@ai-matrx/kit 0.7.4 → 0.8.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 +89 -0
- package/dist/format.cjs +210 -0
- package/dist/format.cjs.map +1 -0
- package/dist/format.d.cts +171 -0
- package/dist/format.d.ts +171 -0
- package/dist/format.js +189 -0
- package/dist/format.js.map +1 -0
- package/dist/html-escape.cjs +38 -0
- package/dist/html-escape.cjs.map +1 -0
- package/dist/html-escape.d.cts +40 -0
- package/dist/html-escape.d.ts +40 -0
- package/dist/html-escape.js +17 -0
- package/dist/html-escape.js.map +1 -0
- package/dist/index.cjs.map +1 -1
- package/dist/uuid.cjs +35 -0
- package/dist/uuid.cjs.map +1 -0
- package/dist/uuid.d.cts +38 -0
- package/dist/uuid.d.ts +38 -0
- package/dist/uuid.js +14 -0
- package/dist/uuid.js.map +1 -0
- package/package.json +37 -2
package/dist/uuid.cjs
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/uuid.ts
|
|
21
|
+
var uuid_exports = {};
|
|
22
|
+
__export(uuid_exports, {
|
|
23
|
+
isRfc4122Uuid: () => isRfc4122Uuid,
|
|
24
|
+
isUuidShape: () => isUuidShape
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(uuid_exports);
|
|
27
|
+
var UUID_SHAPE_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
28
|
+
var RFC_4122_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
29
|
+
function isUuidShape(value) {
|
|
30
|
+
return typeof value === "string" && UUID_SHAPE_RE.test(value);
|
|
31
|
+
}
|
|
32
|
+
function isRfc4122Uuid(value) {
|
|
33
|
+
return typeof value === "string" && RFC_4122_RE.test(value);
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=uuid.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/uuid.ts"],"sourcesContent":["/**\n * @ai-matrx/kit/uuid — the two UUID predicates the fleet actually uses, named\n * so that nobody can pick the wrong one by accident.\n *\n * WHY THIS FILE EXISTS (2026-09-07 duplication census, rows 6–8). The fleet had\n * TWO different predicates both called `isUuid`, and the difference was\n * invisible at the call site:\n *\n * - `@ai-matrx/associations/core`'s — a LAX shape check (8-4-4-4-12 hex).\n * Right for \"is this a database id or a slug?\", where a v7 id, a nil UUID\n * and a hand-made test fixture must all pass.\n * - Six matrx-frontend API doors' — a STRICT RFC-4122 check that additionally\n * pins the version nibble to `1-5` and the variant nibble to `8/9/a/b`.\n * Right for a validation door on a public route, where the only ids that\n * should ever arrive are ones this system minted.\n *\n * They were never reconciled because there was no shared home; the census had\n * to allowlist two of them as \"provably a different capability\". Both now live\n * here, under names that say which is which, and `isUuid` is deliberately NOT\n * exported: a caller must choose.\n *\n * Note the strict predicate REJECTS values the lax one accepts, including the\n * nil UUID `00000000-0000-0000-0000-000000000000` and every UUIDv6/v7/v8 id.\n * Never swap one for the other to make a test pass.\n */\n\n/** 8-4-4-4-12 hex, any version, any variant. */\nconst UUID_SHAPE_RE =\n /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\n/** 8-4-4-4-12 hex with an RFC-4122 version (1–5) and variant (8/9/a/b). */\nconst RFC_4122_RE =\n /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;\n\n/**\n * True when `value` has UUID *shape* — the right question for \"did I get an\n * id or a slug?\". Accepts every UUID version plus the nil UUID.\n */\nexport function isUuidShape(value: unknown): value is string {\n return typeof value === \"string\" && UUID_SHAPE_RE.test(value);\n}\n\n/**\n * True when `value` is a syntactically valid RFC-4122 UUID (version 1–5,\n * variant 8/9/a/b) — the right question for a validation door on a public\n * route. Stricter than {@link isUuidShape}: rejects the nil UUID and v6/v7/v8.\n */\nexport function isRfc4122Uuid(value: unknown): value is string {\n return typeof value === \"string\" && RFC_4122_RE.test(value);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2BA,IAAM,gBACJ;AAGF,IAAM,cACJ;AAMK,SAAS,YAAY,OAAiC;AAC3D,SAAO,OAAO,UAAU,YAAY,cAAc,KAAK,KAAK;AAC9D;AAOO,SAAS,cAAc,OAAiC;AAC7D,SAAO,OAAO,UAAU,YAAY,YAAY,KAAK,KAAK;AAC5D;","names":[]}
|
package/dist/uuid.d.cts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ai-matrx/kit/uuid — the two UUID predicates the fleet actually uses, named
|
|
3
|
+
* so that nobody can pick the wrong one by accident.
|
|
4
|
+
*
|
|
5
|
+
* WHY THIS FILE EXISTS (2026-09-07 duplication census, rows 6–8). The fleet had
|
|
6
|
+
* TWO different predicates both called `isUuid`, and the difference was
|
|
7
|
+
* invisible at the call site:
|
|
8
|
+
*
|
|
9
|
+
* - `@ai-matrx/associations/core`'s — a LAX shape check (8-4-4-4-12 hex).
|
|
10
|
+
* Right for "is this a database id or a slug?", where a v7 id, a nil UUID
|
|
11
|
+
* and a hand-made test fixture must all pass.
|
|
12
|
+
* - Six matrx-frontend API doors' — a STRICT RFC-4122 check that additionally
|
|
13
|
+
* pins the version nibble to `1-5` and the variant nibble to `8/9/a/b`.
|
|
14
|
+
* Right for a validation door on a public route, where the only ids that
|
|
15
|
+
* should ever arrive are ones this system minted.
|
|
16
|
+
*
|
|
17
|
+
* They were never reconciled because there was no shared home; the census had
|
|
18
|
+
* to allowlist two of them as "provably a different capability". Both now live
|
|
19
|
+
* here, under names that say which is which, and `isUuid` is deliberately NOT
|
|
20
|
+
* exported: a caller must choose.
|
|
21
|
+
*
|
|
22
|
+
* Note the strict predicate REJECTS values the lax one accepts, including the
|
|
23
|
+
* nil UUID `00000000-0000-0000-0000-000000000000` and every UUIDv6/v7/v8 id.
|
|
24
|
+
* Never swap one for the other to make a test pass.
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* True when `value` has UUID *shape* — the right question for "did I get an
|
|
28
|
+
* id or a slug?". Accepts every UUID version plus the nil UUID.
|
|
29
|
+
*/
|
|
30
|
+
declare function isUuidShape(value: unknown): value is string;
|
|
31
|
+
/**
|
|
32
|
+
* True when `value` is a syntactically valid RFC-4122 UUID (version 1–5,
|
|
33
|
+
* variant 8/9/a/b) — the right question for a validation door on a public
|
|
34
|
+
* route. Stricter than {@link isUuidShape}: rejects the nil UUID and v6/v7/v8.
|
|
35
|
+
*/
|
|
36
|
+
declare function isRfc4122Uuid(value: unknown): value is string;
|
|
37
|
+
|
|
38
|
+
export { isRfc4122Uuid, isUuidShape };
|
package/dist/uuid.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ai-matrx/kit/uuid — the two UUID predicates the fleet actually uses, named
|
|
3
|
+
* so that nobody can pick the wrong one by accident.
|
|
4
|
+
*
|
|
5
|
+
* WHY THIS FILE EXISTS (2026-09-07 duplication census, rows 6–8). The fleet had
|
|
6
|
+
* TWO different predicates both called `isUuid`, and the difference was
|
|
7
|
+
* invisible at the call site:
|
|
8
|
+
*
|
|
9
|
+
* - `@ai-matrx/associations/core`'s — a LAX shape check (8-4-4-4-12 hex).
|
|
10
|
+
* Right for "is this a database id or a slug?", where a v7 id, a nil UUID
|
|
11
|
+
* and a hand-made test fixture must all pass.
|
|
12
|
+
* - Six matrx-frontend API doors' — a STRICT RFC-4122 check that additionally
|
|
13
|
+
* pins the version nibble to `1-5` and the variant nibble to `8/9/a/b`.
|
|
14
|
+
* Right for a validation door on a public route, where the only ids that
|
|
15
|
+
* should ever arrive are ones this system minted.
|
|
16
|
+
*
|
|
17
|
+
* They were never reconciled because there was no shared home; the census had
|
|
18
|
+
* to allowlist two of them as "provably a different capability". Both now live
|
|
19
|
+
* here, under names that say which is which, and `isUuid` is deliberately NOT
|
|
20
|
+
* exported: a caller must choose.
|
|
21
|
+
*
|
|
22
|
+
* Note the strict predicate REJECTS values the lax one accepts, including the
|
|
23
|
+
* nil UUID `00000000-0000-0000-0000-000000000000` and every UUIDv6/v7/v8 id.
|
|
24
|
+
* Never swap one for the other to make a test pass.
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* True when `value` has UUID *shape* — the right question for "did I get an
|
|
28
|
+
* id or a slug?". Accepts every UUID version plus the nil UUID.
|
|
29
|
+
*/
|
|
30
|
+
declare function isUuidShape(value: unknown): value is string;
|
|
31
|
+
/**
|
|
32
|
+
* True when `value` is a syntactically valid RFC-4122 UUID (version 1–5,
|
|
33
|
+
* variant 8/9/a/b) — the right question for a validation door on a public
|
|
34
|
+
* route. Stricter than {@link isUuidShape}: rejects the nil UUID and v6/v7/v8.
|
|
35
|
+
*/
|
|
36
|
+
declare function isRfc4122Uuid(value: unknown): value is string;
|
|
37
|
+
|
|
38
|
+
export { isRfc4122Uuid, isUuidShape };
|
package/dist/uuid.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// src/uuid.ts
|
|
2
|
+
var UUID_SHAPE_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
3
|
+
var RFC_4122_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
4
|
+
function isUuidShape(value) {
|
|
5
|
+
return typeof value === "string" && UUID_SHAPE_RE.test(value);
|
|
6
|
+
}
|
|
7
|
+
function isRfc4122Uuid(value) {
|
|
8
|
+
return typeof value === "string" && RFC_4122_RE.test(value);
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
isRfc4122Uuid,
|
|
12
|
+
isUuidShape
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=uuid.js.map
|
package/dist/uuid.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/uuid.ts"],"sourcesContent":["/**\n * @ai-matrx/kit/uuid — the two UUID predicates the fleet actually uses, named\n * so that nobody can pick the wrong one by accident.\n *\n * WHY THIS FILE EXISTS (2026-09-07 duplication census, rows 6–8). The fleet had\n * TWO different predicates both called `isUuid`, and the difference was\n * invisible at the call site:\n *\n * - `@ai-matrx/associations/core`'s — a LAX shape check (8-4-4-4-12 hex).\n * Right for \"is this a database id or a slug?\", where a v7 id, a nil UUID\n * and a hand-made test fixture must all pass.\n * - Six matrx-frontend API doors' — a STRICT RFC-4122 check that additionally\n * pins the version nibble to `1-5` and the variant nibble to `8/9/a/b`.\n * Right for a validation door on a public route, where the only ids that\n * should ever arrive are ones this system minted.\n *\n * They were never reconciled because there was no shared home; the census had\n * to allowlist two of them as \"provably a different capability\". Both now live\n * here, under names that say which is which, and `isUuid` is deliberately NOT\n * exported: a caller must choose.\n *\n * Note the strict predicate REJECTS values the lax one accepts, including the\n * nil UUID `00000000-0000-0000-0000-000000000000` and every UUIDv6/v7/v8 id.\n * Never swap one for the other to make a test pass.\n */\n\n/** 8-4-4-4-12 hex, any version, any variant. */\nconst UUID_SHAPE_RE =\n /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\n/** 8-4-4-4-12 hex with an RFC-4122 version (1–5) and variant (8/9/a/b). */\nconst RFC_4122_RE =\n /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;\n\n/**\n * True when `value` has UUID *shape* — the right question for \"did I get an\n * id or a slug?\". Accepts every UUID version plus the nil UUID.\n */\nexport function isUuidShape(value: unknown): value is string {\n return typeof value === \"string\" && UUID_SHAPE_RE.test(value);\n}\n\n/**\n * True when `value` is a syntactically valid RFC-4122 UUID (version 1–5,\n * variant 8/9/a/b) — the right question for a validation door on a public\n * route. Stricter than {@link isUuidShape}: rejects the nil UUID and v6/v7/v8.\n */\nexport function isRfc4122Uuid(value: unknown): value is string {\n return typeof value === \"string\" && RFC_4122_RE.test(value);\n}\n"],"mappings":";AA2BA,IAAM,gBACJ;AAGF,IAAM,cACJ;AAMK,SAAS,YAAY,OAAiC;AAC3D,SAAO,OAAO,UAAU,YAAY,cAAc,KAAK,KAAK;AAC9D;AAOO,SAAS,cAAc,OAAiC;AAC7D,SAAO,OAAO,UAAU,YAAY,YAAY,KAAK,KAAK;AAC5D;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-matrx/kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "The always-include AI Matrx kit: the little primitives every Matrx app speaks — autosave that never loses a keystroke, stale-response guards, clipboard with graceful fallbacks — one per subpath, tree-shaken to what you use.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -22,7 +22,12 @@
|
|
|
22
22
|
"indexeddb",
|
|
23
23
|
"tailwind-colors",
|
|
24
24
|
"qr-code",
|
|
25
|
-
"short-link"
|
|
25
|
+
"short-link",
|
|
26
|
+
"format",
|
|
27
|
+
"duration",
|
|
28
|
+
"file-size",
|
|
29
|
+
"escape-html",
|
|
30
|
+
"uuid"
|
|
26
31
|
],
|
|
27
32
|
"repository": {
|
|
28
33
|
"type": "git",
|
|
@@ -260,6 +265,36 @@
|
|
|
260
265
|
"types": "./dist/short-link-react.d.cts",
|
|
261
266
|
"default": "./dist/short-link-react.cjs"
|
|
262
267
|
}
|
|
268
|
+
},
|
|
269
|
+
"./format": {
|
|
270
|
+
"import": {
|
|
271
|
+
"types": "./dist/format.d.ts",
|
|
272
|
+
"default": "./dist/format.js"
|
|
273
|
+
},
|
|
274
|
+
"require": {
|
|
275
|
+
"types": "./dist/format.d.cts",
|
|
276
|
+
"default": "./dist/format.cjs"
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
"./html-escape": {
|
|
280
|
+
"import": {
|
|
281
|
+
"types": "./dist/html-escape.d.ts",
|
|
282
|
+
"default": "./dist/html-escape.js"
|
|
283
|
+
},
|
|
284
|
+
"require": {
|
|
285
|
+
"types": "./dist/html-escape.d.cts",
|
|
286
|
+
"default": "./dist/html-escape.cjs"
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
"./uuid": {
|
|
290
|
+
"import": {
|
|
291
|
+
"types": "./dist/uuid.d.ts",
|
|
292
|
+
"default": "./dist/uuid.js"
|
|
293
|
+
},
|
|
294
|
+
"require": {
|
|
295
|
+
"types": "./dist/uuid.d.cts",
|
|
296
|
+
"default": "./dist/uuid.cjs"
|
|
297
|
+
}
|
|
263
298
|
}
|
|
264
299
|
},
|
|
265
300
|
"dependencies": {
|