@domino-sdk/relay 1.11.1 → 1.14.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/README.md +1 -0
- package/build.mjs +15 -0
- package/dist/accounts-5ciAkCMP.d.ts +147 -0
- package/dist/{activity-CNiPDPK6.d.ts → activity-D_R3J-gU.d.ts} +115 -115
- package/dist/attempt-captures-DZldPZJc.d.ts +285 -0
- package/dist/authoring.d.ts +49 -47
- package/dist/authoring.js +6 -4
- package/dist/{automatic-outcomes-kPIDv6X_.d.ts → automatic-outcomes-6lJGnSDe.d.ts} +1 -1
- package/dist/browser.d.ts +8 -7
- package/dist/browser.js +7 -6
- package/dist/capability-error-oTd3eYFH.d.ts +151 -0
- package/dist/chunk-2UAVZCMH.js +314 -0
- package/dist/chunk-5TS3OAWS.js +470 -0
- package/dist/{chunk-PUDL4JBY.js → chunk-6DD7DVNQ.js} +2 -2
- package/dist/{chunk-AGFUDCNM.js → chunk-C3CB4WIQ.js} +1 -1
- package/dist/{chunk-T657WO56.js → chunk-LLMJ2SUT.js} +6 -2
- package/dist/chunk-NIYCAW2I.js +79 -0
- package/dist/chunk-UJACD6K2.js +987 -0
- package/dist/{chunk-XK5E4HAS.js → chunk-VBHFJH3P.js} +80 -28
- package/dist/chunk-W335CWYJ.js +53 -0
- package/dist/{chunk-X7ECZ3AK.js → chunk-XMBM2XD5.js} +1 -1
- package/dist/{chunk-2K2QBPAD.js → chunk-ZLYBUM7K.js} +6 -4
- package/dist/{client-fUSERMAC.d.ts → client-BTd_CyX3.d.ts} +26 -6
- package/dist/{groups-BK8ts2yK.d.ts → groups-4Jb3uYFO.d.ts} +1 -1
- package/dist/{images-aw6W7vFZ.d.ts → images-D5kpqHxv.d.ts} +1 -1
- package/dist/index.d.ts +9 -8
- package/dist/index.js +8 -6
- package/dist/{capability-error-ty3SqD_b.d.ts → integrations-Cr9EhGI_.d.ts} +1 -149
- package/dist/internal.d.ts +32 -5
- package/dist/internal.js +8 -3
- package/dist/{offers-C2FANzrG.d.ts → offers-BFI5t-e-.d.ts} +2 -2
- package/dist/{pages-Chb6OZSB.d.ts → pages-nIoMT9J3.d.ts} +1 -1
- package/dist/{participant-activity-DkL3nY5a.d.ts → participant-activity-DYdUUhw2.d.ts} +1 -0
- package/dist/portal-proxy.js +1 -1
- package/dist/react/index.d.ts +246 -177
- package/dist/react/index.js +954 -383
- package/dist/{referral-reward-kinds-M3f0PdiR.d.ts → referral-reward-kinds-DnvQXL8L.d.ts} +100 -3
- package/dist/{schema-DEM8y8Fm.d.ts → schema-K-Pg5lPz.d.ts} +1 -1
- package/dist/schema.d.ts +316 -314
- package/dist/schema.js +16 -14
- package/dist/server/index.d.ts +2546 -377
- package/dist/server/index.js +594 -841
- package/dist/{sign-in-options-iWOp9puZ.d.ts → sign-in-options-DBjMzgnu.d.ts} +2 -2
- package/dist/submission-input-CPIsJt-_.d.ts +146 -0
- package/dist/testing.d.ts +641 -0
- package/dist/testing.js +1282 -0
- package/package.json +6 -2
- package/dist/chunk-OCXGG75K.js +0 -171
- package/dist/chunk-ZFABFKIY.js +0 -1295
- package/dist/submission-input-BbBJTVlT.d.ts +0 -290
package/README.md
CHANGED
|
@@ -17,6 +17,7 @@ pnpm add @domino-sdk/relay
|
|
|
17
17
|
| `@domino-sdk/relay/build` | Bundling authored modules; needs `esbuild` installed |
|
|
18
18
|
| `@domino-sdk/relay/portal-proxy` | Server proxies and hosted app Workers |
|
|
19
19
|
| `@domino-sdk/relay/vite` | The Vite plugin that keeps server code out of the browser build |
|
|
20
|
+
| `@domino-sdk/relay/testing` | Unit-testing quests locally (`runQuest`); for test files only |
|
|
20
21
|
|
|
21
22
|
`@domino-sdk/relay/internal` is shared by Relay's own services and Console. It is not a supported API and can change in any release.
|
|
22
23
|
|
package/build.mjs
CHANGED
|
@@ -17,6 +17,20 @@ async function esbuild() {
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
/** The quest testing kit stays in tests: a quest bundle that imports it fails to build. */
|
|
21
|
+
const testsOnly = {
|
|
22
|
+
name: "domino:tests-only",
|
|
23
|
+
setup(build) {
|
|
24
|
+
build.onResolve({ filter: /^@domino-sdk\/relay\/testing$/ }, (args) => ({
|
|
25
|
+
errors: [
|
|
26
|
+
{
|
|
27
|
+
text: `Quest code cannot import @domino-sdk/relay/testing (imported by ${args.importer}). The testing kit runs quests in tests; import it from a test file instead.`,
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
}))
|
|
31
|
+
},
|
|
32
|
+
}
|
|
33
|
+
|
|
20
34
|
/** Bundle an authored quest without evaluating developer code in the build process. */
|
|
21
35
|
export async function buildQuest(entry, options = {}) {
|
|
22
36
|
if (
|
|
@@ -45,6 +59,7 @@ export async function buildQuest(entry, options = {}) {
|
|
|
45
59
|
platform: "neutral",
|
|
46
60
|
target: "es2022",
|
|
47
61
|
minify: true,
|
|
62
|
+
plugins: [testsOnly],
|
|
48
63
|
})
|
|
49
64
|
const file = result.outputFiles[0]
|
|
50
65
|
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/** A Discord message as `ctx.discord.message()` reads it, from the project's Discord server. */
|
|
4
|
+
declare const discordMessageSchema: z.ZodObject<{
|
|
5
|
+
guildId: z.ZodString;
|
|
6
|
+
channelId: z.ZodString;
|
|
7
|
+
messageId: z.ZodString;
|
|
8
|
+
userId: z.ZodString;
|
|
9
|
+
content: z.ZodNullable<z.ZodString>;
|
|
10
|
+
replyTo: z.ZodNullable<z.ZodString>;
|
|
11
|
+
publishedAt: z.ZodNumber;
|
|
12
|
+
}, z.core.$strict>;
|
|
13
|
+
type DiscordMessage = z.infer<typeof discordMessageSchema>;
|
|
14
|
+
/**
|
|
15
|
+
* Messages posted in the project's Discord server, written by the Discord gateway. The record's
|
|
16
|
+
* `author` is the message author's Discord account. Message text is stored only with `text: true`.
|
|
17
|
+
* Edits update stored text. Deleting a message, or turning text off, removes retained text.
|
|
18
|
+
*/
|
|
19
|
+
declare const discordMessagesSourceSchema: z.ZodObject<{
|
|
20
|
+
kind: z.ZodLiteral<"discord-messages">;
|
|
21
|
+
/** Store each message's text in `data.text`. Off unless set. */
|
|
22
|
+
text: z.ZodOptional<z.ZodBoolean>;
|
|
23
|
+
}, z.core.$strict>;
|
|
24
|
+
/**
|
|
25
|
+
* Reactions added in the project's Discord server, written by the Discord gateway. The record's
|
|
26
|
+
* `author` is the reactor's Discord account and its `messageAuthor` account is the message's
|
|
27
|
+
* author, when Discord could name it.
|
|
28
|
+
*/
|
|
29
|
+
declare const discordReactionsSourceSchema: z.ZodObject<{
|
|
30
|
+
kind: z.ZodLiteral<"discord-reactions">;
|
|
31
|
+
}, z.core.$strict>;
|
|
32
|
+
/** The `data` of a `discord.messages()` record. IDs are Discord snowflakes. */
|
|
33
|
+
declare const discordMessageDataSchema: z.ZodObject<{
|
|
34
|
+
guildId: z.ZodString;
|
|
35
|
+
channelId: z.ZodString;
|
|
36
|
+
messageId: z.ZodString;
|
|
37
|
+
replyTo: z.ZodNullable<z.ZodString>;
|
|
38
|
+
publishedAt: z.ZodNumber;
|
|
39
|
+
}, z.core.$strip>;
|
|
40
|
+
type DiscordMessageData = z.infer<typeof discordMessageDataSchema>;
|
|
41
|
+
/**
|
|
42
|
+
* The `data` of a `discord.messages({ text: true })` record. `text` is null when the platform's
|
|
43
|
+
* bot does not receive message content.
|
|
44
|
+
*/
|
|
45
|
+
declare const discordMessageTextDataSchema: z.ZodObject<{
|
|
46
|
+
guildId: z.ZodString;
|
|
47
|
+
channelId: z.ZodString;
|
|
48
|
+
messageId: z.ZodString;
|
|
49
|
+
replyTo: z.ZodNullable<z.ZodString>;
|
|
50
|
+
publishedAt: z.ZodNumber;
|
|
51
|
+
text: z.ZodNullable<z.ZodString>;
|
|
52
|
+
}, z.core.$strip>;
|
|
53
|
+
type DiscordMessageTextData = z.infer<typeof discordMessageTextDataSchema>;
|
|
54
|
+
/** The `data` of a `discord.reactions()` record. IDs are Discord snowflakes. */
|
|
55
|
+
declare const discordReactionDataSchema: z.ZodObject<{
|
|
56
|
+
guildId: z.ZodString;
|
|
57
|
+
channelId: z.ZodString;
|
|
58
|
+
messageId: z.ZodString;
|
|
59
|
+
emoji: z.ZodObject<{
|
|
60
|
+
id: z.ZodNullable<z.ZodString>;
|
|
61
|
+
name: z.ZodString;
|
|
62
|
+
}, z.core.$strip>;
|
|
63
|
+
reactorRoles: z.ZodArray<z.ZodString>;
|
|
64
|
+
messagePublishedAt: z.ZodNumber;
|
|
65
|
+
}, z.core.$strip>;
|
|
66
|
+
type DiscordReactionData = z.infer<typeof discordReactionDataSchema>;
|
|
67
|
+
/** Rewards and resource selectors supported by the Discord integration. */
|
|
68
|
+
declare const discordRewardSchema: z.ZodObject<{
|
|
69
|
+
kind: z.ZodLiteral<"integration">;
|
|
70
|
+
provider: z.ZodLiteral<"discord">;
|
|
71
|
+
action: z.ZodLiteral<"grant-role">;
|
|
72
|
+
roleId: z.ZodString;
|
|
73
|
+
}, z.core.$strict>;
|
|
74
|
+
declare const discordResourceSourceSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
75
|
+
provider: z.ZodLiteral<"discord">;
|
|
76
|
+
resource: z.ZodLiteral<"channel">;
|
|
77
|
+
types: z.ZodArray<z.ZodEnum<{
|
|
78
|
+
text: "text";
|
|
79
|
+
announcement: "announcement";
|
|
80
|
+
}>>;
|
|
81
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
82
|
+
provider: z.ZodLiteral<"discord">;
|
|
83
|
+
resource: z.ZodLiteral<"role">;
|
|
84
|
+
assignable: z.ZodDefault<z.ZodBoolean>;
|
|
85
|
+
}, z.core.$strict>]>;
|
|
86
|
+
|
|
87
|
+
declare const authProviderSchema: z.ZodEnum<{
|
|
88
|
+
discord: "discord";
|
|
89
|
+
google: "google";
|
|
90
|
+
apple: "apple";
|
|
91
|
+
x: "x";
|
|
92
|
+
}>;
|
|
93
|
+
type AuthProvider = z.infer<typeof authProviderSchema>;
|
|
94
|
+
declare const accountConnectionSchema: z.ZodObject<{
|
|
95
|
+
provider: z.ZodEnum<{
|
|
96
|
+
discord: "discord";
|
|
97
|
+
google: "google";
|
|
98
|
+
apple: "apple";
|
|
99
|
+
x: "x";
|
|
100
|
+
}>;
|
|
101
|
+
configured: z.ZodBoolean;
|
|
102
|
+
status: z.ZodEnum<{
|
|
103
|
+
disconnected: "disconnected";
|
|
104
|
+
connected: "connected";
|
|
105
|
+
reconnect: "reconnect";
|
|
106
|
+
}>;
|
|
107
|
+
subject: z.ZodNullable<z.ZodString>;
|
|
108
|
+
revision: z.ZodNumber;
|
|
109
|
+
}, z.core.$strip>;
|
|
110
|
+
type AccountConnection = z.infer<typeof accountConnectionSchema>;
|
|
111
|
+
declare const discordMemberInputSchema: z.ZodObject<{}, z.core.$strict>;
|
|
112
|
+
declare const discordMessageInputSchema: z.ZodObject<{
|
|
113
|
+
channelId: z.ZodString;
|
|
114
|
+
messageId: z.ZodString;
|
|
115
|
+
}, z.core.$strict>;
|
|
116
|
+
declare const discordMemberSchema: z.ZodObject<{
|
|
117
|
+
userId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
118
|
+
nickname: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
119
|
+
displayName: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
120
|
+
boostingSince: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
121
|
+
roles: z.ZodArray<z.ZodString>;
|
|
122
|
+
joinedAt: z.ZodNullable<z.ZodString>;
|
|
123
|
+
pending: z.ZodBoolean;
|
|
124
|
+
}, z.core.$strip>;
|
|
125
|
+
type DiscordMember = z.infer<typeof discordMemberSchema>;
|
|
126
|
+
/**
|
|
127
|
+
* Reads the project's connected Discord server for the member's linked Discord account. The
|
|
128
|
+
* account and the integration are pinned at the attempt's first Discord read: later links and
|
|
129
|
+
* unlinks do not change the attempt. Provider failures, and an integration that is not ready,
|
|
130
|
+
* throw `CapabilityError` with code `"provider-unavailable"`.
|
|
131
|
+
*/
|
|
132
|
+
interface DiscordReader {
|
|
133
|
+
/** The member's server membership; null when they are not in the server or have not linked Discord. */
|
|
134
|
+
member(): Promise<DiscordMember | null>;
|
|
135
|
+
/**
|
|
136
|
+
* A message in the connected server; null when it does not exist. The bot reads it, so the
|
|
137
|
+
* member needs no linked Discord account. A channel outside the connected server, or one the
|
|
138
|
+
* bot cannot see, throws
|
|
139
|
+
* `CapabilityError` with code `"author-error"`.
|
|
140
|
+
*/
|
|
141
|
+
message(input: {
|
|
142
|
+
channelId: string;
|
|
143
|
+
messageId: string;
|
|
144
|
+
}): Promise<DiscordMessage | null>;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export { type AccountConnection as A, type DiscordMessageData as D, type AuthProvider as a, type DiscordMessageTextData as b, discordReactionsSourceSchema as c, discordMessagesSourceSchema as d, type DiscordReactionData as e, type DiscordReader as f, type DiscordMember as g, type DiscordMessage as h, accountConnectionSchema as i, authProviderSchema as j, discordMemberInputSchema as k, discordMemberSchema as l, discordMessageDataSchema as m, discordMessageInputSchema as n, discordMessageSchema as o, discordMessageTextDataSchema as p, discordReactionDataSchema as q, discordResourceSourceSchema as r, discordRewardSchema as s };
|