@vllnt/convex-analytics 0.1.0 → 0.1.1-canary.879bde1

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 (46) hide show
  1. package/CHANGELOG.md +125 -0
  2. package/README.md +99 -38
  3. package/dist/component/crons.js +1 -1
  4. package/dist/component/crons.js.map +1 -1
  5. package/dist/component/http.d.ts +5 -0
  6. package/dist/component/http.d.ts.map +1 -1
  7. package/dist/component/http.js +76 -21
  8. package/dist/component/http.js.map +1 -1
  9. package/dist/component/internal_mutations.js +4 -4
  10. package/dist/component/internal_mutations.js.map +1 -1
  11. package/dist/component/mutations.d.ts.map +1 -1
  12. package/dist/component/mutations.js +28 -13
  13. package/dist/component/mutations.js.map +1 -1
  14. package/dist/component/queries.d.ts.map +1 -1
  15. package/dist/component/queries.js +57 -58
  16. package/dist/component/queries.js.map +1 -1
  17. package/dist/component/schema.d.ts +2 -4
  18. package/dist/component/schema.js +10 -5
  19. package/dist/component/schema.js.map +1 -1
  20. package/dist/component/validators.d.ts +27 -0
  21. package/dist/component/validators.d.ts.map +1 -1
  22. package/dist/component/validators.js +54 -1
  23. package/dist/component/validators.js.map +1 -1
  24. package/dist/react/index.d.ts +1 -1
  25. package/dist/react/index.js +1 -1
  26. package/dist/test.d.ts +2 -4
  27. package/dist/web/index.d.ts +2 -2
  28. package/dist/web/index.js +2 -2
  29. package/docs/api-reference.md +132 -0
  30. package/docs/architecture.md +70 -0
  31. package/docs/client-sdk.md +249 -0
  32. package/docs/multi-product.md +69 -0
  33. package/docs/quick-start.md +115 -0
  34. package/docs/schema.md +135 -0
  35. package/docs/web-preset.md +104 -0
  36. package/llms.txt +37 -0
  37. package/package.json +39 -27
  38. package/src/component/crons.ts +1 -1
  39. package/src/component/http.ts +78 -21
  40. package/src/component/internal_mutations.ts +5 -5
  41. package/src/component/mutations.ts +37 -15
  42. package/src/component/queries.ts +83 -64
  43. package/src/component/schema.ts +10 -5
  44. package/src/component/validators.ts +80 -1
  45. package/src/react/index.tsx +1 -1
  46. package/src/web/index.ts +2 -2
