@domino-sdk/relay 0.2.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 CHANGED
@@ -13,7 +13,9 @@ export async function buildQuest(entry, options = {}) {
13
13
  stdin: {
14
14
  contents: `export { ${options.exportName} as default } from ${JSON.stringify(resolve(entry))};`,
15
15
  resolveDir: dirname(resolve(entry)),
16
- loader: "ts",
16
+ // This wrapper contains only JavaScript. A TS loader can erase a
17
+ // missing export as a type-only export and silently emit no quest.
18
+ loader: "js",
17
19
  },
18
20
  }
19
21
  : { entryPoints: [entry] }),
@@ -1,7 +1,7 @@
1
+ import { D as DiscordMember, W as WalletConnection, S as SolanaBalance, I as IntegrationProvider } from './settings-B7vsT8nd.js';
2
+ export { d as defineLeaderboard, a as defineReferral, s as settings } from './settings-B7vsT8nd.js';
1
3
  import { z } from 'zod';
2
4
  import { PhotoResult, rewardSchema, triggerSchema, QuestPresentation, QuizEvidence, Decision, TieredRewardDefinition } from './schema.js';
3
- import { W as WalletConnection, S as SolanaBalance } from './settings-BEbCiuhH.js';
4
- export { s as settings } from './settings-BEbCiuhH.js';
5
5
 
6
6
  type Reward = z.infer<typeof rewardSchema>;
7
7
  declare const points: (balance: string, amount: number) => {
@@ -106,6 +106,9 @@ type EvaluationContext<T, I = {
106
106
  criteria: string;
107
107
  }): Promise<PhotoResult>;
108
108
  };
109
+ discord: {
110
+ member(): Promise<DiscordMember | null>;
111
+ };
109
112
  wallet: {
110
113
  connection(): Promise<WalletConnection | null>;
111
114
  solanaBalance(): Promise<SolanaBalance | null>;
@@ -143,6 +146,7 @@ declare function defineQuest<T extends Record<string, z.ZodType>, const G extend
143
146
  settings: z.output<z.ZodObject<T>>;
144
147
  }) => QuestPresentation;
145
148
  trigger: G;
149
+ integrations?: IntegrationProvider[];
146
150
  requires?: ReturnType<typeof completed>[];
147
151
  completion: ReturnType<typeof once>;
148
152
  review?: (ctx: {
@@ -180,6 +184,7 @@ declare function defineQuest<T extends Record<string, z.ZodType>, const G extend
180
184
  } | undefined;
181
185
  } | undefined;
182
186
  };
187
+ integrations: "discord"[];
183
188
  fields: Record<string, {
184
189
  kind: "quiz";
185
190
  default: {
package/dist/authoring.js CHANGED
@@ -1,3 +1,7 @@
1
+ import {
2
+ defineLeaderboard,
3
+ defineReferral
4
+ } from "./chunk-TXL43HL3.js";
1
5
  import {
2
6
  decisionSchema,
3
7
  parseSettings,
@@ -9,7 +13,7 @@ import {
9
13
  settings,
10
14
  tierRewardSchema,
11
15
  tieredRewardDefinitionSchema
12
- } from "./chunk-C2KOMNLG.js";
16
+ } from "./chunk-3IQ4KUKF.js";
13
17
 
14
18
  // src/authoring.ts
15
19
  import { z } from "zod";
@@ -105,6 +109,7 @@ function defineQuest(definition) {
105
109
  rewards,
106
110
  humanReview: definition.review?.({ settings: settings2 })?.enabled ?? true,
107
111
  trigger: definition.trigger,
112
+ integrations: definition.integrations ?? [],
108
113
  completion: definition.completion,
109
114
  requires: definition.requires ?? []
110
115
  });
@@ -119,7 +124,8 @@ function defineQuest(definition) {
119
124
  member: ctx.member,
120
125
  input: ctx.input,
121
126
  review: ctx.review,
122
- wallet: ctx.wallet
127
+ wallet: ctx.wallet,
128
+ discord: ctx.discord
123
129
  }) : decision.accept();
124
130
  if (!result) throw new Error("Evaluator returned no decision");
125
131
  if (result.kind === "review" && !ctx.humanReview)
