@domino-sdk/relay 0.15.0 → 0.16.1

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.
@@ -1,7 +1,7 @@
1
- import { O as Observation, T as TrackerReader, D as DiscordMember, a as DiscordMessage, W as WalletConnection, S as SolanaBalance, o as observationTriggerSchema, B as Budget, A as AuthoringIdentity, I as IntegrationProvider, b as StreakPolicy } from './settings-e0nHA0JA.js';
2
- export { c as customSource, d as defineLeaderboard, e as defineReferral, f as defineTracker, g as discord, p as pointLedgers, s as settings, h as streak, x } from './settings-e0nHA0JA.js';
1
+ import { O as Observation, T as TrackerReader, X as XReader, D as DiscordMember, a as DiscordMessage, W as WalletConnection, S as SolanaBalance, o as observationTriggerSchema, B as Budget, A as AuthoringIdentity, I as IntegrationProvider, b as StreakPolicy, c as TextEvidence, U as UrlEvidence, d as TextOptions, e as UrlOptions } from './submission-input-Cktvl71b.js';
2
+ export { f as customSource, g as defineLeaderboard, h as defineReferral, i as defineTracker, j as discord, p as pointLedgers, s as settings, k as streak, x } from './submission-input-Cktvl71b.js';
3
3
  import { z } from 'zod';
4
- import { PhotoResult, rewardSchema, triggerSchema, QuestPresentation, QuizEvidence, Decision, TieredRewardDefinition } from './schema.js';
4
+ import { TextReviewInput, TextResult, PhotoResult, rewardSchema, triggerSchema, QuestPresentation, QuizEvidence, Decision, TieredRewardDefinition } from './schema.js';
5
5
 
6
6
  type Reward = z.infer<typeof rewardSchema>;
7
7
  declare const points: (balance: string, amount: number) => {
@@ -15,10 +15,32 @@ declare const discordRole: (roleId: string) => {
15
15
  action: "grant-role";
16
16
  roleId: string;
17
17
  };
18
+
18
19
  declare const evidence: {
20
+ text: (options?: TextOptions) => {
21
+ input: "text";
22
+ constraints: {
23
+ required: boolean;
24
+ minLength: number;
25
+ maxLength: number;
26
+ };
27
+ };
28
+ url: (options?: UrlOptions) => {
29
+ input: "url";
30
+ constraints: {
31
+ required: boolean;
32
+ allowedHosts?: string[] | undefined;
33
+ };
34
+ };
19
35
  photo: () => "photo";
20
36
  quiz: () => "quiz";
21
37
  };
38
+ type ValueContract = ReturnType<typeof evidence.text> | ReturnType<typeof evidence.url>;
39
+ declare function manual<const I extends ValueContract>(options: {
40
+ input: I;
41
+ }): I & {
42
+ kind: "manual";
43
+ };
22
44
  declare function manual<const I extends "photo" | "quiz">(options: {
23
45
  input: I;
24
46
  }): {
@@ -138,7 +160,9 @@ type EvaluationContext<T, I = {
138
160
  observation: Observation | null;
139
161
  eligibleAt: number;
140
162
  trackers: TrackerReader;
163
+ x: XReader;
141
164
  review: {
165
+ text(options: TextReviewInput): Promise<TextResult>;
142
166
  photo(options: {
143
167
  image: string;
144
168
  criteria: string;
@@ -177,7 +201,11 @@ type QuestInput<T extends Trigger> = T extends {
177
201
  photo: string;
178
202
  } : T extends {
179
203
  input: "quiz";
180
- } ? QuizEvidence : Record<string, never>;
204
+ } ? QuizEvidence : T extends {
205
+ input: "text";
206
+ } ? TextEvidence : T extends {
207
+ input: "url";
208
+ } ? UrlEvidence : Record<string, never>;
181
209
  declare function defineQuest<T extends Record<string, z.ZodType>, const G extends Trigger>(definition: AuthoringIdentity & {
182
210
  title: string | ((ctx: {
183
211
  settings: z.output<z.ZodObject<T>>;
@@ -335,6 +363,23 @@ declare function defineQuest<T extends Record<string, z.ZodType>, const G extend
335
363
  })[];
336
364
  humanReview: boolean;
337
365
  trigger: {
366
+ kind: "manual";
367
+ input: "text";
368
+ constraints: {
369
+ required: boolean;
370
+ minLength: number;
371
+ maxLength: number;
372
+ };
373
+ actor?: "staff" | "member" | undefined;
374
+ } | {
375
+ kind: "manual";
376
+ input: "url";
377
+ constraints: {
378
+ required: boolean;
379
+ allowedHosts?: string[] | undefined;
380
+ };
381
+ actor?: "staff" | "member" | undefined;
382
+ } | {
338
383
  kind: "manual";
339
384
  input: "photo" | "quiz" | "none";
340
385
  actor?: "staff" | "member" | undefined;
package/dist/authoring.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  defineReferral,
6
6
  defineTracker,
7
7
  x
8
- } from "./chunk-CJARNIVP.js";
8
+ } from "./chunk-XNS25KST.js";
9
9
  import {
10
10
  budgetSchema,
11
11
  decisionSchema,
@@ -20,9 +20,11 @@ import {
20
20
  settingFieldSchema,
21
21
  settings,
22
22
  streak,
23
+ textOptionsSchema,
23
24
  tierRewardSchema,
24
- tieredRewardDefinitionSchema
25
- } from "./chunk-FUQYKTOJ.js";
25
+ tieredRewardDefinitionSchema,
26
+ urlOptionsSchema
27
+ } from "./chunk-YUAE6PFY.js";
26
28
 
27
29
  // src/authoring.ts
28
30
  import { z } from "zod";
@@ -34,10 +36,21 @@ var discordRole = (roleId) => integrationRewardSchema.parse({
34
36
  roleId
35
37
  });
36
38
  var evidence = {
39
+ text: (options = {}) => ({
40
+ input: "text",
41
+ constraints: textOptionsSchema.parse(options)
42
+ }),
43
+ url: (options = {}) => ({
44
+ input: "url",
45
+ constraints: urlOptionsSchema.parse(options)
46
+ }),
37
47
  photo: () => "photo",
38
48
  quiz: () => "quiz"
39
49
  };
40
50
  function manual(options) {
51
+ if (typeof options?.input === "object") {
52
+ return { kind: "manual", ...options.input };
53
+ }
41
54
  return {
42
55
  kind: "manual",
43
56
  input: options?.input ?? "none",
@@ -172,6 +185,7 @@ function defineQuest(definition) {
172
185
  review: ctx.review,
173
186
  trackers: ctx.trackers,
174
187
  wallet: ctx.wallet,
188
+ x: ctx.x,
175
189
  discord: ctx.discord
176
190
  }) : decision.accept();
177
191
  if (!result) {