@vllnt/convex-analytics 0.2.0-canary.7ef4d35 → 0.2.0-canary.dee16f7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +110 -51
- package/README.md +34 -11
- package/dist/component/internal_mutations.d.ts.map +1 -1
- package/dist/component/internal_mutations.js +15 -5
- package/dist/component/internal_mutations.js.map +1 -1
- package/dist/component/mutations.d.ts.map +1 -1
- package/dist/component/mutations.js +22 -20
- package/dist/component/mutations.js.map +1 -1
- package/dist/component/queries.d.ts.map +1 -1
- package/dist/component/queries.js +67 -17
- package/dist/component/queries.js.map +1 -1
- package/dist/component/validators.d.ts +15 -1
- package/dist/component/validators.d.ts.map +1 -1
- package/dist/component/validators.js +32 -0
- package/dist/component/validators.js.map +1 -1
- package/docs/api-reference.md +11 -4
- package/docs/architecture.md +20 -9
- package/docs/client-sdk.md +24 -12
- package/docs/schema.md +4 -3
- package/package.json +2 -2
- package/src/component/internal_mutations.ts +15 -5
- package/src/component/mutations.ts +26 -20
- package/src/component/queries.ts +68 -16
- package/src/component/validators.ts +39 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,29 +5,29 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
-
## [0.2.0] -
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
infinite numbers, empty strings
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
## [0.2.0] - 2026-11-28
|
|
9
|
+
|
|
10
|
+
**Breaking:** this release changes behaviour for invalid input: calls that `0.1.0` accepted with
|
|
11
|
+
`NaN` or infinite numbers, empty strings (on writes, reads and `backfill`), strings over 512
|
|
12
|
+
characters in the fields a write stores in index keys, non-positive or non-integer limits, blank
|
|
13
|
+
or malformed `list` cursors, or `configSet` values that `configure` would refuse now throw typed
|
|
14
|
+
`ConvexError` codes (see **Changed**), and the REST routes answer them with
|
|
15
|
+
`400`; non-scalar REST `props` return `400` instead of failing unhandled. Hosts that passed such
|
|
16
|
+
input must handle these errors before upgrading from `^0.1.0`. Node 20 or later is required.
|
|
17
|
+
The next `convex deploy` also builds the new indexes (see **Changed**) over existing rows, which
|
|
18
|
+
takes longer on large `rollups` and `subjects` tables.
|
|
16
19
|
|
|
17
20
|
### Added
|
|
18
21
|
|
|
19
22
|
- The npm package now ships the user docs (`docs/*.md`), `llms.txt` and `CHANGELOG.md`, so
|
|
20
23
|
`node_modules/@vllnt/convex-analytics/` holds docs that match the installed version.
|
|
21
|
-
`llms.txt` links to them with relative paths.
|
|
22
|
-
packed tarball and fails when a required file is missing, an internal file ships, or a
|
|
23
|
-
relative link does not resolve.
|
|
24
|
+
`llms.txt` links to them with relative paths.
|
|
24
25
|
- Export `./convex.config.js` (same target as `./convex.config`), which the Convex Components
|
|
25
26
|
Directory preflight requires alongside `./_generated/component.js`.
|
|
26
27
|
- Rewritten README for coding agents: when to use, a complete quick start, a table of every
|
|
27
28
|
export of every entry point, common tasks, every error code and message with its fix, limits
|
|
28
29
|
and caps, and compatibility. New `docs/react.md`; every export has a TSDoc summary and a
|
|
29
|
-
reference heading.
|
|
30
|
-
type-checks every README and docs example against the packed package and `convex` 1.45.0.
|
|
30
|
+
reference heading.
|
|
31
31
|
|
|
32
32
|
### Fixed
|
|
33
33
|
|
|
@@ -35,56 +35,115 @@ and **Fixed**) over existing rows, which takes longer on large `rollups` and `su
|
|
|
35
35
|
`INVALID_TIMESTAMP`, `INVALID_SAMPLE_RATE`, `INVALID_PROP_VALUE`, `INVALID_PROP_KEY`,
|
|
36
36
|
`INVALID_COUNT`, `INVALID_CURSOR`, `INVALID_BUCKETS`, `INVALID_CONFIG`): `NaN` or infinite
|
|
37
37
|
`ts`, range bounds, `sampleRate` and number props; empty `scope`, `name`, `subjectRef`,
|
|
38
|
-
`sessionRef`, `dedupeKey`, dimensions and config keys;
|
|
39
|
-
non-
|
|
40
|
-
`
|
|
41
|
-
|
|
38
|
+
`sessionRef`, `dedupeKey`, dimensions and config keys; prop keys Convex cannot store;
|
|
39
|
+
non-scalar REST `props` values; non-positive or non-integer `limit`, `periods` and
|
|
40
|
+
`numItems`; non-finite `distribution` buckets; and empty, blank or malformed `list` cursors.
|
|
41
|
+
A negative `top` limit used to return all but the last rows; a `NaN` or infinite `ts` used to
|
|
42
|
+
create a `NaN` or infinite rollup bucket.
|
|
42
43
|
- `configure` rejects non-positive `retentionDays` and `sessionIdleMs`, which would otherwise
|
|
43
|
-
make `prune` delete every event.
|
|
44
|
+
make `prune` delete every event or `closeSessions` close every session.
|
|
44
45
|
- Inherited keys such as `constructor` are no longer rolled up as dimensions.
|
|
46
|
+
- A dimension or granularity listed twice in `dimensions` / `granularities` (in `track`, the
|
|
47
|
+
client config, `POST /track` or `backfill`) no longer counts one event several times; each
|
|
48
|
+
distinct entry is used once.
|
|
49
|
+
- `configSet` no longer stores a `retentionDays`, `sessionIdleMs` or `sampleRate` value that
|
|
50
|
+
`configure` would reject (for example `retentionDays: "0"`, after which the next `prune`
|
|
51
|
+
deleted every raw event in the scope). The `prune` and `closeSessions` crons also ignore a
|
|
52
|
+
stored value that is not a positive finite number and use the default, so a row written by an
|
|
53
|
+
earlier version cannot wipe data.
|
|
54
|
+
- `metric`, `top`, `timeseries`, `uniques`, `funnel`, `retention`, `distribution`, `list` and
|
|
55
|
+
`backfill` reject empty strings with `EMPTY_STRING`, as the writes do; they used to return
|
|
56
|
+
`0` or empty results, and `backfill` with `dimensions: [""]` dropped every dimension rollup.
|
|
57
|
+
- `list` no longer skips events that share a `ts` at a page edge: the cursor now carries the
|
|
58
|
+
event's `_creationTime` as a tie-break, so paging returns every event exactly once. A
|
|
59
|
+
`cursor: ""` no longer restarts from the newest page.
|
|
45
60
|
- The REST routes return `400 { error, code }` for typed input errors, including nested `props`
|
|
46
|
-
values and non-numeric `from`, `to` or `limit` (
|
|
47
|
-
|
|
48
|
-
`
|
|
49
|
-
|
|
50
|
-
- `metric`, `top` and `timeseries` read only the rollup buckets in the requested range, and
|
|
51
|
-
`uniques` reads only subjects active in range through a new `by_scope_lastSeen` index.
|
|
61
|
+
values and blank or non-numeric `from`, `to` or `limit` (which used to be misread silently),
|
|
62
|
+
and `400 { error }` for non-object bodies and malformed `dimensions` / `granularities` /
|
|
63
|
+
`props`; a malformed stored `apiKeys` value returns `500` with a clear message instead of an
|
|
64
|
+
unhandled exception.
|
|
52
65
|
- Add `.js` extensions to every relative import in `src/` so `@vllnt/convex-analytics/test`
|
|
53
66
|
type-checks under `moduleResolution: nodenext`.
|
|
54
|
-
-
|
|
55
|
-
|
|
56
|
-
- The package build's turbo cache now covers the docs it copies from the repo root, so a build
|
|
57
|
-
can no longer ship stale or missing `README.md`, `LICENSE`, `llms.txt` or `docs/` after a root
|
|
58
|
-
doc change or a cache hit. `pnpm lint` checks this with a turbo dry run.
|
|
67
|
+
- The package build can no longer ship stale or missing `README.md`, `LICENSE`, `llms.txt` or
|
|
68
|
+
`docs/` after a root doc change.
|
|
59
69
|
|
|
60
70
|
### Changed
|
|
61
71
|
|
|
72
|
+
- Calls that now throw for input they accepted before; handle `data.code` or fix the input:
|
|
73
|
+
- `track` with an empty `scope`, `name`, `subjectRef`, `sessionRef`, `dedupeKey` or
|
|
74
|
+
`dimensions` entry (`EMPTY_STRING`), a `NaN` or infinite `ts` (`INVALID_TIMESTAMP`), a
|
|
75
|
+
`sampleRate` outside `0..1` (`INVALID_SAMPLE_RATE`) or a `NaN` or infinite number prop
|
|
76
|
+
(`INVALID_PROP_VALUE`): omit the field or pass a valid value;
|
|
77
|
+
- `configure` with an empty `scope` (`EMPTY_STRING`), a `retentionDays` or `sessionIdleMs`
|
|
78
|
+
that is not a positive finite number (`INVALID_CONFIG`), or a `sampleRate` outside `0..1`
|
|
79
|
+
(`INVALID_SAMPLE_RATE`): pass a valid value or omit it;
|
|
80
|
+
- `configSet` with an empty `scope` or `key` (`EMPTY_STRING`), or an invalid `retentionDays`,
|
|
81
|
+
`sessionIdleMs` or `sampleRate` value (`INVALID_CONFIG`): store what `configure` accepts,
|
|
82
|
+
or call `configure`;
|
|
83
|
+
- `track` (`POST /track` answers `400`; a long `scope` there usually gets `401` first, because
|
|
84
|
+
its `apiKeys` row cannot be stored), `configSet` and `configure` with a capped
|
|
85
|
+
field over 512 characters (`STRING_TOO_LONG`): shorten or hash the value; rows stored earlier
|
|
86
|
+
with longer values stay readable, but `track`, `configSet` and `configure` for them now throw.
|
|
87
|
+
The capped fields are `scope`, `name`, `subjectRef`, `sessionRef`, `dedupeKey`, `dimensions`
|
|
88
|
+
entries and config keys, counted in Unicode code points;
|
|
89
|
+
- reads with an empty `scope`, `name`, `dimension`, `where.dim`, `funnel` step or
|
|
90
|
+
`distribution` `measure`, and `backfill` with an empty `scope`, `name` or `dimensions` entry
|
|
91
|
+
(`EMPTY_STRING`): pass a non-empty value;
|
|
92
|
+
- reads with `NaN` or infinite `range` / `cohortRange` bounds (`INVALID_TIMESTAMP`), a `top`
|
|
93
|
+
`limit`, `retention` `periods` or `list` `numItems` that is not a positive integer
|
|
94
|
+
(`INVALID_COUNT`), or non-finite `distribution` `buckets` (`INVALID_BUCKETS`): pass finite
|
|
95
|
+
values and positive integers;
|
|
96
|
+
- `list` with a `cursor` that is `""`, blank or malformed (`INVALID_CURSOR`): pass `null` for
|
|
97
|
+
the first page, then the previous `continueCursor`. A bare-timestamp cursor from an earlier
|
|
98
|
+
version still works;
|
|
99
|
+
- REST: blank or non-numeric `from`, `to` or `limit`, and a non-null `granularities` that is
|
|
100
|
+
not an array of `minute` / `hour` / `day`, now return `400` (they used to be misread
|
|
101
|
+
silently or, for an unknown granularity, fail with `500`): send valid values.
|
|
102
|
+
- `list` `continueCursor` is now `<ts>:<_creationTime>` (was `<ts>`); treat it as opaque and
|
|
103
|
+
pass it back unchanged.
|
|
104
|
+
- Node: `engines.node` is now `>=20` (was `>=18`), because `convex` 1.45.0, the lowest version
|
|
105
|
+
of the `convex` peer range, requires Node 20 or later.
|
|
106
|
+
- `convex` is now a required peer dependency (range still `^1.45.0`) and no longer also a
|
|
107
|
+
runtime dependency, so a host on an older `convex` 1.x no longer gets a second, nested copy.
|
|
108
|
+
The test suite runs on `convex` 1.51.0, and the README and docs examples are type-checked
|
|
109
|
+
against 1.45.0.
|
|
110
|
+
- Dependencies since `0.1.0`: `@convex-dev/rate-limiter` `^0.3.2` → `^0.4.3` (its component adds a
|
|
111
|
+
`pendingUpdates` table, created on deploy), `@convex-dev/aggregate` `^0.3.0` → `^0.3.4` and
|
|
112
|
+
`@convex-dev/sharded-counter` `^0.2.1` → `^0.2.4`.
|
|
113
|
+
- Reads touch less data: `metric`, `top` and `timeseries` read only the requested series in the
|
|
114
|
+
requested range (`rollups.by_scope_name_dim_val` is replaced by
|
|
115
|
+
`by_scope_name_gran_dim_val_bucket`), and `uniques` reads only subjects active in range
|
|
116
|
+
through a new `subjects.by_scope_lastSeen` index.
|
|
62
117
|
- `track` no longer writes to the `@convex-dev/aggregate` child: no query read it. One fewer
|
|
63
118
|
component call and B-tree write per tracked event. The child stays mounted.
|
|
64
119
|
- Drop the unused `events.by_scope_subject_ts`, `events.by_scope_session_ts` and
|
|
65
120
|
`sessions.by_scope_lastTs` indexes (2 fewer index writes per event, 1 fewer per session write).
|
|
66
|
-
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
logs event data.
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
121
|
+
- Docs: Limits and gotchas now state that write throughput per `(scope, name)` is limited by
|
|
122
|
+
shared rollup, counter and rate-limit rows (parallel bursts can fail with an optimistic
|
|
123
|
+
concurrency error, `500` on `POST /track`, and the event is not stored; retry), that Convex's
|
|
124
|
+
per-function read and time limits can end `funnel`, `retention`, `distribution` and
|
|
125
|
+
`backfill` before their caps, and that a very large `list` `numItems` can hit them too. The
|
|
126
|
+
docs name the crons (`analytics:prune-events`, `analytics:close-sessions`), say the rate limit
|
|
127
|
+
is per `(scope, sessionRef)`, list each method's errors, document the `scopes` table (six tables,
|
|
128
|
+
not five) and the `(scope, name)` key of the sharded counter, and add an input-error table,
|
|
129
|
+
PII guidance and a statement that the component never logs event data. Web-preset examples
|
|
130
|
+
spread the readonly `webDimensions` tuple (`dimensions: [...webDimensions]`) so they
|
|
131
|
+
type-check.
|
|
132
|
+
- Package metadata: `homepage` is https://oss.vllnt.com/packages/convex-analytics.
|
|
133
|
+
- Stable versions are published only from a `vX.Y.Z` tag on `main` with npm provenance; every
|
|
134
|
+
push to `main` publishes a canary build under the `canary` dist-tag.
|
|
135
|
+
- Internal: CI (privacy-guard actions pinned to commit SHAs), tests, release workflow (SHA-pinned
|
|
136
|
+
actions) and tooling (pnpm 10, 7-day release-age gate, dependency overrides); the changelog now
|
|
137
|
+
lives in `packages/convex-analytics/`.
|
|
138
|
+
|
|
139
|
+
### Removed
|
|
140
|
+
|
|
141
|
+
- The repository's `llms-full.txt` bundle; use `llms.txt`.
|
|
142
|
+
|
|
143
|
+
### Security
|
|
144
|
+
|
|
145
|
+
- Docs no longer claim the React hooks are scope-gated: access control and `scope` belong to the
|
|
146
|
+
host query each hook is given.
|
|
88
147
|
|
|
89
148
|
## [0.1.0] - 2026-09-01
|
|
90
149
|
|
package/README.md
CHANGED
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
TypeScript Convex component for event analytics: track events, roll up counts on write, and query metrics, breakdowns, time series, funnels and retention.
|
|
4
4
|
|
|
5
|
+

|
|
6
|
+
|
|
5
7
|
## For coding agents
|
|
6
8
|
|
|
7
9
|
Docs for the installed version are in `node_modules/@vllnt/convex-analytics/`: `docs/`, `llms.txt`, `CHANGELOG.md` and the TypeScript `src/`.
|
|
8
|
-
Every signature is in [docs/client-sdk.md](docs/client-sdk.md); every error is in [Errors and fixes](#errors-and-fixes).
|
|
10
|
+
Every signature is in [docs/client-sdk.md](docs/client-sdk.md), [docs/web-preset.md](docs/web-preset.md) (`./web`) and [docs/react.md](docs/react.md) (`./react`); every error is in [Errors and fixes](#errors-and-fixes).
|
|
9
11
|
|
|
10
12
|
## When to use
|
|
11
13
|
|
|
@@ -363,15 +365,16 @@ them as `400 { "error", "code" }`. Branch on `data.code`.
|
|
|
363
365
|
|
|
364
366
|
| Error | Cause | Fix |
|
|
365
367
|
| --- | --- | --- |
|
|
366
|
-
| `EMPTY_STRING` | `scope`, `name`, `subjectRef`, `sessionRef`, `dedupeKey`, a `dimensions` entry,
|
|
368
|
+
| `EMPTY_STRING` | `scope`, `name`, `subjectRef`, `sessionRef`, `dedupeKey`, a `dimensions` entry, a `configSet` `key`, or a read's `dimension`, `where.dim`, `funnel` step or `distribution` `measure` is `""` (writes, reads and `backfill`) | Omit the optional field instead of passing `""`; pass a non-empty value otherwise |
|
|
369
|
+
| `STRING_TOO_LONG` | A write (`track`, `POST /track`, `configSet`, `configure`) got a `scope`, `name`, `subjectRef`, `sessionRef`, `dedupeKey`, `dimensions` entry or config `key` over 512 characters (Unicode code points) | Shorten or hash the value |
|
|
367
370
|
| `INVALID_TIMESTAMP` | `ts`, `range.from` or `range.to` is `NaN` or infinite (REST: a blank or non-numeric `from` / `to`) | Pass epoch milliseconds as finite numbers |
|
|
368
371
|
| `INVALID_SAMPLE_RATE` | `sampleRate` is not a number from 0 to 1 | Use a value in `[0, 1]` |
|
|
369
372
|
| `INVALID_PROP_KEY` | A `props` key is not printable ASCII, is over 1024 characters, or starts with `$` (checked by `POST /track`; Convex rejects such keys first on function calls) | Rename the key |
|
|
370
373
|
| `INVALID_PROP_VALUE` | A `props` value is `NaN`, infinite, an object or an array | Send flat scalar values only |
|
|
371
374
|
| `INVALID_COUNT` | `limit`, `periods` or `numItems` is not a positive integer | Pass an integer of 1 or more |
|
|
372
|
-
| `INVALID_CURSOR` | A `list` cursor
|
|
375
|
+
| `INVALID_CURSOR` | A `list` cursor is `""`, blank, or not in the form `list` returns | Pass `null` or the previous `continueCursor` |
|
|
373
376
|
| `INVALID_BUCKETS` | A `distribution` bucket bound is `NaN` or infinite | Pass finite numbers |
|
|
374
|
-
| `INVALID_CONFIG` | `retentionDays` or `sessionIdleMs` passed to `configure` is not a positive finite number | Pass a number above 0 |
|
|
377
|
+
| `INVALID_CONFIG` | `retentionDays` or `sessionIdleMs` passed to `configure` or `configSet` is not a positive finite number, or a `configSet` `sampleRate` is not a number from 0 to 1 | Pass a number above 0 (`sampleRate`: from 0 to 1) |
|
|
375
378
|
| `Funnel requires at least 2 steps` | `funnel` got fewer than 2 steps (a plain `Error`, not a `ConvexError`) | Pass 2 or more event names |
|
|
376
379
|
| `backfill requires at most 50000 retained events; existing rollups were preserved` | `backfill` found more than 50,000 raw events for the name (plain `Error`) | Wait for `prune` to remove old events or lower `retentionDays`, then retry |
|
|
377
380
|
| Convex argument validation error | An argument does not match the function validator, for example a nested `props` value or an unknown granularity | Match the types in [docs/client-sdk.md](docs/client-sdk.md) |
|
|
@@ -379,6 +382,7 @@ them as `400 { "error", "code" }`. Branch on `data.code`.
|
|
|
379
382
|
| 401 `API keys not configured` | No `apiKeys` config row for the request's `scope`, or the stored value is `""` | Store keys with `configSet` for that scope |
|
|
380
383
|
| 401 `Invalid API key` | The key is not in the scope's `apiKeys` list | Send a stored key or add it |
|
|
381
384
|
| 500 `API keys misconfigured` | The stored `apiKeys` value is not a JSON array of strings | Store `JSON.stringify(["key"])` |
|
|
385
|
+
| 500 without an `error` or `code` from this package | `POST /track` lost a burst of parallel writes after Convex's optimistic concurrency retries ran out (or another unhandled failure, such as a Convex argument-validator error); the event is not stored | Retry a conflict; it is safe to retry. Fix the input for a validator error |
|
|
382
386
|
| 400 `Invalid JSON body` | `POST /track` body is not JSON | Send a JSON body |
|
|
383
387
|
| 400 `Body must be a JSON object` | `POST /track` body is an array, `null` or a scalar | Send a JSON object |
|
|
384
388
|
| 400 `name is required` | `POST /track` without a non-empty string `name` | Add `name` |
|
|
@@ -395,6 +399,19 @@ them as `400 { "error", "code" }`. Branch on `data.code`.
|
|
|
395
399
|
does not replace one. Questions on props not listed in `dimensions` (unless you `backfill`
|
|
396
400
|
while the raw events are retained), or on raw events older than `retentionDays`, need an
|
|
397
401
|
export of the raw events (for example by paging `list`) to your own store.
|
|
402
|
+
- Write throughput per `(scope, name)` is limited by the shared rows every `track` of that name
|
|
403
|
+
updates: its rollup rows and its lifetime counter, and, for calls that share one `sessionRef` or
|
|
404
|
+
`subjectRef`, that session's rate-limit bucket and its session or subject row. Under a burst of
|
|
405
|
+
parallel calls, some fail with an optimistic
|
|
406
|
+
concurrency error (`POST /track`: a 500) and the event is not stored: retry failed calls or
|
|
407
|
+
queue ingest.
|
|
408
|
+
- Writes accept at most 512 characters (Unicode code points) in `scope`, `name`, `subjectRef`,
|
|
409
|
+
`sessionRef`, `dedupeKey`, each `dimensions` entry and a config `key` (`track`, `POST /track`,
|
|
410
|
+
`configSet`, `configure`); longer values throw `STRING_TOO_LONG`. Reads and `backfill` accept
|
|
411
|
+
longer values, so rows stored earlier with them stay readable, but `track`, `configSet` and
|
|
412
|
+
`configure` for those values now throw. On `POST /track` a `scope` that long usually gets
|
|
413
|
+
`401 API keys not configured` first, because `configSet` refuses its `apiKeys` row (a row
|
|
414
|
+
stored before 0.2.0 passes the key check, and then `400` follows).
|
|
398
415
|
- `track` returns `"dropped"` (no error) when sampled out, or when a `sessionRef` exceeds its
|
|
399
416
|
rate limit: a token bucket per `(scope, sessionRef)` refilling 100 events per minute with
|
|
400
417
|
capacity 10. The limit is fixed. Events without `sessionRef` skip the limiter.
|
|
@@ -414,8 +431,9 @@ them as `400 { "error", "code" }`. Branch on `data.code`.
|
|
|
414
431
|
`backfill` never change.
|
|
415
432
|
- `top`: `limit` defaults to 20 and is capped at 100. It reads every `day` rollup row of the
|
|
416
433
|
event name in the range (all dimensions), so its cost grows with the number of dimension values.
|
|
417
|
-
- `metric`, `top`, `timeseries` and `uniques` collect all matching rows
|
|
418
|
-
|
|
434
|
+
- `metric`, `top`, `timeseries` and `uniques` collect all matching rows, and `list` reads
|
|
435
|
+
`numItems` events per page; very wide ranges, or a very large `numItems` over many events, can
|
|
436
|
+
hit Convex's per-function read and time limits: narrow the range or use a smaller `numItems`.
|
|
419
437
|
- `funnel` reads at most 10,000 events per step, oldest first, and skips events without
|
|
420
438
|
`subjectRef`. Default range: the 30 days before `range.to` (or now).
|
|
421
439
|
- `retention` reads at most 10,000 subjects and caps `periods` at 30. A subject counts only in
|
|
@@ -428,16 +446,21 @@ them as `400 { "error", "code" }`. Branch on `data.code`.
|
|
|
428
446
|
`range.to` is not counted. Default range: the 30 days before `range.to`.
|
|
429
447
|
- `distribution` reads at most 50,000 events, oldest first, then applies `where`; non-numeric
|
|
430
448
|
measure values are ignored. Default `range.from` is 0.
|
|
431
|
-
- `list` has no page-size cap (`numItems` is read as given)
|
|
432
|
-
at a page boundary can be skipped.
|
|
449
|
+
- `list` has no page-size cap (`numItems` is read as given).
|
|
433
450
|
- `retentionDays` (default 90) and `sessionIdleMs` (default 30 minutes) take effect only after
|
|
434
451
|
`configure`; until then the crons use the defaults. `configure` also stores `sampleRate`,
|
|
435
|
-
but nothing reads it: `track` uses the client's `sampleRate`.
|
|
452
|
+
but nothing reads it: `track` uses the client's `sampleRate`. `configSet` accepts only values
|
|
453
|
+
`configure` accepts for these three keys, and the crons ignore a stored value that is not a
|
|
454
|
+
positive finite number.
|
|
436
455
|
- `dedupeKey` matches only retained raw events: after `prune` deletes the first event, the same
|
|
437
456
|
key tracks again.
|
|
438
|
-
- `prune` runs every 24 hours and `closeSessions`
|
|
457
|
+
- `prune` (cron `analytics:prune-events`) runs every 24 hours and `closeSessions` (cron
|
|
458
|
+
`analytics:close-sessions`) every 30 minutes; each deletes or closes at
|
|
439
459
|
most 500 rows per run and reschedules itself, and they page through scopes 100 at a time.
|
|
440
460
|
- `backfill` reads at most 50,001 events and throws if there are more than 50,000.
|
|
461
|
+
- The `funnel`, `retention`, `distribution` and `backfill` caps are upper bounds: Convex's own
|
|
462
|
+
per-function limits on documents read and execution time can end the call earlier, so narrow
|
|
463
|
+
the range (or, for `backfill`, the retained events) when a call fails.
|
|
441
464
|
- REST routes exist only when the component is mounted with `httpPrefix` (it must start with
|
|
442
465
|
`/`). `GET /metric` ignores `dim` without `val` (and the reverse). `POST /track` ignores a
|
|
443
466
|
`ts`, `subjectRef`, `sessionRef`, `dedupeKey` or `sampleRate` of the wrong type instead of
|
|
@@ -462,7 +485,7 @@ them as `400 { "error", "code" }`. Branch on `data.code`.
|
|
|
462
485
|
- `react`: peer `>=18.0.0`, optional; only `@vllnt/convex-analytics/react` imports React. A
|
|
463
486
|
transitive dependency (`@convex-dev/batch-worker` 0.3.3, via `@convex-dev/aggregate`) declares
|
|
464
487
|
`react` as a required peer, so package managers may install it in a backend-only app.
|
|
465
|
-
- Node: `engines` is `>=
|
|
488
|
+
- Node: `engines` is `>=20`, because `convex` 1.45.0 (the lowest supported peer) requires it.
|
|
466
489
|
- ESM only; there is no CommonJS build.
|
|
467
490
|
- The component's functions run in Convex's default runtime. `./web` helpers are plain
|
|
468
491
|
host-side functions with no dependencies. `./react` hooks need a `ConvexProvider`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal_mutations.d.ts","sourceRoot":"","sources":["../../src/component/internal_mutations.ts"],"names":[],"mappings":"AAcA,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAI1D;
|
|
1
|
+
{"version":3,"file":"internal_mutations.d.ts","sourceRoot":"","sources":["../../src/component/internal_mutations.ts"],"names":[],"mappings":"AAcA,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAI1D;AAwBD,oHAAoH;AACpH,eAAO,MAAM,KAAK;;;;;GA6ChB,CAAC;AAEH,0EAA0E;AAC1E,eAAO,MAAM,aAAa;;;;;GAmDxB,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,QAAQ;;;;;;;;GAyEnB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { internal } from "./_generated/api.js";
|
|
2
2
|
import { internalMutation } from "./_generated/server.js";
|
|
3
3
|
import { v } from "convex/values";
|
|
4
|
-
import { granularitiesValidator } from "./validators.js";
|
|
4
|
+
import { assertNonEmpty, granularitiesValidator } from "./validators.js";
|
|
5
5
|
import { bucketStart, valKey } from "../shared.js";
|
|
6
6
|
const MAINTENANCE_CAP = 500;
|
|
7
7
|
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
@@ -13,7 +13,11 @@ export function guardBackfillSize(eventCount) {
|
|
|
13
13
|
throw new Error("backfill requires at most 50000 retained events; existing rollups were preserved");
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Read a positive numeric config value for a scope, falling back to the default. A stored value
|
|
18
|
+
* that is not a finite positive number (for example `"0"` written before `configSet` checked it)
|
|
19
|
+
* is ignored, so it can never move the prune cutoff to now or later.
|
|
20
|
+
*/
|
|
17
21
|
async function readNumber(ctx, scope, key, fallback) {
|
|
18
22
|
const entry = await ctx.db
|
|
19
23
|
.query("config")
|
|
@@ -22,7 +26,7 @@ async function readNumber(ctx, scope, key, fallback) {
|
|
|
22
26
|
if (!entry)
|
|
23
27
|
return fallback;
|
|
24
28
|
const n = Number(entry.value);
|
|
25
|
-
return Number.isFinite(n) ? n : fallback;
|
|
29
|
+
return Number.isFinite(n) && n > 0 ? n : fallback;
|
|
26
30
|
}
|
|
27
31
|
const SCOPE_BATCH = 100;
|
|
28
32
|
/** Delete raw events past `retentionDays` for a scope. Never deletes rollups (only `backfill` does). Idempotent. */
|
|
@@ -108,7 +112,13 @@ export const backfill = internalMutation({
|
|
|
108
112
|
},
|
|
109
113
|
returns: v.object({ events: v.number(), rows: v.number() }),
|
|
110
114
|
handler: async (ctx, args) => {
|
|
111
|
-
|
|
115
|
+
assertNonEmpty("scope", args.scope);
|
|
116
|
+
assertNonEmpty("name", args.name);
|
|
117
|
+
for (const dim of args.dimensions)
|
|
118
|
+
assertNonEmpty("dimensions[]", dim);
|
|
119
|
+
// Each distinct dimension / granularity counts once, however often it is listed.
|
|
120
|
+
const dimensions = [...new Set(args.dimensions)];
|
|
121
|
+
const grans = args.granularities.length > 0 ? [...new Set(args.granularities)] : ["day"];
|
|
112
122
|
const events = await ctx.db
|
|
113
123
|
.query("events")
|
|
114
124
|
.withIndex("by_scope_name_ts", (q) => q.eq("scope", args.scope).eq("name", args.name))
|
|
@@ -131,7 +141,7 @@ export const backfill = internalMutation({
|
|
|
131
141
|
for (const gran of grans) {
|
|
132
142
|
const bucket = bucketStart(e.ts, gran);
|
|
133
143
|
bump(gran, bucket, TOTAL, TOTAL);
|
|
134
|
-
for (const dim of
|
|
144
|
+
for (const dim of dimensions) {
|
|
135
145
|
if (Object.hasOwn(e.props, dim)) {
|
|
136
146
|
bump(gran, bucket, dim, valKey(e.props[dim]));
|
|
137
147
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal_mutations.js","sourceRoot":"","sources":["../../src/component/internal_mutations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"internal_mutations.js","sourceRoot":"","sources":["../../src/component/internal_mutations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAA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M,CAAC,CAAC,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC;wBAChC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAE,CAAC,CAAC,CAAC;oBACjD,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QAED,MAAM,OAAO,CAAC,GAAG,CACf,CAAC,GAAG,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE;YAC7B,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAE,CAAC;YACvB,OAAO,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE;gBAC9B,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,WAAW,EAAE,CAAC,CAAC,IAAI;gBACnB,MAAM,EAAE,CAAC,CAAC,MAAM;gBAChB,GAAG,EAAE,CAAC,CAAC,GAAG;gBACV,GAAG,EAAE,CAAC,CAAC,GAAG;gBACV,KAAK;aACN,CAAC,CAAC;QACL,CAAC,CAAC,CACH,CAAC;QAEF,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;IACtD,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../src/component/mutations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../src/component/mutations.ts"],"names":[],"mappings":"AAuFA,eAAO,MAAM,KAAK;;;;;;;;;;;gDAsJhB,CAAC;AAoBH,eAAO,MAAM,SAAS;;;;iBAWpB,CAAC;AAEH,eAAO,MAAM,SAAS;;;;;iBA6BpB,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { components } from "./_generated/api.js";
|
|
|
3
3
|
import { v } from "convex/values";
|
|
4
4
|
import { ShardedCounter } from "@convex-dev/sharded-counter";
|
|
5
5
|
import { RateLimiter, MINUTE } from "@convex-dev/rate-limiter";
|
|
6
|
-
import { propsValidator, granularitiesValidator, assertProps, assertFiniteTs, assertNonEmpty, assertSampleRate,
|
|
6
|
+
import { propsValidator, granularitiesValidator, assertProps, assertFiniteTs, assertNonEmpty, assertRefLength, assertSampleRate, assertPositiveConfig, assertConfigValue, } from "./validators.js";
|
|
7
7
|
import { bucketStart, tupleKey, valKey } from "../shared.js";
|
|
8
8
|
const counter = new ShardedCounter(components.shardedCounter, {
|
|
9
9
|
defaultShards: 16,
|
|
@@ -53,6 +53,11 @@ async function bumpRollup(ctx, scope, name, granularity, bucket, dim, val) {
|
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
+
/** A string a write stores in an index key: not empty, at most 512 characters. */
|
|
57
|
+
function assertWriteRef(field, value) {
|
|
58
|
+
assertNonEmpty(field, value);
|
|
59
|
+
assertRefLength(field, value);
|
|
60
|
+
}
|
|
56
61
|
export const track = mutation({
|
|
57
62
|
args: {
|
|
58
63
|
scope: v.string(),
|
|
@@ -68,13 +73,13 @@ export const track = mutation({
|
|
|
68
73
|
},
|
|
69
74
|
returns: v.union(v.literal("tracked"), v.literal("dropped"), v.literal("duplicate")),
|
|
70
75
|
handler: async (ctx, args) => {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
assertWriteRef("scope", args.scope);
|
|
77
|
+
assertWriteRef("name", args.name);
|
|
78
|
+
assertWriteRef("subjectRef", args.subjectRef);
|
|
79
|
+
assertWriteRef("sessionRef", args.sessionRef);
|
|
80
|
+
assertWriteRef("dedupeKey", args.dedupeKey);
|
|
76
81
|
for (const dim of args.dimensions)
|
|
77
|
-
|
|
82
|
+
assertWriteRef("dimensions[]", dim);
|
|
78
83
|
assertFiniteTs("ts", args.ts);
|
|
79
84
|
assertSampleRate(args.sampleRate);
|
|
80
85
|
const props = args.props ?? {};
|
|
@@ -82,7 +87,9 @@ export const track = mutation({
|
|
|
82
87
|
const now = Date.now();
|
|
83
88
|
const scope = args.scope;
|
|
84
89
|
const ts = args.ts ?? now;
|
|
85
|
-
|
|
90
|
+
// Each distinct dimension / granularity counts once, however often it is listed.
|
|
91
|
+
const dimensions = [...new Set(args.dimensions)];
|
|
92
|
+
const grans = args.granularities.length > 0 ? [...new Set(args.granularities)] : ["day"];
|
|
86
93
|
if (args.sessionRef !== undefined) {
|
|
87
94
|
const rl = await rateLimiter.limit(ctx, "trackEvent", {
|
|
88
95
|
key: tupleKey(scope, args.sessionRef),
|
|
@@ -168,7 +175,7 @@ export const track = mutation({
|
|
|
168
175
|
for (const granularity of grans) {
|
|
169
176
|
const bucket = bucketStart(ts, granularity);
|
|
170
177
|
await bumpRollup(ctx, scope, args.name, granularity, bucket, TOTAL, TOTAL);
|
|
171
|
-
for (const dim of
|
|
178
|
+
for (const dim of dimensions) {
|
|
172
179
|
if (Object.hasOwn(props, dim)) {
|
|
173
180
|
await bumpRollup(ctx, scope, args.name, granularity, bucket, dim, valKey(props[dim]));
|
|
174
181
|
}
|
|
@@ -195,8 +202,9 @@ export const configSet = mutation({
|
|
|
195
202
|
args: { scope: v.string(), key: v.string(), value: v.string() },
|
|
196
203
|
returns: v.null(),
|
|
197
204
|
handler: async (ctx, args) => {
|
|
198
|
-
|
|
199
|
-
|
|
205
|
+
assertWriteRef("scope", args.scope);
|
|
206
|
+
assertWriteRef("key", args.key);
|
|
207
|
+
assertConfigValue(args.key, args.value);
|
|
200
208
|
await ensureScope(ctx, args.scope);
|
|
201
209
|
await upsertConfig(ctx, args.scope, args.key, args.value);
|
|
202
210
|
return null;
|
|
@@ -211,16 +219,10 @@ export const configure = mutation({
|
|
|
211
219
|
},
|
|
212
220
|
returns: v.null(),
|
|
213
221
|
handler: async (ctx, args) => {
|
|
214
|
-
|
|
222
|
+
assertWriteRef("scope", args.scope);
|
|
215
223
|
assertSampleRate(args.sampleRate);
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
["sessionIdleMs", args.sessionIdleMs],
|
|
219
|
-
]) {
|
|
220
|
-
if (value !== undefined && !(Number.isFinite(value) && value > 0)) {
|
|
221
|
-
throw invalidInput("INVALID_CONFIG", `${field} must be a positive finite number`);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
+
assertPositiveConfig("retentionDays", args.retentionDays);
|
|
225
|
+
assertPositiveConfig("sessionIdleMs", args.sessionIdleMs);
|
|
224
226
|
await ensureScope(ctx, args.scope);
|
|
225
227
|
const entries = [];
|
|
226
228
|
if (args.retentionDays !== undefined) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutations.js","sourceRoot":"","sources":["../../src/component/mutations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,WAAW,EACX,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,
|
|
1
|
+
{"version":3,"file":"mutations.js","sourceRoot":"","sources":["../../src/component/mutations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,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;IACd,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../src/component/queries.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../src/component/queries.ts"],"names":[],"mappings":"AAmFA,kFAAkF;AAClF,eAAO,MAAM,MAAM;;;;;;;;;;;mBAuBjB,CAAC;AAEH,8DAA8D;AAC9D,eAAO,MAAM,GAAG;;;;;;;;;;;;KA6Bd,CAAC;AAEH,gFAAgF;AAChF,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;KAqBrB,CAAC;AAEH,mEAAmE;AACnE,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;GAiDlB,CAAC;AAEH,oEAAoE;AACpE,eAAO,MAAM,MAAM;;;;;;;;UAqCc,MAAM;WAAS,MAAM;UAAQ,MAAM;KA6BlE,CAAC;AAEH,gDAAgD;AAChD,eAAO,MAAM,SAAS;;;;;;;;;;;;KAqDpB,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;GAwDvB,CAAC;AAkBH,4DAA4D;AAC5D,eAAO,MAAM,IAAI;;;;;;;;;aAqDK,MAAM;;;;;;;;;;;;;GAe1B,CAAC;AAEH,8CAA8C;AAC9C,eAAO,MAAM,SAAS;;;0BAYpB,CAAC"}
|