auth0-deploy-cli 8.22.0 → 8.23.1

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 (333) hide show
  1. package/.circleci/config.yml +57 -5
  2. package/CHANGELOG.md +41 -2
  3. package/README.md +1 -1
  4. package/eslint.config.js +131 -0
  5. package/lib/args.js +0 -1
  6. package/lib/commands/export.js +41 -49
  7. package/lib/commands/import.js +36 -43
  8. package/lib/commands/index.js +0 -1
  9. package/lib/configFactory.js +0 -1
  10. package/lib/context/defaults.d.ts +1 -0
  11. package/lib/context/defaults.js +57 -10
  12. package/lib/context/directory/handlers/actions.js +40 -39
  13. package/lib/context/directory/handlers/attackProtection.js +22 -34
  14. package/lib/context/directory/handlers/branding.js +12 -21
  15. package/lib/context/directory/handlers/clientGrants.js +52 -62
  16. package/lib/context/directory/handlers/clients.js +44 -57
  17. package/lib/context/directory/handlers/connectionProfiles.d.ts +1 -1
  18. package/lib/context/directory/handlers/connectionProfiles.js +20 -30
  19. package/lib/context/directory/handlers/connections.js +32 -41
  20. package/lib/context/directory/handlers/customDomains.js +9 -21
  21. package/lib/context/directory/handlers/databases.js +37 -35
  22. package/lib/context/directory/handlers/emailProvider.js +22 -36
  23. package/lib/context/directory/handlers/emailTemplates.js +20 -29
  24. package/lib/context/directory/handlers/flowVaultConnections.js +40 -49
  25. package/lib/context/directory/handlers/flows.js +38 -48
  26. package/lib/context/directory/handlers/forms.js +38 -48
  27. package/lib/context/directory/handlers/guardianFactorProviders.js +9 -21
  28. package/lib/context/directory/handlers/guardianFactorTemplates.js +9 -21
  29. package/lib/context/directory/handlers/guardianFactors.js +9 -21
  30. package/lib/context/directory/handlers/guardianPhoneFactorMessageTypes.js +8 -20
  31. package/lib/context/directory/handlers/guardianPhoneFactorSelectedProvider.js +8 -20
  32. package/lib/context/directory/handlers/guardianPolicies.js +8 -20
  33. package/lib/context/directory/handlers/hooks.js +24 -34
  34. package/lib/context/directory/handlers/index.js +4 -1
  35. package/lib/context/directory/handlers/logStreams.js +12 -24
  36. package/lib/context/directory/handlers/networkACLs.js +22 -34
  37. package/lib/context/directory/handlers/organizations.js +39 -44
  38. package/lib/context/directory/handlers/pages.js +31 -37
  39. package/lib/context/directory/handlers/phoneProvider.js +12 -24
  40. package/lib/context/directory/handlers/phoneTemplates.d.ts +6 -0
  41. package/lib/context/directory/handlers/phoneTemplates.js +39 -0
  42. package/lib/context/directory/handlers/prompts.js +58 -76
  43. package/lib/context/directory/handlers/resourceServers.d.ts +1 -1
  44. package/lib/context/directory/handlers/resourceServers.js +18 -30
  45. package/lib/context/directory/handlers/roles.js +21 -31
  46. package/lib/context/directory/handlers/rules.js +22 -32
  47. package/lib/context/directory/handlers/rulesConfigs.js +3 -15
  48. package/lib/context/directory/handlers/selfServiceProfiles.js +28 -40
  49. package/lib/context/directory/handlers/tenant.js +14 -34
  50. package/lib/context/directory/handlers/themes.js +9 -21
  51. package/lib/context/directory/handlers/tokenExchangeProfiles.d.ts +5 -0
  52. package/lib/context/directory/handlers/tokenExchangeProfiles.js +41 -0
  53. package/lib/context/directory/handlers/triggers.d.ts +1 -1
  54. package/lib/context/directory/handlers/triggers.js +16 -26
  55. package/lib/context/directory/handlers/userAttributeProfiles.d.ts +1 -1
  56. package/lib/context/directory/handlers/userAttributeProfiles.js +16 -26
  57. package/lib/context/directory/index.js +66 -80
  58. package/lib/context/index.js +7 -18
  59. package/lib/context/yaml/handlers/actions.js +39 -41
  60. package/lib/context/yaml/handlers/attackProtection.js +27 -41
  61. package/lib/context/yaml/handlers/branding.js +47 -69
  62. package/lib/context/yaml/handlers/clientGrants.js +26 -40
  63. package/lib/context/yaml/handlers/clients.js +69 -84
  64. package/lib/context/yaml/handlers/connectionProfiles.d.ts +1 -1
  65. package/lib/context/yaml/handlers/connectionProfiles.js +20 -34
  66. package/lib/context/yaml/handlers/connections.js +63 -67
  67. package/lib/context/yaml/handlers/customDomains.js +7 -19
  68. package/lib/context/yaml/handlers/databases.js +63 -65
  69. package/lib/context/yaml/handlers/emailProvider.js +22 -37
  70. package/lib/context/yaml/handlers/emailTemplates.js +28 -39
  71. package/lib/context/yaml/handlers/flowVaultConnections.js +37 -50
  72. package/lib/context/yaml/handlers/flows.js +55 -66
  73. package/lib/context/yaml/handlers/forms.js +55 -66
  74. package/lib/context/yaml/handlers/guardianFactorProviders.js +7 -19
  75. package/lib/context/yaml/handlers/guardianFactorTemplates.js +7 -19
  76. package/lib/context/yaml/handlers/guardianFactors.js +7 -19
  77. package/lib/context/yaml/handlers/guardianPhoneFactorMessageTypes.js +7 -19
  78. package/lib/context/yaml/handlers/guardianPhoneFactorSelectedProvider.js +7 -19
  79. package/lib/context/yaml/handlers/guardianPolicies.js +7 -19
  80. package/lib/context/yaml/handlers/hooks.js +34 -48
  81. package/lib/context/yaml/handlers/index.js +4 -1
  82. package/lib/context/yaml/handlers/logStreams.js +16 -30
  83. package/lib/context/yaml/handlers/networkACLs.js +25 -39
  84. package/lib/context/yaml/handlers/organizations.js +37 -46
  85. package/lib/context/yaml/handlers/pages.js +31 -39
  86. package/lib/context/yaml/handlers/phoneProvider.js +17 -31
  87. package/lib/context/yaml/handlers/phoneTemplates.d.ts +6 -0
  88. package/lib/context/yaml/handlers/phoneTemplates.js +25 -0
  89. package/lib/context/yaml/handlers/prompts.js +22 -47
  90. package/lib/context/yaml/handlers/resourceServers.d.ts +1 -1
  91. package/lib/context/yaml/handlers/resourceServers.js +21 -33
  92. package/lib/context/yaml/handlers/roles.js +19 -33
  93. package/lib/context/yaml/handlers/rules.js +28 -39
  94. package/lib/context/yaml/handlers/rulesConfigs.js +14 -28
  95. package/lib/context/yaml/handlers/selfServiceProfiles.js +29 -43
  96. package/lib/context/yaml/handlers/tenant.js +19 -41
  97. package/lib/context/yaml/handlers/themes.js +7 -19
  98. package/lib/context/yaml/handlers/tokenExchangeProfiles.d.ts +5 -0
  99. package/lib/context/yaml/handlers/tokenExchangeProfiles.js +27 -0
  100. package/lib/context/yaml/handlers/triggers.d.ts +1 -1
  101. package/lib/context/yaml/handlers/triggers.js +15 -29
  102. package/lib/context/yaml/handlers/userAttributeProfiles.d.ts +1 -1
  103. package/lib/context/yaml/handlers/userAttributeProfiles.js +7 -19
  104. package/lib/context/yaml/index.js +120 -128
  105. package/lib/index.d.ts +4 -96
  106. package/lib/index.js +24 -34
  107. package/lib/keywordPreservation.d.ts +1 -1
  108. package/lib/keywordPreservation.js +11 -6
  109. package/lib/logger.js +0 -1
  110. package/lib/readonly.js +3 -4
  111. package/lib/sessionDurationsToMinutes.js +0 -1
  112. package/lib/tools/auth0/client.js +108 -127
  113. package/lib/tools/auth0/handlers/actions.d.ts +8 -26
  114. package/lib/tools/auth0/handlers/actions.js +138 -149
  115. package/lib/tools/auth0/handlers/attackProtection.js +80 -92
  116. package/lib/tools/auth0/handlers/branding.js +75 -99
  117. package/lib/tools/auth0/handlers/clientGrants.d.ts +2 -9
  118. package/lib/tools/auth0/handlers/clientGrants.js +68 -73
  119. package/lib/tools/auth0/handlers/clients.d.ts +17 -16
  120. package/lib/tools/auth0/handlers/clients.js +120 -106
  121. package/lib/tools/auth0/handlers/connectionProfiles.d.ts +3 -1
  122. package/lib/tools/auth0/handlers/connectionProfiles.js +36 -32
  123. package/lib/tools/auth0/handlers/connections.d.ts +3 -1
  124. package/lib/tools/auth0/handlers/connections.js +130 -135
  125. package/lib/tools/auth0/handlers/customDomains.d.ts +4 -1
  126. package/lib/tools/auth0/handlers/customDomains.js +43 -53
  127. package/lib/tools/auth0/handlers/databases.js +94 -114
  128. package/lib/tools/auth0/handlers/default.d.ts +2 -2
  129. package/lib/tools/auth0/handlers/default.js +210 -171
  130. package/lib/tools/auth0/handlers/emailProvider.js +41 -52
  131. package/lib/tools/auth0/handlers/emailTemplates.d.ts +1 -0
  132. package/lib/tools/auth0/handlers/emailTemplates.js +54 -70
  133. package/lib/tools/auth0/handlers/flowVaultConnections.d.ts +5 -12
  134. package/lib/tools/auth0/handlers/flowVaultConnections.js +102 -145
  135. package/lib/tools/auth0/handlers/flows.d.ts +2 -3
  136. package/lib/tools/auth0/handlers/flows.js +92 -129
  137. package/lib/tools/auth0/handlers/forms.d.ts +3 -3
  138. package/lib/tools/auth0/handlers/forms.js +98 -112
  139. package/lib/tools/auth0/handlers/guardianFactorProviders.js +61 -84
  140. package/lib/tools/auth0/handlers/guardianFactorTemplates.js +46 -68
  141. package/lib/tools/auth0/handlers/guardianFactors.js +35 -45
  142. package/lib/tools/auth0/handlers/guardianPhoneFactorMessageTypes.js +29 -45
  143. package/lib/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.js +29 -45
  144. package/lib/tools/auth0/handlers/guardianPolicies.js +20 -35
  145. package/lib/tools/auth0/handlers/hooks.js +123 -153
  146. package/lib/tools/auth0/handlers/index.js +4 -1
  147. package/lib/tools/auth0/handlers/logStreams.js +42 -47
  148. package/lib/tools/auth0/handlers/networkACLs.d.ts +5 -4
  149. package/lib/tools/auth0/handlers/networkACLs.js +115 -133
  150. package/lib/tools/auth0/handlers/organizations.d.ts +10 -9
  151. package/lib/tools/auth0/handlers/organizations.js +350 -431
  152. package/lib/tools/auth0/handlers/pages.js +74 -83
  153. package/lib/tools/auth0/handlers/phoneProvider.d.ts +2 -2
  154. package/lib/tools/auth0/handlers/phoneProvider.js +69 -82
  155. package/lib/tools/auth0/handlers/phoneTemplates.d.ts +63 -0
  156. package/lib/tools/auth0/handlers/phoneTemplates.js +221 -0
  157. package/lib/tools/auth0/handlers/prompts.d.ts +7 -7
  158. package/lib/tools/auth0/handlers/prompts.js +246 -240
  159. package/lib/tools/auth0/handlers/resourceServers.d.ts +6 -2
  160. package/lib/tools/auth0/handlers/resourceServers.js +94 -105
  161. package/lib/tools/auth0/handlers/roles.js +149 -178
  162. package/lib/tools/auth0/handlers/rules.js +144 -162
  163. package/lib/tools/auth0/handlers/rulesConfigs.js +30 -39
  164. package/lib/tools/auth0/handlers/scimHandler.d.ts +4 -3
  165. package/lib/tools/auth0/handlers/scimHandler.js +110 -132
  166. package/lib/tools/auth0/handlers/selfServiceProfiles.d.ts +12 -3
  167. package/lib/tools/auth0/handlers/selfServiceProfiles.js +173 -203
  168. package/lib/tools/auth0/handlers/tenant.d.ts +5 -3
  169. package/lib/tools/auth0/handlers/tenant.js +46 -52
  170. package/lib/tools/auth0/handlers/themes.d.ts +12 -12
  171. package/lib/tools/auth0/handlers/themes.js +86 -102
  172. package/lib/tools/auth0/handlers/tokenExchangeProfiles.d.ts +60 -0
  173. package/lib/tools/auth0/handlers/tokenExchangeProfiles.js +263 -0
  174. package/lib/tools/auth0/handlers/triggers.js +59 -75
  175. package/lib/tools/auth0/handlers/userAttributeProfiles.d.ts +3 -2
  176. package/lib/tools/auth0/handlers/userAttributeProfiles.js +41 -43
  177. package/lib/tools/auth0/index.js +35 -48
  178. package/lib/tools/auth0/schema.js +6 -4
  179. package/lib/tools/calculateChanges.js +24 -15
  180. package/lib/tools/constants.d.ts +4 -2
  181. package/lib/tools/constants.js +3 -1
  182. package/lib/tools/deploy.js +17 -29
  183. package/lib/tools/index.d.ts +3 -89
  184. package/lib/tools/index.js +3 -2
  185. package/lib/tools/utils.d.ts +1 -1
  186. package/lib/tools/utils.js +12 -22
  187. package/lib/tools/validationError.js +0 -1
  188. package/lib/types.d.ts +13 -5
  189. package/lib/types.js +0 -1
  190. package/lib/utils.d.ts +3 -58
  191. package/lib/utils.js +8 -5
  192. package/package.json +11 -10
  193. package/tsconfig.json +4 -3
  194. package/.eslintignore +0 -5
  195. package/.eslintrc +0 -69
  196. package/lib/args.js.map +0 -1
  197. package/lib/commands/export.js.map +0 -1
  198. package/lib/commands/import.js.map +0 -1
  199. package/lib/commands/index.js.map +0 -1
  200. package/lib/configFactory.js.map +0 -1
  201. package/lib/context/defaults.js.map +0 -1
  202. package/lib/context/directory/handlers/actions.js.map +0 -1
  203. package/lib/context/directory/handlers/attackProtection.js.map +0 -1
  204. package/lib/context/directory/handlers/branding.js.map +0 -1
  205. package/lib/context/directory/handlers/clientGrants.js.map +0 -1
  206. package/lib/context/directory/handlers/clients.js.map +0 -1
  207. package/lib/context/directory/handlers/connectionProfiles.js.map +0 -1
  208. package/lib/context/directory/handlers/connections.js.map +0 -1
  209. package/lib/context/directory/handlers/customDomains.js.map +0 -1
  210. package/lib/context/directory/handlers/databases.js.map +0 -1
  211. package/lib/context/directory/handlers/emailProvider.js.map +0 -1
  212. package/lib/context/directory/handlers/emailTemplates.js.map +0 -1
  213. package/lib/context/directory/handlers/flowVaultConnections.js.map +0 -1
  214. package/lib/context/directory/handlers/flows.js.map +0 -1
  215. package/lib/context/directory/handlers/forms.js.map +0 -1
  216. package/lib/context/directory/handlers/guardianFactorProviders.js.map +0 -1
  217. package/lib/context/directory/handlers/guardianFactorTemplates.js.map +0 -1
  218. package/lib/context/directory/handlers/guardianFactors.js.map +0 -1
  219. package/lib/context/directory/handlers/guardianPhoneFactorMessageTypes.js.map +0 -1
  220. package/lib/context/directory/handlers/guardianPhoneFactorSelectedProvider.js.map +0 -1
  221. package/lib/context/directory/handlers/guardianPolicies.js.map +0 -1
  222. package/lib/context/directory/handlers/hooks.js.map +0 -1
  223. package/lib/context/directory/handlers/index.js.map +0 -1
  224. package/lib/context/directory/handlers/logStreams.js.map +0 -1
  225. package/lib/context/directory/handlers/networkACLs.js.map +0 -1
  226. package/lib/context/directory/handlers/organizations.js.map +0 -1
  227. package/lib/context/directory/handlers/pages.js.map +0 -1
  228. package/lib/context/directory/handlers/phoneProvider.js.map +0 -1
  229. package/lib/context/directory/handlers/prompts.js.map +0 -1
  230. package/lib/context/directory/handlers/resourceServers.js.map +0 -1
  231. package/lib/context/directory/handlers/roles.js.map +0 -1
  232. package/lib/context/directory/handlers/rules.js.map +0 -1
  233. package/lib/context/directory/handlers/rulesConfigs.js.map +0 -1
  234. package/lib/context/directory/handlers/selfServiceProfiles.js.map +0 -1
  235. package/lib/context/directory/handlers/tenant.js.map +0 -1
  236. package/lib/context/directory/handlers/themes.js.map +0 -1
  237. package/lib/context/directory/handlers/triggers.js.map +0 -1
  238. package/lib/context/directory/handlers/userAttributeProfiles.js.map +0 -1
  239. package/lib/context/directory/index.js.map +0 -1
  240. package/lib/context/index.js.map +0 -1
  241. package/lib/context/yaml/handlers/actions.js.map +0 -1
  242. package/lib/context/yaml/handlers/attackProtection.js.map +0 -1
  243. package/lib/context/yaml/handlers/branding.js.map +0 -1
  244. package/lib/context/yaml/handlers/clientGrants.js.map +0 -1
  245. package/lib/context/yaml/handlers/clients.js.map +0 -1
  246. package/lib/context/yaml/handlers/connectionProfiles.js.map +0 -1
  247. package/lib/context/yaml/handlers/connections.js.map +0 -1
  248. package/lib/context/yaml/handlers/customDomains.js.map +0 -1
  249. package/lib/context/yaml/handlers/databases.js.map +0 -1
  250. package/lib/context/yaml/handlers/emailProvider.js.map +0 -1
  251. package/lib/context/yaml/handlers/emailTemplates.js.map +0 -1
  252. package/lib/context/yaml/handlers/flowVaultConnections.js.map +0 -1
  253. package/lib/context/yaml/handlers/flows.js.map +0 -1
  254. package/lib/context/yaml/handlers/forms.js.map +0 -1
  255. package/lib/context/yaml/handlers/guardianFactorProviders.js.map +0 -1
  256. package/lib/context/yaml/handlers/guardianFactorTemplates.js.map +0 -1
  257. package/lib/context/yaml/handlers/guardianFactors.js.map +0 -1
  258. package/lib/context/yaml/handlers/guardianPhoneFactorMessageTypes.js.map +0 -1
  259. package/lib/context/yaml/handlers/guardianPhoneFactorSelectedProvider.js.map +0 -1
  260. package/lib/context/yaml/handlers/guardianPolicies.js.map +0 -1
  261. package/lib/context/yaml/handlers/hooks.js.map +0 -1
  262. package/lib/context/yaml/handlers/index.js.map +0 -1
  263. package/lib/context/yaml/handlers/logStreams.js.map +0 -1
  264. package/lib/context/yaml/handlers/networkACLs.js.map +0 -1
  265. package/lib/context/yaml/handlers/organizations.js.map +0 -1
  266. package/lib/context/yaml/handlers/pages.js.map +0 -1
  267. package/lib/context/yaml/handlers/phoneProvider.js.map +0 -1
  268. package/lib/context/yaml/handlers/prompts.js.map +0 -1
  269. package/lib/context/yaml/handlers/resourceServers.js.map +0 -1
  270. package/lib/context/yaml/handlers/roles.js.map +0 -1
  271. package/lib/context/yaml/handlers/rules.js.map +0 -1
  272. package/lib/context/yaml/handlers/rulesConfigs.js.map +0 -1
  273. package/lib/context/yaml/handlers/selfServiceProfiles.js.map +0 -1
  274. package/lib/context/yaml/handlers/tenant.js.map +0 -1
  275. package/lib/context/yaml/handlers/themes.js.map +0 -1
  276. package/lib/context/yaml/handlers/triggers.js.map +0 -1
  277. package/lib/context/yaml/handlers/userAttributeProfiles.js.map +0 -1
  278. package/lib/context/yaml/index.js.map +0 -1
  279. package/lib/index.js.map +0 -1
  280. package/lib/keywordPreservation.js.map +0 -1
  281. package/lib/logger.js.map +0 -1
  282. package/lib/readonly.js.map +0 -1
  283. package/lib/sessionDurationsToMinutes.js.map +0 -1
  284. package/lib/tools/auth0/client.js.map +0 -1
  285. package/lib/tools/auth0/handlers/actions.js.map +0 -1
  286. package/lib/tools/auth0/handlers/attackProtection.js.map +0 -1
  287. package/lib/tools/auth0/handlers/branding.js.map +0 -1
  288. package/lib/tools/auth0/handlers/clientGrants.js.map +0 -1
  289. package/lib/tools/auth0/handlers/clients.js.map +0 -1
  290. package/lib/tools/auth0/handlers/connectionProfiles.js.map +0 -1
  291. package/lib/tools/auth0/handlers/connections.js.map +0 -1
  292. package/lib/tools/auth0/handlers/customDomains.js.map +0 -1
  293. package/lib/tools/auth0/handlers/databases.js.map +0 -1
  294. package/lib/tools/auth0/handlers/default.js.map +0 -1
  295. package/lib/tools/auth0/handlers/emailProvider.js.map +0 -1
  296. package/lib/tools/auth0/handlers/emailTemplates.js.map +0 -1
  297. package/lib/tools/auth0/handlers/flowVaultConnections.js.map +0 -1
  298. package/lib/tools/auth0/handlers/flows.js.map +0 -1
  299. package/lib/tools/auth0/handlers/forms.js.map +0 -1
  300. package/lib/tools/auth0/handlers/guardianFactorProviders.js.map +0 -1
  301. package/lib/tools/auth0/handlers/guardianFactorTemplates.js.map +0 -1
  302. package/lib/tools/auth0/handlers/guardianFactors.js.map +0 -1
  303. package/lib/tools/auth0/handlers/guardianPhoneFactorMessageTypes.js.map +0 -1
  304. package/lib/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.js.map +0 -1
  305. package/lib/tools/auth0/handlers/guardianPolicies.js.map +0 -1
  306. package/lib/tools/auth0/handlers/hooks.js.map +0 -1
  307. package/lib/tools/auth0/handlers/index.js.map +0 -1
  308. package/lib/tools/auth0/handlers/logStreams.js.map +0 -1
  309. package/lib/tools/auth0/handlers/networkACLs.js.map +0 -1
  310. package/lib/tools/auth0/handlers/organizations.js.map +0 -1
  311. package/lib/tools/auth0/handlers/pages.js.map +0 -1
  312. package/lib/tools/auth0/handlers/phoneProvider.js.map +0 -1
  313. package/lib/tools/auth0/handlers/prompts.js.map +0 -1
  314. package/lib/tools/auth0/handlers/resourceServers.js.map +0 -1
  315. package/lib/tools/auth0/handlers/roles.js.map +0 -1
  316. package/lib/tools/auth0/handlers/rules.js.map +0 -1
  317. package/lib/tools/auth0/handlers/rulesConfigs.js.map +0 -1
  318. package/lib/tools/auth0/handlers/scimHandler.js.map +0 -1
  319. package/lib/tools/auth0/handlers/selfServiceProfiles.js.map +0 -1
  320. package/lib/tools/auth0/handlers/tenant.js.map +0 -1
  321. package/lib/tools/auth0/handlers/themes.js.map +0 -1
  322. package/lib/tools/auth0/handlers/triggers.js.map +0 -1
  323. package/lib/tools/auth0/handlers/userAttributeProfiles.js.map +0 -1
  324. package/lib/tools/auth0/index.js.map +0 -1
  325. package/lib/tools/auth0/schema.js.map +0 -1
  326. package/lib/tools/calculateChanges.js.map +0 -1
  327. package/lib/tools/constants.js.map +0 -1
  328. package/lib/tools/deploy.js.map +0 -1
  329. package/lib/tools/index.js.map +0 -1
  330. package/lib/tools/utils.js.map +0 -1
  331. package/lib/tools/validationError.js.map +0 -1
  332. package/lib/types.js.map +0 -1
  333. package/lib/utils.js.map +0 -1
