@domino-sdk/relay 1.61.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.
Files changed (88) hide show
  1. package/CHANGELOG.md +276 -8
  2. package/README.md +3 -2
  3. package/dist/{schema-CZ6Rj0ZF.d.ts → accounts-nz3mzfRQ.d.ts} +3146 -1765
  4. package/dist/action-9Xl0StBg.d.ts +33 -0
  5. package/dist/{attempt-captures-DYnJVkfg.d.ts → attempt-captures-DMi8oR9T.d.ts} +1 -1
  6. package/dist/authoring.d.ts +171 -49
  7. package/dist/authoring.js +158 -49
  8. package/dist/{automatic-outcomes-If88LR9f.d.ts → automatic-outcomes-C_LLQU1p.d.ts} +15 -1
  9. package/dist/avatar.d.ts +1 -1
  10. package/dist/browser.d.ts +15 -11
  11. package/dist/browser.js +18 -12
  12. package/dist/capability-error-CuI_F7yM.d.ts +296 -0
  13. package/dist/{pages-K7-KjSXw.d.ts → catalog-BaTOKpNw.d.ts} +56 -567
  14. package/dist/{chunk-XBV2CK2H.js → chunk-3RFP6GT5.js} +15 -3
  15. package/dist/{chunk-VURRFVNP.js → chunk-4GQW43UU.js} +239 -361
  16. package/dist/chunk-4NOFSGAL.js +320 -0
  17. package/dist/{chunk-24I4R732.js → chunk-5XLZ34PV.js} +34 -19
  18. package/dist/{chunk-L77O64I4.js → chunk-7X67QLPB.js} +43 -43
  19. package/dist/{chunk-RHBS5FJL.js → chunk-7Z4SZ6YM.js} +3 -3
  20. package/dist/{chunk-QEAS4ZGS.js → chunk-AQOL3SK5.js} +1 -1
  21. package/dist/chunk-EHUSD3O2.js +377 -0
  22. package/dist/chunk-FO2LCZTL.js +19 -0
  23. package/dist/{chunk-DYXDZFKA.js → chunk-FU5CGNTR.js} +166 -178
  24. package/dist/chunk-FWLQ5XCS.js +21 -0
  25. package/dist/chunk-GLH6MEI2.js +193 -0
  26. package/dist/chunk-ICXZZNPS.js +199 -0
  27. package/dist/{chunk-ZDJLPN4L.js → chunk-ID3BZXFZ.js} +2696 -2693
  28. package/dist/chunk-KP2MCX3R.js +587 -0
  29. package/dist/{chunk-SKGTNTLF.js → chunk-LZWXCBUB.js} +213 -297
  30. package/dist/chunk-MTKRIQEU.js +31 -0
  31. package/dist/{chunk-4OC7REYX.js → chunk-MWMCQLCG.js} +3 -3
  32. package/dist/{chunk-PPB7HALD.js → chunk-N4BDKS6Y.js} +27 -26
  33. package/dist/{chunk-5I54XBK2.js → chunk-N4LNEGQX.js} +2 -2
  34. package/dist/chunk-NQDEWJWE.js +554 -0
  35. package/dist/chunk-QR6HH4DI.js +508 -0
  36. package/dist/chunk-TLSQETTY.js +41 -0
  37. package/dist/{chunk-MHPKEVEW.js → chunk-U66GUVSG.js} +7 -2
  38. package/dist/{chunk-KDR2VAJP.js → chunk-UYVJZR33.js} +2 -2
  39. package/dist/chunk-UZ765UGH.js +18 -0
  40. package/dist/{chunk-7A4J67ZL.js → chunk-VWQGWGCH.js} +7 -7
  41. package/dist/chunk-W7YSMSGC.js +725 -0
  42. package/dist/{client-C51w7fMb.d.ts → client-DHmG7rn6.d.ts} +126 -93
  43. package/dist/{announcements-CHx3-HBw.d.ts → dashboards-CLemT6kj.d.ts} +14 -137
  44. package/dist/{deployments-kWoHFaqj.d.ts → deployments-DTULi7dF.d.ts} +450 -18
  45. package/dist/identity-integration-DOeNZaxF.d.ts +1271 -0
  46. package/dist/index.d.ts +13 -11
  47. package/dist/index.js +16 -11
  48. package/dist/internal.d.ts +29 -13
  49. package/dist/internal.js +57 -17
  50. package/dist/{integrations-B3y36OaB.d.ts → limits-kNzYdZ00.d.ts} +464 -53
  51. package/dist/{offers-BoV4ryUc.d.ts → offers-CYeN_I0Y.d.ts} +22 -4
  52. package/dist/{participant-activity-DHL8QYks.d.ts → participant-activity-D-Drp24G.d.ts} +16 -3
  53. package/dist/portal-proxy.d.ts +75 -2
  54. package/dist/portal-proxy.js +153 -25
  55. package/dist/react/index.d.ts +214 -27
  56. package/dist/react/index.js +196 -42
  57. package/dist/{action-DBzILFx9.d.ts → request-error-D_dUPLwo.d.ts} +1 -31
  58. package/dist/reward-deliveries-drp-x1G-.d.ts +782 -0
  59. package/dist/runtime/authoring.js +1 -1
  60. package/dist/runtime/chunks/UGDV5W4N.js +1 -0
  61. package/dist/runtime/manifest.json +3 -3
  62. package/dist/runtime/schema.js +1 -1
  63. package/dist/schema.d.ts +330 -31
  64. package/dist/schema.js +147 -91
  65. package/dist/server/index.d.ts +14 -12
  66. package/dist/server/index.js +6425 -6260
  67. package/dist/sign-in-providers-B1Q9eDRm.d.ts +44 -0
  68. package/dist/submission-input-DZCbjQUH.d.ts +343 -0
  69. package/dist/{telegram-browser-BUceZIGZ.d.ts → telegram-browser-NL0Asmsi.d.ts} +46 -6
  70. package/dist/telegram.d.ts +64 -0
  71. package/dist/telegram.js +23 -0
  72. package/dist/testing.d.ts +326 -27
  73. package/dist/testing.js +440 -90
  74. package/dist/tracker-data-esm3WG8R.d.ts +1881 -0
  75. package/dist/{transport-BrX9pIGN.d.ts → transport-Czht_irp.d.ts} +43483 -38512
  76. package/dist/{wallet-CIqFoxdm.d.ts → wallet-B7e06v4m.d.ts} +32 -9
  77. package/package.json +5 -1
  78. package/dist/accounts-DoabriBX.d.ts +0 -306
  79. package/dist/capability-error-DufwG3G0.d.ts +0 -159
  80. package/dist/chunk-3Y3L2F54.js +0 -982
  81. package/dist/chunk-DHXDBAJF.js +0 -544
  82. package/dist/chunk-EN3M5Z4J.js +0 -13
  83. package/dist/chunk-QNUHWK7R.js +0 -602
  84. package/dist/chunk-SE4PFJPT.js +0 -247
  85. package/dist/groups-CqcA2Ycs.d.ts +0 -2827
  86. package/dist/runtime/chunks/5QVFB4TU.js +0 -1
  87. package/dist/submission-input-C54Q8yAD.d.ts +0 -146
  88. package/dist/x-D1PGi8Sq.d.ts +0 -331
@@ -1,602 +0,0 @@
1
- import {
2
- badgeSchema
3
- } from "./chunk-3Y3L2F54.js";
4
- import {
5
- pointLedgerReferenceSchema
6
- } from "./chunk-SE4PFJPT.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-ZDJLPN4L.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
- };