@vercel/board 0.25.0 → 0.26.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.
Files changed (84) hide show
  1. package/dist/{a2-CQ3WcqMv.mjs → a2-Qzj0kCWU.mjs} +6 -6
  2. package/dist/access.d.mts +1 -2
  3. package/dist/access.mjs +3 -3
  4. package/dist/{actors-CDDhhFNY.mjs → actors-BLXVp4oZ.mjs} +2 -2
  5. package/dist/{auth-BwWH3Twu.mjs → auth-lTkOgvcE.mjs} +1 -1
  6. package/dist/{backend-DmXjVnil.d.mts → backend-ZKYTe3xa.d.mts} +5 -15
  7. package/dist/backend-a2/blob-vercel.d.mts +1 -1
  8. package/dist/backend-a2/contract.d.mts +1 -2
  9. package/dist/backend-a2/store-memory.d.mts +1 -1
  10. package/dist/backend-a2/store-postgres.d.mts +1 -1
  11. package/dist/backend-a2/store-redis-http.d.mts +1 -1
  12. package/dist/backend-a2/store-redis.d.mts +1 -1
  13. package/dist/backend-a2/store-sqlite.d.mts +1 -1
  14. package/dist/backend-a2.d.mts +5 -6
  15. package/dist/backend-a2.mjs +1 -1
  16. package/dist/{backend-http-BJ7AdK0c.mjs → backend-http-BB0Gld6Q.mjs} +8 -5
  17. package/dist/{backend-http-BsP0Xq9e.d.mts → backend-http-E7YU0qhn.d.mts} +3 -4
  18. package/dist/{backend-http-Cs-UKpYp.mjs → backend-http-F0W6e36G.mjs} +2 -2
  19. package/dist/backend-http.d.mts +1 -1
  20. package/dist/backend-http.mjs +1 -1
  21. package/dist/backend-http.node.d.mts +1 -1
  22. package/dist/backend-http.node.mjs +1 -1
  23. package/dist/{backend-vercel-CED673bx.d.mts → backend-vercel-CIRObA0t.d.mts} +3 -4
  24. package/dist/{backend-vercel-CG2SYa03.mjs → backend-vercel-CtB46vMQ.mjs} +3 -3
  25. package/dist/{backend-vercel-B0Q0K0O5.mjs → backend-vercel-DUWIcFi9.mjs} +24 -8
  26. package/dist/backend-vercel.d.mts +1 -1
  27. package/dist/backend-vercel.mjs +1 -1
  28. package/dist/backend-vercel.node.d.mts +6 -1
  29. package/dist/backend-vercel.node.mjs +2 -2
  30. package/dist/{blob-C0J3wbGv.d.mts → blob-B-9AvYis.d.mts} +2 -1
  31. package/dist/{chat-provider-6eYkL2ef.d.mts → chat-provider-DsNEBQiA.d.mts} +3 -2
  32. package/dist/cli-commands.d.mts +1 -1
  33. package/dist/cli-commands.mjs +1 -1
  34. package/dist/cli-embedded.d.mts +7 -3
  35. package/dist/cli-embedded.mjs +8 -4
  36. package/dist/cli.mjs +4 -4
  37. package/dist/{client-BY-BCggB.mjs → client-D0Px7KzF.mjs} +16 -4
  38. package/dist/{provider-C_sj4-GL.d.mts → client-xLxeDz0f.d.mts} +13 -689
  39. package/dist/{commands-D0wXq6CY.d.mts → commands-D6gvrOh3.d.mts} +4 -4
  40. package/dist/{commands-BtL4jFq8.mjs → commands-nEG47RM_.mjs} +7 -7
  41. package/dist/{conformance-BZ53bxrG.mjs → conformance-DlnfuzEB.mjs} +1 -1
  42. package/dist/conformance.d.mts +1 -1
  43. package/dist/conformance.mjs +1 -1
  44. package/dist/{engine-SeaJ_CIY.mjs → engine-ROa7-IQY.mjs} +2 -2
  45. package/dist/errors-CB4tnZGz.d.mts +16 -0
  46. package/dist/{errors-Bven0k29.mjs → errors-CusN4x2l.mjs} +14 -6
  47. package/dist/exports-D22M68rk.d.mts +5 -0
  48. package/dist/{exports-ByvYtxFT.mjs → exports-NFjBgIT2.mjs} +6 -6
  49. package/dist/{folds-CRYY14kc.d.mts → folds-jS9wlh9_.d.mts} +49 -2
  50. package/dist/{index-k2LfZxl-.d.mts → index-C05it0mC.d.mts} +2 -2
  51. package/dist/index.d.mts +5 -4
  52. package/dist/{index.default-DmfhBZZi.mjs → index.default-Boe7x-mK.mjs} +1 -1
  53. package/dist/index.mjs +6 -6
  54. package/dist/index.node.d.mts +5 -4
  55. package/dist/index.node.mjs +4 -4
  56. package/dist/inspect/app.js +108 -108
  57. package/dist/{main-BNkywL2P.mjs → main-BuahKR16.mjs} +84 -69
  58. package/dist/{middleware-B0J7QBq7.mjs → middleware-ChKM1zuu.mjs} +1 -1
  59. package/dist/{node-C51_xzCb.mjs → node-Ybi9E6bO.mjs} +104 -46
  60. package/dist/provider-Cdg1qadh.d.mts +688 -0
  61. package/dist/{serve-DYQ64Q5R.mjs → serve-BbHEQk_Y.mjs} +5 -5
  62. package/dist/{server-BgK1sgj7.mjs → server-Bphio_82.mjs} +4 -4
  63. package/dist/{serving-rXQcEgTO.mjs → serving-CvOWEym2.mjs} +1 -1
  64. package/dist/sync-github.d.mts +2 -2
  65. package/dist/sync-kapso.d.mts +2 -2
  66. package/dist/sync-linear.d.mts +2 -2
  67. package/dist/sync-slack.d.mts +3 -3
  68. package/dist/sync.chat.d.mts +1 -1
  69. package/dist/sync.d.mts +2 -2
  70. package/dist/{tokens-U-XRlEfq.mjs → tokens-BuCU-61R.mjs} +2 -2
  71. package/dist/{types-8yq2VnKI.d.mts → types-aCAf6lGU.d.mts} +1 -1
  72. package/dist/{watchers-hash-C4CJg7K1.mjs → watchers-hash-BfDPW95j.mjs} +5 -5
  73. package/docs/01-board/04-messages.md +1 -1
  74. package/docs/01-board/05-reading.md +2 -2
  75. package/docs/01-board/06-watchers.md +3 -3
  76. package/docs/02-sync/01-overview.md +2 -2
  77. package/docs/03-guides/03-ci.md +2 -2
  78. package/docs/03-guides/04-triage.md +5 -5
  79. package/docs/04-reference/01-cli.md +9 -4
  80. package/docs/04-reference/02-board.md +6 -2
  81. package/docs/index.md +2 -2
  82. package/package.json +1 -1
  83. package/dist/exports-CPrIkpz3.d.mts +0 -4
  84. package/dist/schemas-CWxs3ECJ.d.mts +0 -50
