auth0-deploy-cli 8.20.4-beta.0 → 8.22.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 +30 -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 +96 -7
  204. package/lib/tools/auth0/handlers/clients.js +221 -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 +2 -3
  266. package/lib/tools/auth0/handlers/resourceServers.js +106 -57
  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 +8 -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 +12 -13
  317. package/tsconfig.json +3 -4
  318. package/eslint.config.js +0 -130
@@ -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
  };
@@ -49,7 +58,6 @@ const default_1 = __importStar(require("./default"));
49
58
  const client_1 = require("../client");
50
59
  const logger_1 = __importDefault(require("../../../logger"));
51
60
  const utils_1 = require("../../../utils");
52
- const flowVaultConnections_1 = require("./flowVaultConnections");
53
61
  exports.schema = {
54
62
  type: 'array',
55
63
  items: {
@@ -64,114 +72,143 @@ exports.schema = {
64
72
  };
65
73
  class FlowHandler extends default_1.default {
66
74
  constructor(options) {
67
- super({
68
- ...options,
69
- type: 'flows',
70
- id: 'id',
71
- stripCreateFields: ['created_at', 'updated_at', 'executed_at'],
72
- stripUpdateFields: ['created_at', 'updated_at', 'executed_at'],
73
- functions: {
74
- update: async ({ id }, bodyParams) => this.client.flows.update(id, bodyParams),
75
- },
76
- });
75
+ super(Object.assign(Object.assign({}, options), { type: 'flows', id: 'id', stripCreateFields: ['created_at', 'updated_at', 'executed_at'], stripUpdateFields: ['created_at', 'updated_at', 'executed_at'] }));
77
76
  }
78
77
  objString(item) {
79
78
  return super.objString({ id: item.id, name: item.name });
80
79
  }
81
- async getFlows(flows) {
82
- const allFlows = await this.client.pool
83
- .addEachTask({
84
- data: flows,
85
- generator: ({ id }) => this.client.flows.get(id).then((response) => {
86
- if ((0, lodash_1.isEmpty)(response))
87
- return null;
88
- return response;
89
- }),
90
- })
91
- .promise();
92
- return allFlows.filter((flow) => flow !== null);
80
+ getFlows(flows) {
81
+ return __awaiter(this, void 0, void 0, function* () {
82
+ const allFlows = yield this.client.pool
83
+ .addEachTask({
84
+ data: flows,
85
+ generator: ({ id }) => this.client.flows.get({ id: id }).then((response) => {
86
+ if ((0, lodash_1.isEmpty)(response === null || response === void 0 ? void 0 : response.data))
87
+ return null;
88
+ return response.data;
89
+ }),
90
+ })
91
+ .promise();
92
+ return allFlows.filter((flow) => flow !== null);
93
+ });
93
94
  }
94
- async getType() {
95
- if (this.existing) {
95
+ getType() {
96
+ return __awaiter(this, void 0, void 0, function* () {
97
+ if (this.existing) {
98
+ return this.existing;
99
+ }
100
+ const [flows, allFlowConnections] = yield Promise.all([
101
+ (0, client_1.paginate)(this.client.flows.getAll, {
102
+ paginate: true,
103
+ include_totals: true,
104
+ }),
105
+ this.getAllFlowConnections(),
106
+ ]);
107
+ // get more details for each flows
108
+ const allFlows = yield this.getFlows(flows);
109
+ // create a map for id to name from allFlowConnections
110
+ const connectionIdMap = {};
111
+ allFlowConnections.forEach((c) => {
112
+ connectionIdMap[c.id] = c.name;
113
+ });
114
+ this.existing = yield this.formateFlowConnectionId(allFlows, connectionIdMap);
96
115
  return this.existing;
97
- }
98
- const [flows, allFlowConnections] = await Promise.all([
99
- (0, client_1.paginate)(this.client.flows.list, {
100
- paginate: true,
101
- }),
102
- (0, flowVaultConnections_1.getAllFlowConnections)(this.client),
103
- ]);
104
- // get more details for each flows
105
- const allFlows = await this.getFlows(flows);
106
- // create a map for id to name from allFlowConnections
107
- const connectionIdMap = {};
108
- allFlowConnections.forEach((c) => {
109
- connectionIdMap[c.id] = c.name;
110
116
  });
111
- this.existing = await this.formateFlowConnectionId(allFlows, connectionIdMap);
112
- return this.existing;
113
117
  }
114
- async processChanges(assets) {
115
- const { flows } = assets;
116
- // Do nothing if not set
117
- if (!flows)
118
- return;
119
- const allFlowConnections = await (0, flowVaultConnections_1.getAllFlowConnections)(this.client);
120
- // create a map for name to id from allFlowConnections
121
- const connectionNameMap = {};
122
- allFlowConnections.forEach((c) => {
123
- connectionNameMap[c.name] = c.id;
118
+ processChanges(assets) {
119
+ const _super = Object.create(null, {
120
+ processChanges: { get: () => super.processChanges }
124
121
  });
125
- assets.flows = await this.pargeFlowConnectionName(flows, connectionNameMap);
126
- const { del, update, create, conflicts } = await this.calcChanges(assets);
127
- const changes = {
128
- del: del,
129
- update: update,
130
- create: create,
131
- conflicts: conflicts,
132
- };
133
- await super.processChanges(assets, {
134
- ...changes,
122
+ return __awaiter(this, void 0, void 0, function* () {
123
+ const { flows } = assets;
124
+ // Do nothing if not set
125
+ if (!flows)
126
+ return;
127
+ const allFlowConnections = yield this.getAllFlowConnections();
128
+ // create a map for name to id from allFlowConnections
129
+ const connectionNameMap = {};
130
+ allFlowConnections.forEach((c) => {
131
+ connectionNameMap[c.name] = c.id;
132
+ });
133
+ assets.flows = yield this.pargeFlowConnectionName(flows, connectionNameMap);
134
+ const { del, update, create, conflicts } = yield this.calcChanges(assets);
135
+ const changes = {
136
+ del: del,
137
+ update: update,
138
+ create: create,
139
+ conflicts: conflicts,
140
+ };
141
+ yield _super.processChanges.call(this, assets, Object.assign({}, changes));
135
142
  });
136
143
  }
137
- async formateFlowConnectionId(flows, connectionIdMap) {
138
- // replace connection_id with flow connection names
139
- await Promise.all(flows.map(async (flow) => {
140
- const flowConnetions = (0, utils_1.findKeyPathWithValue)(flow, 'connection_id');
141
- await Promise.all(flowConnetions.map(async (f) => {
142
- const connectionId = (dot_prop_1.default.get(flow, f.path) || '');
143
- const flowConnectionName = connectionIdMap[connectionId];
144
- if (!flowConnectionName) {
145
- logger_1.default.warn(`Flow connection: ${connectionId} not found for flow:${flow.name}, please verify the flow connection id.`);
144
+ getAllFlowConnections() {
145
+ return __awaiter(this, void 0, void 0, function* () {
146
+ const allFlowConnections = [];
147
+ // paginate without paginate<T> helper as this is not getAll but getAllConnections
148
+ // paginate through all flow connections
149
+ let page = 0;
150
+ while (true) {
151
+ const { data: { connections, total }, } = yield this.client.flows.getAllConnections({
152
+ page: page,
153
+ per_page: 100,
154
+ include_totals: true,
155
+ });
156
+ // if we get an unexpected response, break the loop to avoid infinite loop
157
+ if (!(0, lodash_1.isArray)(allFlowConnections) || typeof total !== 'number') {
158
+ break;
146
159
  }
147
- else {
148
- dot_prop_1.default.set(flow, f.path, flowConnectionName);
160
+ allFlowConnections.push(...connections);
161
+ page += 1;
162
+ if (allFlowConnections.length === total) {
163
+ break;
149
164
  }
150
- }));
151
- return flow;
152
- }));
153
- return flows;
165
+ }
166
+ return allFlowConnections;
167
+ });
154
168
  }
155
- async pargeFlowConnectionName(flows, connectionNameMap) {
156
- // replace connection_id with flow connection names
157
- const parsedFlows = await Promise.all(flows.map(async (flow) => {
158
- const flowConnetions = (0, utils_1.findKeyPathWithValue)(flow, 'connection_id');
159
- await Promise.all(flowConnetions.map(async (f) => {
160
- const connectionName = (dot_prop_1.default.get(flow, f.path) || '');
161
- const flowConnectionId = connectionNameMap[connectionName];
162
- if (!flowConnectionId) {
163
- logger_1.default.error(`Flow connection: ${flowConnectionId} not found for flow:${flow.name}, please verify the flow connection name.`);
164
- }
165
- else {
166
- dot_prop_1.default.set(flow, f.path, flowConnectionId);
167
- }
168
- }));
169
- return flow;
170
- }));
171
- return parsedFlows;
169
+ formateFlowConnectionId(flows, connectionIdMap) {
170
+ return __awaiter(this, void 0, void 0, function* () {
171
+ // replace connection_id with flow connection names
172
+ yield Promise.all(flows.map((flow) => __awaiter(this, void 0, void 0, function* () {
173
+ const flowConnetions = (0, utils_1.findKeyPathWithValue)(flow, 'connection_id');
174
+ yield Promise.all(flowConnetions.map((f) => __awaiter(this, void 0, void 0, function* () {
175
+ const connectionId = (dot_prop_1.default.get(flow, f.path) || '');
176
+ const flowConnectionName = connectionIdMap[connectionId];
177
+ if (!flowConnectionName) {
178
+ logger_1.default.warn(`Flow connection: ${connectionId} not found for flow:${flow.name}, please verify the flow connection id.`);
179
+ }
180
+ else {
181
+ dot_prop_1.default.set(flow, f.path, flowConnectionName);
182
+ }
183
+ })));
184
+ return flow;
185
+ })));
186
+ return flows;
187
+ });
188
+ }
189
+ pargeFlowConnectionName(flows, connectionNameMap) {
190
+ return __awaiter(this, void 0, void 0, function* () {
191
+ // replace connection_id with flow connection names
192
+ const parsedFlows = yield Promise.all(flows.map((flow) => __awaiter(this, void 0, void 0, function* () {
193
+ const flowConnetions = (0, utils_1.findKeyPathWithValue)(flow, 'connection_id');
194
+ yield Promise.all(flowConnetions.map((f) => __awaiter(this, void 0, void 0, function* () {
195
+ const connectionName = (dot_prop_1.default.get(flow, f.path) || '');
196
+ const flowConnectionId = connectionNameMap[connectionName];
197
+ if (!flowConnectionId) {
198
+ logger_1.default.error(`Flow connection: ${flowConnectionId} not found for flow:${flow.name}, please verify the flow connection name.`);
199
+ }
200
+ else {
201
+ dot_prop_1.default.set(flow, f.path, flowConnectionId);
202
+ }
203
+ })));
204
+ return flow;
205
+ })));
206
+ return parsedFlows;
207
+ });
172
208
  }
173
209
  }
174
210
  exports.default = FlowHandler;
175
211
  __decorate([
176
212
  (0, default_1.order)('80')
177
213
  ], FlowHandler.prototype, "processChanges", null);
214
+ //# sourceMappingURL=flows.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flows.js","sourceRoot":"","sources":["../../../../src/tools/auth0/handlers/flows.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAA0C;AAM1C,wDAA+B;AAC/B,qDAAkD;AAElD,sCAAqC;AACrC,6DAAkC;AAClC,0CAAsD;AAOzC,QAAA,MAAM,GAAG;IACpB,IAAI,EAAE,OAAO;IACb,KAAK,EAAE;QACL,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YACxB,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;SACzB;QACD,QAAQ,EAAE,CAAC,MAAM,CAAC;KACnB;IACD,oBAAoB,EAAE,KAAK;CAC5B,CAAC;AAEF,MAAqB,WAAY,SAAQ,iBAAc;IAGrD,YAAY,OAAuB;QACjC,KAAK,iCACA,OAAO,KACV,IAAI,EAAE,OAAO,EACb,EAAE,EAAE,IAAI,EACR,iBAAiB,EAAE,CAAC,YAAY,EAAE,YAAY,EAAE,aAAa,CAAC,EAC9D,iBAAiB,EAAE,CAAC,YAAY,EAAE,YAAY,EAAE,aAAa,CAAC,IAC9D,CAAC;IACL,CAAC;IAED,SAAS,CAAC,IAAI;QACZ,OAAO,KAAK,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IAC3D,CAAC;IAEK,QAAQ,CAAC,KAA2C;;YACxD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC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CAAC;gBACH,CAAC,CAAA,CAAC,CACH,CAAC;gBACF,OAAO,IAAI,CAAC;YACd,CAAC,CAAA,CAAC,CACH,CAAC;YAEF,OAAO,KAAK,CAAC;QACf,CAAC;KAAA;IAEK,uBAAuB,CAAC,KAAK,EAAE,iBAAiB;;YACpD,mDAAmD;YACnD,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC,GAAG,CACnC,KAAK,CAAC,GAAG,CAAC,CAAO,IAAI,EAAE,EAAE;gBACvB,MAAM,cAAc,GAAG,IAAA,4BAAoB,EAAC,IAAI,EAAE,eAAe,CAAC,CAAC;gBACnE,MAAM,OAAO,CAAC,GAAG,CACf,cAAc,CAAC,GAAG,CAAC,CAAO,CAAC,EAAE,EAAE;oBAC7B,MAAM,cAAc,GAAG,CAAC,kBAAO,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAW,CAAC;oBACnE,MAAM,gBAAgB,GAAG,iBAAiB,CAAC,cAAc,CAAC,CAAC;oBAC3D,IAAI,CAAC,gBAAgB,EAAE,CAAC;wBACtB,gBAAG,CAAC,KAAK,CACP,oBAAoB,gBAAgB,uBAAuB,IAAI,CAAC,IAAI,2CAA2C,CAChH,CAAC;oBACJ,CAAC;yBAAM,CAAC;wBACN,kBAAO,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;oBAC9C,CAAC;gBACH,CAAC,CAAA,CAAC,CACH,CAAC;gBACF,OAAO,IAAI,CAAC;YACd,CAAC,CAAA,CAAC,CACH,CAAC;YAEF,OAAO,WAAW,CAAC;QACrB,CAAC;KAAA;CACF;AAxKD,8BAwKC;AA7GO;IADL,IAAA,eAAK,EAAC,IAAI,CAAC;iDA6BX"}
@@ -1,11 +1,11 @@
1
- import { Management } from 'auth0';
1
+ import { PostForms201Response } from 'auth0';
2
2
  import DefaultHandler from './default';
3
3
  import { Asset, Assets } from '../../../types';
4
4
  export type Form = {
5
5
  name: string;
6
6
  body: string;
7
7
  };
8
- export type FormResponse = Management.GetFormResponseContent;
8
+ export type FormResponse = PostForms201Response;
9
9
  export declare const schema: {
10
10
  type: string;
11
11
  items: {
@@ -26,7 +26,7 @@ export default class FormsHandler extends DefaultHandler {
26
26
  existing: Asset;
27
27
  constructor(options: DefaultHandler);
28
28
  objString(item: any): string;
29
- getForms(forms: Array<Management.FormSummary>): Promise<Management.GetFormResponseContent[]>;
29
+ getForms(forms: Array<PostForms201Response>): Promise<PostForms201Response[]>;
30
30
  getType(): Promise<Asset>;
31
31
  formateFormFlowId(forms: any, flowIdMap: any): Promise<Asset>;
32
32
  pargeFormFlowName(forms: any, flowNameMap: any): Promise<Form[]>;
@@ -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
  };
@@ -63,115 +72,119 @@ exports.schema = {
63
72
  };
64
73
  class FormsHandler extends default_1.default {
65
74
  constructor(options) {
66
- super({
67
- ...options,
68
- type: 'forms',
69
- id: 'id',
70
- stripCreateFields: ['created_at', 'updated_at', 'submitted_at', 'embedded_at'],
71
- stripUpdateFields: ['created_at', 'updated_at', 'submitted_at', 'embedded_at'],
72
- functions: {
73
- update: async ({ id }, bodyParams) => this.client.forms.update(id, bodyParams),
74
- },
75
- });
75
+ super(Object.assign(Object.assign({}, options), { type: 'forms', id: 'id', stripCreateFields: ['created_at', 'updated_at', 'submitted_at', 'embedded_at'], stripUpdateFields: ['created_at', 'updated_at', 'submitted_at', 'embedded_at'] }));
76
76
  }
77
77
  objString(item) {
78
78
  return super.objString({ id: item.id, name: item.name });
79
79
  }
80
- async getForms(forms) {
81
- const allForms = await this.client.pool
82
- .addEachTask({
83
- data: forms,
84
- generator: ({ id }) => this.client.forms.get(id).then((response) => {
85
- if ((0, lodash_1.isEmpty)(response))
86
- return null;
87
- return response;
88
- }),
89
- })
90
- .promise();
91
- return allForms.filter((form) => form !== null);
80
+ getForms(forms) {
81
+ return __awaiter(this, void 0, void 0, function* () {
82
+ const allForms = yield this.client.pool
83
+ .addEachTask({
84
+ data: forms,
85
+ generator: ({ id }) => this.client.forms.get({ id: id }).then((response) => {
86
+ if ((0, lodash_1.isEmpty)(response === null || response === void 0 ? void 0 : response.data))
87
+ return null;
88
+ return response.data;
89
+ }),
90
+ })
91
+ .promise();
92
+ return allForms.filter((form) => form !== null);
93
+ });
92
94
  }
93
- async getType() {
94
- if (this.existing) {
95
+ getType() {
96
+ return __awaiter(this, void 0, void 0, function* () {
97
+ if (this.existing) {
98
+ return this.existing;
99
+ }
100
+ const [forms, flows] = yield Promise.all([
101
+ (0, client_1.paginate)(this.client.forms.getAll, {
102
+ paginate: true,
103
+ include_totals: true,
104
+ }),
105
+ (0, client_1.paginate)(this.client.flows.getAll, {
106
+ paginate: true,
107
+ include_totals: true,
108
+ }),
109
+ ]);
110
+ // get more details for each form
111
+ const allForms = yield this.getForms(forms);
112
+ // create a map for id to name from allFlows
113
+ const flowIdMap = {};
114
+ flows.forEach((f) => {
115
+ flowIdMap[f.id] = f.name;
116
+ });
117
+ this.existing = yield this.formateFormFlowId(allForms, flowIdMap);
95
118
  return this.existing;
96
- }
97
- const [forms, flows] = await Promise.all([
98
- (0, client_1.paginate)(this.client.forms.list, {
99
- paginate: true,
100
- }),
101
- (0, client_1.paginate)(this.client.flows.list, {
102
- paginate: true,
103
- }),
104
- ]);
105
- // get more details for each form
106
- const allForms = await this.getForms(forms);
107
- // create a map for id to name from allFlows
108
- const flowIdMap = {};
109
- flows.forEach((f) => {
110
- flowIdMap[f.id] = f.name;
111
119
  });
112
- this.existing = await this.formateFormFlowId(allForms, flowIdMap);
113
- return this.existing;
114
120
  }
115
- async formateFormFlowId(forms, flowIdMap) {
116
- // replace flow_id with flow names
117
- await Promise.all(forms.map(async (form) => {
118
- const flows = (0, utils_1.findKeyPathWithValue)(form, 'flow_id');
119
- await Promise.all(flows.map(async (f) => {
120
- const flowId = (dot_prop_1.default.get(form, f.path) || '');
121
- const flowName = flowIdMap[flowId];
122
- if (!flowName) {
123
- logger_1.default.warn(`Flow: ${flowId} not found for form:${form.name}, please verify the flow id.`);
124
- }
125
- else {
126
- dot_prop_1.default.set(form, f.path, flowName);
127
- }
128
- }));
129
- return form;
130
- }));
131
- return forms;
132
- }
133
- async pargeFormFlowName(forms, flowNameMap) {
134
- // replace flow names with flow_id
135
- await Promise.all(forms.map(async (form) => {
136
- const flows = (0, utils_1.findKeyPathWithValue)(form, 'flow_id');
137
- await Promise.all(flows.map(async (f) => {
138
- const flowName = (dot_prop_1.default.get(form, f.path) || '');
139
- const flowId = flowNameMap[flowName];
140
- if (!flowId) {
141
- logger_1.default.error(`Flow: ${flowName} not found for form:${form.name}, please verify the flow name.`);
142
- }
143
- else {
144
- dot_prop_1.default.set(form, f.path, flowNameMap[flowName]);
145
- }
146
- }));
147
- return form;
148
- }));
149
- return forms;
121
+ formateFormFlowId(forms, flowIdMap) {
122
+ return __awaiter(this, void 0, void 0, function* () {
123
+ // replace flow_id with flow names
124
+ yield Promise.all(forms.map((form) => __awaiter(this, void 0, void 0, function* () {
125
+ const flows = (0, utils_1.findKeyPathWithValue)(form, 'flow_id');
126
+ yield Promise.all(flows.map((f) => __awaiter(this, void 0, void 0, function* () {
127
+ const flowId = (dot_prop_1.default.get(form, f.path) || '');
128
+ const flowName = flowIdMap[flowId];
129
+ if (!flowName) {
130
+ logger_1.default.warn(`Flow: ${flowId} not found for form:${form.name}, please verify the flow id.`);
131
+ }
132
+ else {
133
+ dot_prop_1.default.set(form, f.path, flowName);
134
+ }
135
+ })));
136
+ return form;
137
+ })));
138
+ return forms;
139
+ });
150
140
  }
151
- async processChanges(assets) {
152
- const { forms } = assets;
153
- // Do nothing if not set
154
- if (!forms)
155
- return;
156
- const flows = await (0, client_1.paginate)(this.client.flows.list, {
157
- paginate: true,
158
- include_totals: true,
141
+ pargeFormFlowName(forms, flowNameMap) {
142
+ return __awaiter(this, void 0, void 0, function* () {
143
+ // replace flow names with flow_id
144
+ yield Promise.all(forms.map((form) => __awaiter(this, void 0, void 0, function* () {
145
+ const flows = (0, utils_1.findKeyPathWithValue)(form, 'flow_id');
146
+ yield Promise.all(flows.map((f) => __awaiter(this, void 0, void 0, function* () {
147
+ const flowName = (dot_prop_1.default.get(form, f.path) || '');
148
+ const flowId = flowNameMap[flowName];
149
+ if (!flowId) {
150
+ logger_1.default.error(`Flow: ${flowName} not found for form:${form.name}, please verify the flow name.`);
151
+ }
152
+ else {
153
+ dot_prop_1.default.set(form, f.path, flowNameMap[flowName]);
154
+ }
155
+ })));
156
+ return form;
157
+ })));
158
+ return forms;
159
159
  });
160
- // create a map for id to name from flows
161
- const flowNamMap = {};
162
- flows.forEach((f) => {
163
- flowNamMap[f.name] = f.id;
160
+ }
161
+ processChanges(assets) {
162
+ const _super = Object.create(null, {
163
+ processChanges: { get: () => super.processChanges }
164
164
  });
165
- assets.forms = await this.pargeFormFlowName(forms, flowNamMap);
166
- const { del, update, create, conflicts } = await this.calcChanges(assets);
167
- const changes = {
168
- del: del,
169
- update: update,
170
- create: create,
171
- conflicts: conflicts,
172
- };
173
- await super.processChanges(assets, {
174
- ...changes,
165
+ return __awaiter(this, void 0, void 0, function* () {
166
+ const { forms } = assets;
167
+ // Do nothing if not set
168
+ if (!forms)
169
+ return;
170
+ const flows = yield (0, client_1.paginate)(this.client.flows.getAll, {
171
+ paginate: true,
172
+ include_totals: true,
173
+ });
174
+ // create a map for id to name from flows
175
+ const flowNamMap = {};
176
+ flows.forEach((f) => {
177
+ flowNamMap[f.name] = f.id;
178
+ });
179
+ assets.forms = yield this.pargeFormFlowName(forms, flowNamMap);
180
+ const { del, update, create, conflicts } = yield this.calcChanges(assets);
181
+ const changes = {
182
+ del: del,
183
+ update: update,
184
+ create: create,
185
+ conflicts: conflicts,
186
+ };
187
+ yield _super.processChanges.call(this, assets, Object.assign({}, changes));
175
188
  });
176
189
  }
177
190
  }
@@ -179,3 +192,4 @@ exports.default = FormsHandler;
179
192
  __decorate([
180
193
  (0, default_1.order)('90')
181
194
  ], FormsHandler.prototype, "processChanges", null);
195
+ //# sourceMappingURL=forms.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forms.js","sourceRoot":"","sources":["../../../../src/tools/auth0/handlers/forms.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,wDAA+B;AAC/B,mCAAiC;AACjC,qDAAkD;AAClD,6DAAkC;AAElC,sCAAqC;AACrC,0CAAsD;AASzC,QAAA,MAAM,GAAG;IACpB,IAAI,EAAE,OAAO;IACb,KAAK,EAAE;QACL,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YACxB,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;SACzB;QACD,QAAQ,EAAE,CAAC,MAAM,CAAC;KACnB;IACD,oBAAoB,EAAE,KAAK;CAC5B,CAAC;AAEF,MAAqB,YAAa,SAAQ,iBAAc;IAGtD,YAAY,OAAuB;QACjC,KAAK,iCACA,OAAO,KACV,IAAI,EAAE,OAAO,EACb,EAAE,EAAE,IAAI,EACR,iBAAiB,EAAE,CAAC,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,CA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