auth0-deploy-cli 7.7.1 → 7.10.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 (134) hide show
  1. package/CHANGELOG.md +40 -1
  2. package/README.md +2 -2
  3. package/lib/args.d.ts +29 -0
  4. package/lib/commands/export.d.ts +2 -0
  5. package/lib/commands/import.d.ts +2 -0
  6. package/lib/commands/index.d.ts +9 -0
  7. package/lib/configFactory.d.ts +7 -0
  8. package/lib/context/defaults.d.ts +1 -0
  9. package/lib/context/directory/handlers/actions.d.ts +6 -0
  10. package/lib/context/directory/handlers/attackProtection.d.ts +10 -0
  11. package/lib/context/directory/handlers/branding.d.ts +6 -0
  12. package/lib/context/directory/handlers/branding.js +55 -21
  13. package/lib/context/directory/handlers/clientGrants.d.ts +6 -0
  14. package/lib/context/directory/handlers/clients.d.ts +6 -0
  15. package/lib/context/directory/handlers/connections.d.ts +6 -0
  16. package/lib/context/directory/handlers/databases.d.ts +6 -0
  17. package/lib/context/directory/handlers/emailProvider.d.ts +6 -0
  18. package/lib/context/directory/handlers/emailTemplates.d.ts +6 -0
  19. package/lib/context/directory/handlers/guardianFactorProviders.d.ts +6 -0
  20. package/lib/context/directory/handlers/guardianFactorTemplates.d.ts +6 -0
  21. package/lib/context/directory/handlers/guardianFactors.d.ts +6 -0
  22. package/lib/context/directory/handlers/guardianPhoneFactorMessageTypes.d.ts +6 -0
  23. package/lib/context/directory/handlers/guardianPhoneFactorSelectedProvider.d.ts +6 -0
  24. package/lib/context/directory/handlers/guardianPolicies.d.ts +6 -0
  25. package/lib/context/directory/handlers/hooks.d.ts +6 -0
  26. package/lib/context/directory/handlers/index.d.ts +12 -0
  27. package/lib/context/directory/handlers/index.js +2 -0
  28. package/lib/context/directory/handlers/logStreams.d.ts +7 -0
  29. package/lib/context/directory/handlers/logStreams.js +49 -0
  30. package/lib/context/directory/handlers/migrations.d.ts +6 -0
  31. package/lib/context/directory/handlers/organizations.d.ts +6 -0
  32. package/lib/context/directory/handlers/pages.d.ts +6 -0
  33. package/lib/context/directory/handlers/resourceServers.d.ts +6 -0
  34. package/lib/context/directory/handlers/roles.d.ts +6 -0
  35. package/lib/context/directory/handlers/rules.d.ts +6 -0
  36. package/lib/context/directory/handlers/rulesConfigs.d.ts +6 -0
  37. package/lib/context/directory/handlers/tenant.d.ts +10 -0
  38. package/lib/context/directory/handlers/triggers.d.ts +6 -0
  39. package/lib/context/directory/index.d.ts +17 -0
  40. package/lib/context/index.d.ts +4 -0
  41. package/lib/context/yaml/handlers/actions.d.ts +6 -0
  42. package/lib/context/yaml/handlers/attackProtection.d.ts +6 -0
  43. package/lib/context/yaml/handlers/branding.d.ts +13 -0
  44. package/lib/context/yaml/handlers/branding.js +23 -6
  45. package/lib/context/yaml/handlers/clientGrants.d.ts +6 -0
  46. package/lib/context/yaml/handlers/clients.d.ts +6 -0
  47. package/lib/context/yaml/handlers/connections.d.ts +6 -0
  48. package/lib/context/yaml/handlers/databases.d.ts +6 -0
  49. package/lib/context/yaml/handlers/emailProvider.d.ts +6 -0
  50. package/lib/context/yaml/handlers/emailTemplates.d.ts +6 -0
  51. package/lib/context/yaml/handlers/guardianFactorProviders.d.ts +6 -0
  52. package/lib/context/yaml/handlers/guardianFactorTemplates.d.ts +6 -0
  53. package/lib/context/yaml/handlers/guardianFactors.d.ts +6 -0
  54. package/lib/context/yaml/handlers/guardianPhoneFactorMessageTypes.d.ts +6 -0
  55. package/lib/context/yaml/handlers/guardianPhoneFactorSelectedProvider.d.ts +6 -0
  56. package/lib/context/yaml/handlers/guardianPolicies.d.ts +6 -0
  57. package/lib/context/yaml/handlers/hooks.d.ts +6 -0
  58. package/lib/context/yaml/handlers/index.d.ts +12 -0
  59. package/lib/context/yaml/handlers/index.js +2 -0
  60. package/lib/context/yaml/handlers/logStreams.d.ts +7 -0
  61. package/lib/context/yaml/handlers/logStreams.js +23 -0
  62. package/lib/context/yaml/handlers/migrations.d.ts +6 -0
  63. package/lib/context/yaml/handlers/organizations.d.ts +6 -0
  64. package/lib/context/yaml/handlers/pages.d.ts +6 -0
  65. package/lib/context/yaml/handlers/resourceServers.d.ts +6 -0
  66. package/lib/context/yaml/handlers/roles.d.ts +6 -0
  67. package/lib/context/yaml/handlers/rules.d.ts +6 -0
  68. package/lib/context/yaml/handlers/rulesConfigs.d.ts +6 -0
  69. package/lib/context/yaml/handlers/tenant.d.ts +6 -0
  70. package/lib/context/yaml/handlers/triggers.d.ts +6 -0
  71. package/lib/context/yaml/index.d.ts +13 -0
  72. package/lib/index.d.ts +89 -0
  73. package/lib/index.js +5 -2
  74. package/lib/logger.d.ts +2 -0
  75. package/lib/logger.js +7 -17
  76. package/lib/readonly.d.ts +2 -0
  77. package/lib/sessionDurationsToMinutes.d.ts +7 -0
  78. package/lib/tools/auth0/client.d.ts +2 -0
  79. package/lib/tools/auth0/handlers/actions.d.ts +95 -0
  80. package/lib/tools/auth0/handlers/actions.js +1 -1
  81. package/lib/tools/auth0/handlers/attackProtection.d.ts +28 -0
  82. package/lib/tools/auth0/handlers/branding.d.ts +27 -0
  83. package/lib/tools/auth0/handlers/clientGrants.d.ts +32 -0
  84. package/lib/tools/auth0/handlers/clients.d.ts +23 -0
  85. package/lib/tools/auth0/handlers/connections.d.ts +54 -0
  86. package/lib/tools/auth0/handlers/databases.d.ts +36 -0
  87. package/lib/tools/auth0/handlers/default.d.ts +54 -0
  88. package/lib/tools/auth0/handlers/default.js +23 -8
  89. package/lib/tools/auth0/handlers/emailProvider.d.ts +11 -0
  90. package/lib/tools/auth0/handlers/emailTemplates.d.ts +26 -0
  91. package/lib/tools/auth0/handlers/guardianFactorProviders.d.ts +25 -0
  92. package/lib/tools/auth0/handlers/guardianFactorTemplates.d.ts +21 -0
  93. package/lib/tools/auth0/handlers/guardianFactors.d.ts +21 -0
  94. package/lib/tools/auth0/handlers/guardianPhoneFactorMessageTypes.d.ts +21 -0
  95. package/lib/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.d.ts +18 -0
  96. package/lib/tools/auth0/handlers/guardianPolicies.d.ts +23 -0
  97. package/lib/tools/auth0/handlers/hooks.d.ts +58 -0
  98. package/lib/tools/auth0/handlers/index.d.ts +134 -0
  99. package/lib/tools/auth0/handlers/index.js +2 -0
  100. package/lib/tools/auth0/handlers/logStreams.d.ts +40 -0
  101. package/lib/tools/auth0/handlers/logStreams.js +77 -0
  102. package/lib/tools/auth0/handlers/migrations.d.ts +15 -0
  103. package/lib/tools/auth0/handlers/migrations.js +1 -1
  104. package/lib/tools/auth0/handlers/organizations.d.ts +51 -0
  105. package/lib/tools/auth0/handlers/organizations.js +2 -2
  106. package/lib/tools/auth0/handlers/pages.d.ts +42 -0
  107. package/lib/tools/auth0/handlers/prompts.d.ts +11 -0
  108. package/lib/tools/auth0/handlers/resourceServers.d.ts +51 -0
  109. package/lib/tools/auth0/handlers/resourceServers.js +1 -1
  110. package/lib/tools/auth0/handlers/roles.d.ts +48 -0
  111. package/lib/tools/auth0/handlers/roles.js +2 -2
  112. package/lib/tools/auth0/handlers/rules.d.ts +55 -0
  113. package/lib/tools/auth0/handlers/rules.js +2 -2
  114. package/lib/tools/auth0/handlers/rulesConfigs.d.ts +25 -0
  115. package/lib/tools/auth0/handlers/tenant.d.ts +11 -0
  116. package/lib/tools/auth0/handlers/triggers.d.ts +35 -0
  117. package/lib/tools/auth0/handlers/triggers.js +1 -1
  118. package/lib/tools/auth0/index.d.ts +15 -0
  119. package/lib/tools/auth0/schema.d.ts +15 -0
  120. package/lib/tools/calculateChanges.d.ts +26 -0
  121. package/lib/tools/calculateChanges.js +3 -3
  122. package/lib/tools/constants.d.ts +72 -0
  123. package/lib/tools/constants.js +4 -1
  124. package/lib/tools/deploy.d.ts +3 -0
  125. package/lib/tools/deploy.js +2 -2
  126. package/lib/tools/index.d.ts +83 -0
  127. package/lib/tools/utils.d.ts +18 -0
  128. package/lib/tools/utils.js +36 -3
  129. package/lib/tools/validationError.d.ts +5 -0
  130. package/lib/types.d.ts +257 -0
  131. package/lib/utils.d.ts +67 -0
  132. package/package.json +10 -10
  133. package/tsconfig.json +2 -1
  134. package/lib/tools/logger.js +0 -21
