@framers/agentos-ext-account-sources 0.7.3 → 0.8.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/README.md CHANGED
@@ -225,7 +225,7 @@ A sync holds a lease. `claim(scope, trigger)` answers a handle only when the own
225
225
 
226
226
  `applyResult(handle, work, result, prepared)` keeps a `retry` result unresolved. A `document` result is weighed first: the store ranks this connection's retained sources and the new one by activity time, newest first with ties broken by source id, and keeps those inside `maxRetainedDocuments`, `maxHeldCharacters` and the allowance. A document that does not fit is recorded as skipped with `document_limit`, `held_limit` or `indexing_limit`, and an excluded one with `excluded`. A document that fits replaces the source's previous copy in the same transaction (host write, indexing charge and provenance), after that copy and every derived result that depends on it are removed through the fence, and this connection's other sources the limits no longer admit are removed with it, never another connection's. A read that repeats the text and message spans of a copy the store still holds, within its expiry and window, adds nothing to index: it is charged nothing and is not weighed against the indexing allowance, so neither a reconcile that reads every retained source again nor a change to a source's labels or history spends any of it. When the read also repeats the copy's version and content hash, the `refresh` binding keeps the copy in place, with every result derived from it, and gives it the read's expiry and message windows; otherwise, and for a host without the binding, the copy is written again from a fresh preparation. A `gone` result, a skip and an excluded document remove the source's previous copy, except an `indexing_limit` skip whose previous copy is within its expiry and window, still admitted as it is by the retained limits, and where the new read begins: the read's text starts with the copy's text, by the hash the store keeps of it, and holds every message of it at the same span. That copy, admitted and charged under an earlier read, stays with the shorter of its own and the read's expiry and message windows until a later read of the source finds room in the allowance (a change to it, or a reconcile) or the copy expires; a read that lost or changed one of its messages removes it. A copy past its expiry or window counts as not held, whether or not `expire` has removed it yet. Given `prepared` as null, a document the store has to write answers `pending` with the same handle and records nothing; apply it again with its prepared value. Such a document reaches the `allowance` binding in both calls, so keep that binding to reads. A failing binding rolls the whole application back. The answer carries a new handle whenever a removal advanced the owner's fence; later calls use it. `finish` commits the cycle's target cursor once every work item is terminal, counting from the stored work, and `progress` records the counts so far.
227
227
 
228
- Controls run with the owner blocked. `control(scope, event, policy?)` applies `connect_started`, `grant_ready`, `pause`, `resume`, `use_changed`, `policy_changed` (with the new policy), `grant_lost` or `disconnect`: it records a content-free barrier and drops the open cycle in one transaction, then completes the barrier and reactivates the owner. Connecting, grant loss and disconnecting remove the connection's sources, their derived results and its exclusions. Pause, resume, a use change and a policy change move retained content to the new generation with its version kept and its expiry never extended, so no result derived before the change can be delivered again; a policy change also removes the sources the new limits leave out and shortens the expiry of the rest to the new window. `exclude(scope, sourceId)` removes one source and keeps a content-free exclusion; `resetExclusions(scope)` clears them. Both raise the generation and keep the committed cursor, and make a reconcile the next cycle: a fresh bounded scan, then history replayed from that cursor, so a change made since it reaches the store even for an item the scan does not list. A control other than disconnecting throws `stale_source_sync` while the `active` binding refuses the owner. A barrier left by a failure blocks claims and reactivation until `recoverControl(scope)` completes it, and a lifecycle worker calls it even for a paused connection. `expire(scope, limit)` removes retained sources whose expiry has passed, also while the connection is paused, then the owner's expired derived results; reads refuse an expired source either way.
228
+ Controls run with the owner blocked. `control(scope, event, policy?)` applies `connect_started`, `grant_ready`, `pause`, `resume`, `use_changed`, `policy_changed` (with the new policy), `grant_lost` or `disconnect`: it records a content-free barrier and drops the open cycle in one transaction, then completes the barrier and reactivates the owner. Connecting, grant loss and disconnecting remove the connection's sources, their derived results and its exclusions. Pause, resume, a use change and a policy change move retained content to the new generation with its version kept and its expiry never extended, so no result derived before the change can be delivered again; a policy change also removes the sources the new limits leave out and shortens the expiry of the rest to the new window. `exclude(scope, sourceId)` removes one source and keeps a content-free exclusion; `resetExclusions(scope)` clears them. Both raise the generation and keep the committed cursor, and make a reconcile the next cycle: a fresh bounded scan, then history replayed from that cursor, so a change made since it reaches the store even for an item the scan does not list. A control other than disconnecting throws `stale_source_sync` while the `active` binding refuses the owner. A barrier left by a failure blocks claims and reactivation until `recoverControl(scope)` completes it, and a lifecycle worker calls it even for a paused connection. `expire(scope, limit)` removes retained sources whose expiry has passed, also while the connection is paused or the owner's fence is inactive, as for a suspended account, which stays inactive, then the owner's expired derived results; reads refuse an expired source either way. Each source goes in a transaction of its own. When a removal or the results' expiry fails, `expire` throws the failure; once it had removed a source, it throws a `SourceSyncExpiryError` with the failure's message and `cause`, whose `partial` counts the removals made before it. `sweepExpired(limit?, owner?)` does the same across every connection, or one owner's, the earliest expiry first and by the store's own expiry, however far a maintenance walk is from them, and answers `{ removed, failed }`: an owner whose removal fails, as when its host purge keeps failing, is counted and left out of the call's later reads, so a call with up to `limit` such owners never holds back another owner's copies. An owner whose derived results then fail to expire is counted too, once; the call still answers every source it removed, and the other owners' results still expire. `removeOwner(owner, remove?)` removes a stopped owner's rows in one transaction: each of its connections, with its work rows, provenance and exclusions, once every one is disconnected with no barrier, lease, work or retained source, after running the lifecycle's own `remove` in the same transaction; the core fence's owner row and deletion records stay, since they hold no content and a restore replays the deletion from them.
229
229
 
