@vllnt/convex-slugs 0.1.0-canary.2051641

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 (71) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +138 -0
  3. package/dist/client/index.d.ts +90 -0
  4. package/dist/client/index.d.ts.map +1 -0
  5. package/dist/client/index.js +102 -0
  6. package/dist/client/index.js.map +1 -0
  7. package/dist/client/types.d.ts +27 -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 +38 -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 +67 -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 +133 -0
  24. package/dist/component/_generated/server.d.ts.map +1 -0
  25. package/dist/component/_generated/server.js +80 -0
  26. package/dist/component/_generated/server.js.map +1 -0
  27. package/dist/component/convex.config.d.ts +3 -0
  28. package/dist/component/convex.config.d.ts.map +1 -0
  29. package/dist/component/convex.config.js +7 -0
  30. package/dist/component/convex.config.js.map +1 -0
  31. package/dist/component/mutations.d.ts +102 -0
  32. package/dist/component/mutations.d.ts.map +1 -0
  33. package/dist/component/mutations.js +191 -0
  34. package/dist/component/mutations.js.map +1 -0
  35. package/dist/component/queries.d.ts +44 -0
  36. package/dist/component/queries.d.ts.map +1 -0
  37. package/dist/component/queries.js +75 -0
  38. package/dist/component/queries.js.map +1 -0
  39. package/dist/component/schema.d.ts +36 -0
  40. package/dist/component/schema.d.ts.map +1 -0
  41. package/dist/component/schema.js +27 -0
  42. package/dist/component/schema.js.map +1 -0
  43. package/dist/component/validators.d.ts +30 -0
  44. package/dist/component/validators.d.ts.map +1 -0
  45. package/dist/component/validators.js +25 -0
  46. package/dist/component/validators.js.map +1 -0
  47. package/dist/react/index.d.ts +55 -0
  48. package/dist/react/index.d.ts.map +1 -0
  49. package/dist/react/index.js +40 -0
  50. package/dist/react/index.js.map +1 -0
  51. package/dist/shared.d.ts +49 -0
  52. package/dist/shared.d.ts.map +1 -0
  53. package/dist/shared.js +52 -0
  54. package/dist/shared.js.map +1 -0
  55. package/package.json +115 -0
  56. package/src/client/index.ts +213 -0
  57. package/src/client/types.ts +29 -0
  58. package/src/component/_generated/api.ts +54 -0
  59. package/src/component/_generated/component.ts +90 -0
  60. package/src/component/_generated/dataModel.ts +60 -0
  61. package/src/component/_generated/server.ts +169 -0
  62. package/src/component/component.test.ts +115 -0
  63. package/src/component/convex.config.ts +9 -0
  64. package/src/component/mutations.ts +212 -0
  65. package/src/component/queries.ts +84 -0
  66. package/src/component/schema.ts +27 -0
  67. package/src/component/validators.ts +32 -0
  68. package/src/react/index.test.tsx +110 -0
  69. package/src/react/index.tsx +79 -0
  70. package/src/shared.ts +78 -0
  71. 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,138 @@
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-slugs.svg)](https://www.npmjs.com/package/@vllnt/convex-slugs)
4
+ [![CI](https://github.com/vllnt/convex-slugs/actions/workflows/ci.yml/badge.svg)](https://github.com/vllnt/convex-slugs/actions/workflows/ci.yml)
5
+ [![license](https://img.shields.io/npm/l/@vllnt/convex-slugs.svg)](./LICENSE)
6
+
7
+ # @vllnt/convex-slugs
8
+
9
+ Unique slug and handle registry with rename redirects, as a Convex component.
10
+
11
+ ```ts
12
+ const slugs = new Slugs(components.slugs);
13
+ await slugs.reserve(ctx, "ada", userId); // { ok: true } | { ok: false, reason }
14
+ const ref = await slugs.resolve(ctx, "ada"); // resourceRef | null
15
+ ```
16
+
17
+ Reserve a unique string (slug, `@handle`, username) against an opaque
18
+ `resourceRef`, enforce uniqueness inside a scope, resolve it back, release it, and
19
+ **redirect on rename**. Domain-neutral: article slugs, profile handles, workspace
20
+ slugs — any public-URL key.
21
+
22
+ ## Features
23
+
24
+ - **Atomic uniqueness** per `(scope, slug)` — rides the Convex mutation transaction, no double-reserve.
25
+ - **Scopes** — global by default, or namespace per tenant / locale / type.
26
+ - **Rename + redirects** — renaming records an old → new redirect for link preservation.
27
+ - **Chain-safe redirects** — chains collapse (A→B→C ⇒ `redirectFor(A) === C`), one row per source.
28
+ - **Reverse lookup** — find the slug currently held by a `resourceRef`.
29
+ - **Case folding + NFC** — case-insensitive (opt-out) and Unicode NFC-normalized to kill homoglyph collisions.
30
+ - **Configurable input rules** — length bounds, charset `pattern`, `reservedWords`; typed rejection reasons.
31
+ - **Degrades, never throws** — reads use `.first()`; release cleans up inbound redirects; opaque `resourceRef`.
32
+
33
+ ## Installation
34
+
35
+ ```bash
36
+ pnpm add @vllnt/convex-slugs
37
+ ```
38
+
39
+ Peer dependency: `convex@^1.41.0` (optionally `react@>=18` for the `./react` hooks).
40
+
41
+ ## Usage
42
+
43
+ ```ts
44
+ // convex/convex.config.ts
45
+ import { defineApp } from "convex/server";
46
+ import slugs from "@vllnt/convex-slugs/convex.config";
47
+
48
+ const app = defineApp();
49
+ app.use(slugs);
50
+ export default app;
51
+ ```
52
+
53
+ ```ts
54
+ // convex/handles.ts — host owns auth; pass an opaque resourceRef in.
55
+ import { components } from "./_generated/api";
56
+ import { mutation, query } from "./_generated/server";
57
+ import { v } from "convex/values";
58
+ import { Slugs } from "@vllnt/convex-slugs";
59
+
60
+ const slugs = new Slugs(components.slugs);
61
+
62
+ export const claim = mutation({
63
+ args: { handle: v.string(), userId: v.string() },
64
+ handler: (ctx, { handle, userId }) => slugs.reserve(ctx, handle, userId),
65
+ });
66
+
67
+ export const lookup = query({
68
+ args: { handle: v.string() },
69
+ handler: (ctx, { handle }) => slugs.resolve(ctx, handle),
70
+ });
71
+ ```
72
+
73
+ Client options: `new Slugs(component, { defaultScope = "global", foldCase = true, minLength = 1, maxLength = 256, pattern?, reservedWords = [] })`.
74
+
75
+ ## API Reference
76
+
77
+ | Method | Kind | Result |
78
+ |--------|------|--------|
79
+ | `reserve(ctx, slug, resourceRef, scope?)` | mutation | `{ ok: true }` or `{ ok: false, reason }` (`SLUG_INVALID` \| `SLUG_RESERVED` \| `SLUG_TAKEN`) |
80
+ | `release(ctx, slug, scope?)` | mutation | `null` (idempotent) |
81
+ | `rename(ctx, fromSlug, toSlug, scope?)` | mutation | `{ ok }` (`SLUG_INVALID` \| `SLUG_NOT_FOUND` \| `SLUG_TAKEN`) |
82
+ | `resolve(ctx, slug, scope?)` | query | `resourceRef \| null` |
83
+ | `redirectFor(ctx, slug, scope?)` | query | `toSlug \| null` |
84
+ | `slugForResource(ctx, resourceRef, scope?)` | query | `slug \| null` |
85
+
86
+ Full reference: [docs/API.md](docs/API.md).
87
+
88
+ ## React
89
+
90
+ Optional, tree-shakeable hooks from `@vllnt/convex-slugs/react` — thin wrappers over
91
+ `useQuery`; `react` is an optional peer dep. Each takes the host's re-exported
92
+ `resolve` query reference.
93
+
94
+ ```tsx
95
+ import { useSlugAvailable } from "@vllnt/convex-slugs/react";
96
+ import { api } from "../convex/_generated/api";
97
+
98
+ // `available` is undefined while loading, true when free, false when held.
99
+ const { available, resourceRef } = useSlugAvailable(api.handles.resolveHandle, { slug });
100
+ ```
101
+
102
+ | Hook | Returns |
103
+ |------|---------|
104
+ | `useSlugAvailable(resolveRef, { slug, scope? })` | `{ available, resourceRef }` — `available` `undefined` while loading, `true` free, `false` held |
105
+ | `useResolve(resolveRef, { slug, scope? })` | `resourceRef \| null \| undefined` (`undefined` while loading) |
106
+
107
+ ## Security
108
+
109
+ - **Auth-agnostic** — the host authenticates the caller, decides who may claim a handle, and passes an opaque `resourceRef`.
110
+ - **Opaque refs only** — `resourceRef` and `scope` are arbitrary strings; tables are sandboxed (reached only via the client).
111
+ - **Boundary re-guard** — the component re-guards length at the trust boundary even if a caller bypasses the client.
112
+
113
+ See [docs/API.md](docs/API.md).
114
+
115
+ ## Testing
116
+
117
+ ```bash
118
+ pnpm test # single run
119
+ pnpm test:coverage # enforced 100% on covered files
120
+ ```
121
+
122
+ Tests run against the real component runtime via `convex-test` (`@edge-runtime/vm`), not mocks.
123
+
124
+ ## Contributing
125
+
126
+ See [CONTRIBUTING.md](CONTRIBUTING.md).
127
+
128
+ ## Author
129
+
130
+ Built by [bntvllnt](https://github.com/bntvllnt) · [bntvllnt.com](https://bntvllnt.com) · [X @bntvllnt](https://x.com/bntvllnt)
131
+
132
+ Part of the [@vllnt](https://github.com/vllnt) Convex component fleet — [vllnt.com](https://vllnt.com)
133
+
134
+ If this is useful, [sponsor the work](https://github.com/sponsors/bntvllnt).
135
+
136
+ ## License
137
+
138
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,90 @@
1
+ import type { FunctionArgs, FunctionReference, FunctionReturnType } from "convex/server";
2
+ import type { SlugsOptions, SlugWriteResult } from "./types.js";
3
+ /** Numeric length backstop forwarded to the component on each write. */
4
+ interface LengthBounds {
5
+ minLength: number;
6
+ maxLength: number;
7
+ }
8
+ /**
9
+ * The slug component's function references, as exposed on the host via
10
+ * `components.slugs`.
11
+ */
12
+ export interface SlugsComponent {
13
+ mutations: {
14
+ reserve: FunctionReference<"mutation", "internal", {
15
+ scope: string;
16
+ slug: string;
17
+ resourceRef: string;
18
+ bounds: LengthBounds;
19
+ }, SlugWriteResult>;
20
+ release: FunctionReference<"mutation", "internal", {
21
+ scope: string;
22
+ slug: string;
23
+ }, null>;
24
+ rename: FunctionReference<"mutation", "internal", {
25
+ scope: string;
26
+ fromSlug: string;
27
+ toSlug: string;
28
+ bounds: LengthBounds;
29
+ }, SlugWriteResult>;
30
+ };
31
+ queries: {
32
+ resolve: FunctionReference<"query", "internal", {
33
+ scope: string;
34
+ slug: string;
35
+ }, string | null>;
36
+ redirectFor: FunctionReference<"query", "internal", {
37
+ scope: string;
38
+ slug: string;
39
+ }, string | null>;
40
+ slugForResource: FunctionReference<"query", "internal", {
41
+ scope: string;
42
+ resourceRef: string;
43
+ }, string | null>;
44
+ };
45
+ }
46
+ interface RunQueryCtx {
47
+ runQuery<Q extends FunctionReference<"query", "internal">>(reference: Q, args: FunctionArgs<Q>): Promise<FunctionReturnType<Q>>;
48
+ }
49
+ interface RunMutationCtx {
50
+ runMutation<M extends FunctionReference<"mutation", "internal">>(reference: M, args: FunctionArgs<M>): Promise<FunctionReturnType<M>>;
51
+ }
52
+ /**
53
+ * Consumer-facing client for the unique slug / handle registry. The host owns
54
+ * meaning and auth; it passes an opaque `resourceRef` and an optional `scope`.
55
+ *
56
+ * Slug validation (length, charset, reserved words) runs here against the
57
+ * resolved {@link SlugsOptions}; the component re-guards length at the trust
58
+ * boundary. An invalid write short-circuits to a typed result with no round-trip.
59
+ */
60
+ export declare class Slugs {
61
+ private readonly component;
62
+ private readonly defaultScope;
63
+ private readonly foldCase;
64
+ private readonly constraints;
65
+ constructor(component: SlugsComponent, options?: SlugsOptions);
66
+ private norm;
67
+ private scopeOf;
68
+ private get bounds();
69
+ /**
70
+ * Reserve `slug` for `resourceRef`. Returns `{ ok: false, reason }` when the
71
+ * slug is invalid (`SLUG_INVALID`), reserved (`SLUG_RESERVED`), or already held
72
+ * (`SLUG_TAKEN`).
73
+ */
74
+ reserve(ctx: RunMutationCtx, slug: string, resourceRef: string, scope?: string): Promise<SlugWriteResult>;
75
+ /** Release `slug` (idempotent — releasing an unheld slug is a no-op). */
76
+ release(ctx: RunMutationCtx, slug: string, scope?: string): Promise<null>;
77
+ /**
78
+ * Rename `fromSlug` to `toSlug`, recording a redirect. The `toSlug` is
79
+ * validated; an invalid target short-circuits to `{ ok: false, reason }`.
80
+ */
81
+ rename(ctx: RunMutationCtx, fromSlug: string, toSlug: string, scope?: string): Promise<SlugWriteResult>;
82
+ /** Resolve `slug` to its `resourceRef`, or `null`. */
83
+ resolve(ctx: RunQueryCtx, slug: string, scope?: string): Promise<string | null>;
84
+ /** Where a renamed `slug` now points (`toSlug`), or `null`. */
85
+ redirectFor(ctx: RunQueryCtx, slug: string, scope?: string): Promise<string | null>;
86
+ /** The slug currently held by `resourceRef`, or `null`. */
87
+ slugForResource(ctx: RunQueryCtx, resourceRef: string, scope?: string): Promise<string | null>;
88
+ }
89
+ export type { SlugsOptions, SlugWriteResult };
90
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRo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AC,IAAI,CAAC,CAKxE;IAED;;;OAGG;IACH,MAAM,CACJ,GAAG,EAAE,cAAc,EACnB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,eAAe,CAAC,CAY1B;IAED,sDAAsD;IACtD,OAAO,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAK9E;IAED,+DAA+D;IAC/D,WAAW,CACT,GAAG,EAAE,WAAW,EAChB,IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAKxB;IAED,2DAA2D;IAC3D,eAAe,CACb,GAAG,EAAE,WAAW,EAChB,WAAW,EAAE,MAAM,EACnB,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAKxB;CACF;AAED,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,CAAC"}
@@ -0,0 +1,102 @@
1
+ import { DEFAULT_MAX_LENGTH, DEFAULT_MIN_LENGTH, DEFAULT_SCOPE, normalizeSlug, validateSlug, } from "../shared.js";
2
+ /**
3
+ * Consumer-facing client for the unique slug / handle registry. The host owns
4
+ * meaning and auth; it passes an opaque `resourceRef` and an optional `scope`.
5
+ *
6
+ * Slug validation (length, charset, reserved words) runs here against the
7
+ * resolved {@link SlugsOptions}; the component re-guards length at the trust
8
+ * boundary. An invalid write short-circuits to a typed result with no round-trip.
9
+ */
10
+ export class Slugs {
11
+ component;
12
+ defaultScope;
13
+ foldCase;
14
+ constraints;
15
+ constructor(component, options = {}) {
16
+ this.component = component;
17
+ this.defaultScope = options.defaultScope ?? DEFAULT_SCOPE;
18
+ this.foldCase = options.foldCase ?? true;
19
+ this.constraints = {
20
+ minLength: options.minLength ?? DEFAULT_MIN_LENGTH,
21
+ maxLength: options.maxLength ?? DEFAULT_MAX_LENGTH,
22
+ pattern: options.pattern,
23
+ reservedWords: options.reservedWords ?? [],
24
+ };
25
+ }
26
+ norm(slug) {
27
+ return normalizeSlug(slug, this.foldCase);
28
+ }
29
+ scopeOf(scope) {
30
+ return scope ?? this.defaultScope;
31
+ }
32
+ get bounds() {
33
+ return {
34
+ minLength: this.constraints.minLength,
35
+ maxLength: this.constraints.maxLength,
36
+ };
37
+ }
38
+ /**
39
+ * Reserve `slug` for `resourceRef`. Returns `{ ok: false, reason }` when the
40
+ * slug is invalid (`SLUG_INVALID`), reserved (`SLUG_RESERVED`), or already held
41
+ * (`SLUG_TAKEN`).
42
+ */
43
+ reserve(ctx, slug, resourceRef, scope) {
44
+ const normalized = this.norm(slug);
45
+ const reason = validateSlug(normalized, this.constraints);
46
+ if (reason !== null) {
47
+ return Promise.resolve({ ok: false, reason });
48
+ }
49
+ return ctx.runMutation(this.component.mutations.reserve, {
50
+ scope: this.scopeOf(scope),
51
+ slug: normalized,
52
+ resourceRef,
53
+ bounds: this.bounds,
54
+ });
55
+ }
56
+ /** Release `slug` (idempotent — releasing an unheld slug is a no-op). */
57
+ release(ctx, slug, scope) {
58
+ return ctx.runMutation(this.component.mutations.release, {
59
+ scope: this.scopeOf(scope),
60
+ slug: this.norm(slug),
61
+ });
62
+ }
63
+ /**
64
+ * Rename `fromSlug` to `toSlug`, recording a redirect. The `toSlug` is
65
+ * validated; an invalid target short-circuits to `{ ok: false, reason }`.
66
+ */
67
+ rename(ctx, fromSlug, toSlug, scope) {
68
+ const normalizedTo = this.norm(toSlug);
69
+ const reason = validateSlug(normalizedTo, this.constraints);
70
+ if (reason !== null) {
71
+ return Promise.resolve({ ok: false, reason });
72
+ }
73
+ return ctx.runMutation(this.component.mutations.rename, {
74
+ scope: this.scopeOf(scope),
75
+ fromSlug: this.norm(fromSlug),
76
+ toSlug: normalizedTo,
77
+ bounds: this.bounds,
78
+ });
79
+ }
80
+ /** Resolve `slug` to its `resourceRef`, or `null`. */
81
+ resolve(ctx, slug, scope) {
82
+ return ctx.runQuery(this.component.queries.resolve, {
83
+ scope: this.scopeOf(scope),
84
+ slug: this.norm(slug),
85
+ });
86
+ }
87
+ /** Where a renamed `slug` now points (`toSlug`), or `null`. */
88
+ redirectFor(ctx, slug, scope) {
89
+ return ctx.runQuery(this.component.queries.redirectFor, {
90
+ scope: this.scopeOf(scope),
91
+ slug: this.norm(slug),
92
+ });
93
+ }
94
+ /** The slug currently held by `resourceRef`, or `null`. */
95
+ slugForResource(ctx, resourceRef, scope) {
96
+ return ctx.runQuery(this.component.queries.slugForResource, {
97
+ scope: this.scopeOf(scope),
98
+ resourceRef,
99
+ });
100
+ }
101
+ }
102
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,YAAY,GACb,MAAM,cAAc,CAAC;AAsEtB;;;;;;;GAOG;AACH,MAAM,OAAO,KAAK;IAMG,SAAS;IALX,YAAY,CAAS;IACrB,QAAQ,CAAU;IAClB,WAAW,CAAkB;IAE9C,YACmB,SAAyB,EAC1C,OAAO,GAAiB,EAAE;yBADT,SAAS;QAG1B,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,IAAI,aAAa,CAAC;QAC1D,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,IAAI,CAAC;QACzC,IAAI,CAAC,WAAW,GAAG;YACjB,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,kBAAkB;YAClD,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,kBAAkB;YAClD,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,aAAa,EAAE,OAAO,CAAC,aAAa,IAAI,EAAE;SAC3C,CAAC;IACJ,CAAC;IAEO,IAAI,CAAC,IAAY;QACv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WAAmB,EACnB,KAAc;QAEd,OAAO,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,eAAe,EAAE;YAC1D,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;YAC1B,WAAW;SACZ,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,27 @@
1
+ /** Public TypeScript surface for the slugs client. */
2
+ import type { SlugReason } from "../shared.js";
3
+ /** Result of a slug write that may be rejected. */
4
+ export interface SlugWriteResult {
5
+ ok: boolean;
6
+ /**
7
+ * Stable code-tag when `ok` is false:
8
+ * `SLUG_TAKEN` | `SLUG_NOT_FOUND` | `SLUG_INVALID` | `SLUG_RESERVED`.
9
+ */
10
+ reason?: SlugReason;
11
+ }
12
+ /** Construction options for the {@link Slugs} client. */
13
+ export interface SlugsOptions {
14
+ /** Namespace applied when a call omits `scope`. Default `"global"`. */
15
+ defaultScope?: string;
16
+ /** Lowercase slugs before store/lookup (case-insensitive handles). Default `true`. */
17
+ foldCase?: boolean;
18
+ /** Minimum slug length after normalization. Default `1`. */
19
+ minLength?: number;
20
+ /** Maximum slug length after normalization. Default `256`. */
21
+ maxLength?: number;
22
+ /** Allowed charset; a slug failing it is rejected `SLUG_INVALID`. Default: none. */
23
+ pattern?: RegExp;
24
+ /** Slugs rejected with `SLUG_RESERVED` (matched on the normalized form). Default `[]`. */
25
+ reservedWords?: string[];
26
+ }
27
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":"AAAA,sDAAsD;AAEtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,mDAAmD;AACnD,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,OAAO,CAAC;IACZ;;;OAGG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB;AAED,yDAAyD;AACzD,MAAM,WAAW,YAAY;IAC3B,uEAAuE;IACvE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sFAAsF;IACtF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8DAA8D;IAC9D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oFAAoF;IACpF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0FAA0F;IAC1F,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B"}
@@ -0,0 +1,3 @@
1
+ /** Public TypeScript surface for the slugs 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,sDAAsD"}
@@ -0,0 +1,38 @@
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 mutations from "../mutations.js";
10
+ import type * as queries from "../queries.js";
11
+ import type * as validators from "../validators.js";
12
+ import type { ApiFromModules, FilterApi, FunctionReference } from "convex/server";
13
+ declare const fullApi: ApiFromModules<{
14
+ mutations: typeof mutations;
15
+ queries: typeof queries;
16
+ validators: typeof validators;
17
+ }>;
18
+ /**
19
+ * A utility for referencing Convex functions in your app's public API.
20
+ *
21
+ * Usage:
22
+ * ```js
23
+ * const myFunctionReference = api.myModule.myFunction;
24
+ * ```
25
+ */
26
+ export declare const api: FilterApi<typeof fullApi, FunctionReference<any, "public">>;
27
+ /**
28
+ * A utility for referencing Convex functions in your app's internal API.
29
+ *
30
+ * Usage:
31
+ * ```js
32
+ * const myFunctionReference = internal.myModule.myFunction;
33
+ * ```
34
+ */
35
+ export declare const internal: FilterApi<typeof fullApi, FunctionReference<any, "internal">>;
36
+ export declare const components: {};
37
+ export {};
38
+ //# 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,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,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;AAWH,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE1D,MAAM,OAAO,GAIR,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"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Generated `ComponentApi` utility.
3
+ *
4
+ * THIS CODE IS AUTOMATICALLY GENERATED.
5
+ *
6
+ * To regenerate, run `npx convex dev`.
7
+ * @module
8
+ */
9
+ import type { FunctionReference } from "convex/server";
10
+ /**
11
+ * A utility for referencing a Convex component's exposed API.
12
+ *
13
+ * Useful when expecting a parameter like `components.myComponent`.
14
+ * Usage:
15
+ * ```ts
16
+ * async function myFunction(ctx: QueryCtx, component: ComponentApi) {
17
+ * return ctx.runQuery(component.someFile.someQuery, { ...args });
18
+ * }
19
+ * ```
20
+ */
21
+ export type ComponentApi<Name extends string | undefined = string | undefined> = {
22
+ mutations: {
23
+ release: FunctionReference<"mutation", "internal", {
24
+ scope: string;
25
+ slug: string;
26
+ }, null, Name>;
27
+ rename: FunctionReference<"mutation", "internal", {
28
+ bounds: {
29
+ maxLength: number;
30
+ minLength: number;
31
+ };
32
+ fromSlug: string;
33
+ scope: string;
34
+ toSlug: string;
35
+ }, {
36
+ ok: boolean;
37
+ reason?: "SLUG_TAKEN" | "SLUG_NOT_FOUND" | "SLUG_INVALID" | "SLUG_RESERVED";
38
+ }, Name>;
39
+ reserve: FunctionReference<"mutation", "internal", {
40
+ bounds: {
41
+ maxLength: number;
42
+ minLength: number;
43
+ };
44
+ resourceRef: string;
45
+ scope: string;
46
+ slug: string;
47
+ }, {
48
+ ok: boolean;
49
+ reason?: "SLUG_TAKEN" | "SLUG_NOT_FOUND" | "SLUG_INVALID" | "SLUG_RESERVED";
50
+ }, Name>;
51
+ };
52
+ queries: {
53
+ redirectFor: FunctionReference<"query", "internal", {
54
+ scope: string;
55
+ slug: string;
56
+ }, null | string, Name>;
57
+ resolve: FunctionReference<"query", "internal", {
58
+ scope: string;
59
+ slug: string;
60
+ }, null | string, Name>;
61
+ slugForResource: FunctionReference<"query", "internal", {
62
+ resourceRef: string;
63
+ scope: string;
64
+ }, null | string, Name>;
65
+ };
66
+ };
67
+ //# sourceMappingURL=component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/component.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,YAAY,CAAC,IAAI,SAAS,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,IAC3E;IACE,SAAS,EAAE;QACT,OAAO,EAAE,iBAAiB,CACxB,UAAU,EACV,UAAU,EACV;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,EAC/B,IAAI,EACJ,IAAI,CACL,CAAC;QACF,MAAM,EAAE,iBAAiB,CACvB,UAAU,EACV,UAAU,EACV;YACE,MAAM,EAAE;gBAAE,SAAS,EAAE,MAAM,CAAC;gBAAC,SAAS,EAAE,MAAM,CAAA;aAAE,CAAC;YACjD,QAAQ,EAAE,MAAM,CAAC;YACjB,KAAK,EAAE,MAAM,CAAC;YACd,MAAM,EAAE,MAAM,CAAC;SAChB,EACD;YACE,EAAE,EAAE,OAAO,CAAC;YACZ,MAAM,CAAC,EACL,YAAY,GAAG,gBAAgB,GAAG,cAAc,GAAG,eAAe,CAAC;SACtE,EACD,IAAI,CACL,CAAC;QACF,OAAO,EAAE,iBAAiB,CACxB,UAAU,EACV,UAAU,EACV;YACE,MAAM,EAAE;gBAAE,SAAS,EAAE,MAAM,CAAC;gBAAC,SAAS,EAAE,MAAM,CAAA;aAAE,CAAC;YACjD,WAAW,EAAE,MAAM,CAAC;YACpB,KAAK,EAAE,MAAM,CAAC;YACd,IAAI,EAAE,MAAM,CAAC;SACd,EACD;YACE,EAAE,EAAE,OAAO,CAAC;YACZ,MAAM,CAAC,EACL,YAAY,GAAG,gBAAgB,GAAG,cAAc,GAAG,eAAe,CAAC;SACtE,EACD,IAAI,CACL,CAAC;KACH,CAAC;IACF,OAAO,EAAE;QACP,WAAW,EAAE,iBAAiB,CAC5B,OAAO,EACP,UAAU,EACV;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,EAC/B,IAAI,GAAG,MAAM,EACb,IAAI,CACL,CAAC;QACF,OAAO,EAAE,iBAAiB,CACxB,OAAO,EACP,UAAU,EACV;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,EAC/B,IAAI,GAAG,MAAM,EACb,IAAI,CACL,CAAC;QACF,eAAe,EAAE,iBAAiB,CAChC,OAAO,EACP,UAAU,EACV;YAAE,WAAW,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,EACtC,IAAI,GAAG,MAAM,EACb,IAAI,CACL,CAAC;KACH,CAAC;CACH,CAAC"}
@@ -0,0 +1,11 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * Generated `ComponentApi` utility.
4
+ *
5
+ * THIS CODE IS AUTOMATICALLY GENERATED.
6
+ *
7
+ * To regenerate, run `npx convex dev`.
8
+ * @module
9
+ */
10
+ export {};
11
+ //# sourceMappingURL=component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component.js","sourceRoot":"","sources":["../../../src/component/_generated/component.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB;;;;;;;GAOG"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Generated data model types.
3
+ *
4
+ * THIS CODE IS AUTOMATICALLY GENERATED.
5
+ *
6
+ * To regenerate, run `npx convex dev`.
7
+ * @module
8
+ */
9
+ import type { DataModelFromSchemaDefinition, DocumentByName, TableNamesInDataModel, SystemTableNames } from "convex/server";
10
+ import type { GenericId } from "convex/values";
11
+ import schema from "../schema.js";
12
+ /**
13
+ * The names of all of your Convex tables.
14
+ */
15
+ export type TableNames = TableNamesInDataModel<DataModel>;
16
+ /**
17
+ * The type of a document stored in Convex.
18
+ *
19
+ * @typeParam TableName - A string literal type of the table name (like "users").
20
+ */
21
+ export type Doc<TableName extends TableNames> = DocumentByName<DataModel, TableName>;
22
+ /**
23
+ * An identifier for a document in Convex.
24
+ *
25
+ * Convex documents are uniquely identified by their `Id`, which is accessible
26
+ * on the `_id` field. To learn more, see [Document IDs](https://docs.convex.dev/using/document-ids).
27
+ *
28
+ * Documents can be loaded using `db.get(tableName, id)` in query and mutation functions.
29
+ *
30
+ * IDs are just strings at runtime, but this type can be used to distinguish them from other
31
+ * strings when type checking.
32
+ *
33
+ * @typeParam TableName - A string literal type of the table name (like "users").
34
+ */
35
+ export type Id<TableName extends TableNames | SystemTableNames> = GenericId<TableName>;
36
+ /**
37
+ * A type describing your Convex data model.
38
+ *
39
+ * This type includes information about what tables you have, the type of
40
+ * documents stored in those tables, and the indexes defined on them.
41
+ *
42
+ * This type is used to parameterize methods like `queryGeneric` and
43
+ * `mutationGeneric` to make them type-safe.
44
+ */
45
+ export type DataModel = DataModelFromSchemaDefinition<typeof schema>;
46
+ //# sourceMappingURL=dataModel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataModel.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/dataModel.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,6BAA6B,EAC7B,cAAc,EACd,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,MAAM,MAAM,cAAc,CAAC;AAElC;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,qBAAqB,CAAC,SAAS,CAAC,CAAC;AAE1D;;;;GAIG;AACH,MAAM,MAAM,GAAG,CAAC,SAAS,SAAS,UAAU,IAAI,cAAc,CAC5D,SAAS,EACT,SAAS,CACV,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,EAAE,CAAC,SAAS,SAAS,UAAU,GAAG,gBAAgB,IAC5D,SAAS,CAAC,SAAS,CAAC,CAAC;AAEvB;;;;;;;;GAQG;AACH,MAAM,MAAM,SAAS,GAAG,6BAA6B,CAAC,OAAO,MAAM,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * Generated data model types.
4
+ *
5
+ * THIS CODE IS AUTOMATICALLY GENERATED.
6
+ *
7
+ * To regenerate, run `npx convex dev`.
8
+ * @module
9
+ */
10
+ export {};
11
+ //# sourceMappingURL=dataModel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataModel.js","sourceRoot":"","sources":["../../../src/component/_generated/dataModel.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB;;;;;;;GAOG"}