@memberjunction/cli 6.3.0-edge.0 → 6.3.0-edge.2

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 (251) hide show
  1. package/README.md +1047 -359
  2. package/dist/baseline/connection.d.ts.map +1 -1
  3. package/dist/baseline/connection.js +12 -1
  4. package/dist/baseline/connection.js.map +1 -1
  5. package/dist/commands/agent/usage.d.ts +7 -0
  6. package/dist/commands/agent/usage.d.ts.map +1 -0
  7. package/dist/commands/agent/usage.js +10 -0
  8. package/dist/commands/agent/usage.js.map +1 -0
  9. package/dist/commands/app/check-updates.d.ts +2 -2
  10. package/dist/commands/app/check-updates.d.ts.map +1 -1
  11. package/dist/commands/app/check-updates.js +8 -7
  12. package/dist/commands/app/check-updates.js.map +1 -1
  13. package/dist/commands/app/install.d.ts +2 -2
  14. package/dist/commands/app/install.d.ts.map +1 -1
  15. package/dist/commands/app/install.js +29 -18
  16. package/dist/commands/app/install.js.map +1 -1
  17. package/dist/commands/app/remove.d.ts.map +1 -1
  18. package/dist/commands/app/remove.js +3 -1
  19. package/dist/commands/app/remove.js.map +1 -1
  20. package/dist/commands/app/upgrade.d.ts +1 -0
  21. package/dist/commands/app/upgrade.d.ts.map +1 -1
  22. package/dist/commands/app/upgrade.js +6 -0
  23. package/dist/commands/app/upgrade.js.map +1 -1
  24. package/dist/commands/codegen/index.d.ts +1 -0
  25. package/dist/commands/codegen/index.d.ts.map +1 -1
  26. package/dist/commands/codegen/manifest.d.ts +40 -0
  27. package/dist/commands/codegen/manifest.d.ts.map +1 -1
  28. package/dist/commands/codegen/manifest.js +124 -3
  29. package/dist/commands/codegen/manifest.js.map +1 -1
  30. package/dist/commands/diag/usage.d.ts +7 -0
  31. package/dist/commands/diag/usage.d.ts.map +1 -0
  32. package/dist/commands/diag/usage.js +10 -0
  33. package/dist/commands/diag/usage.js.map +1 -0
  34. package/dist/commands/doctor/index.d.ts +6 -0
  35. package/dist/commands/doctor/index.d.ts.map +1 -1
  36. package/dist/commands/doctor/index.js +42 -0
  37. package/dist/commands/doctor/index.js.map +1 -1
  38. package/dist/commands/explorer/postbuild.d.ts +14 -0
  39. package/dist/commands/explorer/postbuild.d.ts.map +1 -0
  40. package/dist/commands/explorer/postbuild.js +49 -0
  41. package/dist/commands/explorer/postbuild.js.map +1 -0
  42. package/dist/commands/explorer/usage.d.ts +7 -0
  43. package/dist/commands/explorer/usage.d.ts.map +1 -0
  44. package/dist/commands/explorer/usage.js +10 -0
  45. package/dist/commands/explorer/usage.js.map +1 -0
  46. package/dist/commands/harness/account/add.d.ts +22 -0
  47. package/dist/commands/harness/account/add.d.ts.map +1 -0
  48. package/dist/commands/harness/account/add.js +100 -0
  49. package/dist/commands/harness/account/add.js.map +1 -0
  50. package/dist/commands/harness/account/clear-cooldown.d.ts +13 -0
  51. package/dist/commands/harness/account/clear-cooldown.d.ts.map +1 -0
  52. package/dist/commands/harness/account/clear-cooldown.js +32 -0
  53. package/dist/commands/harness/account/clear-cooldown.js.map +1 -0
  54. package/dist/commands/harness/account/disable.d.ts +13 -0
  55. package/dist/commands/harness/account/disable.d.ts.map +1 -0
  56. package/dist/commands/harness/account/disable.js +34 -0
  57. package/dist/commands/harness/account/disable.js.map +1 -0
  58. package/dist/commands/harness/account/enable.d.ts +13 -0
  59. package/dist/commands/harness/account/enable.d.ts.map +1 -0
  60. package/dist/commands/harness/account/enable.js +34 -0
  61. package/dist/commands/harness/account/enable.js.map +1 -0
  62. package/dist/commands/harness/account/index.d.ts +7 -0
  63. package/dist/commands/harness/account/index.d.ts.map +1 -0
  64. package/dist/commands/harness/account/index.js +23 -0
  65. package/dist/commands/harness/account/index.js.map +1 -0
  66. package/dist/commands/harness/account/list.d.ts +15 -0
  67. package/dist/commands/harness/account/list.d.ts.map +1 -0
  68. package/dist/commands/harness/account/list.js +58 -0
  69. package/dist/commands/harness/account/list.js.map +1 -0
  70. package/dist/commands/harness/account/login.d.ts +16 -0
  71. package/dist/commands/harness/account/login.d.ts.map +1 -0
  72. package/dist/commands/harness/account/login.js +50 -0
  73. package/dist/commands/harness/account/login.js.map +1 -0
  74. package/dist/commands/harness/account/remove.d.ts +14 -0
  75. package/dist/commands/harness/account/remove.d.ts.map +1 -0
  76. package/dist/commands/harness/account/remove.js +43 -0
  77. package/dist/commands/harness/account/remove.js.map +1 -0
  78. package/dist/commands/harness/account/set-strategy.d.ts +13 -0
  79. package/dist/commands/harness/account/set-strategy.d.ts.map +1 -0
  80. package/dist/commands/harness/account/set-strategy.js +38 -0
  81. package/dist/commands/harness/account/set-strategy.js.map +1 -0
  82. package/dist/commands/harness/index.d.ts +7 -0
  83. package/dist/commands/harness/index.d.ts.map +1 -0
  84. package/dist/commands/harness/index.js +22 -0
  85. package/dist/commands/harness/index.js.map +1 -0
  86. package/dist/commands/harness/usage.d.ts +7 -0
  87. package/dist/commands/harness/usage.d.ts.map +1 -0
  88. package/dist/commands/harness/usage.js +10 -0
  89. package/dist/commands/harness/usage.js.map +1 -0
  90. package/dist/commands/migrate/convert.d.ts +25 -1
  91. package/dist/commands/migrate/convert.d.ts.map +1 -1
  92. package/dist/commands/migrate/convert.js +160 -46
  93. package/dist/commands/migrate/convert.js.map +1 -1
  94. package/dist/commands/migrate/index.d.ts +8 -0
  95. package/dist/commands/migrate/index.d.ts.map +1 -1
  96. package/dist/commands/migrate/index.js +41 -2
  97. package/dist/commands/migrate/index.js.map +1 -1
  98. package/dist/commands/migrate/rebake.d.ts +13 -0
  99. package/dist/commands/migrate/rebake.d.ts.map +1 -1
  100. package/dist/commands/migrate/rebake.js +48 -14
  101. package/dist/commands/migrate/rebake.js.map +1 -1
  102. package/dist/commands/queue/export-topology.d.ts +2 -0
  103. package/dist/commands/queue/export-topology.d.ts.map +1 -1
  104. package/dist/commands/queue/export-topology.js +3 -1
  105. package/dist/commands/queue/export-topology.js.map +1 -1
  106. package/dist/commands/queue/import-bindings.d.ts +2 -0
  107. package/dist/commands/queue/import-bindings.d.ts.map +1 -1
  108. package/dist/commands/queue/import-bindings.js +3 -1
  109. package/dist/commands/queue/import-bindings.js.map +1 -1
  110. package/dist/commands/queue/index.d.ts.map +1 -1
  111. package/dist/commands/queue/index.js +1 -0
  112. package/dist/commands/queue/index.js.map +1 -1
  113. package/dist/commands/queue/sweep.d.ts +11 -0
  114. package/dist/commands/queue/sweep.d.ts.map +1 -0
  115. package/dist/commands/queue/sweep.js +36 -0
  116. package/dist/commands/queue/sweep.js.map +1 -0
  117. package/dist/commands/queue/validate-bindings.d.ts +2 -0
  118. package/dist/commands/queue/validate-bindings.d.ts.map +1 -1
  119. package/dist/commands/queue/validate-bindings.js +3 -1
  120. package/dist/commands/queue/validate-bindings.js.map +1 -1
  121. package/dist/commands/queue/work.d.ts +4 -0
  122. package/dist/commands/queue/work.d.ts.map +1 -1
  123. package/dist/commands/queue/work.js +9 -9
  124. package/dist/commands/queue/work.js.map +1 -1
  125. package/dist/commands/rubric/usage.d.ts +7 -0
  126. package/dist/commands/rubric/usage.d.ts.map +1 -0
  127. package/dist/commands/rubric/usage.js +10 -0
  128. package/dist/commands/rubric/usage.js.map +1 -0
  129. package/dist/commands/test/regression/index.d.ts.map +1 -1
  130. package/dist/commands/test/regression/index.js +2 -0
  131. package/dist/commands/test/regression/index.js.map +1 -1
  132. package/dist/commands/test/regression/new.d.ts +21 -0
  133. package/dist/commands/test/regression/new.d.ts.map +1 -0
  134. package/dist/commands/test/regression/new.js +82 -0
  135. package/dist/commands/test/regression/new.js.map +1 -0
  136. package/dist/commands/test/regression/up.d.ts +1 -0
  137. package/dist/commands/test/regression/up.d.ts.map +1 -1
  138. package/dist/commands/test/regression/up.js +17 -0
  139. package/dist/commands/test/regression/up.js.map +1 -1
  140. package/dist/commands/test/scripts.d.ts +6 -4
  141. package/dist/commands/test/scripts.d.ts.map +1 -1
  142. package/dist/commands/test/scripts.js +14 -0
  143. package/dist/commands/test/scripts.js.map +1 -1
  144. package/dist/commands/test/suite.d.ts +1 -0
  145. package/dist/commands/test/suite.d.ts.map +1 -1
  146. package/dist/commands/test/suite.js +6 -0
  147. package/dist/commands/test/suite.js.map +1 -1
  148. package/dist/commands/usage.js +2 -1
  149. package/dist/commands/usage.js.map +1 -1
  150. package/dist/commands/user/usage.d.ts +7 -0
  151. package/dist/commands/user/usage.d.ts.map +1 -0
  152. package/dist/commands/user/usage.js +10 -0
  153. package/dist/commands/user/usage.js.map +1 -0
  154. package/dist/config.d.ts +119 -0
  155. package/dist/config.d.ts.map +1 -1
  156. package/dist/config.js +43 -1
  157. package/dist/config.js.map +1 -1
  158. package/dist/init-templates/citizen-builder/.env.example +5 -0
  159. package/dist/init-templates/citizen-builder/docker-compose.yml +9 -0
  160. package/dist/init-templates/citizen-builder/scripts/docker-entrypoint.sh +18 -1
  161. package/dist/lib/db-preflight.d.ts.map +1 -1
  162. package/dist/lib/db-preflight.js +22 -0
  163. package/dist/lib/db-preflight.js.map +1 -1
  164. package/dist/lib/derived-usage.d.ts +8 -0
  165. package/dist/lib/derived-usage.d.ts.map +1 -1
  166. package/dist/lib/derived-usage.js +30 -20
  167. package/dist/lib/derived-usage.js.map +1 -1
  168. package/dist/lib/dev-workspace/prebundle.d.ts +3 -1
  169. package/dist/lib/dev-workspace/prebundle.d.ts.map +1 -1
  170. package/dist/lib/dev-workspace/prebundle.js +4 -3
  171. package/dist/lib/dev-workspace/prebundle.js.map +1 -1
  172. package/dist/lib/domain-profiles.d.ts.map +1 -1
  173. package/dist/lib/domain-profiles.js +24 -0
  174. package/dist/lib/domain-profiles.js.map +1 -1
  175. package/dist/lib/domain-usage-command.js +2 -1
  176. package/dist/lib/domain-usage-command.js.map +1 -1
  177. package/dist/lib/explorer-postbuild/public-page-html.d.ts +48 -0
  178. package/dist/lib/explorer-postbuild/public-page-html.d.ts.map +1 -0
  179. package/dist/lib/explorer-postbuild/public-page-html.js +284 -0
  180. package/dist/lib/explorer-postbuild/public-page-html.js.map +1 -0
  181. package/dist/lib/explorer-postbuild/service-worker-check.d.ts +13 -0
  182. package/dist/lib/explorer-postbuild/service-worker-check.d.ts.map +1 -0
  183. package/dist/lib/explorer-postbuild/service-worker-check.js +41 -0
  184. package/dist/lib/explorer-postbuild/service-worker-check.js.map +1 -0
  185. package/dist/lib/harness-account.d.ts +34 -0
  186. package/dist/lib/harness-account.d.ts.map +1 -0
  187. package/dist/lib/harness-account.js +105 -0
  188. package/dist/lib/harness-account.js.map +1 -0
  189. package/dist/lib/pg-preflight/checks.d.ts +28 -0
  190. package/dist/lib/pg-preflight/checks.d.ts.map +1 -0
  191. package/dist/lib/pg-preflight/checks.js +94 -0
  192. package/dist/lib/pg-preflight/checks.js.map +1 -0
  193. package/dist/lib/pg-preflight/extension-check.d.ts +28 -0
  194. package/dist/lib/pg-preflight/extension-check.d.ts.map +1 -0
  195. package/dist/lib/pg-preflight/extension-check.js +86 -0
  196. package/dist/lib/pg-preflight/extension-check.js.map +1 -0
  197. package/dist/lib/pg-preflight/extension-scan.d.ts +24 -0
  198. package/dist/lib/pg-preflight/extension-scan.d.ts.map +1 -0
  199. package/dist/lib/pg-preflight/extension-scan.js +58 -0
  200. package/dist/lib/pg-preflight/extension-scan.js.map +1 -0
  201. package/dist/lib/pg-preflight/pending-migrations.d.ts +28 -0
  202. package/dist/lib/pg-preflight/pending-migrations.d.ts.map +1 -0
  203. package/dist/lib/pg-preflight/pending-migrations.js +48 -0
  204. package/dist/lib/pg-preflight/pending-migrations.js.map +1 -0
  205. package/dist/lib/pg-preflight/preflight.d.ts +18 -0
  206. package/dist/lib/pg-preflight/preflight.d.ts.map +1 -0
  207. package/dist/lib/pg-preflight/preflight.js +43 -0
  208. package/dist/lib/pg-preflight/preflight.js.map +1 -0
  209. package/dist/lib/pg-preflight/remediation.d.ts +27 -0
  210. package/dist/lib/pg-preflight/remediation.d.ts.map +1 -0
  211. package/dist/lib/pg-preflight/remediation.js +82 -0
  212. package/dist/lib/pg-preflight/remediation.js.map +1 -0
  213. package/dist/lib/pg-preflight/render.d.ts +15 -0
  214. package/dist/lib/pg-preflight/render.d.ts.map +1 -0
  215. package/dist/lib/pg-preflight/render.js +48 -0
  216. package/dist/lib/pg-preflight/render.js.map +1 -0
  217. package/dist/lib/pg-preflight/run-for-config.d.ts +23 -0
  218. package/dist/lib/pg-preflight/run-for-config.d.ts.map +1 -0
  219. package/dist/lib/pg-preflight/run-for-config.js +45 -0
  220. package/dist/lib/pg-preflight/run-for-config.js.map +1 -0
  221. package/dist/lib/pg-preflight/types.d.ts +67 -0
  222. package/dist/lib/pg-preflight/types.d.ts.map +1 -0
  223. package/dist/lib/pg-preflight/types.js +8 -0
  224. package/dist/lib/pg-preflight/types.js.map +1 -0
  225. package/dist/lib/regression/test-scaffold.d.ts +52 -0
  226. package/dist/lib/regression/test-scaffold.d.ts.map +1 -0
  227. package/dist/lib/regression/test-scaffold.js +237 -0
  228. package/dist/lib/regression/test-scaffold.js.map +1 -0
  229. package/dist/lib/work-queue/queue-format.d.ts +4 -0
  230. package/dist/lib/work-queue/queue-format.d.ts.map +1 -1
  231. package/dist/lib/work-queue/queue-format.js +15 -0
  232. package/dist/lib/work-queue/queue-format.js.map +1 -1
  233. package/dist/lib/work-queue/queue-worker.d.ts +16 -1
  234. package/dist/lib/work-queue/queue-worker.d.ts.map +1 -1
  235. package/dist/lib/work-queue/queue-worker.js +18 -0
  236. package/dist/lib/work-queue/queue-worker.js.map +1 -1
  237. package/dist/light-commands.d.ts.map +1 -1
  238. package/dist/light-commands.js +34 -0
  239. package/dist/light-commands.js.map +1 -1
  240. package/dist/tsconfig.tsbuildinfo +1 -0
  241. package/dist/utils/app-source-lookups.d.ts +19 -0
  242. package/dist/utils/app-source-lookups.d.ts.map +1 -0
  243. package/dist/utils/app-source-lookups.js +19 -0
  244. package/dist/utils/app-source-lookups.js.map +1 -0
  245. package/dist/utils/open-app-context.d.ts +1 -0
  246. package/dist/utils/open-app-context.d.ts.map +1 -1
  247. package/dist/utils/open-app-context.js +13 -17
  248. package/dist/utils/open-app-context.js.map +1 -1
  249. package/oclif.manifest.json +974 -31
  250. package/package.json +31 -28
  251. package/regression-compose/docker-compose.bacpac-standalone.yml +4 -0
