ddd-ts-kit 0.101.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 (293) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/README.fr.md +4 -4
  3. package/README.md +3 -3
  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/run-fixture.d.ts +3 -2
  39. package/dist/check/fixtures/run-fixture.d.ts.map +1 -1
  40. package/dist/check/fixtures/run-fixture.js +3 -3
  41. package/dist/check/fixtures/run-fixture.js.map +1 -1
  42. package/dist/check/fixtures/run-self-check.js +1 -1
  43. package/dist/check/fixtures/run-self-check.js.map +1 -1
  44. package/dist/check/fixtures/tenancy-conjunct-drizzle-fixtures.d.ts +3 -0
  45. package/dist/check/fixtures/tenancy-conjunct-drizzle-fixtures.d.ts.map +1 -0
  46. package/dist/check/fixtures/tenancy-conjunct-drizzle-fixtures.js +33 -0
  47. package/dist/check/fixtures/tenancy-conjunct-drizzle-fixtures.js.map +1 -0
  48. package/dist/check/fixtures/tenancy-conjunct-fixtures.d.ts +4 -0
  49. package/dist/check/fixtures/tenancy-conjunct-fixtures.d.ts.map +1 -0
  50. package/dist/check/fixtures/tenancy-conjunct-fixtures.js +12 -0
  51. package/dist/check/fixtures/tenancy-conjunct-fixtures.js.map +1 -0
  52. package/dist/check/fixtures/tenancy-conjunct-knex-fixtures.d.ts +3 -0
  53. package/dist/check/fixtures/tenancy-conjunct-knex-fixtures.d.ts.map +1 -0
  54. package/dist/check/fixtures/tenancy-conjunct-knex-fixtures.js +49 -0
  55. package/dist/check/fixtures/tenancy-conjunct-knex-fixtures.js.map +1 -0
  56. package/dist/check/fixtures/tenancy-conjunct-prisma-fixtures.d.ts +3 -0
  57. package/dist/check/fixtures/tenancy-conjunct-prisma-fixtures.d.ts.map +1 -0
  58. package/dist/check/fixtures/tenancy-conjunct-prisma-fixtures.js +32 -0
  59. package/dist/check/fixtures/tenancy-conjunct-prisma-fixtures.js.map +1 -0
  60. package/dist/check/fixtures/tenancy-conjunct-typeorm-fixtures.d.ts +3 -0
  61. package/dist/check/fixtures/tenancy-conjunct-typeorm-fixtures.d.ts.map +1 -0
  62. package/dist/check/fixtures/tenancy-conjunct-typeorm-fixtures.js +34 -0
  63. package/dist/check/fixtures/tenancy-conjunct-typeorm-fixtures.js.map +1 -0
  64. package/dist/check/fixtures/tenancy-fixtures.d.ts.map +1 -1
  65. package/dist/check/fixtures/tenancy-fixtures.js +2 -0
  66. package/dist/check/fixtures/tenancy-fixtures.js.map +1 -1
  67. package/dist/check/rules/clean-one-export-per-file.js +1 -0
  68. package/dist/check/rules/clean-one-export-per-file.js.map +1 -1
  69. package/dist/check/rules/schema-no-duplicate-shape.js +1 -3
  70. package/dist/check/rules/schema-no-duplicate-shape.js.map +1 -1
  71. package/dist/check/rules/tenancy-scoped-statement.js +2 -2
  72. package/dist/check/rules/tenancy-scoped-statement.js.map +1 -1
  73. package/dist/check/tenancy/arguments-of-call.d.ts +3 -0
  74. package/dist/check/tenancy/arguments-of-call.d.ts.map +1 -0
  75. package/dist/check/tenancy/arguments-of-call.js +11 -0
  76. package/dist/check/tenancy/arguments-of-call.js.map +1 -0
  77. package/dist/check/tenancy/bare-expression.d.ts +3 -0
  78. package/dist/check/tenancy/bare-expression.d.ts.map +1 -0
  79. package/dist/check/tenancy/bare-expression.js +9 -0
  80. package/dist/check/tenancy/bare-expression.js.map +1 -0
  81. package/dist/check/tenancy/bracket-depth.d.ts +3 -0
  82. package/dist/check/tenancy/bracket-depth.d.ts.map +1 -0
  83. package/dist/check/tenancy/bracket-depth.js +10 -0
  84. package/dist/check/tenancy/bracket-depth.js.map +1 -0
  85. package/dist/check/tenancy/chain-links.d.ts +17 -0
  86. package/dist/check/tenancy/chain-links.d.ts.map +1 -0
  87. package/dist/check/tenancy/chain-links.js +24 -0
  88. package/dist/check/tenancy/chain-links.js.map +1 -0
  89. package/dist/check/tenancy/choice-branches.d.ts +3 -0
  90. package/dist/check/tenancy/choice-branches.d.ts.map +1 -0
  91. package/dist/check/tenancy/choice-branches.js +39 -0
  92. package/dist/check/tenancy/choice-branches.js.map +1 -0
  93. package/dist/check/tenancy/declaration-before.d.ts +12 -0
  94. package/dist/check/tenancy/declaration-before.d.ts.map +1 -0
  95. package/dist/check/tenancy/declaration-before.js +11 -0
  96. package/dist/check/tenancy/declaration-before.js.map +1 -0
  97. package/dist/check/tenancy/declaration-of.d.ts +1 -5
  98. package/dist/check/tenancy/declaration-of.d.ts.map +1 -1
  99. package/dist/check/tenancy/declaration-of.js +3 -8
  100. package/dist/check/tenancy/declaration-of.js.map +1 -1
  101. package/dist/check/tenancy/drizzle-unscoped.d.ts.map +1 -1
  102. package/dist/check/tenancy/drizzle-unscoped.js +16 -3
  103. package/dist/check/tenancy/drizzle-unscoped.js.map +1 -1
  104. package/dist/check/tenancy/enclosed-by.d.ts +3 -0
  105. package/dist/check/tenancy/enclosed-by.d.ts.map +1 -0
  106. package/dist/check/tenancy/enclosed-by.js +6 -0
  107. package/dist/check/tenancy/enclosed-by.js.map +1 -0
  108. package/dist/check/tenancy/end-of-enclosing.d.ts +7 -0
  109. package/dist/check/tenancy/end-of-enclosing.d.ts.map +1 -0
  110. package/dist/check/tenancy/end-of-enclosing.js +18 -0
  111. package/dist/check/tenancy/end-of-enclosing.js.map +1 -0
  112. package/dist/check/tenancy/holds-condition.d.ts +14 -0
  113. package/dist/check/tenancy/holds-condition.d.ts.map +1 -0
  114. package/dist/check/tenancy/holds-condition.js +26 -0
  115. package/dist/check/tenancy/holds-condition.js.map +1 -0
  116. package/dist/check/tenancy/is-conjunct.d.ts +8 -0
  117. package/dist/check/tenancy/is-conjunct.d.ts.map +1 -0
  118. package/dist/check/tenancy/is-conjunct.js +17 -0
  119. package/dist/check/tenancy/is-conjunct.js.map +1 -0
  120. package/dist/check/tenancy/is-or-link.d.ts +4 -0
  121. package/dist/check/tenancy/is-or-link.d.ts.map +1 -0
  122. package/dist/check/tenancy/is-or-link.js +7 -0
  123. package/dist/check/tenancy/is-or-link.js.map +1 -0
  124. package/dist/check/tenancy/knex-links-outside-condition.d.ts +11 -0
  125. package/dist/check/tenancy/knex-links-outside-condition.d.ts.map +1 -0
  126. package/dist/check/tenancy/knex-links-outside-condition.js +108 -0
  127. package/dist/check/tenancy/knex-links-outside-condition.js.map +1 -0
  128. package/dist/check/tenancy/knex-unscoped.d.ts +3 -1
  129. package/dist/check/tenancy/knex-unscoped.d.ts.map +1 -1
  130. package/dist/check/tenancy/knex-unscoped.js +12 -2
  131. package/dist/check/tenancy/knex-unscoped.js.map +1 -1
  132. package/dist/check/tenancy/prisma-unscoped.d.ts.map +1 -1
  133. package/dist/check/tenancy/prisma-unscoped.js +15 -10
  134. package/dist/check/tenancy/prisma-unscoped.js.map +1 -1
  135. package/dist/check/tenancy/spreads-at-top.d.ts +9 -0
  136. package/dist/check/tenancy/spreads-at-top.d.ts.map +1 -0
  137. package/dist/check/tenancy/spreads-at-top.js +49 -0
  138. package/dist/check/tenancy/spreads-at-top.js.map +1 -0
  139. package/dist/check/tenancy/top-level-parts.d.ts +3 -0
  140. package/dist/check/tenancy/top-level-parts.d.ts.map +1 -0
  141. package/dist/check/tenancy/top-level-parts.js +13 -0
  142. package/dist/check/tenancy/top-level-parts.js.map +1 -0
  143. package/dist/check/tenancy/typeorm-unscoped.d.ts.map +1 -1
  144. package/dist/check/tenancy/typeorm-unscoped.js +30 -16
  145. package/dist/check/tenancy/typeorm-unscoped.js.map +1 -1
  146. package/dist/check/tenancy/unconfined-where.d.ts +11 -0
  147. package/dist/check/tenancy/unconfined-where.d.ts.map +1 -0
  148. package/dist/check/tenancy/unconfined-where.js +18 -0
  149. package/dist/check/tenancy/unconfined-where.js.map +1 -0
  150. package/dist/config/read-config.d.ts.map +1 -1
  151. package/dist/config/read-config.js +20 -0
  152. package/dist/config/read-config.js.map +1 -1
  153. package/dist/declared/render-declarations.js +1 -3
  154. package/dist/declared/render-declarations.js.map +1 -1
  155. package/dist/describe/read-controllers.d.ts.map +1 -1
  156. package/dist/describe/read-controllers.js +18 -2
  157. package/dist/describe/read-controllers.js.map +1 -1
  158. package/dist/describe/schema-class-of.js +8 -1
  159. package/dist/describe/schema-class-of.js.map +1 -1
  160. package/dist/digest/tree-at.d.ts.map +1 -1
  161. package/dist/digest/tree-at.js +2 -0
  162. package/dist/digest/tree-at.js.map +1 -1
  163. package/dist/docs/context-sections.js +3 -7
  164. package/dist/docs/context-sections.js.map +1 -1
  165. package/dist/docs/personal-event-lines.d.ts +7 -0
  166. package/dist/docs/personal-event-lines.d.ts.map +1 -0
  167. package/dist/docs/personal-event-lines.js +34 -0
  168. package/dist/docs/personal-event-lines.js.map +1 -0
  169. package/dist/docs/write-docs.d.ts.map +1 -1
  170. package/dist/docs/write-docs.js +2 -0
  171. package/dist/docs/write-docs.js.map +1 -1
  172. package/dist/docs/write-personal-events.d.ts +11 -0
  173. package/dist/docs/write-personal-events.d.ts.map +1 -0
  174. package/dist/docs/write-personal-events.js +28 -0
  175. package/dist/docs/write-personal-events.js.map +1 -0
  176. package/dist/generate/kinds/assert-event-store.d.ts +5 -1
  177. package/dist/generate/kinds/assert-event-store.d.ts.map +1 -1
  178. package/dist/generate/kinds/assert-event-store.js +11 -5
  179. package/dist/generate/kinds/assert-event-store.js.map +1 -1
  180. package/dist/generate/kinds/background/background-job-vars.js +4 -2
  181. package/dist/generate/kinds/background/background-job-vars.js.map +1 -1
  182. package/dist/generate/kinds/generate-event-sourced-repository.js +8 -1
  183. package/dist/generate/kinds/generate-event-sourced-repository.js.map +1 -1
  184. package/dist/generate/kinds/route/controller-vars.js +1 -1
  185. package/dist/generate/kinds/route/controller-vars.js.map +1 -1
  186. package/dist/generate/kinds/route/message-call.d.ts +6 -2
  187. package/dist/generate/kinds/route/message-call.d.ts.map +1 -1
  188. package/dist/generate/kinds/route/message-call.js +2 -1
  189. package/dist/generate/kinds/route/message-call.js.map +1 -1
  190. package/dist/generate/kinds/route/standard-schema-of.d.ts +2 -1
  191. package/dist/generate/kinds/route/standard-schema-of.d.ts.map +1 -1
  192. package/dist/generate/kinds/route/standard-schema-of.js +2 -4
  193. package/dist/generate/kinds/route/standard-schema-of.js.map +1 -1
  194. package/dist/generate/kinds/service-kind.js +1 -1
  195. package/dist/generate/kinds/service-kind.js.map +1 -1
  196. package/dist/generator-lock/unreadable-lock-refusal.d.ts +4 -0
  197. package/dist/generator-lock/unreadable-lock-refusal.d.ts.map +1 -0
  198. package/dist/generator-lock/unreadable-lock-refusal.js +7 -0
  199. package/dist/generator-lock/unreadable-lock-refusal.js.map +1 -0
  200. package/dist/generator-lock/with-generator-lock.d.ts.map +1 -1
  201. package/dist/generator-lock/with-generator-lock.js +8 -7
  202. package/dist/generator-lock/with-generator-lock.js.map +1 -1
  203. package/dist/init/files/platform-files.d.ts.map +1 -1
  204. package/dist/init/files/platform-files.js +14 -0
  205. package/dist/init/files/platform-files.js.map +1 -1
  206. package/dist/init/files/privacy-files.d.ts +2 -2
  207. package/dist/init/files/privacy-files.d.ts.map +1 -1
  208. package/dist/init/files/privacy-files.js +3 -2
  209. package/dist/init/files/privacy-files.js.map +1 -1
  210. package/dist/init/manifest/versions.js +24 -24
  211. package/dist/measures/timeline-of.js +1 -0
  212. package/dist/measures/timeline-of.js.map +1 -1
  213. package/dist/progress/format-progress.js +1 -0
  214. package/dist/progress/format-progress.js.map +1 -1
  215. package/dist/sdk/planned-clients.d.ts +2 -2
  216. package/dist/sdk/planned-clients.d.ts.map +1 -1
  217. package/dist/sdk/planned-clients.js +2 -6
  218. package/dist/sdk/planned-clients.js.map +1 -1
  219. package/dist/sdk/set-up-sdk.d.ts.map +1 -1
  220. package/dist/sdk/set-up-sdk.js +3 -2
  221. package/dist/sdk/set-up-sdk.js.map +1 -1
  222. package/dist/stack/stack-vars.js +12 -3
  223. package/dist/stack/stack-vars.js.map +1 -1
  224. package/dist/stories/forecast-merge.js +1 -0
  225. package/dist/stories/forecast-merge.js.map +1 -1
  226. package/dist/version.d.ts +1 -1
  227. package/dist/version.js +1 -1
  228. package/dist/worker/format-resume.d.ts.map +1 -1
  229. package/dist/worker/format-resume.js +5 -0
  230. package/dist/worker/format-resume.js.map +1 -1
  231. package/dist/worker/format-workers.js +5 -0
  232. package/dist/worker/format-workers.js.map +1 -1
  233. package/dist/worker/progress-of.d.ts +8 -3
  234. package/dist/worker/progress-of.d.ts.map +1 -1
  235. package/dist/worker/progress-of.js +2 -16
  236. package/dist/worker/progress-of.js.map +1 -1
  237. package/dist/worker/read-agent-record.d.ts.map +1 -1
  238. package/dist/worker/read-agent-record.js +15 -3
  239. package/dist/worker/read-agent-record.js.map +1 -1
  240. package/dist/worker/read-workers.js +2 -2
  241. package/dist/worker/read-workers.js.map +1 -1
  242. package/dist/worker/readable-progress.d.ts +5 -0
  243. package/dist/worker/readable-progress.d.ts.map +1 -0
  244. package/dist/worker/readable-progress.js +16 -0
  245. package/dist/worker/readable-progress.js.map +1 -0
  246. package/dist/worker/resume-worker.d.ts.map +1 -1
  247. package/dist/worker/resume-worker.js +4 -5
  248. package/dist/worker/resume-worker.js.map +1 -1
  249. package/dist/worker/worker-progress.d.ts +2 -1
  250. package/dist/worker/worker-progress.d.ts.map +1 -1
  251. package/dist/workspace/real-path-of.d.ts +2 -2
  252. package/dist/workspace/real-path-of.d.ts.map +1 -1
  253. package/dist/workspace/real-path-of.js +15 -10
  254. package/dist/workspace/real-path-of.js.map +1 -1
  255. package/package.json +5 -5
  256. package/templates/docs/privacy-register.md.tpl +2 -0
  257. package/templates/init/README.md.tpl +13 -4
  258. package/templates/init/docker/env.example.tpl +8 -0
  259. package/templates/init/main.ts.tpl +3 -0
  260. package/templates/init/platform/audit/create-audit.ts.tpl +12 -6
  261. package/templates/init/platform/composition/compose-application.manual.ts.tpl +36 -0
  262. package/templates/init/platform/composition/compose-application.tsyringe.ts.tpl +7 -0
  263. package/templates/init/platform/composition/lay-foundations.manual.ts.tpl +1 -1
  264. package/templates/init/platform/composition/lay-foundations.tsyringe.ts.tpl +1 -1
  265. package/templates/init/platform/composition/platform-options.manual.ts.tpl +7 -0
  266. package/templates/init/platform/composition/platform.manual.ts.tpl +7 -0
  267. package/templates/init/platform/composition/platform.module.tsyringe.ts.tpl +7 -0
  268. package/templates/init/platform/config/app-config.ts.tpl +7 -0
  269. package/templates/init/platform/config/load-config.ts.tpl +22 -0
  270. package/templates/init/platform/database/persistence.contract.spec.ts.tpl +14 -3
  271. package/templates/init/platform/event-sourcing/create-event-sourcing.ts.tpl +5 -1
  272. package/templates/init/platform/jobs/create-background-work.ts.tpl +12 -0
  273. package/templates/init/platform/jobs/days-before.ts.tpl +8 -0
  274. package/templates/init/platform/jobs/housekeeping.module.tsyringe.ts.tpl +46 -0
  275. package/templates/init/platform/jobs/housekeeping.ts.tpl +24 -0
  276. package/templates/init/platform/jobs/job-settings.ts.tpl +6 -0
  277. package/templates/init/platform/privacy/personal-events.ts.tpl +11 -0
  278. package/templates/init/platform/privacy/run-erasure.manual.ts.tpl +69 -19
  279. package/templates/init/platform/privacy/run-erasure.tsyringe.ts.tpl +69 -8
  280. package/templates/init/platform/privacy/run-export.manual.ts.tpl +2 -2
  281. package/templates/init/platform/privacy/run-export.tsyringe.ts.tpl +4 -2
  282. package/templates/init/platform/privacy/run-purge.manual.ts.tpl +3 -2
  283. package/templates/init/platform/privacy/run-purge.tsyringe.ts.tpl +4 -2
  284. package/templates/init/rules/infrastructure.md.tpl +1 -1
  285. package/templates/init/scripts/privacy-erase.manual.ts.tpl +52 -7
  286. package/templates/init/scripts/privacy-erase.tsyringe.ts.tpl +52 -7
  287. package/templates/init/scripts/privacy-export.manual.ts.tpl +4 -0
  288. package/templates/init/scripts/privacy-export.tsyringe.ts.tpl +4 -0
  289. package/templates/init/scripts/privacy-purge.manual.ts.tpl +4 -0
  290. package/templates/init/scripts/privacy-purge.tsyringe.ts.tpl +4 -0
  291. package/templates/pipeline/package-scripts.json +1 -1
  292. package/templates/pipeline/stryker.config.mjs.tpl +4 -0
  293. package/templates/worker/main.ts.tpl +3 -0
