auth0-deploy-cli 8.42.0 → 9.0.0-beta.2

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 (56) hide show
  1. package/CHANGELOG.md +10 -50
  2. package/lib/context/directory/handlers/actionModules.js +10 -12
  3. package/lib/context/directory/handlers/actions.js +10 -13
  4. package/lib/context/directory/handlers/clients.js +0 -15
  5. package/lib/context/directory/handlers/databases.js +3 -4
  6. package/lib/context/directory/handlers/hooks.js +11 -1
  7. package/lib/context/directory/handlers/index.js +0 -4
  8. package/lib/context/directory/handlers/rules.js +11 -1
  9. package/lib/context/directory/index.js +6 -8
  10. package/lib/context/yaml/handlers/clients.js +0 -15
  11. package/lib/context/yaml/handlers/index.js +0 -4
  12. package/lib/context/yaml/index.js +6 -8
  13. package/lib/tools/auth0/handlers/attackProtection.js +5 -16
  14. package/lib/tools/auth0/handlers/clientGrants.d.ts +1 -1
  15. package/lib/tools/auth0/handlers/clients.d.ts +0 -46
  16. package/lib/tools/auth0/handlers/clients.js +1 -128
  17. package/lib/tools/auth0/handlers/connections.d.ts +0 -21
  18. package/lib/tools/auth0/handlers/connections.js +0 -16
  19. package/lib/tools/auth0/handlers/default.js +6 -6
  20. package/lib/tools/auth0/handlers/eventStreams.js +2 -10
  21. package/lib/tools/auth0/handlers/guardianFactorTemplates.js +4 -13
  22. package/lib/tools/auth0/handlers/guardianPhoneFactorMessageTypes.js +9 -11
  23. package/lib/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.js +9 -11
  24. package/lib/tools/auth0/handlers/hooks.js +1 -1
  25. package/lib/tools/auth0/handlers/index.js +0 -8
  26. package/lib/tools/auth0/handlers/networkACLs.d.ts +0 -18
  27. package/lib/tools/auth0/handlers/networkACLs.js +0 -9
  28. package/lib/tools/auth0/handlers/organizations.d.ts +0 -4
  29. package/lib/tools/auth0/handlers/organizations.js +0 -4
  30. package/lib/tools/auth0/handlers/prompts.js +1 -1
  31. package/lib/tools/auth0/handlers/rules.js +7 -19
  32. package/lib/tools/auth0/handlers/tenant.d.ts +0 -23
  33. package/lib/tools/auth0/handlers/tenant.js +0 -24
  34. package/lib/tools/auth0/handlers/themes.d.ts +1 -37
  35. package/lib/tools/auth0/handlers/themes.js +0 -64
  36. package/lib/tools/auth0/index.js +6 -12
  37. package/lib/tools/constants.d.ts +0 -1
  38. package/lib/tools/constants.js +0 -1
  39. package/lib/tools/utils.d.ts +0 -1
  40. package/lib/tools/utils.js +2 -25
  41. package/lib/types.d.ts +1 -3
  42. package/package.json +2 -2
  43. package/lib/context/directory/handlers/clientAuthCredentials.d.ts +0 -5
  44. package/lib/context/directory/handlers/clientAuthCredentials.js +0 -13
  45. package/lib/context/directory/handlers/rateLimitPolicies.d.ts +0 -6
  46. package/lib/context/directory/handlers/rateLimitPolicies.js +0 -53
  47. package/lib/context/yaml/handlers/clientAuthCredentials.d.ts +0 -5
  48. package/lib/context/yaml/handlers/clientAuthCredentials.js +0 -13
  49. package/lib/context/yaml/handlers/rateLimitPolicies.d.ts +0 -6
  50. package/lib/context/yaml/handlers/rateLimitPolicies.js +0 -27
  51. package/lib/tools/auth0/handlers/clientAuthCredentials.d.ts +0 -27
  52. package/lib/tools/auth0/handlers/clientAuthCredentials.js +0 -223
  53. package/lib/tools/auth0/handlers/clientAuthCredentialsPre.d.ts +0 -38
  54. package/lib/tools/auth0/handlers/clientAuthCredentialsPre.js +0 -123
  55. package/lib/tools/auth0/handlers/rateLimitPolicies.d.ts +0 -81
  56. package/lib/tools/auth0/handlers/rateLimitPolicies.js +0 -203
