auth0-deploy-cli 7.7.0 → 7.9.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 (137) hide show
  1. package/CHANGELOG.md +42 -1
  2. package/README.md +1 -1
  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/attackProtection.js +3 -3
  12. package/lib/context/directory/handlers/branding.d.ts +6 -0
  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/index.js +18 -0
  42. package/lib/context/yaml/handlers/actions.d.ts +6 -0
  43. package/lib/context/yaml/handlers/attackProtection.d.ts +6 -0
  44. package/lib/context/yaml/handlers/branding.d.ts +6 -0
  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/client.js +7 -7
  80. package/lib/tools/auth0/handlers/actions.d.ts +95 -0
  81. package/lib/tools/auth0/handlers/actions.js +1 -1
  82. package/lib/tools/auth0/handlers/attackProtection.d.ts +28 -0
  83. package/lib/tools/auth0/handlers/branding.d.ts +27 -0
  84. package/lib/tools/auth0/handlers/clientGrants.d.ts +32 -0
  85. package/lib/tools/auth0/handlers/clients.d.ts +23 -0
  86. package/lib/tools/auth0/handlers/connections.d.ts +54 -0
  87. package/lib/tools/auth0/handlers/databases.d.ts +36 -0
  88. package/lib/tools/auth0/handlers/databases.js +2 -2
  89. package/lib/tools/auth0/handlers/default.d.ts +54 -0
  90. package/lib/tools/auth0/handlers/default.js +29 -15
  91. package/lib/tools/auth0/handlers/emailProvider.d.ts +11 -0
  92. package/lib/tools/auth0/handlers/emailTemplates.d.ts +26 -0
  93. package/lib/tools/auth0/handlers/guardianFactorProviders.d.ts +25 -0
  94. package/lib/tools/auth0/handlers/guardianFactorTemplates.d.ts +21 -0
  95. package/lib/tools/auth0/handlers/guardianFactors.d.ts +21 -0
  96. package/lib/tools/auth0/handlers/guardianPhoneFactorMessageTypes.d.ts +21 -0
  97. package/lib/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.d.ts +18 -0
  98. package/lib/tools/auth0/handlers/guardianPolicies.d.ts +23 -0
  99. package/lib/tools/auth0/handlers/hooks.d.ts +58 -0
  100. package/lib/tools/auth0/handlers/index.d.ts +134 -0
  101. package/lib/tools/auth0/handlers/index.js +2 -0
  102. package/lib/tools/auth0/handlers/logStreams.d.ts +40 -0
  103. package/lib/tools/auth0/handlers/logStreams.js +77 -0
  104. package/lib/tools/auth0/handlers/migrations.d.ts +15 -0
  105. package/lib/tools/auth0/handlers/migrations.js +1 -1
  106. package/lib/tools/auth0/handlers/organizations.d.ts +51 -0
  107. package/lib/tools/auth0/handlers/organizations.js +1 -1
  108. package/lib/tools/auth0/handlers/pages.d.ts +42 -0
  109. package/lib/tools/auth0/handlers/prompts.d.ts +11 -0
  110. package/lib/tools/auth0/handlers/resourceServers.d.ts +51 -0
  111. package/lib/tools/auth0/handlers/roles.d.ts +48 -0
  112. package/lib/tools/auth0/handlers/roles.js +1 -1
  113. package/lib/tools/auth0/handlers/rules.d.ts +55 -0
  114. package/lib/tools/auth0/handlers/rules.js +4 -4
  115. package/lib/tools/auth0/handlers/rulesConfigs.d.ts +25 -0
  116. package/lib/tools/auth0/handlers/tenant.d.ts +11 -0
  117. package/lib/tools/auth0/handlers/tenant.js +1 -1
  118. package/lib/tools/auth0/handlers/triggers.d.ts +35 -0
  119. package/lib/tools/auth0/handlers/triggers.js +1 -1
  120. package/lib/tools/auth0/index.d.ts +15 -0
  121. package/lib/tools/auth0/schema.d.ts +15 -0
  122. package/lib/tools/calculateChanges.d.ts +26 -0
  123. package/lib/tools/calculateChanges.js +1 -1
  124. package/lib/tools/constants.d.ts +72 -0
  125. package/lib/tools/constants.js +4 -1
  126. package/lib/tools/deploy.d.ts +3 -0
  127. package/lib/tools/deploy.js +2 -2
  128. package/lib/tools/index.d.ts +83 -0
  129. package/lib/tools/utils.d.ts +18 -0
  130. package/lib/tools/utils.js +67 -9
  131. package/lib/tools/validationError.d.ts +5 -0
  132. package/lib/types.d.ts +257 -0
  133. package/lib/utils.d.ts +67 -0
  134. package/lib/utils.js +8 -5
  135. package/package.json +11 -9
  136. package/tsconfig.json +2 -1
  137. package/lib/tools/logger.js +0 -21