@@ -51,10 +51,8 @@ function rank(path, home) {
51
51
  }
52
52
  return path.includes(SHARED_OF_A_CONTEXT) ? 1 : 2;
53
53
  }
54
+ /** The paths of two files of the project, which are never the same one. */
54
55
  function compare(a, b) {
55
- if (a === b) {
56
- return 0;
57
- }
58
56
  return a < b ? -1 : 1;
59
57
  }
60
58
  //# sourceMappingURL=schema-no-duplicate-shape.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema-no-duplicate-shape.js","sourceRoot":"","sources":["../../../src/check/rules/schema-no-duplicate-shape.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,2HAA2H;AAC3H,MAAM,cAAc,GAAG,iCAAiC,CAAC;AAEzD,8HAA8H;AAC9H,MAAM,mBAAmB,GAAG,4BAA4B,CAAC;AAEzD,gGAAgG;AAChG,MAAM,MAAM,GAAG,EAAE,CAAC;AAElB,MAAM,GAAG,GACP,6dAA6d,CAAC;AAQhe,MAAM,CAAC,MAAM,sBAAsB,GAAS;IAC1C,EAAE,EAAE,2BAA2B;IAC/B,WAAW,EACT,obAAob;IACtb,KAAK,EAAE,SAAS;IAChB,GAAG,CAAC,OAAO;QACT,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC;YAC5B,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;QAC1C,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;QAExC,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAe,EAAE;YACtD,MAAM,OAAO,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knex-unscoped.js';
