auth0-deploy-cli 8.20.2 → 8.20.4-beta.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 (309) hide show
  1. package/.circleci/config.yml +46 -5
  2. package/CHANGELOG.md +17 -1
  3. package/eslint.config.js +130 -0
  4. package/lib/args.js +0 -1
  5. package/lib/commands/export.js +41 -49
  6. package/lib/commands/import.js +36 -43
  7. package/lib/commands/index.js +0 -1
  8. package/lib/configFactory.js +0 -1
  9. package/lib/context/defaults.js +38 -10
  10. package/lib/context/directory/handlers/actions.js +40 -39
  11. package/lib/context/directory/handlers/attackProtection.js +22 -34
  12. package/lib/context/directory/handlers/branding.js +12 -21
  13. package/lib/context/directory/handlers/clientGrants.js +52 -62
  14. package/lib/context/directory/handlers/clients.js +17 -29
  15. package/lib/context/directory/handlers/connections.js +32 -41
  16. package/lib/context/directory/handlers/customDomains.js +9 -21
  17. package/lib/context/directory/handlers/databases.js +37 -35
  18. package/lib/context/directory/handlers/emailProvider.js +22 -36
  19. package/lib/context/directory/handlers/emailTemplates.js +20 -29
  20. package/lib/context/directory/handlers/flowVaultConnections.js +39 -49
  21. package/lib/context/directory/handlers/flows.js +38 -48
  22. package/lib/context/directory/handlers/forms.js +38 -48
  23. package/lib/context/directory/handlers/guardianFactorProviders.js +9 -21
  24. package/lib/context/directory/handlers/guardianFactorTemplates.js +9 -21
  25. package/lib/context/directory/handlers/guardianFactors.js +9 -21
  26. package/lib/context/directory/handlers/guardianPhoneFactorMessageTypes.js +8 -20
  27. package/lib/context/directory/handlers/guardianPhoneFactorSelectedProvider.js +8 -20
  28. package/lib/context/directory/handlers/guardianPolicies.js +8 -20
  29. package/lib/context/directory/handlers/hooks.js +24 -34
  30. package/lib/context/directory/handlers/index.js +0 -1
  31. package/lib/context/directory/handlers/logStreams.js +12 -24
  32. package/lib/context/directory/handlers/networkACLs.js +22 -34
  33. package/lib/context/directory/handlers/organizations.js +39 -44
  34. package/lib/context/directory/handlers/pages.js +31 -37
  35. package/lib/context/directory/handlers/phoneProvider.js +12 -24
  36. package/lib/context/directory/handlers/prompts.js +58 -76
  37. package/lib/context/directory/handlers/resourceServers.d.ts +1 -1
  38. package/lib/context/directory/handlers/resourceServers.js +18 -30
  39. package/lib/context/directory/handlers/roles.js +21 -31
  40. package/lib/context/directory/handlers/rules.js +22 -32
  41. package/lib/context/directory/handlers/rulesConfigs.js +3 -15
  42. package/lib/context/directory/handlers/selfServiceProfiles.js +28 -40
  43. package/lib/context/directory/handlers/tenant.js +14 -34
  44. package/lib/context/directory/handlers/themes.js +9 -21
  45. package/lib/context/directory/handlers/triggers.d.ts +1 -1
  46. package/lib/context/directory/handlers/triggers.js +16 -26
  47. package/lib/context/directory/handlers/userAttributeProfiles.d.ts +1 -1
  48. package/lib/context/directory/handlers/userAttributeProfiles.js +16 -26
  49. package/lib/context/directory/index.js +66 -80
  50. package/lib/context/index.js +7 -18
  51. package/lib/context/yaml/handlers/actions.js +39 -41
  52. package/lib/context/yaml/handlers/attackProtection.js +27 -41
  53. package/lib/context/yaml/handlers/branding.js +47 -69
  54. package/lib/context/yaml/handlers/clientGrants.js +26 -40
  55. package/lib/context/yaml/handlers/clients.js +41 -55
  56. package/lib/context/yaml/handlers/connections.js +63 -67
  57. package/lib/context/yaml/handlers/customDomains.js +7 -19
  58. package/lib/context/yaml/handlers/databases.js +63 -65
  59. package/lib/context/yaml/handlers/emailProvider.js +22 -37
  60. package/lib/context/yaml/handlers/emailTemplates.js +28 -39
  61. package/lib/context/yaml/handlers/flowVaultConnections.js +36 -50
  62. package/lib/context/yaml/handlers/flows.js +55 -66
  63. package/lib/context/yaml/handlers/forms.js +55 -66
  64. package/lib/context/yaml/handlers/guardianFactorProviders.js +7 -19
  65. package/lib/context/yaml/handlers/guardianFactorTemplates.js +7 -19
  66. package/lib/context/yaml/handlers/guardianFactors.js +7 -19
  67. package/lib/context/yaml/handlers/guardianPhoneFactorMessageTypes.js +7 -19
  68. package/lib/context/yaml/handlers/guardianPhoneFactorSelectedProvider.js +7 -19
  69. package/lib/context/yaml/handlers/guardianPolicies.js +7 -19
  70. package/lib/context/yaml/handlers/hooks.js +34 -48
  71. package/lib/context/yaml/handlers/index.js +0 -1
  72. package/lib/context/yaml/handlers/logStreams.js +16 -30
  73. package/lib/context/yaml/handlers/networkACLs.js +25 -39
  74. package/lib/context/yaml/handlers/organizations.js +37 -46
  75. package/lib/context/yaml/handlers/pages.js +31 -39
  76. package/lib/context/yaml/handlers/phoneProvider.js +17 -31
  77. package/lib/context/yaml/handlers/prompts.js +22 -47
  78. package/lib/context/yaml/handlers/resourceServers.d.ts +1 -1
  79. package/lib/context/yaml/handlers/resourceServers.js +21 -33
  80. package/lib/context/yaml/handlers/roles.js +19 -33
  81. package/lib/context/yaml/handlers/rules.js +28 -39
  82. package/lib/context/yaml/handlers/rulesConfigs.js +14 -28
  83. package/lib/context/yaml/handlers/selfServiceProfiles.js +29 -43
  84. package/lib/context/yaml/handlers/tenant.js +19 -41
  85. package/lib/context/yaml/handlers/themes.js +7 -19
  86. package/lib/context/yaml/handlers/triggers.d.ts +1 -1
  87. package/lib/context/yaml/handlers/triggers.js +15 -29
  88. package/lib/context/yaml/handlers/userAttributeProfiles.d.ts +1 -1
  89. package/lib/context/yaml/handlers/userAttributeProfiles.js +7 -19
  90. package/lib/context/yaml/index.js +120 -128
  91. package/lib/index.d.ts +4 -95
  92. package/lib/index.js +24 -34
  93. package/lib/keywordPreservation.d.ts +1 -1
  94. package/lib/keywordPreservation.js +10 -6
  95. package/lib/logger.js +0 -1
  96. package/lib/readonly.js +3 -4
  97. package/lib/sessionDurationsToMinutes.js +0 -1
  98. package/lib/tools/auth0/client.js +111 -120
  99. package/lib/tools/auth0/handlers/actions.d.ts +8 -26
  100. package/lib/tools/auth0/handlers/actions.js +138 -149
  101. package/lib/tools/auth0/handlers/attackProtection.js +80 -92
  102. package/lib/tools/auth0/handlers/branding.js +75 -99
  103. package/lib/tools/auth0/handlers/clientGrants.d.ts +2 -8
  104. package/lib/tools/auth0/handlers/clientGrants.js +65 -70
  105. package/lib/tools/auth0/handlers/clients.d.ts +3 -9
  106. package/lib/tools/auth0/handlers/clients.js +59 -63
  107. package/lib/tools/auth0/handlers/connections.d.ts +3 -1
  108. package/lib/tools/auth0/handlers/connections.js +130 -135
  109. package/lib/tools/auth0/handlers/customDomains.d.ts +4 -1
  110. package/lib/tools/auth0/handlers/customDomains.js +43 -53
  111. package/lib/tools/auth0/handlers/databases.js +94 -114
  112. package/lib/tools/auth0/handlers/default.d.ts +2 -2
  113. package/lib/tools/auth0/handlers/default.js +210 -171
  114. package/lib/tools/auth0/handlers/emailProvider.js +41 -52
  115. package/lib/tools/auth0/handlers/emailTemplates.js +49 -71
  116. package/lib/tools/auth0/handlers/flowVaultConnections.d.ts +5 -12
  117. package/lib/tools/auth0/handlers/flowVaultConnections.js +108 -143
  118. package/lib/tools/auth0/handlers/flows.d.ts +2 -3
  119. package/lib/tools/auth0/handlers/flows.js +92 -129
  120. package/lib/tools/auth0/handlers/forms.d.ts +3 -3
  121. package/lib/tools/auth0/handlers/forms.js +98 -112
  122. package/lib/tools/auth0/handlers/guardianFactorProviders.js +61 -84
  123. package/lib/tools/auth0/handlers/guardianFactorTemplates.js +46 -68
  124. package/lib/tools/auth0/handlers/guardianFactors.js +35 -45
  125. package/lib/tools/auth0/handlers/guardianPhoneFactorMessageTypes.js +29 -45
  126. package/lib/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.js +29 -45
  127. package/lib/tools/auth0/handlers/guardianPolicies.js +20 -35
  128. package/lib/tools/auth0/handlers/hooks.js +123 -153
  129. package/lib/tools/auth0/handlers/index.js +0 -1
  130. package/lib/tools/auth0/handlers/logStreams.js +42 -47
  131. package/lib/tools/auth0/handlers/networkACLs.d.ts +5 -4
  132. package/lib/tools/auth0/handlers/networkACLs.js +115 -133
  133. package/lib/tools/auth0/handlers/organizations.d.ts +10 -9
  134. package/lib/tools/auth0/handlers/organizations.js +360 -429
  135. package/lib/tools/auth0/handlers/pages.js +74 -83
  136. package/lib/tools/auth0/handlers/phoneProvider.d.ts +2 -2
  137. package/lib/tools/auth0/handlers/phoneProvider.js +69 -82
  138. package/lib/tools/auth0/handlers/prompts.d.ts +5 -5
  139. package/lib/tools/auth0/handlers/prompts.js +242 -249
  140. package/lib/tools/auth0/handlers/resourceServers.d.ts +3 -1
  141. package/lib/tools/auth0/handlers/resourceServers.js +59 -60
  142. package/lib/tools/auth0/handlers/roles.js +162 -178
  143. package/lib/tools/auth0/handlers/rules.js +144 -162
  144. package/lib/tools/auth0/handlers/rulesConfigs.js +30 -39
  145. package/lib/tools/auth0/handlers/scimHandler.d.ts +4 -3
  146. package/lib/tools/auth0/handlers/scimHandler.js +110 -132
  147. package/lib/tools/auth0/handlers/selfServiceProfiles.d.ts +11 -3
  148. package/lib/tools/auth0/handlers/selfServiceProfiles.js +170 -208
  149. package/lib/tools/auth0/handlers/tenant.d.ts +5 -3
  150. package/lib/tools/auth0/handlers/tenant.js +45 -52
  151. package/lib/tools/auth0/handlers/themes.d.ts +12 -12
  152. package/lib/tools/auth0/handlers/themes.js +86 -102
  153. package/lib/tools/auth0/handlers/triggers.js +59 -75
  154. package/lib/tools/auth0/handlers/userAttributeProfiles.d.ts +3 -2
  155. package/lib/tools/auth0/handlers/userAttributeProfiles.js +54 -56
  156. package/lib/tools/auth0/index.js +35 -48
  157. package/lib/tools/auth0/schema.js +6 -4
  158. package/lib/tools/calculateChanges.js +24 -15
  159. package/lib/tools/constants.d.ts +2 -2
  160. package/lib/tools/constants.js +0 -1
  161. package/lib/tools/deploy.js +17 -29
  162. package/lib/tools/index.d.ts +3 -88
  163. package/lib/tools/index.js +3 -2
  164. package/lib/tools/utils.d.ts +1 -1
  165. package/lib/tools/utils.js +12 -22
  166. package/lib/tools/validationError.js +0 -1
  167. package/lib/types.d.ts +8 -4
  168. package/lib/types.js +0 -1
  169. package/lib/utils.d.ts +3 -57
  170. package/lib/utils.js +8 -5
  171. package/package.json +12 -11
  172. package/tsconfig.json +4 -3
  173. package/.eslintignore +0 -5
  174. package/.eslintrc +0 -69
  175. package/lib/args.js.map +0 -1
  176. package/lib/commands/export.js.map +0 -1
  177. package/lib/commands/import.js.map +0 -1
  178. package/lib/commands/index.js.map +0 -1
  179. package/lib/configFactory.js.map +0 -1
  180. package/lib/context/defaults.js.map +0 -1
  181. package/lib/context/directory/handlers/actions.js.map +0 -1
  182. package/lib/context/directory/handlers/attackProtection.js.map +0 -1
  183. package/lib/context/directory/handlers/branding.js.map +0 -1
  184. package/lib/context/directory/handlers/clientGrants.js.map +0 -1
  185. package/lib/context/directory/handlers/clients.js.map +0 -1
  186. package/lib/context/directory/handlers/connections.js.map +0 -1
  187. package/lib/context/directory/handlers/customDomains.js.map +0 -1
  188. package/lib/context/directory/handlers/databases.js.map +0 -1
  189. package/lib/context/directory/handlers/emailProvider.js.map +0 -1
  190. package/lib/context/directory/handlers/emailTemplates.js.map +0 -1
  191. package/lib/context/directory/handlers/flowVaultConnections.js.map +0 -1
  192. package/lib/context/directory/handlers/flows.js.map +0 -1
  193. package/lib/context/directory/handlers/forms.js.map +0 -1
  194. package/lib/context/directory/handlers/guardianFactorProviders.js.map +0 -1
  195. package/lib/context/directory/handlers/guardianFactorTemplates.js.map +0 -1
  196. package/lib/context/directory/handlers/guardianFactors.js.map +0 -1
  197. package/lib/context/directory/handlers/guardianPhoneFactorMessageTypes.js.map +0 -1
  198. package/lib/context/directory/handlers/guardianPhoneFactorSelectedProvider.js.map +0 -1
  199. package/lib/context/directory/handlers/guardianPolicies.js.map +0 -1
  200. package/lib/context/directory/handlers/hooks.js.map +0 -1
  201. package/lib/context/directory/handlers/index.js.map +0 -1
  202. package/lib/context/directory/handlers/logStreams.js.map +0 -1
  203. package/lib/context/directory/handlers/networkACLs.js.map +0 -1
  204. package/lib/context/directory/handlers/organizations.js.map +0 -1
  205. package/lib/context/directory/handlers/pages.js.map +0 -1
  206. package/lib/context/directory/handlers/phoneProvider.js.map +0 -1
  207. package/lib/context/directory/handlers/prompts.js.map +0 -1
  208. package/lib/context/directory/handlers/resourceServers.js.map +0 -1
  209. package/lib/context/directory/handlers/roles.js.map +0 -1
  210. package/lib/context/directory/handlers/rules.js.map +0 -1
  211. package/lib/context/directory/handlers/rulesConfigs.js.map +0 -1
  212. package/lib/context/directory/handlers/selfServiceProfiles.js.map +0 -1
  213. package/lib/context/directory/handlers/tenant.js.map +0 -1
  214. package/lib/context/directory/handlers/themes.js.map +0 -1
  215. package/lib/context/directory/handlers/triggers.js.map +0 -1
  216. package/lib/context/directory/handlers/userAttributeProfiles.js.map +0 -1
  217. package/lib/context/directory/index.js.map +0 -1
  218. package/lib/context/index.js.map +0 -1
  219. package/lib/context/yaml/handlers/actions.js.map +0 -1
  220. package/lib/context/yaml/handlers/attackProtection.js.map +0 -1
  221. package/lib/context/yaml/handlers/branding.js.map +0 -1
  222. package/lib/context/yaml/handlers/clientGrants.js.map +0 -1
  223. package/lib/context/yaml/handlers/clients.js.map +0 -1
  224. package/lib/context/yaml/handlers/connections.js.map +0 -1
  225. package/lib/context/yaml/handlers/customDomains.js.map +0 -1
  226. package/lib/context/yaml/handlers/databases.js.map +0 -1
  227. package/lib/context/yaml/handlers/emailProvider.js.map +0 -1
  228. package/lib/context/yaml/handlers/emailTemplates.js.map +0 -1
  229. package/lib/context/yaml/handlers/flowVaultConnections.js.map +0 -1
  230. package/lib/context/yaml/handlers/flows.js.map +0 -1
  231. package/lib/context/yaml/handlers/forms.js.map +0 -1
  232. package/lib/context/yaml/handlers/guardianFactorProviders.js.map +0 -1
  233. package/lib/context/yaml/handlers/guardianFactorTemplates.js.map +0 -1
  234. package/lib/context/yaml/handlers/guardianFactors.js.map +0 -1
  235. package/lib/context/yaml/handlers/guardianPhoneFactorMessageTypes.js.map +0 -1
  236. package/lib/context/yaml/handlers/guardianPhoneFactorSelectedProvider.js.map +0 -1
  237. package/lib/context/yaml/handlers/guardianPolicies.js.map +0 -1
  238. package/lib/context/yaml/handlers/hooks.js.map +0 -1
  239. package/lib/context/yaml/handlers/index.js.map +0 -1
  240. package/lib/context/yaml/handlers/logStreams.js.map +0 -1
  241. package/lib/context/yaml/handlers/networkACLs.js.map +0 -1
  242. package/lib/context/yaml/handlers/organizations.js.map +0 -1
  243. package/lib/context/yaml/handlers/pages.js.map +0 -1
  244. package/lib/context/yaml/handlers/phoneProvider.js.map +0 -1
  245. package/lib/context/yaml/handlers/prompts.js.map +0 -1
  246. package/lib/context/yaml/handlers/resourceServers.js.map +0 -1
  247. package/lib/context/yaml/handlers/roles.js.map +0 -1
  248. package/lib/context/yaml/handlers/rules.js.map +0 -1
  249. package/lib/context/yaml/handlers/rulesConfigs.js.map +0 -1
  250. package/lib/context/yaml/handlers/selfServiceProfiles.js.map +0 -1
  251. package/lib/context/yaml/handlers/tenant.js.map +0 -1
  252. package/lib/context/yaml/handlers/themes.js.map +0 -1
  253. package/lib/context/yaml/handlers/triggers.js.map +0 -1
  254. package/lib/context/yaml/handlers/userAttributeProfiles.js.map +0 -1
  255. package/lib/context/yaml/index.js.map +0 -1
  256. package/lib/index.js.map +0 -1
  257. package/lib/keywordPreservation.js.map +0 -1
  258. package/lib/logger.js.map +0 -1
  259. package/lib/readonly.js.map +0 -1
  260. package/lib/sessionDurationsToMinutes.js.map +0 -1
  261. package/lib/tools/auth0/client.js.map +0 -1
  262. package/lib/tools/auth0/handlers/actions.js.map +0 -1
  263. package/lib/tools/auth0/handlers/attackProtection.js.map +0 -1
  264. package/lib/tools/auth0/handlers/branding.js.map +0 -1
  265. package/lib/tools/auth0/handlers/clientGrants.js.map +0 -1
  266. package/lib/tools/auth0/handlers/clients.js.map +0 -1
  267. package/lib/tools/auth0/handlers/connections.js.map +0 -1
  268. package/lib/tools/auth0/handlers/customDomains.js.map +0 -1
  269. package/lib/tools/auth0/handlers/databases.js.map +0 -1
  270. package/lib/tools/auth0/handlers/default.js.map +0 -1
  271. package/lib/tools/auth0/handlers/emailProvider.js.map +0 -1
  272. package/lib/tools/auth0/handlers/emailTemplates.js.map +0 -1
  273. package/lib/tools/auth0/handlers/flowVaultConnections.js.map +0 -1
  274. package/lib/tools/auth0/handlers/flows.js.map +0 -1
  275. package/lib/tools/auth0/handlers/forms.js.map +0 -1
  276. package/lib/tools/auth0/handlers/guardianFactorProviders.js.map +0 -1
  277. package/lib/tools/auth0/handlers/guardianFactorTemplates.js.map +0 -1
  278. package/lib/tools/auth0/handlers/guardianFactors.js.map +0 -1
  279. package/lib/tools/auth0/handlers/guardianPhoneFactorMessageTypes.js.map +0 -1
  280. package/lib/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.js.map +0 -1
  281. package/lib/tools/auth0/handlers/guardianPolicies.js.map +0 -1
  282. package/lib/tools/auth0/handlers/hooks.js.map +0 -1
  283. package/lib/tools/auth0/handlers/index.js.map +0 -1
  284. package/lib/tools/auth0/handlers/logStreams.js.map +0 -1
  285. package/lib/tools/auth0/handlers/networkACLs.js.map +0 -1
  286. package/lib/tools/auth0/handlers/organizations.js.map +0 -1
  287. package/lib/tools/auth0/handlers/pages.js.map +0 -1
  288. package/lib/tools/auth0/handlers/phoneProvider.js.map +0 -1
  289. package/lib/tools/auth0/handlers/prompts.js.map +0 -1
  290. package/lib/tools/auth0/handlers/resourceServers.js.map +0 -1
  291. package/lib/tools/auth0/handlers/roles.js.map +0 -1
  292. package/lib/tools/auth0/handlers/rules.js.map +0 -1
  293. package/lib/tools/auth0/handlers/rulesConfigs.js.map +0 -1
  294. package/lib/tools/auth0/handlers/scimHandler.js.map +0 -1
  295. package/lib/tools/auth0/handlers/selfServiceProfiles.js.map +0 -1
  296. package/lib/tools/auth0/handlers/tenant.js.map +0 -1
  297. package/lib/tools/auth0/handlers/themes.js.map +0 -1
  298. package/lib/tools/auth0/handlers/triggers.js.map +0 -1
  299. package/lib/tools/auth0/handlers/userAttributeProfiles.js.map +0 -1
  300. package/lib/tools/auth0/index.js.map +0 -1
  301. package/lib/tools/auth0/schema.js.map +0 -1
  302. package/lib/tools/calculateChanges.js.map +0 -1
  303. package/lib/tools/constants.js.map +0 -1
  304. package/lib/tools/deploy.js.map +0 -1
  305. package/lib/tools/index.js.map +0 -1
  306. package/lib/tools/utils.js.map +0 -1
  307. package/lib/tools/validationError.js.map +0 -1
  308. package/lib/types.js.map +0 -1
  309. 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
  };