@@ -1,6 +1,5 @@
1
1
  import { n as AccessSummary } from "./access-CV96SYgr.mjs";
2
- import { i as Attachment } from "./schemas-CWxs3ECJ.mjs";
3
- import { a as ExternalCopy, d as ExternalFile, f as ExternalLink, g as BoardEvent, l as ExternalAuthor, o as Message, p as Link, r as Channel, t as Actor, u as ExternalEvent } from "./folds-CRYY14kc.mjs";
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-jS9wlh9_.mjs";
4
3
  import { z } from "zod";
5
4
  //#region src/api/routes.d.ts
6
5
  /**
@@ -1699,15 +1698,24 @@ type RouteName = keyof typeof routes;
1699
1698
  //#endregion
1700
1699
  //#region src/client/client.d.ts
1701
1700
  /**
1702
- * What went wrong: `message` says what and why, `code` is what to branch on, and `hint`, when the
1703
- * handle knows one, says what fixes it (`Set VERCEL_AUTOMATION_BYPASS_SECRET…`).
1701
+ * Where an error came from: `handle`, raised by the handle on this machine (no Vercel login,
1702
+ * Deployment Protection), or `board`, a board's answer, whose words are its own whatever code it
1703
+ * names.
1704
+ */
1705
+ type ErrorOrigin = 'handle' | 'board';
1706
+ /**
1707
+ * What went wrong: `message` says what and why, `code` is what to branch on, `hint`, when there's
1708
+ * one, what fixes it, and `origin` who said so. Trust a `board` one's message and hint as you would
1709
+ * the board.
1704
1710
  */
1705
1711
  declare class BoardError extends Error {
1706
1712
  readonly code: string;
1707
1713
  readonly status: number;
1708
1714
  readonly hint: string | undefined;
1715
+ readonly origin: ErrorOrigin;
1709
1716
  constructor(code: string, message: string, status: number, options?: {
1710
1717
  hint?: string;
1718
+ origin?: ErrorOrigin;
1711
1719
  });
1712
1720
  }
1713
1721
  type Resolvable<T> = T | (() => T | Promise<T>);
@@ -1994,688 +2002,4 @@ declare function createBoardClient(options: ClientOptions): {
1994
2002
  }, opts?: WaitOptions): Promise<BoardEventView | null>;
1995
2003
  };
1996
2004
  //#endregion
