@indigoai-us/hq-cloud 5.46.0 → 5.47.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.
Files changed (49) hide show
  1. package/dist/bin/sync-runner.d.ts +12 -0
  2. package/dist/bin/sync-runner.d.ts.map +1 -1
  3. package/dist/bin/sync-runner.js +39 -0
  4. package/dist/bin/sync-runner.js.map +1 -1
  5. package/dist/bin/sync-runner.test.js +27 -1
  6. package/dist/bin/sync-runner.test.js.map +1 -1
  7. package/dist/cli/share.d.ts.map +1 -1
  8. package/dist/cli/share.js +17 -2
  9. package/dist/cli/share.js.map +1 -1
  10. package/dist/cli/share.test.js +2 -0
  11. package/dist/cli/share.test.js.map +1 -1
  12. package/dist/cli/sync-scope.test.js +1 -0
  13. package/dist/cli/sync-scope.test.js.map +1 -1
  14. package/dist/cli/sync.d.ts.map +1 -1
  15. package/dist/cli/sync.js +11 -1
  16. package/dist/cli/sync.js.map +1 -1
  17. package/dist/cli/sync.test.js +1 -0
  18. package/dist/cli/sync.test.js.map +1 -1
  19. package/dist/object-io.d.ts +218 -0
  20. package/dist/object-io.d.ts.map +1 -0
  21. package/dist/object-io.js +588 -0
  22. package/dist/object-io.js.map +1 -0
  23. package/dist/object-io.test.d.ts +11 -0
  24. package/dist/object-io.test.d.ts.map +1 -0
  25. package/dist/object-io.test.js +568 -0
  26. package/dist/object-io.test.js.map +1 -0
  27. package/dist/s3.d.ts +37 -0
  28. package/dist/s3.d.ts.map +1 -1
  29. package/dist/s3.js +207 -198
  30. package/dist/s3.js.map +1 -1
  31. package/dist/vault-client.d.ts +68 -0
  32. package/dist/vault-client.d.ts.map +1 -1
  33. package/dist/vault-client.js +35 -0
  34. package/dist/vault-client.js.map +1 -1
  35. package/package.json +1 -1
  36. package/scripts/presign-transport-e2e.mjs +203 -0
  37. package/scripts/vault-rebaseline.sh +275 -0
  38. package/scripts/vault-rescue.sh +8 -0
  39. package/src/bin/sync-runner.test.ts +41 -0
  40. package/src/bin/sync-runner.ts +52 -0
  41. package/src/cli/share.test.ts +2 -0
  42. package/src/cli/share.ts +29 -2
  43. package/src/cli/sync-scope.test.ts +1 -0
  44. package/src/cli/sync.test.ts +1 -0
  45. package/src/cli/sync.ts +22 -1
  46. package/src/object-io.test.ts +663 -0
  47. package/src/object-io.ts +782 -0
  48. package/src/s3.ts +259 -233
  49. package/src/vault-client.ts +101 -0
@@ -181,6 +181,51 @@ export interface ExplicitGrant {
181
181
  source: GrantSource;
182
182
  }
183
183
 
