@murphai/hosted-execution 0.1.15 → 0.1.18
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/LICENSE +201 -674
- package/README.md +15 -14
- package/dist/auth.d.ts +11 -25
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +32 -76
- package/dist/auth.js.map +1 -1
- package/dist/builders.d.ts +3 -4
- package/dist/builders.d.ts.map +1 -1
- package/dist/builders.js +24 -24
- package/dist/builders.js.map +1 -1
- package/dist/bundles.d.ts +3 -13
- package/dist/bundles.d.ts.map +1 -1
- package/dist/bundles.js +1 -16
- package/dist/bundles.js.map +1 -1
- package/dist/client.d.ts +2 -26
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +38 -212
- package/dist/client.js.map +1 -1
- package/dist/contracts.d.ts +49 -118
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +15 -58
- package/dist/contracts.js.map +1 -1
- package/dist/dispatch-ref.d.ts +1 -2
- package/dist/dispatch-ref.d.ts.map +1 -1
- package/dist/dispatch-ref.js +16 -30
- package/dist/dispatch-ref.js.map +1 -1
- package/dist/env.d.ts +0 -38
- package/dist/env.d.ts.map +1 -1
- package/dist/env.js +1 -87
- package/dist/env.js.map +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -2
- package/dist/index.js.map +1 -1
- package/dist/observability.d.ts +3 -1
- package/dist/observability.d.ts.map +1 -1
- package/dist/observability.js +76 -53
- package/dist/observability.js.map +1 -1
- package/dist/outbox-payload.d.ts +7 -5
- package/dist/outbox-payload.d.ts.map +1 -1
- package/dist/outbox-payload.js +75 -38
- package/dist/outbox-payload.js.map +1 -1
- package/dist/parsers.d.ts +10 -10
- package/dist/parsers.d.ts.map +1 -1
- package/dist/parsers.js +192 -139
- package/dist/parsers.js.map +1 -1
- package/dist/routes.d.ts +4 -9
- package/dist/routes.d.ts.map +1 -1
- package/dist/routes.js +7 -18
- package/dist/routes.js.map +1 -1
- package/node_modules/@murphai/core/README.md +3 -0
- package/node_modules/@murphai/core/dist/assessment/index.d.ts +5 -0
- package/node_modules/@murphai/core/dist/assessment/index.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/assessment/index.js +4 -0
- package/node_modules/@murphai/core/dist/assessment/index.js.map +1 -0
- package/node_modules/@murphai/core/dist/assessment/project.d.ts +9 -0
- package/node_modules/@murphai/core/dist/assessment/project.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/assessment/project.js +353 -0
- package/node_modules/@murphai/core/dist/assessment/project.js.map +1 -0
- package/node_modules/@murphai/core/dist/assessment/storage.d.ts +13 -0
- package/node_modules/@murphai/core/dist/assessment/storage.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/assessment/storage.js +202 -0
- package/node_modules/@murphai/core/dist/assessment/storage.js.map +1 -0
- package/node_modules/@murphai/core/dist/assessment/types.d.ts +112 -0
- package/node_modules/@murphai/core/dist/assessment/types.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/assessment/types.js +5 -0
- package/node_modules/@murphai/core/dist/assessment/types.js.map +1 -0
- package/node_modules/@murphai/core/dist/atomic-write.d.ts +5 -0
- package/node_modules/@murphai/core/dist/atomic-write.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/atomic-write.js +120 -0
- package/node_modules/@murphai/core/dist/atomic-write.js.map +1 -0
- package/node_modules/@murphai/core/dist/audit.d.ts +27 -0
- package/node_modules/@murphai/core/dist/audit.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/audit.js +94 -0
- package/node_modules/@murphai/core/dist/audit.js.map +1 -0
- package/node_modules/@murphai/core/dist/automation.d.ts +55 -0
- package/node_modules/@murphai/core/dist/automation.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/automation.js +411 -0
- package/node_modules/@murphai/core/dist/automation.js.map +1 -0
- package/node_modules/@murphai/core/dist/bank/allergies.d.ts +5 -0
- package/node_modules/@murphai/core/dist/bank/allergies.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/bank/allergies.js +209 -0
- package/node_modules/@murphai/core/dist/bank/allergies.js.map +1 -0
- package/node_modules/@murphai/core/dist/bank/conditions.d.ts +5 -0
- package/node_modules/@murphai/core/dist/bank/conditions.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/bank/conditions.js +249 -0
- package/node_modules/@murphai/core/dist/bank/conditions.js.map +1 -0
- package/node_modules/@murphai/core/dist/bank/foods.d.ts +8 -0
- package/node_modules/@murphai/core/dist/bank/foods.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/bank/foods.js +255 -0
- package/node_modules/@murphai/core/dist/bank/foods.js.map +1 -0
- package/node_modules/@murphai/core/dist/bank/goals.d.ts +5 -0
- package/node_modules/@murphai/core/dist/bank/goals.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/bank/goals.js +289 -0
- package/node_modules/@murphai/core/dist/bank/goals.js.map +1 -0
- package/node_modules/@murphai/core/dist/bank/index.d.ts +10 -0
- package/node_modules/@murphai/core/dist/bank/index.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/bank/index.js +10 -0
- package/node_modules/@murphai/core/dist/bank/index.js.map +1 -0
- package/node_modules/@murphai/core/dist/bank/protocols.d.ts +8 -0
- package/node_modules/@murphai/core/dist/bank/protocols.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/bank/protocols.js +466 -0
- package/node_modules/@murphai/core/dist/bank/protocols.js.map +1 -0
- package/node_modules/@murphai/core/dist/bank/providers.d.ts +46 -0
- package/node_modules/@murphai/core/dist/bank/providers.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/bank/providers.js +160 -0
- package/node_modules/@murphai/core/dist/bank/providers.js.map +1 -0
- package/node_modules/@murphai/core/dist/bank/recipes.d.ts +8 -0
- package/node_modules/@murphai/core/dist/bank/recipes.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/bank/recipes.js +287 -0
- package/node_modules/@murphai/core/dist/bank/recipes.js.map +1 -0
- package/node_modules/@murphai/core/dist/bank/shared.d.ts +39 -0
- package/node_modules/@murphai/core/dist/bank/shared.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/bank/shared.js +150 -0
- package/node_modules/@murphai/core/dist/bank/shared.js.map +1 -0
- package/node_modules/@murphai/core/dist/bank/types.d.ts +469 -0
- package/node_modules/@murphai/core/dist/bank/types.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/bank/types.js +35 -0
- package/node_modules/@murphai/core/dist/bank/types.js.map +1 -0
- package/node_modules/@murphai/core/dist/bank/workout-formats.d.ts +5 -0
- package/node_modules/@murphai/core/dist/bank/workout-formats.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/bank/workout-formats.js +204 -0
- package/node_modules/@murphai/core/dist/bank/workout-formats.js.map +1 -0
- package/node_modules/@murphai/core/dist/canonical-mutations.d.ts +54 -0
- package/node_modules/@murphai/core/dist/canonical-mutations.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/canonical-mutations.js +196 -0
- package/node_modules/@murphai/core/dist/canonical-mutations.js.map +1 -0
- package/node_modules/@murphai/core/dist/constants.d.ts +125 -0
- package/node_modules/@murphai/core/dist/constants.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/constants.js +132 -0
- package/node_modules/@murphai/core/dist/constants.js.map +1 -0
- package/node_modules/@murphai/core/dist/domains/events.d.ts +100 -0
- package/node_modules/@murphai/core/dist/domains/events.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/domains/events.js +593 -0
- package/node_modules/@murphai/core/dist/domains/events.js.map +1 -0
- package/node_modules/@murphai/core/dist/domains/experiments.d.ts +71 -0
- package/node_modules/@murphai/core/dist/domains/experiments.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/domains/experiments.js +275 -0
- package/node_modules/@murphai/core/dist/domains/experiments.js.map +1 -0
- package/node_modules/@murphai/core/dist/domains/journal.d.ts +52 -0
- package/node_modules/@murphai/core/dist/domains/journal.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/domains/journal.js +173 -0
- package/node_modules/@murphai/core/dist/domains/journal.js.map +1 -0
- package/node_modules/@murphai/core/dist/domains/shared.d.ts +37 -0
- package/node_modules/@murphai/core/dist/domains/shared.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/domains/shared.js +101 -0
- package/node_modules/@murphai/core/dist/domains/shared.js.map +1 -0
- package/node_modules/@murphai/core/dist/domains/vault-summary.d.ts +15 -0
- package/node_modules/@murphai/core/dist/domains/vault-summary.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/domains/vault-summary.js +58 -0
- package/node_modules/@murphai/core/dist/domains/vault-summary.js.map +1 -0
- package/node_modules/@murphai/core/dist/errors.d.ts +8 -0
- package/node_modules/@murphai/core/dist/errors.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/errors.js +14 -0
- package/node_modules/@murphai/core/dist/errors.js.map +1 -0
- package/node_modules/@murphai/core/dist/event-attachments.d.ts +69 -0
- package/node_modules/@murphai/core/dist/event-attachments.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/event-attachments.js +202 -0
- package/node_modules/@murphai/core/dist/event-attachments.js.map +1 -0
- package/node_modules/@murphai/core/dist/event-links.d.ts +15 -0
- package/node_modules/@murphai/core/dist/event-links.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/event-links.js +54 -0
- package/node_modules/@murphai/core/dist/event-links.js.map +1 -0
- package/node_modules/@murphai/core/dist/family/api.d.ts +5 -0
- package/node_modules/@murphai/core/dist/family/api.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/family/api.js +221 -0
- package/node_modules/@murphai/core/dist/family/api.js.map +1 -0
- package/node_modules/@murphai/core/dist/family/index.d.ts +3 -0
- package/node_modules/@murphai/core/dist/family/index.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/family/index.js +3 -0
- package/node_modules/@murphai/core/dist/family/index.js.map +1 -0
- package/node_modules/@murphai/core/dist/family/types.d.ts +34 -0
- package/node_modules/@murphai/core/dist/family/types.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/family/types.js +2 -0
- package/node_modules/@murphai/core/dist/family/types.js.map +1 -0
- package/node_modules/@murphai/core/dist/frontmatter.d.ts +4 -0
- package/node_modules/@murphai/core/dist/frontmatter.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/frontmatter.js +99 -0
- package/node_modules/@murphai/core/dist/frontmatter.js.map +1 -0
- package/node_modules/@murphai/core/dist/fs.d.ts +22 -0
- package/node_modules/@murphai/core/dist/fs.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/fs.js +172 -0
- package/node_modules/@murphai/core/dist/fs.js.map +1 -0
- package/node_modules/@murphai/core/dist/genetics/api.d.ts +5 -0
- package/node_modules/@murphai/core/dist/genetics/api.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/genetics/api.js +226 -0
- package/node_modules/@murphai/core/dist/genetics/api.js.map +1 -0
- package/node_modules/@murphai/core/dist/genetics/index.d.ts +3 -0
- package/node_modules/@murphai/core/dist/genetics/index.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/genetics/index.js +3 -0
- package/node_modules/@murphai/core/dist/genetics/index.js.map +1 -0
- package/node_modules/@murphai/core/dist/genetics/types.d.ts +40 -0
- package/node_modules/@murphai/core/dist/genetics/types.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/genetics/types.js +4 -0
- package/node_modules/@murphai/core/dist/genetics/types.js.map +1 -0
- package/node_modules/@murphai/core/dist/history/api.d.ts +7 -0
- package/node_modules/@murphai/core/dist/history/api.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/history/api.js +473 -0
- package/node_modules/@murphai/core/dist/history/api.js.map +1 -0
- package/node_modules/@murphai/core/dist/history/event-spine.d.ts +41 -0
- package/node_modules/@murphai/core/dist/history/event-spine.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/history/event-spine.js +111 -0
- package/node_modules/@murphai/core/dist/history/event-spine.js.map +1 -0
- package/node_modules/@murphai/core/dist/history/index.d.ts +3 -0
- package/node_modules/@murphai/core/dist/history/index.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/history/index.js +3 -0
- package/node_modules/@murphai/core/dist/history/index.js.map +1 -0
- package/node_modules/@murphai/core/dist/history/shared.d.ts +25 -0
- package/node_modules/@murphai/core/dist/history/shared.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/history/shared.js +144 -0
- package/node_modules/@murphai/core/dist/history/shared.js.map +1 -0
- package/node_modules/@murphai/core/dist/history/types.d.ts +127 -0
- package/node_modules/@murphai/core/dist/history/types.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/history/types.js +8 -0
- package/node_modules/@murphai/core/dist/history/types.js.map +1 -0
- package/node_modules/@murphai/core/dist/ids.d.ts +3 -0
- package/node_modules/@murphai/core/dist/ids.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/ids.js +20 -0
- package/node_modules/@murphai/core/dist/ids.js.map +1 -0
- package/node_modules/@murphai/core/dist/index.d.ts +30 -0
- package/node_modules/@murphai/core/dist/index.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/index.js +23 -0
- package/node_modules/@murphai/core/dist/index.js.map +1 -0
- package/node_modules/@murphai/core/dist/jsonl.d.ts +12 -0
- package/node_modules/@murphai/core/dist/jsonl.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/jsonl.js +40 -0
- package/node_modules/@murphai/core/dist/jsonl.js.map +1 -0
- package/node_modules/@murphai/core/dist/memory.d.ts +17 -0
- package/node_modules/@murphai/core/dist/memory.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/memory.js +72 -0
- package/node_modules/@murphai/core/dist/memory.js.map +1 -0
- package/node_modules/@murphai/core/dist/mutations.d.ts +150 -0
- package/node_modules/@murphai/core/dist/mutations.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/mutations.js +1109 -0
- package/node_modules/@murphai/core/dist/mutations.js.map +1 -0
- package/node_modules/@murphai/core/dist/operations/canonical-write-lock.d.ts +29 -0
- package/node_modules/@murphai/core/dist/operations/canonical-write-lock.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/operations/canonical-write-lock.js +164 -0
- package/node_modules/@murphai/core/dist/operations/canonical-write-lock.js.map +1 -0
- package/node_modules/@murphai/core/dist/operations/index.d.ts +5 -0
- package/node_modules/@murphai/core/dist/operations/index.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/operations/index.js +3 -0
- package/node_modules/@murphai/core/dist/operations/index.js.map +1 -0
- package/node_modules/@murphai/core/dist/operations/raw-manifests.d.ts +33 -0
- package/node_modules/@murphai/core/dist/operations/raw-manifests.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/operations/raw-manifests.js +105 -0
- package/node_modules/@murphai/core/dist/operations/raw-manifests.js.map +1 -0
- package/node_modules/@murphai/core/dist/operations/write-batch.d.ts +166 -0
- package/node_modules/@murphai/core/dist/operations/write-batch.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/operations/write-batch.js +886 -0
- package/node_modules/@murphai/core/dist/operations/write-batch.js.map +1 -0
- package/node_modules/@murphai/core/dist/path-safety.d.ts +19 -0
- package/node_modules/@murphai/core/dist/path-safety.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/path-safety.js +193 -0
- package/node_modules/@murphai/core/dist/path-safety.js.map +1 -0
- package/node_modules/@murphai/core/dist/profile/index.d.ts +4 -0
- package/node_modules/@murphai/core/dist/profile/index.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/profile/index.js +3 -0
- package/node_modules/@murphai/core/dist/profile/index.js.map +1 -0
- package/node_modules/@murphai/core/dist/profile/storage.d.ts +41 -0
- package/node_modules/@murphai/core/dist/profile/storage.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/profile/storage.js +225 -0
- package/node_modules/@murphai/core/dist/profile/storage.js.map +1 -0
- package/node_modules/@murphai/core/dist/profile/types.d.ts +29 -0
- package/node_modules/@murphai/core/dist/profile/types.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/profile/types.js +8 -0
- package/node_modules/@murphai/core/dist/profile/types.js.map +1 -0
- package/node_modules/@murphai/core/dist/public-mutations.d.ts +120 -0
- package/node_modules/@murphai/core/dist/public-mutations.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/public-mutations.js +275 -0
- package/node_modules/@murphai/core/dist/public-mutations.js.map +1 -0
- package/node_modules/@murphai/core/dist/raw.d.ts +28 -0
- package/node_modules/@murphai/core/dist/raw.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/raw.js +107 -0
- package/node_modules/@murphai/core/dist/raw.js.map +1 -0
- package/node_modules/@murphai/core/dist/registry/api.d.ts +80 -0
- package/node_modules/@murphai/core/dist/registry/api.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/registry/api.js +113 -0
- package/node_modules/@murphai/core/dist/registry/api.js.map +1 -0
- package/node_modules/@murphai/core/dist/registry/id-or-slug.d.ts +15 -0
- package/node_modules/@murphai/core/dist/registry/id-or-slug.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/registry/id-or-slug.js +9 -0
- package/node_modules/@murphai/core/dist/registry/id-or-slug.js.map +1 -0
- package/node_modules/@murphai/core/dist/registry/markdown.d.ts +101 -0
- package/node_modules/@murphai/core/dist/registry/markdown.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/registry/markdown.js +136 -0
- package/node_modules/@murphai/core/dist/registry/markdown.js.map +1 -0
- package/node_modules/@murphai/core/dist/shares.d.ts +36 -0
- package/node_modules/@murphai/core/dist/shares.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/shares.js +333 -0
- package/node_modules/@murphai/core/dist/shares.js.map +1 -0
- package/node_modules/@murphai/core/dist/storage-spine.d.ts +3 -0
- package/node_modules/@murphai/core/dist/storage-spine.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/storage-spine.js +3 -0
- package/node_modules/@murphai/core/dist/storage-spine.js.map +1 -0
- package/node_modules/@murphai/core/dist/time.d.ts +11 -0
- package/node_modules/@murphai/core/dist/time.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/time.js +72 -0
- package/node_modules/@murphai/core/dist/time.js.map +1 -0
- package/node_modules/@murphai/core/dist/types.d.ts +18 -0
- package/node_modules/@murphai/core/dist/types.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/types.js +7 -0
- package/node_modules/@murphai/core/dist/types.js.map +1 -0
- package/node_modules/@murphai/core/dist/vault-core-document.d.ts +8 -0
- package/node_modules/@murphai/core/dist/vault-core-document.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/vault-core-document.js +16 -0
- package/node_modules/@murphai/core/dist/vault-core-document.js.map +1 -0
- package/node_modules/@murphai/core/dist/vault-metadata.d.ts +17 -0
- package/node_modules/@murphai/core/dist/vault-metadata.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/vault-metadata.js +44 -0
- package/node_modules/@murphai/core/dist/vault-metadata.js.map +1 -0
- package/node_modules/@murphai/core/dist/vault-upgrade.d.ts +24 -0
- package/node_modules/@murphai/core/dist/vault-upgrade.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/vault-upgrade.js +44 -0
- package/node_modules/@murphai/core/dist/vault-upgrade.js.map +1 -0
- package/node_modules/@murphai/core/dist/vault.d.ts +40 -0
- package/node_modules/@murphai/core/dist/vault.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/vault.js +649 -0
- package/node_modules/@murphai/core/dist/vault.js.map +1 -0
- package/node_modules/@murphai/core/dist/write-policy.d.ts +63 -0
- package/node_modules/@murphai/core/dist/write-policy.d.ts.map +1 -0
- package/node_modules/@murphai/core/dist/write-policy.js +146 -0
- package/node_modules/@murphai/core/dist/write-policy.js.map +1 -0
- package/node_modules/@murphai/core/package.json +27 -0
- package/node_modules/@murphai/device-syncd/README.md +123 -0
- package/node_modules/@murphai/device-syncd/dist/bin.d.ts +2 -0
- package/node_modules/@murphai/device-syncd/dist/bin.d.ts.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/bin.js +29 -0
- package/node_modules/@murphai/device-syncd/dist/bin.js.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/client.d.ts +124 -0
- package/node_modules/@murphai/device-syncd/dist/client.d.ts.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/client.js +199 -0
- package/node_modules/@murphai/device-syncd/dist/client.js.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/config.d.ts +18 -0
- package/node_modules/@murphai/device-syncd/dist/config.d.ts.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/config.js +279 -0
- package/node_modules/@murphai/device-syncd/dist/config.js.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/crypto.d.ts +6 -0
- package/node_modules/@murphai/device-syncd/dist/crypto.d.ts.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/crypto.js +27 -0
- package/node_modules/@murphai/device-syncd/dist/crypto.js.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/errors.d.ts +21 -0
- package/node_modules/@murphai/device-syncd/dist/errors.d.ts.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/errors.js +32 -0
- package/node_modules/@murphai/device-syncd/dist/errors.js.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/hosted-hints.d.ts +3 -0
- package/node_modules/@murphai/device-syncd/dist/hosted-hints.d.ts.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/hosted-hints.js +110 -0
- package/node_modules/@murphai/device-syncd/dist/hosted-hints.js.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/hosted-runtime.d.ts +139 -0
- package/node_modules/@murphai/device-syncd/dist/hosted-runtime.d.ts.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/hosted-runtime.js +336 -0
- package/node_modules/@murphai/device-syncd/dist/hosted-runtime.js.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/http.d.ts +34 -0
- package/node_modules/@murphai/device-syncd/dist/http.d.ts.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/http.js +644 -0
- package/node_modules/@murphai/device-syncd/dist/http.js.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/index.d.ts +23 -0
- package/node_modules/@murphai/device-syncd/dist/index.d.ts.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/index.js +15 -0
- package/node_modules/@murphai/device-syncd/dist/index.js.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/providers/garmin.d.ts +15 -0
- package/node_modules/@murphai/device-syncd/dist/providers/garmin.d.ts.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/providers/garmin.js +485 -0
- package/node_modules/@murphai/device-syncd/dist/providers/garmin.js.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/providers/oura-webhooks.d.ts +49 -0
- package/node_modules/@murphai/device-syncd/dist/providers/oura-webhooks.d.ts.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/providers/oura-webhooks.js +401 -0
- package/node_modules/@murphai/device-syncd/dist/providers/oura-webhooks.js.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/providers/oura.d.ts +20 -0
- package/node_modules/@murphai/device-syncd/dist/providers/oura.d.ts.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/providers/oura.js +804 -0
- package/node_modules/@murphai/device-syncd/dist/providers/oura.js.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/providers/shared-oauth.d.ts +104 -0
- package/node_modules/@murphai/device-syncd/dist/providers/shared-oauth.d.ts.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/providers/shared-oauth.js +214 -0
- package/node_modules/@murphai/device-syncd/dist/providers/shared-oauth.js.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/providers/whoop.d.ts +15 -0
- package/node_modules/@murphai/device-syncd/dist/providers/whoop.d.ts.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/providers/whoop.js +551 -0
- package/node_modules/@murphai/device-syncd/dist/providers/whoop.js.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/public-account.d.ts +4 -0
- package/node_modules/@murphai/device-syncd/dist/public-account.d.ts.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/public-account.js +13 -0
- package/node_modules/@murphai/device-syncd/dist/public-account.js.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/public-ingress.d.ts +43 -0
- package/node_modules/@murphai/device-syncd/dist/public-ingress.d.ts.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/public-ingress.js +353 -0
- package/node_modules/@murphai/device-syncd/dist/public-ingress.js.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/registry.d.ts +3 -0
- package/node_modules/@murphai/device-syncd/dist/registry.d.ts.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/registry.js +5 -0
- package/node_modules/@murphai/device-syncd/dist/registry.js.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/service.d.ts +61 -0
- package/node_modules/@murphai/device-syncd/dist/service.d.ts.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/service.js +496 -0
- package/node_modules/@murphai/device-syncd/dist/service.js.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/shared.d.ts +26 -0
- package/node_modules/@murphai/device-syncd/dist/shared.d.ts.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/shared.js +182 -0
- package/node_modules/@murphai/device-syncd/dist/shared.js.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/store.d.ts +105 -0
- package/node_modules/@murphai/device-syncd/dist/store.d.ts.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/store.js +965 -0
- package/node_modules/@murphai/device-syncd/dist/store.js.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/types.d.ts +287 -0
- package/node_modules/@murphai/device-syncd/dist/types.d.ts.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/types.js +2 -0
- package/node_modules/@murphai/device-syncd/dist/types.js.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/webhook-verification.d.ts +14 -0
- package/node_modules/@murphai/device-syncd/dist/webhook-verification.d.ts.map +1 -0
- package/node_modules/@murphai/device-syncd/dist/webhook-verification.js +16 -0
- package/node_modules/@murphai/device-syncd/dist/webhook-verification.js.map +1 -0
- package/node_modules/@murphai/device-syncd/package.json +85 -0
- package/node_modules/@murphai/importers/README.md +34 -0
- package/node_modules/@murphai/importers/dist/assessment/core-port.d.ts +13 -0
- package/node_modules/@murphai/importers/dist/assessment/core-port.d.ts.map +1 -0
- package/node_modules/@murphai/importers/dist/assessment/core-port.js +13 -0
- package/node_modules/@murphai/importers/dist/assessment/core-port.js.map +1 -0
- package/node_modules/@murphai/importers/dist/assessment/import-assessment-response.d.ts +15 -0
- package/node_modules/@murphai/importers/dist/assessment/import-assessment-response.d.ts.map +1 -0
- package/node_modules/@murphai/importers/dist/assessment/import-assessment-response.js +32 -0
- package/node_modules/@murphai/importers/dist/assessment/import-assessment-response.js.map +1 -0
- package/node_modules/@murphai/importers/dist/assessment/index.d.ts +4 -0
- package/node_modules/@murphai/importers/dist/assessment/index.d.ts.map +1 -0
- package/node_modules/@murphai/importers/dist/assessment/index.js +2 -0
- package/node_modules/@murphai/importers/dist/assessment/index.js.map +1 -0
- package/node_modules/@murphai/importers/dist/core-port.d.ts +119 -0
- package/node_modules/@murphai/importers/dist/core-port.d.ts.map +1 -0
- package/node_modules/@murphai/importers/dist/core-port.js +22 -0
- package/node_modules/@murphai/importers/dist/core-port.js.map +1 -0
- package/node_modules/@murphai/importers/dist/create-importers.d.ts +17 -0
- package/node_modules/@murphai/importers/dist/create-importers.d.ts.map +1 -0
- package/node_modules/@murphai/importers/dist/create-importers.js +68 -0
- package/node_modules/@murphai/importers/dist/create-importers.js.map +1 -0
- package/node_modules/@murphai/importers/dist/csv-sample-importer.d.ts +22 -0
- package/node_modules/@murphai/importers/dist/csv-sample-importer.d.ts.map +1 -0
- package/node_modules/@murphai/importers/dist/csv-sample-importer.js +153 -0
- package/node_modules/@murphai/importers/dist/csv-sample-importer.js.map +1 -0
- package/node_modules/@murphai/importers/dist/device-providers/defaults.d.ts +5 -0
- package/node_modules/@murphai/importers/dist/device-providers/defaults.d.ts.map +1 -0
- package/node_modules/@murphai/importers/dist/device-providers/defaults.js +11 -0
- package/node_modules/@murphai/importers/dist/device-providers/defaults.js.map +1 -0
- package/node_modules/@murphai/importers/dist/device-providers/garmin-activity-normalizers.d.ts +9 -0
- package/node_modules/@murphai/importers/dist/device-providers/garmin-activity-normalizers.d.ts.map +1 -0
- package/node_modules/@murphai/importers/dist/device-providers/garmin-activity-normalizers.js +172 -0
- package/node_modules/@murphai/importers/dist/device-providers/garmin-activity-normalizers.js.map +1 -0
- package/node_modules/@murphai/importers/dist/device-providers/garmin-health-normalizers.d.ts +12 -0
- package/node_modules/@murphai/importers/dist/device-providers/garmin-health-normalizers.d.ts.map +1 -0
- package/node_modules/@murphai/importers/dist/device-providers/garmin-health-normalizers.js +619 -0
- package/node_modules/@murphai/importers/dist/device-providers/garmin-health-normalizers.js.map +1 -0
- package/node_modules/@murphai/importers/dist/device-providers/garmin-helpers.d.ts +40 -0
- package/node_modules/@murphai/importers/dist/device-providers/garmin-helpers.d.ts.map +1 -0
- package/node_modules/@murphai/importers/dist/device-providers/garmin-helpers.js +295 -0
- package/node_modules/@murphai/importers/dist/device-providers/garmin-helpers.js.map +1 -0
- package/node_modules/@murphai/importers/dist/device-providers/garmin.d.ts +19 -0
- package/node_modules/@murphai/importers/dist/device-providers/garmin.d.ts.map +1 -0
- package/node_modules/@murphai/importers/dist/device-providers/garmin.js +150 -0
- package/node_modules/@murphai/importers/dist/device-providers/garmin.js.map +1 -0
- package/node_modules/@murphai/importers/dist/device-providers/import-device-provider-snapshot.d.ts +14 -0
- package/node_modules/@murphai/importers/dist/device-providers/import-device-provider-snapshot.d.ts.map +1 -0
- package/node_modules/@murphai/importers/dist/device-providers/import-device-provider-snapshot.js +37 -0
- package/node_modules/@murphai/importers/dist/device-providers/import-device-provider-snapshot.js.map +1 -0
- package/node_modules/@murphai/importers/dist/device-providers/index.d.ts +10 -0
- package/node_modules/@murphai/importers/dist/device-providers/index.d.ts.map +1 -0
- package/node_modules/@murphai/importers/dist/device-providers/index.js +8 -0
- package/node_modules/@murphai/importers/dist/device-providers/index.js.map +1 -0
- package/node_modules/@murphai/importers/dist/device-providers/oura.d.ts +20 -0
- package/node_modules/@murphai/importers/dist/device-providers/oura.d.ts.map +1 -0
- package/node_modules/@murphai/importers/dist/device-providers/oura.js +602 -0
- package/node_modules/@murphai/importers/dist/device-providers/oura.js.map +1 -0
- package/node_modules/@murphai/importers/dist/device-providers/provider-descriptors.d.ts +491 -0
- package/node_modules/@murphai/importers/dist/device-providers/provider-descriptors.d.ts.map +1 -0
- package/node_modules/@murphai/importers/dist/device-providers/provider-descriptors.js +326 -0
- package/node_modules/@murphai/importers/dist/device-providers/provider-descriptors.js.map +1 -0
- package/node_modules/@murphai/importers/dist/device-providers/registry.d.ts +9 -0
- package/node_modules/@murphai/importers/dist/device-providers/registry.d.ts.map +1 -0
- package/node_modules/@murphai/importers/dist/device-providers/registry.js +5 -0
- package/node_modules/@murphai/importers/dist/device-providers/registry.js.map +1 -0
- package/node_modules/@murphai/importers/dist/device-providers/shared-normalization.d.ts +81 -0
- package/node_modules/@murphai/importers/dist/device-providers/shared-normalization.d.ts.map +1 -0
- package/node_modules/@murphai/importers/dist/device-providers/shared-normalization.js +215 -0
- package/node_modules/@murphai/importers/dist/device-providers/shared-normalization.js.map +1 -0
- package/node_modules/@murphai/importers/dist/device-providers/types.d.ts +12 -0
- package/node_modules/@murphai/importers/dist/device-providers/types.d.ts.map +1 -0
- package/node_modules/@murphai/importers/dist/device-providers/types.js +2 -0
- package/node_modules/@murphai/importers/dist/device-providers/types.js.map +1 -0
- package/node_modules/@murphai/importers/dist/device-providers/whoop.d.ts +16 -0
- package/node_modules/@murphai/importers/dist/device-providers/whoop.d.ts.map +1 -0
- package/node_modules/@murphai/importers/dist/device-providers/whoop.js +410 -0
- package/node_modules/@murphai/importers/dist/device-providers/whoop.js.map +1 -0
- package/node_modules/@murphai/importers/dist/document-importer.d.ts +15 -0
- package/node_modules/@murphai/importers/dist/document-importer.d.ts.map +1 -0
- package/node_modules/@murphai/importers/dist/document-importer.js +31 -0
- package/node_modules/@murphai/importers/dist/document-importer.js.map +1 -0
- package/node_modules/@murphai/importers/dist/index.d.ts +10 -0
- package/node_modules/@murphai/importers/dist/index.d.ts.map +1 -0
- package/node_modules/@murphai/importers/dist/index.js +9 -0
- package/node_modules/@murphai/importers/dist/index.js.map +1 -0
- package/node_modules/@murphai/importers/dist/meal-importer.d.ts +15 -0
- package/node_modules/@murphai/importers/dist/meal-importer.d.ts.map +1 -0
- package/node_modules/@murphai/importers/dist/meal-importer.js +39 -0
- package/node_modules/@murphai/importers/dist/meal-importer.js.map +1 -0
- package/node_modules/@murphai/importers/dist/preset-registry.d.ts +31 -0
- package/node_modules/@murphai/importers/dist/preset-registry.d.ts.map +1 -0
- package/node_modules/@murphai/importers/dist/preset-registry.js +96 -0
- package/node_modules/@murphai/importers/dist/preset-registry.js.map +1 -0
- package/node_modules/@murphai/importers/dist/shared.d.ts +31 -0
- package/node_modules/@murphai/importers/dist/shared.d.ts.map +1 -0
- package/node_modules/@murphai/importers/dist/shared.js +154 -0
- package/node_modules/@murphai/importers/dist/shared.js.map +1 -0
- package/node_modules/@murphai/importers/package.json +36 -0
- package/node_modules/@murphai/runtime-state/README.md +37 -0
- package/node_modules/@murphai/runtime-state/dist/assistant-local-state-descriptors.d.ts +3 -0
- package/node_modules/@murphai/runtime-state/dist/assistant-local-state-descriptors.d.ts.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/assistant-local-state-descriptors.js +80 -0
- package/node_modules/@murphai/runtime-state/dist/assistant-local-state-descriptors.js.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/assistant-state-security.d.ts +29 -0
- package/node_modules/@murphai/runtime-state/dist/assistant-state-security.d.ts.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/assistant-state-security.js +159 -0
- package/node_modules/@murphai/runtime-state/dist/assistant-state-security.js.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/assistant-state.d.ts +33 -0
- package/node_modules/@murphai/runtime-state/dist/assistant-state.d.ts.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/assistant-state.js +47 -0
- package/node_modules/@murphai/runtime-state/dist/assistant-state.js.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/assistant-usage.d.ts +56 -0
- package/node_modules/@murphai/runtime-state/dist/assistant-usage.d.ts.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/assistant-usage.js +189 -0
- package/node_modules/@murphai/runtime-state/dist/assistant-usage.js.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/atomic-write.d.ts +7 -0
- package/node_modules/@murphai/runtime-state/dist/atomic-write.d.ts.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/atomic-write.js +27 -0
- package/node_modules/@murphai/runtime-state/dist/atomic-write.js.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/device-sync-local-state-descriptors.d.ts +3 -0
- package/node_modules/@murphai/runtime-state/dist/device-sync-local-state-descriptors.d.ts.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/device-sync-local-state-descriptors.js +12 -0
- package/node_modules/@murphai/runtime-state/dist/device-sync-local-state-descriptors.js.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/gateway-local-state-descriptors.d.ts +3 -0
- package/node_modules/@murphai/runtime-state/dist/gateway-local-state-descriptors.d.ts.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/gateway-local-state-descriptors.js +13 -0
- package/node_modules/@murphai/runtime-state/dist/gateway-local-state-descriptors.js.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/hosted-bundle-node.d.ts +43 -0
- package/node_modules/@murphai/runtime-state/dist/hosted-bundle-node.d.ts.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/hosted-bundle-node.js +203 -0
- package/node_modules/@murphai/runtime-state/dist/hosted-bundle-node.js.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/hosted-bundle-ref.d.ts +13 -0
- package/node_modules/@murphai/runtime-state/dist/hosted-bundle-ref.d.ts.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/hosted-bundle-ref.js +46 -0
- package/node_modules/@murphai/runtime-state/dist/hosted-bundle-ref.js.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/hosted-bundle.d.ts +67 -0
- package/node_modules/@murphai/runtime-state/dist/hosted-bundle.d.ts.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/hosted-bundle.js +261 -0
- package/node_modules/@murphai/runtime-state/dist/hosted-bundle.js.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/hosted-bundles.d.ts +31 -0
- package/node_modules/@murphai/runtime-state/dist/hosted-bundles.d.ts.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/hosted-bundles.js +211 -0
- package/node_modules/@murphai/runtime-state/dist/hosted-bundles.js.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/hosted-email.d.ts +50 -0
- package/node_modules/@murphai/runtime-state/dist/hosted-email.d.ts.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/hosted-email.js +191 -0
- package/node_modules/@murphai/runtime-state/dist/hosted-email.js.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/hosted-user-env.d.ts +14 -0
- package/node_modules/@murphai/runtime-state/dist/hosted-user-env.d.ts.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/hosted-user-env.js +59 -0
- package/node_modules/@murphai/runtime-state/dist/hosted-user-env.js.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/hosted-user-keys.d.ts +83 -0
- package/node_modules/@murphai/runtime-state/dist/hosted-user-keys.d.ts.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/hosted-user-keys.js +308 -0
- package/node_modules/@murphai/runtime-state/dist/hosted-user-keys.js.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/inbox-local-state-descriptors.d.ts +3 -0
- package/node_modules/@murphai/runtime-state/dist/inbox-local-state-descriptors.d.ts.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/inbox-local-state-descriptors.js +18 -0
- package/node_modules/@murphai/runtime-state/dist/inbox-local-state-descriptors.js.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/index.d.ts +7 -0
- package/node_modules/@murphai/runtime-state/dist/index.d.ts.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/index.js +7 -0
- package/node_modules/@murphai/runtime-state/dist/index.js.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/local-state-descriptor-helpers.d.ts +31 -0
- package/node_modules/@murphai/runtime-state/dist/local-state-descriptor-helpers.d.ts.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/local-state-descriptor-helpers.js +120 -0
- package/node_modules/@murphai/runtime-state/dist/local-state-descriptor-helpers.js.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/local-state-descriptor-manifests.d.ts +3 -0
- package/node_modules/@murphai/runtime-state/dist/local-state-descriptor-manifests.d.ts.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/local-state-descriptor-manifests.js +17 -0
- package/node_modules/@murphai/runtime-state/dist/local-state-descriptor-manifests.js.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/local-state-files.d.ts +10 -0
- package/node_modules/@murphai/runtime-state/dist/local-state-files.d.ts.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/local-state-files.js +27 -0
- package/node_modules/@murphai/runtime-state/dist/local-state-files.js.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/local-state-taxonomy.d.ts +29 -0
- package/node_modules/@murphai/runtime-state/dist/local-state-taxonomy.d.ts.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/local-state-taxonomy.js +82 -0
- package/node_modules/@murphai/runtime-state/dist/local-state-taxonomy.js.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/locks.d.ts +46 -0
- package/node_modules/@murphai/runtime-state/dist/locks.d.ts.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/locks.js +187 -0
- package/node_modules/@murphai/runtime-state/dist/locks.js.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/loopback-control-plane.d.ts +4 -0
- package/node_modules/@murphai/runtime-state/dist/loopback-control-plane.d.ts.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/loopback-control-plane.js +35 -0
- package/node_modules/@murphai/runtime-state/dist/loopback-control-plane.js.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/node/index.d.ts +22 -0
- package/node_modules/@murphai/runtime-state/dist/node/index.d.ts.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/node/index.js +22 -0
- package/node_modules/@murphai/runtime-state/dist/node/index.js.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/parser-local-state-descriptors.d.ts +3 -0
- package/node_modules/@murphai/runtime-state/dist/parser-local-state-descriptors.d.ts.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/parser-local-state-descriptors.js +12 -0
- package/node_modules/@murphai/runtime-state/dist/parser-local-state-descriptors.js.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/process-env.d.ts +4 -0
- package/node_modules/@murphai/runtime-state/dist/process-env.d.ts.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/process-env.js +124 -0
- package/node_modules/@murphai/runtime-state/dist/process-env.js.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/query-local-state-descriptors.d.ts +3 -0
- package/node_modules/@murphai/runtime-state/dist/query-local-state-descriptors.d.ts.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/query-local-state-descriptors.js +13 -0
- package/node_modules/@murphai/runtime-state/dist/query-local-state-descriptors.js.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/runtime-paths.d.ts +48 -0
- package/node_modules/@murphai/runtime-state/dist/runtime-paths.d.ts.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/runtime-paths.js +93 -0
- package/node_modules/@murphai/runtime-state/dist/runtime-paths.js.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/shared.d.ts +14 -0
- package/node_modules/@murphai/runtime-state/dist/shared.d.ts.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/shared.js +46 -0
- package/node_modules/@murphai/runtime-state/dist/shared.js.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/sqlite.d.ts +26 -0
- package/node_modules/@murphai/runtime-state/dist/sqlite.d.ts.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/sqlite.js +110 -0
- package/node_modules/@murphai/runtime-state/dist/sqlite.js.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/ulid.d.ts +5 -0
- package/node_modules/@murphai/runtime-state/dist/ulid.d.ts.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/ulid.js +31 -0
- package/node_modules/@murphai/runtime-state/dist/ulid.js.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/versioned-json-files.d.ts +24 -0
- package/node_modules/@murphai/runtime-state/dist/versioned-json-files.d.ts.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/versioned-json-files.js +30 -0
- package/node_modules/@murphai/runtime-state/dist/versioned-json-files.js.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/versioned-json-state.d.ts +18 -0
- package/node_modules/@murphai/runtime-state/dist/versioned-json-state.d.ts.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/versioned-json-state.js +25 -0
- package/node_modules/@murphai/runtime-state/dist/versioned-json-state.js.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/write-operation-local-state-descriptors.d.ts +3 -0
- package/node_modules/@murphai/runtime-state/dist/write-operation-local-state-descriptors.d.ts.map +1 -0
- package/node_modules/@murphai/runtime-state/dist/write-operation-local-state-descriptors.js +12 -0
- package/node_modules/@murphai/runtime-state/dist/write-operation-local-state-descriptors.js.map +1 -0
- package/node_modules/@murphai/runtime-state/package.json +30 -0
- package/package.json +45 -11
- package/dist/.tsbuildinfo +0 -1
- package/dist/callback-hosts.d.ts +0 -19
- package/dist/callback-hosts.d.ts.map +0 -1
- package/dist/callback-hosts.js +0 -19
- package/dist/callback-hosts.js.map +0 -1
- package/dist/web-control-plane.d.ts +0 -105
- package/dist/web-control-plane.d.ts.map +0 -1
- package/dist/web-control-plane.js +0 -358
- package/dist/web-control-plane.js.map +0 -1
|
@@ -0,0 +1,804 @@
|
|
|
1
|
+
import { createHmac, timingSafeEqual } from "node:crypto";
|
|
2
|
+
import { OURA_DEVICE_PROVIDER_DESCRIPTOR, requireDeviceProviderOAuthDescriptor, requireDeviceProviderSyncDescriptor, requireDeviceProviderWebhookDescriptor, } from "@murphai/importers";
|
|
3
|
+
import { deviceSyncError } from "../errors.js";
|
|
4
|
+
import { addMilliseconds, coerceRecord, normalizeIdentifier, normalizeString, sha256Text, subtractDays, } from "../shared.js";
|
|
5
|
+
import { buildOAuthConnectUrl, buildProviderApiError, buildScheduledReconcileJobs, createRefreshingApiSession, exchangeOAuthAuthorizationCode, fetchBearerJson, postOAuthTokenRequest, refreshOAuthTokens, requireRefreshToken, splitScopes, tokenResponseToAuthTokens as sharedTokenResponseToAuthTokens, } from "./shared-oauth.js";
|
|
6
|
+
import { createOuraWebhookSubscriptionClient, OURA_DEFAULT_WEBHOOK_TARGETS } from "./oura-webhooks.js";
|
|
7
|
+
const OURA_AUTH_BASE_URL = "https://cloud.ouraring.com";
|
|
8
|
+
const OURA_API_BASE_URL = "https://api.ouraring.com";
|
|
9
|
+
const OURA_AUTHORIZE_PATH = "/oauth/authorize";
|
|
10
|
+
const OURA_TOKEN_PATH = "/oauth/token";
|
|
11
|
+
const OURA_PROVIDER_DESCRIPTOR = OURA_DEVICE_PROVIDER_DESCRIPTOR;
|
|
12
|
+
const OURA_OAUTH = requireDeviceProviderOAuthDescriptor(OURA_PROVIDER_DESCRIPTOR);
|
|
13
|
+
const OURA_WEBHOOK = requireDeviceProviderWebhookDescriptor(OURA_PROVIDER_DESCRIPTOR);
|
|
14
|
+
const OURA_SYNC = requireDeviceProviderSyncDescriptor(OURA_PROVIDER_DESCRIPTOR);
|
|
15
|
+
const OURA_CALLBACK_PATH = OURA_OAUTH.callbackPath;
|
|
16
|
+
const OURA_WEBHOOK_PATH = OURA_WEBHOOK.path;
|
|
17
|
+
const DEFAULT_TIMEOUT_MS = 15_000;
|
|
18
|
+
const DEFAULT_BACKFILL_DAYS = OURA_SYNC.windows.backfillDays;
|
|
19
|
+
const DEFAULT_RECONCILE_DAYS = OURA_SYNC.windows.reconcileDays;
|
|
20
|
+
const DEFAULT_RECONCILE_INTERVAL_MS = OURA_SYNC.windows.reconcileIntervalMs;
|
|
21
|
+
const DEFAULT_WEBHOOK_TOLERANCE_MS = 5 * 60_000;
|
|
22
|
+
const OURA_SECONDS_TIMESTAMP_THRESHOLD = 10_000_000_000;
|
|
23
|
+
const OURA_WEBHOOK_RESOURCE_PRIORITY = 90;
|
|
24
|
+
const OURA_WEBHOOK_DELETE_PRIORITY = 95;
|
|
25
|
+
const OURA_DEFAULT_SCOPES = Object.freeze([...OURA_OAUTH.defaultScopes]);
|
|
26
|
+
const HEARTRATE_CHUNK_MS = 30 * 24 * 60 * 60_000;
|
|
27
|
+
async function fetchOuraHeartRateInChunks(api, windowStart, windowEnd) {
|
|
28
|
+
const resolvedWindowStart = toDateTimeParameter(windowStart);
|
|
29
|
+
const resolvedWindowEnd = toDateTimeParameter(windowEnd);
|
|
30
|
+
const records = [];
|
|
31
|
+
let chunkStart = Date.parse(resolvedWindowStart);
|
|
32
|
+
const end = Date.parse(resolvedWindowEnd);
|
|
33
|
+
while (chunkStart < end) {
|
|
34
|
+
const chunkEnd = Math.min(chunkStart + HEARTRATE_CHUNK_MS, end);
|
|
35
|
+
const chunk = await api.fetchPagedCollection("/v2/usercollection/heartrate", {
|
|
36
|
+
start_datetime: new Date(chunkStart).toISOString(),
|
|
37
|
+
end_datetime: new Date(chunkEnd).toISOString(),
|
|
38
|
+
});
|
|
39
|
+
records.push(...chunk);
|
|
40
|
+
chunkStart = chunkEnd;
|
|
41
|
+
}
|
|
42
|
+
return records;
|
|
43
|
+
}
|
|
44
|
+
function buildOuraScopes(input) {
|
|
45
|
+
const requested = [...OURA_DEFAULT_SCOPES, ...(input ?? [])];
|
|
46
|
+
return [...new Set(requested.map((scope) => scope.trim()).filter(Boolean))];
|
|
47
|
+
}
|
|
48
|
+
function hasOuraScope(account, scope) {
|
|
49
|
+
return account.scopes.includes(scope);
|
|
50
|
+
}
|
|
51
|
+
function toDateParameter(timestamp) {
|
|
52
|
+
return new Date(timestamp).toISOString().slice(0, 10);
|
|
53
|
+
}
|
|
54
|
+
function toDateTimeParameter(timestamp) {
|
|
55
|
+
return new Date(timestamp).toISOString();
|
|
56
|
+
}
|
|
57
|
+
function normalizeGrantedScopes(value) {
|
|
58
|
+
return [...new Set(splitScopes(value).map((scope) => scope.replace(/^extapi:/u, "")))];
|
|
59
|
+
}
|
|
60
|
+
function buildDisplayName(personalInfo) {
|
|
61
|
+
const email = normalizeString(personalInfo.email);
|
|
62
|
+
const accountId = normalizeIdentifier(personalInfo.id ?? personalInfo.user_id ?? personalInfo.userId);
|
|
63
|
+
return email ?? `Oura ${accountId ?? "user"}`;
|
|
64
|
+
}
|
|
65
|
+
function tokenResponseToAuthTokens(payload) {
|
|
66
|
+
return sharedTokenResponseToAuthTokens(payload, () => deviceSyncError({
|
|
67
|
+
code: "OURA_TOKEN_RESPONSE_INVALID",
|
|
68
|
+
message: "Oura token response did not include an access token.",
|
|
69
|
+
retryable: false,
|
|
70
|
+
httpStatus: 502,
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
function buildOuraSignatureCandidates(timestamp, rawBody, secret) {
|
|
74
|
+
const signatureBase = `${timestamp}${rawBody.toString("utf8")}`;
|
|
75
|
+
const digest = createHmac("sha256", secret).update(signatureBase).digest();
|
|
76
|
+
const hex = digest.toString("hex");
|
|
77
|
+
return [hex, hex.toUpperCase(), digest.toString("base64"), digest.toString("base64url")];
|
|
78
|
+
}
|
|
79
|
+
function constantTimeMatchSignature(expectedCandidates, actual) {
|
|
80
|
+
const actualBuffer = Buffer.from(actual, "utf8");
|
|
81
|
+
for (const expected of expectedCandidates) {
|
|
82
|
+
const expectedBuffer = Buffer.from(expected, "utf8");
|
|
83
|
+
if (expectedBuffer.length !== actualBuffer.length) {
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
if (timingSafeEqual(expectedBuffer, actualBuffer)) {
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
function parseOuraWebhookPayload(rawBody) {
|
|
93
|
+
let parsed;
|
|
94
|
+
try {
|
|
95
|
+
parsed = JSON.parse(rawBody.toString("utf8"));
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
throw deviceSyncError({
|
|
99
|
+
code: "OURA_WEBHOOK_INVALID_JSON",
|
|
100
|
+
message: "Oura webhook payload was not valid JSON.",
|
|
101
|
+
retryable: false,
|
|
102
|
+
httpStatus: 400,
|
|
103
|
+
cause: error,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
return coerceRecord(parsed);
|
|
107
|
+
}
|
|
108
|
+
function parseTimestampMillis(value) {
|
|
109
|
+
const normalized = normalizeString(value);
|
|
110
|
+
if (!normalized) {
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
const numeric = Number(normalized);
|
|
114
|
+
if (Number.isFinite(numeric)) {
|
|
115
|
+
return numeric < OURA_SECONDS_TIMESTAMP_THRESHOLD ? numeric * 1000 : numeric;
|
|
116
|
+
}
|
|
117
|
+
const parsed = Date.parse(normalized);
|
|
118
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
119
|
+
}
|
|
120
|
+
function normalizeIsoTimestamp(value) {
|
|
121
|
+
const normalized = normalizeString(value);
|
|
122
|
+
if (!normalized) {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
const parsed = Date.parse(normalized);
|
|
126
|
+
return Number.isFinite(parsed) ? new Date(parsed).toISOString() : null;
|
|
127
|
+
}
|
|
128
|
+
function startOfUtcDay(timestamp) {
|
|
129
|
+
const date = new Date(timestamp);
|
|
130
|
+
return new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate())).toISOString();
|
|
131
|
+
}
|
|
132
|
+
function endOfUtcDay(timestamp) {
|
|
133
|
+
return addMilliseconds(startOfUtcDay(timestamp), 24 * 60 * 60_000 - 1);
|
|
134
|
+
}
|
|
135
|
+
function buildOuraWebhookWindow(occurredAt, descriptor) {
|
|
136
|
+
const dayStart = startOfUtcDay(occurredAt);
|
|
137
|
+
const dayEnd = endOfUtcDay(occurredAt);
|
|
138
|
+
return {
|
|
139
|
+
windowStart: descriptor.narrowWindowDaysBefore > 0
|
|
140
|
+
? subtractDays(dayStart, descriptor.narrowWindowDaysBefore)
|
|
141
|
+
: dayStart,
|
|
142
|
+
windowEnd: descriptor.narrowWindowDaysAfter > 0
|
|
143
|
+
? addMilliseconds(dayEnd, descriptor.narrowWindowDaysAfter * 24 * 60 * 60_000)
|
|
144
|
+
: dayEnd,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function pickOuraRecordCandidates(record, fields) {
|
|
148
|
+
const candidates = new Set();
|
|
149
|
+
for (const field of fields) {
|
|
150
|
+
const value = normalizeString(record[field]);
|
|
151
|
+
if (value) {
|
|
152
|
+
candidates.add(value);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return [...candidates];
|
|
156
|
+
}
|
|
157
|
+
function filterOuraResourceRecords(records, descriptor, objectId) {
|
|
158
|
+
if (!objectId) {
|
|
159
|
+
return [...records];
|
|
160
|
+
}
|
|
161
|
+
return records.filter((record) => pickOuraRecordCandidates(record, descriptor.matchFields).includes(objectId));
|
|
162
|
+
}
|
|
163
|
+
async function populateOuraSnapshotCollections(api, snapshot, windowStart, windowEnd, dataTypes) {
|
|
164
|
+
const descriptors = dataTypes
|
|
165
|
+
? dataTypes
|
|
166
|
+
.map((dataType) => OURA_RESOURCE_DESCRIPTORS[dataType])
|
|
167
|
+
.filter((descriptor) => Boolean(descriptor))
|
|
168
|
+
: Object.values(OURA_RESOURCE_DESCRIPTORS);
|
|
169
|
+
for (const descriptor of descriptors) {
|
|
170
|
+
if (!hasOuraScope(api.account, descriptor.scope)) {
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
snapshot[descriptor.snapshotKey] = await descriptor.fetch(api, windowStart, windowEnd);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
function normalizeOuraWebhookOperation(value) {
|
|
177
|
+
const normalized = normalizeString(value)?.toLowerCase();
|
|
178
|
+
if (!normalized) {
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
181
|
+
if (normalized === "create" || normalized === "created") {
|
|
182
|
+
return "create";
|
|
183
|
+
}
|
|
184
|
+
if (normalized === "update" || normalized === "updated") {
|
|
185
|
+
return "update";
|
|
186
|
+
}
|
|
187
|
+
if (normalized === "delete" || normalized === "deleted") {
|
|
188
|
+
return "delete";
|
|
189
|
+
}
|
|
190
|
+
const suffix = normalized.split(".").at(-1);
|
|
191
|
+
return suffix ? normalizeOuraWebhookOperation(suffix) : null;
|
|
192
|
+
}
|
|
193
|
+
function buildOuraSourceEventType(rawEventType, dataType, operation) {
|
|
194
|
+
const normalized = normalizeString(rawEventType);
|
|
195
|
+
if (normalized?.includes(".")) {
|
|
196
|
+
return normalized;
|
|
197
|
+
}
|
|
198
|
+
if (!operation) {
|
|
199
|
+
return normalized ?? dataType;
|
|
200
|
+
}
|
|
201
|
+
const suffix = operation === "create" ? "created" : operation === "update" ? "updated" : "deleted";
|
|
202
|
+
return `${dataType}.${suffix}`;
|
|
203
|
+
}
|
|
204
|
+
function buildOuraDeleteSnapshot(account, now, marker) {
|
|
205
|
+
return {
|
|
206
|
+
accountId: account.externalAccountId,
|
|
207
|
+
importedAt: now,
|
|
208
|
+
deletions: [marker],
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
const OURA_RESOURCE_DESCRIPTORS = Object.freeze({
|
|
212
|
+
daily_activity: {
|
|
213
|
+
scope: "daily",
|
|
214
|
+
snapshotKey: "dailyActivity",
|
|
215
|
+
matchFields: ["id", "day", "date"],
|
|
216
|
+
narrowWindowDaysBefore: 0,
|
|
217
|
+
narrowWindowDaysAfter: 0,
|
|
218
|
+
fetch(api, windowStart, windowEnd) {
|
|
219
|
+
return api.fetchPagedCollection("/v2/usercollection/daily_activity", {
|
|
220
|
+
start_date: toDateParameter(windowStart),
|
|
221
|
+
end_date: toDateParameter(windowEnd),
|
|
222
|
+
});
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
daily_readiness: {
|
|
226
|
+
scope: "daily",
|
|
227
|
+
snapshotKey: "dailyReadiness",
|
|
228
|
+
matchFields: ["id", "day", "date"],
|
|
229
|
+
narrowWindowDaysBefore: 0,
|
|
230
|
+
narrowWindowDaysAfter: 0,
|
|
231
|
+
fetch(api, windowStart, windowEnd) {
|
|
232
|
+
return api.fetchPagedCollection("/v2/usercollection/daily_readiness", {
|
|
233
|
+
start_date: toDateParameter(windowStart),
|
|
234
|
+
end_date: toDateParameter(windowEnd),
|
|
235
|
+
});
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
daily_sleep: {
|
|
239
|
+
scope: "daily",
|
|
240
|
+
snapshotKey: "dailySleep",
|
|
241
|
+
matchFields: ["id", "day", "date"],
|
|
242
|
+
narrowWindowDaysBefore: 1,
|
|
243
|
+
narrowWindowDaysAfter: 0,
|
|
244
|
+
fetch(api, windowStart, windowEnd) {
|
|
245
|
+
return api.fetchPagedCollection("/v2/usercollection/daily_sleep", {
|
|
246
|
+
start_date: toDateParameter(windowStart),
|
|
247
|
+
end_date: toDateParameter(windowEnd),
|
|
248
|
+
});
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
daily_spo2: {
|
|
252
|
+
scope: "spo2",
|
|
253
|
+
snapshotKey: "dailySpO2",
|
|
254
|
+
matchFields: ["id", "day", "date"],
|
|
255
|
+
narrowWindowDaysBefore: 0,
|
|
256
|
+
narrowWindowDaysAfter: 0,
|
|
257
|
+
fetch(api, windowStart, windowEnd) {
|
|
258
|
+
return api.fetchPagedCollection("/v2/usercollection/daily_spo2", {
|
|
259
|
+
start_date: toDateParameter(windowStart),
|
|
260
|
+
end_date: toDateParameter(windowEnd),
|
|
261
|
+
});
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
heartrate: {
|
|
265
|
+
scope: "heartrate",
|
|
266
|
+
snapshotKey: "heartrate",
|
|
267
|
+
matchFields: ["id", "timestamp", "recorded_at", "recordedAt"],
|
|
268
|
+
narrowWindowDaysBefore: 0,
|
|
269
|
+
narrowWindowDaysAfter: 0,
|
|
270
|
+
fetch(api, windowStart, windowEnd) {
|
|
271
|
+
return fetchOuraHeartRateInChunks(api, windowStart, windowEnd);
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
session: {
|
|
275
|
+
scope: "session",
|
|
276
|
+
snapshotKey: "sessions",
|
|
277
|
+
matchFields: ["id", "day", "date", "start_datetime", "start_time", "start"],
|
|
278
|
+
narrowWindowDaysBefore: 0,
|
|
279
|
+
narrowWindowDaysAfter: 0,
|
|
280
|
+
fetch(api, windowStart, windowEnd) {
|
|
281
|
+
return api.fetchPagedCollection("/v2/usercollection/session", {
|
|
282
|
+
start_date: toDateParameter(windowStart),
|
|
283
|
+
end_date: toDateParameter(windowEnd),
|
|
284
|
+
});
|
|
285
|
+
},
|
|
286
|
+
},
|
|
287
|
+
sleep: {
|
|
288
|
+
scope: "daily",
|
|
289
|
+
snapshotKey: "sleeps",
|
|
290
|
+
matchFields: ["id", "day", "date", "sleep_date", "start_datetime", "bedtime_start"],
|
|
291
|
+
narrowWindowDaysBefore: 1,
|
|
292
|
+
narrowWindowDaysAfter: 0,
|
|
293
|
+
fetch(api, windowStart, windowEnd) {
|
|
294
|
+
return api.fetchPagedCollection("/v2/usercollection/sleep", {
|
|
295
|
+
start_date: toDateParameter(windowStart),
|
|
296
|
+
end_date: toDateParameter(windowEnd),
|
|
297
|
+
});
|
|
298
|
+
},
|
|
299
|
+
},
|
|
300
|
+
workout: {
|
|
301
|
+
scope: "workout",
|
|
302
|
+
snapshotKey: "workouts",
|
|
303
|
+
matchFields: ["id", "day", "date", "start_datetime", "start_time", "start"],
|
|
304
|
+
narrowWindowDaysBefore: 0,
|
|
305
|
+
narrowWindowDaysAfter: 0,
|
|
306
|
+
fetch(api, windowStart, windowEnd) {
|
|
307
|
+
return api.fetchPagedCollection("/v2/usercollection/workout", {
|
|
308
|
+
start_date: toDateParameter(windowStart),
|
|
309
|
+
end_date: toDateParameter(windowEnd),
|
|
310
|
+
});
|
|
311
|
+
},
|
|
312
|
+
},
|
|
313
|
+
});
|
|
314
|
+
export function resolveOuraWebhookVerificationChallenge(input) {
|
|
315
|
+
const challenge = normalizeString(input.url.searchParams.get("challenge"));
|
|
316
|
+
const receivedToken = normalizeString(input.url.searchParams.get("verification_token"));
|
|
317
|
+
const expectedToken = normalizeString(input.verificationToken);
|
|
318
|
+
if (!challenge && !receivedToken) {
|
|
319
|
+
return null;
|
|
320
|
+
}
|
|
321
|
+
if (!expectedToken) {
|
|
322
|
+
throw deviceSyncError({
|
|
323
|
+
code: "OURA_WEBHOOK_VERIFICATION_TOKEN_MISSING",
|
|
324
|
+
message: "Oura webhook verification requires OURA_WEBHOOK_VERIFICATION_TOKEN.",
|
|
325
|
+
retryable: false,
|
|
326
|
+
httpStatus: 500,
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
if (!challenge || !receivedToken || receivedToken !== expectedToken) {
|
|
330
|
+
throw deviceSyncError({
|
|
331
|
+
code: "OURA_WEBHOOK_VERIFICATION_FAILED",
|
|
332
|
+
message: "Oura webhook verification token did not match the configured verification token.",
|
|
333
|
+
retryable: false,
|
|
334
|
+
httpStatus: 403,
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
return challenge;
|
|
338
|
+
}
|
|
339
|
+
function buildOuraApiError(code, message, response, body, options = {}) {
|
|
340
|
+
return buildProviderApiError(code, message, response, body, options);
|
|
341
|
+
}
|
|
342
|
+
export function createOuraDeviceSyncProvider(config) {
|
|
343
|
+
const fetchImpl = config.fetchImpl ?? fetch;
|
|
344
|
+
const authBaseUrl = (config.authBaseUrl ?? OURA_AUTH_BASE_URL).replace(/\/+$/u, "");
|
|
345
|
+
const apiBaseUrl = (config.apiBaseUrl ?? OURA_API_BASE_URL).replace(/\/+$/u, "");
|
|
346
|
+
const scopes = buildOuraScopes(config.scopes);
|
|
347
|
+
const backfillDays = Math.max(1, config.backfillDays ?? DEFAULT_BACKFILL_DAYS);
|
|
348
|
+
const reconcileDays = Math.max(1, config.reconcileDays ?? DEFAULT_RECONCILE_DAYS);
|
|
349
|
+
const reconcileIntervalMs = Math.max(60_000, config.reconcileIntervalMs ?? DEFAULT_RECONCILE_INTERVAL_MS);
|
|
350
|
+
const timeoutMs = Math.max(1_000, config.requestTimeoutMs ?? DEFAULT_TIMEOUT_MS);
|
|
351
|
+
const webhookTimestampToleranceMs = Math.max(1_000, config.webhookTimestampToleranceMs ?? DEFAULT_WEBHOOK_TOLERANCE_MS);
|
|
352
|
+
const descriptor = {
|
|
353
|
+
...OURA_PROVIDER_DESCRIPTOR,
|
|
354
|
+
oauth: {
|
|
355
|
+
...OURA_OAUTH,
|
|
356
|
+
defaultScopes: [...scopes],
|
|
357
|
+
},
|
|
358
|
+
sync: {
|
|
359
|
+
...OURA_SYNC,
|
|
360
|
+
windows: {
|
|
361
|
+
backfillDays,
|
|
362
|
+
reconcileDays,
|
|
363
|
+
reconcileIntervalMs,
|
|
364
|
+
},
|
|
365
|
+
},
|
|
366
|
+
};
|
|
367
|
+
let webhookSubscriptionClient = null;
|
|
368
|
+
async function postTokenRequest(parameters) {
|
|
369
|
+
return postOAuthTokenRequest({
|
|
370
|
+
fetchImpl,
|
|
371
|
+
url: `${apiBaseUrl}${OURA_TOKEN_PATH}`,
|
|
372
|
+
timeoutMs,
|
|
373
|
+
parameters,
|
|
374
|
+
buildError: (response, body) => buildOuraApiError("OURA_TOKEN_REQUEST_FAILED", "Oura token request failed.", response, body, {
|
|
375
|
+
retryable: response.status >= 500,
|
|
376
|
+
accountStatus: response.status === 401 ? "reauthorization_required" : null,
|
|
377
|
+
}),
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
async function fetchOuraJson(input) {
|
|
381
|
+
return fetchBearerJson({
|
|
382
|
+
fetchImpl,
|
|
383
|
+
url: `${apiBaseUrl}${input.path}`,
|
|
384
|
+
accessToken: input.accessToken,
|
|
385
|
+
timeoutMs,
|
|
386
|
+
optional: input.optional,
|
|
387
|
+
buildError: (response, body) => buildOuraApiError("OURA_API_REQUEST_FAILED", `Oura API request failed for ${input.path}.`, response, body, {
|
|
388
|
+
retryable: response.status === 429 || response.status >= 500,
|
|
389
|
+
accountStatus: response.status === 401 ? "reauthorization_required" : null,
|
|
390
|
+
}),
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
async function fetchPagedCollection(requestJson, path, parameters) {
|
|
394
|
+
const records = [];
|
|
395
|
+
let nextToken = null;
|
|
396
|
+
do {
|
|
397
|
+
const search = new URLSearchParams();
|
|
398
|
+
for (const [key, value] of Object.entries(parameters)) {
|
|
399
|
+
const normalized = normalizeString(value);
|
|
400
|
+
if (normalized) {
|
|
401
|
+
search.set(key, normalized);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
if (nextToken) {
|
|
405
|
+
search.set("next_token", nextToken);
|
|
406
|
+
}
|
|
407
|
+
const response = (await requestJson(`${path}?${search.toString()}`)) ?? {
|
|
408
|
+
data: [],
|
|
409
|
+
};
|
|
410
|
+
records.push(...((response.data ?? []).map((entry) => coerceRecord(entry))));
|
|
411
|
+
nextToken = normalizeString(response.next_token) ?? null;
|
|
412
|
+
} while (nextToken);
|
|
413
|
+
return records;
|
|
414
|
+
}
|
|
415
|
+
async function fetchPersonalInfo(accessToken) {
|
|
416
|
+
const personalInfo = await fetchOuraJson({
|
|
417
|
+
path: "/v2/usercollection/personal_info",
|
|
418
|
+
accessToken,
|
|
419
|
+
optional: false,
|
|
420
|
+
});
|
|
421
|
+
return coerceRecord(personalInfo);
|
|
422
|
+
}
|
|
423
|
+
function getWebhookSubscriptionClient() {
|
|
424
|
+
if (!webhookSubscriptionClient) {
|
|
425
|
+
webhookSubscriptionClient = createOuraWebhookSubscriptionClient({
|
|
426
|
+
clientId: config.clientId,
|
|
427
|
+
clientSecret: config.clientSecret,
|
|
428
|
+
apiBaseUrl,
|
|
429
|
+
fetchImpl,
|
|
430
|
+
timeoutMs,
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
return webhookSubscriptionClient;
|
|
434
|
+
}
|
|
435
|
+
const webhookAdmin = {
|
|
436
|
+
resolveVerificationChallenge(context) {
|
|
437
|
+
return resolveOuraWebhookVerificationChallenge(context);
|
|
438
|
+
},
|
|
439
|
+
async ensureSubscriptions(context) {
|
|
440
|
+
const verificationToken = normalizeString(context.verificationToken);
|
|
441
|
+
if (!verificationToken) {
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
const callbackUrl = new URL(OURA_WEBHOOK_PATH.replace(/^\/+/u, ""), `${context.publicBaseUrl}/`).toString();
|
|
445
|
+
await getWebhookSubscriptionClient().ensure({
|
|
446
|
+
callbackUrl,
|
|
447
|
+
verificationToken,
|
|
448
|
+
desired: OURA_DEFAULT_WEBHOOK_TARGETS,
|
|
449
|
+
renewIfExpiringWithinMs: 7 * 24 * 60 * 60_000,
|
|
450
|
+
pruneDuplicates: true,
|
|
451
|
+
});
|
|
452
|
+
},
|
|
453
|
+
};
|
|
454
|
+
function createApiSession(context) {
|
|
455
|
+
const session = createRefreshingApiSession({
|
|
456
|
+
context,
|
|
457
|
+
requestJsonWithAccessToken: (accessToken, path, options) => fetchOuraJson({
|
|
458
|
+
path,
|
|
459
|
+
accessToken,
|
|
460
|
+
optional: options.optional,
|
|
461
|
+
}),
|
|
462
|
+
});
|
|
463
|
+
return {
|
|
464
|
+
get account() {
|
|
465
|
+
return session.account;
|
|
466
|
+
},
|
|
467
|
+
requestJson: session.requestJson,
|
|
468
|
+
fetchPagedCollection(path, parameters) {
|
|
469
|
+
return fetchPagedCollection(session.requestJson, path, parameters);
|
|
470
|
+
},
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
async function executeWindowImport(context, payload, fallbackWindowDays) {
|
|
474
|
+
const now = context.now;
|
|
475
|
+
const windowStart = normalizeString(payload.windowStart) ?? subtractDays(now, fallbackWindowDays);
|
|
476
|
+
const windowEnd = normalizeString(payload.windowEnd) ?? now;
|
|
477
|
+
const includePersonalInfo = payload.includePersonalInfo === true;
|
|
478
|
+
const api = createApiSession(context);
|
|
479
|
+
const snapshot = {
|
|
480
|
+
accountId: api.account.externalAccountId,
|
|
481
|
+
importedAt: now,
|
|
482
|
+
};
|
|
483
|
+
if (includePersonalInfo && hasOuraScope(api.account, "personal")) {
|
|
484
|
+
snapshot.personalInfo = coerceRecord(await api.requestJson("/v2/usercollection/personal_info"));
|
|
485
|
+
}
|
|
486
|
+
await populateOuraSnapshotCollections(api, snapshot, windowStart, windowEnd);
|
|
487
|
+
await context.importSnapshot(snapshot);
|
|
488
|
+
return {};
|
|
489
|
+
}
|
|
490
|
+
async function fetchOuraResourceSnapshot(api, input) {
|
|
491
|
+
if (!input.dataType) {
|
|
492
|
+
return null;
|
|
493
|
+
}
|
|
494
|
+
const descriptor = OURA_RESOURCE_DESCRIPTORS[input.dataType];
|
|
495
|
+
if (!descriptor || !hasOuraScope(api.account, descriptor.scope)) {
|
|
496
|
+
return null;
|
|
497
|
+
}
|
|
498
|
+
const narrowWindow = buildOuraWebhookWindow(input.occurredAt, descriptor);
|
|
499
|
+
const narrowRecords = await descriptor.fetch(api, narrowWindow.windowStart, narrowWindow.windowEnd);
|
|
500
|
+
const filteredNarrowRecords = filterOuraResourceRecords(narrowRecords, descriptor, input.objectId);
|
|
501
|
+
if (filteredNarrowRecords.length > 0 || !input.objectId) {
|
|
502
|
+
return {
|
|
503
|
+
accountId: api.account.externalAccountId,
|
|
504
|
+
importedAt: input.now,
|
|
505
|
+
[descriptor.snapshotKey]: filteredNarrowRecords,
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
const broaderRecords = await descriptor.fetch(api, subtractDays(input.now, reconcileDays), input.now);
|
|
509
|
+
const filteredBroaderRecords = filterOuraResourceRecords(broaderRecords, descriptor, input.objectId);
|
|
510
|
+
return {
|
|
511
|
+
accountId: api.account.externalAccountId,
|
|
512
|
+
importedAt: input.now,
|
|
513
|
+
[descriptor.snapshotKey]: filteredBroaderRecords,
|
|
514
|
+
};
|
|
515
|
+
}
|
|
516
|
+
function buildOuraWindowJobPayload(input) {
|
|
517
|
+
return {
|
|
518
|
+
windowStart: subtractDays(input.now, input.windowDays),
|
|
519
|
+
windowEnd: input.now,
|
|
520
|
+
includePersonalInfo: input.includePersonalInfo,
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
function buildOuraResourceWebhookJobPayload(input) {
|
|
524
|
+
return {
|
|
525
|
+
dataType: input.dataType,
|
|
526
|
+
objectId: input.objectId,
|
|
527
|
+
occurredAt: input.occurredAt,
|
|
528
|
+
...buildOuraWindowJobPayload({
|
|
529
|
+
now: input.now,
|
|
530
|
+
includePersonalInfo: false,
|
|
531
|
+
windowDays: reconcileDays,
|
|
532
|
+
}),
|
|
533
|
+
};
|
|
534
|
+
}
|
|
535
|
+
function buildOuraDeleteWebhookJobPayload(input) {
|
|
536
|
+
return {
|
|
537
|
+
sourceEventType: input.sourceEventType,
|
|
538
|
+
dataType: input.dataType,
|
|
539
|
+
objectId: input.objectId,
|
|
540
|
+
occurredAt: input.occurredAt,
|
|
541
|
+
webhookPayload: input.webhookPayload,
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
async function executeOuraResourceJob(context, job) {
|
|
545
|
+
const dataType = normalizeString(job.payload.dataType) ?? null;
|
|
546
|
+
const objectId = normalizeIdentifier(job.payload.objectId) ?? null;
|
|
547
|
+
const occurredAt = normalizeIsoTimestamp(job.payload.occurredAt) ?? context.now;
|
|
548
|
+
const api = createApiSession(context);
|
|
549
|
+
const snapshot = await fetchOuraResourceSnapshot(api, {
|
|
550
|
+
dataType,
|
|
551
|
+
objectId,
|
|
552
|
+
occurredAt,
|
|
553
|
+
now: context.now,
|
|
554
|
+
});
|
|
555
|
+
if (!snapshot) {
|
|
556
|
+
return executeWindowImport(context, job.payload, reconcileDays);
|
|
557
|
+
}
|
|
558
|
+
await context.importSnapshot(snapshot);
|
|
559
|
+
return {};
|
|
560
|
+
}
|
|
561
|
+
async function executeOuraDeleteJob(context, job) {
|
|
562
|
+
const dataType = normalizeString(job.payload.dataType);
|
|
563
|
+
const objectId = normalizeIdentifier(job.payload.objectId);
|
|
564
|
+
const occurredAt = normalizeIsoTimestamp(job.payload.occurredAt) ?? context.now;
|
|
565
|
+
const sourceEventType = normalizeString(job.payload.sourceEventType) ?? undefined;
|
|
566
|
+
const webhookPayload = coerceRecord(job.payload.webhookPayload);
|
|
567
|
+
if (!dataType || !objectId) {
|
|
568
|
+
throw deviceSyncError({
|
|
569
|
+
code: "OURA_DELETE_JOB_INVALID",
|
|
570
|
+
message: "Oura delete job did not include a dataType and objectId.",
|
|
571
|
+
retryable: false,
|
|
572
|
+
});
|
|
573
|
+
}
|
|
574
|
+
await context.importSnapshot(buildOuraDeleteSnapshot(context.account, context.now, {
|
|
575
|
+
resource_type: dataType,
|
|
576
|
+
resource_id: objectId,
|
|
577
|
+
occurred_at: occurredAt,
|
|
578
|
+
source_event_type: sourceEventType,
|
|
579
|
+
payload: webhookPayload,
|
|
580
|
+
}));
|
|
581
|
+
return {};
|
|
582
|
+
}
|
|
583
|
+
const provider = {
|
|
584
|
+
provider: descriptor.provider,
|
|
585
|
+
descriptor,
|
|
586
|
+
webhookAdmin,
|
|
587
|
+
buildConnectUrl(context) {
|
|
588
|
+
return buildOAuthConnectUrl({
|
|
589
|
+
baseUrl: authBaseUrl,
|
|
590
|
+
authorizePath: OURA_AUTHORIZE_PATH,
|
|
591
|
+
clientId: config.clientId,
|
|
592
|
+
callbackUrl: context.callbackUrl,
|
|
593
|
+
scopes: context.scopes,
|
|
594
|
+
state: context.state,
|
|
595
|
+
});
|
|
596
|
+
},
|
|
597
|
+
async exchangeAuthorizationCode(context, code) {
|
|
598
|
+
const { tokenPayload, tokens } = await exchangeOAuthAuthorizationCode({
|
|
599
|
+
postTokenRequest,
|
|
600
|
+
clientId: config.clientId,
|
|
601
|
+
clientSecret: config.clientSecret,
|
|
602
|
+
callbackUrl: context.callbackUrl,
|
|
603
|
+
code,
|
|
604
|
+
tokenResponseToAuthTokens,
|
|
605
|
+
buildMissingRefreshTokenError: () => deviceSyncError({
|
|
606
|
+
code: "OURA_REFRESH_TOKEN_MISSING",
|
|
607
|
+
message: "Oura did not return a refresh token. Use the server-side OAuth flow so the connection can auto-sync.",
|
|
608
|
+
retryable: false,
|
|
609
|
+
httpStatus: 502,
|
|
610
|
+
}),
|
|
611
|
+
});
|
|
612
|
+
const grantedScopesFromToken = normalizeGrantedScopes(tokenPayload.scope);
|
|
613
|
+
const grantedScopes = grantedScopesFromToken.length > 0
|
|
614
|
+
? grantedScopesFromToken
|
|
615
|
+
: context.grantedScopes.length > 0
|
|
616
|
+
? [...context.grantedScopes]
|
|
617
|
+
: [...scopes];
|
|
618
|
+
if (!grantedScopes.includes("personal")) {
|
|
619
|
+
throw deviceSyncError({
|
|
620
|
+
code: "OURA_PERSONAL_SCOPE_REQUIRED",
|
|
621
|
+
message: "Oura connections require the personal scope so Murph can identify the account.",
|
|
622
|
+
retryable: false,
|
|
623
|
+
httpStatus: 400,
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
const personalInfo = await fetchPersonalInfo(tokens.accessToken);
|
|
627
|
+
const externalAccountId = normalizeIdentifier(personalInfo.id ?? personalInfo.user_id ?? personalInfo.userId);
|
|
628
|
+
if (!externalAccountId) {
|
|
629
|
+
throw deviceSyncError({
|
|
630
|
+
code: "OURA_PROFILE_INVALID",
|
|
631
|
+
message: "Oura personal info response did not include a stable user identifier.",
|
|
632
|
+
retryable: false,
|
|
633
|
+
httpStatus: 502,
|
|
634
|
+
});
|
|
635
|
+
}
|
|
636
|
+
return {
|
|
637
|
+
externalAccountId,
|
|
638
|
+
displayName: buildDisplayName(personalInfo),
|
|
639
|
+
scopes: grantedScopes,
|
|
640
|
+
tokens,
|
|
641
|
+
initialJobs: [
|
|
642
|
+
{
|
|
643
|
+
kind: "backfill",
|
|
644
|
+
priority: 100,
|
|
645
|
+
payload: buildOuraWindowJobPayload({
|
|
646
|
+
now: context.now,
|
|
647
|
+
includePersonalInfo: true,
|
|
648
|
+
windowDays: backfillDays,
|
|
649
|
+
}),
|
|
650
|
+
},
|
|
651
|
+
],
|
|
652
|
+
nextReconcileAt: addMilliseconds(context.now, reconcileIntervalMs),
|
|
653
|
+
};
|
|
654
|
+
},
|
|
655
|
+
async refreshTokens(account) {
|
|
656
|
+
return refreshOAuthTokens({
|
|
657
|
+
postTokenRequest,
|
|
658
|
+
account,
|
|
659
|
+
clientId: config.clientId,
|
|
660
|
+
clientSecret: config.clientSecret,
|
|
661
|
+
tokenResponseToAuthTokens,
|
|
662
|
+
buildMissingRefreshTokenError: () => deviceSyncError({
|
|
663
|
+
code: "OURA_REFRESH_TOKEN_MISSING",
|
|
664
|
+
message: "Oura account does not have a refresh token and must be reconnected.",
|
|
665
|
+
retryable: false,
|
|
666
|
+
accountStatus: "reauthorization_required",
|
|
667
|
+
}),
|
|
668
|
+
resolveRefreshToken: ({ responseRefreshToken }) => requireRefreshToken(responseRefreshToken, () => deviceSyncError({
|
|
669
|
+
code: "OURA_REFRESH_TOKEN_ROTATION_MISSING",
|
|
670
|
+
message: "Oura refresh response did not include a replacement refresh token.",
|
|
671
|
+
retryable: false,
|
|
672
|
+
accountStatus: "reauthorization_required",
|
|
673
|
+
})),
|
|
674
|
+
});
|
|
675
|
+
},
|
|
676
|
+
async verifyAndParseWebhook(context) {
|
|
677
|
+
const signature = normalizeString(context.headers.get("x-oura-signature"));
|
|
678
|
+
const timestamp = normalizeString(context.headers.get("x-oura-timestamp"));
|
|
679
|
+
if (!signature || !timestamp) {
|
|
680
|
+
throw deviceSyncError({
|
|
681
|
+
code: "OURA_WEBHOOK_SIGNATURE_MISSING",
|
|
682
|
+
message: "Oura webhook is missing required signature headers.",
|
|
683
|
+
retryable: false,
|
|
684
|
+
httpStatus: 400,
|
|
685
|
+
});
|
|
686
|
+
}
|
|
687
|
+
const timestampMs = parseTimestampMillis(timestamp);
|
|
688
|
+
if (timestampMs === null) {
|
|
689
|
+
throw deviceSyncError({
|
|
690
|
+
code: "OURA_WEBHOOK_TIMESTAMP_INVALID",
|
|
691
|
+
message: "Oura webhook timestamp header was invalid.",
|
|
692
|
+
retryable: false,
|
|
693
|
+
httpStatus: 400,
|
|
694
|
+
});
|
|
695
|
+
}
|
|
696
|
+
if (Math.abs(Date.parse(context.now) - timestampMs) > webhookTimestampToleranceMs) {
|
|
697
|
+
throw deviceSyncError({
|
|
698
|
+
code: "OURA_WEBHOOK_TIMESTAMP_INVALID",
|
|
699
|
+
message: "Oura webhook timestamp is outside the allowed tolerance window.",
|
|
700
|
+
retryable: false,
|
|
701
|
+
httpStatus: 400,
|
|
702
|
+
});
|
|
703
|
+
}
|
|
704
|
+
const expectedSignatures = buildOuraSignatureCandidates(timestamp, context.rawBody, config.clientSecret);
|
|
705
|
+
if (!constantTimeMatchSignature(expectedSignatures, signature)) {
|
|
706
|
+
throw deviceSyncError({
|
|
707
|
+
code: "OURA_WEBHOOK_SIGNATURE_INVALID",
|
|
708
|
+
message: "Oura webhook signature verification failed.",
|
|
709
|
+
retryable: false,
|
|
710
|
+
httpStatus: 401,
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
const payload = parseOuraWebhookPayload(context.rawBody);
|
|
714
|
+
const externalAccountId = normalizeIdentifier(payload.user_id ?? payload.userId);
|
|
715
|
+
const rawEventType = normalizeString(payload.event_type ?? payload.eventType) ?? null;
|
|
716
|
+
const dataType = normalizeString(payload.data_type ?? payload.dataType) ?? null;
|
|
717
|
+
const objectId = normalizeIdentifier(payload.object_id ?? payload.objectId ?? payload.id);
|
|
718
|
+
const operation = normalizeOuraWebhookOperation(rawEventType);
|
|
719
|
+
const eventType = dataType ? buildOuraSourceEventType(rawEventType, dataType, operation) : rawEventType;
|
|
720
|
+
const occurredAt = normalizeIsoTimestamp(payload.event_time ?? payload.eventTime ?? payload.timestamp) ?? context.now;
|
|
721
|
+
if (!externalAccountId || !eventType || !dataType || !objectId) {
|
|
722
|
+
throw deviceSyncError({
|
|
723
|
+
code: "OURA_WEBHOOK_PAYLOAD_INVALID",
|
|
724
|
+
message: "Oura webhook payload did not include user_id, event_type, data_type, and object_id.",
|
|
725
|
+
retryable: false,
|
|
726
|
+
httpStatus: 400,
|
|
727
|
+
});
|
|
728
|
+
}
|
|
729
|
+
const traceId = normalizeString(payload.trace_id ?? payload.traceId ?? payload.event_id ?? payload.eventId) ??
|
|
730
|
+
sha256Text(`${externalAccountId}:${eventType}:${dataType}:${objectId}:${normalizeString(payload.event_time ?? payload.eventTime ?? payload.timestamp) ?? ""}`);
|
|
731
|
+
return {
|
|
732
|
+
externalAccountId,
|
|
733
|
+
eventType,
|
|
734
|
+
traceId,
|
|
735
|
+
occurredAt,
|
|
736
|
+
payload: {
|
|
737
|
+
eventType,
|
|
738
|
+
dataType,
|
|
739
|
+
operation,
|
|
740
|
+
},
|
|
741
|
+
jobs: [
|
|
742
|
+
{
|
|
743
|
+
kind: operation === "delete" ? "delete" : operation ? "resource" : "reconcile",
|
|
744
|
+
priority: operation === "delete" ? OURA_WEBHOOK_DELETE_PRIORITY : OURA_WEBHOOK_RESOURCE_PRIORITY,
|
|
745
|
+
dedupeKey: `oura-webhook:${traceId}`,
|
|
746
|
+
payload: operation === "delete"
|
|
747
|
+
? buildOuraDeleteWebhookJobPayload({
|
|
748
|
+
sourceEventType: eventType,
|
|
749
|
+
dataType,
|
|
750
|
+
objectId,
|
|
751
|
+
occurredAt,
|
|
752
|
+
webhookPayload: payload,
|
|
753
|
+
})
|
|
754
|
+
: operation
|
|
755
|
+
? buildOuraResourceWebhookJobPayload({
|
|
756
|
+
dataType,
|
|
757
|
+
objectId,
|
|
758
|
+
occurredAt,
|
|
759
|
+
now: context.now,
|
|
760
|
+
})
|
|
761
|
+
: buildOuraWindowJobPayload({
|
|
762
|
+
now: context.now,
|
|
763
|
+
includePersonalInfo: false,
|
|
764
|
+
windowDays: reconcileDays,
|
|
765
|
+
}),
|
|
766
|
+
},
|
|
767
|
+
],
|
|
768
|
+
};
|
|
769
|
+
},
|
|
770
|
+
createScheduledJobs(account, now) {
|
|
771
|
+
return buildScheduledReconcileJobs({
|
|
772
|
+
accountId: account.id,
|
|
773
|
+
nextReconcileAt: account.nextReconcileAt,
|
|
774
|
+
now,
|
|
775
|
+
reconcileDays,
|
|
776
|
+
reconcileIntervalMs,
|
|
777
|
+
payload: {
|
|
778
|
+
includePersonalInfo: false,
|
|
779
|
+
},
|
|
780
|
+
});
|
|
781
|
+
},
|
|
782
|
+
async executeJob(context, job) {
|
|
783
|
+
if (job.kind === "backfill") {
|
|
784
|
+
return executeWindowImport(context, job.payload, backfillDays);
|
|
785
|
+
}
|
|
786
|
+
if (job.kind === "reconcile") {
|
|
787
|
+
return executeWindowImport(context, job.payload, reconcileDays);
|
|
788
|
+
}
|
|
789
|
+
if (job.kind === "resource") {
|
|
790
|
+
return executeOuraResourceJob(context, job);
|
|
791
|
+
}
|
|
792
|
+
if (job.kind === "delete") {
|
|
793
|
+
return executeOuraDeleteJob(context, job);
|
|
794
|
+
}
|
|
795
|
+
throw deviceSyncError({
|
|
796
|
+
code: "OURA_JOB_KIND_UNSUPPORTED",
|
|
797
|
+
message: `Oura job kind ${job.kind} is not supported.`,
|
|
798
|
+
retryable: false,
|
|
799
|
+
});
|
|
800
|
+
},
|
|
801
|
+
};
|
|
802
|
+
return provider;
|
|
803
|
+
}
|
|
804
|
+
//# sourceMappingURL=oura.js.map
|