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,24 +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
- var __rest = (this && this.__rest) || function (s, e) {
12
- var t = {};
13
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
- t[p] = s[p];
15
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
- t[p[i]] = s[p[i]];
19
- }
20
- return t;
21
- };
22
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
23
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
24
4
  };
@@ -46,76 +26,73 @@ exports.schema = {
46
26
  };
47
27
  class GuardianFactorProvidersHandler extends default_1.default {
48
28
  constructor(options) {
49
- super(Object.assign(Object.assign({}, options), { type: 'guardianFactorProviders', id: 'name' }));
50
- }
51
- getType() {
52
- return __awaiter(this, void 0, void 0, function* () {
53
- if (this.existing)
54
- return this.existing;
55
- try {
56
- const data = yield Promise.all(mappings.map((m) => __awaiter(this, void 0, void 0, function* () {
57
- let provider;
58
- // TODO: This is quite a change, needs to be validated for sure.
59
- if (m.name === 'phone' && m.provider === 'twilio') {
60
- provider = yield this.client.guardian.getPhoneFactorProviderTwilio();
61
- }
62
- else if (m.name === 'sms' && m.provider === 'twilio') {
63
- provider = yield this.client.guardian.getSmsFactorProviderTwilio();
64
- }
65
- else if (m.name === 'push-notification' && m.provider === 'apns') {
66
- provider = yield this.client.guardian.getPushNotificationProviderAPNS();
67
- }
68
- else if (m.name === 'push-notification' && m.provider === 'sns') {
69
- provider = yield this.client.guardian.getPushNotificationProviderSNS();
70
- }
71
- return Object.assign(Object.assign({}, m), provider.data);
72
- })));
73
- // Filter out empty, should have more then 2 keys (name, provider)
74
- return data.filter((d) => Object.keys(d).length > 2);
75
- }
76
- catch (err) {
77
- if (err.statusCode === 404 || err.statusCode === 501) {
78
- return null;
79
- }
80
- if ((0, utils_1.isForbiddenFeatureError)(err, this.type)) {
81
- return null;
82
- }
83
- throw err;
84
- }
29
+ super({
30
+ ...options,
31
+ type: 'guardianFactorProviders',
32
+ id: 'name',
85
33
  });
86
34
  }
87
- processChanges(assets) {
88
- return __awaiter(this, void 0, void 0, function* () {
89
- // No API to delete or create guardianFactorProviders, we can only update.
90
- const { guardianFactorProviders } = assets;
91
- // Do nothing if not set
92
- if (!guardianFactorProviders || !guardianFactorProviders.length)
93
- return;
94
- // Process each factor
95
- yield Promise.all(guardianFactorProviders.map((factorProvider) => __awaiter(this, void 0, void 0, function* () {
96
- const { name, provider } = factorProvider, data = __rest(factorProvider, ["name", "provider"]);
97
- const params = { name: factorProvider.name, provider: factorProvider.provider };
98
- // TODO: This is quite a change, needs to be validated for sure.
99
- if (name === 'phone' && provider === 'twilio') {
100
- yield this.client.guardian.updatePhoneFactorProviderTwilio(data);
35
+ async getType() {
36
+ if (this.existing)
37
+ return this.existing;
38
+ try {
39
+ const data = await Promise.all(mappings.map(async (m) => {
40
+ let provider;
41
+ if (m.name === 'phone' && m.provider === 'twilio') {
42
+ provider = await this.client.guardian.factors.phone.getTwilioProvider();
101
43
  }
102
- else if (name === 'sms' && provider === 'twilio') {
103
- yield this.client.guardian.setSmsFactorProviderTwilio(data);
44
+ else if (m.name === 'sms' && m.provider === 'twilio') {
45
+ provider = await this.client.guardian.factors.sms.getTwilioProvider();
104
46
  }
105
- else if (name === 'push-notification' && provider === 'apns') {
106
- yield this.client.guardian.updatePushNotificationProviderAPNS(data);
47
+ else if (m.name === 'push-notification' && m.provider === 'apns') {
48
+ provider = await this.client.guardian.factors.pushNotification.getApnsProvider();
107
49
  }
108
- else if (name === 'push-notification' && provider === 'fcm') {
109
- yield this.client.guardian.updatePushNotificationProviderFCM(data);
50
+ else if (m.name === 'push-notification' && m.provider === 'sns') {
51
+ provider = await this.client.guardian.factors.pushNotification.getSnsProvider();
110
52
  }
111
- else if (name === 'push-notification' && provider === 'sns') {
112
- yield this.client.guardian.updatePushNotificationProviderSNS(data);
113
- }
114
- this.didUpdate(params);
115
- this.updated += 1;
116
- })));
117
- });
53
+ return { ...m, ...provider.data };
54
+ }));
55
+ // Filter out empty, should have more then 2 keys (name, provider)
56
+ return data.filter((d) => Object.keys(d).length > 2);
57
+ }
58
+ catch (err) {
59
+ if (err.statusCode === 404 || err.statusCode === 501) {
60
+ return null;
61
+ }
62
+ if ((0, utils_1.isForbiddenFeatureError)(err, this.type)) {
63
+ return null;
64
+ }
65
+ throw err;
66
+ }
67
+ }
68
+ async processChanges(assets) {
69
+ // No API to delete or create guardianFactorProviders, we can only update.
70
+ const { guardianFactorProviders } = assets;
71
+ // Do nothing if not set
72
+ if (!guardianFactorProviders || !guardianFactorProviders.length)
73
+ return;
74
+ // Process each factor
75
+ await Promise.all(guardianFactorProviders.map(async (factorProvider) => {
76
+ const { name, provider, ...data } = factorProvider;
77
+ const params = { name: factorProvider.name, provider: factorProvider.provider };
78
+ if (name === 'phone' && provider === 'twilio') {
79
+ await this.client.guardian.factors.phone.setTwilioProvider(data);
80
+ }
81
+ else if (name === 'sms' && provider === 'twilio') {
82
+ await this.client.guardian.factors.sms.setTwilioProvider(data);
83
+ }
84
+ else if (name === 'push-notification' && provider === 'apns') {
85
+ await this.client.guardian.factors.pushNotification.setApnsProvider(data);
86
+ }
87
+ else if (name === 'push-notification' && provider === 'fcm') {
88
+ await this.client.guardian.factors.pushNotification.setFcmProvider(data);
89
+ }
90
+ else if (name === 'push-notification' && provider === 'sns') {
91
+ await this.client.guardian.factors.pushNotification.setSnsProvider(data);
92
+ }
93
+ this.didUpdate(params);
94
+ this.updated += 1;
95
+ }));
118
96
  }
119
97
  }
120
98
  exports.default = GuardianFactorProvidersHandler;
121
- //# sourceMappingURL=guardianFactorProviders.js.map
@@ -1,24 +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
- var __rest = (this && this.__rest) || function (s, e) {
12
- var t = {};
13
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
- t[p] = s[p];
15
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
- t[p[i]] = s[p[i]];
19
- }
20
- return t;
21
- };
22
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
23
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
24
4
  };
@@ -39,58 +19,56 @@ exports.schema = {
39
19
  };
40
20
  class GuardianFactorTemplatesHandler extends default_1.default {
41
21
  constructor(options) {
42
- super(Object.assign(Object.assign({}, options), { type: 'guardianFactorTemplates', id: 'name' }));
43
- }
44
- getType() {
45
- return __awaiter(this, void 0, void 0, function* () {
46
- if (this.existing)
47
- return this.existing;
48
- try {
49
- const data = yield Promise.all(constants_1.default.GUARDIAN_FACTOR_TEMPLATES.map((name) => __awaiter(this, void 0, void 0, function* () {
50
- if (name === 'sms') {
51
- const { data: templates } = yield this.client.guardian.getSmsFactorTemplates();
52
- return Object.assign({ name }, templates);
53
- }
54
- const { data: templates } = yield this.client.guardian.getPhoneFactorTemplates();
55
- return Object.assign({ name }, templates);
56
- })));
57
- // Filter out empty, should have more then 1 keys (name)
58
- return data.filter((d) => Object.keys(d).length > 1);
59
- }
60
- catch (err) {
61
- if (err.statusCode === 404 || err.statusCode === 501) {
62
- return null;
63
- }
64
- if ((0, utils_1.isForbiddenFeatureError)(err, this.type)) {
65
- return null;
66
- }
67
- throw err;
68
- }
22
+ super({
23
+ ...options,
24
+ type: 'guardianFactorTemplates',
25
+ id: 'name',
69
26
  });
70
27
  }
71
- processChanges(assets) {
72
- return __awaiter(this, void 0, void 0, function* () {
73
- // No API to delete or create guardianFactorTemplates, we can only update.
74
- const { guardianFactorTemplates } = assets;
75
- // Do nothing if not set
76
- if (!guardianFactorTemplates || !guardianFactorTemplates.length)
77
- return;
78
- // Process each factor templates
79
- yield Promise.all(guardianFactorTemplates.map((fatorTemplates) => __awaiter(this, void 0, void 0, function* () {
80
- const { name } = fatorTemplates, data = __rest(fatorTemplates, ["name"]);
81
- const params = { name: fatorTemplates.name };
82
- // TODO: This is quite a change, needs to be validated for sure.
28
+ async getType() {
29
+ if (this.existing)
30
+ return this.existing;
31
+ try {
32
+ const data = await Promise.all(constants_1.default.GUARDIAN_FACTOR_TEMPLATES.map(async (name) => {
83
33
  if (name === 'sms') {
84
- yield this.client.guardian.setSmsFactorTemplates(data);
85
- }
86
- else if (name === 'phone') {
87
- yield this.client.guardian.setPhoneFactorTemplates(data);
34
+ const templates = await this.client.guardian.factors.sms.getTemplates();
35
+ return { name, ...templates };
88
36
  }
89
- this.didUpdate(params);
90
- this.updated += 1;
91
- })));
92
- });
37
+ const templates = await this.client.guardian.factors.phone.getTemplates();
38
+ return { name, ...templates };
39
+ }));
40
+ // Filter out empty, should have more then 1 keys (name)
41
+ return data.filter((d) => Object.keys(d).length > 1);
42
+ }
43
+ catch (err) {
44
+ if (err.statusCode === 404 || err.statusCode === 501) {
45
+ return null;
46
+ }
47
+ if ((0, utils_1.isForbiddenFeatureError)(err, this.type)) {
48
+ return null;
49
+ }
50
+ throw err;
51
+ }
52
+ }
53
+ async processChanges(assets) {
54
+ // No API to delete or create guardianFactorTemplates, we can only update.
55
+ const { guardianFactorTemplates } = assets;
56
+ // Do nothing if not set
57
+ if (!guardianFactorTemplates || !guardianFactorTemplates.length)
58
+ return;
59
+ // Process each factor templates
60
+ await Promise.all(guardianFactorTemplates.map(async (fatorTemplates) => {
61
+ const { name, ...data } = fatorTemplates;
62
+ const params = { name: fatorTemplates.name };
63
+ if (name === 'sms') {
64
+ await this.client.guardian.factors.sms.setTemplates(data);
65
+ }
66
+ else if (name === 'phone') {
67
+ await this.client.guardian.factors.phone.setTemplates(data);
68
+ }
69
+ this.didUpdate(params);
70
+ this.updated += 1;
71
+ }));
93
72
  }
94
73
  }
95
74
  exports.default = GuardianFactorTemplatesHandler;
96
- //# sourceMappingURL=guardianFactorTemplates.js.map
@@ -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,46 +19,45 @@ exports.schema = {
28
19
  };
29
20
  class GuardianFactorsHandler extends default_1.default {
30
21
  constructor(options) {
31
- super(Object.assign(Object.assign({}, options), { type: 'guardianFactors', id: 'name' }));
22
+ super({
23
+ ...options,
24
+ type: 'guardianFactors',
25
+ id: 'name',
26
+ });
32
27
  }
33
- getType() {
34
- return __awaiter(this, void 0, void 0, function* () {
35
- if (this.existing)
36
- return this.existing;
37
- try {
38
- const { data } = yield this.client.guardian.getFactors();
39
- this.existing = data;
40
- return this.existing;
28
+ async getType() {
29
+ if (this.existing)
30
+ return this.existing;
31
+ try {
32
+ const factors = await this.client.guardian.factors.list();
33
+ this.existing = factors;
34
+ return this.existing;
35
+ }
36
+ catch (err) {
37
+ if (err.statusCode === 404 || err.statusCode === 501) {
38
+ return null;
41
39
  }
42
- catch (err) {
43
- if (err.statusCode === 404 || err.statusCode === 501) {
44
- return null;
45
- }
46
- if ((0, utils_1.isForbiddenFeatureError)(err, this.type)) {
47
- return null;
48
- }
49
- throw err;
40
+ if ((0, utils_1.isForbiddenFeatureError)(err, this.type)) {
41
+ return null;
50
42
  }
51
- });
43
+ throw err;
44
+ }
52
45
  }
53
- processChanges(assets) {
54
- return __awaiter(this, void 0, void 0, function* () {
55
- // No API to delete or create guardianFactors, we can only update.
56
- const { guardianFactors } = assets;
57
- // Do nothing if not set
58
- if (!guardianFactors || !guardianFactors.length)
59
- return;
60
- // Process each factor
61
- yield Promise.all(guardianFactors.map((factor) => __awaiter(this, void 0, void 0, function* () {
62
- const data = Object.assign({}, factor);
63
- const params = { name: factor.name };
64
- delete data.name;
65
- yield this.client.guardian.updateFactor(params, data);
66
- this.didUpdate(params);
67
- this.updated += 1;
68
- })));
69
- });
46
+ async processChanges(assets) {
47
+ // No API to delete or create guardianFactors, we can only update.
48
+ const { guardianFactors } = assets;
49
+ // Do nothing if not set
50
+ if (!guardianFactors || !guardianFactors.length)
51
+ return;
52
+ // Process each factor
53
+ await Promise.all(guardianFactors.map(async (factor) => {
54
+ const data = { ...factor };
55
+ const params = { name: factor.name };
56
+ delete data.name;
57
+ await this.client.guardian.factors.set(params.name, data);
58
+ this.didUpdate(params);
59
+ this.updated += 1;
60
+ }));
70
61
  }
71
62
  }
72
63
  exports.default = GuardianFactorsHandler;
73
- //# sourceMappingURL=guardianFactors.js.map
@@ -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
  };
@@ -46,47 +37,40 @@ const isFeatureUnavailableError = (err) => {
46
37
  };
47
38
  class GuardianPhoneMessageTypesHandler extends default_1.default {
48
39
  constructor(options) {
49
- super(Object.assign(Object.assign({}, options), { type: 'guardianPhoneFactorMessageTypes' }));
40
+ super({
41
+ ...options,
42
+ type: 'guardianPhoneFactorMessageTypes',
43
+ });
50
44
  }
51
- getType() {
52
- return __awaiter(this, void 0, void 0, function* () {
53
- // in case client version does not support the operation
54
- if (!this.client.guardian ||
55
- typeof this.client.guardian.getPhoneFactorMessageTypes !== 'function') {
45
+ async getType() {
46
+ if (this.existing)
47
+ return this.existing;
48
+ try {
49
+ const data = await this.client.guardian.factors.phone.getMessageTypes();
50
+ this.existing = data;
51
+ }
52
+ catch (err) {
53
+ if (isFeatureUnavailableError(err)) {
54
+ // Gracefully skip processing this configuration value.
56
55
  return null;
57
56
  }
58
- if (this.existing)
59
- return this.existing;
60
- try {
61
- const { data } = yield this.client.guardian.getPhoneFactorMessageTypes();
62
- this.existing = data;
63
- }
64
- catch (err) {
65
- if (isFeatureUnavailableError(err)) {
66
- // Gracefully skip processing this configuration value.
67
- return null;
68
- }
69
- if ((0, utils_1.isForbiddenFeatureError)(err, this.type)) {
70
- return null;
71
- }
72
- throw err;
57
+ if ((0, utils_1.isForbiddenFeatureError)(err, this.type)) {
58
+ return null;
73
59
  }
74
- return this.existing;
75
- });
60
+ throw err;
61
+ }
62
+ return this.existing;
76
63
  }
77
- processChanges(assets) {
78
- return __awaiter(this, void 0, void 0, function* () {
79
- // No API to delete or create guardianPhoneFactorMessageTypes, we can only update.
80
- const { guardianPhoneFactorMessageTypes } = assets;
81
- // Do nothing if not set
82
- if (!guardianPhoneFactorMessageTypes || !guardianPhoneFactorMessageTypes.message_types)
83
- return;
84
- const data = guardianPhoneFactorMessageTypes;
85
- yield this.client.guardian.updatePhoneFactorMessageTypes(data);
86
- this.updated += 1;
87
- this.didUpdate(guardianPhoneFactorMessageTypes);
88
- });
64
+ async processChanges(assets) {
65
+ // No API to delete or create guardianPhoneFactorMessageTypes, we can only update.
66
+ const { guardianPhoneFactorMessageTypes } = assets;
67
+ // Do nothing if not set
68
+ if (!guardianPhoneFactorMessageTypes || !guardianPhoneFactorMessageTypes.message_types)
69
+ return;
70
+ const data = guardianPhoneFactorMessageTypes;
71
+ await this.client.guardian.factors.phone.setMessageTypes(data);
72
+ this.updated += 1;
73
+ this.didUpdate(guardianPhoneFactorMessageTypes);
89
74
  }
90
75
  }
91
76
  exports.default = GuardianPhoneMessageTypesHandler;
92
- //# sourceMappingURL=guardianPhoneFactorMessageTypes.js.map
@@ -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
  };
@@ -43,47 +34,40 @@ const isFeatureUnavailableError = (err) => {
43
34
  };
44
35
  class GuardianPhoneSelectedProviderHandler extends default_1.default {
45
36
  constructor(options) {
46
- super(Object.assign(Object.assign({}, options), { type: 'guardianPhoneFactorSelectedProvider' }));
37
+ super({
38
+ ...options,
39
+ type: 'guardianPhoneFactorSelectedProvider',
40
+ });
47
41
  }
48
- getType() {
49
- return __awaiter(this, void 0, void 0, function* () {
50
- // in case client version does not support the operation
51
- if (!this.client.guardian ||
52
- typeof this.client.guardian.getPhoneFactorSelectedProvider !== 'function') {
42
+ async getType() {
43
+ if (this.existing)
44
+ return this.existing;
45
+ try {
46
+ const data = await this.client.guardian.factors.phone.getSelectedProvider();
47
+ this.existing = data;
48
+ }
49
+ catch (err) {
50
+ if (isFeatureUnavailableError(err)) {
51
+ // Gracefully skip processing this configuration value.
53
52
  return null;
54
53
  }
55
- if (this.existing)
56
- return this.existing;
57
- try {
58
- const { data } = yield this.client.guardian.getPhoneFactorSelectedProvider();
59
- this.existing = data;
60
- }
61
- catch (err) {
62
- if (isFeatureUnavailableError(err)) {
63
- // Gracefully skip processing this configuration value.
64
- return null;
65
- }
66
- if ((0, utils_1.isForbiddenFeatureError)(err, this.type)) {
67
- return null;
68
- }
69
- throw err;
54
+ if ((0, utils_1.isForbiddenFeatureError)(err, this.type)) {
55
+ return null;
70
56
  }
71
- return this.existing;
72
- });
57
+ throw err;
58
+ }
59
+ return this.existing;
73
60
  }
74
- processChanges(assets) {
75
- return __awaiter(this, void 0, void 0, function* () {
76
- // No API to delete or create guardianPhoneFactorSelectedProvider, we can only update.
77
- const { guardianPhoneFactorSelectedProvider } = assets;
78
- // Do nothing if not set
79
- if (!guardianPhoneFactorSelectedProvider || !guardianPhoneFactorSelectedProvider.provider)
80
- return;
81
- const data = guardianPhoneFactorSelectedProvider;
82
- yield this.client.guardian.updatePhoneFactorSelectedProvider(data);
83
- this.updated += 1;
84
- this.didUpdate(guardianPhoneFactorSelectedProvider);
85
- });
61
+ async processChanges(assets) {
62
+ // No API to delete or create guardianPhoneFactorSelectedProvider, we can only update.
63
+ const { guardianPhoneFactorSelectedProvider } = assets;
64
+ // Do nothing if not set
65
+ if (!guardianPhoneFactorSelectedProvider || !guardianPhoneFactorSelectedProvider.provider)
66
+ return;
67
+ const data = guardianPhoneFactorSelectedProvider;
68
+ await this.client.guardian.factors.phone.setProvider(data);
69
+ this.updated += 1;
70
+ this.didUpdate(guardianPhoneFactorSelectedProvider);
86
71
  }
87
72
  }
88
73
  exports.default = GuardianPhoneSelectedProviderHandler;
89
- //# sourceMappingURL=guardianPhoneFactorSelectedProvider.js.map
@@ -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
  };
@@ -30,35 +21,29 @@ exports.schema = {
30
21
  };
31
22
  class GuardianPoliciesHandler extends default_1.default {
32
23
  constructor(options) {
33
- super(Object.assign(Object.assign({}, options), { type: 'guardianPolicies' }));
24
+ super({
25
+ ...options,
26
+ type: 'guardianPolicies',
27
+ });
34
28
  }
35
- //TODO: standardize empty object literal with more intentional empty indicator
36
- getType() {
37
- return __awaiter(this, void 0, void 0, function* () {
38
- // in case client version does not support the operation
39
- if (!this.client.guardian || typeof this.client.guardian.getPolicies !== 'function') {
40
- return {};
41
- }
42
- if (this.existing)
43
- return this.existing;
44
- const { data: policies } = yield this.client.guardian.getPolicies();
45
- this.existing = { policies };
29
+ // TODO: standardize empty object literal with more intentional empty indicator
30
+ async getType() {
31
+ if (this.existing)
46
32
  return this.existing;
47
- });
33
+ const policies = await this.client.guardian.policies.list();
34
+ this.existing = { policies };
35
+ return this.existing;
48
36
  }
49
- processChanges(assets) {
50
- return __awaiter(this, void 0, void 0, function* () {
51
- // No API to delete or create guardianPolicies, we can only update.
52
- const { guardianPolicies } = assets;
53
- // Do nothing if not set
54
- if (!guardianPolicies || !guardianPolicies.policies)
55
- return;
56
- const data = guardianPolicies.policies;
57
- yield this.client.guardian.updatePolicies(data);
58
- this.updated += 1;
59
- this.didUpdate(guardianPolicies);
60
- });
37
+ async processChanges(assets) {
38
+ // No API to delete or create guardianPolicies, we can only update.
39
+ const { guardianPolicies } = assets;
40
+ // Do nothing if not set
41
+ if (!guardianPolicies || !guardianPolicies.policies)
42
+ return;
43
+ const data = guardianPolicies.policies;
44
+ await this.client.guardian.policies.set(data);
45
+ this.updated += 1;
46
+ this.didUpdate(guardianPolicies);
61
47
  }
62
48
  }
63
49
  exports.default = GuardianPoliciesHandler;
64
- //# sourceMappingURL=guardianPolicies.js.map