@rockcarver/frodo-cli 2.0.0-4 → 2.0.0-40

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 (486) hide show
  1. package/CHANGELOG.md +308 -5
  2. package/esm/app.js +22 -5
  3. package/esm/app.js.map +1 -1
  4. package/esm/cli/FrodoCommand.js +33 -7
  5. package/esm/cli/FrodoCommand.js.map +1 -1
  6. package/esm/cli/_template/something-delete.js +7 -5
  7. package/esm/cli/_template/something-delete.js.map +1 -1
  8. package/esm/cli/_template/something-describe.js +7 -5
  9. package/esm/cli/_template/something-describe.js.map +1 -1
  10. package/esm/cli/_template/something-else-delete.js +7 -5
  11. package/esm/cli/_template/something-else-delete.js.map +1 -1
  12. package/esm/cli/_template/something-else-describe.js +7 -5
  13. package/esm/cli/_template/something-else-describe.js.map +1 -1
  14. package/esm/cli/_template/something-else-export.js +8 -6
  15. package/esm/cli/_template/something-else-export.js.map +1 -1
  16. package/esm/cli/_template/something-else-import.js +7 -5
  17. package/esm/cli/_template/something-else-import.js.map +1 -1
  18. package/esm/cli/_template/something-else-list.js +7 -5
  19. package/esm/cli/_template/something-else-list.js.map +1 -1
  20. package/esm/cli/_template/something-else.js +1 -1
  21. package/esm/cli/_template/something-else.js.map +1 -1
  22. package/esm/cli/_template/something-export.js +8 -6
  23. package/esm/cli/_template/something-export.js.map +1 -1
  24. package/esm/cli/_template/something-import.js +7 -5
  25. package/esm/cli/_template/something-import.js.map +1 -1
  26. package/esm/cli/_template/something-list.js +7 -5
  27. package/esm/cli/_template/something-list.js.map +1 -1
  28. package/esm/cli/_template/something-other-delete.js +7 -5
  29. package/esm/cli/_template/something-other-delete.js.map +1 -1
  30. package/esm/cli/_template/something-other-describe.js +7 -5
  31. package/esm/cli/_template/something-other-describe.js.map +1 -1
  32. package/esm/cli/_template/something-other-export.js +8 -6
  33. package/esm/cli/_template/something-other-export.js.map +1 -1
  34. package/esm/cli/_template/something-other-import.js +7 -5
  35. package/esm/cli/_template/something-other-import.js.map +1 -1
  36. package/esm/cli/_template/something-other-list.js +7 -5
  37. package/esm/cli/_template/something-other-list.js.map +1 -1
  38. package/esm/cli/_template/something-other.js +1 -1
  39. package/esm/cli/_template/something-other.js.map +1 -1
  40. package/esm/cli/_template/something.js +2 -2
  41. package/esm/cli/_template/something.js.map +1 -1
  42. package/esm/cli/admin/admin-add-autoid-static-user-mapping.js +10 -5
  43. package/esm/cli/admin/admin-add-autoid-static-user-mapping.js.map +1 -1
  44. package/esm/cli/admin/admin-create-oauth2-client-with-admin-privileges.js +14 -8
  45. package/esm/cli/admin/admin-create-oauth2-client-with-admin-privileges.js.map +1 -1
  46. package/esm/cli/admin/admin-execute-rfc7523-authz-grant-flow.js +41 -0
  47. package/esm/cli/admin/admin-execute-rfc7523-authz-grant-flow.js.map +1 -0
  48. package/esm/cli/admin/admin-federation-export.js +44 -0
  49. package/esm/cli/admin/admin-federation-export.js.map +1 -0
  50. package/esm/cli/admin/admin-federation-import.js +48 -0
  51. package/esm/cli/admin/admin-federation-import.js.map +1 -0
  52. package/esm/cli/admin/admin-federation-list.js +28 -0
  53. package/esm/cli/admin/admin-federation-list.js.map +1 -0
  54. package/esm/cli/admin/admin-federation.js +13 -0
  55. package/esm/cli/admin/admin-federation.js.map +1 -0
  56. package/esm/cli/admin/admin-generate-rfc7523-authz-grant-artefacts.js +43 -0
  57. package/esm/cli/admin/admin-generate-rfc7523-authz-grant-artefacts.js.map +1 -0
  58. package/esm/cli/admin/admin-get-access-token.js +12 -7
  59. package/esm/cli/admin/admin-get-access-token.js.map +1 -1
  60. package/esm/cli/admin/admin-grant-oauth2-client-admin-privileges.js +13 -8
  61. package/esm/cli/admin/admin-grant-oauth2-client-admin-privileges.js.map +1 -1
  62. package/esm/cli/admin/admin-hide-generic-extension-attributes.js +11 -6
  63. package/esm/cli/admin/admin-hide-generic-extension-attributes.js.map +1 -1
  64. package/esm/cli/admin/admin-list-oauth2-clients-with-admin-privileges.js +11 -6
  65. package/esm/cli/admin/admin-list-oauth2-clients-with-admin-privileges.js.map +1 -1
  66. package/esm/cli/admin/admin-list-oauth2-clients-with-custom-privileges.js +11 -6
  67. package/esm/cli/admin/admin-list-oauth2-clients-with-custom-privileges.js.map +1 -1
  68. package/esm/cli/admin/admin-list-static-user-mappings.js +12 -7
  69. package/esm/cli/admin/admin-list-static-user-mappings.js.map +1 -1
  70. package/esm/cli/admin/admin-remove-static-user-mapping.js +12 -6
  71. package/esm/cli/admin/admin-remove-static-user-mapping.js.map +1 -1
  72. package/esm/cli/admin/admin-repair-org-model.js +11 -6
  73. package/esm/cli/admin/admin-repair-org-model.js.map +1 -1
  74. package/esm/cli/admin/admin-revoke-oauth2-client-admin-privileges.js +12 -7
  75. package/esm/cli/admin/admin-revoke-oauth2-client-admin-privileges.js.map +1 -1
  76. package/esm/cli/admin/admin-show-generic-extension-attributes.js +11 -6
  77. package/esm/cli/admin/admin-show-generic-extension-attributes.js.map +1 -1
  78. package/esm/cli/admin/admin-train-auto-access-model.js +32 -0
  79. package/esm/cli/admin/admin-train-auto-access-model.js.map +1 -0
  80. package/esm/cli/admin/admin.js +8 -2
  81. package/esm/cli/admin/admin.js.map +1 -1
  82. package/esm/cli/agent/agent-delete.js +13 -7
  83. package/esm/cli/agent/agent-delete.js.map +1 -1
  84. package/esm/cli/agent/agent-describe.js +7 -5
  85. package/esm/cli/agent/agent-describe.js.map +1 -1
  86. package/esm/cli/agent/agent-export.js +12 -10
  87. package/esm/cli/agent/agent-export.js.map +1 -1
  88. package/esm/cli/agent/agent-gateway-delete.js +13 -7
  89. package/esm/cli/agent/agent-gateway-delete.js.map +1 -1
  90. package/esm/cli/agent/agent-gateway-describe.js +7 -5
  91. package/esm/cli/agent/agent-gateway-describe.js.map +1 -1
  92. package/esm/cli/agent/agent-gateway-export.js +12 -10
  93. package/esm/cli/agent/agent-gateway-export.js.map +1 -1
  94. package/esm/cli/agent/agent-gateway-import.js +8 -6
  95. package/esm/cli/agent/agent-gateway-import.js.map +1 -1
  96. package/esm/cli/agent/agent-gateway-list.js +7 -5
  97. package/esm/cli/agent/agent-gateway-list.js.map +1 -1
  98. package/esm/cli/agent/agent-gateway.js +1 -1
  99. package/esm/cli/agent/agent-gateway.js.map +1 -1
  100. package/esm/cli/agent/agent-import.js +8 -6
  101. package/esm/cli/agent/agent-import.js.map +1 -1
  102. package/esm/cli/agent/agent-java-delete.js +13 -7
  103. package/esm/cli/agent/agent-java-delete.js.map +1 -1
  104. package/esm/cli/agent/agent-java-describe.js +7 -5
  105. package/esm/cli/agent/agent-java-describe.js.map +1 -1
  106. package/esm/cli/agent/agent-java-export.js +12 -10
  107. package/esm/cli/agent/agent-java-export.js.map +1 -1
  108. package/esm/cli/agent/agent-java-import.js +8 -6
  109. package/esm/cli/agent/agent-java-import.js.map +1 -1
  110. package/esm/cli/agent/agent-java-list.js +7 -5
  111. package/esm/cli/agent/agent-java-list.js.map +1 -1
  112. package/esm/cli/agent/agent-java.js +1 -1
  113. package/esm/cli/agent/agent-java.js.map +1 -1
  114. package/esm/cli/agent/agent-list.js +7 -5
  115. package/esm/cli/agent/agent-list.js.map +1 -1
  116. package/esm/cli/agent/agent-web-delete.js +13 -7
  117. package/esm/cli/agent/agent-web-delete.js.map +1 -1
  118. package/esm/cli/agent/agent-web-describe.js +7 -5
  119. package/esm/cli/agent/agent-web-describe.js.map +1 -1
  120. package/esm/cli/agent/agent-web-export.js +12 -10
  121. package/esm/cli/agent/agent-web-export.js.map +1 -1
  122. package/esm/cli/agent/agent-web-import.js +8 -6
  123. package/esm/cli/agent/agent-web-import.js.map +1 -1
  124. package/esm/cli/agent/agent-web-list.js +7 -5
  125. package/esm/cli/agent/agent-web-list.js.map +1 -1
  126. package/esm/cli/agent/agent-web.js +3 -3
  127. package/esm/cli/agent/agent-web.js.map +1 -1
  128. package/esm/cli/agent/agent.js +2 -2
  129. package/esm/cli/agent/agent.js.map +1 -1
  130. package/esm/cli/app/app-delete.js +27 -9
  131. package/esm/cli/app/app-delete.js.map +1 -1
  132. package/esm/cli/app/app-describe.js +9 -6
  133. package/esm/cli/app/app-describe.js.map +1 -1
  134. package/esm/cli/app/app-export.js +17 -14
  135. package/esm/cli/app/app-export.js.map +1 -1
  136. package/esm/cli/app/app-import.js +21 -18
  137. package/esm/cli/app/app-import.js.map +1 -1
  138. package/esm/cli/app/app-list.js +12 -9
  139. package/esm/cli/app/app-list.js.map +1 -1
  140. package/esm/cli/app/app.js +8 -12
  141. package/esm/cli/app/app.js.map +1 -1
  142. package/esm/cli/authn/authn-describe.js +29 -0
  143. package/esm/cli/authn/authn-describe.js.map +1 -0
  144. package/esm/cli/authn/authn-export.js +25 -0
  145. package/esm/cli/authn/authn-export.js.map +1 -0
  146. package/esm/cli/authn/authn-import.js +25 -0
  147. package/esm/cli/authn/authn-import.js.map +1 -0
  148. package/esm/cli/authn/authn.js +12 -0
  149. package/esm/cli/authn/authn.js.map +1 -0
  150. package/esm/cli/authz/authz-policy-delete.js +11 -9
  151. package/esm/cli/authz/authz-policy-delete.js.map +1 -1
  152. package/esm/cli/authz/authz-policy-describe.js +8 -6
  153. package/esm/cli/authz/authz-policy-describe.js.map +1 -1
  154. package/esm/cli/authz/authz-policy-export.js +18 -16
  155. package/esm/cli/authz/authz-policy-export.js.map +1 -1
  156. package/esm/cli/authz/authz-policy-import.js +11 -9
  157. package/esm/cli/authz/authz-policy-import.js.map +1 -1
  158. package/esm/cli/authz/authz-policy-list.js +11 -9
  159. package/esm/cli/authz/authz-policy-list.js.map +1 -1
  160. package/esm/cli/authz/authz-policy.js +1 -1
  161. package/esm/cli/authz/authz-policy.js.map +1 -1
  162. package/esm/cli/authz/authz-set-delete.js +11 -9
  163. package/esm/cli/authz/authz-set-delete.js.map +1 -1
  164. package/esm/cli/authz/authz-set-describe.js +8 -6
  165. package/esm/cli/authz/authz-set-describe.js.map +1 -1
  166. package/esm/cli/authz/authz-set-export.js +14 -12
  167. package/esm/cli/authz/authz-set-export.js.map +1 -1
  168. package/esm/cli/authz/authz-set-import.js +11 -9
  169. package/esm/cli/authz/authz-set-import.js.map +1 -1
  170. package/esm/cli/authz/authz-set-list.js +8 -6
  171. package/esm/cli/authz/authz-set-list.js.map +1 -1
  172. package/esm/cli/authz/authz-set.js +1 -1
  173. package/esm/cli/authz/authz-set.js.map +1 -1
  174. package/esm/cli/authz/authz-type-delete.js +13 -11
  175. package/esm/cli/authz/authz-type-delete.js.map +1 -1
  176. package/esm/cli/authz/authz-type-describe.js +9 -7
  177. package/esm/cli/authz/authz-type-describe.js.map +1 -1
  178. package/esm/cli/authz/authz-type-export.js +16 -14
  179. package/esm/cli/authz/authz-type-export.js.map +1 -1
  180. package/esm/cli/authz/authz-type-import.js +14 -12
  181. package/esm/cli/authz/authz-type-import.js.map +1 -1
  182. package/esm/cli/authz/authz-type-list.js +9 -7
  183. package/esm/cli/authz/authz-type-list.js.map +1 -1
  184. package/esm/cli/authz/authz-type.js +1 -1
  185. package/esm/cli/authz/authz-type.js.map +1 -1
  186. package/esm/cli/authz/authz.js +2 -2
  187. package/esm/cli/authz/authz.js.map +1 -1
  188. package/esm/cli/config/config-delete.js +21 -0
  189. package/esm/cli/config/config-delete.js.map +1 -0
  190. package/esm/cli/config/config-describe.js +21 -0
  191. package/esm/cli/config/config-describe.js.map +1 -0
  192. package/esm/cli/config/config-export.js +43 -0
  193. package/esm/cli/config/config-export.js.map +1 -0
  194. package/esm/cli/config/config-import.js +21 -0
  195. package/esm/cli/config/config-import.js.map +1 -0
  196. package/esm/cli/config/config-list.js +21 -0
  197. package/esm/cli/config/config-list.js.map +1 -0
  198. package/esm/cli/config/config.js +20 -0
  199. package/esm/cli/config/config.js.map +1 -0
  200. package/esm/cli/conn/conn-delete.js +2 -3
  201. package/esm/cli/conn/conn-delete.js.map +1 -1
  202. package/esm/cli/conn/conn-describe.js +2 -3
  203. package/esm/cli/conn/conn-describe.js.map +1 -1
  204. package/esm/cli/conn/conn-list.js +2 -3
  205. package/esm/cli/conn/conn-list.js.map +1 -1
  206. package/esm/cli/conn/conn-save.js +31 -16
  207. package/esm/cli/conn/conn-save.js.map +1 -1
  208. package/esm/cli/conn/conn.js +2 -2
  209. package/esm/cli/conn/conn.js.map +1 -1
  210. package/esm/cli/email/email-template-export.js +14 -12
  211. package/esm/cli/email/email-template-export.js.map +1 -1
  212. package/esm/cli/email/email-template-import.js +15 -13
  213. package/esm/cli/email/email-template-import.js.map +1 -1
  214. package/esm/cli/email/email-template-list.js +9 -7
  215. package/esm/cli/email/email-template-list.js.map +1 -1
  216. package/esm/cli/email/email-template.js +1 -1
  217. package/esm/cli/email/email-template.js.map +1 -1
  218. package/esm/cli/email/email.js +2 -2
  219. package/esm/cli/email/email.js.map +1 -1
  220. package/esm/cli/esv/esv-apply.js +18 -9
  221. package/esm/cli/esv/esv-apply.js.map +1 -1
  222. package/esm/cli/esv/esv-secret-create.js +10 -7
  223. package/esm/cli/esv/esv-secret-create.js.map +1 -1
  224. package/esm/cli/esv/esv-secret-delete.js +13 -10
  225. package/esm/cli/esv/esv-secret-delete.js.map +1 -1
  226. package/esm/cli/esv/esv-secret-describe.js +10 -7
  227. package/esm/cli/esv/esv-secret-describe.js.map +1 -1
  228. package/esm/cli/esv/esv-secret-export.js +22 -7
  229. package/esm/cli/esv/esv-secret-export.js.map +1 -1
  230. package/esm/cli/esv/esv-secret-import.js +7 -5
  231. package/esm/cli/esv/esv-secret-import.js.map +1 -1
  232. package/esm/cli/esv/esv-secret-list.js +11 -8
  233. package/esm/cli/esv/esv-secret-list.js.map +1 -1
  234. package/esm/cli/esv/esv-secret-set.js +10 -7
  235. package/esm/cli/esv/esv-secret-set.js.map +1 -1
  236. package/esm/cli/esv/esv-secret-version-activate.js +10 -8
  237. package/esm/cli/esv/esv-secret-version-activate.js.map +1 -1
  238. package/esm/cli/esv/esv-secret-version-create.js +10 -7
  239. package/esm/cli/esv/esv-secret-version-create.js.map +1 -1
  240. package/esm/cli/esv/esv-secret-version-deactivate.js +10 -8
  241. package/esm/cli/esv/esv-secret-version-deactivate.js.map +1 -1
  242. package/esm/cli/esv/esv-secret-version-delete.js +13 -10
  243. package/esm/cli/esv/esv-secret-version-delete.js.map +1 -1
  244. package/esm/cli/esv/esv-secret-version-list.js +10 -7
  245. package/esm/cli/esv/esv-secret-version-list.js.map +1 -1
  246. package/esm/cli/esv/esv-secret-version.js +1 -1
  247. package/esm/cli/esv/esv-secret-version.js.map +1 -1
  248. package/esm/cli/esv/esv-secret.js +2 -3
  249. package/esm/cli/esv/esv-secret.js.map +1 -1
  250. package/esm/cli/esv/esv-variable-create.js +11 -7
  251. package/esm/cli/esv/esv-variable-create.js.map +1 -1
  252. package/esm/cli/esv/esv-variable-delete.js +13 -9
  253. package/esm/cli/esv/esv-variable-delete.js.map +1 -1
  254. package/esm/cli/esv/esv-variable-describe.js +11 -8
  255. package/esm/cli/esv/esv-variable-describe.js.map +1 -1
  256. package/esm/cli/esv/esv-variable-export.js +23 -7
  257. package/esm/cli/esv/esv-variable-export.js.map +1 -1
  258. package/esm/cli/esv/esv-variable-import.js +7 -5
  259. package/esm/cli/esv/esv-variable-import.js.map +1 -1
  260. package/esm/cli/esv/esv-variable-list.js +11 -8
  261. package/esm/cli/esv/esv-variable-list.js.map +1 -1
  262. package/esm/cli/esv/esv-variable-set.js +12 -8
  263. package/esm/cli/esv/esv-variable-set.js.map +1 -1
  264. package/esm/cli/esv/esv-variable.js +2 -3
  265. package/esm/cli/esv/esv-variable.js.map +1 -1
  266. package/esm/cli/esv/esv.js +2 -2
  267. package/esm/cli/esv/esv.js.map +1 -1
  268. package/esm/cli/idm/idm-count.js +10 -8
  269. package/esm/cli/idm/idm-count.js.map +1 -1
  270. package/esm/cli/idm/idm-export.js +24 -16
  271. package/esm/cli/idm/idm-export.js.map +1 -1
  272. package/esm/cli/idm/idm-import.js +22 -14
  273. package/esm/cli/idm/idm-import.js.map +1 -1
  274. package/esm/cli/idm/idm-list.js +9 -7
  275. package/esm/cli/idm/idm-list.js.map +1 -1
  276. package/esm/cli/idm/idm.js +2 -2
  277. package/esm/cli/idm/idm.js.map +1 -1
  278. package/esm/cli/idp/idp-export.js +12 -10
  279. package/esm/cli/idp/idp-export.js.map +1 -1
  280. package/esm/cli/idp/idp-import.js +15 -13
  281. package/esm/cli/idp/idp-import.js.map +1 -1
  282. package/esm/cli/idp/idp-list.js +8 -6
  283. package/esm/cli/idp/idp-list.js.map +1 -1
  284. package/esm/cli/idp/idp.js +2 -2
  285. package/esm/cli/idp/idp.js.map +1 -1
  286. package/esm/cli/info/info.js +13 -8
  287. package/esm/cli/info/info.js.map +1 -1
  288. package/esm/cli/journey/journey-delete.js +14 -8
  289. package/esm/cli/journey/journey-delete.js.map +1 -1
  290. package/esm/cli/journey/journey-describe.js +22 -12
  291. package/esm/cli/journey/journey-describe.js.map +1 -1
  292. package/esm/cli/journey/journey-disable.js +11 -12
  293. package/esm/cli/journey/journey-disable.js.map +1 -1
  294. package/esm/cli/journey/journey-enable.js +11 -12
  295. package/esm/cli/journey/journey-enable.js.map +1 -1
  296. package/esm/cli/journey/journey-export.js +24 -13
  297. package/esm/cli/journey/journey-export.js.map +1 -1
  298. package/esm/cli/journey/journey-import.js +15 -13
  299. package/esm/cli/journey/journey-import.js.map +1 -1
  300. package/esm/cli/journey/journey-list.js +7 -5
  301. package/esm/cli/journey/journey-list.js.map +1 -1
  302. package/esm/cli/journey/journey-prune.js +23 -13
  303. package/esm/cli/journey/journey-prune.js.map +1 -1
  304. package/esm/cli/journey/journey.js +2 -2
  305. package/esm/cli/journey/journey.js.map +1 -1
  306. package/esm/cli/{logging/logs-fetch.js → log/log-fetch.js} +68 -36
  307. package/esm/cli/log/log-fetch.js.map +1 -0
  308. package/esm/cli/log/log-key-delete.js +34 -0
  309. package/esm/cli/log/log-key-delete.js.map +1 -0
  310. package/esm/cli/log/log-key-describe.js +21 -0
  311. package/esm/cli/log/log-key-describe.js.map +1 -0
  312. package/esm/cli/log/log-key-list.js +25 -0
  313. package/esm/cli/log/log-key-list.js.map +1 -0
  314. package/esm/cli/log/log-key.js +8 -0
  315. package/esm/cli/log/log-key.js.map +1 -0
  316. package/esm/cli/log/log-list.js +80 -0
  317. package/esm/cli/log/log-list.js.map +1 -0
  318. package/esm/cli/log/log-tail.js +77 -0
  319. package/esm/cli/log/log-tail.js.map +1 -0
  320. package/esm/cli/{logging/logs.js → log/log.js} +6 -3
  321. package/esm/cli/log/log.js.map +1 -0
  322. package/esm/cli/oauth/oauth-client-delete.js +21 -0
  323. package/esm/cli/oauth/oauth-client-delete.js.map +1 -0
  324. package/esm/cli/oauth/oauth-client-describe.js +21 -0
  325. package/esm/cli/oauth/oauth-client-describe.js.map +1 -0
  326. package/esm/cli/oauth/oauth-client-export.js +51 -0
  327. package/esm/cli/oauth/oauth-client-export.js.map +1 -0
  328. package/esm/cli/oauth/oauth-client-import.js +56 -0
  329. package/esm/cli/oauth/oauth-client-import.js.map +1 -0
  330. package/esm/cli/oauth/oauth-client-list.js +24 -0
  331. package/esm/cli/oauth/oauth-client-list.js.map +1 -0
  332. package/esm/cli/oauth/oauth-client.js +14 -0
  333. package/esm/cli/oauth/oauth-client.js.map +1 -0
  334. package/esm/cli/oauth/oauth.js +13 -0
  335. package/esm/cli/oauth/oauth.js.map +1 -0
  336. package/esm/cli/realm/realm-add-custom-domain.js +8 -6
  337. package/esm/cli/realm/realm-add-custom-domain.js.map +1 -1
  338. package/esm/cli/realm/realm-describe.js +8 -6
  339. package/esm/cli/realm/realm-describe.js.map +1 -1
  340. package/esm/cli/realm/realm-list.js +8 -6
  341. package/esm/cli/realm/realm-list.js.map +1 -1
  342. package/esm/cli/realm/realm-remove-custom-domain.js +11 -6
  343. package/esm/cli/realm/realm-remove-custom-domain.js.map +1 -1
  344. package/esm/cli/realm/realm.js +2 -2
  345. package/esm/cli/realm/realm.js.map +1 -1
  346. package/esm/cli/saml/saml-cot-export.js +14 -12
  347. package/esm/cli/saml/saml-cot-export.js.map +1 -1
  348. package/esm/cli/saml/saml-cot-import.js +15 -13
  349. package/esm/cli/saml/saml-cot-import.js.map +1 -1
  350. package/esm/cli/saml/saml-cot-list.js +9 -7
  351. package/esm/cli/saml/saml-cot-list.js.map +1 -1
  352. package/esm/cli/saml/saml-cot.js +1 -1
  353. package/esm/cli/saml/saml-cot.js.map +1 -1
  354. package/esm/cli/saml/saml-delete.js +14 -8
  355. package/esm/cli/saml/saml-delete.js.map +1 -1
  356. package/esm/cli/saml/saml-describe.js +9 -7
  357. package/esm/cli/saml/saml-describe.js.map +1 -1
  358. package/esm/cli/saml/saml-export.js +14 -12
  359. package/esm/cli/saml/saml-export.js.map +1 -1
  360. package/esm/cli/saml/saml-import.js +15 -13
  361. package/esm/cli/saml/saml-import.js.map +1 -1
  362. package/esm/cli/saml/saml-list.js +9 -7
  363. package/esm/cli/saml/saml-list.js.map +1 -1
  364. package/esm/cli/saml/saml-metadata-export.js +10 -8
  365. package/esm/cli/saml/saml-metadata-export.js.map +1 -1
  366. package/esm/cli/saml/saml-metadata.js +1 -1
  367. package/esm/cli/saml/saml-metadata.js.map +1 -1
  368. package/esm/cli/saml/saml.js +2 -2
  369. package/esm/cli/saml/saml.js.map +1 -1
  370. package/esm/cli/script/script-delete.js +21 -8
  371. package/esm/cli/script/script-delete.js.map +1 -1
  372. package/esm/cli/script/script-describe.js +7 -5
  373. package/esm/cli/script/script-describe.js.map +1 -1
  374. package/esm/cli/script/script-export.js +12 -14
  375. package/esm/cli/script/script-export.js.map +1 -1
  376. package/esm/cli/script/script-import.js +9 -7
  377. package/esm/cli/script/script-import.js.map +1 -1
  378. package/esm/cli/script/script-list.js +10 -8
  379. package/esm/cli/script/script-list.js.map +1 -1
  380. package/esm/cli/script/script.js +3 -5
  381. package/esm/cli/script/script.js.map +1 -1
  382. package/esm/cli/service/service-delete.js +8 -5
  383. package/esm/cli/service/service-delete.js.map +1 -1
  384. package/esm/cli/service/service-export.js +13 -11
  385. package/esm/cli/service/service-export.js.map +1 -1
  386. package/esm/cli/service/service-import.js +11 -10
  387. package/esm/cli/service/service-import.js.map +1 -1
  388. package/esm/cli/service/service-list.js +7 -4
  389. package/esm/cli/service/service-list.js.map +1 -1
  390. package/esm/cli/service/service.js +2 -2
  391. package/esm/cli/service/service.js.map +1 -1
  392. package/esm/cli/shell/shell.js +57 -0
  393. package/esm/cli/shell/shell.js.map +1 -0
  394. package/esm/cli/theme/theme-delete.js +13 -11
  395. package/esm/cli/theme/theme-delete.js.map +1 -1
  396. package/esm/cli/theme/theme-export.js +16 -14
  397. package/esm/cli/theme/theme-export.js.map +1 -1
  398. package/esm/cli/theme/theme-import.js +16 -14
  399. package/esm/cli/theme/theme-import.js.map +1 -1
  400. package/esm/cli/theme/theme-list.js +8 -6
  401. package/esm/cli/theme/theme-list.js.map +1 -1
  402. package/esm/cli/theme/theme.js +2 -2
  403. package/esm/cli/theme/theme.js.map +1 -1
  404. package/esm/help/SampleData.js +7 -0
  405. package/esm/help/SampleData.js.map +1 -0
  406. package/esm/launch.js +1 -1
  407. package/esm/launch.js.map +1 -1
  408. package/esm/loader.js +2 -2
  409. package/esm/loader.js.map +1 -1
  410. package/esm/ops/AdminFederationOps.js +231 -0
  411. package/esm/ops/AdminFederationOps.js.map +1 -0
  412. package/esm/ops/AdminOps.js +151 -0
  413. package/esm/ops/AdminOps.js.map +1 -0
  414. package/esm/ops/AgentOps.js +213 -150
  415. package/esm/ops/AgentOps.js.map +1 -1
  416. package/esm/ops/ApplicationOps.js +324 -0
  417. package/esm/ops/ApplicationOps.js.map +1 -0
  418. package/esm/ops/AuthenticationSettingsOps.js +90 -0
  419. package/esm/ops/AuthenticationSettingsOps.js.map +1 -0
  420. package/esm/ops/CirclesOfTrustOps.js +98 -78
  421. package/esm/ops/CirclesOfTrustOps.js.map +1 -1
  422. package/esm/ops/ConfigOps.js +130 -0
  423. package/esm/ops/ConfigOps.js.map +1 -0
  424. package/esm/ops/ConnectionProfileOps.js +12 -6
  425. package/esm/ops/ConnectionProfileOps.js.map +1 -1
  426. package/esm/ops/EmailTemplateOps.js +125 -125
  427. package/esm/ops/EmailTemplateOps.js.map +1 -1
  428. package/esm/ops/IdmOps.js +72 -103
  429. package/esm/ops/IdmOps.js.map +1 -1
  430. package/esm/ops/IdpOps.js +106 -73
  431. package/esm/ops/IdpOps.js.map +1 -1
  432. package/esm/ops/JourneyOps.js +176 -114
  433. package/esm/ops/JourneyOps.js.map +1 -1
  434. package/esm/ops/LogOps.js +92 -30
  435. package/esm/ops/LogOps.js.map +1 -1
  436. package/esm/ops/NodeOps.js +6 -3
  437. package/esm/ops/NodeOps.js.map +1 -1
  438. package/esm/ops/OAuth2ClientOps.js +71 -49
  439. package/esm/ops/OAuth2ClientOps.js.map +1 -1
  440. package/esm/ops/OrganizationOps.js +14 -22
  441. package/esm/ops/OrganizationOps.js.map +1 -1
  442. package/esm/ops/PolicyOps.js +127 -86
  443. package/esm/ops/PolicyOps.js.map +1 -1
  444. package/esm/ops/PolicySetOps.js +108 -76
  445. package/esm/ops/PolicySetOps.js.map +1 -1
  446. package/esm/ops/RealmOps.js +18 -11
  447. package/esm/ops/RealmOps.js.map +1 -1
  448. package/esm/ops/ResourceTypeOps.js +105 -87
  449. package/esm/ops/ResourceTypeOps.js.map +1 -1
  450. package/esm/ops/Saml2Ops.js +116 -87
  451. package/esm/ops/Saml2Ops.js.map +1 -1
  452. package/esm/ops/Saml2Ops.test_.js.map +1 -1
  453. package/esm/ops/ScriptOps.js +205 -82
  454. package/esm/ops/ScriptOps.js.map +1 -1
  455. package/esm/ops/SecretsOps.js +289 -79
  456. package/esm/ops/SecretsOps.js.map +1 -1
  457. package/esm/ops/ServiceOps.js +71 -44
  458. package/esm/ops/ServiceOps.js.map +1 -1
  459. package/esm/ops/ThemeOps.js +160 -147
  460. package/esm/ops/ThemeOps.js.map +1 -1
  461. package/esm/ops/VariablesOps.js +252 -65
  462. package/esm/ops/VariablesOps.js.map +1 -1
  463. package/esm/ops/utils/OpsUtils.js +1 -1
  464. package/esm/ops/utils/OpsUtils.js.map +1 -1
  465. package/esm/ops/utils/Wordwrap.js +1 -1
  466. package/esm/ops/utils/Wordwrap.js.map +1 -1
  467. package/esm/storage/StaticStorage.js +1 -1
  468. package/esm/storage/StaticStorage.js.map +1 -1
  469. package/esm/utils/Config.js +153 -4
  470. package/esm/utils/Config.js.map +1 -1
  471. package/esm/utils/Console.js +78 -35
  472. package/esm/utils/Console.js.map +1 -1
  473. package/esm/utils/Version.js +19 -16
  474. package/esm/utils/Version.js.map +1 -1
  475. package/global-jest-setup.js +4 -0
  476. package/package.json +55 -37
  477. package/esm/cli/logging/logs-fetch.js.map +0 -1
  478. package/esm/cli/logging/logs-list.js +0 -49
  479. package/esm/cli/logging/logs-list.js.map +0 -1
  480. package/esm/cli/logging/logs-tail.js +0 -46
  481. package/esm/cli/logging/logs-tail.js.map +0 -1
  482. package/esm/cli/logging/logs.js.map +0 -1
  483. package/esm/cli/theme/theme-delete.e2e.test_.js.map +0 -1
  484. package/esm/cli/theme/theme-list.e2e.test_.js.map +0 -1
  485. package/esm/utils/ExportImportUtils.js +0 -90
  486. package/esm/utils/ExportImportUtils.js.map +0 -1