@@ -135,8 +141,10 @@ export {
135
141
  automatic,
136
142
  completed,
137
143
  decision,
144
+ defineLeaderboard,
138
145
  defineQuest,
139
146
  defineQuestType,
147
+ defineReferral,
140
148
  defineTieredReward,
141
149
  evaluators,
142
150
  evidence,
package/dist/browser.d.ts CHANGED
@@ -1,10 +1,317 @@
1
1
  import { SubmitInput, ReviewListOptions, MemberListOptions, ReleaseInput, beginHandoverSchema } from './schema.js';
2
2
  import { SubmissionStore, createRelayClient, QuestView, QuestController, ProgressObservation, questExperienceSchema, ProgressObserver, ExchangeInput, PhotoSubmission, QuizSubmission, ClaimSubmission } from './index.js';
3
- import { w as walletChallengeInputSchema, a as walletProofSchema } from './settings-BEbCiuhH.js';
3
+ import { r as referralAcceptSchema, L as LeaderboardQuery, w as walletChallengeInputSchema, b as walletProofSchema, A as AuthProvider } from './settings-B7vsT8nd.js';
4
4
  import * as zod from 'zod';
5
5
 
6
6
  /** Browser client with durable submission recovery; safe to construct during SSR. */
7
7
  declare function createBrowserRelayClient(options: Parameters<typeof createRelayClient>[0]): {
8
+ referrals: {
9
+ list: () => Promise<{
10
+ id: string;
11
+ title: string;
12
+ enabled: boolean;
13
+ qualification: {
14
+ kind: "signup";
15
+ } | {
16
+ kind: "quest";
17
+ quest: string;
18
+ } | {
19
+ kind: "external";
20
+ };
21
+ rewards: {
22
+ inviter: ({
23
+ kind: "tier";
24
+ reward: {
25
+ id: string;
26
+ title: string;
27
+ tiers: {
28
+ id: string;
29
+ title: string;
30
+ }[];
31
+ inventory: {
32
+ kind: "untracked";
33
+ };
34
+ fulfillment: {
35
+ kind: "staff-handover";
36
+ };
37
+ };
38
+ tier: string;
39
+ } | {
40
+ kind: "points";
41
+ balance: string;
42
+ amount: number;
43
+ })[];
44
+ invitee: ({
45
+ kind: "tier";
46
+ reward: {
47
+ id: string;
48
+ title: string;
49
+ tiers: {
50
+ id: string;
51
+ title: string;
52
+ }[];
53
+ inventory: {
54
+ kind: "untracked";
55
+ };
56
+ fulfillment: {
57
+ kind: "staff-handover";
58
+ };
59
+ };
60
+ tier: string;
61
+ } | {
62
+ kind: "points";
63
+ balance: string;
64
+ amount: number;
65
+ })[];
66
+ };
67
+ milestones: {
68
+ id: string;
69
+ count: number;
70
+ rewards: ({
71
+ kind: "tier";
72
+ reward: {
73
+ id: string;
74
+ title: string;
75
+ tiers: {
76
+ id: string;
77
+ title: string;
78
+ }[];
79
+ inventory: {
80
+ kind: "untracked";
81
+ };
82
+ fulfillment: {
83
+ kind: "staff-handover";
84
+ };
85
+ };
86
+ tier: string;
87
+ } | {
88
+ kind: "points";
89
+ balance: string;
90
+ amount: number;
91
+ })[];
92
+ }[];
93
+ bonuses: {
94
+ id: string;
95
+ balance: string;
96
+ basisPoints: number;
97
+ external: boolean;
98
+ quests?: string[] | undefined;
99
+ durationDays?: number | undefined;
100
+ maxPoints?: number | undefined;
101
+ }[];
102
+ inviterGroup?: string | undefined;
103
+ }[]>;
104
+ summary: () => Promise<{
105
+ code: string;
106
+ attributed: number;
107
+ programs: {
108
+ definition: {
109
+ id: string;
110
+ title: string;
111
+ enabled: boolean;
112
+ qualification: {
113
+ kind: "signup";
114
+ } | {
115
+ kind: "quest";
116
+ quest: string;
117
+ } | {
118
+ kind: "external";
119
+ };
120
+ rewards: {
121
+ inviter: ({
122
+ kind: "tier";
123
+ reward: {
124
+ id: string;
125
+ title: string;
126
+ tiers: {
127
+ id: string;
128
+ title: string;
129
+ }[];
130
+ inventory: {
131
+ kind: "untracked";
132
+ };
133
+ fulfillment: {
134
+ kind: "staff-handover";
135
+ };
136
+ };
137
+ tier: string;
138
+ } | {
139
+ kind: "points";
140
+ balance: string;
141
+ amount: number;
142
+ })[];
143
+ invitee: ({
144
+ kind: "tier";
145
+ reward: {
146
+ id: string;
147
+ title: string;
148
+ tiers: {
149
+ id: string;
150
+ title: string;
151
+ }[];
152
+ inventory: {
153
+ kind: "untracked";
154
+ };
155
+ fulfillment: {
156
+ kind: "staff-handover";
157
+ };
158
+ };
159
+ tier: string;
160
+ } | {
161
+ kind: "points";
162
+ balance: string;
163
+ amount: number;
164
+ })[];
165
+ };
166
+ milestones: {
167
+ id: string;
168
+ count: number;
169
+ rewards: ({
170
+ kind: "tier";
171
+ reward: {
172
+ id: string;
173
+ title: string;
174
+ tiers: {
175
+ id: string;
176
+ title: string;
177
+ }[];
178
+ inventory: {
179
+ kind: "untracked";
180
+ };
181
+ fulfillment: {
182
+ kind: "staff-handover";
183
+ };
184
+ };
185
+ tier: string;
186
+ } | {
187
+ kind: "points";
188
+ balance: string;
189
+ amount: number;
190
+ })[];
191
+ }[];
192
+ bonuses: {
193
+ id: string;
194
+ balance: string;
195
+ basisPoints: number;
196
+ external: boolean;
197
+ quests?: string[] | undefined;
198
+ durationDays?: number | undefined;
199
+ maxPoints?: number | undefined;
200
+ }[];
201
+ inviterGroup?: string | undefined;
202
+ };
203
+ qualified: number;
204
+ milestones: {
205
+ id: string;
206
+ count: number;
207
+ reached: boolean;
208
+ }[];
209
+ }[];
210
+ accounts: {
211
+ id: string;
212
+ program: string;
213
+ kind: "fixed" | "bonus" | "milestone";
214
+ balance: string;
215
+ earned: number;
216
+ settled: number;
217
+ outstanding: number;
218
+ }[];
219
+ }>;
220
+ history: (before?: number) => Promise<{
221
+ items: {
222
+ id: number;
223
+ program: string;
224
+ balance: string;
225
+ amount: number;
226
+ at: number;
227
+ reason: string;
228
+ }[];
229
+ next: number | null;
230
+ }>;
231
+ accept: (input: zod.input<typeof referralAcceptSchema>) => Promise<{
232
+ ok: true;
233
+ }>;
234
+ };
235
+ leaderboards: {
236
+ list: () => Promise<{
237
+ id: string;
238
+ title: string;
239
+ balance: string;
240
+ score: {
241
+ kind: "balance";
242
+ } | {
243
+ window: {
244
+ kind: "fixed";
245
+ start: number;
246
+ end: number;
247
+ } | {
248
+ kind: "all-time";
249
+ } | {
250
+ kind: "rolling";
251
+ days: number;
252
+ } | {
253
+ kind: "calendar";
254
+ period: "day" | "week" | "month";
255
+ timeZone: string;
256
+ };
257
+ kind: "earned";
258
+ quests?: string[] | undefined;
259
+ } | {
260
+ kind: "net";
261
+ window: {
262
+ kind: "fixed";
263
+ start: number;
264
+ end: number;
265
+ } | {
266
+ kind: "all-time";
267
+ } | {
268
+ kind: "rolling";
269
+ days: number;
270
+ } | {
271
+ kind: "calendar";
272
+ period: "day" | "week" | "month";
273
+ timeZone: string;
274
+ };
275
+ };
276
+ access: "participants" | "public";
277
+ group?: string | undefined;
278
+ }[]>;
279
+ standings: (board: string, options?: LeaderboardQuery) => Promise<{
280
+ leaderboard: string;
281
+ title: string;
282
+ version: string;
283
+ calculation: "balance" | "earned" | "net";
284
+ period: {
285
+ start: number | null;
286
+ end: number | null;
287
+ };
288
+ calculatedAt: number;
289
+ lastEntryAt: number | null;
290
+ total: number;
291
+ items: {
292
+ participant: string;
293
+ name: string;
294
+ score: number;
295
+ rank: number;
296
+ member?: string | undefined;
297
+ }[];
298
+ me: {
299
+ participant: string;
300
+ name: string;
301
+ score: number;
302
+ rank: number;
303
+ member?: string | undefined;
304
+ } | null;
305
+ nearby: {
306
+ participant: string;
307
+ name: string;
308
+ score: number;
309
+ rank: number;
310
+ member?: string | undefined;
311
+ }[];
312
+ nextCursor: string | null;
313
+ }>;
314
+ };
8
315
  quests: {
9
316
  get: (id: string) => Promise<{
10
317
  quest: string;
@@ -29,6 +336,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
29
336
  } | undefined;
30
337
  } | undefined;
31
338
  };
339
+ connections: ("google" | "apple" | "x" | "discord")[];
32
340
  trigger: {
33
341
  kind: "manual";
34
342
  input: "quiz" | "photo" | "none";
@@ -182,6 +490,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
182
490
  } | undefined;
183
491
  } | undefined;