@@ -1 +1 @@
1
- {"version":3,"file":"domain-profiles.js","sourceRoot":"","sources":["../../src/lib/domain-profiles.ts"],"names":[],"mappings":"AAwBA;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAkB;IACnD,OAAO,EAAE,qDAAqD;IAC9D,OAAO,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,6CAA6C,EAAE;CACpF,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,eAAe,GAA4C;IACtE,OAAO,EAAE;QACP,OAAO,EAAE,uEAAuE;QAChF,OAAO,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,EAAE,IAAI,EAAE,+DAA+D,EAAE;KACvH;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,mFAAmF;QAC5F,OAAO,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,iEAAiE,EAAE;KACxG;IACD,GAAG,EAAE;QACH,OAAO,EAAE,+EAA+E;QACxF,OAAO,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,gDAAgD,EAAE;KACvF;IACD,EAAE,EAAE;QACF,OAAO,EAAE,oEAAoE;QAC7E,OAAO,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,wEAAwE,EAAE;KAC/G;IACD,KAAK,EAAE;QACL,OAAO,EAAE,2HAA2H;QACpI,OAAO,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,EAAE,EAAE,IAAI,EAAE,+EAA+E,EAAE;KAC1I;IACD,GAAG,EAAE;QACH,OAAO,EAAE,iDAAiD;QAC1D,OAAO,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,EAAE,IAAI,EAAE,8CAA8C,EAAE;KACtG;IACD,SAAS,EAAE;QACT,OAAO,EAA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e,CAAC,MAAM,CAAC,IAAI,sBAAsB,CAAC;AAC3D,CAAC;AAED,gDAAgD;AAChD,MAAM,UAAU,gBAAgB,CAAC,MAAc;IAC7C,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAClC,CAAC"}
@@ -2,6 +2,7 @@ import { Command, Flags } from '@oclif/core';
2
2
  import { CLIPluginRegistry, ResolveOutputFormat } from '@memberjunction/cli-core';
