@byline/db-postgres 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 (99) hide show
  1. package/LICENSE +373 -0
  2. package/README.md +18 -0
  3. package/dist/database/schema/auth.d.ts +857 -0
  4. package/dist/database/schema/auth.d.ts.map +1 -0
  5. package/dist/database/schema/auth.js +176 -0
  6. package/dist/database/schema/auth.js.map +1 -0
  7. package/dist/database/schema/index.d.ts +2955 -0
  8. package/dist/database/schema/index.d.ts.map +1 -0
  9. package/dist/database/schema/index.js +500 -0
  10. package/dist/database/schema/index.js.map +1 -0
  11. package/dist/index.d.ts +31 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +30 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/lib/test-helper.d.ts +17 -0
  16. package/dist/lib/test-helper.d.ts.map +1 -0
  17. package/dist/lib/test-helper.js +47 -0
  18. package/dist/lib/test-helper.js.map +1 -0
  19. package/dist/modules/admin/admin-permissions-repository.d.ts +17 -0
  20. package/dist/modules/admin/admin-permissions-repository.d.ts.map +1 -0
  21. package/dist/modules/admin/admin-permissions-repository.js +76 -0
  22. package/dist/modules/admin/admin-permissions-repository.js.map +1 -0
  23. package/dist/modules/admin/admin-roles-repository.d.ts +12 -0
  24. package/dist/modules/admin/admin-roles-repository.d.ts.map +1 -0
  25. package/dist/modules/admin/admin-roles-repository.js +168 -0
  26. package/dist/modules/admin/admin-roles-repository.js.map +1 -0
  27. package/dist/modules/admin/admin-store.d.ts +20 -0
  28. package/dist/modules/admin/admin-store.d.ts.map +1 -0
  29. package/dist/modules/admin/admin-store.js +28 -0
  30. package/dist/modules/admin/admin-store.js.map +1 -0
  31. package/dist/modules/admin/admin-users-repository.d.ts +12 -0
  32. package/dist/modules/admin/admin-users-repository.d.ts.map +1 -0
  33. package/dist/modules/admin/admin-users-repository.js +208 -0
  34. package/dist/modules/admin/admin-users-repository.js.map +1 -0
  35. package/dist/modules/admin/index.d.ts +27 -0
  36. package/dist/modules/admin/index.d.ts.map +1 -0
  37. package/dist/modules/admin/index.js +27 -0
  38. package/dist/modules/admin/index.js.map +1 -0
  39. package/dist/modules/admin/refresh-tokens-repository.d.ts +16 -0
  40. package/dist/modules/admin/refresh-tokens-repository.d.ts.map +1 -0
  41. package/dist/modules/admin/refresh-tokens-repository.js +132 -0
  42. package/dist/modules/admin/refresh-tokens-repository.js.map +1 -0
  43. package/dist/modules/admin/tests/auth-integration.test.d.ts +9 -0
  44. package/dist/modules/admin/tests/auth-integration.test.d.ts.map +1 -0
  45. package/dist/modules/admin/tests/auth-integration.test.js +392 -0
  46. package/dist/modules/admin/tests/auth-integration.test.js.map +1 -0
  47. package/dist/modules/admin/tests/session-provider.test.d.ts +9 -0
  48. package/dist/modules/admin/tests/session-provider.test.d.ts.map +1 -0
  49. package/dist/modules/admin/tests/session-provider.test.js +370 -0
  50. package/dist/modules/admin/tests/session-provider.test.js.map +1 -0
  51. package/dist/modules/storage/@types.d.ts +116 -0
  52. package/dist/modules/storage/@types.d.ts.map +1 -0
  53. package/dist/modules/storage/@types.js +9 -0
  54. package/dist/modules/storage/@types.js.map +1 -0
  55. package/dist/modules/storage/storage-commands.d.ts +136 -0
  56. package/dist/modules/storage/storage-commands.d.ts.map +1 -0
  57. package/dist/modules/storage/storage-commands.js +272 -0
  58. package/dist/modules/storage/storage-commands.js.map +1 -0
  59. package/dist/modules/storage/storage-flatten.d.ts +19 -0
  60. package/dist/modules/storage/storage-flatten.d.ts.map +1 -0
  61. package/dist/modules/storage/storage-flatten.js +261 -0
  62. package/dist/modules/storage/storage-flatten.js.map +1 -0
  63. package/dist/modules/storage/storage-insert.d.ts +22 -0
  64. package/dist/modules/storage/storage-insert.d.ts.map +1 -0
  65. package/dist/modules/storage/storage-insert.js +115 -0
  66. package/dist/modules/storage/storage-insert.js.map +1 -0
  67. package/dist/modules/storage/storage-queries.d.ts +377 -0
  68. package/dist/modules/storage/storage-queries.d.ts.map +1 -0
  69. package/dist/modules/storage/storage-queries.js +976 -0
  70. package/dist/modules/storage/storage-queries.js.map +1 -0
  71. package/dist/modules/storage/storage-restore.d.ts +19 -0
  72. package/dist/modules/storage/storage-restore.d.ts.map +1 -0
  73. package/dist/modules/storage/storage-restore.js +350 -0
  74. package/dist/modules/storage/storage-restore.js.map +1 -0
  75. package/dist/modules/storage/storage-store-manifest.d.ts +71 -0
  76. package/dist/modules/storage/storage-store-manifest.d.ts.map +1 -0
  77. package/dist/modules/storage/storage-store-manifest.js +294 -0
  78. package/dist/modules/storage/storage-store-manifest.js.map +1 -0
  79. package/dist/modules/storage/storage-utils.d.ts +23 -0
  80. package/dist/modules/storage/storage-utils.d.ts.map +1 -0
  81. package/dist/modules/storage/storage-utils.js +72 -0
  82. package/dist/modules/storage/storage-utils.js.map +1 -0
  83. package/dist/modules/storage/tests/storage-field-types.test.d.ts +9 -0
  84. package/dist/modules/storage/tests/storage-field-types.test.d.ts.map +1 -0
  85. package/dist/modules/storage/tests/storage-field-types.test.js +146 -0
  86. package/dist/modules/storage/tests/storage-field-types.test.js.map +1 -0
  87. package/dist/modules/storage/tests/storage-flatten-reconstruct.test.d.ts +9 -0
  88. package/dist/modules/storage/tests/storage-flatten-reconstruct.test.d.ts.map +1 -0
  89. package/dist/modules/storage/tests/storage-flatten-reconstruct.test.js +327 -0
  90. package/dist/modules/storage/tests/storage-flatten-reconstruct.test.js.map +1 -0
  91. package/dist/modules/storage/tests/storage-store-manifest.test.d.ts +9 -0
  92. package/dist/modules/storage/tests/storage-store-manifest.test.d.ts.map +1 -0
  93. package/dist/modules/storage/tests/storage-store-manifest.test.js +141 -0
  94. package/dist/modules/storage/tests/storage-store-manifest.test.js.map +1 -0
  95. package/dist/modules/storage/tests/storage-versioning.test.d.ts +9 -0
  96. package/dist/modules/storage/tests/storage-versioning.test.d.ts.map +1 -0
  97. package/dist/modules/storage/tests/storage-versioning.test.js +336 -0
  98. package/dist/modules/storage/tests/storage-versioning.test.js.map +1 -0
  99. package/package.json +81 -0