184
+ /** Presign operation: download / upload / delete. */
185
+ export type PresignOp = "get" | "put" | "delete";
186
+
187
+ /** One object's metadata as returned by GET /v1/files/list. */
188
+ export interface VaultListedObject {
189
+ key: string;
190
+ size: number;
191
+ lastModified: string | null;
192
+ /**
193
+ * S3 ETag (quotes stripped) or null. Load-bearing for sync change-
194
+ * detection: the client stores it as remote-content identity and compares
195
+ * it to decide pull/skip/delete-safety — the same role `RemoteFile.etag`
196
+ * plays on the STS path. Mirrors the hq-pro `files/list` field (PR #269).
197
+ */
198
+ etag: string | null;
199
+ permission: GrantPermission;
200
+ }
201
+
202
+ /** One key in a batch presign request. */
203
+ export interface PresignKeyInput {
204
+ key: string;
205
+ op?: PresignOp;
206
+ contentType?: string;
207
+ /** Custom object metadata to sign into a PUT (x-amz-meta-*). */
208
+ metadata?: Record<string, string>;
209
+ }
210
+
211
+ /** One result row from POST /v1/files/presign (per key, request order). */
212
+ export interface PresignResultRow {
213
+ key: string;
214
+ op: PresignOp;
215
+ /** Present on success: the presigned URL. */
216
+ url?: string;
217
+ /**
218
+ * Present on a PUT success: the EXACT headers to send on the PUT so the
219
+ * SigV4 signature matches (Content-Type, SSE-KMS, every x-amz-meta-*).
220
+ */
221
+ headers?: Record<string, string>;
222
+ expiresIn?: number;
223
+ expiresAt?: string;
224
+ /** Present on per-key denial/validation failure. */
225
+ error?: string;
226
+ code?: string;
227
+ }
228
+
184
229
  /**
185
230
  * Effective sync mode for a single membership. Mirrors the server's
186
231
  * resolved view from `GET /v1/memberships/{id}/sync-config`:
@@ -531,6 +576,62 @@ export class VaultClient {
531
576
  return data.grants ?? [];
532
577
  }
533
578
 
579
+ // -- Presigned-URL transport (vault list + presign) ----------------------
580
+
581
+ /**
582
+ * ACL-filtered list of objects under `prefix`. Backed by
583
+ * `GET /v1/files/list?company=&prefix=&cursor=`. Returns only the keys the
584
+ * caller can read, each with metadata (size, lastModified, permission), plus
585
+ * an opaque `cursor` for the next page (null when exhausted). Page the cursor
586
+ * until it is null.
587
+ */
588
+ async listFiles(
589
+ companyUid: string,
590
+ prefix?: string,
591
+ cursor?: string,
592
+ ): Promise<{
593
+ objects: VaultListedObject[];
594
+ cursor: string | null;
595
+ truncated: boolean;
596
+ }> {
597
+ const qs = new URLSearchParams({ company: companyUid });
598
+ if (prefix) qs.set("prefix", prefix);
599
+ if (cursor) qs.set("cursor", cursor);
600
+ const data = await this.get<{
601
+ objects?: VaultListedObject[];
602
+ cursor?: string | null;
603
+ truncated?: boolean;
604
+ }>(`/v1/files/list?${qs.toString()}`);
605
+ return {
606
+ objects: data.objects ?? [],
607
+ cursor: data.cursor ?? null,
608
+ truncated: data.truncated ?? false,
609
+ };
610
+ }
611
+
612
+ /**
613
+ * Batch-mint presigned get/put/delete URLs. Backed by
614
+ * `POST /v1/files/presign`. Authorization is PER KEY — denied/invalid keys
615
+ * come back as `results[i].error` (the call itself succeeds), so callers must
616
+ * inspect each row. PUT rows carry `headers` the client must replay verbatim.
617
+ */
618
+ async presign(input: {
619
+ companyUid: string;
620
+ op?: PresignOp;
621
+ expiresIn?: number;
622
+ keys: PresignKeyInput[];
623
+ }): Promise<{ results: PresignResultRow[]; expiresAt: string }> {
624
+ return this.post<{ results: PresignResultRow[]; expiresAt: string }>(
625
+ `/v1/files/presign`,
626
+ {
627
+ company: input.companyUid,
628
+ ...(input.op ? { op: input.op } : {}),
629
+ ...(input.expiresIn ? { expiresIn: input.expiresIn } : {}),
630
+ keys: input.keys,
631
+ },
632
+ );
633
+ }
634
+
534
635
  /**
535
636
  * Read the effective sync-mode for a single membership. Backed by
536
637
  * `GET /v1/memberships/{id}/sync-config` (hq-pro US-003).