auth0-deploy-cli 8.30.0 → 8.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,7 +6,7 @@ orbs:
6
6
  jobs:
7
7
  e2e_test_as_node_module:
8
8
  docker:
9
- - image: cimg/node:22.12.0
9
+ - image: cimg/node:22.19.0
10
10
  working_directory: ~/repo
11
11
  steps:
12
12
  - checkout
@@ -15,7 +15,7 @@ jobs:
15
15
 
16
16
  e2e_test_as_cli:
17
17
  docker:
18
- - image: cimg/node:22.12.0
18
+ - image: cimg/node:22.19.0
19
19
  working_directory: ~/repo
20
20
  steps:
21
21
  - checkout
@@ -45,21 +45,31 @@ jobs:
45
45
  - run: npm run test:coverage
46
46
  - persist_to_workspace:
47
47
  root: ~/repo
48
- paths: .
48
+ paths:
49
+ - .
49
50
  - codecov/upload
50
51
 
51
52
  does_typescript_compile:
52
53
  docker:
53
- - image: cimg/node:22.12.0
54
+ - image: cimg/node:22.19.0
54
55
  working_directory: ~/repo
55
56
  steps:
56
57
  - checkout
57
58
  - run: npm i
58
59
  - run: npx tsc --noEmit
59
60
 
61
+ does_format_pass:
62
+ docker:
63
+ - image: cimg/node:22.19.0
64
+ working_directory: ~/repo
65
+ steps:
66
+ - checkout
67
+ - run: npm i
68
+ - run: npm run format:check
69
+
60
70
  does_lint_pass:
61
71
  docker:
62
- - image: cimg/node:22.12.0
72
+ - image: cimg/node:22.19.0
63
73
  working_directory: ~/repo
64
74
  steps:
65
75
  - checkout
@@ -83,6 +93,8 @@ workflows:
83
93
  jobs:
84
94
  - does_typescript_compile:
85
95
  name: Does Typescript compile?
96
+ - does_format_pass:
97
+ name: Does format pass?
86
98
  - does_lint_pass:
87
99
  name: Does lint pass?
88
100
  - unit_test:
package/AGENTS.md CHANGED
@@ -63,7 +63,7 @@ npm run build && node lib/index.js import -c config-dev.json -i ./local-export/t
63
63
 
64
64
  ### File Structure
65
65
 
66
- ```
66
+ ```text
67
67
  src/ # TypeScript source
68
68
  ├── index.ts # CLI entry point
69
69
  ├── commands/ # import.ts, export.ts
@@ -225,6 +225,26 @@ npm run lint
225
225
  - [ ] Tested with both YAML and directory formats if applicable
226
226
  - [ ] Checked backward compatibility
227
227
 
228
+ ### Checklist for Every Feature or Fix
229
+
230
+ #### Completion
231
+
232
+ - [ ] Change is complete and matches the intended feature or fix
233
+ - [ ] TypeScript compiles and tests pass locally
234
+
235
+ #### Format and behavior
236
+
237
+ - [ ] Works for both YAML and directory flows when the resource supports both
238
+ - [ ] Keyword preservation still works as expected
239
+ - [ ] Sorted-key output stays stable; no unintended order changes were introduced
240
+ - [ ] Exported configs do not rely on IDs by default; resources should link by names where possible
241
+
242
+ #### Safety and compatibility
243
+
244
+ - [ ] Dry-run output is correct and non-destructive
245
+ - [ ] Unit tests cover the changed path and any important edge cases
246
+ - [ ] Backward compatibility was checked and no existing behavior was unintentionally broken
247
+
228
248
  ### Commit Message Format
229
249
 
230
250
  Follow conventional commits style:
