auth0-deploy-cli 8.20.4-beta.0 → 8.21.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 (318) hide show
  1. package/.circleci/config.yml +5 -46
  2. package/.eslintignore +5 -0
  3. package/.eslintrc +69 -0
  4. package/CHANGELOG.md +15 -6
  5. package/lib/args.js +1 -0
  6. package/lib/args.js.map +1 -0
  7. package/lib/commands/export.js +49 -41
  8. package/lib/commands/export.js.map +1 -0
  9. package/lib/commands/import.js +43 -36
  10. package/lib/commands/import.js.map +1 -0
  11. package/lib/commands/index.js +1 -0
  12. package/lib/commands/index.js.map +1 -0
  13. package/lib/configFactory.js +1 -0
  14. package/lib/configFactory.js.map +1 -0
  15. package/lib/context/defaults.js +10 -38
  16. package/lib/context/defaults.js.map +1 -0
  17. package/lib/context/directory/handlers/actions.js +39 -40
  18. package/lib/context/directory/handlers/actions.js.map +1 -0
  19. package/lib/context/directory/handlers/attackProtection.js +34 -22
  20. package/lib/context/directory/handlers/attackProtection.js.map +1 -0
  21. package/lib/context/directory/handlers/branding.js +21 -12
  22. package/lib/context/directory/handlers/branding.js.map +1 -0
  23. package/lib/context/directory/handlers/clientGrants.js +62 -52
  24. package/lib/context/directory/handlers/clientGrants.js.map +1 -0
  25. package/lib/context/directory/handlers/clients.js +60 -17
  26. package/lib/context/directory/handlers/clients.js.map +1 -0
  27. package/lib/context/directory/handlers/connectionProfiles.d.ts +11 -0
  28. package/lib/context/directory/handlers/connectionProfiles.js +59 -0
  29. package/lib/context/directory/handlers/connectionProfiles.js.map +1 -0
  30. package/lib/context/directory/handlers/connections.js +41 -32
  31. package/lib/context/directory/handlers/connections.js.map +1 -0
  32. package/lib/context/directory/handlers/customDomains.js +21 -9
  33. package/lib/context/directory/handlers/customDomains.js.map +1 -0
  34. package/lib/context/directory/handlers/databases.js +35 -37
  35. package/lib/context/directory/handlers/databases.js.map +1 -0
  36. package/lib/context/directory/handlers/emailProvider.js +36 -22
  37. package/lib/context/directory/handlers/emailProvider.js.map +1 -0
  38. package/lib/context/directory/handlers/emailTemplates.js +29 -20
  39. package/lib/context/directory/handlers/emailTemplates.js.map +1 -0
  40. package/lib/context/directory/handlers/flowVaultConnections.js +49 -39
  41. package/lib/context/directory/handlers/flowVaultConnections.js.map +1 -0
  42. package/lib/context/directory/handlers/flows.js +48 -38
  43. package/lib/context/directory/handlers/flows.js.map +1 -0
  44. package/lib/context/directory/handlers/forms.js +48 -38
  45. package/lib/context/directory/handlers/forms.js.map +1 -0
  46. package/lib/context/directory/handlers/guardianFactorProviders.js +21 -9
  47. package/lib/context/directory/handlers/guardianFactorProviders.js.map +1 -0
  48. package/lib/context/directory/handlers/guardianFactorTemplates.js +21 -9
  49. package/lib/context/directory/handlers/guardianFactorTemplates.js.map +1 -0
  50. package/lib/context/directory/handlers/guardianFactors.js +21 -9
  51. package/lib/context/directory/handlers/guardianFactors.js.map +1 -0
  52. package/lib/context/directory/handlers/guardianPhoneFactorMessageTypes.js +20 -8
  53. package/lib/context/directory/handlers/guardianPhoneFactorMessageTypes.js.map +1 -0
  54. package/lib/context/directory/handlers/guardianPhoneFactorSelectedProvider.js +20 -8
  55. package/lib/context/directory/handlers/guardianPhoneFactorSelectedProvider.js.map +1 -0
  56. package/lib/context/directory/handlers/guardianPolicies.js +20 -8
  57. package/lib/context/directory/handlers/guardianPolicies.js.map +1 -0
  58. package/lib/context/directory/handlers/hooks.js +34 -24
  59. package/lib/context/directory/handlers/hooks.js.map +1 -0
  60. package/lib/context/directory/handlers/index.js +3 -0
  61. package/lib/context/directory/handlers/index.js.map +1 -0
  62. package/lib/context/directory/handlers/logStreams.js +24 -12
  63. package/lib/context/directory/handlers/logStreams.js.map +1 -0
  64. package/lib/context/directory/handlers/networkACLs.js +34 -22
  65. package/lib/context/directory/handlers/networkACLs.js.map +1 -0
  66. package/lib/context/directory/handlers/organizations.js +44 -39
  67. package/lib/context/directory/handlers/organizations.js.map +1 -0
  68. package/lib/context/directory/handlers/pages.js +37 -31
  69. package/lib/context/directory/handlers/pages.js.map +1 -0
  70. package/lib/context/directory/handlers/phoneProvider.js +24 -12
  71. package/lib/context/directory/handlers/phoneProvider.js.map +1 -0
  72. package/lib/context/directory/handlers/prompts.js +76 -58
  73. package/lib/context/directory/handlers/prompts.js.map +1 -0
  74. package/lib/context/directory/handlers/resourceServers.d.ts +1 -1
  75. package/lib/context/directory/handlers/resourceServers.js +30 -18
  76. package/lib/context/directory/handlers/resourceServers.js.map +1 -0
  77. package/lib/context/directory/handlers/roles.js +31 -21
  78. package/lib/context/directory/handlers/roles.js.map +1 -0
  79. package/lib/context/directory/handlers/rules.js +32 -22
  80. package/lib/context/directory/handlers/rules.js.map +1 -0
  81. package/lib/context/directory/handlers/rulesConfigs.js +15 -3
  82. package/lib/context/directory/handlers/rulesConfigs.js.map +1 -0
  83. package/lib/context/directory/handlers/selfServiceProfiles.js +40 -28
  84. package/lib/context/directory/handlers/selfServiceProfiles.js.map +1 -0
  85. package/lib/context/directory/handlers/tenant.js +34 -14
  86. package/lib/context/directory/handlers/tenant.js.map +1 -0
  87. package/lib/context/directory/handlers/themes.js +21 -9
  88. package/lib/context/directory/handlers/themes.js.map +1 -0
  89. package/lib/context/directory/handlers/triggers.d.ts +1 -1
  90. package/lib/context/directory/handlers/triggers.js +26 -16
  91. package/lib/context/directory/handlers/triggers.js.map +1 -0
  92. package/lib/context/directory/handlers/userAttributeProfiles.d.ts +1 -1
  93. package/lib/context/directory/handlers/userAttributeProfiles.js +26 -16
  94. package/lib/context/directory/handlers/userAttributeProfiles.js.map +1 -0
  95. package/lib/context/directory/index.js +80 -66
  96. package/lib/context/directory/index.js.map +1 -0
  97. package/lib/context/index.js +20 -9
  98. package/lib/context/index.js.map +1 -0
  99. package/lib/context/yaml/handlers/actions.js +41 -39
  100. package/lib/context/yaml/handlers/actions.js.map +1 -0
  101. package/lib/context/yaml/handlers/attackProtection.js +41 -27
  102. package/lib/context/yaml/handlers/attackProtection.js.map +1 -0
  103. package/lib/context/yaml/handlers/branding.js +69 -47
  104. package/lib/context/yaml/handlers/branding.js.map +1 -0
  105. package/lib/context/yaml/handlers/clientGrants.js +40 -26
  106. package/lib/context/yaml/handlers/clientGrants.js.map +1 -0
  107. package/lib/context/yaml/handlers/clients.js +85 -41
  108. package/lib/context/yaml/handlers/clients.js.map +1 -0
  109. package/lib/context/yaml/handlers/connectionProfiles.d.ts +11 -0
  110. package/lib/context/yaml/handlers/connectionProfiles.js +44 -0
  111. package/lib/context/yaml/handlers/connectionProfiles.js.map +1 -0
  112. package/lib/context/yaml/handlers/connections.js +67 -63
  113. package/lib/context/yaml/handlers/connections.js.map +1 -0
  114. package/lib/context/yaml/handlers/customDomains.js +19 -7
  115. package/lib/context/yaml/handlers/customDomains.js.map +1 -0
  116. package/lib/context/yaml/handlers/databases.js +65 -63
  117. package/lib/context/yaml/handlers/databases.js.map +1 -0
  118. package/lib/context/yaml/handlers/emailProvider.js +37 -22
  119. package/lib/context/yaml/handlers/emailProvider.js.map +1 -0
  120. package/lib/context/yaml/handlers/emailTemplates.js +39 -28
  121. package/lib/context/yaml/handlers/emailTemplates.js.map +1 -0
  122. package/lib/context/yaml/handlers/flowVaultConnections.js +50 -36
  123. package/lib/context/yaml/handlers/flowVaultConnections.js.map +1 -0
  124. package/lib/context/yaml/handlers/flows.js +66 -55
  125. package/lib/context/yaml/handlers/flows.js.map +1 -0
  126. package/lib/context/yaml/handlers/forms.js +66 -55
  127. package/lib/context/yaml/handlers/forms.js.map +1 -0
  128. package/lib/context/yaml/handlers/guardianFactorProviders.js +19 -7
  129. package/lib/context/yaml/handlers/guardianFactorProviders.js.map +1 -0
  130. package/lib/context/yaml/handlers/guardianFactorTemplates.js +19 -7
  131. package/lib/context/yaml/handlers/guardianFactorTemplates.js.map +1 -0
  132. package/lib/context/yaml/handlers/guardianFactors.js +19 -7
  133. package/lib/context/yaml/handlers/guardianFactors.js.map +1 -0
  134. package/lib/context/yaml/handlers/guardianPhoneFactorMessageTypes.js +19 -7
  135. package/lib/context/yaml/handlers/guardianPhoneFactorMessageTypes.js.map +1 -0
  136. package/lib/context/yaml/handlers/guardianPhoneFactorSelectedProvider.js +19 -7
  137. package/lib/context/yaml/handlers/guardianPhoneFactorSelectedProvider.js.map +1 -0
  138. package/lib/context/yaml/handlers/guardianPolicies.js +19 -7
  139. package/lib/context/yaml/handlers/guardianPolicies.js.map +1 -0
  140. package/lib/context/yaml/handlers/hooks.js +48 -34
  141. package/lib/context/yaml/handlers/hooks.js.map +1 -0
  142. package/lib/context/yaml/handlers/index.js +3 -0
  143. package/lib/context/yaml/handlers/index.js.map +1 -0
  144. package/lib/context/yaml/handlers/logStreams.js +30 -16
  145. package/lib/context/yaml/handlers/logStreams.js.map +1 -0
  146. package/lib/context/yaml/handlers/networkACLs.js +39 -25
  147. package/lib/context/yaml/handlers/networkACLs.js.map +1 -0
  148. package/lib/context/yaml/handlers/organizations.js +46 -37
  149. package/lib/context/yaml/handlers/organizations.js.map +1 -0
  150. package/lib/context/yaml/handlers/pages.js +39 -31
  151. package/lib/context/yaml/handlers/pages.js.map +1 -0
  152. package/lib/context/yaml/handlers/phoneProvider.js +31 -17
  153. package/lib/context/yaml/handlers/phoneProvider.js.map +1 -0
  154. package/lib/context/yaml/handlers/prompts.js +47 -22
  155. package/lib/context/yaml/handlers/prompts.js.map +1 -0
  156. package/lib/context/yaml/handlers/resourceServers.d.ts +1 -1
  157. package/lib/context/yaml/handlers/resourceServers.js +33 -21
  158. package/lib/context/yaml/handlers/resourceServers.js.map +1 -0
  159. package/lib/context/yaml/handlers/roles.js +33 -19
  160. package/lib/context/yaml/handlers/roles.js.map +1 -0
  161. package/lib/context/yaml/handlers/rules.js +39 -28
  162. package/lib/context/yaml/handlers/rules.js.map +1 -0
  163. package/lib/context/yaml/handlers/rulesConfigs.js +28 -14
  164. package/lib/context/yaml/handlers/rulesConfigs.js.map +1 -0
  165. package/lib/context/yaml/handlers/selfServiceProfiles.js +43 -29
  166. package/lib/context/yaml/handlers/selfServiceProfiles.js.map +1 -0
  167. package/lib/context/yaml/handlers/tenant.js +41 -19
  168. package/lib/context/yaml/handlers/tenant.js.map +1 -0
  169. package/lib/context/yaml/handlers/themes.js +19 -7
  170. package/lib/context/yaml/handlers/themes.js.map +1 -0
  171. package/lib/context/yaml/handlers/triggers.d.ts +1 -1
  172. package/lib/context/yaml/handlers/triggers.js +29 -15
  173. package/lib/context/yaml/handlers/triggers.js.map +1 -0
  174. package/lib/context/yaml/handlers/userAttributeProfiles.d.ts +1 -1
  175. package/lib/context/yaml/handlers/userAttributeProfiles.js +19 -7
  176. package/lib/context/yaml/handlers/userAttributeProfiles.js.map +1 -0
  177. package/lib/context/yaml/index.js +128 -120
  178. package/lib/context/yaml/index.js.map +1 -0
  179. package/lib/index.d.ts +96 -4
  180. package/lib/index.js +34 -24
  181. package/lib/index.js.map +1 -0
  182. package/lib/keywordPreservation.d.ts +1 -1
  183. package/lib/keywordPreservation.js +6 -10
  184. package/lib/keywordPreservation.js.map +1 -0
  185. package/lib/logger.js +1 -0
  186. package/lib/logger.js.map +1 -0
  187. package/lib/readonly.js +4 -3
  188. package/lib/readonly.js.map +1 -0
  189. package/lib/sessionDurationsToMinutes.js +1 -0
  190. package/lib/sessionDurationsToMinutes.js.map +1 -0
  191. package/lib/tools/auth0/client.js +127 -108
  192. package/lib/tools/auth0/client.js.map +1 -0
  193. package/lib/tools/auth0/handlers/actions.d.ts +26 -8
  194. package/lib/tools/auth0/handlers/actions.js +149 -138
  195. package/lib/tools/auth0/handlers/actions.js.map +1 -0
  196. package/lib/tools/auth0/handlers/attackProtection.js +92 -80
  197. package/lib/tools/auth0/handlers/attackProtection.js.map +1 -0
  198. package/lib/tools/auth0/handlers/branding.js +99 -75
  199. package/lib/tools/auth0/handlers/branding.js.map +1 -0
  200. package/lib/tools/auth0/handlers/clientGrants.d.ts +9 -2
  201. package/lib/tools/auth0/handlers/clientGrants.js +72 -65
  202. package/lib/tools/auth0/handlers/clientGrants.js.map +1 -0
  203. package/lib/tools/auth0/handlers/clients.d.ts +85 -7
  204. package/lib/tools/auth0/handlers/clients.js +187 -66
  205. package/lib/tools/auth0/handlers/clients.js.map +1 -0
  206. package/lib/tools/auth0/handlers/connectionProfiles.d.ts +182 -0
  207. package/lib/tools/auth0/handlers/connectionProfiles.js +239 -0
  208. package/lib/tools/auth0/handlers/connectionProfiles.js.map +1 -0
  209. package/lib/tools/auth0/handlers/connections.d.ts +1 -3
  210. package/lib/tools/auth0/handlers/connections.js +135 -130
  211. package/lib/tools/auth0/handlers/connections.js.map +1 -0
  212. package/lib/tools/auth0/handlers/customDomains.d.ts +1 -4
  213. package/lib/tools/auth0/handlers/customDomains.js +53 -43
  214. package/lib/tools/auth0/handlers/customDomains.js.map +1 -0
  215. package/lib/tools/auth0/handlers/databases.js +114 -94
  216. package/lib/tools/auth0/handlers/databases.js.map +1 -0
  217. package/lib/tools/auth0/handlers/default.d.ts +2 -2
  218. package/lib/tools/auth0/handlers/default.js +171 -210
  219. package/lib/tools/auth0/handlers/default.js.map +1 -0
  220. package/lib/tools/auth0/handlers/emailProvider.js +52 -41
  221. package/lib/tools/auth0/handlers/emailProvider.js.map +1 -0
  222. package/lib/tools/auth0/handlers/emailTemplates.js +71 -49
  223. package/lib/tools/auth0/handlers/emailTemplates.js.map +1 -0
  224. package/lib/tools/auth0/handlers/flowVaultConnections.d.ts +12 -5
  225. package/lib/tools/auth0/handlers/flowVaultConnections.js +143 -108
  226. package/lib/tools/auth0/handlers/flowVaultConnections.js.map +1 -0
  227. package/lib/tools/auth0/handlers/flows.d.ts +3 -2
  228. package/lib/tools/auth0/handlers/flows.js +129 -92
  229. package/lib/tools/auth0/handlers/flows.js.map +1 -0
  230. package/lib/tools/auth0/handlers/forms.d.ts +3 -3
  231. package/lib/tools/auth0/handlers/forms.js +112 -98
  232. package/lib/tools/auth0/handlers/forms.js.map +1 -0
  233. package/lib/tools/auth0/handlers/guardianFactorProviders.js +84 -61
  234. package/lib/tools/auth0/handlers/guardianFactorProviders.js.map +1 -0
  235. package/lib/tools/auth0/handlers/guardianFactorTemplates.js +68 -46
  236. package/lib/tools/auth0/handlers/guardianFactorTemplates.js.map +1 -0
  237. package/lib/tools/auth0/handlers/guardianFactors.js +45 -35
  238. package/lib/tools/auth0/handlers/guardianFactors.js.map +1 -0
  239. package/lib/tools/auth0/handlers/guardianPhoneFactorMessageTypes.js +45 -29
  240. package/lib/tools/auth0/handlers/guardianPhoneFactorMessageTypes.js.map +1 -0
  241. package/lib/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.js +45 -29
  242. package/lib/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.js.map +1 -0
  243. package/lib/tools/auth0/handlers/guardianPolicies.js +35 -20
  244. package/lib/tools/auth0/handlers/guardianPolicies.js.map +1 -0
  245. package/lib/tools/auth0/handlers/hooks.js +153 -123
  246. package/lib/tools/auth0/handlers/hooks.js.map +1 -0
  247. package/lib/tools/auth0/handlers/index.js +3 -0
  248. package/lib/tools/auth0/handlers/index.js.map +1 -0
  249. package/lib/tools/auth0/handlers/logStreams.js +47 -42
  250. package/lib/tools/auth0/handlers/logStreams.js.map +1 -0
  251. package/lib/tools/auth0/handlers/networkACLs.d.ts +4 -5
  252. package/lib/tools/auth0/handlers/networkACLs.js +133 -115
  253. package/lib/tools/auth0/handlers/networkACLs.js.map +1 -0
  254. package/lib/tools/auth0/handlers/organizations.d.ts +9 -10
  255. package/lib/tools/auth0/handlers/organizations.js +429 -360
  256. package/lib/tools/auth0/handlers/organizations.js.map +1 -0
  257. package/lib/tools/auth0/handlers/pages.js +83 -74
  258. package/lib/tools/auth0/handlers/pages.js.map +1 -0
  259. package/lib/tools/auth0/handlers/phoneProvider.d.ts +2 -2
  260. package/lib/tools/auth0/handlers/phoneProvider.js +82 -69
  261. package/lib/tools/auth0/handlers/phoneProvider.js.map +1 -0
  262. package/lib/tools/auth0/handlers/prompts.d.ts +5 -5
  263. package/lib/tools/auth0/handlers/prompts.js +235 -240
  264. package/lib/tools/auth0/handlers/prompts.js.map +1 -0
  265. package/lib/tools/auth0/handlers/resourceServers.d.ts +1 -3
  266. package/lib/tools/auth0/handlers/resourceServers.js +60 -59
  267. package/lib/tools/auth0/handlers/resourceServers.js.map +1 -0
  268. package/lib/tools/auth0/handlers/roles.js +178 -162
  269. package/lib/tools/auth0/handlers/roles.js.map +1 -0
  270. package/lib/tools/auth0/handlers/rules.js +162 -144
  271. package/lib/tools/auth0/handlers/rules.js.map +1 -0
  272. package/lib/tools/auth0/handlers/rulesConfigs.js +39 -30
  273. package/lib/tools/auth0/handlers/rulesConfigs.js.map +1 -0
  274. package/lib/tools/auth0/handlers/scimHandler.d.ts +3 -4
  275. package/lib/tools/auth0/handlers/scimHandler.js +132 -110
  276. package/lib/tools/auth0/handlers/scimHandler.js.map +1 -0
  277. package/lib/tools/auth0/handlers/selfServiceProfiles.d.ts +5 -13
  278. package/lib/tools/auth0/handlers/selfServiceProfiles.js +204 -170
  279. package/lib/tools/auth0/handlers/selfServiceProfiles.js.map +1 -0
  280. package/lib/tools/auth0/handlers/tenant.d.ts +3 -5
  281. package/lib/tools/auth0/handlers/tenant.js +52 -45
  282. package/lib/tools/auth0/handlers/tenant.js.map +1 -0
  283. package/lib/tools/auth0/handlers/themes.d.ts +12 -12
  284. package/lib/tools/auth0/handlers/themes.js +102 -86
  285. package/lib/tools/auth0/handlers/themes.js.map +1 -0
  286. package/lib/tools/auth0/handlers/triggers.js +75 -59
  287. package/lib/tools/auth0/handlers/triggers.js.map +1 -0
  288. package/lib/tools/auth0/handlers/userAttributeProfiles.d.ts +4 -4
  289. package/lib/tools/auth0/handlers/userAttributeProfiles.js +63 -56
  290. package/lib/tools/auth0/handlers/userAttributeProfiles.js.map +1 -0
  291. package/lib/tools/auth0/index.js +48 -35
  292. package/lib/tools/auth0/index.js.map +1 -0
  293. package/lib/tools/auth0/schema.js +4 -6
  294. package/lib/tools/auth0/schema.js.map +1 -0
  295. package/lib/tools/calculateChanges.js +15 -24
  296. package/lib/tools/calculateChanges.js.map +1 -0
  297. package/lib/tools/constants.d.ts +3 -2
  298. package/lib/tools/constants.js +2 -0
  299. package/lib/tools/constants.js.map +1 -0
  300. package/lib/tools/deploy.js +29 -17
  301. package/lib/tools/deploy.js.map +1 -0
  302. package/lib/tools/index.d.ts +89 -3
  303. package/lib/tools/index.js +2 -3
  304. package/lib/tools/index.js.map +1 -0
  305. package/lib/tools/utils.d.ts +1 -1
  306. package/lib/tools/utils.js +22 -12
  307. package/lib/tools/utils.js.map +1 -0
  308. package/lib/tools/validationError.js +1 -0
  309. package/lib/tools/validationError.js.map +1 -0
  310. package/lib/types.d.ts +6 -9
  311. package/lib/types.js +1 -0
  312. package/lib/types.js.map +1 -0
  313. package/lib/utils.d.ts +58 -3
  314. package/lib/utils.js +5 -8
  315. package/lib/utils.js.map +1 -0
  316. package/package.json +10 -11
  317. package/tsconfig.json +3 -4
  318. package/eslint.config.js +0 -130
