@ddd-ts-kit/kernel 0.7.0 → 0.9.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 (367) hide show
  1. package/README.md +111 -9
  2. package/dist/application/audit/tenant-scope-of.d.ts +4 -1
  3. package/dist/application/audit/tenant-scope-of.d.ts.map +1 -1
  4. package/dist/application/audit/tenant-scope-of.js +6 -2
  5. package/dist/application/audit/tenant-scope-of.js.map +1 -1
  6. package/dist/application/cache/tenant-cache-key.d.ts +5 -0
  7. package/dist/application/cache/tenant-cache-key.d.ts.map +1 -0
  8. package/dist/application/cache/tenant-cache-key.js +7 -0
  9. package/dist/application/cache/tenant-cache-key.js.map +1 -0
  10. package/dist/application/events/execution-context-of-event.d.ts +2 -1
  11. package/dist/application/events/execution-context-of-event.d.ts.map +1 -1
  12. package/dist/application/events/execution-context-of-event.js +3 -1
  13. package/dist/application/events/execution-context-of-event.js.map +1 -1
  14. package/dist/application/events/integration-event.d.ts +6 -0
  15. package/dist/application/events/integration-event.d.ts.map +1 -1
  16. package/dist/application/events/scoped-publisher.d.ts +4 -3
  17. package/dist/application/events/scoped-publisher.d.ts.map +1 -1
  18. package/dist/application/events/scoped-publisher.js +11 -5
  19. package/dist/application/events/scoped-publisher.js.map +1 -1
  20. package/dist/application/execution/execution-context.d.ts +7 -1
  21. package/dist/application/execution/execution-context.d.ts.map +1 -1
  22. package/dist/application/execution/execution-context.js +7 -2
  23. package/dist/application/execution/execution-context.js.map +1 -1
  24. package/dist/application/execution/log-fields-of.d.ts.map +1 -1
  25. package/dist/application/execution/log-fields-of.js +1 -0
  26. package/dist/application/execution/log-fields-of.js.map +1 -1
  27. package/dist/application/files/accepts-media-type.d.ts +3 -0
  28. package/dist/application/files/accepts-media-type.d.ts.map +1 -0
  29. package/dist/application/files/accepts-media-type.js +11 -0
  30. package/dist/application/files/accepts-media-type.js.map +1 -0
  31. package/dist/application/files/assert-expiry.d.ts +3 -0
  32. package/dist/application/files/assert-expiry.d.ts.map +1 -0
  33. package/dist/application/files/assert-expiry.js +10 -0
  34. package/dist/application/files/assert-expiry.js.map +1 -0
  35. package/dist/application/files/assert-file-key.d.ts +3 -0
  36. package/dist/application/files/assert-file-key.d.ts.map +1 -0
  37. package/dist/application/files/assert-file-key.js +10 -0
  38. package/dist/application/files/assert-file-key.js.map +1 -0
  39. package/dist/application/files/assert-final-key.d.ts +3 -0
  40. package/dist/application/files/assert-final-key.d.ts.map +1 -0
  41. package/dist/application/files/assert-final-key.js +11 -0
  42. package/dist/application/files/assert-final-key.js.map +1 -0
  43. package/dist/application/files/content-disposition.d.ts +3 -0
  44. package/dist/application/files/content-disposition.d.ts.map +1 -0
  45. package/dist/application/files/content-disposition.js +9 -0
  46. package/dist/application/files/content-disposition.js.map +1 -0
  47. package/dist/application/files/content-expectation.d.ts +6 -0
  48. package/dist/application/files/content-expectation.d.ts.map +1 -0
  49. package/dist/application/files/content-expectation.js +2 -0
  50. package/dist/application/files/content-expectation.js.map +1 -0
  51. package/dist/application/files/content-matches.d.ts +7 -0
  52. package/dist/application/files/content-matches.d.ts.map +1 -0
  53. package/dist/application/files/content-matches.js +39 -0
  54. package/dist/application/files/content-matches.js.map +1 -0
  55. package/dist/application/files/download-url-options.d.ts +7 -0
  56. package/dist/application/files/download-url-options.d.ts.map +1 -0
  57. package/dist/application/files/download-url-options.js +2 -0
  58. package/dist/application/files/download-url-options.js.map +1 -0
  59. package/dist/application/files/file-content.d.ts +8 -0
  60. package/dist/application/files/file-content.d.ts.map +1 -0
  61. package/dist/application/files/file-content.js +2 -0
  62. package/dist/application/files/file-content.js.map +1 -0
  63. package/dist/application/files/file-error.d.ts +28 -0
  64. package/dist/application/files/file-error.d.ts.map +1 -0
  65. package/dist/application/files/file-error.js +29 -0
  66. package/dist/application/files/file-error.js.map +1 -0
  67. package/dist/application/files/file-metadata.d.ts +10 -0
  68. package/dist/application/files/file-metadata.d.ts.map +1 -0
  69. package/dist/application/files/file-metadata.js +2 -0
  70. package/dist/application/files/file-metadata.js.map +1 -0
  71. package/dist/application/files/file-source.d.ts +4 -0
  72. package/dist/application/files/file-source.d.ts.map +1 -0
  73. package/dist/application/files/file-source.js +2 -0
  74. package/dist/application/files/file-source.js.map +1 -0
  75. package/dist/application/files/file-upload.d.ts +25 -0
  76. package/dist/application/files/file-upload.d.ts.map +1 -0
  77. package/dist/application/files/file-upload.js +36 -0
  78. package/dist/application/files/file-upload.js.map +1 -0
  79. package/dist/application/files/index.d.ts +31 -0
  80. package/dist/application/files/index.d.ts.map +1 -0
  81. package/dist/application/files/index.js +31 -0
  82. package/dist/application/files/index.js.map +1 -0
  83. package/dist/application/files/inspection-limits.d.ts +8 -0
  84. package/dist/application/files/inspection-limits.d.ts.map +1 -0
  85. package/dist/application/files/inspection-limits.js +2 -0
  86. package/dist/application/files/inspection-limits.js.map +1 -0
  87. package/dist/application/files/is-file-key.d.ts +7 -0
  88. package/dist/application/files/is-file-key.d.ts.map +1 -0
  89. package/dist/application/files/is-file-key.js +11 -0
  90. package/dist/application/files/is-file-key.js.map +1 -0
  91. package/dist/application/files/listed-file.d.ts +7 -0
  92. package/dist/application/files/listed-file.d.ts.map +1 -0
  93. package/dist/application/files/listed-file.js +2 -0
  94. package/dist/application/files/listed-file.js.map +1 -0
  95. package/dist/application/files/max-signed-url-seconds.d.ts +3 -0
  96. package/dist/application/files/max-signed-url-seconds.d.ts.map +1 -0
  97. package/dist/application/files/max-signed-url-seconds.js +3 -0
  98. package/dist/application/files/max-signed-url-seconds.js.map +1 -0
  99. package/dist/application/files/media-type-of.d.ts +3 -0
  100. package/dist/application/files/media-type-of.d.ts.map +1 -0
  101. package/dist/application/files/media-type-of.js +5 -0
  102. package/dist/application/files/media-type-of.js.map +1 -0
  103. package/dist/application/files/pending-upload-link.d.ts +10 -0
  104. package/dist/application/files/pending-upload-link.d.ts.map +1 -0
  105. package/dist/application/files/pending-upload-link.js +2 -0
  106. package/dist/application/files/pending-upload-link.js.map +1 -0
  107. package/dist/application/files/pending-upload.d.ts +15 -0
  108. package/dist/application/files/pending-upload.d.ts.map +1 -0
  109. package/dist/application/files/pending-upload.js +2 -0
  110. package/dist/application/files/pending-upload.js.map +1 -0
  111. package/dist/application/files/put-options.d.ts +7 -0
  112. package/dist/application/files/put-options.d.ts.map +1 -0
  113. package/dist/application/files/put-options.js +2 -0
  114. package/dist/application/files/put-options.js.map +1 -0
  115. package/dist/application/files/received-file.d.ts +15 -0
  116. package/dist/application/files/received-file.d.ts.map +1 -0
  117. package/dist/application/files/received-file.js +2 -0
  118. package/dist/application/files/received-file.js.map +1 -0
  119. package/dist/application/files/scan-verdict.d.ts +8 -0
  120. package/dist/application/files/scan-verdict.d.ts.map +1 -0
  121. package/dist/application/files/scan-verdict.js +2 -0
  122. package/dist/application/files/scan-verdict.js.map +1 -0
  123. package/dist/application/files/signature-of.d.ts +3 -0
  124. package/dist/application/files/signature-of.d.ts.map +1 -0
  125. package/dist/application/files/signature-of.js +28 -0
  126. package/dist/application/files/signature-of.js.map +1 -0
  127. package/dist/application/files/signed-download.d.ts +6 -0
  128. package/dist/application/files/signed-download.d.ts.map +1 -0
  129. package/dist/application/files/signed-download.js +2 -0
  130. package/dist/application/files/signed-download.js.map +1 -0
  131. package/dist/application/files/signed-upload.d.ts +9 -0
  132. package/dist/application/files/signed-upload.d.ts.map +1 -0
  133. package/dist/application/files/signed-upload.js +2 -0
  134. package/dist/application/files/signed-upload.js.map +1 -0
  135. package/dist/application/files/signed-url.d.ts +6 -0
  136. package/dist/application/files/signed-url.d.ts.map +1 -0
  137. package/dist/application/files/signed-url.js +2 -0
  138. package/dist/application/files/signed-url.js.map +1 -0
  139. package/dist/application/files/staged-key-of.d.ts +5 -0
  140. package/dist/application/files/staged-key-of.d.ts.map +1 -0
  141. package/dist/application/files/staged-key-of.js +7 -0
  142. package/dist/application/files/staged-key-of.js.map +1 -0
  143. package/dist/application/files/stored-file.d.ts +16 -0
  144. package/dist/application/files/stored-file.d.ts.map +1 -0
  145. package/dist/application/files/stored-file.js +2 -0
  146. package/dist/application/files/stored-file.js.map +1 -0
  147. package/dist/application/files/upload-url-options.d.ts +12 -0
  148. package/dist/application/files/upload-url-options.d.ts.map +1 -0
  149. package/dist/application/files/upload-url-options.js +2 -0
  150. package/dist/application/files/upload-url-options.js.map +1 -0
  151. package/dist/application/ports/file-keys.d.ts +9 -0
  152. package/dist/application/ports/file-keys.d.ts.map +1 -0
  153. package/dist/application/ports/file-keys.js +10 -0
  154. package/dist/application/ports/file-keys.js.map +1 -0
  155. package/dist/application/ports/file-scanner.d.ts +13 -0
  156. package/dist/application/ports/file-scanner.d.ts.map +1 -0
  157. package/dist/application/ports/file-scanner.js +12 -0
  158. package/dist/application/ports/file-scanner.js.map +1 -0
  159. package/dist/application/ports/file-storage.d.ts +40 -0
  160. package/dist/application/ports/file-storage.d.ts.map +1 -0
  161. package/dist/application/ports/file-storage.js +15 -0
  162. package/dist/application/ports/file-storage.js.map +1 -0
  163. package/dist/application/ports/served-file-storage.d.ts +16 -0
  164. package/dist/application/ports/served-file-storage.d.ts.map +1 -0
  165. package/dist/application/ports/served-file-storage.js +12 -0
  166. package/dist/application/ports/served-file-storage.js.map +1 -0
  167. package/dist/application/ports/tenant-directory.d.ts +8 -0
  168. package/dist/application/ports/tenant-directory.d.ts.map +1 -0
  169. package/dist/application/ports/tenant-directory.js +10 -0
  170. package/dist/application/ports/tenant-directory.js.map +1 -0
  171. package/dist/application/scheduling/execution-context-of-job.d.ts +3 -1
  172. package/dist/application/scheduling/execution-context-of-job.d.ts.map +1 -1
  173. package/dist/application/scheduling/execution-context-of-job.js +1 -1
  174. package/dist/application/scheduling/execution-context-of-job.js.map +1 -1
  175. package/dist/application/scheduling/job-execution.d.ts +2 -0
  176. package/dist/application/scheduling/job-execution.d.ts.map +1 -1
  177. package/dist/application/scheduling/job-options.d.ts +6 -0
  178. package/dist/application/scheduling/job-options.d.ts.map +1 -1
  179. package/dist/application/scheduling/job-policy.d.ts.map +1 -1
  180. package/dist/application/scheduling/job-policy.js +4 -2
  181. package/dist/application/scheduling/job-policy.js.map +1 -1
  182. package/dist/application/session/has-scope.d.ts +5 -0
  183. package/dist/application/session/has-scope.d.ts.map +1 -0
  184. package/dist/application/session/has-scope.js +5 -0
  185. package/dist/application/session/has-scope.js.map +1 -0
  186. package/dist/application/session/session-scope.d.ts +4 -0
  187. package/dist/application/session/session-scope.d.ts.map +1 -0
  188. package/dist/application/session/session-scope.js +2 -0
  189. package/dist/application/session/session-scope.js.map +1 -0
  190. package/dist/application/session/session-scopes.d.ts +11 -0
  191. package/dist/application/session/session-scopes.d.ts.map +1 -0
  192. package/dist/application/session/session-scopes.js +2 -0
  193. package/dist/application/session/session-scopes.js.map +1 -0
  194. package/dist/application/session/session.d.ts +6 -0
  195. package/dist/application/session/session.d.ts.map +1 -1
  196. package/dist/application/tenancy/across-tenants.d.ts +12 -0
  197. package/dist/application/tenancy/across-tenants.d.ts.map +1 -0
  198. package/dist/application/tenancy/across-tenants.js +47 -0
  199. package/dist/application/tenancy/across-tenants.js.map +1 -0
  200. package/dist/application/tenancy/assert-tenant-id.d.ts +3 -0
  201. package/dist/application/tenancy/assert-tenant-id.d.ts.map +1 -0
  202. package/dist/application/tenancy/assert-tenant-id.js +10 -0
  203. package/dist/application/tenancy/assert-tenant-id.js.map +1 -0
  204. package/dist/application/tenancy/elevation-options.d.ts +12 -0
  205. package/dist/application/tenancy/elevation-options.d.ts.map +1 -0
  206. package/dist/application/tenancy/elevation-options.js +2 -0
  207. package/dist/application/tenancy/elevation-options.js.map +1 -0
  208. package/dist/application/tenancy/invalid-tenant-elevation-error.d.ts +5 -0
  209. package/dist/application/tenancy/invalid-tenant-elevation-error.d.ts.map +1 -0
  210. package/dist/application/tenancy/invalid-tenant-elevation-error.js +8 -0
  211. package/dist/application/tenancy/invalid-tenant-elevation-error.js.map +1 -0
  212. package/dist/application/tenancy/invalid-tenant-id-error.d.ts +6 -0
  213. package/dist/application/tenancy/invalid-tenant-id-error.d.ts.map +1 -0
  214. package/dist/application/tenancy/invalid-tenant-id-error.js +10 -0
  215. package/dist/application/tenancy/invalid-tenant-id-error.js.map +1 -0
  216. package/dist/application/tenancy/is-tenant-id.d.ts +3 -0
  217. package/dist/application/tenancy/is-tenant-id.d.ts.map +1 -0
  218. package/dist/application/tenancy/is-tenant-id.js +12 -0
  219. package/dist/application/tenancy/is-tenant-id.js.map +1 -0
  220. package/dist/application/tenancy/is-tenant-member.d.ts +4 -0
  221. package/dist/application/tenancy/is-tenant-member.d.ts.map +1 -0
  222. package/dist/application/tenancy/is-tenant-member.js +6 -0
  223. package/dist/application/tenancy/is-tenant-member.js.map +1 -0
  224. package/dist/application/tenancy/tenant-elevation.d.ts +11 -0
  225. package/dist/application/tenancy/tenant-elevation.d.ts.map +1 -0
  226. package/dist/application/tenancy/tenant-elevation.js +2 -0
  227. package/dist/application/tenancy/tenant-elevation.js.map +1 -0
  228. package/dist/application/tenancy/tenant-key.d.ts +9 -0
  229. package/dist/application/tenancy/tenant-key.d.ts.map +1 -0
  230. package/dist/application/tenancy/tenant-key.js +11 -0
  231. package/dist/application/tenancy/tenant-key.js.map +1 -0
  232. package/dist/application/tenancy/tenant-reach-of.d.ts +9 -0
  233. package/dist/application/tenancy/tenant-reach-of.d.ts.map +1 -0
  234. package/dist/application/tenancy/tenant-reach-of.js +18 -0
  235. package/dist/application/tenancy/tenant-reach-of.js.map +1 -0
  236. package/dist/application/tenancy/tenant-reach.d.ts +12 -0
  237. package/dist/application/tenancy/tenant-reach.d.ts.map +1 -0
  238. package/dist/application/tenancy/tenant-reach.js +2 -0
  239. package/dist/application/tenancy/tenant-reach.js.map +1 -0
  240. package/dist/application/tenancy/tenants-of.d.ts +8 -0
  241. package/dist/application/tenancy/tenants-of.d.ts.map +1 -0
  242. package/dist/application/tenancy/tenants-of.js +14 -0
  243. package/dist/application/tenancy/tenants-of.js.map +1 -0
  244. package/dist/index.d.ts +42 -0
  245. package/dist/index.d.ts.map +1 -1
  246. package/dist/index.js +42 -0
  247. package/dist/index.js.map +1 -1
  248. package/dist/infrastructure/domain-events/after-commit.d.ts +10 -0
  249. package/dist/infrastructure/domain-events/after-commit.d.ts.map +1 -0
  250. package/dist/infrastructure/domain-events/after-commit.js +19 -0
  251. package/dist/infrastructure/domain-events/after-commit.js.map +1 -0
  252. package/dist/infrastructure/domain-events/at-commit.d.ts +11 -0
  253. package/dist/infrastructure/domain-events/at-commit.d.ts.map +1 -0
  254. package/dist/infrastructure/domain-events/at-commit.js +19 -0
  255. package/dist/infrastructure/domain-events/at-commit.js.map +1 -0
  256. package/dist/infrastructure/domain-events/commit-step.d.ts +10 -0
  257. package/dist/infrastructure/domain-events/commit-step.d.ts.map +1 -0
  258. package/dist/infrastructure/domain-events/commit-step.js +2 -0
  259. package/dist/infrastructure/domain-events/commit-step.js.map +1 -0
  260. package/dist/infrastructure/domain-events/unit-of-work-scope.d.ts +5 -0
  261. package/dist/infrastructure/domain-events/unit-of-work-scope.d.ts.map +1 -1
  262. package/dist/infrastructure/domain-events/unit-of-work-scope.js.map +1 -1
  263. package/dist/infrastructure/domain-events/within-unit-of-work.d.ts +3 -1
  264. package/dist/infrastructure/domain-events/within-unit-of-work.d.ts.map +1 -1
  265. package/dist/infrastructure/domain-events/within-unit-of-work.js +32 -5
  266. package/dist/infrastructure/domain-events/within-unit-of-work.js.map +1 -1
  267. package/dist/infrastructure/files/accept-every-file-scanner.d.ts +7 -0
  268. package/dist/infrastructure/files/accept-every-file-scanner.d.ts.map +1 -0
  269. package/dist/infrastructure/files/accept-every-file-scanner.js +7 -0
  270. package/dist/infrastructure/files/accept-every-file-scanner.js.map +1 -0
  271. package/dist/infrastructure/files/collect.d.ts +4 -0
  272. package/dist/infrastructure/files/collect.d.ts.map +1 -0
  273. package/dist/infrastructure/files/collect.js +11 -0
  274. package/dist/infrastructure/files/collect.js.map +1 -0
  275. package/dist/infrastructure/files/file-grant.d.ts +11 -0
  276. package/dist/infrastructure/files/file-grant.d.ts.map +1 -0
  277. package/dist/infrastructure/files/file-grant.js +2 -0
  278. package/dist/infrastructure/files/file-grant.js.map +1 -0
  279. package/dist/infrastructure/files/file-inspection.d.ts +22 -0
  280. package/dist/infrastructure/files/file-inspection.d.ts.map +1 -0
  281. package/dist/infrastructure/files/file-inspection.js +66 -0
  282. package/dist/infrastructure/files/file-inspection.js.map +1 -0
  283. package/dist/infrastructure/files/file-staging.d.ts +59 -0
  284. package/dist/infrastructure/files/file-staging.d.ts.map +1 -0
  285. package/dist/infrastructure/files/file-staging.js +142 -0
  286. package/dist/infrastructure/files/file-staging.js.map +1 -0
  287. package/dist/infrastructure/files/file-uploads-middleware.d.ts +11 -0
  288. package/dist/infrastructure/files/file-uploads-middleware.d.ts.map +1 -0
  289. package/dist/infrastructure/files/file-uploads-middleware.js +25 -0
  290. package/dist/infrastructure/files/file-uploads-middleware.js.map +1 -0
  291. package/dist/infrastructure/files/in-memory-file-storage.d.ts +25 -0
  292. package/dist/infrastructure/files/in-memory-file-storage.d.ts.map +1 -0
  293. package/dist/infrastructure/files/in-memory-file-storage.js +73 -0
  294. package/dist/infrastructure/files/in-memory-file-storage.js.map +1 -0
  295. package/dist/infrastructure/files/is-file-grant.d.ts +3 -0
  296. package/dist/infrastructure/files/is-file-grant.d.ts.map +1 -0
  297. package/dist/infrastructure/files/is-file-grant.js +16 -0
  298. package/dist/infrastructure/files/is-file-grant.js.map +1 -0
  299. package/dist/infrastructure/files/is-stored-metadata.d.ts +3 -0
  300. package/dist/infrastructure/files/is-stored-metadata.d.ts.map +1 -0
  301. package/dist/infrastructure/files/is-stored-metadata.js +8 -0
  302. package/dist/infrastructure/files/is-stored-metadata.js.map +1 -0
  303. package/dist/infrastructure/files/local-file-storage-options.d.ts +6 -0
  304. package/dist/infrastructure/files/local-file-storage-options.d.ts.map +1 -0
  305. package/dist/infrastructure/files/local-file-storage-options.js +2 -0
  306. package/dist/infrastructure/files/local-file-storage-options.js.map +1 -0
  307. package/dist/infrastructure/files/local-file-storage.d.ts +29 -0
  308. package/dist/infrastructure/files/local-file-storage.d.ts.map +1 -0
  309. package/dist/infrastructure/files/local-file-storage.js +103 -0
  310. package/dist/infrastructure/files/local-file-storage.js.map +1 -0
  311. package/dist/infrastructure/files/local-paths.d.ts +12 -0
  312. package/dist/infrastructure/files/local-paths.d.ts.map +1 -0
  313. package/dist/infrastructure/files/local-paths.js +33 -0
  314. package/dist/infrastructure/files/local-paths.js.map +1 -0
  315. package/dist/infrastructure/files/purge-staged-files.d.ts +16 -0
  316. package/dist/infrastructure/files/purge-staged-files.d.ts.map +1 -0
  317. package/dist/infrastructure/files/purge-staged-files.js +21 -0
  318. package/dist/infrastructure/files/purge-staged-files.js.map +1 -0
  319. package/dist/infrastructure/files/self-signed-file-storage.d.ts +23 -0
  320. package/dist/infrastructure/files/self-signed-file-storage.d.ts.map +1 -0
  321. package/dist/infrastructure/files/self-signed-file-storage.js +57 -0
  322. package/dist/infrastructure/files/self-signed-file-storage.js.map +1 -0
  323. package/dist/infrastructure/files/signed-file-tokens.d.ts +20 -0
  324. package/dist/infrastructure/files/signed-file-tokens.d.ts.map +1 -0
  325. package/dist/infrastructure/files/signed-file-tokens.js +45 -0
  326. package/dist/infrastructure/files/signed-file-tokens.js.map +1 -0
  327. package/dist/infrastructure/files/signed-link-options.d.ts +10 -0
  328. package/dist/infrastructure/files/signed-link-options.d.ts.map +1 -0
  329. package/dist/infrastructure/files/signed-link-options.js +2 -0
  330. package/dist/infrastructure/files/signed-link-options.js.map +1 -0
  331. package/dist/infrastructure/files/stored-metadata.d.ts +6 -0
  332. package/dist/infrastructure/files/stored-metadata.d.ts.map +1 -0
  333. package/dist/infrastructure/files/stored-metadata.js +2 -0
  334. package/dist/infrastructure/files/stored-metadata.js.map +1 -0
  335. package/dist/infrastructure/files/tenant-file-keys.d.ts +20 -0
  336. package/dist/infrastructure/files/tenant-file-keys.d.ts.map +1 -0
  337. package/dist/infrastructure/files/tenant-file-keys.js +27 -0
  338. package/dist/infrastructure/files/tenant-file-keys.js.map +1 -0
  339. package/dist/infrastructure/files/upload-desk.d.ts +8 -0
  340. package/dist/infrastructure/files/upload-desk.d.ts.map +1 -0
  341. package/dist/infrastructure/files/upload-desk.js +2 -0
  342. package/dist/infrastructure/files/upload-desk.js.map +1 -0
  343. package/dist/infrastructure/files/without-trailing-slashes.d.ts +3 -0
  344. package/dist/infrastructure/files/without-trailing-slashes.d.ts.map +1 -0
  345. package/dist/infrastructure/files/without-trailing-slashes.js +9 -0
  346. package/dist/infrastructure/files/without-trailing-slashes.js.map +1 -0
  347. package/dist/infrastructure/in-memory/in-memory-tenant-directory.d.ts +8 -0
  348. package/dist/infrastructure/in-memory/in-memory-tenant-directory.d.ts.map +1 -0
  349. package/dist/infrastructure/in-memory/in-memory-tenant-directory.js +12 -0
  350. package/dist/infrastructure/in-memory/in-memory-tenant-directory.js.map +1 -0
  351. package/dist/infrastructure/tenancy/tenant-isolation-policies.d.ts +13 -0
  352. package/dist/infrastructure/tenancy/tenant-isolation-policies.d.ts.map +1 -0
  353. package/dist/infrastructure/tenancy/tenant-isolation-policies.js +13 -0
  354. package/dist/infrastructure/tenancy/tenant-isolation-policies.js.map +1 -0
  355. package/dist/infrastructure/tenancy/tenant-policy-expressions.d.ts +11 -0
  356. package/dist/infrastructure/tenancy/tenant-policy-expressions.d.ts.map +1 -0
  357. package/dist/infrastructure/tenancy/tenant-policy-expressions.js +15 -0
  358. package/dist/infrastructure/tenancy/tenant-policy-expressions.js.map +1 -0
  359. package/dist/infrastructure/tenancy/tenant-setting-values.d.ts +13 -0
  360. package/dist/infrastructure/tenancy/tenant-setting-values.d.ts.map +1 -0
  361. package/dist/infrastructure/tenancy/tenant-setting-values.js +19 -0
  362. package/dist/infrastructure/tenancy/tenant-setting-values.js.map +1 -0
  363. package/dist/infrastructure/tenancy/tenant-settings.d.ts +13 -0
  364. package/dist/infrastructure/tenancy/tenant-settings.d.ts.map +1 -0
  365. package/dist/infrastructure/tenancy/tenant-settings.js +13 -0
  366. package/dist/infrastructure/tenancy/tenant-settings.js.map +1 -0
  367. package/package.json +1 -1