184
492
  };
493
+ connections: ("google" | "apple" | "x" | "discord")[];
185
494
  trigger: {
186
495
  kind: "manual";
187
496
  input: "quiz" | "photo" | "none";
@@ -294,6 +603,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
294
603
  } | undefined;
295
604
  } | undefined;
296
605
  };
606
+ connections: ("google" | "apple" | "x" | "discord")[];
297
607
  trigger: {
298
608
  kind: "manual";
299
609
  input: "quiz" | "photo" | "none";
@@ -408,6 +718,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
408
718
  } | undefined;
409
719
  } | undefined;
410
720
  };
721
+ connections: ("google" | "apple" | "x" | "discord")[];
411
722
  trigger: {
412
723
  kind: "manual";
413
724
  input: "quiz" | "photo" | "none";
@@ -531,7 +842,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
531
842
  email: boolean;
532
843
  demo: boolean;
533
844
  }>;
534
- start: (provider: "google" | "apple" | "x" | "discord", mode: "sign-in" | "connect") => Promise<{
845
+ start: (provider: AuthProvider, mode: "sign-in" | "connect") => Promise<{
535
846
  url: string;
536
847
  }>;
537
848
  emailStart: (email: string) => Promise<{
@@ -554,6 +865,16 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
554
865
  };
555
866
  expiresAt: number;
556
867
  }>;
