@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
@@ -4,24 +4,22 @@ import { TreeRaw, state } from '../index';
4
4
  import fs from 'fs';
5
5
  import path from 'path';
6
6
  import { fileURLToPath } from 'url';
7
-
8
7
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
9
-
10
8
  const mock = new MockAdapter(axios);
11
- state.default.session.setTenant('');
12
- state.default.session.setRealm('alpha');
13
- state.default.session.setCookieName('cookieName');
14
- state.default.session.setCookieValue('cookieValue');
9
+ state.setHost('');
10
+ state.setRealm('alpha');
11
+ state.setCookieName('cookieName');
12
+ state.setCookieValue('cookieValue');
15
13
  describe('TreeApi - getTrees()', () => {
16
14
  test('getTrees() 0: Method is implemented', async () => {
17
15
  expect(TreeRaw.getTrees).toBeDefined();
18
16
  });
19
17
  test('getTrees() 1: Get all trees', async () => {
20
18
  const response = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../test/mocks/TreeApi/getTrees/trees.json'), 'utf8'));
21
- mock.onGet('/json/realms/root/realms/alpha/realm-config/authentication/authenticationtrees/trees?_queryFilter=true').reply(200, response);
19
+ mock.onGet(`${state.getHost()}/json/realms/root/realms/alpha/realm-config/authentication/authenticationtrees/trees?_queryFilter=true`).reply(200, response);
22
20
  const trees = await TreeRaw.getTrees();
23
21
  expect(trees).toBeTruthy();
24
- expect(trees.result.length).toBe(92);
22
+ expect(trees).toMatchSnapshot();
25
23
  });
26
24
  });
