@domino-sdk/relay 1.54.0 → 1.56.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/CHANGELOG.md +1859 -0
- package/dist/analytics-URV-mxjH.d.ts +482 -0
- package/dist/{attempt-captures-QC4kTA44.d.ts → attempt-captures-CxxO7DeD.d.ts} +1 -1
- package/dist/authoring.d.ts +277 -40
- package/dist/authoring.js +142 -14
- package/dist/{automatic-outcomes-CVyZHxir.d.ts → automatic-outcomes-DxW_v5Wc.d.ts} +5 -2
- package/dist/avatar.d.ts +1 -1
- package/dist/browser.d.ts +7 -7
- package/dist/browser.js +10 -10
- package/dist/{capability-error-FQGGb5xS.d.ts → capability-error-DSd8EMQC.d.ts} +76 -2
- package/dist/{chunk-RP4LLEON.js → chunk-ABJ4G47X.js} +1 -1
- package/dist/{chunk-IELNFM3V.js → chunk-BHHUSBSD.js} +97 -8
- package/dist/chunk-BJYMTCWG.js +950 -0
- package/dist/{chunk-K6TVMNU4.js → chunk-CK7HO32Z.js} +1 -1
- package/dist/{chunk-GTQJSDBS.js → chunk-CXKXPB7K.js} +32 -16
- package/dist/{chunk-TL5TL5RD.js → chunk-G6XVBYH7.js} +4 -4
- package/dist/{chunk-S2PMKZSX.js → chunk-H2MD6E7Z.js} +21 -2
- package/dist/{chunk-YVC3B72P.js → chunk-INSWI2VZ.js} +1 -1
- package/dist/{chunk-XFAYQFRO.js → chunk-KBVH4XZC.js} +1 -1
- package/dist/{chunk-MLIXJPKL.js → chunk-MHPKEVEW.js} +1 -0
- package/dist/{chunk-7BNCLWAO.js → chunk-MNU6UPXY.js} +1 -1
- package/dist/{chunk-JL7J3EQQ.js → chunk-NK6EER33.js} +46 -16
- package/dist/{chunk-QIDQWXSF.js → chunk-OTITLABX.js} +2 -2
- package/dist/{chunk-53JMTUWG.js → chunk-QNQNKIAA.js} +1 -1
- package/dist/{chunk-ZJ3FVZRP.js → chunk-RBPMT53S.js} +132 -99
- package/dist/chunk-ULQU7KC4.js +704 -0
- package/dist/chunk-VSHV7FEA.js +344 -0
- package/dist/{chunk-LPHXTZDA.js → chunk-W5U2WXG3.js} +2 -2
- package/dist/{client-CzNtl8UO.d.ts → client-bX3oTpRu.d.ts} +111 -8
- package/dist/{deployments-ovtqtAcx.d.ts → deployments-D3lxfQMB.d.ts} +1436 -185
- package/dist/{groups-B5R1RCsl.d.ts → groups-DPE004_V.d.ts} +135 -139
- package/dist/index.d.ts +8 -8
- package/dist/index.js +9 -9
- package/dist/integrations-CcD5NPEA.d.ts +633 -0
- package/dist/internal.d.ts +11 -10
- package/dist/internal.js +9 -9
- package/dist/{offers-CH1RZekg.d.ts → offers-CtzMeB7O.d.ts} +207 -2
- package/dist/{pages-BTlOg8sl.d.ts → pages-BlLqB8ZQ.d.ts} +82 -2
- package/dist/portal-proxy.d.ts +11 -1
- package/dist/portal-proxy.js +27 -6
- package/dist/{profiles-Cdv4BSd_.d.ts → profiles-BoOK03cR.d.ts} +2 -0
- package/dist/react/index.d.ts +566 -13
- package/dist/react/index.js +105 -15
- package/dist/runtime/authoring.js +1 -1
- package/dist/runtime/chunks/NDB42VFF.js +1 -0
- package/dist/runtime/manifest.json +3 -3
- package/dist/runtime/schema.js +1 -1
- package/dist/{schema-BJ9bOgpN.d.ts → schema-C4m9RhCR.d.ts} +166 -6
- package/dist/schema.d.ts +383 -79
- package/dist/schema.js +105 -41
- package/dist/server/index.d.ts +11 -10
- package/dist/server/index.js +1590 -1175
- package/dist/{submission-input-BNah53go.d.ts → submission-input-wTiYGdgA.d.ts} +2 -2
- package/dist/{telegram-browser-C36j_6v-.d.ts → telegram-browser-Bh3i0HiH.d.ts} +1 -1
- package/dist/testing.d.ts +85 -12
- package/dist/testing.js +322 -37
- package/dist/{transport-C8BlCzmF.d.ts → transport-CnKA-_RL.d.ts} +7625 -1265
- package/dist/vite.d.ts +54 -1
- package/dist/vite.js +35 -0
- package/dist/{x-BfQcsDp0.d.ts → x-1czZFVUW.d.ts} +1 -1
- package/package.json +3 -2
- package/dist/chunk-2NUD237O.js +0 -102
- package/dist/chunk-CCE2JWES.js +0 -1083
- package/dist/integrations-CllF-kWg.d.ts +0 -314
- package/dist/runtime/chunks/AVRVSLHX.js +0 -1
package/dist/authoring.d.ts
CHANGED
|
@@ -1,22 +1,26 @@
|
|
|
1
|
-
import { x as xContentBodySchema, I as IdentityKind,
|
|
2
|
-
export {
|
|
1
|
+
import { x as xContentBodySchema, I as IdentityKind, y as customSourceSchema, W as WithRecordData, z as WithContent, B as WithAccountRoles, C as ResourceHandle, D as QuestHandle, L as LedgerReference, G as GroupHandle, F as pointLedgerDeclarationSchema, H as TrackerSource, J as trackerDefinitionSchema, N as Tracker, U as TrackerData, V as SourceRoles, X as LedgerHandle, Y as TrackerDataSchema, Z as xSearchSourceSchema, _ as XTweet, $ as XContentMetric, a0 as TrackerTriggerPolicy, a1 as Where, a2 as MemberIdentity, P as PointBalance, a3 as ReferralHandle, a4 as TrackerTriggerContext, a5 as TrackerReader, a6 as TextReviewInput, a7 as TextResult, a8 as PhotoResult, a9 as Decision, aa as rewardSchema, ab as TrackerTriggerMode, ac as RoleOf, ad as WhereSetting, ae as ContentBody, af as BadgeHandle, ag as ContentMetricName, ah as triggerSchema, k as QuestPresentation, l as QuestProfile, m as QuizEvidence, ai as TieredRewardDefinition } from './schema-C4m9RhCR.js';
|
|
2
|
+
export { aj as LedgerSetting, ak as TrackerPage, al as TrackerReadQuery, am as trackerDataSchema, an as trackerTriggerContextSchema } from './schema-C4m9RhCR.js';
|
|
3
|
+
import { M as MemberCompletion, B as Budget } from './capability-error-DSd8EMQC.js';
|
|
4
|
+
export { C as CapabilityError, a as CapabilityErrorCode, c as capabilityErrorCodes } from './capability-error-DSd8EMQC.js';
|
|
5
|
+
import { d as ProfileReferral } from './profiles-BoOK03cR.js';
|
|
3
6
|
import * as z from 'zod';
|
|
4
7
|
export { z } from 'zod';
|
|
5
|
-
import { f as badgeDeclarationSchema, B as Badge } from './offers-
|
|
6
|
-
export { g as defineOffer } from './offers-
|
|
7
|
-
import { E as EngagementBudget,
|
|
8
|
-
export {
|
|
8
|
+
import { f as badgeDeclarationSchema, B as Badge } from './offers-CtzMeB7O.js';
|
|
9
|
+
export { g as defineOffer } from './offers-CtzMeB7O.js';
|
|
10
|
+
import { E as EngagementBudget, l as leaderboardDefinitionSchema, m as AuthoringIdentity, r as referralAuthoringSchema, C as CampaignDefinition, A as AvailabilityWindow } from './groups-DPE004_V.js';
|
|
11
|
+
export { n as defineCampaign, o as defineGroup } from './groups-DPE004_V.js';
|
|
9
12
|
import { d as discordMessagesSourceSchema, D as DiscordMessageData, c as DiscordMessageTextData, e as discordReactionsSourceSchema, f as DiscordReactionData, g as TelegramReader, h as DiscordReader } from './accounts-DRPENuZe.js';
|
|
10
13
|
export { i as TelegramChatMember, j as TelegramChatMemberStatus, k as TelegramReactionData } from './accounts-DRPENuZe.js';
|
|
11
|
-
import {
|
|
12
|
-
import { R as ResourceSource, S as Setting,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
import { a as StreakPolicy, Q as QuizContent } from './streaks-0YuipsUQ.js';
|
|
15
|
+
import { R as ResourceSource, S as Setting, A as AmountSetting, B as BalanceChain, I as IntegrationModule, a as BoundSettings } from './integrations-CcD5NPEA.js';
|
|
16
|
+
export { D as DashboardInput, b as DashboardPanelInput, T as TikTokVideoBody, c as TikTokVideoMetric, Y as YouTubeShortBody, d as YouTubeShortMetric, e as defineDashboard } from './integrations-CcD5NPEA.js';
|
|
17
|
+
import { P as Prerequisite, T as TextEvidence, U as UrlEvidence, a as TextOptions, b as UrlOptions } from './submission-input-wTiYGdgA.js';
|
|
18
|
+
export { c as balanceAtLeast, d as completed, i as inGroup } from './submission-input-wTiYGdgA.js';
|
|
19
|
+
import { I as ImageReader, X as XReader } from './x-1czZFVUW.js';
|
|
16
20
|
import { h as WalletReader } from './wallet-Ac7OFpOr.js';
|
|
17
21
|
export { i as CosmosDenom, a as CosmosNetwork, E as EvmChainId, j as WalletBalance, k as WalletBalanceQuery, l as cosmosDenomSchema, m as cosmosNetworkSchema, n as isEvmChainId } from './wallet-Ac7OFpOr.js';
|
|
18
|
-
export { C as CapabilityError, a as CapabilityErrorCode, c as capabilityErrorCodes } from './capability-error-FQGGb5xS.js';
|
|
19
22
|
export { f as formatUnits, p as parseUnits } from './units-CwgsPB_r.js';
|
|
23
|
+
import './analytics-URV-mxjH.js';
|
|
20
24
|
|
|
21
25
|
declare function defineBadge(input: z.input<typeof badgeDeclarationSchema>): {
|
|
22
26
|
name: string;
|
|
@@ -253,12 +257,23 @@ declare function earned(options?: Omit<EarnedScore, "kind" | "quests"> & {
|
|
|
253
257
|
quests?: QuestHandle[];
|
|
254
258
|
kind: "earned";
|
|
255
259
|
};
|
|
256
|
-
|
|
260
|
+
type SettlementInput = NonNullable<LeaderboardInput["settle"]>;
|
|
261
|
+
declare function defineLeaderboard(input: Omit<LeaderboardInput, "key" | "id" | "balance" | "group" | "score" | "settle"> & AuthoringIdentity & {
|
|
257
262
|
ledger: LedgerReference;
|
|
258
263
|
group?: GroupHandle;
|
|
259
264
|
score?: Exclude<LeaderboardInput["score"], {
|
|
260
265
|
kind: "earned";
|
|
261
266
|
}> | ReturnType<typeof earned>;
|
|
267
|
+
/**
|
|
268
|
+
* A points pool's `ledger` takes a ledger handle or key. `prizes` may be left out when the
|
|
269
|
+
* settlement has a pool.
|
|
270
|
+
*/
|
|
271
|
+
settle?: Omit<SettlementInput, "pool" | "prizes"> & {
|
|
272
|
+
prizes?: SettlementInput["prizes"];
|
|
273
|
+
pool?: Omit<NonNullable<SettlementInput["pool"]>, "ledger"> & {
|
|
274
|
+
ledger?: LedgerReference;
|
|
275
|
+
};
|
|
276
|
+
};
|
|
262
277
|
}): {
|
|
263
278
|
title: string;
|
|
264
279
|
balance: string;
|
|
@@ -331,6 +346,15 @@ declare function defineLeaderboard(input: Omit<LeaderboardInput, "key" | "id" |
|
|
|
331
346
|
amount: number;
|
|
332
347
|
})[];
|
|
333
348
|
}[];
|
|
349
|
+
pool?: {
|
|
350
|
+
amount: string;
|
|
351
|
+
unit: "points" | {
|
|
352
|
+
code: string;
|
|
353
|
+
decimals: number;
|
|
354
|
+
};
|
|
355
|
+
ledger?: string | undefined;
|
|
356
|
+
minScore?: number | undefined;
|
|
357
|
+
} | undefined;
|
|
334
358
|
} | undefined;
|
|
335
359
|
group?: string | undefined;
|
|
336
360
|
} & ResourceHandle<"leaderboard">;
|
|
@@ -450,7 +474,7 @@ declare const telegram: {
|
|
|
450
474
|
reactions(): {
|
|
451
475
|
kind: "custom";
|
|
452
476
|
namespace: string;
|
|
453
|
-
identities?: ("
|
|
477
|
+
identities?: ("x" | "discord" | "member" | "wallet" | `app:${string}`)[] | undefined;
|
|
454
478
|
accounts?: string[] | undefined;
|
|
455
479
|
data?: TrackerDataSchema | undefined;
|
|
456
480
|
content?: {
|
|
@@ -467,6 +491,88 @@ declare const telegram: {
|
|
|
467
491
|
reactorIsAdmin: boolean;
|
|
468
492
|
}> & WithAccountRoles<"author" | "messageAuthor">;
|
|
469
493
|
};
|
|
494
|
+
/**
|
|
495
|
+
* YouTube, read through the channels members link as creator accounts.
|
|
496
|
+
*
|
|
497
|
+
* - `youtube.shorts()`: a tracker source of the Shorts members publish on their linked channels.
|
|
498
|
+
* Each record is one Short, keyed by its video ID: its `author` is the channel, attributed to the
|
|
499
|
+
* member who linked it, and `occurredAt` is when it was published. Its content is
|
|
500
|
+
* `YouTubeShortBody`, measured by `views`, `likes` and `comments`, so `content()` quests,
|
|
501
|
+
* `performance` and engagement rules work on it. Relay looks for new Shorts and refreshes the
|
|
502
|
+
* counters every `refreshSeconds` of the tracker. A video that is deleted or made private is a
|
|
503
|
+
* content removal.
|
|
504
|
+
*
|
|
505
|
+
* In SDK 1.x the source is a custom source whose namespace Relay reserves: only Relay writes its
|
|
506
|
+
* records, and their accounts are YouTube channels whatever `identities` says.
|
|
507
|
+
*/
|
|
508
|
+
declare const youtube: {
|
|
509
|
+
shorts(): {
|
|
510
|
+
kind: "custom";
|
|
511
|
+
namespace: string;
|
|
512
|
+
identities?: ("x" | "discord" | "member" | "wallet" | `app:${string}`)[] | undefined;
|
|
513
|
+
accounts?: string[] | undefined;
|
|
514
|
+
data?: TrackerDataSchema | undefined;
|
|
515
|
+
content?: {
|
|
516
|
+
metrics: string[];
|
|
517
|
+
} | undefined;
|
|
518
|
+
} & WithRecordData<ContentData<{
|
|
519
|
+
title: string;
|
|
520
|
+
description: string;
|
|
521
|
+
tags: string[];
|
|
522
|
+
durationSeconds: number;
|
|
523
|
+
publishedAt: number;
|
|
524
|
+
}, "likes" | "views" | "comments">> & WithContent<{
|
|
525
|
+
title: string;
|
|
526
|
+
description: string;
|
|
527
|
+
tags: string[];
|
|
528
|
+
durationSeconds: number;
|
|
529
|
+
publishedAt: number;
|
|
530
|
+
}, "likes" | "views" | "comments"> & WithAccountRoles<"author">;
|
|
531
|
+
};
|
|
532
|
+
/**
|
|
533
|
+
* TikTok, read through the accounts members link as creator accounts.
|
|
534
|
+
*
|
|
535
|
+
* - `tiktok.videos()`: a tracker source of the public videos members post on their linked TikTok
|
|
536
|
+
* accounts, read with each member's own token. Each record is one video, keyed by its video ID:
|
|
537
|
+
* its `author` is the account's `open_id`, attributed to the member who linked it, and
|
|
538
|
+
* `occurredAt` is when it was posted. Its content is `TikTokVideoBody`, measured by `views`,
|
|
539
|
+
* `likes`, `comments` and `shares`, so `content()` quests, `performance` and engagement rules
|
|
540
|
+
* work on it. Relay looks for new videos and refreshes the counters every `refreshSeconds` of the
|
|
541
|
+
* tracker. A video its owner's account no longer returns is a content removal.
|
|
542
|
+
*
|
|
543
|
+
* In SDK 1.x the source is a custom source whose namespace Relay reserves: only Relay writes its
|
|
544
|
+
* records, and their accounts are TikTok accounts whatever `identities` says.
|
|
545
|
+
*/
|
|
546
|
+
declare const tiktok: {
|
|
547
|
+
videos(): {
|
|
548
|
+
kind: "custom";
|
|
549
|
+
namespace: string;
|
|
550
|
+
identities?: ("x" | "discord" | "member" | "wallet" | `app:${string}`)[] | undefined;
|
|
551
|
+
accounts?: string[] | undefined;
|
|
552
|
+
data?: TrackerDataSchema | undefined;
|
|
553
|
+
content?: {
|
|
554
|
+
metrics: string[];
|
|
555
|
+
} | undefined;
|
|
556
|
+
} & WithRecordData<ContentData<{
|
|
557
|
+
title: string;
|
|
558
|
+
description: string;
|
|
559
|
+
durationSeconds: number;
|
|
560
|
+
width: number;
|
|
561
|
+
height: number;
|
|
562
|
+
createdAt: number;
|
|
563
|
+
shareUrl: string;
|
|
564
|
+
isAigc: boolean;
|
|
565
|
+
}, "likes" | "views" | "comments" | "shares">> & WithContent<{
|
|
566
|
+
title: string;
|
|
567
|
+
description: string;
|
|
568
|
+
durationSeconds: number;
|
|
569
|
+
width: number;
|
|
570
|
+
height: number;
|
|
571
|
+
createdAt: number;
|
|
572
|
+
shareUrl: string;
|
|
573
|
+
isAigc: boolean;
|
|
574
|
+
}, "likes" | "views" | "comments" | "shares"> & WithAccountRoles<"author">;
|
|
575
|
+
};
|
|
470
576
|
declare const pointLedgers: () => ResourceSource;
|
|
471
577
|
type Label = {
|
|
472
578
|
label: string;
|
|
@@ -507,6 +613,23 @@ declare const settings: {
|
|
|
507
613
|
telegramChat(options: Label & {
|
|
508
614
|
default?: string;
|
|
509
615
|
}): Setting<"text", z.ZodDefault<z.ZodString>>;
|
|
616
|
+
/**
|
|
617
|
+
* A non-negative token amount in base units, as an integer string such as `"1000000"`: exact at
|
|
618
|
+
* any scale, so an 18-decimal threshold fits. A tracker filter may compare with it
|
|
619
|
+
* (`gte: { setting }`). With `decimals`, Console shows and edits it in whole tokens.
|
|
620
|
+
*/
|
|
621
|
+
amount(options: Label & {
|
|
622
|
+
default: string;
|
|
623
|
+
decimals?: number;
|
|
624
|
+
}): AmountSetting<z.ZodDefault<z.ZodString>>;
|
|
625
|
+
/**
|
|
626
|
+
* A chain `ctx.wallet.balance()` reads: `"solana"` (or Solana mainnet's CAIP-2 ID), or an EVM
|
|
627
|
+
* chain's CAIP-2 ID such as `"eip155:8453"`. Typed as the query's chain, so it passes to
|
|
628
|
+
* `ctx.wallet.balance({ chain })` as it is.
|
|
629
|
+
*/
|
|
630
|
+
chain(options: Label & {
|
|
631
|
+
default: BalanceChain;
|
|
632
|
+
}): Setting<"text", z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<"solana" | "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp" | `eip155:${number}`, string>>>>;
|
|
510
633
|
integer(options: Label & {
|
|
511
634
|
default: number;
|
|
512
635
|
min: number;
|
|
@@ -546,10 +669,10 @@ declare const badge: (definition: BadgeHandle & Pick<Badge, "name">) => {
|
|
|
546
669
|
tier: string;
|
|
547
670
|
};
|
|
548
671
|
/**
|
|
549
|
-
* A reward that adds the member to a group when the completion's rewards are delivered.
|
|
550
|
-
*
|
|
551
|
-
*
|
|
552
|
-
*
|
|
672
|
+
* A reward that adds the member to a group when the completion's rewards are delivered. Publishing
|
|
673
|
+
* the quest creates the group, with no members, where it is missing; an archived group refuses.
|
|
674
|
+
* Revoking the completion removes the membership unless an operator's add or another unrevoked
|
|
675
|
+
* completion also backs it.
|
|
553
676
|
*/
|
|
554
677
|
declare const groupMembership: (group: GroupHandle) => {
|
|
555
678
|
reward: {
|
|
@@ -769,7 +892,8 @@ type Supplied<G, K extends string, Present, Base> = unknown extends G ? Base | n
|
|
|
769
892
|
type ContextTracker<G> = Supplied<G, "tracker", TrackerTriggerContext<TriggerData<G>, TriggerBody<G>>, TrackerTriggerContext>;
|
|
770
893
|
/**
|
|
771
894
|
* What a `keyed()` completion key reads. TypeScript cannot carry the trigger into a completion
|
|
772
|
-
* built inline, so `tracker` stays nullable here; the
|
|
895
|
+
* built inline, so `tracker` stays nullable here; the builder form,
|
|
896
|
+
* `completion: ({ keyed }) => keyed((ctx) => …)`, reads a {@link QuestKeyedContext}.
|
|
773
897
|
*/
|
|
774
898
|
type KeyedContext = {
|
|
775
899
|
member: {
|
|
@@ -783,6 +907,15 @@ type KeyedContext = {
|
|
|
783
907
|
/** The attempt's evaluation time; see {@link EvaluationContext.now}. */
|
|
784
908
|
now: number;
|
|
785
909
|
};
|
|
910
|
+
/**
|
|
911
|
+
* What a completion key reads in the builder form, `completion: ({ keyed }) => keyed((ctx) => …)`:
|
|
912
|
+
* a {@link KeyedContext} typed from quest `G`'s trigger, with its settings `S`.
|
|
913
|
+
*/
|
|
914
|
+
type QuestKeyedContext<S, G> = Omit<KeyedContext, "tracker"> & {
|
|
915
|
+
settings: S;
|
|
916
|
+
/** The pinned tracker observation: non-null and typed for a tracker trigger, null for others. */
|
|
917
|
+
tracker: ContextTracker<G>;
|
|
918
|
+
};
|
|
786
919
|
declare const budget: (definition: Omit<Budget, "id" | "cost"> & {
|
|
787
920
|
key: string;
|
|
788
921
|
cost: number | {
|
|
@@ -801,13 +934,14 @@ declare const keyed: (key: (ctx: KeyedContext) => string) => {
|
|
|
801
934
|
kind: "keyed";
|
|
802
935
|
key: (ctx: KeyedContext) => string;
|
|
803
936
|
};
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
distinct: (ctx: KeyedContext) => string;
|
|
937
|
+
type ProgressDefinition<C> = {
|
|
938
|
+
distinct: (ctx: C) => string;
|
|
807
939
|
goal: ReturnType<typeof count>;
|
|
808
940
|
window?: ReturnType<typeof calendar>;
|
|
809
941
|
repeat?: "once" | "repeat";
|
|
810
|
-
}
|
|
942
|
+
};
|
|
943
|
+
/** Accepted evidence contributes once under its distinct key; Relay commits progress with rewards. */
|
|
944
|
+
declare const progress: (definition: ProgressDefinition<KeyedContext>) => {
|
|
811
945
|
distinct: (ctx: KeyedContext) => string;
|
|
812
946
|
kind: "progress";
|
|
813
947
|
goal: {
|
|
@@ -868,12 +1002,22 @@ declare function defineTieredReward<const T extends readonly {
|
|
|
868
1002
|
declare const once: () => {
|
|
869
1003
|
kind: "once";
|
|
870
1004
|
};
|
|
1005
|
+
type CompletionKeyOption = {
|
|
1006
|
+
/**
|
|
1007
|
+
* The completion key for a `keyed(...)` quest, in place of its key callback. Other policies
|
|
1008
|
+
* ignore it: `once()` and `streak(...)` key their own completions, `progress(...)` uses its
|
|
1009
|
+
* `distinct(...)`, and a content quest uses its content item. `runQuest` reports an ignored key.
|
|
1010
|
+
*/
|
|
1011
|
+
completionKey?: string;
|
|
1012
|
+
};
|
|
871
1013
|
type Outcome = (Omit<Extract<Decision, {
|
|
872
1014
|
kind: "accept";
|
|
873
|
-
}>, "rewards"> & {
|
|
1015
|
+
}>, "rewards" | "completionKey"> & {
|
|
874
1016
|
rewards?: Reward[];
|
|
875
|
-
}) |
|
|
876
|
-
kind: "
|
|
1017
|
+
} & CompletionKeyOption) | (Omit<Extract<Decision, {
|
|
1018
|
+
kind: "review";
|
|
1019
|
+
}>, "completionKey"> & CompletionKeyOption) | Exclude<Decision, {
|
|
1020
|
+
kind: "accept" | "review";
|
|
877
1021
|
}>;
|
|
878
1022
|
/**
|
|
879
1023
|
* A performance evaluator's answer. It gates the rewards content evaluation already selected, so
|
|
@@ -940,7 +1084,20 @@ declare const decision: {
|
|
|
940
1084
|
};
|
|
941
1085
|
review: typeof review;
|
|
942
1086
|
};
|
|
943
|
-
/**
|
|
1087
|
+
/** What `ctx.member.completions()` reads. */
|
|
1088
|
+
type MemberCompletionQuery = {
|
|
1089
|
+
/** Only this quest's completions: its handle or key. */
|
|
1090
|
+
quest?: QuestHandle | string;
|
|
1091
|
+
/** Only completions recorded at or after this time, in epoch milliseconds on the member's clock. */
|
|
1092
|
+
since?: number;
|
|
1093
|
+
/** At most this many, newest first: 100 by default, and never more than 100. */
|
|
1094
|
+
limit?: number;
|
|
1095
|
+
};
|
|
1096
|
+
/**
|
|
1097
|
+
* The member an attempt evaluates. Relay and the testing kit create it; quest code only reads it.
|
|
1098
|
+
*
|
|
1099
|
+
* @compat sealed
|
|
1100
|
+
*/
|
|
944
1101
|
type EvaluationMember = {
|
|
945
1102
|
id: string;
|
|
946
1103
|
/**
|
|
@@ -949,6 +1106,39 @@ type EvaluationMember = {
|
|
|
949
1106
|
* this evaluation. Null when the member has none. `ctx.wallet.list()` reads wallets.
|
|
950
1107
|
*/
|
|
951
1108
|
identities(): Promise<MemberIdentity[] | null>;
|
|
1109
|
+
/**
|
|
1110
|
+
* The member's balance in a point ledger of the project, by its handle or key, as
|
|
1111
|
+
* `relay.me.balances()` returns it. The member's balances are pinned once per evaluation run at
|
|
1112
|
+
* the first call: points awarded or spent afterwards, including this attempt's own reward, do not
|
|
1113
|
+
* change this evaluation. An unknown ledger fails with a `CapabilityError` of code `author-error`.
|
|
1114
|
+
*/
|
|
1115
|
+
balance(ledger: LedgerHandle | string): Promise<PointBalance>;
|
|
1116
|
+
/**
|
|
1117
|
+
* The member's accepted, unrevoked quest completions in the project, newest first; completions
|
|
1118
|
+
* recorded without a time come last. Pinned once per evaluation run at the first call, like
|
|
1119
|
+
* `balance`. An unknown quest fails with a `CapabilityError` of code `author-error`.
|
|
1120
|
+
*/
|
|
1121
|
+
completions(query?: MemberCompletionQuery): Promise<MemberCompletion[]>;
|
|
1122
|
+
/**
|
|
1123
|
+
* Keys of the project's unarchived groups the member belongs to, in byte order. Pinned once per
|
|
1124
|
+
* evaluation run at the first call, like `balance`.
|
|
1125
|
+
*/
|
|
1126
|
+
groups(): Promise<string[]>;
|
|
1127
|
+
/**
|
|
1128
|
+
* Whether the member's enrollment in a campaign, by its definition or key, is active: false once
|
|
1129
|
+
* they withdraw and for a campaign they never enrolled in. Pinned once per evaluation run at the
|
|
1130
|
+
* first call, like `balance`. A campaign no active quest declares and the member never enrolled
|
|
1131
|
+
* in fails with a `CapabilityError` of code `author-error`.
|
|
1132
|
+
*/
|
|
1133
|
+
enrolled(campaign: Pick<CampaignDefinition, "key"> | string): Promise<boolean>;
|
|
1134
|
+
/**
|
|
1135
|
+
* The member's progress as inviter in a referral program, by its handle or key, as
|
|
1136
|
+
* `relay.profiles.referral()` returns it: the members they invited, those who qualified in the
|
|
1137
|
+
* program and the milestones reached. Never codes or accounts. Pinned once per evaluation run at
|
|
1138
|
+
* the first call, like `balance`. An unknown program fails with a `CapabilityError` of code
|
|
1139
|
+
* `author-error`.
|
|
1140
|
+
*/
|
|
1141
|
+
referrals(program: ReferralHandle | string): Promise<ProfileReferral>;
|
|
952
1142
|
};
|
|
953
1143
|
/** One project-calendar day, with epoch-millisecond bounds. */
|
|
954
1144
|
type EvaluationCalendarDay = {
|
|
@@ -1051,16 +1241,24 @@ type QuestInput<T extends Trigger> = T extends {
|
|
|
1051
1241
|
input: "url";
|
|
1052
1242
|
} ? UrlEvidence : Record<string, never>;
|
|
1053
1243
|
/**
|
|
1054
|
-
* Rejects a trigger whose filter compares with settings that are not integer
|
|
1055
|
-
* quest, naming them.
|
|
1244
|
+
* Rejects a trigger whose filter compares with settings that are not integer or amount settings
|
|
1245
|
+
* of the quest, naming them.
|
|
1056
1246
|
*/
|
|
1057
1247
|
type IntegerSettingBounds<G, T> = [
|
|
1058
|
-
Exclude<TriggerSettings<G>,
|
|
1248
|
+
Exclude<TriggerSettings<G>, BoundSettings<T>>
|
|
1059
1249
|
] extends [never] ? unknown : {
|
|
1060
|
-
readonly "The tracker filter compares with settings that are not integer settings of this quest": Exclude<TriggerSettings<G>,
|
|
1250
|
+
readonly "The tracker filter compares with settings that are not integer or amount settings of this quest": Exclude<TriggerSettings<G>, BoundSettings<T>>;
|
|
1251
|
+
};
|
|
1252
|
+
type CompletionPolicy = ReturnType<typeof once> | ReturnType<typeof keyed> | StreakPolicy | ReturnType<typeof progress>;
|
|
1253
|
+
/** The completion builders, with key callbacks reading quest `G`'s typed context. */
|
|
1254
|
+
type CompletionPolicies<S, G> = {
|
|
1255
|
+
once: typeof once;
|
|
1256
|
+
keyed: (key: (ctx: QuestKeyedContext<S, G>) => string) => ReturnType<typeof keyed>;
|
|
1257
|
+
streak: typeof streak;
|
|
1258
|
+
progress: (definition: ProgressDefinition<QuestKeyedContext<S, G>>) => ReturnType<typeof progress>;
|
|
1061
1259
|
};
|
|
1062
1260
|
/** How a quest completes: a content quest once per content item, so it takes no `completion`. */
|
|
1063
|
-
type CompletionFor<G> = IsContent<G> extends true ? {
|
|
1261
|
+
type CompletionFor<G, S> = IsContent<G> extends true ? {
|
|
1064
1262
|
/** A content quest completes once per content item; it takes no completion. */
|
|
1065
1263
|
completion?: never;
|
|
1066
1264
|
} : G extends {
|
|
@@ -1069,7 +1267,12 @@ type CompletionFor<G> = IsContent<G> extends true ? {
|
|
|
1069
1267
|
} ? {
|
|
1070
1268
|
completion: ReturnType<typeof once>;
|
|
1071
1269
|
} : {
|
|
1072
|
-
|
|
1270
|
+
/**
|
|
1271
|
+
* A policy, or a function building one from the policies it receives:
|
|
1272
|
+
* `({ keyed }) => keyed((ctx) => ctx.tracker.record.data.messageId)` types `ctx` from the
|
|
1273
|
+
* quest's trigger and settings, which a policy built inline cannot.
|
|
1274
|
+
*/
|
|
1275
|
+
completion: CompletionPolicy | ((policies: CompletionPolicies<S, G>) => CompletionPolicy);
|
|
1073
1276
|
};
|
|
1074
1277
|
/** What a content quest's performance stage reads: the declared metrics it chose, fresh. */
|
|
1075
1278
|
type PerformanceContext<S, G, M extends string> = {
|
|
@@ -1085,7 +1288,7 @@ type PerformanceContext<S, G, M extends string> = {
|
|
|
1085
1288
|
observedAt: number;
|
|
1086
1289
|
};
|
|
1087
1290
|
/** A concrete quest: prerequisite-only automatic triggers need at least one prerequisite. */
|
|
1088
|
-
declare const defineQuest: <T extends Record<string, Setting>, const G extends Trigger, const D extends readonly IntegrationModule[] = readonly [], const M extends readonly [string, ...string[]] = readonly [string, ...string[]]>(definition: AuthoringIdentity & CompletionFor<G
|
|
1291
|
+
declare const defineQuest: <T extends Record<string, Setting>, const G extends Trigger, const D extends readonly IntegrationModule[] = readonly [], const M extends readonly [string, ...string[]] = readonly [string, ...string[]]>(definition: AuthoringIdentity & CompletionFor<G, z.core.$InferObjectOutput<T, {}>> & (G extends {
|
|
1089
1292
|
kind: "automatic";
|
|
1090
1293
|
tracker?: never;
|
|
1091
1294
|
} ? {
|
|
@@ -1116,6 +1319,13 @@ declare const defineQuest: <T extends Record<string, Setting>, const G extends T
|
|
|
1116
1319
|
* Only for quests members submit. Omit it for no cooldown.
|
|
1117
1320
|
*/
|
|
1118
1321
|
retryCooldownMs?: number;
|
|
1322
|
+
/**
|
|
1323
|
+
* Milliseconds a member waits after an accepted completion, of any key, before submitting
|
|
1324
|
+
* again: `5_400_000` makes a second story count only 90 minutes after the first was
|
|
1325
|
+
* accepted. Only for repeatable quests members submit; same bounds as `retryCooldownMs`.
|
|
1326
|
+
* Omit it for no cooldown.
|
|
1327
|
+
*/
|
|
1328
|
+
completionCooldownMs?: number;
|
|
1119
1329
|
/**
|
|
1120
1330
|
* Whether staff can review this quest's attempts. Human review is on unless this returns
|
|
1121
1331
|
* `{ enabled: false }`. With it off, `decision.review(...)` becomes a reject that keeps the
|
|
@@ -1192,7 +1402,7 @@ declare const defineQuest: <T extends Record<string, Setting>, const G extends T
|
|
|
1192
1402
|
imageAlt?: string | undefined;
|
|
1193
1403
|
requirements?: ({
|
|
1194
1404
|
kind: "account";
|
|
1195
|
-
provider: "
|
|
1405
|
+
provider: "x" | "discord" | "google" | "apple";
|
|
1196
1406
|
} | {
|
|
1197
1407
|
kind: "wallet";
|
|
1198
1408
|
chain?: "solana" | "eip155" | "cosmos" | undefined;
|
|
@@ -1216,7 +1426,7 @@ declare const defineQuest: <T extends Record<string, Setting>, const G extends T
|
|
|
1216
1426
|
} | undefined;
|
|
1217
1427
|
} | undefined;
|
|
1218
1428
|
};
|
|
1219
|
-
integrations: ("
|
|
1429
|
+
integrations: ("x" | "discord")[];
|
|
1220
1430
|
fields: Record<string, {
|
|
1221
1431
|
kind: "point-ledger";
|
|
1222
1432
|
default: string;
|
|
@@ -1265,6 +1475,7 @@ declare const defineQuest: <T extends Record<string, Setting>, const G extends T
|
|
|
1265
1475
|
multiline: boolean;
|
|
1266
1476
|
label: string;
|
|
1267
1477
|
picker?: string | undefined;
|
|
1478
|
+
decimals?: number | undefined;
|
|
1268
1479
|
description?: string | undefined;
|
|
1269
1480
|
} | {
|
|
1270
1481
|
kind: "integer";
|
|
@@ -1469,6 +1680,7 @@ declare const defineQuest: <T extends Record<string, Setting>, const G extends T
|
|
|
1469
1680
|
until: number;
|
|
1470
1681
|
} | undefined;
|
|
1471
1682
|
retryCooldownMs?: number | undefined;
|
|
1683
|
+
completionCooldownMs?: number | undefined;
|
|
1472
1684
|
};
|
|
1473
1685
|
evaluate(ctx: {
|
|
1474
1686
|
settings: unknown;
|
|
@@ -1519,11 +1731,19 @@ declare const defineQuest: <T extends Record<string, Setting>, const G extends T
|
|
|
1519
1731
|
rewards: Reward[];
|
|
1520
1732
|
humanReview: boolean;
|
|
1521
1733
|
performance?: unknown;
|
|
1734
|
+
/**
|
|
1735
|
+
* The testing kit's: receives what the run did that had no effect, such as a
|
|
1736
|
+
* `completionKey` the completion policy ignores. Relay's hosted runtime does not pass it.
|
|
1737
|
+
*/
|
|
1738
|
+
diagnose?: ((diagnostic: {
|
|
1739
|
+
code: string;
|
|
1740
|
+
message: string;
|
|
1741
|
+
}) => void) | undefined;
|
|
1522
1742
|
}): Promise<Decision>;
|
|
1523
1743
|
} & ResourceHandle<"quest">;
|
|
1524
1744
|
/** Publish this artifact as a reusable type. Its key names the type;
|
|
1525
1745
|
* Console instances receive independent quest identities and pinned versions. */
|
|
1526
|
-
declare const defineQuestType: <T extends Record<string, Setting>, const G extends Trigger, const D extends readonly IntegrationModule[] = readonly [], const M extends readonly [string, ...string[]] = readonly [string, ...string[]]>(definition: AuthoringIdentity & CompletionFor<G
|
|
1746
|
+
declare const defineQuestType: <T extends Record<string, Setting>, const G extends Trigger, const D extends readonly IntegrationModule[] = readonly [], const M extends readonly [string, ...string[]] = readonly [string, ...string[]]>(definition: AuthoringIdentity & CompletionFor<G, z.core.$InferObjectOutput<T, {}>> & {
|
|
1527
1747
|
title: string | ((ctx: {
|
|
1528
1748
|
settings: z.core.$InferObjectOutput<T, {}>;
|
|
1529
1749
|
}) => string);
|
|
@@ -1549,6 +1769,13 @@ declare const defineQuestType: <T extends Record<string, Setting>, const G exten
|
|
|
1549
1769
|
* Only for quests members submit. Omit it for no cooldown.
|
|
1550
1770
|
*/
|
|
1551
1771
|
retryCooldownMs?: number;
|
|
1772
|
+
/**
|
|
1773
|
+
* Milliseconds a member waits after an accepted completion, of any key, before submitting
|
|
1774
|
+
* again: `5_400_000` makes a second story count only 90 minutes after the first was
|
|
1775
|
+
* accepted. Only for repeatable quests members submit; same bounds as `retryCooldownMs`.
|
|
1776
|
+
* Omit it for no cooldown.
|
|
1777
|
+
*/
|
|
1778
|
+
completionCooldownMs?: number;
|
|
1552
1779
|
/**
|
|
1553
1780
|
* Whether staff can review this quest's attempts. Human review is on unless this returns
|
|
1554
1781
|
* `{ enabled: false }`. With it off, `decision.review(...)` becomes a reject that keeps the
|
|
@@ -1625,7 +1852,7 @@ declare const defineQuestType: <T extends Record<string, Setting>, const G exten
|
|
|
1625
1852
|
imageAlt?: string | undefined;
|
|
1626
1853
|
requirements?: ({
|
|
1627
1854
|
kind: "account";
|
|
1628
|
-
provider: "
|
|
1855
|
+
provider: "x" | "discord" | "google" | "apple";
|
|
1629
1856
|
} | {
|
|
1630
1857
|
kind: "wallet";
|
|
1631
1858
|
chain?: "solana" | "eip155" | "cosmos" | undefined;
|
|
@@ -1649,7 +1876,7 @@ declare const defineQuestType: <T extends Record<string, Setting>, const G exten
|
|
|
1649
1876
|
} | undefined;
|
|
1650
1877
|
} | undefined;
|
|
1651
1878
|
};
|
|
1652
|
-
integrations: ("
|
|
1879
|
+
integrations: ("x" | "discord")[];
|
|
1653
1880
|
fields: Record<string, {
|
|
1654
1881
|
kind: "point-ledger";
|
|
1655
1882
|
default: string;
|
|
@@ -1698,6 +1925,7 @@ declare const defineQuestType: <T extends Record<string, Setting>, const G exten
|
|
|
1698
1925
|
multiline: boolean;
|
|
1699
1926
|
label: string;
|
|
1700
1927
|
picker?: string | undefined;
|
|
1928
|
+
decimals?: number | undefined;
|
|
1701
1929
|
description?: string | undefined;
|
|
1702
1930
|
} | {
|
|
1703
1931
|
kind: "integer";
|
|
@@ -1902,6 +2130,7 @@ declare const defineQuestType: <T extends Record<string, Setting>, const G exten
|
|
|
1902
2130
|
until: number;
|
|
1903
2131
|
} | undefined;
|
|
1904
2132
|
retryCooldownMs?: number | undefined;
|
|
2133
|
+
completionCooldownMs?: number | undefined;
|
|
1905
2134
|
};
|
|
1906
2135
|
evaluate(ctx: {
|
|
1907
2136
|
settings: unknown;
|
|
@@ -1952,7 +2181,15 @@ declare const defineQuestType: <T extends Record<string, Setting>, const G exten
|
|
|
1952
2181
|
rewards: Reward[];
|
|
1953
2182
|
humanReview: boolean;
|
|
1954
2183
|
performance?: unknown;
|
|
2184
|
+
/**
|
|
2185
|
+
* The testing kit's: receives what the run did that had no effect, such as a
|
|
2186
|
+
* `completionKey` the completion policy ignores. Relay's hosted runtime does not pass it.
|
|
2187
|
+
*/
|
|
2188
|
+
diagnose?: ((diagnostic: {
|
|
2189
|
+
code: string;
|
|
2190
|
+
message: string;
|
|
2191
|
+
}) => void) | undefined;
|
|
1955
2192
|
}): Promise<Decision>;
|
|
1956
2193
|
} & ResourceHandle<"quest">;
|
|
1957
2194
|
|
|
1958
|
-
export { ContentBody, type ContentData, ContentMetricName, type ContentTrigger, type ContentTriggerInput, DiscordMessageData, DiscordMessageTextData, DiscordReactionData, DiscordReader, type EvaluationCalendar, type EvaluationCalendarDay, type EvaluationContext, type EvaluationMember, GroupHandle, IdentityKind, ImageReader, IntegrationModule, type KeyedContext, LedgerHandle, LedgerReference, MemberIdentity, type Outcome, type PerformanceContext, type PerformanceOutcome, QuestHandle, RoleOf, Setting, TelegramReader, Tracker, TrackerData, TrackerDataSchema, TrackerReader, type TrackerTrigger, TrackerTriggerContext, type TrackerTriggerInput, type TriggerAdmission, WalletReader, Where, type XContentBody, XReader, automatic, automaticFulfillment, badge, budget, calendar, content, count, customSource, decision, defineBadge, defineEngagementReward, defineLeaderboard, defineLedger, defineQuest, defineQuestType, defineReferral, defineTieredReward, defineTracker, discord, earned, evaluators, evidence, groupMembership, keyed, manual, once, pointLedgers, points, progress, questCompleted, rolling, settings, staffHandover, streak, telegram, untracked, x };
|
|
2195
|
+
export { AmountSetting, BalanceChain, ContentBody, type ContentData, ContentMetricName, type ContentTrigger, type ContentTriggerInput, DiscordMessageData, DiscordMessageTextData, DiscordReactionData, DiscordReader, type EvaluationCalendar, type EvaluationCalendarDay, type EvaluationContext, type EvaluationMember, GroupHandle, IdentityKind, ImageReader, IntegrationModule, type KeyedContext, LedgerHandle, LedgerReference, MemberCompletion, type MemberCompletionQuery, MemberIdentity, type Outcome, type PerformanceContext, type PerformanceOutcome, PointBalance, ProfileReferral, QuestHandle, type QuestKeyedContext, ReferralHandle, RoleOf, Setting, TelegramReader, Tracker, TrackerData, TrackerDataSchema, TrackerReader, type TrackerTrigger, TrackerTriggerContext, type TrackerTriggerInput, type TriggerAdmission, WalletReader, Where, type XContentBody, XReader, automatic, automaticFulfillment, badge, budget, calendar, content, count, customSource, decision, defineBadge, defineEngagementReward, defineLeaderboard, defineLedger, defineQuest, defineQuestType, defineReferral, defineTieredReward, defineTracker, discord, earned, evaluators, evidence, groupMembership, keyed, manual, once, pointLedgers, points, progress, questCompleted, rolling, settings, staffHandover, streak, telegram, tiktok, untracked, x, youtube };
|