auth0-deploy-cli 7.10.0 → 7.12.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 (142) hide show
  1. package/CHANGELOG.md +34 -1
  2. package/lib/context/directory/handlers/actions.d.ts +2 -3
  3. package/lib/context/directory/handlers/actions.js +4 -4
  4. package/lib/context/directory/handlers/attackProtection.d.ts +6 -7
  5. package/lib/context/directory/handlers/attackProtection.js +3 -1
  6. package/lib/context/directory/handlers/branding.d.ts +2 -3
  7. package/lib/context/directory/handlers/branding.js +8 -18
  8. package/lib/context/directory/handlers/clientGrants.d.ts +2 -3
  9. package/lib/context/directory/handlers/clientGrants.js +3 -2
  10. package/lib/context/directory/handlers/clients.d.ts +2 -3
  11. package/lib/context/directory/handlers/clients.js +1 -1
  12. package/lib/context/directory/handlers/connections.d.ts +2 -3
  13. package/lib/context/directory/handlers/connections.js +3 -3
  14. package/lib/context/directory/handlers/customDomains.d.ts +5 -0
  15. package/lib/context/directory/handlers/customDomains.js +46 -0
  16. package/lib/context/directory/handlers/databases.d.ts +2 -3
  17. package/lib/context/directory/handlers/databases.js +2 -2
  18. package/lib/context/directory/handlers/emailProvider.d.ts +2 -3
  19. package/lib/context/directory/handlers/emailProvider.js +12 -10
  20. package/lib/context/directory/handlers/emailTemplates.d.ts +2 -3
  21. package/lib/context/directory/handlers/emailTemplates.js +2 -2
  22. package/lib/context/directory/handlers/guardianFactorProviders.d.ts +2 -3
  23. package/lib/context/directory/handlers/guardianFactorProviders.js +1 -1
  24. package/lib/context/directory/handlers/guardianFactorTemplates.d.ts +2 -3
  25. package/lib/context/directory/handlers/guardianFactorTemplates.js +1 -1
  26. package/lib/context/directory/handlers/guardianFactors.d.ts +2 -3
  27. package/lib/context/directory/handlers/guardianFactors.js +1 -1
  28. package/lib/context/directory/handlers/guardianPhoneFactorMessageTypes.d.ts +2 -3
  29. package/lib/context/directory/handlers/guardianPhoneFactorMessageTypes.js +6 -6
  30. package/lib/context/directory/handlers/guardianPhoneFactorSelectedProvider.d.ts +2 -3
  31. package/lib/context/directory/handlers/guardianPhoneFactorSelectedProvider.js +6 -6
  32. package/lib/context/directory/handlers/guardianPolicies.d.ts +2 -3
  33. package/lib/context/directory/handlers/guardianPolicies.js +6 -6
  34. package/lib/context/directory/handlers/hooks.d.ts +2 -3
  35. package/lib/context/directory/handlers/hooks.js +3 -3
  36. package/lib/context/directory/handlers/index.d.ts +2 -2
  37. package/lib/context/directory/handlers/index.js +4 -0
  38. package/lib/context/directory/handlers/logStreams.d.ts +2 -4
  39. package/lib/context/directory/handlers/logStreams.js +2 -2
  40. package/lib/context/directory/handlers/migrations.d.ts +2 -3
  41. package/lib/context/directory/handlers/migrations.js +2 -2
  42. package/lib/context/directory/handlers/organizations.d.ts +2 -3
  43. package/lib/context/directory/handlers/organizations.js +1 -1
  44. package/lib/context/directory/handlers/pages.d.ts +2 -3
  45. package/lib/context/directory/handlers/pages.js +2 -2
  46. package/lib/context/directory/handlers/prompts.d.ts +6 -0
  47. package/lib/context/directory/handlers/prompts.js +81 -0
  48. package/lib/context/directory/handlers/resourceServers.d.ts +2 -3
  49. package/lib/context/directory/handlers/resourceServers.js +1 -1
  50. package/lib/context/directory/handlers/roles.d.ts +2 -3
  51. package/lib/context/directory/handlers/roles.js +1 -1
  52. package/lib/context/directory/handlers/rules.d.ts +2 -3
  53. package/lib/context/directory/handlers/rules.js +2 -2
  54. package/lib/context/directory/handlers/rulesConfigs.d.ts +2 -3
  55. package/lib/context/directory/handlers/rulesConfigs.js +1 -1
  56. package/lib/context/directory/handlers/tenant.d.ts +7 -7
  57. package/lib/context/directory/handlers/tenant.js +11 -10
  58. package/lib/context/directory/handlers/triggers.d.ts +2 -3
  59. package/lib/context/directory/handlers/triggers.js +1 -1
  60. package/lib/context/yaml/handlers/actions.d.ts +2 -3
  61. package/lib/context/yaml/handlers/actions.js +6 -8
  62. package/lib/context/yaml/handlers/attackProtection.d.ts +6 -3
  63. package/lib/context/yaml/handlers/attackProtection.js +9 -1
  64. package/lib/context/yaml/handlers/branding.d.ts +6 -6
  65. package/lib/context/yaml/handlers/branding.js +11 -6
  66. package/lib/context/yaml/handlers/clientGrants.d.ts +2 -3
  67. package/lib/context/yaml/handlers/clientGrants.js +7 -6
  68. package/lib/context/yaml/handlers/clients.d.ts +2 -3
  69. package/lib/context/yaml/handlers/clients.js +6 -3
  70. package/lib/context/yaml/handlers/connections.d.ts +2 -3
  71. package/lib/context/yaml/handlers/connections.js +6 -9
  72. package/lib/context/yaml/handlers/customDomains.d.ts +5 -0
  73. package/lib/context/yaml/handlers/customDomains.js +26 -0
  74. package/lib/context/yaml/handlers/databases.d.ts +3 -4
  75. package/lib/context/yaml/handlers/databases.js +7 -7
  76. package/lib/context/yaml/handlers/emailProvider.d.ts +2 -3
  77. package/lib/context/yaml/handlers/emailProvider.js +17 -10
  78. package/lib/context/yaml/handlers/emailTemplates.d.ts +2 -3
  79. package/lib/context/yaml/handlers/emailTemplates.js +16 -13
  80. package/lib/context/yaml/handlers/guardianFactorProviders.d.ts +2 -3
  81. package/lib/context/yaml/handlers/guardianFactorProviders.js +4 -2
  82. package/lib/context/yaml/handlers/guardianFactorTemplates.d.ts +2 -3
  83. package/lib/context/yaml/handlers/guardianFactorTemplates.js +4 -2
  84. package/lib/context/yaml/handlers/guardianFactors.d.ts +2 -3
  85. package/lib/context/yaml/handlers/guardianFactors.js +4 -2
  86. package/lib/context/yaml/handlers/guardianPhoneFactorMessageTypes.d.ts +2 -3
  87. package/lib/context/yaml/handlers/guardianPhoneFactorMessageTypes.js +4 -2
  88. package/lib/context/yaml/handlers/guardianPhoneFactorSelectedProvider.d.ts +2 -3
  89. package/lib/context/yaml/handlers/guardianPhoneFactorSelectedProvider.js +4 -2
  90. package/lib/context/yaml/handlers/guardianPolicies.d.ts +4 -3
  91. package/lib/context/yaml/handlers/guardianPolicies.js +4 -2
  92. package/lib/context/yaml/handlers/hooks.d.ts +2 -3
  93. package/lib/context/yaml/handlers/hooks.js +20 -19
  94. package/lib/context/yaml/handlers/index.d.ts +1 -1
  95. package/lib/context/yaml/handlers/index.js +4 -0
  96. package/lib/context/yaml/handlers/logStreams.d.ts +2 -4
  97. package/lib/context/yaml/handlers/logStreams.js +4 -1
  98. package/lib/context/yaml/handlers/migrations.d.ts +2 -3
  99. package/lib/context/yaml/handlers/migrations.js +5 -9
  100. package/lib/context/yaml/handlers/organizations.d.ts +2 -1
  101. package/lib/context/yaml/handlers/organizations.js +17 -15
  102. package/lib/context/yaml/handlers/pages.d.ts +2 -3
  103. package/lib/context/yaml/handlers/pages.js +20 -18
  104. package/lib/context/yaml/handlers/prompts.d.ts +6 -0
  105. package/lib/context/yaml/handlers/prompts.js +26 -0
  106. package/lib/context/yaml/handlers/resourceServers.d.ts +2 -3
  107. package/lib/context/yaml/handlers/resourceServers.js +8 -13
  108. package/lib/context/yaml/handlers/roles.d.ts +2 -3
  109. package/lib/context/yaml/handlers/roles.js +13 -11
  110. package/lib/context/yaml/handlers/rules.d.ts +2 -3
  111. package/lib/context/yaml/handlers/rules.js +18 -17
  112. package/lib/context/yaml/handlers/rulesConfigs.d.ts +2 -3
  113. package/lib/context/yaml/handlers/rulesConfigs.js +9 -5
  114. package/lib/context/yaml/handlers/tenant.d.ts +2 -3
  115. package/lib/context/yaml/handlers/tenant.js +4 -3
  116. package/lib/context/yaml/handlers/triggers.d.ts +2 -3
  117. package/lib/context/yaml/handlers/triggers.js +2 -2
  118. package/lib/context/yaml/index.js +2 -1
  119. package/lib/index.d.ts +2 -0
  120. package/lib/tools/auth0/handlers/actions.js +23 -7
  121. package/lib/tools/auth0/handlers/branding.d.ts +2 -2
  122. package/lib/tools/auth0/handlers/clientGrants.js +1 -1
  123. package/lib/tools/auth0/handlers/connections.js +1 -1
  124. package/lib/tools/auth0/handlers/customDomains.d.ts +43 -0
  125. package/lib/tools/auth0/handlers/customDomains.js +85 -0
  126. package/lib/tools/auth0/handlers/default.js +9 -2
  127. package/lib/tools/auth0/handlers/index.d.ts +34 -24
  128. package/lib/tools/auth0/handlers/index.js +2 -0
  129. package/lib/tools/auth0/handlers/prompts.d.ts +41 -3
  130. package/lib/tools/auth0/handlers/prompts.js +139 -19
  131. package/lib/tools/auth0/handlers/rules.js +2 -2
  132. package/lib/tools/auth0/index.js +5 -2
  133. package/lib/tools/constants.d.ts +2 -0
  134. package/lib/tools/constants.js +2 -0
  135. package/lib/tools/index.d.ts +2 -0
  136. package/lib/tools/utils.d.ts +9 -0
  137. package/lib/tools/utils.js +33 -1
  138. package/lib/types.d.ts +60 -37
  139. package/lib/types.js +46 -0
  140. package/lib/utils.d.ts +82 -29
  141. package/lib/utils.js +1 -1
  142. package/package.json +7 -4
