@10x-media/analytics 1.0.0-beta.11 → 1.0.0-beta.13
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/CHANGELOG.md +530 -0
- package/README.md +30 -37
- package/dist/access/adminUser.d.ts +15 -0
- package/dist/access/adminUser.js +13 -0
- package/dist/access/adminUser.js.map +1 -0
- package/dist/access/decideOnce.js +16 -0
- package/dist/access/decideOnce.js.map +1 -0
- package/dist/access/membership.d.ts +23 -0
- package/dist/access/membership.js +63 -0
- package/dist/access/membership.js.map +1 -0
- package/dist/access/principal.d.ts +37 -0
- package/dist/access/principal.js +29 -0
- package/dist/access/principal.js.map +1 -0
- package/dist/access/readGate.js +16 -0
- package/dist/access/readGate.js.map +1 -0
- package/dist/adapters/ga4/disableKey.js +7 -9
- package/dist/adapters/ga4/disableKey.js.map +1 -1
- package/dist/adapters/ga4/eventName.d.ts +2 -8
- package/dist/adapters/ga4/eventName.js +2 -8
- package/dist/adapters/ga4/eventName.js.map +1 -1
- package/dist/adapters/ga4/ga4.d.ts +17 -0
- package/dist/adapters/ga4/ga4.js +208 -124
- package/dist/adapters/ga4/ga4.js.map +1 -1
- package/dist/adapters/ga4/measurementId.js +2 -3
- package/dist/adapters/ga4/measurementId.js.map +1 -1
- package/dist/adapters/goalRead.js +15 -29
- package/dist/adapters/goalRead.js.map +1 -1
- package/dist/adapters/http/baseUrl.js +15 -0
- package/dist/adapters/http/baseUrl.js.map +1 -0
- package/dist/adapters/http/fetchJson.d.ts +19 -0
- package/dist/adapters/http/fetchJson.js +27 -8
- package/dist/adapters/http/fetchJson.js.map +1 -1
- package/dist/adapters/mapping.js +52 -0
- package/dist/adapters/mapping.js.map +1 -0
- package/dist/adapters/plausible/plausible.d.ts +19 -13
- package/dist/adapters/plausible/plausible.js +139 -123
- package/dist/adapters/plausible/plausible.js.map +1 -1
- package/dist/adapters/plausible/scriptId.js +19 -0
- package/dist/adapters/plausible/scriptId.js.map +1 -0
- package/dist/adapters/posthog/posthog.d.ts +26 -9
- package/dist/adapters/posthog/posthog.js +194 -115
- package/dist/adapters/posthog/posthog.js.map +1 -1
- package/dist/adapters/readTime.js +7 -0
- package/dist/adapters/readTime.js.map +1 -0
- package/dist/adapters/series.js +14 -8
- package/dist/adapters/series.js.map +1 -1
- package/dist/adapters/umami/umami.d.ts +13 -9
- package/dist/adapters/umami/umami.js +186 -173
- package/dist/adapters/umami/umami.js.map +1 -1
- package/dist/adapters/upstream.js +16 -0
- package/dist/adapters/upstream.js.map +1 -0
- package/dist/binding/report.d.ts +8 -0
- package/dist/binding/report.js +24 -0
- package/dist/binding/report.js.map +1 -0
- package/dist/binding/resolvePath.js +16 -29
- package/dist/binding/resolvePath.js.map +1 -1
- package/dist/binding/types.d.ts +14 -29
- package/dist/capture/captureRequest.js +28 -0
- package/dist/capture/captureRequest.js.map +1 -0
- package/dist/capture/exclusionEndpoint.js +98 -0
- package/dist/capture/exclusionEndpoint.js.map +1 -0
- package/dist/capture/exclusionPrelude.js +14 -0
- package/dist/capture/exclusionPrelude.js.map +1 -0
- package/dist/capture/exclusionToken.js +23 -0
- package/dist/capture/exclusionToken.js.map +1 -0
- package/dist/capture/jsLiteral.js +19 -0
- package/dist/capture/jsLiteral.js.map +1 -0
- package/dist/capture/mountPath.js +2 -3
- package/dist/capture/mountPath.js.map +1 -1
- package/dist/capture/proxyEndpoint.js +48 -95
- package/dist/capture/proxyEndpoint.js.map +1 -1
- package/dist/capture/proxyRoutes.js +58 -21
- package/dist/capture/proxyRoutes.js.map +1 -1
- package/dist/capture/relay.js +91 -0
- package/dist/capture/relay.js.map +1 -0
- package/dist/capture/requestBody.js +2 -6
- package/dist/capture/requestBody.js.map +1 -1
- package/dist/capture/requestTrust.js +45 -0
- package/dist/capture/requestTrust.js.map +1 -0
- package/dist/capture/sameSite.js +40 -0
- package/dist/capture/sameSite.js.map +1 -0
- package/dist/capture/slots.js +50 -25
- package/dist/capture/slots.js.map +1 -1
- package/dist/capture/trackerConfig.js +108 -36
- package/dist/capture/trackerConfig.js.map +1 -1
- package/dist/capture/trackerEndpoint.js +22 -21
- package/dist/capture/trackerEndpoint.js.map +1 -1
- package/dist/charts/BarList.d.ts +27 -14
- package/dist/charts/BarList.js +38 -83
- package/dist/charts/BarList.js.map +1 -1
- package/dist/charts/TrendChart.d.ts +40 -7
- package/dist/charts/TrendChart.js +243 -215
- package/dist/charts/TrendChart.js.map +1 -1
- package/dist/charts/bars.d.ts +15 -1
- package/dist/charts/bars.js +12 -12
- package/dist/charts/bars.js.map +1 -1
- package/dist/charts/bucket.js +106 -73
- package/dist/charts/bucket.js.map +1 -1
- package/dist/charts/inProgress.js +22 -0
- package/dist/charts/inProgress.js.map +1 -0
- package/dist/charts/series.d.ts +15 -0
- package/dist/charts/series.js +123 -0
- package/dist/charts/series.js.map +1 -0
- package/dist/charts/spline.js +91 -25
- package/dist/charts/spline.js.map +1 -1
- package/dist/charts/trendGeometry.js +91 -0
- package/dist/charts/trendGeometry.js.map +1 -0
- package/dist/core/adminOptions.d.ts +1 -0
- package/dist/core/adminOptions.js +198 -0
- package/dist/core/adminOptions.js.map +1 -0
- package/dist/core/budget.js +24 -0
- package/dist/core/budget.js.map +1 -0
- package/dist/core/cacheKey.d.ts +1 -0
- package/dist/core/cacheKey.js +48 -37
- package/dist/core/cacheKey.js.map +1 -1
- package/dist/core/cacheOptions.js +165 -0
- package/dist/core/cacheOptions.js.map +1 -0
- package/dist/core/capabilities.d.ts +24 -11
- package/dist/core/capabilities.js +96 -17
- package/dist/core/capabilities.js.map +1 -1
- package/dist/core/capture.d.ts +28 -25
- package/dist/core/captureOptions.d.ts +1 -0
- package/dist/core/captureOptions.js +258 -0
- package/dist/core/captureOptions.js.map +1 -0
- package/dist/core/clock.js +13 -0
- package/dist/core/clock.js.map +1 -0
- package/dist/core/collectionOption.d.ts +17 -0
- package/dist/core/collectionOption.js +104 -0
- package/dist/core/collectionOption.js.map +1 -0
- package/dist/core/collectionSlug.js +7 -0
- package/dist/core/collectionSlug.js.map +1 -0
- package/dist/core/contract.d.ts +297 -59
- package/dist/core/contract.js +6 -4
- package/dist/core/contract.js.map +1 -1
- package/dist/core/cron.js +57 -0
- package/dist/core/cron.js.map +1 -0
- package/dist/core/fetch.d.ts +17 -0
- package/dist/core/goalOptions.d.ts +1 -0
- package/dist/core/goalOptions.js +166 -0
- package/dist/core/goalOptions.js.map +1 -0
- package/dist/core/granularity.js +3 -2
- package/dist/core/granularity.js.map +1 -1
- package/dist/core/guards.js +17 -0
- package/dist/core/guards.js.map +1 -0
- package/dist/core/jobs.d.ts +40 -0
- package/dist/core/jobs.js +132 -0
- package/dist/core/jobs.js.map +1 -0
- package/dist/core/legacyOptions.js +145 -0
- package/dist/core/legacyOptions.js.map +1 -0
- package/dist/core/metricAliases.js +81 -0
- package/dist/core/metricAliases.js.map +1 -0
- package/dist/core/metricValues.js +57 -0
- package/dist/core/metricValues.js.map +1 -0
- package/dist/core/monotonic.js +10 -0
- package/dist/core/monotonic.js.map +1 -0
- package/dist/core/optionChecks.js +51 -0
- package/dist/core/optionChecks.js.map +1 -0
- package/dist/core/options.d.ts +505 -157
- package/dist/core/options.js +158 -219
- package/dist/core/options.js.map +1 -1
- package/dist/core/registry.js +45 -5
- package/dist/core/registry.js.map +1 -1
- package/dist/core/scopeList.js +7 -9
- package/dist/core/scopeList.js.map +1 -1
- package/dist/core/scopeOptions.d.ts +1 -0
- package/dist/core/scopeOptions.js +114 -0
- package/dist/core/scopeOptions.js.map +1 -0
- package/dist/core/scopedRead.js +330 -71
- package/dist/core/scopedRead.js.map +1 -1
- package/dist/core/sdks.d.ts +81 -0
- package/dist/core/sdks.js +23 -0
- package/dist/core/sdks.js.map +1 -0
- package/dist/core/serverEvent.d.ts +38 -20
- package/dist/core/serverEvent.js.map +1 -1
- package/dist/core/siteAddress.js +20 -0
- package/dist/core/siteAddress.js.map +1 -0
- package/dist/core/sourceErrors.js +109 -0
- package/dist/core/sourceErrors.js.map +1 -0
- package/dist/core/sourceLabel.d.ts +10 -0
- package/dist/core/sourceLabel.js +63 -0
- package/dist/core/sourceLabel.js.map +1 -0
- package/dist/core/sourceOptions.js +106 -0
- package/dist/core/sourceOptions.js.map +1 -0
- package/dist/core/sourcePolicy.d.ts +55 -0
- package/dist/core/sourcePolicy.js +51 -0
- package/dist/core/sourcePolicy.js.map +1 -0
- package/dist/core/throttle.js +18 -0
- package/dist/core/throttle.js.map +1 -0
- package/dist/core/values.js +61 -0
- package/dist/core/values.js.map +1 -0
- package/dist/core/widgetSlugs.d.ts +17 -0
- package/dist/core/widgetSlugs.js +29 -0
- package/dist/core/widgetSlugs.js.map +1 -0
- package/dist/db/detachedWrite.js +36 -0
- package/dist/db/detachedWrite.js.map +1 -0
- package/dist/db/errors.js +182 -0
- package/dist/db/errors.js.map +1 -0
- package/dist/db/kind.js +32 -0
- package/dist/db/kind.js.map +1 -0
- package/dist/db/openTransaction.js +51 -0
- package/dist/db/openTransaction.js.map +1 -0
- package/dist/exports/adapters/contract.d.ts +15 -0
- package/dist/exports/adapters/ga4.d.ts +16 -1
- package/dist/exports/adapters/native.d.ts +27 -2
- package/dist/exports/adapters/native.js +4 -1
- package/dist/exports/adapters/plausible.d.ts +16 -1
- package/dist/exports/adapters/posthog.d.ts +16 -1
- package/dist/exports/adapters/umami.d.ts +16 -1
- package/dist/exports/attributes.d.ts +42 -0
- package/dist/exports/attributes.js +83 -0
- package/dist/exports/attributes.js.map +1 -0
- package/dist/exports/client.d.ts +43 -13
- package/dist/exports/client.js +22 -9
- package/dist/exports/geo.d.ts +3 -1
- package/dist/exports/geo.js +1 -1
- package/dist/exports/i18n.d.ts +2 -2
- package/dist/exports/i18n.js +2 -2
- package/dist/exports/migrations.d.ts +2 -0
- package/dist/exports/migrations.js +2 -0
- package/dist/exports/next.d.ts +19 -1
- package/dist/exports/next.js +3 -1
- package/dist/exports/react.d.ts +3 -2
- package/dist/exports/react.js +1 -2
- package/dist/exports/rsc.d.ts +32 -14
- package/dist/exports/rsc.js +11 -6
- package/dist/exports/site.d.ts +5 -0
- package/dist/exports/site.js +3 -0
- package/dist/exports/testing.d.ts +18 -0
- package/dist/exports/testing.js +3 -0
- package/dist/exports/tracker.d.ts +5 -20
- package/dist/exports/tracker.js +3 -14
- package/dist/exports/types.d.ts +44 -14
- package/dist/exports/types.js +5 -1
- package/dist/fields/AnalyticsPanelClient.js +265 -154
- package/dist/fields/AnalyticsPanelClient.js.map +1 -1
- package/dist/fields/AnalyticsPanelField.d.ts +19 -7
- package/dist/fields/AnalyticsPanelField.js +123 -30
- package/dist/fields/AnalyticsPanelField.js.map +1 -1
- package/dist/fields/AnalyticsStatField.d.ts +17 -6
- package/dist/fields/AnalyticsStatField.js +98 -63
- package/dist/fields/AnalyticsStatField.js.map +1 -1
- package/dist/fields/FieldShimmer.js +15 -0
- package/dist/fields/FieldShimmer.js.map +1 -0
- package/dist/fields/PanelContent.js +222 -0
- package/dist/fields/PanelContent.js.map +1 -0
- package/dist/fields/PanelList.js +82 -0
- package/dist/fields/PanelList.js.map +1 -0
- package/dist/fields/PanelLiveCounter.js +63 -0
- package/dist/fields/PanelLiveCounter.js.map +1 -0
- package/dist/fields/PanelSkeleton.js +63 -0
- package/dist/fields/PanelSkeleton.js.map +1 -0
- package/dist/fields/componentPaths.js +8 -0
- package/dist/fields/componentPaths.js.map +1 -0
- package/dist/fields/config/FilterDimensionSelectField.d.ts +2 -2
- package/dist/fields/config/FilterDimensionSelectField.js +26 -54
- package/dist/fields/config/FilterDimensionSelectField.js.map +1 -1
- package/dist/fields/config/FilterKeySelect.js +66 -0
- package/dist/fields/config/FilterKeySelect.js.map +1 -0
- package/dist/fields/config/FilterOperatorSelectField.d.ts +7 -2
- package/dist/fields/config/FilterOperatorSelectField.js +37 -53
- package/dist/fields/config/FilterOperatorSelectField.js.map +1 -1
- package/dist/fields/config/FilterValueField.d.ts +17 -0
- package/dist/fields/config/FilterValueField.js +130 -0
- package/dist/fields/config/FilterValueField.js.map +1 -0
- package/dist/fields/config/MetricSelectField.d.ts +5 -12
- package/dist/fields/config/MetricSelectField.js +18 -30
- package/dist/fields/config/MetricSelectField.js.map +1 -1
- package/dist/fields/config/OptionSelect.js +52 -0
- package/dist/fields/config/OptionSelect.js.map +1 -0
- package/dist/fields/config/SourceSelectField.js +16 -31
- package/dist/fields/config/SourceSelectField.js.map +1 -1
- package/dist/fields/config/fetchSources.d.ts +3 -0
- package/dist/fields/config/fetchSources.js +17 -27
- package/dist/fields/config/fetchSources.js.map +1 -1
- package/dist/fields/config/filterValues.js +106 -0
- package/dist/fields/config/filterValues.js.map +1 -0
- package/dist/fields/config/narrow.js +8 -10
- package/dist/fields/config/narrow.js.map +1 -1
- package/dist/fields/config/retiredPickers.d.ts +45 -0
- package/dist/fields/config/retiredPickers.js +46 -0
- package/dist/fields/config/retiredPickers.js.map +1 -0
- package/dist/fields/config/scopedFields.d.ts +40 -0
- package/dist/fields/config/scopedFields.js +68 -0
- package/dist/fields/config/scopedFields.js.map +1 -0
- package/dist/fields/config/toSelectOption.js +13 -7
- package/dist/fields/config/toSelectOption.js.map +1 -1
- package/dist/fields/config/useAnalyticsSources.d.ts +5 -7
- package/dist/fields/config/useAnalyticsSources.js +17 -21
- package/dist/fields/config/useAnalyticsSources.js.map +1 -1
- package/dist/fields/config/useFilterCapabilities.d.ts +9 -6
- package/dist/fields/config/useFilterCapabilities.js +23 -15
- package/dist/fields/config/useFilterCapabilities.js.map +1 -1
- package/dist/fields/config/useFormString.js +12 -0
- package/dist/fields/config/useFormString.js.map +1 -0
- package/dist/fields/dateRange/field.js +7 -19
- package/dist/fields/dateRange/field.js.map +1 -1
- package/dist/fields/dateRange/types.d.ts +5 -1
- package/dist/fields/dateRange/ui.d.ts +3 -2
- package/dist/fields/dateRange/ui.js +57 -319
- package/dist/fields/dateRange/ui.js.map +1 -1
- package/dist/fields/documentScope.js +21 -0
- package/dist/fields/documentScope.js.map +1 -0
- package/dist/fields/emptyState.js +31 -26
- package/dist/fields/emptyState.js.map +1 -1
- package/dist/fields/factories.d.ts +35 -16
- package/dist/fields/factories.js +66 -37
- package/dist/fields/factories.js.map +1 -1
- package/dist/fields/format.d.ts +12 -3
- package/dist/fields/format.js +77 -13
- package/dist/fields/format.js.map +1 -1
- package/dist/fields/itemReport.js +45 -0
- package/dist/fields/itemReport.js.map +1 -0
- package/dist/fields/readForDocument.d.ts +79 -26
- package/dist/fields/readForDocument.js +450 -116
- package/dist/fields/readForDocument.js.map +1 -1
- package/dist/fields/stateKeys.js +20 -0
- package/dist/fields/stateKeys.js.map +1 -0
- package/dist/goals/GoalAmountField.d.ts +10 -0
- package/dist/goals/GoalAmountField.js +162 -0
- package/dist/goals/GoalAmountField.js.map +1 -0
- package/dist/goals/GoalSelectField.js +89 -40
- package/dist/goals/GoalSelectField.js.map +1 -1
- package/dist/goals/GoalSelectFieldServer.d.ts +13 -0
- package/dist/goals/GoalSelectFieldServer.js +21 -0
- package/dist/goals/GoalSelectFieldServer.js.map +1 -0
- package/dist/goals/amountField.d.ts +20 -0
- package/dist/goals/amountField.js +37 -0
- package/dist/goals/amountField.js.map +1 -0
- package/dist/goals/builtin.js +17 -0
- package/dist/goals/builtin.js.map +1 -0
- package/dist/goals/collection.d.ts +22 -0
- package/dist/goals/collection.js +139 -125
- package/dist/goals/collection.js.map +1 -1
- package/dist/goals/constants.d.ts +38 -0
- package/dist/goals/constants.js +49 -0
- package/dist/goals/constants.js.map +1 -0
- package/dist/goals/currency.d.ts +16 -0
- package/dist/goals/currency.js +46 -4
- package/dist/goals/currency.js.map +1 -1
- package/dist/goals/currencyOptions.js +70 -0
- package/dist/goals/currencyOptions.js.map +1 -0
- package/dist/goals/fetchGoals.d.ts +10 -0
- package/dist/goals/fetchGoals.js +12 -26
- package/dist/goals/fetchGoals.js.map +1 -1
- package/dist/goals/goalField.d.ts +4 -6
- package/dist/goals/goalField.js +9 -19
- package/dist/goals/goalField.js.map +1 -1
- package/dist/goals/goalsEndpoint.js +39 -40
- package/dist/goals/goalsEndpoint.js.map +1 -1
- package/dist/goals/items.js +35 -0
- package/dist/goals/items.js.map +1 -0
- package/dist/goals/latent.js +9 -0
- package/dist/goals/latent.js.map +1 -0
- package/dist/goals/linkFields.d.ts +35 -0
- package/dist/goals/linkFields.js +31 -0
- package/dist/goals/linkFields.js.map +1 -0
- package/dist/goals/match.d.ts +14 -0
- package/dist/goals/match.js +67 -46
- package/dist/goals/match.js.map +1 -1
- package/dist/goals/moneyFields.js +56 -0
- package/dist/goals/moneyFields.js.map +1 -0
- package/dist/goals/pathMatch.js +122 -0
- package/dist/goals/pathMatch.js.map +1 -0
- package/dist/goals/placeholder.js +12 -0
- package/dist/goals/placeholder.js.map +1 -0
- package/dist/goals/resolver.d.ts +3 -3
- package/dist/goals/resolver.js +155 -47
- package/dist/goals/resolver.js.map +1 -1
- package/dist/goals/serverRevenue.d.ts +60 -0
- package/dist/goals/serverRevenue.js +41 -0
- package/dist/goals/serverRevenue.js.map +1 -0
- package/dist/goals/trackGoalAction.d.ts +26 -27
- package/dist/goals/trackGoalAction.js +38 -52
- package/dist/goals/trackGoalAction.js.map +1 -1
- package/dist/goals/types.d.ts +13 -28
- package/dist/goals/types.js +1 -1
- package/dist/goals/types.js.map +1 -1
- package/dist/goals/useAnalyticsGoals.d.ts +6 -5
- package/dist/goals/useAnalyticsGoals.js +17 -18
- package/dist/goals/useAnalyticsGoals.js.map +1 -1
- package/dist/index.d.ts +67 -12
- package/dist/index.js +258 -247
- package/dist/index.js.map +1 -1
- package/dist/items/collectionIdType.js +20 -0
- package/dist/items/collectionIdType.js.map +1 -0
- package/dist/items/idType.js +31 -0
- package/dist/items/idType.js.map +1 -0
- package/dist/items/ref.js +73 -0
- package/dist/items/ref.js.map +1 -0
- package/dist/maintenance/apiTaskState.js +141 -0
- package/dist/maintenance/apiTaskState.js.map +1 -0
- package/dist/maintenance/heartbeat.js +51 -0
- package/dist/maintenance/heartbeat.js.map +1 -0
- package/dist/maintenance/lease.d.ts +1 -0
- package/dist/maintenance/lease.js +81 -0
- package/dist/maintenance/lease.js.map +1 -0
- package/dist/maintenance/taskSchedule.d.ts +1 -0
- package/dist/maintenance/taskSchedule.js +62 -0
- package/dist/maintenance/taskSchedule.js.map +1 -0
- package/dist/maintenance/underLease.js +35 -0
- package/dist/maintenance/underLease.js.map +1 -0
- package/dist/migrations/legacy.d.ts +54 -0
- package/dist/migrations/legacy.js +117 -0
- package/dist/migrations/legacy.js.map +1 -0
- package/dist/migrations/predefined/dropLegacyMongo.d.ts +11 -0
- package/dist/migrations/predefined/dropLegacyMongo.js +12 -0
- package/dist/migrations/predefined/dropLegacyMongo.js.map +1 -0
- package/dist/native/collections/aggregates.js +54 -0
- package/dist/native/collections/aggregates.js.map +1 -0
- package/dist/native/collections/hits.js +102 -0
- package/dist/native/collections/hits.js.map +1 -0
- package/dist/native/collections/slugs.d.ts +10 -0
- package/dist/native/collections/slugs.js +16 -0
- package/dist/native/collections/slugs.js.map +1 -0
- package/dist/native/collections/state.js +84 -0
- package/dist/native/collections/state.js.map +1 -0
- package/dist/native/collections/storeCollection.js +29 -0
- package/dist/native/collections/storeCollection.js.map +1 -0
- package/dist/native/engine/buckets.d.ts +1 -0
- package/dist/native/engine/buckets.js +53 -0
- package/dist/native/engine/buckets.js.map +1 -0
- package/dist/native/engine/capabilities.js +87 -0
- package/dist/native/engine/capabilities.js.map +1 -0
- package/dist/native/engine/cost.js +72 -0
- package/dist/native/engine/cost.js.map +1 -0
- package/dist/native/engine/days.d.ts +1 -0
- package/dist/native/engine/days.js +182 -0
- package/dist/native/engine/days.js.map +1 -0
- package/dist/native/engine/engine.d.ts +1 -0
- package/dist/native/engine/engine.js +1623 -0
- package/dist/native/engine/engine.js.map +1 -0
- package/dist/native/engine/instance.js +58 -0
- package/dist/native/engine/instance.js.map +1 -0
- package/dist/native/engine/maintenance.d.ts +1 -0
- package/dist/native/engine/maintenance.js +677 -0
- package/dist/native/engine/maintenance.js.map +1 -0
- package/dist/native/engine/merge.js +41 -0
- package/dist/native/engine/merge.js.map +1 -0
- package/dist/native/engine/nudge.js +26 -0
- package/dist/native/engine/nudge.js.map +1 -0
- package/dist/native/engine/planner.js +198 -0
- package/dist/native/engine/planner.js.map +1 -0
- package/dist/native/engine/rebuild.d.ts +22 -0
- package/dist/native/engine/rebuild.js +76 -0
- package/dist/native/engine/rebuild.js.map +1 -0
- package/dist/native/engine/recent.js +17 -0
- package/dist/native/engine/recent.js.map +1 -0
- package/dist/native/engine/salt.d.ts +1 -0
- package/dist/native/engine/salt.js +98 -0
- package/dist/native/engine/salt.js.map +1 -0
- package/dist/native/engine/siteHosts.d.ts +1 -0
- package/dist/native/engine/siteHosts.js +58 -0
- package/dist/native/engine/siteHosts.js.map +1 -0
- package/dist/native/engine/toHit.js +108 -0
- package/dist/native/engine/toHit.js.map +1 -0
- package/dist/native/engine/writeBuffer.d.ts +14 -0
- package/dist/native/engine/writeBuffer.js +317 -0
- package/dist/native/engine/writeBuffer.js.map +1 -0
- package/dist/native/geo/composeGeoResolvers.d.ts +1 -0
- package/dist/native/geo/composeGeoResolvers.js +4 -1
- package/dist/native/geo/composeGeoResolvers.js.map +1 -1
- package/dist/native/geo/geoResolver.d.ts +20 -2
- package/dist/native/geo/geoResolver.js +42 -6
- package/dist/native/geo/geoResolver.js.map +1 -1
- package/dist/native/geo/maxmindResolver.d.ts +8 -4
- package/dist/native/geo/maxmindResolver.js +20 -16
- package/dist/native/geo/maxmindResolver.js.map +1 -1
- package/dist/native/geo/resolveGeo.js +31 -0
- package/dist/native/geo/resolveGeo.js.map +1 -0
- package/dist/native/ingest/bots.d.ts +2 -3
- package/dist/native/ingest/bots.js +8 -13
- package/dist/native/ingest/bots.js.map +1 -1
- package/dist/native/ingest/browser.js +4 -6
- package/dist/native/ingest/browser.js.map +1 -1
- package/dist/native/ingest/clientIp.js +30 -9
- package/dist/native/ingest/clientIp.js.map +1 -1
- package/dist/native/ingest/device.js +4 -6
- package/dist/native/ingest/device.js.map +1 -1
- package/dist/native/ingest/endpoint.d.ts +1 -1
- package/dist/native/ingest/endpoint.js +119 -34
- package/dist/native/ingest/endpoint.js.map +1 -1
- package/dist/native/ingest/itemSignature.d.ts +26 -0
- package/dist/native/ingest/itemSignature.js +45 -0
- package/dist/native/ingest/itemSignature.js.map +1 -0
- package/dist/native/ingest/language.js +2 -3
- package/dist/native/ingest/language.js.map +1 -1
- package/dist/native/ingest/normalizeEvent.d.ts +60 -7
- package/dist/native/ingest/normalizeEvent.js +226 -61
- package/dist/native/ingest/normalizeEvent.js.map +1 -1
- package/dist/native/ingest/orderSignature.d.ts +13 -0
- package/dist/native/ingest/orderSignature.js +50 -0
- package/dist/native/ingest/orderSignature.js.map +1 -0
- package/dist/native/ingest/referrer.js +30 -32
- package/dist/native/ingest/referrer.js.map +1 -1
- package/dist/native/ingest/requestHost.js +10 -23
- package/dist/native/ingest/requestHost.js.map +1 -1
- package/dist/native/ingest/resolveHostname.d.ts +4 -13
- package/dist/native/ingest/resolveHostname.js +5 -6
- package/dist/native/ingest/resolveHostname.js.map +1 -1
- package/dist/native/ingest/revenue.d.ts +1 -0
- package/dist/native/ingest/revenue.js +121 -0
- package/dist/native/ingest/revenue.js.map +1 -0
- package/dist/native/ingest/route.d.ts +10 -0
- package/dist/native/ingest/route.js +82 -0
- package/dist/native/ingest/route.js.map +1 -0
- package/dist/native/ingest/serverTrack.d.ts +2 -10
- package/dist/native/ingest/serverTrack.js +181 -72
- package/dist/native/ingest/serverTrack.js.map +1 -1
- package/dist/native/ingest/signature.js +28 -0
- package/dist/native/ingest/signature.js.map +1 -0
- package/dist/native/ingest/source.d.ts +2 -3
- package/dist/native/ingest/source.js +35 -54
- package/dist/native/ingest/source.js.map +1 -1
- package/dist/native/ingest/utm.js +9 -9
- package/dist/native/ingest/utm.js.map +1 -1
- package/dist/native/ingest/validate.js +20 -10
- package/dist/native/ingest/validate.js.map +1 -1
- package/dist/native/ingest/visitorHash.js +6 -8
- package/dist/native/ingest/visitorHash.js.map +1 -1
- package/dist/native/nativeAdapter.d.ts +107 -33
- package/dist/native/nativeAdapter.js +376 -317
- package/dist/native/nativeAdapter.js.map +1 -1
- package/dist/native/rebuildDays.d.ts +12 -0
- package/dist/native/rebuildDays.js +16 -0
- package/dist/native/rebuildDays.js.map +1 -0
- package/dist/native/store/aggregate.js +450 -0
- package/dist/native/store/aggregate.js.map +1 -0
- package/dist/native/store/caps.d.ts +18 -0
- package/dist/native/store/caps.js +76 -0
- package/dist/native/store/caps.js.map +1 -0
- package/dist/native/store/chunks.js +34 -0
- package/dist/native/store/chunks.js.map +1 -0
- package/dist/native/store/columnValues.js +31 -0
- package/dist/native/store/columnValues.js.map +1 -0
- package/dist/native/store/dialect.js +106 -0
- package/dist/native/store/dialect.js.map +1 -0
- package/dist/native/store/eventStore.js +44 -0
- package/dist/native/store/eventStore.js.map +1 -0
- package/dist/native/store/hitRow.js +116 -0
- package/dist/native/store/hitRow.js.map +1 -0
- package/dist/native/store/hits.js +63 -0
- package/dist/native/store/hits.js.map +1 -0
- package/dist/native/store/ids.js +105 -0
- package/dist/native/store/ids.js.map +1 -0
- package/dist/native/store/mongo/aggregatePipelines.js +430 -0
- package/dist/native/store/mongo/aggregatePipelines.js.map +1 -0
- package/dist/native/store/mongo/mongoState.js +375 -0
- package/dist/native/store/mongo/mongoState.js.map +1 -0
- package/dist/native/store/mongo/mongoStore.js +618 -0
- package/dist/native/store/mongo/mongoStore.js.map +1 -0
- package/dist/native/store/mongo/pipelines.js +695 -0
- package/dist/native/store/mongo/pipelines.js.map +1 -0
- package/dist/native/store/mongo/results.js +20 -0
- package/dist/native/store/mongo/results.js.map +1 -0
- package/dist/native/store/parts.d.ts +1 -0
- package/dist/native/store/parts.js +95 -0
- package/dist/native/store/parts.js.map +1 -0
- package/dist/native/store/pattern.js +213 -0
- package/dist/native/store/pattern.js.map +1 -0
- package/dist/native/store/rawRead.d.ts +23 -0
- package/dist/native/store/rawRead.js +384 -0
- package/dist/native/store/rawRead.js.map +1 -0
- package/dist/native/store/reclassify.js +53 -0
- package/dist/native/store/reclassify.js.map +1 -0
- package/dist/native/store/sql/aggregateSql.js +345 -0
- package/dist/native/store/sql/aggregateSql.js.map +1 -0
- package/dist/native/store/sql/columns.js +48 -0
- package/dist/native/store/sql/columns.js.map +1 -0
- package/dist/native/store/sql/compile.js +656 -0
- package/dist/native/store/sql/compile.js.map +1 -0
- package/dist/native/store/sql/drivers.js +218 -0
- package/dist/native/store/sql/drivers.js.map +1 -0
- package/dist/native/store/sql/executor.js +132 -0
- package/dist/native/store/sql/executor.js.map +1 -0
- package/dist/native/store/sql/fragment.js +104 -0
- package/dist/native/store/sql/fragment.js.map +1 -0
- package/dist/native/store/sql/maintenanceSql.js +59 -0
- package/dist/native/store/sql/maintenanceSql.js.map +1 -0
- package/dist/native/store/sql/ownConnection.js +107 -0
- package/dist/native/store/sql/ownConnection.js.map +1 -0
- package/dist/native/store/sql/poolShare.js +101 -0
- package/dist/native/store/sql/poolShare.js.map +1 -0
- package/dist/native/store/sql/sqlState.js +325 -0
- package/dist/native/store/sql/sqlState.js.map +1 -0
- package/dist/native/store/sql/sqlStore.js +355 -0
- package/dist/native/store/sql/sqlStore.js.map +1 -0
- package/dist/native/store/sql/sqliteThread.d.ts +9 -0
- package/dist/native/store/sql/sqliteThread.js +314 -0
- package/dist/native/store/sql/sqliteThread.js.map +1 -0
- package/dist/native/store/sql/sqliteWorker.js +327 -0
- package/dist/native/store/sql/sqliteWorker.js.map +1 -0
- package/dist/native/store/sql/sqliteWorkerSource.js +347 -0
- package/dist/native/store/sql/sqliteWorkerSource.js.map +1 -0
- package/dist/native/store/state.js +151 -0
- package/dist/native/store/state.js.map +1 -0
- package/dist/native/store/stateStore.js +29 -0
- package/dist/native/store/stateStore.js.map +1 -0
- package/dist/native/store/types.d.ts +9 -0
- package/dist/native/tasks/maintainTask.d.ts +19 -0
- package/dist/native/tasks/maintainTask.js +68 -0
- package/dist/native/tasks/maintainTask.js.map +1 -0
- package/dist/net/guardedFetch.d.ts +32 -0
- package/dist/net/guardedFetch.js +220 -0
- package/dist/net/guardedFetch.js.map +1 -0
- package/dist/net/origin.js +40 -0
- package/dist/net/origin.js.map +1 -0
- package/dist/net/platform.d.ts +9 -0
- package/dist/net/platform.js +35 -0
- package/dist/net/platform.js.map +1 -0
- package/dist/next/captureRewrites.d.ts +4 -24
- package/dist/next/captureRewrites.js +6 -50
- package/dist/next/captureRewrites.js.map +1 -1
- package/dist/next/captureRoute.d.ts +28 -0
- package/dist/next/captureRoute.js +67 -0
- package/dist/next/captureRoute.js.map +1 -0
- package/dist/next/ingestRoute.d.ts +17 -0
- package/dist/next/ingestRoute.js +17 -0
- package/dist/next/ingestRoute.js.map +1 -0
- package/dist/next/posthogProxyRewrites.d.ts +3 -25
- package/dist/next/posthogProxyRewrites.js +5 -37
- package/dist/next/posthogProxyRewrites.js.map +1 -1
- package/dist/plugin/adminDependencies.js +34 -0
- package/dist/plugin/adminDependencies.js.map +1 -0
- package/dist/plugin/apiPath.js +23 -0
- package/dist/plugin/apiPath.js.map +1 -0
- package/dist/plugin/boundDocument.js +58 -0
- package/dist/plugin/boundDocument.js.map +1 -0
- package/dist/plugin/buildPhase.js +10 -0
- package/dist/plugin/buildPhase.js.map +1 -0
- package/dist/plugin/collectionChecks.js +232 -0
- package/dist/plugin/collectionChecks.js.map +1 -0
- package/dist/plugin/collectionFields.d.ts +13 -0
- package/dist/plugin/collectionFields.js +22 -0
- package/dist/plugin/collectionFields.js.map +1 -0
- package/dist/plugin/createRuntime.js +339 -0
- package/dist/plugin/createRuntime.js.map +1 -0
- package/dist/plugin/destroy.js +58 -0
- package/dist/plugin/destroy.js.map +1 -0
- package/dist/plugin/documentEndpoint.js +77 -53
- package/dist/plugin/documentEndpoint.js.map +1 -1
- package/dist/plugin/documentScopes.js +37 -0
- package/dist/plugin/documentScopes.js.map +1 -0
- package/dist/plugin/encrypted.js +25 -0
- package/dist/plugin/encrypted.js.map +1 -0
- package/dist/plugin/errors.d.ts +5 -12
- package/dist/plugin/errors.js +23 -16
- package/dist/plugin/errors.js.map +1 -1
- package/dist/plugin/flagsEndpoint.js +41 -0
- package/dist/plugin/flagsEndpoint.js.map +1 -0
- package/dist/plugin/goalHint.js +22 -11
- package/dist/plugin/goalHint.js.map +1 -1
- package/dist/plugin/itemLabels.js +114 -0
- package/dist/plugin/itemLabels.js.map +1 -0
- package/dist/plugin/jobsAccess.js +91 -0
- package/dist/plugin/jobsAccess.js.map +1 -0
- package/dist/plugin/keepAlive.js +48 -0
- package/dist/plugin/keepAlive.js.map +1 -0
- package/dist/plugin/peerImportError.js +3 -6
- package/dist/plugin/peerImportError.js.map +1 -1
- package/dist/plugin/peers.js +64 -0
- package/dist/plugin/peers.js.map +1 -0
- package/dist/plugin/pluginCollections.js +161 -0
- package/dist/plugin/pluginCollections.js.map +1 -0
- package/dist/plugin/queryEndpoint.js +70 -45
- package/dist/plugin/queryEndpoint.js.map +1 -1
- package/dist/plugin/queryParams.js +7 -0
- package/dist/plugin/queryParams.js.map +1 -0
- package/dist/plugin/readContextForRequest.d.ts +11 -0
- package/dist/plugin/readContextForRequest.js +70 -25
- package/dist/plugin/readContextForRequest.js.map +1 -1
- package/dist/plugin/readFailure.js +22 -0
- package/dist/plugin/readFailure.js.map +1 -0
- package/dist/plugin/readableProviders.js +64 -0
- package/dist/plugin/readableProviders.js.map +1 -0
- package/dist/plugin/realtimeEndpoint.js +77 -25
- package/dist/plugin/realtimeEndpoint.js.map +1 -1
- package/dist/plugin/refreshEndpoint.js +69 -44
- package/dist/plugin/refreshEndpoint.js.map +1 -1
- package/dist/plugin/relabelFields.js +36 -0
- package/dist/plugin/relabelFields.js.map +1 -0
- package/dist/plugin/requestMemo.js +35 -0
- package/dist/plugin/requestMemo.js.map +1 -0
- package/dist/plugin/routeChecks.js +39 -0
- package/dist/plugin/routeChecks.js.map +1 -0
- package/dist/plugin/routes.d.ts +53 -0
- package/dist/plugin/routes.js +92 -0
- package/dist/plugin/routes.js.map +1 -0
- package/dist/plugin/runtime.d.ts +1 -1
- package/dist/plugin/runtime.js +234 -30
- package/dist/plugin/runtime.js.map +1 -1
- package/dist/plugin/schemaOnly.js +63 -0
- package/dist/plugin/schemaOnly.js.map +1 -0
- package/dist/plugin/scopeChange.js +6 -5
- package/dist/plugin/scopeChange.js.map +1 -1
- package/dist/plugin/scopeFieldBoot.js +4 -4
- package/dist/plugin/scopeFieldBoot.js.map +1 -1
- package/dist/plugin/scopeToken.js +33 -0
- package/dist/plugin/scopeToken.js.map +1 -0
- package/dist/plugin/sourcesEndpoint.js +50 -17
- package/dist/plugin/sourcesEndpoint.js.map +1 -1
- package/dist/plugin/unbundledLanguages.js +25 -0
- package/dist/plugin/unbundledLanguages.js.map +1 -0
- package/dist/plugin/walkFields.js +22 -0
- package/dist/plugin/walkFields.js.map +1 -0
- package/dist/plugin/warmTask.js +0 -0
- package/dist/plugin/warmTask.js.map +1 -1
- package/dist/providers/ProvidersListNotice.d.ts +11 -0
- package/dist/providers/ProvidersListNotice.js +36 -0
- package/dist/providers/ProvidersListNotice.js.map +1 -0
- package/dist/providers/access.d.ts +1 -0
- package/dist/providers/access.js +35 -26
- package/dist/providers/access.js.map +1 -1
- package/dist/providers/adapterPool.js +121 -0
- package/dist/providers/adapterPool.js.map +1 -0
- package/dist/providers/collection.d.ts +61 -0
- package/dist/providers/collection.js +340 -151
- package/dist/providers/collection.js.map +1 -1
- package/dist/providers/factory.d.ts +76 -0
- package/dist/providers/factory.js +75 -25
- package/dist/providers/factory.js.map +1 -1
- package/dist/providers/hosts.d.ts +25 -0
- package/dist/providers/hosts.js +128 -0
- package/dist/providers/hosts.js.map +1 -0
- package/dist/providers/probe.d.ts +1 -0
- package/dist/providers/probe.js +105 -0
- package/dist/providers/probe.js.map +1 -0
- package/dist/providers/refresh.d.ts +18 -0
- package/dist/providers/refresh.js +49 -0
- package/dist/providers/refresh.js.map +1 -0
- package/dist/providers/registry.js +328 -0
- package/dist/providers/registry.js.map +1 -0
- package/dist/providers/resolver.js +26 -88
- package/dist/providers/resolver.js.map +1 -1
- package/dist/providers/retarget.js +45 -0
- package/dist/providers/retarget.js.map +1 -0
- package/dist/providers/scopeUnique.js +41 -0
- package/dist/providers/scopeUnique.js.map +1 -0
- package/dist/providers/secrets.d.ts +26 -0
- package/dist/providers/secrets.js +61 -4
- package/dist/providers/secrets.js.map +1 -1
- package/dist/providers/stampScope.js +9 -6
- package/dist/providers/stampScope.js.map +1 -1
- package/dist/query/dates.js +10 -12
- package/dist/query/dates.js.map +1 -1
- package/dist/query/errors.d.ts +1 -5
- package/dist/query/fetchQuery.d.ts +25 -32
- package/dist/query/fetchQuery.js +91 -91
- package/dist/query/fetchQuery.js.map +1 -1
- package/dist/query/limits.js +8 -0
- package/dist/query/limits.js.map +1 -0
- package/dist/query/parse.d.ts +6 -0
- package/dist/query/parse.js +153 -106
- package/dist/query/parse.js.map +1 -1
- package/dist/query/response.d.ts +23 -3
- package/dist/query/response.js +12 -5
- package/dist/query/response.js.map +1 -1
- package/dist/react/AnalyticsProvider.d.ts +26 -17
- package/dist/react/AnalyticsProvider.js +23 -22
- package/dist/react/AnalyticsProvider.js.map +1 -1
- package/dist/react/TrackerBoot.js +15 -9
- package/dist/react/TrackerBoot.js.map +1 -1
- package/dist/react/useAnalytics.d.ts +2 -11
- package/dist/react/useAnalytics.js +22 -24
- package/dist/react/useAnalytics.js.map +1 -1
- package/dist/site/AnalyticsScripts.d.ts +34 -0
- package/dist/site/AnalyticsScripts.js +30 -0
- package/dist/site/AnalyticsScripts.js.map +1 -0
- package/dist/site/getTrackerConfig.d.ts +15 -0
- package/dist/site/getTrackerConfig.js +40 -0
- package/dist/site/getTrackerConfig.js.map +1 -0
- package/dist/surfacing/afterRead.d.ts +37 -0
- package/dist/surfacing/bounded.js +38 -0
- package/dist/surfacing/bounded.js.map +1 -0
- package/dist/surfacing/breaker.js +107 -0
- package/dist/surfacing/breaker.js.map +1 -0
- package/dist/surfacing/cacheCollection.d.ts +8 -0
- package/dist/surfacing/cacheCollection.js +69 -0
- package/dist/surfacing/cacheCollection.js.map +1 -0
- package/dist/surfacing/cacheStore.d.ts +71 -1
- package/dist/surfacing/cacheStore.js +16 -37
- package/dist/surfacing/cacheStore.js.map +1 -1
- package/dist/surfacing/cacheSweep.d.ts +1 -0
- package/dist/surfacing/cacheSweep.js +59 -0
- package/dist/surfacing/cacheSweep.js.map +1 -0
- package/dist/surfacing/classifyError.js +282 -0
- package/dist/surfacing/classifyError.js.map +1 -0
- package/dist/surfacing/coalesce.js +2 -1
- package/dist/surfacing/coalesce.js.map +1 -1
- package/dist/surfacing/coldBudget.js +60 -0
- package/dist/surfacing/coldBudget.js.map +1 -0
- package/dist/surfacing/collectionCacheStore.js +183 -0
- package/dist/surfacing/collectionCacheStore.js.map +1 -0
- package/dist/surfacing/engine.d.ts +1 -1
- package/dist/surfacing/engine.js +514 -72
- package/dist/surfacing/engine.js.map +1 -1
- package/dist/surfacing/epoch.js +70 -26
- package/dist/surfacing/epoch.js.map +1 -1
- package/dist/surfacing/lanes.d.ts +1 -0
- package/dist/surfacing/lanes.js +297 -0
- package/dist/surfacing/lanes.js.map +1 -0
- package/dist/surfacing/memo.js +40 -0
- package/dist/surfacing/memo.js.map +1 -0
- package/dist/surfacing/rateLimiter.d.ts +1 -0
- package/dist/surfacing/rateLimiter.js +69 -94
- package/dist/surfacing/rateLimiter.js.map +1 -1
- package/dist/surfacing/rebucket.js +178 -0
- package/dist/surfacing/rebucket.js.map +1 -0
- package/dist/surfacing/recipe.js +28 -0
- package/dist/surfacing/recipe.js.map +1 -0
- package/dist/surfacing/shape.js +22 -0
- package/dist/surfacing/shape.js.map +1 -0
- package/dist/surfacing/todaySplit.js +113 -0
- package/dist/surfacing/todaySplit.js.map +1 -0
- package/dist/sync/collection.d.ts +8 -0
- package/dist/sync/collection.js +28 -18
- package/dist/sync/collection.js.map +1 -1
- package/dist/sync/rekeyDurations.js +70 -0
- package/dist/sync/rekeyDurations.js.map +1 -0
- package/dist/sync/syncTask.js +226 -109
- package/dist/sync/syncTask.js.map +1 -1
- package/dist/testing/memoryAdapter.d.ts +6 -3
- package/dist/testing/memoryAdapter.js +12 -10
- package/dist/testing/memoryAdapter.js.map +1 -1
- package/dist/testing/settle.d.ts +11 -0
- package/dist/testing/settle.js +19 -0
- package/dist/testing/settle.js.map +1 -0
- package/dist/timeframe/calendar.js +65 -0
- package/dist/timeframe/calendar.js.map +1 -0
- package/dist/timeframe/comparison.js +46 -0
- package/dist/timeframe/comparison.js.map +1 -0
- package/dist/timeframe/presets.d.ts +1 -1
- package/dist/timeframe/presets.js +5 -5
- package/dist/timeframe/presets.js.map +1 -1
- package/dist/timeframe/reportingTimezone.d.ts +1 -0
- package/dist/timeframe/reportingTimezone.js +64 -0
- package/dist/timeframe/reportingTimezone.js.map +1 -0
- package/dist/timeframe/tz.js +55 -39
- package/dist/timeframe/tz.js.map +1 -1
- package/dist/tracker/autoCapture.js +125 -38
- package/dist/tracker/autoCapture.js.map +1 -1
- package/dist/tracker/campaign.js +52 -0
- package/dist/tracker/campaign.js.map +1 -0
- package/dist/tracker/config.d.ts +149 -0
- package/dist/tracker/config.js +25 -0
- package/dist/tracker/config.js.map +1 -0
- package/dist/tracker/createTracker.d.ts +4 -10
- package/dist/tracker/createTracker.js +386 -115
- package/dist/tracker/createTracker.js.map +1 -1
- package/dist/tracker/digest.js +28 -0
- package/dist/tracker/digest.js.map +1 -0
- package/dist/tracker/engagement.js +100 -0
- package/dist/tracker/engagement.js.map +1 -0
- package/dist/tracker/events.js +37 -0
- package/dist/tracker/events.js.map +1 -0
- package/dist/tracker/exclusion.d.ts +2 -22
- package/dist/tracker/exclusion.js +53 -21
- package/dist/tracker/exclusion.js.map +1 -1
- package/dist/tracker/gate.js +194 -0
- package/dist/tracker/gate.js.map +1 -0
- package/dist/tracker/initTracker.d.ts +5 -8
- package/dist/tracker/initTracker.js +42 -14
- package/dist/tracker/initTracker.js.map +1 -1
- package/dist/tracker/itemCapture.js +224 -0
- package/dist/tracker/itemCapture.js.map +1 -0
- package/dist/tracker/loadScript.js +21 -14
- package/dist/tracker/loadScript.js.map +1 -1
- package/dist/tracker/pageTracking.js +6 -6
- package/dist/tracker/pageTracking.js.map +1 -1
- package/dist/tracker/registry.js +118 -30
- package/dist/tracker/registry.js.map +1 -1
- package/dist/tracker/sinks/createSink.js +41 -0
- package/dist/tracker/sinks/createSink.js.map +1 -0
- package/dist/tracker/sinks/ga4.js +64 -20
- package/dist/tracker/sinks/ga4.js.map +1 -1
- package/dist/tracker/sinks/native.js +7 -42
- package/dist/tracker/sinks/native.js.map +1 -1
- package/dist/tracker/sinks/plausible.js +27 -22
- package/dist/tracker/sinks/plausible.js.map +1 -1
- package/dist/tracker/sinks/posthog.js +54 -22
- package/dist/tracker/sinks/posthog.js.map +1 -1
- package/dist/tracker/sinks/umami.js +14 -12
- package/dist/tracker/sinks/umami.js.map +1 -1
- package/dist/tracker/sinks/vendor.js +30 -27
- package/dist/tracker/sinks/vendor.js.map +1 -1
- package/dist/tracker/skip.js +81 -0
- package/dist/tracker/skip.js.map +1 -0
- package/dist/tracker/storage.js +23 -0
- package/dist/tracker/storage.js.map +1 -0
- package/dist/tracker/transport.js +2 -5
- package/dist/tracker/transport.js.map +1 -1
- package/dist/tracker/types.d.ts +86 -63
- package/dist/tracker/window.js +7 -0
- package/dist/tracker/window.js.map +1 -0
- package/dist/translations/ar.js +232 -71
- package/dist/translations/ar.js.map +1 -1
- package/dist/translations/de.js +221 -69
- package/dist/translations/de.js.map +1 -1
- package/dist/translations/en.js +215 -67
- package/dist/translations/en.js.map +1 -1
- package/dist/translations/es.js +223 -68
- package/dist/translations/es.js.map +1 -1
- package/dist/translations/fr.js +227 -72
- package/dist/translations/fr.js.map +1 -1
- package/dist/translations/id.js +218 -67
- package/dist/translations/id.js.map +1 -1
- package/dist/translations/index.d.ts +1 -1
- package/dist/translations/index.js +5 -7
- package/dist/translations/index.js.map +1 -1
- package/dist/translations/intl.js +71 -0
- package/dist/translations/intl.js.map +1 -0
- package/dist/translations/keys.d.ts +191 -14
- package/dist/translations/keys.js +196 -14
- package/dist/translations/keys.js.map +1 -1
- package/dist/translations/ko.js +220 -69
- package/dist/translations/ko.js.map +1 -1
- package/dist/translations/labelMap.d.ts +10 -0
- package/dist/translations/labelMap.js +22 -0
- package/dist/translations/labelMap.js.map +1 -0
- package/dist/translations/metricKeys.js +10 -2
- package/dist/translations/metricKeys.js.map +1 -1
- package/dist/translations/parts.js +20 -0
- package/dist/translations/parts.js.map +1 -0
- package/dist/translations/plural.js +61 -0
- package/dist/translations/plural.js.map +1 -0
- package/dist/translations/pt.js +232 -77
- package/dist/translations/pt.js.map +1 -1
- package/dist/translations/ru.js +223 -66
- package/dist/translations/ru.js.map +1 -1
- package/dist/translations/server.d.ts +1 -0
- package/dist/translations/server.js +2 -3
- package/dist/translations/server.js.map +1 -1
- package/dist/translations/staticLabel.js +69 -0
- package/dist/translations/staticLabel.js.map +1 -0
- package/dist/translations/uk.js +223 -66
- package/dist/translations/uk.js.map +1 -1
- package/dist/translations/zh.js +218 -67
- package/dist/translations/zh.js.map +1 -1
- package/dist/ui/RangePicker.js +112 -0
- package/dist/ui/RangePicker.js.map +1 -0
- package/dist/ui/analytics.css +1533 -0
- package/dist/ui/calendarDays.js +27 -0
- package/dist/ui/calendarDays.js.map +1 -0
- package/dist/ui/classNames.js +7 -0
- package/dist/ui/classNames.js.map +1 -0
- package/dist/ui/components/Card.d.ts +28 -0
- package/dist/ui/components/Card.js +21 -0
- package/dist/ui/components/Card.js.map +1 -0
- package/dist/ui/components/ChartDataTable.d.ts +41 -0
- package/dist/ui/components/ChartDataTable.js +48 -0
- package/dist/ui/components/ChartDataTable.js.map +1 -0
- package/dist/ui/components/DataTable.d.ts +82 -0
- package/dist/ui/components/DataTable.js +214 -0
- package/dist/ui/components/DataTable.js.map +1 -0
- package/dist/ui/components/LabeledSelect.js +62 -0
- package/dist/ui/components/LabeledSelect.js.map +1 -0
- package/dist/ui/components/LiveAnnouncement.js +21 -0
- package/dist/ui/components/LiveAnnouncement.js.map +1 -0
- package/dist/ui/components/MetricCard.d.ts +38 -0
- package/dist/ui/components/MetricCard.js +39 -0
- package/dist/ui/components/MetricCard.js.map +1 -0
- package/dist/ui/components/NoValue.js +22 -0
- package/dist/ui/components/NoValue.js.map +1 -0
- package/dist/ui/components/ReadState.js +27 -0
- package/dist/ui/components/ReadState.js.map +1 -0
- package/dist/ui/components/RefreshButton.js +26 -0
- package/dist/ui/components/RefreshButton.js.map +1 -0
- package/dist/ui/components/SourcesNoticeBanner.js +20 -0
- package/dist/ui/components/SourcesNoticeBanner.js.map +1 -0
- package/dist/ui/cssVars.js +7 -0
- package/dist/ui/cssVars.js.map +1 -0
- package/dist/ui/data/WithScopeToken.d.ts +20 -0
- package/dist/ui/data/WithScopeToken.js +20 -0
- package/dist/ui/data/WithScopeToken.js.map +1 -0
- package/dist/ui/data/clientFieldProps.js +16 -0
- package/dist/ui/data/clientFieldProps.js.map +1 -0
- package/dist/ui/data/request.d.ts +46 -0
- package/dist/ui/data/request.js +119 -0
- package/dist/ui/data/request.js.map +1 -0
- package/dist/ui/data/scopeTokenContext.js +18 -0
- package/dist/ui/data/scopeTokenContext.js.map +1 -0
- package/dist/ui/data/sharedCache.js +48 -0
- package/dist/ui/data/sharedCache.js.map +1 -0
- package/dist/ui/data/useRequest.d.ts +19 -0
- package/dist/ui/data/useRequest.js +123 -0
- package/dist/ui/data/useRequest.js.map +1 -0
- package/dist/ui/data/useRequestScope.js +25 -0
- package/dist/ui/data/useRequestScope.js.map +1 -0
- package/dist/ui/hooks/useDirection.js +47 -0
- package/dist/ui/hooks/useDirection.js.map +1 -0
- package/dist/ui/hooks/useDismissOnEscape.js +25 -0
- package/dist/ui/hooks/useDismissOnEscape.js.map +1 -0
- package/dist/ui/hooks/useLiveAnnouncement.js +57 -0
- package/dist/ui/hooks/useLiveAnnouncement.js.map +1 -0
- package/dist/ui/hooks/useRealtimePoll.js +112 -0
- package/dist/ui/hooks/useRealtimePoll.js.map +1 -0
- package/dist/ui/readState.js +19 -0
- package/dist/ui/readState.js.map +1 -0
- package/dist/ui/rows/toDisplayRows.js +49 -0
- package/dist/ui/rows/toDisplayRows.js.map +1 -0
- package/dist/ui/viewerClock.js +7 -0
- package/dist/ui/viewerClock.js.map +1 -0
- package/dist/view/AnalyticsNavLink.d.ts +5 -3
- package/dist/view/AnalyticsNavLink.js +11 -6
- package/dist/view/AnalyticsNavLink.js.map +1 -1
- package/dist/view/AnalyticsView.d.ts +8 -10
- package/dist/view/AnalyticsView.js +47 -18
- package/dist/view/AnalyticsView.js.map +1 -1
- package/dist/view/AnalyticsViewClient.d.ts +4 -7
- package/dist/view/AnalyticsViewClient.js +15 -229
- package/dist/view/AnalyticsViewClient.js.map +1 -1
- package/dist/view/CountryFlag.d.ts +27 -0
- package/dist/view/CountryFlag.js +44 -0
- package/dist/view/CountryFlag.js.map +1 -0
- package/dist/view/DocumentTitle.js +27 -0
- package/dist/view/DocumentTitle.js.map +1 -0
- package/dist/view/ViewRoot.d.ts +21 -0
- package/dist/view/ViewRoot.js +152 -0
- package/dist/view/ViewRoot.js.map +1 -0
- package/dist/view/ViewSections.d.ts +38 -0
- package/dist/view/ViewSections.js +190 -0
- package/dist/view/ViewSections.js.map +1 -0
- package/dist/view/authRedirect.js +2 -4
- package/dist/view/authRedirect.js.map +1 -1
- package/dist/view/conversionRate.js +9 -7
- package/dist/view/conversionRate.js.map +1 -1
- package/dist/view/dayRange.js +6 -10
- package/dist/view/dayRange.js.map +1 -1
- package/dist/view/exclusionLink.d.ts +27 -0
- package/dist/view/exclusionLink.js +46 -0
- package/dist/view/exclusionLink.js.map +1 -0
- package/dist/view/flagSrc.js +14 -0
- package/dist/view/flagSrc.js.map +1 -0
- package/dist/view/gating.d.ts +15 -1
- package/dist/view/gating.js +66 -31
- package/dist/view/gating.js.map +1 -1
- package/dist/view/hostCountryFlag.js +41 -0
- package/dist/view/hostCountryFlag.js.map +1 -0
- package/dist/view/labels.js +95 -10
- package/dist/view/labels.js.map +1 -1
- package/dist/view/metricAliases.js +10 -0
- package/dist/view/metricAliases.js.map +1 -0
- package/dist/view/navLabel.js +15 -0
- package/dist/view/navLabel.js.map +1 -0
- package/dist/view/registerView.js +13 -11
- package/dist/view/registerView.js.map +1 -1
- package/dist/view/scopeLabel.js +21 -0
- package/dist/view/scopeLabel.js.map +1 -0
- package/dist/view/sections/Breakdowns.js +196 -134
- package/dist/view/sections/Breakdowns.js.map +1 -1
- package/dist/view/sections/EmptyStates.js +118 -30
- package/dist/view/sections/EmptyStates.js.map +1 -1
- package/dist/view/sections/ExcludeBrowser.js +188 -0
- package/dist/view/sections/ExcludeBrowser.js.map +1 -0
- package/dist/view/sections/FilterChips.js +124 -27
- package/dist/view/sections/FilterChips.js.map +1 -1
- package/dist/view/sections/GoalsPanel.js +68 -60
- package/dist/view/sections/GoalsPanel.js.map +1 -1
- package/dist/view/sections/OverviewCards.js +29 -33
- package/dist/view/sections/OverviewCards.js.map +1 -1
- package/dist/view/sections/RealtimeStrip.js +70 -59
- package/dist/view/sections/RealtimeStrip.js.map +1 -1
- package/dist/view/sections/SectionBoundary.js +34 -0
- package/dist/view/sections/SectionBoundary.js.map +1 -0
- package/dist/view/sections/Toolbar.d.ts +11 -0
- package/dist/view/sections/Toolbar.js +123 -82
- package/dist/view/sections/Toolbar.js.map +1 -1
- package/dist/view/sections/Trend.js +176 -76
- package/dist/view/sections/Trend.js.map +1 -1
- package/dist/view/state.d.ts +42 -0
- package/dist/view/state.js +93 -54
- package/dist/view/state.js.map +1 -1
- package/dist/view/useViewClock.js +31 -0
- package/dist/view/useViewClock.js.map +1 -0
- package/dist/view/useViewQueries.d.ts +21 -0
- package/dist/view/useViewQueries.js +45 -77
- package/dist/view/useViewQueries.js.map +1 -1
- package/dist/view/useViewState.js +42 -0
- package/dist/view/useViewState.js.map +1 -0
- package/dist/view/useViewUrl.js +47 -0
- package/dist/view/useViewUrl.js.map +1 -0
- package/dist/view/viewBody.js +30 -0
- package/dist/view/viewBody.js.map +1 -0
- package/dist/view/viewContext.d.ts +81 -0
- package/dist/view/viewContext.js +49 -0
- package/dist/view/viewContext.js.map +1 -0
- package/dist/view/viewProps.d.ts +65 -8
- package/dist/view/viewProps.js +123 -36
- package/dist/view/viewProps.js.map +1 -1
- package/dist/widgets/AnalyticsBreakdownWidget.d.ts +7 -3
- package/dist/widgets/AnalyticsBreakdownWidget.js +144 -118
- package/dist/widgets/AnalyticsBreakdownWidget.js.map +1 -1
- package/dist/widgets/AnalyticsGoalsWidget.d.ts +6 -7
- package/dist/widgets/AnalyticsGoalsWidget.js +125 -167
- package/dist/widgets/AnalyticsGoalsWidget.js.map +1 -1
- package/dist/widgets/AnalyticsMetricWidget.d.ts +7 -3
- package/dist/widgets/AnalyticsMetricWidget.js +81 -106
- package/dist/widgets/AnalyticsMetricWidget.js.map +1 -1
- package/dist/widgets/AnalyticsRealtimeWidget.d.ts +7 -3
- package/dist/widgets/AnalyticsRealtimeWidget.js +81 -63
- package/dist/widgets/AnalyticsRealtimeWidget.js.map +1 -1
- package/dist/widgets/AnalyticsTrendWidget.d.ts +7 -3
- package/dist/widgets/AnalyticsTrendWidget.js +130 -123
- package/dist/widgets/AnalyticsTrendWidget.js.map +1 -1
- package/dist/widgets/ComparisonDelta.js +33 -42
- package/dist/widgets/ComparisonDelta.js.map +1 -1
- package/dist/widgets/RealtimeCounter.d.ts +24 -4
- package/dist/widgets/RealtimeCounter.js +91 -77
- package/dist/widgets/RealtimeCounter.js.map +1 -1
- package/dist/widgets/WidgetCard.d.ts +80 -0
- package/dist/widgets/WidgetCard.js +99 -0
- package/dist/widgets/WidgetCard.js.map +1 -0
- package/dist/widgets/WidgetFrame.js +42 -0
- package/dist/widgets/WidgetFrame.js.map +1 -0
- package/dist/widgets/WidgetShimmer.d.ts +55 -0
- package/dist/widgets/WidgetShimmer.js +86 -0
- package/dist/widgets/WidgetShimmer.js.map +1 -0
- package/dist/widgets/breakdownTypes.js +12 -2
- package/dist/widgets/breakdownTypes.js.map +1 -1
- package/dist/widgets/customWidget.d.ts +5 -1
- package/dist/widgets/customWidget.js +6 -7
- package/dist/widgets/customWidget.js.map +1 -1
- package/dist/widgets/defaultLayout.d.ts +26 -0
- package/dist/widgets/defaultLayout.js +51 -0
- package/dist/widgets/defaultLayout.js.map +1 -0
- package/dist/widgets/defaults.d.ts +4 -7
- package/dist/widgets/defaults.js +4 -7
- package/dist/widgets/defaults.js.map +1 -1
- package/dist/widgets/fieldRows.js +14 -0
- package/dist/widgets/fieldRows.js.map +1 -0
- package/dist/widgets/filterCaption.js +6 -7
- package/dist/widgets/filterCaption.js.map +1 -1
- package/dist/widgets/filterField.d.ts +3 -7
- package/dist/widgets/filterField.js +46 -35
- package/dist/widgets/filterField.js.map +1 -1
- package/dist/widgets/filterValueLabel.d.ts +1 -0
- package/dist/widgets/filterValueLabel.js +45 -0
- package/dist/widgets/filterValueLabel.js.map +1 -0
- package/dist/widgets/notices.js +74 -0
- package/dist/widgets/notices.js.map +1 -0
- package/dist/widgets/prepareWidgetRead.d.ts +19 -2
- package/dist/widgets/prepareWidgetRead.js +63 -27
- package/dist/widgets/prepareWidgetRead.js.map +1 -1
- package/dist/widgets/range.js +26 -21
- package/dist/widgets/range.js.map +1 -1
- package/dist/widgets/readForWidget.d.ts +28 -19
- package/dist/widgets/readForWidget.js +33 -29
- package/dist/widgets/readForWidget.js.map +1 -1
- package/dist/widgets/readForWidgetBreakdown.d.ts +40 -29
- package/dist/widgets/readForWidgetBreakdown.js +48 -22
- package/dist/widgets/readForWidgetBreakdown.js.map +1 -1
- package/dist/widgets/readForWidgetGoals.d.ts +18 -24
- package/dist/widgets/readForWidgetGoals.js +52 -46
- package/dist/widgets/readForWidgetGoals.js.map +1 -1
- package/dist/widgets/readForWidgetRealtime.d.ts +22 -17
- package/dist/widgets/readForWidgetRealtime.js +54 -28
- package/dist/widgets/readForWidgetRealtime.js.map +1 -1
- package/dist/widgets/readForWidgetSeries.d.ts +27 -32
- package/dist/widgets/readForWidgetSeries.js +45 -82
- package/dist/widgets/readForWidgetSeries.js.map +1 -1
- package/dist/widgets/readMeta.d.ts +44 -0
- package/dist/widgets/readMeta.js +47 -4
- package/dist/widgets/readMeta.js.map +1 -1
- package/dist/widgets/realtimePoll.d.ts +1 -0
- package/dist/widgets/realtimePoll.js +53 -25
- package/dist/widgets/realtimePoll.js.map +1 -1
- package/dist/widgets/registerWidgets.js +207 -127
- package/dist/widgets/registerWidgets.js.map +1 -1
- package/dist/widgets/stateKeys.js +30 -0
- package/dist/widgets/stateKeys.js.map +1 -0
- package/dist/widgets/titleForecast.js +89 -0
- package/dist/widgets/titleForecast.js.map +1 -0
- package/dist/widgets/types.d.ts +4 -3
- package/dist/widgets/types.js +2 -0
- package/dist/widgets/types.js.map +1 -1
- package/dist/widgets/viewLink.d.ts +24 -6
- package/dist/widgets/viewLink.js +31 -24
- package/dist/widgets/viewLink.js.map +1 -1
- package/dist/widgets/widgetData.js +34 -0
- package/dist/widgets/widgetData.js.map +1 -0
- package/dist/widgets/widgetWindow.d.ts +1 -0
- package/dist/widgets/widgetWindow.js +51 -0
- package/dist/widgets/widgetWindow.js.map +1 -0
- package/package.json +44 -22
- package/dist/adapters/ga4/disableKey.d.ts +0 -9
- package/dist/capture/getTrackerConfig.d.ts +0 -20
- package/dist/capture/getTrackerConfig.js +0 -31
- package/dist/capture/getTrackerConfig.js.map +0 -1
- package/dist/capture/slots.d.ts +0 -8
- package/dist/capture/trackerConfig.d.ts +0 -33
- package/dist/charts/styles.js +0 -59
- package/dist/charts/styles.js.map +0 -1
- package/dist/fields/config/SourceSelectField.d.ts +0 -14
- package/dist/fields/dateRange/styles.js +0 -23
- package/dist/fields/dateRange/styles.js.map +0 -1
- package/dist/goals/GoalSelectField.d.ts +0 -7
- package/dist/native/collections/events.js +0 -165
- package/dist/native/collections/events.js.map +0 -1
- package/dist/native/collections/rollups.js +0 -151
- package/dist/native/collections/rollups.js.map +0 -1
- package/dist/native/collections/seen.js +0 -47
- package/dist/native/collections/seen.js.map +0 -1
- package/dist/native/eventScan.js +0 -25
- package/dist/native/eventScan.js.map +0 -1
- package/dist/native/ingest/flushBatch.js +0 -60
- package/dist/native/ingest/flushBatch.js.map +0 -1
- package/dist/native/ingest/salt.js +0 -39
- package/dist/native/ingest/salt.js.map +0 -1
- package/dist/native/ingest/writeBuffer.js +0 -55
- package/dist/native/ingest/writeBuffer.js.map +0 -1
- package/dist/native/ingest/writeEvent.js +0 -14
- package/dist/native/ingest/writeEvent.js.map +0 -1
- package/dist/native/query/eventAgg.js +0 -175
- package/dist/native/query/eventAgg.js.map +0 -1
- package/dist/native/realtime/buildRealtime.js +0 -53
- package/dist/native/realtime/buildRealtime.js.map +0 -1
- package/dist/native/retention/pruneTask.js +0 -69
- package/dist/native/retention/pruneTask.js.map +0 -1
- package/dist/native/rollupAcc.js +0 -64
- package/dist/native/rollupAcc.js.map +0 -1
- package/dist/native/rollups/bucketKey.js +0 -15
- package/dist/native/rollups/bucketKey.js.map +0 -1
- package/dist/native/rollups/bumpRollups.js +0 -116
- package/dist/native/rollups/bumpRollups.js.map +0 -1
- package/dist/native/rollups/deltas.js +0 -106
- package/dist/native/rollups/deltas.js.map +0 -1
- package/dist/native/rollups/insertManyIfNew.js +0 -93
- package/dist/native/rollups/insertManyIfNew.js.map +0 -1
- package/dist/plugin/paths.js +0 -29
- package/dist/plugin/paths.js.map +0 -1
- package/dist/react/TrackerBoot.d.ts +0 -22
- package/dist/rsc/AnalyticsScripts.d.ts +0 -30
- package/dist/rsc/AnalyticsScripts.js +0 -41
- package/dist/rsc/AnalyticsScripts.js.map +0 -1
- package/dist/surfacing/queue.js +0 -60
- package/dist/surfacing/queue.js.map +0 -1
- package/dist/surfacing/retryPolicy.js +0 -15
- package/dist/surfacing/retryPolicy.js.map +0 -1
- package/dist/tracker/autoCapture.d.ts +0 -48
- package/dist/tracker/consent.d.ts +0 -24
- package/dist/tracker/consent.js +0 -48
- package/dist/tracker/consent.js.map +0 -1
- package/dist/tracker/loadScript.d.ts +0 -14
- package/dist/tracker/pageTracking.d.ts +0 -17
- package/dist/tracker/registry.d.ts +0 -27
- package/dist/tracker/sinks/ga4.d.ts +0 -29
- package/dist/tracker/sinks/native.d.ts +0 -22
- package/dist/tracker/sinks/plausible.d.ts +0 -20
- package/dist/tracker/sinks/posthog.d.ts +0 -18
- package/dist/tracker/sinks/umami.d.ts +0 -18
- package/dist/tracker/sinks/vendor.d.ts +0 -14
- package/dist/view/sections/styles.js +0 -76
- package/dist/view/sections/styles.js.map +0 -1
- package/dist/widgets/WidgetViewLink.js +0 -17
- package/dist/widgets/WidgetViewLink.js.map +0 -1
- package/dist/widgets/cardChrome.d.ts +0 -8
- package/dist/widgets/cardChrome.js +0 -46
- package/dist/widgets/cardChrome.js.map +0 -1
- package/dist/widgets/comparison.js +0 -57
- package/dist/widgets/comparison.js.map +0 -1
package/dist/core/contract.d.ts
CHANGED
|
@@ -1,24 +1,37 @@
|
|
|
1
|
+
import { CurrencyConverter } from "../goals/currency.js";
|
|
1
2
|
import { Goal } from "../goals/types.js";
|
|
3
|
+
import { BrowserAmounts, OrderSignatureMode } from "../goals/match.js";
|
|
4
|
+
import { TrustedPlatform } from "../net/platform.js";
|
|
5
|
+
import { RoutePaths } from "../plugin/routes.js";
|
|
2
6
|
import { CaptureSupport } from "./capture.js";
|
|
7
|
+
import { AdapterJobs, AnalyticsTaskName, ScheduledTask } from "./jobs.js";
|
|
8
|
+
import { AnalyticsSdks } from "./sdks.js";
|
|
3
9
|
import { IngestHostnameResolver, ServerTrack } from "./serverEvent.js";
|
|
4
|
-
import { Config, PayloadRequest } from "payload";
|
|
10
|
+
import { Config, Payload, PayloadRequest } from "payload";
|
|
5
11
|
|
|
6
12
|
//#region src/core/contract.d.ts
|
|
7
13
|
/**
|
|
8
14
|
* Explicit cross-scope read marker: pass as a read's `scope` to aggregate over every
|
|
9
|
-
* scope. Gated by `access.
|
|
15
|
+
* scope. Gated by `access.crossScope.aggregate`; the query reaches the adapter unscoped.
|
|
10
16
|
*/
|
|
11
17
|
declare const PLATFORM_SCOPE = "*";
|
|
12
|
-
type MetricKey = 'pageviews' | 'visitors' | 'visits' | 'sessions' | 'bounceRate' | 'avgDuration' | 'scrollDepth' | 'events' | 'conversions' | 'revenue';
|
|
13
|
-
/**
|
|
14
|
-
|
|
18
|
+
type MetricKey = 'pageviews' | 'visitors' | 'visits' | 'sessions' | 'bounceRate' /** Time on page: engaged time per pageview, an average in milliseconds over the pageviews it is read for. */ | 'avgDuration' /** Time per visit: engaged time per visit, an average in milliseconds over the visits it is read for. */ | 'visitDuration' | 'scrollDepth' | 'events' | 'conversions' | 'revenue' /** Times a content item was seen on screen. Counted per item only, never per page or site. */ | 'impressions' /** Clicks on a content item, the first per item and pageview. */ | 'interactions';
|
|
19
|
+
/**
|
|
20
|
+
* One metric's reading. `null` is an average or a share with nothing to average over (no
|
|
21
|
+
* pageviews to time, no scroll reported, no sessions to bounce): no data, not zero.
|
|
22
|
+
*/
|
|
23
|
+
type MetricValue = number | null;
|
|
24
|
+
/** A row's or a read's metrics. A metric the source did not report is absent. */
|
|
25
|
+
type MetricValues = Partial<Record<MetricKey, MetricValue>>;
|
|
26
|
+
/** Every breakdown key the contract defines, the list request parsers validate against. */
|
|
27
|
+
declare const DIMENSION_KEYS: readonly ["page", "referrer", "source", "channel", "medium", "campaign", "utmSource", "utmMedium", "utmCampaign", "utmContent", "utmTerm", "device", "browser", "os", "country", "region", "city", "language", "event", "goal", "currency", "item"];
|
|
15
28
|
type DimensionKey = (typeof DIMENSION_KEYS)[number];
|
|
16
29
|
type Granularity = 'minute' | 'hour' | 'day' | 'week' | 'month';
|
|
17
30
|
interface DateRange {
|
|
18
31
|
start: Date;
|
|
19
32
|
end: Date;
|
|
20
33
|
}
|
|
21
|
-
/** Every filter operator the contract defines
|
|
34
|
+
/** Every filter operator the contract defines, the list request parsers validate against. */
|
|
22
35
|
declare const FILTER_OPERATORS: readonly ["eq", "contains", "matches"];
|
|
23
36
|
type FilterOperator = (typeof FILTER_OPERATORS)[number];
|
|
24
37
|
interface AnalyticsFilter {
|
|
@@ -29,86 +42,176 @@ interface AnalyticsFilter {
|
|
|
29
42
|
interface AnalyticsQuery {
|
|
30
43
|
path?: string;
|
|
31
44
|
hostname?: string;
|
|
45
|
+
/**
|
|
46
|
+
* One content item's ref (`<collection>:<id>`): the read answers about that item, wherever
|
|
47
|
+
* it was shown. Only a source declaring `capabilities.perItemQuery` can serve it.
|
|
48
|
+
*/
|
|
49
|
+
item?: string;
|
|
32
50
|
metrics: MetricKey[];
|
|
33
51
|
dimensions?: DimensionKey[];
|
|
34
52
|
dateRange: DateRange;
|
|
35
53
|
granularity?: Granularity;
|
|
36
54
|
filters?: AnalyticsFilter[];
|
|
37
55
|
limit?: number;
|
|
56
|
+
/**
|
|
57
|
+
* How a breakdown is ranked before `limit` cuts it. The metric belongs in `metrics`: ranked by
|
|
58
|
+
* one the read did not ask for, rows keep the source's order.
|
|
59
|
+
*/
|
|
38
60
|
order?: {
|
|
39
61
|
metric: MetricKey;
|
|
40
62
|
direction: 'asc' | 'desc';
|
|
41
63
|
};
|
|
42
64
|
/**
|
|
43
|
-
* Analytics boundary
|
|
44
|
-
*
|
|
45
|
-
* ignore it. Always part of the surfacing cache key, so per-scope adapter
|
|
46
|
-
* instances sharing an id never share cached results.
|
|
65
|
+
* Analytics boundary of the read (tenant id, site key); undefined means install-wide. Adapters
|
|
66
|
+
* that can filter by scope apply it, and it is always part of the cache key.
|
|
47
67
|
*/
|
|
48
68
|
scope?: string;
|
|
49
69
|
/**
|
|
50
|
-
* IANA
|
|
51
|
-
*
|
|
52
|
-
* others report in their own account timezone. Part of the cache key when set.
|
|
70
|
+
* IANA timezone the read's day boundaries align to; undefined means UTC. Adapters that can bucket
|
|
71
|
+
* in a zone apply it, others report in their account's own.
|
|
53
72
|
*/
|
|
54
73
|
timezone?: string;
|
|
55
74
|
/**
|
|
56
|
-
* The scope's goal slugs,
|
|
57
|
-
* `
|
|
58
|
-
* adapters restrict goal rows to it, since nothing in a provider marks which of its
|
|
59
|
-
* events are this install's goals; the native engine ignores it and matches completions
|
|
60
|
-
* itself. `'unresolved'` is the sentinel for a goal resolver that failed: the read keeps
|
|
61
|
-
* its site numbers, reports `goalsUnresolved`, and never shares a healthy cache key.
|
|
62
|
-
* Part of the surfacing cache key when set.
|
|
75
|
+
* The scope's goal slugs, which provider adapters restrict goal rows to (native matches goals
|
|
76
|
+
* itself). `'unresolved'` marks a failed goal resolver and never shares a healthy cache key.
|
|
63
77
|
*/
|
|
64
78
|
goalSlugs?: string[] | 'unresolved';
|
|
65
79
|
}
|
|
66
80
|
interface AnalyticsRow {
|
|
67
81
|
dimensions?: Partial<Record<DimensionKey, string>>;
|
|
68
|
-
metrics:
|
|
82
|
+
metrics: MetricValues;
|
|
69
83
|
timestamp?: string;
|
|
84
|
+
/**
|
|
85
|
+
* How many observations each average in `metrics` was taken over, which folds days into weeks
|
|
86
|
+
* exactly. An average without one is weighted by its row's matching count.
|
|
87
|
+
*/
|
|
88
|
+
samples?: Partial<Record<MetricKey, number>>;
|
|
70
89
|
}
|
|
90
|
+
/** How a read's `visitors` were counted. */
|
|
91
|
+
type VisitorCounting = 'distinct' | 'sumOfDaily';
|
|
92
|
+
/** Why a stale answer's source needs a look: its settings were refused, or its host is not allowed. */
|
|
93
|
+
type SourceErrorKind = 'misconfigured' | 'host-refused';
|
|
71
94
|
interface AnalyticsResult {
|
|
72
95
|
rows: AnalyticsRow[];
|
|
73
|
-
totals?:
|
|
96
|
+
totals?: MetricValues;
|
|
74
97
|
meta: {
|
|
75
|
-
provider: string;
|
|
76
|
-
sampled?: boolean;
|
|
77
|
-
clamped?: boolean;
|
|
78
|
-
|
|
98
|
+
provider: string; /** The source counted from a sample of its data (GA4 on a large property), so the numbers are estimates. */
|
|
99
|
+
sampled?: boolean; /** The read covers less than it asked for: from `dataFrom` and up to `dataTo`, where set. */
|
|
100
|
+
clamped?: boolean; /** ISO instant the data starts at, set with `clamped` when later than the range's start. */
|
|
101
|
+
dataFrom?: string;
|
|
102
|
+
/**
|
|
103
|
+
* ISO instant the data ends at, set with `clamped` when earlier than the range's end: a day
|
|
104
|
+
* the range cuts lies past raw retention in a scope's own zone.
|
|
105
|
+
*/
|
|
106
|
+
dataTo?: string;
|
|
107
|
+
/**
|
|
108
|
+
* `distinct` counts each person once per number; `sumOfDaily` means some number adds up daily
|
|
109
|
+
* visitors, so a person who came on two days counts twice.
|
|
110
|
+
*/
|
|
111
|
+
visitorsAre?: VisitorCounting; /** Some days of the range could not be read yet, so the numbers are a floor. */
|
|
112
|
+
partial?: {
|
|
113
|
+
missingDays: number;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* On this many days of the range a value the read asks about was folded into the `(other)`
|
|
117
|
+
* row of its daily totals, and its raw hits are no longer kept: the numbers are a floor.
|
|
118
|
+
*/
|
|
119
|
+
capped?: {
|
|
120
|
+
days: number;
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* On this many days of the range counting failed again and again and was given up: each is
|
|
124
|
+
* read from an earlier count when it had one, and left out otherwise.
|
|
125
|
+
*/
|
|
126
|
+
failed?: {
|
|
127
|
+
days: number;
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* The scope's reporting timezone could not be resolved and none was ever recorded, so this
|
|
131
|
+
* read cut its days in UTC and counted nothing for later reads.
|
|
132
|
+
*/
|
|
133
|
+
timezoneUnresolved?: true; /** ISO instant the numbers were last brought up to date, when older than `fetchedAt`. */
|
|
134
|
+
asOf?: string;
|
|
135
|
+
/**
|
|
136
|
+
* ISO instant the source was read (`ctx.now`), never later than the engine got the answer; a
|
|
137
|
+
* cached answer keeps it.
|
|
138
|
+
*/
|
|
139
|
+
fetchedAt: string;
|
|
140
|
+
/**
|
|
141
|
+
* ISO 4217 code `revenue` is reported in: the vendor's own, else the install's
|
|
142
|
+
* `revenue.currency` or the read's `currency` filter. Absent, revenue is a plain sum as sent.
|
|
143
|
+
*/
|
|
144
|
+
currency?: string;
|
|
145
|
+
/**
|
|
146
|
+
* The currencies the read's revenue adds unconverted amounts of, when more than one. Native
|
|
147
|
+
* sets it.
|
|
148
|
+
*/
|
|
149
|
+
mixedCurrencies?: string[];
|
|
150
|
+
/**
|
|
151
|
+
* Served from a cache entry past its TTL: at once while a refresh runs, or because the refresh
|
|
152
|
+
* failed. `asOf` then says when the entry was fetched.
|
|
153
|
+
*/
|
|
79
154
|
stale?: boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Set on a stale answer whose source last failed as set up rather than as an outage:
|
|
157
|
+
* credentials refused (`misconfigured`) or host not allowed (`host-refused`).
|
|
158
|
+
*/
|
|
159
|
+
sourceError?: SourceErrorKind;
|
|
80
160
|
/**
|
|
81
161
|
* Filters the source could not carry, so the rows are wider than the query asked for.
|
|
82
162
|
* A provider whose API takes one value per dimension reports the ones it dropped here.
|
|
83
163
|
*/
|
|
84
164
|
unappliedFilters?: AnalyticsFilter[];
|
|
85
165
|
/**
|
|
86
|
-
* The read's goal numbers are absent because resolving them failed
|
|
87
|
-
*
|
|
88
|
-
* request and the rest of the read was served without it. A scope that configured no
|
|
89
|
-
* goals is an empty result instead, not this flag.
|
|
166
|
+
* The read's goal numbers are absent because resolving them failed. A scope with no goals gets
|
|
167
|
+
* an empty result instead, not this flag.
|
|
90
168
|
*/
|
|
91
169
|
goalsUnresolved?: true;
|
|
92
170
|
};
|
|
93
171
|
}
|
|
94
172
|
/**
|
|
95
|
-
*
|
|
96
|
-
*
|
|
173
|
+
* The vendor's limits the source's lane keeps to, one token per upstream request per window. A read
|
|
174
|
+
* with conversions may cost a second, goal-filtered request.
|
|
97
175
|
*/
|
|
98
176
|
interface RateLimitDescriptor {
|
|
99
177
|
requestsPerMinute?: number;
|
|
100
178
|
requestsPerHour?: number;
|
|
179
|
+
/** Upstream requests the source may have in flight; `cache.concurrency.perSource` when unset. */
|
|
101
180
|
maxConcurrent?: number;
|
|
181
|
+
/** Whether reads also spend the provider's write or ingest quota. */
|
|
182
|
+
readsCountAsUsage?: boolean;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Which operators each dimension can be filtered with. A dimension absent here, or listed with
|
|
186
|
+
* no operator, cannot be filtered at all.
|
|
187
|
+
*/
|
|
188
|
+
type FilterOperatorMap = Partial<Record<DimensionKey, readonly FilterOperator[]>>;
|
|
189
|
+
/** Where a source reads one metric, when it cannot read it under every breakdown it offers. */
|
|
190
|
+
interface MetricReach {
|
|
102
191
|
/**
|
|
103
|
-
*
|
|
104
|
-
*
|
|
192
|
+
* The breakdowns the metric is read under; empty when only whole-site numbers carry it.
|
|
193
|
+
* Absent: every dimension the source declares.
|
|
105
194
|
*/
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
|
|
195
|
+
dimensions?: readonly DimensionKey[];
|
|
196
|
+
/**
|
|
197
|
+
* A dimension the read must break down or filter by for the metric to have a value at all.
|
|
198
|
+
* A read of one page (`AnalyticsQuery.path`) counts as filtering by `page`.
|
|
199
|
+
*/
|
|
200
|
+
requires?: DimensionKey;
|
|
201
|
+
}
|
|
202
|
+
/** What the numbers of a source mean where sources differ. */
|
|
203
|
+
interface MetricSemantics {
|
|
204
|
+
/**
|
|
205
|
+
* `distinct` counts each person once over a range; `sumOfDaily` adds up each day's visitors.
|
|
206
|
+
* Either may be per hostname: native's visitor id is, so two hostnames add up.
|
|
207
|
+
*/
|
|
208
|
+
visitors: VisitorCounting;
|
|
209
|
+
/** `inactivity30m` ends a visit after 30 minutes without activity; `provider` is the vendor's own rule. */
|
|
210
|
+
sessions: 'inactivity30m' | 'provider';
|
|
109
211
|
}
|
|
110
212
|
interface AnalyticsCapabilities {
|
|
111
|
-
|
|
213
|
+
/** The source answers `AnalyticsQuery.item`: one content item's views, clicks and outcomes. */
|
|
214
|
+
perItemQuery?: boolean;
|
|
112
215
|
realtime: boolean;
|
|
113
216
|
realtimeWindowMinutes?: number;
|
|
114
217
|
/**
|
|
@@ -117,61 +220,181 @@ interface AnalyticsCapabilities {
|
|
|
117
220
|
*/
|
|
118
221
|
comparison?: boolean;
|
|
119
222
|
minGranularity: Granularity;
|
|
223
|
+
/**
|
|
224
|
+
* The source answers `week` and `month` series itself, exactly. Without it the engine reads
|
|
225
|
+
* days and folds them into weeks and months in the read's reporting timezone.
|
|
226
|
+
*/
|
|
227
|
+
calendarBuckets?: boolean;
|
|
120
228
|
maxLookbackDays: number | null;
|
|
229
|
+
/**
|
|
230
|
+
* How far back a filtered read reaches, when that is shorter than `maxLookbackDays`: the
|
|
231
|
+
* source narrows a longer one itself and marks it `clamped`. Absent or null: as far as any read.
|
|
232
|
+
*/
|
|
233
|
+
filterLookbackDays?: number | null;
|
|
121
234
|
metrics: ReadonlySet<MetricKey>;
|
|
122
235
|
dimensions: ReadonlySet<DimensionKey>;
|
|
123
|
-
/**
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
236
|
+
/**
|
|
237
|
+
* Metrics the source reads only under some breakdowns or only for a page; any other is read under
|
|
238
|
+
* every dimension. Reads outside a metric's reach are refused and hidden by pickers.
|
|
239
|
+
*/
|
|
240
|
+
metricReach?: Partial<Record<MetricKey, MetricReach>>;
|
|
241
|
+
/**
|
|
242
|
+
* The `AnalyticsQuery.filters` the source applies, per dimension. A read carrying any other
|
|
243
|
+
* pair is refused before it reaches the adapter. Absent: no filter at all.
|
|
244
|
+
*/
|
|
245
|
+
filters?: FilterOperatorMap;
|
|
246
|
+
/** What `visitors` and `sessions` mean here. Absent: not declared. */
|
|
247
|
+
semantics?: MetricSemantics;
|
|
128
248
|
rateLimit: RateLimitDescriptor | null;
|
|
249
|
+
/**
|
|
250
|
+
* Seconds an answer stays fresh. `today`, for a source cheap to read again, caps a window that
|
|
251
|
+
* reaches into the current day whatever `cache.ttl` says; such an answer is never served stale.
|
|
252
|
+
*/
|
|
129
253
|
recommendedTtl: {
|
|
130
254
|
realtime: number;
|
|
131
255
|
aggregate: number;
|
|
256
|
+
today?: number;
|
|
132
257
|
};
|
|
133
258
|
/**
|
|
134
|
-
* The adapter applies `AnalyticsQuery.scope` as a
|
|
135
|
-
*
|
|
136
|
-
* a shared platform adapter would expose cross-scope data, so such reads are
|
|
137
|
-
* gated by `access.platformRead`.
|
|
259
|
+
* The adapter applies `AnalyticsQuery.scope` as a native filter. Without it a scoped read through
|
|
260
|
+
* a shared adapter would see other scopes, so it is gated by `access.crossScope.unscopedSource`.
|
|
138
261
|
*/
|
|
139
262
|
scopedQueries?: boolean;
|
|
263
|
+
/**
|
|
264
|
+
* The adapter sends every vendor request through `AdapterContext.upstream`, so each one spends
|
|
265
|
+
* its own rate token and slot. Without it the engine counts a whole read as one request.
|
|
266
|
+
*/
|
|
267
|
+
upstreamAware?: boolean;
|
|
140
268
|
}
|
|
141
269
|
interface AdapterContext {
|
|
142
270
|
signal?: AbortSignal;
|
|
271
|
+
/**
|
|
272
|
+
* The Payload instance the read is for, which the surfacing engine always passes. An adapter
|
|
273
|
+
* that stores its data in Payload's database reads through it.
|
|
274
|
+
*/
|
|
275
|
+
payload?: Payload;
|
|
276
|
+
/**
|
|
277
|
+
* Sends one vendor request through the source's lane: rate token, slot, retries on outage,
|
|
278
|
+
* circuit breaker. Absent outside the engine, where `fn(ctx.signal)` is called directly.
|
|
279
|
+
*/
|
|
280
|
+
upstream?: <T>(fn: (signal?: AbortSignal) => Promise<T>) => Promise<T>;
|
|
281
|
+
/**
|
|
282
|
+
* Milliseconds the read has left before it gives up, for a vendor SDK that takes a deadline of
|
|
283
|
+
* its own rather than a signal. Absent outside the engine.
|
|
284
|
+
*/
|
|
285
|
+
remainingMs?: () => number;
|
|
286
|
+
/**
|
|
287
|
+
* What time it is by the plugin's clock (Payload's), which an adapter stamps `meta.fetchedAt`
|
|
288
|
+
* with. The engine always passes it; absent outside the engine.
|
|
289
|
+
*/
|
|
290
|
+
now?: () => Date;
|
|
143
291
|
}
|
|
144
292
|
/** Extra context the plugin hands adapters when they register config surface. */
|
|
145
293
|
interface AdapterRegisterContext {
|
|
146
|
-
/** True when the plugin has
|
|
294
|
+
/** True when the plugin has `scope.resolve` configured. */
|
|
147
295
|
scoped: boolean;
|
|
148
|
-
/**
|
|
296
|
+
/**
|
|
297
|
+
* `scope.resolve` at the `capture` call site, for ingest stamping: the host's resolver sees no
|
|
298
|
+
* user, cookies or authorization header, so a hit files under the site it landed on.
|
|
299
|
+
*/
|
|
149
300
|
resolveScope: (req: PayloadRequest) => Promise<string | null>;
|
|
150
301
|
/**
|
|
151
|
-
* The plugin's reportingTimezone bound for adapter use
|
|
152
|
-
*
|
|
302
|
+
* The plugin's reportingTimezone bound for adapter use, for what is shown in it. Resolves to
|
|
303
|
+
* `'UTC'` when no reportingTimezone is set, and when the host's resolver fails.
|
|
153
304
|
*/
|
|
154
305
|
resolveTimezone: (req: PayloadRequest, scope?: string | null) => Promise<string>;
|
|
155
306
|
/**
|
|
156
|
-
* The
|
|
157
|
-
*
|
|
158
|
-
|
|
307
|
+
* The same timezone, thrown rather than falling back to UTC: for an adapter storing days counted
|
|
308
|
+
* in it, where recounting a day in UTC would move its numbers.
|
|
309
|
+
*/
|
|
310
|
+
resolveTimezoneStrict: (req: PayloadRequest, scope?: string | null) => Promise<string>;
|
|
311
|
+
/** The install's `revenue` settings, for adapters that declare or reconcile revenue. */
|
|
312
|
+
revenue: {
|
|
313
|
+
enabled: boolean;
|
|
314
|
+
dimension: boolean; /** `revenue.currency` bound for adapter use: `undefined` when none is set, revenue a plain number. */
|
|
315
|
+
currency: (req: PayloadRequest, scope?: string | null) => Promise<string | undefined>; /** `revenue.convert`, for adapters that reconcile revenue at ingest. */
|
|
316
|
+
convert?: CurrencyConverter; /** `revenue.browserAmounts`, for an adapter that takes amounts from the browser itself. */
|
|
317
|
+
browserAmounts?: BrowserAmounts; /** `revenue.orderSignature`, for an adapter that takes the browser's order ids. */
|
|
318
|
+
orderSignature?: OrderSignatureMode;
|
|
319
|
+
};
|
|
320
|
+
/**
|
|
321
|
+
* The install's goals for a request's scope (config goals, the collection's merged over them),
|
|
322
|
+
* for adapters that match completions themselves.
|
|
159
323
|
*/
|
|
160
324
|
resolveGoals: (req: PayloadRequest, scope?: string | null) => Promise<Goal[]>;
|
|
325
|
+
/**
|
|
326
|
+
* Whether a scope's own provider documents grant it this adapter; present only when the providers
|
|
327
|
+
* collection runs under `scope.resolve`. Native ingest stores nothing for a scope it denies.
|
|
328
|
+
*/
|
|
329
|
+
adapterGrantedForScope?: (req: PayloadRequest, scope: string | null, adapterId: string) => Promise<boolean>;
|
|
161
330
|
/** The plugin's `trustedProxyHops`, for adapters that read a request's client address. */
|
|
162
331
|
trustedProxyHops?: number;
|
|
332
|
+
/**
|
|
333
|
+
* The plugin's `trustedPlatform`, for adapters that read a request's client address or
|
|
334
|
+
* location: the only platform whose edge headers may be believed.
|
|
335
|
+
*/
|
|
336
|
+
trustedPlatform?: TrustedPlatform;
|
|
337
|
+
/**
|
|
338
|
+
* `capture.allowedOrigins`, normalized, for adapters that register a public POST endpoint: the
|
|
339
|
+
* only other sites whose pages may send to it from a visitor's browser.
|
|
340
|
+
*/
|
|
341
|
+
allowedOrigins?: ReadonlySet<string>;
|
|
342
|
+
/**
|
|
343
|
+
* The collections bound as content items, the only ones whose refs ingest keeps, and whether
|
|
344
|
+
* an item is also counted per page it appeared on. Absent means no item is bound.
|
|
345
|
+
*/
|
|
346
|
+
items?: {
|
|
347
|
+
collections: ReadonlySet<string>;
|
|
348
|
+
pages: boolean;
|
|
349
|
+
};
|
|
350
|
+
/** The plugin's mounts under `routes.api`, for adapters that register an endpoint of their own. */
|
|
351
|
+
routes?: RoutePaths;
|
|
352
|
+
/**
|
|
353
|
+
* The packages the host handed the plugin as `sdks`, for adapters that would otherwise load
|
|
354
|
+
* them at runtime: GA4's Data API client, the native engine's MaxMind reader.
|
|
355
|
+
*/
|
|
356
|
+
sdks?: AnalyticsSdks;
|
|
357
|
+
/**
|
|
358
|
+
* The plugin's `jobs`: the queue and schedule of the maintenance task an adapter registers, or
|
|
359
|
+
* false when the install registers no task and the adapter's own requests do that work instead.
|
|
360
|
+
*/
|
|
361
|
+
jobs?: AdapterJobs;
|
|
362
|
+
/**
|
|
363
|
+
* The host's `jobs.enableConcurrencyControl`: only then may a task an adapter registers carry a
|
|
364
|
+
* concurrency key, which Payload refuses otherwise.
|
|
365
|
+
*/
|
|
366
|
+
jobsConcurrency?: boolean;
|
|
367
|
+
/** Says something at init, once the instance can log: what the boot warns about rather than refuses. */
|
|
368
|
+
notice?: (message: string) => void;
|
|
369
|
+
}
|
|
370
|
+
/** What a switched-off install hands an adapter that keeps its schema (`disabled: true`). */
|
|
371
|
+
interface AdapterSchemaContext {
|
|
372
|
+
/** The plugin's `jobs`, which decides whether the adapter's task slug is in the jobs enum. */
|
|
373
|
+
jobs: AdapterJobs;
|
|
374
|
+
/** What the boot would warn about, which a switched-off install never says. */
|
|
375
|
+
notice?: (message: string) => void;
|
|
376
|
+
}
|
|
377
|
+
/** Whom a source's label is read for: the request, and the scope its sources were listed for. */
|
|
378
|
+
interface AdapterLabelArgs {
|
|
379
|
+
req: PayloadRequest;
|
|
380
|
+
/** Null is install-wide, `*` is cross-scope. */
|
|
381
|
+
scope: string | null;
|
|
163
382
|
}
|
|
164
383
|
interface AnalyticsAdapter {
|
|
165
384
|
readonly id: string;
|
|
385
|
+
/** The source's name wherever no reader is known (boot-time pickers, logs). */
|
|
166
386
|
readonly label: string;
|
|
387
|
+
/**
|
|
388
|
+
* The source's name for one reader, where it differs by language or by who reads. Read through
|
|
389
|
+
* `sourceLabelFor`, which falls back to `label` when this fails.
|
|
390
|
+
*/
|
|
391
|
+
readonly labelFor?: (args: AdapterLabelArgs) => string | Promise<string>;
|
|
167
392
|
readonly capabilities: AnalyticsCapabilities;
|
|
168
393
|
/** Browser-tracker proxying/boot descriptor. Absent when no public capture field is set. */
|
|
169
394
|
readonly capture?: CaptureSupport;
|
|
170
395
|
/**
|
|
171
|
-
* Where
|
|
172
|
-
*
|
|
173
|
-
* pipeline without an HTTP round trip. Server-side only: the tracker learns the path
|
|
174
|
-
* from `TrackerConfig.ingestPath`, and this object is never serialized.
|
|
396
|
+
* Where the adapter's own ingest endpoint listens, relative to `routes.api`, and how server code
|
|
397
|
+
* reaches that pipeline directly. Server-side only, never serialized.
|
|
175
398
|
*/
|
|
176
399
|
readonly ingest?: {
|
|
177
400
|
path: string;
|
|
@@ -182,8 +405,23 @@ interface AnalyticsAdapter {
|
|
|
182
405
|
query(query: AnalyticsQuery, ctx: AdapterContext): Promise<AnalyticsResult>;
|
|
183
406
|
realtime?(query: AnalyticsQuery, ctx: AdapterContext): Promise<AnalyticsResult>;
|
|
184
407
|
register?(config: Config, context?: AdapterRegisterContext): void;
|
|
408
|
+
/**
|
|
409
|
+
* For `disabled: true`: adds exactly the schema `register` would (collections, fields, indexes,
|
|
410
|
+
* task slugs) and nothing that runs, so a switched-off install keeps its tables.
|
|
411
|
+
*/
|
|
412
|
+
registerSchema?(config: Config, context: AdapterSchemaContext): void;
|
|
413
|
+
/**
|
|
414
|
+
* Binds the adapter to the Payload instance a runtime is built for, whenever one is, with or
|
|
415
|
+
* without `onInit`. Called again for every rebuild, so it must be idempotent per instance.
|
|
416
|
+
*/
|
|
417
|
+
attach?(payload: Payload): void;
|
|
418
|
+
/**
|
|
419
|
+
* Releases what the adapter holds for one instance (buffers, clients, timers) once that
|
|
420
|
+
* instance's runtime is retired; another instance the adapter serves keeps what it holds.
|
|
421
|
+
*/
|
|
422
|
+
close?(payload: Payload): void | Promise<void>;
|
|
185
423
|
}
|
|
186
424
|
type AnalyticsAdapterFactory<Config> = (config: Config) => AnalyticsAdapter;
|
|
187
425
|
//#endregion
|
|
188
|
-
export { AdapterContext, AdapterRegisterContext, AnalyticsAdapter, AnalyticsAdapterFactory, AnalyticsCapabilities, AnalyticsFilter, AnalyticsQuery, AnalyticsResult, AnalyticsRow, DIMENSION_KEYS, DateRange, DimensionKey, FILTER_OPERATORS, FilterOperator, Granularity, MetricKey, PLATFORM_SCOPE, RateLimitDescriptor };
|
|
426
|
+
export { AdapterContext, AdapterLabelArgs, AdapterRegisterContext, AdapterSchemaContext, AnalyticsAdapter, AnalyticsAdapterFactory, AnalyticsCapabilities, AnalyticsFilter, AnalyticsQuery, AnalyticsResult, AnalyticsRow, DIMENSION_KEYS, DateRange, DimensionKey, FILTER_OPERATORS, FilterOperator, FilterOperatorMap, Granularity, MetricKey, MetricReach, MetricSemantics, MetricValue, MetricValues, PLATFORM_SCOPE, RateLimitDescriptor, SourceErrorKind, VisitorCounting };
|
|
189
427
|
//# sourceMappingURL=contract.d.ts.map
|
package/dist/core/contract.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
//#region src/core/contract.ts
|
|
2
2
|
/**
|
|
3
3
|
* Explicit cross-scope read marker: pass as a read's `scope` to aggregate over every
|
|
4
|
-
* scope. Gated by `access.
|
|
4
|
+
* scope. Gated by `access.crossScope.aggregate`; the query reaches the adapter unscoped.
|
|
5
5
|
*/
|
|
6
6
|
const PLATFORM_SCOPE = "*";
|
|
7
|
-
/** Every breakdown key the contract defines
|
|
7
|
+
/** Every breakdown key the contract defines, the list request parsers validate against. */
|
|
8
8
|
const DIMENSION_KEYS = [
|
|
9
9
|
"page",
|
|
10
10
|
"referrer",
|
|
@@ -25,9 +25,11 @@ const DIMENSION_KEYS = [
|
|
|
25
25
|
"city",
|
|
26
26
|
"language",
|
|
27
27
|
"event",
|
|
28
|
-
"goal"
|
|
28
|
+
"goal",
|
|
29
|
+
"currency",
|
|
30
|
+
"item"
|
|
29
31
|
];
|
|
30
|
-
/** Every filter operator the contract defines
|
|
32
|
+
/** Every filter operator the contract defines, the list request parsers validate against. */
|
|
31
33
|
const FILTER_OPERATORS = [
|
|
32
34
|
"eq",
|
|
33
35
|
"contains",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.js","names":[],"sources":["../../src/core/contract.ts"],"sourcesContent":["import type { Config, PayloadRequest } from 'payload'\nimport type { Goal } from '../goals/types'\nimport type { CaptureSupport } from './capture'\nimport type { IngestHostnameResolver, ServerTrack } from './serverEvent'\n\n/**\n * Explicit cross-scope read marker: pass as a read's `scope` to aggregate over every\n * scope. Gated by `access.platformRead`; the query reaches the adapter unscoped.\n */\nexport const PLATFORM_SCOPE = '*'\n\nexport type MetricKey =\n\t| 'pageviews'\n\t| 'visitors'\n\t| 'visits'\n\t| 'sessions'\n\t| 'bounceRate'\n\t| 'avgDuration'\n\t| 'scrollDepth'\n\t| 'events'\n\t| 'conversions'\n\t| 'revenue'\n\n/** Every breakdown key the contract defines; the registry request parsers validate against. */\nexport const DIMENSION_KEYS = [\n\t'page',\n\t'referrer',\n\t'source',\n\t'channel',\n\t'medium',\n\t'campaign',\n\t'utmSource',\n\t'utmMedium',\n\t'utmCampaign',\n\t'utmContent',\n\t'utmTerm',\n\t'device',\n\t'browser',\n\t'os',\n\t'country',\n\t'region',\n\t'city',\n\t'language',\n\t'event',\n\t'goal',\n] as const\n\nexport type DimensionKey = (typeof DIMENSION_KEYS)[number]\n\nexport type Granularity = 'minute' | 'hour' | 'day' | 'week' | 'month'\n\nexport interface DateRange {\n\tstart: Date\n\tend: Date\n}\n\n/** Every filter operator the contract defines; the registry request parsers validate against. */\nexport const FILTER_OPERATORS = ['eq', 'contains', 'matches'] as const\n\nexport type FilterOperator = (typeof FILTER_OPERATORS)[number]\n\nexport interface AnalyticsFilter {\n\tdimension: DimensionKey\n\toperator: FilterOperator\n\tvalue: string\n}\n\nexport interface AnalyticsQuery {\n\tpath?: string\n\thostname?: string\n\tmetrics: MetricKey[]\n\tdimensions?: DimensionKey[]\n\tdateRange: DateRange\n\tgranularity?: Granularity\n\tfilters?: AnalyticsFilter[]\n\tlimit?: number\n\torder?: { metric: MetricKey; direction: 'asc' | 'desc' }\n\t/**\n\t * Analytics boundary this read belongs to (tenant id, site key). Undefined means\n\t * install-wide (the default). Adapters that can filter by scope apply it; others\n\t * ignore it. Always part of the surfacing cache key, so per-scope adapter\n\t * instances sharing an id never share cached results.\n\t */\n\tscope?: string\n\t/**\n\t * IANA reporting timezone the read's day boundaries are aligned to. Undefined\n\t * means UTC. Adapters that can bucket in a timezone apply it (PostHog, Umami);\n\t * others report in their own account timezone. Part of the cache key when set.\n\t */\n\ttimezone?: string\n\t/**\n\t * The scope's goal slugs, set by callers that ask for the `goal` dimension or the\n\t * `conversions` metric, and possibly empty when the scope configures no goals. Provider\n\t * adapters restrict goal rows to it, since nothing in a provider marks which of its\n\t * events are this install's goals; the native engine ignores it and matches completions\n\t * itself. `'unresolved'` is the sentinel for a goal resolver that failed: the read keeps\n\t * its site numbers, reports `goalsUnresolved`, and never shares a healthy cache key.\n\t * Part of the surfacing cache key when set.\n\t */\n\tgoalSlugs?: string[] | 'unresolved'\n}\n\nexport interface AnalyticsRow {\n\tdimensions?: Partial<Record<DimensionKey, string>>\n\tmetrics: Partial<Record<MetricKey, number>>\n\ttimestamp?: string\n}\n\nexport interface AnalyticsResult {\n\trows: AnalyticsRow[]\n\ttotals?: Partial<Record<MetricKey, number>>\n\tmeta: {\n\t\tprovider: string\n\t\tsampled?: boolean\n\t\tclamped?: boolean\n\t\tfetchedAt: string\n\t\t/** Served from an expired cache entry because the live refresh failed. */\n\t\tstale?: boolean\n\t\t/**\n\t\t * Filters the source could not carry, so the rows are wider than the query asked for.\n\t\t * A provider whose API takes one value per dimension reports the ones it dropped here.\n\t\t */\n\t\tunappliedFilters?: AnalyticsFilter[]\n\t\t/**\n\t\t * The read's goal numbers are absent because resolving them failed: it ran without\n\t\t * `AnalyticsQuery.goalSlugs`, or with `'unresolved'`, or the provider rejected the goal\n\t\t * request and the rest of the read was served without it. A scope that configured no\n\t\t * goals is an empty result instead, not this flag.\n\t\t */\n\t\tgoalsUnresolved?: true\n\t}\n}\n\n/**\n * A read carrying conversions costs a provider up to twice the requests: the goal numbers\n * come from a second, goal-filtered request the adapter issues after the plain one.\n */\nexport interface RateLimitDescriptor {\n\trequestsPerMinute?: number\n\trequestsPerHour?: number\n\tmaxConcurrent?: number\n\t/**\n\t * Describes the provider's quota model for documentation; the limiter always\n\t * throttles by request count regardless of this value.\n\t */\n\tquotaModel?: 'requests' | 'tokens'\n\t/** Documents whether reads consume the provider's write/ingest quota too. */\n\treadsCountAsUsage?: boolean\n}\n\nexport interface AnalyticsCapabilities {\n\tperPageQuery: boolean\n\trealtime: boolean\n\trealtimeWindowMinutes?: number\n\t/**\n\t * Period-over-period comparison, which the engine serves for every source by reading the\n\t * previous window itself. Adapters omit this; set it false only to opt a source out.\n\t */\n\tcomparison?: boolean\n\tminGranularity: Granularity\n\tmaxLookbackDays: number | null\n\tmetrics: ReadonlySet<MetricKey>\n\tdimensions: ReadonlySet<DimensionKey>\n\t/** Dimensions the adapter can apply AnalyticsQuery.filters on; empty = filters unsupported. */\n\tfilters: ReadonlySet<DimensionKey>\n\t/** Operators the adapter honors in filters; adapters ignore filters whose operator they lack. */\n\tfilterOperators: ReadonlySet<FilterOperator>\n\tbatchPageReport: boolean\n\trateLimit: RateLimitDescriptor | null\n\trecommendedTtl: { realtime: number; aggregate: number }\n\t/**\n\t * The adapter applies `AnalyticsQuery.scope` as a provider-native filter (native\n\t * scope column, PostHog `scopeProperty`, ...). Without it, a scoped read through\n\t * a shared platform adapter would expose cross-scope data, so such reads are\n\t * gated by `access.platformRead`.\n\t */\n\tscopedQueries?: boolean\n}\n\nexport interface AdapterContext {\n\tsignal?: AbortSignal\n}\n\n/** Extra context the plugin hands adapters when they register config surface. */\nexport interface AdapterRegisterContext {\n\t/** True when the plugin has a scopeResolver configured. */\n\tscoped: boolean\n\t/** The plugin's scopeResolver bound for adapter use (e.g. ingest stamping). */\n\tresolveScope: (req: PayloadRequest) => Promise<string | null>\n\t/**\n\t * The plugin's reportingTimezone bound for adapter use (e.g. bucketing native\n\t * rollups at ingest). Resolves to `'UTC'` when no reportingTimezone is set.\n\t */\n\tresolveTimezone: (req: PayloadRequest, scope?: string | null) => Promise<string>\n\t/**\n\t * The install's goals for a request's scope, for adapters that match completions\n\t * themselves (the native engine, at ingest). Config goals, with the goals collection\n\t * merged over them per scope once the install enables it.\n\t */\n\tresolveGoals: (req: PayloadRequest, scope?: string | null) => Promise<Goal[]>\n\t/** The plugin's `trustedProxyHops`, for adapters that read a request's client address. */\n\ttrustedProxyHops?: number\n}\n\nexport interface AnalyticsAdapter {\n\treadonly id: string\n\treadonly label: string\n\treadonly capabilities: AnalyticsCapabilities\n\t/** Browser-tracker proxying/boot descriptor. Absent when no public capture field is set. */\n\treadonly capture?: CaptureSupport\n\t/**\n\t * Where this adapter's own ingest endpoint listens, relative to `routes.api`, for the\n\t * adapters that register one (the native engine), and how server code reaches the same\n\t * pipeline without an HTTP round trip. Server-side only: the tracker learns the path\n\t * from `TrackerConfig.ingestPath`, and this object is never serialized.\n\t */\n\treadonly ingest?: { path: string; track?: ServerTrack; hostname?: IngestHostnameResolver }\n\tisConfigured(): boolean\n\tquery(query: AnalyticsQuery, ctx: AdapterContext): Promise<AnalyticsResult>\n\trealtime?(query: AnalyticsQuery, ctx: AdapterContext): Promise<AnalyticsResult>\n\tregister?(config: Config, context?: AdapterRegisterContext): void\n}\n\nexport type AnalyticsAdapterFactory<Config> = (config: Config) => AnalyticsAdapter\n"],"mappings":";;;;;AASA,MAAa,iBAAiB;;AAe9B,MAAa,iBAAiB;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD;;AAYA,MAAa,mBAAmB;CAAC;CAAM;CAAY;AAAS"}
|
|
1
|
+
{"version":3,"file":"contract.js","names":[],"sources":["../../src/core/contract.ts"],"sourcesContent":["import type { Config, Payload, PayloadRequest } from 'payload'\nimport type { CurrencyConverter } from '../goals/currency'\nimport type { BrowserAmounts, OrderSignatureMode } from '../goals/match'\nimport type { Goal } from '../goals/types'\nimport type { TrustedPlatform } from '../net/platform'\nimport type { RoutePaths } from '../plugin/routes'\nimport type { CaptureSupport } from './capture'\nimport type { AdapterJobs } from './jobs'\nimport type { AnalyticsSdks } from './sdks'\nimport type { IngestHostnameResolver, ServerTrack } from './serverEvent'\n\n/**\n * Explicit cross-scope read marker: pass as a read's `scope` to aggregate over every\n * scope. Gated by `access.crossScope.aggregate`; the query reaches the adapter unscoped.\n */\nexport const PLATFORM_SCOPE = '*'\n\nexport type { AdapterJobs, AnalyticsTaskName, ScheduledTask } from './jobs'\n\nexport type MetricKey =\n\t| 'pageviews'\n\t| 'visitors'\n\t| 'visits'\n\t| 'sessions'\n\t| 'bounceRate'\n\t/** Time on page: engaged time per pageview, an average in milliseconds over the pageviews it is read for. */\n\t| 'avgDuration'\n\t/** Time per visit: engaged time per visit, an average in milliseconds over the visits it is read for. */\n\t| 'visitDuration'\n\t| 'scrollDepth'\n\t| 'events'\n\t| 'conversions'\n\t| 'revenue'\n\t/** Times a content item was seen on screen. Counted per item only, never per page or site. */\n\t| 'impressions'\n\t/** Clicks on a content item, the first per item and pageview. */\n\t| 'interactions'\n\n/**\n * One metric's reading. `null` is an average or a share with nothing to average over (no\n * pageviews to time, no scroll reported, no sessions to bounce): no data, not zero.\n */\nexport type MetricValue = number | null\n\n/** A row's or a read's metrics. A metric the source did not report is absent. */\nexport type MetricValues = Partial<Record<MetricKey, MetricValue>>\n\n/** Every breakdown key the contract defines, the list request parsers validate against. */\nexport const DIMENSION_KEYS = [\n\t'page',\n\t'referrer',\n\t'source',\n\t'channel',\n\t'medium',\n\t'campaign',\n\t'utmSource',\n\t'utmMedium',\n\t'utmCampaign',\n\t'utmContent',\n\t'utmTerm',\n\t'device',\n\t'browser',\n\t'os',\n\t'country',\n\t'region',\n\t'city',\n\t'language',\n\t'event',\n\t'goal',\n\t'currency',\n\t'item',\n] as const\n\nexport type DimensionKey = (typeof DIMENSION_KEYS)[number]\n\nexport type Granularity = 'minute' | 'hour' | 'day' | 'week' | 'month'\n\nexport interface DateRange {\n\tstart: Date\n\tend: Date\n}\n\n/** Every filter operator the contract defines, the list request parsers validate against. */\nexport const FILTER_OPERATORS = ['eq', 'contains', 'matches'] as const\n\nexport type FilterOperator = (typeof FILTER_OPERATORS)[number]\n\nexport interface AnalyticsFilter {\n\tdimension: DimensionKey\n\toperator: FilterOperator\n\tvalue: string\n}\n\nexport interface AnalyticsQuery {\n\tpath?: string\n\thostname?: string\n\t/**\n\t * One content item's ref (`<collection>:<id>`): the read answers about that item, wherever\n\t * it was shown. Only a source declaring `capabilities.perItemQuery` can serve it.\n\t */\n\titem?: string\n\tmetrics: MetricKey[]\n\tdimensions?: DimensionKey[]\n\tdateRange: DateRange\n\tgranularity?: Granularity\n\tfilters?: AnalyticsFilter[]\n\tlimit?: number\n\t/**\n\t * How a breakdown is ranked before `limit` cuts it. The metric belongs in `metrics`: ranked by\n\t * one the read did not ask for, rows keep the source's order.\n\t */\n\torder?: { metric: MetricKey; direction: 'asc' | 'desc' }\n\t/**\n\t * Analytics boundary of the read (tenant id, site key); undefined means install-wide. Adapters\n\t * that can filter by scope apply it, and it is always part of the cache key.\n\t */\n\tscope?: string\n\t/**\n\t * IANA timezone the read's day boundaries align to; undefined means UTC. Adapters that can bucket\n\t * in a zone apply it, others report in their account's own.\n\t */\n\ttimezone?: string\n\t/**\n\t * The scope's goal slugs, which provider adapters restrict goal rows to (native matches goals\n\t * itself). `'unresolved'` marks a failed goal resolver and never shares a healthy cache key.\n\t */\n\tgoalSlugs?: string[] | 'unresolved'\n}\n\nexport interface AnalyticsRow {\n\tdimensions?: Partial<Record<DimensionKey, string>>\n\tmetrics: MetricValues\n\ttimestamp?: string\n\t/**\n\t * How many observations each average in `metrics` was taken over, which folds days into weeks\n\t * exactly. An average without one is weighted by its row's matching count.\n\t */\n\tsamples?: Partial<Record<MetricKey, number>>\n}\n\n/** How a read's `visitors` were counted. */\nexport type VisitorCounting = 'distinct' | 'sumOfDaily'\n\n/** Why a stale answer's source needs a look: its settings were refused, or its host is not allowed. */\nexport type SourceErrorKind = 'misconfigured' | 'host-refused'\n\nexport interface AnalyticsResult {\n\trows: AnalyticsRow[]\n\ttotals?: MetricValues\n\tmeta: {\n\t\tprovider: string\n\t\t/** The source counted from a sample of its data (GA4 on a large property), so the numbers are estimates. */\n\t\tsampled?: boolean\n\t\t/** The read covers less than it asked for: from `dataFrom` and up to `dataTo`, where set. */\n\t\tclamped?: boolean\n\t\t/** ISO instant the data starts at, set with `clamped` when later than the range's start. */\n\t\tdataFrom?: string\n\t\t/**\n\t\t * ISO instant the data ends at, set with `clamped` when earlier than the range's end: a day\n\t\t * the range cuts lies past raw retention in a scope's own zone.\n\t\t */\n\t\tdataTo?: string\n\t\t/**\n\t\t * `distinct` counts each person once per number; `sumOfDaily` means some number adds up daily\n\t\t * visitors, so a person who came on two days counts twice.\n\t\t */\n\t\tvisitorsAre?: VisitorCounting\n\t\t/** Some days of the range could not be read yet, so the numbers are a floor. */\n\t\tpartial?: { missingDays: number }\n\t\t/**\n\t\t * On this many days of the range a value the read asks about was folded into the `(other)`\n\t\t * row of its daily totals, and its raw hits are no longer kept: the numbers are a floor.\n\t\t */\n\t\tcapped?: { days: number }\n\t\t/**\n\t\t * On this many days of the range counting failed again and again and was given up: each is\n\t\t * read from an earlier count when it had one, and left out otherwise.\n\t\t */\n\t\tfailed?: { days: number }\n\t\t/**\n\t\t * The scope's reporting timezone could not be resolved and none was ever recorded, so this\n\t\t * read cut its days in UTC and counted nothing for later reads.\n\t\t */\n\t\ttimezoneUnresolved?: true\n\t\t/** ISO instant the numbers were last brought up to date, when older than `fetchedAt`. */\n\t\tasOf?: string\n\t\t/**\n\t\t * ISO instant the source was read (`ctx.now`), never later than the engine got the answer; a\n\t\t * cached answer keeps it.\n\t\t */\n\t\tfetchedAt: string\n\t\t/**\n\t\t * ISO 4217 code `revenue` is reported in: the vendor's own, else the install's\n\t\t * `revenue.currency` or the read's `currency` filter. Absent, revenue is a plain sum as sent.\n\t\t */\n\t\tcurrency?: string\n\t\t/**\n\t\t * The currencies the read's revenue adds unconverted amounts of, when more than one. Native\n\t\t * sets it.\n\t\t */\n\t\tmixedCurrencies?: string[]\n\t\t/**\n\t\t * Served from a cache entry past its TTL: at once while a refresh runs, or because the refresh\n\t\t * failed. `asOf` then says when the entry was fetched.\n\t\t */\n\t\tstale?: boolean\n\t\t/**\n\t\t * Set on a stale answer whose source last failed as set up rather than as an outage:\n\t\t * credentials refused (`misconfigured`) or host not allowed (`host-refused`).\n\t\t */\n\t\tsourceError?: SourceErrorKind\n\t\t/**\n\t\t * Filters the source could not carry, so the rows are wider than the query asked for.\n\t\t * A provider whose API takes one value per dimension reports the ones it dropped here.\n\t\t */\n\t\tunappliedFilters?: AnalyticsFilter[]\n\t\t/**\n\t\t * The read's goal numbers are absent because resolving them failed. A scope with no goals gets\n\t\t * an empty result instead, not this flag.\n\t\t */\n\t\tgoalsUnresolved?: true\n\t}\n}\n\n/**\n * The vendor's limits the source's lane keeps to, one token per upstream request per window. A read\n * with conversions may cost a second, goal-filtered request.\n */\nexport interface RateLimitDescriptor {\n\trequestsPerMinute?: number\n\trequestsPerHour?: number\n\t/** Upstream requests the source may have in flight; `cache.concurrency.perSource` when unset. */\n\tmaxConcurrent?: number\n\t/** Whether reads also spend the provider's write or ingest quota. */\n\treadsCountAsUsage?: boolean\n}\n\n/**\n * Which operators each dimension can be filtered with. A dimension absent here, or listed with\n * no operator, cannot be filtered at all.\n */\nexport type FilterOperatorMap = Partial<Record<DimensionKey, readonly FilterOperator[]>>\n\n/** Where a source reads one metric, when it cannot read it under every breakdown it offers. */\nexport interface MetricReach {\n\t/**\n\t * The breakdowns the metric is read under; empty when only whole-site numbers carry it.\n\t * Absent: every dimension the source declares.\n\t */\n\tdimensions?: readonly DimensionKey[]\n\t/**\n\t * A dimension the read must break down or filter by for the metric to have a value at all.\n\t * A read of one page (`AnalyticsQuery.path`) counts as filtering by `page`.\n\t */\n\trequires?: DimensionKey\n}\n\n/** What the numbers of a source mean where sources differ. */\nexport interface MetricSemantics {\n\t/**\n\t * `distinct` counts each person once over a range; `sumOfDaily` adds up each day's visitors.\n\t * Either may be per hostname: native's visitor id is, so two hostnames add up.\n\t */\n\tvisitors: VisitorCounting\n\t/** `inactivity30m` ends a visit after 30 minutes without activity; `provider` is the vendor's own rule. */\n\tsessions: 'inactivity30m' | 'provider'\n}\n\nexport interface AnalyticsCapabilities {\n\t/** The source answers `AnalyticsQuery.item`: one content item's views, clicks and outcomes. */\n\tperItemQuery?: boolean\n\trealtime: boolean\n\trealtimeWindowMinutes?: number\n\t/**\n\t * Period-over-period comparison, which the engine serves for every source by reading the\n\t * previous window itself. Adapters omit this; set it false only to opt a source out.\n\t */\n\tcomparison?: boolean\n\tminGranularity: Granularity\n\t/**\n\t * The source answers `week` and `month` series itself, exactly. Without it the engine reads\n\t * days and folds them into weeks and months in the read's reporting timezone.\n\t */\n\tcalendarBuckets?: boolean\n\tmaxLookbackDays: number | null\n\t/**\n\t * How far back a filtered read reaches, when that is shorter than `maxLookbackDays`: the\n\t * source narrows a longer one itself and marks it `clamped`. Absent or null: as far as any read.\n\t */\n\tfilterLookbackDays?: number | null\n\tmetrics: ReadonlySet<MetricKey>\n\tdimensions: ReadonlySet<DimensionKey>\n\t/**\n\t * Metrics the source reads only under some breakdowns or only for a page; any other is read under\n\t * every dimension. Reads outside a metric's reach are refused and hidden by pickers.\n\t */\n\tmetricReach?: Partial<Record<MetricKey, MetricReach>>\n\t/**\n\t * The `AnalyticsQuery.filters` the source applies, per dimension. A read carrying any other\n\t * pair is refused before it reaches the adapter. Absent: no filter at all.\n\t */\n\tfilters?: FilterOperatorMap\n\t/** What `visitors` and `sessions` mean here. Absent: not declared. */\n\tsemantics?: MetricSemantics\n\trateLimit: RateLimitDescriptor | null\n\t/**\n\t * Seconds an answer stays fresh. `today`, for a source cheap to read again, caps a window that\n\t * reaches into the current day whatever `cache.ttl` says; such an answer is never served stale.\n\t */\n\trecommendedTtl: { realtime: number; aggregate: number; today?: number }\n\t/**\n\t * The adapter applies `AnalyticsQuery.scope` as a native filter. Without it a scoped read through\n\t * a shared adapter would see other scopes, so it is gated by `access.crossScope.unscopedSource`.\n\t */\n\tscopedQueries?: boolean\n\t/**\n\t * The adapter sends every vendor request through `AdapterContext.upstream`, so each one spends\n\t * its own rate token and slot. Without it the engine counts a whole read as one request.\n\t */\n\tupstreamAware?: boolean\n}\n\nexport interface AdapterContext {\n\tsignal?: AbortSignal\n\t/**\n\t * The Payload instance the read is for, which the surfacing engine always passes. An adapter\n\t * that stores its data in Payload's database reads through it.\n\t */\n\tpayload?: Payload\n\t/**\n\t * Sends one vendor request through the source's lane: rate token, slot, retries on outage,\n\t * circuit breaker. Absent outside the engine, where `fn(ctx.signal)` is called directly.\n\t */\n\tupstream?: <T>(fn: (signal?: AbortSignal) => Promise<T>) => Promise<T>\n\t/**\n\t * Milliseconds the read has left before it gives up, for a vendor SDK that takes a deadline of\n\t * its own rather than a signal. Absent outside the engine.\n\t */\n\tremainingMs?: () => number\n\t/**\n\t * What time it is by the plugin's clock (Payload's), which an adapter stamps `meta.fetchedAt`\n\t * with. The engine always passes it; absent outside the engine.\n\t */\n\tnow?: () => Date\n}\n\n/** Extra context the plugin hands adapters when they register config surface. */\nexport interface AdapterRegisterContext {\n\t/** True when the plugin has `scope.resolve` configured. */\n\tscoped: boolean\n\t/**\n\t * `scope.resolve` at the `capture` call site, for ingest stamping: the host's resolver sees no\n\t * user, cookies or authorization header, so a hit files under the site it landed on.\n\t */\n\tresolveScope: (req: PayloadRequest) => Promise<string | null>\n\t/**\n\t * The plugin's reportingTimezone bound for adapter use, for what is shown in it. Resolves to\n\t * `'UTC'` when no reportingTimezone is set, and when the host's resolver fails.\n\t */\n\tresolveTimezone: (req: PayloadRequest, scope?: string | null) => Promise<string>\n\t/**\n\t * The same timezone, thrown rather than falling back to UTC: for an adapter storing days counted\n\t * in it, where recounting a day in UTC would move its numbers.\n\t */\n\tresolveTimezoneStrict: (req: PayloadRequest, scope?: string | null) => Promise<string>\n\t/** The install's `revenue` settings, for adapters that declare or reconcile revenue. */\n\trevenue: {\n\t\tenabled: boolean\n\t\tdimension: boolean\n\t\t/** `revenue.currency` bound for adapter use: `undefined` when none is set, revenue a plain number. */\n\t\tcurrency: (req: PayloadRequest, scope?: string | null) => Promise<string | undefined>\n\t\t/** `revenue.convert`, for adapters that reconcile revenue at ingest. */\n\t\tconvert?: CurrencyConverter\n\t\t/** `revenue.browserAmounts`, for an adapter that takes amounts from the browser itself. */\n\t\tbrowserAmounts?: BrowserAmounts\n\t\t/** `revenue.orderSignature`, for an adapter that takes the browser's order ids. */\n\t\torderSignature?: OrderSignatureMode\n\t}\n\t/**\n\t * The install's goals for a request's scope (config goals, the collection's merged over them),\n\t * for adapters that match completions themselves.\n\t */\n\tresolveGoals: (req: PayloadRequest, scope?: string | null) => Promise<Goal[]>\n\t/**\n\t * Whether a scope's own provider documents grant it this adapter; present only when the providers\n\t * collection runs under `scope.resolve`. Native ingest stores nothing for a scope it denies.\n\t */\n\tadapterGrantedForScope?: (\n\t\treq: PayloadRequest,\n\t\tscope: string | null,\n\t\tadapterId: string\n\t) => Promise<boolean>\n\t/** The plugin's `trustedProxyHops`, for adapters that read a request's client address. */\n\ttrustedProxyHops?: number\n\t/**\n\t * The plugin's `trustedPlatform`, for adapters that read a request's client address or\n\t * location: the only platform whose edge headers may be believed.\n\t */\n\ttrustedPlatform?: TrustedPlatform\n\t/**\n\t * `capture.allowedOrigins`, normalized, for adapters that register a public POST endpoint: the\n\t * only other sites whose pages may send to it from a visitor's browser.\n\t */\n\tallowedOrigins?: ReadonlySet<string>\n\t/**\n\t * The collections bound as content items, the only ones whose refs ingest keeps, and whether\n\t * an item is also counted per page it appeared on. Absent means no item is bound.\n\t */\n\titems?: { collections: ReadonlySet<string>; pages: boolean }\n\t/** The plugin's mounts under `routes.api`, for adapters that register an endpoint of their own. */\n\troutes?: RoutePaths\n\t/**\n\t * The packages the host handed the plugin as `sdks`, for adapters that would otherwise load\n\t * them at runtime: GA4's Data API client, the native engine's MaxMind reader.\n\t */\n\tsdks?: AnalyticsSdks\n\t/**\n\t * The plugin's `jobs`: the queue and schedule of the maintenance task an adapter registers, or\n\t * false when the install registers no task and the adapter's own requests do that work instead.\n\t */\n\tjobs?: AdapterJobs\n\t/**\n\t * The host's `jobs.enableConcurrencyControl`: only then may a task an adapter registers carry a\n\t * concurrency key, which Payload refuses otherwise.\n\t */\n\tjobsConcurrency?: boolean\n\t/** Says something at init, once the instance can log: what the boot warns about rather than refuses. */\n\tnotice?: (message: string) => void\n}\n\n/** What a switched-off install hands an adapter that keeps its schema (`disabled: true`). */\nexport interface AdapterSchemaContext {\n\t/** The plugin's `jobs`, which decides whether the adapter's task slug is in the jobs enum. */\n\tjobs: AdapterJobs\n\t/** What the boot would warn about, which a switched-off install never says. */\n\tnotice?: (message: string) => void\n}\n\n/** Whom a source's label is read for: the request, and the scope its sources were listed for. */\nexport interface AdapterLabelArgs {\n\treq: PayloadRequest\n\t/** Null is install-wide, `*` is cross-scope. */\n\tscope: string | null\n}\n\nexport interface AnalyticsAdapter {\n\treadonly id: string\n\t/** The source's name wherever no reader is known (boot-time pickers, logs). */\n\treadonly label: string\n\t/**\n\t * The source's name for one reader, where it differs by language or by who reads. Read through\n\t * `sourceLabelFor`, which falls back to `label` when this fails.\n\t */\n\treadonly labelFor?: (args: AdapterLabelArgs) => string | Promise<string>\n\treadonly capabilities: AnalyticsCapabilities\n\t/** Browser-tracker proxying/boot descriptor. Absent when no public capture field is set. */\n\treadonly capture?: CaptureSupport\n\t/**\n\t * Where the adapter's own ingest endpoint listens, relative to `routes.api`, and how server code\n\t * reaches that pipeline directly. Server-side only, never serialized.\n\t */\n\treadonly ingest?: { path: string; track?: ServerTrack; hostname?: IngestHostnameResolver }\n\tisConfigured(): boolean\n\tquery(query: AnalyticsQuery, ctx: AdapterContext): Promise<AnalyticsResult>\n\trealtime?(query: AnalyticsQuery, ctx: AdapterContext): Promise<AnalyticsResult>\n\tregister?(config: Config, context?: AdapterRegisterContext): void\n\t/**\n\t * For `disabled: true`: adds exactly the schema `register` would (collections, fields, indexes,\n\t * task slugs) and nothing that runs, so a switched-off install keeps its tables.\n\t */\n\tregisterSchema?(config: Config, context: AdapterSchemaContext): void\n\t/**\n\t * Binds the adapter to the Payload instance a runtime is built for, whenever one is, with or\n\t * without `onInit`. Called again for every rebuild, so it must be idempotent per instance.\n\t */\n\tattach?(payload: Payload): void\n\t/**\n\t * Releases what the adapter holds for one instance (buffers, clients, timers) once that\n\t * instance's runtime is retired; another instance the adapter serves keeps what it holds.\n\t */\n\tclose?(payload: Payload): void | Promise<void>\n}\n\nexport type AnalyticsAdapterFactory<Config> = (config: Config) => AnalyticsAdapter\n"],"mappings":";;;;;AAeA,MAAa,iBAAiB;;AAiC9B,MAAa,iBAAiB;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD;;AAYA,MAAa,mBAAmB;CAAC;CAAM;CAAY;AAAS"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { DAY_MS, HOUR_MS, MINUTE_MS } from "../timeframe/tz.js";
|
|
2
|
+
//#region src/core/cron.ts
|
|
3
|
+
const NICKNAMES = new Map([
|
|
4
|
+
["@yearly", 366 * DAY_MS],
|
|
5
|
+
["@annually", 366 * DAY_MS],
|
|
6
|
+
["@monthly", 31 * DAY_MS],
|
|
7
|
+
["@weekly", 7 * DAY_MS],
|
|
8
|
+
["@daily", DAY_MS],
|
|
9
|
+
["@midnight", DAY_MS],
|
|
10
|
+
["@hourly", HOUR_MS]
|
|
11
|
+
]);
|
|
12
|
+
/** What one field of a pattern may hold: numbers, names, `*`, steps, lists, ranges, `?`, `L`, `W`, `#`. */
|
|
13
|
+
const FIELD = /^[0-9A-Za-z*/,?#-]+$/;
|
|
14
|
+
const NUMBER = /^\d+$/;
|
|
15
|
+
const STEP = /^\*\/(\d+)$/;
|
|
16
|
+
const fieldsOf = (pattern) => pattern.trim().split(/\s+/);
|
|
17
|
+
/**
|
|
18
|
+
* Whether `value` reads as a pattern Payload's scheduler takes: five fields, six with seconds
|
|
19
|
+
* first, or a nickname such as `@hourly`. A shape check only; the scheduler parses it in full.
|
|
20
|
+
*/
|
|
21
|
+
const isCronPattern = (value) => {
|
|
22
|
+
if (typeof value !== "string" || value.trim() === "") return false;
|
|
23
|
+
if (NICKNAMES.has(value.trim().toLowerCase())) return true;
|
|
24
|
+
const fields = fieldsOf(value);
|
|
25
|
+
return (fields.length === 5 || fields.length === 6) && fields.every((field) => FIELD.test(field));
|
|
26
|
+
};
|
|
27
|
+
/** A step that divides its cycle evenly, so every run is the same distance from the last. */
|
|
28
|
+
const evenStep = (field, cycle) => {
|
|
29
|
+
const step = Number(STEP.exec(field ?? "")?.[1]);
|
|
30
|
+
return Number.isInteger(step) && step > 0 && cycle % step === 0 ? step : null;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* How far apart a simple pattern's runs fall: every minute, every n minutes or hours, hourly,
|
|
34
|
+
* daily, or a nickname. Null for any other pattern, whose cadence is not read off it.
|
|
35
|
+
*/
|
|
36
|
+
const cronIntervalMs = (pattern) => {
|
|
37
|
+
const nickname = NICKNAMES.get(pattern.trim().toLowerCase());
|
|
38
|
+
if (nickname !== void 0) return nickname;
|
|
39
|
+
const fields = fieldsOf(pattern);
|
|
40
|
+
if (fields.length === 6 && !NUMBER.test(fields[0] ?? "")) return null;
|
|
41
|
+
const [minute, hour, dayOfMonth, month, dayOfWeek] = fields.length === 6 ? fields.slice(1) : fields;
|
|
42
|
+
if (fields.length < 5 || dayOfMonth !== "*" || month !== "*" || dayOfWeek !== "*") return null;
|
|
43
|
+
if (hour === "*") {
|
|
44
|
+
if (minute === "*") return MINUTE_MS;
|
|
45
|
+
const minutes = evenStep(minute, 60);
|
|
46
|
+
if (minutes !== null) return minutes * MINUTE_MS;
|
|
47
|
+
return NUMBER.test(minute ?? "") ? HOUR_MS : null;
|
|
48
|
+
}
|
|
49
|
+
if (!NUMBER.test(minute ?? "")) return null;
|
|
50
|
+
const hours = evenStep(hour, 24);
|
|
51
|
+
if (hours !== null) return hours * HOUR_MS;
|
|
52
|
+
return NUMBER.test(hour ?? "") ? DAY_MS : null;
|
|
53
|
+
};
|
|
54
|
+
//#endregion
|
|
55
|
+
export { cronIntervalMs, isCronPattern };
|
|
56
|
+
|
|
57
|
+
//# sourceMappingURL=cron.js.map
|