@domino-sdk/relay 1.14.0 → 1.16.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/dist/{request-error-D_dUPLwo.d.ts → action-DBzILFx9.d.ts} +31 -1
- package/dist/{attempt-captures-DZldPZJc.d.ts → attempt-captures-DHwIVoRP.d.ts} +1 -1
- package/dist/authoring.d.ts +8 -8
- package/dist/{automatic-outcomes-6lJGnSDe.d.ts → automatic-outcomes-BcEn_L46.d.ts} +1 -1
- package/dist/browser.d.ts +7 -8
- package/dist/browser.js +3 -3
- package/dist/{chunk-6DD7DVNQ.js → chunk-3YCCHTCU.js} +1 -1
- package/dist/{chunk-5TS3OAWS.js → chunk-NM3IYYPG.js} +27 -12
- package/dist/{chunk-VBHFJH3P.js → chunk-Y6SRF54G.js} +1 -1
- package/dist/{chunk-C3CB4WIQ.js → chunk-YT3QKV2L.js} +1 -1
- package/dist/{client-BTd_CyX3.d.ts → client-DFSCmf3H.d.ts} +5 -6
- package/dist/{activity-D_R3J-gU.d.ts → deployments-DIbKJO_Y.d.ts} +15 -15
- package/dist/{groups-4Jb3uYFO.d.ts → groups-Bi7lc54m.d.ts} +1 -1
- package/dist/{images-D5kpqHxv.d.ts → images-Cb8QHGjn.d.ts} +1 -1
- package/dist/index.d.ts +8 -9
- package/dist/index.js +2 -2
- package/dist/internal.d.ts +13 -33
- package/dist/internal.js +2 -2
- package/dist/{offers-BFI5t-e-.d.ts → offers-Catj06u7.d.ts} +2 -2
- package/dist/{pages-nIoMT9J3.d.ts → pages-CpYt56Km.d.ts} +1 -1
- package/dist/portal-proxy.js +1 -1
- package/dist/react/index.d.ts +9 -10
- package/dist/react/index.js +3 -3
- package/dist/{schema-K-Pg5lPz.d.ts → schema-BaVl2VBS.d.ts} +1 -1
- package/dist/schema.d.ts +11 -11
- package/dist/server/index.d.ts +12 -73085
- package/dist/server/index.js +719 -519
- package/dist/{sign-in-options-DBjMzgnu.d.ts → sign-in-options-CU1ND6-y.d.ts} +1 -1
- package/dist/{submission-input-CPIsJt-_.d.ts → submission-input-Bi4HipqI.d.ts} +2 -2
- package/dist/testing.d.ts +3 -3
- package/dist/transport-BdrcbKi_.d.ts +73612 -0
- package/package.json +2 -1
- package/dist/action-9Xl0StBg.d.ts +0 -33
- package/dist/referral-reward-kinds-DnvQXL8L.d.ts +0 -268
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domino-sdk/relay",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.16.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@dicebear/core": "9.4.3",
|
|
58
58
|
"@dicebear/shapes": "9.4.3",
|
|
59
|
+
"croner": "10.0.1",
|
|
59
60
|
"zod": "4.3.6"
|
|
60
61
|
},
|
|
61
62
|
"peerDependencies": {
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { R as RequestError } from './request-error-D_dUPLwo.js';
|
|
2
|
-
|
|
3
|
-
/** SDK input convenience; the wire request always carries a key. */
|
|
4
|
-
type OptionalActionId<T> = T extends {
|
|
5
|
-
actionId: string;
|
|
6
|
-
} ? Omit<T, "actionId"> & {
|
|
7
|
-
actionId?: string;
|
|
8
|
-
} : never;
|
|
9
|
-
/** One logical write. Keep this object until its outcome is definite. */
|
|
10
|
-
type RelayAction<T> = {
|
|
11
|
-
/** The pending write's key, also available on its uncertain error as `operationId`. */
|
|
12
|
-
readonly actionId: string | undefined;
|
|
13
|
-
readonly busy: boolean;
|
|
14
|
-
readonly error: RequestError | undefined;
|
|
15
|
-
/**
|
|
16
|
-
* Starts a write with a generated key. While an uncertain write is pending, replays its saved
|
|
17
|
-
* callback instead of accepting a different write. Concurrent calls share one request.
|
|
18
|
-
* Put refreshes and other follow-up work outside the callback.
|
|
19
|
-
*/
|
|
20
|
-
run(task: (actionId: string) => Promise<T>): Promise<T>;
|
|
21
|
-
/** Replays the exact pending callback and key, only when the error's recovery is `replay`. */
|
|
22
|
-
retry(): Promise<T>;
|
|
23
|
-
/** Acknowledge an authoritative, definite outcome after reconciliation. Refuses while busy. */
|
|
24
|
-
settle(): boolean;
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Owns a mutation key across uncertain answers. A definite success or refusal ends the action;
|
|
28
|
-
* the next `run` gets a new key. `reconcile` failures stay pending and cannot be replayed.
|
|
29
|
-
* In-memory only: persist the key yourself if recovery must survive a reload or process restart.
|
|
30
|
-
*/
|
|
31
|
-
declare function createRelayAction<T = unknown>(): RelayAction<T>;
|
|
32
|
-
|
|
33
|
-
export { type OptionalActionId as O, type RelayAction as R, createRelayAction as c };
|
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
import { ar as PublishedRelease, O as OpenIdentityKind, n as TrackerSource, a0 as TrackerDataSchema, aO as TrackerSourceResponse, at as QuestDescription } from './schema-K-Pg5lPz.js';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import { d as ImageFields, g as ImageRequest } from './images-D5kpqHxv.js';
|
|
4
|
-
import { R as RequestError, b as RequestErrorKind } from './request-error-D_dUPLwo.js';
|
|
5
|
-
|
|
6
|
-
/** Older releases did not record ownership. Preserve every value, including defaults. */
|
|
7
|
-
declare function questConfiguration(release: PublishedRelease): {
|
|
8
|
-
defaults: Record<string, string | number | boolean | {
|
|
9
|
-
id: string;
|
|
10
|
-
prompt: string;
|
|
11
|
-
choices: {
|
|
12
|
-
id: string;
|
|
13
|
-
label: string;
|
|
14
|
-
}[];
|
|
15
|
-
correct: string;
|
|
16
|
-
}[]>;
|
|
17
|
-
overrides: Record<string, string | number | boolean | {
|
|
18
|
-
id: string;
|
|
19
|
-
prompt: string;
|
|
20
|
-
choices: {
|
|
21
|
-
id: string;
|
|
22
|
-
label: string;
|
|
23
|
-
}[];
|
|
24
|
-
correct: string;
|
|
25
|
-
}[]>;
|
|
26
|
-
preserved: string[];
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
declare const identityIntegrationInputSchema: z.ZodObject<{
|
|
30
|
-
name: z.ZodString;
|
|
31
|
-
origin: z.ZodString;
|
|
32
|
-
identityKind: z.ZodOptional<z.ZodTemplateLiteral<`app:${string}`>>;
|
|
33
|
-
adoptIdentitiesFrom: z.ZodOptional<z.ZodString>;
|
|
34
|
-
reason: z.ZodOptional<z.ZodString>;
|
|
35
|
-
}, z.core.$strict>;
|
|
36
|
-
/** An integration as responses return it: fields a newer Relay adds are ignored. */
|
|
37
|
-
declare const identityIntegrationSchema: z.ZodObject<{
|
|
38
|
-
id: z.ZodString;
|
|
39
|
-
name: z.ZodString;
|
|
40
|
-
origin: z.ZodString;
|
|
41
|
-
expiresAt: z.ZodNumber;
|
|
42
|
-
identityKind: z.ZodDefault<z.ZodNullable<z.ZodType<OpenIdentityKind, unknown, z.core.$ZodTypeInternals<OpenIdentityKind, unknown>>>>;
|
|
43
|
-
organization: z.ZodString;
|
|
44
|
-
project: z.ZodString;
|
|
45
|
-
environment: z.ZodEnum<{
|
|
46
|
-
test: "test";
|
|
47
|
-
live: "live";
|
|
48
|
-
}>;
|
|
49
|
-
}, z.core.$strip>;
|
|
50
|
-
declare const identityIntegrationSecretSchema: z.ZodObject<{
|
|
51
|
-
id: z.ZodString;
|
|
52
|
-
name: z.ZodString;
|
|
53
|
-
origin: z.ZodString;
|
|
54
|
-
expiresAt: z.ZodNumber;
|
|
55
|
-
identityKind: z.ZodDefault<z.ZodNullable<z.ZodType<OpenIdentityKind, unknown, z.core.$ZodTypeInternals<OpenIdentityKind, unknown>>>>;
|
|
56
|
-
organization: z.ZodString;
|
|
57
|
-
project: z.ZodString;
|
|
58
|
-
environment: z.ZodEnum<{
|
|
59
|
-
test: "test";
|
|
60
|
-
live: "live";
|
|
61
|
-
}>;
|
|
62
|
-
token: z.ZodString;
|
|
63
|
-
}, z.core.$strip>;
|
|
64
|
-
/**
|
|
65
|
-
* An `app:<name>` kind claimed in the project and environment, and the integration that owns its
|
|
66
|
-
* identities: the live one, or the disconnected one a new integration would adopt them from.
|
|
67
|
-
*/
|
|
68
|
-
declare const identityKindClaimSchema: z.ZodObject<{
|
|
69
|
-
kind: z.ZodType<OpenIdentityKind, unknown, z.core.$ZodTypeInternals<OpenIdentityKind, unknown>>;
|
|
70
|
-
integration: z.ZodString;
|
|
71
|
-
integrationName: z.ZodString;
|
|
72
|
-
connected: z.ZodBoolean;
|
|
73
|
-
linked: z.ZodNumber;
|
|
74
|
-
unlinked: z.ZodNumber;
|
|
75
|
-
claimedAt: z.ZodNumber;
|
|
76
|
-
}, z.core.$strip>;
|
|
77
|
-
type IdentityKindClaim = z.infer<typeof identityKindClaimSchema>;
|
|
78
|
-
declare const participantExchangeSchema: z.ZodObject<{
|
|
79
|
-
subject: z.ZodString;
|
|
80
|
-
previousToken: z.ZodOptional<z.ZodString>;
|
|
81
|
-
}, z.core.$strict>;
|
|
82
|
-
|
|
83
|
-
/** Every declared field is present with its declared type or null; nothing else is returned. */
|
|
84
|
-
declare function parseImageExtraction(raw: ImageFields, value: unknown): {
|
|
85
|
-
values: Record<string, string | number | boolean | null>;
|
|
86
|
-
reason: string;
|
|
87
|
-
};
|
|
88
|
-
declare function parseImageResult(request: ImageRequest, value: unknown): {
|
|
89
|
-
kind: "pass" | "fail" | "unclear";
|
|
90
|
-
reason: string;
|
|
91
|
-
} | {
|
|
92
|
-
width: number;
|
|
93
|
-
height: number;
|
|
94
|
-
format: "jpeg" | "png" | "webp" | "gif" | "avif";
|
|
95
|
-
bytes: number;
|
|
96
|
-
sha256: string;
|
|
97
|
-
phash: string;
|
|
98
|
-
dhash: string;
|
|
99
|
-
} | {
|
|
100
|
-
identical: boolean;
|
|
101
|
-
phashDistance: number;
|
|
102
|
-
dhashDistance: number;
|
|
103
|
-
} | {
|
|
104
|
-
values: Record<string, string | number | boolean | null>;
|
|
105
|
-
reason: string;
|
|
106
|
-
} | {
|
|
107
|
-
matches: number;
|
|
108
|
-
closestDistance: number | null;
|
|
109
|
-
firstSeenAt: number | null;
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* One participant route. `path` uses the API's route syntax: every parameter is `:name{pattern}`,
|
|
114
|
-
* one path segment matched by `pattern`.
|
|
115
|
-
*/
|
|
116
|
-
type ParticipantRoute = {
|
|
117
|
-
method: "GET" | "POST";
|
|
118
|
-
path: `/v1/${string}`;
|
|
119
|
-
/**
|
|
120
|
-
* Sign-in routes only hosted apps reach: identity integrations' apps have their own login. They
|
|
121
|
-
* still connect accounts through /v1/auth/start and /v1/auth/complete.
|
|
122
|
-
*/
|
|
123
|
-
hostedOnly?: true;
|
|
124
|
-
};
|
|
125
|
-
declare const participantRoutes: readonly ParticipantRoute[];
|
|
126
|
-
/**
|
|
127
|
-
* The expression a route path matches: its literal parts exactly, each `:name{pattern}` one path
|
|
128
|
-
* segment. A parameter whose pattern can match "/" would span segments, so it is refused, as is a
|
|
129
|
-
* parameter without a pattern.
|
|
130
|
-
*/
|
|
131
|
-
declare function participantRoutePattern(path: string): RegExp;
|
|
132
|
-
/**
|
|
133
|
-
* A route a hosted app reaches through `proxyParticipant`: exactly a listed method and path.
|
|
134
|
-
* Another method on a listed path is not a participant route either.
|
|
135
|
-
*/
|
|
136
|
-
declare function isParticipantRoute(path: string, method: string): boolean;
|
|
137
|
-
/**
|
|
138
|
-
* A path an identity integration reaches, with any method: the API answers a method its route
|
|
139
|
-
* does not register with 405, and OPTIONS with the route's `Allow` header. Sign-in routes are
|
|
140
|
-
* hosted-only.
|
|
141
|
-
*/
|
|
142
|
-
declare function isIntegrationParticipantPath(path: string): boolean;
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* How a management call failed, as in every Domino client error (see `RequestError`):
|
|
146
|
-
* - `http`: the server answered with an error status. `message`, `code` and `details` are its own.
|
|
147
|
-
* - `network`: no usable answer arrived: the connection failed before a response, or broke while
|
|
148
|
-
* the body was read.
|
|
149
|
-
* - `timeout`: the call's deadline passed (`timeout`, 30 seconds unless the client or call sets
|
|
150
|
-
* another), retries included.
|
|
151
|
-
* - `aborted`: the caller's `signal` cancelled the call.
|
|
152
|
-
* - `invalid-response`: the server answered 2xx, but the body was not JSON or did not match the
|
|
153
|
-
* response this client expects.
|
|
154
|
-
* - `client`: the call never left: its input, its options or the client's `getToken` failed.
|
|
155
|
-
*/
|
|
156
|
-
type ManagementErrorKind = RequestErrorKind;
|
|
157
|
-
/** The codes the client itself sets; with kind `http`, `code` is the server's own. */
|
|
158
|
-
declare const ManagementErrorCode: {
|
|
159
|
-
/** The input or an option failed validation before anything was sent (kind `client`). */
|
|
160
|
-
readonly InvalidInput: "invalid-input";
|
|
161
|
-
/** The client's `getToken` failed before anything was sent (kind `client` or `network`). */
|
|
162
|
-
readonly Credential: "credential";
|
|
163
|
-
readonly Network: "network";
|
|
164
|
-
readonly Timeout: "timeout";
|
|
165
|
-
readonly Aborted: "aborted";
|
|
166
|
-
readonly InvalidResponse: "invalid-response";
|
|
167
|
-
};
|
|
168
|
-
/**
|
|
169
|
-
* The management API's error body: the message in `error`, a machine-readable `code`, and any
|
|
170
|
-
* other fields (such as `moved`), which a `ManagementError` keeps as `details`. `code` is open:
|
|
171
|
-
* the API adds codes over time, and a client keeps one it does not know.
|
|
172
|
-
*/
|
|
173
|
-
declare const managementErrorSchema: z.ZodObject<{
|
|
174
|
-
error: z.ZodString;
|
|
175
|
-
code: z.ZodOptional<z.ZodString>;
|
|
176
|
-
}, z.core.$loose>;
|
|
177
|
-
type ManagementErrorInit = {
|
|
178
|
-
kind: ManagementErrorKind;
|
|
179
|
-
message: string;
|
|
180
|
-
/** The request's method and path, once a request was formed. */
|
|
181
|
-
method?: string;
|
|
182
|
-
path?: string;
|
|
183
|
-
status?: number;
|
|
184
|
-
code?: string;
|
|
185
|
-
details?: Record<string, unknown>;
|
|
186
|
-
/** The action ID the request body carried; the error reports it as `operationId`. */
|
|
187
|
-
actionId?: string;
|
|
188
|
-
/** Whether the route keeps a receipt that makes repeating the action safe. */
|
|
189
|
-
replaySafe?: boolean;
|
|
190
|
-
/** Overrides the default: set false when the request was never sent. */
|
|
191
|
-
uncertain?: boolean;
|
|
192
|
-
/** The answer's `Retry-After`, in milliseconds. */
|
|
193
|
-
retryAfter?: number;
|
|
194
|
-
cause?: unknown;
|
|
195
|
-
};
|
|
196
|
-
declare const managementErrorBrand: unique symbol;
|
|
197
|
-
/** Whether `value` is a `ManagementError` from any copy of the SDK. Prefer it to `instanceof`. */
|
|
198
|
-
declare function isManagementError(value: unknown): value is ManagementError;
|
|
199
|
-
/**
|
|
200
|
-
* Every failure of a typed management call, including input refused before sending (`client`):
|
|
201
|
-
* the shared `RequestError` fields, plus the request's `method`, `path` and the server's `details`.
|
|
202
|
-
*
|
|
203
|
-
* When `uncertain` is true, a write may have been applied, and `recovery` says what to do:
|
|
204
|
-
* `replay` repeats the same call with the same `operationId` (the request's `actionId`), which the
|
|
205
|
-
* server applies at most once; `reconcile` reads the resource before deciding.
|
|
206
|
-
*
|
|
207
|
-
* @compat sealed
|
|
208
|
-
*/
|
|
209
|
-
declare class ManagementError extends RequestError {
|
|
210
|
-
readonly name: string;
|
|
211
|
-
readonly [managementErrorBrand] = true;
|
|
212
|
-
/** The rest of the server's error body besides `error` and `code`, such as `moved`; absent when there is none. */
|
|
213
|
-
readonly details: Readonly<Record<string, unknown>> | undefined;
|
|
214
|
-
/** The request's method; absent when the call failed before forming a request. */
|
|
215
|
-
readonly method: string | undefined;
|
|
216
|
-
/** The management API path, below `/management/v1`, without its query; absent like `method`. */
|
|
217
|
-
readonly path: string | undefined;
|
|
218
|
-
constructor(init: ManagementErrorInit);
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* Per-call options every typed management method accepts as its last argument.
|
|
222
|
-
*
|
|
223
|
-
* @compat input
|
|
224
|
-
*/
|
|
225
|
-
type ManagementCallOptions = {
|
|
226
|
-
/**
|
|
227
|
-
* Cancels the call; it then fails with a `ManagementError` of kind `aborted`. Cancelling stops
|
|
228
|
-
* any retry; a write already sent stays `uncertain`, since the server may have applied it.
|
|
229
|
-
*/
|
|
230
|
-
signal?: AbortSignal;
|
|
231
|
-
/**
|
|
232
|
-
* The call's deadline in milliseconds, covering every attempt, the waits between them and the
|
|
233
|
-
* answer's body. Replaces the client's `timeout` for this call.
|
|
234
|
-
*/
|
|
235
|
-
timeout?: number;
|
|
236
|
-
};
|
|
237
|
-
/** The deadline a call gets when neither the client nor the call sets `timeout`. */
|
|
238
|
-
declare const DEFAULT_MANAGEMENT_TIMEOUT = 30000;
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* How Relay reads back a cursor it issued over a numeric position. Clients treat cursors as
|
|
242
|
-
* opaque strings (`pageCursorSchema`); only the server parses them, so the format can change.
|
|
243
|
-
*/
|
|
244
|
-
declare const sequenceCursorSchema: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>, z.ZodNumber>;
|
|
245
|
-
|
|
246
|
-
/** The account roles a source's records can name: `author` and any others the source declares. */
|
|
247
|
-
declare function sourceRoles(source: TrackerSourceResponse): readonly string[];
|
|
248
|
-
/**
|
|
249
|
-
* The schema a source's record `data` matches: a custom source's declared schema, a Discord
|
|
250
|
-
* source's fixed one, or undefined for X (provider payloads) and untyped custom trackers.
|
|
251
|
-
*/
|
|
252
|
-
declare function sourceDataSchema(source: TrackerSource): TrackerDataSchema | undefined;
|
|
253
|
-
|
|
254
|
-
/** Rules independent of published resources, permissions and another release. */
|
|
255
|
-
type QuestShape = Pick<QuestDescription, "trigger" | "performance"> & {
|
|
256
|
-
completion: Pick<QuestDescription["completion"], "kind">;
|
|
257
|
-
requires: readonly unknown[];
|
|
258
|
-
};
|
|
259
|
-
/** The same trigger/completion matrix for authoring, publication and graph validation. */
|
|
260
|
-
declare function validateQuestShape(description: QuestShape, options?: {
|
|
261
|
-
template?: boolean;
|
|
262
|
-
}): void;
|
|
263
|
-
|
|
264
|
-
declare const REFERRAL_INTEGRATION_REWARD_ERROR = "Referral programs can grant points and tiered rewards; Discord roles need a quest";
|
|
265
|
-
/** Detect the unsupported reward in loose authoring, published, or reward-list shapes. */
|
|
266
|
-
declare function containsReferralIntegrationReward(value: unknown): boolean;
|
|
267
|
-
|
|
268
|
-
export { DEFAULT_MANAGEMENT_TIMEOUT as D, type IdentityKindClaim as I, type ManagementCallOptions as M, type ParticipantRoute as P, REFERRAL_INTEGRATION_REWARD_ERROR as R, identityIntegrationSchema as a, identityIntegrationSecretSchema as b, containsReferralIntegrationReward as c, identityKindClaimSchema as d, isIntegrationParticipantPath as e, isParticipantRoute as f, parseImageResult as g, participantExchangeSchema as h, identityIntegrationInputSchema as i, participantRoutePattern as j, participantRoutes as k, sourceDataSchema as l, sourceRoles as m, ManagementError as n, ManagementErrorCode as o, parseImageExtraction as p, questConfiguration as q, type ManagementErrorInit as r, sequenceCursorSchema as s, type ManagementErrorKind as t, isManagementError as u, validateQuestShape as v, managementErrorSchema as w };
|