@@ -1,6 +1,17 @@
1
- import { Management } from 'auth0';
1
+ import { PostBrandingTheme200Response } from 'auth0';
2
2
  import { Assets } from '../../../types';
3
3
  import DefaultHandler from './default';
4
+ export type Theme = PostBrandingTheme200Response;
5
+ export default class ThemesHandler extends DefaultHandler {
6
+ existing: Theme[] | null;
7
+ constructor(options: DefaultHandler);
8
+ objString(theme: Theme): string;
9
+ getType(): Promise<Theme[] | null>;
10
+ processChanges(assets: Assets): Promise<void>;
11
+ deleteThemes(): Promise<void>;
12
+ updateThemes(themes: Theme[]): Promise<void>;
13
+ getThemes(): Promise<Theme[] | null>;
14
+ }
4
15
  /**
5
16
  * Schema
6
17
  */
@@ -370,14 +381,3 @@ export declare const schema: {
370
381
  type: string;
371
382
  };
372
383
  };
373
- export type Theme = Management.GetBrandingThemeResponseContent;
374
- export default class ThemesHandler extends DefaultHandler {
375
- existing: Theme[] | null;
376
- constructor(options: DefaultHandler);
377
- objString(theme: Theme): string;
378
- getType(): Promise<Theme[] | null>;
379
- processChanges(assets: Assets): Promise<void>;
380
- deleteThemes(): Promise<void>;
381
- updateThemes(themes: Theme[]): Promise<void>;
382
- getThemes(): Promise<Theme[] | null>;
383
- }
@@ -38,6 +38,15 @@ var __importStar = (this && this.__importStar) || (function () {
38
38
  return result;
39
39
  };
40
40
  })();
