@vllnt/convex-slugs 0.2.1 → 0.2.2-canary.b02b7a6

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
@@ -15,13 +15,17 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
15
15
  form, rolling back to 0.2.0 makes them miss for input that lowercases into the old form (`"H̱"`);
16
16
  the one-character spelling (`"ẖ"`) still matches.
17
17
  - New internal mutation `normalizeStoredSlugs` moves those old rows to the new form in one run
18
- (`npx convex run --component slugs mutations:normalizeStoredSlugs '{}'`). It leaves and reports a
18
+ (`npx convex run --component slugs mutations:normalizeStoredSlugs '{}'`). Its optional `batch`
19
+ (rows per page, default 100) must be an integer from 1 to 500, or it throws `INVALID_ARGUMENT`.
20
+ It leaves and reports a
19
21
  row whose new form another resource already holds, with both resources and both forms, in its
20
22
  result and in the deployment logs. A redirect from an old name whose new form is a live slug is
21
23
  deleted, as `reserve` does, so links to that name now reach the live slug instead of
22
24
  redirecting. Run it once after upgrading: until then a row stored by 0.2.0 is found only by the
23
25
  input that reserved it (not by `"ẖ"` or by the value `slugForResource` returns), so another
24
- resource can reserve that look-alike.
26
+ resource can reserve that look-alike, and a redirect 0.2.0 stored from the old form is not
27
+ deleted when the name is reserved or renamed onto as `"ẖ"` (one character), so
28
+ `redirectFor("H̱")` can still return it.
25
29
  - Renaming an old-form row to its new form no longer records a redirect to itself.
26
30
  - Length, pattern and reserved-word checks in `reserve` and `rename` see the composed form. For
27
31
  these letters the slug can be shorter than the input: with `minLength: 2`, `"H̱"` (2 characters
package/README.md CHANGED
@@ -205,7 +205,7 @@ export function HandleField() {
205
205
  | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
206
206
  | `SLUG_INVALID` | After normalization the slug is empty, outside `minLength`..`maxLength`, fails `pattern`, or is over the component's cap of 1024 UTF-16 code units (`string.length`) | Show the rule to the user; for `rename` only `toSlug` is checked. Keep `maxLength` at 1024 or less so the client rule matches the cap |
207
207
  | `SLUG_RESERVED` | The normalized slug is in `reservedWords` | Ask for another slug |
208
- | `SLUG_TAKEN` | The slug is held in the scope (by anyone, including the same `resourceRef`), or `rename` got `fromSlug === toSlug` after normalization | Ask for another slug; for `rename`, skip the call when both names normalize to the same slug |
208
+ | `SLUG_TAKEN` | The slug is held in the scope (by anyone, including the same `resourceRef`), or `rename` got the same `fromSlug` and `toSlug` once trimmed and case-folded (before the final NFC step, so renaming a 0.2.0 row reserved as `"H̱"` to `"ẖ"` succeeds and moves it to the new form) | Ask for another slug; for `rename`, skip the call when both names normalize to the same slug |
209
209
  | `SLUG_NOT_FOUND` | `rename` got a `fromSlug` that is not held in the scope | Read the current slug with `slugForResource` and rename that one |
210
210
 
211
211
  Invalid input throws a `ConvexError` whose `data` is `{ code, message }`; the
package/docs/API.md CHANGED
@@ -91,7 +91,9 @@ a redirect `fromSlug` -> `toSlug`. Only `toSlug` is validated against the
91
91
  options. Checks, in order:
92
92
 
93
93
  1. `toSlug` fails the options: `SLUG_INVALID` or `SLUG_RESERVED` (client).
94
- 2. `fromSlug === toSlug` after normalization: `SLUG_TAKEN`, before any read.
94
+ 2. `fromSlug` and `toSlug` are the same once trimmed and case-folded (before
95
+ the final NFC step): `SLUG_TAKEN`, before any read. Renaming a 0.2.0 row
96
+ reserved as `"H̱"` to `"ẖ"` is not caught here; it moves the row to the NFC form.
95
97
  3. `toSlug` outside the length bounds or over 1024 UTF-16 code units:
96
98
  `SLUG_INVALID` (component).
97
99
  4. `fromSlug` not held: `SLUG_NOT_FOUND`.
@@ -233,7 +235,7 @@ the mounted component, the same shape as `SlugsComponent`.
233
235
  | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
234
236
  | `SLUG_INVALID` | After normalization the slug is empty, outside `minLength`..`maxLength`, fails `pattern`, or is over 1024 UTF-16 code units (component cap) |
235
237
  | `SLUG_RESERVED` | The normalized slug is in the normalized `reservedWords` |
236
- | `SLUG_TAKEN` | The slug is held in the scope, or `rename` got `fromSlug === toSlug` after normalization |
238
+ | `SLUG_TAKEN` | The slug is held in the scope, or `rename` got the same `fromSlug` and `toSlug` once trimmed and case-folded (before the final NFC step) |
237
239
  | `SLUG_NOT_FOUND` | `rename` got a `fromSlug` that is not held in the scope |
238
240
 
239
241
  Causes and fixes are in the README's
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vllnt/convex-slugs",
3
- "version": "0.2.1",
3
+ "version": "0.2.2-canary.b02b7a6",
4
4
  "description": "Convex component for unique slugs, handles and usernames per scope, with rename redirects, a TypeScript client and React hooks.",
5
5
  "license": "MIT",
6
6
  "type": "module",