@@ -0,0 +1,54 @@
1
+ import { Asset, Assets, Auth0APIClient, CalculatedChanges } from '../../../types';
2
+ import { ConfigFunction } from '../../../configFactory';
3
+ export declare function order(value: any): (t: any, n: any, descriptor: any) => any;
4
+ export default class APIHandler {
5
+ config: ConfigFunction;
6
+ id: string;
7
+ type: string;
8
+ updated: number;
9
+ created: number;
10
+ deleted: number;
11
+ existing: null | Asset | Asset[];
12
+ client: Auth0APIClient;
13
+ identifiers: string[];
14
+ objectFields: string[];
15
+ sensitiveFieldsToObfuscate: string[];
16
+ stripUpdateFields: string[];
17
+ stripCreateFields: string[];
18
+ name?: string;
19
+ functions: {
20
+ getAll: string;
21
+ update: string;
22
+ create: string;
23
+ delete: string;
24
+ };
25
+ constructor(options: {
26
+ id?: APIHandler['id'];
27
+ config: ConfigFunction;
28
+ type: APIHandler['type'];
29
+ client: Auth0APIClient;
30
+ objectFields?: APIHandler['objectFields'];
31
+ identifiers?: APIHandler['identifiers'];
32
+ stripUpdateFields?: APIHandler['stripUpdateFields'];
33
+ sensitiveFieldsToObfuscate?: APIHandler['sensitiveFieldsToObfuscate'];
34
+ stripCreateFields?: APIHandler['stripCreateFields'];
35
+ functions: {
36
+ getAll?: string;
37
+ update?: string;
38
+ create?: string;
39
+ delete?: string;
40
+ };
41
+ });
42
+ getClientFN(fn: string | Function): Function;
43
+ didDelete(item: Asset): void;
44
+ didCreate(item: Asset): void;
45
+ didUpdate(item: Asset): void;
46
+ objString(item: Asset): string;
47
+ getType(): Promise<Asset | Asset[] | null>;
48
+ load(): Promise<{
49
+ [key: string]: Asset | Asset[] | null;
50
+ }>;
51
+ calcChanges(assets: Assets): Promise<CalculatedChanges>;
52
+ validate(assets: Assets): Promise<void>;
53
+ processChanges(assets: Assets, changes: CalculatedChanges): Promise<void>;
54
+ }
@@ -14,8 +14,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.order = void 0;
16
16
  const validationError_1 = __importDefault(require("../../validationError"));
17
- const logger_1 = __importDefault(require("../../logger"));
18
17
  const utils_1 = require("../../utils");
18
+ const logger_1 = __importDefault(require("../../../logger"));
19
19
  const calculateChanges_1 = require("../../calculateChanges");