@@ -0,0 +1,69 @@
1
+ # Multi-Product Scoping
2
+
3
+ Every table, mutation, and query is partitioned by a single opaque `scope` string. Use it to
4
+ isolate products, environments, tenants, or platforms — whatever partition your host needs.
5
+
6
+ | Concept | Field | Default |
7
+ | --------- | ------- | ----------- |
8
+ | Partition | `scope` | `"default"` |
9
+
10
+ ## How scoping works
11
+
12
+ ### Set a default scope on the client
13
+
14
+ ```ts
15
+ const analytics = new AnalyticsClient(components.analytics, {
16
+ scope: "my-saas",
17
+ dimensions: ["plan"],
18
+ });
19
+ ```
20
+
21
+ ### Override per call
22
+
23
+ ```ts
24
+ await analytics.track(ctx, "signup", {
25
+ subjectRef: userId,
26
+ scope: "customer-a",
27
+ });
28
+ const total = await analytics.metric(ctx, "signup", { scope: "customer-a" });
29
+ ```
30
+
31
+ Every read takes the same `scope` option; omit it to fall back to the client's default.
32
+
33
+ ## What scope isolates
34
+
35
+ - `events`, `rollups`, `subjects`, `sessions`, `scopes`, and `config` rows are keyed by `scope`.
36
+ - All indexes lead with `scope`, so reads never span partitions.
37
+ - The sharded counter is keyed by `(scope, name)`, so totals are per-scope.
38
+ - `configure` persists retention/sampling/idle per scope.
39
+
40
+ ## Patterns
41
+
42
+ **Per-tenant SaaS** — one `scope` per customer:
43
+
44
+ ```ts
45
+ await analytics.track(ctx, "feature_used", {
46
+ subjectRef: userId,
47
+ scope: "customer-a",
48
+ });
49
+ const used = await analytics.metric(ctx, "feature_used", {
50
+ scope: "customer-a",
51
+ });
52
+ ```
53
+
54
+ **Environment split** — separate staging from production:
55
+
56
+ ```ts
57
+ const scope = process.env.CONVEX_ENV === "production" ? "prod" : "staging";
58
+ await analytics.track(ctx, "signup", { scope });
59
+ ```
60
+
61
+ **Platform split** — compare web vs mobile by scope, or keep one scope and break down on a
62
+ `platform` prop dimension instead.
63
+
64
+ ## Mounting vs scope
65
+
66
+ For a **static** set of partitions (web + mobile + file analytics), you can also mount the
67
+ component multiple times (`app.use(analytics, { name })`) — each mount is fully sandboxed.
68
+ Reach for `scope` when partitions are **runtime-created** (a new tenant you can't declare at
69
+ deploy time).
@@ -0,0 +1,115 @@
1
+ # Quick Start
2
+
3
+ Get generic analytics running in your Convex app in a few minutes.
4
+
5
+ ## 1. Install
6
+
7
+ ```bash
8
+ npm install @vllnt/convex-analytics
9
+ # or: pnpm add @vllnt/convex-analytics
10
+ ```
11
+
12
+ ## 2. Mount the component
13
+
14
+ In your `convex/convex.config.ts`:
15
+
16
+ ```ts
17
+ import { defineApp } from "convex/server";
18
+ import analytics from "@vllnt/convex-analytics/convex.config";
19
+
20
+ const app = defineApp();
21
+ app.use(analytics);
22
+ export default app;
23
+ ```
24
+
25
+ ## 3. Create a client
26
+
27
+ ```ts
28
+ import { AnalyticsClient } from "@vllnt/convex-analytics";
29
+ import { components } from "./_generated/api";
30
+
31
+ type MyProps = { plan?: string; country?: string };
32
+
33
+ const analytics = new AnalyticsClient<MyProps>(components.analytics, {
34
+ dimensions: ["plan", "country"], // host-declared rollup keys
35
+ granularities: ["day"],
36
+ });
37
+ ```
38
+
39
+ `TProps` types the `props` you pass to `track`. See [Client SDK](./client-sdk.md) for the
40
+ full config and verb reference.
41
+
42
+ ## 4. Track your first event
43
+
44
+ Inside a Convex mutation:
45
+
46
+ ```ts
47
+ await analytics.track(ctx, "signup", {
48
+ subjectRef: userId,
49
+ props: { plan: "pro", country: "FR" },
50
+ });
51
+ ```
52
+
53
+ Event names are free strings; `subjectRef` / `sessionRef` are opaque to the component.
54
+
55
+ ## 5. Read
56
+
57
+ ```ts
58
+ const total = await analytics.metric(ctx, "signup");
59
+ const byPlan = await analytics.top(ctx, "signup", "plan");
60
+ const trend = await analytics.timeseries(ctx, "signup", {
61
+ granularity: "day",
62
+ range: { from: Date.now() - 30 * 86_400_000, to: Date.now() },
63
+ });
64
+ ```
65
+
66
+ ## 6. (Optional) REST access
67
+
68
+ First change the mount to `app.use(analytics, { httpPrefix: "/analytics" })` and deploy.
69
+ Without `httpPrefix`, the component's HTTP routes are not exposed.
70
+ Configure API keys from a trusted internal/admin-only mutation, then call the REST surface:
71
+
72
+ ```ts
73
+ // The client has no configSet method: use the component mutation.
74
+ await ctx.runMutation(components.analytics.mutations.configSet, {
75
+ scope: "default",
76
+ key: "apiKeys",
77
+ value: JSON.stringify(["your-key"]),
78
+ });
79
+ ```
80
+
81
+ ```bash
82
+ curl -H "x-api-key: your-key" \
83
+ "https://your-deployment.convex.site/analytics/metric?name=signup"
84
+ ```
85
+
86
+ See the [REST API](./api-reference.md) for all five routes.
87
+
88
+ ## 7. (Optional) Web preset
89
+
90
+ ```ts
91
+ import { webDimensions, trackPageview } from "@vllnt/convex-analytics/web";
92
+
93
+ const web = new AnalyticsClient(components.analytics, {
94
+ dimensions: [...webDimensions],
95
+ });
96
+ await trackPageview(web, ctx, { path: "/pricing", headers: request.headers });
97
+ ```
98
+
99
+ See [Web Preset](./web-preset.md).
100
+
101
+ ## 8. Testing
102
+
103
+ ```ts
104
+ import analyticsTest from "@vllnt/convex-analytics/test";
105
+ import { convexTest } from "convex-test";
106
+
107
+ const t = convexTest(hostSchema, hostModules);
108
+ analyticsTest.register(t);
109
+ ```
110
+
111
+ ## Next steps
112
+
113
+ - [Client SDK](./client-sdk.md) — full config + verb reference
114
+ - [Schema](./schema.md) — the six sandboxed tables
115
+ - [Web Preset](./web-preset.md) — opt-in web dimensions + helpers
package/docs/schema.md ADDED
@@ -0,0 +1,135 @@
1
+ # Database Schema
2
+
3
+ Six sandboxed tables. Generic and domain-neutral — zero hardcoded web fields, zero
4
+ `v.any()`. Schema source of truth: `src/component/schema.ts` in the package
5
+ (`packages/convex-analytics/src/component/schema.ts` in the repository).
6
+
7
+ ## events
8
+
9
+ Raw event log. One row per tracked event. TTL-pruned past `retentionDays` (rollups are
10
+ kept forever).
11
+
12
+ | Field | Type | Description |
13
+ | ------------ | ---------------------- | ---------------------------------------------------------------- |
14
+ | `scope` | string | Multi-tenant partition. Default `"default"`. |
15
+ | `name` | string | Free-string event name (e.g. `"signup"`, `"page_view"`). |
16
+ | `subjectRef` | string? | Opaque subject identifier (user id, device id, …). |
17
+ | `sessionRef` | string? | Opaque session identifier. |
18
+ | `props` | record<string, scalar> | Flat host props. Scalar = string \| number \| boolean \| null. |
19
+ | `ts` | number | Event time (epoch ms). |
20
+ | `seq` | number | Sequence within the session (derived from `session.eventCount`). |
21
+ | `dedupeKey` | string? | Optional idempotency key. |
22
+
23
+ **Indexes:**
24
+
25
+ | Index | Fields | Purpose |
26
+ | --------------------- | ----------------------- | ---------------------------------------- |
27
+ | `by_scope_name_ts` | [scope, name, ts] | funnel, distribution, list, backfill. |
28
+ | `by_scope_ts` | [scope, ts] | Retention prune. |
29
+ | `by_dedupe` | [scope, dedupeKey] | Dedupe lookup at ingest. |
30
+
31
+ ## rollups
32
+
33
+ Pre-aggregated counts, incremented on write. One row per
34
+ `(scope, name, granularity, bucket, dim, val)`. The row with `dim = ""` and `val = ""` is
35
+ the **total** for that bucket; one row per host-declared dimension value present in `props`.
36
+
37
+ | Field | Type | Description |
38
+ | ------------- | --------------------------- | -------------------------------------------------- |
39
+ | `scope` | string | Partition. |
40
+ | `name` | string | Event name. |
41
+ | `granularity` | "minute" \| "hour" \| "day" | Bucket size. |
42
+ | `bucket` | number | Bucket start (epoch ms, truncated to granularity). |
43
+ | `dim` | string | Dimension key (`""` = total). |
44
+ | `val` | string | Dimension value (`""` = total). |
45
+ | `count` | number | Events in this bucket/dimension. |
46
+
47
+ **Indexes:**
48
+
49
+ | Index | Fields | Purpose |
50
+ | ------------------------------- | -------------------------------------------- | ------------------------------------------------- |
51
+ | `by_scope_name_gran_bucket_dim` | [scope, name, granularity, bucket, dim, val] | top reads, on-write upsert. |
52
+ | `by_scope_name_gran_dim_val_bucket` | [scope, name, granularity, dim, val, bucket] | metric / timeseries reads of one series, backfill. |
53
+
54
+ ## subjects
55
+
56
+ Per-subject lifecycle, for uniques and retention. Upserted on every event that carries a
57
+ `subjectRef`.
58
+
59
+ | Field | Type | Description |
60
+ | ------------ | ------ | ------------------------------ |
61
+ | `scope` | string | Partition. |
62
+ | `subjectRef` | string | Opaque subject identifier. |
63
+ | `firstSeen` | number | Earliest event ts. |
64
+ | `lastSeen` | number | Latest event ts. |
65
+ | `eventCount` | number | Total events for this subject. |
66
+
67
+ **Indexes:**
68
+
69
+ | Index | Fields | Purpose |
70
+ | -------------------- | ------------------- | ------------------------------------------------- |
71
+ | `by_scope_subject` | [scope, subjectRef] | Direct lookup / upsert. |
72
+ | `by_scope_firstSeen` | [scope, firstSeen] | Cohort (retention) scans. |
73
+ | `by_scope_lastSeen` | [scope, lastSeen] | Uniques: loads only subjects active in the range. |
74
+
75
+ ## sessions
76
+
77
+ Optional generic session aggregates. Created when an event carries a `sessionRef`; closed
78
+ by the `closeSessions` cron after `sessionIdleMs`.
79
+
80
+ | Field | Type | Description |
81
+ | ------------ | ------- | ----------------------------------------- |
82
+ | `scope` | string | Partition. |
83
+ | `sessionRef` | string | Opaque session identifier. |
84
+ | `subjectRef` | string? | Subject the session belongs to, if known. |
85
+ | `startTs` | number | First event ts. |
86
+ | `endTs` | number? | Set when the session is closed by cron. |
87
+ | `lastTs` | number | Latest event ts. |
88
+ | `eventCount` | number | Events in the session. |
89
+
90
+ **Indexes:**
91
+
92
+ | Index | Fields | Purpose |
93
+ | ------------------ | ------------------- | ------------------------------------------ |
94
+ | `by_scope_session` | [scope, sessionRef] | Direct lookup / upsert. |
95
+ | `by_scope_endTs_lastTs` | [scope, endTs, lastTs] | Idle open-session scan for close-sessions cron. |
96
+
97
+ ## scopes
98
+
99
+ Registry of every scope that has tracked an event. Written by `track` the first time a scope
100
+ is seen; the `prune` and `closeSessions` crons page through it to visit each scope.
101
+
102
+ | Field | Type | Description |
103
+ | ------- | ------ | ----------- |
104
+ | `scope` | string | Partition. |
105
+
106
+ **Indexes:**
107
+
108
+ | Index | Fields | Purpose |
109
+ | ---------- | ------- | ------------------------------- |
110
+ | `by_scope` | [scope] | Existence check; cron paging. |
111
+
112
+ ## config
113
+
114
+ Cron-relevant config, keyed by `(scope, key)`. Values are stored as strings. Set via
115
+ `client.configure(ctx, { ... })`; also holds the REST `apiKeys` array (JSON string).
116
+
117
+ | Field | Type | Description |
118
+ | ------- | ------ | ----------------------------------------------------------------------- |
119
+ | `scope` | string | Partition. |
120
+ | `key` | string | Config key (`retentionDays`, `sampleRate`, `sessionIdleMs`, `apiKeys`). |
121
+ | `value` | string | String-encoded value. |
122
+
123
+ **Indexes:**
124
+
125
+ | Index | Fields | Purpose |
126
+ | -------------- | ------------ | --------------------- |
127
+ | `by_scope_key` | [scope, key] | Direct config lookup. |
128
+
129
+ ## Child components
130
+
131
+ | Component | Package | Role |
132
+ | -------------- | ----------------------------- | ---------------------------------------- |
133
+ | aggregate | `@convex-dev/aggregate` | Mounted for compatibility; not written or read. |
134
+ | shardedCounter | `@convex-dev/sharded-counter` | O(1) total per `(scope, name)` (16 shards). |
135
+ | rateLimiter | `@convex-dev/rate-limiter` | Per-`sessionRef` token bucket at ingest. |
@@ -0,0 +1,104 @@
1
+ # Web Preset
2
+
3
+ An opt-in layer for web analytics. Pure host-side helpers — **not** part of the sandboxed
4
+ component. The generic core stays domain-neutral; you turn on web breakdowns by passing
5
+ `webDimensions` to the client and using `trackPageview` to ingest page views.
6
+
7
+ Import: `@vllnt/convex-analytics/web`. Source: `src/web/index.ts` in the package
8
+ (`packages/convex-analytics/src/web/index.ts` in the repository).
9
+
10
+ ## webDimensions
11
+
12
+ ```ts
13
+ import { AnalyticsClient } from "@vllnt/convex-analytics";
14
+ import { webDimensions } from "@vllnt/convex-analytics/web";
15
+
16
+ const analytics = new AnalyticsClient(components.analytics, {
17
+ dimensions: [...webDimensions],
18
+ });
19
+ ```
20
+
21
+ `webDimensions` is the standard web rollup set:
22
+
23
+ ```ts
24
+ [
25
+ "path",
26
+ "referrer",
27
+ "device",
28
+ "browser",
29
+ "os",
30
+ "country",
31
+ "utmSource",
32
+ "utmMedium",
33
+ "utmCampaign",
34
+ ];
35
+ ```
36
+
37
+ `webDimensions` is a readonly tuple and `dimensions` is a `string[]`, so spread it as above.
38
+ Pass it to the client's `dimensions` config to roll up on those prop keys. Off by default —
39
+ the generic core has zero web fields.
40
+
41
+ ## parseUserAgent
42
+
43
+ ```ts
44
+ parseUserAgent(ua: string): { device: string; browser: string; os: string }
45
+ ```
46
+
47
+ Pure, dependency-free. Coarse buckets suitable for rollups (not exact versioning). Unknown
48
+ agents fall back to `"Other"` / `"desktop"`. Device buckets: `desktop` / `mobile` / `tablet`
49
+ / `bot`.
50
+
51
+ ## geoFromHeaders
52
+
53
+ ```ts
54
+ geoFromHeaders(headers: Headers | Record<string, string>): { country: string; region?: string; city?: string }
55
+ ```
56
+
57
+ Resolves geo from Cloudflare (`CF-IPCountry`) and Vercel (`X-Vercel-IP-*`) edge headers.
58
+ Accepts a DOM `Headers` instance or a plain object (case-insensitive). `country` defaults to
59
+ `"unknown"`.
60
+
61
+ ## trackPageview
62
+
63
+ ```ts
64
+ trackPageview(client, ctx, {
65
+ path: string; // required
66
+ subjectRef?: string;
67
+ sessionRef?: string;
68
+ referrer?: string;
69
+ ua?: string; // parsed into device/browser/os
70
+ headers?: Headers | Record<string, string>; // parsed into country/region/city
71
+ utm?: { source?: string; medium?: string; campaign?: string };
72
+ ts?: number;
73
+ scope?: string;
74
+ dedupeKey?: string;
75
+ }): Promise<unknown>
76
+ ```
77
+
78
+ Builds `webDimensions`-shaped `props` (parsing UA + geo) and calls
79
+ `client.track(ctx, "page_view", { props })`. The component never sees web concepts — this is
80
+ host-side convenience only.
81
+
82
+ ```ts
83
+ await trackPageview(analytics, ctx, {
84
+ path: "/pricing",
85
+ ua: request.headers.get("user-agent") ?? undefined,
86
+ headers: request.headers,
87
+ utm: { source: "twitter" },
88
+ });
89
+ ```
90
+
91
+ Then read web breakdowns with the generic verbs:
92
+
93
+ ```ts
94
+ await analytics.top(ctx, "page_view", "country");
95
+ await analytics.timeseries(ctx, "page_view", { granularity: "day", range });
96
+ ```
97
+
98
+ ## React
99
+
100
+ The optional `@vllnt/convex-analytics/react` entry ships reactive hooks over the host's
101
+ re-exported aggregate query refs: `useMetric`, `useTop`, `useTimeseries`, `useUniques`. They
102
+ wrap `convex/react`'s `useQuery`; `react` is an optional peer dep, so a backend-only
103
+ consumer pulls no React code. Aggregates only (no raw events), every call
104
+ scope-gated. See the React section of the README.
package/llms.txt ADDED
@@ -0,0 +1,37 @@
1
+ # @vllnt/convex-analytics
2
+
3
+ > A generic, configurable, embedded analytics component for Convex — any event, any dimension, any domain — with rollup-on-write for reactive aggregate reads. Only unfiltered lifetime metrics use fixed-shard counter reads; other aggregate reads scale with matching rollups. Mount via `app.use()` in any Convex app.
4
+
5
+ The component owns a standardized, typed schema (events, rollups, subjects, sessions,
6
+ scopes, config); host data enters only as opaque refs (`subjectRef`, `sessionRef`) and
7
+ host-typed scalar `props` — never `v.any()`. Host-declared `dimensions` drive rollup-on-write;
8
+ the verb set (`metric`, `top`, `timeseries`, `uniques`, `funnel`, `retention`, `distribution`,
9
+ `list`) is generic, across `minute`/`hour`/`day` granularities. Web
10
+ analytics is the opt-in `@vllnt/convex-analytics/web` preset; reactive hooks ship as the
11
+ optional `@vllnt/convex-analytics/react` entry. Peer dependency: `convex@^1.45.0`
12
+ (`react@>=18` optional for the `./react` entry).
13
+
14
+ For coding agents: these docs ship inside the npm package at
15
+ `node_modules/@vllnt/convex-analytics/docs/` and match the installed version, as do
16
+ `src/` and `CHANGELOG.md`. Read them before writing code against this package.
17
+
18
+ ## Docs
19
+
20
+ - [Quick Start](./docs/quick-start.md): Install, mount, track, read
21
+ - [Client SDK](./docs/client-sdk.md): `AnalyticsClient<TProps>` config, verbs, types
22
+ - [Schema](./docs/schema.md): events, rollups, subjects, sessions, scopes, config + indexes
23
+ - [REST API](./docs/api-reference.md): the five generic routes (/track, /metric, /top, /timeseries, /uniques)
24
+ - [Web Preset](./docs/web-preset.md): opt-in web dimensions + UA/geo helpers + React note
25
+ - [Multi-Product](./docs/multi-product.md): the opaque `scope` partition
26
+ - [Architecture](./docs/architecture.md): rollup-on-write, child components, crons
27
+ - [Changelog](./CHANGELOG.md): version history, including unreleased changes
28
+
29
+ ## Ecosystem
30
+
31
+ - [vllnt oss](https://oss.vllnt.com/llms.txt): index of every `@vllnt` package
32
+
33
+ ## Optional
34
+
35
+ - [Contributing](https://github.com/vllnt/convex-analytics/blob/main/CONTRIBUTING.md)
36
+ - [Security](https://github.com/vllnt/convex-analytics/blob/main/SECURITY.md)
37
+ - [License](./LICENSE): MIT license
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@vllnt/convex-analytics",
3
- "version": "0.1.0",
4
- "description": "Generic, configurable analytics component for Convex \u2014 any event, any dimension, any domain; rollup-on-write with funnels, retention, uniques",
3
+ "version": "0.1.1-canary.879bde1",
4
+ "description": "Generic, configurable analytics component for Convex — any event, any dimension, any domain; rollup-on-write with funnels, retention, uniques",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
- "packageManager": "pnpm@9.15.0",
7
+ "packageManager": "pnpm@10.34.8",
8
8
  "main": "./dist/client/index.js",
9
9
  "module": "./dist/client/index.js",
10
10
  "types": "./dist/client/index.d.ts",
@@ -28,6 +28,10 @@
28
28
  "types": "./dist/component/convex.config.d.ts",
29
29
  "default": "./dist/component/convex.config.js"
30
30
  },
31
+ "./convex.config.js": {
32
+ "types": "./dist/component/convex.config.d.ts",
33
+ "default": "./dist/component/convex.config.js"
34
+ },
31
35
  "./_generated/component.js": {
32
36
  "types": "./dist/component/_generated/component.d.ts"
33
37
  }
@@ -35,52 +39,60 @@
35
39
  "files": [
36
40
  "dist",
37
41
  "src",
42
+ "docs/quick-start.md",
43
+ "docs/client-sdk.md",
44
+ "docs/schema.md",
45
+ "docs/api-reference.md",
46
+ "docs/web-preset.md",
47
+ "docs/multi-product.md",
48
+ "docs/architecture.md",
38
49
  "README.md",
39
- "LICENSE"
50
+ "LICENSE",
51
+ "CHANGELOG.md",
52
+ "llms.txt",
53
+ "!src/**/*.test.*",
54
+ "!src/**/*.spec.*"
40
55
  ],
41
56
  "scripts": {
42
- "build": "rm -rf dist && tsc && cp ../../README.md ../../LICENSE ./",
57
+ "build": "rm -rf dist docs && tsc && cp ../../README.md ../../LICENSE ../../llms.txt ./ && cp -R ../../docs ./docs",
43
58
  "test": "vitest run",
44
59
  "test:watch": "vitest",
45
60
  "test:coverage": "vitest run --coverage",
46
- "typecheck": "tsc --noEmit",
47
- "typecheck:ci": "tsc --noEmit",
48
- "lint": "pnpm --dir ../.. check:agents && eslint src/",
49
- "generate:llms": "node scripts/generate-llms.mjs",
50
- "preversion": "pnpm install --frozen-lockfile && pnpm build && pnpm test:coverage && pnpm typecheck && pnpm generate:llms",
61
+ "typecheck": "tsc --noEmit --incremental --tsBuildInfoFile node_modules/.cache/tsc/typecheck.tsbuildinfo",
62
+ "typecheck:ci": "tsc --noEmit --incremental --tsBuildInfoFile node_modules/.cache/tsc/typecheck-ci.tsbuildinfo",
63
+ "lint": "pnpm --dir ../.. check:agents && eslint --cache --cache-location node_modules/.cache/eslint/ src/",
64
+ "preversion": "pnpm install --frozen-lockfile && pnpm build && pnpm test:coverage && pnpm typecheck",
51
65
  "codegen": "node scripts/codegen.mjs",
66
+ "test:package": "node scripts/test-package.mjs",
52
67
  "build:codegen": "pnpm codegen && pnpm build"
53
68
  },
54
69
  "dependencies": {
55
- "@convex-dev/aggregate": "^0.3.0",
56
- "@convex-dev/rate-limiter": "^0.3.2",
57
- "@convex-dev/sharded-counter": "^0.2.1",
58
- "convex": "^1.45.0"
70
+ "@convex-dev/aggregate": "^0.3.4",
71
+ "@convex-dev/rate-limiter": "^0.4.2",
72
+ "@convex-dev/sharded-counter": "^0.2.3"
59
73
  },
60
74
  "devDependencies": {
61
75
  "@edge-runtime/vm": "^5.0.0",
62
76
  "@testing-library/react": "^16.3.3",
63
- "@types/react": "^19.2.18",
77
+ "@types/react": "^19.3.0",
64
78
  "@typescript/native": "npm:typescript@7.0.2",
65
- "@vitest/coverage-v8": "^4.1.11",
66
- "@vllnt/eslint-config": "2.0.0",
79
+ "@vitest/coverage-v8": "^5.0.5",
67
80
  "@vllnt/typescript": "2.0.0",
68
- "convex-test": "^0.0.56",
69
- "jsdom": "^29.1.1",
70
- "react": "^19.2.8",
71
- "react-dom": "^19.2.8",
81
+ "convex": "^1.48.0",
82
+ "convex-test": "^0.0.65",
83
+ "eslint": "^9.39.5",
84
+ "jsdom": "^30.1.3",
85
+ "react": "^19.3.1",
86
+ "react-dom": "^19.3.1",
72
87
  "typescript": "npm:@typescript/typescript6@^6.0.2",
73
- "vite": "^8.2.2",
74
- "vitest": "^4.1.11"
88
+ "vite": "^8.3.5",
89
+ "vitest": "^5.0.5"
75
90
  },
76
91
  "peerDependencies": {
77
92
  "convex": "^1.45.0",
78
93
  "react": ">=18.0.0"
79
94
  },
80
95
  "peerDependenciesMeta": {
81
- "convex": {
82
- "optional": true
83
- },
84
96
  "react": {
85
97
  "optional": true
86
98
  }
@@ -99,7 +111,7 @@
99
111
  "type": "github",
100
112
  "url": "https://github.com/sponsors/bntvllnt"
101
113
  },
102
- "homepage": "https://github.com/vllnt/convex-analytics#readme",
114
+ "homepage": "https://oss.vllnt.com/packages/convex-analytics",
103
115
  "bugs": {
104
116
  "url": "https://github.com/vllnt/convex-analytics/issues"
105
117
  },
@@ -1,5 +1,5 @@
1
1
  import { cronJobs } from "convex/server";
2
- import { internal } from "./_generated/api";
2
+ import { internal } from "./_generated/api.js";
3
3
 
4
4
  const crons = cronJobs();
5
5