auth0-deploy-cli 8.31.0 → 8.32.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 (73) hide show
  1. package/CHANGELOG.md +40 -419
  2. package/lib/args.d.ts +4 -0
  3. package/lib/args.js +18 -0
  4. package/lib/commands/import.js +40 -3
  5. package/lib/context/directory/handlers/clients.js +14 -0
  6. package/lib/context/directory/handlers/connections.js +1 -0
  7. package/lib/context/directory/handlers/guardianFactors.js +8 -6
  8. package/lib/context/directory/handlers/tenant.d.ts +1 -6
  9. package/lib/context/directory/handlers/tenant.js +0 -1
  10. package/lib/context/index.js +5 -0
  11. package/lib/context/yaml/handlers/clients.js +12 -0
  12. package/lib/context/yaml/handlers/connections.js +1 -17
  13. package/lib/context/yaml/handlers/guardianFactors.js +3 -1
  14. package/lib/context/yaml/handlers/tenant.js +1 -1
  15. package/lib/sessionDurationsToMinutes.d.ts +9 -7
  16. package/lib/sessionDurationsToMinutes.js +11 -10
  17. package/lib/tools/auth0/handlers/actions.d.ts +1 -0
  18. package/lib/tools/auth0/handlers/actions.js +36 -0
  19. package/lib/tools/auth0/handlers/attackProtection.js +15 -0
  20. package/lib/tools/auth0/handlers/branding.js +7 -0
  21. package/lib/tools/auth0/handlers/clientGrants.js +1 -0
  22. package/lib/tools/auth0/handlers/clients.d.ts +52 -2
  23. package/lib/tools/auth0/handlers/clients.js +175 -22
  24. package/lib/tools/auth0/handlers/connections.d.ts +1 -0
  25. package/lib/tools/auth0/handlers/connections.js +42 -5
  26. package/lib/tools/auth0/handlers/databases.d.ts +91 -0
  27. package/lib/tools/auth0/handlers/databases.js +162 -2
  28. package/lib/tools/auth0/handlers/default.d.ts +4 -0
  29. package/lib/tools/auth0/handlers/default.js +82 -4
  30. package/lib/tools/auth0/handlers/emailProvider.js +8 -0
  31. package/lib/tools/auth0/handlers/emailTemplates.js +7 -0
  32. package/lib/tools/auth0/handlers/flowVaultConnections.js +6 -1
  33. package/lib/tools/auth0/handlers/flows.js +13 -4
  34. package/lib/tools/auth0/handlers/forms.js +10 -1
  35. package/lib/tools/auth0/handlers/guardianFactors.js +7 -1
  36. package/lib/tools/auth0/handlers/guardianPhoneFactorMessageTypes.js +8 -1
  37. package/lib/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.js +8 -1
  38. package/lib/tools/auth0/handlers/guardianPolicies.js +7 -0
  39. package/lib/tools/auth0/handlers/hooks.d.ts +1 -0
  40. package/lib/tools/auth0/handlers/hooks.js +10 -0
  41. package/lib/tools/auth0/handlers/organizations.d.ts +11 -1
  42. package/lib/tools/auth0/handlers/organizations.js +48 -52
  43. package/lib/tools/auth0/handlers/pages.js +7 -0
  44. package/lib/tools/auth0/handlers/phoneProvider.js +7 -0
  45. package/lib/tools/auth0/handlers/prompts.js +7 -0
  46. package/lib/tools/auth0/handlers/resourceServers.d.ts +1 -2
  47. package/lib/tools/auth0/handlers/resourceServers.js +9 -25
  48. package/lib/tools/auth0/handlers/roles.js +7 -0
  49. package/lib/tools/auth0/handlers/rules.d.ts +1 -0
  50. package/lib/tools/auth0/handlers/rules.js +9 -0
  51. package/lib/tools/auth0/handlers/rulesConfigs.d.ts +1 -0
  52. package/lib/tools/auth0/handlers/rulesConfigs.js +3 -0
  53. package/lib/tools/auth0/handlers/scimHandler.js +8 -1
  54. package/lib/tools/auth0/handlers/selfServiceProfiles.d.ts +1 -1
  55. package/lib/tools/auth0/handlers/selfServiceProfiles.js +10 -17
  56. package/lib/tools/auth0/handlers/tenant.d.ts +13 -1
  57. package/lib/tools/auth0/handlers/tenant.js +43 -4
  58. package/lib/tools/auth0/handlers/themes.js +11 -2
  59. package/lib/tools/auth0/handlers/triggers.js +6 -0
  60. package/lib/tools/auth0/handlers/userAttributeProfiles.js +16 -10
  61. package/lib/tools/auth0/index.d.ts +3 -0
  62. package/lib/tools/auth0/index.js +204 -0
  63. package/lib/tools/calculateChanges.d.ts +2 -2
  64. package/lib/tools/calculateChanges.js +21 -6
  65. package/lib/tools/calculateDryRunChanges.d.ts +71 -0
  66. package/lib/tools/calculateDryRunChanges.js +492 -0
  67. package/lib/tools/deploy.js +25 -1
  68. package/lib/tools/utils.d.ts +5 -0
  69. package/lib/tools/utils.js +64 -3
  70. package/lib/types.d.ts +16 -0
  71. package/lib/utils.d.ts +7 -0
  72. package/lib/utils.js +33 -1
  73. package/package.json +7 -4
