@rockcarver/frodo-cli 2.0.0-6 → 2.0.0-7

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 (340) hide show
  1. package/CHANGELOG.md +5 -1
  2. package/esm/app.js +4 -1
  3. package/esm/app.js.map +1 -1
  4. package/esm/cli/_template/something-delete.js +4 -1
  5. package/esm/cli/_template/something-delete.js.map +1 -1
  6. package/esm/cli/_template/something-describe.js +4 -1
  7. package/esm/cli/_template/something-describe.js.map +1 -1
  8. package/esm/cli/_template/something-else-delete.js +4 -1
  9. package/esm/cli/_template/something-else-delete.js.map +1 -1
  10. package/esm/cli/_template/something-else-describe.js +4 -1
  11. package/esm/cli/_template/something-else-describe.js.map +1 -1
  12. package/esm/cli/_template/something-else-export.js +4 -1
  13. package/esm/cli/_template/something-else-export.js.map +1 -1
  14. package/esm/cli/_template/something-else-import.js +4 -1
  15. package/esm/cli/_template/something-else-import.js.map +1 -1
  16. package/esm/cli/_template/something-else-list.js +4 -1
  17. package/esm/cli/_template/something-else-list.js.map +1 -1
  18. package/esm/cli/_template/something-export.js +4 -1
  19. package/esm/cli/_template/something-export.js.map +1 -1
  20. package/esm/cli/_template/something-import.js +4 -1
  21. package/esm/cli/_template/something-import.js.map +1 -1
  22. package/esm/cli/_template/something-list.js +4 -1
  23. package/esm/cli/_template/something-list.js.map +1 -1
  24. package/esm/cli/_template/something-other-delete.js +4 -1
  25. package/esm/cli/_template/something-other-delete.js.map +1 -1
  26. package/esm/cli/_template/something-other-describe.js +4 -1
  27. package/esm/cli/_template/something-other-describe.js.map +1 -1
  28. package/esm/cli/_template/something-other-export.js +4 -1
  29. package/esm/cli/_template/something-other-export.js.map +1 -1
  30. package/esm/cli/_template/something-other-import.js +4 -1
  31. package/esm/cli/_template/something-other-import.js.map +1 -1
  32. package/esm/cli/_template/something-other-list.js +4 -1
  33. package/esm/cli/_template/something-other-list.js.map +1 -1
  34. package/esm/cli/admin/admin-add-autoid-static-user-mapping.js +8 -2
  35. package/esm/cli/admin/admin-add-autoid-static-user-mapping.js.map +1 -1
  36. package/esm/cli/admin/admin-create-oauth2-client-with-admin-privileges.js +10 -3
  37. package/esm/cli/admin/admin-create-oauth2-client-with-admin-privileges.js.map +1 -1
  38. package/esm/cli/admin/admin-federation-export.js +4 -1
  39. package/esm/cli/admin/admin-federation-export.js.map +1 -1
  40. package/esm/cli/admin/admin-federation-import.js +7 -4
  41. package/esm/cli/admin/admin-federation-import.js.map +1 -1
  42. package/esm/cli/admin/admin-federation-list.js +4 -1
  43. package/esm/cli/admin/admin-federation-list.js.map +1 -1
  44. package/esm/cli/admin/admin-get-access-token.js +8 -2
  45. package/esm/cli/admin/admin-get-access-token.js.map +1 -1
  46. package/esm/cli/admin/admin-grant-oauth2-client-admin-privileges.js +8 -2
  47. package/esm/cli/admin/admin-grant-oauth2-client-admin-privileges.js.map +1 -1
  48. package/esm/cli/admin/admin-hide-generic-extension-attributes.js +8 -2
  49. package/esm/cli/admin/admin-hide-generic-extension-attributes.js.map +1 -1
  50. package/esm/cli/admin/admin-list-oauth2-clients-with-admin-privileges.js +8 -2
  51. package/esm/cli/admin/admin-list-oauth2-clients-with-admin-privileges.js.map +1 -1
  52. package/esm/cli/admin/admin-list-oauth2-clients-with-custom-privileges.js +8 -2
  53. package/esm/cli/admin/admin-list-oauth2-clients-with-custom-privileges.js.map +1 -1
  54. package/esm/cli/admin/admin-list-static-user-mappings.js +8 -2
  55. package/esm/cli/admin/admin-list-static-user-mappings.js.map +1 -1
  56. package/esm/cli/admin/admin-remove-static-user-mapping.js +8 -2
  57. package/esm/cli/admin/admin-remove-static-user-mapping.js.map +1 -1
  58. package/esm/cli/admin/admin-repair-org-model.js +8 -2
  59. package/esm/cli/admin/admin-repair-org-model.js.map +1 -1
  60. package/esm/cli/admin/admin-revoke-oauth2-client-admin-privileges.js +8 -2
  61. package/esm/cli/admin/admin-revoke-oauth2-client-admin-privileges.js.map +1 -1
  62. package/esm/cli/admin/admin-show-generic-extension-attributes.js +8 -2
  63. package/esm/cli/admin/admin-show-generic-extension-attributes.js.map +1 -1
  64. package/esm/cli/agent/agent-delete.js +10 -3
  65. package/esm/cli/agent/agent-delete.js.map +1 -1
  66. package/esm/cli/agent/agent-describe.js +4 -1
  67. package/esm/cli/agent/agent-describe.js.map +1 -1
  68. package/esm/cli/agent/agent-export.js +4 -1
  69. package/esm/cli/agent/agent-export.js.map +1 -1
  70. package/esm/cli/agent/agent-gateway-delete.js +10 -3
  71. package/esm/cli/agent/agent-gateway-delete.js.map +1 -1
  72. package/esm/cli/agent/agent-gateway-describe.js +4 -1
  73. package/esm/cli/agent/agent-gateway-describe.js.map +1 -1
  74. package/esm/cli/agent/agent-gateway-export.js +4 -1
  75. package/esm/cli/agent/agent-gateway-export.js.map +1 -1
  76. package/esm/cli/agent/agent-gateway-import.js +4 -1
  77. package/esm/cli/agent/agent-gateway-import.js.map +1 -1
  78. package/esm/cli/agent/agent-gateway-list.js +4 -1
  79. package/esm/cli/agent/agent-gateway-list.js.map +1 -1
  80. package/esm/cli/agent/agent-import.js +4 -1
  81. package/esm/cli/agent/agent-import.js.map +1 -1
  82. package/esm/cli/agent/agent-java-delete.js +10 -3
  83. package/esm/cli/agent/agent-java-delete.js.map +1 -1
  84. package/esm/cli/agent/agent-java-describe.js +4 -1
  85. package/esm/cli/agent/agent-java-describe.js.map +1 -1
  86. package/esm/cli/agent/agent-java-export.js +4 -1
  87. package/esm/cli/agent/agent-java-export.js.map +1 -1
  88. package/esm/cli/agent/agent-java-import.js +4 -1
  89. package/esm/cli/agent/agent-java-import.js.map +1 -1
  90. package/esm/cli/agent/agent-java-list.js +4 -1
  91. package/esm/cli/agent/agent-java-list.js.map +1 -1
  92. package/esm/cli/agent/agent-list.js +4 -1
  93. package/esm/cli/agent/agent-list.js.map +1 -1
  94. package/esm/cli/agent/agent-web-delete.js +10 -3
  95. package/esm/cli/agent/agent-web-delete.js.map +1 -1
  96. package/esm/cli/agent/agent-web-describe.js +4 -1
  97. package/esm/cli/agent/agent-web-describe.js.map +1 -1
  98. package/esm/cli/agent/agent-web-export.js +4 -1
  99. package/esm/cli/agent/agent-web-export.js.map +1 -1
  100. package/esm/cli/agent/agent-web-import.js +4 -1
  101. package/esm/cli/agent/agent-web-import.js.map +1 -1
  102. package/esm/cli/agent/agent-web-list.js +4 -1
  103. package/esm/cli/agent/agent-web-list.js.map +1 -1
  104. package/esm/cli/app/app-delete.js +4 -1
  105. package/esm/cli/app/app-delete.js.map +1 -1
  106. package/esm/cli/app/app-describe.js +4 -1
  107. package/esm/cli/app/app-describe.js.map +1 -1
  108. package/esm/cli/app/app-export.js +6 -3
  109. package/esm/cli/app/app-export.js.map +1 -1
  110. package/esm/cli/app/app-import.js +7 -4
  111. package/esm/cli/app/app-import.js.map +1 -1
  112. package/esm/cli/app/app-list.js +4 -1
  113. package/esm/cli/app/app-list.js.map +1 -1
  114. package/esm/cli/authz/authz-policy-delete.js +6 -3
  115. package/esm/cli/authz/authz-policy-delete.js.map +1 -1
  116. package/esm/cli/authz/authz-policy-describe.js +4 -1
  117. package/esm/cli/authz/authz-policy-describe.js.map +1 -1
  118. package/esm/cli/authz/authz-policy-export.js +8 -5
  119. package/esm/cli/authz/authz-policy-export.js.map +1 -1
  120. package/esm/cli/authz/authz-policy-import.js +7 -4
  121. package/esm/cli/authz/authz-policy-import.js.map +1 -1
  122. package/esm/cli/authz/authz-policy-list.js +5 -2
  123. package/esm/cli/authz/authz-policy-list.js.map +1 -1
  124. package/esm/cli/authz/authz-set-delete.js +5 -2
  125. package/esm/cli/authz/authz-set-delete.js.map +1 -1
  126. package/esm/cli/authz/authz-set-describe.js +4 -1
  127. package/esm/cli/authz/authz-set-describe.js.map +1 -1
  128. package/esm/cli/authz/authz-set-export.js +6 -3
  129. package/esm/cli/authz/authz-set-export.js.map +1 -1
  130. package/esm/cli/authz/authz-set-import.js +7 -4
  131. package/esm/cli/authz/authz-set-import.js.map +1 -1
  132. package/esm/cli/authz/authz-set-list.js +4 -1
  133. package/esm/cli/authz/authz-set-list.js.map +1 -1
  134. package/esm/cli/authz/authz-type-delete.js +6 -3
  135. package/esm/cli/authz/authz-type-delete.js.map +1 -1
  136. package/esm/cli/authz/authz-type-describe.js +5 -2
  137. package/esm/cli/authz/authz-type-describe.js.map +1 -1
  138. package/esm/cli/authz/authz-type-export.js +7 -4
  139. package/esm/cli/authz/authz-type-export.js.map +1 -1
  140. package/esm/cli/authz/authz-type-import.js +8 -5
  141. package/esm/cli/authz/authz-type-import.js.map +1 -1
  142. package/esm/cli/authz/authz-type-list.js +4 -1
  143. package/esm/cli/authz/authz-type-list.js.map +1 -1
  144. package/esm/cli/conn/conn-save.js +18 -5
  145. package/esm/cli/conn/conn-save.js.map +1 -1
  146. package/esm/cli/email/email-template-export.js +6 -3
  147. package/esm/cli/email/email-template-export.js.map +1 -1
  148. package/esm/cli/email/email-template-import.js +7 -4
  149. package/esm/cli/email/email-template-import.js.map +1 -1
  150. package/esm/cli/email/email-template-list.js +4 -1
  151. package/esm/cli/email/email-template-list.js.map +1 -1
  152. package/esm/cli/esv/esv-apply.js +15 -5
  153. package/esm/cli/esv/esv-apply.js.map +1 -1
  154. package/esm/cli/esv/esv-secret-create.js +4 -1
  155. package/esm/cli/esv/esv-secret-create.js.map +1 -1
  156. package/esm/cli/esv/esv-secret-delete.js +5 -2
  157. package/esm/cli/esv/esv-secret-delete.js.map +1 -1
  158. package/esm/cli/esv/esv-secret-describe.js +4 -1
  159. package/esm/cli/esv/esv-secret-describe.js.map +1 -1
  160. package/esm/cli/esv/esv-secret-export.js +4 -1
  161. package/esm/cli/esv/esv-secret-export.js.map +1 -1
  162. package/esm/cli/esv/esv-secret-import.js +4 -1
  163. package/esm/cli/esv/esv-secret-import.js.map +1 -1
  164. package/esm/cli/esv/esv-secret-list.js +4 -1
  165. package/esm/cli/esv/esv-secret-list.js.map +1 -1
  166. package/esm/cli/esv/esv-secret-set.js +4 -1
  167. package/esm/cli/esv/esv-secret-set.js.map +1 -1
  168. package/esm/cli/esv/esv-secret-version-activate.js +4 -1
  169. package/esm/cli/esv/esv-secret-version-activate.js.map +1 -1
  170. package/esm/cli/esv/esv-secret-version-create.js +4 -1
  171. package/esm/cli/esv/esv-secret-version-create.js.map +1 -1
  172. package/esm/cli/esv/esv-secret-version-deactivate.js +4 -1
  173. package/esm/cli/esv/esv-secret-version-deactivate.js.map +1 -1
  174. package/esm/cli/esv/esv-secret-version-delete.js +5 -2
  175. package/esm/cli/esv/esv-secret-version-delete.js.map +1 -1
  176. package/esm/cli/esv/esv-secret-version-list.js +4 -1
  177. package/esm/cli/esv/esv-secret-version-list.js.map +1 -1
  178. package/esm/cli/esv/esv-variable-create.js +4 -1
  179. package/esm/cli/esv/esv-variable-create.js.map +1 -1
  180. package/esm/cli/esv/esv-variable-delete.js +5 -2
  181. package/esm/cli/esv/esv-variable-delete.js.map +1 -1
  182. package/esm/cli/esv/esv-variable-describe.js +4 -1
  183. package/esm/cli/esv/esv-variable-describe.js.map +1 -1
  184. package/esm/cli/esv/esv-variable-export.js +4 -1
  185. package/esm/cli/esv/esv-variable-export.js.map +1 -1
  186. package/esm/cli/esv/esv-variable-import.js +4 -1
  187. package/esm/cli/esv/esv-variable-import.js.map +1 -1
  188. package/esm/cli/esv/esv-variable-list.js +4 -1
  189. package/esm/cli/esv/esv-variable-list.js.map +1 -1
  190. package/esm/cli/esv/esv-variable-set.js +5 -2
  191. package/esm/cli/esv/esv-variable-set.js.map +1 -1
  192. package/esm/cli/idm/idm-count.js +4 -1
  193. package/esm/cli/idm/idm-count.js.map +1 -1
  194. package/esm/cli/idm/idm-export.js +6 -3
  195. package/esm/cli/idm/idm-export.js.map +1 -1
  196. package/esm/cli/idm/idm-import.js +7 -4
  197. package/esm/cli/idm/idm-import.js.map +1 -1
  198. package/esm/cli/idm/idm-list.js +4 -1
  199. package/esm/cli/idm/idm-list.js.map +1 -1
  200. package/esm/cli/idp/idp-export.js +4 -1
  201. package/esm/cli/idp/idp-export.js.map +1 -1
  202. package/esm/cli/idp/idp-import.js +7 -4
  203. package/esm/cli/idp/idp-import.js.map +1 -1
  204. package/esm/cli/idp/idp-list.js +4 -1
  205. package/esm/cli/idp/idp-list.js.map +1 -1
  206. package/esm/cli/info/info.js +8 -2
  207. package/esm/cli/info/info.js.map +1 -1
  208. package/esm/cli/journey/journey-delete.js +5 -2
  209. package/esm/cli/journey/journey-delete.js.map +1 -1
  210. package/esm/cli/journey/journey-describe.js +14 -6
  211. package/esm/cli/journey/journey-describe.js.map +1 -1
  212. package/esm/cli/journey/journey-disable.js +8 -2
  213. package/esm/cli/journey/journey-disable.js.map +1 -1
  214. package/esm/cli/journey/journey-enable.js +8 -2
  215. package/esm/cli/journey/journey-enable.js.map +1 -1
  216. package/esm/cli/journey/journey-export.js +6 -3
  217. package/esm/cli/journey/journey-export.js.map +1 -1
  218. package/esm/cli/journey/journey-import.js +7 -4
  219. package/esm/cli/journey/journey-import.js.map +1 -1
  220. package/esm/cli/journey/journey-list.js +4 -1
  221. package/esm/cli/journey/journey-list.js.map +1 -1
  222. package/esm/cli/journey/journey-prune.js +10 -3
  223. package/esm/cli/journey/journey-prune.js.map +1 -1
  224. package/esm/cli/log/log-fetch.js +16 -6
  225. package/esm/cli/log/log-fetch.js.map +1 -1
  226. package/esm/cli/log/log-key-delete.js +5 -2
  227. package/esm/cli/log/log-key-delete.js.map +1 -1
  228. package/esm/cli/log/log-key-describe.js +4 -1
  229. package/esm/cli/log/log-key-describe.js.map +1 -1
  230. package/esm/cli/log/log-key-list.js +4 -1
  231. package/esm/cli/log/log-key-list.js.map +1 -1
  232. package/esm/cli/log/log-list.js +14 -4
  233. package/esm/cli/log/log-list.js.map +1 -1
  234. package/esm/cli/log/log-tail.js +16 -6
  235. package/esm/cli/log/log-tail.js.map +1 -1
  236. package/esm/cli/realm/realm-add-custom-domain.js +4 -1
  237. package/esm/cli/realm/realm-add-custom-domain.js.map +1 -1
  238. package/esm/cli/realm/realm-describe.js +4 -1
  239. package/esm/cli/realm/realm-describe.js.map +1 -1
  240. package/esm/cli/realm/realm-list.js +4 -1
  241. package/esm/cli/realm/realm-list.js.map +1 -1
  242. package/esm/cli/realm/realm-remove-custom-domain.js +8 -2
  243. package/esm/cli/realm/realm-remove-custom-domain.js.map +1 -1
  244. package/esm/cli/saml/saml-cot-export.js +6 -3
  245. package/esm/cli/saml/saml-cot-export.js.map +1 -1
  246. package/esm/cli/saml/saml-cot-import.js +7 -4
  247. package/esm/cli/saml/saml-cot-import.js.map +1 -1
  248. package/esm/cli/saml/saml-cot-list.js +4 -1
  249. package/esm/cli/saml/saml-cot-list.js.map +1 -1
  250. package/esm/cli/saml/saml-delete.js +11 -4
  251. package/esm/cli/saml/saml-delete.js.map +1 -1
  252. package/esm/cli/saml/saml-describe.js +4 -1
  253. package/esm/cli/saml/saml-describe.js.map +1 -1
  254. package/esm/cli/saml/saml-export.js +6 -3
  255. package/esm/cli/saml/saml-export.js.map +1 -1
  256. package/esm/cli/saml/saml-import.js +7 -4
  257. package/esm/cli/saml/saml-import.js.map +1 -1
  258. package/esm/cli/saml/saml-list.js +4 -1
  259. package/esm/cli/saml/saml-list.js.map +1 -1
  260. package/esm/cli/saml/saml-metadata-export.js +5 -2
  261. package/esm/cli/saml/saml-metadata-export.js.map +1 -1
  262. package/esm/cli/script/script-delete.js +4 -1
  263. package/esm/cli/script/script-delete.js.map +1 -1
  264. package/esm/cli/script/script-describe.js +4 -1
  265. package/esm/cli/script/script-describe.js.map +1 -1
  266. package/esm/cli/script/script-export.js +4 -1
  267. package/esm/cli/script/script-export.js.map +1 -1
  268. package/esm/cli/script/script-import.js +4 -1
  269. package/esm/cli/script/script-import.js.map +1 -1
  270. package/esm/cli/script/script-list.js +4 -1
  271. package/esm/cli/script/script-list.js.map +1 -1
  272. package/esm/cli/service/service-delete.js +5 -2
  273. package/esm/cli/service/service-delete.js.map +1 -1
  274. package/esm/cli/service/service-export.js +6 -3
  275. package/esm/cli/service/service-export.js.map +1 -1
  276. package/esm/cli/service/service-import.js +7 -4
  277. package/esm/cli/service/service-import.js.map +1 -1
  278. package/esm/cli/service/service-list.js +4 -1
  279. package/esm/cli/service/service-list.js.map +1 -1
  280. package/esm/cli/theme/theme-delete.js +6 -3
  281. package/esm/cli/theme/theme-delete.js.map +1 -1
  282. package/esm/cli/theme/theme-export.js +7 -4
  283. package/esm/cli/theme/theme-export.js.map +1 -1
  284. package/esm/cli/theme/theme-import.js +8 -5
  285. package/esm/cli/theme/theme-import.js.map +1 -1
  286. package/esm/cli/theme/theme-list.js +4 -1
  287. package/esm/cli/theme/theme-list.js.map +1 -1
  288. package/esm/ops/AdminFederationOps.js +17 -9
  289. package/esm/ops/AdminFederationOps.js.map +1 -1
  290. package/esm/ops/AgentOps.js +62 -36
  291. package/esm/ops/AgentOps.js.map +1 -1
  292. package/esm/ops/CirclesOfTrustOps.js +22 -10
  293. package/esm/ops/CirclesOfTrustOps.js.map +1 -1
  294. package/esm/ops/ConnectionProfileOps.js +10 -3
  295. package/esm/ops/ConnectionProfileOps.js.map +1 -1
  296. package/esm/ops/EmailTemplateOps.js +23 -15
  297. package/esm/ops/EmailTemplateOps.js.map +1 -1
  298. package/esm/ops/IdmOps.js +34 -21
  299. package/esm/ops/IdmOps.js.map +1 -1
  300. package/esm/ops/IdpOps.js +17 -9
  301. package/esm/ops/IdpOps.js.map +1 -1
  302. package/esm/ops/JourneyOps.js +46 -30
  303. package/esm/ops/JourneyOps.js.map +1 -1
  304. package/esm/ops/LogOps.js +21 -11
  305. package/esm/ops/LogOps.js.map +1 -1
  306. package/esm/ops/NodeOps.js +5 -2
  307. package/esm/ops/NodeOps.js.map +1 -1
  308. package/esm/ops/OAuth2ClientOps.js +25 -12
  309. package/esm/ops/OAuth2ClientOps.js.map +1 -1
  310. package/esm/ops/OrganizationOps.js +8 -2
  311. package/esm/ops/OrganizationOps.js.map +1 -1
  312. package/esm/ops/PolicyOps.js +36 -21
  313. package/esm/ops/PolicyOps.js.map +1 -1
  314. package/esm/ops/PolicySetOps.js +35 -18
  315. package/esm/ops/PolicySetOps.js.map +1 -1
  316. package/esm/ops/RealmOps.js +11 -6
  317. package/esm/ops/RealmOps.js.map +1 -1
  318. package/esm/ops/ResourceTypeOps.js +34 -18
  319. package/esm/ops/ResourceTypeOps.js.map +1 -1
  320. package/esm/ops/Saml2Ops.js +43 -23
  321. package/esm/ops/Saml2Ops.js.map +1 -1
  322. package/esm/ops/ScriptOps.js +18 -10
  323. package/esm/ops/ScriptOps.js.map +1 -1
  324. package/esm/ops/SecretsOps.js +28 -14
  325. package/esm/ops/SecretsOps.js.map +1 -1
  326. package/esm/ops/ServiceOps.js +38 -17
  327. package/esm/ops/ServiceOps.js.map +1 -1
  328. package/esm/ops/ThemeOps.js +35 -19
  329. package/esm/ops/ThemeOps.js.map +1 -1
  330. package/esm/ops/VariablesOps.js +23 -12
  331. package/esm/ops/VariablesOps.js.map +1 -1
  332. package/esm/utils/Config.js +6 -3
  333. package/esm/utils/Config.js.map +1 -1
  334. package/esm/utils/Console.js +5 -2
  335. package/esm/utils/Console.js.map +1 -1
  336. package/esm/utils/ExportImportUtils.js +6 -3
  337. package/esm/utils/ExportImportUtils.js.map +1 -1
  338. package/esm/utils/Version.js +7 -3
  339. package/esm/utils/Version.js.map +1 -1
  340. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"ResourceTypeOps.js","names":["frodo","state","fs","createObjectTable","createProgressBar","createTable","debugMessage","failSpinner","printMessage","showSpinner","stopProgressBar","succeedSpinner","updateProgressBar","getTypedFilename","saveJsonToFile","titleCase","listResourceTypes","long","outcome","resourceTypes","authz","resourceType","getResourceTypes","sort","a","b","name","localeCompare","table","push","description","uuid","toString","err","message","describeResourceType","resourceTypeUuid","json","getResourceType","error","_error$response","response","status","getRealm","_error$response2","_error$response2$data","data","describeResourceTypeByName","resourceTypeName","getResourceTypeByName","_error$response3","_error$response4","_error$response4$data","deleteResourceType","errors","length","errorMessages","map","_error$response5","_error$response5$data","join","deleteResourceTypeByName","_error$response6","_error$response6$data","deleteResourceTypes","resourceTypeId","exportResourceTypeToFile","file","fileName","exportData","exportResourceType","exportResourceTypeByNameToFile","exportResourceTypeByName","exportResourceTypesToFile","helper","utils","getRealmName","exportResourceTypes","exportResourceTypesToFiles","importResourceTypeFromFile","readFileSync","fileData","JSON","parse","importResourceType","importResourceTypeByNameFromFile","importResourceTypeByName","importFirstResourceTypeFromFile","importFirstResourceType","importResourceTypesFromFile","importResourceTypes","importResourceTypesFromFiles","names","readdirSync","files","filter","toLowerCase","endsWith","total","count","Object","keys","resourcetype"],"sources":["ops/ResourceTypeOps.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport fs from 'fs';\nimport type { ResourceTypeSkeleton } from '@rockcarver/frodo-lib/types/api/ApiTypes';\nimport {\n createObjectTable,\n createProgressBar,\n createTable,\n debugMessage,\n failSpinner,\n printMessage,\n showSpinner,\n stopProgressBar,\n succeedSpinner,\n updateProgressBar,\n} from '../utils/Console';\nimport {\n getTypedFilename,\n saveJsonToFile,\n titleCase,\n} from '../utils/ExportImportUtils';\nimport { ResourceTypeExportInterface } from '@rockcarver/frodo-lib/types/ops/ResourceTypeOps';\n\n/**\n * List resource types\n * @param {boolean} long more fields\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function listResourceTypes(long = false): Promise<boolean> {\n let outcome = false;\n try {\n const resourceTypes = await frodo.authz.resourceType.getResourceTypes();\n resourceTypes.sort((a, b) => a.name.localeCompare(b.name));\n if (long) {\n const table = createTable(['Name', 'Description', 'Uuid']);\n for (const resourceType of resourceTypes) {\n table.push([\n `${resourceType.name}`,\n `${resourceType.description}`,\n `${resourceType.uuid}`,\n ]);\n }\n printMessage(table.toString(), 'data');\n } else {\n for (const resourceType of resourceTypes) {\n printMessage(`${resourceType.name}`, 'data');\n }\n }\n outcome = true;\n } catch (err) {\n printMessage(`listResourceTypes ERROR: ${err.message}`, 'error');\n printMessage(err, 'error');\n }\n return outcome;\n}\n\n/**\n * Describe resource type by uuid\n * @param {string} resourceTypeUuid resource type uuid\n * @param {boolean} json JSON output\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function describeResourceType(\n resourceTypeUuid: string,\n json = false\n): Promise<boolean> {\n let outcome = false;\n try {\n const resourceType = await frodo.authz.resourceType.getResourceType(\n resourceTypeUuid\n );\n if (json) {\n printMessage(resourceType, 'data');\n } else {\n const table = createObjectTable(resourceType);\n printMessage(table.toString(), 'data');\n }\n outcome = true;\n } catch (error) {\n if (error.response?.status === 404) {\n printMessage(\n `Resource Type with uuid ${resourceTypeUuid} does not exist in realm ${state.getRealm()}`,\n 'error'\n );\n } else {\n printMessage(error.response?.data?.message || error.message, 'error');\n }\n }\n return outcome;\n}\n\n/**\n * Describe resource type by name\n * @param {string} resourceTypeName resource type name\n * @param {boolean} json JSON output\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function describeResourceTypeByName(\n resourceTypeName: string,\n json = false\n): Promise<boolean> {\n let outcome = false;\n try {\n const resourceType = await frodo.authz.resourceType.getResourceTypeByName(\n resourceTypeName\n );\n if (json) {\n printMessage(resourceType, 'data');\n } else {\n const table = createObjectTable(resourceType);\n printMessage(table.toString(), 'data');\n }\n outcome = true;\n } catch (error) {\n if (error.response?.status === 404) {\n printMessage(\n `Resource Type with name ${resourceTypeName} does not exist in realm ${state.getRealm()}`,\n 'error'\n );\n } else {\n printMessage(error.response?.data?.message || error.message, 'error');\n }\n }\n return outcome;\n}\n\n/**\n * Delete resource type by uuid\n * @param {string} resourceTypeUuid resource type uuid\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteResourceType(\n resourceTypeUuid: string\n): Promise<boolean | ResourceTypeSkeleton> {\n debugMessage(`cli.ResourceTypeOps.deleteResourceType: begin`);\n showSpinner(`Deleting ${resourceTypeUuid}...`);\n let outcome = false;\n const errors = [];\n try {\n debugMessage(`Deleting resource type ${resourceTypeUuid}`);\n await frodo.authz.resourceType.deleteResourceType(resourceTypeUuid);\n } catch (error) {\n errors.push(error);\n }\n if (errors.length) {\n const errorMessages = errors\n .map((error) => error.response?.data?.message || error.message)\n .join('\\n');\n failSpinner(`Error deleting ${resourceTypeUuid}: ${errorMessages}`);\n } else {\n succeedSpinner(`Deleted ${resourceTypeUuid}.`);\n outcome = true;\n }\n debugMessage(\n `cli.ResourceTypeOps.deleteResourceType: end [outcome=${outcome}]`\n );\n return outcome;\n}\n\n/**\n * Delete resource type by name\n * @param {string} resourceTypeName resource type name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteResourceTypeByName(\n resourceTypeName: string\n): Promise<boolean | ResourceTypeSkeleton> {\n debugMessage(`cli.ResourceTypeOps.deleteResourceTypeByName: begin`);\n showSpinner(`Deleting ${resourceTypeName}...`);\n let outcome = false;\n const errors = [];\n try {\n debugMessage(`Deleting resource type ${resourceTypeName}`);\n await frodo.authz.resourceType.deleteResourceTypeByName(resourceTypeName);\n } catch (error) {\n errors.push(error);\n }\n if (errors.length) {\n const errorMessages = errors\n .map((error) => error.response?.data?.message || error.message)\n .join('\\n');\n failSpinner(`Error deleting ${resourceTypeName}: ${errorMessages}`);\n } else {\n succeedSpinner(`Deleted ${resourceTypeName}.`);\n outcome = true;\n }\n debugMessage(\n `cli.ResourceTypeOps.deleteResourceTypeByName: end [outcome=${outcome}]`\n );\n return outcome;\n}\n\n/**\n * Delete all resource types\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteResourceTypes(): Promise<\n boolean | ResourceTypeSkeleton\n> {\n debugMessage(`cli.ResourceTypeOps.deleteResourceTypes: begin`);\n let outcome = false;\n const errors = [];\n let resourceTypes: ResourceTypeSkeleton[] = [];\n try {\n showSpinner(`Retrieving all resource types...`);\n try {\n resourceTypes = await frodo.authz.resourceType.getResourceTypes();\n succeedSpinner(`Found ${resourceTypes.length} resource types.`);\n } catch (error) {\n error.message = `Error retrieving all resource types: ${error.message}`;\n failSpinner(error.message);\n throw error;\n }\n if (resourceTypes.length)\n createProgressBar(\n resourceTypes.length,\n `Deleting ${resourceTypes.length} resource types...`\n );\n for (const resourceType of resourceTypes) {\n const resourceTypeId = resourceType.uuid;\n try {\n debugMessage(`Deleting resource type ${resourceTypeId}`);\n await frodo.authz.resourceType.deleteResourceType(resourceTypeId);\n updateProgressBar(`Deleted ${resourceTypeId}`);\n } catch (error) {\n error.message = `Error deleting resource type ${resourceTypeId}: ${error}`;\n updateProgressBar(error.message);\n errors.push(error);\n }\n }\n } catch (error) {\n error.message = `Error deleting resource types: ${error}`;\n errors.push(error);\n } finally {\n if (errors.length) {\n const errorMessages = errors.map((error) => error.message).join('\\n');\n if (resourceTypes.length)\n stopProgressBar(`Error deleting all resource types: ${errorMessages}`);\n } else {\n if (resourceTypes.length)\n stopProgressBar(`Deleted ${resourceTypes.length} resource types.`);\n outcome = true;\n }\n }\n debugMessage(\n `cli.ResourceTypeOps.deleteResourceTypes: end [outcome=${outcome}]`\n );\n return outcome;\n}\n\n/**\n * Export resource type to file\n * @param {string} resourceTypeUuid resource type uuid\n * @param {string} file file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportResourceTypeToFile(\n resourceTypeUuid: string,\n file: string\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ResourceTypeOps.exportResourceTypeToFile: begin`);\n showSpinner(`Exporting ${resourceTypeUuid}...`);\n try {\n let fileName = getTypedFilename(resourceTypeUuid, 'resourcetype.authz');\n if (file) {\n fileName = file;\n }\n const exportData = await frodo.authz.resourceType.exportResourceType(\n resourceTypeUuid\n );\n saveJsonToFile(exportData, fileName);\n succeedSpinner(`Exported ${resourceTypeUuid} to ${fileName}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting ${resourceTypeUuid}: ${error.message}`);\n }\n debugMessage(`cli.ResourceTypeOps.exportResourceTypeToFile: end`);\n return outcome;\n}\n\n/**\n * Export resource type by name to file\n * @param {string} resourceTypeName resource type name\n * @param {string} file file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportResourceTypeByNameToFile(\n resourceTypeName: string,\n file: string\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ResourceTypeOps.exportResourceTypeByNameToFile: begin`);\n showSpinner(`Exporting ${resourceTypeName}...`);\n try {\n let fileName = getTypedFilename(resourceTypeName, 'resourcetype.authz');\n if (file) {\n fileName = file;\n }\n const exportData = await frodo.authz.resourceType.exportResourceTypeByName(\n resourceTypeName\n );\n saveJsonToFile(exportData, fileName);\n succeedSpinner(`Exported ${resourceTypeName} to ${fileName}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting ${resourceTypeName}: ${error.message}`);\n }\n debugMessage(`cli.ResourceTypeOps.exportResourceTypeByNameToFile: end`);\n return outcome;\n}\n\n/**\n * Export resource types to file\n * @param {string} file file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportResourceTypesToFile(\n file: string\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ResourceTypeOps.exportResourceTypesToFile: begin`);\n showSpinner(`Exporting all resource types...`);\n try {\n let fileName = getTypedFilename(\n `all${titleCase(\n frodo.helper.utils.getRealmName(state.getRealm())\n )}ResourceTypes`,\n 'resourcetype.authz'\n );\n if (file) {\n fileName = file;\n }\n const exportData = await frodo.authz.resourceType.exportResourceTypes();\n saveJsonToFile(exportData, fileName);\n succeedSpinner(`Exported all resource types to ${fileName}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting resource types: ${error.message}`);\n }\n debugMessage(`cli.ResourceTypeOps.exportResourceTypesToFile: end`);\n return outcome;\n}\n\n/**\n * Export all resource types to separate files\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportResourceTypesToFiles(): Promise<boolean> {\n debugMessage(`cli.ResourceTypeOps.exportResourceTypesToFiles: begin`);\n const errors = [];\n try {\n const resourceTypes: ResourceTypeSkeleton[] =\n await frodo.authz.resourceType.getResourceTypes();\n createProgressBar(resourceTypes.length, 'Exporting resource types...');\n for (const resourceType of resourceTypes) {\n const file = getTypedFilename(resourceType.name, 'resourcetype.authz');\n try {\n const exportData: ResourceTypeExportInterface =\n await frodo.authz.resourceType.exportResourceType(resourceType.uuid);\n saveJsonToFile(exportData, file);\n updateProgressBar(`Exported ${resourceType.name}.`);\n } catch (error) {\n errors.push(error);\n updateProgressBar(`Error exporting ${resourceType.name}.`);\n }\n }\n stopProgressBar(`Export complete.`);\n } catch (error) {\n errors.push(error);\n stopProgressBar(`Error exporting resource types to files`);\n }\n debugMessage(`cli.ResourceTypeOps.exportResourceTypesToFiles: end`);\n return 0 === errors.length;\n}\n\n/**\n * Import resource type from file\n * @param {string} resourceTypeId resource type id\n * @param {string} file file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importResourceTypeFromFile(\n resourceTypeId: string,\n file: string\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ResourceTypeOps.importResourceTypeFromFile: begin`);\n showSpinner(`Importing ${resourceTypeId}...`);\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n await frodo.authz.resourceType.importResourceType(resourceTypeId, fileData);\n outcome = true;\n succeedSpinner(`Imported ${resourceTypeId}.`);\n } catch (error) {\n failSpinner(`Error importing ${resourceTypeId}: ${error.message}`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ResourceTypeOps.importResourceTypeFromFile: end`);\n return outcome;\n}\n\n/**\n * Import resource type by name from file\n * @param {string} resourceTypeName resource type name\n * @param {string} file file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importResourceTypeByNameFromFile(\n resourceTypeName: string,\n file: string\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ResourceTypeOps.importResourceTypeByNameFromFile: begin`);\n showSpinner(`Importing ${resourceTypeName}...`);\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n await frodo.authz.resourceType.importResourceTypeByName(\n resourceTypeName,\n fileData\n );\n outcome = true;\n succeedSpinner(`Imported ${resourceTypeName}.`);\n } catch (error) {\n failSpinner(`Error importing ${resourceTypeName}: ${error.message}`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ResourceTypeOps.importResourceTypeByNameFromFile: end`);\n return outcome;\n}\n\n/**\n * Import first resource type from file\n * @param {string} file file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importFirstResourceTypeFromFile(\n file: string\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ResourceTypeOps.importFirstResourceTypeFromFile: begin`);\n showSpinner(`Importing ${file}...`);\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n await frodo.authz.resourceType.importFirstResourceType(fileData);\n outcome = true;\n succeedSpinner(`Imported ${file}.`);\n } catch (error) {\n failSpinner(`Error importing ${file}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ResourceTypeOps.importFirstResourceTypeFromFile: end`);\n return outcome;\n}\n\n/**\n * Import resource types from file\n * @param {string} file file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importResourceTypesFromFile(\n file: string\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ResourceTypeOps.importResourceTypesFromFile: begin`);\n showSpinner(`Importing ${file}...`);\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n await frodo.authz.resourceType.importResourceTypes(fileData);\n outcome = true;\n succeedSpinner(`Imported ${file}.`);\n } catch (error) {\n failSpinner(`Error importing ${file}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ResourceTypeOps.importResourceTypesFromFile: end`);\n return outcome;\n}\n\n/**\n * Import resource types from files\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importResourceTypesFromFiles(): Promise<boolean> {\n const errors = [];\n try {\n debugMessage(`cli.ResourceTypeOps.importResourceTypesFromFiles: begin`);\n const names = fs.readdirSync('.');\n const files = names.filter((name) =>\n name.toLowerCase().endsWith('.resourcetype.authz.json')\n );\n createProgressBar(files.length, 'Importing resource types...');\n let total = 0;\n for (const file of files) {\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData: ResourceTypeExportInterface = JSON.parse(data);\n const count = Object.keys(fileData.resourcetype).length;\n total += count;\n await frodo.authz.resourceType.importResourceTypes(fileData);\n updateProgressBar(`Imported ${count} resource types from ${file}`);\n } catch (error) {\n errors.push(error);\n updateProgressBar(`Error importing resource types from ${file}`);\n printMessage(error, 'error');\n }\n }\n stopProgressBar(\n `Finished importing ${total} resource types from ${files.length} files.`\n );\n } catch (error) {\n errors.push(error);\n stopProgressBar(`Error importing resource types from files.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ResourceTypeOps.importResourceTypesFromFiles: end`);\n return 0 === errors.length;\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AACpD,OAAOC,EAAE,MAAM,IAAI;AAEnB,SACEC,iBAAiB,EACjBC,iBAAiB,EACjBC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,eAAe,EACfC,cAAc,EACdC,iBAAiB,QACZ,kBAAkB;AACzB,SACEC,gBAAgB,EAChBC,cAAc,EACdC,SAAS,QACJ,4BAA4B;AAGnC;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,iBAAiBA,CAACC,IAAI,GAAG,KAAK,EAAoB;EACtE,IAAIC,OAAO,GAAG,KAAK;EACnB,IAAI;IACF,MAAMC,aAAa,GAAG,MAAMnB,KAAK,CAACoB,KAAK,CAACC,YAAY,CAACC,gBAAgB,CAAC,CAAC;IACvEH,aAAa,CAACI,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAACE,IAAI,CAACC,aAAa,CAACF,CAAC,CAACC,IAAI,CAAC,CAAC;IAC1D,IAAIT,IAAI,EAAE;MACR,MAAMW,KAAK,GAAGvB,WAAW,CAAC,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC;MAC1D,KA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I,EAAE,MAAM,CAAC;QAC1C,MAAMc,QAAqC,GAAGC,IAAI,CAACC,KAAK,CAACrC,IAAI,CAAC;QAC9D,MAAMqD,KAAK,GAAGC,MAAM,CAACC,IAAI,CAACpB,QAAQ,CAACqB,YAAY,CAAC,CAAC/C,MAAM;QACvD2C,KAAK,IAAIC,KAAK;QACd,MAAMnG,KAAK,CAACoB,KAAK,CAACC,YAAY,CAACqE,mBAAmB,CAACT,QAAQ,CAAC;QAC5DrE,iBAAiB,CAAE,YAAWuF,KAAM,wBAAuBhC,IAAK,EAAC,CAAC;MACpE,CAAC,CAAC,OAAO5B,KAAK,EAAE;QACde,MAAM,CAACzB,IAAI,CAACU,KAAK,CAAC;QAClB3B,iBAAiB,CAAE,uCAAsCuD,IAAK,EAAC,CAAC;QAChE3D,YAAY,CAAC+B,KAAK,EAAE,OAAO,CAAC;MAC9B;IACF;IACA7B,eAAe,CACZ,sBAAqBwF,KAAM,wBAAuBJ,KAAK,CAACvC,MAAO,SAClE,CAAC;EACH,CAAC,CAAC,OAAOhB,KAAK,EAAE;IACde,MAAM,CAACzB,IAAI,CAACU,KAAK,CAAC;IAClB7B,eAAe,CAAE,4CAA2C,CAAC;IAC7DF,YAAY,CAAC+B,KAAK,EAAE,OAAO,CAAC;EAC9B;EACAjC,YAAY,CAAE,uDAAsD,CAAC;EACrE,OAAO,CAAC,KAAKgD,MAAM,CAACC,MAAM;AAC5B"}
