@byline/core 0.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (283) hide show
  1. package/LICENSE +373 -0
  2. package/README.md +17 -0
  3. package/dist/@types/admin-types.d.ts +275 -0
  4. package/dist/@types/admin-types.d.ts.map +1 -0
  5. package/dist/@types/admin-types.js +18 -0
  6. package/dist/@types/admin-types.js.map +1 -0
  7. package/dist/@types/collection-types.d.ts +816 -0
  8. package/dist/@types/collection-types.d.ts.map +1 -0
  9. package/dist/@types/collection-types.js +217 -0
  10. package/dist/@types/collection-types.js.map +1 -0
  11. package/dist/@types/db-types.d.ts +463 -0
  12. package/dist/@types/db-types.d.ts.map +1 -0
  13. package/dist/@types/db-types.js +2 -0
  14. package/dist/@types/db-types.js.map +1 -0
  15. package/dist/@types/field-data-types.d.ts +147 -0
  16. package/dist/@types/field-data-types.d.ts.map +1 -0
  17. package/dist/@types/field-data-types.js +38 -0
  18. package/dist/@types/field-data-types.js.map +1 -0
  19. package/dist/@types/field-types.d.ts +579 -0
  20. package/dist/@types/field-types.d.ts.map +1 -0
  21. package/dist/@types/field-types.js +32 -0
  22. package/dist/@types/field-types.js.map +1 -0
  23. package/dist/@types/index.d.ts +18 -0
  24. package/dist/@types/index.d.ts.map +1 -0
  25. package/dist/@types/index.js +18 -0
  26. package/dist/@types/index.js.map +1 -0
  27. package/dist/@types/populate-types.d.ts +54 -0
  28. package/dist/@types/populate-types.d.ts.map +1 -0
  29. package/dist/@types/populate-types.js +9 -0
  30. package/dist/@types/populate-types.js.map +1 -0
  31. package/dist/@types/query-predicate.d.ts +74 -0
  32. package/dist/@types/query-predicate.d.ts.map +1 -0
  33. package/dist/@types/query-predicate.js +9 -0
  34. package/dist/@types/query-predicate.js.map +1 -0
  35. package/dist/@types/site-config.d.ts +212 -0
  36. package/dist/@types/site-config.d.ts.map +1 -0
  37. package/dist/@types/site-config.js +9 -0
  38. package/dist/@types/site-config.js.map +1 -0
  39. package/dist/@types/storage-types.d.ts +86 -0
  40. package/dist/@types/storage-types.d.ts.map +1 -0
  41. package/dist/@types/storage-types.js +9 -0
  42. package/dist/@types/storage-types.js.map +1 -0
  43. package/dist/@types/store-types.d.ts +134 -0
  44. package/dist/@types/store-types.d.ts.map +1 -0
  45. package/dist/@types/store-types.js +24 -0
  46. package/dist/@types/store-types.js.map +1 -0
  47. package/dist/@types/type-utils.d.ts +17 -0
  48. package/dist/@types/type-utils.d.ts.map +1 -0
  49. package/dist/@types/type-utils.js +9 -0
  50. package/dist/@types/type-utils.js.map +1 -0
  51. package/dist/auth/apply-before-read.d.ts +36 -0
  52. package/dist/auth/apply-before-read.d.ts.map +1 -0
  53. package/dist/auth/apply-before-read.js +68 -0
  54. package/dist/auth/apply-before-read.js.map +1 -0
  55. package/dist/auth/apply-before-read.test.node.d.ts +9 -0
  56. package/dist/auth/apply-before-read.test.node.d.ts.map +1 -0
  57. package/dist/auth/apply-before-read.test.node.js +144 -0
  58. package/dist/auth/apply-before-read.test.node.js.map +1 -0
  59. package/dist/auth/assert-actor-can-perform.d.ts +39 -0
  60. package/dist/auth/assert-actor-can-perform.d.ts.map +1 -0
  61. package/dist/auth/assert-actor-can-perform.js +64 -0
  62. package/dist/auth/assert-actor-can-perform.js.map +1 -0
  63. package/dist/auth/assert-actor-can-perform.test.node.d.ts +9 -0
  64. package/dist/auth/assert-actor-can-perform.test.node.d.ts.map +1 -0
  65. package/dist/auth/assert-actor-can-perform.test.node.js +119 -0
  66. package/dist/auth/assert-actor-can-perform.test.node.js.map +1 -0
  67. package/dist/auth/index.d.ts +11 -0
  68. package/dist/auth/index.d.ts.map +1 -0
  69. package/dist/auth/index.js +11 -0
  70. package/dist/auth/index.js.map +1 -0
  71. package/dist/auth/register-collection-abilities.d.ts +40 -0
  72. package/dist/auth/register-collection-abilities.d.ts.map +1 -0
  73. package/dist/auth/register-collection-abilities.js +87 -0
  74. package/dist/auth/register-collection-abilities.js.map +1 -0
  75. package/dist/auth/register-collection-abilities.test.node.d.ts +9 -0
  76. package/dist/auth/register-collection-abilities.test.node.d.ts.map +1 -0
  77. package/dist/auth/register-collection-abilities.test.node.js +124 -0
  78. package/dist/auth/register-collection-abilities.test.node.js.map +1 -0
  79. package/dist/config/config.d.ts +10 -0
  80. package/dist/config/config.d.ts.map +1 -0
  81. package/dist/config/config.js +108 -0
  82. package/dist/config/config.js.map +1 -0
  83. package/dist/config/routes.d.ts +16 -0
  84. package/dist/config/routes.d.ts.map +1 -0
  85. package/dist/config/routes.js +26 -0
  86. package/dist/config/routes.js.map +1 -0
  87. package/dist/config/validate-admin-configs.d.ts +33 -0
  88. package/dist/config/validate-admin-configs.d.ts.map +1 -0
  89. package/dist/config/validate-admin-configs.js +250 -0
  90. package/dist/config/validate-admin-configs.js.map +1 -0
  91. package/dist/config/validate-admin-configs.test.node.d.ts +9 -0
  92. package/dist/config/validate-admin-configs.test.node.d.ts.map +1 -0
  93. package/dist/config/validate-admin-configs.test.node.js +224 -0
  94. package/dist/config/validate-admin-configs.test.node.js.map +1 -0
  95. package/dist/config/validate-collections.d.ts +33 -0
  96. package/dist/config/validate-collections.d.ts.map +1 -0
  97. package/dist/config/validate-collections.js +70 -0
  98. package/dist/config/validate-collections.js.map +1 -0
  99. package/dist/config/validate-collections.test.node.d.ts +9 -0
  100. package/dist/config/validate-collections.test.node.d.ts.map +1 -0
  101. package/dist/config/validate-collections.test.node.js +149 -0
  102. package/dist/config/validate-collections.test.node.js.map +1 -0
  103. package/dist/core.d.ts +89 -0
  104. package/dist/core.d.ts.map +1 -0
  105. package/dist/core.js +99 -0
  106. package/dist/core.js.map +1 -0
  107. package/dist/defaults/default-values.d.ts +13 -0
  108. package/dist/defaults/default-values.d.ts.map +1 -0
  109. package/dist/defaults/default-values.js +60 -0
  110. package/dist/defaults/default-values.js.map +1 -0
  111. package/dist/index.d.ts +20 -0
  112. package/dist/index.d.ts.map +1 -0
  113. package/dist/index.js +36 -0
  114. package/dist/index.js.map +1 -0
  115. package/dist/lib/errors.d.ts +98 -0
  116. package/dist/lib/errors.d.ts.map +1 -0
  117. package/dist/lib/errors.js +134 -0
  118. package/dist/lib/errors.js.map +1 -0
  119. package/dist/lib/logger.d.ts +62 -0
  120. package/dist/lib/logger.d.ts.map +1 -0
  121. package/dist/lib/logger.js +120 -0
  122. package/dist/lib/logger.js.map +1 -0
  123. package/dist/lib/registry.d.ts +65 -0
  124. package/dist/lib/registry.d.ts.map +1 -0
  125. package/dist/lib/registry.js +133 -0
  126. package/dist/lib/registry.js.map +1 -0
  127. package/dist/logger/index.d.ts +3 -0
  128. package/dist/logger/index.d.ts.map +1 -0
  129. package/dist/logger/index.js +3 -0
  130. package/dist/logger/index.js.map +1 -0
  131. package/dist/patches/apply-patches.d.ts +21 -0
  132. package/dist/patches/apply-patches.d.ts.map +1 -0
  133. package/dist/patches/apply-patches.js +357 -0
  134. package/dist/patches/apply-patches.js.map +1 -0
  135. package/dist/patches/index.d.ts +3 -0
  136. package/dist/patches/index.d.ts.map +1 -0
  137. package/dist/patches/index.js +4 -0
  138. package/dist/patches/index.js.map +1 -0
  139. package/dist/patches/patch-types.d.ts +82 -0
  140. package/dist/patches/patch-types.d.ts.map +1 -0
  141. package/dist/patches/patch-types.js +3 -0
  142. package/dist/patches/patch-types.js.map +1 -0
  143. package/dist/patches/patch.test.node.d.ts +2 -0
  144. package/dist/patches/patch.test.node.d.ts.map +1 -0
  145. package/dist/patches/patch.test.node.js +193 -0
  146. package/dist/patches/patch.test.node.js.map +1 -0
  147. package/dist/query/parse-where.d.ts +100 -0
  148. package/dist/query/parse-where.d.ts.map +1 -0
  149. package/dist/query/parse-where.js +352 -0
  150. package/dist/query/parse-where.js.map +1 -0
  151. package/dist/query/parse-where.test.node.d.ts +9 -0
  152. package/dist/query/parse-where.test.node.d.ts.map +1 -0
  153. package/dist/query/parse-where.test.node.js +581 -0
  154. package/dist/query/parse-where.test.node.js.map +1 -0
  155. package/dist/schemas/zod/builder.d.ts +466 -0
  156. package/dist/schemas/zod/builder.d.ts.map +1 -0
  157. package/dist/schemas/zod/builder.js +276 -0
  158. package/dist/schemas/zod/builder.js.map +1 -0
  159. package/dist/schemas/zod/cache.d.ts +14 -0
  160. package/dist/schemas/zod/cache.d.ts.map +1 -0
  161. package/dist/schemas/zod/cache.js +40 -0
  162. package/dist/schemas/zod/cache.js.map +1 -0
  163. package/dist/schemas/zod/index.d.ts +4 -0
  164. package/dist/schemas/zod/index.d.ts.map +1 -0
  165. package/dist/schemas/zod/index.js +4 -0
  166. package/dist/schemas/zod/index.js.map +1 -0
  167. package/dist/schemas/zod/types.d.ts +13 -0
  168. package/dist/schemas/zod/types.d.ts.map +1 -0
  169. package/dist/schemas/zod/types.js +2 -0
  170. package/dist/schemas/zod/types.js.map +1 -0
  171. package/dist/services/collection-bootstrap.d.ts +46 -0
  172. package/dist/services/collection-bootstrap.d.ts.map +1 -0
  173. package/dist/services/collection-bootstrap.js +108 -0
  174. package/dist/services/collection-bootstrap.js.map +1 -0
  175. package/dist/services/collection-bootstrap.test.node.d.ts +9 -0
  176. package/dist/services/collection-bootstrap.test.node.d.ts.map +1 -0
  177. package/dist/services/collection-bootstrap.test.node.js +208 -0
  178. package/dist/services/collection-bootstrap.test.node.js.map +1 -0
  179. package/dist/services/document-lifecycle.d.ts +245 -0
  180. package/dist/services/document-lifecycle.d.ts.map +1 -0
  181. package/dist/services/document-lifecycle.js +481 -0
  182. package/dist/services/document-lifecycle.js.map +1 -0
  183. package/dist/services/document-lifecycle.test.node.d.ts +9 -0
  184. package/dist/services/document-lifecycle.test.node.d.ts.map +1 -0
  185. package/dist/services/document-lifecycle.test.node.js +781 -0
  186. package/dist/services/document-lifecycle.test.node.js.map +1 -0
  187. package/dist/services/document-read.d.ts +26 -0
  188. package/dist/services/document-read.d.ts.map +1 -0
  189. package/dist/services/document-read.js +60 -0
  190. package/dist/services/document-read.js.map +1 -0
  191. package/dist/services/field-upload.d.ts +100 -0
  192. package/dist/services/field-upload.d.ts.map +1 -0
  193. package/dist/services/field-upload.js +328 -0
  194. package/dist/services/field-upload.js.map +1 -0
  195. package/dist/services/field-upload.test.node.d.ts +9 -0
  196. package/dist/services/field-upload.test.node.d.ts.map +1 -0
  197. package/dist/services/field-upload.test.node.js +337 -0
  198. package/dist/services/field-upload.test.node.js.map +1 -0
  199. package/dist/services/index.d.ts +10 -0
  200. package/dist/services/index.d.ts.map +1 -0
  201. package/dist/services/index.js +11 -0
  202. package/dist/services/index.js.map +1 -0
  203. package/dist/services/populate.d.ts +299 -0
  204. package/dist/services/populate.d.ts.map +1 -0
  205. package/dist/services/populate.js +484 -0
  206. package/dist/services/populate.js.map +1 -0
  207. package/dist/services/populate.test.node.d.ts +9 -0
  208. package/dist/services/populate.test.node.d.ts.map +1 -0
  209. package/dist/services/populate.test.node.js +910 -0
  210. package/dist/services/populate.test.node.js.map +1 -0
  211. package/dist/services/relation-projection.d.ts +52 -0
  212. package/dist/services/relation-projection.d.ts.map +1 -0
  213. package/dist/services/relation-projection.js +81 -0
  214. package/dist/services/relation-projection.js.map +1 -0
  215. package/dist/services/richtext-populate.d.ts +87 -0
  216. package/dist/services/richtext-populate.d.ts.map +1 -0
  217. package/dist/services/richtext-populate.js +189 -0
  218. package/dist/services/richtext-populate.js.map +1 -0
  219. package/dist/services/richtext-populate.test.node.d.ts +9 -0
  220. package/dist/services/richtext-populate.test.node.d.ts.map +1 -0
  221. package/dist/services/richtext-populate.test.node.js +197 -0
  222. package/dist/services/richtext-populate.test.node.js.map +1 -0
  223. package/dist/storage/collection-fingerprint.d.ts +21 -0
  224. package/dist/storage/collection-fingerprint.d.ts.map +1 -0
  225. package/dist/storage/collection-fingerprint.js +172 -0
  226. package/dist/storage/collection-fingerprint.js.map +1 -0
  227. package/dist/storage/collection-fingerprint.test.node.d.ts +9 -0
  228. package/dist/storage/collection-fingerprint.test.node.d.ts.map +1 -0
  229. package/dist/storage/collection-fingerprint.test.node.js +256 -0
  230. package/dist/storage/collection-fingerprint.test.node.js.map +1 -0
  231. package/dist/storage/field-store-map.d.ts +59 -0
  232. package/dist/storage/field-store-map.d.ts.map +1 -0
  233. package/dist/storage/field-store-map.js +75 -0
  234. package/dist/storage/field-store-map.js.map +1 -0
  235. package/dist/storage/field-store-map.test.node.d.ts +9 -0
  236. package/dist/storage/field-store-map.test.node.d.ts.map +1 -0
  237. package/dist/storage/field-store-map.test.node.js +117 -0
  238. package/dist/storage/field-store-map.test.node.js.map +1 -0
  239. package/dist/storage/index.d.ts +10 -0
  240. package/dist/storage/index.d.ts.map +1 -0
  241. package/dist/storage/index.js +10 -0
  242. package/dist/storage/index.js.map +1 -0
  243. package/dist/utils/normalise-dates.d.ts +15 -0
  244. package/dist/utils/normalise-dates.d.ts.map +1 -0
  245. package/dist/utils/normalise-dates.js +22 -0
  246. package/dist/utils/normalise-dates.js.map +1 -0
  247. package/dist/utils/slugify.d.ts +56 -0
  248. package/dist/utils/slugify.d.ts.map +1 -0
  249. package/dist/utils/slugify.js +91 -0
  250. package/dist/utils/slugify.js.map +1 -0
  251. package/dist/utils/slugify.test.node.d.ts +9 -0
  252. package/dist/utils/slugify.test.node.d.ts.map +1 -0
  253. package/dist/utils/slugify.test.node.js +86 -0
  254. package/dist/utils/slugify.test.node.js.map +1 -0
  255. package/dist/utils/storage-utils.d.ts +36 -0
  256. package/dist/utils/storage-utils.d.ts.map +1 -0
  257. package/dist/utils/storage-utils.js +38 -0
  258. package/dist/utils/storage-utils.js.map +1 -0
  259. package/dist/utils/utils.general.d.ts +64 -0
  260. package/dist/utils/utils.general.d.ts.map +1 -0
  261. package/dist/utils/utils.general.js +219 -0
  262. package/dist/utils/utils.general.js.map +1 -0
  263. package/dist/validation/index.d.ts +9 -0
  264. package/dist/validation/index.d.ts.map +1 -0
  265. package/dist/validation/index.js +9 -0
  266. package/dist/validation/index.js.map +1 -0
  267. package/dist/validation/shared.d.ts +36 -0
  268. package/dist/validation/shared.d.ts.map +1 -0
  269. package/dist/validation/shared.js +42 -0
  270. package/dist/validation/shared.js.map +1 -0
  271. package/dist/workflow/index.d.ts +2 -0
  272. package/dist/workflow/index.d.ts.map +1 -0
  273. package/dist/workflow/index.js +3 -0
  274. package/dist/workflow/index.js.map +1 -0
  275. package/dist/workflow/workflow.d.ts +40 -0
  276. package/dist/workflow/workflow.d.ts.map +1 -0
  277. package/dist/workflow/workflow.js +96 -0
  278. package/dist/workflow/workflow.js.map +1 -0
  279. package/dist/workflow/workflow.test.node.d.ts +2 -0
  280. package/dist/workflow/workflow.test.node.d.ts.map +1 -0
  281. package/dist/workflow/workflow.test.node.js +198 -0
  282. package/dist/workflow/workflow.test.node.js.map +1 -0
  283. package/package.json +88 -0