@@ -0,0 +1,294 @@
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
+ * Generated UNION ALL column projections for the EAV store tables.
9
+ *
10
+ * Instead of maintaining 7 hand-synchronized SQL fragments with 41
11
+ * positional columns each, we define a single column manifest and
12
+ * generate the SELECT list for each store table from it. Adding a
13
+ * column or a new store table is a one-line change in the manifest.
14
+ *
15
+ * The adapter-agnostic pieces (`StoreType`, `ALL_STORE_TYPES`,
16
+ * `fieldTypeToStore`, `fieldTypeToStoreType`) live in `@byline/core`
17
+ * so `@byline/client` can consume the same mapping without taking a
18
+ * dependency on this Postgres adapter.
19
+ */
20
+ import { ALL_STORE_TYPES } from '@byline/core';
21
+ import { sql } from 'drizzle-orm';
22
+ // Re-export for adapter-internal consumers.
23
+ export { ALL_STORE_TYPES, fieldTypeToStore, fieldTypeToStoreType, } from '@byline/core';
24
+ /** Short-form alias used by adapter-internal call sites. */
25
+ export const allStoreTypes = ALL_STORE_TYPES;
26
+ /** Store table names in Postgres, keyed by StoreType. */
27
+ export const storeTableNames = {
28
+ text: 'byline_store_text',
29
+ numeric: 'byline_store_numeric',
30
+ boolean: 'byline_store_boolean',
31
+ datetime: 'byline_store_datetime',
32
+ json: 'byline_store_json',
33
+ relation: 'byline_store_relation',
34
+ file: 'byline_store_file',
35
+ };
36
+ /** The field_type literal emitted for each store table in the UNION ALL. */
37
+ const fieldTypeLiterals = {
38
+ text: 'text',
39
+ numeric: 'numeric',
40
+ boolean: 'boolean',
41
+ datetime: 'datetime',
42
+ json: 'richText',
43
+ relation: 'relation',
44
+ file: 'file',
45
+ };
46
+ /**
47
+ * Canonical column order for the unified UNION ALL output.
48
+ *
49
+ * The first 8 columns are shared across all store tables (base columns).
50
+ * The remaining columns are type-specific — each one declares which store
51
+ * table(s) provide it and what SQL expression to use.
52
+ */
53
+ const columns = [
54
+ // -- Base columns (provided by every store table) -------------------------
55
+ { name: 'id', nullCast: 'uuid' },
56
+ { name: 'document_version_id', nullCast: 'uuid' },
57
+ { name: 'collection_id', nullCast: 'uuid' },
58
+ // field_type is handled specially — see buildSelectList()
59
+ { name: 'field_path', nullCast: 'varchar' },
60
+ { name: 'field_name', nullCast: 'varchar' },
61
+ { name: 'locale', nullCast: 'varchar' },
62
+ { name: 'parent_path', nullCast: 'varchar' },
63
+ // -- Text -----------------------------------------------------------------
64
+ {
65
+ name: 'text_value',
66
+ nullCast: 'text',
67
+ sources: { text: 'value' },
68
+ },
69
+ // -- Boolean --------------------------------------------------------------
70
+ {
71
+ name: 'boolean_value',
72
+ nullCast: 'boolean',
73
+ sources: { boolean: 'value' },
74
+ },
75
+ // -- JSON -----------------------------------------------------------------
76
+ {
77
+ name: 'json_value',
78
+ nullCast: 'jsonb',
79
+ sources: { json: 'value' },
80
+ },
81
+ // -- DateTime -------------------------------------------------------------
82
+ {
83
+ name: 'date_type',
84
+ nullCast: 'varchar',
85
+ sources: { datetime: 'date_type' },
86
+ },
87
+ {
88
+ name: 'value_date',
89
+ nullCast: 'date',
90
+ sources: { datetime: 'value_date' },
91
+ },
92
+ {
93
+ name: 'value_time',
94
+ nullCast: 'time',
95
+ sources: { datetime: 'value_time' },
96
+ },
97
+ {
98
+ name: 'value_timestamp_tz',
99
+ nullCast: 'timestamp',
100
+ sources: { datetime: 'value_timestamp_tz' },
101
+ },
102
+ // -- File -----------------------------------------------------------------
103
+ {
104
+ name: 'file_id',
105
+ nullCast: 'uuid',
106
+ sources: { file: 'file_id' },
107
+ },
108
+ {
109
+ name: 'filename',
110
+ nullCast: 'varchar',
111
+ sources: { file: 'filename' },
112
+ },
113
+ {
114
+ name: 'original_filename',
115
+ nullCast: 'varchar',
116
+ sources: { file: 'original_filename' },
117
+ },
118
+ {
119
+ name: 'mime_type',
120
+ nullCast: 'varchar',
121
+ sources: { file: 'mime_type' },
122
+ },
123
+ {
124
+ name: 'file_size',
125
+ nullCast: 'bigint',
126
+ sources: { file: 'file_size' },
127
+ },
128
+ {
129
+ name: 'storage_provider',
130
+ nullCast: 'varchar',
131
+ sources: { file: 'storage_provider' },
132
+ },
133
+ {
134
+ name: 'storage_path',
135
+ nullCast: 'text',
136
+ sources: { file: 'storage_path' },
137
+ },
138
+ {
139
+ name: 'storage_url',
140
+ nullCast: 'text',
141
+ sources: { file: 'storage_url' },
142
+ },
143
+ {
144
+ name: 'file_hash',
145
+ nullCast: 'varchar',
146
+ sources: { file: 'file_hash' },
147
+ },
148
+ {
149
+ name: 'image_width',
150
+ nullCast: 'integer',
151
+ sources: { file: 'image_width' },
152
+ },
153
+ {
154
+ name: 'image_height',
155
+ nullCast: 'integer',
156
+ sources: { file: 'image_height' },
157
+ },
158
+ {
159
+ name: 'image_format',
160
+ nullCast: 'varchar',
161
+ sources: { file: 'image_format' },
162
+ },
163
+ {
164
+ name: 'processing_status',
165
+ nullCast: 'varchar',
166
+ sources: { file: 'processing_status' },
167
+ },
168
+ {
169
+ name: 'thumbnail_generated',
170
+ nullCast: 'boolean',
171
+ sources: { file: 'thumbnail_generated' },
172
+ },
173
+ {
174
+ name: 'variants',
175
+ nullCast: 'jsonb',
176
+ sources: { file: 'variants' },
177
+ },
178
+ // -- Relation -------------------------------------------------------------
179
+ {
180
+ name: 'target_document_id',
181
+ nullCast: 'uuid',
182
+ sources: { relation: 'target_document_id' },
183
+ },
184
+ {
185
+ name: 'target_collection_id',
186
+ nullCast: 'uuid',
187
+ sources: { relation: 'target_collection_id' },
188
+ },
189
+ {
190
+ name: 'relationship_type',
191
+ nullCast: 'varchar',
192
+ sources: { relation: 'relationship_type' },
193
+ },
194
+ {
195
+ name: 'cascade_delete',
196
+ nullCast: 'boolean',
197
+ sources: { relation: 'cascade_delete' },
198
+ },
199
+ // -- JSON extras ----------------------------------------------------------
200
+ {
201
+ name: 'json_schema',
202
+ nullCast: 'varchar',
203
+ sources: { json: 'json_schema' },
204
+ },
205
+ {
206
+ name: 'object_keys',
207
+ nullCast: 'text[]',
208
+ sources: { json: 'object_keys' },
209
+ },
210
+ // -- Numeric --------------------------------------------------------------
211
+ {
212
+ name: 'number_type',
213
+ nullCast: 'varchar',
214
+ sources: { numeric: 'number_type' },
215
+ },
216
+ {
217
+ name: 'value_integer',
218
+ nullCast: 'integer',
219
+ sources: { numeric: 'value_integer' },
220
+ },
221
+ {
222
+ name: 'value_decimal',
223
+ nullCast: 'decimal',
224
+ sources: { numeric: 'value_decimal' },
225
+ },
226
+ {
227
+ name: 'value_float',
228
+ nullCast: 'real',
229
+ sources: { numeric: 'value_float' },
230
+ },
231
+ ];
232
+ // ---------------------------------------------------------------------------
233
+ // SQL generation
234
+ // ---------------------------------------------------------------------------
235
+ /** Number of columns in the unified output (base + field_type + type-specific). */
236
+ export const UNIFIED_COLUMN_COUNT = columns.length + 1; // +1 for field_type
237
+ /**
238
+ * Build the SELECT column list for a given store table type.
239
+ *
240
+ * Base columns (id, document_version_id, etc.) are passed through directly.
241
+ * The `field_type` column is emitted as a string literal.
242
+ * Type-specific columns are either mapped to the source expression or
243
+ * emitted as `NULL::cast`.
244
+ */
245
+ function buildSelectList(storeType) {
246
+ const parts = [];
247
+ for (const col of columns) {
248
+ // Base columns (no sources) are always passed through from the table.
249
+ if (!col.sources) {
250
+ parts.push(col.name);
251
+ continue;
252
+ }
253
+ const sourceExpr = col.sources[storeType];
254
+ if (sourceExpr) {
255
+ // This store provides this column — use the source expression.
256
+ // If the source column name differs from the output alias, add AS.
257
+ if (sourceExpr === col.name) {
258
+ parts.push(col.name);
259
+ }
260
+ else {
261
+ parts.push(`${sourceExpr} as "${col.name}"`);
262
+ }
263
+ }
264
+ else {
265
+ // This store doesn't provide this column — emit typed NULL.
266
+ parts.push(`NULL::${col.nullCast} as "${col.name}"`);
267
+ }
268
+ }
269
+ // Insert field_type after the base columns. The base columns are the first
270
+ // 7 entries (id through parent_path). field_type goes at position 3
271
+ // (after collection_id, before field_path) to match the original layout.
272
+ const fieldTypeLiteral = `'${fieldTypeLiterals[storeType]}' as "field_type"`;
273
+ parts.splice(3, 0, fieldTypeLiteral);
274
+ return parts.join(',\n ');
275
+ }
276
+ // Pre-generate SQL fragments for each store type.
277
+ const selectListCache = new Map();
278
+ /**
279
+ * Get the Drizzle SQL fragment for a store type's SELECT list.
280
+ * Results are cached — the generation runs once at module load.
281
+ */
282
+ export function storeSelectList(storeType) {
283
+ let cached = selectListCache.get(storeType);
284
+ if (!cached) {
285
+ cached = sql.raw(buildSelectList(storeType));
286
+ selectListCache.set(storeType, cached);
287
+ }
288
+ return cached;
289
+ }
290
+ // ---------------------------------------------------------------------------
291
+ // Exported for testing
292
+ // ---------------------------------------------------------------------------
293
+ export { buildSelectList, columns, fieldTypeLiterals };
294
+ //# sourceMappingURL=storage-store-manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-store-manifest.js","sourceRoot":"","sources":["../../../src/modules/storage/storage-store-manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,eAAe,EAAkB,MAAM,cAAc,CAAA;AAC9D,OAAO,EAAY,GAAG,EAAE,MAAM,aAAa,CAAA;AAE3C,4CAA4C;AAC5C,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,oBAAoB,GAErB,MAAM,cAAc,CAAA;AAErB,4DAA4D;AAC5D,MAAM,CAAC,MAAM,aAAa,GAAG,eAAe,CAAA;AAwB5C,yDAAyD;AACzD,MAAM,CAAC,MAAM,eAAe,GAA8B;IACxD,IAAI,EAAE,mBAAmB;IACzB,OAAO,EAAE,sBAAsB;IAC/B,OAAO,EAAE,sBAAsB;IAC/B,QAAQ,EAAE,uBAAuB;IACjC,IAAI,EAAE,mBAAmB;IACzB,QAAQ,EAAE,uBAAuB;IACjC,IAAI,EAAE,mBAAmB;CAC1B,CAAA;AAED,4EAA4E;AAC5E,MAAM,iBAAiB,GA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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 { FieldSet } from '@byline/core';
9
+ import { type StoreType } from './storage-store-manifest.js';
10
+ /**
11
+ * Given a CollectionDefinition and a list of field names, determine which
12
+ * StoreTypes are needed to satisfy the query. This enables selective field
13
+ * loading — instead of a 7-table UNION ALL, we query only the relevant stores.
14
+ *
15
+ * Field names that don't match a collection field (e.g. 'status', 'updated_at')
16
+ * are silently ignored — they come from the document version row, not EAV stores.
17
+ *
18
+ * Structure fields (array, blocks) recursively include all their children's
19
+ * store types plus 'meta' for _id/_type tracking.
20
+ */
21
+ export declare function resolveStoreTypes(fields: FieldSet, fieldNames: string[]): Set<StoreType>;
22
+ export declare const getFirstOrThrow: <T>(message: string) => (values: T[]) => T;
23
+ //# sourceMappingURL=storage-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-utils.d.ts","sourceRoot":"","sources":["../../../src/modules/storage/storage-utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAS,QAAQ,EAAc,MAAM,cAAc,CAAA;AAG/D,OAAO,EAAwB,KAAK,SAAS,EAAE,MAAM,6BAA6B,CAAA;AAMlF;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,SAAS,CAAC,CAUxF;AAkCD,eAAO,MAAM,eAAe,GACzB,CAAC,EAAE,SAAS,MAAM,MAClB,QAAQ,CAAC,EAAE,KAAG,CAMd,CAAA"}
@@ -0,0 +1,72 @@
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_DATABASE, getLogger } from '@byline/core';
9
+ import { fieldTypeToStoreType } from './storage-store-manifest.js';
10
+ // ------------------------------------------------------------------------------
11
+ // Field name → store type resolution
12
+ // ------------------------------------------------------------------------------
13
+ /**
14
+ * Given a CollectionDefinition and a list of field names, determine which
15
+ * StoreTypes are needed to satisfy the query. This enables selective field
16
+ * loading — instead of a 7-table UNION ALL, we query only the relevant stores.
17
+ *
18
+ * Field names that don't match a collection field (e.g. 'status', 'updated_at')
19
+ * are silently ignored — they come from the document version row, not EAV stores.
20
+ *
21
+ * Structure fields (array, blocks) recursively include all their children's
22
+ * store types plus 'meta' for _id/_type tracking.
23
+ */
24
+ export function resolveStoreTypes(fields, fieldNames) {
25
+ const stores = new Set();
26
+ for (const name of fieldNames) {
27
+ const field = fields.find((f) => f.name === name);
28
+ if (!field)
29
+ continue;
30
+ collectStoreTypes(field, stores);
31
+ }
32
+ return stores;
33
+ }
34
+ function collectStoreTypes(field, stores) {
35
+ const mapped = fieldTypeToStoreType[field.type];
36
+ if (mapped === 'meta') {
37
+ // Structure field — recurse into children and include meta for _id/_type
38
+ if (field.type === 'array') {
39
+ for (const child of field.fields) {
40
+ collectStoreTypes(child, stores);
41
+ }
42
+ }
43
+ else if (field.type === 'blocks') {
44
+ for (const block of field.blocks) {
45
+ for (const child of block.fields) {
46
+ collectStoreTypes(child, stores);
47
+ }
48
+ }
49
+ }
50
+ // Meta rows are fetched separately (not via UNION ALL), so no store type to add
51
+ }
52
+ else if (mapped) {
53
+ stores.add(mapped);
54
+ }
55
+ // undefined (group) or unrecognized — recurse if group
56
+ if (field.type === 'group') {
57
+ for (const child of field.fields) {
58
+ collectStoreTypes(child, stores);
59
+ }
60
+ }
61
+ }
62
+ // ------------------------------------------------------------------------------
63
+ // Misc
64
+ // ------------------------------------------------------------------------------
65
+ export const getFirstOrThrow = (message) => (values) => {
66
+ const value = values[0];
67
+ if (value == null) {
68
+ throw ERR_DATABASE({ message }).log(getLogger());
69
+ }
70
+ return value;
71
+ };
72
+ //# sourceMappingURL=storage-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-utils.js","sourceRoot":"","sources":["../../../src/modules/storage/storage-utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAEtD,OAAO,EAAE,oBAAoB,EAAkB,MAAM,6BAA6B,CAAA;AAElF,iFAAiF;AACjF,qCAAqC;AACrC,iFAAiF;AAEjF;;;;;;;;;;GAUG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAgB,EAAE,UAAoB;IACtE,MAAM,MAAM,GAAG,IAAI,GAAG,EAAa,CAAA;IAEnC,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE,CAAC;QAC9B,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAA;QACjD,IAAI,CAAC,KAAK;YAAE,SAAQ;QACpB,iBAAiB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;IAClC,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAY,EAAE,MAAsB;IAC7D,MAAM,MAAM,GAAG,oBAAoB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IAE/C,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QACtB,yEAAyE;QACzE,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAC3B,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;gBACjC,iBAAiB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;YAClC,CAAC;QACH,CAAC;aAAM,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACnC,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;gBACjC,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;oBACjC,iBAAiB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;gBAClC,CAAC;YACH,CAAC;QACH,CAAC;QACD,gFAAgF;IAClF,CAAC;SAAM,IAAI,MAAM,EAAE,CAAC;QAClB,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;IACpB,CAAC;IACD,uDAAuD;IACvD,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC3B,KAAK,MAAM,KAAK,IAAK,KAAoB,CAAC,MAAM,EAAE,CAAC;YACjD,iBAAiB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;QAClC,CAAC;IACH,CAAC;AACH,CAAC;AAED,iFAAiF;AACjF,OAAO;AACP,iFAAiF;AAEjF,MAAM,CAAC,MAAM,eAAe,GAC1B,CAAI,OAAe,EAAE,EAAE,CACvB,CAAC,MAAW,EAAK,EAAE;IACjB,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAA;IACvB,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QAClB,MAAM,YAAY,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,CAAA;IAClD,CAAC;IACD,OAAO,KAAK,CAAA;AACd,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=storage-field-types.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-field-types.test.d.ts","sourceRoot":"","sources":["../../../../src/modules/storage/tests/storage-field-types.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -0,0 +1,146 @@
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 assert from 'node:assert';
9
+ import { after, before, describe, it } from 'node:test';
10
+ import { v7 as uuidv7 } from 'uuid';
11
+ import { setupTestDB, teardownTestDB } from '../../../lib/test-helper.js';
12
+ // Test database setup
13
+ let commandBuilders;
14
+ let queryBuilders;
15
+ const timestamp = Date.now();
16
+ const FieldTypesCollectionConfig = {
17
+ path: `field-types-${timestamp}`,
18
+ labels: {
19
+ singular: 'FieldTypes',
20
+ plural: 'FieldType',
21
+ },
22
+ fields: [
23
+ { name: 'title', type: 'text', localized: true },
24
+ { name: 'summary', type: 'text', localized: true },
25
+ { name: 'publishedOn', type: 'datetime', optional: true },
26
+ { name: 'views', type: 'integer', optional: true },
27
+ { name: 'price', type: 'decimal', optional: true },
28
+ { name: 'attachment', type: 'file', optional: true },
29
+ ],
30
+ };
31
+ const filedId = uuidv7();
32
+ // Complex test document with many fields and arrays. `path` is a
33
+ // system attribute on `documentVersions`, supplied separately to
34
+ // `createDocumentVersion` — not part of field data.
35
+ const sampleDocument = {
36
+ title: {
37
+ en: 'My First Document',
38
+ es: 'Mi Primer Documento',
39
+ fr: 'Mon Premier Document',
40
+ },
41
+ summary: {
42
+ en: 'This is a sample document for testing purposes.',
43
+ es: 'Este es un documento de muestra para fines de prueba.',
44
+ fr: "Il s'agit d'un document d'exemple à des fins de test.",
45
+ },
46
+ // category: {
47
+ // targetCollectionId: "cat-123",
48
+ // targetDocumentId: "electronics-audio"
49
+ // },
50
+ publishedOn: new Date('2024-01-15T10:00:00'),
51
+ views: 100,
52
+ price: '19.99',
53
+ attachment: {
54
+ fileId: filedId,
55
+ filename: 'sample-attachment.pdf',
56
+ originalFilename: 'sample-document.pdf',
57
+ fileSize: 102400, // 100 KB
58
+ mimeType: 'application/pdf',
59
+ storageProvider: 'local',
60
+ storagePath: 'uploads/attachments/sample-attachment.pdf',
61
+ },
62
+ };
63
+ // Global test variables
64
+ let testCollection = {};
65
+ describe('02 Field Types', () => {
66
+ before(async () => {
67
+ // Connect to test database
68
+ const testDB = setupTestDB([FieldTypesCollectionConfig]);
69
+ commandBuilders = testDB.commandBuilders;
70
+ queryBuilders = testDB.queryBuilders;
71
+ // Create test collection — use config.path so it matches the definition
72
+ const result = await commandBuilders.collections.create(FieldTypesCollectionConfig.path, FieldTypesCollectionConfig);
73
+ const collection = result[0];
74
+ if (collection == null) {
75
+ throw new Error('Failed to create test collection');
76
+ }
77
+ testCollection = { id: collection.id, name: collection.path };
78
+ console.log('Test collection created:', testCollection);
79
+ });
80
+ after(async () => {
81
+ // Clean up test collection (cascades to documents and fields)
82
+ try {
83
+ await commandBuilders.collections.delete(testCollection.id);
84
+ console.log('Test collection and documents cleaned up');
85
+ }
86
+ catch (error) {
87
+ console.error('Failed to cleanup test collection:', error);
88
+ }
89
+ await teardownTestDB();
90
+ });
91
+ it('should create and return a field type document', async () => {
92
+ const sourceDocument = structuredClone(sampleDocument);
93
+ const path = `my-first-field-types-document-${Date.now()}`;
94
+ const result = await commandBuilders.documents.createDocumentVersion({
95
+ collectionId: testCollection.id,
96
+ collectionVersion: 1,
97
+ collectionConfig: FieldTypesCollectionConfig,
98
+ action: 'create',
99
+ documentData: sourceDocument,
100
+ path,
101
+ });
102
+ console.log('Created document:', result);
103
+ const document = await queryBuilders.documents.getDocumentByVersion({
104
+ document_version_id: result.document.id,
105
+ });
106
+ console.log('Retrieved document:', document);
107
+ });
108
+ it('should return only requested fields with selective field loading', async () => {
109
+ const sourceDocument = structuredClone(sampleDocument);
110
+ const path = `selective-loading-${Date.now()}`;
111
+ await commandBuilders.documents.createDocumentVersion({
112
+ collectionId: testCollection.id,
113
+ collectionVersion: 1,
114
+ collectionConfig: FieldTypesCollectionConfig,
115
+ action: 'create',
116
+ documentData: sourceDocument,
117
+ path,
118
+ });
119
+ // Request only title and views — should query only text + numeric stores
120
+ const result = await queryBuilders.documents.findDocuments({
121
+ collection_id: testCollection.id,
122
+ locale: 'en',
123
+ fields: ['title', 'views'],
124
+ });
125
+ assert.ok(result.documents.length > 0, 'should return at least one document');
126
+ const doc = result.documents[0];
127
+ assert.ok(doc.fields, 'document should have fields');
128
+ assert.ok(doc.fields.title, 'should include title field');
129
+ assert.strictEqual(doc.fields.views, 100, 'should include views field');
130
+ // Fields not requested should be absent or empty
131
+ assert.strictEqual(doc.fields.price, undefined, 'should not include unrequested decimal field');
132
+ assert.strictEqual(doc.fields.attachment, undefined, 'should not include unrequested file field');
133
+ });
134
+ it('should return all fields when no fields parameter is provided', async () => {
135
+ const result = await queryBuilders.documents.findDocuments({
136
+ collection_id: testCollection.id,
137
+ locale: 'en',
138
+ });
139
+ assert.ok(result.documents.length > 0, 'should return at least one document');
140
+ const doc = result.documents[0];
141
+ assert.ok(doc.fields, 'document should have fields');
142
+ assert.ok(doc.fields.title, 'should include title');
143
+ assert.ok(doc.path, 'should include the system path on the document envelope');
144
+ });
145
+ });
146
+ //# sourceMappingURL=storage-field-types.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-field-types.test.js","sourceRoot":"","sources":["../../../../src/modules/storage/tests/storage-field-types.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAA;AAGvD,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAA;AAEnC,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAEzE,sBAAsB;AACtB,IAAI,eAA0F,CAAA;AAC9F,IAAI,aAAqF,CAAA;AAEzF,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;AAE5B,MAAM,0BAA0B,GAAyB;IACvD,IAAI,EAAE,eAAe,SAAS,EA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AC,KAAK,EAAE,sBAAsB,CAAC,CAAA;QACnD,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,yDAAyD,CAAC,CAAA;IAChF,CAAC,CAAC,CAAA;AACJ,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=storage-flatten-reconstruct.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-flatten-reconstruct.test.d.ts","sourceRoot":"","sources":["../../../../src/modules/storage/tests/storage-flatten-reconstruct.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}