@domino-sdk/relay 0.5.0 → 0.7.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/dist/authoring.d.ts +93 -5
- package/dist/authoring.js +42 -6
- package/dist/browser.d.ts +438 -32
- package/dist/browser.js +4 -4
- package/dist/{chunk-QWRSUSNB.js → chunk-36LZ3IOO.js} +1 -1
- package/dist/chunk-6QUCADMF.js +831 -0
- package/dist/{chunk-LUCL63DS.js → chunk-LXLNC4CN.js} +200 -158
- package/dist/{chunk-TXL43HL3.js → chunk-TYVT5BPZ.js} +4 -2
- package/dist/index.d.ts +1358 -77
- package/dist/index.js +44 -4
- package/dist/portal-proxy.js +3 -3
- package/dist/schema.d.ts +429 -9
- package/dist/schema.js +3 -1
- package/dist/{settings-B7vsT8nd.d.ts → settings-CU_oBcx0.d.ts} +217 -1
- package/package.json +1 -1
- package/dist/chunk-3IQ4KUKF.js +0 -613
|
@@ -10,12 +10,12 @@ import {
|
|
|
10
10
|
referralDefinitionSchema,
|
|
11
11
|
referralHistorySchema,
|
|
12
12
|
referralSummarySchema
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-TYVT5BPZ.js";
|
|
14
14
|
import {
|
|
15
15
|
authScopeSchema,
|
|
16
16
|
exchangeResultSchema,
|
|
17
17
|
sessionSchema
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-36LZ3IOO.js";
|
|
19
19
|
import {
|
|
20
20
|
accountConnectionSchema,
|
|
21
21
|
attemptSchema,
|
|
@@ -39,7 +39,36 @@ import {
|
|
|
39
39
|
settingsValuesSchema,
|
|
40
40
|
snapshotSchema,
|
|
41
41
|
templateSchema
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-6QUCADMF.js";
|
|
43
|
+
|
|
44
|
+
// src/point-ledgers.ts
|
|
45
|
+
import { z } from "zod";
|
|
46
|
+
var pointLedgerSchema = z.object({
|
|
47
|
+
id: identifier,
|
|
48
|
+
name: z.string().trim().min(1).max(120),
|
|
49
|
+
description: z.string().trim().max(1e3).default("")
|
|
50
|
+
}).strict();
|
|
51
|
+
|
|
52
|
+
// src/reward-deliveries.ts
|
|
53
|
+
import { z as z2 } from "zod";
|
|
54
|
+
var rewardDeliverySchema = z2.object({
|
|
55
|
+
id: z2.string(),
|
|
56
|
+
quest: z2.string(),
|
|
57
|
+
completion: z2.string(),
|
|
58
|
+
member: z2.string(),
|
|
59
|
+
provider: z2.literal("discord"),
|
|
60
|
+
action: z2.literal("grant-role"),
|
|
61
|
+
roleId: z2.string(),
|
|
62
|
+
status: z2.enum(["pending", "delivered"]),
|
|
63
|
+
attempts: z2.number().int(),
|
|
64
|
+
nextAt: z2.number(),
|
|
65
|
+
lastError: z2.string().nullable(),
|
|
66
|
+
createdAt: z2.number(),
|
|
67
|
+
deliveredAt: z2.number().nullable()
|
|
68
|
+
});
|
|
69
|
+
var rewardDeliveriesSchema = z2.object({
|
|
70
|
+
deliveries: z2.array(rewardDeliverySchema)
|
|
71
|
+
});
|
|
43
72
|
|
|
44
73
|
// src/resource-id.ts
|
|
45
74
|
var alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
@@ -55,8 +84,8 @@ function resourceId(prefix) {
|
|
|
55
84
|
}
|
|
56
85
|
|
|
57
86
|
// src/catalog.ts
|
|
58
|
-
import { z } from "zod";
|
|
59
|
-
var interactionSchema =
|
|
87
|
+
import { z as z3 } from "zod";
|
|
88
|
+
var interactionSchema = z3.enum([
|
|
60
89
|
"photo",
|
|
61
90
|
"quiz",
|
|
62
91
|
"claim",
|
|
@@ -66,103 +95,103 @@ var interactionSchema = z.enum([
|
|
|
66
95
|
function questInteraction(trigger) {
|
|
67
96
|
return trigger.kind === "automatic" ? "automatic" : trigger.actor === "staff" ? "staff" : trigger.input === "none" ? "claim" : trigger.input;
|
|
68
97
|
}
|
|
69
|
-
var questTypeVersionSchema =
|
|
98
|
+
var questTypeVersionSchema = z3.object({
|
|
70
99
|
id: identifier,
|
|
71
100
|
version: identifier,
|
|
72
|
-
code:
|
|
101
|
+
code: z3.string(),
|
|
73
102
|
definition: questDescriptionSchema,
|
|
74
103
|
provider: reviewModeSchema,
|
|
75
|
-
createdAt:
|
|
104
|
+
createdAt: z3.number()
|
|
76
105
|
});
|
|
77
|
-
var collectionSlotSchema =
|
|
106
|
+
var collectionSlotSchema = z3.object({ id: identifier, title: z3.string().trim().min(1).max(120) }).strict();
|
|
78
107
|
var questCollectionSchema = collectionSlotSchema.extend({
|
|
79
|
-
quests:
|
|
108
|
+
quests: z3.array(identifier).max(100).refine(
|
|
80
109
|
(v) => new Set(v).size === v.length,
|
|
81
110
|
"A collection can contain a quest only once"
|
|
82
111
|
)
|
|
83
112
|
});
|
|
84
|
-
var questInstanceSchema =
|
|
113
|
+
var questInstanceSchema = z3.object({
|
|
85
114
|
id: identifier,
|
|
86
|
-
title:
|
|
115
|
+
title: z3.string().trim().min(1).max(120),
|
|
87
116
|
typeVersion: identifier,
|
|
88
117
|
settings: settingsValuesSchema,
|
|
89
|
-
requires:
|
|
90
|
-
status:
|
|
118
|
+
requires: z3.array(identifier).max(30),
|
|
119
|
+
status: z3.enum(["active", "paused", "archived"])
|
|
91
120
|
}).strict();
|
|
92
|
-
var questDraftChangesSchema =
|
|
93
|
-
quests:
|
|
121
|
+
var questDraftChangesSchema = z3.object({
|
|
122
|
+
quests: z3.array(
|
|
94
123
|
questInstanceSchema.extend({ expectedRelease: identifier.nullable() })
|
|
95
124
|
).max(50),
|
|
96
|
-
collections:
|
|
125
|
+
collections: z3.array(questCollectionSchema).max(50)
|
|
97
126
|
}).strict();
|
|
98
|
-
var draftBase =
|
|
127
|
+
var draftBase = z3.object({
|
|
99
128
|
id: identifier,
|
|
100
|
-
revision:
|
|
101
|
-
baseRevision:
|
|
129
|
+
revision: z3.number().int().positive(),
|
|
130
|
+
baseRevision: z3.number().int().nonnegative(),
|
|
102
131
|
changes: questDraftChangesSchema
|
|
103
132
|
});
|
|
104
|
-
var questDraftSchema =
|
|
105
|
-
draftBase.extend({ status:
|
|
133
|
+
var questDraftSchema = z3.discriminatedUnion("status", [
|
|
134
|
+
draftBase.extend({ status: z3.literal("draft") }),
|
|
106
135
|
draftBase.extend({
|
|
107
|
-
status:
|
|
108
|
-
releaseIds:
|
|
136
|
+
status: z3.literal("published"),
|
|
137
|
+
releaseIds: z3.array(identifier)
|
|
109
138
|
})
|
|
110
139
|
]);
|
|
111
|
-
var questCatalogSchema =
|
|
112
|
-
revision:
|
|
113
|
-
types:
|
|
114
|
-
collections:
|
|
115
|
-
quests:
|
|
116
|
-
drafts:
|
|
117
|
-
releases:
|
|
118
|
-
supportedInteractions:
|
|
140
|
+
var questCatalogSchema = z3.object({
|
|
141
|
+
revision: z3.number().int().nonnegative(),
|
|
142
|
+
types: z3.array(questTypeVersionSchema),
|
|
143
|
+
collections: z3.array(questCollectionSchema),
|
|
144
|
+
quests: z3.array(questInstanceSchema),
|
|
145
|
+
drafts: z3.array(questDraftSchema),
|
|
146
|
+
releases: z3.array(publishedReleaseSchema).default([]),
|
|
147
|
+
supportedInteractions: z3.array(interactionSchema)
|
|
119
148
|
});
|
|
120
|
-
var catalogDeploymentSchema =
|
|
121
|
-
expectedRevision:
|
|
122
|
-
types:
|
|
123
|
-
|
|
124
|
-
code:
|
|
149
|
+
var catalogDeploymentSchema = z3.object({
|
|
150
|
+
expectedRevision: z3.number().int().nonnegative(),
|
|
151
|
+
types: z3.array(
|
|
152
|
+
z3.object({
|
|
153
|
+
code: z3.string().min(1).max(1e6),
|
|
125
154
|
provider: reviewModeSchema
|
|
126
155
|
})
|
|
127
156
|
).max(50).default([]),
|
|
128
|
-
collections:
|
|
129
|
-
supportedInteractions:
|
|
157
|
+
collections: z3.array(collectionSlotSchema).max(50).default([]),
|
|
158
|
+
supportedInteractions: z3.array(interactionSchema).min(1).optional()
|
|
130
159
|
}).strict();
|
|
131
|
-
var catalogDeploymentPreviewSchema =
|
|
132
|
-
revision:
|
|
133
|
-
types:
|
|
134
|
-
collections:
|
|
135
|
-
supportedInteractions:
|
|
160
|
+
var catalogDeploymentPreviewSchema = z3.object({
|
|
161
|
+
revision: z3.number().int().nonnegative(),
|
|
162
|
+
types: z3.array(questTypeVersionSchema),
|
|
163
|
+
collections: z3.array(collectionSlotSchema),
|
|
164
|
+
supportedInteractions: z3.array(interactionSchema)
|
|
136
165
|
});
|
|
137
|
-
var saveQuestDraftSchema =
|
|
166
|
+
var saveQuestDraftSchema = z3.object({
|
|
138
167
|
id: identifier,
|
|
139
|
-
expectedRevision:
|
|
140
|
-
baseRevision:
|
|
168
|
+
expectedRevision: z3.number().int().nonnegative(),
|
|
169
|
+
baseRevision: z3.number().int().nonnegative(),
|
|
141
170
|
changes: questDraftChangesSchema
|
|
142
171
|
}).strict();
|
|
143
|
-
var publishQuestDraftSchema =
|
|
172
|
+
var publishQuestDraftSchema = z3.object({ id: identifier, expectedRevision: z3.number().int().positive() }).strict();
|
|
144
173
|
var questViewSchema = memberProgressSchema.shape.quests.element.extend(
|
|
145
174
|
{
|
|
146
175
|
release: identifier,
|
|
147
176
|
interaction: interactionSchema,
|
|
148
|
-
lifecycle:
|
|
149
|
-
rewards:
|
|
177
|
+
lifecycle: z3.enum(["active", "paused", "archived"]),
|
|
178
|
+
rewards: z3.array(z3.object({ label: z3.string() }))
|
|
150
179
|
}
|
|
151
180
|
);
|
|
152
|
-
var collectionViewSchema =
|
|
181
|
+
var collectionViewSchema = z3.object({
|
|
153
182
|
id: identifier,
|
|
154
|
-
title:
|
|
155
|
-
quests:
|
|
183
|
+
title: z3.string(),
|
|
184
|
+
quests: z3.array(questViewSchema)
|
|
156
185
|
});
|
|
157
|
-
var questExperienceSchema =
|
|
186
|
+
var questExperienceSchema = z3.object({
|
|
158
187
|
member: identifier,
|
|
159
|
-
quests:
|
|
160
|
-
collections:
|
|
188
|
+
quests: z3.array(questViewSchema),
|
|
189
|
+
collections: z3.array(collectionViewSchema)
|
|
161
190
|
});
|
|
162
|
-
var questPublicationPreviewSchema =
|
|
191
|
+
var questPublicationPreviewSchema = z3.object({
|
|
163
192
|
draft: questDraftSchema,
|
|
164
|
-
releases:
|
|
165
|
-
affectedCollections:
|
|
193
|
+
releases: z3.array(publishedReleaseSchema),
|
|
194
|
+
affectedCollections: z3.array(questCollectionSchema)
|
|
166
195
|
});
|
|
167
196
|
|
|
168
197
|
// src/errors.ts
|
|
@@ -179,43 +208,43 @@ var RelayError = class extends Error {
|
|
|
179
208
|
};
|
|
180
209
|
|
|
181
210
|
// src/submissions.ts
|
|
182
|
-
import { z as
|
|
211
|
+
import { z as z4 } from "zod";
|
|
183
212
|
var common = {
|
|
184
213
|
id: identifier,
|
|
185
214
|
quest: identifier,
|
|
186
215
|
release: identifier.optional()
|
|
187
216
|
};
|
|
188
|
-
var claimInputSchema =
|
|
217
|
+
var claimInputSchema = z4.union([
|
|
189
218
|
quizEvidenceSchema,
|
|
190
|
-
|
|
219
|
+
z4.object({ kind: z4.literal("none") }).strict()
|
|
191
220
|
]);
|
|
192
|
-
var draftSchema =
|
|
221
|
+
var draftSchema = z4.union([
|
|
193
222
|
claimInputSchema,
|
|
194
|
-
|
|
223
|
+
z4.object({ kind: z4.literal("photo"), file: z4.instanceof(Blob) })
|
|
195
224
|
]);
|
|
196
|
-
var recordSchema =
|
|
197
|
-
|
|
225
|
+
var recordSchema = z4.union([
|
|
226
|
+
z4.object({
|
|
198
227
|
...common,
|
|
199
|
-
stage:
|
|
228
|
+
stage: z4.literal("review"),
|
|
200
229
|
draft: draftSchema.nullable()
|
|
201
230
|
}),
|
|
202
|
-
|
|
203
|
-
|
|
231
|
+
z4.object({ ...common, stage: z4.literal("upload"), file: z4.instanceof(Blob) }),
|
|
232
|
+
z4.object({
|
|
204
233
|
...common,
|
|
205
|
-
stage:
|
|
234
|
+
stage: z4.literal("claim"),
|
|
206
235
|
evidence: identifier,
|
|
207
|
-
file:
|
|
236
|
+
file: z4.instanceof(Blob).optional()
|
|
208
237
|
}),
|
|
209
|
-
|
|
238
|
+
z4.object({
|
|
210
239
|
...common,
|
|
211
|
-
stage:
|
|
240
|
+
stage: z4.literal("submitted"),
|
|
212
241
|
evidence: identifier,
|
|
213
242
|
attempt: identifier
|
|
214
243
|
}),
|
|
215
|
-
|
|
216
|
-
|
|
244
|
+
z4.object({ ...common, stage: z4.literal("claim"), input: claimInputSchema }),
|
|
245
|
+
z4.object({
|
|
217
246
|
...common,
|
|
218
|
-
stage:
|
|
247
|
+
stage: z4.literal("submitted"),
|
|
219
248
|
input: claimInputSchema,
|
|
220
249
|
attempt: identifier
|
|
221
250
|
})
|
|
@@ -348,7 +377,8 @@ function submissions(transport, configuredStore, namespace) {
|
|
|
348
377
|
const previous = await claim(existing);
|
|
349
378
|
if (previous.status === "failed")
|
|
350
379
|
return transport.retry(previous.id, sessionId);
|
|
351
|
-
if (previous.status !== "rejected"
|
|
380
|
+
if (previous.status !== "rejected" && !(options.repeatable && previous.status === "accepted"))
|
|
381
|
+
return previous;
|
|
352
382
|
}
|
|
353
383
|
await store.write(key, record);
|
|
354
384
|
return resumeRecord(record);
|
|
@@ -365,7 +395,7 @@ function submissions(transport, configuredStore, namespace) {
|
|
|
365
395
|
"Resume the unfinished submission before starting over."
|
|
366
396
|
);
|
|
367
397
|
const attempt = await claim(record);
|
|
368
|
-
if (attempt.status !== "failed" && attempt.status !== "rejected")
|
|
398
|
+
if (attempt.status !== "failed" && attempt.status !== "rejected" && !(options.repeatable && attempt.status === "accepted"))
|
|
369
399
|
throw new Error(
|
|
370
400
|
"Only a failed or rejected submission can be discarded."
|
|
371
401
|
);
|
|
@@ -486,7 +516,8 @@ function questActions(submission, latest) {
|
|
|
486
516
|
const handle = await submission(view.quest, {
|
|
487
517
|
input: "none",
|
|
488
518
|
release: view.release,
|
|
489
|
-
recoverPrevious: true
|
|
519
|
+
recoverPrevious: true,
|
|
520
|
+
repeatable: view.completion.kind === "keyed"
|
|
490
521
|
});
|
|
491
522
|
return {
|
|
492
523
|
kind: "status",
|
|
@@ -501,7 +532,8 @@ function questActions(submission, latest) {
|
|
|
501
532
|
const handle = await submission(view.quest, {
|
|
502
533
|
input: "photo",
|
|
503
534
|
release: view.release,
|
|
504
|
-
recoverPrevious: true
|
|
535
|
+
recoverPrevious: true,
|
|
536
|
+
repeatable: view.completion.kind === "keyed"
|
|
505
537
|
});
|
|
506
538
|
return {
|
|
507
539
|
kind: "photo",
|
|
@@ -516,7 +548,8 @@ function questActions(submission, latest) {
|
|
|
516
548
|
const handle = await submission(view.quest, {
|
|
517
549
|
input: "quiz",
|
|
518
550
|
release: view.release,
|
|
519
|
-
recoverPrevious: true
|
|
551
|
+
recoverPrevious: true,
|
|
552
|
+
repeatable: view.completion.kind === "keyed"
|
|
520
553
|
});
|
|
521
554
|
return {
|
|
522
555
|
kind: "quiz",
|
|
@@ -531,7 +564,8 @@ function questActions(submission, latest) {
|
|
|
531
564
|
const handle = await submission(view.quest, {
|
|
532
565
|
input: "none",
|
|
533
566
|
release: view.release,
|
|
534
|
-
recoverPrevious: true
|
|
567
|
+
recoverPrevious: true,
|
|
568
|
+
repeatable: view.completion.kind === "keyed"
|
|
535
569
|
});
|
|
536
570
|
return {
|
|
537
571
|
kind: "claim",
|
|
@@ -624,56 +658,56 @@ function observeProgress(transport, listener, options = {}, onDispose = () => {
|
|
|
624
658
|
}
|
|
625
659
|
|
|
626
660
|
// src/index.ts
|
|
627
|
-
import { z as
|
|
661
|
+
import { z as z9 } from "zod";
|
|
628
662
|
|
|
629
663
|
// src/wallet.ts
|
|
630
|
-
import { z as
|
|
631
|
-
var solanaAddressSchema =
|
|
632
|
-
var walletConnectionSchema =
|
|
633
|
-
chain:
|
|
664
|
+
import { z as z5 } from "zod";
|
|
665
|
+
var solanaAddressSchema = z5.string().min(32).max(44).regex(/^[1-9A-HJ-NP-Za-km-z]+$/);
|
|
666
|
+
var walletConnectionSchema = z5.object({
|
|
667
|
+
chain: z5.literal("solana"),
|
|
634
668
|
address: solanaAddressSchema,
|
|
635
|
-
verifiedAt:
|
|
636
|
-
revision:
|
|
669
|
+
verifiedAt: z5.number().int().nonnegative(),
|
|
670
|
+
revision: z5.number().int().positive()
|
|
637
671
|
}).strict();
|
|
638
|
-
var walletChallengeInputSchema =
|
|
639
|
-
chain:
|
|
672
|
+
var walletChallengeInputSchema = z5.object({
|
|
673
|
+
chain: z5.literal("solana"),
|
|
640
674
|
address: solanaAddressSchema
|
|
641
675
|
}).strict();
|
|
642
676
|
var walletChallengeSchema = walletChallengeInputSchema.extend({
|
|
643
|
-
id:
|
|
644
|
-
message:
|
|
645
|
-
expiresAt:
|
|
677
|
+
id: z5.string().uuid(),
|
|
678
|
+
message: z5.string(),
|
|
679
|
+
expiresAt: z5.number()
|
|
646
680
|
});
|
|
647
|
-
var walletProofSchema =
|
|
648
|
-
challenge:
|
|
649
|
-
signature:
|
|
681
|
+
var walletProofSchema = z5.object({
|
|
682
|
+
challenge: z5.string().uuid(),
|
|
683
|
+
signature: z5.string().min(64).max(88).regex(/^[1-9A-HJ-NP-Za-km-z]+$/)
|
|
650
684
|
}).strict();
|
|
651
|
-
var solanaBalanceSchema =
|
|
685
|
+
var solanaBalanceSchema = z5.object({
|
|
652
686
|
address: solanaAddressSchema,
|
|
653
|
-
network:
|
|
654
|
-
lamports:
|
|
655
|
-
slot:
|
|
656
|
-
observedAt:
|
|
687
|
+
network: z5.literal("mainnet-beta"),
|
|
688
|
+
lamports: z5.string().regex(/^(0|[1-9][0-9]*)$/),
|
|
689
|
+
slot: z5.number().int().nonnegative().safe(),
|
|
690
|
+
observedAt: z5.number().int().nonnegative()
|
|
657
691
|
}).strict();
|
|
658
692
|
|
|
659
693
|
// src/collection.ts
|
|
660
|
-
import { z as
|
|
661
|
-
var collectionCodeSchema =
|
|
662
|
-
var collectionPassSchema =
|
|
694
|
+
import { z as z6 } from "zod";
|
|
695
|
+
var collectionCodeSchema = z6.string().regex(/^relay:collect:[a-f0-9]{64}$/);
|
|
696
|
+
var collectionPassSchema = z6.object({
|
|
663
697
|
code: collectionCodeSchema,
|
|
664
|
-
expiresAt:
|
|
698
|
+
expiresAt: z6.number(),
|
|
665
699
|
entitlement: identifier
|
|
666
700
|
});
|
|
667
|
-
var collectionResolveSchema =
|
|
701
|
+
var collectionResolveSchema = z6.object({ code: collectionCodeSchema }).strict();
|
|
668
702
|
var collectionBeginSchema = collectionResolveSchema.extend({
|
|
669
703
|
actionId: identifier,
|
|
670
|
-
revision:
|
|
704
|
+
revision: z6.number().int().positive(),
|
|
671
705
|
selection: pickupSelectionSchema.optional()
|
|
672
706
|
});
|
|
673
|
-
var collectionPreviewSchema =
|
|
707
|
+
var collectionPreviewSchema = z6.object({
|
|
674
708
|
entitlement: entitlementSchema,
|
|
675
709
|
inventory: pickupAvailabilitySchema,
|
|
676
|
-
expiresAt:
|
|
710
|
+
expiresAt: z6.number()
|
|
677
711
|
});
|
|
678
712
|
|
|
679
713
|
// src/configuration.ts
|
|
@@ -691,53 +725,53 @@ function questConfiguration(release) {
|
|
|
691
725
|
}
|
|
692
726
|
|
|
693
727
|
// src/deployments.ts
|
|
694
|
-
import { z as
|
|
728
|
+
import { z as z7 } from "zod";
|
|
695
729
|
var projectCatalogArtifactSchema = catalogDeploymentSchema.omit({ expectedRevision: true }).extend({
|
|
696
|
-
referrals:
|
|
697
|
-
leaderboards:
|
|
730
|
+
referrals: z7.array(referralArtifactSchema).max(50).default([]),
|
|
731
|
+
leaderboards: z7.array(leaderboardArtifactSchema).max(50).default([])
|
|
698
732
|
});
|
|
699
|
-
var projectDeploymentSchema = projectCatalogArtifactSchema.extend({ releases:
|
|
733
|
+
var projectDeploymentSchema = projectCatalogArtifactSchema.extend({ releases: z7.array(releaseSchema).max(50).default([]) }).refine(
|
|
700
734
|
(value) => value.releases.length > 0 || value.leaderboards.length > 0 || value.referrals.length > 0 || value.types.length > 0 || value.collections.length > 0 || value.supportedInteractions !== void 0,
|
|
701
735
|
"No resources configured. Add quests, questTypes, leaderboards, collections, or supportedInteractions to relay.json."
|
|
702
736
|
);
|
|
703
|
-
var deploymentPreviewSchema =
|
|
737
|
+
var deploymentPreviewSchema = z7.object({
|
|
704
738
|
id: identifier,
|
|
705
|
-
baseRevision:
|
|
706
|
-
releases:
|
|
707
|
-
types:
|
|
708
|
-
collections:
|
|
709
|
-
supportedInteractions:
|
|
710
|
-
referrals:
|
|
711
|
-
leaderboards:
|
|
739
|
+
baseRevision: z7.number().int().nonnegative(),
|
|
740
|
+
releases: z7.array(publishedReleaseSchema),
|
|
741
|
+
types: z7.array(questTypeVersionSchema),
|
|
742
|
+
collections: z7.array(questCollectionSchema),
|
|
743
|
+
supportedInteractions: z7.array(interactionSchema),
|
|
744
|
+
referrals: z7.array(publishedReferralSchema).default([]),
|
|
745
|
+
leaderboards: z7.array(leaderboardPreviewSchema).default([])
|
|
712
746
|
});
|
|
713
|
-
var publishDeploymentSchema =
|
|
747
|
+
var publishDeploymentSchema = z7.object({ id: identifier }).strict();
|
|
714
748
|
var deploymentResultSchema = deploymentPreviewSchema.extend({
|
|
715
|
-
revision:
|
|
749
|
+
revision: z7.number().int().positive()
|
|
716
750
|
});
|
|
717
751
|
|
|
718
752
|
// src/identity-integration.ts
|
|
719
|
-
import { z as
|
|
720
|
-
var identityIntegrationInputSchema =
|
|
721
|
-
name:
|
|
722
|
-
origin:
|
|
753
|
+
import { z as z8 } from "zod";
|
|
754
|
+
var identityIntegrationInputSchema = z8.object({
|
|
755
|
+
name: z8.string().trim().min(1).max(80),
|
|
756
|
+
origin: z8.string().url().refine((value) => {
|
|
723
757
|
const url = new URL(value);
|
|
724
758
|
return url.protocol === "https:" && url.origin === value;
|
|
725
759
|
}, "Use an exact HTTPS application origin")
|
|
726
760
|
}).strict();
|
|
727
761
|
var identityIntegrationSchema = authScopeSchema.extend({
|
|
728
|
-
id:
|
|
729
|
-
name:
|
|
730
|
-
origin:
|
|
731
|
-
expiresAt:
|
|
762
|
+
id: z8.string().uuid(),
|
|
763
|
+
name: z8.string(),
|
|
764
|
+
origin: z8.string(),
|
|
765
|
+
expiresAt: z8.number()
|
|
732
766
|
});
|
|
733
767
|
var identityIntegrationSecretSchema = identityIntegrationSchema.extend(
|
|
734
768
|
{
|
|
735
|
-
token:
|
|
769
|
+
token: z8.string()
|
|
736
770
|
}
|
|
737
771
|
);
|
|
738
|
-
var participantExchangeSchema =
|
|
739
|
-
subject:
|
|
740
|
-
previousToken:
|
|
772
|
+
var participantExchangeSchema = z8.object({
|
|
773
|
+
subject: z8.string().min(1).max(200),
|
|
774
|
+
previousToken: z8.string().max(200).optional()
|
|
741
775
|
}).strict();
|
|
742
776
|
|
|
743
777
|
// src/index.ts
|
|
@@ -850,19 +884,19 @@ function createRelayClient(options) {
|
|
|
850
884
|
}
|
|
851
885
|
return {
|
|
852
886
|
referrals: {
|
|
853
|
-
list: () => request("/v1/referrals",
|
|
887
|
+
list: () => request("/v1/referrals", z9.array(referralDefinitionSchema)),
|
|
854
888
|
summary: () => request("/v1/referrals/me", referralSummarySchema),
|
|
855
889
|
history: (before) => request(
|
|
856
890
|
query("/v1/referrals/history", { before }),
|
|
857
891
|
referralHistorySchema
|
|
858
892
|
),
|
|
859
|
-
accept: (input) => request("/v1/referrals/accept",
|
|
893
|
+
accept: (input) => request("/v1/referrals/accept", z9.object({ ok: z9.literal(true) }), {
|
|
860
894
|
method: "POST",
|
|
861
895
|
body: JSON.stringify(referralAcceptSchema.parse(input))
|
|
862
896
|
})
|
|
863
897
|
},
|
|
864
898
|
leaderboards: {
|
|
865
|
-
list: () => request("/v1/leaderboards",
|
|
899
|
+
list: () => request("/v1/leaderboards", z9.array(leaderboardDefinitionSchema)),
|
|
866
900
|
standings: (board, options2 = {}) => {
|
|
867
901
|
const parsed = leaderboardQuerySchema.parse(options2);
|
|
868
902
|
return request(
|
|
@@ -874,6 +908,10 @@ function createRelayClient(options) {
|
|
|
874
908
|
quests: {
|
|
875
909
|
get: getQuest,
|
|
876
910
|
retry: async (view) => {
|
|
911
|
+
if (view.trigger.kind === "automatic")
|
|
912
|
+
throw new Error(
|
|
913
|
+
"Automatic quests recover without participant retries."
|
|
914
|
+
);
|
|
877
915
|
if (!view.attempt || view.attempt.status !== "failed")
|
|
878
916
|
throw new Error("There is no failed attempt to retry.");
|
|
879
917
|
const session = await request(
|
|
@@ -938,25 +976,25 @@ function createRelayClient(options) {
|
|
|
938
976
|
auth: {
|
|
939
977
|
providers: () => request(
|
|
940
978
|
"/v1/auth/providers",
|
|
941
|
-
|
|
942
|
-
providers:
|
|
943
|
-
|
|
979
|
+
z9.object({
|
|
980
|
+
providers: z9.array(
|
|
981
|
+
z9.object({
|
|
944
982
|
provider: authProviderSchema,
|
|
945
|
-
configured:
|
|
983
|
+
configured: z9.boolean()
|
|
946
984
|
})
|
|
947
985
|
),
|
|
948
|
-
email:
|
|
949
|
-
demo:
|
|
986
|
+
email: z9.boolean(),
|
|
987
|
+
demo: z9.boolean()
|
|
950
988
|
})
|
|
951
989
|
),
|
|
952
990
|
start: (provider, mode) => request(
|
|
953
991
|
"/v1/auth/start",
|
|
954
|
-
|
|
992
|
+
z9.object({ url: z9.string() }),
|
|
955
993
|
json({ provider, mode })
|
|
956
994
|
),
|
|
957
995
|
emailStart: (email) => request(
|
|
958
996
|
"/v1/auth/email/start",
|
|
959
|
-
|
|
997
|
+
z9.object({ challenge: z9.string() }),
|
|
960
998
|
json({ email })
|
|
961
999
|
),
|
|
962
1000
|
emailVerify: (challenge, code) => changeSession(
|
|
@@ -966,25 +1004,25 @@ function createRelayClient(options) {
|
|
|
966
1004
|
json({ challenge, code })
|
|
967
1005
|
)
|
|
968
1006
|
),
|
|
969
|
-
accounts: () => request("/v1/auth/accounts",
|
|
1007
|
+
accounts: () => request("/v1/auth/accounts", z9.array(accountConnectionSchema)),
|
|
970
1008
|
disconnect: (provider) => request(
|
|
971
1009
|
"/v1/auth/accounts/disconnect",
|
|
972
|
-
|
|
1010
|
+
z9.object({ ok: z9.boolean() }),
|
|
973
1011
|
json({ provider })
|
|
974
1012
|
),
|
|
975
1013
|
connections: () => request(
|
|
976
1014
|
"/v1/auth/connections",
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
provider:
|
|
980
|
-
subject:
|
|
981
|
-
signInEnabled:
|
|
1015
|
+
z9.array(
|
|
1016
|
+
z9.object({
|
|
1017
|
+
provider: z9.string(),
|
|
1018
|
+
subject: z9.string(),
|
|
1019
|
+
signInEnabled: z9.boolean()
|
|
982
1020
|
})
|
|
983
1021
|
)
|
|
984
1022
|
),
|
|
985
1023
|
session: () => request("/v1/auth/session", sessionSchema.nullable()),
|
|
986
1024
|
signOut: () => changeSession(
|
|
987
|
-
() => request("/v1/auth/logout",
|
|
1025
|
+
() => request("/v1/auth/logout", z9.object({ ok: z9.boolean() }), json({}))
|
|
988
1026
|
),
|
|
989
1027
|
/** Local development only. Existing hosted apps use createParticipantBackend from /portal-proxy. */
|
|
990
1028
|
exchange: (input) => request("/v1/auth/exchange", exchangeResultSchema, json(input))
|
|
@@ -1018,6 +1056,7 @@ function createRelayClient(options) {
|
|
|
1018
1056
|
}),
|
|
1019
1057
|
linkPass: (code) => request("/v1/me/pass", attemptSchema, json({ code })),
|
|
1020
1058
|
progress: () => request("/v1/me/progress", memberProgressSchema),
|
|
1059
|
+
rewardDeliveries: () => request("/v1/reward-deliveries", rewardDeliveriesSchema),
|
|
1021
1060
|
claim: (input, options2) => request("/v1/me/attempts", attemptSchema, {
|
|
1022
1061
|
...json(input),
|
|
1023
1062
|
headers: {
|
|
@@ -1059,16 +1098,16 @@ function createRelayClient(options) {
|
|
|
1059
1098
|
},
|
|
1060
1099
|
lookupMember: (issuer, subject) => request(
|
|
1061
1100
|
"/v1/members/lookup",
|
|
1062
|
-
|
|
1101
|
+
z9.object({ member: z9.string() }),
|
|
1063
1102
|
json({ issuer, subject })
|
|
1064
1103
|
),
|
|
1065
|
-
journeyTemplate: () => request("/v1/journey-template",
|
|
1104
|
+
journeyTemplate: () => request("/v1/journey-template", z9.array(templateSchema)),
|
|
1066
1105
|
template: () => request("/v1/template", templateSchema),
|
|
1067
1106
|
snapshot: () => request("/v1/snapshot", snapshotSchema),
|
|
1068
1107
|
publish: (release) => request("/v1/releases", publishedReleaseSchema, json(release)),
|
|
1069
1108
|
publishBatch: (releases) => request(
|
|
1070
1109
|
"/v1/releases/batch",
|
|
1071
|
-
|
|
1110
|
+
z9.array(publishedReleaseSchema),
|
|
1072
1111
|
json({ releases })
|
|
1073
1112
|
),
|
|
1074
1113
|
progress: (member) => request(
|
|
@@ -1093,6 +1132,9 @@ function createRelayClient(options) {
|
|
|
1093
1132
|
}
|
|
1094
1133
|
|
|
1095
1134
|
export {
|
|
1135
|
+
pointLedgerSchema,
|
|
1136
|
+
rewardDeliverySchema,
|
|
1137
|
+
rewardDeliveriesSchema,
|
|
1096
1138
|
resourceId,
|
|
1097
1139
|
interactionSchema,
|
|
1098
1140
|
questInteraction,
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
identifier,
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
pointsRewardSchema,
|
|
4
|
+
tierRewardSchema
|
|
5
|
+
} from "./chunk-6QUCADMF.js";
|
|
5
6
|
|
|
6
7
|
// src/referrals.ts
|
|
7
8
|
import { z } from "zod";
|
|
9
|
+
var rewardSchema = z.union([pointsRewardSchema, tierRewardSchema]);
|
|
8
10
|
var amount = z.number().int().safe().nonnegative();
|
|
9
11
|
var reason = z.string().trim().min(1).max(1e3);
|
|
10
12
|
var referralDefinitionSchema = z.object({
|