@@ -1,7 +1,29 @@
1
1
  import { frodo } from '@rockcarver/frodo-lib';
2
2
  import fs from 'fs';
3
- import { printMessage, createTable, createProgressIndicator, updateProgressIndicator, stopProgressIndicator } from '../utils/Console';
4
- import { saveToFile, getTypedFilename } from '../utils/ExportImportUtils';
3
+ import { v4 as uuidv4 } from 'uuid';
4
+ import { createProgressIndicator, createTable, printMessage, stopProgressIndicator, updateProgressIndicator } from '../utils/Console';
5
+ const {
6
+ getRealmString,
7
+ validateImport,
8
+ getTypedFilename,
9
+ saveJsonToFile,
10
+ saveToFile,
11
+ getFilePath,
12
+ getWorkingDirectory
13
+ } = frodo.utils;
14
+ const {
15
+ readThemes,
16
+ readThemeByName,
17
+ readTheme,
18
+ updateThemeByName,
19
+ updateTheme,
20
+ updateThemes,
21
+ exportThemes,
22
+ deleteTheme,
23
+ deleteThemeByName,
24
+ deleteThemes
25
+ } = frodo.theme;
26
+
5
27
  /**
6
28
  * Get a one-line description of the theme
7
29
  * @param {ThemeSkeleton} themeObj theme object to describe
@@ -38,7 +60,7 @@ export function getTableRowMd(themeObj) {
38
60
  * @param {boolean} long Long version, more fields
39
61
  */