6
6
  import { prismaUnscoped } from '../tenancy/prisma-unscoped.js';
7
7
  import { typeormUnscoped } from '../tenancy/typeorm-unscoped.js';
8
8
  import { unscopedReadModels } from '../tenancy/unscoped-read-models.js';
9
- const FIX = 'Reach tenant data through the helpers of the ORM package: `tenantTable` to read and `ownTenantTable` to write (Knex), `tenantCondition` and `ownTenantCondition` in the where of each statement and `tenantScopeOf` in each inserted row (Drizzle), `tenantWhere` and `ownTenantWhere` spread into the where of each statement and `tenantScopeOf` into each created row (Prisma, TypeORM), the `tenant` option of a read model store. A context whose tables belong to no tenant (the control plane of the tenants) is declared so, `"contexts.<name>.tenancy": "control-plane"` recorded in "deviations"; one table that holds no tenant data is a deviation: `// ddd-ts-kit-disable-next-line tenancy/scoped-statement -- ADR-NNNN: <why>`.';
9
+ const FIX = 'Reach tenant data through the helpers of the ORM package: `tenantTable` to read and `ownTenantTable` to write (Knex), `tenantCondition` and `ownTenantCondition` in the where of each statement and `tenantScopeOf` in each inserted row (Drizzle), `tenantWhere` and `ownTenantWhere` spread into the where of each statement and `tenantScopeOf` into each created row (Prisma, TypeORM), the `tenant` option of a read model store. The condition is a conjunct of the statement, since SQL binds `and` before `or`: alternatives go in a group beside it, `.where((either) => either.where(a).orWhere(b))` (Knex), `.where(and(tenantCondition(...), or(a, b)))` (Drizzle), an `OR` beside the top-level spread (Prisma), `new Brackets(...)` in an `andWhere` and a where array whose every entry spreads the helper (TypeORM). A context whose tables belong to no tenant (the control plane of the tenants) is declared so, `"contexts.<name>.tenancy": "control-plane"` recorded in "deviations"; one table that holds no tenant data is a deviation: `// ddd-ts-kit-disable-next-line tenancy/scoped-statement -- ADR-NNNN: <why>`.';
10
10
  const READ_MODEL = 'A read model store is built without the `tenant` option: its rows are shared by every tenant.';
