@indigoai-us/hq-cloud 6.14.7 → 6.14.9
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/backup-prune.d.ts +68 -0
- package/dist/backup-prune.d.ts.map +1 -0
- package/dist/backup-prune.js +196 -0
- package/dist/backup-prune.js.map +1 -0
- package/dist/backup-prune.test.d.ts +2 -0
- package/dist/backup-prune.test.d.ts.map +1 -0
- package/dist/backup-prune.test.js +89 -0
- package/dist/backup-prune.test.js.map +1 -0
- package/dist/bin/backup-prune-runner.d.ts +3 -0
- package/dist/bin/backup-prune-runner.d.ts.map +1 -0
- package/dist/bin/backup-prune-runner.js +50 -0
- package/dist/bin/backup-prune-runner.js.map +1 -0
- package/dist/bin/sync-runner-company.d.ts.map +1 -1
- package/dist/bin/sync-runner-company.js +8 -0
- package/dist/bin/sync-runner-company.js.map +1 -1
- package/dist/bin/sync-runner-planning.d.ts +1 -1
- package/dist/bin/sync-runner-planning.d.ts.map +1 -1
- package/dist/bin/sync-runner-planning.js +15 -1
- package/dist/bin/sync-runner-planning.js.map +1 -1
- package/dist/bin/sync-runner-watch-loop.d.ts.map +1 -1
- package/dist/bin/sync-runner-watch-loop.js +28 -0
- package/dist/bin/sync-runner-watch-loop.js.map +1 -1
- package/dist/bin/sync-runner.d.ts +14 -0
- package/dist/bin/sync-runner.d.ts.map +1 -1
- package/dist/bin/sync-runner.js +26 -0
- package/dist/bin/sync-runner.js.map +1 -1
- package/dist/bin/sync-runner.test.js +68 -1
- package/dist/bin/sync-runner.test.js.map +1 -1
- package/dist/cli/rescue-classify-ordering.test.js +105 -0
- package/dist/cli/rescue-classify-ordering.test.js.map +1 -1
- package/dist/cli/rescue-core.d.ts +1 -0
- package/dist/cli/rescue-core.d.ts.map +1 -1
- package/dist/cli/rescue-core.js +478 -300
- package/dist/cli/rescue-core.js.map +1 -1
- package/dist/cli/rescue-snapshot.d.ts +14 -0
- package/dist/cli/rescue-snapshot.d.ts.map +1 -0
- package/dist/cli/rescue-snapshot.js +39 -0
- package/dist/cli/rescue-snapshot.js.map +1 -0
- package/dist/cli/rescue-snapshot.test.d.ts +2 -0
- package/dist/cli/rescue-snapshot.test.d.ts.map +1 -0
- package/dist/cli/rescue-snapshot.test.js +46 -0
- package/dist/cli/rescue-snapshot.test.js.map +1 -0
- package/dist/cli/sync-scope.test.js +3 -1
- package/dist/cli/sync-scope.test.js.map +1 -1
- package/dist/cli/sync.d.ts +6 -6
- package/dist/cli/sync.d.ts.map +1 -1
- package/dist/cli/sync.js +51 -41
- package/dist/cli/sync.js.map +1 -1
- package/dist/cli/sync.test.js +102 -2
- package/dist/cli/sync.test.js.map +1 -1
- package/dist/manifest-reconcile.d.ts +27 -0
- package/dist/manifest-reconcile.d.ts.map +1 -0
- package/dist/manifest-reconcile.js +120 -0
- package/dist/manifest-reconcile.js.map +1 -0
- package/dist/manifest-reconcile.test.d.ts +2 -0
- package/dist/manifest-reconcile.test.d.ts.map +1 -0
- package/dist/manifest-reconcile.test.js +97 -0
- package/dist/manifest-reconcile.test.js.map +1 -0
- package/dist/object-io.d.ts +19 -2
- package/dist/object-io.d.ts.map +1 -1
- package/dist/object-io.js +168 -32
- package/dist/object-io.js.map +1 -1
- package/dist/object-io.test.js +157 -1
- package/dist/object-io.test.js.map +1 -1
- package/dist/s3.d.ts +12 -1
- package/dist/s3.d.ts.map +1 -1
- package/dist/s3.js +51 -18
- package/dist/s3.js.map +1 -1
- package/dist/s3.test.js +12 -1
- package/dist/s3.test.js.map +1 -1
- package/dist/signals/get.test.js +21 -1
- package/dist/signals/get.test.js.map +1 -1
- package/dist/signals/list.test.js +21 -1
- package/dist/signals/list.test.js.map +1 -1
- package/dist/sources/get.test.js +21 -1
- package/dist/sources/get.test.js.map +1 -1
- package/dist/sources/list.test.js +21 -1
- package/dist/sources/list.test.js.map +1 -1
- package/package.json +3 -2
- package/src/backup-prune.test.ts +98 -0
- package/src/backup-prune.ts +182 -0
- package/src/bin/backup-prune-runner.ts +33 -0
- package/src/bin/sync-runner-company.ts +7 -0
- package/src/bin/sync-runner-planning.ts +16 -2
- package/src/bin/sync-runner-watch-loop.ts +18 -0
- package/src/bin/sync-runner.test.ts +82 -1
- package/src/bin/sync-runner.ts +45 -0
- package/src/cli/rescue-classify-ordering.test.ts +121 -0
- package/src/cli/rescue-core.ts +261 -86
- package/src/cli/rescue-snapshot.test.ts +57 -0
- package/src/cli/rescue-snapshot.ts +51 -0
- package/src/cli/sync-scope.test.ts +3 -1
- package/src/cli/sync.test.ts +121 -2
- package/src/cli/sync.ts +71 -53
- package/src/manifest-reconcile.test.ts +107 -0
- package/src/manifest-reconcile.ts +160 -0
- package/src/object-io.test.ts +175 -0
- package/src/object-io.ts +213 -32
- package/src/s3.test.ts +18 -0
- package/src/s3.ts +64 -30
- package/src/signals/get.test.ts +26 -2
- package/src/signals/list.test.ts +26 -2
- package/src/sources/get.test.ts +26 -2
- package/src/sources/list.test.ts +26 -2
package/src/signals/get.test.ts
CHANGED
|
@@ -3,13 +3,18 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
|
|
6
|
+
import { Readable } from "node:stream";
|
|
6
7
|
import { GetObjectCommand, type S3Client } from "@aws-sdk/client-s3";
|
|
7
8
|
import { getSignal, SignalNotFoundError } from "./get.js";
|
|
8
9
|
import {
|
|
9
10
|
_setSignalsS3Factory,
|
|
10
11
|
_resetSignalsS3Factory,
|
|
11
12
|
} from "./internals.js";
|
|
12
|
-
import
|
|
13
|
+
import {
|
|
14
|
+
setPresignedGetTransportForTesting,
|
|
15
|
+
type PresignedGetTransport,
|
|
16
|
+
type PresignTransportClient,
|
|
17
|
+
} from "../object-io.js";
|
|
13
18
|
import type { EntityContext } from "../types.js";
|
|
14
19
|
import { InvalidSignalTypeError } from "../schemas/signal-types.js";
|
|
15
20
|
|
|
@@ -208,6 +213,21 @@ Body.
|
|
|
208
213
|
// Presigned transport (vault client + company vault) — HQ-59
|
|
209
214
|
// ---------------------------------------------------------------------------
|
|
210
215
|
|
|
216
|
+
function fetchBackedPresignedGetTransport(): PresignedGetTransport {
|
|
217
|
+
return {
|
|
218
|
+
async get(url, headers) {
|
|
219
|
+
const response = await fetch(url, { method: "GET", headers });
|
|
220
|
+
const body = response.body ? Readable.fromWeb(response.body) : undefined;
|
|
221
|
+
return {
|
|
222
|
+
status: response.status,
|
|
223
|
+
headers: response.headers,
|
|
224
|
+
body,
|
|
225
|
+
destroy: () => body?.destroy(),
|
|
226
|
+
};
|
|
227
|
+
},
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
|
|
211
231
|
function makePresignVault(objects: Record<string, string>): PresignTransportClient {
|
|
212
232
|
vi.stubGlobal(
|
|
213
233
|
"fetch",
|
|
@@ -218,6 +238,7 @@ function makePresignVault(objects: Record<string, string>): PresignTransportClie
|
|
|
218
238
|
return new Response(Buffer.from(content, "utf-8"), { status: 200 });
|
|
219
239
|
}),
|
|
220
240
|
);
|
|
241
|
+
setPresignedGetTransportForTesting(fetchBackedPresignedGetTransport());
|
|
221
242
|
return {
|
|
222
243
|
presign: async (input) => ({
|
|
223
244
|
results: input.keys.map((k) => ({
|
|
@@ -232,7 +253,10 @@ function makePresignVault(objects: Record<string, string>): PresignTransportClie
|
|
|
232
253
|
}
|
|
233
254
|
|
|
234
255
|
describe("getSignal — presigned transport (vault + cmp_)", () => {
|
|
235
|
-
afterEach(() =>
|
|
256
|
+
afterEach(() => {
|
|
257
|
+
setPresignedGetTransportForTesting(null);
|
|
258
|
+
vi.unstubAllGlobals();
|
|
259
|
+
});
|
|
236
260
|
|
|
237
261
|
it("reads via presign (no S3) and surfaces typed cross-refs", async () => {
|
|
238
262
|
_setSignalsS3Factory(
|
package/src/signals/list.test.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
|
|
10
|
+
import { Readable } from "node:stream";
|
|
10
11
|
import {
|
|
11
12
|
GetObjectCommand,
|
|
12
13
|
ListObjectsV2Command,
|
|
@@ -17,7 +18,11 @@ import {
|
|
|
17
18
|
_setSignalsS3Factory,
|
|
18
19
|
_resetSignalsS3Factory,
|
|
19
20
|
} from "./internals.js";
|
|
20
|
-
import
|
|
21
|
+
import {
|
|
22
|
+
setPresignedGetTransportForTesting,
|
|
23
|
+
type PresignedGetTransport,
|
|
24
|
+
type PresignTransportClient,
|
|
25
|
+
} from "../object-io.js";
|
|
21
26
|
import type { VaultListedObject } from "../vault-client.js";
|
|
22
27
|
import type { EntityContext } from "../types.js";
|
|
23
28
|
import { InvalidSignalTypeError, SIGNAL_TYPES } from "../schemas/signal-types.js";
|
|
@@ -293,6 +298,21 @@ interface PresignVaultStub {
|
|
|
293
298
|
listCalls: Array<{ prefix?: string; cursor?: string }>;
|
|
294
299
|
}
|
|
295
300
|
|
|
301
|
+
function fetchBackedPresignedGetTransport(): PresignedGetTransport {
|
|
302
|
+
return {
|
|
303
|
+
async get(url, headers) {
|
|
304
|
+
const response = await fetch(url, { method: "GET", headers });
|
|
305
|
+
const body = response.body ? Readable.fromWeb(response.body) : undefined;
|
|
306
|
+
return {
|
|
307
|
+
status: response.status,
|
|
308
|
+
headers: response.headers,
|
|
309
|
+
body,
|
|
310
|
+
destroy: () => body?.destroy(),
|
|
311
|
+
};
|
|
312
|
+
},
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
|
|
296
316
|
function makePresignVault(
|
|
297
317
|
page: { objects: VaultListedObject[]; cursor: string | null },
|
|
298
318
|
contents: Record<string, string> = {},
|
|
@@ -307,6 +327,7 @@ function makePresignVault(
|
|
|
307
327
|
return new Response(Buffer.from(c, "utf-8"), { status: 200 });
|
|
308
328
|
}),
|
|
309
329
|
);
|
|
330
|
+
setPresignedGetTransportForTesting(fetchBackedPresignedGetTransport());
|
|
310
331
|
const vault: PresignTransportClient = {
|
|
311
332
|
presign: async (input) => ({
|
|
312
333
|
results: input.keys.map((k) => ({
|
|
@@ -339,7 +360,10 @@ function listed(key: string): VaultListedObject {
|
|
|
339
360
|
}
|
|
340
361
|
|
|
341
362
|
describe("listSignals — presigned transport (vault + cmp_)", () => {
|
|
342
|
-
afterEach(() =>
|
|
363
|
+
afterEach(() => {
|
|
364
|
+
setPresignedGetTransportForTesting(null);
|
|
365
|
+
vi.unstubAllGlobals();
|
|
366
|
+
});
|
|
343
367
|
|
|
344
368
|
it("lists via the ACL-filtered vault endpoint and never touches S3", async () => {
|
|
345
369
|
_setSignalsS3Factory(
|
package/src/sources/get.test.ts
CHANGED
|
@@ -3,13 +3,18 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
|
|
6
|
+
import { Readable } from "node:stream";
|
|
6
7
|
import { GetObjectCommand, type S3Client } from "@aws-sdk/client-s3";
|
|
7
8
|
import { getSource, SourceNotFoundError } from "./get.js";
|
|
8
9
|
import {
|
|
9
10
|
_setSourcesS3Factory,
|
|
10
11
|
_resetSourcesS3Factory,
|
|
11
12
|
} from "./internals.js";
|
|
12
|
-
import
|
|
13
|
+
import {
|
|
14
|
+
setPresignedGetTransportForTesting,
|
|
15
|
+
type PresignedGetTransport,
|
|
16
|
+
type PresignTransportClient,
|
|
17
|
+
} from "../object-io.js";
|
|
13
18
|
import type { EntityContext } from "../types.js";
|
|
14
19
|
import { InvalidSourceChannelError } from "../schemas/source-channels.js";
|
|
15
20
|
|
|
@@ -170,6 +175,21 @@ describe("getSource", () => {
|
|
|
170
175
|
// Presigned transport (vault client + company vault) — HQ-59
|
|
171
176
|
// ---------------------------------------------------------------------------
|
|
172
177
|
|
|
178
|
+
function fetchBackedPresignedGetTransport(): PresignedGetTransport {
|
|
179
|
+
return {
|
|
180
|
+
async get(url, headers) {
|
|
181
|
+
const response = await fetch(url, { method: "GET", headers });
|
|
182
|
+
const body = response.body ? Readable.fromWeb(response.body) : undefined;
|
|
183
|
+
return {
|
|
184
|
+
status: response.status,
|
|
185
|
+
headers: response.headers,
|
|
186
|
+
body,
|
|
187
|
+
destroy: () => body?.destroy(),
|
|
188
|
+
};
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
|
|
173
193
|
/**
|
|
174
194
|
* A presign-capable vault stub + a `fetch` mock keyed by the presigned URL.
|
|
175
195
|
* presign() mints a URL that encodes the key; fetch() returns the object's
|
|
@@ -186,6 +206,7 @@ function makePresignVault(objects: Record<string, string>): PresignTransportClie
|
|
|
186
206
|
return new Response(Buffer.from(content, "utf-8"), { status: 200 });
|
|
187
207
|
}),
|
|
188
208
|
);
|
|
209
|
+
setPresignedGetTransportForTesting(fetchBackedPresignedGetTransport());
|
|
189
210
|
return {
|
|
190
211
|
presign: async (input) => ({
|
|
191
212
|
results: input.keys.map((k) => ({
|
|
@@ -200,7 +221,10 @@ function makePresignVault(objects: Record<string, string>): PresignTransportClie
|
|
|
200
221
|
}
|
|
201
222
|
|
|
202
223
|
describe("getSource — presigned transport (vault + cmp_)", () => {
|
|
203
|
-
afterEach(() =>
|
|
224
|
+
afterEach(() => {
|
|
225
|
+
setPresignedGetTransportForTesting(null);
|
|
226
|
+
vi.unstubAllGlobals();
|
|
227
|
+
});
|
|
204
228
|
|
|
205
229
|
it("reads via presign and never touches S3", async () => {
|
|
206
230
|
// S3 factory throws if used — proves the read went through presign.
|
package/src/sources/list.test.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
|
|
9
|
+
import { Readable } from "node:stream";
|
|
9
10
|
import {
|
|
10
11
|
GetObjectCommand,
|
|
11
12
|
ListObjectsV2Command,
|
|
@@ -16,7 +17,11 @@ import {
|
|
|
16
17
|
_setSourcesS3Factory,
|
|
17
18
|
_resetSourcesS3Factory,
|
|
18
19
|
} from "./internals.js";
|
|
19
|
-
import
|
|
20
|
+
import {
|
|
21
|
+
setPresignedGetTransportForTesting,
|
|
22
|
+
type PresignedGetTransport,
|
|
23
|
+
type PresignTransportClient,
|
|
24
|
+
} from "../object-io.js";
|
|
20
25
|
import type { VaultListedObject } from "../vault-client.js";
|
|
21
26
|
import type { EntityContext } from "../types.js";
|
|
22
27
|
import { InvalidSourceChannelError } from "../schemas/source-channels.js";
|
|
@@ -257,6 +262,21 @@ interface PresignVaultStub {
|
|
|
257
262
|
listCalls: Array<{ prefix?: string; cursor?: string }>;
|
|
258
263
|
}
|
|
259
264
|
|
|
265
|
+
function fetchBackedPresignedGetTransport(): PresignedGetTransport {
|
|
266
|
+
return {
|
|
267
|
+
async get(url, headers) {
|
|
268
|
+
const response = await fetch(url, { method: "GET", headers });
|
|
269
|
+
const body = response.body ? Readable.fromWeb(response.body) : undefined;
|
|
270
|
+
return {
|
|
271
|
+
status: response.status,
|
|
272
|
+
headers: response.headers,
|
|
273
|
+
body,
|
|
274
|
+
destroy: () => body?.destroy(),
|
|
275
|
+
};
|
|
276
|
+
},
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
|
|
260
280
|
/**
|
|
261
281
|
* Vault stub for the list path: `listFiles` returns the configured ACL-filtered
|
|
262
282
|
* page (the server is the ACL boundary — only readable keys come back) + an
|
|
@@ -276,6 +296,7 @@ function makePresignVault(
|
|
|
276
296
|
return new Response(Buffer.from(c, "utf-8"), { status: 200 });
|
|
277
297
|
}),
|
|
278
298
|
);
|
|
299
|
+
setPresignedGetTransportForTesting(fetchBackedPresignedGetTransport());
|
|
279
300
|
const vault: PresignTransportClient = {
|
|
280
301
|
presign: async (input) => ({
|
|
281
302
|
results: input.keys.map((k) => ({
|
|
@@ -308,7 +329,10 @@ function listed(key: string): VaultListedObject {
|
|
|
308
329
|
}
|
|
309
330
|
|
|
310
331
|
describe("listSources — presigned transport (vault + cmp_)", () => {
|
|
311
|
-
afterEach(() =>
|
|
332
|
+
afterEach(() => {
|
|
333
|
+
setPresignedGetTransportForTesting(null);
|
|
334
|
+
vi.unstubAllGlobals();
|
|
335
|
+
});
|
|
312
336
|
|
|
313
337
|
it("lists via the ACL-filtered vault endpoint and never touches S3", async () => {
|
|
314
338
|
_setSourcesS3Factory(
|