@@ -1,13 +1,4 @@
1
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
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
12
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
4
  };
@@ -28,6 +19,50 @@ function order(value) {
28
19
  return descriptor;
29
20
  };
30
21
  }
22
+ // Retry configuration constants
23
+ const DEFAULT_MAX_RETRIES = 3;
24
+ const DEFAULT_INITIAL_DELAY_MS = 1000; // 1 second
25
+ const DEFAULT_MAX_DELAY_MS = 30000; // 30 seconds
26
+ /**
27
+ * Executes a function with exponential backoff retry logic for rate limit errors (429).
28
+ *
29
+ * @param fn - The function to execute with retry logic
30
+ * @param options - Configuration options for retry behavior
31
+ * @returns Promise that resolves with the function result or rejects after max retries
32
+ */
33
+ async function retryWithExponentialBackoff(fn, options = {}) {
34
+ const { maxRetries = DEFAULT_MAX_RETRIES, initialDelay = DEFAULT_INITIAL_DELAY_MS, maxDelay = DEFAULT_MAX_DELAY_MS, onRetry = () => { }, } = options;
35
+ let lastError;
36
+ for (let attempt = 0; attempt <= maxRetries; attempt++) {
37
+ try {
38
+ return await fn();
39
+ }
40
+ catch (error) {
41
+ lastError = error;
42
+ // Only retry on rate limit errors (429)
43
+ const isRateLimitError = error?.statusCode === 429 ||
44
+ error?.message?.includes('429') ||
45
+ error?.message?.includes('Too Many Requests') ||
46
+ error?.message?.includes('TooManyRequestsError') ||
47
+ error?.message?.includes('Global limit has been reached');
48
+ if (!isRateLimitError || attempt === maxRetries) {
49
+ throw error;
50
+ }
51
+ // Calculate delay with exponential backoff and jitter
52
+ const exponentialDelay = initialDelay * 2 ** attempt;
53
+ const jitter = Math.random() * 1000; // 0-1s randomization to prevent thundering herd
54
+ const delay = Math.min(exponentialDelay + jitter, maxDelay);
55
+ // Check for Retry-After header (if available in error response)
56
+ const retryAfter = error?.rawResponse?.headers?.get('retry-after');
57
+ const finalDelay = retryAfter ? parseInt(retryAfter, 10) * 1000 : delay;
58
+ onRetry(error, attempt + 1, finalDelay);
59
+ await new Promise((resolve) => {
60
+ setTimeout(resolve, finalDelay);
61
+ });
62
+ }
63
+ }
64
+ throw lastError;
65
+ }
31
66
  class APIHandler {
32
67
  constructor(options) {
33
68
  this.config = options.config;
@@ -40,7 +75,13 @@ class APIHandler {
40
75
  this.stripUpdateFields = [...(options.stripUpdateFields || []), this.id];
41
76
  this.sensitiveFieldsToObfuscate = options.sensitiveFieldsToObfuscate || [];
42
77
  this.stripCreateFields = options.stripCreateFields || [];
43
- this.functions = Object.assign({ getAll: 'getAll', create: 'create', delete: 'delete', update: 'update' }, (options.functions || {}));
78
+ this.functions = {
79
+ list: 'list',
80
+ create: 'create',
81
+ delete: 'delete',
82
+ update: 'update',
83
+ ...(options.functions || {}),
84
+ };
44
85
  this.updated = 0;
45
86
  this.created = 0;
46
87
  this.deleted = 0;
@@ -57,7 +98,7 @@ class APIHandler {
57
98
  }
58
99
  didCreate(item) {
59
100
  if (typeof item === 'object' && item instanceof auth0_1.JSONApiResponse) {
60
- logger_1.default.info(`Created [${this.type}]: ${this.objString(item === null || item === void 0 ? void 0 : item.data)}`);
101
+ logger_1.default.info(`Created [${this.type}]: ${this.objString(item?.data)}`);
61
102
  }
62
103
  else {
63
104
  logger_1.default.info(`Created [${this.type}]: ${this.objString(item)}`);
@@ -65,7 +106,7 @@ class APIHandler {
65
106
  }
66
107
  didUpdate(item) {
67
108
  if (typeof item === 'object' && item instanceof auth0_1.JSONApiResponse) {
68
- logger_1.default.info(`Updated [${this.type}]: ${this.objString(item === null || item === void 0 ? void 0 : item.data)}`);
109
+ logger_1.default.info(`Updated [${this.type}]: ${this.objString(item?.data)}`);
69
110
  }
70
111
  else {
71
112
  logger_1.default.info(`Updated [${this.type}]: ${this.objString(item)}`);
@@ -74,181 +115,179 @@ class APIHandler {
74
115
  objString(item) {
75
116
  return (0, utils_1.convertJsonToString)(item);
76
117
  }
77
- getType() {
78
- return __awaiter(this, void 0, void 0, function* () {
79
- // Each type to impl how to get the existing as its not consistent across the mgnt api.
80
- throw new Error(`Must implement getType for type ${this.type}`);
81
- });
82
- }
83
- load() {
84
- return __awaiter(this, void 0, void 0, function* () {
85
- // Load Asset from Tenant
86
- const data = yield (() => __awaiter(this, void 0, void 0, function* () {
87
- const { data, hadSufficientScopes, requiredScopes } = yield (0, utils_1.detectInsufficientScopeError)(this.getType.bind(this));
88
- if (!hadSufficientScopes) {
89
- logger_1.default.warn(`Cannot retrieve ${this.type} due to missing scopes: ${requiredScopes}`);
90
- return null;
91
- }
92
- logger_1.default.info(`Retrieving ${this.type} data from Auth0`);
93
- return data;
94
- }))();
95
- this.existing = (0, utils_1.obfuscateSensitiveValues)(data, this.sensitiveFieldsToObfuscate);
96
- return { [this.type]: this.existing };
97
- });
118
+ async getType() {
119
+ // Each type to impl how to get the existing as its not consistent across the mgnt api.
120
+ throw new Error(`Must implement getType for type ${this.type}`);
98
121
  }
99
- calcChanges(assets) {
100
- return __awaiter(this, void 0, void 0, function* () {
101
- const typeAssets = assets[this.type];
102
- // Do nothing if not set
103
- if (!typeAssets) {
104
- return {
105
- del: [],
106
- create: [],
107
- conflicts: [],
108
- update: [],
109
- };
122
+ async load() {
123
+ // Load Asset from Tenant
124
+ const data = await (async () => {
125
+ const { data, hadSufficientScopes, requiredScopes } = await (0, utils_1.detectInsufficientScopeError)(this.getType.bind(this));
126
+ if (!hadSufficientScopes) {
127
+ logger_1.default.warn(`Cannot retrieve ${this.type} due to missing scopes: ${requiredScopes}`);
128
+ return null;
110
129
  }
111
- const existing = yield this.getType();
112
- // Figure out what needs to be updated vs created
113
- return (0, calculateChanges_1.calculateChanges)({
114
- handler: this,
115
- assets: typeAssets,
116
- allowDelete: !!this.config('AUTH0_ALLOW_DELETE'),
117
- //@ts-ignore TODO: investigate what happens when `existing` is null
118
- existing,
119
- identifiers: this.identifiers,
120
- });
130
+ logger_1.default.info(`Retrieving ${this.type} data from Auth0`);
131
+ return data;
132
+ })();
133
+ this.existing = (0, utils_1.obfuscateSensitiveValues)(data, this.sensitiveFieldsToObfuscate);
134
+ return { [this.type]: this.existing };
135
+ }
136
+ async calcChanges(assets) {
137
+ const typeAssets = assets[this.type];
138
+ // Do nothing if not set
139
+ if (!typeAssets) {
140
+ return {
141
+ del: [],
142
+ create: [],
143
+ conflicts: [],
144
+ update: [],
145
+ };
146
+ }
147
+ const existing = await this.getType();
148
+ // Figure out what needs to be updated vs created
149
+ return (0, calculateChanges_1.calculateChanges)({
150
+ handler: this,
151
+ assets: typeAssets,
152
+ allowDelete: !!this.config('AUTH0_ALLOW_DELETE'),
153
+ //@ts-ignore TODO: investigate what happens when `existing` is null
154
+ existing,
155
+ identifiers: this.identifiers,
121
156
  });
122
157
  }
123
- validate(assets) {
124
- return __awaiter(this, void 0, void 0, function* () {
125
- // Ensure no duplication in id and name
126
- const typeAssets = assets[this.type];
127
- // Do nothing if not set
128
- if (!Array.isArray(typeAssets))
129
- return;
130
- // Do not allow items with same name
131
- const duplicateNames = (0, utils_1.duplicateItems)(typeAssets, 'name');
132
- if (duplicateNames.length > 0) {
133
- const formatted = duplicateNames.map((dups) => dups.map((d) => `${d.name}`));
134
- throw new validationError_1.default(`There are multiple ${this.type} with the same name combinations
158
+ async validate(assets) {
159
+ // Ensure no duplication in id and name
160
+ const typeAssets = assets[this.type];
161
+ // Do nothing if not set
162
+ if (!Array.isArray(typeAssets))
163
+ return;
164
+ // Do not allow items with same name
165
+ const duplicateNames = (0, utils_1.duplicateItems)(typeAssets, 'name');
166
+ if (duplicateNames.length > 0) {
167
+ const formatted = duplicateNames.map((dups) => dups.map((d) => `${d.name}`));
168
+ throw new validationError_1.default(`There are multiple ${this.type} with the same name combinations
135
169
  ${(0, utils_1.convertJsonToString)(formatted)}.
136
170
  Names must be unique.`);
137
- }
138
- // Do not allow items with same id
139
- const duplicateIDs = (0, utils_1.duplicateItems)(typeAssets, this.id);
140
- if (duplicateIDs.length > 0) {
141
- const formatted = duplicateIDs.map((dups) => dups.map((d) => `${d[this.id]}`));
142
- throw new validationError_1.default(`There are multiple ${this.type} for the following stage-order combinations
171
+ }
172
+ // Do not allow items with same id
173
+ const duplicateIDs = (0, utils_1.duplicateItems)(typeAssets, this.id);
174
+ if (duplicateIDs.length > 0) {
175
+ const formatted = duplicateIDs.map((dups) => dups.map((d) => `${d[this.id]}`));
176
+ throw new validationError_1.default(`There are multiple ${this.type} for the following stage-order combinations
143
177
  ${(0, utils_1.convertJsonToString)(formatted)}.
144
178
  Only one rule must be defined for the same order number in a stage.`);
145
- }
146
- });
179
+ }
147
180
  }
148
- processChanges(assets, changes) {
149
- return __awaiter(this, void 0, void 0, function* () {
150
- if (!changes) {
151
- changes = yield this.calcChanges(assets);
152
- }
153
- const del = changes.del || [];
154
- const update = changes.update || [];
155
- const create = changes.create || [];
156
- const conflicts = changes.conflicts || [];
157
- logger_1.default.debug(`Start processChanges for ${this.type} [delete:${del.length}] [update:${update.length}], [create:${create.length}], [conflicts:${conflicts.length}]`);
158
- // Process Deleted
159
- if (del.length > 0) {
160
- const allowDelete = this.config('AUTH0_ALLOW_DELETE') === 'true' || this.config('AUTH0_ALLOW_DELETE') === true;
161
- const byExtension = this.config('EXTENSION_SECRET') &&
162
- (this.type === 'rules' || this.type === 'resourceServers');
163
- const shouldDelete = allowDelete || byExtension;
164
- if (!shouldDelete) {
165
- 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
181
+ async processChanges(assets, changes) {
182
+ if (!changes) {
183
+ changes = await this.calcChanges(assets);
184
+ }
185
+ const del = changes.del || [];
186
+ const update = changes.update || [];
187
+ const create = changes.create || [];
188
+ const conflicts = changes.conflicts || [];
189
+ logger_1.default.debug(`Start processChanges for ${this.type} [delete:${del.length}] [update:${update.length}], [create:${create.length}], [conflicts:${conflicts.length}]`);
190
+ // Set retry configuration from config
191
+ const retryConfig = {
192
+ maxRetries: this.config('AUTH0_MAX_RETRIES') || DEFAULT_MAX_RETRIES,
193
+ initialDelay: this.config('AUTH0_RETRY_INITIAL_DELAY_MS') || DEFAULT_INITIAL_DELAY_MS,
194
+ maxDelay: this.config('AUTH0_RETRY_MAX_DELAY_MS') || DEFAULT_MAX_DELAY_MS,
195
+ onRetry: (error, attempt, delay) => {
196
+ logger_1.default.warn(`Rate limit hit for [${this.type}]. Retrying attempt ${attempt}/${retryConfig.maxRetries} after ${Math.round(delay / 1000)}s...`);
197
+ },
198
+ };
199
+ // Process Deleted
200
+ if (del.length > 0) {
201
+ const allowDelete = this.config('AUTH0_ALLOW_DELETE') === 'true' || this.config('AUTH0_ALLOW_DELETE') === true;
202
+ const byExtension = this.config('EXTENSION_SECRET') &&
203
+ (this.type === 'rules' || this.type === 'resourceServers');
204
+ const shouldDelete = allowDelete || byExtension;
205
+ if (!shouldDelete) {
206
+ 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
166
207
  \n${changes.del.map((i) => this.objString(i)).join('\n')}
167
208
  `);
168
- }
169
- else {
170
- yield this.client.pool
171
- .addEachTask({
172
- data: del || [],
173
- generator: (delItem) => {
174
- const delFunction = this.getClientFN(this.functions.delete);
175
- return delFunction({ [this.id]: delItem[this.id] })
176
- .then(() => {
177
- this.didDelete(delItem);
178
- this.deleted += 1;
179
- })
180
- .catch((err) => {
181
- throw new Error(`Problem deleting ${this.type} ${this.objString(delItem)}\n${err}`);
182
- });
183
- },
184
- })
185
- .promise();
186
- }
187
209
  }
188
- // Process Renaming Entries Temp due to conflicts in names
189
- yield this.client.pool
190
- .addEachTask({
191
- data: conflicts || [],
192
- generator: (updateItem) => {
193
- const updateFN = this.getClientFN(this.functions.update);
194
- const params = { [this.id]: updateItem[this.id] };
195
- const updatePayload = (() => {
196
- let data = (0, utils_1.stripFields)(Object.assign({}, updateItem), this.stripUpdateFields);
197
- return (0, utils_1.stripObfuscatedFieldsFromPayload)(data, this.sensitiveFieldsToObfuscate);
198
- })();
199
- return updateFN(params, updatePayload)
200
- .then((data) => this.didUpdate(data))
201
- .catch((err) => {
202
- throw new Error(`Problem updating ${this.type} ${this.objString(updateItem)}\n${err}`);
203
- });
204
- },
205
- })
206
- .promise();
207
- // Process Creations
208
- yield this.client.pool
209
- .addEachTask({
210
- data: create || [],
211
- generator: (createItem) => {
212
- const createFunction = this.getClientFN(this.functions.create);
213
- const createPayload = (() => {
214
- const strippedPayload = (0, utils_1.stripFields)(createItem, this.stripCreateFields);
215
- return (0, utils_1.stripObfuscatedFieldsFromPayload)(strippedPayload, this.sensitiveFieldsToObfuscate);
216
- })();
217
- return createFunction(createPayload)
218
- .then((data) => {
219
- this.didCreate(data);
220
- this.created += 1;
210
+ else {
211
+ await this.client.pool
212
+ .addEachTask({
213
+ data: del || [],
214
+ generator: (delItem) => retryWithExponentialBackoff(() => {
215
+ const delFunction = this.getClientFN(this.functions.delete);
216
+ return delFunction(delItem[this.id]);
217
+ }, retryConfig)
218
+ .then(() => {
219
+ this.didDelete(delItem);
220
+ this.deleted += 1;
221
221
  })
222
222
  .catch((err) => {
223
- throw new Error(`Problem creating ${this.type} ${this.objString(createItem)}\n${err}`);
224
- });
225
- },
223
+ throw new Error(`Problem deleting ${this.type} ${this.objString(delItem)}\n${err}`);
224
+ }),
225
+ })
226
+ .promise();
227
+ }
228
+ }
229
+ // Process Renaming Entries Temp due to conflicts in names
230
+ await this.client.pool
231
+ .addEachTask({
232
+ data: conflicts || [],
233
+ generator: (updateItem) => retryWithExponentialBackoff(() => {
234
+ const updateFN = this.getClientFN(this.functions.update);
235
+ const params = { [this.id]: updateItem[this.id] };
236
+ const updatePayload = (() => {
237
+ const data = (0, utils_1.stripFields)({ ...updateItem }, this.stripUpdateFields);
238
+ return (0, utils_1.stripObfuscatedFieldsFromPayload)(data, this.sensitiveFieldsToObfuscate);
239
+ })();
240
+ return updateFN(params, updatePayload);
241
+ }, retryConfig)
242
+ .then((data) => this.didUpdate(data))
243
+ .catch((err) => {
244
+ throw new Error(`Problem updating ${this.type} ${this.objString(updateItem)}\n${err}`);
245
+ }),
246
+ })
247
+ .promise();
248
+ // Process Creations
249
+ await this.client.pool
250
+ .addEachTask({
251
+ data: create || [],
252
+ generator: (createItem) => retryWithExponentialBackoff(() => {
253
+ const createFunction = this.getClientFN(this.functions.create);
254
+ const createPayload = (() => {
255
+ const strippedPayload = (0, utils_1.stripFields)(createItem, this.stripCreateFields);
256
+ return (0, utils_1.stripObfuscatedFieldsFromPayload)(strippedPayload, this.sensitiveFieldsToObfuscate);
257
+ })();
258
+ return createFunction(createPayload);
259
+ }, retryConfig)
260
+ .then((data) => {
261
+ this.didCreate(data);
262
+ this.created += 1;
226
263
  })
227
- .promise();
228
- // Process Updates and strip fields not allowed in updates
229
- yield this.client.pool
230
- .addEachTask({
231
- data: update || [],
232
- generator: (updateItem) => {
233
- const updateFN = this.getClientFN(this.functions.update);
234
- const params = { [this.id]: updateItem[this.id] };
235
- const updatePayload = (() => {
236
- let data = (0, utils_1.stripFields)(Object.assign({}, updateItem), this.stripUpdateFields);
237
- return (0, utils_1.stripObfuscatedFieldsFromPayload)(data, this.sensitiveFieldsToObfuscate);
238
- })();
239
- return updateFN(params, updatePayload)
240
- .then((data) => {
241
- this.didUpdate(data);
242
- this.updated += 1;
243
- })
244
- .catch((err) => {
245
- throw new Error(`Problem updating ${this.type} ${this.objString(updateItem)}\n${err}`);
246
- });
247
- },
264
+ .catch((err) => {
265
+ throw new Error(`Problem creating ${this.type} ${this.objString(createItem)}\n${err}`);
266
+ }),
267
+ })
268
+ .promise();
269
+ // Process Updates and strip fields not allowed in updates
270
+ await this.client.pool
271
+ .addEachTask({
272
+ data: update || [],
273
+ generator: (updateItem) => retryWithExponentialBackoff(() => {
274
+ const updateFN = this.getClientFN(this.functions.update);
275
+ const params = { [this.id]: updateItem[this.id] };
276
+ const updatePayload = (() => {
277
+ const data = (0, utils_1.stripFields)({ ...updateItem }, this.stripUpdateFields);
278
+ return (0, utils_1.stripObfuscatedFieldsFromPayload)(data, this.sensitiveFieldsToObfuscate);
279
+ })();
280
+ return updateFN(params, updatePayload);
281
+ }, retryConfig)
282
+ .then((data) => {
283
+ this.didUpdate(data);
284
+ this.updated += 1;
248
285
  })
249
- .promise();
250
- });
286
+ .catch((err) => {
287
+ throw new Error(`Problem updating ${this.type} ${this.objString(updateItem)}\n${err}`);
288
+ }),
289
+ })
290
+ .promise();
251
291
  }
252
292
  }
253
293
  exports.default = APIHandler;
254
- //# sourceMappingURL=default.js.map
@@ -38,15 +38,6 @@ 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
- };
50
41
  Object.defineProperty(exports, "__esModule", { value: true });
51
42
  exports.schema = void 0;
52
43
  const lodash_1 = require("lodash");
@@ -56,61 +47,59 @@ exports.schema = { type: 'object' };
56
47
  const defaultFields = ['name', 'enabled', 'credentials', 'settings', 'default_from_address'];
57
48
  class EmailProviderHandler extends default_1.default {
58
49
  constructor(options) {
59
- super(Object.assign(Object.assign({}, options), { type: 'emailProvider' }));
60
- }
61
- getType() {
62
- return __awaiter(this, void 0, void 0, function* () {
63
- try {
64
- const { data } = yield this.client.emails.get({
65
- include_fields: true,
66
- fields: defaultFields.join(','),
67
- });
68
- return data;
69
- }
70
- catch (err) {
71
- if (err.statusCode === 404)
72
- return {};
73
- throw err;
74
- }
50
+ super({
51
+ ...options,
52
+ type: 'emailProvider',
75
53
  });
76
54
  }
55
+ async getType() {
56
+ try {
57
+ const emailProvider = await this.client.emails.provider.get({
58
+ include_fields: true,
59
+ fields: defaultFields.join(','),
60
+ });
61
+ return emailProvider;
62
+ }
63
+ catch (err) {
64
+ if (err.statusCode === 404)
65
+ return {};
66
+ throw err;
67
+ }
68
+ }
77
69
  objString(provider) {
78
70
  return super.objString({ name: provider.name, enabled: provider.enabled });
79
71
  }
80
- processChanges(assets) {
81
- return __awaiter(this, void 0, void 0, function* () {
82
- const { emailProvider } = assets;
83
- if (!emailProvider)
84
- return;
85
- const existing = yield this.getType();
86
- // HTTP DELETE on emails/provider is not supported, as this is not part of our vNext SDK.
87
- if (Object.keys(emailProvider).length === 0) {
88
- if (this.config('AUTH0_ALLOW_DELETE') === true) {
89
- // await this.client.emails.delete(); is not supported
90
- if ((0, lodash_1.isEmpty)(existing.credentials)) {
91
- delete existing.credentials;
92
- }
93
- const updated = yield this.client.emails.update(existing);
94
- this.updated += 1;
95
- this.didUpdate(updated);
72
+ async processChanges(assets) {
73
+ const { emailProvider } = assets;
74
+ if (!emailProvider)
75
+ return;
76
+ const existing = await this.getType();
77
+ // HTTP DELETE on emails/provider is not supported, as this is not part of our vNext SDK.
78
+ if (Object.keys(emailProvider).length === 0) {
79
+ if (this.config('AUTH0_ALLOW_DELETE') === true) {
80
+ // await this.client.emails.delete(); is not supported
81
+ if ((0, lodash_1.isEmpty)(existing.credentials)) {
82
+ delete existing.credentials;
96
83
  }
97
- return;
98
- }
99
- if (existing.name) {
100
- const updated = yield this.client.emails.update(emailProvider);
84
+ const updated = await this.client.emails.provider.update(existing);
101
85
  this.updated += 1;
102
86
  this.didUpdate(updated);
103
87
  }
104
- else {
105
- const created = yield this.client.emails.configure(emailProvider);
106
- this.created += 1;
107
- this.didCreate(created);
108
- }
109
- });
88
+ return;
89
+ }
90
+ if (existing.name) {
91
+ const updated = await this.client.emails.provider.update(emailProvider);
92
+ this.updated += 1;
93
+ this.didUpdate(updated);
94
+ }
95
+ else {
96
+ const created = await this.client.emails.provider.create(emailProvider);
97
+ this.created += 1;
98
+ this.didCreate(created);
99
+ }
110
100
  }
111
101
  }
112
102
  exports.default = EmailProviderHandler;
113
103
  __decorate([
114
104
  (0, default_1.order)('60')
115
105
  ], EmailProviderHandler.prototype, "processChanges", null);
116
- //# sourceMappingURL=emailProvider.js.map
@@ -20,6 +20,7 @@ export declare const schema: {
20
20
  };
21
21
  export default class EmailTemplateHandler extends DefaultHandler {
22
22
  constructor(options: DefaultHandler);
23
+ objString(item: any): string;
23
24
  getType(): Promise<Asset>;
24
25
  updateOrCreate(emailTemplate: any): Promise<void>;
25
26
  processChanges(assets: Assets): Promise<void>;