@indigoai-us/hq-cloud 6.15.0 → 6.15.2
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-mutation.d.ts +16 -0
- package/dist/bin/sync-mutation.d.ts.map +1 -0
- package/dist/bin/sync-mutation.js +60 -0
- package/dist/bin/sync-mutation.js.map +1 -0
- package/dist/bin/sync-mutation.test.d.ts +2 -0
- package/dist/bin/sync-mutation.test.d.ts.map +1 -0
- package/dist/bin/sync-mutation.test.js +165 -0
- package/dist/bin/sync-mutation.test.js.map +1 -0
- package/dist/bin/sync-runner-company.d.ts +8 -0
- package/dist/bin/sync-runner-company.d.ts.map +1 -1
- package/dist/bin/sync-runner-company.js +16 -0
- package/dist/bin/sync-runner-company.js.map +1 -1
- package/dist/bin/sync-runner-company.test.d.ts +2 -0
- package/dist/bin/sync-runner-company.test.d.ts.map +1 -0
- package/dist/bin/sync-runner-company.test.js +36 -0
- package/dist/bin/sync-runner-company.test.js.map +1 -0
- package/dist/bin/sync-runner-watch-loop.d.ts.map +1 -1
- package/dist/bin/sync-runner-watch-loop.js +98 -8
- package/dist/bin/sync-runner-watch-loop.js.map +1 -1
- package/dist/bin/sync-runner.d.ts +17 -0
- package/dist/bin/sync-runner.d.ts.map +1 -1
- package/dist/bin/sync-runner.js.map +1 -1
- package/dist/bin/sync-runner.test.js +109 -0
- package/dist/bin/sync-runner.test.js.map +1 -1
- package/dist/cli/conflict-recovery.test.d.ts +2 -0
- package/dist/cli/conflict-recovery.test.d.ts.map +1 -0
- package/dist/cli/conflict-recovery.test.js +201 -0
- package/dist/cli/conflict-recovery.test.js.map +1 -0
- package/dist/cli/conflict.d.ts +60 -0
- package/dist/cli/conflict.d.ts.map +1 -1
- package/dist/cli/conflict.js +333 -0
- package/dist/cli/conflict.js.map +1 -1
- package/dist/cli/sync.d.ts +35 -0
- package/dist/cli/sync.d.ts.map +1 -1
- package/dist/cli/sync.js +100 -0
- package/dist/cli/sync.js.map +1 -1
- package/dist/cli/sync.test.js +85 -1
- package/dist/cli/sync.test.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/skill-telemetry.d.ts +6 -0
- package/dist/skill-telemetry.d.ts.map +1 -1
- package/dist/skill-telemetry.js +14 -2
- package/dist/skill-telemetry.js.map +1 -1
- package/dist/skill-telemetry.test.js +79 -0
- package/dist/skill-telemetry.test.js.map +1 -1
- package/dist/sync/candidate-uploader.d.ts +88 -0
- package/dist/sync/candidate-uploader.d.ts.map +1 -0
- package/dist/sync/candidate-uploader.js +212 -0
- package/dist/sync/candidate-uploader.js.map +1 -0
- package/dist/sync/candidate-uploader.test.d.ts +2 -0
- package/dist/sync/candidate-uploader.test.d.ts.map +1 -0
- package/dist/sync/candidate-uploader.test.js +132 -0
- package/dist/sync/candidate-uploader.test.js.map +1 -0
- package/dist/sync/delta-client.d.ts +73 -0
- package/dist/sync/delta-client.d.ts.map +1 -0
- package/dist/sync/delta-client.js +201 -0
- package/dist/sync/delta-client.js.map +1 -0
- package/dist/sync/delta-client.test.d.ts +2 -0
- package/dist/sync/delta-client.test.d.ts.map +1 -0
- package/dist/sync/delta-client.test.js +97 -0
- package/dist/sync/delta-client.test.js.map +1 -0
- package/dist/sync/durable-apply.d.ts +76 -0
- package/dist/sync/durable-apply.d.ts.map +1 -0
- package/dist/sync/durable-apply.js +530 -0
- package/dist/sync/durable-apply.js.map +1 -0
- package/dist/sync/durable-apply.test.d.ts +2 -0
- package/dist/sync/durable-apply.test.d.ts.map +1 -0
- package/dist/sync/durable-apply.test.js +180 -0
- package/dist/sync/durable-apply.test.js.map +1 -0
- package/dist/sync/event-sync.d.ts +33 -1
- package/dist/sync/event-sync.d.ts.map +1 -1
- package/dist/sync/event-sync.js +149 -1
- package/dist/sync/event-sync.js.map +1 -1
- package/dist/sync/event-sync.test.js +142 -1
- package/dist/sync/event-sync.test.js.map +1 -1
- package/dist/sync/index.d.ts +2 -0
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +1 -0
- package/dist/sync/index.js.map +1 -1
- package/dist/sync/multipart-uploader.d.ts +99 -0
- package/dist/sync/multipart-uploader.d.ts.map +1 -0
- package/dist/sync/multipart-uploader.js +447 -0
- package/dist/sync/multipart-uploader.js.map +1 -0
- package/dist/sync/multipart-uploader.test.d.ts +2 -0
- package/dist/sync/multipart-uploader.test.d.ts.map +1 -0
- package/dist/sync/multipart-uploader.test.js +119 -0
- package/dist/sync/multipart-uploader.test.js.map +1 -0
- package/dist/sync/mutation-client.d.ts +85 -0
- package/dist/sync/mutation-client.d.ts.map +1 -0
- package/dist/sync/mutation-client.js +245 -0
- package/dist/sync/mutation-client.js.map +1 -0
- package/dist/sync/mutation-client.test.d.ts +2 -0
- package/dist/sync/mutation-client.test.d.ts.map +1 -0
- package/dist/sync/mutation-client.test.js +51 -0
- package/dist/sync/mutation-client.test.js.map +1 -0
- package/dist/sync/push-receiver.d.ts +45 -0
- package/dist/sync/push-receiver.d.ts.map +1 -1
- package/dist/sync/push-receiver.js +101 -0
- package/dist/sync/push-receiver.js.map +1 -1
- package/dist/sync/push-receiver.test.js +54 -2
- package/dist/sync/push-receiver.test.js.map +1 -1
- package/dist/sync/scope-inventory-client.d.ts +69 -0
- package/dist/sync/scope-inventory-client.d.ts.map +1 -0
- package/dist/sync/scope-inventory-client.js +210 -0
- package/dist/sync/scope-inventory-client.js.map +1 -0
- package/dist/sync/scope-inventory-client.test.d.ts +2 -0
- package/dist/sync/scope-inventory-client.test.d.ts.map +1 -0
- package/dist/sync/scope-inventory-client.test.js +94 -0
- package/dist/sync/scope-inventory-client.test.js.map +1 -0
- package/dist/sync/snapshot-client.d.ts +98 -0
- package/dist/sync/snapshot-client.d.ts.map +1 -0
- package/dist/sync/snapshot-client.js +402 -0
- package/dist/sync/snapshot-client.js.map +1 -0
- package/dist/sync/snapshot-client.test.d.ts +2 -0
- package/dist/sync/snapshot-client.test.d.ts.map +1 -0
- package/dist/sync/snapshot-client.test.js +169 -0
- package/dist/sync/snapshot-client.test.js.map +1 -0
- package/dist/sync/uploader-finalization.d.ts +97 -0
- package/dist/sync/uploader-finalization.d.ts.map +1 -0
- package/dist/sync/uploader-finalization.js +273 -0
- package/dist/sync/uploader-finalization.js.map +1 -0
- package/dist/sync/uploader-finalization.test.d.ts +2 -0
- package/dist/sync/uploader-finalization.test.d.ts.map +1 -0
- package/dist/sync/uploader-finalization.test.js +92 -0
- package/dist/sync/uploader-finalization.test.js.map +1 -0
- package/dist/telemetry.d.ts +11 -1
- package/dist/telemetry.d.ts.map +1 -1
- package/dist/telemetry.js +21 -2
- package/dist/telemetry.js.map +1 -1
- package/dist/telemetry.test.js +80 -0
- package/dist/telemetry.test.js.map +1 -1
- package/package.json +6 -1
- package/.claude/policies/hq-cloud-esm-cannot-spy-fs-builtins.md +0 -30
- package/.claude/policies/hq-cloud-strip-types-no-parameter-properties.md +0 -22
- package/.github/workflows/ci.yml +0 -84
- package/.github/workflows/publish.yml +0 -56
- package/.github/workflows/unreleased-commits-nag.yml +0 -256
- package/eslint.config.js +0 -67
- package/pnpm-workspace.yaml +0 -2
- package/scripts/presign-transport-e2e.mjs +0 -250
- package/scripts/vault-rebaseline.sh +0 -323
- package/scripts/vault-rescue.sh +0 -332
- package/src/active-company.test.ts +0 -188
- package/src/active-company.ts +0 -168
- package/src/agent-codex-instructions.test.ts +0 -332
- package/src/agent-codex-instructions.ts +0 -309
- package/src/auth.ts +0 -146
- package/src/backup-prune.test.ts +0 -98
- package/src/backup-prune.ts +0 -182
- package/src/bin/backup-prune-runner.ts +0 -33
- package/src/bin/rescue-runner.ts +0 -25
- package/src/bin/sync-runner-company.ts +0 -695
- package/src/bin/sync-runner-events.test.ts +0 -143
- package/src/bin/sync-runner-events.ts +0 -55
- package/src/bin/sync-runner-planning.test.ts +0 -311
- package/src/bin/sync-runner-planning.ts +0 -258
- package/src/bin/sync-runner-rollup.test.ts +0 -37
- package/src/bin/sync-runner-rollup.ts +0 -97
- package/src/bin/sync-runner-telemetry.ts +0 -15
- package/src/bin/sync-runner-watch-loop.ts +0 -1235
- package/src/bin/sync-runner-watch-routes.test.ts +0 -71
- package/src/bin/sync-runner-watch-routes.ts +0 -184
- package/src/bin/sync-runner.test.ts +0 -8767
- package/src/bin/sync-runner.ts +0 -2190
- package/src/cli/accept.ts +0 -124
- package/src/cli/conflict.ts +0 -119
- package/src/cli/doctor.test.ts +0 -581
- package/src/cli/doctor.ts +0 -642
- package/src/cli/index.ts +0 -49
- package/src/cli/invite.test.ts +0 -250
- package/src/cli/invite.ts +0 -214
- package/src/cli/promote.ts +0 -157
- package/src/cli/reindex-knowledge.test.ts +0 -307
- package/src/cli/reindex-knowledge.ts +0 -450
- package/src/cli/reindex.test.ts +0 -957
- package/src/cli/reindex.ts +0 -979
- package/src/cli/rescue-classify-ordering.test.ts +0 -548
- package/src/cli/rescue-clone-diagnostics.test.ts +0 -120
- package/src/cli/rescue-core.ts +0 -3011
- package/src/cli/rescue-drift-reconcile.test.ts +0 -179
- package/src/cli/rescue-drop-dir-symlink.test.ts +0 -224
- package/src/cli/rescue-exec-bit-preserve.test.ts +0 -187
- package/src/cli/rescue-hq-root-guard.test.ts +0 -232
- package/src/cli/rescue-journal-reconcile.test.ts +0 -215
- package/src/cli/rescue-mtime-preserve.test.ts +0 -203
- package/src/cli/rescue-settings-reconcile.test.ts +0 -637
- package/src/cli/rescue-snapshot.test.ts +0 -57
- package/src/cli/rescue-snapshot.ts +0 -51
- package/src/cli/rescue.reindex.test.ts +0 -63
- package/src/cli/rescue.test.ts +0 -131
- package/src/cli/rescue.ts +0 -182
- package/src/cli/share.test.ts +0 -7843
- package/src/cli/share.ts +0 -3663
- package/src/cli/sync-scope.test.ts +0 -652
- package/src/cli/sync.test.ts +0 -5207
- package/src/cli/sync.ts +0 -3470
- package/src/cli/tombstones.ts +0 -106
- package/src/cli/watch-event-push-conflict.test.ts +0 -234
- package/src/client-info.test.ts +0 -214
- package/src/client-info.ts +0 -121
- package/src/cognito-auth.test.ts +0 -712
- package/src/cognito-auth.ts +0 -1422
- package/src/company-resolver.test.ts +0 -618
- package/src/company-resolver.ts +0 -521
- package/src/context.test.ts +0 -583
- package/src/context.ts +0 -378
- package/src/daemon-worker.ts +0 -26
- package/src/daemon.ts +0 -99
- package/src/entity-resolver.test.ts +0 -315
- package/src/entity-resolver.ts +0 -180
- package/src/ignore.test.ts +0 -466
- package/src/ignore.ts +0 -469
- package/src/index.ts +0 -439
- package/src/journal.test.ts +0 -968
- package/src/journal.ts +0 -765
- package/src/lib/cloud-authoritative.test.ts +0 -45
- package/src/lib/cloud-authoritative.ts +0 -59
- package/src/lib/conflict-file.ts +0 -86
- package/src/lib/conflict-index.ts +0 -289
- package/src/lib/conflict.test.ts +0 -348
- package/src/lib/describe-error.test.ts +0 -100
- package/src/lib/describe-error.ts +0 -58
- package/src/lib/exit-codes.ts +0 -24
- package/src/lib/machine-id.test.ts +0 -231
- package/src/lib/machine-id.ts +0 -175
- package/src/lib/net-errors.test.ts +0 -65
- package/src/lib/net-errors.ts +0 -86
- package/src/lib/readlink-safe.test.ts +0 -43
- package/src/lib/readlink-safe.ts +0 -29
- package/src/local-path-codec.test.ts +0 -138
- package/src/local-path-codec.ts +0 -161
- package/src/machine-auth.test.ts +0 -1323
- package/src/manifest-reconcile.test.ts +0 -1123
- package/src/manifest-reconcile.ts +0 -518
- package/src/object-io.test.ts +0 -1221
- package/src/object-io.ts +0 -1306
- package/src/operation-lock.test.ts +0 -484
- package/src/operation-lock.ts +0 -680
- package/src/outcome-telemetry.test.ts +0 -498
- package/src/outcome-telemetry.ts +0 -639
- package/src/personal-vault-exclusions.test.ts +0 -308
- package/src/personal-vault-exclusions.ts +0 -354
- package/src/personal-vault.test.ts +0 -756
- package/src/personal-vault.ts +0 -496
- package/src/prefix-coalesce.test.ts +0 -240
- package/src/prefix-coalesce.ts +0 -273
- package/src/public-surface.test.ts +0 -117
- package/src/qmd-reindex.test.ts +0 -877
- package/src/qmd-reindex.ts +0 -842
- package/src/read-only-state-dir.test.ts +0 -188
- package/src/remote-pull.test.ts +0 -1130
- package/src/remote-pull.ts +0 -618
- package/src/s3.symlink-materialize.test.ts +0 -492
- package/src/s3.test.ts +0 -1789
- package/src/s3.ts +0 -1532
- package/src/schemas/signal-types.test.ts +0 -82
- package/src/schemas/signal-types.ts +0 -38
- package/src/schemas/source-channels.test.ts +0 -82
- package/src/schemas/source-channels.ts +0 -53
- package/src/scope-shrink.test.ts +0 -633
- package/src/scope-shrink.ts +0 -481
- package/src/signals/get.test.ts +0 -310
- package/src/signals/get.ts +0 -75
- package/src/signals/internals.ts +0 -195
- package/src/signals/list.test.ts +0 -420
- package/src/signals/list.ts +0 -79
- package/src/signals/parse.ts +0 -8
- package/src/signals/types.ts +0 -91
- package/src/skill-telemetry.test.ts +0 -1825
- package/src/skill-telemetry.ts +0 -1439
- package/src/sources/get.test.ts +0 -293
- package/src/sources/get.ts +0 -66
- package/src/sources/internals.ts +0 -198
- package/src/sources/list.test.ts +0 -402
- package/src/sources/list.ts +0 -84
- package/src/sources/parse.ts +0 -43
- package/src/sources/types.ts +0 -84
- package/src/sync/event-sync.test.ts +0 -594
- package/src/sync/event-sync.ts +0 -545
- package/src/sync/feature-flags.test.ts +0 -378
- package/src/sync/feature-flags.ts +0 -62
- package/src/sync/index.ts +0 -76
- package/src/sync/lease-client.test.ts +0 -128
- package/src/sync/lease-client.ts +0 -207
- package/src/sync/logger.test.ts +0 -242
- package/src/sync/logger.ts +0 -79
- package/src/sync/metrics.test.ts +0 -462
- package/src/sync/metrics.ts +0 -213
- package/src/sync/pull-scope.ts +0 -265
- package/src/sync/push-event.test.ts +0 -266
- package/src/sync/push-event.ts +0 -224
- package/src/sync/push-receiver.test.ts +0 -566
- package/src/sync/push-receiver.ts +0 -1048
- package/src/sync/push-transport.ts +0 -231
- package/src/sync/realtime-rollout.test.ts +0 -86
- package/src/sync/realtime-rollout.ts +0 -262
- package/src/sync/state-store.test.ts +0 -194
- package/src/sync/state-store.ts +0 -727
- package/src/sync-core.ts +0 -58
- package/src/sync-progress.test.ts +0 -94
- package/src/sync-progress.ts +0 -140
- package/src/telemetry-events.test.ts +0 -88
- package/src/telemetry-events.ts +0 -205
- package/src/telemetry.test.ts +0 -1280
- package/src/telemetry.ts +0 -1109
- package/src/types.ts +0 -314
- package/src/vault-client.test.ts +0 -1380
- package/src/vault-client.ts +0 -1694
- package/src/version.ts +0 -24
- package/src/watch-roots.test.ts +0 -278
- package/src/watch-roots.ts +0 -162
- package/src/watcher-event-gate.test.ts +0 -212
- package/src/watcher.test.ts +0 -1079
- package/src/watcher.ts +0 -1741
- package/test/e2e/sync/cross-tenant-isolation.test.ts +0 -630
- package/test/e2e/sync/skill-telemetry-oversized-transcript.test.ts +0 -124
- package/test/e2e/sync/transient-company-leg.test.ts +0 -384
- package/test/e2e/sync/windows-unreadable-link-leg.test.ts +0 -191
- package/test/e2e/watcher-real-chokidar.test.ts +0 -165
- package/test/e2e/watcher-recursive-backend.test.ts +0 -181
- package/test/e2e/watcher-scoped-coverage.test.ts +0 -381
- package/test/invite-flow.integration.test.ts +0 -244
- package/test/joiner-manifest-reconcile.integration.test.ts +0 -322
- package/test/share-sync.integration.test.ts +0 -213
- package/tsconfig.json +0 -19
- package/vitest.config.ts +0 -22
package/src/sync/event-sync.ts
DELETED
|
@@ -1,545 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Event-driven sync wiring — Phase 3 of event-driven-sync-menubar
|
|
3
|
-
* (US-017 publish / US-018 receive / US-019 rollout gate).
|
|
4
|
-
*
|
|
5
|
-
* Phases 1–2 built every piece but left them unconnected: the watcher runs
|
|
6
|
-
* targeted *push passes* (S3 upload) but never publishes a PushEvent, and the
|
|
7
|
-
* runner's receiver seam defaults to {@link NoopPushReceiver}. This module is
|
|
8
|
-
* the connective tissue that turns both on after a server grant:
|
|
9
|
-
*
|
|
10
|
-
* - {@link resolveEventSync} — a negative-only local kill switch. A server
|
|
11
|
-
* grant remains the only positive authority for publish and receive.
|
|
12
|
-
* - {@link subscribeSyncReceive} — `POST /v1/sync/subscribe` (US-015/US-016):
|
|
13
|
-
* mints the per-device queue and returns `{queueUrl, region, credentials}`,
|
|
14
|
-
* where `credentials` are short-lived STS creds scoped to receive/delete on
|
|
15
|
-
* exactly that queue.
|
|
16
|
-
* - {@link sqsClientFromAwsSdk} — the doc-promised thin adapter from the AWS
|
|
17
|
-
* SDK `SQSClient` to the receiver's narrow {@link SqsClientLike} seam.
|
|
18
|
-
* - {@link createRefreshingSqsClient} — wraps the adapter with credential
|
|
19
|
-
* lifecycle: proactive re-vend before expiry (skew window) + one reactive
|
|
20
|
-
* retry on an expiry-class error. The queue URL is stable across re-vends
|
|
21
|
-
* (same device → same queue, idempotent endpoint); only creds rotate.
|
|
22
|
-
* - {@link startEventSync} — the wiring entry the runner calls from the
|
|
23
|
-
* `--event-push` watch block unless locally disabled. Resolves tenant + device
|
|
24
|
-
* identity, builds the {@link HttpPushTransport} + {@link PushEventEmitter}
|
|
25
|
-
* (publish leg) and the {@link SqsPushReceiver} (receive leg, self-echo
|
|
26
|
-
* filtered), and returns handles. Any startup failure degrades to
|
|
27
|
-
* poll-only — it NEVER takes the daemon down.
|
|
28
|
-
*
|
|
29
|
-
* The 10-minute `--poll-remote-ms` pass remains the correctness backstop for
|
|
30
|
-
* every path here; event delivery is best-effort by design.
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
import {
|
|
34
|
-
SQSClient,
|
|
35
|
-
ReceiveMessageCommand,
|
|
36
|
-
DeleteMessageCommand,
|
|
37
|
-
} from "@aws-sdk/client-sqs";
|
|
38
|
-
|
|
39
|
-
import { HttpPushTransport, type AuthTokenSource } from "./push-transport.js";
|
|
40
|
-
import {
|
|
41
|
-
SqsPushReceiver,
|
|
42
|
-
type PushReceiver,
|
|
43
|
-
type PublishMetricFn,
|
|
44
|
-
type SqsClientLike,
|
|
45
|
-
type SyncEngineFn,
|
|
46
|
-
} from "./push-receiver.js";
|
|
47
|
-
import { PushEventEmitter } from "../watcher.js";
|
|
48
|
-
import type { TreeChangeBatch } from "../watcher.js";
|
|
49
|
-
import {
|
|
50
|
-
emitCloudTelemetry,
|
|
51
|
-
type CloudTelemetryClient,
|
|
52
|
-
type TelemetryClaims,
|
|
53
|
-
} from "../telemetry-events.js";
|
|
54
|
-
import {
|
|
55
|
-
createSyncLatencyMetricPublisher,
|
|
56
|
-
type SyncMetricCredentials,
|
|
57
|
-
} from "./metrics.js";
|
|
58
|
-
import { isEventSyncLocallyDisabled } from "./feature-flags.js";
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Decide whether the client may request event-sync authority from the server.
|
|
62
|
-
*
|
|
63
|
-
* This is negative-only. An unset value or a former force-on value merely
|
|
64
|
-
* permits the authenticated server request; it cannot authorize event sync.
|
|
65
|
-
*/
|
|
66
|
-
export function resolveEventSync(override: string | undefined): boolean {
|
|
67
|
-
return !isEventSyncLocallyDisabled(override);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// ─── US-018: subscribe + credentials ────────────────────────────────────────
|
|
71
|
-
|
|
72
|
-
export interface SubscribeSyncCredentials {
|
|
73
|
-
accessKeyId: string;
|
|
74
|
-
secretAccessKey: string;
|
|
75
|
-
sessionToken: string;
|
|
76
|
-
/** ISO8601 expiry of the vended STS credentials. */
|
|
77
|
-
expiration: string;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export interface SubscribeSyncResponse {
|
|
81
|
-
/** The caller's own per-device queue URL (stable across calls). */
|
|
82
|
-
queueUrl: string;
|
|
83
|
-
/** Region the queue lives in. */
|
|
84
|
-
region: string;
|
|
85
|
-
/** Short-lived creds scoped to receive/delete on exactly this queue. */
|
|
86
|
-
credentials: SubscribeSyncCredentials;
|
|
87
|
-
/** Optional short-lived creds scoped to publish sync latency CloudWatch metrics. */
|
|
88
|
-
cloudWatch?: {
|
|
89
|
-
region: string;
|
|
90
|
-
credentials: SyncMetricCredentials;
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/** Minimal fetch seam (matches push-transport.ts's FetchLike posture). */
|
|
95
|
-
type FetchLike = (
|
|
96
|
-
url: string,
|
|
97
|
-
init: {
|
|
98
|
-
method: string;
|
|
99
|
-
headers: Record<string, string>;
|
|
100
|
-
body: string;
|
|
101
|
-
signal?: AbortSignal;
|
|
102
|
-
},
|
|
103
|
-
) => Promise<{ ok: boolean; status: number; text(): Promise<string> }>;
|
|
104
|
-
|
|
105
|
-
function asNonEmptyString(v: unknown, field: string): string {
|
|
106
|
-
if (typeof v !== "string" || v.length === 0) {
|
|
107
|
-
throw new Error(`subscribeSyncReceive: response missing ${field}`);
|
|
108
|
-
}
|
|
109
|
-
return v;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function parseOptionalCloudWatch(
|
|
113
|
-
obj: Record<string, unknown>,
|
|
114
|
-
): SubscribeSyncResponse["cloudWatch"] {
|
|
115
|
-
if (obj.cloudWatch === undefined) return undefined;
|
|
116
|
-
if (
|
|
117
|
-
!obj.cloudWatch ||
|
|
118
|
-
typeof obj.cloudWatch !== "object" ||
|
|
119
|
-
Array.isArray(obj.cloudWatch)
|
|
120
|
-
) {
|
|
121
|
-
throw new Error("subscribeSyncReceive: response missing cloudWatch.region");
|
|
122
|
-
}
|
|
123
|
-
const cloudWatch = obj.cloudWatch as Record<string, unknown>;
|
|
124
|
-
const creds = (cloudWatch.credentials ?? {}) as Record<string, unknown>;
|
|
125
|
-
return {
|
|
126
|
-
region: asNonEmptyString(cloudWatch.region, "cloudWatch.region"),
|
|
127
|
-
credentials: {
|
|
128
|
-
accessKeyId: asNonEmptyString(
|
|
129
|
-
creds.accessKeyId,
|
|
130
|
-
"cloudWatch.credentials.accessKeyId",
|
|
131
|
-
),
|
|
132
|
-
secretAccessKey: asNonEmptyString(
|
|
133
|
-
creds.secretAccessKey,
|
|
134
|
-
"cloudWatch.credentials.secretAccessKey",
|
|
135
|
-
),
|
|
136
|
-
sessionToken:
|
|
137
|
-
typeof creds.sessionToken === "string" && creds.sessionToken.length > 0
|
|
138
|
-
? creds.sessionToken
|
|
139
|
-
: undefined,
|
|
140
|
-
expiration:
|
|
141
|
-
typeof creds.expiration === "string" && creds.expiration.length > 0
|
|
142
|
-
? creds.expiration
|
|
143
|
-
: undefined,
|
|
144
|
-
},
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* `POST /v1/sync/subscribe` — provision (idempotently) this device's queue
|
|
150
|
-
* and vend fresh receive credentials. Auth mirrors HttpPushTransport: Bearer
|
|
151
|
-
* token resolved per-call via the supplied source.
|
|
152
|
-
*/
|
|
153
|
-
export async function subscribeSyncReceive(opts: {
|
|
154
|
-
apiUrl: string;
|
|
155
|
-
authToken: AuthTokenSource;
|
|
156
|
-
deviceId: string;
|
|
157
|
-
timeoutMs?: number;
|
|
158
|
-
fetchImpl?: FetchLike;
|
|
159
|
-
}): Promise<SubscribeSyncResponse> {
|
|
160
|
-
const apiUrl = opts.apiUrl.replace(/\/+$/, "");
|
|
161
|
-
const tok = opts.authToken;
|
|
162
|
-
const token = typeof tok === "function" ? await tok() : tok;
|
|
163
|
-
const fetchImpl =
|
|
164
|
-
opts.fetchImpl ??
|
|
165
|
-
((input, init) => (globalThis.fetch as unknown as FetchLike)(input, init));
|
|
166
|
-
|
|
167
|
-
const controller = new AbortController();
|
|
168
|
-
const timeout = setTimeout(
|
|
169
|
-
() => controller.abort(),
|
|
170
|
-
opts.timeoutMs ?? 15_000,
|
|
171
|
-
);
|
|
172
|
-
let res: Awaited<ReturnType<FetchLike>>;
|
|
173
|
-
try {
|
|
174
|
-
res = await fetchImpl(`${apiUrl}/v1/sync/subscribe`, {
|
|
175
|
-
method: "POST",
|
|
176
|
-
headers: {
|
|
177
|
-
Authorization: `Bearer ${token}`,
|
|
178
|
-
"Content-Type": "application/json",
|
|
179
|
-
},
|
|
180
|
-
body: JSON.stringify({ deviceId: opts.deviceId }),
|
|
181
|
-
signal: controller.signal,
|
|
182
|
-
});
|
|
183
|
-
} finally {
|
|
184
|
-
clearTimeout(timeout);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
if (!res.ok) {
|
|
188
|
-
const text = await res.text().catch(() => "");
|
|
189
|
-
throw new Error(
|
|
190
|
-
`subscribeSyncReceive: POST /v1/sync/subscribe failed (${res.status}): ${text.slice(0, 300)}`,
|
|
191
|
-
);
|
|
192
|
-
}
|
|
193
|
-
const parsed: unknown = JSON.parse(await res.text());
|
|
194
|
-
const obj = parsed as Record<string, unknown>;
|
|
195
|
-
const creds = (obj.credentials ?? {}) as Record<string, unknown>;
|
|
196
|
-
const cloudWatch = parseOptionalCloudWatch(obj);
|
|
197
|
-
const response: SubscribeSyncResponse = {
|
|
198
|
-
queueUrl: asNonEmptyString(obj.queueUrl, "queueUrl"),
|
|
199
|
-
region: asNonEmptyString(obj.region, "region"),
|
|
200
|
-
credentials: {
|
|
201
|
-
accessKeyId: asNonEmptyString(creds.accessKeyId, "credentials.accessKeyId"),
|
|
202
|
-
secretAccessKey: asNonEmptyString(
|
|
203
|
-
creds.secretAccessKey,
|
|
204
|
-
"credentials.secretAccessKey",
|
|
205
|
-
),
|
|
206
|
-
sessionToken: asNonEmptyString(
|
|
207
|
-
creds.sessionToken,
|
|
208
|
-
"credentials.sessionToken",
|
|
209
|
-
),
|
|
210
|
-
expiration: asNonEmptyString(creds.expiration, "credentials.expiration"),
|
|
211
|
-
},
|
|
212
|
-
};
|
|
213
|
-
if (cloudWatch !== undefined) response.cloudWatch = cloudWatch;
|
|
214
|
-
return response;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
// ─── SQS SDK adapter ────────────────────────────────────────────────────────
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* Adapt the AWS SDK `SQSClient` to the receiver's narrow {@link SqsClientLike}
|
|
221
|
-
* seam (the doc-promised `sqsClientFromAwsSdk` from push-receiver.ts). The
|
|
222
|
-
* abort signal is forwarded so `dispose()` can cut a 20s long-poll short.
|
|
223
|
-
*/
|
|
224
|
-
export function sqsClientFromAwsSdk(
|
|
225
|
-
client: Pick<SQSClient, "send">,
|
|
226
|
-
): SqsClientLike {
|
|
227
|
-
return {
|
|
228
|
-
async receiveMessage({ queueUrl, maxMessages, waitTimeSeconds, signal }) {
|
|
229
|
-
const out = await client.send(
|
|
230
|
-
new ReceiveMessageCommand({
|
|
231
|
-
QueueUrl: queueUrl,
|
|
232
|
-
MaxNumberOfMessages: maxMessages,
|
|
233
|
-
WaitTimeSeconds: waitTimeSeconds,
|
|
234
|
-
}),
|
|
235
|
-
{ abortSignal: signal },
|
|
236
|
-
);
|
|
237
|
-
return {
|
|
238
|
-
messages: (out.Messages ?? []).map((m) => ({
|
|
239
|
-
Body: m.Body,
|
|
240
|
-
ReceiptHandle: m.ReceiptHandle,
|
|
241
|
-
MessageId: m.MessageId,
|
|
242
|
-
})),
|
|
243
|
-
};
|
|
244
|
-
},
|
|
245
|
-
async deleteMessage({ queueUrl, receiptHandle }) {
|
|
246
|
-
await client.send(
|
|
247
|
-
new DeleteMessageCommand({
|
|
248
|
-
QueueUrl: queueUrl,
|
|
249
|
-
ReceiptHandle: receiptHandle,
|
|
250
|
-
}),
|
|
251
|
-
);
|
|
252
|
-
},
|
|
253
|
-
};
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
// ─── Refreshing SQS client (credential lifecycle) ───────────────────────────
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* Error names the SQS SDK surfaces when STS session creds have expired or
|
|
260
|
-
* become invalid. Used for the reactive retry-once path; the proactive
|
|
261
|
-
* skew-window refresh below should make these rare.
|
|
262
|
-
*/
|
|
263
|
-
const EXPIRY_ERROR_NAMES = new Set([
|
|
264
|
-
"ExpiredToken",
|
|
265
|
-
"ExpiredTokenException",
|
|
266
|
-
"InvalidSecurityToken",
|
|
267
|
-
"InvalidClientTokenId",
|
|
268
|
-
"UnrecognizedClientException",
|
|
269
|
-
]);
|
|
270
|
-
|
|
271
|
-
function isExpiryError(err: unknown): boolean {
|
|
272
|
-
return err instanceof Error && EXPIRY_ERROR_NAMES.has(err.name);
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
/** Re-vend this long before the recorded expiry (proactive refresh window). */
|
|
276
|
-
const REFRESH_SKEW_MS = 120_000;
|
|
277
|
-
|
|
278
|
-
export interface RefreshingSqsClientOptions {
|
|
279
|
-
/** The initial subscribe response (creds + region + queue URL). */
|
|
280
|
-
initial: SubscribeSyncResponse;
|
|
281
|
-
/** Re-vend: called when creds are near/past expiry. Idempotent server-side. */
|
|
282
|
-
subscribe: () => Promise<SubscribeSyncResponse>;
|
|
283
|
-
/**
|
|
284
|
-
* Build the underlying narrow client from a subscribe response. Default:
|
|
285
|
-
* AWS SDK `SQSClient` via {@link sqsClientFromAwsSdk}. Tests inject a fake.
|
|
286
|
-
*/
|
|
287
|
-
buildSqs?: (resp: SubscribeSyncResponse) => SqsClientLike;
|
|
288
|
-
/** Clock seam (tests). Default `Date.now`. */
|
|
289
|
-
now?: () => number;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
function defaultBuildSqs(resp: SubscribeSyncResponse): SqsClientLike {
|
|
293
|
-
return sqsClientFromAwsSdk(
|
|
294
|
-
new SQSClient({
|
|
295
|
-
region: resp.region,
|
|
296
|
-
credentials: {
|
|
297
|
-
accessKeyId: resp.credentials.accessKeyId,
|
|
298
|
-
secretAccessKey: resp.credentials.secretAccessKey,
|
|
299
|
-
sessionToken: resp.credentials.sessionToken,
|
|
300
|
-
expiration: new Date(resp.credentials.expiration),
|
|
301
|
-
},
|
|
302
|
-
}),
|
|
303
|
-
);
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
/**
|
|
307
|
-
* An {@link SqsClientLike} that owns the vended-credential lifecycle:
|
|
308
|
-
*
|
|
309
|
-
* - PROACTIVE: before each call, if the recorded expiry is within the skew
|
|
310
|
-
* window, re-subscribe (re-vend) and rebuild the inner client first.
|
|
311
|
-
* - REACTIVE: if a call still fails with an expiry-class error (clock skew,
|
|
312
|
-
* revocation), re-vend once and retry the call once. Anything else — or a
|
|
313
|
-
* second failure — propagates to the receiver's own backoff/reconnect
|
|
314
|
-
* loop, whose retention-backed redelivery makes the miss recoverable.
|
|
315
|
-
*
|
|
316
|
-
* Concurrent refreshes collapse onto one in-flight subscribe promise.
|
|
317
|
-
*/
|
|
318
|
-
export function createRefreshingSqsClient(
|
|
319
|
-
opts: RefreshingSqsClientOptions,
|
|
320
|
-
): SqsClientLike {
|
|
321
|
-
const now = opts.now ?? (() => Date.now());
|
|
322
|
-
const buildSqs = opts.buildSqs ?? defaultBuildSqs;
|
|
323
|
-
|
|
324
|
-
let inner = buildSqs(opts.initial);
|
|
325
|
-
let expiresAtMs = Date.parse(opts.initial.credentials.expiration);
|
|
326
|
-
let refreshing: Promise<void> | null = null;
|
|
327
|
-
|
|
328
|
-
const refresh = (): Promise<void> => {
|
|
329
|
-
refreshing ??= (async () => {
|
|
330
|
-
try {
|
|
331
|
-
const resp = await opts.subscribe();
|
|
332
|
-
inner = buildSqs(resp);
|
|
333
|
-
expiresAtMs = Date.parse(resp.credentials.expiration);
|
|
334
|
-
} finally {
|
|
335
|
-
refreshing = null;
|
|
336
|
-
}
|
|
337
|
-
})();
|
|
338
|
-
return refreshing;
|
|
339
|
-
};
|
|
340
|
-
|
|
341
|
-
const ensureFresh = async (): Promise<void> => {
|
|
342
|
-
if (Number.isFinite(expiresAtMs) && now() >= expiresAtMs - REFRESH_SKEW_MS) {
|
|
343
|
-
await refresh();
|
|
344
|
-
}
|
|
345
|
-
};
|
|
346
|
-
|
|
347
|
-
const withRetry = async <T>(call: () => Promise<T>): Promise<T> => {
|
|
348
|
-
await ensureFresh();
|
|
349
|
-
try {
|
|
350
|
-
return await call();
|
|
351
|
-
} catch (err) {
|
|
352
|
-
if (!isExpiryError(err)) throw err;
|
|
353
|
-
await refresh();
|
|
354
|
-
return await call();
|
|
355
|
-
}
|
|
356
|
-
};
|
|
357
|
-
|
|
358
|
-
return {
|
|
359
|
-
receiveMessage: (args) => withRetry(() => inner.receiveMessage(args)),
|
|
360
|
-
deleteMessage: (args) => withRetry(() => inner.deleteMessage(args)),
|
|
361
|
-
};
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
// ─── US-017 + US-018: full wiring ───────────────────────────────────────────
|
|
365
|
-
|
|
366
|
-
/** Structured line logger seam — the runner passes its stderr logger. */
|
|
367
|
-
export type EventSyncLog = (message: string) => void;
|
|
368
|
-
|
|
369
|
-
export interface StartEventSyncOptions {
|
|
370
|
-
hqRoot: string;
|
|
371
|
-
/** Vault API base URL (the runner's DEFAULT_VAULT_API_URL). */
|
|
372
|
-
apiUrl: string;
|
|
373
|
-
/** Cognito access-token source (getter for long-running daemons). */
|
|
374
|
-
authToken: AuthTokenSource;
|
|
375
|
-
/** This device's stable id (getOrCreateMachineId). */
|
|
376
|
-
deviceId: string;
|
|
377
|
-
/**
|
|
378
|
-
* Resolve the caller's tenant id (canonical person `prs_*` uid). The server
|
|
379
|
-
* rejects publishes whose `originTenantId` mismatches the JWT principal, so
|
|
380
|
-
* this MUST be the same identity the JWT resolves to.
|
|
381
|
-
*/
|
|
382
|
-
resolveTenantId: () => Promise<string>;
|
|
383
|
-
/**
|
|
384
|
-
* The already-routed targeted-pull bridge (the runner's receiverSyncFn,
|
|
385
|
-
* funneled through its runGuarded mutex). Self-echo filtering happens HERE,
|
|
386
|
-
* before this is invoked.
|
|
387
|
-
*/
|
|
388
|
-
syncFn: SyncEngineFn;
|
|
389
|
-
/** Diagnostic logger (one line per lifecycle event). Default: console.error. */
|
|
390
|
-
log?: EventSyncLog;
|
|
391
|
-
// ── test seams ──
|
|
392
|
-
subscribe?: (deviceId: string) => Promise<SubscribeSyncResponse>;
|
|
393
|
-
buildSqs?: (resp: SubscribeSyncResponse) => SqsClientLike;
|
|
394
|
-
transport?: HttpPushTransport;
|
|
395
|
-
telemetryClient?: CloudTelemetryClient | null;
|
|
396
|
-
telemetryClaims?: TelemetryClaims | null;
|
|
397
|
-
now?: () => number;
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
export interface EventSyncHandles {
|
|
401
|
-
/**
|
|
402
|
-
* Publish PushEvents for a settled change batch. Called by the runner
|
|
403
|
-
* AFTER the targeted push pass succeeds — an event must never announce
|
|
404
|
-
* bytes that are not in S3 yet. Fire-and-forget: failures are logged by
|
|
405
|
-
* the emitter's onError and the cadence poll covers the miss.
|
|
406
|
-
*/
|
|
407
|
-
publishBatch: (batch: TreeChangeBatch) => void;
|
|
408
|
-
/** The live receiver (already started). */
|
|
409
|
-
receiver: PushReceiver;
|
|
410
|
-
/** This device's id — the runner uses it nowhere else, exposed for logs. */
|
|
411
|
-
ownDeviceId: string;
|
|
412
|
-
/** Tear down transport + receiver (runner shutdown path). */
|
|
413
|
-
dispose: () => Promise<void>;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
/**
|
|
417
|
-
* Bring up the publish + receive legs. Returns `null` (poll-only degradation)
|
|
418
|
-
* on ANY startup failure — subscribe 5xx, tenant resolution failure, etc. —
|
|
419
|
-
* after logging the reason. The caller treats `null` as "today's behavior".
|
|
420
|
-
*/
|
|
421
|
-
export async function startEventSync(
|
|
422
|
-
opts: StartEventSyncOptions,
|
|
423
|
-
): Promise<EventSyncHandles | null> {
|
|
424
|
-
const log = opts.log ?? ((m: string) => console.error(m));
|
|
425
|
-
try {
|
|
426
|
-
const tenantId = await opts.resolveTenantId();
|
|
427
|
-
const deviceId = opts.deviceId;
|
|
428
|
-
|
|
429
|
-
// The subscription response is the authenticated legacy inventory/grant.
|
|
430
|
-
// No email, environment, tenant, or queued hint can reach the live path
|
|
431
|
-
// without this server-issued queue and credential material.
|
|
432
|
-
const subscribe =
|
|
433
|
-
opts.subscribe ??
|
|
434
|
-
((dev: string) =>
|
|
435
|
-
subscribeSyncReceive({
|
|
436
|
-
apiUrl: opts.apiUrl,
|
|
437
|
-
authToken: opts.authToken,
|
|
438
|
-
deviceId: dev,
|
|
439
|
-
}));
|
|
440
|
-
const initial = await subscribe(deviceId);
|
|
441
|
-
|
|
442
|
-
// ── publish leg (US-017) ──
|
|
443
|
-
const transport =
|
|
444
|
-
opts.transport ??
|
|
445
|
-
new HttpPushTransport({
|
|
446
|
-
apiUrl: opts.apiUrl,
|
|
447
|
-
pushPath: "/v1/sync/push",
|
|
448
|
-
authToken: opts.authToken,
|
|
449
|
-
});
|
|
450
|
-
await transport.start();
|
|
451
|
-
const emitter = new PushEventEmitter({
|
|
452
|
-
originTenantId: tenantId,
|
|
453
|
-
originDeviceId: deviceId,
|
|
454
|
-
transport,
|
|
455
|
-
// This adapter represents the authenticated server grant above. It is
|
|
456
|
-
// created only after the grant succeeds and ignores the tenant argument;
|
|
457
|
-
// it is not a tenant-derived client selector.
|
|
458
|
-
flagProvider: { isEnabled: () => true },
|
|
459
|
-
// Wall-clock sequence numbers: monotonic per device ACROSS daemon
|
|
460
|
-
// restarts (the emitter's default in-process counter restarts at 0,
|
|
461
|
-
// which would make peers' highest-seq dedupe drop every post-restart
|
|
462
|
-
// event). Receiver dedupe is per-path highest-seq, so ms-epoch values
|
|
463
|
-
// also stay comparable when two devices touch the same path.
|
|
464
|
-
getSequenceNumber: () => (opts.now ?? Date.now)(),
|
|
465
|
-
onError: (err, ctx) =>
|
|
466
|
-
log(
|
|
467
|
-
`event-sync: publish failed for ${ctx.relativePath ?? "?"}: ${err.message}`,
|
|
468
|
-
),
|
|
469
|
-
telemetryClient: opts.telemetryClient,
|
|
470
|
-
telemetryClaims: opts.telemetryClaims,
|
|
471
|
-
});
|
|
472
|
-
|
|
473
|
-
// ── receive leg (US-018) ──
|
|
474
|
-
const publishMetric: PublishMetricFn = initial.cloudWatch
|
|
475
|
-
? createSyncLatencyMetricPublisher(initial.cloudWatch)
|
|
476
|
-
: async () => undefined;
|
|
477
|
-
const sqs = createRefreshingSqsClient({
|
|
478
|
-
initial,
|
|
479
|
-
subscribe: () => subscribe(deviceId),
|
|
480
|
-
buildSqs: opts.buildSqs,
|
|
481
|
-
now: opts.now,
|
|
482
|
-
});
|
|
483
|
-
const receiver = new SqsPushReceiver({
|
|
484
|
-
tenantId,
|
|
485
|
-
queueUrl: initial.queueUrl,
|
|
486
|
-
sqs,
|
|
487
|
-
// Self-echo filter: this device's own publishes fan out to its own
|
|
488
|
-
// queue too — pulling them back is wasted work at best and a conflict
|
|
489
|
-
// source at worst. Skip before bridging into the sync engine.
|
|
490
|
-
syncFn: async (ctx) => {
|
|
491
|
-
if (ctx.event.originDeviceId === deviceId) return;
|
|
492
|
-
await opts.syncFn(ctx);
|
|
493
|
-
},
|
|
494
|
-
publishMetric,
|
|
495
|
-
});
|
|
496
|
-
await receiver.start();
|
|
497
|
-
|
|
498
|
-
log(
|
|
499
|
-
`event-sync: live (tenant=${tenantId} device=${deviceId} queue=${initial.queueUrl})`,
|
|
500
|
-
);
|
|
501
|
-
void emitCloudTelemetry(
|
|
502
|
-
opts.telemetryClient,
|
|
503
|
-
{
|
|
504
|
-
eventName: "event_sync_live",
|
|
505
|
-
source: "event-sync",
|
|
506
|
-
properties: {
|
|
507
|
-
deviceId,
|
|
508
|
-
startupResult: "live",
|
|
509
|
-
receiveState: "enabled",
|
|
510
|
-
publishState: "enabled",
|
|
511
|
-
},
|
|
512
|
-
},
|
|
513
|
-
{ claims: opts.telemetryClaims },
|
|
514
|
-
);
|
|
515
|
-
|
|
516
|
-
return {
|
|
517
|
-
publishBatch: (batch) => void emitter.emitForBatch(batch),
|
|
518
|
-
receiver,
|
|
519
|
-
ownDeviceId: deviceId,
|
|
520
|
-
dispose: async () => {
|
|
521
|
-
await receiver.dispose().catch(() => undefined);
|
|
522
|
-
await transport.dispose().catch(() => undefined);
|
|
523
|
-
},
|
|
524
|
-
};
|
|
525
|
-
} catch (err) {
|
|
526
|
-
log(
|
|
527
|
-
`event-sync: startup failed, continuing poll-only: ${err instanceof Error ? err.message : String(err)}`,
|
|
528
|
-
);
|
|
529
|
-
void emitCloudTelemetry(
|
|
530
|
-
opts.telemetryClient,
|
|
531
|
-
{
|
|
532
|
-
eventName: "event_sync_live",
|
|
533
|
-
source: "event-sync",
|
|
534
|
-
properties: {
|
|
535
|
-
deviceId: opts.deviceId,
|
|
536
|
-
startupResult: "poll_only",
|
|
537
|
-
receiveState: "disabled",
|
|
538
|
-
publishState: "disabled",
|
|
539
|
-
},
|
|
540
|
-
},
|
|
541
|
-
{ claims: opts.telemetryClaims },
|
|
542
|
-
);
|
|
543
|
-
return null;
|
|
544
|
-
}
|
|
545
|
-
}
|