230
230
  `readCurrent(tx, derivation)` answers the current state of a derivation's sources for the fence's commit and delivery checks, and a connection with a barrier or pending revalidation reads as disconnected. The store's provenance decides a source's expiry: a policy change's prune and an `indexing_limit` skip that keeps a copy shorten it there without calling a binding, so a host that reads its own rows takes the earlier of its row's expiry and the one `readCurrent` answers. `snapshot(scope)` answers metadata for authenticated controls and `documents(scope)` the retained provenance; neither authorizes delivery. Work rows and barriers hold ids and fixed values only. The documents table holds provenance, message timing, counts and hashes, never text. A text hash or a connector's content hash confirms a guessed text, a short templated message most easily, so treat the table as content, like the host's own tables, for access, retention and backups.
231
231
 
@@ -334,7 +334,7 @@ A `grant_rejected` or `insufficient_scope` failure goes to `lifecycle.loseGrant`
334
334
  | `stale` | The lease, the generation or the owner's fence moved on; the run committed nothing more |
335
335
  | `unavailable` | The store could not be reached; no retry time was recorded, and a lease the run held expires on its own |
336
336
 
337
- `maintain(after?, limit?)` is a maintenance batch: for up to `limit` connections after `after`, in key order and in every state, paused, blocked and disconnected included, it calls `lifecycle.recover`, the store's `recoverControl` and `expire(scope, 100)`. A failure is counted in `failed` and the next connection still runs; no provider is called. It answers `scanned`, `expired`, `failed` and `next`: pass `next` as `after` to the next batch, and start again from null once it is null. Schedule it at least once a minute; reads refuse expired content whether or not it runs.
337
+ `maintain(after?, limit?)` is a maintenance batch: for up to `limit` connections after `after`, in key order and in every state, paused, blocked and disconnected included, it calls `lifecycle.recover`, the store's `recoverControl` and `expire(scope, 100)`, after a sweep of up to `limit` sources whose expiry has passed from any connection (`sweepExpired`), so no expired copy waits for the walk to reach its connection; each owner the sweep could not clear, and a sweep that could not read, count in `failed`. A failure is counted in `failed` and the next connection still runs, and the sources an `expire` removed before it failed count in `expired`; no provider is called. It answers `scanned`, `expired`, `failed` and `next`: pass `next` as `after` to the next batch, and start again from null once it is null. Schedule it at least once a minute; reads refuse expired content whether or not it runs.
338
338
 
339
339
  With an `events` sink the coordinator reports `started` at the claim, `progress` with the count of retained sources after each read, `yielded` and `retry` with the reads made, `succeeded` with the count of retained sources, `reconnect`, and `purged` with the sources a maintenance batch expired. Each event carries `kind`, `state` and `n`, and `yielded`, `retry`, `succeeded` and `reconnect` also the run's duration as `ms`. A sink that throws is ignored.
340
340
 
@@ -368,11 +368,11 @@ await revocations.revokeBatch();
368
368
 
369
369
  The host wires it in four places. The store's `active` binding answers true only when the account is live and `permits(tx, owner)` holds, so an owner whose stop is still purging, or who was deleted, has no sources. Authorization start and grant installation check `canConnect(tx, owner)` under the owner fence. The grant is saved with `new SealedTokenStore(values(tx, scope), keys, { namespace: sourceGrantNamespace(scope) })` under `SOURCE_GRANT_KEY`, the row every lifecycle step reads. A grant operation such as a refresh runs through `withGrant`.
370
370
 
371
- `disconnect(scope, generation)`, `loseGrant(handle, reason)` and `deleteOwner(owner)` each commit in one short transaction the owner's fence, the connection's stop (`disconnected`, or `needs_reconnecting` for a lost grant), a purge barrier, a content-free stop intent, the grant's refresh token moved into the revoke-only queue, sealed under the current key and bound to its queue row, and the deletion of the active grant and its lease. `disconnect` takes the generation the authenticated request saw and answers null for another one; `loseGrant` takes the coordinator's exact current handle and answers false for a stale one; `deleteOwner` stops every connection of the owner, also when there is none, and keeps the owner blocked for good. Call it before the host removes any source, credential or account row. A grant that cannot be opened is deleted all the same, and its queue row records it as unreadable. The purge then runs in a transaction of its own; when it fails, the committed stop keeps the owner blocked, and `recover(scope)` completes it. The coordinator's `maintain` calls `recover` for every connection, paused ones included. None of these methods calls the provider.
371
+ `disconnect(scope, generation)`, `loseGrant(handle, reason)` and `deleteOwner(owner)` each commit in one short transaction the owner's fence, the connection's stop (`disconnected`, or `needs_reconnecting` for a lost grant), a purge barrier, a content-free stop intent, the grant's refresh token moved into the revoke-only queue, sealed under the current key and bound to its queue row, and the deletion of the active grant and its lease. `disconnect` takes the generation the authenticated request saw and answers null for another one; `loseGrant` takes the coordinator's exact current handle and answers false for a stale one; `deleteOwner` stops every connection of the owner, also when there is none, and keeps the owner blocked for good: its block marker stays, recorded as deleted and no longer pending, when `removeOwner` later removes the owner's rows, so `permits` stays false. Call it before the host removes any source, credential or account row. A grant that cannot be opened is deleted all the same, and its queue row records it as unreadable. The purge then runs in a transaction of its own; when it fails, the committed stop keeps the owner blocked, and `recover(scope)` completes it. The coordinator's `maintain` calls `recover` for every connection, paused ones included. None of these methods calls the provider.
372
372
 
