@vllnt/convex-slugs 0.2.0-canary.eb878e4 → 0.2.0
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 +54 -35
- package/README.md +309 -125
- package/dist/client/index.d.ts +50 -4
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +50 -4
- package/dist/client/index.js.map +1 -1
- package/dist/client/types.d.ts +5 -1
- package/dist/client/types.d.ts.map +1 -1
- package/dist/component/convex.config.d.ts +1 -0
- package/dist/component/convex.config.d.ts.map +1 -1
- package/dist/component/convex.config.js +1 -0
- package/dist/component/convex.config.js.map +1 -1
- package/dist/component/mutations.d.ts +11 -3
- package/dist/component/mutations.d.ts.map +1 -1
- package/dist/component/mutations.js +35 -15
- package/dist/component/mutations.js.map +1 -1
- package/docs/API.md +247 -100
- package/llms.txt +49 -13
- package/package.json +12 -13
- package/src/client/index.ts +50 -4
- package/src/client/types.ts +5 -1
- package/src/component/convex.config.ts +1 -0
- package/src/component/mutations.ts +43 -15
package/dist/client/index.d.ts
CHANGED
|
@@ -56,12 +56,20 @@ interface RunMutationCtx {
|
|
|
56
56
|
* Slug validation (length, charset, reserved words) runs here against the
|
|
57
57
|
* resolved {@link SlugsOptions}; the component re-guards length at the trust
|
|
58
58
|
* boundary. An invalid write short-circuits to a typed result with no round-trip.
|
|
59
|
+
*
|
|
60
|
+
* @see https://oss.vllnt.com/packages/convex-slugs
|
|
59
61
|
*/
|
|
60
62
|
export declare class Slugs {
|
|
61
63
|
private readonly component;
|
|
62
64
|
private readonly defaultScope;
|
|
63
65
|
private readonly foldCase;
|
|
64
66
|
private readonly constraints;
|
|
67
|
+
/**
|
|
68
|
+
* @param component - The mounted component, `components.slugs`.
|
|
69
|
+
* @param options - Scope, case folding and validation rules; see {@link SlugsOptions}.
|
|
70
|
+
* @throws `ConvexError` with `data.code` `INVALID_OPTIONS` for an empty
|
|
71
|
+
* `defaultScope` or invalid length bounds.
|
|
72
|
+
*/
|
|
65
73
|
constructor(component: SlugsComponent, options?: SlugsOptions);
|
|
66
74
|
private norm;
|
|
67
75
|
private scopeOf;
|
|
@@ -70,20 +78,58 @@ export declare class Slugs {
|
|
|
70
78
|
* Reserve `slug` for `resourceRef`. Returns `{ ok: false, reason }` when the
|
|
71
79
|
* slug is invalid (`SLUG_INVALID`), reserved (`SLUG_RESERVED`), or already held
|
|
72
80
|
* (`SLUG_TAKEN`).
|
|
81
|
+
*
|
|
82
|
+
* @param ctx - A mutation or action context.
|
|
83
|
+
* @param slug - Raw slug; normalized before validation and storage.
|
|
84
|
+
* @param resourceRef - Opaque host reference that will hold the slug.
|
|
85
|
+
* @param scope - Namespace; defaults to `defaultScope`.
|
|
73
86
|
*/
|
|
74
87
|
reserve(ctx: RunMutationCtx, slug: string, resourceRef: string, scope?: string): Promise<SlugWriteResult>;
|
|
75
|
-
/**
|
|
88
|
+
/**
|
|
89
|
+
* Release `slug` (idempotent — releasing an unheld slug is a no-op) and
|
|
90
|
+
* delete the redirects that point at it.
|
|
91
|
+
*
|
|
92
|
+
* @param ctx - A mutation or action context.
|
|
93
|
+
* @param slug - Raw slug; normalized before lookup.
|
|
94
|
+
* @param scope - Namespace; defaults to `defaultScope`.
|
|
95
|
+
*/
|
|
76
96
|
release(ctx: RunMutationCtx, slug: string, scope?: string): Promise<null>;
|
|
77
97
|
/**
|
|
78
98
|
* Rename `fromSlug` to `toSlug`, recording a redirect. The `toSlug` is
|
|
79
99
|
* validated; an invalid target short-circuits to `{ ok: false, reason }`.
|
|
100
|
+
* Returns `SLUG_NOT_FOUND` when `fromSlug` is not held and `SLUG_TAKEN` when
|
|
101
|
+
* `toSlug` is held or equals `fromSlug`.
|
|
102
|
+
*
|
|
103
|
+
* @param ctx - A mutation or action context.
|
|
104
|
+
* @param fromSlug - The currently held slug.
|
|
105
|
+
* @param toSlug - The new slug; validated like `reserve`.
|
|
106
|
+
* @param scope - Namespace; defaults to `defaultScope`.
|
|
80
107
|
*/
|
|
81
108
|
rename(ctx: RunMutationCtx, fromSlug: string, toSlug: string, scope?: string): Promise<SlugWriteResult>;
|
|
82
|
-
/**
|
|
109
|
+
/**
|
|
110
|
+
* Resolve `slug` to its `resourceRef`, or `null`. Does not follow redirects.
|
|
111
|
+
*
|
|
112
|
+
* @param ctx - A query, mutation or action context.
|
|
113
|
+
* @param slug - Raw slug; normalized before lookup.
|
|
114
|
+
* @param scope - Namespace; defaults to `defaultScope`.
|
|
115
|
+
*/
|
|
83
116
|
resolve(ctx: RunQueryCtx, slug: string, scope?: string): Promise<string | null>;
|
|
84
|
-
/**
|
|
117
|
+
/**
|
|
118
|
+
* Where a renamed `slug` now points (the live slug, chains collapsed), or
|
|
119
|
+
* `null`.
|
|
120
|
+
*
|
|
121
|
+
* @param ctx - A query, mutation or action context.
|
|
122
|
+
* @param slug - Raw slug; normalized before lookup.
|
|
123
|
+
* @param scope - Namespace; defaults to `defaultScope`.
|
|
124
|
+
*/
|
|
85
125
|
redirectFor(ctx: RunQueryCtx, slug: string, scope?: string): Promise<string | null>;
|
|
86
|
-
/**
|
|
126
|
+
/**
|
|
127
|
+
* The slug currently held by `resourceRef`, or `null`.
|
|
128
|
+
*
|
|
129
|
+
* @param ctx - A query, mutation or action context.
|
|
130
|
+
* @param resourceRef - Opaque host reference, compared exactly.
|
|
131
|
+
* @param scope - Namespace; defaults to `defaultScope`.
|
|
132
|
+
*/
|
|
87
133
|
slugForResource(ctx: RunQueryCtx, resourceRef: string, scope?: string): Promise<string | null>;
|
|
88
134
|
}
|
|
89
135
|
export type { SlugsOptions, SlugWriteResult };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC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,20 @@ import { DEFAULT_MAX_LENGTH, DEFAULT_MIN_LENGTH, DEFAULT_SCOPE, normalizeSlug, v
|
|
|
7
7
|
* Slug validation (length, charset, reserved words) runs here against the
|
|
8
8
|
* resolved {@link SlugsOptions}; the component re-guards length at the trust
|
|
9
9
|
* boundary. An invalid write short-circuits to a typed result with no round-trip.
|
|
10
|
+
*
|
|
11
|
+
* @see https://oss.vllnt.com/packages/convex-slugs
|
|
10
12
|
*/
|
|
11
13
|
export class Slugs {
|
|
12
14
|
component;
|
|
13
15
|
defaultScope;
|
|
14
16
|
foldCase;
|
|
15
17
|
constraints;
|
|
18
|
+
/**
|
|
19
|
+
* @param component - The mounted component, `components.slugs`.
|
|
20
|
+
* @param options - Scope, case folding and validation rules; see {@link SlugsOptions}.
|
|
21
|
+
* @throws `ConvexError` with `data.code` `INVALID_OPTIONS` for an empty
|
|
22
|
+
* `defaultScope` or invalid length bounds.
|
|
23
|
+
*/
|
|
16
24
|
constructor(component, options = {}) {
|
|
17
25
|
this.component = component;
|
|
18
26
|
this.defaultScope = options.defaultScope ?? DEFAULT_SCOPE;
|
|
@@ -53,6 +61,11 @@ export class Slugs {
|
|
|
53
61
|
* Reserve `slug` for `resourceRef`. Returns `{ ok: false, reason }` when the
|
|
54
62
|
* slug is invalid (`SLUG_INVALID`), reserved (`SLUG_RESERVED`), or already held
|
|
55
63
|
* (`SLUG_TAKEN`).
|
|
64
|
+
*
|
|
65
|
+
* @param ctx - A mutation or action context.
|
|
66
|
+
* @param slug - Raw slug; normalized before validation and storage.
|
|
67
|
+
* @param resourceRef - Opaque host reference that will hold the slug.
|
|
68
|
+
* @param scope - Namespace; defaults to `defaultScope`.
|
|
56
69
|
*/
|
|
57
70
|
reserve(ctx, slug, resourceRef, scope) {
|
|
58
71
|
const normalized = this.norm(slug);
|
|
@@ -67,7 +80,14 @@ export class Slugs {
|
|
|
67
80
|
bounds: this.bounds,
|
|
68
81
|
});
|
|
69
82
|
}
|
|
70
|
-
/**
|
|
83
|
+
/**
|
|
84
|
+
* Release `slug` (idempotent — releasing an unheld slug is a no-op) and
|
|
85
|
+
* delete the redirects that point at it.
|
|
86
|
+
*
|
|
87
|
+
* @param ctx - A mutation or action context.
|
|
88
|
+
* @param slug - Raw slug; normalized before lookup.
|
|
89
|
+
* @param scope - Namespace; defaults to `defaultScope`.
|
|
90
|
+
*/
|
|
71
91
|
release(ctx, slug, scope) {
|
|
72
92
|
return ctx.runMutation(this.component.mutations.release, {
|
|
73
93
|
scope: this.scopeOf(scope),
|
|
@@ -77,6 +97,13 @@ export class Slugs {
|
|
|
77
97
|
/**
|
|
78
98
|
* Rename `fromSlug` to `toSlug`, recording a redirect. The `toSlug` is
|
|
79
99
|
* validated; an invalid target short-circuits to `{ ok: false, reason }`.
|
|
100
|
+
* Returns `SLUG_NOT_FOUND` when `fromSlug` is not held and `SLUG_TAKEN` when
|
|
101
|
+
* `toSlug` is held or equals `fromSlug`.
|
|
102
|
+
*
|
|
103
|
+
* @param ctx - A mutation or action context.
|
|
104
|
+
* @param fromSlug - The currently held slug.
|
|
105
|
+
* @param toSlug - The new slug; validated like `reserve`.
|
|
106
|
+
* @param scope - Namespace; defaults to `defaultScope`.
|
|
80
107
|
*/
|
|
81
108
|
rename(ctx, fromSlug, toSlug, scope) {
|
|
82
109
|
const normalizedTo = this.norm(toSlug);
|
|
@@ -91,21 +118,40 @@ export class Slugs {
|
|
|
91
118
|
bounds: this.bounds,
|
|
92
119
|
});
|
|
93
120
|
}
|
|
94
|
-
/**
|
|
121
|
+
/**
|
|
122
|
+
* Resolve `slug` to its `resourceRef`, or `null`. Does not follow redirects.
|
|
123
|
+
*
|
|
124
|
+
* @param ctx - A query, mutation or action context.
|
|
125
|
+
* @param slug - Raw slug; normalized before lookup.
|
|
126
|
+
* @param scope - Namespace; defaults to `defaultScope`.
|
|
127
|
+
*/
|
|
95
128
|
resolve(ctx, slug, scope) {
|
|
96
129
|
return ctx.runQuery(this.component.queries.resolve, {
|
|
97
130
|
scope: this.scopeOf(scope),
|
|
98
131
|
slug: this.norm(slug),
|
|
99
132
|
});
|
|
100
133
|
}
|
|
101
|
-
/**
|
|
134
|
+
/**
|
|
135
|
+
* Where a renamed `slug` now points (the live slug, chains collapsed), or
|
|
136
|
+
* `null`.
|
|
137
|
+
*
|
|
138
|
+
* @param ctx - A query, mutation or action context.
|
|
139
|
+
* @param slug - Raw slug; normalized before lookup.
|
|
140
|
+
* @param scope - Namespace; defaults to `defaultScope`.
|
|
141
|
+
*/
|
|
102
142
|
redirectFor(ctx, slug, scope) {
|
|
103
143
|
return ctx.runQuery(this.component.queries.redirectFor, {
|
|
104
144
|
scope: this.scopeOf(scope),
|
|
105
145
|
slug: this.norm(slug),
|
|
106
146
|
});
|
|
107
147
|
}
|
|
108
|
-
/**
|
|
148
|
+
/**
|
|
149
|
+
* The slug currently held by `resourceRef`, or `null`.
|
|
150
|
+
*
|
|
151
|
+
* @param ctx - A query, mutation or action context.
|
|
152
|
+
* @param resourceRef - Opaque host reference, compared exactly.
|
|
153
|
+
* @param scope - Namespace; defaults to `defaultScope`.
|
|
154
|
+
*/
|
|
109
155
|
slugForResource(ctx, resourceRef, scope) {
|
|
110
156
|
return ctx.runQuery(this.component.queries.slugForResource, {
|
|
111
157
|
scope: this.scopeOf(scope),
|
package/dist/client/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAO5C,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,YAAY,GACb,MAAM,cAAc,CAAC;AAsEtB
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAO5C,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,aA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,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"}
|
package/dist/client/types.d.ts
CHANGED
|
@@ -17,7 +17,11 @@ export interface SlugsOptions {
|
|
|
17
17
|
foldCase?: boolean;
|
|
18
18
|
/** Minimum slug length after normalization. Default `1`. */
|
|
19
19
|
minLength?: number;
|
|
20
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Maximum slug length after normalization, in UTF-16 code units. Default
|
|
22
|
+
* `256`. A value over 1024 is accepted, but the component still returns
|
|
23
|
+
* `SLUG_INVALID` for a slug over 1024 code units.
|
|
24
|
+
*/
|
|
21
25
|
maxLength?: number;
|
|
22
26
|
/** Allowed charset; a slug failing it is rejected `SLUG_INVALID`. Default: none. */
|
|
23
27
|
pattern?: RegExp;
|
|
@@ -1 +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
|
|
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;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oFAAoF;IACpF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0FAA0F;IAC1F,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convex.config.d.ts","sourceRoot":"","sources":["../../src/component/convex.config.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,SAAS,sDAA2B,CAAC;eAM5B,SAAS"}
|
|
1
|
+
{"version":3,"file":"convex.config.d.ts","sourceRoot":"","sources":["../../src/component/convex.config.ts"],"names":[],"mappings":"AAEA,yGAAyG;AACzG,QAAA,MAAM,SAAS,sDAA2B,CAAC;eAM5B,SAAS"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { defineComponent } from "convex/server";
|
|
2
|
+
/** Component definition, named `slugs`. Mount it with `app.use(config)` in `convex/convex.config.ts`. */
|
|
2
3
|
const component = defineComponent("slugs");
|
|
3
4
|
// Nest official child components here, e.g.:
|
|
4
5
|
// import sharded from "@convex-dev/sharded-counter/convex.config";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convex.config.js","sourceRoot":"","sources":["../../src/component/convex.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,MAAM,SAAS,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;AAE3C,6CAA6C;AAC7C,mEAAmE;AACnE,0BAA0B;AAE1B,eAAe,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"convex.config.js","sourceRoot":"","sources":["../../src/component/convex.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,yGAAyG;AACzG,MAAM,SAAS,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;AAE3C,6CAA6C;AAC7C,mEAAmE;AACnE,0BAA0B;AAE1B,eAAe,SAAS,CAAC"}
|
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
* redirect row is removed (the slug is a live name again).
|
|
6
6
|
*
|
|
7
7
|
* @returns `{ ok: true }`, or `{ ok: false, reason }` where reason is
|
|
8
|
-
* `SLUG_INVALID` (empty
|
|
8
|
+
* `SLUG_INVALID` (empty, outside `bounds` or over {@link MAX_INPUT_LENGTH}) or
|
|
9
|
+
* `SLUG_TAKEN` (already held in scope).
|
|
10
|
+
* @throws `INVALID_ARGUMENT` for an empty, or over-cap, `scope` or `resourceRef`.
|
|
9
11
|
*/
|
|
10
12
|
export declare const reserve: import("convex/server").RegisteredMutation<"public", {
|
|
11
13
|
bounds: {
|
|
@@ -51,9 +53,15 @@ export declare const release: import("convex/server").RegisteredMutation<"public
|
|
|
51
53
|
* Self-rename (`fromSlug === toSlug`) is rejected with `SLUG_TAKEN` before any
|
|
52
54
|
* DB read, preventing a self-loop redirect from being created.
|
|
53
55
|
*
|
|
56
|
+
* `fromSlug` is not size-capped: it is only a lookup key, so a value over the
|
|
57
|
+
* cap writes nothing unless an older version stored it, and renaming such a
|
|
58
|
+
* legacy row to a short `toSlug` is the way to bring it under the cap.
|
|
59
|
+
*
|
|
54
60
|
* @returns `{ ok: true }`, or `{ ok: false, reason }` where reason is
|
|
55
|
-
* `SLUG_INVALID` (empty
|
|
56
|
-
*
|
|
61
|
+
* `SLUG_INVALID` (empty, outside `bounds` or over {@link MAX_INPUT_LENGTH}
|
|
62
|
+
* `toSlug`), `SLUG_NOT_FOUND` (`fromSlug` not held), or `SLUG_TAKEN` (`toSlug`
|
|
63
|
+
* already held or equals `fromSlug`).
|
|
64
|
+
* @throws `INVALID_ARGUMENT` for an empty, or over-cap, `scope`.
|
|
57
65
|
*/
|
|
58
66
|
export declare const rename: import("convex/server").RegisteredMutation<"public", {
|
|
59
67
|
bounds: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../src/component/mutations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../src/component/mutations.ts"],"names":[],"mappings":"AAwDA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,OAAO;;;;;;;;;;YAWc,cAAc;;;YASd,YAAY;;;;GAkB5C,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,OAAO;;;iBAyBlB,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;YAWe,YAAY;;;YAGZ,cAAc;;;YASd,gBAAgB;;;;GAoDhD,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS;;;;iBAWpB,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB;;;;iBAW5B,CAAC"}
|
|
@@ -1,24 +1,42 @@
|
|
|
1
1
|
import { ConvexError, v } from "convex/values";
|
|
2
2
|
import { internalMutation, mutation } from "./_generated/server.js";
|
|
3
3
|
import { lengthBounds, reserveResult } from "./validators.js";
|
|
4
|
+
/**
|
|
5
|
+
* Hard cap, in UTF-16 code units (`string.length`), on the slug, `scope` and
|
|
6
|
+
* `resourceRef` that `reserve` and `rename` write. It holds whatever `bounds`
|
|
7
|
+
* the caller passes. `release` and the queries do not apply it, so rows stored
|
|
8
|
+
* by an older version with longer values stay readable and removable.
|
|
9
|
+
*/
|
|
10
|
+
const MAX_INPUT_LENGTH = 1024;
|
|
4
11
|
/**
|
|
5
12
|
* Reject malformed arguments with `ConvexError({ code: "INVALID_ARGUMENT" })`.
|
|
6
13
|
* Expected slug rejections stay typed `{ ok: false, reason }` results; this
|
|
7
|
-
* covers input no correct client sends (empty scope/ref, non-integer bounds
|
|
14
|
+
* covers input no correct client sends (empty scope/ref, non-integer bounds,
|
|
15
|
+
* and on writes a scope or ref over {@link MAX_INPUT_LENGTH}).
|
|
8
16
|
*/
|
|
9
17
|
function assertArgs(args) {
|
|
10
18
|
const { scope, resourceRef, bounds } = args;
|
|
11
|
-
|
|
19
|
+
// Only `reserve` and `rename` pass `bounds`; they are the size-capped writes.
|
|
20
|
+
const isWrite = bounds !== undefined;
|
|
21
|
+
const badBounds = isWrite &&
|
|
12
22
|
!(Number.isInteger(bounds.minLength) &&
|
|
13
23
|
Number.isInteger(bounds.maxLength) &&
|
|
14
24
|
bounds.minLength <= bounds.maxLength);
|
|
15
|
-
|
|
25
|
+
const oversized = isWrite &&
|
|
26
|
+
(scope.length > MAX_INPUT_LENGTH ||
|
|
27
|
+
(resourceRef ?? "").length > MAX_INPUT_LENGTH);
|
|
28
|
+
if (scope === "" || resourceRef === "" || badBounds || oversized) {
|
|
16
29
|
throw new ConvexError({
|
|
17
30
|
code: "INVALID_ARGUMENT",
|
|
18
|
-
message:
|
|
31
|
+
message: `scope and resourceRef must be non-empty, and at most ${String(MAX_INPUT_LENGTH)} UTF-16 code units on reserve and rename; bounds must be integers with min <= max`,
|
|
19
32
|
});
|
|
20
33
|
}
|
|
21
34
|
}
|
|
35
|
+
/** Whether a slug to be written is empty, outside `bounds`, or over the cap. */
|
|
36
|
+
function slugOutOfBounds(slug, bounds) {
|
|
37
|
+
return (slug.length < Math.max(1, bounds.minLength) ||
|
|
38
|
+
slug.length > Math.min(bounds.maxLength, MAX_INPUT_LENGTH));
|
|
39
|
+
}
|
|
22
40
|
/**
|
|
23
41
|
* Reserve `slug` for `resourceRef` within `scope`. The slug arrives already
|
|
24
42
|
* normalized by the client; `bounds` re-guards empty/oversized input at the
|
|
@@ -26,7 +44,9 @@ function assertArgs(args) {
|
|
|
26
44
|
* redirect row is removed (the slug is a live name again).
|
|
27
45
|
*
|
|
28
46
|
* @returns `{ ok: true }`, or `{ ok: false, reason }` where reason is
|
|
29
|
-
* `SLUG_INVALID` (empty
|
|
47
|
+
* `SLUG_INVALID` (empty, outside `bounds` or over {@link MAX_INPUT_LENGTH}) or
|
|
48
|
+
* `SLUG_TAKEN` (already held in scope).
|
|
49
|
+
* @throws `INVALID_ARGUMENT` for an empty, or over-cap, `scope` or `resourceRef`.
|
|
30
50
|
*/
|
|
31
51
|
export const reserve = mutation({
|
|
32
52
|
args: {
|
|
@@ -38,10 +58,7 @@ export const reserve = mutation({
|
|
|
38
58
|
returns: reserveResult,
|
|
39
59
|
handler: async (ctx, args) => {
|
|
40
60
|
assertArgs(args);
|
|
41
|
-
if (args.slug
|
|
42
|
-
return { ok: false, reason: "SLUG_INVALID" };
|
|
43
|
-
}
|
|
44
|
-
if (args.slug.length > args.bounds.maxLength) {
|
|
61
|
+
if (slugOutOfBounds(args.slug, args.bounds)) {
|
|
45
62
|
return { ok: false, reason: "SLUG_INVALID" };
|
|
46
63
|
}
|
|
47
64
|
const existing = await ctx.db
|
|
@@ -110,9 +127,15 @@ export const release = mutation({
|
|
|
110
127
|
* Self-rename (`fromSlug === toSlug`) is rejected with `SLUG_TAKEN` before any
|
|
111
128
|
* DB read, preventing a self-loop redirect from being created.
|
|
112
129
|
*
|
|
130
|
+
* `fromSlug` is not size-capped: it is only a lookup key, so a value over the
|
|
131
|
+
* cap writes nothing unless an older version stored it, and renaming such a
|
|
132
|
+
* legacy row to a short `toSlug` is the way to bring it under the cap.
|
|
133
|
+
*
|
|
113
134
|
* @returns `{ ok: true }`, or `{ ok: false, reason }` where reason is
|
|
114
|
-
* `SLUG_INVALID` (empty
|
|
115
|
-
*
|
|
135
|
+
* `SLUG_INVALID` (empty, outside `bounds` or over {@link MAX_INPUT_LENGTH}
|
|
136
|
+
* `toSlug`), `SLUG_NOT_FOUND` (`fromSlug` not held), or `SLUG_TAKEN` (`toSlug`
|
|
137
|
+
* already held or equals `fromSlug`).
|
|
138
|
+
* @throws `INVALID_ARGUMENT` for an empty, or over-cap, `scope`.
|
|
116
139
|
*/
|
|
117
140
|
export const rename = mutation({
|
|
118
141
|
args: {
|
|
@@ -127,10 +150,7 @@ export const rename = mutation({
|
|
|
127
150
|
if (args.fromSlug === args.toSlug) {
|
|
128
151
|
return { ok: false, reason: "SLUG_TAKEN" };
|
|
129
152
|
}
|
|
130
|
-
if (args.toSlug
|
|
131
|
-
return { ok: false, reason: "SLUG_INVALID" };
|
|
132
|
-
}
|
|
133
|
-
if (args.toSlug.length > args.bounds.maxLength) {
|
|
153
|
+
if (slugOutOfBounds(args.toSlug, args.bounds)) {
|
|
134
154
|
return { ok: false, reason: "SLUG_INVALID" };
|
|
135
155
|
}
|
|
136
156
|
const from = await ctx.db
|
|
@@ -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,gBAAgB,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE9D
|
|
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,gBAAgB,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE9D;;;;;GAKG;AACH,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAE9B;;;;;GAKG;AACH,SAA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