@arisutalk/character-spec 0.0.4 → 0.0.5
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/index.d.ts +4 -4
- package/dist/v0/Character/Assets.d.ts +30 -17
- package/dist/v0/Character/Assets.js +8 -4
- package/dist/v0/Character/Assets.js.map +1 -1
- package/dist/v0/Character/Character.d.ts +74 -63
- package/dist/v0/Character/Character.js +11 -10
- package/dist/v0/Character/Character.js.map +1 -1
- package/dist/v0/Character/Chat.d.ts +11 -4
- package/dist/v0/Character/Chat.js +1 -1
- package/dist/v0/Character/Chat.js.map +1 -1
- package/dist/v0/Character/Lorebook.d.ts +32 -25
- package/dist/v0/Character/Lorebook.js +14 -14
- package/dist/v0/Character/Lorebook.js.map +1 -1
- package/dist/v0/Character/Message.d.ts +23 -11
- package/dist/v0/Character/Message.js +8 -8
- package/dist/v0/Character/Message.js.map +1 -1
- package/dist/v0/Character/Meta.d.ts +19 -0
- package/dist/v0/Character/index.d.ts +2 -1
- package/dist/v0/Character.d.ts +2 -6
- package/dist/v0/Character.js +5 -3
- package/dist/v0/Character.js.map +1 -1
- package/dist/v0/Executables/Executable.d.ts +13 -8
- package/dist/v0/Executables/Executable.js +11 -8
- package/dist/v0/Executables/Executable.js.map +1 -1
- package/dist/v0/Executables/ReplaceHook.d.ts +66 -57
- package/dist/v0/Executables/ReplaceHook.js +10 -10
- package/dist/v0/Executables/ReplaceHook.js.map +1 -1
- package/dist/v0/Executables/index.d.ts +1 -1
- package/dist/v0/Executables.d.ts +2 -3
- package/dist/v0/index.d.ts +3 -1
- package/dist/v0/utils.d.ts +31 -6
- package/dist/v0/utils.js +21 -8
- package/dist/v0/utils.js.map +1 -1
- package/dist/v0.d.ts +1 -1
- package/dist/v0.js +5 -3
- package/package.json +8 -4
package/dist/v0/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../src/types/v0/utils.ts"],"sourcesContent":["import { z } from \"zod\";\n\n/**\n * This type is used to represent the URL of an image.\n * It is used to validate the URL of an image.\n *
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../src/types/v0/utils.ts"],"sourcesContent":["import { z } from \"zod\";\n\n/**\n * This type is used to represent the URL of an image.\n * It is used to validate the URL of an image.\n * This should only be used in exported character. When importing the character, it should be converted to `local:`.\n * If its protocol is `local:`, it means the image is stored in the browser, usually OpFS.\n * Otherwise, it should be a valid URL which can be fetched in browser.\n * Don't use `data:` URL for large images, as it can bloat the character spec size.\n *\n */\nexport const ImageURLSchema = z.url().meta({\n description:\n \"URL of an image. `local:` for browser storage (OpFS), otherwise a fetchable URL. While it can be `data:` URL for base64 encoded images, it's not recommended.\",\n});\n\n/**\n * Binary data represented as Uint8Array.\n * Useful for local file assets.\n */\nexport const Uint8ArraySchema = z.instanceof(Uint8Array).meta({\n description: \"The binary data of the file. Used for local assets.\",\n tsType: \"Uint8Array\",\n});\n\n/**\n * Represents a file, either as a URL or as binary data (Uint8Array).\n * Used for file assets.\n */\nexport const FileSchema = z\n .union([\n // URL Asset\n ImageURLSchema,\n Uint8ArraySchema,\n ])\n .meta({\n description:\n \"Represents a file, either as a URL or as binary data (Uint8Array).\\n\" +\n \"@type {string | Uint8Array}\\n\",\n });\n/**\n * Custom validator to ensure all objects in the array have unique values for a specific key.\n * @param key The key to check for uniqueness. It should be a string key of the object.\n * @returns A predicate function for `z.refine`.\n * @example\n * ```ts\n * const schema = z.array(z.object({ name: z.string() })).refine(unique(\"name\"), { message: \"Not unique\" });\n * ```\n */\nexport function unique<\n const ARR extends {\n [key: string]: unknown;\n },\n>(key: keyof ARR) {\n return (i: ARR[]) => {\n return new Set(i.map((j) => j[key])).size === i.length;\n };\n}\n\n/**\n * Zod custom schema to ensure the value is a positive integer.\n */\nexport const positiveInteger = z\n .int()\n .min(1)\n .meta({ description: \"Positive integer (>= 1)\" });\n"],"names":["ImageURLSchema","z","Uint8ArraySchema","FileSchema","unique","key","i","j","positiveInteger"],"mappings":";AAWO,MAAMA,IAAiBC,EAAE,IAAA,EAAM,KAAK;AAAA,EACvC,aACI;AACR,CAAC,GAMYC,IAAmBD,EAAE,WAAW,UAAU,EAAE,KAAK;AAAA,EAC1D,aAAa;AAAA,EACb,QAAQ;AACZ,CAAC,GAMYE,IAAaF,EACrB,MAAM;AAAA;AAAA,EAEHD;AAAA,EACAE;AACJ,CAAC,EACA,KAAK;AAAA,EACF,aACI;AAAA;AAAA;AAER,CAAC;AAUE,SAASE,EAIdC,GAAgB;AACd,SAAO,CAACC,MACG,IAAI,IAAIA,EAAE,IAAI,CAACC,MAAMA,EAAEF,CAAG,CAAC,CAAC,EAAE,SAASC,EAAE;AAExD;AAKO,MAAME,IAAkBP,EAC1B,IAAA,EACA,IAAI,CAAC,EACL,KAAK,EAAE,aAAa,0BAAA,CAA2B;"}
|
package/dist/v0.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
// Auto-generated barrel export
|
|
1
|
+
// Auto-generated barrel export. DO NOT EDIT.
|
|
2
2
|
export * from "./v0/index";
|
package/dist/v0.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { ImageURLSchema as m, positiveInteger as
|
|
1
|
+
import { FileSchema as i, ImageURLSchema as m, Uint8ArraySchema as r, positiveInteger as t, unique as c } from "./v0/utils.js";
|
|
2
2
|
export {
|
|
3
|
+
i as FileSchema,
|
|
3
4
|
m as ImageURLSchema,
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
r as Uint8ArraySchema,
|
|
6
|
+
t as positiveInteger,
|
|
7
|
+
c as unique
|
|
6
8
|
};
|
|
7
9
|
//# sourceMappingURL=v0.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arisutalk/character-spec",
|
|
3
3
|
"description": "Character specification, schema & migration for ArisuTalk",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.5",
|
|
5
5
|
"contributors": [
|
|
6
6
|
{
|
|
7
7
|
"name": "concertypin",
|
|
@@ -24,10 +24,12 @@
|
|
|
24
24
|
"type": "module",
|
|
25
25
|
"scripts": {
|
|
26
26
|
"build": "vite build && pnpm generate-types",
|
|
27
|
-
"generate-types": "tsx scripts/generate-types.ts",
|
|
27
|
+
"generate-types": "tsx --tsconfig ./tsconfig.base.json scripts/generate-types.ts",
|
|
28
28
|
"prepare": "pnpm exec simple-git-hooks",
|
|
29
29
|
"format": "biome format --write .",
|
|
30
|
-
"lint": "biome check ."
|
|
30
|
+
"lint": "biome check .",
|
|
31
|
+
"test": "pnpm test:types && vitest run",
|
|
32
|
+
"test:types": "tsc -p tsconfig.typetest.json --noEmit"
|
|
31
33
|
},
|
|
32
34
|
"peerDependencies": {
|
|
33
35
|
"zod": "^4.1.13"
|
|
@@ -36,10 +38,12 @@
|
|
|
36
38
|
"@biomejs/biome": "^2.3.5",
|
|
37
39
|
"lint-staged": "^16.2.6",
|
|
38
40
|
"simple-git-hooks": "^2.13.1",
|
|
41
|
+
"tinyglobby": "^0.2.15",
|
|
39
42
|
"tsx": "^4.19.2",
|
|
40
43
|
"typescript": "~5.9.3",
|
|
41
44
|
"vite": "^6.4.1",
|
|
42
45
|
"vite-tsconfig-paths": "^5.1.4",
|
|
46
|
+
"vitest": "^4.0.16",
|
|
43
47
|
"zod": "^4.1.13",
|
|
44
48
|
"zod-to-ts": "^2.0.0"
|
|
45
49
|
},
|
|
@@ -54,4 +58,4 @@
|
|
|
54
58
|
}
|
|
55
59
|
},
|
|
56
60
|
"packageManager": "pnpm@10.16.1+sha512.0e155aa2629db8672b49e8475da6226aa4bdea85fdcdfdc15350874946d4f3c91faaf64cbdc4a5d1ab8002f473d5c3fcedcd197989cf0390f9badd3c04678706"
|
|
57
|
-
}
|
|
61
|
+
}
|