@vercel/board 0.28.0 → 0.30.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/dist/{a2-B0_VlbtC.mjs → a2-D_28Pdip.mjs} +197 -259
- package/dist/access-CQ39gqEV.mjs +226 -0
- package/dist/access.d.mts +1 -1
- package/dist/access.mjs +3 -3
- package/dist/{actors-BLXVp4oZ.mjs → actors-xPiamLWk.mjs} +3 -3
- package/dist/{auth-lTkOgvcE.mjs → auth-BPinwfN0.mjs} +3 -226
- package/dist/backend-a2/blob-vercel.d.mts +1 -1
- package/dist/backend-a2/contract.d.mts +2 -2
- package/dist/backend-a2/contract.mjs +3 -3
- 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 +3 -3
- package/dist/backend-a2/scheduler-qstash.mjs +8 -8
- package/dist/backend-a2/scheduler-vercel.d.mts +3 -3
- package/dist/backend-a2/scheduler-vercel.mjs +6 -6
- 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 +34 -15
- package/dist/backend-a2/store-redis-http.d.mts +1 -1
- package/dist/backend-a2/store-redis-http.mjs +6 -6
- package/dist/backend-a2/store-redis.d.mts +2 -2
- package/dist/backend-a2/store-redis.mjs +5 -5
- 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 +20 -7
- package/dist/backend-a2.mjs +2 -1
- package/dist/{backend-http-BvNFrvcY.mjs → backend-http-16SbvnAK.mjs} +2 -2
- package/dist/{backend-http-E7YU0qhn.d.mts → backend-http-3PoBYQoo.d.mts} +15 -3
- package/dist/{backend-http-CfLVYqmj.mjs → backend-http-BPaNYLWj.mjs} +4 -5
- 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/{backend-ZKYTe3xa.d.mts → backend-n3hajfrD.d.mts} +12 -6
- package/dist/{backend-vercel-D87pIp2k.mjs → backend-vercel-C4Kee2-K.mjs} +260 -30
- package/dist/{backend-vercel-DTrDiSk5.mjs → backend-vercel-Kd8nvW5A.mjs} +3 -3
- package/dist/{backend-vercel-CIRObA0t.d.mts → backend-vercel-qznuDxnN.d.mts} +20 -5
- package/dist/backend-vercel.d.mts +1 -1
- package/dist/backend-vercel.mjs +1 -1
- package/dist/backend-vercel.node.d.mts +1 -1
- package/dist/backend-vercel.node.mjs +1 -1
- package/dist/{blob-B-9AvYis.d.mts → blob-CqILvdmr.d.mts} +2 -2
- package/dist/blob-DQK5prXT.mjs +182 -0
- package/dist/{chat-provider-DnHibqnM.mjs → chat-provider-COtsU5jB.mjs} +2 -2
- package/dist/{chat-provider-DsNEBQiA.d.mts → chat-provider-D6jVT4wS.d.mts} +5 -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 +1 -1
- package/dist/cli.mjs +5 -5
- package/dist/{client-xLxeDz0f.d.mts → client-CjAatpV4.d.mts} +67 -10
- package/dist/{commands-BFookFtn.mjs → commands-B5DHjZKK.mjs} +54 -10
- package/dist/{commands-D6gvrOh3.d.mts → commands-BtH69yqt.d.mts} +17 -0
- package/dist/{conformance-DlnfuzEB.mjs → conformance-C7fwIvmN.mjs} +258 -18
- package/dist/conformance.d.mts +1 -1
- package/dist/conformance.mjs +1 -1
- package/dist/{engine-Bfe6pcXb.mjs → engine-DkdkXQEy.mjs} +21 -13
- package/dist/{errors-CB4tnZGz.d.mts → errors-87TVtXeb.d.mts} +1 -1
- package/dist/{client-D0Px7KzF.mjs → errors-C_5rB8Iz.mjs} +104 -4
- package/dist/{events-CewD4kw7.mjs → events-qf5XG5VQ.mjs} +2 -2
- package/dist/{exports-CCzw2Vdw.mjs → exports-CG0P8Qi4.mjs} +59 -33
- package/dist/exports-CrGA5_yN.d.mts +5 -0
- package/dist/{external-BV_cUncs.mjs → external-D3p5T57R.mjs} +4 -2
- package/dist/{folds-jS9wlh9_.d.mts → folds-8wRRXjAt.d.mts} +4 -0
- package/dist/{folds-Dyjput8M.mjs → folds-DGYkMW19.mjs} +3 -2
- package/dist/{index-C05it0mC.d.mts → index-BygAXP7t.d.mts} +2 -2
- package/dist/index.d.mts +6 -6
- package/dist/{index.default-DmKxH_E6.mjs → index.default-DhkgpfR2.mjs} +1 -1
- package/dist/index.mjs +5 -6
- package/dist/index.node.d.mts +6 -6
- package/dist/index.node.mjs +3 -4
- package/dist/inspect/app.js +29 -29
- package/dist/inspect/engine.js +5 -5
- package/dist/{internal-CvsrprnU-CRY89I-b.mjs → internal-CvsrprnU-zZMpDiRY.mjs} +1 -1
- package/dist/{local-DhkrAqPP.mjs → local-C76Fy5ad.mjs} +1 -1
- package/dist/{main-eci7w-aP.mjs → main-D2s-QBOK.mjs} +76 -26
- package/dist/{middleware-ChKM1zuu.mjs → middleware-DlJQYiwV.mjs} +2 -2
- package/dist/{node-Zd_C-gxP.mjs → node-D8Rtg1su.mjs} +1 -1
- package/dist/{platform-B4TnJtWu-CwcTyKg2.mjs → platform-B4TnJtWu-Do3agKr5.mjs} +1 -1
- package/dist/{project-DMDST9kl.mjs → project-C_2xs57L.mjs} +1 -1
- package/dist/{provider-poIkXapd.mjs → provider-BaVmi4Hi.mjs} +3 -1
- package/dist/{provider-Cdg1qadh.d.mts → provider-Bm46LAdp.d.mts} +9 -2
- package/dist/{redis-tables-DN9PfIDi.mjs → redis-tables-BWJZHUGg.mjs} +41 -25
- package/dist/{reducer-CjmvZSAb-D_OSISmj.mjs → reducer-Bswr11ar-P324o9vn.mjs} +2 -2
- package/dist/{reducer-CYPHsSmd-BQIfozGi.d.mts → reducer-CYPHsSmd-BXjGiptm.d.mts} +1 -1
- package/dist/{reducers-BcmSs4qf.mjs → reducers-8jqLewgw.mjs} +5 -5
- package/dist/{retryable-lazy-DZWmHpii-Bye-W8q7.mjs → retryable-lazy-DZWmHpii-DpTc5PIP.mjs} +1 -1
- package/dist/{scheduler-task-X1SToDjP-BVoWuInI.mjs → scheduler-task-X1SToDjP-D2Il2rln.mjs} +1 -1
- package/dist/{schemas-Be08nyfW.mjs → schemas-DBmUO6pr.mjs} +2 -1
- package/dist/{serve-B09an9DQ.mjs → serve-lPoBDEds.mjs} +7 -6
- package/dist/{server-qgez0Xny-D5mLfqFQ.d.mts → server-B9gu0qi1-DI1WvcVK.d.mts} +10 -4
- package/dist/{server-DTX0prGr.mjs → server-D82a4uMe.mjs} +4 -4
- package/dist/{server-DtFrWxi3-Boa6gdWO.mjs → server-DX7mM6nm-D7N_7bug.mjs} +32 -23
- package/dist/{serving-CvOWEym2.mjs → serving-DKny38LK.mjs} +1 -1
- package/dist/{session-clear-wHd5GCpZ-BnKSxReK.mjs → session-clear-XJYpmUpg-2q8l_FJR.mjs} +14 -2
- package/dist/{sql-U9WTxrwJ.mjs → sql-Bj0fk6dn.mjs} +2 -2
- package/dist/{sqlite-db-Ds4majtT.mjs → sqlite-db-Dc8G78XV.mjs} +1 -1
- package/dist/{store-D0MhBvg6-4Z2L0Kqd.d.mts → store-DEzcHZOA-B-5vhxef.d.mts} +12 -2
- package/dist/store-N8PXxDAS-DWWgv-Vz.mjs +5 -0
- package/dist/{store-codec-DwrWlgQx-CYxGW0aD.mjs → store-codec-pAG2oPgQ-SqDXlPBR.mjs} +4 -4
- package/dist/store-memory-4IBl0Ztu.mjs +2 -0
- package/dist/{store-memory-Bas9Uq5C.mjs → store-memory-B0PkVSuQ.mjs} +14 -7
- package/dist/{store-polling-BZt2Rf3D-BiEM6_HB.mjs → store-polling-BZt2Rf3D-Div-bJ_D.mjs} +2 -2
- package/dist/{store-presence-polling-JuAy2Ck2-CYpuK75X.mjs → store-presence-polling-JuAy2Ck2-Dh-g_KYM.mjs} +3 -3
- package/dist/{store-sqlite-CxxPCcCT.mjs → store-sqlite-D85t3tE7.mjs} +14 -7
- package/dist/store-sqlite-iBTYYKBj.mjs +2 -0
- package/dist/{stream-buffer-DrTyiIuo-BKy-vI14.mjs → stream-buffer-DrTyiIuo-Be10yOBR.mjs} +2 -2
- package/dist/sync-github.d.mts +4 -2
- package/dist/sync-github.mjs +4 -14
- package/dist/sync-kapso.d.mts +3 -2
- package/dist/sync-kapso.mjs +3 -3
- package/dist/sync-linear.d.mts +12 -2
- package/dist/sync-linear.mjs +191 -9
- package/dist/sync-slack.d.mts +41 -5
- package/dist/sync-slack.mjs +70 -11
- package/dist/sync.chat.d.mts +1 -1
- package/dist/sync.chat.mjs +1 -1
- package/dist/sync.d.mts +2 -2
- package/dist/sync.mjs +3 -3
- package/dist/tags-BpFo6q0_.mjs +14 -0
- package/dist/{targets-C-wdR5wP.mjs → targets-Cgjs29T0.mjs} +1 -1
- package/dist/{tokens-BuCU-61R.mjs → tokens-C5_yGRlL.mjs} +2 -2
- package/dist/{types-aCAf6lGU.d.mts → types-shZmGZ-q.d.mts} +2 -2
- package/dist/{watchers-hash-7DJU9b-n.mjs → watchers-hash-B_5b0-ZG.mjs} +50 -19
- package/docs/01-board/04-messages.md +93 -0
- package/docs/01-board/08-middleware.md +5 -2
- package/docs/02-sync/03-slack.md +6 -2
- package/docs/02-sync/07-linear.md +28 -6
- package/docs/04-reference/01-cli.md +27 -12
- package/docs/04-reference/02-board.md +20 -5
- package/docs/04-reference/03-http.md +17 -6
- package/docs/04-reference/05-conformance.md +14 -3
- package/package.json +2 -2
- package/dist/errors-CusN4x2l.mjs +0 -88
- package/dist/exports-D22M68rk.d.mts +0 -5
- package/dist/store-N8PXxDAS-BWBgzBHp.mjs +0 -5
- package/dist/store-memory-ZLiZbH3R.mjs +0 -2
- package/dist/store-sqlite-BmwL3pUR.mjs +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
//#region ../../node_modules/.pnpm/experimental-a2@0.
|
|
1
|
+
import { o as isSessionCleared } from "./session-clear-XJYpmUpg-2q8l_FJR.mjs";
|
|
2
|
+
//#region ../../node_modules/.pnpm/experimental-a2@0.24.0_@upstash+qstash@2.12.0_@vercel+queue@0.7.0_ai@7.0.130_zod@4.6.5__b1e2c243a963f2620a5d202817417c26/node_modules/experimental-a2/dist/reducer-Bswr11ar.js
|
|
3
3
|
/**
|
|
4
4
|
* Run a Standard Schema validator, requiring a synchronous result.
|
|
5
5
|
* Validators must be synchronous (specs/a2-api.md §1) — an async one is
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/experimental-a2@0.
|
|
1
|
+
//#region ../../node_modules/.pnpm/experimental-a2@0.24.0_@upstash+qstash@2.12.0_@vercel+queue@0.7.0_ai@7.0.130_zod@4.6.5__b1e2c243a963f2620a5d202817417c26/node_modules/experimental-a2/dist/reducer-CYPHsSmd.d.ts
|
|
2
2
|
//#region src/standard-schema.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* The Standard Schema interface, vendored per the spec's guidance
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { S as storable, _ as RemoteWatcherId, c as ChannelPath, d as LabelKey, g as MessageText, h as MessageId, i as Attachment, l as Emoji, n as ActorId, o as Author, p as Labels, u as Handle, v as SCOPE_MAX, y as SeenActorKind } from "./schemas-
|
|
2
|
-
import { a as Link, i as ExternalTarget, n as ExternalEvent, o as Origin } from "./external-
|
|
1
|
+
import { S as storable, _ as RemoteWatcherId, c as ChannelPath, d as LabelKey, g as MessageText, h as MessageId, i as Attachment, l as Emoji, n as ActorId, o as Author, p as Labels, u as Handle, v as SCOPE_MAX, y as SeenActorKind } from "./schemas-DBmUO6pr.mjs";
|
|
2
|
+
import { a as Link, i as ExternalTarget, n as ExternalEvent, o as Origin } from "./external-D3p5T57R.mjs";
|
|
3
3
|
import { n as setOwn, t as own } from "./own-OwgPWdmh.mjs";
|
|
4
|
-
import { a as reducer, i as makeReducerBuilder, t as assertSyncSchema } from "./reducer-
|
|
5
|
-
import { n as foldMessages, t as foldActors } from "./folds-
|
|
4
|
+
import { a as reducer, i as makeReducerBuilder, t as assertSyncSchema } from "./reducer-Bswr11ar-P324o9vn.mjs";
|
|
5
|
+
import { n as foldMessages, t as foldActors } from "./folds-DGYkMW19.mjs";
|
|
6
6
|
import { z } from "zod";
|
|
7
|
-
//#region ../../node_modules/.pnpm/experimental-a2@0.
|
|
7
|
+
//#region ../../node_modules/.pnpm/experimental-a2@0.24.0_@upstash+qstash@2.12.0_@vercel+queue@0.7.0_ai@7.0.130_zod@4.6.5__b1e2c243a963f2620a5d202817417c26/node_modules/experimental-a2/dist/contract-DqfBSIqJ.js
|
|
8
8
|
function contract(options) {
|
|
9
9
|
for (const type of Object.keys(options.events ?? {})) if (type.startsWith("a2.")) throw new TypeError(`contract '${String(options.name)}': event types starting with 'a2.' are reserved`);
|
|
10
10
|
return defineContract(options);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/experimental-a2@0.
|
|
1
|
+
//#region ../../node_modules/.pnpm/experimental-a2@0.24.0_@upstash+qstash@2.12.0_@vercel+queue@0.7.0_ai@7.0.130_zod@4.6.5__b1e2c243a963f2620a5d202817417c26/node_modules/experimental-a2/dist/retryable-lazy-DZWmHpii.js
|
|
2
2
|
const retryableLazy = (initialize) => {
|
|
3
3
|
let current = null;
|
|
4
4
|
const get = () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/experimental-a2@0.
|
|
1
|
+
//#region ../../node_modules/.pnpm/experimental-a2@0.24.0_@upstash+qstash@2.12.0_@vercel+queue@0.7.0_ai@7.0.130_zod@4.6.5__b1e2c243a963f2620a5d202817417c26/node_modules/experimental-a2/dist/scheduler-task-X1SToDjP.js
|
|
2
2
|
const recordOf = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
3
3
|
const validName = (value) => typeof value === "string" && value.length > 0;
|
|
4
4
|
const validDueAt = (value) => typeof value === "number" && Number.isInteger(value) && value % 1e3 === 0;
|
|
@@ -60,7 +60,8 @@ const Author = z.object({
|
|
|
60
60
|
session: z.string().nullable()
|
|
61
61
|
});
|
|
62
62
|
/** 128 random bits, base64url: an attachment is named by an ID nobody can guess. */
|
|
63
|
-
|
|
63
|
+
/** 128 random bits, base64url, as A2 makes them; or `att_` and a UUID, as Vercel's board does. */
|
|
64
|
+
const AttachmentId = z.string().regex(/^(?:[A-Za-z0-9_-]{22}|att_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$/, "invalid attachment id");
|
|
64
65
|
/** A file on a message. The board records `type` and `size` from what it stored, never from the request. */
|
|
65
66
|
const Attachment = z.object({
|
|
66
67
|
id: AttachmentId,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { s as localTokenFile } from "./node-
|
|
3
|
-
import { t as board } from "./server-
|
|
4
|
-
import { t as oidcTokens } from "./tokens-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { u as BoardError } from "./errors-C_5rB8Iz.mjs";
|
|
2
|
+
import { s as localTokenFile } from "./node-D8Rtg1su.mjs";
|
|
3
|
+
import { t as board } from "./server-D82a4uMe.mjs";
|
|
4
|
+
import { t as oidcTokens } from "./tokens-C5_yGRlL.mjs";
|
|
5
|
+
import { t as a2 } from "./a2-D_28Pdip.mjs";
|
|
6
|
+
import { a as fsBlob } from "./blob-DQK5prXT.mjs";
|
|
7
|
+
import { t as localScheduler } from "./local-C76Fy5ad.mjs";
|
|
7
8
|
import { mkdir, rm, writeFile } from "node:fs/promises";
|
|
8
9
|
import { userInfo } from "node:os";
|
|
9
10
|
import { dirname, join, resolve } from "node:path";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as PresenceDefs, c as PresenceSnapshot, d as WithPresence, i as EventDefs, l as Reducer, n as Contract, o as PresenceMap, r as ContractEvent, s as PresencePatch, t as AppendInput, u as RegisteredReducer } from "./reducer-CYPHsSmd-
|
|
2
|
-
import { r as Event } from "./store-
|
|
3
|
-
//#region ../../node_modules/.pnpm/experimental-a2@0.
|
|
1
|
+
import { a as PresenceDefs, c as PresenceSnapshot, d as WithPresence, i as EventDefs, l as Reducer, n as Contract, o as PresenceMap, r as ContractEvent, s as PresencePatch, t as AppendInput, u as RegisteredReducer } from "./reducer-CYPHsSmd-BXjGiptm.mjs";
|
|
2
|
+
import { r as Event } from "./store-DEzcHZOA-B-5vhxef.mjs";
|
|
3
|
+
//#region ../../node_modules/.pnpm/experimental-a2@0.24.0_@upstash+qstash@2.12.0_@vercel+queue@0.7.0_ai@7.0.130_zod@4.6.5__b1e2c243a963f2620a5d202817417c26/node_modules/experimental-a2/dist/session-clear-vfonou9S.d.ts
|
|
4
4
|
//#region src/session-clear.d.ts
|
|
5
5
|
/** Reserved type of the marker a clear appends. */
|
|
6
6
|
declare const CLEAR_EVENT_TYPE = "a2.cleared";
|
|
@@ -10,7 +10,7 @@ type SessionCleared = Event & {
|
|
|
10
10
|
payload: null;
|
|
11
11
|
};
|
|
12
12
|
//#endregion
|
|
13
|
-
//#region ../../node_modules/.pnpm/experimental-a2@0.
|
|
13
|
+
//#region ../../node_modules/.pnpm/experimental-a2@0.24.0_@upstash+qstash@2.12.0_@vercel+queue@0.7.0_ai@7.0.130_zod@4.6.5__b1e2c243a963f2620a5d202817417c26/node_modules/experimental-a2/dist/server-B9gu0qi1.d.ts
|
|
14
14
|
//#region src/session-socket.d.ts
|
|
15
15
|
/**
|
|
16
16
|
* The structural socket `sessionsSocket` speaks against — satisfied
|
|
@@ -148,6 +148,12 @@ type SessionDispatch<D extends EventDefs> = (...events: AppendInput<D>[]) => Pro
|
|
|
148
148
|
type SessionAppend<D extends EventDefs> = SessionDispatch<D> & {
|
|
149
149
|
/** Commit, then hand pending work directly to configured scheduler. */
|
|
150
150
|
dispatch: SessionDispatch<D>;
|
|
151
|
+
/**
|
|
152
|
+
* Append only while `index` is the session's head, checked in the same
|
|
153
|
+
* atomic step as the write. Otherwise nothing is written and it throws
|
|
154
|
+
* `LAST_INDEX_MISMATCH`, with the head as `details.index`.
|
|
155
|
+
*/
|
|
156
|
+
ifLastIndex(index: number, ...events: AppendInput<D>[]): Promise<ContractEvent<D>[]>;
|
|
151
157
|
};
|
|
152
158
|
type ConsumerAppend<D extends EventDefs> = (name: string, ...events: AppendInput<D>[]) => Promise<ContractEvent<D>[]>;
|
|
153
159
|
type ScheduleDelay = `${number}${"ms" | "s" | "m" | "h" | "d"}`;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as createBoard } from "./exports-
|
|
2
|
-
import { t as http } from "./backend-http-
|
|
1
|
+
import { t as createBoard } from "./exports-CG0P8Qi4.mjs";
|
|
2
|
+
import { t as http } from "./backend-http-16SbvnAK.mjs";
|
|
3
3
|
//#region src/server/index.ts
|
|
4
4
|
/**
|
|
5
5
|
* The handle on a board. With a `backend`, the board lives there: `a2()` keeps it in this
|
|
@@ -9,8 +9,8 @@ import { t as http } from "./backend-http-BvNFrvcY.mjs";
|
|
|
9
9
|
function board(options = {}) {
|
|
10
10
|
return createBoard(options, {
|
|
11
11
|
http: () => http(),
|
|
12
|
-
sync: () => import("./engine-
|
|
13
|
-
serving: () => import("./serving-
|
|
12
|
+
sync: () => import("./engine-DkdkXQEy.mjs"),
|
|
13
|
+
serving: () => import("./serving-DKny38LK.mjs")
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
16
|
//#endregion
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as cloneInitial, o as validateSync, r as foldEvent } from "./reducer-
|
|
3
|
-
import { _ as serverInternals, a as RESERVED_PARTICIPANT_IDS, c as STREAM_TIMINGS, d as drainSettledHooks, f as failedPreviousAttempt, g as runtimeConsumers, h as runtimeConsumerFactory, m as nullProtoRecord, o as SOCKET_TIMINGS, p as markSchedulerSendFailure, r as POLL_TIMINGS, s as STATE_CACHE, t as DRAIN_TIMINGS, v as stateTailReaders } from "./internal-CvsrprnU-
|
|
4
|
-
import { a as takeBuffered, i as presenceTombstones, n as isSerializedEvent, r as parseSerializedEvent, t as bufferedEvents } from "./stream-buffer-DrTyiIuo-
|
|
5
|
-
import { i as streamActivities, n as defaultSleep, t as createStreamActivity } from "./store-polling-BZt2Rf3D-
|
|
6
|
-
import { r as platformWaitUntil, t as invocationDeadlineMs } from "./platform-B4TnJtWu-
|
|
7
|
-
import { t as retryableLazy } from "./retryable-lazy-DZWmHpii-
|
|
8
|
-
//#region ../../node_modules/.pnpm/experimental-a2@0.
|
|
1
|
+
import { c as sessionClearedError, i as asStoreUnavailable, o as isSessionCleared, r as NonRetriableError, t as A2Error } from "./session-clear-XJYpmUpg-2q8l_FJR.mjs";
|
|
2
|
+
import { n as cloneInitial, o as validateSync, r as foldEvent } from "./reducer-Bswr11ar-P324o9vn.mjs";
|
|
3
|
+
import { _ as serverInternals, a as RESERVED_PARTICIPANT_IDS, c as STREAM_TIMINGS, d as drainSettledHooks, f as failedPreviousAttempt, g as runtimeConsumers, h as runtimeConsumerFactory, m as nullProtoRecord, o as SOCKET_TIMINGS, p as markSchedulerSendFailure, r as POLL_TIMINGS, s as STATE_CACHE, t as DRAIN_TIMINGS, v as stateTailReaders } from "./internal-CvsrprnU-zZMpDiRY.mjs";
|
|
4
|
+
import { a as takeBuffered, i as presenceTombstones, n as isSerializedEvent, r as parseSerializedEvent, t as bufferedEvents } from "./stream-buffer-DrTyiIuo-Be10yOBR.mjs";
|
|
5
|
+
import { i as streamActivities, n as defaultSleep, t as createStreamActivity } from "./store-polling-BZt2Rf3D-Div-bJ_D.mjs";
|
|
6
|
+
import { r as platformWaitUntil, t as invocationDeadlineMs } from "./platform-B4TnJtWu-Do3agKr5.mjs";
|
|
7
|
+
import { t as retryableLazy } from "./retryable-lazy-DZWmHpii-DpTc5PIP.mjs";
|
|
8
|
+
//#region ../../node_modules/.pnpm/experimental-a2@0.24.0_@upstash+qstash@2.12.0_@vercel+queue@0.7.0_ai@7.0.130_zod@4.6.5__b1e2c243a963f2620a5d202817417c26/node_modules/experimental-a2/dist/reducer-runtime-DQwz_J59.js
|
|
9
9
|
const runtimeKey = Symbol("a2.reducerRuntime");
|
|
10
10
|
function encodeState(options) {
|
|
11
11
|
const storage = options.reducer[runtimeKey]?.storage;
|
|
@@ -16,7 +16,7 @@ function decodeState(options) {
|
|
|
16
16
|
return storage ? storage.decode(options.state) : options.state;
|
|
17
17
|
}
|
|
18
18
|
//#endregion
|
|
19
|
-
//#region ../../node_modules/.pnpm/experimental-a2@0.
|
|
19
|
+
//#region ../../node_modules/.pnpm/experimental-a2@0.24.0_@upstash+qstash@2.12.0_@vercel+queue@0.7.0_ai@7.0.130_zod@4.6.5__b1e2c243a963f2620a5d202817417c26/node_modules/experimental-a2/dist/bounded-cache-CPHWF-8h.js
|
|
20
20
|
function boundedCache({ maxEntries, maxBytes }) {
|
|
21
21
|
const entries = /* @__PURE__ */ new Map();
|
|
22
22
|
let total = 0;
|
|
@@ -54,7 +54,7 @@ function boundedCache({ maxEntries, maxBytes }) {
|
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
56
|
//#endregion
|
|
57
|
-
//#region ../../node_modules/.pnpm/experimental-a2@0.
|
|
57
|
+
//#region ../../node_modules/.pnpm/experimental-a2@0.24.0_@upstash+qstash@2.12.0_@vercel+queue@0.7.0_ai@7.0.130_zod@4.6.5__b1e2c243a963f2620a5d202817417c26/node_modules/experimental-a2/dist/wire-BFE9sIQf.js
|
|
58
58
|
/**
|
|
59
59
|
* The wire format shared by server.fetch and experimental-a2/client
|
|
60
60
|
* (browser side): events as JSON with ISO timestamps, and the A2Error
|
|
@@ -168,6 +168,7 @@ const ERROR_STATUS = {
|
|
|
168
168
|
PARTIAL_DUPLICATE_BATCH: 400,
|
|
169
169
|
SUPERSEDED_ATTEMPT: 409,
|
|
170
170
|
SESSION_CLEARED: 409,
|
|
171
|
+
LAST_INDEX_MISMATCH: 409,
|
|
171
172
|
CLAIM_EXPIRED: 409,
|
|
172
173
|
STORE_UNAVAILABLE: 503,
|
|
173
174
|
STORE_NOT_CONFIGURED: 500,
|
|
@@ -267,7 +268,7 @@ function socketUnsubscribedFor(options) {
|
|
|
267
268
|
});
|
|
268
269
|
}
|
|
269
270
|
//#endregion
|
|
270
|
-
//#region ../../node_modules/.pnpm/experimental-a2@0.
|
|
271
|
+
//#region ../../node_modules/.pnpm/experimental-a2@0.24.0_@upstash+qstash@2.12.0_@vercel+queue@0.7.0_ai@7.0.130_zod@4.6.5__b1e2c243a963f2620a5d202817417c26/node_modules/experimental-a2/dist/server-DX7mM6nm.js
|
|
271
272
|
/**
|
|
272
273
|
* The push envelope's trust boundary for `{ sessionId, events, presence? }`,
|
|
273
274
|
* shared verbatim by the HTTP
|
|
@@ -1522,7 +1523,7 @@ function currentSchedulerSlot(now) {
|
|
|
1522
1523
|
* it prefixes every storage key.
|
|
1523
1524
|
*/
|
|
1524
1525
|
const NS = "";
|
|
1525
|
-
const devDefaultStore = retryableLazy(() => import("./store-sqlite-
|
|
1526
|
+
const devDefaultStore = retryableLazy(() => import("./store-sqlite-iBTYYKBj.mjs").then((m) => m.sqlite()));
|
|
1526
1527
|
/** Waits for a scheduler arm for at most `schedulerArmTimeoutMs`. */
|
|
1527
1528
|
async function joinSchedulerArm(arm) {
|
|
1528
1529
|
let timeout = null;
|
|
@@ -1613,7 +1614,7 @@ function createServer(options) {
|
|
|
1613
1614
|
const error = () => new A2Error("STORE_NOT_CONFIGURED", `the server for '${name}' has no store configured and NODE_ENV is 'production' — pass an explicit store backend (e.g. postgres from 'experimental-a2/store-postgres')`);
|
|
1614
1615
|
if (process.env["NEXT_PHASE"] !== "phase-production-build") throw error();
|
|
1615
1616
|
makeStore = () => Promise.reject(error());
|
|
1616
|
-
} else makeStore = env === "test" ? () => import("./store-memory-
|
|
1617
|
+
} else makeStore = env === "test" ? () => import("./store-memory-4IBl0Ztu.mjs").then((m) => m.memory()) : devDefaultStore.get;
|
|
1617
1618
|
}
|
|
1618
1619
|
if (declaresPresence && !options.store) {
|
|
1619
1620
|
const inner = makeStore;
|
|
@@ -1815,7 +1816,7 @@ function createServer(options) {
|
|
|
1815
1816
|
* the drain it schedules is created in the append's active context —
|
|
1816
1817
|
* with a real tracer, causal work remains connected.
|
|
1817
1818
|
*/
|
|
1818
|
-
const appendCore = (sessionId, events, source, mode, onAppended, cause, generatedIds, requireDurableInitialArm = false,
|
|
1819
|
+
const appendCore = (sessionId, events, source, mode, onAppended, cause, generatedIds, requireDurableInitialArm = false, condition = {}) => telemetry.span("a2.append", {
|
|
1819
1820
|
"a2.contract": name,
|
|
1820
1821
|
"a2.session_id": sessionId,
|
|
1821
1822
|
"a2.append.source": source,
|
|
@@ -1836,7 +1837,7 @@ function createServer(options) {
|
|
|
1836
1837
|
try {
|
|
1837
1838
|
const result = await store.append(nsId(sessionId), validated, {
|
|
1838
1839
|
consumers: storeConsumers,
|
|
1839
|
-
...
|
|
1840
|
+
...condition
|
|
1840
1841
|
});
|
|
1841
1842
|
rows = result.events;
|
|
1842
1843
|
shouldHealSession = result.hasPending && !(source === "consumer" && !validated.some(startsWork));
|
|
@@ -2260,7 +2261,7 @@ function createServer(options) {
|
|
|
2260
2261
|
assertScheduleName(scheduleName);
|
|
2261
2262
|
if (clearOptions === null || typeof clearOptions !== "object") throw new TypeError("schedule.clear requires an ifLastIndex");
|
|
2262
2263
|
const { ifLastIndex, ...timing } = clearOptions;
|
|
2263
|
-
|
|
2264
|
+
assertIfLastIndex(ifLastIndex);
|
|
2264
2265
|
const dueAt = scheduleDueAt(timing, triggerCreatedAt ?? Date.now());
|
|
2265
2266
|
const store = await resolveStore();
|
|
2266
2267
|
if (!store.clear || !store.reclaim) throw new TypeError("session.schedule.clear requires a store that supports clearing");
|
|
@@ -2688,7 +2689,7 @@ function createServer(options) {
|
|
|
2688
2689
|
};
|
|
2689
2690
|
const clearSession = async (sessionId, clearOptions, attempt) => {
|
|
2690
2691
|
const ifLastIndex = clearOptions?.ifLastIndex;
|
|
2691
|
-
if (ifLastIndex !== void 0)
|
|
2692
|
+
if (ifLastIndex !== void 0) assertIfLastIndex(ifLastIndex);
|
|
2692
2693
|
const store = await resolveStore();
|
|
2693
2694
|
if (!store.clear || !store.reclaim) throw new TypeError("session.clear requires a store that supports clearing");
|
|
2694
2695
|
const ns = nsId(sessionId);
|
|
@@ -3424,14 +3425,22 @@ function createServer(options) {
|
|
|
3424
3425
|
...schedulerArm ? { schedulerArm } : {}
|
|
3425
3426
|
};
|
|
3426
3427
|
});
|
|
3427
|
-
const appendExternal = async (sessionId, mode, events, requireDurableInitialArm = false,
|
|
3428
|
-
return appendCore(sessionId, events, "external", mode, (_rows, watchdogDueAt) => scheduleDrain(sessionId, watchdogDueAt), void 0, void 0, requireDurableInitialArm,
|
|
3428
|
+
const appendExternal = async (sessionId, mode, events, requireDurableInitialArm = false, condition = {}) => {
|
|
3429
|
+
return appendCore(sessionId, events, "external", mode, (_rows, watchdogDueAt) => scheduleDrain(sessionId, watchdogDueAt), void 0, void 0, requireDurableInitialArm, condition);
|
|
3429
3430
|
};
|
|
3430
3431
|
const session = (id) => {
|
|
3431
3432
|
assertSessionId(id);
|
|
3432
3433
|
const appendInline = async (...events) => appendExternal(id, "inline", events);
|
|
3433
3434
|
const appendDispatch = async (...events) => appendExternal(id, "dispatch", events);
|
|
3434
|
-
const
|
|
3435
|
+
const appendIfLastIndex = async (index, ...events) => {
|
|
3436
|
+
assertIfLastIndex(index);
|
|
3437
|
+
if (events.length === 0) throw new TypeError("append.ifLastIndex requires at least one event");
|
|
3438
|
+
return appendExternal(id, "inline", events, false, { ifLastIndex: index });
|
|
3439
|
+
};
|
|
3440
|
+
const append = Object.assign(appendInline, {
|
|
3441
|
+
dispatch: appendDispatch,
|
|
3442
|
+
ifLastIndex: appendIfLastIndex
|
|
3443
|
+
});
|
|
3435
3444
|
return Object.assign(makeSession(id, append, null), {
|
|
3436
3445
|
deadLetters: () => listDeadLetters(id),
|
|
3437
3446
|
redrive: (target, redriveOptions) => redriveEvent(id, target, redriveOptions)
|
|
@@ -3475,7 +3484,7 @@ function createServer(options) {
|
|
|
3475
3484
|
if (!scheduler) throw new TypeError("scheduled append delivery requires a configured scheduler adapter");
|
|
3476
3485
|
assertSessionId(sessionId);
|
|
3477
3486
|
try {
|
|
3478
|
-
await appendExternal(sessionId, "inline", [...events], true, originIndex);
|
|
3487
|
+
await appendExternal(sessionId, "inline", [...events], true, originIndex === void 0 ? {} : { originIndex });
|
|
3479
3488
|
} catch (error) {
|
|
3480
3489
|
if (originIndex !== void 0 && error instanceof A2Error && error.code === "SESSION_CLEARED") return;
|
|
3481
3490
|
throw error;
|
|
@@ -3484,7 +3493,7 @@ function createServer(options) {
|
|
|
3484
3493
|
historyWithMarkers: async (sessionId, gte) => (await readHistory(sessionId, { gte })).map(toPublic),
|
|
3485
3494
|
schedulerClear: async (sessionId, ifLastIndex) => {
|
|
3486
3495
|
assertSessionId(sessionId);
|
|
3487
|
-
|
|
3496
|
+
assertIfLastIndex(ifLastIndex);
|
|
3488
3497
|
await clearSession(sessionId, { ifLastIndex }, void 0);
|
|
3489
3498
|
}
|
|
3490
3499
|
});
|
|
@@ -3509,7 +3518,7 @@ function assertConsumeIndex(value) {
|
|
|
3509
3518
|
function assertRedriveIndex(value) {
|
|
3510
3519
|
if (!Number.isSafeInteger(value) || value < 1) throw new TypeError("redrive requires a positive safe-integer index");
|
|
3511
3520
|
}
|
|
3512
|
-
function
|
|
3521
|
+
function assertIfLastIndex(value) {
|
|
3513
3522
|
if (!Number.isSafeInteger(value) || value < 0) throw new TypeError("ifLastIndex must be a non-negative safe integer");
|
|
3514
3523
|
}
|
|
3515
3524
|
function assertAppendName(name) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as ownTeamId, n as discoveryIdentity, r as ownProjectId, t as oidcTokens } from "./tokens-
|
|
1
|
+
import { i as ownTeamId, n as discoveryIdentity, r as ownProjectId, t as oidcTokens } from "./tokens-C5_yGRlL.mjs";
|
|
2
2
|
export { discoveryIdentity, oidcTokens, ownProjectId, ownTeamId };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/experimental-a2@0.
|
|
1
|
+
//#region ../../node_modules/.pnpm/experimental-a2@0.24.0_@upstash+qstash@2.12.0_@vercel+queue@0.7.0_ai@7.0.130_zod@4.6.5__b1e2c243a963f2620a5d202817417c26/node_modules/experimental-a2/dist/session-clear-XJYpmUpg.js
|
|
2
2
|
var A2Error = class extends Error {
|
|
3
3
|
code;
|
|
4
4
|
/** e.g. the Standard Schema issues for INVALID_PAYLOAD */
|
|
@@ -15,6 +15,18 @@ function supersededAttemptError(sessionId, cause) {
|
|
|
15
15
|
const of = cause.consumer === void 0 ? "" : ` for consumer '${cause.consumer}'`;
|
|
16
16
|
return new A2Error("SUPERSEDED_ATTEMPT", `attempt ${cause.attempt} no longer owns event ${cause.index}${of} in session '${sessionId}'`);
|
|
17
17
|
}
|
|
18
|
+
/** A conditional append whose `ifLastIndex` is not the session's head. */
|
|
19
|
+
function lastIndexMismatchError(sessionId, ifLastIndex, head) {
|
|
20
|
+
return new A2Error("LAST_INDEX_MISMATCH", `session '${sessionId}' is at index ${head}, not ${ifLastIndex}`, { details: { index: head } });
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A batch whose ids conflict with committed events. In a conditional append
|
|
24
|
+
* whose head moved, the condition failed first, as when another writer's
|
|
25
|
+
* batch took those ids, so the conflict reports the head instead.
|
|
26
|
+
*/
|
|
27
|
+
function duplicateBatchError(message, conditional) {
|
|
28
|
+
return conditional && conditional.head !== conditional.ifLastIndex ? lastIndexMismatchError(conditional.sessionId, conditional.ifLastIndex, conditional.head) : new A2Error("PARTIAL_DUPLICATE_BATCH", message);
|
|
29
|
+
}
|
|
18
30
|
/**
|
|
19
31
|
* Wrap an arbitrary thrown value as STORE_UNAVAILABLE, preserving the
|
|
20
32
|
* original as `cause`. A2Errors pass through untouched — they already
|
|
@@ -48,4 +60,4 @@ function sessionClearedError(message) {
|
|
|
48
60
|
return new A2Error("SESSION_CLEARED", message);
|
|
49
61
|
}
|
|
50
62
|
//#endregion
|
|
51
|
-
export {
|
|
63
|
+
export { duplicateBatchError as a, sessionClearedError as c, asStoreUnavailable as i, supersededAttemptError as l, CLEAR_EVENT_TYPE as n, isSessionCleared as o, NonRetriableError as r, lastIndexMismatchError as s, A2Error as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as externalMessageKey } from "./external-
|
|
1
|
+
import { c as externalMessageKey } from "./external-D3p5T57R.mjs";
|
|
2
2
|
import { n as setOwn } from "./own-OwgPWdmh.mjs";
|
|
3
|
-
import { i as syncReads, n as project, r as projectSync, t as concernedMessageId } from "./project-
|
|
3
|
+
import { i as syncReads, n as project, r as projectSync, t as concernedMessageId } from "./project-C_2xs57L.mjs";
|
|
4
4
|
//#region src/store/sql.ts
|
|
5
5
|
/** The projection's name in `board_positions`, and the A2 consumer that runs it. */
|
|
6
6
|
const TABLES_CONSUMER = "board-tables";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s as PresencePatch } from "./reducer-CYPHsSmd-
|
|
2
|
-
//#region ../../node_modules/.pnpm/experimental-a2@0.
|
|
1
|
+
import { s as PresencePatch } from "./reducer-CYPHsSmd-BXjGiptm.mjs";
|
|
2
|
+
//#region ../../node_modules/.pnpm/experimental-a2@0.24.0_@upstash+qstash@2.12.0_@vercel+queue@0.7.0_ai@7.0.130_zod@4.6.5__b1e2c243a963f2620a5d202817417c26/node_modules/experimental-a2/dist/store-DEzcHZOA.d.ts
|
|
3
3
|
//#region src/store.d.ts
|
|
4
4
|
/** A stored event, as the public API exposes it. */
|
|
5
5
|
type Event = {
|
|
@@ -295,9 +295,19 @@ interface A2Store {
|
|
|
295
295
|
* a `cause` at or below the latest clear marker throws
|
|
296
296
|
* `SUPERSEDED_ATTEMPT`, an `originIndex` there throws `SESSION_CLEARED`,
|
|
297
297
|
* and ids whose rows lie below the marker are free to reuse.
|
|
298
|
+
*
|
|
299
|
+
* `ifLastIndex` conditions a non-empty batch on the session's head, the
|
|
300
|
+
* last index including any clear marker: when the head is anything else,
|
|
301
|
+
* throw `lastIndexMismatchError` carrying the head and write nothing. It is
|
|
302
|
+
* checked last, after the replay path and both fences, inside the same
|
|
303
|
+
* atomic operation, never as a read before it. A conditional batch whose
|
|
304
|
+
* ids conflict (mixed, or not matching their rows) reports that head
|
|
305
|
+
* instead of `PARTIAL_DUPLICATE_BATCH` when it isn't `ifLastIndex`
|
|
306
|
+
* (`duplicateBatchError`).
|
|
298
307
|
*/
|
|
299
308
|
append(sessionId: string, events: AppendEvent[], options?: {
|
|
300
309
|
originIndex?: number;
|
|
310
|
+
ifLastIndex?: number;
|
|
301
311
|
consumers?: readonly StoreConsumer[];
|
|
302
312
|
}): Promise<StoreAppendResult>;
|
|
303
313
|
/**
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/experimental-a2@0.24.0_@upstash+qstash@2.12.0_@vercel+queue@0.7.0_ai@7.0.130_zod@4.6.5__b1e2c243a963f2620a5d202817417c26/node_modules/experimental-a2/dist/store-N8PXxDAS.js
|
|
2
|
+
const SYSTEM_CLOCK = { now: () => /* @__PURE__ */ new Date() };
|
|
3
|
+
const RANDOM_IDS = () => crypto.randomUUID();
|
|
4
|
+
//#endregion
|
|
5
|
+
export { SYSTEM_CLOCK as n, RANDOM_IDS as t };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
//#region ../../node_modules/.pnpm/experimental-a2@0.
|
|
1
|
+
import { a as duplicateBatchError } from "./session-clear-XJYpmUpg-2q8l_FJR.mjs";
|
|
2
|
+
//#region ../../node_modules/.pnpm/experimental-a2@0.24.0_@upstash+qstash@2.12.0_@vercel+queue@0.7.0_ai@7.0.130_zod@4.6.5__b1e2c243a963f2620a5d202817417c26/node_modules/experimental-a2/dist/store-codec-pAG2oPgQ.js
|
|
3
3
|
const canonicalJson = (value) => JSON.stringify(value, (_key, candidate) => {
|
|
4
4
|
if (candidate === null || typeof candidate !== "object" || Array.isArray(candidate)) return candidate;
|
|
5
5
|
return Object.fromEntries(Object.entries(candidate).toSorted(([left], [right]) => left < right ? -1 : left > right ? 1 : 0));
|
|
6
6
|
}) ?? "null";
|
|
7
|
-
const idempotentReplay = (events, existing) => {
|
|
7
|
+
const idempotentReplay = (events, existing, conditional) => {
|
|
8
8
|
const byId = new Map(existing.map((event) => [event.id, event]));
|
|
9
9
|
const ordered = events.map((event) => event.id === void 0 ? void 0 : byId.get(event.id));
|
|
10
10
|
const firstIndex = ordered[0]?.index;
|
|
@@ -12,7 +12,7 @@ const idempotentReplay = (events, existing) => {
|
|
|
12
12
|
if (firstIndex === void 0 || batchSize !== void 0 && batchSize !== events.length || ordered.some((stored, index) => {
|
|
13
13
|
const event = events[index];
|
|
14
14
|
return stored === void 0 || stored.index !== firstIndex + index || stored.type !== event.type || stored.cause?.batchSize !== event.cause?.batchSize || canonicalJson(stored.payload) !== canonicalJson(event.payload);
|
|
15
|
-
})) throw
|
|
15
|
+
})) throw duplicateBatchError("already-appended events do not match the retried batch", conditional);
|
|
16
16
|
return ordered;
|
|
17
17
|
};
|
|
18
18
|
const decodeReturnedEventIds = (value) => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { m as nullProtoRecord } from "./internal-CvsrprnU-
|
|
3
|
-
import { a as idleLogCursor, i as idempotentReplay } from "./store-codec-
|
|
4
|
-
import { n as SYSTEM_CLOCK, t as RANDOM_IDS } from "./store-N8PXxDAS-
|
|
5
|
-
//#region ../../node_modules/.pnpm/experimental-a2@0.
|
|
1
|
+
import { a as duplicateBatchError, c as sessionClearedError, l as supersededAttemptError, n as CLEAR_EVENT_TYPE, s as lastIndexMismatchError, t as A2Error } from "./session-clear-XJYpmUpg-2q8l_FJR.mjs";
|
|
2
|
+
import { m as nullProtoRecord } from "./internal-CvsrprnU-zZMpDiRY.mjs";
|
|
3
|
+
import { a as idleLogCursor, i as idempotentReplay } from "./store-codec-pAG2oPgQ-SqDXlPBR.mjs";
|
|
4
|
+
import { n as SYSTEM_CLOCK, t as RANDOM_IDS } from "./store-N8PXxDAS-DWWgv-Vz.mjs";
|
|
5
|
+
//#region ../../node_modules/.pnpm/experimental-a2@0.24.0_@upstash+qstash@2.12.0_@vercel+queue@0.7.0_ai@7.0.130_zod@4.6.5__b1e2c243a963f2620a5d202817417c26/node_modules/experimental-a2/dist/store-memory.js
|
|
6
6
|
const RECLAIM_BATCH = 256;
|
|
7
7
|
const headOf = (log) => log ? log.offset + log.rows.length : 0;
|
|
8
8
|
const freshDispatch = () => ({
|
|
@@ -363,17 +363,24 @@ function memory(options = {}) {
|
|
|
363
363
|
events: [],
|
|
364
364
|
hasPending: hasPending(sessionId, consumers)
|
|
365
365
|
};
|
|
366
|
+
const ifLastIndex = appendOptions?.ifLastIndex;
|
|
367
|
+
const conditional = ifLastIndex === void 0 ? void 0 : {
|
|
368
|
+
sessionId,
|
|
369
|
+
ifLastIndex,
|
|
370
|
+
head: headOf(sessions.get(sessionId))
|
|
371
|
+
};
|
|
366
372
|
const existing = checkBatchIds(sessionId, events);
|
|
367
373
|
if (existing.length > 0) {
|
|
368
374
|
if (existing.length === events.length) return {
|
|
369
|
-
events: idempotentReplay(events, existing.map(toStored)),
|
|
375
|
+
events: idempotentReplay(events, existing.map(toStored), conditional),
|
|
370
376
|
hasPending: hasPending(sessionId, consumers)
|
|
371
377
|
};
|
|
372
|
-
throw
|
|
378
|
+
throw duplicateBatchError(`batch mixes ${existing.length} already-appended and ${events.length - existing.length} fresh events`, conditional);
|
|
373
379
|
}
|
|
374
380
|
const originIndex = appendOptions?.originIndex;
|
|
375
381
|
if (originIndex !== void 0 && originIndex <= clearIndexOf(sessionId)) throw sessionClearedError(`scheduled work from event ${originIndex} was cleared in session '${sessionId}'`);
|
|
376
382
|
for (const event of events) if (event.cause) assertCurrentCause(sessionId, event.cause);
|
|
383
|
+
if (conditional && conditional.head !== conditional.ifLastIndex) throw lastIndexMismatchError(sessionId, conditional.ifLastIndex, conditional.head);
|
|
377
384
|
const inserted = insert(sessionId, events, clock.now(), consumers);
|
|
378
385
|
notifyStreams(sessionId, inserted);
|
|
379
386
|
return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as POLL_TIMINGS } from "./internal-CvsrprnU-
|
|
2
|
-
//#region ../../node_modules/.pnpm/experimental-a2@0.
|
|
1
|
+
import { r as POLL_TIMINGS } from "./internal-CvsrprnU-zZMpDiRY.mjs";
|
|
2
|
+
//#region ../../node_modules/.pnpm/experimental-a2@0.24.0_@upstash+qstash@2.12.0_@vercel+queue@0.7.0_ai@7.0.130_zod@4.6.5__b1e2c243a963f2620a5d202817417c26/node_modules/experimental-a2/dist/store-polling-BZt2Rf3D.js
|
|
3
3
|
const streamActivities = /* @__PURE__ */ new WeakMap();
|
|
4
4
|
function createStreamActivity(wake) {
|
|
5
5
|
let idle = false;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as POLL_TIMINGS } from "./internal-CvsrprnU-
|
|
2
|
-
import { n as defaultSleep } from "./store-polling-BZt2Rf3D-
|
|
3
|
-
//#region ../../node_modules/.pnpm/experimental-a2@0.
|
|
1
|
+
import { r as POLL_TIMINGS } from "./internal-CvsrprnU-zZMpDiRY.mjs";
|
|
2
|
+
import { n as defaultSleep } from "./store-polling-BZt2Rf3D-Div-bJ_D.mjs";
|
|
3
|
+
//#region ../../node_modules/.pnpm/experimental-a2@0.24.0_@upstash+qstash@2.12.0_@vercel+queue@0.7.0_ai@7.0.130_zod@4.6.5__b1e2c243a963f2620a5d202817417c26/node_modules/experimental-a2/dist/store-presence-polling-JuAy2Ck2.js
|
|
4
4
|
const key = ({ participant, field }) => JSON.stringify([participant, field]);
|
|
5
5
|
function pollPresence({ read, deliver, sleep = defaultSleep }) {
|
|
6
6
|
let stopped = false;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as pollingStream } from "./store-polling-BZt2Rf3D-
|
|
3
|
-
import { a as idleLogCursor, i as idempotentReplay, n as decodeCause, r as decodeReturnedEventIds, t as cursorKeyOf } from "./store-codec-
|
|
4
|
-
import { n as SYSTEM_CLOCK, t as RANDOM_IDS } from "./store-N8PXxDAS-
|
|
1
|
+
import { a as duplicateBatchError, c as sessionClearedError, l as supersededAttemptError, n as CLEAR_EVENT_TYPE, s as lastIndexMismatchError, t as A2Error } from "./session-clear-XJYpmUpg-2q8l_FJR.mjs";
|
|
2
|
+
import { r as pollingStream } from "./store-polling-BZt2Rf3D-Div-bJ_D.mjs";
|
|
3
|
+
import { a as idleLogCursor, i as idempotentReplay, n as decodeCause, r as decodeReturnedEventIds, t as cursorKeyOf } from "./store-codec-pAG2oPgQ-SqDXlPBR.mjs";
|
|
4
|
+
import { n as SYSTEM_CLOCK, t as RANDOM_IDS } from "./store-N8PXxDAS-DWWgv-Vz.mjs";
|
|
5
5
|
import { mkdirSync } from "node:fs";
|
|
6
6
|
import { dirname, resolve } from "node:path";
|
|
7
7
|
import { DatabaseSync } from "node:sqlite";
|
|
8
|
-
//#region ../../node_modules/.pnpm/experimental-a2@0.
|
|
8
|
+
//#region ../../node_modules/.pnpm/experimental-a2@0.24.0_@upstash+qstash@2.12.0_@vercel+queue@0.7.0_ai@7.0.130_zod@4.6.5__b1e2c243a963f2620a5d202817417c26/node_modules/experimental-a2/dist/store-sqlite.js
|
|
9
9
|
/**
|
|
10
10
|
* experimental-a2/store-sqlite — sqlite store backend (the dev default, `.a2/dev.db`).
|
|
11
11
|
*
|
|
@@ -470,14 +470,20 @@ function sqlite(options = {}) {
|
|
|
470
470
|
const clearIndex = clearIndexOf(sessionId);
|
|
471
471
|
const suppliedIds = events.filter((e) => e.id !== void 0).map((e) => e.id);
|
|
472
472
|
if (new Set(suppliedIds).size !== suppliedIds.length) throw new A2Error("PARTIAL_DUPLICATE_BATCH", "batch contains the same event id more than once");
|
|
473
|
+
const ifLastIndex = appendOptions?.ifLastIndex;
|
|
474
|
+
const conditional = ifLastIndex === void 0 ? void 0 : {
|
|
475
|
+
sessionId,
|
|
476
|
+
ifLastIndex,
|
|
477
|
+
head: headOf(sessionId)
|
|
478
|
+
};
|
|
473
479
|
if (suppliedIds.length > 0) {
|
|
474
480
|
const existing = liveOwnersOf(sessionId, clearIndex, suppliedIds);
|
|
475
481
|
if (existing.length > 0) {
|
|
476
482
|
if (existing.length === events.length) return {
|
|
477
|
-
events: idempotentReplay(events, existing.map(toStored)),
|
|
483
|
+
events: idempotentReplay(events, existing.map(toStored), conditional),
|
|
478
484
|
hasPending: hasPending(sessionId, clearIndex, consumers)
|
|
479
485
|
};
|
|
480
|
-
throw
|
|
486
|
+
throw duplicateBatchError(`batch mixes ${existing.length} already-appended and ${events.length - existing.length} fresh events`, conditional);
|
|
481
487
|
}
|
|
482
488
|
}
|
|
483
489
|
const originIndex = appendOptions?.originIndex;
|
|
@@ -487,6 +493,7 @@ function sqlite(options = {}) {
|
|
|
487
493
|
cause: e.cause,
|
|
488
494
|
clearIndex
|
|
489
495
|
});
|
|
496
|
+
if (conditional && conditional.head !== conditional.ifLastIndex) throw lastIndexMismatchError(sessionId, conditional.ifLastIndex, conditional.head);
|
|
490
497
|
return {
|
|
491
498
|
events: insertBatch({
|
|
492
499
|
sessionId,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as PRESENCE_TIMINGS } from "./internal-CvsrprnU-
|
|
2
|
-
//#region ../../node_modules/.pnpm/experimental-a2@0.
|
|
1
|
+
import { i as PRESENCE_TIMINGS } from "./internal-CvsrprnU-zZMpDiRY.mjs";
|
|
2
|
+
//#region ../../node_modules/.pnpm/experimental-a2@0.24.0_@upstash+qstash@2.12.0_@vercel+queue@0.7.0_ai@7.0.130_zod@4.6.5__b1e2c243a963f2620a5d202817417c26/node_modules/experimental-a2/dist/stream-buffer-DrTyiIuo.js
|
|
3
3
|
const key = ({ participant, field }) => JSON.stringify([participant, field]);
|
|
4
4
|
function presenceTombstones() {
|
|
5
5
|
const stamps = /* @__PURE__ */ new Map();
|
package/dist/sync-github.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SyncUnit, _ as withUserTokens, d as ResolvedTarget, f as SyncContext, h as UserTokens, o as ProviderPost, r as ProviderDelivery, y as SyncFn } from "./provider-
|
|
2
|
-
import { n as ChatSyncProvider } from "./chat-provider-
|
|
1
|
+
import { S as SyncUnit, _ as withUserTokens, d as ResolvedTarget, f as SyncContext, h as UserTokens, o as ProviderPost, r as ProviderDelivery, y as SyncFn } from "./provider-Bm46LAdp.mjs";
|
|
2
|
+
import { n as ChatSyncProvider } from "./chat-provider-D6jVT4wS.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { Adapter } from "chat";
|
|
5
5
|
//#region src/sync/github.d.ts
|
|
@@ -309,6 +309,7 @@ export declare const GitHubEvent: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
309
309
|
kind: z.ZodLiteral<"lifecycle">;
|
|
310
310
|
title: z.ZodString;
|
|
311
311
|
url: z.ZodNullable<z.ZodString>;
|
|
312
|
+
body: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
312
313
|
labels: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
313
314
|
unset: z.ZodArray<z.ZodString>;
|
|
314
315
|
owns: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -369,6 +370,7 @@ export declare const GitHubEvent: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
369
370
|
kind: z.ZodLiteral<"lifecycle">;
|
|
370
371
|
title: z.ZodString;
|
|
371
372
|
url: z.ZodNullable<z.ZodString>;
|
|
373
|
+
body: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
372
374
|
labels: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
373
375
|
unset: z.ZodArray<z.ZodString>;
|
|
374
376
|
owns: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
package/dist/sync-github.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { c as into, d as withRoutes } from "./provider-
|
|
2
|
-
import { i as eventSchema, r as envelope } from "./events-
|
|
1
|
+
import { c as into, d as withRoutes } from "./provider-BaVmi4Hi.mjs";
|
|
2
|
+
import { i as eventSchema, r as envelope } from "./events-qf5XG5VQ.mjs";
|
|
3
3
|
import { r as withUserTokens, t as connectUserTokens } from "./users-yryHKFMo.mjs";
|
|
4
|
-
import { r as markdownOf, t as ChatSyncProvider } from "./chat-provider-
|
|
4
|
+
import { r as markdownOf, t as ChatSyncProvider } from "./chat-provider-COtsU5jB.mjs";
|
|
5
|
+
import { n as tagOf } from "./tags-BpFo6q0_.mjs";
|
|
5
6
|
import { z } from "zod";
|
|
6
7
|
import { connectGitHubAdapter } from "@vercel/connect/chat";
|
|
7
8
|
import { createGitHubAdapter } from "@chat-adapter/github";
|
|
@@ -18,17 +19,6 @@ const author = (user) => ({
|
|
|
18
19
|
avatar: user?.avatar_url ?? null,
|
|
19
20
|
isBot: user?.type === "Bot"
|
|
20
21
|
});
|
|
21
|
-
/** `good first issue` → `good-first-issue`: the part of a label key a name gives. Empty when nothing's left. */
|
|
22
|
-
const slug = (name) => name.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9_.-]+/g, "-").replace(/^[-_.]+|-+$/g, "");
|
|
23
|
-
/**
|
|
24
|
-
* A GitHub label or assignee as a board label: `bug` → `tag.bug=bug`,
|
|
25
|
-
* `julianbenegas` → `assignee.julianbenegas=julianbenegas`. The keys don't
|
|
26
|
-
* name GitHub, so a filter like `--label tag.bug` holds for any platform.
|
|
27
|
-
*/
|
|
28
|
-
function tagOf(prefix, name) {
|
|
29
|
-
const key = name ? slug(name) : "";
|
|
30
|
-
return key ? [`${prefix}.${key}`.slice(0, 64), name.slice(0, 256)] : null;
|
|
31
|
-
}
|
|
32
22
|
/** A PR's or issue's current labels and assignees, as board labels. */
|
|
33
23
|
function tagsOf(item) {
|
|
34
24
|
const tags = [...(item.labels ?? []).map((label) => tagOf("tag", label.name)), ...(item.assignees ?? []).map((user) => tagOf("assignee", user.login))];
|