package/CHANGELOG.md CHANGED
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [8.31.0] - 2026-04-10
11
+
12
+ ### Added
13
+
14
+ - Add support for `is_default` on `customDomains`. [#1330]
15
+ - Add `AUTH0_EXPORT_ORDERED` config property and `--export_ordered` flag for stable exports. [#1335]
16
+
17
+ ### Fixed
18
+
19
+ - Fix `clientGrants` matching when multiple grants share the same `client_id` and `audience`. [#1341]
20
+
10
21
  ## [8.30.0] - 2026-04-02
11
22
 
12
23
  ### Added
@@ -1710,7 +1721,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1710
1721
  [#1340]: https://github.com/auth0/auth0-deploy-cli/issues/1340
1711
1722
  [#1342]: https://github.com/auth0/auth0-deploy-cli/issues/1342
1712
1723
  [#1343]: https://github.com/auth0/auth0-deploy-cli/issues/1343
1713
- [Unreleased]: https://github.com/auth0/auth0-deploy-cli/compare/v8.30.0...HEAD
1724
+ [Unreleased]: https://github.com/auth0/auth0-deploy-cli/compare/v8.31.0...HEAD
1725
+ [8.31.0]: https://github.com/auth0/auth0-deploy-cli/compare/v8.30.0...v8.31.0
1714
1726
  [8.30.0]: https://github.com/auth0/auth0-deploy-cli/compare/v8.29.3...v8.30.0
1715
1727
  [8.29.3]: https://github.com/auth0/auth0-deploy-cli/compare/v8.29.2...v8.29.3
1716
1728
  [8.29.2]: https://github.com/auth0/auth0-deploy-cli/compare/v8.29.1...v8.29.2
package/CLAUDE.md ADDED
@@ -0,0 +1,3 @@
1
+ # For project context see
2
+
3
+ - [AGENTS.md](./AGENTS.md)
package/lib/args.d.ts CHANGED
@@ -16,6 +16,7 @@ type ExportSpecificParams = {
16
16
  format: 'yaml' | 'directory';
17
17
  output_folder: string;
18
18
  export_ids?: boolean;
19
+ export_ordered?: boolean;
19
20
  };
20
21
  export type ExportParams = ExportSpecificParams & SharedParams;
21
22
  export type ImportParams = ImportSpecificParams & SharedParams;
package/lib/args.js CHANGED
@@ -83,6 +83,11 @@ function getParams() {
83
83
  type: 'boolean',
84
84
  default: false,
85
85
  },
86
+ export_ordered: {
87
+ alias: 's',
88
+ describe: 'Order keys in exported JSON files for consistent diffs.',
89
+ type: 'boolean',
90
+ },
86
91
  })
87
92
  .example('$0 export -c config.json -f yaml -o path/to/export', 'Dump Auth0 config to folder in YAML format')
88
93
  .example('$0 export -c config.json -f directory -o path/to/export', 'Dump Auth0 config to folder in directory format')
@@ -11,7 +11,7 @@ const logger_1 = __importDefault(require("../logger"));
11
11
  const utils_1 = require("../utils");
12
12
  const index_1 = require("../context/index");
13
13
  async function exportCMD(params) {
14
- const { output_folder: outputFolder, base_path: basePath, config_file: configFile, config: configObj, export_ids: exportIds, secret: clientSecret, env: shouldInheritEnv = false, experimental_ea: experimentalEA, } = params;
14
+ const { output_folder: outputFolder, base_path: basePath, config_file: configFile, config: configObj, export_ids: exportIds, export_ordered: exportOrdered, secret: clientSecret, env: shouldInheritEnv = false, experimental_ea: experimentalEA, } = params;
15
15
  if (shouldInheritEnv) {
16
16
  nconf_1.default.env().use('memory');
17
17
  }
@@ -32,6 +32,10 @@ async function exportCMD(params) {
32
32
  if (exportIds) {
33
33
  overrides.AUTH0_EXPORT_IDENTIFIERS = exportIds;
34
34
  }
35
+ // Allow passed in export_ordered to override the configured one
36
+ if (exportOrdered) {
37
+ overrides.AUTH0_EXPORT_ORDERED = exportOrdered;
38
+ }
35
39
  // Overrides AUTH0_INCLUDE_EXPERIMENTAL_EA is experimental_ea passed in command line
36
40
  if (experimentalEA) {
37
41
  overrides.AUTH0_EXPERIMENTAL_EA = experimentalEA;
@@ -99,8 +99,7 @@ async function dump(context) {
99
99
  // Dump template metadata
100
100
  const name = (0, utils_1.sanitize)(action.name);
101
101
  const actionFile = path_1.default.join(actionsFolder, `${name}.json`);
102
- logger_1.default.info(`Writing ${actionFile}`);
103
- fs_extra_1.default.writeFileSync(actionFile, JSON.stringify(mapToAction(context.filePath, action, includeIdentifiers), null, 2));
102
+ (0, utils_1.dumpJSON)(actionFile, mapToAction(context.filePath, action, includeIdentifiers));
104
103
  });
105
104
  }
106
105
  const actionsHandler = {
@@ -7,7 +7,6 @@ const path_1 = __importDefault(require("path"));
7
7
  const fs_extra_1 = __importDefault(require("fs-extra"));
8
8
  const tools_1 = require("../../../tools");
9
9
  const utils_1 = require("../../../utils");
10
- const logger_1 = __importDefault(require("../../../logger"));
11
10
  function parse(context) {
12
11
  const triggersFolder = path_1.default.join(context.filePath, tools_1.constants.TRIGGERS_DIRECTORY);
13
12
  if (!(0, utils_1.existsMustBeDir)(triggersFolder))
@@ -29,8 +28,7 @@ async function dump(context) {
29
28
  const triggersFolder = path_1.default.join(context.filePath, tools_1.constants.TRIGGERS_DIRECTORY);
30
29
  fs_extra_1.default.ensureDirSync(triggersFolder);
31
30
  const triggerFile = path_1.default.join(triggersFolder, 'triggers.json');
32
- logger_1.default.info(`Writing ${triggerFile}`);
33
- fs_extra_1.default.writeFileSync(triggerFile, JSON.stringify(triggers, null, 2));
31
+ (0, utils_1.dumpJSON)(triggerFile, triggers);
34
32
  }
35
33
  const triggersHandler = {
36
34
  parse,
@@ -183,7 +183,8 @@ class YAMLContext {
183
183
  cleaned = (0, utils_1.stripIdentifiers)(auth0, cleaned);
184
184
  }
185
185
  // Write YAML File
186
- const raw = js_yaml_1.default.dump(cleaned);
186
+ const exportOrdered = Boolean(this.config.AUTH0_EXPORT_ORDERED);
187
+ const raw = js_yaml_1.default.dump(cleaned, { sortKeys: exportOrdered });
187
188
  logger_1.default.info(`Writing ${this.configFile}`);
188
189
  fs_extra_1.default.writeFileSync(this.configFile, raw);
189
190
  }
@@ -84,7 +84,9 @@ class ClientGrantsHandler extends default_1.default {
84
84
  type: 'clientGrants',
85
85
  id: 'id',
86
86
  // @ts-ignore because not sure why two-dimensional array passed in
87
- identifiers: ['id', ['client_id', 'audience']],
87
+ // Try ['client_id', 'audience', 'subject_type'] first; falls through to
88
+ // ['client_id', 'audience'] when subject_type is null (falsy).
89
+ identifiers: ['id', ['client_id', 'audience', 'subject_type'], ['client_id', 'audience']],
88
90
  stripUpdateFields: ['audience', 'client_id', 'subject_type', 'is_system'],
89
91
  });
90
92
  }
@@ -155,6 +157,31 @@ class ClientGrantsHandler extends default_1.default {
155
157
  ...assets,
156
158
  clientGrants: formatted,
157
159
  });
160
+ // subject_type is immutable (in stripUpdateFields). Grants matched via the
161
+ // ['client_id', 'audience'] fallback with a mismatched subject_type must become
162
+ // DELETE + CREATE, not UPDATE, so the tenant converges to the desired state.
163
+ const subjectTypeMismatches = update.filter((localGrant) => {
164
+ // Only flag when local explicitly specifies subject_type (backward compat).
165
+ if (localGrant.subject_type === undefined)
166
+ return false;
167
+ const remoteGrant = (this.existing || []).find((e) => e.id === localGrant.id);
168
+ return (remoteGrant && (remoteGrant.subject_type ?? null) !== (localGrant.subject_type ?? null));
169
+ });
170
+ const adjustedUpdate = update.filter((u) => !subjectTypeMismatches.includes(u));
171
+ const adjustedDel = [
172
+ ...del,
173
+ ...subjectTypeMismatches
174
+ .map((u) => (this.existing || []).find((e) => e.id === u.id))
175
+ .filter((e) => e !== undefined),
176
+ ];
177
+ const adjustedCreate = [
178
+ ...create,
179
+ ...subjectTypeMismatches
180
+ .map((u) => formatted.find((f) => f.client_id === u.client_id &&
181
+ f.audience === u.audience &&
182
+ (f.subject_type ?? null) === (u.subject_type ?? null)))
183
+ .filter((g) => g !== undefined),
184
+ ];
158
185
  const filterGrants = (list) => {
159
186
  let filtered = list;
160
187
  // Filter out the current client (Auth0 Management API client)
@@ -174,11 +201,11 @@ class ClientGrantsHandler extends default_1.default {
174
201
  };
175
202
  const changes = {
176
203
  // @ts-ignore because this expects `client_id` and that's not yet typed on Asset
177
- del: filterGrants(del),
204
+ del: filterGrants(adjustedDel),
178
205
  // @ts-ignore because this expects `client_id` and that's not yet typed on Asset
179
- update: filterGrants(update),
206
+ update: filterGrants(adjustedUpdate),
180
207
  // @ts-ignore because this expects `client_id` and that's not yet typed on Asset
181
- create: filterGrants(create),
208
+ create: filterGrants(adjustedCreate),
182
209
  // @ts-ignore because this expects `client_id` and that's not yet typed on Asset
183
210
  conflicts: filterGrants(conflicts),
184
211
  };
@@ -19,7 +19,6 @@ export declare const schema: {
19
19
  properties: {
20
20
  dpop_signing_alg: {
21
21
  type: string;
22
- enum: ("ES256" | "Ed25519")[];
23
22
  };
24
23
  };
25
24
  };
@@ -56,7 +56,6 @@ const connectionOptionsSchema = {
56
56
  properties: {
57
57
  dpop_signing_alg: {
58
58
  type: 'string',
59
- enum: Object.values(auth0_1.Management.ConnectionDpopSigningAlgEnum),
60
59
  },
61
60
  },
62
61
  };
@@ -50,6 +50,10 @@ export declare const schema: {
50
50
  type: string[];
51
51
  description: string;
52
52
  };
53
+ is_default: {
54
+ type: string;
55
+ description: string;
56
+ };
53
57
  };
54
58
  required: string[];
55
59
  };
@@ -60,6 +64,7 @@ export default class CustomDomainsHadnler extends DefaultAPIHandler {
60
64
  constructor(config: DefaultAPIHandler);
61
65
  objString(item: Asset): string;
62
66
  getType(): Promise<Asset | null>;
67
+ validate(assets: Assets): Promise<void>;
63
68
  processChanges(assets: Assets): Promise<void>;
64
69
  }
65
70
  export {};
@@ -44,6 +44,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
44
44
  Object.defineProperty(exports, "__esModule", { value: true });
45
45
  exports.schema = void 0;
46
46
  const default_1 = __importStar(require("./default"));
47
+ const validationError_1 = __importDefault(require("../../validationError"));
47
48
  const logger_1 = __importDefault(require("../../../logger"));
48
49
  exports.schema = {
49
50
  type: 'array',
@@ -81,6 +82,10 @@ exports.schema = {
81
82
  type: ['string'],
82
83
  description: 'Relying Party ID (rpId) to be used for Passkeys on this custom domain. If not provided or set to null, the full domain will be used.',
83
84
  },
85
+ is_default: {
86
+ type: 'boolean',
87
+ description: 'Whether this custom domain is the default domain used for email notifications.',
88
+ },
84
89
  },
85
90
  required: ['domain', 'type'],
86
91
  },
@@ -136,6 +141,16 @@ class CustomDomainsHadnler extends default_1.default {
136
141
  throw err;
137
142
  }
138
143
  }
144
+ async validate(assets) {
145
+ await super.validate(assets);
146
+ const { customDomains } = assets;
147
+ if (!customDomains)
148
+ return;
149
+ const defaultDomains = customDomains.filter((d) => d.is_default === true);
150
+ if (defaultDomains.length > 1) {
151
+ throw new validationError_1.default(`Only one custom domain can be set as default (is_default: true), but found ${defaultDomains.length}: ${defaultDomains.map((d) => d.domain).join(', ')}`);
152
+ }
153
+ }
139
154
  async processChanges(assets) {
140
155
  const { customDomains } = assets;
141
156
  if (!customDomains)
@@ -149,6 +164,17 @@ class CustomDomainsHadnler extends default_1.default {
149
164
  }
150
165
  const changes = await this.calcChanges(assets);
151
166
  await super.processChanges(assets, changes);
167
+ // If a domain is marked as is_default, set it as the tenant's default custom domain.
168
+ const defaultDomain = customDomains.find((d) => d.is_default === true);
169
+ if (defaultDomain) {
170
+ try {
171
+ await this.client.customDomains.setDefault({ domain: defaultDomain.domain });
172
+ logger_1.default.info(`Set default custom domain: ${defaultDomain.domain}`);
173
+ }
174
+ catch (err) {
175
+ throw new Error(`Problem setting default custom domain ${defaultDomain.domain}\n${err}`);
176
+ }
177
+ }
152
178
  }
153
179
  }
