@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
package/dist/chunk-N7YOS4ZU.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// package.json
|
|
2
|
-
var name = "@domino-sdk/relay";
|
|
3
|
-
var version = "1.60.0";
|
|
4
|
-
|
|
5
|
-
// src/client-identity.ts
|
|
6
|
-
function clientIdentity() {
|
|
7
|
-
const runtime = typeof document === "undefined" ? "server" : "browser";
|
|
8
|
-
return `${name}/${version} (${runtime})`;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export {
|
|
12
|
-
clientIdentity
|
|
13
|
-
};
|
package/dist/chunk-XQKUJL7H.js
DELETED
|
@@ -1,602 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
badgeSchema
|
|
3
|
-
} from "./chunk-MJEJQH5A.js";
|
|
4
|
-
import {
|
|
5
|
-
pointLedgerReferenceSchema
|
|
6
|
-
} from "./chunk-YNW2ZUUP.js";
|
|
7
|
-
import {
|
|
8
|
-
authoringIdentityShape,
|
|
9
|
-
entitlementSchema,
|
|
10
|
-
identifier,
|
|
11
|
-
mediaUrlSchema,
|
|
12
|
-
memberProgressSchema,
|
|
13
|
-
pageCursorSchema,
|
|
14
|
-
pickupAvailabilitySchema,
|
|
15
|
-
pickupSelectionSchema,
|
|
16
|
-
prerequisiteSchema,
|
|
17
|
-
publishedReleaseSchema,
|
|
18
|
-
questPresentationContentSchema,
|
|
19
|
-
questScaleLimits,
|
|
20
|
-
responseShape,
|
|
21
|
-
retryCooldownMsSchema,
|
|
22
|
-
reviewModeSchema,
|
|
23
|
-
sdkRuntimeReferenceSchema,
|
|
24
|
-
settingsValuesSchema,
|
|
25
|
-
storedQuestDescriptionSchema,
|
|
26
|
-
storedReviewModeSchema,
|
|
27
|
-
tieredRewardReferenceSchema
|
|
28
|
-
} from "./chunk-GBSDAD3N.js";
|
|
29
|
-
|
|
30
|
-
// src/participant-activity.ts
|
|
31
|
-
import * as z from "zod";
|
|
32
|
-
var base = { id: z.string(), at: z.number() };
|
|
33
|
-
var attempt = {
|
|
34
|
-
...base,
|
|
35
|
-
quest: z.string(),
|
|
36
|
-
attempt: z.string(),
|
|
37
|
-
completion: z.string().nullable()
|
|
38
|
-
};
|
|
39
|
-
var kinds = [
|
|
40
|
-
"attempt.accepted",
|
|
41
|
-
"attempt.rejected",
|
|
42
|
-
"attempt.review",
|
|
43
|
-
"points.awarded",
|
|
44
|
-
"entitlement.granted",
|
|
45
|
-
"entitlement.collected",
|
|
46
|
-
"delivery.updated",
|
|
47
|
-
"referral.qualified"
|
|
48
|
-
];
|
|
49
|
-
var knownRelayEventSchema = z.discriminatedUnion("kind", [
|
|
50
|
-
z.object({ ...attempt, kind: z.literal("attempt.accepted") }),
|
|
51
|
-
z.object({ ...attempt, kind: z.literal("attempt.rejected") }),
|
|
52
|
-
z.object({ ...attempt, kind: z.literal("attempt.review") }),
|
|
53
|
-
z.object({
|
|
54
|
-
...base,
|
|
55
|
-
kind: z.literal("points.awarded"),
|
|
56
|
-
entry: z.string(),
|
|
57
|
-
ledger: z.string(),
|
|
58
|
-
amount: z.number(),
|
|
59
|
-
quest: z.string().nullable(),
|
|
60
|
-
completion: z.string().nullable()
|
|
61
|
-
}),
|
|
62
|
-
z.object({
|
|
63
|
-
...base,
|
|
64
|
-
kind: z.literal("entitlement.granted"),
|
|
65
|
-
entitlement: z.string(),
|
|
66
|
-
tier: z.string(),
|
|
67
|
-
status: z.string()
|
|
68
|
-
}),
|
|
69
|
-
z.object({
|
|
70
|
-
...base,
|
|
71
|
-
kind: z.literal("entitlement.collected"),
|
|
72
|
-
entitlement: z.string()
|
|
73
|
-
}),
|
|
74
|
-
z.object({
|
|
75
|
-
...base,
|
|
76
|
-
kind: z.literal("delivery.updated"),
|
|
77
|
-
delivery: z.string(),
|
|
78
|
-
quest: z.string(),
|
|
79
|
-
completion: z.string(),
|
|
80
|
-
status: z.string()
|
|
81
|
-
}),
|
|
82
|
-
z.object({
|
|
83
|
-
...base,
|
|
84
|
-
kind: z.literal("referral.qualified"),
|
|
85
|
-
program: z.string()
|
|
86
|
-
})
|
|
87
|
-
]);
|
|
88
|
-
var relayEventSchema = z.union([
|
|
89
|
-
knownRelayEventSchema,
|
|
90
|
-
z.object({
|
|
91
|
-
...base,
|
|
92
|
-
kind: z.string().refine((kind) => !kinds.includes(kind))
|
|
93
|
-
}).catchall(z.json()).transform(({ kind, ...event }) => ({
|
|
94
|
-
...event,
|
|
95
|
-
kind: "unknown",
|
|
96
|
-
reportedKind: kind
|
|
97
|
-
}))
|
|
98
|
-
]);
|
|
99
|
-
var participantActivityQuerySchema = z.object({
|
|
100
|
-
cursor: pageCursorSchema.optional(),
|
|
101
|
-
/** `latest` answers no events and the cursor of the newest one, to follow only what comes next. */
|
|
102
|
-
start: z.literal("latest").optional(),
|
|
103
|
-
limit: z.number().int().min(1).max(100).default(50)
|
|
104
|
-
}).strict().refine((query) => !(query.cursor && query.start), {
|
|
105
|
-
message: "Pass either cursor or start, not both"
|
|
106
|
-
});
|
|
107
|
-
var participantActivitySchema = z.object({
|
|
108
|
-
member: z.string(),
|
|
109
|
-
items: z.array(relayEventSchema),
|
|
110
|
-
nextCursor: pageCursorSchema
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
// src/catalog.ts
|
|
114
|
-
import * as z2 from "zod";
|
|
115
|
-
var interactionSchema = z2.enum([
|
|
116
|
-
"photo",
|
|
117
|
-
"text",
|
|
118
|
-
"url",
|
|
119
|
-
"quiz",
|
|
120
|
-
"claim",
|
|
121
|
-
"staff",
|
|
122
|
-
"automatic"
|
|
123
|
-
]);
|
|
124
|
-
function questInteraction(trigger) {
|
|
125
|
-
return trigger.kind === "automatic" ? "automatic" : trigger.actor === "staff" ? "staff" : trigger.input === "none" ? "claim" : trigger.input;
|
|
126
|
-
}
|
|
127
|
-
var questTypeVersionSchema = z2.object({
|
|
128
|
-
archivedAt: z2.number().int().nonnegative().nullable().optional(),
|
|
129
|
-
key: identifier.optional(),
|
|
130
|
-
id: identifier,
|
|
131
|
-
version: identifier,
|
|
132
|
-
code: z2.string(),
|
|
133
|
-
/** The SDK runtime `code` imports. Absent, the code bundles its own SDK. */
|
|
134
|
-
runtime: sdkRuntimeReferenceSchema.optional(),
|
|
135
|
-
definition: storedQuestDescriptionSchema,
|
|
136
|
-
provider: storedReviewModeSchema,
|
|
137
|
-
createdAt: z2.number()
|
|
138
|
-
});
|
|
139
|
-
var collectionSlotSchema = z2.object({
|
|
140
|
-
archivedAt: z2.number().int().nonnegative().nullable().optional(),
|
|
141
|
-
id: identifier,
|
|
142
|
-
key: identifier.optional(),
|
|
143
|
-
title: z2.string().trim().min(1).max(120),
|
|
144
|
-
description: z2.string().max(4e3).optional(),
|
|
145
|
-
image: mediaUrlSchema.optional(),
|
|
146
|
-
imageAlt: z2.string().max(500).optional()
|
|
147
|
-
}).strict();
|
|
148
|
-
var collectionSlotDeclarationSchema = collectionSlotSchema.omit({ id: true, archivedAt: true }).extend(authoringIdentityShape).strict();
|
|
149
|
-
var questCollectionSchema = collectionSlotSchema.extend({
|
|
150
|
-
quests: z2.array(identifier).max(100).refine(
|
|
151
|
-
(v) => new Set(v).size === v.length,
|
|
152
|
-
"A collection can contain a quest only once"
|
|
153
|
-
)
|
|
154
|
-
});
|
|
155
|
-
var questInstanceSchema = z2.object({
|
|
156
|
-
badges: z2.array(identifier).max(10).refine(
|
|
157
|
-
(items) => new Set(items).size === items.length,
|
|
158
|
-
"Choose each badge once"
|
|
159
|
-
).optional(),
|
|
160
|
-
id: identifier,
|
|
161
|
-
title: z2.string().trim().min(1).max(120),
|
|
162
|
-
typeVersion: identifier,
|
|
163
|
-
presentation: questPresentationContentSchema.optional(),
|
|
164
|
-
settings: settingsValuesSchema,
|
|
165
|
-
requires: z2.array(prerequisiteSchema).max(30),
|
|
166
|
-
/**
|
|
167
|
-
* Milliseconds a member waits after a rejected attempt before submitting again, or `null` for
|
|
168
|
-
* no cooldown. Omitted: the quest type's own `retryCooldownMs`.
|
|
169
|
-
*/
|
|
170
|
-
retryCooldownMs: retryCooldownMsSchema.nullable().optional(),
|
|
171
|
-
/**
|
|
172
|
-
* Milliseconds a member waits after an accepted completion before submitting again, or `null`
|
|
173
|
-
* for no cooldown. Omitted: the quest type's own `completionCooldownMs`.
|
|
174
|
-
*/
|
|
175
|
-
completionCooldownMs: retryCooldownMsSchema.nullable().optional(),
|
|
176
|
-
status: z2.enum(["active", "paused", "archived"])
|
|
177
|
-
}).strict();
|
|
178
|
-
var questDraftChangesSchema = z2.object({
|
|
179
|
-
quests: z2.array(
|
|
180
|
-
questInstanceSchema.extend({ expectedRelease: identifier.nullable() })
|
|
181
|
-
).max(questScaleLimits.quests),
|
|
182
|
-
collections: z2.array(questCollectionSchema.omit({ archivedAt: true })).max(questScaleLimits.collections)
|
|
183
|
-
}).strict();
|
|
184
|
-
var draftBase = z2.object({
|
|
185
|
-
id: identifier,
|
|
186
|
-
revision: z2.number().int().positive(),
|
|
187
|
-
baseRevision: z2.number().int().nonnegative(),
|
|
188
|
-
changes: questDraftChangesSchema
|
|
189
|
-
});
|
|
190
|
-
var questDraftSchema = responseShape(
|
|
191
|
-
z2.discriminatedUnion("status", [
|
|
192
|
-
draftBase.extend({ status: z2.literal("draft") }),
|
|
193
|
-
draftBase.extend({
|
|
194
|
-
status: z2.literal("published"),
|
|
195
|
-
releaseIds: z2.array(identifier)
|
|
196
|
-
})
|
|
197
|
-
])
|
|
198
|
-
);
|
|
199
|
-
var questCatalogSchema = responseShape(
|
|
200
|
-
z2.object({
|
|
201
|
-
revision: z2.number().int().nonnegative(),
|
|
202
|
-
types: z2.array(questTypeVersionSchema),
|
|
203
|
-
collections: z2.array(questCollectionSchema),
|
|
204
|
-
quests: z2.array(questInstanceSchema),
|
|
205
|
-
drafts: z2.array(questDraftSchema),
|
|
206
|
-
releases: z2.array(publishedReleaseSchema).default([]),
|
|
207
|
-
supportedInteractions: z2.array(interactionSchema)
|
|
208
|
-
})
|
|
209
|
-
);
|
|
210
|
-
var catalogDeploymentSchema = z2.object({
|
|
211
|
-
expectedRevision: z2.number().int().nonnegative(),
|
|
212
|
-
types: z2.array(
|
|
213
|
-
z2.object({
|
|
214
|
-
code: z2.string().min(1).max(1e6),
|
|
215
|
-
runtime: sdkRuntimeReferenceSchema.optional(),
|
|
216
|
-
provider: reviewModeSchema
|
|
217
|
-
})
|
|
218
|
-
).max(questScaleLimits.questTypes).default([]),
|
|
219
|
-
collections: z2.array(collectionSlotDeclarationSchema).max(questScaleLimits.collections).default([]),
|
|
220
|
-
supportedInteractions: z2.array(interactionSchema).min(1).optional()
|
|
221
|
-
}).strict();
|
|
222
|
-
var catalogDeploymentPreviewSchema = responseShape(
|
|
223
|
-
z2.object({
|
|
224
|
-
revision: z2.number().int().nonnegative(),
|
|
225
|
-
types: z2.array(questTypeVersionSchema),
|
|
226
|
-
collections: z2.array(collectionSlotSchema),
|
|
227
|
-
supportedInteractions: z2.array(interactionSchema)
|
|
228
|
-
})
|
|
229
|
-
);
|
|
230
|
-
var saveQuestDraftSchema = z2.object({
|
|
231
|
-
id: identifier.optional(),
|
|
232
|
-
actionId: identifier,
|
|
233
|
-
expectedRevision: z2.number().int().nonnegative(),
|
|
234
|
-
baseRevision: z2.number().int().nonnegative(),
|
|
235
|
-
changes: questDraftChangesSchema
|
|
236
|
-
}).strict();
|
|
237
|
-
var publishQuestDraftSchema = z2.object({ id: identifier, expectedRevision: z2.number().int().positive() }).strict();
|
|
238
|
-
var questRewardViewSchema = z2.discriminatedUnion("kind", [
|
|
239
|
-
z2.object({
|
|
240
|
-
kind: z2.literal("points"),
|
|
241
|
-
label: z2.string(),
|
|
242
|
-
amount: z2.number().int().nonnegative(),
|
|
243
|
-
ledger: pointLedgerReferenceSchema
|
|
244
|
-
}),
|
|
245
|
-
z2.object({
|
|
246
|
-
kind: z2.literal("tier"),
|
|
247
|
-
label: z2.string(),
|
|
248
|
-
reward: tieredRewardReferenceSchema.extend({
|
|
249
|
-
title: z2.string(),
|
|
250
|
-
badge: badgeSchema.optional(),
|
|
251
|
-
/** The group the reward adds the member to: its key and the title the quest names it by. */
|
|
252
|
-
group: z2.object({ key: identifier, title: z2.string() }).optional()
|
|
253
|
-
}),
|
|
254
|
-
tier: identifier
|
|
255
|
-
}),
|
|
256
|
-
z2.object({ kind: z2.literal("integration"), label: z2.string() })
|
|
257
|
-
]);
|
|
258
|
-
var questViewSchema = responseShape(
|
|
259
|
-
memberProgressSchema.shape.quests.element.extend({
|
|
260
|
-
release: identifier,
|
|
261
|
-
interaction: interactionSchema,
|
|
262
|
-
lifecycle: z2.enum(["active", "paused", "archived"]),
|
|
263
|
-
rewards: z2.array(questRewardViewSchema)
|
|
264
|
-
})
|
|
265
|
-
);
|
|
266
|
-
var collectionViewSchema = z2.object({
|
|
267
|
-
key: identifier.optional(),
|
|
268
|
-
id: identifier,
|
|
269
|
-
title: z2.string(),
|
|
270
|
-
description: z2.string().optional(),
|
|
271
|
-
image: mediaUrlSchema.optional(),
|
|
272
|
-
imageAlt: z2.string().optional(),
|
|
273
|
-
quests: z2.array(questViewSchema)
|
|
274
|
-
});
|
|
275
|
-
var questExperienceSchema = responseShape(
|
|
276
|
-
z2.object({
|
|
277
|
-
entitlements: z2.array(entitlementSchema).default([]),
|
|
278
|
-
member: identifier,
|
|
279
|
-
quests: z2.array(questViewSchema),
|
|
280
|
-
collections: z2.array(collectionViewSchema)
|
|
281
|
-
})
|
|
282
|
-
);
|
|
283
|
-
var questPublicationPreviewSchema = responseShape(
|
|
284
|
-
z2.object({
|
|
285
|
-
draft: questDraftSchema,
|
|
286
|
-
releases: z2.array(publishedReleaseSchema),
|
|
287
|
-
affectedCollections: z2.array(questCollectionSchema)
|
|
288
|
-
})
|
|
289
|
-
);
|
|
290
|
-
var allocateQuestSchema = z2.object({ actionId: identifier }).strict();
|
|
291
|
-
var allocatedQuestSchema = z2.object({ id: identifier });
|
|
292
|
-
|
|
293
|
-
// src/creator-accounts.ts
|
|
294
|
-
import * as z3 from "zod";
|
|
295
|
-
var knownCreatorAccountProviders = ["youtube", "tiktok"];
|
|
296
|
-
var creatorAccountProviderSchema = z3.custom(
|
|
297
|
-
(value) => typeof value === "string" && /^[a-z][a-z0-9-]{0,39}$/.test(value)
|
|
298
|
-
);
|
|
299
|
-
var creatorAccountSchema = z3.object({
|
|
300
|
-
provider: creatorAccountProviderSchema,
|
|
301
|
-
configured: z3.boolean(),
|
|
302
|
-
status: z3.enum(["disconnected", "connected", "reconnect"]),
|
|
303
|
-
subject: z3.string().nullable(),
|
|
304
|
-
revision: z3.number().int().nonnegative(),
|
|
305
|
-
profile: z3.object({
|
|
306
|
-
name: z3.string().optional(),
|
|
307
|
-
username: z3.string().optional(),
|
|
308
|
-
imageUrl: z3.string().optional()
|
|
309
|
-
}).nullable()
|
|
310
|
-
});
|
|
311
|
-
var creatorAccountsSchema = z3.object({
|
|
312
|
-
accounts: z3.array(creatorAccountSchema)
|
|
313
|
-
});
|
|
314
|
-
|
|
315
|
-
// src/collection.ts
|
|
316
|
-
import * as z4 from "zod";
|
|
317
|
-
var collectionCodeSchema = z4.string().regex(/^relay:collect:[a-f0-9]{64}$/);
|
|
318
|
-
var collectionPassSchema = z4.object({
|
|
319
|
-
code: collectionCodeSchema,
|
|
320
|
-
expiresAt: z4.number(),
|
|
321
|
-
entitlement: identifier
|
|
322
|
-
});
|
|
323
|
-
var collectionResolveSchema = z4.object({ code: collectionCodeSchema }).strict();
|
|
324
|
-
var collectionBeginSchema = collectionResolveSchema.extend({
|
|
325
|
-
actionId: identifier,
|
|
326
|
-
revision: z4.number().int().positive(),
|
|
327
|
-
selection: pickupSelectionSchema.optional()
|
|
328
|
-
});
|
|
329
|
-
var collectionPreviewSchema = z4.object({
|
|
330
|
-
entitlement: entitlementSchema,
|
|
331
|
-
inventory: pickupAvailabilitySchema,
|
|
332
|
-
expiresAt: z4.number()
|
|
333
|
-
});
|
|
334
|
-
|
|
335
|
-
// src/outcomes.ts
|
|
336
|
-
import * as z5 from "zod";
|
|
337
|
-
var timestamp = z5.number().int().safe().nonnegative();
|
|
338
|
-
var questEnrollmentInputSchema = z5.strictObject({
|
|
339
|
-
actionId: identifier,
|
|
340
|
-
/** Quest key or ID. */
|
|
341
|
-
quest: identifier
|
|
342
|
-
});
|
|
343
|
-
var memberEnrollmentInputSchema = questEnrollmentInputSchema.extend({
|
|
344
|
-
member: identifier
|
|
345
|
-
});
|
|
346
|
-
var questEnrollmentSchema = z5.object({
|
|
347
|
-
/** Stable quest ID. */
|
|
348
|
-
quest: identifier,
|
|
349
|
-
member: identifier,
|
|
350
|
-
enrolledAt: timestamp
|
|
351
|
-
});
|
|
352
|
-
var questClaimInputSchema = z5.strictObject({
|
|
353
|
-
actionId: identifier,
|
|
354
|
-
/** Quest key or ID. */
|
|
355
|
-
quest: identifier,
|
|
356
|
-
/** The outcome's tracker, as `QuestOutcome.tracker` names it. */
|
|
357
|
-
tracker: identifier,
|
|
358
|
-
record: z5.string().min(1).max(256),
|
|
359
|
-
observedAt: timestamp
|
|
360
|
-
});
|
|
361
|
-
var QuestOutcomeState = {
|
|
362
|
-
Admitted: "admitted",
|
|
363
|
-
Skipped: "skipped"
|
|
364
|
-
};
|
|
365
|
-
var questOutcomeSchema = z5.object({
|
|
366
|
-
/** Prerequisite transition identity; absent on older tracker responses. */
|
|
367
|
-
automatic: identifier.optional(),
|
|
368
|
-
/** Stable quest ID. */
|
|
369
|
-
quest: identifier,
|
|
370
|
-
/** Stable tracker ID of the record decided. */
|
|
371
|
-
tracker: identifier.nullable(),
|
|
372
|
-
/** The record's ID in its tracker. */
|
|
373
|
-
record: z5.string().nullable(),
|
|
374
|
-
/** Which observation of the record was decided. */
|
|
375
|
-
observedAt: timestamp.nullable(),
|
|
376
|
-
state: z5.enum(["admitted", "skipped"]),
|
|
377
|
-
/**
|
|
378
|
-
* Why it was skipped, one of `trackerSkipCodes` or a code a newer Relay sends; null when
|
|
379
|
-
* admitted. Show an unknown code by its `reason`.
|
|
380
|
-
*/
|
|
381
|
-
code: z5.string().nullable(),
|
|
382
|
-
/** Why it was skipped, for people; null when admitted. */
|
|
383
|
-
reason: z5.string().nullable(),
|
|
384
|
-
/** Which window refused admission when `code` is `outside-window`. */
|
|
385
|
-
window: z5.enum(["tracker", "quest"]).optional(),
|
|
386
|
-
/** The admitted attempt. */
|
|
387
|
-
attempt: identifier.nullable(),
|
|
388
|
-
/** The member can claim it with `relay.quests.claim()`. */
|
|
389
|
-
claimable: z5.boolean(),
|
|
390
|
-
createdAt: timestamp,
|
|
391
|
-
updatedAt: timestamp
|
|
392
|
-
});
|
|
393
|
-
var questOutcomeQuerySchema = z5.strictObject({
|
|
394
|
-
/** Quest key or ID. */
|
|
395
|
-
quest: identifier.optional(),
|
|
396
|
-
state: z5.enum(["admitted", "skipped"]).optional(),
|
|
397
|
-
/** Only skips with this code, such as `historical`. */
|
|
398
|
-
code: z5.string().min(1).max(100).optional(),
|
|
399
|
-
cursor: pageCursorSchema.optional()
|
|
400
|
-
});
|
|
401
|
-
var questOutcomePageSchema = z5.object({
|
|
402
|
-
items: z5.array(questOutcomeSchema),
|
|
403
|
-
nextCursor: pageCursorSchema.nullable()
|
|
404
|
-
});
|
|
405
|
-
|
|
406
|
-
// src/participant-rewards.ts
|
|
407
|
-
import * as z6 from "zod";
|
|
408
|
-
var participantEntitlementsSchema = z6.object({
|
|
409
|
-
items: z6.array(entitlementSchema)
|
|
410
|
-
});
|
|
411
|
-
var base2 = {
|
|
412
|
-
id: z6.string(),
|
|
413
|
-
status: z6.string(),
|
|
414
|
-
at: z6.number().nullable(),
|
|
415
|
-
quest: z6.string().nullable(),
|
|
416
|
-
completion: z6.string().nullable()
|
|
417
|
-
};
|
|
418
|
-
var known = z6.discriminatedUnion("kind", [
|
|
419
|
-
z6.object({
|
|
420
|
-
...base2,
|
|
421
|
-
kind: z6.literal("points"),
|
|
422
|
-
ledger: pointLedgerReferenceSchema,
|
|
423
|
-
amount: z6.number(),
|
|
424
|
-
reversed: z6.number()
|
|
425
|
-
}).catchall(z6.json()),
|
|
426
|
-
z6.object({
|
|
427
|
-
...base2,
|
|
428
|
-
kind: z6.literal("tier"),
|
|
429
|
-
entitlement: entitlementSchema
|
|
430
|
-
}).catchall(z6.json().transform((value) => value)),
|
|
431
|
-
z6.object({
|
|
432
|
-
...base2,
|
|
433
|
-
kind: z6.literal("integration"),
|
|
434
|
-
provider: z6.string(),
|
|
435
|
-
action: z6.string(),
|
|
436
|
-
roleId: z6.string().optional(),
|
|
437
|
-
deliveredAt: z6.number().nullable(),
|
|
438
|
-
revokedAt: z6.number().nullable(),
|
|
439
|
-
reconciliation: z6.object({ status: z6.string(), ownership: z6.string(), at: z6.number() }).catchall(z6.json()).nullable()
|
|
440
|
-
}).catchall(z6.json().optional())
|
|
441
|
-
]);
|
|
442
|
-
var participantDeliverySchema = z6.union([
|
|
443
|
-
known,
|
|
444
|
-
z6.object({
|
|
445
|
-
...base2,
|
|
446
|
-
kind: z6.string().refine((kind) => !["points", "tier", "integration"].includes(kind))
|
|
447
|
-
}).catchall(z6.json()).transform(({ kind, ...item }) => ({
|
|
448
|
-
...item,
|
|
449
|
-
kind: "unknown",
|
|
450
|
-
reportedKind: kind
|
|
451
|
-
}))
|
|
452
|
-
]);
|
|
453
|
-
var participantDeliveriesSchema = z6.object({
|
|
454
|
-
items: z6.array(participantDeliverySchema)
|
|
455
|
-
});
|
|
456
|
-
|
|
457
|
-
// src/reward-deliveries.ts
|
|
458
|
-
import * as z7 from "zod";
|
|
459
|
-
var RewardDeliveryAction = {
|
|
460
|
-
/** Delivers a quest's Discord role reward. */
|
|
461
|
-
GrantRole: "grant-role",
|
|
462
|
-
/**
|
|
463
|
-
* Posts a quest's announcement in a Telegram chat or Discord channel. Its `provider` is
|
|
464
|
-
* `telegram` or `discord`, and its `roleId` is empty.
|
|
465
|
-
*/
|
|
466
|
-
PostMessage: "post-message"
|
|
467
|
-
};
|
|
468
|
-
var rewardDeliveryActionSchema = z7.string().min(1).max(64);
|
|
469
|
-
var roleReconciliationSchema = z7.object({
|
|
470
|
-
status: z7.enum(["pending", "granted", "removed", "preserved", "failed"]),
|
|
471
|
-
ownership: z7.enum(["unclaimed", "relay", "external"]),
|
|
472
|
-
at: z7.number(),
|
|
473
|
-
reason: z7.string().nullable()
|
|
474
|
-
});
|
|
475
|
-
var knownRewardDeliverySchema = z7.object({
|
|
476
|
-
id: z7.string(),
|
|
477
|
-
quest: z7.string(),
|
|
478
|
-
completion: z7.string(),
|
|
479
|
-
member: z7.string(),
|
|
480
|
-
provider: z7.literal("discord"),
|
|
481
|
-
/** `RewardDeliveryAction`, such as `grant-role`. */
|
|
482
|
-
action: rewardDeliveryActionSchema,
|
|
483
|
-
roleId: z7.string(),
|
|
484
|
-
/**
|
|
485
|
-
* `failed` is terminal: Discord rejected the grant permanently (unknown role,
|
|
486
|
-
* member left the server, missing permissions) or retries ran out after about
|
|
487
|
-
* a day. An operator can retry it once the cause is fixed, unless revokedAt is set.
|
|
488
|
-
* Revoke stops pending grants; a late success records deliveredAt but leaves status failed.
|
|
489
|
-
*/
|
|
490
|
-
status: z7.enum(["pending", "delivered", "failed"]),
|
|
491
|
-
/** Provider attempts in the current round; an operator retry starts a new round at zero. */
|
|
492
|
-
attempts: z7.number().int(),
|
|
493
|
-
/** While pending with a `lastError`, when the next attempt is scheduled. */
|
|
494
|
-
nextAt: z7.number(),
|
|
495
|
-
lastError: z7.string().nullable(),
|
|
496
|
-
createdAt: z7.number(),
|
|
497
|
-
deliveredAt: z7.number().nullable(),
|
|
498
|
-
/** First dispatch attempt, retained across retries. Legacy rows use creation time when dispatch timing is unknown. */
|
|
499
|
-
dispatchedAt: z7.number().nullable().optional(),
|
|
500
|
-
/** Completion revocation stops retries, including deliveries that had already failed. */
|
|
501
|
-
revokedAt: z7.number().nullable().optional(),
|
|
502
|
-
/** Current reconciliation of the pinned Discord membership; original delivery and revoke history stay intact. */
|
|
503
|
-
reconciliation: roleReconciliationSchema.nullable().optional()
|
|
504
|
-
});
|
|
505
|
-
var futureRewardDeliverySchema = knownRewardDeliverySchema.extend({
|
|
506
|
-
provider: z7.string(),
|
|
507
|
-
status: z7.string(),
|
|
508
|
-
roleId: z7.string().optional(),
|
|
509
|
-
reconciliation: z7.object({
|
|
510
|
-
status: z7.string(),
|
|
511
|
-
ownership: z7.string(),
|
|
512
|
-
at: z7.number(),
|
|
513
|
-
reason: z7.string().nullable()
|
|
514
|
-
}).catchall(z7.json()).nullable().optional()
|
|
515
|
-
}).catchall(z7.json().optional()).refine(
|
|
516
|
-
(delivery) => delivery.provider !== "discord" || !["pending", "delivered", "failed"].includes(delivery.status) || delivery.reconciliation && (!["pending", "granted", "removed", "preserved", "failed"].includes(
|
|
517
|
-
delivery.reconciliation.status
|
|
518
|
-
) || !["unclaimed", "relay", "external"].includes(
|
|
519
|
-
delivery.reconciliation.ownership
|
|
520
|
-
))
|
|
521
|
-
);
|
|
522
|
-
var rewardDeliverySchema = z7.union([
|
|
523
|
-
knownRewardDeliverySchema.catchall(z7.json().optional()),
|
|
524
|
-
futureRewardDeliverySchema
|
|
525
|
-
]);
|
|
526
|
-
var rewardDeliveriesSchema = z7.object({
|
|
527
|
-
deliveries: z7.array(rewardDeliverySchema),
|
|
528
|
-
nextCursor: pageCursorSchema.nullable().default(null)
|
|
529
|
-
});
|
|
530
|
-
var rewardDeliveryQuerySchema = z7.strictObject({
|
|
531
|
-
cursor: pageCursorSchema.optional(),
|
|
532
|
-
limit: z7.coerce.number().int().min(1).max(500).optional()
|
|
533
|
-
});
|
|
534
|
-
var discordRoleRewardSchema = z7.object({
|
|
535
|
-
roleId: z7.string(),
|
|
536
|
-
quests: z7.array(z7.string()),
|
|
537
|
-
/** Delivery records of this role by `RewardDelivery.status`. */
|
|
538
|
-
deliveries: z7.object({
|
|
539
|
-
pending: z7.number().int(),
|
|
540
|
-
delivered: z7.number().int(),
|
|
541
|
-
failed: z7.number().int()
|
|
542
|
-
})
|
|
543
|
-
});
|
|
544
|
-
var discordRoleRewardsSchema = z7.object({
|
|
545
|
-
roles: z7.array(discordRoleRewardSchema)
|
|
546
|
-
});
|
|
547
|
-
|
|
548
|
-
export {
|
|
549
|
-
knownRelayEventSchema,
|
|
550
|
-
relayEventSchema,
|
|
551
|
-
participantActivityQuerySchema,
|
|
552
|
-
participantActivitySchema,
|
|
553
|
-
interactionSchema,
|
|
554
|
-
questInteraction,
|
|
555
|
-
questTypeVersionSchema,
|
|
556
|
-
collectionSlotSchema,
|
|
557
|
-
collectionSlotDeclarationSchema,
|
|
558
|
-
questCollectionSchema,
|
|
559
|
-
questInstanceSchema,
|
|
560
|
-
questDraftChangesSchema,
|
|
561
|
-
questDraftSchema,
|
|
562
|
-
questCatalogSchema,
|
|
563
|
-
catalogDeploymentSchema,
|
|
564
|
-
catalogDeploymentPreviewSchema,
|
|
565
|
-
saveQuestDraftSchema,
|
|
566
|
-
publishQuestDraftSchema,
|
|
567
|
-
questRewardViewSchema,
|
|
568
|
-
questViewSchema,
|
|
569
|
-
collectionViewSchema,
|
|
570
|
-
questExperienceSchema,
|
|
571
|
-
questPublicationPreviewSchema,
|
|
572
|
-
allocateQuestSchema,
|
|
573
|
-
allocatedQuestSchema,
|
|
574
|
-
knownCreatorAccountProviders,
|
|
575
|
-
creatorAccountProviderSchema,
|
|
576
|
-
creatorAccountSchema,
|
|
577
|
-
creatorAccountsSchema,
|
|
578
|
-
collectionCodeSchema,
|
|
579
|
-
collectionPassSchema,
|
|
580
|
-
collectionResolveSchema,
|
|
581
|
-
collectionBeginSchema,
|
|
582
|
-
collectionPreviewSchema,
|
|
583
|
-
questEnrollmentInputSchema,
|
|
584
|
-
memberEnrollmentInputSchema,
|
|
585
|
-
questEnrollmentSchema,
|
|
586
|
-
questClaimInputSchema,
|
|
587
|
-
QuestOutcomeState,
|
|
588
|
-
questOutcomeSchema,
|
|
589
|
-
questOutcomeQuerySchema,
|
|
590
|
-
questOutcomePageSchema,
|
|
591
|
-
participantEntitlementsSchema,
|
|
592
|
-
participantDeliverySchema,
|
|
593
|
-
participantDeliveriesSchema,
|
|
594
|
-
RewardDeliveryAction,
|
|
595
|
-
roleReconciliationSchema,
|
|
596
|
-
knownRewardDeliverySchema,
|
|
597
|
-
rewardDeliverySchema,
|
|
598
|
-
rewardDeliveriesSchema,
|
|
599
|
-
rewardDeliveryQuerySchema,
|
|
600
|
-
discordRoleRewardSchema,
|
|
601
|
-
discordRoleRewardsSchema
|
|
602
|
-
};
|