1
+ {"version":3,"file":"ResourceTypeOps.js","names":["frodo","state","fs","createObjectTable","createProgressBar","createTable","debugMessage","failSpinner","printMessage","showSpinner","stopProgressBar","succeedSpinner","updateProgressBar","getTypedFilename","saveJsonToFile","titleCase","getRealmName","helper","utils","getResourceTypes","getResourceType","getResourceTypeByName","exportResourceType","exportResourceTypeByName","exportResourceTypes","importResourceType","importResourceTypeByName","importFirstResourceType","importResourceTypes","authz","resourceType","listResourceTypes","long","outcome","resourceTypes","sort","a","b","name","localeCompare","table","push","description","uuid","toString","err","message","describeResourceType","resourceTypeUuid","json","error","_error$response","response","status","getRealm","_error$response2","_error$response2$data","data","describeResourceTypeByName","resourceTypeName","_error$response3","_error$response4","_error$response4$data","deleteResourceType","errors","length","errorMessages","map","_error$response5","_error$response5$data","join","deleteResourceTypeByName","_error$response6","_error$response6$data","deleteResourceTypes","resourceTypeId","exportResourceTypeToFile","file","fileName","exportData","exportResourceTypeByNameToFile","exportResourceTypesToFile","exportResourceTypesToFiles","importResourceTypeFromFile","readFileSync","fileData","JSON","parse","importResourceTypeByNameFromFile","importFirstResourceTypeFromFile","importResourceTypesFromFile","importResourceTypesFromFiles","names","readdirSync","files","filter","toLowerCase","endsWith","total","count","Object","keys","resourcetype"],"sources":["ops/ResourceTypeOps.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport fs from 'fs';\nimport type { ResourceTypeSkeleton } from '@rockcarver/frodo-lib/types/api/ApiTypes';\nimport {\n createObjectTable,\n createProgressBar,\n createTable,\n debugMessage,\n failSpinner,\n printMessage,\n showSpinner,\n stopProgressBar,\n succeedSpinner,\n updateProgressBar,\n} from '../utils/Console';\nimport {\n getTypedFilename,\n saveJsonToFile,\n titleCase,\n} from '../utils/ExportImportUtils';\nimport { ResourceTypeExportInterface } from '@rockcarver/frodo-lib/types/ops/ResourceTypeOps';\n\nconst { getRealmName } = frodo.helper.utils;\nconst {\n getResourceTypes,\n getResourceType,\n getResourceTypeByName,\n exportResourceType,\n exportResourceTypeByName,\n exportResourceTypes,\n importResourceType,\n importResourceTypeByName,\n importFirstResourceType,\n importResourceTypes,\n} = frodo.authz.resourceType;\n\n/**\n * List resource types\n * @param {boolean} long more fields\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function listResourceTypes(long = false): Promise<boolean> {\n let outcome = false;\n try {\n const resourceTypes = await getResourceTypes();\n resourceTypes.sort((a, b) => a.name.localeCompare(b.name));\n if (long) {\n const table = createTable(['Name', 'Description', 'Uuid']);\n for (const resourceType of resourceTypes) {\n table.push([\n `${resourceType.name}`,\n `${resourceType.description}`,\n `${resourceType.uuid}`,\n ]);\n }\n printMessage(table.toString(), 'data');\n } else {\n for (const resourceType of resourceTypes) {\n printMessage(`${resourceType.name}`, 'data');\n }\n }\n outcome = true;\n } catch (err) {\n printMessage(`listResourceTypes ERROR: ${err.message}`, 'error');\n printMessage(err, 'error');\n }\n return outcome;\n}\n\n/**\n * Describe resource type by uuid\n * @param {string} resourceTypeUuid resource type uuid\n * @param {boolean} json JSON output\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function describeResourceType(\n resourceTypeUuid: string,\n json = false\n): Promise<boolean> {\n let outcome = false;\n try {\n const resourceType = await getResourceType(resourceTypeUuid);\n if (json) {\n printMessage(resourceType, 'data');\n } else {\n const table = createObjectTable(resourceType);\n printMessage(table.toString(), 'data');\n }\n outcome = true;\n } catch (error) {\n if (error.response?.status === 404) {\n printMessage(\n `Resource Type with uuid ${resourceTypeUuid} does not exist in realm ${state.getRealm()}`,\n 'error'\n );\n } else {\n printMessage(error.response?.data?.message || error.message, 'error');\n }\n }\n return outcome;\n}\n\n/**\n * Describe resource type by name\n * @param {string} resourceTypeName resource type name\n * @param {boolean} json JSON output\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function describeResourceTypeByName(\n resourceTypeName: string,\n json = false\n): Promise<boolean> {\n let outcome = false;\n try {\n const resourceType = await getResourceTypeByName(resourceTypeName);\n if (json) {\n printMessage(resourceType, 'data');\n } else {\n const table = createObjectTable(resourceType);\n printMessage(table.toString(), 'data');\n }\n outcome = true;\n } catch (error) {\n if (error.response?.status === 404) {\n printMessage(\n `Resource Type with name ${resourceTypeName} does not exist in realm ${state.getRealm()}`,\n 'error'\n );\n } else {\n printMessage(error.response?.data?.message || error.message, 'error');\n }\n }\n return outcome;\n}\n\n/**\n * Delete resource type by uuid\n * @param {string} resourceTypeUuid resource type uuid\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteResourceType(\n resourceTypeUuid: string\n): Promise<boolean | ResourceTypeSkeleton> {\n debugMessage(`cli.ResourceTypeOps.deleteResourceType: begin`);\n showSpinner(`Deleting ${resourceTypeUuid}...`);\n let outcome = false;\n const errors = [];\n try {\n debugMessage(`Deleting resource type ${resourceTypeUuid}`);\n await deleteResourceType(resourceTypeUuid);\n } catch (error) {\n errors.push(error);\n }\n if (errors.length) {\n const errorMessages = errors\n .map((error) => error.response?.data?.message || error.message)\n .join('\\n');\n failSpinner(`Error deleting ${resourceTypeUuid}: ${errorMessages}`);\n } else {\n succeedSpinner(`Deleted ${resourceTypeUuid}.`);\n outcome = true;\n }\n debugMessage(\n `cli.ResourceTypeOps.deleteResourceType: end [outcome=${outcome}]`\n );\n return outcome;\n}\n\n/**\n * Delete resource type by name\n * @param {string} resourceTypeName resource type name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteResourceTypeByName(\n resourceTypeName: string\n): Promise<boolean | ResourceTypeSkeleton> {\n debugMessage(`cli.ResourceTypeOps.deleteResourceTypeByName: begin`);\n showSpinner(`Deleting ${resourceTypeName}...`);\n let outcome = false;\n const errors = [];\n try {\n debugMessage(`Deleting resource type ${resourceTypeName}`);\n await deleteResourceTypeByName(resourceTypeName);\n } catch (error) {\n errors.push(error);\n }\n if (errors.length) {\n const errorMessages = errors\n .map((error) => error.response?.data?.message || error.message)\n .join('\\n');\n failSpinner(`Error deleting ${resourceTypeName}: ${errorMessages}`);\n } else {\n succeedSpinner(`Deleted ${resourceTypeName}.`);\n outcome = true;\n }\n debugMessage(\n `cli.ResourceTypeOps.deleteResourceTypeByName: end [outcome=${outcome}]`\n );\n return outcome;\n}\n\n/**\n * Delete all resource types\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function deleteResourceTypes(): Promise<\n boolean | ResourceTypeSkeleton\n> {\n debugMessage(`cli.ResourceTypeOps.deleteResourceTypes: begin`);\n let outcome = false;\n const errors = [];\n let resourceTypes: ResourceTypeSkeleton[] = [];\n try {\n showSpinner(`Retrieving all resource types...`);\n try {\n resourceTypes = await getResourceTypes();\n succeedSpinner(`Found ${resourceTypes.length} resource types.`);\n } catch (error) {\n error.message = `Error retrieving all resource types: ${error.message}`;\n failSpinner(error.message);\n throw error;\n }\n if (resourceTypes.length)\n createProgressBar(\n resourceTypes.length,\n `Deleting ${resourceTypes.length} resource types...`\n );\n for (const resourceType of resourceTypes) {\n const resourceTypeId = resourceType.uuid;\n try {\n debugMessage(`Deleting resource type ${resourceTypeId}`);\n await deleteResourceType(resourceTypeId);\n updateProgressBar(`Deleted ${resourceTypeId}`);\n } catch (error) {\n error.message = `Error deleting resource type ${resourceTypeId}: ${error}`;\n updateProgressBar(error.message);\n errors.push(error);\n }\n }\n } catch (error) {\n error.message = `Error deleting resource types: ${error}`;\n errors.push(error);\n } finally {\n if (errors.length) {\n const errorMessages = errors.map((error) => error.message).join('\\n');\n if (resourceTypes.length)\n stopProgressBar(`Error deleting all resource types: ${errorMessages}`);\n } else {\n if (resourceTypes.length)\n stopProgressBar(`Deleted ${resourceTypes.length} resource types.`);\n outcome = true;\n }\n }\n debugMessage(\n `cli.ResourceTypeOps.deleteResourceTypes: end [outcome=${outcome}]`\n );\n return outcome;\n}\n\n/**\n * Export resource type to file\n * @param {string} resourceTypeUuid resource type uuid\n * @param {string} file file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportResourceTypeToFile(\n resourceTypeUuid: string,\n file: string\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ResourceTypeOps.exportResourceTypeToFile: begin`);\n showSpinner(`Exporting ${resourceTypeUuid}...`);\n try {\n let fileName = getTypedFilename(resourceTypeUuid, 'resourcetype.authz');\n if (file) {\n fileName = file;\n }\n const exportData = await exportResourceType(resourceTypeUuid);\n saveJsonToFile(exportData, fileName);\n succeedSpinner(`Exported ${resourceTypeUuid} to ${fileName}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting ${resourceTypeUuid}: ${error.message}`);\n }\n debugMessage(`cli.ResourceTypeOps.exportResourceTypeToFile: end`);\n return outcome;\n}\n\n/**\n * Export resource type by name to file\n * @param {string} resourceTypeName resource type name\n * @param {string} file file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportResourceTypeByNameToFile(\n resourceTypeName: string,\n file: string\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ResourceTypeOps.exportResourceTypeByNameToFile: begin`);\n showSpinner(`Exporting ${resourceTypeName}...`);\n try {\n let fileName = getTypedFilename(resourceTypeName, 'resourcetype.authz');\n if (file) {\n fileName = file;\n }\n const exportData = await exportResourceTypeByName(resourceTypeName);\n saveJsonToFile(exportData, fileName);\n succeedSpinner(`Exported ${resourceTypeName} to ${fileName}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting ${resourceTypeName}: ${error.message}`);\n }\n debugMessage(`cli.ResourceTypeOps.exportResourceTypeByNameToFile: end`);\n return outcome;\n}\n\n/**\n * Export resource types to file\n * @param {string} file file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportResourceTypesToFile(\n file: string\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ResourceTypeOps.exportResourceTypesToFile: begin`);\n showSpinner(`Exporting all resource types...`);\n try {\n let fileName = getTypedFilename(\n `all${titleCase(getRealmName(state.getRealm()))}ResourceTypes`,\n 'resourcetype.authz'\n );\n if (file) {\n fileName = file;\n }\n const exportData = await exportResourceTypes();\n saveJsonToFile(exportData, fileName);\n succeedSpinner(`Exported all resource types to ${fileName}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting resource types: ${error.message}`);\n }\n debugMessage(`cli.ResourceTypeOps.exportResourceTypesToFile: end`);\n return outcome;\n}\n\n/**\n * Export all resource types to separate files\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportResourceTypesToFiles(): Promise<boolean> {\n debugMessage(`cli.ResourceTypeOps.exportResourceTypesToFiles: begin`);\n const errors = [];\n try {\n const resourceTypes: ResourceTypeSkeleton[] = await getResourceTypes();\n createProgressBar(resourceTypes.length, 'Exporting resource types...');\n for (const resourceType of resourceTypes) {\n const file = getTypedFilename(resourceType.name, 'resourcetype.authz');\n try {\n const exportData: ResourceTypeExportInterface =\n await exportResourceType(resourceType.uuid);\n saveJsonToFile(exportData, file);\n updateProgressBar(`Exported ${resourceType.name}.`);\n } catch (error) {\n errors.push(error);\n updateProgressBar(`Error exporting ${resourceType.name}.`);\n }\n }\n stopProgressBar(`Export complete.`);\n } catch (error) {\n errors.push(error);\n stopProgressBar(`Error exporting resource types to files`);\n }\n debugMessage(`cli.ResourceTypeOps.exportResourceTypesToFiles: end`);\n return 0 === errors.length;\n}\n\n/**\n * Import resource type from file\n * @param {string} resourceTypeId resource type id\n * @param {string} file file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importResourceTypeFromFile(\n resourceTypeId: string,\n file: string\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ResourceTypeOps.importResourceTypeFromFile: begin`);\n showSpinner(`Importing ${resourceTypeId}...`);\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n await importResourceType(resourceTypeId, fileData);\n outcome = true;\n succeedSpinner(`Imported ${resourceTypeId}.`);\n } catch (error) {\n failSpinner(`Error importing ${resourceTypeId}: ${error.message}`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ResourceTypeOps.importResourceTypeFromFile: end`);\n return outcome;\n}\n\n/**\n * Import resource type by name from file\n * @param {string} resourceTypeName resource type name\n * @param {string} file file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importResourceTypeByNameFromFile(\n resourceTypeName: string,\n file: string\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ResourceTypeOps.importResourceTypeByNameFromFile: begin`);\n showSpinner(`Importing ${resourceTypeName}...`);\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n await importResourceTypeByName(resourceTypeName, fileData);\n outcome = true;\n succeedSpinner(`Imported ${resourceTypeName}.`);\n } catch (error) {\n failSpinner(`Error importing ${resourceTypeName}: ${error.message}`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ResourceTypeOps.importResourceTypeByNameFromFile: end`);\n return outcome;\n}\n\n/**\n * Import first resource type from file\n * @param {string} file file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importFirstResourceTypeFromFile(\n file: string\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ResourceTypeOps.importFirstResourceTypeFromFile: begin`);\n showSpinner(`Importing ${file}...`);\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n await importFirstResourceType(fileData);\n outcome = true;\n succeedSpinner(`Imported ${file}.`);\n } catch (error) {\n failSpinner(`Error importing ${file}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ResourceTypeOps.importFirstResourceTypeFromFile: end`);\n return outcome;\n}\n\n/**\n * Import resource types from file\n * @param {string} file file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importResourceTypesFromFile(\n file: string\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.ResourceTypeOps.importResourceTypesFromFile: begin`);\n showSpinner(`Importing ${file}...`);\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n await importResourceTypes(fileData);\n outcome = true;\n succeedSpinner(`Imported ${file}.`);\n } catch (error) {\n failSpinner(`Error importing ${file}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ResourceTypeOps.importResourceTypesFromFile: end`);\n return outcome;\n}\n\n/**\n * Import resource types from files\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importResourceTypesFromFiles(): Promise<boolean> {\n const errors = [];\n try {\n debugMessage(`cli.ResourceTypeOps.importResourceTypesFromFiles: begin`);\n const names = fs.readdirSync('.');\n const files = names.filter((name) =>\n name.toLowerCase().endsWith('.resourcetype.authz.json')\n );\n createProgressBar(files.length, 'Importing resource types...');\n let total = 0;\n for (const file of files) {\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData: ResourceTypeExportInterface = JSON.parse(data);\n const count = Object.keys(fileData.resourcetype).length;\n total += count;\n await importResourceTypes(fileData);\n updateProgressBar(`Imported ${count} resource types from ${file}`);\n } catch (error) {\n errors.push(error);\n updateProgressBar(`Error importing resource types from ${file}`);\n printMessage(error, 'error');\n }\n }\n stopProgressBar(\n `Finished importing ${total} resource types from ${files.length} files.`\n );\n } catch (error) {\n errors.push(error);\n stopProgressBar(`Error importing resource types from files.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.ResourceTypeOps.importResourceTypesFromFiles: end`);\n return 0 === errors.length;\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AACpD,OAAOC,EAAE,MAAM,IAAI;AAEnB,SACEC,iBAAiB,EACjBC,iBAAiB,EACjBC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,eAAe,EACfC,cAAc,EACdC,iBAAiB,QACZ,kBAAkB;AACzB,SACEC,gBAAgB,EAChBC,cAAc,EACdC,SAAS,QACJ,4BAA4B;AAGnC,MAAM;EAAEC;AAAa,CAAC,GAAGhB,KAAK,CAACiB,MAAM,CAACC,KAAK;AAC3C,MAAM;EACJC,gBAAgB;EAChBC,eAAe;EACfC,qBAAqB;EACrBC,kBAAkB;EAClBC,wBAAwB;EACxBC,mBAAmB;EACnBC,kBAAkB;EAClBC,wBAAwB;EACxBC,uBAAuB;EACvBC;AACF,CAAC,GAAG5B,KAAK,CAAC6B,KAAK,CAACC,YAAY;;AAE5B;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,iBAAiBA,CAACC,IAAI,GAAG,KAAK,EAAoB;EACtE,IAAIC,OAAO,GAAG,KAAK;EACnB,IAAI;IACF,MAAMC,aAAa,GAAG,MAAMf,gBAAgB,CAAC,CAAC;IAC9Ce,aAAa,CAACC,IAAI,CAAC,CAACC,CAAC,EAAEC,C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CAAC,CAAC,OAAO3B,KAAK,EAAE;QACdc,MAAM,CAACvB,IAAI,CAACS,KAAK,CAAC;QAClBtC,iBAAiB,CAAE,uCAAsCiE,IAAK,EAAC,CAAC;QAChErE,YAAY,CAAC0C,KAAK,EAAE,OAAO,CAAC;MAC9B;IACF;IACAxC,eAAe,CACZ,sBAAqBwF,KAAM,wBAAuBJ,KAAK,CAAC7B,MAAO,SAClE,CAAC;EACH,CAAC,CAAC,OAAOf,KAAK,EAAE;IACdc,MAAM,CAACvB,IAAI,CAACS,KAAK,CAAC;IAClBxC,eAAe,CAAE,4CAA2C,CAAC;IAC7DF,YAAY,CAAC0C,KAAK,EAAE,OAAO,CAAC;EAC9B;EACA5C,YAAY,CAAE,uDAAsD,CAAC;EACrE,OAAO,CAAC,KAAK0D,MAAM,CAACC,MAAM;AAC5B"}
@@ -2,6 +2,26 @@ import { frodo } from '@rockcarver/frodo-lib';
2
2
  import fs from 'fs';
3
3
  import { createObjectTable, createProgressBar, createTable, debugMessage, failSpinner, printMessage, showSpinner, stopProgressBar, succeedSpinner, updateProgressBar } from '../utils/Console';
4
4
  import { saveTextToFile } from '../utils/ExportImportUtils';
5
+ const {
6
+ decode
7
+ } = frodo.helper.base64;
8
+ const {
9
+ getTypedFilename,
10
+ saveJsonToFile,
11
+ getRealmString,
12
+ validateImport
13
+ } = frodo.utils.impex;
14
+ const {
15
+ getSaml2ProviderStubs,
16
+ getProviderByLocationAndId,
17
+ getSaml2ProviderStub,
18
+ getProviderMetadataUrl,
19
+ getProviderMetadata,
20
+ exportSaml2Provider,
21
+ exportSaml2Providers,
22
+ importSaml2Provider,
23
+ importSaml2Providers
24
+ } = frodo.saml2.entityProvider;
5
25
  const roleMap = {
6
26
  identityProvider: 'IDP',
7
27
  serviceProvider: 'SP',
@@ -57,7 +77,7 @@ export function getTableRowMd(saml2ProviderObj) {
57
77
  * @param {boolean} long Long list format with details
58
78
  */
59
79
  export async function listSaml2Providers(long = false) {
60
- const providerList = await frodo.saml2.entityProvider.getSaml2ProviderStubs();
80
+ const providerList = await getSaml2ProviderStubs();
61
81
  providerList.sort((a, b) => a._id.localeCompare(b._id));
62
82
  if (!long) {
63
83
  for (const provider of providerList) {
@@ -78,19 +98,19 @@ export async function listSaml2Providers(long = false) {
78
98
  */
79
99
  export async function describeSaml2Provider(entityId) {
80
100
  try {
81
- const stub = await frodo.saml2.entityProvider.getSaml2ProviderStub(entityId);
101
+ const stub = await getSaml2ProviderStub(entityId);
82
102
  printMessage(stub);
83
103
  const {
84
104
  location
85
105
  } = stub;
86
106
  const id = stub._id;
87
107
  const roles = stub.roles.map(role => roleMap[role]).join(', ');
88
- const rawProviderData = await frodo.saml2.entityProvider.getProviderByLocationAndId(location, id);
108
+ const rawProviderData = await getProviderByLocationAndId(location, id);
89
109
  delete rawProviderData._id;
90
110
  delete rawProviderData._rev;
91
111
  rawProviderData.location = location;
92
112
  rawProviderData.roles = roles;
93
- rawProviderData.metadataUrl = frodo.saml2.entityProvider.getProviderMetadataUrl(entityId);
113
+ rawProviderData.metadataUrl = getProviderMetadataUrl(entityId);
94
114
  const table = createObjectTable(rawProviderData);
95
115
  printMessage(table.toString());
96
116
  } catch (error) {
@@ -106,12 +126,12 @@ export async function describeSaml2Provider(entityId) {
106
126
  export async function exportSaml2MetadataToFile(entityId, file = null) {
107
127
  let fileName = file;
108
128
  if (!fileName) {
109
- fileName = frodo.utils.impex.getTypedFilename(entityId, 'metadata', 'xml');
129
+ fileName = getTypedFilename(entityId, 'metadata', 'xml');
110
130
  }
111
131
  createProgressBar(1, `Exporting metadata for: ${entityId}`);
112
132
  try {
113
133
  updateProgressBar(`Writing file ${fileName}`);
114
- const metaData = await frodo.saml2.entityProvider.getProviderMetadata(entityId);
134
+ const metaData = await getProviderMetadata(entityId);
115
135
  saveTextToFile(metaData, fileName);
116
136
  updateProgressBar(`Exported provider ${entityId}`);
117
137
  stopProgressBar(`Exported ${entityId.brightCyan} metadata to ${fileName.brightCyan}.`);
@@ -130,12 +150,12 @@ export async function exportSaml2ProviderToFile(entityId, file = null) {
130
150
  debugMessage(`cli.Saml2Ops.exportSaml2ProviderToFile: start [entityId=${entityId}, file=${file}]`);
131
151
  let fileName = file;
132
152
  if (!fileName) {
133
- fileName = frodo.utils.impex.getTypedFilename(entityId, 'saml');
153
+ fileName = getTypedFilename(entityId, 'saml');
134
154
  }
135
155
  try {
136
156
  createProgressBar(1, `Exporting provider ${entityId}`);
137
- const fileData = await frodo.saml2.entityProvider.exportSaml2Provider(entityId);
138
- frodo.utils.impex.saveJsonToFile(fileData, fileName);
157
+ const fileData = await exportSaml2Provider(entityId);
158
+ saveJsonToFile(fileData, fileName);
139
159
  updateProgressBar(`Exported provider ${entityId}`);
140
160
  stopProgressBar(`Exported ${entityId.brightCyan} to ${fileName.brightCyan}.`);
141
161
  } catch (err) {
@@ -153,11 +173,11 @@ export async function exportSaml2ProvidersToFile(file = null) {
153
173
  debugMessage(`cli.Saml2Ops.exportSaml2ProviderToFile: start [file=${file}]`);
154
174
  let fileName = file;
155
175
  if (!fileName) {
156
- fileName = frodo.utils.impex.getTypedFilename(`all${frodo.utils.impex.getRealmString()}Providers`, 'saml');
176
+ fileName = getTypedFilename(`all${getRealmString()}Providers`, 'saml');
157
177
  }
158
178
  try {
159
- const exportData = await frodo.saml2.entityProvider.exportSaml2Providers();
160
- frodo.utils.impex.saveJsonToFile(exportData, fileName);
179
+ const exportData = await exportSaml2Providers();
180
+ saveJsonToFile(exportData, fileName);
161
181
  } catch (error) {
162
182
  var _error$response;
163
183
  printMessage(error.message, 'error');
@@ -170,13 +190,13 @@ export async function exportSaml2ProvidersToFile(file = null) {
170
190
  * Export all entity providers to individual files
171
191
  */
172
192
  export async function exportSaml2ProvidersToFiles() {
173
- const stubs = await frodo.saml2.entityProvider.getSaml2ProviderStubs();
193
+ const stubs = await getSaml2ProviderStubs();
174
194
  if (stubs.length > 0) {
175
195
  createProgressBar(stubs.length, 'Exporting providers');
176
196
  for (const stub of stubs) {
177
- const fileName = frodo.utils.impex.getTypedFilename(stub.entityId, 'saml');
178
- const fileData = await frodo.saml2.entityProvider.exportSaml2Provider(stub.entityId);
179
- frodo.utils.impex.saveJsonToFile(fileData, fileName);
197
+ const fileName = getTypedFilename(stub.entityId, 'saml');
198
+ const fileData = await exportSaml2Provider(stub.entityId);
199
+ saveJsonToFile(fileData, fileName);
180
200
  updateProgressBar(`Exported provider ${stub.entityId}`);
181
201
  }
182
202
  stopProgressBar(`${stubs.length} providers exported.`);
@@ -196,7 +216,7 @@ export async function importSaml2ProviderFromFile(entityId, file) {
196
216
  const fileData = JSON.parse(data);
197
217
  showSpinner(`Importing ${entityId}...`);
198
218
  try {
199
- await frodo.saml2.entityProvider.importSaml2Provider(entityId, fileData);
219
+ await importSaml2Provider(entityId, fileData);
200
220
  succeedSpinner(`Imported ${entityId}.`);
201
221
  } catch (error) {
202
222
  failSpinner(`Error importing ${entityId}: ${error.message}`);
@@ -214,10 +234,10 @@ export async function importFirstSaml2ProviderFromFile(file) {
214
234
  const fileData = JSON.parse(data);
215
235
  // pick the first provider and run with it
216
236
  const entityId64 = Object.keys(fileData.saml.remote)[0] || Object.keys(fileData.saml.hosted)[0];
217
- const entityId = frodo.helper.base64.decode(entityId64);
237
+ const entityId = decode(entityId64);
218
238
  showSpinner(`Importing ${entityId}...`);
219
239
  try {
220
- await frodo.saml2.entityProvider.importSaml2Provider(entityId, fileData);
240
+ await importSaml2Provider(entityId, fileData);
221
241
  succeedSpinner(`Imported ${entityId}.`);
222
242
  } catch (error) {
223
243
  failSpinner(`Error importing ${entityId}: ${error.message}`);
@@ -233,8 +253,8 @@ export async function importSaml2ProvidersFromFile(file) {
233
253
  fs.readFile(file, 'utf8', async (err, data) => {
234
254
  if (err) throw err;
235
255
  const fileData = JSON.parse(data);
236
- if (frodo.utils.impex.validateImport(fileData.meta)) {
237
- await frodo.saml2.entityProvider.importSaml2Providers(fileData);
256
+ if (validateImport(fileData.meta)) {
257
+ await importSaml2Providers(fileData);
238
258
  } else {
239
259
  printMessage('Import validation failed...', 'error');
240
260
  }
@@ -257,8 +277,8 @@ export async function importSaml2ProvidersFromFiles() {
257
277
  for (const file of jsonFiles) {
258
278
  const data = fs.readFileSync(file, 'utf8');
259
279
  const fileData = JSON.parse(data);
260
- if (frodo.utils.impex.validateImport(fileData.meta)) {
261
- const myStatus = await frodo.saml2.entityProvider.importSaml2Providers(fileData);
280
+ if (validateImport(fileData.meta)) {
281
+ const myStatus = await importSaml2Providers(fileData);
262
282
  totalStatus.total += myStatus.total;
263
283
  totalStatus.successes += myStatus.successes;
264
284
  totalStatus.warnings += myStatus.warnings;
@@ -1 +1 @@
1
- {"version":3,"file":"Saml2Ops.js","names":["frodo","fs","createObjectTable","createProgressBar","createTable","debugMessage","failSpinner","printMessage","showSpinner","stopProgressBar","succeedSpinner","updateProgressBar","saveTextToFile","roleMap","identityProvider","serviceProvider","attributeQueryProvider","xacmlPolicyEnforcementPoint","getOneLineDescription","saml2ProviderObj","roles","key","value","Object","entries","push","description","entityId","entityLocation","length","join","getTableHeaderMd","markdown","getTableRowMd","row","listSaml2Providers","long","providerList","saml2","entityProvider","getSaml2ProviderStubs","sort","a","b","_id","localeCompare","provider","table","location","map","role","toString","describeSaml2Provider","stub","getSaml2ProviderStub","id","rawProviderData","getProviderByLocationAndId","_rev","metadataUrl","getProviderMetadataUrl","error","message","exportSaml2MetadataToFile","file","fileName","utils","impex","getTypedFilename","metaData","getProviderMetadata","brightCyan","exportSaml2ProviderToFile","fileData","exportSaml2Provider","saveJsonToFile","err","exportSaml2ProvidersToFile","getRealmString","exportData","exportSaml2Providers","_error$response","response","status","exportSaml2ProvidersToFiles","stubs","importSaml2ProviderFromFile","readFile","data","JSON","parse","importSaml2Provider","importFirstSaml2ProviderFromFile","entityId64","keys","saml","remote","hosted","helper","base64","decode","importSaml2ProvidersFromFile","validateImport","meta","importSaml2Providers","importSaml2ProvidersFromFiles","names","readdirSync","jsonFiles","filter","name","toLowerCase","endsWith","totalStatus","total","successes","warnings","failures","readFileSync","myStatus"],"sources":["ops/Saml2Ops.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport fs from 'fs';\nimport {\n createObjectTable,\n createProgressBar,\n createTable,\n debugMessage,\n failSpinner,\n printMessage,\n showSpinner,\n stopProgressBar,\n succeedSpinner,\n updateProgressBar,\n} from '../utils/Console';\nimport { saveTextToFile } from '../utils/ExportImportUtils';\nimport type {\n MultiOpStatusInterface,\n Saml2ExportInterface,\n} from '@rockcarver/frodo-lib/types/ops/OpsTypes';\nimport type { Saml2ProviderSkeleton } from '@rockcarver/frodo-lib/types/api/ApiTypes';\n\nconst roleMap = {\n identityProvider: 'IDP',\n serviceProvider: 'SP',\n attributeQueryProvider: 'AttrQuery',\n xacmlPolicyEnforcementPoint: 'XACML PEP',\n};\n\n/**\n * Get a one-line description of the saml2 provider object\n * @param {Saml2ProviderSkeleton} saml2ProviderObj saml2 provider object to describe\n * @returns {string} a one-line description\n */\nexport function getOneLineDescription(\n saml2ProviderObj: Saml2ProviderSkeleton\n): string {\n const roles: string[] = [];\n for (const [key, value] of Object.entries(roleMap)) {\n if (saml2ProviderObj[key]) {\n roles.push(value);\n }\n }\n const description = `[${saml2ProviderObj.entityId['brightCyan']}]${\n ' (' + saml2ProviderObj.entityLocation\n }${roles.length ? ' ' + roles.join(', ') + ')' : ')'}`;\n return description;\n}\n\n/**\n * Get markdown table header\n * @returns {string} markdown table header\n */\nexport function getTableHeaderMd(): string {\n let markdown = '';\n markdown += '| Entity Id | Location | Role(s) |\\n';\n markdown += '| --------- | -------- | ------- |';\n return markdown;\n}\n\n/**\n * Get a table-row of the saml2 provider in markdown\n * @param {Saml2ProviderSkeleton} saml2ProviderObj saml2 provider object to describe\n * @returns {string} a table-row of the saml2 provider in markdown\n */\nexport function getTableRowMd(saml2ProviderObj: Saml2ProviderSkeleton): string {\n const roles: string[] = [];\n for (const [key, value] of Object.entries(roleMap)) {\n if (saml2ProviderObj[key]) {\n roles.push(value);\n }\n }\n const row = `| ${saml2ProviderObj.entityId} | ${\n saml2ProviderObj.entityLocation\n } | ${roles.length ? roles.join(', ') : ''} |`;\n return row;\n}\n\n/**\n * List entity providers\n * @param {boolean} long Long list format with details\n */\nexport async function listSaml2Providers(long = false) {\n const providerList = await frodo.saml2.entityProvider.getSaml2ProviderStubs();\n providerList.sort((a, b) => a._id.localeCompare(b._id));\n if (!long) {\n for (const provider of providerList) {\n printMessage(`${provider.entityId}`, 'data');\n }\n } else {\n const table = createTable([\n 'Entity Id'['brightCyan'],\n 'Location'['brightCyan'],\n 'Role(s)'['brightCyan'],\n ]);\n for (const provider of providerList) {\n table.push([\n provider.entityId,\n provider.location,\n provider.roles.map((role) => roleMap[role]).join(', '),\n ]);\n }\n printMessage(table.toString());\n }\n}\n\n/**\n * Describe an entity provider's configuration\n * @param {String} entityId Provider entity id\n */\nexport async function describeSaml2Provider(entityId) {\n try {\n const stub = await frodo.saml2.entityProvider.getSaml2ProviderStub(\n entityId\n );\n printMessage(stub);\n const { location } = stub;\n const id = stub._id;\n const roles = stub.roles.map((role: string) => roleMap[role]).join(', ');\n const rawProviderData =\n await frodo.saml2.entityProvider.getProviderByLocationAndId(location, id);\n delete rawProviderData._id;\n delete rawProviderData._rev;\n rawProviderData.location = location;\n rawProviderData.roles = roles;\n rawProviderData.metadataUrl =\n frodo.saml2.entityProvider.getProviderMetadataUrl(entityId);\n const table = createObjectTable(rawProviderData);\n printMessage(table.toString());\n } catch (error) {\n printMessage(error.message, 'error');\n }\n}\n\n/**\n * Export provider metadata to file\n * @param {String} entityId Provider entity id\n * @param {String} file Optional filename\n */\nexport async function exportSaml2MetadataToFile(entityId, file = null) {\n let fileName = file;\n if (!fileName) {\n fileName = frodo.utils.impex.getTypedFilename(entityId, 'metadata', 'xml');\n }\n createProgressBar(1, `Exporting metadata for: ${entityId}`);\n try {\n updateProgressBar(`Writing file ${fileName}`);\n const metaData = await frodo.saml2.entityProvider.getProviderMetadata(\n entityId\n );\n saveTextToFile(metaData, fileName);\n updateProgressBar(`Exported provider ${entityId}`);\n stopProgressBar(\n `Exported ${entityId.brightCyan} metadata to ${fileName.brightCyan}.`\n );\n } catch (error) {\n stopProgressBar(`${error}`);\n printMessage(error, 'error');\n }\n}\n\n/**\n * Export a single entity provider to file\n * @param {String} entityId Provider entity id\n * @param {String} file Optional filename\n */\nexport async function exportSaml2ProviderToFile(entityId, file = null) {\n debugMessage(\n `cli.Saml2Ops.exportSaml2ProviderToFile: start [entityId=${entityId}, file=${file}]`\n );\n let fileName = file;\n if (!fileName) {\n fileName = frodo.utils.impex.getTypedFilename(entityId, 'saml');\n }\n try {\n createProgressBar(1, `Exporting provider ${entityId}`);\n const fileData = await frodo.saml2.entityProvider.exportSaml2Provider(\n entityId\n );\n frodo.utils.impex.saveJsonToFile(fileData, fileName);\n updateProgressBar(`Exported provider ${entityId}`);\n stopProgressBar(\n `Exported ${entityId.brightCyan} to ${fileName.brightCyan}.`\n );\n } catch (err) {\n stopProgressBar(`${err}`);\n printMessage(err, 'error');\n }\n debugMessage(\n `cli.Saml2Ops.exportSaml2ProviderToFile: end [entityId=${entityId}, file=${fileName}]`\n );\n}\n\n/**\n * Export all entity providers to one file\n * @param {String} file Optional filename\n */\nexport async function exportSaml2ProvidersToFile(file = null) {\n debugMessage(`cli.Saml2Ops.exportSaml2ProviderToFile: start [file=${file}]`);\n let fileName = file;\n if (!fileName) {\n fileName = frodo.utils.impex.getTypedFilename(\n `all${frodo.utils.impex.getRealmString()}Providers`,\n 'saml'\n );\n }\n try {\n const exportData = await frodo.saml2.entityProvider.exportSaml2Providers();\n frodo.utils.impex.saveJsonToFile(exportData, fileName);\n } catch (error) {\n printMessage(error.message, 'error');\n printMessage(\n `exportSaml2ProvidersToFile: ${error.response?.status}`,\n 'error'\n );\n }\n debugMessage(`cli.Saml2Ops.exportSaml2ProviderToFile: end [file=${file}]`);\n}\n\n/**\n * Export all entity providers to individual files\n */\nexport async function exportSaml2ProvidersToFiles() {\n const stubs = await frodo.saml2.entityProvider.getSaml2ProviderStubs();\n if (stubs.length > 0) {\n createProgressBar(stubs.length, 'Exporting providers');\n for (const stub of stubs) {\n const fileName = frodo.utils.impex.getTypedFilename(\n stub.entityId,\n 'saml'\n );\n const fileData = await frodo.saml2.entityProvider.exportSaml2Provider(\n stub.entityId\n );\n frodo.utils.impex.saveJsonToFile(fileData, fileName);\n updateProgressBar(`Exported provider ${stub.entityId}`);\n }\n stopProgressBar(`${stubs.length} providers exported.`);\n } else {\n printMessage('No entity providers found.', 'info');\n }\n}\n\n/**\n * Import a SAML entity provider by entity id from file\n * @param {String} entityId Provider entity id\n * @param {String} file Import file name\n */\nexport async function importSaml2ProviderFromFile(\n entityId: string,\n file: string\n) {\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n const fileData = JSON.parse(data);\n showSpinner(`Importing ${entityId}...`);\n try {\n await frodo.saml2.entityProvider.importSaml2Provider(entityId, fileData);\n succeedSpinner(`Imported ${entityId}.`);\n } catch (error) {\n failSpinner(`Error importing ${entityId}: ${error.message}`);\n }\n });\n}\n\n/**\n * Import a SAML entity provider by entity id from file\n * @param {String} file Import file name\n */\nexport async function importFirstSaml2ProviderFromFile(file: string) {\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n const fileData = JSON.parse(data) as Saml2ExportInterface;\n // pick the first provider and run with it\n const entityId64 =\n Object.keys(fileData.saml.remote)[0] ||\n Object.keys(fileData.saml.hosted)[0];\n const entityId = frodo.helper.base64.decode(entityId64);\n showSpinner(`Importing ${entityId}...`);\n try {\n await frodo.saml2.entityProvider.importSaml2Provider(entityId, fileData);\n succeedSpinner(`Imported ${entityId}.`);\n } catch (error) {\n failSpinner(`Error importing ${entityId}: ${error.message}`);\n }\n });\n}\n\n/**\n * Import all SAML entity providers from file\n * @param {String} file Import file name\n */\nexport async function importSaml2ProvidersFromFile(file: string) {\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n const fileData = JSON.parse(data);\n if (frodo.utils.impex.validateImport(fileData.meta)) {\n await frodo.saml2.entityProvider.importSaml2Providers(fileData);\n } else {\n printMessage('Import validation failed...', 'error');\n }\n });\n}\n\n/**\n * Import all SAML entity providers from all *.saml.json files in the current directory\n */\nexport async function importSaml2ProvidersFromFiles() {\n const names = fs.readdirSync('.');\n const jsonFiles = names.filter((name) =>\n name.toLowerCase().endsWith('.saml.json')\n );\n createProgressBar(jsonFiles.length, 'Importing providers...');\n const totalStatus: MultiOpStatusInterface = {\n total: 0,\n successes: 0,\n warnings: 0,\n failures: 0,\n };\n for (const file of jsonFiles) {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n if (frodo.utils.impex.validateImport(fileData.meta)) {\n const myStatus = await frodo.saml2.entityProvider.importSaml2Providers(\n fileData\n );\n totalStatus.total += myStatus.total;\n totalStatus.successes += myStatus.successes;\n totalStatus.warnings += myStatus.warnings;\n totalStatus.failures += myStatus.failures;\n updateProgressBar(\n `Imported ${myStatus.successes}/${myStatus.total} provider(s) from ${file}.`\n );\n } else {\n printMessage(`Validation of ${file} failed!`, 'error');\n }\n }\n stopProgressBar(\n `Imported ${totalStatus.successes} of ${totalStatus.total} provider(s) from ${jsonFiles.length} file(s).`\n );\n}\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAC7C,OAAOC,EAAE,MAAM,IAAI;AACnB,SACEC,iBAAiB,EACjBC,iBAAiB,EACjBC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,eAAe,EACfC,cAAc,EACdC,iBAAiB,QACZ,kBAAkB;AACzB,SAASC,cAAc,QAAQ,4BAA4B;AAO3D,MAAMC,OAAO,GAAG;EACdC,gBAAgB,EAAE,KAAK;EACvBC,eAAe,EAAE,IAAI;EACrBC,sBAAsB,EAAE,WAAW;EACnCC,2BAA2B,EAAE;AAC/B,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,qBAAqBA,CACnCC,gBAAuC,EAC/B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AAQ,CAACL,KAAM,qBAAoBlD,IAAK,GAC5E,CAAC;IACH,CAAC,MAAM;MACLzD,YAAY,CAAE,iBAAgByD,IAAK,UAAS,EAAE,OAAO,CAAC;IACxD;EACF;EACAvD,eAAe,CACZ,YAAWwG,WAAW,CAACE,SAAU,OAAMF,WAAW,CAACC,KAAM,qBAAoBN,SAAS,CAAC/E,MAAO,WACjG,CAAC;AACH"}
1
+ {"version":3,"file":"Saml2Ops.js","names":["frodo","fs","createObjectTable","createProgressBar","createTable","debugMessage","failSpinner","printMessage","showSpinner","stopProgressBar","succeedSpinner","updateProgressBar","saveTextToFile","decode","helper","base64","getTypedFilename","saveJsonToFile","getRealmString","validateImport","utils","impex","getSaml2ProviderStubs","getProviderByLocationAndId","getSaml2ProviderStub","getProviderMetadataUrl","getProviderMetadata","exportSaml2Provider","exportSaml2Providers","importSaml2Provider","importSaml2Providers","saml2","entityProvider","roleMap","identityProvider","serviceProvider","attributeQueryProvider","xacmlPolicyEnforcementPoint","getOneLineDescription","saml2ProviderObj","roles","key","value","Object","entries","push","description","entityId","entityLocation","length","join","getTableHeaderMd","markdown","getTableRowMd","row","listSaml2Providers","long","providerList","sort","a","b","_id","localeCompare","provider","table","location","map","role","toString","describeSaml2Provider","stub","id","rawProviderData","_rev","metadataUrl","error","message","exportSaml2MetadataToFile","file","fileName","metaData","brightCyan","exportSaml2ProviderToFile","fileData","err","exportSaml2ProvidersToFile","exportData","_error$response","response","status","exportSaml2ProvidersToFiles","stubs","importSaml2ProviderFromFile","readFile","data","JSON","parse","importFirstSaml2ProviderFromFile","entityId64","keys","saml","remote","hosted","importSaml2ProvidersFromFile","meta","importSaml2ProvidersFromFiles","names","readdirSync","jsonFiles","filter","name","toLowerCase","endsWith","totalStatus","total","successes","warnings","failures","readFileSync","myStatus"],"sources":["ops/Saml2Ops.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport fs from 'fs';\nimport {\n createObjectTable,\n createProgressBar,\n createTable,\n debugMessage,\n failSpinner,\n printMessage,\n showSpinner,\n stopProgressBar,\n succeedSpinner,\n updateProgressBar,\n} from '../utils/Console';\nimport { saveTextToFile } from '../utils/ExportImportUtils';\nimport type {\n MultiOpStatusInterface,\n Saml2ExportInterface,\n} from '@rockcarver/frodo-lib/types/ops/OpsTypes';\nimport type { Saml2ProviderSkeleton } from '@rockcarver/frodo-lib/types/api/ApiTypes';\n\nconst { decode } = frodo.helper.base64;\nconst { getTypedFilename, saveJsonToFile, getRealmString, validateImport } =\n frodo.utils.impex;\nconst {\n getSaml2ProviderStubs,\n getProviderByLocationAndId,\n getSaml2ProviderStub,\n getProviderMetadataUrl,\n getProviderMetadata,\n exportSaml2Provider,\n exportSaml2Providers,\n importSaml2Provider,\n importSaml2Providers,\n} = frodo.saml2.entityProvider;\n\nconst roleMap = {\n identityProvider: 'IDP',\n serviceProvider: 'SP',\n attributeQueryProvider: 'AttrQuery',\n xacmlPolicyEnforcementPoint: 'XACML PEP',\n};\n\n/**\n * Get a one-line description of the saml2 provider object\n * @param {Saml2ProviderSkeleton} saml2ProviderObj saml2 provider object to describe\n * @returns {string} a one-line description\n */\nexport function getOneLineDescription(\n saml2ProviderObj: Saml2ProviderSkeleton\n): string {\n const roles: string[] = [];\n for (const [key, value] of Object.entries(roleMap)) {\n if (saml2ProviderObj[key]) {\n roles.push(value);\n }\n }\n const description = `[${saml2ProviderObj.entityId['brightCyan']}]${\n ' (' + saml2ProviderObj.entityLocation\n }${roles.length ? ' ' + roles.join(', ') + ')' : ')'}`;\n return description;\n}\n\n/**\n * Get markdown table header\n * @returns {string} markdown table header\n */\nexport function getTableHeaderMd(): string {\n let markdown = '';\n markdown += '| Entity Id | Location | Role(s) |\\n';\n markdown += '| --------- | -------- | ------- |';\n return markdown;\n}\n\n/**\n * Get a table-row of the saml2 provider in markdown\n * @param {Saml2ProviderSkeleton} saml2ProviderObj saml2 provider object to describe\n * @returns {string} a table-row of the saml2 provider in markdown\n */\nexport function getTableRowMd(saml2ProviderObj: Saml2ProviderSkeleton): string {\n const roles: string[] = [];\n for (const [key, value] of Object.entries(roleMap)) {\n if (saml2ProviderObj[key]) {\n roles.push(value);\n }\n }\n const row = `| ${saml2ProviderObj.entityId} | ${\n saml2ProviderObj.entityLocation\n } | ${roles.length ? roles.join(', ') : ''} |`;\n return row;\n}\n\n/**\n * List entity providers\n * @param {boolean} long Long list format with details\n */\nexport async function listSaml2Providers(long = false) {\n const providerList = await getSaml2ProviderStubs();\n providerList.sort((a, b) => a._id.localeCompare(b._id));\n if (!long) {\n for (const provider of providerList) {\n printMessage(`${provider.entityId}`, 'data');\n }\n } else {\n const table = createTable([\n 'Entity Id'['brightCyan'],\n 'Location'['brightCyan'],\n 'Role(s)'['brightCyan'],\n ]);\n for (const provider of providerList) {\n table.push([\n provider.entityId,\n provider.location,\n provider.roles.map((role) => roleMap[role]).join(', '),\n ]);\n }\n printMessage(table.toString());\n }\n}\n\n/**\n * Describe an entity provider's configuration\n * @param {String} entityId Provider entity id\n */\nexport async function describeSaml2Provider(entityId) {\n try {\n const stub = await getSaml2ProviderStub(entityId);\n printMessage(stub);\n const { location } = stub;\n const id = stub._id;\n const roles = stub.roles.map((role: string) => roleMap[role]).join(', ');\n const rawProviderData = await getProviderByLocationAndId(location, id);\n delete rawProviderData._id;\n delete rawProviderData._rev;\n rawProviderData.location = location;\n rawProviderData.roles = roles;\n rawProviderData.metadataUrl = getProviderMetadataUrl(entityId);\n const table = createObjectTable(rawProviderData);\n printMessage(table.toString());\n } catch (error) {\n printMessage(error.message, 'error');\n }\n}\n\n/**\n * Export provider metadata to file\n * @param {String} entityId Provider entity id\n * @param {String} file Optional filename\n */\nexport async function exportSaml2MetadataToFile(entityId, file = null) {\n let fileName = file;\n if (!fileName) {\n fileName = getTypedFilename(entityId, 'metadata', 'xml');\n }\n createProgressBar(1, `Exporting metadata for: ${entityId}`);\n try {\n updateProgressBar(`Writing file ${fileName}`);\n const metaData = await getProviderMetadata(entityId);\n saveTextToFile(metaData, fileName);\n updateProgressBar(`Exported provider ${entityId}`);\n stopProgressBar(\n `Exported ${entityId.brightCyan} metadata to ${fileName.brightCyan}.`\n );\n } catch (error) {\n stopProgressBar(`${error}`);\n printMessage(error, 'error');\n }\n}\n\n/**\n * Export a single entity provider to file\n * @param {String} entityId Provider entity id\n * @param {String} file Optional filename\n */\nexport async function exportSaml2ProviderToFile(entityId, file = null) {\n debugMessage(\n `cli.Saml2Ops.exportSaml2ProviderToFile: start [entityId=${entityId}, file=${file}]`\n );\n let fileName = file;\n if (!fileName) {\n fileName = getTypedFilename(entityId, 'saml');\n }\n try {\n createProgressBar(1, `Exporting provider ${entityId}`);\n const fileData = await exportSaml2Provider(entityId);\n saveJsonToFile(fileData, fileName);\n updateProgressBar(`Exported provider ${entityId}`);\n stopProgressBar(\n `Exported ${entityId.brightCyan} to ${fileName.brightCyan}.`\n );\n } catch (err) {\n stopProgressBar(`${err}`);\n printMessage(err, 'error');\n }\n debugMessage(\n `cli.Saml2Ops.exportSaml2ProviderToFile: end [entityId=${entityId}, file=${fileName}]`\n );\n}\n\n/**\n * Export all entity providers to one file\n * @param {String} file Optional filename\n */\nexport async function exportSaml2ProvidersToFile(file = null) {\n debugMessage(`cli.Saml2Ops.exportSaml2ProviderToFile: start [file=${file}]`);\n let fileName = file;\n if (!fileName) {\n fileName = getTypedFilename(`all${getRealmString()}Providers`, 'saml');\n }\n try {\n const exportData = await exportSaml2Providers();\n saveJsonToFile(exportData, fileName);\n } catch (error) {\n printMessage(error.message, 'error');\n printMessage(\n `exportSaml2ProvidersToFile: ${error.response?.status}`,\n 'error'\n );\n }\n debugMessage(`cli.Saml2Ops.exportSaml2ProviderToFile: end [file=${file}]`);\n}\n\n/**\n * Export all entity providers to individual files\n */\nexport async function exportSaml2ProvidersToFiles() {\n const stubs = await getSaml2ProviderStubs();\n if (stubs.length > 0) {\n createProgressBar(stubs.length, 'Exporting providers');\n for (const stub of stubs) {\n const fileName = getTypedFilename(stub.entityId, 'saml');\n const fileData = await exportSaml2Provider(stub.entityId);\n saveJsonToFile(fileData, fileName);\n updateProgressBar(`Exported provider ${stub.entityId}`);\n }\n stopProgressBar(`${stubs.length} providers exported.`);\n } else {\n printMessage('No entity providers found.', 'info');\n }\n}\n\n/**\n * Import a SAML entity provider by entity id from file\n * @param {String} entityId Provider entity id\n * @param {String} file Import file name\n */\nexport async function importSaml2ProviderFromFile(\n entityId: string,\n file: string\n) {\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n const fileData = JSON.parse(data);\n showSpinner(`Importing ${entityId}...`);\n try {\n await importSaml2Provider(entityId, fileData);\n succeedSpinner(`Imported ${entityId}.`);\n } catch (error) {\n failSpinner(`Error importing ${entityId}: ${error.message}`);\n }\n });\n}\n\n/**\n * Import a SAML entity provider by entity id from file\n * @param {String} file Import file name\n */\nexport async function importFirstSaml2ProviderFromFile(file: string) {\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n const fileData = JSON.parse(data) as Saml2ExportInterface;\n // pick the first provider and run with it\n const entityId64 =\n Object.keys(fileData.saml.remote)[0] ||\n Object.keys(fileData.saml.hosted)[0];\n const entityId = decode(entityId64);\n showSpinner(`Importing ${entityId}...`);\n try {\n await importSaml2Provider(entityId, fileData);\n succeedSpinner(`Imported ${entityId}.`);\n } catch (error) {\n failSpinner(`Error importing ${entityId}: ${error.message}`);\n }\n });\n}\n\n/**\n * Import all SAML entity providers from file\n * @param {String} file Import file name\n */\nexport async function importSaml2ProvidersFromFile(file: string) {\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n const fileData = JSON.parse(data);\n if (validateImport(fileData.meta)) {\n await importSaml2Providers(fileData);\n } else {\n printMessage('Import validation failed...', 'error');\n }\n });\n}\n\n/**\n * Import all SAML entity providers from all *.saml.json files in the current directory\n */\nexport async function importSaml2ProvidersFromFiles() {\n const names = fs.readdirSync('.');\n const jsonFiles = names.filter((name) =>\n name.toLowerCase().endsWith('.saml.json')\n );\n createProgressBar(jsonFiles.length, 'Importing providers...');\n const totalStatus: MultiOpStatusInterface = {\n total: 0,\n successes: 0,\n warnings: 0,\n failures: 0,\n };\n for (const file of jsonFiles) {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n if (validateImport(fileData.meta)) {\n const myStatus = await importSaml2Providers(fileData);\n totalStatus.total += myStatus.total;\n totalStatus.successes += myStatus.successes;\n totalStatus.warnings += myStatus.warnings;\n totalStatus.failures += myStatus.failures;\n updateProgressBar(\n `Imported ${myStatus.successes}/${myStatus.total} provider(s) from ${file}.`\n );\n } else {\n printMessage(`Validation of ${file} failed!`, 'error');\n }\n }\n stopProgressBar(\n `Imported ${totalStatus.successes} of ${totalStatus.total} provider(s) from ${jsonFiles.length} file(s).`\n );\n}\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAC7C,OAAOC,EAAE,MAAM,IAAI;AACnB,SACEC,iBAAiB,EACjBC,iBAAiB,EACjBC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,eAAe,EACfC,cAAc,EACdC,iBAAiB,QACZ,kBAAkB;AACzB,SAASC,cAAc,QAAQ,4BAA4B;AAO3D,MAAM;EAAEC;AAAO,CAAC,GAAGb,KAAK,CAACc,MAAM,CAACC,MAAM;AACtC,MAAM;EAAEC,gBAAgB;EAAEC,cAAc;EAAEC,cAAc;EAAEC;AAAe,CAAC,GACxEnB,KAAK,CAACoB,KAAK,CAACC,KAAK;AACnB,MAAM;EACJC,qBAAqB;EACrBC,0BAA0B;EAC1BC,oBAAoB;EACpBC,sBAAsB;EACtBC,mBAAmB;EACnBC,mBAAmB;EACnBC,oBAAoB;EACpBC,mBAAmB;EACnBC;AACF,CAAC,GAAG9B,KAAK,CAAC+B,KAAK,CAACC,cAAc;AAE9B,MAAMC,OAAO,GAAG;EACdC,gBAAgB,EAAE,KAAK;EACvBC,eAAe,EAAE,IAAI;EACrBC,sBAAsB,EAAE,WAAW;EACnCC,2BAA2B,EAA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,CAACF,IAAI,CAAC;IACjC,IAAI3E,cAAc,CAACgE,QAAQ,CAACqB,IAAI,CAAC,EAAE;MACjC,MAAMe,QAAQ,GAAG,MAAMzF,oBAAoB,CAACqD,QAAQ,CAAC;MACrD8B,WAAW,CAACC,KAAK,IAAIK,QAAQ,CAACL,KAAK;MACnCD,WAAW,CAACE,SAAS,IAAII,QAAQ,CAACJ,SAAS;MAC3CF,WAAW,CAACG,QAAQ,IAAIG,QAAQ,CAACH,QAAQ;MACzCH,WAAW,CAACI,QAAQ,IAAIE,QAAQ,CAACF,QAAQ;MACzC1G,iBAAiB,CACd,YAAW4G,QAAQ,CAACJ,SAAU,IAAGI,QAAQ,CAACL,KAAM,qBAAoBpC,IAAK,GAC5E,CAAC;IACH,CAAC,MAAM;MACLvE,YAAY,CAAE,iBAAgBuE,IAAK,UAAS,EAAE,OAAO,CAAC;IACxD;EACF;EACArE,eAAe,CACZ,YAAWwG,WAAW,CAACE,SAAU,OAAMF,WAAW,CAACC,KAAM,qBAAoBN,SAAS,CAAC3D,MAAO,WACjG,CAAC;AACH"}
@@ -4,6 +4,14 @@ import fs from 'fs';
4
4
  import { createProgressBar, createTable, debugMessage, failSpinner, printMessage, showSpinner, spinSpinner, stopProgressBar, succeedSpinner, updateProgressBar } from '../utils/Console';
5
5
  import { getTypedFilename, saveJsonToFile, saveTextToFile, titleCase } from '../utils/ExportImportUtils';
6
6
  import wordwrap from './utils/Wordwrap';
7
+ const {
8
+ getScripts,
9
+ exportScript,
10
+ exportScriptByName,
11
+ exportScripts,
12
+ importScripts
13
+ } = frodo.script;
14
+
7
15
  /**
8
16
  * Get a one-line description of the script object
9
17
  * @param {ScriptSkeleton} scriptObj script object to describe
@@ -48,7 +56,7 @@ export async function listScripts(long = false) {
48
56
  let outcome = true;
49
57
  debugMessage(`Cli.ScriptOps.listScripts: start`);
50
58
  try {
51
- const scripts = await frodo.script.getScripts();
59
+ const scripts = await getScripts();
52
60
  scripts.sort((a, b) => a.name.localeCompare(b.name));
53
61
  if (long) {
54
62
  const table = createTable(['Name', 'UUID', 'Language', 'Context', 'Description']);
@@ -89,7 +97,7 @@ export async function exportScriptToFile(scriptId, file) {
89
97
  fileName = file;
90
98
  }
91
99
  spinSpinner(`Exporting script '${scriptId}' to '${fileName}'...`);
92
- const scriptExport = await frodo.script.exportScript(scriptId);
100
+ const scriptExport = await exportScript(scriptId);
93
101
  saveJsonToFile(scriptExport, fileName);
94
102
  succeedSpinner(`Exported script '${scriptId}' to '${fileName}'.`);
95
103
  debugMessage(`Cli.ScriptOps.exportScriptToFile: end [true]`);
@@ -117,7 +125,7 @@ export async function exportScriptByNameToFile(name, file) {
117
125
  fileName = file;
118
126
  }
119
127
  spinSpinner(`Exporting script '${name}' to '${fileName}'...`);
120
- const scriptExport = await frodo.script.exportScriptByName(name);
128
+ const scriptExport = await exportScriptByName(name);
121
129
  saveJsonToFile(scriptExport, fileName);
122
130
  succeedSpinner(`Exported script '${name}' to '${fileName}'.`);
123
131
  debugMessage(`Cli.ScriptOps.exportScriptByNameToFile: end [true]`);
@@ -142,7 +150,7 @@ export async function exportScriptsToFile(file) {
142
150
  if (file) {
143
151
  fileName = file;
144
152
  }
145
- const scriptExport = await frodo.script.exportScripts();
153
+ const scriptExport = await exportScripts();
146
154
  saveJsonToFile(scriptExport, fileName);
147
155
  debugMessage(`Cli.ScriptOps.exportScriptsToFile: end [true]`);
148
156
  return true;
@@ -161,13 +169,13 @@ export async function exportScriptsToFile(file) {
161
169
  export async function exportScriptsToFiles() {
162
170
  let outcome = true;
163
171
  debugMessage(`Cli.ScriptOps.exportScriptsToFiles: start`);
164
- const scriptList = await frodo.script.getScripts();
172
+ const scriptList = await getScripts();
165
173
  createProgressBar(scriptList.length, 'Exporting scripts to individual files...');
166
174
  for (const script of scriptList) {
167
175
  try {
168
176
  updateProgressBar(`Reading script ${script.name}`);
169
177
  const fileName = getTypedFilename(script.name, 'script');
170
- const scriptExport = await frodo.script.exportScriptByName(script.name);
178
+ const scriptExport = await exportScriptByName(script.name);
171
179
  saveJsonToFile(scriptExport, fileName);
172
180
  } catch (error) {
173
181
  outcome = false;
@@ -182,7 +190,7 @@ export async function exportScriptsToFiles() {
182
190
  export async function exportScriptsToFilesExtract() {
183
191
  let outcome = true;
184
192
  debugMessage(`Cli.ScriptOps.exportScriptsToFilesExtract: start`);
185
- const scriptList = await frodo.script.getScripts();
193
+ const scriptList = await getScripts();
186
194
  createProgressBar(scriptList.length, 'Exporting scripts to individual files...');
187
195
  for (const script of scriptList) {
188
196
  try {
@@ -190,7 +198,7 @@ export async function exportScriptsToFilesExtract() {
190
198
  const fileExtension = script.language === 'JAVASCRIPT' ? 'js' : 'groovy';
191
199
  const scriptFileName = getTypedFilename(script.name, 'script', fileExtension);
192
200
  const fileName = getTypedFilename(script.name, 'script');
193
- const scriptExport = await frodo.script.exportScriptByName(script.name);
201
+ const scriptExport = await exportScriptByName(script.name);
194
202
  const scriptSkeleton = getScriptSkeleton(scriptExport);
195
203
  const scriptText = Array.isArray(scriptSkeleton.script) ? scriptSkeleton.script.join('\n') : scriptSkeleton.script;
196
204
  scriptSkeleton.script = `file://${scriptFileName}`;
@@ -221,7 +229,7 @@ export async function importScriptsFromFile(name, file, reUuid = false) {
221
229
  try {
222
230
  if (err) throw err;
223
231
  const importData = JSON.parse(data);
224
- outcome = await frodo.script.importScripts(name, importData, reUuid);
232
+ outcome = await importScripts(name, importData, reUuid);
225
233
  } catch (error) {
226
234
  printMessage(`Error exporting script '${name}': ${error.message}`, 'error');
227
235
  debugMessage(error);
@@ -279,7 +287,7 @@ async function handleScriptFileImport(file, reUuid, validateScripts) {
279
287
  debugMessage(`Cli.ScriptOps.handleScriptFileImport: start`);
280
288
  const scriptFile = getScriptFile(file);
281
289
  const script = getScriptExportByScriptFile(scriptFile);
282
- const success = await frodo.script.importScripts('', script, reUuid, validateScripts);
290
+ const success = await importScripts('', script, reUuid, validateScripts);
283
291
  if (success) {
284
292
  printMessage(`Imported '${scriptFile}'`);
285
293
  }