@domino-sdk/relay 1.0.0-next.6 → 1.0.0-next.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +13 -1
  2. package/build.mjs +18 -1
  3. package/dist/authoring.d.ts +316 -14
  4. package/dist/authoring.js +177 -23
  5. package/dist/avatar.d.ts +29 -0
  6. package/dist/avatar.js +21 -0
  7. package/dist/browser.d.ts +168 -165
  8. package/dist/browser.js +6 -6
  9. package/dist/catalog-C09gnPYT.d.ts +3948 -0
  10. package/dist/chunk-7HSTFBMO.js +24 -0
  11. package/dist/{chunk-5IIWKDFX.js → chunk-ADSP377G.js} +1 -1
  12. package/dist/{chunk-RTHN22KO.js → chunk-AWLLGCKU.js} +2 -2
  13. package/dist/chunk-DJZB5RY5.js +901 -0
  14. package/dist/chunk-SKETUPST.js +171 -0
  15. package/dist/chunk-UFXBQ6FN.js +257 -0
  16. package/dist/{chunk-BRESOTKV.js → chunk-UW6R2QGT.js} +604 -723
  17. package/dist/chunk-V7UKZLHA.js +35 -0
  18. package/dist/{chunk-ERBVT7GE.js → chunk-X6FJIPXR.js} +166 -724
  19. package/dist/client-BufGakEt.d.ts +4577 -0
  20. package/dist/collection-BGneJ6Bk.d.ts +114 -0
  21. package/dist/images-e6FW9QSx.d.ts +234 -0
  22. package/dist/index.d.ts +11 -13132
  23. package/dist/index.js +11 -693
  24. package/dist/integrations-C3Sp558f.d.ts +1297 -0
  25. package/dist/internal.d.ts +109 -0
  26. package/dist/internal.js +104 -0
  27. package/dist/point-ledgers-iS00Z_v0.d.ts +37 -0
  28. package/dist/portal-proxy.js +5 -6
  29. package/dist/profiles-BtOXMGcC.d.ts +297 -0
  30. package/dist/react/index.d.ts +37 -34
  31. package/dist/react/index.js +7 -13
  32. package/dist/schema-DCapSPHz.d.ts +3396 -0
  33. package/dist/schema.d.ts +3194 -2372
  34. package/dist/schema.js +539 -3
  35. package/dist/streaks-CwGReWGt.d.ts +73 -0
  36. package/dist/submission-input-Bter6XiI.d.ts +2672 -0
  37. package/dist/units-CwgsPB_r.d.ts +9 -0
  38. package/dist/wallet-Bu6sqJvQ.d.ts +231 -0
  39. package/package.json +17 -4
  40. package/dist/chunk-XEQDW7FM.js +0 -373
  41. package/dist/chunk-ZKJBCQNI.js +0 -624
  42. package/dist/submission-input-CZDukyb3.d.ts +0 -4998
@@ -0,0 +1,171 @@
1
+ import {
2
+ identifier,
3
+ xTweetSchema
4
+ } from "./chunk-UW6R2QGT.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-DJZB5RY5.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-UW6R2QGT.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
+ };