@10x-media/analytics 1.0.0-beta.9 → 4.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1273) hide show
  1. package/CHANGELOG.md +710 -0
  2. package/README.md +35 -36
  3. package/dist/access/adminUser.d.ts +15 -0
  4. package/dist/access/adminUser.js +13 -0
  5. package/dist/access/adminUser.js.map +1 -0
  6. package/dist/access/decideOnce.js +16 -0
  7. package/dist/access/decideOnce.js.map +1 -0
  8. package/dist/access/membership.d.ts +23 -0
  9. package/dist/access/membership.js +63 -0
  10. package/dist/access/membership.js.map +1 -0
  11. package/dist/access/principal.d.ts +37 -0
  12. package/dist/access/principal.js +29 -0
  13. package/dist/access/principal.js.map +1 -0
  14. package/dist/access/readGate.js +16 -0
  15. package/dist/access/readGate.js.map +1 -0
  16. package/dist/adapters/ga4/disableKey.js +19 -0
  17. package/dist/adapters/ga4/disableKey.js.map +1 -0
  18. package/dist/adapters/ga4/eventName.d.ts +2 -8
  19. package/dist/adapters/ga4/eventName.js +2 -8
  20. package/dist/adapters/ga4/eventName.js.map +1 -1
  21. package/dist/adapters/ga4/ga4.d.ts +24 -0
  22. package/dist/adapters/ga4/ga4.js +226 -122
  23. package/dist/adapters/ga4/ga4.js.map +1 -1
  24. package/dist/adapters/ga4/measurementId.js +2 -3
  25. package/dist/adapters/ga4/measurementId.js.map +1 -1
  26. package/dist/adapters/goalRead.js +15 -29
  27. package/dist/adapters/goalRead.js.map +1 -1
  28. package/dist/adapters/http/baseUrl.js +15 -0
  29. package/dist/adapters/http/baseUrl.js.map +1 -0
  30. package/dist/adapters/http/fetchJson.d.ts +19 -0
  31. package/dist/adapters/http/fetchJson.js +27 -8
  32. package/dist/adapters/http/fetchJson.js.map +1 -1
  33. package/dist/adapters/mapping.js +52 -0
  34. package/dist/adapters/mapping.js.map +1 -0
  35. package/dist/adapters/plausible/plausible.d.ts +25 -13
  36. package/dist/adapters/plausible/plausible.js +144 -124
  37. package/dist/adapters/plausible/plausible.js.map +1 -1
  38. package/dist/adapters/plausible/scriptId.js +19 -0
  39. package/dist/adapters/plausible/scriptId.js.map +1 -0
  40. package/dist/adapters/posthog/posthog.d.ts +33 -9
  41. package/dist/adapters/posthog/posthog.js +279 -121
  42. package/dist/adapters/posthog/posthog.js.map +1 -1
  43. package/dist/adapters/posthog/projectCheck.js +56 -0
  44. package/dist/adapters/posthog/projectCheck.js.map +1 -0
  45. package/dist/adapters/readTime.js +7 -0
  46. package/dist/adapters/readTime.js.map +1 -0
  47. package/dist/adapters/series.js +14 -8
  48. package/dist/adapters/series.js.map +1 -1
  49. package/dist/adapters/umami/umami.d.ts +19 -9
  50. package/dist/adapters/umami/umami.js +196 -166
  51. package/dist/adapters/umami/umami.js.map +1 -1
  52. package/dist/adapters/upstream.js +16 -0
  53. package/dist/adapters/upstream.js.map +1 -0
  54. package/dist/binding/report.d.ts +8 -0
  55. package/dist/binding/report.js +24 -0
  56. package/dist/binding/report.js.map +1 -0
  57. package/dist/binding/resolvePath.js +28 -25
  58. package/dist/binding/resolvePath.js.map +1 -1
  59. package/dist/binding/types.d.ts +14 -29
  60. package/dist/capture/captureRequest.js +28 -0
  61. package/dist/capture/captureRequest.js.map +1 -0
  62. package/dist/capture/exclusionEndpoint.js +98 -0
  63. package/dist/capture/exclusionEndpoint.js.map +1 -0
  64. package/dist/capture/exclusionPrelude.js +14 -0
  65. package/dist/capture/exclusionPrelude.js.map +1 -0
  66. package/dist/capture/exclusionToken.js +23 -0
  67. package/dist/capture/exclusionToken.js.map +1 -0
  68. package/dist/capture/jsLiteral.js +19 -0
  69. package/dist/capture/jsLiteral.js.map +1 -0
  70. package/dist/capture/mountPath.js +2 -3
  71. package/dist/capture/mountPath.js.map +1 -1
  72. package/dist/capture/proxyEndpoint.js +49 -92
  73. package/dist/capture/proxyEndpoint.js.map +1 -1
  74. package/dist/capture/proxyRoutes.js +58 -21
  75. package/dist/capture/proxyRoutes.js.map +1 -1
  76. package/dist/capture/relay.js +91 -0
  77. package/dist/capture/relay.js.map +1 -0
  78. package/dist/capture/requestBody.js +2 -6
  79. package/dist/capture/requestBody.js.map +1 -1
  80. package/dist/capture/requestTrust.js +45 -0
  81. package/dist/capture/requestTrust.js.map +1 -0
  82. package/dist/capture/sameSite.js +40 -0
  83. package/dist/capture/sameSite.js.map +1 -0
  84. package/dist/capture/slots.js +50 -25
  85. package/dist/capture/slots.js.map +1 -1
  86. package/dist/capture/trackerConfig.js +131 -36
  87. package/dist/capture/trackerConfig.js.map +1 -1
  88. package/dist/capture/trackerEndpoint.js +22 -21
  89. package/dist/capture/trackerEndpoint.js.map +1 -1
  90. package/dist/capture/withoutConsent.js +91 -0
  91. package/dist/capture/withoutConsent.js.map +1 -0
  92. package/dist/charts/BarList.d.ts +27 -13
  93. package/dist/charts/BarList.js +38 -83
  94. package/dist/charts/BarList.js.map +1 -1
  95. package/dist/charts/TrendChart.d.ts +40 -7
  96. package/dist/charts/TrendChart.js +243 -215
  97. package/dist/charts/TrendChart.js.map +1 -1
  98. package/dist/charts/bars.d.ts +17 -1
  99. package/dist/charts/bars.js +12 -11
  100. package/dist/charts/bars.js.map +1 -1
  101. package/dist/charts/bucket.js +106 -73
  102. package/dist/charts/bucket.js.map +1 -1
  103. package/dist/charts/inProgress.js +22 -0
  104. package/dist/charts/inProgress.js.map +1 -0
  105. package/dist/charts/series.d.ts +15 -0
  106. package/dist/charts/series.js +123 -0
  107. package/dist/charts/series.js.map +1 -0
  108. package/dist/charts/spline.js +91 -25
  109. package/dist/charts/spline.js.map +1 -1
  110. package/dist/charts/trendGeometry.js +91 -0
  111. package/dist/charts/trendGeometry.js.map +1 -0
  112. package/dist/core/adminOptions.d.ts +1 -0
  113. package/dist/core/adminOptions.js +198 -0
  114. package/dist/core/adminOptions.js.map +1 -0
  115. package/dist/core/budget.js +24 -0
  116. package/dist/core/budget.js.map +1 -0
  117. package/dist/core/cacheKey.d.ts +1 -0
  118. package/dist/core/cacheKey.js +48 -36
  119. package/dist/core/cacheKey.js.map +1 -1
  120. package/dist/core/cacheOptions.js +165 -0
  121. package/dist/core/cacheOptions.js.map +1 -0
  122. package/dist/core/capabilities.d.ts +24 -11
  123. package/dist/core/capabilities.js +96 -17
  124. package/dist/core/capabilities.js.map +1 -1
  125. package/dist/core/capture.d.ts +59 -26
  126. package/dist/core/captureOptions.d.ts +1 -0
  127. package/dist/core/captureOptions.js +347 -0
  128. package/dist/core/captureOptions.js.map +1 -0
  129. package/dist/core/clock.js +13 -0
  130. package/dist/core/clock.js.map +1 -0
  131. package/dist/core/collectionOption.d.ts +17 -0
  132. package/dist/core/collectionOption.js +105 -0
  133. package/dist/core/collectionOption.js.map +1 -0
  134. package/dist/core/collectionSlug.js +7 -0
  135. package/dist/core/collectionSlug.js.map +1 -0
  136. package/dist/core/contract.d.ts +321 -60
  137. package/dist/core/contract.js +7 -4
  138. package/dist/core/contract.js.map +1 -1
  139. package/dist/core/cron.js +57 -0
  140. package/dist/core/cron.js.map +1 -0
  141. package/dist/core/fetch.d.ts +17 -0
  142. package/dist/core/goalOptions.d.ts +1 -0
  143. package/dist/core/goalOptions.js +166 -0
  144. package/dist/core/goalOptions.js.map +1 -0
  145. package/dist/core/granularity.js +3 -2
  146. package/dist/core/granularity.js.map +1 -1
  147. package/dist/core/guards.js +17 -0
  148. package/dist/core/guards.js.map +1 -0
  149. package/dist/core/jobs.d.ts +40 -0
  150. package/dist/core/jobs.js +132 -0
  151. package/dist/core/jobs.js.map +1 -0
  152. package/dist/core/legacyOptions.js +145 -0
  153. package/dist/core/legacyOptions.js.map +1 -0
  154. package/dist/core/metricAliases.js +81 -0
  155. package/dist/core/metricAliases.js.map +1 -0
  156. package/dist/core/metricValues.js +57 -0
  157. package/dist/core/metricValues.js.map +1 -0
  158. package/dist/core/monotonic.js +10 -0
  159. package/dist/core/monotonic.js.map +1 -0
  160. package/dist/core/optionChecks.js +51 -0
  161. package/dist/core/optionChecks.js.map +1 -0
  162. package/dist/core/options.d.ts +530 -152
  163. package/dist/core/options.js +158 -216
  164. package/dist/core/options.js.map +1 -1
  165. package/dist/core/registry.js +45 -5
  166. package/dist/core/registry.js.map +1 -1
  167. package/dist/core/scopeList.js +7 -9
  168. package/dist/core/scopeList.js.map +1 -1
  169. package/dist/core/scopeOptions.d.ts +1 -0
  170. package/dist/core/scopeOptions.js +114 -0
  171. package/dist/core/scopeOptions.js.map +1 -0
  172. package/dist/core/scopedRead.js +349 -36
  173. package/dist/core/scopedRead.js.map +1 -1
  174. package/dist/core/sdks.d.ts +81 -0
  175. package/dist/core/sdks.js +23 -0
  176. package/dist/core/sdks.js.map +1 -0
  177. package/dist/core/serverEvent.d.ts +50 -16
  178. package/dist/core/serverEvent.js.map +1 -1
  179. package/dist/core/siteAddress.js +20 -0
  180. package/dist/core/siteAddress.js.map +1 -0
  181. package/dist/core/sourceErrors.js +109 -0
  182. package/dist/core/sourceErrors.js.map +1 -0
  183. package/dist/core/sourceLabel.d.ts +10 -0
  184. package/dist/core/sourceLabel.js +63 -0
  185. package/dist/core/sourceLabel.js.map +1 -0
  186. package/dist/core/sourceOptions.js +107 -0
  187. package/dist/core/sourceOptions.js.map +1 -0
  188. package/dist/core/sourcePolicy.d.ts +55 -0
  189. package/dist/core/sourcePolicy.js +51 -0
  190. package/dist/core/sourcePolicy.js.map +1 -0
  191. package/dist/core/throttle.js +18 -0
  192. package/dist/core/throttle.js.map +1 -0
  193. package/dist/core/values.js +61 -0
  194. package/dist/core/values.js.map +1 -0
  195. package/dist/core/widgetSlugs.d.ts +17 -0
  196. package/dist/core/widgetSlugs.js +29 -0
  197. package/dist/core/widgetSlugs.js.map +1 -0
  198. package/dist/db/detachedWrite.js +36 -0
  199. package/dist/db/detachedWrite.js.map +1 -0
  200. package/dist/db/errors.js +182 -0
  201. package/dist/db/errors.js.map +1 -0
  202. package/dist/db/kind.js +32 -0
  203. package/dist/db/kind.js.map +1 -0
  204. package/dist/db/openTransaction.js +51 -0
  205. package/dist/db/openTransaction.js.map +1 -0
  206. package/dist/exports/adapters/contract.d.ts +15 -0
  207. package/dist/exports/adapters/ga4.d.ts +16 -1
  208. package/dist/exports/adapters/native.d.ts +29 -2
  209. package/dist/exports/adapters/native.js +5 -1
  210. package/dist/exports/adapters/plausible.d.ts +16 -1
  211. package/dist/exports/adapters/posthog.d.ts +16 -1
  212. package/dist/exports/adapters/umami.d.ts +16 -1
  213. package/dist/exports/attributes.d.ts +42 -0
  214. package/dist/exports/attributes.js +83 -0
  215. package/dist/exports/attributes.js.map +1 -0
  216. package/dist/exports/client.d.ts +43 -12
  217. package/dist/exports/client.js +22 -8
  218. package/dist/exports/geo.d.ts +4 -2
  219. package/dist/exports/geo.js +1 -1
  220. package/dist/exports/i18n.d.ts +2 -2
  221. package/dist/exports/i18n.js +2 -2
  222. package/dist/exports/migrations.d.ts +2 -0
  223. package/dist/exports/migrations.js +2 -0
  224. package/dist/exports/react.d.ts +5 -3
  225. package/dist/exports/react.js +1 -2
  226. package/dist/exports/routes.d.ts +19 -0
  227. package/dist/exports/routes.js +3 -0
  228. package/dist/exports/rsc.d.ts +32 -14
  229. package/dist/exports/rsc.js +11 -6
  230. package/dist/exports/site.d.ts +5 -0
  231. package/dist/exports/site.js +3 -0
  232. package/dist/exports/testing.d.ts +18 -0
  233. package/dist/exports/testing.js +3 -0
  234. package/dist/exports/tracker.d.ts +6 -18
  235. package/dist/exports/tracker.js +3 -12
  236. package/dist/exports/types.d.ts +45 -14
  237. package/dist/exports/types.js +6 -1
  238. package/dist/fields/AnalyticsPanelClient.js +265 -154
  239. package/dist/fields/AnalyticsPanelClient.js.map +1 -1
  240. package/dist/fields/AnalyticsPanelField.d.ts +19 -7
  241. package/dist/fields/AnalyticsPanelField.js +123 -30
  242. package/dist/fields/AnalyticsPanelField.js.map +1 -1
  243. package/dist/fields/AnalyticsStatField.d.ts +17 -6
  244. package/dist/fields/AnalyticsStatField.js +98 -63
  245. package/dist/fields/AnalyticsStatField.js.map +1 -1
  246. package/dist/fields/FieldShimmer.js +15 -0
  247. package/dist/fields/FieldShimmer.js.map +1 -0
  248. package/dist/fields/PanelContent.js +222 -0
  249. package/dist/fields/PanelContent.js.map +1 -0
  250. package/dist/fields/PanelList.js +82 -0
  251. package/dist/fields/PanelList.js.map +1 -0
  252. package/dist/fields/PanelLiveCounter.js +63 -0
  253. package/dist/fields/PanelLiveCounter.js.map +1 -0
  254. package/dist/fields/PanelSkeleton.js +63 -0
  255. package/dist/fields/PanelSkeleton.js.map +1 -0
  256. package/dist/fields/componentPaths.js +8 -0
  257. package/dist/fields/componentPaths.js.map +1 -0
  258. package/dist/fields/config/FilterDimensionSelectField.d.ts +2 -2
  259. package/dist/fields/config/FilterDimensionSelectField.js +26 -54
  260. package/dist/fields/config/FilterDimensionSelectField.js.map +1 -1
  261. package/dist/fields/config/FilterKeySelect.js +66 -0
  262. package/dist/fields/config/FilterKeySelect.js.map +1 -0
  263. package/dist/fields/config/FilterOperatorSelectField.d.ts +7 -2
  264. package/dist/fields/config/FilterOperatorSelectField.js +37 -53
  265. package/dist/fields/config/FilterOperatorSelectField.js.map +1 -1
  266. package/dist/fields/config/FilterValueField.d.ts +17 -0
  267. package/dist/fields/config/FilterValueField.js +130 -0
  268. package/dist/fields/config/FilterValueField.js.map +1 -0
  269. package/dist/fields/config/MetricSelectField.d.ts +5 -12
  270. package/dist/fields/config/MetricSelectField.js +18 -30
  271. package/dist/fields/config/MetricSelectField.js.map +1 -1
  272. package/dist/fields/config/OptionSelect.js +52 -0
  273. package/dist/fields/config/OptionSelect.js.map +1 -0
  274. package/dist/fields/config/SourceSelectField.js +16 -31
  275. package/dist/fields/config/SourceSelectField.js.map +1 -1
  276. package/dist/fields/config/fetchSources.d.ts +3 -0
  277. package/dist/fields/config/fetchSources.js +17 -23
  278. package/dist/fields/config/fetchSources.js.map +1 -1
  279. package/dist/fields/config/filterValues.js +106 -0
  280. package/dist/fields/config/filterValues.js.map +1 -0
  281. package/dist/fields/config/narrow.js +8 -10
  282. package/dist/fields/config/narrow.js.map +1 -1
  283. package/dist/fields/config/retiredPickers.d.ts +45 -0
  284. package/dist/fields/config/retiredPickers.js +46 -0
  285. package/dist/fields/config/retiredPickers.js.map +1 -0
  286. package/dist/fields/config/scopedFields.d.ts +40 -0
  287. package/dist/fields/config/scopedFields.js +68 -0
  288. package/dist/fields/config/scopedFields.js.map +1 -0
  289. package/dist/fields/config/toSelectOption.js +13 -7
  290. package/dist/fields/config/toSelectOption.js.map +1 -1
  291. package/dist/fields/config/useAnalyticsSources.d.ts +5 -7
  292. package/dist/fields/config/useAnalyticsSources.js +17 -21
  293. package/dist/fields/config/useAnalyticsSources.js.map +1 -1
  294. package/dist/fields/config/useFilterCapabilities.d.ts +9 -6
  295. package/dist/fields/config/useFilterCapabilities.js +23 -15
  296. package/dist/fields/config/useFilterCapabilities.js.map +1 -1
  297. package/dist/fields/config/useFormString.js +12 -0
  298. package/dist/fields/config/useFormString.js.map +1 -0
  299. package/dist/fields/dateRange/field.js +7 -19
  300. package/dist/fields/dateRange/field.js.map +1 -1
  301. package/dist/fields/dateRange/types.d.ts +5 -1
  302. package/dist/fields/dateRange/ui.d.ts +3 -2
  303. package/dist/fields/dateRange/ui.js +57 -319
  304. package/dist/fields/dateRange/ui.js.map +1 -1
  305. package/dist/fields/documentScope.js +21 -0
  306. package/dist/fields/documentScope.js.map +1 -0
  307. package/dist/fields/emptyState.js +30 -26
  308. package/dist/fields/emptyState.js.map +1 -1
  309. package/dist/fields/factories.d.ts +35 -16
  310. package/dist/fields/factories.js +67 -38
  311. package/dist/fields/factories.js.map +1 -1
  312. package/dist/fields/format.d.ts +12 -3
  313. package/dist/fields/format.js +77 -13
  314. package/dist/fields/format.js.map +1 -1
  315. package/dist/fields/itemReport.js +45 -0
  316. package/dist/fields/itemReport.js.map +1 -0
  317. package/dist/fields/readForDocument.d.ts +79 -26
  318. package/dist/fields/readForDocument.js +450 -116
  319. package/dist/fields/readForDocument.js.map +1 -1
  320. package/dist/fields/stateKeys.js +20 -0
  321. package/dist/fields/stateKeys.js.map +1 -0
  322. package/dist/goals/GoalAmountField.d.ts +10 -0
  323. package/dist/goals/GoalAmountField.js +179 -0
  324. package/dist/goals/GoalAmountField.js.map +1 -0
  325. package/dist/goals/GoalSelectField.js +89 -40
  326. package/dist/goals/GoalSelectField.js.map +1 -1
  327. package/dist/goals/GoalSelectFieldServer.d.ts +13 -0
  328. package/dist/goals/GoalSelectFieldServer.js +21 -0
  329. package/dist/goals/GoalSelectFieldServer.js.map +1 -0
  330. package/dist/goals/amountField.d.ts +20 -0
  331. package/dist/goals/amountField.js +37 -0
  332. package/dist/goals/amountField.js.map +1 -0
  333. package/dist/goals/builtin.js +17 -0
  334. package/dist/goals/builtin.js.map +1 -0
  335. package/dist/goals/collection.d.ts +22 -0
  336. package/dist/goals/collection.js +143 -124
  337. package/dist/goals/collection.js.map +1 -1
  338. package/dist/goals/constants.d.ts +38 -0
  339. package/dist/goals/constants.js +49 -0
  340. package/dist/goals/constants.js.map +1 -0
  341. package/dist/goals/currency.d.ts +16 -0
  342. package/dist/goals/currency.js +46 -4
  343. package/dist/goals/currency.js.map +1 -1
  344. package/dist/goals/currencyOptions.js +70 -0
  345. package/dist/goals/currencyOptions.js.map +1 -0
  346. package/dist/goals/fetchGoals.d.ts +10 -0
  347. package/dist/goals/fetchGoals.js +12 -22
  348. package/dist/goals/fetchGoals.js.map +1 -1
  349. package/dist/goals/goalField.d.ts +4 -6
  350. package/dist/goals/goalField.js +9 -19
  351. package/dist/goals/goalField.js.map +1 -1
  352. package/dist/goals/goalsEndpoint.js +40 -38
  353. package/dist/goals/goalsEndpoint.js.map +1 -1
  354. package/dist/goals/items.js +35 -0
  355. package/dist/goals/items.js.map +1 -0
  356. package/dist/goals/latent.js +9 -0
  357. package/dist/goals/latent.js.map +1 -0
  358. package/dist/goals/linkFields.d.ts +35 -0
  359. package/dist/goals/linkFields.js +31 -0
  360. package/dist/goals/linkFields.js.map +1 -0
  361. package/dist/goals/match.d.ts +14 -0
  362. package/dist/goals/match.js +67 -46
  363. package/dist/goals/match.js.map +1 -1
  364. package/dist/goals/moneyFields.js +56 -0
  365. package/dist/goals/moneyFields.js.map +1 -0
  366. package/dist/goals/pathMatch.js +122 -0
  367. package/dist/goals/pathMatch.js.map +1 -0
  368. package/dist/goals/placeholder.js +12 -0
  369. package/dist/goals/placeholder.js.map +1 -0
  370. package/dist/goals/resolver.d.ts +3 -3
  371. package/dist/goals/resolver.js +155 -47
  372. package/dist/goals/resolver.js.map +1 -1
  373. package/dist/goals/serverRevenue.d.ts +60 -0
  374. package/dist/goals/serverRevenue.js +41 -0
  375. package/dist/goals/serverRevenue.js.map +1 -0
  376. package/dist/goals/trackGoalAction.d.ts +26 -25
  377. package/dist/goals/trackGoalAction.js +71 -66
  378. package/dist/goals/trackGoalAction.js.map +1 -1
  379. package/dist/goals/types.d.ts +13 -28
  380. package/dist/goals/types.js +1 -1
  381. package/dist/goals/types.js.map +1 -1
  382. package/dist/goals/useAnalyticsGoals.d.ts +6 -5
  383. package/dist/goals/useAnalyticsGoals.js +17 -18
  384. package/dist/goals/useAnalyticsGoals.js.map +1 -1
  385. package/dist/index.d.ts +68 -12
  386. package/dist/index.js +261 -192
  387. package/dist/index.js.map +1 -1
  388. package/dist/items/collectionIdType.js +20 -0
  389. package/dist/items/collectionIdType.js.map +1 -0
  390. package/dist/items/idType.js +31 -0
  391. package/dist/items/idType.js.map +1 -0
  392. package/dist/items/ref.js +73 -0
  393. package/dist/items/ref.js.map +1 -0
  394. package/dist/maintenance/apiTaskState.js +141 -0
  395. package/dist/maintenance/apiTaskState.js.map +1 -0
  396. package/dist/maintenance/heartbeat.js +51 -0
  397. package/dist/maintenance/heartbeat.js.map +1 -0
  398. package/dist/maintenance/lease.d.ts +1 -0
  399. package/dist/maintenance/lease.js +79 -0
  400. package/dist/maintenance/lease.js.map +1 -0
  401. package/dist/maintenance/taskSchedule.js +27 -0
  402. package/dist/maintenance/taskSchedule.js.map +1 -0
  403. package/dist/maintenance/underLease.js +35 -0
  404. package/dist/maintenance/underLease.js.map +1 -0
  405. package/dist/migrations/legacy.d.ts +54 -0
  406. package/dist/migrations/legacy.js +117 -0
  407. package/dist/migrations/legacy.js.map +1 -0
  408. package/dist/migrations/predefined/dropLegacyMongo.d.ts +11 -0
  409. package/dist/migrations/predefined/dropLegacyMongo.js +12 -0
  410. package/dist/migrations/predefined/dropLegacyMongo.js.map +1 -0
  411. package/dist/native/collections/aggregates.js +54 -0
  412. package/dist/native/collections/aggregates.js.map +1 -0
  413. package/dist/native/collections/hits.js +103 -0
  414. package/dist/native/collections/hits.js.map +1 -0
  415. package/dist/native/collections/slugs.d.ts +10 -0
  416. package/dist/native/collections/slugs.js +16 -0
  417. package/dist/native/collections/slugs.js.map +1 -0
  418. package/dist/native/collections/state.js +84 -0
  419. package/dist/native/collections/state.js.map +1 -0
  420. package/dist/native/collections/storeCollection.js +31 -0
  421. package/dist/native/collections/storeCollection.js.map +1 -0
  422. package/dist/native/engine/buckets.d.ts +1 -0
  423. package/dist/native/engine/buckets.js +53 -0
  424. package/dist/native/engine/buckets.js.map +1 -0
  425. package/dist/native/engine/capabilities.js +87 -0
  426. package/dist/native/engine/capabilities.js.map +1 -0
  427. package/dist/native/engine/cost.js +72 -0
  428. package/dist/native/engine/cost.js.map +1 -0
  429. package/dist/native/engine/days.d.ts +1 -0
  430. package/dist/native/engine/days.js +182 -0
  431. package/dist/native/engine/days.js.map +1 -0
  432. package/dist/native/engine/engine.d.ts +1 -0
  433. package/dist/native/engine/engine.js +1627 -0
  434. package/dist/native/engine/engine.js.map +1 -0
  435. package/dist/native/engine/instance.js +58 -0
  436. package/dist/native/engine/instance.js.map +1 -0
  437. package/dist/native/engine/maintenance.d.ts +1 -0
  438. package/dist/native/engine/maintenance.js +677 -0
  439. package/dist/native/engine/maintenance.js.map +1 -0
  440. package/dist/native/engine/merge.js +41 -0
  441. package/dist/native/engine/merge.js.map +1 -0
  442. package/dist/native/engine/nudge.js +26 -0
  443. package/dist/native/engine/nudge.js.map +1 -0
  444. package/dist/native/engine/planner.js +199 -0
  445. package/dist/native/engine/planner.js.map +1 -0
  446. package/dist/native/engine/rebuild.d.ts +22 -0
  447. package/dist/native/engine/rebuild.js +76 -0
  448. package/dist/native/engine/rebuild.js.map +1 -0
  449. package/dist/native/engine/recent.js +17 -0
  450. package/dist/native/engine/recent.js.map +1 -0
  451. package/dist/native/engine/salt.d.ts +1 -0
  452. package/dist/native/engine/salt.js +98 -0
  453. package/dist/native/engine/salt.js.map +1 -0
  454. package/dist/native/engine/siteHosts.d.ts +1 -0
  455. package/dist/native/engine/siteHosts.js +58 -0
  456. package/dist/native/engine/siteHosts.js.map +1 -0
  457. package/dist/native/engine/toHit.js +110 -0
  458. package/dist/native/engine/toHit.js.map +1 -0
  459. package/dist/native/engine/writeBuffer.d.ts +14 -0
  460. package/dist/native/engine/writeBuffer.js +317 -0
  461. package/dist/native/engine/writeBuffer.js.map +1 -0
  462. package/dist/native/geo/composeGeoResolvers.d.ts +1 -0
  463. package/dist/native/geo/composeGeoResolvers.js +5 -2
  464. package/dist/native/geo/composeGeoResolvers.js.map +1 -1
  465. package/dist/native/geo/geoResolver.d.ts +27 -2
  466. package/dist/native/geo/geoResolver.js +42 -6
  467. package/dist/native/geo/geoResolver.js.map +1 -1
  468. package/dist/native/geo/maxmindResolver.d.ts +8 -4
  469. package/dist/native/geo/maxmindResolver.js +20 -16
  470. package/dist/native/geo/maxmindResolver.js.map +1 -1
  471. package/dist/native/geo/resolveGeo.js +31 -0
  472. package/dist/native/geo/resolveGeo.js.map +1 -0
  473. package/dist/native/ingest/bots.d.ts +10 -0
  474. package/dist/native/ingest/bots.js +66 -0
  475. package/dist/native/ingest/bots.js.map +1 -0
  476. package/dist/native/ingest/browser.js +4 -6
  477. package/dist/native/ingest/browser.js.map +1 -1
  478. package/dist/native/ingest/clientIp.js +34 -8
  479. package/dist/native/ingest/clientIp.js.map +1 -1
  480. package/dist/native/ingest/device.js +4 -6
  481. package/dist/native/ingest/device.js.map +1 -1
  482. package/dist/native/ingest/endpoint.d.ts +1 -1
  483. package/dist/native/ingest/endpoint.js +185 -32
  484. package/dist/native/ingest/endpoint.js.map +1 -1
  485. package/dist/native/ingest/itemSignature.d.ts +26 -0
  486. package/dist/native/ingest/itemSignature.js +45 -0
  487. package/dist/native/ingest/itemSignature.js.map +1 -0
  488. package/dist/native/ingest/language.js +2 -3
  489. package/dist/native/ingest/language.js.map +1 -1
  490. package/dist/native/ingest/normalizeEvent.d.ts +70 -8
  491. package/dist/native/ingest/normalizeEvent.js +239 -60
  492. package/dist/native/ingest/normalizeEvent.js.map +1 -1
  493. package/dist/native/ingest/orderSignature.d.ts +13 -0
  494. package/dist/native/ingest/orderSignature.js +50 -0
  495. package/dist/native/ingest/orderSignature.js.map +1 -0
  496. package/dist/native/ingest/referrer.js +30 -32
  497. package/dist/native/ingest/referrer.js.map +1 -1
  498. package/dist/native/ingest/requestHost.js +44 -0
  499. package/dist/native/ingest/requestHost.js.map +1 -0
  500. package/dist/native/ingest/resolveHostname.d.ts +20 -0
  501. package/dist/native/ingest/resolveHostname.js +51 -0
  502. package/dist/native/ingest/resolveHostname.js.map +1 -0
  503. package/dist/native/ingest/revenue.d.ts +1 -0
  504. package/dist/native/ingest/revenue.js +121 -0
  505. package/dist/native/ingest/revenue.js.map +1 -0
  506. package/dist/native/ingest/route.d.ts +10 -0
  507. package/dist/native/ingest/route.js +85 -0
  508. package/dist/native/ingest/route.js.map +1 -0
  509. package/dist/native/ingest/serverTrack.d.ts +2 -10
  510. package/dist/native/ingest/serverTrack.js +188 -69
  511. package/dist/native/ingest/serverTrack.js.map +1 -1
  512. package/dist/native/ingest/signature.js +28 -0
  513. package/dist/native/ingest/signature.js.map +1 -0
  514. package/dist/native/ingest/source.d.ts +5 -2
  515. package/dist/native/ingest/source.js +163 -59
  516. package/dist/native/ingest/source.js.map +1 -1
  517. package/dist/native/ingest/utm.js +9 -9
  518. package/dist/native/ingest/utm.js.map +1 -1
  519. package/dist/native/ingest/validate.js +25 -13
  520. package/dist/native/ingest/validate.js.map +1 -1
  521. package/dist/native/ingest/visitorHash.js +6 -8
  522. package/dist/native/ingest/visitorHash.js.map +1 -1
  523. package/dist/native/nativeAdapter.d.ts +128 -9
  524. package/dist/native/nativeAdapter.js +396 -288
  525. package/dist/native/nativeAdapter.js.map +1 -1
  526. package/dist/native/rebuildDays.d.ts +12 -0
  527. package/dist/native/rebuildDays.js +16 -0
  528. package/dist/native/rebuildDays.js.map +1 -0
  529. package/dist/native/store/aggregate.js +450 -0
  530. package/dist/native/store/aggregate.js.map +1 -0
  531. package/dist/native/store/caps.d.ts +18 -0
  532. package/dist/native/store/caps.js +76 -0
  533. package/dist/native/store/caps.js.map +1 -0
  534. package/dist/native/store/chunks.js +34 -0
  535. package/dist/native/store/chunks.js.map +1 -0
  536. package/dist/native/store/columnValues.js +31 -0
  537. package/dist/native/store/columnValues.js.map +1 -0
  538. package/dist/native/store/dialect.js +106 -0
  539. package/dist/native/store/dialect.js.map +1 -0
  540. package/dist/native/store/eventStore.js +44 -0
  541. package/dist/native/store/eventStore.js.map +1 -0
  542. package/dist/native/store/hitRow.js +119 -0
  543. package/dist/native/store/hitRow.js.map +1 -0
  544. package/dist/native/store/hits.js +65 -0
  545. package/dist/native/store/hits.js.map +1 -0
  546. package/dist/native/store/ids.js +105 -0
  547. package/dist/native/store/ids.js.map +1 -0
  548. package/dist/native/store/mongo/aggregatePipelines.js +438 -0
  549. package/dist/native/store/mongo/aggregatePipelines.js.map +1 -0
  550. package/dist/native/store/mongo/mongoState.js +375 -0
  551. package/dist/native/store/mongo/mongoState.js.map +1 -0
  552. package/dist/native/store/mongo/mongoStore.js +618 -0
  553. package/dist/native/store/mongo/mongoStore.js.map +1 -0
  554. package/dist/native/store/mongo/pipelines.js +705 -0
  555. package/dist/native/store/mongo/pipelines.js.map +1 -0
  556. package/dist/native/store/mongo/results.js +20 -0
  557. package/dist/native/store/mongo/results.js.map +1 -0
  558. package/dist/native/store/parts.d.ts +1 -0
  559. package/dist/native/store/parts.js +101 -0
  560. package/dist/native/store/parts.js.map +1 -0
  561. package/dist/native/store/pattern.js +213 -0
  562. package/dist/native/store/pattern.js.map +1 -0
  563. package/dist/native/store/rawRead.d.ts +23 -0
  564. package/dist/native/store/rawRead.js +387 -0
  565. package/dist/native/store/rawRead.js.map +1 -0
  566. package/dist/native/store/reclassify.js +53 -0
  567. package/dist/native/store/reclassify.js.map +1 -0
  568. package/dist/native/store/sql/aggregateSql.js +349 -0
  569. package/dist/native/store/sql/aggregateSql.js.map +1 -0
  570. package/dist/native/store/sql/columns.js +49 -0
  571. package/dist/native/store/sql/columns.js.map +1 -0
  572. package/dist/native/store/sql/compile.js +668 -0
  573. package/dist/native/store/sql/compile.js.map +1 -0
  574. package/dist/native/store/sql/drivers.js +218 -0
  575. package/dist/native/store/sql/drivers.js.map +1 -0
  576. package/dist/native/store/sql/executor.js +132 -0
  577. package/dist/native/store/sql/executor.js.map +1 -0
  578. package/dist/native/store/sql/fragment.js +104 -0
  579. package/dist/native/store/sql/fragment.js.map +1 -0
  580. package/dist/native/store/sql/maintenanceSql.js +59 -0
  581. package/dist/native/store/sql/maintenanceSql.js.map +1 -0
  582. package/dist/native/store/sql/ownConnection.js +107 -0
  583. package/dist/native/store/sql/ownConnection.js.map +1 -0
  584. package/dist/native/store/sql/poolShare.js +101 -0
  585. package/dist/native/store/sql/poolShare.js.map +1 -0
  586. package/dist/native/store/sql/sqlState.js +325 -0
  587. package/dist/native/store/sql/sqlState.js.map +1 -0
  588. package/dist/native/store/sql/sqlStore.js +355 -0
  589. package/dist/native/store/sql/sqlStore.js.map +1 -0
  590. package/dist/native/store/sql/sqliteThread.d.ts +9 -0
  591. package/dist/native/store/sql/sqliteThread.js +314 -0
  592. package/dist/native/store/sql/sqliteThread.js.map +1 -0
  593. package/dist/native/store/sql/sqliteWorker.js +327 -0
  594. package/dist/native/store/sql/sqliteWorker.js.map +1 -0
  595. package/dist/native/store/sql/sqliteWorkerSource.js +347 -0
  596. package/dist/native/store/sql/sqliteWorkerSource.js.map +1 -0
  597. package/dist/native/store/state.js +151 -0
  598. package/dist/native/store/state.js.map +1 -0
  599. package/dist/native/store/stateStore.js +29 -0
  600. package/dist/native/store/stateStore.js.map +1 -0
  601. package/dist/native/store/types.d.ts +15 -0
  602. package/dist/native/store/types.js +10 -0
  603. package/dist/native/store/types.js.map +1 -0
  604. package/dist/native/tasks/maintainTask.d.ts +19 -0
  605. package/dist/native/tasks/maintainTask.js +57 -0
  606. package/dist/native/tasks/maintainTask.js.map +1 -0
  607. package/dist/net/guardedFetch.d.ts +32 -0
  608. package/dist/net/guardedFetch.js +220 -0
  609. package/dist/net/guardedFetch.js.map +1 -0
  610. package/dist/net/origin.js +40 -0
  611. package/dist/net/origin.js.map +1 -0
  612. package/dist/net/platform.d.ts +9 -0
  613. package/dist/net/platform.js +35 -0
  614. package/dist/net/platform.js.map +1 -0
  615. package/dist/plugin/adminDependencies.js +34 -0
  616. package/dist/plugin/adminDependencies.js.map +1 -0
  617. package/dist/plugin/apiPath.js +23 -0
  618. package/dist/plugin/apiPath.js.map +1 -0
  619. package/dist/plugin/boundDocument.js +58 -0
  620. package/dist/plugin/boundDocument.js.map +1 -0
  621. package/dist/plugin/buildPhase.js +10 -0
  622. package/dist/plugin/buildPhase.js.map +1 -0
  623. package/dist/plugin/collectionChecks.js +232 -0
  624. package/dist/plugin/collectionChecks.js.map +1 -0
  625. package/dist/plugin/collectionFields.d.ts +13 -0
  626. package/dist/plugin/collectionFields.js +22 -0
  627. package/dist/plugin/collectionFields.js.map +1 -0
  628. package/dist/plugin/createRuntime.js +346 -0
  629. package/dist/plugin/createRuntime.js.map +1 -0
  630. package/dist/plugin/destroy.js +58 -0
  631. package/dist/plugin/destroy.js.map +1 -0
  632. package/dist/plugin/documentEndpoint.js +105 -71
  633. package/dist/plugin/documentEndpoint.js.map +1 -1
  634. package/dist/plugin/documentScopes.js +37 -0
  635. package/dist/plugin/documentScopes.js.map +1 -0
  636. package/dist/plugin/encrypted.js +25 -0
  637. package/dist/plugin/encrypted.js.map +1 -0
  638. package/dist/plugin/errors.d.ts +24 -0
  639. package/dist/plugin/errors.js +86 -0
  640. package/dist/plugin/errors.js.map +1 -0
  641. package/dist/plugin/flagsEndpoint.js +41 -0
  642. package/dist/plugin/flagsEndpoint.js.map +1 -0
  643. package/dist/plugin/goalHint.js +22 -11
  644. package/dist/plugin/goalHint.js.map +1 -1
  645. package/dist/plugin/itemLabels.js +114 -0
  646. package/dist/plugin/itemLabels.js.map +1 -0
  647. package/dist/plugin/keepAlive.js +48 -0
  648. package/dist/plugin/keepAlive.js.map +1 -0
  649. package/dist/plugin/peerImportError.js +3 -6
  650. package/dist/plugin/peerImportError.js.map +1 -1
  651. package/dist/plugin/peers.js +64 -0
  652. package/dist/plugin/peers.js.map +1 -0
  653. package/dist/plugin/pluginCollections.js +161 -0
  654. package/dist/plugin/pluginCollections.js.map +1 -0
  655. package/dist/plugin/queryEndpoint.js +80 -51
  656. package/dist/plugin/queryEndpoint.js.map +1 -1
  657. package/dist/plugin/queryParams.js +7 -0
  658. package/dist/plugin/queryParams.js.map +1 -0
  659. package/dist/plugin/readContextForRequest.d.ts +11 -0
  660. package/dist/plugin/readContextForRequest.js +79 -32
  661. package/dist/plugin/readContextForRequest.js.map +1 -1
  662. package/dist/plugin/readFailure.js +22 -0
  663. package/dist/plugin/readFailure.js.map +1 -0
  664. package/dist/plugin/readableProviders.js +67 -0
  665. package/dist/plugin/readableProviders.js.map +1 -0
  666. package/dist/plugin/realtimeEndpoint.js +79 -34
  667. package/dist/plugin/realtimeEndpoint.js.map +1 -1
  668. package/dist/plugin/refreshEndpoint.js +138 -0
  669. package/dist/plugin/refreshEndpoint.js.map +1 -0
  670. package/dist/plugin/relabelFields.js +36 -0
  671. package/dist/plugin/relabelFields.js.map +1 -0
  672. package/dist/plugin/requestMemo.js +35 -0
  673. package/dist/plugin/requestMemo.js.map +1 -0
  674. package/dist/plugin/routeChecks.js +39 -0
  675. package/dist/plugin/routeChecks.js.map +1 -0
  676. package/dist/plugin/routes.d.ts +53 -0
  677. package/dist/plugin/routes.js +92 -0
  678. package/dist/plugin/routes.js.map +1 -0
  679. package/dist/plugin/runtime.d.ts +1 -1
  680. package/dist/plugin/runtime.js +235 -29
  681. package/dist/plugin/runtime.js.map +1 -1
  682. package/dist/plugin/schemaOnly.js +61 -0
  683. package/dist/plugin/schemaOnly.js.map +1 -0
  684. package/dist/plugin/scopeChange.js +23 -0
  685. package/dist/plugin/scopeChange.js.map +1 -0
  686. package/dist/plugin/scopeFieldBoot.js +4 -4
  687. package/dist/plugin/scopeFieldBoot.js.map +1 -1
  688. package/dist/plugin/scopeToken.js +33 -0
  689. package/dist/plugin/scopeToken.js.map +1 -0
  690. package/dist/plugin/sourcesEndpoint.js +50 -23
  691. package/dist/plugin/sourcesEndpoint.js.map +1 -1
  692. package/dist/plugin/unbundledLanguages.js +25 -0
  693. package/dist/plugin/unbundledLanguages.js.map +1 -0
  694. package/dist/plugin/walkFields.js +24 -0
  695. package/dist/plugin/walkFields.js.map +1 -0
  696. package/dist/plugin/warmTask.js +0 -0
  697. package/dist/plugin/warmTask.js.map +1 -1
  698. package/dist/providers/ProvidersListNotice.d.ts +11 -0
  699. package/dist/providers/ProvidersListNotice.js +36 -0
  700. package/dist/providers/ProvidersListNotice.js.map +1 -0
  701. package/dist/providers/access.d.ts +1 -0
  702. package/dist/providers/access.js +35 -26
  703. package/dist/providers/access.js.map +1 -1
  704. package/dist/providers/adapterPool.js +121 -0
  705. package/dist/providers/adapterPool.js.map +1 -0
  706. package/dist/providers/collection.d.ts +63 -0
  707. package/dist/providers/collection.js +369 -150
  708. package/dist/providers/collection.js.map +1 -1
  709. package/dist/providers/factory.d.ts +84 -0
  710. package/dist/providers/factory.js +84 -25
  711. package/dist/providers/factory.js.map +1 -1
  712. package/dist/providers/hosts.d.ts +25 -0
  713. package/dist/providers/hosts.js +128 -0
  714. package/dist/providers/hosts.js.map +1 -0
  715. package/dist/providers/probe.d.ts +1 -0
  716. package/dist/providers/probe.js +105 -0
  717. package/dist/providers/probe.js.map +1 -0
  718. package/dist/providers/refresh.d.ts +18 -0
  719. package/dist/providers/refresh.js +49 -0
  720. package/dist/providers/refresh.js.map +1 -0
  721. package/dist/providers/registry.js +329 -0
  722. package/dist/providers/registry.js.map +1 -0
  723. package/dist/providers/resolver.js +26 -88
  724. package/dist/providers/resolver.js.map +1 -1
  725. package/dist/providers/retarget.js +45 -0
  726. package/dist/providers/retarget.js.map +1 -0
  727. package/dist/providers/scopeUnique.js +41 -0
  728. package/dist/providers/scopeUnique.js.map +1 -0
  729. package/dist/providers/secrets.d.ts +26 -0
  730. package/dist/providers/secrets.js +61 -4
  731. package/dist/providers/secrets.js.map +1 -1
  732. package/dist/providers/stampScope.js +9 -6
  733. package/dist/providers/stampScope.js.map +1 -1
  734. package/dist/query/dates.js +10 -12
  735. package/dist/query/dates.js.map +1 -1
  736. package/dist/query/errors.d.ts +6 -13
  737. package/dist/query/fetchQuery.d.ts +36 -23
  738. package/dist/query/fetchQuery.js +96 -89
  739. package/dist/query/fetchQuery.js.map +1 -1
  740. package/dist/query/limits.js +8 -0
  741. package/dist/query/limits.js.map +1 -0
  742. package/dist/query/parse.d.ts +8 -2
  743. package/dist/query/parse.js +155 -108
  744. package/dist/query/parse.js.map +1 -1
  745. package/dist/query/response.d.ts +23 -3
  746. package/dist/query/response.js +12 -5
  747. package/dist/query/response.js.map +1 -1
  748. package/dist/react/AnalyticsProvider.d.ts +42 -20
  749. package/dist/react/AnalyticsProvider.js +24 -22
  750. package/dist/react/AnalyticsProvider.js.map +1 -1
  751. package/dist/react/TrackerBoot.js +15 -9
  752. package/dist/react/TrackerBoot.js.map +1 -1
  753. package/dist/react/useAnalytics.d.ts +2 -8
  754. package/dist/react/useAnalytics.js +31 -13
  755. package/dist/react/useAnalytics.js.map +1 -1
  756. package/dist/routes/captureRoute.d.ts +28 -0
  757. package/dist/routes/captureRoute.js +67 -0
  758. package/dist/routes/captureRoute.js.map +1 -0
  759. package/dist/routes/ingestRoute.d.ts +17 -0
  760. package/dist/routes/ingestRoute.js +17 -0
  761. package/dist/routes/ingestRoute.js.map +1 -0
  762. package/dist/site/AnalyticsScripts.d.ts +35 -0
  763. package/dist/site/AnalyticsScripts.js +44 -0
  764. package/dist/site/AnalyticsScripts.js.map +1 -0
  765. package/dist/site/getTrackerConfig.d.ts +15 -0
  766. package/dist/site/getTrackerConfig.js +43 -0
  767. package/dist/site/getTrackerConfig.js.map +1 -0
  768. package/dist/surfacing/afterRead.d.ts +37 -0
  769. package/dist/surfacing/bounded.js +38 -0
  770. package/dist/surfacing/bounded.js.map +1 -0
  771. package/dist/surfacing/breaker.js +107 -0
  772. package/dist/surfacing/breaker.js.map +1 -0
  773. package/dist/surfacing/cacheCollection.d.ts +8 -0
  774. package/dist/surfacing/cacheCollection.js +71 -0
  775. package/dist/surfacing/cacheCollection.js.map +1 -0
  776. package/dist/surfacing/cacheStore.d.ts +71 -1
  777. package/dist/surfacing/cacheStore.js +16 -37
  778. package/dist/surfacing/cacheStore.js.map +1 -1
  779. package/dist/surfacing/cacheSweep.d.ts +1 -0
  780. package/dist/surfacing/cacheSweep.js +59 -0
  781. package/dist/surfacing/cacheSweep.js.map +1 -0
  782. package/dist/surfacing/classifyError.js +282 -0
  783. package/dist/surfacing/classifyError.js.map +1 -0
  784. package/dist/surfacing/coalesce.js +2 -1
  785. package/dist/surfacing/coalesce.js.map +1 -1
  786. package/dist/surfacing/coldBudget.js +60 -0
  787. package/dist/surfacing/coldBudget.js.map +1 -0
  788. package/dist/surfacing/collectionCacheStore.js +183 -0
  789. package/dist/surfacing/collectionCacheStore.js.map +1 -0
  790. package/dist/surfacing/engine.d.ts +1 -1
  791. package/dist/surfacing/engine.js +514 -71
  792. package/dist/surfacing/engine.js.map +1 -1
  793. package/dist/surfacing/epoch.d.ts +1 -0
  794. package/dist/surfacing/epoch.js +116 -0
  795. package/dist/surfacing/epoch.js.map +1 -0
  796. package/dist/surfacing/lanes.d.ts +1 -0
  797. package/dist/surfacing/lanes.js +297 -0
  798. package/dist/surfacing/lanes.js.map +1 -0
  799. package/dist/surfacing/memo.js +40 -0
  800. package/dist/surfacing/memo.js.map +1 -0
  801. package/dist/surfacing/rateLimiter.d.ts +1 -0
  802. package/dist/surfacing/rateLimiter.js +69 -94
  803. package/dist/surfacing/rateLimiter.js.map +1 -1
  804. package/dist/surfacing/rebucket.js +178 -0
  805. package/dist/surfacing/rebucket.js.map +1 -0
  806. package/dist/surfacing/recipe.js +28 -0
  807. package/dist/surfacing/recipe.js.map +1 -0
  808. package/dist/surfacing/shape.js +22 -0
  809. package/dist/surfacing/shape.js.map +1 -0
  810. package/dist/surfacing/todaySplit.js +119 -0
  811. package/dist/surfacing/todaySplit.js.map +1 -0
  812. package/dist/sync/collection.d.ts +8 -0
  813. package/dist/sync/collection.js +30 -18
  814. package/dist/sync/collection.js.map +1 -1
  815. package/dist/sync/rekeyDurations.js +70 -0
  816. package/dist/sync/rekeyDurations.js.map +1 -0
  817. package/dist/sync/syncTask.js +222 -109
  818. package/dist/sync/syncTask.js.map +1 -1
  819. package/dist/testing/memoryAdapter.d.ts +6 -3
  820. package/dist/testing/memoryAdapter.js +12 -10
  821. package/dist/testing/memoryAdapter.js.map +1 -1
  822. package/dist/testing/settle.d.ts +11 -0
  823. package/dist/testing/settle.js +19 -0
  824. package/dist/testing/settle.js.map +1 -0
  825. package/dist/timeframe/calendar.js +65 -0
  826. package/dist/timeframe/calendar.js.map +1 -0
  827. package/dist/timeframe/comparison.js +46 -0
  828. package/dist/timeframe/comparison.js.map +1 -0
  829. package/dist/timeframe/presets.d.ts +1 -1
  830. package/dist/timeframe/presets.js +5 -5
  831. package/dist/timeframe/presets.js.map +1 -1
  832. package/dist/timeframe/reportingTimezone.d.ts +1 -0
  833. package/dist/timeframe/reportingTimezone.js +64 -0
  834. package/dist/timeframe/reportingTimezone.js.map +1 -0
  835. package/dist/timeframe/tz.js +55 -39
  836. package/dist/timeframe/tz.js.map +1 -1
  837. package/dist/tracker/autoCapture.js +125 -38
  838. package/dist/tracker/autoCapture.js.map +1 -1
  839. package/dist/tracker/campaign.js +52 -0
  840. package/dist/tracker/campaign.js.map +1 -0
  841. package/dist/tracker/config.d.ts +174 -0
  842. package/dist/tracker/config.js +25 -0
  843. package/dist/tracker/config.js.map +1 -0
  844. package/dist/tracker/createTracker.d.ts +5 -10
  845. package/dist/tracker/createTracker.js +434 -91
  846. package/dist/tracker/createTracker.js.map +1 -1
  847. package/dist/tracker/digest.js +28 -0
  848. package/dist/tracker/digest.js.map +1 -0
  849. package/dist/tracker/engagement.js +100 -0
  850. package/dist/tracker/engagement.js.map +1 -0
  851. package/dist/tracker/events.js +37 -0
  852. package/dist/tracker/events.js.map +1 -0
  853. package/dist/tracker/exclusion.d.ts +8 -0
  854. package/dist/tracker/exclusion.js +82 -0
  855. package/dist/tracker/exclusion.js.map +1 -0
  856. package/dist/tracker/gate.d.ts +8 -0
  857. package/dist/tracker/gate.js +244 -0
  858. package/dist/tracker/gate.js.map +1 -0
  859. package/dist/tracker/initTracker.d.ts +5 -8
  860. package/dist/tracker/initTracker.js +42 -14
  861. package/dist/tracker/initTracker.js.map +1 -1
  862. package/dist/tracker/itemCapture.js +224 -0
  863. package/dist/tracker/itemCapture.js.map +1 -0
  864. package/dist/tracker/loadScript.js +23 -15
  865. package/dist/tracker/loadScript.js.map +1 -1
  866. package/dist/tracker/pageTracking.js +6 -6
  867. package/dist/tracker/pageTracking.js.map +1 -1
  868. package/dist/tracker/registry.js +129 -30
  869. package/dist/tracker/registry.js.map +1 -1
  870. package/dist/tracker/sinks/createSink.js +60 -0
  871. package/dist/tracker/sinks/createSink.js.map +1 -0
  872. package/dist/tracker/sinks/ga4.js +97 -17
  873. package/dist/tracker/sinks/ga4.js.map +1 -1
  874. package/dist/tracker/sinks/native.js +21 -42
  875. package/dist/tracker/sinks/native.js.map +1 -1
  876. package/dist/tracker/sinks/plausible.js +36 -18
  877. package/dist/tracker/sinks/plausible.js.map +1 -1
  878. package/dist/tracker/sinks/posthog.js +145 -9
  879. package/dist/tracker/sinks/posthog.js.map +1 -1
  880. package/dist/tracker/sinks/umami.js +18 -10
  881. package/dist/tracker/sinks/umami.js.map +1 -1
  882. package/dist/tracker/sinks/vendor.js +54 -22
  883. package/dist/tracker/sinks/vendor.js.map +1 -1
  884. package/dist/tracker/skip.js +81 -0
  885. package/dist/tracker/skip.js.map +1 -0
  886. package/dist/tracker/storage.js +23 -0
  887. package/dist/tracker/storage.js.map +1 -0
  888. package/dist/tracker/transport.js +2 -5
  889. package/dist/tracker/transport.js.map +1 -1
  890. package/dist/tracker/types.d.ts +99 -49
  891. package/dist/tracker/window.js +7 -0
  892. package/dist/tracker/window.js.map +1 -0
  893. package/dist/translations/ar.js +255 -74
  894. package/dist/translations/ar.js.map +1 -1
  895. package/dist/translations/de.js +243 -71
  896. package/dist/translations/de.js.map +1 -1
  897. package/dist/translations/en.js +238 -70
  898. package/dist/translations/en.js.map +1 -1
  899. package/dist/translations/es.js +246 -71
  900. package/dist/translations/es.js.map +1 -1
  901. package/dist/translations/fr.js +250 -75
  902. package/dist/translations/fr.js.map +1 -1
  903. package/dist/translations/id.js +241 -70
  904. package/dist/translations/id.js.map +1 -1
  905. package/dist/translations/index.d.ts +1 -1
  906. package/dist/translations/index.js +5 -7
  907. package/dist/translations/index.js.map +1 -1
  908. package/dist/translations/intl.js +71 -0
  909. package/dist/translations/intl.js.map +1 -0
  910. package/dist/translations/keys.d.ts +214 -17
  911. package/dist/translations/keys.js +219 -17
  912. package/dist/translations/keys.js.map +1 -1
  913. package/dist/translations/ko.js +243 -72
  914. package/dist/translations/ko.js.map +1 -1
  915. package/dist/translations/labelMap.d.ts +10 -0
  916. package/dist/translations/labelMap.js +22 -0
  917. package/dist/translations/labelMap.js.map +1 -0
  918. package/dist/translations/metricKeys.js +10 -2
  919. package/dist/translations/metricKeys.js.map +1 -1
  920. package/dist/translations/parts.js +20 -0
  921. package/dist/translations/parts.js.map +1 -0
  922. package/dist/translations/plural.js +61 -0
  923. package/dist/translations/plural.js.map +1 -0
  924. package/dist/translations/pt.js +255 -80
  925. package/dist/translations/pt.js.map +1 -1
  926. package/dist/translations/ru.js +246 -69
  927. package/dist/translations/ru.js.map +1 -1
  928. package/dist/translations/server.d.ts +1 -0
  929. package/dist/translations/server.js +2 -3
  930. package/dist/translations/server.js.map +1 -1
  931. package/dist/translations/staticLabel.js +69 -0
  932. package/dist/translations/staticLabel.js.map +1 -0
  933. package/dist/translations/uk.js +246 -69
  934. package/dist/translations/uk.js.map +1 -1
  935. package/dist/translations/zh.js +241 -70
  936. package/dist/translations/zh.js.map +1 -1
  937. package/dist/ui/RangePicker.js +110 -0
  938. package/dist/ui/RangePicker.js.map +1 -0
  939. package/dist/ui/analytics.css +1667 -0
  940. package/dist/ui/calendarDays.js +27 -0
  941. package/dist/ui/calendarDays.js.map +1 -0
  942. package/dist/ui/classNames.js +7 -0
  943. package/dist/ui/classNames.js.map +1 -0
  944. package/dist/ui/components/Card.d.ts +28 -0
  945. package/dist/ui/components/Card.js +21 -0
  946. package/dist/ui/components/Card.js.map +1 -0
  947. package/dist/ui/components/ChartDataTable.d.ts +41 -0
  948. package/dist/ui/components/ChartDataTable.js +48 -0
  949. package/dist/ui/components/ChartDataTable.js.map +1 -0
  950. package/dist/ui/components/ChoiceMenu.js +48 -0
  951. package/dist/ui/components/ChoiceMenu.js.map +1 -0
  952. package/dist/ui/components/DataTable.d.ts +82 -0
  953. package/dist/ui/components/DataTable.js +214 -0
  954. package/dist/ui/components/DataTable.js.map +1 -0
  955. package/dist/ui/components/LabeledSelect.js +62 -0
  956. package/dist/ui/components/LabeledSelect.js.map +1 -0
  957. package/dist/ui/components/LiveAnnouncement.js +21 -0
  958. package/dist/ui/components/LiveAnnouncement.js.map +1 -0
  959. package/dist/ui/components/MetricCard.d.ts +38 -0
  960. package/dist/ui/components/MetricCard.js +39 -0
  961. package/dist/ui/components/MetricCard.js.map +1 -0
  962. package/dist/ui/components/NoValue.js +22 -0
  963. package/dist/ui/components/NoValue.js.map +1 -0
  964. package/dist/ui/components/ReadState.js +27 -0
  965. package/dist/ui/components/ReadState.js.map +1 -0
  966. package/dist/ui/components/RefreshButton.js +25 -0
  967. package/dist/ui/components/RefreshButton.js.map +1 -0
  968. package/dist/ui/components/SourcesNoticeBanner.js +20 -0
  969. package/dist/ui/components/SourcesNoticeBanner.js.map +1 -0
  970. package/dist/ui/cssVars.js +7 -0
  971. package/dist/ui/cssVars.js.map +1 -0
  972. package/dist/ui/data/WithScopeToken.d.ts +20 -0
  973. package/dist/ui/data/WithScopeToken.js +20 -0
  974. package/dist/ui/data/WithScopeToken.js.map +1 -0
  975. package/dist/ui/data/clientFieldProps.js +16 -0
  976. package/dist/ui/data/clientFieldProps.js.map +1 -0
  977. package/dist/ui/data/request.d.ts +46 -0
  978. package/dist/ui/data/request.js +119 -0
  979. package/dist/ui/data/request.js.map +1 -0
  980. package/dist/ui/data/scopeTokenContext.js +18 -0
  981. package/dist/ui/data/scopeTokenContext.js.map +1 -0
  982. package/dist/ui/data/sharedCache.js +48 -0
  983. package/dist/ui/data/sharedCache.js.map +1 -0
  984. package/dist/ui/data/useRequest.d.ts +19 -0
  985. package/dist/ui/data/useRequest.js +123 -0
  986. package/dist/ui/data/useRequest.js.map +1 -0
  987. package/dist/ui/data/useRequestScope.js +25 -0
  988. package/dist/ui/data/useRequestScope.js.map +1 -0
  989. package/dist/ui/hooks/useDirection.js +47 -0
  990. package/dist/ui/hooks/useDirection.js.map +1 -0
  991. package/dist/ui/hooks/useDismissOnEscape.js +25 -0
  992. package/dist/ui/hooks/useDismissOnEscape.js.map +1 -0
  993. package/dist/ui/hooks/useLiveAnnouncement.js +57 -0
  994. package/dist/ui/hooks/useLiveAnnouncement.js.map +1 -0
  995. package/dist/ui/hooks/useRealtimePoll.js +112 -0
  996. package/dist/ui/hooks/useRealtimePoll.js.map +1 -0
  997. package/dist/ui/readState.js +19 -0
  998. package/dist/ui/readState.js.map +1 -0
  999. package/dist/ui/rows/toDisplayRows.js +49 -0
  1000. package/dist/ui/rows/toDisplayRows.js.map +1 -0
  1001. package/dist/ui/viewerClock.js +7 -0
  1002. package/dist/ui/viewerClock.js.map +1 -0
  1003. package/dist/view/AnalyticsNavLink.d.ts +5 -3
  1004. package/dist/view/AnalyticsNavLink.js +12 -8
  1005. package/dist/view/AnalyticsNavLink.js.map +1 -1
  1006. package/dist/view/AnalyticsView.d.ts +9 -10
  1007. package/dist/view/AnalyticsView.js +47 -19
  1008. package/dist/view/AnalyticsView.js.map +1 -1
  1009. package/dist/view/AnalyticsViewClient.d.ts +4 -7
  1010. package/dist/view/AnalyticsViewClient.js +15 -185
  1011. package/dist/view/AnalyticsViewClient.js.map +1 -1
  1012. package/dist/view/CountryFlag.d.ts +27 -0
  1013. package/dist/view/CountryFlag.js +44 -0
  1014. package/dist/view/CountryFlag.js.map +1 -0
  1015. package/dist/view/DocumentTitle.js +27 -0
  1016. package/dist/view/DocumentTitle.js.map +1 -0
  1017. package/dist/view/ViewRoot.d.ts +21 -0
  1018. package/dist/view/ViewRoot.js +155 -0
  1019. package/dist/view/ViewRoot.js.map +1 -0
  1020. package/dist/view/ViewSections.d.ts +38 -0
  1021. package/dist/view/ViewSections.js +190 -0
  1022. package/dist/view/ViewSections.js.map +1 -0
  1023. package/dist/view/authRedirect.js +2 -4
  1024. package/dist/view/authRedirect.js.map +1 -1
  1025. package/dist/view/consentShare.js +15 -0
  1026. package/dist/view/consentShare.js.map +1 -0
  1027. package/dist/view/conversionRate.js +9 -7
  1028. package/dist/view/conversionRate.js.map +1 -1
  1029. package/dist/view/dayRange.js +6 -10
  1030. package/dist/view/dayRange.js.map +1 -1
  1031. package/dist/view/exclusionLink.d.ts +27 -0
  1032. package/dist/view/exclusionLink.js +46 -0
  1033. package/dist/view/exclusionLink.js.map +1 -0
  1034. package/dist/view/flagSrc.js +14 -0
  1035. package/dist/view/flagSrc.js.map +1 -0
  1036. package/dist/view/gating.d.ts +15 -1
  1037. package/dist/view/gating.js +67 -32
  1038. package/dist/view/gating.js.map +1 -1
  1039. package/dist/view/hostCountryFlag.js +41 -0
  1040. package/dist/view/hostCountryFlag.js.map +1 -0
  1041. package/dist/view/labels.js +113 -16
  1042. package/dist/view/labels.js.map +1 -1
  1043. package/dist/view/metricAliases.js +10 -0
  1044. package/dist/view/metricAliases.js.map +1 -0
  1045. package/dist/view/navLabel.js +15 -0
  1046. package/dist/view/navLabel.js.map +1 -0
  1047. package/dist/view/registerView.js +13 -11
  1048. package/dist/view/registerView.js.map +1 -1
  1049. package/dist/view/scopeLabel.js +21 -0
  1050. package/dist/view/scopeLabel.js.map +1 -0
  1051. package/dist/view/sections/Breakdowns.js +195 -132
  1052. package/dist/view/sections/Breakdowns.js.map +1 -1
  1053. package/dist/view/sections/EmptyStates.js +120 -32
  1054. package/dist/view/sections/EmptyStates.js.map +1 -1
  1055. package/dist/view/sections/ExcludeBrowser.js +188 -0
  1056. package/dist/view/sections/ExcludeBrowser.js.map +1 -0
  1057. package/dist/view/sections/FilterChips.js +127 -27
  1058. package/dist/view/sections/FilterChips.js.map +1 -1
  1059. package/dist/view/sections/GoalsPanel.js +68 -60
  1060. package/dist/view/sections/GoalsPanel.js.map +1 -1
  1061. package/dist/view/sections/OverviewCards.js +42 -36
  1062. package/dist/view/sections/OverviewCards.js.map +1 -1
  1063. package/dist/view/sections/RealtimeStrip.js +70 -59
  1064. package/dist/view/sections/RealtimeStrip.js.map +1 -1
  1065. package/dist/view/sections/SectionBoundary.js +34 -0
  1066. package/dist/view/sections/SectionBoundary.js.map +1 -0
  1067. package/dist/view/sections/Toolbar.d.ts +11 -0
  1068. package/dist/view/sections/Toolbar.js +181 -122
  1069. package/dist/view/sections/Toolbar.js.map +1 -1
  1070. package/dist/view/sections/Trend.js +176 -76
  1071. package/dist/view/sections/Trend.js.map +1 -1
  1072. package/dist/view/state.d.ts +42 -0
  1073. package/dist/view/state.js +93 -54
  1074. package/dist/view/state.js.map +1 -1
  1075. package/dist/view/useViewClock.js +31 -0
  1076. package/dist/view/useViewClock.js.map +1 -0
  1077. package/dist/view/useViewQueries.d.ts +21 -0
  1078. package/dist/view/useViewQueries.js +45 -77
  1079. package/dist/view/useViewQueries.js.map +1 -1
  1080. package/dist/view/useViewState.js +42 -0
  1081. package/dist/view/useViewState.js.map +1 -0
  1082. package/dist/view/useViewUrl.js +52 -0
  1083. package/dist/view/useViewUrl.js.map +1 -0
  1084. package/dist/view/viewBody.js +30 -0
  1085. package/dist/view/viewBody.js.map +1 -0
  1086. package/dist/view/viewContext.d.ts +81 -0
  1087. package/dist/view/viewContext.js +49 -0
  1088. package/dist/view/viewContext.js.map +1 -0
  1089. package/dist/view/viewProps.d.ts +65 -8
  1090. package/dist/view/viewProps.js +123 -36
  1091. package/dist/view/viewProps.js.map +1 -1
  1092. package/dist/widgets/AnalyticsBreakdownWidget.d.ts +7 -3
  1093. package/dist/widgets/AnalyticsBreakdownWidget.js +144 -118
  1094. package/dist/widgets/AnalyticsBreakdownWidget.js.map +1 -1
  1095. package/dist/widgets/AnalyticsGoalsWidget.d.ts +6 -7
  1096. package/dist/widgets/AnalyticsGoalsWidget.js +126 -167
  1097. package/dist/widgets/AnalyticsGoalsWidget.js.map +1 -1
  1098. package/dist/widgets/AnalyticsMetricWidget.d.ts +7 -3
  1099. package/dist/widgets/AnalyticsMetricWidget.js +81 -106
  1100. package/dist/widgets/AnalyticsMetricWidget.js.map +1 -1
  1101. package/dist/widgets/AnalyticsRealtimeWidget.d.ts +7 -3
  1102. package/dist/widgets/AnalyticsRealtimeWidget.js +81 -63
  1103. package/dist/widgets/AnalyticsRealtimeWidget.js.map +1 -1
  1104. package/dist/widgets/AnalyticsTrendWidget.d.ts +7 -3
  1105. package/dist/widgets/AnalyticsTrendWidget.js +130 -123
  1106. package/dist/widgets/AnalyticsTrendWidget.js.map +1 -1
  1107. package/dist/widgets/ComparisonDelta.js +33 -42
  1108. package/dist/widgets/ComparisonDelta.js.map +1 -1
  1109. package/dist/widgets/RealtimeCounter.d.ts +24 -4
  1110. package/dist/widgets/RealtimeCounter.js +90 -71
  1111. package/dist/widgets/RealtimeCounter.js.map +1 -1
  1112. package/dist/widgets/WidgetCard.d.ts +80 -0
  1113. package/dist/widgets/WidgetCard.js +99 -0
  1114. package/dist/widgets/WidgetCard.js.map +1 -0
  1115. package/dist/widgets/WidgetFrame.js +42 -0
  1116. package/dist/widgets/WidgetFrame.js.map +1 -0
  1117. package/dist/widgets/WidgetShimmer.d.ts +55 -0
  1118. package/dist/widgets/WidgetShimmer.js +86 -0
  1119. package/dist/widgets/WidgetShimmer.js.map +1 -0
  1120. package/dist/widgets/breakdownTypes.js +18 -2
  1121. package/dist/widgets/breakdownTypes.js.map +1 -1
  1122. package/dist/widgets/customWidget.d.ts +5 -1
  1123. package/dist/widgets/customWidget.js +6 -7
  1124. package/dist/widgets/customWidget.js.map +1 -1
  1125. package/dist/widgets/defaultLayout.d.ts +26 -0
  1126. package/dist/widgets/defaultLayout.js +51 -0
  1127. package/dist/widgets/defaultLayout.js.map +1 -0
  1128. package/dist/widgets/defaults.d.ts +4 -7
  1129. package/dist/widgets/defaults.js +12 -7
  1130. package/dist/widgets/defaults.js.map +1 -1
  1131. package/dist/widgets/fieldRows.js +14 -0
  1132. package/dist/widgets/fieldRows.js.map +1 -0
  1133. package/dist/widgets/filterCaption.js +6 -7
  1134. package/dist/widgets/filterCaption.js.map +1 -1
  1135. package/dist/widgets/filterField.d.ts +3 -7
  1136. package/dist/widgets/filterField.js +46 -35
  1137. package/dist/widgets/filterField.js.map +1 -1
  1138. package/dist/widgets/filterValueLabel.d.ts +1 -0
  1139. package/dist/widgets/filterValueLabel.js +45 -0
  1140. package/dist/widgets/filterValueLabel.js.map +1 -0
  1141. package/dist/widgets/notices.js +79 -0
  1142. package/dist/widgets/notices.js.map +1 -0
  1143. package/dist/widgets/prepareWidgetRead.d.ts +19 -2
  1144. package/dist/widgets/prepareWidgetRead.js +63 -27
  1145. package/dist/widgets/prepareWidgetRead.js.map +1 -1
  1146. package/dist/widgets/range.js +26 -21
  1147. package/dist/widgets/range.js.map +1 -1
  1148. package/dist/widgets/readForWidget.d.ts +28 -19
  1149. package/dist/widgets/readForWidget.js +33 -29
  1150. package/dist/widgets/readForWidget.js.map +1 -1
  1151. package/dist/widgets/readForWidgetBreakdown.d.ts +40 -29
  1152. package/dist/widgets/readForWidgetBreakdown.js +48 -22
  1153. package/dist/widgets/readForWidgetBreakdown.js.map +1 -1
  1154. package/dist/widgets/readForWidgetGoals.d.ts +18 -24
  1155. package/dist/widgets/readForWidgetGoals.js +52 -46
  1156. package/dist/widgets/readForWidgetGoals.js.map +1 -1
  1157. package/dist/widgets/readForWidgetRealtime.d.ts +22 -17
  1158. package/dist/widgets/readForWidgetRealtime.js +54 -27
  1159. package/dist/widgets/readForWidgetRealtime.js.map +1 -1
  1160. package/dist/widgets/readForWidgetSeries.d.ts +27 -32
  1161. package/dist/widgets/readForWidgetSeries.js +45 -82
  1162. package/dist/widgets/readForWidgetSeries.js.map +1 -1
  1163. package/dist/widgets/readMeta.d.ts +48 -0
  1164. package/dist/widgets/readMeta.js +52 -4
  1165. package/dist/widgets/readMeta.js.map +1 -1
  1166. package/dist/widgets/realtimePoll.d.ts +1 -0
  1167. package/dist/widgets/realtimePoll.js +56 -16
  1168. package/dist/widgets/realtimePoll.js.map +1 -1
  1169. package/dist/widgets/registerWidgets.js +207 -127
  1170. package/dist/widgets/registerWidgets.js.map +1 -1
  1171. package/dist/widgets/stateKeys.js +30 -0
  1172. package/dist/widgets/stateKeys.js.map +1 -0
  1173. package/dist/widgets/titleForecast.js +89 -0
  1174. package/dist/widgets/titleForecast.js.map +1 -0
  1175. package/dist/widgets/types.d.ts +4 -3
  1176. package/dist/widgets/types.js +2 -0
  1177. package/dist/widgets/types.js.map +1 -1
  1178. package/dist/widgets/viewLink.d.ts +24 -6
  1179. package/dist/widgets/viewLink.js +31 -24
  1180. package/dist/widgets/viewLink.js.map +1 -1
  1181. package/dist/widgets/widgetData.js +34 -0
  1182. package/dist/widgets/widgetData.js.map +1 -0
  1183. package/dist/widgets/widgetWindow.d.ts +1 -0
  1184. package/dist/widgets/widgetWindow.js +51 -0
  1185. package/dist/widgets/widgetWindow.js.map +1 -0
  1186. package/package.json +61 -42
  1187. package/dist/capture/getTrackerConfig.d.ts +0 -20
  1188. package/dist/capture/getTrackerConfig.js +0 -31
  1189. package/dist/capture/getTrackerConfig.js.map +0 -1
  1190. package/dist/capture/slots.d.ts +0 -8
  1191. package/dist/capture/trackerConfig.d.ts +0 -33
  1192. package/dist/charts/styles.js +0 -59
  1193. package/dist/charts/styles.js.map +0 -1
  1194. package/dist/exports/next.d.ts +0 -3
  1195. package/dist/exports/next.js +0 -3
  1196. package/dist/fields/config/SourceSelectField.d.ts +0 -14
  1197. package/dist/fields/dateRange/styles.js +0 -23
  1198. package/dist/fields/dateRange/styles.js.map +0 -1
  1199. package/dist/goals/GoalSelectField.d.ts +0 -7
  1200. package/dist/native/collections/events.js +0 -157
  1201. package/dist/native/collections/events.js.map +0 -1
  1202. package/dist/native/collections/rollups.js +0 -151
  1203. package/dist/native/collections/rollups.js.map +0 -1
  1204. package/dist/native/collections/seen.js +0 -47
  1205. package/dist/native/collections/seen.js.map +0 -1
  1206. package/dist/native/eventScan.js +0 -25
  1207. package/dist/native/eventScan.js.map +0 -1
  1208. package/dist/native/ingest/flushBatch.js +0 -60
  1209. package/dist/native/ingest/flushBatch.js.map +0 -1
  1210. package/dist/native/ingest/salt.js +0 -14
  1211. package/dist/native/ingest/salt.js.map +0 -1
  1212. package/dist/native/ingest/writeBuffer.js +0 -55
  1213. package/dist/native/ingest/writeBuffer.js.map +0 -1
  1214. package/dist/native/ingest/writeEvent.js +0 -14
  1215. package/dist/native/ingest/writeEvent.js.map +0 -1
  1216. package/dist/native/query/eventAgg.js +0 -174
  1217. package/dist/native/query/eventAgg.js.map +0 -1
  1218. package/dist/native/realtime/buildRealtime.js +0 -53
  1219. package/dist/native/realtime/buildRealtime.js.map +0 -1
  1220. package/dist/native/retention/pruneTask.js +0 -29
  1221. package/dist/native/retention/pruneTask.js.map +0 -1
  1222. package/dist/native/rollupAcc.js +0 -64
  1223. package/dist/native/rollupAcc.js.map +0 -1
  1224. package/dist/native/rollups/bucketKey.js +0 -15
  1225. package/dist/native/rollups/bucketKey.js.map +0 -1
  1226. package/dist/native/rollups/bumpRollups.js +0 -116
  1227. package/dist/native/rollups/bumpRollups.js.map +0 -1
  1228. package/dist/native/rollups/deltas.js +0 -105
  1229. package/dist/native/rollups/deltas.js.map +0 -1
  1230. package/dist/native/rollups/insertManyIfNew.js +0 -93
  1231. package/dist/native/rollups/insertManyIfNew.js.map +0 -1
  1232. package/dist/next/captureRewrites.d.ts +0 -42
  1233. package/dist/next/captureRewrites.js +0 -57
  1234. package/dist/next/captureRewrites.js.map +0 -1
  1235. package/dist/next/posthogProxyRewrites.d.ts +0 -41
  1236. package/dist/next/posthogProxyRewrites.js +0 -45
  1237. package/dist/next/posthogProxyRewrites.js.map +0 -1
  1238. package/dist/plugin/paths.js +0 -27
  1239. package/dist/plugin/paths.js.map +0 -1
  1240. package/dist/plugin/responses.js +0 -17
  1241. package/dist/plugin/responses.js.map +0 -1
  1242. package/dist/query/errors.js +0 -10
  1243. package/dist/query/errors.js.map +0 -1
  1244. package/dist/react/TrackerBoot.d.ts +0 -22
  1245. package/dist/rsc/AnalyticsScripts.d.ts +0 -30
  1246. package/dist/rsc/AnalyticsScripts.js +0 -41
  1247. package/dist/rsc/AnalyticsScripts.js.map +0 -1
  1248. package/dist/surfacing/queue.js +0 -60
  1249. package/dist/surfacing/queue.js.map +0 -1
  1250. package/dist/surfacing/retryPolicy.js +0 -15
  1251. package/dist/surfacing/retryPolicy.js.map +0 -1
  1252. package/dist/tracker/autoCapture.d.ts +0 -48
  1253. package/dist/tracker/consent.d.ts +0 -24
  1254. package/dist/tracker/consent.js +0 -48
  1255. package/dist/tracker/consent.js.map +0 -1
  1256. package/dist/tracker/loadScript.d.ts +0 -14
  1257. package/dist/tracker/pageTracking.d.ts +0 -17
  1258. package/dist/tracker/registry.d.ts +0 -27
  1259. package/dist/tracker/sinks/ga4.d.ts +0 -21
  1260. package/dist/tracker/sinks/native.d.ts +0 -22
  1261. package/dist/tracker/sinks/plausible.d.ts +0 -14
  1262. package/dist/tracker/sinks/posthog.d.ts +0 -14
  1263. package/dist/tracker/sinks/umami.d.ts +0 -13
  1264. package/dist/tracker/sinks/vendor.d.ts +0 -14
  1265. package/dist/view/sections/styles.js +0 -74
  1266. package/dist/view/sections/styles.js.map +0 -1
  1267. package/dist/widgets/WidgetViewLink.js +0 -17
  1268. package/dist/widgets/WidgetViewLink.js.map +0 -1
  1269. package/dist/widgets/cardChrome.d.ts +0 -8
  1270. package/dist/widgets/cardChrome.js +0 -46
  1271. package/dist/widgets/cardChrome.js.map +0 -1
  1272. package/dist/widgets/comparison.js +0 -57
  1273. package/dist/widgets/comparison.js.map +0 -1
