@ariestools/aries-dapp-core 0.1.20 → 0.1.21
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/bin/dappServer.mjs +21 -20
- package/dist/node/DappActor.d.ts.map +1 -1
- package/dist/node/consumer/api.d.ts.map +1 -1
- package/dist/node/consumer/hash.d.ts.map +1 -1
- package/dist/node/consumer.mjs +14 -7
- package/dist/node/consumer.mjs.map +2 -2
- package/dist/node/examples/productionComposition.d.ts +2 -2
- package/dist/node/index.mjs +75 -48
- package/dist/node/index.mjs.map +3 -3
- package/dist/node/locator/createDappLocator.d.ts.map +1 -1
- package/dist/node/providers/DappBucketStore.d.ts.map +1 -1
- package/dist/node/publication/canonicalHead.d.ts.map +1 -1
- package/dist/node/publication/gc.d.ts.map +1 -1
- package/dist/node/publication/incremental.d.ts.map +1 -1
- package/dist/node/publication/publishGeneration.d.ts.map +1 -1
- package/dist/node/publication/putCreateOnly.d.ts.map +1 -1
- package/dist/node/publication/releases.d.ts.map +1 -1
- package/dist/node/publication/status.d.ts +1 -1
- package/dist/node/publication/status.d.ts.map +1 -1
- package/dist/node/publication/writeGenerationObjects.d.ts.map +1 -1
- package/examples/countFactsReducer.mjs +5 -4
- package/package.json +13 -13
package/dist/node/index.mjs
CHANGED
|
@@ -91,7 +91,8 @@ function encodeStatus(status) {
|
|
|
91
91
|
async function readIndexerStatus(store, key = STATUS_KEY) {
|
|
92
92
|
const body = await store.get(key);
|
|
93
93
|
if (body === void 0) return void 0;
|
|
94
|
-
const
|
|
94
|
+
const decoder = new TextDecoder();
|
|
95
|
+
const parsed = JSON.parse(decoder.decode(body));
|
|
95
96
|
if (parsed === null || typeof parsed !== "object") {
|
|
96
97
|
throw new Error(`Invalid indexer status at "${key}": not an object`);
|
|
97
98
|
}
|
|
@@ -103,10 +104,11 @@ async function readIndexerStatus(store, key = STATUS_KEY) {
|
|
|
103
104
|
}
|
|
104
105
|
async function writeIndexerStatus(store, input) {
|
|
105
106
|
const key = input.key ?? STATUS_KEY;
|
|
107
|
+
const now = /* @__PURE__ */ new Date();
|
|
106
108
|
const status = {
|
|
107
109
|
schema: INDEXER_STATUS_SCHEMA,
|
|
108
110
|
consecutiveFailures: input.consecutiveFailures,
|
|
109
|
-
updatedAt:
|
|
111
|
+
updatedAt: now.toISOString(),
|
|
110
112
|
...input.floor !== void 0 && { floor: input.floor },
|
|
111
113
|
...input.cursor !== void 0 && { cursor: input.cursor },
|
|
112
114
|
...input.lastCompletedPosition !== void 0 && { lastCompletedPosition: input.lastCompletedPosition },
|
|
@@ -233,7 +235,8 @@ var DappActor = class extends PeriodicActor {
|
|
|
233
235
|
} catch {
|
|
234
236
|
prior = void 0;
|
|
235
237
|
}
|
|
236
|
-
const
|
|
238
|
+
const nowDate = /* @__PURE__ */ new Date();
|
|
239
|
+
const now = nowDate.toISOString();
|
|
237
240
|
const fields = error === void 0 ? successStatusFields(progress, prior, now) : failureStatusFields(prior, this.consecutiveFailures, error, now);
|
|
238
241
|
await writeIndexerStatus(this._state, fields);
|
|
239
242
|
}
|
|
@@ -311,8 +314,8 @@ function joinKey(prefix, relativeKey) {
|
|
|
311
314
|
function stripPrefix(prefix, physicalKey) {
|
|
312
315
|
const cleanPrefix = prefix.replaceAll(/^\/+|\/+$/g, "");
|
|
313
316
|
if (cleanPrefix.length === 0) return physicalKey;
|
|
314
|
-
const withSlash = `${cleanPrefix}/`;
|
|
315
317
|
if (physicalKey === cleanPrefix) return "";
|
|
318
|
+
const withSlash = `${cleanPrefix}/`;
|
|
316
319
|
if (physicalKey.startsWith(withSlash)) return physicalKey.slice(withSlash.length);
|
|
317
320
|
return physicalKey;
|
|
318
321
|
}
|
|
@@ -335,7 +338,9 @@ function isConditionalFailure(error) {
|
|
|
335
338
|
return name === "PreconditionFailed" || name === "ConditionalRequestConflict" || name === "412" || status === 412;
|
|
336
339
|
}
|
|
337
340
|
function toBodyBytes(body) {
|
|
338
|
-
|
|
341
|
+
if (typeof body !== "string") return body;
|
|
342
|
+
const encoder = new TextEncoder();
|
|
343
|
+
return encoder.encode(body);
|
|
339
344
|
}
|
|
340
345
|
function metaFromResponse(response) {
|
|
341
346
|
return {
|
|
@@ -390,9 +395,7 @@ function createS3BucketStore(options) {
|
|
|
390
395
|
bucket,
|
|
391
396
|
prefix: bindingPrefix,
|
|
392
397
|
...publicBaseUrl !== void 0 && { publicBaseUrl },
|
|
393
|
-
resolveKey(key)
|
|
394
|
-
return resolve(key);
|
|
395
|
-
},
|
|
398
|
+
resolveKey: (key) => resolve(key),
|
|
396
399
|
publicUrl(key) {
|
|
397
400
|
if (publicBaseUrl === void 0) return void 0;
|
|
398
401
|
const relative = key.replaceAll(/^\/+/g, "");
|
|
@@ -593,9 +596,7 @@ function createDappLocator(options) {
|
|
|
593
596
|
let destroyed = false;
|
|
594
597
|
return {
|
|
595
598
|
context: { logger },
|
|
596
|
-
has(moniker)
|
|
597
|
-
return instances.has(moniker);
|
|
598
|
-
},
|
|
599
|
+
has: (moniker) => instances.has(moniker),
|
|
599
600
|
register(moniker, instance) {
|
|
600
601
|
instances.set(moniker, instance);
|
|
601
602
|
},
|
|
@@ -604,9 +605,7 @@ function createDappLocator(options) {
|
|
|
604
605
|
if (found === void 0) throw new Error(`No provider registered for moniker "${moniker}"`);
|
|
605
606
|
return found;
|
|
606
607
|
},
|
|
607
|
-
async
|
|
608
|
-
return instances.get(moniker);
|
|
609
|
-
},
|
|
608
|
+
tryGetInstance: async (moniker) => instances.get(moniker),
|
|
610
609
|
destroy() {
|
|
611
610
|
if (destroyed) return;
|
|
612
611
|
destroyed = true;
|
|
@@ -639,7 +638,9 @@ function createMemoryBucketStore(options) {
|
|
|
639
638
|
return `"mem-${etagSeq}"`;
|
|
640
639
|
}
|
|
641
640
|
function toBytes4(body) {
|
|
642
|
-
|
|
641
|
+
if (typeof body !== "string") return body;
|
|
642
|
+
const encoder = new TextEncoder();
|
|
643
|
+
return encoder.encode(body);
|
|
643
644
|
}
|
|
644
645
|
return {
|
|
645
646
|
role,
|
|
@@ -659,9 +660,7 @@ function createMemoryBucketStore(options) {
|
|
|
659
660
|
const relative = key.replaceAll(/^\/+/g, "");
|
|
660
661
|
return relative.length === 0 ? publicBaseUrl : `${publicBaseUrl}/${relative}`;
|
|
661
662
|
},
|
|
662
|
-
async get(key)
|
|
663
|
-
return objects.get(key)?.body;
|
|
664
|
-
},
|
|
663
|
+
get: async (key) => objects.get(key)?.body,
|
|
665
664
|
async getWithMeta(key) {
|
|
666
665
|
const found = objects.get(key);
|
|
667
666
|
if (found === void 0) return void 0;
|
|
@@ -716,7 +715,7 @@ function createMemoryBucketStore(options) {
|
|
|
716
715
|
},
|
|
717
716
|
async listPage(pageOptions = {}) {
|
|
718
717
|
const p = pageOptions.prefix ?? "";
|
|
719
|
-
let keys =
|
|
718
|
+
let keys = objects.keys().filter((k) => k.startsWith(p)).toArray().toSorted();
|
|
720
719
|
if (pageOptions.continuationToken !== void 0) {
|
|
721
720
|
const idx = keys.indexOf(pageOptions.continuationToken);
|
|
722
721
|
keys = idx === -1 ? keys : keys.slice(idx + 1);
|
|
@@ -775,9 +774,10 @@ function canonicalHeadBytes(head) {
|
|
|
775
774
|
"trust",
|
|
776
775
|
"layout"
|
|
777
776
|
]) {
|
|
778
|
-
if (key
|
|
777
|
+
if (Object.hasOwn(payload, key)) ordered[key] = payload[key];
|
|
779
778
|
}
|
|
780
|
-
|
|
779
|
+
const encoder = new TextEncoder();
|
|
780
|
+
return encoder.encode(`${JSON.stringify(ordered)}
|
|
781
781
|
`);
|
|
782
782
|
}
|
|
783
783
|
|
|
@@ -874,7 +874,9 @@ async function assertPublicationSafety(store, safety, capabilities) {
|
|
|
874
874
|
|
|
875
875
|
// src/publication/putCreateOnly.ts
|
|
876
876
|
function toBytes(body) {
|
|
877
|
-
|
|
877
|
+
if (typeof body !== "string") return body;
|
|
878
|
+
const encoder = new TextEncoder();
|
|
879
|
+
return encoder.encode(body);
|
|
878
880
|
}
|
|
879
881
|
function bytesEqual(a, b) {
|
|
880
882
|
if (a.byteLength !== b.byteLength) return false;
|
|
@@ -919,7 +921,9 @@ function assertNotAborted(signal) {
|
|
|
919
921
|
}
|
|
920
922
|
}
|
|
921
923
|
function toBytes2(body) {
|
|
922
|
-
|
|
924
|
+
if (typeof body !== "string") return body;
|
|
925
|
+
const encoder = new TextEncoder();
|
|
926
|
+
return encoder.encode(body);
|
|
923
927
|
}
|
|
924
928
|
async function writeImmutableObjects(store, role, generation, objects, signal, fenced) {
|
|
925
929
|
const refs = [];
|
|
@@ -1000,7 +1004,8 @@ async function writeObjectsAndManifest(input, generation, fenced) {
|
|
|
1000
1004
|
const signal = input.signal;
|
|
1001
1005
|
const stateRefs = await writeImmutableObjects(input.state, "state", generation, input.stateObjects ?? [], signal, fenced);
|
|
1002
1006
|
const indexRefs = await writeImmutableObjects(input.index, "index", generation, input.indexObjects ?? [], signal, fenced);
|
|
1003
|
-
const
|
|
1007
|
+
const publishedAtDate = /* @__PURE__ */ new Date();
|
|
1008
|
+
const publishedAt = publishedAtDate.toISOString();
|
|
1004
1009
|
const manifest = {
|
|
1005
1010
|
schema: GENERATION_MANIFEST_SCHEMA,
|
|
1006
1011
|
generation,
|
|
@@ -1102,7 +1107,8 @@ async function publishGeneration(input) {
|
|
|
1102
1107
|
async function readPublishedHead(state) {
|
|
1103
1108
|
const withMeta = await state.getWithMeta(HEAD_KEY);
|
|
1104
1109
|
if (withMeta === void 0) return void 0;
|
|
1105
|
-
const
|
|
1110
|
+
const decoder = new TextDecoder();
|
|
1111
|
+
const head = JSON.parse(decoder.decode(withMeta.body));
|
|
1106
1112
|
if (head.schema !== HEAD_MANIFEST_SCHEMA) {
|
|
1107
1113
|
throw new Error(`Invalid head schema: ${String(head.schema)}`);
|
|
1108
1114
|
}
|
|
@@ -1110,7 +1116,8 @@ async function readPublishedHead(state) {
|
|
|
1110
1116
|
if (targetBody === void 0) {
|
|
1111
1117
|
throw new Error(`Head points at missing object "${head.manifestKey}"`);
|
|
1112
1118
|
}
|
|
1113
|
-
const
|
|
1119
|
+
const encoder = new TextEncoder();
|
|
1120
|
+
const targetBytes = typeof targetBody === "string" ? encoder.encode(targetBody) : targetBody;
|
|
1114
1121
|
const actualHash = hashBytes(targetBytes);
|
|
1115
1122
|
if (actualHash !== head.manifestHash) {
|
|
1116
1123
|
throw new Error(
|
|
@@ -1123,7 +1130,7 @@ async function readPublishedHead(state) {
|
|
|
1123
1130
|
...withMeta.meta.etag !== void 0 && { headEtag: withMeta.meta.etag }
|
|
1124
1131
|
};
|
|
1125
1132
|
}
|
|
1126
|
-
const manifest = JSON.parse(
|
|
1133
|
+
const manifest = JSON.parse(decoder.decode(targetBytes));
|
|
1127
1134
|
if (manifest.schema !== GENERATION_MANIFEST_SCHEMA) {
|
|
1128
1135
|
throw new Error(`Invalid generation manifest schema: ${String(manifest.schema)}`);
|
|
1129
1136
|
}
|
|
@@ -1143,15 +1150,17 @@ async function readPublishedHead(state) {
|
|
|
1143
1150
|
async function readPins(state) {
|
|
1144
1151
|
const found = await state.getWithMeta(PINS_KEY);
|
|
1145
1152
|
if (found === void 0) {
|
|
1153
|
+
const now = /* @__PURE__ */ new Date();
|
|
1146
1154
|
return {
|
|
1147
1155
|
doc: {
|
|
1148
1156
|
schema: PINS_SCHEMA,
|
|
1149
1157
|
pins: [],
|
|
1150
|
-
updatedAt:
|
|
1158
|
+
updatedAt: now.toISOString()
|
|
1151
1159
|
}
|
|
1152
1160
|
};
|
|
1153
1161
|
}
|
|
1154
|
-
const
|
|
1162
|
+
const decoder = new TextDecoder();
|
|
1163
|
+
const doc = JSON.parse(decoder.decode(found.body));
|
|
1155
1164
|
return {
|
|
1156
1165
|
doc,
|
|
1157
1166
|
...found.meta.etag !== void 0 && { etag: found.meta.etag }
|
|
@@ -1194,19 +1203,20 @@ async function listReleases(state) {
|
|
|
1194
1203
|
if (existing.manifestKey === void 0) existing.kind = "incremental";
|
|
1195
1204
|
byGen.set(base, existing);
|
|
1196
1205
|
}
|
|
1197
|
-
return
|
|
1206
|
+
return byGen.values().toArray().toSorted((a, b) => a.generation.localeCompare(b.generation));
|
|
1198
1207
|
}
|
|
1199
1208
|
async function pinRelease(state, generation, opts) {
|
|
1200
1209
|
const { doc, etag } = await readPins(state);
|
|
1201
1210
|
if (doc.pins.some((p) => p.generation === generation)) return doc;
|
|
1211
|
+
const now = /* @__PURE__ */ new Date();
|
|
1202
1212
|
const next = {
|
|
1203
1213
|
schema: PINS_SCHEMA,
|
|
1204
|
-
updatedAt:
|
|
1214
|
+
updatedAt: now.toISOString(),
|
|
1205
1215
|
pins: [
|
|
1206
1216
|
...doc.pins,
|
|
1207
1217
|
{
|
|
1208
1218
|
generation,
|
|
1209
|
-
pinnedAt:
|
|
1219
|
+
pinnedAt: now.toISOString(),
|
|
1210
1220
|
...opts?.reason !== void 0 && { reason: opts.reason }
|
|
1211
1221
|
}
|
|
1212
1222
|
]
|
|
@@ -1216,9 +1226,10 @@ async function pinRelease(state, generation, opts) {
|
|
|
1216
1226
|
}
|
|
1217
1227
|
async function unpinRelease(state, generation) {
|
|
1218
1228
|
const { doc, etag } = await readPins(state);
|
|
1229
|
+
const now = /* @__PURE__ */ new Date();
|
|
1219
1230
|
const next = {
|
|
1220
1231
|
schema: PINS_SCHEMA,
|
|
1221
|
-
updatedAt:
|
|
1232
|
+
updatedAt: now.toISOString(),
|
|
1222
1233
|
pins: doc.pins.filter((p) => p.generation !== generation)
|
|
1223
1234
|
};
|
|
1224
1235
|
await writePins(state, next, etag);
|
|
@@ -1244,9 +1255,13 @@ async function rollbackHead(state, input) {
|
|
|
1244
1255
|
const manifestBody = await state.get(manifestKey);
|
|
1245
1256
|
const receiptBody = manifestBody === void 0 ? await state.get(receiptKey) : void 0;
|
|
1246
1257
|
let head;
|
|
1258
|
+
const now = /* @__PURE__ */ new Date();
|
|
1259
|
+
const publishedAt = now.toISOString();
|
|
1247
1260
|
if (manifestBody !== void 0) {
|
|
1248
|
-
const
|
|
1249
|
-
const
|
|
1261
|
+
const encoder = new TextEncoder();
|
|
1262
|
+
const bytes = typeof manifestBody === "string" ? encoder.encode(manifestBody) : manifestBody;
|
|
1263
|
+
const decoder = new TextDecoder();
|
|
1264
|
+
const parsed = JSON.parse(decoder.decode(bytes));
|
|
1250
1265
|
if (parsed.generation !== input.targetGeneration) {
|
|
1251
1266
|
return { ok: false, message: "Target manifest generation mismatch" };
|
|
1252
1267
|
}
|
|
@@ -1255,7 +1270,7 @@ async function rollbackHead(state, input) {
|
|
|
1255
1270
|
generation: input.targetGeneration,
|
|
1256
1271
|
manifestKey,
|
|
1257
1272
|
manifestHash: hashBytes(bytes),
|
|
1258
|
-
publishedAt
|
|
1273
|
+
publishedAt,
|
|
1259
1274
|
previousGeneration: current.head.generation,
|
|
1260
1275
|
trust: current.head.trust ?? "trusted-origin",
|
|
1261
1276
|
revision: (current.head.revision ?? 1) + 1,
|
|
@@ -1264,13 +1279,14 @@ async function rollbackHead(state, input) {
|
|
|
1264
1279
|
} else if (receiptBody === void 0) {
|
|
1265
1280
|
return { ok: false, message: `Target generation "${input.targetGeneration}" not found` };
|
|
1266
1281
|
} else {
|
|
1267
|
-
const
|
|
1282
|
+
const decoder = new TextDecoder();
|
|
1283
|
+
const receipt = JSON.parse(decoder.decode(receiptBody));
|
|
1268
1284
|
head = {
|
|
1269
1285
|
schema: HEAD_MANIFEST_SCHEMA,
|
|
1270
1286
|
generation: receipt.generation,
|
|
1271
1287
|
manifestKey: receipt.rootKey,
|
|
1272
1288
|
manifestHash: receipt.rootHash,
|
|
1273
|
-
publishedAt
|
|
1289
|
+
publishedAt,
|
|
1274
1290
|
previousGeneration: current.head.generation,
|
|
1275
1291
|
trust: current.head.trust ?? "trusted-origin",
|
|
1276
1292
|
revision: (current.head.revision ?? 1) + 1,
|
|
@@ -1292,6 +1308,10 @@ async function rollbackHead(state, input) {
|
|
|
1292
1308
|
|
|
1293
1309
|
// src/publication/gc.ts
|
|
1294
1310
|
var PROTECTED_KEYS = /* @__PURE__ */ new Set([HEAD_KEY, STATUS_KEY, PINS_KEY]);
|
|
1311
|
+
function decodeJson(bytes) {
|
|
1312
|
+
const decoder = new TextDecoder();
|
|
1313
|
+
return JSON.parse(decoder.decode(bytes));
|
|
1314
|
+
}
|
|
1295
1315
|
function generationFromKey(key) {
|
|
1296
1316
|
if (key.startsWith(`${GENERATIONS_PREFIX}/`)) {
|
|
1297
1317
|
return key.split("/", 2)[1];
|
|
@@ -1325,19 +1345,19 @@ async function collectCasAndMapFromHead(state, index, generation) {
|
|
|
1325
1345
|
return { stateKeys, indexKeys };
|
|
1326
1346
|
}
|
|
1327
1347
|
stateKeys.push(receiptKey);
|
|
1328
|
-
const receipt =
|
|
1348
|
+
const receipt = decodeJson(receiptBody);
|
|
1329
1349
|
if (receipt.rootKey !== void 0) stateKeys.push(receipt.rootKey);
|
|
1330
1350
|
if (receipt.rootHash !== void 0) {
|
|
1331
1351
|
const rootKey = receipt.rootKey ?? `${MAP_ROOTS_PREFIX}/${receipt.rootHash}.json`;
|
|
1332
1352
|
const rootBody = await state.get(rootKey);
|
|
1333
1353
|
if (rootBody !== void 0) {
|
|
1334
|
-
const root =
|
|
1354
|
+
const root = decodeJson(rootBody);
|
|
1335
1355
|
for (const shardHash of Object.values(root.shards ?? {})) {
|
|
1336
1356
|
const shardKey = `${MAP_SHARDS_PREFIX}/${shardHash}.json`;
|
|
1337
1357
|
stateKeys.push(shardKey);
|
|
1338
1358
|
const shardBody = await state.get(shardKey) ?? (index === void 0 ? void 0 : await index.get(shardKey));
|
|
1339
1359
|
if (shardBody === void 0) continue;
|
|
1340
|
-
const shard =
|
|
1360
|
+
const shard = decodeJson(shardBody);
|
|
1341
1361
|
for (const entry of Object.values(shard.entries ?? {})) {
|
|
1342
1362
|
const casKey = `${CAS_PREFIX}/${entry.hash}`;
|
|
1343
1363
|
indexKeys.push(casKey);
|
|
@@ -1385,7 +1405,7 @@ async function planGarbageCollection(options) {
|
|
|
1385
1405
|
const id = generationFromKey(key);
|
|
1386
1406
|
if (id !== void 0) genIds.add(id);
|
|
1387
1407
|
}
|
|
1388
|
-
const ordered =
|
|
1408
|
+
const ordered = genIds.values().toArray().toSorted();
|
|
1389
1409
|
const retainTail = ordered.slice(-policy.retainGenerations);
|
|
1390
1410
|
for (const id of retainTail) protectedGens.add(id);
|
|
1391
1411
|
const liveState = new Set(PROTECTED_KEYS);
|
|
@@ -1464,8 +1484,6 @@ async function planGarbageCollection(options) {
|
|
|
1464
1484
|
}
|
|
1465
1485
|
async function runGarbageCollection(plan, stores, opts) {
|
|
1466
1486
|
const dryRun = opts?.dryRun !== false;
|
|
1467
|
-
const deleted = [];
|
|
1468
|
-
const skipped = [];
|
|
1469
1487
|
if (dryRun) {
|
|
1470
1488
|
return {
|
|
1471
1489
|
dryRun: true,
|
|
@@ -1473,6 +1491,8 @@ async function runGarbageCollection(plan, stores, opts) {
|
|
|
1473
1491
|
skipped: plan.deleteKeys
|
|
1474
1492
|
};
|
|
1475
1493
|
}
|
|
1494
|
+
const deleted = [];
|
|
1495
|
+
const skipped = [];
|
|
1476
1496
|
for (const ref of plan.deleteKeys) {
|
|
1477
1497
|
try {
|
|
1478
1498
|
const store = ref.role === "index" ? stores.index : stores.state;
|
|
@@ -1508,7 +1528,13 @@ function shardIdForKey(logicalKey, hexChars = DEFAULT_SHARD_HEX_CHARS) {
|
|
|
1508
1528
|
|
|
1509
1529
|
// src/publication/incremental.ts
|
|
1510
1530
|
function toBytes3(body) {
|
|
1511
|
-
|
|
1531
|
+
if (typeof body !== "string") return body;
|
|
1532
|
+
const encoder = new TextEncoder();
|
|
1533
|
+
return encoder.encode(body);
|
|
1534
|
+
}
|
|
1535
|
+
function decodeJson2(bytes) {
|
|
1536
|
+
const decoder = new TextDecoder();
|
|
1537
|
+
return JSON.parse(decoder.decode(bytes));
|
|
1512
1538
|
}
|
|
1513
1539
|
async function putCas(store, body, contentType, fenced) {
|
|
1514
1540
|
const hash = hashBytes(body);
|
|
@@ -1533,7 +1559,7 @@ async function loadRoot(state, head) {
|
|
|
1533
1559
|
if (body === void 0) {
|
|
1534
1560
|
return { schema: MAP_ROOT_SCHEMA, shards: {} };
|
|
1535
1561
|
}
|
|
1536
|
-
return
|
|
1562
|
+
return decodeJson2(body);
|
|
1537
1563
|
}
|
|
1538
1564
|
async function loadShard(state, shardHash) {
|
|
1539
1565
|
if (shardHash === void 0) {
|
|
@@ -1544,7 +1570,7 @@ async function loadShard(state, shardHash) {
|
|
|
1544
1570
|
if (body === void 0) {
|
|
1545
1571
|
return { schema: MAP_SHARD_SCHEMA, entries: {} };
|
|
1546
1572
|
}
|
|
1547
|
-
return
|
|
1573
|
+
return decodeJson2(body);
|
|
1548
1574
|
}
|
|
1549
1575
|
async function publishIncremental(input) {
|
|
1550
1576
|
const generation = input.generation ?? randomUUID2();
|
|
@@ -1628,7 +1654,8 @@ async function publishIncremental(input) {
|
|
|
1628
1654
|
});
|
|
1629
1655
|
}
|
|
1630
1656
|
writes += 1;
|
|
1631
|
-
const
|
|
1657
|
+
const publishedAtDate = /* @__PURE__ */ new Date();
|
|
1658
|
+
const publishedAt = publishedAtDate.toISOString();
|
|
1632
1659
|
const receipt = {
|
|
1633
1660
|
schema: RECEIPT_SCHEMA,
|
|
1634
1661
|
generation,
|