@@ -0,0 +1,40 @@
1
+ import DefaultAPIHandler from './default';
2
+ import { Asset, Assets } from '../../../types';
3
+ export declare const schema: {
4
+ type: string;
5
+ items: {
6
+ type: string;
7
+ properties: {
8
+ id: {
9
+ type: string;
10
+ };
11
+ type: {
12
+ type: string;
13
+ };
14
+ name: {
15
+ type: string;
16
+ };
17
+ status: {
18
+ type: string;
19
+ enum: string[];
20
+ };
21
+ sink: {
22
+ type: string;
23
+ };
24
+ filters: {
25
+ type: string;
26
+ items: {
27
+ type: string;
28
+ };
29
+ };
30
+ };
31
+ required: string[];
32
+ };
33
+ };
34
+ export default class LogStreamsHandler extends DefaultAPIHandler {
35
+ existing: Asset[] | null;
36
+ constructor(config: DefaultAPIHandler);
37
+ objString(item: Asset): string;
38
+ getType(): Promise<Asset>;
39
+ processChanges(assets: Assets): Promise<void>;
40
+ }
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.schema = void 0;
16
+ const default_1 = __importDefault(require("./default"));
17
+ exports.schema = {
18
+ type: 'array',
19
+ items: {
20
+ type: 'object',
21
+ properties: {
22
+ id: { type: 'string' },
23
+ type: { type: 'string' },
24
+ name: { type: 'string' },
25
+ status: { type: 'string', enum: ['active', 'paused', 'suspended'] },
26
+ sink: { type: 'object' },
27
+ filters: {
28
+ type: 'array',
29
+ items: {
30
+ type: 'object',
31
+ },
32
+ },
33
+ },
34
+ required: ['name'],
35
+ },
36
+ };
37
+ class LogStreamsHandler extends default_1.default {
38
+ constructor(config) {
39
+ super(Object.assign(Object.assign({}, config), { type: 'logStreams', stripUpdateFields: ['type'], stripCreateFields: ['status', 'sink.awsPartnerEventSource'], sensitiveFieldsToObfuscate: ['sink.httpAuthorization'] }));
40
+ }
41
+ objString(item) {
42
+ return super.objString(item.name);
43
+ }
44
+ getType() {
45
+ return __awaiter(this, void 0, void 0, function* () {
46
+ if (this.existing) {
47
+ return this.existing;
48
+ }
49
+ const logStreams = yield this.client.logStreams.getAll({ paginate: false });
50
+ const nonSuspendedLogStreams = logStreams.filter((logStream) => logStream.status !== 'suspended');
51
+ this.existing = nonSuspendedLogStreams;
52
+ return nonSuspendedLogStreams;
53
+ });
54
+ }
55
+ processChanges(assets) {
56
+ const _super = Object.create(null, {
57
+ processChanges: { get: () => super.processChanges }
58
+ });
59
+ return __awaiter(this, void 0, void 0, function* () {
60
+ const { logStreams } = assets;
61
+ // Do nothing if not set
62
+ if (!logStreams)
63
+ return;
64
+ // Figure out what needs to be updated vs created
65
+ const changes = yield this.calcChanges(assets).then((changes) => {
66
+ return Object.assign(Object.assign({}, changes), { update: changes.update.map((update) => {
67
+ if (update.type === 'eventbridge' || update.type === 'eventgrid') {
68
+ delete update.sink;
69
+ }
70
+ return update;
71
+ }) });
72
+ });
73
+ yield _super.processChanges.call(this, assets, changes);
74
+ });
75
+ }
76
+ }
77
+ exports.default = LogStreamsHandler;
@@ -0,0 +1,15 @@
1
+ import DefaultHandler from './default';
2
+ import { Asset, Assets } from '../../../types';
3
+ export declare const schema: {
4
+ type: string;
5
+ additionalProperties: {
6
+ type: string;
7
+ };
8
+ };
9
+ export default class MigrationsHandler extends DefaultHandler {
10
+ constructor(options: DefaultHandler);
11
+ getType(): Promise<Asset[] | {}>;
12
+ processChanges(assets: Assets): Promise<void>;
13
+ logUnavailableMigrations(ignoreUnavailableMigrations: boolean, ignoredMigrations: string[]): void;
14
+ removeUnavailableMigrations(migrations: Asset[]): Promise<Asset[]>;
15
+ }
@@ -43,7 +43,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
43
43
  Object.defineProperty(exports, "__esModule", { value: true });