@@ -68,34 +59,31 @@ function parse(context) {
68
59
  attackProtection,
69
60
  };
70
61
  }
71
- function dump(context) {
72
- return __awaiter(this, void 0, void 0, function* () {
73
- const { attackProtection } = context.assets;
74
- if (!attackProtection)
75
- return;
76
- const files = attackProtectionFiles(context.filePath);
77
- fs_extra_1.default.ensureDirSync(files.directory);
78
- const maskedAttackProtection = (0, defaults_1.attackProtectionDefaults)(attackProtection);
79
- if (maskedAttackProtection.botDetection) {
80
- (0, utils_1.dumpJSON)(files.botDetection, maskedAttackProtection.botDetection);
81
- }
82
- if (maskedAttackProtection.breachedPasswordDetection) {
83
- (0, utils_1.dumpJSON)(files.breachedPasswordDetection, maskedAttackProtection.breachedPasswordDetection);
84
- }
85
- if (maskedAttackProtection.bruteForceProtection) {
86
- (0, utils_1.dumpJSON)(files.bruteForceProtection, maskedAttackProtection.bruteForceProtection);
87
- }
88
- if (maskedAttackProtection.captcha) {
89
- (0, utils_1.dumpJSON)(files.captcha, maskedAttackProtection.captcha);
90
- }
91
- if (maskedAttackProtection.suspiciousIpThrottling) {
92
- (0, utils_1.dumpJSON)(files.suspiciousIpThrottling, maskedAttackProtection.suspiciousIpThrottling);
93
- }
94
- });
62
+ async function dump(context) {
63
+ const { attackProtection } = context.assets;
64
+ if (!attackProtection)
65
+ return;
66
+ const files = attackProtectionFiles(context.filePath);
67
+ fs_extra_1.default.ensureDirSync(files.directory);
68
+ const maskedAttackProtection = (0, defaults_1.attackProtectionDefaults)(attackProtection);
69
+ if (maskedAttackProtection.botDetection) {
70
+ (0, utils_1.dumpJSON)(files.botDetection, maskedAttackProtection.botDetection);
71
+ }
72
+ if (maskedAttackProtection.breachedPasswordDetection) {
73
+ (0, utils_1.dumpJSON)(files.breachedPasswordDetection, maskedAttackProtection.breachedPasswordDetection);
74
+ }
75
+ if (maskedAttackProtection.bruteForceProtection) {
76
+ (0, utils_1.dumpJSON)(files.bruteForceProtection, maskedAttackProtection.bruteForceProtection);
77
+ }
78
+ if (maskedAttackProtection.captcha) {
79
+ (0, utils_1.dumpJSON)(files.captcha, maskedAttackProtection.captcha);
80
+ }
81
+ if (maskedAttackProtection.suspiciousIpThrottling) {
82
+ (0, utils_1.dumpJSON)(files.suspiciousIpThrottling, maskedAttackProtection.suspiciousIpThrottling);
83
+ }
95
84
  }
96
85
  const attackProtectionHandler = {
97
86
  parse,
98
87
  dump,
99
88
  };
100
89
  exports.default = attackProtectionHandler;
101
- //# sourceMappingURL=attackProtection.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
  };
