@stndrds/schema 0.1.0-alpha.57 → 0.1.0-alpha.59
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/dist/{chunk-DPRLHGPO.js → chunk-DCTLP3ZD.js} +1144 -962
- package/dist/chunk-NEVERCM3.js +41 -0
- package/dist/{chunk-YVUSATKC.mjs → chunk-O7FGYLYG.mjs} +1017 -835
- package/dist/chunk-SV4BCGQU.mjs +617 -0
- package/dist/chunk-U4AB53AM.js +617 -0
- package/dist/chunk-V2RPPE2Y.mjs +41 -0
- package/dist/index.d.mts +223 -30
- package/dist/index.d.ts +223 -30
- package/dist/index.js +39 -93
- package/dist/index.mjs +112 -166
- package/dist/{runtime-BqJdmg_4.d.mts → runtime-BRkoIwsC.d.ts} +274 -1658
- package/dist/{runtime-BqJdmg_4.d.ts → runtime-Chz-bTNq.d.mts} +274 -1658
- package/dist/runtime.d.mts +3 -1
- package/dist/runtime.d.ts +3 -1
- package/dist/runtime.js +6 -2
- package/dist/runtime.mjs +5 -1
- package/dist/utils.d.mts +154 -0
- package/dist/utils.d.ts +154 -0
- package/dist/utils.js +19 -0
- package/dist/utils.mjs +19 -0
- package/dist/validation/validators.d.mts +4 -0
- package/dist/validation/validators.d.ts +4 -0
- package/dist/validation/validators.js +121 -0
- package/dist/validation/validators.mjs +121 -0
- package/dist/validators-BIAmz0CD.d.mts +1631 -0
- package/dist/validators-BPIB7Miq.d.ts +1631 -0
- package/package.json +12 -2
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/utils.ts
|
|
2
|
+
function asTenantId(id) {
|
|
3
|
+
return id;
|
|
4
|
+
}
|
|
5
|
+
function asUserId(id) {
|
|
6
|
+
return id;
|
|
7
|
+
}
|
|
8
|
+
function generateId() {
|
|
9
|
+
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
10
|
+
return crypto.randomUUID();
|
|
11
|
+
}
|
|
12
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
|
13
|
+
const r = Math.random() * 16 | 0;
|
|
14
|
+
const v = c === "x" ? r : r & 3 | 8;
|
|
15
|
+
return v.toString(16);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function generatePrefixedId(prefix) {
|
|
19
|
+
return `${prefix}_${generateId()}`;
|
|
20
|
+
}
|
|
21
|
+
function slugify(input) {
|
|
22
|
+
return input.normalize("NFD").replace(/\p{M}/gu, "").toLowerCase().replace(/[^a-z0-9\s_-]/g, "").trim().replace(/\s+/g, "-").replace(/-+/g, "-");
|
|
23
|
+
}
|
|
24
|
+
function generateTemplateName(label) {
|
|
25
|
+
const slug = slugify(label) || "template";
|
|
26
|
+
const suffix = generateId().slice(0, 8);
|
|
27
|
+
return `${slug}-${suffix}`;
|
|
28
|
+
}
|
|
29
|
+
function indexBy(items, keyFn) {
|
|
30
|
+
return new Map(items.map((item) => [keyFn(item), item]));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
exports.asTenantId = asTenantId; exports.asUserId = asUserId; exports.generateId = generateId; exports.generatePrefixedId = generatePrefixedId; exports.slugify = slugify; exports.generateTemplateName = generateTemplateName; exports.indexBy = indexBy;
|