Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
5efedf5
feat(config): add initial structure for API v6
jose-filho-azion Oct 29, 2026
6129916
feat(config): add build schema and strategies to API v6
jose-filho-azion Oct 30, 2026
f33e017
feat(config): write the API version to the v3 and v4 manifests
jose-filho-azion Oct 30, 2026
70f18cd
feat(presets): add the v6 config to the javascript preset
jose-filho-azion Oct 30, 2026
6191ea4
feat(config): add applications, functions and rules to API v6
jose-filho-azion Oct 30, 2026
232298e
feat(presets): add the application, functions and rules to the javasc…
jose-filho-azion Oct 30, 2026
c56c767
feat(config): add workloads, environments, deployments, storage and c…
jose-filho-azion Oct 30, 2026
a53d6c0
feat(presets): add the v6 config to the react preset and the workload…
jose-filho-azion Oct 30, 2026
0819361
feat(config): add the function bindings to API v6
jose-filho-azion Nov 3, 2026
77042ed
feat(config): add the application cache settings to API v6
jose-filho-azion Nov 3, 2026
11429bc
feat(presets): add the v6 config to the opennextjs preset and the cac…
jose-filho-azion Nov 3, 2026
9c38734
feat(config): require the environment and deployment policies in API v6
jose-filho-azion Nov 3, 2026
90b2e7a
feat(config): add firewall, waf, network list and custom pages to API v6
jose-filho-azion Nov 3, 2026
405b814
feat(presets): add the v6 config to the eleventy preset
jose-filho-azion Nov 3, 2026
d01376c
feat(config): define the firewall replaced keys of API v6
jose-filho-azion Nov 3, 2026
34168ac
fix(config): declare the item types of the v6 network list schema
jose-filho-azion Nov 4, 2026
01e43b8
feat(config): name the environment and deployment of a workload bindi…
jose-filho-azion Nov 4, 2026
81b9a94
feat(config): add the device groups of an application to API v6
jose-filho-azion Nov 4, 2026
8fb3137
feat(config): add the purge to API v6
jose-filho-azion Nov 4, 2026
72dabdb
chore: add the changeset for the API v6 config
jose-filho-azion Nov 4, 2026
f6ea66f
security(deps): remediate pnpm audit vulnerabilities
jose-filho-azion Nov 4, 2026
954437b
feat(config): use the workload deployments in API v6
jose-filho-azion Nov 5, 2026
0883fdf
chore: describe the workload deployments in the v6 changeset
jose-filho-azion Nov 5, 2026
e3fffe6
feat(presets): add the v6 config to every preset
jose-filho-azion Nov 6, 2026
bc5c1b3
docs(config): document the config of the API v6 with a complete example
jose-filho-azion Nov 6, 2026
da031de
fix(presets): match only the paths without extension in the subpaths …
jose-filho-azion Nov 10, 2026
3f3f23c
feat(config): follow the current openapi-v6-prod in API v6
jose-filho-azion Nov 10, 2026
a8a1210
chore: update the v6 changeset to the current openapi-v6-prod
jose-filho-azion Nov 10, 2026
bcf077e
fix(presets): resolve nuxt manifest from build output with fallbacks
jose-filho-azion Nov 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changeset/config-api-v6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@aziontech/config': minor
'@aziontech/presets': minor
---

Support the Azion API v6 config in the same packages.

