@indigoai-us/hq-cloud 6.18.44-alpha.9 → 6.18.44
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/bin/sync-runner-planning.d.ts +12 -0
- package/dist/bin/sync-runner-planning.d.ts.map +1 -1
- package/dist/bin/sync-runner-planning.js +18 -0
- package/dist/bin/sync-runner-planning.js.map +1 -1
- package/dist/bin/sync-runner-watch-loop.d.ts +18 -0
- package/dist/bin/sync-runner-watch-loop.d.ts.map +1 -1
- package/dist/bin/sync-runner-watch-loop.js +75 -6
- package/dist/bin/sync-runner-watch-loop.js.map +1 -1
- package/dist/bin/sync-runner.d.ts +22 -1
- package/dist/bin/sync-runner.d.ts.map +1 -1
- package/dist/bin/sync-runner.js +33 -4
- package/dist/bin/sync-runner.js.map +1 -1
- package/dist/cli/conflict.d.ts.map +1 -1
- package/dist/cli/conflict.js +2 -1
- package/dist/cli/conflict.js.map +1 -1
- package/dist/cli/rescue-core.d.ts +6 -0
- package/dist/cli/rescue-core.d.ts.map +1 -1
- package/dist/cli/rescue-core.js +10 -1
- package/dist/cli/rescue-core.js.map +1 -1
- package/dist/cli/rescue-windows-test-harness.d.ts +19 -0
- package/dist/cli/rescue-windows-test-harness.d.ts.map +1 -0
- package/dist/cli/rescue-windows-test-harness.js +443 -0
- package/dist/cli/rescue-windows-test-harness.js.map +1 -0
- package/dist/company-resolver.d.ts +22 -0
- package/dist/company-resolver.d.ts.map +1 -1
- package/dist/company-resolver.js +1 -1
- package/dist/company-resolver.js.map +1 -1
- package/dist/ignore.d.ts +4 -1
- package/dist/ignore.d.ts.map +1 -1
- package/dist/ignore.js +10 -12
- package/dist/ignore.js.map +1 -1
- package/dist/journal-snapshot-decoder.js +15 -2
- package/dist/journal-snapshot-decoder.js.map +1 -1
- package/dist/sync/durable-apply.d.ts +2 -0
- package/dist/sync/durable-apply.d.ts.map +1 -1
- package/dist/sync/durable-apply.js +9 -12
- package/dist/sync/durable-apply.js.map +1 -1
- package/dist/sync/fsync-compat.d.ts +13 -0
- package/dist/sync/fsync-compat.d.ts.map +1 -0
- package/dist/sync/fsync-compat.js +33 -0
- package/dist/sync/fsync-compat.js.map +1 -0
- package/dist/sync/multipart-uploader.d.ts.map +1 -1
- package/dist/sync/multipart-uploader.js +2 -1
- package/dist/sync/multipart-uploader.js.map +1 -1
- package/dist/sync/scope-inventory-client.d.ts.map +1 -1
- package/dist/sync/scope-inventory-client.js +7 -2
- package/dist/sync/scope-inventory-client.js.map +1 -1
- package/dist/telemetry.d.ts +31 -0
- package/dist/telemetry.d.ts.map +1 -1
- package/dist/telemetry.js +177 -17
- package/dist/telemetry.js.map +1 -1
- package/dist/usage-company-fallback.d.ts +104 -0
- package/dist/usage-company-fallback.d.ts.map +1 -0
- package/dist/usage-company-fallback.js +599 -0
- package/dist/usage-company-fallback.js.map +1 -0
- package/dist/watch-owner-lease.d.ts +3 -0
- package/dist/watch-owner-lease.d.ts.map +1 -1
- package/dist/watch-owner-lease.js +14 -3
- package/dist/watch-owner-lease.js.map +1 -1
- package/package.json +2 -2
- package/dist/active-company.test.d.ts +0 -2
- package/dist/active-company.test.d.ts.map +0 -1
- package/dist/active-company.test.js +0 -149
- package/dist/active-company.test.js.map +0 -1
- package/dist/agent-codex-instructions.test.d.ts +0 -2
- package/dist/agent-codex-instructions.test.d.ts.map +0 -1
- package/dist/agent-codex-instructions.test.js +0 -271
- package/dist/agent-codex-instructions.test.js.map +0 -1
- package/dist/backup-prune.test.d.ts +0 -2
- package/dist/backup-prune.test.d.ts.map +0 -1
- package/dist/backup-prune.test.js +0 -154
- package/dist/backup-prune.test.js.map +0 -1
- package/dist/bandwidth.test.d.ts +0 -2
- package/dist/bandwidth.test.d.ts.map +0 -1
- package/dist/bandwidth.test.js +0 -342
- package/dist/bandwidth.test.js.map +0 -1
- package/dist/best-effort-error.test.d.ts +0 -2
- package/dist/best-effort-error.test.d.ts.map +0 -1
- package/dist/best-effort-error.test.js +0 -54
- package/dist/best-effort-error.test.js.map +0 -1
- package/dist/bin/area-ledger-migration.test.d.ts +0 -2
- package/dist/bin/area-ledger-migration.test.d.ts.map +0 -1
- package/dist/bin/area-ledger-migration.test.js +0 -410
- package/dist/bin/area-ledger-migration.test.js.map +0 -1
- package/dist/bin/backup-prune-runner.test.d.ts +0 -2
- package/dist/bin/backup-prune-runner.test.d.ts.map +0 -1
- package/dist/bin/backup-prune-runner.test.js +0 -22
- package/dist/bin/backup-prune-runner.test.js.map +0 -1
- package/dist/bin/journal-repair.test.d.ts +0 -2
- package/dist/bin/journal-repair.test.d.ts.map +0 -1
- package/dist/bin/journal-repair.test.js +0 -53
- package/dist/bin/journal-repair.test.js.map +0 -1
- package/dist/bin/layout-compatibility.test.d.ts +0 -2
- package/dist/bin/layout-compatibility.test.d.ts.map +0 -1
- package/dist/bin/layout-compatibility.test.js +0 -87
- package/dist/bin/layout-compatibility.test.js.map +0 -1
- package/dist/bin/outpost-heartbeat.test.d.ts +0 -7
- package/dist/bin/outpost-heartbeat.test.d.ts.map +0 -1
- package/dist/bin/outpost-heartbeat.test.js +0 -84
- package/dist/bin/outpost-heartbeat.test.js.map +0 -1
- package/dist/bin/outpost-session-host.test.d.ts +0 -7
- package/dist/bin/outpost-session-host.test.d.ts.map +0 -1
- package/dist/bin/outpost-session-host.test.js +0 -52
- package/dist/bin/outpost-session-host.test.js.map +0 -1
- package/dist/bin/sync-mutation.test.d.ts +0 -2
- package/dist/bin/sync-mutation.test.d.ts.map +0 -1
- package/dist/bin/sync-mutation.test.js +0 -64
- package/dist/bin/sync-mutation.test.js.map +0 -1
- package/dist/bin/sync-runner-args.test.d.ts +0 -2
- package/dist/bin/sync-runner-args.test.d.ts.map +0 -1
- package/dist/bin/sync-runner-args.test.js +0 -82
- package/dist/bin/sync-runner-args.test.js.map +0 -1
- package/dist/bin/sync-runner-auth-wait.test.d.ts +0 -2
- package/dist/bin/sync-runner-auth-wait.test.d.ts.map +0 -1
- package/dist/bin/sync-runner-auth-wait.test.js +0 -406
- package/dist/bin/sync-runner-auth-wait.test.js.map +0 -1
- package/dist/bin/sync-runner-backoff.regression.test.d.ts +0 -29
- package/dist/bin/sync-runner-backoff.regression.test.d.ts.map +0 -1
- package/dist/bin/sync-runner-backoff.regression.test.js +0 -224
- package/dist/bin/sync-runner-backoff.regression.test.js.map +0 -1
- package/dist/bin/sync-runner-company.test.d.ts +0 -2
- package/dist/bin/sync-runner-company.test.d.ts.map +0 -1
- package/dist/bin/sync-runner-company.test.js +0 -2439
- package/dist/bin/sync-runner-company.test.js.map +0 -1
- package/dist/bin/sync-runner-delete-snapshot-mixed.bench.test.d.ts +0 -2
- package/dist/bin/sync-runner-delete-snapshot-mixed.bench.test.d.ts.map +0 -1
- package/dist/bin/sync-runner-delete-snapshot-mixed.bench.test.js +0 -648
- package/dist/bin/sync-runner-delete-snapshot-mixed.bench.test.js.map +0 -1
- package/dist/bin/sync-runner-delete-snapshot.bench.test.d.ts +0 -2
- package/dist/bin/sync-runner-delete-snapshot.bench.test.d.ts.map +0 -1
- package/dist/bin/sync-runner-delete-snapshot.bench.test.js +0 -329
- package/dist/bin/sync-runner-delete-snapshot.bench.test.js.map +0 -1
- package/dist/bin/sync-runner-events.test.d.ts +0 -2
- package/dist/bin/sync-runner-events.test.d.ts.map +0 -1
- package/dist/bin/sync-runner-events.test.js +0 -364
- package/dist/bin/sync-runner-events.test.js.map +0 -1
- package/dist/bin/sync-runner-heap-telemetry.test.d.ts +0 -2
- package/dist/bin/sync-runner-heap-telemetry.test.d.ts.map +0 -1
- package/dist/bin/sync-runner-heap-telemetry.test.js +0 -1966
- package/dist/bin/sync-runner-heap-telemetry.test.js.map +0 -1
- package/dist/bin/sync-runner-manifest.test.d.ts +0 -12
- package/dist/bin/sync-runner-manifest.test.d.ts.map +0 -1
- package/dist/bin/sync-runner-manifest.test.js +0 -921
- package/dist/bin/sync-runner-manifest.test.js.map +0 -1
- package/dist/bin/sync-runner-planning.test.d.ts +0 -2
- package/dist/bin/sync-runner-planning.test.d.ts.map +0 -1
- package/dist/bin/sync-runner-planning.test.js +0 -448
- package/dist/bin/sync-runner-planning.test.js.map +0 -1
- package/dist/bin/sync-runner-post-sync-flags.test.d.ts +0 -2
- package/dist/bin/sync-runner-post-sync-flags.test.d.ts.map +0 -1
- package/dist/bin/sync-runner-post-sync-flags.test.js +0 -64
- package/dist/bin/sync-runner-post-sync-flags.test.js.map +0 -1
- package/dist/bin/sync-runner-publish-expansion.test.d.ts +0 -2
- package/dist/bin/sync-runner-publish-expansion.test.d.ts.map +0 -1
- package/dist/bin/sync-runner-publish-expansion.test.js +0 -54
- package/dist/bin/sync-runner-publish-expansion.test.js.map +0 -1
- package/dist/bin/sync-runner-receiver-unresolved-company.test.d.ts +0 -2
- package/dist/bin/sync-runner-receiver-unresolved-company.test.d.ts.map +0 -1
- package/dist/bin/sync-runner-receiver-unresolved-company.test.js +0 -379
- package/dist/bin/sync-runner-receiver-unresolved-company.test.js.map +0 -1
- package/dist/bin/sync-runner-rollup.test.d.ts +0 -2
- package/dist/bin/sync-runner-rollup.test.d.ts.map +0 -1
- package/dist/bin/sync-runner-rollup.test.js +0 -24
- package/dist/bin/sync-runner-rollup.test.js.map +0 -1
- package/dist/bin/sync-runner-watch-loop.test.d.ts +0 -2
- package/dist/bin/sync-runner-watch-loop.test.d.ts.map +0 -1
- package/dist/bin/sync-runner-watch-loop.test.js +0 -734
- package/dist/bin/sync-runner-watch-loop.test.js.map +0 -1
- package/dist/bin/sync-runner-watch-routes.test.d.ts +0 -2
- package/dist/bin/sync-runner-watch-routes.test.d.ts.map +0 -1
- package/dist/bin/sync-runner-watch-routes.test.js +0 -181
- package/dist/bin/sync-runner-watch-routes.test.js.map +0 -1
- package/dist/bin/sync-runner.test.d.ts +0 -10
- package/dist/bin/sync-runner.test.d.ts.map +0 -1
- package/dist/bin/sync-runner.test.js +0 -18984
- package/dist/bin/sync-runner.test.js.map +0 -1
- package/dist/cli/case-alias.test.d.ts +0 -2
- package/dist/cli/case-alias.test.d.ts.map +0 -1
- package/dist/cli/case-alias.test.js +0 -96
- package/dist/cli/case-alias.test.js.map +0 -1
- package/dist/cli/conflict-recovery.test.d.ts +0 -2
- package/dist/cli/conflict-recovery.test.d.ts.map +0 -1
- package/dist/cli/conflict-recovery.test.js +0 -201
- package/dist/cli/conflict-recovery.test.js.map +0 -1
- package/dist/cli/conflict-winner.test.d.ts +0 -7
- package/dist/cli/conflict-winner.test.d.ts.map +0 -1
- package/dist/cli/conflict-winner.test.js +0 -98
- package/dist/cli/conflict-winner.test.js.map +0 -1
- package/dist/cli/doctor.test.d.ts +0 -13
- package/dist/cli/doctor.test.d.ts.map +0 -1
- package/dist/cli/doctor.test.js +0 -607
- package/dist/cli/doctor.test.js.map +0 -1
- package/dist/cli/invite.test.d.ts +0 -5
- package/dist/cli/invite.test.d.ts.map +0 -1
- package/dist/cli/invite.test.js +0 -178
- package/dist/cli/invite.test.js.map +0 -1
- package/dist/cli/onepass-pull-planner-regressions.test.d.ts +0 -2
- package/dist/cli/onepass-pull-planner-regressions.test.d.ts.map +0 -1
- package/dist/cli/onepass-pull-planner-regressions.test.js +0 -300
- package/dist/cli/onepass-pull-planner-regressions.test.js.map +0 -1
- package/dist/cli/onepass-pull-planner.test.d.ts +0 -2
- package/dist/cli/onepass-pull-planner.test.d.ts.map +0 -1
- package/dist/cli/onepass-pull-planner.test.js +0 -266
- package/dist/cli/onepass-pull-planner.test.js.map +0 -1
- package/dist/cli/push-scan-exclusions.test.d.ts +0 -2
- package/dist/cli/push-scan-exclusions.test.d.ts.map +0 -1
- package/dist/cli/push-scan-exclusions.test.js +0 -99
- package/dist/cli/push-scan-exclusions.test.js.map +0 -1
- package/dist/cli/reindex-knowledge.test.d.ts +0 -12
- package/dist/cli/reindex-knowledge.test.d.ts.map +0 -1
- package/dist/cli/reindex-knowledge.test.js +0 -260
- package/dist/cli/reindex-knowledge.test.js.map +0 -1
- package/dist/cli/reindex.test.d.ts +0 -11
- package/dist/cli/reindex.test.d.ts.map +0 -1
- package/dist/cli/reindex.test.js +0 -811
- package/dist/cli/reindex.test.js.map +0 -1
- package/dist/cli/rescue-breaker.test.d.ts +0 -2
- package/dist/cli/rescue-breaker.test.d.ts.map +0 -1
- package/dist/cli/rescue-breaker.test.js +0 -812
- package/dist/cli/rescue-breaker.test.js.map +0 -1
- package/dist/cli/rescue-classify-ordering.test.d.ts +0 -2
- package/dist/cli/rescue-classify-ordering.test.d.ts.map +0 -1
- package/dist/cli/rescue-classify-ordering.test.js +0 -500
- package/dist/cli/rescue-classify-ordering.test.js.map +0 -1
- package/dist/cli/rescue-clone-diagnostics.test.d.ts +0 -2
- package/dist/cli/rescue-clone-diagnostics.test.d.ts.map +0 -1
- package/dist/cli/rescue-clone-diagnostics.test.js +0 -101
- package/dist/cli/rescue-clone-diagnostics.test.js.map +0 -1
- package/dist/cli/rescue-clone-network-retry.test.d.ts +0 -2
- package/dist/cli/rescue-clone-network-retry.test.d.ts.map +0 -1
- package/dist/cli/rescue-clone-network-retry.test.js +0 -415
- package/dist/cli/rescue-clone-network-retry.test.js.map +0 -1
- package/dist/cli/rescue-core-stamp.test.d.ts +0 -2
- package/dist/cli/rescue-core-stamp.test.d.ts.map +0 -1
- package/dist/cli/rescue-core-stamp.test.js +0 -364
- package/dist/cli/rescue-core-stamp.test.js.map +0 -1
- package/dist/cli/rescue-drift-reconcile.test.d.ts +0 -2
- package/dist/cli/rescue-drift-reconcile.test.d.ts.map +0 -1
- package/dist/cli/rescue-drift-reconcile.test.js +0 -162
- package/dist/cli/rescue-drift-reconcile.test.js.map +0 -1
- package/dist/cli/rescue-drop-dir-symlink.test.d.ts +0 -2
- package/dist/cli/rescue-drop-dir-symlink.test.d.ts.map +0 -1
- package/dist/cli/rescue-drop-dir-symlink.test.js +0 -255
- package/dist/cli/rescue-drop-dir-symlink.test.js.map +0 -1
- package/dist/cli/rescue-exec-bit-preserve.test.d.ts +0 -2
- package/dist/cli/rescue-exec-bit-preserve.test.d.ts.map +0 -1
- package/dist/cli/rescue-exec-bit-preserve.test.js +0 -177
- package/dist/cli/rescue-exec-bit-preserve.test.js.map +0 -1
- package/dist/cli/rescue-hq-root-guard.test.d.ts +0 -2
- package/dist/cli/rescue-hq-root-guard.test.d.ts.map +0 -1
- package/dist/cli/rescue-hq-root-guard.test.js +0 -210
- package/dist/cli/rescue-hq-root-guard.test.js.map +0 -1
- package/dist/cli/rescue-journal-reconcile.test.d.ts +0 -2
- package/dist/cli/rescue-journal-reconcile.test.d.ts.map +0 -1
- package/dist/cli/rescue-journal-reconcile.test.js +0 -186
- package/dist/cli/rescue-journal-reconcile.test.js.map +0 -1
- package/dist/cli/rescue-keep-local-ignore.test.d.ts +0 -2
- package/dist/cli/rescue-keep-local-ignore.test.d.ts.map +0 -1
- package/dist/cli/rescue-keep-local-ignore.test.js +0 -315
- package/dist/cli/rescue-keep-local-ignore.test.js.map +0 -1
- package/dist/cli/rescue-move.test.d.ts +0 -2
- package/dist/cli/rescue-move.test.d.ts.map +0 -1
- package/dist/cli/rescue-move.test.js +0 -166
- package/dist/cli/rescue-move.test.js.map +0 -1
- package/dist/cli/rescue-mtime-preserve.test.d.ts +0 -2
- package/dist/cli/rescue-mtime-preserve.test.d.ts.map +0 -1
- package/dist/cli/rescue-mtime-preserve.test.js +0 -186
- package/dist/cli/rescue-mtime-preserve.test.js.map +0 -1
- package/dist/cli/rescue-preserve-copy-symlink.test.d.ts +0 -2
- package/dist/cli/rescue-preserve-copy-symlink.test.d.ts.map +0 -1
- package/dist/cli/rescue-preserve-copy-symlink.test.js +0 -483
- package/dist/cli/rescue-preserve-copy-symlink.test.js.map +0 -1
- package/dist/cli/rescue-realpath.test.d.ts +0 -2
- package/dist/cli/rescue-realpath.test.d.ts.map +0 -1
- package/dist/cli/rescue-realpath.test.js +0 -109
- package/dist/cli/rescue-realpath.test.js.map +0 -1
- package/dist/cli/rescue-restore-flag.test.d.ts +0 -2
- package/dist/cli/rescue-restore-flag.test.d.ts.map +0 -1
- package/dist/cli/rescue-restore-flag.test.js +0 -82
- package/dist/cli/rescue-restore-flag.test.js.map +0 -1
- package/dist/cli/rescue-rsync-preflight.test.d.ts +0 -2
- package/dist/cli/rescue-rsync-preflight.test.d.ts.map +0 -1
- package/dist/cli/rescue-rsync-preflight.test.js +0 -579
- package/dist/cli/rescue-rsync-preflight.test.js.map +0 -1
- package/dist/cli/rescue-rsync-status.test.d.ts +0 -2
- package/dist/cli/rescue-rsync-status.test.d.ts.map +0 -1
- package/dist/cli/rescue-rsync-status.test.js +0 -406
- package/dist/cli/rescue-rsync-status.test.js.map +0 -1
- package/dist/cli/rescue-settings-reconcile.test.d.ts +0 -2
- package/dist/cli/rescue-settings-reconcile.test.d.ts.map +0 -1
- package/dist/cli/rescue-settings-reconcile.test.js +0 -610
- package/dist/cli/rescue-settings-reconcile.test.js.map +0 -1
- package/dist/cli/rescue-snapshot-copy.test.d.ts +0 -2
- package/dist/cli/rescue-snapshot-copy.test.d.ts.map +0 -1
- package/dist/cli/rescue-snapshot-copy.test.js +0 -790
- package/dist/cli/rescue-snapshot-copy.test.js.map +0 -1
- package/dist/cli/rescue-snapshot-recovery.test.d.ts +0 -2
- package/dist/cli/rescue-snapshot-recovery.test.d.ts.map +0 -1
- package/dist/cli/rescue-snapshot-recovery.test.js +0 -265
- package/dist/cli/rescue-snapshot-recovery.test.js.map +0 -1
- package/dist/cli/rescue-snapshot.test.d.ts +0 -2
- package/dist/cli/rescue-snapshot.test.d.ts.map +0 -1
- package/dist/cli/rescue-snapshot.test.js +0 -46
- package/dist/cli/rescue-snapshot.test.js.map +0 -1
- package/dist/cli/rescue-source-switch-floor.test.d.ts +0 -2
- package/dist/cli/rescue-source-switch-floor.test.d.ts.map +0 -1
- package/dist/cli/rescue-source-switch-floor.test.js +0 -247
- package/dist/cli/rescue-source-switch-floor.test.js.map +0 -1
- package/dist/cli/rescue-unchanged-delete.test.d.ts +0 -2
- package/dist/cli/rescue-unchanged-delete.test.d.ts.map +0 -1
- package/dist/cli/rescue-unchanged-delete.test.js +0 -305
- package/dist/cli/rescue-unchanged-delete.test.js.map +0 -1
- package/dist/cli/rescue.reindex.test.d.ts +0 -2
- package/dist/cli/rescue.reindex.test.d.ts.map +0 -1
- package/dist/cli/rescue.reindex.test.js +0 -72
- package/dist/cli/rescue.reindex.test.js.map +0 -1
- package/dist/cli/rescue.test.d.ts +0 -2
- package/dist/cli/rescue.test.d.ts.map +0 -1
- package/dist/cli/rescue.test.js +0 -127
- package/dist/cli/rescue.test.js.map +0 -1
- package/dist/cli/share-plan-limit-presign.test.d.ts +0 -2
- package/dist/cli/share-plan-limit-presign.test.d.ts.map +0 -1
- package/dist/cli/share-plan-limit-presign.test.js +0 -271
- package/dist/cli/share-plan-limit-presign.test.js.map +0 -1
- package/dist/cli/share-presign-transport.test.d.ts +0 -22
- package/dist/cli/share-presign-transport.test.d.ts.map +0 -1
- package/dist/cli/share-presign-transport.test.js +0 -388
- package/dist/cli/share-presign-transport.test.js.map +0 -1
- package/dist/cli/share.test.d.ts +0 -5
- package/dist/cli/share.test.d.ts.map +0 -1
- package/dist/cli/share.test.js +0 -12335
- package/dist/cli/share.test.js.map +0 -1
- package/dist/cli/streaming-pull-planner.bench.test.d.ts +0 -15
- package/dist/cli/streaming-pull-planner.bench.test.d.ts.map +0 -1
- package/dist/cli/streaming-pull-planner.bench.test.js +0 -273
- package/dist/cli/streaming-pull-planner.bench.test.js.map +0 -1
- package/dist/cli/sync-scope.test.d.ts +0 -22
- package/dist/cli/sync-scope.test.d.ts.map +0 -1
- package/dist/cli/sync-scope.test.js +0 -903
- package/dist/cli/sync-scope.test.js.map +0 -1
- package/dist/cli/sync.test.d.ts +0 -5
- package/dist/cli/sync.test.d.ts.map +0 -1
- package/dist/cli/sync.test.js +0 -9028
- package/dist/cli/sync.test.js.map +0 -1
- package/dist/cli/tombstones.test.d.ts +0 -2
- package/dist/cli/tombstones.test.d.ts.map +0 -1
- package/dist/cli/tombstones.test.js +0 -120
- package/dist/cli/tombstones.test.js.map +0 -1
- package/dist/cli/watch-event-push-conflict.test.d.ts +0 -25
- package/dist/cli/watch-event-push-conflict.test.d.ts.map +0 -1
- package/dist/cli/watch-event-push-conflict.test.js +0 -230
- package/dist/cli/watch-event-push-conflict.test.js.map +0 -1
- package/dist/client-info.test.d.ts +0 -11
- package/dist/client-info.test.d.ts.map +0 -1
- package/dist/client-info.test.js +0 -168
- package/dist/client-info.test.js.map +0 -1
- package/dist/cognito-auth-lock-no-hard-links.test.d.ts +0 -11
- package/dist/cognito-auth-lock-no-hard-links.test.d.ts.map +0 -1
- package/dist/cognito-auth-lock-no-hard-links.test.js +0 -76
- package/dist/cognito-auth-lock-no-hard-links.test.js.map +0 -1
- package/dist/cognito-auth.test.d.ts +0 -9
- package/dist/cognito-auth.test.d.ts.map +0 -1
- package/dist/cognito-auth.test.js +0 -745
- package/dist/cognito-auth.test.js.map +0 -1
- package/dist/company-resolver.test.d.ts +0 -7
- package/dist/company-resolver.test.d.ts.map +0 -1
- package/dist/company-resolver.test.js +0 -533
- package/dist/company-resolver.test.js.map +0 -1
- package/dist/company-slug.test.d.ts +0 -7
- package/dist/company-slug.test.d.ts.map +0 -1
- package/dist/company-slug.test.js +0 -43
- package/dist/company-slug.test.js.map +0 -1
- package/dist/company-vault-transport.test.d.ts +0 -12
- package/dist/company-vault-transport.test.d.ts.map +0 -1
- package/dist/company-vault-transport.test.js +0 -97
- package/dist/company-vault-transport.test.js.map +0 -1
- package/dist/context.test.d.ts +0 -7
- package/dist/context.test.d.ts.map +0 -1
- package/dist/context.test.js +0 -646
- package/dist/context.test.js.map +0 -1
- package/dist/entity-resolver.test.d.ts +0 -10
- package/dist/entity-resolver.test.d.ts.map +0 -1
- package/dist/entity-resolver.test.js +0 -244
- package/dist/entity-resolver.test.js.map +0 -1
- package/dist/getindigo-dead-refs-contract.test.d.ts +0 -2
- package/dist/getindigo-dead-refs-contract.test.d.ts.map +0 -1
- package/dist/getindigo-dead-refs-contract.test.js +0 -58
- package/dist/getindigo-dead-refs-contract.test.js.map +0 -1
- package/dist/hermetic-test-env.test.d.ts +0 -2
- package/dist/hermetic-test-env.test.d.ts.map +0 -1
- package/dist/hermetic-test-env.test.js +0 -61
- package/dist/hermetic-test-env.test.js.map +0 -1
- package/dist/hq-root-recovery.test.d.ts +0 -2
- package/dist/hq-root-recovery.test.d.ts.map +0 -1
- package/dist/hq-root-recovery.test.js +0 -65
- package/dist/hq-root-recovery.test.js.map +0 -1
- package/dist/ignore.test.d.ts +0 -10
- package/dist/ignore.test.d.ts.map +0 -1
- package/dist/ignore.test.js +0 -926
- package/dist/ignore.test.js.map +0 -1
- package/dist/index.test.d.ts +0 -2
- package/dist/index.test.d.ts.map +0 -1
- package/dist/index.test.js +0 -26
- package/dist/index.test.js.map +0 -1
- package/dist/journal-area-ledger-read-boundary.test.d.ts +0 -2
- package/dist/journal-area-ledger-read-boundary.test.d.ts.map +0 -1
- package/dist/journal-area-ledger-read-boundary.test.js +0 -420
- package/dist/journal-area-ledger-read-boundary.test.js.map +0 -1
- package/dist/journal-baseline.test.d.ts +0 -2
- package/dist/journal-baseline.test.d.ts.map +0 -1
- package/dist/journal-baseline.test.js +0 -218
- package/dist/journal-baseline.test.js.map +0 -1
- package/dist/journal-decode-window.test.d.ts +0 -2
- package/dist/journal-decode-window.test.d.ts.map +0 -1
- package/dist/journal-decode-window.test.js +0 -99
- package/dist/journal-decode-window.test.js.map +0 -1
- package/dist/journal-delta-writes.test.d.ts +0 -2
- package/dist/journal-delta-writes.test.d.ts.map +0 -1
- package/dist/journal-delta-writes.test.js +0 -159
- package/dist/journal-delta-writes.test.js.map +0 -1
- package/dist/journal-ledger-index.test.d.ts +0 -15
- package/dist/journal-ledger-index.test.d.ts.map +0 -1
- package/dist/journal-ledger-index.test.js +0 -269
- package/dist/journal-ledger-index.test.js.map +0 -1
- package/dist/journal-public-boundary.test.d.ts +0 -2
- package/dist/journal-public-boundary.test.d.ts.map +0 -1
- package/dist/journal-public-boundary.test.js +0 -216
- package/dist/journal-public-boundary.test.js.map +0 -1
- package/dist/journal-row-store.test.d.ts +0 -2
- package/dist/journal-row-store.test.d.ts.map +0 -1
- package/dist/journal-row-store.test.js +0 -729
- package/dist/journal-row-store.test.js.map +0 -1
- package/dist/journal-snapshot-memory-helpers.d.ts +0 -33
- package/dist/journal-snapshot-memory-helpers.d.ts.map +0 -1
- package/dist/journal-snapshot-memory-helpers.js +0 -212
- package/dist/journal-snapshot-memory-helpers.js.map +0 -1
- package/dist/journal-snapshot-memory.test.d.ts +0 -2
- package/dist/journal-snapshot-memory.test.d.ts.map +0 -1
- package/dist/journal-snapshot-memory.test.js +0 -47
- package/dist/journal-snapshot-memory.test.js.map +0 -1
- package/dist/journal-snapshot-v4-memory.test.d.ts +0 -2
- package/dist/journal-snapshot-v4-memory.test.d.ts.map +0 -1
- package/dist/journal-snapshot-v4-memory.test.js +0 -24
- package/dist/journal-snapshot-v4-memory.test.js.map +0 -1
- package/dist/journal-snapshot-v4-writer-memory.test.d.ts +0 -2
- package/dist/journal-snapshot-v4-writer-memory.test.d.ts.map +0 -1
- package/dist/journal-snapshot-v4-writer-memory.test.js +0 -76
- package/dist/journal-snapshot-v4-writer-memory.test.js.map +0 -1
- package/dist/journal-snapshot-v4-writer.test.d.ts +0 -2
- package/dist/journal-snapshot-v4-writer.test.d.ts.map +0 -1
- package/dist/journal-snapshot-v4-writer.test.js +0 -282
- package/dist/journal-snapshot-v4-writer.test.js.map +0 -1
- package/dist/journal-snapshot-v4.test.d.ts +0 -2
- package/dist/journal-snapshot-v4.test.d.ts.map +0 -1
- package/dist/journal-snapshot-v4.test.js +0 -281
- package/dist/journal-snapshot-v4.test.js.map +0 -1
- package/dist/journal-store.test.d.ts +0 -2
- package/dist/journal-store.test.d.ts.map +0 -1
- package/dist/journal-store.test.js +0 -1227
- package/dist/journal-store.test.js.map +0 -1
- package/dist/journal-streaming.heap.test.d.ts +0 -2
- package/dist/journal-streaming.heap.test.d.ts.map +0 -1
- package/dist/journal-streaming.heap.test.js +0 -190
- package/dist/journal-streaming.heap.test.js.map +0 -1
- package/dist/journal.test.d.ts +0 -9
- package/dist/journal.test.d.ts.map +0 -1
- package/dist/journal.test.js +0 -1074
- package/dist/journal.test.js.map +0 -1
- package/dist/kms10-etag-safe-pull.test.d.ts +0 -2
- package/dist/kms10-etag-safe-pull.test.d.ts.map +0 -1
- package/dist/kms10-etag-safe-pull.test.js +0 -53
- package/dist/kms10-etag-safe-pull.test.js.map +0 -1
- package/dist/lib/cloud-authoritative.test.d.ts +0 -2
- package/dist/lib/cloud-authoritative.test.d.ts.map +0 -1
- package/dist/lib/cloud-authoritative.test.js +0 -42
- package/dist/lib/cloud-authoritative.test.js.map +0 -1
- package/dist/lib/conflict-reconcile.test.d.ts +0 -7
- package/dist/lib/conflict-reconcile.test.d.ts.map +0 -1
- package/dist/lib/conflict-reconcile.test.js +0 -246
- package/dist/lib/conflict-reconcile.test.js.map +0 -1
- package/dist/lib/conflict.test.d.ts +0 -9
- package/dist/lib/conflict.test.d.ts.map +0 -1
- package/dist/lib/conflict.test.js +0 -340
- package/dist/lib/conflict.test.js.map +0 -1
- package/dist/lib/describe-error.test.d.ts +0 -2
- package/dist/lib/describe-error.test.d.ts.map +0 -1
- package/dist/lib/describe-error.test.js +0 -148
- package/dist/lib/describe-error.test.js.map +0 -1
- package/dist/lib/machine-id.test.d.ts +0 -8
- package/dist/lib/machine-id.test.d.ts.map +0 -1
- package/dist/lib/machine-id.test.js +0 -228
- package/dist/lib/machine-id.test.js.map +0 -1
- package/dist/lib/net-errors.test.d.ts +0 -2
- package/dist/lib/net-errors.test.d.ts.map +0 -1
- package/dist/lib/net-errors.test.js +0 -111
- package/dist/lib/net-errors.test.js.map +0 -1
- package/dist/lib/ontology-entity-meta.test.d.ts +0 -2
- package/dist/lib/ontology-entity-meta.test.d.ts.map +0 -1
- package/dist/lib/ontology-entity-meta.test.js +0 -79
- package/dist/lib/ontology-entity-meta.test.js.map +0 -1
- package/dist/lib/ontology-entity-push.test.d.ts +0 -2
- package/dist/lib/ontology-entity-push.test.d.ts.map +0 -1
- package/dist/lib/ontology-entity-push.test.js +0 -156
- package/dist/lib/ontology-entity-push.test.js.map +0 -1
- package/dist/lib/personal-connector-settings-sync.test.d.ts +0 -2
- package/dist/lib/personal-connector-settings-sync.test.d.ts.map +0 -1
- package/dist/lib/personal-connector-settings-sync.test.js +0 -34
- package/dist/lib/personal-connector-settings-sync.test.js.map +0 -1
- package/dist/lib/readlink-safe.test.d.ts +0 -2
- package/dist/lib/readlink-safe.test.d.ts.map +0 -1
- package/dist/lib/readlink-safe.test.js +0 -34
- package/dist/lib/readlink-safe.test.js.map +0 -1
- package/dist/lib/s3-content-checksum.test.d.ts +0 -2
- package/dist/lib/s3-content-checksum.test.d.ts.map +0 -1
- package/dist/lib/s3-content-checksum.test.js +0 -26
- package/dist/lib/s3-content-checksum.test.js.map +0 -1
- package/dist/lib/skill-register-landed-bytes.test.d.ts +0 -2
- package/dist/lib/skill-register-landed-bytes.test.d.ts.map +0 -1
- package/dist/lib/skill-register-landed-bytes.test.js +0 -83
- package/dist/lib/skill-register-landed-bytes.test.js.map +0 -1
- package/dist/local-path-codec.test.d.ts +0 -14
- package/dist/local-path-codec.test.d.ts.map +0 -1
- package/dist/local-path-codec.test.js +0 -122
- package/dist/local-path-codec.test.js.map +0 -1
- package/dist/machine-auth.test.d.ts +0 -14
- package/dist/machine-auth.test.d.ts.map +0 -1
- package/dist/machine-auth.test.js +0 -1492
- package/dist/machine-auth.test.js.map +0 -1
- package/dist/machine-token-cache-isolation.test.d.ts +0 -24
- package/dist/machine-token-cache-isolation.test.d.ts.map +0 -1
- package/dist/machine-token-cache-isolation.test.js +0 -284
- package/dist/machine-token-cache-isolation.test.js.map +0 -1
- package/dist/manifest/US-002.acceptance.test.d.ts +0 -11
- package/dist/manifest/US-002.acceptance.test.d.ts.map +0 -1
- package/dist/manifest/US-002.acceptance.test.js +0 -160
- package/dist/manifest/US-002.acceptance.test.js.map +0 -1
- package/dist/manifest/US-004.acceptance.test.d.ts +0 -12
- package/dist/manifest/US-004.acceptance.test.d.ts.map +0 -1
- package/dist/manifest/US-004.acceptance.test.js +0 -173
- package/dist/manifest/US-004.acceptance.test.js.map +0 -1
- package/dist/manifest/build-manifest-resident-parity.test.d.ts +0 -2
- package/dist/manifest/build-manifest-resident-parity.test.d.ts.map +0 -1
- package/dist/manifest/build-manifest-resident-parity.test.js +0 -69
- package/dist/manifest/build-manifest-resident-parity.test.js.map +0 -1
- package/dist/manifest/build-manifest.bench.test.d.ts +0 -22
- package/dist/manifest/build-manifest.bench.test.d.ts.map +0 -1
- package/dist/manifest/build-manifest.bench.test.js +0 -930
- package/dist/manifest/build-manifest.bench.test.js.map +0 -1
- package/dist/manifest/build-manifest.test.d.ts +0 -10
- package/dist/manifest/build-manifest.test.d.ts.map +0 -1
- package/dist/manifest/build-manifest.test.js +0 -1217
- package/dist/manifest/build-manifest.test.js.map +0 -1
- package/dist/manifest/contract.test.d.ts +0 -17
- package/dist/manifest/contract.test.d.ts.map +0 -1
- package/dist/manifest/contract.test.js +0 -346
- package/dist/manifest/contract.test.js.map +0 -1
- package/dist/manifest/import-graph.test.d.ts +0 -25
- package/dist/manifest/import-graph.test.d.ts.map +0 -1
- package/dist/manifest/import-graph.test.js +0 -120
- package/dist/manifest/import-graph.test.js.map +0 -1
- package/dist/manifest/ledger-shard-isolation.test.d.ts +0 -18
- package/dist/manifest/ledger-shard-isolation.test.d.ts.map +0 -1
- package/dist/manifest/ledger-shard-isolation.test.js +0 -153
- package/dist/manifest/ledger-shard-isolation.test.js.map +0 -1
- package/dist/manifest/snapshot-store.test.d.ts +0 -11
- package/dist/manifest/snapshot-store.test.d.ts.map +0 -1
- package/dist/manifest/snapshot-store.test.js +0 -206
- package/dist/manifest/snapshot-store.test.js.map +0 -1
- package/dist/manifest/upload-manifest.test.d.ts +0 -10
- package/dist/manifest/upload-manifest.test.d.ts.map +0 -1
- package/dist/manifest/upload-manifest.test.js +0 -1335
- package/dist/manifest/upload-manifest.test.js.map +0 -1
- package/dist/manifest-reconcile.test.d.ts +0 -2
- package/dist/manifest-reconcile.test.d.ts.map +0 -1
- package/dist/manifest-reconcile.test.js +0 -1029
- package/dist/manifest-reconcile.test.js.map +0 -1
- package/dist/object-io.test.d.ts +0 -11
- package/dist/object-io.test.d.ts.map +0 -1
- package/dist/object-io.test.js +0 -2376
- package/dist/object-io.test.js.map +0 -1
- package/dist/operation-lock.test.d.ts +0 -5
- package/dist/operation-lock.test.d.ts.map +0 -1
- package/dist/operation-lock.test.js +0 -796
- package/dist/operation-lock.test.js.map +0 -1
- package/dist/outcome-telemetry.test.d.ts +0 -9
- package/dist/outcome-telemetry.test.d.ts.map +0 -1
- package/dist/outcome-telemetry.test.js +0 -663
- package/dist/outcome-telemetry.test.js.map +0 -1
- package/dist/outposts/client.test.d.ts +0 -9
- package/dist/outposts/client.test.d.ts.map +0 -1
- package/dist/outposts/client.test.js +0 -415
- package/dist/outposts/client.test.js.map +0 -1
- package/dist/outposts/command.test.d.ts +0 -18
- package/dist/outposts/command.test.d.ts.map +0 -1
- package/dist/outposts/command.test.js +0 -1230
- package/dist/outposts/command.test.js.map +0 -1
- package/dist/outposts/replica-sync.test.d.ts +0 -2
- package/dist/outposts/replica-sync.test.d.ts.map +0 -1
- package/dist/outposts/replica-sync.test.js +0 -224
- package/dist/outposts/replica-sync.test.js.map +0 -1
- package/dist/outposts/self-deploy.test.d.ts +0 -2
- package/dist/outposts/self-deploy.test.d.ts.map +0 -1
- package/dist/outposts/self-deploy.test.js +0 -218
- package/dist/outposts/self-deploy.test.js.map +0 -1
- package/dist/outposts/session-heartbeat-bounds.test.d.ts +0 -25
- package/dist/outposts/session-heartbeat-bounds.test.d.ts.map +0 -1
- package/dist/outposts/session-heartbeat-bounds.test.js +0 -156
- package/dist/outposts/session-heartbeat-bounds.test.js.map +0 -1
- package/dist/outposts/session-heartbeat-guard.test.d.ts +0 -16
- package/dist/outposts/session-heartbeat-guard.test.d.ts.map +0 -1
- package/dist/outposts/session-heartbeat-guard.test.js +0 -88
- package/dist/outposts/session-heartbeat-guard.test.js.map +0 -1
- package/dist/outposts/session-heartbeat-publisher.test.d.ts +0 -10
- package/dist/outposts/session-heartbeat-publisher.test.d.ts.map +0 -1
- package/dist/outposts/session-heartbeat-publisher.test.js +0 -153
- package/dist/outposts/session-heartbeat-publisher.test.js.map +0 -1
- package/dist/outposts/session-heartbeat-retain-guard.test.d.ts +0 -18
- package/dist/outposts/session-heartbeat-retain-guard.test.d.ts.map +0 -1
- package/dist/outposts/session-heartbeat-retain-guard.test.js +0 -106
- package/dist/outposts/session-heartbeat-retain-guard.test.js.map +0 -1
- package/dist/outposts/session-heartbeat-scan.test.d.ts +0 -20
- package/dist/outposts/session-heartbeat-scan.test.d.ts.map +0 -1
- package/dist/outposts/session-heartbeat-scan.test.js +0 -241
- package/dist/outposts/session-heartbeat-scan.test.js.map +0 -1
- package/dist/outposts/session-heartbeat.test.d.ts +0 -11
- package/dist/outposts/session-heartbeat.test.d.ts.map +0 -1
- package/dist/outposts/session-heartbeat.test.js +0 -370
- package/dist/outposts/session-heartbeat.test.js.map +0 -1
- package/dist/outposts/session-host-auth.test.d.ts +0 -16
- package/dist/outposts/session-host-auth.test.d.ts.map +0 -1
- package/dist/outposts/session-host-auth.test.js +0 -284
- package/dist/outposts/session-host-auth.test.js.map +0 -1
- package/dist/outposts/session-host-command.test.d.ts +0 -10
- package/dist/outposts/session-host-command.test.d.ts.map +0 -1
- package/dist/outposts/session-host-command.test.js +0 -180
- package/dist/outposts/session-host-command.test.js.map +0 -1
- package/dist/outposts/session-host-connection.test.d.ts +0 -18
- package/dist/outposts/session-host-connection.test.d.ts.map +0 -1
- package/dist/outposts/session-host-connection.test.js +0 -392
- package/dist/outposts/session-host-connection.test.js.map +0 -1
- package/dist/outposts/session-host-fakes.d.ts +0 -61
- package/dist/outposts/session-host-fakes.d.ts.map +0 -1
- package/dist/outposts/session-host-fakes.js +0 -115
- package/dist/outposts/session-host-fakes.js.map +0 -1
- package/dist/outposts/session-host-ndjson.test.d.ts +0 -11
- package/dist/outposts/session-host-ndjson.test.d.ts.map +0 -1
- package/dist/outposts/session-host-ndjson.test.js +0 -73
- package/dist/outposts/session-host-ndjson.test.js.map +0 -1
- package/dist/outposts/session-host-protocol.test.d.ts +0 -15
- package/dist/outposts/session-host-protocol.test.d.ts.map +0 -1
- package/dist/outposts/session-host-protocol.test.js +0 -0
- package/dist/outposts/session-host-protocol.test.js.map +0 -1
- package/dist/outposts/session-host-server.test.d.ts +0 -10
- package/dist/outposts/session-host-server.test.d.ts.map +0 -1
- package/dist/outposts/session-host-server.test.js +0 -118
- package/dist/outposts/session-host-server.test.js.map +0 -1
- package/dist/outposts/session-host-sessions.test.d.ts +0 -18
- package/dist/outposts/session-host-sessions.test.d.ts.map +0 -1
- package/dist/outposts/session-host-sessions.test.js +0 -439
- package/dist/outposts/session-host-sessions.test.js.map +0 -1
- package/dist/outposts/terminal.test.d.ts +0 -2
- package/dist/outposts/terminal.test.d.ts.map +0 -1
- package/dist/outposts/terminal.test.js +0 -146
- package/dist/outposts/terminal.test.js.map +0 -1
- package/dist/outposts/transport.test.d.ts +0 -10
- package/dist/outposts/transport.test.d.ts.map +0 -1
- package/dist/outposts/transport.test.js +0 -205
- package/dist/outposts/transport.test.js.map +0 -1
- package/dist/packed-journal-phase2.test.d.ts +0 -2
- package/dist/packed-journal-phase2.test.d.ts.map +0 -1
- package/dist/packed-journal-phase2.test.js +0 -273
- package/dist/packed-journal-phase2.test.js.map +0 -1
- package/dist/path-ancestors.test.d.ts +0 -2
- package/dist/path-ancestors.test.d.ts.map +0 -1
- package/dist/path-ancestors.test.js +0 -21
- package/dist/path-ancestors.test.js.map +0 -1
- package/dist/personal-vault-exclusions.test.d.ts +0 -22
- package/dist/personal-vault-exclusions.test.d.ts.map +0 -1
- package/dist/personal-vault-exclusions.test.js +0 -294
- package/dist/personal-vault-exclusions.test.js.map +0 -1
- package/dist/personal-vault.test.d.ts +0 -18
- package/dist/personal-vault.test.d.ts.map +0 -1
- package/dist/personal-vault.test.js +0 -1099
- package/dist/personal-vault.test.js.map +0 -1
- package/dist/plan-limit-pause.test.d.ts +0 -2
- package/dist/plan-limit-pause.test.d.ts.map +0 -1
- package/dist/plan-limit-pause.test.js +0 -150
- package/dist/plan-limit-pause.test.js.map +0 -1
- package/dist/plan-limit.fixtures.d.ts +0 -34
- package/dist/plan-limit.fixtures.d.ts.map +0 -1
- package/dist/plan-limit.fixtures.js +0 -96
- package/dist/plan-limit.fixtures.js.map +0 -1
- package/dist/plan-limit.test.d.ts +0 -2
- package/dist/plan-limit.test.d.ts.map +0 -1
- package/dist/plan-limit.test.js +0 -132
- package/dist/plan-limit.test.js.map +0 -1
- package/dist/prefix-coalesce.test.d.ts +0 -2
- package/dist/prefix-coalesce.test.d.ts.map +0 -1
- package/dist/prefix-coalesce.test.js +0 -260
- package/dist/prefix-coalesce.test.js.map +0 -1
- package/dist/private-folder-transport.test.d.ts +0 -2
- package/dist/private-folder-transport.test.d.ts.map +0 -1
- package/dist/private-folder-transport.test.js +0 -33
- package/dist/private-folder-transport.test.js.map +0 -1
- package/dist/public-surface.test.d.ts +0 -15
- package/dist/public-surface.test.d.ts.map +0 -1
- package/dist/public-surface.test.js +0 -110
- package/dist/public-surface.test.js.map +0 -1
- package/dist/qmd-reindex.test.d.ts +0 -14
- package/dist/qmd-reindex.test.d.ts.map +0 -1
- package/dist/qmd-reindex.test.js +0 -899
- package/dist/qmd-reindex.test.js.map +0 -1
- package/dist/read-only-state-dir.test.d.ts +0 -27
- package/dist/read-only-state-dir.test.d.ts.map +0 -1
- package/dist/read-only-state-dir.test.js +0 -167
- package/dist/read-only-state-dir.test.js.map +0 -1
- package/dist/remote-pull.test.d.ts +0 -2
- package/dist/remote-pull.test.d.ts.map +0 -1
- package/dist/remote-pull.test.js +0 -1147
- package/dist/remote-pull.test.js.map +0 -1
- package/dist/s3-download-stream-hash.test.d.ts +0 -2
- package/dist/s3-download-stream-hash.test.d.ts.map +0 -1
- package/dist/s3-download-stream-hash.test.js +0 -70
- package/dist/s3-download-stream-hash.test.js.map +0 -1
- package/dist/s3.list-cost.test.d.ts +0 -2
- package/dist/s3.list-cost.test.d.ts.map +0 -1
- package/dist/s3.list-cost.test.js +0 -51
- package/dist/s3.list-cost.test.js.map +0 -1
- package/dist/s3.rename-retry.test.d.ts +0 -2
- package/dist/s3.rename-retry.test.d.ts.map +0 -1
- package/dist/s3.rename-retry.test.js +0 -217
- package/dist/s3.rename-retry.test.js.map +0 -1
- package/dist/s3.symlink-materialize.test.d.ts +0 -18
- package/dist/s3.symlink-materialize.test.d.ts.map +0 -1
- package/dist/s3.symlink-materialize.test.js +0 -579
- package/dist/s3.symlink-materialize.test.js.map +0 -1
- package/dist/s3.test.d.ts +0 -9
- package/dist/s3.test.d.ts.map +0 -1
- package/dist/s3.test.js +0 -2047
- package/dist/s3.test.js.map +0 -1
- package/dist/s3.windows-portability.test.d.ts +0 -12
- package/dist/s3.windows-portability.test.d.ts.map +0 -1
- package/dist/s3.windows-portability.test.js +0 -223
- package/dist/s3.windows-portability.test.js.map +0 -1
- package/dist/schemas/signal-types.test.d.ts +0 -2
- package/dist/schemas/signal-types.test.d.ts.map +0 -1
- package/dist/schemas/signal-types.test.js +0 -65
- package/dist/schemas/signal-types.test.js.map +0 -1
- package/dist/schemas/source-channels.test.d.ts +0 -2
- package/dist/schemas/source-channels.test.d.ts.map +0 -1
- package/dist/schemas/source-channels.test.js +0 -65
- package/dist/schemas/source-channels.test.js.map +0 -1
- package/dist/scope-shrink.test.d.ts +0 -13
- package/dist/scope-shrink.test.d.ts.map +0 -1
- package/dist/scope-shrink.test.js +0 -558
- package/dist/scope-shrink.test.js.map +0 -1
- package/dist/session-log-capture.test.d.ts +0 -2
- package/dist/session-log-capture.test.d.ts.map +0 -1
- package/dist/session-log-capture.test.js +0 -533
- package/dist/session-log-capture.test.js.map +0 -1
- package/dist/session-log-retention.test.d.ts +0 -2
- package/dist/session-log-retention.test.d.ts.map +0 -1
- package/dist/session-log-retention.test.js +0 -383
- package/dist/session-log-retention.test.js.map +0 -1
- package/dist/signals/get.test.d.ts +0 -5
- package/dist/signals/get.test.d.ts.map +0 -1
- package/dist/signals/get.test.js +0 -254
- package/dist/signals/get.test.js.map +0 -1
- package/dist/signals/list.test.d.ts +0 -9
- package/dist/signals/list.test.d.ts.map +0 -1
- package/dist/signals/list.test.js +0 -330
- package/dist/signals/list.test.js.map +0 -1
- package/dist/skill-telemetry.test.d.ts +0 -2
- package/dist/skill-telemetry.test.d.ts.map +0 -1
- package/dist/skill-telemetry.test.js +0 -1484
- package/dist/skill-telemetry.test.js.map +0 -1
- package/dist/sources/get.test.d.ts +0 -5
- package/dist/sources/get.test.d.ts.map +0 -1
- package/dist/sources/get.test.js +0 -236
- package/dist/sources/get.test.js.map +0 -1
- package/dist/sources/list.test.d.ts +0 -8
- package/dist/sources/list.test.d.ts.map +0 -1
- package/dist/sources/list.test.js +0 -318
- package/dist/sources/list.test.js.map +0 -1
- package/dist/sts-credential-refresh.test.d.ts +0 -2
- package/dist/sts-credential-refresh.test.d.ts.map +0 -1
- package/dist/sts-credential-refresh.test.js +0 -181
- package/dist/sts-credential-refresh.test.js.map +0 -1
- package/dist/swallowed-error-sites.test.d.ts +0 -2
- package/dist/swallowed-error-sites.test.d.ts.map +0 -1
- package/dist/swallowed-error-sites.test.js +0 -199
- package/dist/swallowed-error-sites.test.js.map +0 -1
- package/dist/swallowed-error-w32.test.d.ts +0 -2
- package/dist/swallowed-error-w32.test.d.ts.map +0 -1
- package/dist/swallowed-error-w32.test.js +0 -171
- package/dist/swallowed-error-w32.test.js.map +0 -1
- package/dist/swallowed-error-w33.test.d.ts +0 -2
- package/dist/swallowed-error-w33.test.d.ts.map +0 -1
- package/dist/swallowed-error-w33.test.js +0 -125
- package/dist/swallowed-error-w33.test.js.map +0 -1
- package/dist/swallowed-error-w34.test.d.ts +0 -2
- package/dist/swallowed-error-w34.test.d.ts.map +0 -1
- package/dist/swallowed-error-w34.test.js +0 -110
- package/dist/swallowed-error-w34.test.js.map +0 -1
- package/dist/swallowed-error-w35.test.d.ts +0 -2
- package/dist/swallowed-error-w35.test.d.ts.map +0 -1
- package/dist/swallowed-error-w35.test.js +0 -223
- package/dist/swallowed-error-w35.test.js.map +0 -1
- package/dist/sync/area-ledger-auto-migration.test.d.ts +0 -2
- package/dist/sync/area-ledger-auto-migration.test.d.ts.map +0 -1
- package/dist/sync/area-ledger-auto-migration.test.js +0 -291
- package/dist/sync/area-ledger-auto-migration.test.js.map +0 -1
- package/dist/sync/area-ledger-migration.test.d.ts +0 -2
- package/dist/sync/area-ledger-migration.test.d.ts.map +0 -1
- package/dist/sync/area-ledger-migration.test.js +0 -554
- package/dist/sync/area-ledger-migration.test.js.map +0 -1
- package/dist/sync/area-ledger-recovery.bench.test.d.ts +0 -2
- package/dist/sync/area-ledger-recovery.bench.test.d.ts.map +0 -1
- package/dist/sync/area-ledger-recovery.bench.test.js +0 -60
- package/dist/sync/area-ledger-recovery.bench.test.js.map +0 -1
- package/dist/sync/area-ledger-writer-lock.bench.test.d.ts +0 -2
- package/dist/sync/area-ledger-writer-lock.bench.test.d.ts.map +0 -1
- package/dist/sync/area-ledger-writer-lock.bench.test.js +0 -57
- package/dist/sync/area-ledger-writer-lock.bench.test.js.map +0 -1
- package/dist/sync/area-ledger.test.d.ts +0 -2
- package/dist/sync/area-ledger.test.d.ts.map +0 -1
- package/dist/sync/area-ledger.test.js +0 -1401
- package/dist/sync/area-ledger.test.js.map +0 -1
- package/dist/sync/area-resolver.test.d.ts +0 -2
- package/dist/sync/area-resolver.test.d.ts.map +0 -1
- package/dist/sync/area-resolver.test.js +0 -234
- package/dist/sync/area-resolver.test.js.map +0 -1
- package/dist/sync/base-version-resolver.test.d.ts +0 -2
- package/dist/sync/base-version-resolver.test.d.ts.map +0 -1
- package/dist/sync/base-version-resolver.test.js +0 -24
- package/dist/sync/base-version-resolver.test.js.map +0 -1
- package/dist/sync/candidate-uploader.test.d.ts +0 -2
- package/dist/sync/candidate-uploader.test.d.ts.map +0 -1
- package/dist/sync/candidate-uploader.test.js +0 -132
- package/dist/sync/candidate-uploader.test.js.map +0 -1
- package/dist/sync/child-process-sync-worker-env.test.d.ts +0 -2
- package/dist/sync/child-process-sync-worker-env.test.d.ts.map +0 -1
- package/dist/sync/child-process-sync-worker-env.test.js +0 -38
- package/dist/sync/child-process-sync-worker-env.test.js.map +0 -1
- package/dist/sync/child-process-sync-worker-errors.test.d.ts +0 -2
- package/dist/sync/child-process-sync-worker-errors.test.d.ts.map +0 -1
- package/dist/sync/child-process-sync-worker-errors.test.js +0 -121
- package/dist/sync/child-process-sync-worker-errors.test.js.map +0 -1
- package/dist/sync/child-process-sync-worker.test.d.ts +0 -2
- package/dist/sync/child-process-sync-worker.test.d.ts.map +0 -1
- package/dist/sync/child-process-sync-worker.test.js +0 -262
- package/dist/sync/child-process-sync-worker.test.js.map +0 -1
- package/dist/sync/content-hash.test.d.ts +0 -2
- package/dist/sync/content-hash.test.d.ts.map +0 -1
- package/dist/sync/content-hash.test.js +0 -16
- package/dist/sync/content-hash.test.js.map +0 -1
- package/dist/sync/delta-client.test.d.ts +0 -2
- package/dist/sync/delta-client.test.d.ts.map +0 -1
- package/dist/sync/delta-client.test.js +0 -97
- package/dist/sync/delta-client.test.js.map +0 -1
- package/dist/sync/durable-apply.test.d.ts +0 -2
- package/dist/sync/durable-apply.test.d.ts.map +0 -1
- package/dist/sync/durable-apply.test.js +0 -180
- package/dist/sync/durable-apply.test.js.map +0 -1
- package/dist/sync/event-sync.test.d.ts +0 -14
- package/dist/sync/event-sync.test.d.ts.map +0 -1
- package/dist/sync/event-sync.test.js +0 -1714
- package/dist/sync/event-sync.test.js.map +0 -1
- package/dist/sync/feature-flags.test.d.ts +0 -24
- package/dist/sync/feature-flags.test.d.ts.map +0 -1
- package/dist/sync/feature-flags.test.js +0 -594
- package/dist/sync/feature-flags.test.js.map +0 -1
- package/dist/sync/full-pass-cap-governor.bench.test.d.ts +0 -2
- package/dist/sync/full-pass-cap-governor.bench.test.d.ts.map +0 -1
- package/dist/sync/full-pass-cap-governor.bench.test.js +0 -179
- package/dist/sync/full-pass-cap-governor.bench.test.js.map +0 -1
- package/dist/sync/full-pass-caps.test.d.ts +0 -2
- package/dist/sync/full-pass-caps.test.d.ts.map +0 -1
- package/dist/sync/full-pass-caps.test.js +0 -550
- package/dist/sync/full-pass-caps.test.js.map +0 -1
- package/dist/sync/idle-full-reconcile.test.d.ts +0 -2
- package/dist/sync/idle-full-reconcile.test.d.ts.map +0 -1
- package/dist/sync/idle-full-reconcile.test.js +0 -62
- package/dist/sync/idle-full-reconcile.test.js.map +0 -1
- package/dist/sync/inbound-event-admission.test.d.ts +0 -2
- package/dist/sync/inbound-event-admission.test.d.ts.map +0 -1
- package/dist/sync/inbound-event-admission.test.js +0 -125
- package/dist/sync/inbound-event-admission.test.js.map +0 -1
- package/dist/sync/journal-ledger-stream.test.d.ts +0 -12
- package/dist/sync/journal-ledger-stream.test.d.ts.map +0 -1
- package/dist/sync/journal-ledger-stream.test.js +0 -134
- package/dist/sync/journal-ledger-stream.test.js.map +0 -1
- package/dist/sync/lease-client.test.d.ts +0 -2
- package/dist/sync/lease-client.test.d.ts.map +0 -1
- package/dist/sync/lease-client.test.js +0 -119
- package/dist/sync/lease-client.test.js.map +0 -1
- package/dist/sync/logger.test.d.ts +0 -19
- package/dist/sync/logger.test.d.ts.map +0 -1
- package/dist/sync/logger.test.js +0 -204
- package/dist/sync/logger.test.js.map +0 -1
- package/dist/sync/metrics.test.d.ts +0 -19
- package/dist/sync/metrics.test.d.ts.map +0 -1
- package/dist/sync/metrics.test.js +0 -357
- package/dist/sync/metrics.test.js.map +0 -1
- package/dist/sync/multipart-uploader.test.d.ts +0 -2
- package/dist/sync/multipart-uploader.test.d.ts.map +0 -1
- package/dist/sync/multipart-uploader.test.js +0 -135
- package/dist/sync/multipart-uploader.test.js.map +0 -1
- package/dist/sync/mutation-client.test.d.ts +0 -2
- package/dist/sync/mutation-client.test.d.ts.map +0 -1
- package/dist/sync/mutation-client.test.js +0 -100
- package/dist/sync/mutation-client.test.js.map +0 -1
- package/dist/sync/mutation-session.test.d.ts +0 -2
- package/dist/sync/mutation-session.test.d.ts.map +0 -1
- package/dist/sync/mutation-session.test.js +0 -190
- package/dist/sync/mutation-session.test.js.map +0 -1
- package/dist/sync/parallel-sync-coordinator.test.d.ts +0 -2
- package/dist/sync/parallel-sync-coordinator.test.d.ts.map +0 -1
- package/dist/sync/parallel-sync-coordinator.test.js +0 -564
- package/dist/sync/parallel-sync-coordinator.test.js.map +0 -1
- package/dist/sync/path-leases.test.d.ts +0 -2
- package/dist/sync/path-leases.test.d.ts.map +0 -1
- package/dist/sync/path-leases.test.js +0 -51
- package/dist/sync/path-leases.test.js.map +0 -1
- package/dist/sync/per-area-maintenance.test.d.ts +0 -2
- package/dist/sync/per-area-maintenance.test.d.ts.map +0 -1
- package/dist/sync/per-area-maintenance.test.js +0 -100
- package/dist/sync/per-area-maintenance.test.js.map +0 -1
- package/dist/sync/push-event.test.d.ts +0 -15
- package/dist/sync/push-event.test.d.ts.map +0 -1
- package/dist/sync/push-event.test.js +0 -282
- package/dist/sync/push-event.test.js.map +0 -1
- package/dist/sync/push-receiver.test.d.ts +0 -25
- package/dist/sync/push-receiver.test.d.ts.map +0 -1
- package/dist/sync/push-receiver.test.js +0 -2851
- package/dist/sync/push-receiver.test.js.map +0 -1
- package/dist/sync/push-transport.test.d.ts +0 -2
- package/dist/sync/push-transport.test.d.ts.map +0 -1
- package/dist/sync/push-transport.test.js +0 -70
- package/dist/sync/push-transport.test.js.map +0 -1
- package/dist/sync/push-walk-matchers.bench.test.d.ts +0 -2
- package/dist/sync/push-walk-matchers.bench.test.d.ts.map +0 -1
- package/dist/sync/push-walk-matchers.bench.test.js +0 -230
- package/dist/sync/push-walk-matchers.bench.test.js.map +0 -1
- package/dist/sync/realtime-network-integration.test.d.ts +0 -2
- package/dist/sync/realtime-network-integration.test.d.ts.map +0 -1
- package/dist/sync/realtime-network-integration.test.js +0 -83
- package/dist/sync/realtime-network-integration.test.js.map +0 -1
- package/dist/sync/realtime-rollout.test.d.ts +0 -2
- package/dist/sync/realtime-rollout.test.d.ts.map +0 -1
- package/dist/sync/realtime-rollout.test.js +0 -94
- package/dist/sync/realtime-rollout.test.js.map +0 -1
- package/dist/sync/realtime-telemetry.test.d.ts +0 -2
- package/dist/sync/realtime-telemetry.test.d.ts.map +0 -1
- package/dist/sync/realtime-telemetry.test.js +0 -300
- package/dist/sync/realtime-telemetry.test.js.map +0 -1
- package/dist/sync/receiver-origin-config.test.d.ts +0 -2
- package/dist/sync/receiver-origin-config.test.d.ts.map +0 -1
- package/dist/sync/receiver-origin-config.test.js +0 -39
- package/dist/sync/receiver-origin-config.test.js.map +0 -1
- package/dist/sync/reconcile-cursor.test.d.ts +0 -2
- package/dist/sync/reconcile-cursor.test.d.ts.map +0 -1
- package/dist/sync/reconcile-cursor.test.js +0 -139
- package/dist/sync/reconcile-cursor.test.js.map +0 -1
- package/dist/sync/remote-file-spool.test.d.ts +0 -2
- package/dist/sync/remote-file-spool.test.d.ts.map +0 -1
- package/dist/sync/remote-file-spool.test.js +0 -77
- package/dist/sync/remote-file-spool.test.js.map +0 -1
- package/dist/sync/scope-inventory-client.test.d.ts +0 -2
- package/dist/sync/scope-inventory-client.test.d.ts.map +0 -1
- package/dist/sync/scope-inventory-client.test.js +0 -103
- package/dist/sync/scope-inventory-client.test.js.map +0 -1
- package/dist/sync/secret-path-policy.test.d.ts +0 -2
- package/dist/sync/secret-path-policy.test.d.ts.map +0 -1
- package/dist/sync/secret-path-policy.test.js +0 -183
- package/dist/sync/secret-path-policy.test.js.map +0 -1
- package/dist/sync/snapshot-client.test.d.ts +0 -2
- package/dist/sync/snapshot-client.test.d.ts.map +0 -1
- package/dist/sync/snapshot-client.test.js +0 -169
- package/dist/sync/snapshot-client.test.js.map +0 -1
- package/dist/sync/state-store.test.d.ts +0 -2
- package/dist/sync/state-store.test.d.ts.map +0 -1
- package/dist/sync/state-store.test.js +0 -1556
- package/dist/sync/state-store.test.js.map +0 -1
- package/dist/sync/sync-contract.test.d.ts +0 -2
- package/dist/sync/sync-contract.test.d.ts.map +0 -1
- package/dist/sync/sync-contract.test.js +0 -141
- package/dist/sync/sync-contract.test.js.map +0 -1
- package/dist/sync/targeted-pull-prefixes.test.d.ts +0 -2
- package/dist/sync/targeted-pull-prefixes.test.d.ts.map +0 -1
- package/dist/sync/targeted-pull-prefixes.test.js +0 -33
- package/dist/sync/targeted-pull-prefixes.test.js.map +0 -1
- package/dist/sync/targeted-upsert-exact-list.test.d.ts +0 -2
- package/dist/sync/targeted-upsert-exact-list.test.d.ts.map +0 -1
- package/dist/sync/targeted-upsert-exact-list.test.js +0 -247
- package/dist/sync/targeted-upsert-exact-list.test.js.map +0 -1
- package/dist/sync/unchanged-push-events.test.d.ts +0 -2
- package/dist/sync/unchanged-push-events.test.d.ts.map +0 -1
- package/dist/sync/unchanged-push-events.test.js +0 -76
- package/dist/sync/unchanged-push-events.test.js.map +0 -1
- package/dist/sync/uploader-finalization.test.d.ts +0 -2
- package/dist/sync/uploader-finalization.test.d.ts.map +0 -1
- package/dist/sync/uploader-finalization.test.js +0 -107
- package/dist/sync/uploader-finalization.test.js.map +0 -1
- package/dist/sync-core.test.d.ts +0 -2
- package/dist/sync-core.test.d.ts.map +0 -1
- package/dist/sync-core.test.js +0 -189
- package/dist/sync-core.test.js.map +0 -1
- package/dist/sync-progress.test.d.ts +0 -2
- package/dist/sync-progress.test.d.ts.map +0 -1
- package/dist/sync-progress.test.js +0 -277
- package/dist/sync-progress.test.js.map +0 -1
- package/dist/telemetry-events.test.d.ts +0 -2
- package/dist/telemetry-events.test.d.ts.map +0 -1
- package/dist/telemetry-events.test.js +0 -113
- package/dist/telemetry-events.test.js.map +0 -1
- package/dist/telemetry.test.d.ts +0 -11
- package/dist/telemetry.test.d.ts.map +0 -1
- package/dist/telemetry.test.js +0 -1603
- package/dist/telemetry.test.js.map +0 -1
- package/dist/vault-client.test.d.ts +0 -7
- package/dist/vault-client.test.d.ts.map +0 -1
- package/dist/vault-client.test.js +0 -1334
- package/dist/vault-client.test.js.map +0 -1
- package/dist/watch-coverage.test.d.ts +0 -2
- package/dist/watch-coverage.test.d.ts.map +0 -1
- package/dist/watch-coverage.test.js +0 -56
- package/dist/watch-coverage.test.js.map +0 -1
- package/dist/watch-owner-lease.test.d.ts +0 -2
- package/dist/watch-owner-lease.test.d.ts.map +0 -1
- package/dist/watch-owner-lease.test.js +0 -353
- package/dist/watch-owner-lease.test.js.map +0 -1
- package/dist/watch-parent.test.d.ts +0 -2
- package/dist/watch-parent.test.d.ts.map +0 -1
- package/dist/watch-parent.test.js +0 -131
- package/dist/watch-parent.test.js.map +0 -1
- package/dist/watch-roots.test.d.ts +0 -18
- package/dist/watch-roots.test.d.ts.map +0 -1
- package/dist/watch-roots.test.js +0 -395
- package/dist/watch-roots.test.js.map +0 -1
- package/dist/watcher-continuity-hot-path.test.d.ts +0 -2
- package/dist/watcher-continuity-hot-path.test.d.ts.map +0 -1
- package/dist/watcher-continuity-hot-path.test.js +0 -40
- package/dist/watcher-continuity-hot-path.test.js.map +0 -1
- package/dist/watcher-event-gate.test.d.ts +0 -16
- package/dist/watcher-event-gate.test.d.ts.map +0 -1
- package/dist/watcher-event-gate.test.js +0 -191
- package/dist/watcher-event-gate.test.js.map +0 -1
- package/dist/watcher-replan-sweep.test.d.ts +0 -2
- package/dist/watcher-replan-sweep.test.d.ts.map +0 -1
- package/dist/watcher-replan-sweep.test.js +0 -245
- package/dist/watcher-replan-sweep.test.js.map +0 -1
- package/dist/watcher-stdout.test.d.ts +0 -2
- package/dist/watcher-stdout.test.d.ts.map +0 -1
- package/dist/watcher-stdout.test.js +0 -86
- package/dist/watcher-stdout.test.js.map +0 -1
- package/dist/watcher.test.d.ts +0 -2
- package/dist/watcher.test.d.ts.map +0 -1
- package/dist/watcher.test.js +0 -4301
- package/dist/watcher.test.js.map +0 -1
- package/dist/watcher.warmup-cancel.test.d.ts +0 -2
- package/dist/watcher.warmup-cancel.test.d.ts.map +0 -1
- package/dist/watcher.warmup-cancel.test.js +0 -59
- package/dist/watcher.warmup-cancel.test.js.map +0 -1
- package/dist/watcher.warmup-responsive.test.d.ts +0 -2
- package/dist/watcher.warmup-responsive.test.d.ts.map +0 -1
- package/dist/watcher.warmup-responsive.test.js +0 -62
- package/dist/watcher.warmup-responsive.test.js.map +0 -1
|
@@ -1,1334 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* VaultClient unit tests (VLT-7 US-001).
|
|
3
|
-
*
|
|
4
|
-
* Uses mocked fetch to assert retry behavior, error mapping, and auth header injection.
|
|
5
|
-
*/
|
|
6
|
-
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
|
|
7
|
-
import { VaultClient, VaultAuthError, VaultPermissionDeniedError, VaultNotFoundError, VaultConflictError, VaultClientError, pickCanonicalPersonEntity, planLimitRefusalFromError, } from "./vault-client.js";
|
|
8
|
-
import { VaultCredentialScopeError } from "./credential-scope-error.js";
|
|
9
|
-
import { PLAN_LIMIT_UPGRADE_URL, canonicalPlanLimitBody, companyPresignRefusalRow, legacyMembershipPlanLimitBody, } from "./plan-limit.fixtures.js";
|
|
10
|
-
// ---------------------------------------------------------------------------
|
|
11
|
-
// Helpers
|
|
12
|
-
// ---------------------------------------------------------------------------
|
|
13
|
-
function jsonResponse(status, body) {
|
|
14
|
-
return new Response(JSON.stringify(body), {
|
|
15
|
-
status,
|
|
16
|
-
headers: { "Content-Type": "application/json" },
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
function textResponse(status, body) {
|
|
20
|
-
return new Response(body, { status });
|
|
21
|
-
}
|
|
22
|
-
const TEST_CONFIG = {
|
|
23
|
-
apiUrl: "https://vault.test.example.com",
|
|
24
|
-
authToken: "test-jwt-token-123",
|
|
25
|
-
};
|
|
26
|
-
let client;
|
|
27
|
-
let fetchSpy;
|
|
28
|
-
beforeEach(() => {
|
|
29
|
-
client = new VaultClient(TEST_CONFIG);
|
|
30
|
-
fetchSpy = vi.spyOn(globalThis, "fetch");
|
|
31
|
-
});
|
|
32
|
-
afterEach(() => {
|
|
33
|
-
vi.restoreAllMocks();
|
|
34
|
-
});
|
|
35
|
-
// ---------------------------------------------------------------------------
|
|
36
|
-
// Auth header injection
|
|
37
|
-
// ---------------------------------------------------------------------------
|
|
38
|
-
describe("auth header injection", () => {
|
|
39
|
-
it("sends Bearer token on every request", async () => {
|
|
40
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, { members: [] }));
|
|
41
|
-
await client.listMembersOfCompany("cmp_abc");
|
|
42
|
-
expect(fetchSpy).toHaveBeenCalledTimes(1);
|
|
43
|
-
const [, init] = fetchSpy.mock.calls[0];
|
|
44
|
-
const headers = init.headers;
|
|
45
|
-
expect(headers.Authorization).toBe("Bearer test-jwt-token-123");
|
|
46
|
-
});
|
|
47
|
-
it("sets Content-Type on POST requests", async () => {
|
|
48
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, { membership: {}, inviteToken: "tok" }));
|
|
49
|
-
await client.createInvite({
|
|
50
|
-
companyUid: "cmp_abc",
|
|
51
|
-
role: "member",
|
|
52
|
-
invitedBy: "psn_xyz",
|
|
53
|
-
});
|
|
54
|
-
const [, init] = fetchSpy.mock.calls[0];
|
|
55
|
-
const headers = init.headers;
|
|
56
|
-
expect(headers["Content-Type"]).toBe("application/json");
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
describe("company skill registration", () => {
|
|
60
|
-
it("posts canonical skill bytes to the authoritative registration route", async () => {
|
|
61
|
-
const content = "---\nname: Call Prep\n---\n";
|
|
62
|
-
const stamped = "---\nskill_uid: skl_CREATED1\nname: Call Prep\n---\n";
|
|
63
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(201, {
|
|
64
|
-
ok: true,
|
|
65
|
-
skillUid: "skl_CREATED1",
|
|
66
|
-
path: "skills/call-prep/SKILL.md",
|
|
67
|
-
vaultPath: "skills/call-prep/SKILL.md",
|
|
68
|
-
content: stamped,
|
|
69
|
-
action: "created",
|
|
70
|
-
accessPolicy: "open",
|
|
71
|
-
skill: {
|
|
72
|
-
name: "Call Prep",
|
|
73
|
-
description: "",
|
|
74
|
-
tags: [],
|
|
75
|
-
},
|
|
76
|
-
}));
|
|
77
|
-
const result = await client.registerCompanySkill("acme team", {
|
|
78
|
-
path: "skills/call-prep/SKILL.md",
|
|
79
|
-
content,
|
|
80
|
-
});
|
|
81
|
-
expect(result.skillUid).toBe("skl_CREATED1");
|
|
82
|
-
expect(fetchSpy).toHaveBeenCalledWith("https://vault.test.example.com/v1/files/skills/company/acme%20team/register", expect.objectContaining({
|
|
83
|
-
method: "POST",
|
|
84
|
-
body: JSON.stringify({
|
|
85
|
-
path: "skills/call-prep/SKILL.md",
|
|
86
|
-
content,
|
|
87
|
-
}),
|
|
88
|
-
}));
|
|
89
|
-
});
|
|
90
|
-
it("marks metadata reconciliation only after the caller confirms the bytes landed", async () => {
|
|
91
|
-
const content = "---\nskill_uid: skl_CREATED1\nname: Call Prep\n---\n";
|
|
92
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, {
|
|
93
|
-
ok: true,
|
|
94
|
-
skillUid: "skl_CREATED1",
|
|
95
|
-
path: "skills/call-prep/SKILL.md",
|
|
96
|
-
vaultPath: "skills/call-prep/SKILL.md",
|
|
97
|
-
content,
|
|
98
|
-
action: "reused",
|
|
99
|
-
accessPolicy: "preserved",
|
|
100
|
-
skill: { name: "Call Prep", description: "", tags: ["sales"] },
|
|
101
|
-
}));
|
|
102
|
-
await client.registerCompanySkill("acme", {
|
|
103
|
-
path: "skills/call-prep/SKILL.md",
|
|
104
|
-
content,
|
|
105
|
-
landed: true,
|
|
106
|
-
});
|
|
107
|
-
expect(fetchSpy).toHaveBeenCalledWith("https://vault.test.example.com/v1/files/skills/company/acme/register", expect.objectContaining({
|
|
108
|
-
method: "POST",
|
|
109
|
-
body: JSON.stringify({
|
|
110
|
-
path: "skills/call-prep/SKILL.md",
|
|
111
|
-
content,
|
|
112
|
-
landed: true,
|
|
113
|
-
}),
|
|
114
|
-
}));
|
|
115
|
-
});
|
|
116
|
-
it("rejects a response that does not contain a valid stamped identity", async () => {
|
|
117
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, {
|
|
118
|
-
ok: true,
|
|
119
|
-
skillUid: "not-a-skill-id",
|
|
120
|
-
path: "skills/call-prep/SKILL.md",
|
|
121
|
-
vaultPath: "skills/call-prep/SKILL.md",
|
|
122
|
-
content: "---\nname: Call Prep\n---\n",
|
|
123
|
-
action: "created",
|
|
124
|
-
accessPolicy: "open",
|
|
125
|
-
skill: { name: "Call Prep", description: "", tags: [] },
|
|
126
|
-
}));
|
|
127
|
-
await expect(client.registerCompanySkill("acme", {
|
|
128
|
-
path: "skills/call-prep/SKILL.md",
|
|
129
|
-
content: "---\nname: Call Prep\n---\n",
|
|
130
|
-
})).rejects.toThrow(/invalid response/i);
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
|
-
// ---------------------------------------------------------------------------
|
|
134
|
-
// Error mapping
|
|
135
|
-
// ---------------------------------------------------------------------------
|
|
136
|
-
describe("error mapping", () => {
|
|
137
|
-
it("maps 401 to VaultAuthError", async () => {
|
|
138
|
-
fetchSpy.mockImplementation(() => Promise.resolve(jsonResponse(401, { message: "Token expired" })));
|
|
139
|
-
await expect(client.listMembersOfCompany("cmp_abc")).rejects.toThrow(VaultAuthError);
|
|
140
|
-
});
|
|
141
|
-
it("maps 403 to VaultPermissionDeniedError", async () => {
|
|
142
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(403, { message: "Admin required" }));
|
|
143
|
-
await expect(client.listMembersOfCompany("cmp_abc")).rejects.toThrow(VaultPermissionDeniedError);
|
|
144
|
-
});
|
|
145
|
-
it("maps 404 to VaultNotFoundError", async () => {
|
|
146
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(404, { message: "Not found" }));
|
|
147
|
-
await expect(client.entity.get("cmp_missing")).rejects.toThrow(VaultNotFoundError);
|
|
148
|
-
});
|
|
149
|
-
it("maps 409 to VaultConflictError", async () => {
|
|
150
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(409, { message: "Already accepted" }));
|
|
151
|
-
await expect(client.acceptInvite("tok", "psn_abc")).rejects.toThrow(VaultConflictError);
|
|
152
|
-
});
|
|
153
|
-
it("carries the vault's code and path on a refusal so callers can name the file", async () => {
|
|
154
|
-
// The skill-register 409 body names the object it is about; before this
|
|
155
|
-
// the client kept only the sentence, so a company-level abort read
|
|
156
|
-
// "this path" with no path (undrdog, 2026-09-11).
|
|
157
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(409, {
|
|
158
|
-
error: "The landed skill does not carry the registered identity for this path",
|
|
159
|
-
code: "SKILL_REGISTER_LANDED_IDENTITY_MISMATCH",
|
|
160
|
-
path: "skills/workflow-preflight/SKILL.md",
|
|
161
|
-
}));
|
|
162
|
-
const err = await client
|
|
163
|
-
.registerCompanySkill("acme", {
|
|
164
|
-
path: "skills/workflow-preflight/SKILL.md",
|
|
165
|
-
content: "---\nskill_uid: skl_X\n---\n",
|
|
166
|
-
landed: true,
|
|
167
|
-
})
|
|
168
|
-
.catch((e) => e);
|
|
169
|
-
expect(err).toBeInstanceOf(VaultConflictError);
|
|
170
|
-
expect(err).toMatchObject({
|
|
171
|
-
statusCode: 409,
|
|
172
|
-
message: "The landed skill does not carry the registered identity for this path",
|
|
173
|
-
code: "SKILL_REGISTER_LANDED_IDENTITY_MISMATCH",
|
|
174
|
-
path: "skills/workflow-preflight/SKILL.md",
|
|
175
|
-
});
|
|
176
|
-
});
|
|
177
|
-
it("names the requested skill path when a 409 body does not", async () => {
|
|
178
|
-
// The undrdog abort logged path:"(company)" because older vault bodies
|
|
179
|
-
// were a bare sentence. The client already knows which file it posted.
|
|
180
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(409, {
|
|
181
|
-
error: "The landed skill does not carry the registered identity for this path",
|
|
182
|
-
}));
|
|
183
|
-
const err = await client
|
|
184
|
-
.registerCompanySkill("undrdog", {
|
|
185
|
-
path: "skills/workflow-preflight/SKILL.md",
|
|
186
|
-
content: "---\nskill_uid: skl_X\n---\n",
|
|
187
|
-
landed: true,
|
|
188
|
-
})
|
|
189
|
-
.catch((e) => e);
|
|
190
|
-
expect(err).toBeInstanceOf(VaultConflictError);
|
|
191
|
-
expect(err).toMatchObject({
|
|
192
|
-
statusCode: 409,
|
|
193
|
-
path: "skills/workflow-preflight/SKILL.md",
|
|
194
|
-
});
|
|
195
|
-
});
|
|
196
|
-
it("does not replace a path the vault body already named", async () => {
|
|
197
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(409, {
|
|
198
|
-
error: "The landed skill does not carry the registered identity for this path",
|
|
199
|
-
path: "skills/workflow-intake/SKILL.md",
|
|
200
|
-
}));
|
|
201
|
-
const err = await client
|
|
202
|
-
.registerCompanySkill("undrdog", {
|
|
203
|
-
path: "skills/workflow-preflight/SKILL.md",
|
|
204
|
-
content: "---\nskill_uid: skl_X\n---\n",
|
|
205
|
-
landed: true,
|
|
206
|
-
})
|
|
207
|
-
.catch((e) => e);
|
|
208
|
-
expect(err).toMatchObject({ path: "skills/workflow-intake/SKILL.md" });
|
|
209
|
-
});
|
|
210
|
-
it("leaves code and path unset when the error body has none", async () => {
|
|
211
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(409, { message: "Already accepted" }));
|
|
212
|
-
const err = (await client
|
|
213
|
-
.acceptInvite("tok", "psn_abc")
|
|
214
|
-
.catch((e) => e));
|
|
215
|
-
expect(err.code).toBeUndefined();
|
|
216
|
-
expect(err.path).toBeUndefined();
|
|
217
|
-
});
|
|
218
|
-
it("keeps error, code, message and the parsed refusal from the canonical 402 hard-stop body", async () => {
|
|
219
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(402, canonicalPlanLimitBody()));
|
|
220
|
-
const err = await client.acceptInvite("tok", "psn_abc").catch((error) => error);
|
|
221
|
-
expect(err).toBeInstanceOf(VaultClientError);
|
|
222
|
-
expect(err).toMatchObject({
|
|
223
|
-
statusCode: 402,
|
|
224
|
-
message: "New files are paused while Acme is over its Starter limits.",
|
|
225
|
-
code: "PLAN_LIMIT_EXCEEDED",
|
|
226
|
-
errorCode: "plan_limit_reached",
|
|
227
|
-
upgradeUrl: PLAN_LIMIT_UPGRADE_URL,
|
|
228
|
-
planLimit: {
|
|
229
|
-
upgradeUrl: PLAN_LIMIT_UPGRADE_URL,
|
|
230
|
-
error: "plan_limit_reached",
|
|
231
|
-
code: "PLAN_LIMIT_EXCEEDED",
|
|
232
|
-
blocked: "files.create",
|
|
233
|
-
resources: [
|
|
234
|
-
{ resource: "storageBytes", used: 11_811_160_064, limit: 10_737_418_240 },
|
|
235
|
-
],
|
|
236
|
-
fixOptions: { storageBytes: 10_737_418_240 },
|
|
237
|
-
},
|
|
238
|
-
});
|
|
239
|
-
expect(planLimitRefusalFromError(err)).toEqual(err.planLimit);
|
|
240
|
-
});
|
|
241
|
-
it("recognises the legacy membership 402 as a plan-limit refusal", async () => {
|
|
242
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(402, legacyMembershipPlanLimitBody()));
|
|
243
|
-
const err = await client.acceptInvite("tok", "psn_abc").catch((error) => error);
|
|
244
|
-
expect(planLimitRefusalFromError(err)).toEqual({
|
|
245
|
-
upgradeUrl: PLAN_LIMIT_UPGRADE_URL,
|
|
246
|
-
code: "PLAN_LIMIT_EXCEEDED",
|
|
247
|
-
resources: [{ resource: "users", used: 5, limit: 5 }],
|
|
248
|
-
});
|
|
249
|
-
});
|
|
250
|
-
it("does not treat an unrelated 4xx as a plan-limit refusal", async () => {
|
|
251
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(403, { error: "forbidden", code: "FILES_PRESIGN_FORBIDDEN" }));
|
|
252
|
-
const err = await client.acceptInvite("tok", "psn_abc").catch((error) => error);
|
|
253
|
-
expect(err).toMatchObject({ errorCode: "forbidden", code: "FILES_PRESIGN_FORBIDDEN" });
|
|
254
|
-
expect(planLimitRefusalFromError(err)).toBeNull();
|
|
255
|
-
expect(planLimitRefusalFromError(new Error("boom"))).toBeNull();
|
|
256
|
-
});
|
|
257
|
-
it("keeps the server's exact per-item company presign refusal row", async () => {
|
|
258
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, {
|
|
259
|
-
results: [
|
|
260
|
-
companyPresignRefusalRow("docs/paused.md"),
|
|
261
|
-
{ key: "docs/read.md", op: "get", url: "https://s3.example.test/read" },
|
|
262
|
-
],
|
|
263
|
-
expiresAt: "2026-09-24T00:00:00.000Z",
|
|
264
|
-
}));
|
|
265
|
-
const response = await client.presign({
|
|
266
|
-
companyUid: "cmp_01ABCDEF",
|
|
267
|
-
keys: [
|
|
268
|
-
{ key: "docs/paused.md", op: "put" },
|
|
269
|
-
{ key: "docs/read.md", op: "get" },
|
|
270
|
-
],
|
|
271
|
-
});
|
|
272
|
-
expect(response.results[0]).toEqual({
|
|
273
|
-
key: "docs/paused.md",
|
|
274
|
-
op: "put",
|
|
275
|
-
error: "New files are paused while Acme is over its Starter limits.",
|
|
276
|
-
code: "PLAN_LIMIT_EXCEEDED",
|
|
277
|
-
upgradeUrl: PLAN_LIMIT_UPGRADE_URL,
|
|
278
|
-
});
|
|
279
|
-
expect(response.results[1]).toMatchObject({ url: "https://s3.example.test/read" });
|
|
280
|
-
});
|
|
281
|
-
it("does not treat a marker-less 402 or a non-https upgrade link as a plan-limit refusal", async () => {
|
|
282
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(402, { message: "Add a card to continue", upgradeUrl: PLAN_LIMIT_UPGRADE_URL }));
|
|
283
|
-
const billing = await client.acceptInvite("tok", "psn_abc").catch((error) => error);
|
|
284
|
-
expect(billing).toMatchObject({ statusCode: 402, upgradeUrl: PLAN_LIMIT_UPGRADE_URL });
|
|
285
|
-
expect(planLimitRefusalFromError(billing)).toBeNull();
|
|
286
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(402, { ...canonicalPlanLimitBody(), upgradeUrl: "http://billing.example.test/acme" }));
|
|
287
|
-
const insecure = await client.acceptInvite("tok", "psn_abc").catch((error) => error);
|
|
288
|
-
expect(planLimitRefusalFromError(insecure)).toBeNull();
|
|
289
|
-
// Hand-built errors follow the same rule.
|
|
290
|
-
expect(planLimitRefusalFromError(new VaultClientError("Plan limit reached", 402, undefined, { upgradeUrl: PLAN_LIMIT_UPGRADE_URL }))).toBeNull();
|
|
291
|
-
});
|
|
292
|
-
it("checkFilesAdmission posts the admission body to the presign route with one attempt", async () => {
|
|
293
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, { allowed: true }));
|
|
294
|
-
await expect(client.checkFilesAdmission("cmp_01ABCDEF")).resolves.toEqual({ allowed: true });
|
|
295
|
-
const [url, init] = fetchSpy.mock.calls[0];
|
|
296
|
-
expect(url).toBe(`${TEST_CONFIG.apiUrl}/v1/files/presign`);
|
|
297
|
-
expect(init.method).toBe("POST");
|
|
298
|
-
expect(JSON.parse(String(init.body))).toEqual({ admission: true, companyUid: "cmp_01ABCDEF" });
|
|
299
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(402, canonicalPlanLimitBody()));
|
|
300
|
-
const refused = await client.checkFilesAdmission("cmp_01ABCDEF").catch((error) => error);
|
|
301
|
-
expect(planLimitRefusalFromError(refused)).toMatchObject({ upgradeUrl: PLAN_LIMIT_UPGRADE_URL });
|
|
302
|
-
// A 5xx is not retried: the caller treats it as "unknown".
|
|
303
|
-
fetchSpy.mockClear();
|
|
304
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(503, { message: "unavailable" }));
|
|
305
|
-
await expect(client.checkFilesAdmission("cmp_01ABCDEF")).rejects.toMatchObject({ statusCode: 503 });
|
|
306
|
-
expect(fetchSpy).toHaveBeenCalledTimes(1);
|
|
307
|
-
});
|
|
308
|
-
it("preserves upgradeUrl on an item plan-limit presign row", async () => {
|
|
309
|
-
const upgradeUrl = "https://billing.example.test/company/acme";
|
|
310
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, {
|
|
311
|
-
results: [
|
|
312
|
-
{
|
|
313
|
-
key: "shared/paused.md",
|
|
314
|
-
op: "put",
|
|
315
|
-
error: "Plan limit reached",
|
|
316
|
-
code: "PLAN_LIMIT_REACHED",
|
|
317
|
-
upgradeUrl,
|
|
318
|
-
},
|
|
319
|
-
],
|
|
320
|
-
expiresAt: "2026-09-24T00:00:00.000Z",
|
|
321
|
-
}));
|
|
322
|
-
const response = await client.presign({
|
|
323
|
-
companyUid: "cmp_01ABCDEF",
|
|
324
|
-
op: "put",
|
|
325
|
-
keys: [{ key: "shared/paused.md", op: "put" }],
|
|
326
|
-
});
|
|
327
|
-
expect(response.results[0]).toMatchObject({
|
|
328
|
-
code: "PLAN_LIMIT_REACHED",
|
|
329
|
-
upgradeUrl,
|
|
330
|
-
});
|
|
331
|
-
});
|
|
332
|
-
it("preserves error message from response body", async () => {
|
|
333
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(403, { message: "Only admins can invite" }));
|
|
334
|
-
try {
|
|
335
|
-
await client.createInvite({
|
|
336
|
-
companyUid: "cmp_abc",
|
|
337
|
-
role: "member",
|
|
338
|
-
invitedBy: "psn_xyz",
|
|
339
|
-
});
|
|
340
|
-
expect.fail("Should have thrown");
|
|
341
|
-
}
|
|
342
|
-
catch (err) {
|
|
343
|
-
expect(err).toBeInstanceOf(VaultPermissionDeniedError);
|
|
344
|
-
expect(err.message).toBe("Only admins can invite");
|
|
345
|
-
}
|
|
346
|
-
});
|
|
347
|
-
it("handles non-JSON error bodies gracefully", async () => {
|
|
348
|
-
fetchSpy.mockResolvedValueOnce(textResponse(404, "Not Found"));
|
|
349
|
-
try {
|
|
350
|
-
await client.entity.findBySlug("company", "test");
|
|
351
|
-
expect.fail("Should have thrown");
|
|
352
|
-
}
|
|
353
|
-
catch (err) {
|
|
354
|
-
expect(err).toBeInstanceOf(VaultNotFoundError);
|
|
355
|
-
expect(err.message).toBe("Not Found");
|
|
356
|
-
}
|
|
357
|
-
});
|
|
358
|
-
});
|
|
359
|
-
// ---------------------------------------------------------------------------
|
|
360
|
-
// Retry behavior
|
|
361
|
-
// ---------------------------------------------------------------------------
|
|
362
|
-
describe("retry behavior", () => {
|
|
363
|
-
it("retries on 429 and succeeds on second attempt", async () => {
|
|
364
|
-
fetchSpy
|
|
365
|
-
.mockResolvedValueOnce(jsonResponse(429, { message: "Rate limited" }))
|
|
366
|
-
.mockResolvedValueOnce(jsonResponse(200, { members: [{ personUid: "psn_1" }] }));
|
|
367
|
-
const result = await client.listMembersOfCompany("cmp_abc");
|
|
368
|
-
expect(result).toHaveLength(1);
|
|
369
|
-
expect(fetchSpy).toHaveBeenCalledTimes(2);
|
|
370
|
-
});
|
|
371
|
-
it("retries on 500 and succeeds on third attempt", async () => {
|
|
372
|
-
fetchSpy
|
|
373
|
-
.mockResolvedValueOnce(jsonResponse(500, { message: "Internal error" }))
|
|
374
|
-
.mockResolvedValueOnce(jsonResponse(502, { message: "Bad gateway" }))
|
|
375
|
-
.mockResolvedValueOnce(jsonResponse(200, { membership: { role: "admin" } }));
|
|
376
|
-
const result = await client.updateRole({
|
|
377
|
-
membershipKey: "psn_1#cmp_abc",
|
|
378
|
-
newRole: "admin",
|
|
379
|
-
updaterUid: "psn_owner",
|
|
380
|
-
companyUid: "cmp_abc",
|
|
381
|
-
});
|
|
382
|
-
expect(result.role).toBe("admin");
|
|
383
|
-
expect(fetchSpy).toHaveBeenCalledTimes(3);
|
|
384
|
-
});
|
|
385
|
-
it("throws after exhausting all retries on persistent 500", async () => {
|
|
386
|
-
fetchSpy.mockImplementation(() => Promise.resolve(jsonResponse(500, { message: "Down" })));
|
|
387
|
-
await expect(client.listMembersOfCompany("cmp_abc")).rejects.toThrow(VaultClientError);
|
|
388
|
-
// 1 initial + 3 retries = 4
|
|
389
|
-
expect(fetchSpy).toHaveBeenCalledTimes(4);
|
|
390
|
-
});
|
|
391
|
-
// Regression: the deploy access-gate 401 of 2026-07-19. A token that expired
|
|
392
|
-
// mid-request is recoverable — callers passing a getter can mint a fresh one —
|
|
393
|
-
// but the client threw instead of retrying, so a transient auth lapse surfaced
|
|
394
|
-
// as a hard failure and the caller degraded a members-only gate to a password.
|
|
395
|
-
it("retries a 401 once when the token getter yields a fresh token", async () => {
|
|
396
|
-
const tokens = ["stale-token", "fresh-token"];
|
|
397
|
-
const getToken = vi.fn(async () => tokens.shift() ?? "fresh-token");
|
|
398
|
-
const c = new VaultClient({ ...TEST_CONFIG, authToken: getToken });
|
|
399
|
-
fetchSpy
|
|
400
|
-
.mockResolvedValueOnce(jsonResponse(401, { message: "Token expired" }))
|
|
401
|
-
.mockResolvedValueOnce(jsonResponse(200, { members: [{ personUid: "psn_1" }] }));
|
|
402
|
-
const result = await c.listMembersOfCompany("cmp_abc");
|
|
403
|
-
expect(result).toHaveLength(1);
|
|
404
|
-
expect(fetchSpy).toHaveBeenCalledTimes(2);
|
|
405
|
-
const authHeader = (call) => fetchSpy.mock.calls[call][1].headers;
|
|
406
|
-
expect(authHeader(0).Authorization).toBe("Bearer stale-token");
|
|
407
|
-
expect(authHeader(1).Authorization).toBe("Bearer fresh-token");
|
|
408
|
-
});
|
|
409
|
-
it("does not retry a 401 when the getter returns the same token", async () => {
|
|
410
|
-
const getToken = vi.fn(async () => "unchanging-token");
|
|
411
|
-
const c = new VaultClient({ ...TEST_CONFIG, authToken: getToken });
|
|
412
|
-
fetchSpy.mockResolvedValue(jsonResponse(401, { message: "Nope" }));
|
|
413
|
-
await expect(c.listMembersOfCompany("cmp_abc")).rejects.toThrow(VaultAuthError);
|
|
414
|
-
expect(fetchSpy).toHaveBeenCalledTimes(1);
|
|
415
|
-
});
|
|
416
|
-
// Review finding: the auth retry used to share the transient budget, so a
|
|
417
|
-
// 401 on the LAST attempt set the flag, hit `continue`, and fell out of the
|
|
418
|
-
// loop having never actually retried — the recovery silently did nothing in
|
|
419
|
-
// exactly the case it was written for.
|
|
420
|
-
it("still retries when the 401 lands on the final attempt", async () => {
|
|
421
|
-
const tokens = ["stale", "stale", "stale", "stale", "fresh"];
|
|
422
|
-
const getToken = vi.fn(async () => tokens.shift() ?? "fresh");
|
|
423
|
-
const c = new VaultClient({ ...TEST_CONFIG, authToken: getToken });
|
|
424
|
-
// Burn the whole transient budget first (attempts 0,1,2), so the 401 lands
|
|
425
|
-
// on attempt 3 — the last one the shared-budget loop would ever run.
|
|
426
|
-
fetchSpy
|
|
427
|
-
.mockResolvedValueOnce(jsonResponse(500, { message: "boom" }))
|
|
428
|
-
.mockResolvedValueOnce(jsonResponse(500, { message: "boom" }))
|
|
429
|
-
.mockResolvedValueOnce(jsonResponse(500, { message: "boom" }))
|
|
430
|
-
.mockResolvedValueOnce(jsonResponse(401, { message: "Token expired" }))
|
|
431
|
-
.mockResolvedValueOnce(jsonResponse(200, { members: [{ personUid: "psn_1" }] }));
|
|
432
|
-
const result = await c.listMembersOfCompany("cmp_abc");
|
|
433
|
-
expect(result).toHaveLength(1);
|
|
434
|
-
// 5th call only happens if the auth retry got its own budget.
|
|
435
|
-
expect(fetchSpy).toHaveBeenCalledTimes(5);
|
|
436
|
-
});
|
|
437
|
-
// Review finding: a 401 consumed a transient-retry slot, so a request that
|
|
438
|
-
// hit an auth lapse had fewer retries left for genuine 5xx afterwards.
|
|
439
|
-
it("does not spend transient-retry budget on the auth retry", async () => {
|
|
440
|
-
const tokens = ["stale", "fresh"];
|
|
441
|
-
const getToken = vi.fn(async () => tokens.shift() ?? "fresh");
|
|
442
|
-
const c = new VaultClient({ ...TEST_CONFIG, authToken: getToken });
|
|
443
|
-
// 401 (free retry) then three 500s — the full transient budget must still
|
|
444
|
-
// be available, so the 4th call succeeds.
|
|
445
|
-
fetchSpy
|
|
446
|
-
.mockResolvedValueOnce(jsonResponse(401, { message: "Token expired" }))
|
|
447
|
-
.mockResolvedValueOnce(jsonResponse(500, { message: "boom" }))
|
|
448
|
-
.mockResolvedValueOnce(jsonResponse(500, { message: "boom" }))
|
|
449
|
-
.mockResolvedValueOnce(jsonResponse(500, { message: "boom" }))
|
|
450
|
-
.mockResolvedValueOnce(jsonResponse(200, { members: [{ personUid: "psn_1" }] }));
|
|
451
|
-
const result = await c.listMembersOfCompany("cmp_abc");
|
|
452
|
-
expect(result).toHaveLength(1);
|
|
453
|
-
expect(fetchSpy).toHaveBeenCalledTimes(5);
|
|
454
|
-
});
|
|
455
|
-
it("retries a 401 at most once even if the token keeps changing", async () => {
|
|
456
|
-
let n = 0;
|
|
457
|
-
const getToken = vi.fn(async () => `token-${n++}`);
|
|
458
|
-
const c = new VaultClient({ ...TEST_CONFIG, authToken: getToken });
|
|
459
|
-
// mockImplementation (not mockResolvedValue): each attempt needs its own
|
|
460
|
-
// Response, since the body can only be read once.
|
|
461
|
-
fetchSpy.mockImplementation(() => Promise.resolve(jsonResponse(401, { message: "Still no" })));
|
|
462
|
-
await expect(c.listMembersOfCompany("cmp_abc")).rejects.toThrow(VaultAuthError);
|
|
463
|
-
// 1 initial + exactly 1 auth retry — never a retry storm against the authorizer
|
|
464
|
-
expect(fetchSpy).toHaveBeenCalledTimes(2);
|
|
465
|
-
});
|
|
466
|
-
it("does not retry on 403 (non-transient)", async () => {
|
|
467
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(403, { message: "Forbidden" }));
|
|
468
|
-
await expect(client.createInvite({
|
|
469
|
-
companyUid: "cmp_abc",
|
|
470
|
-
role: "member",
|
|
471
|
-
invitedBy: "psn_xyz",
|
|
472
|
-
})).rejects.toThrow(VaultPermissionDeniedError);
|
|
473
|
-
expect(fetchSpy).toHaveBeenCalledTimes(1);
|
|
474
|
-
});
|
|
475
|
-
it("retries on network errors (fetch throws)", async () => {
|
|
476
|
-
fetchSpy
|
|
477
|
-
.mockRejectedValueOnce(new Error("ECONNRESET"))
|
|
478
|
-
.mockResolvedValueOnce(jsonResponse(200, { members: [] }));
|
|
479
|
-
const result = await client.listMembersOfCompany("cmp_abc");
|
|
480
|
-
expect(result).toEqual([]);
|
|
481
|
-
expect(fetchSpy).toHaveBeenCalledTimes(2);
|
|
482
|
-
});
|
|
483
|
-
});
|
|
484
|
-
// ---------------------------------------------------------------------------
|
|
485
|
-
// API surface
|
|
486
|
-
// ---------------------------------------------------------------------------
|
|
487
|
-
describe("API surface", () => {
|
|
488
|
-
it("createInvite sends correct body and URL", async () => {
|
|
489
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, {
|
|
490
|
-
membership: { membershipKey: "psn_1#cmp_abc", role: "member", status: "pending" },
|
|
491
|
-
inviteToken: "tok_secure_random",
|
|
492
|
-
}));
|
|
493
|
-
const result = await client.createInvite({
|
|
494
|
-
companyUid: "cmp_abc",
|
|
495
|
-
role: "member",
|
|
496
|
-
invitedBy: "psn_owner",
|
|
497
|
-
inviteeEmail: "alice@example.com",
|
|
498
|
-
});
|
|
499
|
-
expect(result.inviteToken).toBe("tok_secure_random");
|
|
500
|
-
const [url, init] = fetchSpy.mock.calls[0];
|
|
501
|
-
expect(url).toBe("https://vault.test.example.com/membership/invite");
|
|
502
|
-
expect(JSON.parse(init.body)).toEqual({
|
|
503
|
-
companyUid: "cmp_abc",
|
|
504
|
-
role: "member",
|
|
505
|
-
invitedBy: "psn_owner",
|
|
506
|
-
inviteeEmail: "alice@example.com",
|
|
507
|
-
});
|
|
508
|
-
});
|
|
509
|
-
it("acceptInvite sends token and personUid", async () => {
|
|
510
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, {
|
|
511
|
-
membership: { status: "active", role: "member" },
|
|
512
|
-
}));
|
|
513
|
-
const result = await client.acceptInvite("tok_abc", "psn_invitee");
|
|
514
|
-
expect(result.membership.status).toBe("active");
|
|
515
|
-
const [url, init] = fetchSpy.mock.calls[0];
|
|
516
|
-
expect(url).toBe("https://vault.test.example.com/membership/accept");
|
|
517
|
-
expect(JSON.parse(init.body)).toEqual({
|
|
518
|
-
token: "tok_abc",
|
|
519
|
-
personUid: "psn_invitee",
|
|
520
|
-
});
|
|
521
|
-
});
|
|
522
|
-
it("postTelemetryEvents sends action events without personUid", async () => {
|
|
523
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, { contractVersion: 1, ok: true, written: 1, skipped: [] }));
|
|
524
|
-
const batch = {
|
|
525
|
-
events: [
|
|
526
|
-
{
|
|
527
|
-
eventName: "sync_runner_completed",
|
|
528
|
-
app: "hq-cloud",
|
|
529
|
-
source: "sync-runner",
|
|
530
|
-
occurredAt: "2026-07-07T12:00:00.000Z",
|
|
531
|
-
companyUid: "cmp_abc",
|
|
532
|
-
sessionId: "sync_123",
|
|
533
|
-
schemaVersion: 1,
|
|
534
|
-
properties: {
|
|
535
|
-
result: "completed",
|
|
536
|
-
fileCount: 2,
|
|
537
|
-
},
|
|
538
|
-
},
|
|
539
|
-
],
|
|
540
|
-
};
|
|
541
|
-
const result = await client.postTelemetryEvents(batch);
|
|
542
|
-
expect(result).toEqual({ ok: true, written: 1, skipped: [] });
|
|
543
|
-
expect(fetchSpy).toHaveBeenCalledTimes(1);
|
|
544
|
-
const [url, init] = fetchSpy.mock.calls[0];
|
|
545
|
-
expect(url).toBe("https://vault.test.example.com/v1/telemetry/events");
|
|
546
|
-
expect(init.method.toUpperCase()).toBe("POST");
|
|
547
|
-
const body = JSON.parse(init.body);
|
|
548
|
-
expect(body).toEqual(batch);
|
|
549
|
-
expect(JSON.stringify(body)).not.toContain("personUid");
|
|
550
|
-
});
|
|
551
|
-
it("postTelemetryEvents normalizes the compatible pre-v1 accepted response", async () => {
|
|
552
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, { accepted: 2, deduped: 1 }));
|
|
553
|
-
const batch = { events: [] };
|
|
554
|
-
await expect(client.postTelemetryEvents(batch)).resolves.toEqual({
|
|
555
|
-
ok: true,
|
|
556
|
-
written: 2,
|
|
557
|
-
skipped: [],
|
|
558
|
-
});
|
|
559
|
-
});
|
|
560
|
-
it("updateRole sends correct payload", async () => {
|
|
561
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, {
|
|
562
|
-
membership: { role: "guest", allowedPrefixes: ["docs/"] },
|
|
563
|
-
}));
|
|
564
|
-
const result = await client.updateRole({
|
|
565
|
-
membershipKey: "psn_1#cmp_abc",
|
|
566
|
-
newRole: "guest",
|
|
567
|
-
allowedPrefixes: ["docs/"],
|
|
568
|
-
updaterUid: "psn_admin",
|
|
569
|
-
companyUid: "cmp_abc",
|
|
570
|
-
});
|
|
571
|
-
expect(result.role).toBe("guest");
|
|
572
|
-
expect(result.allowedPrefixes).toEqual(["docs/"]);
|
|
573
|
-
const [url, init] = fetchSpy.mock.calls[0];
|
|
574
|
-
expect(url).toBe("https://vault.test.example.com/membership/role");
|
|
575
|
-
expect(JSON.parse(init.body)).toEqual({
|
|
576
|
-
membershipKey: "psn_1#cmp_abc",
|
|
577
|
-
newRole: "guest",
|
|
578
|
-
allowedPrefixes: ["docs/"],
|
|
579
|
-
updaterUid: "psn_admin",
|
|
580
|
-
companyUid: "cmp_abc",
|
|
581
|
-
});
|
|
582
|
-
});
|
|
583
|
-
it("entity.get calls correct URL", async () => {
|
|
584
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, {
|
|
585
|
-
entity: { uid: "cmp_abc", slug: "acme", type: "company", status: "active" },
|
|
586
|
-
}));
|
|
587
|
-
const entity = await client.entity.get("cmp_abc");
|
|
588
|
-
expect(entity.slug).toBe("acme");
|
|
589
|
-
const [url] = fetchSpy.mock.calls[0];
|
|
590
|
-
expect(url).toBe("https://vault.test.example.com/entity/cmp_abc");
|
|
591
|
-
});
|
|
592
|
-
it("entity.findBySlug calls correct URL", async () => {
|
|
593
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, {
|
|
594
|
-
entity: { uid: "cmp_abc", slug: "acme", type: "company", status: "active" },
|
|
595
|
-
}));
|
|
596
|
-
const entity = await client.entity.findBySlug("company", "acme");
|
|
597
|
-
expect(entity.uid).toBe("cmp_abc");
|
|
598
|
-
const [url] = fetchSpy.mock.calls[0];
|
|
599
|
-
expect(url).toBe("https://vault.test.example.com/entity/by-slug/company/acme");
|
|
600
|
-
});
|
|
601
|
-
it("revokeMembership calls POST /membership/revoke with companyUid", async () => {
|
|
602
|
-
fetchSpy.mockResolvedValueOnce(new Response(null, { status: 204 }));
|
|
603
|
-
await client.revokeMembership("psn_1#cmp_abc", "cmp_abc");
|
|
604
|
-
const [url, init] = fetchSpy.mock.calls[0];
|
|
605
|
-
expect(url).toBe("https://vault.test.example.com/membership/revoke");
|
|
606
|
-
expect(init.method).toBe("POST");
|
|
607
|
-
expect(JSON.parse(init.body)).toEqual({
|
|
608
|
-
membershipKey: "psn_1#cmp_abc",
|
|
609
|
-
companyUid: "cmp_abc",
|
|
610
|
-
});
|
|
611
|
-
});
|
|
612
|
-
it("listPendingInvites calls correct URL", async () => {
|
|
613
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, { invites: [{ status: "pending" }] }));
|
|
614
|
-
const invites = await client.listPendingInvites("cmp_abc");
|
|
615
|
-
expect(invites).toHaveLength(1);
|
|
616
|
-
const [url] = fetchSpy.mock.calls[0];
|
|
617
|
-
expect(url).toBe("https://vault.test.example.com/membership/company/cmp_abc/pending");
|
|
618
|
-
});
|
|
619
|
-
it("listMyMemberships hits GET /membership/me and unwraps memberships[]", async () => {
|
|
620
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, {
|
|
621
|
-
memberships: [
|
|
622
|
-
{ membershipKey: "psn_1#cmp_a", role: "owner", status: "active" },
|
|
623
|
-
{ membershipKey: "psn_1#cmp_b", role: "member", status: "active" },
|
|
624
|
-
],
|
|
625
|
-
}));
|
|
626
|
-
const memberships = await client.listMyMemberships();
|
|
627
|
-
expect(memberships).toHaveLength(2);
|
|
628
|
-
expect(memberships[0].membershipKey).toBe("psn_1#cmp_a");
|
|
629
|
-
const [url, init] = fetchSpy.mock.calls[0];
|
|
630
|
-
expect(url).toBe("https://vault.test.example.com/membership/me");
|
|
631
|
-
expect(init.method).toBe("GET");
|
|
632
|
-
// No body on GET.
|
|
633
|
-
expect(init.body).toBeUndefined();
|
|
634
|
-
});
|
|
635
|
-
it("listMyMemberships returns [] for callers with no person entity (bootstrap case)", async () => {
|
|
636
|
-
// Server returns 200 + { memberships: [] } rather than 404 when the
|
|
637
|
-
// caller is signed in but hasn't been provisioned yet. The SDK must
|
|
638
|
-
// surface an empty array, NOT throw — hq-sync-runner relies on this
|
|
639
|
-
// to emit `setup-needed` without catching HTTP errors.
|
|
640
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, { memberships: [] }));
|
|
641
|
-
const memberships = await client.listMyMemberships();
|
|
642
|
-
expect(memberships).toEqual([]);
|
|
643
|
-
});
|
|
644
|
-
it("listMyPendingInvitesByEmail hits GET /membership/pending-by-email", async () => {
|
|
645
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, {
|
|
646
|
-
invites: [
|
|
647
|
-
{
|
|
648
|
-
membershipKey: "email:stefan@getindigo.ai#cmp_abc",
|
|
649
|
-
companyUid: "cmp_abc",
|
|
650
|
-
role: "owner",
|
|
651
|
-
invitedBy: "sub-admin",
|
|
652
|
-
invitedAt: "2026-04-20T00:00:00Z",
|
|
653
|
-
},
|
|
654
|
-
],
|
|
655
|
-
}));
|
|
656
|
-
const invites = await client.listMyPendingInvitesByEmail();
|
|
657
|
-
expect(invites).toHaveLength(1);
|
|
658
|
-
expect(invites[0].companyUid).toBe("cmp_abc");
|
|
659
|
-
const [url, init] = fetchSpy.mock.calls[0];
|
|
660
|
-
expect(url).toBe("https://vault.test.example.com/membership/pending-by-email");
|
|
661
|
-
expect(init.method).toBe("GET");
|
|
662
|
-
});
|
|
663
|
-
it("listMyPendingInvitesByEmail returns [] when server omits the key", async () => {
|
|
664
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, {}));
|
|
665
|
-
const invites = await client.listMyPendingInvitesByEmail();
|
|
666
|
-
expect(invites).toEqual([]);
|
|
667
|
-
});
|
|
668
|
-
it("claimPendingInvitesByEmail POSTs personUid to /membership/claim-by-email", async () => {
|
|
669
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, {}));
|
|
670
|
-
await client.claimPendingInvitesByEmail("ent_person_stefan");
|
|
671
|
-
const [url, init] = fetchSpy.mock.calls[0];
|
|
672
|
-
expect(url).toBe("https://vault.test.example.com/membership/claim-by-email");
|
|
673
|
-
expect(init.method).toBe("POST");
|
|
674
|
-
expect(JSON.parse(init.body)).toEqual({
|
|
675
|
-
personUid: "ent_person_stefan",
|
|
676
|
-
});
|
|
677
|
-
});
|
|
678
|
-
});
|
|
679
|
-
describe("response validation (F26)", () => {
|
|
680
|
-
it("F26: validates a valid files/list response and returns typed data", async () => {
|
|
681
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, {
|
|
682
|
-
objects: [
|
|
683
|
-
{
|
|
684
|
-
key: "shared/docs/a.txt",
|
|
685
|
-
size: 123,
|
|
686
|
-
lastModified: "2026-05-20T12:00:00.000Z",
|
|
687
|
-
storageClass: "DEEP_ARCHIVE",
|
|
688
|
-
etag: "abc123",
|
|
689
|
-
permission: "read",
|
|
690
|
-
},
|
|
691
|
-
],
|
|
692
|
-
cursor: null,
|
|
693
|
-
truncated: false,
|
|
694
|
-
}));
|
|
695
|
-
const page = await client.listFiles("cmp_abc", "shared/docs/");
|
|
696
|
-
expect(page.objects[0]).toEqual({
|
|
697
|
-
key: "shared/docs/a.txt",
|
|
698
|
-
size: 123,
|
|
699
|
-
lastModified: "2026-05-20T12:00:00.000Z",
|
|
700
|
-
storageClass: "DEEP_ARCHIVE",
|
|
701
|
-
etag: "abc123",
|
|
702
|
-
permission: "read",
|
|
703
|
-
});
|
|
704
|
-
expect(page.cursor).toBeNull();
|
|
705
|
-
expect(page.truncated).toBe(false);
|
|
706
|
-
});
|
|
707
|
-
it("F26: defaults omitted files/list paging fields", async () => {
|
|
708
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, {}));
|
|
709
|
-
const page = await client.listFiles("cmp_abc", "shared/docs/");
|
|
710
|
-
expect(page).toEqual({
|
|
711
|
-
objects: [],
|
|
712
|
-
cursor: null,
|
|
713
|
-
truncated: false,
|
|
714
|
-
});
|
|
715
|
-
});
|
|
716
|
-
it("F26: accepts an older files/list row that omits storageClass", async () => {
|
|
717
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, {
|
|
718
|
-
objects: [{
|
|
719
|
-
key: "shared/docs/older-server.txt",
|
|
720
|
-
size: 9,
|
|
721
|
-
lastModified: "2026-05-20T12:00:00.000Z",
|
|
722
|
-
etag: "old-server-etag",
|
|
723
|
-
permission: "read",
|
|
724
|
-
}],
|
|
725
|
-
}));
|
|
726
|
-
const page = await client.listFiles("cmp_abc", "shared/docs/");
|
|
727
|
-
expect(page.objects[0].storageClass).toBeUndefined();
|
|
728
|
-
});
|
|
729
|
-
it("F26: defaults omitted telemetry opt-in fields to disabled", async () => {
|
|
730
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, {}));
|
|
731
|
-
const optIn = await client.getTelemetryOptIn();
|
|
732
|
-
expect(optIn).toEqual({ enabled: false, updatedAt: null });
|
|
733
|
-
});
|
|
734
|
-
it("F26: maps a malformed files/list response to VaultClientError", async () => {
|
|
735
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, {
|
|
736
|
-
objects: [
|
|
737
|
-
{
|
|
738
|
-
key: "shared/docs/a.txt",
|
|
739
|
-
size: 123,
|
|
740
|
-
lastModified: "2026-05-20T12:00:00.000Z",
|
|
741
|
-
permission: "read",
|
|
742
|
-
},
|
|
743
|
-
],
|
|
744
|
-
cursor: null,
|
|
745
|
-
truncated: false,
|
|
746
|
-
}));
|
|
747
|
-
await expect(client.listFiles("cmp_abc")).rejects.toMatchObject({
|
|
748
|
-
name: "VaultClientError",
|
|
749
|
-
statusCode: 502,
|
|
750
|
-
});
|
|
751
|
-
});
|
|
752
|
-
});
|
|
753
|
-
describe("VaultClient identity bootstrap", () => {
|
|
754
|
-
let client;
|
|
755
|
-
let fetchSpy;
|
|
756
|
-
beforeEach(() => {
|
|
757
|
-
fetchSpy = vi.spyOn(globalThis, "fetch");
|
|
758
|
-
fetchSpy.mockResolvedValue(jsonResponse(200, {}));
|
|
759
|
-
client = new VaultClient({
|
|
760
|
-
apiUrl: "https://vault.test.example.com",
|
|
761
|
-
authToken: "test-token",
|
|
762
|
-
region: "us-east-1",
|
|
763
|
-
});
|
|
764
|
-
});
|
|
765
|
-
afterEach(() => {
|
|
766
|
-
fetchSpy.mockRestore();
|
|
767
|
-
});
|
|
768
|
-
it("entity.listByType GETs /entity/by-type/{type}", async () => {
|
|
769
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, {
|
|
770
|
-
entities: [
|
|
771
|
-
{
|
|
772
|
-
uid: "ent_person_stefan",
|
|
773
|
-
slug: "stefan-johnson",
|
|
774
|
-
type: "person",
|
|
775
|
-
status: "active",
|
|
776
|
-
},
|
|
777
|
-
],
|
|
778
|
-
}));
|
|
779
|
-
const entities = await client.entity.listByType("person");
|
|
780
|
-
expect(entities).toHaveLength(1);
|
|
781
|
-
const [url] = fetchSpy.mock.calls[0];
|
|
782
|
-
expect(url).toBe("https://vault.test.example.com/entity/by-type/person");
|
|
783
|
-
});
|
|
784
|
-
it("entity.listByType returns [] when server omits the key", async () => {
|
|
785
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, {}));
|
|
786
|
-
const entities = await client.entity.listByType("person");
|
|
787
|
-
expect(entities).toEqual([]);
|
|
788
|
-
});
|
|
789
|
-
it("ensureMyPersonEntity short-circuits when a person entity already exists", async () => {
|
|
790
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, {
|
|
791
|
-
entities: [
|
|
792
|
-
{
|
|
793
|
-
uid: "ent_person_existing",
|
|
794
|
-
slug: "already-there",
|
|
795
|
-
type: "person",
|
|
796
|
-
status: "active",
|
|
797
|
-
},
|
|
798
|
-
],
|
|
799
|
-
}));
|
|
800
|
-
const person = await client.ensureMyPersonEntity({
|
|
801
|
-
ownerSub: "sub-abc",
|
|
802
|
-
displayName: "Stefan Johnson",
|
|
803
|
-
});
|
|
804
|
-
expect(person.uid).toBe("ent_person_existing");
|
|
805
|
-
// Only one HTTP call — list. No POST /entity.
|
|
806
|
-
expect(fetchSpy).toHaveBeenCalledTimes(1);
|
|
807
|
-
});
|
|
808
|
-
it("ensureMyPersonEntity POSTs /entity with a slug derived from displayName when none exist", async () => {
|
|
809
|
-
fetchSpy
|
|
810
|
-
.mockResolvedValueOnce(jsonResponse(200, { entities: [] }))
|
|
811
|
-
.mockResolvedValueOnce(jsonResponse(200, {
|
|
812
|
-
entity: {
|
|
813
|
-
uid: "ent_person_new",
|
|
814
|
-
slug: "stefan-johnson",
|
|
815
|
-
type: "person",
|
|
816
|
-
status: "active",
|
|
817
|
-
},
|
|
818
|
-
}));
|
|
819
|
-
const person = await client.ensureMyPersonEntity({
|
|
820
|
-
ownerSub: "sub-abc",
|
|
821
|
-
displayName: "Stefan Johnson",
|
|
822
|
-
});
|
|
823
|
-
expect(person.uid).toBe("ent_person_new");
|
|
824
|
-
expect(fetchSpy).toHaveBeenCalledTimes(2);
|
|
825
|
-
const [url, init] = fetchSpy.mock.calls[1];
|
|
826
|
-
expect(url).toBe("https://vault.test.example.com/entity");
|
|
827
|
-
expect(init.method).toBe("POST");
|
|
828
|
-
expect(JSON.parse(init.body)).toEqual({
|
|
829
|
-
type: "person",
|
|
830
|
-
name: "Stefan Johnson",
|
|
831
|
-
slug: "stefan-johnson",
|
|
832
|
-
});
|
|
833
|
-
});
|
|
834
|
-
it("ensureMyPersonEntity falls back to user-<sub-suffix> when displayName slugifies to empty", async () => {
|
|
835
|
-
fetchSpy
|
|
836
|
-
.mockResolvedValueOnce(jsonResponse(200, { entities: [] }))
|
|
837
|
-
.mockResolvedValueOnce(jsonResponse(200, {
|
|
838
|
-
entity: {
|
|
839
|
-
uid: "ent_person_new",
|
|
840
|
-
slug: "user-12345678",
|
|
841
|
-
type: "person",
|
|
842
|
-
status: "active",
|
|
843
|
-
},
|
|
844
|
-
}));
|
|
845
|
-
await client.ensureMyPersonEntity({
|
|
846
|
-
ownerSub: "sub-abcdef12345678",
|
|
847
|
-
displayName: "!!!",
|
|
848
|
-
});
|
|
849
|
-
const [, init] = fetchSpy.mock.calls[1];
|
|
850
|
-
const body = JSON.parse(init.body);
|
|
851
|
-
expect(body.slug).toBe("user-12345678");
|
|
852
|
-
});
|
|
853
|
-
it("listByType_roundtrips_createdAt", async () => {
|
|
854
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, {
|
|
855
|
-
entities: [
|
|
856
|
-
{
|
|
857
|
-
uid: "prs_x",
|
|
858
|
-
slug: "alice",
|
|
859
|
-
type: "person",
|
|
860
|
-
status: "active",
|
|
861
|
-
createdAt: "2026-01-01T00:00:00Z",
|
|
862
|
-
},
|
|
863
|
-
],
|
|
864
|
-
}));
|
|
865
|
-
const entities = await client.entity.listByType("person");
|
|
866
|
-
expect(entities).toHaveLength(1);
|
|
867
|
-
expect(entities[0].createdAt).toBe("2026-01-01T00:00:00Z");
|
|
868
|
-
});
|
|
869
|
-
it("ensureMyPersonEntity_picks_oldest_when_multiple", async () => {
|
|
870
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, {
|
|
871
|
-
entities: [
|
|
872
|
-
{ uid: "prs_b", slug: "b", type: "person", status: "active", createdAt: "2026-03-01T00:00:00Z" },
|
|
873
|
-
{ uid: "prs_a", slug: "a", type: "person", status: "active", createdAt: "2026-01-01T00:00:00Z" },
|
|
874
|
-
{ uid: "prs_c", slug: "c", type: "person", status: "active", createdAt: "2026-06-01T00:00:00Z" },
|
|
875
|
-
],
|
|
876
|
-
}));
|
|
877
|
-
const person = await client.ensureMyPersonEntity({
|
|
878
|
-
ownerSub: "sub-multi",
|
|
879
|
-
displayName: "Multi User",
|
|
880
|
-
});
|
|
881
|
-
expect(person.uid).toBe("prs_a");
|
|
882
|
-
expect(fetchSpy).toHaveBeenCalledTimes(1);
|
|
883
|
-
});
|
|
884
|
-
it("ensureMyPersonEntity_handles_missing_createdAt_deterministically", async () => {
|
|
885
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, {
|
|
886
|
-
entities: [
|
|
887
|
-
{ uid: "prs_z", slug: "z", type: "person", status: "active" },
|
|
888
|
-
{ uid: "prs_a", slug: "a", type: "person", status: "active" },
|
|
889
|
-
],
|
|
890
|
-
}));
|
|
891
|
-
const person = await client.ensureMyPersonEntity({
|
|
892
|
-
ownerSub: "sub-nodates",
|
|
893
|
-
displayName: "No Dates User",
|
|
894
|
-
});
|
|
895
|
-
// Both missing createdAt → "" tie, uid tiebreak selects prs_a
|
|
896
|
-
expect(person.uid).toBe("prs_a");
|
|
897
|
-
expect(fetchSpy).toHaveBeenCalledTimes(1);
|
|
898
|
-
});
|
|
899
|
-
it("pickCanonicalPersonEntity_picks_oldest_tiebreak_uid", () => {
|
|
900
|
-
const list = [
|
|
901
|
-
{ uid: "prs_b", slug: "b", type: "person", status: "active", createdAt: "2026-01-02T00:00:00Z" },
|
|
902
|
-
{ uid: "prs_a", slug: "a", type: "person", status: "active", createdAt: "2026-01-01T00:00:00Z" },
|
|
903
|
-
];
|
|
904
|
-
// Older createdAt wins
|
|
905
|
-
expect(pickCanonicalPersonEntity(list)?.uid).toBe("prs_a");
|
|
906
|
-
// Same createdAt: uid tiebreak (lexicographic ascending)
|
|
907
|
-
const tieList = [
|
|
908
|
-
{ uid: "prs_z", slug: "z", type: "person", status: "active", createdAt: "2026-01-01T00:00:00Z" },
|
|
909
|
-
{ uid: "prs_a", slug: "a", type: "person", status: "active", createdAt: "2026-01-01T00:00:00Z" },
|
|
910
|
-
];
|
|
911
|
-
expect(pickCanonicalPersonEntity(tieList)?.uid).toBe("prs_a");
|
|
912
|
-
});
|
|
913
|
-
it("pickCanonicalPersonEntity_handles_missing_createdAt_deterministically", () => {
|
|
914
|
-
// undefined createdAt coalesces to "" which sorts before any ISO date string.
|
|
915
|
-
// So the entity with undefined createdAt wins on the createdAt comparison.
|
|
916
|
-
// When two entities both lack createdAt, uid tiebreak applies.
|
|
917
|
-
const list = [
|
|
918
|
-
{ uid: "prs_b", slug: "b", type: "person", status: "active", createdAt: "2026-01-01T00:00:00Z" },
|
|
919
|
-
{ uid: "prs_a", slug: "a", type: "person", status: "active" },
|
|
920
|
-
];
|
|
921
|
-
// "" < "2026-..." so prs_a (undefined→"") wins
|
|
922
|
-
expect(pickCanonicalPersonEntity(list)?.uid).toBe("prs_a");
|
|
923
|
-
// Both undefined: uid tiebreak
|
|
924
|
-
const bothUndefined = [
|
|
925
|
-
{ uid: "prs_z", slug: "z", type: "person", status: "active" },
|
|
926
|
-
{ uid: "prs_a", slug: "a", type: "person", status: "active" },
|
|
927
|
-
];
|
|
928
|
-
expect(pickCanonicalPersonEntity(bothUndefined)?.uid).toBe("prs_a");
|
|
929
|
-
});
|
|
930
|
-
it("pickCanonicalPersonEntity_filters_out_non_person_types", () => {
|
|
931
|
-
const mixed = [
|
|
932
|
-
{ uid: "cmp_x", slug: "x", type: "company", status: "active", createdAt: "2025-01-01T00:00:00Z" },
|
|
933
|
-
{ uid: "prs_b", slug: "b", type: "person", status: "active", createdAt: "2026-01-02T00:00:00Z" },
|
|
934
|
-
];
|
|
935
|
-
const result = pickCanonicalPersonEntity(mixed);
|
|
936
|
-
expect(result?.uid).toBe("prs_b");
|
|
937
|
-
expect(result?.type).toBe("person");
|
|
938
|
-
});
|
|
939
|
-
it("sts.vend roundtrips POST /sts/vend with companyUid", async () => {
|
|
940
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, {
|
|
941
|
-
credentials: {
|
|
942
|
-
accessKeyId: "AKIAIOSFODNN7EXAMPLE",
|
|
943
|
-
secretAccessKey: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
|
|
944
|
-
sessionToken: "FwoGZXIvYXdzEBY...",
|
|
945
|
-
},
|
|
946
|
-
expiresAt: "2026-01-01T01:00:00.000Z",
|
|
947
|
-
}));
|
|
948
|
-
const result = await client.sts.vend({ companyUid: "cmp_x" });
|
|
949
|
-
expect(result.credentials.accessKeyId).toBe("AKIAIOSFODNN7EXAMPLE");
|
|
950
|
-
expect(result.credentials.sessionToken).toBe("FwoGZXIvYXdzEBY...");
|
|
951
|
-
expect(typeof result.expiresAt).toBe("string");
|
|
952
|
-
const [url, init] = fetchSpy.mock.calls[0];
|
|
953
|
-
expect(url).toBe("https://vault.test.example.com/sts/vend");
|
|
954
|
-
expect(init.method.toUpperCase()).toBe("POST");
|
|
955
|
-
expect(JSON.parse(init.body)).toEqual({ companyUid: "cmp_x" });
|
|
956
|
-
});
|
|
957
|
-
it("sts.vend refuses a legacy 200 response whose credentials dropped writes", async () => {
|
|
958
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, {
|
|
959
|
-
credentials: {
|
|
960
|
-
accessKeyId: "AKIAIOSFODNN7EXAMPLE",
|
|
961
|
-
secretAccessKey: "secret",
|
|
962
|
-
sessionToken: "token",
|
|
963
|
-
policyTruncated: true,
|
|
964
|
-
droppedWriteGrantPrefixes: [
|
|
965
|
-
"data/intelligence/deployment-tests/*",
|
|
966
|
-
"data/intelligence/founder-signals/*",
|
|
967
|
-
],
|
|
968
|
-
retainedGrantPrefixes: ["knowledge/*"],
|
|
969
|
-
},
|
|
970
|
-
expiresAt: "2026-01-01T01:00:00.000Z",
|
|
971
|
-
}));
|
|
972
|
-
await expect(client.sts.vend({ companyUid: "cmp_x" })).rejects.toMatchObject({
|
|
973
|
-
name: "VaultCredentialScopeError",
|
|
974
|
-
code: "POLICY_WRITE_SCOPE_TRUNCATED",
|
|
975
|
-
droppedWriteGrantPrefixes: [
|
|
976
|
-
"data/intelligence/deployment-tests/*",
|
|
977
|
-
"data/intelligence/founder-signals/*",
|
|
978
|
-
],
|
|
979
|
-
retainedGrantPrefixes: ["knowledge/*"],
|
|
980
|
-
});
|
|
981
|
-
});
|
|
982
|
-
it("sts.vend maps the server's typed 422 refusal without losing prefix diagnostics", async () => {
|
|
983
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(422, {
|
|
984
|
-
error: "Vault write credentials cannot represent 2 granted prefixes",
|
|
985
|
-
code: "POLICY_WRITE_SCOPE_TRUNCATED",
|
|
986
|
-
droppedWriteGrantPrefixes: [
|
|
987
|
-
"data/intelligence/deployment-tests/*",
|
|
988
|
-
"data/intelligence/founder-signals/*",
|
|
989
|
-
],
|
|
990
|
-
retainedGrantPrefixes: ["knowledge/*"],
|
|
991
|
-
remediation: "Use presigned company-vault access.",
|
|
992
|
-
}));
|
|
993
|
-
const error = await client.sts
|
|
994
|
-
.vend({ companyUid: "cmp_x" })
|
|
995
|
-
.catch((caught) => caught);
|
|
996
|
-
expect(error).toBeInstanceOf(VaultCredentialScopeError);
|
|
997
|
-
expect(error).toMatchObject({
|
|
998
|
-
statusCode: 422,
|
|
999
|
-
code: "POLICY_WRITE_SCOPE_TRUNCATED",
|
|
1000
|
-
retainedGrantPrefixes: ["knowledge/*"],
|
|
1001
|
-
});
|
|
1002
|
-
expect(error.message).toContain("deployment-tests/*");
|
|
1003
|
-
expect(error.message).toContain("Use presigned company-vault access");
|
|
1004
|
-
});
|
|
1005
|
-
it("vendSelf_roundtrip", async () => {
|
|
1006
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, {
|
|
1007
|
-
credentials: {
|
|
1008
|
-
accessKeyId: "AKIAIOSFODNN7EXAMPLE",
|
|
1009
|
-
secretAccessKey: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
|
|
1010
|
-
sessionToken: "FwoGZXIvYXdzEBY...",
|
|
1011
|
-
},
|
|
1012
|
-
expiresAt: "2026-01-01T01:00:00.000Z",
|
|
1013
|
-
}));
|
|
1014
|
-
const result = await client.sts.vendSelf({ personUid: "prs_x" });
|
|
1015
|
-
expect(result.credentials.accessKeyId).toBe("AKIAIOSFODNN7EXAMPLE");
|
|
1016
|
-
expect(result.credentials.secretAccessKey).toBe("wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY");
|
|
1017
|
-
expect(result.credentials.sessionToken).toBe("FwoGZXIvYXdzEBY...");
|
|
1018
|
-
expect(typeof result.expiresAt).toBe("string");
|
|
1019
|
-
const [url, init] = fetchSpy.mock.calls[0];
|
|
1020
|
-
expect(url).toBe("https://vault.test.example.com/sts/vend-self");
|
|
1021
|
-
expect(init.method.toUpperCase()).toBe("POST");
|
|
1022
|
-
expect(JSON.parse(init.body)).toEqual({ personUid: "prs_x" });
|
|
1023
|
-
});
|
|
1024
|
-
});
|
|
1025
|
-
// ---------------------------------------------------------------------------
|
|
1026
|
-
// Browse-vs-sync SDK methods (US-004)
|
|
1027
|
-
//
|
|
1028
|
-
// listMyExplicitGrants, getMembershipSyncConfig, setMembershipSyncConfig
|
|
1029
|
-
// wrap the US-002/US-003 hq-pro endpoints. Tests assert URL shape, payload
|
|
1030
|
-
// shape, error mapping (401/404/network), and the empty-grants fallback
|
|
1031
|
-
// that lets call sites treat "no grants" as a normal state.
|
|
1032
|
-
// ---------------------------------------------------------------------------
|
|
1033
|
-
describe("listMyExplicitGrants (US-004)", () => {
|
|
1034
|
-
it("GETs /v1/files/grants with the company query param and returns grants[]", async () => {
|
|
1035
|
-
const grant = {
|
|
1036
|
-
companyUid: "cmp_abc",
|
|
1037
|
-
path: "shared/docs",
|
|
1038
|
-
permission: "read",
|
|
1039
|
-
source: "person",
|
|
1040
|
-
};
|
|
1041
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, {
|
|
1042
|
-
grants: [grant],
|
|
1043
|
-
computedAt: "2026-05-20T12:00:00.000Z",
|
|
1044
|
-
}));
|
|
1045
|
-
const grants = await client.listMyExplicitGrants("cmp_abc");
|
|
1046
|
-
expect(grants).toEqual([grant]);
|
|
1047
|
-
const [url, init] = fetchSpy.mock.calls[0];
|
|
1048
|
-
expect(url).toBe("https://vault.test.example.com/v1/files/grants?company=cmp_abc");
|
|
1049
|
-
expect(init.method).toBe("GET");
|
|
1050
|
-
expect(init.body).toBeUndefined();
|
|
1051
|
-
});
|
|
1052
|
-
it("parses creator-sourced grants", async () => {
|
|
1053
|
-
const grant = {
|
|
1054
|
-
companyUid: "cmp_abc",
|
|
1055
|
-
path: "personal/psn_creator",
|
|
1056
|
-
permission: "admin",
|
|
1057
|
-
source: "creator",
|
|
1058
|
-
};
|
|
1059
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, {
|
|
1060
|
-
grants: [grant],
|
|
1061
|
-
computedAt: "2026-05-20T12:00:00.000Z",
|
|
1062
|
-
}));
|
|
1063
|
-
const grants = await client.listMyExplicitGrants("cmp_abc");
|
|
1064
|
-
expect(grants[0]?.source).toBe("creator");
|
|
1065
|
-
expect(grants).toEqual([grant]);
|
|
1066
|
-
});
|
|
1067
|
-
it("URL-encodes the companyUid query parameter", async () => {
|
|
1068
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, { grants: [], computedAt: "2026-05-20T12:00:00.000Z" }));
|
|
1069
|
-
await client.listMyExplicitGrants("cmp/with spaces&weird=chars");
|
|
1070
|
-
const [url] = fetchSpy.mock.calls[0];
|
|
1071
|
-
expect(url).toBe("https://vault.test.example.com/v1/files/grants?company=cmp%2Fwith%20spaces%26weird%3Dchars");
|
|
1072
|
-
});
|
|
1073
|
-
it("returns [] when the server omits the grants key (empty graph)", async () => {
|
|
1074
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, { computedAt: "2026-05-20T12:00:00.000Z" }));
|
|
1075
|
-
const grants = await client.listMyExplicitGrants("cmp_abc");
|
|
1076
|
-
expect(grants).toEqual([]);
|
|
1077
|
-
});
|
|
1078
|
-
it("maps 401 to VaultAuthError", async () => {
|
|
1079
|
-
fetchSpy.mockImplementation(() => Promise.resolve(jsonResponse(401, { error: "Missing or invalid authorization token" })));
|
|
1080
|
-
await expect(client.listMyExplicitGrants("cmp_abc")).rejects.toThrow(VaultAuthError);
|
|
1081
|
-
});
|
|
1082
|
-
it("maps 404 to VaultNotFoundError", async () => {
|
|
1083
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(404, { error: "Unknown route" }));
|
|
1084
|
-
await expect(client.listMyExplicitGrants("cmp_abc")).rejects.toThrow(VaultNotFoundError);
|
|
1085
|
-
});
|
|
1086
|
-
it("surfaces transport errors after exhausting retries", async () => {
|
|
1087
|
-
fetchSpy.mockRejectedValue(new Error("ECONNREFUSED"));
|
|
1088
|
-
await expect(client.listMyExplicitGrants("cmp_abc")).rejects.toThrow(/ECONNREFUSED/);
|
|
1089
|
-
// 1 initial + 3 retries = 4 attempts on a persistent network error.
|
|
1090
|
-
expect(fetchSpy).toHaveBeenCalledTimes(4);
|
|
1091
|
-
});
|
|
1092
|
-
});
|
|
1093
|
-
describe("getMembershipSyncConfig (US-004)", () => {
|
|
1094
|
-
it("GETs /v1/memberships/{id}/sync-config and returns the row verbatim", async () => {
|
|
1095
|
-
const row = {
|
|
1096
|
-
membershipId: "psn_1#cmp_abc",
|
|
1097
|
-
syncMode: "custom",
|
|
1098
|
-
customPaths: ["shared/docs", "personal/psn_1"],
|
|
1099
|
-
isDefault: false,
|
|
1100
|
-
updatedAt: "2026-05-20T12:00:00.000Z",
|
|
1101
|
-
updatedBy: "psn_admin",
|
|
1102
|
-
};
|
|
1103
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, row));
|
|
1104
|
-
const result = await client.getMembershipSyncConfig("psn_1#cmp_abc");
|
|
1105
|
-
expect(result).toEqual(row);
|
|
1106
|
-
const [url, init] = fetchSpy.mock.calls[0];
|
|
1107
|
-
expect(url).toBe(
|
|
1108
|
-
// `#` in the membershipKey MUST be URL-encoded — otherwise the
|
|
1109
|
-
// server sees a fragment, not a path segment.
|
|
1110
|
-
"https://vault.test.example.com/v1/memberships/psn_1%23cmp_abc/sync-config");
|
|
1111
|
-
expect(init.method).toBe("GET");
|
|
1112
|
-
expect(init.body).toBeUndefined();
|
|
1113
|
-
});
|
|
1114
|
-
it("returns the default row (isDefault: true) without updatedAt/updatedBy", async () => {
|
|
1115
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, {
|
|
1116
|
-
membershipId: "psn_1#cmp_abc",
|
|
1117
|
-
syncMode: "all",
|
|
1118
|
-
isDefault: true,
|
|
1119
|
-
}));
|
|
1120
|
-
const result = await client.getMembershipSyncConfig("psn_1#cmp_abc");
|
|
1121
|
-
expect(result.isDefault).toBe(true);
|
|
1122
|
-
expect(result.updatedAt).toBeUndefined();
|
|
1123
|
-
expect(result.updatedBy).toBeUndefined();
|
|
1124
|
-
});
|
|
1125
|
-
it("maps 401 to VaultAuthError", async () => {
|
|
1126
|
-
fetchSpy.mockImplementation(() => Promise.resolve(jsonResponse(401, { error: "Token expired" })));
|
|
1127
|
-
await expect(client.getMembershipSyncConfig("psn_1#cmp_abc")).rejects.toThrow(VaultAuthError);
|
|
1128
|
-
});
|
|
1129
|
-
it("maps 404 to VaultNotFoundError (membership tombstoned or missing)", async () => {
|
|
1130
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(404, {
|
|
1131
|
-
error: "Membership not found or not active: psn_1#cmp_abc",
|
|
1132
|
-
}));
|
|
1133
|
-
await expect(client.getMembershipSyncConfig("psn_1#cmp_abc")).rejects.toThrow(VaultNotFoundError);
|
|
1134
|
-
});
|
|
1135
|
-
it("surfaces network errors after retry exhaustion", async () => {
|
|
1136
|
-
fetchSpy.mockRejectedValue(new Error("socket hang up"));
|
|
1137
|
-
await expect(client.getMembershipSyncConfig("psn_1#cmp_abc")).rejects.toThrow(/socket hang up/);
|
|
1138
|
-
expect(fetchSpy).toHaveBeenCalledTimes(4);
|
|
1139
|
-
});
|
|
1140
|
-
});
|
|
1141
|
-
describe("setMembershipSyncConfig (US-004)", () => {
|
|
1142
|
-
it("PUTs the partial body to /v1/memberships/{id}/sync-config", async () => {
|
|
1143
|
-
const persisted = {
|
|
1144
|
-
membershipId: "psn_1#cmp_abc",
|
|
1145
|
-
syncMode: "custom",
|
|
1146
|
-
customPaths: ["shared/docs"],
|
|
1147
|
-
isDefault: false,
|
|
1148
|
-
updatedAt: "2026-05-20T12:00:00.000Z",
|
|
1149
|
-
updatedBy: "psn_1",
|
|
1150
|
-
};
|
|
1151
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, persisted));
|
|
1152
|
-
const result = await client.setMembershipSyncConfig("psn_1#cmp_abc", {
|
|
1153
|
-
syncMode: "custom",
|
|
1154
|
-
customPaths: ["shared/docs"],
|
|
1155
|
-
});
|
|
1156
|
-
expect(result).toEqual(persisted);
|
|
1157
|
-
const [url, init] = fetchSpy.mock.calls[0];
|
|
1158
|
-
expect(url).toBe("https://vault.test.example.com/v1/memberships/psn_1%23cmp_abc/sync-config");
|
|
1159
|
-
expect(init.method).toBe("PUT");
|
|
1160
|
-
const headers = init.headers;
|
|
1161
|
-
expect(headers["Content-Type"]).toBe("application/json");
|
|
1162
|
-
expect(headers.Authorization).toBe("Bearer test-jwt-token-123");
|
|
1163
|
-
expect(JSON.parse(init.body)).toEqual({
|
|
1164
|
-
syncMode: "custom",
|
|
1165
|
-
customPaths: ["shared/docs"],
|
|
1166
|
-
});
|
|
1167
|
-
});
|
|
1168
|
-
it("supports the shared mode without customPaths", async () => {
|
|
1169
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, {
|
|
1170
|
-
membershipId: "psn_1#cmp_abc",
|
|
1171
|
-
syncMode: "shared",
|
|
1172
|
-
isDefault: false,
|
|
1173
|
-
updatedAt: "2026-05-20T12:00:00.000Z",
|
|
1174
|
-
updatedBy: "psn_1",
|
|
1175
|
-
}));
|
|
1176
|
-
const result = await client.setMembershipSyncConfig("psn_1#cmp_abc", {
|
|
1177
|
-
syncMode: "shared",
|
|
1178
|
-
});
|
|
1179
|
-
expect(result.syncMode).toBe("shared");
|
|
1180
|
-
expect(result.customPaths).toBeUndefined();
|
|
1181
|
-
const [, init] = fetchSpy.mock.calls[0];
|
|
1182
|
-
expect(JSON.parse(init.body)).toEqual({ syncMode: "shared" });
|
|
1183
|
-
});
|
|
1184
|
-
it("maps 401 to VaultAuthError", async () => {
|
|
1185
|
-
fetchSpy.mockImplementation(() => Promise.resolve(jsonResponse(401, { error: "Token expired" })));
|
|
1186
|
-
await expect(client.setMembershipSyncConfig("psn_1#cmp_abc", { syncMode: "all" })).rejects.toThrow(VaultAuthError);
|
|
1187
|
-
});
|
|
1188
|
-
it("maps 404 to VaultNotFoundError when the membership is gone", async () => {
|
|
1189
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(404, { error: "Membership not found" }));
|
|
1190
|
-
await expect(client.setMembershipSyncConfig("psn_1#cmp_abc", { syncMode: "all" })).rejects.toThrow(VaultNotFoundError);
|
|
1191
|
-
});
|
|
1192
|
-
it("maps 409 to VaultConflictError", async () => {
|
|
1193
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(409, { error: "Concurrent write conflict" }));
|
|
1194
|
-
await expect(client.setMembershipSyncConfig("psn_1#cmp_abc", { syncMode: "all" })).rejects.toThrow(VaultConflictError);
|
|
1195
|
-
});
|
|
1196
|
-
it("surfaces network errors after retry exhaustion", async () => {
|
|
1197
|
-
fetchSpy.mockRejectedValue(new Error("ETIMEDOUT"));
|
|
1198
|
-
await expect(client.setMembershipSyncConfig("psn_1#cmp_abc", { syncMode: "all" })).rejects.toThrow(/ETIMEDOUT/);
|
|
1199
|
-
const syncConfigCalls = fetchSpy.mock.calls.filter(([url]) => String(url).includes("/v1/memberships/psn_1%23cmp_abc/sync-config"));
|
|
1200
|
-
expect(syncConfigCalls).toHaveLength(4);
|
|
1201
|
-
});
|
|
1202
|
-
});
|
|
1203
|
-
// ---------------------------------------------------------------------------
|
|
1204
|
-
// Refreshable authToken getter
|
|
1205
|
-
//
|
|
1206
|
-
// Regression for the personal-sync 401: a captured `authToken` string can
|
|
1207
|
-
// outlive Cognito's 60-min access token TTL during long multi-company
|
|
1208
|
-
// fanouts, causing mid-flight `refreshEntityContext` calls to 401. The
|
|
1209
|
-
// getter form lets every request resolve the latest token from disk.
|
|
1210
|
-
// ---------------------------------------------------------------------------
|
|
1211
|
-
describe("authToken getter (refreshable token)", () => {
|
|
1212
|
-
// Response bodies can only be read once, so each mock call needs a fresh
|
|
1213
|
-
// Response. Using mockImplementation (not mockResolvedValue) ensures a new
|
|
1214
|
-
// Response instance per request — same pattern as the retry tests above.
|
|
1215
|
-
function alwaysOk(body) {
|
|
1216
|
-
fetchSpy.mockImplementation(() => Promise.resolve(jsonResponse(200, body)));
|
|
1217
|
-
}
|
|
1218
|
-
it("calls the getter on every request", async () => {
|
|
1219
|
-
const getter = vi.fn(async () => "first-token");
|
|
1220
|
-
const c = new VaultClient({
|
|
1221
|
-
apiUrl: "https://vault.test.example.com",
|
|
1222
|
-
authToken: getter,
|
|
1223
|
-
});
|
|
1224
|
-
alwaysOk({ members: [] });
|
|
1225
|
-
await c.listMembersOfCompany("cmp_abc");
|
|
1226
|
-
await c.listMembersOfCompany("cmp_abc");
|
|
1227
|
-
await c.listMembersOfCompany("cmp_abc");
|
|
1228
|
-
expect(getter).toHaveBeenCalledTimes(3);
|
|
1229
|
-
});
|
|
1230
|
-
it("picks up a rotated token without recreating the client", async () => {
|
|
1231
|
-
let current = "stale-token";
|
|
1232
|
-
const c = new VaultClient({
|
|
1233
|
-
apiUrl: "https://vault.test.example.com",
|
|
1234
|
-
authToken: async () => current,
|
|
1235
|
-
});
|
|
1236
|
-
alwaysOk({ members: [] });
|
|
1237
|
-
await c.listMembersOfCompany("cmp_abc");
|
|
1238
|
-
const [, firstInit] = fetchSpy.mock.calls[0];
|
|
1239
|
-
expect(firstInit.headers.Authorization).toBe("Bearer stale-token");
|
|
1240
|
-
// Simulate the menubar refreshing ~/.hq/cognito-tokens.json mid-flight.
|
|
1241
|
-
current = "fresh-token";
|
|
1242
|
-
await c.listMembersOfCompany("cmp_abc");
|
|
1243
|
-
const [, secondInit] = fetchSpy.mock.calls[1];
|
|
1244
|
-
expect(secondInit.headers.Authorization).toBe("Bearer fresh-token");
|
|
1245
|
-
});
|
|
1246
|
-
it("supports a sync getter (returns plain string, not a promise)", async () => {
|
|
1247
|
-
const c = new VaultClient({
|
|
1248
|
-
apiUrl: "https://vault.test.example.com",
|
|
1249
|
-
authToken: () => "sync-token",
|
|
1250
|
-
});
|
|
1251
|
-
alwaysOk({ members: [] });
|
|
1252
|
-
await c.listMembersOfCompany("cmp_abc");
|
|
1253
|
-
const [, init] = fetchSpy.mock.calls[0];
|
|
1254
|
-
expect(init.headers.Authorization).toBe("Bearer sync-token");
|
|
1255
|
-
});
|
|
1256
|
-
it("static-string authToken still works (back-compat)", async () => {
|
|
1257
|
-
const c = new VaultClient({
|
|
1258
|
-
apiUrl: "https://vault.test.example.com",
|
|
1259
|
-
authToken: "static-token",
|
|
1260
|
-
});
|
|
1261
|
-
alwaysOk({ members: [] });
|
|
1262
|
-
await c.listMembersOfCompany("cmp_abc");
|
|
1263
|
-
await c.listMembersOfCompany("cmp_abc");
|
|
1264
|
-
const calls = fetchSpy.mock.calls;
|
|
1265
|
-
for (const [, init] of calls) {
|
|
1266
|
-
expect(init.headers.Authorization).toBe("Bearer static-token");
|
|
1267
|
-
}
|
|
1268
|
-
});
|
|
1269
|
-
});
|
|
1270
|
-
// ---------------------------------------------------------------------------
|
|
1271
|
-
// Raw vend (POST /vend, purpose-aware after US-009)
|
|
1272
|
-
// ---------------------------------------------------------------------------
|
|
1273
|
-
describe("vend (POST /vend, purpose-aware)", () => {
|
|
1274
|
-
it("POSTs to /vend with paths/operations/purpose and returns credentials + policySize", async () => {
|
|
1275
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, {
|
|
1276
|
-
credentials: {
|
|
1277
|
-
accessKeyId: "AKIA-BROWSE",
|
|
1278
|
-
secretAccessKey: "secret",
|
|
1279
|
-
sessionToken: "token",
|
|
1280
|
-
expiration: "2026-05-20T13:00:00.000Z",
|
|
1281
|
-
},
|
|
1282
|
-
paths: ["shared/docs/"],
|
|
1283
|
-
operations: "read-only",
|
|
1284
|
-
purpose: "browse",
|
|
1285
|
-
policySize: 412,
|
|
1286
|
-
requestId: "req_xyz",
|
|
1287
|
-
}));
|
|
1288
|
-
const out = await client.vend({
|
|
1289
|
-
paths: ["shared/docs/"],
|
|
1290
|
-
operations: "read-only",
|
|
1291
|
-
purpose: "browse",
|
|
1292
|
-
});
|
|
1293
|
-
expect(out.purpose).toBe("browse");
|
|
1294
|
-
expect(out.policySize).toBe(412);
|
|
1295
|
-
expect(out.credentials.accessKeyId).toBe("AKIA-BROWSE");
|
|
1296
|
-
expect(out.credentials.sessionToken).toBe("token");
|
|
1297
|
-
const [url, init] = fetchSpy.mock.calls[0];
|
|
1298
|
-
expect(url).toBe("https://vault.test.example.com/vend");
|
|
1299
|
-
expect(init.method.toUpperCase()).toBe("POST");
|
|
1300
|
-
expect(JSON.parse(init.body)).toEqual({
|
|
1301
|
-
paths: ["shared/docs/"],
|
|
1302
|
-
operations: "read-only",
|
|
1303
|
-
purpose: "browse",
|
|
1304
|
-
});
|
|
1305
|
-
});
|
|
1306
|
-
it("forwards purpose='sync' verbatim (no client-side defaulting)", async () => {
|
|
1307
|
-
fetchSpy.mockResolvedValueOnce(jsonResponse(200, {
|
|
1308
|
-
credentials: {
|
|
1309
|
-
accessKeyId: "k",
|
|
1310
|
-
secretAccessKey: "s",
|
|
1311
|
-
sessionToken: "t",
|
|
1312
|
-
expiration: "2026-05-20T13:00:00.000Z",
|
|
1313
|
-
},
|
|
1314
|
-
paths: ["shared/"],
|
|
1315
|
-
operations: "read-only",
|
|
1316
|
-
purpose: "sync",
|
|
1317
|
-
policySize: 200,
|
|
1318
|
-
}));
|
|
1319
|
-
await client.vend({
|
|
1320
|
-
paths: ["shared/"],
|
|
1321
|
-
operations: "read-only",
|
|
1322
|
-
purpose: "sync",
|
|
1323
|
-
duration: 1800,
|
|
1324
|
-
});
|
|
1325
|
-
const [, init] = fetchSpy.mock.calls[0];
|
|
1326
|
-
expect(JSON.parse(init.body)).toEqual({
|
|
1327
|
-
paths: ["shared/"],
|
|
1328
|
-
operations: "read-only",
|
|
1329
|
-
purpose: "sync",
|
|
1330
|
-
duration: 1800,
|
|
1331
|
-
});
|
|
1332
|
-
});
|
|
1333
|
-
});
|
|
1334
|
-
//# sourceMappingURL=vault-client.test.js.map
|