@markless/serializer 0.3.0 → 0.3.2

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/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { _ as ASYNC_PROTOCOL_VERSION, a as ProtocolEventAction, c as ProtocolPayloadScripts, d as ProtocolSyncPolicy, f as ProtocolSyncPolicyBranch, g as protocolEventDispatchesMarkless, h as protocolEventActionKind, i as ProtocolAsyncBoundaryArm, l as ProtocolStatePayload, m as ProtocolViewPayload, n as ProtocolArmBranchRecord, o as ProtocolEventActionKind, p as ProtocolSyncPolicyCondition, r as ProtocolArmRecordSet, s as ProtocolEventRecord, t as PROTOCOL_EVENT_ACTION_KIND, u as ProtocolStreamedArmPatch, v as STORAGE_PROTOCOL_VERSION, y as ASYNC_BOUNDARY_ARM } from "./protocol--6NOPwgQ.js";
1
+ import { _ as ASYNC_PROTOCOL_VERSION, a as ProtocolEventAction, b as ASYNC_BOUNDARY_ARM, c as ProtocolPayloadScripts, d as ProtocolSyncPolicy, f as ProtocolSyncPolicyBranch, g as protocolEventDispatchesMarkless, h as protocolEventActionKind, i as ProtocolAsyncBoundaryArm, l as ProtocolStatePayload, m as ProtocolViewPayload, n as ProtocolArmBranchRecord, o as ProtocolEventActionKind, p as ProtocolSyncPolicyCondition, r as ProtocolArmRecordSet, s as ProtocolEventRecord, t as PROTOCOL_EVENT_ACTION_KIND, u as ProtocolStreamedArmPatch, v as STORAGE_PROTOCOL_VERSION, y as protocolStateVersion } from "./protocol-BfzeLgjZ.js";
2
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-BJ6YNKDd.js";
3
- import { a as RuntimePayloadError, c as assertProtocolStateCellPayload, d as decodePayloadScriptsWithVersion, f as invalidPayloadShapeError, i as RuntimePayloadDiagnostic, l as assertProtocolStatePayload, m as payloadScriptSelector, n as DecodedPayloadScripts, o as RuntimePayloadErrorCode, p as payloadInvalidError, r as EncodedPayloadScripts, s as RuntimePayloadType, t as decodePayloadScripts, u as assertProtocolViewPayload } from "./protocol-validation-storage-C9wAbNbb.js";
3
+ import { a as RuntimePayloadError, c as assertProtocolStateCellPayload, d as decodePayloadScriptsWithVersion, f as invalidPayloadShapeError, i as RuntimePayloadDiagnostic, l as assertProtocolStatePayload, m as payloadScriptSelector, n as DecodedPayloadScripts, o as RuntimePayloadErrorCode, p as payloadInvalidError, r as EncodedPayloadScripts, s as RuntimePayloadType, t as decodePayloadScripts, u as assertProtocolViewPayload } from "./protocol-validation-storage-DogbS8xp.js";
4
4
 
5
5
  //#region src/payload-scripts.d.ts
