@domino-sdk/relay 0.3.0 → 0.4.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/build.mjs +3 -1
- package/dist/authoring.d.ts +7 -2
- package/dist/authoring.js +10 -2
- package/dist/browser.d.ts +330 -2
- package/dist/browser.js +4 -3
- package/dist/chunk-3IQ4KUKF.js +613 -0
- package/dist/{chunk-L757OYXZ.js → chunk-KQVL6MOH.js} +78 -9
- package/dist/{chunk-6IXQRMGW.js → chunk-QWRSUSNB.js} +1 -1
- package/dist/chunk-TXL43HL3.js +335 -0
- package/dist/index.d.ts +1242 -49
- package/dist/index.js +73 -3
- package/dist/portal-proxy.js +10 -8
- package/dist/schema.d.ts +20 -0
- package/dist/schema.js +1 -1
- package/dist/settings-B7vsT8nd.d.ts +1383 -0
- package/package.json +1 -1
- package/dist/chunk-C2KOMNLG.js +0 -570
- package/dist/settings-BEbCiuhH.d.ts +0 -195
|
@@ -1,10 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
leaderboardArtifactSchema,
|
|
3
|
+
leaderboardDefinitionSchema,
|
|
4
|
+
leaderboardPageSchema,
|
|
5
|
+
leaderboardPreviewSchema,
|
|
6
|
+
leaderboardQuerySchema,
|
|
7
|
+
publishedReferralSchema,
|
|
8
|
+
referralAcceptSchema,
|
|
9
|
+
referralArtifactSchema,
|
|
10
|
+
referralDefinitionSchema,
|
|
11
|
+
referralHistorySchema,
|
|
12
|
+
referralSummarySchema
|
|
13
|
+
} from "./chunk-TXL43HL3.js";
|
|
1
14
|
import {
|
|
2
15
|
authScopeSchema,
|
|
3
16
|
exchangeResultSchema,
|
|
4
17
|
sessionSchema
|
|
5
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-QWRSUSNB.js";
|
|
6
19
|
import {
|
|
20
|
+
accountConnectionSchema,
|
|
7
21
|
attemptSchema,
|
|
22
|
+
authProviderSchema,
|
|
8
23
|
entitlementSchema,
|
|
9
24
|
errorSchema,
|
|
10
25
|
evidenceSchema,
|
|
@@ -24,7 +39,7 @@ import {
|
|
|
24
39
|
settingsValuesSchema,
|
|
25
40
|
snapshotSchema,
|
|
26
41
|
templateSchema
|
|
27
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-3IQ4KUKF.js";
|
|
28
43
|
|
|
29
44
|
// src/catalog.ts
|
|
30
45
|
import { z } from "zod";
|
|
@@ -327,6 +342,23 @@ function submissions(transport, configuredStore, namespace) {
|
|
|
327
342
|
});
|
|
328
343
|
}
|
|
329
344
|
const handle = {
|
|
345
|
+
async discard() {
|
|
346
|
+
return store.exclusive(key, async () => {
|
|
347
|
+
await currentSession();
|
|
348
|
+
const record = await read();
|
|
349
|
+
if (!record) return;
|
|
350
|
+
if (record.stage !== "submitted")
|
|
351
|
+
throw new Error(
|
|
352
|
+
"Resume the unfinished submission before starting over."
|
|
353
|
+
);
|
|
354
|
+
const attempt = await claim(record);
|
|
355
|
+
if (attempt.status !== "failed" && attempt.status !== "rejected")
|
|
356
|
+
throw new Error(
|
|
357
|
+
"Only a failed or rejected submission can be discarded."
|
|
358
|
+
);
|
|
359
|
+
await store.write(key, null);
|
|
360
|
+
});
|
|
361
|
+
},
|
|
330
362
|
async status() {
|
|
331
363
|
await currentSession();
|
|
332
364
|
const record = await read();
|
|
@@ -447,6 +479,7 @@ function questActions(submission, latest) {
|
|
|
447
479
|
kind: "status",
|
|
448
480
|
view,
|
|
449
481
|
status: handle.status,
|
|
482
|
+
discard: handle.discard,
|
|
450
483
|
resume: () => run(handle.resume)
|
|
451
484
|
};
|
|
452
485
|
}
|
|
@@ -461,6 +494,7 @@ function questActions(submission, latest) {
|
|
|
461
494
|
kind: "photo",
|
|
462
495
|
view,
|
|
463
496
|
status: handle.status,
|
|
497
|
+
discard: handle.discard,
|
|
464
498
|
resume: () => run(handle.resume),
|
|
465
499
|
submit: (file) => run(() => handle.submit(file))
|
|
466
500
|
};
|
|
@@ -475,6 +509,7 @@ function questActions(submission, latest) {
|
|
|
475
509
|
kind: "quiz",
|
|
476
510
|
view,
|
|
477
511
|
status: handle.status,
|
|
512
|
+
discard: handle.discard,
|
|
478
513
|
resume: () => run(handle.resume),
|
|
479
514
|
submit: (answers) => run(() => handle.submit(answers, { release: view.release }))
|
|
480
515
|
};
|
|
@@ -489,6 +524,7 @@ function questActions(submission, latest) {
|
|
|
489
524
|
kind: "claim",
|
|
490
525
|
view,
|
|
491
526
|
status: handle.status,
|
|
527
|
+
discard: handle.discard,
|
|
492
528
|
resume: () => run(handle.resume),
|
|
493
529
|
submit: () => run(handle.submit)
|
|
494
530
|
};
|
|
@@ -643,11 +679,13 @@ function questConfiguration(release) {
|
|
|
643
679
|
|
|
644
680
|
// src/deployments.ts
|
|
645
681
|
import { z as z5 } from "zod";
|
|
646
|
-
var
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
682
|
+
var projectCatalogArtifactSchema = catalogDeploymentSchema.omit({ expectedRevision: true }).extend({
|
|
683
|
+
referrals: z5.array(referralArtifactSchema).max(50).default([]),
|
|
684
|
+
leaderboards: z5.array(leaderboardArtifactSchema).max(50).default([])
|
|
685
|
+
});
|
|
686
|
+
var projectDeploymentSchema = projectCatalogArtifactSchema.extend({ releases: z5.array(releaseSchema).max(50).default([]) }).refine(
|
|
687
|
+
(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,
|
|
688
|
+
"No resources configured. Add quests, questTypes, leaderboards, collections, or supportedInteractions to relay.json."
|
|
651
689
|
);
|
|
652
690
|
var deploymentPreviewSchema = z5.object({
|
|
653
691
|
id: identifier,
|
|
@@ -655,7 +693,9 @@ var deploymentPreviewSchema = z5.object({
|
|
|
655
693
|
releases: z5.array(publishedReleaseSchema),
|
|
656
694
|
types: z5.array(questTypeVersionSchema),
|
|
657
695
|
collections: z5.array(questCollectionSchema),
|
|
658
|
-
supportedInteractions: z5.array(interactionSchema)
|
|
696
|
+
supportedInteractions: z5.array(interactionSchema),
|
|
697
|
+
referrals: z5.array(publishedReferralSchema).default([]),
|
|
698
|
+
leaderboards: z5.array(leaderboardPreviewSchema).default([])
|
|
659
699
|
});
|
|
660
700
|
var publishDeploymentSchema = z5.object({ id: identifier }).strict();
|
|
661
701
|
var deploymentResultSchema = deploymentPreviewSchema.extend({
|
|
@@ -796,6 +836,28 @@ function createRelayClient(options) {
|
|
|
796
836
|
return quest;
|
|
797
837
|
}
|
|
798
838
|
return {
|
|
839
|
+
referrals: {
|
|
840
|
+
list: () => request("/v1/referrals", z7.array(referralDefinitionSchema)),
|
|
841
|
+
summary: () => request("/v1/referrals/me", referralSummarySchema),
|
|
842
|
+
history: (before) => request(
|
|
843
|
+
query("/v1/referrals/history", { before }),
|
|
844
|
+
referralHistorySchema
|
|
845
|
+
),
|
|
846
|
+
accept: (input) => request("/v1/referrals/accept", z7.object({ ok: z7.literal(true) }), {
|
|
847
|
+
method: "POST",
|
|
848
|
+
body: JSON.stringify(referralAcceptSchema.parse(input))
|
|
849
|
+
})
|
|
850
|
+
},
|
|
851
|
+
leaderboards: {
|
|
852
|
+
list: () => request("/v1/leaderboards", z7.array(leaderboardDefinitionSchema)),
|
|
853
|
+
standings: (board, options2 = {}) => {
|
|
854
|
+
const parsed = leaderboardQuerySchema.parse(options2);
|
|
855
|
+
return request(
|
|
856
|
+
query(`/v1/leaderboards/${identifier.parse(board)}`, parsed),
|
|
857
|
+
leaderboardPageSchema
|
|
858
|
+
);
|
|
859
|
+
}
|
|
860
|
+
},
|
|
799
861
|
quests: {
|
|
800
862
|
get: getQuest,
|
|
801
863
|
retry: async (view) => {
|
|
@@ -866,7 +928,7 @@ function createRelayClient(options) {
|
|
|
866
928
|
z7.object({
|
|
867
929
|
providers: z7.array(
|
|
868
930
|
z7.object({
|
|
869
|
-
provider:
|
|
931
|
+
provider: authProviderSchema,
|
|
870
932
|
configured: z7.boolean()
|
|
871
933
|
})
|
|
872
934
|
),
|
|
@@ -891,6 +953,12 @@ function createRelayClient(options) {
|
|
|
891
953
|
json({ challenge, code })
|
|
892
954
|
)
|
|
893
955
|
),
|
|
956
|
+
accounts: () => request("/v1/auth/accounts", z7.array(accountConnectionSchema)),
|
|
957
|
+
disconnect: (provider) => request(
|
|
958
|
+
"/v1/auth/accounts/disconnect",
|
|
959
|
+
z7.object({ ok: z7.boolean() }),
|
|
960
|
+
json({ provider })
|
|
961
|
+
),
|
|
894
962
|
connections: () => request(
|
|
895
963
|
"/v1/auth/connections",
|
|
896
964
|
z7.array(
|
|
@@ -1048,6 +1116,7 @@ export {
|
|
|
1048
1116
|
collectionBeginSchema,
|
|
1049
1117
|
collectionPreviewSchema,
|
|
1050
1118
|
questConfiguration,
|
|
1119
|
+
projectCatalogArtifactSchema,
|
|
1051
1120
|
projectDeploymentSchema,
|
|
1052
1121
|
deploymentPreviewSchema,
|
|
1053
1122
|
publishDeploymentSchema,
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
import {
|
|
2
|
+
identifier,
|
|
3
|
+
rewardSchema
|
|
4
|
+
} from "./chunk-3IQ4KUKF.js";
|
|
5
|
+
|
|
6
|
+
// src/referrals.ts
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
var amount = z.number().int().safe().nonnegative();
|
|
9
|
+
var reason = z.string().trim().min(1).max(1e3);
|
|
10
|
+
var referralDefinitionSchema = z.object({
|
|
11
|
+
id: identifier,
|
|
12
|
+
title: z.string().trim().min(1).max(120),
|
|
13
|
+
enabled: z.boolean().default(true),
|
|
14
|
+
qualification: z.discriminatedUnion("kind", [
|
|
15
|
+
z.object({ kind: z.literal("signup") }).strict(),
|
|
16
|
+
z.object({ kind: z.literal("quest"), quest: identifier }).strict(),
|
|
17
|
+
z.object({ kind: z.literal("external") }).strict()
|
|
18
|
+
]),
|
|
19
|
+
inviterGroup: identifier.optional(),
|
|
20
|
+
rewards: z.object({
|
|
21
|
+
inviter: z.array(rewardSchema).max(10).default([]),
|
|
22
|
+
invitee: z.array(rewardSchema).max(10).default([])
|
|
23
|
+
}).strict().default({ inviter: [], invitee: [] }),
|
|
24
|
+
milestones: z.array(
|
|
25
|
+
z.object({
|
|
26
|
+
id: identifier,
|
|
27
|
+
count: amount.min(1),
|
|
28
|
+
rewards: z.array(rewardSchema).min(1).max(10)
|
|
29
|
+
}).strict()
|
|
30
|
+
).max(30).default([]),
|
|
31
|
+
bonuses: z.array(
|
|
32
|
+
z.object({
|
|
33
|
+
id: identifier,
|
|
34
|
+
balance: identifier,
|
|
35
|
+
basisPoints: amount.min(1).max(1e4),
|
|
36
|
+
quests: z.array(identifier).min(1).max(100).optional(),
|
|
37
|
+
external: z.boolean().default(false),
|
|
38
|
+
durationDays: amount.min(1).max(36500).optional(),
|
|
39
|
+
maxPoints: amount.min(1).optional()
|
|
40
|
+
}).strict()
|
|
41
|
+
).max(20).default([])
|
|
42
|
+
}).strict().superRefine((value, ctx) => {
|
|
43
|
+
for (const entries of [value.milestones, value.bonuses])
|
|
44
|
+
if (new Set(entries.map((e) => e.id)).size !== entries.length)
|
|
45
|
+
ctx.addIssue({ code: "custom", message: "Rule IDs must be unique" });
|
|
46
|
+
});
|
|
47
|
+
function defineReferral(input) {
|
|
48
|
+
return referralDefinitionSchema.parse(input);
|
|
49
|
+
}
|
|
50
|
+
var referralArtifactSchema = z.union([
|
|
51
|
+
referralDefinitionSchema,
|
|
52
|
+
z.object({ code: z.string().min(1).max(2e6) }).strict()
|
|
53
|
+
]);
|
|
54
|
+
var publishedReferralSchema = z.object({
|
|
55
|
+
version: identifier,
|
|
56
|
+
definition: referralDefinitionSchema,
|
|
57
|
+
publishedAt: amount,
|
|
58
|
+
actor: z.string().nullable()
|
|
59
|
+
});
|
|
60
|
+
var referralAcceptSchema = z.object({ actionId: identifier, code: identifier }).strict();
|
|
61
|
+
var referralControlSchema = z.discriminatedUnion("kind", [
|
|
62
|
+
z.object({
|
|
63
|
+
kind: z.literal("suspend"),
|
|
64
|
+
actionId: identifier,
|
|
65
|
+
member: identifier,
|
|
66
|
+
suspended: z.boolean(),
|
|
67
|
+
reason
|
|
68
|
+
}).strict(),
|
|
69
|
+
z.object({
|
|
70
|
+
kind: z.literal("qualify"),
|
|
71
|
+
actionId: identifier,
|
|
72
|
+
member: identifier,
|
|
73
|
+
program: identifier,
|
|
74
|
+
qualified: z.boolean(),
|
|
75
|
+
reason
|
|
76
|
+
}).strict(),
|
|
77
|
+
z.object({
|
|
78
|
+
kind: z.literal("resolve-reward"),
|
|
79
|
+
actionId: identifier,
|
|
80
|
+
entitlement: identifier,
|
|
81
|
+
reason
|
|
82
|
+
}).strict()
|
|
83
|
+
]);
|
|
84
|
+
var referralRelationshipSchema = z.object({
|
|
85
|
+
member: identifier,
|
|
86
|
+
inviter: identifier,
|
|
87
|
+
acceptedAt: amount,
|
|
88
|
+
suspended: z.boolean()
|
|
89
|
+
});
|
|
90
|
+
var referralAccountSchema = z.object({
|
|
91
|
+
id: identifier,
|
|
92
|
+
program: identifier,
|
|
93
|
+
kind: z.enum(["bonus", "fixed", "milestone"]),
|
|
94
|
+
balance: identifier,
|
|
95
|
+
earned: amount,
|
|
96
|
+
settled: amount,
|
|
97
|
+
outstanding: amount
|
|
98
|
+
});
|
|
99
|
+
var referralSummarySchema = z.object({
|
|
100
|
+
code: identifier,
|
|
101
|
+
attributed: amount,
|
|
102
|
+
programs: z.array(
|
|
103
|
+
z.object({
|
|
104
|
+
definition: referralDefinitionSchema,
|
|
105
|
+
qualified: amount,
|
|
106
|
+
milestones: z.array(
|
|
107
|
+
z.object({ id: identifier, count: amount, reached: z.boolean() })
|
|
108
|
+
)
|
|
109
|
+
})
|
|
110
|
+
),
|
|
111
|
+
accounts: z.array(referralAccountSchema)
|
|
112
|
+
});
|
|
113
|
+
var referralHistorySchema = z.object({
|
|
114
|
+
items: z.array(
|
|
115
|
+
z.object({
|
|
116
|
+
id: amount,
|
|
117
|
+
program: identifier,
|
|
118
|
+
balance: identifier,
|
|
119
|
+
amount: z.number().int().safe(),
|
|
120
|
+
at: amount,
|
|
121
|
+
reason: z.string()
|
|
122
|
+
})
|
|
123
|
+
),
|
|
124
|
+
next: amount.nullable()
|
|
125
|
+
});
|
|
126
|
+
var referralManagementSchema = z.object({
|
|
127
|
+
relationships: z.array(referralRelationshipSchema),
|
|
128
|
+
qualifications: z.array(
|
|
129
|
+
z.object({
|
|
130
|
+
member: identifier,
|
|
131
|
+
program: identifier,
|
|
132
|
+
qualified: z.boolean(),
|
|
133
|
+
qualifiedAt: amount
|
|
134
|
+
})
|
|
135
|
+
),
|
|
136
|
+
accounts: z.array(
|
|
137
|
+
referralAccountSchema.extend({ member: identifier, invitee: z.string() })
|
|
138
|
+
),
|
|
139
|
+
reviews: z.array(
|
|
140
|
+
z.object({
|
|
141
|
+
entitlement: identifier,
|
|
142
|
+
member: identifier,
|
|
143
|
+
program: identifier,
|
|
144
|
+
reason: z.string()
|
|
145
|
+
})
|
|
146
|
+
),
|
|
147
|
+
next: amount.nullable()
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
// src/leaderboards.ts
|
|
151
|
+
import { z as z2 } from "zod";
|
|
152
|
+
var integer = z2.number().int().safe();
|
|
153
|
+
var timestamp = integer.nonnegative().max(864e13);
|
|
154
|
+
var leaderboardWindowSchema = z2.discriminatedUnion("kind", [
|
|
155
|
+
z2.object({ kind: z2.literal("all-time") }).strict(),
|
|
156
|
+
z2.object({ kind: z2.literal("fixed"), start: timestamp, end: timestamp }).strict().refine((w) => w.end > w.start, "Window end must follow its start"),
|
|
157
|
+
z2.object({ kind: z2.literal("rolling"), days: integer.min(1).max(3660) }).strict(),
|
|
158
|
+
z2.object({
|
|
159
|
+
kind: z2.literal("calendar"),
|
|
160
|
+
period: z2.enum(["day", "week", "month"]),
|
|
161
|
+
timeZone: z2.string().min(1).max(100).refine((zone) => {
|
|
162
|
+
try {
|
|
163
|
+
new Intl.DateTimeFormat("en", { timeZone: zone });
|
|
164
|
+
return true;
|
|
165
|
+
} catch {
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
168
|
+
}, "Use an IANA timezone")
|
|
169
|
+
}).strict()
|
|
170
|
+
]);
|
|
171
|
+
var periodScore = {
|
|
172
|
+
window: leaderboardWindowSchema.default({ kind: "all-time" }),
|
|
173
|
+
quests: z2.array(identifier).min(1).max(100).optional()
|
|
174
|
+
};
|
|
175
|
+
var leaderboardDefinitionSchema = z2.object({
|
|
176
|
+
id: identifier,
|
|
177
|
+
title: z2.string().trim().min(1).max(120),
|
|
178
|
+
balance: identifier,
|
|
179
|
+
score: z2.discriminatedUnion("kind", [
|
|
180
|
+
z2.object({ kind: z2.literal("balance") }).strict(),
|
|
181
|
+
z2.object({ kind: z2.literal("earned"), ...periodScore }).strict(),
|
|
182
|
+
z2.object({
|
|
183
|
+
kind: z2.literal("net"),
|
|
184
|
+
window: leaderboardWindowSchema.default({ kind: "all-time" })
|
|
185
|
+
}).strict()
|
|
186
|
+
]).default({ kind: "balance" }),
|
|
187
|
+
access: z2.enum(["participants", "public"]).default("participants"),
|
|
188
|
+
group: identifier.optional()
|
|
189
|
+
}).strict();
|
|
190
|
+
function defineLeaderboard(input) {
|
|
191
|
+
return leaderboardDefinitionSchema.parse(input);
|
|
192
|
+
}
|
|
193
|
+
var leaderboardArtifactSchema = z2.union([
|
|
194
|
+
leaderboardDefinitionSchema,
|
|
195
|
+
z2.object({ code: z2.string().min(1).max(2e6) }).strict()
|
|
196
|
+
]);
|
|
197
|
+
var publishedLeaderboardSchema = z2.object({
|
|
198
|
+
version: identifier,
|
|
199
|
+
definition: leaderboardDefinitionSchema,
|
|
200
|
+
publishedAt: timestamp,
|
|
201
|
+
actor: z2.string().nullable()
|
|
202
|
+
});
|
|
203
|
+
var leaderboardQuerySchema = z2.object({
|
|
204
|
+
limit: z2.coerce.number().int().min(1).max(100).default(25),
|
|
205
|
+
cursor: z2.string().max(4096).optional()
|
|
206
|
+
}).strict();
|
|
207
|
+
var leaderboardRowSchema = z2.object({
|
|
208
|
+
participant: identifier,
|
|
209
|
+
member: identifier.optional(),
|
|
210
|
+
name: z2.string(),
|
|
211
|
+
score: integer,
|
|
212
|
+
rank: integer.positive()
|
|
213
|
+
});
|
|
214
|
+
var leaderboardPageSchema = z2.object({
|
|
215
|
+
leaderboard: identifier,
|
|
216
|
+
title: z2.string(),
|
|
217
|
+
version: identifier,
|
|
218
|
+
calculation: z2.enum(["balance", "earned", "net"]),
|
|
219
|
+
period: z2.object({ start: timestamp.nullable(), end: timestamp.nullable() }),
|
|
220
|
+
calculatedAt: timestamp,
|
|
221
|
+
lastEntryAt: timestamp.nullable(),
|
|
222
|
+
total: integer.nonnegative(),
|
|
223
|
+
items: z2.array(leaderboardRowSchema),
|
|
224
|
+
me: leaderboardRowSchema.nullable(),
|
|
225
|
+
nearby: z2.array(leaderboardRowSchema),
|
|
226
|
+
nextCursor: z2.string().nullable()
|
|
227
|
+
});
|
|
228
|
+
var leaderboardPreviewSchema = z2.object({
|
|
229
|
+
published: publishedLeaderboardSchema,
|
|
230
|
+
before: leaderboardPageSchema.nullable(),
|
|
231
|
+
after: leaderboardPageSchema
|
|
232
|
+
});
|
|
233
|
+
var mutationBase = {
|
|
234
|
+
actionId: identifier,
|
|
235
|
+
member: identifier,
|
|
236
|
+
balance: identifier,
|
|
237
|
+
reason: z2.string().trim().min(1).max(1e3)
|
|
238
|
+
};
|
|
239
|
+
var datedMutation = { ...mutationBase, effectiveAt: timestamp.optional() };
|
|
240
|
+
var pointsMutationSchema = z2.discriminatedUnion("kind", [
|
|
241
|
+
z2.object({
|
|
242
|
+
...datedMutation,
|
|
243
|
+
kind: z2.literal("award"),
|
|
244
|
+
referralEligible: z2.boolean().optional(),
|
|
245
|
+
amount: integer.positive()
|
|
246
|
+
}).strict(),
|
|
247
|
+
z2.object({
|
|
248
|
+
...datedMutation,
|
|
249
|
+
kind: z2.literal("spend"),
|
|
250
|
+
amount: integer.positive()
|
|
251
|
+
}).strict(),
|
|
252
|
+
z2.object({
|
|
253
|
+
...datedMutation,
|
|
254
|
+
kind: z2.literal("adjust"),
|
|
255
|
+
amount: integer.refine((n) => n !== 0)
|
|
256
|
+
}).strict(),
|
|
257
|
+
z2.object({
|
|
258
|
+
...datedMutation,
|
|
259
|
+
kind: z2.literal("set"),
|
|
260
|
+
total: integer.nonnegative(),
|
|
261
|
+
expectedTotal: integer.nonnegative(),
|
|
262
|
+
classification: z2.enum(["earned", "spend"])
|
|
263
|
+
}).strict(),
|
|
264
|
+
z2.object({
|
|
265
|
+
...mutationBase,
|
|
266
|
+
kind: z2.literal("reverse"),
|
|
267
|
+
entry: identifier,
|
|
268
|
+
amount: integer.positive()
|
|
269
|
+
}).strict()
|
|
270
|
+
]);
|
|
271
|
+
var pointsEntrySchema = z2.object({
|
|
272
|
+
id: identifier,
|
|
273
|
+
completion: z2.string().nullable(),
|
|
274
|
+
member: identifier,
|
|
275
|
+
balance: identifier,
|
|
276
|
+
amount: integer,
|
|
277
|
+
kind: z2.enum(["award", "spend", "adjust", "reverse"]),
|
|
278
|
+
effectiveAt: timestamp,
|
|
279
|
+
receivedAt: timestamp,
|
|
280
|
+
quest: identifier.nullable(),
|
|
281
|
+
original: identifier.nullable(),
|
|
282
|
+
reason: z2.string(),
|
|
283
|
+
actor: z2.string().nullable()
|
|
284
|
+
});
|
|
285
|
+
var pointsResultSchema = z2.object({
|
|
286
|
+
entry: pointsEntrySchema,
|
|
287
|
+
total: integer.nonnegative()
|
|
288
|
+
});
|
|
289
|
+
var pointsAccountSchema = z2.object({
|
|
290
|
+
member: identifier,
|
|
291
|
+
balance: identifier,
|
|
292
|
+
total: integer.nonnegative(),
|
|
293
|
+
held: integer.nonnegative()
|
|
294
|
+
});
|
|
295
|
+
var leaderboardExclusionSchema = z2.object({
|
|
296
|
+
actionId: identifier,
|
|
297
|
+
member: identifier,
|
|
298
|
+
excluded: z2.boolean(),
|
|
299
|
+
reason: z2.string().trim().min(1).max(1e3)
|
|
300
|
+
}).strict();
|
|
301
|
+
var leaderboardGroupSchema = z2.object({
|
|
302
|
+
actionId: identifier,
|
|
303
|
+
member: identifier,
|
|
304
|
+
included: z2.boolean(),
|
|
305
|
+
reason: z2.string().trim().min(1).max(1e3)
|
|
306
|
+
}).strict();
|
|
307
|
+
|
|
308
|
+
export {
|
|
309
|
+
referralDefinitionSchema,
|
|
310
|
+
defineReferral,
|
|
311
|
+
referralArtifactSchema,
|
|
312
|
+
publishedReferralSchema,
|
|
313
|
+
referralAcceptSchema,
|
|
314
|
+
referralControlSchema,
|
|
315
|
+
referralRelationshipSchema,
|
|
316
|
+
referralAccountSchema,
|
|
317
|
+
referralSummarySchema,
|
|
318
|
+
referralHistorySchema,
|
|
319
|
+
referralManagementSchema,
|
|
320
|
+
leaderboardWindowSchema,
|
|
321
|
+
leaderboardDefinitionSchema,
|
|
322
|
+
defineLeaderboard,
|
|
323
|
+
leaderboardArtifactSchema,
|
|
324
|
+
publishedLeaderboardSchema,
|
|
325
|
+
leaderboardQuerySchema,
|
|
326
|
+
leaderboardRowSchema,
|
|
327
|
+
leaderboardPageSchema,
|
|
328
|
+
leaderboardPreviewSchema,
|
|
329
|
+
pointsMutationSchema,
|
|
330
|
+
pointsEntrySchema,
|
|
331
|
+
pointsResultSchema,
|
|
332
|
+
pointsAccountSchema,
|
|
333
|
+
leaderboardExclusionSchema,
|
|
334
|
+
leaderboardGroupSchema
|
|
335
|
+
};
|