@substrat-run/kernel 0.149.0 → 0.151.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/attachment-sweep.d.ts +75 -2
- package/dist/attachment-sweep.d.ts.map +1 -1
- package/dist/attachment-sweep.js +164 -2
- package/dist/attachment-sweep.js.map +1 -1
- package/dist/check-tally.d.ts +89 -0
- package/dist/check-tally.d.ts.map +1 -0
- package/dist/check-tally.js +48 -0
- package/dist/check-tally.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/module-operations.d.ts +20 -1
- package/dist/module-operations.d.ts.map +1 -1
- package/dist/module-operations.js +61 -2
- package/dist/module-operations.js.map +1 -1
- package/dist/platform-sweep.d.ts +26 -5
- package/dist/platform-sweep.d.ts.map +1 -1
- package/dist/platform-sweep.js +16 -4
- package/dist/platform-sweep.js.map +1 -1
- package/dist/testing.d.ts +1 -0
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +4 -1
- package/dist/testing.js.map +1 -1
- package/package.json +3 -3
|
@@ -37,7 +37,9 @@ import type { ScopedSql, TenantBlobStore } from './scope-host.js';
|
|
|
37
37
|
* The instant a pass judges age and the fence against is the HOST's clock, never a caller's
|
|
38
38
|
* (`OrphanSweepRequest` carries none), so no caller can step past guard 2 or guard 3.
|
|
39
39
|
*
|
|
40
|
-
* A dry run condemns nothing and deletes nothing: it reports what a pass would condemn
|
|
40
|
+
* A dry run condemns nothing and deletes nothing: it reports what a pass would condemn, and the
|
|
41
|
+
* scope records that as its licence (#2350). A destructive pass needs one in force, and deletes only
|
|
42
|
+
* what it lists (`ATTACHMENT_SWEEP_LICENCE_DDL`).
|
|
41
43
|
*/
|
|
42
44
|
/** The tombstone table, shared by both adapters so the two cannot part company. */
|
|
43
45
|
export declare const ATTACHMENT_CONDEMNED_DDL = "\n CREATE TABLE IF NOT EXISTS _substrat_attachment_condemned (\n -- The attachment id whose object the sweep deleted, or is about to. No row may ever be\n -- inserted for it again: the insert path refuses it (#2314).\n id TEXT PRIMARY KEY,\n condemned_at TEXT NOT NULL\n );\n";
|
|
@@ -92,6 +94,60 @@ export declare function rowlessAttachmentIds(sql: ScopedSql, ids: readonly strin
|
|
|
92
94
|
* tombstone of an id this pass is about to delete.
|
|
93
95
|
*/
|
|
94
96
|
export declare function condemnOrphanAttachments(sql: ScopedSql, ids: readonly string[], now: string): string[];
|
|
97
|
+
/**
|
|
98
|
+
* The dry-run-first licence (#2350), held by the scope's own storage so the rule holds whoever asks
|
|
99
|
+
* for a pass: one row per attachment id the scope's last dry run listed, stamped with the host's
|
|
100
|
+
* clock at that run. A destructive pass is refused without one in force
|
|
101
|
+
* (`refuseUnlicensedOrphanSweep`), condemns only ids it lists (`condemnLicensedOrphanAttachments`),
|
|
102
|
+
* and takes each id it deleted out of it (`consumeOrphanSweepLicence`).
|
|
103
|
+
*
|
|
104
|
+
* It only ever NARROWS what a pass may delete: every guard of the pass still runs on the ids it
|
|
105
|
+
* lists. So a licence that a rewind brought back, or that outlived the rows it was judged against,
|
|
106
|
+
* can permit nothing the pass would not permit without it. A dump never carries its rows and every
|
|
107
|
+
* load drops them, so a restore, a carry or a fork leaves the next pass a dry run.
|
|
108
|
+
*/
|
|
109
|
+
export declare const ATTACHMENT_SWEEP_LICENCE_DDL = "\n CREATE TABLE IF NOT EXISTS _substrat_attachment_sweep_licence (\n -- An attachment id the scope's last orphan-sweep dry run listed, and that no destructive\n -- pass has deleted since (#2350). Store-local: never dumped, and cleared by every load.\n id TEXT PRIMARY KEY,\n licensed_at TEXT NOT NULL\n );\n";
|
|
110
|
+
/** The licence table's name, for the dump export that leaves its rows out and the load that drops them. */
|
|
111
|
+
export declare const ATTACHMENT_SWEEP_LICENCE_TABLE = "_substrat_attachment_sweep_licence";
|
|
112
|
+
/** The refusal reason a destructive pass meets when the scope holds no dry-run licence in force. */
|
|
113
|
+
export declare const ORPHAN_SWEEP_UNLICENSED = "orphan_sweep_unlicensed";
|
|
114
|
+
/** How long a scope's dry-run licence stays in force, judged against the host's clock: seven days. */
|
|
115
|
+
export declare const ORPHAN_SWEEP_DRY_RUN_WINDOW_MS: number;
|
|
116
|
+
/** The most ids one licence holds. A dry run that lists more licenses its first this many. */
|
|
117
|
+
export declare const ORPHAN_SWEEP_LICENCE_CAP = 1000;
|
|
118
|
+
/**
|
|
119
|
+
* When the scope's licence was recorded, if it holds one in force at `now`, else null. A licence
|
|
120
|
+
* stamped more than a minute later than `now` (a clock that went back) is not in force: the next
|
|
121
|
+
* pass is a dry run.
|
|
122
|
+
*/
|
|
123
|
+
export declare function orphanSweepLicensedAt(sql: ScopedSql, now: string): string | null;
|
|
124
|
+
/** Refuse a destructive pass over a scope that holds no dry-run licence in force at `now`. */
|
|
125
|
+
export declare function refuseUnlicensedOrphanSweep(sql: ScopedSql, now: string): void;
|
|
126
|
+
/**
|
|
127
|
+
* Record what a dry run found as the scope's licence, inside the caller's scope transaction: the
|
|
128
|
+
* first `ORPHAN_SWEEP_LICENCE_CAP` of `ids`, stamped `now`. Writes only when that set differs from
|
|
129
|
+
* the one held, or the one held is older than half the window, so a dry run that keeps finding the
|
|
130
|
+
* same orphans moves no write revision (a carry and a kept-copy release are fenced on it). An empty
|
|
131
|
+
* set clears a held licence, and writes nothing when there is none. Returns whether it wrote.
|
|
132
|
+
*/
|
|
133
|
+
export declare function recordOrphanSweepLicence(sql: ScopedSql, ids: readonly string[], now: string): boolean;
|
|
134
|
+
/**
|
|
135
|
+
* `condemnOrphanAttachments` over only the ids in `ids` the scope's licence lists, while it is in
|
|
136
|
+
* force at `now`: a destructive pass deletes nothing its dry run did not list. Inside the caller's
|
|
137
|
+
* scope transaction, so a load that dropped the licence meanwhile leaves nothing to condemn.
|
|
138
|
+
*/
|
|
139
|
+
export declare function condemnLicensedOrphanAttachments(sql: ScopedSql, ids: readonly string[], now: string): string[];
|
|
140
|
+
/** The ids the scope's licence lists, held or expired: at most `ORPHAN_SWEEP_LICENCE_CAP`. */
|
|
141
|
+
export declare function licensedOrphanIds(sql: ScopedSql): string[];
|
|
142
|
+
/**
|
|
143
|
+
* Take ids out of the licence: the ones a destructive pass deleted, and the ones whose objects are
|
|
144
|
+
* gone some other way, so its next pass in the window goes on with the ids it has not reached and
|
|
145
|
+
* never back to what is gone. A licence left with nothing is no licence, so the next destructive
|
|
146
|
+
* pass is refused and the scope is dry-run again. Writes only when one of `ids` is held.
|
|
147
|
+
*/
|
|
148
|
+
export declare function consumeOrphanSweepLicence(sql: ScopedSql, ids: readonly string[]): void;
|
|
149
|
+
/** Drop the whole licence: every dump load does, so a restored, carried or forked store starts with none. */
|
|
150
|
+
export declare function clearOrphanSweepLicence(sql: ScopedSql): void;
|
|
95
151
|
/**
|
|
96
152
|
* The copy-ledger states (#1722) in which another script's copy of a scope can no longer hold a
|
|
97
153
|
* row the serving copy lacks, nor discover one. An ALLOWLIST: every other state, a future one
|
|
@@ -185,6 +241,13 @@ export interface OrphanSweepReport {
|
|
|
185
241
|
keys: string[];
|
|
186
242
|
/** Set when the restore fence held the pass: the instant until which it holds. */
|
|
187
243
|
fencedUntil?: string;
|
|
244
|
+
/**
|
|
245
|
+
* Set when a destructive pass could not bring the scope's dry-run licence up to date afterwards
|
|
246
|
+
* (#2350): take out what it deleted, and what is gone some other way. Any deletes stand and `keys`
|
|
247
|
+
* names them. The licence keeps rows for ids that are gone, which license nothing a pass could
|
|
248
|
+
* delete, and which the next pass that settles the licence takes out.
|
|
249
|
+
*/
|
|
250
|
+
consumeFailed?: true;
|
|
188
251
|
dryRun: boolean;
|
|
189
252
|
/**
|
|
190
253
|
* `'none'` when the deployment holds no attachment store for the tenant at all, so nothing was
|
|
@@ -193,10 +256,20 @@ export interface OrphanSweepReport {
|
|
|
193
256
|
*/
|
|
194
257
|
bucket?: 'none';
|
|
195
258
|
}
|
|
196
|
-
/**
|
|
259
|
+
/**
|
|
260
|
+
* What the scope side of a pass is: the read for a dry run, and the licence it records; the
|
|
261
|
+
* licensed condemnation otherwise, and the consumption of the licence by what was deleted.
|
|
262
|
+
*/
|
|
197
263
|
export interface OrphanSweepScope {
|
|
198
264
|
rowless(ids: readonly string[]): Promise<string[]>;
|
|
265
|
+
/** Condemn the ids the scope's licence lists (`condemnLicensedOrphanAttachments`). */
|
|
199
266
|
condemn(ids: readonly string[], now: string): Promise<string[]>;
|
|
267
|
+
/** Record what a dry run found as the scope's licence (`recordOrphanSweepLicence`). */
|
|
268
|
+
license(ids: readonly string[], now: string): Promise<void>;
|
|
269
|
+
/** The ids the scope's licence lists (`licensedOrphanIds`). */
|
|
270
|
+
licensed(): Promise<string[]>;
|
|
271
|
+
/** Take ids out of the licence (`consumeOrphanSweepLicence`). */
|
|
272
|
+
consume(ids: readonly string[]): Promise<void>;
|
|
200
273
|
}
|
|
201
274
|
/**
|
|
202
275
|
* One pass over one scope's attachment bytes. The host supplies the store and the scope side;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment-sweep.d.ts","sourceRoot":"","sources":["../src/attachment-sweep.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"attachment-sweep.d.ts","sourceRoot":"","sources":["../src/attachment-sweep.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AASlE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,mFAAmF;AACnF,eAAO,MAAM,wBAAwB,sSAOpC,CAAC;AAEF,gGAAgG;AAChG,eAAO,MAAM,oBAAoB,yBAAyB,CAAC;AAE3D,mFAAmF;AACnF,eAAO,MAAM,qBAAqB,QAAiB,CAAC;AAEpD;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,QAAkB,CAAC;AAErD,qDAAqD;AACrD,eAAO,MAA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AAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACnD,sFAAsF;IACtF,OAAO,CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAChE,uFAAuF;IACvF,OAAO,CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5D,+DAA+D;IAC/D,QAAQ,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC9B,iEAAiE;IACjE,OAAO,CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChD;AAOD;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,eAAe,EACtB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,gBAAgB,EACvB,IAAI,EAAE,kBAAkB,GACvB,OAAO,CAAC,iBAAiB,CAAC,CAmG5B"}
|
package/dist/attachment-sweep.js
CHANGED
|
@@ -39,7 +39,9 @@ import { ulidTime } from './ulid.js';
|
|
|
39
39
|
* The instant a pass judges age and the fence against is the HOST's clock, never a caller's
|
|
40
40
|
* (`OrphanSweepRequest` carries none), so no caller can step past guard 2 or guard 3.
|
|
41
41
|
*
|
|
42
|
-
* A dry run condemns nothing and deletes nothing: it reports what a pass would condemn
|
|
42
|
+
* A dry run condemns nothing and deletes nothing: it reports what a pass would condemn, and the
|
|
43
|
+
* scope records that as its licence (#2350). A destructive pass needs one in force, and deletes only
|
|
44
|
+
* what it lists (`ATTACHMENT_SWEEP_LICENCE_DDL`).
|
|
43
45
|
*/
|
|
44
46
|
/** The tombstone table, shared by both adapters so the two cannot part company. */
|
|
45
47
|
export const ATTACHMENT_CONDEMNED_DDL = `
|
|
@@ -151,6 +153,132 @@ export function condemnOrphanAttachments(sql, ids, now) {
|
|
|
151
153
|
}
|
|
152
154
|
return rowless;
|
|
153
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* The dry-run-first licence (#2350), held by the scope's own storage so the rule holds whoever asks
|
|
158
|
+
* for a pass: one row per attachment id the scope's last dry run listed, stamped with the host's
|
|
159
|
+
* clock at that run. A destructive pass is refused without one in force
|
|
160
|
+
* (`refuseUnlicensedOrphanSweep`), condemns only ids it lists (`condemnLicensedOrphanAttachments`),
|
|
161
|
+
* and takes each id it deleted out of it (`consumeOrphanSweepLicence`).
|
|
162
|
+
*
|
|
163
|
+
* It only ever NARROWS what a pass may delete: every guard of the pass still runs on the ids it
|
|
164
|
+
* lists. So a licence that a rewind brought back, or that outlived the rows it was judged against,
|
|
165
|
+
* can permit nothing the pass would not permit without it. A dump never carries its rows and every
|
|
166
|
+
* load drops them, so a restore, a carry or a fork leaves the next pass a dry run.
|
|
167
|
+
*/
|
|
168
|
+
export const ATTACHMENT_SWEEP_LICENCE_DDL = `
|
|
169
|
+
CREATE TABLE IF NOT EXISTS _substrat_attachment_sweep_licence (
|
|
170
|
+
-- An attachment id the scope's last orphan-sweep dry run listed, and that no destructive
|
|
171
|
+
-- pass has deleted since (#2350). Store-local: never dumped, and cleared by every load.
|
|
172
|
+
id TEXT PRIMARY KEY,
|
|
173
|
+
licensed_at TEXT NOT NULL
|
|
174
|
+
);
|
|
175
|
+
`;
|
|
176
|
+
/** The licence table's name, for the dump export that leaves its rows out and the load that drops them. */
|
|
177
|
+
export const ATTACHMENT_SWEEP_LICENCE_TABLE = '_substrat_attachment_sweep_licence';
|
|
178
|
+
/** The refusal reason a destructive pass meets when the scope holds no dry-run licence in force. */
|
|
179
|
+
export const ORPHAN_SWEEP_UNLICENSED = 'orphan_sweep_unlicensed';
|
|
180
|
+
/** How long a scope's dry-run licence stays in force, judged against the host's clock: seven days. */
|
|
181
|
+
export const ORPHAN_SWEEP_DRY_RUN_WINDOW_MS = 7 * 86_400_000;
|
|
182
|
+
/** The most ids one licence holds. A dry run that lists more licenses its first this many. */
|
|
183
|
+
export const ORPHAN_SWEEP_LICENCE_CAP = 1000;
|
|
184
|
+
/**
|
|
185
|
+
* How far past `now` a licence's stamp may read and still be in force: the jitter between two
|
|
186
|
+
* reads of a host's clock. Beyond it the clock went back, and the licence is not in force.
|
|
187
|
+
*/
|
|
188
|
+
const LICENCE_SKEW_MS = 60_000;
|
|
189
|
+
const hasLicenceTable = (sql) => sql.query(`SELECT 1 AS hit FROM sqlite_master WHERE type = 'table' AND name = '_substrat_attachment_sweep_licence'`).length > 0;
|
|
190
|
+
/**
|
|
191
|
+
* When the scope's licence was recorded, if it holds one in force at `now`, else null. A licence
|
|
192
|
+
* stamped more than a minute later than `now` (a clock that went back) is not in force: the next
|
|
193
|
+
* pass is a dry run.
|
|
194
|
+
*/
|
|
195
|
+
export function orphanSweepLicensedAt(sql, now) {
|
|
196
|
+
if (!hasLicenceTable(sql))
|
|
197
|
+
return null;
|
|
198
|
+
const [row] = sql.query(`SELECT MIN(licensed_at) AS at FROM _substrat_attachment_sweep_licence`);
|
|
199
|
+
const at = row?.at ?? null;
|
|
200
|
+
if (at === null)
|
|
201
|
+
return null;
|
|
202
|
+
const atMs = Date.parse(at);
|
|
203
|
+
const nowMs = Date.parse(now);
|
|
204
|
+
if (!Number.isFinite(atMs) || atMs > nowMs + LICENCE_SKEW_MS || nowMs - atMs > ORPHAN_SWEEP_DRY_RUN_WINDOW_MS)
|
|
205
|
+
return null;
|
|
206
|
+
return at;
|
|
207
|
+
}
|
|
208
|
+
/** Refuse a destructive pass over a scope that holds no dry-run licence in force at `now`. */
|
|
209
|
+
export function refuseUnlicensedOrphanSweep(sql, now) {
|
|
210
|
+
if (orphanSweepLicensedAt(sql, now) !== null)
|
|
211
|
+
return;
|
|
212
|
+
throw substratError('conflict', `refused: this scope holds no orphan-sweep dry run from the last ` +
|
|
213
|
+
`${ORPHAN_SWEEP_DRY_RUN_WINDOW_MS / 86_400_000} days, so a destructive pass has nothing it may delete. Run a dry run first`, { reason: ORPHAN_SWEEP_UNLICENSED });
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Record what a dry run found as the scope's licence, inside the caller's scope transaction: the
|
|
217
|
+
* first `ORPHAN_SWEEP_LICENCE_CAP` of `ids`, stamped `now`. Writes only when that set differs from
|
|
218
|
+
* the one held, or the one held is older than half the window, so a dry run that keeps finding the
|
|
219
|
+
* same orphans moves no write revision (a carry and a kept-copy release are fenced on it). An empty
|
|
220
|
+
* set clears a held licence, and writes nothing when there is none. Returns whether it wrote.
|
|
221
|
+
*/
|
|
222
|
+
export function recordOrphanSweepLicence(sql, ids, now) {
|
|
223
|
+
const next = [...new Set(ids)].slice(0, ORPHAN_SWEEP_LICENCE_CAP);
|
|
224
|
+
const held = sql.query(`SELECT id, licensed_at FROM _substrat_attachment_sweep_licence`);
|
|
225
|
+
if (held.length === 0 && next.length === 0)
|
|
226
|
+
return false;
|
|
227
|
+
if (held.length === next.length && held.length > 0) {
|
|
228
|
+
const heldIds = new Set(held.map((r) => r.id));
|
|
229
|
+
const oldest = Math.min(...held.map((r) => Date.parse(r.licensed_at)));
|
|
230
|
+
const age = Date.parse(now) - oldest;
|
|
231
|
+
const fresh = Number.isFinite(age) && age >= -LICENCE_SKEW_MS && age <= ORPHAN_SWEEP_DRY_RUN_WINDOW_MS / 2;
|
|
232
|
+
if (fresh && next.every((id) => heldIds.has(id)))
|
|
233
|
+
return false;
|
|
234
|
+
}
|
|
235
|
+
sql.exec(`DELETE FROM _substrat_attachment_sweep_licence`);
|
|
236
|
+
if (next.length > 0) {
|
|
237
|
+
sql.exec(`INSERT INTO _substrat_attachment_sweep_licence (id, licensed_at) SELECT value, ? FROM json_each(?)`, [now, JSON.stringify(next)]);
|
|
238
|
+
}
|
|
239
|
+
return true;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* `condemnOrphanAttachments` over only the ids in `ids` the scope's licence lists, while it is in
|
|
243
|
+
* force at `now`: a destructive pass deletes nothing its dry run did not list. Inside the caller's
|
|
244
|
+
* scope transaction, so a load that dropped the licence meanwhile leaves nothing to condemn.
|
|
245
|
+
*/
|
|
246
|
+
export function condemnLicensedOrphanAttachments(sql, ids, now) {
|
|
247
|
+
if (ids.length === 0 || orphanSweepLicensedAt(sql, now) === null)
|
|
248
|
+
return [];
|
|
249
|
+
const licensed = sql
|
|
250
|
+
.query(`SELECT j.value AS value FROM json_each(?) AS j
|
|
251
|
+
WHERE EXISTS (SELECT 1 FROM _substrat_attachment_sweep_licence l WHERE l.id = j.value)
|
|
252
|
+
ORDER BY j.value`, [JSON.stringify(ids)])
|
|
253
|
+
.map((r) => r.value);
|
|
254
|
+
return condemnOrphanAttachments(sql, licensed, now);
|
|
255
|
+
}
|
|
256
|
+
/** The ids the scope's licence lists, held or expired: at most `ORPHAN_SWEEP_LICENCE_CAP`. */
|
|
257
|
+
export function licensedOrphanIds(sql) {
|
|
258
|
+
if (!hasLicenceTable(sql))
|
|
259
|
+
return [];
|
|
260
|
+
return sql.query(`SELECT id FROM _substrat_attachment_sweep_licence ORDER BY id`).map((r) => r.id);
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Take ids out of the licence: the ones a destructive pass deleted, and the ones whose objects are
|
|
264
|
+
* gone some other way, so its next pass in the window goes on with the ids it has not reached and
|
|
265
|
+
* never back to what is gone. A licence left with nothing is no licence, so the next destructive
|
|
266
|
+
* pass is refused and the scope is dry-run again. Writes only when one of `ids` is held.
|
|
267
|
+
*/
|
|
268
|
+
export function consumeOrphanSweepLicence(sql, ids) {
|
|
269
|
+
if (ids.length === 0 || !hasLicenceTable(sql))
|
|
270
|
+
return;
|
|
271
|
+
const json = JSON.stringify(ids);
|
|
272
|
+
const held = sql.query(`SELECT 1 AS hit FROM _substrat_attachment_sweep_licence WHERE id IN (SELECT value FROM json_each(?)) LIMIT 1`, [json]);
|
|
273
|
+
if (held.length === 0)
|
|
274
|
+
return;
|
|
275
|
+
sql.exec(`DELETE FROM _substrat_attachment_sweep_licence WHERE id IN (SELECT value FROM json_each(?))`, [json]);
|
|
276
|
+
}
|
|
277
|
+
/** Drop the whole licence: every dump load does, so a restored, carried or forked store starts with none. */
|
|
278
|
+
export function clearOrphanSweepLicence(sql) {
|
|
279
|
+
if (hasLicenceTable(sql))
|
|
280
|
+
sql.exec(`DELETE FROM _substrat_attachment_sweep_licence`);
|
|
281
|
+
}
|
|
154
282
|
/**
|
|
155
283
|
* The copy-ledger states (#1722) in which another script's copy of a scope can no longer hold a
|
|
156
284
|
* row the serving copy lacks, nor discover one. An ALLOWLIST: every other state, a future one
|
|
@@ -286,6 +414,8 @@ export async function sweepOrphanAttachments(store, scopeId, scope, opts) {
|
|
|
286
414
|
candidates.push(id);
|
|
287
415
|
}
|
|
288
416
|
report.candidates = candidates.length;
|
|
417
|
+
// Every id this scope's prefix still holds, whatever its age: a licensed id not among them is gone.
|
|
418
|
+
const present = new Set(keys.map((key) => key.slice(prefix.length)));
|
|
289
419
|
const orphans = [];
|
|
290
420
|
for (let i = 0; i < candidates.length && orphans.length < limit; i += ORPHAN_CONDEMN_BATCH) {
|
|
291
421
|
const batch = candidates.slice(i, i + ORPHAN_CONDEMN_BATCH);
|
|
@@ -300,19 +430,51 @@ export async function sweepOrphanAttachments(store, scopeId, scope, opts) {
|
|
|
300
430
|
const doomed = orphans.slice(0, limit);
|
|
301
431
|
if (dryRun) {
|
|
302
432
|
report.keys = doomed.map((id) => attachmentBlobKey(scopeId, id));
|
|
433
|
+
// The licence a destructive pass needs (#2350): what this run listed, nothing more.
|
|
434
|
+
await scope.license(doomed, opts.now);
|
|
303
435
|
return report;
|
|
304
436
|
}
|
|
305
|
-
|
|
437
|
+
/**
|
|
438
|
+
* Bring the licence up to date once the pass is done (#2350): take out the ids it deleted, so a
|
|
439
|
+
* backlog past `limit` drains over the next passes in the window, and every licensed id whose
|
|
440
|
+
* object is gone some other way, so a licence that lists nothing deletable does not hold the
|
|
441
|
+
* scope away from its next dry run until it expires. Taking ids out only narrows the licence.
|
|
442
|
+
*
|
|
443
|
+
* The bytes may be gone by now, so a failure here (the scope suspended or carried away mid-pass)
|
|
444
|
+
* must not cost the report: it is the only record of which keys were deleted. A licence row left
|
|
445
|
+
* for a gone id licenses nothing a pass could delete.
|
|
446
|
+
*/
|
|
447
|
+
const settleLicence = async (gone) => {
|
|
448
|
+
try {
|
|
449
|
+
const stale = (await scope.licensed()).filter((id) => !present.has(id));
|
|
450
|
+
const drop = [...gone, ...stale];
|
|
451
|
+
if (drop.length > 0)
|
|
452
|
+
await scope.consume(drop);
|
|
453
|
+
}
|
|
454
|
+
catch (err) {
|
|
455
|
+
report.consumeFailed = true;
|
|
456
|
+
console.error(`orphan-attachment sweep: scope ${scopeId} deleted ${report.deleted} object(s) but could not bring its ` +
|
|
457
|
+
`dry-run licence up to date (${err instanceof Error ? err.name : 'Error'}); the report names the deleted keys`);
|
|
458
|
+
}
|
|
459
|
+
};
|
|
460
|
+
if (doomed.length === 0) {
|
|
461
|
+
await settleLicence([]);
|
|
306
462
|
return report;
|
|
463
|
+
}
|
|
307
464
|
// Guard 3 again, after the condemnation: a rewind that armed mid-pass wrote its fence first.
|
|
308
465
|
if (await fenced())
|
|
309
466
|
return report;
|
|
467
|
+
const gone = [];
|
|
310
468
|
for (const id of doomed) {
|
|
311
469
|
const key = attachmentBlobKey(scopeId, id);
|
|
312
470
|
await store.delete(key);
|
|
471
|
+
gone.push(id);
|
|
313
472
|
report.keys.push(key);
|
|
314
473
|
report.deleted++;
|
|
315
474
|
}
|
|
475
|
+
// A delete that throws ends the pass before this, so every id stays licensed and condemned, and
|
|
476
|
+
// the next pass deletes them again (a delete of what is gone is a no-op).
|
|
477
|
+
await settleLicence(gone);
|
|
316
478
|
return report;
|
|
317
479
|
}
|
|
318
480
|
//# sourceMappingURL=attachment-sweep.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment-sweep.js","sourceRoot":"","sources":["../src/attachment-sweep.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MA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 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Did the operation ask? (#2387)
|
|
3
|
+
*
|
|
4
|
+
* Every operation checks a permission: its first line is `assertAllowed(await ctx.check(PERM))`.
|
|
5
|
+
* The gates around that rule read declarations — `lint:permissions` the surface,
|
|
6
|
+
* `entityCheckConformanceSuite` an operation that declares `{ key, entity, idFrom }`. None of them
|
|
7
|
+
* sees an operation that declares a bare scope-wide key and whose handler checks nothing, because
|
|
8
|
+
* no declaration tells it apart from a correct one, and a static read of the handler cannot
|
|
9
|
+
* follow the check into the helper it usually delegates to.
|
|
10
|
+
*
|
|
11
|
+
* The host can see it directly. It builds one context per invocation, and every check goes
|
|
12
|
+
* through that context's `check`. So each adapter counts the calls on it ({@link countChecks}),
|
|
13
|
+
* and when the handler returns having made none, the host writes a line saying so
|
|
14
|
+
* ({@link noteUncheckedCompletion}).
|
|
15
|
+
*
|
|
16
|
+
* ## What counts as a check
|
|
17
|
+
*
|
|
18
|
+
* A CALL, not a pass. A refused check counts, so does one the handler caught, and so does one
|
|
19
|
+
* that threw (a malformed key): each is the operation asking, which is the whole question. A
|
|
20
|
+
* check made inside a helper, an engine function or a kernel verb (`ctx.grant` re-checks the
|
|
21
|
+
* caller's own decision, `ctx.archive` checks the declared key) counts too, because it went
|
|
22
|
+
* through the same `ctx.check`.
|
|
23
|
+
*
|
|
24
|
+
* Only checks made while the HANDLER runs count: each adapter resets the tally just before it
|
|
25
|
+
* calls the handler. A guard (K-17) runs on the same context first, and may ask any key it likes
|
|
26
|
+
* without asserting it, so its check says nothing about the handler. The host's trashed-target
|
|
27
|
+
* refusal also checks before the handler, but it always ends the invocation when it does, so the
|
|
28
|
+
* handler never runs behind it.
|
|
29
|
+
*
|
|
30
|
+
* The tally is the context's, and a context belongs to one invocation, so two invocations in one
|
|
31
|
+
* request are counted apart.
|
|
32
|
+
*
|
|
33
|
+
* ## Which operations are held to it
|
|
34
|
+
*
|
|
35
|
+
* Those that declare a `permission` and whose handler is authored (`checkHeldOperationsOf`): a
|
|
36
|
+
* declared key is a promise that the handler asks for it. Left out, each for a reason the
|
|
37
|
+
* declaration states:
|
|
38
|
+
*
|
|
39
|
+
* - a **derived** handler (#1773) — the kernel wrote it from the declaration, check included;
|
|
40
|
+
* - a **`narrows`** walk — it checks row by row, so a walk over nothing asks nothing and is right
|
|
41
|
+
* to. `narrows: { reason, checks: [], unchecked: true }` is the one way to declare an operation
|
|
42
|
+
* that checks nothing at all; the reason is required and the conformance receipt lists it;
|
|
43
|
+
* - a module bound with **`undeclaredOperations`** — it declares no key, so it promised none.
|
|
44
|
+
*
|
|
45
|
+
* ## Recorded, and refused only where a test asks
|
|
46
|
+
*
|
|
47
|
+
* The line is a `warn` through the context's own `ctx.log`, so it carries the tenant, scope,
|
|
48
|
+
* operation and invocation every other line does and lands wherever the host sends them. Its
|
|
49
|
+
* template is a constant, so every such line groups into one pattern. In production that is all
|
|
50
|
+
* it does: no error, no rollback.
|
|
51
|
+
*
|
|
52
|
+
* A node test run can turn it into a refusal: `tools/vitest/unchecked-operations.cjs`, preloaded
|
|
53
|
+
* by the root `pnpm test` and CI's test step beside the LIKE and SQL-limit preloads, sets
|
|
54
|
+
* {@link REFUSE_UNCHECKED_OPERATIONS_KEY}, and the operation then throws {@link UncheckedOperation}
|
|
55
|
+
* after the line is written, so it rolls back like any other failure. That makes every scenario
|
|
56
|
+
* suite the gate, without a production scope failing over a diagnostic.
|
|
57
|
+
*/
|
|
58
|
+
import type { OperationContext } from './scope-host.js';
|
|
59
|
+
/** How many checks one invocation's context has been asked for. */
|
|
60
|
+
export interface CheckTally {
|
|
61
|
+
calls: number;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* The context's `check`, counted. The count moves BEFORE the check runs, so a check that throws
|
|
65
|
+
* or is refused is still one the operation made.
|
|
66
|
+
*/
|
|
67
|
+
export declare function countChecks(check: OperationContext['check'], tally: CheckTally): OperationContext['check'];
|
|
68
|
+
/** The template of the line — constant, so every one of them is the same pattern. */
|
|
69
|
+
export declare const UNCHECKED_OPERATION_TEMPLATE = "operation completed without a permission check";
|
|
70
|
+
/** The `finding` field on that line, for a reader filtering on fields rather than templates. */
|
|
71
|
+
export declare const UNCHECKED_OPERATION_FINDING = "unchecked-operation";
|
|
72
|
+
/**
|
|
73
|
+
* The registered key a test run sets on `globalThis` to have an unchecked completion refused
|
|
74
|
+
* instead of only recorded. Registered, so the copy of the kernel an adapter bundled reads the
|
|
75
|
+
* flag the preload set.
|
|
76
|
+
*/
|
|
77
|
+
export declare const REFUSE_UNCHECKED_OPERATIONS_KEY = "substrat.refuseUncheckedOperations";
|
|
78
|
+
/** An operation held to a check completed without one, under a run that refuses it. */
|
|
79
|
+
export declare class UncheckedOperation extends Error {
|
|
80
|
+
readonly operation: string;
|
|
81
|
+
constructor(operation: string);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Called once, right after the handler returns. Writes the line when an operation `held` to a
|
|
85
|
+
* check made none, and throws {@link UncheckedOperation} after it when the run refuses them.
|
|
86
|
+
* Returns whether a line was written.
|
|
87
|
+
*/
|
|
88
|
+
export declare function noteUncheckedCompletion(ctx: OperationContext, operation: string, tally: CheckTally, held: boolean): boolean;
|
|
89
|
+
//# sourceMappingURL=check-tally.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-tally.d.ts","sourceRoot":"","sources":["../src/check-tally.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD,mEAAmE;AACnE,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,UAAU,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAK1G;AAED,qFAAqF;AACrF,eAAO,MAAM,4BAA4B,mDAAmD,CAAC;AAE7F,gGAAgG;AAChG,eAAO,MAAM,2BAA2B,wBAAwB,CAAC;AAEjE;;;;GAIG;AACH,eAAO,MAAM,+BAA+B,uCAAuC,CAAC;AAMpF,uFAAuF;AACvF,qBAAa,kBAAmB,SAAQ,KAAK;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM;IAAtC,YAAqB,SAAS,EAAE,MAAM,EAOrC;CACF;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,gBAAgB,EACrB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,UAAU,EACjB,IAAI,EAAE,OAAO,GACZ,OAAO,CAKT"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The context's `check`, counted. The count moves BEFORE the check runs, so a check that throws
|
|
3
|
+
* or is refused is still one the operation made.
|
|
4
|
+
*/
|
|
5
|
+
export function countChecks(check, tally) {
|
|
6
|
+
return (permission, entity) => {
|
|
7
|
+
tally.calls += 1;
|
|
8
|
+
return check(permission, entity);
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
/** The template of the line — constant, so every one of them is the same pattern. */
|
|
12
|
+
export const UNCHECKED_OPERATION_TEMPLATE = 'operation completed without a permission check';
|
|
13
|
+
/** The `finding` field on that line, for a reader filtering on fields rather than templates. */
|
|
14
|
+
export const UNCHECKED_OPERATION_FINDING = 'unchecked-operation';
|
|
15
|
+
/**
|
|
16
|
+
* The registered key a test run sets on `globalThis` to have an unchecked completion refused
|
|
17
|
+
* instead of only recorded. Registered, so the copy of the kernel an adapter bundled reads the
|
|
18
|
+
* flag the preload set.
|
|
19
|
+
*/
|
|
20
|
+
export const REFUSE_UNCHECKED_OPERATIONS_KEY = 'substrat.refuseUncheckedOperations';
|
|
21
|
+
function refusing() {
|
|
22
|
+
return globalThis[Symbol.for(REFUSE_UNCHECKED_OPERATIONS_KEY)] === true;
|
|
23
|
+
}
|
|
24
|
+
/** An operation held to a check completed without one, under a run that refuses it. */
|
|
25
|
+
export class UncheckedOperation extends Error {
|
|
26
|
+
operation;
|
|
27
|
+
constructor(operation) {
|
|
28
|
+
super(`${operation} declares a permission but its handler returned without calling ctx.check — ` +
|
|
29
|
+
'check the declared key, or declare `narrows: { reason, checks: [], unchecked: true }` if it ' +
|
|
30
|
+
'deliberately checks nothing');
|
|
31
|
+
this.operation = operation;
|
|
32
|
+
this.name = 'UncheckedOperation';
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Called once, right after the handler returns. Writes the line when an operation `held` to a
|
|
37
|
+
* check made none, and throws {@link UncheckedOperation} after it when the run refuses them.
|
|
38
|
+
* Returns whether a line was written.
|
|
39
|
+
*/
|
|
40
|
+
export function noteUncheckedCompletion(ctx, operation, tally, held) {
|
|
41
|
+
if (!held || tally.calls > 0)
|
|
42
|
+
return false;
|
|
43
|
+
ctx.log.warn(UNCHECKED_OPERATION_TEMPLATE, { finding: UNCHECKED_OPERATION_FINDING });
|
|
44
|
+
if (refusing())
|
|
45
|
+
throw new UncheckedOperation(operation);
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=check-tally.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-tally.js","sourceRoot":"","sources":["../src/check-tally.ts"],"names":[],"mappings":"AAgEA;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,KAAgC,EAAE,KAAiB;IAC7E,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE;QAC5B,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC;QACjB,OAAO,KAAK,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IACnC,CAAC,CAAC;AACJ,CAAC;AAED,qFAAqF;AACrF,MAAM,CAAC,MAAM,4BAA4B,GAAG,gDAAgD,CAAC;AAE7F,gGAAgG;AAChG,MAAM,CAAC,MAAM,2BAA2B,GAAG,qBAAqB,CAAC;AAEjE;;;;GAIG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,oCAAoC,CAAC;AAEpF,SAAS,QAAQ;IACf,OAAQ,UAAsC,CAAC,MAAM,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC,KAAK,IAAI,CAAC;AACvG,CAAC;AAED,uFAAuF;AACvF,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IACtB,SAAS;IAA9B,YAAqB,SAAiB;QACpC,KAAK,CACH,GAAG,SAAS,8EAA8E;YACxF,8FAA8F;YAC9F,6BAA6B,CAChC,CAAC;yBALiB,SAAS;QAM5B,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACnC,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CACrC,GAAqB,EACrB,SAAiB,EACjB,KAAiB,EACjB,IAAa;IAEb,IAAI,CAAC,IAAI,IAAI,KAAK,CAAC,KAAK,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IAC3C,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,4BAA4B,EAAE,EAAE,OAAO,EAAE,2BAA2B,EAAE,CAAC,CAAC;IACrF,IAAI,QAAQ,EAAE;QAAE,MAAM,IAAI,kBAAkB,CAAC,SAAS,CAAC,CAAC;IACxD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,8 @@ export type { OutcomeEventStamp, PlatformRequestSettle } from './email-intent.js
|
|
|
9
9
|
export type { MailAddress, MailSender, MailSendResult, OutboundMail, OutboundMailAttachment, } from './mail-sender.js';
|
|
10
10
|
export { COPY_CLAIM_SQL, COPY_RESTORE_FENCE_LAPSED, copyRestoreFence, copyRestoreFenceLapsed, type CopyRestoreFence, BACKFILL_MOVE_ID, COPY_BACKFILL_SCOPE_SQL, COPY_BACKFILL_SQL, COPY_BACKFILL_SUPERSEDE_SQL, copyBackfillParams, copyBackfillRefusal, type ScopeCopyBackfillResult, type CopyBackfillScopeRow, type ErasureEpochStamp, SUBJECT_ERASURE_CLAIM_SQL, subjectErasureClaimParams, type SubjectErasureFence, COPY_EXPIRED_SQL, COPY_MOVE_CONFIRM_SQL, COPY_MOVE_LIVE_PREDICATE, SCOPE_SCRIPT_COPY_COLUMNS, copyMoveConfirmParams, copyMoveLiveParams, scopeScriptCopyOf, type ScopeScriptCopyRow, } from './scope-copy-ledger.js';
|
|
11
11
|
export { SCOPE_COPY_LEASE_MS, assertRedrainWindow, attachmentBlobKey, attachmentSha256, consumersFor, entitlementDenial, requiredEntitlementFor, backoffAt, globalFetch, executorOutcomeOf, parseValidationRecords, resolveRetryPolicy, OPS_FAILURE_RETENTION_DAYS, SWEEP_RUN_RETENTION_DAYS, SWEEP_RUNS_INTENT_INDEX, sweepRunsIntentHasKind, ISSUE_RETENTION_DAYS, telemetryRetentionStatements, assertRowLimit, assertRowOffset, EMITTED_REPORT_CAP, isUpgradeRequest, isVouchedWithin, vouchedWithin, type VouchedWithin, checkedWithin, isCheckedWithin, type CheckedWithin, } from './scope-host.js';
|
|
12
|
-
export { assertBoundOperations, operationsFor, undeclaredOperations, type BoundOperations, type HandlerMap, } from './module-operations.js';
|
|
12
|
+
export { assertBoundOperations, checkHeldOperationsOf, operationsFor, undeclaredOperations, type BoundOperations, type HandlerMap, } from './module-operations.js';
|
|
13
|
+
export { countChecks, noteUncheckedCompletion, REFUSE_UNCHECKED_OPERATIONS_KEY, UncheckedOperation, UNCHECKED_OPERATION_FINDING, UNCHECKED_OPERATION_TEMPLATE, type CheckTally, } from './check-tally.js';
|
|
13
14
|
export { isSecretBoxConfigured, SecretBoxUnconfiguredError, unconfiguredSecretBox, webCryptoSecretBox, } from './secret-box.js';
|
|
14
15
|
export type { SealedSecret, SecretBox } from './secret-box.js';
|
|
15
16
|
export { visibleContinuation, CONTINUATION_POSITION_CAP } from './visible-continuation.js';
|
|
@@ -45,7 +46,7 @@ export { createAtomic } from './sub-transaction.js';
|
|
|
45
46
|
export type { RunSub, AtomicMarks } from './sub-transaction.js';
|
|
46
47
|
export { DEFAULT_SEARCH_LIMIT, MAX_SEARCH_LIMIT, NotSearchable, SearchTermTooShort, isSearchIndexTable, searchIndexMigrations, searchIndexPlans, searchLimit, searchMatchExpression, searchQuery, } from './search-index.js';
|
|
47
48
|
export type { SearchHit, SearchIndexPlan, SearchOptions, SearchTokenizer, SearchableDeclaration, } from './search-index.js';
|
|
48
|
-
export { ATTACHMENT_CONDEMNED, ATTACHMENT_CONDEMNED_DDL, ORPHAN_SWEEP_FENCE_MS, ORPHAN_SWEEP_GRACE_MS, SETTLED_COPY_STATES, attachmentSweepFenceKey, condemnOrphanAttachments, fenceAttachmentSweep, refuseCondemnedAttachment, refuseCondemnedInDump, rowlessAttachmentIds, sweepOrphanAttachments, unsettledCopyRefusal, missingAttachmentStore, orphanSweepVersionRefusal, } from './attachment-sweep.js';
|
|
49
|
+
export { ATTACHMENT_CONDEMNED, ATTACHMENT_CONDEMNED_DDL, ATTACHMENT_SWEEP_LICENCE_DDL, ATTACHMENT_SWEEP_LICENCE_TABLE, ORPHAN_SWEEP_LICENCE_CAP, ORPHAN_SWEEP_UNLICENSED, clearOrphanSweepLicence, condemnLicensedOrphanAttachments, consumeOrphanSweepLicence, licensedOrphanIds, orphanSweepLicensedAt, recordOrphanSweepLicence, refuseUnlicensedOrphanSweep, ORPHAN_SWEEP_FENCE_MS, ORPHAN_SWEEP_GRACE_MS, SETTLED_COPY_STATES, attachmentSweepFenceKey, condemnOrphanAttachments, fenceAttachmentSweep, refuseCondemnedAttachment, refuseCondemnedInDump, rowlessAttachmentIds, sweepOrphanAttachments, unsettledCopyRefusal, missingAttachmentStore, orphanSweepVersionRefusal, } from './attachment-sweep.js';
|
|
49
50
|
export type { OrphanSweepOptions, OrphanSweepReport, OrphanSweepRequest, OrphanSweepScope } from './attachment-sweep.js';
|
|
50
51
|
export { ATTACHMENT_SEARCH_OWNER_MAX, ATTACHMENT_SEARCH_OWNERS_SQL, ATTACHMENT_SEARCH_SQL, ATTACHMENT_SEARCH_TOO_MANY_OWNERS, ATTACHMENT_TEXT_BACKFILL_BATCH, ATTACHMENT_TEXT_BACKFILL_JOB, ATTACHMENT_TEXT_DDL, ATTACHMENT_TEXT_JOB, ATTACHMENT_TEXT_MODULE, assertJobRegistrable, attachmentRecordOfRow, attachmentTextBackfillJob, attachmentTextJob, enqueueAttachmentText, kernelJobFor, queueAttachmentTextBackfill, readAttachmentText, reconcileAttachmentText, recordAttachmentText, searchAttachments, startAttachmentTextBackfill, } from './attachment-text.js';
|
|
51
52
|
export type { AttachmentRowShape, AttachmentTextBackfillBatch, KernelJobHandlers, AttachmentSearchGate, AttachmentTextSource, AttachmentTextState, AttachmentTextStatus, } from './attachment-text.js';
|