@vite-hub/realtime 0.5.0 → 0.5.1
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 +2 -2
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +1 -2
- package/dist/{bus-Bsdanf5O.js → bus-DJ3dOQAZ.js} +4 -6
- package/dist/{bus-protocol-wXkXW28q.d.ts → bus-protocol-juNrVJDF.d.ts} +0 -2
- package/dist/bus.d.ts +1 -3
- package/dist/bus.js +1 -2
- package/dist/client/browser.js +3 -3
- package/dist/client.d.ts +2 -4
- package/dist/client.js +5 -6
- package/dist/{conflict-DYC_qXzM.js → conflict-BqdKFrkE.js} +3 -5
- package/dist/{conflict-CmZizTYl.d.ts → conflict-C5KRv-J1.d.ts} +0 -2
- package/dist/{document-b1ShR2S1.d.ts → document-CbqgNO_0.d.ts} +2 -4
- package/dist/document-CfrQbB03.js +1736 -0
- package/dist/durability.d.ts +1 -3
- package/dist/durability.js +1 -2
- package/dist/{editor-IL2jHqn8.js → editor-DzhKM4Gt.js} +2 -4
- package/dist/{error-diagnostics-Cd-XWNf7.js → error-diagnostics-we8V1O-X.js} +1 -2
- package/dist/index.d.ts +3 -7
- package/dist/index.js +3 -3
- package/dist/internal/runtime/unavailable.d.ts +1 -3
- package/dist/internal/runtime/unavailable.js +1 -2
- package/dist/internal/server.d.ts +6 -6
- package/dist/internal/server.js +5 -5
- package/dist/{keepalive-B4ONG6AD.js → keepalive-BYkk6Ax8.js} +3 -5
- package/dist/{layout-DNaxppTZ.js → layout-BQwRLTH0.js} +1 -2
- package/dist/{layout-VHjYWa-M.d.ts → layout-BZtKNqiC.d.ts} +1 -3
- package/dist/{log-E-cH6xkd.js → log-NlQi6kow.js} +2 -4
- package/dist/{object-BgPPDLDE.js → object-DfrneieE.js} +2 -4
- package/dist/{presence-B6rvkHqd.js → presence-DZ21pPKm.js} +3 -4
- package/dist/{request-kM5epeSd.js → request-DM6xHTaU.js} +5 -9
- package/dist/{request-DAodIqZ8.d.ts → request-PrMHOYFK.d.ts} +1 -3
- package/dist/{server-Covbc24E.d.ts → server-CLdYV7Md.d.ts} +6 -20
- package/dist/{server-BSXJP45b.js → server-yQp02XNp.js} +17 -24
- package/dist/server.d.ts +3 -3
- package/dist/server.js +2 -2
- package/dist/{types-DdY7Vo1H.d.ts → types-oUyN-CJR.d.ts} +1 -5
- package/dist/vite.d.ts +2 -15
- package/dist/vite.js +20 -27
- package/dist/vue.d.ts +2 -6
- package/dist/vue.js +47 -26
- package/package.json +39 -39
- package/dist/document-U5rzg2vG.js +0 -2041
package/dist/durability.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { Durability, DurabilityContext } from "@vite-hub/runtime/durability";
|
|
2
|
-
//#region src/durability.d.ts
|
|
3
2
|
/** What the build passes to `realtimeDurability()`: the Realtime driver that the build resolved. */
|
|
4
3
|
export interface RealtimeDurabilityInput {
|
|
5
4
|
/** `cloudflare`, `memory`, `postgres`, `redis`, or `auto` / `node` when the server picks it at boot. */
|
|
6
5
|
driver: string;
|
|
7
6
|
}
|
|
8
7
|
/** The durability of Realtime rooms, from the driver that the server uses at boot. */
|
|
9
|
-
export declare function realtimeDurability(input: RealtimeDurabilityInput, context: DurabilityContext): Durability[];
|
|
10
|
-
//#endregion
|
|
8
|
+
export declare function realtimeDurability(input: RealtimeDurabilityInput, context: DurabilityContext): Durability[];
|
package/dist/durability.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/durability.ts
|
|
2
2
|
const shared = {
|
|
3
3
|
cloudflare: "One Durable Object owns each room.",
|
|
4
4
|
postgres: "Postgres carries room updates between instances.",
|
|
@@ -38,5 +38,4 @@ function realtimeDurability(input, context) {
|
|
|
38
38
|
fix: "Set REDIS_URL, or use a Postgres Default Database, so instances share rooms. Or send every Realtime connection to one instance."
|
|
39
39
|
}];
|
|
40
40
|
}
|
|
41
|
-
//#endregion
|
|
42
41
|
export { realtimeDurability };
|
|
@@ -7,7 +7,7 @@ import { TableKit } from "@tiptap/extension-table";
|
|
|
7
7
|
import { Markdown } from "@tiptap/markdown";
|
|
8
8
|
import StarterKit from "@tiptap/starter-kit";
|
|
9
9
|
import { Marked } from "marked";
|
|
10
|
-
|
|
10
|
+
// src/frontmatter.ts
|
|
11
11
|
const frontmatterPattern = /^---\r?\n(?:---(?:\r?\n|$)|([\s\S]*?)\r?\n---(?:\r?\n|$))/;
|
|
12
12
|
const Frontmatter = Node.create({
|
|
13
13
|
name: "frontmatter",
|
|
@@ -58,8 +58,7 @@ const Frontmatter = Node.create({
|
|
|
58
58
|
return node.attrs?.value === null ? "---\n---" : `---\n${node.attrs?.value || ""}\n---`;
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
|
-
|
|
62
|
-
//#region src/editor.ts
|
|
61
|
+
// src/editor.ts
|
|
63
62
|
const RealtimeDocument = Document.extend({
|
|
64
63
|
content: "frontmatter? block+",
|
|
65
64
|
renderMarkdown(node, helpers, context) {
|
|
@@ -142,5 +141,4 @@ const realtimeMarkdownEditor = defineRealtimeEditor({
|
|
|
142
141
|
}
|
|
143
142
|
}
|
|
144
143
|
});
|
|
145
|
-
//#endregion
|
|
146
144
|
export { defineRealtimeEditor as n, realtimeMarkdownEditor as r, createRealtimeEditorExtensions as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineErrors } from "@vite-hub/runtime";
|
|
2
|
-
|
|
2
|
+
// src/error-diagnostics.ts
|
|
3
3
|
const realtimeErrorDiagnostics = /*#__PURE__*/ defineErrors({
|
|
4
4
|
docs: "https://vitehub.dev/docs/realtime/diagnostics",
|
|
5
5
|
codes: {
|
|
@@ -154,5 +154,4 @@ const realtimeErrorDiagnostics = /*#__PURE__*/ defineErrors({
|
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
});
|
|
157
|
-
//#endregion
|
|
158
157
|
export { realtimeErrorDiagnostics as t };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import { A as RealtimeResetReason, C as RealtimeReadOnlyReason, D as RealtimeRequestErrorCode, E as RealtimeRequestError, F as RealtimeUser, I as RealtimeVerifyResult, L as RealtimeWorkspaceChange, M as RealtimeSaveOptions, N as RealtimeSaveResult, O as RealtimeRequestEvent, P as RealtimeSaved, R as RealtimeWorkspaceDocumentOptions, S as RealtimePresenceDefinition, T as RealtimeRequestContext, _ as RealtimeLoadedDocument, a as RealtimeDefinition, b as RealtimePersistenceOptions, c as RealtimeDocumentContext, d as RealtimeDocumentStatus, f as RealtimeEditor, g as RealtimeIssue, h as RealtimeHoldOptions, i as RealtimeCheckpoint, j as RealtimeRoomRequestErrorCode, k as RealtimeRequestResult, l as RealtimeDocumentDefinition, m as RealtimeHistoryOptions, n as RealtimeAuthorizeContext, o as RealtimeDefinitionAccess, p as RealtimeFieldValue, s as RealtimeDocumentAdapter, u as RealtimeDocumentSnapshot, v as RealtimeOptions, x as RealtimePerson, y as RealtimeOriginContext, z as RealtimeRequestFailure } from "./types-
|
|
2
|
-
import { n as isRealtimeDocumentConflict, t as RealtimeDocumentConflict } from "./conflict-
|
|
3
|
-
import { n as realtimeDocumentLayout, t as readRealtimeStatus } from "./layout-
|
|
4
|
-
//#region src/definition.d.ts
|
|
1
|
+
import { A as RealtimeResetReason, C as RealtimeReadOnlyReason, D as RealtimeRequestErrorCode, E as RealtimeRequestError, F as RealtimeUser, I as RealtimeVerifyResult, L as RealtimeWorkspaceChange, M as RealtimeSaveOptions, N as RealtimeSaveResult, O as RealtimeRequestEvent, P as RealtimeSaved, R as RealtimeWorkspaceDocumentOptions, S as RealtimePresenceDefinition, T as RealtimeRequestContext, _ as RealtimeLoadedDocument, a as RealtimeDefinition, b as RealtimePersistenceOptions, c as RealtimeDocumentContext, d as RealtimeDocumentStatus, f as RealtimeEditor, g as RealtimeIssue, h as RealtimeHoldOptions, i as RealtimeCheckpoint, j as RealtimeRoomRequestErrorCode, k as RealtimeRequestResult, l as RealtimeDocumentDefinition, m as RealtimeHistoryOptions, n as RealtimeAuthorizeContext, o as RealtimeDefinitionAccess, p as RealtimeFieldValue, s as RealtimeDocumentAdapter, u as RealtimeDocumentSnapshot, v as RealtimeOptions, x as RealtimePerson, y as RealtimeOriginContext, z as RealtimeRequestFailure } from "./types-oUyN-CJR.js";
|
|
2
|
+
import { n as isRealtimeDocumentConflict, t as RealtimeDocumentConflict } from "./conflict-C5KRv-J1.js";
|
|
3
|
+
import { n as realtimeDocumentLayout, t as readRealtimeStatus } from "./layout-BZtKNqiC.js";
|
|
5
4
|
/**
|
|
6
5
|
* Checks a definition when the server loads it. A definition must say who can use its rooms: `authorize: true`,
|
|
7
6
|
* `authorize()`, or `access: "public"`. `history.checkpoint` needs a document that can record history: a Workspace
|
|
8
7
|
* document, or an adapter with `checkpoint()`.
|
|
9
8
|
*/
|
|
10
9
|
export declare function defineRealtime(definition: RealtimeDefinition): RealtimeDefinition;
|
|
11
|
-
//#endregion
|
|
12
|
-
//#region src/editor.d.ts
|
|
13
10
|
export declare function createRealtimeEditorExtensions(options?: {
|
|
14
11
|
collaborative?: boolean;
|
|
15
12
|
}): (import("@tiptap/core").Extension<import("@tiptap/starter-kit").StarterKitOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-blockquote").BlockquoteOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-code").CodeOptions, any> | import("@tiptap/core").Node<any, any> | import("@tiptap/core").Node<import("@tiptap/extension-image").ImageOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-table").TableKitOptions, any> | import("@tiptap/core").Extension<import("@tiptap/markdown").MarkdownExtensionOptions, import("@tiptap/markdown").MarkdownExtensionStorage>)[];
|
|
@@ -20,5 +17,4 @@ export declare function defineRealtimeEditor(editor: RealtimeEditor): RealtimeEd
|
|
|
20
17
|
* atom node, parsed and printed by `@tiptap/markdown`. It runs headless on the server.
|
|
21
18
|
*/
|
|
22
19
|
export declare const realtimeMarkdownEditor: RealtimeEditor;
|
|
23
|
-
//#endregion
|
|
24
20
|
export { type RealtimeAuthorizeContext, type RealtimeCheckpoint, type RealtimeDefinition, type RealtimeDefinitionAccess, type RealtimeDocumentAdapter, RealtimeDocumentConflict, type RealtimeDocumentContext, type RealtimeDocumentDefinition, type RealtimeDocumentSnapshot, type RealtimeDocumentStatus, type RealtimeEditor, type RealtimeFieldValue, type RealtimeHistoryOptions, type RealtimeHoldOptions, type RealtimeIssue, type RealtimeLoadedDocument, type RealtimeOptions, type RealtimeOriginContext, type RealtimePersistenceOptions, type RealtimePerson, type RealtimePresenceDefinition, type RealtimeReadOnlyReason, type RealtimeRequestContext, type RealtimeRequestError, type RealtimeRequestErrorCode, type RealtimeRequestEvent, type RealtimeRequestFailure, type RealtimeRequestResult, type RealtimeResetReason, type RealtimeRoomRequestErrorCode, type RealtimeSaveOptions, type RealtimeSaveResult, type RealtimeSaved, type RealtimeUser, type RealtimeVerifyResult, type RealtimeWorkspaceChange, type RealtimeWorkspaceDocumentOptions, isRealtimeDocumentConflict, readRealtimeStatus, realtimeDocumentLayout };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
import {
|
|
3
|
-
import { n as
|
|
1
|
+
import { a as defineRealtime, n as isRealtimeDocumentConflict, t as RealtimeDocumentConflict } from "./conflict-BqdKFrkE.js";
|
|
2
|
+
import { n as defineRealtimeEditor, r as realtimeMarkdownEditor, t as createRealtimeEditorExtensions } from "./editor-DzhKM4Gt.js";
|
|
3
|
+
import { n as realtimeDocumentLayout, t as readRealtimeStatus } from "./layout-BQwRLTH0.js";
|
|
4
4
|
export { RealtimeDocumentConflict, createRealtimeEditorExtensions, defineRealtime, defineRealtimeEditor, isRealtimeDocumentConflict, readRealtimeStatus, realtimeDocumentLayout, realtimeMarkdownEditor };
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { r as RealtimeAvailability } from "../../types-
|
|
2
|
-
//#region src/internal/runtime/unavailable.d.ts
|
|
1
|
+
import { r as RealtimeAvailability } from "../../types-oUyN-CJR.js";
|
|
3
2
|
declare const availability: RealtimeAvailability;
|
|
4
|
-
//#endregion
|
|
5
3
|
export { availability as default };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
// src/internal/runtime/unavailable.ts
|
|
2
2
|
const availability = {
|
|
3
3
|
available: false,
|
|
4
4
|
reason: "This build does not enable Realtime.",
|
|
5
5
|
fix: "Enable `realtime` in vitehub() with the Cloudflare or Node preset."
|
|
6
6
|
};
|
|
7
|
-
//#endregion
|
|
8
7
|
export { availability as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { i as RealtimeRoomRequestResult, n as RealtimeDurableObjectNamespace, o as requestRealtimeRoom, r as RealtimeRoomRequestOptions } from "../request-
|
|
2
|
-
import { n as RealtimeBusMessage, r as RealtimeRoomRecord, t as RealtimeBus } from "../bus-protocol-
|
|
3
|
-
import { n as isRealtimeDocumentConflict, t as RealtimeDocumentConflict } from "../conflict-
|
|
4
|
-
import { n as realtimeDocumentLayout, t as readRealtimeStatus } from "../layout-
|
|
5
|
-
import { C as claimAwarenessClientIds, D as blobDocument, E as RealtimeBlobStore, O as isRealtimeAvailable, S as bindAwarenessIdentity, T as RealtimeBlobDocumentOptions, _ as isRealtimeWorkspaceDocument, a as applyRealtimeSyncMessage, b as readRealtimeRequestState, c as encodeAwarenessState, d as realtimePersistenceDefaults, f as realtimeRoomKey, g as RealtimeWorkspaceDocumentAdapter, h as restoreRealtimeDocument, i as RealtimeSyncOptions, l as encodeSyncStep1, m as resolveRealtimeDefinition, n as RealtimeHandlerOptions, o as assertRealtimeRoomStateQuota, p as refreshRealtimeDocument, r as RealtimeRefreshOptions, s as createRealtimeHandler, t as RealtimeHandler, u as encodeSyncUpdate, v as readRealtimeWorkspaceDocument, w as compactRealtimeAwareness, x as applyRealtimeAwarenessUpdate, y as workspaceDocument } from "../server-
|
|
6
|
-
import { i as readRealtimeYDoc, n as createRealtimeYDoc, r as diffRealtimeYDoc, t as containsRealtimeState } from "../document-
|
|
1
|
+
import { i as RealtimeRoomRequestResult, n as RealtimeDurableObjectNamespace, o as requestRealtimeRoom, r as RealtimeRoomRequestOptions } from "../request-PrMHOYFK.js";
|
|
2
|
+
import { n as RealtimeBusMessage, r as RealtimeRoomRecord, t as RealtimeBus } from "../bus-protocol-juNrVJDF.js";
|
|
3
|
+
import { n as isRealtimeDocumentConflict, t as RealtimeDocumentConflict } from "../conflict-C5KRv-J1.js";
|
|
4
|
+
import { n as realtimeDocumentLayout, t as readRealtimeStatus } from "../layout-BZtKNqiC.js";
|
|
5
|
+
import { C as claimAwarenessClientIds, D as blobDocument, E as RealtimeBlobStore, O as isRealtimeAvailable, S as bindAwarenessIdentity, T as RealtimeBlobDocumentOptions, _ as isRealtimeWorkspaceDocument, a as applyRealtimeSyncMessage, b as readRealtimeRequestState, c as encodeAwarenessState, d as realtimePersistenceDefaults, f as realtimeRoomKey, g as RealtimeWorkspaceDocumentAdapter, h as restoreRealtimeDocument, i as RealtimeSyncOptions, l as encodeSyncStep1, m as resolveRealtimeDefinition, n as RealtimeHandlerOptions, o as assertRealtimeRoomStateQuota, p as refreshRealtimeDocument, r as RealtimeRefreshOptions, s as createRealtimeHandler, t as RealtimeHandler, u as encodeSyncUpdate, v as readRealtimeWorkspaceDocument, w as compactRealtimeAwareness, x as applyRealtimeAwarenessUpdate, y as workspaceDocument } from "../server-CLdYV7Md.js";
|
|
6
|
+
import { i as readRealtimeYDoc, n as createRealtimeYDoc, r as diffRealtimeYDoc, t as containsRealtimeState } from "../document-CbqgNO_0.js";
|
|
7
7
|
export { type RealtimeBlobDocumentOptions, type RealtimeBlobStore, type RealtimeBus, type RealtimeBusMessage, RealtimeDocumentConflict, type RealtimeDurableObjectNamespace, RealtimeHandler, RealtimeHandlerOptions, RealtimeRefreshOptions, type RealtimeRoomRecord, type RealtimeRoomRequestOptions, type RealtimeRoomRequestResult, RealtimeSyncOptions, type RealtimeWorkspaceDocumentAdapter, applyRealtimeAwarenessUpdate, applyRealtimeSyncMessage, assertRealtimeRoomStateQuota, bindAwarenessIdentity, blobDocument, claimAwarenessClientIds, compactRealtimeAwareness, containsRealtimeState, createRealtimeHandler, createRealtimeYDoc, diffRealtimeYDoc, encodeAwarenessState, encodeSyncStep1, encodeSyncUpdate, isRealtimeAvailable, isRealtimeDocumentConflict, isRealtimeWorkspaceDocument, readRealtimeRequestState, readRealtimeStatus, readRealtimeWorkspaceDocument, readRealtimeYDoc, realtimeDocumentLayout, realtimePersistenceDefaults, realtimeRoomKey, refreshRealtimeDocument, requestRealtimeRoom, resolveRealtimeDefinition, restoreRealtimeDocument, workspaceDocument };
|
package/dist/internal/server.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { l as requestRealtimeRoom, m as isRealtimeAvailable } from "../request-
|
|
2
|
-
import { n as realtimeDocumentLayout, t as readRealtimeStatus } from "../layout-
|
|
3
|
-
import { n as isRealtimeDocumentConflict, t as RealtimeDocumentConflict } from "../conflict-
|
|
4
|
-
import { _ as applyRealtimeAwarenessUpdate, a as encodeSyncStep1, b as compactRealtimeAwareness, c as realtimeRoomKey, d as restoreRealtimeDocument, f as blobDocument, g as readRealtimeRequestState, h as workspaceDocument, i as encodeAwarenessState, l as refreshRealtimeDocument, m as readRealtimeWorkspaceDocument, n as assertRealtimeRoomStateQuota, o as encodeSyncUpdate, p as isRealtimeWorkspaceDocument, r as createRealtimeHandler, s as realtimePersistenceDefaults, t as applyRealtimeSyncMessage, u as resolveRealtimeDefinition, v as bindAwarenessIdentity, y as claimAwarenessClientIds } from "../server-
|
|
5
|
-
import { i as diffRealtimeYDoc, n as containsRealtimeState, o as readRealtimeYDoc, r as createRealtimeYDoc } from "../document-
|
|
1
|
+
import { l as requestRealtimeRoom, m as isRealtimeAvailable } from "../request-DM6xHTaU.js";
|
|
2
|
+
import { n as realtimeDocumentLayout, t as readRealtimeStatus } from "../layout-BQwRLTH0.js";
|
|
3
|
+
import { n as isRealtimeDocumentConflict, t as RealtimeDocumentConflict } from "../conflict-BqdKFrkE.js";
|
|
4
|
+
import { _ as applyRealtimeAwarenessUpdate, a as encodeSyncStep1, b as compactRealtimeAwareness, c as realtimeRoomKey, d as restoreRealtimeDocument, f as blobDocument, g as readRealtimeRequestState, h as workspaceDocument, i as encodeAwarenessState, l as refreshRealtimeDocument, m as readRealtimeWorkspaceDocument, n as assertRealtimeRoomStateQuota, o as encodeSyncUpdate, p as isRealtimeWorkspaceDocument, r as createRealtimeHandler, s as realtimePersistenceDefaults, t as applyRealtimeSyncMessage, u as resolveRealtimeDefinition, v as bindAwarenessIdentity, y as claimAwarenessClientIds } from "../server-yQp02XNp.js";
|
|
5
|
+
import { i as diffRealtimeYDoc, n as containsRealtimeState, o as readRealtimeYDoc, r as createRealtimeYDoc } from "../document-CfrQbB03.js";
|
|
6
6
|
export { RealtimeDocumentConflict, applyRealtimeAwarenessUpdate, applyRealtimeSyncMessage, assertRealtimeRoomStateQuota, bindAwarenessIdentity, blobDocument, claimAwarenessClientIds, compactRealtimeAwareness, containsRealtimeState, createRealtimeHandler, createRealtimeYDoc, diffRealtimeYDoc, encodeAwarenessState, encodeSyncStep1, encodeSyncUpdate, isRealtimeAvailable, isRealtimeDocumentConflict, isRealtimeWorkspaceDocument, readRealtimeRequestState, readRealtimeStatus, readRealtimeWorkspaceDocument, readRealtimeYDoc, realtimeDocumentLayout, realtimePersistenceDefaults, realtimeRoomKey, refreshRealtimeDocument, requestRealtimeRoom, resolveRealtimeDefinition, restoreRealtimeDocument, workspaceDocument };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { h as realtimeKeepalivePing } from "./object-
|
|
1
|
+
import { h as realtimeKeepalivePing } from "./object-DfrneieE.js";
|
|
2
2
|
import * as time from "lib0/time";
|
|
3
|
-
|
|
3
|
+
// src/application-path.ts
|
|
4
4
|
function resolveRealtimeApplicationPath(path, baseURL = typeof __VITEHUB_APP_BASE_URL__ === "undefined" ? "/" : __VITEHUB_APP_BASE_URL__) {
|
|
5
5
|
return baseURL === "/" ? path : `${baseURL.replace(/\/+$/, "")}${path}`;
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
//#region src/keepalive.ts
|
|
7
|
+
// src/keepalive.ts
|
|
9
8
|
const keepaliveIntervalMs = 15e3;
|
|
10
9
|
/**
|
|
11
10
|
* y-websocket closes a socket that received nothing for 30 seconds, then connects again. A room with nobody else in it,
|
|
@@ -29,5 +28,4 @@ function keepRealtimeSocketAlive(provider) {
|
|
|
29
28
|
}, keepaliveIntervalMs);
|
|
30
29
|
});
|
|
31
30
|
}
|
|
32
|
-
//#endregion
|
|
33
31
|
export { resolveRealtimeApplicationPath as n, keepRealtimeSocketAlive as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/layout.ts
|
|
2
2
|
/**
|
|
3
3
|
* Root types of every Realtime Y.Doc:
|
|
4
4
|
* - `body`: Y.XmlFragment bound to the editor through TipTap Collaboration.
|
|
@@ -30,5 +30,4 @@ function readRealtimeStatus(document) {
|
|
|
30
30
|
savedBy: status.savedBy
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
//#endregion
|
|
34
33
|
export { realtimeDocumentLayout as n, readRealtimeStatus as t };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { d as RealtimeDocumentStatus } from "./types-
|
|
1
|
+
import { d as RealtimeDocumentStatus } from "./types-oUyN-CJR.js";
|
|
2
2
|
import * as Y from "yjs";
|
|
3
|
-
//#region src/layout.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Root types of every Realtime Y.Doc:
|
|
6
5
|
* - `body`: Y.XmlFragment bound to the editor through TipTap Collaboration.
|
|
@@ -14,5 +13,4 @@ declare const realtimeDocumentLayout: Readonly<{
|
|
|
14
13
|
readonly status: "status";
|
|
15
14
|
}>;
|
|
16
15
|
declare function readRealtimeStatus(document: Y.Doc): RealtimeDocumentStatus;
|
|
17
|
-
//#endregion
|
|
18
16
|
export { realtimeDocumentLayout as n, readRealtimeStatus as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// ../internal/src/runtime/request-log.ts
|
|
2
2
|
function isRequestLog(value) {
|
|
3
3
|
return value !== null && typeof value === "object" && typeof Reflect.get(value, "set") === "function" && typeof Reflect.get(value, "warn") === "function" && typeof Reflect.get(value, "error") === "function";
|
|
4
4
|
}
|
|
@@ -101,8 +101,7 @@ function logFailure(failure, fallback) {
|
|
|
101
101
|
fallback();
|
|
102
102
|
} catch {}
|
|
103
103
|
}
|
|
104
|
-
|
|
105
|
-
//#region src/log.ts
|
|
104
|
+
// src/log.ts
|
|
106
105
|
/**
|
|
107
106
|
* The label of a room in logs. A `document: false` room id can be a random token that lets a person join, such as a
|
|
108
107
|
* page id, so the log gets a short hash of it. A cryptographic hash adds nothing here: a short or guessable id can be
|
|
@@ -155,5 +154,4 @@ function logRealtime(level, message, fields, error, options = {}) {
|
|
|
155
154
|
else console.warn(text, ...error === void 0 ? [] : [error instanceof Error ? error.message : String(error)]);
|
|
156
155
|
});
|
|
157
156
|
}
|
|
158
|
-
//#endregion
|
|
159
157
|
export { requestLog as i, realtimeRoomFields as n, realtimeRoomLabel as r, logRealtime as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as realtimeErrorDiagnostics } from "./error-diagnostics-
|
|
1
|
+
import { t as realtimeErrorDiagnostics } from "./error-diagnostics-we8V1O-X.js";
|
|
2
2
|
import * as decoding from "lib0/decoding";
|
|
3
3
|
import * as encoding from "lib0/encoding";
|
|
4
4
|
import { normalizeSafeWorkspacePath } from "@vite-hub/workspace/internal/path";
|
|
@@ -127,8 +127,7 @@ function decodeRealtimeRequestFramePayload(decoder) {
|
|
|
127
127
|
};
|
|
128
128
|
} catch {}
|
|
129
129
|
}
|
|
130
|
-
|
|
131
|
-
//#region ../internal/src/object.ts
|
|
130
|
+
// ../internal/src/object.ts
|
|
132
131
|
/** A non-null object that is not an array. Functions do not pass. */
|
|
133
132
|
function isRecord(value) {
|
|
134
133
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -141,5 +140,4 @@ function isRecordOrFunction(value) {
|
|
|
141
140
|
function cloneRecord(value) {
|
|
142
141
|
return value && typeof value === "object" && !Array.isArray(value) ? { ...value } : {};
|
|
143
142
|
}
|
|
144
|
-
//#endregion
|
|
145
143
|
export { realtimeReadOnlyCode as _, decodeRealtimeRequestFramePayload as a, realtimeSyncPendingCode as b, encodeRealtimeRequestFrame as c, maxAwarenessClients as d, readAwarenessClientIds as f, realtimeKeepalivePong as g, realtimeKeepalivePing as h, decodeRealtimeControlPayload as i, encodeWorkspaceChange as l, realtimeInvalidDocumentCode as m, isRecord as n, decodeWorkspaceChangePayload as o, realtimeForbiddenWriteCloseCode as p, isRecordOrFunction as r, encodeRealtimeControl as s, cloneRecord as t, isRetryableRealtimeRequestCode as u, realtimeResetCloseCode as v, workspaceRoomId as x, realtimeSourceChangedCode as y };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { n as isRecord } from "./object-DfrneieE.js";
|
|
2
|
+
import { t as realtimeErrorDiagnostics } from "./error-diagnostics-we8V1O-X.js";
|
|
3
|
+
// src/presence.ts
|
|
4
4
|
const personColors = [
|
|
5
5
|
"#E11D48",
|
|
6
6
|
"#D97706",
|
|
@@ -49,5 +49,4 @@ function getRealtimePeople(states) {
|
|
|
49
49
|
}
|
|
50
50
|
return people;
|
|
51
51
|
}
|
|
52
|
-
//#endregion
|
|
53
52
|
export { getRealtimePeople as n, createRealtimeIdentity as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as realtimeErrorDiagnostics } from "./error-diagnostics-
|
|
1
|
+
import { t as realtimeErrorDiagnostics } from "./error-diagnostics-we8V1O-X.js";
|
|
2
2
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
3
|
import availability from "#vitehub/realtime/availability";
|
|
4
|
-
|
|
4
|
+
// ../internal/src/runtime/cloudflare-env-lookup.ts
|
|
5
5
|
/** The key of the AsyncLocalStorage store on `globalThis`. Every bundled copy of this module shares the store. */
|
|
6
6
|
const activeEnvStorageKey = Symbol.for("vitehub.cloudflare.env-storage");
|
|
7
7
|
let activeEnv;
|
|
@@ -15,16 +15,14 @@ function getActiveCloudflareEnv() {
|
|
|
15
15
|
const host = globalThis;
|
|
16
16
|
return Object.hasOwn(host, "__env__") && host.__env__ !== void 0 ? host.__env__ : activeEnv;
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
//#region ../internal/src/runtime/cloudflare-env.ts
|
|
18
|
+
// ../internal/src/runtime/cloudflare-env.ts
|
|
20
19
|
const runtimeGlobal = globalThis;
|
|
21
20
|
runtimeGlobal[activeEnvStorageKey] ||= new AsyncLocalStorage();
|
|
22
21
|
function getActiveCloudflareBinding(name) {
|
|
23
22
|
const env = getActiveCloudflareEnv();
|
|
24
23
|
return env && Object.hasOwn(env, name) ? env[name] : void 0;
|
|
25
24
|
}
|
|
26
|
-
|
|
27
|
-
//#region src/availability.ts
|
|
25
|
+
// src/availability.ts
|
|
28
26
|
/**
|
|
29
27
|
* Returns `true` when this build has a Realtime room driver: Durable Objects on Cloudflare, a Node server, or memory
|
|
30
28
|
* on the dev server. Without one, no room opens and `refreshRealtimeDocument()` resolves `false`.
|
|
@@ -32,8 +30,7 @@ function getActiveCloudflareBinding(name) {
|
|
|
32
30
|
function isRealtimeAvailable() {
|
|
33
31
|
return availability.available;
|
|
34
32
|
}
|
|
35
|
-
|
|
36
|
-
//#region src/request.ts
|
|
33
|
+
// src/request.ts
|
|
37
34
|
const routePrefix = "/_vitehub/realtime/";
|
|
38
35
|
/** Marks the request that `requestRealtimeRoom()` sends to a Durable Object. The Worker strips it from client requests. */
|
|
39
36
|
const internalRequestHeader = "x-vitehub-realtime-request";
|
|
@@ -187,5 +184,4 @@ const agentRealtime = {
|
|
|
187
184
|
available: isRealtimeAvailable,
|
|
188
185
|
request: requestRealtimeRoom
|
|
189
186
|
};
|
|
190
|
-
//#endregion
|
|
191
187
|
export { internalRequestHeader as a, localRequesters as c, routePrefix as d, toDurableRequestReply as f, durableRoomsInstance as i, requestRealtimeRoom as l, isRealtimeAvailable as m, defaultRequestTimeout as n, isDurableSockets as o, workerDurableObjects as p, defaultRequestWait as r, isRealtimeDurableObjectNamespace as s, agentRealtime as t, roomRequestError as u };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { j as RealtimeRoomRequestErrorCode } from "./types-
|
|
1
|
+
import { j as RealtimeRoomRequestErrorCode } from "./types-oUyN-CJR.js";
|
|
2
2
|
import { Result } from "@vite-hub/runtime";
|
|
3
|
-
//#region src/request.d.ts
|
|
4
3
|
/** The `$DurableObject` namespace binding that holds Realtime rooms on Cloudflare. */
|
|
5
4
|
interface RealtimeDurableObjectNamespace {
|
|
6
5
|
get(id: unknown): {
|
|
@@ -44,5 +43,4 @@ interface AgentRealtime {
|
|
|
44
43
|
request: typeof requestRealtimeRoom;
|
|
45
44
|
}
|
|
46
45
|
declare const agentRealtime: AgentRealtime;
|
|
47
|
-
//#endregion
|
|
48
46
|
export { agentRealtime as a, RealtimeRoomRequestResult as i, RealtimeDurableObjectNamespace as n, requestRealtimeRoom as o, RealtimeRoomRequestOptions as r, AgentRealtime as t };
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import "./conflict-
|
|
5
|
-
import "./document-
|
|
1
|
+
import { t as RealtimeBus } from "./bus-protocol-juNrVJDF.js";
|
|
2
|
+
import { R as RealtimeWorkspaceDocumentOptions, c as RealtimeDocumentContext, f as RealtimeEditor, l as RealtimeDocumentDefinition, s as RealtimeDocumentAdapter, w as RealtimeRegistry, x as RealtimePerson } from "./types-oUyN-CJR.js";
|
|
3
|
+
import { n as RealtimeDurableObjectNamespace } from "./request-PrMHOYFK.js";
|
|
4
|
+
import "./conflict-C5KRv-J1.js";
|
|
5
|
+
import "./document-CbqgNO_0.js";
|
|
6
6
|
import * as awarenessProtocol from "y-protocols/awareness";
|
|
7
7
|
import * as Y from "yjs";
|
|
8
8
|
import { Diagnostic } from "nostics";
|
|
9
9
|
import { ReadonlyWorkspaceFiles, WritableWorkspaceFiles } from "@vite-hub/workspace/files";
|
|
10
|
-
//#region src/availability.d.ts
|
|
11
10
|
/**
|
|
12
11
|
* Returns `true` when this build has a Realtime room driver: Durable Objects on Cloudflare, a Node server, or memory
|
|
13
12
|
* on the dev server. Without one, no room opens and `refreshRealtimeDocument()` resolves `false`.
|
|
14
13
|
*/
|
|
15
14
|
declare function isRealtimeAvailable(): boolean;
|
|
16
|
-
//#endregion
|
|
17
|
-
//#region src/blob-document.d.ts
|
|
18
15
|
/**
|
|
19
16
|
* The part of a ViteHub Blob store that `blobDocument()` uses, such as `blob` from `vite-hub/blob`. `put()` writes only
|
|
20
17
|
* when its `ifMatch` or `overwrite: false` condition holds, and otherwise returns a `BLOB_CONFLICT` error.
|
|
@@ -45,11 +42,7 @@ interface RealtimeBlobDocumentOptions {
|
|
|
45
42
|
* and the save's write also makes the save throw `RealtimeDocumentConflict`, and keeps its file.
|
|
46
43
|
*/
|
|
47
44
|
declare function blobDocument(store: RealtimeBlobStore, options?: RealtimeBlobDocumentOptions): RealtimeDocumentAdapter;
|
|
48
|
-
//#endregion
|
|
49
|
-
//#region src/presence.d.ts
|
|
50
45
|
type RealtimeIdentity = Omit<RealtimePerson, "clientId">;
|
|
51
|
-
//#endregion
|
|
52
|
-
//#region src/awareness.d.ts
|
|
53
46
|
/**
|
|
54
47
|
* Records that `peer` owns `clients`. A client that another peer owns is a conflict, unless `transferable` accepts its
|
|
55
48
|
* owner, such as another server instance that the client left.
|
|
@@ -58,11 +51,7 @@ declare function claimAwarenessClientIds<Peer extends object>(owners: Map<number
|
|
|
58
51
|
declare function bindAwarenessIdentity(update: Uint8Array, identity: RealtimeIdentity): Uint8Array;
|
|
59
52
|
declare function applyRealtimeAwarenessUpdate(awareness: awarenessProtocol.Awareness, update: Uint8Array, origin: unknown, maxStateBytes?: number): void;
|
|
60
53
|
declare function compactRealtimeAwareness(awareness: awarenessProtocol.Awareness): awarenessProtocol.Awareness;
|
|
61
|
-
//#endregion
|
|
62
|
-
//#region src/transport.d.ts
|
|
63
54
|
declare function readRealtimeRequestState(request: Request, maxBytes?: number): Promise<Uint8Array>;
|
|
64
|
-
//#endregion
|
|
65
|
-
//#region src/workspace-document.d.ts
|
|
66
55
|
interface RealtimeWorkspaceDocumentAdapter extends RealtimeDocumentAdapter {
|
|
67
56
|
kind: "workspace";
|
|
68
57
|
workspace: string;
|
|
@@ -78,8 +67,6 @@ declare function readRealtimeWorkspaceDocument(readable: ReadonlyWorkspaceFiles,
|
|
|
78
67
|
*/
|
|
79
68
|
declare function workspaceDocument(workspaceName: string, checkpointAuthor?: RealtimeWorkspaceDocumentOptions["checkpointAuthor"]): RealtimeWorkspaceDocumentAdapter;
|
|
80
69
|
declare function isRealtimeWorkspaceDocument(adapter: RealtimeDocumentAdapter): adapter is RealtimeWorkspaceDocumentAdapter;
|
|
81
|
-
//#endregion
|
|
82
|
-
//#region src/internal/server.d.ts
|
|
83
70
|
interface RealtimeHandler {
|
|
84
71
|
(event: unknown): Promise<unknown>;
|
|
85
72
|
fetch(input: Request | URL | string): Promise<Response>;
|
|
@@ -113,7 +100,7 @@ declare function restoreRealtimeDocument(markdown: string, baselineDigest: strin
|
|
|
113
100
|
interface ResolvedRealtimeDefinition {
|
|
114
101
|
adapter: RealtimeDocumentAdapter;
|
|
115
102
|
definition: RealtimeDocumentDefinition;
|
|
116
|
-
editor: (context: RealtimeDocumentContext) => RealtimeEditor
|
|
103
|
+
editor: (context: RealtimeDocumentContext) => RealtimeEditor | Promise<RealtimeEditor>;
|
|
117
104
|
persistence: {
|
|
118
105
|
debounce: number;
|
|
119
106
|
maxWait: number;
|
|
@@ -136,5 +123,4 @@ interface RealtimeRefreshOptions {
|
|
|
136
123
|
*/
|
|
137
124
|
declare function refreshRealtimeDocument(definition: string, documentId: string, options?: RealtimeRefreshOptions): Promise<boolean>;
|
|
138
125
|
declare function createRealtimeHandler(registry: RealtimeRegistry, options?: RealtimeHandlerOptions): RealtimeHandler;
|
|
139
|
-
//#endregion
|
|
140
126
|
export { claimAwarenessClientIds as C, blobDocument as D, RealtimeBlobStore as E, isRealtimeAvailable as O, bindAwarenessIdentity as S, RealtimeBlobDocumentOptions as T, isRealtimeWorkspaceDocument as _, applyRealtimeSyncMessage as a, readRealtimeRequestState as b, encodeAwarenessState as c, realtimePersistenceDefaults as d, realtimeRoomKey as f, RealtimeWorkspaceDocumentAdapter as g, restoreRealtimeDocument as h, RealtimeSyncOptions as i, encodeSyncStep1 as l, resolveRealtimeDefinition as m, RealtimeHandlerOptions as n, assertRealtimeRoomStateQuota as o, refreshRealtimeDocument as p, RealtimeRefreshOptions as r, createRealtimeHandler as s, RealtimeHandler as t, encodeSyncUpdate as u, readRealtimeWorkspaceDocument as v, compactRealtimeAwareness as w, applyRealtimeAwarenessUpdate as x, workspaceDocument as y };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { n as realtimeDocumentLayout, t as readRealtimeStatus } from "./layout-
|
|
6
|
-
import { t as
|
|
7
|
-
import {
|
|
8
|
-
import { r as
|
|
9
|
-
import {
|
|
1
|
+
import { t as createRealtimeIdentity } from "./presence-DZ21pPKm.js";
|
|
2
|
+
import { _ as realtimeReadOnlyCode, a as decodeRealtimeRequestFramePayload, b as realtimeSyncPendingCode, c as encodeRealtimeRequestFrame, f as readAwarenessClientIds, g as realtimeKeepalivePong, h as realtimeKeepalivePing, l as encodeWorkspaceChange, m as realtimeInvalidDocumentCode, n as isRecord, o as decodeWorkspaceChangePayload, p as realtimeForbiddenWriteCloseCode, s as encodeRealtimeControl, v as realtimeResetCloseCode, y as realtimeSourceChangedCode } from "./object-DfrneieE.js";
|
|
3
|
+
import { t as realtimeErrorDiagnostics } from "./error-diagnostics-we8V1O-X.js";
|
|
4
|
+
import { i as assertRealtimeCheckpoint, n as isRealtimeDocumentConflict, r as assertRealtimeAccess, t as RealtimeDocumentConflict } from "./conflict-BqdKFrkE.js";
|
|
5
|
+
import { n as realtimeDocumentLayout, t as readRealtimeStatus } from "./layout-BQwRLTH0.js";
|
|
6
|
+
import { a as keepRealtimeFinalNewline, c as realtimeJsonEqual, d as writeRealtimeStatus, i as diffRealtimeYDoc, l as realtimeStatusFingerprint, n as containsRealtimeState, o as readRealtimeYDoc, r as createRealtimeYDoc, s as realtimeCodecReadsBack, t as checkRealtimeBody, u as writeRealtimeFields } from "./document-CfrQbB03.js";
|
|
7
|
+
import { r as realtimeMarkdownEditor } from "./editor-DzhKM4Gt.js";
|
|
8
|
+
import { a as internalRequestHeader, c as localRequesters, d as routePrefix, f as toDurableRequestReply, i as durableRoomsInstance, n as defaultRequestTimeout, o as isDurableSockets, p as workerDurableObjects, r as defaultRequestWait, s as isRealtimeDurableObjectNamespace, u as roomRequestError } from "./request-DM6xHTaU.js";
|
|
9
|
+
import { i as requestLog, n as realtimeRoomFields, r as realtimeRoomLabel, t as logRealtime } from "./log-NlQi6kow.js";
|
|
10
10
|
import { getViteHubErrorShape } from "@vite-hub/runtime";
|
|
11
11
|
import * as decoding from "lib0/decoding";
|
|
12
12
|
import * as encoding from "lib0/encoding";
|
|
@@ -18,7 +18,7 @@ import { isWorkspaceConflict, normalizeSafeWorkspacePath, resolveWorkspaceStoreT
|
|
|
18
18
|
import { HTTPError, defineEventHandler, defineWebSocketHandler } from "nitro/h3";
|
|
19
19
|
import * as syncProtocol from "y-protocols/sync";
|
|
20
20
|
import { getStandardContext } from "@vite-hub/runtime/internal/h3";
|
|
21
|
-
|
|
21
|
+
// src/awareness.ts
|
|
22
22
|
const maxRoomAwarenessBytes = 8388608;
|
|
23
23
|
/**
|
|
24
24
|
* Records that `peer` owns `clients`. A client that another peer owns is a conflict, unless `transferable` accepts its
|
|
@@ -180,8 +180,7 @@ function createRealtimeAwarenessOwners(options = {}) {
|
|
|
180
180
|
}
|
|
181
181
|
};
|
|
182
182
|
}
|
|
183
|
-
|
|
184
|
-
//#region src/transport.ts
|
|
183
|
+
// src/transport.ts
|
|
185
184
|
const maxRequestStateBytes = 8388608;
|
|
186
185
|
const arrayBufferByteLengthGetter = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength").get;
|
|
187
186
|
const typedArrayByteLengthGetter = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype), "byteLength").get;
|
|
@@ -255,8 +254,7 @@ async function readRealtimeRequestState(request, maxBytes = maxRequestStateBytes
|
|
|
255
254
|
}
|
|
256
255
|
return state;
|
|
257
256
|
}
|
|
258
|
-
|
|
259
|
-
//#region src/workspace-document.ts
|
|
257
|
+
// src/workspace-document.ts
|
|
260
258
|
async function readRealtimeWorkspaceDocument(readable, writable, documentId) {
|
|
261
259
|
const stat = async () => {
|
|
262
260
|
try {
|
|
@@ -384,8 +382,7 @@ function workspaceDocument(workspaceName, checkpointAuthor) {
|
|
|
384
382
|
function isRealtimeWorkspaceDocument(adapter) {
|
|
385
383
|
return adapter.kind === "workspace" && "workspace" in adapter && typeof adapter.workspace === "string";
|
|
386
384
|
}
|
|
387
|
-
|
|
388
|
-
//#region src/cloudflare-sql.ts
|
|
385
|
+
// src/cloudflare-sql.ts
|
|
389
386
|
function hasCloudflareSqlExecInternal(sql, allowOwnExec) {
|
|
390
387
|
if (sql === null || Object(sql) !== sql) return false;
|
|
391
388
|
try {
|
|
@@ -446,8 +443,7 @@ function hasCloudflareSqlExecInternal(sql, allowOwnExec) {
|
|
|
446
443
|
function hasNativeCloudflareSql(sql) {
|
|
447
444
|
return hasCloudflareSqlExecInternal(sql, false);
|
|
448
445
|
}
|
|
449
|
-
|
|
450
|
-
//#region ../internal/src/runtime/request-origin.ts
|
|
446
|
+
// ../internal/src/runtime/request-origin.ts
|
|
451
447
|
function firstHeaderValue(headers, name) {
|
|
452
448
|
return headers.get(name)?.split(",", 1)[0]?.trim() || void 0;
|
|
453
449
|
}
|
|
@@ -468,8 +464,7 @@ function forwardedRequestOrigin(request) {
|
|
|
468
464
|
return url.origin;
|
|
469
465
|
}
|
|
470
466
|
}
|
|
471
|
-
|
|
472
|
-
//#region src/blob-document.ts
|
|
467
|
+
// src/blob-document.ts
|
|
473
468
|
function errorCode$1(error) {
|
|
474
469
|
return error !== null && typeof error === "object" && "code" in error ? error.code : void 0;
|
|
475
470
|
}
|
|
@@ -522,8 +517,7 @@ function blobDocument(store, options = {}) {
|
|
|
522
517
|
}
|
|
523
518
|
};
|
|
524
519
|
}
|
|
525
|
-
|
|
526
|
-
//#region src/internal/server.ts
|
|
520
|
+
// src/internal/server.ts
|
|
527
521
|
const maxMessageBytes = 1048576;
|
|
528
522
|
const maxRoomStateBytes = 8388608;
|
|
529
523
|
const maxMemoryRooms = 128;
|
|
@@ -1493,7 +1487,7 @@ function createRealtimeHandler(registry, options = {}) {
|
|
|
1493
1487
|
definition: definitionName,
|
|
1494
1488
|
documentId
|
|
1495
1489
|
};
|
|
1496
|
-
const editor = resolved.editor(context);
|
|
1490
|
+
const editor = await resolved.editor(context);
|
|
1497
1491
|
const { loaded, guard, shared } = bus ? await bus.withRoomLock(key, async () => {
|
|
1498
1492
|
const loaded = await resolved.adapter.load(context);
|
|
1499
1493
|
const guard = await verifyDocument(editor, loaded);
|
|
@@ -2602,5 +2596,4 @@ function createRealtimeHandler(registry, options = {}) {
|
|
|
2602
2596
|
}
|
|
2603
2597
|
});
|
|
2604
2598
|
}
|
|
2605
|
-
//#endregion
|
|
2606
2599
|
export { applyRealtimeAwarenessUpdate as _, encodeSyncStep1 as a, compactRealtimeAwareness as b, realtimeRoomKey as c, restoreRealtimeDocument as d, blobDocument as f, readRealtimeRequestState as g, workspaceDocument as h, encodeAwarenessState as i, refreshRealtimeDocument as l, readRealtimeWorkspaceDocument as m, assertRealtimeRoomStateQuota as n, encodeSyncUpdate as o, isRealtimeWorkspaceDocument as p, createRealtimeHandler as r, realtimePersistenceDefaults as s, applyRealtimeSyncMessage as t, resolveRealtimeDefinition as u, bindAwarenessIdentity as v, claimAwarenessClientIds as y };
|
package/dist/server.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as
|
|
3
|
-
import {
|
|
1
|
+
import { D as blobDocument, E as RealtimeBlobStore, O as isRealtimeAvailable, T as RealtimeBlobDocumentOptions, g as RealtimeWorkspaceDocumentAdapter, n as RealtimeHandlerOptions, p as refreshRealtimeDocument, r as RealtimeRefreshOptions, s as createRealtimeHandler, t as RealtimeHandler, y as workspaceDocument } from "./server-CLdYV7Md.js";
|
|
2
|
+
import { i as RealtimeRoomRequestResult, n as RealtimeDurableObjectNamespace, o as requestRealtimeRoom, r as RealtimeRoomRequestOptions } from "./request-PrMHOYFK.js";
|
|
3
|
+
import { n as RealtimeBusMessage, r as RealtimeRoomRecord, t as RealtimeBus } from "./bus-protocol-juNrVJDF.js";
|
|
4
4
|
export { type RealtimeBlobDocumentOptions, type RealtimeBlobStore, type RealtimeBus, type RealtimeBusMessage, type RealtimeDurableObjectNamespace, type RealtimeHandler, type RealtimeHandlerOptions, type RealtimeRefreshOptions, type RealtimeRoomRecord, type RealtimeRoomRequestOptions, type RealtimeRoomRequestResult, type RealtimeWorkspaceDocumentAdapter, blobDocument, createRealtimeHandler, isRealtimeAvailable, refreshRealtimeDocument, requestRealtimeRoom, workspaceDocument };
|
package/dist/server.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { l as requestRealtimeRoom, m as isRealtimeAvailable } from "./request-
|
|
2
|
-
import { f as blobDocument, h as workspaceDocument, l as refreshRealtimeDocument, r as createRealtimeHandler } from "./server-
|
|
1
|
+
import { l as requestRealtimeRoom, m as isRealtimeAvailable } from "./request-DM6xHTaU.js";
|
|
2
|
+
import { f as blobDocument, h as workspaceDocument, l as refreshRealtimeDocument, r as createRealtimeHandler } from "./server-yQp02XNp.js";
|
|
3
3
|
export { blobDocument, createRealtimeHandler, isRealtimeAvailable, refreshRealtimeDocument, requestRealtimeRoom, workspaceDocument };
|
|
@@ -2,14 +2,11 @@ import { ResultError, ViteHubContext } from "@vite-hub/runtime";
|
|
|
2
2
|
import { AnyExtension, JSONContent } from "@tiptap/core";
|
|
3
3
|
import { WorkspaceAuthor, WorkspaceSnapshot } from "@vite-hub/workspace";
|
|
4
4
|
import { H3Event } from "h3";
|
|
5
|
-
//#region src/error-diagnostics.d.ts
|
|
6
5
|
/** The `data` of a `REALTIME_REQUEST_FAILED` error. */
|
|
7
6
|
type RealtimeRequestFailure = {
|
|
8
7
|
/** HTTP status of the server answer, such as `409` when the stored document changed. `undefined` for a network error. */
|
|
9
8
|
status: number | undefined;
|
|
10
9
|
};
|
|
11
|
-
//#endregion
|
|
12
|
-
//#region src/types.d.ts
|
|
13
10
|
/** JSON value stored in one field of a structured Realtime document. */
|
|
14
11
|
type RealtimeFieldValue = null | boolean | number | string | RealtimeFieldValue[] | {
|
|
15
12
|
[key: string]: RealtimeFieldValue;
|
|
@@ -198,7 +195,7 @@ type RealtimeDefinitionAccess = RealtimeDefinitionIdentity & ({
|
|
|
198
195
|
});
|
|
199
196
|
interface RealtimeDocumentFields {
|
|
200
197
|
document: RealtimeWorkspaceDocumentOptions | RealtimeDocumentAdapter;
|
|
201
|
-
editor?: RealtimeEditor | ((context: RealtimeDocumentContext) => RealtimeEditor);
|
|
198
|
+
editor?: RealtimeEditor | ((context: RealtimeDocumentContext) => RealtimeEditor | Promise<RealtimeEditor>);
|
|
202
199
|
history?: {
|
|
203
200
|
checkpoint: true | {
|
|
204
201
|
message?: string;
|
|
@@ -304,5 +301,4 @@ type RealtimeAvailability = {
|
|
|
304
301
|
reason: string;
|
|
305
302
|
fix: string;
|
|
306
303
|
};
|
|
307
|
-
//#endregion
|
|
308
304
|
export { RealtimeResetReason as A, RealtimeReadOnlyReason as C, RealtimeRequestErrorCode as D, RealtimeRequestError as E, RealtimeUser as F, RealtimeVerifyResult as I, RealtimeWorkspaceChange as L, RealtimeSaveOptions as M, RealtimeSaveResult as N, RealtimeRequestEvent as O, RealtimeSaved as P, RealtimeWorkspaceDocumentOptions as R, RealtimePresenceDefinition as S, RealtimeRequestContext as T, RealtimeLoadedDocument as _, RealtimeDefinition as a, RealtimePersistenceOptions as b, RealtimeDocumentContext as c, RealtimeDocumentStatus as d, RealtimeEditor as f, RealtimeIssue as g, RealtimeHoldOptions as h, RealtimeCheckpoint as i, RealtimeRoomRequestErrorCode as j, RealtimeRequestResult as k, RealtimeDocumentDefinition as l, RealtimeHistoryOptions as m, RealtimeAuthorizeContext as n, RealtimeDefinitionAccess as o, RealtimeFieldValue as p, RealtimeAvailability as r, RealtimeDocumentAdapter as s, DiscoveredRealtimeDefinition as t, RealtimeDocumentSnapshot as u, RealtimeOptions as v, RealtimeRegistry as w, RealtimePerson as x, RealtimeOriginContext as y, RealtimeRequestFailure as z };
|
package/dist/vite.d.ts
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import { t as DiscoveredRealtimeDefinition, v as RealtimeOptions } from "./types-
|
|
1
|
+
import { t as DiscoveredRealtimeDefinition, v as RealtimeOptions } from "./types-oUyN-CJR.js";
|
|
2
2
|
import { Plugin } from "vite";
|
|
3
|
-
//#region src/discovery.d.ts
|
|
4
3
|
export declare function discoverRealtimeDefinitions(rootDir: string, serverDirs?: string[]): DiscoveredRealtimeDefinition[];
|
|
5
|
-
//#endregion
|
|
6
|
-
//#region ../internal/src/deployment.d.ts
|
|
7
4
|
/** The host that ViteHub builds for: the `host` option of `vitehub()` and the value of `VITEHUB_HOST`. */
|
|
8
5
|
type ViteHubHost = "cloudflare" | "deno" | "netlify" | "node" | "vercel";
|
|
9
|
-
//#endregion
|
|
10
|
-
//#region ../internal/src/inspect.d.ts
|
|
11
6
|
interface ViteHubDefinitionField {
|
|
12
7
|
label: string;
|
|
13
8
|
value: string;
|
|
@@ -69,8 +64,6 @@ type ViteHubInspectionContributorFactory = () => ViteHubInspectionContributor |
|
|
|
69
64
|
interface ViteHubInspectionPluginMetadata {
|
|
70
65
|
inspect?: ViteHubInspectionContributor | ViteHubInspectionContributorFactory;
|
|
71
66
|
}
|
|
72
|
-
//#endregion
|
|
73
|
-
//#region ../internal/src/build/deployment-plan-output.d.ts
|
|
74
67
|
/**
|
|
75
68
|
* One set of host variables that the deployed app reads, as `deployment.json` lists it: a Server Env declaration, or
|
|
76
69
|
* a variable that a primitive reads itself, such as `VITEHUB_SECRET` or `BLOB_READ_WRITE_TOKEN`.
|
|
@@ -100,8 +93,6 @@ interface DeploymentEnvContext {
|
|
|
100
93
|
* Return names only, never values.
|
|
101
94
|
*/
|
|
102
95
|
type DeploymentEnvContribution = (context: DeploymentEnvContext) => readonly DeploymentEnvEntry[];
|
|
103
|
-
//#endregion
|
|
104
|
-
//#region ../internal/src/durability.d.ts
|
|
105
96
|
/**
|
|
106
97
|
* One durability reporter that a primitive's Vite plugin contributes through `vitehub.durability`. The Node server
|
|
107
98
|
* imports `export` from `module` at boot and calls it with `input` and the server environment. It returns the
|
|
@@ -124,11 +115,7 @@ interface DurabilityPluginMetadata {
|
|
|
124
115
|
/** Called after Vite resolves the config. Return an empty list when the primitive is off. */
|
|
125
116
|
durability?: () => readonly DurabilityContribution[];
|
|
126
117
|
}
|
|
127
|
-
//#endregion
|
|
128
|
-
//#region src/inspect.d.ts
|
|
129
118
|
type RealtimeInspectionDriver = "auto" | "cloudflare" | "memory" | "node" | "postgres" | "redis" | "unsupported";
|
|
130
|
-
//#endregion
|
|
131
|
-
//#region src/vite.d.ts
|
|
132
119
|
/** Where a contributed definition runs. */
|
|
133
120
|
export interface RealtimeContributionContext {
|
|
134
121
|
/**
|
|
@@ -180,4 +167,4 @@ export interface RealtimeInspectionOptions {
|
|
|
180
167
|
*/
|
|
181
168
|
export declare function inspectRealtimeDefinitions(options: RealtimeInspectionOptions): Promise<ViteHubDefinitionSummary[]>;
|
|
182
169
|
export declare function hubRealtime(options?: RealtimeVitePluginOptions): RealtimeVitePlugin;
|
|
183
|
-
|
|
170
|
+
export {};
|