@rockcarver/frodo-cli 0.18.2-1 → 0.18.2-11

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 (372) hide show
  1. package/CHANGELOG.md +44 -1
  2. package/esm/app.js +6 -2
  3. package/esm/app.js.map +1 -1
  4. package/esm/cli/_template/something-delete.js +28 -0
  5. package/esm/cli/_template/something-delete.js.map +1 -0
  6. package/esm/cli/_template/something-describe.js +28 -0
  7. package/esm/cli/_template/something-describe.js.map +1 -0
  8. package/esm/cli/_template/something-else-delete.js +28 -0
  9. package/esm/cli/_template/something-else-delete.js.map +1 -0
  10. package/esm/cli/_template/something-else-describe.js +28 -0
  11. package/esm/cli/_template/something-else-describe.js.map +1 -0
  12. package/esm/cli/_template/something-else-export.js +28 -0
  13. package/esm/cli/_template/something-else-export.js.map +1 -0
  14. package/esm/cli/_template/something-else-import.js +28 -0
  15. package/esm/cli/_template/something-else-import.js.map +1 -0
  16. package/esm/cli/_template/something-else-list.js +28 -0
  17. package/esm/cli/_template/something-else-list.js.map +1 -0
  18. package/esm/cli/_template/something-else.js +10 -0
  19. package/esm/cli/_template/something-else.js.map +1 -0
  20. package/esm/cli/_template/something-export.js +28 -0
  21. package/esm/cli/_template/something-export.js.map +1 -0
  22. package/esm/cli/_template/something-import.js +28 -0
  23. package/esm/cli/_template/something-import.js.map +1 -0
  24. package/esm/cli/_template/something-list.js +28 -0
  25. package/esm/cli/_template/something-list.js.map +1 -0
  26. package/esm/cli/_template/something-other-delete.js +28 -0
  27. package/esm/cli/_template/something-other-delete.js.map +1 -0
  28. package/esm/cli/_template/something-other-describe.js +28 -0
  29. package/esm/cli/_template/something-other-describe.js.map +1 -0
  30. package/esm/cli/_template/something-other-export.js +28 -0
  31. package/esm/cli/_template/something-other-export.js.map +1 -0
  32. package/esm/cli/_template/something-other-import.js +28 -0
  33. package/esm/cli/_template/something-other-import.js.map +1 -0
  34. package/esm/cli/_template/{cmd-export.js → something-other-list.js} +12 -6
  35. package/esm/cli/_template/something-other-list.js.map +1 -0
  36. package/esm/cli/_template/something-other.js +10 -0
  37. package/esm/cli/_template/something-other.js.map +1 -0
  38. package/esm/cli/_template/something.js +17 -0
  39. package/esm/cli/_template/something.js.map +1 -0
  40. package/esm/cli/admin/admin-add-autoid-static-user-mapping.js +8 -3
  41. package/esm/cli/admin/admin-add-autoid-static-user-mapping.js.map +1 -1
  42. package/esm/cli/admin/admin-create-oauth2-client-with-admin-privileges.js +10 -11
  43. package/esm/cli/admin/admin-create-oauth2-client-with-admin-privileges.js.map +1 -1
  44. package/esm/cli/admin/admin-get-access-token.js +8 -3
  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 -3
  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 -3
  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 -3
  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 -3
  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 -3
  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 -3
  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 -3
  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 -3
  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 -3
  63. package/esm/cli/admin/admin-show-generic-extension-attributes.js.map +1 -1
  64. package/esm/cli/admin/admin.js +0 -2
  65. package/esm/cli/admin/admin.js.map +1 -1
  66. package/esm/cli/agent/agent-delete.js +59 -0
  67. package/esm/cli/agent/agent-delete.js.map +1 -0
  68. package/esm/cli/{_template/cmd-describe.js → agent/agent-describe.js} +11 -5
  69. package/esm/cli/agent/agent-describe.js.map +1 -0
  70. package/esm/cli/agent/agent-export.js +49 -0
  71. package/esm/cli/agent/agent-export.js.map +1 -0
  72. package/esm/cli/agent/agent-gateway-delete.js +59 -0
  73. package/esm/cli/agent/agent-gateway-delete.js.map +1 -0
  74. package/esm/cli/agent/agent-gateway-describe.js +28 -0
  75. package/esm/cli/agent/agent-gateway-describe.js.map +1 -0
  76. package/esm/cli/agent/agent-gateway-export.js +49 -0
  77. package/esm/cli/agent/agent-gateway-export.js.map +1 -0
  78. package/esm/cli/agent/agent-gateway-import.js +54 -0
  79. package/esm/cli/agent/agent-gateway-import.js.map +1 -0
  80. package/esm/cli/agent/agent-gateway-list.js +29 -0
  81. package/esm/cli/agent/agent-gateway-list.js.map +1 -0
  82. package/esm/cli/agent/agent-gateway.js +10 -0
  83. package/esm/cli/agent/agent-gateway.js.map +1 -0
  84. package/esm/cli/agent/agent-import.js +54 -0
  85. package/esm/cli/agent/agent-import.js.map +1 -0
  86. package/esm/cli/agent/agent-java-delete.js +59 -0
  87. package/esm/cli/agent/agent-java-delete.js.map +1 -0
  88. package/esm/cli/agent/agent-java-describe.js +28 -0
  89. package/esm/cli/agent/agent-java-describe.js.map +1 -0
  90. package/esm/cli/agent/agent-java-export.js +49 -0
  91. package/esm/cli/agent/agent-java-export.js.map +1 -0
  92. package/esm/cli/agent/agent-java-import.js +54 -0
  93. package/esm/cli/agent/agent-java-import.js.map +1 -0
  94. package/esm/cli/agent/agent-java-list.js +29 -0
  95. package/esm/cli/agent/agent-java-list.js.map +1 -0
  96. package/esm/cli/agent/agent-java.js +10 -0
  97. package/esm/cli/agent/agent-java.js.map +1 -0
  98. package/esm/cli/{_template/cmd-sub1-export.js → agent/agent-list.js} +13 -6
  99. package/esm/cli/agent/agent-list.js.map +1 -0
  100. package/esm/cli/agent/agent-web-delete.js +59 -0
  101. package/esm/cli/agent/agent-web-delete.js.map +1 -0
  102. package/esm/cli/agent/agent-web-describe.js +28 -0
  103. package/esm/cli/agent/agent-web-describe.js.map +1 -0
  104. package/esm/cli/agent/agent-web-export.js +49 -0
  105. package/esm/cli/agent/agent-web-export.js.map +1 -0
  106. package/esm/cli/agent/agent-web-import.js +54 -0
  107. package/esm/cli/agent/agent-web-import.js.map +1 -0
  108. package/esm/cli/agent/agent-web-list.js +29 -0
  109. package/esm/cli/agent/agent-web-list.js.map +1 -0
  110. package/esm/cli/agent/agent-web.js +10 -0
  111. package/esm/cli/agent/agent-web.js.map +1 -0
  112. package/esm/cli/agent/agent.js +18 -0
  113. package/esm/cli/agent/agent.js.map +1 -0
  114. package/esm/cli/app/app-delete.js +10 -4
  115. package/esm/cli/app/app-delete.js.map +1 -1
  116. package/esm/cli/app/app-describe.js +10 -4
  117. package/esm/cli/app/app-describe.js.map +1 -1
  118. package/esm/cli/app/app-export.js +28 -22
  119. package/esm/cli/app/app-export.js.map +1 -1
  120. package/esm/cli/app/app-import.js +14 -7
  121. package/esm/cli/app/app-import.js.map +1 -1
  122. package/esm/cli/app/app-list.js +10 -5
  123. package/esm/cli/app/app-list.js.map +1 -1
  124. package/esm/cli/app/app.js +8 -5
  125. package/esm/cli/app/app.js.map +1 -1
  126. package/esm/cli/cmd_common.js +9 -6
  127. package/esm/cli/cmd_common.js.map +1 -1
  128. package/esm/cli/conn/conn-add.js +8 -5
  129. package/esm/cli/conn/conn-add.js.map +1 -1
  130. package/esm/cli/conn/conn-delete.js +9 -4
  131. package/esm/cli/conn/conn-delete.js.map +1 -1
  132. package/esm/cli/conn/conn-describe.js +8 -3
  133. package/esm/cli/conn/conn-describe.js.map +1 -1
  134. package/esm/cli/conn/conn-list.js +10 -7
  135. package/esm/cli/conn/conn-list.js.map +1 -1
  136. package/esm/cli/conn/conn.js +2 -3
  137. package/esm/cli/conn/conn.js.map +1 -1
  138. package/esm/cli/email/email-template-export.js +30 -28
  139. package/esm/cli/email/email-template-export.js.map +1 -1
  140. package/esm/cli/email/email-template-import.js +35 -33
  141. package/esm/cli/email/email-template-import.js.map +1 -1
  142. package/esm/cli/email/email-template-list.js +12 -9
  143. package/esm/cli/email/email-template-list.js.map +1 -1
  144. package/esm/cli/email/email-template.js.map +1 -1
  145. package/esm/cli/email/email.js +0 -2
  146. package/esm/cli/email/email.js.map +1 -1
  147. package/esm/cli/esv/esv-apply.js +12 -11
  148. package/esm/cli/esv/esv-apply.js.map +1 -1
  149. package/esm/cli/esv/esv-secret-create.js +10 -5
  150. package/esm/cli/esv/esv-secret-create.js.map +1 -1
  151. package/esm/cli/esv/esv-secret-delete.js +23 -18
  152. package/esm/cli/esv/esv-secret-delete.js.map +1 -1
  153. package/esm/cli/esv/esv-secret-describe.js +10 -5
  154. package/esm/cli/esv/esv-secret-describe.js.map +1 -1
  155. package/esm/cli/esv/esv-secret-export.js +10 -4
  156. package/esm/cli/esv/esv-secret-export.js.map +1 -1
  157. package/esm/cli/esv/esv-secret-import.js +10 -4
  158. package/esm/cli/esv/esv-secret-import.js.map +1 -1
  159. package/esm/cli/esv/esv-secret-list.js +10 -5
  160. package/esm/cli/esv/esv-secret-list.js.map +1 -1
  161. package/esm/cli/esv/esv-secret-set.js +10 -5
  162. package/esm/cli/esv/esv-secret-set.js.map +1 -1
  163. package/esm/cli/esv/esv-secret-version-activate.js +18 -14
  164. package/esm/cli/esv/esv-secret-version-activate.js.map +1 -1
  165. package/esm/cli/esv/esv-secret-version-create.js +10 -5
  166. package/esm/cli/esv/esv-secret-version-create.js.map +1 -1
  167. package/esm/cli/esv/esv-secret-version-deactivate.js +18 -14
  168. package/esm/cli/esv/esv-secret-version-deactivate.js.map +1 -1
  169. package/esm/cli/esv/esv-secret-version-delete.js +23 -19
  170. package/esm/cli/esv/esv-secret-version-delete.js.map +1 -1
  171. package/esm/cli/esv/esv-secret-version-list.js +10 -5
  172. package/esm/cli/esv/esv-secret-version-list.js.map +1 -1
  173. package/esm/cli/esv/esv-secret-version.js.map +1 -1
  174. package/esm/cli/esv/esv-secret.js +4 -1
  175. package/esm/cli/esv/esv-secret.js.map +1 -1
  176. package/esm/cli/esv/esv-variable-create.js +11 -6
  177. package/esm/cli/esv/esv-variable-create.js.map +1 -1
  178. package/esm/cli/esv/esv-variable-delete.js +23 -18
  179. package/esm/cli/esv/esv-variable-delete.js.map +1 -1
  180. package/esm/cli/esv/esv-variable-describe.js +10 -5
  181. package/esm/cli/esv/esv-variable-describe.js.map +1 -1
  182. package/esm/cli/esv/esv-variable-export.js +10 -4
  183. package/esm/cli/esv/esv-variable-export.js.map +1 -1
  184. package/esm/cli/esv/esv-variable-import.js +10 -4
  185. package/esm/cli/esv/esv-variable-import.js.map +1 -1
  186. package/esm/cli/esv/esv-variable-list.js +10 -5
  187. package/esm/cli/esv/esv-variable-list.js.map +1 -1
  188. package/esm/cli/esv/esv-variable-set.js +21 -17
  189. package/esm/cli/esv/esv-variable-set.js.map +1 -1
  190. package/esm/cli/esv/esv-variable.js +4 -1
  191. package/esm/cli/esv/esv-variable.js.map +1 -1
  192. package/esm/cli/esv/esv.js +0 -2
  193. package/esm/cli/esv/esv.js.map +1 -1
  194. package/esm/cli/idm/idm-count.js +10 -5
  195. package/esm/cli/idm/idm-count.js.map +1 -1
  196. package/esm/cli/idm/idm-export.js +29 -23
  197. package/esm/cli/idm/idm-export.js.map +1 -1
  198. package/esm/cli/idm/idm-import.js +51 -0
  199. package/esm/cli/idm/idm-import.js.map +1 -0
  200. package/esm/cli/idm/idm-list.js +12 -6
  201. package/esm/cli/idm/idm-list.js.map +1 -1
  202. package/esm/cli/idm/idm.js +3 -3
  203. package/esm/cli/idm/idm.js.map +1 -1
  204. package/esm/cli/idp/idp-export.js +18 -10
  205. package/esm/cli/idp/idp-export.js.map +1 -1
  206. package/esm/cli/idp/idp-import.js +33 -26
  207. package/esm/cli/idp/idp-import.js.map +1 -1
  208. package/esm/cli/idp/idp-list.js +12 -6
  209. package/esm/cli/idp/idp-list.js.map +1 -1
  210. package/esm/cli/idp/idp.js +0 -2
  211. package/esm/cli/idp/idp.js.map +1 -1
  212. package/esm/cli/info/info.js +6 -8
  213. package/esm/cli/info/info.js.map +1 -1
  214. package/esm/cli/journey/journey-delete.js +23 -18
  215. package/esm/cli/journey/journey-delete.js.map +1 -1
  216. package/esm/cli/journey/journey-describe.js +34 -30
  217. package/esm/cli/journey/journey-describe.js.map +1 -1
  218. package/esm/cli/journey/journey-disable.js +22 -18
  219. package/esm/cli/journey/journey-disable.js.map +1 -1
  220. package/esm/cli/journey/journey-enable.js +22 -18
  221. package/esm/cli/journey/journey-enable.js.map +1 -1
  222. package/esm/cli/journey/journey-export.js +35 -31
  223. package/esm/cli/journey/journey-export.js.map +1 -1
  224. package/esm/cli/journey/journey-import.js +42 -37
  225. package/esm/cli/journey/journey-import.js.map +1 -1
  226. package/esm/cli/journey/journey-list.js +10 -5
  227. package/esm/cli/journey/journey-list.js.map +1 -1
  228. package/esm/cli/journey/journey-prune.js +10 -7
  229. package/esm/cli/journey/journey-prune.js.map +1 -1
  230. package/esm/cli/journey/journey.js +0 -2
  231. package/esm/cli/journey/journey.js.map +1 -1
  232. package/esm/cli/logging/logs-fetch.js +6 -12
  233. package/esm/cli/logging/logs-fetch.js.map +1 -1
  234. package/esm/cli/logging/logs-list.js +4 -6
  235. package/esm/cli/logging/logs-list.js.map +1 -1
  236. package/esm/cli/logging/logs-tail.js +4 -5
  237. package/esm/cli/logging/logs-tail.js.map +1 -1
  238. package/esm/cli/logging/logs.js +2 -4
  239. package/esm/cli/logging/logs.js.map +1 -1
  240. package/esm/cli/realm/realm-add-custom-domain.js +10 -5
  241. package/esm/cli/realm/realm-add-custom-domain.js.map +1 -1
  242. package/esm/cli/realm/realm-describe.js +10 -5
  243. package/esm/cli/realm/realm-describe.js.map +1 -1
  244. package/esm/cli/realm/realm-list.js +10 -5
  245. package/esm/cli/realm/realm-list.js.map +1 -1
  246. package/esm/cli/realm/realm-remove-custom-domain.js +10 -5
  247. package/esm/cli/realm/realm-remove-custom-domain.js.map +1 -1
  248. package/esm/cli/realm/realm.js +5 -4
  249. package/esm/cli/realm/realm.js.map +1 -1
  250. package/esm/cli/saml/saml-cot-export.js +28 -22
  251. package/esm/cli/saml/saml-cot-export.js.map +1 -1
  252. package/esm/cli/saml/saml-cot-import.js +33 -26
  253. package/esm/cli/saml/saml-cot-import.js.map +1 -1
  254. package/esm/cli/saml/saml-cot-list.js +10 -5
  255. package/esm/cli/saml/saml-cot-list.js.map +1 -1
  256. package/esm/cli/saml/saml-cot.js.map +1 -1
  257. package/esm/cli/saml/saml-delete.js +45 -0
  258. package/esm/cli/saml/saml-delete.js.map +1 -0
  259. package/esm/cli/saml/saml-describe.js +12 -9
  260. package/esm/cli/saml/saml-describe.js.map +1 -1
  261. package/esm/cli/saml/saml-export.js +44 -27
  262. package/esm/cli/saml/saml-export.js.map +1 -1
  263. package/esm/cli/saml/saml-import.js +48 -28
  264. package/esm/cli/saml/saml-import.js.map +1 -1
  265. package/esm/cli/saml/saml-list.js +18 -10
  266. package/esm/cli/saml/saml-list.js.map +1 -1
  267. package/esm/cli/saml/saml-metadata-export.js +24 -22
  268. package/esm/cli/saml/saml-metadata-export.js.map +1 -1
  269. package/esm/cli/saml/saml-metadata.js.map +1 -1
  270. package/esm/cli/saml/saml.js +1 -2
  271. package/esm/cli/saml/saml.js.map +1 -1
  272. package/esm/cli/script/script-delete.js +10 -4
  273. package/esm/cli/script/script-delete.js.map +1 -1
  274. package/esm/cli/script/script-describe.js +10 -4
  275. package/esm/cli/script/script-describe.js.map +1 -1
  276. package/esm/cli/script/script-export.js +32 -24
  277. package/esm/cli/script/script-export.js.map +1 -1
  278. package/esm/cli/script/script-import.js +12 -6
  279. package/esm/cli/script/script-import.js.map +1 -1
  280. package/esm/cli/script/script-list.js +10 -5
  281. package/esm/cli/script/script-list.js.map +1 -1
  282. package/esm/cli/script/script.js +6 -4
  283. package/esm/cli/script/script.js.map +1 -1
  284. package/esm/cli/service/service-delete.js +28 -0
  285. package/esm/cli/service/service-delete.js.map +1 -0
  286. package/esm/cli/service/service-export.js +45 -0
  287. package/esm/cli/service/service-export.js.map +1 -0
  288. package/esm/cli/service/service-import.js +53 -0
  289. package/esm/cli/service/service-import.js.map +1 -0
  290. package/esm/cli/service/service-list.js +26 -0
  291. package/esm/cli/service/service-list.js.map +1 -0
  292. package/esm/cli/service/service.js +14 -0
  293. package/esm/cli/service/service.js.map +1 -0
  294. package/esm/cli/theme/theme-delete.e2e.test_.js.map +1 -1
  295. package/esm/cli/theme/theme-delete.js +30 -28
  296. package/esm/cli/theme/theme-delete.js.map +1 -1
  297. package/esm/cli/theme/theme-export.js +35 -33
  298. package/esm/cli/theme/theme-export.js.map +1 -1
  299. package/esm/cli/theme/theme-import.js +38 -38
  300. package/esm/cli/theme/theme-import.js.map +1 -1
  301. package/esm/cli/theme/theme-list.e2e.test_.js.map +1 -1
  302. package/esm/cli/theme/theme-list.js +12 -9
  303. package/esm/cli/theme/theme-list.js.map +1 -1
  304. package/esm/cli/theme/theme.js +0 -2
  305. package/esm/cli/theme/theme.js.map +1 -1
  306. package/esm/ops/AgentOps.js +698 -0
  307. package/esm/ops/AgentOps.js.map +1 -0
  308. package/esm/ops/CirclesOfTrustOps.js +2 -2
  309. package/esm/ops/CirclesOfTrustOps.js.map +1 -1
  310. package/esm/ops/EmailTemplateOps.js +270 -6
  311. package/esm/ops/EmailTemplateOps.js.map +1 -1
  312. package/esm/ops/IdpOps.js +2 -2
  313. package/esm/ops/IdpOps.js.map +1 -1
  314. package/esm/ops/JourneyOps.js +96 -152
  315. package/esm/ops/JourneyOps.js.map +1 -1
  316. package/esm/ops/NodeOps.js +6 -12
  317. package/esm/ops/NodeOps.js.map +1 -1
  318. package/esm/ops/Saml2Ops.js +456 -9
  319. package/esm/ops/Saml2Ops.js.map +1 -1
  320. package/esm/ops/Saml2Ops.test_.js.map +1 -0
  321. package/esm/ops/ScriptOps.js +3 -3
  322. package/esm/ops/ScriptOps.js.map +1 -1
  323. package/esm/ops/ServiceOps.js +213 -0
  324. package/esm/ops/ServiceOps.js.map +1 -0
  325. package/esm/ops/ThemeOps.js +331 -2
  326. package/esm/ops/ThemeOps.js.map +1 -1
  327. package/esm/ops/utils/Wordwrap.js.map +1 -1
  328. package/esm/storage/StaticStorage.js.map +1 -1
  329. package/esm/utils/Config.js +0 -9
  330. package/esm/utils/Config.js.map +1 -1
  331. package/esm/utils/Console.js +58 -67
  332. package/esm/utils/Console.js.map +1 -1
  333. package/esm/utils/ExportImportUtils.js +46 -0
  334. package/esm/utils/ExportImportUtils.js.map +1 -0
  335. package/esm/utils/Version.js +6 -24
  336. package/esm/utils/Version.js.map +1 -1
  337. package/package.json +20 -20
  338. package/esm/cli/_template/cmd-delete.js +0 -22
  339. package/esm/cli/_template/cmd-delete.js.map +0 -1
  340. package/esm/cli/_template/cmd-describe.js.map +0 -1
  341. package/esm/cli/_template/cmd-export.js.map +0 -1
  342. package/esm/cli/_template/cmd-import.js +0 -22
  343. package/esm/cli/_template/cmd-import.js.map +0 -1
  344. package/esm/cli/_template/cmd-list.js +0 -22
  345. package/esm/cli/_template/cmd-list.js.map +0 -1
  346. package/esm/cli/_template/cmd-sub1-delete.js +0 -22
  347. package/esm/cli/_template/cmd-sub1-delete.js.map +0 -1
  348. package/esm/cli/_template/cmd-sub1-describe.js +0 -22
  349. package/esm/cli/_template/cmd-sub1-describe.js.map +0 -1
  350. package/esm/cli/_template/cmd-sub1-export.js.map +0 -1
  351. package/esm/cli/_template/cmd-sub1-import.js +0 -22
  352. package/esm/cli/_template/cmd-sub1-import.js.map +0 -1
  353. package/esm/cli/_template/cmd-sub1-list.js +0 -22
  354. package/esm/cli/_template/cmd-sub1-list.js.map +0 -1
  355. package/esm/cli/_template/cmd-sub1.js +0 -10
  356. package/esm/cli/_template/cmd-sub1.js.map +0 -1
  357. package/esm/cli/_template/cmd-sub2-delete.js +0 -22
  358. package/esm/cli/_template/cmd-sub2-delete.js.map +0 -1
  359. package/esm/cli/_template/cmd-sub2-describe.js +0 -22
  360. package/esm/cli/_template/cmd-sub2-describe.js.map +0 -1
  361. package/esm/cli/_template/cmd-sub2-export.js +0 -22
  362. package/esm/cli/_template/cmd-sub2-export.js.map +0 -1
  363. package/esm/cli/_template/cmd-sub2-import.js +0 -22
  364. package/esm/cli/_template/cmd-sub2-import.js.map +0 -1
  365. package/esm/cli/_template/cmd-sub2-list.js +0 -22
  366. package/esm/cli/_template/cmd-sub2-list.js.map +0 -1
  367. package/esm/cli/_template/cmd-sub2.js +0 -10
  368. package/esm/cli/_template/cmd-sub2.js.map +0 -1
  369. package/esm/cli/_template/cmd.js +0 -19
  370. package/esm/cli/_template/cmd.js.map +0 -1
  371. package/esm/cli/journey/journey-delete.e2e.test_.js.map +0 -1
  372. package/esm/cli/journey/journey-list.e2e.test_.js.map +0 -1