@@ -0,0 +1,134 @@
1
+ /**
2
+ * This Source Code is subject to the terms of the Mozilla Public
3
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
4
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
+ *
6
+ * Copyright (c) Infonomic Company Limited
7
+ */
8
+ export interface BaseStore {
9
+ field_path: string;
10
+ field_name: string;
11
+ locale: string;
12
+ parent_path?: string;
13
+ }
14
+ export interface TextStore extends BaseStore {
15
+ field_type: 'text' | 'select' | 'textArea';
16
+ value: string;
17
+ }
18
+ export interface NumericStore extends BaseStore {
19
+ field_type: 'float' | 'integer' | 'decimal';
20
+ number_type: 'float' | 'integer' | 'decimal';
21
+ value_float?: number;
22
+ value_integer?: number;
23
+ value_decimal?: string;
24
+ }
25
+ export interface BooleanStore extends BaseStore {
26
+ field_type: 'boolean' | 'checkbox';
27
+ value: boolean;
28
+ }
29
+ export interface DateTimeStore extends BaseStore {
30
+ field_type: 'datetime' | 'date' | 'time';
31
+ date_type: 'datetime' | 'date' | 'time';
32
+ value_time?: string;
33
+ value_date?: Date;
34
+ value_timestamp_tz?: Date;
35
+ }
36
+ /**
37
+ * One generated image variant persisted alongside the original file
38
+ * inside `store_file.variants` (jsonb). Mirrors `PersistedVariant` on
39
+ * the field-data side; kept in sync because flatten/restore copies
40
+ * directly between them.
41
+ */
42
+ export interface FileStoreVariant {
43
+ name: string;
44
+ storage_path: string;
45
+ storage_url?: string;
46
+ width?: number;
47
+ height?: number;
48
+ format?: string;
49
+ }
50
+ export interface FileStore extends BaseStore {
51
+ field_type: 'file' | 'image';
52
+ file_id: string;
53
+ filename: string;
54
+ original_filename: string;
55
+ mime_type: string;
56
+ file_size: number;
57
+ storage_provider: string;
58
+ storage_path: string;
59
+ storage_url?: string;
60
+ file_hash?: string;
61
+ image_width?: number;
62
+ image_height?: number;
63
+ image_format?: string;
64
+ processing_status?: string;
65
+ thumbnail_generated?: boolean;
66
+ /** Image variants persisted as jsonb. Absent for non-image / no-sizes uploads. */
67
+ variants?: FileStoreVariant[];
68
+ }
69
+ export interface RelationStore extends BaseStore {
70
+ field_type: 'relation';
71
+ target_document_id: string;
72
+ target_collection_id: string;
73
+ relationship_type?: string;
74
+ cascade_delete?: boolean;
75
+ }
76
+ export interface RichTextStore extends BaseStore {
77
+ field_type: 'richText';
78
+ value: any;
79
+ }
80
+ export interface JsonStore extends BaseStore {
81
+ field_type: 'json' | 'object';
82
+ value: any;
83
+ json_schema?: string;
84
+ object_keys?: string[];
85
+ }
86
+ export type FlattenedStore = TextStore | RichTextStore | NumericStore | BooleanStore | DateTimeStore | FileStore | RelationStore | JsonStore;
87
+ export declare function isFileStore(fieldValue: FlattenedStore): fieldValue is FileStore;
88
+ export declare function isRelationStore(fieldValue: FlattenedStore): fieldValue is RelationStore;
89
+ export declare function isJsonStore(fieldValue: FlattenedStore): fieldValue is JsonStore;
90
+ export declare function isNumericStore(fieldValue: FlattenedStore): fieldValue is NumericStore;
91
+ export declare function isDateTimeStore(fieldValue: FlattenedStore): fieldValue is DateTimeStore;
92
+ export interface UnionRowValue {
93
+ id: string;
94
+ document_version_id: string;
95
+ collection_id: string;
96
+ field_type: string;
97
+ field_path: string;
98
+ field_name: string;
99
+ locale: string;
100
+ parent_path: string | null;
101
+ text_value: string | null;
102
+ boolean_value: boolean | null;
103
+ json_value: any | null;
104
+ date_type: string | null;
105
+ value_date: Date | null;
106
+ value_time: string | null;
107
+ value_timestamp_tz: Date | null;
108
+ file_id: string | null;
109
+ filename: string | null;
110
+ original_filename: string | null;
111
+ mime_type: string | null;
112
+ file_size: number | null;
113
+ storage_provider: string | null;
114
+ storage_path: string | null;
115
+ storage_url: string | null;
116
+ file_hash: string | null;
117
+ image_width: number | null;
118
+ image_height: number | null;
119
+ image_format: string | null;
120
+ processing_status: string | null;
121
+ thumbnail_generated: boolean | null;
122
+ variants: FileStoreVariant[] | null;
123
+ target_document_id: string | null;
124
+ target_collection_id: string | null;
125
+ relationship_type: string | null;
126
+ cascade_delete: boolean | null;
127
+ json_schema: string | null;
128
+ object_keys: string[] | null;
129
+ number_type: string | null;
130
+ value_integer: number | null;
131
+ value_decimal: string | null;
132
+ value_float: number | null;
133
+ }
134
+ //# sourceMappingURL=store-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store-types.d.ts","sourceRoot":"","sources":["../../src/@types/store-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,SAAS;IACxB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,SAAU,SAAQ,SAAS;IAC1C,UAAU,EAAE,MAAM,GAAG,QAAQ,GAAG,UAAU,CAAA;IAC1C,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,YAAa,SAAQ,SAAS;IAC7C,UAAU,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAAA;IAC3C,WAAW,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAAA;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,MAAM,WAAW,YAAa,SAAQ,SA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AW,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;IAG5B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;CAC3B"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * This Source Code is subject to the terms of the Mozilla Public
3
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
4
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
+ *
6
+ * Copyright (c) Infonomic Company Limited
7
+ */
8
+ // Type guards for runtime checking
9
+ export function isFileStore(fieldValue) {
10
+ return fieldValue.field_type === 'file' || fieldValue.field_type === 'image';
11
+ }
12
+ export function isRelationStore(fieldValue) {
13
+ return fieldValue.field_type === 'relation';
14
+ }
15
+ export function isJsonStore(fieldValue) {
16
+ return fieldValue.field_type === 'json' || fieldValue.field_type === 'object';
17
+ }
18
+ export function isNumericStore(fieldValue) {
19
+ return ['float', 'integer', 'decimal'].includes(fieldValue.field_type);
20
+ }
21
+ export function isDateTimeStore(fieldValue) {
22
+ return ['datetime', 'date', 'time'].includes(fieldValue.field_type);
23
+ }
24
+ //# sourceMappingURL=store-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store-types.js","sourceRoot":"","sources":["../../src/@types/store-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAqGH,mCAAmC;AACnC,MAAM,UAAU,WAAW,CAAC,UAA0B;IACpD,OAAO,UAAU,CAAC,UAAU,KAAK,MAAM,IAAI,UAAU,CAAC,UAAU,KAAK,OAAO,CAAA;AAC9E,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,UAA0B;IACxD,OAAO,UAAU,CAAC,UAAU,KAAK,UAAU,CAAA;AAC7C,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,UAA0B;IACpD,OAAO,UAAU,CAAC,UAAU,KAAK,MAAM,IAAI,UAAU,CAAC,UAAU,KAAK,QAAQ,CAAA;AAC/E,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,UAA0B;IACvD,OAAO,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,CAAA;AACxE,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,UAA0B;IACxD,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,CAAA;AACrE,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * This Source Code is subject to the terms of the Mozilla Public
3
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
4
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
+ *
6
+ * Copyright (c) Infonomic Company Limited
7
+ */
8
+ export type MaybePromise<T> = T | Promise<T>;
9
+ export type NonEmptyArray<T> = [T, ...T[]];
10
+ export type Prettify<T> = {
11
+ [K in keyof T]: T[K];
12
+ } & {};
13
+ export type DeepMutable<T> = T extends ReadonlyArray<infer U> ? Array<DeepMutable<U>> : T extends object ? {
14
+ -readonly [K in keyof T]: DeepMutable<T[K]>;
15
+ } : T;
16
+ export type ValueUnion<T extends Record<string, any>> = T[keyof T];
17
+ //# sourceMappingURL=type-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-utils.d.ts","sourceRoot":"","sources":["../../src/@types/type-utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;AAG5C,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAA;AAG1C,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI;KACvB,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACrB,GAAG,EAAE,CAAA;AAGN,MAAM,MAAM,WAAW,CAAC,CAAC,IACvB,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAC5B,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GACrB,CAAC,SAAS,MAAM,GACd;IAAE,CAAC,UAAU,CAAC,IAAI,MAAM,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GAC/C,CAAC,CAAA;AAKT,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This Source Code is subject to the terms of the Mozilla Public
3
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
4
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
+ *
6
+ * Copyright (c) Infonomic Company Limited
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=type-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-utils.js","sourceRoot":"","sources":["../../src/@types/type-utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * This Source Code is subject to the terms of the Mozilla Public
3
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
4
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
+ *
6
+ * Copyright (c) Infonomic Company Limited
7
+ */
8
+ import type { RequestContext } from '@byline/auth';
9
+ import type { CollectionDefinition } from '../@types/collection-types.js';
10
+ import type { ReadContext } from '../@types/db-types.js';
11
+ import type { QueryPredicate } from '../@types/query-predicate.js';
12
+ /**
13
+ * Resolve the per-collection `beforeRead` hook predicate for the current
14
+ * request, with caching across populate fanout.
15
+ *
16
+ * Behaviour:
17
+ * - Cache hit on `readContext.beforeReadCache` (keyed by collection
18
+ * path) returns the cached value immediately. The actor is invariant
19
+ * for the lifetime of one `ReadContext`, so a single key per
20
+ * collection is sufficient.
21
+ * - Each configured hook function runs in declaration order. Predicates
22
+ * returned by multiple hooks are combined with implicit AND. Hooks
23
+ * that return `void` / `undefined` are skipped.
24
+ * - The result is stored in the cache (including `null` for "ran with
25
+ * no scoping") so subsequent batches in the same request reuse it.
26
+ *
27
+ * Returns `null` when no hook is configured, or every hook returned
28
+ * void. Callers (`CollectionHandle`, `populateDocuments`) treat `null`
29
+ * the same as "no scoping" — they pass nothing extra to the adapter.
30
+ */
31
+ export declare function applyBeforeRead(params: {
32
+ definition: CollectionDefinition;
33
+ requestContext: RequestContext;
34
+ readContext: ReadContext;
35
+ }): Promise<QueryPredicate | null>;
36
+ //# sourceMappingURL=apply-before-read.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply-before-read.d.ts","sourceRoot":"","sources":["../../src/auth/apply-before-read.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAElD,OAAO,KAAK,EAGV,oBAAoB,EACrB,MAAM,+BAA+B,CAAA;AACtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAElE;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,eAAe,CAAC,MAAM,EAAE;IAC5C,UAAU,EAAE,oBAAoB,CAAA;IAChC,cAAc,EAAE,cAAc,CAAA;IAC9B,WAAW,EAAE,WAAW,CAAA;CACzB,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAqCjC"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * This Source Code is subject to the terms of the Mozilla Public
3
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
4
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
+ *
6
+ * Copyright (c) Infonomic Company Limited
7
+ */
8
+ /**
9
+ * Resolve the per-collection `beforeRead` hook predicate for the current
10
+ * request, with caching across populate fanout.
11
+ *
12
+ * Behaviour:
13
+ * - Cache hit on `readContext.beforeReadCache` (keyed by collection
14
+ * path) returns the cached value immediately. The actor is invariant
15
+ * for the lifetime of one `ReadContext`, so a single key per
16
+ * collection is sufficient.
17
+ * - Each configured hook function runs in declaration order. Predicates
18
+ * returned by multiple hooks are combined with implicit AND. Hooks
19
+ * that return `void` / `undefined` are skipped.
20
+ * - The result is stored in the cache (including `null` for "ran with
21
+ * no scoping") so subsequent batches in the same request reuse it.
22
+ *
23
+ * Returns `null` when no hook is configured, or every hook returned
24
+ * void. Callers (`CollectionHandle`, `populateDocuments`) treat `null`
25
+ * the same as "no scoping" — they pass nothing extra to the adapter.
26
+ */
27
+ export async function applyBeforeRead(params) {
28
+ const { definition, requestContext, readContext } = params;
29
+ const collectionPath = definition.path;
30
+ if (readContext.beforeReadCache.has(collectionPath)) {
31
+ return readContext.beforeReadCache.get(collectionPath) ?? null;
32
+ }
33
+ const hooks = normalizeBeforeReadHook(definition.hooks?.beforeRead);
34
+ if (hooks.length === 0) {
35
+ readContext.beforeReadCache.set(collectionPath, null);
36
+ return null;
37
+ }
38
+ const predicates = [];
39
+ for (const hook of hooks) {
40
+ const result = await hook({
41
+ collectionPath,
42
+ requestContext,
43
+ readContext,
44
+ });
45
+ if (result != null) {
46
+ predicates.push(result);
47
+ }
48
+ }
49
+ let combined;
50
+ if (predicates.length === 0) {
51
+ combined = null;
52
+ }
53
+ else if (predicates.length === 1) {
54
+ combined = predicates[0];
55
+ }
56
+ else {
57
+ combined = { $and: predicates };
58
+ }
59
+ readContext.beforeReadCache.set(collectionPath, combined);
60
+ return combined;
61
+ }
62
+ /** Normalise a `beforeRead` slot (single function or array) into a flat array. */
63
+ function normalizeBeforeReadHook(slot) {
64
+ if (!slot)
65
+ return [];
66
+ return Array.isArray(slot) ? slot : [slot];
67
+ }
68
+ //# sourceMappingURL=apply-before-read.js.map
@@ -0,0 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,CAAC;SAAM,CAAC;QACN,QAAQ,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,CAAA;IACjC,CAAC;IAED,WAAW,CAAC,eAAe,CAAC,GAAG,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAA;IACzD,OAAO,QAAQ,CAAA;AACjB,CAAC;AAED,kFAAkF;AAClF,SAAS,uBAAuB,CAAC,IAAoC;IACnE,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,CAAA;IACpB,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;AAC5C,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This Source Code is subject to the terms of the Mozilla Public
3
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
4
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
+ *
6
+ * Copyright (c) Infonomic Company Limited
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=apply-before-read.test.node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply-before-read.test.node.d.ts","sourceRoot":"","sources":["../../src/auth/apply-before-read.test.node.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -0,0 +1,144 @@
1
+ /**
2
+ * This Source Code is subject to the terms of the Mozilla Public
3
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
4
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
+ *
6
+ * Copyright (c) Infonomic Company Limited
7
+ */
8
+ import { createRequestContext } from '@byline/auth';
9
+ import { describe, expect, it } from 'vitest';
10
+ import { defineCollection, defineWorkflow, } from '../@types/collection-types.js';
11
+ import { createReadContext } from '../services/populate.js';
12
+ import { applyBeforeRead } from './apply-before-read.js';
13
+ const baseCollection = (hook) => defineCollection({
14
+ path: 'posts',
15
+ labels: { singular: 'Post', plural: 'Posts' },
16
+ workflow: defineWorkflow({
17
+ draft: { label: 'Draft', verb: 'Revert to Draft' },
18
+ published: { label: 'Published', verb: 'Publish' },
19
+ }),
20
+ fields: [{ name: 'title', type: 'text', label: 'Title' }],
21
+ ...(hook ? { hooks: { beforeRead: hook } } : {}),
22
+ });
23
+ describe('applyBeforeRead', () => {
24
+ it('returns null when the collection has no beforeRead hook', async () => {
25
+ const result = await applyBeforeRead({
26
+ definition: baseCollection(),
27
+ requestContext: createRequestContext(),
28
+ readContext: createReadContext(),
29
+ });
30
+ expect(result).toBeNull();
31
+ });
32
+ it('returns the predicate from a single hook', async () => {
33
+ const hook = () => ({ status: 'published' });
34
+ const result = await applyBeforeRead({
35
+ definition: baseCollection(hook),
36
+ requestContext: createRequestContext(),
37
+ readContext: createReadContext(),
38
+ });
39
+ expect(result).toEqual({ status: 'published' });
40
+ });
41
+ it('returns null when the hook returns void', async () => {
42
+ const hook = () => undefined;
43
+ const result = await applyBeforeRead({
44
+ definition: baseCollection(hook),
45
+ requestContext: createRequestContext(),
46
+ readContext: createReadContext(),
47
+ });
48
+ expect(result).toBeNull();
49
+ });
50
+ it('combines multiple hook predicates with implicit AND', async () => {
51
+ const a = () => ({ tenantId: 't-1' });
52
+ const b = () => ({ status: 'published' });
53
+ const result = await applyBeforeRead({
54
+ definition: baseCollection([a, b]),
55
+ requestContext: createRequestContext(),
56
+ readContext: createReadContext(),
57
+ });
58
+ expect(result).toEqual({
59
+ $and: [{ tenantId: 't-1' }, { status: 'published' }],
60
+ });
61
+ });
62
+ it('skips void-returning hooks when combining', async () => {
63
+ const a = () => ({ tenantId: 't-1' });
64
+ const b = () => undefined;
65
+ const c = () => ({ status: 'published' });
66
+ const result = await applyBeforeRead({
67
+ definition: baseCollection([a, b, c]),
68
+ requestContext: createRequestContext(),
69
+ readContext: createReadContext(),
70
+ });
71
+ expect(result).toEqual({
72
+ $and: [{ tenantId: 't-1' }, { status: 'published' }],
73
+ });
74
+ });
75
+ it('caches the predicate on ReadContext (hook runs once per request)', async () => {
76
+ let callCount = 0;
77
+ const hook = () => {
78
+ callCount += 1;
79
+ return { tenantId: 't-1' };
80
+ };
81
+ const def = baseCollection(hook);
82
+ const readContext = createReadContext();
83
+ const requestContext = createRequestContext();
84
+ await applyBeforeRead({ definition: def, requestContext, readContext });
85
+ await applyBeforeRead({ definition: def, requestContext, readContext });
86
+ await applyBeforeRead({ definition: def, requestContext, readContext });
87
+ expect(callCount).toBe(1);
88
+ });
89
+ it('caches a void result so subsequent calls do not re-run the hook', async () => {
90
+ let callCount = 0;
91
+ const hook = () => {
92
+ callCount += 1;
93
+ return undefined;
94
+ };
95
+ const def = baseCollection(hook);
96
+ const readContext = createReadContext();
97
+ const requestContext = createRequestContext();
98
+ const first = await applyBeforeRead({ definition: def, requestContext, readContext });
99
+ const second = await applyBeforeRead({ definition: def, requestContext, readContext });
100
+ expect(first).toBeNull();
101
+ expect(second).toBeNull();
102
+ expect(callCount).toBe(1);
103
+ });
104
+ it('runs the hook again on a fresh ReadContext', async () => {
105
+ let callCount = 0;
106
+ const hook = () => {
107
+ callCount += 1;
108
+ return { tenantId: 't-1' };
109
+ };
110
+ const def = baseCollection(hook);
111
+ const requestContext = createRequestContext();
112
+ await applyBeforeRead({ definition: def, requestContext, readContext: createReadContext() });
113
+ await applyBeforeRead({ definition: def, requestContext, readContext: createReadContext() });
114
+ expect(callCount).toBe(2);
115
+ });
116
+ it('passes collectionPath, requestContext, and readContext through to the hook', async () => {
117
+ let received;
118
+ const hook = (ctx) => {
119
+ received = ctx;
120
+ };
121
+ const def = baseCollection(hook);
122
+ const requestContext = createRequestContext();
123
+ const readContext = createReadContext();
124
+ await applyBeforeRead({ definition: def, requestContext, readContext });
125
+ expect(received).toMatchObject({
126
+ collectionPath: 'posts',
127
+ requestContext,
128
+ readContext,
129
+ });
130
+ });
131
+ it('supports an async hook', async () => {
132
+ const hook = async () => {
133
+ await Promise.resolve();
134
+ return { tenantId: 't-1' };
135
+ };
136
+ const result = await applyBeforeRead({
137
+ definition: baseCollection(hook),
138
+ requestContext: createRequestContext(),
139
+ readContext: createReadContext(),
140
+ });
141
+ expect(result).toEqual({ tenantId: 't-1' });
142
+ });
143
+ });
144
+ //# sourceMappingURL=apply-before-read.test.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply-before-read.test.node.js","sourceRoot":"","sources":["../../src/auth/apply-before-read.test.node.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAE7C,OAAO,EAGL,gBAAgB,EAChB,cAAc,GACf,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAExD,MAAM,cAAc,GAAG,CAAC,IAA4C,EAAwB,EAAE,CAC5F,gBAAgB,CAAC;IACf,IAAI,EAAE,OAAO;IACb,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE;IAC7C,QAAQ,EAAE,cAAc,CAAC;QACvB,KAAK,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE;QAClD,SAAS,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE;KACnD,CAAC;IACF,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;IACzD,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;CACjD,CAAC,CAAA;AAEJ,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,EAAE,CAAC,yDAAyD,EAAE,KAAK,IAAI,EAA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YACd,WAAW;SACZ,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,wBAAwB,EAAE,KAAK,IAAI,EAAE;QACtC,MAAM,IAAI,GAAqB,KAAK,IAAI,EAAE;YACxC,MAAM,OAAO,CAAC,OAAO,EAAE,CAAA;YACvB,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAA;QAC5B,CAAC,CAAA;QACD,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC;YACnC,UAAU,EAAE,cAAc,CAAC,IAAI,CAAC;YAChC,cAAc,EAAE,oBAAoB,EAAE;YACtC,WAAW,EAAE,iBAAiB,EAAE;SACjC,CAAC,CAAA;QACF,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAA;IAC7C,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * This Source Code is subject to the terms of the Mozilla Public
3
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
4
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
+ *
6
+ * Copyright (c) Infonomic Company Limited
7
+ */
8
+ import { type RequestContext } from '@byline/auth';
9
+ import { type CollectionAbilityVerb } from './register-collection-abilities.js';
10
+ /**
11
+ * Central enforcement helper. Called from the service layer — at the top
12
+ * of each `document-lifecycle` function and at the top of each
13
+ * `@byline/client.CollectionHandle` read method — before any DB work.
14
+ *
15
+ * Policy, in order:
16
+ *
17
+ * 1. **No `RequestContext`** → `ERR_UNAUTHENTICATED`. Every enforced
18
+ * call site must supply a context. Tests, seeds, and migration
19
+ * scripts pass `createSuperAdminContext()` from `@byline/auth` for
20
+ * this.
21
+ *
22
+ * 2. **`actor === null` (public / anonymous reader)**:
23
+ * - Only permitted on `verb === 'read'`.
24
+ * - Only when `readMode === 'published'` (the `@byline/client`
25
+ * default for unauthenticated consumers).
26
+ * - Any other combination → `ERR_UNAUTHENTICATED`.
27
+ *
28
+ * 3. **Actor present** → `actor.assertAbility('collections.<path>.<verb>')`.
29
+ * `AdminAuth` with `isSuperAdmin: true` short-circuits the check
30
+ * internally; any other actor must hold the specific ability.
31
+ *
32
+ * Direct adapter calls (`db.commands.*` / `db.queries.*`) intentionally
33
+ * bypass this helper — the same escape hatch that skips collection
34
+ * hooks. Seeds, migrations, and internal tooling live there.
35
+ *
36
+ * See docs/analysis/AUTHN-AUTHZ-ANALYSIS.md §8.
37
+ */
38
+ export declare function assertActorCanPerform(context: RequestContext | undefined, collectionPath: string, verb: CollectionAbilityVerb): void;
39
+ //# sourceMappingURL=assert-actor-can-perform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assert-actor-can-perform.d.ts","sourceRoot":"","sources":["../../src/auth/assert-actor-can-perform.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,cAAc,CAAA;AAEvE,OAAO,EACL,KAAK,qBAAqB,EAE3B,MAAM,oCAAoC,CAAA;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,cAAc,GAAG,SAAS,EACnC,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,qBAAqB,GAC1B,IAAI,CA8BN"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * This Source Code is subject to the terms of the Mozilla Public
3
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
4
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
+ *
6
+ * Copyright (c) Infonomic Company Limited
7
+ */
8
+ import { ERR_UNAUTHENTICATED } from '@byline/auth';
9
+ import { collectionAbilityKey, } from './register-collection-abilities.js';
10
+ /**
11
+ * Central enforcement helper. Called from the service layer — at the top
12
+ * of each `document-lifecycle` function and at the top of each
13
+ * `@byline/client.CollectionHandle` read method — before any DB work.
14
+ *
15
+ * Policy, in order:
16
+ *
17
+ * 1. **No `RequestContext`** → `ERR_UNAUTHENTICATED`. Every enforced
18
+ * call site must supply a context. Tests, seeds, and migration
19
+ * scripts pass `createSuperAdminContext()` from `@byline/auth` for
20
+ * this.
21
+ *
22
+ * 2. **`actor === null` (public / anonymous reader)**:
23
+ * - Only permitted on `verb === 'read'`.
24
+ * - Only when `readMode === 'published'` (the `@byline/client`
25
+ * default for unauthenticated consumers).
26
+ * - Any other combination → `ERR_UNAUTHENTICATED`.
27
+ *
28
+ * 3. **Actor present** → `actor.assertAbility('collections.<path>.<verb>')`.
29
+ * `AdminAuth` with `isSuperAdmin: true` short-circuits the check
30
+ * internally; any other actor must hold the specific ability.
31
+ *
32
+ * Direct adapter calls (`db.commands.*` / `db.queries.*`) intentionally
33
+ * bypass this helper — the same escape hatch that skips collection
34
+ * hooks. Seeds, migrations, and internal tooling live there.
35
+ *
36
+ * See docs/analysis/AUTHN-AUTHZ-ANALYSIS.md §8.
37
+ */
38
+ export function assertActorCanPerform(context, collectionPath, verb) {
39
+ if (!context) {
40
+ throw ERR_UNAUTHENTICATED({
41
+ message: `missing requestContext on ${verb} '${collectionPath}'. Pass createSuperAdminContext() ` +
42
+ `from @byline/auth for scripts/tests, or construct a request-scoped context from your ` +
43
+ `session provider in the admin webapp.`,
44
+ });
45
+ }
46
+ const { actor, readMode } = context;
47
+ if (actor == null) {
48
+ if (verb !== 'read') {
49
+ throw ERR_UNAUTHENTICATED({
50
+ message: `anonymous request cannot ${verb} '${collectionPath}': no actor in context`,
51
+ });
52
+ }
53
+ if (readMode !== 'published') {
54
+ throw ERR_UNAUTHENTICATED({
55
+ message: `anonymous read of '${collectionPath}' requires readMode: 'published' ` +
56
+ `(got readMode: ${readMode == null ? '<unset>' : `'${readMode}'`})`,
57
+ });
58
+ }
59
+ // Anonymous read of published content — permitted.
60
+ return;
61
+ }
62
+ actor.assertAbility(collectionAbilityKey(collectionPath, verb));
63
+ }
64
+ //# sourceMappingURL=assert-actor-can-perform.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assert-actor-can-perform.js","sourceRoot":"","sources":["../../src/auth/assert-actor-can-perform.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,mBAAmB,EAAuB,MAAM,cAAc,CAAA;AAEvE,OAAO,EAEL,oBAAoB,GACrB,MAAM,oCAAoC,CAAA;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,qBAAqB,CACnC,OAAmC,EACnC,cAAsB,EACtB,IAA2B;IAE3B,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,mBAAmB,CAAC;YACxB,OAAO,EACL,6BAA6B,IAAI,KAAK,cAAc,oCAAoC;gBACxF,uFAAuF;gBACvF,uCAAuC;SAC1C,CAAC,CAAA;IACJ,CAAC;IAED,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAA;IAEnC,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QAClB,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;YACpB,MAAM,mBAAmB,CAAC;gBACxB,OAAO,EAAE,4BAA4B,IAAI,KAAK,cAAc,wBAAwB;aACrF,CAAC,CAAA;QACJ,CAAC;QACD,IAAI,QAAQ,KAAK,WAAW,EAAE,CAAC;YAC7B,MAAM,mBAAmB,CAAC;gBACxB,OAAO,EACL,sBAAsB,cAAc,mCAAmC;oBACvE,kBAAkB,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,QAAQ,GAAG,GAAG;aACtE,CAAC,CAAA;QACJ,CAAC;QACD,mDAAmD;QACnD,OAAM;IACR,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,oBAAoB,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC,CAAA;AACjE,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This Source Code is subject to the terms of the Mozilla Public
3
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
4
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
+ *
6
+ * Copyright (c) Infonomic Company Limited
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=assert-actor-can-perform.test.node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assert-actor-can-perform.test.node.d.ts","sourceRoot":"","sources":["../../src/auth/assert-actor-can-perform.test.node.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}