@relyio/sdk 0.17.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/automations/index.cjs +70 -0
- package/dist/automations/index.d.cts +1309 -0
- package/dist/automations/index.d.ts +1309 -0
- package/dist/automations/index.js +5 -0
- package/dist/{chunk-RSHMA4KT.cjs → chunk-2SPPU2WG.cjs} +68 -68
- package/dist/chunk-7I3SC7SV.cjs +40 -0
- package/dist/chunk-DI6KFDBO.js +43 -0
- package/dist/chunk-EDE2H37D.js +686 -0
- package/dist/chunk-HDHBYYEY.js +36 -0
- package/dist/{chunk-6E22GYPB.cjs → chunk-IFKF72VJ.cjs} +705 -320
- package/dist/chunk-L6DXCKVQ.cjs +50 -0
- package/dist/chunk-LSI26ZN2.cjs +535 -0
- package/dist/{chunk-TZL374LS.cjs → chunk-M7MWNV3Q.cjs} +21 -21
- package/dist/{chunk-H6IBQSMM.js → chunk-NJQK5STK.js} +3 -3
- package/dist/chunk-R6E4HE7R.js +520 -0
- package/dist/chunk-SHSK7UUY.cjs +706 -0
- package/dist/{chunk-BBUB7C2Z.js → chunk-W2A4OTCI.js} +3 -3
- package/dist/chunk-W7JFHSFM.js +18718 -0
- package/dist/{chunk-5UMY6CS4.js → chunk-ZAKEY6DY.js} +3 -3
- package/dist/chunk-ZAMAR3X2.cjs +18759 -0
- package/dist/{chunk-VS2DEUTN.js → chunk-ZHTJ7GXH.js} +387 -8
- package/dist/{chunk-LSRPMNPT.cjs → chunk-ZO6QDYJG.cjs} +7 -7
- package/dist/client/index.cjs +8 -7
- package/dist/client/index.d.cts +4 -3
- package/dist/client/index.d.ts +4 -3
- package/dist/client/index.js +6 -5
- package/dist/{define-content-type-AuL9-oz6.d.cts → define-content-type-NEQDrvdq.d.cts} +3342 -805
- package/dist/{define-content-type-BGoQxqLf.d.ts → define-content-type-fb-WCD5e.d.ts} +3342 -805
- package/dist/{define-schema-DgCX9YB7.d.ts → define-schema-DZhtvLiK.d.cts} +157 -10
- package/dist/{define-schema-DkXwpp0I.d.cts → define-schema-Dlwh6l_J.d.ts} +157 -10
- package/dist/dev-handshake/index.cjs +9 -9
- package/dist/dev-handshake/index.js +2 -2
- package/dist/extensions/index.cjs +80 -0
- package/dist/extensions/index.d.cts +792 -0
- package/dist/extensions/index.d.ts +792 -0
- package/dist/extensions/index.js +76 -0
- package/dist/functions/index.cjs +68 -0
- package/dist/functions/index.d.cts +6 -0
- package/dist/functions/index.d.ts +6 -0
- package/dist/functions/index.js +59 -0
- package/dist/{index-DaMZ4FQ_.d.ts → index-C4LqrNd1.d.ts} +1 -1
- package/dist/{index-Bp4AiNT3.d.cts → index-Dnmt_UOo.d.cts} +1 -1
- package/dist/{index-DxRmKPrR.d.cts → index-DwHcL6x5.d.cts} +83 -428
- package/dist/{index-BBp8_tn9.d.ts → index-M3luH06A.d.ts} +83 -428
- package/dist/index.cjs +204 -185
- package/dist/index.d.cts +93 -13
- package/dist/index.d.ts +93 -13
- package/dist/index.js +11 -16
- package/dist/markdown/index.cjs +382 -382
- package/dist/markdown/index.js +1 -1
- package/dist/preview/index.cjs +11 -10
- package/dist/preview/index.js +3 -2
- package/dist/register-B53i97A9.d.ts +677 -0
- package/dist/register-BYCs0FpF.d.cts +677 -0
- package/dist/rich-text/index.cjs +12 -12
- package/dist/rich-text/index.d.cts +2 -2
- package/dist/rich-text/index.d.ts +2 -2
- package/dist/rich-text/index.js +2 -2
- package/dist/schema/index.cjs +62 -34
- package/dist/schema/index.d.cts +127 -5
- package/dist/schema/index.d.ts +127 -5
- package/dist/schema/index.js +2 -2
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/index.cjs +20 -20
- package/dist/utils/index.js +2 -2
- package/package.json +23 -5
- package/dist/chunk-6PTRZP5U.cjs +0 -433
- package/dist/chunk-DIZY6CKM.js +0 -950
- package/dist/chunk-GHYB6IZK.cjs +0 -983
- package/dist/chunk-MWMSFIWN.cjs +0 -17
- package/dist/chunk-OVMIHAYK.js +0 -411
- package/dist/chunk-XQ4QHWZE.js +0 -13
|
@@ -1,4 +1,139 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { aR as FieldMember, A as AIConfig, F as FieldValues, D as DeclaredFields, cw as components, cv as RecordFile, b as FileUpload, K as KeyedMembers, cx as DisplayFieldOf, a as KeyedMembersOf, aT as ContentTypeDefinition, aZ as SingletonContentTypeDefinition, b2 as SettingsGroupDefinition, aK as LocaleDefinition, bN as RoleDefinition, c4 as WorkflowDefinition, cm as ViewDefinition, b7 as AssetTypeDefinition, aV as InferContentType, bQ as KeyedRoles, cp as KeyedViews, cy as CheckedLocales, cz as CheckedRoles, cA as CheckedWorkflow, cB as CheckedSection, cC as KeysDeclared, cD as LocaleCodesOf, cE as StagesDeclared, bR as KeyedRolesAsList, cq as KeyedViewsAsList } from './define-content-type-NEQDrvdq.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Record type definition matching @relyio/schema RecordTypeSchema (spec 1, ADR 0023)
|
|
5
|
+
*
|
|
6
|
+
* A Record is the data an app writes while it runs — an order, a stock level, a review, a cart —
|
|
7
|
+
* declared in the schema beside the content types and deployed with them. It is live the moment it
|
|
8
|
+
* is written: no drafts, no publication, no locales, no version history. So a Record type is a
|
|
9
|
+
* content type's shape without the editorial half: no `workflow`, no `hierarchical`, and its fields
|
|
10
|
+
* take every kind but `slug` and are never `localized` (deploy refuses both:
|
|
11
|
+
* `RECORD_TYPE_SLUG_FIELD`, `RECORD_TYPE_LOCALIZED_FIELD`).
|
|
12
|
+
*
|
|
13
|
+
* A Record type's references point outward: at content types, asset types and other Record types.
|
|
14
|
+
* An entry never references a Record — a content type whose reference names a Record type fails to
|
|
15
|
+
* compile under `defineSchema`, and deploy refuses it (`REFERENCE_TO_RECORD_TYPE`).
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* A Record type's configuration in the keyed form (REL-1969), as a content type's: its key under
|
|
20
|
+
* `defineSchema({ recordTypes })` is its id — one namespace with every content, singleton, settings
|
|
21
|
+
* group and asset type id — and `fields` a record keyed by Field id. `displayName` is derived from
|
|
22
|
+
* the key when left out.
|
|
23
|
+
*/
|
|
24
|
+
interface KeyedRecordTypeConfig<R extends KeyedMembers = KeyedMembers> {
|
|
25
|
+
/** Display name shown in the UI. Derived from the type's key when left out: `orderLine` → "Order line" */
|
|
26
|
+
displayName?: string;
|
|
27
|
+
/** Plural display name shown in the UI (e.g., "Orders" for "Order"); not derived */
|
|
28
|
+
displayNamePlural?: string;
|
|
29
|
+
/** Description of the Record type */
|
|
30
|
+
description?: string;
|
|
31
|
+
/** AI configuration: guidance for agents reading these Records */
|
|
32
|
+
ai?: AIConfig;
|
|
33
|
+
/** Access tags for role-based access control */
|
|
34
|
+
accessTags?: string[];
|
|
35
|
+
/** The Field a Record's title is in lists and references: one of this type's own (REL-2416) */
|
|
36
|
+
displayField?: DisplayFieldOf<R>;
|
|
37
|
+
/**
|
|
38
|
+
* Sets of this type's own Fields no two Records hold the same values of in one Dataset (REL-3782):
|
|
39
|
+
* `[['product', 'author']]` keeps one review per product per author. One Field alone says it with
|
|
40
|
+
* `unique: true` in its own config. A Record writing values another holds is refused, naming the
|
|
41
|
+
* set and the Record holding them.
|
|
42
|
+
*/
|
|
43
|
+
unique?: ReadonlyArray<ReadonlyArray<DisplayFieldOf<R>>>;
|
|
44
|
+
/**
|
|
45
|
+
* How long each Record lives after its last write, in whole hours or days — `'36h'`, `'7d'`
|
|
46
|
+
* (REL-3775). Every write moves the deadline on, so an active Record never expires; past it, the
|
|
47
|
+
* Record is deleted as a delete would delete it. Left out, a Record lives until it is deleted.
|
|
48
|
+
*/
|
|
49
|
+
expireAfter?: RecordExpiry;
|
|
50
|
+
/** Each Field under its id, in the order the form shows them */
|
|
51
|
+
fields: R;
|
|
52
|
+
}
|
|
53
|
+
/** A whole number of hours or days: `'36h'`, `'7d'`. Deploy refuses any other form. */
|
|
54
|
+
type RecordExpiry = `${number}h` | `${number}d`;
|
|
55
|
+
/**
|
|
56
|
+
* Record type definition - preserves field types for inference
|
|
57
|
+
*/
|
|
58
|
+
interface RecordTypeDefinition<TFields extends readonly FieldMember[] = readonly FieldMember[]> {
|
|
59
|
+
readonly _tag: 'recordType';
|
|
60
|
+
/** Absent until `defineSchema` writes the type's key here; deploy takes the key either way. */
|
|
61
|
+
readonly name?: string;
|
|
62
|
+
/** Absent in the keyed form until `defineSchema` derives it from the type's key */
|
|
63
|
+
readonly displayName?: string;
|
|
64
|
+
readonly displayNamePlural?: string;
|
|
65
|
+
readonly description?: string;
|
|
66
|
+
/** AI configuration: guidance for agents reading these Records */
|
|
67
|
+
readonly ai?: AIConfig;
|
|
68
|
+
/** Field ID to use as a Record's display title */
|
|
69
|
+
readonly displayField?: string;
|
|
70
|
+
readonly accessTags?: string[];
|
|
71
|
+
/** Sets of Fields no two Records hold the same values of in one Dataset (REL-3782) */
|
|
72
|
+
readonly unique?: string[][];
|
|
73
|
+
/** How long each Record lives after its last write (REL-3775) */
|
|
74
|
+
readonly expireAfter?: RecordExpiry;
|
|
75
|
+
readonly fields: TFields;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Define a Record type: the shape of the data an app writes while it runs.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* export const inventory = defineRecordType({
|
|
82
|
+
* fields: {
|
|
83
|
+
* product: fields.reference({ required: true, to: 'product' }),
|
|
84
|
+
* stock: fields.integer({ required: true, min: 0 }),
|
|
85
|
+
* },
|
|
86
|
+
* })
|
|
87
|
+
* // Under its key in defineSchema: recordTypes: { inventory }
|
|
88
|
+
*/
|
|
89
|
+
declare function defineRecordType<R extends KeyedMembers>(config: KeyedRecordTypeConfig<R>): RecordTypeDefinition<readonly KeyedMembersOf<R>[]>;
|
|
90
|
+
/**
|
|
91
|
+
* Type alias for any Record type definition.
|
|
92
|
+
*/
|
|
93
|
+
type AnyRecordTypeDefinition = RecordTypeDefinition<any>;
|
|
94
|
+
/**
|
|
95
|
+
* A Record's values as its Record type declares them (REL-3771): a required field always present,
|
|
96
|
+
* every other one optional, each typed as a read returns it. What `records(type).create` takes.
|
|
97
|
+
*/
|
|
98
|
+
type RecordFieldsOf<T extends AnyRecordTypeDefinition> = FieldValues<DeclaredFields<T>>;
|
|
99
|
+
/**
|
|
100
|
+
* A Record's values as a write takes them (REL-3781, REL-3824): {@link RecordFieldsOf} without its
|
|
101
|
+
* Sequences, which RelyIO numbers and a create or an update that sets one is refused — and a File
|
|
102
|
+
* as the upload holding its bytes (`FileUpload`), never the address only a read answers. What
|
|
103
|
+
* `records(type).create` and `update` take.
|
|
104
|
+
*/
|
|
105
|
+
type RecordWriteFieldsOf<T extends AnyRecordTypeDefinition> = {
|
|
106
|
+
[K in keyof Omit<RecordFieldsOf<T>, SequenceIdsOf<T>>]: WrittenAs<RecordFieldsOf<T>[K]>;
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* A Record's values as an update takes them (REL-3774, REL-3765): {@link RecordWriteFieldsOf}
|
|
110
|
+
* without its Counters — a create starts one, and after that it moves only by `increment` and
|
|
111
|
+
* `decrement`, applied in the write itself; a value an update set would overwrite a move made since
|
|
112
|
+
* the read, and the server refuses it (`COUNTER_USE_INCREMENT_OR_DECREMENT`). What
|
|
113
|
+
* `records(type).update` takes.
|
|
114
|
+
*/
|
|
115
|
+
type RecordUpdateFieldsOf<T extends AnyRecordTypeDefinition> = Omit<RecordWriteFieldsOf<T>, CounterIdsOf<T>>;
|
|
116
|
+
/** The ids of a Record type's Counter fields. */
|
|
117
|
+
type CounterIdsOf<T extends AnyRecordTypeDefinition> = Extract<DeclaredFields<T>, {
|
|
118
|
+
readonly type: 'counter';
|
|
119
|
+
}>['id'];
|
|
120
|
+
/** A value as a write sends it: a File as its upload, every other value as a read answers it. */
|
|
121
|
+
type WrittenAs<V> = V extends RecordFile ? FileUpload : V;
|
|
122
|
+
/** The ids of a Record type's Sequence fields. */
|
|
123
|
+
type SequenceIdsOf<T extends AnyRecordTypeDefinition> = Extract<DeclaredFields<T>, {
|
|
124
|
+
readonly type: 'sequence';
|
|
125
|
+
}>['id'];
|
|
126
|
+
/**
|
|
127
|
+
* A Record as a read answers it: its fields, and `_metadata` — the document's `RecordMetadata`, no
|
|
128
|
+
* locale, publication or version (REL-3771).
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* type Order = InferRecordType<typeof order>
|
|
132
|
+
* // { shopperEmail: string; total: number; …; _metadata: RecordMetadata }
|
|
133
|
+
*/
|
|
134
|
+
type InferRecordType<T extends AnyRecordTypeDefinition> = RecordFieldsOf<T> & {
|
|
135
|
+
_metadata: components['schemas']['RecordMetadata'];
|
|
136
|
+
};
|
|
2
137
|
|
|
3
138
|
/**
|
|
4
139
|
* Query definition matching @relyio/schema QueryDefinitionSchema
|
|
@@ -544,6 +679,8 @@ interface SchemaConfig {
|
|
|
544
679
|
settingsGroups?: Record<string, SettingsGroupDefinition>;
|
|
545
680
|
/** Asset type definitions (optional) */
|
|
546
681
|
assetTypes?: Record<string, AssetTypeDefinition>;
|
|
682
|
+
/** Record type definitions: the data the app writes while it runs (optional, spec 1) */
|
|
683
|
+
recordTypes?: Record<string, RecordTypeDefinition>;
|
|
547
684
|
/** Custom roles for fine-grained access control, each under its id (optional) */
|
|
548
685
|
roles?: KeyedRoles;
|
|
549
686
|
/** Global workflow configuration with approval stages (optional) */
|
|
@@ -554,7 +691,7 @@ interface SchemaConfig {
|
|
|
554
691
|
/**
|
|
555
692
|
* Complete schema definition - Generic version for type inference
|
|
556
693
|
*/
|
|
557
|
-
interface SchemaDefinition<TContentTypes extends Record<string, ContentTypeDefinition> = Record<string, ContentTypeDefinition>, TSingletons extends Record<string, SingletonContentTypeDefinition> = Record<string, SingletonContentTypeDefinition>, TQueries extends Record<string, QueryDefinition> = Record<string, QueryDefinition>, TSettings extends Record<string, SettingsGroupDefinition> = Record<string, SettingsGroupDefinition>, TLocales extends readonly LocaleDefinition[] = readonly LocaleDefinition[], TRoles extends readonly RoleDefinition[] = readonly RoleDefinition[], TWorkflow extends WorkflowDefinition | undefined = WorkflowDefinition | undefined, TViews extends readonly ViewDefinition[] = readonly ViewDefinition[], TAssets extends Record<string, AssetTypeDefinition> = Record<string, AssetTypeDefinition>> {
|
|
694
|
+
interface SchemaDefinition<TContentTypes extends Record<string, ContentTypeDefinition> = Record<string, ContentTypeDefinition>, TSingletons extends Record<string, SingletonContentTypeDefinition> = Record<string, SingletonContentTypeDefinition>, TQueries extends Record<string, QueryDefinition> = Record<string, QueryDefinition>, TSettings extends Record<string, SettingsGroupDefinition> = Record<string, SettingsGroupDefinition>, TLocales extends readonly LocaleDefinition[] = readonly LocaleDefinition[], TRoles extends readonly RoleDefinition[] = readonly RoleDefinition[], TWorkflow extends WorkflowDefinition | undefined = WorkflowDefinition | undefined, TViews extends readonly ViewDefinition[] = readonly ViewDefinition[], TAssets extends Record<string, AssetTypeDefinition> = Record<string, AssetTypeDefinition>, TRecords extends Record<string, RecordTypeDefinition> = Record<string, RecordTypeDefinition>> {
|
|
558
695
|
readonly _tag: 'schema';
|
|
559
696
|
readonly locales?: TLocales;
|
|
560
697
|
readonly contentTypes: TContentTypes;
|
|
@@ -562,6 +699,7 @@ interface SchemaDefinition<TContentTypes extends Record<string, ContentTypeDefin
|
|
|
562
699
|
readonly queries: TQueries;
|
|
563
700
|
readonly settingsGroups?: TSettings;
|
|
564
701
|
readonly assetTypes?: TAssets;
|
|
702
|
+
readonly recordTypes?: TRecords;
|
|
565
703
|
readonly roles?: TRoles;
|
|
566
704
|
readonly workflow?: TWorkflow;
|
|
567
705
|
readonly views?: TViews;
|
|
@@ -569,13 +707,14 @@ interface SchemaDefinition<TContentTypes extends Record<string, ContentTypeDefin
|
|
|
569
707
|
/**
|
|
570
708
|
* Typed schema config for type inference
|
|
571
709
|
*/
|
|
572
|
-
interface TypedSchemaConfig<TContentTypes extends Record<string, ContentTypeDefinition>, TSingletons extends Record<string, SingletonContentTypeDefinition>, TQueries extends Record<string, QueryDefinition>, TSettings extends Record<string, SettingsGroupDefinition>, TLocales extends readonly LocaleDefinition[] = readonly LocaleDefinition[], TRoles extends KeyedRoles = KeyedRoles, TWorkflow extends WorkflowDefinition | undefined = WorkflowDefinition | undefined, TViews extends KeyedViews = KeyedViews, TAssets extends Record<string, AssetTypeDefinition> = Record<string, AssetTypeDefinition>> {
|
|
710
|
+
interface TypedSchemaConfig<TContentTypes extends Record<string, ContentTypeDefinition>, TSingletons extends Record<string, SingletonContentTypeDefinition>, TQueries extends Record<string, QueryDefinition>, TSettings extends Record<string, SettingsGroupDefinition>, TLocales extends readonly LocaleDefinition[] = readonly LocaleDefinition[], TRoles extends KeyedRoles = KeyedRoles, TWorkflow extends WorkflowDefinition | undefined = WorkflowDefinition | undefined, TViews extends KeyedViews = KeyedViews, TAssets extends Record<string, AssetTypeDefinition> = Record<string, AssetTypeDefinition>, TRecords extends Record<string, RecordTypeDefinition> = Record<string, RecordTypeDefinition>> {
|
|
573
711
|
locales?: TLocales;
|
|
574
712
|
contentTypes: TContentTypes;
|
|
575
713
|
singletonContentTypes?: TSingletons;
|
|
576
714
|
queries?: TQueries;
|
|
577
715
|
settingsGroups?: TSettings;
|
|
578
716
|
assetTypes?: TAssets;
|
|
717
|
+
recordTypes?: TRecords;
|
|
579
718
|
roles?: TRoles;
|
|
580
719
|
workflow?: TWorkflow;
|
|
581
720
|
views?: TViews;
|
|
@@ -615,7 +754,7 @@ interface TypedSchemaConfig<TContentTypes extends Record<string, ContentTypeDefi
|
|
|
615
754
|
* contentTypes: { product },
|
|
616
755
|
* })
|
|
617
756
|
*/
|
|
618
|
-
declare function defineSchema<TContentTypes extends Record<string, ContentTypeDefinition>, TSingletons extends Record<string, SingletonContentTypeDefinition> = Record<string, never>, TQueries extends Record<string, QueryDefinition> = Record<string, never>, TSettings extends Record<string, SettingsGroupDefinition> = Record<string, never>, TLocales extends readonly LocaleDefinition[] = readonly never[], TRoles extends KeyedRoles = Record<never, never>, TWorkflow extends WorkflowDefinition | undefined = undefined, TViews extends KeyedViews = Record<never, never>, TAssets extends Record<string, AssetTypeDefinition> = Record<string, never>>(config: TypedSchemaConfig<TContentTypes, TSingletons, TQueries, TSettings, TLocales, TRoles, TWorkflow, TViews, TAssets> & NamesChecked<TContentTypes, TSingletons, TSettings, TAssets, TLocales, TRoles, TWorkflow>): SchemaDefinition<TContentTypes, TSingletons, TQueries, TSettings, TLocales, RolesAsList<TRoles>, TWorkflow, ViewsAsList<TViews>, TAssets>;
|
|
757
|
+
declare function defineSchema<TContentTypes extends Record<string, ContentTypeDefinition>, TSingletons extends Record<string, SingletonContentTypeDefinition> = Record<string, never>, TQueries extends Record<string, QueryDefinition> = Record<string, never>, TSettings extends Record<string, SettingsGroupDefinition> = Record<string, never>, TLocales extends readonly LocaleDefinition[] = readonly never[], TRoles extends KeyedRoles = Record<never, never>, TWorkflow extends WorkflowDefinition | undefined = undefined, TViews extends KeyedViews = Record<never, never>, TAssets extends Record<string, AssetTypeDefinition> = Record<string, never>, TRecords extends Record<string, RecordTypeDefinition> = Record<string, never>>(config: TypedSchemaConfig<TContentTypes, TSingletons, TQueries, TSettings, TLocales, TRoles, TWorkflow, TViews, TAssets, TRecords> & NamesChecked<TContentTypes, TSingletons, TSettings, TAssets, TRecords, TLocales, TRoles, TWorkflow>): SchemaDefinition<TContentTypes, TSingletons, TQueries, TSettings, TLocales, RolesAsList<TRoles>, TWorkflow, ViewsAsList<TViews>, TAssets, TRecords>;
|
|
619
758
|
/**
|
|
620
759
|
* What `defineSchema` holds a schema's names to (REL-2416): each section of types against what the
|
|
621
760
|
* schema declares — a reference's `to` and rich text's `links.to` against its content, singleton and
|
|
@@ -625,7 +764,7 @@ declare function defineSchema<TContentTypes extends Record<string, ContentTypeDe
|
|
|
625
764
|
* against the built-in roles and its role keys; and a type's stages against its workflow's stage
|
|
626
765
|
* keys. Types only; `./checked-names.ts` says how.
|
|
627
766
|
*/
|
|
628
|
-
type NamesChecked<TContentTypes, TSingletons, TSettings, TAssets, TLocales, TRoles, TWorkflow> = {
|
|
767
|
+
type NamesChecked<TContentTypes, TSingletons, TSettings, TAssets, TRecords, TLocales, TRoles, TWorkflow> = {
|
|
629
768
|
readonly locales?: CheckedLocales<TLocales>;
|
|
630
769
|
readonly roles?: CheckedRoles<TRoles>;
|
|
631
770
|
readonly workflow?: CheckedWorkflow<TWorkflow, TRoles>;
|
|
@@ -633,10 +772,14 @@ type NamesChecked<TContentTypes, TSingletons, TSettings, TAssets, TLocales, TRol
|
|
|
633
772
|
readonly singletonContentTypes?: CheckedSection<TSingletons, DeclaredBy<TContentTypes, TSingletons, TAssets, TLocales, TWorkflow>>;
|
|
634
773
|
readonly settingsGroups?: CheckedSection<TSettings, DeclaredBy<TContentTypes, TSingletons, TAssets, TLocales, TWorkflow>>;
|
|
635
774
|
readonly assetTypes?: CheckedSection<TAssets, DeclaredBy<TContentTypes, TSingletons, TAssets, TLocales, TWorkflow>>;
|
|
775
|
+
readonly recordTypes?: CheckedSection<TRecords, DeclaredBy<TContentTypes, TSingletons, TAssets, TLocales, TWorkflow, TRecords>>;
|
|
636
776
|
};
|
|
637
|
-
/**
|
|
638
|
-
|
|
639
|
-
|
|
777
|
+
/**
|
|
778
|
+
* The names a schema declares, for its sections' names to be checked against. `TRecords` is the
|
|
779
|
+
* Record types a section's references may name: none for an entry type's.
|
|
780
|
+
*/
|
|
781
|
+
interface DeclaredBy<TContentTypes, TSingletons, TAssets, TLocales, TWorkflow, TRecords = never> {
|
|
782
|
+
readonly targets: KeysDeclared<TContentTypes> | KeysDeclared<TSingletons> | KeysDeclared<TAssets> | KeysDeclared<TRecords>;
|
|
640
783
|
readonly locales: LocaleCodesOf<TLocales>;
|
|
641
784
|
readonly stages: StagesDeclared<TWorkflow>;
|
|
642
785
|
}
|
|
@@ -651,7 +794,7 @@ type ViewsAsList<V extends KeyedViews> = KeyedViewsAsList<V>;
|
|
|
651
794
|
* Type alias for any schema definition.
|
|
652
795
|
* Uses `any` intentionally for type inference utilities that need to accept any schema.
|
|
653
796
|
*/
|
|
654
|
-
type AnySchemaDefinition = SchemaDefinition<any, any, any, any, any, any, any, any, any>;
|
|
797
|
+
type AnySchemaDefinition = SchemaDefinition<any, any, any, any, any, any, any, any, any, any>;
|
|
655
798
|
/**
|
|
656
799
|
* Get content type names from a schema
|
|
657
800
|
*/
|
|
@@ -688,6 +831,10 @@ type SchemaSettingsGroupNames<T extends AnySchemaDefinition> = NonNullable<T['se
|
|
|
688
831
|
* Get asset type names from a schema
|
|
689
832
|
*/
|
|
690
833
|
type SchemaAssetTypeNames<T extends AnySchemaDefinition> = NonNullable<T['assetTypes']> extends Record<string, AssetTypeDefinition> ? keyof NonNullable<T['assetTypes']> & string : never;
|
|
834
|
+
/**
|
|
835
|
+
* Get Record type names from a schema (spec 1), read through `NonNullable` as asset types are
|
|
836
|
+
*/
|
|
837
|
+
type SchemaRecordTypeNames<T extends AnySchemaDefinition> = NonNullable<T['recordTypes']> extends Record<string, RecordTypeDefinition> ? keyof NonNullable<T['recordTypes']> & string : never;
|
|
691
838
|
/**
|
|
692
839
|
* Get locale codes from a schema: the codes its locales declare, or `string` for a schema that
|
|
693
840
|
* declares none. `defineSchema` now types an absent `locales` as an empty list, so that a Field's
|
|
@@ -696,4 +843,4 @@ type SchemaAssetTypeNames<T extends AnySchemaDefinition> = NonNullable<T['assetT
|
|
|
696
843
|
*/
|
|
697
844
|
type SchemaLocaleCodes<T extends AnySchemaDefinition> = NonNullable<T['locales']> extends readonly LocaleDefinition[] ? [NonNullable<T['locales']>[number]] extends [never] ? string : NonNullable<T['locales']>[number]['code'] : never;
|
|
698
845
|
|
|
699
|
-
export { type
|
|
846
|
+
export { type AnyQueryParameters as $, type AnyRecordTypeDefinition as A, type SortCondition as B, type SortDirection as C, type IncludeDefinition as D, type IncludeRelationship as E, type FullTextSearch as F, type SelectMapping as G, type HavingOperator as H, type InferRecordType as I, type FilterDefinition as J, type KeyedRecordTypeConfig as K, type CachePolicy as L, type CachePolicyObject as M, type IncludeSubQuery as N, type IncludeSubQueries as O, type Parameterizable as P, type QueryConfig as Q, type RecordWriteFieldsOf as R, type SchemaRecordTypeNames as S, type QueryParameter as T, type QueryParameterType as U, type ViewsAsList as V, type WhereCondition as W, type QueryCardinality as X, type InferQueryResponse as Y, type InferQueryParams as Z, type QueryParameterValue as _, type SchemaContentTypeNames as a, type DeclaredParameters as a0, type SchemaEntry as b, type SchemaLocaleCodes as c, type RecordUpdateFieldsOf as d, defineSchema as e, type SchemaConfig as f, type SchemaDefinition as g, type SchemaSingletonNames as h, type SchemaQueryNames as i, type SchemaSettingsGroupNames as j, type SchemaAssetTypeNames as k, type SchemaEntryOf as l, type RolesAsList as m, defineRecordType as n, type RecordTypeDefinition as o, type RecordExpiry as p, type RecordFieldsOf as q, defineQuery as r, type QueryDefinition as s, type QueryType as t, type FetchBlock as u, type AggregateBlock as v, type SearchBlock as w, type WhereValue as x, type WhereOperator as y, type QueryScalar as z };
|
|
@@ -1,4 +1,139 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { aR as FieldMember, A as AIConfig, F as FieldValues, D as DeclaredFields, cw as components, cv as RecordFile, b as FileUpload, K as KeyedMembers, cx as DisplayFieldOf, a as KeyedMembersOf, aT as ContentTypeDefinition, aZ as SingletonContentTypeDefinition, b2 as SettingsGroupDefinition, aK as LocaleDefinition, bN as RoleDefinition, c4 as WorkflowDefinition, cm as ViewDefinition, b7 as AssetTypeDefinition, aV as InferContentType, bQ as KeyedRoles, cp as KeyedViews, cy as CheckedLocales, cz as CheckedRoles, cA as CheckedWorkflow, cB as CheckedSection, cC as KeysDeclared, cD as LocaleCodesOf, cE as StagesDeclared, bR as KeyedRolesAsList, cq as KeyedViewsAsList } from './define-content-type-fb-WCD5e.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Record type definition matching @relyio/schema RecordTypeSchema (spec 1, ADR 0023)
|
|
5
|
+
*
|
|
6
|
+
* A Record is the data an app writes while it runs — an order, a stock level, a review, a cart —
|
|
7
|
+
* declared in the schema beside the content types and deployed with them. It is live the moment it
|
|
8
|
+
* is written: no drafts, no publication, no locales, no version history. So a Record type is a
|
|
9
|
+
* content type's shape without the editorial half: no `workflow`, no `hierarchical`, and its fields
|
|
10
|
+
* take every kind but `slug` and are never `localized` (deploy refuses both:
|
|
11
|
+
* `RECORD_TYPE_SLUG_FIELD`, `RECORD_TYPE_LOCALIZED_FIELD`).
|
|
12
|
+
*
|
|
13
|
+
* A Record type's references point outward: at content types, asset types and other Record types.
|
|
14
|
+
* An entry never references a Record — a content type whose reference names a Record type fails to
|
|
15
|
+
* compile under `defineSchema`, and deploy refuses it (`REFERENCE_TO_RECORD_TYPE`).
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* A Record type's configuration in the keyed form (REL-1969), as a content type's: its key under
|
|
20
|
+
* `defineSchema({ recordTypes })` is its id — one namespace with every content, singleton, settings
|
|
21
|
+
* group and asset type id — and `fields` a record keyed by Field id. `displayName` is derived from
|
|
22
|
+
* the key when left out.
|
|
23
|
+
*/
|
|
24
|
+
interface KeyedRecordTypeConfig<R extends KeyedMembers = KeyedMembers> {
|
|
25
|
+
/** Display name shown in the UI. Derived from the type's key when left out: `orderLine` → "Order line" */
|
|
26
|
+
displayName?: string;
|
|
27
|
+
/** Plural display name shown in the UI (e.g., "Orders" for "Order"); not derived */
|
|
28
|
+
displayNamePlural?: string;
|
|
29
|
+
/** Description of the Record type */
|
|
30
|
+
description?: string;
|
|
31
|
+
/** AI configuration: guidance for agents reading these Records */
|
|
32
|
+
ai?: AIConfig;
|
|
33
|
+
/** Access tags for role-based access control */
|
|
34
|
+
accessTags?: string[];
|
|
35
|
+
/** The Field a Record's title is in lists and references: one of this type's own (REL-2416) */
|
|
36
|
+
displayField?: DisplayFieldOf<R>;
|
|
37
|
+
/**
|
|
38
|
+
* Sets of this type's own Fields no two Records hold the same values of in one Dataset (REL-3782):
|
|
39
|
+
* `[['product', 'author']]` keeps one review per product per author. One Field alone says it with
|
|
40
|
+
* `unique: true` in its own config. A Record writing values another holds is refused, naming the
|
|
41
|
+
* set and the Record holding them.
|
|
42
|
+
*/
|
|
43
|
+
unique?: ReadonlyArray<ReadonlyArray<DisplayFieldOf<R>>>;
|
|
44
|
+
/**
|
|
45
|
+
* How long each Record lives after its last write, in whole hours or days — `'36h'`, `'7d'`
|
|
46
|
+
* (REL-3775). Every write moves the deadline on, so an active Record never expires; past it, the
|
|
47
|
+
* Record is deleted as a delete would delete it. Left out, a Record lives until it is deleted.
|
|
48
|
+
*/
|
|
49
|
+
expireAfter?: RecordExpiry;
|
|
50
|
+
/** Each Field under its id, in the order the form shows them */
|
|
51
|
+
fields: R;
|
|
52
|
+
}
|
|
53
|
+
/** A whole number of hours or days: `'36h'`, `'7d'`. Deploy refuses any other form. */
|
|
54
|
+
type RecordExpiry = `${number}h` | `${number}d`;
|
|
55
|
+
/**
|
|
56
|
+
* Record type definition - preserves field types for inference
|
|
57
|
+
*/
|
|
58
|
+
interface RecordTypeDefinition<TFields extends readonly FieldMember[] = readonly FieldMember[]> {
|
|
59
|
+
readonly _tag: 'recordType';
|
|
60
|
+
/** Absent until `defineSchema` writes the type's key here; deploy takes the key either way. */
|
|
61
|
+
readonly name?: string;
|
|
62
|
+
/** Absent in the keyed form until `defineSchema` derives it from the type's key */
|
|
63
|
+
readonly displayName?: string;
|
|
64
|
+
readonly displayNamePlural?: string;
|
|
65
|
+
readonly description?: string;
|
|
66
|
+
/** AI configuration: guidance for agents reading these Records */
|
|
67
|
+
readonly ai?: AIConfig;
|
|
68
|
+
/** Field ID to use as a Record's display title */
|
|
69
|
+
readonly displayField?: string;
|
|
70
|
+
readonly accessTags?: string[];
|
|
71
|
+
/** Sets of Fields no two Records hold the same values of in one Dataset (REL-3782) */
|
|
72
|
+
readonly unique?: string[][];
|
|
73
|
+
/** How long each Record lives after its last write (REL-3775) */
|
|
74
|
+
readonly expireAfter?: RecordExpiry;
|
|
75
|
+
readonly fields: TFields;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Define a Record type: the shape of the data an app writes while it runs.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* export const inventory = defineRecordType({
|
|
82
|
+
* fields: {
|
|
83
|
+
* product: fields.reference({ required: true, to: 'product' }),
|
|
84
|
+
* stock: fields.integer({ required: true, min: 0 }),
|
|
85
|
+
* },
|
|
86
|
+
* })
|
|
87
|
+
* // Under its key in defineSchema: recordTypes: { inventory }
|
|
88
|
+
*/
|
|
89
|
+
declare function defineRecordType<R extends KeyedMembers>(config: KeyedRecordTypeConfig<R>): RecordTypeDefinition<readonly KeyedMembersOf<R>[]>;
|
|
90
|
+
/**
|
|
91
|
+
* Type alias for any Record type definition.
|
|
92
|
+
*/
|
|
93
|
+
type AnyRecordTypeDefinition = RecordTypeDefinition<any>;
|
|
94
|
+
/**
|
|
95
|
+
* A Record's values as its Record type declares them (REL-3771): a required field always present,
|
|
96
|
+
* every other one optional, each typed as a read returns it. What `records(type).create` takes.
|
|
97
|
+
*/
|
|
98
|
+
type RecordFieldsOf<T extends AnyRecordTypeDefinition> = FieldValues<DeclaredFields<T>>;
|
|
99
|
+
/**
|
|
100
|
+
* A Record's values as a write takes them (REL-3781, REL-3824): {@link RecordFieldsOf} without its
|
|
101
|
+
* Sequences, which RelyIO numbers and a create or an update that sets one is refused — and a File
|
|
102
|
+
* as the upload holding its bytes (`FileUpload`), never the address only a read answers. What
|
|
103
|
+
* `records(type).create` and `update` take.
|
|
104
|
+
*/
|
|
105
|
+
type RecordWriteFieldsOf<T extends AnyRecordTypeDefinition> = {
|
|
106
|
+
[K in keyof Omit<RecordFieldsOf<T>, SequenceIdsOf<T>>]: WrittenAs<RecordFieldsOf<T>[K]>;
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* A Record's values as an update takes them (REL-3774, REL-3765): {@link RecordWriteFieldsOf}
|
|
110
|
+
* without its Counters — a create starts one, and after that it moves only by `increment` and
|
|
111
|
+
* `decrement`, applied in the write itself; a value an update set would overwrite a move made since
|
|
112
|
+
* the read, and the server refuses it (`COUNTER_USE_INCREMENT_OR_DECREMENT`). What
|
|
113
|
+
* `records(type).update` takes.
|
|
114
|
+
*/
|
|
115
|
+
type RecordUpdateFieldsOf<T extends AnyRecordTypeDefinition> = Omit<RecordWriteFieldsOf<T>, CounterIdsOf<T>>;
|
|
116
|
+
/** The ids of a Record type's Counter fields. */
|
|
117
|
+
type CounterIdsOf<T extends AnyRecordTypeDefinition> = Extract<DeclaredFields<T>, {
|
|
118
|
+
readonly type: 'counter';
|
|
119
|
+
}>['id'];
|
|
120
|
+
/** A value as a write sends it: a File as its upload, every other value as a read answers it. */
|
|
121
|
+
type WrittenAs<V> = V extends RecordFile ? FileUpload : V;
|
|
122
|
+
/** The ids of a Record type's Sequence fields. */
|
|
123
|
+
type SequenceIdsOf<T extends AnyRecordTypeDefinition> = Extract<DeclaredFields<T>, {
|
|
124
|
+
readonly type: 'sequence';
|
|
125
|
+
}>['id'];
|
|
126
|
+
/**
|
|
127
|
+
* A Record as a read answers it: its fields, and `_metadata` — the document's `RecordMetadata`, no
|
|
128
|
+
* locale, publication or version (REL-3771).
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* type Order = InferRecordType<typeof order>
|
|
132
|
+
* // { shopperEmail: string; total: number; …; _metadata: RecordMetadata }
|
|
133
|
+
*/
|
|
134
|
+
type InferRecordType<T extends AnyRecordTypeDefinition> = RecordFieldsOf<T> & {
|
|
135
|
+
_metadata: components['schemas']['RecordMetadata'];
|
|
136
|
+
};
|
|
2
137
|
|
|
3
138
|
/**
|
|
4
139
|
* Query definition matching @relyio/schema QueryDefinitionSchema
|
|
@@ -544,6 +679,8 @@ interface SchemaConfig {
|
|
|
544
679
|
settingsGroups?: Record<string, SettingsGroupDefinition>;
|
|
545
680
|
/** Asset type definitions (optional) */
|
|
546
681
|
assetTypes?: Record<string, AssetTypeDefinition>;
|
|
682
|
+
/** Record type definitions: the data the app writes while it runs (optional, spec 1) */
|
|
683
|
+
recordTypes?: Record<string, RecordTypeDefinition>;
|
|
547
684
|
/** Custom roles for fine-grained access control, each under its id (optional) */
|
|
548
685
|
roles?: KeyedRoles;
|
|
549
686
|
/** Global workflow configuration with approval stages (optional) */
|
|
@@ -554,7 +691,7 @@ interface SchemaConfig {
|
|
|
554
691
|
/**
|
|
555
692
|
* Complete schema definition - Generic version for type inference
|
|
556
693
|
*/
|
|
557
|
-
interface SchemaDefinition<TContentTypes extends Record<string, ContentTypeDefinition> = Record<string, ContentTypeDefinition>, TSingletons extends Record<string, SingletonContentTypeDefinition> = Record<string, SingletonContentTypeDefinition>, TQueries extends Record<string, QueryDefinition> = Record<string, QueryDefinition>, TSettings extends Record<string, SettingsGroupDefinition> = Record<string, SettingsGroupDefinition>, TLocales extends readonly LocaleDefinition[] = readonly LocaleDefinition[], TRoles extends readonly RoleDefinition[] = readonly RoleDefinition[], TWorkflow extends WorkflowDefinition | undefined = WorkflowDefinition | undefined, TViews extends readonly ViewDefinition[] = readonly ViewDefinition[], TAssets extends Record<string, AssetTypeDefinition> = Record<string, AssetTypeDefinition>> {
|
|
694
|
+
interface SchemaDefinition<TContentTypes extends Record<string, ContentTypeDefinition> = Record<string, ContentTypeDefinition>, TSingletons extends Record<string, SingletonContentTypeDefinition> = Record<string, SingletonContentTypeDefinition>, TQueries extends Record<string, QueryDefinition> = Record<string, QueryDefinition>, TSettings extends Record<string, SettingsGroupDefinition> = Record<string, SettingsGroupDefinition>, TLocales extends readonly LocaleDefinition[] = readonly LocaleDefinition[], TRoles extends readonly RoleDefinition[] = readonly RoleDefinition[], TWorkflow extends WorkflowDefinition | undefined = WorkflowDefinition | undefined, TViews extends readonly ViewDefinition[] = readonly ViewDefinition[], TAssets extends Record<string, AssetTypeDefinition> = Record<string, AssetTypeDefinition>, TRecords extends Record<string, RecordTypeDefinition> = Record<string, RecordTypeDefinition>> {
|
|
558
695
|
readonly _tag: 'schema';
|
|
559
696
|
readonly locales?: TLocales;
|
|
560
697
|
readonly contentTypes: TContentTypes;
|
|
@@ -562,6 +699,7 @@ interface SchemaDefinition<TContentTypes extends Record<string, ContentTypeDefin
|
|
|
562
699
|
readonly queries: TQueries;
|
|
563
700
|
readonly settingsGroups?: TSettings;
|
|
564
701
|
readonly assetTypes?: TAssets;
|
|
702
|
+
readonly recordTypes?: TRecords;
|
|
565
703
|
readonly roles?: TRoles;
|
|
566
704
|
readonly workflow?: TWorkflow;
|
|
567
705
|
readonly views?: TViews;
|
|
@@ -569,13 +707,14 @@ interface SchemaDefinition<TContentTypes extends Record<string, ContentTypeDefin
|
|
|
569
707
|
/**
|
|
570
708
|
* Typed schema config for type inference
|
|
571
709
|
*/
|
|
572
|
-
interface TypedSchemaConfig<TContentTypes extends Record<string, ContentTypeDefinition>, TSingletons extends Record<string, SingletonContentTypeDefinition>, TQueries extends Record<string, QueryDefinition>, TSettings extends Record<string, SettingsGroupDefinition>, TLocales extends readonly LocaleDefinition[] = readonly LocaleDefinition[], TRoles extends KeyedRoles = KeyedRoles, TWorkflow extends WorkflowDefinition | undefined = WorkflowDefinition | undefined, TViews extends KeyedViews = KeyedViews, TAssets extends Record<string, AssetTypeDefinition> = Record<string, AssetTypeDefinition>> {
|
|
710
|
+
interface TypedSchemaConfig<TContentTypes extends Record<string, ContentTypeDefinition>, TSingletons extends Record<string, SingletonContentTypeDefinition>, TQueries extends Record<string, QueryDefinition>, TSettings extends Record<string, SettingsGroupDefinition>, TLocales extends readonly LocaleDefinition[] = readonly LocaleDefinition[], TRoles extends KeyedRoles = KeyedRoles, TWorkflow extends WorkflowDefinition | undefined = WorkflowDefinition | undefined, TViews extends KeyedViews = KeyedViews, TAssets extends Record<string, AssetTypeDefinition> = Record<string, AssetTypeDefinition>, TRecords extends Record<string, RecordTypeDefinition> = Record<string, RecordTypeDefinition>> {
|
|
573
711
|
locales?: TLocales;
|
|
574
712
|
contentTypes: TContentTypes;
|
|
575
713
|
singletonContentTypes?: TSingletons;
|
|
576
714
|
queries?: TQueries;
|
|
577
715
|
settingsGroups?: TSettings;
|
|
578
716
|
assetTypes?: TAssets;
|
|
717
|
+
recordTypes?: TRecords;
|
|
579
718
|
roles?: TRoles;
|
|
580
719
|
workflow?: TWorkflow;
|
|
581
720
|
views?: TViews;
|
|
@@ -615,7 +754,7 @@ interface TypedSchemaConfig<TContentTypes extends Record<string, ContentTypeDefi
|
|
|
615
754
|
* contentTypes: { product },
|
|
616
755
|
* })
|
|
617
756
|
*/
|
|
618
|
-
declare function defineSchema<TContentTypes extends Record<string, ContentTypeDefinition>, TSingletons extends Record<string, SingletonContentTypeDefinition> = Record<string, never>, TQueries extends Record<string, QueryDefinition> = Record<string, never>, TSettings extends Record<string, SettingsGroupDefinition> = Record<string, never>, TLocales extends readonly LocaleDefinition[] = readonly never[], TRoles extends KeyedRoles = Record<never, never>, TWorkflow extends WorkflowDefinition | undefined = undefined, TViews extends KeyedViews = Record<never, never>, TAssets extends Record<string, AssetTypeDefinition> = Record<string, never>>(config: TypedSchemaConfig<TContentTypes, TSingletons, TQueries, TSettings, TLocales, TRoles, TWorkflow, TViews, TAssets> & NamesChecked<TContentTypes, TSingletons, TSettings, TAssets, TLocales, TRoles, TWorkflow>): SchemaDefinition<TContentTypes, TSingletons, TQueries, TSettings, TLocales, RolesAsList<TRoles>, TWorkflow, ViewsAsList<TViews>, TAssets>;
|
|
757
|
+
declare function defineSchema<TContentTypes extends Record<string, ContentTypeDefinition>, TSingletons extends Record<string, SingletonContentTypeDefinition> = Record<string, never>, TQueries extends Record<string, QueryDefinition> = Record<string, never>, TSettings extends Record<string, SettingsGroupDefinition> = Record<string, never>, TLocales extends readonly LocaleDefinition[] = readonly never[], TRoles extends KeyedRoles = Record<never, never>, TWorkflow extends WorkflowDefinition | undefined = undefined, TViews extends KeyedViews = Record<never, never>, TAssets extends Record<string, AssetTypeDefinition> = Record<string, never>, TRecords extends Record<string, RecordTypeDefinition> = Record<string, never>>(config: TypedSchemaConfig<TContentTypes, TSingletons, TQueries, TSettings, TLocales, TRoles, TWorkflow, TViews, TAssets, TRecords> & NamesChecked<TContentTypes, TSingletons, TSettings, TAssets, TRecords, TLocales, TRoles, TWorkflow>): SchemaDefinition<TContentTypes, TSingletons, TQueries, TSettings, TLocales, RolesAsList<TRoles>, TWorkflow, ViewsAsList<TViews>, TAssets, TRecords>;
|
|
619
758
|
/**
|
|
620
759
|
* What `defineSchema` holds a schema's names to (REL-2416): each section of types against what the
|
|
621
760
|
* schema declares — a reference's `to` and rich text's `links.to` against its content, singleton and
|
|
@@ -625,7 +764,7 @@ declare function defineSchema<TContentTypes extends Record<string, ContentTypeDe
|
|
|
625
764
|
* against the built-in roles and its role keys; and a type's stages against its workflow's stage
|
|
626
765
|
* keys. Types only; `./checked-names.ts` says how.
|
|
627
766
|
*/
|
|
628
|
-
type NamesChecked<TContentTypes, TSingletons, TSettings, TAssets, TLocales, TRoles, TWorkflow> = {
|
|
767
|
+
type NamesChecked<TContentTypes, TSingletons, TSettings, TAssets, TRecords, TLocales, TRoles, TWorkflow> = {
|
|
629
768
|
readonly locales?: CheckedLocales<TLocales>;
|
|
630
769
|
readonly roles?: CheckedRoles<TRoles>;
|
|
631
770
|
readonly workflow?: CheckedWorkflow<TWorkflow, TRoles>;
|
|
@@ -633,10 +772,14 @@ type NamesChecked<TContentTypes, TSingletons, TSettings, TAssets, TLocales, TRol
|
|
|
633
772
|
readonly singletonContentTypes?: CheckedSection<TSingletons, DeclaredBy<TContentTypes, TSingletons, TAssets, TLocales, TWorkflow>>;
|
|
634
773
|
readonly settingsGroups?: CheckedSection<TSettings, DeclaredBy<TContentTypes, TSingletons, TAssets, TLocales, TWorkflow>>;
|
|
635
774
|
readonly assetTypes?: CheckedSection<TAssets, DeclaredBy<TContentTypes, TSingletons, TAssets, TLocales, TWorkflow>>;
|
|
775
|
+
readonly recordTypes?: CheckedSection<TRecords, DeclaredBy<TContentTypes, TSingletons, TAssets, TLocales, TWorkflow, TRecords>>;
|
|
636
776
|
};
|
|
637
|
-
/**
|
|
638
|
-
|
|
639
|
-
|
|
777
|
+
/**
|
|
778
|
+
* The names a schema declares, for its sections' names to be checked against. `TRecords` is the
|
|
779
|
+
* Record types a section's references may name: none for an entry type's.
|
|
780
|
+
*/
|
|
781
|
+
interface DeclaredBy<TContentTypes, TSingletons, TAssets, TLocales, TWorkflow, TRecords = never> {
|
|
782
|
+
readonly targets: KeysDeclared<TContentTypes> | KeysDeclared<TSingletons> | KeysDeclared<TAssets> | KeysDeclared<TRecords>;
|
|
640
783
|
readonly locales: LocaleCodesOf<TLocales>;
|
|
641
784
|
readonly stages: StagesDeclared<TWorkflow>;
|
|
642
785
|
}
|
|
@@ -651,7 +794,7 @@ type ViewsAsList<V extends KeyedViews> = KeyedViewsAsList<V>;
|
|
|
651
794
|
* Type alias for any schema definition.
|
|
652
795
|
* Uses `any` intentionally for type inference utilities that need to accept any schema.
|
|
653
796
|
*/
|
|
654
|
-
type AnySchemaDefinition = SchemaDefinition<any, any, any, any, any, any, any, any, any>;
|
|
797
|
+
type AnySchemaDefinition = SchemaDefinition<any, any, any, any, any, any, any, any, any, any>;
|
|
655
798
|
/**
|
|
656
799
|
* Get content type names from a schema
|
|
657
800
|
*/
|
|
@@ -688,6 +831,10 @@ type SchemaSettingsGroupNames<T extends AnySchemaDefinition> = NonNullable<T['se
|
|
|
688
831
|
* Get asset type names from a schema
|
|
689
832
|
*/
|
|
690
833
|
type SchemaAssetTypeNames<T extends AnySchemaDefinition> = NonNullable<T['assetTypes']> extends Record<string, AssetTypeDefinition> ? keyof NonNullable<T['assetTypes']> & string : never;
|
|
834
|
+
/**
|
|
835
|
+
* Get Record type names from a schema (spec 1), read through `NonNullable` as asset types are
|
|
836
|
+
*/
|
|
837
|
+
type SchemaRecordTypeNames<T extends AnySchemaDefinition> = NonNullable<T['recordTypes']> extends Record<string, RecordTypeDefinition> ? keyof NonNullable<T['recordTypes']> & string : never;
|
|
691
838
|
/**
|
|
692
839
|
* Get locale codes from a schema: the codes its locales declare, or `string` for a schema that
|
|
693
840
|
* declares none. `defineSchema` now types an absent `locales` as an empty list, so that a Field's
|
|
@@ -696,4 +843,4 @@ type SchemaAssetTypeNames<T extends AnySchemaDefinition> = NonNullable<T['assetT
|
|
|
696
843
|
*/
|
|
697
844
|
type SchemaLocaleCodes<T extends AnySchemaDefinition> = NonNullable<T['locales']> extends readonly LocaleDefinition[] ? [NonNullable<T['locales']>[number]] extends [never] ? string : NonNullable<T['locales']>[number]['code'] : never;
|
|
698
845
|
|
|
699
|
-
export { type
|
|
846
|
+
export { type AnyQueryParameters as $, type AnyRecordTypeDefinition as A, type SortCondition as B, type SortDirection as C, type IncludeDefinition as D, type IncludeRelationship as E, type FullTextSearch as F, type SelectMapping as G, type HavingOperator as H, type InferRecordType as I, type FilterDefinition as J, type KeyedRecordTypeConfig as K, type CachePolicy as L, type CachePolicyObject as M, type IncludeSubQuery as N, type IncludeSubQueries as O, type Parameterizable as P, type QueryConfig as Q, type RecordWriteFieldsOf as R, type SchemaRecordTypeNames as S, type QueryParameter as T, type QueryParameterType as U, type ViewsAsList as V, type WhereCondition as W, type QueryCardinality as X, type InferQueryResponse as Y, type InferQueryParams as Z, type QueryParameterValue as _, type SchemaContentTypeNames as a, type DeclaredParameters as a0, type SchemaEntry as b, type SchemaLocaleCodes as c, type RecordUpdateFieldsOf as d, defineSchema as e, type SchemaConfig as f, type SchemaDefinition as g, type SchemaSingletonNames as h, type SchemaQueryNames as i, type SchemaSettingsGroupNames as j, type SchemaAssetTypeNames as k, type SchemaEntryOf as l, type RolesAsList as m, defineRecordType as n, type RecordTypeDefinition as o, type RecordExpiry as p, type RecordFieldsOf as q, defineQuery as r, type QueryDefinition as s, type QueryType as t, type FetchBlock as u, type AggregateBlock as v, type SearchBlock as w, type WhereValue as x, type WhereOperator as y, type QueryScalar as z };
|
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
3
|
+
var chunkZO6QDYJG_cjs = require('../chunk-ZO6QDYJG.cjs');
|
|
4
|
+
require('../chunk-L6DXCKVQ.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, "DEV_CONTEXT_DIR", {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
10
|
+
get: function () { return chunkZO6QDYJG_cjs.DEV_CONTEXT_DIR; }
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "DEV_CONTEXT_FILE", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunkZO6QDYJG_cjs.DEV_CONTEXT_FILE; }
|
|
15
15
|
});
|
|
16
16
|
Object.defineProperty(exports, "DEV_CONTEXT_FILENAME", {
|
|
17
17
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
18
|
+
get: function () { return chunkZO6QDYJG_cjs.DEV_CONTEXT_FILENAME; }
|
|
19
19
|
});
|
|
20
20
|
Object.defineProperty(exports, "DEV_ENV", {
|
|
21
21
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
22
|
+
get: function () { return chunkZO6QDYJG_cjs.DEV_ENV; }
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "buildDevEnv", {
|
|
25
25
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
26
|
+
get: function () { return chunkZO6QDYJG_cjs.buildDevEnv; }
|
|
27
27
|
});
|
|
28
28
|
Object.defineProperty(exports, "parseDevContextFile", {
|
|
29
29
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
30
|
+
get: function () { return chunkZO6QDYJG_cjs.parseDevContextFile; }
|
|
31
31
|
});
|
|
32
32
|
Object.defineProperty(exports, "parseDevEnv", {
|
|
33
33
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
34
|
+
get: function () { return chunkZO6QDYJG_cjs.parseDevEnv; }
|
|
35
35
|
});
|
|
36
36
|
//# sourceMappingURL=index.cjs.map
|
|
37
37
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { DEV_CONTEXT_DIR, DEV_CONTEXT_FILE, DEV_CONTEXT_FILENAME, DEV_ENV, buildDevEnv, parseDevContextFile, parseDevEnv } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { DEV_CONTEXT_DIR, DEV_CONTEXT_FILE, DEV_CONTEXT_FILENAME, DEV_ENV, buildDevEnv, parseDevContextFile, parseDevEnv } from '../chunk-W2A4OTCI.js';
|
|
2
|
+
import '../chunk-DI6KFDBO.js';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
4
4
|
//# sourceMappingURL=index.js.map
|