@domino-sdk/relay 1.59.0 → 1.60.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 +26 -0
- package/dist/{accounts-CVonEkdb.d.ts → accounts-DoabriBX.d.ts} +4 -1
- package/dist/{attempt-captures-DBj-rxak.d.ts → attempt-captures-W2dgzGqE.d.ts} +1 -1
- package/dist/authoring.d.ts +160 -28
- package/dist/authoring.js +83 -14
- package/dist/{automatic-outcomes-FS9okvBP.d.ts → automatic-outcomes-Cmou89IS.d.ts} +1 -1
- package/dist/avatar.d.ts +1 -1
- package/dist/browser.d.ts +19 -10
- package/dist/browser.js +12 -10
- package/dist/{capability-error-DDJl0LY-.d.ts → capability-error-DufwG3G0.d.ts} +21 -1
- package/dist/{chunk-2LKGAL63.js → chunk-2FHNY52R.js} +8 -2
- package/dist/{chunk-EQF4ID47.js → chunk-422J3QRW.js} +12 -2
- package/dist/{chunk-KYUQEZZA.js → chunk-4OFH4BNX.js} +1 -1
- package/dist/{chunk-R4S6BFOH.js → chunk-6ZG7WNYX.js} +1 -1
- package/dist/{chunk-AWWCEP7F.js → chunk-GBSDAD3N.js} +811 -592
- package/dist/{chunk-YRSU2X2P.js → chunk-KUPVQXUJ.js} +2 -2
- package/dist/{chunk-LDLOB2UZ.js → chunk-KWFY7L7X.js} +4 -4
- package/dist/{chunk-UEMLYPKJ.js → chunk-MJEJQH5A.js} +13 -4
- package/dist/{chunk-W42KMMH5.js → chunk-N3LJ6GFK.js} +1 -1
- package/dist/{chunk-TZJT5CRF.js → chunk-N7YOS4ZU.js} +1 -1
- package/dist/{chunk-KBCTII6C.js → chunk-OTEUP2SG.js} +1 -1
- package/dist/{chunk-577DG2IT.js → chunk-VVRQQRMQ.js} +12 -12
- package/dist/{chunk-YMWRLAAP.js → chunk-VWMIA2TT.js} +8 -2
- package/dist/{chunk-6U5WWH3W.js → chunk-XQKUJL7H.js} +9 -4
- package/dist/{chunk-M2JQPDUX.js → chunk-Y2IGFLD2.js} +9 -9
- package/dist/chunk-YNW2ZUUP.js +247 -0
- package/dist/{chunk-IBROKMFV.js → chunk-YOAPPIWN.js} +1 -1
- package/dist/{client-3b9HjSzZ.d.ts → client-Cw1pB5sv.d.ts} +12 -7
- package/dist/{deployments-BydFVj4Q.d.ts → deployments-DI-W7fBq.d.ts} +786 -2
- package/dist/{groups-CFuTfFqG.d.ts → groups-9Jm3peq3.d.ts} +4 -1
- package/dist/index.d.ts +10 -10
- package/dist/index.js +9 -9
- package/dist/{integrations-DrbKQSTD.d.ts → integrations-CmIkP1Gi.d.ts} +48 -3
- package/dist/internal.d.ts +10 -10
- package/dist/internal.js +8 -8
- package/dist/{offers-DAfe1O3_.d.ts → offers-CqXfMIxq.d.ts} +3 -2
- package/dist/{pages-ChDVLrgR.d.ts → pages-Bti7g5mX.d.ts} +147 -2
- package/dist/{participant-activity-iciCEs_8.d.ts → participant-activity-DHL8QYks.d.ts} +4 -0
- package/dist/portal-proxy.js +3 -3
- package/dist/react/index.d.ts +15 -14
- package/dist/react/index.js +10 -10
- package/dist/runtime/authoring.js +1 -1
- package/dist/runtime/chunks/ADUMK6CR.js +1 -0
- package/dist/runtime/manifest.json +3 -3
- package/dist/runtime/schema.js +1 -1
- package/dist/{schema-BA0nRRlt.d.ts → schema-CwbRkmlr.d.ts} +142 -2
- package/dist/schema.d.ts +112 -17
- package/dist/schema.js +35 -21
- package/dist/server/index.d.ts +10 -10
- package/dist/server/index.js +292 -41
- package/dist/{submission-input-DxQ6RnKo.d.ts → submission-input-D9EGH_yb.d.ts} +2 -2
- package/dist/{telegram-browser-o3OIxGrJ.d.ts → telegram-browser-CTJh4Ro_.d.ts} +4 -4
- package/dist/testing.d.ts +7 -7
- package/dist/testing.js +8 -8
- package/dist/{transport-D_Eqf78J.d.ts → transport-B8Ss5lcz.d.ts} +5331 -118
- package/dist/{wallet-B06zvDXp.d.ts → wallet-DZWL7lJH.d.ts} +1 -1
- package/dist/{x-C28SNifw.d.ts → x-KFJD2x8y.d.ts} +2 -2
- package/package.json +1 -1
- package/dist/chunk-XGXDINGM.js +0 -357
- package/dist/runtime/chunks/BG43KQ2T.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @domino-sdk/relay
|
|
2
2
|
|
|
3
|
+
## 1.60.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- d258795: A budget can cap what one person gives, not only what one member receives. `budget({ key, scope: "author", period, limit, cost })` counts per tracker record author: the account that caused the record, such as a reaction's reactor, whether or not a member linked it. Put it in a tracker quest's `budgets` beside a `"member"` budget to cap both sides, for example a tip paid to a message's author with `beneficiary: "messageAuthor"`: at most 20 tips a day per receiver and 10 a day per reactor. A tip over either cap is rejected with `budget-exhausted`, permanently; other reactors' tips keep paying. It works on `telegram.reactions()`, `discord.reactions()`, kudos recipients and X `inReplyTo` replies. Author budgets share keys, calendar periods and the atomic commit with the other budgets, and imported completions don't count toward them.
|
|
8
|
+
|
|
9
|
+
An author budget needs a tracker trigger. `domino check` reports `AUTHOR_BUDGET_TRACKER_REQUIRED` on another quest, `domino build` and `domino deploy` refuse it, and Relay refuses its publication.
|
|
10
|
+
|
|
11
|
+
The types SDK 1.x code reads are unchanged: `Budget` keeps `scope: "member" | "project"`, and a quest's description lists author budgets in the new optional `authorBudgets` (`AuthorBudget`, `authorBudgetSchema` from `@domino-sdk/relay/schema`), apart from `budgets`. `budget()` returns an `AuthorBudget` for `scope: "author"`. A member's quest `budgets` (`QuestBudgetView`) leave author budgets out, since they cap someone else's giving.
|
|
12
|
+
|
|
13
|
+
- d41f5da: `relay.me.get()` and `useMe()` now return the member's `clock: { now, offsetMs }`, the clock Relay judges their activity on. A test member's clock runs ahead after the staging toolbar's **Next day** or `domino test-members advance`; every other member's `offsetMs` is 0. New `memberTime(me, at?)` from `@domino-sdk/relay/browser` turns a real instant into the member's time, so an app that shows campaign phases or open quests by date follows an advanced test member. `clock` is optional, and `memberTime` returns real time when a Relay older than it omits it. On staging, the toolbar's `domino:test-state-changed` event now carries `detail: { change, actingAs }`: what changed and which test member the page is signed in as.
|
|
14
|
+
- e899f47: Member imports carry referrals. A row's optional `referral` names the member's inviter (another row's `ref`, or the sign-in identity of an existing member), when they accepted, and the referral programs they already qualified in (`qualified: [{ program, at }]`). Applying records the referral and the qualifications without paying any referral reward, milestone or bonus; they count toward the inviter's qualified friends, and the friend's later points pay the program's bonus. An inviter's row applies before the rows that name it. New refusal codes: `unknown-inviter`, `self-referral`, `inviter-already-accepted`, `referral-cycle`, `inviter-refused` and `unknown-referral-program`. The check summary adds `referrals` (`accepted`, and `qualified` by program), `management.referrals.participants()` names the import that recorded a relationship or qualification in `import`, and `management.members.get()` returns the member's accepted referral in an optional `referral` (`inviter`, `acceptedAt`, `suspended`, `import`).
|
|
15
|
+
- 8ee2000: A member import vouches for Telegram and Discord accounts too. A row's `accounts` takes `{ kind: "telegram", subject }` and `{ kind: "discord", subject }`, each a numeric user ID, at most one of each per member, from `domino import` and `management.memberImports.addRows`. They work like a vouched X account: Telegram and Discord tracker records, quest checks and Discord role checks trust them from when the import attached them, nobody else can link them, and the member's own Telegram or Discord link replaces them. They never sign in: a Telegram or Discord sign-in with one is refused with `sign-in-method-disabled`. A row naming a second account of a kind, or another one than the member's, is refused with the new `MemberImportRefusalCode.TelegramAccountSelected` (`telegram-account-selected`) or `DiscordAccountSelected` (`discord-account-selected`).
|
|
16
|
+
|
|
17
|
+
`@domino-sdk/relay/server` adds `memberImportVouchedAccountSchema`, `memberImportFullRowSchema` and `memberImportFullRowsInputSchema`, with the types `MemberImportVouchedAccount`, `MemberImportFullRow`, `MemberImportFullRowInput` and `MemberImportFullRowsInput`, for rows with every kind of vouched account; `addRows` takes `MemberImportFullRowInput[]`. `memberImportAccountSchema`, `memberImportRowSchema` and `memberImportRowsInputSchema` stay the X-and-wallet form. Member identity states carry `imported: true` for an X, Discord or Telegram account an import attached, and so does a connected `ManagedTelegramAccount`.
|
|
18
|
+
|
|
19
|
+
An imported X, Telegram or Discord account now pays tracker records from the moment it was imported. Before, a vouched X account had no link time, so its records were skipped as historical. Members imported before this release keep that unknown link time until they link their X account themselves.
|
|
20
|
+
|
|
21
|
+
- f0d5b8e: Offers can be archived and restored. `management.offers.archive` and `unarchive` (`POST /management/v1/offers/OFFER/archive|unarchive`), `domino offers archive|unarchive OFFER --reason`, Console **Settings → Resources** and the offer's card in Console **Rewards** archive one in test, and a promotion carries it to live. Each returns `{ resource, changed }`, typed by the new `offerLifecycleResultSchema`, with `resource.kind` `offer`. An archived offer leaves member offer reads and refuses redemption with `offer-paused`; management reads keep it, with the new `archivedAt` field on `Offer`, and its redemptions can still be canceled. `management.resources.list()` and `domino resources list` list offers in a new `offers` array (`managedResourceListSchema`), beside the existing kinds. A rollback now archives an offer the earlier promotion did not carry.
|
|
22
|
+
- 6b5228b: Quests can announce a completion in a connected Telegram chat or Discord channel. List `telegram.postMessage({ chat, text, replyToTriggeringMessage })` or `discord.postMessage({ channel, text, replyToTriggeringMessage })` in the new optional `announcements` of `defineQuest`, beside `rewards` (at most three; an array or a function of the settings). The text is a template with the placeholders `{beneficiary}`, `{author}`, `{points}`, `{rewards}` and `{quest}` (`announcementPlaceholders`); people are mentioned through their linked account on that platform. Relay posts after the rewards commit, as a reward delivery with the new `RewardDeliveryAction.PostMessage` action and an empty `roleId`, retried with backoff and paced per chat; a failed post never undoes the rewards, and `management.retryRewardDelivery(id)` retries one. Descriptions carry them in the new optional `announcements` field (`announcementSchema`). `discord.channels({ postable: true })` lists channels the bot can't post in as unavailable, and `TelegramChat` gains an optional `canPost`. The CLI's authoring reference documents announcements.
|
|
23
|
+
- ea1f033: Revert an applied or stopped member import: `management.memberImports.revert(id, { reason })` starts it, and `domino imports revert IMPORT --reason TEXT` starts it and waits. In the background, one row at a time, it reverses the applied rows' opening balances (taking only points members still have; `unreversedPoints` lists the rest), revokes their imported completions (reason `import-reverted`, freeing the occurrence) and removes the wallets, accounts and identities they linked unless the member signed in with one since (`keptLinks`). Members stay in the project. A reverting or reverted import reads as `applied` with `revert` set, and is reverted once; the same `actionId` answers the import again. Rows applied before imports recorded their links keep them (`linksUntracked`). Reverting needs `publish` permission and works in live from API keys and CLI sessions too. Console shows **Revert import** on applied and stopped imports.
|
|
24
|
+
`MemberImport` gains `revert`: the reason, who asked and when, rows reverted so far, then `revertedAt` and the `outcome`.
|
|
25
|
+
- 9a7ad11: Stop a member import while it applies: `management.memberImports.stop(id)` and `domino imports stop IMPORT` let the row being applied finish, apply no more rows, and end the import: it reads as `applied` with `appliedAt` null and `stoppedAt` and `stoppedBy` set, and its remaining rows stay `ready`. A stopped import can't be applied again; import the remaining rows in a new import. Stopping needs `publish` permission and works in live from API keys and CLI sessions too. Console shows **Stop import** on an applying import.
|
|
26
|
+
`MemberImport` gains `stoppedAt` and `stoppedBy`; check `stoppedAt` to tell a stopped import from a fully applied one.
|
|
27
|
+
- df3a08c: A test member's clock moves by hours and minutes, or to an instant, so time-of-day rules can be tested: block edges, or midnight in the project's time zone. `management.testMembers.advance(member, input)` takes `{ actionId }` with one of `days` (1–30, unchanged: project-calendar days that keep the time of day), `hours` (1–720), `minutes` (1–43200) or `to`, an ISO 8601 instant with an offset that must be later than the member's clock (else 422 `test-member-clock-past`). From the CLI, `domino test-members advance MEMBER` takes one of `--days`, `--hours`, `--minutes` or `--to`. The 90-day limit holds across units (422 `test-member-clock-limit`): `days` still add up to at most 90 and land no later than the 90th date, and hours, minutes and `to` never move the clock past 90 days from now. `offsetDays` still counts the days advanced with `days`; hours, minutes and `to` leave it unchanged, so read the member's date from `today`. `@domino-sdk/relay/server` exports `testMemberClockAdvanceSchema` and `TestMemberClockAdvanceInput` for every form; `testMemberAdvanceSchema` and `TestMemberAdvanceInput` stay the `days` form.
|
|
28
|
+
|
|
3
29
|
## 1.59.0
|
|
4
30
|
|
|
5
31
|
### Minor Changes
|
|
@@ -77,6 +77,7 @@ declare const discordResourceSourceSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
77
77
|
text: "text";
|
|
78
78
|
announcement: "announcement";
|
|
79
79
|
}>>;
|
|
80
|
+
postable: z.ZodOptional<z.ZodLiteral<true>>;
|
|
80
81
|
}, z.core.$strict>, z.ZodObject<{
|
|
81
82
|
provider: z.ZodLiteral<"discord">;
|
|
82
83
|
resource: z.ZodLiteral<"role">;
|
|
@@ -136,6 +137,7 @@ declare const telegramChatSchema: z.ZodObject<{
|
|
|
136
137
|
username: z.ZodNullable<z.ZodString>;
|
|
137
138
|
status: z.ZodString;
|
|
138
139
|
issue: z.ZodNullable<z.ZodString>;
|
|
140
|
+
canPost: z.ZodOptional<z.ZodBoolean>;
|
|
139
141
|
connectedAt: z.ZodNumber;
|
|
140
142
|
}, z.core.$strip>;
|
|
141
143
|
type TelegramChat = z.infer<typeof telegramChatSchema>;
|
|
@@ -157,6 +159,7 @@ declare const telegramChatsSchema: z.ZodObject<{
|
|
|
157
159
|
username: z.ZodNullable<z.ZodString>;
|
|
158
160
|
status: z.ZodString;
|
|
159
161
|
issue: z.ZodNullable<z.ZodString>;
|
|
162
|
+
canPost: z.ZodOptional<z.ZodBoolean>;
|
|
160
163
|
connectedAt: z.ZodNumber;
|
|
161
164
|
}, z.core.$strip>>;
|
|
162
165
|
}, z.core.$strip>;
|
|
@@ -300,4 +303,4 @@ interface DiscordReader {
|
|
|
300
303
|
}): Promise<DiscordMessage | null>;
|
|
301
304
|
}
|
|
302
305
|
|
|
303
|
-
export { type AccountConnection as A,
|
|
306
|
+
export { type AccountConnection as A, discordReactionDataSchema as B, discordResourceSourceSchema as C, type DiscordMessageData as D, discordRewardSchema as E, telegramAccountConnectionSchema as F, telegramChatConnectionSchema as G, telegramChatIdSchema as H, telegramChatSchema as I, telegramChatsSchema as J, telegramInitDataSchema as K, telegramMemberInputSchema as L, telegramMessageDataSchema as M, telegramMiniAppSignInSchema as N, telegramReactionDataSchema as O, telegramSignInMethodsSchema as P, type TelegramAccountConnection as T, type AuthProvider as a, type TelegramSignInMethods as b, type DiscordMessageTextData as c, discordMessagesSourceSchema as d, discordReactionsSourceSchema as e, type DiscordReactionData as f, type TelegramReader as g, type DiscordReader as h, type TelegramChatMember as i, type TelegramChatMemberStatus as j, type TelegramMessageData as k, type TelegramReactionData as l, discordMemberSchema as m, discordMessageSchema as n, type DiscordMember as o, type DiscordMessage as p, type TelegramChat as q, type TelegramChatConnection as r, type TelegramChats as s, telegramChatMemberSchema as t, accountConnectionSchema as u, authProviderSchema as v, discordMemberInputSchema as w, discordMessageDataSchema as x, discordMessageInputSchema as y, discordMessageTextDataSchema as z };
|
package/dist/authoring.d.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { B as xContentBodySchema, I as IdentityKind, C as customSourceSchema, W as WithRecordData, D as WithContent, F as WithAccountRoles, y as ResourceHandle, x as QuestHandle, L as LedgerReference, G as GroupHandle, H as pointLedgerDeclarationSchema, J as TrackerSource, N as trackerDefinitionSchema, U as Tracker, V as TrackerData, X as SourceRoles, Y as LedgerHandle, Z as TrackerDataSchema, _ as xSearchSourceSchema, $ as XTweet, a0 as XContentMetric, a1 as TrackerTriggerPolicy, a2 as Where, a3 as MemberIdentity, P as PointBalance, a4 as ReferralHandle, a5 as TrackerTriggerContext, a6 as TrackerReader, a7 as TextReviewInput, a8 as TextResult, z 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-
|
|
2
|
-
export { aj as LedgerSetting, ak as TrackerPage, al as TrackerReadQuery, am as trackerDataSchema, an as trackerTriggerContextSchema } from './schema-
|
|
3
|
-
import { M as MemberCompletion, B as Budget } from './capability-error-
|
|
4
|
-
export { C as CapabilityError, a as CapabilityErrorCode, c as capabilityErrorCodes } from './capability-error-
|
|
5
|
-
import { N as NftCollection, o as ContractCall, p as ContractEvent, S as SolanaProgram, q as WalletBalanceSourceQuery, r as WalletTransaction, s as WalletInstruction, e as ProfileReferral, t as WalletReader } from './wallet-
|
|
6
|
-
export { u as ContractCallParts, v as ContractCallReturnType, w as ContractEventInput, x as ContractEventParts, y as ContractFunction, z as CosmosDenom, a as CosmosNetwork, E as EvmChainId, B as NftCollectionParts, D as NftStandard, F as WalletBalance, G as WalletBalanceChange, H as WalletBalanceQuery, I as WalletBalanceSample, J as WalletCall, K as WalletCallArgument, M as WalletCallQuery, Q as WalletDelegations, R as WalletDelegationsQuery, T as WalletEventCondition, U as WalletEventValue, V as WalletEvents, X as WalletEventsQuery, Y as WalletNfts, Z as WalletNftsQuery, _ as WalletTransactions, $ as WalletTransactionsQuery, a0 as cosmosDenomSchema, a1 as cosmosNetworkSchema, a2 as isContractCall, a3 as isContractEvent, a4 as isEvmChainId, a5 as isNftCollection, a6 as isSolanaProgram, a7 as maxWalletEventLogs, a8 as maxWalletEventLookback, a9 as maxWalletTransactionLookback, aa as maxWalletTransactions, ab as parseContractCall, ac as parseContractEvent, ad as parseContractFunction, ae as parseNftCollection } from './wallet-
|
|
1
|
+
import { B as xContentBodySchema, I as IdentityKind, C as customSourceSchema, W as WithRecordData, D as WithContent, F as WithAccountRoles, y as ResourceHandle, x as QuestHandle, L as LedgerReference, G as GroupHandle, H as pointLedgerDeclarationSchema, J as TrackerSource, N as trackerDefinitionSchema, U as Tracker, V as TrackerData, X as SourceRoles, Y as LedgerHandle, Z as TrackerDataSchema, _ as xSearchSourceSchema, $ as XTweet, a0 as XContentMetric, a1 as TrackerTriggerPolicy, a2 as Where, a3 as MemberIdentity, P as PointBalance, a4 as ReferralHandle, a5 as TrackerTriggerContext, a6 as TrackerReader, a7 as TextReviewInput, a8 as TextResult, z 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-CwbRkmlr.js';
|
|
2
|
+
export { aj as LedgerSetting, ak as TrackerPage, al as TrackerReadQuery, am as trackerDataSchema, an as trackerTriggerContextSchema } from './schema-CwbRkmlr.js';
|
|
3
|
+
import { M as MemberCompletion, B as Budget, A as AuthorBudget } from './capability-error-DufwG3G0.js';
|
|
4
|
+
export { C as CapabilityError, a as CapabilityErrorCode, c as capabilityErrorCodes } from './capability-error-DufwG3G0.js';
|
|
5
|
+
import { N as NftCollection, o as ContractCall, p as ContractEvent, S as SolanaProgram, q as WalletBalanceSourceQuery, r as WalletTransaction, s as WalletInstruction, e as ProfileReferral, t as WalletReader } from './wallet-DZWL7lJH.js';
|
|
6
|
+
export { u as ContractCallParts, v as ContractCallReturnType, w as ContractEventInput, x as ContractEventParts, y as ContractFunction, z as CosmosDenom, a as CosmosNetwork, E as EvmChainId, B as NftCollectionParts, D as NftStandard, F as WalletBalance, G as WalletBalanceChange, H as WalletBalanceQuery, I as WalletBalanceSample, J as WalletCall, K as WalletCallArgument, M as WalletCallQuery, Q as WalletDelegations, R as WalletDelegationsQuery, T as WalletEventCondition, U as WalletEventValue, V as WalletEvents, X as WalletEventsQuery, Y as WalletNfts, Z as WalletNftsQuery, _ as WalletTransactions, $ as WalletTransactionsQuery, a0 as cosmosDenomSchema, a1 as cosmosNetworkSchema, a2 as isContractCall, a3 as isContractEvent, a4 as isEvmChainId, a5 as isNftCollection, a6 as isSolanaProgram, a7 as maxWalletEventLogs, a8 as maxWalletEventLookback, a9 as maxWalletTransactionLookback, aa as maxWalletTransactions, ab as parseContractCall, ac as parseContractEvent, ad as parseContractFunction, ae as parseNftCollection } from './wallet-DZWL7lJH.js';
|
|
7
7
|
import * as z from 'zod';
|
|
8
8
|
export { z } from 'zod';
|
|
9
|
-
import { f as badgeDeclarationSchema, B as Badge } from './offers-
|
|
10
|
-
export { g as defineOffer } from './offers-
|
|
11
|
-
import { E as EngagementBudget, m as leaderboardDefinitionSchema, l as AuthoringIdentity, r as referralAuthoringSchema, C as CampaignDefinition, A as AvailabilityWindow } from './groups-
|
|
12
|
-
export { n as defineCampaign, o as defineGroup } from './groups-
|
|
13
|
-
import { d as discordMessagesSourceSchema, D as DiscordMessageData, c as DiscordMessageTextData, e as discordReactionsSourceSchema, f as DiscordReactionData, g as TelegramReader, h as DiscordReader } from './accounts-
|
|
14
|
-
export { i as TelegramChatMember, j as TelegramChatMemberStatus, k as TelegramMessageData, l as TelegramReactionData } from './accounts-
|
|
9
|
+
import { f as badgeDeclarationSchema, B as Badge } from './offers-CqXfMIxq.js';
|
|
10
|
+
export { g as defineOffer } from './offers-CqXfMIxq.js';
|
|
11
|
+
import { E as EngagementBudget, m as leaderboardDefinitionSchema, l as AuthoringIdentity, r as referralAuthoringSchema, C as CampaignDefinition, A as AvailabilityWindow } from './groups-9Jm3peq3.js';
|
|
12
|
+
export { n as defineCampaign, o as defineGroup } from './groups-9Jm3peq3.js';
|
|
13
|
+
import { d as discordMessagesSourceSchema, D as DiscordMessageData, c as DiscordMessageTextData, e as discordReactionsSourceSchema, f as DiscordReactionData, g as TelegramReader, h as DiscordReader } from './accounts-DoabriBX.js';
|
|
14
|
+
export { i as TelegramChatMember, j as TelegramChatMemberStatus, k as TelegramMessageData, l as TelegramReactionData } from './accounts-DoabriBX.js';
|
|
15
15
|
import { a as StreakPolicy, Q as QuizContent } from './streaks-0YuipsUQ.js';
|
|
16
|
-
import { R as ResourceSource, S as Setting, A as AmountSetting, B as BalanceChain, I as IntegrationModule, a as BoundSettings } from './integrations-
|
|
17
|
-
export { D as DashboardInput,
|
|
18
|
-
import { P as Prerequisite, T as TextEvidence, U as UrlEvidence, a as TextOptions, b as UrlOptions } from './submission-input-
|
|
19
|
-
export { c as balanceAtLeast, d as completed, i as inGroup } from './submission-input-
|
|
20
|
-
import { I as ImageReader, X as XReader } from './x-
|
|
16
|
+
import { R as ResourceSource, S as Setting, A as AmountSetting, B as BalanceChain, I as IntegrationModule, a as BoundSettings, b as Announcement } from './integrations-CmIkP1Gi.js';
|
|
17
|
+
export { D as DashboardInput, c as DashboardPanelInput, T as TikTokVideoBody, d as TikTokVideoMetric, Y as YouTubeShortBody, e as YouTubeShortMetric, f as defineDashboard } from './integrations-CmIkP1Gi.js';
|
|
18
|
+
import { P as Prerequisite, T as TextEvidence, U as UrlEvidence, a as TextOptions, b as UrlOptions } from './submission-input-D9EGH_yb.js';
|
|
19
|
+
export { c as balanceAtLeast, d as completed, i as inGroup } from './submission-input-D9EGH_yb.js';
|
|
20
|
+
import { I as ImageReader, X as XReader } from './x-KFJD2x8y.js';
|
|
21
21
|
export { f as formatUnits, p as parseUnits } from './units-CwgsPB_r.js';
|
|
22
22
|
import './analytics-URV-mxjH.js';
|
|
23
23
|
|
|
@@ -446,13 +446,36 @@ declare const discord: {
|
|
|
446
446
|
action: "grant-role";
|
|
447
447
|
roleId: string;
|
|
448
448
|
};
|
|
449
|
+
/**
|
|
450
|
+
* An announcement Domino's bot posts in a channel of the project's Discord server when a
|
|
451
|
+
* completion pays, such as `"{beneficiary} got +{points} XP from {author}"`. Placeholders are
|
|
452
|
+
* `announcementPlaceholders`; `{beneficiary}` and `{author}` mention linked Discord accounts.
|
|
453
|
+
* Pass it in the quest's `announcements`, and declare the `discord` integration.
|
|
454
|
+
*/
|
|
455
|
+
postMessage(options: {
|
|
456
|
+
channel: string;
|
|
457
|
+
text: string;
|
|
458
|
+
replyToTriggeringMessage?: boolean;
|
|
459
|
+
}): {
|
|
460
|
+
action: "post-message";
|
|
461
|
+
text: string;
|
|
462
|
+
provider: "discord";
|
|
463
|
+
channel: string;
|
|
464
|
+
replyToTriggeringMessage?: boolean | undefined;
|
|
465
|
+
};
|
|
449
466
|
messages: typeof messages;
|
|
450
467
|
reactions: typeof reactions;
|
|
451
468
|
roles(options?: {
|
|
452
469
|
assignable?: boolean;
|
|
453
470
|
}): ResourceSource;
|
|
471
|
+
/**
|
|
472
|
+
* A channel of the project's Discord server, for a resource setting. With `postable: true`,
|
|
473
|
+
* Console lists channels Domino's bot cannot post in as unavailable, as an announcement's
|
|
474
|
+
* channel needs.
|
|
475
|
+
*/
|
|
454
476
|
channels(options?: {
|
|
455
477
|
types?: ChannelTypes;
|
|
478
|
+
postable?: boolean;
|
|
456
479
|
}): ResourceSource;
|
|
457
480
|
};
|
|
458
481
|
/**
|
|
@@ -470,11 +493,30 @@ declare const discord: {
|
|
|
470
493
|
* Pay the message's author with `automatic({ tracker, beneficiary: "messageAuthor" })`.
|
|
471
494
|
* - Quests read membership with `ctx.telegram.member({ chat })`, naming the chat with
|
|
472
495
|
* `settings.telegramChat()`.
|
|
496
|
+
* - `telegram.postMessage({ chat, text })`: an announcement the bot posts in a connected chat
|
|
497
|
+
* when a completion pays, listed in the quest's `announcements`.
|
|
473
498
|
*
|
|
474
499
|
* In SDK 1.x both sources are custom sources whose namespaces Relay reserves: only Relay writes
|
|
475
500
|
* their records, and the accounts on them are Telegram accounts whatever `identities` says.
|
|
476
501
|
*/
|
|
477
502
|
declare const telegram: {
|
|
503
|
+
/**
|
|
504
|
+
* An announcement Domino's bot posts in a connected chat when a completion pays, such as
|
|
505
|
+
* `"{beneficiary} got +{points} XP from {author}"`. Name the chat with `settings.telegramChat()`.
|
|
506
|
+
* Placeholders are `announcementPlaceholders`; `{beneficiary}` and `{author}` mention Telegram
|
|
507
|
+
* accounts. Pass it in the quest's `announcements`.
|
|
508
|
+
*/
|
|
509
|
+
postMessage(options: {
|
|
510
|
+
chat: string;
|
|
511
|
+
text: string;
|
|
512
|
+
replyToTriggeringMessage?: boolean;
|
|
513
|
+
}): {
|
|
514
|
+
action: "post-message";
|
|
515
|
+
text: string;
|
|
516
|
+
provider: "telegram";
|
|
517
|
+
chat: string;
|
|
518
|
+
replyToTriggeringMessage?: boolean | undefined;
|
|
519
|
+
};
|
|
478
520
|
messages(): {
|
|
479
521
|
kind: "custom";
|
|
480
522
|
namespace: string;
|
|
@@ -1068,19 +1110,21 @@ type QuestKeyedContext<S, G> = Omit<KeyedContext, "tracker"> & {
|
|
|
1068
1110
|
/** The pinned tracker observation: non-null and typed for a tracker trigger, null for others. */
|
|
1069
1111
|
tracker: ContextTracker<G>;
|
|
1070
1112
|
};
|
|
1071
|
-
|
|
1113
|
+
type BudgetDefinition<B extends Budget | AuthorBudget> = Omit<B, "id" | "cost"> & {
|
|
1072
1114
|
key: string;
|
|
1073
1115
|
cost: number | {
|
|
1074
1116
|
ledger: LedgerReference;
|
|
1075
1117
|
};
|
|
1076
|
-
}
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1118
|
+
};
|
|
1119
|
+
/**
|
|
1120
|
+
* A named cap on a quest's completions or awarded points, per member (`scope: "member"`), for
|
|
1121
|
+
* everyone together (`"project"`), or per tracker record author (`"author"`): the account that
|
|
1122
|
+
* caused the record, such as a reaction's reactor, whether or not a member linked it. An author
|
|
1123
|
+
* budget caps what one person gives when the quest pays someone else, and needs a tracker trigger.
|
|
1124
|
+
*/
|
|
1125
|
+
declare const budget: {
|
|
1126
|
+
(definition: BudgetDefinition<Budget>): Budget;
|
|
1127
|
+
(definition: BudgetDefinition<AuthorBudget>): AuthorBudget;
|
|
1084
1128
|
};
|
|
1085
1129
|
declare const keyed: (key: (ctx: KeyedContext) => string) => {
|
|
1086
1130
|
kind: "keyed";
|
|
@@ -1464,7 +1508,8 @@ declare const defineQuest: <T extends Record<string, Setting>, const G extends T
|
|
|
1464
1508
|
* (`relay.profiles.completions`). Hidden by default.
|
|
1465
1509
|
*/
|
|
1466
1510
|
profile?: QuestProfile;
|
|
1467
|
-
|
|
1511
|
+
/** Its {@link budget}s; an author budget needs a tracker trigger. */
|
|
1512
|
+
budgets?: (Budget | AuthorBudget)[];
|
|
1468
1513
|
/**
|
|
1469
1514
|
* Milliseconds a member waits after an attempt is rejected, by the evaluator or a
|
|
1470
1515
|
* reviewer, before submitting again: `300_000` lets a quiz be retried every five minutes.
|
|
@@ -1522,6 +1567,26 @@ declare const defineQuest: <T extends Record<string, Setting>, const G extends T
|
|
|
1522
1567
|
})[] | ((ctx: {
|
|
1523
1568
|
settings: z.core.$InferObjectOutput<T, {}>;
|
|
1524
1569
|
}) => Reward[]);
|
|
1570
|
+
/**
|
|
1571
|
+
* Messages Relay posts when a completion pays, after its rewards commit, such as
|
|
1572
|
+
* `telegram.postMessage({ chat, text: "{beneficiary} got +{points} XP from {author}" })`.
|
|
1573
|
+
* At most three. Return none while a setting they need is empty.
|
|
1574
|
+
*/
|
|
1575
|
+
announcements?: ({
|
|
1576
|
+
action: "post-message";
|
|
1577
|
+
text: string;
|
|
1578
|
+
provider: "telegram";
|
|
1579
|
+
chat: string;
|
|
1580
|
+
replyToTriggeringMessage?: boolean | undefined;
|
|
1581
|
+
} | {
|
|
1582
|
+
action: "post-message";
|
|
1583
|
+
text: string;
|
|
1584
|
+
provider: "discord";
|
|
1585
|
+
channel: string;
|
|
1586
|
+
replyToTriggeringMessage?: boolean | undefined;
|
|
1587
|
+
})[] | ((ctx: {
|
|
1588
|
+
settings: z.core.$InferObjectOutput<T, {}>;
|
|
1589
|
+
}) => Announcement[]) | undefined;
|
|
1525
1590
|
evaluate?: Evaluator<z.core.$InferObjectOutput<T, {}>, QuestInput<G>, NoInfer<G>, NoInfer<D>> | undefined;
|
|
1526
1591
|
/**
|
|
1527
1592
|
* A content quest's performance stage: once content evaluation accepts an item, each later
|
|
@@ -1596,6 +1661,7 @@ declare const defineQuest: <T extends Record<string, Setting>, const G extends T
|
|
|
1596
1661
|
provider: "discord";
|
|
1597
1662
|
resource: "channel";
|
|
1598
1663
|
types: ("text" | "announcement")[];
|
|
1664
|
+
postable?: true | undefined;
|
|
1599
1665
|
} | {
|
|
1600
1666
|
provider: "discord";
|
|
1601
1667
|
resource: "role";
|
|
@@ -1814,6 +1880,19 @@ declare const defineQuest: <T extends Record<string, Setting>, const G extends T
|
|
|
1814
1880
|
balance: string;
|
|
1815
1881
|
};
|
|
1816
1882
|
}[];
|
|
1883
|
+
announcements?: ({
|
|
1884
|
+
action: "post-message";
|
|
1885
|
+
text: string;
|
|
1886
|
+
provider: "telegram";
|
|
1887
|
+
chat: string;
|
|
1888
|
+
replyToTriggeringMessage?: boolean | undefined;
|
|
1889
|
+
} | {
|
|
1890
|
+
action: "post-message";
|
|
1891
|
+
text: string;
|
|
1892
|
+
provider: "discord";
|
|
1893
|
+
channel: string;
|
|
1894
|
+
replyToTriggeringMessage?: boolean | undefined;
|
|
1895
|
+
})[] | undefined;
|
|
1817
1896
|
performance?: {
|
|
1818
1897
|
metrics: string[];
|
|
1819
1898
|
maxAgeMs: number;
|
|
@@ -1831,6 +1910,15 @@ declare const defineQuest: <T extends Record<string, Setting>, const G extends T
|
|
|
1831
1910
|
from: number;
|
|
1832
1911
|
until: number;
|
|
1833
1912
|
} | undefined;
|
|
1913
|
+
authorBudgets?: {
|
|
1914
|
+
id: string;
|
|
1915
|
+
period: "lifetime" | "day" | "week" | "month";
|
|
1916
|
+
limit: number;
|
|
1917
|
+
cost: number | {
|
|
1918
|
+
balance: string;
|
|
1919
|
+
};
|
|
1920
|
+
scope: "author";
|
|
1921
|
+
}[] | undefined;
|
|
1834
1922
|
retryCooldownMs?: number | undefined;
|
|
1835
1923
|
completionCooldownMs?: number | undefined;
|
|
1836
1924
|
};
|
|
@@ -1914,7 +2002,8 @@ declare const defineQuestType: <T extends Record<string, Setting>, const G exten
|
|
|
1914
2002
|
* (`relay.profiles.completions`). Hidden by default.
|
|
1915
2003
|
*/
|
|
1916
2004
|
profile?: QuestProfile;
|
|
1917
|
-
|
|
2005
|
+
/** Its {@link budget}s; an author budget needs a tracker trigger. */
|
|
2006
|
+
budgets?: (Budget | AuthorBudget)[];
|
|
1918
2007
|
/**
|
|
1919
2008
|
* Milliseconds a member waits after an attempt is rejected, by the evaluator or a
|
|
1920
2009
|
* reviewer, before submitting again: `300_000` lets a quiz be retried every five minutes.
|
|
@@ -1972,6 +2061,26 @@ declare const defineQuestType: <T extends Record<string, Setting>, const G exten
|
|
|
1972
2061
|
})[] | ((ctx: {
|
|
1973
2062
|
settings: z.core.$InferObjectOutput<T, {}>;
|
|
1974
2063
|
}) => Reward[]);
|
|
2064
|
+
/**
|
|
2065
|
+
* Messages Relay posts when a completion pays, after its rewards commit, such as
|
|
2066
|
+
* `telegram.postMessage({ chat, text: "{beneficiary} got +{points} XP from {author}" })`.
|
|
2067
|
+
* At most three. Return none while a setting they need is empty.
|
|
2068
|
+
*/
|
|
2069
|
+
announcements?: ({
|
|
2070
|
+
action: "post-message";
|
|
2071
|
+
text: string;
|
|
2072
|
+
provider: "telegram";
|
|
2073
|
+
chat: string;
|
|
2074
|
+
replyToTriggeringMessage?: boolean | undefined;
|
|
2075
|
+
} | {
|
|
2076
|
+
action: "post-message";
|
|
2077
|
+
text: string;
|
|
2078
|
+
provider: "discord";
|
|
2079
|
+
channel: string;
|
|
2080
|
+
replyToTriggeringMessage?: boolean | undefined;
|
|
2081
|
+
})[] | ((ctx: {
|
|
2082
|
+
settings: z.core.$InferObjectOutput<T, {}>;
|
|
2083
|
+
}) => Announcement[]) | undefined;
|
|
1975
2084
|
evaluate?: Evaluator<z.core.$InferObjectOutput<T, {}>, QuestInput<G>, NoInfer<G>, NoInfer<D>> | undefined;
|
|
1976
2085
|
/**
|
|
1977
2086
|
* A content quest's performance stage: once content evaluation accepts an item, each later
|
|
@@ -2046,6 +2155,7 @@ declare const defineQuestType: <T extends Record<string, Setting>, const G exten
|
|
|
2046
2155
|
provider: "discord";
|
|
2047
2156
|
resource: "channel";
|
|
2048
2157
|
types: ("text" | "announcement")[];
|
|
2158
|
+
postable?: true | undefined;
|
|
2049
2159
|
} | {
|
|
2050
2160
|
provider: "discord";
|
|
2051
2161
|
resource: "role";
|
|
@@ -2264,6 +2374,19 @@ declare const defineQuestType: <T extends Record<string, Setting>, const G exten
|
|
|
2264
2374
|
balance: string;
|
|
2265
2375
|
};
|
|
2266
2376
|
}[];
|
|
2377
|
+
announcements?: ({
|
|
2378
|
+
action: "post-message";
|
|
2379
|
+
text: string;
|
|
2380
|
+
provider: "telegram";
|
|
2381
|
+
chat: string;
|
|
2382
|
+
replyToTriggeringMessage?: boolean | undefined;
|
|
2383
|
+
} | {
|
|
2384
|
+
action: "post-message";
|
|
2385
|
+
text: string;
|
|
2386
|
+
provider: "discord";
|
|
2387
|
+
channel: string;
|
|
2388
|
+
replyToTriggeringMessage?: boolean | undefined;
|
|
2389
|
+
})[] | undefined;
|
|
2267
2390
|
performance?: {
|
|
2268
2391
|
metrics: string[];
|
|
2269
2392
|
maxAgeMs: number;
|
|
@@ -2281,6 +2404,15 @@ declare const defineQuestType: <T extends Record<string, Setting>, const G exten
|
|
|
2281
2404
|
from: number;
|
|
2282
2405
|
until: number;
|
|
2283
2406
|
} | undefined;
|
|
2407
|
+
authorBudgets?: {
|
|
2408
|
+
id: string;
|
|
2409
|
+
period: "lifetime" | "day" | "week" | "month";
|
|
2410
|
+
limit: number;
|
|
2411
|
+
cost: number | {
|
|
2412
|
+
balance: string;
|
|
2413
|
+
};
|
|
2414
|
+
scope: "author";
|
|
2415
|
+
}[] | undefined;
|
|
2284
2416
|
retryCooldownMs?: number | undefined;
|
|
2285
2417
|
completionCooldownMs?: number | undefined;
|
|
2286
2418
|
};
|
package/dist/authoring.js
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
tiktokVideoMetrics,
|
|
9
9
|
youtubeShortBodySchema,
|
|
10
10
|
youtubeShortMetrics
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-N3LJ6GFK.js";
|
|
12
12
|
import {
|
|
13
13
|
CapabilityError,
|
|
14
14
|
capabilityErrorCodes
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
sourceDataSchema,
|
|
18
18
|
sourceRoles,
|
|
19
19
|
validateQuestShape
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-VWMIA2TT.js";
|
|
21
21
|
import {
|
|
22
22
|
badgeDeclarationSchema,
|
|
23
23
|
defineOffer,
|
|
@@ -26,13 +26,13 @@ import {
|
|
|
26
26
|
engagementScoreSchema,
|
|
27
27
|
leaderboardAuthoringSchema,
|
|
28
28
|
referralAuthoringSchema
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-MJEJQH5A.js";
|
|
30
30
|
import {
|
|
31
|
-
pointLedgerDeclarationSchema
|
|
32
|
-
|
|
33
|
-
telegramReactionDataSchema
|
|
34
|
-
} from "./chunk-XGXDINGM.js";
|
|
31
|
+
pointLedgerDeclarationSchema
|
|
32
|
+
} from "./chunk-YNW2ZUUP.js";
|
|
35
33
|
import {
|
|
34
|
+
announcementSchema,
|
|
35
|
+
authorBudgetSchema,
|
|
36
36
|
authoringKey,
|
|
37
37
|
badgeReward,
|
|
38
38
|
balanceAtLeast,
|
|
@@ -51,6 +51,7 @@ import {
|
|
|
51
51
|
defaultTriggerMode,
|
|
52
52
|
defineCampaign,
|
|
53
53
|
defineGroup,
|
|
54
|
+
discordAnnouncementSchema,
|
|
54
55
|
discordMessagesSourceSchema,
|
|
55
56
|
discordReactionsSourceSchema,
|
|
56
57
|
discordRewardSchema,
|
|
@@ -73,6 +74,7 @@ import {
|
|
|
73
74
|
maxWalletEventLookback,
|
|
74
75
|
maxWalletTransactionLookback,
|
|
75
76
|
maxWalletTransactions,
|
|
77
|
+
parseAnnouncementTemplate,
|
|
76
78
|
parseContractCall,
|
|
77
79
|
parseContractEvent,
|
|
78
80
|
parseContractFunction,
|
|
@@ -96,7 +98,10 @@ import {
|
|
|
96
98
|
sourceContent,
|
|
97
99
|
sourceIdentities,
|
|
98
100
|
streakPolicySchema,
|
|
101
|
+
telegramAnnouncementSchema,
|
|
102
|
+
telegramMessageDataSchema,
|
|
99
103
|
telegramMessagesNamespace,
|
|
104
|
+
telegramReactionDataSchema,
|
|
100
105
|
telegramReactionsNamespace,
|
|
101
106
|
textOptionsSchema,
|
|
102
107
|
textSettingSchema,
|
|
@@ -115,7 +120,7 @@ import {
|
|
|
115
120
|
whereSettings,
|
|
116
121
|
xSearchSourceSchema,
|
|
117
122
|
youtubeShortsNamespace
|
|
118
|
-
} from "./chunk-
|
|
123
|
+
} from "./chunk-GBSDAD3N.js";
|
|
119
124
|
|
|
120
125
|
// src/builders.ts
|
|
121
126
|
import * as z from "zod";
|
|
@@ -292,6 +297,19 @@ var discord = {
|
|
|
292
297
|
action: "grant-role",
|
|
293
298
|
roleId
|
|
294
299
|
}),
|
|
300
|
+
/**
|
|
301
|
+
* An announcement Domino's bot posts in a channel of the project's Discord server when a
|
|
302
|
+
* completion pays, such as `"{beneficiary} got +{points} XP from {author}"`. Placeholders are
|
|
303
|
+
* `announcementPlaceholders`; `{beneficiary}` and `{author}` mention linked Discord accounts.
|
|
304
|
+
* Pass it in the quest's `announcements`, and declare the `discord` integration.
|
|
305
|
+
*/
|
|
306
|
+
postMessage(options) {
|
|
307
|
+
return discordAnnouncementSchema.parse({
|
|
308
|
+
provider: "discord",
|
|
309
|
+
action: "post-message",
|
|
310
|
+
...options
|
|
311
|
+
});
|
|
312
|
+
},
|
|
295
313
|
messages,
|
|
296
314
|
reactions,
|
|
297
315
|
roles(options = {}) {
|
|
@@ -301,15 +319,34 @@ var discord = {
|
|
|
301
319
|
assignable: options.assignable ?? false
|
|
302
320
|
});
|
|
303
321
|
},
|
|
322
|
+
/**
|
|
323
|
+
* A channel of the project's Discord server, for a resource setting. With `postable: true`,
|
|
324
|
+
* Console lists channels Domino's bot cannot post in as unavailable, as an announcement's
|
|
325
|
+
* channel needs.
|
|
326
|
+
*/
|
|
304
327
|
channels(options = {}) {
|
|
305
328
|
return resourceSourceSchema.parse({
|
|
306
329
|
provider: "discord",
|
|
307
330
|
resource: "channel",
|
|
308
|
-
types: options.types ?? ["text", "announcement"]
|
|
331
|
+
types: options.types ?? ["text", "announcement"],
|
|
332
|
+
...options.postable ? { postable: true } : {}
|
|
309
333
|
});
|
|
310
334
|
}
|
|
311
335
|
};
|
|
312
336
|
var telegram = {
|
|
337
|
+
/**
|
|
338
|
+
* An announcement Domino's bot posts in a connected chat when a completion pays, such as
|
|
339
|
+
* `"{beneficiary} got +{points} XP from {author}"`. Name the chat with `settings.telegramChat()`.
|
|
340
|
+
* Placeholders are `announcementPlaceholders`; `{beneficiary}` and `{author}` mention Telegram
|
|
341
|
+
* accounts. Pass it in the quest's `announcements`.
|
|
342
|
+
*/
|
|
343
|
+
postMessage(options) {
|
|
344
|
+
return telegramAnnouncementSchema.parse({
|
|
345
|
+
provider: "telegram",
|
|
346
|
+
action: "post-message",
|
|
347
|
+
...options
|
|
348
|
+
});
|
|
349
|
+
},
|
|
313
350
|
messages() {
|
|
314
351
|
return customSource(telegramMessagesNamespace, {
|
|
315
352
|
identities: ["member"],
|
|
@@ -801,14 +838,17 @@ function content(input) {
|
|
|
801
838
|
}
|
|
802
839
|
return trackerTrigger({ ...input, content: true }, "content");
|
|
803
840
|
}
|
|
804
|
-
|
|
841
|
+
function defineBudget(definition) {
|
|
805
842
|
const { key: _, cost, ...properties } = definition;
|
|
806
|
-
|
|
843
|
+
const parsed = {
|
|
807
844
|
...properties,
|
|
808
845
|
id: authoringKey(definition),
|
|
809
846
|
cost: typeof cost === "number" ? cost : { balance: ledgerKey(cost.ledger) }
|
|
810
|
-
}
|
|
811
|
-
|
|
847
|
+
};
|
|
848
|
+
return properties.scope === "author" ? authorBudgetSchema.parse(parsed) : budgetSchema.parse(parsed);
|
|
849
|
+
}
|
|
850
|
+
var budget = defineBudget;
|
|
851
|
+
var authorBudgets = (budgets = []) => budgets.filter((value) => value.scope === "author");
|
|
812
852
|
var keyed = (key) => ({
|
|
813
853
|
kind: "keyed",
|
|
814
854
|
key
|
|
@@ -928,11 +968,13 @@ function questBuilder(template) {
|
|
|
928
968
|
"A quest needs a completion, such as once(), keyed(...), streak(...) or progress(...)"
|
|
929
969
|
);
|
|
930
970
|
}
|
|
971
|
+
const author = authorBudgets(definition.budgets);
|
|
931
972
|
validateQuestShape(
|
|
932
973
|
{
|
|
933
974
|
trigger: definition.trigger,
|
|
934
975
|
completion: completion ?? { kind: "keyed" },
|
|
935
976
|
requires: definition.requires ?? [],
|
|
977
|
+
authorBudgets: author,
|
|
936
978
|
performance: definition.performance ? contentPerformancePolicySchema.parse({
|
|
937
979
|
metrics: definition.performance.metrics,
|
|
938
980
|
maxAgeMs: definition.performance.maxAgeMs
|
|
@@ -992,10 +1034,33 @@ function questBuilder(template) {
|
|
|
992
1034
|
const rewards = rewardBundleSchema.parse(
|
|
993
1035
|
typeof definition.rewards === "function" ? definition.rewards({ settings: settings2 }) : definition.rewards
|
|
994
1036
|
);
|
|
1037
|
+
const announcements = z3.array(announcementSchema).max(3, "A quest posts at most three announcements").parse(
|
|
1038
|
+
(typeof definition.announcements === "function" ? definition.announcements({ settings: settings2 }) : definition.announcements) ?? []
|
|
1039
|
+
);
|
|
1040
|
+
const trackerTrigger3 = definition.trigger.kind === "automatic" && definition.trigger.tracker !== void 0;
|
|
1041
|
+
for (const announcement of announcements) {
|
|
1042
|
+
const parsed = parseAnnouncementTemplate(announcement.text);
|
|
1043
|
+
const usesAuthor = "segments" in parsed && parsed.segments.some(
|
|
1044
|
+
(segment) => segment.kind === "placeholder" && segment.name === "author"
|
|
1045
|
+
);
|
|
1046
|
+
if (!trackerTrigger3 && usesAuthor) {
|
|
1047
|
+
throw new Error(
|
|
1048
|
+
"An announcement names {author} only on a quest with an automatic tracker trigger"
|
|
1049
|
+
);
|
|
1050
|
+
}
|
|
1051
|
+
if (!trackerTrigger3 && announcement.replyToTriggeringMessage) {
|
|
1052
|
+
throw new Error(
|
|
1053
|
+
"An announcement replies to the triggering message only on a quest with an automatic tracker trigger"
|
|
1054
|
+
);
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
995
1057
|
const required = [
|
|
996
1058
|
...rewards.flatMap(
|
|
997
1059
|
(reward) => reward.kind === "integration" ? [reward.provider] : []
|
|
998
1060
|
),
|
|
1061
|
+
...announcements.flatMap(
|
|
1062
|
+
(announcement) => announcement.provider === "discord" ? ["discord"] : []
|
|
1063
|
+
),
|
|
999
1064
|
...Object.values(fields).flatMap(
|
|
1000
1065
|
(field) => field.kind === "resource" && field.source.provider !== "domino" ? [field.source.provider] : []
|
|
1001
1066
|
)
|
|
@@ -1013,6 +1078,7 @@ function questBuilder(template) {
|
|
|
1013
1078
|
fields,
|
|
1014
1079
|
values,
|
|
1015
1080
|
rewards,
|
|
1081
|
+
...announcements.length ? { announcements } : {},
|
|
1016
1082
|
humanReview: definition.review?.({ settings: settings2 })?.enabled ?? true,
|
|
1017
1083
|
trigger: definition.trigger,
|
|
1018
1084
|
...definition.performance ? {
|
|
@@ -1031,7 +1097,10 @@ function questBuilder(template) {
|
|
|
1031
1097
|
} : completion.kind === "streak" ? completion : { kind: completion.kind },
|
|
1032
1098
|
visibility: definition.visibility ?? "visible",
|
|
1033
1099
|
profile: definition.profile ?? { visible: false },
|
|
1034
|
-
budgets: definition.budgets ?? []
|
|
1100
|
+
budgets: (definition.budgets ?? []).filter(
|
|
1101
|
+
(value) => value.scope !== "author"
|
|
1102
|
+
),
|
|
1103
|
+
...author.length ? { authorBudgets: author } : {},
|
|
1035
1104
|
requires: definition.requires ?? [],
|
|
1036
1105
|
...definition.campaign ? { campaign: definition.campaign } : {},
|
|
1037
1106
|
...definition.availability ? { availability: definition.availability } : {},
|
package/dist/avatar.d.ts
CHANGED