@domino-sdk/relay 1.62.0 → 1.65.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 +145 -0
- package/dist/{accounts-CCqCKCVx.d.ts → accounts-_lNsiR2k.d.ts} +42 -4
- package/dist/{attempt-captures-Cm-5G0PC.d.ts → attempt-captures-BqPggxTU.d.ts} +1 -1
- package/dist/authoring.d.ts +54 -20
- package/dist/authoring.js +60 -31
- package/dist/{automatic-outcomes-pAsOyIVp.d.ts → automatic-outcomes-BzAvfcpd.d.ts} +11 -1
- package/dist/avatar.d.ts +1 -1
- package/dist/browser.d.ts +10 -10
- package/dist/browser.js +12 -13
- package/dist/capability-error-CuI_F7yM.d.ts +296 -0
- package/dist/{catalog--ZIlskAo.d.ts → catalog-ByZMRS7I.d.ts} +21 -10
- package/dist/{chunk-XNKSSE32.js → chunk-4NIV4NPV.js} +7 -7
- package/dist/chunk-7H4MRVQF.js +199 -0
- package/dist/{chunk-UPQPUJOU.js → chunk-CVQZ2YP7.js} +73 -202
- package/dist/{chunk-3PYYGFSB.js → chunk-DLABJSBO.js} +3 -3
- package/dist/{chunk-Y322OTCH.js → chunk-E22XSC4L.js} +1 -1
- package/dist/{chunk-E6IKQHTX.js → chunk-EDNKKVGU.js} +2 -2
- package/dist/{chunk-K2KS3JLY.js → chunk-EOUEAOWJ.js} +35 -4
- package/dist/{chunk-6WCIWXUV.js → chunk-EUEW2APU.js} +2 -2
- package/dist/{chunk-MK425RXJ.js → chunk-HNR6G3GV.js} +2335 -1538
- package/dist/{chunk-UW5232GG.js → chunk-KCUUHT2V.js} +5 -5
- package/dist/{chunk-CICDIBOF.js → chunk-MPTE7EIV.js} +76 -74
- package/dist/{chunk-4OC7REYX.js → chunk-MWMCQLCG.js} +3 -3
- package/dist/{chunk-GTDW453U.js → chunk-NG4GZ54I.js} +100 -114
- package/dist/chunk-R2KZFX6E.js +405 -0
- package/dist/{chunk-HTZHBTIL.js → chunk-RD3XJ4DH.js} +208 -376
- package/dist/{chunk-5TEYFX6X.js → chunk-SE7XHQFP.js} +2 -2
- package/dist/{chunk-CZFXGGEK.js → chunk-U66GUVSG.js} +2 -2
- package/dist/{chunk-KDR2VAJP.js → chunk-UYVJZR33.js} +2 -2
- package/dist/chunk-UZ765UGH.js +18 -0
- package/dist/{chunk-GKIFABGN.js → chunk-VBYOAT46.js} +100 -277
- package/dist/{chunk-QYPMPWVX.js → chunk-XVZ4YOF2.js} +43 -43
- package/dist/{chunk-3KLC4AMA.js → chunk-ZQ3IPCI6.js} +177 -176
- package/dist/chunk-ZXGBDLVB.js +1510 -0
- package/dist/{client-B-hbHX30.d.ts → client-D7IiwEq2.d.ts} +31 -62
- package/dist/{capability-error-DFMwSuSf.d.ts → dashboards-pVfclkyh.d.ts} +14 -294
- package/dist/{deployments-M4OHn7G3.d.ts → deployments-Cr1tfqrr.d.ts} +46 -3
- package/dist/{identity-integration-3mX6b5iH.d.ts → identity-integration-Ci2vGKtX.d.ts} +67 -2
- package/dist/index.d.ts +11 -11
- package/dist/index.js +11 -13
- package/dist/internal.d.ts +27 -13
- package/dist/internal.js +46 -13
- package/dist/{analytics-BwAKLi7O.d.ts → limits-pE04y9O2.d.ts} +131 -3
- package/dist/{offers-DhAtss4_.d.ts → offers-Hw2P6tcK.d.ts} +3 -2
- package/dist/{participant-activity-D-Drp24G.d.ts → participant-activity-DXRq4s6K.d.ts} +1 -0
- package/dist/portal-proxy.d.ts +21 -3
- package/dist/portal-proxy.js +72 -22
- package/dist/react/index.d.ts +29 -15
- package/dist/react/index.js +52 -29
- package/dist/{pages-B8q8Y_dQ.d.ts → reward-deliveries-BCV8hznc.d.ts} +300 -233
- package/dist/runtime/authoring.js +1 -1
- package/dist/runtime/chunks/6EBN6IZU.js +1 -0
- package/dist/runtime/manifest.json +3 -3
- package/dist/runtime/schema.js +1 -1
- package/dist/schema.d.ts +197 -19
- package/dist/schema.js +126 -124
- package/dist/server/index.d.ts +13 -13
- package/dist/server/index.js +5701 -6302
- package/dist/{sign-in-providers-BkjcDsFF.d.ts → sign-in-providers-BAkGjSXo.d.ts} +7 -2
- package/dist/{submission-input-DHGKhXfp.d.ts → submission-input-ChL1aYNH.d.ts} +3 -2
- package/dist/{telegram-browser-BCE7zdOb.d.ts → telegram-browser-K27t4TwM.d.ts} +5 -5
- package/dist/telegram.d.ts +9 -9
- package/dist/telegram.js +2 -2
- package/dist/testing.d.ts +229 -27
- package/dist/testing.js +146 -105
- package/dist/{tracker-data-Hb1uQnk5.d.ts → tracker-data-Bl-qPIvZ.d.ts} +37 -9
- package/dist/{transport-DkhX2Cbs.d.ts → transport-DC1m73Tp.d.ts} +40211 -37736
- package/dist/{wallet-DTO7SXj7.d.ts → wallet-B7e06v4m.d.ts} +14 -4
- package/package.json +1 -1
- package/dist/chunk-D26YNACF.js +0 -320
- package/dist/chunk-UAKYDVT3.js +0 -565
- package/dist/chunk-WSBYWVTZ.js +0 -717
- package/dist/chunk-XJFYAXET.js +0 -87
- package/dist/runtime/chunks/Y4OAVXFR.js +0 -1
|
@@ -1,18 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createHttpExchange,
|
|
3
|
+
uncertainStatuses
|
|
4
|
+
} from "./chunk-7H4MRVQF.js";
|
|
1
5
|
import {
|
|
2
6
|
MANAGEMENT_TIMEOUT,
|
|
3
|
-
clientIdentity,
|
|
4
7
|
lifetime,
|
|
5
|
-
retryAfter,
|
|
6
8
|
retrying,
|
|
7
9
|
validTimeout
|
|
8
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-DLABJSBO.js";
|
|
9
11
|
import {
|
|
10
12
|
knownResponse
|
|
11
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-HNR6G3GV.js";
|
|
12
14
|
import {
|
|
13
15
|
RequestError,
|
|
14
16
|
isRequestError
|
|
15
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-EOUEAOWJ.js";
|
|
16
18
|
|
|
17
19
|
// src/configuration.ts
|
|
18
20
|
function questConfiguration(release) {
|
|
@@ -40,11 +42,10 @@ var ManagementErrorCode = {
|
|
|
40
42
|
Aborted: "aborted",
|
|
41
43
|
InvalidResponse: "invalid-response"
|
|
42
44
|
};
|
|
43
|
-
var managementErrorSchema = z.looseObject({
|
|
45
|
+
var managementErrorSchema = /* @__PURE__ */ (() => z.looseObject({
|
|
44
46
|
error: z.string(),
|
|
45
47
|
code: z.string().optional()
|
|
46
|
-
});
|
|
47
|
-
var uncertainStatuses = /* @__PURE__ */ new Set([500, 502, 504]);
|
|
48
|
+
}))();
|
|
48
49
|
function uncertainOutcome(init) {
|
|
49
50
|
if (init.method === void 0 || init.method === "GET") {
|
|
50
51
|
return false;
|
|
@@ -62,7 +63,7 @@ function uncertainOutcome(init) {
|
|
|
62
63
|
return false;
|
|
63
64
|
}
|
|
64
65
|
}
|
|
65
|
-
var managementErrorBrand = /* @__PURE__ */ Symbol.for("@domino-sdk/relay.ManagementError");
|
|
66
|
+
var managementErrorBrand = /* @__PURE__ */ (() => /* @__PURE__ */ Symbol.for("@domino-sdk/relay.ManagementError"))();
|
|
66
67
|
function isManagementError(value) {
|
|
67
68
|
return isRequestError(value) && value[managementErrorBrand] === true;
|
|
68
69
|
}
|
|
@@ -139,182 +140,63 @@ function checkedTimeout(timeout) {
|
|
|
139
140
|
}
|
|
140
141
|
function managementTransport(options) {
|
|
141
142
|
const clientTimeout = checkedTimeout(options.timeout) ?? DEFAULT_MANAGEMENT_TIMEOUT;
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
-
|
|
143
|
+
const redirect = options.redirect ? { redirect: options.redirect } : {};
|
|
144
|
+
const http = createHttpExchange(
|
|
145
|
+
{
|
|
146
|
+
baseUrl: `${options.baseUrl}/management/v1`,
|
|
147
|
+
headers: options.headers,
|
|
148
|
+
getToken: options.getToken,
|
|
149
|
+
fetch: options.fetch,
|
|
150
|
+
organization: options.organization,
|
|
151
|
+
project: options.project,
|
|
152
|
+
environment: options.environment
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
client: options.client,
|
|
156
|
+
credentialLast: true,
|
|
157
|
+
// A redirect fetch refused to follow was answered without being applied. The participant
|
|
158
|
+
// client has no such rule, so there a write that failed to connect stays uncertain.
|
|
159
|
+
neverSent: (error) => unsent(error) || redirected(error),
|
|
160
|
+
abortReason: true,
|
|
161
|
+
messages: {
|
|
162
|
+
aborted: "The management request was cancelled",
|
|
163
|
+
timeout: (milliseconds) => `The management request did not finish within ${milliseconds} ms`,
|
|
164
|
+
network: () => "The management request failed before Domino answered",
|
|
165
|
+
credential: "Could not get a management credential",
|
|
166
|
+
invalidToken: "getToken returned a value that is not a token",
|
|
167
|
+
invalidOptions: "Management headers, organization and project must be valid HTTP header values"
|
|
168
|
+
// No `unsendable`: a header or body that cannot be sent rejects with the platform's error.
|
|
169
|
+
},
|
|
170
|
+
makeError: (message, error, context) => new ManagementError({ ...context, ...error, message }),
|
|
171
|
+
// A body that is not the server's error JSON still rejects with the status.
|
|
172
|
+
parseRefusal: (body) => {
|
|
173
|
+
const parsed = managementErrorSchema.safeParse(body);
|
|
174
|
+
if (!parsed.success) {
|
|
175
|
+
return {};
|
|
176
|
+
}
|
|
177
|
+
const { error, code, ...details } = parsed.data;
|
|
178
|
+
return { message: error, code, details };
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
);
|
|
154
182
|
function callLifetime(call) {
|
|
155
183
|
return lifetime(
|
|
156
184
|
checkedTimeout(call?.timeout) ?? clientTimeout,
|
|
157
185
|
call?.signal ?? void 0
|
|
158
186
|
);
|
|
159
187
|
}
|
|
160
|
-
function transportFailure(error, context, life, sent, status, refused = false, headers) {
|
|
161
|
-
if (error instanceof ManagementError) {
|
|
162
|
-
return error;
|
|
163
|
-
}
|
|
164
|
-
const unsent2 = {
|
|
165
|
-
retryAfter: headers ? retryAfter(headers) : void 0,
|
|
166
|
-
// A redirect fetch refused to follow was answered without being applied.
|
|
167
|
-
...!sent || redirected(error) ? { uncertain: false } : refused ? {
|
|
168
|
-
uncertain: context.method !== "GET" && [500, 502, 504].includes(status ?? 0)
|
|
169
|
-
} : {},
|
|
170
|
-
...status === void 0 ? {} : { status }
|
|
171
|
-
};
|
|
172
|
-
const ended = life.ended();
|
|
173
|
-
if (ended === "aborted") {
|
|
174
|
-
return new ManagementError({
|
|
175
|
-
...context,
|
|
176
|
-
...unsent2,
|
|
177
|
-
kind: "aborted",
|
|
178
|
-
code: ManagementErrorCode.Aborted,
|
|
179
|
-
message: "The management request was cancelled",
|
|
180
|
-
cause: life.reason()
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
if (ended === "timeout") {
|
|
184
|
-
return new ManagementError({
|
|
185
|
-
...context,
|
|
186
|
-
...unsent2,
|
|
187
|
-
kind: "timeout",
|
|
188
|
-
code: ManagementErrorCode.Timeout,
|
|
189
|
-
message: `The management request did not finish within ${life.timeout} ms`,
|
|
190
|
-
cause: error
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
return new ManagementError({
|
|
194
|
-
...context,
|
|
195
|
-
...unsent2,
|
|
196
|
-
kind: "network",
|
|
197
|
-
code: ManagementErrorCode.Network,
|
|
198
|
-
message: "The management request failed before Domino answered",
|
|
199
|
-
cause: error
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
async function credential(context, life) {
|
|
203
|
-
if (!options.getToken) {
|
|
204
|
-
return null;
|
|
205
|
-
}
|
|
206
|
-
const getToken = options.getToken;
|
|
207
|
-
try {
|
|
208
|
-
return await new Promise((resolve, reject) => {
|
|
209
|
-
const stop = () => reject(life.signal.reason);
|
|
210
|
-
life.signal.addEventListener("abort", stop, { once: true });
|
|
211
|
-
getToken().then(resolve, reject).finally(() => life.signal.removeEventListener("abort", stop));
|
|
212
|
-
});
|
|
213
|
-
} catch (error) {
|
|
214
|
-
if (life.signal.aborted) {
|
|
215
|
-
throw transportFailure(error, context, life, false);
|
|
216
|
-
}
|
|
217
|
-
throw new ManagementError({
|
|
218
|
-
...context,
|
|
219
|
-
// A token source that could not reach its own service failed like a network call.
|
|
220
|
-
kind: error instanceof TypeError ? "network" : "client",
|
|
221
|
-
code: ManagementErrorCode.Credential,
|
|
222
|
-
uncertain: false,
|
|
223
|
-
message: "Could not get a management credential",
|
|
224
|
-
cause: error
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
async function send(path, fetchInit, context, life) {
|
|
229
|
-
if (life.signal.aborted) {
|
|
230
|
-
throw transportFailure(life.reason(), context, life, false);
|
|
231
|
-
}
|
|
232
|
-
const headers = new Headers(options.headers);
|
|
233
|
-
new Headers(fetchInit.headers).forEach(
|
|
234
|
-
(value, name) => headers.set(name, value)
|
|
235
|
-
);
|
|
236
|
-
headers.set("X-Domino-Client", options.client ?? clientIdentity());
|
|
237
|
-
const token = await credential(context, life);
|
|
238
|
-
if (token) {
|
|
239
|
-
try {
|
|
240
|
-
headers.set("Authorization", `Bearer ${token}`);
|
|
241
|
-
} catch (error) {
|
|
242
|
-
throw new ManagementError({
|
|
243
|
-
...context,
|
|
244
|
-
kind: "client",
|
|
245
|
-
code: ManagementErrorCode.Credential,
|
|
246
|
-
uncertain: false,
|
|
247
|
-
message: "getToken returned a value that is not a token",
|
|
248
|
-
cause: error
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
} else if (options.getToken) {
|
|
252
|
-
headers.delete("Authorization");
|
|
253
|
-
}
|
|
254
|
-
if (options.organization) {
|
|
255
|
-
headers.set("X-Relay-Organization", options.organization);
|
|
256
|
-
}
|
|
257
|
-
if (options.project) {
|
|
258
|
-
headers.set("X-Relay-Project", options.project);
|
|
259
|
-
}
|
|
260
|
-
if (options.environment) {
|
|
261
|
-
headers.set("X-Relay-Environment", options.environment);
|
|
262
|
-
}
|
|
263
|
-
let response;
|
|
264
|
-
try {
|
|
265
|
-
response = await (options.fetch ?? fetch)(
|
|
266
|
-
`${options.baseUrl}/management/v1${path}`,
|
|
267
|
-
{
|
|
268
|
-
...fetchInit,
|
|
269
|
-
headers,
|
|
270
|
-
signal: life.signal,
|
|
271
|
-
...options.redirect ? { redirect: options.redirect } : {}
|
|
272
|
-
}
|
|
273
|
-
);
|
|
274
|
-
} catch (error) {
|
|
275
|
-
throw transportFailure(error, context, life, !unsent(error));
|
|
276
|
-
}
|
|
277
|
-
if (!response.ok) {
|
|
278
|
-
let text;
|
|
279
|
-
try {
|
|
280
|
-
text = await response.text();
|
|
281
|
-
} catch (error2) {
|
|
282
|
-
throw transportFailure(
|
|
283
|
-
error2,
|
|
284
|
-
context,
|
|
285
|
-
life,
|
|
286
|
-
true,
|
|
287
|
-
response.status,
|
|
288
|
-
true,
|
|
289
|
-
response.headers
|
|
290
|
-
);
|
|
291
|
-
}
|
|
292
|
-
let body = null;
|
|
293
|
-
try {
|
|
294
|
-
body = JSON.parse(text);
|
|
295
|
-
} catch {
|
|
296
|
-
}
|
|
297
|
-
const parsed = managementErrorSchema.safeParse(body);
|
|
298
|
-
const { error, code, ...details } = parsed.success ? parsed.data : { error: `Request failed (${response.status})`, code: void 0 };
|
|
299
|
-
throw new ManagementError({
|
|
300
|
-
...context,
|
|
301
|
-
kind: "http",
|
|
302
|
-
status: response.status,
|
|
303
|
-
message: error,
|
|
304
|
-
...code === void 0 ? {} : { code },
|
|
305
|
-
details,
|
|
306
|
-
retryAfter: retryAfter(response.headers)
|
|
307
|
-
});
|
|
308
|
-
}
|
|
309
|
-
return response;
|
|
310
|
-
}
|
|
311
188
|
async function raw(path, init) {
|
|
312
189
|
const { timeout, signal, ...fetchInit } = init ?? {};
|
|
313
190
|
const life = callLifetime({ timeout, signal: signal ?? void 0 });
|
|
314
191
|
try {
|
|
315
|
-
return await send(
|
|
192
|
+
return await http.send(
|
|
316
193
|
path,
|
|
317
|
-
|
|
194
|
+
{
|
|
195
|
+
method: fetchInit.method,
|
|
196
|
+
headers: fetchInit.headers,
|
|
197
|
+
body: fetchInit.body,
|
|
198
|
+
init: { ...fetchInit, ...redirect }
|
|
199
|
+
},
|
|
318
200
|
{
|
|
319
201
|
method: (fetchInit.method ?? "GET").toUpperCase(),
|
|
320
202
|
path: path.split("?")[0],
|
|
@@ -334,31 +216,24 @@ function managementTransport(options) {
|
|
|
334
216
|
path: path.split("?")[0],
|
|
335
217
|
...actionId ? { actionId } : {}
|
|
336
218
|
};
|
|
337
|
-
const
|
|
219
|
+
const tolerance = tolerant ? { "X-Domino-Response": "tolerant-v1" } : {};
|
|
220
|
+
const request = input instanceof ManagementUploadBody ? {
|
|
338
221
|
method,
|
|
339
|
-
headers:
|
|
340
|
-
|
|
341
|
-
headers
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
} : {
|
|
348
|
-
headers: {
|
|
349
|
-
"Content-Type": "application/json",
|
|
350
|
-
...tolerant ? { "X-Domino-Response": "tolerant-v1" } : {}
|
|
351
|
-
},
|
|
352
|
-
body: JSON.stringify(input)
|
|
353
|
-
}
|
|
354
|
-
};
|
|
222
|
+
headers: {
|
|
223
|
+
"Content-Type": input.body.type,
|
|
224
|
+
...input.headers,
|
|
225
|
+
...tolerance
|
|
226
|
+
},
|
|
227
|
+
body: input.body,
|
|
228
|
+
init: redirect
|
|
229
|
+
} : { method, headers: tolerance, json: input, init: redirect };
|
|
355
230
|
const life = callLifetime(call);
|
|
356
231
|
try {
|
|
357
232
|
return await retrying(
|
|
358
233
|
life,
|
|
359
234
|
{ replaySafe: method === "GET" || replaySafe },
|
|
360
235
|
async () => {
|
|
361
|
-
const response = await send(path,
|
|
236
|
+
const response = await http.send(path, request, context, life);
|
|
362
237
|
let body;
|
|
363
238
|
try {
|
|
364
239
|
body = response.status === 204 ? null : await response.json();
|
|
@@ -373,15 +248,11 @@ function managementTransport(options) {
|
|
|
373
248
|
cause: error
|
|
374
249
|
});
|
|
375
250
|
}
|
|
376
|
-
throw
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
response.status,
|
|
382
|
-
false,
|
|
383
|
-
response.headers
|
|
384
|
-
);
|
|
251
|
+
throw http.interrupted(error, method, context, life, {
|
|
252
|
+
sent: true,
|
|
253
|
+
status: response.status,
|
|
254
|
+
headers: response.headers
|
|
255
|
+
});
|
|
385
256
|
}
|
|
386
257
|
const parsed = knownResponse(schema).safeParse(
|
|
387
258
|
tolerant ? { status: response.status, operationId: actionId, result: body } : body
|
|
@@ -421,7 +292,7 @@ function managementTransport(options) {
|
|
|
421
292
|
|
|
422
293
|
// src/sequence-cursor.ts
|
|
423
294
|
import * as z3 from "zod";
|
|
424
|
-
var sequenceCursorSchema = z3.string().regex(/^[1-9][0-9]{0,15}$/, "Invalid cursor").transform(Number).pipe(z3.number().int().positive().safe());
|
|
295
|
+
var sequenceCursorSchema = /* @__PURE__ */ (() => z3.string().regex(/^[1-9][0-9]{0,15}$/, "Invalid cursor").transform(Number).pipe(z3.number().int().positive().safe()))();
|
|
425
296
|
|
|
426
297
|
// src/referral-reward-kinds.ts
|
|
427
298
|
var REFERRAL_INTEGRATION_REWARD_ERROR = "Referral programs can grant points and tiered rewards; Discord roles need a quest";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isRequestError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-EOUEAOWJ.js";
|
|
4
4
|
|
|
5
5
|
// package.json
|
|
6
6
|
var name = "@domino-sdk/relay";
|
|
7
|
-
var version = "1.
|
|
7
|
+
var version = "1.65.0";
|
|
8
8
|
|
|
9
9
|
// src/client-identity.ts
|
|
10
10
|
function clientIdentity() {
|
|
@@ -16,7 +16,7 @@ function clientIdentity() {
|
|
|
16
16
|
var PARTICIPANT_TIMEOUT = 15e3;
|
|
17
17
|
var MANAGEMENT_TIMEOUT = 3e4;
|
|
18
18
|
var MAX_ATTEMPTS = 3;
|
|
19
|
-
var transientStatuses = /* @__PURE__ */ new Set([429, 500, 502, 503, 504]);
|
|
19
|
+
var transientStatuses = /* @__PURE__ */ (() => /* @__PURE__ */ new Set([429, 500, 502, 503, 504]))();
|
|
20
20
|
function validTimeout(value) {
|
|
21
21
|
return typeof value === "number" && Number.isFinite(value) && value > 0;
|
|
22
22
|
}
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
imageFieldsSchema,
|
|
5
5
|
imageInspectionSchema,
|
|
6
6
|
imageSightingsSchema
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-XVZ4YOF2.js";
|
|
8
8
|
import {
|
|
9
9
|
photoResultSchema
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-HNR6G3GV.js";
|
|
11
11
|
|
|
12
12
|
// src/image-results.ts
|
|
13
13
|
import * as z from "zod";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/request-error.ts
|
|
2
|
-
var requestErrorBrand = /* @__PURE__ */ Symbol.for("@domino-sdk/relay.RequestError");
|
|
2
|
+
var requestErrorBrand = /* @__PURE__ */ (() => /* @__PURE__ */ Symbol.for("@domino-sdk/relay.RequestError"))();
|
|
3
3
|
function isRequestError(value) {
|
|
4
4
|
return typeof value === "object" && value !== null && value[requestErrorBrand] === true;
|
|
5
5
|
}
|
|
@@ -31,13 +31,37 @@ var RequestError = class extends Error {
|
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
+
// src/definition-error.ts
|
|
35
|
+
function issueText(issues) {
|
|
36
|
+
return [
|
|
37
|
+
...new Set(
|
|
38
|
+
issues.map(
|
|
39
|
+
(issue) => issue.path.length ? issue.path.map(String).join(".") + ": " + issue.message : issue.message
|
|
40
|
+
)
|
|
41
|
+
)
|
|
42
|
+
].join("; ");
|
|
43
|
+
}
|
|
44
|
+
function parseDefinition(kind, schema, input) {
|
|
45
|
+
const parsed = schema.safeParse(input);
|
|
46
|
+
if (parsed.success) {
|
|
47
|
+
return parsed.data;
|
|
48
|
+
}
|
|
49
|
+
const key = typeof input === "object" && input !== null && "key" in input && typeof input.key === "string" ? ` "${input.key}"` : "";
|
|
50
|
+
parsed.error.message = `${kind}${key} is invalid: ${issueText(parsed.error.issues)}`;
|
|
51
|
+
throw parsed.error;
|
|
52
|
+
}
|
|
53
|
+
|
|
34
54
|
// src/errors.ts
|
|
35
|
-
import * as z from "zod";
|
|
36
55
|
var RelayErrorCode = {
|
|
37
56
|
/** The call needs a signed-in member. */
|
|
38
57
|
NotSignedIn: "not-signed-in",
|
|
39
58
|
/** The session changed since the app read it (the `session` option). Reload before retrying. */
|
|
40
59
|
StaleSession: "stale-session",
|
|
60
|
+
/**
|
|
61
|
+
* A participant backend (`createParticipantBackend`) refused the call because the app's own
|
|
62
|
+
* sign-in ended. The SDK treats it like `not-signed-in`: the member is signed out.
|
|
63
|
+
*/
|
|
64
|
+
Unauthenticated: "unauthenticated",
|
|
41
65
|
/** The input failed validation before it was sent. */
|
|
42
66
|
InvalidInput: "invalid-input",
|
|
43
67
|
/** Relay's answer was not JSON or not the expected shape (kind `invalid-response`). */
|
|
@@ -116,6 +140,11 @@ var RelayErrorCode = {
|
|
|
116
140
|
QuestClosed: "quest-closed",
|
|
117
141
|
/** An operator paused the quest. */
|
|
118
142
|
QuestPaused: "quest-paused",
|
|
143
|
+
/**
|
|
144
|
+
* The member is banned from the project, so their attempts, completions and invitations are
|
|
145
|
+
* refused. Relay gives no reason; `me()` answers `eligible: false`.
|
|
146
|
+
*/
|
|
147
|
+
MemberBanned: "member-banned",
|
|
119
148
|
/** An operator locked the member's profile; hiding it is still allowed. */
|
|
120
149
|
ProfileLocked: "profile-locked",
|
|
121
150
|
/** No member in the project has the invitation code the member accepted. */
|
|
@@ -129,7 +158,7 @@ var RelayErrorCode = {
|
|
|
129
158
|
/** Too many requests; `retryAfter` says how long to wait when Relay knows. */
|
|
130
159
|
RateLimited: "rate-limited"
|
|
131
160
|
};
|
|
132
|
-
var relayErrorBrand = /* @__PURE__ */ Symbol.for("@domino-sdk/relay.RelayError");
|
|
161
|
+
var relayErrorBrand = /* @__PURE__ */ (() => /* @__PURE__ */ Symbol.for("@domino-sdk/relay.RelayError"))();
|
|
133
162
|
function isRelayError(value) {
|
|
134
163
|
return isRequestError(value) && value[relayErrorBrand] === true;
|
|
135
164
|
}
|
|
@@ -168,7 +197,7 @@ function parseInput(schema, value) {
|
|
|
168
197
|
const parsed = schema.safeParse(value);
|
|
169
198
|
if (!parsed.success) {
|
|
170
199
|
throw clientError(
|
|
171
|
-
|
|
200
|
+
issueText(parsed.error.issues),
|
|
172
201
|
RelayErrorCode.InvalidInput,
|
|
173
202
|
{ cause: parsed.error }
|
|
174
203
|
);
|
|
@@ -179,6 +208,8 @@ function parseInput(schema, value) {
|
|
|
179
208
|
export {
|
|
180
209
|
isRequestError,
|
|
181
210
|
RequestError,
|
|
211
|
+
issueText,
|
|
212
|
+
parseDefinition,
|
|
182
213
|
RelayErrorCode,
|
|
183
214
|
isRelayError,
|
|
184
215
|
RelayError,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RelayErrorCode,
|
|
3
3
|
clientError
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-EOUEAOWJ.js";
|
|
5
5
|
|
|
6
6
|
// src/plugin-client.ts
|
|
7
|
-
var transportKey = /* @__PURE__ */ Symbol.for("@domino-sdk/relay:plugin-transport");
|
|
7
|
+
var transportKey = /* @__PURE__ */ (() => /* @__PURE__ */ Symbol.for("@domino-sdk/relay:plugin-transport"))();
|
|
8
8
|
function setPluginTransport(client, transport) {
|
|
9
9
|
Object.defineProperty(client, transportKey, { value: transport });
|
|
10
10
|
}
|