@tinycloud/replica 0.3.0-beta.6 → 0.3.0-beta.7
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/kv-storage-testing.js.map +1 -1
- package/dist/kv-storage.js +1 -1
- package/dist/{kv-storage.worker.f9311d47e8d4d08d5413987b5f8aa5e3cd180708f3e4debed3b0a3d938156fcd.js → kv-storage.worker.850a5e19b486939f03586f7d1294934f54f44cca0224450b1ba94dfb07912a75.js} +1 -1
- package/dist/kv-storage.worker.js +1 -1
- package/dist/kv-storage.worker.js.map +1 -1
- package/dist/replica.worker.js +1 -1
- package/dist/replica.worker.js.map +1 -1
- package/dist/sqlite.cjs +9 -6
- package/dist/sqlite.cjs.map +1 -1
- package/dist/sqlite.js +9 -6
- package/dist/sqlite.js.map +1 -1
- package/package.json +1 -1
package/dist/sqlite.js
CHANGED
|
@@ -1335,12 +1335,15 @@ var SqliteReplicaStore = class _SqliteReplicaStore {
|
|
|
1335
1335
|
}
|
|
1336
1336
|
#storeGrantPolicy(g, policy, existing) {
|
|
1337
1337
|
const installedAt = existing?.installedAt ?? policy.at;
|
|
1338
|
+
const keepExisting = existing !== null && existing.consentDeadline < policy.consentDeadline;
|
|
1339
|
+
const consentDeadline = keepExisting ? existing.consentDeadline : policy.consentDeadline;
|
|
1340
|
+
const consentAnchor = keepExisting ? existing.consentAnchor : policy.consentAnchor;
|
|
1338
1341
|
const effectiveExpiresAt = Math.min(
|
|
1339
1342
|
g.expiresAt === null ? Infinity : g.expiresAt * 1e3,
|
|
1340
1343
|
installedAt + policy.ttlMs,
|
|
1341
|
-
|
|
1344
|
+
consentDeadline
|
|
1342
1345
|
);
|
|
1343
|
-
if (!Number.isSafeInteger(installedAt) || installedAt < 0 || !Number.isSafeInteger(effectiveExpiresAt) || effectiveExpiresAt < 0 || !Number.isSafeInteger(
|
|
1346
|
+
if (!Number.isSafeInteger(installedAt) || installedAt < 0 || !Number.isSafeInteger(effectiveExpiresAt) || effectiveExpiresAt < 0 || !Number.isSafeInteger(consentDeadline) || consentDeadline < 0 || !Number.isSafeInteger(consentAnchor.at) || consentAnchor.at < 0 || !Number.isSafeInteger(policy.ttlMs) || policy.ttlMs <= 0) {
|
|
1344
1347
|
throw new ReplicaError(ReplicaErrorCode.GRANT_EXPIRED, "The replica grant has no finite effective expiry.");
|
|
1345
1348
|
}
|
|
1346
1349
|
this.#db.run(
|
|
@@ -1352,11 +1355,11 @@ var SqliteReplicaStore = class _SqliteReplicaStore {
|
|
|
1352
1355
|
g.cid,
|
|
1353
1356
|
installedAt,
|
|
1354
1357
|
effectiveExpiresAt,
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
+
consentDeadline,
|
|
1359
|
+
consentAnchor.at,
|
|
1360
|
+
consentAnchor.source
|
|
1358
1361
|
);
|
|
1359
|
-
return { installedAt, effectiveExpiresAt, consentDeadline
|
|
1362
|
+
return { installedAt, effectiveExpiresAt, consentDeadline, consentAnchor };
|
|
1360
1363
|
}
|
|
1361
1364
|
async installGatedGrant(g, policy) {
|
|
1362
1365
|
return this.#guardedWrite("Installing the gated grant", () => {
|