@domino-sdk/relay 1.62.0 → 1.63.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 +120 -0
- package/dist/{accounts-CCqCKCVx.d.ts → accounts-nz3mzfRQ.d.ts} +21 -3
- package/dist/{attempt-captures-Cm-5G0PC.d.ts → attempt-captures-DMi8oR9T.d.ts} +1 -1
- package/dist/authoring.d.ts +54 -20
- package/dist/authoring.js +58 -24
- package/dist/{automatic-outcomes-pAsOyIVp.d.ts → automatic-outcomes-C_LLQU1p.d.ts} +11 -1
- package/dist/avatar.d.ts +1 -1
- package/dist/browser.d.ts +9 -9
- package/dist/browser.js +15 -13
- package/dist/capability-error-CuI_F7yM.d.ts +296 -0
- package/dist/{catalog--ZIlskAo.d.ts → catalog-BaTOKpNw.d.ts} +21 -10
- package/dist/{chunk-3PYYGFSB.js → chunk-3RFP6GT5.js} +3 -3
- package/dist/{chunk-HTZHBTIL.js → chunk-4GQW43UU.js} +193 -357
- package/dist/{chunk-D26YNACF.js → chunk-4NOFSGAL.js} +56 -56
- package/dist/{chunk-UW5232GG.js → chunk-5XLZ34PV.js} +5 -5
- package/dist/{chunk-QYPMPWVX.js → chunk-7X67QLPB.js} +43 -43
- package/dist/{chunk-5TEYFX6X.js → chunk-7Z4SZ6YM.js} +2 -2
- package/dist/{chunk-Y322OTCH.js → chunk-AQOL3SK5.js} +1 -1
- package/dist/{chunk-CICDIBOF.js → chunk-EHUSD3O2.js} +76 -72
- package/dist/chunk-FO2LCZTL.js +19 -0
- package/dist/{chunk-3KLC4AMA.js → chunk-FU5CGNTR.js} +135 -173
- package/dist/{chunk-K2KS3JLY.js → chunk-GLH6MEI2.js} +7 -2
- package/dist/chunk-ICXZZNPS.js +199 -0
- package/dist/{chunk-MK425RXJ.js → chunk-ID3BZXFZ.js} +709 -640
- package/dist/{chunk-UAKYDVT3.js → chunk-KP2MCX3R.js} +111 -89
- package/dist/{chunk-GKIFABGN.js → chunk-LZWXCBUB.js} +74 -247
- package/dist/{chunk-6WCIWXUV.js → chunk-MTKRIQEU.js} +2 -2
- package/dist/{chunk-4OC7REYX.js → chunk-MWMCQLCG.js} +3 -3
- package/dist/{chunk-XJFYAXET.js → chunk-N4BDKS6Y.js} +19 -19
- package/dist/{chunk-E6IKQHTX.js → chunk-N4LNEGQX.js} +2 -2
- package/dist/chunk-NQDEWJWE.js +554 -0
- package/dist/{chunk-GTDW453U.js → chunk-QR6HH4DI.js} +100 -114
- package/dist/chunk-TLSQETTY.js +41 -0
- 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-XNKSSE32.js → chunk-VWQGWGCH.js} +7 -7
- package/dist/{chunk-WSBYWVTZ.js → chunk-W7YSMSGC.js} +166 -158
- package/dist/{client-B-hbHX30.d.ts → client-DHmG7rn6.d.ts} +25 -61
- package/dist/{capability-error-DFMwSuSf.d.ts → dashboards-CLemT6kj.d.ts} +14 -294
- package/dist/{deployments-M4OHn7G3.d.ts → deployments-DTULi7dF.d.ts} +46 -3
- package/dist/{identity-integration-3mX6b5iH.d.ts → identity-integration-DOeNZaxF.d.ts} +32 -2
- package/dist/index.d.ts +10 -10
- package/dist/index.js +13 -11
- package/dist/internal.d.ts +27 -13
- package/dist/internal.js +41 -13
- package/dist/{analytics-BwAKLi7O.d.ts → limits-kNzYdZ00.d.ts} +124 -3
- package/dist/{offers-DhAtss4_.d.ts → offers-CYeN_I0Y.d.ts} +3 -2
- package/dist/portal-proxy.d.ts +19 -3
- package/dist/portal-proxy.js +64 -22
- package/dist/react/index.d.ts +21 -14
- package/dist/react/index.js +55 -29
- package/dist/{pages-B8q8Y_dQ.d.ts → reward-deliveries-drp-x1G-.d.ts} +300 -233
- package/dist/runtime/authoring.js +1 -1
- package/dist/runtime/chunks/UGDV5W4N.js +1 -0
- package/dist/runtime/manifest.json +3 -3
- package/dist/runtime/schema.js +1 -1
- package/dist/schema.d.ts +193 -18
- package/dist/schema.js +31 -26
- package/dist/server/index.d.ts +13 -13
- package/dist/server/index.js +5885 -6224
- package/dist/{sign-in-providers-BkjcDsFF.d.ts → sign-in-providers-B1Q9eDRm.d.ts} +7 -2
- package/dist/{submission-input-DHGKhXfp.d.ts → submission-input-DZCbjQUH.d.ts} +3 -2
- package/dist/{telegram-browser-BCE7zdOb.d.ts → telegram-browser-NL0Asmsi.d.ts} +4 -4
- package/dist/telegram.d.ts +8 -8
- package/dist/telegram.js +2 -2
- package/dist/testing.d.ts +228 -26
- package/dist/testing.js +137 -92
- package/dist/{tracker-data-Hb1uQnk5.d.ts → tracker-data-esm3WG8R.d.ts} +34 -8
- package/dist/{transport-DkhX2Cbs.d.ts → transport-Czht_irp.d.ts} +41259 -39835
- package/dist/{wallet-DTO7SXj7.d.ts → wallet-B7e06v4m.d.ts} +14 -4
- package/package.json +1 -1
- package/dist/chunk-UPQPUJOU.js +0 -457
- package/dist/runtime/chunks/Y4OAVXFR.js +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createRelayAction,
|
|
3
3
|
withActionId
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-AQOL3SK5.js";
|
|
5
5
|
import {
|
|
6
6
|
setPluginTransport
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-MTKRIQEU.js";
|
|
8
8
|
import {
|
|
9
9
|
authProvidersSchema,
|
|
10
10
|
collectionPassSchema,
|
|
@@ -23,12 +23,12 @@ import {
|
|
|
23
23
|
questOutcomeSchema,
|
|
24
24
|
rewardDeliveriesSchema,
|
|
25
25
|
rewardDeliveryQuerySchema
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-EHUSD3O2.js";
|
|
27
27
|
import {
|
|
28
28
|
participantActivityQuerySchema,
|
|
29
29
|
participantActivitySchema,
|
|
30
30
|
questExperienceSchema
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-4NOFSGAL.js";
|
|
32
32
|
import {
|
|
33
33
|
engagementBoundaryPageSchema,
|
|
34
34
|
engagementPageQuerySchema,
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
referralDefinitionSchema,
|
|
40
40
|
referralHistorySchema,
|
|
41
41
|
referralSummarySchema
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-QR6HH4DI.js";
|
|
43
43
|
import {
|
|
44
44
|
AVATAR_UPLOAD_LIMIT,
|
|
45
45
|
avatarUploadTypes,
|
|
@@ -62,22 +62,25 @@ import {
|
|
|
62
62
|
profileReferralSchema,
|
|
63
63
|
profileSummarySchema,
|
|
64
64
|
profileUpdateSchema
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-W7YSMSGC.js";
|
|
66
|
+
import {
|
|
67
|
+
createHttpExchange,
|
|
68
|
+
untilAborted,
|
|
69
|
+
withQuery
|
|
70
|
+
} from "./chunk-ICXZZNPS.js";
|
|
66
71
|
import {
|
|
67
72
|
PARTICIPANT_TIMEOUT,
|
|
68
|
-
clientIdentity,
|
|
69
73
|
lifetime,
|
|
70
|
-
retryAfter,
|
|
71
74
|
retrying,
|
|
72
75
|
validTimeout
|
|
73
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-3RFP6GT5.js";
|
|
74
77
|
import {
|
|
75
78
|
exchangeResultSchema,
|
|
76
79
|
exchangeSchema,
|
|
77
80
|
memberSummarySchema,
|
|
78
81
|
participantSessionSchema,
|
|
79
82
|
sessionMember
|
|
80
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-N4BDKS6Y.js";
|
|
81
84
|
import {
|
|
82
85
|
accountConnectionSchema,
|
|
83
86
|
attemptSchema,
|
|
@@ -112,7 +115,7 @@ import {
|
|
|
112
115
|
walletMessageChallengeSchema,
|
|
113
116
|
walletSignatureSchema,
|
|
114
117
|
walletUnlinkInputSchema
|
|
115
|
-
} from "./chunk-
|
|
118
|
+
} from "./chunk-ID3BZXFZ.js";
|
|
116
119
|
import {
|
|
117
120
|
RelayError,
|
|
118
121
|
RelayErrorCode,
|
|
@@ -120,24 +123,24 @@ import {
|
|
|
120
123
|
isRelayError,
|
|
121
124
|
isRequestError,
|
|
122
125
|
parseInput
|
|
123
|
-
} from "./chunk-
|
|
126
|
+
} from "./chunk-GLH6MEI2.js";
|
|
124
127
|
|
|
125
128
|
// src/legacy-submissions.ts
|
|
126
129
|
import * as z from "zod";
|
|
127
|
-
var common = {
|
|
130
|
+
var common = /* @__PURE__ */ (() => ({
|
|
128
131
|
id: identifier,
|
|
129
132
|
quest: identifier,
|
|
130
133
|
release: identifier.optional()
|
|
131
|
-
};
|
|
132
|
-
var claimInputSchema = z.union([
|
|
134
|
+
}))();
|
|
135
|
+
var claimInputSchema = /* @__PURE__ */ (() => z.union([
|
|
133
136
|
submissionEvidenceSchema,
|
|
134
137
|
z.object({ kind: z.literal("none") }).strict()
|
|
135
|
-
]);
|
|
136
|
-
var draftSchema = z.union([
|
|
138
|
+
]))();
|
|
139
|
+
var draftSchema = /* @__PURE__ */ (() => z.union([
|
|
137
140
|
claimInputSchema,
|
|
138
141
|
z.object({ kind: z.literal("photo"), file: z.instanceof(Blob) })
|
|
139
|
-
]);
|
|
140
|
-
var activeRecordSchema = z.union([
|
|
142
|
+
]))();
|
|
143
|
+
var activeRecordSchema = /* @__PURE__ */ (() => z.union([
|
|
141
144
|
z.object({
|
|
142
145
|
...common,
|
|
143
146
|
stage: z.literal("review"),
|
|
@@ -163,15 +166,15 @@ var activeRecordSchema = z.union([
|
|
|
163
166
|
input: claimInputSchema,
|
|
164
167
|
attempt: identifier
|
|
165
168
|
})
|
|
166
|
-
]);
|
|
167
|
-
var recordSchema = z.union([
|
|
169
|
+
]))();
|
|
170
|
+
var recordSchema = /* @__PURE__ */ (() => z.union([
|
|
168
171
|
activeRecordSchema,
|
|
169
172
|
z.object({
|
|
170
173
|
...common,
|
|
171
174
|
stage: z.literal("retired"),
|
|
172
175
|
previous: activeRecordSchema
|
|
173
176
|
})
|
|
174
|
-
]);
|
|
177
|
+
]))();
|
|
175
178
|
function legacySubmissions(transport, configuredStore, namespace) {
|
|
176
179
|
async function open(quest, options = {
|
|
177
180
|
input: "photo"
|
|
@@ -806,7 +809,7 @@ import * as z2 from "zod";
|
|
|
806
809
|
|
|
807
810
|
// src/progress.ts
|
|
808
811
|
function sessionEnded(error) {
|
|
809
|
-
return isRequestError(error) && (error.code === RelayErrorCode.StaleSession || error.code === RelayErrorCode.NotSignedIn);
|
|
812
|
+
return isRequestError(error) && (error.code === RelayErrorCode.StaleSession || error.code === RelayErrorCode.NotSignedIn || error.code === RelayErrorCode.Unauthenticated);
|
|
810
813
|
}
|
|
811
814
|
function observeProgress(transport, listener, options = {}, onDispose = () => {
|
|
812
815
|
}) {
|
|
@@ -1121,14 +1124,14 @@ function questActions(submission, latest) {
|
|
|
1121
1124
|
}
|
|
1122
1125
|
|
|
1123
1126
|
// src/client.ts
|
|
1124
|
-
var authStartSchema = z2.strictObject({
|
|
1127
|
+
var authStartSchema = /* @__PURE__ */ (() => z2.strictObject({
|
|
1125
1128
|
provider: signInProviderInputSchema,
|
|
1126
1129
|
mode: z2.enum(["sign-in", "connect"])
|
|
1127
|
-
});
|
|
1128
|
-
var emailVerificationSchema = z2.strictObject({
|
|
1130
|
+
}))();
|
|
1131
|
+
var emailVerificationSchema = /* @__PURE__ */ (() => z2.strictObject({
|
|
1129
1132
|
challenge: z2.string().min(1).max(200),
|
|
1130
1133
|
code: z2.string().transform((code) => code.trim()).pipe(z2.string().regex(/^\d{6}$/, "Enter the 6-digit code"))
|
|
1131
|
-
});
|
|
1134
|
+
}))();
|
|
1132
1135
|
function errorBody(value) {
|
|
1133
1136
|
const body = value !== null && typeof value === "object" ? value : {};
|
|
1134
1137
|
const window = body.window === "tracker" ? "tracker" : body.window === "quest" ? "quest" : void 0;
|
|
@@ -1144,24 +1147,16 @@ function errorBody(value) {
|
|
|
1144
1147
|
};
|
|
1145
1148
|
}
|
|
1146
1149
|
async function fromSigner(step, signal) {
|
|
1147
|
-
let stop;
|
|
1148
1150
|
try {
|
|
1149
|
-
return await
|
|
1150
|
-
stop = () => reject(
|
|
1151
|
-
new RelayError("The request was cancelled", {
|
|
1152
|
-
kind: "aborted",
|
|
1153
|
-
code: RelayErrorCode.Aborted,
|
|
1154
|
-
cause: signal?.reason
|
|
1155
|
-
})
|
|
1156
|
-
);
|
|
1157
|
-
if (signal?.aborted) {
|
|
1158
|
-
stop();
|
|
1159
|
-
return;
|
|
1160
|
-
}
|
|
1161
|
-
signal?.addEventListener("abort", stop, { once: true });
|
|
1162
|
-
step().then(resolve, reject);
|
|
1163
|
-
});
|
|
1151
|
+
return await untilAborted(step, signal);
|
|
1164
1152
|
} catch (error) {
|
|
1153
|
+
if (signal?.aborted && error === signal.reason) {
|
|
1154
|
+
throw new RelayError("The request was cancelled", {
|
|
1155
|
+
kind: "aborted",
|
|
1156
|
+
code: RelayErrorCode.Aborted,
|
|
1157
|
+
cause: error
|
|
1158
|
+
});
|
|
1159
|
+
}
|
|
1165
1160
|
if (error instanceof RelayError) {
|
|
1166
1161
|
throw error;
|
|
1167
1162
|
}
|
|
@@ -1170,59 +1165,13 @@ async function fromSigner(step, signal) {
|
|
|
1170
1165
|
RelayErrorCode.WalletSigner,
|
|
1171
1166
|
{ cause: error }
|
|
1172
1167
|
);
|
|
1173
|
-
} finally {
|
|
1174
|
-
if (stop) {
|
|
1175
|
-
signal?.removeEventListener("abort", stop);
|
|
1176
|
-
}
|
|
1177
1168
|
}
|
|
1178
1169
|
}
|
|
1179
1170
|
var invalidTimeout = () => clientError(
|
|
1180
1171
|
"timeout must be a positive, finite number of milliseconds",
|
|
1181
1172
|
RelayErrorCode.InvalidInput
|
|
1182
1173
|
);
|
|
1183
|
-
var uncertainStatuses = /* @__PURE__ */ new Set([500, 502, 504]);
|
|
1184
1174
|
var methodOf = (call) => call.method ?? (call.json === void 0 ? "GET" : "POST");
|
|
1185
|
-
function withQuery(path, values) {
|
|
1186
|
-
const params = new URLSearchParams();
|
|
1187
|
-
for (const [key, value] of Object.entries(values)) {
|
|
1188
|
-
if (value !== void 0) {
|
|
1189
|
-
params.set(key, String(value));
|
|
1190
|
-
}
|
|
1191
|
-
}
|
|
1192
|
-
const search = params.toString();
|
|
1193
|
-
return search ? path + "?" + search : path;
|
|
1194
|
-
}
|
|
1195
|
-
function interrupted(call, life, error, stage) {
|
|
1196
|
-
const details = {
|
|
1197
|
-
status: stage.status,
|
|
1198
|
-
retryAfter: stage.headers ? retryAfter(stage.headers) : void 0,
|
|
1199
|
-
operationId: call.operationId,
|
|
1200
|
-
replaySafe: call.replaySafe,
|
|
1201
|
-
uncertain: stage.sent && methodOf(call) !== "GET" && // An error status whose body broke off still refused the write, unless the status itself
|
|
1202
|
-
// does not prove that (500, 502, 504).
|
|
1203
|
-
(!stage.refused || uncertainStatuses.has(stage.status ?? 0)),
|
|
1204
|
-
cause: error
|
|
1205
|
-
};
|
|
1206
|
-
const ended = life.ended();
|
|
1207
|
-
if (ended === "aborted") {
|
|
1208
|
-
return new RelayError("The request was cancelled", {
|
|
1209
|
-
...details,
|
|
1210
|
-
kind: "aborted",
|
|
1211
|
-
code: RelayErrorCode.Aborted
|
|
1212
|
-
});
|
|
1213
|
-
}
|
|
1214
|
-
if (ended === "timeout") {
|
|
1215
|
-
return new RelayError(`Relay did not respond within ${life.timeout} ms`, {
|
|
1216
|
-
...details,
|
|
1217
|
-
kind: "timeout",
|
|
1218
|
-
code: RelayErrorCode.Timeout
|
|
1219
|
-
});
|
|
1220
|
-
}
|
|
1221
|
-
return new RelayError(
|
|
1222
|
-
stage.status === void 0 ? "Could not reach Relay" : "Relay's response was cut off",
|
|
1223
|
-
{ ...details, kind: "network", code: RelayErrorCode.Network }
|
|
1224
|
-
);
|
|
1225
|
-
}
|
|
1226
1175
|
function createRelayClient(options) {
|
|
1227
1176
|
return relayClient(options);
|
|
1228
1177
|
}
|
|
@@ -1236,158 +1185,28 @@ function relayClient(options) {
|
|
|
1236
1185
|
RelayErrorCode.InvalidInput
|
|
1237
1186
|
);
|
|
1238
1187
|
}
|
|
1239
|
-
try {
|
|
1240
|
-
const headers = new Headers(options.headers);
|
|
1241
|
-
if (options.token) {
|
|
1242
|
-
headers.set("Authorization", `Bearer ${options.token}`);
|
|
1243
|
-
}
|
|
1244
|
-
headers.set("X-Relay-Organization", options.organization ?? "");
|
|
1245
|
-
headers.set("X-Relay-Project", options.project ?? "");
|
|
1246
|
-
} catch (error) {
|
|
1247
|
-
throw clientError(
|
|
1248
|
-
"headers, token, organization and project must be valid HTTP header values",
|
|
1249
|
-
RelayErrorCode.InvalidInput,
|
|
1250
|
-
{ cause: error }
|
|
1251
|
-
);
|
|
1252
|
-
}
|
|
1253
1188
|
const clientTimeout = options.timeout ?? PARTICIPANT_TIMEOUT;
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
}
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
cause: error
|
|
1276
|
-
});
|
|
1277
|
-
}
|
|
1278
|
-
}
|
|
1279
|
-
async function send(path, call, life) {
|
|
1280
|
-
if (life.signal.aborted) {
|
|
1281
|
-
throw interrupted(call, life, life.reason(), { sent: false });
|
|
1282
|
-
}
|
|
1283
|
-
const method = methodOf(call);
|
|
1284
|
-
const token = await credential(call, life);
|
|
1285
|
-
let headers;
|
|
1286
|
-
let body2 = call.body;
|
|
1287
|
-
try {
|
|
1288
|
-
headers = new Headers(options.headers);
|
|
1289
|
-
new Headers(call.headers).forEach(
|
|
1290
|
-
(value, name) => headers.set(name, value)
|
|
1291
|
-
);
|
|
1292
|
-
headers.set("X-Domino-Client", clientIdentity());
|
|
1293
|
-
if (token) {
|
|
1294
|
-
try {
|
|
1295
|
-
headers.set("Authorization", `Bearer ${token}`);
|
|
1296
|
-
} catch (error) {
|
|
1297
|
-
throw new RelayError(
|
|
1298
|
-
"getToken returned a value that is not a token",
|
|
1299
|
-
{
|
|
1300
|
-
kind: "client",
|
|
1301
|
-
code: RelayErrorCode.Credential,
|
|
1302
|
-
operationId: call.operationId,
|
|
1303
|
-
replaySafe: call.replaySafe,
|
|
1304
|
-
cause: error
|
|
1305
|
-
}
|
|
1306
|
-
);
|
|
1307
|
-
}
|
|
1308
|
-
} else if (options.getToken) {
|
|
1309
|
-
headers.delete("Authorization");
|
|
1310
|
-
}
|
|
1311
|
-
if (options.organization) {
|
|
1312
|
-
headers.set("X-Relay-Organization", options.organization);
|
|
1313
|
-
}
|
|
1314
|
-
if (options.project) {
|
|
1315
|
-
headers.set("X-Relay-Project", options.project);
|
|
1316
|
-
}
|
|
1317
|
-
if (options.environment) {
|
|
1318
|
-
headers.set("X-Relay-Environment", options.environment);
|
|
1319
|
-
}
|
|
1320
|
-
if (call.options?.session) {
|
|
1321
|
-
headers.set("X-Relay-Session", call.options.session);
|
|
1322
|
-
}
|
|
1323
|
-
if (call.json !== void 0) {
|
|
1324
|
-
headers.set("Content-Type", "application/json");
|
|
1325
|
-
body2 = JSON.stringify(call.json);
|
|
1326
|
-
}
|
|
1327
|
-
if (method !== "GET") {
|
|
1328
|
-
headers.set("X-Relay-CSRF", "1");
|
|
1329
|
-
}
|
|
1330
|
-
} catch (error) {
|
|
1331
|
-
if (isRelayError(error)) {
|
|
1332
|
-
throw error;
|
|
1333
|
-
}
|
|
1334
|
-
throw clientError(
|
|
1335
|
-
"The request has a header or body that cannot be sent",
|
|
1336
|
-
RelayErrorCode.InvalidInput,
|
|
1337
|
-
{
|
|
1338
|
-
operationId: call.operationId,
|
|
1339
|
-
replaySafe: call.replaySafe,
|
|
1340
|
-
cause: error
|
|
1341
|
-
}
|
|
1342
|
-
);
|
|
1343
|
-
}
|
|
1344
|
-
if (life.signal.aborted) {
|
|
1345
|
-
throw interrupted(call, life, life.reason(), { sent: false });
|
|
1346
|
-
}
|
|
1347
|
-
let response;
|
|
1348
|
-
try {
|
|
1349
|
-
response = await (options.fetch ?? fetch)(options.baseUrl + path, {
|
|
1350
|
-
method,
|
|
1351
|
-
headers,
|
|
1352
|
-
body: body2,
|
|
1353
|
-
signal: life.signal
|
|
1354
|
-
});
|
|
1355
|
-
} catch (error) {
|
|
1356
|
-
throw interrupted(call, life, error, { sent: true });
|
|
1357
|
-
}
|
|
1358
|
-
if (!response.ok) {
|
|
1359
|
-
let text;
|
|
1360
|
-
try {
|
|
1361
|
-
text = await response.text();
|
|
1362
|
-
} catch (error) {
|
|
1363
|
-
throw interrupted(call, life, error, {
|
|
1364
|
-
sent: true,
|
|
1365
|
-
status: response.status,
|
|
1366
|
-
headers: response.headers,
|
|
1367
|
-
refused: true
|
|
1368
|
-
});
|
|
1369
|
-
}
|
|
1370
|
-
let value = null;
|
|
1371
|
-
try {
|
|
1372
|
-
value = JSON.parse(text);
|
|
1373
|
-
} catch {
|
|
1374
|
-
}
|
|
1375
|
-
const { message, code, window, missing, retryAt } = errorBody(value);
|
|
1376
|
-
throw new RelayError(message ?? `Request failed (${response.status})`, {
|
|
1377
|
-
kind: "http",
|
|
1378
|
-
status: response.status,
|
|
1379
|
-
code,
|
|
1380
|
-
window,
|
|
1381
|
-
missing,
|
|
1382
|
-
...retryAt === void 0 ? {} : { retryAt },
|
|
1383
|
-
operationId: call.operationId,
|
|
1384
|
-
replaySafe: call.replaySafe,
|
|
1385
|
-
uncertain: methodOf(call) !== "GET" && uncertainStatuses.has(response.status),
|
|
1386
|
-
retryAfter: retryAfter(response.headers)
|
|
1387
|
-
});
|
|
1388
|
-
}
|
|
1389
|
-
return response;
|
|
1390
|
-
}
|
|
1189
|
+
const http = createHttpExchange(options, {
|
|
1190
|
+
csrf: true,
|
|
1191
|
+
session: (call) => call.options?.session,
|
|
1192
|
+
messages: {
|
|
1193
|
+
aborted: "The request was cancelled",
|
|
1194
|
+
timeout: (milliseconds) => `Relay did not respond within ${milliseconds} ms`,
|
|
1195
|
+
network: (status) => status === void 0 ? "Could not reach Relay" : "Relay's response was cut off",
|
|
1196
|
+
credential: "Could not get a Relay credential",
|
|
1197
|
+
invalidToken: "getToken returned a value that is not a token",
|
|
1198
|
+
invalidOptions: "headers, token, organization and project must be valid HTTP header values",
|
|
1199
|
+
unsendable: "The request has a header or body that cannot be sent"
|
|
1200
|
+
},
|
|
1201
|
+
// Unlike the management client's, a write that failed to connect stays uncertain: this client
|
|
1202
|
+
// does not read the socket error that would prove it was never sent.
|
|
1203
|
+
makeError: (message, details, call) => new RelayError(message, {
|
|
1204
|
+
...details,
|
|
1205
|
+
operationId: call?.operationId,
|
|
1206
|
+
replaySafe: call?.replaySafe
|
|
1207
|
+
}),
|
|
1208
|
+
parseRefusal: errorBody
|
|
1209
|
+
});
|
|
1391
1210
|
async function exchange(path, call, receive) {
|
|
1392
1211
|
const timeout = call.options?.timeout ?? clientTimeout;
|
|
1393
1212
|
if (!validTimeout(timeout)) {
|
|
@@ -1400,7 +1219,7 @@ function relayClient(options) {
|
|
|
1400
1219
|
{
|
|
1401
1220
|
replaySafe: methodOf(call) === "GET" || (call.replaySafe ?? call.operationId !== void 0)
|
|
1402
1221
|
},
|
|
1403
|
-
async () => receive(await send(path, call, life), life)
|
|
1222
|
+
async () => receive(await http.send(path, call, call, life), life)
|
|
1404
1223
|
);
|
|
1405
1224
|
} finally {
|
|
1406
1225
|
life.end();
|
|
@@ -1410,7 +1229,7 @@ function relayClient(options) {
|
|
|
1410
1229
|
try {
|
|
1411
1230
|
return await reader(response);
|
|
1412
1231
|
} catch (error) {
|
|
1413
|
-
throw interrupted(call,
|
|
1232
|
+
throw http.interrupted(error, methodOf(call), call, life, {
|
|
1414
1233
|
sent: true,
|
|
1415
1234
|
status: response.status,
|
|
1416
1235
|
headers: response.headers
|
|
@@ -1869,7 +1688,8 @@ function relayClient(options) {
|
|
|
1869
1688
|
* Claims one of the signed-in member's outcomes skipped as `historical`, on a quest whose
|
|
1870
1689
|
* historical policy is `"claim"` (`outcome.claimable`). Relay decides it again with
|
|
1871
1690
|
* historical activity released and returns the outcome; a rule that still fails rejects
|
|
1872
|
-
* with a `RelayError` whose code is that rule's skip code.
|
|
1691
|
+
* with a `RelayError` whose code is that rule's skip code. This claim is of a skipped
|
|
1692
|
+
* outcome; `me.claim` submits an attempt.
|
|
1873
1693
|
*/
|
|
1874
1694
|
claim: async (value, requestOptions) => {
|
|
1875
1695
|
const body2 = parseInput(questClaimInputSchema, withActionId(value));
|
|
@@ -2344,11 +2164,13 @@ function relayClient(options) {
|
|
|
2344
2164
|
}),
|
|
2345
2165
|
/**
|
|
2346
2166
|
* The member's reward deliveries, newest first, one page at a time. Pass a page's
|
|
2347
|
-
* `nextCursor` back as `cursor` for older ones; `limit` is 1 to 500, 500 by default.
|
|
2167
|
+
* `nextCursor` back as `cursor` for older ones; `limit` is 1 to 500, 500 by default. The
|
|
2168
|
+
* page answers its deliveries as `items` (and, for 1.x callers, as `deliveries`), so
|
|
2169
|
+
* `paginate((cursor) => relay.me.rewardDeliveries({ cursor }))` reads them all.
|
|
2348
2170
|
*/
|
|
2349
|
-
rewardDeliveries: (requestOptions = {}) => {
|
|
2171
|
+
rewardDeliveries: async (requestOptions = {}) => {
|
|
2350
2172
|
const { cursor, limit, ...options2 } = requestOptions;
|
|
2351
|
-
|
|
2173
|
+
const page = await request(
|
|
2352
2174
|
withQuery(
|
|
2353
2175
|
"/v1/reward-deliveries",
|
|
2354
2176
|
parseInput(rewardDeliveryQuerySchema, { cursor, limit })
|
|
@@ -2356,6 +2178,7 @@ function relayClient(options) {
|
|
|
2356
2178
|
rewardDeliveriesSchema,
|
|
2357
2179
|
{ options: options2 }
|
|
2358
2180
|
);
|
|
2181
|
+
return { ...page, items: page.items ?? page.deliveries };
|
|
2359
2182
|
},
|
|
2360
2183
|
/**
|
|
2361
2184
|
* `{ items }`: the member's balance in each of the project's point ledgers, in the project's
|
|
@@ -2388,7 +2211,11 @@ function relayClient(options) {
|
|
|
2388
2211
|
{ options: requestOptions }
|
|
2389
2212
|
);
|
|
2390
2213
|
},
|
|
2391
|
-
/**
|
|
2214
|
+
/**
|
|
2215
|
+
* Submits an attempt at a quest for the signed-in member, whatever input the quest takes;
|
|
2216
|
+
* a quest whose interaction is `"claim"` takes none. Quest controllers (`quests.open`) call
|
|
2217
|
+
* this. `quests.claim` is different: it claims an outcome skipped as historical.
|
|
2218
|
+
*/
|
|
2392
2219
|
claim: async (value, requestOptions) => {
|
|
2393
2220
|
const claim = parseInput(
|
|
2394
2221
|
submitSchema.omit({ member: true }),
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RelayErrorCode,
|
|
3
3
|
clientError
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-GLH6MEI2.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
|
}
|
|
@@ -6,7 +6,7 @@ var capabilityErrorCodes = [
|
|
|
6
6
|
"author-error"
|
|
7
7
|
];
|
|
8
8
|
var isKnown = (code) => capabilityErrorCodes.includes(code);
|
|
9
|
-
var capabilityFailureSchema = z.looseObject({
|
|
9
|
+
var capabilityFailureSchema = /* @__PURE__ */ (() => z.looseObject({
|
|
10
10
|
code: z.string().min(1),
|
|
11
11
|
message: z.string().min(1),
|
|
12
12
|
/**
|
|
@@ -16,8 +16,8 @@ var capabilityFailureSchema = z.looseObject({
|
|
|
16
16
|
* handles and moves past is final for the attempt; one that escapes the evaluation is retried.
|
|
17
17
|
*/
|
|
18
18
|
retryable: z.boolean()
|
|
19
|
-
});
|
|
20
|
-
var brand = /* @__PURE__ */ Symbol.for("@domino-sdk/relay/CapabilityError");
|
|
19
|
+
}))();
|
|
20
|
+
var brand = /* @__PURE__ */ (() => /* @__PURE__ */ Symbol.for("@domino-sdk/relay/CapabilityError"))();
|
|
21
21
|
var CapabilityError = class _CapabilityError extends Error {
|
|
22
22
|
code;
|
|
23
23
|
retryable;
|
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
import {
|
|
2
2
|
identifier
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ID3BZXFZ.js";
|
|
4
4
|
|
|
5
5
|
// src/auth.ts
|
|
6
6
|
import * as z from "zod";
|
|
7
|
-
var authScopeSchema = z.object({
|
|
7
|
+
var authScopeSchema = /* @__PURE__ */ (() => z.object({
|
|
8
8
|
organization: identifier,
|
|
9
9
|
project: identifier,
|
|
10
10
|
environment: z.enum(["test", "live"])
|
|
11
|
-
}).strict();
|
|
12
|
-
var principalSchema = z.discriminatedUnion("kind", [
|
|
11
|
+
}).strict())();
|
|
12
|
+
var principalSchema = /* @__PURE__ */ (() => z.discriminatedUnion("kind", [
|
|
13
13
|
z.object({ kind: z.literal("member"), member: identifier }),
|
|
14
14
|
z.object({ kind: z.literal("staff"), subject: identifier }),
|
|
15
15
|
z.object({ kind: z.literal("operator"), subject: identifier })
|
|
16
|
-
]);
|
|
17
|
-
var sessionSchema = z.object({
|
|
16
|
+
]))();
|
|
17
|
+
var sessionSchema = /* @__PURE__ */ (() => z.object({
|
|
18
18
|
...authScopeSchema.shape,
|
|
19
19
|
id: identifier,
|
|
20
20
|
principal: principalSchema,
|
|
21
21
|
expiresAt: z.number()
|
|
22
|
-
});
|
|
23
|
-
var knownPrincipalKinds = principalSchema.options.map(
|
|
22
|
+
}))();
|
|
23
|
+
var knownPrincipalKinds = /* @__PURE__ */ (() => principalSchema.options.map(
|
|
24
24
|
(option) => option.shape.kind.value
|
|
25
|
-
);
|
|
26
|
-
var participantPrincipalSchema = z.union([
|
|
25
|
+
))();
|
|
26
|
+
var participantPrincipalSchema = /* @__PURE__ */ (() => z.union([
|
|
27
27
|
principalSchema,
|
|
28
28
|
z.object({ kind: z.string().min(1) }).refine((principal) => !knownPrincipalKinds.includes(principal.kind))
|
|
29
|
-
]);
|
|
30
|
-
var participantSessionSchema = z.object({
|
|
29
|
+
]))();
|
|
30
|
+
var participantSessionSchema = /* @__PURE__ */ (() => z.object({
|
|
31
31
|
...authScopeSchema.shape,
|
|
32
32
|
id: identifier,
|
|
33
33
|
principal: participantPrincipalSchema,
|
|
34
34
|
expiresAt: z.number()
|
|
35
|
-
});
|
|
35
|
+
}))();
|
|
36
36
|
function sessionMember(session) {
|
|
37
37
|
const principal = session?.principal;
|
|
38
38
|
return principal?.kind === "member" && "member" in principal ? principal.member : null;
|
|
39
39
|
}
|
|
40
|
-
var memberSummarySchema = z.object({
|
|
40
|
+
var memberSummarySchema = /* @__PURE__ */ (() => z.object({
|
|
41
41
|
member: identifier,
|
|
42
42
|
avatarSeed: z.string().min(1).max(100),
|
|
43
43
|
/**
|
|
@@ -64,15 +64,15 @@ var memberSummarySchema = z.object({
|
|
|
64
64
|
now: z.number().int().nonnegative(),
|
|
65
65
|
offsetMs: z.number().int()
|
|
66
66
|
}).optional()
|
|
67
|
-
});
|
|
68
|
-
var exchangeSchema = authScopeSchema.extend({
|
|
67
|
+
}))();
|
|
68
|
+
var exchangeSchema = /* @__PURE__ */ (() => authScopeSchema.extend({
|
|
69
69
|
identity: z.object({ issuer: identifier, subject: z.string().min(1).max(200) }).strict(),
|
|
70
70
|
role: z.enum(["member", "staff", "operator"])
|
|
71
|
-
}).strict();
|
|
72
|
-
var exchangeResultSchema = z.object({
|
|
71
|
+
}).strict())();
|
|
72
|
+
var exchangeResultSchema = /* @__PURE__ */ (() => z.object({
|
|
73
73
|
token: z.string(),
|
|
74
74
|
session: sessionSchema
|
|
75
|
-
});
|
|
75
|
+
}))();
|
|
76
76
|
|
|
77
77
|
export {
|
|
78
78
|
authScopeSchema,
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
imageFieldsSchema,
|
|
5
5
|
imageInspectionSchema,
|
|
6
6
|
imageSightingsSchema
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-7X67QLPB.js";
|
|
8
8
|
import {
|
|
9
9
|
photoResultSchema
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-ID3BZXFZ.js";
|
|
11
11
|
|
|
12
12
|
// src/image-results.ts
|
|
13
13
|
import * as z from "zod";
|