auth0-deploy-cli 8.43.0 → 8.45.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.
Files changed (50) hide show
  1. package/CHANGELOG.md +53 -1
  2. package/README.md +1 -1
  3. package/lib/context/defaults.d.ts +7 -0
  4. package/lib/context/defaults.js +74 -30
  5. package/lib/context/directory/handlers/attackProtection.js +1 -1
  6. package/lib/context/directory/handlers/branding.js +9 -1
  7. package/lib/context/directory/handlers/clients.js +9 -3
  8. package/lib/context/directory/handlers/connections.js +10 -4
  9. package/lib/context/directory/handlers/emailTemplates.js +9 -0
  10. package/lib/context/directory/handlers/index.js +2 -0
  11. package/lib/context/directory/handlers/networkACLKeys.d.ts +6 -0
  12. package/lib/context/directory/handlers/networkACLKeys.js +54 -0
  13. package/lib/context/directory/handlers/prompts.js +11 -3
  14. package/lib/context/yaml/handlers/attackProtection.js +1 -1
  15. package/lib/context/yaml/handlers/branding.js +8 -1
  16. package/lib/context/yaml/handlers/clients.js +4 -1
  17. package/lib/context/yaml/handlers/connections.js +3 -1
  18. package/lib/context/yaml/handlers/flows.js +7 -0
  19. package/lib/context/yaml/handlers/forms.js +7 -0
  20. package/lib/context/yaml/handlers/index.js +2 -0
  21. package/lib/context/yaml/handlers/networkACLKeys.d.ts +6 -0
  22. package/lib/context/yaml/handlers/networkACLKeys.js +42 -0
  23. package/lib/context/yaml/handlers/prompts.js +7 -1
  24. package/lib/keywordPreservation.d.ts +1 -1
  25. package/lib/keywordPreservation.js +2 -1
  26. package/lib/readonly.js +5 -0
  27. package/lib/tools/auth0/handlers/attackProtection.js +3 -1
  28. package/lib/tools/auth0/handlers/clients.d.ts +40 -0
  29. package/lib/tools/auth0/handlers/clients.js +58 -1
  30. package/lib/tools/auth0/handlers/connectionProfiles.d.ts +27 -0
  31. package/lib/tools/auth0/handlers/connectionProfiles.js +30 -0
  32. package/lib/tools/auth0/handlers/connections.js +10 -3
  33. package/lib/tools/auth0/handlers/databases.d.ts +28 -0
  34. package/lib/tools/auth0/handlers/databases.js +47 -22
  35. package/lib/tools/auth0/handlers/default.d.ts +23 -0
  36. package/lib/tools/auth0/handlers/default.js +21 -10
  37. package/lib/tools/auth0/handlers/index.js +2 -0
  38. package/lib/tools/auth0/handlers/networkACLKeys.d.ts +45 -0
  39. package/lib/tools/auth0/handlers/networkACLKeys.js +177 -0
  40. package/lib/tools/auth0/handlers/networkACLs.d.ts +114 -2
  41. package/lib/tools/auth0/handlers/networkACLs.js +91 -16
  42. package/lib/tools/auth0/handlers/organizations.d.ts +1 -1
  43. package/lib/tools/auth0/handlers/organizations.js +49 -20
  44. package/lib/tools/auth0/handlers/phoneProvider.js +10 -2
  45. package/lib/tools/calculateDryRunChanges.js +12 -8
  46. package/lib/tools/constants.d.ts +1 -0
  47. package/lib/tools/constants.js +1 -0
  48. package/lib/types.d.ts +3 -1
  49. package/lib/utils.js +5 -2
  50. package/package.json +2 -2
@@ -202,12 +202,20 @@ class PhoneProviderHandler extends default_1.default {
202
202
  }
203
203
  const currentProviders = await this.getPhoneProviders();
