@vllnt/convex-events 0.2.0-canary.a6c63aa → 0.2.0-canary.f67f4ae

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 CHANGED
@@ -14,6 +14,15 @@ All notable changes to this project are documented here. The format is based on
14
14
  is no actor.
15
15
  - **Breaking:** `purge` throws `INVALID_ARGUMENT` for an empty `subjectRef`. Pass the subject to
16
16
  purge.
17
+ - **Breaking:** `record` throws `INVALID_ARGUMENT` when `subjectRef`, `type` or `actorRef` is longer
18
+ than 512 characters (UTF-16 code units), so oversized refs never reach storage or indexes. Keep
19
+ them at or under 512 characters, for example by hashing longer ids. Hashing a long id gives a new
20
+ `subjectRef`, so read or purge older events with the original value. Events are append-only and
21
+ never updated, so there is no update path: rows stored earlier keep their longer values and stay
22
+ readable, countable and purgeable, because `list`, `paginate`, `count` and `purge` do not check
23
+ the length. Only new `record` calls are checked. The cap runs before the duplicate check, so a
24
+ retried `record` with an old long ref and the same `idempotencyKey` now throws `INVALID_ARGUMENT`
25
+ instead of returning the existing id.
17
26
  - **Breaking:** `list` and `paginate` throw `ConvexError({ code: "INVALID_SINCE" })` when `since`
18
27
  is `NaN`, `Infinity` or `-Infinity`. Pass a millisecond timestamp, or omit `since` to read from
19
28
  the start.
@@ -21,8 +30,9 @@ All notable changes to this project are documented here. The format is based on
21
30
  20, and convex 1.49 and newer need Node.js 22. The `convex` peer range is unchanged
22
31
  (`^1.45.0`).
23
32
  - README rewritten in a fixed, agent-first order, with every error code and its fix, limits,
24
- compatibility and testing; `docs/API.md` has one section per export and method; `llms.txt`
25
- links to the shipped docs.
33
+ compatibility and testing, plus the `canary` install, the React and test dependency commands
34
+ and the `convex/schema.ts` the test example imports; `docs/API.md` has one section per export
35
+ and method; `llms.txt` links to the shipped docs.
26
36
  - `package.json` `description`, `keywords` and `homepage`
27
37
  (`https://oss.vllnt.com/packages/convex-events`) describe the package, and the `record` TSDoc
28
38
  lists the guards in the order they run.
package/README.md CHANGED
@@ -28,6 +28,11 @@ before writing code against this package.
28
28
  pnpm add @vllnt/convex-events convex
29
29
  ```
30
30
 
31
+ Unreleased builds from `main` are published under the `canary` dist-tag:
32
+ `pnpm add @vllnt/convex-events@canary convex`. The React hooks need
33
+ `pnpm add react` (and `pnpm add -D @types/react` for TypeScript). Testing lists
34
+ the test dependencies.
35
+
31
36
  ## Quick start
32
37
 
33
38
  ```ts
@@ -360,27 +365,27 @@ export const gameEvents = new Events(components.gameEvents);
360
365
  The component throws a `ConvexError` whose `data` is `{ code, message }`. Catch
361
366
  it in the host with `error instanceof ConvexError` and read `error.data.code`.
362
367
 
