@endora-commerce/cli 0.100.0

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 (356) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +37 -0
  3. package/dist/bin/endora.d.ts +28 -0
  4. package/dist/bin/endora.d.ts.map +1 -0
  5. package/dist/bin/endora.js +926 -0
  6. package/dist/bin/endora.js.map +1 -0
  7. package/dist/check/estate.d.ts +189 -0
  8. package/dist/check/estate.d.ts.map +1 -0
  9. package/dist/check/estate.js +1037 -0
  10. package/dist/check/estate.js.map +1 -0
  11. package/dist/check/hosts.d.ts +25 -0
  12. package/dist/check/hosts.d.ts.map +1 -0
  13. package/dist/check/hosts.js +1347 -0
  14. package/dist/check/hosts.js.map +1 -0
  15. package/dist/check/index.d.ts +60 -0
  16. package/dist/check/index.d.ts.map +1 -0
  17. package/dist/check/index.js +111 -0
  18. package/dist/check/index.js.map +1 -0
  19. package/dist/check/layout.d.ts +136 -0
  20. package/dist/check/layout.d.ts.map +1 -0
  21. package/dist/check/layout.js +262 -0
  22. package/dist/check/layout.js.map +1 -0
  23. package/dist/check/ledger.d.ts +98 -0
  24. package/dist/check/ledger.d.ts.map +1 -0
  25. package/dist/check/ledger.js +173 -0
  26. package/dist/check/ledger.js.map +1 -0
  27. package/dist/check/peer-owners.d.ts +116 -0
  28. package/dist/check/peer-owners.d.ts.map +1 -0
  29. package/dist/check/peer-owners.js +225 -0
  30. package/dist/check/peer-owners.js.map +1 -0
  31. package/dist/check/report.d.ts +33 -0
  32. package/dist/check/report.d.ts.map +1 -0
  33. package/dist/check/report.js +107 -0
  34. package/dist/check/report.js.map +1 -0
  35. package/dist/check/run.d.ts +147 -0
  36. package/dist/check/run.d.ts.map +1 -0
  37. package/dist/check/run.js +111 -0
  38. package/dist/check/run.js.map +1 -0
  39. package/dist/checks.d.ts +17 -0
  40. package/dist/checks.d.ts.map +1 -0
  41. package/dist/checks.js +17 -0
  42. package/dist/checks.js.map +1 -0
  43. package/dist/dev/index.d.ts +83 -0
  44. package/dist/dev/index.d.ts.map +1 -0
  45. package/dist/dev/index.js +298 -0
  46. package/dist/dev/index.js.map +1 -0
  47. package/dist/generate/divergence.d.ts +38 -0
  48. package/dist/generate/divergence.d.ts.map +1 -0
  49. package/dist/generate/divergence.js +237 -0
  50. package/dist/generate/divergence.js.map +1 -0
  51. package/dist/generate/index.d.ts +90 -0
  52. package/dist/generate/index.d.ts.map +1 -0
  53. package/dist/generate/index.js +369 -0
  54. package/dist/generate/index.js.map +1 -0
  55. package/dist/index.d.ts +23 -0
  56. package/dist/index.d.ts.map +1 -0
  57. package/dist/index.js +35 -0
  58. package/dist/index.js.map +1 -0
  59. package/dist/inputs/declaration.d.ts +18 -0
  60. package/dist/inputs/declaration.d.ts.map +1 -0
  61. package/dist/inputs/declaration.js +64 -0
  62. package/dist/inputs/declaration.js.map +1 -0
  63. package/dist/inputs/env-file.d.ts +73 -0
  64. package/dist/inputs/env-file.d.ts.map +1 -0
  65. package/dist/inputs/env-file.js +134 -0
  66. package/dist/inputs/env-file.js.map +1 -0
  67. package/dist/inputs/prompt.d.ts +21 -0
  68. package/dist/inputs/prompt.d.ts.map +1 -0
  69. package/dist/inputs/prompt.js +59 -0
  70. package/dist/inputs/prompt.js.map +1 -0
  71. package/dist/inputs/resolve.d.ts +163 -0
  72. package/dist/inputs/resolve.d.ts.map +1 -0
  73. package/dist/inputs/resolve.js +290 -0
  74. package/dist/inputs/resolve.js.map +1 -0
  75. package/dist/install/host.d.ts +27 -0
  76. package/dist/install/host.d.ts.map +1 -0
  77. package/dist/install/host.js +90 -0
  78. package/dist/install/host.js.map +1 -0
  79. package/dist/install/index.d.ts +173 -0
  80. package/dist/install/index.d.ts.map +1 -0
  81. package/dist/install/index.js +793 -0
  82. package/dist/install/index.js.map +1 -0
  83. package/dist/install/wizard.d.ts +144 -0
  84. package/dist/install/wizard.d.ts.map +1 -0
  85. package/dist/install/wizard.js +362 -0
  86. package/dist/install/wizard.js.map +1 -0
  87. package/dist/lib/admin-artefacts.d.ts +70 -0
  88. package/dist/lib/admin-artefacts.d.ts.map +1 -0
  89. package/dist/lib/admin-artefacts.js +354 -0
  90. package/dist/lib/admin-artefacts.js.map +1 -0
  91. package/dist/lib/admin-surfaces.d.ts +298 -0
  92. package/dist/lib/admin-surfaces.d.ts.map +1 -0
  93. package/dist/lib/admin-surfaces.js +669 -0
  94. package/dist/lib/admin-surfaces.js.map +1 -0
  95. package/dist/lib/delegated-composer.d.ts +85 -0
  96. package/dist/lib/delegated-composer.d.ts.map +1 -0
  97. package/dist/lib/delegated-composer.js +241 -0
  98. package/dist/lib/delegated-composer.js.map +1 -0
  99. package/dist/lib/divergence-artefacts.d.ts +305 -0
  100. package/dist/lib/divergence-artefacts.d.ts.map +1 -0
  101. package/dist/lib/divergence-artefacts.js +828 -0
  102. package/dist/lib/divergence-artefacts.js.map +1 -0
  103. package/dist/lib/divergence.d.ts +337 -0
  104. package/dist/lib/divergence.d.ts.map +1 -0
  105. package/dist/lib/divergence.js +1005 -0
  106. package/dist/lib/divergence.js.map +1 -0
  107. package/dist/lib/docs-artefacts.d.ts +395 -0
  108. package/dist/lib/docs-artefacts.d.ts.map +1 -0
  109. package/dist/lib/docs-artefacts.js +781 -0
  110. package/dist/lib/docs-artefacts.js.map +1 -0
  111. package/dist/lib/emitted-exports.d.ts +21 -0
  112. package/dist/lib/emitted-exports.d.ts.map +1 -0
  113. package/dist/lib/emitted-exports.js +96 -0
  114. package/dist/lib/emitted-exports.js.map +1 -0
  115. package/dist/lib/emitted-freshness.d.ts +112 -0
  116. package/dist/lib/emitted-freshness.d.ts.map +1 -0
  117. package/dist/lib/emitted-freshness.js +288 -0
  118. package/dist/lib/emitted-freshness.js.map +1 -0
  119. package/dist/lib/entity-index-artefact.d.ts +95 -0
  120. package/dist/lib/entity-index-artefact.d.ts.map +1 -0
  121. package/dist/lib/entity-index-artefact.js +210 -0
  122. package/dist/lib/entity-index-artefact.js.map +1 -0
  123. package/dist/lib/instance-build-inputs.d.ts +108 -0
  124. package/dist/lib/instance-build-inputs.d.ts.map +1 -0
  125. package/dist/lib/instance-build-inputs.js +165 -0
  126. package/dist/lib/instance-build-inputs.js.map +1 -0
  127. package/dist/lib/module-docs.d.ts +473 -0
  128. package/dist/lib/module-docs.d.ts.map +1 -0
  129. package/dist/lib/module-docs.js +711 -0
  130. package/dist/lib/module-docs.js.map +1 -0
  131. package/dist/lib/module-package-subpaths.d.ts +56 -0
  132. package/dist/lib/module-package-subpaths.d.ts.map +1 -0
  133. package/dist/lib/module-package-subpaths.js +223 -0
  134. package/dist/lib/module-package-subpaths.js.map +1 -0
  135. package/dist/lib/module-packages.d.ts +200 -0
  136. package/dist/lib/module-packages.d.ts.map +1 -0
  137. package/dist/lib/module-packages.js +580 -0
  138. package/dist/lib/module-packages.js.map +1 -0
  139. package/dist/lib/module-population.d.ts +129 -0
  140. package/dist/lib/module-population.d.ts.map +1 -0
  141. package/dist/lib/module-population.js +172 -0
  142. package/dist/lib/module-population.js.map +1 -0
  143. package/dist/lib/module-roots.d.ts +337 -0
  144. package/dist/lib/module-roots.d.ts.map +1 -0
  145. package/dist/lib/module-roots.js +586 -0
  146. package/dist/lib/module-roots.js.map +1 -0
  147. package/dist/lib/nested-checkouts.d.ts +33 -0
  148. package/dist/lib/nested-checkouts.d.ts.map +1 -0
  149. package/dist/lib/nested-checkouts.js +160 -0
  150. package/dist/lib/nested-checkouts.js.map +1 -0
  151. package/dist/lib/platform-root.d.ts +43 -0
  152. package/dist/lib/platform-root.d.ts.map +1 -0
  153. package/dist/lib/platform-root.js +134 -0
  154. package/dist/lib/platform-root.js.map +1 -0
  155. package/dist/lib/platform-surface.d.ts +235 -0
  156. package/dist/lib/platform-surface.d.ts.map +1 -0
  157. package/dist/lib/platform-surface.js +393 -0
  158. package/dist/lib/platform-surface.js.map +1 -0
  159. package/dist/lib/port-registrations.d.ts +223 -0
  160. package/dist/lib/port-registrations.d.ts.map +1 -0
  161. package/dist/lib/port-registrations.js +532 -0
  162. package/dist/lib/port-registrations.js.map +1 -0
  163. package/dist/lib/read-size.d.ts +154 -0
  164. package/dist/lib/read-size.d.ts.map +1 -0
  165. package/dist/lib/read-size.js +182 -0
  166. package/dist/lib/read-size.js.map +1 -0
  167. package/dist/lib/registration-owners.d.ts +79 -0
  168. package/dist/lib/registration-owners.d.ts.map +1 -0
  169. package/dist/lib/registration-owners.js +77 -0
  170. package/dist/lib/registration-owners.js.map +1 -0
  171. package/dist/lib/release-index.d.ts +53 -0
  172. package/dist/lib/release-index.d.ts.map +1 -0
  173. package/dist/lib/release-index.js +162 -0
  174. package/dist/lib/release-index.js.map +1 -0
  175. package/dist/lib/repeating-timers.d.ts +79 -0
  176. package/dist/lib/repeating-timers.d.ts.map +1 -0
  177. package/dist/lib/repeating-timers.js +189 -0
  178. package/dist/lib/repeating-timers.js.map +1 -0
  179. package/dist/lib/source-text.d.ts +34 -0
  180. package/dist/lib/source-text.d.ts.map +1 -0
  181. package/dist/lib/source-text.js +80 -0
  182. package/dist/lib/source-text.js.map +1 -0
  183. package/dist/lib/specifiers.d.ts +20 -0
  184. package/dist/lib/specifiers.d.ts.map +1 -0
  185. package/dist/lib/specifiers.js +130 -0
  186. package/dist/lib/specifiers.js.map +1 -0
  187. package/dist/lib/sql-tables.d.ts +166 -0
  188. package/dist/lib/sql-tables.d.ts.map +1 -0
  189. package/dist/lib/sql-tables.js +464 -0
  190. package/dist/lib/sql-tables.js.map +1 -0
  191. package/dist/lib/switchable-modules.d.ts +54 -0
  192. package/dist/lib/switchable-modules.d.ts.map +1 -0
  193. package/dist/lib/switchable-modules.js +104 -0
  194. package/dist/lib/switchable-modules.js.map +1 -0
  195. package/dist/lib/tailwind-sources.d.ts +136 -0
  196. package/dist/lib/tailwind-sources.d.ts.map +1 -0
  197. package/dist/lib/tailwind-sources.js +307 -0
  198. package/dist/lib/tailwind-sources.js.map +1 -0
  199. package/dist/lib/ui-layer.d.ts +54 -0
  200. package/dist/lib/ui-layer.d.ts.map +1 -0
  201. package/dist/lib/ui-layer.js +57 -0
  202. package/dist/lib/ui-layer.js.map +1 -0
  203. package/dist/lib/workspace-packages.d.ts +186 -0
  204. package/dist/lib/workspace-packages.d.ts.map +1 -0
  205. package/dist/lib/workspace-packages.js +351 -0
  206. package/dist/lib/workspace-packages.js.map +1 -0
  207. package/dist/new-instance/deploy.d.ts +211 -0
  208. package/dist/new-instance/deploy.d.ts.map +1 -0
  209. package/dist/new-instance/deploy.js +1381 -0
  210. package/dist/new-instance/deploy.js.map +1 -0
  211. package/dist/new-instance/docs-toolchain.d.ts +66 -0
  212. package/dist/new-instance/docs-toolchain.d.ts.map +1 -0
  213. package/dist/new-instance/docs-toolchain.js +69 -0
  214. package/dist/new-instance/docs-toolchain.js.map +1 -0
  215. package/dist/new-instance/host.d.ts +124 -0
  216. package/dist/new-instance/host.d.ts.map +1 -0
  217. package/dist/new-instance/host.js +276 -0
  218. package/dist/new-instance/host.js.map +1 -0
  219. package/dist/new-instance/index.d.ts +118 -0
  220. package/dist/new-instance/index.d.ts.map +1 -0
  221. package/dist/new-instance/index.js +567 -0
  222. package/dist/new-instance/index.js.map +1 -0
  223. package/dist/new-instance/modules.d.ts +188 -0
  224. package/dist/new-instance/modules.d.ts.map +1 -0
  225. package/dist/new-instance/modules.js +392 -0
  226. package/dist/new-instance/modules.js.map +1 -0
  227. package/dist/new-instance/template.d.ts +505 -0
  228. package/dist/new-instance/template.d.ts.map +1 -0
  229. package/dist/new-instance/template.js +1886 -0
  230. package/dist/new-instance/template.js.map +1 -0
  231. package/dist/new-module/emit.d.ts +67 -0
  232. package/dist/new-module/emit.d.ts.map +1 -0
  233. package/dist/new-module/emit.js +1393 -0
  234. package/dist/new-module/emit.js.map +1 -0
  235. package/dist/new-module/host.d.ts +67 -0
  236. package/dist/new-module/host.d.ts.map +1 -0
  237. package/dist/new-module/host.js +224 -0
  238. package/dist/new-module/host.js.map +1 -0
  239. package/dist/new-module/index.d.ts +32 -0
  240. package/dist/new-module/index.d.ts.map +1 -0
  241. package/dist/new-module/index.js +193 -0
  242. package/dist/new-module/index.js.map +1 -0
  243. package/dist/new-module/spec.d.ts +188 -0
  244. package/dist/new-module/spec.d.ts.map +1 -0
  245. package/dist/new-module/spec.js +404 -0
  246. package/dist/new-module/spec.js.map +1 -0
  247. package/dist/new-module/text.d.ts +15 -0
  248. package/dist/new-module/text.d.ts.map +1 -0
  249. package/dist/new-module/text.js +22 -0
  250. package/dist/new-module/text.js.map +1 -0
  251. package/dist/new-storefront/dockerfile.d.ts +20 -0
  252. package/dist/new-storefront/dockerfile.d.ts.map +1 -0
  253. package/dist/new-storefront/dockerfile.js +131 -0
  254. package/dist/new-storefront/dockerfile.js.map +1 -0
  255. package/dist/new-storefront/gitignore.d.ts +23 -0
  256. package/dist/new-storefront/gitignore.d.ts.map +1 -0
  257. package/dist/new-storefront/gitignore.js +39 -0
  258. package/dist/new-storefront/gitignore.js.map +1 -0
  259. package/dist/new-storefront/index.d.ts +93 -0
  260. package/dist/new-storefront/index.d.ts.map +1 -0
  261. package/dist/new-storefront/index.js +329 -0
  262. package/dist/new-storefront/index.js.map +1 -0
  263. package/dist/new-storefront/npmrc.d.ts +98 -0
  264. package/dist/new-storefront/npmrc.d.ts.map +1 -0
  265. package/dist/new-storefront/npmrc.js +217 -0
  266. package/dist/new-storefront/npmrc.js.map +1 -0
  267. package/dist/new-storefront/reference.d.ts +189 -0
  268. package/dist/new-storefront/reference.d.ts.map +1 -0
  269. package/dist/new-storefront/reference.js +430 -0
  270. package/dist/new-storefront/reference.js.map +1 -0
  271. package/dist/new-storefront/rewrite.d.ts +171 -0
  272. package/dist/new-storefront/rewrite.d.ts.map +1 -0
  273. package/dist/new-storefront/rewrite.js +701 -0
  274. package/dist/new-storefront/rewrite.js.map +1 -0
  275. package/dist/release-index.json +284 -0
  276. package/dist/rules/action-route-permissions.d.ts +141 -0
  277. package/dist/rules/action-route-permissions.d.ts.map +1 -0
  278. package/dist/rules/action-route-permissions.js +556 -0
  279. package/dist/rules/action-route-permissions.js.map +1 -0
  280. package/dist/rules/bundle-pairing.d.ts +74 -0
  281. package/dist/rules/bundle-pairing.d.ts.map +1 -0
  282. package/dist/rules/bundle-pairing.js +281 -0
  283. package/dist/rules/bundle-pairing.js.map +1 -0
  284. package/dist/rules/channel-resolution.d.ts +17 -0
  285. package/dist/rules/channel-resolution.d.ts.map +1 -0
  286. package/dist/rules/channel-resolution.js +382 -0
  287. package/dist/rules/channel-resolution.js.map +1 -0
  288. package/dist/rules/command-coverage.d.ts +210 -0
  289. package/dist/rules/command-coverage.d.ts.map +1 -0
  290. package/dist/rules/command-coverage.js +714 -0
  291. package/dist/rules/command-coverage.js.map +1 -0
  292. package/dist/rules/container-imports.d.ts +60 -0
  293. package/dist/rules/container-imports.d.ts.map +1 -0
  294. package/dist/rules/container-imports.js +158 -0
  295. package/dist/rules/container-imports.js.map +1 -0
  296. package/dist/rules/default-language-prose.d.ts +212 -0
  297. package/dist/rules/default-language-prose.d.ts.map +1 -0
  298. package/dist/rules/default-language-prose.js +710 -0
  299. package/dist/rules/default-language-prose.js.map +1 -0
  300. package/dist/rules/diacritic-folds.d.ts +238 -0
  301. package/dist/rules/diacritic-folds.d.ts.map +1 -0
  302. package/dist/rules/diacritic-folds.js +681 -0
  303. package/dist/rules/diacritic-folds.js.map +1 -0
  304. package/dist/rules/entity-tenant-classification.d.ts +171 -0
  305. package/dist/rules/entity-tenant-classification.d.ts.map +1 -0
  306. package/dist/rules/entity-tenant-classification.js +323 -0
  307. package/dist/rules/entity-tenant-classification.js.map +1 -0
  308. package/dist/rules/entry-presence.d.ts +142 -0
  309. package/dist/rules/entry-presence.d.ts.map +1 -0
  310. package/dist/rules/entry-presence.js +339 -0
  311. package/dist/rules/entry-presence.js.map +1 -0
  312. package/dist/rules/entry-scope.d.ts +91 -0
  313. package/dist/rules/entry-scope.d.ts.map +1 -0
  314. package/dist/rules/entry-scope.js +404 -0
  315. package/dist/rules/entry-scope.js.map +1 -0
  316. package/dist/rules/env-inputs.d.ts +222 -0
  317. package/dist/rules/env-inputs.d.ts.map +1 -0
  318. package/dist/rules/env-inputs.js +951 -0
  319. package/dist/rules/env-inputs.js.map +1 -0
  320. package/dist/rules/kernel-boundary.d.ts +37 -0
  321. package/dist/rules/kernel-boundary.d.ts.map +1 -0
  322. package/dist/rules/kernel-boundary.js +195 -0
  323. package/dist/rules/kernel-boundary.js.map +1 -0
  324. package/dist/rules/nul-bytes.d.ts +233 -0
  325. package/dist/rules/nul-bytes.d.ts.map +1 -0
  326. package/dist/rules/nul-bytes.js +332 -0
  327. package/dist/rules/nul-bytes.js.map +1 -0
  328. package/dist/rules/platform-surface.d.ts +479 -0
  329. package/dist/rules/platform-surface.d.ts.map +1 -0
  330. package/dist/rules/platform-surface.js +749 -0
  331. package/dist/rules/platform-surface.js.map +1 -0
  332. package/dist/rules/port-catches.d.ts +225 -0
  333. package/dist/rules/port-catches.d.ts.map +1 -0
  334. package/dist/rules/port-catches.js +1374 -0
  335. package/dist/rules/port-catches.js.map +1 -0
  336. package/dist/rules/port-shape.d.ts +213 -0
  337. package/dist/rules/port-shape.d.ts.map +1 -0
  338. package/dist/rules/port-shape.js +670 -0
  339. package/dist/rules/port-shape.js.map +1 -0
  340. package/dist/rules/queue-names.d.ts +108 -0
  341. package/dist/rules/queue-names.d.ts.map +1 -0
  342. package/dist/rules/queue-names.js +395 -0
  343. package/dist/rules/queue-names.js.map +1 -0
  344. package/dist/rules/singleton-identity.d.ts +205 -0
  345. package/dist/rules/singleton-identity.d.ts.map +1 -0
  346. package/dist/rules/singleton-identity.js +830 -0
  347. package/dist/rules/singleton-identity.js.map +1 -0
  348. package/dist/rules/subscribe-seam.d.ts +121 -0
  349. package/dist/rules/subscribe-seam.d.ts.map +1 -0
  350. package/dist/rules/subscribe-seam.js +594 -0
  351. package/dist/rules/subscribe-seam.js.map +1 -0
  352. package/dist/rules/transaction-context.d.ts +40 -0
  353. package/dist/rules/transaction-context.d.ts.map +1 -0
  354. package/dist/rules/transaction-context.js +294 -0
  355. package/dist/rules/transaction-context.js.map +1 -0
  356. package/package.json +59 -0
