tablinum 0.6.2 → 0.6.4
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.js +26 -8
- package/dist/svelte/index.svelte.js +26 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -401,7 +401,8 @@ function fieldDefToSchema(fd) {
|
|
|
401
401
|
case "object": {
|
|
402
402
|
const nested = {};
|
|
403
403
|
for (const [k, v] of Object.entries(fd.fields)) {
|
|
404
|
-
|
|
404
|
+
const fieldSchema = fieldDefToSchema(v);
|
|
405
|
+
nested[k] = v.isOptional ? Schema3.optionalKey(fieldSchema) : fieldSchema;
|
|
405
406
|
}
|
|
406
407
|
base = Schema3.Struct(nested);
|
|
407
408
|
break;
|
|
@@ -2082,23 +2083,40 @@ var EpochStoreLive = Layer3.effect(
|
|
|
2082
2083
|
const config = yield* Config;
|
|
2083
2084
|
const identity = yield* Identity;
|
|
2084
2085
|
const storage = yield* Storage;
|
|
2086
|
+
let idbStore;
|
|
2085
2087
|
const idbRaw = yield* storage.getMeta("epochs");
|
|
2086
2088
|
if (typeof idbRaw === "string") {
|
|
2087
|
-
const
|
|
2088
|
-
if (Option7.isSome(
|
|
2089
|
-
|
|
2090
|
-
source: "storage",
|
|
2091
|
-
epochs: idbStore.value.epochs.size
|
|
2092
|
-
});
|
|
2093
|
-
return idbStore.value;
|
|
2089
|
+
const parsed = deserializeEpochStore(idbRaw);
|
|
2090
|
+
if (Option7.isSome(parsed)) {
|
|
2091
|
+
idbStore = parsed.value;
|
|
2094
2092
|
}
|
|
2095
2093
|
}
|
|
2096
2094
|
if (config.epochKeys && config.epochKeys.length > 0) {
|
|
2095
|
+
if (idbStore) {
|
|
2096
|
+
const configIsSubset = config.epochKeys.every((ek) => {
|
|
2097
|
+
const existing = idbStore.epochs.get(ek.epochId);
|
|
2098
|
+
return existing !== void 0 && existing.privateKey === ek.key;
|
|
2099
|
+
});
|
|
2100
|
+
if (configIsSubset) {
|
|
2101
|
+
yield* Effect12.logInfo("Epoch store loaded", {
|
|
2102
|
+
source: "storage",
|
|
2103
|
+
epochs: idbStore.epochs.size
|
|
2104
|
+
});
|
|
2105
|
+
return idbStore;
|
|
2106
|
+
}
|
|
2107
|
+
}
|
|
2097
2108
|
const store2 = createEpochStoreFromInputs(config.epochKeys);
|
|
2098
2109
|
yield* storage.putMeta("epochs", stringifyEpochStore(store2));
|
|
2099
2110
|
yield* Effect12.logInfo("Epoch store loaded", { source: "config", epochs: store2.epochs.size });
|
|
2100
2111
|
return store2;
|
|
2101
2112
|
}
|
|
2113
|
+
if (idbStore) {
|
|
2114
|
+
yield* Effect12.logInfo("Epoch store loaded", {
|
|
2115
|
+
source: "storage",
|
|
2116
|
+
epochs: idbStore.epochs.size
|
|
2117
|
+
});
|
|
2118
|
+
return idbStore;
|
|
2119
|
+
}
|
|
2102
2120
|
const store = createEpochStoreFromInputs(
|
|
2103
2121
|
[{ epochId: EpochId("epoch-0"), key: bytesToHex3(generateSecretKey2()) }],
|
|
2104
2122
|
{ createdBy: identity.publicKey }
|
|
@@ -438,7 +438,8 @@ function fieldDefToSchema(fd) {
|
|
|
438
438
|
case "object": {
|
|
439
439
|
const nested = {};
|
|
440
440
|
for (const [k, v] of Object.entries(fd.fields)) {
|
|
441
|
-
|
|
441
|
+
const fieldSchema = fieldDefToSchema(v);
|
|
442
|
+
nested[k] = v.isOptional ? Schema4.optionalKey(fieldSchema) : fieldSchema;
|
|
442
443
|
}
|
|
443
444
|
base = Schema4.Struct(nested);
|
|
444
445
|
break;
|
|
@@ -2119,23 +2120,40 @@ var EpochStoreLive = Layer3.effect(
|
|
|
2119
2120
|
const config = yield* Config;
|
|
2120
2121
|
const identity = yield* Identity;
|
|
2121
2122
|
const storage = yield* Storage;
|
|
2123
|
+
let idbStore;
|
|
2122
2124
|
const idbRaw = yield* storage.getMeta("epochs");
|
|
2123
2125
|
if (typeof idbRaw === "string") {
|
|
2124
|
-
const
|
|
2125
|
-
if (Option7.isSome(
|
|
2126
|
-
|
|
2127
|
-
source: "storage",
|
|
2128
|
-
epochs: idbStore.value.epochs.size
|
|
2129
|
-
});
|
|
2130
|
-
return idbStore.value;
|
|
2126
|
+
const parsed = deserializeEpochStore(idbRaw);
|
|
2127
|
+
if (Option7.isSome(parsed)) {
|
|
2128
|
+
idbStore = parsed.value;
|
|
2131
2129
|
}
|
|
2132
2130
|
}
|
|
2133
2131
|
if (config.epochKeys && config.epochKeys.length > 0) {
|
|
2132
|
+
if (idbStore) {
|
|
2133
|
+
const configIsSubset = config.epochKeys.every((ek) => {
|
|
2134
|
+
const existing = idbStore.epochs.get(ek.epochId);
|
|
2135
|
+
return existing !== void 0 && existing.privateKey === ek.key;
|
|
2136
|
+
});
|
|
2137
|
+
if (configIsSubset) {
|
|
2138
|
+
yield* Effect12.logInfo("Epoch store loaded", {
|
|
2139
|
+
source: "storage",
|
|
2140
|
+
epochs: idbStore.epochs.size
|
|
2141
|
+
});
|
|
2142
|
+
return idbStore;
|
|
2143
|
+
}
|
|
2144
|
+
}
|
|
2134
2145
|
const store2 = createEpochStoreFromInputs(config.epochKeys);
|
|
2135
2146
|
yield* storage.putMeta("epochs", stringifyEpochStore(store2));
|
|
2136
2147
|
yield* Effect12.logInfo("Epoch store loaded", { source: "config", epochs: store2.epochs.size });
|
|
2137
2148
|
return store2;
|
|
2138
2149
|
}
|
|
2150
|
+
if (idbStore) {
|
|
2151
|
+
yield* Effect12.logInfo("Epoch store loaded", {
|
|
2152
|
+
source: "storage",
|
|
2153
|
+
epochs: idbStore.epochs.size
|
|
2154
|
+
});
|
|
2155
|
+
return idbStore;
|
|
2156
|
+
}
|
|
2139
2157
|
const store = createEpochStoreFromInputs(
|
|
2140
2158
|
[{ epochId: EpochId("epoch-0"), key: bytesToHex3(generateSecretKey2()) }],
|
|
2141
2159
|
{ createdBy: identity.publicKey }
|