@arisutalk/character-spec 0.0.0 → 0.0.2
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/LICENSE +202 -202
- package/README.md +154 -64
- package/dist/index.d.ts +15 -166
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/v0/Character/Assets.d.ts +37 -0
- package/dist/v0/Character/Assets.js +21 -0
- package/dist/v0/Character/Assets.js.map +1 -0
- package/dist/v0/Character/Character.d.ts +263 -0
- package/dist/v0/Character/Character.js +46 -0
- package/dist/v0/Character/Character.js.map +1 -0
- package/dist/v0/Character/Chat.d.ts +73 -0
- package/dist/v0/Character/Chat.js +19 -0
- package/dist/v0/Character/Chat.js.map +1 -0
- package/dist/v0/Character/Lorebook.d.ts +98 -0
- package/dist/v0/Character/Lorebook.js +68 -0
- package/dist/v0/Character/Lorebook.js.map +1 -0
- package/dist/v0/Character/Message.d.ts +32 -0
- package/dist/v0/Character/Message.js +34 -0
- package/dist/v0/Character/Message.js.map +1 -0
- package/dist/v0/Character/Meta.js +22 -0
- package/dist/v0/Character/Meta.js.map +1 -0
- package/dist/v0/Character/index.d.ts +6 -0
- package/dist/v0/Character.d.ts +6 -0
- package/dist/v0/Character.js +19 -0
- package/dist/v0/Character.js.map +1 -0
- package/dist/v0/Executables/Executable.d.ts +120 -0
- package/dist/v0/Executables/Executable.js +21 -0
- package/dist/v0/Executables/Executable.js.map +1 -0
- package/dist/v0/Executables/ReplaceHook.d.ts +161 -0
- package/dist/v0/Executables/ReplaceHook.js +57 -0
- package/dist/v0/Executables/ReplaceHook.js.map +1 -0
- package/dist/v0/Executables/index.d.ts +3 -0
- package/dist/v0/Executables.d.ts +3 -0
- package/dist/v0/Executables.js +9 -0
- package/dist/v0/Executables.js.map +1 -0
- package/dist/v0/index.d.ts +2 -0
- package/dist/v0/utils.d.ts +11 -0
- package/dist/v0/utils.js +14 -0
- package/dist/v0/utils.js.map +1 -0
- package/dist/v0.d.ts +2 -507
- package/dist/v0.js +4 -96
- package/dist/v0.js.map +1 -1
- package/package.json +13 -11
- package/dist/Character-Didq99iq.js +0 -157
- package/dist/Character-Didq99iq.js.map +0 -1
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
// Auto-generated TypeScript types from Zod schemas
|
|
2
|
+
// JSDoc comments are extracted from schema .meta({ description }) values
|
|
3
|
+
import type { z } from "zod";
|
|
4
|
+
|
|
5
|
+
export type ReplaceHook = {
|
|
6
|
+
/** Replace hooks for display. Doesn't edit the data, only changes the display. */
|
|
7
|
+
display: {
|
|
8
|
+
/** The input pattern. May contain additional javascript expression if `isInputPatternScripted` is true. */
|
|
9
|
+
input: string;
|
|
10
|
+
/** The meta data for the replace hook. */
|
|
11
|
+
meta: ({
|
|
12
|
+
/** The input pattern is a RegExp. */
|
|
13
|
+
type: "regex";
|
|
14
|
+
/** The flag for RegExp. */
|
|
15
|
+
flag: string;
|
|
16
|
+
} | {
|
|
17
|
+
/** The input pattern is a simple string. */
|
|
18
|
+
type: "string";
|
|
19
|
+
/** If true, the input pattern is case sensitive. */
|
|
20
|
+
caseSensitive: boolean;
|
|
21
|
+
}) & {
|
|
22
|
+
/** If true, input pattern might contain additional javascript expression. Resolved before matching. */
|
|
23
|
+
isInputPatternScripted: boolean;
|
|
24
|
+
/** If true, output might contain additional javascript expression. Resolved after matching. */
|
|
25
|
+
isOutputScripted: boolean;
|
|
26
|
+
/** The priority of the replace hook. Higher number means higher priority. Can be positive, negative, or fractional. */
|
|
27
|
+
priority: number;
|
|
28
|
+
};
|
|
29
|
+
/** The output. May contain additional javascript expression if `isOutputScripted` is true. */
|
|
30
|
+
output: string;
|
|
31
|
+
}[];
|
|
32
|
+
/** Replace hooks for input. User chat input will be edited by this. */
|
|
33
|
+
input: {
|
|
34
|
+
/** The input pattern. May contain additional javascript expression if `isInputPatternScripted` is true. */
|
|
35
|
+
input: string;
|
|
36
|
+
/** The meta data for the replace hook. */
|
|
37
|
+
meta: ({
|
|
38
|
+
/** The input pattern is a RegExp. */
|
|
39
|
+
type: "regex";
|
|
40
|
+
/** The flag for RegExp. */
|
|
41
|
+
flag: string;
|
|
42
|
+
} | {
|
|
43
|
+
/** The input pattern is a simple string. */
|
|
44
|
+
type: "string";
|
|
45
|
+
/** If true, the input pattern is case sensitive. */
|
|
46
|
+
caseSensitive: boolean;
|
|
47
|
+
}) & {
|
|
48
|
+
/** If true, input pattern might contain additional javascript expression. Resolved before matching. */
|
|
49
|
+
isInputPatternScripted: boolean;
|
|
50
|
+
/** If true, output might contain additional javascript expression. Resolved after matching. */
|
|
51
|
+
isOutputScripted: boolean;
|
|
52
|
+
/** The priority of the replace hook. Higher number means higher priority. Can be positive, negative, or fractional. */
|
|
53
|
+
priority: number;
|
|
54
|
+
};
|
|
55
|
+
/** The output. May contain additional javascript expression if `isOutputScripted` is true. */
|
|
56
|
+
output: string;
|
|
57
|
+
}[];
|
|
58
|
+
/** Replace hooks for output. Character response will be edited by this. */
|
|
59
|
+
output: {
|
|
60
|
+
/** The input pattern. May contain additional javascript expression if `isInputPatternScripted` is true. */
|
|
61
|
+
input: string;
|
|
62
|
+
/** The meta data for the replace hook. */
|
|
63
|
+
meta: ({
|
|
64
|
+
/** The input pattern is a RegExp. */
|
|
65
|
+
type: "regex";
|
|
66
|
+
/** The flag for RegExp. */
|
|
67
|
+
flag: string;
|
|
68
|
+
} | {
|
|
69
|
+
/** The input pattern is a simple string. */
|
|
70
|
+
type: "string";
|
|
71
|
+
/** If true, the input pattern is case sensitive. */
|
|
72
|
+
caseSensitive: boolean;
|
|
73
|
+
}) & {
|
|
74
|
+
/** If true, input pattern might contain additional javascript expression. Resolved before matching. */
|
|
75
|
+
isInputPatternScripted: boolean;
|
|
76
|
+
/** If true, output might contain additional javascript expression. Resolved after matching. */
|
|
77
|
+
isOutputScripted: boolean;
|
|
78
|
+
/** The priority of the replace hook. Higher number means higher priority. Can be positive, negative, or fractional. */
|
|
79
|
+
priority: number;
|
|
80
|
+
};
|
|
81
|
+
/** The output. May contain additional javascript expression if `isOutputScripted` is true. */
|
|
82
|
+
output: string;
|
|
83
|
+
}[];
|
|
84
|
+
/** Replace hooks for request. AI request will be edited by this. Differs from `input` in that it's for AI request. Does not edit the data, only changes the fetching request. */
|
|
85
|
+
request: {
|
|
86
|
+
/** The input pattern. May contain additional javascript expression if `isInputPatternScripted` is true. */
|
|
87
|
+
input: string;
|
|
88
|
+
/** The meta data for the replace hook. */
|
|
89
|
+
meta: ({
|
|
90
|
+
/** The input pattern is a RegExp. */
|
|
91
|
+
type: "regex";
|
|
92
|
+
/** The flag for RegExp. */
|
|
93
|
+
flag: string;
|
|
94
|
+
} | {
|
|
95
|
+
/** The input pattern is a simple string. */
|
|
96
|
+
type: "string";
|
|
97
|
+
/** If true, the input pattern is case sensitive. */
|
|
98
|
+
caseSensitive: boolean;
|
|
99
|
+
}) & {
|
|
100
|
+
/** If true, input pattern might contain additional javascript expression. Resolved before matching. */
|
|
101
|
+
isInputPatternScripted: boolean;
|
|
102
|
+
/** If true, output might contain additional javascript expression. Resolved after matching. */
|
|
103
|
+
isOutputScripted: boolean;
|
|
104
|
+
/** The priority of the replace hook. Higher number means higher priority. Can be positive, negative, or fractional. */
|
|
105
|
+
priority: number;
|
|
106
|
+
};
|
|
107
|
+
/** The output. May contain additional javascript expression if `isOutputScripted` is true. */
|
|
108
|
+
output: string;
|
|
109
|
+
}[];
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export declare const ReplaceHookSchema: z.ZodType<ReplaceHook>;
|
|
113
|
+
|
|
114
|
+
export type ReplaceHookEntity = {
|
|
115
|
+
/** The input pattern. May contain additional javascript expression if `isInputPatternScripted` is true. */
|
|
116
|
+
input: string;
|
|
117
|
+
/** The meta data for the replace hook. */
|
|
118
|
+
meta: ({
|
|
119
|
+
/** The input pattern is a RegExp. */
|
|
120
|
+
type: "regex";
|
|
121
|
+
/** The flag for RegExp. */
|
|
122
|
+
flag: string;
|
|
123
|
+
} | {
|
|
124
|
+
/** The input pattern is a simple string. */
|
|
125
|
+
type: "string";
|
|
126
|
+
/** If true, the input pattern is case sensitive. */
|
|
127
|
+
caseSensitive: boolean;
|
|
128
|
+
}) & {
|
|
129
|
+
/** If true, input pattern might contain additional javascript expression. Resolved before matching. */
|
|
130
|
+
isInputPatternScripted: boolean;
|
|
131
|
+
/** If true, output might contain additional javascript expression. Resolved after matching. */
|
|
132
|
+
isOutputScripted: boolean;
|
|
133
|
+
/** The priority of the replace hook. Higher number means higher priority. Can be positive, negative, or fractional. */
|
|
134
|
+
priority: number;
|
|
135
|
+
};
|
|
136
|
+
/** The output. May contain additional javascript expression if `isOutputScripted` is true. */
|
|
137
|
+
output: string;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export declare const ReplaceHookEntitySchema: z.ZodType<ReplaceHookEntity>;
|
|
141
|
+
|
|
142
|
+
export type ReplaceHookMeta = ({
|
|
143
|
+
/** The input pattern is a RegExp. */
|
|
144
|
+
type: "regex";
|
|
145
|
+
/** The flag for RegExp. */
|
|
146
|
+
flag: string;
|
|
147
|
+
} | {
|
|
148
|
+
/** The input pattern is a simple string. */
|
|
149
|
+
type: "string";
|
|
150
|
+
/** If true, the input pattern is case sensitive. */
|
|
151
|
+
caseSensitive: boolean;
|
|
152
|
+
}) & {
|
|
153
|
+
/** If true, input pattern might contain additional javascript expression. Resolved before matching. */
|
|
154
|
+
isInputPatternScripted: boolean;
|
|
155
|
+
/** If true, output might contain additional javascript expression. Resolved after matching. */
|
|
156
|
+
isOutputScripted: boolean;
|
|
157
|
+
/** The priority of the replace hook. Higher number means higher priority. Can be positive, negative, or fractional. */
|
|
158
|
+
priority: number;
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
export declare const ReplaceHookMetaSchema: z.ZodType<ReplaceHookMeta>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { z as e } from "zod";
|
|
2
|
+
const i = [
|
|
3
|
+
e.object({
|
|
4
|
+
type: e.literal("regex").meta({ description: "The input pattern is a RegExp." }),
|
|
5
|
+
flag: e.string().meta({ description: "The flag for RegExp." })
|
|
6
|
+
}).meta({ description: "Regex pattern type." }),
|
|
7
|
+
e.object({
|
|
8
|
+
type: e.literal("string").meta({ description: "The input pattern is a simple string." }),
|
|
9
|
+
caseSensitive: e.boolean().default(!0).meta({
|
|
10
|
+
description: "If true, the input pattern is case sensitive."
|
|
11
|
+
})
|
|
12
|
+
}).meta({ description: "String pattern type." })
|
|
13
|
+
], a = e.intersection(
|
|
14
|
+
e.discriminatedUnion("type", i),
|
|
15
|
+
e.object({
|
|
16
|
+
isInputPatternScripted: e.boolean().default(!1).meta({
|
|
17
|
+
description: "If true, input pattern might contain additional javascript expression. Resolved before matching."
|
|
18
|
+
}),
|
|
19
|
+
isOutputScripted: e.boolean().default(!1).meta({
|
|
20
|
+
description: "If true, output might contain additional javascript expression. Resolved after matching."
|
|
21
|
+
}),
|
|
22
|
+
priority: e.number().default(0).meta({
|
|
23
|
+
description: "The priority of the replace hook. Higher number means higher priority. Can be positive, negative, or fractional."
|
|
24
|
+
})
|
|
25
|
+
})
|
|
26
|
+
), t = e.object({
|
|
27
|
+
input: e.string().meta({
|
|
28
|
+
description: "The input pattern. May contain additional javascript expression if `isInputPatternScripted` is true."
|
|
29
|
+
}),
|
|
30
|
+
meta: a.meta({
|
|
31
|
+
description: "The meta data for the replace hook."
|
|
32
|
+
}),
|
|
33
|
+
output: e.string().meta({
|
|
34
|
+
description: "The output. May contain additional javascript expression if `isOutputScripted` is true."
|
|
35
|
+
})
|
|
36
|
+
}), o = e.object({
|
|
37
|
+
display: e.array(t).meta({
|
|
38
|
+
description: "Replace hooks for display. Doesn't edit the data, only changes the display."
|
|
39
|
+
}),
|
|
40
|
+
input: e.array(t).meta({
|
|
41
|
+
description: "Replace hooks for input. User chat input will be edited by this."
|
|
42
|
+
}),
|
|
43
|
+
output: e.array(t).meta({
|
|
44
|
+
description: "Replace hooks for output. Character response will be edited by this."
|
|
45
|
+
}),
|
|
46
|
+
request: e.array(t).meta({
|
|
47
|
+
description: "Replace hooks for request. AI request will be edited by this. Differs from `input` in that it's for AI request. Does not edit the data, only changes the fetching request."
|
|
48
|
+
})
|
|
49
|
+
}).meta({
|
|
50
|
+
description: "Replace hooks. RegExp for request, display, and response."
|
|
51
|
+
});
|
|
52
|
+
export {
|
|
53
|
+
t as ReplaceHookEntitySchema,
|
|
54
|
+
a as ReplaceHookMetaSchema,
|
|
55
|
+
o as ReplaceHookSchema
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=ReplaceHook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReplaceHook.js","sources":["../../../src/types/v0/Executables/ReplaceHook.ts"],"sourcesContent":["import { z } from \"zod\";\n\nconst ReplaceHookMetaType = [\n z\n .object({\n type: z\n .literal(\"regex\")\n .meta({ description: \"The input pattern is a RegExp.\" }),\n flag: z.string().meta({ description: \"The flag for RegExp.\" }),\n })\n .meta({ description: \"Regex pattern type.\" }),\n z\n .object({\n type: z\n .literal(\"string\")\n .meta({ description: \"The input pattern is a simple string.\" }),\n caseSensitive: z.boolean().default(true).meta({\n description: \"If true, the input pattern is case sensitive.\",\n }),\n })\n .meta({ description: \"String pattern type.\" }),\n] as const;\n\nexport const ReplaceHookMetaSchema = z.intersection(\n z.discriminatedUnion(\"type\", ReplaceHookMetaType),\n z.object({\n isInputPatternScripted: z.boolean().default(false).meta({\n description:\n \"If true, input pattern might contain additional javascript expression. Resolved before matching.\",\n }),\n isOutputScripted: z.boolean().default(false).meta({\n description:\n \"If true, output might contain additional javascript expression. Resolved after matching.\",\n }),\n priority: z.number().default(0).meta({\n description:\n \"The priority of the replace hook. Higher number means higher priority. Can be positive, negative, or fractional.\",\n }),\n }),\n);\n\nexport const ReplaceHookEntitySchema = z.object({\n input: z.string().meta({\n description:\n \"The input pattern. May contain additional javascript expression if `isInputPatternScripted` is true.\",\n }),\n meta: ReplaceHookMetaSchema.meta({\n description: \"The meta data for the replace hook.\",\n }),\n output: z.string().meta({\n description:\n \"The output. May contain additional javascript expression if `isOutputScripted` is true.\",\n }),\n});\n\n/**\n * Replace hooks. It's technically RegExp for request, display, and response.\n */\nexport const ReplaceHookSchema = z\n .object({\n display: z.array(ReplaceHookEntitySchema).meta({\n description:\n \"Replace hooks for display. Doesn't edit the data, only changes the display.\",\n }),\n input: z.array(ReplaceHookEntitySchema).meta({\n description:\n \"Replace hooks for input. User chat input will be edited by this.\",\n }),\n output: z.array(ReplaceHookEntitySchema).meta({\n description:\n \"Replace hooks for output. Character response will be edited by this.\",\n }),\n request: z.array(ReplaceHookEntitySchema).meta({\n description:\n \"Replace hooks for request. AI request will be edited by this. Differs from `input` in that it's for AI request. Does not edit the data, only changes the fetching request.\",\n }),\n })\n .meta({\n description:\n \"Replace hooks. RegExp for request, display, and response.\",\n });\n"],"names":["ReplaceHookMetaType","z","ReplaceHookMetaSchema","ReplaceHookEntitySchema","ReplaceHookSchema"],"mappings":";AAEA,MAAMA,IAAsB;AAAA,EACxBC,EACK,OAAO;AAAA,IACJ,MAAMA,EACD,QAAQ,OAAO,EACf,KAAK,EAAE,aAAa,kCAAkC;AAAA,IAC3D,MAAMA,EAAE,OAAA,EAAS,KAAK,EAAE,aAAa,wBAAwB;AAAA,EAAA,CAChE,EACA,KAAK,EAAE,aAAa,uBAAuB;AAAA,EAChDA,EACK,OAAO;AAAA,IACJ,MAAMA,EACD,QAAQ,QAAQ,EAChB,KAAK,EAAE,aAAa,yCAAyC;AAAA,IAClE,eAAeA,EAAE,QAAA,EAAU,QAAQ,EAAI,EAAE,KAAK;AAAA,MAC1C,aAAa;AAAA,IAAA,CAChB;AAAA,EAAA,CACJ,EACA,KAAK,EAAE,aAAa,wBAAwB;AACrD,GAEaC,IAAwBD,EAAE;AAAA,EACnCA,EAAE,mBAAmB,QAAQD,CAAmB;AAAA,EAChDC,EAAE,OAAO;AAAA,IACL,wBAAwBA,EAAE,QAAA,EAAU,QAAQ,EAAK,EAAE,KAAK;AAAA,MACpD,aACI;AAAA,IAAA,CACP;AAAA,IACD,kBAAkBA,EAAE,QAAA,EAAU,QAAQ,EAAK,EAAE,KAAK;AAAA,MAC9C,aACI;AAAA,IAAA,CACP;AAAA,IACD,UAAUA,EAAE,OAAA,EAAS,QAAQ,CAAC,EAAE,KAAK;AAAA,MACjC,aACI;AAAA,IAAA,CACP;AAAA,EAAA,CACJ;AACL,GAEaE,IAA0BF,EAAE,OAAO;AAAA,EAC5C,OAAOA,EAAE,OAAA,EAAS,KAAK;AAAA,IACnB,aACI;AAAA,EAAA,CACP;AAAA,EACD,MAAMC,EAAsB,KAAK;AAAA,IAC7B,aAAa;AAAA,EAAA,CAChB;AAAA,EACD,QAAQD,EAAE,OAAA,EAAS,KAAK;AAAA,IACpB,aACI;AAAA,EAAA,CACP;AACL,CAAC,GAKYG,IAAoBH,EAC5B,OAAO;AAAA,EACJ,SAASA,EAAE,MAAME,CAAuB,EAAE,KAAK;AAAA,IAC3C,aACI;AAAA,EAAA,CACP;AAAA,EACD,OAAOF,EAAE,MAAME,CAAuB,EAAE,KAAK;AAAA,IACzC,aACI;AAAA,EAAA,CACP;AAAA,EACD,QAAQF,EAAE,MAAME,CAAuB,EAAE,KAAK;AAAA,IAC1C,aACI;AAAA,EAAA,CACP;AAAA,EACD,SAASF,EAAE,MAAME,CAAuB,EAAE,KAAK;AAAA,IAC3C,aACI;AAAA,EAAA,CACP;AACL,CAAC,EACA,KAAK;AAAA,EACF,aACI;AACR,CAAC;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ScriptSettingSchema as a } from "./Executables/Executable.js";
|
|
2
|
+
import { ReplaceHookEntitySchema as t, ReplaceHookMetaSchema as m, ReplaceHookSchema as p } from "./Executables/ReplaceHook.js";
|
|
3
|
+
export {
|
|
4
|
+
t as ReplaceHookEntitySchema,
|
|
5
|
+
m as ReplaceHookMetaSchema,
|
|
6
|
+
p as ReplaceHookSchema,
|
|
7
|
+
a as ScriptSettingSchema
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=Executables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Executables.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Auto-generated TypeScript types from Zod schemas
|
|
2
|
+
// JSDoc comments are extracted from schema .meta({ description }) values
|
|
3
|
+
import type { z } from "zod";
|
|
4
|
+
|
|
5
|
+
export type ImageURL = string;
|
|
6
|
+
|
|
7
|
+
export declare const ImageURLSchema: z.ZodType<ImageURL>;
|
|
8
|
+
|
|
9
|
+
export type PositiveInteger = number;
|
|
10
|
+
|
|
11
|
+
export declare const positiveInteger: z.ZodType<PositiveInteger>;
|
package/dist/v0/utils.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z as t } from "zod";
|
|
2
|
+
const i = t.url().meta({
|
|
3
|
+
description: "URL of an image. `data:` for base64 (export only), `local:` for browser storage (OpFS), otherwise a fetchable URL."
|
|
4
|
+
});
|
|
5
|
+
function a(r) {
|
|
6
|
+
return (e) => new Set(e.map((o) => o[r])).size === e.length;
|
|
7
|
+
}
|
|
8
|
+
const s = t.number().int().min(1).meta({ description: "Positive integer (>= 1)" });
|
|
9
|
+
export {
|
|
10
|
+
i as ImageURLSchema,
|
|
11
|
+
s as positiveInteger,
|
|
12
|
+
a as unique
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +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 * If its protocol is `data:`, it means the image is base64 encoded.\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 */\nexport const ImageURLSchema = z.url().meta({\n description:\n \"URL of an image. `data:` for base64 (export only), `local:` for browser storage (OpFS), otherwise a fetchable URL.\",\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 .number()\n .int()\n .min(1)\n .meta({ description: \"Positive integer (>= 1)\" });\n"],"names":["ImageURLSchema","z","unique","key","i","j","positiveInteger"],"mappings":";AAUO,MAAMA,IAAiBC,EAAE,IAAA,EAAM,KAAK;AAAA,EACvC,aACI;AACR,CAAC;AAWM,SAASC,EAIdC,GAAgB;AACd,SAAO,CAACC,MACG,IAAI,IAAIA,EAAE,IAAI,CAACC,MAAMA,EAAEF,CAAG,CAAC,CAAC,EAAE,SAASC,EAAE;AAExD;AAKO,MAAME,IAAkBL,EAC1B,OAAA,EACA,IAAA,EACA,IAAI,CAAC,EACL,KAAK,EAAE,aAAa,2BAA2B;"}
|