@domino-sdk/relay 1.0.0-next.6 → 1.0.0-next.8
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/README.md +13 -1
- package/build.mjs +18 -1
- package/dist/authoring.d.ts +317 -15
- package/dist/authoring.js +177 -23
- package/dist/avatar.d.ts +29 -0
- package/dist/avatar.js +21 -0
- package/dist/browser.d.ts +174 -2239
- package/dist/browser.js +6 -6
- package/dist/{chunk-RTHN22KO.js → chunk-6A6K5RUD.js} +22 -8
- package/dist/chunk-77H7APVD.js +171 -0
- package/dist/chunk-MRIURJE3.js +257 -0
- package/dist/{chunk-5IIWKDFX.js → chunk-QBOHLT7M.js} +26 -5
- package/dist/chunk-V5R2DMGY.js +1407 -0
- package/dist/chunk-V7EZUZ3Z.js +1003 -0
- package/dist/chunk-V7UKZLHA.js +35 -0
- package/dist/{chunk-BRESOTKV.js → chunk-VARGF4JS.js} +660 -770
- package/dist/chunk-ZWY3R6B3.js +26 -0
- package/dist/client-CK4nwt7V.d.ts +2631 -0
- package/dist/collection-BGneJ6Bk.d.ts +114 -0
- package/dist/images--vZ9U0kr.d.ts +234 -0
- package/dist/index.d.ts +11 -13132
- package/dist/index.js +20 -690
- package/dist/integrations-C3Sp558f.d.ts +1297 -0
- package/dist/internal.d.ts +120 -0
- package/dist/internal.js +111 -0
- package/dist/pages-BzqJuI69.d.ts +4006 -0
- package/dist/point-ledgers-iS00Z_v0.d.ts +37 -0
- package/dist/portal-proxy.js +8 -9
- package/dist/profiles-DDMFBRKe.d.ts +297 -0
- package/dist/react/index.d.ts +186 -2251
- package/dist/react/index.js +11 -15
- package/dist/schema-pnuWqvGn.d.ts +3396 -0
- package/dist/schema.d.ts +3196 -2374
- package/dist/schema.js +549 -3
- package/dist/streaks-CwGReWGt.d.ts +73 -0
- package/dist/submission-input-C9qm9ixd.d.ts +2672 -0
- package/dist/units-CwgsPB_r.d.ts +9 -0
- package/dist/wallet-BGOfFkG9.d.ts +231 -0
- package/package.json +17 -4
- package/dist/chunk-ERBVT7GE.js +0 -1847
- package/dist/chunk-XEQDW7FM.js +0 -373
- package/dist/chunk-ZKJBCQNI.js +0 -624
- package/dist/submission-input-CZDukyb3.d.ts +0 -4998
package/dist/browser.js
CHANGED
|
@@ -11,12 +11,12 @@ import {
|
|
|
11
11
|
signInOptions,
|
|
12
12
|
solanaSigner,
|
|
13
13
|
walletStandardSolanaSigner
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-6A6K5RUD.js";
|
|
15
|
+
import "./chunk-V5R2DMGY.js";
|
|
16
|
+
import "./chunk-MRIURJE3.js";
|
|
17
|
+
import "./chunk-V7EZUZ3Z.js";
|
|
18
|
+
import "./chunk-QBOHLT7M.js";
|
|
19
|
+
import "./chunk-VARGF4JS.js";
|
|
20
20
|
export {
|
|
21
21
|
browserSubmissionStore,
|
|
22
22
|
cosmosChainList,
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createRelayClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-V5R2DMGY.js";
|
|
4
4
|
import {
|
|
5
|
+
RelayErrorCode,
|
|
6
|
+
clientError,
|
|
5
7
|
cosmosChain
|
|
6
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-V7EZUZ3Z.js";
|
|
7
9
|
|
|
8
10
|
// src/base58.ts
|
|
9
11
|
var alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
@@ -494,16 +496,27 @@ function browserSubmissionStore() {
|
|
|
494
496
|
let database;
|
|
495
497
|
function open() {
|
|
496
498
|
if (!globalThis.indexedDB || !globalThis.navigator?.locks) {
|
|
497
|
-
throw
|
|
498
|
-
"This browser cannot safely save submissions. Use a browser with IndexedDB and Web Locks enabled."
|
|
499
|
+
throw clientError(
|
|
500
|
+
"This browser cannot safely save submissions. Use a browser with IndexedDB and Web Locks enabled.",
|
|
501
|
+
RelayErrorCode.SubmissionStorage
|
|
499
502
|
);
|
|
500
503
|
}
|
|
501
504
|
return database ??= new Promise((resolve, reject) => {
|
|
502
505
|
const request = indexedDB.open("domino-relay-submissions", 1);
|
|
503
506
|
request.onupgradeneeded = () => request.result.createObjectStore("submissions");
|
|
504
|
-
request.onerror = () => reject(
|
|
507
|
+
request.onerror = () => reject(
|
|
508
|
+
clientError(
|
|
509
|
+
"Could not open submission storage",
|
|
510
|
+
RelayErrorCode.SubmissionStorage
|
|
511
|
+
)
|
|
512
|
+
);
|
|
505
513
|
request.onsuccess = () => resolve(request.result);
|
|
506
|
-
request.onblocked = () => reject(
|
|
514
|
+
request.onblocked = () => reject(
|
|
515
|
+
clientError(
|
|
516
|
+
"Close other Relay tabs and try again",
|
|
517
|
+
RelayErrorCode.SubmissionStorage
|
|
518
|
+
)
|
|
519
|
+
);
|
|
507
520
|
});
|
|
508
521
|
}
|
|
509
522
|
async function transact(key, value) {
|
|
@@ -518,8 +531,9 @@ function browserSubmissionStore() {
|
|
|
518
531
|
const request = value === void 0 ? store.get(key) : store.put(value, key);
|
|
519
532
|
transaction.oncomplete = () => resolve(request.result);
|
|
520
533
|
transaction.onerror = transaction.onabort = () => reject(
|
|
521
|
-
|
|
522
|
-
"Could not save submission progress. Resume the saved submission when browser storage is available."
|
|
534
|
+
clientError(
|
|
535
|
+
"Could not save submission progress. Resume the saved submission when browser storage is available.",
|
|
536
|
+
RelayErrorCode.SubmissionStorage
|
|
523
537
|
)
|
|
524
538
|
);
|
|
525
539
|
});
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import {
|
|
2
|
+
identifier,
|
|
3
|
+
xTweetSchema
|
|
4
|
+
} from "./chunk-VARGF4JS.js";
|
|
5
|
+
|
|
6
|
+
// src/x.ts
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
var xIdSchema = z.string().regex(/^[0-9]{1,20}$/);
|
|
9
|
+
var xConnectionSchema = z.object({ userId: xIdSchema });
|
|
10
|
+
var xProfileSchema = z.object({
|
|
11
|
+
id: xIdSchema,
|
|
12
|
+
username: z.string(),
|
|
13
|
+
name: z.string(),
|
|
14
|
+
bio: z.string().nullable(),
|
|
15
|
+
profileImageUrl: z.string().url().nullable(),
|
|
16
|
+
followersCount: z.number().int().nonnegative().nullable(),
|
|
17
|
+
verified: z.boolean().nullable()
|
|
18
|
+
});
|
|
19
|
+
var xPostSchema = xTweetSchema.extend({
|
|
20
|
+
quotedTweetId: xIdSchema.nullish().transform((v) => v ?? null),
|
|
21
|
+
inReplyToUserId: xIdSchema.nullish().transform((v) => v ?? null),
|
|
22
|
+
inReplyToStatusId: xIdSchema.nullish().transform((v) => v ?? null),
|
|
23
|
+
retweetedTweetId: xIdSchema.nullish().transform((v) => v ?? null),
|
|
24
|
+
/**
|
|
25
|
+
* Attached media in post order. Videos and GIFs carry their preview image URL. Like the tracker
|
|
26
|
+
* projection (migration 0056), a list with any malformed item is dropped whole, so positions
|
|
27
|
+
* never shift and a bad entry never fails the post read.
|
|
28
|
+
*/
|
|
29
|
+
media: z.unknown().transform(
|
|
30
|
+
(value) => z.array(z.object({ type: z.string(), url: z.string() })).safeParse(value).data ?? []
|
|
31
|
+
)
|
|
32
|
+
});
|
|
33
|
+
var xRequestSchema = z.discriminatedUnion("operation", [
|
|
34
|
+
z.object({ operation: z.literal("connection") }).strict(),
|
|
35
|
+
z.object({ operation: z.literal("profile") }).strict(),
|
|
36
|
+
z.object({ operation: z.literal("post"), postId: xIdSchema }).strict(),
|
|
37
|
+
z.object({ operation: z.literal("follows"), userId: xIdSchema }).strict(),
|
|
38
|
+
z.object({ operation: z.literal("reposted"), postId: xIdSchema }).strict()
|
|
39
|
+
]);
|
|
40
|
+
|
|
41
|
+
// src/images.ts
|
|
42
|
+
import { z as z2 } from "zod";
|
|
43
|
+
var imageReferenceSchema = z2.union([
|
|
44
|
+
z2.strictObject({ evidence: z2.string().min(1).max(256) }),
|
|
45
|
+
z2.strictObject({ x: z2.literal("profile") }),
|
|
46
|
+
z2.strictObject({
|
|
47
|
+
x: z2.literal("post"),
|
|
48
|
+
postId: xIdSchema,
|
|
49
|
+
index: z2.number().int().min(0).max(3).default(0)
|
|
50
|
+
}),
|
|
51
|
+
z2.strictObject({ asset: identifier })
|
|
52
|
+
]);
|
|
53
|
+
var criteria = z2.string().trim().min(1).max(2e3);
|
|
54
|
+
var imageFieldSchema = z2.strictObject({
|
|
55
|
+
type: z2.enum(["string", "number", "boolean"]),
|
|
56
|
+
description: z2.string().trim().min(1).max(500)
|
|
57
|
+
});
|
|
58
|
+
var imageFieldsSchema = z2.record(z2.string().regex(/^[a-zA-Z][a-zA-Z0-9_]{0,39}$/), imageFieldSchema).refine((fields) => {
|
|
59
|
+
const count = Object.keys(fields).length;
|
|
60
|
+
return count >= 1 && count <= 12;
|
|
61
|
+
}, "Declare between 1 and 12 fields");
|
|
62
|
+
var imageRequestSchema = z2.discriminatedUnion("operation", [
|
|
63
|
+
z2.strictObject({
|
|
64
|
+
operation: z2.literal("inspect"),
|
|
65
|
+
image: imageReferenceSchema
|
|
66
|
+
}),
|
|
67
|
+
z2.strictObject({
|
|
68
|
+
operation: z2.literal("compare"),
|
|
69
|
+
images: z2.tuple([imageReferenceSchema, imageReferenceSchema])
|
|
70
|
+
}),
|
|
71
|
+
z2.strictObject({
|
|
72
|
+
operation: z2.literal("review"),
|
|
73
|
+
images: z2.array(imageReferenceSchema).min(1).max(4),
|
|
74
|
+
criteria
|
|
75
|
+
}),
|
|
76
|
+
z2.strictObject({
|
|
77
|
+
operation: z2.literal("extract"),
|
|
78
|
+
image: imageReferenceSchema,
|
|
79
|
+
fields: imageFieldsSchema
|
|
80
|
+
}),
|
|
81
|
+
z2.strictObject({
|
|
82
|
+
operation: z2.literal("seen"),
|
|
83
|
+
image: imageReferenceSchema,
|
|
84
|
+
maxDistance: z2.number().int().min(0).max(8).default(8)
|
|
85
|
+
})
|
|
86
|
+
]);
|
|
87
|
+
var hash = z2.string().regex(/^[0-9a-f]{16}$/);
|
|
88
|
+
var imageInspectionSchema = z2.strictObject({
|
|
89
|
+
width: z2.number().int().positive(),
|
|
90
|
+
height: z2.number().int().positive(),
|
|
91
|
+
format: z2.enum(["jpeg", "png", "webp", "gif", "avif"]),
|
|
92
|
+
bytes: z2.number().int().positive(),
|
|
93
|
+
sha256: z2.string().regex(/^[0-9a-f]{64}$/),
|
|
94
|
+
phash: hash,
|
|
95
|
+
dhash: hash
|
|
96
|
+
});
|
|
97
|
+
var distance = z2.number().int().min(0).max(64);
|
|
98
|
+
var imageComparisonSchema = z2.strictObject({
|
|
99
|
+
identical: z2.boolean(),
|
|
100
|
+
phashDistance: distance,
|
|
101
|
+
dhashDistance: distance
|
|
102
|
+
});
|
|
103
|
+
var imageExtractionSchema = z2.strictObject({
|
|
104
|
+
values: z2.record(
|
|
105
|
+
z2.string(),
|
|
106
|
+
z2.union([z2.string().max(2e3), z2.number(), z2.boolean(), z2.null()])
|
|
107
|
+
),
|
|
108
|
+
reason: z2.string().min(1).max(2e3)
|
|
109
|
+
});
|
|
110
|
+
var imageSightingsSchema = z2.strictObject({
|
|
111
|
+
matches: z2.number().int().nonnegative(),
|
|
112
|
+
closestDistance: distance.nullable(),
|
|
113
|
+
firstSeenAt: z2.number().int().nonnegative().nullable()
|
|
114
|
+
});
|
|
115
|
+
var sha256 = z2.string().regex(/^[0-9a-f]{64}$/);
|
|
116
|
+
var imageSize = z2.number().int().positive().max(5 * 1024 * 1024);
|
|
117
|
+
var imageAssetArtifactSchema = z2.strictObject({
|
|
118
|
+
key: identifier,
|
|
119
|
+
sha256,
|
|
120
|
+
size: imageSize,
|
|
121
|
+
path: z2.string().min(1).max(500).optional()
|
|
122
|
+
});
|
|
123
|
+
var imageUploadRequestSchema = z2.strictObject({
|
|
124
|
+
images: z2.array(
|
|
125
|
+
z2.strictObject({
|
|
126
|
+
sha256,
|
|
127
|
+
size: imageSize,
|
|
128
|
+
type: z2.enum(["image/jpeg", "image/png", "image/webp"])
|
|
129
|
+
})
|
|
130
|
+
).min(1).max(10)
|
|
131
|
+
});
|
|
132
|
+
var imageUploadsSchema = z2.strictObject({
|
|
133
|
+
images: z2.array(
|
|
134
|
+
z2.strictObject({
|
|
135
|
+
sha256,
|
|
136
|
+
upload: z2.strictObject({
|
|
137
|
+
url: z2.string().url(),
|
|
138
|
+
headers: z2.record(z2.string(), z2.string()),
|
|
139
|
+
expiresAt: z2.number().int().positive()
|
|
140
|
+
}).nullable()
|
|
141
|
+
})
|
|
142
|
+
)
|
|
143
|
+
});
|
|
144
|
+
var publishedImageSchema = z2.strictObject({
|
|
145
|
+
key: identifier,
|
|
146
|
+
sha256,
|
|
147
|
+
type: z2.enum(["image/jpeg", "image/png", "image/webp"]),
|
|
148
|
+
size: imageSize,
|
|
149
|
+
width: z2.number().int().positive(),
|
|
150
|
+
height: z2.number().int().positive()
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
export {
|
|
154
|
+
xIdSchema,
|
|
155
|
+
xConnectionSchema,
|
|
156
|
+
xProfileSchema,
|
|
157
|
+
xPostSchema,
|
|
158
|
+
xRequestSchema,
|
|
159
|
+
imageReferenceSchema,
|
|
160
|
+
imageFieldSchema,
|
|
161
|
+
imageFieldsSchema,
|
|
162
|
+
imageRequestSchema,
|
|
163
|
+
imageInspectionSchema,
|
|
164
|
+
imageComparisonSchema,
|
|
165
|
+
imageExtractionSchema,
|
|
166
|
+
imageSightingsSchema,
|
|
167
|
+
imageAssetArtifactSchema,
|
|
168
|
+
imageUploadRequestSchema,
|
|
169
|
+
imageUploadsSchema,
|
|
170
|
+
publishedImageSchema
|
|
171
|
+
};
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import {
|
|
2
|
+
authoringIdentityShape,
|
|
3
|
+
normalizeAuthoringIdentity,
|
|
4
|
+
validateAuthoringIdentity
|
|
5
|
+
} from "./chunk-V7EZUZ3Z.js";
|
|
6
|
+
import {
|
|
7
|
+
entitlementSchema,
|
|
8
|
+
identifier,
|
|
9
|
+
memberProgressSchema,
|
|
10
|
+
pickupAvailabilitySchema,
|
|
11
|
+
pickupSelectionSchema,
|
|
12
|
+
publishedReleaseSchema,
|
|
13
|
+
questDescriptionSchema,
|
|
14
|
+
reviewModeSchema,
|
|
15
|
+
settingsValuesSchema,
|
|
16
|
+
storedReviewModeSchema,
|
|
17
|
+
tieredRewardReferenceSchema
|
|
18
|
+
} from "./chunk-VARGF4JS.js";
|
|
19
|
+
|
|
20
|
+
// src/point-ledgers.ts
|
|
21
|
+
import { z } from "zod";
|
|
22
|
+
var pointLedgerPropertiesSchema = z.object({
|
|
23
|
+
name: z.string().trim().min(1).max(120),
|
|
24
|
+
description: z.string().trim().max(1e3).default("")
|
|
25
|
+
}).strict();
|
|
26
|
+
var createPointLedgerSchema = pointLedgerPropertiesSchema.extend({ actionId: identifier, key: identifier.optional() }).strict();
|
|
27
|
+
var pointLedgerSchema = pointLedgerPropertiesSchema.extend({
|
|
28
|
+
id: identifier
|
|
29
|
+
});
|
|
30
|
+
var pointLedgerDeclarationSchema = pointLedgerPropertiesSchema.extend({ key: identifier }).strict();
|
|
31
|
+
var pointLedgerReferenceSchema = z.object({
|
|
32
|
+
id: identifier,
|
|
33
|
+
key: identifier.nullable(),
|
|
34
|
+
name: z.string()
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// src/catalog.ts
|
|
38
|
+
import { z as z2 } from "zod";
|
|
39
|
+
var interactionSchema = z2.enum([
|
|
40
|
+
"photo",
|
|
41
|
+
"text",
|
|
42
|
+
"url",
|
|
43
|
+
"quiz",
|
|
44
|
+
"claim",
|
|
45
|
+
"staff",
|
|
46
|
+
"automatic"
|
|
47
|
+
]);
|
|
48
|
+
function questInteraction(trigger) {
|
|
49
|
+
return trigger.kind === "automatic" ? "automatic" : trigger.actor === "staff" ? "staff" : trigger.input === "none" ? "claim" : trigger.input;
|
|
50
|
+
}
|
|
51
|
+
var questTypeVersionSchema = z2.object({
|
|
52
|
+
key: identifier.optional(),
|
|
53
|
+
id: identifier,
|
|
54
|
+
version: identifier,
|
|
55
|
+
code: z2.string(),
|
|
56
|
+
definition: questDescriptionSchema,
|
|
57
|
+
provider: storedReviewModeSchema,
|
|
58
|
+
createdAt: z2.number()
|
|
59
|
+
});
|
|
60
|
+
var collectionSlotSchema = z2.object({
|
|
61
|
+
id: identifier,
|
|
62
|
+
key: identifier.optional(),
|
|
63
|
+
title: z2.string().trim().min(1).max(120)
|
|
64
|
+
}).strict();
|
|
65
|
+
var collectionSlotDeclarationSchema = collectionSlotSchema.omit({ id: true }).extend(authoringIdentityShape).strict().superRefine(validateAuthoringIdentity).transform(normalizeAuthoringIdentity);
|
|
66
|
+
var questCollectionSchema = collectionSlotSchema.extend({
|
|
67
|
+
quests: z2.array(identifier).max(100).refine(
|
|
68
|
+
(v) => new Set(v).size === v.length,
|
|
69
|
+
"A collection can contain a quest only once"
|
|
70
|
+
)
|
|
71
|
+
});
|
|
72
|
+
var questInstanceSchema = z2.object({
|
|
73
|
+
id: identifier,
|
|
74
|
+
title: z2.string().trim().min(1).max(120),
|
|
75
|
+
typeVersion: identifier,
|
|
76
|
+
settings: settingsValuesSchema,
|
|
77
|
+
requires: z2.array(identifier).max(30),
|
|
78
|
+
status: z2.enum(["active", "paused", "archived"])
|
|
79
|
+
}).strict();
|
|
80
|
+
var questDraftChangesSchema = z2.object({
|
|
81
|
+
quests: z2.array(
|
|
82
|
+
questInstanceSchema.extend({ expectedRelease: identifier.nullable() })
|
|
83
|
+
).max(50),
|
|
84
|
+
collections: z2.array(questCollectionSchema).max(50)
|
|
85
|
+
}).strict();
|
|
86
|
+
var draftBase = z2.object({
|
|
87
|
+
id: identifier,
|
|
88
|
+
revision: z2.number().int().positive(),
|
|
89
|
+
baseRevision: z2.number().int().nonnegative(),
|
|
90
|
+
changes: questDraftChangesSchema
|
|
91
|
+
});
|
|
92
|
+
var questDraftSchema = z2.discriminatedUnion("status", [
|
|
93
|
+
draftBase.extend({ status: z2.literal("draft") }),
|
|
94
|
+
draftBase.extend({
|
|
95
|
+
status: z2.literal("published"),
|
|
96
|
+
releaseIds: z2.array(identifier)
|
|
97
|
+
})
|
|
98
|
+
]);
|
|
99
|
+
var questCatalogSchema = z2.object({
|
|
100
|
+
revision: z2.number().int().nonnegative(),
|
|
101
|
+
types: z2.array(questTypeVersionSchema),
|
|
102
|
+
collections: z2.array(questCollectionSchema),
|
|
103
|
+
quests: z2.array(questInstanceSchema),
|
|
104
|
+
drafts: z2.array(questDraftSchema),
|
|
105
|
+
releases: z2.array(publishedReleaseSchema).default([]),
|
|
106
|
+
supportedInteractions: z2.array(interactionSchema)
|
|
107
|
+
});
|
|
108
|
+
var catalogDeploymentSchema = z2.object({
|
|
109
|
+
expectedRevision: z2.number().int().nonnegative(),
|
|
110
|
+
types: z2.array(
|
|
111
|
+
z2.object({
|
|
112
|
+
code: z2.string().min(1).max(1e6),
|
|
113
|
+
provider: reviewModeSchema
|
|
114
|
+
})
|
|
115
|
+
).max(50).default([]),
|
|
116
|
+
collections: z2.array(collectionSlotDeclarationSchema).max(50).default([]),
|
|
117
|
+
supportedInteractions: z2.array(interactionSchema).min(1).optional()
|
|
118
|
+
}).strict();
|
|
119
|
+
var catalogDeploymentPreviewSchema = z2.object({
|
|
120
|
+
revision: z2.number().int().nonnegative(),
|
|
121
|
+
types: z2.array(questTypeVersionSchema),
|
|
122
|
+
collections: z2.array(collectionSlotSchema),
|
|
123
|
+
supportedInteractions: z2.array(interactionSchema)
|
|
124
|
+
});
|
|
125
|
+
var saveQuestDraftSchema = z2.object({
|
|
126
|
+
id: identifier.optional(),
|
|
127
|
+
actionId: identifier,
|
|
128
|
+
expectedRevision: z2.number().int().nonnegative(),
|
|
129
|
+
baseRevision: z2.number().int().nonnegative(),
|
|
130
|
+
changes: questDraftChangesSchema
|
|
131
|
+
}).strict();
|
|
132
|
+
var publishQuestDraftSchema = z2.object({ id: identifier, expectedRevision: z2.number().int().positive() }).strict();
|
|
133
|
+
var questRewardViewSchema = z2.discriminatedUnion("kind", [
|
|
134
|
+
z2.object({
|
|
135
|
+
kind: z2.literal("points"),
|
|
136
|
+
label: z2.string(),
|
|
137
|
+
amount: z2.number().int().nonnegative(),
|
|
138
|
+
ledger: pointLedgerReferenceSchema
|
|
139
|
+
}),
|
|
140
|
+
z2.object({
|
|
141
|
+
kind: z2.literal("tier"),
|
|
142
|
+
label: z2.string(),
|
|
143
|
+
reward: tieredRewardReferenceSchema.extend({ title: z2.string() }),
|
|
144
|
+
tier: identifier
|
|
145
|
+
}),
|
|
146
|
+
z2.object({ kind: z2.literal("integration"), label: z2.string() })
|
|
147
|
+
]);
|
|
148
|
+
var questViewSchema = memberProgressSchema.shape.quests.element.extend(
|
|
149
|
+
{
|
|
150
|
+
release: identifier,
|
|
151
|
+
interaction: interactionSchema,
|
|
152
|
+
lifecycle: z2.enum(["active", "paused", "archived"]),
|
|
153
|
+
rewards: z2.array(questRewardViewSchema)
|
|
154
|
+
}
|
|
155
|
+
);
|
|
156
|
+
var collectionViewSchema = z2.object({
|
|
157
|
+
key: identifier.optional(),
|
|
158
|
+
id: identifier,
|
|
159
|
+
title: z2.string(),
|
|
160
|
+
quests: z2.array(questViewSchema)
|
|
161
|
+
});
|
|
162
|
+
var questExperienceSchema = z2.object({
|
|
163
|
+
member: identifier,
|
|
164
|
+
quests: z2.array(questViewSchema),
|
|
165
|
+
collections: z2.array(collectionViewSchema)
|
|
166
|
+
});
|
|
167
|
+
var questPublicationPreviewSchema = z2.object({
|
|
168
|
+
draft: questDraftSchema,
|
|
169
|
+
releases: z2.array(publishedReleaseSchema),
|
|
170
|
+
affectedCollections: z2.array(questCollectionSchema)
|
|
171
|
+
});
|
|
172
|
+
var allocateQuestSchema = z2.object({ actionId: identifier }).strict();
|
|
173
|
+
var allocatedQuestSchema = z2.object({ id: identifier });
|
|
174
|
+
|
|
175
|
+
// src/collection.ts
|
|
176
|
+
import { z as z3 } from "zod";
|
|
177
|
+
var collectionCodeSchema = z3.string().regex(/^relay:collect:[a-f0-9]{64}$/);
|
|
178
|
+
var collectionPassSchema = z3.object({
|
|
179
|
+
code: collectionCodeSchema,
|
|
180
|
+
expiresAt: z3.number(),
|
|
181
|
+
entitlement: identifier
|
|
182
|
+
});
|
|
183
|
+
var collectionResolveSchema = z3.object({ code: collectionCodeSchema }).strict();
|
|
184
|
+
var collectionBeginSchema = collectionResolveSchema.extend({
|
|
185
|
+
actionId: identifier,
|
|
186
|
+
revision: z3.number().int().positive(),
|
|
187
|
+
selection: pickupSelectionSchema.optional()
|
|
188
|
+
});
|
|
189
|
+
var collectionPreviewSchema = z3.object({
|
|
190
|
+
entitlement: entitlementSchema,
|
|
191
|
+
inventory: pickupAvailabilitySchema,
|
|
192
|
+
expiresAt: z3.number()
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
// src/reward-deliveries.ts
|
|
196
|
+
import { z as z4 } from "zod";
|
|
197
|
+
var rewardDeliverySchema = z4.object({
|
|
198
|
+
id: z4.string(),
|
|
199
|
+
quest: z4.string(),
|
|
200
|
+
completion: z4.string(),
|
|
201
|
+
member: z4.string(),
|
|
202
|
+
provider: z4.literal("discord"),
|
|
203
|
+
action: z4.literal("grant-role"),
|
|
204
|
+
roleId: z4.string(),
|
|
205
|
+
/**
|
|
206
|
+
* `failed` is terminal: Discord rejected the grant permanently (unknown role,
|
|
207
|
+
* member left the server, missing permissions) or retries ran out after
|
|
208
|
+
* about a day. An operator can retry it once the cause is fixed.
|
|
209
|
+
*/
|
|
210
|
+
status: z4.enum(["pending", "delivered", "failed"]),
|
|
211
|
+
/** Provider attempts in the current round; an operator retry starts a new round at zero. */
|
|
212
|
+
attempts: z4.number().int(),
|
|
213
|
+
/** While pending with a `lastError`, when the next attempt is scheduled. */
|
|
214
|
+
nextAt: z4.number(),
|
|
215
|
+
lastError: z4.string().nullable(),
|
|
216
|
+
createdAt: z4.number(),
|
|
217
|
+
deliveredAt: z4.number().nullable()
|
|
218
|
+
});
|
|
219
|
+
var rewardDeliveriesSchema = z4.object({
|
|
220
|
+
deliveries: z4.array(rewardDeliverySchema)
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
export {
|
|
224
|
+
pointLedgerPropertiesSchema,
|
|
225
|
+
createPointLedgerSchema,
|
|
226
|
+
pointLedgerSchema,
|
|
227
|
+
pointLedgerDeclarationSchema,
|
|
228
|
+
pointLedgerReferenceSchema,
|
|
229
|
+
interactionSchema,
|
|
230
|
+
questInteraction,
|
|
231
|
+
questTypeVersionSchema,
|
|
232
|
+
collectionSlotSchema,
|
|
233
|
+
collectionSlotDeclarationSchema,
|
|
234
|
+
questCollectionSchema,
|
|
235
|
+
questInstanceSchema,
|
|
236
|
+
questDraftChangesSchema,
|
|
237
|
+
questDraftSchema,
|
|
238
|
+
questCatalogSchema,
|
|
239
|
+
catalogDeploymentSchema,
|
|
240
|
+
catalogDeploymentPreviewSchema,
|
|
241
|
+
saveQuestDraftSchema,
|
|
242
|
+
publishQuestDraftSchema,
|
|
243
|
+
questRewardViewSchema,
|
|
244
|
+
questViewSchema,
|
|
245
|
+
collectionViewSchema,
|
|
246
|
+
questExperienceSchema,
|
|
247
|
+
questPublicationPreviewSchema,
|
|
248
|
+
allocateQuestSchema,
|
|
249
|
+
allocatedQuestSchema,
|
|
250
|
+
collectionCodeSchema,
|
|
251
|
+
collectionPassSchema,
|
|
252
|
+
collectionResolveSchema,
|
|
253
|
+
collectionBeginSchema,
|
|
254
|
+
collectionPreviewSchema,
|
|
255
|
+
rewardDeliverySchema,
|
|
256
|
+
rewardDeliveriesSchema
|
|
257
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
identifier
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-VARGF4JS.js";
|
|
4
4
|
|
|
5
5
|
// src/auth.ts
|
|
6
6
|
import { z } from "zod";
|
|
@@ -10,15 +10,33 @@ var authScopeSchema = z.object({
|
|
|
10
10
|
environment: z.enum(["test", "live"])
|
|
11
11
|
}).strict();
|
|
12
12
|
var principalSchema = z.discriminatedUnion("kind", [
|
|
13
|
-
z.object({ kind: z.literal("member"), member: identifier })
|
|
14
|
-
z.object({ kind: z.literal("staff"), subject: identifier })
|
|
15
|
-
z.object({ kind: z.literal("operator"), subject: identifier })
|
|
13
|
+
z.object({ kind: z.literal("member"), member: identifier }),
|
|
14
|
+
z.object({ kind: z.literal("staff"), subject: identifier }),
|
|
15
|
+
z.object({ kind: z.literal("operator"), subject: identifier })
|
|
16
16
|
]);
|
|
17
|
-
var sessionSchema =
|
|
17
|
+
var sessionSchema = z.object({
|
|
18
|
+
...authScopeSchema.shape,
|
|
18
19
|
id: identifier,
|
|
19
20
|
principal: principalSchema,
|
|
20
21
|
expiresAt: z.number()
|
|
21
22
|
});
|
|
23
|
+
var knownPrincipalKinds = principalSchema.options.map(
|
|
24
|
+
(option) => option.shape.kind.value
|
|
25
|
+
);
|
|
26
|
+
var participantPrincipalSchema = z.union([
|
|
27
|
+
principalSchema,
|
|
28
|
+
z.object({ kind: z.string().min(1) }).refine((principal) => !knownPrincipalKinds.includes(principal.kind))
|
|
29
|
+
]);
|
|
30
|
+
var participantSessionSchema = z.object({
|
|
31
|
+
...authScopeSchema.shape,
|
|
32
|
+
id: identifier,
|
|
33
|
+
principal: participantPrincipalSchema,
|
|
34
|
+
expiresAt: z.number()
|
|
35
|
+
});
|
|
36
|
+
function sessionMember(session) {
|
|
37
|
+
const principal = session?.principal;
|
|
38
|
+
return principal?.kind === "member" && "member" in principal ? principal.member : null;
|
|
39
|
+
}
|
|
22
40
|
var memberSummarySchema = z.object({
|
|
23
41
|
member: identifier,
|
|
24
42
|
avatarSeed: z.string().min(1).max(100)
|
|
@@ -36,6 +54,9 @@ export {
|
|
|
36
54
|
authScopeSchema,
|
|
37
55
|
principalSchema,
|
|
38
56
|
sessionSchema,
|
|
57
|
+
participantPrincipalSchema,
|
|
58
|
+
participantSessionSchema,
|
|
59
|
+
sessionMember,
|
|
39
60
|
memberSummarySchema,
|
|
40
61
|
exchangeSchema,
|
|
41
62
|
exchangeResultSchema
|