@@ -0,0 +1,130 @@
1
+ /**
2
+ * Every module specifier a TypeScript source names, in every shape a specifier
3
+ * can take.
4
+ *
5
+ * Extracted from `check-kernel-boundary.ts` (feature 075, MR-0) rather than
6
+ * written fresh: two independently written walkers drift, and the shape one
7
+ * forgets is the shape the next violation uses. `check-kernel-boundary.ts` and
8
+ * `check-module-boundary.ts` police opposite directions across the same
9
+ * boundary, so a specifier that is invisible to one of them is a hole in both.
10
+ *
11
+ * The eight shapes, and why each is here rather than assumed away:
12
+ *
13
+ * - `value-import` `import { X } from '…'`
14
+ * - `type-only-import` `import type { X } from '…'` — erased at runtime and
15
+ * still a real edge: types resolve at build time, and
16
+ * ESLint's `prefer: 'type-imports'` rewrites value
17
+ * imports into this shape automatically.
18
+ * - `mixed-type-specifier` `import { type A, B } from '…'` — a *value* import
19
+ * whose first specifier is typed. A classifier that
20
+ * reads the first token calls it type-only; one that
21
+ * requires every specifier to be typed calls it a
22
+ * value import. Both are edges, so the kind records
23
+ * which reading was taken instead of hiding it.
24
+ * - `re-export` `export { X } from '…'` / `export * from '…'`
25
+ * - `side-effect-import` `import '…'`
26
+ * - `dynamic-import` `await import('…')` — invisible to a reviewer
27
+ * scanning the import block, and to a bundler.
28
+ * - `require-call` `require('…')`
29
+ * - `import-type-node` `let x: import('…').T` — erased by tsc, permitted by
30
+ * this repository's ESLint config
31
+ * (`disallowTypeAnnotations: false`), and invisible to
32
+ * a check that only walks import declarations.
33
+ *
34
+ * Static analysis through the TypeScript compiler API, so a specifier mentioned
35
+ * in a comment or in a string literal is not a finding.
36
+ */
37
+ import ts from 'typescript';
38
+ function importBindings(node) {
39
+ if (ts.isImportDeclaration(node)) {
40
+ const clause = node.importClause;
41
+ if (!clause)
42
+ return [];
43
+ const names = [];
44
+ if (clause.name)
45
+ names.push(clause.name.text);
46
+ const bound = clause.namedBindings;
47
+ if (bound) {
48
+ if (ts.isNamespaceImport(bound))
49
+ names.push(`* as ${bound.name.text}`);
50
+ else
51
+ for (const element of bound.elements)
52
+ names.push(element.name.text);
53
+ }
54
+ return names;
55
+ }
56
+ if (ts.isExportDeclaration(node)) {
57
+ const clause = node.exportClause;
58
+ if (!clause)
59
+ return ['*'];
60
+ if (ts.isNamespaceExport(clause))
61
+ return [`* as ${clause.name.text}`];
62
+ return clause.elements.map((element) => element.name.text);
63
+ }
64
+ return [];
65
+ }
66
+ /**
67
+ * Which of the four import-declaration shapes this is.
68
+ *
69
+ * A declaration with no import clause takes nothing and is therefore a
70
+ * side-effect import; `import type` marks the clause; `import { type A, B }`
71
+ * marks individual elements, which is the shape a first-token classifier gets
72
+ * wrong.
73
+ */
74
+ function importDeclarationKind(node) {
75
+ const clause = node.importClause;
76
+ if (!clause)
77
+ return 'side-effect-import';
78
+ if (clause.isTypeOnly)
79
+ return 'type-only-import';
80
+ const bound = clause.namedBindings;
81
+ if (bound && ts.isNamedImports(bound) && bound.elements.some((element) => element.isTypeOnly)) {
82
+ return 'mixed-type-specifier';
83
+ }
84
+ return 'value-import';
85
+ }
86
+ /**
87
+ * Every module specifier `source` names, in source order.
88
+ *
89
+ * `file` is used only for the source-file name the compiler API wants and for
90
+ * line numbers; nothing here touches disk, so a caller may pass a path that does
91
+ * not exist — which is what lets both checks' fixtures enter at the top.
92
+ */
93
+ export function namedSpecifiers(source, file) {
94
+ const sf = ts.createSourceFile(file, source, ts.ScriptTarget.Latest, true);
95
+ const found = [];
96
+ const record = (specifier, kind, bindings) => {
97
+ found.push({
98
+ text: specifier.text,
99
+ kind,
100
+ bindings,
101
+ line: sf.getLineAndCharacterOfPosition(specifier.getStart(sf)).line + 1,
102
+ });
103
+ };
104
+ const visit = (node) => {
105
+ if ((ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) &&
106
+ node.moduleSpecifier &&
107
+ ts.isStringLiteral(node.moduleSpecifier)) {
108
+ record(node.moduleSpecifier, ts.isImportDeclaration(node) ? importDeclarationKind(node) : 're-export', importBindings(node));
109
+ }
110
+ if (ts.isCallExpression(node)) {
111
+ const callee = node.expression;
112
+ const isDynamicImport = callee.kind === ts.SyntaxKind.ImportKeyword;
113
+ const isRequire = ts.isIdentifier(callee) && callee.text === 'require';
114
+ const [first] = node.arguments;
115
+ if ((isDynamicImport || isRequire) && first && ts.isStringLiteral(first)) {
116
+ record(first, isDynamicImport ? 'dynamic-import' : 'require-call', []);
117
+ }
118
+ }
119
+ if (ts.isImportTypeNode(node)) {
120
+ const argument = node.argument;
121
+ if (ts.isLiteralTypeNode(argument) && ts.isStringLiteral(argument.literal)) {
122
+ record(argument.literal, 'import-type-node', node.qualifier ? [node.qualifier.getText(sf)] : []);
123
+ }
124
+ }
125
+ node.forEachChild(visit);
126
+ };
127
+ sf.forEachChild(visit);
128
+ return found;
129
+ }
130
+ //# sourceMappingURL=specifiers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"specifiers.js","sourceRoot":"","sources":["../../src/lib/specifiers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,OAAO,EAAE,MAAM,YAAY,CAAC;AAuB5B,SAAS,cAAc,CAAC,IAAa;IACnC,IAAI,EAAE,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC;QACjC,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC;QACjC,IAAI,CAAC,MAAM;YAAE,OAAO,EAAE,CAAC;QACvB,MAAM,KAAK,GAAa,EAAE,CAAC;QAC3B,IAAI,MAAM,CAAC,IAAI;YAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC9C,MAAM,KAAK,GAAG,MAAM,CAAC,aAAa,CAAC;QACnC,IAAI,KAAK,EAAE,CAAC;YACV,IAAI,EAAE,CAAC,iBAAiB,CAAC,KAAK,CAAC;gBAAE,KAAK,CAAC,IAAI,CAAC,QA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K,SAAS,CAAC;YACvE,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC;YAC/B,IAAI,CAAC,eAAe,IAAI,SAAS,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;gBACzE,MAAM,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;YACzE,CAAC;QACH,CAAC;QACD,IAAI,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9B,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;YAC/B,IAAI,EAAE,CAAC,iBAAiB,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,eAAe,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC3E,MAAM,CACJ,QAAQ,CAAC,OAAO,EAChB,kBAAkB,EAClB,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CACnD,CAAC;YACJ,CAAC;QACH,CAAC;QACD,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC,CAAC;IAEF,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IACvB,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,166 @@
1
+ /**
2
+ * SQL table identifiers, read out of TypeScript sources through the compiler
3
+ * API (feature 077, D-87).
4
+ *
5
+ * `check-module-boundary.ts` polices one rule — a module does not reach into
6
+ * another module's internals — through two predicates, and this file is the
7
+ * syntax half of the second one. The first predicate reads import specifiers
8
+ * (`lib/specifiers.ts`); a raw `select … from another_module_table` names no
9
+ * specifier at all, compiles, runs, and returns rows.
10
+ *
11
+ * Two extractions live here, and both are deliberately **syntactic only**:
12
+ * ownership is decided by the check, which is the file that knows what a module
13
+ * is.
14
+ *
15
+ * - {@link sqlTableAccesses} — the table identifiers a source *uses*, through
16
+ * two recognition paths: a **statement** literal, and a knex query
17
+ * **builder** (issue #187).
18
+ * - {@link declaredTableNames} — the table names a source *declares*, from an
19
+ * `@Entity()` class or from `create table` DDL. Both sources are needed: an
20
+ * owner map built from entity classes alone maps 220 tables and misses every
21
+ * join table and every channel bridge, which is 39 of the 157 findings the
22
+ * D-87 sweep measured — including the one carrying a live defect.
23
+ *
24
+ * ## Why this reads literal **nodes** and never source text
25
+ *
26
+ * The first spike for D-87 was a regex over source text. It hallucinated a dozen
27
+ * tables — `every`, `bumps`, `used`, `path` — because an apostrophe in an
28
+ * English comment opens a string literal that runs to the next apostrophe, and
29
+ * the prose in between parses as SQL often enough to matter. Reading
30
+ * `ts.StringLiteral` / template-literal nodes removes comments from the
31
+ * population by construction rather than by an exclusion someone has to
32
+ * maintain, which is why `sql-in-a-comment` is one of the check's red proofs.
33
+ *
34
+ * ## What a statement has to look like
35
+ *
36
+ * A literal joins the population when it *starts* with `select`, `insert into`,
37
+ * `update`, `delete from` or `with`, **and** carries the rest of that statement's
38
+ * skeleton: a `select` needs a `from`, an `update` needs a `set`, a `with` needs
39
+ * a `select`. The second half is not decoration — `'Update products in the
40
+ * catalog'` is English prose that a start-anchored test alone reads as an
41
+ * `UPDATE` against `products`, and a check that reports it teaches its readers
42
+ * to ignore it.
43
+ *
44
+ * ## What a builder has to look like (issue #187)
45
+ *
46
+ * A knex builder names its table as an **argument to a call**, so no statement
47
+ * literal exists to anchor on:
48
+ *
49
+ * ```ts
50
+ * await knexForStock('warehouse_channel_assignments as a')
51
+ * .join('warehouses as w', 'w.id', 'a.warehouse_id')
52
+ * ```
53
+ *
54
+ * Both tables are `inventory`'s, read from inside `orders`' placement
55
+ * transaction, and both predicates were blind to them — the import predicate
56
+ * because a builder names no specifier, the statement path because there is no
57
+ * statement. **Ten** such accesses, in six files, stood outside a `sql=111` that
58
+ * read as the whole coupling, which is exactly the "`violations=0` licenses a
59
+ * package split the tree has not earned" failure D-87 exists to end. The grep
60
+ * that raised the issue found seven; the three it missed are the aliasing object
61
+ * form (`knex({ p: 'products' })`) and two reaches into **kernel** tables, which
62
+ * is the argument for reading nodes rather than grepping a spelling.
63
+ *
64
+ * Two shapes are recognised, and the population is bounded twice over — by the
65
+ * argument position and by the check's table→owner map, which only knows real
66
+ * tables:
67
+ *
68
+ * - **{@link TABLE_ARGUMENT_METHODS}** — a string literal in the *first*
69
+ * argument of `from`, `into`, `table` or a member of the join family. The
70
+ * list is enumerated rather than "any string on any builder method" because
71
+ * `where('status', …)`, `select('id')` and `orderBy(…)` take **columns**: a
72
+ * column spelled like another module's table would flood the ledger and the
73
+ * check would be switched off. Only the first argument is read, because
74
+ * `join(table, first, second)`'s remaining arguments are column references.
75
+ * - **the knex callable itself** — `knex('products')`, which starts 36 of the
76
+ * tree's 43 builder queries over a known table and which is not a method
77
+ * call at all.
78
+ * Its callee carries no name to key on, so the identifier must be **bound to
79
+ * a `getKnex()` result in the same file**; nothing else opens that door.
80
+ *
81
+ * The method list is receiver-agnostic on purpose. `Array.prototype.join` and
82
+ * `path.join` share the `join` spelling, and the tree calls the first 238 times;
83
+ * what keeps them out is that their arguments (`', '`, a path segment) are not
84
+ * table names in the owner map. The alternative — requiring every builder chain
85
+ * to root syntactically in a knex binding — would refuse them by construction
86
+ * but go **silently** blind on the builder held in a variable or taken as a
87
+ * parameter, which `catalog-admin.service.ts` and `promotion-stats-service.ts`
88
+ * both do. A spelling collision is a visible finding a reader resolves; a
89
+ * receiver rule is a miss nobody sees, and this file's whole reason for existing
90
+ * is that the second kind of failure is the expensive one.
91
+ */
92
+ import ts from 'typescript';
93
+ /** Which way the statement moves rows through the table it names. */
94
+ export type SqlAccessDirection = 'read' | 'write';
95
+ /**
96
+ * Which recognition path named the table — a SQL statement literal, or a knex
97
+ * query builder (issue #187).
98
+ *
99
+ * Carried on the finding so a red proof can assert the path it is testing: a
100
+ * builder proof that only checked the table would go green off the statement
101
+ * path, which is how a new signal goes blind behind an existing one's red
102
+ * (issue #130).
103
+ */
104
+ export type SqlAccessSyntax = 'statement' | 'builder';
105
+ /** One table identifier a SQL literal or a query builder names. */
106
+ export interface SqlTableAccess {
107
+ /** The identifier, lower-cased, alias and schema qualifier stripped. */
108
+ readonly table: string;
109
+ readonly direction: SqlAccessDirection;
110
+ readonly syntax: SqlAccessSyntax;
111
+ /** 1-based line of the literal that names it. */
112
+ readonly line: number;
113
+ /** The head of the statement, or of the builder chain, for the message. */
114
+ readonly statement: string;
115
+ }
116
+ /** Where a table name was declared — the two owner-map sources. */
117
+ export type TableDeclarationSource = 'entity' | 'migration';
118
+ /** One table name a source declares. */
119
+ export interface TableDeclaration {
120
+ readonly table: string;
121
+ readonly source: TableDeclarationSource;
122
+ }
123
+ /**
124
+ * Every table identifier `source` names, through either recognition path.
125
+ *
126
+ * `file` is used for the source-file name the compiler API wants and for line
127
+ * numbers only; nothing here touches disk, so a caller may pass a path that does
128
+ * not exist. That is what lets the check's red proofs enter here, with source
129
+ * text, rather than below with a resolved table list.
130
+ */
131
+ export declare function sqlTableAccesses(source: string, file: string): SqlTableAccess[];
132
+ /**
133
+ * `em.getKnex()`, `em.getConnection().getKnex()`, `this.emFactory().getKnex()`.
134
+ *
135
+ * Exported because `check-transaction-context` refuses the same handle for a
136
+ * different reason (issue #200: it carries no transaction context), and two
137
+ * copies of "what a knex handle looks like" would drift — the receiver is
138
+ * spelled at least three ways in this tree already.
139
+ */
140
+ export declare function isGetKnexCall(node: ts.Expression): boolean;
141
+ /**
142
+ * How a class name becomes a table name when an `@Entity()` declares no
143
+ * `tableName`.
144
+ *
145
+ * It is a **parameter and has no default**, deliberately. The convention is the
146
+ * platform's own naming strategy (`PluralizingNamingStrategy`), which lives in
147
+ * the application's runtime sources and cannot be reached from here — this file
148
+ * is `@endora-commerce/cli`'s, and the application depends on the CLI as a
149
+ * development tool, never the other way round. Writing a copy of the pluralizer
150
+ * here would make two authors of one convention, which is the defect this whole
151
+ * estate exists against; asking the caller for it keeps the strategy the single
152
+ * author and makes a package-scope host supply whatever its own platform
153
+ * declares.
154
+ */
155
+ export type EntityTableNameStrategy = (className: string) => string;
156
+ /**
157
+ * The table names `source` declares, from either owner-map source.
158
+ *
159
+ * An `@Entity()` class declares its `tableName` option, or — for the classes
160
+ * that do not set one — the name `PluralizingNamingStrategy` derives from the
161
+ * class name, imported rather than reimplemented so the two cannot drift.
162
+ * `create table` DDL is read out of the same literal nodes as everything else,
163
+ * so a migration that mentions a table in a comment declares nothing.
164
+ */
165
+ export declare function declaredTableNames(source: string, file: string, tableNameOf: EntityTableNameStrategy): TableDeclaration[];
166
+ //# sourceMappingURL=sql-tables.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sql-tables.d.ts","sourceRoot":"","sources":["../../src/lib/sql-tables.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0FG;AACH,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,qEAAqE;AACrE,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,OAAO,CAAC;AAElD;;;;;;;;GAQG;AACH,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,SAAS,CAAC;AAEtD,mEAAmE;AACnE,MAAM,WAAW,cAAc;IAC7B,wEAAwE;IACxE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,kBAAkB,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IACjC,iDAAiD;IACjD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,2EAA2E;IAC3E,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,mEAAmE;AACnE,MAAM,MAAM,sBAAsB,GAAG,QAAQ,GAAG,W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