204
204
  const providerReqPayload = (() => {
205
+ // Work on a shallow copy so we don't mutate the caller's asset (phoneProviders[0]).
206
+ // The SDK response type doesn't declare `credentials`, so widen it here.
207
+ const payload = { ...phoneProviders[0] };
205
208
  // Removing id from update and create payloads, otherwise API will error
206
209
  // id may be required to handle if `--export_ids=true`
207
- const payload = phoneProviders[0];
208
- if (payload && 'id' in payload) {
210
+ if ('id' in payload) {
209
211
  delete payload.id;
210
212
  }
213
+ // The `custom` provider requires a `credentials` object in the payload even
214
+ // when it is empty. Exported configs omit credentials, so inject an empty
215
+ // object here to avoid a "Missing required property: credentials" 400 error.
216
+ if (payload.name === 'custom' && payload.credentials == null) {
217
+ payload.credentials = {};
218
+ }
211
219
  return payload;
212
220
  })();
213
221
  if (currentProviders === null || currentProviders.length === 0) {
@@ -108,6 +108,13 @@ function normalizeArrayValues(values) {
108
108
  .map((value) => normalizeValue(value))
109
109
  .sort((left, right) => JSON.stringify(left).localeCompare(JSON.stringify(right)));
110
110
  }
111
+ /**
112
+ * Serializes a value to a human-readable string for use in diff messages.
113
+ * Objects and arrays are JSON-stringified to avoid "[object Object]" output.
114
+ */
115
+ function formatDiffValue(value) {
116
+ return typeof value === 'object' && value !== null ? JSON.stringify(value) : String(value);
117
+ }
111
118
  /**
112
119
  * Writes the accumulated diff log to a JSON file on disk.
113
120
  * Useful for CI pipelines that want a machine-readable dry-run report.
@@ -179,7 +186,7 @@ function getObjectDifferences(localObj, remoteObj, keyObjPath = '', resourceType
179
186
  differences.push(...nestedDifferences);
180
187
  }
181
188
  else if (item !== normalizedRemoteValue[index]) {
182
- const message = `Array item difference at [${currentPath}[${index}]]: local:${item} vs remote:${normalizedRemoteValue[index]}`;
189
+ const message = `Array item difference at [${currentPath}[${index}]]: local:${formatDiffValue(item)} vs remote:${formatDiffValue(normalizedRemoteValue[index])}`;
183
190
  differences.push(message);
184
191
  }
185
192
  });
@@ -204,13 +211,10 @@ function getObjectDifferences(localObj, remoteObj, keyObjPath = '', resourceType
204
211
  differences.push(...nestedDifferences);
205
212
  return;
206
213
  }
207
- // Compare primitive values — omit array indices from path to reduce log noise
214
+ // Compare primitive values
208
215
  if (localValue !== remoteValue) {
209
- let arrayPathRegex = new RegExp(/\[\d+\]/g);
210
- if (!arrayPathRegex.test(currentPath)) {
211
- const message = `Value difference for [${currentPath}]: local:${localValue} vs remote:${remoteValue}`;
212
- differences.push(message);
213
- }
216
+ const message = `Value difference for [${currentPath}]: local:${localValue} vs remote:${remoteValue}`;
217
+ differences.push(message);
214
218
  }
215
219
  });
216
220
  return differences;
@@ -242,7 +246,7 @@ function calculateDryRunChanges({ type, assets, existing, identifiers = ['id', '
242
246
  const create = [];
243
247
  const conflicts = [];
244
248
  const localAssets = (Array.isArray(assets) ? [...assets] : [assets]).map((asset) => type === 'tenant' ? normalizeTenantForDryRun(asset) : asset);
245
- const remoteAssets = (Array.isArray(existing) ? [...existing] : [existing]).map((asset) => (type === 'tenant' ? normalizeTenantForDryRun(asset) : asset));
249
+ const remoteAssets = (Array.isArray(existing) ? [...existing] : existing ? [existing] : []).map((asset) => (type === 'tenant' ? normalizeTenantForDryRun(asset) : asset));
246
250
  // Helper: returns true if a local and remote asset share at least one identifier value
247
251
  const assetsMatch = (localAsset, remoteAsset) => identifiers.some((id) => {
248
252
  if (Array.isArray(id)) {
@@ -86,6 +86,7 @@ declare const constants: {
86
86
  FLOWS_VAULT_DIRECTORY: string;
87
87
  SELF_SERVICE_PROFILE_DIRECTORY: string;
88
88
  NETWORK_ACLS_DIRECTORY: string;
89
+ NETWORK_ACL_KEYS_DIRECTORY: string;
89
90
  USER_ATTRIBUTE_PROFILES_DIRECTORY: string;
90
91
  CONNECTION_PROFILES_DIRECTORY: string;
91
92
  TOKEN_EXCHANGE_PROFILES_DIRECTORY: string;
@@ -216,6 +216,7 @@ const constants = {
216
216
  FLOWS_VAULT_DIRECTORY: 'flow-vault-connections',
217
217
  SELF_SERVICE_PROFILE_DIRECTORY: 'self-service-profiles',
218
218
  NETWORK_ACLS_DIRECTORY: 'network-acls',
219
+ NETWORK_ACL_KEYS_DIRECTORY: 'network-acl-keys',
219
220
  USER_ATTRIBUTE_PROFILES_DIRECTORY: 'user-attribute-profiles',
220
221
  CONNECTION_PROFILES_DIRECTORY: 'connection-profiles',
221
222
  TOKEN_EXCHANGE_PROFILES_DIRECTORY: 'token-exchange-profiles',
package/lib/types.d.ts CHANGED
@@ -16,6 +16,7 @@ import { SsProfileWithCustomText } from './tools/auth0/handlers/selfServiceProfi
16
16
  import { PhoneProvider } from './tools/auth0/handlers/phoneProvider';
17
17
  import { PhoneTemplate } from './tools/auth0/handlers/phoneTemplates';
18
18
  import { NetworkACL } from './tools/auth0/handlers/networkACLs';
19
+ import { NetworkAclKey } from './tools/auth0/handlers/networkACLKeys';
19
20
  import { UserAttributeProfile } from './tools/auth0/handlers/userAttributeProfiles';
20
21
  import { AttackProtection } from './tools/auth0/handlers/attackProtection';
21
22
  import { TokenExchangeProfile } from './tools/auth0/handlers/tokenExchangeProfiles';
@@ -156,6 +157,7 @@ export type Assets = Partial<{
156
157
  flows: Flow[] | null;
157
158
  flowVaultConnections: FlowVaultConnection[] | null;
158
159
  selfServiceProfiles: SsProfileWithCustomText[] | null;
160
+ networkACLKeys: NetworkAclKey[] | null;
159
161
  networkACLs: NetworkACL[] | null;
160
162
  userAttributeProfiles: UserAttributeProfile[] | null;
161
163
  userAttributeProfilesWithId: UserAttributeProfile[] | null;
@@ -183,7 +185,7 @@ export type DetailedDryRunChanges = {
183
185
  changes: DetailedDryRunChange[];
184
186
  };
185
187
  };
186
- export type AssetTypes = 'rules' | 'rulesConfigs' | 'hooks' | 'pages' | 'databases' | 'clientGrants' | 'resourceServers' | 'clients' | 'connections' | 'tenant' | 'emailProvider' | 'emailTemplates' | 'guardianFactors' | 'guardianFactorProviders' | 'guardianFactorTemplates' | 'guardianPhoneFactorMessageTypes' | 'guardianPhoneFactorSelectedProvider' | 'guardianPolicies' | 'roles' | 'actions' | 'actionModules' | 'organizations' | 'triggers' | 'attackProtection' | 'riskAssessment' | 'branding' | 'phoneProviders' | 'phoneTemplates' | 'logStreams' | 'prompts' | 'customDomains' | 'themes' | 'forms' | 'flows' | 'flowVaultConnections' | 'selfServiceProfiles' | 'networkACLs' | 'userAttributeProfiles' | 'connectionProfiles' | 'tokenExchangeProfiles' | 'supplementalSignals' | 'rateLimitPolicies' | 'eventStreams' | 'clientAuthCredentials';
188
+ export type AssetTypes = 'rules' | 'rulesConfigs' | 'hooks' | 'pages' | 'databases' | 'clientGrants' | 'resourceServers' | 'clients' | 'connections' | 'tenant' | 'emailProvider' | 'emailTemplates' | 'guardianFactors' | 'guardianFactorProviders' | 'guardianFactorTemplates' | 'guardianPhoneFactorMessageTypes' | 'guardianPhoneFactorSelectedProvider' | 'guardianPolicies' | 'roles' | 'actions' | 'actionModules' | 'organizations' | 'triggers' | 'attackProtection' | 'riskAssessment' | 'branding' | 'phoneProviders' | 'phoneTemplates' | 'logStreams' | 'prompts' | 'customDomains' | 'themes' | 'forms' | 'flows' | 'flowVaultConnections' | 'selfServiceProfiles' | 'networkACLKeys' | 'networkACLs' | 'userAttributeProfiles' | 'connectionProfiles' | 'tokenExchangeProfiles' | 'supplementalSignals' | 'rateLimitPolicies' | 'eventStreams' | 'clientAuthCredentials';
187
189
  export type KeywordMappings = {
188
190
  [key: string]: (string | number)[] | string | number;
189
191
  };
package/lib/utils.js CHANGED
@@ -301,12 +301,15 @@ exports.decodeBase64ToCertString = decodeBase64ToCertString;
301
301
  // Format connection options by converting client IDs to client names for SAML connections
302
302
  const getFormattedOptions = (connection, clients) => {
303
303
  try {
304
+ const { idpinitiated } = connection.options;
304
305
  return {
305
306
  options: {
306
307
  ...connection.options,
307
308
  idpinitiated: {
308
- ...connection.options.idpinitiated,
309
- client_id: convertClientIdToName(connection.options.idpinitiated.client_id, clients),
309
+ ...idpinitiated,
310
+ ...(idpinitiated.client_id && {
311
+ client_id: convertClientIdToName(idpinitiated.client_id, clients),
312
+ }),
310
313
  },
311
314
  },
312
315
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "auth0-deploy-cli",
3
- "version": "8.43.0",
3
+ "version": "8.45.0",
4
4
  "description": "A command line tool for deploying updates to your Auth0 tenant",
5
5
  "main": "lib/index.js",
6
6
  "bin": {
@@ -35,7 +35,7 @@
35
35
  "dependencies": {
36
36
  "@clack/prompts": "1.4.0",
37
37
  "ajv": "^6.12.6",
38
- "auth0": "^6.2.0",
38
+ "auth0": "^6.4.0",
39
39
  "chalk": "5.6.2",
40
40
  "dot-prop": "^5.3.0",
41
41
  "fs-extra": "^10.1.0",