@north-light/api 0.3.745 → 0.3.746
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.
|
@@ -39,6 +39,9 @@ export declare function dropExistingWatches(db: CanvasDb, schema: string, target
|
|
|
39
39
|
/** A staged idempotency key whose (grantee, key) the target already holds is already imported (a hosted person's runs the control plane has since served): it is dropped, the target's
|
|
40
40
|
* row stands, so the copy never inserts it and verify never compares it. Only this key is skipped; any other difference still fails. Returns the dropped rows. Runs before the pre-check. */
|
|
41
41
|
export declare function dropExistingIdempotencyKeys(db: CanvasDb, schema: string, target: string): Promise<number>;
|
|
42
|
+
/** A staged idempotency key at least `IDEMPOTENCY_WINDOW_MS` old is already expired (`findIdempotent` ignores it and the daemon's sweep deletes it within a minute), so it is dropped before
|
|
43
|
+
* the copy: otherwise the sweep removes it between copy and verify and verify reports a difference. Returns the dropped rows. Runs before the pre-check. */
|
|
44
|
+
export declare function dropExpiredIdempotencyKeys(db: CanvasDb, schema: string): Promise<number>;
|
|
42
45
|
/** The rows `fillEnvironments` created, as manifest keys per table, so rollback removes them and verify (which has no staged row for them) skips them. */
|
|
43
46
|
export interface FilledRow {
|
|
44
47
|
table: string;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// repo-synced documents, and the pre-check (design-import, "Import lane"). All SQL names the staging schema explicitly.
|
|
3
3
|
import { createProfileBlaxelEnvironment } from '../../environments.js';
|
|
4
4
|
import { KEY_MAPPED_TABLES, mapPath } from '../bundle/layout.js';
|
|
5
|
+
import { IDEMPOTENCY_WINDOW_MS } from '../../runs/operations.js';
|
|
5
6
|
import { ImportLaneError } from './stage.js';
|
|
6
7
|
import { withHeaderCwd } from '../../conversation-store/row-store.js';
|
|
7
8
|
import { runBlobKey } from '../bundle/blob-keys.js';
|
|
@@ -126,6 +127,12 @@ export async function dropExistingIdempotencyKeys(db, schema, target) {
|
|
|
126
127
|
const done = await db.prepareUncached(`DELETE FROM ${sq(schema, 'idempotency_keys')} s WHERE EXISTS (SELECT 1 FROM ${sq(target, 'idempotency_keys')} t WHERE t.grantee = s.grantee AND t.key = s.key)`).run();
|
|
127
128
|
return Number(done.changes);
|
|
128
129
|
}
|
|
130
|
+
/** A staged idempotency key at least `IDEMPOTENCY_WINDOW_MS` old is already expired (`findIdempotent` ignores it and the daemon's sweep deletes it within a minute), so it is dropped before
|
|
131
|
+
* the copy: otherwise the sweep removes it between copy and verify and verify reports a difference. Returns the dropped rows. Runs before the pre-check. */
|
|
132
|
+
export async function dropExpiredIdempotencyKeys(db, schema) {
|
|
133
|
+
const done = await db.prepareUncached(`DELETE FROM ${sq(schema, 'idempotency_keys')} WHERE created_at <= ?`).run(new Date(Date.now() - IDEMPOTENCY_WINDOW_MS).toISOString());
|
|
134
|
+
return Number(done.changes);
|
|
135
|
+
}
|
|
129
136
|
/** Fill: a staged profile with no environment gets the source's machine environment (a Mac) or the person's Blaxel environment (hosted, created if
|
|
130
137
|
* absent). Runs in the copy transaction: it writes target objects. */
|
|
131
138
|
export async function fillEnvironments(tx, schema, target, source, person) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/api",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.746",
|
|
4
4
|
"description": "Typed crtrd /v1 API contract — DTOs, route builders, the error contract, the CrtrClient, and the command-plugin manifest format. Zero runtime dependencies.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/api/index.js",
|