@@ -0,0 +1,213 @@
1
+ import fs from 'fs';
2
+ import { printMessage, createTable, debugMessage, showSpinner, succeedSpinner, failSpinner } from '../utils/Console';
3
+ import { ExportImportUtils, Service, Utils, state } from '@rockcarver/frodo-lib';
4
+ const {
5
+ createServiceExportTemplate,
6
+ deleteFullServices,
7
+ deleteFullService,
8
+ getListOfServices,
9
+ getFullServices,
10
+ exportServices,
11
+ exportService,
12
+ importServices,
13
+ importService
14
+ } = Service;
15
+ const {
16
+ getTypedFilename,
17
+ getWorkingDirectory,
18
+ saveJsonToFile,
19
+ titleCase
20
+ } = ExportImportUtils;
21
+ const {
22
+ getRealmName
23
+ } = Utils;
24
+
25
+ /**
26
+ * List services
27
+ */
28
+ export async function listServices(long = false) {
29
+ try {
30
+ const services = await getListOfServices();
31
+ services.sort((a, b) => a._id.localeCompare(b._id));
32
+ if (long) {
33
+ const table = createTable(['Service Id', 'Service Name']);
34
+ for (const service of services) {
35
+ table.push([service._id, service.name]);
36
+ }
37
+ printMessage(table.toString(), 'data');
38
+ } else {
39
+ for (const service of services) {
40
+ printMessage(`${service._id}`, 'data');
41
+ }
42
+ }
43
+ } catch (error) {
44
+ printMessage(`Error listing agents - ${error}`, 'error');
45
+ printMessage(error.stack, 'error');
46
+ }
47
+ }
48
+
49
+ /**
50
+ * Export all services to file
51
+ * @param {string} file file name
52
+ */
53
+ export async function exportServicesToFile(file) {
54
+ const exportData = await exportServices();
55
+ let fileName = getTypedFilename(`all${titleCase(getRealmName(state.default.session.getRealm()))}Services`, `service`);
56
+ if (file) {
57
+ fileName = file;
58
+ }
59
+ saveJsonToFile(exportData, fileName);
60
+ }
61
+
62
+ /**
63
+ * Export service to file
64
+ * @param {string} serviceId service id
65
+ * @param {string} file file name
66
+ */
67
+ export async function exportServiceToFile(serviceId, file) {
68
+ const exportData = await exportService(serviceId);
69
+ let fileName = getTypedFilename(serviceId, `service`);
70
+ if (file) {
71
+ fileName = file;
72
+ }
73
+ saveJsonToFile(exportData, fileName);
74
+ }
75
+
76
+ /**
77
+ * Export all services to separate files
78
+ */
79
+ export async function exportServicesToFiles() {
80
+ debugMessage(`cli.ServiceOps.exportServicesToFiles: start`);
81
+ const services = await getFullServices();
82
+ for (const service of services) {
83
+ const fileName = getTypedFilename(service._type._id, `service`);
84
+ const exportData = createServiceExportTemplate();
85
+ exportData.service[service._type._id] = service;
86
+ debugMessage(`cli.ServiceOps.exportServicesToFiles: exporting ${service._type._id} to ${fileName}`);
87
+ saveJsonToFile(exportData, fileName);
88
+ }
89
+ debugMessage(`cli.ServiceOps.exportServicesToFiles: end.`);
90
+ }
91
+
92
+ /**
93
+ * Import a service from file
94
+ * @param {string} serviceId service id/name
95
+ * @param {string} file import file name
96
+ * @param {boolean} clean remove existing service
97
+ */
98
+ export async function importServiceFromFile(serviceId, file, clean) {
99
+ debugMessage(`cli.ServiceOps.importServiceFromFile: start [serviceId=${serviceId}, file=${file}]`);
100
+ const verbose = state.default.session.getVerbose();
101
+ fs.readFile(file, 'utf8', async (err, data) => {
102
+ if (err) throw err;
103
+ const importData = JSON.parse(data);
104
+ if (importData && importData.service[serviceId]) {
105
+ if (!verbose) showSpinner(`Importing ${serviceId}...`);
106
+ try {
107
+ if (verbose) showSpinner(`Importing ${serviceId}...`);
108
+ await importService(serviceId, importData, clean);
109
+ succeedSpinner(`Imported ${serviceId}.`);
110
+ } catch (importError) {
111
+ var _importError$response, _importError$response2, _importError$response3, _importError$response4;
112
+ const message = (_importError$response = importError.response) === null || _importError$response === void 0 ? void 0 : (_importError$response2 = _importError$response.data) === null || _importError$response2 === void 0 ? void 0 : _importError$response2.message;
113
+ const detail = (_importError$response3 = importError.response) === null || _importError$response3 === void 0 ? void 0 : (_importError$response4 = _importError$response3.data) === null || _importError$response4 === void 0 ? void 0 : _importError$response4.detail;
114
+ if (verbose) showSpinner(`Importing ${serviceId}...`);
115
+ failSpinner(`${detail ? message + ' - ' + detail : message}`);
116
+ }
117
+ } else {
118
+ showSpinner(`Importing ${serviceId}...`);
119
+ failSpinner(`${serviceId} not found!`);
120
+ }
121
+ });
122
+ debugMessage(`cli.ServiceOps.importServiceFromFile: end [serviceId=${serviceId}, file=${file}]`);
123
+ }
124
+
125
+ /**
126
+ * Import first service from file
127
+ * @param {string} file import file name
128
+ * @param {boolean} clean remove existing service
129
+ */
130
+ export async function importFirstServiceFromFile(file, clean) {
131
+ debugMessage(`cli.ServiceOps.importFirstServiceFromFile: start [file=${file}]`);
132
+ const verbose = state.default.session.getVerbose();
133
+ fs.readFile(file, 'utf8', async (err, data) => {
134
+ if (err) throw err;
135
+ const importData = JSON.parse(data);
136
+ if (importData && Object.keys(importData.service).length) {
137
+ const serviceId = Object.keys(importData.service)[0];
138
+ if (!verbose) showSpinner(`Importing ${serviceId}...`);
139
+ try {
140
+ if (verbose) showSpinner(`Importing ${serviceId}...`);
141
+ await importService(serviceId, importData, clean);
142
+ succeedSpinner(`Imported ${serviceId}.`);
143
+ } catch (importError) {
144
+ var _importError$response5, _importError$response6, _importError$response7, _importError$response8;
145
+ const message = (_importError$response5 = importError.response) === null || _importError$response5 === void 0 ? void 0 : (_importError$response6 = _importError$response5.data) === null || _importError$response6 === void 0 ? void 0 : _importError$response6.message;
146
+ const detail = (_importError$response7 = importError.response) === null || _importError$response7 === void 0 ? void 0 : (_importError$response8 = _importError$response7.data) === null || _importError$response8 === void 0 ? void 0 : _importError$response8.detail;
147
+ if (verbose) showSpinner(`Importing ${serviceId}...`);
148
+ failSpinner(`${detail ? message + ' - ' + detail : message}`);
149
+ }
150
+ } else {
151
+ showSpinner(`Importing service...`);
152
+ failSpinner(`No service found in ${file}!`);
153
+ }
154
+ debugMessage(`cli.ServiceOps.importFirstServiceFromFile: end [file=${file}]`);
155
+ });
156
+ }
157
+
158
+ /**
159
+ * Import services from file
160
+ * @param {String} file file name
161
+ * @param {boolean} clean remove existing service
162
+ */
163
+ export async function importServicesFromFile(file, clean) {
164
+ debugMessage(`cli.ServiceOps.importServiceFromFile: start [file=${file}]`);
165
+ fs.readFile(file, 'utf8', async (err, data) => {
166
+ if (err) throw err;
167
+ debugMessage(`cli.ServiceOps.importServiceFromFile: importing ${file}`);
168
+ const importData = JSON.parse(data);
169
+ try {
170
+ await importServices(importData, clean);
171
+ } catch (error) {
172
+ printMessage(`${error.message}`, 'error');
173
+ printMessage(error.response.status, 'error');
174
+ }
175
+ debugMessage(`cli.ServiceOps.importServiceFromFile: end [file=${file}]`);
176
+ });
177
+ }
178
+
179
+ /**
180
+ * Import all services from separate files
181
+ * @param {boolean} clean remove existing service
182
+ */
183
+ export async function importServicesFromFiles(clean) {
184
+ debugMessage(`cli.ServiceOps.importServicesFromFiles: start`);
185
+ const names = fs.readdirSync(getWorkingDirectory());
186
+ const agentFiles = names.filter(name => name.toLowerCase().endsWith('.service.json'));
187
+ for (const file of agentFiles) {
188
+ await importServicesFromFile(file, clean);
189
+ }
190
+ debugMessage(`cli.ServiceOps.importServicesFromFiles: end`);
191
+ }
192
+
193
+ /**
194
+ * Delete a service by id/name
195
+ * @param {string} serviceId Reference to the service to delete
196
+ */
197
+ export async function deleteService(serviceId) {
198
+ try {
199
+ await deleteFullService(serviceId);
200
+ } catch (error) {
201
+ var _error$response, _error$response$data;
202
+ const message = (_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$data = _error$response.data) === null || _error$response$data === void 0 ? void 0 : _error$response$data.message;
203
+ printMessage(`Delete service '${serviceId}': ${message}`, 'error');
204
+ }
205
+ }
206
+
207
+ /**
208
+ * Delete all services
209
+ */
210
+ export async function deleteServices() {
211
+ await deleteFullServices();
212
+ }
213
+ //# sourceMappingURL=ServiceOps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ServiceOps.js","names":["fs","printMessage","createTable","debugMessage","showSpinner","succeedSpinner","failSpinner","ExportImportUtils","Service","Utils","state","createServiceExportTemplate","deleteFullServices","deleteFullService","getListOfServices","getFullServices","exportServices","exportService","importServices","importService","getTypedFilename","getWorkingDirectory","saveJsonToFile","titleCase","getRealmName","listServices","long","services","sort","a","b","_id","localeCompare","table","service","push","name","toString","error","stack","exportServicesToFile","file","exportData","fileName","default","session","getRealm","exportServiceToFile","serviceId","exportServicesToFiles","_type","importServiceFromFile","clean","verbose","getVerbose","readFile","err","data","importData","JSON","parse","importError","message","response","detail","importFirstServiceFromFile","Object","keys","length","importServicesFromFile","status","importServicesFromFiles","names","readdirSync","agentFiles","filter","toLowerCase","endsWith","deleteService","deleteServices"],"sources":["ops/ServiceOps.ts"],"sourcesContent":["import fs from 'fs';\nimport {\n printMessage,\n createTable,\n debugMessage,\n showSpinner,\n succeedSpinner,\n failSpinner,\n} from '../utils/Console';\nimport {\n ExportImportUtils,\n Service,\n Utils,\n state,\n} from '@rockcarver/frodo-lib';\nimport { ServiceExportInterface } from '@rockcarver/frodo-lib/types/ops/OpsTypes';\n\nconst {\n createServiceExportTemplate,\n deleteFullServices,\n deleteFullService,\n getListOfServices,\n getFullServices,\n exportServices,\n exportService,\n importServices,\n importService,\n} = Service;\nconst { getTypedFilename, getWorkingDirectory, saveJsonToFile, titleCase } =\n ExportImportUtils;\nconst { getRealmName } = Utils;\n\n/**\n * List services\n */\nexport async function listServices(long = false) {\n try {\n const services = await getListOfServices();\n services.sort((a, b) => a._id.localeCompare(b._id));\n if (long) {\n const table = createTable(['Service Id', 'Service Name']);\n for (const service of services) {\n table.push([service._id, service.name]);\n }\n printMessage(table.toString(), 'data');\n } else {\n for (const service of services) {\n printMessage(`${service._id}`, 'data');\n }\n }\n } catch (error) {\n printMessage(`Error listing agents - ${error}`, 'error');\n printMessage(error.stack, 'error');\n }\n}\n\n/**\n * Export all services to file\n * @param {string} file file name\n */\nexport async function exportServicesToFile(file) {\n const exportData = await exportServices();\n let fileName = getTypedFilename(\n `all${titleCase(getRealmName(state.default.session.getRealm()))}Services`,\n `service`\n );\n if (file) {\n fileName = file;\n }\n saveJsonToFile(exportData, fileName);\n}\n\n/**\n * Export service to file\n * @param {string} serviceId service id\n * @param {string} file file name\n */\nexport async function exportServiceToFile(serviceId: string, file: string) {\n const exportData = await exportService(serviceId);\n let fileName = getTypedFilename(serviceId, `service`);\n if (file) {\n fileName = file;\n }\n saveJsonToFile(exportData, fileName);\n}\n\n/**\n * Export all services to separate files\n */\nexport async function exportServicesToFiles() {\n debugMessage(`cli.ServiceOps.exportServicesToFiles: start`);\n const services = await getFullServices();\n for (const service of services) {\n const fileName = getTypedFilename(service._type._id, `service`);\n const exportData = createServiceExportTemplate();\n exportData.service[service._type._id] = service;\n debugMessage(\n `cli.ServiceOps.exportServicesToFiles: exporting ${service._type._id} to ${fileName}`\n );\n saveJsonToFile(exportData, fileName);\n }\n debugMessage(`cli.ServiceOps.exportServicesToFiles: end.`);\n}\n\n/**\n * Import a service from file\n * @param {string} serviceId service id/name\n * @param {string} file import file name\n * @param {boolean} clean remove existing service\n */\nexport async function importServiceFromFile(\n serviceId: string,\n file: string,\n clean: boolean\n) {\n debugMessage(\n `cli.ServiceOps.importServiceFromFile: start [serviceId=${serviceId}, file=${file}]`\n );\n const verbose = state.default.session.getVerbose();\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n const importData = JSON.parse(data);\n if (importData && importData.service[serviceId]) {\n if (!verbose) showSpinner(`Importing ${serviceId}...`);\n try {\n if (verbose) showSpinner(`Importing ${serviceId}...`);\n await importService(serviceId, importData, clean);\n succeedSpinner(`Imported ${serviceId}.`);\n } catch (importError) {\n const message = importError.response?.data?.message;\n const detail = importError.response?.data?.detail;\n if (verbose) showSpinner(`Importing ${serviceId}...`);\n failSpinner(`${detail ? message + ' - ' + detail : message}`);\n }\n } else {\n showSpinner(`Importing ${serviceId}...`);\n failSpinner(`${serviceId} not found!`);\n }\n });\n debugMessage(\n `cli.ServiceOps.importServiceFromFile: end [serviceId=${serviceId}, file=${file}]`\n );\n}\n\n/**\n * Import first service from file\n * @param {string} file import file name\n * @param {boolean} clean remove existing service\n */\nexport async function importFirstServiceFromFile(file: string, clean: boolean) {\n debugMessage(\n `cli.ServiceOps.importFirstServiceFromFile: start [file=${file}]`\n );\n const verbose = state.default.session.getVerbose();\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n const importData = JSON.parse(data);\n if (importData && Object.keys(importData.service).length) {\n const serviceId = Object.keys(importData.service)[0];\n if (!verbose) showSpinner(`Importing ${serviceId}...`);\n try {\n if (verbose) showSpinner(`Importing ${serviceId}...`);\n await importService(serviceId, importData, clean);\n succeedSpinner(`Imported ${serviceId}.`);\n } catch (importError) {\n const message = importError.response?.data?.message;\n const detail = importError.response?.data?.detail;\n if (verbose) showSpinner(`Importing ${serviceId}...`);\n failSpinner(`${detail ? message + ' - ' + detail : message}`);\n }\n } else {\n showSpinner(`Importing service...`);\n failSpinner(`No service found in ${file}!`);\n }\n debugMessage(\n `cli.ServiceOps.importFirstServiceFromFile: end [file=${file}]`\n );\n });\n}\n\n/**\n * Import services from file\n * @param {String} file file name\n * @param {boolean} clean remove existing service\n */\nexport async function importServicesFromFile(file: string, clean: boolean) {\n debugMessage(`cli.ServiceOps.importServiceFromFile: start [file=${file}]`);\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n debugMessage(`cli.ServiceOps.importServiceFromFile: importing ${file}`);\n const importData = JSON.parse(data) as ServiceExportInterface;\n try {\n await importServices(importData, clean);\n } catch (error) {\n printMessage(`${error.message}`, 'error');\n printMessage(error.response.status, 'error');\n }\n debugMessage(`cli.ServiceOps.importServiceFromFile: end [file=${file}]`);\n });\n}\n\n/**\n * Import all services from separate files\n * @param {boolean} clean remove existing service\n */\nexport async function importServicesFromFiles(clean: boolean) {\n debugMessage(`cli.ServiceOps.importServicesFromFiles: start`);\n const names = fs.readdirSync(getWorkingDirectory());\n const agentFiles = names.filter((name) =>\n name.toLowerCase().endsWith('.service.json')\n );\n for (const file of agentFiles) {\n await importServicesFromFile(file, clean);\n }\n debugMessage(`cli.ServiceOps.importServicesFromFiles: end`);\n}\n\n/**\n * Delete a service by id/name\n * @param {string} serviceId Reference to the service to delete\n */\nexport async function deleteService(serviceId: string) {\n try {\n await deleteFullService(serviceId);\n } catch (error) {\n const message = error.response?.data?.message;\n printMessage(`Delete service '${serviceId}': ${message}`, 'error');\n }\n}\n\n/**\n * Delete all services\n */\nexport async function deleteServices() {\n await deleteFullServices();\n}\n"],"mappings":"AAAA,OAAOA,EAAE,MAAM,IAAI;AACnB,SACEC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,cAAc,EACdC,WAAW,QACN,kBAAkB;AACzB,SACEC,iBAAiB,EACjBC,OAAO,EACPC,KAAK,EACLC,KAAK,QACA,uBAAuB;AAG9B,MAAM;EACJC,2BAA2B;EAC3BC,kBAAkB;EAClBC,iBAAiB;EACjBC,iBAAiB;EACjBC,eAAe;EACfC,cAAc;EACdC,aAAa;EACbC,cAAc;EACdC;AACF,CAAC,GAAGX,OAAO;AACX,MAAM;EAAEY,gBAAgB;EAAEC,mBAAmB;EAA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ML,sBAAsB,CAAC5B,IAAI,EAAEW,KAAK,CAAC;EAC3C;EACAjD,YAAY,CAAE,6CAA4C,CAAC;AAC7D;;AAEA;AACA;AACA;AACA;AACA,OAAO,eAAe2E,aAAa,CAAC9B,SAAiB,EAAE;EACrD,IAAI;IACF,MAAMnC,iBAAiB,CAACmC,SAAS,CAAC;EACpC,CAAC,CAAC,OAAOV,KAAK,EAAE;IAAA;IACd,MAAMwB,OAAO,sBAAGxB,KAAK,CAACyB,QAAQ,4EAAd,gBAAgBN,IAAI,yDAApB,qBAAsBK,OAAO;IAC7C7D,YAAY,CAAE,mBAAkB+C,SAAU,MAAKc,OAAQ,EAAC,EAAE,OAAO,CAAC;EACpE;AACF;;AAEA;AACA;AACA;AACA,OAAO,eAAeiB,cAAc,GAAG;EACrC,MAAMnE,kBAAkB,EAAE;AAC5B"}
@@ -1,3 +1,22 @@
1
+ import fs from 'fs';
2
+ import { Theme, ExportImportUtils } from '@rockcarver/frodo-lib';
3
+ import { printMessage, createTable, createProgressIndicator, updateProgressIndicator, stopProgressIndicator } from '../utils/Console';
4
+ import { saveToFile, getTypedFilename } from '../utils/ExportImportUtils';
5
+ const {
6
+ getTheme,
7
+ getThemes,
8
+ getThemeByName,
9
+ putThemeByName,
10
+ putTheme,
11
+ putThemes,
12
+ deleteTheme,
13
+ deleteThemeByName,
14
+ deleteThemes
15
+ } = Theme;
16
+ const {
17
+ getRealmString,
18
+ validateImport
19
+ } = ExportImportUtils;
1
20
  /**
2
21
  * Get a one-line description of the theme
3
22
  * @param {ThemeSkeleton} themeObj theme object to describe
@@ -7,25 +26,335 @@ export function getOneLineDescription(themeObj) {
7
26
  const description = `[${themeObj._id['brightCyan']}] ${themeObj.name}${themeObj.linkedTrees ? ' (' + themeObj.linkedTrees.join(', ')['brightCyan'] + ')' : ''}`;
8
27
  return description;
9
28
  }
29
+
10
30
  /**
11
31
  * Get markdown table header
12
32
  * @returns {string} markdown table header
13
33
  */
