@domino-sdk/relay 0.7.0 → 0.9.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/dist/authoring.d.ts +13 -9
- package/dist/authoring.js +19 -9
- package/dist/browser.d.ts +38 -9
- package/dist/browser.js +4 -4
- package/dist/{chunk-36LZ3IOO.js → chunk-MVDE7WKB.js} +1 -1
- package/dist/chunk-Q5VDZVVO.js +388 -0
- package/dist/{chunk-6QUCADMF.js → chunk-XTFCKK2Y.js} +37 -5
- package/dist/{chunk-LXLNC4CN.js → chunk-Y6H4HDQT.js} +42 -28
- package/dist/index.d.ts +854 -114
- package/dist/index.js +28 -6
- package/dist/portal-proxy.js +2 -2
- package/dist/schema.d.ts +45 -19
- package/dist/schema.js +7 -1
- package/dist/{settings-CU_oBcx0.d.ts → settings-BA8XjT4m.d.ts} +766 -23
- package/package.json +1 -1
- package/dist/chunk-TYVT5BPZ.js +0 -337
package/dist/authoring.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { O as Observation, D as DiscordMember, a as DiscordMessage, W as WalletConnection, S as SolanaBalance, o as observationTriggerSchema, B as Budget, I as IntegrationProvider } from './settings-
|
|
2
|
-
export { d as defineLeaderboard, b as defineReferral, c as discord, s as settings } from './settings-
|
|
1
|
+
import { O as Observation, D as DiscordMember, a as DiscordMessage, W as WalletConnection, S as SolanaBalance, o as observationTriggerSchema, B as Budget, A as AuthoringIdentity, I as IntegrationProvider } from './settings-BA8XjT4m.js';
|
|
2
|
+
export { d as defineLeaderboard, b as defineReferral, c as discord, p as pointLedgers, s as settings } from './settings-BA8XjT4m.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { PhotoResult, rewardSchema, triggerSchema, QuestPresentation, QuizEvidence, Decision, TieredRewardDefinition } from './schema.js';
|
|
5
5
|
|
|
@@ -68,9 +68,7 @@ declare const keyed: (key: (ctx: {
|
|
|
68
68
|
eligibleAt: number;
|
|
69
69
|
}) => string;
|
|
70
70
|
};
|
|
71
|
-
declare const completed: (quest: {
|
|
72
|
-
id: string;
|
|
73
|
-
} | string) => {
|
|
71
|
+
declare const completed: (quest: AuthoringIdentity | string) => {
|
|
74
72
|
quest: string;
|
|
75
73
|
scope: "ever";
|
|
76
74
|
};
|
|
@@ -80,7 +78,9 @@ declare const untracked: () => {
|
|
|
80
78
|
declare const staffHandover: () => {
|
|
81
79
|
kind: "staff-handover";
|
|
82
80
|
};
|
|
83
|
-
declare function defineTieredReward(input: TieredRewardDefinition): {
|
|
81
|
+
declare function defineTieredReward(input: Omit<TieredRewardDefinition, "id"> & AuthoringIdentity): {
|
|
82
|
+
key: string;
|
|
83
|
+
/** @deprecated Authoring key alias. Use key. */
|
|
84
84
|
id: string;
|
|
85
85
|
tier: (tier: string) => {
|
|
86
86
|
kind: "tier";
|
|
@@ -177,8 +177,7 @@ type QuestInput<T extends Trigger> = T extends {
|
|
|
177
177
|
} : T extends {
|
|
178
178
|
input: "quiz";
|
|
179
179
|
} ? QuizEvidence : Record<string, never>;
|
|
180
|
-
declare function defineQuest<T extends Record<string, z.ZodType>, const G extends Trigger>(definition: {
|
|
181
|
-
id: string;
|
|
180
|
+
declare function defineQuest<T extends Record<string, z.ZodType>, const G extends Trigger>(definition: AuthoringIdentity & {
|
|
182
181
|
title: string | ((ctx: {
|
|
183
182
|
settings: z.output<z.ZodObject<T>>;
|
|
184
183
|
}) => string);
|
|
@@ -202,6 +201,8 @@ declare function defineQuest<T extends Record<string, z.ZodType>, const G extend
|
|
|
202
201
|
}) => Reward[]);
|
|
203
202
|
evaluate?: Evaluator<z.output<z.ZodObject<T>>, QuestInput<G>>;
|
|
204
203
|
}): {
|
|
204
|
+
key: string;
|
|
205
|
+
/** @deprecated Authoring key alias. Use key. */
|
|
205
206
|
id: string;
|
|
206
207
|
describe: (input: unknown) => {
|
|
207
208
|
quest: string;
|
|
@@ -242,6 +243,9 @@ declare function defineQuest<T extends Record<string, z.ZodType>, const G extend
|
|
|
242
243
|
kind: "resource";
|
|
243
244
|
default: string;
|
|
244
245
|
source: {
|
|
246
|
+
provider: "domino";
|
|
247
|
+
resource: "point-ledger";
|
|
248
|
+
} | {
|
|
245
249
|
provider: "discord";
|
|
246
250
|
resource: "channel";
|
|
247
251
|
types: ("text" | "announcement")[];
|
|
@@ -365,7 +369,7 @@ declare function defineQuest<T extends Record<string, z.ZodType>, const G extend
|
|
|
365
369
|
humanReview: boolean;
|
|
366
370
|
}): Promise<Decision>;
|
|
367
371
|
};
|
|
368
|
-
/** Publish this artifact as a reusable type. Its
|
|
372
|
+
/** Publish this artifact as a reusable type. Its key names the type;
|
|
369
373
|
* Console instances receive independent quest identities and pinned versions. */
|
|
370
374
|
declare const defineQuestType: typeof defineQuest;
|
|
371
375
|
|
package/dist/authoring.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
|
+
authoringKey,
|
|
2
3
|
defineLeaderboard,
|
|
3
4
|
defineReferral
|
|
4
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-Q5VDZVVO.js";
|
|
5
6
|
import {
|
|
6
7
|
budgetSchema,
|
|
7
8
|
decisionSchema,
|
|
8
9
|
discord,
|
|
9
10
|
integrationRewardSchema,
|
|
10
11
|
parseSettings,
|
|
12
|
+
pointLedgers,
|
|
11
13
|
pointsRewardSchema,
|
|
12
14
|
questDescriptionSchema,
|
|
13
15
|
quizAnswersSchema,
|
|
@@ -16,7 +18,7 @@ import {
|
|
|
16
18
|
settings,
|
|
17
19
|
tierRewardSchema,
|
|
18
20
|
tieredRewardDefinitionSchema
|
|
19
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-XTFCKK2Y.js";
|
|
20
22
|
|
|
21
23
|
// src/authoring.ts
|
|
22
24
|
import { z } from "zod";
|
|
@@ -45,14 +47,18 @@ var automatic = (observation) => ({
|
|
|
45
47
|
var budget = (definition) => budgetSchema.parse(definition);
|
|
46
48
|
var keyed = (key) => ({ kind: "keyed", key });
|
|
47
49
|
var completed = (quest) => ({
|
|
48
|
-
quest: typeof quest === "string" ? quest : quest
|
|
50
|
+
quest: typeof quest === "string" ? quest : authoringKey(quest),
|
|
49
51
|
scope: "ever"
|
|
50
52
|
});
|
|
51
53
|
var untracked = () => ({ kind: "untracked" });
|
|
52
54
|
var staffHandover = () => ({ kind: "staff-handover" });
|
|
53
55
|
function defineTieredReward(input) {
|
|
54
|
-
const
|
|
56
|
+
const { key: _, id: __, ...properties } = input;
|
|
57
|
+
const key = authoringKey(input);
|
|
58
|
+
const reward = tieredRewardDefinitionSchema.parse({ id: key, ...properties });
|
|
55
59
|
return {
|
|
60
|
+
key: reward.id,
|
|
61
|
+
/** @deprecated Authoring key alias. Use key. */
|
|
56
62
|
id: reward.id,
|
|
57
63
|
tier: (tier) => tierRewardSchema.parse({ kind: "tier", reward, tier })
|
|
58
64
|
};
|
|
@@ -99,11 +105,12 @@ var evaluators = {
|
|
|
99
105
|
}
|
|
100
106
|
};
|
|
101
107
|
function defineQuest(definition) {
|
|
108
|
+
const key = authoringKey(definition);
|
|
102
109
|
if (definition.trigger.kind === "manual" && definition.trigger.input !== "none" && !definition.evaluate)
|
|
103
110
|
throw new Error("Evidence quests require an evaluator");
|
|
104
111
|
const fields = Object.fromEntries(
|
|
105
|
-
Object.entries(definition.settings.shape).map(([
|
|
106
|
-
|
|
112
|
+
Object.entries(definition.settings.shape).map(([key2, schema]) => [
|
|
113
|
+
key2,
|
|
107
114
|
settingFieldSchema.parse(schema.meta())
|
|
108
115
|
])
|
|
109
116
|
);
|
|
@@ -114,7 +121,7 @@ function defineQuest(definition) {
|
|
|
114
121
|
typeof definition.rewards === "function" ? definition.rewards({ settings: settings2 }) : definition.rewards
|
|
115
122
|
);
|
|
116
123
|
return questDescriptionSchema.parse({
|
|
117
|
-
quest:
|
|
124
|
+
quest: key,
|
|
118
125
|
runtimeVersion: 2,
|
|
119
126
|
title: typeof definition.title === "function" ? definition.title({ settings: settings2 }) : definition.title,
|
|
120
127
|
presentation: definition.presentation?.({ settings: settings2 }) ?? {},
|
|
@@ -130,7 +137,7 @@ function defineQuest(definition) {
|
|
|
130
137
|
(reward) => reward.kind === "integration" ? [reward.provider] : []
|
|
131
138
|
),
|
|
132
139
|
...Object.values(fields).flatMap(
|
|
133
|
-
(field) => field.kind === "resource" ? [field.source.provider] : []
|
|
140
|
+
(field) => field.kind === "resource" && field.source.provider !== "domino" ? [field.source.provider] : []
|
|
134
141
|
)
|
|
135
142
|
])
|
|
136
143
|
],
|
|
@@ -141,7 +148,9 @@ function defineQuest(definition) {
|
|
|
141
148
|
});
|
|
142
149
|
}
|
|
143
150
|
return {
|
|
144
|
-
|
|
151
|
+
key,
|
|
152
|
+
/** @deprecated Authoring key alias. Use key. */
|
|
153
|
+
id: key,
|
|
145
154
|
describe,
|
|
146
155
|
async evaluate(ctx) {
|
|
147
156
|
const settings2 = definition.settings.parse(ctx.settings);
|
|
@@ -186,6 +195,7 @@ export {
|
|
|
186
195
|
keyed,
|
|
187
196
|
manual,
|
|
188
197
|
once,
|
|
198
|
+
pointLedgers,
|
|
189
199
|
points,
|
|
190
200
|
settings,
|
|
191
201
|
staffHandover,
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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 { r as referralAcceptSchema, L as LeaderboardQuery, w as walletChallengeInputSchema, e as walletProofSchema,
|
|
3
|
+
import { r as referralAcceptSchema, L as LeaderboardQuery, w as walletChallengeInputSchema, e as walletProofSchema, f as AuthProvider } from './settings-BA8XjT4m.js';
|
|
4
4
|
import * as zod from 'zod';
|
|
5
5
|
|
|
6
6
|
/** Browser client with durable submission recovery; safe to construct during SSR. */
|
|
@@ -99,6 +99,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
|
|
|
99
99
|
durationDays?: number | undefined;
|
|
100
100
|
maxPoints?: number | undefined;
|
|
101
101
|
}[];
|
|
102
|
+
key?: string | undefined;
|
|
102
103
|
inviterGroup?: string | undefined;
|
|
103
104
|
}[]>;
|
|
104
105
|
summary: () => Promise<{
|
|
@@ -198,6 +199,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
|
|
|
198
199
|
durationDays?: number | undefined;
|
|
199
200
|
maxPoints?: number | undefined;
|
|
200
201
|
}[];
|
|
202
|
+
key?: string | undefined;
|
|
201
203
|
inviterGroup?: string | undefined;
|
|
202
204
|
};
|
|
203
205
|
qualified: number;
|
|
@@ -274,6 +276,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
|
|
|
274
276
|
};
|
|
275
277
|
};
|
|
276
278
|
access: "participants" | "public";
|
|
279
|
+
key?: string | undefined;
|
|
277
280
|
group?: string | undefined;
|
|
278
281
|
}[]>;
|
|
279
282
|
standings: (board: string, options?: LeaderboardQuery) => Promise<{
|
|
@@ -442,6 +445,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
|
|
|
442
445
|
rewards: {
|
|
443
446
|
label: string;
|
|
444
447
|
}[];
|
|
448
|
+
key?: string | undefined;
|
|
445
449
|
}>;
|
|
446
450
|
retry: (view: QuestView) => Promise<{
|
|
447
451
|
id: string;
|
|
@@ -621,6 +625,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
|
|
|
621
625
|
rewards: {
|
|
622
626
|
label: string;
|
|
623
627
|
}[];
|
|
628
|
+
key?: string | undefined;
|
|
624
629
|
}[];
|
|
625
630
|
collections: {
|
|
626
631
|
id: string;
|
|
@@ -754,7 +759,9 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
|
|
|
754
759
|
rewards: {
|
|
755
760
|
label: string;
|
|
756
761
|
}[];
|
|
762
|
+
key?: string | undefined;
|
|
757
763
|
}[];
|
|
764
|
+
key?: string | undefined;
|
|
758
765
|
}[];
|
|
759
766
|
}>;
|
|
760
767
|
collection: (id: string) => Promise<{
|
|
@@ -889,7 +896,9 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
|
|
|
889
896
|
rewards: {
|
|
890
897
|
label: string;
|
|
891
898
|
}[];
|
|
899
|
+
key?: string | undefined;
|
|
892
900
|
}[];
|
|
901
|
+
key?: string | undefined;
|
|
893
902
|
}>;
|
|
894
903
|
open: (view: QuestView) => Promise<QuestController>;
|
|
895
904
|
observe: (listener: (value: ProgressObservation<zod.infer<typeof questExperienceSchema>>) => void, options?: {
|
|
@@ -1208,6 +1217,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
|
|
|
1208
1217
|
release?: string | undefined;
|
|
1209
1218
|
} | undefined;
|
|
1210
1219
|
} | null;
|
|
1220
|
+
key?: string | undefined;
|
|
1211
1221
|
release?: string | undefined;
|
|
1212
1222
|
}[];
|
|
1213
1223
|
entitlements: ({
|
|
@@ -1487,6 +1497,9 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
|
|
|
1487
1497
|
provider: "discord";
|
|
1488
1498
|
resource: "channel";
|
|
1489
1499
|
types: ("text" | "announcement")[];
|
|
1500
|
+
} | {
|
|
1501
|
+
provider: "domino";
|
|
1502
|
+
resource: "point-ledger";
|
|
1490
1503
|
} | {
|
|
1491
1504
|
provider: "discord";
|
|
1492
1505
|
resource: "role";
|
|
@@ -1595,7 +1608,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
|
|
|
1595
1608
|
budgets: {
|
|
1596
1609
|
id: string;
|
|
1597
1610
|
scope: "project" | "member";
|
|
1598
|
-
period: "
|
|
1611
|
+
period: "lifetime" | "day";
|
|
1599
1612
|
limit: number;
|
|
1600
1613
|
cost: number | {
|
|
1601
1614
|
balance: string;
|
|
@@ -1647,6 +1660,9 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
|
|
|
1647
1660
|
provider: "discord";
|
|
1648
1661
|
resource: "channel";
|
|
1649
1662
|
types: ("text" | "announcement")[];
|
|
1663
|
+
} | {
|
|
1664
|
+
provider: "domino";
|
|
1665
|
+
resource: "point-ledger";
|
|
1650
1666
|
} | {
|
|
1651
1667
|
provider: "discord";
|
|
1652
1668
|
resource: "role";
|
|
@@ -1755,7 +1771,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
|
|
|
1755
1771
|
budgets: {
|
|
1756
1772
|
id: string;
|
|
1757
1773
|
scope: "project" | "member";
|
|
1758
|
-
period: "
|
|
1774
|
+
period: "lifetime" | "day";
|
|
1759
1775
|
limit: number;
|
|
1760
1776
|
cost: number | {
|
|
1761
1777
|
balance: string;
|
|
@@ -1806,6 +1822,9 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
|
|
|
1806
1822
|
provider: "discord";
|
|
1807
1823
|
resource: "channel";
|
|
1808
1824
|
types: ("text" | "announcement")[];
|
|
1825
|
+
} | {
|
|
1826
|
+
provider: "domino";
|
|
1827
|
+
resource: "point-ledger";
|
|
1809
1828
|
} | {
|
|
1810
1829
|
provider: "discord";
|
|
1811
1830
|
resource: "role";
|
|
@@ -1914,18 +1933,19 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
|
|
|
1914
1933
|
budgets: {
|
|
1915
1934
|
id: string;
|
|
1916
1935
|
scope: "project" | "member";
|
|
1917
|
-
period: "
|
|
1936
|
+
period: "lifetime" | "day";
|
|
1918
1937
|
limit: number;
|
|
1919
1938
|
cost: number | {
|
|
1920
1939
|
balance: string;
|
|
1921
1940
|
};
|
|
1922
1941
|
}[];
|
|
1923
1942
|
code: string;
|
|
1924
|
-
provider: "
|
|
1943
|
+
provider: "workers-ai" | "fixture-pass" | "fixture-fail" | "fixture-unclear" | "fixture-error";
|
|
1925
1944
|
id: string;
|
|
1926
1945
|
createdAt: number;
|
|
1927
1946
|
legacy: boolean;
|
|
1928
1947
|
lifecycle: "active" | "paused" | "archived";
|
|
1948
|
+
key?: string | undefined;
|
|
1929
1949
|
origin?: {
|
|
1930
1950
|
typeVersion: string;
|
|
1931
1951
|
} | undefined;
|
|
@@ -2139,6 +2159,9 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
|
|
|
2139
2159
|
provider: "discord";
|
|
2140
2160
|
resource: "channel";
|
|
2141
2161
|
types: ("text" | "announcement")[];
|
|
2162
|
+
} | {
|
|
2163
|
+
provider: "domino";
|
|
2164
|
+
resource: "point-ledger";
|
|
2142
2165
|
} | {
|
|
2143
2166
|
provider: "discord";
|
|
2144
2167
|
resource: "role";
|
|
@@ -2247,18 +2270,19 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
|
|
|
2247
2270
|
budgets: {
|
|
2248
2271
|
id: string;
|
|
2249
2272
|
scope: "project" | "member";
|
|
2250
|
-
period: "
|
|
2273
|
+
period: "lifetime" | "day";
|
|
2251
2274
|
limit: number;
|
|
2252
2275
|
cost: number | {
|
|
2253
2276
|
balance: string;
|
|
2254
2277
|
};
|
|
2255
2278
|
}[];
|
|
2256
2279
|
code: string;
|
|
2257
|
-
provider: "
|
|
2280
|
+
provider: "workers-ai" | "fixture-pass" | "fixture-fail" | "fixture-unclear" | "fixture-error";
|
|
2258
2281
|
id: string;
|
|
2259
2282
|
createdAt: number;
|
|
2260
2283
|
legacy: boolean;
|
|
2261
2284
|
lifecycle: "active" | "paused" | "archived";
|
|
2285
|
+
key?: string | undefined;
|
|
2262
2286
|
origin?: {
|
|
2263
2287
|
typeVersion: string;
|
|
2264
2288
|
} | undefined;
|
|
@@ -2326,6 +2350,9 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
|
|
|
2326
2350
|
provider: "discord";
|
|
2327
2351
|
resource: "channel";
|
|
2328
2352
|
types: ("text" | "announcement")[];
|
|
2353
|
+
} | {
|
|
2354
|
+
provider: "domino";
|
|
2355
|
+
resource: "point-ledger";
|
|
2329
2356
|
} | {
|
|
2330
2357
|
provider: "discord";
|
|
2331
2358
|
resource: "role";
|
|
@@ -2434,18 +2461,19 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
|
|
|
2434
2461
|
budgets: {
|
|
2435
2462
|
id: string;
|
|
2436
2463
|
scope: "project" | "member";
|
|
2437
|
-
period: "
|
|
2464
|
+
period: "lifetime" | "day";
|
|
2438
2465
|
limit: number;
|
|
2439
2466
|
cost: number | {
|
|
2440
2467
|
balance: string;
|
|
2441
2468
|
};
|
|
2442
2469
|
}[];
|
|
2443
2470
|
code: string;
|
|
2444
|
-
provider: "
|
|
2471
|
+
provider: "workers-ai" | "fixture-pass" | "fixture-fail" | "fixture-unclear" | "fixture-error";
|
|
2445
2472
|
id: string;
|
|
2446
2473
|
createdAt: number;
|
|
2447
2474
|
legacy: boolean;
|
|
2448
2475
|
lifecycle: "active" | "paused" | "archived";
|
|
2476
|
+
key?: string | undefined;
|
|
2449
2477
|
origin?: {
|
|
2450
2478
|
typeVersion: string;
|
|
2451
2479
|
} | undefined;
|
|
@@ -2596,6 +2624,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
|
|
|
2596
2624
|
release?: string | undefined;
|
|
2597
2625
|
} | undefined;
|
|
2598
2626
|
} | null;
|
|
2627
|
+
key?: string | undefined;
|
|
2599
2628
|
release?: string | undefined;
|
|
2600
2629
|
}[];
|
|
2601
2630
|
entitlements: ({
|
package/dist/browser.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createRelayClient
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-Y6H4HDQT.js";
|
|
4
|
+
import "./chunk-Q5VDZVVO.js";
|
|
5
|
+
import "./chunk-MVDE7WKB.js";
|
|
6
|
+
import "./chunk-XTFCKK2Y.js";
|
|
7
7
|
|
|
8
8
|
// src/browser.ts
|
|
9
9
|
function createBrowserRelayClient(options) {
|