@domino-sdk/relay 0.6.0 → 0.8.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 +18 -9
- package/dist/authoring.js +19 -9
- package/dist/browser.d.ts +91 -37
- package/dist/browser.js +4 -4
- package/dist/{chunk-PLO5PPLU.js → chunk-2BN7XZH3.js} +1 -1
- package/dist/{chunk-CCLIDCUU.js → chunk-APMYDKEX.js} +211 -189
- package/dist/chunk-XVHWBZRG.js +388 -0
- package/dist/{chunk-MXK7KEDA.js → chunk-Z43O273V.js} +45 -3
- package/dist/index.d.ts +982 -128
- package/dist/index.js +28 -6
- package/dist/portal-proxy.js +2 -2
- package/dist/schema.d.ts +63 -2
- package/dist/schema.js +5 -1
- package/dist/{settings-BrC6C9yl.d.ts → settings-BA8XjT4m.d.ts} +779 -23
- package/package.json +1 -1
- package/dist/chunk-UIC6OF3C.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;
|
|
@@ -229,6 +230,11 @@ declare function defineQuest<T extends Record<string, z.ZodType>, const G extend
|
|
|
229
230
|
};
|
|
230
231
|
integrations: "discord"[];
|
|
231
232
|
fields: Record<string, {
|
|
233
|
+
kind: "point-ledger";
|
|
234
|
+
default: string;
|
|
235
|
+
label: string;
|
|
236
|
+
description?: string | undefined;
|
|
237
|
+
} | {
|
|
232
238
|
kind: "datetime";
|
|
233
239
|
default: string;
|
|
234
240
|
label: string;
|
|
@@ -237,6 +243,9 @@ declare function defineQuest<T extends Record<string, z.ZodType>, const G extend
|
|
|
237
243
|
kind: "resource";
|
|
238
244
|
default: string;
|
|
239
245
|
source: {
|
|
246
|
+
provider: "domino";
|
|
247
|
+
resource: "point-ledger";
|
|
248
|
+
} | {
|
|
240
249
|
provider: "discord";
|
|
241
250
|
resource: "channel";
|
|
242
251
|
types: ("text" | "announcement")[];
|
|
@@ -360,7 +369,7 @@ declare function defineQuest<T extends Record<string, z.ZodType>, const G extend
|
|
|
360
369
|
humanReview: boolean;
|
|
361
370
|
}): Promise<Decision>;
|
|
362
371
|
};
|
|
363
|
-
/** Publish this artifact as a reusable type. Its
|
|
372
|
+
/** Publish this artifact as a reusable type. Its key names the type;
|
|
364
373
|
* Console instances receive independent quest identities and pinned versions. */
|
|
365
374
|
declare const defineQuestType: typeof defineQuest;
|
|
366
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-XVHWBZRG.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-Z43O273V.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,
|