@@ -1,14 +1,15 @@
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.platformRead`; the query reaches the adapter unscoped.
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; the registry request parsers validate against. */
7
+ /** Every breakdown key the contract defines, the list request parsers validate against. */
8
8
  const DIMENSION_KEYS = [
9
9
  "page",
10
10
  "referrer",
11
11
  "source",
12
+ "channel",
12
13
  "medium",
13
14
  "campaign",
14
15
  "utmSource",
@@ -24,9 +25,11 @@ const DIMENSION_KEYS = [
24
25
  "city",
25
26
  "language",
26
27
  "event",
27
- "goal"
28
+ "goal",
29
+ "currency",
30
+ "item"
28
31
  ];
29
- /** Every filter operator the contract defines; the registry request parsers validate against. */
32
+ /** Every filter operator the contract defines, the list request parsers validate against. */
30
33
  const FILTER_OPERATORS = [
31
34
  "eq",
32
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 { 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'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}\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 }\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;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\t/**\n\t\t * Pageviews of the read counted without consent, at a cookieless or anonymous level, which\n\t\t * the view shows as a share of all pageviews. Absent when the source cannot tell or found none.\n\t\t */\n\t\twithoutConsent?: { pageviews: number }\n\t\t/**\n\t\t * Pageviews of the read recorded without a visitor (native's anonymous level): they count as\n\t\t * pageviews, and toward no visitor, visit, bounce rate or time.\n\t\t */\n\t\twithoutVisitor?: { pageviews: number }\n\t\t/**\n\t\t * The vendor drops what a slot counts without consent, so those visits are missing from every\n\t\t * number: PostHog with its project's cookieless tracking setting off.\n\t\t */\n\t\twithoutConsentDropped?: 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 * False when this adapter fills no slot `capture.gate` holds that can count without consent, as\n\t * far as the boot can tell, so it need not check its vendor accepts such events. Absent reads as\n\t * true.\n\t */\n\tadapterCountsWithoutConsent?: boolean\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/** 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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cron.js","names":[],"sources":["../../src/core/cron.ts"],"sourcesContent":["import { DAY_MS, HOUR_MS, MINUTE_MS } from '../timeframe/tz'\n\nconst NICKNAMES: ReadonlyMap<string, number> = new Map([\n\t['@yearly', 366 * DAY_MS],\n\t['@annually', 366 * DAY_MS],\n\t['@monthly', 31 * DAY_MS],\n\t['@weekly', 7 * DAY_MS],\n\t['@daily', DAY_MS],\n\t['@midnight', DAY_MS],\n\t['@hourly', HOUR_MS],\n])\n\n/** What one field of a pattern may hold: numbers, names, `*`, steps, lists, ranges, `?`, `L`, `W`, `#`. */\nconst FIELD = /^[0-9A-Za-z*/,?#-]+$/\n\nconst NUMBER = /^\\d+$/\n\nconst STEP = /^\\*\\/(\\d+)$/\n\nconst fieldsOf = (pattern: string): string[] => pattern.trim().split(/\\s+/)\n\n/**\n * Whether `value` reads as a pattern Payload's scheduler takes: five fields, six with seconds\n * first, or a nickname such as `@hourly`. A shape check only; the scheduler parses it in full.\n */\nexport const isCronPattern = (value: unknown): value is string => {\n\tif (typeof value !== 'string' || value.trim() === '') {\n\t\treturn false\n\t}\n\tif (NICKNAMES.has(value.trim().toLowerCase())) {\n\t\treturn true\n\t}\n\tconst fields = fieldsOf(value)\n\treturn (fields.length === 5 || fields.length === 6) && fields.every((field) => FIELD.test(field))\n}\n\n/** A step that divides its cycle evenly, so every run is the same distance from the last. */\nconst evenStep = (field: string | undefined, cycle: number): number | null => {\n\tconst step = Number(STEP.exec(field ?? '')?.[1])\n\treturn Number.isInteger(step) && step > 0 && cycle % step === 0 ? step : null\n}\n\n/**\n * How far apart a simple pattern's runs fall: every minute, every n minutes or hours, hourly,\n * daily, or a nickname. Null for any other pattern, whose cadence is not read off it.\n */\nexport const cronIntervalMs = (pattern: string): number | null => {\n\tconst nickname = NICKNAMES.get(pattern.trim().toLowerCase())\n\tif (nickname !== undefined) {\n\t\treturn nickname\n\t}\n\tconst fields = fieldsOf(pattern)\n\tif (fields.length === 6 && !NUMBER.test(fields[0] ?? '')) {\n\t\treturn null\n\t}\n\tconst [minute, hour, dayOfMonth, month, dayOfWeek] =\n\t\tfields.length === 6 ? fields.slice(1) : fields\n\tif (fields.length < 5 || dayOfMonth !== '*' || month !== '*' || dayOfWeek !== '*') {\n\t\treturn null\n\t}\n\tif (hour === '*') {\n\t\tif (minute === '*') {\n\t\t\treturn MINUTE_MS\n\t\t}\n\t\tconst minutes = evenStep(minute, 60)\n\t\tif (minutes !== null) {\n\t\t\treturn minutes * MINUTE_MS\n\t\t}\n\t\treturn NUMBER.test(minute ?? '') ? HOUR_MS : null\n\t}\n\tif (!NUMBER.test(minute ?? '')) {\n\t\treturn null\n\t}\n\tconst hours = evenStep(hour, 24)\n\tif (hours !== null) {\n\t\treturn hours * HOUR_MS\n\t}\n\treturn NUMBER.test(hour ?? '') ? DAY_MS : null\n}\n"],"mappings":";;AAEA,MAAM,YAAyC,IAAI,IAAI;CACtD,CAAC,WAAW,MAAM,MAAM;CACxB,CAAC,aAAa,MAAM,MAAM;CAC1B,CAAC,YAAY,KAAK,MAAM;CACxB,CAAC,WAAW,IAAI,MAAM;CACtB,CAAC,UAAU,MAAM;CACjB,CAAC,aAAa,MAAM;CACpB,CAAC,WAAW,OAAO;AACpB,CAAC;;AAGD,MAAM,QAAQ;AAEd,MAAM,SAAS;AAEf,MAAM,OAAO;AAEb,MAAM,YAAY,YAA8B,QAAQ,KAAK,EAAE,MAAM,KAAK;;;;;AAM1E,MAAa,iBAAiB,UAAoC;CACjE,IAAI,OAAO,UAAU,YAAY,MAAM,KAAK,MAAM,IACjD,OAAO;CAER,IAAI,UAAU,IAAI,MAAM,KAAK,EAAE,YAAY,CAAC,GAC3C,OAAO;CAER,MAAM,SAAS,SAAS,KAAK;CAC7B,QAAQ,OAAO,WAAW,KAAK,OAAO,WAAW,MAAM,OAAO,OAAO,UAAU,MAAM,KAAK,KAAK,CAAC;AACjG;;AAGA,MAAM,YAAY,OAA2B,UAAiC;CAC7E,MAAM,OAAO,OAAO,KAAK,KAAK,SAAS,EAAE,IAAI,EAAE;CAC/C,OAAO,OAAO,UAAU,IAAI,KAAK,OAAO,KAAK,QAAQ,SAAS,IAAI,OAAO;AAC1E;;;;;AAMA,MAAa,kBAAkB,YAAmC;CACjE,MAAM,WAAW,UAAU,IAAI,QAAQ,KAAK,EAAE,YAAY,CAAC;CAC3D,IAAI,aAAa,KAAA,GAChB,OAAO;CAER,MAAM,SAAS,SAAS,OAAO;CAC/B,IAAI,OAAO,WAAW,KAAK,CAAC,OAAO,KAAK,OAAO,MAAM,EAAE,GACtD,OAAO;CAER,MAAM,CAAC,QAAQ,MAAM,YAAY,OAAO,aACvC,OAAO,WAAW,IAAI,OAAO,MAAM,CAAC,IAAI;CACzC,IAAI,OAAO,SAAS,KAAK,eAAe,OAAO,UAAU,OAAO,cAAc,KAC7E,OAAO;CAER,IAAI,SAAS,KAAK;EACjB,IAAI,WAAW,KACd,OAAO;EAER,MAAM,UAAU,SAAS,QAAQ,EAAE;EACnC,IAAI,YAAY,MACf,OAAO,UAAU;EAElB,OAAO,OAAO,KAAK,UAAU,EAAE,IAAI,UAAU;CAC9C;CACA,IAAI,CAAC,OAAO,KAAK,UAAU,EAAE,GAC5B,OAAO;CAER,MAAM,QAAQ,SAAS,MAAM,EAAE;CAC/B,IAAI,UAAU,MACb,OAAO,QAAQ;CAEhB,OAAO,OAAO,KAAK,QAAQ,EAAE,IAAI,SAAS;AAC3C"}
@@ -0,0 +1,17 @@
1
+ //#region src/core/fetch.d.ts
2
+ /** What the plugin's server code hands a fetch; the global `fetch` accepts all of it. */
3
+ interface FetchInit {
4
+ method?: string;
5
+ headers?: HeadersInit;
6
+ body?: string | ArrayBuffer | null;
7
+ signal?: AbortSignal | null;
8
+ redirect?: RequestRedirect;
9
+ }
10
+ /**
11
+ * A fetch the plugin reaches a vendor with: the global one, or the guarded one adapters built from
12
+ * provider documents use.
13
+ */
14
+ type FetchLike = (input: string | URL, init?: FetchInit) => Promise<Response>;
15
+ //#endregion
16
+ export { FetchInit, FetchLike };
17
+ //# sourceMappingURL=fetch.d.ts.map
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,166 @@
1
+ import { isOneOf, isRecord, kindOf } from "./values.js";
2
+ import { keysOf, optionalBoolean, optionalFunction, optionalList, optionsObject } from "./optionChecks.js";
3
+ import { resolveScopedCollection } from "./collectionOption.js";
4
+ import { CURRENCY_PATTERN } from "../goals/currency.js";
5
+ import { patternProblem } from "../goals/pathMatch.js";
6
+ import { GOAL_SLUG_PATTERN } from "../goals/types.js";
7
+ import { GOALS_SLUG } from "../goals/collection.js";
8
+ import { BROWSER_AMOUNT_MODES, DEFAULT_BROWSER_AMOUNTS, DEFAULT_ORDER_SIGNATURE, ORDER_SIGNATURE_MODES } from "../goals/match.js";
9
+ //#region src/core/goalOptions.ts
10
+ const GOALS_KEYS = keysOf({
11
+ defaults: true,
12
+ collection: true,
13
+ purchase: true
14
+ });
15
+ const GOALS_COLLECTION_KEYS = keysOf({
16
+ slug: true,
17
+ scopeField: true,
18
+ fields: true,
19
+ overrides: true,
20
+ access: true
21
+ });
22
+ const GOAL_FIELD_KEYS = keysOf({
23
+ name: true,
24
+ slug: true,
25
+ enabled: true,
26
+ browser: true,
27
+ match: true,
28
+ value: true,
29
+ currency: true
30
+ });
31
+ const REVENUE_KEYS = keysOf({
32
+ currency: true,
33
+ convert: true,
34
+ dimension: true,
35
+ browserAmounts: true,
36
+ orderSignature: true
37
+ });
38
+ const PATTERN_PROBLEMS = {
39
+ "too-many-segments": `has more than 32 parts in its address pattern; shorten it to 32 or fewer`,
40
+ "too-many-globstars": `uses ** more than 4 times in its address pattern; use it at most 4 times`
41
+ };
42
+ /** A path goal's pattern, refused at boot when it is not a string or is over the matcher's caps. */
43
+ const assertGoalPattern = (goal) => {
44
+ if (goal.match.kind !== "path") return;
45
+ const pattern = goal.match.pattern;
46
+ if (typeof pattern !== "string") throw new Error(`analytics: goal "${goal.slug}" matches a path, so match.pattern must be a string, got ${kindOf(pattern)}`);
47
+ const problem = patternProblem(pattern);
48
+ if (problem !== null) throw new Error(`analytics: goal "${goal.slug}" ${PATTERN_PROBLEMS[problem]}`);
49
+ };
50
+ /** One config goal, refused at boot for anything ingest would otherwise drop or misread. */
51
+ const assertGoal = (goal) => {
52
+ if (!GOAL_SLUG_PATTERN.test(goal.slug)) throw new Error(`analytics: goal slug "${goal.slug}" must be kebab-case`);
53
+ assertGoalPattern(goal);
54
+ const fixed = goal.value?.fixed;
55
+ if (fixed !== void 0 && (!Number.isFinite(fixed) || fixed < 0)) throw new Error(`analytics: goal "${goal.slug}" value.fixed must be a finite number >= 0, got ${String(fixed)}`);
56
+ if ("wire" in goal) throw new Error(`analytics: goal "${goal.slug}" wire is not an option, use browser: false for a goal only server code completes`);
57
+ optionalBoolean(goal.browser, `goal "${goal.slug}" browser`);
58
+ };
59
+ /** The config goals, as a list or `goals.defaults`, each checked and no two sharing a slug. */
60
+ const resolveConfigGoals = (option) => {
61
+ if (option !== void 0 && !Array.isArray(option)) {
62
+ const shaped = optionsObject(option, {
63
+ path: "goals",
64
+ known: GOALS_KEYS,
65
+ example: "a list of goals, or an object such as { defaults: [], collection: true }"
66
+ });
67
+ optionalList(shaped.defaults, "goals.defaults", "[{ slug: 'signup', name: 'Signup', match: { kind: 'goal' } }]");
68
+ optionalBoolean(shaped.purchase, "goals.purchase");
69
+ }
70
+ const goals = Array.isArray(option) ? option : option?.defaults ?? [];
71
+ const listed = Array.isArray(option) ? "goals" : "goals.defaults";
72
+ const seen = /* @__PURE__ */ new Set();
73
+ for (const [index, goal] of goals.entries()) {
74
+ const candidate = goal;
75
+ if (!isRecord(candidate) || typeof candidate.slug !== "string" || !isRecord(candidate.match)) throw new Error(`analytics: ${listed}[${index}] must be a goal such as { slug: 'signup', name: 'Signup', match: { kind: 'goal' } }, got ${kindOf(candidate)}`);
76
+ if (seen.has(goal.slug)) throw new Error(`analytics: duplicate goal slug "${goal.slug}"`);
77
+ assertGoal(goal);
78
+ seen.add(goal.slug);
79
+ }
80
+ return goals;
81
+ };
82
+ /** `goals`: the config goals, whether the built-in `purchase` goal is added, and the collection. */
83
+ const resolveGoals = (option) => {
84
+ const goals = resolveConfigGoals(option);
85
+ const grouped = Array.isArray(option) ? void 0 : option;
86
+ return {
87
+ goals,
88
+ purchaseGoal: grouped?.purchase !== false,
89
+ goalsCollection: resolveScopedCollection(grouped?.collection, {
90
+ path: "goals.collection",
91
+ fallback: GOALS_SLUG,
92
+ known: GOALS_COLLECTION_KEYS,
93
+ fieldKeys: GOAL_FIELD_KEYS,
94
+ exampleSlug: "goals"
95
+ })
96
+ };
97
+ };
98
+ /** A revenue mode option: one of `modes`, which a refusal lists quoted and `separator`-joined. */
99
+ const assertMode = (value, at) => {
100
+ if (value !== void 0 && !isOneOf(at.modes, value)) {
101
+ const listed = at.modes.map((mode) => `'${mode}'`).join(at.separator);
102
+ throw new Error(`analytics: ${at.path} must be ${listed}, got ${kindOf(value)}`);
103
+ }
104
+ };
105
+ /**
106
+ * `true` measures money with the defaults; an object turns it on and customizes it. `dimension`
107
+ * follows, and is off whenever money is, since a currency breakdown of nothing is a column of zeros.
108
+ */
109
+ const resolveRevenue = (option) => {
110
+ const defaults = {
111
+ browserAmounts: DEFAULT_BROWSER_AMOUNTS,
112
+ orderSignature: DEFAULT_ORDER_SIGNATURE
113
+ };
114
+ if (option === void 0 || option === false) return {
115
+ enabled: false,
116
+ dimension: false,
117
+ ...defaults
118
+ };
119
+ if (option === true) return {
120
+ enabled: true,
121
+ dimension: true,
122
+ ...defaults
123
+ };
124
+ optionsObject(option, {
125
+ path: "revenue",
126
+ known: REVENUE_KEYS,
127
+ example: "true, false or an object such as { currency: \"EUR\" }"
128
+ });
129
+ optionalBoolean(option.dimension, "revenue.dimension");
130
+ const { currency, browserAmounts, orderSignature } = option;
131
+ assertMode(browserAmounts, {
132
+ path: "revenue.browserAmounts",
133
+ modes: BROWSER_AMOUNT_MODES,
134
+ separator: ", "
135
+ });
136
+ assertMode(orderSignature, {
137
+ path: "revenue.orderSignature",
138
+ modes: ORDER_SIGNATURE_MODES,
139
+ separator: " or "
140
+ });
141
+ if (currency !== void 0 && typeof currency !== "string" && typeof currency !== "function") throw new Error(`analytics: revenue.currency must be an ISO 4217 code or a function, got ${kindOf(currency)}`);
142
+ if (typeof currency === "string" && !CURRENCY_PATTERN.test(currency)) throw new Error(`analytics: revenue.currency must be a three-letter ISO 4217 code, got "${currency}"`);
143
+ const convert = optionalFunction(option.convert, "revenue.convert");
144
+ return {
145
+ enabled: true,
146
+ ...currency === void 0 ? {} : { currency },
147
+ ...convert === void 0 ? {} : { convert },
148
+ dimension: option.dimension ?? convert === void 0,
149
+ browserAmounts: browserAmounts ?? "fixed",
150
+ orderSignature: orderSignature ?? "optional"
151
+ };
152
+ };
153
+ /**
154
+ * The boot warning for an install that measures no money while a config goal carries a value,
155
+ * or null. The value is ignored there: nothing reports revenue until `revenue` turns money on.
156
+ */
157
+ const revenueOffWarning = (resolved) => {
158
+ if (resolved.revenue.enabled) return null;
159
+ const valued = resolved.goals.filter((goal) => goal.value !== void 0);
160
+ if (valued.length === 0) return null;
161
+ return `analytics: revenue is off, so the value these goals carry reports nothing: ${valued.map((goal) => `"${goal.slug}"`).join(", ")}. Set revenue to true, or to a revenue object, to measure money.`;
162
+ };
163
+ //#endregion
164
+ export { resolveGoals, resolveRevenue, revenueOffWarning };
165
+
166
+ //# sourceMappingURL=goalOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"goalOptions.js","names":[],"sources":["../../src/core/goalOptions.ts"],"sourcesContent":["import { GOALS_SLUG, type GoalCollectionFieldOverrides } from '../goals/collection'\nimport { CURRENCY_PATTERN } from '../goals/currency'\nimport {\n\tBROWSER_AMOUNT_MODES,\n\tDEFAULT_BROWSER_AMOUNTS,\n\tDEFAULT_ORDER_SIGNATURE,\n\tORDER_SIGNATURE_MODES,\n} from '../goals/match'\nimport {\n\tMAX_PATTERN_GLOBSTARS,\n\tMAX_PATTERN_SEGMENTS,\n\ttype PatternProblem,\n\tpatternProblem,\n} from '../goals/pathMatch'\nimport { GOAL_SLUG_PATTERN, type Goal } from '../goals/types'\nimport { resolveScopedCollection } from './collectionOption'\nimport {\n\tkeysOf,\n\toptionalBoolean,\n\toptionalFunction,\n\toptionalList,\n\toptionsObject,\n} from './optionChecks'\nimport type {\n\tAnalyticsGoalsCollectionOptions,\n\tAnalyticsGoalsOptions,\n\tAnalyticsPluginOptions,\n\tAnalyticsRevenueOptions,\n\tResolvedOptions,\n\tResolvedRevenue,\n} from './options'\nimport { isOneOf, isRecord, kindOf } from './values'\n\nconst GOALS_KEYS = keysOf<AnalyticsGoalsOptions>({\n\tdefaults: true,\n\tcollection: true,\n\tpurchase: true,\n})\nconst GOALS_COLLECTION_KEYS = keysOf<AnalyticsGoalsCollectionOptions>({\n\tslug: true,\n\tscopeField: true,\n\tfields: true,\n\toverrides: true,\n\taccess: true,\n})\nconst GOAL_FIELD_KEYS = keysOf<GoalCollectionFieldOverrides>({\n\tname: true,\n\tslug: true,\n\tenabled: true,\n\tbrowser: true,\n\tmatch: true,\n\tvalue: true,\n\tcurrency: true,\n})\nconst REVENUE_KEYS = keysOf<AnalyticsRevenueOptions>({\n\tcurrency: true,\n\tconvert: true,\n\tdimension: true,\n\tbrowserAmounts: true,\n\torderSignature: true,\n})\n\nconst PATTERN_PROBLEMS: Record<PatternProblem, string> = {\n\t'too-many-segments': `has more than ${MAX_PATTERN_SEGMENTS} parts in its address pattern; shorten it to ${MAX_PATTERN_SEGMENTS} or fewer`,\n\t'too-many-globstars': `uses ** more than ${MAX_PATTERN_GLOBSTARS} times in its address pattern; use it at most ${MAX_PATTERN_GLOBSTARS} times`,\n}\n\n/** A path goal's pattern, refused at boot when it is not a string or is over the matcher's caps. */\nconst assertGoalPattern = (goal: Goal): void => {\n\tif (goal.match.kind !== 'path') {\n\t\treturn\n\t}\n\tconst pattern: unknown = goal.match.pattern\n\tif (typeof pattern !== 'string') {\n\t\tthrow new Error(\n\t\t\t`analytics: goal \"${goal.slug}\" matches a path, so match.pattern must be a string, got ${kindOf(pattern)}`\n\t\t)\n\t}\n\tconst problem = patternProblem(pattern)\n\tif (problem !== null) {\n\t\tthrow new Error(`analytics: goal \"${goal.slug}\" ${PATTERN_PROBLEMS[problem]}`)\n\t}\n}\n\n/** One config goal, refused at boot for anything ingest would otherwise drop or misread. */\nconst assertGoal = (goal: Goal): void => {\n\tif (!GOAL_SLUG_PATTERN.test(goal.slug)) {\n\t\tthrow new Error(`analytics: goal slug \"${goal.slug}\" must be kebab-case`)\n\t}\n\tassertGoalPattern(goal)\n\tconst fixed = goal.value?.fixed\n\t// Ingest would silently ignore a negative or non-finite amount, so it fails the boot instead.\n\tif (fixed !== undefined && (!Number.isFinite(fixed) || fixed < 0)) {\n\t\tthrow new Error(\n\t\t\t`analytics: goal \"${goal.slug}\" value.fixed must be a finite number >= 0, got ${String(fixed)}`\n\t\t)\n\t}\n\tif ('wire' in goal) {\n\t\tthrow new Error(\n\t\t\t`analytics: goal \"${goal.slug}\" wire is not an option, use browser: false for a goal only server code completes`\n\t\t)\n\t}\n\toptionalBoolean(goal.browser, `goal \"${goal.slug}\" browser`)\n}\n\n/** The config goals, as a list or `goals.defaults`, each checked and no two sharing a slug. */\nconst resolveConfigGoals = (option: AnalyticsPluginOptions['goals']): Goal[] => {\n\tif (option !== undefined && !Array.isArray(option)) {\n\t\tconst shaped = optionsObject(option, {\n\t\t\tpath: 'goals',\n\t\t\tknown: GOALS_KEYS,\n\t\t\texample: 'a list of goals, or an object such as { defaults: [], collection: true }',\n\t\t})\n\t\toptionalList(\n\t\t\tshaped.defaults,\n\t\t\t'goals.defaults',\n\t\t\t\"[{ slug: 'signup', name: 'Signup', match: { kind: 'goal' } }]\"\n\t\t)\n\t\toptionalBoolean(shaped.purchase, 'goals.purchase')\n\t}\n\tconst goals = Array.isArray(option) ? option : (option?.defaults ?? [])\n\tconst listed = Array.isArray(option) ? 'goals' : 'goals.defaults'\n\tconst seen = new Set<string>()\n\tfor (const [index, goal] of goals.entries()) {\n\t\tconst candidate: unknown = goal\n\t\tif (!isRecord(candidate) || typeof candidate.slug !== 'string' || !isRecord(candidate.match)) {\n\t\t\tthrow new Error(\n\t\t\t\t`analytics: ${listed}[${index}] must be a goal such as { slug: 'signup', name: 'Signup', match: { kind: 'goal' } }, got ${kindOf(candidate)}`\n\t\t\t)\n\t\t}\n\t\tif (seen.has(goal.slug)) {\n\t\t\tthrow new Error(`analytics: duplicate goal slug \"${goal.slug}\"`)\n\t\t}\n\t\tassertGoal(goal)\n\t\tseen.add(goal.slug)\n\t}\n\treturn goals\n}\n\n/** `goals`: the config goals, whether the built-in `purchase` goal is added, and the collection. */\nexport const resolveGoals = (\n\toption: AnalyticsPluginOptions['goals']\n): Pick<ResolvedOptions, 'goals' | 'purchaseGoal' | 'goalsCollection'> => {\n\tconst goals = resolveConfigGoals(option)\n\tconst grouped = Array.isArray(option) ? undefined : option\n\treturn {\n\t\tgoals,\n\t\tpurchaseGoal: grouped?.purchase !== false,\n\t\tgoalsCollection: resolveScopedCollection(grouped?.collection, {\n\t\t\tpath: 'goals.collection',\n\t\t\tfallback: GOALS_SLUG,\n\t\t\tknown: GOALS_COLLECTION_KEYS,\n\t\t\tfieldKeys: GOAL_FIELD_KEYS,\n\t\t\texampleSlug: 'goals',\n\t\t}),\n\t}\n}\n\n/** A revenue mode option: one of `modes`, which a refusal lists quoted and `separator`-joined. */\nconst assertMode = (\n\tvalue: unknown,\n\tat: { path: string; modes: readonly string[]; separator: string }\n): void => {\n\tif (value !== undefined && !isOneOf(at.modes, value)) {\n\t\tconst listed = at.modes.map((mode) => `'${mode}'`).join(at.separator)\n\t\tthrow new Error(`analytics: ${at.path} must be ${listed}, got ${kindOf(value)}`)\n\t}\n}\n\n/**\n * `true` measures money with the defaults; an object turns it on and customizes it. `dimension`\n * follows, and is off whenever money is, since a currency breakdown of nothing is a column of zeros.\n */\nexport const resolveRevenue = (option: AnalyticsPluginOptions['revenue']): ResolvedRevenue => {\n\tconst defaults = {\n\t\tbrowserAmounts: DEFAULT_BROWSER_AMOUNTS,\n\t\torderSignature: DEFAULT_ORDER_SIGNATURE,\n\t}\n\tif (option === undefined || option === false) {\n\t\treturn { enabled: false, dimension: false, ...defaults }\n\t}\n\tif (option === true) {\n\t\treturn { enabled: true, dimension: true, ...defaults }\n\t}\n\toptionsObject(option, {\n\t\tpath: 'revenue',\n\t\tknown: REVENUE_KEYS,\n\t\texample: 'true, false or an object such as { currency: \"EUR\" }',\n\t})\n\toptionalBoolean(option.dimension, 'revenue.dimension')\n\tconst { currency, browserAmounts, orderSignature } = option\n\tassertMode(browserAmounts, {\n\t\tpath: 'revenue.browserAmounts',\n\t\tmodes: BROWSER_AMOUNT_MODES,\n\t\tseparator: ', ',\n\t})\n\tassertMode(orderSignature, {\n\t\tpath: 'revenue.orderSignature',\n\t\tmodes: ORDER_SIGNATURE_MODES,\n\t\tseparator: ' or ',\n\t})\n\tif (currency !== undefined && typeof currency !== 'string' && typeof currency !== 'function') {\n\t\tthrow new Error(\n\t\t\t`analytics: revenue.currency must be an ISO 4217 code or a function, got ${kindOf(currency)}`\n\t\t)\n\t}\n\tif (typeof currency === 'string' && !CURRENCY_PATTERN.test(currency)) {\n\t\tthrow new Error(\n\t\t\t`analytics: revenue.currency must be a three-letter ISO 4217 code, got \"${currency}\"`\n\t\t)\n\t}\n\tconst convert = optionalFunction(option.convert, 'revenue.convert')\n\treturn {\n\t\tenabled: true,\n\t\t...(currency === undefined ? {} : { currency }),\n\t\t...(convert === undefined ? {} : { convert }),\n\t\tdimension: option.dimension ?? convert === undefined,\n\t\tbrowserAmounts: browserAmounts ?? DEFAULT_BROWSER_AMOUNTS,\n\t\torderSignature: orderSignature ?? DEFAULT_ORDER_SIGNATURE,\n\t}\n}\n\n/**\n * The boot warning for an install that measures no money while a config goal carries a value,\n * or null. The value is ignored there: nothing reports revenue until `revenue` turns money on.\n */\nexport const revenueOffWarning = (\n\tresolved: Pick<ResolvedOptions, 'revenue' | 'goals'>\n): string | null => {\n\tif (resolved.revenue.enabled) {\n\t\treturn null\n\t}\n\tconst valued = resolved.goals.filter((goal) => goal.value !== undefined)\n\tif (valued.length === 0) {\n\t\treturn null\n\t}\n\tconst slugs = valued.map((goal) => `\"${goal.slug}\"`).join(', ')\n\treturn `analytics: revenue is off, so the value these goals carry reports nothing: ${slugs}. Set revenue to true, or to a revenue object, to measure money.`\n}\n"],"mappings":";;;;;;;;;AAiCA,MAAM,aAAa,OAA8B;CAChD,UAAU;CACV,YAAY;CACZ,UAAU;AACX,CAAC;AACD,MAAM,wBAAwB,OAAwC;CACrE,MAAM;CACN,YAAY;CACZ,QAAQ;CACR,WAAW;CACX,QAAQ;AACT,CAAC;AACD,MAAM,kBAAkB,OAAqC;CAC5D,MAAM;CACN,MAAM;CACN,SAAS;CACT,SAAS;CACT,OAAO;CACP,OAAO;CACP,UAAU;AACX,CAAC;AACD,MAAM,eAAe,OAAgC;CACpD,UAAU;CACV,SAAS;CACT,WAAW;CACX,gBAAgB;CAChB,gBAAgB;AACjB,CAAC;AAED,MAAM,mBAAmD;CACxD,qBAAqB;CACrB,sBAAsB;AACvB;;AAGA,MAAM,qBAAqB,SAAqB;CAC/C,IAAI,KAAK,MAAM,SAAS,QACvB;CAED,MAAM,UAAmB,KAAK,MAAM;CACpC,IAAI,OAAO,YAAY,UACtB,MAAM,IAAI,MACT,oBAAoB,KAAK,KAAK,2DAA2D,OAAO,OAAO,GACxG;CAED,MAAM,UAAU,eAAe,OAAO;CACtC,IAAI,YAAY,MACf,MAAM,IAAI,MAAM,oBAAoB,KAAK,KAAK,IAAI,iBAAiB,UAAU;AAE/E;;AAGA,MAAM,cAAc,SAAqB;CACxC,IAAI,CAAC,kBAAkB,KAAK,KAAK,IAAI,GACpC,MAAM,IAAI,MAAM,yBAAyB,KAAK,KAAK,qBAAqB;CAEzE,kBAAkB,IAAI;CACtB,MAAM,QAAQ,KAAK,OAAO;CAE1B,IAAI,UAAU,KAAA,MAAc,CAAC,OAAO,SAAS,KAAK,KAAK,QAAQ,IAC9D,MAAM,IAAI,MACT,oBAAoB,KAAK,KAAK,kDAAkD,OAAO,KAAK,GAC7F;CAED,IAAI,UAAU,MACb,MAAM,IAAI,MACT,oBAAoB,KAAK,KAAK,kFAC/B;CAED,gBAAgB,KAAK,SAAS,SAAS,KAAK,KAAK,UAAU;AAC5D;;AAGA,MAAM,sBAAsB,WAAoD;CAC/E,IAAI,WAAW,KAAA,KAAa,CAAC,MAAM,QAAQ,MAAM,GAAG;EACnD,MAAM,SAAS,cAAc,QAAQ;GACpC,MAAM;GACN,OAAO;GACP,SAAS;EACV,CAAC;EACD,aACC,OAAO,UACP,kBACA,+DACD;EACA,gBAAgB,OAAO,UAAU,gBAAgB;CAClD;CACA,MAAM,QAAQ,MAAM,QAAQ,MAAM,IAAI,SAAU,QAAQ,YAAY,CAAC;CACrE,MAAM,SAAS,MAAM,QAAQ,MAAM,IAAI,UAAU;CACjD,MAAM,uBAAO,IAAI,IAAY;CAC7B,KAAK,MAAM,CAAC,OAAO,SAAS,MAAM,QAAQ,GAAG;EAC5C,MAAM,YAAqB;EAC3B,IAAI,CAAC,SAAS,SAAS,KAAK,OAAO,UAAU,SAAS,YAAY,CAAC,SAAS,UAAU,KAAK,GAC1F,MAAM,IAAI,MACT,cAAc,OAAO,GAAG,MAAM,4FAA4F,OAAO,SAAS,GAC3I;EAED,IAAI,KAAK,IAAI,KAAK,IAAI,GACrB,MAAM,IAAI,MAAM,mCAAmC,KAAK,KAAK,EAAE;EAEhE,WAAW,IAAI;EACf,KAAK,IAAI,KAAK,IAAI;CACnB;CACA,OAAO;AACR;;AAGA,MAAa,gBACZ,WACyE;CACzE,MAAM,QAAQ,mBAAmB,MAAM;CACvC,MAAM,UAAU,MAAM,QAAQ,MAAM,IAAI,KAAA,IAAY;CACpD,OAAO;EACN;EACA,cAAc,SAAS,aAAa;EACpC,iBAAiB,wBAAwB,SAAS,YAAY;GAC7D,MAAM;GACN,UAAU;GACV,OAAO;GACP,WAAW;GACX,aAAa;EACd,CAAC;CACF;AACD;;AAGA,MAAM,cACL,OACA,OACU;CACV,IAAI,UAAU,KAAA,KAAa,CAAC,QAAQ,GAAG,OAAO,KAAK,GAAG;EACrD,MAAM,SAAS,GAAG,MAAM,KAAK,SAAS,IAAI,KAAK,EAAE,EAAE,KAAK,GAAG,SAAS;EACpE,MAAM,IAAI,MAAM,cAAc,GAAG,KAAK,WAAW,OAAO,QAAQ,OAAO,KAAK,GAAG;CAChF;AACD;;;;;AAMA,MAAa,kBAAkB,WAA+D;CAC7F,MAAM,WAAW;EAChB,gBAAgB;EAChB,gBAAgB;CACjB;CACA,IAAI,WAAW,KAAA,KAAa,WAAW,OACtC,OAAO;EAAE,SAAS;EAAO,WAAW;EAAO,GAAG;CAAS;CAExD,IAAI,WAAW,MACd,OAAO;EAAE,SAAS;EAAM,WAAW;EAAM,GAAG;CAAS;CAEtD,cAAc,QAAQ;EACrB,MAAM;EACN,OAAO;EACP,SAAS;CACV,CAAC;CACD,gBAAgB,OAAO,WAAW,mBAAmB;CACrD,MAAM,EAAE,UAAU,gBAAgB,mBAAmB;CACrD,WAAW,gBAAgB;EAC1B,MAAM;EACN,OAAO;EACP,WAAW;CACZ,CAAC;CACD,WAAW,gBAAgB;EAC1B,MAAM;EACN,OAAO;EACP,WAAW;CACZ,CAAC;CACD,IAAI,aAAa,KAAA,KAAa,OAAO,aAAa,YAAY,OAAO,aAAa,YACjF,MAAM,IAAI,MACT,2EAA2E,OAAO,QAAQ,GAC3F;CAED,IAAI,OAAO,aAAa,YAAY,CAAC,iBAAiB,KAAK,QAAQ,GAClE,MAAM,IAAI,MACT,0EAA0E,SAAS,EACpF;CAED,MAAM,UAAU,iBAAiB,OAAO,SAAS,iBAAiB;CAClE,OAAO;EACN,SAAS;EACT,GAAI,aAAa,KAAA,IAAY,CAAC,IAAI,EAAE,SAAS;EAC7C,GAAI,YAAY,KAAA,IAAY,CAAC,IAAI,EAAE,QAAQ;EAC3C,WAAW,OAAO,aAAa,YAAY,KAAA;EAC3C,gBAAgB,kBAAA;EAChB,gBAAgB,kBAAA;CACjB;AACD;;;;;AAMA,MAAa,qBACZ,aACmB;CACnB,IAAI,SAAS,QAAQ,SACpB,OAAO;CAER,MAAM,SAAS,SAAS,MAAM,QAAQ,SAAS,KAAK,UAAU,KAAA,CAAS;CACvE,IAAI,OAAO,WAAW,GACrB,OAAO;CAGR,OAAO,8EADO,OAAO,KAAK,SAAS,IAAI,KAAK,KAAK,EAAE,EAAE,KAAK,IAC+B,EAAE;AAC5F"}
@@ -1,4 +1,5 @@
1
1
  //#region src/core/granularity.ts
