@domino-sdk/relay 0.29.0 → 0.31.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 +48 -16
- package/dist/authoring.js +36 -10
- package/dist/browser.d.ts +406 -197
- package/dist/browser.js +6 -6
- package/dist/{chunk-MVCKCDNR.js → chunk-BGN3CQC6.js} +2 -2
- package/dist/{chunk-5LLU7UUV.js → chunk-IZYXEXUO.js} +166 -740
- package/dist/chunk-OQ4ZNOC7.js +42 -0
- package/dist/{chunk-YKS6P4IP.js → chunk-QEN4GHL7.js} +2 -2
- package/dist/{chunk-LAKQCIHX.js → chunk-UI4N4XRZ.js} +166 -31
- package/dist/{chunk-BE5V6RFD.js → chunk-UPWID5KS.js} +190 -35
- package/dist/index.d.ts +1036 -463
- package/dist/index.js +65 -39
- package/dist/portal-proxy.js +6 -6
- package/dist/react/index.d.ts +241 -13
- package/dist/react/index.js +6 -6
- package/dist/schema.d.ts +184 -26
- package/dist/schema.js +1 -1
- package/dist/{submission-input-C0cOmO4Q.d.ts → submission-input-JDwq3EVK.d.ts} +359 -1239
- package/package.json +1 -1
- package/dist/chunk-MRKFRCCI.js +0 -168
package/dist/authoring.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as AdmittedContent, O as Observation, T as TrackerTriggerContext, a as TrackerReader, X as XReader, I as ImageReader, D as DiscordMember, b as DiscordMessage, W as WalletConnection, S as SolanaBalance, L as LinkedWallet, c as WalletBalanceQuery, d as WalletBalance,
|
|
2
|
-
export {
|
|
1
|
+
import { A as AdmittedContent, O as Observation, T as TrackerTriggerContext, a as TrackerReader, X as XReader, I as ImageReader, D as DiscordMember, b as DiscordMessage, W as WalletConnection, S as SolanaBalance, L as LinkedWallet, c as WalletBalanceQuery, d as WalletBalance, e as TrackerDefinition, f as TrackerTriggerMode, g as TrackerWhere, o as observationTriggerSchema, h as TrackerTriggerPolicy, B as Budget, i as AuthoringIdentity, C as ContentMetric, j as IntegrationProvider, k as StreakPolicy, l as TextEvidence, U as UrlEvidence, m as TextOptions, n as UrlOptions } from './submission-input-JDwq3EVK.js';
|
|
2
|
+
export { E as EvmChainId, p as content, q as customSource, r as defineEngagementReward, s as defineLeaderboard, t as defineReferral, u as defineTracker, v as discord, w as formatUnits, x as isEvmChainId, y as parseUnits, z as perContent, F as pointLedgers, G as settings, H as streak, J as trackerTriggerContextSchema, K as x } from './submission-input-JDwq3EVK.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { TextReviewInput, TextResult, PhotoResult, rewardSchema, triggerSchema, QuestPresentation, QuestProfile, QuizEvidence, Decision, TieredRewardDefinition } from './schema.js';
|
|
5
5
|
|
|
@@ -58,11 +58,32 @@ declare function manual(options: {
|
|
|
58
58
|
input: "none";
|
|
59
59
|
actor: "staff";
|
|
60
60
|
};
|
|
61
|
+
/** A tracker trigger: which observations of which tracker run the quest, and for whom. */
|
|
62
|
+
type TrackerTriggerInput = {
|
|
63
|
+
tracker: TrackerDefinition;
|
|
64
|
+
/**
|
|
65
|
+
* Which observations fire. `"new-record"`: each record's first observation (the default for X
|
|
66
|
+
* trackers, where it means each newly collected post). `"new-observation"`: each observation
|
|
67
|
+
* that becomes its record's current one (the default for custom trackers). `"data-changed"`: a
|
|
68
|
+
* new record, or a current observation whose `data` differs from the previous one.
|
|
69
|
+
*/
|
|
70
|
+
on?: TrackerTriggerMode;
|
|
71
|
+
/**
|
|
72
|
+
* Admit only observations whose `data` matches, such as `{ path: "amount", gte: 1000 }` or
|
|
73
|
+
* `{ path: "amount", gte: { setting: "threshold" } }`. Others record no outcome.
|
|
74
|
+
*/
|
|
75
|
+
where?: TrackerWhere;
|
|
76
|
+
/**
|
|
77
|
+
* The record account whose member the quest pays: `"author"` (the default), `"inReplyTo"` on
|
|
78
|
+
* an X tracker, or a named account a custom source declares in `accounts`. Skipped when that
|
|
79
|
+
* account is the record's author account or belongs to the author's member.
|
|
80
|
+
*/
|
|
81
|
+
beneficiary?: string;
|
|
82
|
+
};
|
|
61
83
|
/**
|
|
62
84
|
* An automatic quest. With no argument it runs once its prerequisites are complete; with an
|
|
63
|
-
* observation it runs for each matching observation; with a tracker it runs for each
|
|
64
|
-
*
|
|
65
|
-
* record to.
|
|
85
|
+
* observation it runs for each matching observation; with a tracker it runs for each observation
|
|
86
|
+
* its firing mode and filter admit, for the member Relay attributes the beneficiary account to.
|
|
66
87
|
*/
|
|
67
88
|
declare function automatic(): {
|
|
68
89
|
kind: "automatic";
|
|
@@ -71,15 +92,7 @@ declare function automatic(observation: z.infer<typeof observationTriggerSchema>
|
|
|
71
92
|
kind: "automatic";
|
|
72
93
|
observation: z.infer<typeof observationTriggerSchema>;
|
|
73
94
|
};
|
|
74
|
-
declare function automatic(input: {
|
|
75
|
-
tracker: TrackerDefinition;
|
|
76
|
-
/**
|
|
77
|
-
* Whose quest each record is. `"author"` (the default): the member who verified the record
|
|
78
|
-
* author's wallet (custom trackers) or X account (X trackers). `"replied-to"`: the member whose
|
|
79
|
-
* verified X account an X post replies to.
|
|
80
|
-
*/
|
|
81
|
-
beneficiary?: TrackerBeneficiary;
|
|
82
|
-
}): {
|
|
95
|
+
declare function automatic(input: TrackerTriggerInput): {
|
|
83
96
|
kind: "automatic";
|
|
84
97
|
tracker: TrackerTriggerPolicy;
|
|
85
98
|
};
|
|
@@ -445,7 +458,26 @@ declare function defineQuest<T extends Record<string, z.ZodType>, const G extend
|
|
|
445
458
|
tracker?: {
|
|
446
459
|
tracker: string;
|
|
447
460
|
source: "custom" | "x-search";
|
|
448
|
-
beneficiary:
|
|
461
|
+
beneficiary: string;
|
|
462
|
+
on?: "new-record" | "new-observation" | "data-changed" | undefined;
|
|
463
|
+
where?: {
|
|
464
|
+
path: string;
|
|
465
|
+
gt?: number | {
|
|
466
|
+
setting: string;
|
|
467
|
+
} | undefined;
|
|
468
|
+
gte?: number | {
|
|
469
|
+
setting: string;
|
|
470
|
+
} | undefined;
|
|
471
|
+
lt?: number | {
|
|
472
|
+
setting: string;
|
|
473
|
+
} | undefined;
|
|
474
|
+
lte?: number | {
|
|
475
|
+
setting: string;
|
|
476
|
+
} | undefined;
|
|
477
|
+
} | {
|
|
478
|
+
path: string;
|
|
479
|
+
equals: string | number | boolean;
|
|
480
|
+
} | undefined;
|
|
449
481
|
} | undefined;
|
|
450
482
|
} | {
|
|
451
483
|
kind: "manual";
|
|
@@ -510,4 +542,4 @@ declare function defineQuest<T extends Record<string, z.ZodType>, const G extend
|
|
|
510
542
|
* Console instances receive independent quest identities and pinned versions. */
|
|
511
543
|
declare const defineQuestType: typeof defineQuest;
|
|
512
544
|
|
|
513
|
-
export { type EvaluationContext, TrackerTriggerContext, WalletBalance, WalletBalanceQuery, automatic, budget, completed, decision, defineQuest, defineQuestType, defineTieredReward, discordRole, evaluators, evidence, keyed, manual, once, points, staffHandover, untracked };
|
|
545
|
+
export { type EvaluationContext, TrackerTriggerContext, type TrackerTriggerInput, WalletBalance, WalletBalanceQuery, automatic, budget, completed, decision, defineQuest, defineQuestType, defineTieredReward, discordRole, evaluators, evidence, keyed, manual, once, points, staffHandover, untracked };
|
package/dist/authoring.js
CHANGED
|
@@ -5,8 +5,10 @@ import {
|
|
|
5
5
|
defineReferral,
|
|
6
6
|
formatUnits,
|
|
7
7
|
parseUnits
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import
|
|
8
|
+
} from "./chunk-QEN4GHL7.js";
|
|
9
|
+
import {
|
|
10
|
+
isEvmChainId
|
|
11
|
+
} from "./chunk-UI4N4XRZ.js";
|
|
10
12
|
import {
|
|
11
13
|
admittedContentSchema,
|
|
12
14
|
budgetSchema,
|
|
@@ -15,6 +17,7 @@ import {
|
|
|
15
17
|
contentPerformanceSnapshotSchema,
|
|
16
18
|
customSource,
|
|
17
19
|
decisionSchema,
|
|
20
|
+
defaultTriggerMode,
|
|
18
21
|
defineTracker,
|
|
19
22
|
discord,
|
|
20
23
|
integrationRewardSchema,
|
|
@@ -27,6 +30,7 @@ import {
|
|
|
27
30
|
rewardBundleSchema,
|
|
28
31
|
settingFieldSchema,
|
|
29
32
|
settings,
|
|
33
|
+
sourceIdentities,
|
|
30
34
|
streak,
|
|
31
35
|
textOptionsSchema,
|
|
32
36
|
tierRewardSchema,
|
|
@@ -34,8 +38,9 @@ import {
|
|
|
34
38
|
trackerTriggerContextSchema,
|
|
35
39
|
trackerTriggerPolicySchema,
|
|
36
40
|
urlOptionsSchema,
|
|
37
|
-
x
|
|
38
|
-
|
|
41
|
+
x,
|
|
42
|
+
xAccountRoles
|
|
43
|
+
} from "./chunk-UPWID5KS.js";
|
|
39
44
|
|
|
40
45
|
// src/authoring.ts
|
|
41
46
|
import { z } from "zod";
|
|
@@ -73,20 +78,32 @@ function automatic(input) {
|
|
|
73
78
|
return { kind: "automatic" };
|
|
74
79
|
}
|
|
75
80
|
if ("tracker" in input) {
|
|
76
|
-
const { tracker, beneficiary = "author" } = input;
|
|
77
|
-
|
|
78
|
-
|
|
81
|
+
const { tracker, beneficiary = "author", on, where } = input;
|
|
82
|
+
const { source } = tracker;
|
|
83
|
+
if (source.kind === "x-search" && !xAccountRoles.includes(beneficiary)) {
|
|
84
|
+
throw new Error(
|
|
85
|
+
`X trackers pay "author" or "inReplyTo", not "${beneficiary}"`
|
|
86
|
+
);
|
|
79
87
|
}
|
|
80
|
-
if (
|
|
88
|
+
if (!sourceIdentities(source)) {
|
|
81
89
|
throw new Error(
|
|
82
|
-
'Tracker triggers need attributable
|
|
90
|
+
'Tracker triggers need attributable records: declare customSource(namespace, { identities: ["wallet"] }) or other identity kinds'
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
if (source.kind === "custom" && beneficiary !== "author" && !source.accounts?.includes(beneficiary)) {
|
|
94
|
+
throw new Error(
|
|
95
|
+
`Tracker "${tracker.key}" has no "${beneficiary}" account: declare it in customSource(namespace, { accounts: ["${beneficiary}"] })`
|
|
83
96
|
);
|
|
84
97
|
}
|
|
85
98
|
return {
|
|
86
99
|
kind: "automatic",
|
|
87
100
|
tracker: trackerTriggerPolicySchema.parse({
|
|
88
101
|
tracker: tracker.key,
|
|
89
|
-
source:
|
|
102
|
+
source: source.kind,
|
|
103
|
+
// The source's default mode is left out, so default quests keep the policy shape
|
|
104
|
+
// earlier SDKs and servers read.
|
|
105
|
+
...on && on !== defaultTriggerMode(source.kind) ? { on } : {},
|
|
106
|
+
...where ? { where } : {},
|
|
90
107
|
beneficiary
|
|
91
108
|
})
|
|
92
109
|
};
|
|
@@ -182,6 +199,14 @@ function defineQuest(definition) {
|
|
|
182
199
|
settingFieldSchema.parse(schema.meta())
|
|
183
200
|
])
|
|
184
201
|
);
|
|
202
|
+
const where = definition.trigger.kind === "automatic" ? definition.trigger.tracker?.where : void 0;
|
|
203
|
+
for (const bound of where && !("equals" in where) ? [where.gt, where.gte, where.lt, where.lte] : []) {
|
|
204
|
+
if (typeof bound === "object" && fields[bound.setting]?.kind !== "integer") {
|
|
205
|
+
throw new Error(
|
|
206
|
+
`The tracker filter compares with setting "${bound.setting}", which is not an integer setting`
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
185
210
|
function describe(input) {
|
|
186
211
|
const settings2 = definition.settings.parse(input);
|
|
187
212
|
const values = parseSettings(fields, settings2);
|
|
@@ -318,6 +343,7 @@ export {
|
|
|
318
343
|
evaluators,
|
|
319
344
|
evidence,
|
|
320
345
|
formatUnits,
|
|
346
|
+
isEvmChainId,
|
|
321
347
|
keyed,
|
|
322
348
|
manual,
|
|
323
349
|
once,
|