@g9tm/syncdata 1.2.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/LICENSE.md +21 -0
- package/PARITY.md +71 -0
- package/README.md +71 -0
- package/THIRD-PARTY-NOTICES.md +31 -0
- package/dist/abstractions/digest.d.ts +27 -0
- package/dist/abstractions/digest.js +78 -0
- package/dist/abstractions/digest.js.map +1 -0
- package/dist/abstractions/enums.d.ts +42 -0
- package/dist/abstractions/enums.js +60 -0
- package/dist/abstractions/enums.js.map +1 -0
- package/dist/abstractions/errors.d.ts +72 -0
- package/dist/abstractions/errors.js +90 -0
- package/dist/abstractions/errors.js.map +1 -0
- package/dist/abstractions/guid.d.ts +24 -0
- package/dist/abstractions/guid.js +93 -0
- package/dist/abstractions/guid.js.map +1 -0
- package/dist/abstractions/key.d.ts +16 -0
- package/dist/abstractions/key.js +47 -0
- package/dist/abstractions/key.js.map +1 -0
- package/dist/abstractions/long.d.ts +103 -0
- package/dist/abstractions/long.js +351 -0
- package/dist/abstractions/long.js.map +1 -0
- package/dist/abstractions/parameters.d.ts +49 -0
- package/dist/abstractions/parameters.js +153 -0
- package/dist/abstractions/parameters.js.map +1 -0
- package/dist/brotli-js/decode.d.ts +8 -0
- package/dist/brotli-js/decode.js +2004 -0
- package/dist/brotli-js/decode.js.map +1 -0
- package/dist/brotli-js/index.d.ts +5 -0
- package/dist/brotli-js/index.js +19 -0
- package/dist/brotli-js/index.js.map +1 -0
- package/dist/client/engine.d.ts +110 -0
- package/dist/client/engine.js +1158 -0
- package/dist/client/engine.js.map +1 -0
- package/dist/client/model.d.ts +61 -0
- package/dist/client/model.js +154 -0
- package/dist/client/model.js.map +1 -0
- package/dist/client/progress.d.ts +101 -0
- package/dist/client/progress.js +251 -0
- package/dist/client/progress.js.map +1 -0
- package/dist/client/runs.d.ts +219 -0
- package/dist/client/runs.js +239 -0
- package/dist/client/runs.js.map +1 -0
- package/dist/client/storeTypes.d.ts +428 -0
- package/dist/client/storeTypes.js +256 -0
- package/dist/client/storeTypes.js.map +1 -0
- package/dist/client/transport.d.ts +19 -0
- package/dist/client/transport.js +2 -0
- package/dist/client/transport.js.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/abort.d.ts +21 -0
- package/dist/internal/abort.js +125 -0
- package/dist/internal/abort.js.map +1 -0
- package/dist/internal/base64.d.ts +8 -0
- package/dist/internal/base64.js +85 -0
- package/dist/internal/base64.js.map +1 -0
- package/dist/internal/dotnetFormat.d.ts +32 -0
- package/dist/internal/dotnetFormat.js +207 -0
- package/dist/internal/dotnetFormat.js.map +1 -0
- package/dist/internal/md5.d.ts +2 -0
- package/dist/internal/md5.js +97 -0
- package/dist/internal/md5.js.map +1 -0
- package/dist/internal/sha256.d.ts +20 -0
- package/dist/internal/sha256.js +153 -0
- package/dist/internal/sha256.js.map +1 -0
- package/dist/internal/utf8.d.ts +8 -0
- package/dist/internal/utf8.js +143 -0
- package/dist/internal/utf8.js.map +1 -0
- package/dist/node/index.d.ts +9 -0
- package/dist/node/index.js +35 -0
- package/dist/node/index.js.map +1 -0
- package/dist/node/sqliteDriver.d.ts +11 -0
- package/dist/node/sqliteDriver.js +252 -0
- package/dist/node/sqliteDriver.js.map +1 -0
- package/dist/protocol/dtos.d.ts +280 -0
- package/dist/protocol/dtos.js +33 -0
- package/dist/protocol/dtos.js.map +1 -0
- package/dist/protocol/protocol.d.ts +36 -0
- package/dist/protocol/protocol.js +63 -0
- package/dist/protocol/protocol.js.map +1 -0
- package/dist/protocol/rowBatch/columnLayout.d.ts +4 -0
- package/dist/protocol/rowBatch/columnLayout.js +309 -0
- package/dist/protocol/rowBatch/columnLayout.js.map +1 -0
- package/dist/protocol/rowBatch/format.d.ts +74 -0
- package/dist/protocol/rowBatch/format.js +163 -0
- package/dist/protocol/rowBatch/format.js.map +1 -0
- package/dist/protocol/rowBatch/reader.d.ts +119 -0
- package/dist/protocol/rowBatch/reader.js +459 -0
- package/dist/protocol/rowBatch/reader.js.map +1 -0
- package/dist/protocol/rowBatch/writer.d.ts +101 -0
- package/dist/protocol/rowBatch/writer.js +412 -0
- package/dist/protocol/rowBatch/writer.js.map +1 -0
- package/dist/protocol/wire.d.ts +32 -0
- package/dist/protocol/wire.js +329 -0
- package/dist/protocol/wire.js.map +1 -0
- package/dist/signalr/index.d.ts +2 -0
- package/dist/signalr/index.js +5 -0
- package/dist/signalr/index.js.map +1 -0
- package/dist/signalr/protocols.d.ts +17 -0
- package/dist/signalr/protocols.js +109 -0
- package/dist/signalr/protocols.js.map +1 -0
- package/dist/signalr/transport.d.ts +67 -0
- package/dist/signalr/transport.js +286 -0
- package/dist/signalr/transport.js.map +1 -0
- package/dist/sqlite/apply.d.ts +91 -0
- package/dist/sqlite/apply.js +657 -0
- package/dist/sqlite/apply.js.map +1 -0
- package/dist/sqlite/commands.d.ts +24 -0
- package/dist/sqlite/commands.js +167 -0
- package/dist/sqlite/commands.js.map +1 -0
- package/dist/sqlite/connection.d.ts +81 -0
- package/dist/sqlite/connection.js +322 -0
- package/dist/sqlite/connection.js.map +1 -0
- package/dist/sqlite/driver.d.ts +63 -0
- package/dist/sqlite/driver.js +9 -0
- package/dist/sqlite/driver.js.map +1 -0
- package/dist/sqlite/index.d.ts +6 -0
- package/dist/sqlite/index.js +7 -0
- package/dist/sqlite/index.js.map +1 -0
- package/dist/sqlite/internals.d.ts +63 -0
- package/dist/sqlite/internals.js +194 -0
- package/dist/sqlite/internals.js.map +1 -0
- package/dist/sqlite/options.d.ts +78 -0
- package/dist/sqlite/options.js +78 -0
- package/dist/sqlite/options.js.map +1 -0
- package/dist/sqlite/push.d.ts +9 -0
- package/dist/sqlite/push.js +272 -0
- package/dist/sqlite/push.js.map +1 -0
- package/dist/sqlite/query.d.ts +38 -0
- package/dist/sqlite/query.js +476 -0
- package/dist/sqlite/query.js.map +1 -0
- package/dist/sqlite/revocation.d.ts +28 -0
- package/dist/sqlite/revocation.js +337 -0
- package/dist/sqlite/revocation.js.map +1 -0
- package/dist/sqlite/sql.d.ts +60 -0
- package/dist/sqlite/sql.js +324 -0
- package/dist/sqlite/sql.js.map +1 -0
- package/dist/sqlite/store.d.ts +116 -0
- package/dist/sqlite/store.js +664 -0
- package/dist/sqlite/store.js.map +1 -0
- package/dist/sqlite/values.d.ts +29 -0
- package/dist/sqlite/values.js +288 -0
- package/dist/sqlite/values.js.map +1 -0
- package/dist/testing/index.d.ts +61 -0
- package/dist/testing/index.js +175 -0
- package/dist/testing/index.js.map +1 -0
- package/package.json +104 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { G9Long } from '../../abstractions/long.js';
|
|
2
|
+
import { type DecimalParts } from '../../internal/dotnetFormat.js';
|
|
3
|
+
/** A DateTime value on the wire: ticks (100 ns since 0001-01-01) and the `DateTimeKind` (0 unspecified, 1 UTC, 2 local). */
|
|
4
|
+
export interface G9DateTimeValue {
|
|
5
|
+
ticks: G9Long;
|
|
6
|
+
kind: number;
|
|
7
|
+
}
|
|
8
|
+
/** A DateTimeOffset value on the wire: UTC ticks and the offset in minutes. */
|
|
9
|
+
export interface G9DateTimeOffsetValue {
|
|
10
|
+
utcTicks: G9Long;
|
|
11
|
+
offsetMinutes: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A compressor for push frames. Optional: without one the writer emits uncompressed frames, which every reader
|
|
15
|
+
* accepts (the .NET writer falls back to them whenever compression does not help).
|
|
16
|
+
*/
|
|
17
|
+
export interface G9FrameCompressor {
|
|
18
|
+
compress(body: Uint8Array, quality: number, window: number): Uint8Array | null;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Writes a G9RowBatch frame: a 10-byte header (`'G' '9' 'R' 'B' | version | compression | body length i32 LE`) and a
|
|
22
|
+
* body of sections, each holding rows of one table and one op.
|
|
23
|
+
*/
|
|
24
|
+
export declare class G9RowBatchWriter {
|
|
25
|
+
private _buffer;
|
|
26
|
+
private _length;
|
|
27
|
+
private _sectionCount;
|
|
28
|
+
private _totalRows;
|
|
29
|
+
private _inSection;
|
|
30
|
+
private _op;
|
|
31
|
+
private _keyType;
|
|
32
|
+
private _types;
|
|
33
|
+
private _rowCountPosition;
|
|
34
|
+
private _sectionRows;
|
|
35
|
+
private _inRow;
|
|
36
|
+
private _rowHasValues;
|
|
37
|
+
private _column;
|
|
38
|
+
private _bitmapPosition;
|
|
39
|
+
constructor(initialCapacity?: number);
|
|
40
|
+
/** Uncompressed body length written so far. */
|
|
41
|
+
get length(): number;
|
|
42
|
+
get totalRows(): number;
|
|
43
|
+
get sectionCount(): number;
|
|
44
|
+
get currentSectionRows(): number;
|
|
45
|
+
get inSection(): boolean;
|
|
46
|
+
/** Starts a section. Key-only ops (Tombstone, MoveOut, KeyVersions) take no column types. */
|
|
47
|
+
beginSection(op: number, tableId: number, keyType: number, columnTypes: readonly number[]): void;
|
|
48
|
+
endSection(): void;
|
|
49
|
+
/** Starts an Upsert or Backfill row; write every column, then {@link endRow}. `key` is canonical key text. */
|
|
50
|
+
beginRow(key: string, version: number | G9Long): void;
|
|
51
|
+
/** Adds a complete Tombstone or MoveOut row. */
|
|
52
|
+
addKey(key: string, version: number | G9Long): void;
|
|
53
|
+
/** Adds a complete KeyVersions row. */
|
|
54
|
+
addKeyVersion(key: string, version: number | G9Long, rowHash: G9Long): void;
|
|
55
|
+
/** Starts a Push row. Upserts must then write every column; deletes write none. Finish with {@link endRow}. */
|
|
56
|
+
beginPushRow(key: string, op: number, sequence: number | G9Long, baseVersion: number | G9Long, dirtyMask: G9Long, hlcMs: number | G9Long): void;
|
|
57
|
+
/** Completes a row started with beginRow or beginPushRow. */
|
|
58
|
+
endRow(): void;
|
|
59
|
+
writeNull(): void;
|
|
60
|
+
writeBoolean(value: boolean): void;
|
|
61
|
+
writeInt32(value: number): void;
|
|
62
|
+
writeInt64(value: number | G9Long): void;
|
|
63
|
+
writeDouble(value: number): void;
|
|
64
|
+
/** A decimal: its .NET parts, or invariant decimal text. */
|
|
65
|
+
writeDecimal(value: DecimalParts | string): void;
|
|
66
|
+
/** Writes a string, or NULL when `value` is null. */
|
|
67
|
+
writeString(value: string | null): void;
|
|
68
|
+
/** Writes a string that is already UTF-8 encoded. */
|
|
69
|
+
writeStringUtf8(utf8: Uint8Array): void;
|
|
70
|
+
/** Writes a GUID given as text in any form `Guid.Parse` accepts. */
|
|
71
|
+
writeGuid(value: string): void;
|
|
72
|
+
writeDateTime(value: G9DateTimeValue): void;
|
|
73
|
+
writeDateTimeOffset(value: G9DateTimeOffsetValue): void;
|
|
74
|
+
/** A TimeSpan as ticks. */
|
|
75
|
+
writeTimeSpan(ticks: number | G9Long): void;
|
|
76
|
+
writeBytes(value: Uint8Array): void;
|
|
77
|
+
/**
|
|
78
|
+
* Produces the frame. With a compressor and `compression` Brotli, the body is compressed when it is over 128 bytes
|
|
79
|
+
* and compression helps; otherwise the frame is uncompressed. `version` 2 writes the column-grouped layout (only for
|
|
80
|
+
* a peer that asked for it).
|
|
81
|
+
*/
|
|
82
|
+
toFrame(options?: {
|
|
83
|
+
compression?: number;
|
|
84
|
+
quality?: number;
|
|
85
|
+
version?: number;
|
|
86
|
+
compressor?: G9FrameCompressor | null;
|
|
87
|
+
}): Uint8Array;
|
|
88
|
+
/** Clears all content so the buffer can be reused for the next frame. */
|
|
89
|
+
reset(): void;
|
|
90
|
+
private _startRow;
|
|
91
|
+
private _completeRow;
|
|
92
|
+
private _openValues;
|
|
93
|
+
private _nextColumn;
|
|
94
|
+
private _writeKey;
|
|
95
|
+
private _unsigned;
|
|
96
|
+
private _varintNumber;
|
|
97
|
+
private _varintLong;
|
|
98
|
+
private _zigZagNumber;
|
|
99
|
+
private _bytesRaw;
|
|
100
|
+
private _ensure;
|
|
101
|
+
}
|
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
// Twin of G9SyncData.Protocol/RowBatch/G9CRowBatchWriter.cs. Same bytes for the same rows: the frame header, the
|
|
2
|
+
// section layout and every value encoding are specified in AiGuides/04-Protocol.md.
|
|
3
|
+
import { G9ESyncColumnType, isColumnType } from '../../abstractions/enums.js';
|
|
4
|
+
import { writeGuidBytes } from '../../abstractions/guid.js';
|
|
5
|
+
import { G9SyncKey } from '../../abstractions/key.js';
|
|
6
|
+
import { G9Long } from '../../abstractions/long.js';
|
|
7
|
+
import { parseDecimal } from '../../internal/dotnetFormat.js';
|
|
8
|
+
import { utf8Encode } from '../../internal/utf8.js';
|
|
9
|
+
import { fromRows } from './columnLayout.js';
|
|
10
|
+
import { G9ECompression, G9EPushRowOp, G9ERowBatchOp, G9RowBatchFormat, isRowBatchOp, writeInt32LE, zigZag } from './format.js';
|
|
11
|
+
/**
|
|
12
|
+
* Writes a G9RowBatch frame: a 10-byte header (`'G' '9' 'R' 'B' | version | compression | body length i32 LE`) and a
|
|
13
|
+
* body of sections, each holding rows of one table and one op.
|
|
14
|
+
*/
|
|
15
|
+
export class G9RowBatchWriter {
|
|
16
|
+
constructor(initialCapacity = 64 * 1024) {
|
|
17
|
+
this._length = 4;
|
|
18
|
+
this._sectionCount = 0;
|
|
19
|
+
this._totalRows = 0;
|
|
20
|
+
this._inSection = false;
|
|
21
|
+
this._op = 0;
|
|
22
|
+
this._keyType = 0;
|
|
23
|
+
this._types = [];
|
|
24
|
+
this._rowCountPosition = 0;
|
|
25
|
+
this._sectionRows = 0;
|
|
26
|
+
this._inRow = false;
|
|
27
|
+
this._rowHasValues = false;
|
|
28
|
+
this._column = 0;
|
|
29
|
+
this._bitmapPosition = 0;
|
|
30
|
+
this._buffer = new Uint8Array(Math.max(initialCapacity, 256));
|
|
31
|
+
}
|
|
32
|
+
/** Uncompressed body length written so far. */
|
|
33
|
+
get length() {
|
|
34
|
+
return this._length;
|
|
35
|
+
}
|
|
36
|
+
get totalRows() {
|
|
37
|
+
return this._totalRows;
|
|
38
|
+
}
|
|
39
|
+
get sectionCount() {
|
|
40
|
+
return this._sectionCount;
|
|
41
|
+
}
|
|
42
|
+
get currentSectionRows() {
|
|
43
|
+
return this._sectionRows;
|
|
44
|
+
}
|
|
45
|
+
get inSection() {
|
|
46
|
+
return this._inSection;
|
|
47
|
+
}
|
|
48
|
+
/** Starts a section. Key-only ops (Tombstone, MoveOut, KeyVersions) take no column types. */
|
|
49
|
+
beginSection(op, tableId, keyType, columnTypes) {
|
|
50
|
+
if (this._inSection)
|
|
51
|
+
throw new Error('EndSection must be called before BeginSection.');
|
|
52
|
+
if (!isRowBatchOp(op))
|
|
53
|
+
throw new RangeError(`Unknown row batch op ${op}.`);
|
|
54
|
+
if (!G9SyncKey.isSupportedKeyType(keyType))
|
|
55
|
+
throw new RangeError(`Unsupported key type ${keyType}.`);
|
|
56
|
+
if (!(tableId >= 0) || Math.floor(tableId) !== tableId)
|
|
57
|
+
throw new RangeError('The table id must be a non-negative integer.');
|
|
58
|
+
if ((op === G9ERowBatchOp.Tombstone || op === G9ERowBatchOp.MoveOut || op === G9ERowBatchOp.KeyVersions) && columnTypes.length > 0) {
|
|
59
|
+
throw new RangeError('Key-only sections carry no columns.');
|
|
60
|
+
}
|
|
61
|
+
if (columnTypes.length > 1024)
|
|
62
|
+
throw new RangeError('Too many columns.');
|
|
63
|
+
for (const type of columnTypes) {
|
|
64
|
+
if (!isColumnType(type))
|
|
65
|
+
throw new RangeError(`Invalid column type '${type}'.`);
|
|
66
|
+
}
|
|
67
|
+
this._ensure(2 + 20 + columnTypes.length + 4);
|
|
68
|
+
this._buffer[this._length++] = op;
|
|
69
|
+
this._varintNumber(tableId);
|
|
70
|
+
this._buffer[this._length++] = keyType;
|
|
71
|
+
this._varintNumber(columnTypes.length);
|
|
72
|
+
for (const type of columnTypes)
|
|
73
|
+
this._buffer[this._length++] = type;
|
|
74
|
+
this._rowCountPosition = this._length;
|
|
75
|
+
this._length += 4;
|
|
76
|
+
this._op = op;
|
|
77
|
+
this._keyType = keyType;
|
|
78
|
+
this._types = columnTypes.slice();
|
|
79
|
+
this._sectionRows = 0;
|
|
80
|
+
this._inSection = true;
|
|
81
|
+
}
|
|
82
|
+
endSection() {
|
|
83
|
+
if (!this._inSection)
|
|
84
|
+
throw new Error('No section is open.');
|
|
85
|
+
if (this._inRow)
|
|
86
|
+
throw new Error('EndRow must be called before EndSection.');
|
|
87
|
+
writeInt32LE(this._buffer, this._rowCountPosition, this._sectionRows);
|
|
88
|
+
this._sectionCount++;
|
|
89
|
+
this._inSection = false;
|
|
90
|
+
}
|
|
91
|
+
// ---------------------------------------------------------------- rows
|
|
92
|
+
/** Starts an Upsert or Backfill row; write every column, then {@link endRow}. `key` is canonical key text. */
|
|
93
|
+
beginRow(key, version) {
|
|
94
|
+
this._startRow(G9ERowBatchOp.Upsert, G9ERowBatchOp.Backfill);
|
|
95
|
+
this._writeKey(key);
|
|
96
|
+
this._unsigned(version);
|
|
97
|
+
this._openValues();
|
|
98
|
+
}
|
|
99
|
+
/** Adds a complete Tombstone or MoveOut row. */
|
|
100
|
+
addKey(key, version) {
|
|
101
|
+
this._startRow(G9ERowBatchOp.Tombstone, G9ERowBatchOp.MoveOut);
|
|
102
|
+
this._writeKey(key);
|
|
103
|
+
this._unsigned(version);
|
|
104
|
+
this._completeRow();
|
|
105
|
+
}
|
|
106
|
+
/** Adds a complete KeyVersions row. */
|
|
107
|
+
addKeyVersion(key, version, rowHash) {
|
|
108
|
+
this._startRow(G9ERowBatchOp.KeyVersions, G9ERowBatchOp.KeyVersions);
|
|
109
|
+
this._writeKey(key);
|
|
110
|
+
this._unsigned(version);
|
|
111
|
+
this._ensure(8);
|
|
112
|
+
rowHash.writeLE(this._buffer, this._length);
|
|
113
|
+
this._length += 8;
|
|
114
|
+
this._completeRow();
|
|
115
|
+
}
|
|
116
|
+
/** Starts a Push row. Upserts must then write every column; deletes write none. Finish with {@link endRow}. */
|
|
117
|
+
beginPushRow(key, op, sequence, baseVersion, dirtyMask, hlcMs) {
|
|
118
|
+
this._startRow(G9ERowBatchOp.Push, G9ERowBatchOp.Push);
|
|
119
|
+
if (op !== G9EPushRowOp.Upsert && op !== G9EPushRowOp.Delete)
|
|
120
|
+
throw new RangeError(`Unknown push op ${op}.`);
|
|
121
|
+
this._writeKey(key);
|
|
122
|
+
this._ensure(1);
|
|
123
|
+
this._buffer[this._length++] = op;
|
|
124
|
+
this._unsigned(sequence);
|
|
125
|
+
this._unsigned(baseVersion);
|
|
126
|
+
this._ensure(8);
|
|
127
|
+
dirtyMask.writeLE(this._buffer, this._length);
|
|
128
|
+
this._length += 8;
|
|
129
|
+
if (hlcMs instanceof G9Long)
|
|
130
|
+
this._varintLong(zigZag(hlcMs));
|
|
131
|
+
else
|
|
132
|
+
this._zigZagNumber(hlcMs);
|
|
133
|
+
if (op === G9EPushRowOp.Upsert)
|
|
134
|
+
this._openValues();
|
|
135
|
+
}
|
|
136
|
+
/** Completes a row started with beginRow or beginPushRow. */
|
|
137
|
+
endRow() {
|
|
138
|
+
if (!this._inRow)
|
|
139
|
+
throw new Error('No row is open.');
|
|
140
|
+
if (this._rowHasValues && this._column !== this._types.length) {
|
|
141
|
+
throw new Error(`Row ended after ${this._column} of ${this._types.length} column values.`);
|
|
142
|
+
}
|
|
143
|
+
this._completeRow();
|
|
144
|
+
}
|
|
145
|
+
// ---------------------------------------------------------------- values
|
|
146
|
+
writeNull() {
|
|
147
|
+
const column = this._nextColumn(null);
|
|
148
|
+
const at = this._bitmapPosition + (column >> 3);
|
|
149
|
+
this._buffer[at] = this._buffer[at] | (1 << (column & 7));
|
|
150
|
+
}
|
|
151
|
+
writeBoolean(value) {
|
|
152
|
+
this._nextColumn(G9ESyncColumnType.Boolean);
|
|
153
|
+
this._ensure(1);
|
|
154
|
+
this._buffer[this._length++] = value ? 1 : 0;
|
|
155
|
+
}
|
|
156
|
+
writeInt32(value) {
|
|
157
|
+
this._nextColumn(G9ESyncColumnType.Int32);
|
|
158
|
+
if (!(value >= -2147483648 && value <= 2147483647) || Math.floor(value) !== value)
|
|
159
|
+
throw new RangeError(`${value} is not an Int32.`);
|
|
160
|
+
this._zigZagNumber(value);
|
|
161
|
+
}
|
|
162
|
+
writeInt64(value) {
|
|
163
|
+
this._nextColumn(G9ESyncColumnType.Int64);
|
|
164
|
+
if (value instanceof G9Long)
|
|
165
|
+
this._varintLong(zigZag(value));
|
|
166
|
+
else
|
|
167
|
+
this._zigZagNumber(value);
|
|
168
|
+
}
|
|
169
|
+
writeDouble(value) {
|
|
170
|
+
this._nextColumn(G9ESyncColumnType.Double);
|
|
171
|
+
this._ensure(8);
|
|
172
|
+
DOUBLE_VIEW.setFloat64(0, value, true);
|
|
173
|
+
for (let i = 0; i < 8; i++)
|
|
174
|
+
this._buffer[this._length + i] = DOUBLE_BYTES[i];
|
|
175
|
+
this._length += 8;
|
|
176
|
+
}
|
|
177
|
+
/** A decimal: its .NET parts, or invariant decimal text. */
|
|
178
|
+
writeDecimal(value) {
|
|
179
|
+
this._nextColumn(G9ESyncColumnType.Decimal);
|
|
180
|
+
const parts = typeof value === 'string' ? parseDecimal(value) : value;
|
|
181
|
+
if (!parts)
|
|
182
|
+
throw new RangeError(`'${String(value)}' is not a decimal.`);
|
|
183
|
+
if (!(parts.scale >= 0 && parts.scale <= 28))
|
|
184
|
+
throw new RangeError('Decimal scale must be 0..28.');
|
|
185
|
+
this._ensure(16);
|
|
186
|
+
const flags = ((parts.scale & 0xff) << 16) | (parts.negative ? 0x80000000 : 0);
|
|
187
|
+
writeInt32LE(this._buffer, this._length, parts.lo);
|
|
188
|
+
writeInt32LE(this._buffer, this._length + 4, parts.mid);
|
|
189
|
+
writeInt32LE(this._buffer, this._length + 8, parts.hi);
|
|
190
|
+
writeInt32LE(this._buffer, this._length + 12, flags);
|
|
191
|
+
this._length += 16;
|
|
192
|
+
}
|
|
193
|
+
/** Writes a string, or NULL when `value` is null. */
|
|
194
|
+
writeString(value) {
|
|
195
|
+
if (value === null || value === undefined) {
|
|
196
|
+
this.writeNull();
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
this._nextColumn(G9ESyncColumnType.String);
|
|
200
|
+
this._bytesRaw(utf8Encode(value));
|
|
201
|
+
}
|
|
202
|
+
/** Writes a string that is already UTF-8 encoded. */
|
|
203
|
+
writeStringUtf8(utf8) {
|
|
204
|
+
this._nextColumn(G9ESyncColumnType.String);
|
|
205
|
+
this._bytesRaw(utf8);
|
|
206
|
+
}
|
|
207
|
+
/** Writes a GUID given as text in any form `Guid.Parse` accepts. */
|
|
208
|
+
writeGuid(value) {
|
|
209
|
+
this._nextColumn(G9ESyncColumnType.Guid);
|
|
210
|
+
this._ensure(16);
|
|
211
|
+
writeGuidBytes(value, this._buffer, this._length);
|
|
212
|
+
this._length += 16;
|
|
213
|
+
}
|
|
214
|
+
writeDateTime(value) {
|
|
215
|
+
this._nextColumn(G9ESyncColumnType.DateTime);
|
|
216
|
+
this._ensure(9);
|
|
217
|
+
value.ticks.writeLE(this._buffer, this._length);
|
|
218
|
+
this._length += 8;
|
|
219
|
+
this._buffer[this._length++] = value.kind & 0xff;
|
|
220
|
+
}
|
|
221
|
+
writeDateTimeOffset(value) {
|
|
222
|
+
this._nextColumn(G9ESyncColumnType.DateTimeOffset);
|
|
223
|
+
if (!(value.offsetMinutes >= -32768 && value.offsetMinutes <= 32767))
|
|
224
|
+
throw new RangeError('The offset does not fit 16 bits.');
|
|
225
|
+
this._ensure(10);
|
|
226
|
+
value.utcTicks.writeLE(this._buffer, this._length);
|
|
227
|
+
this._length += 8;
|
|
228
|
+
this._buffer[this._length++] = value.offsetMinutes & 0xff;
|
|
229
|
+
this._buffer[this._length++] = (value.offsetMinutes >> 8) & 0xff;
|
|
230
|
+
}
|
|
231
|
+
/** A TimeSpan as ticks. */
|
|
232
|
+
writeTimeSpan(ticks) {
|
|
233
|
+
this._nextColumn(G9ESyncColumnType.TimeSpan);
|
|
234
|
+
if (ticks instanceof G9Long)
|
|
235
|
+
this._varintLong(zigZag(ticks));
|
|
236
|
+
else
|
|
237
|
+
this._zigZagNumber(ticks);
|
|
238
|
+
}
|
|
239
|
+
writeBytes(value) {
|
|
240
|
+
this._nextColumn(G9ESyncColumnType.Bytes);
|
|
241
|
+
this._bytesRaw(value);
|
|
242
|
+
}
|
|
243
|
+
// ---------------------------------------------------------------- frame
|
|
244
|
+
/**
|
|
245
|
+
* Produces the frame. With a compressor and `compression` Brotli, the body is compressed when it is over 128 bytes
|
|
246
|
+
* and compression helps; otherwise the frame is uncompressed. `version` 2 writes the column-grouped layout (only for
|
|
247
|
+
* a peer that asked for it).
|
|
248
|
+
*/
|
|
249
|
+
toFrame(options) {
|
|
250
|
+
var _a, _b, _c;
|
|
251
|
+
if (this._inSection)
|
|
252
|
+
throw new Error('EndSection must be called before ToFrame.');
|
|
253
|
+
const version = (_a = options === null || options === void 0 ? void 0 : options.version) !== null && _a !== void 0 ? _a : G9RowBatchFormat.Version;
|
|
254
|
+
if (version !== G9RowBatchFormat.Version && version !== G9RowBatchFormat.ColumnVersion) {
|
|
255
|
+
throw new RangeError(`Unknown G9RowBatch version ${version}.`);
|
|
256
|
+
}
|
|
257
|
+
writeInt32LE(this._buffer, 0, this._sectionCount);
|
|
258
|
+
const rows = this._buffer.subarray(0, this._length);
|
|
259
|
+
const body = version === G9RowBatchFormat.ColumnVersion ? fromRows(rows) : rows;
|
|
260
|
+
const compression = (_b = options === null || options === void 0 ? void 0 : options.compression) !== null && _b !== void 0 ? _b : G9ECompression.Brotli;
|
|
261
|
+
const compressor = options === null || options === void 0 ? void 0 : options.compressor;
|
|
262
|
+
if (compression === G9ECompression.Brotli && compressor && body.length > 128) {
|
|
263
|
+
const compressed = compressor.compress(body, (_c = options === null || options === void 0 ? void 0 : options.quality) !== null && _c !== void 0 ? _c : 4, 22);
|
|
264
|
+
if (compressed && compressed.length < body.length) {
|
|
265
|
+
const frame = new Uint8Array(G9RowBatchFormat.HeaderSize + compressed.length);
|
|
266
|
+
writeHeader(frame, version, G9ECompression.Brotli, body.length);
|
|
267
|
+
frame.set(compressed, G9RowBatchFormat.HeaderSize);
|
|
268
|
+
return frame;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
const frame = new Uint8Array(G9RowBatchFormat.HeaderSize + body.length);
|
|
272
|
+
writeHeader(frame, version, G9ECompression.None, body.length);
|
|
273
|
+
frame.set(body, G9RowBatchFormat.HeaderSize);
|
|
274
|
+
return frame;
|
|
275
|
+
}
|
|
276
|
+
/** Clears all content so the buffer can be reused for the next frame. */
|
|
277
|
+
reset() {
|
|
278
|
+
this._length = 4;
|
|
279
|
+
this._sectionCount = 0;
|
|
280
|
+
this._totalRows = 0;
|
|
281
|
+
this._inSection = false;
|
|
282
|
+
this._inRow = false;
|
|
283
|
+
this._rowHasValues = false;
|
|
284
|
+
this._sectionRows = 0;
|
|
285
|
+
}
|
|
286
|
+
// ---------------------------------------------------------------- internals
|
|
287
|
+
_startRow(allowed1, allowed2) {
|
|
288
|
+
if (!this._inSection)
|
|
289
|
+
throw new Error('BeginSection must be called before adding rows.');
|
|
290
|
+
if (this._inRow)
|
|
291
|
+
throw new Error('EndRow must be called before starting another row.');
|
|
292
|
+
if (this._op !== allowed1 && this._op !== allowed2)
|
|
293
|
+
throw new Error(`This row kind is not valid in a section of op ${this._op}.`);
|
|
294
|
+
this._inRow = true;
|
|
295
|
+
this._rowHasValues = false;
|
|
296
|
+
this._column = 0;
|
|
297
|
+
}
|
|
298
|
+
_completeRow() {
|
|
299
|
+
this._inRow = false;
|
|
300
|
+
this._rowHasValues = false;
|
|
301
|
+
this._sectionRows++;
|
|
302
|
+
this._totalRows++;
|
|
303
|
+
}
|
|
304
|
+
_openValues() {
|
|
305
|
+
const bitmapBytes = (this._types.length + 7) >> 3;
|
|
306
|
+
this._ensure(bitmapBytes);
|
|
307
|
+
this._bitmapPosition = this._length;
|
|
308
|
+
this._buffer.fill(0, this._length, this._length + bitmapBytes);
|
|
309
|
+
this._length += bitmapBytes;
|
|
310
|
+
this._column = 0;
|
|
311
|
+
this._rowHasValues = true;
|
|
312
|
+
}
|
|
313
|
+
_nextColumn(expected) {
|
|
314
|
+
if (!this._inRow || !this._rowHasValues)
|
|
315
|
+
throw new Error('No row with column values is open.');
|
|
316
|
+
if (this._column >= this._types.length)
|
|
317
|
+
throw new Error('Every column of this row has already been written.');
|
|
318
|
+
if (expected !== null && this._types[this._column] !== expected) {
|
|
319
|
+
throw new Error(`Column ${this._column} is declared ${this._types[this._column]}, but a ${expected} value was written.`);
|
|
320
|
+
}
|
|
321
|
+
return this._column++;
|
|
322
|
+
}
|
|
323
|
+
_writeKey(key) {
|
|
324
|
+
if (typeof key !== 'string')
|
|
325
|
+
throw new TypeError('The key is required.');
|
|
326
|
+
switch (this._keyType) {
|
|
327
|
+
case G9ESyncColumnType.Guid:
|
|
328
|
+
this._ensure(16);
|
|
329
|
+
writeGuidBytes(key, this._buffer, this._length);
|
|
330
|
+
this._length += 16;
|
|
331
|
+
break;
|
|
332
|
+
case G9ESyncColumnType.Int32:
|
|
333
|
+
case G9ESyncColumnType.Int64:
|
|
334
|
+
this._varintLong(zigZag(G9Long.parse(key)));
|
|
335
|
+
break;
|
|
336
|
+
default:
|
|
337
|
+
this._bytesRaw(utf8Encode(key));
|
|
338
|
+
break;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
_unsigned(value) {
|
|
342
|
+
if (value instanceof G9Long) {
|
|
343
|
+
if (value.isNegative())
|
|
344
|
+
throw new RangeError(`${value.toString()} must be non-negative.`);
|
|
345
|
+
this._varintLong(value);
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
if (!(value >= 0) || Math.floor(value) !== value)
|
|
349
|
+
throw new RangeError(`${value} must be a non-negative integer.`);
|
|
350
|
+
if (value > 9007199254740991)
|
|
351
|
+
this._varintLong(G9Long.fromNumber(value));
|
|
352
|
+
else
|
|
353
|
+
this._varintNumber(value);
|
|
354
|
+
}
|
|
355
|
+
_varintNumber(value) {
|
|
356
|
+
this._ensure(10);
|
|
357
|
+
let v = value;
|
|
358
|
+
while (v >= 128) {
|
|
359
|
+
this._buffer[this._length++] = (v % 128) | 0x80;
|
|
360
|
+
v = Math.floor(v / 128);
|
|
361
|
+
}
|
|
362
|
+
this._buffer[this._length++] = v;
|
|
363
|
+
}
|
|
364
|
+
_varintLong(value) {
|
|
365
|
+
this._ensure(10);
|
|
366
|
+
let lo = value.lo;
|
|
367
|
+
let hi = value.hi >>> 0;
|
|
368
|
+
while (hi !== 0 || lo >= 128) {
|
|
369
|
+
this._buffer[this._length++] = (lo & 0x7f) | 0x80;
|
|
370
|
+
lo = ((lo >>> 7) | (hi << 25)) >>> 0;
|
|
371
|
+
hi = hi >>> 7;
|
|
372
|
+
}
|
|
373
|
+
this._buffer[this._length++] = lo;
|
|
374
|
+
}
|
|
375
|
+
_zigZagNumber(value) {
|
|
376
|
+
if (Math.floor(value) !== value)
|
|
377
|
+
throw new RangeError(`${value} is not an integer.`);
|
|
378
|
+
if (value >= -4503599627370496 && value < 4503599627370496)
|
|
379
|
+
this._varintNumber(value >= 0 ? value * 2 : -value * 2 - 1);
|
|
380
|
+
else
|
|
381
|
+
this._varintLong(zigZag(G9Long.fromNumber(value)));
|
|
382
|
+
}
|
|
383
|
+
_bytesRaw(value) {
|
|
384
|
+
this._ensure(10 + value.length);
|
|
385
|
+
this._varintNumber(value.length);
|
|
386
|
+
this._buffer.set(value, this._length);
|
|
387
|
+
this._length += value.length;
|
|
388
|
+
}
|
|
389
|
+
_ensure(additional) {
|
|
390
|
+
const required = this._length + additional;
|
|
391
|
+
if (required <= this._buffer.length)
|
|
392
|
+
return;
|
|
393
|
+
if (required > G9RowBatchFormat.MaxBodyBytes)
|
|
394
|
+
throw new Error('Row batch exceeds the maximum body size.');
|
|
395
|
+
const next = new Uint8Array(Math.min(Math.max(required, this._buffer.length * 2), G9RowBatchFormat.MaxBodyBytes));
|
|
396
|
+
next.set(this._buffer.subarray(0, this._length));
|
|
397
|
+
this._buffer = next;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
const DOUBLE_BUFFER = new ArrayBuffer(8);
|
|
401
|
+
const DOUBLE_VIEW = new DataView(DOUBLE_BUFFER);
|
|
402
|
+
const DOUBLE_BYTES = new Uint8Array(DOUBLE_BUFFER);
|
|
403
|
+
function writeHeader(frame, version, compression, bodyLength) {
|
|
404
|
+
frame[0] = 0x47; // G
|
|
405
|
+
frame[1] = 0x39; // 9
|
|
406
|
+
frame[2] = 0x52; // R
|
|
407
|
+
frame[3] = 0x42; // B
|
|
408
|
+
frame[4] = version;
|
|
409
|
+
frame[5] = compression;
|
|
410
|
+
writeInt32LE(frame, 6, bodyLength);
|
|
411
|
+
}
|
|
412
|
+
//# sourceMappingURL=writer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writer.js","sourceRoot":"","sources":["../../../src/protocol/rowBatch/writer.ts"],"names":[],"mappings":"AAAA,iHAAiH;AACjH,oFAAoF;AACpF,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAqB,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAsBhI;;;GAGG;AACH,MAAM,OAAO,gBAAgB;IAkB3B,YAAY,kBAA0B,EAAE,GAAG,IAAI;QAhBvC,YAAO,GAAG,CAAC,CAAC;QACZ,kBAAa,GAAG,CAAC,CAAC;QAClB,eAAU,GAAG,CAAC,CAAC;QAEf,eAAU,GAAG,KAAK,CAAC;QACnB,QAAG,GAAW,CAAC,CAAC;QAChB,aAAQ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K,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI;IACrB,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI;IACrB,KAAK,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC;IACnB,KAAK,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC;IACvB,YAAY,CAAC,KAAK,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC;AACrC,CAAC","sourcesContent":["// Twin of G9SyncData.Protocol/RowBatch/G9CRowBatchWriter.cs. Same bytes for the same rows: the frame header, the\n// section layout and every value encoding are specified in AiGuides/04-Protocol.md.\nimport { G9ESyncColumnType, isColumnType } from '../../abstractions/enums.js';\nimport { writeGuidBytes } from '../../abstractions/guid.js';\nimport { G9SyncKey } from '../../abstractions/key.js';\nimport { G9Long } from '../../abstractions/long.js';\nimport { type DecimalParts, parseDecimal } from '../../internal/dotnetFormat.js';\nimport { utf8Encode } from '../../internal/utf8.js';\nimport { fromRows } from './columnLayout.js';\nimport { G9ECompression, G9EPushRowOp, G9ERowBatchOp, G9RowBatchFormat, isRowBatchOp, writeInt32LE, zigZag } from './format.js';\n\n/** A DateTime value on the wire: ticks (100 ns since 0001-01-01) and the `DateTimeKind` (0 unspecified, 1 UTC, 2 local). */\nexport interface G9DateTimeValue {\n ticks: G9Long;\n kind: number;\n}\n\n/** A DateTimeOffset value on the wire: UTC ticks and the offset in minutes. */\nexport interface G9DateTimeOffsetValue {\n utcTicks: G9Long;\n offsetMinutes: number;\n}\n\n/**\n * A compressor for push frames. Optional: without one the writer emits uncompressed frames, which every reader\n * accepts (the .NET writer falls back to them whenever compression does not help).\n */\nexport interface G9FrameCompressor {\n compress(body: Uint8Array, quality: number, window: number): Uint8Array | null;\n}\n\n/**\n * Writes a G9RowBatch frame: a 10-byte header (`'G' '9' 'R' 'B' | version | compression | body length i32 LE`) and a\n * body of sections, each holding rows of one table and one op.\n */\nexport class G9RowBatchWriter {\n private _buffer: Uint8Array;\n private _length = 4;\n private _sectionCount = 0;\n private _totalRows = 0;\n\n private _inSection = false;\n private _op: number = 0;\n private _keyType: number = 0;\n private _types: number[] = [];\n private _rowCountPosition = 0;\n private _sectionRows = 0;\n\n private _inRow = false;\n private _rowHasValues = false;\n private _column = 0;\n private _bitmapPosition = 0;\n\n constructor(initialCapacity: number = 64 * 1024) {\n this._buffer = new Uint8Array(Math.max(initialCapacity, 256));\n }\n\n /** Uncompressed body length written so far. */\n get length(): number {\n return this._length;\n }\n\n get totalRows(): number {\n return this._totalRows;\n }\n\n get sectionCount(): number {\n return this._sectionCount;\n }\n\n get currentSectionRows(): number {\n return this._sectionRows;\n }\n\n get inSection(): boolean {\n return this._inSection;\n }\n\n /** Starts a section. Key-only ops (Tombstone, MoveOut, KeyVersions) take no column types. */\n beginSection(op: number, tableId: number, keyType: number, columnTypes: readonly number[]): void {\n if (this._inSection) throw new Error('EndSection must be called before BeginSection.');\n if (!isRowBatchOp(op)) throw new RangeError(`Unknown row batch op ${op}.`);\n if (!G9SyncKey.isSupportedKeyType(keyType)) throw new RangeError(`Unsupported key type ${keyType}.`);\n if (!(tableId >= 0) || Math.floor(tableId) !== tableId) throw new RangeError('The table id must be a non-negative integer.');\n if ((op === G9ERowBatchOp.Tombstone || op === G9ERowBatchOp.MoveOut || op === G9ERowBatchOp.KeyVersions) && columnTypes.length > 0) {\n throw new RangeError('Key-only sections carry no columns.');\n }\n if (columnTypes.length > 1024) throw new RangeError('Too many columns.');\n for (const type of columnTypes) {\n if (!isColumnType(type)) throw new RangeError(`Invalid column type '${type}'.`);\n }\n\n this._ensure(2 + 20 + columnTypes.length + 4);\n this._buffer[this._length++] = op;\n this._varintNumber(tableId);\n this._buffer[this._length++] = keyType;\n this._varintNumber(columnTypes.length);\n for (const type of columnTypes) this._buffer[this._length++] = type;\n this._rowCountPosition = this._length;\n this._length += 4;\n\n this._op = op;\n this._keyType = keyType;\n this._types = columnTypes.slice();\n this._sectionRows = 0;\n this._inSection = true;\n }\n\n endSection(): void {\n if (!this._inSection) throw new Error('No section is open.');\n if (this._inRow) throw new Error('EndRow must be called before EndSection.');\n writeInt32LE(this._buffer, this._rowCountPosition, this._sectionRows);\n this._sectionCount++;\n this._inSection = false;\n }\n\n // ---------------------------------------------------------------- rows\n\n /** Starts an Upsert or Backfill row; write every column, then {@link endRow}. `key` is canonical key text. */\n beginRow(key: string, version: number | G9Long): void {\n this._startRow(G9ERowBatchOp.Upsert, G9ERowBatchOp.Backfill);\n this._writeKey(key);\n this._unsigned(version);\n this._openValues();\n }\n\n /** Adds a complete Tombstone or MoveOut row. */\n addKey(key: string, version: number | G9Long): void {\n this._startRow(G9ERowBatchOp.Tombstone, G9ERowBatchOp.MoveOut);\n this._writeKey(key);\n this._unsigned(version);\n this._completeRow();\n }\n\n /** Adds a complete KeyVersions row. */\n addKeyVersion(key: string, version: number | G9Long, rowHash: G9Long): void {\n this._startRow(G9ERowBatchOp.KeyVersions, G9ERowBatchOp.KeyVersions);\n this._writeKey(key);\n this._unsigned(version);\n this._ensure(8);\n rowHash.writeLE(this._buffer, this._length);\n this._length += 8;\n this._completeRow();\n }\n\n /** Starts a Push row. Upserts must then write every column; deletes write none. Finish with {@link endRow}. */\n beginPushRow(key: string, op: number, sequence: number | G9Long, baseVersion: number | G9Long, dirtyMask: G9Long, hlcMs: number | G9Long): void {\n this._startRow(G9ERowBatchOp.Push, G9ERowBatchOp.Push);\n if (op !== G9EPushRowOp.Upsert && op !== G9EPushRowOp.Delete) throw new RangeError(`Unknown push op ${op}.`);\n this._writeKey(key);\n this._ensure(1);\n this._buffer[this._length++] = op;\n this._unsigned(sequence);\n this._unsigned(baseVersion);\n this._ensure(8);\n dirtyMask.writeLE(this._buffer, this._length);\n this._length += 8;\n if (hlcMs instanceof G9Long) this._varintLong(zigZag(hlcMs));\n else this._zigZagNumber(hlcMs);\n if (op === G9EPushRowOp.Upsert) this._openValues();\n }\n\n /** Completes a row started with beginRow or beginPushRow. */\n endRow(): void {\n if (!this._inRow) throw new Error('No row is open.');\n if (this._rowHasValues && this._column !== this._types.length) {\n throw new Error(`Row ended after ${this._column} of ${this._types.length} column values.`);\n }\n this._completeRow();\n }\n\n // ---------------------------------------------------------------- values\n\n writeNull(): void {\n const column = this._nextColumn(null);\n const at = this._bitmapPosition + (column >> 3);\n this._buffer[at] = (this._buffer[at] as number) | (1 << (column & 7));\n }\n\n writeBoolean(value: boolean): void {\n this._nextColumn(G9ESyncColumnType.Boolean);\n this._ensure(1);\n this._buffer[this._length++] = value ? 1 : 0;\n }\n\n writeInt32(value: number): void {\n this._nextColumn(G9ESyncColumnType.Int32);\n if (!(value >= -2147483648 && value <= 2147483647) || Math.floor(value) !== value) throw new RangeError(`${value} is not an Int32.`);\n this._zigZagNumber(value);\n }\n\n writeInt64(value: number | G9Long): void {\n this._nextColumn(G9ESyncColumnType.Int64);\n if (value instanceof G9Long) this._varintLong(zigZag(value));\n else this._zigZagNumber(value);\n }\n\n writeDouble(value: number): void {\n this._nextColumn(G9ESyncColumnType.Double);\n this._ensure(8);\n DOUBLE_VIEW.setFloat64(0, value, true);\n for (let i = 0; i < 8; i++) this._buffer[this._length + i] = DOUBLE_BYTES[i] as number;\n this._length += 8;\n }\n\n /** A decimal: its .NET parts, or invariant decimal text. */\n writeDecimal(value: DecimalParts | string): void {\n this._nextColumn(G9ESyncColumnType.Decimal);\n const parts = typeof value === 'string' ? parseDecimal(value) : value;\n if (!parts) throw new RangeError(`'${String(value)}' is not a decimal.`);\n if (!(parts.scale >= 0 && parts.scale <= 28)) throw new RangeError('Decimal scale must be 0..28.');\n this._ensure(16);\n const flags = ((parts.scale & 0xff) << 16) | (parts.negative ? 0x80000000 : 0);\n writeInt32LE(this._buffer, this._length, parts.lo);\n writeInt32LE(this._buffer, this._length + 4, parts.mid);\n writeInt32LE(this._buffer, this._length + 8, parts.hi);\n writeInt32LE(this._buffer, this._length + 12, flags);\n this._length += 16;\n }\n\n /** Writes a string, or NULL when `value` is null. */\n writeString(value: string | null): void {\n if (value === null || value === undefined) {\n this.writeNull();\n return;\n }\n this._nextColumn(G9ESyncColumnType.String);\n this._bytesRaw(utf8Encode(value));\n }\n\n /** Writes a string that is already UTF-8 encoded. */\n writeStringUtf8(utf8: Uint8Array): void {\n this._nextColumn(G9ESyncColumnType.String);\n this._bytesRaw(utf8);\n }\n\n /** Writes a GUID given as text in any form `Guid.Parse` accepts. */\n writeGuid(value: string): void {\n this._nextColumn(G9ESyncColumnType.Guid);\n this._ensure(16);\n writeGuidBytes(value, this._buffer, this._length);\n this._length += 16;\n }\n\n writeDateTime(value: G9DateTimeValue): void {\n this._nextColumn(G9ESyncColumnType.DateTime);\n this._ensure(9);\n value.ticks.writeLE(this._buffer, this._length);\n this._length += 8;\n this._buffer[this._length++] = value.kind & 0xff;\n }\n\n writeDateTimeOffset(value: G9DateTimeOffsetValue): void {\n this._nextColumn(G9ESyncColumnType.DateTimeOffset);\n if (!(value.offsetMinutes >= -32768 && value.offsetMinutes <= 32767)) throw new RangeError('The offset does not fit 16 bits.');\n this._ensure(10);\n value.utcTicks.writeLE(this._buffer, this._length);\n this._length += 8;\n this._buffer[this._length++] = value.offsetMinutes & 0xff;\n this._buffer[this._length++] = (value.offsetMinutes >> 8) & 0xff;\n }\n\n /** A TimeSpan as ticks. */\n writeTimeSpan(ticks: number | G9Long): void {\n this._nextColumn(G9ESyncColumnType.TimeSpan);\n if (ticks instanceof G9Long) this._varintLong(zigZag(ticks));\n else this._zigZagNumber(ticks);\n }\n\n writeBytes(value: Uint8Array): void {\n this._nextColumn(G9ESyncColumnType.Bytes);\n this._bytesRaw(value);\n }\n\n // ---------------------------------------------------------------- frame\n\n /**\n * Produces the frame. With a compressor and `compression` Brotli, the body is compressed when it is over 128 bytes\n * and compression helps; otherwise the frame is uncompressed. `version` 2 writes the column-grouped layout (only for\n * a peer that asked for it).\n */\n toFrame(options?: { compression?: number; quality?: number; version?: number; compressor?: G9FrameCompressor | null }): Uint8Array {\n if (this._inSection) throw new Error('EndSection must be called before ToFrame.');\n const version = options?.version ?? G9RowBatchFormat.Version;\n if (version !== G9RowBatchFormat.Version && version !== G9RowBatchFormat.ColumnVersion) {\n throw new RangeError(`Unknown G9RowBatch version ${version}.`);\n }\n writeInt32LE(this._buffer, 0, this._sectionCount);\n const rows = this._buffer.subarray(0, this._length);\n const body = version === G9RowBatchFormat.ColumnVersion ? fromRows(rows) : rows;\n\n const compression = options?.compression ?? G9ECompression.Brotli;\n const compressor = options?.compressor;\n if (compression === G9ECompression.Brotli && compressor && body.length > 128) {\n const compressed = compressor.compress(body, options?.quality ?? 4, 22);\n if (compressed && compressed.length < body.length) {\n const frame = new Uint8Array(G9RowBatchFormat.HeaderSize + compressed.length);\n writeHeader(frame, version, G9ECompression.Brotli, body.length);\n frame.set(compressed, G9RowBatchFormat.HeaderSize);\n return frame;\n }\n }\n const frame = new Uint8Array(G9RowBatchFormat.HeaderSize + body.length);\n writeHeader(frame, version, G9ECompression.None, body.length);\n frame.set(body, G9RowBatchFormat.HeaderSize);\n return frame;\n }\n\n /** Clears all content so the buffer can be reused for the next frame. */\n reset(): void {\n this._length = 4;\n this._sectionCount = 0;\n this._totalRows = 0;\n this._inSection = false;\n this._inRow = false;\n this._rowHasValues = false;\n this._sectionRows = 0;\n }\n\n // ---------------------------------------------------------------- internals\n\n private _startRow(allowed1: number, allowed2: number): void {\n if (!this._inSection) throw new Error('BeginSection must be called before adding rows.');\n if (this._inRow) throw new Error('EndRow must be called before starting another row.');\n if (this._op !== allowed1 && this._op !== allowed2) throw new Error(`This row kind is not valid in a section of op ${this._op}.`);\n this._inRow = true;\n this._rowHasValues = false;\n this._column = 0;\n }\n\n private _completeRow(): void {\n this._inRow = false;\n this._rowHasValues = false;\n this._sectionRows++;\n this._totalRows++;\n }\n\n private _openValues(): void {\n const bitmapBytes = (this._types.length + 7) >> 3;\n this._ensure(bitmapBytes);\n this._bitmapPosition = this._length;\n this._buffer.fill(0, this._length, this._length + bitmapBytes);\n this._length += bitmapBytes;\n this._column = 0;\n this._rowHasValues = true;\n }\n\n private _nextColumn(expected: number | null): number {\n if (!this._inRow || !this._rowHasValues) throw new Error('No row with column values is open.');\n if (this._column >= this._types.length) throw new Error('Every column of this row has already been written.');\n if (expected !== null && this._types[this._column] !== expected) {\n throw new Error(`Column ${this._column} is declared ${this._types[this._column]}, but a ${expected} value was written.`);\n }\n return this._column++;\n }\n\n private _writeKey(key: string): void {\n if (typeof key !== 'string') throw new TypeError('The key is required.');\n switch (this._keyType) {\n case G9ESyncColumnType.Guid:\n this._ensure(16);\n writeGuidBytes(key, this._buffer, this._length);\n this._length += 16;\n break;\n case G9ESyncColumnType.Int32:\n case G9ESyncColumnType.Int64:\n this._varintLong(zigZag(G9Long.parse(key)));\n break;\n default:\n this._bytesRaw(utf8Encode(key));\n break;\n }\n }\n\n private _unsigned(value: number | G9Long): void {\n if (value instanceof G9Long) {\n if (value.isNegative()) throw new RangeError(`${value.toString()} must be non-negative.`);\n this._varintLong(value);\n return;\n }\n if (!(value >= 0) || Math.floor(value) !== value) throw new RangeError(`${value} must be a non-negative integer.`);\n if (value > 9007199254740991) this._varintLong(G9Long.fromNumber(value));\n else this._varintNumber(value);\n }\n\n private _varintNumber(value: number): void {\n this._ensure(10);\n let v = value;\n while (v >= 128) {\n this._buffer[this._length++] = (v % 128) | 0x80;\n v = Math.floor(v / 128);\n }\n this._buffer[this._length++] = v;\n }\n\n private _varintLong(value: G9Long): void {\n this._ensure(10);\n let lo = value.lo;\n let hi = value.hi >>> 0;\n while (hi !== 0 || lo >= 128) {\n this._buffer[this._length++] = (lo & 0x7f) | 0x80;\n lo = ((lo >>> 7) | (hi << 25)) >>> 0;\n hi = hi >>> 7;\n }\n this._buffer[this._length++] = lo;\n }\n\n private _zigZagNumber(value: number): void {\n if (Math.floor(value) !== value) throw new RangeError(`${value} is not an integer.`);\n if (value >= -4503599627370496 && value < 4503599627370496) this._varintNumber(value >= 0 ? value * 2 : -value * 2 - 1);\n else this._varintLong(zigZag(G9Long.fromNumber(value)));\n }\n\n private _bytesRaw(value: Uint8Array): void {\n this._ensure(10 + value.length);\n this._varintNumber(value.length);\n this._buffer.set(value, this._length);\n this._length += value.length;\n }\n\n private _ensure(additional: number): void {\n const required = this._length + additional;\n if (required <= this._buffer.length) return;\n if (required > G9RowBatchFormat.MaxBodyBytes) throw new Error('Row batch exceeds the maximum body size.');\n const next = new Uint8Array(Math.min(Math.max(required, this._buffer.length * 2), G9RowBatchFormat.MaxBodyBytes));\n next.set(this._buffer.subarray(0, this._length));\n this._buffer = next;\n }\n}\n\nconst DOUBLE_BUFFER = new ArrayBuffer(8);\nconst DOUBLE_VIEW = new DataView(DOUBLE_BUFFER);\nconst DOUBLE_BYTES = new Uint8Array(DOUBLE_BUFFER);\n\nfunction writeHeader(frame: Uint8Array, version: number, compression: number, bodyLength: number): void {\n frame[0] = 0x47; // G\n frame[1] = 0x39; // 9\n frame[2] = 0x52; // R\n frame[3] = 0x42; // B\n frame[4] = version;\n frame[5] = compression;\n writeInt32LE(frame, 6, bodyLength);\n}\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { G9DtChangesAvailable, G9DtHelloResult, G9DtNegotiatedTable, G9DtPullContinuation, G9DtPullPlan, G9DtPushResult, G9DtReconcileSummary, G9DtSubscriptionDefinition, G9DtSubscriptionState, G9DtSyncChunk, G9DtSyncError } from './dtos.js';
|
|
2
|
+
/** Which SignalR hub protocol a value came from or goes to. */
|
|
3
|
+
export type G9WireFormat = 'json' | 'messagepack';
|
|
4
|
+
/** A GUID on its way into MessagePack (written as extension type 2, 16 big-endian bytes, like Nerdbank's Guid converter). */
|
|
5
|
+
export declare class G9WireGuid {
|
|
6
|
+
readonly value: string;
|
|
7
|
+
constructor(value: string);
|
|
8
|
+
}
|
|
9
|
+
/** Nerdbank.MessagePack's extension type for System.Guid. */
|
|
10
|
+
export declare const GUID_EXTENSION_TYPE = 2;
|
|
11
|
+
/** The camelCase twin of a decoded MessagePack value (a `Parameters` dictionary keeps its own keys). */
|
|
12
|
+
export declare function fromMessagePackNames(value: unknown): unknown;
|
|
13
|
+
/**
|
|
14
|
+
* The MessagePack form of an outgoing DTO: PascalCase names (a `parameters` dictionary keeps its keys), GUID fields as
|
|
15
|
+
* {@link G9WireGuid}. G9Long values stay as they are (the protocol writes them as int64).
|
|
16
|
+
*/
|
|
17
|
+
export declare function toMessagePackNames(value: unknown): unknown;
|
|
18
|
+
/** A byte[] field: base64 text (JSON) or bytes (MessagePack). */
|
|
19
|
+
export declare function bytesField(value: unknown): Uint8Array | null;
|
|
20
|
+
/** Epoch milliseconds of a wire DateTime: ISO text (JSON) or a Date (MessagePack timestamp). */
|
|
21
|
+
export declare function dateTimeMs(value: unknown): number;
|
|
22
|
+
export declare function readSyncError(value: unknown): G9DtSyncError | null;
|
|
23
|
+
export declare function readNegotiatedTable(value: unknown): G9DtNegotiatedTable;
|
|
24
|
+
export declare function readSubscriptionDefinition(value: unknown): G9DtSubscriptionDefinition;
|
|
25
|
+
export declare function readSubscriptionState(value: unknown): G9DtSubscriptionState;
|
|
26
|
+
export declare function readHelloResult(value: unknown): G9DtHelloResult;
|
|
27
|
+
export declare function readPushResult(value: unknown): G9DtPushResult;
|
|
28
|
+
export declare function readPullPlan(value: unknown): G9DtPullPlan;
|
|
29
|
+
export declare function readContinuation(value: unknown): G9DtPullContinuation | null;
|
|
30
|
+
export declare function readReconcileSummary(value: unknown): G9DtReconcileSummary | null;
|
|
31
|
+
export declare function readSyncChunk(value: unknown): G9DtSyncChunk;
|
|
32
|
+
export declare function readChangesAvailable(value: unknown): G9DtChangesAvailable;
|