@vllnt/convex-events 0.1.0-canary.2310a69

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 (75) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +140 -0
  3. package/dist/client/index.d.ts +134 -0
  4. package/dist/client/index.d.ts.map +1 -0
  5. package/dist/client/index.js +144 -0
  6. package/dist/client/index.js.map +1 -0
  7. package/dist/client/types.d.ts +58 -0
  8. package/dist/client/types.d.ts.map +1 -0
  9. package/dist/client/types.js +3 -0
  10. package/dist/client/types.js.map +1 -0
  11. package/dist/component/_generated/api.d.ts +40 -0
  12. package/dist/component/_generated/api.d.ts.map +1 -0
  13. package/dist/component/_generated/api.js +31 -0
  14. package/dist/component/_generated/api.js.map +1 -0
  15. package/dist/component/_generated/component.d.ts +93 -0
  16. package/dist/component/_generated/component.d.ts.map +1 -0
  17. package/dist/component/_generated/component.js +11 -0
  18. package/dist/component/_generated/component.js.map +1 -0
  19. package/dist/component/_generated/dataModel.d.ts +46 -0
  20. package/dist/component/_generated/dataModel.d.ts.map +1 -0
  21. package/dist/component/_generated/dataModel.js +11 -0
  22. package/dist/component/_generated/dataModel.js.map +1 -0
  23. package/dist/component/_generated/server.d.ts +121 -0
  24. package/dist/component/_generated/server.d.ts.map +1 -0
  25. package/dist/component/_generated/server.js +78 -0
  26. package/dist/component/_generated/server.js.map +1 -0
  27. package/dist/component/convex.config.d.ts +8 -0
  28. package/dist/component/convex.config.d.ts.map +1 -0
  29. package/dist/component/convex.config.js +9 -0
  30. package/dist/component/convex.config.js.map +1 -0
  31. package/dist/component/crons.d.ts +8 -0
  32. package/dist/component/crons.d.ts.map +1 -0
  33. package/dist/component/crons.js +11 -0
  34. package/dist/component/crons.js.map +1 -0
  35. package/dist/component/mutations.d.ts +30 -0
  36. package/dist/component/mutations.d.ts.map +1 -0
  37. package/dist/component/mutations.js +105 -0
  38. package/dist/component/mutations.js.map +1 -0
  39. package/dist/component/queries.d.ts +54 -0
  40. package/dist/component/queries.d.ts.map +1 -0
  41. package/dist/component/queries.js +103 -0
  42. package/dist/component/queries.js.map +1 -0
  43. package/dist/component/schema.d.ts +35 -0
  44. package/dist/component/schema.d.ts.map +1 -0
  45. package/dist/component/schema.js +28 -0
  46. package/dist/component/schema.js.map +1 -0
  47. package/dist/component/validators.d.ts +82 -0
  48. package/dist/component/validators.d.ts.map +1 -0
  49. package/dist/component/validators.js +29 -0
  50. package/dist/component/validators.js.map +1 -0
  51. package/dist/react/index.d.ts +63 -0
  52. package/dist/react/index.d.ts.map +1 -0
  53. package/dist/react/index.js +40 -0
  54. package/dist/react/index.js.map +1 -0
  55. package/dist/shared.d.ts +23 -0
  56. package/dist/shared.d.ts.map +1 -0
  57. package/dist/shared.js +23 -0
  58. package/dist/shared.js.map +1 -0
  59. package/package.json +112 -0
  60. package/src/client/index.ts +297 -0
  61. package/src/client/types.ts +62 -0
  62. package/src/component/_generated/api.ts +56 -0
  63. package/src/component/_generated/component.ts +113 -0
  64. package/src/component/_generated/dataModel.ts +60 -0
  65. package/src/component/_generated/server.ts +156 -0
  66. package/src/component/convex.config.ts +10 -0
  67. package/src/component/crons.ts +18 -0
  68. package/src/component/mutations.ts +108 -0
  69. package/src/component/queries.ts +109 -0
  70. package/src/component/schema.ts +28 -0
  71. package/src/component/validators.ts +32 -0
  72. package/src/react/index.test.tsx +133 -0
  73. package/src/react/index.tsx +83 -0
  74. package/src/shared.ts +35 -0
  75. package/src/test.ts +12 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 bntvllnt
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,140 @@
1
+ <!-- Badges -->
2
+ [![Convex Component](https://img.shields.io/badge/convex-component-EE342F.svg)](https://www.convex.dev/components)
3
+ [![npm](https://img.shields.io/npm/v/@vllnt/convex-events.svg)](https://www.npmjs.com/package/@vllnt/convex-events)
4
+ [![CI](https://github.com/vllnt/convex-events/actions/workflows/ci.yml/badge.svg)](https://github.com/vllnt/convex-events/actions/workflows/ci.yml)
5
+ [![license](https://img.shields.io/npm/l/@vllnt/convex-events.svg)](./LICENSE)
6
+
7
+ # @vllnt/convex-events
8
+
9
+ Append-only per-subject activity feed and event ledger, as a Convex component — record events against an opaque `subjectRef`, read them back newest-first as a feed or history.
10
+
11
+ ```ts
12
+ const events = new Events(components.events);
13
+ await events.record(ctx, subjectRef, "created", { actorRef });
14
+ const feed = await events.list(ctx, subjectRef, { limit: 20 });
15
+ ```
16
+
17
+ ## Features
18
+
19
+ - **Append-only ledger** — `record` stamps `createdAt` and inserts; events are never mutated.
20
+ - **Per-subject feeds** — list / count keyed by an opaque `subjectRef`, newest-first.
21
+ - **Cursor pagination** — `paginate` returns Convex's `{ page, isDone, continueCursor }`.
22
+ - **Type filter & since filter** — narrow a feed (or count) to one `type`, or page forward from a timestamp.
23
+ - **Bounded count** — scans at most `maxCount + 1` rows and reports `{ count, isExact }`.
24
+ - **Batched purge + retention cron** — drains large feeds in self-rescheduling batches; an idempotent daily cron prunes past `retentionMs`.
25
+ - **Typed metadata + host validator** — generic over the host's metadata type, with optional client-boundary value guards.
26
+ - **Opaque refs** — `subjectRef` / `actorRef` are arbitrary host strings the component never inspects.
27
+
28
+ ## Installation
29
+
30
+ ```bash
31
+ pnpm add @vllnt/convex-events
32
+ ```
33
+
34
+ Peer dependency: `convex@^1.41.0`.
35
+
36
+ ## Usage
37
+
38
+ ```ts
39
+ // convex/convex.config.ts
40
+ import { defineApp } from "convex/server";
41
+ import events from "@vllnt/convex-events/convex.config";
42
+
43
+ const app = defineApp();
44
+ app.use(events);
45
+ export default app;
46
+ ```
47
+
48
+ ```ts
49
+ // convex/activity.ts — host owns auth; pass opaque refs in.
50
+ import { components } from "./_generated/api";
51
+ import { mutation, query } from "./_generated/server";
52
+ import { v } from "convex/values";
53
+ import { paginationOptsValidator } from "convex/server";
54
+ import { Events } from "@vllnt/convex-events";
55
+
56
+ interface Meta { note?: string }
57
+
58
+ const events = new Events<Meta>(components.events, {
59
+ allowedTypes: ["created", "updated", "deleted"], // optional value guard
60
+ });
61
+
62
+ export const log = mutation({
63
+ args: { userId: v.string(), type: v.string() },
64
+ handler: (ctx, { userId, type }) => events.record(ctx, userId, type, { actorRef: userId }),
65
+ });
66
+
67
+ export const feed = query({
68
+ args: { userId: v.string() },
69
+ handler: (ctx, { userId }) => events.list(ctx, userId, { limit: 20 }),
70
+ });
71
+
72
+ export const feedPage = query({
73
+ args: { userId: v.string(), paginationOpts: paginationOptsValidator },
74
+ handler: (ctx, { userId, paginationOpts }) => events.paginate(ctx, userId, paginationOpts),
75
+ });
76
+ ```
77
+
78
+ ## API Reference
79
+
80
+ | Method | Kind | Result |
81
+ |--------|------|--------|
82
+ | `record(ctx, subjectRef, type, opts?)` | mutation | new event id (`string`) |
83
+ | `list(ctx, subjectRef, opts?)` | query | `EventDoc<TMeta>[]` (newest-first) |
84
+ | `paginate(ctx, subjectRef, paginationOpts, opts?)` | query | `EventPage<TMeta>` |
85
+ | `count(ctx, subjectRef, opts?)` | query | `{ count, isExact }` |
86
+ | `purge(ctx, subjectRef, opts?)` | mutation | `number` (deleted in the first batch) |
87
+ | `configure(ctx, retentionMs?)` | mutation | `null` (sets/clears the retention window) |
88
+ | `pruneExpired(ctx, opts?)` | mutation | `number` (manual retention sweep) |
89
+
90
+ Full reference: [docs/API.md](docs/API.md) — including client options (`defaultLimit`, `allowedTypes`, `metadataValidator`, …) and `EVENT_ERROR_CODES`.
91
+
92
+ ## React
93
+
94
+ Optional, tree-shakeable hooks at `@vllnt/convex-events/react`; `react` and `convex` are optional peer deps. Pass the host's own re-exported query refs — the component never imports your `api`.
95
+
96
+ ```tsx
97
+ import { useActivityFeed, useEventCount } from "@vllnt/convex-events/react";
98
+ import { api } from "../convex/_generated/api";
99
+
100
+ const { results, status, loadMore } = useActivityFeed(api.events.paginate, { subjectRef }, { initialNumItems: 20 });
101
+ const count = useEventCount(api.events.count, { subjectRef });
102
+ ```
103
+
104
+ | Hook | Wraps | Returns |
105
+ |------|-------|---------|
106
+ | `useActivityFeed(paginateRef, { subjectRef, type? }, { initialNumItems })` | `usePaginatedQuery` | `{ results, status, loadMore }` |
107
+ | `useEventCount(countRef, { subjectRef, type? })` | `useQuery` | `{ count, isExact } \| undefined` |
108
+
109
+ ## Security
110
+
111
+ - Auth-agnostic — the host resolves identity, decides who may record or read a feed, and passes opaque refs.
112
+ - Tables are sandboxed; `subjectRef`, `actorRef`, and `metadata` are opaque and never inspected.
113
+ - Optional client-boundary guards (`allowedTypes`, `maxTypeLength`, `maxMetadataBytes`, `metadataValidator`) reject malformed input with a code-tagged `EventValidationError`.
114
+
115
+ See [docs/API.md](docs/API.md).
116
+
117
+ ## Testing
118
+
119
+ ```bash
120
+ pnpm test # single run
121
+ pnpm test:coverage # enforced 100% on covered files
122
+ ```
123
+
124
+ Tests run against the real component runtime via `convex-test` (`@edge-runtime/vm`), not mocks.
125
+
126
+ ## Contributing
127
+
128
+ See [CONTRIBUTING.md](CONTRIBUTING.md).
129
+
130
+ ## Author
131
+
132
+ Built by [bntvllnt](https://github.com/bntvllnt) · [bntvllnt.com](https://bntvllnt.com) · [X @bntvllnt](https://x.com/bntvllnt)
133
+
134
+ Part of the [@vllnt](https://github.com/vllnt) Convex component fleet — [vllnt.com](https://vllnt.com)
135
+
136
+ If this is useful, [sponsor the work](https://github.com/sponsors/bntvllnt).
137
+
138
+ ## License
139
+
140
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,134 @@
1
+ import type { FunctionArgs, FunctionReference, FunctionReturnType, PaginationOptions } from "convex/server";
2
+ import type { CountResult, EventDoc, EventPage, EventsOptions, MetadataValidator } from "./types.js";
3
+ /**
4
+ * The events component's function references, as exposed on the host via
5
+ * `components.events`. Generic over the host's metadata type `TMeta`.
6
+ */
7
+ export interface EventsComponent<TMeta = unknown> {
8
+ mutations: {
9
+ record: FunctionReference<"mutation", "internal", {
10
+ subjectRef: string;
11
+ type: string;
12
+ actorRef?: string;
13
+ metadata?: TMeta;
14
+ }, string>;
15
+ purge: FunctionReference<"mutation", "internal", {
16
+ subjectRef: string;
17
+ before?: number;
18
+ batch?: number;
19
+ }, number>;
20
+ configure: FunctionReference<"mutation", "internal", {
21
+ retentionMs?: number;
22
+ }, null>;
23
+ pruneExpired: FunctionReference<"mutation", "internal", {
24
+ batch?: number;
25
+ }, number>;
26
+ };
27
+ queries: {
28
+ list: FunctionReference<"query", "internal", {
29
+ subjectRef: string;
30
+ type?: string;
31
+ since?: number;
32
+ limit: number;
33
+ }, EventDoc<TMeta>[]>;
34
+ listPaginated: FunctionReference<"query", "internal", {
35
+ subjectRef: string;
36
+ type?: string;
37
+ since?: number;
38
+ paginationOpts: PaginationOptions;
39
+ }, EventPage<TMeta>>;
40
+ count: FunctionReference<"query", "internal", {
41
+ subjectRef: string;
42
+ type?: string;
43
+ maxCount?: number;
44
+ }, CountResult>;
45
+ };
46
+ }
47
+ interface RunQueryCtx {
48
+ runQuery<Q extends FunctionReference<"query", "internal">>(reference: Q, args: FunctionArgs<Q>): Promise<FunctionReturnType<Q>>;
49
+ }
50
+ interface RunMutationCtx {
51
+ runMutation<M extends FunctionReference<"mutation", "internal">>(reference: M, args: FunctionArgs<M>): Promise<FunctionReturnType<M>>;
52
+ }
53
+ /**
54
+ * Consumer-facing client for the append-only per-subject activity feed. The
55
+ * host owns meaning and auth; it passes opaque `subjectRef` / `actorRef` refs
56
+ * and a host-typed `metadata` payload (typed here as `TMeta`).
57
+ */
58
+ export declare class Events<TMeta = unknown> {
59
+ private readonly component;
60
+ private readonly defaultLimit;
61
+ private readonly defaultMaxCount;
62
+ private readonly allowedTypes?;
63
+ private readonly maxTypeLength?;
64
+ private readonly maxMetadataBytes?;
65
+ private readonly metadataValidator?;
66
+ constructor(component: EventsComponent<TMeta>, options?: EventsOptions<TMeta>);
67
+ /**
68
+ * Apply the configured client-boundary guards to one `record` call.
69
+ * Returns the (possibly transformed) metadata to store; throws an
70
+ * {@link EventValidationError} on rejection.
71
+ */
72
+ private guard;
73
+ /**
74
+ * Append an event of `type` for `subjectRef`. Returns the new event id.
75
+ * Applies the configured boundary guards (`allowedTypes`, `maxTypeLength`,
76
+ * `maxMetadataBytes`, `metadataValidator`) before writing — throws an
77
+ * {@link EventValidationError} on rejection.
78
+ */
79
+ record(ctx: RunMutationCtx, subjectRef: string, type: string, opts?: {
80
+ actorRef?: string;
81
+ metadata?: TMeta;
82
+ }): Promise<string>;
83
+ /** List events for `subjectRef`, newest-first. Filter by `type` / `since`; `limit` defaults to the client's `defaultLimit`. */
84
+ list(ctx: RunQueryCtx, subjectRef: string, opts?: {
85
+ type?: string;
86
+ since?: number;
87
+ limit?: number;
88
+ }): Promise<EventDoc<TMeta>[]>;
89
+ /**
90
+ * Cursor-paginated feed for `subjectRef`, newest-first, honoring the same
91
+ * `type` / `since` filters as {@link Events.list}. Returns Convex's
92
+ * `{ page, isDone, continueCursor }` so a host can page past any `limit`.
93
+ */
94
+ paginate(ctx: RunQueryCtx, subjectRef: string, paginationOpts: PaginationOptions, opts?: {
95
+ type?: string;
96
+ since?: number;
97
+ }): Promise<EventPage<TMeta>>;
98
+ /**
99
+ * Bounded count for `subjectRef` (optionally one `type`). Scans at most
100
+ * `maxCount + 1` rows (default the client's `defaultMaxCount`); `isExact` is
101
+ * `false` when the feed is larger than the bound.
102
+ */
103
+ count(ctx: RunQueryCtx, subjectRef: string, opts?: {
104
+ type?: string;
105
+ maxCount?: number;
106
+ }): Promise<CountResult>;
107
+ /**
108
+ * Delete events for `subjectRef` (all, or only those before `before`). Batched
109
+ * and self-rescheduling for large feeds; returns the count deleted in the
110
+ * first batch (the remainder is pruned by scheduled follow-ups).
111
+ */
112
+ purge(ctx: RunMutationCtx, subjectRef: string, opts?: {
113
+ before?: number;
114
+ batch?: number;
115
+ }): Promise<number>;
116
+ /**
117
+ * Set (or clear, with `undefined`) the retention window the component's daily
118
+ * cron prunes against. Without this, the retention sweep is a no-op.
119
+ */
120
+ configure(ctx: RunMutationCtx, retentionMs?: number): Promise<null>;
121
+ /**
122
+ * Manually run the retention sweep (the same work the daily cron performs):
123
+ * prune one batch of events older than the configured window, rescheduling
124
+ * follow-up batches. A no-op until {@link Events.configure} sets a window.
125
+ * Returns the count deleted in the first batch.
126
+ */
127
+ pruneExpired(ctx: RunMutationCtx, opts?: {
128
+ batch?: number;
129
+ }): Promise<number>;
130
+ }
131
+ export type { CountResult, EventDoc, EventPage, EventsOptions, MetadataValidator, };
132
+ export { EventValidationError, EVENT_ERROR_CODES } from "../shared.js";
133
+ export type { EventErrorCode } from "../shared.js";
134
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,eAAe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MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAInE;;;;;OAKG;IACH,YAAY,CACV,GAAG,EAAE,cAAc,EACnB,IAAI,GAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAO,GAC5B,OAAO,CAAC,MAAM,CAAC;CAKnB;AAED,YAAY,EACV,WAAW,EACX,QAAQ,EACR,SAAS,EACT,aAAa,EACb,iBAAiB,GAClB,CAAC;AACF,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACvE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,144 @@
1
+ import { DEFAULT_LIMIT, DEFAULT_MAX_COUNT, EVENT_ERROR_CODES, EventValidationError, } from "../shared.js";
2
+ /**
3
+ * Serialized byte size of a defined value (UTF-8), for the `maxMetadataBytes`
4
+ * guard. Only ever called with non-`undefined` metadata.
5
+ */
6
+ function byteSize(value) {
7
+ return new TextEncoder().encode(JSON.stringify(value)).length;
8
+ }
9
+ /**
10
+ * Consumer-facing client for the append-only per-subject activity feed. The
11
+ * host owns meaning and auth; it passes opaque `subjectRef` / `actorRef` refs
12
+ * and a host-typed `metadata` payload (typed here as `TMeta`).
13
+ */
14
+ export class Events {
15
+ component;
16
+ defaultLimit;
17
+ defaultMaxCount;
18
+ allowedTypes;
19
+ maxTypeLength;
20
+ maxMetadataBytes;
21
+ metadataValidator;
22
+ constructor(component, options = {}) {
23
+ this.component = component;
24
+ this.defaultLimit = options.defaultLimit ?? DEFAULT_LIMIT;
25
+ this.defaultMaxCount = options.defaultMaxCount ?? DEFAULT_MAX_COUNT;
26
+ this.allowedTypes = options.allowedTypes
27
+ ? new Set(options.allowedTypes)
28
+ : undefined;
29
+ this.maxTypeLength = options.maxTypeLength;
30
+ this.maxMetadataBytes = options.maxMetadataBytes;
31
+ this.metadataValidator = options.metadataValidator;
32
+ }
33
+ /**
34
+ * Apply the configured client-boundary guards to one `record` call.
35
+ * Returns the (possibly transformed) metadata to store; throws an
36
+ * {@link EventValidationError} on rejection.
37
+ */
38
+ guard(type, metadata) {
39
+ if (this.allowedTypes && !this.allowedTypes.has(type)) {
40
+ throw new EventValidationError(EVENT_ERROR_CODES.TYPE_NOT_ALLOWED, `event type "${type}" is not in the allowed set`);
41
+ }
42
+ if (this.maxTypeLength !== undefined && type.length > this.maxTypeLength) {
43
+ throw new EventValidationError(EVENT_ERROR_CODES.TYPE_TOO_LONG, `event type exceeds maxTypeLength (${this.maxTypeLength})`);
44
+ }
45
+ let next = metadata;
46
+ if (next !== undefined && this.metadataValidator) {
47
+ try {
48
+ next = this.metadataValidator(next);
49
+ }
50
+ catch (err) {
51
+ throw new EventValidationError(EVENT_ERROR_CODES.METADATA_INVALID, err instanceof Error
52
+ ? err.message
53
+ : "metadata validation failed");
54
+ }
55
+ }
56
+ if (this.maxMetadataBytes !== undefined &&
57
+ next !== undefined &&
58
+ byteSize(next) > this.maxMetadataBytes) {
59
+ throw new EventValidationError(EVENT_ERROR_CODES.METADATA_TOO_LARGE, `metadata exceeds maxMetadataBytes (${this.maxMetadataBytes})`);
60
+ }
61
+ return next;
62
+ }
63
+ /**
64
+ * Append an event of `type` for `subjectRef`. Returns the new event id.
65
+ * Applies the configured boundary guards (`allowedTypes`, `maxTypeLength`,
66
+ * `maxMetadataBytes`, `metadataValidator`) before writing — throws an
67
+ * {@link EventValidationError} on rejection.
68
+ */
69
+ record(ctx, subjectRef, type, opts = {}) {
70
+ const metadata = this.guard(type, opts.metadata);
71
+ return ctx.runMutation(this.component.mutations.record, {
72
+ subjectRef,
73
+ type,
74
+ actorRef: opts.actorRef,
75
+ metadata,
76
+ });
77
+ }
78
+ /** List events for `subjectRef`, newest-first. Filter by `type` / `since`; `limit` defaults to the client's `defaultLimit`. */
79
+ list(ctx, subjectRef, opts = {}) {
80
+ return ctx.runQuery(this.component.queries.list, {
81
+ subjectRef,
82
+ type: opts.type,
83
+ since: opts.since,
84
+ limit: opts.limit ?? this.defaultLimit,
85
+ });
86
+ }
87
+ /**
88
+ * Cursor-paginated feed for `subjectRef`, newest-first, honoring the same
89
+ * `type` / `since` filters as {@link Events.list}. Returns Convex's
90
+ * `{ page, isDone, continueCursor }` so a host can page past any `limit`.
91
+ */
92
+ paginate(ctx, subjectRef, paginationOpts, opts = {}) {
93
+ return ctx.runQuery(this.component.queries.listPaginated, {
94
+ subjectRef,
95
+ type: opts.type,
96
+ since: opts.since,
97
+ paginationOpts,
98
+ });
99
+ }
100
+ /**
101
+ * Bounded count for `subjectRef` (optionally one `type`). Scans at most
102
+ * `maxCount + 1` rows (default the client's `defaultMaxCount`); `isExact` is
103
+ * `false` when the feed is larger than the bound.
104
+ */
105
+ count(ctx, subjectRef, opts = {}) {
106
+ return ctx.runQuery(this.component.queries.count, {
107
+ subjectRef,
108
+ type: opts.type,
109
+ maxCount: opts.maxCount ?? this.defaultMaxCount,
110
+ });
111
+ }
112
+ /**
113
+ * Delete events for `subjectRef` (all, or only those before `before`). Batched
114
+ * and self-rescheduling for large feeds; returns the count deleted in the
115
+ * first batch (the remainder is pruned by scheduled follow-ups).
116
+ */
117
+ purge(ctx, subjectRef, opts = {}) {
118
+ return ctx.runMutation(this.component.mutations.purge, {
119
+ subjectRef,
120
+ before: opts.before,
121
+ batch: opts.batch,
122
+ });
123
+ }
124
+ /**
125
+ * Set (or clear, with `undefined`) the retention window the component's daily
126
+ * cron prunes against. Without this, the retention sweep is a no-op.
127
+ */
128
+ configure(ctx, retentionMs) {
129
+ return ctx.runMutation(this.component.mutations.configure, { retentionMs });
130
+ }
131
+ /**
132
+ * Manually run the retention sweep (the same work the daily cron performs):
133
+ * prune one batch of events older than the configured window, rescheduling
134
+ * follow-up batches. A no-op until {@link Events.configure} sets a window.
135
+ * Returns the count deleted in the first batch.
136
+ */
137
+ pruneExpired(ctx, opts = {}) {
138
+ return ctx.runMutation(this.component.mutations.pruneExpired, {
139
+ batch: opts.batch,
140
+ });
141
+ }
142
+ }
143
+ export { EventValidationError, EVENT_ERROR_CODES } from "../shared.js";
144
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,cAAc,CAAC;AA+EtB;;;GAGG;AACH,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;AAChE,CAAC;AAED;;;;GAIG;AACH,MAAM,OAAO,MAAM;IASE;IARF,YAAY,CAAS;IACrB,eAAe,CAAS;IACxB,YAAY,CAAuB;IACnC,aAAa,CAAU;IACvB,gBAAgB,CAAU;IAC1B,iBAAiB,CAA4B;IAE9D,YACmB,SAAiC,EAClD,UAAgC,EAAE;QADjB,cAAS,GAAT,SAAS,CAAwB;QAGlD,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,IAAI,aAAa,CAAC;QAC1D,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,IAAI,iBAAiB,CAAC;QACpE,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY;YACtC,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC;YAC/B,CAAC,CAAC,SAAS,CAAC;QACd,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;QAC3C,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;QACjD,IAAI,CAAC,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IACrD,CAAC;IAED;;;;OAIG;IACK,KAAK,CAAC,IAAY,EAAE,QAAgB;QAC1C,IAAI,IAAI,CAAC,YAAY,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACt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AU;YACV,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,SAAS,CAAC,GAAmB,EAAE,WAAoB;QACjD,OAAO,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,SAAS,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC;IAC9E,CAAC;IAED;;;;;OAKG;IACH,YAAY,CACV,GAAmB,EACnB,OAA2B,EAAE;QAE7B,OAAO,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,YAAY,EAAE;YAC5D,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB,CAAC,CAAC;IACL,CAAC;CACF;AASD,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,58 @@
1
+ /** Public TypeScript surface for the events client. */
2
+ /**
3
+ * A stored event, as returned by {@link Events.list} / {@link Events.paginate}.
4
+ * `TMeta` is the host's metadata type. `metadata` is optional: a record made
5
+ * without it round-trips as `undefined`, so the shape never lies to a host whose
6
+ * `TMeta` is non-nullable.
7
+ */
8
+ export interface EventDoc<TMeta = unknown> {
9
+ _id: string;
10
+ _creationTime: number;
11
+ /** Opaque host-owned subject this event belongs to. */
12
+ subjectRef: string;
13
+ /** Host-defined event type / verb (e.g. `"created"`, `"login"`). */
14
+ type: string;
15
+ /** Opaque host-owned actor that caused the event, if any. */
16
+ actorRef?: string;
17
+ /** Host-owned payload. Opaque to the component; typed as `TMeta` for the host. Omitted when the event was recorded without metadata. */
18
+ metadata?: TMeta;
19
+ /** Host-stamped creation time (ms since epoch); the ledger's sort key. */
20
+ createdAt: number;
21
+ }
22
+ /** One page of events, as returned by {@link Events.paginate}. */
23
+ export interface EventPage<TMeta = unknown> {
24
+ page: EventDoc<TMeta>[];
25
+ isDone: boolean;
26
+ continueCursor: string;
27
+ splitCursor?: string | null;
28
+ pageStatus?: "SplitRecommended" | "SplitRequired" | null;
29
+ }
30
+ /** A capped count, as returned by {@link Events.count}. */
31
+ export interface CountResult {
32
+ /** Number of matching events, capped at the scan bound. */
33
+ count: number;
34
+ /** `false` when more events exist than the scan bound (so `count` is the bound). */
35
+ isExact: boolean;
36
+ }
37
+ /**
38
+ * Validate (or parse) a host metadata payload at the `record` boundary. Return
39
+ * the value to store (optionally transformed); throw to reject. Lets a host with
40
+ * a non-`unknown` `TMeta` enforce its own shape without the component knowing it.
41
+ */
42
+ export type MetadataValidator<TMeta> = (metadata: TMeta) => TMeta;
43
+ /** Construction options for the {@link Events} client. */
44
+ export interface EventsOptions<TMeta = unknown> {
45
+ /** Page size applied when a `list` call omits `limit`. Default `50`. */
46
+ defaultLimit?: number;
47
+ /** Scan bound applied when a `count` call omits `maxCount`. Default `1000`. */
48
+ defaultMaxCount?: number;
49
+ /** If set, `record` rejects any `type` not in this allow-list. Default: freeform. */
50
+ allowedTypes?: readonly string[];
51
+ /** Max length of an event `type`. `record` rejects longer. Default: unbounded. */
52
+ maxTypeLength?: number;
53
+ /** Max serialized byte size of `metadata`. `record` rejects larger. Default: unbounded. */
54
+ maxMetadataBytes?: number;
55
+ /** Host-supplied validator/parser run on `metadata` at the `record` boundary. */
56
+ metadataValidator?: MetadataValidator<TMeta>;
57
+ }
58
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAEvD;;;;;GAKG;AACH,MAAM,WAAW,QAAQ,CAAC,KAAK,GAAG,OAAO;IACvC,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa,EAAE,MAAM,CAAC;IACtB,uDAAuD;IACvD,UAAU,EAAE,MAAM,CAAC;IACnB,oEAAoE;IACpE,IAAI,EAAE,MAAM,CAAC;IACb,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wIAAwI;IACxI,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,0EAA0E;IAC1E,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,kEAAkE;AAClE,MAAM,WAAW,SAAS,CAAC,KAAK,GAAG,OAAO;IACxC,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;IACxB,MAAM,EAAE,OAAO,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,UAAU,CAAC,EAAE,kBAAkB,GAAG,eAAe,GAAG,IAAI,CAAC;CAC1D;AAED,2DAA2D;AAC3D,MAAM,WAAW,WAAW;IAC1B,2DAA2D;IAC3D,KAAK,EAAE,MAAM,CAAC;IACd,oFAAoF;IACpF,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,CAAC,KAAK,IAAI,CAAC,QAAQ,EAAE,KAAK,KAAK,KAAK,CAAC;AAElE,0DAA0D;AAC1D,MAAM,WAAW,aAAa,CAAC,KAAK,GAAG,OAAO;IAC5C,wEAAwE;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,kFAAkF;IAClF,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"}
@@ -0,0 +1,3 @@
1
+ /** Public TypeScript surface for the events client. */
2
+ export {};
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":"AAAA,uDAAuD"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Generated `api` utility.
3
+ *
4
+ * THIS CODE IS AUTOMATICALLY GENERATED.
5
+ *
6
+ * To regenerate, run `npx convex dev`.
7
+ * @module
8
+ */
9
+ import type * as crons from "../crons.js";
10
+ import type * as mutations from "../mutations.js";
11
+ import type * as queries from "../queries.js";
12
+ import type * as validators from "../validators.js";
13
+ import type { ApiFromModules, FilterApi, FunctionReference } from "convex/server";
14
+ declare const fullApi: ApiFromModules<{
15
+ crons: typeof crons;
16
+ mutations: typeof mutations;
17
+ queries: typeof queries;
18
+ validators: typeof validators;
19
+ }>;
20
+ /**
21
+ * A utility for referencing Convex functions in your app's public API.
22
+ *
23
+ * Usage:
24
+ * ```js
25
+ * const myFunctionReference = api.myModule.myFunction;
26
+ * ```
27
+ */
28
+ export declare const api: FilterApi<typeof fullApi, FunctionReference<any, "public">>;
29
+ /**
30
+ * A utility for referencing Convex functions in your app's internal API.
31
+ *
32
+ * Usage:
33
+ * ```js
34
+ * const myFunctionReference = internal.myModule.myFunction;
35
+ * ```
36
+ */
37
+ export declare const internal: FilterApi<typeof fullApi, FunctionReference<any, "internal">>;
38
+ export declare const components: {};
39
+ export {};
40
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/api.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,KAAK,KAAK,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,KAAK,SAAS,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,KAAK,OAAO,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAEpD,OAAO,KAAK,EACV,cAAc,EACd,SAAS,EACT,iBAAiB,EAClB,MAAM,eAAe,CAAC;AAGvB,QAAA,MAAM,OAAO,EAAE,cAAc,CAAC;IAC5B,KAAK,EAAE,OAAO,KAAK,CAAC;IACpB,SAAS,EAAE,OAAO,SAAS,CAAC;IAC5B,OAAO,EAAE,OAAO,OAAO,CAAC;IACxB,UAAU,EAAE,OAAO,UAAU,CAAC;CAC/B,CAAiB,CAAC;AAEnB;;;;;;;GAOG;AACH,eAAO,MAAM,GAAG,EAAE,SAAS,CACzB,OAAO,OAAO,EACd,iBAAiB,CAAC,GAAG,EAAE,QAAQ,CAAC,CACjB,CAAC;AAElB;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,EAAE,SAAS,CAC9B,OAAO,OAAO,EACd,iBAAiB,CAAC,GAAG,EAAE,UAAU,CAAC,CACnB,CAAC;AAElB,eAAO,MAAM,UAAU,EAAqC,EAAE,CAAC"}
@@ -0,0 +1,31 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * Generated `api` utility.
4
+ *
5
+ * THIS CODE IS AUTOMATICALLY GENERATED.
6
+ *
7
+ * To regenerate, run `npx convex dev`.
8
+ * @module
9
+ */
10
+ import { anyApi, componentsGeneric } from "convex/server";
11
+ const fullApi = anyApi;
12
+ /**
13
+ * A utility for referencing Convex functions in your app's public API.
14
+ *
15
+ * Usage:
16
+ * ```js
17
+ * const myFunctionReference = api.myModule.myFunction;
18
+ * ```
19
+ */
20
+ export const api = anyApi;
21
+ /**
22
+ * A utility for referencing Convex functions in your app's internal API.
23
+ *
24
+ * Usage:
25
+ * ```js
26
+ * const myFunctionReference = internal.myModule.myFunction;
27
+ * ```
28
+ */
29
+ export const internal = anyApi;
30
+ export const components = componentsGeneric();
31
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/component/_generated/api.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB;;;;;;;GAOG;AAYH,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE1D,MAAM,OAAO,GAKR,MAAa,CAAC;AAEnB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,GAAG,GAGZ,MAAa,CAAC;AAElB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,QAAQ,GAGjB,MAAa,CAAC;AAElB,MAAM,CAAC,MAAM,UAAU,GAAG,iBAAiB,EAAmB,CAAC"}