@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.
- package/LICENSE +373 -0
- package/README.md +17 -0
- package/dist/@types/admin-types.d.ts +275 -0
- package/dist/@types/admin-types.d.ts.map +1 -0
- package/dist/@types/admin-types.js +18 -0
- package/dist/@types/admin-types.js.map +1 -0
- package/dist/@types/collection-types.d.ts +816 -0
- package/dist/@types/collection-types.d.ts.map +1 -0
- package/dist/@types/collection-types.js +217 -0
- package/dist/@types/collection-types.js.map +1 -0
- package/dist/@types/db-types.d.ts +463 -0
- package/dist/@types/db-types.d.ts.map +1 -0
- package/dist/@types/db-types.js +2 -0
- package/dist/@types/db-types.js.map +1 -0
- package/dist/@types/field-data-types.d.ts +147 -0
- package/dist/@types/field-data-types.d.ts.map +1 -0
- package/dist/@types/field-data-types.js +38 -0
- package/dist/@types/field-data-types.js.map +1 -0
- package/dist/@types/field-types.d.ts +579 -0
- package/dist/@types/field-types.d.ts.map +1 -0
- package/dist/@types/field-types.js +32 -0
- package/dist/@types/field-types.js.map +1 -0
- package/dist/@types/index.d.ts +18 -0
- package/dist/@types/index.d.ts.map +1 -0
- package/dist/@types/index.js +18 -0
- package/dist/@types/index.js.map +1 -0
- package/dist/@types/populate-types.d.ts +54 -0
- package/dist/@types/populate-types.d.ts.map +1 -0
- package/dist/@types/populate-types.js +9 -0
- package/dist/@types/populate-types.js.map +1 -0
- package/dist/@types/query-predicate.d.ts +74 -0
- package/dist/@types/query-predicate.d.ts.map +1 -0
- package/dist/@types/query-predicate.js +9 -0
- package/dist/@types/query-predicate.js.map +1 -0
- package/dist/@types/site-config.d.ts +212 -0
- package/dist/@types/site-config.d.ts.map +1 -0
- package/dist/@types/site-config.js +9 -0
- package/dist/@types/site-config.js.map +1 -0
- package/dist/@types/storage-types.d.ts +86 -0
- package/dist/@types/storage-types.d.ts.map +1 -0
- package/dist/@types/storage-types.js +9 -0
- package/dist/@types/storage-types.js.map +1 -0
- package/dist/@types/store-types.d.ts +134 -0
- package/dist/@types/store-types.d.ts.map +1 -0
- package/dist/@types/store-types.js +24 -0
- package/dist/@types/store-types.js.map +1 -0
- package/dist/@types/type-utils.d.ts +17 -0
- package/dist/@types/type-utils.d.ts.map +1 -0
- package/dist/@types/type-utils.js +9 -0
- package/dist/@types/type-utils.js.map +1 -0
- package/dist/auth/apply-before-read.d.ts +36 -0
- package/dist/auth/apply-before-read.d.ts.map +1 -0
- package/dist/auth/apply-before-read.js +68 -0
- package/dist/auth/apply-before-read.js.map +1 -0
- package/dist/auth/apply-before-read.test.node.d.ts +9 -0
- package/dist/auth/apply-before-read.test.node.d.ts.map +1 -0
- package/dist/auth/apply-before-read.test.node.js +144 -0
- package/dist/auth/apply-before-read.test.node.js.map +1 -0
- package/dist/auth/assert-actor-can-perform.d.ts +39 -0
- package/dist/auth/assert-actor-can-perform.d.ts.map +1 -0
- package/dist/auth/assert-actor-can-perform.js +64 -0
- package/dist/auth/assert-actor-can-perform.js.map +1 -0
- package/dist/auth/assert-actor-can-perform.test.node.d.ts +9 -0
- package/dist/auth/assert-actor-can-perform.test.node.d.ts.map +1 -0
- package/dist/auth/assert-actor-can-perform.test.node.js +119 -0
- package/dist/auth/assert-actor-can-perform.test.node.js.map +1 -0
- package/dist/auth/index.d.ts +11 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +11 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/register-collection-abilities.d.ts +40 -0
- package/dist/auth/register-collection-abilities.d.ts.map +1 -0
- package/dist/auth/register-collection-abilities.js +87 -0
- package/dist/auth/register-collection-abilities.js.map +1 -0
- package/dist/auth/register-collection-abilities.test.node.d.ts +9 -0
- package/dist/auth/register-collection-abilities.test.node.d.ts.map +1 -0
- package/dist/auth/register-collection-abilities.test.node.js +124 -0
- package/dist/auth/register-collection-abilities.test.node.js.map +1 -0
- package/dist/config/config.d.ts +10 -0
- package/dist/config/config.d.ts.map +1 -0
- package/dist/config/config.js +108 -0
- package/dist/config/config.js.map +1 -0
- package/dist/config/routes.d.ts +16 -0
- package/dist/config/routes.d.ts.map +1 -0
- package/dist/config/routes.js +26 -0
- package/dist/config/routes.js.map +1 -0
- package/dist/config/validate-admin-configs.d.ts +33 -0
- package/dist/config/validate-admin-configs.d.ts.map +1 -0
- package/dist/config/validate-admin-configs.js +250 -0
- package/dist/config/validate-admin-configs.js.map +1 -0
- package/dist/config/validate-admin-configs.test.node.d.ts +9 -0
- package/dist/config/validate-admin-configs.test.node.d.ts.map +1 -0
- package/dist/config/validate-admin-configs.test.node.js +224 -0
- package/dist/config/validate-admin-configs.test.node.js.map +1 -0
- package/dist/config/validate-collections.d.ts +33 -0
- package/dist/config/validate-collections.d.ts.map +1 -0
- package/dist/config/validate-collections.js +70 -0
- package/dist/config/validate-collections.js.map +1 -0
- package/dist/config/validate-collections.test.node.d.ts +9 -0
- package/dist/config/validate-collections.test.node.d.ts.map +1 -0
- package/dist/config/validate-collections.test.node.js +149 -0
- package/dist/config/validate-collections.test.node.js.map +1 -0
- package/dist/core.d.ts +89 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/core.js +99 -0
- package/dist/core.js.map +1 -0
- package/dist/defaults/default-values.d.ts +13 -0
- package/dist/defaults/default-values.d.ts.map +1 -0
- package/dist/defaults/default-values.js +60 -0
- package/dist/defaults/default-values.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/errors.d.ts +98 -0
- package/dist/lib/errors.d.ts.map +1 -0
- package/dist/lib/errors.js +134 -0
- package/dist/lib/errors.js.map +1 -0
- package/dist/lib/logger.d.ts +62 -0
- package/dist/lib/logger.d.ts.map +1 -0
- package/dist/lib/logger.js +120 -0
- package/dist/lib/logger.js.map +1 -0
- package/dist/lib/registry.d.ts +65 -0
- package/dist/lib/registry.d.ts.map +1 -0
- package/dist/lib/registry.js +133 -0
- package/dist/lib/registry.js.map +1 -0
- package/dist/logger/index.d.ts +3 -0
- package/dist/logger/index.d.ts.map +1 -0
- package/dist/logger/index.js +3 -0
- package/dist/logger/index.js.map +1 -0
- package/dist/patches/apply-patches.d.ts +21 -0
- package/dist/patches/apply-patches.d.ts.map +1 -0
- package/dist/patches/apply-patches.js +357 -0
- package/dist/patches/apply-patches.js.map +1 -0
- package/dist/patches/index.d.ts +3 -0
- package/dist/patches/index.d.ts.map +1 -0
- package/dist/patches/index.js +4 -0
- package/dist/patches/index.js.map +1 -0
- package/dist/patches/patch-types.d.ts +82 -0
- package/dist/patches/patch-types.d.ts.map +1 -0
- package/dist/patches/patch-types.js +3 -0
- package/dist/patches/patch-types.js.map +1 -0
- package/dist/patches/patch.test.node.d.ts +2 -0
- package/dist/patches/patch.test.node.d.ts.map +1 -0
- package/dist/patches/patch.test.node.js +193 -0
- package/dist/patches/patch.test.node.js.map +1 -0
- package/dist/query/parse-where.d.ts +100 -0
- package/dist/query/parse-where.d.ts.map +1 -0
- package/dist/query/parse-where.js +352 -0
- package/dist/query/parse-where.js.map +1 -0
- package/dist/query/parse-where.test.node.d.ts +9 -0
- package/dist/query/parse-where.test.node.d.ts.map +1 -0
- package/dist/query/parse-where.test.node.js +581 -0
- package/dist/query/parse-where.test.node.js.map +1 -0
- package/dist/schemas/zod/builder.d.ts +466 -0
- package/dist/schemas/zod/builder.d.ts.map +1 -0
- package/dist/schemas/zod/builder.js +276 -0
- package/dist/schemas/zod/builder.js.map +1 -0
- package/dist/schemas/zod/cache.d.ts +14 -0
- package/dist/schemas/zod/cache.d.ts.map +1 -0
- package/dist/schemas/zod/cache.js +40 -0
- package/dist/schemas/zod/cache.js.map +1 -0
- package/dist/schemas/zod/index.d.ts +4 -0
- package/dist/schemas/zod/index.d.ts.map +1 -0
- package/dist/schemas/zod/index.js +4 -0
- package/dist/schemas/zod/index.js.map +1 -0
- package/dist/schemas/zod/types.d.ts +13 -0
- package/dist/schemas/zod/types.d.ts.map +1 -0
- package/dist/schemas/zod/types.js +2 -0
- package/dist/schemas/zod/types.js.map +1 -0
- package/dist/services/collection-bootstrap.d.ts +46 -0
- package/dist/services/collection-bootstrap.d.ts.map +1 -0
- package/dist/services/collection-bootstrap.js +108 -0
- package/dist/services/collection-bootstrap.js.map +1 -0
- package/dist/services/collection-bootstrap.test.node.d.ts +9 -0
- package/dist/services/collection-bootstrap.test.node.d.ts.map +1 -0
- package/dist/services/collection-bootstrap.test.node.js +208 -0
- package/dist/services/collection-bootstrap.test.node.js.map +1 -0
- package/dist/services/document-lifecycle.d.ts +245 -0
- package/dist/services/document-lifecycle.d.ts.map +1 -0
- package/dist/services/document-lifecycle.js +481 -0
- package/dist/services/document-lifecycle.js.map +1 -0
- package/dist/services/document-lifecycle.test.node.d.ts +9 -0
- package/dist/services/document-lifecycle.test.node.d.ts.map +1 -0
- package/dist/services/document-lifecycle.test.node.js +781 -0
- package/dist/services/document-lifecycle.test.node.js.map +1 -0
- package/dist/services/document-read.d.ts +26 -0
- package/dist/services/document-read.d.ts.map +1 -0
- package/dist/services/document-read.js +60 -0
- package/dist/services/document-read.js.map +1 -0
- package/dist/services/field-upload.d.ts +100 -0
- package/dist/services/field-upload.d.ts.map +1 -0
- package/dist/services/field-upload.js +328 -0
- package/dist/services/field-upload.js.map +1 -0
- package/dist/services/field-upload.test.node.d.ts +9 -0
- package/dist/services/field-upload.test.node.d.ts.map +1 -0
- package/dist/services/field-upload.test.node.js +337 -0
- package/dist/services/field-upload.test.node.js.map +1 -0
- package/dist/services/index.d.ts +10 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +11 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/populate.d.ts +299 -0
- package/dist/services/populate.d.ts.map +1 -0
- package/dist/services/populate.js +484 -0
- package/dist/services/populate.js.map +1 -0
- package/dist/services/populate.test.node.d.ts +9 -0
- package/dist/services/populate.test.node.d.ts.map +1 -0
- package/dist/services/populate.test.node.js +910 -0
- package/dist/services/populate.test.node.js.map +1 -0
- package/dist/services/relation-projection.d.ts +52 -0
- package/dist/services/relation-projection.d.ts.map +1 -0
- package/dist/services/relation-projection.js +81 -0
- package/dist/services/relation-projection.js.map +1 -0
- package/dist/services/richtext-populate.d.ts +87 -0
- package/dist/services/richtext-populate.d.ts.map +1 -0
- package/dist/services/richtext-populate.js +189 -0
- package/dist/services/richtext-populate.js.map +1 -0
- package/dist/services/richtext-populate.test.node.d.ts +9 -0
- package/dist/services/richtext-populate.test.node.d.ts.map +1 -0
- package/dist/services/richtext-populate.test.node.js +197 -0
- package/dist/services/richtext-populate.test.node.js.map +1 -0
- package/dist/storage/collection-fingerprint.d.ts +21 -0
- package/dist/storage/collection-fingerprint.d.ts.map +1 -0
- package/dist/storage/collection-fingerprint.js +172 -0
- package/dist/storage/collection-fingerprint.js.map +1 -0
- package/dist/storage/collection-fingerprint.test.node.d.ts +9 -0
- package/dist/storage/collection-fingerprint.test.node.d.ts.map +1 -0
- package/dist/storage/collection-fingerprint.test.node.js +256 -0
- package/dist/storage/collection-fingerprint.test.node.js.map +1 -0
- package/dist/storage/field-store-map.d.ts +59 -0
- package/dist/storage/field-store-map.d.ts.map +1 -0
- package/dist/storage/field-store-map.js +75 -0
- package/dist/storage/field-store-map.js.map +1 -0
- package/dist/storage/field-store-map.test.node.d.ts +9 -0
- package/dist/storage/field-store-map.test.node.d.ts.map +1 -0
- package/dist/storage/field-store-map.test.node.js +117 -0
- package/dist/storage/field-store-map.test.node.js.map +1 -0
- package/dist/storage/index.d.ts +10 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +10 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/utils/normalise-dates.d.ts +15 -0
- package/dist/utils/normalise-dates.d.ts.map +1 -0
- package/dist/utils/normalise-dates.js +22 -0
- package/dist/utils/normalise-dates.js.map +1 -0
- package/dist/utils/slugify.d.ts +56 -0
- package/dist/utils/slugify.d.ts.map +1 -0
- package/dist/utils/slugify.js +91 -0
- package/dist/utils/slugify.js.map +1 -0
- package/dist/utils/slugify.test.node.d.ts +9 -0
- package/dist/utils/slugify.test.node.d.ts.map +1 -0
- package/dist/utils/slugify.test.node.js +86 -0
- package/dist/utils/slugify.test.node.js.map +1 -0
- package/dist/utils/storage-utils.d.ts +36 -0
- package/dist/utils/storage-utils.d.ts.map +1 -0
- package/dist/utils/storage-utils.js +38 -0
- package/dist/utils/storage-utils.js.map +1 -0
- package/dist/utils/utils.general.d.ts +64 -0
- package/dist/utils/utils.general.d.ts.map +1 -0
- package/dist/utils/utils.general.js +219 -0
- package/dist/utils/utils.general.js.map +1 -0
- package/dist/validation/index.d.ts +9 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +9 -0
- package/dist/validation/index.js.map +1 -0
- package/dist/validation/shared.d.ts +36 -0
- package/dist/validation/shared.d.ts.map +1 -0
- package/dist/validation/shared.js +42 -0
- package/dist/validation/shared.js.map +1 -0
- package/dist/workflow/index.d.ts +2 -0
- package/dist/workflow/index.d.ts.map +1 -0
- package/dist/workflow/index.js +3 -0
- package/dist/workflow/index.js.map +1 -0
- package/dist/workflow/workflow.d.ts +40 -0
- package/dist/workflow/workflow.d.ts.map +1 -0
- package/dist/workflow/workflow.js +96 -0
- package/dist/workflow/workflow.js.map +1 -0
- package/dist/workflow/workflow.test.node.d.ts +2 -0
- package/dist/workflow/workflow.test.node.d.ts.map +1 -0
- package/dist/workflow/workflow.test.node.js +198 -0
- package/dist/workflow/workflow.test.node.js.map +1 -0
- package/package.json +88 -0
|
@@ -0,0 +1,18 @@
|
|
|
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 * from './admin-types.js';
|
|
9
|
+
export * from './collection-types.js';
|
|
10
|
+
export * from './db-types.js';
|
|
11
|
+
export * from './field-data-types.js';
|
|
12
|
+
export * from './field-types.js';
|
|
13
|
+
export * from './populate-types.js';
|
|
14
|
+
export * from './query-predicate.js';
|
|
15
|
+
export * from './site-config.js';
|
|
16
|
+
export * from './storage-types.js';
|
|
17
|
+
export * from './store-types.js';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/@types/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,kBAAkB,CAAA;AAChC,cAAc,uBAAuB,CAAA;AACrC,cAAc,eAAe,CAAA;AAC7B,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AACpC,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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 * from './admin-types.js';
|
|
9
|
+
export * from './collection-types.js';
|
|
10
|
+
export * from './db-types.js';
|
|
11
|
+
export * from './field-data-types.js';
|
|
12
|
+
export * from './field-types.js';
|
|
13
|
+
export * from './populate-types.js';
|
|
14
|
+
export * from './query-predicate.js';
|
|
15
|
+
export * from './site-config.js';
|
|
16
|
+
export * from './storage-types.js';
|
|
17
|
+
export * from './store-types.js';
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/@types/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,kBAAkB,CAAA;AAChC,cAAc,uBAAuB,CAAA;AACrC,cAAc,eAAe,CAAA;AAC7B,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AACpC,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
* Pure type aliases for the populate DSL. The runtime orchestrator
|
|
10
|
+
* (`populateDocuments`) lives in `services/populate.ts` and re-exports
|
|
11
|
+
* these for backward compatibility, but they live here so other type
|
|
12
|
+
* surfaces — notably `CollectionAdminConfig.preview.populate` — can
|
|
13
|
+
* reference them without importing the services layer (which would
|
|
14
|
+
* create a cycle, since `populate.ts` imports from this folder).
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Per-field populate options. `select` names the target's fields to
|
|
18
|
+
* load (merged with the target's identity field so UI always has a
|
|
19
|
+
* label to render); `populate` nests for deeper relations.
|
|
20
|
+
*
|
|
21
|
+
* Use the `'*'` sub-spec shorthand instead when you want the full
|
|
22
|
+
* target document — `select` is strictly for explicit field lists.
|
|
23
|
+
*/
|
|
24
|
+
export interface PopulateFieldOptions {
|
|
25
|
+
select?: string[];
|
|
26
|
+
populate?: PopulateMap;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Per-relation projection selector.
|
|
30
|
+
*
|
|
31
|
+
* - `true` → default projection (identity field only; metadata is free).
|
|
32
|
+
* - `'*'` → full document (every field loaded).
|
|
33
|
+
* - `{ select: [...] }` or `{ populate: {...} }` → explicit options.
|
|
34
|
+
*/
|
|
35
|
+
export type PopulateFieldSpec = true | '*' | PopulateFieldOptions;
|
|
36
|
+
/**
|
|
37
|
+
* Top-level populate spec. Keys are relation field names (matched
|
|
38
|
+
* anywhere in the source document's field tree, including inside
|
|
39
|
+
* `group` / `array` / `blocks` structures).
|
|
40
|
+
*/
|
|
41
|
+
export type PopulateMap = Record<string, PopulateFieldSpec>;
|
|
42
|
+
/**
|
|
43
|
+
* Top-level populate spec. Three shapes:
|
|
44
|
+
*
|
|
45
|
+
* - `true` → populate every relation leaf encountered, with
|
|
46
|
+
* default projection (identity only) at every level.
|
|
47
|
+
* - `'*'` → populate every relation leaf, with full projection
|
|
48
|
+
* at every level. Symmetric with the sub-spec `'*'`
|
|
49
|
+
* shorthand.
|
|
50
|
+
* - `PopulateMap` → populate only the named relations, with per-field
|
|
51
|
+
* projection selectors.
|
|
52
|
+
*/
|
|
53
|
+
export type PopulateSpec = true | '*' | PopulateMap;
|
|
54
|
+
//# sourceMappingURL=populate-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"populate-types.d.ts","sourceRoot":"","sources":["../../src/@types/populate-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;GAOG;AAEH;;;;;;;GAOG;AACH,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,QAAQ,CAAC,EAAE,WAAW,CAAA;CACvB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG,IAAI,GAAG,GAAG,GAAG,oBAAoB,CAAA;AAEjE;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAA;AAE3D;;;;;;;;;;GAUG;AACH,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,GAAG,GAAG,WAAW,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=populate-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"populate-types.js","sourceRoot":"","sources":["../../src/@types/populate-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
|
@@ -0,0 +1,74 @@
|
|
|
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
|
+
* Comparison operators usable on a single field-level predicate value. The
|
|
10
|
+
* parser normalises a bare value (`'foo'`) to `{ $eq: 'foo' }`; an operator
|
|
11
|
+
* object is taken as-is and the first declared operator wins.
|
|
12
|
+
*/
|
|
13
|
+
export interface FilterOperators {
|
|
14
|
+
$eq?: string | number | boolean | null;
|
|
15
|
+
$ne?: string | number | boolean | null;
|
|
16
|
+
$gt?: string | number;
|
|
17
|
+
$gte?: string | number;
|
|
18
|
+
$lt?: string | number;
|
|
19
|
+
$lte?: string | number;
|
|
20
|
+
$contains?: string;
|
|
21
|
+
$in?: Array<string | number>;
|
|
22
|
+
$nin?: Array<string | number>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The value side of a predicate entry. Either a bare value (interpreted as
|
|
26
|
+
* `$eq`), an operator object, a nested `QueryPredicate` (for cross-collection
|
|
27
|
+
* relation filters or combinator children), or an array of `QueryPredicate`
|
|
28
|
+
* (the value side of `$and` / `$or`).
|
|
29
|
+
*/
|
|
30
|
+
export type PredicateValue = string | number | boolean | null | FilterOperators | QueryPredicate | QueryPredicate[];
|
|
31
|
+
/**
|
|
32
|
+
* Structured predicate language used by:
|
|
33
|
+
* - the client API's `where` clause (re-exported as `WhereClause`),
|
|
34
|
+
* - the `CollectionHooks.beforeRead` hook return value.
|
|
35
|
+
*
|
|
36
|
+
* Keys are field names declared on the collection, with three exceptions:
|
|
37
|
+
*
|
|
38
|
+
* - `$and: QueryPredicate[]` — every child must match.
|
|
39
|
+
* - `$or: QueryPredicate[]` — at least one child must match.
|
|
40
|
+
* - reserved client-side keys (`status`, `query`, `path`) that the
|
|
41
|
+
* `parseWhere` parser maps to document-level columns at the top level.
|
|
42
|
+
* `beforeRead` predicates may use these too, with the same semantics.
|
|
43
|
+
*
|
|
44
|
+
* Field-name keys resolve through `field-store-map` and compile into the
|
|
45
|
+
* existing `EXISTS` / `LEFT JOIN LATERAL` SQL machinery — no new SQL
|
|
46
|
+
* primitives. Combinators nest freely:
|
|
47
|
+
*
|
|
48
|
+
* ```ts
|
|
49
|
+
* {
|
|
50
|
+
* $or: [
|
|
51
|
+
* { status: 'published' },
|
|
52
|
+
* { status: 'draft', authorId: actor.id },
|
|
53
|
+
* ],
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* Returning `undefined` from `beforeRead` means "no scoping". Use a
|
|
58
|
+
* sentinel predicate that yields no rows (e.g. `{ id: '__none__' }`)
|
|
59
|
+
* rather than throwing when the actor can read nothing — empty results
|
|
60
|
+
* are the correct shape for list endpoints.
|
|
61
|
+
*/
|
|
62
|
+
export interface QueryPredicate {
|
|
63
|
+
$and?: QueryPredicate[];
|
|
64
|
+
$or?: QueryPredicate[];
|
|
65
|
+
[key: string]: PredicateValue | undefined;
|
|
66
|
+
}
|
|
67
|
+
export type SortDirection = 'asc' | 'desc';
|
|
68
|
+
/**
|
|
69
|
+
* A sort specification — `{ fieldName: direction }`. Field names resolve
|
|
70
|
+
* through `field-store-map` to a LATERAL JOIN; document-level columns
|
|
71
|
+
* (`createdAt`, `updatedAt`, `path`) compile to a direct `ORDER BY`.
|
|
72
|
+
*/
|
|
73
|
+
export type SortSpec = Record<string, SortDirection>;
|
|
74
|
+
//# sourceMappingURL=query-predicate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-predicate.d.ts","sourceRoot":"","sources":["../../src/@types/query-predicate.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAA;IACtC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAA;IACtC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACrB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACrB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,GAAG,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAA;IAC5B,IAAI,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAA;CAC9B;AAED;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GACtB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,eAAe,GACf,cAAc,GACd,cAAc,EAAE,CAAA;AAEpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,cAAc,EAAE,CAAA;IACvB,GAAG,CAAC,EAAE,cAAc,EAAE,CAAA;IACtB,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAAA;CAC1C;AAMD,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,MAAM,CAAA;AAE1C;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,aAAa,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=query-predicate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-predicate.js","sourceRoot":"","sources":["../../src/@types/query-predicate.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
|
@@ -0,0 +1,212 @@
|
|
|
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 { SessionProvider } from '@byline/auth';
|
|
9
|
+
import type { SlugifierFn } from '../utils/slugify.js';
|
|
10
|
+
import type { CollectionAdminConfig } from './admin-types.js';
|
|
11
|
+
import type { CollectionDefinition } from './collection-types.js';
|
|
12
|
+
import type { IDbAdapter } from './db-types.js';
|
|
13
|
+
import type { RichTextEditorComponent, RichTextPopulateFn } from './field-types.js';
|
|
14
|
+
import type { IStorageProvider } from './storage-types.js';
|
|
15
|
+
export type DbAdapterFn = (args: {
|
|
16
|
+
connectionString: string;
|
|
17
|
+
}) => IDbAdapter;
|
|
18
|
+
/**
|
|
19
|
+
* URL path segments for the admin and (future) public API routes.
|
|
20
|
+
* Both values are optional on the input side — callers typically read the
|
|
21
|
+
* resolved shape via `resolveRoutes()` which fills in `'/admin'` and `'/api'`
|
|
22
|
+
* defaults.
|
|
23
|
+
*/
|
|
24
|
+
export interface RoutesConfig {
|
|
25
|
+
admin: string;
|
|
26
|
+
api: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Common configuration shared by the server and client. Contains only
|
|
30
|
+
* serializable, framework-agnostic properties — no React components, no
|
|
31
|
+
* database adapters, no storage providers.
|
|
32
|
+
*/
|
|
33
|
+
export interface BaseConfig {
|
|
34
|
+
serverURL: string;
|
|
35
|
+
i18n: {
|
|
36
|
+
interface: {
|
|
37
|
+
defaultLocale: string;
|
|
38
|
+
locales: string[];
|
|
39
|
+
};
|
|
40
|
+
content: {
|
|
41
|
+
defaultLocale: string;
|
|
42
|
+
locales: string[];
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
collections: CollectionDefinition[];
|
|
46
|
+
/**
|
|
47
|
+
* URL segments for admin and API routes. Both keys default to `/admin`
|
|
48
|
+
* and `/api` respectively — installations only set this when they want
|
|
49
|
+
* to mount the admin or API at a non-default path. Consumers should
|
|
50
|
+
* read these via `resolveRoutes()` so the defaults are always applied.
|
|
51
|
+
*/
|
|
52
|
+
routes?: Partial<RoutesConfig>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Client-side configuration. Extends BaseConfig with admin UI presentation
|
|
56
|
+
* config (React components, formatters, column definitions, etc.).
|
|
57
|
+
*
|
|
58
|
+
* Used by `defineClientConfig()` and consumed by admin UI routes.
|
|
59
|
+
*/
|
|
60
|
+
export interface ClientConfig extends BaseConfig {
|
|
61
|
+
/** Admin UI configuration for collections (client-side only). */
|
|
62
|
+
admin?: CollectionAdminConfig[];
|
|
63
|
+
/**
|
|
64
|
+
* Site-wide field-level UI defaults. Currently surfaces the richtext
|
|
65
|
+
* editor adapter slot — additional field-level defaults (custom
|
|
66
|
+
* widgets, formatters, etc.) can be registered here as the system grows.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* import { RichTextField } from '@byline/richtext-lexical'
|
|
71
|
+
*
|
|
72
|
+
* defineClientConfig({
|
|
73
|
+
* // ...
|
|
74
|
+
* fields: {
|
|
75
|
+
* richText: { editor: RichTextField },
|
|
76
|
+
* },
|
|
77
|
+
* })
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
fields?: {
|
|
81
|
+
/**
|
|
82
|
+
* Editor component used to render every `type: 'richText'` field. Per-field
|
|
83
|
+
* overrides via `FieldAdminConfig.components.Field` continue to take
|
|
84
|
+
* precedence over this site-wide default.
|
|
85
|
+
*/
|
|
86
|
+
richText?: {
|
|
87
|
+
editor: RichTextEditorComponent;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Server-side configuration. Extends BaseConfig with database and storage
|
|
93
|
+
* adapters. Deliberately does NOT extend ClientConfig — the server has no
|
|
94
|
+
* knowledge of React components or admin UI presentation logic.
|
|
95
|
+
*
|
|
96
|
+
* Generic over `TAdminStore` so installations can thread an adapter-built
|
|
97
|
+
* admin store (users / roles / permissions / refresh tokens) through
|
|
98
|
+
* `initBylineCore()` without `@byline/core` depending on `@byline/admin` —
|
|
99
|
+
* which would invert the package dependency direction. Callers that
|
|
100
|
+
* consume admin functionality pass `AdminStore` from `@byline/admin`;
|
|
101
|
+
* callers that do not leave the default `unknown`.
|
|
102
|
+
*/
|
|
103
|
+
export interface ServerConfig<TAdminStore = unknown> extends BaseConfig {
|
|
104
|
+
db: IDbAdapter;
|
|
105
|
+
/**
|
|
106
|
+
* Site-wide default storage provider for upload-capable image/file
|
|
107
|
+
* fields.
|
|
108
|
+
*
|
|
109
|
+
* This is the fallback used when a field's own `UploadConfig.storage`
|
|
110
|
+
* is not set. Individual fields can override this by specifying
|
|
111
|
+
* `storage` inside their `upload` config block.
|
|
112
|
+
*
|
|
113
|
+
* Resolution order:
|
|
114
|
+
* 1. `field.upload.storage` — per-field override
|
|
115
|
+
* 2. `ServerConfig.storage` — site-wide default
|
|
116
|
+
* 3. 500 error if neither is set
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```ts
|
|
120
|
+
* import { localStorageProvider } from '@byline/storage-local'
|
|
121
|
+
* storage: localStorageProvider({ uploadDir: './public/uploads', baseUrl: '/uploads' })
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
124
|
+
storage?: IStorageProvider;
|
|
125
|
+
/**
|
|
126
|
+
* Installation-wide slugifier used to derive `documentVersions.path`
|
|
127
|
+
* from the field named by `CollectionDefinition.useAsPath`.
|
|
128
|
+
*
|
|
129
|
+
* Falls back to the default `slugify` from `@byline/core` when not set.
|
|
130
|
+
* Must be pure and synchronous — it runs server-side at write time and
|
|
131
|
+
* client-side for live form preview, and the two must agree on output.
|
|
132
|
+
*/
|
|
133
|
+
slugifier?: SlugifierFn;
|
|
134
|
+
/**
|
|
135
|
+
* Session provider for admin authentication. Optional in Phase 3 —
|
|
136
|
+
* installations without a provider configured simply can't sign in
|
|
137
|
+
* (sign-in / verify / refresh / revoke all require one); everything
|
|
138
|
+
* else continues to work. Phase 5 wires the admin server-fn middleware
|
|
139
|
+
* and will tighten this where authentication is required.
|
|
140
|
+
*
|
|
141
|
+
* The built-in `JwtSessionProvider` from `@byline/admin/auth` covers
|
|
142
|
+
* the default case. Alternative providers can adapt Lucia, better-auth,
|
|
143
|
+
* WorkOS, Clerk, or institutional SSO by implementing the
|
|
144
|
+
* `SessionProvider` interface from `@byline/auth` — those adapters
|
|
145
|
+
* should ship as separate packages rather than being added to
|
|
146
|
+
* `@byline/admin`.
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```ts
|
|
150
|
+
* import { JwtSessionProvider } from '@byline/admin/auth'
|
|
151
|
+
* import { createAdminStore } from '@byline/db-postgres/admin'
|
|
152
|
+
*
|
|
153
|
+
* sessionProvider: new JwtSessionProvider({
|
|
154
|
+
* store: createAdminStore(drizzleDb),
|
|
155
|
+
* signingSecret: process.env.BYLINE_JWT_SECRET!,
|
|
156
|
+
* })
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
159
|
+
sessionProvider?: SessionProvider;
|
|
160
|
+
/**
|
|
161
|
+
* Adapter-built bundle of admin repositories (users / roles /
|
|
162
|
+
* permissions / refresh tokens). Typically constructed via the
|
|
163
|
+
* adapter's `createAdminStore(...)` factory and shared with the
|
|
164
|
+
* session provider so both sides talk to the same repository
|
|
165
|
+
* instances.
|
|
166
|
+
*
|
|
167
|
+
* Surfaced unchanged as `BylineCore.adminStore` so server fns, seeds,
|
|
168
|
+
* and future admin commands can reach it without holding a second
|
|
169
|
+
* reference or casting the adapter. Optional — installations without
|
|
170
|
+
* admin UI can leave it unset.
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* ```ts
|
|
174
|
+
* import type { AdminStore } from '@byline/admin'
|
|
175
|
+
* import { createAdminStore } from '@byline/db-postgres/admin'
|
|
176
|
+
*
|
|
177
|
+
* const db = pgAdapter({ ... })
|
|
178
|
+
* const adminStore = createAdminStore(db.drizzle)
|
|
179
|
+
* const core = await initBylineCore<AdminStore>({ db, adminStore, ... })
|
|
180
|
+
* // core.adminStore is typed as AdminStore
|
|
181
|
+
* ```
|
|
182
|
+
*/
|
|
183
|
+
adminStore?: TAdminStore;
|
|
184
|
+
/**
|
|
185
|
+
* Site-wide field-level server adapter slots. Mirrors
|
|
186
|
+
* `ClientConfig.fields` for the server side — each entry plugs an
|
|
187
|
+
* adapter package into a framework-managed read or write phase.
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* ```ts
|
|
191
|
+
* import { lexicalEditorServer } from '@byline/richtext-lexical/server'
|
|
192
|
+
*
|
|
193
|
+
* defineServerConfig({
|
|
194
|
+
* fields: {
|
|
195
|
+
* richText: { populate: lexicalEditorServer({ getClient: getAdminBylineClient }) },
|
|
196
|
+
* },
|
|
197
|
+
* })
|
|
198
|
+
* ```
|
|
199
|
+
*/
|
|
200
|
+
fields?: {
|
|
201
|
+
/**
|
|
202
|
+
* Richtext server-side populate function. Invoked by the read pipeline
|
|
203
|
+
* for every rich-text field whose effective `populateRelationsOnRead`
|
|
204
|
+
* is `true`. Required when any collection has a `richText` field
|
|
205
|
+
* configured to populate on read; `initBylineCore()` enforces this.
|
|
206
|
+
*/
|
|
207
|
+
richText?: {
|
|
208
|
+
populate: RichTextPopulateFn;
|
|
209
|
+
};
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
//# sourceMappingURL=site-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"site-config.d.ts","sourceRoot":"","sources":["../../src/@types/site-config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAEnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AAC7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,KAAK,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AACnF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAE1D,MAAM,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE;IAAE,gBAAgB,EAAE,MAAM,CAAA;CAAE,KAAK,UAAU,CAAA;AAE5E;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;CACZ;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE;QACJ,SAAS,EAAE;YACT,aAAa,EAAE,MAAM,CAAA;YACrB,OAAO,EAAE,MAAM,EAAE,CAAA;SAClB,CAAA;QACD,OAAO,EAAE;YACP,aAAa,EAAE,MAAM,CAAA;YACrB,OAAO,EAAE,MAAM,EAAE,CAAA;SAClB,CAAA;KACF,CAAA;IACD,WAAW,EAAE,oBAAoB,EAAE,CAAA;IACnC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAA;CAC/B;AAED;;;;;GAKG;AACH,MAAM,WAAW,YAAa,SAAQ,UAAU;IAC9C,iEAAiE;IACjE,KAAK,CAAC,EAAE,qBAAqB,EAAE,CAAA;IAC/B;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,EAAE;QACP;;;;WAIG;QACH,QAAQ,CAAC,EAAE;YAAE,MAAM,EAAE,uBAAuB,CAAA;SAAE,CAAA;KAC/C,CAAA;CACF;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,YAAY,CAAC,WAAW,GAAG,OAAO,CAAE,SAAQ,UAAU;IACrE,EAAE,EAAE,UAAU,CAAA;IACd;;;;;;;;;;;;;;;;;;OAkBG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAA;IAC1B;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,WAAW,CAAA;IACvB;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,eAAe,CAAC,EAAE,eAAe,CAAA;IACjC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,UAAU,CAAC,EAAE,WAAW,CAAA;IACxB;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CAAC,EAAE;QACP;;;;;WAKG;QACH,QAAQ,CAAC,EAAE;YAAE,QAAQ,EAAE,kBAAkB,CAAA;SAAE,CAAA;KAC5C,CAAA;CACF"}
|
|
@@ -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=site-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"site-config.js","sourceRoot":"","sources":["../../src/@types/site-config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
|
@@ -0,0 +1,86 @@
|
|
|
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
|
+
* The location metadata returned by a storage provider after a successful
|
|
10
|
+
* upload. These three values are stored in `store_file` alongside the rest of
|
|
11
|
+
* the file metadata.
|
|
12
|
+
*/
|
|
13
|
+
export interface StoredFileLocation {
|
|
14
|
+
/** Provider identifier string (e.g. `'local'`, `'s3'`). */
|
|
15
|
+
storageProvider: string;
|
|
16
|
+
/** Provider-internal path or object key for the stored file. */
|
|
17
|
+
storagePath: string;
|
|
18
|
+
/**
|
|
19
|
+
* Public or CDN URL for the file, if available.
|
|
20
|
+
* `null` when the provider requires a separate URL-generation step (e.g.
|
|
21
|
+
* signed S3 URLs generated at read-time).
|
|
22
|
+
*/
|
|
23
|
+
storageUrl: string | null;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Options passed to `IStorageProvider.upload()` describing the file being
|
|
27
|
+
* stored.
|
|
28
|
+
*/
|
|
29
|
+
export interface UploadFileOptions {
|
|
30
|
+
/** Final stored filename (may differ from the original if sanitised). */
|
|
31
|
+
filename: string;
|
|
32
|
+
/** MIME type of the file (e.g. `'image/jpeg'`). */
|
|
33
|
+
mimeType: string;
|
|
34
|
+
/** File size in bytes. */
|
|
35
|
+
size: number;
|
|
36
|
+
/**
|
|
37
|
+
* The collection path the upload belongs to (e.g. `'media'`).
|
|
38
|
+
* Providers may use this to namespace storage paths.
|
|
39
|
+
*/
|
|
40
|
+
collection?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The pluggable file-storage interface.
|
|
44
|
+
*
|
|
45
|
+
* Implement this interface to add a new storage backend. Register the
|
|
46
|
+
* implementation in `ServerConfig.storage`.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* // In your server config (e.g. byline/server.config.ts):
|
|
51
|
+
* import { localStorageProvider } from '@byline/storage-local'
|
|
52
|
+
*
|
|
53
|
+
* defineServerConfig({
|
|
54
|
+
* ...config,
|
|
55
|
+
* db: pgAdapter({ connectionString: process.env.DB_CONNECTION_STRING! }),
|
|
56
|
+
* storage: localStorageProvider({ uploadDir: './public/uploads', baseUrl: '/uploads' }),
|
|
57
|
+
* })
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export interface IStorageProvider {
|
|
61
|
+
/**
|
|
62
|
+
* A stable string identifier for this provider, stored in `store_file.storage_provider`.
|
|
63
|
+
* e.g. `'local'`, `'s3'`.
|
|
64
|
+
*/
|
|
65
|
+
readonly providerName: string;
|
|
66
|
+
/**
|
|
67
|
+
* Store a file. The `stream` may be a Node.js `Readable` or a raw `Buffer`.
|
|
68
|
+
* Returns the location metadata to be recorded alongside the file entry.
|
|
69
|
+
*/
|
|
70
|
+
upload(stream: NodeJS.ReadableStream | Buffer, options: UploadFileOptions): Promise<StoredFileLocation>;
|
|
71
|
+
/**
|
|
72
|
+
* Delete a previously stored file by its `storage_path`.
|
|
73
|
+
* Should resolve (not throw) if the file no longer exists.
|
|
74
|
+
*/
|
|
75
|
+
delete(storagePath: string): Promise<void>;
|
|
76
|
+
/**
|
|
77
|
+
* Derive a public URL for a given `storagePath` at read-time.
|
|
78
|
+
*
|
|
79
|
+
* For providers that embed the URL in `StoredFileLocation.storageUrl` at
|
|
80
|
+
* upload time (e.g. a public S3 bucket), this can simply return the same
|
|
81
|
+
* value. For providers that generate signed/expiring URLs, implement the
|
|
82
|
+
* signing logic here.
|
|
83
|
+
*/
|
|
84
|
+
getUrl(storagePath: string): string;
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=storage-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-types.d.ts","sourceRoot":"","sources":["../../src/@types/storage-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,2DAA2D;IAC3D,eAAe,EAAE,MAAM,CAAA;IACvB,gEAAgE;IAChE,WAAW,EAAE,MAAM,CAAA;IACnB;;;;OAIG;IACH,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;CAC1B;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,yEAAyE;IACzE,QAAQ,EAAE,MAAM,CAAA;IAChB,mDAAmD;IACnD,QAAQ,EAAE,MAAM,CAAA;IAChB,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAE7B;;;OAGG;IACH,MAAM,CACJ,MAAM,EAAE,MAAM,CAAC,cAAc,GAAG,MAAM,EACtC,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,kBAAkB,CAAC,CAAA;IAE9B;;;OAGG;IACH,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAE1C;;;;;;;OAOG;IACH,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAAA;CACpC"}
|
|
@@ -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-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-types.js","sourceRoot":"","sources":["../../src/@types/storage-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|