373
373
  `revokeBatch(limit?, signal?)` is the account-independent worker. It claims due queue rows, one worker per row, opens each token and revokes it with the revoker's `revoke` outside any transaction, within 15 seconds. A success confirms the row and erases its ciphertext. A failure is retried after 1, 2, 4, 8 and then 15 minutes, whatever status the provider answered. Each token's deadline is 23 hours and 59 minutes after it was queued, and neither a retry, a restart nor a repeated disconnect or deletion moves it: at the deadline the ciphertext is erased and the row records that the permission must be removed at the provider. A token that does not open, because its ciphertext was moved to another row or its key is gone, is erased the same way and never sent. A worker whose claim expired cannot settle a row another worker claimed since. The batch answers `{ attempted, confirmed, deferred, expired, unreadable }`. The database erases nothing on its own when a deadline passes: reads and dispatch stop at the deadline, and erasure needs the worker to run, so schedule it at least once a minute.
374
374
 
375
- `status(scope)` answers `{ localPending, revocation }`, with `revocation` one of `not_needed`, `pending`, `confirmed` and `permission_removal_required`; the local purge completes whatever the revocation's outcome. A provider can revoke a whole grant rather than one connection's, so `canConnect` stays false while a revocation of the owner's is pending, or expired or unreadable and not yet acknowledged. `acknowledgeRemoval(scope)` records the account owner's statement that the permission was removed at the provider, after which a new grant may begin; it is an attestation, never a confirmation. `compact()` removes, a day after their deadline, terminal rows that nothing refers to.
375
+ `status(scope)` answers `{ localPending, revocation }`, with `revocation` one of `not_needed`, `pending`, `confirmed` and `permission_removal_required`; the local purge completes whatever the revocation's outcome. A provider can revoke a whole grant rather than one connection's, so `canConnect` stays false while a revocation of the owner's is pending, or expired or unreadable and not yet acknowledged. `acknowledgeRemoval(scope)` records the account owner's statement that the permission was removed at the provider, after which a new grant may begin; it is an attestation, never a confirmation. `compact()` removes, a day after their deadline, terminal rows that nothing refers to. `removeOwner(owner)` removes a deleted owner's rows in one transaction once nothing about them is pending: its connections and their work, provenance and exclusions in the store, and its stop intents, the queue rows they and its exchanges refer to, its grant leases and its exchanges here. It answers `pending`, changing nothing, while the deletion's purge or a revocation of its grants is pending and until a day after its last exchange ended, since a grant can still return for that exchange and must find its record to be queued for revocation; it answers `not_deleted` for an owner whose deletion is not recorded, and `removed` again for an owner already removed. The block marker stays, recording the deletion, so `permits` and `canConnect` stay false and the owner is refused for good, even while the host's account row still reads active; the core fence's owner row and deletion records stay too. `removeDeletedOwners(limit?)` runs it for at most `limit` deleted owners a call, those with rows left to remove and nothing pending, for a host whose own records of a deleted account are gone; run it on a schedule beside `revokeBatch` and `compact`. An owner already removed is not taken again.
376
376
 
377
377
  `withGrant(handle, work, signal?)` runs one grant operation under a durable 30-second grant lease, without holding a transaction over the network; another worker gets `rate_limited` until the lease expires, and the lease is never renewed. `work` receives a `SealedTokenStore` and a signal that aborts after 15 seconds. Every load and save through that store, and the final return, recheck the sync handle and the lease, so after a disconnect or once the lease has expired a held token can be neither saved nor returned (`grant_rejected`).
378
378
 
@@ -402,7 +402,7 @@ An authorization code exchange returns a grant before anything is installed, and
402
402
 
403
403
  `endExchange(exchange, outcome)` records an exchange that returned no grant: `not_dispatched` when the request never left the process, `revoked` when the provider flow revoked a grant it refused and the provider confirmed it, and `unconfirmed` otherwise, as after a timeout, an aborted connection or an unreadable answer. An open exchange whose end passes with nothing recorded, because its worker stopped, becomes unconfirmed at the next `revokeBatch`, counted in `expired`. A recorded outcome is never weakened. An unconfirmed exchange, or a returned grant whose revocation expired or could not be opened, makes `status` answer `permission_removal_required` and keeps `canConnect` false until `acknowledgeRemoval`. Exchange rows survive the account's deletion only to settle their attempt. `compact` removes an exchange a day after its end once it installed, ended or was acknowledged, or its returned grant's revocation was confirmed. A deleted owner can never acknowledge, so once the deletion is recorded `compact` also removes the owner's unconfirmed exchanges and those whose returned grant's revocation expired or could not be opened, and their queue rows a day after the rows' own deadline; an exchange still in flight or with a revocation pending stays, and so does the owner's block marker, which keeps `permits` false.
404
404
 
405
- With an `events` sink the service reports `fenced` after a stop's transaction, `purged` after its purge, and `confirmed`, `deferred`, `expired` and `unreadable` from `revokeBatch`, each as `{ kind: 'source_revocation', state, n }`, with no scope, token or provider text. A sink that throws is ignored.
405
+ With an `events` sink the service reports `fenced` after a stop's transaction, `purged` after its purge, `confirmed`, `deferred`, `expired` and `unreadable` from `revokeBatch`, and `removed` after `removeOwner` removes a deleted owner's rows, each as `{ kind: 'source_revocation', state, n }`, with no scope, token or provider text. A sink that throws is ignored.
406
406
 
407
407
  The service uses five store methods besides those above. `stageStop(scope, event, stage, expected)` and `stageOwnerStop(owner, stage)` commit a stop and run the service's writes in its transaction; `completeStop(scope, generation, complete)` runs the purge's completion once the barrier is gone; `withCurrentHandle(handle, work)` runs grant storage work with the handle checked; and `lockState(tx, scope)` reads the connection's state in a host transaction after taking the owner fence's lock and then the connection's.
408
408
 
package/dist/index.d.ts CHANGED
@@ -13,12 +13,12 @@ export * from './sync/types.js';
13
13
  export * from './sync/state.js';
14
14
  /** The migration-owned schema and the SQL store that persists synchronization under the owner fence. */
15
15
  export { sourceSyncSchema } from './sync/schema.js';
