@markless/serializer 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/decode-client.d.ts +1 -1
- package/dist/decode-client.js +1 -1
- package/dist/decode.d.ts +1 -1
- package/dist/index.d.ts +18 -3
- package/dist/index.js +7 -5
- package/dist/protocol-validation-DoQNwYjl.js +699 -0
- package/dist/protocol-validation.js +1 -664
- package/dist/protocol.d.ts +8 -2
- package/dist/protocol.js +2 -1
- package/package.json +3 -2
- /package/dist/{value-decode-extensions-BhNCyKre.js → value-decode-extensions-9I1L0f-F.js} +0 -0
- /package/dist/{value-CcROymhu.d.ts → value-h64yUmxK.d.ts} +0 -0
package/dist/decode-client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as SerializedRecord, o as SerializedSlot, r as SerializedGraphPayload } from "./value-
|
|
1
|
+
import { a as SerializedRecord, o as SerializedSlot, r as SerializedGraphPayload } from "./value-h64yUmxK.js";
|
|
2
2
|
|
|
3
3
|
//#region src/value-decode-client.d.ts
|
|
4
4
|
type ValueDecodeExtensions = {
|
package/dist/decode-client.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/value-decode-client.ts
|
|
2
2
|
async function deserializeGraphValueForClient(payload) {
|
|
3
|
-
return deserializeGraphValueWithExtensions(payload, payloadNeedsExtendedDecoders(payload) ? (await import("./value-decode-extensions-
|
|
3
|
+
return deserializeGraphValueWithExtensions(payload, payloadNeedsExtendedDecoders(payload) ? (await import("./value-decode-extensions-9I1L0f-F.js")).valueDecodeExtensions : void 0);
|
|
4
4
|
}
|
|
5
5
|
function deserializeGraphValueWithExtensions(payload, extensions) {
|
|
6
6
|
const shells = /* @__PURE__ */ new Map();
|
package/dist/decode.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as SerializedRecord, l as deserializeGraphValue, o as SerializedSlot, r as SerializedGraphPayload } from "./value-
|
|
1
|
+
import { a as SerializedRecord, l as deserializeGraphValue, o as SerializedSlot, r as SerializedGraphPayload } from "./value-h64yUmxK.js";
|
|
2
2
|
export { SerializedGraphPayload, SerializedRecord, SerializedSlot, deserializeGraphValue };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ASYNC_PROTOCOL_VERSION, ProtocolArmBranchRecord, ProtocolArmRecordSet, ProtocolPayloadScripts, ProtocolStatePayload, ProtocolSyncPolicy, ProtocolSyncPolicyBranch, ProtocolSyncPolicyCondition, ProtocolViewPayload } from "./protocol.js";
|
|
2
|
-
import { a as SerializedRecord, c as serializeGraphValue, i as SerializedPrimitive, l as deserializeGraphValue, n as SerializationResult, o as SerializedSlot, r as SerializedGraphPayload, s as TypedArrayName, t as SerializationDiagnostic } from "./value-
|
|
1
|
+
import { ASYNC_PROTOCOL_VERSION, ProtocolArmBranchRecord, ProtocolArmRecordSet, ProtocolPayloadScripts, ProtocolStatePayload, ProtocolSyncPolicy, ProtocolSyncPolicyBranch, ProtocolSyncPolicyCondition, ProtocolViewPayload, STORAGE_PROTOCOL_VERSION } from "./protocol.js";
|
|
2
|
+
import { a as SerializedRecord, c as serializeGraphValue, i as SerializedPrimitive, l as deserializeGraphValue, n as SerializationResult, o as SerializedSlot, r as SerializedGraphPayload, s as TypedArrayName, t as SerializationDiagnostic } from "./value-h64yUmxK.js";
|
|
3
3
|
import { DecodedPayloadScripts, EncodedPayloadScripts, RuntimePayloadDiagnostic, RuntimePayloadError, RuntimePayloadErrorCode, RuntimePayloadType, assertProtocolStateCellPayload, assertProtocolStatePayload, assertProtocolViewPayload, decodePayloadScripts, payloadInvalidError, payloadScriptSelector } from "./protocol-validation.js";
|
|
4
4
|
|
|
5
5
|
//#region src/payload-scripts.d.ts
|
|
@@ -45,6 +45,7 @@ type ProtocolStatePayloadInput = {
|
|
|
45
45
|
readonly snapshot?: ProtocolAsyncComputedSnapshotInput;
|
|
46
46
|
}>;
|
|
47
47
|
readonly sharedDefinitions?: ProtocolStatePayload['sharedDefinitions'];
|
|
48
|
+
readonly storage?: ProtocolStatePayload['storage'];
|
|
48
49
|
};
|
|
49
50
|
type ProtocolStateSerializationDiagnostic = SerializationDiagnostic & {
|
|
50
51
|
readonly graphNodeId: string;
|
|
@@ -69,4 +70,18 @@ declare function createProtocolStatePayload(input: ProtocolStatePayloadInput): P
|
|
|
69
70
|
declare function serializeRuntimeStateCells(cells: ProtocolStatePayload['cells']): ProtocolStatePayload['cells'];
|
|
70
71
|
declare function serializeRuntimeAsyncSnapshots(computed: ProtocolStatePayload['computed']): ProtocolStatePayload['computed'];
|
|
71
72
|
//#endregion
|
|
72
|
-
|
|
73
|
+
//#region src/storage-slot.d.ts
|
|
74
|
+
declare const STORAGE_SLOT_SYMBOL_KEY = "tsrx.storage/1";
|
|
75
|
+
declare function storageAttributeName(driverKey: string): string;
|
|
76
|
+
declare function isValidStorageKey(value: string): boolean;
|
|
77
|
+
type StorageSeedMetadata = {
|
|
78
|
+
readonly slotKey: string;
|
|
79
|
+
readonly driverKey: string;
|
|
80
|
+
readonly fallback: string;
|
|
81
|
+
};
|
|
82
|
+
declare function storageSlotEntryKey(moduleId: string, key: string): string;
|
|
83
|
+
declare function storageSlotEntryKeyFromGraphNodeId(graphNodeId: string): string;
|
|
84
|
+
declare function createStorageSeedMetadata(moduleId: string, driverKey: string, fallback: string): StorageSeedMetadata;
|
|
85
|
+
declare function createStorageSeedMetadataFromGraphNodeId(graphNodeId: string, driverKey: string, fallback: string): StorageSeedMetadata;
|
|
86
|
+
//#endregion
|
|
87
|
+
export { ASYNC_PROTOCOL_VERSION, DecodedPayloadScripts, EncodedPayloadScripts, ProtocolArmBranchRecord, ProtocolArmRecordSet, ProtocolAsyncComputedSnapshotInput, ProtocolPayloadScripts, ProtocolStatePayload, ProtocolStatePayloadInput, ProtocolStateSerializationDiagnostic, ProtocolStateSerializationError, ProtocolSyncPolicy, ProtocolSyncPolicyBranch, ProtocolSyncPolicyCondition, ProtocolViewPayload, RenderPayloadScriptsInput, RenderedPayloadScripts, RuntimePayloadDiagnostic, RuntimePayloadError, RuntimePayloadErrorCode, RuntimePayloadType, STORAGE_PROTOCOL_VERSION, STORAGE_SLOT_SYMBOL_KEY, SerializationDiagnostic, SerializationResult, SerializedGraphPayload, SerializedPrimitive, SerializedRecord, SerializedSlot, StorageSeedMetadata, TypedArrayName, assertProtocolStateCellPayload, assertProtocolStatePayload, assertProtocolViewPayload, createProtocolStatePayload, createStorageSeedMetadata, createStorageSeedMetadataFromGraphNodeId, decodePayloadScripts, deserializeGraphValue, isValidStorageKey, payloadInvalidError, payloadScriptSelector, renderPayloadScripts, serializeGraphValue, serializeRuntimeAsyncSnapshots, serializeRuntimeStateCells, storageAttributeName, storageSlotEntryKey, storageSlotEntryKeyFromGraphNodeId };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ASYNC_PROTOCOL_VERSION } from "./protocol.js";
|
|
1
|
+
import { ASYNC_PROTOCOL_VERSION, STORAGE_PROTOCOL_VERSION } from "./protocol.js";
|
|
2
2
|
import { deserializeGraphValue } from "./decode.js";
|
|
3
|
-
import {
|
|
3
|
+
import { a as decodePayloadScripts, c as STORAGE_SLOT_SYMBOL_KEY, d as isValidStorageKey, f as storageAttributeName, i as assertProtocolViewPayload, l as createStorageSeedMetadata, m as storageSlotEntryKeyFromGraphNodeId, n as assertProtocolStateCellPayload, o as payloadInvalidError, p as storageSlotEntryKey, r as assertProtocolStatePayload, s as payloadScriptSelector, t as RuntimePayloadError, u as createStorageSeedMetadataFromGraphNodeId } from "./protocol-validation-DoQNwYjl.js";
|
|
4
4
|
//#region src/payload-scripts.ts
|
|
5
5
|
function renderPayloadScripts(input) {
|
|
6
6
|
return {
|
|
@@ -289,8 +289,9 @@ var ProtocolStateSerializationError = class extends Error {
|
|
|
289
289
|
}
|
|
290
290
|
};
|
|
291
291
|
function createProtocolStatePayload(input) {
|
|
292
|
+
const storage = input.storage ?? [];
|
|
292
293
|
return {
|
|
293
|
-
version: 1,
|
|
294
|
+
version: storage.length > 0 ? 2 : 1,
|
|
294
295
|
cells: input.cells.map((cell) => {
|
|
295
296
|
const result = serializeGraphValue(cell.value);
|
|
296
297
|
if (!result.ok) throw protocolStateSerializationError(cell, result.diagnostics[0]);
|
|
@@ -302,7 +303,8 @@ function createProtocolStatePayload(input) {
|
|
|
302
303
|
};
|
|
303
304
|
}),
|
|
304
305
|
computed: (input.computed ?? []).map(serializeComputedSnapshot),
|
|
305
|
-
sharedDefinitions: input.sharedDefinitions
|
|
306
|
+
sharedDefinitions: input.sharedDefinitions,
|
|
307
|
+
...storage.length > 0 ? { storage } : {}
|
|
306
308
|
};
|
|
307
309
|
}
|
|
308
310
|
function serializeRuntimeStateCells(cells) {
|
|
@@ -399,4 +401,4 @@ function protocolStateSerializationError(cell, diagnostic) {
|
|
|
399
401
|
});
|
|
400
402
|
}
|
|
401
403
|
//#endregion
|
|
402
|
-
export { ASYNC_PROTOCOL_VERSION, ProtocolStateSerializationError, RuntimePayloadError, assertProtocolStateCellPayload, assertProtocolStatePayload, assertProtocolViewPayload, createProtocolStatePayload, decodePayloadScripts, deserializeGraphValue, payloadInvalidError, payloadScriptSelector, renderPayloadScripts, serializeGraphValue, serializeRuntimeAsyncSnapshots, serializeRuntimeStateCells };
|
|
404
|
+
export { ASYNC_PROTOCOL_VERSION, ProtocolStateSerializationError, RuntimePayloadError, STORAGE_PROTOCOL_VERSION, STORAGE_SLOT_SYMBOL_KEY, assertProtocolStateCellPayload, assertProtocolStatePayload, assertProtocolViewPayload, createProtocolStatePayload, createStorageSeedMetadata, createStorageSeedMetadataFromGraphNodeId, decodePayloadScripts, deserializeGraphValue, isValidStorageKey, payloadInvalidError, payloadScriptSelector, renderPayloadScripts, serializeGraphValue, serializeRuntimeAsyncSnapshots, serializeRuntimeStateCells, storageAttributeName, storageSlotEntryKey, storageSlotEntryKeyFromGraphNodeId };
|