363
- | Code | Message | Cause | Fix |
364
- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
365
- | `INVALID_ARGUMENT` | `subjectRef must be non-empty` (or `type`, `actorRef`) | `record` got an empty `subjectRef`, `type` or `actorRef`; `purge` got an empty `subjectRef` | Pass non-empty strings; omit `actorRef` instead of passing `""` |
366
- | `INVALID_IDEMPOTENCY_KEY` | `idempotencyKey must be between 1 and 256 characters` | `record` got an empty key or one longer than 256 UTF-16 code units | Pass 1..256 characters; hash longer ids |
367
- | `INVALID_LIMIT` | `limit must be an integer between 1 and 1000` (or `paginationOpts.numItems`), `maxCount must be an integer between 0 and 1000` | `list` `limit` or `paginate` `numItems` outside 1..1000; `count` `maxCount` outside 0..1000 | Pass an integer in range; page with `paginate` to read more than 1000 events |
368
- | `INVALID_SINCE` | `since must be finite` | `list` or `paginate` got `NaN`, `Infinity` or `-Infinity` as `since` | Pass a millisecond timestamp, or omit `since` |
369
- | `INVALID_BATCH` | `batch must be an integer between 1 and 500` | `purge` or `pruneExpired` got a batch outside 1..500 or not an integer | Pass an integer in 1..500, or omit it (default 256) |
370
- | `INVALID_BEFORE` | `before must be finite` | `purge` got `NaN`, `Infinity` or `-Infinity` as `before` | Pass a millisecond timestamp, or omit `before` to delete everything |
371
- | `INVALID_RETENTION` | `retentionMs must be a non-negative finite number` | `configure` got a negative, `NaN` or infinite window | Pass milliseconds `>= 0`, or call `configure(ctx)` to turn retention off |
368
+ | Code | Message | Cause | Fix |
369
+ | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
370
+ | `INVALID_ARGUMENT` | `subjectRef must be non-empty`, `subjectRef must be at most 512 characters` (or `type`, `actorRef`) | `record` got an empty `subjectRef`, `type` or `actorRef`, or one longer than 512 UTF-16 code units; `purge` got an empty `subjectRef` | Pass non-empty strings of at most 512 characters (hash longer ids); omit `actorRef` instead of passing `""` |
371
+ | `INVALID_IDEMPOTENCY_KEY` | `idempotencyKey must be between 1 and 256 characters` | `record` got an empty key or one longer than 256 UTF-16 code units | Pass 1..256 characters; hash longer ids |
372
+ | `INVALID_LIMIT` | `limit must be an integer between 1 and 1000` (or `paginationOpts.numItems`), `maxCount must be an integer between 0 and 1000` | `list` `limit` or `paginate` `numItems` outside 1..1000; `count` `maxCount` outside 0..1000 | Pass an integer in range; page with `paginate` to read more than 1000 events |
373
+ | `INVALID_SINCE` | `since must be finite` | `list` or `paginate` got `NaN`, `Infinity` or `-Infinity` as `since` | Pass a millisecond timestamp, or omit `since` |
374
+ | `INVALID_BATCH` | `batch must be an integer between 1 and 500` | `purge` or `pruneExpired` got a batch outside 1..500 or not an integer | Pass an integer in 1..500, or omit it (default 256) |
375
+ | `INVALID_BEFORE` | `before must be finite` | `purge` got `NaN`, `Infinity` or `-Infinity` as `before` | Pass a millisecond timestamp, or omit `before` to delete everything |
376
+ | `INVALID_RETENTION` | `retentionMs must be a non-negative finite number` | `configure` got a negative, `NaN` or infinite window | Pass milliseconds `>= 0`, or call `configure(ctx)` to turn retention off |
372
377
 
373
378
  The client's `record` guards throw an `EventValidationError` (`error.code`,
374
379
  `error.message`) before anything is written. A plain error thrown from a Convex
375
380
  function reaches the browser without its message in production, so rethrow it as
376
381
  a `ConvexError` if the client must see the code (see Common tasks).
377
382
 
378
- | Code | Message | Cause | Fix |
379
- | --------------------------- | ---------------------------------------------------------------------- | --------------------------------------------------------- | ----------------------------------------------------------- |
380
- | `EVENTS_TYPE_NOT_ALLOWED` | `event type "<type>" is not in the allowed set` | `type` is not in the client's `allowedTypes` | Add the type to `allowedTypes`, or fix the caller |
381
- | `EVENTS_TYPE_TOO_LONG` | `event type exceeds maxTypeLength (<n>)` | `type.length` is above `maxTypeLength` | Shorten the type or raise `maxTypeLength` |
382
- | `EVENTS_METADATA_INVALID` | the `metadataValidator` error message, or `metadata validation failed` | Your `metadataValidator` threw | Send metadata your validator accepts |
383
- | `EVENTS_METADATA_TOO_LARGE` | `metadata exceeds maxMetadataBytes (<n>)` | UTF-8 size of `JSON.stringify(metadata)` is above the cap | Store less, or store a reference to a host document instead |
383
+ | Code | Message | Cause | Fix |
384
+ | --------------------------- | ---------------------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
385
+ | `EVENTS_TYPE_NOT_ALLOWED` | `event type "<type>" is not in the allowed set` | `type` is not in the client's `allowedTypes` | Add the type to `allowedTypes`, or fix the caller |
386
+ | `EVENTS_TYPE_TOO_LONG` | `event type exceeds maxTypeLength (<n>)` | `type.length` is above `maxTypeLength` | Shorten the type or raise `maxTypeLength`; the component caps `type` at 512 on `record`, so a value above 512 has no effect |
387
+ | `EVENTS_METADATA_INVALID` | the `metadataValidator` error message, or `metadata validation failed` | Your `metadataValidator` threw | Send metadata your validator accepts |
388
+ | `EVENTS_METADATA_TOO_LARGE` | `metadata exceeds maxMetadataBytes (<n>)` | UTF-8 size of `JSON.stringify(metadata)` is above the cap | Store less, or store a reference to a host document instead |
384
389
 
