@rockcarver/frodo-lib 0.16.2-9 → 0.17.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 (355) hide show
  1. package/CHANGELOG.md +222 -1
  2. package/cjs/api/AgentApi.js +14 -61
  3. package/cjs/api/AgentApi.js.map +1 -1
  4. package/cjs/api/AgentApi.test.js.map +1 -1
  5. package/cjs/api/ApiTypes.js +0 -5
  6. package/cjs/api/ApiTypes.js.map +1 -1
  7. package/cjs/api/AuthenticateApi.js +9 -20
  8. package/cjs/api/AuthenticateApi.js.map +1 -1
  9. package/cjs/api/AuthenticateApi.test.js.map +1 -0
  10. package/cjs/api/BaseApi.js +82 -124
  11. package/cjs/api/BaseApi.js.map +1 -1
  12. package/cjs/api/CirclesOfTrustApi.js +8 -32
  13. package/cjs/api/CirclesOfTrustApi.js.map +1 -1
  14. package/cjs/api/IdmConfigApi.js +9 -34
  15. package/cjs/api/IdmConfigApi.js.map +1 -1
  16. package/cjs/api/LogApi.js +8 -31
  17. package/cjs/api/LogApi.js.map +1 -1
  18. package/cjs/api/ManagedObjectApi.js +34 -31
  19. package/cjs/api/ManagedObjectApi.js.map +1 -1
  20. package/cjs/api/NodeApi.js +10 -41
  21. package/cjs/api/NodeApi.js.map +1 -1
  22. package/cjs/api/NodeApi.test.js.map +1 -1
  23. package/cjs/api/OAuth2ClientApi.js +7 -26
  24. package/cjs/api/OAuth2ClientApi.js.map +1 -1
  25. package/cjs/api/OAuth2OIDCApi.js +28 -34
  26. package/cjs/api/OAuth2OIDCApi.js.map +1 -1
  27. package/cjs/api/OAuth2OIDCApi.test.js.map +1 -0
  28. package/cjs/api/OAuth2ProviderApi.js +5 -15
  29. package/cjs/api/OAuth2ProviderApi.js.map +1 -1
  30. package/cjs/api/RealmApi.js +8 -34
  31. package/cjs/api/RealmApi.js.map +1 -1
  32. package/cjs/api/Saml2Api.js +16 -67
  33. package/cjs/api/Saml2Api.js.map +1 -1
  34. package/cjs/api/ScriptApi.js +8 -30
  35. package/cjs/api/ScriptApi.js.map +1 -1
  36. package/cjs/api/SecretsApi.js +14 -64
  37. package/cjs/api/SecretsApi.js.map +1 -1
  38. package/cjs/api/SecretsApi.test.js.map +1 -1
  39. package/cjs/api/ServerInfoApi.js +6 -21
  40. package/cjs/api/ServerInfoApi.js.map +1 -1
  41. package/cjs/api/ServiceApi.js +49 -47
  42. package/cjs/api/ServiceApi.js.map +1 -1
  43. package/cjs/api/SocialIdentityProvidersApi.js +9 -36
  44. package/cjs/api/SocialIdentityProvidersApi.js.map +1 -1
  45. package/cjs/api/StartupApi.js +5 -24
  46. package/cjs/api/StartupApi.js.map +1 -1
  47. package/cjs/api/StartupApi.test.js.map +1 -1
  48. package/cjs/api/TreeApi.js +8 -30
  49. package/cjs/api/TreeApi.js.map +1 -1
  50. package/cjs/api/TreeApi.test.js.map +1 -1
  51. package/cjs/api/VariablesApi.js +9 -37
  52. package/cjs/api/VariablesApi.js.map +1 -1
  53. package/cjs/api/VariablesApi.test.js.map +1 -1
  54. package/cjs/api/utils/ApiUtils.js +47 -57
  55. package/cjs/api/utils/ApiUtils.js.map +1 -1
  56. package/cjs/api/utils/ApiUtils.test.js.map +1 -1
  57. package/cjs/api/utils/Base64.js +5 -15
  58. package/cjs/api/utils/Base64.js.map +1 -1
  59. package/cjs/ext/axios-curlirize/curlirize.js +2 -9
  60. package/cjs/ext/axios-curlirize/curlirize.js.map +1 -1
  61. package/cjs/ext/axios-curlirize/lib/CurlHelper.js +7 -22
  62. package/cjs/ext/axios-curlirize/lib/CurlHelper.js.map +1 -1
  63. package/cjs/index.js +30 -89
  64. package/cjs/index.js.map +1 -1
  65. package/cjs/ops/AdminOps.js +27 -165
  66. package/cjs/ops/AdminOps.js.map +1 -1
  67. package/cjs/ops/AgentOps.js +2 -159
  68. package/cjs/ops/AgentOps.js.map +1 -1
  69. package/cjs/ops/AgentOps.test.js.map +1 -1
  70. package/cjs/ops/AuthenticateOps.js +266 -226
  71. package/cjs/ops/AuthenticateOps.js.map +1 -1
  72. package/cjs/ops/AuthenticateOps.test.js.map +1 -1
  73. package/cjs/ops/CirclesOfTrustOps.js +13 -91
  74. package/cjs/ops/CirclesOfTrustOps.js.map +1 -1
  75. package/cjs/ops/ConnectionProfileOps.js +220 -136
  76. package/cjs/ops/ConnectionProfileOps.js.map +1 -1
  77. package/cjs/ops/ConnectionProfileOps.test.js.map +1 -1
  78. package/cjs/ops/EmailTemplateOps.js +35 -379
  79. package/cjs/ops/EmailTemplateOps.js.map +1 -1
  80. package/cjs/ops/EmailTemplateOps.test.js.map +1 -1
  81. package/cjs/ops/IdmOps.js +52 -426
  82. package/cjs/ops/IdmOps.js.map +1 -1
  83. package/cjs/ops/IdmOps.test.js.map +1 -1
  84. package/cjs/ops/IdpOps.js +11 -94
  85. package/cjs/ops/IdpOps.js.map +1 -1
  86. package/cjs/ops/IdpOps.test.js.map +1 -1
  87. package/cjs/ops/JoseOps.js +81 -0
  88. package/cjs/ops/JoseOps.js.map +1 -0
  89. package/cjs/ops/JoseOps.test.js.map +1 -0
  90. package/cjs/ops/JourneyOps.js +139 -370
  91. package/cjs/ops/JourneyOps.js.map +1 -1
  92. package/cjs/ops/JourneyOps.test.js.map +1 -1
  93. package/cjs/ops/LogOps.js +14 -47
  94. package/cjs/ops/LogOps.js.map +1 -1
  95. package/cjs/ops/ManagedObjectOps.js +4 -12
  96. package/cjs/ops/ManagedObjectOps.js.map +1 -1
  97. package/cjs/ops/NodeOps.js +9 -67
  98. package/cjs/ops/NodeOps.js.map +1 -1
  99. package/cjs/ops/OAuth2ClientOps.js +10 -40
  100. package/cjs/ops/OAuth2ClientOps.js.map +1 -1
  101. package/cjs/ops/OpsTypes.js +0 -5
  102. package/cjs/ops/OpsTypes.js.map +1 -1
  103. package/cjs/ops/OrganizationOps.js +6 -25
  104. package/cjs/ops/OrganizationOps.js.map +1 -1
  105. package/cjs/ops/RealmOps.js +0 -19
  106. package/cjs/ops/RealmOps.js.map +1 -1
  107. package/cjs/ops/Saml2Ops.js +11 -107
  108. package/cjs/ops/Saml2Ops.js.map +1 -1
  109. package/cjs/ops/Saml2Ops.test.js.map +1 -1
  110. package/cjs/ops/ScriptOps.js +26 -73
  111. package/cjs/ops/ScriptOps.js.map +1 -1
  112. package/cjs/ops/SecretsOps.js +2 -58
  113. package/cjs/ops/SecretsOps.js.map +1 -1
  114. package/cjs/ops/ServiceAccountOps.js +61 -0
  115. package/cjs/ops/ServiceAccountOps.js.map +1 -0
  116. package/cjs/ops/ServiceAccountOps.test.js.map +1 -0
  117. package/cjs/ops/ServiceOps.js +55 -101
  118. package/cjs/ops/ServiceOps.js.map +1 -1
  119. package/cjs/ops/StartupOps.js +2 -23
  120. package/cjs/ops/StartupOps.js.map +1 -1
  121. package/cjs/ops/ThemeOps.js +230 -436
  122. package/cjs/ops/ThemeOps.js.map +1 -1
  123. package/cjs/ops/ThemeOps.test.js.map +1 -0
  124. package/cjs/ops/VariablesOps.js +0 -38
  125. package/cjs/ops/VariablesOps.js.map +1 -1
  126. package/cjs/ops/utils/Console.js +29 -62
  127. package/cjs/ops/utils/Console.js.map +1 -1
  128. package/cjs/ops/utils/DataProtection.js +13 -47
  129. package/cjs/ops/utils/DataProtection.js.map +1 -1
  130. package/cjs/ops/utils/DataProtection.test.js.map +1 -1
  131. package/cjs/ops/utils/ExportImportUtils.js +36 -74
  132. package/cjs/ops/utils/ExportImportUtils.js.map +1 -1
  133. package/cjs/ops/utils/ExportImportUtils.test.js.map +1 -1
  134. package/cjs/ops/utils/OpsUtils.js +27 -43
  135. package/cjs/ops/utils/OpsUtils.js.map +1 -1
  136. package/cjs/ops/utils/OpsUtils.test.js.map +1 -1
  137. package/cjs/ops/utils/ValidationUtils.js +0 -13
  138. package/cjs/ops/utils/ValidationUtils.js.map +1 -1
  139. package/cjs/ops/utils/ValidationUtils.test.js.map +1 -1
  140. package/cjs/ops/utils/Version.js +2 -12
  141. package/cjs/ops/utils/Version.js.map +1 -1
  142. package/cjs/ops/utils/Version.test.js.map +1 -1
  143. package/cjs/ops/utils/Wordwrap.js +1 -2
  144. package/cjs/ops/utils/Wordwrap.js.map +1 -1
  145. package/cjs/ops/utils/Wordwrap.test.js.map +1 -0
  146. package/cjs/shared/State.js +239 -0
  147. package/cjs/shared/State.js.map +1 -0
  148. package/cjs/shared/State.test.js.map +1 -0
  149. package/cjs/storage/StaticStorage.js.map +1 -1
  150. package/cjs/test/mocks/AuthenticateApi/step/default_steps.json +88 -0
  151. package/cjs/test/mocks/ForgeRockApiMockEngine.js +161 -83
  152. package/cjs/test/mocks/ForgeRockApiMockEngine.js.map +1 -1
  153. package/cjs/test/mocks/IdmConfigApi/getConfigEntity/managed.json +4420 -0
  154. package/cjs/test/mocks/OAuth2OIDCApi/accessToken/body.json +6 -0
  155. package/cjs/test/mocks/OAuth2OIDCApi/accessToken/headers.json +19 -0
  156. package/cjs/test/mocks/OAuth2OIDCApi/authorize/headers.json +38 -0
  157. package/cjs/test/mocks/ServerInfoApi/getServerInfo/info.json +25 -0
  158. package/cjs/test/mocks/ServerInfoApi/getServerVersionInfo/version.json +8 -0
  159. package/cjs/utils/AutoSetupPolly.js +79 -0
  160. package/cjs/utils/AutoSetupPolly.js.map +1 -0
  161. package/cjs/utils/SetupJest.js +6 -0
  162. package/cjs/utils/SetupJest.js.map +1 -0
  163. package/cjs/{test/mocks → utils}/snapshotResolve.js +10 -12
  164. package/cjs/utils/snapshotResolve.js.map +1 -0
  165. package/esm/api/AgentApi.mjs +19 -21
  166. package/esm/api/AgentApi.test.mjs +6 -15
  167. package/esm/api/ApiTypes.mjs +0 -5
  168. package/esm/api/AuthenticateApi.mjs +7 -10
  169. package/esm/api/AuthenticateApi.test.mjs +39 -0
  170. package/esm/api/BaseApi.mjs +96 -81
  171. package/esm/api/CirclesOfTrustApi.mjs +9 -12
  172. package/esm/api/IdmConfigApi.mjs +11 -12
  173. package/esm/api/LogApi.mjs +6 -10
  174. package/esm/api/ManagedObjectApi.mjs +23 -8
  175. package/esm/api/NodeApi.mjs +13 -15
  176. package/esm/api/NodeApi.test.mjs +13 -17
  177. package/esm/api/OAuth2ClientApi.mjs +7 -9
  178. package/esm/api/OAuth2OIDCApi.mjs +15 -9
  179. package/esm/api/OAuth2OIDCApi.test.mjs +53 -0
  180. package/esm/api/OAuth2ProviderApi.mjs +3 -5
  181. package/esm/api/RealmApi.mjs +10 -13
  182. package/esm/api/Saml2Api.mjs +25 -29
  183. package/esm/api/ScriptApi.mjs +9 -11
  184. package/esm/api/SecretsApi.mjs +21 -24
  185. package/esm/api/SecretsApi.test.mjs +9 -31
  186. package/esm/api/ServerInfoApi.mjs +5 -9
  187. package/esm/api/ServiceApi.mjs +53 -26
  188. package/esm/api/SocialIdentityProvidersApi.mjs +11 -13
  189. package/esm/api/StartupApi.mjs +5 -10
  190. package/esm/api/StartupApi.test.mjs +4 -7
  191. package/esm/api/TreeApi.mjs +9 -11
  192. package/esm/api/TreeApi.test.mjs +24 -61
  193. package/esm/api/VariablesApi.mjs +11 -13
  194. package/esm/api/VariablesApi.test.mjs +80 -222
  195. package/esm/api/utils/ApiUtils.mjs +45 -48
  196. package/esm/api/utils/ApiUtils.test.mjs +33 -32
  197. package/esm/api/utils/Base64.mjs +5 -9
  198. package/esm/ext/axios-curlirize/curlirize.mjs +2 -7
  199. package/esm/ext/axios-curlirize/lib/CurlHelper.mjs +7 -20
  200. package/esm/index.mjs +23 -13
  201. package/esm/ops/AdminOps.mjs +33 -119
  202. package/esm/ops/AgentOps.mjs +37 -80
  203. package/esm/ops/AgentOps.test.mjs +5 -45
  204. package/esm/ops/AuthenticateOps.mjs +242 -175
  205. package/esm/ops/AuthenticateOps.test.mjs +7 -9
  206. package/esm/ops/CirclesOfTrustOps.mjs +24 -61
  207. package/esm/ops/ConnectionProfileOps.mjs +192 -82
  208. package/esm/ops/ConnectionProfileOps.test.mjs +19 -19
  209. package/esm/ops/EmailTemplateOps.mjs +18 -276
  210. package/esm/ops/EmailTemplateOps.test.mjs +19 -44
  211. package/esm/ops/IdmOps.mjs +30 -327
  212. package/esm/ops/IdmOps.test.mjs +47 -54
  213. package/esm/ops/IdpOps.mjs +21 -59
  214. package/esm/ops/IdpOps.test.mjs +5 -5
  215. package/esm/ops/JoseOps.mjs +41 -0
  216. package/esm/ops/JoseOps.test.mjs +137 -0
  217. package/esm/ops/JourneyOps.mjs +146 -289
  218. package/esm/ops/JourneyOps.test.mjs +29 -27
  219. package/esm/ops/LogOps.mjs +15 -25
  220. package/esm/ops/ManagedObjectOps.mjs +6 -6
  221. package/esm/ops/NodeOps.mjs +9 -47
  222. package/esm/ops/OAuth2ClientOps.mjs +13 -19
  223. package/esm/ops/OpsTypes.mjs +1 -3
  224. package/esm/ops/OrganizationOps.mjs +7 -14
  225. package/esm/ops/RealmOps.mjs +4 -7
  226. package/esm/ops/Saml2Ops.mjs +28 -62
  227. package/esm/ops/Saml2Ops.test.mjs +20 -23
  228. package/esm/ops/ScriptOps.mjs +29 -47
  229. package/esm/ops/SecretsOps.mjs +15 -31
  230. package/esm/ops/ServiceAccountOps.mjs +41 -0
  231. package/esm/ops/ServiceAccountOps.test.mjs +51 -0
  232. package/esm/ops/ServiceOps.mjs +66 -83
  233. package/esm/ops/StartupOps.mjs +4 -13
  234. package/esm/ops/ThemeOps.mjs +189 -298
  235. package/esm/{api/ThemeApi.test.mjs → ops/ThemeOps.test.mjs} +91 -96
  236. package/esm/ops/VariablesOps.mjs +9 -18
  237. package/esm/ops/utils/Console.mjs +28 -46
  238. package/esm/ops/utils/DataProtection.mjs +15 -28
  239. package/esm/ops/utils/DataProtection.test.mjs +8 -8
  240. package/esm/ops/utils/ExportImportUtils.mjs +34 -43
  241. package/esm/ops/utils/ExportImportUtils.test.mjs +20 -18
  242. package/esm/ops/utils/OpsUtils.mjs +27 -21
  243. package/esm/ops/utils/OpsUtils.test.mjs +155 -27
  244. package/esm/ops/utils/ValidationUtils.mjs +0 -9
  245. package/esm/ops/utils/Version.mjs +2 -3
  246. package/esm/ops/utils/Version.test.mjs +0 -2
  247. package/esm/ops/utils/Wordwrap.mjs +1 -1
  248. package/esm/ops/utils/Wordwrap.test.mjs +19 -0
  249. package/esm/shared/State.mjs +164 -0
  250. package/esm/shared/State.test.mjs +249 -0
  251. package/esm/test/mocks/AuthenticateApi/step/default_steps.json +88 -0
  252. package/esm/test/mocks/ForgeRockApiMockEngine.mjs +147 -31
  253. package/esm/test/mocks/IdmConfigApi/getConfigEntity/managed.json +4420 -0
  254. package/esm/test/mocks/OAuth2OIDCApi/accessToken/body.json +6 -0
  255. package/esm/test/mocks/OAuth2OIDCApi/accessToken/headers.json +19 -0
  256. package/esm/test/mocks/OAuth2OIDCApi/authorize/headers.json +38 -0
  257. package/esm/test/mocks/ServerInfoApi/getServerInfo/info.json +25 -0
  258. package/esm/test/mocks/ServerInfoApi/getServerVersionInfo/version.json +8 -0
  259. package/esm/utils/AutoSetupPolly.mjs +72 -0
  260. package/esm/utils/SetupJest.mjs +3 -0
  261. package/esm/{test/mocks → utils}/snapshotResolve.mjs +10 -12
  262. package/package.json +36 -26
  263. package/types/api/AgentApi.d.ts.map +1 -1
  264. package/types/api/ApiTypes.d.ts +15 -16
  265. package/types/api/ApiTypes.d.ts.map +1 -1
  266. package/types/api/AuthenticateApi.d.ts +1 -1
  267. package/types/api/AuthenticateApi.d.ts.map +1 -1
  268. package/types/api/BaseApi.d.ts +2 -0
  269. package/types/api/BaseApi.d.ts.map +1 -1
  270. package/types/api/CirclesOfTrustApi.d.ts.map +1 -1
  271. package/types/api/IdmConfigApi.d.ts.map +1 -1
  272. package/types/api/LogApi.d.ts.map +1 -1
  273. package/types/api/ManagedObjectApi.d.ts +9 -1
  274. package/types/api/ManagedObjectApi.d.ts.map +1 -1
  275. package/types/api/NodeApi.d.ts.map +1 -1
  276. package/types/api/OAuth2ClientApi.d.ts.map +1 -1
  277. package/types/api/OAuth2OIDCApi.d.ts +4 -2
  278. package/types/api/OAuth2OIDCApi.d.ts.map +1 -1
  279. package/types/api/OAuth2ProviderApi.d.ts.map +1 -1
  280. package/types/api/RealmApi.d.ts.map +1 -1
  281. package/types/api/Saml2Api.d.ts.map +1 -1
  282. package/types/api/ScriptApi.d.ts.map +1 -1
  283. package/types/api/SecretsApi.d.ts.map +1 -1
  284. package/types/api/ServerInfoApi.d.ts.map +1 -1
  285. package/types/api/ServiceApi.d.ts +14 -7
  286. package/types/api/ServiceApi.d.ts.map +1 -1
  287. package/types/api/SocialIdentityProvidersApi.d.ts.map +1 -1
  288. package/types/api/StartupApi.d.ts.map +1 -1
  289. package/types/api/TreeApi.d.ts.map +1 -1
  290. package/types/api/VariablesApi.d.ts.map +1 -1
  291. package/types/api/utils/ApiUtils.d.ts +1 -0
  292. package/types/api/utils/ApiUtils.d.ts.map +1 -1
  293. package/types/index.d.ts +11 -5
  294. package/types/index.d.ts.map +1 -1
  295. package/types/ops/AuthenticateOps.d.ts +10 -2
  296. package/types/ops/AuthenticateOps.d.ts.map +1 -1
  297. package/types/ops/ConnectionProfileOps.d.ts +49 -21
  298. package/types/ops/ConnectionProfileOps.d.ts.map +1 -1
  299. package/types/ops/EmailTemplateOps.d.ts +14 -33
  300. package/types/ops/EmailTemplateOps.d.ts.map +1 -1
  301. package/types/ops/IdmOps.d.ts +29 -37
  302. package/types/ops/IdmOps.d.ts.map +1 -1
  303. package/types/ops/JoseOps.d.ts +33 -0
  304. package/types/ops/JoseOps.d.ts.map +1 -0
  305. package/types/ops/JourneyOps.d.ts.map +1 -1
  306. package/types/ops/LogOps.d.ts.map +1 -1
  307. package/types/ops/NodeOps.d.ts.map +1 -1
  308. package/types/ops/OAuth2ClientOps.d.ts.map +1 -1
  309. package/types/ops/OpsTypes.d.ts +1 -1
  310. package/types/ops/OpsTypes.d.ts.map +1 -1
  311. package/types/ops/OrganizationOps.d.ts.map +1 -1
  312. package/types/ops/ScriptOps.d.ts.map +1 -1
  313. package/types/ops/ServiceAccountOps.d.ts +20 -0
  314. package/types/ops/ServiceAccountOps.d.ts.map +1 -0
  315. package/types/ops/ServiceOps.d.ts +18 -10
  316. package/types/ops/ServiceOps.d.ts.map +1 -1
  317. package/types/ops/ThemeOps.d.ts +35 -50
  318. package/types/ops/ThemeOps.d.ts.map +1 -1
  319. package/types/ops/utils/Console.d.ts +1 -1
  320. package/types/ops/utils/Console.d.ts.map +1 -1
  321. package/types/ops/utils/DataProtection.d.ts.map +1 -1
  322. package/types/ops/utils/ExportImportUtils.d.ts +5 -2
  323. package/types/ops/utils/ExportImportUtils.d.ts.map +1 -1
  324. package/types/ops/utils/OpsUtils.d.ts +6 -0
  325. package/types/ops/utils/OpsUtils.d.ts.map +1 -1
  326. package/types/ops/utils/Wordwrap.d.ts.map +1 -1
  327. package/types/shared/State.d.ts +223 -0
  328. package/types/shared/State.d.ts.map +1 -0
  329. package/types/test/mocks/ForgeRockApiMockEngine.d.ts +19 -1
  330. package/types/test/mocks/ForgeRockApiMockEngine.d.ts.map +1 -1
  331. package/types/utils/AutoSetupPolly.d.ts +1 -0
  332. package/types/utils/AutoSetupPolly.d.ts.map +1 -0
  333. package/types/utils/SetupJest.d.ts +1 -0
  334. package/types/utils/SetupJest.d.ts.map +1 -0
  335. package/types/utils/snapshotResolve.d.ts +1 -0
  336. package/types/utils/snapshotResolve.d.ts.map +1 -0
  337. package/cjs/api/EmailTemplateApi.js +0 -73
  338. package/cjs/api/EmailTemplateApi.js.map +0 -1
  339. package/cjs/api/ThemeApi.js +0 -367
  340. package/cjs/api/ThemeApi.js.map +0 -1
  341. package/cjs/api/ThemeApi.test.js.map +0 -1
  342. package/cjs/storage/SessionStorage.js +0 -91
  343. package/cjs/storage/SessionStorage.js.map +0 -1
  344. package/cjs/test/mocks/snapshotResolve.js.map +0 -1
  345. package/esm/api/EmailTemplateApi.mjs +0 -34
  346. package/esm/api/ThemeApi.mjs +0 -271
  347. package/esm/storage/SessionStorage.mjs +0 -79
  348. package/types/api/EmailTemplateApi.d.ts +0 -22
  349. package/types/api/EmailTemplateApi.d.ts.map +0 -1
  350. package/types/api/ThemeApi.d.ts +0 -56
  351. package/types/api/ThemeApi.d.ts.map +0 -1
  352. package/types/storage/SessionStorage.d.ts +0 -71
  353. package/types/storage/SessionStorage.d.ts.map +0 -1
  354. package/types/test/mocks/snapshotResolve.d.ts +0 -1
  355. package/types/test/mocks/snapshotResolve.d.ts.map +0 -1