@@ -1,81 +0,0 @@
1
- import { Management } from 'auth0';
2
- import DefaultAPIHandler from './default';
3
- import { Asset, Assets, CalculatedChanges } from '../../../types';
4
- export type RateLimitPolicyConfiguration = Management.RateLimitPolicyConfiguration;
5
- export type RateLimitPolicy = Management.RateLimitPolicy;
6
- export declare const schema: {
7
- type: string;
8
- items: {
9
- type: string;
10
- properties: {
11
- resource: {
12
- type: string;
13
- enum: "oauth_authentication_api"[];
14
- };
15
- consumer: {
16
- type: string;
17
- enum: "client"[];
18
- };
19
- consumer_selector: {
20
- type: string;
21
- };
22
- configuration: {
23
- type: string;
24
- oneOf: ({
25
- required: string[];
26
- properties: {
27
- action: {
28
- type: string;
29
- enum: string[];
30
- };
31
- limit?: undefined;
32
- redirect_uri?: undefined;
33
- };
34
- additionalProperties: boolean;
35
- } | {
36
- required: string[];
37
- properties: {
38
- action: {
39
- type: string;
40
- enum: string[];
41
- };
42
- limit: {
43
- type: string;
44
- };
45
- redirect_uri?: undefined;
46
- };
47
- additionalProperties: boolean;
48
- } | {
49
- required: string[];
50
- properties: {
51
- action: {
52
- type: string;
53
- enum: string[];
54
- };
55
- limit: {
56
- type: string;
57
- };
58
- redirect_uri: {
59
- type: string;
60
- };
61
- };
62
- additionalProperties: boolean;
63
- })[];
64
- };
65
- };
66
- required: string[];
67
- };
68
- };
69
- export default class RateLimitPoliciesHandler extends DefaultAPIHandler {
70
- existing: RateLimitPolicy[] | null;
71
- constructor(config: DefaultAPIHandler);
72
- objString(policy: RateLimitPolicy): string;
73
- getType(): Promise<Asset | null>;
74
- processChanges(assets: Assets): Promise<void>;
75
- createRateLimitPolicy(policy: RateLimitPolicy): Promise<RateLimitPolicy>;
76
- createRateLimitPolicies(creates: CalculatedChanges['create']): Promise<void>;
77
- updateRateLimitPolicy(policy: RateLimitPolicy): Promise<void>;
78
- updateRateLimitPolicies(updates: CalculatedChanges['update']): Promise<void>;
79
- deleteRateLimitPolicy(policy: RateLimitPolicy): Promise<void>;
80
- deleteRateLimitPolicies(data: Asset[]): Promise<void>;
81
- }
@@ -1,203 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.schema = void 0;
7
- const auth0_1 = require("auth0");
8
- const default_1 = __importDefault(require("./default"));
9
- const client_1 = require("../client");
10
- const utils_1 = require("../../utils");
11
- const logger_1 = __importDefault(require("../../../logger"));
12
- exports.schema = {
13
- type: 'array',
14
- items: {
15
- type: 'object',
16
- properties: {
17
- resource: {
18
- type: 'string',
19
- enum: Object.values(auth0_1.Management.RateLimitPolicyResourceEnum),
20
- },
21
- consumer: {
22
- type: 'string',
23
- enum: Object.values(auth0_1.Management.RateLimitPolicyConsumerEnum),
24
- },
25
- consumer_selector: {
26
- type: 'string',
27
- },
28
- configuration: {
29
- type: 'object',
30
- oneOf: [
31
- {
32
- required: ['action'],
33
- properties: {
34
- action: { type: 'string', enum: ['allow'] },
35
- },
36
- additionalProperties: false,
37
- },
38
- {
39
- required: ['action', 'limit'],
40
- properties: {
41
- action: { type: 'string', enum: ['block', 'log'] },
42
- limit: { type: 'number' },
43
- },
44
- additionalProperties: false,
45
- },
46
- {
47
- required: ['action', 'limit', 'redirect_uri'],
48
- properties: {
49
- action: { type: 'string', enum: ['redirect'] },
50
- limit: { type: 'number' },
51
- redirect_uri: { type: 'string' },
52
- },
53
- additionalProperties: false,
54
- },
55
- ],
56
- },
57
- },
58
- required: ['resource', 'consumer', 'consumer_selector', 'configuration'],
59
- },
60
- };
61
- class RateLimitPoliciesHandler extends default_1.default {
62
- constructor(config) {
63
- super({
64
- ...config,
65
- type: 'rateLimitPolicies',
66
- id: 'id',
67
- identifiers: ['id', 'consumer_selector'],
68
- stripCreateFields: ['id', 'created_at', 'updated_at'],
69
- stripUpdateFields: [
70
- 'id',
71
- 'resource',
72
- 'consumer',
73
- 'consumer_selector',
74
- 'created_at',
75
- 'updated_at',
76
- ],
77
- });
78
- }
79
- objString(policy) {
80
- return super.objString({
81
- consumer_selector: policy.consumer_selector,
82
- resource: policy.resource,
83
- });
84
- }
85
- async getType() {
86
- if (this.existing)
87
- return this.existing;
88
- try {
89
- const rateLimitPolicies = await (0, client_1.paginate)(this.client.rateLimitPolicies.list, { checkpoint: true });
90
- this.existing = rateLimitPolicies;
91
- return this.existing;
92
- }
93
- catch (err) {
94
- if (err.statusCode === 404 || err.statusCode === 501) {
95
- return null;
96
- }
97
- if (err.statusCode === 403) {
98
- logger_1.default.debug('Rate Limit Policies feature is not enabled for this tenant. Please contact Auth0 support to enable this feature.');
99
- return null;
100
- }
101
- throw err;
102
- }
103
- }
104
- async processChanges(assets) {
105
- const { rateLimitPolicies } = assets;
106
- if (!rateLimitPolicies)
107
- return;
108
- const { del, update, create } = await this.calcChanges(assets);
109
- if ((0, utils_1.isDryRun)(this.config)) {
110
- if (create.length === 0 && update.length === 0 && del.length === 0) {
111
- return;
112
- }
113
- }
114
- logger_1.default.debug(`Start processChanges for rateLimitPolicies [delete:${del.length}] [update:${update.length}], [create:${create.length}]`);
115
- const changes = [{ del }, { create }, { update }];
116
- await Promise.all(changes.map(async (change) => {
117
- switch (true) {
118
- case change.del && change.del.length > 0:
119
- await this.deleteRateLimitPolicies(change.del);
120
- break;
121
- case change.create && change.create.length > 0:
122
- await this.createRateLimitPolicies(change.create);
123
- break;
124
- case change.update && change.update.length > 0:
125
- await this.updateRateLimitPolicies(change.update);
126
- break;
127
- default:
128
- break;
129
- }
130
- }));
131
- }
132
- async createRateLimitPolicy(policy) {
133
- const created = await this.client.rateLimitPolicies.create(policy);
134
- return created;
135
- }
136
- async createRateLimitPolicies(creates) {
137
- await this.client.pool
138
- .addEachTask({
139
- data: creates || [],
140
- generator: (item) => this.createRateLimitPolicy(item)
141
- .then((data) => {
142
- this.didCreate(data);
143
- this.created += 1;
144
- })
145
- .catch((err) => {
146
- throw new Error(`Problem creating ${this.type} ${this.objString(item)}\n${err}`);
147
- }),
148
- })
149
- .promise();
150
- }
151
- async updateRateLimitPolicy(policy) {
152
- const { id, configuration } = policy;
153
- if (!id) {
154
- throw new Error(`Missing id for ${this.type} ${this.objString(policy)}`);
155
- }
156
- await this.client.rateLimitPolicies.update(id, { configuration });
157
- }
158
- async updateRateLimitPolicies(updates) {
159
- await this.client.pool
160
- .addEachTask({
161
- data: updates || [],
162
- generator: (item) => this.updateRateLimitPolicy(item)
163
- .then(() => {
164
- this.didUpdate(item);
165
- this.updated += 1;
166
- })
167
- .catch((err) => {
168
- throw new Error(`Problem updating ${this.type} ${this.objString(item)}\n${err}`);
169
- }),
170
- })
171
- .promise();
172
- }
173
- async deleteRateLimitPolicy(policy) {
174
- if (!policy.id) {
175
- throw new Error(`Missing id for ${this.type} ${this.objString(policy)}`);
176
- }
177
- await this.client.rateLimitPolicies.delete(policy.id);
178
- }
179
- async deleteRateLimitPolicies(data) {
180
- if (this.config('AUTH0_ALLOW_DELETE') === 'true' ||
181
- this.config('AUTH0_ALLOW_DELETE') === true) {
182
- await this.client.pool
183
- .addEachTask({
184
- data: data || [],
185
- generator: (item) => this.deleteRateLimitPolicy(item)
186
- .then(() => {
187
- this.didDelete(item);
188
- this.deleted += 1;
189
- })
190
- .catch((err) => {
191
- throw new Error(`Problem deleting ${this.type} ${this.objString(item)}\n${err}`);
192
- }),
193
- })
194
- .promise();
195
- }
196
- else {
197
- logger_1.default.warn(`Detected the following ${this.type} should be deleted. Doing so may be destructive.\nYou can enable deletes by setting 'AUTH0_ALLOW_DELETE' to true in the config\n${data
198
- .map((i) => this.objString(i))
199
- .join('\n')}`);
200
- }
201
- }
202
- }
203
- exports.default = RateLimitPoliciesHandler;