ddd-ts-kit 0.100.0 → 0.102.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 (463) hide show
  1. package/CHANGELOG.md +104 -0
  2. package/README.fr.md +17 -10
  3. package/README.md +16 -9
  4. package/dist/build/emitted-place.d.ts +1 -2
  5. package/dist/build/emitted-place.d.ts.map +1 -1
  6. package/dist/build/emitted-specifier.d.ts +7 -1
  7. package/dist/build/emitted-specifier.d.ts.map +1 -1
  8. package/dist/build/emitted-specifier.js +5 -6
  9. package/dist/build/emitted-specifier.js.map +1 -1
  10. package/dist/build/emitted-target.d.ts +6 -5
  11. package/dist/build/emitted-target.d.ts.map +1 -1
  12. package/dist/build/emitted-target.js +5 -9
  13. package/dist/build/emitted-target.js.map +1 -1
  14. package/dist/build/rewrite-aliases.d.ts.map +1 -1
  15. package/dist/build/rewrite-aliases.js +4 -5
  16. package/dist/build/rewrite-aliases.js.map +1 -1
  17. package/dist/build/rewrite-specifiers.d.ts +7 -6
  18. package/dist/build/rewrite-specifiers.d.ts.map +1 -1
  19. package/dist/build/rewrite-specifiers.js +6 -4
  20. package/dist/build/rewrite-specifiers.js.map +1 -1
  21. package/dist/build/unresolved-problem.d.ts +2 -1
  22. package/dist/build/unresolved-problem.d.ts.map +1 -1
  23. package/dist/build/unresolved-problem.js +2 -2
  24. package/dist/build/unresolved-problem.js.map +1 -1
  25. package/dist/check/business-names/parameter-lists.js +1 -3
  26. package/dist/check/business-names/parameter-lists.js.map +1 -1
  27. package/dist/check/engine/run-check.d.ts +3 -0
  28. package/dist/check/engine/run-check.d.ts.map +1 -1
  29. package/dist/check/engine/run-check.js +1 -1
  30. package/dist/check/engine/run-check.js.map +1 -1
  31. package/dist/check/explain/tenancy-docs.d.ts.map +1 -1
  32. package/dist/check/explain/tenancy-docs.js +13 -3
  33. package/dist/check/explain/tenancy-docs.js.map +1 -1
  34. package/dist/check/fixtures/conjunct-cases.d.ts +11 -0
  35. package/dist/check/fixtures/conjunct-cases.d.ts.map +1 -0
  36. package/dist/check/fixtures/conjunct-cases.js +19 -0
  37. package/dist/check/fixtures/conjunct-cases.js.map +1 -0
  38. package/dist/check/fixtures/privacy-fixtures.d.ts.map +1 -1
  39. package/dist/check/fixtures/privacy-fixtures.js +22 -0
  40. package/dist/check/fixtures/privacy-fixtures.js.map +1 -1
  41. package/dist/check/fixtures/run-fixture.d.ts +3 -2
  42. package/dist/check/fixtures/run-fixture.d.ts.map +1 -1
  43. package/dist/check/fixtures/run-fixture.js +3 -3
  44. package/dist/check/fixtures/run-fixture.js.map +1 -1
  45. package/dist/check/fixtures/run-self-check.js +1 -1
  46. package/dist/check/fixtures/run-self-check.js.map +1 -1
  47. package/dist/check/fixtures/tenancy-conjunct-drizzle-fixtures.d.ts +3 -0
  48. package/dist/check/fixtures/tenancy-conjunct-drizzle-fixtures.d.ts.map +1 -0
  49. package/dist/check/fixtures/tenancy-conjunct-drizzle-fixtures.js +33 -0
  50. package/dist/check/fixtures/tenancy-conjunct-drizzle-fixtures.js.map +1 -0
  51. package/dist/check/fixtures/tenancy-conjunct-fixtures.d.ts +4 -0
  52. package/dist/check/fixtures/tenancy-conjunct-fixtures.d.ts.map +1 -0
  53. package/dist/check/fixtures/tenancy-conjunct-fixtures.js +12 -0
  54. package/dist/check/fixtures/tenancy-conjunct-fixtures.js.map +1 -0
  55. package/dist/check/fixtures/tenancy-conjunct-knex-fixtures.d.ts +3 -0
  56. package/dist/check/fixtures/tenancy-conjunct-knex-fixtures.d.ts.map +1 -0
  57. package/dist/check/fixtures/tenancy-conjunct-knex-fixtures.js +49 -0
  58. package/dist/check/fixtures/tenancy-conjunct-knex-fixtures.js.map +1 -0
  59. package/dist/check/fixtures/tenancy-conjunct-prisma-fixtures.d.ts +3 -0
  60. package/dist/check/fixtures/tenancy-conjunct-prisma-fixtures.d.ts.map +1 -0
  61. package/dist/check/fixtures/tenancy-conjunct-prisma-fixtures.js +32 -0
  62. package/dist/check/fixtures/tenancy-conjunct-prisma-fixtures.js.map +1 -0
  63. package/dist/check/fixtures/tenancy-conjunct-typeorm-fixtures.d.ts +3 -0
  64. package/dist/check/fixtures/tenancy-conjunct-typeorm-fixtures.d.ts.map +1 -0
  65. package/dist/check/fixtures/tenancy-conjunct-typeorm-fixtures.js +34 -0
  66. package/dist/check/fixtures/tenancy-conjunct-typeorm-fixtures.js.map +1 -0
  67. package/dist/check/fixtures/tenancy-fixtures.d.ts.map +1 -1
  68. package/dist/check/fixtures/tenancy-fixtures.js +2 -0
  69. package/dist/check/fixtures/tenancy-fixtures.js.map +1 -1
  70. package/dist/check/privacy/published-events-of.d.ts.map +1 -1
  71. package/dist/check/privacy/published-events-of.js +4 -2
  72. package/dist/check/privacy/published-events-of.js.map +1 -1
  73. package/dist/check/rules/clean-one-export-per-file.js +1 -0
  74. package/dist/check/rules/clean-one-export-per-file.js.map +1 -1
  75. package/dist/check/rules/schema-no-duplicate-shape.js +1 -3
  76. package/dist/check/rules/schema-no-duplicate-shape.js.map +1 -1
  77. package/dist/check/rules/tenancy-scoped-statement.js +2 -2
  78. package/dist/check/rules/tenancy-scoped-statement.js.map +1 -1
  79. package/dist/check/schemas/class-shapes.d.ts.map +1 -1
  80. package/dist/check/schemas/class-shapes.js +5 -26
  81. package/dist/check/schemas/class-shapes.js.map +1 -1
  82. package/dist/check/structure/class-statements.d.ts +13 -0
  83. package/dist/check/structure/class-statements.d.ts.map +1 -0
  84. package/dist/check/structure/class-statements.js +34 -0
  85. package/dist/check/structure/class-statements.js.map +1 -0
  86. package/dist/check/structure/property-of.d.ts +13 -0
  87. package/dist/check/structure/property-of.d.ts.map +1 -0
  88. package/dist/check/structure/property-of.js +23 -0
  89. package/dist/check/structure/property-of.js.map +1 -0
  90. package/dist/check/tenancy/arguments-of-call.d.ts +3 -0
  91. package/dist/check/tenancy/arguments-of-call.d.ts.map +1 -0
  92. package/dist/check/tenancy/arguments-of-call.js +11 -0
  93. package/dist/check/tenancy/arguments-of-call.js.map +1 -0
  94. package/dist/check/tenancy/bare-expression.d.ts +3 -0
  95. package/dist/check/tenancy/bare-expression.d.ts.map +1 -0
  96. package/dist/check/tenancy/bare-expression.js +9 -0
  97. package/dist/check/tenancy/bare-expression.js.map +1 -0
  98. package/dist/check/tenancy/bracket-depth.d.ts +3 -0
  99. package/dist/check/tenancy/bracket-depth.d.ts.map +1 -0
  100. package/dist/check/tenancy/bracket-depth.js +10 -0
  101. package/dist/check/tenancy/bracket-depth.js.map +1 -0
  102. package/dist/check/tenancy/chain-links.d.ts +17 -0
  103. package/dist/check/tenancy/chain-links.d.ts.map +1 -0
  104. package/dist/check/tenancy/chain-links.js +24 -0
  105. package/dist/check/tenancy/chain-links.js.map +1 -0
  106. package/dist/check/tenancy/choice-branches.d.ts +3 -0
  107. package/dist/check/tenancy/choice-branches.d.ts.map +1 -0
  108. package/dist/check/tenancy/choice-branches.js +39 -0
  109. package/dist/check/tenancy/choice-branches.js.map +1 -0
  110. package/dist/check/tenancy/declaration-before.d.ts +12 -0
  111. package/dist/check/tenancy/declaration-before.d.ts.map +1 -0
  112. package/dist/check/tenancy/declaration-before.js +11 -0
  113. package/dist/check/tenancy/declaration-before.js.map +1 -0
  114. package/dist/check/tenancy/declaration-of.d.ts +1 -5
  115. package/dist/check/tenancy/declaration-of.d.ts.map +1 -1
  116. package/dist/check/tenancy/declaration-of.js +3 -8
  117. package/dist/check/tenancy/declaration-of.js.map +1 -1
  118. package/dist/check/tenancy/drizzle-unscoped.d.ts.map +1 -1
  119. package/dist/check/tenancy/drizzle-unscoped.js +16 -3
  120. package/dist/check/tenancy/drizzle-unscoped.js.map +1 -1
  121. package/dist/check/tenancy/enclosed-by.d.ts +3 -0
  122. package/dist/check/tenancy/enclosed-by.d.ts.map +1 -0
  123. package/dist/check/tenancy/enclosed-by.js +6 -0
  124. package/dist/check/tenancy/enclosed-by.js.map +1 -0
  125. package/dist/check/tenancy/end-of-enclosing.d.ts +7 -0
  126. package/dist/check/tenancy/end-of-enclosing.d.ts.map +1 -0
  127. package/dist/check/tenancy/end-of-enclosing.js +18 -0
  128. package/dist/check/tenancy/end-of-enclosing.js.map +1 -0
  129. package/dist/check/tenancy/holds-condition.d.ts +14 -0
  130. package/dist/check/tenancy/holds-condition.d.ts.map +1 -0
  131. package/dist/check/tenancy/holds-condition.js +26 -0
  132. package/dist/check/tenancy/holds-condition.js.map +1 -0
  133. package/dist/check/tenancy/is-conjunct.d.ts +8 -0
  134. package/dist/check/tenancy/is-conjunct.d.ts.map +1 -0
  135. package/dist/check/tenancy/is-conjunct.js +17 -0
  136. package/dist/check/tenancy/is-conjunct.js.map +1 -0
  137. package/dist/check/tenancy/is-or-link.d.ts +4 -0
  138. package/dist/check/tenancy/is-or-link.d.ts.map +1 -0
  139. package/dist/check/tenancy/is-or-link.js +7 -0
  140. package/dist/check/tenancy/is-or-link.js.map +1 -0
  141. package/dist/check/tenancy/knex-links-outside-condition.d.ts +11 -0
  142. package/dist/check/tenancy/knex-links-outside-condition.d.ts.map +1 -0
  143. package/dist/check/tenancy/knex-links-outside-condition.js +108 -0
  144. package/dist/check/tenancy/knex-links-outside-condition.js.map +1 -0
  145. package/dist/check/tenancy/knex-unscoped.d.ts +3 -1
  146. package/dist/check/tenancy/knex-unscoped.d.ts.map +1 -1
  147. package/dist/check/tenancy/knex-unscoped.js +12 -2
  148. package/dist/check/tenancy/knex-unscoped.js.map +1 -1
  149. package/dist/check/tenancy/prisma-unscoped.d.ts.map +1 -1
  150. package/dist/check/tenancy/prisma-unscoped.js +15 -10
  151. package/dist/check/tenancy/prisma-unscoped.js.map +1 -1
  152. package/dist/check/tenancy/spreads-at-top.d.ts +9 -0
  153. package/dist/check/tenancy/spreads-at-top.d.ts.map +1 -0
  154. package/dist/check/tenancy/spreads-at-top.js +49 -0
  155. package/dist/check/tenancy/spreads-at-top.js.map +1 -0
  156. package/dist/check/tenancy/top-level-parts.d.ts +3 -0
  157. package/dist/check/tenancy/top-level-parts.d.ts.map +1 -0
  158. package/dist/check/tenancy/top-level-parts.js +13 -0
  159. package/dist/check/tenancy/top-level-parts.js.map +1 -0
  160. package/dist/check/tenancy/typeorm-unscoped.d.ts.map +1 -1
  161. package/dist/check/tenancy/typeorm-unscoped.js +30 -16
  162. package/dist/check/tenancy/typeorm-unscoped.js.map +1 -1
  163. package/dist/check/tenancy/unconfined-where.d.ts +11 -0
  164. package/dist/check/tenancy/unconfined-where.d.ts.map +1 -0
  165. package/dist/check/tenancy/unconfined-where.js +18 -0
  166. package/dist/check/tenancy/unconfined-where.js.map +1 -0
  167. package/dist/config/read-config.d.ts.map +1 -1
  168. package/dist/config/read-config.js +20 -0
  169. package/dist/config/read-config.js.map +1 -1
  170. package/dist/declared/render-declarations.js +1 -3
  171. package/dist/declared/render-declarations.js.map +1 -1
  172. package/dist/describe/read-controllers.d.ts.map +1 -1
  173. package/dist/describe/read-controllers.js +18 -2
  174. package/dist/describe/read-controllers.js.map +1 -1
  175. package/dist/describe/read-event-definitions.d.ts +2 -0
  176. package/dist/describe/read-event-definitions.d.ts.map +1 -1
  177. package/dist/describe/read-event-definitions.js +1 -0
  178. package/dist/describe/read-event-definitions.js.map +1 -1
  179. package/dist/describe/schema-class-of.js +8 -1
  180. package/dist/describe/schema-class-of.js.map +1 -1
  181. package/dist/digest/tree-at.d.ts.map +1 -1
  182. package/dist/digest/tree-at.js +2 -0
  183. package/dist/digest/tree-at.js.map +1 -1
  184. package/dist/docs/context-sections.js +3 -7
  185. package/dist/docs/context-sections.js.map +1 -1
  186. package/dist/docs/personal-event-lines.d.ts +7 -0
  187. package/dist/docs/personal-event-lines.d.ts.map +1 -0
  188. package/dist/docs/personal-event-lines.js +34 -0
  189. package/dist/docs/personal-event-lines.js.map +1 -0
  190. package/dist/docs/write-docs.d.ts.map +1 -1
  191. package/dist/docs/write-docs.js +2 -0
  192. package/dist/docs/write-docs.js.map +1 -1
  193. package/dist/docs/write-personal-events.d.ts +11 -0
  194. package/dist/docs/write-personal-events.d.ts.map +1 -0
  195. package/dist/docs/write-personal-events.js +28 -0
  196. package/dist/docs/write-personal-events.js.map +1 -0
  197. package/dist/generate/flags-of.d.ts +4 -0
  198. package/dist/generate/flags-of.d.ts.map +1 -0
  199. package/dist/generate/flags-of.js +6 -0
  200. package/dist/generate/flags-of.js.map +1 -0
  201. package/dist/generate/held-to-glossary.d.ts +9 -0
  202. package/dist/generate/held-to-glossary.d.ts.map +1 -0
  203. package/dist/generate/held-to-glossary.js +11 -0
  204. package/dist/generate/held-to-glossary.js.map +1 -0
  205. package/dist/generate/kind-help.d.ts +2 -0
  206. package/dist/generate/kind-help.d.ts.map +1 -1
  207. package/dist/generate/kind-help.js +2 -0
  208. package/dist/generate/kind-help.js.map +1 -1
  209. package/dist/generate/kinds/adapter-kind.js +1 -1
  210. package/dist/generate/kinds/adapter-kind.js.map +1 -1
  211. package/dist/generate/kinds/assert-event-store.d.ts +5 -1
  212. package/dist/generate/kinds/assert-event-store.d.ts.map +1 -1
  213. package/dist/generate/kinds/assert-event-store.js +11 -5
  214. package/dist/generate/kinds/assert-event-store.js.map +1 -1
  215. package/dist/generate/kinds/background/background-job-vars.js +4 -2
  216. package/dist/generate/kinds/background/background-job-vars.js.map +1 -1
  217. package/dist/generate/kinds/background/class-payload-schema.js +3 -3
  218. package/dist/generate/kinds/background/class-payload-schema.js.map +1 -1
  219. package/dist/generate/kinds/background-job-kind.js +1 -1
  220. package/dist/generate/kinds/background-job-kind.js.map +1 -1
  221. package/dist/generate/kinds/builder-kind.js +1 -1
  222. package/dist/generate/kinds/builder-kind.js.map +1 -1
  223. package/dist/generate/kinds/command-kind.js +1 -1
  224. package/dist/generate/kinds/command-kind.js.map +1 -1
  225. package/dist/generate/kinds/declarations-of.d.ts +11 -0
  226. package/dist/generate/kinds/declarations-of.d.ts.map +1 -0
  227. package/dist/generate/kinds/declarations-of.js +17 -0
  228. package/dist/generate/kinds/declarations-of.js.map +1 -0
  229. package/dist/generate/kinds/e2e-kind.js +1 -1
  230. package/dist/generate/kinds/e2e-kind.js.map +1 -1
  231. package/dist/generate/kinds/erasure-handler-kind.js +1 -1
  232. package/dist/generate/kinds/erasure-handler-kind.js.map +1 -1
  233. package/dist/generate/kinds/event-type-as-published.d.ts +11 -0
  234. package/dist/generate/kinds/event-type-as-published.d.ts.map +1 -0
  235. package/dist/generate/kinds/event-type-as-published.js +17 -0
  236. package/dist/generate/kinds/event-type-as-published.js.map +1 -0
  237. package/dist/generate/kinds/form-kind.js +1 -1
  238. package/dist/generate/kinds/form-kind.js.map +1 -1
  239. package/dist/generate/kinds/generate-event-sourced-repository.js +8 -1
  240. package/dist/generate/kinds/generate-event-sourced-repository.js.map +1 -1
  241. package/dist/generate/kinds/integration-event-kind.d.ts.map +1 -1
  242. package/dist/generate/kinds/integration-event-kind.js +2 -9
  243. package/dist/generate/kinds/integration-event-kind.js.map +1 -1
  244. package/dist/generate/kinds/integration-handler-kind.d.ts.map +1 -1
  245. package/dist/generate/kinds/integration-handler-kind.js +30 -14
  246. package/dist/generate/kinds/integration-handler-kind.js.map +1 -1
  247. package/dist/generate/kinds/job-kind.js +1 -1
  248. package/dist/generate/kinds/job-kind.js.map +1 -1
  249. package/dist/generate/kinds/module-kind.js +1 -1
  250. package/dist/generate/kinds/module-kind.js.map +1 -1
  251. package/dist/generate/kinds/parse-version.d.ts +3 -0
  252. package/dist/generate/kinds/parse-version.d.ts.map +1 -0
  253. package/dist/generate/kinds/parse-version.js +9 -0
  254. package/dist/generate/kinds/parse-version.js.map +1 -0
  255. package/dist/generate/kinds/pick-declaration.d.ts +9 -0
  256. package/dist/generate/kinds/pick-declaration.d.ts.map +1 -0
  257. package/dist/generate/kinds/pick-declaration.js +14 -0
  258. package/dist/generate/kinds/pick-declaration.js.map +1 -0
  259. package/dist/generate/kinds/presentation/controller-of.d.ts.map +1 -1
  260. package/dist/generate/kinds/presentation/controller-of.js +15 -5
  261. package/dist/generate/kinds/presentation/controller-of.js.map +1 -1
  262. package/dist/generate/kinds/projection-kind.d.ts.map +1 -1
  263. package/dist/generate/kinds/projection-kind.js +21 -12
  264. package/dist/generate/kinds/projection-kind.js.map +1 -1
  265. package/dist/generate/kinds/property-kind.js +1 -1
  266. package/dist/generate/kinds/property-kind.js.map +1 -1
  267. package/dist/generate/kinds/refuse-unpublished-version.d.ts +7 -0
  268. package/dist/generate/kinds/refuse-unpublished-version.d.ts.map +1 -0
  269. package/dist/generate/kinds/refuse-unpublished-version.js +15 -0
  270. package/dist/generate/kinds/refuse-unpublished-version.js.map +1 -0
  271. package/dist/generate/kinds/repository-kind.js +1 -1
  272. package/dist/generate/kinds/repository-kind.js.map +1 -1
  273. package/dist/generate/kinds/representation-kind.js +1 -1
  274. package/dist/generate/kinds/representation-kind.js.map +1 -1
  275. package/dist/generate/kinds/route/controller-vars.js +1 -1
  276. package/dist/generate/kinds/route/controller-vars.js.map +1 -1
  277. package/dist/generate/kinds/route/message-call.d.ts +6 -2
  278. package/dist/generate/kinds/route/message-call.d.ts.map +1 -1
  279. package/dist/generate/kinds/route/message-call.js +2 -1
  280. package/dist/generate/kinds/route/message-call.js.map +1 -1
  281. package/dist/generate/kinds/route/message-vars.d.ts.map +1 -1
  282. package/dist/generate/kinds/route/message-vars.js +5 -2
  283. package/dist/generate/kinds/route/message-vars.js.map +1 -1
  284. package/dist/generate/kinds/route/route-vars.js +1 -1
  285. package/dist/generate/kinds/route/route-vars.js.map +1 -1
  286. package/dist/generate/kinds/route/spec-vars.d.ts +2 -1
  287. package/dist/generate/kinds/route/spec-vars.d.ts.map +1 -1
  288. package/dist/generate/kinds/route/spec-vars.js +26 -7
  289. package/dist/generate/kinds/route/spec-vars.js.map +1 -1
  290. package/dist/generate/kinds/route/standard-schema-of.d.ts +2 -1
  291. package/dist/generate/kinds/route/standard-schema-of.d.ts.map +1 -1
  292. package/dist/generate/kinds/route/standard-schema-of.js +2 -4
  293. package/dist/generate/kinds/route/standard-schema-of.js.map +1 -1
  294. package/dist/generate/kinds/route-group-kind.js +1 -1
  295. package/dist/generate/kinds/route-group-kind.js.map +1 -1
  296. package/dist/generate/kinds/route-kind.js +2 -2
  297. package/dist/generate/kinds/route-kind.js.map +1 -1
  298. package/dist/generate/kinds/service-kind.js +1 -1
  299. package/dist/generate/kinds/service-kind.js.map +1 -1
  300. package/dist/generate/kinds/state-machine-kind.js +1 -1
  301. package/dist/generate/kinds/state-machine-kind.js.map +1 -1
  302. package/dist/generate/kinds/wanted-event.d.ts +6 -0
  303. package/dist/generate/kinds/wanted-event.d.ts.map +1 -0
  304. package/dist/generate/kinds/wanted-event.js +2 -0
  305. package/dist/generate/kinds/wanted-event.js.map +1 -0
  306. package/dist/generate/refuse-undeclared-flags.d.ts.map +1 -1
  307. package/dist/generate/refuse-undeclared-flags.js +9 -2
  308. package/dist/generate/refuse-undeclared-flags.js.map +1 -1
  309. package/dist/generator-lock/unreadable-lock-refusal.d.ts +4 -0
  310. package/dist/generator-lock/unreadable-lock-refusal.d.ts.map +1 -0
  311. package/dist/generator-lock/unreadable-lock-refusal.js +7 -0
  312. package/dist/generator-lock/unreadable-lock-refusal.js.map +1 -0
  313. package/dist/generator-lock/with-generator-lock.d.ts.map +1 -1
  314. package/dist/generator-lock/with-generator-lock.js +8 -7
  315. package/dist/generator-lock/with-generator-lock.js.map +1 -1
  316. package/dist/help/kind-help-text.d.ts.map +1 -1
  317. package/dist/help/kind-help-text.js +24 -13
  318. package/dist/help/kind-help-text.js.map +1 -1
  319. package/dist/init/files/platform-files.d.ts.map +1 -1
  320. package/dist/init/files/platform-files.js +14 -0
  321. package/dist/init/files/platform-files.js.map +1 -1
  322. package/dist/init/files/privacy-files.d.ts +2 -2
  323. package/dist/init/files/privacy-files.d.ts.map +1 -1
  324. package/dist/init/files/privacy-files.js +3 -2
  325. package/dist/init/files/privacy-files.js.map +1 -1
  326. package/dist/init/manifest/versions.js +24 -24
  327. package/dist/init/stack/http-cache-misfit.d.ts +4 -0
  328. package/dist/init/stack/http-cache-misfit.d.ts.map +1 -0
  329. package/dist/init/stack/http-cache-misfit.js +21 -0
  330. package/dist/init/stack/http-cache-misfit.js.map +1 -0
  331. package/dist/init/stack/resolve-stack.d.ts.map +1 -1
  332. package/dist/init/stack/resolve-stack.js +2 -1
  333. package/dist/init/stack/resolve-stack.js.map +1 -1
  334. package/dist/measures/timeline-of.js +1 -0
  335. package/dist/measures/timeline-of.js.map +1 -1
  336. package/dist/progress/format-progress.js +1 -0
  337. package/dist/progress/format-progress.js.map +1 -1
  338. package/dist/sdk/planned-clients.d.ts +2 -2
  339. package/dist/sdk/planned-clients.d.ts.map +1 -1
  340. package/dist/sdk/planned-clients.js +2 -6
  341. package/dist/sdk/planned-clients.js.map +1 -1
  342. package/dist/sdk/set-up-sdk.d.ts.map +1 -1
  343. package/dist/sdk/set-up-sdk.js +3 -2
  344. package/dist/sdk/set-up-sdk.js.map +1 -1
  345. package/dist/stack/stack-vars.js +12 -3
  346. package/dist/stack/stack-vars.js.map +1 -1
  347. package/dist/stories/forecast-merge.js +1 -0
  348. package/dist/stories/forecast-merge.js.map +1 -1
  349. package/dist/version.d.ts +1 -1
  350. package/dist/version.js +1 -1
  351. package/dist/worker/format-resume.d.ts.map +1 -1
  352. package/dist/worker/format-resume.js +5 -0
  353. package/dist/worker/format-resume.js.map +1 -1
  354. package/dist/worker/format-workers.js +5 -0
  355. package/dist/worker/format-workers.js.map +1 -1
  356. package/dist/worker/progress-of.d.ts +8 -3
  357. package/dist/worker/progress-of.d.ts.map +1 -1
  358. package/dist/worker/progress-of.js +2 -16
  359. package/dist/worker/progress-of.js.map +1 -1
  360. package/dist/worker/read-agent-record.d.ts.map +1 -1
  361. package/dist/worker/read-agent-record.js +15 -3
  362. package/dist/worker/read-agent-record.js.map +1 -1
  363. package/dist/worker/read-workers.js +2 -2
  364. package/dist/worker/read-workers.js.map +1 -1
  365. package/dist/worker/readable-progress.d.ts +5 -0
  366. package/dist/worker/readable-progress.d.ts.map +1 -0
  367. package/dist/worker/readable-progress.js +16 -0
  368. package/dist/worker/readable-progress.js.map +1 -0
  369. package/dist/worker/resume-worker.d.ts.map +1 -1
  370. package/dist/worker/resume-worker.js +4 -5
  371. package/dist/worker/resume-worker.js.map +1 -1
  372. package/dist/worker/worker-progress.d.ts +2 -1
  373. package/dist/worker/worker-progress.d.ts.map +1 -1
  374. package/dist/workspace/real-path-of.d.ts +2 -2
  375. package/dist/workspace/real-path-of.d.ts.map +1 -1
  376. package/dist/workspace/real-path-of.js +15 -10
  377. package/dist/workspace/real-path-of.js.map +1 -1
  378. package/package.json +5 -5
  379. package/templates/controller/controller.spec.ts.tpl +19 -0
  380. package/templates/docs/privacy-register.md.tpl +2 -0
  381. package/templates/init/README.md.tpl +13 -4
  382. package/templates/init/docker/env.example.tpl +8 -0
  383. package/templates/init/main.ts.tpl +3 -0
  384. package/templates/init/platform/audit/create-audit.ts.tpl +12 -6
  385. package/templates/init/platform/composition/compose-application.manual.ts.tpl +36 -0
  386. package/templates/init/platform/composition/compose-application.tsyringe.ts.tpl +7 -0
  387. package/templates/init/platform/composition/lay-foundations.manual.ts.tpl +1 -1
  388. package/templates/init/platform/composition/lay-foundations.tsyringe.ts.tpl +1 -1
  389. package/templates/init/platform/composition/platform-options.manual.ts.tpl +7 -0
  390. package/templates/init/platform/composition/platform.manual.ts.tpl +7 -0
  391. package/templates/init/platform/composition/platform.module.tsyringe.ts.tpl +7 -0
  392. package/templates/init/platform/config/app-config.ts.tpl +7 -0
  393. package/templates/init/platform/config/load-config.ts.tpl +22 -0
  394. package/templates/init/platform/database/persistence.contract.spec.ts.tpl +14 -3
  395. package/templates/init/platform/event-sourcing/create-event-sourcing.ts.tpl +5 -1
  396. package/templates/init/platform/jobs/create-background-work.ts.tpl +12 -0
  397. package/templates/init/platform/jobs/days-before.ts.tpl +8 -0
  398. package/templates/init/platform/jobs/housekeeping.module.tsyringe.ts.tpl +46 -0
  399. package/templates/init/platform/jobs/housekeeping.ts.tpl +24 -0
  400. package/templates/init/platform/jobs/job-settings.ts.tpl +6 -0
  401. package/templates/init/platform/privacy/personal-events.ts.tpl +11 -0
  402. package/templates/init/platform/privacy/run-erasure.manual.ts.tpl +69 -19
  403. package/templates/init/platform/privacy/run-erasure.tsyringe.ts.tpl +69 -8
  404. package/templates/init/platform/privacy/run-export.manual.ts.tpl +2 -2
  405. package/templates/init/platform/privacy/run-export.tsyringe.ts.tpl +4 -2
  406. package/templates/init/platform/privacy/run-purge.manual.ts.tpl +3 -2
  407. package/templates/init/platform/privacy/run-purge.tsyringe.ts.tpl +4 -2
  408. package/templates/init/rules/infrastructure.md.tpl +1 -1
  409. package/templates/init/scripts/privacy-erase.manual.ts.tpl +52 -7
  410. package/templates/init/scripts/privacy-erase.tsyringe.ts.tpl +52 -7
  411. package/templates/init/scripts/privacy-export.manual.ts.tpl +4 -0
  412. package/templates/init/scripts/privacy-export.tsyringe.ts.tpl +4 -0
  413. package/templates/init/scripts/privacy-purge.manual.ts.tpl +4 -0
  414. package/templates/init/scripts/privacy-purge.tsyringe.ts.tpl +4 -0
  415. package/templates/integration-event/payload.class-validator.ts.tpl +2 -2
  416. package/templates/nest-controller/controller.spec.ts.tpl +25 -0
  417. package/templates/pipeline/package-scripts.json +1 -1
  418. package/templates/pipeline/stryker.config.mjs.tpl +4 -0
  419. package/templates/presets/identity/context/presentation/http/accounts/deactivate-account/deactivate-account.accepted.class-validator.per-route.ts.tpl +1 -1
  420. package/templates/presets/identity/context/presentation/http/accounts/provision-account/provision-account.accepted.class-validator.per-route.ts.tpl +1 -1
  421. package/templates/presets/identity/context/presentation/http/accounts/provision-account/provision-account.body.class-validator.ts.tpl +1 -1
  422. package/templates/presets/identity/context/presentation/http/invitations/accept-invitation/accept-invitation.accepted.class-validator.per-route.ts.tpl +1 -1
  423. package/templates/presets/identity/context/presentation/http/invitations/accept-invitation/accept-invitation.body.class-validator.per-route.ts.tpl +1 -1
  424. package/templates/presets/identity/context/presentation/http/invitations/decline-invitation/decline-invitation.accepted.class-validator.per-route.ts.tpl +1 -1
  425. package/templates/presets/identity/context/presentation/http/invitations/decline-invitation/decline-invitation.body.class-validator.per-route.ts.tpl +1 -1
  426. package/templates/presets/identity/context/presentation/http/organisations/change-member-role/change-member-role.accepted.class-validator.per-route.ts.tpl +1 -1
  427. package/templates/presets/identity/context/presentation/http/organisations/change-member-role/change-member-role.body.class-validator.ts.tpl +1 -1
  428. package/templates/presets/identity/context/presentation/http/organisations/change-member-role/change-member-role.params.class-validator.ts.tpl +2 -2
  429. package/templates/presets/identity/context/presentation/http/organisations/grant-delegation/grant-delegation.accepted.class-validator.per-route.ts.tpl +1 -1
  430. package/templates/presets/identity/context/presentation/http/organisations/grant-delegation/grant-delegation.body.class-validator.ts.tpl +4 -4
  431. package/templates/presets/identity/context/presentation/http/organisations/grant-delegation/grant-delegation.params.class-validator.ts.tpl +1 -1
  432. package/templates/presets/identity/context/presentation/http/organisations/invite-member/invite-member.accepted.class-validator.ts.tpl +2 -2
  433. package/templates/presets/identity/context/presentation/http/organisations/invite-member/invite-member.body.class-validator.ts.tpl +2 -2
  434. package/templates/presets/identity/context/presentation/http/organisations/invite-member/invite-member.params.class-validator.ts.tpl +1 -1
  435. package/templates/presets/identity/context/presentation/http/organisations/open-organisation/open-organisation.accepted.class-validator.per-route.ts.tpl +1 -1
  436. package/templates/presets/identity/context/presentation/http/organisations/open-organisation/open-organisation.body.class-validator.ts.tpl +2 -2
  437. package/templates/presets/identity/context/presentation/http/organisations/remove-member/remove-member.accepted.class-validator.per-route.ts.tpl +1 -1
  438. package/templates/presets/identity/context/presentation/http/organisations/remove-member/remove-member.params.class-validator.ts.tpl +2 -2
  439. package/templates/presets/identity/context/presentation/http/organisations/revoke-delegation/revoke-delegation.accepted.class-validator.per-route.ts.tpl +1 -1
  440. package/templates/presets/identity/context/presentation/http/organisations/revoke-delegation/revoke-delegation.params.class-validator.ts.tpl +2 -2
  441. package/templates/presets/identity/context/presentation/http/organisations/revoke-invitation/revoke-invitation.accepted.class-validator.per-route.ts.tpl +1 -1
  442. package/templates/presets/identity/context/presentation/http/organisations/revoke-invitation/revoke-invitation.params.class-validator.ts.tpl +2 -2
  443. package/templates/presets/identity/context/presentation/http/organisations/search-members/search-members.line.class-validator.ts.tpl +6 -6
  444. package/templates/presets/identity/context/presentation/http/organisations/search-members/search-members.params.class-validator.ts.tpl +1 -1
  445. package/templates/presets/identity/context/presentation/http/shared/invitation-token.schema.class-validator.shared.ts.tpl +1 -1
  446. package/templates/presets/identity/context/published-language/account-deactivated.v1.payload.class-validator.ts.tpl +1 -1
  447. package/templates/presets/identity/context/published-language/delegation-granted.v1.payload.class-validator.ts.tpl +7 -7
  448. package/templates/presets/identity/context/published-language/delegation-revoked.v1.payload.class-validator.ts.tpl +4 -4
  449. package/templates/presets/identity/context/published-language/member-joined.v1.payload.class-validator.ts.tpl +4 -4
  450. package/templates/presets/identity/context/published-language/member-removed.v1.payload.class-validator.ts.tpl +4 -4
  451. package/templates/presets/identity/context/published-language/member-role-changed.v1.payload.class-validator.ts.tpl +6 -6
  452. package/templates/presets/identity/context/published-language/organisation-opened.v1.payload.class-validator.ts.tpl +3 -3
  453. package/templates/route/dto.accepted.ts.tpl +1 -1
  454. package/templates/route/dto.answer.ts.tpl +1 -1
  455. package/templates/route/dto.body.ts.tpl +1 -1
  456. package/templates/route/dto.line.ts.tpl +2 -2
  457. package/templates/route/route.spec.ts.tpl +19 -0
  458. package/templates/schema/schema.class-validator.ts.tpl +1 -1
  459. package/templates/worker/main.ts.tpl +3 -0
  460. package/dist/generate/kinds/find-event-declaration.d.ts +0 -8
  461. package/dist/generate/kinds/find-event-declaration.d.ts.map +0 -1
  462. package/dist/generate/kinds/find-event-declaration.js +0 -27
  463. package/dist/generate/kinds/find-event-declaration.js.map +0 -1