385
390
  Arguments of the wrong type (for example a number `subjectRef`) are rejected by
386
391
  Convex argument validation before the component runs. With `maxMetadataBytes`
@@ -416,6 +421,11 @@ set, metadata that `JSON.stringify` cannot serialize (a `bigint`) throws its own
416
421
  - `metadata` is stored as-is (`v.any()`) and is not validated on read; Convex
417
422
  document size limits still apply.
418
423
  - Reads with an empty `subjectRef` return no events instead of throwing.
424
+ - `record` rejects a `subjectRef`, `type` or `actorRef` longer than 512
425
+ characters (UTF-16 code units, JavaScript `.length`), so an emoji counts as 2.
426
+ Hash longer host ids. Only `record` checks this: `list`, `paginate`, `count`
427
+ and `purge` accept any length, so rows an older version stored with a longer
428
+ value stay readable, countable and purgeable.
419
429
  - Events are never updated. There is no edit method.
420
430
 
421
431
  ## Compatibility
@@ -441,6 +451,10 @@ Mount the component in your own `convex-test` suite with `register`. Use the
441
451
  Vitest settings `convex-test` recommends (edge runtime, `convex-test` inlined).
442
452
  `register` uses Vite's `import.meta.glob`, so it only works under Vitest/Vite:
443
453
 
454
+ ```bash
455
+ pnpm add -D convex-test vitest vite @edge-runtime/vm
456
+ ```
457
+
444
458
  ```ts
445
459
  // vitest.config.mts
446
460
  import { defineConfig } from "vitest/config";
@@ -453,6 +467,16 @@ export default defineConfig({
453
467
  });
454
468
  ```
455
469
 