- `@aziontech/config`: a config with `version: 6` is now validated and processed into a v6 manifest. v3 and v4 are unchanged, and a config without `version` is still the v4 one. v6 changes the publishing model: Save creates a Draft version and publishing is a separate step, so the config declares `environments` and `deployments` (the environment and deployment policies are required) and workloads with `bindings` (a binding references an environment and a deployment by name). Adds the build, applications (rules, cache settings, function instances and device groups), functions (with bindings), purge, storage, connectors, firewall, WAF, network lists and custom pages. `validateConfig`, `processConfig`, `validateManifest` and `convertJsonConfigToObject` accept v6, and `defineConfig` types the config as `AzionConfigV6`. The v3 and v4 manifests now carry the API version. The v6 API has no `active` in its resources, so the v6 config and manifest do not have it, and the `createSPARules` and `createMPARules` helpers no longer write `active: true` (it is the default of the v4 and v3 rules).
- `@aziontech/presets`: every preset now provides its v6 config in `configs[6]` (`nitro` has no v3 config, as it did not exist on v3). `config` remains the default (v4) config.
5 changes: 5 additions & 0 deletions .changeset/fix-nuxt-manifest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@aziontech/presets': patch
---

Fix the `nuxt` preset prebuild reading a stale or missing manifest. Nuxt >= 4.6 builds into `node_modules/.cache/nuxt/.nuxt` when `.nuxt` already exists, so `.nuxt/manifest/meta` is no longer reliable. The manifest is now read from `.output/public/_nuxt/builds/meta` first, then from the cache dir and `.nuxt`, picking the file that `latest.json` references.
5 changes: 5 additions & 0 deletions .changeset/fix-subpaths-regex.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@aziontech/presets': patch
---

