@vercel/board 0.16.0 → 0.17.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 +27 -27
- package/dist/{a2-C41hD8SF.mjs → a2-Bck5x1Kh.mjs} +969 -25
- package/dist/access.d.mts +1 -1
- package/dist/access.mjs +3 -3
- package/dist/{actors-DjMeZpnU.mjs → actors-BOamkEuz.mjs} +3 -73
- package/dist/attempts-CLG840Oj.mjs +20 -0
- package/dist/{auth-COzc09sn.mjs → auth-Drg9FiC2.mjs} +225 -2
- package/dist/backend-B-SJ7p6p.d.mts +680 -0
- package/dist/backend-a2/contract.d.mts +873 -2
- package/dist/backend-a2/contract.mjs +2 -2
- package/dist/backend-a2/scheduler-local.d.mts +1 -1
- package/dist/backend-a2/scheduler-local.mjs +1 -1
- package/dist/backend-a2/scheduler-qstash.d.mts +78 -1
- package/dist/backend-a2/scheduler-qstash.mjs +521 -1
- package/dist/backend-a2/scheduler-vercel.d.mts +37 -1
- package/dist/backend-a2/scheduler-vercel.mjs +203 -1
- package/dist/backend-a2/store-memory.d.mts +2 -2
- package/dist/backend-a2/store-memory.mjs +3 -3
- package/dist/backend-a2/store-postgres.d.mts +1 -1
- package/dist/backend-a2/store-postgres.mjs +2850 -2
- package/dist/backend-a2/store-redis-http.d.mts +1 -1
- package/dist/backend-a2/store-redis-http.mjs +490 -2
- package/dist/backend-a2/store-redis.d.mts +10 -2
- package/dist/backend-a2/store-redis.mjs +51 -2
- package/dist/backend-a2/store-sqlite.d.mts +1 -1
- package/dist/backend-a2/store-sqlite.mjs +3 -3
- package/dist/backend-a2.d.mts +2706 -3
- package/dist/backend-a2.mjs +1 -1
- package/dist/{backend-http-Bid7RIpC.d.mts → backend-http-7cNb8nJI.d.mts} +10 -3
- package/dist/{backend-http-0roEmjl0.mjs → backend-http-C5I7Wfdw.mjs} +2 -2
- package/dist/{backend-http-BVRno-ca.mjs → backend-http-CuUIACCs.mjs} +32 -3
- package/dist/backend-http.d.mts +1 -1
- package/dist/backend-http.mjs +1 -1
- package/dist/backend-http.node.d.mts +1 -1
- package/dist/backend-http.node.mjs +1 -1
- package/dist/{chat-provider-XCnQlxq6.d.mts → chat-provider-DNJQyajS.d.mts} +16 -4
- package/dist/{chat-provider-jFSeyNmB.mjs → chat-provider-YHy-WbrB.mjs} +15 -9
- package/dist/cli.mjs +30 -10
- package/dist/{client-DGDPaN7U.mjs → client-BA-J7usH.mjs} +10 -2
- package/dist/{conformance-DRR23YNy.mjs → conformance-CT5EeHeC.mjs} +5 -2
- package/dist/conformance.d.mts +1 -1
- package/dist/conformance.mjs +1 -1
- package/dist/{engine-Bir5s8ts.mjs → engine-D0oBUBEK.mjs} +249 -163
- package/dist/events-CewD4kw7.mjs +75 -0
- package/dist/{exports-Dvc1o52I.mjs → exports-DOdA7KhF.mjs} +35 -32
- package/dist/exports-ZsgjzEnM.d.mts +4 -0
- package/dist/external-BV_cUncs.mjs +151 -0
- package/dist/folds-CRYY14kc.d.mts +534 -0
- package/dist/{reducers-mUPFuFJV.mjs → folds-Dyjput8M.mjs} +6 -73
- package/dist/ids-C6AYo1bu.mjs +31 -0
- package/dist/index.d.mts +4 -4
- package/dist/{index.default-Bkg77Pxn.mjs → index.default-n4qKN7EL.mjs} +1 -1
- package/dist/index.mjs +5 -5
- package/dist/index.node.d.mts +4 -4
- package/dist/index.node.mjs +3 -3
- package/dist/inspect/app.js +31 -31
- package/dist/inspect/engine.js +5 -5
- package/dist/internal-CvsrprnU-CRY89I-b.mjs +203 -0
- package/dist/{local-Cr_dSjvs.mjs → local-DhkrAqPP.mjs} +1 -1
- package/dist/mentions-CB6ShY4R.mjs +72 -0
- package/dist/{targets-yM5JBUgr.mjs → middleware-CqaCwucP.mjs} +1 -33
- package/dist/platform-B4TnJtWu-CwcTyKg2.mjs +32 -0
- package/dist/{project-CFiArraX.mjs → project-DMDST9kl.mjs} +1 -1
- package/dist/{provider-BGjz-mDa.d.mts → provider-B0b9Qxw4.d.mts} +170 -40
- package/dist/provider-B3DpYSDq.mjs +220 -0
- package/dist/redis-tables-DN9PfIDi.mjs +3897 -0
- package/dist/reducer-CYPHsSmd-BQIfozGi.d.mts +170 -0
- package/dist/reducer-CjmvZSAb-D_OSISmj.mjs +74 -0
- package/dist/{contract-CuJmlrhw.mjs → reducers-BFmIXilu.mjs} +260 -287
- package/dist/retryable-lazy-DZWmHpii-Bye-W8q7.mjs +19 -0
- package/dist/scheduler-task-X1SToDjP-BVoWuInI.mjs +69 -0
- package/dist/{serve-BsOOc-6_.mjs → serve-CNYvA4pT.mjs} +5 -5
- package/dist/server-DtFrWxi3-Boa6gdWO.mjs +3602 -0
- package/dist/server-qgez0Xny-D5mLfqFQ.d.mts +385 -0
- package/dist/{server-jwPY7_wi.mjs → server-snYFkITb.mjs} +4 -4
- package/dist/{serving-BNbzc96L.mjs → serving-CNkgUPW1.mjs} +1 -1
- package/dist/session-clear-wHd5GCpZ-BnKSxReK.mjs +51 -0
- package/dist/{sql-DbiEnqM0.mjs → sql-U9WTxrwJ.mjs} +2 -2
- package/dist/{sqlite-db-Cbj03vmp.mjs → sqlite-db-Ds4majtT.mjs} +1 -1
- package/dist/store-D0MhBvg6-4Z2L0Kqd.d.mts +530 -0
- package/dist/store-N8PXxDAS-BWBgzBHp.mjs +5 -0
- package/dist/store-codec-DwrWlgQx-CYxGW0aD.mjs +61 -0
- package/dist/store-memory-Bas9Uq5C.mjs +872 -0
- package/dist/store-memory-ZLiZbH3R.mjs +2 -0
- package/dist/store-polling-BZt2Rf3D-BiEM6_HB.mjs +148 -0
- package/dist/store-presence-polling-JuAy2Ck2-CYpuK75X.mjs +109 -0
- package/dist/store-sqlite-BmwL3pUR.mjs +2 -0
- package/dist/store-sqlite-CxxPCcCT.mjs +1053 -0
- package/dist/stream-buffer-DrTyiIuo-BKy-vI14.mjs +53 -0
- package/dist/sync-github.d.mts +24 -17
- package/dist/sync-github.mjs +89 -22
- package/dist/sync-kapso.d.mts +15 -13
- package/dist/sync-kapso.mjs +17 -14
- package/dist/sync-slack.d.mts +12 -17
- package/dist/sync-slack.mjs +54 -42
- package/dist/sync.chat.d.mts +1 -1
- package/dist/sync.chat.mjs +1 -1
- package/dist/sync.d.mts +3 -3
- package/dist/sync.mjs +5 -4
- package/dist/targets-C-wdR5wP.mjs +33 -0
- package/dist/{tokens-DKLn5P9B.mjs → tokens-DhuzKzAl.mjs} +1 -1
- package/dist/{types-BHCjTZdB.d.mts → types-8yq2VnKI.d.mts} +2 -2
- package/dist/{users-Dls7_ANV.mjs → users-yryHKFMo.mjs} +2 -2
- package/dist/{watch-spec-W0c7ypHJ.mjs → watchers-hash-DojIuoFg.mjs} +233 -28
- package/docs/01-board/01-mounting.md +1 -1
- package/docs/02-sync/01-overview.md +69 -47
- package/docs/02-sync/02-functions.md +395 -0
- package/docs/02-sync/03-slack.md +30 -25
- package/docs/02-sync/04-github.md +62 -26
- package/docs/02-sync/05-whatsapp.md +23 -19
- package/docs/02-sync/06-providers.md +58 -26
- package/docs/03-guides/04-triage.md +1 -1
- package/docs/04-reference/01-cli.md +26 -6
- package/docs/04-reference/02-board.md +18 -5
- package/docs/04-reference/03-http.md +5 -2
- package/docs/04-reference/05-conformance.md +1 -1
- package/docs/index.md +5 -10
- package/package.json +22 -6
- package/dist/a2-D24cvwpN.d.mts +0 -3359
- package/dist/access-CJU2-vaa.mjs +0 -226
- package/dist/attempts-Bxp9KgPf.mjs +0 -919
- package/dist/exports-DLiE7fLY.d.mts +0 -4
- package/dist/provider-CuewcDNZ.mjs +0 -205
- package/dist/redis-tables-B35vv4CZ.mjs +0 -842
- package/dist/reducers-B_vUGQRp.d.mts +0 -1172
- package/dist/watchers-hash-CLjsa6od.mjs +0 -225
- package/docs/02-sync/02-callbacks.md +0 -265
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
import { d as LabelKey, p as Labels } from "./schemas-Be08nyfW.mjs";
|
|
2
|
-
import { i as ExternalLocation, r as ExternalEvent } from "./contract-CuJmlrhw.mjs";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
//#region src/sync/events.ts
|
|
5
|
-
const EventBase = z.object({
|
|
6
|
-
id: z.string().min(1),
|
|
7
|
-
platform: z.string().min(1),
|
|
8
|
-
key: z.string().min(1),
|
|
9
|
-
...ExternalLocation.shape,
|
|
10
|
-
raw: z.unknown()
|
|
11
|
-
});
|
|
12
|
-
const eventTypes = {
|
|
13
|
-
message: "message",
|
|
14
|
-
edited: "message.edited",
|
|
15
|
-
deleted: "message.deleted",
|
|
16
|
-
reaction: "reaction.added",
|
|
17
|
-
lifecycle: "lifecycle"
|
|
18
|
-
};
|
|
19
|
-
function envelope(platform, key, event, raw, id) {
|
|
20
|
-
return {
|
|
21
|
-
...event,
|
|
22
|
-
...EventBase.parse({
|
|
23
|
-
id,
|
|
24
|
-
platform,
|
|
25
|
-
key,
|
|
26
|
-
channel: event.channel,
|
|
27
|
-
thread: event.thread,
|
|
28
|
-
subthread: "subthread" in event ? event.subthread : null,
|
|
29
|
-
raw
|
|
30
|
-
}),
|
|
31
|
-
type: event.kind === "lifecycle" ? event.type : event.kind === "reaction" && !event.added ? "reaction.removed" : eventTypes[event.kind]
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
function eventSchema(platform, messageType) {
|
|
35
|
-
const [message, edited, deleted, reaction, lifecycle] = ExternalEvent.options;
|
|
36
|
-
const common = {
|
|
37
|
-
...EventBase.shape,
|
|
38
|
-
platform: z.literal(platform)
|
|
39
|
-
};
|
|
40
|
-
return z.discriminatedUnion("kind", [
|
|
41
|
-
message.extend({
|
|
42
|
-
...common,
|
|
43
|
-
type: z.literal(messageType)
|
|
44
|
-
}),
|
|
45
|
-
edited.extend({
|
|
46
|
-
...common,
|
|
47
|
-
type: z.literal("message.edited")
|
|
48
|
-
}),
|
|
49
|
-
deleted.extend({
|
|
50
|
-
...common,
|
|
51
|
-
type: z.literal("message.deleted")
|
|
52
|
-
}),
|
|
53
|
-
reaction.extend({
|
|
54
|
-
...common,
|
|
55
|
-
type: z.enum(["reaction.added", "reaction.removed"])
|
|
56
|
-
}),
|
|
57
|
-
lifecycle.extend(common)
|
|
58
|
-
]);
|
|
59
|
-
}
|
|
60
|
-
const SyncOverrides = z.object({
|
|
61
|
-
root: z.custom((value) => typeof value === "function").optional(),
|
|
62
|
-
text: z.string().optional(),
|
|
63
|
-
labels: Labels.optional(),
|
|
64
|
-
unset: z.array(LabelKey).optional(),
|
|
65
|
-
noSync: z.boolean().optional()
|
|
66
|
-
}).strict();
|
|
67
|
-
function immutable(value) {
|
|
68
|
-
if (value && typeof value === "object") {
|
|
69
|
-
for (const item of Object.values(value)) immutable(item);
|
|
70
|
-
Object.freeze(value);
|
|
71
|
-
}
|
|
72
|
-
return value;
|
|
73
|
-
}
|
|
74
|
-
//#endregion
|
|
75
|
-
//#region src/sync/provider.ts
|
|
76
|
-
const ResolvedTarget = z.object({
|
|
77
|
-
target: z.string().min(1),
|
|
78
|
-
channel: z.string().min(1),
|
|
79
|
-
kind: z.enum(["channel", "thread"])
|
|
80
|
-
}).strict();
|
|
81
|
-
/** Why a platform wouldn't read a channel or thread on demand. Its message is shown as is. */
|
|
82
|
-
var UnreadableError = class extends Error {
|
|
83
|
-
code;
|
|
84
|
-
constructor(code, message) {
|
|
85
|
-
super(message);
|
|
86
|
-
this.code = code;
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
const ReceivedEvent = z.object({
|
|
90
|
-
event: ExternalEvent,
|
|
91
|
-
raw: z.unknown(),
|
|
92
|
-
dedupe: z.string().min(1)
|
|
93
|
-
});
|
|
94
|
-
var SyncProvider = class {
|
|
95
|
-
platform;
|
|
96
|
-
canStartThreads;
|
|
97
|
-
singleReaction;
|
|
98
|
-
uploadsFiles;
|
|
99
|
-
mappings = {};
|
|
100
|
-
/** People's tokens, when the adapter has them: messages they write post as them. */
|
|
101
|
-
users;
|
|
102
|
-
options;
|
|
103
|
-
constructor(options) {
|
|
104
|
-
this.options = options;
|
|
105
|
-
this.users = options.users ?? null;
|
|
106
|
-
this.platform = options.platform;
|
|
107
|
-
this.canStartThreads = options.canStartThreads ?? false;
|
|
108
|
-
this.singleReaction = options.singleReaction ?? false;
|
|
109
|
-
this.uploadsFiles = options.uploadsFiles ?? false;
|
|
110
|
-
}
|
|
111
|
-
/** The platform account a person's token belongs to. */
|
|
112
|
-
async whoAmI(_token) {
|
|
113
|
-
throw new Error(`${this.platform} can't post as a person`);
|
|
114
|
-
}
|
|
115
|
-
/** `post`, as the person whose token this is. */
|
|
116
|
-
async postAs(_token, _target, _kind, _body) {
|
|
117
|
-
throw new Error(`${this.platform} can't post as a person`);
|
|
118
|
-
}
|
|
119
|
-
async editAs(_token, _thread, _message, _body) {}
|
|
120
|
-
async deleteAs(_token, _thread, _message) {}
|
|
121
|
-
async findByEmail(_email) {
|
|
122
|
-
return null;
|
|
123
|
-
}
|
|
124
|
-
mention(_actor) {
|
|
125
|
-
return null;
|
|
126
|
-
}
|
|
127
|
-
async fetchRoot(_thread) {
|
|
128
|
-
return null;
|
|
129
|
-
}
|
|
130
|
-
async fetchFile(_file) {
|
|
131
|
-
return null;
|
|
132
|
-
}
|
|
133
|
-
/** The platform's own link to an event's message, or null when it has none. */
|
|
134
|
-
async permalink(_event) {
|
|
135
|
-
return null;
|
|
136
|
-
}
|
|
137
|
-
/** A linked message the platform didn't describe, read from the platform. */
|
|
138
|
-
async fetchLink(_link) {
|
|
139
|
-
return {
|
|
140
|
-
snapshot: null,
|
|
141
|
-
unavailable: `${this.platform} can't read it`
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* A channel or thread, read on demand for whoever asked: nothing is synced,
|
|
146
|
-
* stored, or joined. Throws `UnreadableError` for what it won't read.
|
|
147
|
-
*/
|
|
148
|
-
async read(_target, _options) {
|
|
149
|
-
throw new UnreadableError("unsupported", `${this.platform} can't be read on demand`);
|
|
150
|
-
}
|
|
151
|
-
async edit(_thread, _message, _body) {}
|
|
152
|
-
async delete(_thread, _message) {}
|
|
153
|
-
async react(_thread, _message, _emoji, _added) {}
|
|
154
|
-
async startTyping(_thread, _latest, _status) {}
|
|
155
|
-
/**
|
|
156
|
-
* The channel whose inbox a thread's events land in (`slack:C0123ABC` for `slack:C0123ABC:1727.1234`),
|
|
157
|
-
* worked out without calling the platform. Null when the provider can't tell: a key's inbox then
|
|
158
|
-
* lists only the mapped channels'.
|
|
159
|
-
*/
|
|
160
|
-
inboxChannel(_key, _thread) {
|
|
161
|
-
return null;
|
|
162
|
-
}
|
|
163
|
-
async deleteFiles(_ids) {}
|
|
164
|
-
refusesFiles(_error) {
|
|
165
|
-
return false;
|
|
166
|
-
}
|
|
167
|
-
async uploadFiles(_thread, _files) {
|
|
168
|
-
throw new Error(`${this.platform} does not support file uploads`);
|
|
169
|
-
}
|
|
170
|
-
sync(context, channel, overrides) {
|
|
171
|
-
return context.apply(channel, overrides);
|
|
172
|
-
}
|
|
173
|
-
render(input) {
|
|
174
|
-
return this.options.render?.(input) ?? `**${input.label}**: ${input.message.text}`;
|
|
175
|
-
}
|
|
176
|
-
map(key, value) {
|
|
177
|
-
if (typeof value === "string") {
|
|
178
|
-
this.mappings[key] = { channel: value };
|
|
179
|
-
return;
|
|
180
|
-
}
|
|
181
|
-
const handler = typeof value === "function" ? value : value.run;
|
|
182
|
-
this.mappings[key] = {
|
|
183
|
-
...typeof value === "object" ? { channel: value.channel } : {},
|
|
184
|
-
run: (context) => {
|
|
185
|
-
const event = immutable(this.event(context));
|
|
186
|
-
let link;
|
|
187
|
-
const permalink = () => {
|
|
188
|
-
const promise = link ?? this.permalink(event);
|
|
189
|
-
link = promise;
|
|
190
|
-
promise.catch(() => {
|
|
191
|
-
if (link === promise) link = void 0;
|
|
192
|
-
});
|
|
193
|
-
return promise;
|
|
194
|
-
};
|
|
195
|
-
return handler({
|
|
196
|
-
event,
|
|
197
|
-
board: context.client(event),
|
|
198
|
-
permalink
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
};
|
|
204
|
-
//#endregion
|
|
205
|
-
export { EventBase as a, eventSchema as c, UnreadableError as i, immutable as l, ResolvedTarget as n, SyncOverrides as o, SyncProvider as r, envelope as s, ReceivedEvent as t };
|