@fxhash/params 0.0.11 → 0.0.13
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 +214 -213
- package/dist/index.js +78 -83
- package/dist/index.js.map +1 -1
- package/dist/utils-BXUz-G9x.js +387 -0
- package/dist/{chunk-B3N473DY.js.map → utils-BXUz-G9x.js.map} +1 -1
- package/dist/utils-Bd4LPrAy.d.ts +136 -0
- package/dist/utils.d.ts +2 -1
- package/dist/utils.js +3 -3
- package/package.json +7 -10
- package/dist/chunk-B3N473DY.js +0 -412
- package/dist/utils-jEvPb5wq.d.ts +0 -141
- package/dist/utils.js.map +0 -1
package/dist/index.d.ts
CHANGED
@@ -1,249 +1,250 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
import { z, SafeParseError, SafeParseSuccess } from 'zod';
|
1
|
+
import { FxParamDefinition, FxParamDefinitions, FxParamOptionsMap, FxParamProcessor, FxParamProcessorConstrainer, FxParamProcessorTransformer, FxParamProcessors, FxParamTranformType, FxParamTransformation, FxParamTransformationTypeMap, FxParamType, FxParamTypeMap, FxParamUpdateMode, FxParamValue, FxParamsData, FxParamsRaw, FxParamsTransformed, MAX_SAFE_INT64$1 as MAX_SAFE_INT64, MIN_SAFE_INT64$1 as MIN_SAFE_INT64, ParameterProcessors$1 as ParameterProcessors, buildParamsObject$1 as buildParamsObject, consolidateParams$1 as consolidateParams, deserializeParams$1 as deserializeParams, getRandomParamValues$1 as getRandomParamValues, hexString, hexToRgba$1 as hexToRgba, jsonStringifyBigint$1 as jsonStringifyBigint, processParam$1 as processParam, processParams$1 as processParams, rgbaToHex$1 as rgbaToHex, serializeParams$1 as serializeParams, serializeParamsOrNull$1 as serializeParamsOrNull, stringifyParamsData$1 as stringifyParamsData, sumBytesParams$1 as sumBytesParams } from "./utils-Bd4LPrAy.js";
|
2
|
+
import { SafeParseError, SafeParseSuccess, z } from "zod";
|
4
3
|
|
4
|
+
//#region src/validation.d.ts
|
5
5
|
declare const BaseControllerDefinitionSchema: z.ZodObject<{
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
id: z.ZodString;
|
7
|
+
name: z.ZodOptional<z.ZodString>;
|
8
|
+
exposedAsFeature: z.ZodOptional<z.ZodBoolean>;
|
9
9
|
}, "strip", z.ZodTypeAny, {
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
id: string;
|
11
|
+
name?: string | undefined;
|
12
|
+
exposedAsFeature?: boolean | undefined;
|
13
13
|
}, {
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
id: string;
|
15
|
+
name?: string | undefined;
|
16
|
+
exposedAsFeature?: boolean | undefined;
|
17
17
|
}>;
|
18
18
|
declare const ControllerDefinitionSchema: z.ZodUnion<[z.ZodObject<{
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
id: z.ZodString;
|
20
|
+
name: z.ZodOptional<z.ZodString>;
|
21
|
+
exposedAsFeature: z.ZodOptional<z.ZodBoolean>;
|
22
22
|
} & {
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
23
|
+
type: z.ZodLiteral<"string">;
|
24
|
+
options: z.ZodOptional<z.ZodObject<{
|
25
|
+
minLength: z.ZodOptional<z.ZodNumber>;
|
26
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
27
|
+
}, "strip", z.ZodTypeAny, {
|
28
|
+
minLength?: number | undefined;
|
29
|
+
maxLength?: number | undefined;
|
30
|
+
}, {
|
31
|
+
minLength?: number | undefined;
|
32
|
+
maxLength?: number | undefined;
|
33
|
+
}>>;
|
34
|
+
default: z.ZodOptional<z.ZodString>;
|
35
35
|
}, "strip", z.ZodTypeAny, {
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
36
|
+
id: string;
|
37
|
+
type: "string";
|
38
|
+
name?: string | undefined;
|
39
|
+
exposedAsFeature?: boolean | undefined;
|
40
|
+
options?: {
|
41
|
+
minLength?: number | undefined;
|
42
|
+
maxLength?: number | undefined;
|
43
|
+
} | undefined;
|
44
|
+
default?: string | undefined;
|
45
45
|
}, {
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
46
|
+
id: string;
|
47
|
+
type: "string";
|
48
|
+
name?: string | undefined;
|
49
|
+
exposedAsFeature?: boolean | undefined;
|
50
|
+
options?: {
|
51
|
+
minLength?: number | undefined;
|
52
|
+
maxLength?: number | undefined;
|
53
|
+
} | undefined;
|
54
|
+
default?: string | undefined;
|
55
55
|
}>, z.ZodObject<{
|
56
|
-
|
57
|
-
|
58
|
-
|
56
|
+
id: z.ZodString;
|
57
|
+
name: z.ZodOptional<z.ZodString>;
|
58
|
+
exposedAsFeature: z.ZodOptional<z.ZodBoolean>;
|
59
59
|
} & {
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
60
|
+
type: z.ZodLiteral<"number">;
|
61
|
+
options: z.ZodOptional<z.ZodObject<{
|
62
|
+
min: z.ZodOptional<z.ZodNumber>;
|
63
|
+
max: z.ZodOptional<z.ZodNumber>;
|
64
|
+
step: z.ZodOptional<z.ZodNumber>;
|
65
|
+
}, "strip", z.ZodTypeAny, {
|
66
|
+
min?: number | undefined;
|
67
|
+
max?: number | undefined;
|
68
|
+
step?: number | undefined;
|
69
|
+
}, {
|
70
|
+
min?: number | undefined;
|
71
|
+
max?: number | undefined;
|
72
|
+
step?: number | undefined;
|
73
|
+
}>>;
|
74
|
+
default: z.ZodOptional<z.ZodNumber>;
|
75
75
|
}, "strip", z.ZodTypeAny, {
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
76
|
+
id: string;
|
77
|
+
type: "number";
|
78
|
+
name?: string | undefined;
|
79
|
+
exposedAsFeature?: boolean | undefined;
|
80
|
+
options?: {
|
81
|
+
min?: number | undefined;
|
82
|
+
max?: number | undefined;
|
83
|
+
step?: number | undefined;
|
84
|
+
} | undefined;
|
85
|
+
default?: number | undefined;
|
86
86
|
}, {
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
87
|
+
id: string;
|
88
|
+
type: "number";
|
89
|
+
name?: string | undefined;
|
90
|
+
exposedAsFeature?: boolean | undefined;
|
91
|
+
options?: {
|
92
|
+
min?: number | undefined;
|
93
|
+
max?: number | undefined;
|
94
|
+
step?: number | undefined;
|
95
|
+
} | undefined;
|
96
|
+
default?: number | undefined;
|
97
97
|
}>, z.ZodObject<{
|
98
|
-
|
99
|
-
|
100
|
-
|
98
|
+
id: z.ZodString;
|
99
|
+
name: z.ZodOptional<z.ZodString>;
|
100
|
+
exposedAsFeature: z.ZodOptional<z.ZodBoolean>;
|
101
101
|
} & {
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
102
|
+
type: z.ZodLiteral<"bigint">;
|
103
|
+
options: z.ZodOptional<z.ZodObject<{
|
104
|
+
min: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodBigInt]>>;
|
105
|
+
max: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodBigInt]>>;
|
106
|
+
}, "strip", z.ZodTypeAny, {
|
107
|
+
min?: number | bigint | undefined;
|
108
|
+
max?: number | bigint | undefined;
|
109
|
+
}, {
|
110
|
+
min?: number | bigint | undefined;
|
111
|
+
max?: number | bigint | undefined;
|
112
|
+
}>>;
|
113
|
+
default: z.ZodOptional<z.ZodBigInt>;
|
114
114
|
}, "strip", z.ZodTypeAny, {
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
115
|
+
id: string;
|
116
|
+
type: "bigint";
|
117
|
+
name?: string | undefined;
|
118
|
+
exposedAsFeature?: boolean | undefined;
|
119
|
+
options?: {
|
120
|
+
min?: number | bigint | undefined;
|
121
|
+
max?: number | bigint | undefined;
|
122
|
+
} | undefined;
|
123
|
+
default?: bigint | undefined;
|
124
124
|
}, {
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
125
|
+
id: string;
|
126
|
+
type: "bigint";
|
127
|
+
name?: string | undefined;
|
128
|
+
exposedAsFeature?: boolean | undefined;
|
129
|
+
options?: {
|
130
|
+
min?: number | bigint | undefined;
|
131
|
+
max?: number | bigint | undefined;
|
132
|
+
} | undefined;
|
133
|
+
default?: bigint | undefined;
|
134
134
|
}>, z.ZodObject<{
|
135
|
-
|
136
|
-
|
137
|
-
|
135
|
+
id: z.ZodString;
|
136
|
+
name: z.ZodOptional<z.ZodString>;
|
137
|
+
exposedAsFeature: z.ZodOptional<z.ZodBoolean>;
|
138
138
|
} & {
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
139
|
+
type: z.ZodLiteral<"select">;
|
140
|
+
options: z.ZodObject<{
|
141
|
+
options: z.ZodArray<z.ZodString, "atleastone">;
|
142
|
+
}, "strip", z.ZodTypeAny, {
|
143
|
+
options: [string, ...string[]];
|
144
|
+
}, {
|
145
|
+
options: [string, ...string[]];
|
146
|
+
}>;
|
147
|
+
default: z.ZodOptional<z.ZodString>;
|
148
148
|
}, "strip", z.ZodTypeAny, {
|
149
|
-
|
150
|
-
|
151
|
-
options:
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
149
|
+
id: string;
|
150
|
+
options: {
|
151
|
+
options: [string, ...string[]];
|
152
|
+
};
|
153
|
+
type: "select";
|
154
|
+
name?: string | undefined;
|
155
|
+
exposedAsFeature?: boolean | undefined;
|
156
|
+
default?: string | undefined;
|
157
157
|
}, {
|
158
|
-
|
159
|
-
|
160
|
-
options:
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
158
|
+
id: string;
|
159
|
+
options: {
|
160
|
+
options: [string, ...string[]];
|
161
|
+
};
|
162
|
+
type: "select";
|
163
|
+
name?: string | undefined;
|
164
|
+
exposedAsFeature?: boolean | undefined;
|
165
|
+
default?: string | undefined;
|
166
166
|
}>, z.ZodObject<{
|
167
|
-
|
168
|
-
|
169
|
-
|
167
|
+
id: z.ZodString;
|
168
|
+
name: z.ZodOptional<z.ZodString>;
|
169
|
+
exposedAsFeature: z.ZodOptional<z.ZodBoolean>;
|
170
170
|
} & {
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
171
|
+
type: z.ZodLiteral<"bytes">;
|
172
|
+
options: z.ZodObject<{
|
173
|
+
length: z.ZodNumber;
|
174
|
+
}, "strip", z.ZodTypeAny, {
|
175
|
+
length: number;
|
176
|
+
}, {
|
177
|
+
length: number;
|
178
|
+
}>;
|
179
|
+
default: z.ZodOptional<z.ZodAny>;
|
180
|
+
update: z.ZodLiteral<"code-driven">;
|
181
181
|
}, "strip", z.ZodTypeAny, {
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
182
|
+
id: string;
|
183
|
+
options: {
|
184
|
+
length: number;
|
185
|
+
};
|
186
|
+
type: "bytes";
|
187
|
+
update: "code-driven";
|
188
|
+
name?: string | undefined;
|
189
|
+
exposedAsFeature?: boolean | undefined;
|
190
|
+
default?: any;
|
191
191
|
}, {
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
192
|
+
id: string;
|
193
|
+
options: {
|
194
|
+
length: number;
|
195
|
+
};
|
196
|
+
type: "bytes";
|
197
|
+
update: "code-driven";
|
198
|
+
name?: string | undefined;
|
199
|
+
exposedAsFeature?: boolean | undefined;
|
200
|
+
default?: any;
|
201
201
|
}>, z.ZodObject<{
|
202
|
-
|
203
|
-
|
204
|
-
|
202
|
+
id: z.ZodString;
|
203
|
+
name: z.ZodOptional<z.ZodString>;
|
204
|
+
exposedAsFeature: z.ZodOptional<z.ZodBoolean>;
|
205
205
|
} & {
|
206
|
-
|
207
|
-
|
208
|
-
|
206
|
+
type: z.ZodLiteral<"boolean">;
|
207
|
+
options: z.ZodUndefined;
|
208
|
+
default: z.ZodOptional<z.ZodBoolean>;
|
209
209
|
}, "strip", z.ZodTypeAny, {
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
210
|
+
id: string;
|
211
|
+
type: "boolean";
|
212
|
+
name?: string | undefined;
|
213
|
+
exposedAsFeature?: boolean | undefined;
|
214
|
+
options?: undefined;
|
215
|
+
default?: boolean | undefined;
|
216
216
|
}, {
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
217
|
+
id: string;
|
218
|
+
type: "boolean";
|
219
|
+
name?: string | undefined;
|
220
|
+
exposedAsFeature?: boolean | undefined;
|
221
|
+
options?: undefined;
|
222
|
+
default?: boolean | undefined;
|
223
223
|
}>, z.ZodObject<{
|
224
|
-
|
225
|
-
|
226
|
-
|
224
|
+
id: z.ZodString;
|
225
|
+
name: z.ZodOptional<z.ZodString>;
|
226
|
+
exposedAsFeature: z.ZodOptional<z.ZodBoolean>;
|
227
227
|
} & {
|
228
|
-
|
229
|
-
|
230
|
-
|
228
|
+
type: z.ZodLiteral<"color">;
|
229
|
+
options: z.ZodUndefined;
|
230
|
+
default: z.ZodOptional<z.ZodString>;
|
231
231
|
}, "strip", z.ZodTypeAny, {
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
232
|
+
id: string;
|
233
|
+
type: "color";
|
234
|
+
name?: string | undefined;
|
235
|
+
exposedAsFeature?: boolean | undefined;
|
236
|
+
options?: undefined;
|
237
|
+
default?: string | undefined;
|
238
238
|
}, {
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
239
|
+
id: string;
|
240
|
+
type: "color";
|
241
|
+
name?: string | undefined;
|
242
|
+
exposedAsFeature?: boolean | undefined;
|
243
|
+
options?: undefined;
|
244
|
+
default?: string | undefined;
|
245
245
|
}>]>;
|
246
246
|
type ControllerDefinitionSchemaType = z.infer<typeof ControllerDefinitionSchema>;
|
247
247
|
declare function validateParameterDefinition(parameterDefinition: FxParamDefinition<FxParamType>): SafeParseError<ControllerDefinitionSchemaType> | SafeParseSuccess<ControllerDefinitionSchemaType> | undefined;
|
248
|
-
|
249
|
-
export { BaseControllerDefinitionSchema,
|
248
|
+
//#endregion
|
249
|
+
export { BaseControllerDefinitionSchema, ControllerDefinitionSchemaType, FxParamDefinition, FxParamDefinitions, FxParamOptionsMap, FxParamProcessor, FxParamProcessorConstrainer, FxParamProcessorTransformer, FxParamProcessors, FxParamTranformType, FxParamTransformation, FxParamTransformationTypeMap, FxParamType, FxParamTypeMap, FxParamUpdateMode, FxParamValue, FxParamsData, FxParamsRaw, FxParamsTransformed, MAX_SAFE_INT64, MIN_SAFE_INT64, ParameterProcessors, buildParamsObject, consolidateParams, deserializeParams, getRandomParamValues, hexString, hexToRgba, jsonStringifyBigint, processParam, processParams, rgbaToHex, serializeParams, serializeParamsOrNull, stringifyParamsData, sumBytesParams, validateParameterDefinition };
|
250
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
@@ -1,102 +1,97 @@
|
|
1
|
-
|
2
|
-
import { z } from
|
1
|
+
import { MAX_SAFE_INT64, MIN_SAFE_INT64, ParameterProcessors, buildParamsObject, consolidateParams, deserializeParams, getRandomParamValues, hexToRgba, jsonStringifyBigint, processParam, processParams, rgbaToHex, serializeParams, serializeParamsOrNull, stringifyParamsData, sumBytesParams } from "./utils-BXUz-G9x.js";
|
2
|
+
import { z } from "zod";
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
4
|
+
//#region src/validation.ts
|
5
|
+
const ControllerTypeSchema = z.enum([
|
6
|
+
"number",
|
7
|
+
"bigint",
|
8
|
+
"color",
|
9
|
+
"string",
|
10
|
+
"bytes",
|
11
|
+
"boolean",
|
12
|
+
"select"
|
12
13
|
]);
|
13
|
-
|
14
|
-
|
15
|
-
|
14
|
+
const FxParamOptions_bigintSchema = z.object({
|
15
|
+
min: z.number().or(z.bigint()).optional(),
|
16
|
+
max: z.number().or(z.bigint()).optional()
|
16
17
|
});
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
const FxParamOptions_numberSchema = z.object({
|
19
|
+
min: z.number().gte(Number.MIN_SAFE_INTEGER).optional(),
|
20
|
+
max: z.number().lte(Number.MAX_SAFE_INTEGER).optional(),
|
21
|
+
step: z.number().optional()
|
21
22
|
});
|
22
|
-
|
23
|
-
|
24
|
-
|
23
|
+
const FxParamOptions_stringSchema = z.object({
|
24
|
+
minLength: z.number().gte(0).optional(),
|
25
|
+
maxLength: z.number().optional()
|
25
26
|
});
|
26
|
-
|
27
|
-
|
27
|
+
const FxParamOptions_bytesSchema = z.object({ length: z.number().gt(0) });
|
28
|
+
const FxParamOptions_selectSchema = z.object({ options: z.string().array().nonempty() });
|
29
|
+
const BaseControllerDefinitionSchema = z.object({
|
30
|
+
id: z.string(),
|
31
|
+
name: z.string().optional(),
|
32
|
+
exposedAsFeature: z.boolean().optional()
|
28
33
|
});
|
29
|
-
|
30
|
-
|
34
|
+
const StringControllerSchema = BaseControllerDefinitionSchema.extend({
|
35
|
+
type: z.literal(ControllerTypeSchema.enum.string),
|
36
|
+
options: FxParamOptions_stringSchema.optional(),
|
37
|
+
default: z.string().optional()
|
31
38
|
});
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
39
|
+
const BytesControllerSchema = BaseControllerDefinitionSchema.extend({
|
40
|
+
type: z.literal(ControllerTypeSchema.enum.bytes),
|
41
|
+
options: FxParamOptions_bytesSchema,
|
42
|
+
default: z.any().optional(),
|
43
|
+
update: z.literal("code-driven", {
|
44
|
+
invalid_type_error: "Bytes parameters must be code-driven",
|
45
|
+
required_error: "Bytes parameters must be code-driven"
|
46
|
+
})
|
36
47
|
});
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
48
|
+
const NumberControllerSchema = BaseControllerDefinitionSchema.extend({
|
49
|
+
type: z.literal(ControllerTypeSchema.enum.number),
|
50
|
+
options: FxParamOptions_numberSchema.optional(),
|
51
|
+
default: z.number().gte(Number.MIN_SAFE_INTEGER).lte(Number.MAX_SAFE_INTEGER).optional()
|
41
52
|
});
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
update: z.literal("code-driven", {
|
47
|
-
invalid_type_error: "Bytes parameters must be code-driven",
|
48
|
-
required_error: "Bytes parameters must be code-driven"
|
49
|
-
})
|
53
|
+
const BigIntControllerSchema = BaseControllerDefinitionSchema.extend({
|
54
|
+
type: z.literal(ControllerTypeSchema.enum.bigint),
|
55
|
+
options: FxParamOptions_bigintSchema.optional(),
|
56
|
+
default: z.bigint().optional()
|
50
57
|
});
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
58
|
+
const SelectControllerSchema = BaseControllerDefinitionSchema.extend({
|
59
|
+
type: z.literal(ControllerTypeSchema.enum.select),
|
60
|
+
options: FxParamOptions_selectSchema,
|
61
|
+
default: z.string().optional()
|
55
62
|
});
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
63
|
+
const BooleanControllerSchema = BaseControllerDefinitionSchema.extend({
|
64
|
+
type: z.literal(ControllerTypeSchema.enum.boolean),
|
65
|
+
options: z.undefined(),
|
66
|
+
default: z.boolean().optional()
|
60
67
|
});
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
68
|
+
const ColorControllerSchema = BaseControllerDefinitionSchema.extend({
|
69
|
+
type: z.literal(ControllerTypeSchema.enum.color),
|
70
|
+
options: z.undefined(),
|
71
|
+
default: z.string().optional()
|
65
72
|
});
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
default: z.string().optional()
|
75
|
-
});
|
76
|
-
z.union([
|
77
|
-
StringControllerSchema,
|
78
|
-
NumberControllerSchema,
|
79
|
-
BigIntControllerSchema,
|
80
|
-
SelectControllerSchema,
|
81
|
-
BytesControllerSchema,
|
82
|
-
BooleanControllerSchema,
|
83
|
-
ColorControllerSchema
|
73
|
+
const ControllerDefinitionSchema = z.union([
|
74
|
+
StringControllerSchema,
|
75
|
+
NumberControllerSchema,
|
76
|
+
BigIntControllerSchema,
|
77
|
+
SelectControllerSchema,
|
78
|
+
BytesControllerSchema,
|
79
|
+
BooleanControllerSchema,
|
80
|
+
ColorControllerSchema
|
84
81
|
]);
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
82
|
+
const controllerSchema = {
|
83
|
+
number: NumberControllerSchema,
|
84
|
+
bigint: BigIntControllerSchema,
|
85
|
+
color: ColorControllerSchema,
|
86
|
+
string: StringControllerSchema,
|
87
|
+
bytes: BytesControllerSchema,
|
88
|
+
boolean: BooleanControllerSchema,
|
89
|
+
select: SelectControllerSchema
|
93
90
|
};
|
94
91
|
function validateParameterDefinition(parameterDefinition) {
|
95
|
-
|
96
|
-
parameterDefinition
|
97
|
-
);
|
92
|
+
return controllerSchema[parameterDefinition.type]?.safeParse(parameterDefinition);
|
98
93
|
}
|
99
94
|
|
100
|
-
|
101
|
-
|
95
|
+
//#endregion
|
96
|
+
export { BaseControllerDefinitionSchema, MAX_SAFE_INT64, MIN_SAFE_INT64, ParameterProcessors, buildParamsObject, consolidateParams, deserializeParams, getRandomParamValues, hexToRgba, jsonStringifyBigint, processParam, processParams, rgbaToHex, serializeParams, serializeParamsOrNull, stringifyParamsData, sumBytesParams, validateParameterDefinition };
|
102
97
|
//# sourceMappingURL=index.js.map
|