16
- export { SqlAccountSourceSyncStore, type SourceSyncStoredDocument, type SourceSyncAllowance, type SourceSyncStorageBindings, type SourceSyncStoreOptions, type SourceSyncHandle, type SourceSyncSnapshot, type SourceSyncControl, type SourceSyncApplication, type SourceSyncBarrier, } from './sync/SqlAccountSourceSyncStore.js';
16
+ export { SqlAccountSourceSyncStore, type SourceSyncStoredDocument, type SourceSyncAllowance, type SourceSyncStorageBindings, type SourceSyncStoreOptions, type SourceSyncHandle, type SourceSyncSnapshot, type SourceSyncControl, type SourceSyncApplication, type SourceSyncBarrier, type SourceSyncSweep, SourceSyncExpiryError, } from './sync/SqlAccountSourceSyncStore.js';
17
17
  /** Weighted request budgets, request slots and provider retry times shared by every worker through SQL. */
18
18
  export { SourceQuota, sourceQuotaSchema, sourceRetryAt, type SourceQuotaMethod, type SourceQuotaPolicy, type SourceQuotaRequest, type SourceQuotaReason, type SourceQuotaResult, type SourceQuotaOptions, type SourceQuotaCompaction, } from './sync/SourceQuota.js';
19
19
  /** The resumable synchronization coordinator, its lifecycle binding and the migration of its control state. */
20
20
  export { AccountSourceSync, type AccountSourceSyncOptions, type SourceSyncLifecycle, type SourceSyncRunResult, type SourceSyncMaintenanceResult, } from './sync/AccountSourceSync.js';
21
21
  export { sourceSyncCoordinatorSchema, type SourceSyncOperationAttempt, type SourceSyncOperationState, } from './sync/coordinatorState.js';
22
22
  /** Fenced purge, the grant lease, the bounded revoke-only queue and the cleanup of grants that exchanges return. */
23
- export { SourceRevocations, sourceRevocationSchema, sourceGrantNamespace, SOURCE_GRANT_KEY, type SourceRevocationOptions, type SourceRevocationReason, type SourceRevocationNotice, type SourceRevocationBatch, type SourceRevocationEvent, type SourceGrantExchange, type SourceGrantExchangeOutcome, type SourceUninstalledGrantLifecycle, } from './sync/SourceRevocations.js';
23
+ export { SourceRevocations, sourceRevocationSchema, sourceGrantNamespace, SOURCE_GRANT_KEY, type SourceRevocationOptions, type SourceRevocationReason, type SourceRevocationNotice, type SourceRevocationBatch, type SourceRevocationEvent, type SourceOwnerRemoval, type SourceGrantExchange, type SourceGrantExchangeOutcome, type SourceUninstalledGrantLifecycle, } from './sync/SourceRevocations.js';
24
24
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,cAAc,YAAY,CAAC;AAC3B,yDAAyD;AACzD,cAAc,gBAAgB,CAAC;AAC/B,8DAA8D;AAC9D,cAAc,iBAAiB,CAAC;AAChC,oEAAoE;AACpE,cAAc,cAAc,CAAC;AAC7B,0EAA0E;AAC1E,cAAc,kBAAkB,CAAC;AACjC,yEAAyE;AACzE,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,wGAAwG;AACxG,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EACL,yBAAyB,EACzB,KAAK,wBAAwB,EAAE,KAAK,mBAAmB,EAAE,KAAK,yBAAyB,EACvF,KAAK,sBAAsB,EAAE,KAAK,gBAAgB,EAAE,KAAK,kBAAkB,EAC3E,KAAK,iBAAiB,EAAE,KAAK,qBAAqB,EAAE,KAAK,iBAAiB,GAC3E,MAAM,qCAAqC,CAAC;AAC7C,2GAA2G;AAC3G,OAAO,EACL,WAAW,EAAE,iBAAiB,EAAE,aAAa,EAC7C,KAAK,iBAAiB,EAAE,KAAK,iBAAiB,EAAE,KAAK,kBAAkB,EACvE,KAAK,iBAAiB,EAAE,KAAK,iBAAiB,EAAE,KAAK,kBAAkB,EAAE,KAAK,qBAAqB,GACpG,MAAM,uBAAuB,CAAC;AAC/B,+GAA+G;AAC/G,OAAO,EACL,iBAAiB,EACjB,KAAK,wBAAwB,EAAE,KAAK,mBAAmB,EACvD,KAAK,mBAAmB,EAAE,KAAK,2BAA2B,GAC3D,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,2BAA2B,EAC3B,KAAK,0BAA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B,CAAC;AAC/B,+GAA+G;AAC/G,OAAO,EACL,iBAAiB,EACjB,KAAK,wBAAwB,EAAE,KAAK,mBAAmB,EACvD,KAAK,mBAAmB,EAAE,KAAK,2BAA2B,GAC3D,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,2BAA2B,EAC3B,KAAK,0BAA0B,EAAE,KAAK,wBAAwB,GAC/D,MAAM,4BAA4B,CAAC;AACpC,oHAAoH;AACpH,OAAO,EACL,iBAAiB,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,gBAAgB,EACjF,KAAK,uBAAuB,EAAE,KAAK,sBAAsB,EAAE,KAAK,sBAAsB,EACtF,KAAK,qBAAqB,EAAE,KAAK,qBAAqB,EAAE,KAAK,kBAAkB,EAC/E,KAAK,mBAAmB,EAAE,KAAK,0BAA0B,EAAE,KAAK,+BAA+B,GAChG,MAAM,6BAA6B,CAAC"}
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ export * from './sync/types.js';
13
13
  export * from './sync/state.js';
14
14
  /** The migration-owned schema and the SQL store that persists synchronization under the owner fence. */
15
15
  export { sourceSyncSchema } from './sync/schema.js';
16
- export { SqlAccountSourceSyncStore, } from './sync/SqlAccountSourceSyncStore.js';
16
+ export { SqlAccountSourceSyncStore, SourceSyncExpiryError, } from './sync/SqlAccountSourceSyncStore.js';
17
17
  /** Weighted request budgets, request slots and provider retry times shared by every worker through SQL. */
18
18
  export { SourceQuota, sourceQuotaSchema, sourceRetryAt, } from './sync/SourceQuota.js';