@@ -9,19 +9,17 @@ import { isEqualJson } from './utils/OpsUtils';
9
9
  import { mockCreateSaml2Provider } from '../test/mocks/ForgeRockApiMockEngine';
10
10
  import { convertTextArrayToBase64Url } from './utils/ExportImportUtils';
11
11
  const mock = new MockAdapter(axios);
12
-
13
12
  const outputHandler = message => {
14
13
  console.log(message);
15
14
  };
16
-
17
- state.default.session.setTenant('https://openam-volker-dev.forgeblocks.com/am');
18
- state.default.session.setRealm('alpha');
19
- state.default.session.setCookieName('cookieName');
20
- state.default.session.setCookieValue('cookieValue');
21
- state.default.session.setDeploymentType(globalConfig.CLOUD_DEPLOYMENT_TYPE_KEY);
22
- state.default.session.setDebug(true);
23
- state.default.session.setDebugHandler(outputHandler);
24
- state.default.session.setPrintHandler(outputHandler);
15
+ state.setHost('https://openam-volker-dev.forgeblocks.com/am');
16
+ state.setRealm('alpha');
17
+ state.setCookieName('cookieName');
18
+ state.setCookieValue('cookieValue');
19
+ state.setDeploymentType(globalConfig.CLOUD_DEPLOYMENT_TYPE_KEY);
20
+ state.setDebug(true);
21
+ state.setDebugHandler(outputHandler);
22
+ state.setPrintHandler(outputHandler);
25
23
  describe('Saml2Ops - createSaml2ExportTemplate()', () => {
26
24
  test('createSaml2ExportTemplate() 0: Method is implemented', async () => {
27
25
  expect(Saml2.createSaml2ExportTemplate).toBeDefined();
@@ -244,8 +242,8 @@ describe('Saml2Ops - importSaml2Provider()', () => {
244
242
  expect(mockSaml2ProviderId64).toEqual(entityId64);
245
243
  expect(mockSaml2ProviderLocation).toEqual(entityLocation);
246
244
  expect(isEqualJson(importData.saml[entityLocation][entityId64], mockSaml2ProviderObj, ['_rev'])).toBeTruthy();
247
- }); // expect 5 assertions because import contains 1 script
248
-
245
+ });
246
+ // expect 5 assertions because import contains 1 script
249
247
  expect.assertions(5);
250
248
  await Saml2.importSaml2Provider(entityId, importData);
251
249
  });