@@ -0,0 +1,3 @@
1
+ /** How a bracket moves the depth of a text whose literals are blanked: nothing for any other character. */
2
+ export declare const BRACKET_DEPTH: Readonly<Record<string, number>>;
3
+ //# sourceMappingURL=bracket-depth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bracket-depth.d.ts","sourceRoot":"","sources":["../../../src/check/tenancy/bracket-depth.ts"],"names":[],"mappings":"AAAA,2GAA2G;AAC3G,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAO1D,CAAC"}
@@ -0,0 +1,10 @@
1
+ /** How a bracket moves the depth of a text whose literals are blanked: nothing for any other character. */
2
+ export const BRACKET_DEPTH = {
3
+ '(': 1,
4
+ '[': 1,
5
+ '{': 1,
6
+ ')': -1,
7
+ ']': -1,
8
+ '}': -1,
9
+ };
10
+ //# sourceMappingURL=bracket-depth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bracket-depth.js","sourceRoot":"","sources":["../../../src/check/tenancy/bracket-depth.ts"],"names":[],"mappings":"AAAA,2GAA2G;AAC3G,MAAM,CAAC,MAAM,aAAa,GAAqC;IAC7D,GAAG,EAAE,CAAC;IACN,GAAG,EAAE,CAAC;IACN,GAAG,EAAE,CAAC;IACN,GAAG,EAAE,CAAC,CAAC;IACP,GAAG,EAAE,CAAC,CAAC;IACP,GAAG,EAAE,CAAC,CAAC;CACR,CAAC"}
@@ -0,0 +1,17 @@
1
+ /** One link of a chain: `.where({ id })`, or `.or`, a property that takes no arguments. */
2
+ export interface ChainLink {
3
+ readonly method: string;
4
+ /** Where the link starts in the code, at its dot. */
5
+ readonly offset: number;
6
+ /** Where the text between its parentheses starts. */
7
+ readonly argumentsAt: number;
8
+ /** The text between its parentheses: empty for a property. */
9
+ readonly argumentsText: string;
10
+ }
11
+ /**
12
+ * The links of the chain that goes on at `from`, what a callback holds left out: a link of a chain
13
+ * inside an argument is no link of this one. `.where(a).orderBy(b)`, across lines, with type
14
+ * arguments, stopping at the first thing that is no link.
15
+ */
16
+ export declare function chainLinks(code: string, from: number): readonly ChainLink[];
17
+ //# sourceMappingURL=chain-links.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chain-links.d.ts","sourceRoot":"","sources":["../../../src/check/tenancy/chain-links.ts"],"names":[],"mappings":"AAEA,2FAA2F;AAC3F,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,qDAAqD;IACrD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,qDAAqD;IACrD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,8DAA8D;IAC9D,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,SAAS,EAAE,CAe3E"}
@@ -0,0 +1,24 @@
1
+ import { balancedArguments } from './balanced-arguments.js';
2
+ /**
3
+ * The links of the chain that goes on at `from`, what a callback holds left out: a link of a chain
4
+ * inside an argument is no link of this one. `.where(a).orderBy(b)`, across lines, with type
5
+ * arguments, stopping at the first thing that is no link.
6
+ */
7
+ export function chainLinks(code, from) {
8
+ const link = /\s*\??\.\s*([A-Za-z_$][\w$]*)\s*(?:<[^()]*>\s*)?(\(?)/y;
9
+ const links = [];
10
+ let index = from;
11
+ for (let found = matchAt(link, code, index); found !== null; found = matchAt(link, code, index)) {
12
+ const [whole, method = '', open = ''] = found;
13
+ const argumentsAt = index + whole.length;
14
+ const argumentsText = open === '' ? '' : balancedArguments(code, argumentsAt - 1);
15
+ links.push({ method, offset: index, argumentsAt, argumentsText });
16
+ index = open === '' ? argumentsAt : argumentsAt + argumentsText.length + 1;
17
+ }
18
+ return links;
19
+ }
20
+ function matchAt(sticky, code, index) {
21
+ sticky.lastIndex = index;
22
+ return sticky.exec(code);
23
+ }
24
+ //# sourceMappingURL=chain-links.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chain-links.js","sourceRoot":"","sources":["../../../src/check/tenancy/chain-links.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAazD;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY,EAAE,IAAY;IACnD,MAAM,IAAI,GAAG,wDAAwD,CAAC;IACtE,MAAM,KAAK,GAAgB,EAAE,CAAC;IAC9B,IAAI,KAAK,GAAG,IAAI,CAAC;IAEjB,KAAK,IAAI,KAAK,GAAG,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,KAAK,KAAK,IAAI,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC;QAChG,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,EAAE,EAAE,IAAI,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC;QAC9C,MAAM,WAAW,GAAG,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC;QACzC,MAAM,aAAa,GAAG,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,CAAC,CAAC,CAAC;QAElF,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC,CAAC;QAClE,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,GAAG,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC;IAC7E,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,OAAO,CAAC,MAAc,EAAE,IAAY,EAAE,KAAa;IAC1D,MAAM,CAAC,SAAS,GAAG,KAAK,CAAC;IAEzB,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** The two branches of a choice outside any bracket, `a` and `b` of `test ? a : b`, or `undefined` when it is no choice. */
2
+ export declare function choiceBranches(bare: string): readonly [string, string] | undefined;
3
+ //# sourceMappingURL=choice-branches.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"choice-branches.d.ts","sourceRoot":"","sources":["../../../src/check/tenancy/choice-branches.ts"],"names":[],"mappings":"AAEA,4HAA4H;AAC5H,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAUlF"}
@@ -0,0 +1,39 @@
1
+ import { BRACKET_DEPTH } from './bracket-depth.js';
2
+ /** The two branches of a choice outside any bracket, `a` and `b` of `test ? a : b`, or `undefined` when it is no choice. */
3
+ export function choiceBranches(bare) {
4
+ const question = questionMark(bare);
5
+ if (question === undefined) {
6
+ return undefined;
7
+ }
8
+ const colon = matchingColon(bare, question);
9
+ return [bare.slice(question + 1, colon), bare.slice(colon + 1)];
10
+ }
11
+ /** The first `?` outside any bracket that starts a choice: never `?.` or `??`. */
12
+ function questionMark(bare) {
13
+ let depth = 0;
14
+ for (let index = 0; index < bare.length; index += 1) {
15
+ depth += BRACKET_DEPTH[bare.charAt(index)] ?? 0;
16
+ if (depth === 0 && bare.charAt(index) === '?') {
17
+ if (bare.charAt(index + 1) !== '.' && bare.charAt(index + 1) !== '?') {
18
+ return index;
19
+ }
20
+ index += 1;
21
+ }
22
+ }
23
+ return undefined;
24
+ }
25
+ /** The `:` of the `?` at `question`, past the choices nested in its first branch. */
26
+ function matchingColon(bare, question) {
27
+ let depth = 0;
28
+ let open = 1;
29
+ for (let index = question + 1; index < bare.length; index += 1) {
30
+ const char = bare.charAt(index);
31
+ depth += BRACKET_DEPTH[char] ?? 0;
32
+ open += depth === 0 ? ({ '?': 1, ':': -1 }[char] ?? 0) : 0;
33
+ if (open === 0) {
34
+ return index;
35
+ }
36
+ }
37
+ return bare.length;
38
+ }
39
+ //# sourceMappingURL=choice-branches.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"choice-branches.js","sourceRoot":"","sources":["../../../src/check/tenancy/choice-branches.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAA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GAAG,QAAQ,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QAC/D,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAEhC,KAAK,IAAI,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClC,IAAI,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAE3D,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;YACf,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC,MAAM,CAAC;AACrB,CAAC"}
@@ -0,0 +1,12 @@
1
+ /** What a local is declared with, and where. */
2
+ export interface Declaration {
3
+ readonly text: string;
4
+ readonly at: number;
5
+ }
6
+ /**
7
+ * The last declaration of a local before `at` (`const mine = ...;`, `const mine: Row = ...;`), which
8
+ * is the one a statement at `at` sees when several methods name a local alike, or `undefined`
9
+ * when the file declares no such local before it.
10
+ */
11
+ export declare function declarationBefore(code: string, name: string, at: number): Declaration | undefined;
12
+ //# sourceMappingURL=declaration-before.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declaration-before.d.ts","sourceRoot":"","sources":["../../../src/check/tenancy/declaration-before.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAKjG"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The last declaration of a local before `at` (`const mine = ...;`, `const mine: Row = ...;`), which
3
+ * is the one a statement at `at` sees when several methods name a local alike, or `undefined`
4
+ * when the file declares no such local before it.
5
+ */
6
+ export function declarationBefore(code, name, at) {
7
+ const declarations = new RegExp(`(?:const|let)\\s+${name.replaceAll('$', '\\$')}\\s*(?::[^=;]*)?=([^;]*)`, 'g');
8
+ const last = [...code.matchAll(declarations)].filter((match) => match.index < at).at(-1);
9
+ return last === undefined ? undefined : { text: last[1] ?? '', at: last.index };
10
+ }
11
+ //# sourceMappingURL=declaration-before.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declaration-before.js","sourceRoot":"","sources":["../../../src/check/tenancy/declaration-before.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY,EAAE,IAAY,EAAE,EAAU;IACtE,MAAM,YAAY,GAAG,IAAI,MAAM,CAAC,oBAAoB,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,0BAA0B,EAAE,GAAG,CAAC,CAAC;IAChH,MAAM,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAEzF,OAAO,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;AAClF,CAAC"}
@@ -1,7 +1,3 @@
1
- /**
2
- * What a local is declared with (`const mine = ...;`) in the last declaration before `at`, which
3
- * is the one a statement at `at` sees when several methods name a local alike, or `undefined`
4
- * when the file declares no such local before it.
5
- */
1
+ /** What a local is declared with in the last declaration before `at`, or `undefined` when the file declares none. */
6
2
  export declare function declarationOf(code: string, name: string, at: number): string | undefined;
7
3
  //# sourceMappingURL=declaration-of.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"declaration-of.d.ts","sourceRoot":"","sources":["../../../src/check/tenancy/declaration-of.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAKxF"}
1
+ {"version":3,"file":"declaration-of.d.ts","sourceRoot":"","sources":["../../../src/check/tenancy/declaration-of.ts"],"names":[],"mappings":"AAEA,qHAAqH;AACrH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAExF"}
@@ -1,11 +1,6 @@
1
- /**
2
- * What a local is declared with (`const mine = ...;`) in the last declaration before `at`, which
3
- * is the one a statement at `at` sees when several methods name a local alike, or `undefined`
4
- * when the file declares no such local before it.
5
- */
1
+ import { declarationBefore } from './declaration-before.js';
2
+ /** What a local is declared with in the last declaration before `at`, or `undefined` when the file declares none. */
6
3
  export function declarationOf(code, name, at) {
7
- const declarations = new RegExp(`(?:const|let)\\s+${name.replaceAll('$', '\\$')}\\s*=([^;]*)`, 'g');
8
- const before = [...code.matchAll(declarations)].filter((match) => match.index < at);
9
- return before.at(-1)?.[1];
4
+ return declarationBefore(code, name, at)?.text;
10
5
  }
11
6
  //# sourceMappingURL=declaration-of.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"declaration-of.js","sourceRoot":"","sources":["../../../src/check/tenancy/declaration-of.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,IAAY,EAAE,EAAU;IAClE,MAAM,YAAY,GAAG,IAAI,MAAM,CAAC,oBAAoB,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC;IACpG,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC;IAEpF,OAAO,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAC5B,CAAC"}
1
+ {"version":3,"file":"declaration-of.js","sourceRoot":"","sources":["../../../src/check/tenancy/declaration-of.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,qHAAqH;AACrH,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,IAAY,EAAE,EAAU;IAClE,OAAO,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,IAAI,CAAC;AACjD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"drizzle-unscoped.d.ts","sourceRoot":"","sources":["../../../src/check/tenancy/drizzle-unscoped.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAavD,wGAAwG;AACxG,wBAAgB,eAAe,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,EAAE,CAQhG"}
1
+ {"version":3,"file":"drizzle-unscoped.d.ts","sourceRoot":"","sources":["../../../src/check/tenancy/drizzle-unscoped.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAevD,wGAAwG;AACxG,wBAAgB,eAAe,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,EAAE,CAQhG"}
@@ -1,5 +1,7 @@
1
1
  import { declaredWith } from './declared-with.js';
2
+ import { chainLinks } from './chain-links.js';
2
3
  import { executorUses } from './executor-uses.js';
4
+ import { isConjunct } from './is-conjunct.js';
3
5
  /** What confines a read, an update or a delete to the tenant. */
4
6
  const CONDITION = /(?<![\w$])(?:tenantCondition|ownTenantCondition)\s*\(/;
5
7
  /** What names the tenant of an inserted row. */
@@ -27,10 +29,21 @@ function unscopedStatement(code, { statement, offset }) {
27
29
  : 'An insert names no tenant: spread tenantScopeOf(this.scope) into the row it writes.';
28
30
  }
29
31
  if (READ_OR_WRITE.test(statement)) {
30
- return CONDITION.test(statement) || declaredWith(code, { statement, method: 'where', at: offset }, CONDITION)
31
- ? undefined
32
- : 'A statement reaches a table with no tenant condition in its where.';
32
+ return unconfinedStatement(code, statement, offset);
33
33
  }
34
34
  return 'The executor is used other than through a statement this rule can judge (held in a variable, a transaction).';
35
35
  }
36
+ /** The where holds the condition for every row, or says what is wrong with it. */
37
+ function unconfinedStatement(code, statement, at) {
38
+ const reading = { code, at, helper: CONDITION };
39
+ const conjunct = chainLinks(statement, 0)
40
+ .filter(({ method }) => method === 'where')
41
+ .some(({ argumentsText }) => isConjunct(argumentsText, reading));
42
+ if (conjunct) {
43
+ return undefined;
44
+ }
45
+ return CONDITION.test(statement) || declaredWith(code, { statement, method: 'where', at }, CONDITION)
46
+ ? 'The tenant condition is no conjunct of the statement: make it a direct argument of its where or of a top-level and, never under or, not or a sql template.'
47
+ : 'A statement reaches a table with no tenant condition in its where.';
48
+ }
36
49
  //# sourceMappingURL=drizzle-unscoped.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"drizzle-unscoped.js","sourceRoot":"","sources":["../../../src/check/tenancy/drizzle-unscoped.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,C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,CAAC;IAED,OAAO,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,YAAY,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,SAAS,CAAC;QACnG,CAAC,CAAC,4JAA4J;QAC9J,CAAC,CAAC,oEAAoE,CAAC;AAC3E,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** What a bracket encloses when it holds the whole expression: `a, b` of `[a, b]`, and `undefined` of `[a].concat(b)`. */
2
+ export declare function enclosedBy(bare: string, opening: '[' | '{'): string | undefined;
3
+ //# sourceMappingURL=enclosed-by.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enclosed-by.d.ts","sourceRoot":"","sources":["../../../src/check/tenancy/enclosed-by.ts"],"names":[],"mappings":"AAEA,0HAA0H;AAC1H,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,GAAG,GAAG,GAAG,MAAM,GAAG,SAAS,CAE/E"}
@@ -0,0 +1,6 @@
1
+ import { endOfEnclosing } from './end-of-enclosing.js';
2
+ /** What a bracket encloses when it holds the whole expression: `a, b` of `[a, b]`, and `undefined` of `[a].concat(b)`. */
3
+ export function enclosedBy(bare, opening) {
4
+ return bare.startsWith(opening) && endOfEnclosing(bare, 1) === bare.length - 1 ? bare.slice(1, -1) : undefined;
5
+ }
6
+ //# sourceMappingURL=enclosed-by.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enclosed-by.js","sourceRoot":"","sources":["../../../src/check/tenancy/enclosed-by.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,0HAA0H;AAC1H,MAAM,UAAU,UAAU,CAAC,IAAY,EAAE,OAAkB;IACzD,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,cAAc,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACjH,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Where what encloses `from` ends: the offset of the bracket that closes it, or of the first of
3
+ * `stops` outside any bracket, or the end of the code. A local lives up to the first (`}` of its
4
+ * block), an expression up to the second (the `,` or `;` after it).
5
+ */
6
+ export declare function endOfEnclosing(code: string, from: number, stops?: string): number;
7
+ //# sourceMappingURL=end-of-enclosing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"end-of-enclosing.d.ts","sourceRoot":"","sources":["../../../src/check/tenancy/end-of-enclosing.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,SAAK,GAAG,MAAM,CAc7E"}
@@ -0,0 +1,18 @@
1
+ import { BRACKET_DEPTH } from './bracket-depth.js';
2
+ /**
3
+ * Where what encloses `from` ends: the offset of the bracket that closes it, or of the first of
4
+ * `stops` outside any bracket, or the end of the code. A local lives up to the first (`}` of its
5
+ * block), an expression up to the second (the `,` or `;` after it).
6
+ */
7
+ export function endOfEnclosing(code, from, stops = '') {
8
+ let depth = 0;
9
+ for (let index = from; index < code.length; index += 1) {
10
+ const char = code.charAt(index);
11
+ depth += BRACKET_DEPTH[char] ?? 0;
12
+ if (depth < 0 || (depth === 0 && stops.includes(char))) {
13
+ return index;
14
+ }
15
+ }
16
+ return code.length;
17
+ }
18
+ //# sourceMappingURL=end-of-enclosing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"end-of-enclosing.js","sourceRoot":"","sources":["../../../src/check/tenancy/end-of-enclosing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,IAAY,EAAE,KAAK,GAAG,EAAE;IACnE,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,KAAK,IAAI,KAAK,GAAG,IAAI,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACvD,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAEhC,KAAK,IAAI,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAElC,IAAI,KAAK,GAAG,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;YACvD,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC,MAAM,CAAC;AACrB,CAAC"}
@@ -0,0 +1,14 @@
1
+ /** How a tenant condition is looked for: the source, where the statement is, and the helper that writes it. */
2
+ export interface ConditionReading {
3
+ readonly code: string;
4
+ readonly at: number;
5
+ readonly helper: RegExp;
6
+ }
7
+ /**
8
+ * Whether an expression holds the condition on every path through it: the helper called, a choice
9
+ * that holds it on both branches, a local declared with what holds it; anything else is what
10
+ * `holds` says, which is what an ORM makes of a conjunction. Each local followed is declared
11
+ * before the last, so the reading ends.
12
+ */
13
+ export declare function holdsCondition(text: string, reading: ConditionReading, holds: (bare: string, reading: ConditionReading) => boolean): boolean;
14
+ //# sourceMappingURL=holds-condition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"holds-condition.d.ts","sourceRoot":"","sources":["../../../src/check/tenancy/holds-condition.ts"],"names":[],"mappings":"AAOA,+GAA+G;AAC/G,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,gBAAgB,EACzB,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,KAAK,OAAO,GAC1D,OAAO,CAiBT"}
@@ -0,0 +1,26 @@
1
+ import { argumentsOfCall } from './arguments-of-call.js';
2
+ import { bareExpression } from './bare-expression.js';
3
+ import { choiceBranches } from './choice-branches.js';
4
+ import { declarationBefore } from './declaration-before.js';
5
+ const LOCAL = /^[A-Za-z_$][\w$]*$/;
6
+ /**
7
+ * Whether an expression holds the condition on every path through it: the helper called, a choice
8
+ * that holds it on both branches, a local declared with what holds it; anything else is what
9
+ * `holds` says, which is what an ORM makes of a conjunction. Each local followed is declared
10
+ * before the last, so the reading ends.
11
+ */
12
+ export function holdsCondition(text, reading, holds) {
13
+ const bare = bareExpression(text);
14
+ const branches = choiceBranches(bare);
15
+ if (branches !== undefined) {
16
+ return branches.every((branch) => holdsCondition(branch, reading, holds));
17
+ }
18
+ if (argumentsOfCall(bare, new RegExp(`^(?:${reading.helper.source})`)) !== undefined) {
19
+ return true;
20
+ }
21
+ const declaration = LOCAL.test(bare) ? declarationBefore(reading.code, bare, reading.at) : undefined;
22
+ return declaration === undefined
23
+ ? holds(bare, reading)
24
+ : holdsCondition(declaration.text, { ...reading, at: declaration.at }, holds);
25
+ }
26
+ //# sourceMappingURL=holds-condition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"holds-condition.js","sourceRoot":"","sources":["../../../src/check/tenancy/holds-condition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,MAAM,KAAK,GAAG,oBAAoB,CAAC;AASnC;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAC5B,IAAY,EACZ,OAAyB,EACzB,KAA2D;IAE3D,MAAM,IAAI,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IAClC,MAAM,QAAQ,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IAEtC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;IAC5E,CAAC;IAED,IAAI,eAAe,CAAC,IAAI,EAAE,IAAI,MAAM,CAAC,OAAO,OAAO,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC;QACrF,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAErG,OAAO,WAAW,KAAK,SAAS;QAC9B,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC;QACtB,CAAC,CAAC,cAAc,CAAC,WAAW,CAAC,IAAI,EAAE,EAAE,GAAG,OAAO,EAAE,EAAE,EAAE,WAAW,CAAC,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;AAClF,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { type ConditionReading } from './holds-condition.js';
2
+ /**
3
+ * Whether a Drizzle condition holds the tenant for every row: the helper is the condition, or a
4
+ * direct argument of an `and`, at any depth of `and`. An `or` or a `not` beside it is fine; the
5
+ * helper under one of them, or in a `sql` template, holds for one branch alone.
6
+ */
7
+ export declare function isConjunct(text: string, reading: ConditionReading): boolean;
8
+ //# sourceMappingURL=is-conjunct.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-conjunct.d.ts","sourceRoot":"","sources":["../../../src/check/tenancy/is-conjunct.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAK1E;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAE3E"}
@@ -0,0 +1,17 @@
1
+ import { argumentsOfCall } from './arguments-of-call.js';
2
+ import { holdsCondition } from './holds-condition.js';
3
+ import { topLevelParts } from './top-level-parts.js';
4
+ const AND = /and\s*\(/;
5
+ /**
6
+ * Whether a Drizzle condition holds the tenant for every row: the helper is the condition, or a
7
+ * direct argument of an `and`, at any depth of `and`. An `or` or a `not` beside it is fine; the
8
+ * helper under one of them, or in a `sql` template, holds for one branch alone.
9
+ */
10
+ export function isConjunct(text, reading) {
11
+ return holdsCondition(text, reading, inConjunction);
12
+ }
13
+ function inConjunction(bare, reading) {
14
+ const list = argumentsOfCall(bare, AND);
15
+ return list !== undefined && topLevelParts(list).some((part) => isConjunct(part, reading));
16
+ }
17
+ //# sourceMappingURL=is-conjunct.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-conjunct.js","sourceRoot":"","sources":["../../../src/check/tenancy/is-conjunct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAyB,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,MAAM,GAAG,GAAG,UAAU,CAAC;AAEvB;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY,EAAE,OAAyB;IAChE,OAAO,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;AACtD,CAAC;AAED,SAAS,aAAa,CAAC,IAAY,EAAE,OAAyB;IAC5D,MAAM,IAAI,GAAG,eAAe,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAExC,OAAO,IAAI,KAAK,SAAS,IAAI,aAAa,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;AAC7F,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { ChainLink } from './chain-links.js';
2
+ /** Whether a link of a builder chain adds an alternative at the top of its statement. */
3
+ export declare function isOrLink({ method }: ChainLink): boolean;
4
+ //# sourceMappingURL=is-or-link.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-or-link.d.ts","sourceRoot":"","sources":["../../../src/check/tenancy/is-or-link.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAK/C,yFAAyF;AACzF,wBAAgB,QAAQ,CAAC,EAAE,MAAM,EAAE,EAAE,SAAS,GAAG,OAAO,CAEvD"}
@@ -0,0 +1,7 @@
1
+ /** What adds an alternative beside the conditions of a statement: `orWhere`, `orWhereIn`, the `or` modifier. `orHaving` applies after the where, and is free. */
2
+ const OR_METHOD = /^or(?:$|Where)/;
3
+ /** Whether a link of a builder chain adds an alternative at the top of its statement. */
4
+ export function isOrLink({ method }) {
5
+ return OR_METHOD.test(method);
6
+ }
7
+ //# sourceMappingURL=is-or-link.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-or-link.js","sourceRoot":"","sources":["../../../src/check/tenancy/is-or-link.ts"],"names":[],"mappings":"AAEA,iKAAiK;AACjK,MAAM,SAAS,GAAG,gBAAgB,CAAC;AAEnC,yFAAyF;AACzF,MAAM,UAAU,QAAQ,CAAC,EAAE,MAAM,EAAa;IAC5C,OAAO,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAChC,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { SourceFile } from '../model/source-file.js';
2
+ import { type ChainLink } from './chain-links.js';
3
+ /**
4
+ * The links of a Knex adapter that leave the tenant condition of a statement of the helpers: an
5
+ * `or` at its top, or what clears its conditions; on the chain of a helper, of what a function of
6
+ * the file answers, of a local that holds one of them, and in the builder given to `whereTenant`.
7
+ * In SQL `and` binds first, so such an `or` is outside the condition. The callback of a `where`
8
+ * is a group, and what it holds is left out; a `modify` is no group.
9
+ */
10
+ export declare function knexLinksOutsideCondition(file: SourceFile): readonly ChainLink[];
11
+ //# sourceMappingURL=knex-links-outside-condition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"knex-links-outside-condition.d.ts","sourceRoot":"","sources":["../../../src/check/tenancy/knex-links-outside-condition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAyB3D;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,SAAS,EAAE,CAchF"}
@@ -0,0 +1,108 @@
1
+ import { balancedArguments } from './balanced-arguments.js';
2
+ import { chainLinks } from './chain-links.js';
3
+ import { endOfEnclosing } from './end-of-enclosing.js';
4
+ import { isOrLink } from './is-or-link.js';
5
+ import { rawSqlText } from './raw-sql-text.js';
6
+ const HELPERS = ['tenantTable', 'ownTenantTable', 'whereTenant'];
7
+ const NAME = '[A-Za-z_$][\\w$]*';
8
+ /** A method or a function of the file that answers a builder of the helpers. */
9
+ const ANSWERS_BUILDER = new RegExp(`(${NAME})\\s*\\([^()]*\\)\\s*(?::[^{;]*)?\\{\\s*return\\s+(?:${HELPERS.join('|')})(?![\\w$])`, 'g');
10
+ const DECLARED = new RegExp(`(?:const|let)\\s+(${NAME})\\s*(?::[^=;]*)?=\\s*`, 'g');
11
+ const GIVEN_TO_HELPER = new RegExp(`(?<![\\w$])whereTenant\\s*(?:<[^()]*>\\s*)?\\(\\s*(${NAME})\\s*,`, 'g');
12
+ const CALLBACK = new RegExp(`^\\s*(?:async\\s+)?\\(?\\s*(${NAME})\\s*(?::[^()]*)?\\)?\\s*=>`);
13
+ /**
14
+ * The links of a Knex adapter that leave the tenant condition of a statement of the helpers: an
15
+ * `or` at its top, or what clears its conditions; on the chain of a helper, of what a function of
16
+ * the file answers, of a local that holds one of them, and in the builder given to `whereTenant`.
17
+ * In SQL `and` binds first, so such an `or` is outside the condition. The callback of a `where`
18
+ * is a group, and what it holds is left out; a `modify` is no group.
19
+ */
20
+ export function knexLinksOutsideCondition(file) {
21
+ const { code } = file.scan;
22
+ const answered = [...code.matchAll(ANSWERS_BUILDER)].map(([, name = '']) => escaped(name));
23
+ const source = `(?<![\\w$])(?:${[...HELPERS, ...answered].join('|')})\\s*(?:<[^()]*>\\s*)?\\(`;
24
+ const calls = [...code.matchAll(new RegExp(source, 'g'))].flatMap((match) => chainsOfCall(code, match));
25
+ const locals = builderLocals(code, new RegExp(`(?:this\\s*\\.\\s*)?${source}`, 'y')).flatMap((local) => [
26
+ chainOfExpression(code, local.from),
27
+ ...uses(code, local),
28
+ ]);
29
+ const links = [...calls, ...locals].flatMap((chain) => linksOutside(file, chain));
30
+ return [...new Map(links.map((link) => [link.offset, link])).values()];
31
+ }
32
+ function chainsOfCall(code, match) {
33
+ const open = match.index + match[0].length - 1;
34
+ const after = chainLinks(code, open + balancedArguments(code, open).length + 2);
35
+ return match[0].startsWith('whereTenant') ? [after, chainOfExpression(code, open + 1)] : [after];
36
+ }
37
+ /** The chain of an expression, from the first dot outside its brackets: `rows.where(a).orWhere(b)`. */
38
+ function chainOfExpression(code, from) {
39
+ const stop = endOfEnclosing(code, from, '.,;');
40
+ return code.charAt(stop) === '.' ? chainLinks(code, stop) : [];
41
+ }
42
+ function builderLocals(code, startsBuilder) {
43
+ const given = [...code.matchAll(GIVEN_TO_HELPER)];
44
+ const locals = [];
45
+ for (const match of code.matchAll(DECLARED)) {
46
+ const name = match[1] ?? '';
47
+ const from = match.index + match[0].length;
48
+ const local = { name, from, to: endOfEnclosing(code, from) };
49
+ startsBuilder.lastIndex = from;
50
+ const isGiven = given.some(({ 1: other, index }) => other === name && from <= index && index <= local.to);
51
+ if (isGiven || startsBuilder.test(code) || startsFromLocal(code, from, locals)) {
52
+ locals.push(local);
53
+ }
54
+ }
55
+ return locals;
56
+ }
57
+ function startsFromLocal(code, value, locals) {
58
+ const first = new RegExp(NAME, 'y');
59
+ first.lastIndex = value;
60
+ const name = first.exec(code)?.[0];
61
+ return locals.some((local) => local.name === name && local.from <= value && value <= local.to);
62
+ }
63
+ /** The chain after each use of a local, in the callbacks that name a parameter alike left out. */
64
+ function uses(code, local) {
65
+ const { name, from, to } = local;
66
+ const hidden = hiddenRanges(code, local);
67
+ const use = new RegExp(`(?<![\\w$.])${escaped(name)}(?=\\s*\\??\\.)`, 'g');
68
+ return [...code.slice(from, to).matchAll(use)]
69
+ .map((match) => from + match.index)
70
+ .filter((at) => !hidden.some(([start, end]) => start <= at && at <= end))
71
+ .map((at) => chainLinks(code, at + name.length));
72
+ }
73
+ /** The callbacks in the life of a local with a parameter named as it: what they hold is the parameter. */
74
+ function hiddenRanges(code, { name, from, to }) {
75
+ const parameter = new RegExp(`(?:\\(\\s*${escaped(name)}\\s*(?::[^()]*)?\\)|(?<![\\w$.])${escaped(name)})\\s*=>`, 'g');
76
+ return [...code.slice(from, to).matchAll(parameter)].map((match) => {
77
+ const start = from + match.index + match[0].length;
78
+ return [start, endOfEnclosing(code, start, ',;')];
79
+ });
80
+ }
81
+ /** The links of a chain that leave the condition, and the ones a `modify` adds on the same builder through its callback. */
82
+ function linksOutside(file, links) {
83
+ return links.flatMap((link) => {
84
+ if (isOrLink(link) || clearsConditions(file, link)) {
85
+ return [link];
86
+ }
87
+ return link.method === 'modify' ? linksOfModify(file, link) : [];
88
+ });
89
+ }
90
+ function clearsConditions(file, { method, argumentsAt }) {
91
+ return method === 'clearWhere' || (method === 'clear' && rawSqlText(file, argumentsAt) === 'where');
92
+ }
93
+ function linksOfModify(file, { argumentsAt, argumentsText }) {
94
+ const callback = CALLBACK.exec(argumentsText);
95
+ if (callback === null) {
96
+ return [];
97
+ }
98
+ const local = {
99
+ name: callback[1] ?? '',
100
+ from: argumentsAt + callback[0].length,
101
+ to: argumentsAt + argumentsText.length,
102
+ };
103
+ return uses(file.scan.code, local).flatMap((chain) => linksOutside(file, chain));
104
+ }
105
+ function escaped(name) {
106
+ return name.replaceAll('$', '\\$');
107
+ }
108
+ //# sourceMappingURL=knex-links-outside-condition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"knex-links-outside-condition.js","sourceRoot":"","sources":["../../../src/check/tenancy/knex-links-outside-condition.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAkB,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,MAAM,OAAO,GAAG,CAAC,aAAa,EAAE,gBAAgB,EAAE,aAAa,CAAC,CAAC;AACjE,MAAM,IAAI,GAAG,mBAAmB,CAAC;AAEjC,gFAAgF;AAChF,MAAM,eAAe,GAAG,IAAI,MAAM,CAChC,IAAI,IAAI,wDAAwD,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,aAAa,EAC9F,GAAG,CACJ,CAAC;AAEF,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC,qBAAqB,IAAI,wBAAwB,EAAE,GAAG,CAAC,CAAC;AACpF,MAAM,eAAe,GAAG,IAAI,MAAM,CAAC,sDAAsD,IAAI,QAAQ,EAAE,GAAG,CAAC,CAAC;AAC5G,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC,+BAA+B,IAAI,6BAA6B,CAAC,CAAC;AAS9F;;;;;;GAMG;AACH,MAA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C;AAED,SAAS,OAAO,CAAC,IAAY;IAC3B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AACrC,CAAC"}
@@ -3,7 +3,9 @@ import type { SourceFile } from '../model/source-file.js';
3
3
  * What a Knex adapter of tenant data reaches without the helpers: the executor called, chained or
4
4
  * held, and raw SQL. A raw call whose first argument is a literal that reaches no row by itself
5
5
  * (an aggregate in a select, a constraint of the schema: `rawReachesRows`) is not reported, since
6
- * the statement it is put in is what the tenant confines; any other raw call is.
6
+ * the statement it is put in is what the tenant confines; any other raw call is. An `or` at the
7
+ * top of a statement of the helpers, or a clear of its conditions, leaves the tenant condition
8
+ * behind (`knexLinksOutsideCondition`).
7
9
  */
8
10
  export declare function knexUnscoped(file: SourceFile): readonly {
9
11
  offset: number;
@@ -1 +1 @@
1
- {"version":3,"file":"knex-unscoped.d.ts","sourceRoot":"","sources":["../../../src/check/tenancy/knex-unscoped.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAWvD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,EAAE,CAe7F"}
1
+ {"version":3,"file":"knex-unscoped.d.ts","sourceRoot":"","sources":["../../../src/check/tenancy/knex-unscoped.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAmBvD;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,EAAE,CAoB7F"}