3
3
  import { LoadAllCliPlugins } from './cli-plugins.js';
4
4
  import { EmitUsage, RenderDomainDetail } from './usage-render.js';
5
+ import { FromOclifCommands } from './derived-usage.js';
5
6
  /**
6
7
  * Shared base for tier-2 usage commands (`mj <domain> usage`). Concrete
7
8
  * subclasses under `commands/<domain>/usage.ts` set {@link Domain}. Returns every
@@ -18,7 +19,7 @@ export class DomainUsageCommand extends Command {
18
19
  }; }
19
20
  async run() {
20
21
  const { flags } = await this.parse(this.constructor);
21
- await LoadAllCliPlugins(process.cwd(), this.config.commands);
22
+ await LoadAllCliPlugins(process.cwd(), FromOclifCommands(this.config.commands));
22
23
  const detail = CLIPluginRegistry.BuildDomainDetail(this.Domain);
23
24
  const result = CLIPluginRegistry.AsResult(`${this.Domain}:usage`, { domain: detail.domain, commands: detail.commands });
24
25
  const { format } = ResolveOutputFormat({ formatFlag: flags.format });
@@ -1 +1 @@
1
- {"version":3,"file":"domain-usage-command.js","sourceRoot":"","sources":["../../src/lib/domain-usage-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAGlE;;;;;GAKG;AACH,MAAM,OAAgB,kBAAmB,SAAQ,OAAO;aAC/C,UAAK,GAAG;QACb,8EAA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BAAmB,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;;;;GAKG;AACH,MAAM,OAAgB,kBAAmB,SAAQ,OAAO;aAC/C,UAAK,GAAG;QACb,8EAA8E;QAC9E,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC;YACnB,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC;YAC/B,WAAW,EAAE,8EAA8E;SAC5F,CAAC;KACH,CAAC;IAKF,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAwC,CAAC,CAAC;QAClF,MAAM,iBAAiB,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QAChF,MAAM,MAAM,GAAG,iBAAiB,CAAC,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAChE,MAAM,MAAM,GAAG,iBAAiB,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,MAAM,QAAQ,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;QACxH,MAAM,EAAE,MAAM,EAAE,GAAG,mBAAmB,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;QACrE,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC;IAC5E,CAAC"}
@@ -0,0 +1,48 @@
1
+ import { type OpenAppPublicPage, type OpenAppPublicPageEntry } from '../../commands/codegen/manifest.js';
2
+ /** A JSON value, as read from a config file. */
3
+ export type JsonValue = string | number | boolean | null | JsonValue[] | JsonObject;
4
+ /** A JSON object, as read from a config file. */
5
+ export interface JsonObject {
6
+ [key: string]: JsonValue;
7
+ }
8
+ /** One route in an Azure Static Web Apps config file. Other route settings are kept as they are. */
9
+ export interface StaticWebAppRoute {
10
+ route: string;
11
+ rewrite?: string;
12
+ [key: string]: JsonValue | undefined;
13
+ }
14
+ /**
15
+ * Builds a page's HTML from Explorer's built `index.html`:
16
+ * - the page title, and the description and Open Graph tags that link previews read
17
+ * - a robots tag that lets search engines index the page
18
+ * - no map library tags, and a plain link for the main stylesheet
19
+ * - a Content Security Policy that allows only the site's own scripts
20
+ */
21
+ export declare function BuildPublicPageHtml(indexHtml: string, page: OpenAppPublicPage): string;
22
+ /**
23
+ * Builds the HTML for a public page address that has no page file: an unknown slug, or `/p/` alone.
24
+ * It has the same policy as a page file, so the error page that shows there runs under it. Search
25
+ * engines do not index it.
26
+ */
27
+ export declare function BuildPublicFallbackHtml(indexHtml: string): string;
28
+ /**
29
+ * Writes `public-pages/<slug>.html` into the site folder (Explorer's build) for each enabled page,
30
+ * and `public-pages/_fallback.html` for the other public page addresses.
31
+ *
32
+ * @returns the number of page files written
33
+ */
34
+ export declare function WritePublicPageHtmlFiles(siteDir: string, entries: OpenAppPublicPageEntry[]): number;
35
+ /**
36
+ * Returns `routes` with two rewrites for each enabled page (`/p/<slug>` and `/p/<slug>/*`) to the
37
+ * page's HTML file, then one for every other public page address to the fallback file, before the
38
+ * other routes. Page routes from an earlier run are replaced.
39
+ */
40
+ export declare function ApplyPublicPageRoutes(routes: StaticWebAppRoute[], entries: OpenAppPublicPageEntry[]): StaticWebAppRoute[];
41
+ /**
42
+ * Adds the page routes to `staticwebapp.config.json` (Azure Static Web Apps) in the site folder.
43
+ * A site folder without that file is not changed.
44
+ *
45
+ * @returns true when the file was written
46
+ */
47
+ export declare function WriteStaticWebAppRoutes(siteDir: string, entries: OpenAppPublicPageEntry[]): boolean;
48
+ //# sourceMappingURL=public-page-html.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public-page-html.d.ts","sourceRoot":"","sources":["../../../src/lib/explorer-postbuild/public-page-html.ts"],"names":[],"mappings":"AASA,OAAO,EAAkC,KAAK,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAczI,gDAAgD;AAChD,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,EAAE,GAAG,UAAU,CAAC;AAEpF,iDAAiD;AACjD,MAAM,WAAW,UAAU;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B;AAED,oGAAoG;AACpG,MAAM,WAAW,iBAAiB;IAE9B,KAAK,EAAE,MAAM,CAAC;IAEd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;CACxC;AA0ND;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAGtF;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEjE;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAsB,EAAE,GAAG,MAAM,CAYnG;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,iBAAiB,EAAE,EAAE,OAAO,EAAE,sBAAsB,EAAE,GAAG,iBAAiB,EAAE,CAWzH;AAOD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAsB,EAAE,GAAG,OAAO,CAenG"}
@@ -0,0 +1,284 @@
1
+ /**
2
+ * @fileoverview The HTML file of each public page, and the Azure Static Web Apps routes that
3
+ * serve those files. `mj explorer postbuild` runs this on MJ Explorer's build output.
4
+ */
5
+ import { createHash } from 'node:crypto';
6
+ import { mkdirSync, writeFileSync } from 'node:fs';
7
+ import { join } from 'node:path';
8
+ import { defaultTreeAdapter, html as htmlNames, parse, serialize } from 'parse5';
9
+ import { PUBLIC_PAGE_SLUG_PATTERN } from '@memberjunction/open-app-engine';
10
+ import { IsPublicPage, ReadFileIfExists } from '../../commands/codegen/manifest.js';
11
+ /** Folder in the site folder that holds one HTML file per page. */
12
+ const PUBLIC_PAGE_HTML_FOLDER = 'public-pages';
13
+ /** File in the pages folder that answers a public page address with no page file of its own. An underscore cannot be in a slug. */
14
+ const PUBLIC_PAGE_FALLBACK_FILE = '_fallback.html';
15
+ /** Address prefix of public pages. The public host uses the same prefix. */
16
+ const PUBLIC_PAGE_PATH_PREFIX = '/p/';
17
+ /** The Azure Static Web Apps config file in the site folder. */
18
+ const STATIC_WEB_APP_CONFIG_FILE = 'staticwebapp.config.json';
19
+ /**
20
+ * The enabled pages. Error pages are left out: they have no address of their own, so no file and
21
+ * no route. Throws on a slug that does not follow the slug rule, because the slug is a file name
22
+ * and an address.
23
+ */
24
+ function enabledPages(entries) {
25
+ const pages = entries.filter(IsPublicPage).filter((entry) => entry.Enabled !== false);
26
+ const invalid = pages.find((page) => !PUBLIC_PAGE_SLUG_PATTERN.test(page.Slug));
27
+ if (invalid) {
28
+ throw new Error(`Public page slug '${invalid.Slug}' of app '${invalid.AppName}' must be lowercase letters and digits joined by single hyphens.`);
29
+ }
30
+ return pages;
31
+ }
32
+ function isElement(node) {
33
+ return defaultTreeAdapter.isElementNode(node);
34
+ }
35
+ /** All nodes below `parent`, in document order. */
36
+ function nodesIn(parent) {
37
+ return parent.childNodes.flatMap((child) => ('childNodes' in child ? [child, ...nodesIn(child)] : [child]));
38
+ }
39
+ /** The elements below `parent` with one of the tag names, in document order. */
40
+ function elementsIn(parent, ...tagNames) {
41
+ return nodesIn(parent).filter(isElement).filter((element) => tagNames.includes(element.tagName));
42
+ }
43
+ function attribute(element, name) {
44
+ return element.attrs.find((attr) => attr.name === name)?.value;
45
+ }
46
+ function textOf(element) {
47
+ return element.childNodes.map((child) => (defaultTreeAdapter.isTextNode(child) ? child.value : '')).join('');
48
+ }
49
+ function isBlankText(node) {
50
+ return !!node && defaultTreeAdapter.isTextNode(node) && node.value.trim() === '';
51
+ }
52
+ /** Removes a node, and the blank text before it, so no empty line stays. */
53
+ function removeNode(node) {
54
+ const siblings = node.parentNode?.childNodes ?? [];
55
+ const before = siblings[siblings.indexOf(node) - 1];
56
+ if (before && isBlankText(before)) {
57
+ defaultTreeAdapter.detachNode(before);
58
+ }
59
+ defaultTreeAdapter.detachNode(node);
60
+ }
61
+ function createElement(tagName, attrs) {
62
+ return defaultTreeAdapter.createElement(tagName, htmlNames.NS.HTML, Object.entries(attrs).map(([name, value]) => ({ name, value })));
63
+ }
64
+ /** Puts `elements` after `reference`, or first in `parent` when there is no reference. Each goes on its own line. */
65
+ function insertElements(parent, reference, elements) {
66
+ const index = reference ? parent.childNodes.indexOf(reference) + 1 : 0;
67
+ const next = parent.childNodes[index];
68
+ for (const element of elements) {
69
+ const indent = { nodeName: '#text', value: '\n ', parentNode: null };
70
+ for (const node of [indent, element]) {
71
+ if (next) {
72
+ defaultTreeAdapter.insertBefore(parent, node, next);
73
+ }
74
+ else {
75
+ defaultTreeAdapter.appendChild(parent, node);
76
+ }
77
+ }
78
+ }
79
+ }
80
+ /** True for an address of the map library (Leaflet and its cluster plugin) on unpkg.com. */
81
+ function isMapLibraryUrl(address) {
82
+ if (!URL.canParse(address)) {
83
+ return false;
84
+ }
85
+ const url = new URL(address);
86
+ return url.hostname === 'unpkg.com' && url.pathname.startsWith('/leaflet');
87
+ }
88
+ /** True for an inline script that names a map library address. */
89
+ function loadsMapLibrary(script) {
90
+ const addresses = textOf(script).match(/https?:\/\/[^\s'"`]+/g) ?? [];
91
+ return addresses.some(isMapLibraryUrl);
92
+ }
93
+ /**
94
+ * Removes the map library's tags. They load scripts from another site, and a public page does
95
+ * not use them.
96
+ */
97
+ function removeMapLibraryTags(document) {
98
+ for (const element of elementsIn(document, 'link', 'script')) {
99
+ const address = attribute(element, element.tagName === 'link' ? 'href' : 'src');
100
+ const isMapTag = address !== undefined ? isMapLibraryUrl(address) : element.tagName === 'script' && loadsMapLibrary(element);
101
+ if (isMapTag) {
102
+ removeNode(element);
103
+ }
104
+ }
105
+ }
106
+ function isStylesheetLink(node) {
107
+ return isElement(node) && node.tagName === 'link' && attribute(node, 'rel') === 'stylesheet';
108
+ }
109
+ /**
110
+ * Turns a stylesheet link that Angular's build defers with an inline `onload` handler into a
111
+ * plain link, and removes its `<noscript>` copy. The page's policy blocks inline handlers.
112
+ */
113
+ function useStylesheetLinks(document) {
114
+ for (const link of elementsIn(document, 'link')) {
115
+ if (isStylesheetLink(link) && attribute(link, 'media') === 'print' && attribute(link, 'onload') === "this.media='all'") {
116
+ link.attrs = link.attrs.filter((attr) => attr.name !== 'media' && attr.name !== 'onload');
117
+ }
118
+ }
119
+ for (const noscript of elementsIn(document, 'noscript')) {
120
+ const content = noscript.childNodes.filter((child) => !isBlankText(child));
121
+ if (content.length > 0 && content.every(isStylesheetLink)) {
122
+ defaultTreeAdapter.detachNode(noscript);
123
+ }
124
+ }
125
+ }
126
+ /** True for a script that the browser runs from its own text: no `src`, and not a data block. */
127
+ function isInlineScript(script) {
128
+ const type = attribute(script, 'type')?.trim().toLowerCase();
129
+ const runs = !type || type === 'module' || type.endsWith('javascript');
130
+ return runs && attribute(script, 'src') === undefined;
131
+ }
132
+ /**
133
+ * The page's Content Security Policy tag. Scripts run only from the site itself, plus the inline
134
+ * scripts that the page file holds, each named by the SHA-256 hash of its text. A script from
135
+ * another site, or one that an attacker injects, does not run, so it cannot read Explorer's
136
+ * sign-in tokens.
137
+ */
138
+ function policyTag(document) {
139
+ const hashes = elementsIn(document, 'script')
140
+ .filter(isInlineScript)
141
+ .map((script) => `'sha256-${createHash('sha256').update(textOf(script), 'utf-8').digest('base64')}'`);
142
+ const scriptSources = ["'self'", ...hashes].join(' ');
143
+ return createElement('meta', {
144
+ 'http-equiv': 'Content-Security-Policy',
145
+ content: `script-src ${scriptSources}; object-src 'none'; base-uri 'self'`,
146
+ });
147
+ }
148
+ /** The head tags that search results and link previews read. */
149
+ function previewTags(head) {
150
+ const tags = [];
151
+ if (head.Description) {
152
+ tags.push(createElement('meta', { name: 'description', content: head.Description }));
153
+ }
154
+ tags.push(createElement('meta', { property: 'og:type', content: 'website' }));
155
+ if (head.Title) {
156
+ tags.push(createElement('meta', { property: 'og:title', content: head.Title }));
157
+ }
158
+ if (head.Description) {
159
+ tags.push(createElement('meta', { property: 'og:description', content: head.Description }));
160
+ }
161
+ tags.push(createElement('meta', { name: 'twitter:card', content: 'summary' }));
162
+ return tags;
163
+ }
164
+ /** Sets the title, and puts the given tags and the robots tag after it. */
165
+ function setHeadTags(headElement, head, tags) {
166
+ for (const meta of elementsIn(headElement, 'meta')) {
167
+ if (attribute(meta, 'name')?.toLowerCase() === 'robots') {
168
+ removeNode(meta);
169
+ }
170
+ }
171
+ let title = elementsIn(headElement, 'title')[0];
172
+ if (head.Title) {
173
+ if (!title) {
174
+ title = createElement('title', {});
175
+ insertElements(headElement, headElement.childNodes.at(-1), [title]);
176
+ }
177
+ title.childNodes = [];
178
+ defaultTreeAdapter.insertText(title, head.Title);
179
+ }
180
+ const parent = title?.parentNode ?? headElement;
181
+ const reference = title ?? parent.childNodes.at(-1);
182
+ insertElements(parent, reference, [...tags, createElement('meta', { name: 'robots', content: head.Robots })]);
183
+ }
184
+ /**
185
+ * Builds a page file from Explorer's built `index.html`. The file is parsed and written as a
186
+ * browser reads it, so the policy names each inline script by the text that the browser runs.
187
+ */
188
+ function buildHtml(indexHtml, head, tags) {
189
+ const document = parse(indexHtml, { scriptingEnabled: false });
190
+ for (const node of nodesIn(document)) {
191
+ if (defaultTreeAdapter.isCommentNode(node)) {
192
+ removeNode(node);
193
+ }
194
+ }
195
+ removeMapLibraryTags(document);
196
+ useStylesheetLinks(document);
197
+ const headElement = elementsIn(document, 'head')[0];
198
+ setHeadTags(headElement, head, tags);
199
+ const charset = elementsIn(headElement, 'meta').find((meta) => attribute(meta, 'charset') !== undefined);
200
+ insertElements(charset?.parentNode ?? headElement, charset, [policyTag(document)]);
201
+ return serialize(document, { scriptingEnabled: false });
202
+ }
203
+ /**
204
+ * Builds a page's HTML from Explorer's built `index.html`:
205
+ * - the page title, and the description and Open Graph tags that link previews read
206
+ * - a robots tag that lets search engines index the page
207
+ * - no map library tags, and a plain link for the main stylesheet
208
+ * - a Content Security Policy that allows only the site's own scripts
209
+ */
210
+ export function BuildPublicPageHtml(indexHtml, page) {
211
+ const head = { Title: page.Title, Description: page.Description, Robots: 'index, follow' };
212
+ return buildHtml(indexHtml, head, previewTags(head));
213
+ }
214
+ /**
215
+ * Builds the HTML for a public page address that has no page file: an unknown slug, or `/p/` alone.
216
+ * It has the same policy as a page file, so the error page that shows there runs under it. Search
217
+ * engines do not index it.
218
+ */
219
+ export function BuildPublicFallbackHtml(indexHtml) {
220
+ return buildHtml(indexHtml, { Robots: 'noindex' }, []);
221
+ }
222
+ /**
223
+ * Writes `public-pages/<slug>.html` into the site folder (Explorer's build) for each enabled page,
224
+ * and `public-pages/_fallback.html` for the other public page addresses.
225
+ *
226
+ * @returns the number of page files written
227
+ */
228
+ export function WritePublicPageHtmlFiles(siteDir, entries) {
229
+ const indexHtml = ReadFileIfExists(join(siteDir, 'index.html'));
230
+ if (indexHtml === null) {
231
+ throw new Error(`No index.html in ${siteDir}. Build MJ Explorer first.`);
232
+ }
233
+ const pages = enabledPages(entries);
234
+ mkdirSync(join(siteDir, PUBLIC_PAGE_HTML_FOLDER), { recursive: true });
235
+ writeFileSync(join(siteDir, PUBLIC_PAGE_HTML_FOLDER, PUBLIC_PAGE_FALLBACK_FILE), BuildPublicFallbackHtml(indexHtml), 'utf-8');
236
+ for (const page of pages) {
237
+ writeFileSync(join(siteDir, PUBLIC_PAGE_HTML_FOLDER, `${page.Slug}.html`), BuildPublicPageHtml(indexHtml, page), 'utf-8');
238
+ }
239
+ return pages.length;
240
+ }
241
+ /**
242
+ * Returns `routes` with two rewrites for each enabled page (`/p/<slug>` and `/p/<slug>/*`) to the
243
+ * page's HTML file, then one for every other public page address to the fallback file, before the
244
+ * other routes. Page routes from an earlier run are replaced.
245
+ */
246
+ export function ApplyPublicPageRoutes(routes, entries) {
247
+ const pagesUrlPath = `/${PUBLIC_PAGE_HTML_FOLDER}`;
248
+ const isPageRoute = (route) => !!route.rewrite?.startsWith(`${pagesUrlPath}/`);
249
+ const pageRoutes = enabledPages(entries)
250
+ .flatMap((entry) => {
251
+ const rewrite = `${pagesUrlPath}/${entry.Slug}.html`;
252
+ const path = `${PUBLIC_PAGE_PATH_PREFIX}${entry.Slug}`;
253
+ return [{ route: path, rewrite }, { route: `${path}/*`, rewrite }];
254
+ });
255
+ const fallbackRoute = { route: `${PUBLIC_PAGE_PATH_PREFIX}*`, rewrite: `${pagesUrlPath}/${PUBLIC_PAGE_FALLBACK_FILE}` };
256
+ return [...pageRoutes, fallbackRoute, ...routes.filter((route) => !isPageRoute(route))];
257
+ }
258
+ /** True when a JSON value is a route object. */
259
+ function isRoute(value) {
260
+ return typeof value === 'object' && value !== null && !Array.isArray(value) && typeof value['route'] === 'string';
261
+ }
262
+ /**
263
+ * Adds the page routes to `staticwebapp.config.json` (Azure Static Web Apps) in the site folder.
264
+ * A site folder without that file is not changed.
265
+ *
266
+ * @returns true when the file was written
267
+ */
268
+ export function WriteStaticWebAppRoutes(siteDir, entries) {
269
+ const configPath = join(siteDir, STATIC_WEB_APP_CONFIG_FILE);
270
+ const configText = ReadFileIfExists(configPath);
271
+ if (configText === null) {
272
+ return false;
273
+ }
274
+ const config = JSON.parse(configText);
275
+ const current = config['routes'];
276
+ const routes = Array.isArray(current) ? current.filter(isRoute) : [];
277
+ const updated = ApplyPublicPageRoutes(routes, entries);
278
+ if (JSON.stringify(updated) === JSON.stringify(current ?? [])) {
279
+ return false;
280
+ }
281
+ writeFileSync(configPath, `${JSON.stringify({ ...config, routes: updated }, null, 2)}\n`, 'utf-8');
282
+ return true;
283
+ }
284
+ //# sourceMappingURL=public-page-html.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public-page-html.js","sourceRoot":"","sources":["../../../src/lib/explorer-postbuild/public-page-html.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAAE,IAAI,IAAI,SAAS,EAAE,KAAK,EAAE,SAAS,EAAgC,MAAM,QAAQ,CAAC;AAC/G,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAuD,MAAM,oCAAoC,CAAC;AAEzI,mEAAmE;AACnE,MAAM,uBAAuB,GAAG,cAAc,CAAC;AAE/C,mIAAmI;AACnI,MAAM,yBAAyB,GAAG,gBAAgB,CAAC;AAEnD,4EAA4E;AAC5E,MAAM,uBAAuB,GAAG,KAAK,CAAC;AAEtC,gEAAgE;AAChE,MAAM,0BAA0B,GAAG,0BAA0B,CAAC;AA+B9D;;;;GAIG;AACH,SAAS,YAAY,CAAC,OAAiC;IACnD,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,KAAK,KAAK,CAAC,CAAC;IACtF,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,wBAAwB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAChF,IAAI,OAAO,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CAAC,qBAAqB,OAA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,IAAI,CAAC;AAChB,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The path of the check script as installed for the host at `hostDir`, or null when the host does
3
+ * not have it. Looks in the `node_modules` of the host folder and of each folder above it.
4
+ */
5
+ export declare function FindServiceWorkerCheck(hostDir: string): string | null;
6
+ /**
7
+ * Runs the service worker cache check on the site folder.
8
+ *
9
+ * @returns `passed`, or `skipped` when the host does not have the check script
10
+ * @throws when the check fails
11
+ */
12
+ export declare function RunServiceWorkerCheck(siteDir: string, hostDir: string): 'passed' | 'skipped';
13
+ //# sourceMappingURL=service-worker-check.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-worker-check.d.ts","sourceRoot":"","sources":["../../../src/lib/explorer-postbuild/service-worker-check.ts"],"names":[],"mappings":"AAUA;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAUrE;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAU5F"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * @fileoverview Runs the service worker cache check that ships in
3
+ * `@memberjunction/ng-explorer-service-worker` on MJ Explorer's build output.
4
+ */
5
+ import { spawnSync } from 'node:child_process';
6
+ import { existsSync } from 'node:fs';
7
+ import { dirname, join } from 'node:path';
8
+ const SERVICE_WORKER_CHECK_SCRIPT = join('node_modules', '@memberjunction', 'ng-explorer-service-worker', 'scripts', 'verify-sw-cache-shape.js');
9
+ /**
10
+ * The path of the check script as installed for the host at `hostDir`, or null when the host does
11
+ * not have it. Looks in the `node_modules` of the host folder and of each folder above it.
12
+ */
13
+ export function FindServiceWorkerCheck(hostDir) {
14
+ for (let dir = hostDir;; dir = dirname(dir)) {
15
+ const script = join(dir, SERVICE_WORKER_CHECK_SCRIPT);
16
+ if (existsSync(script)) {
17
+ return script;
18
+ }
19
+ if (dirname(dir) === dir) {
20
+ return null;
21
+ }
22
+ }
23
+ }
24
+ /**
25
+ * Runs the service worker cache check on the site folder.
26
+ *
27
+ * @returns `passed`, or `skipped` when the host does not have the check script
28
+ * @throws when the check fails
29
+ */
30
+ export function RunServiceWorkerCheck(siteDir, hostDir) {
31
+ const script = FindServiceWorkerCheck(hostDir);
32
+ if (!script) {
33
+ return 'skipped';
34
+ }
35
+ const result = spawnSync(process.execPath, [script, siteDir], { cwd: hostDir, stdio: 'inherit' });
36
+ if (result.status !== 0) {
37
+ throw new Error(`The service worker cache check failed for ${siteDir}.`);
38
+ }
39
+ return 'passed';
40
+ }
41
+ //# sourceMappingURL=service-worker-check.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-worker-check.js","sourceRoot":"","sources":["../../../src/lib/explorer-postbuild/service-worker-check.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,2BAA2B,GAAG,IAAI,CAAC,cAAc,EAAE,iBAAiB,EAAE,4BAA4B,EAAE,SAAS,EAAE,0BAA0B,CAAC,CAAC;AAEjJ;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,OAAe;IAClD,KAAK,IAAI,GAAG,GAAG,OAAO,GAAI,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QAC3C,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,EAAE,2BAA2B,CAAC,CAAC;QACtD,IAAI,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;YACrB,OAAO,MAAM,CAAC;QAClB,CAAC;QACD,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,GAAG,EAAE,CAAC;YACvB,OAAO,IAAI,CAAC;QAChB,CAAC;IACL,CAAC;AACL,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAAe,EAAE,OAAe;IAClE,MAAM,MAAM,GAAG,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAC/C,IAAI,CAAC,MAAM,EAAE,CAAC;QACV,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IAClG,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,6CAA6C,OAAO,GAAG,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,QAAQ,CAAC;AACpB,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { type HarnessAccountPoolOptions, type HarnessAccountSelectionStrategy, type HarnessAccountSlotStatus, type HarnessPoolVendor, type InteractiveLoginCommandSpec } from '@memberjunction/ai-agent-harness';
2
+ /** Result returned by an {@link InteractiveLoginRunner} invocation. */
3
+ export interface InteractiveLoginResult {
4
+ Status: number | null;
5
+ Error?: Error;
6
+ }
7
+ /** Function signature for spawning interactive CLI logins (injectable for unit tests). */
8
+ export type InteractiveLoginRunner = (spec: InteractiveLoginCommandSpec, env: Record<string, string>) => InteractiveLoginResult;
9
+ /** Default interactive login runner using `spawnSync(..., { stdio: 'inherit' })`. */
10
+ export declare function RunInteractiveCliLogin(spec: InteractiveLoginCommandSpec, env: Record<string, string>): InteractiveLoginResult;
11
+ /**
12
+ * Builds the subprocess environment for an interactive CLI subscription login:
13
+ * inherits host environment, layers the slot's `envOverrides`, and strips provider API keys
14
+ * so the CLI executes its subscription OAuth login flow cleanly.
15
+ */
16
+ export declare function BuildInteractiveLoginEnv(envOverrides: Readonly<Record<string, string>>, baseEnv?: NodeJS.ProcessEnv): Record<string, string>;
17
+ /** Builds {@link HarnessAccountPoolOptions} from an optional `--pool-dir` CLI flag. */
18
+ export declare function BuildPoolOptionsFromFlag(poolDir?: string): HarnessAccountPoolOptions | undefined;
19
+ /** Validates and normalizes a CLI `<vendor>` argument or throws an actionable error message. */
20
+ export declare function RequireHarnessVendor(rawVendor: string): HarnessPoolVendor;
21
+ /** Validates and normalizes a CLI `<strategy>` argument or throws an actionable error message. */
22
+ export declare function RequireHarnessStrategy(rawStrategy: string): HarnessAccountSelectionStrategy;
23
+ /** Formats human-readable setup instructions for an isolated CLI account slot. */
24
+ export declare function FormatSlotIsolationInstructions(vendor: HarnessPoolVendor, slotId: string, slotDir: string, envOverrides: Readonly<Record<string, string>>): string[];
25
+ /** Structured JSON payload emitted by `mj harness account list --json`. */
26
+ export interface HarnessAccountListJsonOutput {
27
+ PoolDir: string;
28
+ Strategy: HarnessAccountSelectionStrategy;
29
+ IncludeOsDefaultLogin: boolean;
30
+ Slots: HarnessAccountSlotStatus[];
31
+ }
32
+ /** Renders the `mj harness account list` human-readable table. */
33
+ export declare function FormatHarnessAccountTable(poolDir: string, strategy: HarnessAccountSelectionStrategy, includeOsDefaultLogin: boolean, slots: readonly HarnessAccountSlotStatus[]): string;
34
+ //# sourceMappingURL=harness-account.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"harness-account.d.ts","sourceRoot":"","sources":["../../src/lib/harness-account.ts"],"names":[],"mappings":"AACA,OAAO,EAOH,KAAK,yBAAyB,EAC9B,KAAK,+BAA+B,EACpC,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,KAAK,2BAA2B,EACnC,MAAM,kCAAkC,CAAC;AAE1C,uEAAuE;AACvE,MAAM,WAAW,sBAAsB;IACnC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,KAAK,CAAC,EAAE,KAAK,CAAC;CACjB;AAED,0FAA0F;AAC1F,MAAM,MAAM,sBAAsB,GAAG,CACjC,IAAI,EAAE,2BAA2B,EACjC,GAAG,EAAE,MAAM,CAA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105 @@
1
+ import { spawnSync } from 'node:child_process';
2
+ import { HARNESS_ACCOUNT_SELECTION_STRATEGIES, HARNESS_POOL_VENDORS, HarnessAccountPoolService, NormalizeHarnessPoolVendor, ParseHarnessAccountSelectionStrategy, StripHarnessApiKeyEnvironment, } from '@memberjunction/ai-agent-harness';
3
+ /** Default interactive login runner using `spawnSync(..., { stdio: 'inherit' })`. */
4
+ export function RunInteractiveCliLogin(spec, env) {
5
+ const result = spawnSync(spec.command, spec.args, {
6
+ stdio: 'inherit',
7
+ env,
8
+ });
9
+ return {
10
+ Status: result.status,
11
+ Error: result.error,
12
+ };
13
+ }
14
+ /**
15
+ * Builds the subprocess environment for an interactive CLI subscription login:
16
+ * inherits host environment, layers the slot's `envOverrides`, and strips provider API keys
17
+ * so the CLI executes its subscription OAuth login flow cleanly.
18
+ */
19
+ export function BuildInteractiveLoginEnv(envOverrides, baseEnv = process.env) {
20
+ const env = {};
21
+ for (const [key, value] of Object.entries(baseEnv)) {
22
+ if (value !== undefined) {
23
+ env[key] = value;
24
+ }
25
+ }
26
+ Object.assign(env, envOverrides);
27
+ StripHarnessApiKeyEnvironment(env);
28
+ return env;
29
+ }
30
+ /** Builds {@link HarnessAccountPoolOptions} from an optional `--pool-dir` CLI flag. */
31
+ export function BuildPoolOptionsFromFlag(poolDir) {
32
+ const trimmed = poolDir?.trim();
33
+ return trimmed ? { poolDir: trimmed } : undefined;
34
+ }
35
+ /** Validates and normalizes a CLI `<vendor>` argument or throws an actionable error message. */
36
+ export function RequireHarnessVendor(rawVendor) {
37
+ const vendor = NormalizeHarnessPoolVendor(rawVendor);
38
+ if (!vendor) {
39
+ throw new Error(`Unknown vendor '${rawVendor}'. Supported vendors: ${HARNESS_POOL_VENDORS.join(', ')} ` +
40
+ `(aliases: claude-code, antigravity, openai-codex, gemini-cli).`);
41
+ }
42
+ return vendor;
43
+ }
44
+ /** Validates and normalizes a CLI `<strategy>` argument or throws an actionable error message. */
45
+ export function RequireHarnessStrategy(rawStrategy) {
46
+ const strategy = ParseHarnessAccountSelectionStrategy(rawStrategy);
47
+ if (!strategy) {
48
+ throw new Error(`Invalid strategy '${rawStrategy}'. Valid strategies: ${HARNESS_ACCOUNT_SELECTION_STRATEGIES.join(', ')}.`);
49
+ }
50
+ return strategy;
51
+ }
52
+ /** Formats human-readable setup instructions for an isolated CLI account slot. */
53
+ export function FormatSlotIsolationInstructions(vendor, slotId, slotDir, envOverrides) {
54
+ const loginSpec = HarnessAccountPoolService.Instance.GetInteractiveLoginCommand(vendor);
55
+ const envPreview = Object.entries(envOverrides)
56
+ .map(([k, v]) => `${k}=${v}`)
57
+ .join(' ');
58
+ const lines = [
59
+ `Slot '${slotId}' (${vendor}) directory: ${slotDir}`,
60
+ `Interactive login command: ${envPreview ? `${envPreview} ` : ''}${loginSpec.displayCommand}`,
61
+ ];
62
+ if (vendor === 'agy' || vendor === 'gemini') {
63
+ lines.push('Isolated HOME prepared with read-through toolchain symlinks (.gitconfig, .ssh, .npmrc, etc.); ' +
64
+ '.gemini/ and .config/ credentials stay local to this slot.');
65
+ }
66
+ return lines;
67
+ }
68
+ /** Renders the `mj harness account list` human-readable table. */
69
+ export function FormatHarnessAccountTable(poolDir, strategy, includeOsDefaultLogin, slots) {
70
+ const lines = [
71
+ `Harness Account Pool (${poolDir})`,
72
+ `Strategy: ${strategy} | Include OS Default Login: ${includeOsDefaultLogin ? 'yes' : 'no'}`,
73
+ '',
74
+ ];
75
+ if (slots.length === 0) {
76
+ lines.push('No CLI account slots found. Add one with: mj harness account add <claude|agy|codex|gemini>');
77
+ return lines.join('\n');
78
+ }
79
+ const headers = ['SLOT ID', 'VENDOR', 'LABEL', 'AUTH', 'ENABLED', 'LEASES', 'W/P', 'COOLDOWN'];
80
+ const rows = slots.map((slot) => [
81
+ slot.slotId,
82
+ slot.vendor,
83
+ slot.label,
84
+ slot.authStatus,
85
+ slot.enabled ? 'yes' : 'no',
86
+ String(slot.activeLeaseCount),
87
+ `${slot.weight}/${slot.priority}`,
88
+ slot.inCooldown && slot.cooldownUntilIso ? `until ${slot.cooldownUntilIso}` : 'none',
89
+ ]);
90
+ const widths = headers.map((header, colIdx) => Math.max(header.length, ...rows.map((row) => row[colIdx].length)));
91
+ const formatRow = (cols) => cols.map((col, idx) => col.padEnd(widths[idx])).join(' ');
92
+ lines.push(formatRow(headers));
93
+ lines.push(widths.map((w) => '-'.repeat(w)).join(' '));
94
+ for (const row of rows) {
95
+ lines.push(formatRow(row));
96
+ }
97
+ const missingBinaryVendors = [...new Set(slots.filter((s) => s.authStatus === 'Binary Missing').map((s) => s.vendor))];
98
+ if (missingBinaryVendors.length > 0) {
99
+ lines.push('');
100
+ lines.push(`Note: 'Binary Missing' indicates the CLI executable failed '<binary> --version' for: ${missingBinaryVendors.join(', ')}. ` +
101
+ `Install or repair the CLI before dispatching turns to those slots.`);
102
+ }
103
+ return lines.join('\n');
104
+ }
105
+ //# sourceMappingURL=harness-account.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"harness-account.js","sourceRoot":"","sources":["../../src/lib/harness-account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAyB,MAAM,oBAAoB,CAAC;AACtE,OAAO,EACH,oCAAoC,EACpC,oBAAoB,EACpB,yBAAyB,EACzB,0BAA0B,EAC1B,oCAAoC,EACpC,6BAA6B,GAMhC,MAAM,kCAAkC,CAAC;AAc1C,qFAAqF;AACrF,MAAM,UAAU,sBAAsB,CAClC,IAAiC,EACjC,GAA2B;IAE3B,MAAM,MAAM,GAA6B,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE;QACxE,KAAK,EAAE,SAAS;QAChB,GAAG;KACN,CAAC,CAAC;IACH,OAAO;QACH,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,KAAK,EAAE,MAAM,CAAC,KAAK;KACtB,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CACpC,YAA8C,EAC9C,UAA6B,OAA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