@substrat-run/adapter-cloudflare 0.132.1 → 0.133.0
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/control-plane-do.d.ts +1 -1
- package/dist/control-plane-do.d.ts.map +1 -1
- package/dist/control-plane-do.js +8 -3
- package/dist/control-plane-do.js.map +1 -1
- package/dist/host.d.ts +7 -0
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +9 -2
- package/dist/host.js.map +1 -1
- package/dist/scope-do.d.ts.map +1 -1
- package/dist/scope-do.js +15 -11
- package/dist/scope-do.js.map +1 -1
- package/package.json +7 -7
package/dist/scope-do.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope-do.d.ts","sourceRoot":"","sources":["../src/scope-do.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAcL,KAAK,WAAW,EAsCjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAoCL,KAAK,SAAS,EAmBd,KAAK,kBAAkB,EAEvB,KAAK,gBAAgB,EAuEtB,MAAM,sBAAsB,CAAC;AAsF9B;;;;;;;;;;;;;GAaG;AAEH,MAAM,WAAW,UAAU;IACzB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,sBAAsB,CAAC;IACvC;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AA0bD;;;GAGG;AACH,MAAM,MAAM,yBAAyB,CAAC,CAAC,IAAI;IAAE,KAAK,EAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,SAAS,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,WAAW,CAAA;CAAE,CAAC;AAgDxG;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,UAAU,GAAG,SAAS,CAOxD;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,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|
package/dist/scope-do.js
CHANGED
|
@@ -2822,8 +2822,8 @@ export function defineScopeDO(modules, bareOps) {
|
|
|
2822
2822
|
this.ctx.storage.transactionSync(() => {
|
|
2823
2823
|
this.sql.exec(`INSERT INTO _substrat_job_runs
|
|
2824
2824
|
(id, module_id, job, instance, payload, status, cursor, counters, attempts,
|
|
2825
|
-
last_error, started_at, updated_at, next_attempt_at, ended_at)
|
|
2826
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, row.id, row.module_id, row.job, row.instance, row.payload, row.status, row.cursor, row.counters, row.attempts, row.last_error, row.started_at, row.updated_at, row.next_attempt_at, row.ended_at);
|
|
2825
|
+
last_error, started_at, updated_at, next_attempt_at, ended_at, subject_id)
|
|
2826
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, row.id, row.module_id, row.job, row.instance, row.payload, row.status, row.cursor, row.counters, row.attempts, row.last_error, row.started_at, row.updated_at, row.next_attempt_at, row.ended_at, row.subject_id ?? null);
|
|
2827
2827
|
});
|
|
2828
2828
|
return row;
|
|
2829
2829
|
}
|
|
@@ -2835,8 +2835,8 @@ export function defineScopeDO(modules, bareOps) {
|
|
|
2835
2835
|
async jobRunInsert(row) {
|
|
2836
2836
|
this.sql.exec(`INSERT INTO _substrat_job_runs
|
|
2837
2837
|
(id, module_id, job, instance, payload, status, cursor, counters, attempts,
|
|
2838
|
-
last_error, started_at, updated_at, next_attempt_at, ended_at)
|
|
2839
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, row.id, row.module_id, row.job, row.instance, row.payload, row.status, row.cursor, row.counters, row.attempts, row.last_error, row.started_at, row.updated_at, row.next_attempt_at, row.ended_at);
|
|
2838
|
+
last_error, started_at, updated_at, next_attempt_at, ended_at, subject_id)
|
|
2839
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, row.id, row.module_id, row.job, row.instance, row.payload, row.status, row.cursor, row.counters, row.attempts, row.last_error, row.started_at, row.updated_at, row.next_attempt_at, row.ended_at, row.subject_id ?? null);
|
|
2840
2840
|
}
|
|
2841
2841
|
/**
|
|
2842
2842
|
* `running` runs whose backoff has elapsed, oldest first, after `afterId`.
|
|
@@ -3416,6 +3416,8 @@ export function defineScopeDO(modules, bareOps) {
|
|
|
3416
3416
|
'ALTER TABLE _substrat_migrations ADD COLUMN duration_ms INTEGER',
|
|
3417
3417
|
'ALTER TABLE _substrat_migrations ADD COLUMN rows_changed INTEGER',
|
|
3418
3418
|
'ALTER TABLE _substrat_tuples ADD COLUMN revoked_at TEXT',
|
|
3419
|
+
// #1632: legacy runs retain an unknown subject; no content-based backfill.
|
|
3420
|
+
'ALTER TABLE _substrat_job_runs ADD COLUMN subject_id TEXT',
|
|
3419
3421
|
// Executor retry state (#100). The defaults read as "terminal", which is
|
|
3420
3422
|
// right for every row already there: each is a completed delivery or a
|
|
3421
3423
|
// consumer dead-letter.
|
|
@@ -4425,7 +4427,9 @@ export function defineScopeDO(modules, bareOps) {
|
|
|
4425
4427
|
/** The directory's recorded-off modules (#1742), switched off in THIS unit right after the
|
|
4426
4428
|
* seat, so no sweep can run the grants the seat just re-created. `scopeId` is the scope
|
|
4427
4429
|
* this projection provisions (the object of `scopeTuples`), never another. */
|
|
4428
|
-
switchOff
|
|
4430
|
+
switchOff,
|
|
4431
|
+
/** Declared service subjects excluded only from human lockout repair (#1896). */
|
|
4432
|
+
serviceSubjects) {
|
|
4429
4433
|
if (await this.isReaped())
|
|
4430
4434
|
return [];
|
|
4431
4435
|
// A projection that arrives after this scope was reaped is dropped, not
|
|
@@ -4510,14 +4514,14 @@ export function defineScopeDO(modules, bareOps) {
|
|
|
4510
4514
|
this.sql.exec(seat.sql, ...seat.params);
|
|
4511
4515
|
}
|
|
4512
4516
|
// #1659's one exception: the owner-of-record's seat comes back over a revoke when
|
|
4513
|
-
//
|
|
4514
|
-
// That is the #332 lockout this path exists to repair
|
|
4515
|
-
//
|
|
4517
|
+
// No HUMAN holder remains — declared service subjects cannot prevent lockout repair.
|
|
4518
|
+
// That is the #332 lockout this path exists to repair. The flip guard below still
|
|
4519
|
+
// counts service authority; only the repair excludes the declared service subjects.
|
|
4516
4520
|
// With any other effective holder, the revoke stands: a hand-over that seats a
|
|
4517
4521
|
// successor before unseating the owner is not undone by the next promote. A holder of
|
|
4518
4522
|
// a role the vertical no longer defines is NOT one — it passes no check, so it must
|
|
4519
4523
|
// not stand in for the holder this repair exists to restore.
|
|
4520
|
-
if (roles.length > 0 && !this.hasEffectiveRoleGrant(tenantId)) {
|
|
4524
|
+
if (roles.length > 0 && !this.hasEffectiveRoleGrant(tenantId, serviceSubjects)) {
|
|
4521
4525
|
for (const st of scopeTuples ?? []) {
|
|
4522
4526
|
if (!st.lockout_reseat)
|
|
4523
4527
|
continue;
|
|
@@ -4566,8 +4570,8 @@ export function defineScopeDO(modules, bareOps) {
|
|
|
4566
4570
|
* kernel's `effectiveRoleGrantQuery`, where it is tested against a real SQLite. A tuple
|
|
4567
4571
|
* for a role the vertical no longer defines counts for nothing, exactly as in the local
|
|
4568
4572
|
* checker, which expands a role only through its definition. */
|
|
4569
|
-
hasEffectiveRoleGrant(tenantId) {
|
|
4570
|
-
const q = effectiveRoleGrantQuery(tenantId, new Date().toISOString());
|
|
4573
|
+
hasEffectiveRoleGrant(tenantId, excludedSubjects) {
|
|
4574
|
+
const q = effectiveRoleGrantQuery(tenantId, new Date().toISOString(), undefined, excludedSubjects);
|
|
4571
4575
|
const row = this.sql.exec(q.sql, ...q.params).toArray()[0];
|
|
4572
4576
|
return row?.effective === 1;
|
|
4573
4577
|
}
|