@vercel/board 0.31.0 → 0.33.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 +25 -20
- package/dist/{access-CY5xVMIK.mjs → access-N3XmkKXg.mjs} +3 -3
- package/dist/access.d.mts +4 -5
- package/dist/access.mjs +5 -5
- package/dist/{actors-Bm-ojWWT.mjs → actors-ihyN47OV.mjs} +3 -3
- package/dist/{auth-DLYSt_-A.d.mts → auth-D6z3rMNj.d.mts} +11 -93
- package/dist/{auth-CyO2aw5n.mjs → auth-r-_PeZyw.mjs} +39 -151
- package/dist/{backend-Bob-5CM7.d.mts → backend-CWpyR1A7.d.mts} +81 -51
- package/dist/backend-local.d.mts +28 -0
- package/dist/backend-local.mjs +2 -0
- package/dist/{chat-provider-DkFp2hrh.mjs → chat-provider-9hCT654s.mjs} +2 -2
- package/dist/{chat-provider-BChYrrA7.d.mts → chat-provider-DJpFUaFv.d.mts} +2 -3
- package/dist/cli-commands.d.mts +1 -1
- package/dist/cli-commands.mjs +1 -1
- package/dist/cli-embedded.d.mts +2 -2
- package/dist/cli-embedded.mjs +2 -2
- package/dist/cli.mjs +6 -6
- package/dist/{commands-DK4W3HCJ.d.mts → commands-BOBQHVqM.d.mts} +14 -0
- package/dist/{commands-L1JSGz2Z.mjs → commands-CHoMl06v.mjs} +39 -12
- package/dist/{conformance-DK43HiHf.mjs → conformance-qKmGLTAT.mjs} +40 -5
- package/dist/conformance.d.mts +1 -1
- package/dist/conformance.mjs +1 -1
- package/dist/{engine-DurYIRt8.mjs → engine-JxgZiikU.mjs} +6 -8
- package/dist/{errors-CJXhhzvT.mjs → errors-Pk0XV1hK.mjs} +56 -2
- package/dist/{events-lujPA3gQ.mjs → events-IQg0k281.mjs} +2 -2
- package/dist/exports-BuKjVq2t.d.mts +4 -0
- package/dist/exports-gHDHlg0i.mjs +3207 -0
- package/dist/{external-D3p5T57R.mjs → external-CYe424fO.mjs} +1 -1
- package/dist/{folds-DLUzfibJ.d.mts → folds-DjFTiqIM.d.mts} +38 -44
- package/dist/index-CXvvYNYj.d.mts +11 -0
- package/dist/index.d.mts +9 -8
- package/dist/index.mjs +21 -8
- package/dist/index.node.d.mts +5 -6
- package/dist/index.node.mjs +3 -3
- package/dist/inspect/app.js +95 -95
- package/dist/{internal-CvsrprnU-zZMpDiRY.mjs → internal-CvsrprnU-CEPOUpAv.mjs} +63 -43
- package/dist/local-BbLjA5vI.mjs +8818 -0
- package/dist/{main-Dz-8komG.mjs → main-CQpCZJFw.mjs} +140 -36
- package/dist/{backend-a2/store-memory.mjs → memory-7RRnLa4X.mjs} +3 -3
- package/dist/middleware-BU7rVi9F.mjs +103 -0
- package/dist/{client-COfYrgfV.d.mts → provider-BlzUvcM9.d.mts} +665 -5
- package/dist/{schemas-DBmUO6pr.mjs → schemas-BG205xds.mjs} +2 -5
- package/dist/{serve-CTmow-YH.mjs → serve-D8_W4UN6.mjs} +33 -24
- package/dist/{node-BgeGcwX0.mjs → server-BiIUXWbU.mjs} +419 -6
- package/dist/{serving-DBFRo6U_.mjs → serving-D7rcUtSC.mjs} +1 -1
- package/dist/{sql-CT5xVuGr.mjs → sql-BQzKUqQt.mjs} +349 -114
- package/dist/sqlite-DCtZFEVm.mjs +30 -0
- package/dist/{sqlite-db-0WeSOEZN.mjs → sqlite-db-qLTs52Ny.mjs} +2 -3
- package/dist/{store-codec-pAG2oPgQ-SqDXlPBR.mjs → store-N8PXxDAS-BdL4Sq-f.mjs} +6 -2
- package/dist/{store-memory-B0PkVSuQ.mjs → store-memory-CKQVEzXN.mjs} +2 -4
- package/dist/store-memory-OdGsc-t_.mjs +2 -0
- package/dist/{store-polling-BZt2Rf3D-Div-bJ_D.mjs → store-polling-BZt2Rf3D-oh3aU_An.mjs} +1 -1
- package/dist/store-sqlite-CTxAVCcz.mjs +2 -0
- package/dist/{store-sqlite-D85t3tE7.mjs → store-sqlite-D6fIszST.mjs} +3 -4
- package/dist/sync-chat-sdk.d.mts +2 -2
- package/dist/sync-chat-sdk.mjs +2 -2
- package/dist/sync-github.d.mts +2 -2
- package/dist/sync-github.mjs +2 -2
- package/dist/sync-linear.d.mts +2 -3
- package/dist/sync-linear.mjs +2 -2
- package/dist/sync-slack.d.mts +3 -3
- package/dist/sync-slack.mjs +4 -4
- package/dist/sync.d.mts +2 -2
- package/dist/sync.mjs +2 -2
- package/dist/{watchers-hash-BjwlnGD9.mjs → targets-CknPGGVi.mjs} +40 -10
- package/dist/{tokens-Dnyd_y1n.mjs → tokens-DPKjl3jf.mjs} +15 -43
- package/docs/01-board/01-mounting.md +243 -288
- package/docs/01-board/03-identity.md +41 -50
- package/docs/01-board/04-messages.md +19 -16
- package/docs/01-board/05-reading.md +3 -3
- package/docs/01-board/06-watchers.md +58 -105
- package/docs/01-board/07-schedules.md +21 -41
- package/docs/01-board/08-middleware.md +11 -17
- package/docs/01-board/09-access.md +76 -313
- package/docs/01-board/10-local.md +81 -0
- package/docs/01-quickstart.md +49 -126
- package/docs/02-sync/01-overview.md +25 -80
- package/docs/02-sync/02-functions.md +10 -16
- package/docs/02-sync/03-slack.md +13 -26
- package/docs/02-sync/04-github.md +8 -20
- package/docs/02-sync/07-linear.md +6 -10
- package/docs/03-guides/02-inspector.md +3 -3
- package/docs/03-guides/03-ci.md +88 -128
- package/docs/03-guides/04-triage.md +7 -15
- package/docs/03-guides/05-agent-factory.md +30 -36
- package/docs/04-reference/01-cli.md +118 -32
- package/docs/04-reference/02-board.md +60 -74
- package/docs/04-reference/03-http.md +119 -57
- package/docs/04-reference/05-conformance.md +31 -45
- package/docs/index.md +41 -65
- package/package.json +12 -83
- package/dist/a2-DngWY2Eb.mjs +0 -4238
- package/dist/access-DPcrKIH_.d.mts +0 -37
- package/dist/backend-a2/blob-vercel.d.mts +0 -8
- package/dist/backend-a2/blob-vercel.mjs +0 -81
- package/dist/backend-a2/contract.d.mts +0 -828
- package/dist/backend-a2/contract.mjs +0 -5
- package/dist/backend-a2/scheduler-local.d.mts +0 -11
- package/dist/backend-a2/scheduler-local.mjs +0 -2
- package/dist/backend-a2/scheduler-qstash.d.mts +0 -79
- package/dist/backend-a2/scheduler-qstash.mjs +0 -522
- package/dist/backend-a2/scheduler-vercel.d.mts +0 -38
- package/dist/backend-a2/scheduler-vercel.mjs +0 -204
- package/dist/backend-a2/store-memory.d.mts +0 -11
- package/dist/backend-a2/store-postgres.d.mts +0 -38
- package/dist/backend-a2/store-postgres.mjs +0 -2977
- package/dist/backend-a2/store-redis-http.d.mts +0 -17
- package/dist/backend-a2/store-redis-http.mjs +0 -520
- package/dist/backend-a2/store-redis.d.mts +0 -31
- package/dist/backend-a2/store-redis.mjs +0 -88
- package/dist/backend-a2/store-sqlite.d.mts +0 -12
- package/dist/backend-a2/store-sqlite.mjs +0 -31
- package/dist/backend-a2.d.mts +0 -2633
- package/dist/backend-a2.mjs +0 -3
- package/dist/backend-http-BRrRbjRx.d.mts +0 -672
- package/dist/backend-http-CvUKOn-m.mjs +0 -585
- package/dist/backend-http-D8mUzuKQ.mjs +0 -18
- package/dist/backend-http.d.mts +0 -10
- package/dist/backend-http.mjs +0 -2
- package/dist/backend-http.node.d.mts +0 -10
- package/dist/backend-http.node.mjs +0 -2
- package/dist/backend-vercel-Ba8JDtqW.mjs +0 -86
- package/dist/backend-vercel-BaSEUdwg.d.mts +0 -674
- package/dist/backend-vercel-CmY9yZ9m.mjs +0 -1656
- package/dist/backend-vercel.d.mts +0 -9
- package/dist/backend-vercel.mjs +0 -11
- package/dist/backend-vercel.node.d.mts +0 -17
- package/dist/backend-vercel.node.mjs +0 -2
- package/dist/blob-Bx8QPWEd.d.mts +0 -40
- package/dist/blob-WbB2DJKn.mjs +0 -201
- package/dist/errors-2vGs49Db.d.mts +0 -16
- package/dist/exports-CWIdN0Ub.mjs +0 -1389
- package/dist/exports-FBOQWT7O.d.mts +0 -5
- package/dist/files-SniSmeEr.mjs +0 -47
- package/dist/folds-Cu9Q9zyQ.mjs +0 -207
- package/dist/index-Ho-ayyQL.d.mts +0 -11
- package/dist/index.default-BUcwDaAe.mjs +0 -12
- package/dist/local-C76Fy5ad.mjs +0 -44
- package/dist/middleware-BavYSDUa.mjs +0 -62
- package/dist/platform-B4TnJtWu-Do3agKr5.mjs +0 -32
- package/dist/project-CQ4VUibA.mjs +0 -124
- package/dist/provider-gynDUoyW.d.mts +0 -665
- package/dist/redis-tables-DHf85ixI.mjs +0 -3895
- package/dist/reducer-Bswr11ar-P324o9vn.mjs +0 -74
- package/dist/reducer-CYPHsSmd-BXjGiptm.d.mts +0 -170
- package/dist/reducers-DcENwtwZ.mjs +0 -538
- package/dist/retryable-lazy-DZWmHpii-DpTc5PIP.mjs +0 -19
- package/dist/scheduler-task-X1SToDjP-D2Il2rln.mjs +0 -69
- package/dist/server-B9gu0qi1-DI1WvcVK.d.mts +0 -391
- package/dist/server-DG8D6VV0.mjs +0 -17
- package/dist/server-DX7mM6nm-D7N_7bug.mjs +0 -3611
- package/dist/session-clear-XJYpmUpg-2q8l_FJR.mjs +0 -63
- package/dist/store-DEzcHZOA-B-5vhxef.d.mts +0 -540
- package/dist/store-N8PXxDAS-DWWgv-Vz.mjs +0 -5
- package/dist/store-memory-4IBl0Ztu.mjs +0 -2
- package/dist/store-presence-polling-JuAy2Ck2-Dh-g_KYM.mjs +0 -109
- package/dist/store-sqlite-iBTYYKBj.mjs +0 -2
- package/dist/stream-buffer-DrTyiIuo-Be10yOBR.mjs +0 -53
- package/dist/targets-Cgjs29T0.mjs +0 -33
- package/dist/types-CmrFjpml.d.mts +0 -102
- package/dist/wait-until-Dw4XrIDQ.mjs +0 -42
- package/docs/01-board/02-database.md +0 -258
- package/docs/04-reference/04-log.md +0 -247
- package/sql/postgres/board.sql +0 -145
- package/sql/postgres/notifications.sql +0 -24
- package/sql/postgres/schema.sql +0 -451
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as ExternalCopy, g as BoardEvent, o as Message, p as Link, r as Channel, t as Actor, u as ExternalEvent, x as Attachment } from "./folds-DLUzfibJ.mjs";
|
|
1
|
+
import { a as ExternalAuthor, c as ExternalLink, d as Attachment, g as Can, h as AccessSummary, i as Message, l as Link, n as Channel, o as ExternalEvent, r as ExternalCopy, s as ExternalFile, t as Actor, u as BoardEvent } from "./folds-DjFTiqIM.mjs";
|
|
3
2
|
import { z } from "zod";
|
|
4
3
|
//#region src/api/routes.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* A message's, schedule's, or cursor's ID: a string clients pass back as they got it, and never
|
|
7
|
-
* parse, compare, or count with. Each backend picks its own; a board on `
|
|
6
|
+
* parse, compare, or count with. Each backend picks its own; a board on `local()` writes decimals,
|
|
8
7
|
* and `s12` for a schedule.
|
|
9
8
|
*/
|
|
10
9
|
declare const Ref: z.ZodString;
|
|
@@ -827,7 +826,7 @@ type InboxItem = {
|
|
|
827
826
|
};
|
|
828
827
|
/**
|
|
829
828
|
* A channel, and what its board counts in it: its threads, its messages, and its last message's
|
|
830
|
-
* position. `
|
|
829
|
+
* position. `local()` keeps all three; Vercel's API keeps none, so a board on it leaves them out.
|
|
831
830
|
*/
|
|
832
831
|
type ChannelView = {
|
|
833
832
|
path: string;
|
|
@@ -2022,4 +2021,665 @@ declare function createBoardClient(options: ClientOptions): {
|
|
|
2022
2021
|
}, opts?: WaitOptions): Promise<BoardEventView | null>;
|
|
2023
2022
|
};
|
|
2024
2023
|
//#endregion
|
|
2025
|
-
|
|
2024
|
+
//#region src/sync/events.d.ts
|
|
2025
|
+
declare const EventBase: z.ZodObject<{
|
|
2026
|
+
channel: z.ZodString;
|
|
2027
|
+
thread: z.ZodString;
|
|
2028
|
+
subthread: z.ZodNullable<z.ZodString>;
|
|
2029
|
+
id: z.ZodString;
|
|
2030
|
+
platform: z.ZodString;
|
|
2031
|
+
key: z.ZodString;
|
|
2032
|
+
raw: z.ZodUnknown;
|
|
2033
|
+
}, z.core.$strip>;
|
|
2034
|
+
type EventBase<P extends string = string> = Omit<z.infer<typeof EventBase>, 'platform'> & {
|
|
2035
|
+
platform: P;
|
|
2036
|
+
};
|
|
2037
|
+
type ProviderEvent = EventBase & ExternalEvent & {
|
|
2038
|
+
type: string;
|
|
2039
|
+
};
|
|
2040
|
+
declare function envelope(platform: string, key: string, event: ExternalEvent, raw: unknown, id: string): {
|
|
2041
|
+
channel: string;
|
|
2042
|
+
thread: string;
|
|
2043
|
+
subthread: string | null;
|
|
2044
|
+
kind: "message";
|
|
2045
|
+
message: string;
|
|
2046
|
+
isRoot: boolean;
|
|
2047
|
+
text: string;
|
|
2048
|
+
context: string | null;
|
|
2049
|
+
author: {
|
|
2050
|
+
id: string;
|
|
2051
|
+
handle: string;
|
|
2052
|
+
name: string;
|
|
2053
|
+
avatar: string | null;
|
|
2054
|
+
isBot: boolean;
|
|
2055
|
+
};
|
|
2056
|
+
files?: {
|
|
2057
|
+
type: "audio" | "file" | "image" | "video";
|
|
2058
|
+
name?: string | undefined;
|
|
2059
|
+
mimeType?: string | undefined;
|
|
2060
|
+
size?: number | undefined;
|
|
2061
|
+
url?: string | undefined;
|
|
2062
|
+
fetchMetadata?: Record<string, string> | undefined;
|
|
2063
|
+
}[] | undefined;
|
|
2064
|
+
links?: {
|
|
2065
|
+
url: string;
|
|
2066
|
+
thread: string;
|
|
2067
|
+
message: string;
|
|
2068
|
+
snapshot: {
|
|
2069
|
+
author: string;
|
|
2070
|
+
text: string;
|
|
2071
|
+
createdAt: string | null;
|
|
2072
|
+
files: {
|
|
2073
|
+
name: string;
|
|
2074
|
+
url: string | null;
|
|
2075
|
+
}[];
|
|
2076
|
+
} | null;
|
|
2077
|
+
}[] | undefined;
|
|
2078
|
+
id: string;
|
|
2079
|
+
platform: string;
|
|
2080
|
+
key: string;
|
|
2081
|
+
raw: unknown;
|
|
2082
|
+
type: string;
|
|
2083
|
+
} | {
|
|
2084
|
+
channel: string;
|
|
2085
|
+
thread: string;
|
|
2086
|
+
subthread: string | null;
|
|
2087
|
+
kind: "edited";
|
|
2088
|
+
message: string;
|
|
2089
|
+
text: string;
|
|
2090
|
+
author: {
|
|
2091
|
+
id: string;
|
|
2092
|
+
handle: string;
|
|
2093
|
+
name: string;
|
|
2094
|
+
avatar: string | null;
|
|
2095
|
+
isBot: boolean;
|
|
2096
|
+
};
|
|
2097
|
+
links?: {
|
|
2098
|
+
url: string;
|
|
2099
|
+
thread: string;
|
|
2100
|
+
message: string;
|
|
2101
|
+
snapshot: {
|
|
2102
|
+
author: string;
|
|
2103
|
+
text: string;
|
|
2104
|
+
createdAt: string | null;
|
|
2105
|
+
files: {
|
|
2106
|
+
name: string;
|
|
2107
|
+
url: string | null;
|
|
2108
|
+
}[];
|
|
2109
|
+
} | null;
|
|
2110
|
+
}[] | undefined;
|
|
2111
|
+
linksOnly?: boolean | undefined;
|
|
2112
|
+
id: string;
|
|
2113
|
+
platform: string;
|
|
2114
|
+
key: string;
|
|
2115
|
+
raw: unknown;
|
|
2116
|
+
type: string;
|
|
2117
|
+
} | {
|
|
2118
|
+
channel: string;
|
|
2119
|
+
thread: string;
|
|
2120
|
+
subthread: string | null;
|
|
2121
|
+
kind: "deleted";
|
|
2122
|
+
message: string;
|
|
2123
|
+
id: string;
|
|
2124
|
+
platform: string;
|
|
2125
|
+
key: string;
|
|
2126
|
+
raw: unknown;
|
|
2127
|
+
type: string;
|
|
2128
|
+
} | {
|
|
2129
|
+
channel: string;
|
|
2130
|
+
thread: string;
|
|
2131
|
+
subthread: string | null;
|
|
2132
|
+
kind: "reaction";
|
|
2133
|
+
message: string;
|
|
2134
|
+
emoji: string;
|
|
2135
|
+
added: boolean;
|
|
2136
|
+
author: {
|
|
2137
|
+
id: string;
|
|
2138
|
+
handle: string;
|
|
2139
|
+
name: string;
|
|
2140
|
+
avatar: string | null;
|
|
2141
|
+
isBot: boolean;
|
|
2142
|
+
};
|
|
2143
|
+
id: string;
|
|
2144
|
+
platform: string;
|
|
2145
|
+
key: string;
|
|
2146
|
+
raw: unknown;
|
|
2147
|
+
type: string;
|
|
2148
|
+
} | {
|
|
2149
|
+
channel: string;
|
|
2150
|
+
thread: string;
|
|
2151
|
+
subthread: string | null;
|
|
2152
|
+
kind: "lifecycle";
|
|
2153
|
+
title: string;
|
|
2154
|
+
url: string | null;
|
|
2155
|
+
body?: string | null | undefined;
|
|
2156
|
+
labels: Record<string, string>;
|
|
2157
|
+
unset: string[];
|
|
2158
|
+
owns?: string[] | undefined;
|
|
2159
|
+
reply: string | null;
|
|
2160
|
+
createRoot: boolean;
|
|
2161
|
+
retitled?: boolean | undefined;
|
|
2162
|
+
author: {
|
|
2163
|
+
id: string;
|
|
2164
|
+
handle: string;
|
|
2165
|
+
name: string;
|
|
2166
|
+
avatar: string | null;
|
|
2167
|
+
isBot: boolean;
|
|
2168
|
+
};
|
|
2169
|
+
id: string;
|
|
2170
|
+
platform: string;
|
|
2171
|
+
key: string;
|
|
2172
|
+
raw: unknown;
|
|
2173
|
+
type: string;
|
|
2174
|
+
};
|
|
2175
|
+
declare function eventSchema<P extends string, M extends string>(platform: P, messageType: M): z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2176
|
+
channel: z.ZodString;
|
|
2177
|
+
thread: z.ZodString;
|
|
2178
|
+
subthread: z.ZodNullable<z.ZodString>;
|
|
2179
|
+
kind: z.ZodLiteral<"message">;
|
|
2180
|
+
message: z.ZodString;
|
|
2181
|
+
isRoot: z.ZodBoolean;
|
|
2182
|
+
text: z.ZodString;
|
|
2183
|
+
context: z.ZodNullable<z.ZodString>;
|
|
2184
|
+
author: z.ZodObject<{
|
|
2185
|
+
id: z.ZodString;
|
|
2186
|
+
handle: z.ZodString;
|
|
2187
|
+
name: z.ZodString;
|
|
2188
|
+
avatar: z.ZodNullable<z.ZodString>;
|
|
2189
|
+
isBot: z.ZodBoolean;
|
|
2190
|
+
}, z.core.$strip>;
|
|
2191
|
+
files: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2192
|
+
type: z.ZodEnum<{
|
|
2193
|
+
audio: "audio";
|
|
2194
|
+
file: "file";
|
|
2195
|
+
image: "image";
|
|
2196
|
+
video: "video";
|
|
2197
|
+
}>;
|
|
2198
|
+
name: z.ZodOptional<z.ZodString>;
|
|
2199
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
2200
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
2201
|
+
url: z.ZodOptional<z.ZodString>;
|
|
2202
|
+
fetchMetadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
2203
|
+
}, z.core.$strip>>>;
|
|
2204
|
+
links: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2205
|
+
url: z.ZodString;
|
|
2206
|
+
thread: z.ZodString;
|
|
2207
|
+
message: z.ZodString;
|
|
2208
|
+
snapshot: z.ZodNullable<z.ZodObject<{
|
|
2209
|
+
author: z.ZodString;
|
|
2210
|
+
text: z.ZodString;
|
|
2211
|
+
createdAt: z.ZodNullable<z.ZodString>;
|
|
2212
|
+
files: z.ZodArray<z.ZodObject<{
|
|
2213
|
+
name: z.ZodString;
|
|
2214
|
+
url: z.ZodNullable<z.ZodString>;
|
|
2215
|
+
}, z.core.$strip>>;
|
|
2216
|
+
}, z.core.$strip>>;
|
|
2217
|
+
}, z.core.$strip>>>;
|
|
2218
|
+
id: z.ZodString;
|
|
2219
|
+
key: z.ZodString;
|
|
2220
|
+
raw: z.ZodUnknown;
|
|
2221
|
+
platform: z.ZodLiteral<P>;
|
|
2222
|
+
type: z.ZodLiteral<M>;
|
|
2223
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2224
|
+
channel: z.ZodString;
|
|
2225
|
+
thread: z.ZodString;
|
|
2226
|
+
subthread: z.ZodNullable<z.ZodString>;
|
|
2227
|
+
kind: z.ZodLiteral<"edited">;
|
|
2228
|
+
message: z.ZodString;
|
|
2229
|
+
text: z.ZodString;
|
|
2230
|
+
author: z.ZodObject<{
|
|
2231
|
+
id: z.ZodString;
|
|
2232
|
+
handle: z.ZodString;
|
|
2233
|
+
name: z.ZodString;
|
|
2234
|
+
avatar: z.ZodNullable<z.ZodString>;
|
|
2235
|
+
isBot: z.ZodBoolean;
|
|
2236
|
+
}, z.core.$strip>;
|
|
2237
|
+
links: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2238
|
+
url: z.ZodString;
|
|
2239
|
+
thread: z.ZodString;
|
|
2240
|
+
message: z.ZodString;
|
|
2241
|
+
snapshot: z.ZodNullable<z.ZodObject<{
|
|
2242
|
+
author: z.ZodString;
|
|
2243
|
+
text: z.ZodString;
|
|
2244
|
+
createdAt: z.ZodNullable<z.ZodString>;
|
|
2245
|
+
files: z.ZodArray<z.ZodObject<{
|
|
2246
|
+
name: z.ZodString;
|
|
2247
|
+
url: z.ZodNullable<z.ZodString>;
|
|
2248
|
+
}, z.core.$strip>>;
|
|
2249
|
+
}, z.core.$strip>>;
|
|
2250
|
+
}, z.core.$strip>>>;
|
|
2251
|
+
linksOnly: z.ZodOptional<z.ZodBoolean>;
|
|
2252
|
+
id: z.ZodString;
|
|
2253
|
+
key: z.ZodString;
|
|
2254
|
+
raw: z.ZodUnknown;
|
|
2255
|
+
platform: z.ZodLiteral<P>;
|
|
2256
|
+
type: z.ZodLiteral<"message.edited">;
|
|
2257
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2258
|
+
channel: z.ZodString;
|
|
2259
|
+
thread: z.ZodString;
|
|
2260
|
+
subthread: z.ZodNullable<z.ZodString>;
|
|
2261
|
+
kind: z.ZodLiteral<"deleted">;
|
|
2262
|
+
message: z.ZodString;
|
|
2263
|
+
id: z.ZodString;
|
|
2264
|
+
key: z.ZodString;
|
|
2265
|
+
raw: z.ZodUnknown;
|
|
2266
|
+
platform: z.ZodLiteral<P>;
|
|
2267
|
+
type: z.ZodLiteral<"message.deleted">;
|
|
2268
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2269
|
+
channel: z.ZodString;
|
|
2270
|
+
thread: z.ZodString;
|
|
2271
|
+
subthread: z.ZodNullable<z.ZodString>;
|
|
2272
|
+
kind: z.ZodLiteral<"reaction">;
|
|
2273
|
+
message: z.ZodString;
|
|
2274
|
+
emoji: z.ZodString;
|
|
2275
|
+
added: z.ZodBoolean;
|
|
2276
|
+
author: z.ZodObject<{
|
|
2277
|
+
id: z.ZodString;
|
|
2278
|
+
handle: z.ZodString;
|
|
2279
|
+
name: z.ZodString;
|
|
2280
|
+
avatar: z.ZodNullable<z.ZodString>;
|
|
2281
|
+
isBot: z.ZodBoolean;
|
|
2282
|
+
}, z.core.$strip>;
|
|
2283
|
+
id: z.ZodString;
|
|
2284
|
+
key: z.ZodString;
|
|
2285
|
+
raw: z.ZodUnknown;
|
|
2286
|
+
platform: z.ZodLiteral<P>;
|
|
2287
|
+
type: z.ZodEnum<{
|
|
2288
|
+
"reaction.added": "reaction.added";
|
|
2289
|
+
"reaction.removed": "reaction.removed";
|
|
2290
|
+
}>;
|
|
2291
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2292
|
+
channel: z.ZodString;
|
|
2293
|
+
thread: z.ZodString;
|
|
2294
|
+
subthread: z.ZodNullable<z.ZodString>;
|
|
2295
|
+
kind: z.ZodLiteral<"lifecycle">;
|
|
2296
|
+
type: z.ZodString;
|
|
2297
|
+
title: z.ZodString;
|
|
2298
|
+
url: z.ZodNullable<z.ZodString>;
|
|
2299
|
+
body: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2300
|
+
labels: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
2301
|
+
unset: z.ZodArray<z.ZodString>;
|
|
2302
|
+
owns: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2303
|
+
reply: z.ZodNullable<z.ZodString>;
|
|
2304
|
+
createRoot: z.ZodBoolean;
|
|
2305
|
+
retitled: z.ZodOptional<z.ZodBoolean>;
|
|
2306
|
+
author: z.ZodObject<{
|
|
2307
|
+
id: z.ZodString;
|
|
2308
|
+
handle: z.ZodString;
|
|
2309
|
+
name: z.ZodString;
|
|
2310
|
+
avatar: z.ZodNullable<z.ZodString>;
|
|
2311
|
+
isBot: z.ZodBoolean;
|
|
2312
|
+
}, z.core.$strip>;
|
|
2313
|
+
id: z.ZodString;
|
|
2314
|
+
key: z.ZodString;
|
|
2315
|
+
raw: z.ZodUnknown;
|
|
2316
|
+
platform: z.ZodLiteral<P>;
|
|
2317
|
+
}, z.core.$strip>], "kind">;
|
|
2318
|
+
type SyncRoot = {
|
|
2319
|
+
text: string;
|
|
2320
|
+
labels: Record<string, string>;
|
|
2321
|
+
author: ExternalAuthor;
|
|
2322
|
+
raw: unknown;
|
|
2323
|
+
};
|
|
2324
|
+
type RootOverride = (root: Readonly<SyncRoot>) => {
|
|
2325
|
+
text?: string;
|
|
2326
|
+
labels?: Record<string, string>;
|
|
2327
|
+
};
|
|
2328
|
+
declare const SyncOverrides: z.ZodObject<{
|
|
2329
|
+
root: z.ZodOptional<z.ZodCustom<RootOverride, RootOverride>>;
|
|
2330
|
+
text: z.ZodOptional<z.ZodString>;
|
|
2331
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
2332
|
+
unset: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2333
|
+
noSync: z.ZodOptional<z.ZodBoolean>;
|
|
2334
|
+
}, z.core.$strict>;
|
|
2335
|
+
type SyncOverrides = z.infer<typeof SyncOverrides>;
|
|
2336
|
+
/** What an import made: its thread's root and the message, as IDs clients pass back as they got them. */
|
|
2337
|
+
type SyncResult = {
|
|
2338
|
+
root: string | null;
|
|
2339
|
+
message: string | null;
|
|
2340
|
+
};
|
|
2341
|
+
//#endregion
|
|
2342
|
+
//#region src/sync/fn.d.ts
|
|
2343
|
+
/** An event coming in from the platform. */
|
|
2344
|
+
type SyncIn<E extends ProviderEvent = ProviderEvent> = {
|
|
2345
|
+
direction: 'in';
|
|
2346
|
+
/** The sync entry's key: `slack` in `sync: { slack: slack(…) }`. */
|
|
2347
|
+
key: string;
|
|
2348
|
+
/** The platform channel it happened in, as the platform names it: `C0123ABC`, `owner/repo:pulls`, a phone number ID. */
|
|
2349
|
+
channel: string;
|
|
2350
|
+
/** The event, validated and frozen. */
|
|
2351
|
+
event: E;
|
|
2352
|
+
/** The board, as the platform user the event came from: its writes are theirs. */
|
|
2353
|
+
board: BoardClient;
|
|
2354
|
+
/**
|
|
2355
|
+
* Imports the event: into its board thread when the board syncs its platform thread, otherwise
|
|
2356
|
+
* as a new root in `channel`. Without a channel, an event in a thread the board doesn't sync
|
|
2357
|
+
* stays off it. Runs once: a second call answers what the first did.
|
|
2358
|
+
*/
|
|
2359
|
+
import(channel?: string, overrides?: SyncOverrides): Promise<SyncResult>;
|
|
2360
|
+
/** The platform's own link to the event's message, or null when it has none. Nothing is synced or joined. */
|
|
2361
|
+
permalink(): Promise<string | null>;
|
|
2362
|
+
/** A platform channel's ID from its name (`#dev` → `C0123ABC`), as `channel` names it. */
|
|
2363
|
+
resolve(name: string): Promise<string>;
|
|
2364
|
+
};
|
|
2365
|
+
/** A board event going out to the platform. */
|
|
2366
|
+
type SyncOut = {
|
|
2367
|
+
direction: 'out';
|
|
2368
|
+
key: string;
|
|
2369
|
+
/** The platform channel `target` is in, as the platform names it; null for a new root, which isn't on the platform yet. */
|
|
2370
|
+
channel: string | null;
|
|
2371
|
+
event: BoardEventView;
|
|
2372
|
+
/** The message the event is about, as it is now. */
|
|
2373
|
+
message: MessageView;
|
|
2374
|
+
/** Where it goes: a platform thread or channel the board thread syncs with (`slack:C0123ABC:1727000000.123456`), or null for a new root. */
|
|
2375
|
+
target: string | null;
|
|
2376
|
+
/**
|
|
2377
|
+
* Sends the event to `target`: a new thread's root and what's been said in it, a reply, an
|
|
2378
|
+
* edit, a delete, a reaction, or the copy a label change re-renders. A new root has no target
|
|
2379
|
+
* yet, so it sends nothing. Runs once: a second call answers what the first did.
|
|
2380
|
+
*/
|
|
2381
|
+
deliver(options?: {
|
|
2382
|
+
render?: Renderer;
|
|
2383
|
+
}): Promise<void>;
|
|
2384
|
+
/**
|
|
2385
|
+
* Syncs the message's thread with a platform channel (`#dev`, `C0123ABC`): the board starts a
|
|
2386
|
+
* thread there, and its root and replies follow. Never the channel it came from.
|
|
2387
|
+
*/
|
|
2388
|
+
start(channel: string): Promise<void>;
|
|
2389
|
+
resolve(name: string): Promise<string>;
|
|
2390
|
+
};
|
|
2391
|
+
type Sync<E extends ProviderEvent = ProviderEvent> = SyncIn<E> | SyncOut;
|
|
2392
|
+
/**
|
|
2393
|
+
* What every event does, both ways. Inbound, it calls `import` to bring the event onto the board;
|
|
2394
|
+
* outbound, `deliver` to send it to the platform, or `start` to open a new root's thread there.
|
|
2395
|
+
* One that calls neither does nothing. A throw is retried.
|
|
2396
|
+
*
|
|
2397
|
+
* The webhook keeps an event (stores it in the inbox for the function) when the board syncs its
|
|
2398
|
+
* thread, or when its channel is one that `channels`, `repos`, or `numbers` routes. A function of
|
|
2399
|
+
* your own at the top keeps every event the platform sends, so keep the helper outermost.
|
|
2400
|
+
*/
|
|
2401
|
+
type SyncFn<E extends ProviderEvent = ProviderEvent> = (sync: Sync<E>) => unknown;
|
|
2402
|
+
/** A sync function, or a board channel: what a string means is up to the helper that takes it. */
|
|
2403
|
+
type SyncUnit<E extends ProviderEvent = ProviderEvent> = string | SyncFn<E>;
|
|
2404
|
+
/**
|
|
2405
|
+
* A two-way mirror of a board channel: what comes in lands in `channel`, what's said on the
|
|
2406
|
+
* board goes out, and a new root in `channel` starts a thread in the platform channel.
|
|
2407
|
+
*/
|
|
2408
|
+
declare function mirror(channel: string): SyncFn;
|
|
2409
|
+
/** Imports into a board channel, and sends nothing back. */
|
|
2410
|
+
declare function into(channel: string): SyncFn;
|
|
2411
|
+
/** `inner`, delivering with `renderer` unless it passes its own. */
|
|
2412
|
+
declare function render<E extends ProviderEvent = ProviderEvent>(renderer: Renderer, inner: SyncFn<E>): SyncFn<E>;
|
|
2413
|
+
/**
|
|
2414
|
+
* Routes each event by its platform channel. Keys are platform channels, by name (`'#dev'`) or
|
|
2415
|
+
* ID (`'C0123ABC'`); values are a board channel to `mirror`, or a sync function. A new root goes
|
|
2416
|
+
* to every channel's function, with `channel` set to that one. A thread the board syncs outside
|
|
2417
|
+
* these channels (someone ran `vb sync` on it) stays synced both ways. A key the platform says
|
|
2418
|
+
* doesn't exist is skipped. While one can't be checked, an event outside the resolved channels
|
|
2419
|
+
* throws, so it's retried, rather than going past that key's function to the default. A new root
|
|
2420
|
+
* starts only in the channels that resolved.
|
|
2421
|
+
*/
|
|
2422
|
+
declare function channels<E extends ProviderEvent = ProviderEvent>(map: Record<string, SyncUnit<E>>): SyncFn<E>;
|
|
2423
|
+
//#endregion
|
|
2424
|
+
//#region src/sync/provider.d.ts
|
|
2425
|
+
declare const ResolvedTarget: z.ZodObject<{
|
|
2426
|
+
target: z.ZodString;
|
|
2427
|
+
channel: z.ZodString;
|
|
2428
|
+
kind: z.ZodEnum<{
|
|
2429
|
+
channel: "channel";
|
|
2430
|
+
thread: "thread";
|
|
2431
|
+
}>;
|
|
2432
|
+
}, z.core.$strict>;
|
|
2433
|
+
type ResolvedTarget = z.infer<typeof ResolvedTarget>;
|
|
2434
|
+
/** The fields a provider's `event` builds its typed event from. */
|
|
2435
|
+
type SyncContext = {
|
|
2436
|
+
id: string;
|
|
2437
|
+
key: string;
|
|
2438
|
+
event: ExternalEvent;
|
|
2439
|
+
raw: unknown;
|
|
2440
|
+
};
|
|
2441
|
+
type RenderInput = {
|
|
2442
|
+
/** The message as clients see it: its IDs are refs. */
|
|
2443
|
+
message: Readonly<MessageView>;
|
|
2444
|
+
author: Readonly<Actor> | null;
|
|
2445
|
+
/** How this platform mentions an actor when it's one of its own (`<@U123>`); null for anyone else. */
|
|
2446
|
+
mentionOf: (actor: string) => string | null;
|
|
2447
|
+
label: string;
|
|
2448
|
+
target: string;
|
|
2449
|
+
};
|
|
2450
|
+
/** How a platform shows a board message: markdown, which the platform converts to its own format. */
|
|
2451
|
+
type Renderer = (input: RenderInput) => string;
|
|
2452
|
+
type FileDelivery = {
|
|
2453
|
+
message: string;
|
|
2454
|
+
files: string[];
|
|
2455
|
+
};
|
|
2456
|
+
/** What a linked message said, or why the platform wouldn't say. */
|
|
2457
|
+
type FetchedLink = Pick<Link, 'snapshot' | 'unavailable'>;
|
|
2458
|
+
/** Why a platform wouldn't read a channel or thread on demand. Its message is shown as is. */
|
|
2459
|
+
declare class UnreadableError extends Error {
|
|
2460
|
+
readonly code: string;
|
|
2461
|
+
constructor(code: string, message: string);
|
|
2462
|
+
}
|
|
2463
|
+
/** A file to send: its bytes (a Node `Buffer` is one), its name, and its type. */
|
|
2464
|
+
type ProviderFile = {
|
|
2465
|
+
data: Uint8Array;
|
|
2466
|
+
filename: string;
|
|
2467
|
+
mimeType?: string;
|
|
2468
|
+
};
|
|
2469
|
+
/**
|
|
2470
|
+
* Who a post is from, for a platform that can show it as the sender (Slack's per-message
|
|
2471
|
+
* username and icon): `name` is the label the text opens with (`**name**: …`).
|
|
2472
|
+
*/
|
|
2473
|
+
type ProviderSender = {
|
|
2474
|
+
name: string;
|
|
2475
|
+
avatar: string | null;
|
|
2476
|
+
};
|
|
2477
|
+
type ProviderPost = {
|
|
2478
|
+
markdown: string;
|
|
2479
|
+
files?: ProviderFile[];
|
|
2480
|
+
as?: ProviderSender;
|
|
2481
|
+
};
|
|
2482
|
+
type ProviderDelivery = {
|
|
2483
|
+
thread: string;
|
|
2484
|
+
message: string;
|
|
2485
|
+
files?: string[];
|
|
2486
|
+
};
|
|
2487
|
+
type ProviderOptions = {
|
|
2488
|
+
platform: string;
|
|
2489
|
+
canStartThreads?: boolean;
|
|
2490
|
+
singleReaction?: boolean;
|
|
2491
|
+
uploadsFiles?: boolean;
|
|
2492
|
+
/** Whether a new thread's root can carry its files in the same message as its text. */
|
|
2493
|
+
startsThreadsWithFiles?: boolean;
|
|
2494
|
+
};
|
|
2495
|
+
declare const ReceivedEvent: z.ZodObject<{
|
|
2496
|
+
event: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2497
|
+
channel: z.ZodString;
|
|
2498
|
+
thread: z.ZodString;
|
|
2499
|
+
subthread: z.ZodNullable<z.ZodString>;
|
|
2500
|
+
kind: z.ZodLiteral<"message">;
|
|
2501
|
+
message: z.ZodString;
|
|
2502
|
+
isRoot: z.ZodBoolean;
|
|
2503
|
+
text: z.ZodString;
|
|
2504
|
+
context: z.ZodNullable<z.ZodString>;
|
|
2505
|
+
author: z.ZodObject<{
|
|
2506
|
+
id: z.ZodString;
|
|
2507
|
+
handle: z.ZodString;
|
|
2508
|
+
name: z.ZodString;
|
|
2509
|
+
avatar: z.ZodNullable<z.ZodString>;
|
|
2510
|
+
isBot: z.ZodBoolean;
|
|
2511
|
+
}, z.core.$strip>;
|
|
2512
|
+
files: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2513
|
+
type: z.ZodEnum<{
|
|
2514
|
+
audio: "audio";
|
|
2515
|
+
file: "file";
|
|
2516
|
+
image: "image";
|
|
2517
|
+
video: "video";
|
|
2518
|
+
}>;
|
|
2519
|
+
name: z.ZodOptional<z.ZodString>;
|
|
2520
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
2521
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
2522
|
+
url: z.ZodOptional<z.ZodString>;
|
|
2523
|
+
fetchMetadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
2524
|
+
}, z.core.$strip>>>;
|
|
2525
|
+
links: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2526
|
+
url: z.ZodString;
|
|
2527
|
+
thread: z.ZodString;
|
|
2528
|
+
message: z.ZodString;
|
|
2529
|
+
snapshot: z.ZodNullable<z.ZodObject<{
|
|
2530
|
+
author: z.ZodString;
|
|
2531
|
+
text: z.ZodString;
|
|
2532
|
+
createdAt: z.ZodNullable<z.ZodString>;
|
|
2533
|
+
files: z.ZodArray<z.ZodObject<{
|
|
2534
|
+
name: z.ZodString;
|
|
2535
|
+
url: z.ZodNullable<z.ZodString>;
|
|
2536
|
+
}, z.core.$strip>>;
|
|
2537
|
+
}, z.core.$strip>>;
|
|
2538
|
+
}, z.core.$strip>>>;
|
|
2539
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2540
|
+
channel: z.ZodString;
|
|
2541
|
+
thread: z.ZodString;
|
|
2542
|
+
subthread: z.ZodNullable<z.ZodString>;
|
|
2543
|
+
kind: z.ZodLiteral<"edited">;
|
|
2544
|
+
message: z.ZodString;
|
|
2545
|
+
text: z.ZodString;
|
|
2546
|
+
author: z.ZodObject<{
|
|
2547
|
+
id: z.ZodString;
|
|
2548
|
+
handle: z.ZodString;
|
|
2549
|
+
name: z.ZodString;
|
|
2550
|
+
avatar: z.ZodNullable<z.ZodString>;
|
|
2551
|
+
isBot: z.ZodBoolean;
|
|
2552
|
+
}, z.core.$strip>;
|
|
2553
|
+
links: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2554
|
+
url: z.ZodString;
|
|
2555
|
+
thread: z.ZodString;
|
|
2556
|
+
message: z.ZodString;
|
|
2557
|
+
snapshot: z.ZodNullable<z.ZodObject<{
|
|
2558
|
+
author: z.ZodString;
|
|
2559
|
+
text: z.ZodString;
|
|
2560
|
+
createdAt: z.ZodNullable<z.ZodString>;
|
|
2561
|
+
files: z.ZodArray<z.ZodObject<{
|
|
2562
|
+
name: z.ZodString;
|
|
2563
|
+
url: z.ZodNullable<z.ZodString>;
|
|
2564
|
+
}, z.core.$strip>>;
|
|
2565
|
+
}, z.core.$strip>>;
|
|
2566
|
+
}, z.core.$strip>>>;
|
|
2567
|
+
linksOnly: z.ZodOptional<z.ZodBoolean>;
|
|
2568
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2569
|
+
channel: z.ZodString;
|
|
2570
|
+
thread: z.ZodString;
|
|
2571
|
+
subthread: z.ZodNullable<z.ZodString>;
|
|
2572
|
+
kind: z.ZodLiteral<"deleted">;
|
|
2573
|
+
message: z.ZodString;
|
|
2574
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2575
|
+
channel: z.ZodString;
|
|
2576
|
+
thread: z.ZodString;
|
|
2577
|
+
subthread: z.ZodNullable<z.ZodString>;
|
|
2578
|
+
kind: z.ZodLiteral<"reaction">;
|
|
2579
|
+
message: z.ZodString;
|
|
2580
|
+
emoji: z.ZodString;
|
|
2581
|
+
added: z.ZodBoolean;
|
|
2582
|
+
author: z.ZodObject<{
|
|
2583
|
+
id: z.ZodString;
|
|
2584
|
+
handle: z.ZodString;
|
|
2585
|
+
name: z.ZodString;
|
|
2586
|
+
avatar: z.ZodNullable<z.ZodString>;
|
|
2587
|
+
isBot: z.ZodBoolean;
|
|
2588
|
+
}, z.core.$strip>;
|
|
2589
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2590
|
+
channel: z.ZodString;
|
|
2591
|
+
thread: z.ZodString;
|
|
2592
|
+
kind: z.ZodLiteral<"lifecycle">;
|
|
2593
|
+
type: z.ZodString;
|
|
2594
|
+
title: z.ZodString;
|
|
2595
|
+
url: z.ZodNullable<z.ZodString>;
|
|
2596
|
+
body: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2597
|
+
labels: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
2598
|
+
unset: z.ZodArray<z.ZodString>;
|
|
2599
|
+
owns: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2600
|
+
reply: z.ZodNullable<z.ZodString>;
|
|
2601
|
+
createRoot: z.ZodBoolean;
|
|
2602
|
+
retitled: z.ZodOptional<z.ZodBoolean>;
|
|
2603
|
+
author: z.ZodObject<{
|
|
2604
|
+
id: z.ZodString;
|
|
2605
|
+
handle: z.ZodString;
|
|
2606
|
+
name: z.ZodString;
|
|
2607
|
+
avatar: z.ZodNullable<z.ZodString>;
|
|
2608
|
+
isBot: z.ZodBoolean;
|
|
2609
|
+
}, z.core.$strip>;
|
|
2610
|
+
}, z.core.$strip>], "kind">;
|
|
2611
|
+
raw: z.ZodUnknown;
|
|
2612
|
+
dedupe: z.ZodString;
|
|
2613
|
+
}, z.core.$strip>;
|
|
2614
|
+
type ReceivedEvent = z.infer<typeof ReceivedEvent>;
|
|
2615
|
+
type Receive = (received: ReceivedEvent) => Promise<void>;
|
|
2616
|
+
declare abstract class SyncProvider<E extends ProviderEvent = ProviderEvent> {
|
|
2617
|
+
readonly platform: string;
|
|
2618
|
+
readonly canStartThreads: boolean;
|
|
2619
|
+
readonly singleReaction: boolean;
|
|
2620
|
+
readonly uploadsFiles: boolean;
|
|
2621
|
+
readonly startsThreadsWithFiles: boolean;
|
|
2622
|
+
private readonly fn;
|
|
2623
|
+
protected readonly options: ProviderOptions;
|
|
2624
|
+
constructor(options: ProviderOptions, sync: SyncFn<E>);
|
|
2625
|
+
abstract receive(key: string, request: Request, emit: Receive): Promise<Response>;
|
|
2626
|
+
abstract resolveChannel(key: string): Promise<string>;
|
|
2627
|
+
abstract resolveTarget(target: string): Promise<ResolvedTarget>;
|
|
2628
|
+
abstract post(target: string, kind: ResolvedTarget['kind'], body: ProviderPost): Promise<ProviderDelivery>;
|
|
2629
|
+
findByEmail(_email: string): Promise<ExternalAuthor | null>;
|
|
2630
|
+
mention(_actor: Actor): string | null;
|
|
2631
|
+
fetchRoot(_thread: string): Promise<SyncRoot | null>;
|
|
2632
|
+
fetchFile(_file: ExternalFile): Promise<Uint8Array | null>;
|
|
2633
|
+
/** The platform's own link to an event's message, or null when it has none. */
|
|
2634
|
+
permalink(_event: E): Promise<string | null>;
|
|
2635
|
+
/**
|
|
2636
|
+
* A linked message the platform didn't describe, read from the platform. `linker` is the
|
|
2637
|
+
* platform message that links it, by its own IDs: what the platform says about the link may be
|
|
2638
|
+
* there by now.
|
|
2639
|
+
*/
|
|
2640
|
+
fetchLink(_link: ExternalLink, _linker: {
|
|
2641
|
+
thread: string;
|
|
2642
|
+
message: string;
|
|
2643
|
+
}): Promise<FetchedLink>;
|
|
2644
|
+
/**
|
|
2645
|
+
* The message a URL of this platform's names, by its own thread and message IDs, or null for a
|
|
2646
|
+
* URL that isn't one. `message` is null for a link to a thread itself. It asks the platform
|
|
2647
|
+
* nothing: the board answers from what it synced (`vb read <url>`).
|
|
2648
|
+
*/
|
|
2649
|
+
locate(_url: string): {
|
|
2650
|
+
thread: string;
|
|
2651
|
+
message: string | null;
|
|
2652
|
+
} | null;
|
|
2653
|
+
/** The platform's URL for one of its messages, by its own IDs, or null when it has none (`vb sync <id>`). */
|
|
2654
|
+
url(_thread: string, _message: string): Promise<string | null>;
|
|
2655
|
+
/**
|
|
2656
|
+
* A channel or thread, read on demand for whoever asked: nothing is synced,
|
|
2657
|
+
* stored, or joined. Throws `UnreadableError` for what it won't read.
|
|
2658
|
+
*/
|
|
2659
|
+
read(_target: string, _options: {
|
|
2660
|
+
limit: number;
|
|
2661
|
+
after: string | null;
|
|
2662
|
+
}): Promise<SourceRead>;
|
|
2663
|
+
/** Adds the board's app to a channel so `read` can read it, where the board opted in. Throws `UnreadableError` otherwise. */
|
|
2664
|
+
join(_target: string): Promise<SourceJoin>;
|
|
2665
|
+
edit(_thread: string, _message: string, _body: ProviderPost): Promise<void>;
|
|
2666
|
+
delete(_thread: string, _message: string): Promise<void>;
|
|
2667
|
+
react(_thread: string, _message: string, _emoji: string, _added: boolean): Promise<void>;
|
|
2668
|
+
startTyping(_thread: string, _latest: string | null, _status?: string): Promise<void>;
|
|
2669
|
+
/**
|
|
2670
|
+
* The channel whose inbox a thread's events land in (`slack:C0123ABC` for `slack:C0123ABC:1727.1234`),
|
|
2671
|
+
* worked out without calling the platform. Null when the provider can't tell: a key's inbox then
|
|
2672
|
+
* lists only the mapped channels'.
|
|
2673
|
+
*/
|
|
2674
|
+
inboxChannel(_key: string, _thread: string): string | null;
|
|
2675
|
+
deleteFiles(_ids: string[]): Promise<void>;
|
|
2676
|
+
refusesFiles(_error: unknown): boolean;
|
|
2677
|
+
uploadFiles(_thread: string, _files: ProviderFile[]): Promise<FileDelivery>;
|
|
2678
|
+
abstract event(context: SyncContext): E;
|
|
2679
|
+
/** Runs the sync function the provider was made with: what every event does, both ways. */
|
|
2680
|
+
sync(sync: Sync<E>): unknown;
|
|
2681
|
+
/** The default rendering: `**${label}**: ${text}`. A `Renderer` passed to `deliver` replaces it. */
|
|
2682
|
+
render(input: RenderInput): string;
|
|
2683
|
+
}
|
|
2684
|
+
//#endregion
|
|
2685
|
+
export { EditBody as $, SyncImportBody as $t, envelope as A, RegisterBody as At, ScheduleTiming as B, SchedulesQueryInput as Bt, render as C, MessagesQueryInput as Ct, SyncOverrides as D, REGISTERED_WATCHERS_MAX as Dt, RootOverride as E, PostInput as Et, Filters as F, ScheduleBody as Ft, AckBody as G, SourceRead as Gt, WaitOptions as H, SourceJoin as Ht, PostOptions as I, ScheduleBodyOutput as It, BoardEventView as J, SyncCopiesQuery as Jt, ActorView as K, SourceReadQuery as Kt, ProfileOption as L, ScheduleInput as Lt, BoardClient as M, RegistrationView as Mt, BoardError as N, ResolvedSyncTarget as Nt, SyncResult as O, ReactBody as Ot, ErrorOrigin as P, RouteName as Pt, Discovery as Q, SyncFindView as Qt, ReplyOptions as R, ScheduleView as Rt, mirror as S, MessagesQuery as St, ProviderEvent as T, PostBody as Tt, Written as U, SourceJoinBody as Ut, UploadInput as V, SchedulesQueryOutput as Vt, duration as W, SourceMessage as Wt, CreateChannelBody as X, SyncFindInput as Xt, ChannelView as Y, SyncCopiesView as Yt, DeleteBody as Z, SyncFindQuery as Zt, SyncIn as _, routes as _n, MatchView as _t, ProviderOptions as a, ThreadSummaryView as an, GrantInput as at, channels as b, MessageView as bt, ReceivedEvent as c, ThreadsQuery as cn, InboxEntry as ct, ResolvedTarget as d, TokenInput as dn, InboxPushBody as dt, SyncImportInput as en, EventsPage as et, SyncContext as f, TokenView as fn, InboxQuery as ft, SyncFn as g, UploadTicket as gn, LinkedQuery as gt, Sync as h, UploadStartBody as hn, LinkView as ht, ProviderFile as i, SyncedView as in, GrantBody as it, eventSchema as j, RegisterInput as jt, SyncRoot as k, Ref as kt, RenderInput as l, ThreadsQueryInput as ln, InboxItem as lt, UnreadableError as m, TypingResult as mn, LabelBody as mt, FileDelivery as n, SyncReceiptInput as nn, EventsQueryInput as nt, ProviderPost as o, ThreadView as on, GrantView as ot, SyncProvider as p, TypingBody as pn, LABEL_CONDITIONS_MAX as pt, ApiError as q, SyncBody as qt, ProviderDelivery as r, SyncThreadView as rn, FiltersInput as rt, Receive as s, ThreadsPage as sn, InboxAckBody as st, FetchedLink as t, SyncReceiptBody as tn, EventsQuery as tt, Renderer as u, TokenBody as un, InboxNextQuery as ut, SyncOut as v, MatchesQuery as vt, EventBase as w, ParsedFilters as wt, into as x, MessagesPage as xt, SyncUnit as y, Me as yt, ScheduleOptions as z, SchedulesQuery as zt };
|