14
-
15
34
  export function getTableHeaderMd() {
16
35
  let markdown = '';
17
36
  markdown += '| Name | Linked Journey(s) | Id |\n';
18
37
  markdown += '| ---- | ----------------- | ---|';
19
38
  return markdown;
20
39
  }
40
+
21
41
  /**
22
42
  * Get a table-row of the theme in markdown
23
43
  * @param {ThemeSkeleton} themeObj theme object to describe
24
44
  * @returns {string} a table-row of the theme in markdown
25
45
  */
26
-
27
46
  export function getTableRowMd(themeObj) {
28
47
  const row = `| ${themeObj.name} | ${themeObj.linkedTrees ? themeObj.linkedTrees.join(', ') : ''} | \`${themeObj._id}\` |`;
29
48
  return row;
30
49
  }
50
+
51
+ /**
52
+ * List all the themes
53
+ * @param {boolean} long Long version, more fields
54
+ */
55
+ export async function listThemes(long = false) {
56
+ const themeList = await getThemes();
57
+ themeList.sort((a, b) => a.name.localeCompare(b.name));
58
+ if (!long) {
59
+ themeList.forEach(theme => {
60
+ printMessage(`${theme.isDefault ? theme.name['brightCyan'] : theme.name}`, 'data');
61
+ });
62
+ } else {
63
+ const table = createTable(['Name'['brightCyan'], 'Id'['brightCyan'], 'Default'['brightCyan']]);
64
+ themeList.forEach(theme => {
65
+ table.push([`${theme.name}`, `${theme._id}`, `${theme.isDefault ? 'Yes'['brightGreen'] : ''}`]);
66
+ });
67
+ printMessage(table.toString(), 'data');
68
+ }
69
+ }
70
+
71
+ /**
72
+ * Export theme by name to file
73
+ * @param {String} name theme name
74
+ * @param {String} file optional export file name
75
+ */
76
+ export async function exportThemeByName(name, file) {
77
+ let fileName = getTypedFilename(name, 'theme');
78
+ if (file) {
79
+ fileName = file;
80
+ }
81
+ createProgressIndicator('determinate', 1, `Exporting ${name}`);
82
+ try {
83
+ const themeData = await getThemeByName(name);
84
+ updateProgressIndicator(`Writing file ${fileName}`);
85
+ saveToFile('theme', [themeData], '_id', fileName);
86
+ stopProgressIndicator(`Successfully exported theme ${name}.`);
87
+ } catch (error) {
88
+ stopProgressIndicator(`${error.message}`);
89
+ printMessage(`${error.message}`, 'error');
90
+ }
91
+ }
92
+
93
+ /**
94
+ * Export theme by uuid to file
95
+ * @param {String} id theme uuid
96
+ * @param {String} file optional export file name
97
+ */
98
+ export async function exportThemeById(id, file) {
99
+ let fileName = getTypedFilename(id, 'theme');
100
+ if (file) {
101
+ fileName = file;
102
+ }
103
+ createProgressIndicator('determinate', 1, `Exporting ${id}`);
104
+ try {
105
+ const themeData = await getTheme(id);
106
+ updateProgressIndicator(`Writing file ${fileName}`);
107
+ saveToFile('theme', [themeData], '_id', fileName);
108
+ stopProgressIndicator(`Successfully exported theme ${id}.`);
109
+ } catch (error) {
110
+ stopProgressIndicator(`${error.message}`);
111
+ printMessage(`${error.message}`, 'error');
112
+ }
113
+ }
114
+
115
+ /**
116
+ * Export all themes to file
117
+ * @param {String} file optional export file name
118
+ */
119
+ export async function exportThemesToFile(file) {
120
+ let fileName = getTypedFilename(`all${getRealmString()}Themes`, 'theme');
121
+ if (file) {
122
+ fileName = file;
123
+ }
124
+ const allThemesData = await getThemes();
125
+ createProgressIndicator('determinate', allThemesData.length, 'Exporting themes');
126
+ for (const themeData of allThemesData) {
127
+ updateProgressIndicator(`Exporting theme ${themeData.name}`);
128
+ }
129
+ saveToFile('theme', allThemesData, '_id', fileName);
130
+ stopProgressIndicator(`${allThemesData.length} themes exported to ${fileName}.`);
131
+ }
132
+
133
+ /**
134
+ * Export all themes to separate files
135
+ */
136
+ export async function exportThemesToFiles() {
137
+ const allThemesData = await getThemes();
138
+ createProgressIndicator('determinate', allThemesData.length, 'Exporting themes');
139
+ for (const themeData of allThemesData) {
140
+ updateProgressIndicator(`Writing theme ${themeData.name}`);
141
+ const fileName = getTypedFilename(themeData.name, 'theme');
142
+ saveToFile('theme', themeData, '_id', fileName);
143
+ }
144
+ stopProgressIndicator(`${allThemesData.length} themes exported.`);
145
+ }
146
+
147
+ /**
148
+ * Import theme by name from file
149
+ * @param {String} name theme name
150
+ * @param {String} file import file name
151
+ */
152
+ export async function importThemeByName(name, file) {
153
+ fs.readFile(file, 'utf8', async (err, data) => {
154
+ if (err) throw err;
155
+ const themeData = JSON.parse(data);
156
+ if (validateImport(themeData.meta)) {
157
+ createProgressIndicator('determinate', 1, 'Importing theme...');
158
+ let found = false;
159
+ for (const id in themeData.theme) {
160
+ if ({}.hasOwnProperty.call(themeData.theme, id)) {
161
+ if (themeData.theme[id].name === name) {
162
+ found = true;
163
+ updateProgressIndicator(`Importing ${themeData.theme[id].name}`);
164
+ try {
165
+ await putThemeByName(name, themeData.theme[id]);
166
+ stopProgressIndicator(`Successfully imported theme ${name}.`);
167
+ } catch (error) {
168
+ stopProgressIndicator(`Error importing theme ${themeData.theme[id].name}: ${error.message}`);
169
+ printMessage(`Error importing theme ${themeData.theme[id].name}: ${error.message}`, 'error');
170
+ }
171
+ break;
172
+ }
173
+ }
174
+ }
175
+ if (!found) {
176
+ stopProgressIndicator(`Theme ${name} not found!`);
177
+ }
178
+ } else {
179
+ printMessage('Import validation failed...', 'error');
180
+ }
181
+ });
182
+ }
183
+
184
+ /**
185
+ * Import theme by uuid from file
186
+ * @param {String} id theme uuid
187
+ * @param {String} file import file name
188
+ */
189
+ export async function importThemeById(id, file) {
190
+ fs.readFile(file, 'utf8', async (err, data) => {
191
+ if (err) throw err;
192
+ const themeData = JSON.parse(data);
193
+ if (validateImport(themeData.meta)) {
194
+ createProgressIndicator('determinate', 1, 'Importing theme...');
195
+ let found = false;
196
+ for (const themeId in themeData.theme) {
197
+ if ({}.hasOwnProperty.call(themeData.theme, themeId)) {
198
+ if (themeId === id) {
199
+ found = true;
200
+ updateProgressIndicator(`Importing ${themeData.theme[themeId]._id}`);
201
+ try {
202
+ await putTheme(themeId, themeData.theme[themeId]);
203
+ stopProgressIndicator(`Successfully imported theme ${id}.`);
204
+ } catch (error) {
205
+ stopProgressIndicator(`Error importing theme ${themeData.theme[themeId]._id}: ${error.message}`);
206
+ printMessage(`Error importing theme ${themeData.theme[themeId]._id}: ${error.message}`, 'error');
207
+ }
208
+ break;
209
+ }
210
+ }
211
+ }
212
+ if (!found) {
213
+ stopProgressIndicator(`Theme ${id} not found!`);
214
+ }
215
+ } else {
216
+ printMessage('Import validation failed...', 'error');
217
+ }
218
+ });
219
+ }
220
+
221
+ /**
222
+ * Import all themes from single file
223
+ * @param {String} file import file name
224
+ */
225
+ export async function importThemesFromFile(file) {
226
+ fs.readFile(file, 'utf8', (err, data) => {
227
+ if (err) throw err;
228
+ const fileData = JSON.parse(data);
229
+ if (validateImport(fileData.meta)) {
230
+ createProgressIndicator('determinate', Object.keys(fileData.theme).length, 'Importing themes...');
231
+ for (const id in fileData.theme) {
232
+ if ({}.hasOwnProperty.call(fileData.theme, id)) {
233
+ updateProgressIndicator(`Importing ${fileData.theme[id].name}`);
234
+ }
235
+ }
236
+ putThemes(fileData.theme).then(result => {
237
+ if (result == null) {
238
+ stopProgressIndicator(`Error importing ${Object.keys(fileData.theme).length} themes!`);
239
+ printMessage(`Error importing ${Object.keys(fileData.theme).length} themes from ${file}`, 'error');
240
+ } else {
241
+ stopProgressIndicator(`Successfully imported ${Object.keys(fileData.theme).length} themes.`);
242
+ }
243
+ });
244
+ } else {
245
+ printMessage('Import validation failed...', 'error');
246
+ }
247
+ });
248
+ }
249
+
250
+ /**
251
+ * Import themes from separate files
252
+ */
253
+ export async function importThemesFromFiles() {
254
+ const names = fs.readdirSync('.');
255
+ const jsonFiles = names.filter(name => name.toLowerCase().endsWith('.theme.json'));
256
+ createProgressIndicator('determinate', jsonFiles.length, 'Importing themes...');
257
+ let fileData = null;
258
+ let count = 0;
259
+ let total = 0;
260
+ let files = 0;
261
+ for (const file of jsonFiles) {
262
+ const data = fs.readFileSync(file, 'utf8');
263
+ fileData = JSON.parse(data);
264
+ if (validateImport(fileData.meta)) {
265
+ count = Object.keys(fileData.theme).length;
266
+ // eslint-disable-next-line no-await-in-loop
267
+ const result = await putThemes(fileData.theme);
268
+ if (result == null) {
269
+ printMessage(`Error importing ${count} themes from ${file}`, 'error');
270
+ } else {
271
+ files += 1;
272
+ total += count;
273
+ updateProgressIndicator(`Imported ${count} theme(s) from ${file}`);
274
+ }
275
+ } else {
276
+ printMessage(`Validation of ${file} failed!`, 'error');
277
+ }
278
+ }
279
+ stopProgressIndicator(`Finished importing ${total} theme(s) from ${files} file(s).`);
280
+ }
281
+
282
+ /**
283
+ * Import first theme from file
284
+ * @param {String} file import file name
285
+ */
286
+ export async function importFirstThemeFromFile(file) {
287
+ fs.readFile(file, 'utf8', (err, data) => {
288
+ if (err) throw err;
289
+ const themeData = JSON.parse(data);
290
+ if (validateImport(themeData.meta)) {
291
+ createProgressIndicator('determinate', 1, 'Importing theme...');
292
+ for (const id in themeData.theme) {
293
+ if ({}.hasOwnProperty.call(themeData.theme, id)) {
294
+ updateProgressIndicator(`Importing ${themeData.theme[id].name}`);
295
+ putTheme(id, themeData.theme[id]).then(result => {
296
+ if (result == null) {
297
+ stopProgressIndicator(`Error importing theme ${themeData.theme[id].name}`);
298
+ printMessage(`Error importing theme ${themeData.theme[id].name}`, 'error');
299
+ } else {
300
+ stopProgressIndicator(`Successfully imported theme ${themeData.theme[id].name}`);
301
+ }
302
+ });
303
+ break;
304
+ }
305
+ }
306
+ } else {
307
+ printMessage('Import validation failed...', 'error');
308
+ }
309
+ });
310
+ }
311
+
312
+ /**
313
+ * Delete theme by id
314
+ * @param {String} id theme id
315
+ */
316
+ export async function deleteThemeCmd(id) {
317
+ createProgressIndicator('indeterminate', undefined, `Deleting ${id}...`);
318
+ try {
319
+ await deleteTheme(id);
320
+ stopProgressIndicator(`Deleted ${id}.`, 'success');
321
+ } catch (error) {
322
+ stopProgressIndicator(`Error: ${error.message}`, 'fail');
323
+ }
324
+ }
325
+
326
+ /**
327
+ * Delete theme by name
328
+ * @param {String} name theme name
329
+ */
330
+ export async function deleteThemeByNameCmd(name) {
331
+ createProgressIndicator('indeterminate', undefined, `Deleting ${name}...`);
332
+ try {
333
+ await deleteThemeByName(name);
334
+ stopProgressIndicator(`Deleted ${name}.`, 'success');
335
+ } catch (error) {
336
+ stopProgressIndicator(`Error: ${error.message}`, 'fail');
337
+ }
338
+ }
339
+
340
+ /**
341
+ * Delete all themes
342
+ */
343
+ export async function deleteAllThemes() {
344
+ createProgressIndicator('indeterminate', undefined, `Deleting all realm themes...`);
345
+ try {
346
+ await deleteThemes();
347
+ stopProgressIndicator(`Deleted all realm themes.`, 'success');
348
+ } catch (error) {
349
+ stopProgressIndicator(`Error: ${error.message}`, 'fail');
350
+ }
351
+ }
352
+
353
+ /**
354
+ * Delete all themes
355
+ * @deprecated since version 0.14.0
356
+ */
357
+ export async function deleteThemesCmd() {
358
+ return deleteAllThemes();
359
+ }
31
360
  //# sourceMappingURL=ThemeOps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeOps.js","names":["getOneLineDescription","themeObj","description","_id","name","linkedTrees","join","getTableHeaderMd","markdown","getTableRowMd","row"],"sources":["ops/ThemeOps.ts"],"sourcesContent":["import { ThemeSkeleton } from '@rockcarver/frodo-lib/types/api/ApiTypes';\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"],"mappings":"AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,qBAAT,CAA+BC,QAA/B,EAAgE;EACrE,MAAMC,WAAW,GAAI,IAAGD,QAAQ,CAACE,GAAT,CAAa,YAAb,CAA2B,KAAIF,QAAQ,CAACG,IAAK,GACnEH,QAAQ,CAACI,WAAT,GACI,OAAOJ,QAAQ,CAACI,WAAT,CAAqBC,IAArB,CAA0B,IAA1B,EAAgC,YAAhC,CAAP,GAAuD,GAD3D,GAEI,EACL,EAJD;EAKA,OAAOJ,WAAP;AACD;AAED;AACA;AACA;AACA;;AACA,OAAO,SAASK,gBAAT,GAAoC;EACzC,IAAIC,QAAQ,GAAG,EAAf;EACAA,QAAQ,IAAI,qCAAZ;EACAA,QAAQ,IAAI,mCAAZ;EACA,OAAOA,QAAP;AACD;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,aAAT,CAAuBR,QAAvB,EAAwD;EAC7D,MAAMS,GAAG,GAAI,KAAIT,QAAQ,CAACG,IAAK,MAC7BH,QAAQ,CAACI,WAAT,GAAuBJ,QAAQ,CAACI,WAAT,CAAqBC,IAArB,CAA0B,IAA1B,CAAvB,GAAyD,EAC1D,QAAOL,QAAQ,CAACE,GAAI,MAFrB;EAGA,OAAOO,GAAP;AACD"}
