@relyio/sdk 0.18.0 → 0.19.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 +20 -0
- package/dist/automations/index.cjs +18 -17
- package/dist/automations/index.d.cts +289 -8
- package/dist/automations/index.d.ts +289 -8
- package/dist/automations/index.js +3 -2
- package/dist/{chunk-ZHTJ7GXH.js → chunk-356SF5Y2.js} +84 -26
- package/dist/{chunk-ZAMAR3X2.cjs → chunk-5F3YYPLZ.cjs} +11249 -10771
- package/dist/{chunk-LSI26ZN2.cjs → chunk-DBYMG6MQ.cjs} +5 -5
- package/dist/{chunk-SHSK7UUY.cjs → chunk-NN45CSPZ.cjs} +177 -11
- package/dist/{chunk-IFKF72VJ.cjs → chunk-P23G5NXD.cjs} +122 -63
- package/dist/{chunk-W7JFHSFM.js → chunk-PZCDJFMA.js} +11249 -10772
- package/dist/{chunk-EDE2H37D.js → chunk-T7LGREB3.js} +174 -12
- package/dist/{chunk-R6E4HE7R.js → chunk-W2GRVXDG.js} +3 -3
- package/dist/client/index.cjs +4 -4
- package/dist/client/index.d.cts +4 -4
- package/dist/client/index.d.ts +4 -4
- package/dist/client/index.js +2 -2
- package/dist/{define-content-type-NEQDrvdq.d.cts → define-content-type-BZ6X8GvL.d.cts} +1324 -156
- package/dist/{define-content-type-fb-WCD5e.d.ts → define-content-type-C12jh8cY.d.ts} +1324 -156
- package/dist/{define-schema-Dlwh6l_J.d.ts → define-schema-BPlZl4a2.d.cts} +104 -3
- package/dist/{define-schema-DZhtvLiK.d.cts → define-schema-CK7TtYot.d.ts} +104 -3
- package/dist/extensions/index.cjs +26 -6
- package/dist/extensions/index.d.cts +5 -791
- package/dist/extensions/index.d.ts +5 -791
- package/dist/extensions/index.js +24 -4
- package/dist/functions/index.cjs +7 -4
- package/dist/functions/index.d.cts +4 -4
- package/dist/functions/index.d.ts +4 -4
- package/dist/functions/index.js +5 -2
- package/dist/{index-M3luH06A.d.ts → index-BxNnlc5D.d.ts} +91 -73
- package/dist/{index-C4LqrNd1.d.ts → index-C-MymZTe.d.ts} +1 -1
- package/dist/{index-DwHcL6x5.d.cts → index-D5jyIeQ5.d.cts} +91 -73
- package/dist/{index-Dnmt_UOo.d.cts → index-DN0l8RHw.d.cts} +1 -1
- package/dist/index.cjs +88 -84
- package/dist/index.d.cts +64 -14
- package/dist/index.d.ts +64 -14
- package/dist/index.js +4 -4
- package/dist/preview/index.cjs +3 -3
- package/dist/preview/index.js +1 -1
- package/dist/{register-B53i97A9.d.ts → register-BiMQKVp-.d.ts} +24 -8
- package/dist/{register-BYCs0FpF.d.cts → register-DeMsaurp.d.cts} +24 -8
- package/dist/rich-text/index.d.cts +2 -2
- package/dist/rich-text/index.d.ts +2 -2
- package/dist/schema/index.cjs +41 -40
- package/dist/schema/index.d.cts +7 -120
- package/dist/schema/index.d.ts +7 -120
- package/dist/schema/index.js +2 -1
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,49 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cK as ConditionTree, aS as FieldMember, A as AIConfig, an as FieldValues, ao as DeclaredFields, cR as components, cy as RecordFile, cx as FileUpload, r as KeyedMembers, cS as DisplayFieldOf, s as KeyedMembersOf, aV as ContentTypeDefinition, a$ as SingletonContentTypeDefinition, b4 as SettingsGroupDefinition, aL as LocaleDefinition, bP as RoleDefinition, c6 as WorkflowDefinition, co as ViewDefinition, b9 as AssetTypeDefinition, aX as InferContentType, bS as KeyedRoles, cr as KeyedViews, cT as CheckedLocales, cU as CheckedRoles, cV as CheckedWorkflow, cW as CheckedSection, cX as KeysDeclared, cY as ContributedRecordType, cZ as LocaleCodesOf, c_ as StagesDeclared, bT as KeyedRolesAsList, cs as KeyedViewsAsList } from './define-content-type-BZ6X8GvL.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A Record type's End-user Policies (spec 4, REL-3883, ADR 0027): what the End users of a
|
|
5
|
+
* customer's app — and anonymous visitors — may do with the type's Records, action by action.
|
|
6
|
+
*
|
|
7
|
+
* A rule is one of three names or a condition:
|
|
8
|
+
*
|
|
9
|
+
* - `'owner'` — the End user the Record's Owner field names, and no one else. The type must declare
|
|
10
|
+
* an Owner field (`fields.owner()`), and a visitor with no token is never one.
|
|
11
|
+
* - `'signedIn'` — any End user, whoever owns the Record; never a visitor.
|
|
12
|
+
* - `'anyone'` — every End user and every visitor.
|
|
13
|
+
* - a condition tree (`@relyio/schema/lists`) over three roots: `record.*` — the Record's own
|
|
14
|
+
* fields, compiled against the stored Records — and the two the asker supplies, `owner` (the End
|
|
15
|
+
* user's subject, absent for a visitor, so `owner.exists()` is "signed in") and `claims.*` (what
|
|
16
|
+
* their token claims). A condition holds of anyone it admits, a visitor included.
|
|
17
|
+
*
|
|
18
|
+
* An action with no rule gives End users and visitors nothing of the type: a type that declares no
|
|
19
|
+
* `endUsers` is closed to them, so adding a Record type never exposes it by accident. A write
|
|
20
|
+
* (`create`, `update`, `delete`) is a rule too, or for `create` and `update` `{ when, fields }`:
|
|
21
|
+
* who may, and which fields they may set (REL-3885 declares the shape and its deploy refusals,
|
|
22
|
+
* {@link endUserPolicyFaults}; REL-3884 enforces it). Every backend reads the declaration through the
|
|
23
|
+
* `endUserPolicies` projection, never from here.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/** The rules a Policy may name rather than spell as a condition. */
|
|
27
|
+
declare const NAMED_POLICY_RULES: readonly ['owner', 'signedIn', 'anyone'];
|
|
28
|
+
type NamedPolicyRule = (typeof NAMED_POLICY_RULES)[number];
|
|
29
|
+
/** One action's rule: a name, or a condition over the Record and the asker. */
|
|
30
|
+
type PolicyRule = NamedPolicyRule | ConditionTree;
|
|
31
|
+
/** A write rule naming the fields an End user may set: who may (`when`), and which (`fields`). */
|
|
32
|
+
interface FieldsWriteRule {
|
|
33
|
+
readonly when: PolicyRule;
|
|
34
|
+
readonly fields: readonly string[];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A `create` or `update` rule: a rule alone — the End users it admits set any field an End user may
|
|
38
|
+
* set — or `{ when, fields }`, naming the fields.
|
|
39
|
+
*/
|
|
40
|
+
type WriteRule = PolicyRule | FieldsWriteRule;
|
|
41
|
+
/**
|
|
42
|
+
* What a Record type does with an End user's Records when the identity source reports them deleted
|
|
43
|
+
* (spec 4): `keep` them, or `delete` them through the pipeline. Only a type with an owner field.
|
|
44
|
+
*/
|
|
45
|
+
declare const OWNER_DELETED_ACTIONS: readonly ['keep', 'delete'];
|
|
46
|
+
type OwnerDeletedAction = (typeof OWNER_DELETED_ACTIONS)[number];
|
|
2
47
|
|
|
3
48
|
/**
|
|
4
49
|
* Record type definition matching @relyio/schema RecordTypeSchema (spec 1, ADR 0023)
|
|
@@ -47,9 +92,61 @@ interface KeyedRecordTypeConfig<R extends KeyedMembers = KeyedMembers> {
|
|
|
47
92
|
* Record is deleted as a delete would delete it. Left out, a Record lives until it is deleted.
|
|
48
93
|
*/
|
|
49
94
|
expireAfter?: RecordExpiry;
|
|
95
|
+
/**
|
|
96
|
+
* What the End users of your app — and anonymous visitors with your publishable key — may do with
|
|
97
|
+
* this type's Records (spec 4, REL-3883). Left out, they read nothing of it: your server reads
|
|
98
|
+
* every Record with a secret key, as it always did.
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* endUsers: { read: 'owner' } // each End user lists and gets only the Records they own
|
|
102
|
+
* endUsers: { read: conditionRoot('record').status.eq('visible') } // anyone, visible ones only
|
|
103
|
+
* endUsers: { update: { when: 'owner', fields: ['note'] } } // an owner changes the note alone
|
|
104
|
+
*/
|
|
105
|
+
endUsers?: RecordTypeEndUsers<DisplayFieldOf<R>>;
|
|
106
|
+
/**
|
|
107
|
+
* What becomes of an End user's Records when your identity source reports them deleted — Clerk's
|
|
108
|
+
* `user.deleted` (spec 4): `'keep'` them, or `'delete'` them. Only a type with `fields.owner()`.
|
|
109
|
+
*/
|
|
110
|
+
onOwnerDeleted?: OwnerDeletedAction;
|
|
50
111
|
/** Each Field under its id, in the order the form shows them */
|
|
51
112
|
fields: R;
|
|
52
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* A Record type's End-user Policies (spec 4, REL-3883), action by action. A rule is `'owner'` — the
|
|
116
|
+
* End user the type's `fields.owner()` names; `'signedIn'` — any End user; `'anyone'` — every End
|
|
117
|
+
* user and visitor; or a condition over `record.*` (the Record's fields), `owner` (the End user's
|
|
118
|
+
* subject, absent for a visitor) and `claims.*` (what their token claims), built with
|
|
119
|
+
* `conditionRoot`, `and`, `or` and `not`.
|
|
120
|
+
*/
|
|
121
|
+
interface RecordTypeEndUsers<F extends string = string> {
|
|
122
|
+
/** Who may list, count, facet and get the Records. Left out, End users and visitors may not. */
|
|
123
|
+
readonly read?: PolicyRule;
|
|
124
|
+
/**
|
|
125
|
+
* Who may create a Record — a rule, or `{ when, fields }` naming the fields they may set, each one
|
|
126
|
+
* of this type's own. Never `'anyone'`, and never an owner, sequence, counter or Private field in
|
|
127
|
+
* `fields`. Left out, End users create none. RelyIO sets the owner from the End user's token.
|
|
128
|
+
*/
|
|
129
|
+
readonly create?: RecordWriteRule<F>;
|
|
130
|
+
/** Who may update a Record, asked of it as stored, as `create`. Left out, End users update none. */
|
|
131
|
+
readonly update?: RecordWriteRule<F>;
|
|
132
|
+
/** Who may delete a Record, asked of it as stored. Never `'anyone'`. Left out, none. */
|
|
133
|
+
readonly delete?: PolicyRule;
|
|
134
|
+
/**
|
|
135
|
+
* How many writes a minute one End user makes to the type (REL-3884): 60 when left out. Over it,
|
|
136
|
+
* a write is refused `RATE_LIMIT_EXCEEDED` with `Retry-After`, before anything is written.
|
|
137
|
+
*/
|
|
138
|
+
readonly perUser?: {
|
|
139
|
+
readonly writesPerMinute: number;
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* A `create` or `update` rule whose `fields` name this type's own Fields (REL-3884): the schema's
|
|
144
|
+
* `WriteRule`, checked as you type.
|
|
145
|
+
*/
|
|
146
|
+
type RecordWriteRule<F extends string = string> = PolicyRule | {
|
|
147
|
+
readonly when: PolicyRule;
|
|
148
|
+
readonly fields: readonly F[];
|
|
149
|
+
};
|
|
53
150
|
/** A whole number of hours or days: `'36h'`, `'7d'`. Deploy refuses any other form. */
|
|
54
151
|
type RecordExpiry = `${number}h` | `${number}d`;
|
|
55
152
|
/**
|
|
@@ -72,6 +169,10 @@ interface RecordTypeDefinition<TFields extends readonly FieldMember[] = readonly
|
|
|
72
169
|
readonly unique?: string[][];
|
|
73
170
|
/** How long each Record lives after its last write (REL-3775) */
|
|
74
171
|
readonly expireAfter?: RecordExpiry;
|
|
172
|
+
/** What End users and visitors may do with the Records (REL-3883) */
|
|
173
|
+
readonly endUsers?: RecordTypeEndUsers;
|
|
174
|
+
/** What becomes of an End user's Records when they are deleted (spec 4) */
|
|
175
|
+
readonly onOwnerDeleted?: OwnerDeletedAction;
|
|
75
176
|
readonly fields: TFields;
|
|
76
177
|
}
|
|
77
178
|
/**
|
|
@@ -779,7 +880,7 @@ type NamesChecked<TContentTypes, TSingletons, TSettings, TAssets, TRecords, TLoc
|
|
|
779
880
|
* Record types a section's references may name: none for an entry type's.
|
|
780
881
|
*/
|
|
781
882
|
interface DeclaredBy<TContentTypes, TSingletons, TAssets, TLocales, TWorkflow, TRecords = never> {
|
|
782
|
-
readonly targets: KeysDeclared<TContentTypes> | KeysDeclared<TSingletons> | KeysDeclared<TAssets> | KeysDeclared<TRecords
|
|
883
|
+
readonly targets: KeysDeclared<TContentTypes> | KeysDeclared<TSingletons> | KeysDeclared<TAssets> | KeysDeclared<TRecords> | ([TRecords] extends [never] ? never : ContributedRecordType);
|
|
783
884
|
readonly locales: LocaleCodesOf<TLocales>;
|
|
784
885
|
readonly stages: StagesDeclared<TWorkflow>;
|
|
785
886
|
}
|
|
@@ -843,4 +944,4 @@ type SchemaRecordTypeNames<T extends AnySchemaDefinition> = NonNullable<T['recor
|
|
|
843
944
|
*/
|
|
844
945
|
type SchemaLocaleCodes<T extends AnySchemaDefinition> = NonNullable<T['locales']> extends readonly LocaleDefinition[] ? [NonNullable<T['locales']>[number]] extends [never] ? string : NonNullable<T['locales']>[number]['code'] : never;
|
|
845
946
|
|
|
846
|
-
export { type
|
|
947
|
+
export { type Parameterizable as $, type AnyRecordTypeDefinition as A, type WhereCondition as B, type WhereValue as C, type WhereOperator as D, type QueryScalar as E, type FieldsWriteRule as F, type SortCondition as G, type HavingOperator as H, type InferRecordType as I, type SortDirection as J, type KeyedRecordTypeConfig as K, type IncludeDefinition as L, type IncludeRelationship as M, type NamedPolicyRule as N, type OwnerDeletedAction as O, type PolicyRule as P, type QueryConfig as Q, type RolesAsList as R, type SchemaConfig as S, type SelectMapping as T, type FilterDefinition as U, type ViewsAsList as V, type WriteRule as W, type CachePolicy as X, type CachePolicyObject as Y, type IncludeSubQuery as Z, type IncludeSubQueries as _, type SchemaDefinition as a, type QueryParameter as a0, type QueryParameterType as a1, type QueryCardinality as a2, type InferQueryResponse as a3, type InferQueryParams as a4, type QueryParameterValue as a5, type AnyQueryParameters as a6, type DeclaredParameters as a7, 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 SchemaRecordTypeNames as i, type SchemaEntry as j, type SchemaEntryOf as k, defineRecordType as l, type RecordTypeDefinition as m, type RecordExpiry as n, type RecordFieldsOf as o, type RecordTypeEndUsers as p, type RecordUpdateFieldsOf as q, type RecordWriteFieldsOf as r, type RecordWriteRule as s, defineQuery as t, type QueryDefinition as u, type QueryType as v, type FullTextSearch as w, type FetchBlock as x, type AggregateBlock as y, type SearchBlock as z };
|
|
@@ -1,4 +1,49 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cK as ConditionTree, aS as FieldMember, A as AIConfig, an as FieldValues, ao as DeclaredFields, cR as components, cy as RecordFile, cx as FileUpload, r as KeyedMembers, cS as DisplayFieldOf, s as KeyedMembersOf, aV as ContentTypeDefinition, a$ as SingletonContentTypeDefinition, b4 as SettingsGroupDefinition, aL as LocaleDefinition, bP as RoleDefinition, c6 as WorkflowDefinition, co as ViewDefinition, b9 as AssetTypeDefinition, aX as InferContentType, bS as KeyedRoles, cr as KeyedViews, cT as CheckedLocales, cU as CheckedRoles, cV as CheckedWorkflow, cW as CheckedSection, cX as KeysDeclared, cY as ContributedRecordType, cZ as LocaleCodesOf, c_ as StagesDeclared, bT as KeyedRolesAsList, cs as KeyedViewsAsList } from './define-content-type-C12jh8cY.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A Record type's End-user Policies (spec 4, REL-3883, ADR 0027): what the End users of a
|
|
5
|
+
* customer's app — and anonymous visitors — may do with the type's Records, action by action.
|
|
6
|
+
*
|
|
7
|
+
* A rule is one of three names or a condition:
|
|
8
|
+
*
|
|
9
|
+
* - `'owner'` — the End user the Record's Owner field names, and no one else. The type must declare
|
|
10
|
+
* an Owner field (`fields.owner()`), and a visitor with no token is never one.
|
|
11
|
+
* - `'signedIn'` — any End user, whoever owns the Record; never a visitor.
|
|
12
|
+
* - `'anyone'` — every End user and every visitor.
|
|
13
|
+
* - a condition tree (`@relyio/schema/lists`) over three roots: `record.*` — the Record's own
|
|
14
|
+
* fields, compiled against the stored Records — and the two the asker supplies, `owner` (the End
|
|
15
|
+
* user's subject, absent for a visitor, so `owner.exists()` is "signed in") and `claims.*` (what
|
|
16
|
+
* their token claims). A condition holds of anyone it admits, a visitor included.
|
|
17
|
+
*
|
|
18
|
+
* An action with no rule gives End users and visitors nothing of the type: a type that declares no
|
|
19
|
+
* `endUsers` is closed to them, so adding a Record type never exposes it by accident. A write
|
|
20
|
+
* (`create`, `update`, `delete`) is a rule too, or for `create` and `update` `{ when, fields }`:
|
|
21
|
+
* who may, and which fields they may set (REL-3885 declares the shape and its deploy refusals,
|
|
22
|
+
* {@link endUserPolicyFaults}; REL-3884 enforces it). Every backend reads the declaration through the
|
|
23
|
+
* `endUserPolicies` projection, never from here.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/** The rules a Policy may name rather than spell as a condition. */
|
|
27
|
+
declare const NAMED_POLICY_RULES: readonly ['owner', 'signedIn', 'anyone'];
|
|
28
|
+
type NamedPolicyRule = (typeof NAMED_POLICY_RULES)[number];
|
|
29
|
+
/** One action's rule: a name, or a condition over the Record and the asker. */
|
|
30
|
+
type PolicyRule = NamedPolicyRule | ConditionTree;
|
|
31
|
+
/** A write rule naming the fields an End user may set: who may (`when`), and which (`fields`). */
|
|
32
|
+
interface FieldsWriteRule {
|
|
33
|
+
readonly when: PolicyRule;
|
|
34
|
+
readonly fields: readonly string[];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A `create` or `update` rule: a rule alone — the End users it admits set any field an End user may
|
|
38
|
+
* set — or `{ when, fields }`, naming the fields.
|
|
39
|
+
*/
|
|
40
|
+
type WriteRule = PolicyRule | FieldsWriteRule;
|
|
41
|
+
/**
|
|
42
|
+
* What a Record type does with an End user's Records when the identity source reports them deleted
|
|
43
|
+
* (spec 4): `keep` them, or `delete` them through the pipeline. Only a type with an owner field.
|
|
44
|
+
*/
|
|
45
|
+
declare const OWNER_DELETED_ACTIONS: readonly ['keep', 'delete'];
|
|
46
|
+
type OwnerDeletedAction = (typeof OWNER_DELETED_ACTIONS)[number];
|
|
2
47
|
|
|
3
48
|
/**
|
|
4
49
|
* Record type definition matching @relyio/schema RecordTypeSchema (spec 1, ADR 0023)
|
|
@@ -47,9 +92,61 @@ interface KeyedRecordTypeConfig<R extends KeyedMembers = KeyedMembers> {
|
|
|
47
92
|
* Record is deleted as a delete would delete it. Left out, a Record lives until it is deleted.
|
|
48
93
|
*/
|
|
49
94
|
expireAfter?: RecordExpiry;
|
|
95
|
+
/**
|
|
96
|
+
* What the End users of your app — and anonymous visitors with your publishable key — may do with
|
|
97
|
+
* this type's Records (spec 4, REL-3883). Left out, they read nothing of it: your server reads
|
|
98
|
+
* every Record with a secret key, as it always did.
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* endUsers: { read: 'owner' } // each End user lists and gets only the Records they own
|
|
102
|
+
* endUsers: { read: conditionRoot('record').status.eq('visible') } // anyone, visible ones only
|
|
103
|
+
* endUsers: { update: { when: 'owner', fields: ['note'] } } // an owner changes the note alone
|
|
104
|
+
*/
|
|
105
|
+
endUsers?: RecordTypeEndUsers<DisplayFieldOf<R>>;
|
|
106
|
+
/**
|
|
107
|
+
* What becomes of an End user's Records when your identity source reports them deleted — Clerk's
|
|
108
|
+
* `user.deleted` (spec 4): `'keep'` them, or `'delete'` them. Only a type with `fields.owner()`.
|
|
109
|
+
*/
|
|
110
|
+
onOwnerDeleted?: OwnerDeletedAction;
|
|
50
111
|
/** Each Field under its id, in the order the form shows them */
|
|
51
112
|
fields: R;
|
|
52
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* A Record type's End-user Policies (spec 4, REL-3883), action by action. A rule is `'owner'` — the
|
|
116
|
+
* End user the type's `fields.owner()` names; `'signedIn'` — any End user; `'anyone'` — every End
|
|
117
|
+
* user and visitor; or a condition over `record.*` (the Record's fields), `owner` (the End user's
|
|
118
|
+
* subject, absent for a visitor) and `claims.*` (what their token claims), built with
|
|
119
|
+
* `conditionRoot`, `and`, `or` and `not`.
|
|
120
|
+
*/
|
|
121
|
+
interface RecordTypeEndUsers<F extends string = string> {
|
|
122
|
+
/** Who may list, count, facet and get the Records. Left out, End users and visitors may not. */
|
|
123
|
+
readonly read?: PolicyRule;
|
|
124
|
+
/**
|
|
125
|
+
* Who may create a Record — a rule, or `{ when, fields }` naming the fields they may set, each one
|
|
126
|
+
* of this type's own. Never `'anyone'`, and never an owner, sequence, counter or Private field in
|
|
127
|
+
* `fields`. Left out, End users create none. RelyIO sets the owner from the End user's token.
|
|
128
|
+
*/
|
|
129
|
+
readonly create?: RecordWriteRule<F>;
|
|
130
|
+
/** Who may update a Record, asked of it as stored, as `create`. Left out, End users update none. */
|
|
131
|
+
readonly update?: RecordWriteRule<F>;
|
|
132
|
+
/** Who may delete a Record, asked of it as stored. Never `'anyone'`. Left out, none. */
|
|
133
|
+
readonly delete?: PolicyRule;
|
|
134
|
+
/**
|
|
135
|
+
* How many writes a minute one End user makes to the type (REL-3884): 60 when left out. Over it,
|
|
136
|
+
* a write is refused `RATE_LIMIT_EXCEEDED` with `Retry-After`, before anything is written.
|
|
137
|
+
*/
|
|
138
|
+
readonly perUser?: {
|
|
139
|
+
readonly writesPerMinute: number;
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* A `create` or `update` rule whose `fields` name this type's own Fields (REL-3884): the schema's
|
|
144
|
+
* `WriteRule`, checked as you type.
|
|
145
|
+
*/
|
|
146
|
+
type RecordWriteRule<F extends string = string> = PolicyRule | {
|
|
147
|
+
readonly when: PolicyRule;
|
|
148
|
+
readonly fields: readonly F[];
|
|
149
|
+
};
|
|
53
150
|
/** A whole number of hours or days: `'36h'`, `'7d'`. Deploy refuses any other form. */
|
|
54
151
|
type RecordExpiry = `${number}h` | `${number}d`;
|
|
55
152
|
/**
|
|
@@ -72,6 +169,10 @@ interface RecordTypeDefinition<TFields extends readonly FieldMember[] = readonly
|
|
|
72
169
|
readonly unique?: string[][];
|
|
73
170
|
/** How long each Record lives after its last write (REL-3775) */
|
|
74
171
|
readonly expireAfter?: RecordExpiry;
|
|
172
|
+
/** What End users and visitors may do with the Records (REL-3883) */
|
|
173
|
+
readonly endUsers?: RecordTypeEndUsers;
|
|
174
|
+
/** What becomes of an End user's Records when they are deleted (spec 4) */
|
|
175
|
+
readonly onOwnerDeleted?: OwnerDeletedAction;
|
|
75
176
|
readonly fields: TFields;
|
|
76
177
|
}
|
|
77
178
|
/**
|
|
@@ -779,7 +880,7 @@ type NamesChecked<TContentTypes, TSingletons, TSettings, TAssets, TRecords, TLoc
|
|
|
779
880
|
* Record types a section's references may name: none for an entry type's.
|
|
780
881
|
*/
|
|
781
882
|
interface DeclaredBy<TContentTypes, TSingletons, TAssets, TLocales, TWorkflow, TRecords = never> {
|
|
782
|
-
readonly targets: KeysDeclared<TContentTypes> | KeysDeclared<TSingletons> | KeysDeclared<TAssets> | KeysDeclared<TRecords
|
|
883
|
+
readonly targets: KeysDeclared<TContentTypes> | KeysDeclared<TSingletons> | KeysDeclared<TAssets> | KeysDeclared<TRecords> | ([TRecords] extends [never] ? never : ContributedRecordType);
|
|
783
884
|
readonly locales: LocaleCodesOf<TLocales>;
|
|
784
885
|
readonly stages: StagesDeclared<TWorkflow>;
|
|
785
886
|
}
|
|
@@ -843,4 +944,4 @@ type SchemaRecordTypeNames<T extends AnySchemaDefinition> = NonNullable<T['recor
|
|
|
843
944
|
*/
|
|
844
945
|
type SchemaLocaleCodes<T extends AnySchemaDefinition> = NonNullable<T['locales']> extends readonly LocaleDefinition[] ? [NonNullable<T['locales']>[number]] extends [never] ? string : NonNullable<T['locales']>[number]['code'] : never;
|
|
845
946
|
|
|
846
|
-
export { type
|
|
947
|
+
export { type Parameterizable as $, type AnyRecordTypeDefinition as A, type WhereCondition as B, type WhereValue as C, type WhereOperator as D, type QueryScalar as E, type FieldsWriteRule as F, type SortCondition as G, type HavingOperator as H, type InferRecordType as I, type SortDirection as J, type KeyedRecordTypeConfig as K, type IncludeDefinition as L, type IncludeRelationship as M, type NamedPolicyRule as N, type OwnerDeletedAction as O, type PolicyRule as P, type QueryConfig as Q, type RolesAsList as R, type SchemaConfig as S, type SelectMapping as T, type FilterDefinition as U, type ViewsAsList as V, type WriteRule as W, type CachePolicy as X, type CachePolicyObject as Y, type IncludeSubQuery as Z, type IncludeSubQueries as _, type SchemaDefinition as a, type QueryParameter as a0, type QueryParameterType as a1, type QueryCardinality as a2, type InferQueryResponse as a3, type InferQueryParams as a4, type QueryParameterValue as a5, type AnyQueryParameters as a6, type DeclaredParameters as a7, 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 SchemaRecordTypeNames as i, type SchemaEntry as j, type SchemaEntryOf as k, defineRecordType as l, type RecordTypeDefinition as m, type RecordExpiry as n, type RecordFieldsOf as o, type RecordTypeEndUsers as p, type RecordUpdateFieldsOf as q, type RecordWriteFieldsOf as r, type RecordWriteRule as s, defineQuery as t, type QueryDefinition as u, type QueryType as v, type FullTextSearch as w, type FetchBlock as x, type AggregateBlock as y, type SearchBlock as z };
|
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
var
|
|
3
|
+
var chunkDBYMG6MQ_cjs = require('../chunk-DBYMG6MQ.cjs');
|
|
4
|
+
var chunk5F3YYPLZ_cjs = require('../chunk-5F3YYPLZ.cjs');
|
|
5
|
+
var chunkNN45CSPZ_cjs = require('../chunk-NN45CSPZ.cjs');
|
|
6
6
|
var chunkL6DXCKVQ_cjs = require('../chunk-L6DXCKVQ.cjs');
|
|
7
7
|
|
|
8
8
|
/* RelyIO SDK - Built with ❤️ by the RelyIO Team */
|
|
9
9
|
|
|
10
10
|
// src/extensions/index.ts
|
|
11
11
|
var DECLARED = "declared";
|
|
12
|
-
var SURFACES =
|
|
12
|
+
var SURFACES = chunkNN45CSPZ_cjs.EXTENSION_SURFACES;
|
|
13
|
+
function fieldKindBuilder(slug, name, kind) {
|
|
14
|
+
return (options = {}) => {
|
|
15
|
+
const ui = options.ui;
|
|
16
|
+
const widget = typeof ui === "object" && ui !== null ? ui : {};
|
|
17
|
+
return chunk5F3YYPLZ_cjs.keyedField("reference", {
|
|
18
|
+
...options,
|
|
19
|
+
to: kind.base.to,
|
|
20
|
+
ui: { ...widget, [chunkNN45CSPZ_cjs.CONTRIBUTED_FIELD_KIND_OPTION]: chunkNN45CSPZ_cjs.contributedFieldKindName(slug, name) }
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
chunkL6DXCKVQ_cjs.__name(fieldKindBuilder, "fieldKindBuilder");
|
|
13
25
|
function handleOf(slug) {
|
|
14
26
|
const surface = SURFACES[slug];
|
|
15
27
|
if (surface === void 0) {
|
|
@@ -27,9 +39,17 @@ function handleOf(slug) {
|
|
|
27
39
|
...Object.fromEntries(
|
|
28
40
|
Object.entries(surface.triggers).map(([name, { trigger }]) => [
|
|
29
41
|
name,
|
|
30
|
-
(options) =>
|
|
42
|
+
(options) => chunkDBYMG6MQ_cjs.extensionTrigger(slug, trigger, options)
|
|
31
43
|
])
|
|
32
|
-
)
|
|
44
|
+
),
|
|
45
|
+
...Object.fromEntries(
|
|
46
|
+
Object.entries(surface.fieldKinds).map(([name, kind]) => [
|
|
47
|
+
name,
|
|
48
|
+
fieldKindBuilder(slug, name, kind)
|
|
49
|
+
])
|
|
50
|
+
),
|
|
51
|
+
// Its Managed Record types, by name: `clerk.user` is `'clerkUser'` (REL-3863)
|
|
52
|
+
...surface.recordTypes
|
|
33
53
|
};
|
|
34
54
|
}
|
|
35
55
|
chunkL6DXCKVQ_cjs.__name(handleOf, "handleOf");
|