6
6
  type RenderPayloadScriptsInput = {
@@ -102,4 +102,4 @@ declare function storageSlotEntryKeyFromGraphNodeId(graphNodeId: string): string
102
102
  declare function createStorageSeedMetadata(moduleId: string, driverKey: string, fallback: string): StorageSeedMetadata;
103
103
  declare function createStorageSeedMetadataFromGraphNodeId(graphNodeId: string, driverKey: string, fallback: string): StorageSeedMetadata;
104
104
  //#endregion
105
- export { ASYNC_BOUNDARY_ARM, ASYNC_PROTOCOL_VERSION, DecodedPayloadScripts, EncodedPayloadScripts, PROTOCOL_EVENT_ACTION_KIND, ProtocolArmBranchRecord, ProtocolArmRecordSet, ProtocolAsyncBoundaryArm, ProtocolAsyncComputedSnapshotInput, ProtocolEventAction, ProtocolEventActionKind, ProtocolEventRecord, ProtocolPayloadScripts, ProtocolStatePayload, ProtocolStatePayloadInput, ProtocolStateSerializationDiagnostic, ProtocolStateSerializationError, ProtocolStreamedArmPatch, ProtocolSyncPolicy, ProtocolSyncPolicyBranch, ProtocolSyncPolicyCondition, ProtocolViewPayload, RenderPayloadScriptsInput, RenderedPayloadScripts, ResumeRecordDeltaClassification, type ResumeRecordSet, RuntimePayloadDiagnostic, RuntimePayloadError, RuntimePayloadErrorCode, RuntimePayloadType, STORAGE_PROTOCOL_VERSION, STORAGE_SLOT_SYMBOL_KEY, SerializationDiagnostic, SerializationResult, SerializedGraphPayload, SerializedPrimitive, SerializedRecord, SerializedSlot, StorageSeedMetadata, TypedArrayName, assertProtocolStateCellPayload, assertProtocolStatePayload, assertProtocolViewPayload, classifyResumeRecordDelta, createProtocolStatePayload, createStorageSeedMetadata, createStorageSeedMetadataFromGraphNodeId, decodePayloadScripts, decodePayloadScriptsWithVersion, deserializeGraphValue, invalidPayloadShapeError, isValidStorageKey, mergeResumeRecordDelta, payloadInvalidError, payloadScriptSelector, protocolEventActionKind, protocolEventDispatchesMarkless, renderPayloadScripts, serializeGraphValue, serializeRuntimeAsyncSnapshots, serializeRuntimeStateCells, storageAttributeName, storageSlotEntryKey, storageSlotEntryKeyFromGraphNodeId };
105
+ export { ASYNC_BOUNDARY_ARM, ASYNC_PROTOCOL_VERSION, DecodedPayloadScripts, EncodedPayloadScripts, PROTOCOL_EVENT_ACTION_KIND, ProtocolArmBranchRecord, ProtocolArmRecordSet, ProtocolAsyncBoundaryArm, ProtocolAsyncComputedSnapshotInput, ProtocolEventAction, ProtocolEventActionKind, ProtocolEventRecord, ProtocolPayloadScripts, ProtocolStatePayload, ProtocolStatePayloadInput, ProtocolStateSerializationDiagnostic, ProtocolStateSerializationError, ProtocolStreamedArmPatch, ProtocolSyncPolicy, ProtocolSyncPolicyBranch, ProtocolSyncPolicyCondition, ProtocolViewPayload, RenderPayloadScriptsInput, RenderedPayloadScripts, ResumeRecordDeltaClassification, type ResumeRecordSet, RuntimePayloadDiagnostic, RuntimePayloadError, RuntimePayloadErrorCode, RuntimePayloadType, STORAGE_PROTOCOL_VERSION, STORAGE_SLOT_SYMBOL_KEY, SerializationDiagnostic, SerializationResult, SerializedGraphPayload, SerializedPrimitive, SerializedRecord, SerializedSlot, StorageSeedMetadata, TypedArrayName, assertProtocolStateCellPayload, assertProtocolStatePayload, assertProtocolViewPayload, classifyResumeRecordDelta, createProtocolStatePayload, createStorageSeedMetadata, createStorageSeedMetadataFromGraphNodeId, decodePayloadScripts, decodePayloadScriptsWithVersion, deserializeGraphValue, invalidPayloadShapeError, isValidStorageKey, mergeResumeRecordDelta, payloadInvalidError, payloadScriptSelector, protocolEventActionKind, protocolEventDispatchesMarkless, protocolStateVersion, renderPayloadScripts, serializeGraphValue, serializeRuntimeAsyncSnapshots, serializeRuntimeStateCells, storageAttributeName, storageSlotEntryKey, storageSlotEntryKeyFromGraphNodeId };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { a as ASYNC_PROTOCOL_VERSION, i as ASYNC_BOUNDARY_ARM, n as protocolEventActionKind, o as STORAGE_PROTOCOL_VERSION, r as protocolEventDispatchesMarkless, t as PROTOCOL_EVENT_ACTION_KIND } from "./protocol-Bzvnaz87.js";
1
+ import { a as ASYNC_PROTOCOL_VERSION, i as ASYNC_BOUNDARY_ARM, n as protocolEventActionKind, o as STORAGE_PROTOCOL_VERSION, r as protocolEventDispatchesMarkless, s as protocolStateVersion, t as PROTOCOL_EVENT_ACTION_KIND } from "./protocol-BX4yw9bm.js";
2
2
  import { deserializeGraphValue } from "./decode.js";
3
- import { a as assertProtocolStatePayload, c as invalidPayloadShapeError, i as assertProtocolStateCellPayload, l as payloadInvalidError, n as isValidStorageKey, o as assertProtocolViewPayload, r as RuntimePayloadError, s as decodePayloadScriptsWithVersion, t as decodePayloadScripts, u as payloadScriptSelector } from "./protocol-validation-storage-DBEF2IjR.js";
3
+ import { a as assertProtocolStatePayload, c as invalidPayloadShapeError, i as assertProtocolStateCellPayload, l as payloadInvalidError, n as isValidStorageKey, o as assertProtocolViewPayload, r as RuntimePayloadError, s as decodePayloadScriptsWithVersion, t as decodePayloadScripts, u as payloadScriptSelector } from "./protocol-validation-storage-BQ8D2S5j.js";
4
4
  //#region src/payload-scripts.ts
5
5
  function renderPayloadScripts(input) {
6
6
  return {
@@ -291,7 +291,7 @@ var ProtocolStateSerializationError = class extends Error {
291
291
  function createProtocolStatePayload(input) {
292
292
  const storage = input.storage ?? [];
293
293
  return {
294
- version: storage.length > 0 ? 2 : 1,
294
+ version: protocolStateVersion(storage),
295
295
  cells: input.cells.map((cell) => {
296
296
  const result = serializeGraphValue(cell.value);
297
297
  if (!result.ok) throw protocolStateSerializationError(cell, result.diagnostics[0]);
@@ -574,4 +574,4 @@ function createStorageSeedMetadataFromGraphNodeId(graphNodeId, driverKey, fallba
574
574
  };
575
575
  }
576
576
  //#endregion
577
- export { ASYNC_BOUNDARY_ARM, ASYNC_PROTOCOL_VERSION, PROTOCOL_EVENT_ACTION_KIND, ProtocolStateSerializationError, RuntimePayloadError, STORAGE_PROTOCOL_VERSION, STORAGE_SLOT_SYMBOL_KEY, assertProtocolStateCellPayload, assertProtocolStatePayload, assertProtocolViewPayload, classifyResumeRecordDelta, createProtocolStatePayload, createStorageSeedMetadata, createStorageSeedMetadataFromGraphNodeId, decodePayloadScripts, decodePayloadScriptsWithVersion, deserializeGraphValue, invalidPayloadShapeError, isValidStorageKey, mergeResumeRecordDelta, payloadInvalidError, payloadScriptSelector, protocolEventActionKind, protocolEventDispatchesMarkless, renderPayloadScripts, serializeGraphValue, serializeRuntimeAsyncSnapshots, serializeRuntimeStateCells, storageAttributeName, storageSlotEntryKey, storageSlotEntryKeyFromGraphNodeId };
577
+ export { ASYNC_BOUNDARY_ARM, ASYNC_PROTOCOL_VERSION, PROTOCOL_EVENT_ACTION_KIND, ProtocolStateSerializationError, RuntimePayloadError, STORAGE_PROTOCOL_VERSION, STORAGE_SLOT_SYMBOL_KEY, assertProtocolStateCellPayload, assertProtocolStatePayload, assertProtocolViewPayload, classifyResumeRecordDelta, createProtocolStatePayload, createStorageSeedMetadata, createStorageSeedMetadataFromGraphNodeId, decodePayloadScripts, decodePayloadScriptsWithVersion, deserializeGraphValue, invalidPayloadShapeError, isValidStorageKey, mergeResumeRecordDelta, payloadInvalidError, payloadScriptSelector, protocolEventActionKind, protocolEventDispatchesMarkless, protocolStateVersion, renderPayloadScripts, serializeGraphValue, serializeRuntimeAsyncSnapshots, serializeRuntimeStateCells, storageAttributeName, storageSlotEntryKey, storageSlotEntryKeyFromGraphNodeId };
@@ -1,6 +1,9 @@
1
1
  //#region src/protocol-constants.ts
2
2
  const ASYNC_PROTOCOL_VERSION = 1;
3
3
  const STORAGE_PROTOCOL_VERSION = 2;
4
+ function protocolStateVersion(storage) {
5
+ return (storage?.length ?? 0) > 0 ? 2 : 1;
6
+ }
4
7
  //#endregion
5
8
  //#region src/async-boundary-arm.ts
6
9
  const ASYNC_BOUNDARY_ARM = {
@@ -25,4 +28,4 @@ function protocolEventDispatchesMarkless(record) {
25
28
  return PROTOCOL_EVENT_ACTION_DISPATCHES_MARKLESS[protocolEventActionKind(record)];
26
29
  }
27
30
  //#endregion
28
- export { ASYNC_PROTOCOL_VERSION as a, ASYNC_BOUNDARY_ARM as i, protocolEventActionKind as n, STORAGE_PROTOCOL_VERSION as o, protocolEventDispatchesMarkless as r, PROTOCOL_EVENT_ACTION_KIND as t };
31
+ export { ASYNC_PROTOCOL_VERSION as a, ASYNC_BOUNDARY_ARM as i, protocolEventActionKind as n, STORAGE_PROTOCOL_VERSION as o, protocolEventDispatchesMarkless as r, protocolStateVersion as s, PROTOCOL_EVENT_ACTION_KIND as t };
@@ -8,6 +8,7 @@ declare const ASYNC_BOUNDARY_ARM: {
8
8
  //#region src/protocol-constants.d.ts
9
9
  declare const ASYNC_PROTOCOL_VERSION = 1;
10
10
  declare const STORAGE_PROTOCOL_VERSION = 2;
11
+ declare function protocolStateVersion(storage: readonly unknown[] | undefined): typeof ASYNC_PROTOCOL_VERSION | typeof STORAGE_PROTOCOL_VERSION;
11
12
  //#endregion
12
13
  //#region src/protocol.d.ts
13
14
  type ProtocolAsyncBoundaryArm = (typeof ASYNC_BOUNDARY_ARM)[keyof typeof ASYNC_BOUNDARY_ARM];
@@ -284,4 +285,4 @@ type ProtocolPayloadScripts = {
284
285
  readonly viewScript: string;
285
286
  };
286
287
  //#endregion
287
- export { ASYNC_PROTOCOL_VERSION as _, ProtocolEventAction as a, ProtocolPayloadScripts as c, ProtocolSyncPolicy as d, ProtocolSyncPolicyBranch as f, protocolEventDispatchesMarkless as g, protocolEventActionKind as h, ProtocolAsyncBoundaryArm as i, ProtocolStatePayload as l, ProtocolViewPayload as m, ProtocolArmBranchRecord as n, ProtocolEventActionKind as o, ProtocolSyncPolicyCondition as p, ProtocolArmRecordSet as r, ProtocolEventRecord as s, PROTOCOL_EVENT_ACTION_KIND as t, ProtocolStreamedArmPatch as u, STORAGE_PROTOCOL_VERSION as v, ASYNC_BOUNDARY_ARM as y };
288
+ export { ASYNC_PROTOCOL_VERSION as _, ProtocolEventAction as a, ASYNC_BOUNDARY_ARM as b, ProtocolPayloadScripts as c, ProtocolSyncPolicy as d, ProtocolSyncPolicyBranch as f, protocolEventDispatchesMarkless as g, protocolEventActionKind as h, ProtocolAsyncBoundaryArm as i, ProtocolStatePayload as l, ProtocolViewPayload as m, ProtocolArmBranchRecord as n, ProtocolEventActionKind as o, ProtocolSyncPolicyCondition as p, ProtocolArmRecordSet as r, ProtocolEventRecord as s, PROTOCOL_EVENT_ACTION_KIND as t, ProtocolStreamedArmPatch as u, STORAGE_PROTOCOL_VERSION as v, protocolStateVersion as y };
@@ -1,4 +1,4 @@
1
- import { i as ASYNC_BOUNDARY_ARM, t as PROTOCOL_EVENT_ACTION_KIND } from "./protocol-Bzvnaz87.js";
1
+ import { i as ASYNC_BOUNDARY_ARM, t as PROTOCOL_EVENT_ACTION_KIND } from "./protocol-BX4yw9bm.js";
2
2
  //#region src/protocol-validation.ts
3
3
  var RuntimePayloadError = class extends Error {
4
4
  constructor(diagnostic) {
@@ -1,4 +1,4 @@
1
- import { l as ProtocolStatePayload, m as ProtocolViewPayload } from "./protocol--6NOPwgQ.js";
1
+ import { l as ProtocolStatePayload, m as ProtocolViewPayload } from "./protocol-BfzeLgjZ.js";
2
2
 
3
3
  //#region src/protocol-validation.d.ts
4
4
  type EncodedPayloadScripts = {
@@ -1,2 +1,2 @@
1
- import { a as RuntimePayloadError, c as assertProtocolStateCellPayload, d as decodePayloadScriptsWithVersion, f as invalidPayloadShapeError, i as RuntimePayloadDiagnostic, l as assertProtocolStatePayload, m as payloadScriptSelector, n as DecodedPayloadScripts, o as RuntimePayloadErrorCode, p as payloadInvalidError, r as EncodedPayloadScripts, s as RuntimePayloadType, t as decodePayloadScripts, u as assertProtocolViewPayload } from "./protocol-validation-storage-C9wAbNbb.js";
1
+ import { a as RuntimePayloadError, c as assertProtocolStateCellPayload, d as decodePayloadScriptsWithVersion, f as invalidPayloadShapeError, i as RuntimePayloadDiagnostic, l as assertProtocolStatePayload, m as payloadScriptSelector, n as DecodedPayloadScripts, o as RuntimePayloadErrorCode, p as payloadInvalidError, r as EncodedPayloadScripts, s as RuntimePayloadType, t as decodePayloadScripts, u as assertProtocolViewPayload } from "./protocol-validation-storage-DogbS8xp.js";
2
2
  export { DecodedPayloadScripts, EncodedPayloadScripts, RuntimePayloadDiagnostic, RuntimePayloadError, RuntimePayloadErrorCode, RuntimePayloadType, assertProtocolStateCellPayload, assertProtocolStatePayload, assertProtocolViewPayload, decodePayloadScripts, decodePayloadScriptsWithVersion, invalidPayloadShapeError, payloadInvalidError, payloadScriptSelector };
@@ -1,2 +1,2 @@
1
- import { a as assertProtocolStatePayload, c as invalidPayloadShapeError, i as assertProtocolStateCellPayload, l as payloadInvalidError, o as assertProtocolViewPayload, r as RuntimePayloadError, s as decodePayloadScriptsWithVersion, t as decodePayloadScripts, u as payloadScriptSelector } from "./protocol-validation-storage-DBEF2IjR.js";
1
+ import { a as assertProtocolStatePayload, c as invalidPayloadShapeError, i as assertProtocolStateCellPayload, l as payloadInvalidError, o as assertProtocolViewPayload, r as RuntimePayloadError, s as decodePayloadScriptsWithVersion, t as decodePayloadScripts, u as payloadScriptSelector } from "./protocol-validation-storage-BQ8D2S5j.js";
2
2
  export { RuntimePayloadError, assertProtocolStateCellPayload, assertProtocolStatePayload, assertProtocolViewPayload, decodePayloadScripts, decodePayloadScriptsWithVersion, invalidPayloadShapeError, payloadInvalidError, payloadScriptSelector };
@@ -1,2 +1,2 @@
1
- import { _ as ASYNC_PROTOCOL_VERSION, a as ProtocolEventAction, c as ProtocolPayloadScripts, d as ProtocolSyncPolicy, f as ProtocolSyncPolicyBranch, g as protocolEventDispatchesMarkless, h as protocolEventActionKind, i as ProtocolAsyncBoundaryArm, l as ProtocolStatePayload, m as ProtocolViewPayload, n as ProtocolArmBranchRecord, o as ProtocolEventActionKind, p as ProtocolSyncPolicyCondition, r as ProtocolArmRecordSet, s as ProtocolEventRecord, t as PROTOCOL_EVENT_ACTION_KIND, u as ProtocolStreamedArmPatch, v as STORAGE_PROTOCOL_VERSION, y as ASYNC_BOUNDARY_ARM } from "./protocol--6NOPwgQ.js";
2
- export { ASYNC_BOUNDARY_ARM, ASYNC_PROTOCOL_VERSION, PROTOCOL_EVENT_ACTION_KIND, ProtocolArmBranchRecord, ProtocolArmRecordSet, ProtocolAsyncBoundaryArm, ProtocolEventAction, ProtocolEventActionKind, ProtocolEventRecord, ProtocolPayloadScripts, ProtocolStatePayload, ProtocolStreamedArmPatch, ProtocolSyncPolicy, ProtocolSyncPolicyBranch, ProtocolSyncPolicyCondition, ProtocolViewPayload, STORAGE_PROTOCOL_VERSION, protocolEventActionKind, protocolEventDispatchesMarkless };
1
+ import { _ as ASYNC_PROTOCOL_VERSION, a as ProtocolEventAction, b as ASYNC_BOUNDARY_ARM, c as ProtocolPayloadScripts, d as ProtocolSyncPolicy, f as ProtocolSyncPolicyBranch, g as protocolEventDispatchesMarkless, h as protocolEventActionKind, i as ProtocolAsyncBoundaryArm, l as ProtocolStatePayload, m as ProtocolViewPayload, n as ProtocolArmBranchRecord, o as ProtocolEventActionKind, p as ProtocolSyncPolicyCondition, r as ProtocolArmRecordSet, s as ProtocolEventRecord, t as PROTOCOL_EVENT_ACTION_KIND, u as ProtocolStreamedArmPatch, v as STORAGE_PROTOCOL_VERSION, y as protocolStateVersion } from "./protocol-BfzeLgjZ.js";
2
+ export { ASYNC_BOUNDARY_ARM, ASYNC_PROTOCOL_VERSION, PROTOCOL_EVENT_ACTION_KIND, ProtocolArmBranchRecord, ProtocolArmRecordSet, ProtocolAsyncBoundaryArm, ProtocolEventAction, ProtocolEventActionKind, ProtocolEventRecord, ProtocolPayloadScripts, ProtocolStatePayload, ProtocolStreamedArmPatch, ProtocolSyncPolicy, ProtocolSyncPolicyBranch, ProtocolSyncPolicyCondition, ProtocolViewPayload, STORAGE_PROTOCOL_VERSION, protocolEventActionKind, protocolEventDispatchesMarkless, protocolStateVersion };
package/dist/protocol.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as ASYNC_PROTOCOL_VERSION, i as ASYNC_BOUNDARY_ARM, n as protocolEventActionKind, o as STORAGE_PROTOCOL_VERSION, r as protocolEventDispatchesMarkless, t as PROTOCOL_EVENT_ACTION_KIND } from "./protocol-Bzvnaz87.js";
2
- export { ASYNC_BOUNDARY_ARM, ASYNC_PROTOCOL_VERSION, PROTOCOL_EVENT_ACTION_KIND, STORAGE_PROTOCOL_VERSION, protocolEventActionKind, protocolEventDispatchesMarkless };
1
+ import { a as ASYNC_PROTOCOL_VERSION, i as ASYNC_BOUNDARY_ARM, n as protocolEventActionKind, o as STORAGE_PROTOCOL_VERSION, r as protocolEventDispatchesMarkless, s as protocolStateVersion, t as PROTOCOL_EVENT_ACTION_KIND } from "./protocol-BX4yw9bm.js";
2
+ export { ASYNC_BOUNDARY_ARM, ASYNC_PROTOCOL_VERSION, PROTOCOL_EVENT_ACTION_KIND, STORAGE_PROTOCOL_VERSION, protocolEventActionKind, protocolEventDispatchesMarkless, protocolStateVersion };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markless/serializer",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Markless serialization tiers and resumability payload protocol.",
5
5
  "license": "MIT",
6
6
  "repository": {