@@ -0,0 +1,28 @@
1
+ /** The leading bytes of the binary formats the kit recognises, written as latin1 strings. */
2
+ const SIGNATURES = [
3
+ { mediaType: 'application/pdf', parts: [[0, '%PDF-']] },
4
+ { mediaType: 'image/png', parts: [[0, '\x89PNG\r\n\x1a\n']] },
5
+ { mediaType: 'image/jpeg', parts: [[0, '\xff\xd8\xff']] },
6
+ { mediaType: 'image/gif', parts: [[0, 'GIF8']] },
7
+ {
8
+ mediaType: 'image/webp',
9
+ parts: [
10
+ [0, 'RIFF'],
11
+ [8, 'WEBP'],
12
+ ],
13
+ },
14
+ { mediaType: 'application/zip', parts: [[0, 'PK\x03\x04']] },
15
+ { mediaType: 'application/gzip', parts: [[0, '\x1f\x8b']] },
16
+ ];
17
+ /** The binary format the first bytes of a content announce, or `undefined` when none is recognised. */
18
+ export function signatureOf(head) {
19
+ return SIGNATURES.find((signature) => signature.parts.every(([offset, bytes]) => startsWith(head, offset, bytes)))
20
+ ?.mediaType;
21
+ }
22
+ function startsWith(head, offset, bytes) {
23
+ if (head.length < offset + bytes.length) {
24
+ return false;
25
+ }
26
+ return Array.from({ length: bytes.length }, (_, index) => index).every((index) => head[offset + index] === bytes.charCodeAt(index));
27
+ }
28
+ //# sourceMappingURL=signature-of.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signature-of.js","sourceRoot":"","sources":["../../../src/application/files/signature-of.ts"],"names":[],"mappings":"AAMA,6FAA6F;AAC7F,MAAM,UAAU,GAAyB;IACvC,EAAE,SAAS,EAAE,iBAAiB,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE;IACvD,EAAE,SAAS,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,mBAAmB,CAAC,CAAC,EAAE;IAC7D,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,cAAc,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@@
1
+ import type { FileContent } from './file-content.js';
2
+ /** A download a signed link granted: the file, and the name to offer the browser when one was signed. */
3
+ export interface SignedDownload extends FileContent {
4
+ readonly fileName?: string;
5
+ }
6
+ //# sourceMappingURL=signed-download.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signed-download.d.ts","sourceRoot":"","sources":["../../../src/application/files/signed-download.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,yGAAyG;AACzG,MAAM,WAAW,cAAe,SAAQ,WAAW;IACjD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=signed-download.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signed-download.js","sourceRoot":"","sources":["../../../src/application/files/signed-download.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ /** What a client needs to send a file straight to the storage: the request to make, and until when. */
2
+ export interface SignedUpload {
3
+ readonly url: string;
4
+ readonly method: 'PUT';
5
+ /** To send as they are: the signature covers them. */
6
+ readonly headers: Readonly<Record<string, string>>;
7
+ readonly expiresAt: Date;
8
+ }
9
+ //# sourceMappingURL=signed-upload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signed-upload.d.ts","sourceRoot":"","sources":["../../../src/application/files/signed-upload.ts"],"names":[],"mappings":"AAAA,uGAAuG;AACvG,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC;IACvB,sDAAsD;IACtD,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACnD,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;CAC1B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=signed-upload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signed-upload.js","sourceRoot":"","sources":["../../../src/application/files/signed-upload.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ /** A link that grants one action on one file until it expires, without any other credential. */
2
+ export interface SignedUrl {
3
+ readonly url: string;
4
+ readonly expiresAt: Date;
5
+ }
6
+ //# sourceMappingURL=signed-url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signed-url.d.ts","sourceRoot":"","sources":["../../../src/application/files/signed-url.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;CAC1B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=signed-url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signed-url.js","sourceRoot":"","sources":["../../../src/application/files/signed-url.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ /** Where a file waits until the transaction that references it commits: nothing reads there, and no final key starts with it. */
2
+ export declare const STAGING_PREFIX = "staging/";
3
+ /** The staged key of a final key. */
4
+ export declare function stagedKeyOf(key: string): string;
5
+ //# sourceMappingURL=staged-key-of.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"staged-key-of.d.ts","sourceRoot":"","sources":["../../../src/application/files/staged-key-of.ts"],"names":[],"mappings":"AAAA,iIAAiI;AACjI,eAAO,MAAM,cAAc,aAAa,CAAC;AAEzC,qCAAqC;AACrC,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/C"}
@@ -0,0 +1,7 @@
1
+ /** Where a file waits until the transaction that references it commits: nothing reads there, and no final key starts with it. */
2
+ export const STAGING_PREFIX = 'staging/';
3
+ /** The staged key of a final key. */
4
+ export function stagedKeyOf(key) {
5
+ return `${STAGING_PREFIX}${key}`;
6
+ }
7
+ //# sourceMappingURL=staged-key-of.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"staged-key-of.js","sourceRoot":"","sources":["../../../src/application/files/staged-key-of.ts"],"names":[],"mappings":"AAAA,iIAAiI;AACjI,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;AAEzC,qCAAqC;AACrC,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,OAAO,GAAG,cAAc,GAAG,GAAG,EAAE,CAAC;AACnC,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The reference to a file that an aggregate keeps, and all it keeps: the content lives in a
3
+ * `FileStorage`, never in the database. It names no provider, no bucket and no URL, so the
4
+ * connector can change without touching a row.
5
+ */
6
+ export interface StoredFile {
7
+ /** Generated by the server (`FileKeys`), never taken from the user. */
8
+ readonly key: string;
9
+ /** In bytes. */
10
+ readonly size: number;
11
+ /** Verified on the content, not only on the name the client gave. */
12
+ readonly mediaType: string;
13
+ /** `sha256:<hex>` of the content, computed while it streamed. */
14
+ readonly checksum: string;
15
+ }
16
+ //# sourceMappingURL=stored-file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stored-file.d.ts","sourceRoot":"","sources":["../../../src/application/files/stored-file.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,uEAAuE;IACvE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,gBAAgB;IAChB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,qEAAqE;IACrE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,iEAAiE;IACjE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=stored-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stored-file.js","sourceRoot":"","sources":["../../../src/application/files/stored-file.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ export interface UploadUrlOptions {
2
+ /** Short: at most `MAX_SIGNED_URL_SECONDS`. */
3
+ readonly expiresInSeconds: number;
4
+ /** The media type the client must send, as the `content-type` the signature covers. */
5
+ readonly mediaType: string;
6
+ /**
7
+ * In bytes. The storages the application serves refuse a larger upload; a presigned link of
8
+ * an object store cannot cap it, so `FileStaging.confirm` checks it again in every case.
9
+ */
10
+ readonly maxBytes: number;
11
+ }
12
+ //# sourceMappingURL=upload-url-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload-url-options.d.ts","sourceRoot":"","sources":["../../../src/application/files/upload-url-options.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,+CAA+C;IAC/C,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,uFAAuF;IACvF,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=upload-url-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload-url-options.js","sourceRoot":"","sources":["../../../src/application/files/upload-url-options.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Names the files: a key is always generated on the server, never built from what a user sent
3
+ * (a file name, a path), so a request can neither choose where it writes nor guess another key.
4
+ */
5
+ export declare abstract class FileKeys {
6
+ /** A new key under `area`, a key prefix of the project such as `appointment-documents`. */
7
+ abstract next(area: string): string;
8
+ }
9
+ //# sourceMappingURL=file-keys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-keys.d.ts","sourceRoot":"","sources":["../../../src/application/ports/file-keys.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,8BAAsB,QAAQ;IAK5B,2FAA2F;IAC3F,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CACrC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Names the files: a key is always generated on the server, never built from what a user sent
3
+ * (a file name, a path), so a request can neither choose where it writes nor guess another key.
4
+ */
5
+ export class FileKeys {
6
+ static {
7
+ Object.defineProperty(this, 'tokenKey', { value: 'kernel.FileKeys' });
8
+ }
9
+ }
10
+ //# sourceMappingURL=file-keys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-keys.js","sourceRoot":"","sources":["../../../src/application/ports/file-keys.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,OAAgB,QAAQ;IAC5B;QACE,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC,CAAC;IACxE,CAAC;CAIF"}
@@ -0,0 +1,13 @@
1
+ import type { Readable } from 'node:stream';
2
+ import type { ScanVerdict } from '../files/scan-verdict.js';
3
+ import type { StoredFile } from '../files/stored-file.js';
4
+ /**
5
+ * The check a file passes before it is accepted: an antivirus (ClamAV over its socket, a cloud
6
+ * scanning service), a parser that refuses a malformed document, a policy on archives. Called on
7
+ * the staged file, so a refused file is never visible. `open` reads the content again; a scanner
8
+ * that needs none of it does not call it.
9
+ */
10
+ export declare abstract class FileScanner {
11
+ abstract scan(file: StoredFile, open: () => Promise<Readable>): Promise<ScanVerdict>;
12
+ }
13
+ //# sourceMappingURL=file-scanner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-scanner.d.ts","sourceRoot":"","sources":["../../../src/application/ports/file-scanner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1D;;;;;GAKG;AACH,8BAAsB,WAAW;IAK/B,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;CACtF"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The check a file passes before it is accepted: an antivirus (ClamAV over its socket, a cloud
3
+ * scanning service), a parser that refuses a malformed document, a policy on archives. Called on
4
+ * the staged file, so a refused file is never visible. `open` reads the content again; a scanner
5
+ * that needs none of it does not call it.
6
+ */
7
+ export class FileScanner {
8
+ static {
9
+ Object.defineProperty(this, 'tokenKey', { value: 'kernel.FileScanner' });
10
+ }
11
+ }
12
+ //# sourceMappingURL=file-scanner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-scanner.js","sourceRoot":"","sources":["../../../src/application/ports/file-scanner.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,MAAM,OAAgB,WAAW;IAC/B;QACE,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,oBAAoB,EAAE,CAAC,CAAC;IAC3E,CAAC;CAGF"}
@@ -0,0 +1,40 @@
1
+ import type { DownloadUrlOptions } from '../files/download-url-options.js';
2
+ import type { FileContent } from '../files/file-content.js';
3
+ import type { FileMetadata } from '../files/file-metadata.js';
4
+ import type { FileSource } from '../files/file-source.js';
5
+ import type { ListedFile } from '../files/listed-file.js';
6
+ import type { PutOptions } from '../files/put-options.js';
7
+ import type { SignedUpload } from '../files/signed-upload.js';
8
+ import type { SignedUrl } from '../files/signed-url.js';
9
+ import type { StoredFile } from '../files/stored-file.js';
10
+ import type { UploadUrlOptions } from '../files/upload-url-options.js';
11
+ /**
12
+ * Where the content of files lives: an object store, a directory, the memory of a test. Never
13
+ * the database, whose backups, replicas and memory are sized for rows. Content always streams in
14
+ * and out: no method takes or returns a whole file. A key that `isFileKey` refuses is refused
15
+ * with `INVALID_FILE_KEY` before anything is touched.
16
+ *
17
+ * A write is not part of a transaction: see `FileStaging` for the order that keeps the database
18
+ * and the storage consistent.
19
+ */
20
+ export declare abstract class FileStorage {
21
+ /** Writes the content under the key, replacing what was there; rejects with `FILE_TOO_LARGE` beyond `maxBytes`, leaving nothing. */
22
+ abstract put(key: string, content: FileSource, options: PutOptions): Promise<StoredFile>;
23
+ /** The content as a stream, or `undefined` when nothing is stored under the key. */
24
+ abstract get(key: string): Promise<FileContent | undefined>;
25
+ /** What is known of the file without reading it, or `undefined`: how a caller asks whether it exists. */
26
+ abstract stat(key: string): Promise<FileMetadata | undefined>;
27
+ /** Removes the file; removing a file that is not there is not an error. */
28
+ abstract delete(key: string): Promise<void>;
29
+ /** Rejects with `FILE_NOT_FOUND` when nothing is stored under `from`. */
30
+ abstract copy(from: string, to: string): Promise<void>;
31
+ /** Rejects with `FILE_NOT_FOUND` when nothing is stored under `from`. */
32
+ abstract move(from: string, to: string): Promise<void>;
33
+ /** Every file whose key starts with the prefix, in no promised order. */
34
+ abstract list(prefix: string): AsyncIterable<ListedFile>;
35
+ /** A link that downloads the file until it expires. Signing does not check that the file exists. */
36
+ abstract signedDownloadUrl(key: string, options: DownloadUrlOptions): Promise<SignedUrl>;
37
+ /** A request that uploads one file under the key, straight to the storage, until it expires. */
38
+ abstract signedUploadUrl(key: string, options: UploadUrlOptions): Promise<SignedUpload>;
39
+ }
40
+ //# sourceMappingURL=file-storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-storage.d.ts","sourceRoot":"","sources":["../../../src/application/ports/file-storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,E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,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IAEzF,gGAAgG;IAChG,QAAQ,CAAC,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CACzF"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Where the content of files lives: an object store, a directory, the memory of a test. Never
3
+ * the database, whose backups, replicas and memory are sized for rows. Content always streams in
4
+ * and out: no method takes or returns a whole file. A key that `isFileKey` refuses is refused
5
+ * with `INVALID_FILE_KEY` before anything is touched.
6
+ *
7
+ * A write is not part of a transaction: see `FileStaging` for the order that keeps the database
8
+ * and the storage consistent.
9
+ */
10
+ export class FileStorage {
11
+ static {
12
+ Object.defineProperty(this, 'tokenKey', { value: 'kernel.FileStorage' });
13
+ }
14
+ }
15
+ //# sourceMappingURL=file-storage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-storage.js","sourceRoot":"","sources":["../../../src/application/ports/file-storage.ts"],"names":[],"mappings":"AAWA;;;;;;;;GAQG;AACH,MAAM,OAAgB,WAAW;IAC/B;QACE,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,oBAAoB,EAAE,CAAC,CAAC;IAC3E,CAAC;CA4BF"}
@@ -0,0 +1,16 @@
1
+ import type { FileSource } from '../files/file-source.js';
2
+ import type { SignedDownload } from '../files/signed-download.js';
3
+ import type { StoredFile } from '../files/stored-file.js';
4
+ import { FileStorage } from './file-storage.js';
5
+ /**
6
+ * A storage whose signed links point at the application itself, which must then answer them:
7
+ * the local directory of development and the memory of the tests. `signedFileRoutes` of
8
+ * `@ddd-ts-kit/http` mounts that answer. An object store answers its own links and is not one.
9
+ */
10
+ export declare abstract class ServedFileStorage extends FileStorage {
11
+ /** The file a download link grants, or `undefined` for a link that is forged, expired or for another action. */
12
+ abstract openSigned(token: string): Promise<SignedDownload | undefined>;
13
+ /** Stores what an upload link grants, sent with the media type it was signed for; `undefined` when the link does not grant it. */
14
+ abstract acceptSigned(token: string, content: FileSource, mediaType: string): Promise<StoredFile | undefined>;
15
+ }
16
+ //# sourceMappingURL=served-file-storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"served-file-storage.d.ts","sourceRoot":"","sources":["../../../src/application/ports/served-file-storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;;GAIG;AACH,8BAAsB,iBAAkB,SAAQ,WAAW;IAKzD,gHAAgH;IAChH,QAAQ,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;IAExE,kIAAkI;IAClI,QAAQ,CAAC,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC;CAC/G"}
@@ -0,0 +1,12 @@
1
+ import { FileStorage } from './file-storage.js';
2
+ /**
3
+ * A storage whose signed links point at the application itself, which must then answer them:
4
+ * the local directory of development and the memory of the tests. `signedFileRoutes` of
5
+ * `@ddd-ts-kit/http` mounts that answer. An object store answers its own links and is not one.
6
+ */
7
+ export class ServedFileStorage extends FileStorage {
8
+ static {
9
+ Object.defineProperty(this, 'tokenKey', { value: 'kernel.ServedFileStorage' });
10
+ }
11
+ }
12
+ //# sourceMappingURL=served-file-storage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"served-file-storage.js","sourceRoot":"","sources":["../../../src/application/ports/served-file-storage.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;;GAIG;AACH,MAAM,OAAgB,iBAAkB,SAAQ,WAAW;IACzD;QACE,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,0BAA0B,EAAE,CAAC,CAAC;IACjF,CAAC;CAOF"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The tenants that exist, for work that runs once per tenant: a job declared `tenancy:
3
+ * 'per-tenant'`, the provisioning of a schema or a database, a migration applied to each.
4
+ */
5
+ export declare abstract class TenantDirectory {
6
+ abstract tenants(): Promise<readonly string[]>;
7
+ }
8
+ //# sourceMappingURL=tenant-directory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tenant-directory.d.ts","sourceRoot":"","sources":["../../../src/application/ports/tenant-directory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,8BAAsB,eAAe;IAKnC,QAAQ,CAAC,OAAO,IAAI,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CAAC;CAChD"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The tenants that exist, for work that runs once per tenant: a job declared `tenancy:
3
+ * 'per-tenant'`, the provisioning of a schema or a database, a migration applied to each.
4
+ */
5
+ export class TenantDirectory {
6
+ static {
7
+ Object.defineProperty(this, 'tokenKey', { value: 'kernel.TenantDirectory' });
8
+ }
9
+ }
10
+ //# sourceMappingURL=tenant-directory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tenant-directory.js","sourceRoot":"","sources":["../../../src/application/ports/tenant-directory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,OAAgB,eAAe;IACnC;QACE,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,wBAAwB,EAAE,CAAC,CAAC;IAC/E,CAAC;CAGF"}
@@ -4,10 +4,12 @@ export interface JobExecutionStart {
4
4
  readonly scheduledAt: Date;
5
5
  /** The instant the timeout of the job ends the run, when it has one. */
6
6
  readonly deadline?: Date;
7
+ /** For a job declared `tenancy: 'per-tenant'`: the tenant of this run. */
8
+ readonly tenantId?: string;
7
9
  }
8
10
  /**
9
11
  * The execution context of one run: origin `schedule`, the system actor named after the job, a
10
- * correlation of its own and the instant the run was due.
12
+ * correlation of its own, the instant the run was due, and the tenant of a per-tenant run.
11
13
  */
12
14
  export declare function executionContextOfJob(job: string, start: JobExecutionStart): ExecutionContext;
13
15
  //# sourceMappingURL=execution-context-of-job.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"execution-context-of-job.d.ts","sourceRoot":"","sources":["../../../src/application/scheduling/execution-context-of-job.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,gBAAgB,EAAoB,MAAM,mCAAmC,CAAC;AAE5F,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC;IAC3B,wEAAwE;IACxE,QAAQ,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC;CAC1B;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,GAAG,gBAAgB,CAE7F"}
1
+ {"version":3,"file":"execution-context-of-job.d.ts","sourceRoot":"","sources":["../../../src/application/scheduling/execution-context-of-job.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,gBAAgB,EAAoB,MAAM,mCAAmC,CAAC;AAE5F,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC;IAC3B,wEAAwE;IACxE,QAAQ,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC;IACzB,0EAA0E;IAC1E,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,GAAG,gBAAgB,CAE7F"}
@@ -2,7 +2,7 @@ import { systemActor } from '../actor/system-actor.js';
2
2
  import { executionContext } from '../execution/execution-context.js';
3
3
  /**
4
4
  * The execution context of one run: origin `schedule`, the system actor named after the job, a
5
- * correlation of its own and the instant the run was due.
5
+ * correlation of its own, the instant the run was due, and the tenant of a per-tenant run.
6
6
  */
7
7
  export function executionContextOfJob(job, start) {
8
8
  return executionContext({ ...start, actor: systemActor(job), origin: 'schedule' });
@@ -1 +1 @@
1
- {"version":3,"file":"execution-context-of-job.js","sourceRoot":"","sources":["../../../src/application/scheduling/execution-context-of-job.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAyB,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAS5F;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,GAAW,EAAE,KAAwB;IACzE,OAAO,gBAAgB,CAAC,EAAE,GAAG,KAAK,EAAE,KAAK,EAAE,WAAW,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;AACrF,CAAC"}
1
+ {"version":3,"file":"execution-context-of-job.js","sourceRoot":"","sources":["../../../src/application/scheduling/execution-context-of-job.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAyB,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAW5F;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,GAAW,EAAE,KAAwB;IACzE,OAAO,gBAAgB,CAAC,EAAE,GAAG,KAAK,EAAE,KAAK,EAAE,WAAW,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;AACrF,CAAC"}
@@ -8,5 +8,7 @@ export interface JobExecution {
8
8
  readonly attempt: number;
9
9
  /** Aborted when the run exceeds its timeout or the scheduler stops: a long job checks it. */
10
10
  readonly signal: AbortSignal;
11
+ /** The tenant of this run, for a job declared `tenancy: 'per-tenant'`. */
12
+ readonly tenantId?: string;
11
13
  }
12
14
  //# sourceMappingURL=job-execution.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"job-execution.d.ts","sourceRoot":"","sources":["../../../src/application/scheduling/job-execution.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,MAAM,WAAW,YAAY;IAC3B,2EAA2E;IAC3E,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC;IAC3B,yGAAyG;IACzG,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;IACzB,uGAAuG;IACvG,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,6FAA6F;IAC7F,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;CAC9B"}
1
+ {"version":3,"file":"job-execution.d.ts","sourceRoot":"","sources":["../../../src/application/scheduling/job-execution.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,MAAM,WAAW,YAAY;IAC3B,2EAA2E;IAC3E,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC;IAC3B,yGAAyG;IACzG,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;IACzB,uGAAuG;IACvG,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,6FAA6F;IAC7F,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,0EAA0E;IAC1E,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B"}
@@ -21,5 +21,11 @@ export interface JobOptions {
21
21
  * an application running several runs it. Best effort: see the scheduler.
22
22
  */
23
23
  readonly singleInstance?: boolean;
24
+ /**
25
+ * `global` (default): one run per occurrence, in no tenant. `per-tenant`: one run per tenant
26
+ * of the `TenantDirectory` for each occurrence, each in that tenant's execution scope, so the
27
+ * job reads and writes one tenant at a time; one failing tenant does not stop the others.
28
+ */
29
+ readonly tenancy?: 'global' | 'per-tenant';
24
30
  }
25
31
  //# sourceMappingURL=job-options.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"job-options.d.ts","sourceRoot":"","sources":["../../../src/application/scheduling/job-options.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACpC;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IACtC,6EAA6E;IAC7E,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,sHAAsH;IACtH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,uGAAuG;IACvG,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;CACnC"}
1
+ {"version":3,"file":"job-options.d.ts","sourceRoot":"","sources":["../../../src/application/scheduling/job-options.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACpC;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IACtC,6EAA6E;IAC7E,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,sHAAsH;IACtH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,uGAAuG;IACvG,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAClC;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,GAAG,YAAY,CAAC;CAC5C"}
@@ -1 +1 @@
1
- {"version":3,"file":"job-policy.d.ts","sourceRoot":"","sources":["../../../src/application/scheduling/job-policy.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnD,iDAAiD;AACjD,MAAM,MAAM,SAAS,GAAG,QAAQ,CAAC,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC,GAAG,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;AAEhG,yFAAyF;AACzF,wBAAgB,SAAS,CAAC,OAAO,EAAE,UAAU,GAAG,SAAS,CAiBxD"}
1
+ {"version":3,"file":"job-policy.d.ts","sourceRoot":"","sources":["../../../src/application/scheduling/job-policy.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnD,iDAAiD;AACjD,MAAM,MAAM,SAAS,GAAG,QAAQ,CAAC,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC,GAAG,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;AAEhG,yFAAyF;AACzF,wBAAgB,SAAS,CAAC,OAAO,EAAE,UAAU,GAAG,SAAS,CAmBxD"}
@@ -3,15 +3,17 @@ import { parseDuration } from './parse-duration.js';
3
3
  /** Validates the options and fills in the defaults. Throws `InvalidJobScheduleError`. */
4
4
  export function jobPolicy(options) {
5
5
  const { overlap = 'skip', missed = 'skip', timeoutMs, jitterMs = 0, enabled = true, singleInstance = true } = options;
6
+ const tenancy = options.tenancy ?? 'global';
6
7
  assertOneOf('overlap', overlap, ['skip', 'queue']);
7
8
  assertOneOf('missed', missed, ['skip', 'run-once']);
9
+ assertOneOf('tenancy', tenancy, ['global', 'per-tenant']);
8
10
  if (!Number.isSafeInteger(jitterMs) || jitterMs < 0) {
9
11
  throw new InvalidJobScheduleError(`jitterMs is ${jitterMs}: a whole number of milliseconds, zero or more, is expected.`);
10
12
  }
11
13
  if (timeoutMs === undefined) {
12
- return { overlap, missed, jitterMs, enabled, singleInstance };
14
+ return { overlap, missed, jitterMs, enabled, singleInstance, tenancy };
13
15
  }
14
- return { overlap, missed, jitterMs, enabled, singleInstance, timeoutMs: parseDuration(timeoutMs) };
16
+ return { overlap, missed, jitterMs, enabled, singleInstance, tenancy, timeoutMs: parseDuration(timeoutMs) };
15
17
  }
16
18
  function assertOneOf(option, value, allowed) {
17
19
  if (allowed.includes(value)) {
@@ -1 +1 @@
1
- {"version":3,"file":"job-policy.js","sourceRoot":"","sources":["../../../src/application/scheduling/job-policy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAE1E,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAKpD,yFAAyF;AACzF,MAAM,UAAU,SAAS,CAAC,OAAmB;IAC3C,MAAM,EAAE,OAAO,GAAG,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,SAAS,EAAE,QAAQ,GAAG,CAAC,EAAE,OAAO,GAAG,IAAI,EAAE,cAAc,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;IAEtH,WAAW,CAAC,SAAS,EAAE,OAAO,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACnD,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;IAEpD,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,QAAQ,GAAG,CAAC,EAAE,CAAC;QACpD,MAAM,IAAI,uBAAuB,CAC/B,eAAe,QAAQ,8DAA8D,CACtF,CAAC;IACJ,CAAC;IAED,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC;IAChE,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,aAAa,CAAC,SAAS,CA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E,CAAC;QAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,CAAC;IACzE,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,CAAC,SAAS,CAAC,EAAE,CAAC;AAC9G,CAAC;AAED,SAAS,WAAW,CAAC,MAAc,EAAE,KAAa,EAAE,OAA0B;IAC5E,IAAI,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO;IACT,CAAC;IAED,MAAM,IAAI,uBAAuB,CAAC,GAAG,MAAM,QAAQ,KAAK,aAAa,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;AAC1G,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { SessionScope } from './session-scope.js';
2
+ import type { Session } from './session.js';
3
+ /** Whether the session was granted the scope; a request without a session was granted none. */
4
+ export declare function hasScope(session: Session | undefined, scope: SessionScope): boolean;
5
+ //# sourceMappingURL=has-scope.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"has-scope.d.ts","sourceRoot":"","sources":["../../../src/application/session/has-scope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,+FAA+F;AAC/F,wBAAgB,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,EAAE,KAAK,EAAE,YAAY,GAAG,OAAO,CAEnF"}
@@ -0,0 +1,5 @@
1
+ /** Whether the session was granted the scope; a request without a session was granted none. */
2
+ export function hasScope(session, scope) {
3
+ return session?.scopes?.includes(scope) === true;
4
+ }
5
+ //# sourceMappingURL=has-scope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"has-scope.js","sourceRoot":"","sources":["../../../src/application/session/has-scope.ts"],"names":[],"mappings":"AAGA,+FAA+F;AAC/F,MAAM,UAAU,QAAQ,CAAC,OAA4B,EAAE,KAAmB;IACxE,OAAO,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC;AACnD,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { SessionScopes } from './session-scopes.js';
2
+ /** A scope of the project's vocabulary once `SessionScopes` declares one, any string before. */
3
+ export type SessionScope = [keyof SessionScopes] extends [never] ? string : Extract<keyof SessionScopes, string>;
4
+ //# sourceMappingURL=session-scope.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-scope.d.ts","sourceRoot":"","sources":["../../../src/application/session/session-scope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,gGAAgG;AAChG,MAAM,MAAM,YAAY,GAAG,CAAC,MAAM,aAAa,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,aAAa,EAAE,MAAM,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=session-scope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-scope.js","sourceRoot":"","sources":["../../../src/application/session/session-scope.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The vocabulary of the scopes a project grants its clients, by declaration merging, so that a
3
+ * guard names only scopes that exist:
4
+ *
5
+ * declare module '@ddd-ts-kit/kernel' {
6
+ * interface SessionScopes { readonly 'invoices:read': true; readonly 'invoices:write': true }
7
+ * }
8
+ */
9
+ export interface SessionScopes {
10
+ }
11
+ //# sourceMappingURL=session-scopes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-scopes.d.ts","sourceRoot":"","sources":["../../../src/application/session/session-scopes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa;CAAG"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=session-scopes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-scopes.js","sourceRoot":"","sources":["../../../src/application/session/session-scopes.ts"],"names":[],"mappings":""}
@@ -22,6 +22,12 @@ export interface Session {
22
22
  /** IANA time zone, for example `Europe/Paris`. */
23
23
  readonly timeZone?: string;
24
24
  readonly client?: SessionClient;
25
+ /**
26
+ * What the credential allows whoever presents it (the OAuth 2.0 `scope` of the token): a
27
+ * limit on the client, checked at the edge (`HasScope`), never what the actor may do, which
28
+ * stays a permission of the use case. Absent when the credential carries none.
29
+ */
30
+ readonly scopes?: readonly string[];
25
31
  readonly extensions: SessionExtensionValues;
26
32
  }
27
33
  //# sourceMappingURL=session.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/application/session/session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAE5E;;;;GAIG;AACH,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;IACxB,QAAQ,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC;IAC1B,QAAQ,CAAC,oBAAoB,EAAE,oBAAoB,CAAC;IACpD,QAAQ,CAAC,sBAAsB,CAAC,EAAE,sBAAsB,CAAC;IACzD,kF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AIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,UAAU,EAAE,sBAAsB,CAAC;CAC7C"}
@@ -0,0 +1,12 @@
1
+ import type { ElevationOptions } from './elevation-options.js';
2
+ import type { TenantElevation } from './tenant-elevation.js';
3
+ /** The action of the audit entry an elevation writes. */
4
+ export declare const TENANT_ELEVATION_ACTION = "tenancy:elevate";
5
+ /**
6
+ * Runs `work` with reads widened to the tenants of `elevation`, for platform staff. Never
7
+ * implicit: the platform calls it after the permission to elevate was decided, and the
8
+ * elevation is written to the audit trail before the work starts; a trail that fails refuses
9
+ * the elevation. Writes still name one tenant (`tenantScopeOf`).
10
+ */
11
+ export declare function acrossTenants<T>(options: ElevationOptions, elevation: TenantElevation, work: () => Promise<T>): Promise<T>;
12
+ //# sourceMappingURL=across-tenants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"across-tenants.d.ts","sourceRoot":"","sources":["../../../src/application/tenancy/across-tenants.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,yDAAyD;AACzD,eAAO,MAAM,uBAAuB,oBAAoB,CAAC;AAEzD;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,CAAC,EACnC,OAAO,EAAE,gBAAgB,EACzB,SAAS,EAAE,eAAe,EAC1B,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACrB,OAAO,CAAC,CAAC,CAAC,CAQZ"}