470
+ The test imports your app's schema. Use your own `convex/schema.ts` if you have
471
+ one; otherwise add an empty one:
472
+
473
+ ```ts
474
+ // convex/schema.ts
475
+ import { defineSchema } from "convex/server";
476
+
477
+ export default defineSchema({});
478
+ ```
479
+
456
480
  ```ts
457
481
  // convex/activity.test.ts
458
482
  /// <reference types="vite/client" />
@@ -48,7 +48,10 @@ export interface EventsOptions<TMeta = unknown> {
48
48
  defaultMaxCount?: number;
49
49
  /** If set, `record` rejects any `type` not in this allow-list. Default: freeform. */
50
50
  allowedTypes?: readonly string[];
51
- /** Max length of an event `type`. `record` rejects longer. Default: unbounded. */
51
+ /**
52
+ * Max length of an event `type`. `record` rejects longer. Default: no client limit. The
53
+ * component caps `type` at 512 on `record`, so a value above 512 has no effect.
54
+ */
52
55
  maxTypeLength?: number;
53
56
  /** Max serialized byte size of `metadata`. `record` rejects larger. Default: unbounded. */
54
57
  maxMetadataBytes?: number;
@@ -1 +1 @@
1
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;IACxE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+EAA+E;IAC/E,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qFAAqF;IACrF,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,2FAA2F;IAC3F,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iFAAiF;IACjF,iBAAiB,CAAC,EAAE,iBAAiB,CAAC,KAAK,CAAC,CAAC;CAC9C"}
@@ -1 +1 @@
1
- {"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../src/component/mutations.ts"],"names":[],"mappings":"AA+BA,eAAO,MAAM,MAAM;;;;;;wDAuCjB,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,KAAK;;;;mBAkChB,CAAC;AAEH,mFAAmF;AACnF,eAAO,MAAM,SAAS;;iBAkBpB,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,YAAY;;mBAwBvB,CAAC"}
1
+ {"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../src/component/mutations.ts"],"names":[],"mappings":"AAgDA,eAAO,MAAM,MAAM;;;;;;wDAyCjB,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,KAAK;;;;mBAkChB,CAAC;AAEH,mFAAmF;AACnF,eAAO,MAAM,SAAS;;iBAkBpB,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,YAAY;;mBAwBvB,CAAC"}
@@ -6,6 +6,8 @@ import { jsonValue } from "./validators.js";
6
6
  const DEFAULT_PURGE_BATCH = 256;
7
7
  const MAX_PURGE_BATCH = 500;
8
8
  const MAX_IDEMPOTENCY_KEY_LENGTH = 256;
9
+ /** Write-path cap on `subjectRef`, `type` and `actorRef`, in UTF-16 code units (`.length`). */
10
+ const MAX_REF_LENGTH = 512;
9
11
  function validateBatch(batch) {
10
12
  if (!Number.isFinite(batch) || !Number.isInteger(batch) || batch < 1 || batch > MAX_PURGE_BATCH) {
11
13
  throw new ConvexError({
@@ -25,6 +27,20 @@ function assertNonEmpty(fields) {
25
27
  }
26
28
  }
27
29
  }
30
+ /**
31
+ * Reject over-long identifiers on `record` only. Reads and `purge` stay uncapped so rows an
32
+ * older version stored with a longer value remain readable, countable and purgeable.
33
+ */
34
+ function assertMaxRefLength(fields) {
35
+ for (const [name, value] of Object.entries(fields)) {
36
+ if (value !== undefined && value.length > MAX_REF_LENGTH) {
37
+ throw new ConvexError({
38
+ code: "INVALID_ARGUMENT",
39
+ message: `${name} must be at most ${MAX_REF_LENGTH} characters`,
40
+ });
41
+ }
42
+ }
43
+ }
28
44
  export const record = mutation({
29
45
  args: {
30
46
  subjectRef: v.string(),
@@ -35,7 +51,9 @@ export const record = mutation({
35
51
  },
36
52
  returns: v.id("events"),
37
53
  handler: async (ctx, args) => {
38
- assertNonEmpty({ subjectRef: args.subjectRef, type: args.type, actorRef: args.actorRef });
54
+ const refs = { subjectRef: args.subjectRef, type: args.type, actorRef: args.actorRef };
55
+ assertNonEmpty(refs);
56
+ assertMaxRefLength(refs);
39
57
  if (args.idempotencyKey !== undefined &&
40
58
  (args.idempotencyKey.length === 0 ||
41
59
  args.idempotencyKey.length > MAX_IDEMPOTENCY_KEY_LENGTH)) {
@@ -1 +1 @@
1
- {"version":3,"file":"mutations.js","sourceRoot":"","sources":["../../src/component/mutations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,oFAAoF;AACpF,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAChC,MAAM,eAAe,GAAG,GAAG,CAAC;AAC5B,MAAM,0BAA0B,GAAG,GAAG,CAAC;AAEvC,SA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E,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF,CAAC,CAAC"}
package/docs/API.md CHANGED
@@ -55,8 +55,11 @@ nothing is written. `metadataValidator` and `maxMetadataBytes` run only when
55
55
  `metadata` is set; the value the validator returns is what is stored and
56
56
  measured.
57
57
 
58
- - `subjectRef`, `type` and a supplied `actorRef` must be non-empty
59
- (`INVALID_ARGUMENT`).
58
+ - `subjectRef`, `type` and a supplied `actorRef` must be non-empty and at most
59
+ 512 characters (UTF-16 code units, JavaScript `.length`; an emoji counts as 2)
60
+ (`INVALID_ARGUMENT`). Only `record` checks the length: reads and `purge`
61
+ accept longer values, so rows stored by an older version stay readable and
62
+ purgeable.
60
63
  - `idempotencyKey` must be 1..256 UTF-16 code units (`INVALID_IDEMPOTENCY_KEY`).
61
64
  While an event with the same `subjectRef` and key exists, `record` returns
62
65
  that event's id and writes nothing, even if `type` or `metadata` differ. Purge
@@ -178,7 +181,7 @@ interface EventsOptions<TMeta = unknown> {
178
181
  defaultLimit?: number; // list limit when omitted; default 50
179
182
  defaultMaxCount?: number; // count bound when omitted; default 1000
180
183
  allowedTypes?: readonly string[]; // record rejects other types; default: any type
181
- maxTypeLength?: number; // record rejects longer types; default: no limit
184
+ maxTypeLength?: number; // record rejects longer types; default: no client limit (the component caps type at 512)
182
185
  maxMetadataBytes?: number; // record rejects larger metadata; default: no limit
183
186
  metadataValidator?: MetadataValidator<TMeta>; // parse, transform or reject metadata
184
187
  }
@@ -188,8 +191,9 @@ interface EventsOptions<TMeta = unknown> {
188
191
  An out-of-range default fails with `INVALID_LIMIT` only the `list` calls that
189
192
  leave out `limit` and the `count` calls that leave out `maxCount`, because only
190
193
  those fall back to it. `maxTypeLength` compares `type.length` (UTF-16 code
191
- units). `maxMetadataBytes` compares the UTF-8 byte length of
192
- `JSON.stringify(metadata)`.
194
+ units). The component already rejects a `type` over 512 on `record`
195
+ (`INVALID_ARGUMENT`), so a `maxTypeLength` above 512 has no effect.
196
+ `maxMetadataBytes` compares the UTF-8 byte length of `JSON.stringify(metadata)`.
193
197
 
194
198
  ### `EventDoc`
195
199
 
@@ -284,15 +288,15 @@ type EventErrorCode =
284
288
 
285
289
  The component throws `ConvexError` with `data: { code, message }`:
286
290
 
287
- | `data.code` | Thrown by | Message |
288
- | ------------------------- | --------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
289
- | `INVALID_ARGUMENT` | `record`, `purge` | `<field> must be non-empty` for `subjectRef`, `type` or `actorRef` |
290
- | `INVALID_IDEMPOTENCY_KEY` | `record` | `idempotencyKey must be between 1 and 256 characters` |
291
- | `INVALID_LIMIT` | `list`, `paginate`, `count` | `limit` / `paginationOpts.numItems must be an integer between 1 and 1000`; `maxCount must be an integer between 0 and 1000` |
292
- | `INVALID_SINCE` | `list`, `paginate` | `since must be finite` |
293
- | `INVALID_BATCH` | `purge`, `pruneExpired` | `batch must be an integer between 1 and 500` |
294
- | `INVALID_BEFORE` | `purge` | `before must be finite` |
295
- | `INVALID_RETENTION` | `configure` | `retentionMs must be a non-negative finite number` |
291
+ | `data.code` | Thrown by | Message |
292
+ | ------------------------- | --------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
293
+ | `INVALID_ARGUMENT` | `record`, `purge` | `<field> must be non-empty` for `subjectRef`, `type` or `actorRef`; `<field> must be at most 512 characters` (`record` only) |
294
+ | `INVALID_IDEMPOTENCY_KEY` | `record` | `idempotencyKey must be between 1 and 256 characters` |
295
+ | `INVALID_LIMIT` | `list`, `paginate`, `count` | `limit` / `paginationOpts.numItems must be an integer between 1 and 1000`; `maxCount must be an integer between 0 and 1000` |
296
+ | `INVALID_SINCE` | `list`, `paginate` | `since must be finite` |
297
+ | `INVALID_BATCH` | `purge`, `pruneExpired` | `batch must be an integer between 1 and 500` |
298
+ | `INVALID_BEFORE` | `purge` | `before must be finite` |
299
+ | `INVALID_RETENTION` | `configure` | `retentionMs must be a non-negative finite number` |
296
300
 
297
301
  ## React
298
302
 
package/llms.txt CHANGED
@@ -14,16 +14,19 @@ events (default 50, max 1000) filtered by `type` and inclusive `since`;
14
14
  `paginate` returns a Convex cursor page; `count` reads at most `maxCount + 1`
15
15
  rows (default and max 1000) and returns `{ count, isExact }`. `record` accepts
16
16
  `actorRef`, typed `metadata` and an `idempotencyKey` (1..256 characters, per
17
- subject) that returns the first event's id on a retry. `purge` deletes a
17
+ subject) that returns the first event's id on a retry; it rejects a
18
+ `subjectRef`, `type` or `actorRef` that is empty or over 512 characters (UTF-16
19
+ code units), while reads and `purge` accept any length. `purge` deletes a
18
20
  subject's events (optionally `createdAt < before`) in self-rescheduling batches
19
21
  (default 256, max 500). Retention is off until `configure(ctx, retentionMs)`;
20
22
  then a daily cron prunes events older than the window. Invalid input throws
21
23
  `ConvexError` with `data.code` `INVALID_ARGUMENT`, `INVALID_IDEMPOTENCY_KEY`,
22
24
  `INVALID_LIMIT`, `INVALID_SINCE`, `INVALID_BATCH`, `INVALID_BEFORE` or
23
25
  `INVALID_RETENTION`. Optional client guards (`allowedTypes`, `maxTypeLength`,
24
- `maxMetadataBytes`, `metadataValidator`) throw `EventValidationError` with
25
- `code` `EVENTS_TYPE_NOT_ALLOWED`, `EVENTS_TYPE_TOO_LONG`,
26
- `EVENTS_METADATA_INVALID` or `EVENTS_METADATA_TOO_LARGE`. React hooks
26
+ `maxMetadataBytes`, `metadataValidator`; a `maxTypeLength` above 512 has no
27
+ effect) throw `EventValidationError` with `code` `EVENTS_TYPE_NOT_ALLOWED`,
28
+ `EVENTS_TYPE_TOO_LONG`, `EVENTS_METADATA_INVALID` or
29
+ `EVENTS_METADATA_TOO_LARGE`. React hooks
27
30
  `useActivityFeed` and `useEventCount` take the host's own public queries. The
28
31
  host owns auth and the meaning of subjects, actors, types and metadata.
29
32
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vllnt/convex-events",
3
- "version": "0.2.0-canary.a6c63aa",
3
+ "version": "0.2.0-canary.f67f4ae",
4
4
  "description": "Convex component for an append-only activity feed and event log: record, list, paginate, count and purge events per subject, with optional retention.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -53,7 +53,10 @@ export interface EventsOptions<TMeta = unknown> {
53
53
  defaultMaxCount?: number;
54
54
  /** If set, `record` rejects any `type` not in this allow-list. Default: freeform. */
55
55
  allowedTypes?: readonly string[];
56
- /** Max length of an event `type`. `record` rejects longer. Default: unbounded. */
56
+ /**
57
+ * Max length of an event `type`. `record` rejects longer. Default: no client limit. The
58
+ * component caps `type` at 512 on `record`, so a value above 512 has no effect.
59
+ */
57
60
  maxTypeLength?: number;
58
61
  /** Max serialized byte size of `metadata`. `record` rejects larger. Default: unbounded. */
59
62
  maxMetadataBytes?: number;
@@ -7,6 +7,8 @@ import { jsonValue } from "./validators.js";
7
7
  const DEFAULT_PURGE_BATCH = 256;
8
8
  const MAX_PURGE_BATCH = 500;
9
9
  const MAX_IDEMPOTENCY_KEY_LENGTH = 256;
10
+ /** Write-path cap on `subjectRef`, `type` and `actorRef`, in UTF-16 code units (`.length`). */
11
+ const MAX_REF_LENGTH = 512;
10
12
 
11
13
  function validateBatch(batch: number): void {
12
14
  if (!Number.isFinite(batch) || !Number.isInteger(batch) || batch < 1 || batch > MAX_PURGE_BATCH) {
@@ -29,6 +31,21 @@ function assertNonEmpty(fields: Record<string, string | undefined>): void {
29
31
  }
30
32
  }
31
33
 
34
+ /**
35
+ * Reject over-long identifiers on `record` only. Reads and `purge` stay uncapped so rows an
36
+ * older version stored with a longer value remain readable, countable and purgeable.
37
+ */
38
+ function assertMaxRefLength(fields: Record<string, string | undefined>): void {
39
+ for (const [name, value] of Object.entries(fields)) {
40
+ if (value !== undefined && value.length > MAX_REF_LENGTH) {
41
+ throw new ConvexError({
42
+ code: "INVALID_ARGUMENT",
43
+ message: `${name} must be at most ${MAX_REF_LENGTH} characters`,
44
+ });
45
+ }
46
+ }
47
+ }
48
+
32
49
  export const record = mutation({
33
50
  args: {
34
51
  subjectRef: v.string(),
@@ -39,7 +56,9 @@ export const record = mutation({
39
56
  },
40
57
  returns: v.id("events"),
41
58
  handler: async (ctx, args) => {
42
- assertNonEmpty({ subjectRef: args.subjectRef, type: args.type, actorRef: args.actorRef });
59
+ const refs = { subjectRef: args.subjectRef, type: args.type, actorRef: args.actorRef };
60
+ assertNonEmpty(refs);
61
+ assertMaxRefLength(refs);
43
62
  if (
44
63
  args.idempotencyKey !== undefined &&
45
64
  (args.idempotencyKey.length === 0 ||