hikoutei 0.3.1 → 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/apps-script/gateway/Code.gs +41 -6
- package/dist/adapter/sheets/providers/apps-script-gateway/operations/effect/effectOperationScript.d.ts.map +1 -1
- package/dist/adapter/sheets/providers/apps-script-gateway/operations/effect/effectOperationScript.js +4 -25
- package/dist/adapter/sheets/providers/apps-script-gateway/operations/effect/effectOperationScript.js.map +1 -1
- package/dist/adapter/sheets/providers/apps-script-gateway/operations/observation/observationOperation.d.ts.map +1 -1
- package/dist/adapter/sheets/providers/apps-script-gateway/operations/observation/observationOperation.js +4 -23
- package/dist/adapter/sheets/providers/apps-script-gateway/operations/observation/observationOperation.js.map +1 -1
- package/dist/adapter/sheets/providers/apps-script-gateway/operations/shared/appsScriptStableCodecSource.d.ts +8 -0
- package/dist/adapter/sheets/providers/apps-script-gateway/operations/shared/appsScriptStableCodecSource.d.ts.map +1 -0
- package/dist/adapter/sheets/providers/apps-script-gateway/operations/shared/appsScriptStableCodecSource.js +122 -0
- package/dist/adapter/sheets/providers/apps-script-gateway/operations/shared/appsScriptStableCodecSource.js.map +1 -0
- package/dist/adapter/sheets/providers/apps-script-gateway/protocol/syncProtocol.d.ts.map +1 -1
- package/dist/adapter/sheets/providers/apps-script-gateway/protocol/syncProtocol.js +15 -36
- package/dist/adapter/sheets/providers/apps-script-gateway/protocol/syncProtocol.js.map +1 -1
- package/dist/adapter/sheets/providers/apps-script-gateway/protocol/types.d.ts +2 -3
- package/dist/adapter/sheets/providers/apps-script-gateway/protocol/types.d.ts.map +1 -1
- package/dist/shared/encoding/constants.d.ts +1 -12
- package/dist/shared/encoding/constants.d.ts.map +1 -1
- package/dist/shared/encoding/constants.js +1 -10
- package/dist/shared/encoding/constants.js.map +1 -1
- package/dist/shared/encoding/stableEncode.d.ts +3 -30
- package/dist/shared/encoding/stableEncode.d.ts.map +1 -1
- package/dist/shared/encoding/stableEncode.js +12 -195
- package/dist/shared/encoding/stableEncode.js.map +1 -1
- package/dist/shared/encoding/types.d.ts +4 -9
- package/dist/shared/encoding/types.d.ts.map +1 -1
- package/docs/ci.md +27 -0
- package/package.json +4 -1
|
@@ -338,7 +338,8 @@ function readGatewayConfiguration_() {
|
|
|
338
338
|
// Shared encoding / hashing helpers (preserved from v1)
|
|
339
339
|
// ---------------------------------------------------------------------------
|
|
340
340
|
|
|
341
|
-
function canonicalJson_(value) {
|
|
341
|
+
function canonicalJson_(value, ancestors) {
|
|
342
|
+
ancestors = ancestors || [];
|
|
342
343
|
if (value === null) return "null";
|
|
343
344
|
if (value === true) return "true";
|
|
344
345
|
if (value === false) return "false";
|
|
@@ -348,16 +349,48 @@ function canonicalJson_(value) {
|
|
|
348
349
|
return (value === 0 ? "0" : String(value)).replace(/e\+/, "e").replace(/e(-?)0+(\d+)/, "e$1$2");
|
|
349
350
|
}
|
|
350
351
|
if (Array.isArray(value)) {
|
|
351
|
-
|
|
352
|
+
if (!isDenseArray_(value)) throw new Error("Sync payload arrays must be dense");
|
|
353
|
+
enterCanonicalContainer_(value, ancestors);
|
|
354
|
+
try {
|
|
355
|
+
return "[" + value.map(function (item) {
|
|
356
|
+
return canonicalJson_(item, ancestors);
|
|
357
|
+
}).join(",") + "]";
|
|
358
|
+
} finally {
|
|
359
|
+
leaveCanonicalContainer_(value, ancestors);
|
|
360
|
+
}
|
|
352
361
|
}
|
|
353
362
|
if (isPlainObject_(value)) {
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
363
|
+
enterCanonicalContainer_(value, ancestors);
|
|
364
|
+
try {
|
|
365
|
+
return "{" + Object.keys(value).sort().map(function (key) {
|
|
366
|
+
return JSON.stringify(key) + ":" + canonicalJson_(value[key], ancestors);
|
|
367
|
+
}).join(",") + "}";
|
|
368
|
+
} finally {
|
|
369
|
+
leaveCanonicalContainer_(value, ancestors);
|
|
370
|
+
}
|
|
357
371
|
}
|
|
358
372
|
throw new Error("Sync payload has unsupported value type");
|
|
359
373
|
}
|
|
360
374
|
|
|
375
|
+
function isDenseArray_(value) {
|
|
376
|
+
for (var index = 0; index < value.length; index += 1) {
|
|
377
|
+
if (!Object.prototype.hasOwnProperty.call(value, index)) return false;
|
|
378
|
+
}
|
|
379
|
+
return true;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
function enterCanonicalContainer_(value, ancestors) {
|
|
383
|
+
if (ancestors.indexOf(value) !== -1) {
|
|
384
|
+
throw new Error("Sync payload cannot contain cycles");
|
|
385
|
+
}
|
|
386
|
+
ancestors.push(value);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
function leaveCanonicalContainer_(value, ancestors) {
|
|
390
|
+
var index = ancestors.lastIndexOf(value);
|
|
391
|
+
if (index !== -1) ancestors.splice(index, 1);
|
|
392
|
+
}
|
|
393
|
+
|
|
361
394
|
function sha256Hex_(value) {
|
|
362
395
|
return Utilities.computeDigest(Utilities.DigestAlgorithm.SHA_256, value, Utilities.Charset.UTF_8)
|
|
363
396
|
.map(function (byte) {
|
|
@@ -382,7 +415,9 @@ function constantTimeEquals_(left, right) {
|
|
|
382
415
|
}
|
|
383
416
|
|
|
384
417
|
function isPlainObject_(value) {
|
|
385
|
-
|
|
418
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
|
|
419
|
+
var prototype = Object.getPrototypeOf(value);
|
|
420
|
+
return prototype === Object.prototype || prototype === null;
|
|
386
421
|
}
|
|
387
422
|
|
|
388
423
|
function isNonEmptyString_(value) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"effectOperationScript.d.ts","sourceRoot":"","sources":["../../../../../../../src/adapter/sheets/providers/apps-script-gateway/operations/effect/effectOperationScript.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"effectOperationScript.d.ts","sourceRoot":"","sources":["../../../../../../../src/adapter/sheets/providers/apps-script-gateway/operations/effect/effectOperationScript.ts"],"names":[],"mappings":"AAEA,yFAAyF;AACzF,eAAO,MAAM,uBAAuB,QAirBlC,CAAC"}
|
package/dist/adapter/sheets/providers/apps-script-gateway/operations/effect/effectOperationScript.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { APPS_SCRIPT_STABLE_CODEC_SOURCE } from "../shared/appsScriptStableCodecSource.js";
|
|
1
2
|
/** Self-contained V8 source executed by Code.gs for effect application and read-back. */
|
|
2
3
|
export const EFFECT_OPERATION_SOURCE = String.raw `function (spreadsheet, args) {
|
|
3
4
|
var MAX_EFFECTS = 20;
|
|
@@ -685,30 +686,8 @@ export const EFFECT_OPERATION_SOURCE = String.raw `function (spreadsheet, args)
|
|
|
685
686
|
function nonNegativeInteger_(value, label) { if (typeof value !== "number" || !isFinite(value) || Math.floor(value) !== value || value < 0) throw new Error(label + " must be a non-negative integer"); return value; }
|
|
686
687
|
|
|
687
688
|
function visibleHash_(fields) {
|
|
688
|
-
return
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
function stableEncode_(value) {
|
|
692
|
-
if (value === null) return "n";
|
|
693
|
-
if (value === true) return "b1";
|
|
694
|
-
if (value === false) return "b0";
|
|
695
|
-
if (typeof value === "number") return stableEncodeNumber_(value);
|
|
696
|
-
if (typeof value === "string") return stableEncodeString_(value);
|
|
697
|
-
if (isObject_(value) && value.kind === "date" && isCanonicalDate_(value.value)) return "d24:" + value.value;
|
|
698
|
-
if (Array.isArray(value)) return "a" + value.length + "[" + value.map(stableEncode_).join("") + "]";
|
|
699
|
-
if (isObject_(value)) {
|
|
700
|
-
var entries = Object.keys(value).map(function (key) { var normalized = normalizeScalarString_(key); return { key: normalized, bytes: utf8Bytes_(normalized), value: value[key] }; });
|
|
701
|
-
entries.sort(function (left, right) { return compareBytes_(left.bytes, right.bytes); });
|
|
702
|
-
return "o" + entries.length + "{" + entries.map(function (entry) { return "s" + entry.bytes.length + ":" + entry.key + stableEncode_(entry.value); }).join("") + "}";
|
|
703
|
-
}
|
|
704
|
-
throw new Error("stable value is unsupported");
|
|
705
|
-
}
|
|
706
|
-
function stableEncodeNumber_(value) { if (!isFinite(value)) throw new Error("stable number is not finite"); var decimal = value === 0 ? "0" : String(value).replace(/e\+/, "e").replace(/e(-?)0+(\d+)/, "e$1$2"); return "f" + utf8ByteLength_(decimal) + ":" + decimal; }
|
|
707
|
-
function stableEncodeString_(value) { var normalized = normalizeScalarString_(value); return "s" + utf8ByteLength_(normalized) + ":" + normalized; }
|
|
708
|
-
function normalizeScalarString_(value) { return value.normalize("NFC"); }
|
|
709
|
-
function sha256Hex_(value) { return Utilities.computeDigest(Utilities.DigestAlgorithm.SHA_256, value, Utilities.Charset.UTF_8).map(function (byte) { var unsigned = byte < 0 ? byte + 256 : byte; return ("0" + unsigned.toString(16)).slice(-2); }).join(""); }
|
|
710
|
-
function utf8Bytes_(value) { return Utilities.newBlob(value).getBytes(); }
|
|
711
|
-
function utf8ByteLength_(value) { return utf8Bytes_(value).length; }
|
|
712
|
-
function compareBytes_(left, right) { var count = Math.min(left.length, right.length); for (var index = 0; index < count; index += 1) { var a = left[index] < 0 ? left[index] + 256 : left[index]; var b = right[index] < 0 ? right[index] + 256 : right[index]; if (a !== b) return a - b; } return left.length - right.length; }
|
|
689
|
+
return codecStableHash_({ fields: Object.keys(fields).sort().map(function (fieldName) { return { fieldName: fieldName, value: fields[fieldName] }; }) });
|
|
690
|
+
}
|
|
691
|
+
${APPS_SCRIPT_STABLE_CODEC_SOURCE}
|
|
713
692
|
}`;
|
|
714
693
|
//# sourceMappingURL=effectOperationScript.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"effectOperationScript.js","sourceRoot":"","sources":["../../../../../../../src/adapter/sheets/providers/apps-script-gateway/operations/effect/effectOperationScript.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,GAAG,CAAA
|
|
1
|
+
{"version":3,"file":"effectOperationScript.js","sourceRoot":"","sources":["../../../../../../../src/adapter/sheets/providers/apps-script-gateway/operations/effect/effectOperationScript.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,0CAA0C,CAAC;AAE3F,yFAAyF;AACzF,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgrB/C,+BAA+B;EAC/B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observationOperation.d.ts","sourceRoot":"","sources":["../../../../../../../src/adapter/sheets/providers/apps-script-gateway/operations/observation/observationOperation.ts"],"names":[],"mappings":"AAAA,0EAA0E;
|
|
1
|
+
{"version":3,"file":"observationOperation.d.ts","sourceRoot":"","sources":["../../../../../../../src/adapter/sheets/providers/apps-script-gateway/operations/observation/observationOperation.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAG1E,OAAO,KAAK,EACV,2BAA2B,EAC3B,0BAA0B,EAC1B,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,2DAA2D,CAAC;AAwBnE,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AAQxF,QAAA,MAAM,2BAA2B;;;;CAIvB,CAAC;AAEX,UAAU,gCAAgC;IACxC,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7C,4EAA4E;IAC5E,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC9C;AAED,KAAK,2BAA2B,GAC9B,CAAC,2BAA2B,GAAG,uBAAuB,CAAC,GAAG,gCAAgC,CAAC;AAE7F,MAAM,MAAM,uCAAuC,GAAG;IACpD,QAAQ,CAAC,IAAI,EAAE,OAAO,2BAA2B,CAAC,cAAc,CAAC;CAClE,GAAG,2BAA2B,CAAC;AAEhC,MAAM,MAAM,mCAAmC,GAAG;IAChD,QAAQ,CAAC,IAAI,EAAE,OAAO,2BAA2B,CAAC,aAAa,CAAC;CACjE,GAAG,2BAA2B,CAAC;AAEhC,MAAM,MAAM,sCAAsC,GAAG;IACnD,QAAQ,CAAC,IAAI,EAAE,OAAO,2BAA2B,CAAC,gBAAgB,CAAC;CACpE,GAAG,2BAA2B,CAAC;AAEhC,+EAA+E;AAC/E,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,2BAA2B,GAAG,gCAAgC,GACtE,6BAA6B,CAC9B,uCAAuC,EACvC,0BAA0B,CAC3B,CAQA;AAED,iEAAiE;AACjE,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,uBAAuB,GAAG,gCAAgC,GAClE,6BAA6B,CAAC,mCAAmC,EAAE,mBAAmB,CAAC,CAQzF;AAED,uFAAuF;AACvF,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,uBAAuB,GAAG,gCAAgC,GAClE,6BAA6B,CAC9B,sCAAsC,EACtC,oBAAoB,CACrB,CAQA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** Thin-Gateway operations for anchors and normalized Sheet snapshots. */
|
|
2
|
+
import { APPS_SCRIPT_STABLE_CODEC_SOURCE } from "../shared/appsScriptStableCodecSource.js";
|
|
2
3
|
import { CELL_OBSERVATION_KINDS, } from "../../../../../../shared/encoding/constants.js";
|
|
3
4
|
import { isNormalizedCell } from "../../../../../../shared/encoding/normalizedCell.js";
|
|
4
5
|
import { SYNC_GATEWAY_ERROR_CODES, } from "../../../../../../application/sync/gateway/errors.js";
|
|
@@ -393,7 +394,7 @@ const OBSERVATION_OPERATION_SOURCE = String.raw `function (spreadsheet, args) {
|
|
|
393
394
|
rows: rows,
|
|
394
395
|
};
|
|
395
396
|
var snapshotHashStartedAt = Date.now();
|
|
396
|
-
var snapshotHash =
|
|
397
|
+
var snapshotHash = codecStableHash_(snapshot);
|
|
397
398
|
phase_("snapshot_hash", snapshotHashStartedAt);
|
|
398
399
|
return {
|
|
399
400
|
protocolVersion: snapshot.protocolVersion,
|
|
@@ -481,7 +482,7 @@ const OBSERVATION_OPERATION_SOURCE = String.raw `function (spreadsheet, args) {
|
|
|
481
482
|
else if (typeof rawValue === "number" && isFinite(rawValue)) normalized = { kind: "number", value: rawValue };
|
|
482
483
|
else if (typeof rawValue === "boolean") normalized = { kind: "boolean", value: rawValue };
|
|
483
484
|
else return { cellKind: "error", normalizedCell: null, formulaHash: null, mergeRange: null, errorCode: "unsupported_cell_value", stableHash: null };
|
|
484
|
-
return { cellKind: normalized === null ? "blank" : "literal", normalizedCell: normalized, formulaHash: null, mergeRange: null, errorCode: null, stableHash: lightweight ? null :
|
|
485
|
+
return { cellKind: normalized === null ? "blank" : "literal", normalizedCell: normalized, formulaHash: null, mergeRange: null, errorCode: null, stableHash: lightweight ? null : codecStableHash_(normalized) };
|
|
485
486
|
}
|
|
486
487
|
|
|
487
488
|
function mergedCellMap_(targetRange) {
|
|
@@ -506,26 +507,6 @@ const OBSERVATION_OPERATION_SOURCE = String.raw `function (spreadsheet, args) {
|
|
|
506
507
|
function requireObject_(value, label) { if (!isObject_(value)) throw new Error(label + " must be an object"); return value; }
|
|
507
508
|
function normalizeScalarString_(value) { return value.normalize("NFC"); }
|
|
508
509
|
function sha256Hex_(value) { return Utilities.computeDigest(Utilities.DigestAlgorithm.SHA_256, value, Utilities.Charset.UTF_8).map(function (byte) { var unsigned = byte < 0 ? byte + 256 : byte; return ("0" + unsigned.toString(16)).slice(-2); }).join(""); }
|
|
509
|
-
|
|
510
|
-
function stableEncode_(value) {
|
|
511
|
-
if (value === null) return "n";
|
|
512
|
-
if (value === true) return "b1";
|
|
513
|
-
if (value === false) return "b0";
|
|
514
|
-
if (typeof value === "number") return stableEncodeNumber_(value);
|
|
515
|
-
if (typeof value === "string") return stableEncodeString_(value);
|
|
516
|
-
if (isObject_(value) && value.kind === "date" && isCanonicalDate_(value.value)) return "d24:" + value.value;
|
|
517
|
-
if (Array.isArray(value)) return "a" + value.length + "[" + value.map(stableEncode_).join("") + "]";
|
|
518
|
-
if (isObject_(value)) {
|
|
519
|
-
var entries = Object.keys(value).map(function (key) { var normalized = normalizeScalarString_(key); return { key: normalized, bytes: utf8Bytes_(normalized), value: value[key] }; });
|
|
520
|
-
entries.sort(function (left, right) { return compareBytes_(left.bytes, right.bytes); });
|
|
521
|
-
return "o" + entries.length + "{" + entries.map(function (entry) { return "s" + entry.bytes.length + ":" + entry.key + stableEncode_(entry.value); }).join("") + "}";
|
|
522
|
-
}
|
|
523
|
-
throw new Error("stable value is unsupported");
|
|
524
|
-
}
|
|
525
|
-
function stableEncodeNumber_(value) { if (!isFinite(value)) throw new Error("stable number is not finite"); var decimal = value === 0 ? "0" : String(value).replace(/e\+/, "e").replace(/e(-?)0+(\d+)/, "e$1$2"); return "f" + utf8ByteLength_(decimal) + ":" + decimal; }
|
|
526
|
-
function stableEncodeString_(value) { var normalized = normalizeScalarString_(value); return "s" + utf8ByteLength_(normalized) + ":" + normalized; }
|
|
527
|
-
function utf8Bytes_(value) { return Utilities.newBlob(value).getBytes(); }
|
|
528
|
-
function utf8ByteLength_(value) { return utf8Bytes_(value).length; }
|
|
529
|
-
function compareBytes_(left, right) { var count = Math.min(left.length, right.length); for (var index = 0; index < count; index += 1) { var a = left[index] < 0 ? left[index] + 256 : left[index]; var b = right[index] < 0 ? right[index] + 256 : right[index]; if (a !== b) return a - b; } return left.length - right.length; }
|
|
510
|
+
${APPS_SCRIPT_STABLE_CODEC_SOURCE}
|
|
530
511
|
}`;
|
|
531
512
|
//# sourceMappingURL=observationOperation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observationOperation.js","sourceRoot":"","sources":["../../../../../../../src/adapter/sheets/providers/apps-script-gateway/operations/observation/observationOperation.ts"],"names":[],"mappings":"AAAA,0EAA0E;
|
|
1
|
+
{"version":3,"file":"observationOperation.js","sourceRoot":"","sources":["../../../../../../../src/adapter/sheets/providers/apps-script-gateway/operations/observation/observationOperation.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAE1E,OAAO,EAAE,+BAA+B,EAAE,MAAM,0CAA0C,CAAC;AAQ3F,OAAO,EACL,sBAAsB,GAEvB,MAAM,gDAAgD,CAAC;AAExD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qDAAqD,CAAC;AACvF,OAAO,EACL,wBAAwB,GACzB,MAAM,sDAAsD,CAAC;AAC9D,OAAO,EACL,wBAAwB,EACxB,8BAA8B,EAC9B,gCAAgC,GACjC,MAAM,yDAAyD,CAAC;AACjE,OAAO,EACL,+CAA+C,IAAI,gCAAgC,EACnF,+BAA+B,IAAI,oBAAoB,EACvD,wCAAwC,EACxC,qCAAqC,EACrC,4BAA4B,EAC5B,kCAAkC,EAClC,sBAAsB,GACvB,MAAM,0DAA0D,CAAC;AAElE,O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AC;AAC3C,CAAC;AAED,SAAS,aAAa,CAAC,KAAc,EAAE,KAAa;IAClD,OAAO,sBAAsB,CAAC,KAAK,EAAE,KAAK,EAAE,mCAAmC,CAAC,CAAC;AACnF,CAAC;AAED;;;GAGG;AACH,MAAM,4BAA4B,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoT7C,+BAA+B;EAC/B,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Self-contained Apps Script source for the stable_encode_v1 runtime adapter. */
|
|
2
|
+
/**
|
|
3
|
+
* This fragment is interpolated into dynamic operation functions. It uses only
|
|
4
|
+
* Apps Script globals and intentionally keeps every helper name prefixed so it
|
|
5
|
+
* cannot collide with operation-specific helpers or an older Code.gs global.
|
|
6
|
+
*/
|
|
7
|
+
export declare const APPS_SCRIPT_STABLE_CODEC_SOURCE: string;
|
|
8
|
+
//# sourceMappingURL=appsScriptStableCodecSource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appsScriptStableCodecSource.d.ts","sourceRoot":"","sources":["../../../../../../../src/adapter/sheets/providers/apps-script-gateway/operations/shared/appsScriptStableCodecSource.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAElF;;;;GAIG;AACH,eAAO,MAAM,+BAA+B,QAkH3C,CAAC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/** Self-contained Apps Script source for the stable_encode_v1 runtime adapter. */
|
|
2
|
+
/**
|
|
3
|
+
* This fragment is interpolated into dynamic operation functions. It uses only
|
|
4
|
+
* Apps Script globals and intentionally keeps every helper name prefixed so it
|
|
5
|
+
* cannot collide with operation-specific helpers or an older Code.gs global.
|
|
6
|
+
*/
|
|
7
|
+
export const APPS_SCRIPT_STABLE_CODEC_SOURCE = String.raw `
|
|
8
|
+
function codecStableHash_(value) {
|
|
9
|
+
return codecSha256Hex_(codecStableEncode_(value, []));
|
|
10
|
+
}
|
|
11
|
+
function codecStableEncode_(value, ancestors) {
|
|
12
|
+
if (ancestors === undefined) ancestors = [];
|
|
13
|
+
if (value === null) return "n";
|
|
14
|
+
if (value === true) return "b1";
|
|
15
|
+
if (value === false) return "b0";
|
|
16
|
+
if (typeof value === "number") return codecStableEncodeNumber_(value);
|
|
17
|
+
if (typeof value === "string") return codecStableEncodeString_(value);
|
|
18
|
+
if (codecIsDateValue_(value)) return codecEncodeDate_(value.value);
|
|
19
|
+
if (Array.isArray(value)) {
|
|
20
|
+
if (!codecIsDenseArray_(value)) throw new Error("stable array must be dense");
|
|
21
|
+
codecEnterContainer_(value, ancestors);
|
|
22
|
+
try {
|
|
23
|
+
return "a" + value.length + "[" + value.map(function (item) {
|
|
24
|
+
return codecStableEncode_(item, ancestors);
|
|
25
|
+
}).join("") + "]";
|
|
26
|
+
} finally {
|
|
27
|
+
codecLeaveContainer_(value, ancestors);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (codecIsPlainRecord_(value)) {
|
|
31
|
+
codecEnterContainer_(value, ancestors);
|
|
32
|
+
try {
|
|
33
|
+
var entries = Object.keys(value).map(function (key) {
|
|
34
|
+
var normalized = codecNormalizeScalarString_(key);
|
|
35
|
+
return { key: normalized, bytes: codecUtf8Bytes_(normalized), value: value[key] };
|
|
36
|
+
});
|
|
37
|
+
var normalizedKeys = Object.create(null);
|
|
38
|
+
entries.forEach(function (entry) {
|
|
39
|
+
if (normalizedKeys[entry.key]) throw new Error("stable object has duplicate NFC key");
|
|
40
|
+
normalizedKeys[entry.key] = true;
|
|
41
|
+
});
|
|
42
|
+
entries.sort(function (left, right) { return codecCompareBytes_(left.bytes, right.bytes); });
|
|
43
|
+
return "o" + entries.length + "{" + entries.map(function (entry) {
|
|
44
|
+
return "s" + entry.bytes.length + ":" + entry.key + codecStableEncode_(entry.value, ancestors);
|
|
45
|
+
}).join("") + "}";
|
|
46
|
+
} finally {
|
|
47
|
+
codecLeaveContainer_(value, ancestors);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
throw new Error("stable value is unsupported");
|
|
51
|
+
}
|
|
52
|
+
function codecStableEncodeNumber_(value) {
|
|
53
|
+
if (!isFinite(value)) throw new Error("stable number is not finite");
|
|
54
|
+
var decimal = value === 0 ? "0" : String(value).replace(/e\+/, "e").replace(/e(-?)0+(\d+)/, "e$1$2");
|
|
55
|
+
return "f" + codecUtf8ByteLength_(decimal) + ":" + decimal;
|
|
56
|
+
}
|
|
57
|
+
function codecStableEncodeString_(value) {
|
|
58
|
+
var normalized = codecNormalizeScalarString_(value);
|
|
59
|
+
return "s" + codecUtf8ByteLength_(normalized) + ":" + normalized;
|
|
60
|
+
}
|
|
61
|
+
function codecEncodeDate_(value) {
|
|
62
|
+
if (!codecIsCanonicalDate_(value)) throw new Error("stable date is invalid");
|
|
63
|
+
return "d24:" + value;
|
|
64
|
+
}
|
|
65
|
+
function codecIsDateValue_(value) {
|
|
66
|
+
return codecIsPlainRecord_(value) && Object.keys(value).length === 2 &&
|
|
67
|
+
Object.prototype.hasOwnProperty.call(value, "kind") &&
|
|
68
|
+
Object.prototype.hasOwnProperty.call(value, "value") &&
|
|
69
|
+
value.kind === "date" && typeof value.value === "string";
|
|
70
|
+
}
|
|
71
|
+
function codecIsCanonicalDate_(value) {
|
|
72
|
+
if (typeof value !== "string" || !/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(value)) return false;
|
|
73
|
+
var parsed = new Date(value);
|
|
74
|
+
return !isNaN(parsed.getTime()) && parsed.toISOString() === value;
|
|
75
|
+
}
|
|
76
|
+
function codecIsPlainRecord_(value) {
|
|
77
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
|
|
78
|
+
var prototype = Object.getPrototypeOf(value);
|
|
79
|
+
return prototype === Object.prototype || prototype === null;
|
|
80
|
+
}
|
|
81
|
+
function codecIsDenseArray_(value) {
|
|
82
|
+
for (var index = 0; index < value.length; index += 1) {
|
|
83
|
+
if (!Object.prototype.hasOwnProperty.call(value, index)) return false;
|
|
84
|
+
}
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
function codecEnterContainer_(value, ancestors) {
|
|
88
|
+
if (ancestors.indexOf(value) >= 0) throw new Error("stable value cannot contain cycles");
|
|
89
|
+
ancestors.push(value);
|
|
90
|
+
}
|
|
91
|
+
function codecLeaveContainer_(value, ancestors) { ancestors.pop(); }
|
|
92
|
+
function codecNormalizeScalarString_(value) {
|
|
93
|
+
for (var index = 0; index < value.length; index += 1) {
|
|
94
|
+
var codeUnit = value.charCodeAt(index);
|
|
95
|
+
if (codeUnit >= 0xd800 && codeUnit <= 0xdbff) {
|
|
96
|
+
var next = value.charCodeAt(index + 1);
|
|
97
|
+
if (!Number.isInteger(next) || next < 0xdc00 || next > 0xdfff) throw new Error("stable string has an unpaired high surrogate");
|
|
98
|
+
index += 1;
|
|
99
|
+
} else if (codeUnit >= 0xdc00 && codeUnit <= 0xdfff) {
|
|
100
|
+
throw new Error("stable string has an unpaired low surrogate");
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return value.normalize("NFC");
|
|
104
|
+
}
|
|
105
|
+
function codecSha256Hex_(value) {
|
|
106
|
+
return Utilities.computeDigest(Utilities.DigestAlgorithm.SHA_256, value, Utilities.Charset.UTF_8)
|
|
107
|
+
.map(function (byte) { var unsigned = byte < 0 ? byte + 256 : byte; return ("0" + unsigned.toString(16)).slice(-2); })
|
|
108
|
+
.join("");
|
|
109
|
+
}
|
|
110
|
+
function codecUtf8Bytes_(value) { return Utilities.newBlob(value).getBytes(); }
|
|
111
|
+
function codecUtf8ByteLength_(value) { return codecUtf8Bytes_(value).length; }
|
|
112
|
+
function codecCompareBytes_(left, right) {
|
|
113
|
+
var count = Math.min(left.length, right.length);
|
|
114
|
+
for (var index = 0; index < count; index += 1) {
|
|
115
|
+
var a = left[index] < 0 ? left[index] + 256 : left[index];
|
|
116
|
+
var b = right[index] < 0 ? right[index] + 256 : right[index];
|
|
117
|
+
if (a !== b) return a - b;
|
|
118
|
+
}
|
|
119
|
+
return left.length - right.length;
|
|
120
|
+
}
|
|
121
|
+
`;
|
|
122
|
+
//# sourceMappingURL=appsScriptStableCodecSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appsScriptStableCodecSource.js","sourceRoot":"","sources":["../../../../../../../src/adapter/sheets/providers/apps-script-gateway/operations/shared/appsScriptStableCodecSource.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAElF;;;;GAIG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkHxD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"syncProtocol.d.ts","sourceRoot":"","sources":["../../../../../../src/adapter/sheets/providers/apps-script-gateway/protocol/syncProtocol.ts"],"names":[],"mappings":"AAAA,gFAAgF;
|
|
1
|
+
{"version":3,"file":"syncProtocol.d.ts","sourceRoot":"","sources":["../../../../../../src/adapter/sheets/providers/apps-script-gateway/protocol/syncProtocol.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAiBhF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,wFAAwF;AACxF,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAEtE;AAED,qFAAqF;AACrF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa,CAQlE;AAED,4EAA4E;AAC5E,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAMxD;AAED,yEAAyE;AACzE,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAInD"}
|
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
/** Canonical JSON and hashing helpers shared by the thin operation protocol. */
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { SYNC_GATEWAY_ENCODINGS, SYNC_GATEWAY_HASH_ALGORITHMS, SYNC_JSON_LITERAL_TOKENS, } from "./constants.js";
|
|
3
|
+
import { canonicalJson, isCanonicalJsonValue, CANONICAL_CODEC_ERROR_CODES, CanonicalCodecError, } from "@hikoutei/kohkai";
|
|
4
|
+
import { SYNC_GATEWAY_ENCODINGS, SYNC_GATEWAY_HASH_ALGORITHMS, } from "./constants.js";
|
|
6
5
|
import { SYNC_GATEWAY_PROTOCOL_ERROR_CODES, SyncGatewayProtocolError, } from "../errors.js";
|
|
7
6
|
/** Checks whether an unknown value is safe to send through the signed JSON boundary. */
|
|
8
7
|
export function isSyncJsonValue(value) {
|
|
9
|
-
|
|
10
|
-
return true;
|
|
11
|
-
if (typeof value === "number")
|
|
12
|
-
return Number.isFinite(value);
|
|
13
|
-
if (Array.isArray(value))
|
|
14
|
-
return value.every(isSyncJsonValue);
|
|
15
|
-
return isRecord(value) && isPlainObject(value) && Object.values(value).every(isSyncJsonValue);
|
|
8
|
+
return isCanonicalJsonValue(value);
|
|
16
9
|
}
|
|
17
10
|
/** Promotes a JSON-compatible value or throws the protocol error used by signing. */
|
|
18
11
|
export function requireSyncJsonValue(value) {
|
|
@@ -23,25 +16,12 @@ export function requireSyncJsonValue(value) {
|
|
|
23
16
|
}
|
|
24
17
|
/** Canonical JSON used for payload hashes and cross-runtime HMAC inputs. */
|
|
25
18
|
export function canonicalSyncJson(value) {
|
|
26
|
-
|
|
27
|
-
return
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return SYNC_JSON_LITERAL_TOKENS.FALSE;
|
|
32
|
-
if (isJavaScriptType(value, JAVASCRIPT_TYPE_NAMES.STRING))
|
|
33
|
-
return JSON.stringify(value);
|
|
34
|
-
if (isJavaScriptType(value, JAVASCRIPT_TYPE_NAMES.NUMBER))
|
|
35
|
-
return canonicalNumber(value);
|
|
36
|
-
if (Array.isArray(value))
|
|
37
|
-
return `[${value.map((item) => canonicalSyncJson(item)).join(",")}]`;
|
|
38
|
-
if (isRecord(value) && isPlainObject(value)) {
|
|
39
|
-
const entries = Object.keys(value)
|
|
40
|
-
.sort()
|
|
41
|
-
.map((key) => `${JSON.stringify(key)}:${canonicalSyncJson(value[key])}`);
|
|
42
|
-
return `{${entries.join(",")}}`;
|
|
19
|
+
try {
|
|
20
|
+
return canonicalJson(value);
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
throwProtocolCodecError(error);
|
|
43
24
|
}
|
|
44
|
-
throw new SyncGatewayProtocolError(SYNC_GATEWAY_PROTOCOL_ERROR_CODES.INVALID_JSON_VALUE, "sync gateway payload must contain JSON values only");
|
|
45
25
|
}
|
|
46
26
|
/** SHA-256 helper shared by envelope and effect payload verification. */
|
|
47
27
|
export function syncSha256Hex(value) {
|
|
@@ -49,14 +29,13 @@ export function syncSha256Hex(value) {
|
|
|
49
29
|
.update(value, SYNC_GATEWAY_ENCODINGS.UTF8)
|
|
50
30
|
.digest("hex");
|
|
51
31
|
}
|
|
52
|
-
function
|
|
53
|
-
if (
|
|
54
|
-
|
|
32
|
+
function throwProtocolCodecError(error) {
|
|
33
|
+
if (error instanceof CanonicalCodecError) {
|
|
34
|
+
const code = error.code === CANONICAL_CODEC_ERROR_CODES.NON_FINITE_NUMBER
|
|
35
|
+
? SYNC_GATEWAY_PROTOCOL_ERROR_CODES.NON_FINITE_NUMBER
|
|
36
|
+
: SYNC_GATEWAY_PROTOCOL_ERROR_CODES.INVALID_JSON_VALUE;
|
|
37
|
+
throw new SyncGatewayProtocolError(code, error.message);
|
|
55
38
|
}
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
function isPlainObject(value) {
|
|
59
|
-
const prototype = Object.getPrototypeOf(value);
|
|
60
|
-
return prototype === Object.prototype || prototype === null;
|
|
39
|
+
throw error;
|
|
61
40
|
}
|
|
62
41
|
//# sourceMappingURL=syncProtocol.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"syncProtocol.js","sourceRoot":"","sources":["../../../../../../src/adapter/sheets/providers/apps-script-gateway/protocol/syncProtocol.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAEhF,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,
|
|
1
|
+
{"version":3,"file":"syncProtocol.js","sourceRoot":"","sources":["../../../../../../src/adapter/sheets/providers/apps-script-gateway/protocol/syncProtocol.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAEhF,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,2BAA2B,EAC3B,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,sBAAsB,EACtB,4BAA4B,GAC7B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,iCAAiC,EACjC,wBAAwB,GACzB,MAAM,cAAc,CAAC;AAItB,wFAAwF;AACxF,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,OAAO,oBAAoB,CAAC,KAAK,CAAC,CAAC;AACrC,CAAC;AAED,qFAAqF;AACrF,MAAM,UAAU,oBAAoB,CAAC,KAAc;IACjD,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,wBAAwB,CAChC,iCAAiC,CAAC,kBAAkB,EACpD,oDAAoD,CACrD,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,IAAI,CAAC;QACH,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,uBAAuB,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;AACH,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,OAAO,UAAU,CAAC,4BAA4B,CAAC,MAAM,CAAC;SACnD,MAAM,CAAC,KAAK,EAAE,sBAAsB,CAAC,IAAI,CAAC;SAC1C,MAAM,CAAC,KAAK,CAAC,CAAC;AACnB,CAAC;AAED,SAAS,uBAAuB,CAAC,KAAc;IAC7C,IAAI,KAAK,YAAY,mBAAmB,EAAE,CAAC;QACzC,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,KAAK,2BAA2B,CAAC,iBAAiB;YACvE,CAAC,CAAC,iCAAiC,CAAC,iBAAiB;YACrD,CAAC,CAAC,iCAAiC,CAAC,kBAAkB,CAAC;QACzD,MAAM,IAAI,wBAAwB,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IAC1D,CAAC;IACD,MAAM,KAAK,CAAC;AACd,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
+
import type { CanonicalJsonValue } from "@hikoutei/kohkai";
|
|
1
2
|
/** JSON values allowed in signed gateway payloads. */
|
|
2
|
-
export type SyncJsonValue =
|
|
3
|
-
readonly [key: string]: SyncJsonValue;
|
|
4
|
-
};
|
|
3
|
+
export type SyncJsonValue = CanonicalJsonValue;
|
|
5
4
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/adapter/sheets/providers/apps-script-gateway/protocol/types.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/adapter/sheets/providers/apps-script-gateway/protocol/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,sDAAsD;AACtD,MAAM,MAAM,aAAa,GAAG,kBAAkB,CAAC"}
|
|
@@ -11,18 +11,7 @@ export declare const JAVASCRIPT_TYPE_NAMES: {
|
|
|
11
11
|
};
|
|
12
12
|
/** Closed set of JavaScript typeof result names. */
|
|
13
13
|
export type JavaScriptTypeName = (typeof JAVASCRIPT_TYPE_NAMES)[keyof typeof JAVASCRIPT_TYPE_NAMES];
|
|
14
|
-
|
|
15
|
-
export declare const STABLE_ENCODING_ERROR_CODES: {
|
|
16
|
-
readonly UNSUPPORTED_VALUE_TYPE: "unsupported_value_type";
|
|
17
|
-
readonly NON_FINITE_NUMBER: "non_finite_number";
|
|
18
|
-
readonly INVALID_DATE_FORMAT: "invalid_date_format";
|
|
19
|
-
readonly INVALID_DATE_BYTE_LENGTH: "invalid_date_byte_length";
|
|
20
|
-
readonly DUPLICATE_OBJECT_KEY: "duplicate_object_key";
|
|
21
|
-
readonly UNPAIRED_HIGH_SURROGATE: "unpaired_high_surrogate";
|
|
22
|
-
readonly UNPAIRED_LOW_SURROGATE: "unpaired_low_surrogate";
|
|
23
|
-
};
|
|
24
|
-
/** Closed set of stable encoder error codes. */
|
|
25
|
-
export type StableEncodingErrorCode = (typeof STABLE_ENCODING_ERROR_CODES)[keyof typeof STABLE_ENCODING_ERROR_CODES];
|
|
14
|
+
export { STABLE_ENCODING_ERROR_CODES, type StableEncodingErrorCode, } from "@hikoutei/kohkai";
|
|
26
15
|
/** Runtime values for normalized cell value kinds. */
|
|
27
16
|
export declare const NORMALIZED_CELL_KINDS: {
|
|
28
17
|
readonly STRING: "string";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/shared/encoding/constants.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,eAAO,MAAM,qBAAqB;;;;;;;;;CASxB,CAAC;AAEX,oDAAoD;AACpD,MAAM,MAAM,kBAAkB,GAC5B,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,OAAO,qBAAqB,CAAC,CAAC;AAErE,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/shared/encoding/constants.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,eAAO,MAAM,qBAAqB;;;;;;;;;CASxB,CAAC;AAEX,oDAAoD;AACpD,MAAM,MAAM,kBAAkB,GAC5B,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,OAAO,qBAAqB,CAAC,CAAC;AAErE,OAAO,EACL,2BAA2B,EAC3B,KAAK,uBAAuB,GAC7B,MAAM,kBAAkB,CAAC;AAE1B,sDAAsD;AACtD,eAAO,MAAM,qBAAqB;;;;;CAKxB,CAAC;AAEX,iDAAiD;AACjD,MAAM,MAAM,kBAAkB,GAC5B,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,OAAO,qBAAqB,CAAC,CAAC;AAErE,gEAAgE;AAChE,eAAO,MAAM,sBAAsB;;;;;;CAMzB,CAAC;AAEX,2DAA2D;AAC3D,MAAM,MAAM,mBAAmB,GAC7B,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,OAAO,sBAAsB,CAAC,CAAC"}
|
|
@@ -9,16 +9,7 @@ export const JAVASCRIPT_TYPE_NAMES = {
|
|
|
9
9
|
SYMBOL: "symbol",
|
|
10
10
|
FUNCTION: "function",
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
export const STABLE_ENCODING_ERROR_CODES = {
|
|
14
|
-
UNSUPPORTED_VALUE_TYPE: "unsupported_value_type",
|
|
15
|
-
NON_FINITE_NUMBER: "non_finite_number",
|
|
16
|
-
INVALID_DATE_FORMAT: "invalid_date_format",
|
|
17
|
-
INVALID_DATE_BYTE_LENGTH: "invalid_date_byte_length",
|
|
18
|
-
DUPLICATE_OBJECT_KEY: "duplicate_object_key",
|
|
19
|
-
UNPAIRED_HIGH_SURROGATE: "unpaired_high_surrogate",
|
|
20
|
-
UNPAIRED_LOW_SURROGATE: "unpaired_low_surrogate",
|
|
21
|
-
};
|
|
12
|
+
export { STABLE_ENCODING_ERROR_CODES, } from "@hikoutei/kohkai";
|
|
22
13
|
/** Runtime values for normalized cell value kinds. */
|
|
23
14
|
export const NORMALIZED_CELL_KINDS = {
|
|
24
15
|
STRING: "string",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/shared/encoding/constants.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;CACZ,CAAC;AAMX,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/shared/encoding/constants.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;CACZ,CAAC;AAMX,OAAO,EACL,2BAA2B,GAE5B,MAAM,kBAAkB,CAAC;AAE1B,sDAAsD;AACtD,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,MAAM;CACJ,CAAC;AAMX,gEAAgE;AAChE,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,OAAO;CACN,CAAC"}
|
|
@@ -1,35 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `stable_encode_v1` — deterministic cross-runtime byte encoding.
|
|
3
|
-
*
|
|
4
|
-
* Grammar (no whitespace between tokens):
|
|
5
|
-
*
|
|
6
|
-
* ```
|
|
7
|
-
* null := "n"
|
|
8
|
-
* boolean := "b0" | "b1"
|
|
9
|
-
* string := "s" <utf8ByteLength> ":" <NFC UTF-8 bytes>
|
|
10
|
-
* number := "f" <asciiByteLength> ":" <canonical finite decimal>
|
|
11
|
-
* date := "d" "24" ":" <UTC YYYY-MM-DDTHH:mm:ss.SSSZ>
|
|
12
|
-
* array := "a" <count> "[" <value>* "]"
|
|
13
|
-
* object := "o" <count> "{" (<encoded string key> <value>)* "}"
|
|
14
|
-
* ```
|
|
15
|
-
*
|
|
16
|
-
* Rules:
|
|
17
|
-
* - string and object key bytes are NFC-normalized then UTF-8 byte-length prefixed
|
|
18
|
-
* - object keys are sorted by UTF-8 byte lexicographic order
|
|
19
|
-
* - array order is preserved
|
|
20
|
-
* - number is the shortest round-trip decimal of its IEEE-754 binary64 value
|
|
21
|
-
* - -0 is unified to 0; NaN/Infinity are rejected
|
|
22
|
-
* - date payload is always 24 bytes: YYYY-MM-DDTHH:mm:ss.SSSZ
|
|
23
|
-
*
|
|
24
|
-
* The SHA-256 hex of the encoded bytes is the canonical fingerprint.
|
|
25
|
-
*/
|
|
1
|
+
/** Hikoutei compatibility facade for the generic stable_encode_v1 core. */
|
|
26
2
|
import type { HikouteiStableHash } from "../identity/types.js";
|
|
27
3
|
import type { StableValue } from "./types.js";
|
|
28
|
-
/**
|
|
29
|
-
* Encodes a stable value to its canonical byte sequence.
|
|
30
|
-
* Throws on unsupported values (NaN, Infinity, non-finite numbers).
|
|
31
|
-
*/
|
|
4
|
+
/** Encodes a stable value while preserving Hikoutei's existing error contract. */
|
|
32
5
|
export declare function stableEncode(value: StableValue): Uint8Array;
|
|
33
|
-
/** SHA-256
|
|
6
|
+
/** Computes the SHA-256 fingerprint of Hikoutei's stable encoding. */
|
|
34
7
|
export declare function stableHash(value: StableValue): HikouteiStableHash;
|
|
35
8
|
//# sourceMappingURL=stableEncode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stableEncode.d.ts","sourceRoot":"","sources":["../../../src/shared/encoding/stableEncode.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"stableEncode.d.ts","sourceRoot":"","sources":["../../../src/shared/encoding/stableEncode.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAG3E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAM/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,kFAAkF;AAClF,wBAAgB,YAAY,CAAC,KAAK,EAAE,WAAW,GAAG,UAAU,CAS3D;AAED,sEAAsE;AACtE,wBAAgB,UAAU,CAAC,KAAK,EAAE,WAAW,GAAG,kBAAkB,CAEjE"}
|
|
@@ -1,204 +1,21 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `stable_encode_v1` — deterministic cross-runtime byte encoding.
|
|
3
|
-
*
|
|
4
|
-
* Grammar (no whitespace between tokens):
|
|
5
|
-
*
|
|
6
|
-
* ```
|
|
7
|
-
* null := "n"
|
|
8
|
-
* boolean := "b0" | "b1"
|
|
9
|
-
* string := "s" <utf8ByteLength> ":" <NFC UTF-8 bytes>
|
|
10
|
-
* number := "f" <asciiByteLength> ":" <canonical finite decimal>
|
|
11
|
-
* date := "d" "24" ":" <UTC YYYY-MM-DDTHH:mm:ss.SSSZ>
|
|
12
|
-
* array := "a" <count> "[" <value>* "]"
|
|
13
|
-
* object := "o" <count> "{" (<encoded string key> <value>)* "}"
|
|
14
|
-
* ```
|
|
15
|
-
*
|
|
16
|
-
* Rules:
|
|
17
|
-
* - string and object key bytes are NFC-normalized then UTF-8 byte-length prefixed
|
|
18
|
-
* - object keys are sorted by UTF-8 byte lexicographic order
|
|
19
|
-
* - array order is preserved
|
|
20
|
-
* - number is the shortest round-trip decimal of its IEEE-754 binary64 value
|
|
21
|
-
* - -0 is unified to 0; NaN/Infinity are rejected
|
|
22
|
-
* - date payload is always 24 bytes: YYYY-MM-DDTHH:mm:ss.SSSZ
|
|
23
|
-
*
|
|
24
|
-
* The SHA-256 hex of the encoded bytes is the canonical fingerprint.
|
|
25
|
-
*/
|
|
1
|
+
/** Hikoutei compatibility facade for the generic stable_encode_v1 core. */
|
|
26
2
|
import { createHash } from "node:crypto";
|
|
27
|
-
import { JAVASCRIPT_TYPE_NAMES, NORMALIZED_CELL_KINDS, STABLE_ENCODING_ERROR_CODES, } from "./constants.js";
|
|
28
|
-
import { isJavaScriptType, isRecord } from "./typeGuards.js";
|
|
29
|
-
import { isCanonicalUtcIsoDate } from "../validation.js";
|
|
30
3
|
import { StableEncodingError } from "../../domain/errors/stableEncoding.js";
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
* Throws on unsupported values (NaN, Infinity, non-finite numbers).
|
|
34
|
-
*/
|
|
4
|
+
import { StableCodecError, stableEncode as encodeStableValue, } from "@hikoutei/kohkai";
|
|
5
|
+
/** Encodes a stable value while preserving Hikoutei's existing error contract. */
|
|
35
6
|
export function stableEncode(value) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return concat(chunks);
|
|
39
|
-
}
|
|
40
|
-
/** SHA-256 hex of the stable encoding. This is the canonical fingerprint. */
|
|
41
|
-
export function stableHash(value) {
|
|
42
|
-
return createHash("sha256").update(stableEncode(value)).digest("hex");
|
|
43
|
-
}
|
|
44
|
-
function encodeValue(value, chunks) {
|
|
45
|
-
if (value === null) {
|
|
46
|
-
chunks.push(ascii("n"));
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
if (value === true) {
|
|
50
|
-
chunks.push(ascii("b1"));
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
if (value === false) {
|
|
54
|
-
chunks.push(ascii("b0"));
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
if (isJavaScriptType(value, JAVASCRIPT_TYPE_NAMES.NUMBER)) {
|
|
58
|
-
encodeNumber(value, chunks);
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
if (isJavaScriptType(value, JAVASCRIPT_TYPE_NAMES.STRING)) {
|
|
62
|
-
encodeString(value, chunks);
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
if (isDateValue(value)) {
|
|
66
|
-
encodeDate(value.value, chunks);
|
|
67
|
-
return;
|
|
7
|
+
try {
|
|
8
|
+
return encodeStableValue(value);
|
|
68
9
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
if (isRecord(value)) {
|
|
74
|
-
encodeObject(value, chunks);
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
throw new StableEncodingError(STABLE_ENCODING_ERROR_CODES.UNSUPPORTED_VALUE_TYPE, `stable_encode: unsupported value type: ${typeof value}`);
|
|
78
|
-
}
|
|
79
|
-
function encodeNumber(value, chunks) {
|
|
80
|
-
if (!Number.isFinite(value)) {
|
|
81
|
-
throw new StableEncodingError(STABLE_ENCODING_ERROR_CODES.NON_FINITE_NUMBER, `stable_encode: non-finite number: ${value}`);
|
|
82
|
-
}
|
|
83
|
-
const unified = value === 0 ? 0 : value; // unify -0 to 0
|
|
84
|
-
const decimal = shortestRoundTripDecimal(unified);
|
|
85
|
-
const encoded = ascii(decimal);
|
|
86
|
-
const lengthPrefix = ascii(`f${encoded.length}:`);
|
|
87
|
-
chunks.push(lengthPrefix, encoded);
|
|
88
|
-
}
|
|
89
|
-
function encodeString(value, chunks) {
|
|
90
|
-
const nfc = normalizeScalarString(value);
|
|
91
|
-
const bytes = textEncode(nfc);
|
|
92
|
-
const lengthPrefix = ascii(`s${bytes.length}:`);
|
|
93
|
-
chunks.push(lengthPrefix, bytes);
|
|
94
|
-
}
|
|
95
|
-
function encodeDate(iso, chunks) {
|
|
96
|
-
if (!isCanonicalUtcIsoDate(iso)) {
|
|
97
|
-
throw new StableEncodingError(STABLE_ENCODING_ERROR_CODES.INVALID_DATE_FORMAT, `stable_encode: invalid date format: ${iso}`);
|
|
98
|
-
}
|
|
99
|
-
const bytes = textEncode(iso);
|
|
100
|
-
if (bytes.length !== 24) {
|
|
101
|
-
throw new StableEncodingError(STABLE_ENCODING_ERROR_CODES.INVALID_DATE_BYTE_LENGTH, `stable_encode: date must be exactly 24 bytes, got ${bytes.length}`);
|
|
102
|
-
}
|
|
103
|
-
chunks.push(ascii("d24:"), bytes);
|
|
104
|
-
}
|
|
105
|
-
function encodeArray(values, chunks) {
|
|
106
|
-
chunks.push(ascii(`a${values.length}[`));
|
|
107
|
-
for (const v of values) {
|
|
108
|
-
encodeValue(v, chunks);
|
|
109
|
-
}
|
|
110
|
-
chunks.push(ascii("]"));
|
|
111
|
-
}
|
|
112
|
-
function encodeObject(obj, chunks) {
|
|
113
|
-
const keys = Object.keys(obj);
|
|
114
|
-
const entries = [];
|
|
115
|
-
const normalizedKeys = new Set();
|
|
116
|
-
for (const key of keys) {
|
|
117
|
-
const nfcKey = normalizeScalarString(key);
|
|
118
|
-
if (normalizedKeys.has(nfcKey)) {
|
|
119
|
-
throw new StableEncodingError(STABLE_ENCODING_ERROR_CODES.DUPLICATE_OBJECT_KEY, `stable_encode: duplicate object key after NFC normalization: ${nfcKey}`);
|
|
120
|
-
}
|
|
121
|
-
normalizedKeys.add(nfcKey);
|
|
122
|
-
const encodedKey = textEncode(nfcKey);
|
|
123
|
-
entries.push([encodedKey, nfcKey, obj[key]]);
|
|
124
|
-
}
|
|
125
|
-
entries.sort((a, b) => compareBytes(a[0], b[0]));
|
|
126
|
-
chunks.push(ascii(`o${entries.length}{`));
|
|
127
|
-
for (const [encodedKey, , val] of entries) {
|
|
128
|
-
const lengthPrefix = ascii(`s${encodedKey.length}:`);
|
|
129
|
-
chunks.push(lengthPrefix, encodedKey);
|
|
130
|
-
encodeValue(val, chunks);
|
|
131
|
-
}
|
|
132
|
-
chunks.push(ascii("}"));
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Produces the shortest decimal representation that round-trips to the same
|
|
136
|
-
* IEEE-754 binary64 value.
|
|
137
|
-
*
|
|
138
|
-
* - Uses the V8 `toString` which already gives shortest round-trip for most
|
|
139
|
-
* numbers. We normalize exponent format to use lowercase `e` with no leading
|
|
140
|
-
* zero in the exponent.
|
|
141
|
-
* - Integers are emitted without a decimal point.
|
|
142
|
-
*/
|
|
143
|
-
function shortestRoundTripDecimal(value) {
|
|
144
|
-
const str = value.toString();
|
|
145
|
-
// Normalize exponent: V8 uses "e+21" or "e-7", we want "e21" and "e-7"
|
|
146
|
-
return str.replace(/e([+-])0*(\d)/, (_, sign, digit) => {
|
|
147
|
-
const expSign = sign === "-" ? "-" : "";
|
|
148
|
-
return `e${expSign}${digit}`;
|
|
149
|
-
}).replace(/e\+/, "e");
|
|
150
|
-
}
|
|
151
|
-
function isDateValue(value) {
|
|
152
|
-
return (isRecord(value) &&
|
|
153
|
-
Object.keys(value).length === 2 &&
|
|
154
|
-
value.kind === NORMALIZED_CELL_KINDS.DATE &&
|
|
155
|
-
typeof value.value === "string");
|
|
156
|
-
}
|
|
157
|
-
/** Rejects unpaired UTF-16 surrogates instead of letting TextEncoder replace them. */
|
|
158
|
-
function normalizeScalarString(value) {
|
|
159
|
-
for (let index = 0; index < value.length; index += 1) {
|
|
160
|
-
const codeUnit = value.charCodeAt(index);
|
|
161
|
-
if (codeUnit >= 0xd800 && codeUnit <= 0xdbff) {
|
|
162
|
-
const next = value.charCodeAt(index + 1);
|
|
163
|
-
if (!Number.isInteger(next) || next < 0xdc00 || next > 0xdfff) {
|
|
164
|
-
throw new StableEncodingError(STABLE_ENCODING_ERROR_CODES.UNPAIRED_HIGH_SURROGATE, "stable_encode: string contains an unpaired high surrogate");
|
|
165
|
-
}
|
|
166
|
-
index += 1;
|
|
167
|
-
continue;
|
|
168
|
-
}
|
|
169
|
-
if (codeUnit >= 0xdc00 && codeUnit <= 0xdfff) {
|
|
170
|
-
throw new StableEncodingError(STABLE_ENCODING_ERROR_CODES.UNPAIRED_LOW_SURROGATE, "stable_encode: string contains an unpaired low surrogate");
|
|
10
|
+
catch (error) {
|
|
11
|
+
if (error instanceof StableCodecError) {
|
|
12
|
+
throw new StableEncodingError(error.code, error.message);
|
|
171
13
|
}
|
|
14
|
+
throw error;
|
|
172
15
|
}
|
|
173
|
-
return value.normalize("NFC");
|
|
174
16
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
function textEncode(s) {
|
|
179
|
-
return new TextEncoder().encode(s);
|
|
180
|
-
}
|
|
181
|
-
function concat(chunks) {
|
|
182
|
-
let total = 0;
|
|
183
|
-
for (const c of chunks) {
|
|
184
|
-
total += c.length;
|
|
185
|
-
}
|
|
186
|
-
const result = new Uint8Array(total);
|
|
187
|
-
let offset = 0;
|
|
188
|
-
for (const c of chunks) {
|
|
189
|
-
result.set(c, offset);
|
|
190
|
-
offset += c.length;
|
|
191
|
-
}
|
|
192
|
-
return result;
|
|
193
|
-
}
|
|
194
|
-
function compareBytes(a, b) {
|
|
195
|
-
const min = Math.min(a.length, b.length);
|
|
196
|
-
for (let i = 0; i < min; i++) {
|
|
197
|
-
if (a[i] < b[i])
|
|
198
|
-
return -1;
|
|
199
|
-
if (a[i] > b[i])
|
|
200
|
-
return 1;
|
|
201
|
-
}
|
|
202
|
-
return a.length - b.length;
|
|
17
|
+
/** Computes the SHA-256 fingerprint of Hikoutei's stable encoding. */
|
|
18
|
+
export function stableHash(value) {
|
|
19
|
+
return createHash("sha256").update(stableEncode(value)).digest("hex");
|
|
203
20
|
}
|
|
204
21
|
//# sourceMappingURL=stableEncode.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stableEncode.js","sourceRoot":"","sources":["../../../src/shared/encoding/stableEncode.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"stableEncode.js","sourceRoot":"","sources":["../../../src/shared/encoding/stableEncode.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAE3E,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,EACL,gBAAgB,EAChB,YAAY,IAAI,iBAAiB,GAClC,MAAM,kBAAkB,CAAC;AAG1B,kFAAkF;AAClF,MAAM,UAAU,YAAY,CAAC,KAAkB;IAC7C,IAAI,CAAC;QACH,OAAO,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,IAAI,KAAK,YAAY,gBAAgB,EAAE,CAAC;YACtC,MAAM,IAAI,mBAAmB,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAC3D,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,UAAU,CAAC,KAAkB;IAC3C,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAuB,CAAC;AAC9F,CAAC"}
|
|
@@ -4,15 +4,12 @@
|
|
|
4
4
|
* These types are the foundation for cross-runtime fingerprinting and event
|
|
5
5
|
* identity. They contain no Google SDK, SQLite, or platform-specific types.
|
|
6
6
|
*/
|
|
7
|
-
import { NORMALIZED_CELL_KINDS } from "./constants.js";
|
|
8
|
-
import type {
|
|
7
|
+
import { NORMALIZED_CELL_KINDS, type CellObservationKind } from "./constants.js";
|
|
8
|
+
import type { StableCodecDateValue, StableCodecValue } from "@hikoutei/kohkai";
|
|
9
9
|
import type { Presence } from "../state/types.js";
|
|
10
10
|
export type { CellObservationKind, NormalizedCellKind } from "./constants.js";
|
|
11
11
|
/** A date encoded as a fixed-width UTC ISO-8601 string. */
|
|
12
|
-
export
|
|
13
|
-
readonly kind: typeof NORMALIZED_CELL_KINDS.DATE;
|
|
14
|
-
readonly value: string;
|
|
15
|
-
}
|
|
12
|
+
export type DateValue = StableCodecDateValue;
|
|
16
13
|
/**
|
|
17
14
|
* A normalized scalar value that can be deterministically encoded.
|
|
18
15
|
*
|
|
@@ -45,7 +42,5 @@ export interface CellObservation {
|
|
|
45
42
|
* objects with string keys. Objects with `kind: "date"` are encoded as dates,
|
|
46
43
|
* not as plain objects.
|
|
47
44
|
*/
|
|
48
|
-
export type StableValue =
|
|
49
|
-
readonly [key: string]: StableValue;
|
|
50
|
-
};
|
|
45
|
+
export type StableValue = StableCodecValue;
|
|
51
46
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/shared/encoding/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,qBAAqB,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/shared/encoding/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,qBAAqB,EACrB,KAAK,mBAAmB,EACzB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EACV,oBAAoB,EACpB,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD,YAAY,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAE9E,2DAA2D;AAC3D,MAAM,MAAM,SAAS,GAAG,oBAAoB,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GACtB,IAAI,GACJ;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,qBAAqB,CAAC,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC9E;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,qBAAqB,CAAC,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC9E;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,qBAAqB,CAAC,OAAO,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAChF,SAAS,CAAC;AAEd;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAAC;IACvC,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IACxC,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IACvC,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IACtC,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;CACtC;AAED;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG,gBAAgB,CAAC"}
|
package/docs/ci.md
CHANGED
|
@@ -112,6 +112,33 @@ not leave the fixture behind. The Apps Script receipt tab is also removed by
|
|
|
112
112
|
the cleanup operation. Do not point the live secrets at a production
|
|
113
113
|
spreadsheet; cleanup is intentionally scoped to the dedicated CI spreadsheet.
|
|
114
114
|
|
|
115
|
+
## Kohkai dependency
|
|
116
|
+
|
|
117
|
+
Hikoutei consumes the standalone `@hikoutei/kohkai` package from the
|
|
118
|
+
`ManddarinShop/Kohkai` repository. The codec is not a Hikoutei workspace and
|
|
119
|
+
its source is not included in the Hikoutei tarball:
|
|
120
|
+
|
|
121
|
+
```json
|
|
122
|
+
{
|
|
123
|
+
"dependencies": {
|
|
124
|
+
"@hikoutei/kohkai": "0.1.0"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
The root CI, develop publish, and stable publish workflows verify that the
|
|
130
|
+
exact declared Kohkai version already exists on npm before installing or
|
|
131
|
+
publishing Hikoutei. The first integration release therefore requires:
|
|
132
|
+
|
|
133
|
+
1. publish `@hikoutei/kohkai@0.1.0` from the Kohkai repository using tag `v0.1.0`;
|
|
134
|
+
2. merge the Hikoutei dependency integration;
|
|
135
|
+
3. let the next develop release produce `0.3.2` from the current `0.3.1` baseline.
|
|
136
|
+
|
|
137
|
+
Existing Hikoutei releases remain unchanged. Apps Script cannot import npm
|
|
138
|
+
packages, so `apps-script/gateway/Code.gs` keeps the Hikoutei-specific gateway
|
|
139
|
+
and its self-contained codec mirror; the root tests compare it with the pinned
|
|
140
|
+
Kohkai compatibility vectors.
|
|
141
|
+
|
|
115
142
|
## Develop publication
|
|
116
143
|
|
|
117
144
|
A push to `develop` runs `.github/workflows/develop-version.yml`. It verifies
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hikoutei",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Hikoutei — typed repository and safe write layer for Google Sheets-backed MVPs.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -38,6 +38,9 @@
|
|
|
38
38
|
"optimistic-locking"
|
|
39
39
|
],
|
|
40
40
|
"license": "MIT",
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@hikoutei/kohkai": "0.1.0"
|
|
43
|
+
},
|
|
41
44
|
"devDependencies": {
|
|
42
45
|
"@mikro-orm/core": "7.1.7",
|
|
43
46
|
"@mikro-orm/sql": "7.1.7",
|