27
25
  describe('TreeApi - getTree()', () => {
@@ -30,28 +28,21 @@ describe('TreeApi - getTree()', () => {
30
28
  });
31
29
  test('getTree() 1: Get existing tree', async () => {
32
30
  const response = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../test/mocks/TreeApi/getTree/FrodoTest.json'), 'utf8'));
33
- mock.onGet('/json/realms/root/realms/alpha/realm-config/authentication/authenticationtrees/trees/FrodoTest').reply(200, response);
31
+ mock.onGet(`${state.getHost()}/json/realms/root/realms/alpha/realm-config/authentication/authenticationtrees/trees/FrodoTest`).reply(200, response);
34
32
  const tree = await TreeRaw.getTree('FrodoTest');
35
33
  expect(tree).toBeTruthy();
36
- expect(tree._id).toEqual('FrodoTest');
34
+ expect(tree).toMatchSnapshot();
37
35
  });
38
36
  test('getTree() 2: Get non-existing tree', async () => {
39
- mock.onGet('/json/realms/root/realms/alpha/realm-config/authentication/authenticationtrees/trees/DoesNotExist').reply(404, {
37
+ mock.onGet(`${state.getHost()}/json/realms/root/realms/alpha/realm-config/authentication/authenticationtrees/trees/DoesNotExist`).reply(404, {
40
38
  code: 404,
41
39
  reason: 'Not Found',
42
40
  message: 'Not Found'
43
41
  });
44
- expect.assertions(2);
45
-
46
42
  try {
47
43
  await TreeRaw.getTree('DoesNotExist');
48
44
  } catch (error) {
49
- expect(error.response).toBeTruthy();
50
- expect(error.response.data).toMatchObject({
51
- code: 404,
52
- reason: 'Not Found',
53
- message: 'Not Found'
54
- });
45
+ expect(error.response.data).toMatchSnapshot();
55
46
  }
56
47
  });
57
48
  });
@@ -61,34 +52,29 @@ describe('TreeApi - putTree()', () => {
61
52
  });
62
53
  test('putTree() 1: Put valid tree', async () => {
63
54
  const response = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../test/mocks/TreeApi/putTree/FrodoTest.json'), 'utf8'));
64
- mock.onPut('/json/realms/root/realms/alpha/realm-config/authentication/authenticationtrees/trees/FrodoTest').reply(201, response);
55
+ mock.onPut(`${state.getHost()}/json/realms/root/realms/alpha/realm-config/authentication/authenticationtrees/trees/FrodoTest`).reply(201, response);
65
56
  const tree = await TreeRaw.putTree('FrodoTest', response);
66
57
  expect(tree).toBeTruthy();
67
- expect(tree._id).toEqual('FrodoTest');
58
+ expect(tree).toMatchSnapshot();
68
59
  });
69
60
  test('putTree() 2: Put invalid tree [trailing data]', async () => {
70
61
  const request = fs.readFileSync(path.resolve(__dirname, '../test/mocks/TreeApi/putTree/Invalid_trailing-data.txt'), 'utf8');
71
- mock.onPut('/json/realms/root/realms/alpha/realm-config/authentication/authenticationtrees/trees/Invalid').reply(400, {
62
+ mock.onPut(`${state.getHost()}/json/realms/root/realms/alpha/realm-config/authentication/authenticationtrees/trees/Invalid`).reply(400, {
72
63
  code: 400,
73
64
  reason: 'Bad Request',
74
65
  message: 'The request could not be processed because there is trailing data after the JSON content'
75
66
  });
76
67
  expect.assertions(2);
77
-
78
68
  try {
79
69
  await TreeRaw.putTree('Invalid', request);
80
70
  } catch (error) {
81
71
  expect(error.response).toBeTruthy();
82
- expect(error.response.data).toMatchObject({
83
- code: 400,
84
- reason: 'Bad Request',
85
- message: 'The request could not be processed because there is trailing data after the JSON content'
86
- });
72
+ expect(error.response.data).toMatchSnapshot();
87
73
  }
88
74
  });
89
75
  test('putTree() 3: Put invalid tree [invalid attribute]', async () => {
90
76
  const request = fs.readFileSync(path.resolve(__dirname, '../test/mocks/TreeApi/putTree/Invalid_invalid-attribute.json'), 'utf8');
91
- mock.onPut('/json/realms/root/realms/alpha/realm-config/authentication/authenticationtrees/trees/Invalid').reply(400, {
77
+ mock.onPut(`${state.getHost()}/json/realms/root/realms/alpha/realm-config/authentication/authenticationtrees/trees/Invalid`).reply(400, {
92
78
  code: 400,
93
79
  reason: 'Bad Request',
94
80
  message: 'Invalid attribute specified.',
@@ -97,59 +83,41 @@ describe('TreeApi - putTree()', () => {
97
83
  }
98
84
  });
99
85
  expect.assertions(2);
100
-
101
86
  try {
102
87
  await TreeRaw.putTree('Invalid', request);
103
88
  } catch (error) {
104
89
  expect(error.response).toBeTruthy();
105
- expect(error.response.data).toMatchObject({
106
- code: 400,
107
- reason: 'Bad Request',
108
- message: 'Invalid attribute specified.',
109
- detail: {
110
- validAttributes: ['description', 'enabled', 'entryNodeId', 'identityResource', 'nodes', 'staticNodes', 'uiConfig']
111
- }
112
- });
90
+ expect(error.response.data).toMatchSnapshot();
113
91
  }
114
92
  });
115
93
  test('putTree() 4: Put invalid tree [no entry node]', async () => {
116
94
  const request = fs.readFileSync(path.resolve(__dirname, '../test/mocks/TreeApi/putTree/Invalid_no-entry-node.json'), 'utf8');
117
- mock.onPut('/json/realms/root/realms/alpha/realm-config/authentication/authenticationtrees/trees/Invalid').reply(400, {
95
+ mock.onPut(`${state.getHost()}/json/realms/root/realms/alpha/realm-config/authentication/authenticationtrees/trees/Invalid`).reply(400, {
118
96
  code: 400,
119
97
  reason: 'Bad Request',
120
98
  message: 'Node with ID entryNodeId must exist in the tree.'
121
99
  });
122
100
  expect.assertions(2);
123
-
124
101
  try {
125
102
  await TreeRaw.putTree('Invalid', request);
126
103
  } catch (error) {
127
104
  expect(error.response).toBeTruthy();
128
- expect(error.response.data).toMatchObject({
129
- code: 400,
130
- reason: 'Bad Request',
131
- message: 'Node with ID entryNodeId must exist in the tree.'
132
- });
105
+ expect(error.response.data).toMatchSnapshot();
133
106
  }
134
107
  });
135
108
  test('putTree() 5: Put invalid tree [invalid nodes]', async () => {
136
109
  const request = fs.readFileSync(path.resolve(__dirname, '../test/mocks/TreeApi/putTree/Invalid_invalid-nodes.json'), 'utf8');
137
- mock.onPut('/json/realms/root/realms/alpha/realm-config/authentication/authenticationtrees/trees/Invalid').reply(400, {
110
+ mock.onPut(`${state.getHost()}/json/realms/root/realms/alpha/realm-config/authentication/authenticationtrees/trees/Invalid`).reply(400, {
138
111
  code: 400,
139
112
  reason: 'Bad Request',
140
113
  message: 'Node with ID entryNodeId must exist in the tree.'
141
114
  });
142
115
  expect.assertions(2);
143
-
144
116
  try {
145
117
  await TreeRaw.putTree('Invalid', request);
146
118
  } catch (error) {
147
119
  expect(error.response).toBeTruthy();
148
- expect(error.response.data).toMatchObject({
149
- code: 400,
150
- reason: 'Bad Request',
151
- message: 'Node with ID entryNodeId must exist in the tree.'
152
- });
120
+ expect(error.response.data).toMatchSnapshot();
153
121
  }
154
122
  });
155
123
  });
@@ -159,28 +127,23 @@ describe('TreeApi - deleteTree()', () => {
159
127
  });
160
128
  test('deleteTree() 1: Delete existing tree', async () => {
161
129
  const response = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../test/mocks/TreeApi/deleteTree/FrodoTest.json'), 'utf8'));
162
- mock.onDelete('/json/realms/root/realms/alpha/realm-config/authentication/authenticationtrees/trees/FrodoTest').reply(200, response);
130
+ mock.onDelete(`${state.getHost()}/json/realms/root/realms/alpha/realm-config/authentication/authenticationtrees/trees/FrodoTest`).reply(200, response);
163
131
  const tree = await TreeRaw.deleteTree('FrodoTest');
164
132
  expect(tree).toBeTruthy();
165
- expect(tree._id).toEqual('FrodoTest');
133
+ expect(tree).toMatchSnapshot();
166
134
  });
167
135
  test('deleteTree() 2: Delete non-existing tree', async () => {
168
- mock.onDelete('/json/realms/root/realms/alpha/realm-config/authentication/authenticationtrees/trees/DoesNotExist').reply(404, {
136
+ mock.onDelete(`${state.getHost()}/json/realms/root/realms/alpha/realm-config/authentication/authenticationtrees/trees/DoesNotExist`).reply(404, {
169
137
  code: 404,
170
138
  reason: 'Not Found',
171
139
  message: 'Not Found'
172
140
  });
173
141
  expect.assertions(2);
174
-
175
142
  try {
176
143
  await TreeRaw.deleteTree('DoesNotExist');
177
144
  } catch (error) {
178
145
  expect(error.response).toBeTruthy();
179
- expect(error.response.data).toMatchObject({
180
- code: 404,
181
- reason: 'Not Found',
182
- message: 'Not Found'
183
- });
146
+ expect(error.response.data).toMatchSnapshot();
184
147
  }
185
148
  });
186
149
  });
@@ -2,12 +2,11 @@ import util from 'util';
2
2
  import { encode } from './utils/Base64';
3
3
  import { getTenantURL, getCurrentRealmPath } from './utils/ApiUtils';
4
4
  import { generateESVApi } from './BaseApi';
5
- import storage from '../storage/SessionStorage';
5
+ import * as state from '../shared/State';
6
6
  const variablesListURLTemplate = '%s/environment/variables';
7
7
  const variableURLTemplate = '%s/environment/variables/%s';
8
8
  const variableSetDescriptionURLTemplate = `${variableURLTemplate}?_action=setDescription`;
9
9
  const apiVersion = 'protocol=1.0,resource=1.0';
10
-
11
10
  const getApiConfig = () => {
12
11
  const configPath = getCurrentRealmPath();
13
12
  return {
@@ -15,14 +14,13 @@ const getApiConfig = () => {
15
14
  apiVersion
16
15
  };
17
16
  };
17
+
18
18
  /**
19
19
  * Get all variables
20
20
  * @returns {Promise<unknown[]>} a promise that resolves to an array of variable objects
21
21
  */
22
-
23
-
24
22
  export async function getVariables() {
25
- const urlString = util.format(variablesListURLTemplate, getTenantURL(storage.session.getTenant()));
23
+ const urlString = util.format(variablesListURLTemplate, getTenantURL(state.getHost()));
26
24
  const {
27
25
  data
28
26
  } = await generateESVApi(getApiConfig()).get(urlString, {
@@ -30,14 +28,14 @@ export async function getVariables() {
30
28
  });
31
29
  return data;
32
30
  }
31
+
33
32
  /**
34
33
  * Get variable by id/name
35
34
  * @param {string} variableId variable id/name
36
35
  * @returns {Promise<unknown>} a promise that resolves to a variable object
37
36
  */
38
-
39
37
  export async function getVariable(variableId) {
40
- const urlString = util.format(variableURLTemplate, getTenantURL(storage.session.getTenant()), variableId);
38
+ const urlString = util.format(variableURLTemplate, getTenantURL(state.getHost()), variableId);
41
39
  const {
42
40
  data
43
41
  } = await generateESVApi(getApiConfig()).get(urlString, {
@@ -45,6 +43,7 @@ export async function getVariable(variableId) {
45
43
  });
46
44
  return data;
47
45
  }
46
+
48
47
  /**
49
48
  * Put variable by id/name
50
49
  * @param {string} variableId variable id/name
@@ -52,12 +51,11 @@ export async function getVariable(variableId) {
52
51
  * @param {string} description variable description
53
52
  * @returns {Promise<unknown>} a promise that resolves to a variable object
54
53
  */
55
-
56
54
  export async function putVariable(variableId, value, description) {
57
55
  const variableData = {};
58
56
  if (value) variableData['valueBase64'] = encode(value);
59
57
  if (description) variableData['description'] = description;
60
- const urlString = util.format(variableURLTemplate, getTenantURL(storage.session.getTenant()), variableId);
58
+ const urlString = util.format(variableURLTemplate, getTenantURL(state.getHost()), variableId);
61
59
  const {
62
60
  data
63
61
  } = await generateESVApi(getApiConfig()).put(urlString, variableData, {
@@ -65,15 +63,15 @@ export async function putVariable(variableId, value, description) {
65
63
  });
66
64
  return data;
67
65
  }
66
+
68
67
  /**
69
68
  * Set variable description
70
69
  * @param {string} variableId variable id/name
71
70
  * @param {string} description variable description
72
71
  * @returns {Promise<unknown>} a promise that resolves to a status object
73
72
  */
74
-
75
73
  export async function setVariableDescription(variableId, description) {
76
- const urlString = util.format(variableSetDescriptionURLTemplate, getTenantURL(storage.session.getTenant()), variableId);
74
+ const urlString = util.format(variableSetDescriptionURLTemplate, getTenantURL(state.getHost()), variableId);
77
75
  const {
78
76
  data
79
77
  } = await generateESVApi(getApiConfig()).post(urlString, {
@@ -83,14 +81,14 @@ export async function setVariableDescription(variableId, description) {
83
81
  });
84
82
  return data;
85
83
  }
84
+
86
85
  /**
87
86
  * Delete variable by id/name
88
87
  * @param {string} variableId variable id/name
89
88
  * @returns {Promise<unknown>} a promise that resolves to a variable object
90
89
  */
91
-
92
90
  export async function deleteVariable(variableId) {
93
- const urlString = util.format(variableURLTemplate, getTenantURL(storage.session.getTenant()), variableId);
91
+ const urlString = util.format(variableURLTemplate, getTenantURL(state.getHost()), variableId);
94
92
  const {
95
93
  data
96
94
  } = await generateESVApi(getApiConfig()).delete(urlString, {
@@ -1,229 +1,87 @@
1
- import axios from 'axios';
2
- import MockAdapter from 'axios-mock-adapter';
3
- import { VariablesRaw, state } from '../index';
4
- const mock = new MockAdapter(axios);
5
- state.default.session.setTenant('https://openam-frodo-dev.forgeblocks.com/am');
6
- state.default.session.setRealm('alpha');
7
- state.default.session.setCookieName('cookieName');
8
- state.default.session.setCookieValue('cookieValue');
9
- describe('VariablesApi - getVariables()', () => {
10
- test('getVariables() 0: Method is implemented', async () => {
11
- expect(VariablesRaw.getVariables).toBeDefined();
1
+ import { VariablesRaw } from '../index';
2
+ import autoSetupPolly from '../utils/AutoSetupPolly';
3
+ const pollyContext = autoSetupPolly();
4
+ describe('VariablesApi', () => {
5
+ describe('VariablesApi - getVariables()', () => {
6
+ test('getVariables() 0: Method is implemented', async () => {
7
+ expect(VariablesRaw.getVariables).toBeDefined();
8
+ });
9
+ test('getVariables() 1: Get all variables - success', async () => {
10
+ const response = await VariablesRaw.getVariables();
11
+ expect(response).toMatchSnapshot();
12
+ });
13
+ test('getVariables() 2: Get all variables - error', async () => {
14
+ try {
15
+ await VariablesRaw.getVariables();
16
+ } catch (error) {
17
+ expect(error.response.data).toMatchSnapshot();
18
+ }
19
+ });
12
20
  });
13
- test('getVariables() 1: Get all variables - success', async () => {
14
- const mockResponse = {
15
- pagedResultsCookie: null,
16
- remainingPagedResults: -1,
17
- result: [{
18
- _id: 'esv-twilio-phone-number',
19
- description: 'Twilio phone number. Get your own at: https://twilio.com',
20
- expressionType: '',
21
- lastChangeDate: '2022-08-12T21:27:18.560Z',
22
- lastChangedBy: 'c5f3cf35-4cc1-42f9-80b3-59e1ca842510',
23
- loaded: true,
24
- valueBase64: 'KzEzMTc2NDQzMTA3'
25
- }, {
26
- _id: 'esv-461016d8d2-configurationpropertiescredentials',
27
- description: 'Configuration parameter /configurationProperties/credentials in file idm/conf/provisioner.openicf-OUD.json',
28
- expressionType: '',
29
- lastChangeDate: '2021-12-09T16:48:18.482Z',
30
- lastChangedBy: 'forgerock-automation',
31
- loaded: true,
32
- valueBase64: 'RnJkcC0yMDEw'
33
- }, {
34
- _id: 'esv-twilio-account-sid',
35
- description: 'Twilio account SID. Get your own at: https://twilio.com',
36
- expressionType: '',
37
- lastChangeDate: '2022-08-12T21:26:32.688Z',
38
- lastChangedBy: 'c5f3cf35-4cc1-42f9-80b3-59e1ca842510',
39
- loaded: true,
40
- valueBase64: 'QUM3NTA0MTVlMzE2M2EyZTU3YjdhZWVhN2VlZDgyZDk0NA=='
41
- }, {
42
- _id: 'esv-ipv4-cidr-access-rules',
43
- description: 'IPv4 CIDR access rules: { "allow": [ "address/mask" ] }',
44
- expressionType: '',
45
- lastChangeDate: '2022-08-25T20:16:54.243Z',
46
- lastChangedBy: 'c5f3cf35-4cc1-42f9-80b3-59e1ca842510',
47
- loaded: true,
48
- valueBase64: 'eyAiYWxsb3ciOiBbICIxNDUuMTE4LjAuMC8xNiIsICIxMzIuMzUuMC4wLzE2IiwgIjEwMS4yMjYuMC4wLzE2IiwgIjk5LjcyLjI4LjE4Mi8zMiIgXSB9'
49
- }, {
50
- _id: 'esv-volkerstestvariable1',
51
- description: "Volker's Updated Test Variable Description",
52
- expressionType: '',
53
- lastChangeDate: '2022-04-10T20:55:39.746Z',
54
- lastChangedBy: 'c5f3cf35-4cc1-42f9-80b3-59e1ca842510',
55
- loaded: true,
56
- valueBase64: 'Vm9sa2VyJ3MgVGVzdCBWYXJpYWJsZSBWYWx1ZQo='
57
- }],
58
- resultCount: 5,
59
- totalPagedResults: -1,
60
- totalPagedResultsPolicy: 'NONE'
61
- };
62
- mock.onGet('https://openam-frodo-dev.forgeblocks.com/environment/variables').reply(200, mockResponse);
63
- const response = await VariablesRaw.getVariables();
64
- expect(response).toBeTruthy();
65
- expect(response).toMatchObject(mockResponse);
21
+ describe('VariablesApi - getVariable()', () => {
22
+ test('getVariable() 0: Method is implemented', async () => {
23
+ expect(VariablesRaw.getVariable).toBeDefined();
24
+ });
25
+ test('getVariable() 1: Get existing variable: esv-volkerstestvariable1', async () => {
26
+ const response = await VariablesRaw.getVariable('esv-volkerstestvariable1');
27
+ expect(response).toMatchSnapshot();
28
+ });
29
+ test('getVariable() 2: Get non-existing variable: esv-does-not-exist', async () => {
30
+ try {
31
+ await VariablesRaw.getVariable('esv-does-not-exist');
32
+ } catch (error) {
33
+ // expect(error.response.status).toBe(404);
34
+ expect(error.response.data).toMatchSnapshot();
35
+ }
36
+ });
66
37
  });
67
- test('getVariables() 2: Get all variables - error', async () => {
68
- const mockResponse = {
69
- message: 'Server Error',
70
- code: 500
71
- };
72
- mock.onGet('https://openam-frodo-dev.forgeblocks.com/environment/variables').reply(500, mockResponse);
73
- expect.assertions(4);
74
-
75
- try {
76
- await VariablesRaw.getVariables();
77
- } catch (error) {
78
- // console.dir(error);
79
- expect(error).toBeTruthy();
80
- expect(error.response.status).toBe(500);
81
- expect(error.response.data.code).toBe(500);
82
- expect(error.response.data.message).toBe('Server Error');
83
- }
38
+ describe('VariablesApi - putVariable()', () => {
39
+ test('putVariable() 0: Method is implemented', async () => {
40
+ expect(VariablesRaw.putVariable).toBeDefined();
41
+ });
42
+ test('putVariable() 1: Create variable: esv-volkerstestvariable2 - success', async () => {
43
+ const response = await VariablesRaw.putVariable('esv-volkerstestvariable2', "Volker's Test Variable Value", "Volker's Test Variable Description");
44
+ expect(response).toMatchSnapshot();
45
+ });
46
+ test('putVariable() 2: Create variable: esv-volkerstestvariable2 - error', async () => {
47
+ try {
48
+ await VariablesRaw.putVariable('esv-volkerstestvariable2', "Volker's Test Variable Value", "Volker's Test Variable Description");
49
+ } catch (error) {
50
+ expect(error.response.data).toMatchSnapshot();
51
+ }
52
+ });
84
53
  });
85
- });
86
- describe('VariablesApi - getVariable()', () => {
87
- test('getVariable() 0: Method is implemented', async () => {
88
- expect(VariablesRaw.getVariable).toBeDefined();
89
- });
90
- test('getVariable() 1: Get existing variable: esv-volkerstestvariable1', async () => {
91
- const mockResponse = {
92
- _id: 'esv-volkerstestvariable1',
93
- description: "Volker's Updated Test Variable Description",
94
- expressionType: '',
95
- lastChangeDate: '2022-04-10T20:55:39.746Z',
96
- lastChangedBy: 'c5f3cf35-4cc1-42f9-80b3-59e1ca842510',
97
- loaded: true,
98
- valueBase64: 'Vm9sa2VyJ3MgVGVzdCBWYXJpYWJsZSBWYWx1ZQo='
99
- };
100
- mock.onGet('https://openam-frodo-dev.forgeblocks.com/environment/variables/esv-volkerstestvariable1').reply(200, mockResponse);
101
- const response = await VariablesRaw.getVariable('esv-volkerstestvariable1');
102
- expect(response).toBeTruthy();
103
- expect(response).toMatchObject(mockResponse);
104
- });
105
- test('getVariable() 2: Get non-existing variable: esv-does-not-exist', async () => {
106
- const mockResponse = {
107
- code: 404,
108
- message: 'The variable does not exist'
109
- };
110
- mock.onGet('https://openam-frodo-dev.forgeblocks.com/environment/variables/esv-does-not-exist').reply(404, mockResponse);
111
- expect.assertions(4);
112
-
113
- try {
114
- await VariablesRaw.getVariable('esv-does-not-exist');
115
- } catch (error) {
116
- // console.dir(error);
117
- expect(error).toBeTruthy();
118
- expect(error.response.status).toBe(404);
119
- expect(error.response.data.code).toBe(404);
120
- expect(error.response.data.message).toBe('The variable does not exist');
121
- }
122
- });
123
- });
124
- describe('VariablesApi - putVariable()', () => {
125
- test('putVariable() 0: Method is implemented', async () => {
126
- expect(VariablesRaw.putVariable).toBeDefined();
127
- });
128
- test('putVariable() 1: Create variable: esv-volkerstestvariable1 - success', async () => {
129
- const mockResponse = {
130
- _id: 'esv-volkerstestvariable1',
131
- description: "Volker's Updated Test Variable Description",
132
- expressionType: '',
133
- lastChangeDate: '2022-04-10T20:55:39.746Z',
134
- lastChangedBy: 'c5f3cf35-4cc1-42f9-80b3-59e1ca842510',
135
- loaded: true,
136
- valueBase64: 'Vm9sa2VyJ3MgVGVzdCBWYXJpYWJsZSBWYWx1ZQo='
137
- };
138
- mock.onPut('https://openam-frodo-dev.forgeblocks.com/environment/variables/esv-volkerstestvariable1').reply(200, mockResponse);
139
- const response = await VariablesRaw.putVariable('esv-volkerstestvariable1', "Volker's Test Variable Value", "Volker's Test Variable Description");
140
- expect(response).toBeTruthy();
141
- expect(response).toMatchObject(mockResponse);
142
- });
143
- test('putVariable() 2: Create variable: esv-volkerstestvariable1 - error', async () => {
144
- const mockResponse = {
145
- code: 500,
146
- message: 'Server Error'
147
- };
148
- mock.onPut('https://openam-frodo-dev.forgeblocks.com/environment/variables/esv-volkerstestvariable1').reply(500, mockResponse);
149
- expect.assertions(4);
150
-
151
- try {
152
- await VariablesRaw.putVariable('esv-volkerstestvariable1', "Volker's Test Variable Value", "Volker's Test Variable Description");
153
- } catch (error) {
154
- // console.dir(error);
155
- expect(error).toBeTruthy();
156
- expect(error.response.status).toBe(500);
157
- expect(error.response.data.code).toBe(500);
158
- expect(error.response.data.message).toBe('Server Error');
159
- }
160
- });
161
- });
162
- describe('VariablesApi - setVariableDescription()', () => {
163
- test('setVariableDescription() 0: Method is implemented', async () => {
164
- expect(VariablesRaw.setVariableDescription).toBeDefined();
165
- });
166
- test('setVariableDescription() 1: Set variable description: esv-volkerstestvariable1 - success', async () => {
167
- const mockResponse = '';
168
- mock.onPost('https://openam-frodo-dev.forgeblocks.com/environment/variables/esv-volkerstestvariable1?_action=setDescription').reply(200, mockResponse);
169
- const response = await VariablesRaw.setVariableDescription('esv-volkerstestvariable1', "Volker's Updated Test Secret Description");
170
- expect(response).toBe('');
171
- });
172
- test('setVariableDescription() 2: Set variable description: esv-volkerstestvariable1 - error', async () => {
173
- const mockResponse = {
174
- code: 500,
175
- message: 'Server Error'
176
- };
177
- mock.onPost('https://openam-frodo-dev.forgeblocks.com/environment/variables/esv-volkerstestvariable1?_action=setDescription').reply(500, mockResponse);
178
- expect.assertions(4);
179
-
180
- try {
181
- await VariablesRaw.setVariableDescription('esv-volkerstestvariable1', "Volker's Updated Test Secret Description");
182
- } catch (error) {
183
- // console.dir(error);
184
- expect(error).toBeTruthy();
185
- expect(error.response.status).toBe(500);
186
- expect(error.response.data.code).toBe(500);
187
- expect(error.response.data.message).toBe('Server Error');
188
- }
189
- });
190
- });
191
- describe('VariablesApi - deleteVariable()', () => {
192
- test('deleteVariable() 0: Method is implemented', async () => {
193
- expect(VariablesRaw.deleteVariable).toBeDefined();
194
- });
195
- test('deleteVariable() 1: Delete variable: esv-volkerstestvariable1 - success', async () => {
196
- const mockResponse = {
197
- _id: 'esv-volkerstestvariable1',
198
- description: "Volker's Updated Test Variable Description",
199
- expressionType: '',
200
- lastChangeDate: '2022-04-10T20:55:39.746Z',
201
- lastChangedBy: 'c5f3cf35-4cc1-42f9-80b3-59e1ca842510',
202
- loaded: true,
203
- valueBase64: 'Vm9sa2VyJ3MgVGVzdCBWYXJpYWJsZSBWYWx1ZQo='
204
- };
205
- mock.onDelete('https://openam-frodo-dev.forgeblocks.com/environment/variables/esv-volkerstestvariable1').reply(200, mockResponse);
206
- const response = await VariablesRaw.deleteVariable('esv-volkerstestvariable1');
207
- expect(response).toBeTruthy();
208
- expect(response).toMatchObject(mockResponse);
54
+ describe('VariablesApi - setVariableDescription()', () => {
55
+ test('setVariableDescription() 0: Method is implemented', async () => {
56
+ expect(VariablesRaw.setVariableDescription).toBeDefined();
57
+ });
58
+ test('setVariableDescription() 1: Set variable description: esv-volkerstestvariable2 - success', async () => {
59
+ const response = await VariablesRaw.setVariableDescription('esv-volkerstestvariable2', "Volker's Updated Test Secret Description");
60
+ expect(response).toMatchSnapshot();
61
+ });
62
+ test('setVariableDescription() 2: Set variable description: esv-volkerstestvariable3 - error', async () => {
63
+ try {
64
+ await VariablesRaw.setVariableDescription('esv-volkerstestvariable3', "Volker's Updated Test Secret Description");
65
+ } catch (error) {
66
+ expect(error.response.data).toMatchSnapshot();
67
+ }
68
+ });
209
69
  });
210
- test('deleteVariable() 2: Delete variable: esv-volkerstestvariable1 - error', async () => {
211
- const mockResponse = {
212
- code: 500,
213
- message: 'Cannot delete a variable that has an existing config placeholder'
214
- };
215
- mock.onDelete('https://openam-frodo-dev.forgeblocks.com/environment/variables/esv-volkerstestvariable1').reply(500, mockResponse);
216
- expect.assertions(4);
217
-
218
- try {
219
- await VariablesRaw.deleteVariable('esv-volkerstestvariable1');
220
- } catch (error) {
221
- // console.dir(error);
222
- expect(error).toBeTruthy();
223
- expect(error.response.status).toBe(500);
224
- expect(error.response.data.code).toBe(500);
225
- expect(error.response.data.message).toBe('Cannot delete a variable that has an existing config placeholder');
226
- }
70
+ describe('VariablesApi - deleteVariable()', () => {
71
+ test('deleteVariable() 0: Method is implemented', async () => {
72
+ expect(VariablesRaw.deleteVariable).toBeDefined();
73
+ });
74
+ test('deleteVariable() 1: Delete variable: esv-volkerstestvariable2 - success', async () => {
75
+ const response = await VariablesRaw.deleteVariable('esv-volkerstestvariable2');
76
+ expect(response).toMatchSnapshot();
77
+ });
78
+ test('deleteVariable() 2: Delete variable: esv-volkerstestvariable3 - error', async () => {
79
+ try {
80
+ await VariablesRaw.deleteVariable('esv-volkerstestvariable3');
81
+ } catch (error) {
82
+ expect(error.response.data).toMatchSnapshot();
83
+ }
84
+ });
227
85
  });
228
86
  });
229
87
  //# sourceMappingURL=VariablesApi.test.js.map