868
+ accounts: () => Promise<{
869
+ provider: "google" | "apple" | "x" | "discord";
870
+ configured: boolean;
871
+ status: "disconnected" | "connected" | "reconnect";
872
+ subject: string | null;
873
+ revision: number;
874
+ }[]>;
875
+ disconnect: (provider: AuthProvider) => Promise<{
876
+ ok: boolean;
877
+ }>;
557
878
  connections: () => Promise<{
558
879
  provider: string;
559
880
  subject: string;
@@ -711,6 +1032,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
711
1032
  } | undefined;
712
1033
  } | undefined;
713
1034
  };
1035
+ connections: ("google" | "apple" | "x" | "discord")[];
714
1036
  trigger: {
715
1037
  kind: "manual";
716
1038
  input: "quiz" | "photo" | "none";
@@ -1024,6 +1346,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
1024
1346
  } | undefined;
1025
1347
  } | undefined;
1026
1348
  };
1349
+ integrations: "discord"[];
1027
1350
  fields: Record<string, {
1028
1351
  kind: "quiz";
1029
1352
  default: {
@@ -1138,6 +1461,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
1138
1461
  } | undefined;
1139
1462
  } | undefined;
1140
1463
  };
1464
+ integrations: "discord"[];
1141
1465
  fields: Record<string, {
1142
1466
  kind: "quiz";
1143
1467
  default: {
@@ -1251,6 +1575,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
1251
1575
  } | undefined;
1252
1576
  } | undefined;
1253
1577
  };
1578
+ integrations: "discord"[];
1254
1579
  fields: Record<string, {
1255
1580
  kind: "quiz";
1256
1581
  default: {
@@ -1532,6 +1857,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
1532
1857
  } | undefined;
1533
1858
  } | undefined;
1534
1859
  };
1860
+ integrations: "discord"[];
1535
1861
  fields: Record<string, {
1536
1862
  kind: "quiz";
1537
1863
  default: {
@@ -1673,6 +1999,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
1673
1999
  } | undefined;
1674
2000
  } | undefined;
1675
2001
  };
2002
+ integrations: "discord"[];
1676
2003
  fields: Record<string, {
1677
2004
  kind: "quiz";
1678
2005
  default: {
@@ -1815,6 +2142,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
1815
2142
  } | undefined;
1816
2143
  } | undefined;
1817
2144
  };
2145
+ connections: ("google" | "apple" | "x" | "discord")[];
1818
2146
  trigger: {
1819
2147
  kind: "manual";
1820
2148
  input: "quiz" | "photo" | "none";
package/dist/browser.js CHANGED
@@ -1,7 +1,9 @@
1
1
  import {
2
2
  createRelayClient
3
- } from "./chunk-NC3UAP6T.js";
4
- import "./chunk-C2KOMNLG.js";
3
+ } from "./chunk-KQVL6MOH.js";
4
+ import "./chunk-TXL43HL3.js";
5
+ import "./chunk-QWRSUSNB.js";
6
+ import "./chunk-3IQ4KUKF.js";
5
7
 
6
8
  // src/browser.ts
7
9
  function createBrowserRelayClient(options) {