@@ -262,8 +260,8 @@ describe('Saml2Ops - importSaml2Provider()', () => {
262
260
  expect(mockSaml2ProviderId64).toEqual(entityId64);
263
261
  expect(mockSaml2ProviderLocation).toEqual(entityLocation);
264
262
  expect(isEqualJson(importData.saml[entityLocation][entityId64], mockSaml2ProviderObj, ['_rev'])).toBeTruthy();
265
- }); // expect 7 assertions because import contains 2 scripts
266
-
263
+ });
264
+ // expect 7 assertions because import contains 2 scripts
267
265
  expect.assertions(7);
268
266
  await Saml2.importSaml2Provider(entityId, importData);
269
267
  });
@@ -278,11 +276,11 @@ describe('Saml2Ops - importSaml2Provider()', () => {
278
276
  });
279
277
  mockCreateSaml2Provider(mock, (mockSaml2ProviderId64, mockSaml2ProviderLocation, mockSaml2ProviderObj) => {
280
278
  expect(mockSaml2ProviderId64).toEqual(entityId64);
281
- expect(mockSaml2ProviderLocation).toEqual(entityLocation); // this is an import of a remote identity provider, which can only be done using SAML2 metadata
282
-
279
+ expect(mockSaml2ProviderLocation).toEqual(entityLocation);
280
+ // this is an import of a remote identity provider, which can only be done using SAML2 metadata
283
281
  expect(mockSaml2ProviderObj.standardMetadata).toEqual(convertTextArrayToBase64Url(importData.saml.metadata[entityId64]));
284
- }); // expect only 3 assertions because import contains no scripts
285
-
282
+ });
283
+ // expect only 3 assertions because import contains no scripts
286
284
  expect.assertions(3);