1997
- //#region src/sync/events.d.ts
1998
- declare const EventBase: z.ZodObject<{
1999
- channel: z.ZodString;
2000
- thread: z.ZodString;
2001
- subthread: z.ZodNullable<z.ZodString>;
2002
- id: z.ZodString;
2003
- platform: z.ZodString;
2004
- key: z.ZodString;
2005
- raw: z.ZodUnknown;
2006
- }, z.core.$strip>;
2007
- type EventBase<P extends string = string> = Omit<z.infer<typeof EventBase>, 'platform'> & {
2008
- platform: P;
2009
- };
2010
- type ProviderEvent = EventBase & ExternalEvent & {
2011
- type: string;
2012
- };
2013
- declare function envelope(platform: string, key: string, event: ExternalEvent, raw: unknown, id: string): {
2014
- channel: string;
2015
- thread: string;
2016
- subthread: string | null;
2017
- kind: "message";
2018
- message: string;
2019
- isRoot: boolean;
2020
- text: string;
2021
- context: string | null;
2022
- author: {
2023
- id: string;
2024
- handle: string;
2025
- name: string;
2026
- avatar: string | null;
2027
- isBot: boolean;
2028
- };
2029
- files?: {
2030
- type: "audio" | "file" | "image" | "video";
2031
- name?: string | undefined;
2032
- mimeType?: string | undefined;
2033
- size?: number | undefined;
2034
- url?: string | undefined;
2035
- fetchMetadata?: Record<string, string> | undefined;
2036
- }[] | undefined;
2037
- links?: {
2038
- url: string;
2039
- thread: string;
2040
- message: string;
2041
- snapshot: {
2042
- author: string;
2043
- text: string;
2044
- createdAt: string | null;
2045
- files: {
2046
- name: string;
2047
- url: string | null;
2048
- }[];
2049
- } | null;
2050
- }[] | undefined;
2051
- id: string;
2052
- platform: string;
2053
- key: string;
2054
- raw: unknown;
2055
- type: string;
2056
- } | {
2057
- channel: string;
2058
- thread: string;
2059
- subthread: string | null;
2060
- kind: "edited";
2061
- message: string;
2062
- text: string;
2063
- author: {
2064
- id: string;
2065
- handle: string;
2066
- name: string;
2067
- avatar: string | null;
2068
- isBot: boolean;
2069
- };
2070
- links?: {
2071
- url: string;
2072
- thread: string;
2073
- message: string;
2074
- snapshot: {
2075
- author: string;
2076
- text: string;
2077
- createdAt: string | null;
2078
- files: {
2079
- name: string;
2080
- url: string | null;
2081
- }[];
2082
- } | null;
2083
- }[] | undefined;
2084
- linksOnly?: boolean | undefined;
2085
- id: string;
2086
- platform: string;
2087
- key: string;
2088
- raw: unknown;
2089
- type: string;
2090
- } | {
2091
- channel: string;
2092
- thread: string;
2093
- subthread: string | null;
2094
- kind: "deleted";
2095
- message: string;
2096
- id: string;
2097
- platform: string;
2098
- key: string;
2099
- raw: unknown;
2100
- type: string;
2101
- } | {
2102
- channel: string;
2103
- thread: string;
2104
- subthread: string | null;
2105
- kind: "reaction";
2106
- message: string;
2107
- emoji: string;
2108
- added: boolean;
2109
- author: {
2110
- id: string;
2111
- handle: string;
2112
- name: string;
2113
- avatar: string | null;
2114
- isBot: boolean;
2115
- };
2116
- id: string;
2117
- platform: string;
2118
- key: string;
2119
- raw: unknown;
2120
- type: string;
2121
- } | {
2122
- channel: string;
2123
- thread: string;
2124
- subthread: string | null;
2125
- kind: "lifecycle";
2126
- title: string;
2127
- url: string | null;
2128
- labels: Record<string, string>;
2129
- unset: string[];
2130
- owns?: string[] | undefined;
2131
- reply: string | null;
2132
- createRoot: boolean;
2133
- retitled?: boolean | undefined;
2134
- author: {
2135
- id: string;
2136
- handle: string;
2137
- name: string;
2138
- avatar: string | null;
2139
- isBot: boolean;
2140
- };
2141
- id: string;
2142
- platform: string;
2143
- key: string;
2144
- raw: unknown;
2145
- type: string;
2146
- };
2147
- declare function eventSchema<P extends string, M extends string>(platform: P, messageType: M): z.ZodDiscriminatedUnion<[z.ZodObject<{
2148
- channel: z.ZodString;
2149
- thread: z.ZodString;
2150
- subthread: z.ZodNullable<z.ZodString>;
2151
- kind: z.ZodLiteral<"message">;
2152
- message: z.ZodString;
2153
- isRoot: z.ZodBoolean;
2154
- text: z.ZodString;
2155
- context: z.ZodNullable<z.ZodString>;
2156
- author: z.ZodObject<{
2157
- id: z.ZodString;
2158
- handle: z.ZodString;
2159
- name: z.ZodString;
2160
- avatar: z.ZodNullable<z.ZodString>;
2161
- isBot: z.ZodBoolean;
2162
- }, z.core.$strip>;
2163
- files: z.ZodOptional<z.ZodArray<z.ZodObject<{
2164
- type: z.ZodEnum<{
2165
- audio: "audio";
2166
- file: "file";
2167
- image: "image";
2168
- video: "video";
2169
- }>;
2170
- name: z.ZodOptional<z.ZodString>;
2171
- mimeType: z.ZodOptional<z.ZodString>;
2172
- size: z.ZodOptional<z.ZodNumber>;
2173
- url: z.ZodOptional<z.ZodString>;
2174
- fetchMetadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2175
- }, z.core.$strip>>>;
2176
- links: z.ZodOptional<z.ZodArray<z.ZodObject<{
2177
- url: z.ZodString;
2178
- thread: z.ZodString;
2179
- message: z.ZodString;
2180
- snapshot: z.ZodNullable<z.ZodObject<{
2181
- author: z.ZodString;
2182
- text: z.ZodString;
2183
- createdAt: z.ZodNullable<z.ZodString>;
2184
- files: z.ZodArray<z.ZodObject<{
2185
- name: z.ZodString;
2186
- url: z.ZodNullable<z.ZodString>;
2187
- }, z.core.$strip>>;
2188
- }, z.core.$strip>>;
2189
- }, z.core.$strip>>>;
2190
- id: z.ZodString;
2191
- key: z.ZodString;
2192
- raw: z.ZodUnknown;
2193
- platform: z.ZodLiteral<P>;
2194
- type: z.ZodLiteral<M>;
2195
- }, z.core.$strip>, z.ZodObject<{
2196
- channel: z.ZodString;
2197
- thread: z.ZodString;
2198
- subthread: z.ZodNullable<z.ZodString>;
2199
- kind: z.ZodLiteral<"edited">;
2200
- message: z.ZodString;
2201
- text: z.ZodString;
2202
- author: z.ZodObject<{
2203
- id: z.ZodString;
2204
- handle: z.ZodString;
2205
- name: z.ZodString;
2206
- avatar: z.ZodNullable<z.ZodString>;
2207
- isBot: z.ZodBoolean;
2208
- }, z.core.$strip>;
2209
- links: z.ZodOptional<z.ZodArray<z.ZodObject<{
2210
- url: z.ZodString;
2211
- thread: z.ZodString;
2212
- message: z.ZodString;
2213
- snapshot: z.ZodNullable<z.ZodObject<{
2214
- author: z.ZodString;
2215
- text: z.ZodString;
2216
- createdAt: z.ZodNullable<z.ZodString>;
2217
- files: z.ZodArray<z.ZodObject<{
2218
- name: z.ZodString;
2219
- url: z.ZodNullable<z.ZodString>;
2220
- }, z.core.$strip>>;
2221
- }, z.core.$strip>>;
2222
- }, z.core.$strip>>>;
2223
- linksOnly: z.ZodOptional<z.ZodBoolean>;
2224
- id: z.ZodString;
2225
- key: z.ZodString;
2226
- raw: z.ZodUnknown;
2227
- platform: z.ZodLiteral<P>;
2228
- type: z.ZodLiteral<"message.edited">;
2229
- }, z.core.$strip>, z.ZodObject<{
2230
- channel: z.ZodString;
2231
- thread: z.ZodString;
2232
- subthread: z.ZodNullable<z.ZodString>;
2233
- kind: z.ZodLiteral<"deleted">;
2234
- message: z.ZodString;
2235
- id: z.ZodString;
2236
- key: z.ZodString;
2237
- raw: z.ZodUnknown;
2238
- platform: z.ZodLiteral<P>;
2239
- type: z.ZodLiteral<"message.deleted">;
2240
- }, z.core.$strip>, z.ZodObject<{
2241
- channel: z.ZodString;
2242
- thread: z.ZodString;
2243
- subthread: z.ZodNullable<z.ZodString>;
2244
- kind: z.ZodLiteral<"reaction">;
2245
- message: z.ZodString;
2246
- emoji: z.ZodString;
2247
- added: z.ZodBoolean;
2248
- author: z.ZodObject<{
2249
- id: z.ZodString;
2250
- handle: z.ZodString;
2251
- name: z.ZodString;
2252
- avatar: z.ZodNullable<z.ZodString>;
2253
- isBot: z.ZodBoolean;
2254
- }, z.core.$strip>;
2255
- id: z.ZodString;
2256
- key: z.ZodString;
2257
- raw: z.ZodUnknown;
2258
- platform: z.ZodLiteral<P>;
2259
- type: z.ZodEnum<{
2260
- "reaction.added": "reaction.added";
2261
- "reaction.removed": "reaction.removed";
2262
- }>;
2263
- }, z.core.$strip>, z.ZodObject<{
2264
- channel: z.ZodString;
2265
- thread: z.ZodString;
2266
- subthread: z.ZodNullable<z.ZodString>;
2267
- kind: z.ZodLiteral<"lifecycle">;
2268
- type: z.ZodString;
2269
- title: z.ZodString;
2270
- url: z.ZodNullable<z.ZodString>;
2271
- labels: z.ZodRecord<z.ZodString, z.ZodString>;
2272
- unset: z.ZodArray<z.ZodString>;
2273
- owns: z.ZodOptional<z.ZodArray<z.ZodString>>;
2274
- reply: z.ZodNullable<z.ZodString>;
2275
- createRoot: z.ZodBoolean;
2276
- retitled: z.ZodOptional<z.ZodBoolean>;
2277
- author: z.ZodObject<{
2278
- id: z.ZodString;
2279
- handle: z.ZodString;
2280
- name: z.ZodString;
2281
- avatar: z.ZodNullable<z.ZodString>;
2282
- isBot: z.ZodBoolean;
2283
- }, z.core.$strip>;
2284
- id: z.ZodString;
2285
- key: z.ZodString;
2286
- raw: z.ZodUnknown;
2287
- platform: z.ZodLiteral<P>;
2288
- }, z.core.$strip>], "kind">;
2289
- type SyncRoot = {
2290
- text: string;
2291
- labels: Record<string, string>;
2292
- author: ExternalAuthor;
2293
- raw: unknown;
2294
- };
2295
- type RootOverride = (root: Readonly<SyncRoot>) => {
2296
- text?: string;
2297
- labels?: Record<string, string>;
2298
- };
2299
- declare const SyncOverrides: z.ZodObject<{
2300
- root: z.ZodOptional<z.ZodCustom<RootOverride, RootOverride>>;
2301
- text: z.ZodOptional<z.ZodString>;
2302
- labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2303
- unset: z.ZodOptional<z.ZodArray<z.ZodString>>;
2304
- noSync: z.ZodOptional<z.ZodBoolean>;
2305
- }, z.core.$strict>;
2306
- type SyncOverrides = z.infer<typeof SyncOverrides>;
2307
- /** What an import made: its thread's root and the message, as IDs clients pass back as they got them. */
2308
- type SyncResult = {
2309
- root: string | null;
2310
- message: string | null;
2311
- };
2312
- //#endregion
2313
- //#region src/sync/fn.d.ts
2314
- /** An event coming in from the platform. */
2315
- type SyncIn<E extends ProviderEvent = ProviderEvent> = {
2316
- direction: 'in';
2317
- /** The sync entry's key: `slack` in `sync: { slack: slack(…) }`. */
2318
- key: string;
2319
- /** The platform channel it happened in, as the platform names it: `C0123ABC`, `owner/repo:pulls`, a phone number ID. */
2320
- channel: string;
2321
- /** The event, validated and frozen. */
2322
- event: E;
2323
- /** The board, as the platform user the event came from: its writes are theirs. */
2324
- board: BoardClient;
2325
- /**
2326
- * Imports the event: into its board thread when the board syncs its platform thread, otherwise
2327
- * as a new root in `channel`. Without a channel, an event in a thread the board doesn't sync
2328
- * stays off it. Runs once: a second call answers what the first did.
2329
- */
2330
- import(channel?: string, overrides?: SyncOverrides): Promise<SyncResult>;
2331
- /** The platform's own link to the event's message, or null when it has none. Nothing is synced or joined. */
2332
- permalink(): Promise<string | null>;
2333
- /** A platform channel's ID from its name (`#dev` → `C0123ABC`), as `channel` names it. */
2334
- resolve(name: string): Promise<string>;
2335
- };
2336
- /** A board event going out to the platform. */
2337
- type SyncOut = {
2338
- direction: 'out';
2339
- key: string;
2340
- /** The platform channel `target` is in, as the platform names it; null for a new root, which isn't on the platform yet. */
2341
- channel: string | null;
2342
- event: BoardEventView;
2343
- /** The message the event is about, as it is now. */
2344
- message: MessageView;
2345
- /** Where it goes: a platform thread or channel the board thread syncs with (`slack:C0123ABC:1727000000.123456`), or null for a new root. */
2346
- target: string | null;
2347
- /**
2348
- * Sends the event to `target`: a new thread's root and what's been said in it, a reply, an
2349
- * edit, a delete, a reaction, or the copy a label change re-renders. A new root has no target
2350
- * yet, so it sends nothing. Runs once: a second call answers what the first did.
2351
- */
2352
- deliver(options?: {
2353
- render?: Renderer;
2354
- }): Promise<void>;
2355
- /**
2356
- * Syncs the message's thread with a platform channel (`#dev`, `C0123ABC`): the board starts a
2357
- * thread there, and its root and replies follow. Never the channel it came from.
2358
- */
2359
- start(channel: string): Promise<void>;
2360
- resolve(name: string): Promise<string>;
2361
- };
2362
- type Sync<E extends ProviderEvent = ProviderEvent> = SyncIn<E> | SyncOut;
2363
- /**
2364
- * What every event does, both ways. Inbound, it calls `import` to bring the event onto the board;
2365
- * outbound, `deliver` to send it to the platform, or `start` to open a new root's thread there.
2366
- * One that calls neither does nothing. A throw is retried.
2367
- *
2368
- * The webhook keeps an event (stores it in the inbox for the function) when the board syncs its
2369
- * thread, or when its channel is one that `channels`, `repos`, or `numbers` routes. A function of
2370
- * your own at the top keeps every event the platform sends, so keep the helper outermost.
2371
- */
2372
- type SyncFn<E extends ProviderEvent = ProviderEvent> = (sync: Sync<E>) => unknown;
2373
- /** A sync function, or a board channel: what a string means is up to the helper that takes it. */
2374
- type SyncUnit<E extends ProviderEvent = ProviderEvent> = string | SyncFn<E>;
2375
- /**
2376
- * A two-way mirror of a board channel: what comes in lands in `channel`, what's said on the
2377
- * board goes out, and a new root in `channel` starts a thread in the platform channel.
2378
- */
2379
- declare function mirror(channel: string): SyncFn;
2380
- /** Imports into a board channel, and sends nothing back. */
2381
- declare function into(channel: string): SyncFn;
2382
- /** `inner`, delivering with `renderer` unless it passes its own. */
2383
- declare function render<E extends ProviderEvent = ProviderEvent>(renderer: Renderer, inner: SyncFn<E>): SyncFn<E>;
2384
- /**
2385
- * Routes each event by its platform channel. Keys are platform channels, by name (`'#dev'`) or
2386
- * ID (`'C0123ABC'`); values are a board channel to `mirror`, or a sync function. A new root goes
2387
- * to every channel's function, with `channel` set to that one. A thread the board syncs outside
2388
- * these channels (someone ran `vb sync` on it) stays synced both ways. A key the platform says
2389
- * doesn't exist is skipped. While one can't be checked, an event outside the resolved channels
2390
- * throws, so it's retried, rather than going past that key's function to the default. A new root
2391
- * starts only in the channels that resolved.
2392
- */
2393
- declare function channels<E extends ProviderEvent = ProviderEvent>(map: Record<string, SyncUnit<E>>): SyncFn<E>;
2394
- //#endregion
2395
- //#region src/sync/users.d.ts
2396
- /**
2397
- * People's own platform tokens, so a board message they wrote reaches Slack or
2398
- * GitHub as them, and signing in proves an account is theirs. The board never
2399
- * stores a token: it asks for one at each delivery, and a person without one
2400
- * (never signed in, revoked, expired) is delivered as the bot, as before.
2401
- */
2402
- type UserTokens = {
2403
- /**
2404
- * A sign-in URL that binds whoever completes it to `principal`. Show it only to them. With
2405
- * `callback`, the platform sends them there once they've approved.
2406
- */
2407
- authorize(principal: string, options?: {
2408
- callback?: string;
2409
- }): Promise<string>;
2410
- /** `principal`'s token on the platform, or null when they haven't signed in. */
2411
- token(principal: string): Promise<string | null>;
2412
- };
2413
- /**
2414
- * Gives an adapter people's tokens, for your own OAuth: `slack({ adapter:
2415
- * withUserTokens(createSlackAdapter(...), { authorize, token }) }, sync)`. A
2416
- * Connect connector name (`slack('slack/acme', sync)`) does this for you.
2417
- */
2418
- declare function withUserTokens<A extends object>(adapter: A, tokens: UserTokens): A;
2419
- /** Vercel Connect's user tokens for `connector`: the subject is the board's principal, so Connect binds the account to it. */
2420
- declare function connectUserTokens(connector: string): UserTokens;
2421
- //#endregion
2422
- //#region src/sync/provider.d.ts
2423
- declare const ResolvedTarget: z.ZodObject<{
2424
- target: z.ZodString;
2425
- channel: z.ZodString;
2426
- kind: z.ZodEnum<{
2427
- channel: "channel";
2428
- thread: "thread";
2429
- }>;
2430
- }, z.core.$strict>;
2431
- type ResolvedTarget = z.infer<typeof ResolvedTarget>;
2432
- /** The fields a provider's `event` builds its typed event from. */
2433
- type SyncContext = {
2434
- id: string;
2435
- key: string;
2436
- event: ExternalEvent;
2437
- raw: unknown;
2438
- };
2439
- type RenderInput = {
2440
- /** The message as clients see it: its IDs are refs. */
2441
- message: Readonly<MessageView>;
2442
- author: Readonly<Actor> | null;
2443
- /** How this platform mentions an actor, through linked accounts; null when it can't. */
2444
- mentionOf: (actor: string) => string | null;
2445
- label: string;
2446
- target: string;
2447
- };
2448
- /** How a platform shows a board message: markdown, which the platform converts to its own format. */
2449
- type Renderer = (input: RenderInput) => string;
2450
- type FileDelivery = {
2451
- message: string;
2452
- files: string[];
2453
- };
2454
- /** What a linked message said, or why the platform wouldn't say. */
2455
- type FetchedLink = Pick<Link, 'snapshot' | 'unavailable'>;
2456
- /** Why a platform wouldn't read a channel or thread on demand. Its message is shown as is. */
2457
- declare class UnreadableError extends Error {
2458
- readonly code: string;
2459
- constructor(code: string, message: string);
2460
- }
2461
- /** A file to send: its bytes (a Node `Buffer` is one), its name, and its type. */
2462
- type ProviderFile = {
2463
- data: Uint8Array;
2464
- filename: string;
2465
- mimeType?: string;
2466
- };
2467
- /**
2468
- * Who a post is from, for a platform that can show it as the sender (Slack's per-message
2469
- * username and icon): `name` is the label the text opens with (`**name**: …`).
2470
- */
2471
- type ProviderSender = {
2472
- name: string;
2473
- avatar: string | null;
2474
- };
2475
- type ProviderPost = {
2476
- markdown: string;
2477
- files?: ProviderFile[];
2478
- as?: ProviderSender;
2479
- };
2480
- type ProviderDelivery = {
2481
- thread: string;
2482
- message: string;
2483
- files?: string[];
2484
- };
2485
- type ProviderOptions = {
2486
- platform: string;
2487
- canStartThreads?: boolean;
2488
- singleReaction?: boolean;
2489
- uploadsFiles?: boolean;
2490
- /** People's own tokens, to post as them and to link accounts by signing in. */
2491
- users?: UserTokens | null;
2492
- };
2493
- declare const ReceivedEvent: z.ZodObject<{
2494
- event: z.ZodDiscriminatedUnion<[z.ZodObject<{
2495
- channel: z.ZodString;
2496
- thread: z.ZodString;
2497
- subthread: z.ZodNullable<z.ZodString>;
2498
- kind: z.ZodLiteral<"message">;
2499
- message: z.ZodString;
2500
- isRoot: z.ZodBoolean;
2501
- text: z.ZodString;
2502
- context: z.ZodNullable<z.ZodString>;
2503
- author: z.ZodObject<{
2504
- id: z.ZodString;
2505
- handle: z.ZodString;
2506
- name: z.ZodString;
2507
- avatar: z.ZodNullable<z.ZodString>;
2508
- isBot: z.ZodBoolean;
2509
- }, z.core.$strip>;
2510
- files: z.ZodOptional<z.ZodArray<z.ZodObject<{
2511
- type: z.ZodEnum<{
2512
- audio: "audio";
2513
- file: "file";
2514
- image: "image";
2515
- video: "video";
2516
- }>;
2517
- name: z.ZodOptional<z.ZodString>;
2518
- mimeType: z.ZodOptional<z.ZodString>;
2519
- size: z.ZodOptional<z.ZodNumber>;
2520
- url: z.ZodOptional<z.ZodString>;
2521
- fetchMetadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2522
- }, z.core.$strip>>>;
2523
- links: z.ZodOptional<z.ZodArray<z.ZodObject<{
2524
- url: z.ZodString;
2525
- thread: z.ZodString;
2526
- message: z.ZodString;
2527
- snapshot: z.ZodNullable<z.ZodObject<{
2528
- author: z.ZodString;
2529
- text: z.ZodString;
2530
- createdAt: z.ZodNullable<z.ZodString>;
2531
- files: z.ZodArray<z.ZodObject<{
2532
- name: z.ZodString;
2533
- url: z.ZodNullable<z.ZodString>;
2534
- }, z.core.$strip>>;
2535
- }, z.core.$strip>>;
2536
- }, z.core.$strip>>>;
2537
- }, z.core.$strip>, z.ZodObject<{
2538
- channel: z.ZodString;
2539
- thread: z.ZodString;
2540
- subthread: z.ZodNullable<z.ZodString>;
2541
- kind: z.ZodLiteral<"edited">;
2542
- message: z.ZodString;
2543
- text: z.ZodString;
2544
- author: z.ZodObject<{
2545
- id: z.ZodString;
2546
- handle: z.ZodString;
2547
- name: z.ZodString;
2548
- avatar: z.ZodNullable<z.ZodString>;
2549
- isBot: z.ZodBoolean;
2550
- }, z.core.$strip>;
2551
- links: z.ZodOptional<z.ZodArray<z.ZodObject<{
2552
- url: z.ZodString;
2553
- thread: z.ZodString;
2554
- message: z.ZodString;
2555
- snapshot: z.ZodNullable<z.ZodObject<{
2556
- author: z.ZodString;
2557
- text: z.ZodString;
2558
- createdAt: z.ZodNullable<z.ZodString>;
2559
- files: z.ZodArray<z.ZodObject<{
2560
- name: z.ZodString;
2561
- url: z.ZodNullable<z.ZodString>;
2562
- }, z.core.$strip>>;
2563
- }, z.core.$strip>>;
2564
- }, z.core.$strip>>>;
2565
- linksOnly: z.ZodOptional<z.ZodBoolean>;
2566
- }, z.core.$strip>, z.ZodObject<{
2567
- channel: z.ZodString;
2568
- thread: z.ZodString;
2569
- subthread: z.ZodNullable<z.ZodString>;
2570
- kind: z.ZodLiteral<"deleted">;
2571
- message: z.ZodString;
2572
- }, z.core.$strip>, z.ZodObject<{
2573
- channel: z.ZodString;
2574
- thread: z.ZodString;
2575
- subthread: z.ZodNullable<z.ZodString>;
2576
- kind: z.ZodLiteral<"reaction">;
2577
- message: z.ZodString;
2578
- emoji: z.ZodString;
2579
- added: z.ZodBoolean;
2580
- author: z.ZodObject<{
2581
- id: z.ZodString;
2582
- handle: z.ZodString;
2583
- name: z.ZodString;
2584
- avatar: z.ZodNullable<z.ZodString>;
2585
- isBot: z.ZodBoolean;
2586
- }, z.core.$strip>;
2587
- }, z.core.$strip>, z.ZodObject<{
2588
- channel: z.ZodString;
2589
- thread: z.ZodString;
2590
- kind: z.ZodLiteral<"lifecycle">;
2591
- type: z.ZodString;
2592
- title: z.ZodString;
2593
- url: z.ZodNullable<z.ZodString>;
2594
- labels: z.ZodRecord<z.ZodString, z.ZodString>;
2595
- unset: z.ZodArray<z.ZodString>;
2596
- owns: z.ZodOptional<z.ZodArray<z.ZodString>>;
2597
- reply: z.ZodNullable<z.ZodString>;
2598
- createRoot: z.ZodBoolean;
2599
- retitled: z.ZodOptional<z.ZodBoolean>;
2600
- author: z.ZodObject<{
2601
- id: z.ZodString;
2602
- handle: z.ZodString;
2603
- name: z.ZodString;
2604
- avatar: z.ZodNullable<z.ZodString>;
2605
- isBot: z.ZodBoolean;
2606
- }, z.core.$strip>;
2607
- }, z.core.$strip>], "kind">;
2608
- raw: z.ZodUnknown;
2609
- dedupe: z.ZodString;
2610
- }, z.core.$strip>;
2611
- type ReceivedEvent = z.infer<typeof ReceivedEvent>;
2612
- type Receive = (received: ReceivedEvent) => Promise<void>;
2613
- declare abstract class SyncProvider<E extends ProviderEvent = ProviderEvent> {
2614
- readonly platform: string;
2615
- readonly canStartThreads: boolean;
2616
- readonly singleReaction: boolean;
2617
- readonly uploadsFiles: boolean;
2618
- private readonly fn;
2619
- /** People's tokens, when the adapter has them: messages they write post as them. */
2620
- readonly users: UserTokens | null;
2621
- protected readonly options: ProviderOptions;
2622
- constructor(options: ProviderOptions, sync: SyncFn<E>);
2623
- abstract receive(key: string, request: Request, emit: Receive): Promise<Response>;
2624
- abstract resolveChannel(key: string): Promise<string>;
2625
- abstract resolveTarget(target: string): Promise<ResolvedTarget>;
2626
- abstract post(target: string, kind: ResolvedTarget['kind'], body: ProviderPost): Promise<ProviderDelivery>;
2627
- /** The platform account a person's token belongs to. */
2628
- whoAmI(_token: string): Promise<ExternalAuthor>;
2629
- /** `post`, as the person whose token this is. */
2630
- postAs(_token: string, _target: string, _kind: ResolvedTarget['kind'], _body: ProviderPost): Promise<ProviderDelivery>;
2631
- editAs(_token: string, _thread: string, _message: string, _body: ProviderPost): Promise<void>;
2632
- deleteAs(_token: string, _thread: string, _message: string): Promise<void>;
2633
- findByEmail(_email: string): Promise<ExternalAuthor | null>;
2634
- mention(_actor: Actor): string | null;
2635
- fetchRoot(_thread: string): Promise<SyncRoot | null>;
2636
- fetchFile(_file: ExternalFile): Promise<Uint8Array | null>;
2637
- /** The platform's own link to an event's message, or null when it has none. */
2638
- permalink(_event: E): Promise<string | null>;
2639
- /** A linked message the platform didn't describe, read from the platform. */
2640
- fetchLink(_link: ExternalLink): Promise<FetchedLink>;
2641
- /**
2642
- * The message a URL of this platform's names, by its own thread and message IDs, or null for a
2643
- * URL that isn't one. `message` is null for a link to a thread itself. It asks the platform
2644
- * nothing: the board answers from what it synced (`vb read <url>`).
2645
- */
2646
- locate(_url: string): {
2647
- thread: string;
2648
- message: string | null;
2649
- } | null;
2650
- /** The platform's URL for one of its messages, by its own IDs, or null when it has none (`vb sync <id>`). */
2651
- url(_thread: string, _message: string): Promise<string | null>;
2652
- /**
2653
- * A channel or thread, read on demand for whoever asked: nothing is synced,
2654
- * stored, or joined. Throws `UnreadableError` for what it won't read.
2655
- */
2656
- read(_target: string, _options: {
2657
- limit: number;
2658
- }): Promise<SourceRead>;
2659
- /** Adds the board's app to a channel so `read` can read it, where the board opted in. Throws `UnreadableError` otherwise. */
2660
- join(_target: string): Promise<SourceJoin>;
2661
- edit(_thread: string, _message: string, _body: ProviderPost): Promise<void>;
2662
- delete(_thread: string, _message: string): Promise<void>;
2663
- react(_thread: string, _message: string, _emoji: string, _added: boolean): Promise<void>;
2664
- startTyping(_thread: string, _latest: string | null, _status?: string): Promise<void>;
2665
- /**
2666
- * The channel whose inbox a thread's events land in (`slack:C0123ABC` for `slack:C0123ABC:1727.1234`),
2667
- * worked out without calling the platform. Null when the provider can't tell: a key's inbox then
2668
- * lists only the mapped channels'.
2669
- */
2670
- inboxChannel(_key: string, _thread: string): string | null;
2671
- deleteFiles(_ids: string[]): Promise<void>;
2672
- refusesFiles(_error: unknown): boolean;
2673
- uploadFiles(_thread: string, _files: ProviderFile[]): Promise<FileDelivery>;
2674
- abstract event(context: SyncContext): E;
2675
- /** Runs the sync function the provider was made with: what every event does, both ways. */
2676
- sync(sync: Sync<E>): unknown;
2677
- /** The default rendering: `**${label}**: ${text}`. A `Renderer` passed to `deliver` replaces it. */
2678
- render(input: RenderInput): string;
2679
- }
2680
- //#endregion
2681
- export { Discovery as $, SyncCodeView as $t, SyncOverrides as A, Ref as At, ReplyOptions as B, SchedulesQuery as Bt, channels as C, MessagesQueryInput as Ct, EventBase as D, PostInput as Dt, render as E, PostBody as Et, BoardClient as F, RouteName as Ft, Written as G, SourceJoinBody as Gt, ScheduleTiming as H, SchedulesQueryOutput as Ht, BoardError as I, ScheduleBody as It, ActorView as J, SourceReadQuery as Jt, duration as K, SourceMessage as Kt, Filters as L, ScheduleBodyOutput as Lt, SyncRoot as M, RegisterInput as Mt, envelope as N, RegistrationView as Nt, ProviderEvent as O, REGISTERED_WATCHERS_MAX as Ot, eventSchema as P, ResolvedSyncTarget as Pt, DeleteBody as Q, SyncCodeBody as Qt, PostOptions as R, ScheduleInput as Rt, SyncUnit as S, routes as Sn, MessagesQuery as St, mirror as T, PersonView as Tt, UploadInput as U, SignInQuery as Ut, ScheduleOptions as V, SchedulesQueryInput as Vt, WaitOptions as W, SourceJoin as Wt, BoardEventView as X, SyncAccountInput as Xt, ApiError as Y, SyncAccountBody as Yt, ChannelView as Z, SyncBody as Zt, withUserTokens as _, ThreadsQueryInput as _n, MatchView as _t, ProviderOptions as a, SyncImportBody as an, IdentityUnlinkBody as at, SyncIn as b, UploadStartBody as bn, MessageView as bt, ReceivedEvent as c, SyncReceiptInput as cn, InboxEntry as ct, ResolvedTarget as d, SyncUnlinkBody as dn, InboxPushBody as dt, SyncCopiesQuery as en, EditBody as et, SyncContext as f, SyncedView as fn, InboxQuery as ft, connectUserTokens as g, ThreadsQuery as gn, LinkedQuery as gt, UserTokens as h, ThreadsPage as hn, LinkedAccount as ht, ProviderFile as i, SyncFindView as in, FiltersInput as it, SyncResult as j, RegisterBody as jt, RootOverride as k, ReactBody as kt, RenderInput as l, SyncRootsQuery as ln, InboxItem as lt, UnreadableError as m, ThreadView as mn, LinkView as mt, FileDelivery as n, SyncFindInput as nn, EventsQuery as nt, ProviderPost as o, SyncImportInput as on, IdentityView as ot, SyncProvider as p, ThreadSummaryView as pn, LabelBody as pt, AckBody as q, SourceRead as qt, ProviderDelivery as r, SyncFindQuery as rn, EventsQueryInput as rt, Receive as s, SyncReceiptBody as sn, InboxAckBody as st, FetchedLink as t, SyncCopiesView as tn, EventsPage as tt, Renderer as u, SyncThreadView as un, InboxNextQuery as ut, Sync as v, TypingBody as vn, MatchesQuery as vt, into as w, ParsedFilters as wt, SyncOut as x, UploadTicket as xn, MessagesPage as xt, SyncFn as y, TypingResult as yn, Me as yt, ProfileOption as z, ScheduleView as zt };
2005
+ export { RegisterInput as $, InboxItem as A, SyncRootsQuery as At, Me as B, TypingResult as Bt, EventsQuery as C, SyncFindInput as Ct, IdentityView as D, SyncImportInput as Dt, IdentityUnlinkBody as E, SyncImportBody as Et, LinkView as F, ThreadView as Ft, ParsedFilters as G, MessagesPage as H, UploadTicket as Ht, LinkedAccount as I, ThreadsPage as It, PostInput as J, PersonView as K, LinkedQuery as L, ThreadsQuery as Lt, InboxPushBody as M, SyncUnlinkBody as Mt, InboxQuery as N, SyncedView as Nt, InboxAckBody as O, SyncReceiptBody as Ot, LabelBody as P, ThreadSummaryView as Pt, RegisterBody as Q, MatchView as R, ThreadsQueryInput as Rt, EventsPage as S, SyncCopiesView as St, FiltersInput as T, SyncFindView as Tt, MessagesQuery as U, routes as Ut, MessageView as V, UploadStartBody as Vt, MessagesQueryInput as W, ReactBody as X, REGISTERED_WATCHERS_MAX as Y, Ref as Z, BoardEventView as _, SyncAccountInput as _t, PostOptions as a, ScheduleInput as at, Discovery as b, SyncCodeView as bt, ScheduleOptions as c, SchedulesQueryInput as ct, WaitOptions as d, SourceJoin as dt, RegistrationView as et, Written as f, SourceJoinBody as ft, ApiError as g, SyncAccountBody as gt, ActorView as h, SourceReadQuery as ht, Filters as i, ScheduleBodyOutput as it, InboxNextQuery as j, SyncThreadView as jt, InboxEntry as k, SyncReceiptInput as kt, ScheduleTiming as l, SchedulesQueryOutput as lt, AckBody as m, SourceRead as mt, BoardError as n, RouteName as nt, ProfileOption as o, ScheduleView as ot, duration as p, SourceMessage as pt, PostBody as q, ErrorOrigin as r, ScheduleBody as rt, ReplyOptions as s, SchedulesQuery as st, BoardClient as t, ResolvedSyncTarget as tt, UploadInput as u, SignInQuery as ut, ChannelView as v, SyncBody as vt, EventsQueryInput as w, SyncFindQuery as wt, EditBody as x, SyncCopiesQuery as xt, DeleteBody as y, SyncCodeBody as yt, MatchesQuery as z, TypingBody as zt };