@memberjunction/cli 6.3.0-edge.1 → 6.3.0-edge.3

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 (270) hide show
  1. package/README.md +1052 -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/init.d.ts +3 -0
  6. package/dist/commands/agent/init.d.ts.map +1 -1
  7. package/dist/commands/agent/init.js +102 -46
  8. package/dist/commands/agent/init.js.map +1 -1
  9. package/dist/commands/agent/usage.d.ts +7 -0
  10. package/dist/commands/agent/usage.d.ts.map +1 -0
  11. package/dist/commands/agent/usage.js +10 -0
  12. package/dist/commands/agent/usage.js.map +1 -0
  13. package/dist/commands/ai/actions/list.d.ts.map +1 -1
  14. package/dist/commands/ai/actions/list.js +18 -14
  15. package/dist/commands/ai/actions/list.js.map +1 -1
  16. package/dist/commands/ai/actions/run.d.ts.map +1 -1
  17. package/dist/commands/ai/actions/run.js +15 -8
  18. package/dist/commands/ai/actions/run.js.map +1 -1
  19. package/dist/commands/ai/agents/list.d.ts.map +1 -1
  20. package/dist/commands/ai/agents/list.js +18 -14
  21. package/dist/commands/ai/agents/list.js.map +1 -1
  22. package/dist/commands/ai/agents/run.d.ts.map +1 -1
  23. package/dist/commands/ai/agents/run.js +19 -8
  24. package/dist/commands/ai/agents/run.js.map +1 -1
  25. package/dist/commands/ai/audit/agent-run.d.ts.map +1 -1
  26. package/dist/commands/ai/audit/agent-run.js +62 -56
  27. package/dist/commands/ai/audit/agent-run.js.map +1 -1
  28. package/dist/commands/ai/prompts/list.d.ts.map +1 -1
  29. package/dist/commands/ai/prompts/list.js +6 -3
  30. package/dist/commands/ai/prompts/list.js.map +1 -1
  31. package/dist/commands/ai/prompts/run.d.ts.map +1 -1
  32. package/dist/commands/ai/prompts/run.js +17 -10
  33. package/dist/commands/ai/prompts/run.js.map +1 -1
  34. package/dist/commands/app/install.d.ts +4 -0
  35. package/dist/commands/app/install.d.ts.map +1 -1
  36. package/dist/commands/app/install.js +36 -1
  37. package/dist/commands/app/install.js.map +1 -1
  38. package/dist/commands/app/upgrade.d.ts +1 -0
  39. package/dist/commands/app/upgrade.d.ts.map +1 -1
  40. package/dist/commands/app/upgrade.js +9 -0
  41. package/dist/commands/app/upgrade.js.map +1 -1
  42. package/dist/commands/codegen/manifest.d.ts +40 -0
  43. package/dist/commands/codegen/manifest.d.ts.map +1 -1
  44. package/dist/commands/codegen/manifest.js +124 -3
  45. package/dist/commands/codegen/manifest.js.map +1 -1
  46. package/dist/commands/diag/usage.d.ts +7 -0
  47. package/dist/commands/diag/usage.d.ts.map +1 -0
  48. package/dist/commands/diag/usage.js +10 -0
  49. package/dist/commands/diag/usage.js.map +1 -0
  50. package/dist/commands/doctor/index.d.ts +6 -0
  51. package/dist/commands/doctor/index.d.ts.map +1 -1
  52. package/dist/commands/doctor/index.js +42 -0
  53. package/dist/commands/doctor/index.js.map +1 -1
  54. package/dist/commands/explorer/postbuild.d.ts +14 -0
  55. package/dist/commands/explorer/postbuild.d.ts.map +1 -0
  56. package/dist/commands/explorer/postbuild.js +49 -0
  57. package/dist/commands/explorer/postbuild.js.map +1 -0
  58. package/dist/commands/explorer/usage.d.ts +7 -0
  59. package/dist/commands/explorer/usage.d.ts.map +1 -0
  60. package/dist/commands/explorer/usage.js +10 -0
  61. package/dist/commands/explorer/usage.js.map +1 -0
  62. package/dist/commands/harness/account/add.d.ts +22 -0
  63. package/dist/commands/harness/account/add.d.ts.map +1 -0
  64. package/dist/commands/harness/account/add.js +100 -0
  65. package/dist/commands/harness/account/add.js.map +1 -0
  66. package/dist/commands/harness/account/clear-cooldown.d.ts +13 -0
  67. package/dist/commands/harness/account/clear-cooldown.d.ts.map +1 -0
  68. package/dist/commands/harness/account/clear-cooldown.js +32 -0
  69. package/dist/commands/harness/account/clear-cooldown.js.map +1 -0
  70. package/dist/commands/harness/account/disable.d.ts +13 -0
  71. package/dist/commands/harness/account/disable.d.ts.map +1 -0
  72. package/dist/commands/harness/account/disable.js +34 -0
  73. package/dist/commands/harness/account/disable.js.map +1 -0
  74. package/dist/commands/harness/account/enable.d.ts +13 -0
  75. package/dist/commands/harness/account/enable.d.ts.map +1 -0
  76. package/dist/commands/harness/account/enable.js +34 -0
  77. package/dist/commands/harness/account/enable.js.map +1 -0
  78. package/dist/commands/harness/account/index.d.ts +7 -0
  79. package/dist/commands/harness/account/index.d.ts.map +1 -0
  80. package/dist/commands/harness/account/index.js +23 -0
  81. package/dist/commands/harness/account/index.js.map +1 -0
  82. package/dist/commands/harness/account/list.d.ts +15 -0
  83. package/dist/commands/harness/account/list.d.ts.map +1 -0
  84. package/dist/commands/harness/account/list.js +58 -0
  85. package/dist/commands/harness/account/list.js.map +1 -0
  86. package/dist/commands/harness/account/login.d.ts +16 -0
  87. package/dist/commands/harness/account/login.d.ts.map +1 -0
  88. package/dist/commands/harness/account/login.js +50 -0
  89. package/dist/commands/harness/account/login.js.map +1 -0
  90. package/dist/commands/harness/account/remove.d.ts +14 -0
  91. package/dist/commands/harness/account/remove.d.ts.map +1 -0
  92. package/dist/commands/harness/account/remove.js +43 -0
  93. package/dist/commands/harness/account/remove.js.map +1 -0
  94. package/dist/commands/harness/account/set-strategy.d.ts +13 -0
  95. package/dist/commands/harness/account/set-strategy.d.ts.map +1 -0
  96. package/dist/commands/harness/account/set-strategy.js +38 -0
  97. package/dist/commands/harness/account/set-strategy.js.map +1 -0
  98. package/dist/commands/harness/index.d.ts +7 -0
  99. package/dist/commands/harness/index.d.ts.map +1 -0
  100. package/dist/commands/harness/index.js +22 -0
  101. package/dist/commands/harness/index.js.map +1 -0
  102. package/dist/commands/harness/usage.d.ts +7 -0
  103. package/dist/commands/harness/usage.d.ts.map +1 -0
  104. package/dist/commands/harness/usage.js +10 -0
  105. package/dist/commands/harness/usage.js.map +1 -0
  106. package/dist/commands/migrate/convert.d.ts +25 -1
  107. package/dist/commands/migrate/convert.d.ts.map +1 -1
  108. package/dist/commands/migrate/convert.js +156 -38
  109. package/dist/commands/migrate/convert.js.map +1 -1
  110. package/dist/commands/migrate/index.d.ts +8 -0
  111. package/dist/commands/migrate/index.d.ts.map +1 -1
  112. package/dist/commands/migrate/index.js +40 -1
  113. package/dist/commands/migrate/index.js.map +1 -1
  114. package/dist/commands/migrate/rebake.d.ts +13 -0
  115. package/dist/commands/migrate/rebake.d.ts.map +1 -1
  116. package/dist/commands/migrate/rebake.js +45 -6
  117. package/dist/commands/migrate/rebake.js.map +1 -1
  118. package/dist/commands/queue/export-topology.d.ts +2 -0
  119. package/dist/commands/queue/export-topology.d.ts.map +1 -1
  120. package/dist/commands/queue/export-topology.js +3 -1
  121. package/dist/commands/queue/export-topology.js.map +1 -1
  122. package/dist/commands/queue/import-bindings.d.ts +2 -0
  123. package/dist/commands/queue/import-bindings.d.ts.map +1 -1
  124. package/dist/commands/queue/import-bindings.js +3 -1
  125. package/dist/commands/queue/import-bindings.js.map +1 -1
  126. package/dist/commands/queue/index.js +1 -1
  127. package/dist/commands/queue/index.js.map +1 -1
  128. package/dist/commands/queue/sweep.d.ts +4 -6
  129. package/dist/commands/queue/sweep.d.ts.map +1 -1
  130. package/dist/commands/queue/sweep.js +15 -23
  131. package/dist/commands/queue/sweep.js.map +1 -1
  132. package/dist/commands/queue/validate-bindings.d.ts +2 -0
  133. package/dist/commands/queue/validate-bindings.d.ts.map +1 -1
  134. package/dist/commands/queue/validate-bindings.js +3 -1
  135. package/dist/commands/queue/validate-bindings.js.map +1 -1
  136. package/dist/commands/queue/work.d.ts +2 -19
  137. package/dist/commands/queue/work.d.ts.map +1 -1
  138. package/dist/commands/queue/work.js +9 -29
  139. package/dist/commands/queue/work.js.map +1 -1
  140. package/dist/commands/rubric/usage.d.ts +7 -0
  141. package/dist/commands/rubric/usage.d.ts.map +1 -0
  142. package/dist/commands/rubric/usage.js +10 -0
  143. package/dist/commands/rubric/usage.js.map +1 -0
  144. package/dist/commands/test/regression/index.d.ts.map +1 -1
  145. package/dist/commands/test/regression/index.js +2 -0
  146. package/dist/commands/test/regression/index.js.map +1 -1
  147. package/dist/commands/test/regression/new.d.ts +21 -0
  148. package/dist/commands/test/regression/new.d.ts.map +1 -0
  149. package/dist/commands/test/regression/new.js +82 -0
  150. package/dist/commands/test/regression/new.js.map +1 -0
  151. package/dist/commands/test/regression/up.d.ts +1 -0
  152. package/dist/commands/test/regression/up.d.ts.map +1 -1
  153. package/dist/commands/test/regression/up.js +17 -0
  154. package/dist/commands/test/regression/up.js.map +1 -1
  155. package/dist/commands/test/scripts.d.ts +6 -4
  156. package/dist/commands/test/scripts.d.ts.map +1 -1
  157. package/dist/commands/test/scripts.js +14 -0
  158. package/dist/commands/test/scripts.js.map +1 -1
  159. package/dist/commands/test/suite.d.ts +1 -0
  160. package/dist/commands/test/suite.d.ts.map +1 -1
  161. package/dist/commands/test/suite.js +6 -0
  162. package/dist/commands/test/suite.js.map +1 -1
  163. package/dist/commands/usage.js +2 -1
  164. package/dist/commands/usage.js.map +1 -1
  165. package/dist/commands/user/usage.d.ts +7 -0
  166. package/dist/commands/user/usage.d.ts.map +1 -0
  167. package/dist/commands/user/usage.js +10 -0
  168. package/dist/commands/user/usage.js.map +1 -0
  169. package/dist/config.d.ts +117 -0
  170. package/dist/config.d.ts.map +1 -1
  171. package/dist/config.js +44 -0
  172. package/dist/config.js.map +1 -1
  173. package/dist/init-templates/citizen-builder/.agents/skills/package-agent/SKILL.md +12 -2
  174. package/dist/init-templates/citizen-builder/.agents/skills/test-agent/SKILL.md +1 -1
  175. package/dist/init-templates/citizen-builder/.claude/skills/package-agent/SKILL.md +12 -2
  176. package/dist/init-templates/citizen-builder/.claude/skills/test-agent/SKILL.md +1 -1
  177. package/dist/init-templates/citizen-builder/.env.example +14 -2
  178. package/dist/init-templates/citizen-builder/AGENTS.md +5 -2
  179. package/dist/init-templates/citizen-builder/CAPABILITIES.md +9 -0
  180. package/dist/init-templates/citizen-builder/README.md +29 -15
  181. package/dist/init-templates/citizen-builder/docker-compose.yml +13 -0
  182. package/dist/init-templates/citizen-builder/docs/PROMOTION_GUIDE.md +5 -2
  183. package/dist/init-templates/citizen-builder/scripts/docker-entrypoint.sh +290 -33
  184. package/dist/init-templates/citizen-builder/scripts/generate-capabilities.sh +148 -41
  185. package/dist/lib/db-preflight.d.ts.map +1 -1
  186. package/dist/lib/db-preflight.js +22 -0
  187. package/dist/lib/db-preflight.js.map +1 -1
  188. package/dist/lib/derived-usage.d.ts +8 -0
  189. package/dist/lib/derived-usage.d.ts.map +1 -1
  190. package/dist/lib/derived-usage.js +30 -20
  191. package/dist/lib/derived-usage.js.map +1 -1
  192. package/dist/lib/domain-profiles.d.ts.map +1 -1
  193. package/dist/lib/domain-profiles.js +24 -0
  194. package/dist/lib/domain-profiles.js.map +1 -1
  195. package/dist/lib/domain-usage-command.js +2 -1
  196. package/dist/lib/domain-usage-command.js.map +1 -1
  197. package/dist/lib/explorer-postbuild/public-page-html.d.ts +48 -0
  198. package/dist/lib/explorer-postbuild/public-page-html.d.ts.map +1 -0
  199. package/dist/lib/explorer-postbuild/public-page-html.js +284 -0
  200. package/dist/lib/explorer-postbuild/public-page-html.js.map +1 -0
  201. package/dist/lib/explorer-postbuild/service-worker-check.d.ts +13 -0
  202. package/dist/lib/explorer-postbuild/service-worker-check.d.ts.map +1 -0
  203. package/dist/lib/explorer-postbuild/service-worker-check.js +41 -0
  204. package/dist/lib/explorer-postbuild/service-worker-check.js.map +1 -0
  205. package/dist/lib/harness-account.d.ts +34 -0
  206. package/dist/lib/harness-account.d.ts.map +1 -0
  207. package/dist/lib/harness-account.js +105 -0
  208. package/dist/lib/harness-account.js.map +1 -0
  209. package/dist/lib/pg-preflight/checks.d.ts +28 -0
  210. package/dist/lib/pg-preflight/checks.d.ts.map +1 -0
  211. package/dist/lib/pg-preflight/checks.js +94 -0
  212. package/dist/lib/pg-preflight/checks.js.map +1 -0
  213. package/dist/lib/pg-preflight/extension-check.d.ts +28 -0
  214. package/dist/lib/pg-preflight/extension-check.d.ts.map +1 -0
  215. package/dist/lib/pg-preflight/extension-check.js +86 -0
  216. package/dist/lib/pg-preflight/extension-check.js.map +1 -0
  217. package/dist/lib/pg-preflight/extension-scan.d.ts +24 -0
  218. package/dist/lib/pg-preflight/extension-scan.d.ts.map +1 -0
  219. package/dist/lib/pg-preflight/extension-scan.js +58 -0
  220. package/dist/lib/pg-preflight/extension-scan.js.map +1 -0
  221. package/dist/lib/pg-preflight/pending-migrations.d.ts +28 -0
  222. package/dist/lib/pg-preflight/pending-migrations.d.ts.map +1 -0
  223. package/dist/lib/pg-preflight/pending-migrations.js +48 -0
  224. package/dist/lib/pg-preflight/pending-migrations.js.map +1 -0
  225. package/dist/lib/pg-preflight/preflight.d.ts +18 -0
  226. package/dist/lib/pg-preflight/preflight.d.ts.map +1 -0
  227. package/dist/lib/pg-preflight/preflight.js +43 -0
  228. package/dist/lib/pg-preflight/preflight.js.map +1 -0
  229. package/dist/lib/pg-preflight/remediation.d.ts +27 -0
  230. package/dist/lib/pg-preflight/remediation.d.ts.map +1 -0
  231. package/dist/lib/pg-preflight/remediation.js +82 -0
  232. package/dist/lib/pg-preflight/remediation.js.map +1 -0
  233. package/dist/lib/pg-preflight/render.d.ts +15 -0
  234. package/dist/lib/pg-preflight/render.d.ts.map +1 -0
  235. package/dist/lib/pg-preflight/render.js +48 -0
  236. package/dist/lib/pg-preflight/render.js.map +1 -0
  237. package/dist/lib/pg-preflight/run-for-config.d.ts +23 -0
  238. package/dist/lib/pg-preflight/run-for-config.d.ts.map +1 -0
  239. package/dist/lib/pg-preflight/run-for-config.js +45 -0
  240. package/dist/lib/pg-preflight/run-for-config.js.map +1 -0
  241. package/dist/lib/pg-preflight/types.d.ts +67 -0
  242. package/dist/lib/pg-preflight/types.d.ts.map +1 -0
  243. package/dist/lib/pg-preflight/types.js +8 -0
  244. package/dist/lib/pg-preflight/types.js.map +1 -0
  245. package/dist/lib/regression/test-scaffold.d.ts +52 -0
  246. package/dist/lib/regression/test-scaffold.d.ts.map +1 -0
  247. package/dist/lib/regression/test-scaffold.js +237 -0
  248. package/dist/lib/regression/test-scaffold.js.map +1 -0
  249. package/dist/lib/work-queue/queue-format.d.ts +4 -0
  250. package/dist/lib/work-queue/queue-format.d.ts.map +1 -1
  251. package/dist/lib/work-queue/queue-format.js +15 -0
  252. package/dist/lib/work-queue/queue-format.js.map +1 -1
  253. package/dist/lib/work-queue/queue-worker.d.ts +16 -1
  254. package/dist/lib/work-queue/queue-worker.d.ts.map +1 -1
  255. package/dist/lib/work-queue/queue-worker.js +18 -0
  256. package/dist/lib/work-queue/queue-worker.js.map +1 -1
  257. package/dist/light-commands.d.ts.map +1 -1
  258. package/dist/light-commands.js +34 -0
  259. package/dist/light-commands.js.map +1 -1
  260. package/dist/tsconfig.tsbuildinfo +1 -1
  261. package/dist/utils/dependencies-from-head.d.ts +4 -0
  262. package/dist/utils/dependencies-from-head.d.ts.map +1 -0
  263. package/dist/utils/dependencies-from-head.js +5 -0
  264. package/dist/utils/dependencies-from-head.js.map +1 -0
  265. package/dist/utils/open-app-context.d.ts +1 -0
  266. package/dist/utils/open-app-context.d.ts.map +1 -1
  267. package/dist/utils/open-app-context.js +6 -1
  268. package/dist/utils/open-app-context.js.map +1 -1
  269. package/oclif.manifest.json +2026 -1091
  270. package/package.json +34 -31