@@ -47,18 +38,19 @@ function parse(context) {
47
38
  return definition;
48
39
  }, {});
49
40
  return {
50
- branding: Object.assign(Object.assign({}, brandingSettings), { templates }),
41
+ branding: {
42
+ ...brandingSettings,
43
+ templates,
44
+ },
51
45
  };
52
46
  }
53
- function dump(context) {
54
- return __awaiter(this, void 0, void 0, function* () {
55
- const { branding } = context.assets;
56
- if (!branding)
57
- return;
58
- dumpBranding(context);
59
- if (!!branding.templates)
60
- dumpBrandingTemplates(context);
61
- });
47
+ async function dump(context) {
48
+ const { branding } = context.assets;
49
+ if (!branding)
50
+ return;
51
+ dumpBranding(context);
52
+ if (!!branding.templates)
53
+ dumpBrandingTemplates(context);
62
54
  }
63
55
  const dumpBrandingTemplates = ({ filePath, assets }) => {
64
56
  if (!assets.branding || !assets.branding.templates)
@@ -84,7 +76,7 @@ const dumpBranding = ({ filePath, assets }) => {
84
76
  return;
85
77
  const { branding } = assets;
86
78
  const brandingWithoutTemplates = (() => {
87
- const newBranding = Object.assign({}, branding);
79
+ const newBranding = { ...branding };
88
80
  delete newBranding.templates;
89
81
  return newBranding;
90
82
  })();
@@ -98,4 +90,3 @@ const brandingHandler = {
98
90
  dump,
99
91
  };
100
92
  exports.default = brandingHandler;
101
- //# sourceMappingURL=branding.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
  };
@@ -33,58 +24,58 @@ function parse(context) {
33
24
  clientGrants,
34
25
  };
35
26
  }
36
- function dump(context) {
37
- return __awaiter(this, void 0, void 0, function* () {
38
- const { clientGrants } = context.assets;
39
- if (!clientGrants)
40
- return; // Skip, nothing to dump
41
- const grantsFolder = path_1.default.join(context.filePath, tools_1.constants.CLIENTS_GRANTS_DIRECTORY);
42
- fs_extra_1.default.ensureDirSync(grantsFolder);
43
- if (clientGrants.length === 0)
44
- return;
45
- const allResourceServers = yield (0, client_1.paginate)(context.mgmtClient.resourceServers.getAll, {
46
- paginate: true,
47
- include_totals: true,
48
- });
49
- const allClients = yield (0, client_1.paginate)(context.mgmtClient.clients.getAll, {
50
- paginate: true,
51
- include_totals: true,
52
- });
53
- // Convert client_id to the client name for readability
54
- clientGrants.forEach((grant) => {
55
- const dumpGrant = Object.assign({}, grant);
56
- if (context.assets.clientsOrig) {
57
- dumpGrant.client_id = (0, utils_1.convertClientIdToName)(dumpGrant.client_id, context.assets.clientsOrig);
58
- }
59
- const clientName = (() => {
60
- const associatedClient = allClients.find((client) => client.client_id === grant.client_id);
61
- if (associatedClient === undefined)
62
- return grant.client_id;
63
- return associatedClient.name;
64
- })();
65
- // Convert audience to the API name for readability
66
- const apiName = (grantAudience) => {
67
- const associatedAPI = allResourceServers.find((resourceServer) => resourceServer.identifier === grantAudience);
68
- if (associatedAPI === undefined)
69
- return grantAudience; // Use the audience if the API is not found
70
- return associatedAPI.name; // Use the name of the API
71
- };
72
- // Replace keyword markers if necessary
73
- const clientNameNonMarker = (0, keywordPreservation_1.doesHaveKeywordMarker)(clientName, context.mappings)
74
- ? (0, tools_1.keywordReplace)(clientName, context.mappings)
75
- : clientName;
76
- const apiAudienceNonMarker = (0, keywordPreservation_1.doesHaveKeywordMarker)(grant.audience, context.mappings)
77
- ? (0, tools_1.keywordReplace)(grant.audience, context.mappings)
78
- : grant.audience;
79
- // Construct the name using non-marker names
80
- const name = (0, utils_1.sanitize)(`${clientNameNonMarker}-${apiName(apiAudienceNonMarker)}`);
81
- // Ensure the name is not empty or invalid
82
- if (!name || name.trim().length === 0) {
83
- throw new Error(`Invalid name generated for client grant: ${JSON.stringify(grant)}`);
84
- }
85
- const grantFile = path_1.default.join(grantsFolder, `${name}.json`);
86
- (0, utils_1.dumpJSON)(grantFile, dumpGrant);
87
- });
27
+ async function dump(context) {
28
+ const { clientGrants } = context.assets;
29
+ if (!clientGrants)
30
+ return; // Skip, nothing to dump
31
+ const grantsFolder = path_1.default.join(context.filePath, tools_1.constants.CLIENTS_GRANTS_DIRECTORY);
32
+ fs_extra_1.default.ensureDirSync(grantsFolder);
33
+ if (clientGrants.length === 0)
34
+ return;
35
+ const allResourceServers = await (0, client_1.paginate)(context.mgmtClient.resourceServers.list, {
36
+ paginate: true,
37
+ include_totals: true,
38
+ });
39
+ const allClients = await (0, client_1.paginate)(context.mgmtClient.clients.list, {
40
+ paginate: true,
41
+ include_totals: true,
42
+ });
43
+ // Convert client_id to the client name for readability
44
+ clientGrants.forEach((grant) => {
45
+ const dumpGrant = { ...grant };
46
+ if (context.assets.clientsOrig) {
47
+ dumpGrant.client_id = (0, utils_1.convertClientIdToName)(dumpGrant.client_id, context.assets.clientsOrig);
48
+ }
49
+ const clientName = (() => {
50
+ const associatedClient = allClients.find((client) => client.client_id === grant.client_id);
51
+ if (associatedClient === undefined)
52
+ return grant.client_id;
53
+ return associatedClient.name;
54
+ })();
55
+ // Convert audience to the API name for readability
56
+ const apiName = (grantAudience) => {
57
+ if (!grantAudience)
58
+ return grantAudience;
59
+ const associatedAPI = allResourceServers.find((resourceServer) => resourceServer.identifier === grantAudience);
60
+ if (associatedAPI === undefined)
61
+ return grantAudience; // Use the audience if the API is not found
62
+ return associatedAPI.name; // Use the name of the API
63
+ };
64
+ // Replace keyword markers if necessary
65
+ const clientNameNonMarker = (0, keywordPreservation_1.doesHaveKeywordMarker)(clientName, context.mappings)
66
+ ? (0, tools_1.keywordReplace)(clientName, context.mappings)
67
+ : clientName;
68
+ const apiAudienceNonMarker = (0, keywordPreservation_1.doesHaveKeywordMarker)(grant.audience, context.mappings)
69
+ ? (0, tools_1.keywordReplace)(grant.audience, context.mappings)
70
+ : grant.audience;
71
+ // Construct the name using non-marker names
72
+ const name = (0, utils_1.sanitize)(`${clientNameNonMarker}-${apiName(apiAudienceNonMarker)}`);
73
+ // Ensure the name is not empty or invalid
74
+ if (!name || name.trim().length === 0) {
75
+ throw new Error(`Invalid name generated for client grant: ${JSON.stringify(grant)}`);
76
+ }
77
+ const grantFile = path_1.default.join(grantsFolder, `${name}.json`);
78
+ (0, utils_1.dumpJSON)(grantFile, dumpGrant);
88
79
  });
89
80
  }
90
81
  const clientGrantsHandler = {
@@ -92,4 +83,3 @@ const clientGrantsHandler = {
92
83
  dump,
93
84
  };
94
85
  exports.default = clientGrantsHandler;
95
- //# sourceMappingURL=clientGrants.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
  };
@@ -44,25 +35,23 @@ function parse(context) {
44
35
  clients,
45
36
  };
46
37
  }
47
- function dump(context) {
48
- return __awaiter(this, void 0, void 0, function* () {
49
- const { clients } = context.assets;
50
- if (!clients)
51
- return; // Skip, nothing to dump
52
- const clientsFolder = path_1.default.join(context.filePath, tools_1.constants.CLIENTS_DIRECTORY);
53
- fs_extra_1.default.ensureDirSync(clientsFolder);
54
- clients.forEach((client) => {
55
- const clientName = (0, utils_1.sanitize)(client.name);
56
- const clientFile = path_1.default.join(clientsFolder, `${clientName}.json`);
57
- if (client.custom_login_page) {
58
- const html = client.custom_login_page;
59
- const customLoginHtml = path_1.default.join(clientsFolder, `${clientName}_custom_login_page.html`);
60
- logger_1.default.info(`Writing ${customLoginHtml}`);
61
- fs_extra_1.default.writeFileSync(customLoginHtml, html);
62
- client.custom_login_page = `./${clientName}_custom_login_page.html`;
63
- }
64
- (0, utils_1.dumpJSON)(clientFile, (0, utils_1.clearClientArrays)(client));
65
- });
38
+ async function dump(context) {
39
+ const { clients } = context.assets;
40
+ if (!clients)
41
+ return; // Skip, nothing to dump
42
+ const clientsFolder = path_1.default.join(context.filePath, tools_1.constants.CLIENTS_DIRECTORY);
43
+ fs_extra_1.default.ensureDirSync(clientsFolder);
44
+ clients.forEach((client) => {
45
+ const clientName = (0, utils_1.sanitize)(client.name);
46
+ const clientFile = path_1.default.join(clientsFolder, `${clientName}.json`);
47
+ if (client.custom_login_page) {
48
+ const html = client.custom_login_page;
49
+ const customLoginHtml = path_1.default.join(clientsFolder, `${clientName}_custom_login_page.html`);
50
+ logger_1.default.info(`Writing ${customLoginHtml}`);
51
+ fs_extra_1.default.writeFileSync(customLoginHtml, html);
52
+ client.custom_login_page = `./${clientName}_custom_login_page.html`;
53
+ }
54
+ (0, utils_1.dumpJSON)(clientFile, (0, utils_1.clearClientArrays)(client));
66
55
  });
67
56
  }
68
57
  const clientsHandler = {
@@ -70,4 +59,3 @@ const clientsHandler = {
70
59
  dump,
71
60
  };
72
61
  exports.default = clientsHandler;
73
- //# sourceMappingURL=clients.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
  };
@@ -48,40 +39,41 @@ function parse(context) {
48
39
  connections,
49
40
  };
50
41
  }
51
- function dump(context) {
52
- return __awaiter(this, void 0, void 0, function* () {
53
- const { connections, clientsOrig } = context.assets;
54
- if (!connections)
55
- return; // Skip, nothing to dump
56
- const connectionsFolder = path_1.default.join(context.filePath, tools_1.constants.CONNECTIONS_DIRECTORY);
57
- fs_extra_1.default.ensureDirSync(connectionsFolder);
58
- // Convert enabled_clients from id to name
59
- connections.forEach((connection) => {
60
- let dumpedConnection = Object.assign(Object.assign({}, connection), (connection.enabled_clients && {
42
+ async function dump(context) {
43
+ const { connections, clientsOrig } = context.assets;
44
+ if (!connections)
45
+ return; // Skip, nothing to dump
46
+ const connectionsFolder = path_1.default.join(context.filePath, tools_1.constants.CONNECTIONS_DIRECTORY);
47
+ fs_extra_1.default.ensureDirSync(connectionsFolder);
48
+ // Convert enabled_clients from id to name
49
+ connections.forEach((connection) => {
50
+ let dumpedConnection = {
51
+ ...connection,
52
+ ...(connection.enabled_clients && {
61
53
  enabled_clients: (0, utils_1.mapClientID2NameSorted)(connection.enabled_clients, clientsOrig || []),
62
- }));
63
- const connectionName = (0, utils_1.sanitize)(dumpedConnection.name);
64
- // Mask secrets
65
- dumpedConnection = (0, defaults_1.connectionDefaults)(dumpedConnection);
66
- if (dumpedConnection.strategy === 'email') {
67
- (0, utils_1.ensureProp)(dumpedConnection, 'options.email.body');
68
- const html = dumpedConnection.options.email.body;
69
- const emailConnectionHtml = path_1.default.join(connectionsFolder, `${connectionName}.html`);
70
- logger_1.default.info(`Writing ${emailConnectionHtml}`);
71
- fs_extra_1.default.writeFileSync(emailConnectionHtml, html);
72
- dumpedConnection.options.email.body = `./${connectionName}.html`;
54
+ }),
55
+ };
56
+ const connectionName = (0, utils_1.sanitize)(dumpedConnection.name);
57
+ // Mask secrets
58
+ dumpedConnection = (0, defaults_1.connectionDefaults)(dumpedConnection);
59
+ if (dumpedConnection.strategy === 'email') {
60
+ (0, utils_1.ensureProp)(dumpedConnection, 'options.email.body');
61
+ const html = dumpedConnection.options.email.body;
62
+ const emailConnectionHtml = path_1.default.join(connectionsFolder, `${connectionName}.html`);
63
+ logger_1.default.info(`Writing ${emailConnectionHtml}`);
64
+ fs_extra_1.default.writeFileSync(emailConnectionHtml, html);
65
+ dumpedConnection.options.email.body = `./${connectionName}.html`;
66
+ }
67
+ if (dumpedConnection.strategy === 'samlp' && dumpedConnection.options) {
68
+ if ('cert' in dumpedConnection.options) {
69
+ dumpedConnection.options.cert = (0, utils_1.encodeCertStringToBase64)(dumpedConnection.options.cert);
73
70
  }
74
- if (dumpedConnection.strategy === 'samlp' && dumpedConnection.options) {
75
- if ('cert' in dumpedConnection.options) {
76
- dumpedConnection.options.cert = (0, utils_1.encodeCertStringToBase64)(dumpedConnection.options.cert);
77
- }
78
- if ('signingCert' in dumpedConnection.options) {
79
- dumpedConnection.options.signingCert = (0, utils_1.encodeCertStringToBase64)(dumpedConnection.options.signingCert);
80
- }
71
+ if ('signingCert' in dumpedConnection.options) {
72
+ dumpedConnection.options.signingCert = (0, utils_1.encodeCertStringToBase64)(dumpedConnection.options.signingCert);
81
73
  }
82
- const connectionFile = path_1.default.join(connectionsFolder, `${connectionName}.json`);
83
- (0, utils_1.dumpJSON)(connectionFile, dumpedConnection);
84
- });
74
+ }
75
+ const connectionFile = path_1.default.join(connectionsFolder, `${connectionName}.json`);
76
+ (0, utils_1.dumpJSON)(connectionFile, dumpedConnection);
85
77
  });
86
78
  }
87
79
  const connectionsHandler = {
@@ -89,4 +81,3 @@ const connectionsHandler = {
89
81
  dump,
90
82
  };
91
83
  exports.default = connectionsHandler;
92
- //# sourceMappingURL=connections.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,21 +21,18 @@ function parse(context) {
30
21
  }),
31
22
  };
32
23
  }
33
- function dump(context) {
34
- return __awaiter(this, void 0, void 0, function* () {
35
- const { customDomains } = context.assets;
36
- if (!customDomains)
37
- return; // Skip, nothing to dump
38
- // Create Rules folder
39
- const customDomainsDirectory = getCustomDomainsDirectory(context.filePath);
40
- fs_extra_1.default.ensureDirSync(customDomainsDirectory);
41
- const customDomainsFile = getCustomDomainsFile(context.filePath);
42
- (0, utils_1.dumpJSON)(customDomainsFile, customDomains);
43
- });
24
+ async function dump(context) {
25
+ const { customDomains } = context.assets;
26
+ if (!customDomains)
27
+ return; // Skip, nothing to dump
28
+ // Create Rules folder
29
+ const customDomainsDirectory = getCustomDomainsDirectory(context.filePath);
30
+ fs_extra_1.default.ensureDirSync(customDomainsDirectory);
31
+ const customDomainsFile = getCustomDomainsFile(context.filePath);
32
+ (0, utils_1.dumpJSON)(customDomainsFile, customDomains);
44
33
  }
45
34
  const customDomainsHandler = {
46
35
  parse,
47
36
  dump,
48
37
  };
49
38
  exports.default = customDomainsHandler;
50
- //# sourceMappingURL=customDomains.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
  };
@@ -18,7 +9,6 @@ const tools_1 = require("../../../tools");
18
9
  const logger_1 = __importDefault(require("../../../logger"));
19
10
  const utils_1 = require("../../../utils");
20
11
  function getDatabase(folder, mappingOpts) {
21
- var _a;
22
12
  const metaFile = path_1.default.join(folder, 'database.json');
23
13
  const metaData = (() => {
24
14
  try {
@@ -33,9 +23,17 @@ function getDatabase(folder, mappingOpts) {
33
23
  logger_1.default.warn(`Skipping database folder ${folder} as ${metaFile} is empty`);
34
24
  return {};
35
25
  }
36
- const database = Object.assign(Object.assign({}, metaData), { options: Object.assign(Object.assign({}, (metaData.options || {})), ((metaData === null || metaData === void 0 ? void 0 : metaData.customScripts) && { customScripts: metaData === null || metaData === void 0 ? void 0 : metaData.customScripts })) });
26
+ const database = {
27
+ ...metaData,
28
+ options: {
29
+ // @ts-ignore because this code exists currently, but still needs to be understood if it is correct or not
30
+ ...(metaData.options || {}),
31
+ // @ts-ignore because this code exists currently, but still needs to be understood if it is correct or not
32
+ ...(metaData?.customScripts && { customScripts: metaData?.customScripts }),
33
+ },
34
+ };
37
35
  // If any customScripts configured then load content of files
38
- if ((_a = database.options) === null || _a === void 0 ? void 0 : _a.customScripts) {
36
+ if (database.options?.customScripts) {
39
37
  Object.entries(database.options.customScripts).forEach(([name, script]) => {
40
38
  if (!tools_1.constants.DATABASE_SCRIPTS.includes(name)) {
41
39
  // skip invalid keys in customScripts object
@@ -66,25 +64,29 @@ function parse(context) {
66
64
  databases,
67
65
  };
68
66
  }
69
- function dump(context) {
70
- return __awaiter(this, void 0, void 0, function* () {
71
- const { databases } = context.assets;
72
- if (!databases)
73
- return; // Skip, nothing to dump
74
- const databasesFolder = path_1.default.join(context.filePath, tools_1.constants.DATABASE_CONNECTIONS_DIRECTORY);
75
- fs_extra_1.default.ensureDirSync(databasesFolder);
76
- databases.forEach((database) => {
77
- var _a;
78
- const dbFolder = path_1.default.join(databasesFolder, (0, utils_1.sanitize)(database.name));
79
- fs_extra_1.default.ensureDirSync(dbFolder);
80
- const sortCustomScripts = (name1, name2) => {
81
- if (name1 === name2)
82
- return 0;
83
- return name1 > name2 ? 1 : -1;
84
- };
85
- const formatted = Object.assign(Object.assign(Object.assign({}, database), (database.enabled_clients && {
67
+ async function dump(context) {
68
+ const { databases } = context.assets;
69
+ if (!databases)
70
+ return; // Skip, nothing to dump
71
+ const databasesFolder = path_1.default.join(context.filePath, tools_1.constants.DATABASE_CONNECTIONS_DIRECTORY);
72
+ fs_extra_1.default.ensureDirSync(databasesFolder);
73
+ databases.forEach((database) => {
74
+ const dbFolder = path_1.default.join(databasesFolder, (0, utils_1.sanitize)(database.name));
75
+ fs_extra_1.default.ensureDirSync(dbFolder);
76
+ const sortCustomScripts = (name1, name2) => {
77
+ if (name1 === name2)
78
+ return 0;
79
+ return name1 > name2 ? 1 : -1;
80
+ };
81
+ const formatted = {
82
+ ...database,
83
+ ...(database.enabled_clients && {
86
84
  enabled_clients: (0, utils_1.mapClientID2NameSorted)(database.enabled_clients, context.assets.clientsOrig || []),
87
- })), { options: Object.assign(Object.assign({}, (database.options || {})), (((_a = database.options) === null || _a === void 0 ? void 0 : _a.customScripts) && {
85
+ }),
86
+ options: {
87
+ ...(database.options || {}),
88
+ // customScripts option only written if there are scripts
89
+ ...(database.options?.customScripts && {
88
90
  customScripts: Object.entries(database.options.customScripts)
89
91
  // @ts-ignore because we'll fix this in subsequent PR
90
92
  .sort(sortCustomScripts)
@@ -98,10 +100,11 @@ function dump(context) {
98
100
  scripts[name] = `./${scriptName}`;
99
101
  return scripts;
100
102
  }, {}),
101
- })) });
102
- const databaseFile = path_1.default.join(dbFolder, 'database.json');
103
- (0, utils_1.dumpJSON)(databaseFile, formatted);
104
- });
103
+ }),
104
+ },
105
+ };
106
+ const databaseFile = path_1.default.join(dbFolder, 'database.json');
107
+ (0, utils_1.dumpJSON)(databaseFile, formatted);
105
108
  });
106
109
  }
107
110
  const databasesHandler = {
@@ -109,4 +112,3 @@ const databasesHandler = {
109
112
  dump,
110
113
  };
111
114
  exports.default = databasesHandler;
112
- //# sourceMappingURL=databases.js.map