40
62
  export async function listThemes(long = false) {
41
- const themeList = await frodo.theme.getThemes();
63
+ const themeList = await readThemes();
42
64
  themeList.sort((a, b) => a.name.localeCompare(b.name));
43
65
  if (!long) {
44
66
  themeList.forEach(theme => {
@@ -57,20 +79,23 @@ export async function listThemes(long = false) {
57
79
  * Export theme by name to file
58
80
  * @param {String} name theme name
59
81
  * @param {String} file optional export file name
82
+ * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true
60
83
  */
61
- export async function exportThemeByName(name, file) {
84
+ export async function exportThemeByName(name, file, includeMeta = true) {
62
85
  let fileName = getTypedFilename(name, 'theme');
63
86
  if (file) {
64
87
  fileName = file;
65
88
  }
66
- createProgressIndicator('determinate', 1, `Exporting ${name}`);
89
+ const filePath = getFilePath(fileName, true);
90
+ const indicatorId = createProgressIndicator('determinate', 1, `Exporting ${name}`);
67
91
  try {
68
- const themeData = await frodo.theme.getThemeByName(name);
69
- updateProgressIndicator(`Writing file ${fileName}`);
70
- saveToFile('theme', [themeData], '_id', fileName);
71
- stopProgressIndicator(`Successfully exported theme ${name}.`);
92
+ const themeData = await readThemeByName(name);
93
+ if (!themeData._id) themeData._id = uuidv4();
94
+ updateProgressIndicator(indicatorId, `Writing file to ${filePath}`);
95
+ saveToFile('theme', [themeData], '_id', filePath, includeMeta);
96
+ stopProgressIndicator(indicatorId, `Successfully exported theme ${name}.`);
72
97
  } catch (error) {
73
- stopProgressIndicator(`${error.message}`);
98
+ stopProgressIndicator(indicatorId, `${error.message}`);
74
99
  printMessage(`${error.message}`, 'error');
75
100
  }
76
101
  }
@@ -79,20 +104,22 @@ export async function exportThemeByName(name, file) {
79
104
  * Export theme by uuid to file
80
105
  * @param {String} id theme uuid
81
106
  * @param {String} file optional export file name
107
+ * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true
82
108
  */
83
- export async function exportThemeById(id, file) {
109
+ export async function exportThemeById(id, file, includeMeta = true) {
84
110
  let fileName = getTypedFilename(id, 'theme');
85
111
  if (file) {
86
112
  fileName = file;
87
113
  }
88
- createProgressIndicator('determinate', 1, `Exporting ${id}`);
114
+ const filePath = getFilePath(fileName, true);
115
+ const indicatorId = createProgressIndicator('determinate', 1, `Exporting ${id}`);
89
116
  try {
90
- const themeData = await frodo.theme.getTheme(id);
91
- updateProgressIndicator(`Writing file ${fileName}`);
92
- saveToFile('theme', [themeData], '_id', fileName);
93
- stopProgressIndicator(`Successfully exported theme ${id}.`);
117
+ const themeData = await readTheme(id);
118
+ updateProgressIndicator(indicatorId, `Writing file to ${filePath}`);
119
+ saveToFile('theme', [themeData], '_id', filePath, includeMeta);
120
+ stopProgressIndicator(indicatorId, `Successfully exported theme ${id}.`);
94
121
  } catch (error) {
95
- stopProgressIndicator(`${error.message}`);
122
+ stopProgressIndicator(indicatorId, `${error.message}`);
96
123
  printMessage(`${error.message}`, 'error');
97
124
  }
98
125
  }
@@ -100,33 +127,35 @@ export async function exportThemeById(id, file) {
100
127
  /**
101
128
  * Export all themes to file
102
129
  * @param {String} file optional export file name
130
+ * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true
103
131
  */
104
- export async function exportThemesToFile(file) {
105
- let fileName = getTypedFilename(`all${frodo.utils.impex.getRealmString()}Themes`, 'theme');
132
+ export async function exportThemesToFile(file, includeMeta = true) {
133
+ let fileName = getTypedFilename(`all${getRealmString()}Themes`, 'theme');
106
134
  if (file) {
107
135
  fileName = file;
108
136
  }
109
- const allThemesData = await frodo.theme.getThemes();
110
- createProgressIndicator('determinate', allThemesData.length, 'Exporting themes');
111
- for (const themeData of allThemesData) {
112
- updateProgressIndicator(`Exporting theme ${themeData.name}`);
113
- }
114
- saveToFile('theme', allThemesData, '_id', fileName);
115
- stopProgressIndicator(`${allThemesData.length} themes exported to ${fileName}.`);
137
+ const filePath = getFilePath(fileName, true);
138
+ const exportData = await exportThemes();
139
+ saveJsonToFile(exportData, filePath, includeMeta);
116
140
  }
117
141
 
118
142
  /**
119
143
  * Export all themes to separate files
144
+ * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true
120
145
  */
121
- export async function exportThemesToFiles() {
122
- const allThemesData = await frodo.theme.getThemes();
123
- createProgressIndicator('determinate', allThemesData.length, 'Exporting themes');
124
- for (const themeData of allThemesData) {
125
- updateProgressIndicator(`Writing theme ${themeData.name}`);
126
- const fileName = getTypedFilename(themeData.name, 'theme');
127
- saveToFile('theme', themeData, '_id', fileName);
146
+ export async function exportThemesToFiles(includeMeta = true) {
147
+ const themes = await readThemes();
148
+ const barId = createProgressIndicator('determinate', themes.length, 'Exporting themes');
149
+ for (const theme of themes) {
150
+ if (!theme._id) theme._id = uuidv4();
151
+ const fileBarId = createProgressIndicator('determinate', 1, `Exporting theme ${theme.name}...`);
152
+ updateProgressIndicator(barId, `Exporting theme ${theme.name}`);
153
+ const file = getFilePath(getTypedFilename(theme.name, 'theme'), true);
154
+ saveToFile('theme', theme, '_id', file, includeMeta);
155
+ updateProgressIndicator(fileBarId, `${theme.name} saved to ${file}`);
156
+ stopProgressIndicator(fileBarId, `${theme.name} saved to ${file}.`);
128
157
  }
129
- stopProgressIndicator(`${allThemesData.length} themes exported.`);
158
+ stopProgressIndicator(barId, `${themes.length} themes exported.`);
130
159
  }
131
160
 
132
161
  /**
@@ -135,35 +164,31 @@ export async function exportThemesToFiles() {
135
164
  * @param {String} file import file name
136
165
  */
137
166
  export async function importThemeByName(name, file) {
138
- fs.readFile(file, 'utf8', async (err, data) => {
139
- if (err) throw err;
140
- const themeData = JSON.parse(data);
141
- if (frodo.utils.impex.validateImport(themeData.meta)) {
142
- createProgressIndicator('determinate', 1, 'Importing theme...');
143
- let found = false;
144
- for (const id in themeData.theme) {
145
- if ({}.hasOwnProperty.call(themeData.theme, id)) {
146
- if (themeData.theme[id].name === name) {
147
- found = true;
148
- updateProgressIndicator(`Importing ${themeData.theme[id].name}`);
149
- try {
150
- await frodo.theme.putThemeByName(name, themeData.theme[id]);
151
- stopProgressIndicator(`Successfully imported theme ${name}.`);
152
- } catch (error) {
153
- stopProgressIndicator(`Error importing theme ${themeData.theme[id].name}: ${error.message}`);
154
- printMessage(`Error importing theme ${themeData.theme[id].name}: ${error.message}`, 'error');
155
- }
156
- break;
157
- }
167
+ try {
168
+ const data = fs.readFileSync(getFilePath(file), 'utf8');
169
+ const themeExport = JSON.parse(data);
170
+ const indicatorId = createProgressIndicator('determinate', 1, 'Importing theme...');
171
+ let found = false;
172
+ for (const id of Object.keys(themeExport.theme)) {
173
+ if (themeExport.theme[id].name === name) {
174
+ found = true;
175
+ updateProgressIndicator(indicatorId, `Importing ${themeExport.theme[id].name}`);
176
+ try {
177
+ await updateThemeByName(name, themeExport.theme[id]);
178
+ stopProgressIndicator(indicatorId, `Successfully imported theme ${name}.`);
179
+ } catch (error) {
180
+ stopProgressIndicator(indicatorId, `Error importing theme ${themeExport.theme[id].name}: ${error.message}`);
181
+ printMessage(`Error importing theme ${themeExport.theme[id].name}: ${error.message}`, 'error');
158
182
  }
183
+ break;
159
184
  }
160
- if (!found) {
161
- stopProgressIndicator(`Theme ${name} not found!`);
162
- }
163
- } else {
164
- printMessage('Import validation failed...', 'error');
165
185
  }
166
- });
186
+ if (!found) {
187
+ stopProgressIndicator(indicatorId, `Theme ${name} not found!`);
188
+ }
189
+ } catch (error) {
190
+ printMessage(`Error importing theme ${name}: ${error}`, 'error');
191
+ }
167
192
  }
168
193
 
169
194
  /**
@@ -172,35 +197,31 @@ export async function importThemeByName(name, file) {
172
197
  * @param {String} file import file name
173
198
  */
174
199
  export async function importThemeById(id, file) {
175
- fs.readFile(file, 'utf8', async (err, data) => {
176
- if (err) throw err;
177
- const themeData = JSON.parse(data);
178
- if (frodo.utils.impex.validateImport(themeData.meta)) {
179
- createProgressIndicator('determinate', 1, 'Importing theme...');
180
- let found = false;
181
- for (const themeId in themeData.theme) {
182
- if ({}.hasOwnProperty.call(themeData.theme, themeId)) {
183
- if (themeId === id) {
184
- found = true;
185
- updateProgressIndicator(`Importing ${themeData.theme[themeId]._id}`);
186
- try {
187
- await frodo.theme.putTheme(themeId, themeData.theme[themeId]);
188
- stopProgressIndicator(`Successfully imported theme ${id}.`);
189
- } catch (error) {
190
- stopProgressIndicator(`Error importing theme ${themeData.theme[themeId]._id}: ${error.message}`);
191
- printMessage(`Error importing theme ${themeData.theme[themeId]._id}: ${error.message}`, 'error');
192
- }
193
- break;
194
- }
200
+ try {
201
+ const data = fs.readFileSync(getFilePath(file), 'utf8');
202
+ const themeExport = JSON.parse(data);
203
+ const indicatorId = createProgressIndicator('determinate', 1, 'Importing theme...');
204
+ let found = false;
205
+ for (const themeId of Object.keys(themeExport.theme)) {
206
+ if (themeId === id) {
207
+ found = true;
208
+ updateProgressIndicator(indicatorId, `Importing ${themeExport.theme[themeId]._id}`);
209
+ try {
210
+ await updateTheme(themeId, themeExport.theme[themeId]);
211
+ stopProgressIndicator(indicatorId, `Successfully imported theme ${id}.`);
212
+ } catch (error) {
213
+ stopProgressIndicator(indicatorId, `Error importing theme ${themeExport.theme[themeId]._id}: ${error.message}`);
214
+ printMessage(`Error importing theme ${themeExport.theme[themeId]._id}: ${error.message}`, 'error');
195
215
  }
216
+ break;
196
217
  }
197
- if (!found) {
198
- stopProgressIndicator(`Theme ${id} not found!`);
199
- }
200
- } else {
201
- printMessage('Import validation failed...', 'error');
202
218
  }
203
- });
219
+ if (!found) {
220
+ stopProgressIndicator(indicatorId, `Theme ${id} not found!`);
221
+ }
222
+ } catch (error) {
223
+ printMessage(`Error importing theme ${id}: ${error}`, 'error');
224
+ }
204
225
  }
205
226
 
206
227
  /**
@@ -208,37 +229,33 @@ export async function importThemeById(id, file) {
208
229
  * @param {String} file import file name
209
230
  */
210
231
  export async function importThemesFromFile(file) {
211
- fs.readFile(file, 'utf8', (err, data) => {
212
- if (err) throw err;
213
- const fileData = JSON.parse(data);
214
- if (frodo.utils.impex.validateImport(fileData.meta)) {
215
- createProgressIndicator('determinate', Object.keys(fileData.theme).length, 'Importing themes...');
216
- for (const id in fileData.theme) {
217
- if ({}.hasOwnProperty.call(fileData.theme, id)) {
218
- updateProgressIndicator(`Importing ${fileData.theme[id].name}`);
219
- }
220
- }
221
- frodo.theme.putThemes(fileData.theme).then(result => {
222
- if (result == null) {
223
- stopProgressIndicator(`Error importing ${Object.keys(fileData.theme).length} themes!`);
224
- printMessage(`Error importing ${Object.keys(fileData.theme).length} themes from ${file}`, 'error');
225
- } else {
226
- stopProgressIndicator(`Successfully imported ${Object.keys(fileData.theme).length} themes.`);
227
- }
228
- });
232
+ const filePath = getFilePath(file);
233
+ try {
234
+ const data = fs.readFileSync(filePath, 'utf8');
235
+ const themeExport = JSON.parse(data);
236
+ const indicatorId = createProgressIndicator('determinate', Object.keys(themeExport.theme).length, 'Importing themes...');
237
+ for (const id of Object.keys(themeExport.theme)) {
238
+ updateProgressIndicator(indicatorId, `Importing ${themeExport.theme[id].name}`);
239
+ }
240
+ const result = await updateThemes(themeExport.theme);
241
+ if (result == null) {
242
+ stopProgressIndicator(indicatorId, `Error importing ${Object.keys(themeExport.theme).length} themes!`);
243
+ printMessage(`Error importing ${Object.keys(themeExport.theme).length} themes from ${filePath}`, 'error');
229
244
  } else {
230
- printMessage('Import validation failed...', 'error');
245
+ stopProgressIndicator(indicatorId, `Successfully imported ${Object.keys(themeExport.theme).length} themes.`);
231
246
  }
232
- });
247
+ } catch (error) {
248
+ printMessage(`Error importing themes: ${error}`, 'error');
249
+ }
233
250
  }
234
251
 
235
252
  /**
236
253
  * Import themes from separate files
237
254
  */
238
255
  export async function importThemesFromFiles() {
239
- const names = fs.readdirSync('.');
240
- const jsonFiles = names.filter(name => name.toLowerCase().endsWith('.theme.json'));
241
- createProgressIndicator('determinate', jsonFiles.length, 'Importing themes...');
256
+ const names = fs.readdirSync(getWorkingDirectory());
257
+ const jsonFiles = names.filter(name => name.toLowerCase().endsWith('.theme.json')).map(name => getFilePath(name));
258
+ const indicatorId = createProgressIndicator('determinate', jsonFiles.length, 'Importing themes...');
242
259
  let fileData = null;
243
260
  let count = 0;
244
261
  let total = 0;
@@ -246,22 +263,22 @@ export async function importThemesFromFiles() {
246
263
  for (const file of jsonFiles) {
247
264
  const data = fs.readFileSync(file, 'utf8');
248
265
  fileData = JSON.parse(data);
249
- if (frodo.utils.impex.validateImport(fileData.meta)) {
266
+ if (validateImport(fileData.meta)) {
250
267
  count = Object.keys(fileData.theme).length;
251
268
  // eslint-disable-next-line no-await-in-loop
252
- const result = await frodo.theme.putThemes(fileData.theme);
269
+ const result = await updateThemes(fileData.theme);
253
270
  if (result == null) {
254
271
  printMessage(`Error importing ${count} themes from ${file}`, 'error');
255
272
  } else {
256
273
  files += 1;
257
274
  total += count;
258
- updateProgressIndicator(`Imported ${count} theme(s) from ${file}`);
275
+ updateProgressIndicator(indicatorId, `Imported ${count} theme(s) from ${file}`);
259
276
  }
260
277
  } else {
261
278
  printMessage(`Validation of ${file} failed!`, 'error');
262
279
  }
263
280
  }
264
- stopProgressIndicator(`Finished importing ${total} theme(s) from ${files} file(s).`);
281
+ stopProgressIndicator(indicatorId, `Finished importing ${total} theme(s) from ${files} file(s).`);
265
282
  }
266
283
 
267
284
  /**
@@ -269,29 +286,25 @@ export async function importThemesFromFiles() {
269
286
  * @param {String} file import file name
270
287
  */
271
288
  export async function importFirstThemeFromFile(file) {
272
- fs.readFile(file, 'utf8', (err, data) => {
273
- if (err) throw err;
274
- const themeData = JSON.parse(data);
275
- if (frodo.utils.impex.validateImport(themeData.meta)) {
276
- createProgressIndicator('determinate', 1, 'Importing theme...');
277
- for (const id in themeData.theme) {
278
- if ({}.hasOwnProperty.call(themeData.theme, id)) {
279
- updateProgressIndicator(`Importing ${themeData.theme[id].name}`);
280
- frodo.theme.putTheme(id, themeData.theme[id]).then(result => {
281
- if (result == null) {
282
- stopProgressIndicator(`Error importing theme ${themeData.theme[id].name}`);
283
- printMessage(`Error importing theme ${themeData.theme[id].name}`, 'error');
284
- } else {
285
- stopProgressIndicator(`Successfully imported theme ${themeData.theme[id].name}`);
286
- }
287
- });
288
- break;
289
+ try {
290
+ const data = fs.readFileSync(getFilePath(file), 'utf8');
291
+ const themeExport = JSON.parse(data);
292
+ const indicatorId = createProgressIndicator('determinate', 1, 'Importing theme...');
293
+ for (const id of Object.keys(themeExport.theme)) {
294
+ updateProgressIndicator(indicatorId, `Importing ${themeExport.theme[id].name}`);
295
+ updateTheme(id, themeExport.theme[id]).then(result => {
296
+ if (result == null) {
297
+ stopProgressIndicator(indicatorId, `Error importing theme ${themeExport.theme[id].name}`);
298
+ printMessage(`Error importing theme ${themeExport.theme[id].name}`, 'error');
299
+ } else {
300
+ stopProgressIndicator(indicatorId, `Successfully imported theme ${themeExport.theme[id].name}`);
289
301
  }
290
- }
291
- } else {
292
- printMessage('Import validation failed...', 'error');
302
+ });
303
+ break;
293
304
  }
294
- });
305
+ } catch (error) {
306
+ printMessage(`Error importing themes: ${error}`, 'error');
307
+ }
295
308
  }
296
309
 
297
310
  /**
@@ -299,12 +312,12 @@ export async function importFirstThemeFromFile(file) {
299
312
  * @param {String} id theme id
300
313
  */
301
314
  export async function deleteThemeCmd(id) {
302
- createProgressIndicator('indeterminate', undefined, `Deleting ${id}...`);
315
+ const indicatorId = createProgressIndicator('indeterminate', undefined, `Deleting ${id}...`);
303
316
  try {
304
- await frodo.theme.deleteTheme(id);
305
- stopProgressIndicator(`Deleted ${id}.`, 'success');
317
+ await deleteTheme(id);
318
+ stopProgressIndicator(indicatorId, `Deleted ${id}.`, 'success');
306
319
  } catch (error) {
307
- stopProgressIndicator(`Error: ${error.message}`, 'fail');
320
+ stopProgressIndicator(indicatorId, `Error: ${error.message}`, 'fail');
308
321
  }
309
322
  }
310
323
 
@@ -313,12 +326,12 @@ export async function deleteThemeCmd(id) {
313
326
  * @param {String} name theme name
314
327
  */
315
328
  export async function deleteThemeByNameCmd(name) {
316
- createProgressIndicator('indeterminate', undefined, `Deleting ${name}...`);
329
+ const indicatorId = createProgressIndicator('indeterminate', undefined, `Deleting ${name}...`);
317
330
  try {
318
- await frodo.theme.deleteThemeByName(name);
319
- stopProgressIndicator(`Deleted ${name}.`, 'success');
331
+ await deleteThemeByName(name);
332
+ stopProgressIndicator(indicatorId, `Deleted ${name}.`, 'success');
320
333
  } catch (error) {
321
- stopProgressIndicator(`Error: ${error.message}`, 'fail');
334
+ stopProgressIndicator(indicatorId, `Error: ${error.message}`, 'fail');
322
335
  }
323
336
  }
324
337
 
@@ -326,12 +339,12 @@ export async function deleteThemeByNameCmd(name) {
326
339
  * Delete all themes
327
340
  */
328
341
  export async function deleteAllThemes() {
329
- createProgressIndicator('indeterminate', undefined, `Deleting all realm themes...`);
342
+ const indicatorId = createProgressIndicator('indeterminate', undefined, `Deleting all realm themes...`);
330
343
  try {
331
- await frodo.theme.deleteThemes();
332
- stopProgressIndicator(`Deleted all realm themes.`, 'success');
344
+ await deleteThemes();
345
+ stopProgressIndicator(indicatorId, `Deleted all realm themes.`, 'success');
333
346
  } catch (error) {
334
- stopProgressIndicator(`Error: ${error.message}`, 'fail');
347
+ stopProgressIndicator(indicatorId, `Error: ${error.message}`, 'fail');
335
348
  }
336
349
  }
337
350
 
@@ -342,4 +355,4 @@ export async function deleteAllThemes() {
342
355
  export async function deleteThemesCmd() {
343
356
  return deleteAllThemes();
344
357
  }
345
- //# sourceMappingURL=ThemeOps.js.map
358
+ //# sourceMappingURL=ThemeOps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeOps.js","names":["frodo","fs","printMessage","createTable","createProgressIndicator","updateProgressIndicator","stopProgressIndicator","saveToFile","getTypedFilename","getOneLineDescription","themeObj","description","_id","name","linkedTrees","join","getTableHeaderMd","markdown","getTableRowMd","row","listThemes","long","themeList","theme","getThemes","sort","a","b","localeCompare","forEach","isDefault","table","push","toString","exportThemeByName","file","fileName","themeData","getThemeByName","error","message","exportThemeById","id","getTheme","exportThemesToFile","utils","impex","getRealmString","allThemesData","length","exportThemesToFiles","importThemeByName","readFile","err","data","JSON","parse","validateImport","meta","found","hasOwnProperty","call","putThemeByName","importThemeById","themeId","putTheme","importThemesFromFile","fileData","Object","keys","putThemes","then","result","importThemesFromFiles","names","readdirSync","jsonFiles","filter","toLowerCase","endsWith","count","total","files","readFileSync","importFirstThemeFromFile","deleteThemeCmd","undefined","deleteTheme","deleteThemeByNameCmd","deleteThemeByName","deleteAllThemes","deleteThemes","deleteThemesCmd"],"sources":["ops/ThemeOps.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport fs from 'fs';\nimport type { ThemeSkeleton } from '@rockcarver/frodo-lib/types/api/ApiTypes';\nimport {\n printMessage,\n createTable,\n createProgressIndicator,\n updateProgressIndicator,\n stopProgressIndicator,\n} from '../utils/Console';\nimport { saveToFile, getTypedFilename } from '../utils/ExportImportUtils';\n/**\n * Get a one-line description of the theme\n * @param {ThemeSkeleton} themeObj theme object to describe\n * @returns {string} a one-line description\n */\nexport function getOneLineDescription(themeObj: ThemeSkeleton): string {\n const description = `[${themeObj._id['brightCyan']}] ${themeObj.name}${\n themeObj.linkedTrees\n ? ' (' + themeObj.linkedTrees.join(', ')['brightCyan'] + ')'\n : ''\n }`;\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 += '| Name | Linked Journey(s) | Id |\\n';\n markdown += '| ---- | ----------------- | ---|';\n return markdown;\n}\n\n/**\n * Get a table-row of the theme in markdown\n * @param {ThemeSkeleton} themeObj theme object to describe\n * @returns {string} a table-row of the theme in markdown\n */\nexport function getTableRowMd(themeObj: ThemeSkeleton): string {\n const row = `| ${themeObj.name} | ${\n themeObj.linkedTrees ? themeObj.linkedTrees.join(', ') : ''\n } | \\`${themeObj._id}\\` |`;\n return row;\n}\n\n/**\n * List all the themes\n * @param {boolean} long Long version, more fields\n */\nexport async function listThemes(long = false) {\n const themeList = await frodo.theme.getThemes();\n themeList.sort((a, b) => a.name.localeCompare(b.name));\n if (!long) {\n themeList.forEach((theme) => {\n printMessage(\n `${theme.isDefault ? theme.name['brightCyan'] : theme.name}`,\n 'data'\n );\n });\n } else {\n const table = createTable([\n 'Name'['brightCyan'],\n 'Id'['brightCyan'],\n 'Default'['brightCyan'],\n ]);\n themeList.forEach((theme) => {\n table.push([\n `${theme.name}`,\n `${theme._id}`,\n `${theme.isDefault ? 'Yes'['brightGreen'] : ''}`,\n ]);\n });\n printMessage(table.toString(), 'data');\n }\n}\n\n/**\n * Export theme by name to file\n * @param {String} name theme name\n * @param {String} file optional export file name\n */\nexport async function exportThemeByName(name, file) {\n let fileName = getTypedFilename(name, 'theme');\n if (file) {\n fileName = file;\n }\n createProgressIndicator('determinate', 1, `Exporting ${name}`);\n try {\n const themeData = await frodo.theme.getThemeByName(name);\n updateProgressIndicator(`Writing file ${fileName}`);\n saveToFile('theme', [themeData], '_id', fileName);\n stopProgressIndicator(`Successfully exported theme ${name}.`);\n } catch (error) {\n stopProgressIndicator(`${error.message}`);\n printMessage(`${error.message}`, 'error');\n }\n}\n\n/**\n * Export theme by uuid to file\n * @param {String} id theme uuid\n * @param {String} file optional export file name\n */\nexport async function exportThemeById(id, file) {\n let fileName = getTypedFilename(id, 'theme');\n if (file) {\n fileName = file;\n }\n createProgressIndicator('determinate', 1, `Exporting ${id}`);\n try {\n const themeData = await frodo.theme.getTheme(id);\n updateProgressIndicator(`Writing file ${fileName}`);\n saveToFile('theme', [themeData], '_id', fileName);\n stopProgressIndicator(`Successfully exported theme ${id}.`);\n } catch (error) {\n stopProgressIndicator(`${error.message}`);\n printMessage(`${error.message}`, 'error');\n }\n}\n\n/**\n * Export all themes to file\n * @param {String} file optional export file name\n */\nexport async function exportThemesToFile(file) {\n let fileName = getTypedFilename(\n `all${frodo.utils.impex.getRealmString()}Themes`,\n 'theme'\n );\n if (file) {\n fileName = file;\n }\n const allThemesData = await frodo.theme.getThemes();\n createProgressIndicator(\n 'determinate',\n allThemesData.length,\n 'Exporting themes'\n );\n for (const themeData of allThemesData) {\n updateProgressIndicator(`Exporting theme ${themeData.name}`);\n }\n saveToFile('theme', allThemesData, '_id', fileName);\n stopProgressIndicator(\n `${allThemesData.length} themes exported to ${fileName}.`\n );\n}\n\n/**\n * Export all themes to separate files\n */\nexport async function exportThemesToFiles() {\n const allThemesData = await frodo.theme.getThemes();\n createProgressIndicator(\n 'determinate',\n allThemesData.length,\n 'Exporting themes'\n );\n for (const themeData of allThemesData) {\n updateProgressIndicator(`Writing theme ${themeData.name}`);\n const fileName = getTypedFilename(themeData.name, 'theme');\n saveToFile('theme', themeData, '_id', fileName);\n }\n stopProgressIndicator(`${allThemesData.length} themes exported.`);\n}\n\n/**\n * Import theme by name from file\n * @param {String} name theme name\n * @param {String} file import file name\n */\nexport async function importThemeByName(name, file) {\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n const themeData = JSON.parse(data);\n if (frodo.utils.impex.validateImport(themeData.meta)) {\n createProgressIndicator('determinate', 1, 'Importing theme...');\n let found = false;\n for (const id in themeData.theme) {\n if ({}.hasOwnProperty.call(themeData.theme, id)) {\n if (themeData.theme[id].name === name) {\n found = true;\n updateProgressIndicator(`Importing ${themeData.theme[id].name}`);\n try {\n await frodo.theme.putThemeByName(name, themeData.theme[id]);\n stopProgressIndicator(`Successfully imported theme ${name}.`);\n } catch (error) {\n stopProgressIndicator(\n `Error importing theme ${themeData.theme[id].name}: ${error.message}`\n );\n printMessage(\n `Error importing theme ${themeData.theme[id].name}: ${error.message}`,\n 'error'\n );\n }\n break;\n }\n }\n }\n if (!found) {\n stopProgressIndicator(`Theme ${name} not found!`);\n }\n } else {\n printMessage('Import validation failed...', 'error');\n }\n });\n}\n\n/**\n * Import theme by uuid from file\n * @param {String} id theme uuid\n * @param {String} file import file name\n */\nexport async function importThemeById(id, file) {\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n const themeData = JSON.parse(data);\n if (frodo.utils.impex.validateImport(themeData.meta)) {\n createProgressIndicator('determinate', 1, 'Importing theme...');\n let found = false;\n for (const themeId in themeData.theme) {\n if ({}.hasOwnProperty.call(themeData.theme, themeId)) {\n if (themeId === id) {\n found = true;\n updateProgressIndicator(\n `Importing ${themeData.theme[themeId]._id}`\n );\n try {\n await frodo.theme.putTheme(themeId, themeData.theme[themeId]);\n stopProgressIndicator(`Successfully imported theme ${id}.`);\n } catch (error) {\n stopProgressIndicator(\n `Error importing theme ${themeData.theme[themeId]._id}: ${error.message}`\n );\n printMessage(\n `Error importing theme ${themeData.theme[themeId]._id}: ${error.message}`,\n 'error'\n );\n }\n break;\n }\n }\n }\n if (!found) {\n stopProgressIndicator(`Theme ${id} not found!`);\n }\n } else {\n printMessage('Import validation failed...', 'error');\n }\n });\n}\n\n/**\n * Import all themes from single file\n * @param {String} file import file name\n */\nexport async function importThemesFromFile(file) {\n fs.readFile(file, 'utf8', (err, data) => {\n if (err) throw err;\n const fileData = JSON.parse(data);\n if (frodo.utils.impex.validateImport(fileData.meta)) {\n createProgressIndicator(\n 'determinate',\n Object.keys(fileData.theme).length,\n 'Importing themes...'\n );\n for (const id in fileData.theme) {\n if ({}.hasOwnProperty.call(fileData.theme, id)) {\n updateProgressIndicator(`Importing ${fileData.theme[id].name}`);\n }\n }\n frodo.theme.putThemes(fileData.theme).then((result) => {\n if (result == null) {\n stopProgressIndicator(\n `Error importing ${Object.keys(fileData.theme).length} themes!`\n );\n printMessage(\n `Error importing ${\n Object.keys(fileData.theme).length\n } themes from ${file}`,\n 'error'\n );\n } else {\n stopProgressIndicator(\n `Successfully imported ${\n Object.keys(fileData.theme).length\n } themes.`\n );\n }\n });\n } else {\n printMessage('Import validation failed...', 'error');\n }\n });\n}\n\n/**\n * Import themes from separate files\n */\nexport async function importThemesFromFiles() {\n const names = fs.readdirSync('.');\n const jsonFiles = names.filter((name) =>\n name.toLowerCase().endsWith('.theme.json')\n );\n\n createProgressIndicator(\n 'determinate',\n jsonFiles.length,\n 'Importing themes...'\n );\n let fileData = null;\n let count = 0;\n let total = 0;\n let files = 0;\n for (const file of jsonFiles) {\n const data = fs.readFileSync(file, 'utf8');\n fileData = JSON.parse(data);\n if (frodo.utils.impex.validateImport(fileData.meta)) {\n count = Object.keys(fileData.theme).length;\n // eslint-disable-next-line no-await-in-loop\n const result = await frodo.theme.putThemes(fileData.theme);\n if (result == null) {\n printMessage(`Error importing ${count} themes from ${file}`, 'error');\n } else {\n files += 1;\n total += count;\n updateProgressIndicator(`Imported ${count} theme(s) from ${file}`);\n }\n } else {\n printMessage(`Validation of ${file} failed!`, 'error');\n }\n }\n stopProgressIndicator(\n `Finished importing ${total} theme(s) from ${files} file(s).`\n );\n}\n\n/**\n * Import first theme from file\n * @param {String} file import file name\n */\nexport async function importFirstThemeFromFile(file) {\n fs.readFile(file, 'utf8', (err, data) => {\n if (err) throw err;\n const themeData = JSON.parse(data);\n if (frodo.utils.impex.validateImport(themeData.meta)) {\n createProgressIndicator('determinate', 1, 'Importing theme...');\n for (const id in themeData.theme) {\n if ({}.hasOwnProperty.call(themeData.theme, id)) {\n updateProgressIndicator(`Importing ${themeData.theme[id].name}`);\n frodo.theme.putTheme(id, themeData.theme[id]).then((result) => {\n if (result == null) {\n stopProgressIndicator(\n `Error importing theme ${themeData.theme[id].name}`\n );\n printMessage(\n `Error importing theme ${themeData.theme[id].name}`,\n 'error'\n );\n } else {\n stopProgressIndicator(\n `Successfully imported theme ${themeData.theme[id].name}`\n );\n }\n });\n break;\n }\n }\n } else {\n printMessage('Import validation failed...', 'error');\n }\n });\n}\n\n/**\n * Delete theme by id\n * @param {String} id theme id\n */\nexport async function deleteThemeCmd(id) {\n createProgressIndicator('indeterminate', undefined, `Deleting ${id}...`);\n try {\n await frodo.theme.deleteTheme(id);\n stopProgressIndicator(`Deleted ${id}.`, 'success');\n } catch (error) {\n stopProgressIndicator(`Error: ${error.message}`, 'fail');\n }\n}\n\n/**\n * Delete theme by name\n * @param {String} name theme name\n */\nexport async function deleteThemeByNameCmd(name) {\n createProgressIndicator('indeterminate', undefined, `Deleting ${name}...`);\n try {\n await frodo.theme.deleteThemeByName(name);\n stopProgressIndicator(`Deleted ${name}.`, 'success');\n } catch (error) {\n stopProgressIndicator(`Error: ${error.message}`, 'fail');\n }\n}\n\n/**\n * Delete all themes\n */\nexport async function deleteAllThemes() {\n createProgressIndicator(\n 'indeterminate',\n undefined,\n `Deleting all realm themes...`\n );\n try {\n await frodo.theme.deleteThemes();\n stopProgressIndicator(`Deleted all realm themes.`, 'success');\n } catch (error) {\n stopProgressIndicator(`Error: ${error.message}`, 'fail');\n }\n}\n\n/**\n * Delete all themes\n * @deprecated since version 0.14.0\n */\nexport async function deleteThemesCmd() {\n return deleteAllThemes();\n}\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAC7C,OAAOC,EAAE,MAAM,IAAI;AAEnB,SACEC,YAAY,EACZC,WAAW,EACXC,uBAAuB,EACvBC,uBAAuB,EACvBC,qBAAqB,QAChB,kBAAkB;AACzB,SAASC,UAAU,EAAEC,gBAAgB,QAAQ,4BAA4B;AACzE;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,qBAAqBA,CAACC,QAAuB,EAAU;EACrE,MAAMC,WAAW,GAAI,IAAGD,QAAQ,CAACE,GAAG,CAAC,YAAY,CAAE,KAAIF,QAAQ,CAACG,IAAK,GACnEH,QAAQ,CAACI,WAAW,GAChB,IAAI,GAAGJ,QAAQ,CAACI,WAAW,CAACC,IAAI,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,GAAG,GAAG,GAC1D,EACL,EAAC;EACF,OAAOJ,WAAW;AACpB;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASK,gBAAgBA,CAAA,EAAW;EACzC,IAAIC,QAAQ,GAAG,EAAE;EACjBA,QAAQ,IAAI,qCAAqC;EACjDA,QAAQ,IAAI,mCAAmC;EAC/C,OAAOA,QAAQ;AACjB;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SA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AAS,EAAG,YAAW5C,EAAG,KAAI,CAAC;EACxE,IAAI;IACF,MAAM1C,KAAK,CAACuB,KAAK,CAACgE,WAAW,CAAC7C,EAAE,CAAC;IACjCpC,qBAAqB,CAAE,WAAUoC,EAAG,GAAE,EAAE,SAAS,CAAC;EACpD,CAAC,CAAC,OAAOH,KAAK,EAAE;IACdjC,qBAAqB,CAAE,UAASiC,KAAK,CAACC,OAAQ,EAAC,EAAE,MAAM,CAAC;EAC1D;AACF;;AAEA;AACA;AACA;AACA;AACA,OAAO,eAAegD,oBAAoBA,CAAC3E,IAAI,EAAE;EAC/CT,uBAAuB,CAAC,eAAe,EAAEkF,SAAS,EAAG,YAAWzE,IAAK,KAAI,CAAC;EAC1E,IAAI;IACF,MAAMb,KAAK,CAACuB,KAAK,CAACkE,iBAAiB,CAAC5E,IAAI,CAAC;IACzCP,qBAAqB,CAAE,WAAUO,IAAK,GAAE,EAAE,SAAS,CAAC;EACtD,CAAC,CAAC,OAAO0B,KAAK,EAAE;IACdjC,qBAAqB,CAAE,UAASiC,KAAK,CAACC,OAAQ,EAAC,EAAE,MAAM,CAAC;EAC1D;AACF;;AAEA;AACA;AACA;AACA,OAAO,eAAekD,eAAeA,CAAA,EAAG;EACtCtF,uBAAuB,CACrB,eAAe,EACfkF,SAAS,EACR,8BACH,CAAC;EACD,IAAI;IACF,MAAMtF,KAAK,CAACuB,KAAK,CAACoE,YAAY,CAAC,CAAC;IAChCrF,qBAAqB,CAAE,2BAA0B,EAAE,SAAS,CAAC;EAC/D,CAAC,CAAC,OAAOiC,KAAK,EAAE;IACdjC,qBAAqB,CAAE,UAASiC,KAAK,CAACC,OAAQ,EAAC,EAAE,MAAM,CAAC;EAC1D;AACF;;AAEA;AACA;AACA;AACA;AACA,OAAO,eAAeoD,eAAeA,CAAA,EAAG;EACtC,OAAOF,eAAe,CAAC,CAAC;AAC1B"}
1
+ {"version":3,"file":"ThemeOps.js","names":["frodo","fs","v4","uuidv4","createProgressIndicator","createTable","printMessage","stopProgressIndicator","updateProgressIndicator","getRealmString","validateImport","getTypedFilename","saveJsonToFile","saveToFile","getFilePath","getWorkingDirectory","utils","readThemes","readThemeByName","readTheme","updateThemeByName","updateTheme","updateThemes","exportThemes","deleteTheme","deleteThemeByName","deleteThemes","theme","getOneLineDescription","themeObj","description","_id","name","linkedTrees","join","getTableHeaderMd","markdown","getTableRowMd","row","listThemes","long","themeList","sort","a","b","localeCompare","forEach","isDefault","table","push","toString","exportThemeByName","file","includeMeta","fileName","filePath","indicatorId","themeData","error","message","exportThemeById","id","exportThemesToFile","exportData","exportThemesToFiles","themes","barId","length","fileBarId","importThemeByName","data","readFileSync","themeExport","JSON","parse","found","Object","keys","importThemeById","themeId","importThemesFromFile","result","importThemesFromFiles","names","readdirSync","jsonFiles","filter","toLowerCase","endsWith","map","fileData","count","total","files","meta","importFirstThemeFromFile","then","deleteThemeCmd","undefined","deleteThemeByNameCmd","deleteAllThemes","deleteThemesCmd"],"sources":["../../src/ops/ThemeOps.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport {\n ThemeExportInterface,\n type ThemeSkeleton,\n} from '@rockcarver/frodo-lib/types/ops/ThemeOps';\nimport fs from 'fs';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport {\n createProgressIndicator,\n createTable,\n printMessage,\n stopProgressIndicator,\n updateProgressIndicator,\n} from '../utils/Console';\n\nconst {\n getRealmString,\n validateImport,\n getTypedFilename,\n saveJsonToFile,\n saveToFile,\n getFilePath,\n getWorkingDirectory,\n} = frodo.utils;\nconst {\n readThemes,\n readThemeByName,\n readTheme,\n updateThemeByName,\n updateTheme,\n updateThemes,\n exportThemes,\n deleteTheme,\n deleteThemeByName,\n deleteThemes,\n} = frodo.theme;\n\n/**\n * Get a one-line description of the theme\n * @param {ThemeSkeleton} themeObj theme object to describe\n * @returns {string} a one-line description\n */\nexport function getOneLineDescription(themeObj: ThemeSkeleton): string {\n const description = `[${themeObj._id['brightCyan']}] ${themeObj.name}${\n themeObj.linkedTrees\n ? ' (' + themeObj.linkedTrees.join(', ')['brightCyan'] + ')'\n : ''\n }`;\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 += '| Name | Linked Journey(s) | Id |\\n';\n markdown += '| ---- | ----------------- | ---|';\n return markdown;\n}\n\n/**\n * Get a table-row of the theme in markdown\n * @param {ThemeSkeleton} themeObj theme object to describe\n * @returns {string} a table-row of the theme in markdown\n */\nexport function getTableRowMd(themeObj: ThemeSkeleton): string {\n const row = `| ${themeObj.name} | ${\n themeObj.linkedTrees ? themeObj.linkedTrees.join(', ') : ''\n } | \\`${themeObj._id}\\` |`;\n return row;\n}\n\n/**\n * List all the themes\n * @param {boolean} long Long version, more fields\n */\nexport async function listThemes(long = false) {\n const themeList = await readThemes();\n themeList.sort((a, b) => a.name.localeCompare(b.name));\n if (!long) {\n themeList.forEach((theme) => {\n printMessage(\n `${theme.isDefault ? theme.name['brightCyan'] : theme.name}`,\n 'data'\n );\n });\n } else {\n const table = createTable([\n 'Name'['brightCyan'],\n 'Id'['brightCyan'],\n 'Default'['brightCyan'],\n ]);\n themeList.forEach((theme) => {\n table.push([\n `${theme.name}`,\n `${theme._id}`,\n `${theme.isDefault ? 'Yes'['brightGreen'] : ''}`,\n ]);\n });\n printMessage(table.toString(), 'data');\n }\n}\n\n/**\n * Export theme by name to file\n * @param {String} name theme name\n * @param {String} file optional export file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n */\nexport async function exportThemeByName(name, file, includeMeta = true) {\n let fileName = getTypedFilename(name, 'theme');\n if (file) {\n fileName = file;\n }\n const filePath = getFilePath(fileName, true);\n const indicatorId = createProgressIndicator(\n 'determinate',\n 1,\n `Exporting ${name}`\n );\n try {\n const themeData = await readThemeByName(name);\n if (!themeData._id) themeData._id = uuidv4();\n updateProgressIndicator(indicatorId, `Writing file to ${filePath}`);\n saveToFile('theme', [themeData], '_id', filePath, includeMeta);\n stopProgressIndicator(indicatorId, `Successfully exported theme ${name}.`);\n } catch (error) {\n stopProgressIndicator(indicatorId, `${error.message}`);\n printMessage(`${error.message}`, 'error');\n }\n}\n\n/**\n * Export theme by uuid to file\n * @param {String} id theme uuid\n * @param {String} file optional export file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n */\nexport async function exportThemeById(id, file, includeMeta = true) {\n let fileName = getTypedFilename(id, 'theme');\n if (file) {\n fileName = file;\n }\n const filePath = getFilePath(fileName, true);\n const indicatorId = createProgressIndicator(\n 'determinate',\n 1,\n `Exporting ${id}`\n );\n try {\n const themeData = await readTheme(id);\n updateProgressIndicator(indicatorId, `Writing file to ${filePath}`);\n saveToFile('theme', [themeData], '_id', filePath, includeMeta);\n stopProgressIndicator(indicatorId, `Successfully exported theme ${id}.`);\n } catch (error) {\n stopProgressIndicator(indicatorId, `${error.message}`);\n printMessage(`${error.message}`, 'error');\n }\n}\n\n/**\n * Export all themes to file\n * @param {String} file optional export file name\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n */\nexport async function exportThemesToFile(file, includeMeta = true) {\n let fileName = getTypedFilename(`all${getRealmString()}Themes`, 'theme');\n if (file) {\n fileName = file;\n }\n const filePath = getFilePath(fileName, true);\n const exportData = await exportThemes();\n saveJsonToFile(exportData, filePath, includeMeta);\n}\n\n/**\n * Export all themes to separate files\n * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true\n */\nexport async function exportThemesToFiles(includeMeta = true) {\n const themes = await readThemes();\n const barId = createProgressIndicator(\n 'determinate',\n themes.length,\n 'Exporting themes'\n );\n for (const theme of themes) {\n if (!theme._id) theme._id = uuidv4();\n const fileBarId = createProgressIndicator(\n 'determinate',\n 1,\n `Exporting theme ${theme.name}...`\n );\n updateProgressIndicator(barId, `Exporting theme ${theme.name}`);\n const file = getFilePath(getTypedFilename(theme.name, 'theme'), true);\n saveToFile('theme', theme, '_id', file, includeMeta);\n updateProgressIndicator(fileBarId, `${theme.name} saved to ${file}`);\n stopProgressIndicator(fileBarId, `${theme.name} saved to ${file}.`);\n }\n stopProgressIndicator(barId, `${themes.length} themes exported.`);\n}\n\n/**\n * Import theme by name from file\n * @param {String} name theme name\n * @param {String} file import file name\n */\nexport async function importThemeByName(name, file) {\n try {\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n const themeExport: ThemeExportInterface = JSON.parse(data);\n const indicatorId = createProgressIndicator(\n 'determinate',\n 1,\n 'Importing theme...'\n );\n let found = false;\n for (const id of Object.keys(themeExport.theme)) {\n if (themeExport.theme[id].name === name) {\n found = true;\n updateProgressIndicator(\n indicatorId,\n `Importing ${themeExport.theme[id].name}`\n );\n try {\n await updateThemeByName(name, themeExport.theme[id]);\n stopProgressIndicator(\n indicatorId,\n `Successfully imported theme ${name}.`\n );\n } catch (error) {\n stopProgressIndicator(\n indicatorId,\n `Error importing theme ${themeExport.theme[id].name}: ${error.message}`\n );\n printMessage(\n `Error importing theme ${themeExport.theme[id].name}: ${error.message}`,\n 'error'\n );\n }\n break;\n }\n }\n if (!found) {\n stopProgressIndicator(indicatorId, `Theme ${name} not found!`);\n }\n } catch (error) {\n printMessage(`Error importing theme ${name}: ${error}`, 'error');\n }\n}\n\n/**\n * Import theme by uuid from file\n * @param {String} id theme uuid\n * @param {String} file import file name\n */\nexport async function importThemeById(id, file) {\n try {\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n const themeExport: ThemeExportInterface = JSON.parse(data);\n const indicatorId = createProgressIndicator(\n 'determinate',\n 1,\n 'Importing theme...'\n );\n let found = false;\n for (const themeId of Object.keys(themeExport.theme)) {\n if (themeId === id) {\n found = true;\n updateProgressIndicator(\n indicatorId,\n `Importing ${themeExport.theme[themeId]._id}`\n );\n try {\n await updateTheme(themeId, themeExport.theme[themeId]);\n stopProgressIndicator(\n indicatorId,\n `Successfully imported theme ${id}.`\n );\n } catch (error) {\n stopProgressIndicator(\n indicatorId,\n `Error importing theme ${themeExport.theme[themeId]._id}: ${error.message}`\n );\n printMessage(\n `Error importing theme ${themeExport.theme[themeId]._id}: ${error.message}`,\n 'error'\n );\n }\n break;\n }\n }\n if (!found) {\n stopProgressIndicator(indicatorId, `Theme ${id} not found!`);\n }\n } catch (error) {\n printMessage(`Error importing theme ${id}: ${error}`, 'error');\n }\n}\n\n/**\n * Import all themes from single file\n * @param {String} file import file name\n */\nexport async function importThemesFromFile(file) {\n const filePath = getFilePath(file);\n try {\n const data = fs.readFileSync(filePath, 'utf8');\n const themeExport: ThemeExportInterface = JSON.parse(data);\n const indicatorId = createProgressIndicator(\n 'determinate',\n Object.keys(themeExport.theme).length,\n 'Importing themes...'\n );\n for (const id of Object.keys(themeExport.theme)) {\n updateProgressIndicator(\n indicatorId,\n `Importing ${themeExport.theme[id].name}`\n );\n }\n const result = await updateThemes(themeExport.theme);\n if (result == null) {\n stopProgressIndicator(\n indicatorId,\n `Error importing ${Object.keys(themeExport.theme).length} themes!`\n );\n printMessage(\n `Error importing ${\n Object.keys(themeExport.theme).length\n } themes from ${filePath}`,\n 'error'\n );\n } else {\n stopProgressIndicator(\n indicatorId,\n `Successfully imported ${Object.keys(themeExport.theme).length} themes.`\n );\n }\n } catch (error) {\n printMessage(`Error importing themes: ${error}`, 'error');\n }\n}\n\n/**\n * Import themes from separate files\n */\nexport async function importThemesFromFiles() {\n const names = fs.readdirSync(getWorkingDirectory());\n const jsonFiles = names\n .filter((name) => name.toLowerCase().endsWith('.theme.json'))\n .map((name) => getFilePath(name));\n\n const indicatorId = createProgressIndicator(\n 'determinate',\n jsonFiles.length,\n 'Importing themes...'\n );\n let fileData = null;\n let count = 0;\n let total = 0;\n let files = 0;\n for (const file of jsonFiles) {\n const data = fs.readFileSync(file, 'utf8');\n fileData = JSON.parse(data);\n if (validateImport(fileData.meta)) {\n count = Object.keys(fileData.theme).length;\n // eslint-disable-next-line no-await-in-loop\n const result = await updateThemes(fileData.theme);\n if (result == null) {\n printMessage(`Error importing ${count} themes from ${file}`, 'error');\n } else {\n files += 1;\n total += count;\n updateProgressIndicator(\n indicatorId,\n `Imported ${count} theme(s) from ${file}`\n );\n }\n } else {\n printMessage(`Validation of ${file} failed!`, 'error');\n }\n }\n stopProgressIndicator(\n indicatorId,\n `Finished importing ${total} theme(s) from ${files} file(s).`\n );\n}\n\n/**\n * Import first theme from file\n * @param {String} file import file name\n */\nexport async function importFirstThemeFromFile(file) {\n try {\n const data = fs.readFileSync(getFilePath(file), 'utf8');\n const themeExport = JSON.parse(data);\n const indicatorId = createProgressIndicator(\n 'determinate',\n 1,\n 'Importing theme...'\n );\n for (const id of Object.keys(themeExport.theme)) {\n updateProgressIndicator(\n indicatorId,\n `Importing ${themeExport.theme[id].name}`\n );\n updateTheme(id, themeExport.theme[id]).then((result) => {\n if (result == null) {\n stopProgressIndicator(\n indicatorId,\n `Error importing theme ${themeExport.theme[id].name}`\n );\n printMessage(\n `Error importing theme ${themeExport.theme[id].name}`,\n 'error'\n );\n } else {\n stopProgressIndicator(\n indicatorId,\n `Successfully imported theme ${themeExport.theme[id].name}`\n );\n }\n });\n break;\n }\n } catch (error) {\n printMessage(`Error importing themes: ${error}`, 'error');\n }\n}\n\n/**\n * Delete theme by id\n * @param {String} id theme id\n */\nexport async function deleteThemeCmd(id) {\n const indicatorId = createProgressIndicator(\n 'indeterminate',\n undefined,\n `Deleting ${id}...`\n );\n try {\n await deleteTheme(id);\n stopProgressIndicator(indicatorId, `Deleted ${id}.`, 'success');\n } catch (error) {\n stopProgressIndicator(indicatorId, `Error: ${error.message}`, 'fail');\n }\n}\n\n/**\n * Delete theme by name\n * @param {String} name theme name\n */\nexport async function deleteThemeByNameCmd(name) {\n const indicatorId = createProgressIndicator(\n 'indeterminate',\n undefined,\n `Deleting ${name}...`\n );\n try {\n await deleteThemeByName(name);\n stopProgressIndicator(indicatorId, `Deleted ${name}.`, 'success');\n } catch (error) {\n stopProgressIndicator(indicatorId, `Error: ${error.message}`, 'fail');\n }\n}\n\n/**\n * Delete all themes\n */\nexport async function deleteAllThemes() {\n const indicatorId = createProgressIndicator(\n 'indeterminate',\n undefined,\n `Deleting all realm themes...`\n );\n try {\n await deleteThemes();\n stopProgressIndicator(indicatorId, `Deleted all realm themes.`, 'success');\n } catch (error) {\n stopProgressIndicator(indicatorId, `Error: ${error.message}`, 'fail');\n }\n}\n\n/**\n * Delete all themes\n * @deprecated since version 0.14.0\n */\nexport async function deleteThemesCmd() {\n return deleteAllThemes();\n}\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAK7C,OAAOC,EAAE,MAAM,IAAI;AACnB,SAASC,EAAE,IAAIC,MAAM,QAAQ,MAAM;AAEnC,SACEC,uBAAuB,EACvBC,WAAW,EACXC,YAAY,EACZC,qBAAqB,EACrBC,uBAAuB,QAClB,kBAAkB;AAEzB,MAAM;EACJC,cAAc;EACdC,cAAc;EACdC,gBAAgB;EAChBC,cAAc;EACdC,UAAU;EACVC,WAAW;EACXC;AACF,CAAC,GAAGf,KAAK,CAACgB,KAAK;AACf,MAAM;EACJC,UAAU;EACVC,eAAe;EACfC,SAAS;EACTC,iBAAiB;EACjBC,WAAW;EACXC,YAAY;EACZC,YAAY;EACZC,WAAW;EACXC,iBAAiB;EACjBC;AACF,CAAC,GAAG1B,KAAK,CAAC2B,KAAK;;AAEf;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,qBAAqBA,CAACC,QAAuB,EAAU;EACrE,MAAMC,WAAW,GAAI,IAAGD,QAAQ,CAACE,GAAG,CAAC,YAAY,CAAE,KAAIF,QAAQ,CAACG,IAAK,GACnEH,QAAQ,CAACI,WAAW,GAChB,IAAI,GAAGJ,QAAQ,CAACI,WAAW,CAACC,IAAI,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,GAAG,GAAG,GAC1D,EACL,EAAC;EACF,OAAOJ,WAAW;AACpB;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASK,gBAAgBA,CAAA,EAAW;EACzC,IAAIC,QAAQ,GAAG,EAAE;EACjBA,QAAQ,IAAI,qCAAqC;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