package/lib/types.d.ts CHANGED
@@ -73,6 +73,9 @@ export type Config = {
73
73
  AUTH0_EXPORT_IDENTIFIERS?: boolean;
74
74
  AUTH0_EXPORT_ORDERED?: boolean;
75
75
  AUTH0_CONNECTIONS_DIRECTORY?: string;
76
+ AUTH0_DRY_RUN?: boolean | 'preview';
77
+ AUTH0_DRY_RUN_INTERACTIVE?: boolean;
78
+ AUTH0_DRY_RUN_APPLY?: boolean;
76
79
  EXCLUDED_PROPS?: {
77
80
  [key: string]: string[];
78
81
  };
@@ -158,6 +161,19 @@ export type CalculatedChanges = {
158
161
  conflicts: Asset[];
159
162
  create: Asset[];
160
163
  };
164
+ export type DetailedDryRunChange = {
165
+ action: 'CREATE' | 'UPDATE' | 'DELETE';
166
+ identifier: string;
167
+ details?: any;
168
+ };
169
+ export type DetailedDryRunChanges = {
170
+ [key: string]: {
171
+ created: number;
172
+ updated: number;
173
+ deleted: number;
174
+ changes: DetailedDryRunChange[];
175
+ };
176
+ };
161
177
  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';
162
178
  export type KeywordMappings = {
163
179
  [key: string]: (string | number)[] | string | number;
package/lib/utils.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Auth0 } from './tools';
2
2
  import { Asset, Assets, Config, KeywordMappings } from './types';
3
+ export declare function isTruthy(value: unknown): boolean;
3
4
  export declare function isDirectory(filePath: string): boolean;
4
5
  export declare function isFile(filePath: string): boolean;
5
6
  export declare function getFiles(folder: string, exts: string[]): string[];
@@ -45,4 +46,10 @@ export declare const findKeyPathWithValue: (obj: any, findKey: string, parentPat
45
46
  * @returns The Base64 encoded certificate string if the input starts with '-----BEGIN CERTIFICATE-----', otherwise returns the original string.
46
47
  */
47
48
  export declare const encodeCertStringToBase64: (cert: string) => string;
49
+ export declare const decodeBase64ToCertString: (base64Cert: string) => string;
50
+ export declare const getFormattedOptions: (connection: any, clients: any) => {
51
+ options: any;
52
+ } | {
53
+ options?: undefined;
54
+ };
48
55
  export {};
package/lib/utils.js CHANGED
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.encodeCertStringToBase64 = exports.findKeyPathWithValue = void 0;
6
+ exports.getFormattedOptions = exports.decodeBase64ToCertString = exports.encodeCertStringToBase64 = exports.findKeyPathWithValue = void 0;
7
+ exports.isTruthy = isTruthy;
7
8
  exports.isDirectory = isDirectory;
8
9
  exports.isFile = isFile;
9
10
  exports.getFiles = getFiles;
@@ -30,6 +31,9 @@ const dot_prop_1 = __importDefault(require("dot-prop"));
30
31
  const lodash_1 = require("lodash");
31
32
  const tools_1 = require("./tools");
32
33
  const logger_1 = __importDefault(require("./logger"));
34
+ function isTruthy(value) {
35
+ return value === true || value === 'true';
36
+ }
33
37
  function isDirectory(filePath) {
34
38
  try {
35
39
  return fs_extra_1.default.statSync(path_1.default.resolve(filePath)).isDirectory();
@@ -284,3 +288,31 @@ const encodeCertStringToBase64 = (cert) => {
284
288
  return cert;
285
289
  };
286
290
  exports.encodeCertStringToBase64 = encodeCertStringToBase64;
291
+ // Decode a Base64 encoded certificate string back to its original format.
292
+ const decodeBase64ToCertString = (base64Cert) => {
293
+ try {
294
+ return Buffer.from(base64Cert, 'base64').toString('utf-8');
295
+ }
296
+ catch (e) {
297
+ return base64Cert;
298
+ }
299
+ };
300
+ exports.decodeBase64ToCertString = decodeBase64ToCertString;
301
+ // Format connection options by converting client IDs to client names for SAML connections
302
+ const getFormattedOptions = (connection, clients) => {
303
+ try {
304
+ return {
305
+ options: {
306
+ ...connection.options,
307
+ idpinitiated: {
308
+ ...connection.options.idpinitiated,
309
+ client_id: convertClientIdToName(connection.options.idpinitiated.client_id, clients),
310
+ },
311
+ },
312
+ };
313
+ }
314
+ catch (e) {
315
+ return {};
316
+ }
317
+ };
318
+ exports.getFormattedOptions = getFormattedOptions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "auth0-deploy-cli",
3
- "version": "8.31.0",
3
+ "version": "8.32.0",
4
4
  "description": "A command line tool for deploying updates to your Auth0 tenant",
5
5
  "main": "lib/index.js",
6
6
  "bin": {
@@ -33,8 +33,10 @@
33
33
  "readme": "README.md",
34
34
  "homepage": "https://github.com/auth0/auth0-deploy-cli#readme",
35
35
  "dependencies": {
36
+ "@clack/prompts": "1.2.0",
36
37
  "ajv": "^6.12.6",
37
- "auth0": "^5.6.0",
38
+ "chalk": "5.6.2",
39
+ "auth0": "^5.8.0",
38
40
  "dot-prop": "^5.3.0",
39
41
  "fs-extra": "^10.1.0",
40
42
  "js-yaml": "^4.1.1",
@@ -49,12 +51,13 @@
49
51
  },
50
52
  "devDependencies": {
51
53
  "@eslint/js": "^9.39.2",
54
+ "@types/chai": "^5.2.3",
52
55
  "@types/fs-extra": "^9.0.13",
53
56
  "@types/lodash": "^4.17.24",
54
57
  "@types/mocha": "^10.0.10",
55
58
  "@types/nconf": "^0.10.7",
56
- "@typescript-eslint/eslint-plugin": "^8.58.0",
57
- "@typescript-eslint/parser": "^8.58.0",
59
+ "@typescript-eslint/eslint-plugin": "^8.58.1",
60
+ "@typescript-eslint/parser": "^8.58.1",
58
61
  "chai": "^4.5.0",
59
62
  "chai-as-promised": "^7.1.2",
60
63
  "eslint": "^9.39.2",