154
180
  exports.default = CustomDomainsHadnler;
@@ -198,6 +198,11 @@ class TenantHandler extends default_1.default {
198
198
  delete updatedTenant.flags;
199
199
  }
200
200
  }
201
+ if (tenant.flags?.enable_custom_domain_in_emails !== undefined) {
202
+ logger_1.default.warn('The "enable_custom_domain_in_emails" tenant flag is deprecated. ' +
203
+ 'Use the "is_default" field on customDomains to configure the default domain instead. ' +
204
+ 'The flag will still be applied for now but will be removed in a future release.');
205
+ }
201
206
  if (updatedTenant && Object.keys(updatedTenant).length > 0) {
202
207
  await this.client.tenants.settings.update(updatedTenant);
203
208
  this.updated += 1;
package/lib/types.d.ts CHANGED
@@ -71,6 +71,7 @@ export type Config = {
71
71
  AUTH0_RETRY_MAX_DELAY_MS?: number;
72
72
  AUTH0_KEYWORD_REPLACE_MAPPINGS?: KeywordMappings;
73
73
  AUTH0_EXPORT_IDENTIFIERS?: boolean;
74
+ AUTH0_EXPORT_ORDERED?: boolean;
74
75
  AUTH0_CONNECTIONS_DIRECTORY?: string;
75
76
  EXCLUDED_PROPS?: {
76
77
  [key: string]: string[];
package/lib/utils.js CHANGED
@@ -24,6 +24,7 @@ exports.mapClientID2NameSorted = mapClientID2NameSorted;
24
24
  exports.nomalizedYAMLPath = nomalizedYAMLPath;
25
25
  const path_1 = __importDefault(require("path"));
26
26
  const fs_extra_1 = __importDefault(require("fs-extra"));
27
+ const nconf_1 = __importDefault(require("nconf"));
27
28
  const sanitize_filename_1 = __importDefault(require("sanitize-filename"));
28
29
  const dot_prop_1 = __importDefault(require("dot-prop"));
29
30
  const lodash_1 = require("lodash");
@@ -69,10 +70,21 @@ function loadJSON(file, opts = {
69
70
  throw new Error(`Error parsing JSON from metadata file: ${file}, because: ${e.message}`);
70
71
  }
71
72
  }
73
+ function orderedKeysReplacer(_key, value) {
74
+ if (value && typeof value === 'object' && !Array.isArray(value)) {
75
+ const obj = value;
76
+ return Object.fromEntries(Object.keys(obj)
77
+ .sort()
78
+ .map((k) => [k, obj[k]]));
79
+ }
80
+ return value;
81
+ }
72
82
  function dumpJSON(file, mappings) {
73
83
  try {
74
84
  logger_1.default.info(`Writing ${file}`);
75
- const jsonBody = JSON.stringify(mappings, null, 2);
85
+ const exportOrdered = Boolean(nconf_1.default.get('AUTH0_EXPORT_ORDERED'));
86
+ const replacer = exportOrdered ? orderedKeysReplacer : undefined;
87
+ const jsonBody = JSON.stringify(mappings, replacer, 2);
76
88
  fs_extra_1.default.writeFileSync(file, jsonBody.endsWith('\n') ? jsonBody : `${jsonBody}\n`);
77
89
  }
78
90
  catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "auth0-deploy-cli",
3
- "version": "8.30.0",
3
+ "version": "8.31.0",
4
4
  "description": "A command line tool for deploying updates to your Auth0 tenant",
5
5
  "main": "lib/index.js",
6
6
  "bin": {
@@ -9,6 +9,7 @@
9
9
  "scripts": {
10
10
  "lint:fix": "eslint --fix . && kacl lint",
11
11
  "lint": "eslint . && kacl lint",
12
+ "format:check": "npx prettier --check .",
12
13
  "format": "npx prettier --write .",
13
14
  "test": "ts-mocha -p tsconfig.json --recursive 'test/**/*.test*' --exclude 'test/e2e/*' --timeout 20000",
14
15
  "test:e2e:node-module": "ts-mocha -p tsconfig.json --recursive 'test/e2e/*.test*' --timeout 150000",
@@ -33,15 +34,15 @@
33
34
  "homepage": "https://github.com/auth0/auth0-deploy-cli#readme",
34
35
  "dependencies": {
35
36
  "ajv": "^6.12.6",
36
- "auth0": "^5.5.0",
37
+ "auth0": "^5.6.0",
37
38
  "dot-prop": "^5.3.0",
38
39
  "fs-extra": "^10.1.0",
39
40
  "js-yaml": "^4.1.1",
40
- "lodash": "^4.17.23",
41
+ "lodash": "^4.18.1",
41
42
  "mkdirp": "^1.0.4",
42
43
  "nconf": "^0.13.0",
43
44
  "promise-pool-executor": "^1.1.1",
44
- "sanitize-filename": "^1.6.3",
45
+ "sanitize-filename": "^1.6.4",
45
46
  "undici": "^7.24.3",
46
47
  "winston": "^3.19.0",
47
48
  "yargs": "^15.4.1"
@@ -52,8 +53,8 @@
52
53
  "@types/lodash": "^4.17.24",
53
54
  "@types/mocha": "^10.0.10",
54
55
  "@types/nconf": "^0.10.7",
55
- "@typescript-eslint/eslint-plugin": "^8.57.0",
56
- "@typescript-eslint/parser": "^8.57.0",
56
+ "@typescript-eslint/eslint-plugin": "^8.58.0",
57
+ "@typescript-eslint/parser": "^8.58.0",
57
58
  "chai": "^4.5.0",
58
59
  "chai-as-promised": "^7.1.2",
59
60
  "eslint": "^9.39.2",