@@ -5,37 +5,37 @@ declare const _default: {
5
5
  excludeSchema?: any;
6
6
  schema: any;
7
7
  };
8
- rulesConfigs: {
8
+ hooks: {
9
9
  default: typeof APIHandler;
10
10
  excludeSchema?: any;
11
11
  schema: any;
12
12
  };
13
- hooks: {
13
+ actions: {
14
14
  default: typeof APIHandler;
15
15
  excludeSchema?: any;
16
16
  schema: any;
17
17
  };
18
- pages: {
18
+ triggers: {
19
19
  default: typeof APIHandler;
20
20
  excludeSchema?: any;
21
21
  schema: any;
22
22
  };
23
- databases: {
23
+ pages: {
24
24
  default: typeof APIHandler;
25
25
  excludeSchema?: any;
26
26
  schema: any;
27
27
  };
28
- clientGrants: {
28
+ resourceServers: {
29
29
  default: typeof APIHandler;
30
30
  excludeSchema?: any;
31
31
  schema: any;
32
32
  };
33
- resourceServers: {
33
+ clients: {
34
34
  default: typeof APIHandler;
35
35
  excludeSchema?: any;
36
36
  schema: any;
37
37
  };
38
- clients: {
38
+ branding: {
39
39
  default: typeof APIHandler;
40
40
  excludeSchema?: any;
41
41
  schema: any;
@@ -45,87 +45,97 @@ declare const _default: {
45
45
  excludeSchema?: any;
46
46
  schema: any;
47
47
  };
48
- tenant: {
48
+ roles: {
49
49
  default: typeof APIHandler;
50
50
  excludeSchema?: any;
51
51
  schema: any;
52
52
  };
53
- emailProvider: {
53
+ prompts: {
54
54
  default: typeof APIHandler;
55
55
  excludeSchema?: any;
56
56
  schema: any;
57
57
  };
58
- emailTemplates: {
58
+ attackProtection: {
59
59
  default: typeof APIHandler;
60
60
  excludeSchema?: any;
61
61
  schema: any;
62
62
  };
63
- guardianFactors: {
63
+ clientGrants: {
64
64
  default: typeof APIHandler;
65
65
  excludeSchema?: any;
66
66
  schema: any;
67
67
  };
68
- guardianFactorProviders: {
68
+ customDomains: {
69
69
  default: typeof APIHandler;
70
70
  excludeSchema?: any;
71
71
  schema: any;
72
72
  };
73
- guardianFactorTemplates: {
73
+ databases: {
74
74
  default: typeof APIHandler;
75
75
  excludeSchema?: any;
76
76
  schema: any;
77
77
  };
78
- migrations: {
78
+ emailProvider: {
79
79
  default: typeof APIHandler;
80
80
  excludeSchema?: any;
81
81
  schema: any;
82
82
  };
83
- guardianPhoneFactorMessageTypes: {
83
+ emailTemplates: {
84
84
  default: typeof APIHandler;
85
85
  excludeSchema?: any;
86
86
  schema: any;
87
87
  };
88
- guardianPhoneFactorSelectedProvider: {
88
+ guardianFactorProviders: {
89
89
  default: typeof APIHandler;
90
90
  excludeSchema?: any;
91
91
  schema: any;
92
92
  };
93
- guardianPolicies: {
93
+ guardianFactors: {
94
94
  default: typeof APIHandler;
95
95
  excludeSchema?: any;
96
96
  schema: any;
97
97
  };
98
- roles: {
98
+ guardianFactorTemplates: {
99
99
  default: typeof APIHandler;
100
100
  excludeSchema?: any;
101
101
  schema: any;
102
102
  };
103
- actions: {
103
+ guardianPhoneFactorMessageTypes: {
104
104
  default: typeof APIHandler;
105
105
  excludeSchema?: any;
106
106
  schema: any;
107
107
  };
108
- organizations: {
108
+ guardianPhoneFactorSelectedProvider: {
109
109
  default: typeof APIHandler;
110
110
  excludeSchema?: any;
111
111
  schema: any;
112
112
  };
113
- triggers: {
113
+ guardianPolicies: {
114
114
  default: typeof APIHandler;
115
115
  excludeSchema?: any;
116
116
  schema: any;
117
117
  };
118
- attackProtection: {
118
+ logStreams: {
119
119
  default: typeof APIHandler;
120
120
  excludeSchema?: any;
121
121
  schema: any;
122
122
  };
123
- branding: {
123
+ migrations: {
124
124
  default: typeof APIHandler;
125
125
  excludeSchema?: any;
126
126
  schema: any;
127
127
  };
128
- logStreams: {
128
+ organizations: {
129
+ default: typeof APIHandler;
130
+ excludeSchema?: any;
131
+ schema: any;
132
+ };
133
+ rulesConfigs: {
134
+ default: typeof APIHandler;
135
+ excludeSchema?: any;
136
+ schema: any;
137
+ };
138
+ tenant: {
129
139
  default: typeof APIHandler;
130
140
  excludeSchema?: any;
131
141
  schema: any;
@@ -51,6 +51,7 @@ const triggers = __importStar(require("./triggers"));
51
51
  const organizations = __importStar(require("./organizations"));
52
52
  const attackProtection = __importStar(require("./attackProtection"));
53
53
  const logStreams = __importStar(require("./logStreams"));
54
+ const customDomains = __importStar(require("./customDomains"));
54
55
  const auth0ApiHandlers = {
55
56
  rules,
56
57
  rulesConfigs,
@@ -80,5 +81,6 @@ const auth0ApiHandlers = {
80
81
  organizations,
81
82
  attackProtection,
82
83
  logStreams,
84
+ customDomains,
83
85
  };
84
86
  exports.default = auth0ApiHandlers; // TODO: apply stronger types to schema properties
@@ -1,11 +1,49 @@
1
1
  import DefaultHandler from './default';
2
- import { Asset, Assets } from '../../../types';
2
+ import { Assets, Language } from '../../../types';
3
+ declare const promptScreenTypes: readonly ["login", "login-id", "login-password", "login-email-verification", "signup", "signup-id", "signup-password", "reset-password", "consent", "mfa-push", "mfa-otp", "mfa-voice", "mfa-phone", "mfa-webauthn", "mfa-sms", "mfa-email", "mfa-recovery-code", "mfa", "status", "device-flow", "email-verification", "email-otp-challenge", "organizations", "invitation", "common"];
3
4
  export declare const schema: {
4
5
  type: string;
6
+ properties: {
7
+ universal_login_experience: {
8
+ type: string;
9
+ enum: string[];
10
+ };
11
+ webauthn_platform_first_factor: {
12
+ type: string;
13
+ };
14
+ identifier_first: {
15
+ type: string;
16
+ };
17
+ customText: {
18
+ type: string;
19
+ properties: {};
20
+ };
21
+ };
5
22
  };
23
+ export declare type PromptScreenTypes = typeof promptScreenTypes[number];
24
+ export declare type PromptSettings = {
25
+ universal_login_experience?: 'new' | 'classic';
26
+ webauthn_platform_first_factor?: boolean;
27
+ identifier_first?: boolean;
28
+ };
29
+ export declare type PromptsCustomText = {
30
+ [key in PromptScreenTypes]: {
31
+ [key: string]: string;
32
+ };
33
+ };
34
+ export declare type Prompts = Partial<PromptSettings & {
35
+ customText: AllPromptsByLanguage;
36
+ }>;
37
+ export declare type AllPromptsByLanguage = Partial<{
38
+ [key in Language]: Partial<PromptsCustomText>;
39
+ }>;
6
40
  export default class PromptsHandler extends DefaultHandler {
7
- existing: Asset[];
41
+ existing: Prompts;
8
42
  constructor(options: DefaultHandler);
9
- getType(): Promise<Asset[]>;
43
+ objString({ customText }: Prompts): string;
44
+ getType(): Promise<Prompts | null>;
45
+ getCustomTextSettings(): Promise<AllPromptsByLanguage>;
10
46
  processChanges(assets: Assets): Promise<void>;
47
+ updateCustomTextSettings(customText: Prompts['customText']): Promise<void>;
11
48
  }
49
+ export {};
@@ -8,46 +8,166 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __rest = (this && this.__rest) || function (s, e) {
12
+ var t = {};
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
+ t[p] = s[p];
15
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
+ t[p[i]] = s[p[i]];
19
+ }
20
+ return t;
21
+ };
11
22
  var __importDefault = (this && this.__importDefault) || function (mod) {
12
23
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
24
  };
14
25
  Object.defineProperty(exports, "__esModule", { value: true });
15
26
  exports.schema = void 0;
16
- //@ts-nocheck because prompts haven't been fully implemented in this codebase yet
17
27
  const default_1 = __importDefault(require("./default"));
18
- exports.schema = { type: 'object' };
28
+ const types_1 = require("../../../types");
29
+ const lodash_1 = require("lodash");
30
+ const promptScreenTypes = [
31
+ 'login',
32
+ 'login-id',
33
+ 'login-password',
34
+ 'login-email-verification',
35
+ 'signup',
36
+ 'signup-id',
37
+ 'signup-password',
38
+ 'reset-password',
39
+ 'consent',
40
+ 'mfa-push',
41
+ 'mfa-otp',
42
+ 'mfa-voice',
43
+ 'mfa-phone',
44
+ 'mfa-webauthn',
45
+ 'mfa-sms',
46
+ 'mfa-email',
47
+ 'mfa-recovery-code',
48
+ 'mfa',
49
+ 'status',
50
+ 'device-flow',
51
+ 'email-verification',
52
+ 'email-otp-challenge',
53
+ 'organizations',
54
+ 'invitation',
55
+ 'common',
56
+ ];
57
+ exports.schema = {
58
+ type: 'object',
59
+ properties: {
60
+ universal_login_experience: {
61
+ type: 'string',
62
+ enum: ['new', 'classic'],
63
+ },
64
+ webauthn_platform_first_factor: {
65
+ type: 'boolean',
66
+ },
67
+ identifier_first: {
68
+ type: 'boolean',
69
+ },
70
+ customText: {
71
+ type: 'object',
72
+ properties: types_1.languages.reduce((acc, language) => {
73
+ return Object.assign(Object.assign({}, acc), { [language]: {
74
+ type: 'object',
75
+ properties: promptScreenTypes.reduce((acc, screenType) => {
76
+ return Object.assign(Object.assign({}, acc), { [screenType]: {
77
+ type: 'object',
78
+ } });
79
+ }, {}),
80
+ } });
81
+ }, {}),
82
+ },
83
+ },
84
+ };
19
85
  class PromptsHandler extends default_1.default {
20
86
  constructor(options) {
21
87
  super(Object.assign(Object.assign({}, options), { type: 'prompts' }));
22
88
  }
89
+ objString({ customText }) {
90
+ return `Prompts settings${!!customText ? ' and prompts custom text' : ''}`;
91
+ }
23
92
  getType() {
24
93
  return __awaiter(this, void 0, void 0, function* () {
25
- // in case client version does not support branding
26
- if (!this.client.prompts || typeof this.client.prompts.getSettings !== 'function') {
27
- return {};
28
- }
29
- try {
30
- return yield this.client.prompts.getSettings();
31
- }
32
- catch (err) {
33
- if (err.statusCode === 404)
34
- return {};
35
- if (err.statusCode === 501)
36
- return {};
37
- throw err;
38
- }
94
+ const promptsSettings = yield this.client.prompts.getSettings();
95
+ const customText = yield this.getCustomTextSettings();
96
+ return Object.assign(Object.assign({}, promptsSettings), { customText });
97
+ });
98
+ }
99
+ getCustomTextSettings() {
100
+ return __awaiter(this, void 0, void 0, function* () {
101
+ const supportedLanguages = yield this.client.tenant
102
+ .getSettings()
103
+ .then(({ enabled_locales }) => enabled_locales);
104
+ const data = yield Promise.all(supportedLanguages.flatMap((language) => {
105
+ return promptScreenTypes.map((screenType) => {
106
+ return this.client.prompts
107
+ .getCustomTextByLanguage({
108
+ prompt: screenType,
109
+ language,
110
+ })
111
+ .then((customTextData) => {
112
+ if ((0, lodash_1.isEmpty)(customTextData))
113
+ return null;
114
+ return Object.assign({ language }, customTextData);
115
+ });
116
+ });
117
+ })).then((customTextData) => {
118
+ return customTextData
119
+ .filter((customTextData) => {
120
+ return customTextData !== null;
121
+ })
122
+ .reduce((acc, customTextItem) => {
123
+ if ((customTextItem === null || customTextItem === void 0 ? void 0 : customTextItem.language) === undefined)
124
+ return acc;
125
+ const { language } = customTextItem, customTextSettings = __rest(customTextItem, ["language"]);
126
+ return Object.assign(Object.assign({}, acc), { [language]: !!acc[language]
127
+ ? Object.assign(Object.assign({}, acc[language]), customTextSettings) : Object.assign({}, customTextSettings) });
128
+ }, {});
129
+ });
130
+ return data;
39
131
  });
40
132
  }
41
133
  processChanges(assets) {
42
134
  return __awaiter(this, void 0, void 0, function* () {
43
135
  const { prompts } = assets;
44
- // Do nothing if not set
45
- if (!prompts || !Object.keys(prompts).length)
136
+ if (!prompts)
46
137
  return;
47
- yield this.client.prompts.updateSettings({}, prompts);
138
+ const { customText } = prompts, promptSettings = __rest(prompts, ["customText"]);
139
+ if (!(0, lodash_1.isEmpty)(promptSettings)) {
140
+ yield this.client.prompts.updateSettings({}, promptSettings);
141
+ }
142
+ yield this.updateCustomTextSettings(customText);
48
143
  this.updated += 1;
49
144
  this.didUpdate(prompts);
50
145
  });
51
146
  }
147
+ updateCustomTextSettings(customText) {
148
+ return __awaiter(this, void 0, void 0, function* () {
149
+ /*
150
+ Note: deletes are not currently supported
151
+ */
152
+ if (!customText)
153
+ return;
154
+ yield Promise.all(Object.keys(customText).flatMap((language) => {
155
+ const languageScreenTypes = customText[language];
156
+ if (!languageScreenTypes)
157
+ return [];
158
+ return Object.keys(languageScreenTypes).map((prompt) => {
159
+ const body = languageScreenTypes[prompt];
160
+ return this.client.prompts.updateCustomTextByLanguage({
161
+ prompt,
162
+ language,
163
+ //@ts-ignore
164
+ body: {
165
+ [prompt]: languageScreenTypes[prompt],
166
+ } || {},
167
+ });
168
+ });
169
+ }));
170
+ });
171
+ }
52
172
  }
53
173
  exports.default = PromptsHandler;
@@ -175,8 +175,8 @@ class RulesHandler extends default_1.default {
175
175
  yield this.client.pool
176
176
  .addEachTask({
177
177
  data: changes.reOrder,
178
- generator: (rule) => this.client
179
- .updateRule({ id: rule.id }, (0, utils_1.stripFields)(rule, this.stripUpdateFields))
178
+ generator: (rule) => this.client.rules
179
+ .update({ id: rule.id }, (0, utils_1.stripFields)(rule, this.stripUpdateFields))
180
180
  .then(() => {
181
181
  const updated = {
182
182
  name: rule.name,
@@ -62,8 +62,11 @@ class Auth0 {
62
62
  }
63
63
  validate() {
64
64
  return __awaiter(this, void 0, void 0, function* () {
65
- const ajv = new ajv_1.default({ useDefaults: true });
66
- const valid = ajv.validate(schema_1.default, this.assets);
65
+ const ajv = new ajv_1.default({ useDefaults: true, nullable: true });
66
+ const nonNullAssets = Object.keys(this.assets)
67
+ .filter((k) => this.assets[k] != null)
68
+ .reduce((a, k) => (Object.assign(Object.assign({}, a), { [k]: this.assets[k] })), {});
69
+ const valid = ajv.validate(schema_1.default, nonNullAssets);
67
70
  if (!valid) {
68
71
  throw new Error(`Schema validation failed loading ${JSON.stringify(ajv.errors, null, 4)}`);
69
72
  }
@@ -68,5 +68,7 @@ declare const constants: {
68
68
  EMAIL_TEMPLATES_NAMES: string[];
69
69
  SUPPORTED_BRANDING_TEMPLATES: string[];
70
70
  LOG_STREAMS_DIRECTORY: string;
71
+ PROMPTS_DIRECTORY: string;
72
+ CUSTOM_DOMAINS_DIRECTORY: string;
71
73
  };
72
74
  export default constants;
@@ -165,5 +165,7 @@ const constants = {
165
165
  ],
166
166
  SUPPORTED_BRANDING_TEMPLATES: [UNIVERSAL_LOGIN_TEMPLATE],
167
167
  LOG_STREAMS_DIRECTORY: 'log-streams',
168
+ PROMPTS_DIRECTORY: 'prompts',
169
+ CUSTOM_DOMAINS_DIRECTORY: 'custom-domains',
168
170
  };
169
171
  exports.default = constants;
@@ -73,6 +73,8 @@ declare const _default: {
73
73
  EMAIL_TEMPLATES_NAMES: string[];
74
74
  SUPPORTED_BRANDING_TEMPLATES: string[];
75
75
  LOG_STREAMS_DIRECTORY: string;
76
+ PROMPTS_DIRECTORY: string;
77
+ CUSTOM_DOMAINS_DIRECTORY: string;
76
78
  };
77
79
  deploy: typeof deploy;
78
80
  keywordReplace: typeof keywordReplace;
@@ -16,3 +16,12 @@ export declare function filterExcluded(changes: CalculatedChanges, exclude: stri
16
16
  export declare function areArraysEquals(x: any[], y: any[]): boolean;
17
17
  export declare const obfuscateSensitiveValues: (data: Asset | Asset[] | null, sensitiveFieldsToObfuscate: string[]) => Asset | Asset[] | null;
18
18
  export declare const stripObfuscatedFieldsFromPayload: (data: Asset | Asset[] | null, obfuscatedFields: string[]) => Asset | Asset[] | null;
19
+ export declare const detectInsufficientScopeError: <T>(fn: Function) => Promise<{
20
+ hadSufficientScopes: true;
21
+ data: T;
22
+ requiredScopes: [];
23
+ } | {
24
+ hadSufficientScopes: false;
25
+ requiredScopes: string[];
26
+ data: null;
27
+ }>;
@@ -22,11 +22,20 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
25
34
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
35
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
36
  };
28
37
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.stripObfuscatedFieldsFromPayload = exports.obfuscateSensitiveValues = exports.areArraysEquals = exports.filterExcluded = exports.duplicateItems = exports.getEnabledClients = exports.stripFields = exports.convertJsonToString = exports.flatten = exports.loadFileAndReplaceKeywords = exports.convertClientNamesToIds = exports.convertClientNameToId = exports.keywordReplace = exports.keywordStringReplace = exports.keywordArrayReplace = void 0;
38
+ exports.detectInsufficientScopeError = exports.stripObfuscatedFieldsFromPayload = exports.obfuscateSensitiveValues = exports.areArraysEquals = exports.filterExcluded = exports.duplicateItems = exports.getEnabledClients = exports.stripFields = exports.convertJsonToString = exports.flatten = exports.loadFileAndReplaceKeywords = exports.convertClientNamesToIds = exports.convertClientNameToId = exports.keywordReplace = exports.keywordStringReplace = exports.keywordArrayReplace = void 0;
30
39
  const path_1 = __importDefault(require("path"));
31
40
  const fs_1 = __importStar(require("fs"));
32
41
  const dot_prop_1 = __importDefault(require("dot-prop"));
@@ -208,3 +217,26 @@ const stripObfuscatedFieldsFromPayload = (data, obfuscatedFields) => {
208
217
  return newAsset;
209
218
  };
210
219
  exports.stripObfuscatedFieldsFromPayload = stripObfuscatedFieldsFromPayload;
220
+ const detectInsufficientScopeError = (fn) => __awaiter(void 0, void 0, void 0, function* () {
221
+ var _a, _b;
222
+ try {
223
+ const data = yield fn();
224
+ return {
225
+ hadSufficientScopes: true,
226
+ data,
227
+ requiredScopes: [],
228
+ };
229
+ }
230
+ catch (err) {
231
+ if (err.statusCode === 403 && err.message.includes('Insufficient scope')) {
232
+ const requiredScopes = (_b = (_a = err.message) === null || _a === void 0 ? void 0 : _a.split('Insufficient scope, expected any of: ')) === null || _b === void 0 ? void 0 : _b.slice(1);
233
+ return {
234
+ hadSufficientScopes: false,
235
+ requiredScopes,
236
+ data: null,
237
+ };
238
+ }
239
+ throw err;
240
+ }
241
+ });
242
+ exports.detectInsufficientScopeError = detectInsufficientScopeError;