287
285
  await Saml2.importSaml2Provider(entityId, importData);
288
286
  });
@@ -305,12 +303,11 @@ describe('Saml2Ops - importSaml2Providers()', () => {
305
303
  });
306
304
  mockCreateSaml2Provider(mock, (mockSaml2ProviderId64, mockSaml2ProviderLocation, mockSaml2ProviderObj) => {
307
305
  expect(allEntityIds64).toContain(mockSaml2ProviderId64);
308
- expect(mockSaml2ProviderLocation).toEqual(hostedEntityIds64.includes(mockSaml2ProviderId64) ? Saml2ProiderLocation.HOSTED : Saml2ProiderLocation.REMOTE); // for hosted providers compare the provider config, for remote providers compare the metadata
309
-
306
+ expect(mockSaml2ProviderLocation).toEqual(hostedEntityIds64.includes(mockSaml2ProviderId64) ? Saml2ProiderLocation.HOSTED : Saml2ProiderLocation.REMOTE);
307
+ // for hosted providers compare the provider config, for remote providers compare the metadata
310
308
  expect(isEqualJson(importData.saml[mockSaml2ProviderLocation][mockSaml2ProviderId64], mockSaml2ProviderObj, ['_rev']) || mockSaml2ProviderObj.standardMetadata === convertTextArrayToBase64Url(importData.saml.metadata[mockSaml2ProviderId64])).toBeTruthy();
311
309
  hostedEntityIds64 = hostedEntityIds64.filter(saml2ProviderId64 => saml2ProviderId64 !== mockSaml2ProviderId64);
312
310
  remoteEntityIds64 = remoteEntityIds64.filter(saml2ProviderId64 => saml2ProviderId64 !== mockSaml2ProviderId64);
313
-
314
311
  if (mockSaml2ProviderObj.standardMetadata) {
315
312
  metaDataIds64 = metaDataIds64.filter(saml2ProviderId64 => saml2ProviderId64 !== mockSaml2ProviderId64);
316
313
  }
@@ -319,8 +316,8 @@ describe('Saml2Ops - importSaml2Providers()', () => {
319
316
  await Saml2.importSaml2Providers(importData);
320
317
  expect(scriptIds.length).toBe(0);
321
318
  expect(hostedEntityIds64.length).toBe(0);
322
- expect(remoteEntityIds64.length).toBe(0); // frodo exports metadata for both hosted and remote providers but on import it is only required for remote providers
323
-
319
+ expect(remoteEntityIds64.length).toBe(0);
320
+ // frodo exports metadata for both hosted and remote providers but on import it is only required for remote providers
324
321
  expect(metaDataIds64.length).toBe(6);
325
322
  });
326
323
  });