20
20
  function order(value) {
21
21
  return function decorator(t, n, descriptor) {
@@ -34,6 +34,8 @@ class APIHandler {
34
34
  this.identifiers = options.identifiers || ['id', 'name'];
35
35
  this.objectFields = options.objectFields || [];
36
36
  this.stripUpdateFields = [...(options.stripUpdateFields || []), this.id];
37
+ this.sensitiveFieldsToObfuscate = options.sensitiveFieldsToObfuscate || [];
38
+ this.stripCreateFields = options.stripCreateFields || [];
37
39
  this.functions = Object.assign({ getAll: 'getAll', create: 'create', delete: 'delete', update: 'update' }, (options.functions || {}));
38
40
  this.updated = 0;
39
41
  this.created = 0;
@@ -56,7 +58,7 @@ class APIHandler {
56
58
  logger_1.default.info(`Updated [${this.type}]: ${this.objString(item)}`);
57
59
  }
58
60
  objString(item) {
59
- return (0, utils_1.dumpJSON)(item);
61
+ return (0, utils_1.convertJsonToString)(item);
60
62
  }
61
63
  getType() {
62
64
  return __awaiter(this, void 0, void 0, function* () {
@@ -68,7 +70,8 @@ class APIHandler {
68
70
  return __awaiter(this, void 0, void 0, function* () {
69
71
  // Load Asset from Tenant
70
72
  logger_1.default.info(`Retrieving ${this.type} data from Auth0`);
71
- this.existing = yield this.getType();
73
+ const data = yield this.getType();
74
+ this.existing = (0, utils_1.obfuscateSensitiveValues)(data, this.sensitiveFieldsToObfuscate);
72
75
  return { [this.type]: this.existing };
73
76
  });
74
77
  }
@@ -76,13 +79,14 @@ class APIHandler {
76
79
  return __awaiter(this, void 0, void 0, function* () {
77
80
  const typeAssets = assets[this.type];
78
81
  // Do nothing if not set
79
- if (!typeAssets)
82
+ if (!typeAssets) {
80
83
  return {
81
84
  del: [],
82
85
  create: [],
83
86
  conflicts: [],
84
87
  update: [],
85
88
  };
89
+ }
86
90
  const existing = yield this.getType();
87
91
  // Figure out what needs to be updated vs created
88
92
  return (0, calculateChanges_1.calculateChanges)({
@@ -106,7 +110,7 @@ class APIHandler {
106
110
  if (duplicateNames.length > 0) {
107
111
  const formatted = duplicateNames.map((dups) => dups.map((d) => `${d.name}`));
108
112
  throw new validationError_1.default(`There are multiple ${this.type} with the same name combinations
109
- ${(0, utils_1.dumpJSON)(formatted)}.
113
+ ${(0, utils_1.convertJsonToString)(formatted)}.
110
114
  Names must be unique.`);
111
115
  }
112
116
  // Do not allow items with same id
@@ -114,7 +118,7 @@ class APIHandler {
114
118
  if (duplicateIDs.length > 0) {
115
119
  const formatted = duplicateIDs.map((dups) => dups.map((d) => `${d[this.id]}`));
116
120
  throw new validationError_1.default(`There are multiple ${this.type} for the following stage-order combinations
117
- ${(0, utils_1.dumpJSON)(formatted)}.
121
+ ${(0, utils_1.convertJsonToString)(formatted)}.
118
122
  Only one rule must be defined for the same order number in a stage.`);
119
123
  }
120
124
  });
@@ -145,7 +149,7 @@ class APIHandler {
145
149
  .addEachTask({
146
150
  data: del || [],
147
151
  generator: (delItem) => {
148
- const delFunction = this.getClientFN('delete');
152
+ const delFunction = this.getClientFN(this.functions.delete);
149
153
  return delFunction({ [this.id]: delItem[this.id] })
150
154
  .then(() => {
151
155
  this.didDelete(delItem);
@@ -164,10 +168,13 @@ class APIHandler {
164
168
  .addEachTask({
165
169
  data: conflicts || [],
166
170
  generator: (updateItem) => {
167
- const updateFN = this.getClientFN('update');
171
+ const updateFN = this.getClientFN(this.functions.update);
168
172
  const params = { [this.id]: updateItem[this.id] };
169
- const payload = (0, utils_1.stripFields)(Object.assign({}, updateItem), this.stripUpdateFields);
170
- return updateFN(params, payload)
173
+ const updatePayload = (() => {
174
+ let data = (0, utils_1.stripFields)(Object.assign({}, updateItem), this.stripUpdateFields);
175
+ return (0, utils_1.stripObfuscatedFieldsFromPayload)(data, this.sensitiveFieldsToObfuscate);
176
+ })();
177
+ return updateFN(params, updatePayload)
171
178
  .then((data) => this.didUpdate(data))
172
179
  .catch((err) => {
173
180
  throw new Error(`Problem updating ${this.type} ${this.objString(updateItem)}\n${err}`);
@@ -180,8 +187,12 @@ class APIHandler {
180
187
  .addEachTask({
181
188
  data: create || [],
182
189
  generator: (createItem) => {
183
- const createFunction = this.getClientFN('create');
184
- return createFunction(createItem)
190
+ const createFunction = this.getClientFN(this.functions.create);
191
+ const createPayload = (() => {
192
+ const strippedPayload = (0, utils_1.stripFields)(createItem, this.stripCreateFields);
193
+ return (0, utils_1.stripObfuscatedFieldsFromPayload)(strippedPayload, this.sensitiveFieldsToObfuscate);
194
+ })();
195
+ return createFunction(createPayload)
185
196
  .then((data) => {
186
197
  this.didCreate(data);
187
198
  this.created += 1;
@@ -197,10 +208,13 @@ class APIHandler {
197
208
  .addEachTask({
198
209
  data: update || [],
199
210
  generator: (updateItem) => {
200
- const updateFN = this.getClientFN('update');
211
+ const updateFN = this.getClientFN(this.functions.update);
201
212
  const params = { [this.id]: updateItem[this.id] };
202
- const payload = (0, utils_1.stripFields)(Object.assign({}, updateItem), this.stripUpdateFields);
203
- return updateFN(params, payload)
213
+ const updatePayload = (() => {
214
+ let data = (0, utils_1.stripFields)(Object.assign({}, updateItem), this.stripUpdateFields);
215
+ return (0, utils_1.stripObfuscatedFieldsFromPayload)(data, this.sensitiveFieldsToObfuscate);
216
+ })();
217
+ return updateFN(params, updatePayload)
204
218
  .then((data) => {
205
219
  this.didUpdate(data);
206
220
  this.updated += 1;
@@ -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 EmailProviderHandler extends DefaultHandler {
7
+ constructor(options: DefaultHandler);
8
+ getType(): Promise<Asset>;
9
+ objString(provider: any): string;
10
+ processChanges(assets: Assets): Promise<void>;
11
+ }
@@ -0,0 +1,26 @@
1
+ import DefaultHandler from './default';
2
+ import { Assets, Asset } from '../../../types';
3
+ export declare const supportedTemplates: string[];
4
+ export declare const schema: {
5
+ type: string;
6
+ items: {
7
+ type: string;
8
+ properties: {
9
+ template: {
10
+ type: string;
11
+ enum: string[];
12
+ };
13
+ body: {
14
+ type: string;
15
+ default: string;
16
+ };
17
+ };
18
+ required: string[];
19
+ };
20
+ };
21
+ export default class EmailTemplateHandler extends DefaultHandler {
22
+ constructor(options: DefaultHandler);
23
+ getType(): Promise<Asset>;
24
+ updateOrCreate(emailTemplate: any): Promise<void>;
25
+ processChanges(assets: Assets): Promise<void>;
26
+ }
@@ -0,0 +1,25 @@
1
+ import DefaultHandler from './default';
2
+ import { Asset, Assets } from '../../../types';
3
+ export declare const schema: {
4
+ type: string;
5
+ items: {
6
+ type: string;
7
+ properties: {
8
+ name: {
9
+ type: string;
10
+ enum: string[];
11
+ };
12
+ provider: {
13
+ type: string;
14
+ enum: string[];
15
+ };
16
+ };
17
+ required: string[];
18
+ };
19
+ };
20
+ export default class GuardianFactorProvidersHandler extends DefaultHandler {
21
+ existing: Asset[];
22
+ constructor(options: DefaultHandler);
23
+ getType(): Promise<Asset[]>;
24
+ processChanges(assets: Assets): Promise<void>;
25
+ }
@@ -0,0 +1,21 @@
1
+ import DefaultHandler from './default';
2
+ import { Assets, Asset } from '../../../types';
3
+ export declare const schema: {
4
+ type: string;
5
+ items: {
6
+ type: string;
7
+ properties: {
8
+ name: {
9
+ type: string;
10
+ enum: string[];
11
+ };
12
+ };
13
+ required: string[];
14
+ };
15
+ };
16
+ export default class GuardianFactorTemplatesHandler extends DefaultHandler {
17
+ existing: Asset[];
18
+ constructor(options: any);
19
+ getType(): Promise<Asset[]>;
20
+ processChanges(assets: Assets): Promise<void>;
21
+ }
@@ -0,0 +1,21 @@
1
+ import DefaultHandler from './default';
2
+ import { Asset, Assets } from '../../../types';
3
+ export declare const schema: {
4
+ type: string;
5
+ items: {
6
+ type: string;
7
+ properties: {
8
+ name: {
9
+ type: string;
10
+ enum: string[];
11
+ };
12
+ };
13
+ required: string[];
14
+ };
15
+ };
16
+ export default class GuardianFactorsHandler extends DefaultHandler {
17
+ existing: Asset[];
18
+ constructor(options: DefaultHandler);
19
+ getType(): Promise<Asset[]>;
20
+ processChanges(assets: Assets): Promise<void>;
21
+ }
@@ -0,0 +1,21 @@
1
+ import DefaultHandler from './default';
2
+ import { Asset, Assets } from '../../../types';
3
+ export declare const schema: {
4
+ type: string;
5
+ properties: {
6
+ message_types: {
7
+ type: string;
8
+ items: {
9
+ type: string;
10
+ enum: string[];
11
+ };
12
+ };
13
+ };
14
+ additionalProperties: boolean;
15
+ };
16
+ export default class GuardianPhoneMessageTypesHandler extends DefaultHandler {
17
+ existing: Asset[];
18
+ constructor(options: DefaultHandler);
19
+ getType(): Promise<Asset[] | {}>;
20
+ processChanges(assets: Assets): Promise<void>;
21
+ }
@@ -0,0 +1,18 @@
1
+ import DefaultHandler from './default';
2
+ import { Asset, Assets } from '../../../types';
3
+ export declare const schema: {
4
+ type: string;
5
+ properties: {
6
+ provider: {
7
+ type: string;
8
+ enum: string[];
9
+ };
10
+ };
11
+ additionalProperties: boolean;
12
+ };
13
+ export default class GuardianPhoneSelectedProviderHandler extends DefaultHandler {
14
+ existing: Asset[];
15
+ constructor(options: any);
16
+ getType(): Promise<{}>;
17
+ processChanges(assets: Assets): Promise<void>;
18
+ }
@@ -0,0 +1,23 @@
1
+ import DefaultHandler from './default';
2
+ import { Asset, Assets } from '../../../types';
3
+ export declare const schema: {
4
+ type: string;
5
+ properties: {
6
+ policies: {
7
+ type: string;
8
+ items: {
9
+ type: string;
10
+ enum: string[];
11
+ };
12
+ };
13
+ };
14
+ additionalProperties: boolean;
15
+ };
16
+ export default class GuardianPoliciesHandler extends DefaultHandler {
17
+ existing: {
18
+ policies: Asset[];
19
+ };
20
+ constructor(options: any);
21
+ getType(): Promise<GuardianPoliciesHandler['existing'] | {}>;
22
+ processChanges(assets: Assets): Promise<void>;
23
+ }
@@ -0,0 +1,58 @@
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
+ enabled: {
26
+ type: string;
27
+ description: string;
28
+ default: boolean;
29
+ };
30
+ triggerId: {
31
+ type: string;
32
+ description: string;
33
+ enum: string[];
34
+ };
35
+ secrets: {
36
+ type: string;
37
+ description: string;
38
+ default: {};
39
+ };
40
+ dependencies: {
41
+ type: string;
42
+ default: {};
43
+ description: string;
44
+ };
45
+ };
46
+ required: string[];
47
+ };
48
+ };
49
+ export default class HooksHandler extends DefaultHandler {
50
+ existing: Asset[];
51
+ constructor(options: DefaultHandler);
52
+ objString(hook: any): string;
53
+ processSecrets(hooks: any): Promise<void>;
54
+ getType(reload: boolean): Promise<Asset[]>;
55
+ calcChanges(assets: Assets): Promise<CalculatedChanges>;
56
+ validate(assets: any): Promise<void>;
57
+ processChanges(assets: Assets): Promise<void>;
58
+ }
@@ -0,0 +1,134 @@
1
+ import APIHandler from './default';
2
+ declare const _default: {
3
+ rules: {
4
+ default: typeof APIHandler;
5
+ excludeSchema?: any;
6
+ schema: any;
7
+ };
8
+ rulesConfigs: {
9
+ default: typeof APIHandler;
10
+ excludeSchema?: any;
11
+ schema: any;
12
+ };
13
+ hooks: {
14
+ default: typeof APIHandler;
15
+ excludeSchema?: any;
16
+ schema: any;
17
+ };
18
+ pages: {
19
+ default: typeof APIHandler;
20
+ excludeSchema?: any;
21
+ schema: any;
22
+ };
23
+ databases: {
24
+ default: typeof APIHandler;
25
+ excludeSchema?: any;
26
+ schema: any;
27
+ };
28
+ clientGrants: {
29
+ default: typeof APIHandler;
30
+ excludeSchema?: any;
31
+ schema: any;
32
+ };
33
+ resourceServers: {
34
+ default: typeof APIHandler;
35
+ excludeSchema?: any;
36
+ schema: any;
37
+ };
38
+ clients: {
39
+ default: typeof APIHandler;
40
+ excludeSchema?: any;
41
+ schema: any;
42
+ };
43
+ connections: {
44
+ default: typeof APIHandler;
45
+ excludeSchema?: any;
46
+ schema: any;
47
+ };
48
+ tenant: {
49
+ default: typeof APIHandler;
50
+ excludeSchema?: any;
51
+ schema: any;
52
+ };
53
+ emailProvider: {
54
+ default: typeof APIHandler;
55
+ excludeSchema?: any;
56
+ schema: any;
57
+ };
58
+ emailTemplates: {
59
+ default: typeof APIHandler;
60
+ excludeSchema?: any;
61
+ schema: any;
62
+ };
63
+ guardianFactors: {
64
+ default: typeof APIHandler;
65
+ excludeSchema?: any;
66
+ schema: any;
67
+ };
68
+ guardianFactorProviders: {
69
+ default: typeof APIHandler;
70
+ excludeSchema?: any;
71
+ schema: any;
72
+ };
73
+ guardianFactorTemplates: {
74
+ default: typeof APIHandler;
75
+ excludeSchema?: any;
76
+ schema: any;
77
+ };
78
+ migrations: {
79
+ default: typeof APIHandler;
80
+ excludeSchema?: any;
81
+ schema: any;
82
+ };
83
+ guardianPhoneFactorMessageTypes: {
84
+ default: typeof APIHandler;
85
+ excludeSchema?: any;
86
+ schema: any;
87
+ };
88
+ guardianPhoneFactorSelectedProvider: {
89
+ default: typeof APIHandler;
90
+ excludeSchema?: any;
91
+ schema: any;
92
+ };
93
+ guardianPolicies: {
94
+ default: typeof APIHandler;
95
+ excludeSchema?: any;
96
+ schema: any;
97
+ };
98
+ roles: {
99
+ default: typeof APIHandler;
100
+ excludeSchema?: any;
101
+ schema: any;
102
+ };
103
+ actions: {
104
+ default: typeof APIHandler;
105
+ excludeSchema?: any;
106
+ schema: any;
107
+ };
108
+ organizations: {
109
+ default: typeof APIHandler;
110
+ excludeSchema?: any;
111
+ schema: any;
112
+ };
113
+ triggers: {
114
+ default: typeof APIHandler;
115
+ excludeSchema?: any;
116
+ schema: any;
117
+ };
118
+ attackProtection: {
119
+ default: typeof APIHandler;
120
+ excludeSchema?: any;
121
+ schema: any;
122
+ };
123
+ branding: {
124
+ default: typeof APIHandler;
125
+ excludeSchema?: any;
126
+ schema: any;
127
+ };
128
+ logStreams: {
129
+ default: typeof APIHandler;
130
+ excludeSchema?: any;
131
+ schema: any;
132
+ };
133
+ };
134
+ export default _default;
@@ -50,6 +50,7 @@ const actions = __importStar(require("./actions"));
50
50
  const triggers = __importStar(require("./triggers"));
51
51
  const organizations = __importStar(require("./organizations"));
52
52
  const attackProtection = __importStar(require("./attackProtection"));
53
+ const logStreams = __importStar(require("./logStreams"));
53
54
  const auth0ApiHandlers = {
54
55
  rules,
55
56
  rulesConfigs,
@@ -78,5 +79,6 @@ const auth0ApiHandlers = {
78
79
  triggers,
79
80
  organizations,
80
81
  attackProtection,
82
+ logStreams,
81
83
  };
82
84
  exports.default = auth0ApiHandlers; // TODO: apply stronger types to schema properties
@@ -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;