19
19
  /** The resumable synchronization coordinator, its lifecycle binding and the migration of its control state. */
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,cAAc,YAAY,CAAC;AAC3B,yDAAyD;AACzD,cAAc,gBAAgB,CAAC;AAC/B,8DAA8D;AAC9D,cAAc,iBAAiB,CAAC;AAChC,oEAAoE;AACpE,cAAc,cAAc,CAAC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M,4BAA4B,CAAC;AACpC,oHAAoH;AACpH,OAAO,EACL,iBAAiB,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,gBAAgB,GAIlF,MAAM,6BAA6B,CAAC"}
@@ -5,7 +5,7 @@
5
5
  * @module account-sources/sync/AccountSourceSync
6
6
  */
7
7
  import type { AccountSourceSyncProvider, SourceSyncScope, SourceSyncTrigger, SourceSyncRequest, SourceSyncDocument, SourceSyncRetryReason, SourceSyncEventSink } from './types.js';
8
- import type { SqlAccountSourceSyncStore, SourceSyncHandle } from './SqlAccountSourceSyncStore.js';
8
+ import { type SqlAccountSourceSyncStore, type SourceSyncHandle } from './SqlAccountSourceSyncStore.js';
9
9
  /**
10
10
  * The host's lifecycle binding: recovery of its committed purges and the fenced handoff of a lost grant. The
11
11
  * coordinator calls it; it never calls a provider for content.
@@ -76,8 +76,10 @@ export type SourceSyncRunResult = {
76
76
  readonly reason: 'domain_policy' | 'invalid_response';
77
77
  };
78
78
  /**
79
- * One maintenance batch: the connections visited, the sources expired, the connections whose maintenance failed, and
80
- * the scope to pass as `after` to the next batch, null once the last batch is done.
79
+ * One maintenance batch: the connections visited, the sources expired by the batch's sweep and its visits (also those
80
+ * an expiry removed before it failed), the failures (each connection whose maintenance failed, each owner the sweep
81
+ * could not clear, and a sweep that could not read), and the scope to pass as `after` to the next batch, null once the
82
+ * last batch is done.
81
83
  */
