@relyio/sdk 0.11.0 → 0.13.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 +172 -0
- package/dist/chunk-3NPPMGB6.js +1092 -0
- package/dist/{chunk-7GLDVHIH.js → chunk-6NGJXLOR.js} +65 -67
- package/dist/{chunk-4HTIU5YE.cjs → chunk-DEDIJKHY.cjs} +65 -67
- package/dist/{chunk-2TIJLV2X.js → chunk-EW23SZPX.js} +43 -65
- package/dist/{chunk-PO7CUR5U.cjs → chunk-FOSM4LMM.cjs} +42 -65
- package/dist/chunk-Z6GLWSSD.cjs +1106 -0
- package/dist/client/index.cjs +3 -3
- package/dist/client/index.d.cts +4 -4
- package/dist/client/index.d.ts +4 -4
- package/dist/client/index.js +1 -1
- package/dist/{define-schema-CVi8nwc7.d.ts → define-schema-UHViXKiv.d.ts} +33 -435
- package/dist/{define-schema-DqpipEHv.d.cts → define-schema-sWJ8Zn7C.d.cts} +33 -435
- package/dist/{define-content-type-ENAod5Ve.d.cts → include-paths-Bs5FhNw2.d.cts} +3505 -483
- package/dist/{define-content-type-ENAod5Ve.d.ts → include-paths-Cb7iPCW2.d.ts} +3505 -483
- package/dist/index--_u1nPHv.d.cts +507 -0
- package/dist/index-8DozAWsA.d.ts +507 -0
- package/dist/{index-MLAFUuco.d.cts → index-BT0L8xJj.d.cts} +139 -90
- package/dist/{index-BKEAYvvz.d.ts → index-CPjJ25R4.d.ts} +139 -90
- package/dist/index.cjs +134 -110
- package/dist/index.d.cts +44 -71
- package/dist/index.d.ts +44 -71
- package/dist/index.js +5 -28
- package/dist/markdown/index.cjs +13750 -0
- package/dist/markdown/index.d.cts +111 -0
- package/dist/markdown/index.d.ts +111 -0
- package/dist/markdown/index.js +13742 -0
- package/dist/rich-text/index.cjs +49 -0
- package/dist/rich-text/index.d.cts +3 -0
- package/dist/rich-text/index.d.ts +3 -0
- package/dist/rich-text/index.js +4 -0
- package/dist/rich-text.d-BWc-5gX1.d.cts +326 -0
- package/dist/rich-text.d-BWc-5gX1.d.ts +326 -0
- package/dist/schema/index.cjs +34 -38
- package/dist/schema/index.d.cts +15 -137
- package/dist/schema/index.d.ts +15 -137
- package/dist/schema/index.js +1 -1
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/package.json +19 -2
- package/dist/.tsbuildinfo +0 -1
- package/dist/index-BM42r4yg.d.cts +0 -860
- package/dist/index-C73cK2Tt.d.ts +0 -860
package/dist/client/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkDEDIJKHY_cjs = require('../chunk-DEDIJKHY.cjs');
|
|
4
4
|
require('../chunk-LSRPMNPT.cjs');
|
|
5
5
|
require('../chunk-TZL374LS.cjs');
|
|
6
6
|
require('../chunk-MWMSFIWN.cjs');
|
|
@@ -9,11 +9,11 @@ require('../chunk-MWMSFIWN.cjs');
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, "TypedRelyIOClient", {
|
|
11
11
|
enumerable: true,
|
|
12
|
-
get: function () { return
|
|
12
|
+
get: function () { return chunkDEDIJKHY_cjs.TypedRelyIOClient; }
|
|
13
13
|
});
|
|
14
14
|
Object.defineProperty(exports, "createClient", {
|
|
15
15
|
enumerable: true,
|
|
16
|
-
get: function () { return
|
|
16
|
+
get: function () { return chunkDEDIJKHY_cjs.createClient; }
|
|
17
17
|
});
|
|
18
18
|
//# sourceMappingURL=index.cjs.map
|
|
19
19
|
//# sourceMappingURL=index.cjs.map
|
package/dist/client/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { e as ClientSchema, R as Register, f as RegisteredSchema, d as TypedClientConfig, T as TypedRelyIOClient, c as createClient } from '../index-
|
|
2
|
-
import '../
|
|
3
|
-
import '../
|
|
4
|
-
import '../define-schema-
|
|
1
|
+
export { e as ClientSchema, R as Register, f as RegisteredSchema, d as TypedClientConfig, T as TypedRelyIOClient, c as createClient } from '../index-BT0L8xJj.cjs';
|
|
2
|
+
import '../include-paths-Bs5FhNw2.cjs';
|
|
3
|
+
import '../rich-text.d-BWc-5gX1.cjs';
|
|
4
|
+
import '../define-schema-sWJ8Zn7C.cjs';
|
|
5
5
|
import './live-visitor.js';
|
|
6
6
|
import '../dev-handshake/index.cjs';
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { e as ClientSchema, R as Register, f as RegisteredSchema, d as TypedClientConfig, T as TypedRelyIOClient, c as createClient } from '../index-
|
|
2
|
-
import '../
|
|
3
|
-
import '../
|
|
4
|
-
import '../define-schema-
|
|
1
|
+
export { e as ClientSchema, R as Register, f as RegisteredSchema, d as TypedClientConfig, T as TypedRelyIOClient, c as createClient } from '../index-CPjJ25R4.js';
|
|
2
|
+
import '../include-paths-Cb7iPCW2.js';
|
|
3
|
+
import '../rich-text.d-BWc-5gX1.js';
|
|
4
|
+
import '../define-schema-UHViXKiv.js';
|
|
5
5
|
import './live-visitor.js';
|
|
6
6
|
import '../dev-handshake/index.js';
|
package/dist/client/index.js
CHANGED
|
@@ -1,183 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Component definition matching @relyio/schema ComponentSchema
|
|
5
|
-
*
|
|
6
|
-
* Components are reusable field groups that can be embedded in content types.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
interface ComponentReusabilityMetadata {
|
|
10
|
-
/** Minimum number of usages to be considered reusable */
|
|
11
|
-
minUsageCount?: number;
|
|
12
|
-
/** Maximum complexity score */
|
|
13
|
-
maxComplexity?: number;
|
|
14
|
-
/** Recommended usage contexts */
|
|
15
|
-
recommendedUsage?: string[];
|
|
16
|
-
}
|
|
17
|
-
interface ComponentValidationMetadata {
|
|
18
|
-
/** Whether nesting of components is allowed */
|
|
19
|
-
allowNesting?: boolean;
|
|
20
|
-
/** Maximum nesting depth */
|
|
21
|
-
maxNestingDepth?: number;
|
|
22
|
-
/** How to resolve field ID conflicts */
|
|
23
|
-
conflictResolution?: 'error' | 'component-wins' | 'field-wins' | 'prefix';
|
|
24
|
-
}
|
|
25
|
-
interface ComponentMetadata {
|
|
26
|
-
reusability?: ComponentReusabilityMetadata;
|
|
27
|
-
validation?: ComponentValidationMetadata;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Component configuration. Generic over its fields, as a content type's is, so a component field
|
|
31
|
-
* reads as an object typed by them (`INV-SS-TYPES-INFERRED`).
|
|
32
|
-
*/
|
|
33
|
-
interface ComponentConfig<TFields extends readonly AnyFieldDefinition[] = FieldDefinition[]> {
|
|
34
|
-
/** Display name shown in the UI */
|
|
35
|
-
displayName?: string;
|
|
36
|
-
/** Description of the component */
|
|
37
|
-
description?: string;
|
|
38
|
-
/** AI configuration for content generation and review */
|
|
39
|
-
ai?: AIConfig;
|
|
40
|
-
/** Whether this component is deprecated */
|
|
41
|
-
deprecated?: boolean;
|
|
42
|
-
/** Component fields */
|
|
43
|
-
fields: TFields;
|
|
44
|
-
/** Component metadata for validation and reusability */
|
|
45
|
-
metadata?: ComponentMetadata;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Component definition - preserves field types for inference
|
|
49
|
-
*/
|
|
50
|
-
interface ComponentDefinition<TFields extends readonly AnyFieldDefinition[] = FieldDefinition[]> {
|
|
51
|
-
readonly _tag: 'component';
|
|
52
|
-
readonly name: string;
|
|
53
|
-
readonly displayName?: string;
|
|
54
|
-
readonly description?: string;
|
|
55
|
-
/** AI configuration for content generation and review */
|
|
56
|
-
readonly ai?: AIConfig;
|
|
57
|
-
readonly deprecated?: boolean;
|
|
58
|
-
readonly fields: TFields;
|
|
59
|
-
readonly metadata?: ComponentMetadata;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Define a reusable component (field group)
|
|
63
|
-
*
|
|
64
|
-
* @example
|
|
65
|
-
* const seoComponent = defineComponent('seoMetadata', {
|
|
66
|
-
* displayName: 'SEO Metadata',
|
|
67
|
-
* description: 'Common SEO fields for all content types',
|
|
68
|
-
* fields: [
|
|
69
|
-
* fields.shortText('metaTitle', {
|
|
70
|
-
* config: { maxLength: 60 },
|
|
71
|
-
* ui: { displayName: 'Meta Title' }
|
|
72
|
-
* }),
|
|
73
|
-
* fields.longText('metaDescription', {
|
|
74
|
-
* config: { maxLength: 160 },
|
|
75
|
-
* ui: { displayName: 'Meta Description' }
|
|
76
|
-
* }),
|
|
77
|
-
* // An image is an entry of an asset type, which a reference points at
|
|
78
|
-
* fields.reference('ogImage', {
|
|
79
|
-
* config: { to: 'productPhoto' },
|
|
80
|
-
* ui: { displayName: 'Open Graph Image' }
|
|
81
|
-
* }),
|
|
82
|
-
* ]
|
|
83
|
-
* })
|
|
84
|
-
*
|
|
85
|
-
* // Use in a content type:
|
|
86
|
-
* const product = defineContentType('product', {
|
|
87
|
-
* displayName: 'Product',
|
|
88
|
-
* fields: [
|
|
89
|
-
* fields.shortText('title', { config: { required: true } }),
|
|
90
|
-
* fields.component('seo', 'seoMetadata'), // Reference the component
|
|
91
|
-
* ]
|
|
92
|
-
* })
|
|
93
|
-
*/
|
|
94
|
-
declare function defineComponent<TFields extends readonly AnyFieldDefinition[]>(name: string, config: ComponentConfig<TFields>): ComponentDefinition<TFields>;
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Settings group definition matching @relyio/schema SettingsGroupSchema
|
|
98
|
-
*
|
|
99
|
-
* Settings groups are for project-level configuration that doesn't fit
|
|
100
|
-
* into content types (e.g., API keys, feature flags, integrations).
|
|
101
|
-
*
|
|
102
|
-
* Uses advanced TypeScript generics to preserve literal field IDs through
|
|
103
|
-
* the type system, enabling full autocomplete in SDK methods.
|
|
104
|
-
*/
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Settings group configuration - generic to preserve field types
|
|
108
|
-
*/
|
|
109
|
-
interface SettingsGroupConfig<TFields extends readonly AnyFieldDefinition[] = readonly AnyFieldDefinition[]> {
|
|
110
|
-
/** Display name shown in the UI */
|
|
111
|
-
displayName: string;
|
|
112
|
-
/** Description of the settings group */
|
|
113
|
-
description?: string;
|
|
114
|
-
/** AI configuration for content generation and review */
|
|
115
|
-
ai?: AIConfig;
|
|
116
|
-
/** Access tags for role-based access control */
|
|
117
|
-
accessTags?: string[];
|
|
118
|
-
/** Settings fields - preserves literal types */
|
|
119
|
-
fields: TFields;
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Settings group definition - preserves field types for inference
|
|
123
|
-
*/
|
|
124
|
-
interface SettingsGroupDefinition<TFields extends readonly AnyFieldDefinition[] = readonly AnyFieldDefinition[]> {
|
|
125
|
-
readonly _tag: 'settingsGroup';
|
|
126
|
-
readonly name: string;
|
|
127
|
-
readonly displayName: string;
|
|
128
|
-
readonly description?: string;
|
|
129
|
-
/** AI configuration for content generation and review */
|
|
130
|
-
readonly ai?: AIConfig;
|
|
131
|
-
readonly accessTags?: string[];
|
|
132
|
-
readonly fields: TFields;
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Define a settings group
|
|
136
|
-
*
|
|
137
|
-
* The generic type parameter preserves the literal field IDs through the type
|
|
138
|
-
* system, enabling autocomplete in SDK methods.
|
|
139
|
-
*
|
|
140
|
-
* @example
|
|
141
|
-
* const integrations = defineSettingsGroup('integrations', {
|
|
142
|
-
* displayName: 'Integrations',
|
|
143
|
-
* description: 'Third-party service integrations',
|
|
144
|
-
* fields: [
|
|
145
|
-
* fields.shortText('stripeApiKey', {
|
|
146
|
-
* config: { required: true },
|
|
147
|
-
* ui: { displayName: 'Stripe API Key' }
|
|
148
|
-
* }),
|
|
149
|
-
* fields.shortText('sendgridApiKey', {
|
|
150
|
-
* ui: { displayName: 'SendGrid API Key' }
|
|
151
|
-
* }),
|
|
152
|
-
* fields.boolean('enableAnalytics', {
|
|
153
|
-
* config: { defaultValue: true },
|
|
154
|
-
* ui: { displayName: 'Enable Analytics' }
|
|
155
|
-
* }),
|
|
156
|
-
* ]
|
|
157
|
-
* })
|
|
158
|
-
*/
|
|
159
|
-
declare function defineSettingsGroup<TFields extends readonly AnyFieldDefinition[]>(name: string, config: SettingsGroupConfig<TFields>): SettingsGroupDefinition<TFields>;
|
|
160
|
-
/**
|
|
161
|
-
* Type alias for any settings group definition.
|
|
162
|
-
*/
|
|
163
|
-
type AnySettingsGroupDefinition = SettingsGroupDefinition<any>;
|
|
164
|
-
/**
|
|
165
|
-
* What a read reports about a settings group beside its fields: the committed document's
|
|
166
|
-
* `SettingsGroupMetadata`, read through `http/api-schema.ts` rather than declared again here.
|
|
167
|
-
*
|
|
168
|
-
* It names the group by `id` and `groupId`, carries the per-locale facts and the version history
|
|
169
|
-
* of `locale`, and says when the group was last written — there is no `createdAt`. The hand-written
|
|
170
|
-
* type this replaces declared a `key`, a `groupType` and a `createdAt` the wire does not carry, and
|
|
171
|
-
* `Date` timestamps where it sends ISO 8601 strings.
|
|
172
|
-
*/
|
|
173
|
-
type SettingsGroupMetadata = components['schemas']['SettingsGroupMetadata'];
|
|
174
|
-
/**
|
|
175
|
-
* Infer the TypeScript type from a settings group definition: every field typed as a read returns it
|
|
176
|
-
* (`schema/infer-fields.ts`), plus `_metadata`. `S` is the schema, as for `InferContentType`.
|
|
177
|
-
*/
|
|
178
|
-
type InferSettingsGroup<T extends AnySettingsGroupDefinition, S extends FieldSchemaContext | undefined = undefined> = FieldValues<DeclaredFields<T>, S> & {
|
|
179
|
-
_metadata: SettingsGroupMetadata;
|
|
180
|
-
};
|
|
1
|
+
import { ao as ContentTypeDefinition, av as SingletonContentTypeDefinition, aB as SettingsGroupDefinition, be as WorkflowDefinition, bs as ViewDefinition, aG as AssetTypeDefinition, aq as InferContentType } from './include-paths-Cb7iPCW2.js';
|
|
181
2
|
|
|
182
3
|
/**
|
|
183
4
|
* Query definition matching @relyio/schema QueryDefinitionSchema
|
|
@@ -255,7 +76,12 @@ type WhereValue = string | number | boolean | (string | number | boolean)[] | Wh
|
|
|
255
76
|
type WhereCondition = Record<string, WhereValue>;
|
|
256
77
|
type SortDirection = 'asc' | 'desc';
|
|
257
78
|
type SortCondition = Record<string, SortDirection> | Record<string, SortDirection>[];
|
|
258
|
-
/**
|
|
79
|
+
/**
|
|
80
|
+
* A relationship joined by name — a reference the fetched type declares, or a reverse one another
|
|
81
|
+
* type declares to it (`reviews`) — optionally filtered, counted and aliased:
|
|
82
|
+
* `{ relationship: 'products', where: { status: 'active' }, aggregate: 'count', alias: 'productCount' }`.
|
|
83
|
+
* `relationship` is a name, with no parentheses. A `select` reads what it joins.
|
|
84
|
+
*/
|
|
259
85
|
type IncludeRelationship = {
|
|
260
86
|
relationship: string;
|
|
261
87
|
where?: WhereCondition;
|
|
@@ -269,23 +95,14 @@ type IncludeRelationship = {
|
|
|
269
95
|
alias?: string;
|
|
270
96
|
};
|
|
271
97
|
/**
|
|
272
|
-
*
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
*
|
|
276
|
-
*
|
|
98
|
+
* What a fetch includes (REL-2035). A string is an **include path**, the grammar `?include=` and the
|
|
99
|
+
* SDK's `include()` read: field ids joined by `.`, crossing lists, page builders, objects and
|
|
100
|
+
* references, each hop written out, with the fields to return in parentheses —
|
|
101
|
+
* `'sections.customers.logo'`, `'sections.features(name,slug)'`. The query returns what
|
|
102
|
+
* `GET …?include=` returns for the same paths. A path's entries are expanded after the read, so a
|
|
103
|
+
* `select` cannot read them: join a relationship for that ({@link IncludeRelationship}).
|
|
277
104
|
*/
|
|
278
|
-
type
|
|
279
|
-
path: string;
|
|
280
|
-
fields?: string[];
|
|
281
|
-
include?: (string | {
|
|
282
|
-
path: string;
|
|
283
|
-
fields?: string[];
|
|
284
|
-
where?: WhereCondition;
|
|
285
|
-
})[];
|
|
286
|
-
where?: WhereCondition;
|
|
287
|
-
};
|
|
288
|
-
type IncludeDefinition = string | string[] | (string | IncludeRelationship | IncludeSelection)[];
|
|
105
|
+
type IncludeDefinition = string | (string | IncludeRelationship)[];
|
|
289
106
|
type SelectMapping = Record<string, string>;
|
|
290
107
|
/** `filters` are `where` conditions bound at call time: the same operators, written the same way. */
|
|
291
108
|
type FilterOperator = WhereOperator;
|
|
@@ -842,223 +659,6 @@ declare function isBuiltInRole(roleId: string): roleId is BuiltInRole;
|
|
|
842
659
|
*/
|
|
843
660
|
declare function getBuiltInRoleActions(roleId: BuiltInRole): readonly RoleAction[];
|
|
844
661
|
|
|
845
|
-
/**
|
|
846
|
-
* View definitions for SDK schema
|
|
847
|
-
*
|
|
848
|
-
* Views define pre-configured entry list configurations with filters,
|
|
849
|
-
* columns, and metadata display settings.
|
|
850
|
-
*/
|
|
851
|
-
/**
|
|
852
|
-
* View scope defines which content types a view applies to.
|
|
853
|
-
*
|
|
854
|
-
* When using `contentTypes` (plural) or `all`, the view displays entries
|
|
855
|
-
* from multiple content types. In this case:
|
|
856
|
-
*
|
|
857
|
-
* - Columns/fields may only exist on some content types
|
|
858
|
-
* - For entries where a field doesn't exist, the UI displays "—"
|
|
859
|
-
* - System fields (id, status, createdAt, updatedAt) exist on all entries
|
|
860
|
-
* - Filters on non-existent fields are skipped for that entry type
|
|
861
|
-
*
|
|
862
|
-
* Example display:
|
|
863
|
-
* | Content Type | title | author | productCode |
|
|
864
|
-
* |--------------|-------|--------|-------------|
|
|
865
|
-
* | post | ✓ | ✓ | — |
|
|
866
|
-
* | product | ✓ | — | ✓ |
|
|
867
|
-
*/
|
|
868
|
-
/**
|
|
869
|
-
* Scope for a single content type
|
|
870
|
-
*/
|
|
871
|
-
interface ContentTypeScopeConfig {
|
|
872
|
-
type: 'contentType';
|
|
873
|
-
contentType: string;
|
|
874
|
-
}
|
|
875
|
-
/**
|
|
876
|
-
* Scope for multiple content types
|
|
877
|
-
*
|
|
878
|
-
* Fields not present on all content types will show "—" in the UI
|
|
879
|
-
*/
|
|
880
|
-
interface ContentTypesScopeConfig {
|
|
881
|
-
type: 'contentTypes';
|
|
882
|
-
contentTypes: string[];
|
|
883
|
-
}
|
|
884
|
-
/**
|
|
885
|
-
* Scope for an entry type (content, singleton, settings, asset)
|
|
886
|
-
*/
|
|
887
|
-
interface EntryTypeScopeConfig {
|
|
888
|
-
type: 'entryType';
|
|
889
|
-
entryType: 'content' | 'singleton' | 'settings' | 'asset';
|
|
890
|
-
}
|
|
891
|
-
/**
|
|
892
|
-
* Scope for all content
|
|
893
|
-
*
|
|
894
|
-
* Fields not present on all content types will show "—" in the UI
|
|
895
|
-
*/
|
|
896
|
-
interface AllScopeConfig {
|
|
897
|
-
type: 'all';
|
|
898
|
-
}
|
|
899
|
-
/**
|
|
900
|
-
* View scope options
|
|
901
|
-
*/
|
|
902
|
-
type ViewScopeConfig = ContentTypeScopeConfig | ContentTypesScopeConfig | EntryTypeScopeConfig | AllScopeConfig;
|
|
903
|
-
/**
|
|
904
|
-
* The operators a view filter may name: the schema's `FILTER_OPERATORS`, which deploy parses a view
|
|
905
|
-
* with and the read core compiles every one of.
|
|
906
|
-
*
|
|
907
|
-
* This list used to be its own: ten of its names — `doesNotContain`, `isNotEmpty`, `isOnOrBefore`,
|
|
908
|
-
* `isOnOrAfter`, `tomorrow`, `lastWeek`, `lastMonth`, `includesAll`, `includesAny`, `excludes` —
|
|
909
|
-
* are none the schema declares, so a view naming one was refused at deploy, and six the schema does
|
|
910
|
-
* declare — `notContains`, `notIncludes`, `isOn`, `isBetween`, `thisYear`, `hasValue` — could not be
|
|
911
|
-
* written here, so a view pulled by `relyio generate-types` that named one did not compile.
|
|
912
|
-
* `@relyio/codegen-typescript`'s `src/__tests__/sdk-definition-config.types.ts` holds the two to each
|
|
913
|
-
* other (REL-1457).
|
|
914
|
-
*/
|
|
915
|
-
type ViewFilterOperator = 'is' | 'isNot' | 'contains' | 'notContains' | 'startsWith' | 'endsWith' | 'isAnyOf' | 'isNoneOf' | 'includes' | 'notIncludes' | 'isTrue' | 'isFalse' | 'equals' | 'notEquals' | 'greaterThan' | 'lessThan' | 'greaterThanOrEqual' | 'lessThanOrEqual' | 'between' | 'isOn' | 'isBefore' | 'isAfter' | 'isBetween' | 'inTheLast' | 'inTheNext' | 'today' | 'yesterday' | 'thisWeek' | 'thisMonth' | 'thisYear' | 'isEmpty' | 'hasValue';
|
|
916
|
-
/** A span of time back or forward from now, for `inTheLast` and `inTheNext`. */
|
|
917
|
-
interface ViewFilterRelativeDate {
|
|
918
|
-
amount: number;
|
|
919
|
-
unit: 'minutes' | 'hours' | 'days' | 'weeks' | 'months' | 'years';
|
|
920
|
-
}
|
|
921
|
-
/** What a filter compares against: the schema's `FilterValueSchema`. */
|
|
922
|
-
type ViewFilterValue = string | number | boolean | null | (string | number)[] | {
|
|
923
|
-
from: string | number | Date;
|
|
924
|
-
to: string | number | Date;
|
|
925
|
-
} | ViewFilterRelativeDate | Date;
|
|
926
|
-
/**
|
|
927
|
-
* One filter of a view: a field, an operator and the value it compares with.
|
|
928
|
-
*/
|
|
929
|
-
interface ViewFilterCondition {
|
|
930
|
-
/**
|
|
931
|
-
* The Property to filter on, as the Studio's entry list names it: `fields.<id>` for a field your
|
|
932
|
-
* schema declares (`fields.seo.title` for a component's sub-field), `_metadata.<id>` for a system
|
|
933
|
-
* field — `_metadata.status`, `_metadata.createdAt`, `_metadata.updatedAt`. So a field called
|
|
934
|
-
* `status` (`fields.status`) and the entry's own lifecycle (`_metadata.status`) are both
|
|
935
|
-
* filterable.
|
|
936
|
-
*/
|
|
937
|
-
field: string;
|
|
938
|
-
/**
|
|
939
|
-
* Filter operator
|
|
940
|
-
*/
|
|
941
|
-
operator: ViewFilterOperator;
|
|
942
|
-
/**
|
|
943
|
-
* Filter value (optional for some operators like isEmpty)
|
|
944
|
-
*/
|
|
945
|
-
value?: ViewFilterValue;
|
|
946
|
-
}
|
|
947
|
-
/**
|
|
948
|
-
* A view's filter. A view's filters are a flat list joined by AND — the Filters the Studio's entry
|
|
949
|
-
* list takes, each drawn as a Chip — so there is no filter group: an OR within one field is
|
|
950
|
-
* `isAnyOf`. RelyIO refuses a group by name when you deploy.
|
|
951
|
-
*/
|
|
952
|
-
type ViewFilter = ViewFilterCondition;
|
|
953
|
-
/**
|
|
954
|
-
* View definition configuration
|
|
955
|
-
*/
|
|
956
|
-
interface ViewConfig {
|
|
957
|
-
/**
|
|
958
|
-
* Display name for the view
|
|
959
|
-
*/
|
|
960
|
-
name: string;
|
|
961
|
-
/**
|
|
962
|
-
* URL-friendly slug for the view, used in Studio URLs like /studio/views/:slug. Absent, the
|
|
963
|
-
* platform derives one from the id when it reads the schema.
|
|
964
|
-
*/
|
|
965
|
-
slug?: string;
|
|
966
|
-
/**
|
|
967
|
-
* Optional description for the view
|
|
968
|
-
*/
|
|
969
|
-
description?: string;
|
|
970
|
-
/**
|
|
971
|
-
* Icon (emoji or icon name) for the view
|
|
972
|
-
*/
|
|
973
|
-
icon?: string;
|
|
974
|
-
/**
|
|
975
|
-
* Color for the view in the sidebar
|
|
976
|
-
*/
|
|
977
|
-
color?: string;
|
|
978
|
-
/**
|
|
979
|
-
* View scope - what content types this view applies to
|
|
980
|
-
*/
|
|
981
|
-
scope: ViewScopeConfig;
|
|
982
|
-
/**
|
|
983
|
-
* Filter conditions (optional), combined with AND. A flat list: an OR within one field is
|
|
984
|
-
* `isAnyOf`, and there is no filter group.
|
|
985
|
-
*
|
|
986
|
-
* Deploy judges each against the entries the view lists: the field must be one they can be
|
|
987
|
-
* narrowed by, and it must offer the operator — a boolean field takes `is` with `true` or
|
|
988
|
-
* `false`, for example, not `isTrue`.
|
|
989
|
-
*/
|
|
990
|
-
filters?: ViewFilter[];
|
|
991
|
-
/**
|
|
992
|
-
* Column field IDs to display (optional)
|
|
993
|
-
* If not specified, uses default columns
|
|
994
|
-
*/
|
|
995
|
-
columns?: string[];
|
|
996
|
-
/**
|
|
997
|
-
* Metadata field IDs to show under title (max 3)
|
|
998
|
-
*/
|
|
999
|
-
metadataFields?: string[];
|
|
1000
|
-
/**
|
|
1001
|
-
* Default sort (optional). `field` names the Property to sort by, as a filter names one —
|
|
1002
|
-
* `fields.<id>` or `_metadata.<id>` — and deploy refuses one the view's entries cannot be sorted
|
|
1003
|
-
* by. `columns` and `metadataFields` are display settings and name field IDs as written.
|
|
1004
|
-
*/
|
|
1005
|
-
sort?: {
|
|
1006
|
-
field: string;
|
|
1007
|
-
direction: 'asc' | 'desc';
|
|
1008
|
-
};
|
|
1009
|
-
/**
|
|
1010
|
-
* Sort order in the sidebar (lower = higher priority)
|
|
1011
|
-
*/
|
|
1012
|
-
sortOrder?: number;
|
|
1013
|
-
}
|
|
1014
|
-
/**
|
|
1015
|
-
* Complete view definition with ID
|
|
1016
|
-
*/
|
|
1017
|
-
interface ViewDefinition extends ViewConfig {
|
|
1018
|
-
/**
|
|
1019
|
-
* Internal tag for type discrimination
|
|
1020
|
-
*/
|
|
1021
|
-
readonly _tag: 'view';
|
|
1022
|
-
/**
|
|
1023
|
-
* Unique view ID (must start with a letter)
|
|
1024
|
-
*/
|
|
1025
|
-
readonly id: string;
|
|
1026
|
-
}
|
|
1027
|
-
/**
|
|
1028
|
-
* Define a schema view
|
|
1029
|
-
*
|
|
1030
|
-
* Views are pre-configured entry list displays with filters,
|
|
1031
|
-
* columns, and metadata settings.
|
|
1032
|
-
*
|
|
1033
|
-
* @example
|
|
1034
|
-
* const featuredPosts = defineView('featuredPosts', {
|
|
1035
|
-
* name: 'Featured Posts',
|
|
1036
|
-
* description: 'Blog posts marked as featured',
|
|
1037
|
-
* icon: '📝',
|
|
1038
|
-
* scope: { type: 'contentType', contentType: 'post' },
|
|
1039
|
-
* filters: [
|
|
1040
|
-
* { field: 'fields.featured', operator: 'is', value: true }
|
|
1041
|
-
* ],
|
|
1042
|
-
* columns: ['title', 'author', 'publishedAt'],
|
|
1043
|
-
* metadataFields: ['category', 'views'],
|
|
1044
|
-
* sort: { field: '_metadata.publishedAt', direction: 'desc' }
|
|
1045
|
-
* })
|
|
1046
|
-
*
|
|
1047
|
-
* @example
|
|
1048
|
-
* const archivedContent = defineView('archivedContent', {
|
|
1049
|
-
* name: 'Archived',
|
|
1050
|
-
* scope: { type: 'all' },
|
|
1051
|
-
* filters: [
|
|
1052
|
-
* { field: '_metadata.status', operator: 'is', value: 'archived' }
|
|
1053
|
-
* ]
|
|
1054
|
-
* })
|
|
1055
|
-
*
|
|
1056
|
-
* @param id - Unique view ID (must start with a letter)
|
|
1057
|
-
* @param config - View configuration
|
|
1058
|
-
* @returns View definition object
|
|
1059
|
-
*/
|
|
1060
|
-
declare function defineView(id: string, config: ViewConfig): ViewDefinition;
|
|
1061
|
-
|
|
1062
662
|
/**
|
|
1063
663
|
* Schema definition matching @relyio/schema SchemaDefinitionSchema
|
|
1064
664
|
*
|
|
@@ -1071,7 +671,6 @@ declare function defineView(id: string, config: ViewConfig): ViewDefinition;
|
|
|
1071
671
|
* Matches the SchemaDefinitionSchema from @relyio/schema:
|
|
1072
672
|
* - locales: Optional array of locale definitions for multi-language support
|
|
1073
673
|
* - contentTypes: Required record of content type definitions
|
|
1074
|
-
* - components: Required record of component definitions (can be empty {})
|
|
1075
674
|
* - singletonContentTypes: Required record of singleton definitions (can be empty {})
|
|
1076
675
|
* - queries: Required record of query definitions (can be empty {})
|
|
1077
676
|
* - settingsGroups: Optional record of settings groups
|
|
@@ -1085,8 +684,6 @@ interface SchemaConfig {
|
|
|
1085
684
|
locales?: LocaleDefinition[];
|
|
1086
685
|
/** Content type definitions (required) */
|
|
1087
686
|
contentTypes: Record<string, ContentTypeDefinition>;
|
|
1088
|
-
/** Reusable component definitions (required, can be empty) */
|
|
1089
|
-
components?: Record<string, ComponentDefinition>;
|
|
1090
687
|
/** Singleton content type definitions (required, can be empty) */
|
|
1091
688
|
singletonContentTypes?: Record<string, SingletonContentTypeDefinition>;
|
|
1092
689
|
/** Predefined query definitions (required, can be empty) */
|
|
@@ -1105,11 +702,10 @@ interface SchemaConfig {
|
|
|
1105
702
|
/**
|
|
1106
703
|
* Complete schema definition - Generic version for type inference
|
|
1107
704
|
*/
|
|
1108
|
-
interface SchemaDefinition<TContentTypes extends Record<string, ContentTypeDefinition> = Record<string, ContentTypeDefinition>,
|
|
705
|
+
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>> {
|
|
1109
706
|
readonly _tag: 'schema';
|
|
1110
707
|
readonly locales?: TLocales;
|
|
1111
708
|
readonly contentTypes: TContentTypes;
|
|
1112
|
-
readonly components: TComponents;
|
|
1113
709
|
readonly singletonContentTypes: TSingletons;
|
|
1114
710
|
readonly queries: TQueries;
|
|
1115
711
|
readonly settingsGroups?: TSettings;
|
|
@@ -1121,10 +717,9 @@ interface SchemaDefinition<TContentTypes extends Record<string, ContentTypeDefin
|
|
|
1121
717
|
/**
|
|
1122
718
|
* Typed schema config for type inference
|
|
1123
719
|
*/
|
|
1124
|
-
interface TypedSchemaConfig<TContentTypes extends Record<string, ContentTypeDefinition>,
|
|
720
|
+
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 readonly RoleDefinition[] = readonly RoleDefinition[], TWorkflow extends WorkflowDefinition | undefined = WorkflowDefinition | undefined, TViews extends readonly ViewDefinition[] = readonly ViewDefinition[], TAssets extends Record<string, AssetTypeDefinition> = Record<string, AssetTypeDefinition>> {
|
|
1125
721
|
locales?: TLocales;
|
|
1126
722
|
contentTypes: TContentTypes;
|
|
1127
|
-
components?: TComponents;
|
|
1128
723
|
singletonContentTypes?: TSingletons;
|
|
1129
724
|
queries?: TQueries;
|
|
1130
725
|
settingsGroups?: TSettings;
|
|
@@ -1141,35 +736,38 @@ interface TypedSchemaConfig<TContentTypes extends Record<string, ContentTypeDefi
|
|
|
1141
736
|
* 2. Used for type inference in the SDK client
|
|
1142
737
|
*
|
|
1143
738
|
* @example
|
|
1144
|
-
* import { defineSchema, defineContentType,
|
|
739
|
+
* import { defineSchema, defineContentType, defineLocale, fields } from '@relyio/sdk/schema'
|
|
1145
740
|
*
|
|
1146
741
|
* const enUS = defineLocale('en-US', { displayName: 'English (US)', default: true })
|
|
1147
742
|
* const esES = defineLocale('es-ES', { displayName: 'Spanish', fallback: ['en-US'] })
|
|
1148
743
|
*
|
|
1149
|
-
* const seoComponent = defineComponent('seo', {
|
|
1150
|
-
* displayName: 'SEO Metadata',
|
|
1151
|
-
* fields: [
|
|
1152
|
-
* fields.shortText('metaTitle', { config: { maxLength: 60 } }),
|
|
1153
|
-
* fields.longText('metaDescription', { config: { maxLength: 160 } }),
|
|
1154
|
-
* ]
|
|
1155
|
-
* })
|
|
1156
|
-
*
|
|
1157
744
|
* const product = defineContentType('product', {
|
|
1158
745
|
* displayName: 'Product',
|
|
1159
746
|
* fields: [
|
|
1160
747
|
* fields.shortText('title', { config: { required: true }, localization: true }),
|
|
1161
748
|
* fields.decimal('price', { config: { min: 0, decimalPlaces: 2 } }),
|
|
1162
|
-
*
|
|
749
|
+
* // One value of a fieldset: `{ _type: 'seo', _key, metaTitle?, metaDescription? }`
|
|
750
|
+
* fields.object('seo', {
|
|
751
|
+
* config: {
|
|
752
|
+
* of: {
|
|
753
|
+
* id: 'seo',
|
|
754
|
+
* displayName: 'SEO Metadata',
|
|
755
|
+
* fields: [
|
|
756
|
+
* fields.shortText('metaTitle', { config: { maxLength: 60 } }),
|
|
757
|
+
* fields.longText('metaDescription', { config: { maxLength: 160 } }),
|
|
758
|
+
* ],
|
|
759
|
+
* },
|
|
760
|
+
* },
|
|
761
|
+
* }),
|
|
1163
762
|
* ]
|
|
1164
763
|
* })
|
|
1165
764
|
*
|
|
1166
765
|
* export const schema = defineSchema({
|
|
1167
766
|
* locales: [enUS, esES],
|
|
1168
767
|
* contentTypes: { product },
|
|
1169
|
-
* components: { seo: seoComponent },
|
|
1170
768
|
* })
|
|
1171
769
|
*/
|
|
1172
|
-
declare function defineSchema<TContentTypes extends Record<string, ContentTypeDefinition>,
|
|
770
|
+
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 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, never>>(config: TypedSchemaConfig<TContentTypes, TSingletons, TQueries, TSettings, TLocales, TRoles, TWorkflow, TViews, TAssets>): SchemaDefinition<TContentTypes, TSingletons, TQueries, TSettings, TLocales, TRoles, TWorkflow, TViews, TAssets>;
|
|
1173
771
|
/**
|
|
1174
772
|
* Type alias for any schema definition.
|
|
1175
773
|
* Uses `any` intentionally for type inference utilities that need to accept any schema.
|
|
@@ -1181,7 +779,7 @@ type AnySchemaDefinition = SchemaDefinition<any, any, any, any, any, any, any, a
|
|
|
1181
779
|
type SchemaContentTypeNames<T extends AnySchemaDefinition> = keyof T['contentTypes'] & string;
|
|
1182
780
|
/**
|
|
1183
781
|
* An entry of content type `K`, typed by schema `T` as a read returns it — what `content(K)` reads,
|
|
1184
|
-
* with references
|
|
782
|
+
* with references resolved against `T` (`INV-SS-TYPES-INFERRED`).
|
|
1185
783
|
*/
|
|
1186
784
|
type SchemaEntry<T extends AnySchemaDefinition, K extends SchemaContentTypeNames<T>> = InferContentType<T['contentTypes'][K], T>;
|
|
1187
785
|
/**
|
|
@@ -1216,4 +814,4 @@ type SchemaAssetTypeNames<T extends AnySchemaDefinition> = NonNullable<T['assetT
|
|
|
1216
814
|
*/
|
|
1217
815
|
type SchemaLocaleCodes<T extends AnySchemaDefinition> = NonNullable<T['locales']> extends readonly LocaleDefinition[] ? NonNullable<T['locales']>[number]['code'] : never;
|
|
1218
816
|
|
|
1219
|
-
export { type
|
|
817
|
+
export { type CachePolicyObject as $, type RoleDefinition as A, BUILT_IN_ROLES as B, defineQuery as C, type QueryDefinition as D, type QueryType as E, type FieldVisibility as F, type FullTextSearch as G, type FetchBlock as H, type AggregateBlock as I, type SearchBlock as J, type WhereValue as K, type LocaleOptions as L, type WhereOperator as M, type HavingOperator as N, type QueryScalar as O, type SortCondition as P, type QueryConfig as Q, ROLE_ACTIONS as R, type SchemaConfig as S, type TextDirection as T, type SortDirection as U, type IncludeDefinition as V, type WhereCondition as W, type IncludeRelationship as X, type SelectMapping as Y, type FilterDefinition as Z, type CachePolicy as _, type SchemaDefinition as a, type IncludeSubQuery as a0, type IncludeSubQueries as a1, type Parameterizable as a2, type QueryParameter as a3, type QueryParameterType as a4, type QueryCardinality as a5, type InferQueryResponse as a6, type InferQueryParams as a7, type FilterOperator as a8, type SchemaContentTypeNames as b, type SchemaSingletonNames as c, defineSchema as d, type SchemaQueryNames as e, type SchemaLocaleCodes as f, type SchemaSettingsGroupNames as g, type SchemaAssetTypeNames as h, type SchemaEntry as i, type SchemaEntryOf as j, defineLocale as k, isLocaleDefinition as l, getLocaleCodes as m, findDefaultLocale as n, getActiveLocales as o, buildFallbackChain as p, type LocaleDefinition as q, defineRole as r, isRoleDefinition as s, isBuiltInRole as t, getBuiltInRoleActions as u, BUILT_IN_ROLE_ACTIONS as v, type BuiltInRole as w, type RoleAction as x, type ResourcePermission as y, type RoleConfig as z };
|