41
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
42
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
43
+ return new (P || (P = Promise))(function (resolve, reject) {
44
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
45
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
46
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
47
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
48
+ });
49
+ };
41
50
  var __importDefault = (this && this.__importDefault) || function (mod) {
42
51
  return (mod && mod.__esModule) ? mod : { "default": mod };
43
52
  };
@@ -45,6 +54,98 @@ Object.defineProperty(exports, "__esModule", { value: true });
45
54
  exports.schema = void 0;
46
55
  const logger_1 = __importDefault(require("../../../logger"));
47
56
  const default_1 = __importStar(require("./default"));
57
+ class ThemesHandler extends default_1.default {
58
+ constructor(options) {
59
+ super(Object.assign(Object.assign({}, options), { type: 'themes', id: 'themeId' }));
60
+ }
61
+ objString(theme) {
62
+ return theme.displayName || JSON.stringify(theme);
63
+ }
64
+ getType() {
65
+ return __awaiter(this, void 0, void 0, function* () {
66
+ if (!this.existing) {
67
+ this.existing = yield this.getThemes();
68
+ }
69
+ return this.existing;
70
+ });
71
+ }
72
+ processChanges(assets) {
73
+ return __awaiter(this, void 0, void 0, function* () {
74
+ const { themes } = assets;
75
+ // Non existing section means themes doesn't need to be processed
76
+ if (!themes) {
77
+ return;
78
+ }
79
+ // Empty array means themes should be deleted
80
+ if (themes.length === 0) {
81
+ return this.deleteThemes();
82
+ }
83
+ return this.updateThemes(themes);
84
+ });
85
+ }
86
+ deleteThemes() {
87
+ return __awaiter(this, void 0, void 0, function* () {
88
+ if (!this.config('AUTH0_ALLOW_DELETE')) {
89
+ return;
90
+ }
91
+ // if theme exists we need to delete it
92
+ const currentThemes = yield this.getThemes();
93
+ if (currentThemes === null || currentThemes.length === 0) {
94
+ return;
95
+ }
96
+ const currentTheme = currentThemes[0];
97
+ yield this.client.branding.deleteTheme({ themeId: currentTheme.themeId });
98
+ this.deleted += 1;
99
+ this.didDelete(currentTheme);
100
+ });
101
+ }
102
+ updateThemes(themes) {
103
+ return __awaiter(this, void 0, void 0, function* () {
104
+ if (themes.length > 1) {
105
+ logger_1.default.warn('Only one theme is supported per tenant');
106
+ }
107
+ const currentThemes = yield this.getThemes();
108
+ const themeReqPayload = (() => {
109
+ // Removing themeId from update and create payloads, otherwise API will error
110
+ // Theme ID may be required to handle if `--export_ids=true`
111
+ const payload = themes[0];
112
+ //@ts-ignore to quell non-optional themeId property, but we know that it's ok to delete
113
+ delete payload.themeId;
114
+ return payload;
115
+ })();
116
+ if (currentThemes === null || currentThemes.length === 0) {
117
+ yield this.client.branding.createTheme(themeReqPayload);
118
+ }
119
+ else {
120
+ const currentTheme = currentThemes[0];
121
+ // if theme exists, overwrite it otherwise create it
122
+ yield this.client.branding.updateTheme({ themeId: currentTheme.themeId }, themeReqPayload);
123
+ }
124
+ this.updated += 1;
125
+ this.didUpdate(themes[0]);
126
+ });
127
+ }
128
+ getThemes() {
129
+ return __awaiter(this, void 0, void 0, function* () {
130
+ try {
131
+ const { data: theme } = yield this.client.branding.getDefaultTheme();
132
+ return [theme];
133
+ }
134
+ catch (err) {
135
+ if (err.statusCode === 404)
136
+ return [];
137
+ if (err.statusCode === 400)
138
+ return null;
139
+ // Errors other than 404 (theme doesn't exist) or 400 (no-code not enabled) shouldn't be expected
140
+ throw err;
141
+ }
142
+ });
143
+ }
144
+ }
145
+ exports.default = ThemesHandler;
146
+ __decorate([
147
+ (0, default_1.order)('60') // Run after custom domains.
148
+ ], ThemesHandler.prototype, "processChanges", null);
48
149
  /**
49
150
  * Schema
50
151
  */