82
84
  export interface SourceSyncMaintenanceResult {
83
85
  readonly scanned: number;
@@ -127,12 +129,15 @@ export declare class AccountSourceSync<Prepared = unknown> {
127
129
  /**
128
130
  * A bounded scheduler batch. The host persists next between ticks to avoid starving high keys.
129
131
  *
130
- * Visits up to `limit` connections after `after` in key order, paused, blocked and disconnected ones included, and
131
- * for each runs the lifecycle's recovery, the store's control recovery and the expiry of up to 100 sources. A
132
- * failure is counted and the next connection still runs. No provider is called.
132
+ * First removes up to `limit` sources whose expiry has passed from any connection, the earliest first, however far
133
+ * the walk is from them (`sweepExpired`). Then visits up to `limit` connections after `after` in key order, paused,
134
+ * blocked and disconnected ones included, and for each runs the lifecycle's recovery, the store's control recovery
135
+ * and the expiry of up to 100 sources. A failure is counted and the next connection still runs, and the sources an
136
+ * expiry removed before it failed (`SourceSyncExpiryError`) count as expired. No provider is called.
133
137
  *
134
138
  * @param after - The `next` of the previous batch, or null to start from the first connection.
135
- * @param limit - At most this many connections, an integer from 1 to 1,000.
139
+ * @param limit - At most this many connections visited, and this many expired sources swept, an integer from 1 to
140
+ * 1,000.
136
141
  * @throws {SourceSyncFault} `storage_unavailable` when the connections cannot be listed, a `limit` outside that
137
142
  * range included.
138
143
  */
@@ -1 +1 @@
1
- {"version":3,"file":"AccountSourceSync.d.ts","sourceRoot":"","sources":["../../src/sync/AccountSourceSync.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EACV,yBAAyB,EAAE,eAAe,EAAE,iBAAiB,EAAE,iBAAiB,EAChF,kBAAkB,EACF,qBAAqB,EAAmB,mBAAmB,EAC5E,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EACV,yBAAyB,EAAE,gBAAgB,EAC5C,MAAM,gCAAgC,CAAC;AAIxC;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,6FAA6F;IAC7F,OAAO,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/C;;;;OAIG;IACH,SAAS,CAAC,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,gBAAgB,GAAG,oBAAoB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACxG;AACD;;;;;GAKG;AACH,MAAM,WAAW,wBAAwB,CAAC,QAAQ;IAChD,2FAA2F;IAC3F,QAAQ,CAAC,KAAK,EAAE,yBAAyB,CAAC,QAAQ,CAAC,CAAC;IACpD;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,CAAC,aAAa,EAAE,MAAM,gBAAgB,KAAK,OAAO,CAAC,yBAAyB,CAAC,CAAC;IACjG;;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QAAQ,CAAC,KAAK,GAAE,eAAe,GAAG,IAAW,EAAE,KAAK,SAAM,GAAG,OAAO,CAAC,2BAA2B,CAAC;CAuBxG"}
@@ -5,6 +5,7 @@
5
5
  * @module account-sources/sync/AccountSourceSync
6
6
  */
7
7
  import { createHash, randomUUID } from 'node:crypto';
8
+ import { SourceSyncExpiryError, } from './SqlAccountSourceSyncStore.js';
8
9
  import { SourceSyncFault } from './state.js';
9
10
  import { sourceRetryAt } from './SourceQuota.js';
10
11
  class SyncStale extends Error {
@@ -387,12 +388,15 @@ export class AccountSourceSync {
387
388
  /**
388
389
  * A bounded scheduler batch. The host persists next between ticks to avoid starving high keys.
389
390
  *
390
- * Visits up to `limit` connections after `after` in key order, paused, blocked and disconnected ones included, and
391
- * for each runs the lifecycle's recovery, the store's control recovery and the expiry of up to 100 sources. A
392
- * failure is counted and the next connection still runs. No provider is called.
391
+ * First removes up to `limit` sources whose expiry has passed from any connection, the earliest first, however far
392
+ * the walk is from them (`sweepExpired`). Then visits up to `limit` connections after `after` in key order, paused,
393
+ * blocked and disconnected ones included, and for each runs the lifecycle's recovery, the store's control recovery
394
+ * and the expiry of up to 100 sources. A failure is counted and the next connection still runs, and the sources an
395
+ * expiry removed before it failed (`SourceSyncExpiryError`) count as expired. No provider is called.
393
396
  *
394
397
  * @param after - The `next` of the previous batch, or null to start from the first connection.
395
- * @param limit - At most this many connections, an integer from 1 to 1,000.
398
+ * @param limit - At most this many connections visited, and this many expired sources swept, an integer from 1 to
399
+ * 1,000.
396
400
  * @throws {SourceSyncFault} `storage_unavailable` when the connections cannot be listed, a `limit` outside that
397
401
  * range included.
398
402
  */
@@ -400,14 +404,29 @@ export class AccountSourceSync {
400
404
  const scopes = await this.stored(() => this.store.scopes(after, limit));
401
405
  let expired = 0;
402
406
  let failed = 0;
407
+ // A copy past its expiry goes in this pass whichever page of connections the walk below visits.
408
+ try {
409
+ const sweep = await this.stored(() => this.store.sweepExpired(limit));
410
+ expired += sweep.removed;
411
+ failed += sweep.failed;
412
+ }
413
+ catch {
414
+ failed++;
415
+ }
403
416
  for (const scope of scopes) {
404
417
  try {
405
418
  await this.stored(() => this.options.lifecycle.recover(scope));
406
419
  await this.stored(() => this.store.recoverControl(scope));
407
- expired += await this.stored(() => this.store.expire(scope, 100));
420
+ expired += await this.store.expire(scope, 100);
408
421
  }
409
- catch {
410
- failed++;
422
+ catch (error) {
423
+ // An expiry that failed after removing copies removed them all the same.
424
+ if (error instanceof SourceSyncExpiryError) {
425
+ expired += error.partial.removed;
426
+ failed += error.partial.failed;
427
+ }
428
+ else
429
+ failed++;
411
430
  }
412
431
  }
413
432
  if (expired > 0)
@@ -1 +1 @@
1
- {"version":3,"file":"AccountSourceSync.js","sourceRoot":"","sources":["../../src/sync/AccountSourceSync.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AASrD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAuEjD,MAAM,SAAU,SAAQ,KAAK;IAAG,gBAAgB,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;CAAE;AAC/E,MAAM,SAAU,SAAQ,KAAK;IAAG,gBAAgB,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;CAAE;AAC/E,MAAM,YAAa,SAAQ,KAAK;IACT;IAAwC;IAA7D,YAAqB,MAA6B,EAAW,OAAe;QAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;QAAzF,WAAM,GAAN,MAAM,CAAuB;QAAW,YAAO,GAAP,OAAO,CAAQ;IAAmC,CAAC;CACjH;AACD,MAAM,YAAY,GAAqC,CAAC,SAAS,EAAE,cAAc,EAAE,sBAAsB,EAAE,qBAAqB,CAAC,CAAC;AAClI,MAAM,SAAS,GAAG,CAAC,KAAsB,EAAuE,EAAE,CAChH,YAAY,CAAC,QAA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E,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM;YAC9C,IAAI,EAAE,MAAM,CAAC,MAAM,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACxE,CAAC;CACF"}
@@ -48,9 +48,15 @@ export interface SourceRevocationBatch {
48
48
  /** A content-free lifecycle event: a fixed state and a count, never a scope, a token or a provider's text. */
49
49
  export interface SourceRevocationEvent {
50
50
  readonly kind: 'source_revocation';
51
- readonly state: 'fenced' | 'purged' | 'confirmed' | 'deferred' | 'expired' | 'unreadable';
51
+ readonly state: 'fenced' | 'purged' | 'confirmed' | 'deferred' | 'expired' | 'unreadable' | 'removed';
52
52
  readonly n: number;
53
53
  }
54
+ /**
55
+ * What `removeOwner` did: `removed` once the owner's rows are gone but for its block marker, also for an owner already
56
+ * removed; `pending`, changing nothing, while its deletion's purge, a revocation of one of its grants or an exchange
57
+ * of its own is not over; `not_deleted`, changing nothing, for an owner whose deletion is not recorded.
58
+ */
59
+ export type SourceOwnerRemoval = 'removed' | 'pending' | 'not_deleted';
54
60
  /**
55
61
  * What the lifecycle runs with: the synchronization store, the sealing keys, the host's sealed-value binding and a
56
62
  * revocation-only provider flow, with an optional table prefix, clock and event sink.
@@ -154,7 +160,9 @@ export declare class SourceRevocations<Prepared = unknown> implements SourceSync
154
160
  private context;
155
161
  /**
156
162
  * Combine with fresh host account liveness in the sync store's active binding. False while a stop's purge is
157
- * pending for the owner and, for good, once the owner was deleted; it does not authenticate an account.
163
+ * pending for the owner and, for good, once the owner was deleted: `removeOwner` keeps the owner's block marker,
164
+ * recorded as deleted and no longer pending, so it stays false after the owner's rows are removed. It does not
165
+ * authenticate an account.
158
166
  */
159
167
  permits(tx: StorageAdapter, scope: SourceOwnerScope): Promise<boolean>;
160
168
  /**
@@ -198,7 +206,8 @@ export declare class SourceRevocations<Prepared = unknown> implements SourceSync
198
206
  /**
199
207
  * Account deletion: blocks the owner for good and stops every connection of the owner, queueing each grant for
200
208
  * revocation, in one transaction, also when the owner has no connection; then purges them. Call it before the host
201
- * removes any source, credential or account row. Queued revocations outlive the account.
209
+ * removes any source, credential or account row. Queued revocations outlive the account, and the block marker
210
+ * outlives `removeOwner`: it stays recorded as deleted, no longer pending, so `permits` stays false.
202
211
  */
203
212
  deleteOwner(scope: SourceOwnerScope): Promise<void>;
204
213
  /** Recover every pending intent for the owner. No grant or account row is required. */
@@ -255,6 +264,31 @@ export declare class SourceRevocations<Prepared = unknown> implements SourceSync
255
264
  * @returns How many rows were removed.
256
265
  */
257
266
  compact(): Promise<number>;
267
+ /**
268
+ * Removes a deleted owner's rows in one transaction once nothing about them is pending: from the store, each of its
269
+ * connections with their work rows, retained-source provenance and exclusions (`SqlAccountSourceSyncStore.removeOwner`),
270
+ * and from these tables its stop intents, the revoke-only queue rows they and its exchanges refer to, its grant leases
271
+ * and its exchanges. It waits while the deletion's purge is pending, while a revocation of one of its grants is
272
+ * pending, and until a day after its last exchange ended: a grant can still come back for that exchange and must find
273
+ * its record to be queued for revocation. The owner's block marker stays, recording the deletion, so `permits` and
274
+ * `canConnect` stay false and the owner is refused for good, even while the host's account row still reads active.
275
+ * The core fence's owner row and its deletion records stay too.
276
+ *
277
+ * @returns `removed`, `pending` or `not_deleted`, as `SourceOwnerRemoval` describes.
278
+ * @throws {SourceSyncFault} `storage_unavailable` when the store fails.
279
+ */
280
+ removeOwner(scope: SourceOwnerScope): Promise<SourceOwnerRemoval>;
281
+ /**
282
+ * Removes, as `removeOwner` does, the rows of at most `limit` deleted owners a call: those with rows left to remove
283
+ * and nothing pending, the first by key, for a host whose own records of a deleted account are gone. Run it on a
284
+ * schedule beside `revokeBatch` and `compact`; an owner whose purge, revocation or exchange is not over waits for a
285
+ * later call, and an owner already removed is not taken again.
286
+ *
287
+ * @param limit - At most this many owners, an integer from 1 to 1,000.
288
+ * @returns How many owners' rows were removed.
289
+ * @throws {SourceSyncFault} `invalid_response` for another limit and `storage_unavailable` when the store fails.
290
+ */
291
+ removeDeletedOwners(limit?: number): Promise<number>;
258
292
  /** Records exchanges whose deadline passed with no grant returned as unconfirmed: their outcome is unknown. */
259
293
  private lapseExchanges;
260
294
  /** Takes the owner's lifecycle row lock, creating the row unblocked when missing; exchange changes take it first. */
@@ -1 +1 @@
1
- {"version":3,"file":"SourceRevocations.d.ts","sourceRoot":"","sources":["../../src/sync/SourceRevocations.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EACL,gBAAgB,EAChB,KAAK,aAAa,EAAE,KAAK,gBAAgB,EAAE,KAAK,WAAW,EAAE,KAAK,iBAAiB,EACpF,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,YAAY,CAAC;AACnE,OAAO,KAAK,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAGlE,qHAAqH;AACrH,eAAO,MAAM,gBAAgB,UAAU,CAAC;AACxC;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,CAEnE;AACD,oHAAoH;AACpH,MAAM,MAAM,sBAAsB,GAAG,YAAY,GAAG,iBAAiB,GAAG,gBAAgB,GAAG,oBAAoB,CAAC;AAChH;;;;;;GAMG;AACH,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,UAAU,EAAE,YAAY,GAAG,SAAS,GAAG,WAAW,G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a,EACtE,OAAO,EAAE,CAAC,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,aAAa,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAkD/G;;;;;;;;;OASG;IACG,WAAW,CAAC,QAAQ,EAAE,mBAAmB,EAAE,OAAO,EAAE,gBAAgB,GAAG,SAAS,GAAG,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;CAavH"}
@@ -155,7 +155,9 @@ export class SourceRevocations {
155
155
  context(id) { return JSON.stringify(['SourceRevocations', this.t.prefix, id]); }
156
156
  /**
157
157
  * Combine with fresh host account liveness in the sync store's active binding. False while a stop's purge is
158
- * pending for the owner and, for good, once the owner was deleted; it does not authenticate an account.
158
+ * pending for the owner and, for good, once the owner was deleted: `removeOwner` keeps the owner's block marker,
159
+ * recorded as deleted and no longer pending, so it stays false after the owner's rows are removed. It does not
160
+ * authenticate an account.
159
161
  */
160
162
  async permits(tx, scope) {
161
163
  const row = await tx.get(`SELECT pending,deleted FROM ${this.t.blocks}
@@ -291,7 +293,8 @@ export class SourceRevocations {
291
293
  /**
292
294
  * Account deletion: blocks the owner for good and stops every connection of the owner, queueing each grant for
293
295
  * revocation, in one transaction, also when the owner has no connection; then purges them. Call it before the host
294
- * removes any source, credential or account row. Queued revocations outlive the account.
296
+ * removes any source, credential or account row. Queued revocations outlive the account, and the block marker
297
+ * outlives `removeOwner`: it stays recorded as deleted, no longer pending, so `permits` stays false.
295
298
  */
296
299
  async deleteOwner(scope) {
297
300
  await this.stored(async () => {
@@ -592,6 +595,87 @@ export class SourceRevocations {
592
595
  return (exchanges.changes ?? 0) + (changed.changes ?? 0);
593
596
  });
594
597
  }
598
+ /**
599
+ * Removes a deleted owner's rows in one transaction once nothing about them is pending: from the store, each of its
600
+ * connections with their work rows, retained-source provenance and exclusions (`SqlAccountSourceSyncStore.removeOwner`),
601
+ * and from these tables its stop intents, the revoke-only queue rows they and its exchanges refer to, its grant leases
602
+ * and its exchanges. It waits while the deletion's purge is pending, while a revocation of one of its grants is
603
+ * pending, and until a day after its last exchange ended: a grant can still come back for that exchange and must find
604
+ * its record to be queued for revocation. The owner's block marker stays, recording the deletion, so `permits` and
605
+ * `canConnect` stay false and the owner is refused for good, even while the host's account row still reads active.
606
+ * The core fence's owner row and its deletion records stay too.
607
+ *
608
+ * @returns `removed`, `pending` or `not_deleted`, as `SourceOwnerRemoval` describes.
609
+ * @throws {SourceSyncFault} `storage_unavailable` when the store fails.
610
+ */
611
+ async removeOwner(scope) {
612
+ return this.stored(async () => {
613
+ // The deletion is recorded for good, so it is read before the store's locks and read again under them.
614
+ const recorded = await this.db.get(`SELECT deleted FROM ${this.t.blocks}
615
+ WHERE tenant_id=$1 AND owner_id=$2`, ownerFields(scope));
616
+ if (!recorded?.deleted)
617
+ return 'not_deleted';
618
+ const outcome = { unrecorded: false, rows: 0 };
619
+ const removed = await this.store.removeOwner(scope, async (tx) => {
620
+ const block = await tx.get(`SELECT pending,deleted FROM ${this.t.blocks}
621
+ WHERE tenant_id=$1 AND owner_id=$2 FOR UPDATE`, ownerFields(scope));
622
+ if (!block?.deleted) {
623
+ outcome.unrecorded = true;
624
+ return false;
625
+ }
626
+ if (block.pending || await tx.get(`SELECT 1 FROM ${this.t.intents}
627
+ WHERE tenant_id=$1 AND owner_id=$2 AND purged=FALSE LIMIT 1`, ownerFields(scope)))
628
+ return false;
629
+ if (await tx.get(`SELECT 1 FROM ${this.t.exchanges} WHERE tenant_id=$1 AND owner_id=$2 AND ends_at>=$3 LIMIT 1`, [...ownerFields(scope), this.now() - 86_400_000]))
630
+ return false;
631
+ const queued = await tx.all(`SELECT id,state FROM ${this.t.queue}
632
+ WHERE id IN (SELECT queue_id FROM ${this.t.intents} WHERE tenant_id=$1 AND owner_id=$2
633
+ UNION SELECT queue_id FROM ${this.t.exchanges} WHERE tenant_id=$1 AND owner_id=$2) FOR UPDATE`, ownerFields(scope));
634
+ if (queued.some((row) => row.state === 'pending'))
635
+ return false;
636
+ outcome.rows += (await tx.run(`DELETE FROM ${this.t.queue} WHERE id=ANY($1::text[]) AND state<>'pending'`, [queued.map((row) => row.id)])).changes ?? 0;
637
+ for (const table of [this.t.intents, this.t.exchanges, this.t.grants]) {
638
+ outcome.rows += (await tx.run(`DELETE FROM ${table} WHERE tenant_id=$1 AND owner_id=$2`, ownerFields(scope))).changes ?? 0;
639
+ }
640
+ return true;
641
+ });
642
+ if (removed && outcome.rows > 0)
643
+ this.emit('removed');
644
+ return removed ? 'removed' : outcome.unrecorded ? 'not_deleted' : 'pending';
645
+ });
646
+ }
647
+ /**
648
+ * Removes, as `removeOwner` does, the rows of at most `limit` deleted owners a call: those with rows left to remove
649
+ * and nothing pending, the first by key, for a host whose own records of a deleted account are gone. Run it on a
650
+ * schedule beside `revokeBatch` and `compact`; an owner whose purge, revocation or exchange is not over waits for a
651
+ * later call, and an owner already removed is not taken again.
652
+ *
653
+ * @param limit - At most this many owners, an integer from 1 to 1,000.
654
+ * @returns How many owners' rows were removed.
655
+ * @throws {SourceSyncFault} `invalid_response` for another limit and `storage_unavailable` when the store fails.
656
+ */
657
+ async removeDeletedOwners(limit = 100) {
658
+ if (!Number.isInteger(limit) || limit < 1 || limit > 1000)
659
+ throw new SourceSyncFault('invalid_response');
660
+ return this.stored(async () => {
661
+ const owners = await this.db.all(`SELECT b.tenant_id,b.owner_id
662
+ FROM ${this.t.blocks} b WHERE b.deleted AND NOT b.pending
663
+ AND (EXISTS(SELECT 1 FROM ${this.t.intents} i WHERE i.tenant_id=b.tenant_id AND i.owner_id=b.owner_id)
664
+ OR EXISTS(SELECT 1 FROM ${this.t.exchanges} e WHERE e.tenant_id=b.tenant_id AND e.owner_id=b.owner_id)
665
+ OR EXISTS(SELECT 1 FROM ${this.t.grants} g WHERE g.tenant_id=b.tenant_id AND g.owner_id=b.owner_id))
666
+ AND NOT EXISTS(SELECT 1 FROM ${this.t.intents} i LEFT JOIN ${this.t.queue} q ON q.id=i.queue_id
667
+ WHERE i.tenant_id=b.tenant_id AND i.owner_id=b.owner_id AND (NOT i.purged OR q.state='pending'))
668
+ AND NOT EXISTS(SELECT 1 FROM ${this.t.exchanges} e LEFT JOIN ${this.t.queue} q ON q.id=e.queue_id
669
+ WHERE e.tenant_id=b.tenant_id AND e.owner_id=b.owner_id AND (e.ends_at>=$1 OR q.state='pending'))
670
+ ORDER BY b.tenant_id,b.owner_id LIMIT $2`, [this.now() - 86_400_000, limit]);
671
+ let removed = 0;
672
+ for (const row of owners) {
673
+ if (await this.removeOwner({ tenantId: row.tenant_id, ownerId: row.owner_id }) === 'removed')
674
+ removed++;
675
+ }
676
+ return removed;
677
+ });
678
+ }
595
679
  /** Records exchanges whose deadline passed with no grant returned as unconfirmed: their outcome is unknown. */
596
680
  async lapseExchanges() {
597
681
  const now = this.now();