44
44
  exports.schema = void 0;
45
45
  const default_1 = __importStar(require("./default"));
46
- const logger_1 = __importDefault(require("../../logger"));
46
+ const logger_1 = __importDefault(require("../../../logger"));
47
47
  exports.schema = {
48
48
  type: 'object',
49
49
  additionalProperties: { type: 'boolean' },
@@ -0,0 +1,51 @@
1
+ import DefaultHandler from './default';
2
+ import { Asset, Assets, CalculatedChanges } from '../../../types';
3
+ export declare const schema: {
4
+ type: string;
5
+ items: {
6
+ type: string;
7
+ properties: {
8
+ name: {
9
+ type: string;
10
+ };
11
+ display_name: {
12
+ type: string;
13
+ };
14
+ branding: {
15
+ type: string;
16
+ };
17
+ metadata: {
18
+ type: string;
19
+ };
20
+ connections: {
21
+ type: string;
22
+ items: {
23
+ type: string;
24
+ properties: {
25
+ connection_id: {
26
+ type: string;
27
+ };
28
+ assign_membership_on_login: {
29
+ type: string;
30
+ };
31
+ };
32
+ };
33
+ };
34
+ };
35
+ required: string[];
36
+ };
37
+ };
38
+ export default class OrganizationsHandler extends DefaultHandler {
39
+ existing: Asset[];
40
+ constructor(config: DefaultHandler);
41
+ deleteOrganization(org: any): Promise<void>;
42
+ deleteOrganizations(data: any): Promise<void>;
43
+ createOrganization(org: any): Promise<Asset>;
44
+ createOrganizations(creates: CalculatedChanges['create']): Promise<void>;
45
+ updateOrganization(org: any, organizations: any): Promise<{
46
+ id: any;
47
+ }>;
48
+ updateOrganizations(updates: CalculatedChanges['update'], orgs: Asset[]): Promise<void>;
49
+ getType(): Promise<Asset[]>;
50
+ processChanges(assets: Assets): Promise<void>;
51
+ }
@@ -45,7 +45,7 @@ exports.schema = void 0;
45
45
  const lodash_1 = __importDefault(require("lodash"));
46
46
  const default_1 = __importStar(require("./default"));
47
47
  const calculateChanges_1 = require("../../calculateChanges");
48
- const logger_1 = __importDefault(require("../../logger"));
48
+ const logger_1 = __importDefault(require("../../../logger"));
49
49
  exports.schema = {
50
50
  type: 'array',
51
51
  items: {
@@ -237,7 +237,7 @@ class OrganizationsHandler extends default_1.default {
237
237
  assets: organizations,
238
238
  existing,
239
239
  identifiers: ['id', 'name'],
240
- allowDelete: false, //TODO: actually pass in correct allowDelete value
240
+ allowDelete: !!this.config('AUTH0_ALLOW_DELETE'),
241
241
  });
242
242
  logger_1.default.debug(`Start processChanges for organizations [delete:${changes.del.length}] [update:${changes.update.length}], [create:${changes.create.length}]`);
243
243
  const myChanges = [
@@ -0,0 +1,42 @@
1
+ import DefaultHandler from './default';
2
+ import { Asset, Assets } from '../../../types';
3
+ export declare const supportedPages: string[];
4
+ export declare const pageNameMap: {
5
+ guardian_multifactor: string;
6
+ password_reset: string;
7
+ error_page: string;
8
+ };
9
+ export declare const schema: {
10
+ type: string;
11
+ items: {
12
+ type: string;
13
+ properties: {
14
+ name: {
15
+ type: string;
16
+ enum: string[];
17
+ };
18
+ html: {
19
+ type: string;
20
+ default: string;
21
+ };
22
+ url: {
23
+ type: string;
24
+ };
25
+ show_log_link: {
26
+ type: string;
27
+ };
28
+ enabled: {
29
+ type: string;
30
+ };
31
+ };
32
+ required: string[];
33
+ };
34
+ };
35
+ export default class PagesHandler extends DefaultHandler {
36
+ constructor(options: DefaultHandler);
37
+ objString(page: any): string;
38
+ updateLoginPage(page: any): Promise<void>;
39
+ updatePages(pages: Asset[]): Promise<void>;
40
+ getType(): Promise<Asset[]>;
41
+ processChanges(assets: Assets): Promise<void>;
42
+ }
@@ -0,0 +1,11 @@
1
+ import DefaultHandler from './default';
2
+ import { Asset, Assets } from '../../../types';
3
+ export declare const schema: {
4
+ type: string;
5
+ };
6
+ export default class PromptsHandler extends DefaultHandler {
7
+ existing: Asset[];
8
+ constructor(options: DefaultHandler);
9
+ getType(): Promise<Asset[]>;
10
+ processChanges(assets: Assets): Promise<void>;
11
+ }
@@ -0,0 +1,51 @@
1
+ import DefaultHandler from './default';
2
+ import { Asset, Assets, CalculatedChanges } from '../../../types';
3
+ export declare const excludeSchema: {
4
+ type: string;
5
+ items: {
6
+ type: string;
7
+ };
8
+ };
9
+ export declare const schema: {
10
+ type: string;
11
+ items: {
12
+ type: string;
13
+ properties: {
14
+ name: {
15
+ type: string;
16
+ };
17
+ identifier: {
18
+ type: string;
19
+ };
20
+ scopes: {
21
+ type: string;
22
+ items: {
23
+ type: string;
24
+ properties: {
25
+ name: {
26
+ type: string;
27
+ };
28
+ description: {
29
+ type: string;
30
+ };
31
+ };
32
+ };
33
+ };
34
+ enforce_policies: {
35
+ type: string;
36
+ };
37
+ token_dialect: {
38
+ type: string;
39
+ };
40
+ };
41
+ required: string[];
42
+ };
43
+ };
44
+ export default class ResourceServersHandler extends DefaultHandler {
45
+ existing: Asset[];
46
+ constructor(options: DefaultHandler);
47
+ objString(resourceServer: any): string;
48
+ getType(): Promise<Asset[]>;
49
+ calcChanges(assets: Assets): Promise<CalculatedChanges>;
50
+ validate(assets: Assets): Promise<void>;
51
+ }
@@ -83,7 +83,7 @@ class ResourceServersHandler extends default_1.default {
83
83
  assets: resourceServers,
84
84
  existing,
85
85
  identifiers: ['id', 'identifier'],
86
- allowDelete: false, //TODO: actually pass in correct allowDelete value
86
+ allowDelete: !!this.config('AUTH0_ALLOW_DELETE'),
87
87
  });
88
88
  });
