@brass-build/client 0.4.0 → 0.5.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/AGENTS.md +142 -41
- package/CHANGELOG.md +93 -4
- package/README.md +666 -179
- package/dist/acting-organization.d.ts.map +1 -1
- package/dist/acting-organization.js +6 -11
- package/dist/acting-organization.js.map +1 -1
- package/dist/api-fetch.d.ts +8 -0
- package/dist/api-fetch.d.ts.map +1 -1
- package/dist/api-fetch.js +35 -8
- package/dist/api-fetch.js.map +1 -1
- package/dist/batched-get.d.ts +11 -0
- package/dist/batched-get.d.ts.map +1 -0
- package/dist/batched-get.js +92 -0
- package/dist/batched-get.js.map +1 -0
- package/dist/call-service.d.ts +4 -0
- package/dist/call-service.d.ts.map +1 -1
- package/dist/call-service.js +66 -3
- package/dist/call-service.js.map +1 -1
- package/dist/client.d.ts +51 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +982 -124
- package/dist/client.js.map +1 -1
- package/dist/document-checkpoints.d.ts +25 -2
- package/dist/document-checkpoints.d.ts.map +1 -1
- package/dist/document-checkpoints.js +258 -61
- package/dist/document-checkpoints.js.map +1 -1
- package/dist/document-commands.d.ts.map +1 -1
- package/dist/document-commands.js +5 -3
- package/dist/document-commands.js.map +1 -1
- package/dist/document-contents.d.ts +10 -0
- package/dist/document-contents.d.ts.map +1 -1
- package/dist/document-contents.js +23 -1
- package/dist/document-contents.js.map +1 -1
- package/dist/document-set-subscription.d.ts +56 -0
- package/dist/document-set-subscription.d.ts.map +1 -0
- package/dist/document-set-subscription.js +240 -0
- package/dist/document-set-subscription.js.map +1 -0
- package/dist/document-signals.d.ts +6 -0
- package/dist/document-signals.d.ts.map +1 -1
- package/dist/document-signals.js +31 -1
- package/dist/document-signals.js.map +1 -1
- package/dist/document-streams.d.ts +36 -2
- package/dist/document-streams.d.ts.map +1 -1
- package/dist/document-streams.js +69 -18
- package/dist/document-streams.js.map +1 -1
- package/dist/document-thumbnail-capture.d.ts +12 -2
- package/dist/document-thumbnail-capture.d.ts.map +1 -1
- package/dist/document-thumbnail-capture.js +103 -27
- package/dist/document-thumbnail-capture.js.map +1 -1
- package/dist/documents-namespace.d.ts +92 -10
- package/dist/documents-namespace.d.ts.map +1 -1
- package/dist/documents-namespace.js +285 -39
- package/dist/documents-namespace.js.map +1 -1
- package/dist/documents.d.ts +173 -8
- package/dist/documents.d.ts.map +1 -1
- package/dist/documents.js +1778 -310
- package/dist/documents.js.map +1 -1
- package/dist/errors.d.ts +3 -3
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/fetch-retry.d.ts +1 -0
- package/dist/fetch-retry.d.ts.map +1 -1
- package/dist/fetch-retry.js +2 -0
- package/dist/fetch-retry.js.map +1 -1
- package/dist/file-choice.d.ts +2 -0
- package/dist/file-choice.d.ts.map +1 -0
- package/dist/file-choice.js +27 -0
- package/dist/file-choice.js.map +1 -0
- package/dist/guest-link.d.ts +18 -1
- package/dist/guest-link.d.ts.map +1 -1
- package/dist/guest-link.js +329 -1
- package/dist/guest-link.js.map +1 -1
- package/dist/handle-types.d.ts +67 -5
- package/dist/handle-types.d.ts.map +1 -1
- package/dist/handles.d.ts +15 -19
- package/dist/handles.d.ts.map +1 -1
- package/dist/handles.js +231 -76
- package/dist/handles.js.map +1 -1
- package/dist/hosted-ui.d.ts +61 -0
- package/dist/hosted-ui.d.ts.map +1 -1
- package/dist/hosted-ui.js +94 -42
- package/dist/hosted-ui.js.map +1 -1
- package/dist/import-contract.d.ts +74 -0
- package/dist/import-contract.d.ts.map +1 -0
- package/dist/import-contract.js +163 -0
- package/dist/import-contract.js.map +1 -0
- package/dist/import-guest.d.ts +9 -0
- package/dist/import-guest.d.ts.map +1 -0
- package/dist/import-guest.js +155 -0
- package/dist/import-guest.js.map +1 -0
- package/dist/import-report.d.ts +17 -0
- package/dist/import-report.d.ts.map +1 -0
- package/dist/import-report.js +7 -0
- package/dist/import-report.js.map +1 -0
- package/dist/importer-wait.d.ts +2 -0
- package/dist/importer-wait.d.ts.map +1 -0
- package/dist/importer-wait.js +5 -0
- package/dist/importer-wait.js.map +1 -0
- package/dist/importer.d.ts +18 -4
- package/dist/importer.d.ts.map +1 -1
- package/dist/importer.js +322 -105
- package/dist/importer.js.map +1 -1
- package/dist/in-development.d.ts +2 -0
- package/dist/in-development.d.ts.map +1 -0
- package/dist/in-development.js +10 -0
- package/dist/in-development.js.map +1 -0
- package/dist/index.d.ts +16 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -8
- package/dist/index.js.map +1 -1
- package/dist/init-keys.d.ts +1 -1
- package/dist/init-keys.d.ts.map +1 -1
- package/dist/init-keys.js +6 -1
- package/dist/init-keys.js.map +1 -1
- package/dist/input-documents.d.ts +67 -0
- package/dist/input-documents.d.ts.map +1 -0
- package/dist/input-documents.js +693 -0
- package/dist/input-documents.js.map +1 -0
- package/dist/inputs-status.d.ts +80 -0
- package/dist/inputs-status.d.ts.map +1 -0
- package/dist/inputs-status.js +460 -0
- package/dist/inputs-status.js.map +1 -0
- package/dist/inputs.d.ts +2 -0
- package/dist/inputs.d.ts.map +1 -0
- package/dist/inputs.js +793 -0
- package/dist/inputs.js.map +1 -0
- package/dist/internal.d.ts +6 -1
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +4 -1
- package/dist/internal.js.map +1 -1
- package/dist/join-content.d.ts +33 -0
- package/dist/join-content.d.ts.map +1 -0
- package/dist/join-content.js +114 -0
- package/dist/join-content.js.map +1 -0
- package/dist/join-stamp.d.ts +3 -0
- package/dist/join-stamp.d.ts.map +1 -0
- package/dist/join-stamp.js +12 -0
- package/dist/join-stamp.js.map +1 -0
- package/dist/manifest-drift.d.ts +9 -0
- package/dist/manifest-drift.d.ts.map +1 -0
- package/dist/manifest-drift.js +46 -0
- package/dist/manifest-drift.js.map +1 -0
- package/dist/open-document.d.ts +109 -2
- package/dist/open-document.d.ts.map +1 -1
- package/dist/open-document.js +1822 -811
- package/dist/open-document.js.map +1 -1
- package/dist/page-restore.d.ts +12 -0
- package/dist/page-restore.d.ts.map +1 -0
- package/dist/page-restore.js +23 -0
- package/dist/page-restore.js.map +1 -0
- package/dist/placement.d.ts +13 -0
- package/dist/placement.d.ts.map +1 -0
- package/dist/placement.js +34 -0
- package/dist/placement.js.map +1 -0
- package/dist/presence.d.ts +1 -0
- package/dist/presence.d.ts.map +1 -1
- package/dist/presence.js +16 -4
- package/dist/presence.js.map +1 -1
- package/dist/read-only-document.d.ts +87 -0
- package/dist/read-only-document.d.ts.map +1 -0
- package/dist/read-only-document.js +4 -0
- package/dist/read-only-document.js.map +1 -0
- package/dist/record-paging.d.ts +63 -6
- package/dist/record-paging.d.ts.map +1 -1
- package/dist/record-paging.js +122 -29
- package/dist/record-paging.js.map +1 -1
- package/dist/references.d.ts +40 -0
- package/dist/references.d.ts.map +1 -0
- package/dist/references.js +135 -0
- package/dist/references.js.map +1 -0
- package/dist/request-lane.d.ts +5 -0
- package/dist/request-lane.d.ts.map +1 -0
- package/dist/request-lane.js +48 -0
- package/dist/request-lane.js.map +1 -0
- package/dist/sealed-arrow.d.ts +170 -0
- package/dist/sealed-arrow.d.ts.map +1 -0
- package/dist/sealed-arrow.js +769 -0
- package/dist/sealed-arrow.js.map +1 -0
- package/dist/sealed-cache.d.ts +21 -0
- package/dist/sealed-cache.d.ts.map +1 -0
- package/dist/sealed-cache.js +247 -0
- package/dist/sealed-cache.js.map +1 -0
- package/dist/sealed-encode.d.ts +87 -0
- package/dist/sealed-encode.d.ts.map +1 -0
- package/dist/sealed-encode.js +876 -0
- package/dist/sealed-encode.js.map +1 -0
- package/dist/sealed-handles.d.ts +45 -0
- package/dist/sealed-handles.d.ts.map +1 -0
- package/dist/sealed-handles.js +408 -0
- package/dist/sealed-handles.js.map +1 -0
- package/dist/sealed-store.d.ts +242 -0
- package/dist/sealed-store.d.ts.map +1 -0
- package/dist/sealed-store.js +1155 -0
- package/dist/sealed-store.js.map +1 -0
- package/dist/serializer.d.ts +6 -15
- package/dist/serializer.d.ts.map +1 -1
- package/dist/session-toolbar.d.ts +20 -5
- package/dist/session-toolbar.d.ts.map +1 -1
- package/dist/session-toolbar.js +419 -67
- package/dist/session-toolbar.js.map +1 -1
- package/dist/session.d.ts +38 -1
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +562 -79
- package/dist/session.js.map +1 -1
- package/dist/sha256.d.ts +3 -0
- package/dist/sha256.d.ts.map +1 -0
- package/dist/sha256.js +74 -0
- package/dist/sha256.js.map +1 -0
- package/dist/stable-handles.d.ts +19 -0
- package/dist/stable-handles.d.ts.map +1 -0
- package/dist/stable-handles.js +193 -0
- package/dist/stable-handles.js.map +1 -0
- package/dist/staged-seal.d.ts +2 -0
- package/dist/staged-seal.d.ts.map +1 -0
- package/dist/staged-seal.js +76 -0
- package/dist/staged-seal.js.map +1 -0
- package/dist/subscriber-delivery.d.ts +8 -0
- package/dist/subscriber-delivery.d.ts.map +1 -0
- package/dist/subscriber-delivery.js +31 -0
- package/dist/subscriber-delivery.js.map +1 -0
- package/dist/tail-op-import.d.ts +10 -0
- package/dist/tail-op-import.d.ts.map +1 -0
- package/dist/tail-op-import.js +33 -0
- package/dist/tail-op-import.js.map +1 -0
- package/dist/topic-lifecycle.d.ts +6 -0
- package/dist/topic-lifecycle.d.ts.map +1 -1
- package/dist/topic-lifecycle.js +32 -2
- package/dist/topic-lifecycle.js.map +1 -1
- package/dist/trial-replace-dialog.d.ts +10 -0
- package/dist/trial-replace-dialog.d.ts.map +1 -0
- package/dist/trial-replace-dialog.js +153 -0
- package/dist/trial-replace-dialog.js.map +1 -0
- package/dist/types.d.ts +8 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/undo.d.ts +60 -5
- package/dist/undo.d.ts.map +1 -1
- package/dist/undo.js +344 -75
- package/dist/undo.js.map +1 -1
- package/dist/version-bar.d.ts +1 -0
- package/dist/version-bar.d.ts.map +1 -1
- package/dist/version-bar.js +2 -1
- package/dist/version-bar.js.map +1 -1
- package/dist/version.d.ts +2 -2
- package/dist/version.js +1 -1
- package/dist/ws-client.d.ts +21 -0
- package/dist/ws-client.d.ts.map +1 -1
- package/dist/ws-client.js +192 -8
- package/dist/ws-client.js.map +1 -1
- package/dist/ws-frame-limit.d.ts +1 -0
- package/dist/ws-frame-limit.d.ts.map +1 -1
- package/dist/ws-frame-limit.js.map +1 -1
- package/docs/app-manifest.md +121 -17
- package/docs/custom-chrome.md +24 -16
- package/docs/hosted-ui-advanced.md +38 -6
- package/docs/imported-documents.md +104 -51
- package/docs/presence.md +16 -4
- package/docs/schemas.md +8 -5
- package/docs/services.md +6 -6
- package/docs/streams.md +139 -150
- package/docs/text-fields.md +26 -19
- package/package.json +5 -2
- package/src/acting-organization.ts +6 -12
- package/src/api-fetch.ts +53 -3
- package/src/auth-flow.ts +1 -1
- package/src/batched-get.ts +117 -0
- package/src/call-service.ts +78 -3
- package/src/client.ts +1092 -121
- package/src/document-checkpoints.ts +307 -65
- package/src/document-commands.ts +5 -5
- package/src/document-contents.ts +27 -1
- package/src/document-set-subscription.ts +274 -0
- package/src/document-signals.ts +47 -5
- package/src/document-streams.ts +85 -16
- package/src/document-thumbnail-capture.ts +118 -32
- package/src/documents-namespace.ts +539 -84
- package/src/documents.ts +2017 -348
- package/src/errors.ts +17 -6
- package/src/fetch-retry.ts +5 -0
- package/src/file-choice.ts +26 -0
- package/src/guest-link.ts +362 -1
- package/src/handle-types.ts +73 -47
- package/src/handles.ts +253 -83
- package/src/hosted-ui.ts +211 -50
- package/src/import-contract.ts +227 -0
- package/src/import-guest.ts +193 -0
- package/src/import-report.ts +24 -0
- package/src/importer-wait.ts +4 -0
- package/src/importer.ts +386 -131
- package/src/in-development.ts +10 -0
- package/src/index.ts +76 -16
- package/src/init-keys.ts +6 -1
- package/src/input-documents.ts +819 -0
- package/src/inputs-status.ts +598 -0
- package/src/inputs.ts +1090 -0
- package/src/internal.ts +7 -0
- package/src/join-content.ts +135 -0
- package/src/join-stamp.ts +12 -0
- package/src/manifest-drift.ts +54 -0
- package/src/open-document.ts +2346 -930
- package/src/page-restore.ts +38 -0
- package/src/placement.ts +54 -0
- package/src/presence.ts +21 -5
- package/src/read-only-document.ts +133 -0
- package/src/record-paging.ts +147 -25
- package/src/references.ts +207 -0
- package/src/request-lane.ts +59 -0
- package/src/sealed-arrow.ts +843 -0
- package/src/sealed-cache.ts +267 -0
- package/src/sealed-encode.ts +1015 -0
- package/src/sealed-handles.ts +486 -0
- package/src/sealed-store.ts +1330 -0
- package/src/serializer.ts +8 -20
- package/src/session-toolbar.ts +463 -72
- package/src/session.ts +740 -99
- package/src/sha256.ts +65 -0
- package/src/stable-handles.ts +235 -0
- package/src/staged-seal.ts +90 -0
- package/src/subscriber-delivery.ts +37 -0
- package/src/tail-op-import.ts +30 -0
- package/src/topic-lifecycle.ts +38 -2
- package/src/trial-replace-dialog.ts +163 -0
- package/src/types.ts +6 -6
- package/src/undo.ts +386 -73
- package/src/version-bar.ts +5 -1
- package/src/version.ts +1 -1
- package/src/ws-client.ts +208 -16
- package/src/ws-frame-limit.ts +1 -0
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { type PackedRecord } from './record-paging.js';
|
|
2
|
+
import type { ArrowReader } from './sealed-arrow.js';
|
|
3
|
+
/**
|
|
4
|
+
* The peer every conversion of frozen content into a CRDT authors as.
|
|
5
|
+
*
|
|
6
|
+
* Pinned, so one frozen stream produces one document: two sides that convert
|
|
7
|
+
* the same content independently write the same ops, and their later edits
|
|
8
|
+
* merge rather than doubling every record.
|
|
9
|
+
*
|
|
10
|
+
* A live editor never authors as this peer. It keeps the one its own document
|
|
11
|
+
* was opened with, so every op it writes after a conversion is its own.
|
|
12
|
+
*/
|
|
13
|
+
export declare const CONVERSION_PEER_ID: "1";
|
|
14
|
+
/** Named roots, every map as typed Arrow tables, the whole stream one ZSTD
|
|
15
|
+
* frame. What the platform stores; only its encoder writes it. */
|
|
16
|
+
export declare const VERSION_ARROW = 4;
|
|
17
|
+
/** Frame 4's body under gzip rather than ZSTD: what a producer without a ZSTD
|
|
18
|
+
* compressor (a browser) uploads. Staging only; the seal stores it as frame
|
|
19
|
+
* 4, so no reader is ever handed it. */
|
|
20
|
+
export declare const VERSION_ARROW_STAGED = 5;
|
|
21
|
+
/** The newest frame this build reads. */
|
|
22
|
+
export declare const NEWEST_VERSION = 4;
|
|
23
|
+
/** The join `accept` token naming the stored frames this build decodes. */
|
|
24
|
+
export declare const SEALED_ACCEPT = "sealed@4";
|
|
25
|
+
/** One root of frozen content, as JSON: an object is a map, an array a list,
|
|
26
|
+
* a string a text. */
|
|
27
|
+
export type SealedRootValue = Record<string, unknown> | readonly unknown[] | string;
|
|
28
|
+
/** A stream's content as JSON, one entry per root. */
|
|
29
|
+
export type SealedContentJson = Record<string, SealedRootValue>;
|
|
30
|
+
export type SealedRootKind = 'map' | 'list' | 'text';
|
|
31
|
+
/** The kind a JSON value would be stored as, or null for a value no root can
|
|
32
|
+
* hold. */
|
|
33
|
+
export declare function sealedRootKindOf(value: unknown): SealedRootKind | null;
|
|
34
|
+
/** One header entry of a record store: the format's own preamble (an IFC
|
|
35
|
+
* `FILE_DESCRIPTION`, a DXF header variable), tagged the way a record is. */
|
|
36
|
+
export interface SealedHeaderEntry {
|
|
37
|
+
tag: string;
|
|
38
|
+
body: unknown;
|
|
39
|
+
}
|
|
40
|
+
/** What produced a stream's content: an importer's id and version. A reader
|
|
41
|
+
* answers from the content whoever produced it; this is for deciding which
|
|
42
|
+
* stored streams an importer fix should rebuild. */
|
|
43
|
+
export interface SealedStoreBuiltBy {
|
|
44
|
+
id: string;
|
|
45
|
+
version: string;
|
|
46
|
+
}
|
|
47
|
+
/** A record store as triples, which is what a caller holding parsed records
|
|
48
|
+
* hands the encoder without first building a map object from them. */
|
|
49
|
+
export interface SealedStoreSource {
|
|
50
|
+
schemaVersion: string;
|
|
51
|
+
header: readonly SealedHeaderEntry[];
|
|
52
|
+
/** Absent for content nothing parsed (an app's own). */
|
|
53
|
+
builtBy?: SealedStoreBuiltBy;
|
|
54
|
+
/** `[key, tag, body]` triples in the order the store holds them. */
|
|
55
|
+
records: PackedRecord<unknown>[];
|
|
56
|
+
}
|
|
57
|
+
/** A record-store entry split into its tag and body: the tag of a value in
|
|
58
|
+
* the record shape (`{ type, params }` and nothing else), or null for any
|
|
59
|
+
* other value, which is the body whole. `recordValueOf` rebuilds the value. */
|
|
60
|
+
export interface SealedRecord {
|
|
61
|
+
tag: string | null;
|
|
62
|
+
body: unknown;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* One map root of frozen content, stored or held in memory.
|
|
66
|
+
*
|
|
67
|
+
* Opening one decodes nothing. A keyed read builds the record it asks for;
|
|
68
|
+
* `forEach` walks the records in stored order without keeping them. Values
|
|
69
|
+
* are the stored JSON values, built afresh on every read.
|
|
70
|
+
*/
|
|
71
|
+
export interface SealedMapReader {
|
|
72
|
+
/** Entries in the map. */
|
|
73
|
+
size(): number;
|
|
74
|
+
has(key: string): boolean;
|
|
75
|
+
get(key: string): unknown;
|
|
76
|
+
/** Every key, in stored order. */
|
|
77
|
+
keys(): string[];
|
|
78
|
+
/** Every entry, in stored order. */
|
|
79
|
+
forEach(visit: (key: string, value: unknown) => void): void;
|
|
80
|
+
/** Every entry, in stored order, decoded as the iteration reaches it: a
|
|
81
|
+
* caller that stops early pays for the records it read. */
|
|
82
|
+
entries(): IterableIterator<[string, unknown]>;
|
|
83
|
+
/** The JSON text of every value, in bytes. Reads every value. */
|
|
84
|
+
valueBytes(): number;
|
|
85
|
+
/** The whole map as the object it was stored from. */
|
|
86
|
+
toJSON(): Record<string, unknown>;
|
|
87
|
+
/** Drop what keyed reads decoded and kept. */
|
|
88
|
+
releaseDecoded(): void;
|
|
89
|
+
}
|
|
90
|
+
/** A value split the way a record store reports it. */
|
|
91
|
+
export declare function sealedRecordOf(value: unknown): SealedRecord;
|
|
92
|
+
/** Whether a byte run opens as frozen content THIS reader can read. Cheap
|
|
93
|
+
* enough to ask of any object, since it reads the first five bytes. */
|
|
94
|
+
export declare function isSealedStore(bytes: Uint8Array): boolean;
|
|
95
|
+
/** The frame version stamped on frozen content, or null for bytes that are
|
|
96
|
+
* not frozen content. */
|
|
97
|
+
export declare function frameVersion(bytes: Uint8Array): number | null;
|
|
98
|
+
/** Frozen content that could not be read. The message names the content
|
|
99
|
+
* rather than the field that failed, because every way this throws means the
|
|
100
|
+
* bytes are not content this reader can open. */
|
|
101
|
+
export declare class SealedStoreError extends Error {
|
|
102
|
+
/** The error the decoder raised, where this wraps one. */
|
|
103
|
+
readonly underlying?: unknown | undefined;
|
|
104
|
+
constructor(message?: string,
|
|
105
|
+
/** The error the decoder raised, where this wraps one. */
|
|
106
|
+
underlying?: unknown | undefined);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Decoded frozen content: the frame read and every root located, or content
|
|
110
|
+
* held in memory (`fromJSON`, `fromRecords`) with the same roots, so a reader
|
|
111
|
+
* never asks which one it holds.
|
|
112
|
+
*/
|
|
113
|
+
export declare class SealedContent {
|
|
114
|
+
private readonly _bytes;
|
|
115
|
+
private readonly _roots;
|
|
116
|
+
private readonly _builtBy;
|
|
117
|
+
private constructor();
|
|
118
|
+
/** Read the frame. Throws `SealedStoreError` for bytes that are not frozen
|
|
119
|
+
* content, or whose frame does not fit inside them. */
|
|
120
|
+
static decode(bytes: Uint8Array): SealedContent;
|
|
121
|
+
/**
|
|
122
|
+
* Content held in memory, as `decode` reads the same content stored.
|
|
123
|
+
* CONSUMES the map values, as `sealedTablesOfImport` does. Throws for a
|
|
124
|
+
* root that is not a map, a list or a string.
|
|
125
|
+
*/
|
|
126
|
+
static fromJSON(content: SealedContentJson, builtBy?: SealedStoreBuiltBy): SealedContent;
|
|
127
|
+
/** A record store handed over as triples, held in memory. CONSUMES
|
|
128
|
+
* `source.records`. */
|
|
129
|
+
static fromRecords(source: SealedStoreSource): SealedContent;
|
|
130
|
+
/** The content's own size, which is what it costs to hold and transfer. */
|
|
131
|
+
get byteLength(): number;
|
|
132
|
+
/** The importer that produced the content, or null for content that names
|
|
133
|
+
* none. */
|
|
134
|
+
builtBy(): SealedStoreBuiltBy | null;
|
|
135
|
+
rootNames(): string[];
|
|
136
|
+
kindOf(name: string): SealedRootKind | undefined;
|
|
137
|
+
/** A map root as a lazy reader, or null when the content holds no such
|
|
138
|
+
* map. */
|
|
139
|
+
mapRoot(name: string): SealedMapReader | null;
|
|
140
|
+
/** The map a list root is the key walk of (an ordered map's order list), or
|
|
141
|
+
* null for a list stored with items of its own. */
|
|
142
|
+
keyWalkOf(name: string): string | null;
|
|
143
|
+
/** Every entry of a map root, in stored order, without building the
|
|
144
|
+
* object. */
|
|
145
|
+
forEachMapEntry(name: string, visit: (key: string, value: unknown) => void): void;
|
|
146
|
+
/** A map root as an object, or null when the content holds no such map. */
|
|
147
|
+
map(name: string): Record<string, unknown> | null;
|
|
148
|
+
/** A list root's items, or null when the content holds no such list. */
|
|
149
|
+
list(name: string): unknown[] | null;
|
|
150
|
+
/** A text root, or null when the content holds no such text. */
|
|
151
|
+
text(name: string): string | null;
|
|
152
|
+
/** The whole content as the JSON it was encoded from. */
|
|
153
|
+
toJSON(): SealedContentJson;
|
|
154
|
+
}
|
|
155
|
+
/** What a frame-4 decode calls. Each decompressor refuses output past `max`. */
|
|
156
|
+
export interface SealedCodec {
|
|
157
|
+
arrow: ArrowReader;
|
|
158
|
+
unzstd(bytes: Uint8Array, max: number): Uint8Array;
|
|
159
|
+
gunzip(bytes: Uint8Array, max: number): Uint8Array;
|
|
160
|
+
reader: typeof import('./sealed-arrow.js');
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* The most a frame-4 or staging-frame body expands to. The encoder refuses to
|
|
164
|
+
* write tables past it and the decoder refuses a body that would expand past
|
|
165
|
+
* it, so every stored line is one every reader decodes, and a body an
|
|
166
|
+
* uploader shaped to expand further is refused before it is decompressed.
|
|
167
|
+
* The densest import measured (2.85M IFC geometry records) expands to 68 MB,
|
|
168
|
+
* and a 128 MiB CSV of single-digit cells to about 285 MB.
|
|
169
|
+
*/
|
|
170
|
+
export declare const SEALED_INNER_MAX_BYTES: number;
|
|
171
|
+
/** Content whose tables would expand past `SEALED_INNER_MAX_BYTES`. */
|
|
172
|
+
export declare class SealedContentTooLargeError extends SealedStoreError {
|
|
173
|
+
constructor();
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* The most a ZSTD stream can write or allocate, read from its frame and block
|
|
177
|
+
* headers without decompressing it: per frame its window, and its declared
|
|
178
|
+
* content size, which a decoder holds the frame's output to. A frame that
|
|
179
|
+
* declares none is bounded by its blocks: each raw or RLE block's stated size
|
|
180
|
+
* plus the format's 128 KiB ceiling per compressed block, which overstates a
|
|
181
|
+
* level-19 frame (its blocks average a few KB). Both encoders here declare the
|
|
182
|
+
* size. Throws on a stream that is not ZSTD frames end to end.
|
|
183
|
+
*/
|
|
184
|
+
export declare function zstdOutputBound(bytes: Uint8Array): number;
|
|
185
|
+
/** Whether decoding these bytes needs `loadSealedCodec` first. */
|
|
186
|
+
export declare function needsSealedCodec(bytes: Uint8Array): boolean;
|
|
187
|
+
/** Load what a frame-4 decode needs. Under a Node that carries zstd, the
|
|
188
|
+
* built-in decompresses; anywhere else, `fzstd`. */
|
|
189
|
+
export declare function loadSealedCodec(): Promise<void>;
|
|
190
|
+
/** Decode frozen bytes, loading the frame-4 codec first when they need it.
|
|
191
|
+
* A frame-4 decode awaits `pause` before each table it parses, so a large
|
|
192
|
+
* decode leaves the page responsive. */
|
|
193
|
+
export declare function decodeSealedContent(bytes: Uint8Array, pause?: () => Promise<void>): Promise<SealedContent>;
|
|
194
|
+
/** A pause that hands the event loop back once `sliceMs` of work has run
|
|
195
|
+
* since the last time it did. */
|
|
196
|
+
export declare function slicedYield(sliceMs?: number): () => Promise<void>;
|
|
197
|
+
/** Hands the event loop back for one turn: `scheduler.yield` where the
|
|
198
|
+
* platform has it, else a message, which no timer clamp delays. */
|
|
199
|
+
export declare function yieldToEventLoop(): Promise<void>;
|
|
200
|
+
/** A frame-4 object around its ZSTD-compressed parts, or with
|
|
201
|
+
* `VERSION_ARROW_STAGED`, the staging frame around its gzipped parts. */
|
|
202
|
+
export declare function arrowFrameBytes(compressed: Uint8Array, version?: number): Uint8Array;
|
|
203
|
+
/** A frame-4 or staging-frame object's compressed parts. */
|
|
204
|
+
export declare function arrowFrameBody(bytes: Uint8Array): Uint8Array;
|
|
205
|
+
/**
|
|
206
|
+
* A frame-4 or staging-frame object's parts, decompressed. Throws
|
|
207
|
+
* `SealedContentTooLargeError` for a body that expands past
|
|
208
|
+
* `SEALED_INNER_MAX_BYTES`, and needs `loadSealedCodec` first.
|
|
209
|
+
*/
|
|
210
|
+
export declare function arrowFrameInner(bytes: Uint8Array): Uint8Array;
|
|
211
|
+
/** The manifest part's name; table parts are named by their position. */
|
|
212
|
+
export declare const ARROW_MANIFEST_PART = "manifest";
|
|
213
|
+
export type ArrowManifestRoot = ['map', string] | ['list', string, unknown[]] | ['list', string, null, string] | ['text', string, string];
|
|
214
|
+
export type ArrowManifest = [[string, string] | null, ArrowManifestRoot[]];
|
|
215
|
+
/**
|
|
216
|
+
* Frozen content read as a record store: the `instances` map, its order, the
|
|
217
|
+
* schema version and the header. Every server-side reader that walks records
|
|
218
|
+
* (an exporter, a view) reads through this, and it answers for any frozen
|
|
219
|
+
* content: a root the content does not hold reads as empty.
|
|
220
|
+
*/
|
|
221
|
+
export declare class SealedStore {
|
|
222
|
+
private readonly _content;
|
|
223
|
+
private readonly _records;
|
|
224
|
+
private constructor();
|
|
225
|
+
static decode(bytes: Uint8Array): SealedStore;
|
|
226
|
+
static of(content: SealedContent): SealedStore;
|
|
227
|
+
/** The general form this view reads. */
|
|
228
|
+
get content(): SealedContent;
|
|
229
|
+
get byteLength(): number;
|
|
230
|
+
/** The schema version, the `meta` root's one key. */
|
|
231
|
+
schemaVersion(): string;
|
|
232
|
+
/** The header entries in the record shape, in order. */
|
|
233
|
+
header(): SealedHeaderEntry[];
|
|
234
|
+
builtBy(): SealedStoreBuiltBy | null;
|
|
235
|
+
keys(): string[];
|
|
236
|
+
recordCount(): number;
|
|
237
|
+
has(key: string): boolean;
|
|
238
|
+
get(key: string): SealedRecord | undefined;
|
|
239
|
+
forEachRecord(visit: (key: string, tag: string | null, body: unknown) => void): void;
|
|
240
|
+
releaseDecoded(): void;
|
|
241
|
+
}
|
|
242
|
+
//# sourceMappingURL=sealed-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sealed-store.d.ts","sourceRoot":"","sources":["../src/sealed-store.ts"],"names":[],"mappings":"AA8BA,OAAO,EAOL,KAAK,YAAY,EAClB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAa,WAAW,EAAsC,MAAM,mBAAmB,CAAC;AAEpG;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,EAAG,GAAY,CAAC;AAK/C;mEACmE;AACnE,eAAO,MAAM,aAAa,IAAI,CAAC;AAC/B;;yCAEyC;AACzC,eAAO,MAAM,oBAAoB,IAAI,CAAC;AACtC,yCAAyC;AACzC,eAAO,MAAM,cAAc,IAAgB,CAAC;AAE5C,2EAA2E;AAC3E,eAAO,MAAM,aAAa,aAA4B,CAAC;AAMvD;uBACuB;AACvB,MAAM,MAAM,eAAe,GACvB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACvB,SAAS,OAAO,EAAE,GAClB,MAAM,CAAC;AAEX,sDAAsD;AACtD,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;AAEhE,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AAErD;YACY;AACZ,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,cAAc,GAAG,IAAI,CAKtE;AAED;8EAC8E;AAC9E,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,OAAO,CA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