@@ -457,89 +558,4 @@ exports.schema = {
457
558
  type: 'object',
458
559
  },
459
560
  };
460
- class ThemesHandler extends default_1.default {
461
- constructor(options) {
462
- super({
463
- ...options,
464
- type: 'themes',
465
- id: 'themeId',
466
- });
467
- }
468
- objString(theme) {
469
- return theme.displayName || JSON.stringify(theme);
470
- }
471
- async getType() {
472
- if (!this.existing) {
473
- this.existing = await this.getThemes();
474
- }
475
- return this.existing;
476
- }
477
- async processChanges(assets) {
478
- const { themes } = assets;
479
- // Non existing section means themes doesn't need to be processed
480
- if (!themes) {
481
- return;
482
- }
483
- // Empty array means themes should be deleted
484
- if (themes.length === 0) {
485
- return this.deleteThemes();
486
- }
487
- return this.updateThemes(themes);
488
- }
489
- async deleteThemes() {
490
- if (!this.config('AUTH0_ALLOW_DELETE')) {
491
- return;
492
- }
493
- // if theme exists we need to delete it
494
- const currentThemes = await this.getThemes();
495
- if (currentThemes === null || currentThemes.length === 0) {
496
- return;
497
- }
498
- const currentTheme = currentThemes[0];
499
- await this.client.branding.themes.delete(currentTheme.themeId);
500
- this.deleted += 1;
501
- this.didDelete(currentTheme);
502
- }
503
- async updateThemes(themes) {
504
- if (themes.length > 1) {
505
- logger_1.default.warn('Only one theme is supported per tenant');
506
- }
507
- const currentThemes = await this.getThemes();
508
- const themeReqPayload = (() => {
509
- // Removing themeId from update and create payloads, otherwise API will error
510
- // Theme ID may be required to handle if `--export_ids=true`
511
- const payload = themes[0];
512
- // @ts-ignore to quell non-optional themeId property, but we know that it's ok to delete
513
- delete payload.themeId;
514
- return payload;
515
- })();
516
- if (currentThemes === null || currentThemes.length === 0) {
517
- await this.client.branding.themes.create(themeReqPayload);
518
- }
519
- else {
520
- const currentTheme = currentThemes[0];
521
- // if theme exists, overwrite it otherwise create it
522
- await this.client.branding.themes.update(currentTheme.themeId, themeReqPayload);
523
- }
524
- this.updated += 1;
525
- this.didUpdate(themes[0]);
526
- }
527
- async getThemes() {
528
- try {
529
- const theme = await this.client.branding.themes.getDefault();
530
- return [theme];
531
- }
532
- catch (err) {
533
- if (err.statusCode === 404)
534
- return [];
535
- if (err.statusCode === 400)
536
- return null;
537
- // Errors other than 404 (theme doesn't exist) or 400 (no-code not enabled) shouldn't be expected
538
- throw err;
539
- }
540
- }
541
- }
542
- exports.default = ThemesHandler;
543
- __decorate([
544
- (0, default_1.order)('60') // Run after custom domains.
545
- ], ThemesHandler.prototype, "processChanges", null);
561
+ //# sourceMappingURL=themes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"themes.js","sourceRoot":"","sources":["../../../../src/tools/auth0/handlers/themes.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,6DAAkC;AAClC,qDAAkD;AAGlD,MAAqB,aAAc,SAAQ,iBAAc;IAGvD,YAAY,OAAuB;QACjC,KAAK,iCACA,OAAO,KACV,IAAI,EAAE,QAAQ,EACd,EAAE,EAAE,SAAS,IACb,CAAC;IACL,CAAC;IAED,SAAS,CAAC,KAAY;QACpB,OAAO,KAAK,CAAC,WAAW,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACpD,CAAC;IAEK,OAAO;;YACX,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACnB,IAAI,CAAC,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC;YACzC,CAAC;YAED,OAAO,IAAI,CAAC,QAAQ,CAAC;QACvB,CAAC;KAAA;IAGK,cAAc,CAAC,MAAc;;YACjC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;YAE1B,iEAAiE;YACjE,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,OAAO;YACT,CAAC;YAED,6CAA6C;YAC7C,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACxB,OAAO,IAAI,CAAC,YAAY,EAAE,CAAC;YAC7B,CAAC;YAED,OAAO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C,IAAI,EAAE,QAAQ;qBACf;oBACD,WAAW,EAAE;wBACX,WAAW,EAAE,aAAa;wBAC1B,OAAO,EAAE,GAAG;wBACZ,OAAO,EAAE,CAAC;wBACV,IAAI,EAAE,QAAQ;qBACf;oBACD,aAAa,EAAE;wBACb,WAAW,EAAE,eAAe;wBAC5B,IAAI,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC;wBACzC,IAAI,EAAE,QAAQ;qBACf;oBACD,QAAQ,EAAE;wBACR,WAAW,EAAE,UAAU;wBACvB,OAAO,EACL,m1EAAm1E;wBACr1E,IAAI,EAAE,QAAQ;qBACf;oBACD,qBAAqB,EAAE;wBACrB,WAAW,EAAE,uBAAuB;wBACpC,IAAI,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC;wBACvB,IAAI,EAAE,QAAQ;qBACf;iBACF;gBACD,QAAQ,EAAE;oBACR,uBAAuB;oBACvB,aAAa;oBACb,eAAe;oBACf,UAAU;oBACV,uBAAuB;iBACxB;gBACD,IAAI,EAAE,QAAQ;aACf;SACF;QACD,QAAQ,EAAE,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,EAAE,QAAQ,CAAC;QACrE,IAAI,EAAE,QAAQ;KACf;CACF,CAAC"}
@@ -38,6 +38,15 @@ var __importStar = (this && this.__importStar) || (function () {
38
38
  return result;
39
39
  };
40
40
  })();