1
+ {"version":3,"file":"ThemeOps.js","names":["fs","Theme","ExportImportUtils","printMessage","createTable","createProgressIndicator","updateProgressIndicator","stopProgressIndicator","saveToFile","getTypedFilename","getTheme","getThemes","getThemeByName","putThemeByName","putTheme","putThemes","deleteTheme","deleteThemeByName","deleteThemes","getRealmString","validateImport","getOneLineDescription","themeObj","description","_id","name","linkedTrees","join","getTableHeaderMd","markdown","getTableRowMd","row","listThemes","long","themeList","sort","a","b","localeCompare","forEach","theme","isDefault","table","push","toString","exportThemeByName","file","fileName","themeData","error","message","exportThemeById","id","exportThemesToFile","allThemesData","length","exportThemesToFiles","importThemeByName","readFile","err","data","JSON","parse","meta","found","hasOwnProperty","call","importThemeById","themeId","importThemesFromFile","fileData","Object","keys","then","result","importThemesFromFiles","names","readdirSync","jsonFiles","filter","toLowerCase","endsWith","count","total","files","readFileSync","importFirstThemeFromFile","deleteThemeCmd","undefined","deleteThemeByNameCmd","deleteAllThemes","deleteThemesCmd"],"sources":["ops/ThemeOps.ts"],"sourcesContent":["import fs from 'fs';\nimport { Theme, ExportImportUtils } from '@rockcarver/frodo-lib';\nimport { 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\nconst {\n getTheme,\n getThemes,\n getThemeByName,\n putThemeByName,\n putTheme,\n putThemes,\n deleteTheme,\n deleteThemeByName,\n deleteThemes,\n} = Theme;\nconst { getRealmString, validateImport } = 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 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 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 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(`all${getRealmString()}Themes`, 'theme');\n if (file) {\n fileName = file;\n }\n const allThemesData = await 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 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 (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 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 (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 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 (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 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 (validateImport(fileData.meta)) {\n count = Object.keys(fileData.theme).length;\n // eslint-disable-next-line no-await-in-loop\n const result = await 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 (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 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 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 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 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,OAAOA,EAAE,MAAM,IAAI;AACnB,SAASC,KAAK,EAAEC,iBAAiB,QAAQ,uBAAuB;AAEhE,SACEC,YAAY,EACZC,WAAW,EACXC,uBAAuB,EACvBC,uBAAuB,EACvBC,qBAAqB,QAChB,kBAAkB;AACzB,SAASC,UAAU,EAAEC,gBAAgB,QAAQ,4BAA4B;AAEzE,MAAM;EACJC,QAAQ;EACRC,SAAS;EACTC,cAAc;EACdC,cAAc;EACdC,QAAQ;EACRC,SAAS;EACTC,WAAW;EACXC,iBAAiB;EACjBC;AACF,CAAC,GAAGjB,KAAK;AACT,MAAM;EAAEkB,cAAc;EAAEC;AAAe,CAAC,GAAGlB,iBAAiB;AAC5D;AACA;AACA;AACA;AACA;AACA,OAAO,SAASmB,qBAAqB,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,gBAAgB,GAAW;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,SAASC,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