@tinycloud/cli 1.3.0-beta.26 → 1.3.0-beta.27
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 +9 -6
- package/dist/index.js.map +1 -1
- package/dist/legacy-entry.js +9 -6
- package/dist/legacy-entry.js.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -5349,12 +5349,15 @@ CREATE TABLE IF NOT EXISTS grant_install (
|
|
|
5349
5349
|
}
|
|
5350
5350
|
#storeGrantPolicy(g, policy, existing) {
|
|
5351
5351
|
const installedAt = existing?.installedAt ?? policy.at;
|
|
5352
|
+
const keepExisting = existing !== null && existing.consentDeadline < policy.consentDeadline;
|
|
5353
|
+
const consentDeadline = keepExisting ? existing.consentDeadline : policy.consentDeadline;
|
|
5354
|
+
const consentAnchor = keepExisting ? existing.consentAnchor : policy.consentAnchor;
|
|
5352
5355
|
const effectiveExpiresAt = Math.min(
|
|
5353
5356
|
g.expiresAt === null ? Infinity : g.expiresAt * 1e3,
|
|
5354
5357
|
installedAt + policy.ttlMs,
|
|
5355
|
-
|
|
5358
|
+
consentDeadline
|
|
5356
5359
|
);
|
|
5357
|
-
if (!Number.isSafeInteger(installedAt) || installedAt < 0 || !Number.isSafeInteger(effectiveExpiresAt) || effectiveExpiresAt < 0 || !Number.isSafeInteger(
|
|
5360
|
+
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) {
|
|
5358
5361
|
throw new ReplicaError3(ReplicaErrorCode3.GRANT_EXPIRED, "The replica grant has no finite effective expiry.");
|
|
5359
5362
|
}
|
|
5360
5363
|
this.#db.run(
|
|
@@ -5366,11 +5369,11 @@ CREATE TABLE IF NOT EXISTS grant_install (
|
|
|
5366
5369
|
g.cid,
|
|
5367
5370
|
installedAt,
|
|
5368
5371
|
effectiveExpiresAt,
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
+
consentDeadline,
|
|
5373
|
+
consentAnchor.at,
|
|
5374
|
+
consentAnchor.source
|
|
5372
5375
|
);
|
|
5373
|
-
return { installedAt, effectiveExpiresAt, consentDeadline
|
|
5376
|
+
return { installedAt, effectiveExpiresAt, consentDeadline, consentAnchor };
|
|
5374
5377
|
}
|
|
5375
5378
|
async installGatedGrant(g, policy) {
|
|
5376
5379
|
return this.#guardedWrite("Installing the gated grant", () => {
|