Fix the regex of the "Redirect to index.html for Subpaths" rule of the `nuxt`, `svelte` and `nitro` presets (v4 and v6 configs). It matched files such as `/logo.png` and skipped the paths without extension such as `/about`, because of `[sS]*` (instead of `[\s\S]*`) and an unescaped `.`. It now matches only the paths that do not end with `/` and have no file extension.
17 changes: 13 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,20 @@
"prettier": "^3.9.6",
"typescript": "^5.9.3",
"typescript-eslint": "^8.69.0",
"vite": "^7.3.6",
"vite": "^7.3.7",
"vite-plugin-dts": "^4.5.4"
},
"pnpm": {
"auditConfig": {
"ignoreGhsas": [
"GHSA-gcqx-w48m-w2h4"
]
},
"overrides": {
"lodash": ">=4.18.0",
"postcss": ">=8.5.18",
"fast-uri": ">=4.1.5",
"qs": ">=6.15.2",
"fast-uri": ">=4.2.3",
"qs": ">=6.16.1",
"esbuild": ">=0.28.1",
"source-map-js": ">=1.2.2",
"brace-expansion@1": "^1.1.17",
Expand All @@ -77,7 +82,11 @@
"js-yaml@3>argparse": "^2.0.1",
"@rushstack/ts-command-line>argparse": "^2.0.1",
"@babel/core": ">=7.29.6",
"@babel/plugin-transform-modules-systemjs": ">=7.29.4"
"@babel/plugin-transform-modules-systemjs": ">=7.29.4",
"handlebars": ">=4.7.10",
"vite@7": "^7.3.7",
"minimatch@<11.0.1": ">=11.0.1",
"glob@<14.0.2": ">=14.0.2"
}
},
"workspaces": [
Expand Down
3 changes: 3 additions & 0 deletions packages/config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

This module provides comprehensive configuration and validation for the Azion Platform. It supports applications, workloads, connectors, functions, storage, firewall rules, WAF settings, network lists, custom pages, and purge operations.

> **Config API versions:** the examples below are for the default config (Azion API v4). The package also processes the
> v3 and v6 configs, selected with the `version` field of the config. See [Azion config for the API v6](https://github.com/aziontech/lib/blob/main/packages/config/docs/config-v6.md).

## Table of Contents

- [Installation](#installation)
Expand Down
307 changes: 307 additions & 0 deletions packages/config/docs/config-v6.md

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions packages/config/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
} from './configProcessor/helpers/convertLegacyConfig';
import { AzionConfig } from './types';
import type { AzionConfigV3 } from './versions/v3/types';
import type { AzionConfigV6 } from './versions/v6/types';
import { getApplicationName, getFirewallReplacedKeys, getStorage } from './versions/accessors';
import { getPresetApiVersions, resolvePresetConfig } from './versions/presetConfig';
import {
Expand All @@ -20,7 +21,7 @@ import { DEFAULT_API_VERSION } from './versions/types';
* Helper function to provide IntelliSense for Azion configuration.
* Similar to Vite's defineConfig - provides type safety without runtime overhead.
*
* Declare `version: 3` to get the Azion API v3 types (the remaining v3 types live under the `V3` namespace).
* Declare `version: 3` or `version: 6` to get the types of that Azion API version (the remaining types live under the `V3` and `V6` namespaces).
*
* @param {AnyAzionConfig} config - The configuration object for the Azion Platform.
* @returns {AzionConfig} The same configuration object (no validation or processing)
Expand All @@ -39,8 +40,11 @@ import { DEFAULT_API_VERSION } from './versions/types';
* });
*/
function defineConfig(config: AzionConfigV3): AzionConfigV3;
function defineConfig(config: AzionConfigV6): AzionConfigV6;
function defineConfig(config: AzionConfig): AzionConfig;
function defineConfig(config: AzionConfig | AzionConfigV3): AzionConfig | AzionConfigV3 {
function defineConfig(
config: AzionConfig | AzionConfigV3 | AzionConfigV6,
): AzionConfig | AzionConfigV3 | AzionConfigV6 {
return config;
}

Expand All @@ -67,5 +71,6 @@ export {

export type * from './types';
export type { AnyAzionConfig, ApiVersion, ConfigByVersion, ConfigVersionModule } from './versions/types';
export type { AzionConfigV3 };
export type { AzionConfigV3, AzionConfigV6 };
export type * as V3 from './versions/v3/types';
export type * as V6 from './versions/v6/types';
3 changes: 0 additions & 3 deletions packages/config/src/rules/request/createMPA.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ describe('createMPARules', () => {
expect(staticAssetsRule).toEqual({
name: 'Deliver Static Assets and Set Cache Policy',
description: 'Deliver static assets directly from storage and set cache policy',
active: true,
criteria: [
[
{
Expand Down Expand Up @@ -54,7 +53,6 @@ describe('createMPARules', () => {
expect(directoryIndexRule).toEqual({
name: 'Redirect to index.html',
description: 'Handle directory requests by rewriting to index.html',
active: true,
criteria: [
[
{
Expand Down Expand Up @@ -86,7 +84,6 @@ describe('createMPARules', () => {
expect(subpathIndexRule).toEqual({
name: 'Redirect to index.html for Subpaths',
description: 'Handle subpath requests by rewriting to index.html',
active: true,
criteria: [
[
{
Expand Down
3 changes: 0 additions & 3 deletions packages/config/src/rules/request/createMPA.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export function createMPARules(
{
name: 'Deliver Static Assets and Set Cache Policy',
description: 'Deliver static assets directly from storage and set cache policy',
active: true,
criteria: [
[
{
Expand Down Expand Up @@ -62,7 +61,6 @@ export function createMPARules(
{
name: 'Redirect to index.html',
description: 'Handle directory requests by rewriting to index.html',
active: true,
criteria: [
[
{
Expand Down Expand Up @@ -91,7 +89,6 @@ export function createMPARules(
{
name: 'Redirect to index.html for Subpaths',
description: 'Handle subpath requests by rewriting to index.html',
active: true,
criteria: [
[
{
Expand Down
2 changes: 0 additions & 2 deletions packages/config/src/rules/request/createSPA.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ describe('createSPARules', () => {
expect(staticAssetsRule).toEqual({
name: 'Deliver Static Assets and Set Cache Policy',
description: 'Deliver static assets directly from storage and set cache policy',
active: true,
criteria: [
[
{
Expand Down Expand Up @@ -54,7 +53,6 @@ describe('createSPARules', () => {
expect(indexRedirectRule).toEqual({
name: 'Redirect to index.html',
description: 'Handle all routes by rewriting to index.html for client-side routing',
active: true,
criteria: [
[
{
Expand Down
2 changes: 0 additions & 2 deletions packages/config/src/rules/request/createSPA.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export function createSPARules(
{
name: 'Deliver Static Assets and Set Cache Policy',
description: 'Deliver static assets directly from storage and set cache policy',
active: true,
criteria: [
[
{
Expand Down Expand Up @@ -62,7 +61,6 @@ export function createSPARules(
{
name: 'Redirect to index.html',
description: 'Handle all routes by rewriting to index.html for client-side routing',
active: true,
criteria: [
[
{
Expand Down
43 changes: 43 additions & 0 deletions packages/config/src/versions/accessors.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { describe, expect, it } from '@jest/globals';

import { getApplicationName, getFirewallReplacedKeys, getStorage } from './accessors';
import v4Schema from './v4/schemas/schema';
import v6Schema from './v6/schemas/schema';

const v4 = {
applications: [{ name: 'app-1' }, { name: 'app-2' }],
Expand All @@ -20,6 +22,8 @@ describe('version accessors', () => {
expect(getApplicationName(v4)).toBe('app-1');
expect(getApplicationName({})).toBeUndefined();
expect(getApplicationName(v3)).toBeUndefined();
expect(getApplicationName({ version: 6, applications: [{ name: 'app-6' }] })).toBe('app-6');
expect(getApplicationName({ version: 6 })).toBeUndefined();
});

it('reads the storage where each version keeps it', () => {
Expand All @@ -29,6 +33,28 @@ describe('version accessors', () => {
prefix: '',
});
expect(getStorage(v3)).toEqual({ bucket: 'bucket-3', prefix: 'p3' });
expect(getStorage({ version: 6, storage: [{ name: 'bucket-6', prefix: 'p6', dir: './dist' }] })).toEqual({
bucket: 'bucket-6',
prefix: 'p6',
});
});

it('reads the first v6 storage and falls back to an empty prefix, as the prefix is optional in v6', () => {
expect(getStorage({ version: 6, storage: [{ name: 'bucket-6', dir: './dist' }] })).toEqual({
bucket: 'bucket-6',
prefix: '',
});
expect(
getStorage({
version: 6,
storage: [
{ name: 'first-bucket', dir: './a' },
{ name: 'second-bucket', dir: './b' },
],
}),
).toEqual({ bucket: 'first-bucket', prefix: '' });
expect(getStorage({ version: 6 })).toBeUndefined();
expect(getStorage({ version: 6, storage: [] })).toBeUndefined();
});

it('returns undefined when the config has no storage', () => {
Expand All @@ -50,5 +76,22 @@ describe('version accessors', () => {
it('lists the preset keys a firewall-only project must not inherit', () => {
expect(getFirewallReplacedKeys(4)).toEqual(['applications', 'workloads', 'connectors', 'functions']);
expect(getFirewallReplacedKeys(3)).toEqual(['origin', 'cache', 'rules', 'functions']);
expect(getFirewallReplacedKeys(6)).toEqual([
'applications',
'workloads',
'connectors',
'functions',
'environments',
'deployments',
]);
});

it('lists only keys that exist in the config schema of each version', () => {
const properties = (schema: { definitions: { mainConfig: { properties: object } } }) =>
Object.keys(schema.definitions.mainConfig.properties);
const schemas = { 4: properties(v4Schema), 6: properties(v6Schema) };

getFirewallReplacedKeys(4).forEach((key) => expect(schemas[4]).toContain(key));
getFirewallReplacedKeys(6).forEach((key) => expect(schemas[6]).toContain(key));
});
});
86 changes: 83 additions & 3 deletions packages/config/src/versions/registry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ describe('version dispatch', () => {
expect(processConfig({ ...config, version: 4 })).toEqual(processConfig(config));
});

it('does not leak version into the manifest', () => {
expect(processConfig({ ...config, version: 4 })).not.toHaveProperty('version');
it('writes the version to the manifest, the default one when it is not declared', () => {
expect(processConfig({ ...config, version: 4 })).toHaveProperty('version', 4);
expect(processConfig(config)).toHaveProperty('version', 4);
});

it('rejects a config that declares an unsupported version', () => {
Expand Down Expand Up @@ -106,7 +107,7 @@ describe('v3 support', () => {
expect(manifest).toHaveProperty('origin');
expect(manifest).toHaveProperty('rules');
expect(manifest).not.toHaveProperty('applications');
expect(manifest).not.toHaveProperty('version');
expect(manifest).toHaveProperty('version', 3);
});

it('rejects v3-only fields on a v4 config and vice versa', () => {
Expand All @@ -121,3 +122,82 @@ describe('v3 support', () => {
expect(v4.version).toBeUndefined();
});
});

describe('v6 support', () => {
const v6Config = { version: 6 as const, build: { bundler: 'esbuild' as const } };

it('is registered and selected by `version: 6`', () => {
expect(resolveApiVersion(v6Config)).toBe(6);
expect(getVersionModule(6).version).toBe(6);
expect(SUPPORTED_API_VERSIONS).toContain(6);
});

it('keeps v4 as the default when version is omitted', () => {
expect(DEFAULT_API_VERSION).toBe(4);
expect(resolveApiVersion({ build: {} })).toBe(4);
});

it('validates a v6 config and rejects fields the v6 schema does not know yet', () => {
expect(() => validateConfig(v6Config)).not.toThrow();
expect(() => validateConfig({ version: 6, kv: [] })).toThrow();
});

it('does not accept v6 on the v4 schema nor the other way around', () => {
expect(() => validateConfig({ version: 4, build: {} })).not.toThrow();
expect(() => validateConfig({ version: 6, origin: [] })).toThrow();
});

it('writes the version, the build and the applications to the v6 manifest', () => {
expect(processConfig(v6Config)).toEqual({
version: 6,
build: v6Config.build,
functions: [],
applications: [],
firewall: [],
custom_pages: [],
environments: [],
deployments: [],
workloads: [],
});
});

it('processes the v6 applications into the manifest', () => {
const manifest = processConfig({ ...v6Config, applications: [{ name: 'my-app' }] });
expect(manifest.applications).toEqual([
{
name: 'my-app',
debug: false,
modules: {
cache: { enabled: true },
functions: { enabled: false },
application_accelerator: { enabled: true },
image_processor: { enabled: false },
},
},
]);
});

it('processes the v6 network lists into the network_list key of the manifest', () => {
const manifest = processConfig({
...v6Config,
networkList: [{ name: 'blocked-ips', type: 'ip_cidr', items: ['10.0.0.0/8'] }],
});

expect(manifest.network_list).toEqual([{ name: 'blocked-ips', type: 'ip_cidr', items: ['10.0.0.0/8'] }]);
});

it('forwards the version to manifest helpers', () => {
expect(() => validateManifest({}, undefined, { version: 6 })).not.toThrow();
expect(() => convertJsonConfigToObject('{', { version: 6 })).toThrow('Invalid JSON configuration.');
expect(convertJsonConfigToObject('{}', { version: 6 })).toEqual({ version: 6, firewall: [], applications: [] });
expect(convertJsonConfigToObject(JSON.stringify(processConfig(v6Config)), { version: 6 })).toEqual({
...v6Config,
firewall: [],
applications: [],
});
});

it('types defineConfig by the declared version', () => {
expect(defineConfig(v6Config).version).toBe(6);
});
});
2 changes: 2 additions & 0 deletions packages/config/src/versions/registry.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { ApiVersion, ConfigVersionModule, DEFAULT_API_VERSION } from './types';
import v3 from './v3';
import v4 from './v4';
import v6 from './v6';

const registry: Record<ApiVersion, ConfigVersionModule> = {
3: v3,
4: v4,
6: v6,
};

/**
Expand Down
Loading
Loading