89
89
  }
@@ -0,0 +1,48 @@
1
+ import DefaultHandler from './default';
2
+ import { Asset, Assets, CalculatedChanges } from '../../../types';
3
+ export declare const schema: {
4
+ type: string;
5
+ items: {
6
+ type: string;
7
+ properties: {
8
+ name: {
9
+ type: string;
10
+ };
11
+ id: {
12
+ type: string;
13
+ };
14
+ description: {
15
+ type: string;
16
+ };
17
+ permissions: {
18
+ type: string;
19
+ items: {
20
+ type: string;
21
+ properties: {
22
+ permission_name: {
23
+ type: string;
24
+ };
25
+ resource_server_identifier: {
26
+ type: string;
27
+ };
28
+ };
29
+ };
30
+ };
31
+ };
32
+ required: string[];
33
+ };
34
+ };
35
+ export default class RolesHandler extends DefaultHandler {
36
+ existing: Asset[];
37
+ constructor(config: DefaultHandler);
38
+ createRole(data: any): Promise<Asset>;
39
+ createRoles(creates: CalculatedChanges['create']): Promise<void>;
40
+ deleteRole(data: any): Promise<void>;
41
+ deleteRoles(dels: CalculatedChanges['del']): Promise<void>;
42
+ updateRole(data: any, roles: any): Promise<{
43
+ id: any;
44
+ }>;
45
+ updateRoles(updates: CalculatedChanges['update'], roles: any): Promise<void>;
46
+ getType(): Promise<Asset[]>;
47
+ processChanges(assets: Assets): Promise<void>;
48
+ }
@@ -44,7 +44,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
44
44
  exports.schema = void 0;
