@domino-sdk/relay 0.6.0 → 0.8.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 +18 -9
- package/dist/authoring.js +19 -9
- package/dist/browser.d.ts +91 -37
- package/dist/browser.js +4 -4
- package/dist/{chunk-PLO5PPLU.js → chunk-2BN7XZH3.js} +1 -1
- package/dist/{chunk-CCLIDCUU.js → chunk-APMYDKEX.js} +211 -189
- package/dist/chunk-XVHWBZRG.js +388 -0
- package/dist/{chunk-MXK7KEDA.js → chunk-Z43O273V.js} +45 -3
- package/dist/index.d.ts +982 -128
- package/dist/index.js +28 -6
- package/dist/portal-proxy.js +2 -2
- package/dist/schema.d.ts +63 -2
- package/dist/schema.js +5 -1
- package/dist/{settings-BrC6C9yl.d.ts → settings-BA8XjT4m.d.ts} +779 -23
- package/package.json +1 -1
- package/dist/chunk-UIC6OF3C.js +0 -337
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
|
+
authoringIdentityShape,
|
|
2
3
|
leaderboardArtifactSchema,
|
|
3
4
|
leaderboardDefinitionSchema,
|
|
4
5
|
leaderboardPageSchema,
|
|
5
6
|
leaderboardPreviewSchema,
|
|
6
7
|
leaderboardQuerySchema,
|
|
8
|
+
normalizeAuthoringIdentity,
|
|
7
9
|
publishedReferralSchema,
|
|
8
10
|
referralAcceptSchema,
|
|
9
11
|
referralArtifactSchema,
|
|
10
12
|
referralDefinitionSchema,
|
|
11
13
|
referralHistorySchema,
|
|
12
|
-
referralSummarySchema
|
|
13
|
-
|
|
14
|
+
referralSummarySchema,
|
|
15
|
+
validateAuthoringIdentity
|
|
16
|
+
} from "./chunk-XVHWBZRG.js";
|
|
14
17
|
import {
|
|
15
18
|
authScopeSchema,
|
|
16
19
|
exchangeResultSchema,
|
|
17
20
|
sessionSchema
|
|
18
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-2BN7XZH3.js";
|
|
19
22
|
import {
|
|
20
23
|
accountConnectionSchema,
|
|
21
24
|
attemptSchema,
|
|
@@ -39,45 +42,44 @@ import {
|
|
|
39
42
|
settingsValuesSchema,
|
|
40
43
|
snapshotSchema,
|
|
41
44
|
templateSchema
|
|
42
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-Z43O273V.js";
|
|
43
46
|
|
|
44
|
-
// src/
|
|
47
|
+
// src/point-ledgers.ts
|
|
45
48
|
import { z } from "zod";
|
|
46
|
-
var
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
roleId: z.string(),
|
|
54
|
-
status: z.enum(["pending", "delivered"]),
|
|
55
|
-
attempts: z.number().int(),
|
|
56
|
-
nextAt: z.number(),
|
|
57
|
-
lastError: z.string().nullable(),
|
|
58
|
-
createdAt: z.number(),
|
|
59
|
-
deliveredAt: z.number().nullable()
|
|
60
|
-
});
|
|
61
|
-
var rewardDeliveriesSchema = z.object({
|
|
62
|
-
deliveries: z.array(rewardDeliverySchema)
|
|
49
|
+
var pointLedgerPropertiesSchema = z.object({
|
|
50
|
+
name: z.string().trim().min(1).max(120),
|
|
51
|
+
description: z.string().trim().max(1e3).default("")
|
|
52
|
+
}).strict();
|
|
53
|
+
var createPointLedgerSchema = pointLedgerPropertiesSchema.extend({ actionId: identifier, key: identifier.optional() }).strict();
|
|
54
|
+
var pointLedgerSchema = pointLedgerPropertiesSchema.extend({
|
|
55
|
+
id: identifier
|
|
63
56
|
});
|
|
57
|
+
var pointLedgerDeclarationSchema = pointLedgerPropertiesSchema.extend({ key: identifier }).strict();
|
|
64
58
|
|
|
65
|
-
// src/
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
59
|
+
// src/reward-deliveries.ts
|
|
60
|
+
import { z as z2 } from "zod";
|
|
61
|
+
var rewardDeliverySchema = z2.object({
|
|
62
|
+
id: z2.string(),
|
|
63
|
+
quest: z2.string(),
|
|
64
|
+
completion: z2.string(),
|
|
65
|
+
member: z2.string(),
|
|
66
|
+
provider: z2.literal("discord"),
|
|
67
|
+
action: z2.literal("grant-role"),
|
|
68
|
+
roleId: z2.string(),
|
|
69
|
+
status: z2.enum(["pending", "delivered"]),
|
|
70
|
+
attempts: z2.number().int(),
|
|
71
|
+
nextAt: z2.number(),
|
|
72
|
+
lastError: z2.string().nullable(),
|
|
73
|
+
createdAt: z2.number(),
|
|
74
|
+
deliveredAt: z2.number().nullable()
|
|
75
|
+
});
|
|
76
|
+
var rewardDeliveriesSchema = z2.object({
|
|
77
|
+
deliveries: z2.array(rewardDeliverySchema)
|
|
78
|
+
});
|
|
77
79
|
|
|
78
80
|
// src/catalog.ts
|
|
79
|
-
import { z as
|
|
80
|
-
var interactionSchema =
|
|
81
|
+
import { z as z3 } from "zod";
|
|
82
|
+
var interactionSchema = z3.enum([
|
|
81
83
|
"photo",
|
|
82
84
|
"quiz",
|
|
83
85
|
"claim",
|
|
@@ -87,104 +89,114 @@ var interactionSchema = z2.enum([
|
|
|
87
89
|
function questInteraction(trigger) {
|
|
88
90
|
return trigger.kind === "automatic" ? "automatic" : trigger.actor === "staff" ? "staff" : trigger.input === "none" ? "claim" : trigger.input;
|
|
89
91
|
}
|
|
90
|
-
var questTypeVersionSchema =
|
|
92
|
+
var questTypeVersionSchema = z3.object({
|
|
93
|
+
key: identifier.optional(),
|
|
91
94
|
id: identifier,
|
|
92
95
|
version: identifier,
|
|
93
|
-
code:
|
|
96
|
+
code: z3.string(),
|
|
94
97
|
definition: questDescriptionSchema,
|
|
95
98
|
provider: reviewModeSchema,
|
|
96
|
-
createdAt:
|
|
99
|
+
createdAt: z3.number()
|
|
97
100
|
});
|
|
98
|
-
var collectionSlotSchema =
|
|
101
|
+
var collectionSlotSchema = z3.object({
|
|
102
|
+
id: identifier,
|
|
103
|
+
key: identifier.optional(),
|
|
104
|
+
title: z3.string().trim().min(1).max(120)
|
|
105
|
+
}).strict();
|
|
106
|
+
var collectionSlotDeclarationSchema = collectionSlotSchema.omit({ id: true }).extend(authoringIdentityShape).strict().superRefine(validateAuthoringIdentity).transform(normalizeAuthoringIdentity);
|
|
99
107
|
var questCollectionSchema = collectionSlotSchema.extend({
|
|
100
|
-
quests:
|
|
108
|
+
quests: z3.array(identifier).max(100).refine(
|
|
101
109
|
(v) => new Set(v).size === v.length,
|
|
102
110
|
"A collection can contain a quest only once"
|
|
103
111
|
)
|
|
104
112
|
});
|
|
105
|
-
var questInstanceSchema =
|
|
113
|
+
var questInstanceSchema = z3.object({
|
|
106
114
|
id: identifier,
|
|
107
|
-
title:
|
|
115
|
+
title: z3.string().trim().min(1).max(120),
|
|
108
116
|
typeVersion: identifier,
|
|
109
117
|
settings: settingsValuesSchema,
|
|
110
|
-
requires:
|
|
111
|
-
status:
|
|
118
|
+
requires: z3.array(identifier).max(30),
|
|
119
|
+
status: z3.enum(["active", "paused", "archived"])
|
|
112
120
|
}).strict();
|
|
113
|
-
var questDraftChangesSchema =
|
|
114
|
-
quests:
|
|
121
|
+
var questDraftChangesSchema = z3.object({
|
|
122
|
+
quests: z3.array(
|
|
115
123
|
questInstanceSchema.extend({ expectedRelease: identifier.nullable() })
|
|
116
124
|
).max(50),
|
|
117
|
-
collections:
|
|
125
|
+
collections: z3.array(questCollectionSchema).max(50)
|
|
118
126
|
}).strict();
|
|
119
|
-
var draftBase =
|
|
127
|
+
var draftBase = z3.object({
|
|
120
128
|
id: identifier,
|
|
121
|
-
revision:
|
|
122
|
-
baseRevision:
|
|
129
|
+
revision: z3.number().int().positive(),
|
|
130
|
+
baseRevision: z3.number().int().nonnegative(),
|
|
123
131
|
changes: questDraftChangesSchema
|
|
124
132
|
});
|
|
125
|
-
var questDraftSchema =
|
|
126
|
-
draftBase.extend({ status:
|
|
133
|
+
var questDraftSchema = z3.discriminatedUnion("status", [
|
|
134
|
+
draftBase.extend({ status: z3.literal("draft") }),
|
|
127
135
|
draftBase.extend({
|
|
128
|
-
status:
|
|
129
|
-
releaseIds:
|
|
136
|
+
status: z3.literal("published"),
|
|
137
|
+
releaseIds: z3.array(identifier)
|
|
130
138
|
})
|
|
131
139
|
]);
|
|
132
|
-
var questCatalogSchema =
|
|
133
|
-
revision:
|
|
134
|
-
types:
|
|
135
|
-
collections:
|
|
136
|
-
quests:
|
|
137
|
-
drafts:
|
|
138
|
-
releases:
|
|
139
|
-
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)
|
|
140
148
|
});
|
|
141
|
-
var catalogDeploymentSchema =
|
|
142
|
-
expectedRevision:
|
|
143
|
-
types:
|
|
144
|
-
|
|
145
|
-
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),
|
|
146
154
|
provider: reviewModeSchema
|
|
147
155
|
})
|
|
148
156
|
).max(50).default([]),
|
|
149
|
-
collections:
|
|
150
|
-
supportedInteractions:
|
|
157
|
+
collections: z3.array(collectionSlotDeclarationSchema).max(50).default([]),
|
|
158
|
+
supportedInteractions: z3.array(interactionSchema).min(1).optional()
|
|
151
159
|
}).strict();
|
|
152
|
-
var catalogDeploymentPreviewSchema =
|
|
153
|
-
revision:
|
|
154
|
-
types:
|
|
155
|
-
collections:
|
|
156
|
-
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)
|
|
157
165
|
});
|
|
158
|
-
var saveQuestDraftSchema =
|
|
159
|
-
id: identifier,
|
|
160
|
-
|
|
161
|
-
|
|
166
|
+
var saveQuestDraftSchema = z3.object({
|
|
167
|
+
id: identifier.optional(),
|
|
168
|
+
actionId: identifier,
|
|
169
|
+
expectedRevision: z3.number().int().nonnegative(),
|
|
170
|
+
baseRevision: z3.number().int().nonnegative(),
|
|
162
171
|
changes: questDraftChangesSchema
|
|
163
172
|
}).strict();
|
|
164
|
-
var publishQuestDraftSchema =
|
|
173
|
+
var publishQuestDraftSchema = z3.object({ id: identifier, expectedRevision: z3.number().int().positive() }).strict();
|
|
165
174
|
var questViewSchema = memberProgressSchema.shape.quests.element.extend(
|
|
166
175
|
{
|
|
167
176
|
release: identifier,
|
|
168
177
|
interaction: interactionSchema,
|
|
169
|
-
lifecycle:
|
|
170
|
-
rewards:
|
|
178
|
+
lifecycle: z3.enum(["active", "paused", "archived"]),
|
|
179
|
+
rewards: z3.array(z3.object({ label: z3.string() }))
|
|
171
180
|
}
|
|
172
181
|
);
|
|
173
|
-
var collectionViewSchema =
|
|
182
|
+
var collectionViewSchema = z3.object({
|
|
183
|
+
key: identifier.optional(),
|
|
174
184
|
id: identifier,
|
|
175
|
-
title:
|
|
176
|
-
quests:
|
|
185
|
+
title: z3.string(),
|
|
186
|
+
quests: z3.array(questViewSchema)
|
|
177
187
|
});
|
|
178
|
-
var questExperienceSchema =
|
|
188
|
+
var questExperienceSchema = z3.object({
|
|
179
189
|
member: identifier,
|
|
180
|
-
quests:
|
|
181
|
-
collections:
|
|
190
|
+
quests: z3.array(questViewSchema),
|
|
191
|
+
collections: z3.array(collectionViewSchema)
|
|
182
192
|
});
|
|
183
|
-
var questPublicationPreviewSchema =
|
|
193
|
+
var questPublicationPreviewSchema = z3.object({
|
|
184
194
|
draft: questDraftSchema,
|
|
185
|
-
releases:
|
|
186
|
-
affectedCollections:
|
|
195
|
+
releases: z3.array(publishedReleaseSchema),
|
|
196
|
+
affectedCollections: z3.array(questCollectionSchema)
|
|
187
197
|
});
|
|
198
|
+
var allocateQuestSchema = z3.object({ actionId: identifier }).strict();
|
|
199
|
+
var allocatedQuestSchema = z3.object({ id: identifier });
|
|
188
200
|
|
|
189
201
|
// src/errors.ts
|
|
190
202
|
var RelayError = class extends Error {
|
|
@@ -200,43 +212,43 @@ var RelayError = class extends Error {
|
|
|
200
212
|
};
|
|
201
213
|
|
|
202
214
|
// src/submissions.ts
|
|
203
|
-
import { z as
|
|
215
|
+
import { z as z4 } from "zod";
|
|
204
216
|
var common = {
|
|
205
217
|
id: identifier,
|
|
206
218
|
quest: identifier,
|
|
207
219
|
release: identifier.optional()
|
|
208
220
|
};
|
|
209
|
-
var claimInputSchema =
|
|
221
|
+
var claimInputSchema = z4.union([
|
|
210
222
|
quizEvidenceSchema,
|
|
211
|
-
|
|
223
|
+
z4.object({ kind: z4.literal("none") }).strict()
|
|
212
224
|
]);
|
|
213
|
-
var draftSchema =
|
|
225
|
+
var draftSchema = z4.union([
|
|
214
226
|
claimInputSchema,
|
|
215
|
-
|
|
227
|
+
z4.object({ kind: z4.literal("photo"), file: z4.instanceof(Blob) })
|
|
216
228
|
]);
|
|
217
|
-
var recordSchema =
|
|
218
|
-
|
|
229
|
+
var recordSchema = z4.union([
|
|
230
|
+
z4.object({
|
|
219
231
|
...common,
|
|
220
|
-
stage:
|
|
232
|
+
stage: z4.literal("review"),
|
|
221
233
|
draft: draftSchema.nullable()
|
|
222
234
|
}),
|
|
223
|
-
|
|
224
|
-
|
|
235
|
+
z4.object({ ...common, stage: z4.literal("upload"), file: z4.instanceof(Blob) }),
|
|
236
|
+
z4.object({
|
|
225
237
|
...common,
|
|
226
|
-
stage:
|
|
238
|
+
stage: z4.literal("claim"),
|
|
227
239
|
evidence: identifier,
|
|
228
|
-
file:
|
|
240
|
+
file: z4.instanceof(Blob).optional()
|
|
229
241
|
}),
|
|
230
|
-
|
|
242
|
+
z4.object({
|
|
231
243
|
...common,
|
|
232
|
-
stage:
|
|
244
|
+
stage: z4.literal("submitted"),
|
|
233
245
|
evidence: identifier,
|
|
234
246
|
attempt: identifier
|
|
235
247
|
}),
|
|
236
|
-
|
|
237
|
-
|
|
248
|
+
z4.object({ ...common, stage: z4.literal("claim"), input: claimInputSchema }),
|
|
249
|
+
z4.object({
|
|
238
250
|
...common,
|
|
239
|
-
stage:
|
|
251
|
+
stage: z4.literal("submitted"),
|
|
240
252
|
input: claimInputSchema,
|
|
241
253
|
attempt: identifier
|
|
242
254
|
})
|
|
@@ -650,56 +662,56 @@ function observeProgress(transport, listener, options = {}, onDispose = () => {
|
|
|
650
662
|
}
|
|
651
663
|
|
|
652
664
|
// src/index.ts
|
|
653
|
-
import { z as
|
|
665
|
+
import { z as z9 } from "zod";
|
|
654
666
|
|
|
655
667
|
// src/wallet.ts
|
|
656
|
-
import { z as
|
|
657
|
-
var solanaAddressSchema =
|
|
658
|
-
var walletConnectionSchema =
|
|
659
|
-
chain:
|
|
668
|
+
import { z as z5 } from "zod";
|
|
669
|
+
var solanaAddressSchema = z5.string().min(32).max(44).regex(/^[1-9A-HJ-NP-Za-km-z]+$/);
|
|
670
|
+
var walletConnectionSchema = z5.object({
|
|
671
|
+
chain: z5.literal("solana"),
|
|
660
672
|
address: solanaAddressSchema,
|
|
661
|
-
verifiedAt:
|
|
662
|
-
revision:
|
|
673
|
+
verifiedAt: z5.number().int().nonnegative(),
|
|
674
|
+
revision: z5.number().int().positive()
|
|
663
675
|
}).strict();
|
|
664
|
-
var walletChallengeInputSchema =
|
|
665
|
-
chain:
|
|
676
|
+
var walletChallengeInputSchema = z5.object({
|
|
677
|
+
chain: z5.literal("solana"),
|
|
666
678
|
address: solanaAddressSchema
|
|
667
679
|
}).strict();
|
|
668
680
|
var walletChallengeSchema = walletChallengeInputSchema.extend({
|
|
669
|
-
id:
|
|
670
|
-
message:
|
|
671
|
-
expiresAt:
|
|
681
|
+
id: z5.string().uuid(),
|
|
682
|
+
message: z5.string(),
|
|
683
|
+
expiresAt: z5.number()
|
|
672
684
|
});
|
|
673
|
-
var walletProofSchema =
|
|
674
|
-
challenge:
|
|
675
|
-
signature:
|
|
685
|
+
var walletProofSchema = z5.object({
|
|
686
|
+
challenge: z5.string().uuid(),
|
|
687
|
+
signature: z5.string().min(64).max(88).regex(/^[1-9A-HJ-NP-Za-km-z]+$/)
|
|
676
688
|
}).strict();
|
|
677
|
-
var solanaBalanceSchema =
|
|
689
|
+
var solanaBalanceSchema = z5.object({
|
|
678
690
|
address: solanaAddressSchema,
|
|
679
|
-
network:
|
|
680
|
-
lamports:
|
|
681
|
-
slot:
|
|
682
|
-
observedAt:
|
|
691
|
+
network: z5.literal("mainnet-beta"),
|
|
692
|
+
lamports: z5.string().regex(/^(0|[1-9][0-9]*)$/),
|
|
693
|
+
slot: z5.number().int().nonnegative().safe(),
|
|
694
|
+
observedAt: z5.number().int().nonnegative()
|
|
683
695
|
}).strict();
|
|
684
696
|
|
|
685
697
|
// src/collection.ts
|
|
686
|
-
import { z as
|
|
687
|
-
var collectionCodeSchema =
|
|
688
|
-
var collectionPassSchema =
|
|
698
|
+
import { z as z6 } from "zod";
|
|
699
|
+
var collectionCodeSchema = z6.string().regex(/^relay:collect:[a-f0-9]{64}$/);
|
|
700
|
+
var collectionPassSchema = z6.object({
|
|
689
701
|
code: collectionCodeSchema,
|
|
690
|
-
expiresAt:
|
|
702
|
+
expiresAt: z6.number(),
|
|
691
703
|
entitlement: identifier
|
|
692
704
|
});
|
|
693
|
-
var collectionResolveSchema =
|
|
705
|
+
var collectionResolveSchema = z6.object({ code: collectionCodeSchema }).strict();
|
|
694
706
|
var collectionBeginSchema = collectionResolveSchema.extend({
|
|
695
707
|
actionId: identifier,
|
|
696
|
-
revision:
|
|
708
|
+
revision: z6.number().int().positive(),
|
|
697
709
|
selection: pickupSelectionSchema.optional()
|
|
698
710
|
});
|
|
699
|
-
var collectionPreviewSchema =
|
|
711
|
+
var collectionPreviewSchema = z6.object({
|
|
700
712
|
entitlement: entitlementSchema,
|
|
701
713
|
inventory: pickupAvailabilitySchema,
|
|
702
|
-
expiresAt:
|
|
714
|
+
expiresAt: z6.number()
|
|
703
715
|
});
|
|
704
716
|
|
|
705
717
|
// src/configuration.ts
|
|
@@ -717,53 +729,55 @@ function questConfiguration(release) {
|
|
|
717
729
|
}
|
|
718
730
|
|
|
719
731
|
// src/deployments.ts
|
|
720
|
-
import { z as
|
|
732
|
+
import { z as z7 } from "zod";
|
|
721
733
|
var projectCatalogArtifactSchema = catalogDeploymentSchema.omit({ expectedRevision: true }).extend({
|
|
722
|
-
|
|
723
|
-
|
|
734
|
+
pointLedgers: z7.array(pointLedgerDeclarationSchema).max(50).default([]),
|
|
735
|
+
referrals: z7.array(referralArtifactSchema).max(50).default([]),
|
|
736
|
+
leaderboards: z7.array(leaderboardArtifactSchema).max(50).default([])
|
|
724
737
|
});
|
|
725
|
-
var projectDeploymentSchema = projectCatalogArtifactSchema.extend({ releases:
|
|
726
|
-
(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,
|
|
727
|
-
"No resources configured. Add quests, questTypes, leaderboards, collections, or supportedInteractions to relay.json."
|
|
738
|
+
var projectDeploymentSchema = projectCatalogArtifactSchema.extend({ releases: z7.array(releaseSchema).max(50).default([]) }).refine(
|
|
739
|
+
(value) => value.pointLedgers.length > 0 || value.releases.length > 0 || value.leaderboards.length > 0 || value.referrals.length > 0 || value.types.length > 0 || value.collections.length > 0 || value.supportedInteractions !== void 0,
|
|
740
|
+
"No resources configured. Add quests, questTypes, pointLedgers, leaderboards, referrals, collections, or supportedInteractions to relay.json."
|
|
728
741
|
);
|
|
729
|
-
var deploymentPreviewSchema =
|
|
742
|
+
var deploymentPreviewSchema = z7.object({
|
|
730
743
|
id: identifier,
|
|
731
|
-
baseRevision:
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
744
|
+
baseRevision: z7.number().int().nonnegative(),
|
|
745
|
+
pointLedgers: z7.array(pointLedgerSchema).default([]),
|
|
746
|
+
releases: z7.array(publishedReleaseSchema),
|
|
747
|
+
types: z7.array(questTypeVersionSchema),
|
|
748
|
+
collections: z7.array(questCollectionSchema),
|
|
749
|
+
supportedInteractions: z7.array(interactionSchema),
|
|
750
|
+
referrals: z7.array(publishedReferralSchema).default([]),
|
|
751
|
+
leaderboards: z7.array(leaderboardPreviewSchema).default([])
|
|
738
752
|
});
|
|
739
|
-
var publishDeploymentSchema =
|
|
753
|
+
var publishDeploymentSchema = z7.object({ id: identifier }).strict();
|
|
740
754
|
var deploymentResultSchema = deploymentPreviewSchema.extend({
|
|
741
|
-
revision:
|
|
755
|
+
revision: z7.number().int().positive()
|
|
742
756
|
});
|
|
743
757
|
|
|
744
758
|
// src/identity-integration.ts
|
|
745
|
-
import { z as
|
|
746
|
-
var identityIntegrationInputSchema =
|
|
747
|
-
name:
|
|
748
|
-
origin:
|
|
759
|
+
import { z as z8 } from "zod";
|
|
760
|
+
var identityIntegrationInputSchema = z8.object({
|
|
761
|
+
name: z8.string().trim().min(1).max(80),
|
|
762
|
+
origin: z8.string().url().refine((value) => {
|
|
749
763
|
const url = new URL(value);
|
|
750
764
|
return url.protocol === "https:" && url.origin === value;
|
|
751
765
|
}, "Use an exact HTTPS application origin")
|
|
752
766
|
}).strict();
|
|
753
767
|
var identityIntegrationSchema = authScopeSchema.extend({
|
|
754
|
-
id:
|
|
755
|
-
name:
|
|
756
|
-
origin:
|
|
757
|
-
expiresAt:
|
|
768
|
+
id: z8.string().uuid(),
|
|
769
|
+
name: z8.string(),
|
|
770
|
+
origin: z8.string(),
|
|
771
|
+
expiresAt: z8.number()
|
|
758
772
|
});
|
|
759
773
|
var identityIntegrationSecretSchema = identityIntegrationSchema.extend(
|
|
760
774
|
{
|
|
761
|
-
token:
|
|
775
|
+
token: z8.string()
|
|
762
776
|
}
|
|
763
777
|
);
|
|
764
|
-
var participantExchangeSchema =
|
|
765
|
-
subject:
|
|
766
|
-
previousToken:
|
|
778
|
+
var participantExchangeSchema = z8.object({
|
|
779
|
+
subject: z8.string().min(1).max(200),
|
|
780
|
+
previousToken: z8.string().max(200).optional()
|
|
767
781
|
}).strict();
|
|
768
782
|
|
|
769
783
|
// src/index.ts
|
|
@@ -870,25 +884,27 @@ function createRelayClient(options) {
|
|
|
870
884
|
}
|
|
871
885
|
const experience = () => request("/v1/me/experience", questExperienceSchema);
|
|
872
886
|
async function getQuest(id) {
|
|
873
|
-
const quest = (await experience()).quests.find(
|
|
887
|
+
const quest = (await experience()).quests.find(
|
|
888
|
+
(q) => q.quest === id || q.key === id
|
|
889
|
+
);
|
|
874
890
|
if (!quest) throw new RelayError("Quest not found", 404);
|
|
875
891
|
return quest;
|
|
876
892
|
}
|
|
877
893
|
return {
|
|
878
894
|
referrals: {
|
|
879
|
-
list: () => request("/v1/referrals",
|
|
895
|
+
list: () => request("/v1/referrals", z9.array(referralDefinitionSchema)),
|
|
880
896
|
summary: () => request("/v1/referrals/me", referralSummarySchema),
|
|
881
897
|
history: (before) => request(
|
|
882
898
|
query("/v1/referrals/history", { before }),
|
|
883
899
|
referralHistorySchema
|
|
884
900
|
),
|
|
885
|
-
accept: (input) => request("/v1/referrals/accept",
|
|
901
|
+
accept: (input) => request("/v1/referrals/accept", z9.object({ ok: z9.literal(true) }), {
|
|
886
902
|
method: "POST",
|
|
887
903
|
body: JSON.stringify(referralAcceptSchema.parse(input))
|
|
888
904
|
})
|
|
889
905
|
},
|
|
890
906
|
leaderboards: {
|
|
891
|
-
list: () => request("/v1/leaderboards",
|
|
907
|
+
list: () => request("/v1/leaderboards", z9.array(leaderboardDefinitionSchema)),
|
|
892
908
|
standings: (board, options2 = {}) => {
|
|
893
909
|
const parsed = leaderboardQuerySchema.parse(options2);
|
|
894
910
|
return request(
|
|
@@ -923,7 +939,7 @@ function createRelayClient(options) {
|
|
|
923
939
|
experience,
|
|
924
940
|
collection: async (id) => {
|
|
925
941
|
const collection = (await experience()).collections.find(
|
|
926
|
-
(c) => c.id === id
|
|
942
|
+
(c) => c.id === id || c.key === id
|
|
927
943
|
);
|
|
928
944
|
if (!collection) throw new RelayError("Collection not found", 404);
|
|
929
945
|
return collection;
|
|
@@ -968,25 +984,25 @@ function createRelayClient(options) {
|
|
|
968
984
|
auth: {
|
|
969
985
|
providers: () => request(
|
|
970
986
|
"/v1/auth/providers",
|
|
971
|
-
|
|
972
|
-
providers:
|
|
973
|
-
|
|
987
|
+
z9.object({
|
|
988
|
+
providers: z9.array(
|
|
989
|
+
z9.object({
|
|
974
990
|
provider: authProviderSchema,
|
|
975
|
-
configured:
|
|
991
|
+
configured: z9.boolean()
|
|
976
992
|
})
|
|
977
993
|
),
|
|
978
|
-
email:
|
|
979
|
-
demo:
|
|
994
|
+
email: z9.boolean(),
|
|
995
|
+
demo: z9.boolean()
|
|
980
996
|
})
|
|
981
997
|
),
|
|
982
998
|
start: (provider, mode) => request(
|
|
983
999
|
"/v1/auth/start",
|
|
984
|
-
|
|
1000
|
+
z9.object({ url: z9.string() }),
|
|
985
1001
|
json({ provider, mode })
|
|
986
1002
|
),
|
|
987
1003
|
emailStart: (email) => request(
|
|
988
1004
|
"/v1/auth/email/start",
|
|
989
|
-
|
|
1005
|
+
z9.object({ challenge: z9.string() }),
|
|
990
1006
|
json({ email })
|
|
991
1007
|
),
|
|
992
1008
|
emailVerify: (challenge, code) => changeSession(
|
|
@@ -996,25 +1012,25 @@ function createRelayClient(options) {
|
|
|
996
1012
|
json({ challenge, code })
|
|
997
1013
|
)
|
|
998
1014
|
),
|
|
999
|
-
accounts: () => request("/v1/auth/accounts",
|
|
1015
|
+
accounts: () => request("/v1/auth/accounts", z9.array(accountConnectionSchema)),
|
|
1000
1016
|
disconnect: (provider) => request(
|
|
1001
1017
|
"/v1/auth/accounts/disconnect",
|
|
1002
|
-
|
|
1018
|
+
z9.object({ ok: z9.boolean() }),
|
|
1003
1019
|
json({ provider })
|
|
1004
1020
|
),
|
|
1005
1021
|
connections: () => request(
|
|
1006
1022
|
"/v1/auth/connections",
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
provider:
|
|
1010
|
-
subject:
|
|
1011
|
-
signInEnabled:
|
|
1023
|
+
z9.array(
|
|
1024
|
+
z9.object({
|
|
1025
|
+
provider: z9.string(),
|
|
1026
|
+
subject: z9.string(),
|
|
1027
|
+
signInEnabled: z9.boolean()
|
|
1012
1028
|
})
|
|
1013
1029
|
)
|
|
1014
1030
|
),
|
|
1015
1031
|
session: () => request("/v1/auth/session", sessionSchema.nullable()),
|
|
1016
1032
|
signOut: () => changeSession(
|
|
1017
|
-
() => request("/v1/auth/logout",
|
|
1033
|
+
() => request("/v1/auth/logout", z9.object({ ok: z9.boolean() }), json({}))
|
|
1018
1034
|
),
|
|
1019
1035
|
/** Local development only. Existing hosted apps use createParticipantBackend from /portal-proxy. */
|
|
1020
1036
|
exchange: (input) => request("/v1/auth/exchange", exchangeResultSchema, json(input))
|
|
@@ -1090,16 +1106,16 @@ function createRelayClient(options) {
|
|
|
1090
1106
|
},
|
|
1091
1107
|
lookupMember: (issuer, subject) => request(
|
|
1092
1108
|
"/v1/members/lookup",
|
|
1093
|
-
|
|
1109
|
+
z9.object({ member: z9.string() }),
|
|
1094
1110
|
json({ issuer, subject })
|
|
1095
1111
|
),
|
|
1096
|
-
journeyTemplate: () => request("/v1/journey-template",
|
|
1112
|
+
journeyTemplate: () => request("/v1/journey-template", z9.array(templateSchema)),
|
|
1097
1113
|
template: () => request("/v1/template", templateSchema),
|
|
1098
1114
|
snapshot: () => request("/v1/snapshot", snapshotSchema),
|
|
1099
1115
|
publish: (release) => request("/v1/releases", publishedReleaseSchema, json(release)),
|
|
1100
1116
|
publishBatch: (releases) => request(
|
|
1101
1117
|
"/v1/releases/batch",
|
|
1102
|
-
|
|
1118
|
+
z9.array(publishedReleaseSchema),
|
|
1103
1119
|
json({ releases })
|
|
1104
1120
|
),
|
|
1105
1121
|
progress: (member) => request(
|
|
@@ -1124,13 +1140,17 @@ function createRelayClient(options) {
|
|
|
1124
1140
|
}
|
|
1125
1141
|
|
|
1126
1142
|
export {
|
|
1143
|
+
pointLedgerPropertiesSchema,
|
|
1144
|
+
createPointLedgerSchema,
|
|
1145
|
+
pointLedgerSchema,
|
|
1146
|
+
pointLedgerDeclarationSchema,
|
|
1127
1147
|
rewardDeliverySchema,
|
|
1128
1148
|
rewardDeliveriesSchema,
|
|
1129
|
-
resourceId,
|
|
1130
1149
|
interactionSchema,
|
|
1131
1150
|
questInteraction,
|
|
1132
1151
|
questTypeVersionSchema,
|
|
1133
1152
|
collectionSlotSchema,
|
|
1153
|
+
collectionSlotDeclarationSchema,
|
|
1134
1154
|
questCollectionSchema,
|
|
1135
1155
|
questInstanceSchema,
|
|
1136
1156
|
questDraftChangesSchema,
|
|
@@ -1144,6 +1164,8 @@ export {
|
|
|
1144
1164
|
collectionViewSchema,
|
|
1145
1165
|
questExperienceSchema,
|
|
1146
1166
|
questPublicationPreviewSchema,
|
|
1167
|
+
allocateQuestSchema,
|
|
1168
|
+
allocatedQuestSchema,
|
|
1147
1169
|
RelayError,
|
|
1148
1170
|
QuestUpdatedError,
|
|
1149
1171
|
reconcileQuestDraft,
|