@@ -5,16 +5,15 @@ import { createProgressIndicator, createTable, printMessage, stopProgressIndicat
5
5
  import { getScriptByName, getScripts, putScript } from '../api/ScriptApi';
6
6
  import wordwrap from './utils/Wordwrap';
7
7
  import { convertBase64TextToArray, convertTextArrayToBase64, getTypedFilename, saveToFile, titleCase, validateImport } from './utils/ExportImportUtils';
8
- import storage from '../storage/SessionStorage';
8
+ import * as state from '../shared/State';
9
+
9
10
  /**
10
11
  * List scripts
11
12
  */
12
-
13
13
  export async function listScripts(long = false) {
14
14
  try {
15
15
  const scripts = (await getScripts()).result;
16
16
  scripts.sort((a, b) => a.name.localeCompare(b.name));
17
-
18
17
  if (long) {
19
18
  const table = createTable(['Name', 'UUID', 'Language', 'Context', 'Description']);
20
19
  const langMap = {
@@ -34,93 +33,83 @@ export async function listScripts(long = false) {
34
33
  printMessage(`Error listing scripts - ${error}`, 'error');
35
34
  }
36
35
  }
36
+
37
37
  /**
38
38
  * Export script to file
39
39
  * @param {String} name script name
40
40
  * @param {String} file file name
41
41
  */
42
-
43
42
  export async function exportScriptByName(name, file) {
44
43
  let fileName = getTypedFilename(name, 'script');
45
-
46
44
  if (file) {
47
45
  fileName = file;
48
46
  }
49
-
50
47
  const scriptData = (await getScriptByName(name)).result;
51
-
52
48
  if (scriptData.length > 1) {
53
49
  printMessage(`Multiple scripts with name ${name} found...`, 'error');
54
50
  }
55
-
56
51
  scriptData.forEach(element => {
57
- const scriptTextArray = convertBase64TextToArray(element.script); // eslint-disable-next-line no-param-reassign
58
-
52
+ const scriptTextArray = convertBase64TextToArray(element.script);
53
+ // eslint-disable-next-line no-param-reassign
59
54
  element.script = scriptTextArray;
60
55
  });
61
56
  saveToFile('script', scriptData, '_id', fileName);
62
57
  }
58
+
63
59
  /**
64
60
  * Export all scripts to single file
65
61
  * @param {String} file file name
66
62
  */
67
-
68
63
  export async function exportScriptsToFile(file) {
69
- let fileName = getTypedFilename(`all${storage.session.getRealm()}Scripts`, 'script');
70
-
64
+ let fileName = getTypedFilename(`all${state.getRealm()}Scripts`, 'script');
71
65
  if (file) {
72
66
  fileName = file;
73
67
  }
74
-
75
68
  const scriptList = (await getScripts()).result;
76
69
  const allScriptsData = [];
77
70
  createProgressIndicator(scriptList.length, 'Exporting script');
78
-
79
71
  for (const item of scriptList) {
80
- updateProgressIndicator(`Reading script ${item.name}`); // eslint-disable-next-line no-await-in-loop
81
-
72
+ updateProgressIndicator(`Reading script ${item.name}`);
73
+ // eslint-disable-next-line no-await-in-loop
82
74
  const scriptData = (await getScriptByName(item.name)).result;
83
75
  scriptData.forEach(element => {
84
- const scriptTextArray = convertBase64TextToArray(element.script); // eslint-disable-next-line no-param-reassign
85
-
76
+ const scriptTextArray = convertBase64TextToArray(element.script);
77
+ // eslint-disable-next-line no-param-reassign
86
78
  element.script = scriptTextArray;
87
79
  allScriptsData.push(element);
88
80
  });
89
81
  }
90
-
91
82
  stopProgressIndicator('Done');
92
83
  saveToFile('script', allScriptsData, '_id', fileName);
93
84
  }
85
+
94
86
  /**
95
87
  * Export all scripts to individual files
96
88
  */
97
-
98
89
  export async function exportScriptsToFiles() {
99
90
  const scriptList = (await getScripts()).result;
100
91
  createProgressIndicator(scriptList.length, 'Exporting script');
101
-
102
92
  for (const item of scriptList) {
103
- updateProgressIndicator(`Reading script ${item.name}`); // eslint-disable-next-line no-await-in-loop
104
-
93
+ updateProgressIndicator(`Reading script ${item.name}`);
94
+ // eslint-disable-next-line no-await-in-loop
105
95
  const scriptData = (await getScriptByName(item.name)).result;
106
96
  scriptData.forEach(element => {
107
- const scriptTextArray = convertBase64TextToArray(element.script); // eslint-disable-next-line no-param-reassign
108
-
97
+ const scriptTextArray = convertBase64TextToArray(element.script);
98
+ // eslint-disable-next-line no-param-reassign
109
99
  element.script = scriptTextArray;
110
100
  });
111
101
  const fileName = getTypedFilename(item.name, 'script');
112
102
  saveToFile('script', scriptData, '_id', fileName);
113
103
  }
114
-
115
104
  stopProgressIndicator('Done');
116
105
  }
106
+
117
107
  /**
118
108
  * Import script
119
109
  * @param {String} id script uuid
120
110
  * @param {Object} data script object
121
111
  * @returns {Object} a status object
122
112
  */
123
-
124
113
  export async function createOrUpdateScript(id, data) {
125
114
  try {
126
115
  await putScript(id, data);
@@ -130,13 +119,12 @@ export async function createOrUpdateScript(id, data) {
130
119
  };
131
120
  } catch (e) {
132
121
  var _e$response;
133
-
134
122
  if (((_e$response = e.response) === null || _e$response === void 0 ? void 0 : _e$response.status) === 409) {
135
123
  printMessage(`createOrUpdateScript WARNING: script with name ${data.name} already exists, using renaming policy... <name> => <name - imported (n)>`, 'warn');
136
- const newName = applyNameCollisionPolicy(data.name); // console.log(newName);
137
-
138
- printMessage(`Trying to save script as ${newName}`, 'warn'); // eslint-disable-next-line no-param-reassign
139
-
124
+ const newName = applyNameCollisionPolicy(data.name);
125
+ // console.log(newName);
126
+ printMessage(`Trying to save script as ${newName}`, 'warn');
127
+ // eslint-disable-next-line no-param-reassign
140
128
  data.name = newName;
141
129
  await createOrUpdateScript(id, data);
142
130
  return {
@@ -144,7 +132,6 @@ export async function createOrUpdateScript(id, data) {
144
132
  name: data.name
145
133
  };
146
134
  }
147
-
148
135
  printMessage(`createOrUpdateScript ERROR: put script error, script ${id} - ${e.message}`, 'error');
149
136
  return {
150
137
  error: true,
@@ -156,42 +143,37 @@ export async function importScriptsFromFile(name, file, reUuid = false) {
156
143
  fs.readFile(file, 'utf8', (err, data) => {
157
144
  if (err) throw err;
158
145
  const scriptData = JSON.parse(data);
159
-
160
146
  if (validateImport(scriptData.meta)) {
161
147
  createProgressIndicator(Object.keys(scriptData.script).length, '');
162
-
163
148
  for (const existingId in scriptData.script) {
164
149
  if ({}.hasOwnProperty.call(scriptData.script, existingId)) {
165
- let newId = existingId; // console.log(id);
166
-
150
+ let newId = existingId;
151
+ // console.log(id);
167
152
  const encodedScript = convertTextArrayToBase64(scriptData.script[existingId].script);
168
153
  scriptData.script[existingId].script = encodedScript;
169
-
170
154
  if (reUuid) {
171
- newId = uuidv4(); // printMessage(
155
+ newId = uuidv4();
156
+ // printMessage(
172
157
  // `Re-uuid-ing script ${scriptData.script[existingId].name} ${existingId} => ${newId}...`
173
158
  // );
174
-
175
159
  scriptData.script[existingId]._id = newId;
176
160
  }
177
-
178
161
  if (name) {
179
162
  // printMessage(
180
163
  // `Renaming script ${scriptData.script[existingId].name} => ${options.script}...`
181
164
  // );
182
165
  scriptData.script[existingId].name = name;
183
166
  }
184
-
185
- updateProgressIndicator(`Importing ${scriptData.script[existingId].name}`); // console.log(scriptData.script[id]);
186
-
167
+ updateProgressIndicator(`Importing ${scriptData.script[existingId].name}`);
168
+ // console.log(scriptData.script[id]);
187
169
  createOrUpdateScript(newId, scriptData.script[existingId]).then(result => {
188
170
  if (result == null) printMessage(`Error importing ${scriptData.script[existingId].name}`, 'error');
189
171
  });
190
172
  if (name) break;
191
173
  }
192
174
  }
193
-
194
- stopProgressIndicator('Done'); // printMessage('Done');
175
+ stopProgressIndicator('Done');
176
+ // printMessage('Done');
195
177
  } else {
196
178
  printMessage('Import validation failed...', 'error');
197
179
  }
@@ -2,21 +2,19 @@ import { createKeyValueTable, createProgressIndicator, createTable, printMessage
2
2
  import { createNewVersionOfSecret, deleteSecret, deleteVersionOfSecret, getSecret, getSecrets, getSecretVersions, putSecret, setSecretDescription, setStatusOfVersionOfSecret, VersionOfSecretStatus } from '../api/SecretsApi';
3
3
  import wordwrap from './utils/Wordwrap';
4
4
  import { resolveUserName } from './ManagedObjectOps';
5
+
5
6
  /**
6
7
  * List secrets
7
8
  * @param {boolean} long Long version, all the fields
8
9
  */
9
-
10
10
  export async function listSecrets(long) {
11
11
  let secrets = [];
12
-
13
12
  try {
14
13
  secrets = (await getSecrets()).result;
15
14
  } catch (error) {
16
15
  printMessage(`${error.message}`, 'error');
17
16
  printMessage(error.response.data, 'error');
18
17
  }
19
-
20
18
  if (long) {
21
19
  const table = createTable(['Id'['brightCyan'], {
22
20
  hAlign: 'right',
@@ -26,7 +24,6 @@ export async function listSecrets(long) {
26
24
  content: 'Loaded\nVersion'['brightCyan']
27
25
  }, 'Status'['brightCyan'], 'Description'['brightCyan'], 'Modifier'['brightCyan'], 'Modified'['brightCyan']]);
28
26
  secrets.sort((a, b) => a._id.localeCompare(b._id));
29
-
30
27
  for (const secret of secrets) {
31
28
  table.push([secret._id, {
32
29
  hAlign: 'right',
@@ -34,10 +31,10 @@ export async function listSecrets(long) {
34
31
  }, {
35
32
  hAlign: 'right',
36
33
  content: secret.loadedVersion
37
- }, secret.loaded ? 'loaded'['brightGreen'] : 'unloaded'['brightRed'], wordwrap(secret.description, 40), // eslint-disable-next-line no-await-in-loop
34
+ }, secret.loaded ? 'loaded'['brightGreen'] : 'unloaded'['brightRed'], wordwrap(secret.description, 40),
35
+ // eslint-disable-next-line no-await-in-loop
38
36
  await resolveUserName('teammember', secret.lastChangedBy), new Date(secret.lastChangeDate).toLocaleString()]);
39
37
  }
40
-
41
38
  printMessage(table.toString());
42
39
  } else {
43
40
  secrets.forEach(secret => {
@@ -45,6 +42,7 @@ export async function listSecrets(long) {
45
42
  });
46
43
  }
47
44
  }
45
+
48
46
  /**
49
47
  * Create secret
50
48
  * @param {String} id secret id
@@ -53,10 +51,8 @@ export async function listSecrets(long) {
53
51
  * @param {String} encoding secret encoding
54
52
  * @param {boolean} useInPlaceholders use secret in placeholders
55
53
  */
56
-
57
54
  export async function createSecret(id, value, description, encoding, useInPlaceholders) {
58
55
  createProgressIndicator(undefined, `Creating secret ${id}...`, 'indeterminate');
59
-
60
56
  try {
61
57
  await putSecret(id, value, description, encoding, useInPlaceholders);
62
58
  stopProgressIndicator(`Created secret ${id}`, 'success');
@@ -64,15 +60,14 @@ export async function createSecret(id, value, description, encoding, useInPlaceh
64
60
  stopProgressIndicator(`Error: ${error.response.data.code} - ${error.response.data.message}`, 'fail');
65
61
  }
66
62
  }
63
+
67
64
  /**
68
65
  * Set description of secret
69
66
  * @param {String} secretId secret id
70
67
  * @param {String} description secret description
71
68
  */
72
-
73
69
  export async function setDescriptionOfSecret(secretId, description) {
74
70
  createProgressIndicator(undefined, `Setting description of secret ${secretId}...`, 'indeterminate');
75
-
76
71
  try {
77
72
  await setSecretDescription(secretId, description);
78
73
  stopProgressIndicator(`Set description of secret ${secretId}`, 'success');
@@ -80,14 +75,13 @@ export async function setDescriptionOfSecret(secretId, description) {
80
75
  stopProgressIndicator(`Error: ${error.response.data.code} - ${error.response.data.message}`, 'fail');
81
76
  }
82
77
  }
78
+
83
79
  /**
84
80
  * Delete a secret
85
81
  * @param {String} secretId secret id
86
82
  */
87
-
88
83
  export async function deleteSecretCmd(secretId) {
89
84
  createProgressIndicator(undefined, `Deleting secret ${secretId}...`, 'indeterminate');
90
-
91
85
  try {
92
86
  await deleteSecret(secretId);
93
87
  stopProgressIndicator(`Deleted secret ${secretId}`, 'success');
@@ -95,15 +89,14 @@ export async function deleteSecretCmd(secretId) {
95
89
  stopProgressIndicator(`Error: ${error.response.data.code} - ${error.response.data.message}`, 'fail');
96
90
  }
97
91
  }
92
+
98
93
  /**
99
94
  * Delete all secrets
100
95
  */
101
-
102
96
  export async function deleteSecretsCmd() {
103
97
  try {
104
98
  const secrets = (await getSecrets()).result;
105
99
  createProgressIndicator(secrets.length, `Deleting secrets...`);
106
-
107
100
  for (const secret of secrets) {
108
101
  try {
109
102
  // eslint-disable-next-line no-await-in-loop
@@ -113,52 +106,47 @@ export async function deleteSecretsCmd() {
113
106
  printMessage(`Error: ${error.response.data.code} - ${error.response.data.message}`, 'error');
114
107
  }
115
108
  }
116
-
117
109
  stopProgressIndicator(`Secrets deleted.`);
118
110
  } catch (error) {
119
111
  printMessage(`Error: ${error.response.data.code} - ${error.response.data.message}`, 'error');
120
112
  }
121
113
  }
114
+
122
115
  /**
123
116
  * List all the versions of the secret
124
117
  * @param {String} secretId secret id
125
118
  */
126
-
127
119
  export async function listSecretVersionsCmd(secretId) {
128
120
  let versions = [];
129
-
130
121
  try {
131
122
  versions = await getSecretVersions(secretId);
132
123
  } catch (error) {
133
124
  printMessage(`${error.message}`, 'error');
134
125
  printMessage(error.response.data, 'error');
135
126
  }
136
-
137
127
  const table = createTable([{
138
128
  hAlign: 'right',
139
129
  content: 'Version'['brightCyan']
140
- }, 'Status'['brightCyan'], 'Loaded'['brightCyan'], 'Created'['brightCyan']]); // versions.sort((a, b) => a._id.localeCompare(b._id));
141
-
130
+ }, 'Status'['brightCyan'], 'Loaded'['brightCyan'], 'Created'['brightCyan']]);
131
+ // versions.sort((a, b) => a._id.localeCompare(b._id));
142
132
  const statusMap = {
143
133
  ENABLED: 'active'['brightGreen'],
144
134
  DISABLED: 'inactive'['brightRed'],
145
135
  DESTROYED: 'deleted'['brightRed']
146
136
  };
147
-
148
137
  for (const version of versions) {
149
138
  table.push([{
150
139
  hAlign: 'right',
151
140
  content: version.version
152
141
  }, statusMap[version.status], version.loaded ? 'loaded'['brightGreen'] : 'unloaded'['brightRed'], new Date(version.createDate).toLocaleString()]);
153
142
  }
154
-
155
143
  printMessage(table.toString());
156
144
  }
145
+
157
146
  /**
158
147
  * Describe a secret
159
148
  * @param {String} secretId Secret id
160
149
  */
161
-
162
150
  export async function describeSecret(secretId) {
163
151
  const secret = await getSecret(secretId);
164
152
  const table = createKeyValueTable();
@@ -176,15 +164,14 @@ export async function describeSecret(secretId) {
176
164
  printMessage('\nSecret Versions:');
177
165
  await listSecretVersionsCmd(secretId);
178
166
  }
167
+
179
168
  /**
180
169
  * Create new version of secret
181
170
  * @param {String} secretId secret id
182
171
  * @param {String} value secret value
183
172
  */
184
-
185
173
  export async function createNewVersionOfSecretCmd(secretId, value) {
186
174
  createProgressIndicator(undefined, `Creating new version of secret ${secretId}...`, 'indeterminate');
187
-
188
175
  try {
189
176
  const version = await createNewVersionOfSecret(secretId, value);
190
177
  stopProgressIndicator(`Created version ${version.version} of secret ${secretId}`, 'success');
@@ -192,15 +179,14 @@ export async function createNewVersionOfSecretCmd(secretId, value) {
192
179
  stopProgressIndicator(`Error: ${error.response.data.code} - ${error.response.data.message}`, 'fail');
193
180
  }
194
181
  }
182
+
195
183
  /**
196
184
  * Activate a version of a secret
197
185
  * @param {String} secretId secret id
198
186
  * @param {Number} version version of secret
199
187
  */
200
-
201
188
  export async function activateVersionOfSecret(secretId, version) {
202
189
  createProgressIndicator(undefined, `Activating version ${version} of secret ${secretId}...`, 'indeterminate');
203
-
204
190
  try {
205
191
  await setStatusOfVersionOfSecret(secretId, version, VersionOfSecretStatus.ENABLED);
206
192
  stopProgressIndicator(`Activated version ${version} of secret ${secretId}`, 'success');
@@ -208,15 +194,14 @@ export async function activateVersionOfSecret(secretId, version) {
208
194
  stopProgressIndicator(`Error: ${error.response.data.code} - ${error.response.data.message}`, 'fail');
209
195
  }
210
196
  }
197
+
211
198
  /**
212
199
  * Deactivate a version of a secret
213
200
  * @param {String} secretId secret id
214
201
  * @param {Number} version version of secret
215
202
  */
216
-
217
203
  export async function deactivateVersionOfSecret(secretId, version) {
218
204
  createProgressIndicator(undefined, `Deactivating version ${version} of secret ${secretId}...`, 'indeterminate');
219
-
220
205
  try {
221
206
  await setStatusOfVersionOfSecret(secretId, version, VersionOfSecretStatus.DISABLED);
222
207
  stopProgressIndicator(`Deactivated version ${version} of secret ${secretId}`, 'success');
@@ -224,15 +209,14 @@ export async function deactivateVersionOfSecret(secretId, version) {
224
209
  stopProgressIndicator(`Error: ${error.response.data.code} - ${error.response.data.message}`, 'fail');
225
210
  }
226
211
  }
212
+
227
213
  /**
228
214
  * Delete version of secret
229
215
  * @param {String} secretId secret id
230
216
  * @param {Number} version version of secret
231
217
  */
232
-
233
218
  export async function deleteVersionOfSecretCmd(secretId, version) {
234
219
  createProgressIndicator(undefined, `Deleting version ${version} of secret ${secretId}...`, 'indeterminate');
235
-
236
220
  try {
237
221
  await deleteVersionOfSecret(secretId, version);
238
222
  stopProgressIndicator(`Deleted version ${version} of secret ${secretId}`, 'success');
@@ -0,0 +1,41 @@
1
+ import { createManagedObject } from '../api/ManagedObjectApi';
2
+ import { debugMessage } from './utils/Console';
3
+ import { getConfigEntity } from './IdmOps';
4
+ const moType = 'svcacct';
5
+ let serviceAccountsFeatureAvailable = undefined;
6
+ export async function isServiceAccountsFeatureAvailable() {
7
+ debugMessage(`ServiceAccountOps.isServiceAccountsFeatureAvailable: start`);
8
+ // only look up the schema once
9
+ if (typeof serviceAccountsFeatureAvailable !== 'undefined') return serviceAccountsFeatureAvailable;
10
+ serviceAccountsFeatureAvailable = false;
11
+ const schema = await getConfigEntity('managed');
12
+ for (const object of schema['objects']) {
13
+ if (object['name'] === 'svcacct') serviceAccountsFeatureAvailable = true;
14
+ }
15
+ debugMessage(`ServiceAccountOps.isServiceAccountsFeatureAvailable: end, available=${serviceAccountsFeatureAvailable}`);
16
+ return serviceAccountsFeatureAvailable;
17
+ }
18
+
19
+ /**
20
+ * Create service account
21
+ * @param {string} name Human-readable name of service account
22
+ * @param {string} description Description of service account
23
+ * @param {'Active' | 'Inactive'} accountStatus Service account status
24
+ * @param {string[]} scopes Scopes.
25
+ * @param {JwksInterface} jwks Java Web Key Set
26
+ * @returns {Promise<ObjectSkeletonInterface>} A promise resolving to a service account object
27
+ */
28
+ export async function createServiceAccount(name, description, accountStatus, scopes, jwks) {
29
+ const payload = {
30
+ name,
31
+ description,
32
+ accountStatus,
33
+ scopes,
34
+ jwks: JSON.stringify(jwks)
35
+ };
36
+ debugMessage(`SvcacctOps: createSvcacct: payload:`);
37
+ debugMessage(payload);
38
+ const result = await createManagedObject(moType, payload);
39
+ return result;
40
+ }
41
+ //# sourceMappingURL=ServiceAccountOps.js.map
@@ -0,0 +1,51 @@
1
+ import axios from 'axios';
2
+ import MockAdapter from 'axios-mock-adapter';
3
+ import { state } from '../index';
4
+ import * as globalConfig from '../storage/StaticStorage';
5
+ import { createJwkRsa, createJwks, getJwkRsaPublic } from './JoseOps';
6
+ import * as ServiceAccount from './ServiceAccountOps';
7
+ import { mockCreateManagedObject } from '../test/mocks/ForgeRockApiMockEngine';
8
+ import { isEqualJson } from './utils/OpsUtils';
9
+ const mock = new MockAdapter(axios);
10
+ const outputHandler = message => {
11
+ console.log(message);
12
+ };
13
+ state.setHost('https://openam-frodo-dev.forgeblocks.com/am');
14
+ state.setRealm('alpha');
15
+ state.setCookieName('cookieName');
16
+ state.setCookieValue('cookieValue');
17
+ state.setDeploymentType(globalConfig.CLOUD_DEPLOYMENT_TYPE_KEY);
18
+ state.setDebug(true);
19
+ state.setDebugHandler(outputHandler);
20
+ state.setPrintHandler(outputHandler);
21
+ state.setCurlirize(true);
22
+ state.setCurlirizeHandler(outputHandler);
23
+ describe('SvcacctOps - createSvcacct()', () => {
24
+ test('createSvcacct() 0: Method is implemented', async () => {
25
+ expect(ServiceAccount.createServiceAccount).toBeDefined();
26
+ });
27
+ test('createSvcacct() 1: Create service account', async () => {
28
+ let moId = null;
29
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
30
+ let moData = null;
31
+ const name = 'sa';
32
+ const description = 'service account';
33
+ const accountStatus = 'Active';
34
+ const scopes = ['fr:am:*', 'fr:idm:*', 'fr:idc:esv:*'];
35
+ const jwk = await createJwkRsa();
36
+ const publicJwk = await getJwkRsaPublic(jwk);
37
+ const jwks = await createJwks(publicJwk);
38
+ mockCreateManagedObject(mock, (mockManagedObjId, mockManagedObj) => {
39
+ moId = mockManagedObjId;
40
+ moData = mockManagedObj;
41
+ });
42
+ const payload = await ServiceAccount.createServiceAccount(name, description, accountStatus, scopes, jwks);
43
+ expect(isEqualJson(payload, moData)).toBeTruthy();
44
+ expect(payload).toBeTruthy();
45
+ expect(payload._id).toBe(moId);
46
+ expect(payload.name).toBe(name);
47
+ expect(payload.description).toBe(description);
48
+ expect(payload.scopes).toStrictEqual(scopes);
49
+ });
50
+ });
51
+ //# sourceMappingURL=ServiceAccountOps.test.js.map