45
45
  const default_1 = __importStar(require("./default"));
46
46
  const calculateChanges_1 = require("../../calculateChanges");
47
- const logger_1 = __importDefault(require("../../logger"));
47
+ const logger_1 = __importDefault(require("../../../logger"));
48
48
  exports.schema = {
49
49
  type: 'array',
50
50
  items: {
@@ -210,7 +210,7 @@ class RolesHandler extends default_1.default {
210
210
  assets: roles,
211
211
  existing,
212
212
  identifiers: ['id', 'name'],
213
- allowDelete: false, //TODO: actually pass in correct allowDelete value
213
+ allowDelete: !!this.config('AUTH0_ALLOW_DELETE'),
214
214
  });
215
215
  logger_1.default.debug(`Start processChanges for roles [delete:${changes.del.length}] [update:${changes.update.length}], [create:${changes.create.length}]`);
216
216
  const myChanges = [
@@ -0,0 +1,55 @@
1
+ import DefaultHandler from './default';
2
+ import { Asset, Assets, CalculatedChanges } from '../../../types';
3
+ export declare const excludeSchema: {
4
+ type: string;
5
+ items: {
6
+ type: string;
7
+ };
8
+ };
9
+ export declare const schema: {
10
+ type: string;
11
+ items: {
12
+ type: string;
13
+ default: never[];
14
+ properties: {
15
+ script: {
16
+ type: string;
17
+ description: string;
18
+ default: string;
19
+ };
20
+ name: {
21
+ type: string;
22
+ description: string;
23
+ pattern: string;
24
+ };
25
+ order: {
26
+ type: string[];
27
+ description: string;
28
+ default: null;
29
+ };
30
+ enabled: {
31
+ type: string;
32
+ description: string;
33
+ default: boolean;
34
+ };
35
+ stage: {
36
+ type: string;
37
+ description: string;
38
+ default: string;
39
+ enum: string[];
40
+ };
41
+ };
42
+ required: string[];
43
+ };
44
+ };
45
+ export default class RulesHandler extends DefaultHandler {
46
+ existing: Asset[];
47
+ constructor(options: DefaultHandler);
48
+ getType(): Promise<Asset[]>;
49
+ objString(rule: any): string;
50
+ calcChanges(assets: any, includeExcluded?: boolean): Promise<CalculatedChanges & {
51
+ reOrder: Asset[];
52
+ }>;
53
+ validate(assets: Assets): Promise<void>;
54
+ processChanges(assets: Assets): Promise<void>;
55
+ }
@@ -16,7 +16,7 @@ exports.schema = exports.excludeSchema = void 0;
16
16
  const validationError_1 = __importDefault(require("../../validationError"));
17
17
  const utils_1 = require("../../utils");
18
18
  const default_1 = __importDefault(require("./default"));
19
- const logger_1 = __importDefault(require("../../logger"));
19
+ const logger_1 = __importDefault(require("../../../logger"));
20
20
  const calculateChanges_1 = require("../../calculateChanges");
21
21
  exports.excludeSchema = {
22
22
  type: 'array',
@@ -89,7 +89,7 @@ class RulesHandler extends default_1.default {
89
89
  assets: rules,
90
90
  existing,
91
91
  identifiers: ['id', 'name'],
92
- allowDelete: false, //TODO: actually pass in correct allowDelete value
92
+ allowDelete: !!this.config('AUTH0_ALLOW_DELETE'),
93
93
  });
94
94
  // Figure out the rules that need to be re-ordered
95
95
  const futureRules = [...create, ...update];
@@ -0,0 +1,25 @@
1
+ import { Assets, Asset, CalculatedChanges } from '../../../types';
2
+ import DefaultHandler from './default';
3
+ export declare const schema: {
4
+ type: string;
5
+ items: {
6
+ type: string;
7
+ properties: {
8
+ key: {
9
+ type: string;
10
+ pattern: string;
11
+ };
12
+ value: {
13
+ type: string;
14
+ };
15
+ };
16
+ required: string[];
17
+ };
18
+ additionalProperties: boolean;
19
+ };
20
+ export default class RulesConfigsHandler extends DefaultHandler {
21
+ constructor(options: DefaultHandler);
22
+ getType(): Promise<Asset[]>;
23
+ objString(item: any): string;
24
+ calcChanges(assets: Assets): Promise<CalculatedChanges>;
25
+ }
@@ -0,0 +1,11 @@
1
+ import DefaultHandler from './default';
2
+ import { Asset, Assets } from '../../../types';
3
+ export declare const schema: {
4
+ type: string;
5
+ };
6
+ export default class TenantHandler extends DefaultHandler {
7
+ constructor(options: DefaultHandler);
8
+ getType(): Promise<Asset>;
9
+ validate(assets: Assets): Promise<void>;
10
+ processChanges(assets: Assets): Promise<void>;
11
+ }
@@ -0,0 +1,35 @@
1
+ import DefaultHandler from './default';
2
+ import { Assets } from '../../../types';
3
+ export declare const schema: {
4
+ type: string;
5
+ items: {
6
+ type: string;
7
+ additionalProperties: boolean;
8
+ properties: {
9
+ trigger_id: {
10
+ type: string;
11
+ properties: {
12
+ action_name: {
13
+ type: string;
14
+ enum: string[];
15
+ };
16
+ display_name: {
17
+ type: string;
18
+ default: string;
19
+ };
20
+ };
21
+ };
22
+ };
23
+ };
24
+ };
25
+ export default class TriggersHandler extends DefaultHandler {
26
+ existing: {
27
+ [key: string]: {
28
+ action_name: string;
29
+ display_name: string;
30
+ };
31
+ };
32
+ constructor(options: DefaultHandler);
33
+ getType(): Promise<DefaultHandler['existing']>;
34
+ processChanges(assets: Assets): Promise<void>;
35
+ }
@@ -45,7 +45,7 @@ exports.schema = void 0;
45
45
  const lodash_1 = __importDefault(require("lodash"));
46
46
  const default_1 = __importStar(require("./default"));
47
47
  const constants_1 = __importDefault(require("../../constants"));
48
- const logger_1 = __importDefault(require("../../logger"));
48
+ const logger_1 = __importDefault(require("../../../logger"));
49
49
  exports.schema = {
50
50
  type: 'object',
51
51
  items: {
@@ -0,0 +1,15 @@
1
+ import { Assets, Auth0APIClient, BaseAuth0APIClient } from '../../types';
2
+ import APIHandler from './handlers/default';
3
+ import { ConfigFunction } from '../../configFactory';
4
+ export declare type Stage = 'load' | 'validate' | 'processChanges';
5
+ export default class Auth0 {
6
+ client: Auth0APIClient;
7
+ config: ConfigFunction;
8
+ assets: Assets;
9
+ handlers: APIHandler[];
10
+ constructor(client: BaseAuth0APIClient, assets: Assets, config: ConfigFunction);
11
+ runStage(stage: Stage): Promise<void>;
12
+ validate(): Promise<void>;
13
+ loadAll(): Promise<void>;
14
+ processChanges(): Promise<void>;
15
+ }
@@ -0,0 +1,15 @@
1
+ declare const _default: {
2
+ type: string;
3
+ $schema: string;
4
+ properties: {
5
+ exclude: {
6
+ type: string;
7
+ properties: {
8
+ [x: string]: Object;
9
+ };
10
+ default: {};
11
+ };
12
+ };
13
+ additionalProperties: boolean;
14
+ };
15
+ export default _default;
@@ -0,0 +1,26 @@
1
+ import APIHandler from '../tools/auth0/handlers/default';
2
+ import { Asset, CalculatedChanges } from '../types';
3
+ /**
4
+ * @template T
5
+ * @param {typeof import('./auth0/handlers/default').default} handler
6
+ * @param {T} desiredAssetState
7
+ * @param {T} currentAssetState
8
+ * @param {string[]} [objectFields=[]]
9
+ * @param {boolean} [allowDelete]
10
+ * @returns T
11
+ */
12
+ export declare function processChangedObjectFields({ handler, desiredAssetState, currentAssetState, allowDelete, }: {
13
+ handler: APIHandler;
14
+ desiredAssetState: Asset;
15
+ currentAssetState: Asset;
16
+ allowDelete: boolean;
17
+ }): {
18
+ [x: string]: any;
19
+ };
20
+ export declare function calculateChanges({ handler, assets, existing, identifiers, allowDelete, }: {
21
+ handler: APIHandler;
22
+ assets: Asset[];
23
+ existing: Asset[];
24
+ identifiers: string[];
25
+ allowDelete: boolean;
26
+ }): CalculatedChanges;
@@ -4,17 +4,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.calculateChanges = exports.processChangedObjectFields = void 0;
7
- const logger_1 = __importDefault(require("./logger"));
7
+ const logger_1 = __importDefault(require("../logger"));
8
8
  /**
9
9
  * @template T
10
10
  * @param {typeof import('./auth0/handlers/default').default} handler
11
11
  * @param {T} desiredAssetState
12
12
  * @param {T} currentAssetState
13
13
  * @param {string[]} [objectFields=[]]
14
- * @param {boolean} [allowDelete=false]
14
+ * @param {boolean} [allowDelete]
15
15
  * @returns T
16
16
  */
17
- function processChangedObjectFields({ handler, desiredAssetState, currentAssetState, allowDelete = false, }) {
17
+ function processChangedObjectFields({ handler, desiredAssetState, currentAssetState, allowDelete, }) {
18
18
  const desiredAssetStateWithChanges = Object.assign({}, desiredAssetState);
19
19
  // eslint-disable-next-line no-restricted-syntax
20
20
  for (const fieldName of handler.objectFields) {