@domino-sdk/relay 1.60.0 → 1.62.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 +175 -8
- package/README.md +3 -2
- package/dist/{schema-CwbRkmlr.d.ts → accounts-CCqCKCVx.d.ts} +3127 -1764
- package/dist/action-9Xl0StBg.d.ts +33 -0
- package/dist/{analytics-URV-mxjH.d.ts → analytics-BwAKLi7O.d.ts} +347 -3
- package/dist/{attempt-captures-W2dgzGqE.d.ts → attempt-captures-Cm-5G0PC.d.ts} +1 -1
- package/dist/authoring.d.ts +130 -42
- package/dist/authoring.js +105 -19
- package/dist/{automatic-outcomes-Cmou89IS.d.ts → automatic-outcomes-pAsOyIVp.d.ts} +5 -1
- package/dist/avatar.d.ts +1 -1
- package/dist/browser.d.ts +15 -11
- package/dist/browser.js +15 -11
- package/dist/{integrations-CmIkP1Gi.d.ts → capability-error-DFMwSuSf.d.ts} +160 -42
- package/dist/{pages-Bti7g5mX.d.ts → catalog--ZIlskAo.d.ts} +39 -561
- package/dist/{chunk-N3LJ6GFK.js → chunk-3KLC4AMA.js} +40 -11
- package/dist/{chunk-6ZG7WNYX.js → chunk-3PYYGFSB.js} +14 -2
- package/dist/{chunk-VWMIA2TT.js → chunk-5TEYFX6X.js} +2 -2
- package/dist/chunk-6WCIWXUV.js +31 -0
- package/dist/chunk-CICDIBOF.js +373 -0
- package/dist/{chunk-MHPKEVEW.js → chunk-CZFXGGEK.js} +5 -0
- package/dist/chunk-D26YNACF.js +320 -0
- package/dist/{chunk-KUPVQXUJ.js → chunk-E6IKQHTX.js} +2 -2
- package/dist/chunk-FWLQ5XCS.js +21 -0
- package/dist/{chunk-VVRQQRMQ.js → chunk-GKIFABGN.js} +150 -61
- package/dist/chunk-GTDW453U.js +522 -0
- package/dist/{chunk-Y2IGFLD2.js → chunk-HTZHBTIL.js} +69 -27
- package/dist/chunk-K2KS3JLY.js +188 -0
- package/dist/{chunk-GBSDAD3N.js → chunk-MK425RXJ.js} +3140 -3202
- package/dist/{chunk-YOAPPIWN.js → chunk-QYPMPWVX.js} +1 -1
- package/dist/chunk-UAKYDVT3.js +565 -0
- package/dist/{chunk-KWFY7L7X.js → chunk-UPQPUJOU.js} +36 -123
- package/dist/{chunk-2FHNY52R.js → chunk-UW5232GG.js} +65 -19
- package/dist/chunk-WSBYWVTZ.js +717 -0
- package/dist/{chunk-422J3QRW.js → chunk-XJFYAXET.js} +9 -8
- package/dist/{chunk-OTEUP2SG.js → chunk-XNKSSE32.js} +1 -1
- package/dist/{chunk-4OFH4BNX.js → chunk-Y322OTCH.js} +1 -1
- package/dist/{client-Cw1pB5sv.d.ts → client-B-hbHX30.d.ts} +109 -40
- package/dist/{deployments-DI-W7fBq.d.ts → deployments-M4OHn7G3.d.ts} +407 -18
- package/dist/identity-integration-3mX6b5iH.d.ts +1241 -0
- package/dist/index.d.ts +13 -11
- package/dist/index.js +14 -11
- package/dist/internal.d.ts +14 -12
- package/dist/internal.js +26 -14
- package/dist/{offers-CqXfMIxq.d.ts → offers-DhAtss4_.d.ts} +21 -4
- package/dist/pages-B8q8Y_dQ.d.ts +715 -0
- package/dist/{participant-activity-DHL8QYks.d.ts → participant-activity-D-Drp24G.d.ts} +16 -3
- package/dist/portal-proxy.d.ts +59 -2
- package/dist/portal-proxy.js +109 -23
- package/dist/react/index.d.ts +211 -27
- package/dist/react/index.js +286 -29
- package/dist/{action-DBzILFx9.d.ts → request-error-D_dUPLwo.d.ts} +1 -31
- package/dist/runtime/authoring.js +1 -1
- package/dist/runtime/chunks/Y4OAVXFR.js +1 -0
- package/dist/runtime/manifest.json +3 -3
- package/dist/runtime/schema.js +1 -1
- package/dist/schema.d.ts +154 -30
- package/dist/schema.js +128 -75
- package/dist/server/index.d.ts +14 -12
- package/dist/server/index.js +2189 -1631
- package/dist/sign-in-providers-BkjcDsFF.d.ts +39 -0
- package/dist/submission-input-DHGKhXfp.d.ts +342 -0
- package/dist/{telegram-browser-CTJh4Ro_.d.ts → telegram-browser-BCE7zdOb.d.ts} +49 -6
- package/dist/telegram.d.ts +64 -0
- package/dist/telegram.js +23 -0
- package/dist/testing.d.ts +112 -15
- package/dist/testing.js +321 -16
- package/dist/tracker-data-Hb1uQnk5.d.ts +1855 -0
- package/dist/{transport-B8Ss5lcz.d.ts → transport-DkhX2Cbs.d.ts} +5863 -2217
- package/dist/{wallet-DZWL7lJH.d.ts → wallet-DTO7SXj7.d.ts} +27 -7
- package/package.json +5 -1
- package/dist/accounts-DoabriBX.d.ts +0 -306
- package/dist/capability-error-DufwG3G0.d.ts +0 -159
- package/dist/chunk-MJEJQH5A.js +0 -962
- package/dist/chunk-N7YOS4ZU.js +0 -13
- package/dist/chunk-XQKUJL7H.js +0 -602
- package/dist/chunk-YNW2ZUUP.js +0 -247
- package/dist/groups-9Jm3peq3.d.ts +0 -2827
- package/dist/runtime/chunks/ADUMK6CR.js +0 -1
- package/dist/submission-input-D9EGH_yb.d.ts +0 -146
- package/dist/x-KFJD2x8y.d.ts +0 -331
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
parseDefinition
|
|
3
|
+
} from "./chunk-GTDW453U.js";
|
|
1
4
|
import {
|
|
2
5
|
identifier,
|
|
3
6
|
resourceHandle,
|
|
4
7
|
responseShape
|
|
5
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-MK425RXJ.js";
|
|
6
9
|
|
|
7
10
|
// src/youtube.ts
|
|
8
11
|
import * as z from "zod";
|
|
@@ -60,20 +63,25 @@ var analyticsRanges = ["7d", "30d", "90d", "all"];
|
|
|
60
63
|
var amount = once(() => z3.number().int().safe());
|
|
61
64
|
var amounts = once(() => z3.array(amount()));
|
|
62
65
|
var instant = once(() => z3.iso.datetime({ offset: true }));
|
|
66
|
+
var instantMs = once(() => amount().optional());
|
|
63
67
|
var bucket = once(
|
|
64
68
|
() => z3.object({
|
|
65
69
|
/** The period's label in its time zone, such as `2026-10-08@Europe/Budapest` or `2026-W41@UTC`. */
|
|
66
70
|
key: z3.string(),
|
|
67
71
|
start: instant(),
|
|
68
|
-
|
|
72
|
+
startMs: instantMs(),
|
|
73
|
+
end: instant(),
|
|
74
|
+
endMs: instantMs()
|
|
69
75
|
})
|
|
70
76
|
);
|
|
71
77
|
var range = once(
|
|
72
78
|
() => z3.object({
|
|
73
79
|
key: z3.enum(analyticsRanges),
|
|
74
80
|
from: instant(),
|
|
81
|
+
fromMs: instantMs(),
|
|
75
82
|
/** Now, by the database's clock, when the read ran. */
|
|
76
83
|
to: instant(),
|
|
84
|
+
toMs: instantMs(),
|
|
77
85
|
bucket: z3.enum(["day", "week"]),
|
|
78
86
|
/** The project calendar's time zone now. Buckets before a time zone change follow the old one. */
|
|
79
87
|
timeZone: z3.string(),
|
|
@@ -81,7 +89,12 @@ var range = once(
|
|
|
81
89
|
})
|
|
82
90
|
);
|
|
83
91
|
var previousRange = once(
|
|
84
|
-
() => z3.object({
|
|
92
|
+
() => z3.object({
|
|
93
|
+
from: instant(),
|
|
94
|
+
fromMs: instantMs(),
|
|
95
|
+
to: instant(),
|
|
96
|
+
toMs: instantMs()
|
|
97
|
+
}).optional()
|
|
85
98
|
);
|
|
86
99
|
var analyticsQuerySchema = z3.strictObject(
|
|
87
100
|
lazyShape({
|
|
@@ -116,29 +129,40 @@ var quest = once(
|
|
|
116
129
|
rejectionRate: z3.number().min(0).max(1).nullable(),
|
|
117
130
|
/**
|
|
118
131
|
* The 5 most common rejections, most frequent first. Rejections with a code (an evaluator's
|
|
119
|
-
* reject code or one Relay writes, such as `budget-exhausted`) group by it
|
|
120
|
-
*
|
|
132
|
+
* reject code or one Relay writes, such as `budget-exhausted`) group by it and by who wrote it,
|
|
133
|
+
* so Relay's `key-used` and an evaluator's own `key-used` are separate rows; `reason` is the
|
|
134
|
+
* latest rejection's reason. Rejections without one group by their exact reason.
|
|
121
135
|
*/
|
|
122
136
|
topReasons: z3.array(
|
|
123
137
|
z3.object({
|
|
124
138
|
reason: z3.string(),
|
|
125
139
|
code: z3.string().nullable(),
|
|
140
|
+
/**
|
|
141
|
+
* Who wrote `code`: `relay` or `evaluator`, null for a rejection without one. Relay always
|
|
142
|
+
* sends it; servers before it was added did not.
|
|
143
|
+
*/
|
|
144
|
+
codeSource: z3.string().nullish(),
|
|
126
145
|
count: amount()
|
|
127
146
|
})
|
|
128
147
|
),
|
|
129
|
-
/**
|
|
148
|
+
/**
|
|
149
|
+
* Rejections by who made them: the evaluator, staff, an exhausted budget, an expired deferral,
|
|
150
|
+
* or Relay because another member's completion holds the attempt's shared key (`keyUsed`, which
|
|
151
|
+
* Relay always sends; servers before it was added counted those as `evaluator`).
|
|
152
|
+
*/
|
|
130
153
|
rejectionsBySource: z3.object({
|
|
131
154
|
evaluator: amount(),
|
|
132
155
|
staff: amount(),
|
|
133
156
|
budget: amount(),
|
|
134
|
-
expired: amount()
|
|
157
|
+
expired: amount(),
|
|
158
|
+
keyUsed: amount().optional()
|
|
135
159
|
}),
|
|
136
160
|
/** Attempts and completions per bucket. */
|
|
137
161
|
series: z3.object({ attempts: amounts(), completions: amounts() })
|
|
138
162
|
})
|
|
139
163
|
);
|
|
140
|
-
var analyticsReadSchema = z3.object(
|
|
141
|
-
lazyShape({
|
|
164
|
+
var analyticsReadSchema = /* @__PURE__ */ z3.object(
|
|
165
|
+
/* @__PURE__ */ lazyShape({
|
|
142
166
|
range,
|
|
143
167
|
previous: previousRange,
|
|
144
168
|
members: () => z3.object({
|
|
@@ -207,6 +231,8 @@ var analyticsReadSchema = z3.object(
|
|
|
207
231
|
testEnvironment: () => z3.object({
|
|
208
232
|
/** When a test member was last reset, deleting their history, or null. */
|
|
209
233
|
lastResetAt: instant().nullable(),
|
|
234
|
+
/** `lastResetAt` in epoch milliseconds. Servers before it was added did not send it. */
|
|
235
|
+
lastResetAtMs: amount().nullish(),
|
|
210
236
|
/** Test members whose clock is advanced, so their activity can be dated in the future. */
|
|
211
237
|
shiftedClockMembers: amount()
|
|
212
238
|
}).optional()
|
|
@@ -455,7 +481,10 @@ var analyticsMetricResultSchema = z3.object(
|
|
|
455
481
|
*/
|
|
456
482
|
rows: z3.array(
|
|
457
483
|
z3.object({
|
|
458
|
-
/**
|
|
484
|
+
/**
|
|
485
|
+
* The resource's key (its ID when it has none), the source, the outcome, or the reason's
|
|
486
|
+
* code or text; Relay's `key-used` is `relay:key-used`, apart from an evaluator's `key-used`.
|
|
487
|
+
*/
|
|
459
488
|
key: z3.string(),
|
|
460
489
|
title: z3.string(),
|
|
461
490
|
archived: z3.boolean(),
|
|
@@ -648,7 +677,7 @@ var dashboardPreviewSchema = responseShape(
|
|
|
648
677
|
);
|
|
649
678
|
var keyOf = (reference) => typeof reference === "string" ? reference : reference.key;
|
|
650
679
|
function defineDashboard(input) {
|
|
651
|
-
const authored = dashboardAuthoringSchema
|
|
680
|
+
const authored = parseDefinition("Dashboard", dashboardAuthoringSchema, {
|
|
652
681
|
...input,
|
|
653
682
|
sections: input.sections.map((section) => ({
|
|
654
683
|
...section,
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isRequestError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-K2KS3JLY.js";
|
|
4
|
+
|
|
5
|
+
// package.json
|
|
6
|
+
var name = "@domino-sdk/relay";
|
|
7
|
+
var version = "1.62.0";
|
|
8
|
+
|
|
9
|
+
// src/client-identity.ts
|
|
10
|
+
function clientIdentity() {
|
|
11
|
+
const runtime = typeof document === "undefined" ? "server" : "browser";
|
|
12
|
+
return `${name}/${version} (${runtime})`;
|
|
13
|
+
}
|
|
4
14
|
|
|
5
15
|
// src/request-lifetime.ts
|
|
6
16
|
var PARTICIPANT_TIMEOUT = 15e3;
|
|
@@ -46,7 +56,8 @@ function backoff(retry) {
|
|
|
46
56
|
function retryDelay(failure, context) {
|
|
47
57
|
const transient = failure.kind === "network" && (failure.status === void 0 || failure.status < 400) || (failure.kind === "http" || failure.kind === "network") && transientStatuses.has(failure.status ?? 0) && // Domino's rate limits run for minutes or hours: a 429 waits only when told how long.
|
|
48
58
|
(failure.status !== 429 || failure.retryAfter !== void 0);
|
|
49
|
-
|
|
59
|
+
const repeatable = context.replaySafe || failure.status === 503 && failure.retryAfter !== void 0;
|
|
60
|
+
if (!transient || !repeatable || context.attempt >= MAX_ATTEMPTS) {
|
|
50
61
|
return void 0;
|
|
51
62
|
}
|
|
52
63
|
const wait = failure.retryAfter ?? backoff(context.attempt);
|
|
@@ -103,6 +114,7 @@ function markUncertain(error) {
|
|
|
103
114
|
}
|
|
104
115
|
|
|
105
116
|
export {
|
|
117
|
+
clientIdentity,
|
|
106
118
|
PARTICIPANT_TIMEOUT,
|
|
107
119
|
MANAGEMENT_TIMEOUT,
|
|
108
120
|
validTimeout,
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
isKnownTrackerSource,
|
|
6
6
|
trackerDataSchema,
|
|
7
7
|
xAccountRoles
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-MK425RXJ.js";
|
|
9
9
|
|
|
10
10
|
// src/quest-shape.ts
|
|
11
11
|
function validateQuestShape(description, options = {}) {
|
|
@@ -29,7 +29,7 @@ function validateQuestShape(description, options = {}) {
|
|
|
29
29
|
);
|
|
30
30
|
}
|
|
31
31
|
if (content) {
|
|
32
|
-
if (completion.kind !== "keyed") {
|
|
32
|
+
if (completion.kind !== "keyed" || completion.across) {
|
|
33
33
|
throw new Error("Content quests complete once per content item");
|
|
34
34
|
}
|
|
35
35
|
if (tracker.beneficiary !== "author" || tracker.on !== "new-record") {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {
|
|
2
|
+
RelayErrorCode,
|
|
3
|
+
clientError
|
|
4
|
+
} from "./chunk-K2KS3JLY.js";
|
|
5
|
+
|
|
6
|
+
// src/plugin-client.ts
|
|
7
|
+
var transportKey = /* @__PURE__ */ Symbol.for("@domino-sdk/relay:plugin-transport");
|
|
8
|
+
function setPluginTransport(client, transport) {
|
|
9
|
+
Object.defineProperty(client, transportKey, { value: transport });
|
|
10
|
+
}
|
|
11
|
+
function withPluginNamespace(client, name, build) {
|
|
12
|
+
if (!Object.hasOwn(client, name)) {
|
|
13
|
+
const transport = client[transportKey];
|
|
14
|
+
if (!transport) {
|
|
15
|
+
throw clientError(
|
|
16
|
+
"Pass a client that createRelayClient or createBrowserRelayClient made",
|
|
17
|
+
RelayErrorCode.InvalidInput
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
Object.defineProperty(client, name, {
|
|
21
|
+
value: build(transport),
|
|
22
|
+
enumerable: true
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
return client;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export {
|
|
29
|
+
setPluginTransport,
|
|
30
|
+
withPluginNamespace
|
|
31
|
+
};
|
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
import {
|
|
2
|
+
pointLedgerReferenceSchema
|
|
3
|
+
} from "./chunk-WSBYWVTZ.js";
|
|
4
|
+
import {
|
|
5
|
+
authProviderSchema,
|
|
6
|
+
entitlementSchema,
|
|
7
|
+
identifier,
|
|
8
|
+
pageCursorSchema,
|
|
9
|
+
pickupAvailabilitySchema,
|
|
10
|
+
pickupSelectionSchema,
|
|
11
|
+
signInProviderOptionSchema,
|
|
12
|
+
telegramSignInMethodsSchema,
|
|
13
|
+
walletSignInNetworksSchema
|
|
14
|
+
} from "./chunk-MK425RXJ.js";
|
|
15
|
+
|
|
16
|
+
// src/sign-in-providers.ts
|
|
17
|
+
import * as z from "zod";
|
|
18
|
+
var authProvidersSchema = z.object({
|
|
19
|
+
providers: z.array(
|
|
20
|
+
z.object({
|
|
21
|
+
provider: authProviderSchema,
|
|
22
|
+
configured: z.boolean()
|
|
23
|
+
})
|
|
24
|
+
),
|
|
25
|
+
email: z.boolean(),
|
|
26
|
+
/** The wallet sign-in this project enabled. */
|
|
27
|
+
wallets: walletSignInNetworksSchema,
|
|
28
|
+
demo: z.boolean(),
|
|
29
|
+
/**
|
|
30
|
+
* Telegram's sign-in, which is not one of `providers` in SDK 1.x. Absent from Relay versions
|
|
31
|
+
* without Telegram. `login` is deprecated in favour of `signInProviders`; `miniApp` is not.
|
|
32
|
+
*/
|
|
33
|
+
telegram: telegramSignInMethodsSchema.optional(),
|
|
34
|
+
/**
|
|
35
|
+
* Every sign-in provider the platform has, Telegram included, and whether Domino configured it:
|
|
36
|
+
* the open sibling of `providers`, which SDK 1.x keeps to `AuthProvider`. A newer Relay may list
|
|
37
|
+
* providers this SDK does not know. Absent from older Relay versions.
|
|
38
|
+
*/
|
|
39
|
+
signInProviders: z.array(signInProviderOptionSchema).optional()
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// src/creator-accounts.ts
|
|
43
|
+
import * as z2 from "zod";
|
|
44
|
+
var knownCreatorAccountProviders = ["youtube", "tiktok"];
|
|
45
|
+
var creatorAccountProviderSchema = z2.custom(
|
|
46
|
+
(value) => typeof value === "string" && /^[a-z][a-z0-9-]{0,39}$/.test(value)
|
|
47
|
+
);
|
|
48
|
+
var creatorAccountSchema = z2.object({
|
|
49
|
+
provider: creatorAccountProviderSchema,
|
|
50
|
+
configured: z2.boolean(),
|
|
51
|
+
status: z2.enum(["disconnected", "connected", "reconnect"]),
|
|
52
|
+
subject: z2.string().nullable(),
|
|
53
|
+
revision: z2.number().int().nonnegative(),
|
|
54
|
+
profile: z2.object({
|
|
55
|
+
name: z2.string().optional(),
|
|
56
|
+
username: z2.string().optional(),
|
|
57
|
+
imageUrl: z2.string().optional()
|
|
58
|
+
}).nullable()
|
|
59
|
+
});
|
|
60
|
+
var creatorAccountsSchema = z2.object({
|
|
61
|
+
accounts: z2.array(creatorAccountSchema)
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// src/consent.ts
|
|
65
|
+
import * as z3 from "zod";
|
|
66
|
+
var consentWordingMaxLength = 2e3;
|
|
67
|
+
var knownConsentChannels = ["email"];
|
|
68
|
+
var openValue = z3.string().min(1).max(64);
|
|
69
|
+
var memberConsentSchema = z3.object({
|
|
70
|
+
member: identifier,
|
|
71
|
+
channel: openValue,
|
|
72
|
+
state: openValue,
|
|
73
|
+
at: z3.number().int().safe().nonnegative(),
|
|
74
|
+
wording: z3.string().nullable(),
|
|
75
|
+
source: openValue
|
|
76
|
+
});
|
|
77
|
+
var memberConsentListSchema = z3.array(memberConsentSchema);
|
|
78
|
+
var consentInputSchema = z3.object({
|
|
79
|
+
actionId: identifier,
|
|
80
|
+
channel: z3.custom(
|
|
81
|
+
(value) => typeof value === "string" && value.length <= 64
|
|
82
|
+
),
|
|
83
|
+
granted: z3.boolean(),
|
|
84
|
+
wording: z3.string().optional()
|
|
85
|
+
}).strict();
|
|
86
|
+
var memberConsentInputSchema = z3.object({
|
|
87
|
+
actionId: identifier,
|
|
88
|
+
member: identifier,
|
|
89
|
+
channel: z3.string().max(64),
|
|
90
|
+
granted: z3.boolean(),
|
|
91
|
+
wording: z3.string().optional()
|
|
92
|
+
}).strict();
|
|
93
|
+
var memberConsentHistorySchema = z3.object({
|
|
94
|
+
items: z3.array(memberConsentSchema),
|
|
95
|
+
nextCursor: z3.string().nullable()
|
|
96
|
+
});
|
|
97
|
+
var memberConsentHistoryQuerySchema = z3.object({
|
|
98
|
+
cursor: z3.string().max(2e3).optional(),
|
|
99
|
+
limit: z3.coerce.number().int().min(1).max(100).optional()
|
|
100
|
+
}).strict();
|
|
101
|
+
|
|
102
|
+
// src/collection.ts
|
|
103
|
+
import * as z4 from "zod";
|
|
104
|
+
var collectionCodeSchema = z4.string().regex(/^relay:collect:[a-f0-9]{64}$/);
|
|
105
|
+
var collectionPassSchema = z4.object({
|
|
106
|
+
code: collectionCodeSchema,
|
|
107
|
+
expiresAt: z4.number(),
|
|
108
|
+
entitlement: identifier
|
|
109
|
+
});
|
|
110
|
+
var collectionResolveSchema = z4.object({ code: collectionCodeSchema }).strict();
|
|
111
|
+
var collectionBeginSchema = collectionResolveSchema.extend({
|
|
112
|
+
actionId: identifier,
|
|
113
|
+
revision: z4.number().int().positive(),
|
|
114
|
+
selection: pickupSelectionSchema.optional()
|
|
115
|
+
});
|
|
116
|
+
var collectionPreviewSchema = z4.object({
|
|
117
|
+
entitlement: entitlementSchema,
|
|
118
|
+
inventory: pickupAvailabilitySchema,
|
|
119
|
+
expiresAt: z4.number()
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
// src/outcomes.ts
|
|
123
|
+
import * as z5 from "zod";
|
|
124
|
+
var timestamp = z5.number().int().safe().nonnegative();
|
|
125
|
+
var questEnrollmentInputSchema = z5.strictObject({
|
|
126
|
+
actionId: identifier,
|
|
127
|
+
/** Quest key or ID. */
|
|
128
|
+
quest: identifier
|
|
129
|
+
});
|
|
130
|
+
var memberEnrollmentInputSchema = questEnrollmentInputSchema.extend({
|
|
131
|
+
member: identifier
|
|
132
|
+
});
|
|
133
|
+
var questEnrollmentSchema = z5.object({
|
|
134
|
+
/** Stable quest ID. */
|
|
135
|
+
quest: identifier,
|
|
136
|
+
member: identifier,
|
|
137
|
+
enrolledAt: timestamp
|
|
138
|
+
});
|
|
139
|
+
var questClaimInputSchema = z5.strictObject({
|
|
140
|
+
actionId: identifier,
|
|
141
|
+
/** Quest key or ID. */
|
|
142
|
+
quest: identifier,
|
|
143
|
+
/** The outcome's tracker, as `QuestOutcome.tracker` names it. */
|
|
144
|
+
tracker: identifier,
|
|
145
|
+
record: z5.string().min(1).max(256),
|
|
146
|
+
observedAt: timestamp
|
|
147
|
+
});
|
|
148
|
+
var QuestOutcomeState = {
|
|
149
|
+
Admitted: "admitted",
|
|
150
|
+
Skipped: "skipped"
|
|
151
|
+
};
|
|
152
|
+
var questOutcomeSchema = z5.object({
|
|
153
|
+
/** Prerequisite transition identity; absent on older tracker responses. */
|
|
154
|
+
automatic: identifier.optional(),
|
|
155
|
+
/** Stable quest ID. */
|
|
156
|
+
quest: identifier,
|
|
157
|
+
/** Stable tracker ID of the record decided. */
|
|
158
|
+
tracker: identifier.nullable(),
|
|
159
|
+
/** The record's ID in its tracker. */
|
|
160
|
+
record: z5.string().nullable(),
|
|
161
|
+
/** Which observation of the record was decided. */
|
|
162
|
+
observedAt: timestamp.nullable(),
|
|
163
|
+
state: z5.enum(["admitted", "skipped"]),
|
|
164
|
+
/**
|
|
165
|
+
* Why it was skipped, one of `trackerSkipCodes` or a code a newer Relay sends; null when
|
|
166
|
+
* admitted. Show an unknown code by its `reason`.
|
|
167
|
+
*/
|
|
168
|
+
code: z5.string().nullable(),
|
|
169
|
+
/** Why it was skipped, for people; null when admitted. */
|
|
170
|
+
reason: z5.string().nullable(),
|
|
171
|
+
/** Which window refused admission when `code` is `outside-window`. */
|
|
172
|
+
window: z5.enum(["tracker", "quest"]).optional(),
|
|
173
|
+
/** The admitted attempt. */
|
|
174
|
+
attempt: identifier.nullable(),
|
|
175
|
+
/** The member can claim it with `relay.quests.claim()`. */
|
|
176
|
+
claimable: z5.boolean(),
|
|
177
|
+
createdAt: timestamp,
|
|
178
|
+
updatedAt: timestamp
|
|
179
|
+
});
|
|
180
|
+
var questOutcomeQuerySchema = z5.strictObject({
|
|
181
|
+
/** Quest key or ID. */
|
|
182
|
+
quest: identifier.optional(),
|
|
183
|
+
state: z5.enum(["admitted", "skipped"]).optional(),
|
|
184
|
+
/** Only skips with this code, such as `historical`. */
|
|
185
|
+
code: z5.string().min(1).max(100).optional(),
|
|
186
|
+
cursor: pageCursorSchema.optional()
|
|
187
|
+
});
|
|
188
|
+
var questOutcomePageSchema = z5.object({
|
|
189
|
+
items: z5.array(questOutcomeSchema),
|
|
190
|
+
nextCursor: pageCursorSchema.nullable()
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
// src/participant-rewards.ts
|
|
194
|
+
import * as z6 from "zod";
|
|
195
|
+
var participantEntitlementsSchema = z6.object({
|
|
196
|
+
items: z6.array(entitlementSchema)
|
|
197
|
+
});
|
|
198
|
+
var base = {
|
|
199
|
+
id: z6.string(),
|
|
200
|
+
status: z6.string(),
|
|
201
|
+
at: z6.number().nullable(),
|
|
202
|
+
quest: z6.string().nullable(),
|
|
203
|
+
completion: z6.string().nullable()
|
|
204
|
+
};
|
|
205
|
+
var known = z6.discriminatedUnion("kind", [
|
|
206
|
+
z6.object({
|
|
207
|
+
...base,
|
|
208
|
+
kind: z6.literal("points"),
|
|
209
|
+
ledger: pointLedgerReferenceSchema,
|
|
210
|
+
amount: z6.number(),
|
|
211
|
+
reversed: z6.number()
|
|
212
|
+
}).catchall(z6.json()),
|
|
213
|
+
z6.object({
|
|
214
|
+
...base,
|
|
215
|
+
kind: z6.literal("tier"),
|
|
216
|
+
entitlement: entitlementSchema
|
|
217
|
+
}).catchall(z6.json().transform((value) => value)),
|
|
218
|
+
z6.object({
|
|
219
|
+
...base,
|
|
220
|
+
kind: z6.literal("integration"),
|
|
221
|
+
provider: z6.string(),
|
|
222
|
+
action: z6.string(),
|
|
223
|
+
roleId: z6.string().optional(),
|
|
224
|
+
deliveredAt: z6.number().nullable(),
|
|
225
|
+
revokedAt: z6.number().nullable(),
|
|
226
|
+
reconciliation: z6.object({ status: z6.string(), ownership: z6.string(), at: z6.number() }).catchall(z6.json()).nullable()
|
|
227
|
+
}).catchall(z6.json().optional())
|
|
228
|
+
]);
|
|
229
|
+
var participantDeliverySchema = z6.union([
|
|
230
|
+
known,
|
|
231
|
+
z6.object({
|
|
232
|
+
...base,
|
|
233
|
+
kind: z6.string().refine((kind) => !["points", "tier", "integration"].includes(kind))
|
|
234
|
+
}).catchall(z6.json()).transform(({ kind, ...item }) => ({
|
|
235
|
+
...item,
|
|
236
|
+
kind: "unknown",
|
|
237
|
+
reportedKind: kind
|
|
238
|
+
}))
|
|
239
|
+
]);
|
|
240
|
+
var participantDeliveriesSchema = z6.object({
|
|
241
|
+
items: z6.array(participantDeliverySchema)
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
// src/reward-deliveries.ts
|
|
245
|
+
import * as z7 from "zod";
|
|
246
|
+
var RewardDeliveryAction = {
|
|
247
|
+
/** Delivers a quest's Discord role reward. */
|
|
248
|
+
GrantRole: "grant-role",
|
|
249
|
+
/**
|
|
250
|
+
* Posts a quest's announcement in a Telegram chat or Discord channel. Its `provider` is
|
|
251
|
+
* `telegram` or `discord`, and its `roleId` is empty.
|
|
252
|
+
*/
|
|
253
|
+
PostMessage: "post-message"
|
|
254
|
+
};
|
|
255
|
+
var rewardDeliveryActionSchema = z7.string().min(1).max(64);
|
|
256
|
+
var roleReconciliationSchema = z7.object({
|
|
257
|
+
status: z7.enum(["pending", "granted", "removed", "preserved", "failed"]),
|
|
258
|
+
ownership: z7.enum(["unclaimed", "relay", "external"]),
|
|
259
|
+
at: z7.number(),
|
|
260
|
+
reason: z7.string().nullable()
|
|
261
|
+
});
|
|
262
|
+
var knownRewardDeliverySchema = z7.object({
|
|
263
|
+
id: z7.string(),
|
|
264
|
+
quest: z7.string(),
|
|
265
|
+
completion: z7.string(),
|
|
266
|
+
member: z7.string(),
|
|
267
|
+
provider: z7.literal("discord"),
|
|
268
|
+
/** `RewardDeliveryAction`, such as `grant-role`. */
|
|
269
|
+
action: rewardDeliveryActionSchema,
|
|
270
|
+
roleId: z7.string(),
|
|
271
|
+
/**
|
|
272
|
+
* `failed` is terminal: Discord rejected the grant permanently (unknown role,
|
|
273
|
+
* member left the server, missing permissions) or retries ran out after about
|
|
274
|
+
* a day. An operator can retry it once the cause is fixed, unless revokedAt is set.
|
|
275
|
+
* Revoke stops pending grants; a late success records deliveredAt but leaves status failed.
|
|
276
|
+
*/
|
|
277
|
+
status: z7.enum(["pending", "delivered", "failed"]),
|
|
278
|
+
/** Provider attempts in the current round; an operator retry starts a new round at zero. */
|
|
279
|
+
attempts: z7.number().int(),
|
|
280
|
+
/** While pending with a `lastError`, when the next attempt is scheduled. */
|
|
281
|
+
nextAt: z7.number(),
|
|
282
|
+
lastError: z7.string().nullable(),
|
|
283
|
+
createdAt: z7.number(),
|
|
284
|
+
deliveredAt: z7.number().nullable(),
|
|
285
|
+
/** First dispatch attempt, retained across retries. Legacy rows use creation time when dispatch timing is unknown. */
|
|
286
|
+
dispatchedAt: z7.number().nullable().optional(),
|
|
287
|
+
/** Completion revocation stops retries, including deliveries that had already failed. */
|
|
288
|
+
revokedAt: z7.number().nullable().optional(),
|
|
289
|
+
/** Current reconciliation of the pinned Discord membership; original delivery and revoke history stay intact. */
|
|
290
|
+
reconciliation: roleReconciliationSchema.nullable().optional()
|
|
291
|
+
});
|
|
292
|
+
var futureRewardDeliverySchema = knownRewardDeliverySchema.extend({
|
|
293
|
+
provider: z7.string(),
|
|
294
|
+
status: z7.string(),
|
|
295
|
+
roleId: z7.string().optional(),
|
|
296
|
+
reconciliation: z7.object({
|
|
297
|
+
status: z7.string(),
|
|
298
|
+
ownership: z7.string(),
|
|
299
|
+
at: z7.number(),
|
|
300
|
+
reason: z7.string().nullable()
|
|
301
|
+
}).catchall(z7.json()).nullable().optional()
|
|
302
|
+
}).catchall(z7.json().optional()).refine(
|
|
303
|
+
(delivery) => delivery.provider !== "discord" || !["pending", "delivered", "failed"].includes(delivery.status) || delivery.reconciliation && (!["pending", "granted", "removed", "preserved", "failed"].includes(
|
|
304
|
+
delivery.reconciliation.status
|
|
305
|
+
) || !["unclaimed", "relay", "external"].includes(
|
|
306
|
+
delivery.reconciliation.ownership
|
|
307
|
+
))
|
|
308
|
+
);
|
|
309
|
+
var rewardDeliverySchema = z7.union([
|
|
310
|
+
knownRewardDeliverySchema.catchall(z7.json().optional()),
|
|
311
|
+
futureRewardDeliverySchema
|
|
312
|
+
]);
|
|
313
|
+
var rewardDeliveriesSchema = z7.object({
|
|
314
|
+
deliveries: z7.array(rewardDeliverySchema),
|
|
315
|
+
nextCursor: pageCursorSchema.nullable().default(null)
|
|
316
|
+
});
|
|
317
|
+
var rewardDeliveryQuerySchema = z7.strictObject({
|
|
318
|
+
cursor: pageCursorSchema.optional(),
|
|
319
|
+
limit: z7.coerce.number().int().min(1).max(500).optional()
|
|
320
|
+
});
|
|
321
|
+
var discordRoleRewardSchema = z7.object({
|
|
322
|
+
roleId: z7.string(),
|
|
323
|
+
quests: z7.array(z7.string()),
|
|
324
|
+
/** Delivery records of this role by `RewardDelivery.status`. */
|
|
325
|
+
deliveries: z7.object({
|
|
326
|
+
pending: z7.number().int(),
|
|
327
|
+
delivered: z7.number().int(),
|
|
328
|
+
failed: z7.number().int()
|
|
329
|
+
})
|
|
330
|
+
});
|
|
331
|
+
var discordRoleRewardsSchema = z7.object({
|
|
332
|
+
roles: z7.array(discordRoleRewardSchema)
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
export {
|
|
336
|
+
authProvidersSchema,
|
|
337
|
+
knownCreatorAccountProviders,
|
|
338
|
+
creatorAccountProviderSchema,
|
|
339
|
+
creatorAccountSchema,
|
|
340
|
+
creatorAccountsSchema,
|
|
341
|
+
consentWordingMaxLength,
|
|
342
|
+
knownConsentChannels,
|
|
343
|
+
memberConsentSchema,
|
|
344
|
+
memberConsentListSchema,
|
|
345
|
+
consentInputSchema,
|
|
346
|
+
memberConsentInputSchema,
|
|
347
|
+
memberConsentHistorySchema,
|
|
348
|
+
memberConsentHistoryQuerySchema,
|
|
349
|
+
collectionCodeSchema,
|
|
350
|
+
collectionPassSchema,
|
|
351
|
+
collectionResolveSchema,
|
|
352
|
+
collectionBeginSchema,
|
|
353
|
+
collectionPreviewSchema,
|
|
354
|
+
questEnrollmentInputSchema,
|
|
355
|
+
memberEnrollmentInputSchema,
|
|
356
|
+
questEnrollmentSchema,
|
|
357
|
+
questClaimInputSchema,
|
|
358
|
+
QuestOutcomeState,
|
|
359
|
+
questOutcomeSchema,
|
|
360
|
+
questOutcomeQuerySchema,
|
|
361
|
+
questOutcomePageSchema,
|
|
362
|
+
participantEntitlementsSchema,
|
|
363
|
+
participantDeliverySchema,
|
|
364
|
+
participantDeliveriesSchema,
|
|
365
|
+
RewardDeliveryAction,
|
|
366
|
+
roleReconciliationSchema,
|
|
367
|
+
knownRewardDeliverySchema,
|
|
368
|
+
rewardDeliverySchema,
|
|
369
|
+
rewardDeliveriesSchema,
|
|
370
|
+
rewardDeliveryQuerySchema,
|
|
371
|
+
discordRoleRewardSchema,
|
|
372
|
+
discordRoleRewardsSchema
|
|
373
|
+
};
|
|
@@ -20,6 +20,7 @@ var participantRoutes = [
|
|
|
20
20
|
{ method: "POST", path: "/v1/auth/logout" },
|
|
21
21
|
{ method: "GET", path: "/v1/auth/accounts" },
|
|
22
22
|
{ method: "GET", path: "/v1/auth/accounts/telegram" },
|
|
23
|
+
{ method: "GET", path: "/v1/auth/sign-in-accounts" },
|
|
23
24
|
{ method: "GET", path: "/v1/auth/creator-accounts" },
|
|
24
25
|
{ method: "POST", path: "/v1/auth/accounts/disconnect" },
|
|
25
26
|
{ method: "POST", path: "/v1/auth/telegram/mini-app" },
|
|
@@ -52,6 +53,9 @@ var participantRoutes = [
|
|
|
52
53
|
{ method: "GET", path: "/v1/me/profile" },
|
|
53
54
|
{ method: "POST", path: "/v1/me/profile" },
|
|
54
55
|
{ method: "POST", path: "/v1/me/profile/avatar" },
|
|
56
|
+
// The member's marketing consent per channel.
|
|
57
|
+
{ method: "GET", path: "/v1/me/consent" },
|
|
58
|
+
{ method: "POST", path: "/v1/me/consent" },
|
|
55
59
|
{ method: "GET", path: `/v1/profiles/:profile${id}` },
|
|
56
60
|
{ method: "GET", path: `/v1/profiles/:profile${id}/completions` },
|
|
57
61
|
{
|
|
@@ -85,6 +89,7 @@ var participantRoutes = [
|
|
|
85
89
|
{ method: "GET", path: `/v1/leaderboards/:board${id}` },
|
|
86
90
|
{ method: "GET", path: "/v1/point-ledgers" },
|
|
87
91
|
{ method: "GET", path: "/v1/badges" },
|
|
92
|
+
{ method: "GET", path: "/v1/badges/catalog" },
|
|
88
93
|
{ method: "GET", path: "/v1/me/badges" },
|
|
89
94
|
{ method: "GET", path: "/v1/profiles/:profile{[\\w-]+}/badges" },
|
|
90
95
|
{ method: "GET", path: "/v1/tiered-rewards" }
|