@@ -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,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IAChD,IAAI,UAAU,KAAK,IAAI,EAAE,CAAC;QACtB,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAe,CAAC;IACpD,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IACjC,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACrE,MAAM,OAAO,GAAG,qBAAqB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvD,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,OAAO,IAAI,EAAE,CAAC,EAAE,CAAC;QAC5D,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,aAAa,CAAC,UAAU,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACnG,OAAO,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/l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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,CAAC,MAAM,EAAE,MAAM,CAAC,KAC1B,sBAAsB,CAAC;AAE5B,qFAAqF;AACrF,wBAAgB,sBAAsB,CAClC,IAAI,EAAE,2BAA2B,EACjC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC5B,sBAAsB,CASxB;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACpC,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAC9C,OAAO,GAAE,MAAM,CAAC,UAAwB,GACzC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAUxB;AAED,uFAAuF;AACvF,wBAAgB,wBAAwB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,yBAAyB,GAAG,SAAS,CAGhG;AAED,gGAAgG;AAChG,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,iBAAiB,CASzE;AAED,kGAAkG;AAClG,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,GAAG,+BAA+B,CAQ3F;AAED,kFAAkF;AAClF,wBAAgB,+BAA+B,CAC3C,MAAM,EAAE,iBAAiB,EACzB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAC/C,MAAM,EAAE,CAgBV;AAED,2EAA2E;AAC3E,MAAM,WAAW,4BAA4B;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,+BAA+B,CAAC;IAC1C,qBAAqB,EAAE,OAAO,CAAC;IAC/B,KAAK,EAAE,wBAAwB,EAAE,CAAC;CACrC;AAED,kEAAkE;AAClE,wBAAgB,yBAAyB,CACrC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,+BAA+B,EACzC,qBAAqB,EAAE,OAAO,EAC9B,KAAK,EAAE,SAAS,wBAAwB,EAAE,GAC3C,MAAM,CA+CR"}
@@ -0,0 +1,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,OAAO,CAAC,GAAG;IAExC,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACjD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACtB,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACrB,CAAC;IACL,CAAC;IACD,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;IACjC,6BAA6B,CAAC,GAAG,CAAC,CAAC;IACnC,OAAO,GAAG,CAAC;AACf,CAAC;AAED,uFAAuF;AACvF,MAAM,UAAU,wBAAwB,CAAC,OAAgB;IACrD,MAAM,OAAO,GAAG,OAAO,EAAE,IA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ClC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,CAAC,IAAI,CACN,wFAAwF,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;YACvH,oEAAoE,CAC3E,CAAC;IACN,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * The individual managed-PostgreSQL preflight checks. Each one runs a read-only catalog
3
+ * query through a {@link PgPreflightQueryRunner} and returns a {@link PgPreflightCheck}.
4
+ *
5
+ * @module lib/pg-preflight/checks
6
+ */
7
+ import type { PgPreflightCheck, PgPreflightCheckId, PgPreflightQueryRunner, PgPreflightStatus, PgRemediationStep, PgSessionContext } from './types.js';
8
+ /** PostgreSQL 14, the lowest version MJ supports. */
9
+ export declare const MIN_PG_SERVER_VERSION_NUM = 140000;
10
+ /** Builds a check result. */
11
+ export declare function MakeCheck(Id: PgPreflightCheckId, Status: PgPreflightStatus, Message: string, Remediation?: PgRemediationStep[], Notes?: string[]): PgPreflightCheck;
12
+ /** Reads the facts every check shares, in one round trip. */
13
+ export declare function ReadSessionContext(runner: PgPreflightQueryRunner): Promise<PgSessionContext>;
14
+ /** The server must be PostgreSQL 14 or later. */
15
+ export declare function CheckServerVersion(session: PgSessionContext, minimum?: number): PgPreflightCheck;
16
+ /** Every group role the migrations grant to must exist. */
17
+ export declare function CheckGroupRoles(runner: PgPreflightQueryRunner, session: PgSessionContext, roles: readonly string[]): Promise<PgPreflightCheck>;
18
+ /** The migrate login needs CREATE on the database: Skyway runs `CREATE SCHEMA IF NOT EXISTS`, which checks it even when the schema exists. */
19
+ export declare function CheckDatabaseCreate(session: PgSessionContext): PgPreflightCheck;
20
+ /** The target schema must be owned by the migrate login, or not exist yet. */
21
+ export declare function CheckTargetSchema(runner: PgPreflightQueryRunner, session: PgSessionContext, schema: string): Promise<PgPreflightCheck>;
22
+ /** TLS for the current backend. Never fails: a warning (info on a loopback host). */
23
+ export declare function CheckTls(runner: PgPreflightQueryRunner, host: string | undefined): Promise<PgPreflightCheck>;
24
+ /** True for localhost and the loopback addresses. */
25
+ export declare function IsLoopbackHost(host: string | undefined): boolean;
26
+ /** Reports `max_connections` and current use. Informational only. */
27
+ export declare function CheckConnections(runner: PgPreflightQueryRunner): Promise<PgPreflightCheck>;
28
+ //# sourceMappingURL=checks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checks.d.ts","sourceRoot":"","sources":["../../../src/lib/pg-preflight/checks.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEpJ,qDAAqD;AACrD,eAAO,MAAM,yBAAyB,SAAS,CAAC;AAEhD,6BAA6B;AAC7B,wBAAgB,SAAS,CACvB,EAAE,EAAE,kBAAkB,EACtB,MAAM,EAAE,iBAAiB,EACzB,OAAO,EAAE,MAAM,EACf,WAAW,GAAE,iBAAiB,EAAO,EACrC,KAAK,GAAE,MAAM,EAAO,GACnB,gBAAgB,CAElB;AAED,6DAA6D;AAC7D,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAWlG;AAED,iDAAiD;AACjD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,gBAAgB,EAAE,OAAO,SAA4B,GAAG,gBAAgB,CAQnH;AAED,2DAA2D;AAC3D,wBAAsB,eAAe,CAAC,MAAM,EAAE,sBAAsB,EAAE,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAWpJ;AAED,8IAA8I;AAC9I,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,GAAG,gBAAgB,CAU/E;AAED,8EAA8E;AAC9E,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,sBAAsB,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAkB5I;AAED,qFAAqF;AACrF,wBAAsB,QAAQ,CAAC,MAAM,EAAE,sBAAsB,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAWlH;AAED,qDAAqD;AACrD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAGhE;AAED,qEAAqE;AACrE,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAShG"}
@@ -0,0 +1,94 @@
1
+ /**
2
+ * The individual managed-PostgreSQL preflight checks. Each one runs a read-only catalog
3
+ * query through a {@link PgPreflightQueryRunner} and returns a {@link PgPreflightCheck}.
4
+ *
5
+ * @module lib/pg-preflight/checks
6
+ */
7
+ import { DatabaseCreateRemediation, RoleRemediation, SchemaOwnerRemediation } from './remediation.js';
8
+ /** PostgreSQL 14, the lowest version MJ supports. */
9
+ export const MIN_PG_SERVER_VERSION_NUM = 140000;
10
+ /** Builds a check result. */
11
+ export function MakeCheck(Id, Status, Message, Remediation = [], Notes = []) {
12
+ return { Id, Status, Message, Remediation, Notes };
13
+ }
14
+ /** Reads the facts every check shares, in one round trip. */
15
+ export async function ReadSessionContext(runner) {
16
+ const rows = await runner.Query(`SELECT current_user AS "Login",
17
+ current_database() AS "Database",
18
+ current_setting('server_version') AS "ServerVersion",
19
+ current_setting('server_version_num')::int AS "ServerVersionNum",
20
+ has_database_privilege(current_database(), 'CREATE') AS "CanCreateInDatabase",
21
+ COALESCE((SELECT rolsuper FROM pg_catalog.pg_roles WHERE rolname = current_user), false) AS "IsSuperuser"`);
22
+ if (rows.length === 0)
23
+ throw new Error('The session context query returned no rows.');
24
+ return rows[0];
25
+ }
26
+ /** The server must be PostgreSQL 14 or later. */
27
+ export function CheckServerVersion(session, minimum = MIN_PG_SERVER_VERSION_NUM) {
28
+ const minimumMajor = Math.floor(minimum / 10000);
29
+ if (session.ServerVersionNum >= minimum) {
30
+ return MakeCheck('server-version', 'pass', `PostgreSQL ${session.ServerVersion} (${minimumMajor} or later required)`);
31
+ }
32
+ return MakeCheck('server-version', 'fail', `PostgreSQL ${session.ServerVersion} is older than ${minimumMajor}, the lowest version MJ supports`, [], [
33
+ `Upgrade the server to PostgreSQL ${minimumMajor} or later.`,
34
+ ]);
35
+ }
36
+ /** Every group role the migrations grant to must exist. */
37
+ export async function CheckGroupRoles(runner, session, roles) {
38
+ if (roles.length === 0) {
39
+ return MakeCheck('group-roles', 'pass', 'The pending migrations grant to no MJ group role');
40
+ }
41
+ const rows = await runner.Query('SELECT rolname FROM pg_catalog.pg_roles WHERE rolname = ANY($1::text[])', [[...roles]]);
42
+ const present = new Set(rows.map((r) => r.rolname));
43
+ const missing = roles.filter((role) => !present.has(role));
44
+ if (missing.length === 0) {
45
+ return MakeCheck('group-roles', 'pass', `Group roles exist: ${roles.join(', ')}`);
46
+ }
47
+ return MakeCheck('group-roles', 'fail', `Missing group role(s) the migrations grant to: ${missing.join(', ')}`, RoleRemediation(session, missing));
48
+ }
49
+ /** The migrate login needs CREATE on the database: Skyway runs `CREATE SCHEMA IF NOT EXISTS`, which checks it even when the schema exists. */
50
+ export function CheckDatabaseCreate(session) {
51
+ if (session.CanCreateInDatabase) {
52
+ return MakeCheck('database-create', 'pass', `${session.Login} has CREATE on database ${session.Database}`);
53
+ }
54
+ return MakeCheck('database-create', 'fail', `${session.Login} lacks CREATE on database ${session.Database} (needed to create schemas and trusted extensions)`, DatabaseCreateRemediation(session));
55
+ }
56
+ /** The target schema must be owned by the migrate login, or not exist yet. */
57
+ export async function CheckTargetSchema(runner, session, schema) {
58
+ const rows = await runner.Query(`SELECT pg_catalog.pg_get_userbyid(nspowner) AS "Owner", pg_catalog.pg_has_role(current_user, nspowner, 'USAGE') AS "Owned"
59
+ FROM pg_catalog.pg_namespace WHERE nspname = $1`, [schema]);
60
+ if (rows.length === 0) {
61
+ return MakeCheck('target-schema', 'info', `Schema ${schema} does not exist yet; the migration creates it, owned by ${session.Login}`);
62
+ }
63
+ if (rows[0].Owned) {
64
+ return MakeCheck('target-schema', 'pass', `Schema ${schema} is owned by ${rows[0].Owner}, which ${session.Login} is or belongs to`);
65
+ }
66
+ return MakeCheck('target-schema', 'fail', `Schema ${schema} is owned by ${rows[0].Owner}, not ${session.Login}, so the migrations cannot alter its objects`, SchemaOwnerRemediation(session, schema));
67
+ }
68
+ /** TLS for the current backend. Never fails: a warning (info on a loopback host). */
69
+ export async function CheckTls(runner, host) {
70
+ const rows = await runner.Query('SELECT ssl, version FROM pg_catalog.pg_stat_ssl WHERE pid = pg_catalog.pg_backend_pid()');
71
+ if (rows[0]?.ssl) {
72
+ return MakeCheck('tls', 'pass', `The connection uses TLS (${rows[0].version ?? 'unknown version'})`);
73
+ }
74
+ if (IsLoopbackHost(host)) {
75
+ return MakeCheck('tls', 'info', 'The connection does not use TLS (expected for a local server)');
76
+ }
77
+ return MakeCheck('tls', 'warn', 'The connection does not use TLS; a managed host should require it');
78
+ }
79
+ /** True for localhost and the loopback addresses. */
80
+ export function IsLoopbackHost(host) {
81
+ const h = (host ?? '').trim().toLowerCase();
82
+ return h === 'localhost' || h === '::1' || h === '[::1]' || h.startsWith('127.');
83
+ }
84
+ /** Reports `max_connections` and current use. Informational only. */
85
+ export async function CheckConnections(runner) {
86
+ const rows = await runner.Query(`SELECT current_setting('max_connections')::int AS "Max",
87
+ current_setting('superuser_reserved_connections')::int AS "Reserved",
88
+ (SELECT count(*) FROM pg_catalog.pg_stat_activity)::int AS "InUse"`);
89
+ const row = rows[0];
90
+ if (!row)
91
+ return MakeCheck('connections', 'info', 'Could not read max_connections');
92
+ return MakeCheck('connections', 'info', `max_connections=${row.Max} (${row.Reserved} reserved for superusers), ${row.InUse} in use`);
93
+ }
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AI,CAAC,CAAC,CAAC,CAAC,OAAO,IAAI,iBAAiB,GAAG,CAAC,CAAC;IACvG,CAAC;IACD,IAAI,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,OAAO,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,+DAA+D,CAAC,CAAC;IACnG,CAAC;IACD,OAAO,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,mEAAmE,CAAC,CAAC;AACvG,CAAC;AAED,qDAAqD;AACrD,MAAM,UAAU,cAAc,CAAC,IAAwB;IACrD,MAAM,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC5C,OAAO,CAAC,KAAK,WAAW,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,OAAO,IAAI,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;AACnF,CAAC;AAED,qEAAqE;AACrE,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,MAA8B;IACnE,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,KAAK,CAC7B;;+EAE2E,CAC5E,CAAC;IACF,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,IAAI,CAAC,GAAG;QAAE,OAAO,SAAS,CAAC,aAAa,EAAE,MAAM,EAAE,gCAAgC,CAAC,CAAC;IACpF,OAAO,SAAS,CAAC,aAAa,EAAE,MAAM,EAAE,mBAAmB,GAAG,CAAC,GAAG,KAAK,GAAG,CAAC,QAAQ,8BAA8B,GAAG,CAAC,KAAK,SAAS,CAAC,CAAC;AACvI,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * The extension check: every extension a pending migration `CREATE`s must already be
3
+ * installed, or be creatable by the migrate login on this server.
4
+ *
5
+ * Managed hosts add one more gate. Azure Database for PostgreSQL Flexible Server and
6
+ * Azure HorizonDB refuse `CREATE EXTENSION` for anything missing from the
7
+ * `azure.extensions` server parameter, whatever the login's privileges, so the check
8
+ * reads that parameter whenever the server defines it.
9
+ *
10
+ * @module lib/pg-preflight/extension-check
11
+ */
12
+ import type { PgPreflightCheck, PgPreflightQueryRunner, PgSessionContext } from './types.js';
13
+ /** One required extension as the catalog describes it. */
14
+ export interface ExtensionCatalogRow {
15
+ Name: string;
16
+ InstalledVersion: string | null;
17
+ Trusted: boolean;
18
+ }
19
+ /** Why an extension blocks the migration. */
20
+ type ExtensionProblem = 'unavailable' | 'not-allowlisted' | 'needs-admin';
21
+ /** Splits the `azure.extensions` value; null when the server does not define the parameter. */
22
+ export declare function ParseAllowlist(value: string | null): string[] | null;
23
+ /** Classifies one required extension; null means it is fine. */
24
+ export declare function ClassifyExtension(name: string, row: ExtensionCatalogRow | undefined, allowlist: string[] | null, session: PgSessionContext): ExtensionProblem | null;
25
+ /** Runs the extension check. */
26
+ export declare function CheckExtensions(runner: PgPreflightQueryRunner, session: PgSessionContext, required: readonly string[]): Promise<PgPreflightCheck>;
27
+ export {};
28
+ //# sourceMappingURL=extension-check.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extension-check.d.ts","sourceRoot":"","sources":["../../../src/lib/pg-preflight/extension-check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE1F,0DAA0D;AAC1D,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,6CAA6C;AAC7C,KAAK,gBAAgB,GAAG,aAAa,GAAG,iBAAiB,GAAG,aAAa,CAAC;AAe1E,+FAA+F;AAC/F,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,EAAE,GAAG,IAAI,CAMpE;AAED,gEAAgE;AAChE,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,mBAAmB,GAAG,SAAS,EACpC,SAAS,EAAE,MAAM,EAAE,GAAG,IAAI,EAC1B,OAAO,EAAE,gBAAgB,GACxB,gBAAgB,GAAG,IAAI,CAMzB;AAED,gCAAgC;AAChC,wBAAsB,eAAe,CAAC,MAAM,EAAE,sBAAsB,EAAE,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAcvJ"}
@@ -0,0 +1,86 @@
1
+ /**
2
+ * The extension check: every extension a pending migration `CREATE`s must already be
3
+ * installed, or be creatable by the migrate login on this server.
4
+ *
5
+ * Managed hosts add one more gate. Azure Database for PostgreSQL Flexible Server and
6
+ * Azure HorizonDB refuse `CREATE EXTENSION` for anything missing from the
7
+ * `azure.extensions` server parameter, whatever the login's privileges, so the check
8
+ * reads that parameter whenever the server defines it.
9
+ *
10
+ * @module lib/pg-preflight/extension-check
11
+ */
12
+ import { MakeCheck } from './checks.js';
13
+ import { ExtensionRemediation } from './remediation.js';
14
+ /** Reads the catalog rows for the required extensions, and the Azure allowlist when defined. */
15
+ async function readExtensionState(runner, required) {
16
+ const rows = await runner.Query(`SELECT e.name AS "Name", e.installed_version AS "InstalledVersion", COALESCE(v.trusted, false) AS "Trusted"
17
+ FROM pg_catalog.pg_available_extensions e
18
+ LEFT JOIN pg_catalog.pg_available_extension_versions v ON v.name = e.name AND v.version = e.default_version
19
+ WHERE e.name = ANY($1::text[])`, [[...required]]);
20
+ const allow = await runner.Query(`SELECT current_setting('azure.extensions', true) AS "Allowlist"`);
21
+ return { Rows: rows, Allowlist: ParseAllowlist(allow[0]?.Allowlist ?? null) };
22
+ }
23
+ /** Splits the `azure.extensions` value; null when the server does not define the parameter. */
24
+ export function ParseAllowlist(value) {
25
+ if (value === null)
26
+ return null;
27
+ return value
28
+ .split(',')
29
+ .map((name) => name.trim().toLowerCase())
30
+ .filter((name) => name.length > 0);
31
+ }
32
+ /** Classifies one required extension; null means it is fine. */
33
+ export function ClassifyExtension(name, row, allowlist, session) {
34
+ if (row?.InstalledVersion)
35
+ return null;
36
+ if (!row)
37
+ return 'unavailable';
38
+ if (allowlist !== null && !allowlist.includes(name.toLowerCase()))
39
+ return 'not-allowlisted';
40
+ const canCreate = session.IsSuperuser || (row.Trusted && session.CanCreateInDatabase);
41
+ return canCreate ? null : 'needs-admin';
42
+ }
43
+ /** Runs the extension check. */
44
+ export async function CheckExtensions(runner, session, required) {
45
+ if (required.length === 0) {
46
+ return MakeCheck('extensions', 'pass', 'No pending migration creates an extension');
47
+ }
48
+ const state = await readExtensionState(runner, required);
49
+ const problems = new Map();
50
+ for (const name of required) {
51
+ const problem = ClassifyExtension(name, state.Rows.find((r) => r.Name === name), state.Allowlist, session);
52
+ if (problem)
53
+ problems.set(name, problem);
54
+ }
55
+ if (problems.size === 0) {
56
+ return MakeCheck('extensions', 'pass', `Extensions installed or creatable by ${session.Login}: ${required.join(', ')}`);
57
+ }
58
+ return buildFailure(session, problems, state.Allowlist);
59
+ }
60
+ /** The failed check, with SQL for what SQL can fix and notes for what it cannot. */
61
+ function buildFailure(session, problems, allowlist) {
62
+ const byProblem = (p) => [...problems].filter(([, v]) => v === p).map(([k]) => k);
63
+ const unavailable = byProblem('unavailable');
64
+ const notAllowlisted = byProblem('not-allowlisted');
65
+ const needsAdmin = byProblem('needs-admin');
66
+ const parts = [
67
+ unavailable.length ? `are not available on this server: ${unavailable.join(', ')}` : '',
68
+ notAllowlisted.length ? `are not in the azure.extensions allowlist: ${notAllowlisted.join(', ')}` : '',
69
+ needsAdmin.length ? `${session.Login} cannot create without an administrator: ${needsAdmin.join(', ')}` : '',
70
+ ].filter((p) => p.length > 0);
71
+ return MakeCheck('extensions', 'fail', `Pending migrations need extension(s) that ${parts.join('; ')}`, ExtensionRemediation(session, [...notAllowlisted, ...needsAdmin]), extensionNotes(unavailable, notAllowlisted, allowlist ?? []));
72
+ }
73
+ /** Non-SQL fixes: install packages, or extend the Azure allowlist. */
74
+ function extensionNotes(unavailable, notAllowlisted, allowlist) {
75
+ const notes = [];
76
+ if (unavailable.length > 0) {
77
+ notes.push(`Install the server package that provides ${unavailable.join(', ')}, or use a host that offers it.`);
78
+ }
79
+ if (notAllowlisted.length > 0) {
80
+ const merged = [...new Set([...allowlist, ...notAllowlisted.map((n) => n.toLowerCase())])].join(',');
81
+ notes.push(`Add ${notAllowlisted.join(', ')} to the azure.extensions server parameter before running the SQL below, for example: ` +
82
+ `az postgres flexible-server parameter set --resource-group <rg> --server-name <server> --name azure.extensions --value "${merged}"`);
83
+ }
84
+ return notes;
85
+ }
86
+ //# sourceMappingURL=extension-check.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extension-check.js","sourceRoot":"","sources":["../../../src/lib/pg-preflight/extension-check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAarD,gGAAgG;AAChG,KAAK,UAAU,kBAAkB,CAAC,MAA8B,EAAE,QAA2B;IAC3F,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,KAAK,CAC7B;;;qCAGiC,EACjC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAChB,CAAC;IACF,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,KAAK,CAA+B,iEAAiE,CAAC,CAAC;IAClI,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,SAAS,IAAI,IAAI,CAAC,EAAE,CAAC;AAChF,CAAC;AAED,+FAA+F;AAC/F,MAAM,UAAU,cAAc,CAAC,KAAoB;IACjD,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAChC,OAAO,KAAK;SACT,KAAK,CAAC,GAAG,CAAC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 @@
1
+ /**
2
+ * Finds the PostgreSQL extensions a set of migration scripts will `CREATE`.
3
+ *
4
+ * @module lib/pg-preflight/extension-scan
5
+ */
6
+ /**
7
+ * Returns the extension names the scripts create, de-duplicated, in first-seen order.
8
+ * Quoted names keep their case; bare names fold to lower case, as PostgreSQL does.
9
+ *
10
+ * @param scripts - Migration SQL texts (placeholder substitution is not needed).
11
+ */
12
+ export declare function ExtractCreatedExtensions(scripts: Iterable<string>): string[];
13
+ /**
14
+ * Returns which of the candidate group roles the scripts reference (in a GRANT, an
15
+ * `ALTER DEFAULT PRIVILEGES … TO`, a policy, …), in candidate order. Only those must exist
16
+ * before the migrations run: requiring the installer's full list would fail databases that
17
+ * a set of migrations never grants to (no shipped migration references `cdp_BI` or
18
+ * `cdp_CodeGen`, for example).
19
+ *
20
+ * @param scripts - Migration SQL texts.
21
+ * @param candidates - The role names to look for (the installer's `POSTGRES_MJ_GROUP_ROLES`).
22
+ */
23
+ export declare function ExtractReferencedRoles(scripts: Iterable<string>, candidates: readonly string[]): string[];
24
+ //# sourceMappingURL=extension-scan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extension-scan.d.ts","sourceRoot":"","sources":["../../../src/lib/pg-preflight/extension-scan.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAYH;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,MAAM,EAAE,CAQ5E;AAaD;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAGzG"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Finds the PostgreSQL extensions a set of migration scripts will `CREATE`.
3
+ *
4
+ * @module lib/pg-preflight/extension-scan
5
+ */
6
+ /**
7
+ * `CREATE EXTENSION [IF NOT EXISTS] name`, where the name is a quoted identifier or a bare one.
8
+ * Group 1 is a quoted name (with `""` escapes), group 2 a bare name.
9
+ */
10
+ const CREATE_EXTENSION_PATTERN = /\bCREATE\s+EXTENSION\s+(?:IF\s+NOT\s+EXISTS\s+)?(?:"((?:[^"]|"")+)"|([A-Za-z_][A-Za-z0-9_$-]*))/gi;
11
+ /** Line comments and block comments, removed before scanning so commented-out statements don't count. */
12
+ const LINE_COMMENT_PATTERN = /--[^\n]*/g;
13
+ const BLOCK_COMMENT_PATTERN = /\/\*[\s\S]*?\*\//g;
14
+ /**
15
+ * Returns the extension names the scripts create, de-duplicated, in first-seen order.
16
+ * Quoted names keep their case; bare names fold to lower case, as PostgreSQL does.
17
+ *
18
+ * @param scripts - Migration SQL texts (placeholder substitution is not needed).
19
+ */
20
+ export function ExtractCreatedExtensions(scripts) {
21
+ const found = new Set();
22
+ for (const script of scripts) {
23
+ for (const name of extensionsInScript(script)) {
24
+ found.add(name);
25
+ }
26
+ }
27
+ return [...found];
28
+ }
29
+ /** The extension names one script creates, in order of appearance. */
30
+ function extensionsInScript(script) {
31
+ const code = script.replace(BLOCK_COMMENT_PATTERN, ' ').replace(LINE_COMMENT_PATTERN, ' ');
32
+ const names = [];
33
+ for (const match of code.matchAll(CREATE_EXTENSION_PATTERN)) {
34
+ const quoted = match[1];
35
+ names.push(quoted !== undefined ? quoted.replace(/""/g, '"') : match[2].toLowerCase());
36
+ }
37
+ return names;
38
+ }
39
+ /**
40
+ * Returns which of the candidate group roles the scripts reference (in a GRANT, an
41
+ * `ALTER DEFAULT PRIVILEGES … TO`, a policy, …), in candidate order. Only those must exist
42
+ * before the migrations run: requiring the installer's full list would fail databases that
43
+ * a set of migrations never grants to (no shipped migration references `cdp_BI` or
44
+ * `cdp_CodeGen`, for example).
45
+ *
46
+ * @param scripts - Migration SQL texts.
47
+ * @param candidates - The role names to look for (the installer's `POSTGRES_MJ_GROUP_ROLES`).
48
+ */
49
+ export function ExtractReferencedRoles(scripts, candidates) {
50
+ const code = [...scripts].map((s) => s.replace(BLOCK_COMMENT_PATTERN, ' ').replace(LINE_COMMENT_PATTERN, ' ')).join('\n');
51
+ return candidates.filter((role) => roleReferencePattern(role).test(code));
52
+ }
53
+ /** Matches a role name quoted (`"cdp_UI"`) or bare, as a whole identifier. */
54
+ function roleReferencePattern(role) {
55
+ const escaped = role.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
56
+ return new RegExp(`"${escaped}"|(?<![A-Za-z0-9_$"])${escaped}(?![A-Za-z0-9_$"])`, 'i');
57
+ }
58
+ //# sourceMappingURL=extension-scan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extension-scan.js","sourceRoot":"","sources":["../../../src/lib/pg-preflight/extension-scan.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,wBAAwB,GAAG,mGAAmG,CAAC;AAErI,yGAAyG;AACzG,MAAM,oBAAoB,GAAG,WAAW,CAAC;AACzC,MAAM,qBAAqB,GAAG,mBAAmB,CAAC;AAElD;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAAyB;IAChE,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAChC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,KAAK,MAAM,IAAI,IAAI,kBAAkB,CAAC,MAAM,CAAC,EAAE,CAAC;YAC9C,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;IACD,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC;AACpB,CAAC;AAED,sEAAsE;AACtE,SAAS,kBAAkB,CAAC,MAAc;IACxC,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,qBAAqB,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,oBAAoB,EAAE,GAAG,CAAC,CAAC;IAC3F,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,wBAAw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