11
11
  export const tenancyScopedStatement = {
12
12
  id: 'tenancy/scoped-statement',
13
- description: 'In a multi-tenant project ("stack.tenancy" other than "none"), a persistence adapter of a context that is not the control plane of the tenants confines every statement to the tenant of the work through the helpers of its ORM package: never the executor, client or manager used straight, raw SQL, a relational query, a row reached by its key alone, or a read model store without its tenant.',
13
+ description: 'In a multi-tenant project ("stack.tenancy" other than "none"), a persistence adapter of a context that is not the control plane of the tenants confines every statement to the tenant of the work through the helpers of its ORM package: never the executor, client or manager used straight, raw SQL, a relational query, a row reached by its key alone, or a read model store without its tenant. The condition is a conjunct of the statement: never beside an `or` at its top, or under an `or`, a `not` or a `sql` template.',
14
14
  scope: 'file',
15
15
  run(project) {
16
16
  const { tenancy, orm } = project.config.stack;
@@ -1 +1 @@
1
- {"version":3,"file":"tenancy-scoped-statement.js","sourceRoot":"","sources":["../../../src/check/rules/tenancy-scoped-statement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAe,MAAM,cAAc,CAAC;AAI3D,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE,MAAM,GAAG,GACP,gtBAAgtB,CAAC;AAEntB,MAAM,UAAU,GAAG,+FAA+F,CAAC;AAEnH,MAAM,CAAC,MAAM,sBAAsB,GAAS;IAC1C,EAAE,EAAE,0BAA0B;IAC9B,WAAW,EACT,uYAAuY;IACzY,KAAK,EAAE,MAAM;IACb,GAAG,CAAC,OAAO;QACT,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;QAE9C,IAAI,OAAO,KAAK,MAAM,EAAE,CAAC;YACvB,OAAO,EAAE,CAAC;QACZ,CA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9G,SAAS,SAAS,CAAC,IAAgB,EAAE,MAAc;IACjD,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAE9E,OAAO,QAAQ,KAAK,SAAS,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;AAC7E,CAAC;AAED,MAAM,UAAU,GAAmG;IACjH,IAAI,EAAE,YAAY;IAClB,OAAO,EAAE,eAAe;IACxB,MAAM,EAAE,cAAc;IACtB,OAAO,EAAE,eAAe;CACzB,CAAC;AAEF,SAAS,QAAQ,CAAC,IAAgB,EAAE,GAAW;IAC7C,MAAM,UAAU,GAAG,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IACjD,MAAM,UAAU,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;IAE/F,OAAO,CAAC,GAAG,UAAU,EAAE,GAAG,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;QAClE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;QAC9B,OAAO;QACP,GAAG,EAAE,GAAG;KACT,CAAC,CAAC,CAAC;AACN,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** The arguments of a call that is the whole expression: `a, b` of `and(a, b)`, and `undefined` of `and(a).b`. */
2
+ export declare function argumentsOfCall(bare: string, callee: RegExp): string | undefined;
3
+ //# sourceMappingURL=arguments-of-call.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arguments-of-call.d.ts","sourceRoot":"","sources":["../../../src/check/tenancy/arguments-of-call.ts"],"names":[],"mappings":"AAEA,kHAAkH;AAClH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAUhF"}
@@ -0,0 +1,11 @@
1
+ import { endOfEnclosing } from './end-of-enclosing.js';
2
+ /** The arguments of a call that is the whole expression: `a, b` of `and(a, b)`, and `undefined` of `and(a).b`. */
3
+ export function argumentsOfCall(bare, callee) {
4
+ const call = callee.exec(bare);
5
+ if (call?.index !== 0) {
6
+ return undefined;
7
+ }
8
+ const open = call[0].length;
9
+ return endOfEnclosing(bare, open) === bare.length - 1 ? bare.slice(open, -1) : undefined;
10
+ }
11
+ //# sourceMappingURL=arguments-of-call.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arguments-of-call.js","sourceRoot":"","sources":["../../../src/check/tenancy/arguments-of-call.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,kHAAkH;AAClH,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,MAAc;IAC1D,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE/B,IAAI,IAAI,EAAE,KAAK,KAAK,CAAC,EAAE,CAAC;QACtB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IAE5B,OAAO,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC3F,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** An expression trimmed, without the type stated after it and the parentheses around all of it. */
2
+ export declare function bareExpression(text: string): string;
3
+ //# sourceMappingURL=bare-expression.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bare-expression.d.ts","sourceRoot":"","sources":["../../../src/check/tenancy/bare-expression.ts"],"names":[],"mappings":"AAKA,oGAAoG;AACpG,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAInD"}
@@ -0,0 +1,9 @@
1
+ import { endOfEnclosing } from './end-of-enclosing.js';
2
+ /** A type stated after an expression, which says nothing of what it holds: `{ id } satisfies Filter`, `row as Row`. */
3
+ const STATED_TYPE = /\s+(?:as|satisfies)\s+[\w$.<>[\]\s|]+$/;
4
+ /** An expression trimmed, without the type stated after it and the parentheses around all of it. */
5
+ export function bareExpression(text) {
6
+ const bare = text.trim().replace(STATED_TYPE, '');
7
+ return bare.startsWith('(') && endOfEnclosing(bare, 1) === bare.length - 1 ? bareExpression(bare.slice(1, -1)) : bare;
8
+ }
9
+ //# sourceMappingURL=bare-expression.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bare-expression.js","sourceRoot":"","sources":["../../../src/check/tenancy/bare-expression.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,uHAAuH;AACvH,MAAM,WAAW,GAAG,wCAAwC,CAAC;AAE7D,oGAAoG;AACpG,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IAElD,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,cAAc,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACxH,CAAC"}
@@ -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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@
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,MAAM,iBAAiB,CAAC;AAEhD,4HAA4H;AAC5H,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,MAAM,QAAQ,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAEpC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAE5C,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,CAAC,EAAE,KAAK,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC;AAED,kFAAkF;AAClF,SAAS,YAAY,CAAC,IAAY;IAChC,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACpD,KAAK,IAAI,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC;QAEhD,IAAI,KAAK,KAAK,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC;YAC9C,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;gBACrE,OAAO,KAAK,CAAC;YACf,CAAC;YAED,KAAK,IAAI,CAAC,CAAC;QACb,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,qFAAqF;AACrF,SAAS,aAAa,CAAC,IAAY,EAAE,QAAgB;IACnD,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,IAAI,GAAG,CAAC,CAAC;IAEb,KAAK,IAAI,KAAK,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","s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AAC,CAAC,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC,UAAU,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC;IAEnE,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,SAAS,CAAC;IACnB,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"}