@relyio/sdk 0.18.0 → 0.20.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 +30 -0
- package/dist/automations/index.cjs +18 -17
- package/dist/automations/index.d.cts +2 -1307
- package/dist/automations/index.d.ts +2 -1307
- package/dist/automations/index.js +3 -2
- package/dist/{chunk-ZAMAR3X2.cjs → chunk-5F3YYPLZ.cjs} +11249 -10771
- package/dist/{chunk-ZO6QDYJG.cjs → chunk-5WGMIQBH.cjs} +2 -2
- package/dist/{chunk-LSI26ZN2.cjs → chunk-DBYMG6MQ.cjs} +5 -5
- package/dist/{chunk-W2A4OTCI.js → chunk-EQUZNVAR.js} +2 -2
- package/dist/{chunk-IFKF72VJ.cjs → chunk-K66MBRI4.cjs} +147 -71
- package/dist/{chunk-ZHTJ7GXH.js → chunk-L42C4G2S.js} +106 -31
- package/dist/{chunk-EDE2H37D.js → chunk-OUR7OUUZ.js} +174 -12
- package/dist/{chunk-W7JFHSFM.js → chunk-PZCDJFMA.js} +11249 -10772
- package/dist/{chunk-SHSK7UUY.cjs → chunk-UO2QRYKV.cjs} +177 -11
- package/dist/{chunk-R6E4HE7R.js → chunk-W2GRVXDG.js} +3 -3
- package/dist/client/index.cjs +5 -5
- package/dist/client/index.d.cts +4 -4
- package/dist/client/index.d.ts +4 -4
- package/dist/client/index.js +3 -3
- package/dist/{define-content-type-NEQDrvdq.d.cts → define-content-type-C2HnCYYX.d.cts} +1324 -156
- package/dist/{define-content-type-fb-WCD5e.d.ts → define-content-type-CVLUusfx.d.ts} +1324 -156
- package/dist/dev-handshake/index.cjs +8 -8
- package/dist/dev-handshake/index.d.cts +1 -1
- package/dist/dev-handshake/index.d.ts +1 -1
- package/dist/dev-handshake/index.js +1 -1
- package/dist/extensions/index.cjs +26 -6
- package/dist/extensions/index.d.cts +3 -791
- package/dist/extensions/index.d.ts +3 -791
- package/dist/extensions/index.js +24 -4
- package/dist/functions/index.cjs +7 -4
- package/dist/functions/index.d.cts +2 -4
- package/dist/functions/index.d.ts +2 -4
- package/dist/functions/index.js +5 -2
- package/dist/{index-DwHcL6x5.d.cts → index-BLVNMYUU.d.cts} +142 -79
- package/dist/{index-C4LqrNd1.d.ts → index-BY1xU93u.d.ts} +1 -1
- package/dist/{index-Dnmt_UOo.d.cts → index-Cmup6HJY.d.cts} +1 -1
- package/dist/index-D1fiaQlK.d.ts +2284 -0
- package/dist/index-DImzg3ew.d.cts +2284 -0
- package/dist/{index-M3luH06A.d.ts → index-IjSyBr8f.d.ts} +142 -79
- package/dist/index.cjs +89 -85
- package/dist/index.d.cts +64 -15
- package/dist/index.d.ts +64 -15
- package/dist/index.js +5 -5
- package/dist/preview/index.cjs +3 -3
- package/dist/preview/index.js +1 -1
- 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 +948 -118
- package/dist/schema/index.d.ts +948 -118
- 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 +5 -5
- package/dist/define-schema-DZhtvLiK.d.cts +0 -846
- package/dist/define-schema-Dlwh6l_J.d.ts +0 -846
- package/dist/register-B53i97A9.d.ts +0 -677
- package/dist/register-BYCs0FpF.d.cts +0 -677
package/dist/extensions/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { extensionTrigger } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import { EXTENSION_SURFACES } from '../chunk-
|
|
1
|
+
import { extensionTrigger } from '../chunk-W2GRVXDG.js';
|
|
2
|
+
import { keyedField } from '../chunk-PZCDJFMA.js';
|
|
3
|
+
import { contributedFieldKindName, CONTRIBUTED_FIELD_KIND_OPTION, EXTENSION_SURFACES } from '../chunk-OUR7OUUZ.js';
|
|
4
4
|
import { __name } from '../chunk-DI6KFDBO.js';
|
|
5
5
|
|
|
6
6
|
/* RelyIO SDK - Built with ❤️ by the RelyIO Team */
|
|
@@ -8,6 +8,18 @@ import { __name } from '../chunk-DI6KFDBO.js';
|
|
|
8
8
|
// src/extensions/index.ts
|
|
9
9
|
var DECLARED = "declared";
|
|
10
10
|
var SURFACES = EXTENSION_SURFACES;
|
|
11
|
+
function fieldKindBuilder(slug, name, kind) {
|
|
12
|
+
return (options = {}) => {
|
|
13
|
+
const ui = options.ui;
|
|
14
|
+
const widget = typeof ui === "object" && ui !== null ? ui : {};
|
|
15
|
+
return keyedField("reference", {
|
|
16
|
+
...options,
|
|
17
|
+
to: kind.base.to,
|
|
18
|
+
ui: { ...widget, [CONTRIBUTED_FIELD_KIND_OPTION]: contributedFieldKindName(slug, name) }
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
__name(fieldKindBuilder, "fieldKindBuilder");
|
|
11
23
|
function handleOf(slug) {
|
|
12
24
|
const surface = SURFACES[slug];
|
|
13
25
|
if (surface === void 0) {
|
|
@@ -27,7 +39,15 @@ function handleOf(slug) {
|
|
|
27
39
|
name,
|
|
28
40
|
(options) => extensionTrigger(slug, trigger, options)
|
|
29
41
|
])
|
|
30
|
-
)
|
|
42
|
+
),
|
|
43
|
+
...Object.fromEntries(
|
|
44
|
+
Object.entries(surface.fieldKinds).map(([name, kind]) => [
|
|
45
|
+
name,
|
|
46
|
+
fieldKindBuilder(slug, name, kind)
|
|
47
|
+
])
|
|
48
|
+
),
|
|
49
|
+
// Its Managed Record types, by name: `clerk.user` is `'clerkUser'` (REL-3863)
|
|
50
|
+
...surface.recordTypes
|
|
31
51
|
};
|
|
32
52
|
}
|
|
33
53
|
__name(handleOf, "handleOf");
|
package/dist/functions/index.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk5F3YYPLZ_cjs = require('../chunk-5F3YYPLZ.cjs');
|
|
4
|
+
require('../chunk-UO2QRYKV.cjs');
|
|
4
5
|
var chunkL6DXCKVQ_cjs = require('../chunk-L6DXCKVQ.cjs');
|
|
5
6
|
|
|
6
7
|
/* RelyIO SDK - Built with ❤️ by the RelyIO Team */
|
|
@@ -30,8 +31,8 @@ function defineFunction(config) {
|
|
|
30
31
|
runtime: config.runtime ?? "isolate",
|
|
31
32
|
...config.container === void 0 ? {} : { container: { size: config.container.size } },
|
|
32
33
|
...config.limits === void 0 ? {} : { limits: { ...config.limits } },
|
|
33
|
-
input:
|
|
34
|
-
...config.output === void 0 ? {} : { output:
|
|
34
|
+
input: chunk5F3YYPLZ_cjs.compileKeyedMembers(config.input ?? {}),
|
|
35
|
+
...config.output === void 0 ? {} : { output: chunk5F3YYPLZ_cjs.compileKeyedMembers(config.output) },
|
|
35
36
|
records: { read: [...config.records?.read ?? []], write: [...config.records?.write ?? []] },
|
|
36
37
|
content: config.content ?? "none",
|
|
37
38
|
network: (config.network ?? []).map((host) => ({ ...host })),
|
|
@@ -43,6 +44,8 @@ function defineFunction(config) {
|
|
|
43
44
|
),
|
|
44
45
|
// Absent when it declares none, so a Function declaring none hashes as it did before
|
|
45
46
|
...actions.length === 0 ? {} : { actions },
|
|
47
|
+
// Absent when undeclared, so a Function declaring none hashes as it did before
|
|
48
|
+
...config.endUsers === void 0 ? {} : { endUsers: config.endUsers },
|
|
46
49
|
...config.route === void 0 ? {} : { route: config.route },
|
|
47
50
|
...config.tool === void 0 ? {} : { tool: { description: config.tool.description } },
|
|
48
51
|
...config.schedule === void 0 ? {} : { schedule: { ...config.schedule } }
|
|
@@ -57,7 +60,7 @@ chunkL6DXCKVQ_cjs.__name(isFunctionDefinition, "isFunctionDefinition");
|
|
|
57
60
|
|
|
58
61
|
Object.defineProperty(exports, "fields", {
|
|
59
62
|
enumerable: true,
|
|
60
|
-
get: function () { return
|
|
63
|
+
get: function () { return chunk5F3YYPLZ_cjs.fields; }
|
|
61
64
|
});
|
|
62
65
|
exports.defineFunction = defineFunction;
|
|
63
66
|
exports.isActionRefused = isActionRefused;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
export {
|
|
2
|
-
import '../register-BYCs0FpF.cjs';
|
|
3
|
-
import '../define-schema-DZhtvLiK.cjs';
|
|
4
|
-
import '../define-content-type-NEQDrvdq.cjs';
|
|
1
|
+
export { b7 as FunctionActionHandle, b6 as FunctionActionReach, bv as FunctionActionRefused, bu as FunctionActions, bl as FunctionBatchRefused, bk as FunctionBatchResult, bx as FunctionCapabilities, bA as FunctionConfig, b2 as FunctionContainerSize, bt as FunctionContent, bg as FunctionCounterMove, bd as FunctionDeclaration, bB as FunctionDefinition, b3 as FunctionDuration, br as FunctionEndUser, bq as FunctionEndUserClaims, bp as FunctionEndUsers, bc as FunctionFieldDeclaration, F as FunctionFieldValues, bf as FunctionFile, bC as FunctionInputOf, b5 as FunctionNetworkHost, bD as FunctionOutputOf, bj as FunctionRecordBatch, bh as FunctionRecordReader, be as FunctionRecordTypeName, bi as FunctionRecordWriter, bn as FunctionRecords, by as FunctionResponse, b9 as FunctionRoute, b4 as FunctionRouteMethod, bs as FunctionRunInfo, b1 as FunctionRuntime, bb as FunctionSchedule, b8 as FunctionSecretDeclaration, ba as FunctionTool, bo as FunctionWayIn, bE as defineFunction, bw as isActionRefused, bm as isBatchRefused, bF as isFunctionDefinition, bz as respond } from '../index-DImzg3ew.cjs';
|
|
5
2
|
export { fields } from '../schema/index.cjs';
|
|
3
|
+
import '../define-content-type-C2HnCYYX.cjs';
|
|
6
4
|
import '../rich-text.d-BWc-5gX1.cjs';
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
export {
|
|
2
|
-
import '../register-B53i97A9.js';
|
|
3
|
-
import '../define-schema-Dlwh6l_J.js';
|
|
4
|
-
import '../define-content-type-fb-WCD5e.js';
|
|
1
|
+
export { b7 as FunctionActionHandle, b6 as FunctionActionReach, bv as FunctionActionRefused, bu as FunctionActions, bl as FunctionBatchRefused, bk as FunctionBatchResult, bx as FunctionCapabilities, bA as FunctionConfig, b2 as FunctionContainerSize, bt as FunctionContent, bg as FunctionCounterMove, bd as FunctionDeclaration, bB as FunctionDefinition, b3 as FunctionDuration, br as FunctionEndUser, bq as FunctionEndUserClaims, bp as FunctionEndUsers, bc as FunctionFieldDeclaration, F as FunctionFieldValues, bf as FunctionFile, bC as FunctionInputOf, b5 as FunctionNetworkHost, bD as FunctionOutputOf, bj as FunctionRecordBatch, bh as FunctionRecordReader, be as FunctionRecordTypeName, bi as FunctionRecordWriter, bn as FunctionRecords, by as FunctionResponse, b9 as FunctionRoute, b4 as FunctionRouteMethod, bs as FunctionRunInfo, b1 as FunctionRuntime, bb as FunctionSchedule, b8 as FunctionSecretDeclaration, ba as FunctionTool, bo as FunctionWayIn, bE as defineFunction, bw as isActionRefused, bm as isBatchRefused, bF as isFunctionDefinition, bz as respond } from '../index-D1fiaQlK.js';
|
|
5
2
|
export { fields } from '../schema/index.js';
|
|
3
|
+
import '../define-content-type-CVLUusfx.js';
|
|
6
4
|
import '../rich-text.d-BWc-5gX1.js';
|
package/dist/functions/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { compileKeyedMembers } from '../chunk-
|
|
2
|
-
export { fields } from '../chunk-
|
|
1
|
+
import { compileKeyedMembers } from '../chunk-PZCDJFMA.js';
|
|
2
|
+
export { fields } from '../chunk-PZCDJFMA.js';
|
|
3
|
+
import '../chunk-OUR7OUUZ.js';
|
|
3
4
|
import { __name } from '../chunk-DI6KFDBO.js';
|
|
4
5
|
|
|
5
6
|
/* RelyIO SDK - Built with ❤️ by the RelyIO Team */
|
|
@@ -42,6 +43,8 @@ function defineFunction(config) {
|
|
|
42
43
|
),
|
|
43
44
|
// Absent when it declares none, so a Function declaring none hashes as it did before
|
|
44
45
|
...actions.length === 0 ? {} : { actions },
|
|
46
|
+
// Absent when undeclared, so a Function declaring none hashes as it did before
|
|
47
|
+
...config.endUsers === void 0 ? {} : { endUsers: config.endUsers },
|
|
45
48
|
...config.route === void 0 ? {} : { route: config.route },
|
|
46
49
|
...config.tool === void 0 ? {} : { tool: { description: config.tool.description } },
|
|
47
50
|
...config.schedule === void 0 ? {} : { schedule: { ...config.schedule } }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { b as ApiPath, c as ApiMethod, Q as QueryOf, W as Wire, H as HttpClient, F as FunctionFieldValues, R as Register, A as AnySchemaDefinition, h as RecordsClient, B as BaseRecord, v as RecordBatchOperation, x as RecordBatchOptions, y as RecordBatchResult, a as RegisteredSchema } from './index-DImzg3ew.cjs';
|
|
2
|
+
import { bi as EntryMetadata, aZ as Reading, da as BaseContent, aV as CheckedIncludes, dL as ReadWhere, df as WhereClause, ap as components, a_ as ReadWith, dr as UpdateInput, b1 as UntypedReading, dk as RevisedContent, di as CreateInput, dj as CreatedContent, dq as ContentVersionRow, dp as ContentVersion, dn as RestoredContent, d3 as SDKError, dI as BaseValidationError, dH as ValidationViolation, bw as AssetServedBlocks, dM as CheckedInclude, de as WhereFieldCondition, d8 as AssetFileBlock, db as BaseSingleton, dl as WrittenSingleton, dc as BaseSettingsGroup, dm as WrittenSettingsGroup, s as KeyedMembers, aB as InferContentType, aX as ContentReading, bn as InferSingleton, cW as paths, d4 as RelyIOConfig, bu as InferAssetType, aU as AssetReading, b0 as SingletonReading, br as InferSettingsGroup, a$ as SettingsReading, d5 as RelyIOConfigUpdate, cY as MergedRelyIOConfig } from './define-content-type-C2HnCYYX.cjs';
|
|
3
|
+
import { SchemaContentTypeNames, SchemaEntryOf, SchemaLocaleCodes, SchemaSingletonNames, AggregateBlock, QueryParameterValue, FullTextSearch, SchemaQueryNames, InferQueryParams, AnyQueryParameters, SchemaRecordTypeNames, InferRecordType, RecordWriteFieldsOf, RecordUpdateFieldsOf, SchemaAssetTypeNames, SchemaSettingsGroupNames } from './schema/index.cjs';
|
|
4
4
|
import { DevUnreadableReason } from './dev-handshake/index.cjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -65,70 +65,6 @@ type ActiveSandbox = Extract<SandboxState, {
|
|
|
65
65
|
state: 'active';
|
|
66
66
|
}>;
|
|
67
67
|
|
|
68
|
-
/**
|
|
69
|
-
* API4's two request headers, as the SDK's writes send them.
|
|
70
|
-
*
|
|
71
|
-
* `Idempotency-Key` is an option on every write whose route declares it (`idempotencyKey`), and the
|
|
72
|
-
* SDK mints one when none is given. `If-Match` is never an option: a checked write builds it from
|
|
73
|
-
* the entry it was read as (`versionCheckOf`), from the `_metadata` every read carries in its body
|
|
74
|
-
* whether or not the edge cache served it (REL-2418). The SDK does not read the separate
|
|
75
|
-
* `X-Entity-Tag` header, which the edge removes from what it stores; the API keeps sending it for
|
|
76
|
-
* callers using plain HTTP (REL-2427). A batch operation carries its check in its own body, as
|
|
77
|
-
* `ifMatch` (`batch/batch-operations.ts`, REL-2421).
|
|
78
|
-
*/
|
|
79
|
-
interface RetryableWriteOptions {
|
|
80
|
-
/**
|
|
81
|
-
* A key that makes a retry of **this** write safe.
|
|
82
|
-
*
|
|
83
|
-
* A replay inside the service's window returns the original outcome rather
|
|
84
|
-
* than applying twice. The service derives that response from committed state
|
|
85
|
-
* pinned to the recorded version — it does not store bytes — so a replay after
|
|
86
|
-
* the version has been pruned is refused `RESOURCE_EXPIRED` rather than
|
|
87
|
-
* answered from a stale copy.
|
|
88
|
-
*
|
|
89
|
-
* **The SDK mints one when you do not.** It used to be caller-supplied and
|
|
90
|
-
* nothing else, which meant the default write carried no key while the retry
|
|
91
|
-
* loop replayed it anyway — the one mechanism that makes a replay safe was
|
|
92
|
-
* optional on the one path that needed it. Supply your own to make a key
|
|
93
|
-
* outlive the process: a job that may be restarted wants a key derived from
|
|
94
|
-
* the work, not one minted per call.
|
|
95
|
-
*/
|
|
96
|
-
idempotencyKey?: string;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* An entry a read handed back, as much of it as a version check needs: its `_metadata`'s id, the
|
|
100
|
-
* locale it was read in and the two counters it was read at (REL-2418).
|
|
101
|
-
*
|
|
102
|
-
* Every read carries these in its body, whether origin or the edge cache served it — the edge
|
|
103
|
-
* removes only the separate `X-Entity-Tag` header from what it stores, so a check taken from that
|
|
104
|
-
* header vanished after a cached read. A `Pick` of the document's `EntryMetadata`, so a counter the
|
|
105
|
-
* API stops reporting stops compiling here.
|
|
106
|
-
*/
|
|
107
|
-
interface ReadEntry {
|
|
108
|
-
readonly _metadata: Pick<EntryMetadata, 'id' | 'locale' | 'version' | 'sharedVersion'>;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* The version check a write takes from the entry it was read as: the entry's id, the locale it was
|
|
112
|
-
* read in — which the write addresses, so a read negotiated from `Accept-Language` is written back
|
|
113
|
-
* to that locale — and the `If-Match` tag over its two counters, spelled as the API mints it.
|
|
114
|
-
*/
|
|
115
|
-
declare function versionCheckOf(entry: ReadEntry): {
|
|
116
|
-
id: string;
|
|
117
|
-
locale: string;
|
|
118
|
-
ifMatch: string;
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* The client's locale as a sub-client holds it: a function it asks on every call, or a locale fixed
|
|
123
|
-
* when it was built.
|
|
124
|
-
*
|
|
125
|
-
* `TypedRelyIOClient` hands every sub-client and builder a function over the configuration it holds,
|
|
126
|
-
* so one taken before `updateConfig({ locale })` sends the locale the client holds when the call is
|
|
127
|
-
* made, and none once `updateConfig({ locale: null })` has cleared it (REL-1453). A string is a locale
|
|
128
|
-
* fixed at construction — a handle built directly, as the tests build one — and stays what it was.
|
|
129
|
-
*/
|
|
130
|
-
type ClientLocale = string | (() => string | undefined);
|
|
131
|
-
|
|
132
68
|
/**
|
|
133
69
|
* Site-visitor live, declared once for everyone who speaks it (`live-layer-spec.md` decisions 15, 19
|
|
134
70
|
* and 20; phase LV5): the wire a visitor's browser meets at `live.relyio.com`, and the two internal
|
|
@@ -229,6 +165,70 @@ type VisitorResyncReason = VisitorLedgerResyncReason | 'too-far-behind';
|
|
|
229
165
|
*/
|
|
230
166
|
type VisitorRetry = 'stop' | 'retry' | 'back-off';
|
|
231
167
|
|
|
168
|
+
/**
|
|
169
|
+
* API4's two request headers, as the SDK's writes send them.
|
|
170
|
+
*
|
|
171
|
+
* `Idempotency-Key` is an option on every write whose route declares it (`idempotencyKey`), and the
|
|
172
|
+
* SDK mints one when none is given. `If-Match` is never an option: a checked write builds it from
|
|
173
|
+
* the entry it was read as (`versionCheckOf`), from the `_metadata` every read carries in its body
|
|
174
|
+
* whether or not the edge cache served it (REL-2418). The SDK does not read the separate
|
|
175
|
+
* `X-Entity-Tag` header, which the edge removes from what it stores; the API keeps sending it for
|
|
176
|
+
* callers using plain HTTP (REL-2427). A batch operation carries its check in its own body, as
|
|
177
|
+
* `ifMatch` (`batch/batch-operations.ts`, REL-2421).
|
|
178
|
+
*/
|
|
179
|
+
interface RetryableWriteOptions {
|
|
180
|
+
/**
|
|
181
|
+
* A key that makes a retry of **this** write safe.
|
|
182
|
+
*
|
|
183
|
+
* A replay inside the service's window returns the original outcome rather
|
|
184
|
+
* than applying twice. The service derives that response from committed state
|
|
185
|
+
* pinned to the recorded version — it does not store bytes — so a replay after
|
|
186
|
+
* the version has been pruned is refused `RESOURCE_EXPIRED` rather than
|
|
187
|
+
* answered from a stale copy.
|
|
188
|
+
*
|
|
189
|
+
* **The SDK mints one when you do not.** It used to be caller-supplied and
|
|
190
|
+
* nothing else, which meant the default write carried no key while the retry
|
|
191
|
+
* loop replayed it anyway — the one mechanism that makes a replay safe was
|
|
192
|
+
* optional on the one path that needed it. Supply your own to make a key
|
|
193
|
+
* outlive the process: a job that may be restarted wants a key derived from
|
|
194
|
+
* the work, not one minted per call.
|
|
195
|
+
*/
|
|
196
|
+
idempotencyKey?: string;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* An entry a read handed back, as much of it as a version check needs: its `_metadata`'s id, the
|
|
200
|
+
* locale it was read in and the two counters it was read at (REL-2418).
|
|
201
|
+
*
|
|
202
|
+
* Every read carries these in its body, whether origin or the edge cache served it — the edge
|
|
203
|
+
* removes only the separate `X-Entity-Tag` header from what it stores, so a check taken from that
|
|
204
|
+
* header vanished after a cached read. A `Pick` of the document's `EntryMetadata`, so a counter the
|
|
205
|
+
* API stops reporting stops compiling here.
|
|
206
|
+
*/
|
|
207
|
+
interface ReadEntry {
|
|
208
|
+
readonly _metadata: Pick<EntryMetadata, 'id' | 'locale' | 'version' | 'sharedVersion'>;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* The version check a write takes from the entry it was read as: the entry's id, the locale it was
|
|
212
|
+
* read in — which the write addresses, so a read negotiated from `Accept-Language` is written back
|
|
213
|
+
* to that locale — and the `If-Match` tag over its two counters, spelled as the API mints it.
|
|
214
|
+
*/
|
|
215
|
+
declare function versionCheckOf(entry: ReadEntry): {
|
|
216
|
+
id: string;
|
|
217
|
+
locale: string;
|
|
218
|
+
ifMatch: string;
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* The client's locale as a sub-client holds it: a function it asks on every call, or a locale fixed
|
|
223
|
+
* when it was built.
|
|
224
|
+
*
|
|
225
|
+
* `TypedRelyIOClient` hands every sub-client and builder a function over the configuration it holds,
|
|
226
|
+
* so one taken before `updateConfig({ locale })` sends the locale the client holds when the call is
|
|
227
|
+
* made, and none once `updateConfig({ locale: null })` has cleared it (REL-1453). A string is a locale
|
|
228
|
+
* fixed at construction — a handle built directly, as the tests build one — and stays what it was.
|
|
229
|
+
*/
|
|
230
|
+
type ClientLocale = string | (() => string | undefined);
|
|
231
|
+
|
|
232
232
|
/**
|
|
233
233
|
* Two read terms every read that takes them writes the same way: the children an entry embeds,
|
|
234
234
|
* and the refusal of a condition on `_metadata`. Here once, for the list and entry reads
|
|
@@ -803,7 +803,7 @@ declare class FileValidationError extends BaseValidationError {
|
|
|
803
803
|
}
|
|
804
804
|
/** Constraints `validateFile` checks a file against (subset of the schema upload gate). */
|
|
805
805
|
interface FileValidationConstraints {
|
|
806
|
-
/** Allowed MIME types
|
|
806
|
+
/** Allowed MIME types: exact (`image/png`) or a wildcard pattern (`image/*`), as a schema declares them. */
|
|
807
807
|
allowedMimeTypes?: string[];
|
|
808
808
|
/** Max size in bytes. */
|
|
809
809
|
maxSizeBytes?: number;
|
|
@@ -1479,9 +1479,11 @@ declare class SettingsClient<T = BaseSettingsGroup, R extends Reading = UntypedR
|
|
|
1479
1479
|
* runs the Function `checkout` that the key's Branch runs, on the key's Dataset, and answers its
|
|
1480
1480
|
* output.
|
|
1481
1481
|
*
|
|
1482
|
-
* Call it from your server with a secret key
|
|
1483
|
-
*
|
|
1484
|
-
*
|
|
1482
|
+
* Call it from your server with a secret key. A publishable key calls only a Function declaring
|
|
1483
|
+
* `endUsers` (spec 4, REL-3892) — with a signed-in End user's token (`getToken`) when it says
|
|
1484
|
+
* `'required'` — and is refused any other (`PublishableKeyRefusedError`); a read-only secret key
|
|
1485
|
+
* runs only a Function whose reach writes nothing (`ReadOnlyKeyError`). A call carrying an End
|
|
1486
|
+
* user's token hands the run `run.endUser`, whatever the key. A run whose code threw or was ended at a limit throws
|
|
1485
1487
|
* `FunctionRunFailedError`, and one that outlived the service's five-minute wait
|
|
1486
1488
|
* `FunctionRunTimedOutError` — each naming the run (`runId`), whose record and console output Manage
|
|
1487
1489
|
* serves. A call is never retried: a Function may write, and a second call would be a second run.
|
|
@@ -1502,15 +1504,56 @@ interface FunctionCallOptions {
|
|
|
1502
1504
|
*/
|
|
1503
1505
|
idempotencyKey?: string;
|
|
1504
1506
|
}
|
|
1505
|
-
/** One Function, called
|
|
1507
|
+
/** One Function, called, before `Register` names the project's Functions: any input, any answer. */
|
|
1506
1508
|
type FunctionCall = (input?: Record<string, unknown>, options?: FunctionCallOptions) => Promise<unknown>;
|
|
1507
1509
|
/**
|
|
1508
|
-
*
|
|
1509
|
-
*
|
|
1510
|
+
* One Function's input and output Fields, as the generated `schema.ts` registers them (REL-4059): the
|
|
1511
|
+
* keyed record its file declares under `input`, and under `output` when it declares one.
|
|
1510
1512
|
*/
|
|
1511
|
-
|
|
1513
|
+
interface RegisteredFunctionFields {
|
|
1514
|
+
readonly input: KeyedMembers;
|
|
1515
|
+
readonly output?: KeyedMembers;
|
|
1516
|
+
}
|
|
1517
|
+
/** What a registered Function's call answers: its output's values, or what its run returned when it declares none. */
|
|
1518
|
+
type OutputOf<F extends RegisteredFunctionFields> = F extends {
|
|
1519
|
+
readonly output: infer O extends KeyedMembers;
|
|
1520
|
+
} ? FunctionFieldValues<O> : unknown;
|
|
1521
|
+
/**
|
|
1522
|
+
* What a registered Function's call takes: its input Fields' values. A Function declaring no input
|
|
1523
|
+
* field takes none — `{}` would take any key, since an empty object type has no excess-property check.
|
|
1524
|
+
*/
|
|
1525
|
+
type InputOf<F extends RegisteredFunctionFields> = [keyof FunctionFieldValues<F['input']>] extends [
|
|
1526
|
+
never
|
|
1527
|
+
] ? {
|
|
1528
|
+
readonly [field: string]: never;
|
|
1529
|
+
} : FunctionFieldValues<F['input']>;
|
|
1530
|
+
/**
|
|
1531
|
+
* One registered Function, called: its input as its input Fields declare them — required when a
|
|
1532
|
+
* field of it is, so a missing, misnamed or mistyped field is a type error — and its output.
|
|
1533
|
+
*/
|
|
1534
|
+
type TypedFunctionCall<F extends RegisteredFunctionFields> = {} extends InputOf<F> ? (input?: InputOf<F>, options?: FunctionCallOptions) => Promise<OutputOf<F>> : (input: InputOf<F>, options?: FunctionCallOptions) => Promise<OutputOf<F>>;
|
|
1535
|
+
/**
|
|
1536
|
+
* `relyio.functions` over a project's Functions: exactly those registered, each typed by its Fields,
|
|
1537
|
+
* or any name before `relyio generate-types` registered any. Generic on purpose, as
|
|
1538
|
+
* `FunctionRecordTypeName` is: written over `Register` directly, the conditional can be resolved
|
|
1539
|
+
* before the program's augmentation is in view.
|
|
1540
|
+
*/
|
|
1541
|
+
type FunctionsAccessorOf<R> = R extends {
|
|
1542
|
+
readonly functions: infer F extends {
|
|
1543
|
+
readonly [name: string]: RegisteredFunctionFields;
|
|
1544
|
+
};
|
|
1545
|
+
} ? {
|
|
1546
|
+
readonly [N in keyof F]: TypedFunctionCall<F[N]>;
|
|
1547
|
+
} : {
|
|
1512
1548
|
readonly [name: string]: FunctionCall;
|
|
1513
1549
|
};
|
|
1550
|
+
/**
|
|
1551
|
+
* `relyio.functions`: every Function the key's Branch runs, by name. Once `relyio generate-types`
|
|
1552
|
+
* has registered the project's Functions (`Register`'s `functions`), only those names are on it and
|
|
1553
|
+
* each call is typed by its input and output Fields; before, any name, untyped. A name the Branch
|
|
1554
|
+
* does not run is refused by the service (`ResourceNotFoundError`), not here.
|
|
1555
|
+
*/
|
|
1556
|
+
type FunctionsAccessor = FunctionsAccessorOf<Register>;
|
|
1514
1557
|
|
|
1515
1558
|
/**
|
|
1516
1559
|
* What the search family's routes answer, read from the committed document, and what a search over
|
|
@@ -2430,11 +2473,19 @@ interface DeployedContentType {
|
|
|
2430
2473
|
}
|
|
2431
2474
|
/**
|
|
2432
2475
|
* The defaults `client.with()` gives the client it makes (REL-2417, Q9): the locale and the dataset
|
|
2433
|
-
* its reads and writes are in unless a call names its own
|
|
2476
|
+
* its reads and writes are in unless a call names its own, and the End user's token function its
|
|
2477
|
+
* requests ask in place of the parent's (REL-3882). A locale is one the schema declares.
|
|
2434
2478
|
*/
|
|
2435
2479
|
interface ClientDefaults<TSchema extends AnySchemaDefinition | undefined = undefined> {
|
|
2436
2480
|
readonly locale?: LocaleCodeOf<TSchema>;
|
|
2437
2481
|
readonly dataset?: string;
|
|
2482
|
+
/**
|
|
2483
|
+
* The signed-in End user's token, asked for on every request this client sends — and every
|
|
2484
|
+
* request of a client `with()` makes from it that names none — in place of the parent's
|
|
2485
|
+
* `getToken`. `@relyio/react`'s provider hands it Clerk's `useAuth().getToken`. See
|
|
2486
|
+
* `RelyIOConfig.getToken`.
|
|
2487
|
+
*/
|
|
2488
|
+
readonly getToken?: () => Promise<string | null>;
|
|
2438
2489
|
}
|
|
2439
2490
|
/** The locale codes a client's reads may name: the schema's, or any where no schema types it. */
|
|
2440
2491
|
type LocaleCodeOf<TSchema extends AnySchemaDefinition | undefined> = TSchema extends AnySchemaDefinition ? SchemaLocaleCodes<TSchema> : string;
|
|
@@ -2509,7 +2560,10 @@ declare class TypedRelyIOClient<TSchema extends AnySchemaDefinition | undefined
|
|
|
2509
2560
|
* `createClient()` made, which reads its own.
|
|
2510
2561
|
*/
|
|
2511
2562
|
private parent;
|
|
2512
|
-
/**
|
|
2563
|
+
/**
|
|
2564
|
+
* What `with()` gave this client over its parent's: the locale, dataset and End user's token
|
|
2565
|
+
* function it names, and no other.
|
|
2566
|
+
*/
|
|
2513
2567
|
private defaults;
|
|
2514
2568
|
/** The live edge's poll client id: chosen once, when first needed, and kept for this client's life. */
|
|
2515
2569
|
private _liveClientId;
|
|
@@ -2565,7 +2619,9 @@ declare class TypedRelyIOClient<TSchema extends AnySchemaDefinition | undefined
|
|
|
2565
2619
|
* all or none (REL-3774).
|
|
2566
2620
|
*
|
|
2567
2621
|
* A Record is an app's data, written by your server with a secret key and live the moment it
|
|
2568
|
-
* lands
|
|
2622
|
+
* lands. A publishable key reads the Records a Record type's read Policy grants it (spec 4,
|
|
2623
|
+
* REL-3883), and writes them only for the End user whose token it carries, as the type's write
|
|
2624
|
+
* Policy allows (REL-3884); with no token it writes nothing (`PUBLISHABLE_KEY_REFUSED`).
|
|
2569
2625
|
*
|
|
2570
2626
|
* @example
|
|
2571
2627
|
* ```typescript
|
|
@@ -2585,9 +2641,13 @@ declare class TypedRelyIOClient<TSchema extends AnySchemaDefinition | undefined
|
|
|
2585
2641
|
* `FunctionRunFailedError` and one past five minutes `FunctionRunTimedOutError`, each naming the
|
|
2586
2642
|
* run. Never retried: a Function may write.
|
|
2587
2643
|
*
|
|
2644
|
+
* Once `relyio generate-types` has run, its `schema.ts` registers each Function's input and output
|
|
2645
|
+
* Fields (REL-4059): only the project's Functions are named here, and each call takes and answers
|
|
2646
|
+
* what its Fields declare, so a misnamed or mistyped input field is a type error.
|
|
2647
|
+
*
|
|
2588
2648
|
* @example
|
|
2589
2649
|
* ```typescript
|
|
2590
|
-
* const { orderId } =
|
|
2650
|
+
* const { orderId } = await relyio.functions.checkout({ cartId })
|
|
2591
2651
|
* ```
|
|
2592
2652
|
*/
|
|
2593
2653
|
readonly functions: FunctionsAccessor;
|
|
@@ -2935,6 +2995,9 @@ declare class TypedRelyIOClient<TSchema extends AnySchemaDefinition | undefined
|
|
|
2935
2995
|
* const { data } = await staging.content('post').list({ limit: 10 })
|
|
2936
2996
|
*
|
|
2937
2997
|
* const french = relyio.with({ locale: 'fr-FR' }) // ← autocompletes the schema's locales
|
|
2998
|
+
*
|
|
2999
|
+
* // Every request this one sends carries the signed-in End user's token (REL-3882)
|
|
3000
|
+
* const visitor = relyio.with({ getToken: () => session.getToken() })
|
|
2938
3001
|
* ```
|
|
2939
3002
|
*/
|
|
2940
3003
|
with(defaults: ClientDefaults<TSchema>): TypedRelyIOClient<TSchema>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { k as RichTextHeading, b as RichTextValue, y as RichTextTable, h as RichTextCodeGroup, e as RichTextBlock, l as RichTextInline, t as RichTextNode, w as RichTextSpan, r as RichTextMark, A as AnyRichTextEntryLink, c as RichTextShapeValue } from './rich-text.d-BWc-5gX1.js';
|
|
2
|
-
import {
|
|
2
|
+
import { da as BaseContent } from './define-content-type-CVLUusfx.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The DOM↔field binding contract, as the one pure helper that emits it.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { k as RichTextHeading, b as RichTextValue, y as RichTextTable, h as RichTextCodeGroup, e as RichTextBlock, l as RichTextInline, t as RichTextNode, w as RichTextSpan, r as RichTextMark, A as AnyRichTextEntryLink, c as RichTextShapeValue } from './rich-text.d-BWc-5gX1.cjs';
|
|
2
|
-
import {
|
|
2
|
+
import { da as BaseContent } from './define-content-type-C2HnCYYX.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The DOM↔field binding contract, as the one pure helper that emits it.
|