41
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
42
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
43
+ return new (P || (P = Promise))(function (resolve, reject) {
44
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
45
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
46
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
47
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
48
+ });
49
+ };
41
50
  var __importDefault = (this && this.__importDefault) || function (mod) {
42
51
  return (mod && mod.__esModule) ? mod : { "default": mod };
43
52
  };
@@ -70,74 +79,81 @@ function isActionsDisabled(err) {
70
79
  }
71
80
  class TriggersHandler extends default_1.default {
72
81
  constructor(options) {
73
- super({
74
- ...options,
75
- type: 'triggers',
76
- id: 'name',
77
- });
82
+ super(Object.assign(Object.assign({}, options), { type: 'triggers', id: 'name' }));
78
83
  }
79
- async getType() {
80
- if (this.existing) {
81
- return this.existing;
82
- }
83
- const triggerBindings = {};
84
- try {
85
- const res = await this.client.actions.triggers.list();
86
- const triggers = (0, lodash_1.default)(res?.triggers).map('id').uniq().value();
87
- for (let i = 0; i < triggers.length; i++) {
88
- const triggerId = triggers[i];
89
- let bindings;
90
- try {
91
- const { data } = await this.client.actions.triggers.bindings.list(triggerId);
92
- bindings = data;
93
- }
94
- catch (err) {
95
- logger_1.default.warn(`${err.message} (trigger: ${triggerId}). Skipping this trigger and continuing.`);
96
- bindings = null;
97
- }
98
- if (bindings && bindings.length > 0) {
99
- triggerBindings[triggerId] = bindings.map((binding) => ({
100
- action_name: binding.action.name,
101
- display_name: binding.display_name,
102
- }));
103
- }
84
+ getType() {
85
+ return __awaiter(this, void 0, void 0, function* () {
86
+ if (this.existing) {
87
+ return this.existing;
104
88
  }
105
- this.existing = triggerBindings;
106
- return this.existing;
107
- }
108
- catch (err) {
109
- if (err.statusCode === 404 || err.statusCode === 501) {
89
+ // in case client version does not support actions
90
+ if (!this.client.actions || typeof this.client.actions.getAllTriggers !== 'function') {
110
91
  return [];
111
92
  }
112
- if (isActionsDisabled(err)) {
113
- logger_1.default.info('Skipping triggers because Actions is not enabled.');
114
- return {};
93
+ const triggerBindings = {};
94
+ try {
95
+ const res = yield this.client.actions.getAllTriggers();
96
+ const triggers = (0, lodash_1.default)(res.data.triggers).map('id').uniq().value();
97
+ for (let i = 0; i < triggers.length; i++) {
98
+ const triggerId = triggers[i];
99
+ let bindings;
100
+ try {
101
+ const { data } = yield this.client.actions.getTriggerBindings({
102
+ triggerId: triggerId,
103
+ });
104
+ bindings = data === null || data === void 0 ? void 0 : data.bindings;
105
+ }
106
+ catch (err) {
107
+ logger_1.default.warn(`${err.message} (trigger: ${triggerId}). Skipping this trigger and continuing.`);
108
+ continue;
109
+ }
110
+ if (bindings && bindings.length > 0) {
111
+ triggerBindings[triggerId] = bindings.map((binding) => ({
112
+ action_name: binding.action.name,
113
+ display_name: binding.display_name,
114
+ }));
115
+ }
116
+ }
117
+ this.existing = triggerBindings;
118
+ return this.existing;
119
+ }
120
+ catch (err) {
121
+ if (err.statusCode === 404 || err.statusCode === 501) {
122
+ return [];
123
+ }
124
+ if (isActionsDisabled(err)) {
125
+ logger_1.default.info('Skipping triggers because Actions is not enabled.');
126
+ return {};
127
+ }
128
+ throw err;
115
129
  }
116
- throw err;
117
- }
130
+ });
118
131
  }
119
- async processChanges(assets) {
120
- // No API to delete or create triggers, we can only update.
121
- const { triggers } = assets;
122
- // Do nothing if not set
123
- if (!triggers)
124
- return;
125
- await (0, utils_1.sleep)(2000); // Delay to allow newly-deployed actions to register in backend
126
- await Promise.all(Object.entries(triggers).map(async ([name, data]) => {
127
- const bindings = data.map((binding) => ({
128
- ref: {
129
- type: 'action_name',
130
- value: binding.action_name,
131
- },
132
- display_name: binding.display_name,
133
- }));
134
- await this.client.actions.triggers.bindings.updateMany(name, { bindings });
135
- this.didUpdate({ trigger_id: name });
136
- this.updated += 1;
137
- }));
132
+ processChanges(assets) {
133
+ return __awaiter(this, void 0, void 0, function* () {
134
+ // No API to delete or create triggers, we can only update.
135
+ const { triggers } = assets;
136
+ // Do nothing if not set
137
+ if (!triggers)
138
+ return;
139
+ yield (0, utils_1.sleep)(2000); // Delay to allow newly-deployed actions to register in backend
140
+ yield Promise.all(Object.entries(triggers).map((_a) => __awaiter(this, [_a], void 0, function* ([name, data]) {
141
+ const bindings = data.map((binding) => ({
142
+ ref: {
143
+ type: 'action_name',
144
+ value: binding.action_name,
145
+ },
146
+ display_name: binding.display_name,
147
+ }));
148
+ yield this.client.actions.updateTriggerBindings({ triggerId: name }, { bindings });
149
+ this.didUpdate({ trigger_id: name });
150
+ this.updated += 1;
151
+ })));
152
+ });
138
153
  }
139
154
  }
140
155
  exports.default = TriggersHandler;
141
156
  __decorate([
142
157
  (0, default_1.order)('80')
143
158
  ], TriggersHandler.prototype, "processChanges", null);
159
+ //# sourceMappingURL=triggers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"triggers.js","sourceRoot":"","sources":["../../../../src/tools/auth0/handlers/triggers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAuB;AACvB,qDAAkD;AAClD,gEAAwC;AACxC,6DAAkC;AAElC,uCAAoC;AAEvB,QAAA,MAAM,GAAG;IACpB,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE;QACL,IAAI,EAAE,QAAQ;QACd,oBAAoB,EAAE,IAAI;QAC1B,UAAU,EAAE;YACV,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,mBAAS,CAAC,gBAAgB,EAAE;oBACjE,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;iBAC9C;aACF;SACF;KACF;CACF,CAAC;AAEF,SAAS,iBAAiB,CAAC,GAAG;IAC5B,MAAM,SAAS,GAAG,gBAAC,CAAC,GAAG,CAAC,GAAG,EAAE,6BAA6B,CAAC,IAAI,EAAE,CAAC;IAElE,OAAO,GAAG,CAAC,UAAU,KAAK,GAAG,IAAI,SAAS,CAAC,SAAS,KAAK,qBAAqB,CAAC;AACjF,CAAC;AAED,MAAqB,eAAgB,SAAQ,iBAAc;IAQzD,YAAY,OAAuB;QACjC,KAAK,iCACA,OAAO,KACV,IAAI,EAAE,UAAU,EAChB,EAAE,EAAE,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oBACD,YAAY,EAAE,OAAO,CAAC,YAAY;iBACnC,CAAC,CAAC,CAAC;gBAEJ,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,qBAAqB,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;gBACnF,IAAI,CAAC,SAAS,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;gBACrC,IAAI,CAAC,OAAO,IAAI,CAAC,CAAC;YACpB,CAAC,CAAA,CAAC,CACH,CAAC;QACJ,CAAC;KAAA;CACF;AAjGD,kCAiGC;AAzBO;IADL,IAAA,eAAK,EAAC,IAAI,CAAC;qDAyBX"}
@@ -1,7 +1,6 @@
1
- import { Management } from 'auth0';
1
+ import { UserAttributeProfile } from 'auth0';
2
2
  import DefaultAPIHandler from './default';
3
- import { Assets } from '../../../types';
4
- export type UserAttributeProfile = Management.UserAttributeProfile;
3
+ import { Assets, Auth0APIClient } from '../../../types';
5
4
  export declare const schema: {
6
5
  type: string;
7
6
  items: {
@@ -114,9 +113,10 @@ export declare const schema: {
114
113
  };
115
114
  };
116
115
  };
116
+ export declare const getUserAttributeProfiles: (auth0Client: Auth0APIClient) => Promise<UserAttributeProfile[]>;
117
117
  export default class UserAttributeProfilesHandler extends DefaultAPIHandler {
118
118
  existing: UserAttributeProfile[];
119
119
  constructor(options: DefaultAPIHandler);
120
- getType(): Promise<Management.UserAttributeProfile[] | null>;
120
+ getType(): Promise<UserAttributeProfile[]>;
121
121
  processChanges(assets: Assets): Promise<void>;
122
122
  }
@@ -38,11 +38,20 @@ var __importStar = (this && this.__importStar) || (function () {
38
38
  return result;
39
39
  };
40
40
  })();
41
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
42
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
43
+ return new (P || (P = Promise))(function (resolve, reject) {
44
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
45
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
46
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
47
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
48
+ });
49
+ };
41
50
  var __importDefault = (this && this.__importDefault) || function (mod) {
42
51
  return (mod && mod.__esModule) ? mod : { "default": mod };
43
52
  };
44
53
  Object.defineProperty(exports, "__esModule", { value: true });
45
- exports.schema = void 0;
54
+ exports.getUserAttributeProfiles = exports.schema = void 0;
46
55
  const default_1 = __importStar(require("./default"));
47
56
  const logger_1 = __importDefault(require("../../../logger"));
48
57
  const client_1 = require("../client");
@@ -51,9 +60,7 @@ const strategies = ['pingfederate', 'ad', 'adfs', 'waad', 'google-apps', 'okta',
51
60
  const strategyOverrides = {
52
61
  type: 'object',
53
62
  additionalProperties: false,
54
- properties: strategies.reduce((acc, curr) => ({
55
- ...acc,
56
- [curr]: {
63
+ properties: strategies.reduce((acc, curr) => (Object.assign(Object.assign({}, acc), { [curr]: {
57
64
  type: 'object',
58
65
  additionalProperties: false,
59
66
  properties: {
@@ -89,8 +96,7 @@ const strategyOverrides = {
89
96
  maxLength: 128,
90
97
  },
91
98
  },
92
- },
93
- }), {}),
99
+ } })), {}),
94
100
  };
95
101
  exports.schema = {
96
102
  type: 'array',
@@ -125,9 +131,7 @@ exports.schema = {
125
131
  },
126
132
  strategy_overrides: {
127
133
  type: 'object',
128
- properties: strategies.reduce((acc, curr) => ({
129
- ...acc,
130
- [curr]: {
134
+ properties: strategies.reduce((acc, curr) => (Object.assign(Object.assign({}, acc), { [curr]: {
131
135
  type: 'object',
132
136
  additionalProperties: false,
133
137
  properties: {
@@ -150,8 +154,7 @@ exports.schema = {
150
154
  default: 'externalId',
151
155
  },
152
156
  },
153
- },
154
- }), {}),
157
+ } })), {}),
155
158
  },
156
159
  },
157
160
  },
@@ -226,60 +229,64 @@ exports.schema = {
226
229
  },
227
230
  },
228
231
  };
229
- class UserAttributeProfilesHandler extends default_1.default {
230
- constructor(options) {
231
- super({
232
- ...options,
233
- type: 'userAttributeProfiles',
234
- id: 'id',
235
- identifiers: ['id', 'name'],
236
- stripUpdateFields: ['id'],
237
- functions: {
238
- update: async (params, payload) => this.client.userAttributeProfiles.update(params?.id, payload),
239
- },
232
+ const getUserAttributeProfiles = (auth0Client) => __awaiter(void 0, void 0, void 0, function* () {
233
+ try {
234
+ const userAttributeProfiles = yield (0, client_1.paginate)(auth0Client.userAttributeProfiles.getAll, {
235
+ checkpoint: true,
236
+ include_totals: true,
237
+ is_global: false,
238
+ take: 10,
240
239
  });
240
+ return userAttributeProfiles;
241
241
  }
242
- async getType() {
243
- if (this.existing)
244
- return this.existing;
245
- try {
246
- this.existing = await (0, client_1.paginate)(this.client.userAttributeProfiles.list, {
247
- checkpoint: true,
248
- include_totals: true,
249
- is_global: false,
250
- take: 10,
251
- });
252
- return this.existing;
242
+ catch (err) {
243
+ if (err.statusCode === 404 || err.statusCode === 501) {
244
+ return [];
253
245
  }
254
- catch (err) {
255
- if (err.statusCode === 404 || err.statusCode === 501) {
256
- return null;
257
- }
258
- if (err.statusCode === 403) {
259
- logger_1.default.debug('User Attribute Profile with Self-Service SSO is not enabled for this tenant. Please verify `scope` or contact Auth0 support to enable this feature.');
260
- return null;
261
- }
262
- throw err;
246
+ if (err.statusCode === 403) {
247
+ logger_1.default.debug('User Attribute Profile with Self-Service SSO is not enabled for this tenant. Please verify `scope` or contact Auth0 support to enable this feature.');
248
+ return [];
263
249
  }
250
+ throw err;
264
251
  }
265
- async processChanges(assets) {
266
- const { userAttributeProfiles } = assets;
267
- // Do nothing if not set
268
- if (!userAttributeProfiles)
269
- return;
270
- const existing = await this.getType();
271
- const changes = (0, calculateChanges_1.calculateChanges)({
272
- handler: this,
273
- assets: userAttributeProfiles,
274
- existing,
275
- identifiers: this.identifiers,
276
- allowDelete: !!this.config('AUTH0_ALLOW_DELETE'),
252
+ });
253
+ exports.getUserAttributeProfiles = getUserAttributeProfiles;
254
+ class UserAttributeProfilesHandler extends default_1.default {
255
+ constructor(options) {
256
+ super(Object.assign(Object.assign({}, options), { type: 'userAttributeProfiles', id: 'id', identifiers: ['id', 'name'], stripUpdateFields: ['id'] }));
257
+ }
258
+ getType() {
259
+ return __awaiter(this, void 0, void 0, function* () {
260
+ if (this.existing)
261
+ return this.existing;
262
+ this.existing = yield (0, exports.getUserAttributeProfiles)(this.client);
263
+ return this.existing;
264
+ });
265
+ }
266
+ processChanges(assets) {
267
+ const _super = Object.create(null, {
268
+ processChanges: { get: () => super.processChanges }
269
+ });
270
+ return __awaiter(this, void 0, void 0, function* () {
271
+ const { userAttributeProfiles } = assets;
272
+ // Do nothing if not set
273
+ if (!userAttributeProfiles)
274
+ return;
275
+ const existing = yield this.getType();
276
+ const changes = (0, calculateChanges_1.calculateChanges)({
277
+ handler: this,
278
+ assets: userAttributeProfiles,
279
+ existing,
280
+ identifiers: this.identifiers,
281
+ allowDelete: !!this.config('AUTH0_ALLOW_DELETE'),
282
+ });
283
+ logger_1.default.debug(`Start processChanges for userAttributeProfile [delete:${changes.del.length}] [update:${changes.update.length}], [create:${changes.create.length}]`);
284
+ yield _super.processChanges.call(this, assets, changes);
277
285
  });
278
- logger_1.default.debug(`Start processChanges for userAttributeProfile [delete:${changes.del.length}] [update:${changes.update.length}], [create:${changes.create.length}]`);
279
- await super.processChanges(assets, changes);
280
286
  }
281
287
  }
282
288
  exports.default = UserAttributeProfilesHandler;
283
289
  __decorate([
284
290
  (0, default_1.order)('50')
285
291
  ], UserAttributeProfilesHandler.prototype, "processChanges", null);
292
+ //# sourceMappingURL=userAttributeProfiles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userAttributeProfiles.js","sourceRoot":"","sources":["../../../../src/tools/auth0/handlers/userAttributeProfiles.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,qDAAqD;AAErD,6DAAkC;AAClC,sC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