2
+ /** Every bucket, finest first. */
2
3
  const GRANULARITY_ORDER = [
3
4
  "minute",
4
5
  "hour",
@@ -7,8 +8,8 @@ const GRANULARITY_ORDER = [
7
8
  "month"
8
9
  ];
9
10
  /**
10
- * Whether an adapter can bucket at granularity `g`. `minGranularity` is the finest
11
- * bucket a provider supports, so it also supports every coarser one.
11
+ * Whether a source buckets at `g`: `minGranularity` is the finest bucket it supports, so it supports
12
+ * every coarser one too.
12
13
  */
13
14
  const supportsGranularity = (caps, g) => GRANULARITY_ORDER.indexOf(g) >= GRANULARITY_ORDER.indexOf(caps.minGranularity);
14
15
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"granularity.js","names":[],"sources":["../../src/core/granularity.ts"],"sourcesContent":["import type { AnalyticsCapabilities, Granularity } from './contract'\n\nexport const GRANULARITY_ORDER: Granularity[] = ['minute', 'hour', 'day', 'week', 'month']\n\n/**\n * Whether an adapter can bucket at granularity `g`. `minGranularity` is the finest\n * bucket a provider supports, so it also supports every coarser one.\n */\nexport const supportsGranularity = (caps: AnalyticsCapabilities, g: Granularity): boolean =>\n\tGRANULARITY_ORDER.indexOf(g) >= GRANULARITY_ORDER.indexOf(caps.minGranularity)\n"],"mappings":";AAEA,MAAa,oBAAmC;CAAC;CAAU;CAAQ;CAAO;CAAQ;AAAO;;;;;AAMzF,MAAa,uBAAuB,MAA6B,MAChE,kBAAkB,QAAQ,CAAC,KAAK,kBAAkB,QAAQ,KAAK,cAAc"}
1
+ {"version":3,"file":"granularity.js","names":[],"sources":["../../src/core/granularity.ts"],"sourcesContent":["import type { AnalyticsCapabilities, Granularity } from './contract'\n\n/** Every bucket, finest first. */\nexport const GRANULARITY_ORDER: Granularity[] = ['minute', 'hour', 'day', 'week', 'month']\n\n/**\n * Whether a source buckets at `g`: `minGranularity` is the finest bucket it supports, so it supports\n * every coarser one too.\n */\nexport const supportsGranularity = (\n\tcaps: Pick<AnalyticsCapabilities, 'minGranularity'>,\n\tg: Granularity\n): boolean => GRANULARITY_ORDER.indexOf(g) >= GRANULARITY_ORDER.indexOf(caps.minGranularity)\n"],"mappings":";;AAGA,MAAa,oBAAmC;CAAC;CAAU;CAAQ;CAAO;CAAQ;AAAO;;;;;AAMzF,MAAa,uBACZ,MACA,MACa,kBAAkB,QAAQ,CAAC,KAAK,kBAAkB,QAAQ,KAAK,cAAc"}
@@ -0,0 +1,17 @@
1
+ import { DIMENSION_KEYS, FILTER_OPERATORS } from "./contract.js";
2
+ import { isOneOf } from "./values.js";
3
+ import { METRIC_KEYS } from "../translations/metricKeys.js";
4
+ import { GRANULARITY_ORDER } from "./granularity.js";
5
+ //#region src/core/guards.ts
6
+ /** Whether `value` names a metric the contract defines. */
7
+ const isMetricKey = (value) => typeof value === "string" && Object.hasOwn(METRIC_KEYS, value);
8
+ /** Whether `value` names a dimension the contract defines. */
9
+ const isDimensionKey = (value) => isOneOf(DIMENSION_KEYS, value);
10
+ /** Whether `value` names a filter operator the contract defines. */
11
+ const isFilterOperator = (value) => isOneOf(FILTER_OPERATORS, value);
12
+ /** Whether `value` names a bucket the contract defines. */
13
+ const isGranularity = (value) => isOneOf(GRANULARITY_ORDER, value);
14
+ //#endregion
15
+ export { isDimensionKey, isFilterOperator, isGranularity, isMetricKey };
16
+
17
+ //# sourceMappingURL=guards.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guards.js","names":[],"sources":["../../src/core/guards.ts"],"sourcesContent":["import { METRIC_KEYS } from '../translations/metricKeys'\nimport {\n\tDIMENSION_KEYS,\n\ttype DimensionKey,\n\tFILTER_OPERATORS,\n\ttype FilterOperator,\n\ttype Granularity,\n\ttype MetricKey,\n} from './contract'\nimport { GRANULARITY_ORDER } from './granularity'\nimport { isOneOf } from './values'\n\n/** Whether `value` names a metric the contract defines. */\nexport const isMetricKey = (value: unknown): value is MetricKey =>\n\ttypeof value === 'string' && Object.hasOwn(METRIC_KEYS, value)\n\n/** Whether `value` names a dimension the contract defines. */\nexport const isDimensionKey = (value: unknown): value is DimensionKey =>\n\tisOneOf(DIMENSION_KEYS, value)\n\n/** Whether `value` names a filter operator the contract defines. */\nexport const isFilterOperator = (value: unknown): value is FilterOperator =>\n\tisOneOf(FILTER_OPERATORS, value)\n\n/** Whether `value` names a bucket the contract defines. */\nexport const isGranularity = (value: unknown): value is Granularity =>\n\tisOneOf(GRANULARITY_ORDER, value)\n"],"mappings":";;;;;;AAaA,MAAa,eAAe,UAC3B,OAAO,UAAU,YAAY,OAAO,OAAO,aAAa,KAAK;;AAG9D,MAAa,kBAAkB,UAC9B,QAAQ,gBAAgB,KAAK;;AAG9B,MAAa,oBAAoB,UAChC,QAAQ,kBAAkB,KAAK;;AAGhC,MAAa,iBAAiB,UAC7B,QAAQ,mBAAmB,KAAK"}
@@ -0,0 +1,40 @@
1
+ import { AnalyticsCollectionOptions } from "./collectionOption.js";
2
+
3
+ //#region src/core/jobs.d.ts
4
+ /** When one of the plugin's tasks runs, and on which queue. */
5
+ type AnalyticsTaskOptions = {
6
+ /** The queue its scheduled runs are queued on; `jobs.queue` by default. */queue?: string; /** When it is scheduled. `false` registers it unscheduled, to run only when something queues it. */
7
+ cron?: string | false;
8
+ };
9
+ /** The plugin's background tasks, registered with Payload's jobs queue. */
10
+ type AnalyticsJobsOptions = {
11
+ /** The queue every task is scheduled on unless its own entry names another. Default `'default'`. */queue?: string;
12
+ tasks?: {
13
+ /** `analytics-maintain`, the native engine's upkeep, registered with `native()`. Every 15 minutes by default. */maintain?: AnalyticsTaskOptions; /** `analytics-sync`, registered with `sync`. Every six hours by default. */
14
+ sync?: AnalyticsTaskOptions; /** `analytics-warm`, registered with `cache.warm`. Every 30 minutes by default. */
15
+ warm?: AnalyticsTaskOptions;
16
+ };
17
+ /**
18
+ * The `analytics-state` collection holding the sync and warm tasks' leases, on an install without
19
+ * `native()`; with `native()` the engine registers it and this is refused.
20
+ */
21
+ state?: AnalyticsCollectionOptions;
22
+ };
23
+ /** The tasks `jobs.tasks` names, `maintain` first. */
24
+ declare const TASK_NAMES: readonly ["maintain", "sync", "warm"];
25
+ type AnalyticsTaskName = (typeof TASK_NAMES)[number];
26
+ /** One task as registered: its queue, its schedule (null when unscheduled) and its cadence. */
27
+ interface ScheduledTask {
28
+ queue: string;
29
+ cron: string | null;
30
+ /** How far apart its runs fall, which its heartbeat is judged by. */
31
+ intervalMs: number;
32
+ }
33
+ /**
34
+ * The plugin's `jobs` as an adapter is handed it: each task's queue and schedule, or false when the
35
+ * install registers no task and the adapter's own requests do that work instead.
36
+ */
37
+ type AdapterJobs = false | Readonly<Record<AnalyticsTaskName, ScheduledTask>>;
38
+ //#endregion
39
+ export { AdapterJobs, AnalyticsJobsOptions, AnalyticsTaskName, AnalyticsTaskOptions, ScheduledTask, TASK_NAMES };
40
+ //# sourceMappingURL=jobs.d.ts.map
@@ -0,0 +1,132 @@
1
+ import { isOneOf, isRecord, kindOf } from "./values.js";
2
+ import { STATE_SLUG } from "../native/collections/slugs.js";
3
+ import { optionsObject } from "./optionChecks.js";
4
+ import { resolveCollectionOption } from "./collectionOption.js";
5
+ import { cronIntervalMs, isCronPattern } from "./cron.js";
6
+ //#region src/core/jobs.ts
7
+ /** The tasks `jobs.tasks` names, `maintain` first. */
8
+ const TASK_NAMES = [
9
+ "maintain",
10
+ "sync",
11
+ "warm"
12
+ ];
13
+ /** Each task's slug in Payload's jobs config, which is also its heartbeat's and its lease's name. */
14
+ const TASK_SLUGS = {
15
+ maintain: "analytics-maintain",
16
+ sync: "analytics-sync",
17
+ warm: "analytics-warm"
18
+ };
19
+ const DEFAULT_JOBS_QUEUE = "default";
20
+ const MAINTAIN_INTERVAL_MS = 15 * 6e4;
21
+ const DEFAULT_SCHEDULES = {
22
+ maintain: {
23
+ cron: "*/15 * * * *",
24
+ intervalMs: MAINTAIN_INTERVAL_MS
25
+ },
26
+ sync: {
27
+ cron: "0 */6 * * *",
28
+ intervalMs: 6 * 36e5
29
+ },
30
+ warm: {
31
+ cron: "*/30 * * * *",
32
+ intervalMs: 30 * 6e4
33
+ }
34
+ };
35
+ const defaultTask = (name, queue) => ({
36
+ queue,
37
+ cron: DEFAULT_SCHEDULES[name].cron,
38
+ intervalMs: DEFAULT_SCHEDULES[name].intervalMs
39
+ });
40
+ const DEFAULT_JOBS = {
41
+ maintain: defaultTask("maintain", DEFAULT_JOBS_QUEUE),
42
+ sync: defaultTask("sync", DEFAULT_JOBS_QUEUE),
43
+ warm: defaultTask("warm", DEFAULT_JOBS_QUEUE),
44
+ configured: /* @__PURE__ */ new Set()
45
+ };
46
+ const isTaskName = (name) => isOneOf(TASK_NAMES, name);
47
+ const refuse = (message) => {
48
+ throw new Error(`analytics: ${message}`);
49
+ };
50
+ const queueOf = (value, path) => {
51
+ if (value === void 0) return;
52
+ if (typeof value !== "string" || value.trim() === "") return refuse(`${path} must be a queue name, got ${kindOf(value)}`);
53
+ return value.trim();
54
+ };
55
+ const taskOf = (value, name, defaultQueue) => {
56
+ const path = `jobs.tasks.${name}`;
57
+ if (value === void 0) return defaultTask(name, defaultQueue);
58
+ const { cron, queue } = optionsObject(value, {
59
+ path,
60
+ known: ["queue", "cron"],
61
+ example: "an object such as { cron: '0 * * * *' }"
62
+ });
63
+ if (cron !== void 0 && cron !== false && !isCronPattern(cron)) refuse(`${path}.cron must be a cron pattern of five fields (six with seconds first) or a nickname such as '@hourly', or false to leave the task unscheduled, got ${kindOf(cron)}`);
64
+ const fallback = DEFAULT_SCHEDULES[name];
65
+ const schedule = cron === false ? null : typeof cron === "string" ? cron.trim() : fallback.cron;
66
+ return {
67
+ queue: queueOf(queue, `${path}.queue`) ?? defaultQueue,
68
+ cron: schedule,
69
+ intervalMs: (schedule === null ? null : cronIntervalMs(schedule)) ?? fallback.intervalMs
70
+ };
71
+ };
72
+ /**
73
+ * `jobs` checked at boot: every task resolved to its queue and schedule. Which of them the install
74
+ * registers follows `native()`, `sync` and `cache.warm`; `false` registers none.
75
+ */
76
+ const resolveJobs = (option) => {
77
+ if (option === false) return false;
78
+ if (option === void 0) return DEFAULT_JOBS;
79
+ const shaped = optionsObject(option, {
80
+ path: "jobs",
81
+ known: [
82
+ "queue",
83
+ "tasks",
84
+ "state"
85
+ ],
86
+ example: "false, to register no task, or an object such as { queue: 'analytics' }"
87
+ });
88
+ const queue = queueOf(shaped.queue, "jobs.queue") ?? DEFAULT_JOBS_QUEUE;
89
+ const tasks = shaped.tasks ?? {};
90
+ if (!isRecord(tasks) || Array.isArray(tasks)) return refuse(`jobs.tasks must be an object such as { maintain: { cron: false } }, got ${kindOf(tasks)}`);
91
+ const configured = /* @__PURE__ */ new Set();
92
+ for (const name of Object.keys(tasks)) {
93
+ if (!isTaskName(name)) return refuse(`jobs.tasks.${name} is not a task; the tasks are ${TASK_NAMES.join(", ")}`);
94
+ if (tasks[name] !== void 0) configured.add(name);
95
+ }
96
+ const of = (name) => taskOf(tasks[name], name, queue);
97
+ const state = shaped.state === void 0 ? void 0 : resolveCollectionOption(shaped.state, {
98
+ path: "jobs.state",
99
+ fallback: STATE_SLUG
100
+ });
101
+ return {
102
+ maintain: of("maintain"),
103
+ sync: of("sync"),
104
+ warm: of("warm"),
105
+ configured,
106
+ ...state ? { state } : {}
107
+ };
108
+ };
109
+ /**
110
+ * Refuses a `jobs` that contradicts what the install turned on: `false` beside a feature whose only
111
+ * worker is a task, or a task's entry for a feature that is off and so registers no task.
112
+ */
113
+ const assertJobsFit = (jobs, demand) => {
114
+ if (jobs === false) {
115
+ const needs = [...demand.sync ? ["sync, which only the analytics-sync task fills"] : [], ...demand.warm ? ["cache.warm, which only the analytics-warm task runs"] : []];
116
+ if (needs.length > 0) refuse(`jobs: false registers no task, but this install turns on ${needs.join(" and ")}. Turn ${needs.length === 1 ? "it" : "them"} off, or replace jobs: false with entries such as jobs: { tasks: { sync: { cron: false } } } to register a task unscheduled and queue it yourself.`);
117
+ return;
118
+ }
119
+ if (jobs.configured.has("sync") && !demand.sync) refuse("jobs.tasks.sync schedules analytics-sync, which is registered only while sync is on. Turn sync on, or remove the entry.");
120
+ if (jobs.configured.has("warm") && !demand.warm) refuse("jobs.tasks.warm schedules analytics-warm, which is registered only while cache.warm is on. Turn cache.warm on, or remove the entry.");
121
+ };
122
+ /**
123
+ * Refuses `jobs.tasks.maintain` on an install that registered no `analytics-maintain`, checked once
124
+ * the adapters have registered what they run.
125
+ */
126
+ const assertMaintainRegistered = (jobs, registered) => {
127
+ if (jobs !== false && jobs.configured.has("maintain") && !registered) refuse("jobs.tasks.maintain schedules analytics-maintain, which only native() registers. Add native() to adapters, or remove the entry.");
128
+ };
129
+ //#endregion
130
+ export { DEFAULT_JOBS, MAINTAIN_INTERVAL_MS, TASK_SLUGS, assertJobsFit, assertMaintainRegistered, resolveJobs };
131
+
132
+ //# sourceMappingURL=jobs.js.map