@tinycloud/node-sdk 3.1.0-beta.10 → 3.1.0-beta.11
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/{core-CC7uDKZP.d.cts → core-CJiLya1s.d.cts} +3 -0
- package/dist/{core-CC7uDKZP.d.ts → core-CJiLya1s.d.ts} +3 -0
- package/dist/core.cjs +43 -29
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +43 -29
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +43 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +43 -29
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -20218,12 +20218,13 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20218
20218
|
if (!auth) {
|
|
20219
20219
|
throw new Error("Account bootstrap requires an active wallet session");
|
|
20220
20220
|
}
|
|
20221
|
+
const accountSpaceId = this.ownedSpaceId(import_sdk_core7.ACCOUNT_REGISTRY_SPACE);
|
|
20221
20222
|
const skipped = auth.lastActivationSkippedSpaceIds;
|
|
20223
|
+
if (skipped.includes(accountSpaceId)) return { action: "run", mode: "fresh" };
|
|
20222
20224
|
if (skipped.some((spaceId) => enshrinedSpaceIds.has(spaceId))) {
|
|
20223
|
-
return { action: "run", mode: "
|
|
20225
|
+
return { action: "run", mode: "repair" };
|
|
20224
20226
|
}
|
|
20225
20227
|
try {
|
|
20226
|
-
const accountSpaceId = this.ownedSpaceId(import_sdk_core7.ACCOUNT_REGISTRY_SPACE);
|
|
20227
20228
|
const markerPermission = {
|
|
20228
20229
|
service: "tinycloud.kv",
|
|
20229
20230
|
space: accountSpaceId,
|
|
@@ -20235,7 +20236,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20235
20236
|
}
|
|
20236
20237
|
const marker = await this.readBootstrapCompletionMarker();
|
|
20237
20238
|
if (marker.ok) {
|
|
20238
|
-
if (this.isAcceptedBootstrapCompletionMarker(marker.data.data)) {
|
|
20239
|
+
if (this.isAcceptedBootstrapCompletionMarker(marker.data.data, steps.map((step) => step.id))) {
|
|
20239
20240
|
return { action: "skip" };
|
|
20240
20241
|
}
|
|
20241
20242
|
return { action: "run", mode: "repair" };
|
|
@@ -20285,12 +20286,16 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20285
20286
|
);
|
|
20286
20287
|
}
|
|
20287
20288
|
}
|
|
20288
|
-
|
|
20289
|
+
/**
|
|
20290
|
+
* A marker written before a canonical space was added triggers one bounded repair.
|
|
20291
|
+
*/
|
|
20292
|
+
isAcceptedBootstrapCompletionMarker(value, canonicalStepIds) {
|
|
20289
20293
|
if (typeof value !== "object" || value === null) return false;
|
|
20290
20294
|
const entries = Object.entries(value);
|
|
20291
20295
|
const markerValue = (name) => entries.find(([key2]) => key2 === name)?.[1];
|
|
20292
20296
|
const version23 = markerValue("v");
|
|
20293
|
-
|
|
20297
|
+
const stepIds = markerValue("stepIds");
|
|
20298
|
+
return typeof version23 === "number" && Number.isInteger(version23) && ACCEPTED_MARKER_VERSIONS.some((acceptedVersion) => acceptedVersion === version23) && Array.isArray(stepIds) && canonicalStepIds.every((stepId) => stepIds.includes(stepId));
|
|
20294
20299
|
}
|
|
20295
20300
|
markerReadIsUnhostedSpace(meta) {
|
|
20296
20301
|
return meta?.status === 404;
|
|
@@ -20377,30 +20382,39 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20377
20382
|
}
|
|
20378
20383
|
}
|
|
20379
20384
|
if (step.kind === "seed-spaces") {
|
|
20380
|
-
const
|
|
20381
|
-
|
|
20382
|
-
|
|
20383
|
-
|
|
20384
|
-
|
|
20385
|
-
|
|
20386
|
-
|
|
20387
|
-
|
|
20388
|
-
|
|
20389
|
-
|
|
20390
|
-
|
|
20391
|
-
|
|
20392
|
-
|
|
20393
|
-
|
|
20394
|
-
|
|
20395
|
-
|
|
20396
|
-
|
|
20397
|
-
|
|
20398
|
-
|
|
20399
|
-
|
|
20400
|
-
|
|
20401
|
-
|
|
20402
|
-
|
|
20403
|
-
|
|
20385
|
+
const inputs = step.spaces.map((space) => ({
|
|
20386
|
+
spaceId: space.spaceId,
|
|
20387
|
+
name: space.name,
|
|
20388
|
+
ownerDid: this.did,
|
|
20389
|
+
type: "owned",
|
|
20390
|
+
permissions: ["*"],
|
|
20391
|
+
status: "active"
|
|
20392
|
+
}));
|
|
20393
|
+
if (mode === "fresh") {
|
|
20394
|
+
const registered = await this.account.spaces.registerBatch(inputs);
|
|
20395
|
+
if (!registered.ok) {
|
|
20396
|
+
throw Object.assign(
|
|
20397
|
+
new Error(`Failed to seed account spaces: ${registered.error.message}`),
|
|
20398
|
+
{ cause: registered.error }
|
|
20399
|
+
);
|
|
20400
|
+
}
|
|
20401
|
+
const batchError = registered.data.recoveredFromBatchError;
|
|
20402
|
+
if (batchError) {
|
|
20403
|
+
warnings.push({
|
|
20404
|
+
stepId: step.id,
|
|
20405
|
+
kind: "batch-write-reconciled",
|
|
20406
|
+
code: batchError.code,
|
|
20407
|
+
message: batchError.message
|
|
20408
|
+
});
|
|
20409
|
+
}
|
|
20410
|
+
} else {
|
|
20411
|
+
const ensured = await this.account.spaces.registerMissing(inputs);
|
|
20412
|
+
if (!ensured.ok) {
|
|
20413
|
+
throw Object.assign(
|
|
20414
|
+
new Error(`Failed to seed account spaces: ${ensured.error.message}`),
|
|
20415
|
+
{ cause: ensured.error }
|
|
20416
|
+
);
|
|
20417
|
+
}
|
|
20404
20418
|
}
|
|
20405
20419
|
}
|
|
20406
20420
|
if (step.kind === "seed-applications") {
|