@roughapp/feature 0.1.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/README.md +134 -0
- package/index.d.ts +1274 -0
- package/index.js +79 -0
- package/package.json +35 -0
- package/style.css +2 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,1274 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import * as svelte from 'svelte';
|
|
3
|
+
import { Snippet, ComponentProps } from 'svelte';
|
|
4
|
+
|
|
5
|
+
type _JSONSchema = boolean | JSONSchema;
|
|
6
|
+
type JSONSchema = {
|
|
7
|
+
[k: string]: unknown;
|
|
8
|
+
$schema?: "https://json-schema.org/draft/2020-12/schema" | "http://json-schema.org/draft-07/schema#" | "http://json-schema.org/draft-04/schema#";
|
|
9
|
+
$id?: string;
|
|
10
|
+
$anchor?: string;
|
|
11
|
+
$ref?: string;
|
|
12
|
+
$dynamicRef?: string;
|
|
13
|
+
$dynamicAnchor?: string;
|
|
14
|
+
$vocabulary?: Record<string, boolean>;
|
|
15
|
+
$comment?: string;
|
|
16
|
+
$defs?: Record<string, JSONSchema>;
|
|
17
|
+
type?: "object" | "array" | "string" | "number" | "boolean" | "null" | "integer";
|
|
18
|
+
additionalItems?: _JSONSchema;
|
|
19
|
+
unevaluatedItems?: _JSONSchema;
|
|
20
|
+
prefixItems?: _JSONSchema[];
|
|
21
|
+
items?: _JSONSchema | _JSONSchema[];
|
|
22
|
+
contains?: _JSONSchema;
|
|
23
|
+
additionalProperties?: _JSONSchema;
|
|
24
|
+
unevaluatedProperties?: _JSONSchema;
|
|
25
|
+
properties?: Record<string, _JSONSchema>;
|
|
26
|
+
patternProperties?: Record<string, _JSONSchema>;
|
|
27
|
+
dependentSchemas?: Record<string, _JSONSchema>;
|
|
28
|
+
propertyNames?: _JSONSchema;
|
|
29
|
+
if?: _JSONSchema;
|
|
30
|
+
then?: _JSONSchema;
|
|
31
|
+
else?: _JSONSchema;
|
|
32
|
+
allOf?: JSONSchema[];
|
|
33
|
+
anyOf?: JSONSchema[];
|
|
34
|
+
oneOf?: JSONSchema[];
|
|
35
|
+
not?: _JSONSchema;
|
|
36
|
+
multipleOf?: number;
|
|
37
|
+
maximum?: number;
|
|
38
|
+
exclusiveMaximum?: number | boolean;
|
|
39
|
+
minimum?: number;
|
|
40
|
+
exclusiveMinimum?: number | boolean;
|
|
41
|
+
maxLength?: number;
|
|
42
|
+
minLength?: number;
|
|
43
|
+
pattern?: string;
|
|
44
|
+
maxItems?: number;
|
|
45
|
+
minItems?: number;
|
|
46
|
+
uniqueItems?: boolean;
|
|
47
|
+
maxContains?: number;
|
|
48
|
+
minContains?: number;
|
|
49
|
+
maxProperties?: number;
|
|
50
|
+
minProperties?: number;
|
|
51
|
+
required?: string[];
|
|
52
|
+
dependentRequired?: Record<string, string[]>;
|
|
53
|
+
enum?: Array<string | number | boolean | null>;
|
|
54
|
+
const?: string | number | boolean | null;
|
|
55
|
+
id?: string;
|
|
56
|
+
title?: string;
|
|
57
|
+
description?: string;
|
|
58
|
+
default?: unknown;
|
|
59
|
+
deprecated?: boolean;
|
|
60
|
+
readOnly?: boolean;
|
|
61
|
+
writeOnly?: boolean;
|
|
62
|
+
nullable?: boolean;
|
|
63
|
+
examples?: unknown[];
|
|
64
|
+
format?: string;
|
|
65
|
+
contentMediaType?: string;
|
|
66
|
+
contentEncoding?: string;
|
|
67
|
+
contentSchema?: JSONSchema;
|
|
68
|
+
_prefault?: unknown;
|
|
69
|
+
};
|
|
70
|
+
type BaseSchema = JSONSchema;
|
|
71
|
+
|
|
72
|
+
/** The Standard interface. */
|
|
73
|
+
interface StandardTypedV1<Input = unknown, Output = Input> {
|
|
74
|
+
/** The Standard properties. */
|
|
75
|
+
readonly "~standard": StandardTypedV1.Props<Input, Output>;
|
|
76
|
+
}
|
|
77
|
+
declare namespace StandardTypedV1 {
|
|
78
|
+
/** The Standard properties interface. */
|
|
79
|
+
interface Props<Input = unknown, Output = Input> {
|
|
80
|
+
/** The version number of the standard. */
|
|
81
|
+
readonly version: 1;
|
|
82
|
+
/** The vendor name of the schema library. */
|
|
83
|
+
readonly vendor: string;
|
|
84
|
+
/** Inferred types associated with the schema. */
|
|
85
|
+
readonly types?: Types<Input, Output> | undefined;
|
|
86
|
+
}
|
|
87
|
+
/** The Standard types interface. */
|
|
88
|
+
interface Types<Input = unknown, Output = Input> {
|
|
89
|
+
/** The input type of the schema. */
|
|
90
|
+
readonly input: Input;
|
|
91
|
+
/** The output type of the schema. */
|
|
92
|
+
readonly output: Output;
|
|
93
|
+
}
|
|
94
|
+
/** Infers the input type of a Standard. */
|
|
95
|
+
type InferInput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
96
|
+
/** Infers the output type of a Standard. */
|
|
97
|
+
type InferOutput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
98
|
+
}
|
|
99
|
+
/** The Standard Schema interface. */
|
|
100
|
+
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
101
|
+
/** The Standard Schema properties. */
|
|
102
|
+
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
|
103
|
+
}
|
|
104
|
+
declare namespace StandardSchemaV1 {
|
|
105
|
+
/** The Standard Schema properties interface. */
|
|
106
|
+
interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {
|
|
107
|
+
/** Validates unknown input values. */
|
|
108
|
+
readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result<Output> | Promise<Result<Output>>;
|
|
109
|
+
}
|
|
110
|
+
/** The result interface of the validate function. */
|
|
111
|
+
type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
112
|
+
/** The result interface if validation succeeds. */
|
|
113
|
+
interface SuccessResult<Output> {
|
|
114
|
+
/** The typed output value. */
|
|
115
|
+
readonly value: Output;
|
|
116
|
+
/** The absence of issues indicates success. */
|
|
117
|
+
readonly issues?: undefined;
|
|
118
|
+
}
|
|
119
|
+
interface Options {
|
|
120
|
+
/** Implicit support for additional vendor-specific parameters, if needed. */
|
|
121
|
+
readonly libraryOptions?: Record<string, unknown> | undefined;
|
|
122
|
+
}
|
|
123
|
+
/** The result interface if validation fails. */
|
|
124
|
+
interface FailureResult {
|
|
125
|
+
/** The issues of failed validation. */
|
|
126
|
+
readonly issues: ReadonlyArray<Issue>;
|
|
127
|
+
}
|
|
128
|
+
/** The issue interface of the failure output. */
|
|
129
|
+
interface Issue {
|
|
130
|
+
/** The error message of the issue. */
|
|
131
|
+
readonly message: string;
|
|
132
|
+
/** The path of the issue, if any. */
|
|
133
|
+
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
134
|
+
}
|
|
135
|
+
/** The path segment interface of the issue. */
|
|
136
|
+
interface PathSegment {
|
|
137
|
+
/** The key representing a path segment. */
|
|
138
|
+
readonly key: PropertyKey;
|
|
139
|
+
}
|
|
140
|
+
/** The Standard types interface. */
|
|
141
|
+
interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {
|
|
142
|
+
}
|
|
143
|
+
/** Infers the input type of a Standard. */
|
|
144
|
+
type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
|
|
145
|
+
/** Infers the output type of a Standard. */
|
|
146
|
+
type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
declare const $output: unique symbol;
|
|
150
|
+
type $output = typeof $output;
|
|
151
|
+
declare const $input: unique symbol;
|
|
152
|
+
type $input = typeof $input;
|
|
153
|
+
type $replace<Meta, S extends $ZodType> = Meta extends $output ? output<S> : Meta extends $input ? input<S> : Meta extends (infer M)[] ? $replace<M, S>[] : Meta extends (...args: infer P) => infer R ? (...args: {
|
|
154
|
+
[K in keyof P]: $replace<P[K], S>;
|
|
155
|
+
}) => $replace<R, S> : Meta extends object ? {
|
|
156
|
+
[K in keyof Meta]: $replace<Meta[K], S>;
|
|
157
|
+
} : Meta;
|
|
158
|
+
type MetadataType = object | undefined;
|
|
159
|
+
declare class $ZodRegistry<Meta extends MetadataType = MetadataType, Schema extends $ZodType = $ZodType> {
|
|
160
|
+
_meta: Meta;
|
|
161
|
+
_schema: Schema;
|
|
162
|
+
_map: WeakMap<Schema, $replace<Meta, Schema>>;
|
|
163
|
+
_idmap: Map<string, Schema>;
|
|
164
|
+
add<S extends Schema>(schema: S, ..._meta: undefined extends Meta ? [$replace<Meta, S>?] : [$replace<Meta, S>]): this;
|
|
165
|
+
clear(): this;
|
|
166
|
+
remove(schema: Schema): this;
|
|
167
|
+
get<S extends Schema>(schema: S): $replace<Meta, S> | undefined;
|
|
168
|
+
has(schema: Schema): boolean;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
type Processor<T extends $ZodType = $ZodType> = (schema: T, ctx: ToJSONSchemaContext, json: BaseSchema, params: ProcessParams) => void;
|
|
172
|
+
interface ProcessParams {
|
|
173
|
+
schemaPath: $ZodType[];
|
|
174
|
+
path: (string | number)[];
|
|
175
|
+
}
|
|
176
|
+
interface Seen {
|
|
177
|
+
/** JSON Schema result for this Zod schema */
|
|
178
|
+
schema: BaseSchema;
|
|
179
|
+
/** A cached version of the schema that doesn't get overwritten during ref resolution */
|
|
180
|
+
def?: BaseSchema;
|
|
181
|
+
defId?: string | undefined;
|
|
182
|
+
/** Number of times this schema was encountered during traversal */
|
|
183
|
+
count: number;
|
|
184
|
+
/** Cycle path */
|
|
185
|
+
cycle?: (string | number)[] | undefined;
|
|
186
|
+
isParent?: boolean | undefined;
|
|
187
|
+
/** Schema to inherit JSON Schema properties from (set by processor for wrappers) */
|
|
188
|
+
ref?: $ZodType | null;
|
|
189
|
+
/** JSON Schema property path for this schema */
|
|
190
|
+
path?: (string | number)[] | undefined;
|
|
191
|
+
}
|
|
192
|
+
interface ToJSONSchemaContext {
|
|
193
|
+
processors: Record<string, Processor>;
|
|
194
|
+
metadataRegistry: $ZodRegistry<Record<string, any>>;
|
|
195
|
+
target: "draft-04" | "draft-07" | "draft-2020-12" | "openapi-3.0" | ({} & string);
|
|
196
|
+
unrepresentable: "throw" | "any";
|
|
197
|
+
override: (ctx: {
|
|
198
|
+
zodSchema: $ZodType;
|
|
199
|
+
jsonSchema: BaseSchema;
|
|
200
|
+
path: (string | number)[];
|
|
201
|
+
}) => void;
|
|
202
|
+
io: "input" | "output";
|
|
203
|
+
counter: number;
|
|
204
|
+
seen: Map<$ZodType, Seen>;
|
|
205
|
+
cycles: "ref" | "throw";
|
|
206
|
+
reused: "ref" | "inline";
|
|
207
|
+
external?: {
|
|
208
|
+
registry: $ZodRegistry<{
|
|
209
|
+
id?: string | undefined;
|
|
210
|
+
}>;
|
|
211
|
+
uri?: ((id: string) => string) | undefined;
|
|
212
|
+
defs: Record<string, BaseSchema>;
|
|
213
|
+
} | undefined;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
217
|
+
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
218
|
+
type MakePartial<T, K extends keyof T> = Omit<T, K> & InexactPartial<Pick<T, K>>;
|
|
219
|
+
type LoosePartial<T extends object> = InexactPartial<T> & {
|
|
220
|
+
[k: string]: unknown;
|
|
221
|
+
};
|
|
222
|
+
type InexactPartial<T> = {
|
|
223
|
+
[P in keyof T]?: T[P] | undefined;
|
|
224
|
+
};
|
|
225
|
+
type Identity<T> = T;
|
|
226
|
+
type Flatten<T> = Identity<{
|
|
227
|
+
[k in keyof T]: T[k];
|
|
228
|
+
}>;
|
|
229
|
+
type Prettify<T> = {
|
|
230
|
+
[K in keyof T]: T[K];
|
|
231
|
+
} & {};
|
|
232
|
+
type AnyFunc = (...args: any[]) => any;
|
|
233
|
+
type MaybeAsync<T> = T | Promise<T>;
|
|
234
|
+
type EnumValue = string | number;
|
|
235
|
+
type EnumLike = Readonly<Record<string, EnumValue>>;
|
|
236
|
+
type Primitive = string | number | symbol | bigint | boolean | null | undefined;
|
|
237
|
+
type SafeParseResult<T> = SafeParseSuccess<T> | SafeParseError<T>;
|
|
238
|
+
type SafeParseSuccess<T> = {
|
|
239
|
+
success: true;
|
|
240
|
+
data: T;
|
|
241
|
+
error?: never;
|
|
242
|
+
};
|
|
243
|
+
type SafeParseError<T> = {
|
|
244
|
+
success: false;
|
|
245
|
+
data?: never;
|
|
246
|
+
error: $ZodError<T>;
|
|
247
|
+
};
|
|
248
|
+
type PropValues = Record<string, Set<Primitive>>;
|
|
249
|
+
type PrimitiveSet = Set<Primitive>;
|
|
250
|
+
declare abstract class Class {
|
|
251
|
+
constructor(..._args: any[]);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
declare const version: {
|
|
255
|
+
readonly major: 4;
|
|
256
|
+
readonly minor: 4;
|
|
257
|
+
readonly patch: number;
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
interface ParseContext<T extends $ZodIssueBase = never> {
|
|
261
|
+
/** Customize error messages. */
|
|
262
|
+
readonly error?: $ZodErrorMap<T>;
|
|
263
|
+
/** Include the `input` field in issue objects. Default `false`. */
|
|
264
|
+
readonly reportInput?: boolean;
|
|
265
|
+
/** Skip eval-based fast path. Default `false`. */
|
|
266
|
+
readonly jitless?: boolean;
|
|
267
|
+
}
|
|
268
|
+
/** @internal */
|
|
269
|
+
interface ParseContextInternal<T extends $ZodIssueBase = never> extends ParseContext<T> {
|
|
270
|
+
readonly async?: boolean | undefined;
|
|
271
|
+
readonly direction?: "forward" | "backward";
|
|
272
|
+
readonly skipChecks?: boolean;
|
|
273
|
+
}
|
|
274
|
+
interface ParsePayload<T = unknown> {
|
|
275
|
+
value: T;
|
|
276
|
+
issues: $ZodRawIssue[];
|
|
277
|
+
/** A way to mark a whole payload as aborted. Used in codecs/pipes. */
|
|
278
|
+
aborted?: boolean;
|
|
279
|
+
/** @internal Marks a value as a fallback that an outer wrapper (e.g.
|
|
280
|
+
* $ZodOptional) may override with its own interpretation when input was
|
|
281
|
+
* undefined. Set by $ZodCatch when catchValue substitutes and by every
|
|
282
|
+
* $ZodTransform invocation. */
|
|
283
|
+
fallback?: boolean | undefined;
|
|
284
|
+
}
|
|
285
|
+
type CheckFn<T> = (input: ParsePayload<T>) => MaybeAsync<void>;
|
|
286
|
+
interface $ZodTypeDef {
|
|
287
|
+
type: "string" | "number" | "int" | "boolean" | "bigint" | "symbol" | "null" | "undefined" | "void" | "never" | "any" | "unknown" | "date" | "object" | "record" | "file" | "array" | "tuple" | "union" | "intersection" | "map" | "set" | "enum" | "literal" | "nullable" | "optional" | "nonoptional" | "success" | "transform" | "default" | "prefault" | "catch" | "nan" | "pipe" | "readonly" | "template_literal" | "promise" | "lazy" | "function" | "custom";
|
|
288
|
+
error?: $ZodErrorMap<never> | undefined;
|
|
289
|
+
checks?: $ZodCheck<never>[];
|
|
290
|
+
}
|
|
291
|
+
interface _$ZodTypeInternals {
|
|
292
|
+
/** The `@zod/core` version of this schema */
|
|
293
|
+
version: typeof version;
|
|
294
|
+
/** Schema definition. */
|
|
295
|
+
def: $ZodTypeDef;
|
|
296
|
+
/** @internal Randomly generated ID for this schema. */
|
|
297
|
+
/** @internal List of deferred initializers. */
|
|
298
|
+
deferred: AnyFunc[] | undefined;
|
|
299
|
+
/** @internal Parses input and runs all checks (refinements). */
|
|
300
|
+
run(payload: ParsePayload<any>, ctx: ParseContextInternal): MaybeAsync<ParsePayload>;
|
|
301
|
+
/** @internal Parses input, doesn't run checks. */
|
|
302
|
+
parse(payload: ParsePayload<any>, ctx: ParseContextInternal): MaybeAsync<ParsePayload>;
|
|
303
|
+
/** @internal Stores identifiers for the set of traits implemented by this schema. */
|
|
304
|
+
traits: Set<string>;
|
|
305
|
+
/** @internal Indicates that a schema output type should be considered optional inside objects.
|
|
306
|
+
* @default Required
|
|
307
|
+
*/
|
|
308
|
+
/** @internal */
|
|
309
|
+
optin?: "optional" | undefined;
|
|
310
|
+
/** @internal */
|
|
311
|
+
optout?: "optional" | undefined;
|
|
312
|
+
/** @internal The set of literal values that will pass validation. Must be an exhaustive set. Used to determine optionality in z.record().
|
|
313
|
+
*
|
|
314
|
+
* Defined on: enum, const, literal, null, undefined
|
|
315
|
+
* Passthrough: optional, nullable, branded, default, catch, pipe
|
|
316
|
+
* Todo: unions?
|
|
317
|
+
*/
|
|
318
|
+
values?: PrimitiveSet | undefined;
|
|
319
|
+
/** Default value bubbled up from */
|
|
320
|
+
/** @internal A set of literal discriminators used for the fast path in discriminated unions. */
|
|
321
|
+
propValues?: PropValues | undefined;
|
|
322
|
+
/** @internal This flag indicates that a schema validation can be represented with a regular expression. Used to determine allowable schemas in z.templateLiteral(). */
|
|
323
|
+
pattern: RegExp | undefined;
|
|
324
|
+
/** @internal The constructor function of this schema. */
|
|
325
|
+
constr: new (def: any) => $ZodType;
|
|
326
|
+
/** @internal A catchall object for bag metadata related to this schema. Commonly modified by checks using `onattach`. */
|
|
327
|
+
bag: Record<string, unknown>;
|
|
328
|
+
/** @internal The set of issues this schema might throw during type checking. */
|
|
329
|
+
isst: $ZodIssueBase;
|
|
330
|
+
/** @internal Subject to change, not a public API. */
|
|
331
|
+
processJSONSchema?: ((ctx: ToJSONSchemaContext, json: BaseSchema, params: ProcessParams) => void) | undefined;
|
|
332
|
+
/** An optional method used to override `toJSONSchema` logic. */
|
|
333
|
+
toJSONSchema?: () => unknown;
|
|
334
|
+
/** @internal The parent of this schema. Only set during certain clone operations. */
|
|
335
|
+
parent?: $ZodType | undefined;
|
|
336
|
+
}
|
|
337
|
+
/** @internal */
|
|
338
|
+
interface $ZodTypeInternals<out O = unknown, out I = unknown> extends _$ZodTypeInternals {
|
|
339
|
+
/** @internal The inferred output type */
|
|
340
|
+
output: O;
|
|
341
|
+
/** @internal The inferred input type */
|
|
342
|
+
input: I;
|
|
343
|
+
}
|
|
344
|
+
type $ZodStandardSchema<T> = StandardSchemaV1.Props<input<T>, output<T>>;
|
|
345
|
+
type SomeType$1 = {
|
|
346
|
+
_zod: _$ZodTypeInternals;
|
|
347
|
+
};
|
|
348
|
+
interface _$ZodType<T extends $ZodTypeInternals = $ZodTypeInternals> extends $ZodType<T["output"], T["input"], T> {
|
|
349
|
+
}
|
|
350
|
+
interface $ZodType<O = unknown, I = unknown, Internals extends $ZodTypeInternals<O, I> = $ZodTypeInternals<O, I>> {
|
|
351
|
+
_zod: Internals;
|
|
352
|
+
"~standard": $ZodStandardSchema<this>;
|
|
353
|
+
}
|
|
354
|
+
declare const $ZodType: $constructor<$ZodType>;
|
|
355
|
+
|
|
356
|
+
interface $ZodStringDef extends $ZodTypeDef {
|
|
357
|
+
type: "string";
|
|
358
|
+
coerce?: boolean;
|
|
359
|
+
checks?: $ZodCheck<string>[];
|
|
360
|
+
}
|
|
361
|
+
interface $ZodStringInternals<Input> extends $ZodTypeInternals<string, Input> {
|
|
362
|
+
def: $ZodStringDef;
|
|
363
|
+
/** @deprecated Internal API, use with caution (not deprecated) */
|
|
364
|
+
pattern: RegExp;
|
|
365
|
+
/** @deprecated Internal API, use with caution (not deprecated) */
|
|
366
|
+
isst: $ZodIssueInvalidType;
|
|
367
|
+
bag: LoosePartial<{
|
|
368
|
+
minimum: number;
|
|
369
|
+
maximum: number;
|
|
370
|
+
patterns: Set<RegExp>;
|
|
371
|
+
format: string;
|
|
372
|
+
contentEncoding: string;
|
|
373
|
+
}>;
|
|
374
|
+
}
|
|
375
|
+
interface $ZodString<Input = unknown> extends _$ZodType<$ZodStringInternals<Input>> {
|
|
376
|
+
}
|
|
377
|
+
declare const $ZodString: $constructor<$ZodString>;
|
|
378
|
+
interface $ZodStringFormatDef<Format extends string = string> extends $ZodStringDef, $ZodCheckStringFormatDef<Format> {
|
|
379
|
+
}
|
|
380
|
+
interface $ZodStringFormatInternals<Format extends string = string> extends $ZodStringInternals<string>, $ZodCheckStringFormatInternals {
|
|
381
|
+
def: $ZodStringFormatDef<Format>;
|
|
382
|
+
}
|
|
383
|
+
interface $ZodURLDef extends $ZodStringFormatDef<"url"> {
|
|
384
|
+
hostname?: RegExp | undefined;
|
|
385
|
+
protocol?: RegExp | undefined;
|
|
386
|
+
normalize?: boolean | undefined;
|
|
387
|
+
}
|
|
388
|
+
interface $ZodURLInternals extends $ZodStringFormatInternals<"url"> {
|
|
389
|
+
def: $ZodURLDef;
|
|
390
|
+
}
|
|
391
|
+
interface $ZodNumberDef extends $ZodTypeDef {
|
|
392
|
+
type: "number";
|
|
393
|
+
coerce?: boolean;
|
|
394
|
+
}
|
|
395
|
+
interface $ZodNumberInternals<Input = unknown> extends $ZodTypeInternals<number, Input> {
|
|
396
|
+
def: $ZodNumberDef;
|
|
397
|
+
/** @deprecated Internal API, use with caution (not deprecated) */
|
|
398
|
+
pattern: RegExp;
|
|
399
|
+
/** @deprecated Internal API, use with caution (not deprecated) */
|
|
400
|
+
isst: $ZodIssueInvalidType;
|
|
401
|
+
bag: LoosePartial<{
|
|
402
|
+
minimum: number;
|
|
403
|
+
maximum: number;
|
|
404
|
+
exclusiveMinimum: number;
|
|
405
|
+
exclusiveMaximum: number;
|
|
406
|
+
format: string;
|
|
407
|
+
pattern: RegExp;
|
|
408
|
+
}>;
|
|
409
|
+
}
|
|
410
|
+
interface $ZodNumber<Input = unknown> extends $ZodType {
|
|
411
|
+
_zod: $ZodNumberInternals<Input>;
|
|
412
|
+
}
|
|
413
|
+
declare const $ZodNumber: $constructor<$ZodNumber>;
|
|
414
|
+
interface $ZodUnknownDef extends $ZodTypeDef {
|
|
415
|
+
type: "unknown";
|
|
416
|
+
}
|
|
417
|
+
interface $ZodUnknownInternals extends $ZodTypeInternals<unknown, unknown> {
|
|
418
|
+
def: $ZodUnknownDef;
|
|
419
|
+
isst: never;
|
|
420
|
+
}
|
|
421
|
+
type OptionalOutSchema = {
|
|
422
|
+
_zod: {
|
|
423
|
+
optout: "optional";
|
|
424
|
+
};
|
|
425
|
+
};
|
|
426
|
+
type OptionalInSchema = {
|
|
427
|
+
_zod: {
|
|
428
|
+
optin: "optional";
|
|
429
|
+
};
|
|
430
|
+
};
|
|
431
|
+
type $InferObjectOutput<T extends $ZodLooseShape, Extra extends Record<string, unknown>> = string extends keyof T ? IsAny<T[keyof T]> extends true ? Record<string, unknown> : Record<string, output<T[keyof T]>> : keyof (T & Extra) extends never ? Record<string, never> : Prettify<{
|
|
432
|
+
-readonly [k in keyof T as T[k] extends OptionalOutSchema ? never : k]: T[k]["_zod"]["output"];
|
|
433
|
+
} & {
|
|
434
|
+
-readonly [k in keyof T as T[k] extends OptionalOutSchema ? k : never]?: T[k]["_zod"]["output"];
|
|
435
|
+
} & Extra>;
|
|
436
|
+
type $InferObjectInput<T extends $ZodLooseShape, Extra extends Record<string, unknown>> = string extends keyof T ? IsAny<T[keyof T]> extends true ? Record<string, unknown> : Record<string, input<T[keyof T]>> : keyof (T & Extra) extends never ? Record<string, never> : Prettify<{
|
|
437
|
+
-readonly [k in keyof T as T[k] extends OptionalInSchema ? never : k]: T[k]["_zod"]["input"];
|
|
438
|
+
} & {
|
|
439
|
+
-readonly [k in keyof T as T[k] extends OptionalInSchema ? k : never]?: T[k]["_zod"]["input"];
|
|
440
|
+
} & Extra>;
|
|
441
|
+
type $ZodObjectConfig = {
|
|
442
|
+
out: Record<string, unknown>;
|
|
443
|
+
in: Record<string, unknown>;
|
|
444
|
+
};
|
|
445
|
+
type $strip = {
|
|
446
|
+
out: {};
|
|
447
|
+
in: {};
|
|
448
|
+
};
|
|
449
|
+
type $ZodShape = Readonly<{
|
|
450
|
+
[k: string]: $ZodType;
|
|
451
|
+
}>;
|
|
452
|
+
interface $ZodObjectDef<Shape extends $ZodShape = $ZodShape> extends $ZodTypeDef {
|
|
453
|
+
type: "object";
|
|
454
|
+
shape: Shape;
|
|
455
|
+
catchall?: $ZodType | undefined;
|
|
456
|
+
}
|
|
457
|
+
interface $ZodObjectInternals<
|
|
458
|
+
/** @ts-ignore Cast variance */
|
|
459
|
+
out Shape extends $ZodShape = $ZodShape, out Config extends $ZodObjectConfig = $ZodObjectConfig> extends _$ZodTypeInternals {
|
|
460
|
+
def: $ZodObjectDef<Shape>;
|
|
461
|
+
config: Config;
|
|
462
|
+
isst: $ZodIssueInvalidType | $ZodIssueUnrecognizedKeys;
|
|
463
|
+
propValues: PropValues;
|
|
464
|
+
output: $InferObjectOutput<Shape, Config["out"]>;
|
|
465
|
+
input: $InferObjectInput<Shape, Config["in"]>;
|
|
466
|
+
optin?: "optional" | undefined;
|
|
467
|
+
optout?: "optional" | undefined;
|
|
468
|
+
}
|
|
469
|
+
type $ZodLooseShape = Record<string, any>;
|
|
470
|
+
interface $ZodObject<
|
|
471
|
+
/** @ts-ignore Cast variance */
|
|
472
|
+
out Shape extends Readonly<$ZodShape> = Readonly<$ZodShape>, out Params extends $ZodObjectConfig = $ZodObjectConfig> extends $ZodType<any, any, $ZodObjectInternals<Shape, Params>> {
|
|
473
|
+
}
|
|
474
|
+
declare const $ZodObject: $constructor<$ZodObject>;
|
|
475
|
+
type $ZodRecordKey = $ZodType<string | number | symbol, unknown>;
|
|
476
|
+
interface $ZodRecordDef<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType$1 = $ZodType> extends $ZodTypeDef {
|
|
477
|
+
type: "record";
|
|
478
|
+
keyType: Key;
|
|
479
|
+
valueType: Value;
|
|
480
|
+
/** @default "strict" - errors on keys not matching keyType. "loose" passes through non-matching keys unchanged. */
|
|
481
|
+
mode?: "strict" | "loose";
|
|
482
|
+
}
|
|
483
|
+
type $InferZodRecordOutput<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType$1 = $ZodType> = Key extends $partial ? Partial<Record<output<Key>, output<Value>>> : Record<output<Key>, output<Value>>;
|
|
484
|
+
type $InferZodRecordInput<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType$1 = $ZodType> = Key extends $partial ? Partial<Record<input<Key> & PropertyKey, input<Value>>> : Record<input<Key> & PropertyKey, input<Value>>;
|
|
485
|
+
interface $ZodRecordInternals<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType$1 = $ZodType> extends $ZodTypeInternals<$InferZodRecordOutput<Key, Value>, $InferZodRecordInput<Key, Value>> {
|
|
486
|
+
def: $ZodRecordDef<Key, Value>;
|
|
487
|
+
isst: $ZodIssueInvalidType | $ZodIssueInvalidKey<Record<PropertyKey, unknown>>;
|
|
488
|
+
optin?: "optional" | undefined;
|
|
489
|
+
optout?: "optional" | undefined;
|
|
490
|
+
}
|
|
491
|
+
type $partial = {
|
|
492
|
+
"~~partial": true;
|
|
493
|
+
};
|
|
494
|
+
type $InferEnumOutput<T extends EnumLike> = T[keyof T] & {};
|
|
495
|
+
type $InferEnumInput<T extends EnumLike> = T[keyof T] & {};
|
|
496
|
+
interface $ZodEnumDef<T extends EnumLike = EnumLike> extends $ZodTypeDef {
|
|
497
|
+
type: "enum";
|
|
498
|
+
entries: T;
|
|
499
|
+
}
|
|
500
|
+
interface $ZodEnumInternals<
|
|
501
|
+
/** @ts-ignore Cast variance */
|
|
502
|
+
out T extends EnumLike = EnumLike> extends $ZodTypeInternals<$InferEnumOutput<T>, $InferEnumInput<T>> {
|
|
503
|
+
def: $ZodEnumDef<T>;
|
|
504
|
+
/** @deprecated Internal API, use with caution (not deprecated) */
|
|
505
|
+
values: PrimitiveSet;
|
|
506
|
+
/** @deprecated Internal API, use with caution (not deprecated) */
|
|
507
|
+
pattern: RegExp;
|
|
508
|
+
isst: $ZodIssueInvalidValue;
|
|
509
|
+
}
|
|
510
|
+
interface $ZodNullableDef<T extends SomeType$1 = $ZodType> extends $ZodTypeDef {
|
|
511
|
+
type: "nullable";
|
|
512
|
+
innerType: T;
|
|
513
|
+
}
|
|
514
|
+
interface $ZodNullableInternals<T extends SomeType$1 = $ZodType> extends $ZodTypeInternals<output<T> | null, input<T> | null> {
|
|
515
|
+
def: $ZodNullableDef<T>;
|
|
516
|
+
optin: T["_zod"]["optin"];
|
|
517
|
+
optout: T["_zod"]["optout"];
|
|
518
|
+
isst: never;
|
|
519
|
+
values: T["_zod"]["values"];
|
|
520
|
+
pattern: T["_zod"]["pattern"];
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
interface $ZodCheckDef {
|
|
524
|
+
check: string;
|
|
525
|
+
error?: $ZodErrorMap<never> | undefined;
|
|
526
|
+
/** If true, no later checks will be executed if this check fails. Default `false`. */
|
|
527
|
+
abort?: boolean | undefined;
|
|
528
|
+
/** If provided, the check runs only when this returns `true`. By default, it is skipped if prior parsing produced aborting issues. */
|
|
529
|
+
when?: ((payload: ParsePayload) => boolean) | undefined;
|
|
530
|
+
}
|
|
531
|
+
interface $ZodCheckInternals<T> {
|
|
532
|
+
def: $ZodCheckDef;
|
|
533
|
+
/** The set of issues this check might throw. */
|
|
534
|
+
issc?: $ZodIssueBase;
|
|
535
|
+
check(payload: ParsePayload<T>): MaybeAsync<void>;
|
|
536
|
+
onattach: ((schema: $ZodType) => void)[];
|
|
537
|
+
}
|
|
538
|
+
interface $ZodCheck<in T = never> {
|
|
539
|
+
_zod: $ZodCheckInternals<T>;
|
|
540
|
+
}
|
|
541
|
+
declare const $ZodCheck: $constructor<$ZodCheck<any>>;
|
|
542
|
+
type $ZodStringFormats = "email" | "url" | "emoji" | "uuid" | "guid" | "nanoid" | "cuid" | "cuid2" | "ulid" | "xid" | "ksuid" | "datetime" | "date" | "time" | "duration" | "ipv4" | "ipv6" | "cidrv4" | "cidrv6" | "base64" | "base64url" | "json_string" | "e164" | "lowercase" | "uppercase" | "regex" | "jwt" | "starts_with" | "ends_with" | "includes";
|
|
543
|
+
interface $ZodCheckStringFormatDef<Format extends string = string> extends $ZodCheckDef {
|
|
544
|
+
check: "string_format";
|
|
545
|
+
format: Format;
|
|
546
|
+
pattern?: RegExp | undefined;
|
|
547
|
+
}
|
|
548
|
+
interface $ZodCheckStringFormatInternals extends $ZodCheckInternals<string> {
|
|
549
|
+
def: $ZodCheckStringFormatDef;
|
|
550
|
+
issc: $ZodIssueInvalidStringFormat;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
interface $ZodIssueBase {
|
|
554
|
+
readonly code?: string;
|
|
555
|
+
readonly input?: unknown;
|
|
556
|
+
readonly path: PropertyKey[];
|
|
557
|
+
readonly message: string;
|
|
558
|
+
}
|
|
559
|
+
type $ZodInvalidTypeExpected = "string" | "number" | "int" | "boolean" | "bigint" | "symbol" | "undefined" | "null" | "never" | "void" | "date" | "array" | "object" | "tuple" | "record" | "map" | "set" | "file" | "nonoptional" | "nan" | "function" | (string & {});
|
|
560
|
+
interface $ZodIssueInvalidType<Input = unknown> extends $ZodIssueBase {
|
|
561
|
+
readonly code: "invalid_type";
|
|
562
|
+
readonly expected: $ZodInvalidTypeExpected;
|
|
563
|
+
readonly input?: Input;
|
|
564
|
+
}
|
|
565
|
+
interface $ZodIssueTooBig<Input = unknown> extends $ZodIssueBase {
|
|
566
|
+
readonly code: "too_big";
|
|
567
|
+
readonly origin: "number" | "int" | "bigint" | "date" | "string" | "array" | "set" | "file" | (string & {});
|
|
568
|
+
readonly maximum: number | bigint;
|
|
569
|
+
readonly inclusive?: boolean;
|
|
570
|
+
readonly exact?: boolean;
|
|
571
|
+
readonly input?: Input;
|
|
572
|
+
}
|
|
573
|
+
interface $ZodIssueTooSmall<Input = unknown> extends $ZodIssueBase {
|
|
574
|
+
readonly code: "too_small";
|
|
575
|
+
readonly origin: "number" | "int" | "bigint" | "date" | "string" | "array" | "set" | "file" | (string & {});
|
|
576
|
+
readonly minimum: number | bigint;
|
|
577
|
+
/** True if the allowable range includes the minimum */
|
|
578
|
+
readonly inclusive?: boolean;
|
|
579
|
+
/** True if the allowed value is fixed (e.g.` z.length(5)`), not a range (`z.minLength(5)`) */
|
|
580
|
+
readonly exact?: boolean;
|
|
581
|
+
readonly input?: Input;
|
|
582
|
+
}
|
|
583
|
+
interface $ZodIssueInvalidStringFormat extends $ZodIssueBase {
|
|
584
|
+
readonly code: "invalid_format";
|
|
585
|
+
readonly format: $ZodStringFormats | (string & {});
|
|
586
|
+
readonly pattern?: string;
|
|
587
|
+
readonly input?: string;
|
|
588
|
+
}
|
|
589
|
+
interface $ZodIssueNotMultipleOf<Input extends number | bigint = number | bigint> extends $ZodIssueBase {
|
|
590
|
+
readonly code: "not_multiple_of";
|
|
591
|
+
readonly divisor: number;
|
|
592
|
+
readonly input?: Input;
|
|
593
|
+
}
|
|
594
|
+
interface $ZodIssueUnrecognizedKeys extends $ZodIssueBase {
|
|
595
|
+
readonly code: "unrecognized_keys";
|
|
596
|
+
readonly keys: string[];
|
|
597
|
+
readonly input?: Record<string, unknown>;
|
|
598
|
+
}
|
|
599
|
+
interface $ZodIssueInvalidUnionNoMatch extends $ZodIssueBase {
|
|
600
|
+
readonly code: "invalid_union";
|
|
601
|
+
readonly errors: $ZodIssue[][];
|
|
602
|
+
readonly input?: unknown;
|
|
603
|
+
readonly discriminator?: string | undefined;
|
|
604
|
+
readonly options?: Primitive[];
|
|
605
|
+
readonly inclusive?: true;
|
|
606
|
+
}
|
|
607
|
+
interface $ZodIssueInvalidUnionMultipleMatch extends $ZodIssueBase {
|
|
608
|
+
readonly code: "invalid_union";
|
|
609
|
+
readonly errors: [];
|
|
610
|
+
readonly input?: unknown;
|
|
611
|
+
readonly discriminator?: string | undefined;
|
|
612
|
+
readonly inclusive: false;
|
|
613
|
+
}
|
|
614
|
+
type $ZodIssueInvalidUnion = $ZodIssueInvalidUnionNoMatch | $ZodIssueInvalidUnionMultipleMatch;
|
|
615
|
+
interface $ZodIssueInvalidKey<Input = unknown> extends $ZodIssueBase {
|
|
616
|
+
readonly code: "invalid_key";
|
|
617
|
+
readonly origin: "map" | "record";
|
|
618
|
+
readonly issues: $ZodIssue[];
|
|
619
|
+
readonly input?: Input;
|
|
620
|
+
}
|
|
621
|
+
interface $ZodIssueInvalidElement<Input = unknown> extends $ZodIssueBase {
|
|
622
|
+
readonly code: "invalid_element";
|
|
623
|
+
readonly origin: "map" | "set";
|
|
624
|
+
readonly key: unknown;
|
|
625
|
+
readonly issues: $ZodIssue[];
|
|
626
|
+
readonly input?: Input;
|
|
627
|
+
}
|
|
628
|
+
interface $ZodIssueInvalidValue<Input = unknown> extends $ZodIssueBase {
|
|
629
|
+
readonly code: "invalid_value";
|
|
630
|
+
readonly values: Primitive[];
|
|
631
|
+
readonly input?: Input;
|
|
632
|
+
}
|
|
633
|
+
interface $ZodIssueCustom extends $ZodIssueBase {
|
|
634
|
+
readonly code: "custom";
|
|
635
|
+
readonly params?: Record<string, any> | undefined;
|
|
636
|
+
readonly input?: unknown;
|
|
637
|
+
}
|
|
638
|
+
type $ZodIssue = $ZodIssueInvalidType | $ZodIssueTooBig | $ZodIssueTooSmall | $ZodIssueInvalidStringFormat | $ZodIssueNotMultipleOf | $ZodIssueUnrecognizedKeys | $ZodIssueInvalidUnion | $ZodIssueInvalidKey | $ZodIssueInvalidElement | $ZodIssueInvalidValue | $ZodIssueCustom;
|
|
639
|
+
type $ZodInternalIssue<T extends $ZodIssueBase = $ZodIssue> = T extends any ? RawIssue<T> : never;
|
|
640
|
+
type RawIssue<T extends $ZodIssueBase> = T extends any ? Flatten<MakePartial<T, "message" | "path"> & {
|
|
641
|
+
/** The input data */
|
|
642
|
+
readonly input: unknown;
|
|
643
|
+
/** The schema or check that originated this issue. */
|
|
644
|
+
readonly inst?: $ZodType | $ZodCheck;
|
|
645
|
+
/** If `true`, Zod will continue executing checks/refinements after this issue. */
|
|
646
|
+
readonly continue?: boolean | undefined;
|
|
647
|
+
} & Record<string, unknown>> : never;
|
|
648
|
+
type $ZodRawIssue<T extends $ZodIssueBase = $ZodIssue> = $ZodInternalIssue<T>;
|
|
649
|
+
interface $ZodErrorMap<T extends $ZodIssueBase = $ZodIssue> {
|
|
650
|
+
(issue: $ZodRawIssue<T>): {
|
|
651
|
+
message: string;
|
|
652
|
+
} | string | undefined | null;
|
|
653
|
+
}
|
|
654
|
+
interface $ZodError<T = unknown> extends Error {
|
|
655
|
+
type: T;
|
|
656
|
+
issues: $ZodIssue[];
|
|
657
|
+
_zod: {
|
|
658
|
+
output: T;
|
|
659
|
+
def: $ZodIssue[];
|
|
660
|
+
};
|
|
661
|
+
stack?: string;
|
|
662
|
+
name: string;
|
|
663
|
+
}
|
|
664
|
+
declare const $ZodError: $constructor<$ZodError>;
|
|
665
|
+
|
|
666
|
+
type ZodTrait = {
|
|
667
|
+
_zod: {
|
|
668
|
+
def: any;
|
|
669
|
+
[k: string]: any;
|
|
670
|
+
};
|
|
671
|
+
};
|
|
672
|
+
interface $constructor<T extends ZodTrait, D = T["_zod"]["def"]> {
|
|
673
|
+
new (def: D): T;
|
|
674
|
+
init(inst: T, def: D): asserts inst is T;
|
|
675
|
+
}
|
|
676
|
+
declare function $constructor<T extends ZodTrait, D = T["_zod"]["def"]>(name: string, initializer: (inst: T, def: D) => void, params?: {
|
|
677
|
+
Parent?: typeof Class;
|
|
678
|
+
}): $constructor<T, D>;
|
|
679
|
+
declare const $brand: unique symbol;
|
|
680
|
+
type $brand<T extends string | number | symbol = string | number | symbol> = {
|
|
681
|
+
[$brand]: {
|
|
682
|
+
[k in T]: true;
|
|
683
|
+
};
|
|
684
|
+
};
|
|
685
|
+
type $ZodBranded<T extends SomeType$1, Brand extends string | number | symbol, Dir extends "in" | "out" | "inout" = "out"> = T & (Dir extends "inout" ? {
|
|
686
|
+
_zod: {
|
|
687
|
+
input: input<T> & $brand<Brand>;
|
|
688
|
+
output: output<T> & $brand<Brand>;
|
|
689
|
+
};
|
|
690
|
+
} : Dir extends "in" ? {
|
|
691
|
+
_zod: {
|
|
692
|
+
input: input<T> & $brand<Brand>;
|
|
693
|
+
};
|
|
694
|
+
} : {
|
|
695
|
+
_zod: {
|
|
696
|
+
output: output<T> & $brand<Brand>;
|
|
697
|
+
};
|
|
698
|
+
});
|
|
699
|
+
type input<T> = T extends {
|
|
700
|
+
_zod: {
|
|
701
|
+
input: any;
|
|
702
|
+
};
|
|
703
|
+
} ? T["_zod"]["input"] : unknown;
|
|
704
|
+
type output<T> = T extends {
|
|
705
|
+
_zod: {
|
|
706
|
+
output: any;
|
|
707
|
+
};
|
|
708
|
+
} ? T["_zod"]["output"] : unknown;
|
|
709
|
+
|
|
710
|
+
type ToolDefinition<
|
|
711
|
+
Id extends string = string,
|
|
712
|
+
InputSchema extends z.ZodType = z.ZodType,
|
|
713
|
+
OutputSchema extends z.ZodType = z.ZodType,
|
|
714
|
+
> = {
|
|
715
|
+
type: 'query' | 'mutation' | 'subscription'
|
|
716
|
+
id: Id
|
|
717
|
+
name: string
|
|
718
|
+
description: string
|
|
719
|
+
inputSchema: InputSchema
|
|
720
|
+
outputSchema: OutputSchema
|
|
721
|
+
outputSample: z.infer<OutputSchema>
|
|
722
|
+
implementation: (...args: never) => unknown
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
type MutationImplementation<InputSchema, OutputSchema> = (
|
|
726
|
+
input: z.output<InputSchema>,
|
|
727
|
+
) => Promise<z.input<OutputSchema>>
|
|
728
|
+
|
|
729
|
+
type MutationConstructorOptions<
|
|
730
|
+
Id extends string,
|
|
731
|
+
InputSchema extends z.ZodType,
|
|
732
|
+
OutputSchema extends z.ZodType,
|
|
733
|
+
> = {
|
|
734
|
+
id: Id
|
|
735
|
+
name: string
|
|
736
|
+
description: string
|
|
737
|
+
inputSchema: InputSchema
|
|
738
|
+
outputSchema: OutputSchema
|
|
739
|
+
outputSample: NoInfer<z.infer<OutputSchema>>
|
|
740
|
+
implementation: MutationImplementation<InputSchema, OutputSchema>
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
declare class Mutation<
|
|
744
|
+
Id extends string,
|
|
745
|
+
InputSchema extends z.ZodType,
|
|
746
|
+
OutputSchema extends z.ZodType,
|
|
747
|
+
> implements ToolDefinition<Id, InputSchema, OutputSchema>
|
|
748
|
+
{
|
|
749
|
+
type = 'mutation' as const
|
|
750
|
+
|
|
751
|
+
id: Id
|
|
752
|
+
name: string
|
|
753
|
+
description: string
|
|
754
|
+
inputSchema: InputSchema
|
|
755
|
+
outputSchema: OutputSchema
|
|
756
|
+
outputSample: z.infer<OutputSchema>
|
|
757
|
+
implementation: MutationImplementation<InputSchema, OutputSchema>
|
|
758
|
+
|
|
759
|
+
static create<
|
|
760
|
+
Id extends string,
|
|
761
|
+
InputSchema extends z.ZodType,
|
|
762
|
+
OutputSchema extends z.ZodType,
|
|
763
|
+
>(options: MutationConstructorOptions<Id, InputSchema, OutputSchema>) {
|
|
764
|
+
new Mutation(options)
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
constructor(
|
|
768
|
+
options: MutationConstructorOptions<Id, InputSchema, OutputSchema>,
|
|
769
|
+
) {
|
|
770
|
+
this.id = options.id
|
|
771
|
+
this.name = options.name
|
|
772
|
+
this.description = options.description
|
|
773
|
+
this.inputSchema = options.inputSchema
|
|
774
|
+
this.outputSchema = options.outputSchema
|
|
775
|
+
this.outputSample = options.outputSample
|
|
776
|
+
this.implementation = options.implementation
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
toJSON() {
|
|
780
|
+
return toJSONToolDefinition(this)
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
async call(input: z.input<InputSchema>): Promise<z.output<OutputSchema>> {
|
|
784
|
+
const parsedInput = this.inputSchema.safeParse(input)
|
|
785
|
+
if (!parsedInput.success) {
|
|
786
|
+
throw new Error(
|
|
787
|
+
`Invalid input for ${this.id}: ${z.prettifyError(parsedInput.error)}`,
|
|
788
|
+
)
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
const output = await this.implementation(parsedInput.data)
|
|
792
|
+
const parsedOutput = this.outputSchema.safeParse(output)
|
|
793
|
+
if (!parsedOutput.success) {
|
|
794
|
+
throw new Error(
|
|
795
|
+
`Invalid output for ${this.id}: ${z.prettifyError(parsedOutput.error)}`,
|
|
796
|
+
)
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
return parsedOutput.data
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
type QueryImplementation<InputSchema, OutputSchema> = (
|
|
804
|
+
input: z.output<InputSchema>,
|
|
805
|
+
) => Promise<z.input<OutputSchema>>
|
|
806
|
+
|
|
807
|
+
type QueryConstructorOptions<
|
|
808
|
+
Id extends string,
|
|
809
|
+
InputSchema extends z.ZodType,
|
|
810
|
+
OutputSchema extends z.ZodType,
|
|
811
|
+
> = {
|
|
812
|
+
id: Id
|
|
813
|
+
name: string
|
|
814
|
+
description: string
|
|
815
|
+
inputSchema: InputSchema
|
|
816
|
+
outputSchema: OutputSchema
|
|
817
|
+
outputSample: NoInfer<z.infer<OutputSchema>>
|
|
818
|
+
implementation: QueryImplementation<InputSchema, OutputSchema>
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
declare class Query<
|
|
822
|
+
Id extends string,
|
|
823
|
+
InputSchema extends z.ZodType,
|
|
824
|
+
OutputSchema extends z.ZodType,
|
|
825
|
+
> implements ToolDefinition<Id, InputSchema, OutputSchema>
|
|
826
|
+
{
|
|
827
|
+
type = 'query' as const
|
|
828
|
+
|
|
829
|
+
id: Id
|
|
830
|
+
name: string
|
|
831
|
+
description: string
|
|
832
|
+
inputSchema: InputSchema
|
|
833
|
+
outputSchema: OutputSchema
|
|
834
|
+
outputSample: z.infer<OutputSchema>
|
|
835
|
+
implementation: QueryImplementation<InputSchema, OutputSchema>
|
|
836
|
+
|
|
837
|
+
static create<
|
|
838
|
+
Id extends string,
|
|
839
|
+
InputSchema extends z.ZodType,
|
|
840
|
+
OutputSchema extends z.ZodType,
|
|
841
|
+
>(options: QueryConstructorOptions<Id, InputSchema, OutputSchema>) {
|
|
842
|
+
new Query(options)
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
constructor(options: QueryConstructorOptions<Id, InputSchema, OutputSchema>) {
|
|
846
|
+
this.id = options.id
|
|
847
|
+
this.name = options.name
|
|
848
|
+
this.description = options.description
|
|
849
|
+
this.inputSchema = options.inputSchema
|
|
850
|
+
this.outputSchema = options.outputSchema
|
|
851
|
+
this.outputSample = options.outputSample
|
|
852
|
+
this.implementation = options.implementation
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
toJSON() {
|
|
856
|
+
return toJSONToolDefinition(this)
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
async call(input: z.input<InputSchema>): Promise<z.output<OutputSchema>> {
|
|
860
|
+
const parsedInput = this.inputSchema.safeParse(input)
|
|
861
|
+
if (!parsedInput.success) {
|
|
862
|
+
throw new Error(
|
|
863
|
+
`Invalid input for ${this.id}: ${z.prettifyError(parsedInput.error)}`,
|
|
864
|
+
)
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
const output = await this.implementation(parsedInput.data)
|
|
868
|
+
const parsedOutput = this.outputSchema.safeParse(output)
|
|
869
|
+
if (!parsedOutput.success) {
|
|
870
|
+
throw new Error(
|
|
871
|
+
`Invalid output for ${this.id}: ${z.prettifyError(parsedOutput.error)}`,
|
|
872
|
+
)
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
return parsedOutput.data
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
type UnsubscribeFn = () => void
|
|
880
|
+
|
|
881
|
+
type SubscriptionImplementation<InputSchema, OutputSchema> = (
|
|
882
|
+
callback: (output: z.input<OutputSchema>) => void,
|
|
883
|
+
input: z.output<InputSchema>,
|
|
884
|
+
) => Promise<UnsubscribeFn>
|
|
885
|
+
|
|
886
|
+
type SubscriptionConstructorOptions<
|
|
887
|
+
Id extends string,
|
|
888
|
+
InputSchema extends z.ZodType,
|
|
889
|
+
OutputSchema extends z.ZodType,
|
|
890
|
+
> = {
|
|
891
|
+
id: Id
|
|
892
|
+
name: string
|
|
893
|
+
description: string
|
|
894
|
+
inputSchema: InputSchema
|
|
895
|
+
outputSchema: OutputSchema
|
|
896
|
+
outputSample: NoInfer<z.infer<OutputSchema>>
|
|
897
|
+
implementation: SubscriptionImplementation<InputSchema, OutputSchema>
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
declare class Subscription<
|
|
901
|
+
Id extends string,
|
|
902
|
+
InputSchema extends z.ZodType,
|
|
903
|
+
OutputSchema extends z.ZodType,
|
|
904
|
+
> implements ToolDefinition<Id, InputSchema, OutputSchema>
|
|
905
|
+
{
|
|
906
|
+
type = 'subscription' as const
|
|
907
|
+
|
|
908
|
+
id: Id
|
|
909
|
+
name: string
|
|
910
|
+
description: string
|
|
911
|
+
inputSchema: InputSchema
|
|
912
|
+
outputSchema: OutputSchema
|
|
913
|
+
outputSample: z.infer<OutputSchema>
|
|
914
|
+
implementation: SubscriptionImplementation<InputSchema, OutputSchema>
|
|
915
|
+
|
|
916
|
+
static create<
|
|
917
|
+
Id extends string,
|
|
918
|
+
InputSchema extends z.ZodType,
|
|
919
|
+
OutputSchema extends z.ZodType,
|
|
920
|
+
>(options: SubscriptionConstructorOptions<Id, InputSchema, OutputSchema>) {
|
|
921
|
+
new Subscription(options)
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
constructor(
|
|
925
|
+
options: SubscriptionConstructorOptions<Id, InputSchema, OutputSchema>,
|
|
926
|
+
) {
|
|
927
|
+
this.id = options.id
|
|
928
|
+
this.name = options.name
|
|
929
|
+
this.description = options.description
|
|
930
|
+
this.inputSchema = options.inputSchema
|
|
931
|
+
this.outputSchema = options.outputSchema
|
|
932
|
+
this.outputSample = options.outputSample
|
|
933
|
+
this.implementation = options.implementation
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
toJSON() {
|
|
937
|
+
return toJSONToolDefinition(this)
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
async subscribe(
|
|
941
|
+
callback: (outupt: z.output<OutputSchema>) => void,
|
|
942
|
+
input: z.input<InputSchema>,
|
|
943
|
+
): Promise<UnsubscribeFn> {
|
|
944
|
+
const parsedInput = this.inputSchema.safeParse(input)
|
|
945
|
+
if (!parsedInput.success) {
|
|
946
|
+
throw new Error(
|
|
947
|
+
`Invalid input for ${this.id}: ${z.prettifyError(parsedInput.error)}`,
|
|
948
|
+
)
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
const unsubscribeFn = await this.implementation((output) => {
|
|
952
|
+
const parsedOutput = this.outputSchema.safeParse(output)
|
|
953
|
+
if (!parsedOutput.success) {
|
|
954
|
+
throw new Error(
|
|
955
|
+
`Invalid output for ${this.id}: ${z.prettifyError(parsedOutput.error)}`,
|
|
956
|
+
)
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
callback(parsedOutput.data)
|
|
960
|
+
}, parsedInput.data)
|
|
961
|
+
|
|
962
|
+
return unsubscribeFn
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
type AnyQuery = Query<string, z.ZodType, z.ZodType>
|
|
967
|
+
type AnyMutation = Mutation<string, z.ZodType, z.ZodType>
|
|
968
|
+
type AnySubscription = Subscription<string, z.ZodType, z.ZodType>
|
|
969
|
+
|
|
970
|
+
type AnyTool = AnyQuery | AnyMutation | AnySubscription
|
|
971
|
+
|
|
972
|
+
type SomeType = SomeType$1;
|
|
973
|
+
interface _ZodMiniType<out Internals extends $ZodTypeInternals = $ZodTypeInternals> extends ZodMiniType<any, any, Internals> {
|
|
974
|
+
}
|
|
975
|
+
interface ZodMiniType<out Output = unknown, out Input = unknown, out Internals extends $ZodTypeInternals<Output, Input> = $ZodTypeInternals<Output, Input>> extends $ZodType<Output, Input, Internals> {
|
|
976
|
+
type: Internals["def"]["type"];
|
|
977
|
+
check(...checks: (CheckFn<output<this>> | $ZodCheck<output<this>>)[]): this;
|
|
978
|
+
with(...checks: (CheckFn<output<this>> | $ZodCheck<output<this>>)[]): this;
|
|
979
|
+
clone(def?: Internals["def"], params?: {
|
|
980
|
+
parent: boolean;
|
|
981
|
+
}): this;
|
|
982
|
+
register<R extends $ZodRegistry>(registry: R, ...meta: this extends R["_schema"] ? undefined extends R["_meta"] ? [$replace<R["_meta"], this>?] : [$replace<R["_meta"], this>] : ["Incompatible schema"]): this;
|
|
983
|
+
brand<T extends PropertyKey = PropertyKey, Dir extends "in" | "out" | "inout" = "out">(value?: T): PropertyKey extends T ? this : $ZodBranded<this, T, Dir>;
|
|
984
|
+
def: Internals["def"];
|
|
985
|
+
parse(data: unknown, params?: ParseContext<$ZodIssue>): output<this>;
|
|
986
|
+
safeParse(data: unknown, params?: ParseContext<$ZodIssue>): SafeParseResult<output<this>>;
|
|
987
|
+
parseAsync(data: unknown, params?: ParseContext<$ZodIssue>): Promise<output<this>>;
|
|
988
|
+
safeParseAsync(data: unknown, params?: ParseContext<$ZodIssue>): Promise<SafeParseResult<output<this>>>;
|
|
989
|
+
apply<T>(fn: (schema: this) => T): T;
|
|
990
|
+
}
|
|
991
|
+
declare const ZodMiniType: $constructor<ZodMiniType>;
|
|
992
|
+
interface _ZodMiniString<T extends $ZodStringInternals<unknown> = $ZodStringInternals<unknown>> extends _ZodMiniType<T>, $ZodString<T["input"]> {
|
|
993
|
+
_zod: T;
|
|
994
|
+
}
|
|
995
|
+
interface ZodMiniString<Input = unknown> extends _ZodMiniString<$ZodStringInternals<Input>>, $ZodString<Input> {
|
|
996
|
+
}
|
|
997
|
+
declare const ZodMiniString: $constructor<ZodMiniString>;
|
|
998
|
+
interface ZodMiniURL extends _ZodMiniString<$ZodURLInternals> {
|
|
999
|
+
}
|
|
1000
|
+
declare const ZodMiniURL: $constructor<ZodMiniURL>;
|
|
1001
|
+
interface _ZodMiniNumber<T extends $ZodNumberInternals<unknown> = $ZodNumberInternals<unknown>> extends _ZodMiniType<T>, $ZodNumber<T["input"]> {
|
|
1002
|
+
_zod: T;
|
|
1003
|
+
}
|
|
1004
|
+
interface ZodMiniNumber<Input = unknown> extends _ZodMiniNumber<$ZodNumberInternals<Input>>, $ZodNumber<Input> {
|
|
1005
|
+
}
|
|
1006
|
+
declare const ZodMiniNumber: $constructor<ZodMiniNumber>;
|
|
1007
|
+
interface ZodMiniUnknown extends _ZodMiniType<$ZodUnknownInternals> {
|
|
1008
|
+
}
|
|
1009
|
+
declare const ZodMiniUnknown: $constructor<ZodMiniUnknown>;
|
|
1010
|
+
interface ZodMiniObject<
|
|
1011
|
+
/** @ts-ignore Cast variance */
|
|
1012
|
+
out Shape extends $ZodShape = $ZodShape, out Config extends $ZodObjectConfig = $strip> extends ZodMiniType<any, any, $ZodObjectInternals<Shape, Config>>, $ZodObject<Shape, Config> {
|
|
1013
|
+
shape: Shape;
|
|
1014
|
+
}
|
|
1015
|
+
declare const ZodMiniObject: $constructor<ZodMiniObject>;
|
|
1016
|
+
interface ZodMiniRecord<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType = $ZodType> extends _ZodMiniType<$ZodRecordInternals<Key, Value>> {
|
|
1017
|
+
}
|
|
1018
|
+
declare const ZodMiniRecord: $constructor<ZodMiniRecord>;
|
|
1019
|
+
interface ZodMiniEnum<T extends EnumLike = EnumLike> extends _ZodMiniType<$ZodEnumInternals<T>> {
|
|
1020
|
+
options: Array<T[keyof T]>;
|
|
1021
|
+
}
|
|
1022
|
+
declare const ZodMiniEnum: $constructor<ZodMiniEnum>;
|
|
1023
|
+
interface ZodMiniNullable<T extends SomeType = $ZodType> extends _ZodMiniType<$ZodNullableInternals<T>> {
|
|
1024
|
+
}
|
|
1025
|
+
declare const ZodMiniNullable: $constructor<ZodMiniNullable>;
|
|
1026
|
+
|
|
1027
|
+
declare const $Sprite: ZodMiniObject<{
|
|
1028
|
+
id: ZodMiniString<string>;
|
|
1029
|
+
name: ZodMiniString<string>;
|
|
1030
|
+
ownedByPersonId: ZodMiniString<string>;
|
|
1031
|
+
publishedSpriteBuild: ZodMiniNullable<ZodMiniObject<{
|
|
1032
|
+
id: ZodMiniString<string>;
|
|
1033
|
+
spriteId: ZodMiniString<string>;
|
|
1034
|
+
parentSpriteBuildId: ZodMiniNullable<ZodMiniString<string>>;
|
|
1035
|
+
createdByPerson: ZodMiniObject<{
|
|
1036
|
+
id: ZodMiniString<string>;
|
|
1037
|
+
name: ZodMiniString<string>;
|
|
1038
|
+
}, $strip>;
|
|
1039
|
+
prompt: ZodMiniString<string>;
|
|
1040
|
+
status: ZodMiniEnum<{
|
|
1041
|
+
PENDING: "PENDING";
|
|
1042
|
+
IN_PROGRESS: "IN_PROGRESS";
|
|
1043
|
+
READY: "READY";
|
|
1044
|
+
ERROR: "ERROR";
|
|
1045
|
+
}>;
|
|
1046
|
+
artifactUrl: ZodMiniNullable<ZodMiniURL>;
|
|
1047
|
+
sourceUrl: ZodMiniNullable<ZodMiniURL>;
|
|
1048
|
+
startedAt: ZodMiniNullable<ZodMiniNumber<number>>;
|
|
1049
|
+
stoppedAt: ZodMiniNullable<ZodMiniNumber<number>>;
|
|
1050
|
+
error: ZodMiniNullable<ZodMiniRecord<ZodMiniString<string>, ZodMiniUnknown>>;
|
|
1051
|
+
reasoningSummary: ZodMiniNullable<ZodMiniString<string>>;
|
|
1052
|
+
publishedAt: ZodMiniNullable<ZodMiniNumber<number>>;
|
|
1053
|
+
}, $strip>>;
|
|
1054
|
+
}, $strip>;
|
|
1055
|
+
type Sprite = output<typeof $Sprite>;
|
|
1056
|
+
|
|
1057
|
+
declare const $SpriteBuild: ZodMiniObject<{
|
|
1058
|
+
id: ZodMiniString<string>;
|
|
1059
|
+
spriteId: ZodMiniString<string>;
|
|
1060
|
+
parentSpriteBuildId: ZodMiniNullable<ZodMiniString<string>>;
|
|
1061
|
+
createdByPerson: ZodMiniObject<{
|
|
1062
|
+
id: ZodMiniString<string>;
|
|
1063
|
+
name: ZodMiniString<string>;
|
|
1064
|
+
}, $strip>;
|
|
1065
|
+
prompt: ZodMiniString<string>;
|
|
1066
|
+
status: ZodMiniEnum<{
|
|
1067
|
+
PENDING: "PENDING";
|
|
1068
|
+
IN_PROGRESS: "IN_PROGRESS";
|
|
1069
|
+
READY: "READY";
|
|
1070
|
+
ERROR: "ERROR";
|
|
1071
|
+
}>;
|
|
1072
|
+
artifactUrl: ZodMiniNullable<ZodMiniURL>;
|
|
1073
|
+
sourceUrl: ZodMiniNullable<ZodMiniURL>;
|
|
1074
|
+
startedAt: ZodMiniNullable<ZodMiniNumber<number>>;
|
|
1075
|
+
stoppedAt: ZodMiniNullable<ZodMiniNumber<number>>;
|
|
1076
|
+
error: ZodMiniNullable<ZodMiniRecord<ZodMiniString<string>, ZodMiniUnknown>>;
|
|
1077
|
+
reasoningSummary: ZodMiniNullable<ZodMiniString<string>>;
|
|
1078
|
+
publishedAt: ZodMiniNullable<ZodMiniNumber<number>>;
|
|
1079
|
+
}, $strip>;
|
|
1080
|
+
type SpriteBuild = output<typeof $SpriteBuild>;
|
|
1081
|
+
|
|
1082
|
+
type SurfaceDefinition = {
|
|
1083
|
+
key: string;
|
|
1084
|
+
name: string;
|
|
1085
|
+
description: string;
|
|
1086
|
+
toolList: readonly AnyTool[];
|
|
1087
|
+
};
|
|
1088
|
+
declare const defineSurface: (config: SurfaceDefinition) => SurfaceDefinition;
|
|
1089
|
+
|
|
1090
|
+
declare const getRoughFeatures: (surface: SurfaceDefinition, callback: (features: Sprite[]) => void) => (() => void);
|
|
1091
|
+
|
|
1092
|
+
type FetchUserTokenFn = () => string | Promise<string>;
|
|
1093
|
+
|
|
1094
|
+
type SurfaceEntry = {
|
|
1095
|
+
surfaceId: string;
|
|
1096
|
+
toolList: readonly AnyTool[];
|
|
1097
|
+
triggerRefresh: () => void;
|
|
1098
|
+
};
|
|
1099
|
+
declare const registerSurfaceEntry: (key: string, entry: SurfaceEntry) => (() => void);
|
|
1100
|
+
|
|
1101
|
+
type InitRoughOptions = {
|
|
1102
|
+
baseUrl?: string;
|
|
1103
|
+
projectId: string;
|
|
1104
|
+
fetchUserToken: FetchUserTokenFn;
|
|
1105
|
+
};
|
|
1106
|
+
declare const initRough: (options: InitRoughOptions) => void;
|
|
1107
|
+
|
|
1108
|
+
type OpenRoughCreateOptions = {
|
|
1109
|
+
projectId?: string;
|
|
1110
|
+
};
|
|
1111
|
+
declare const openRoughCreate: (surface: SurfaceDefinition, options?: OpenRoughCreateOptions) => void;
|
|
1112
|
+
|
|
1113
|
+
type Props$9 = {
|
|
1114
|
+
children?: Snippet;
|
|
1115
|
+
class?: string;
|
|
1116
|
+
type?: 'button' | 'submit' | 'reset';
|
|
1117
|
+
disabled?: boolean;
|
|
1118
|
+
onclick?: (event: MouseEvent) => void;
|
|
1119
|
+
role?: string;
|
|
1120
|
+
block?: boolean;
|
|
1121
|
+
iconOnly?: boolean;
|
|
1122
|
+
alignStart?: boolean;
|
|
1123
|
+
'aria-label'?: string;
|
|
1124
|
+
'aria-haspopup'?: boolean | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog';
|
|
1125
|
+
'aria-expanded'?: boolean;
|
|
1126
|
+
};
|
|
1127
|
+
declare const PrimaryButton: svelte.Component<Props$9, {}, "">;
|
|
1128
|
+
type PrimaryButton = ReturnType<typeof PrimaryButton>;
|
|
1129
|
+
|
|
1130
|
+
type ResizableHandle = {
|
|
1131
|
+
class: string;
|
|
1132
|
+
role: 'separator';
|
|
1133
|
+
'aria-orientation': 'horizontal';
|
|
1134
|
+
'aria-label': string;
|
|
1135
|
+
title: string;
|
|
1136
|
+
onpointerdown: (event: PointerEvent) => void;
|
|
1137
|
+
onpointermove: (event: PointerEvent) => void;
|
|
1138
|
+
onpointerup: (event: PointerEvent) => void;
|
|
1139
|
+
onpointercancel: (event: PointerEvent) => void;
|
|
1140
|
+
ondblclick: () => void;
|
|
1141
|
+
destroy: (node: HTMLElement) => void;
|
|
1142
|
+
};
|
|
1143
|
+
|
|
1144
|
+
type Props$8 = {
|
|
1145
|
+
handle: ResizableHandle;
|
|
1146
|
+
children?: Snippet;
|
|
1147
|
+
class?: string;
|
|
1148
|
+
};
|
|
1149
|
+
declare const ResizeHandle: svelte.Component<Props$8, {}, "">;
|
|
1150
|
+
type ResizeHandle = ReturnType<typeof ResizeHandle>;
|
|
1151
|
+
|
|
1152
|
+
type Props$7 = {
|
|
1153
|
+
toolList: readonly AnyTool[];
|
|
1154
|
+
surfaceId: string;
|
|
1155
|
+
projectId?: string;
|
|
1156
|
+
onclose?: () => void;
|
|
1157
|
+
onpublish?: (sprite: Sprite, spriteBuild: SpriteBuild) => void;
|
|
1158
|
+
};
|
|
1159
|
+
declare const RoughCreateModal: svelte.Component<Props$7, {}, "">;
|
|
1160
|
+
type RoughCreateModal = ReturnType<typeof RoughCreateModal>;
|
|
1161
|
+
|
|
1162
|
+
type Props$6 = {
|
|
1163
|
+
toolList: readonly AnyTool[];
|
|
1164
|
+
label?: string;
|
|
1165
|
+
spriteId: string;
|
|
1166
|
+
onpublish?: (sprite: Sprite, spriteBuild: SpriteBuild) => void;
|
|
1167
|
+
};
|
|
1168
|
+
declare const RoughEditButton: svelte.Component<Props$6, {}, "">;
|
|
1169
|
+
type RoughEditButton = ReturnType<typeof RoughEditButton>;
|
|
1170
|
+
|
|
1171
|
+
type JsonValue = null | boolean | number | string | JsonValue[] | {
|
|
1172
|
+
[key: string]: JsonValue;
|
|
1173
|
+
};
|
|
1174
|
+
type SpriteFrameDatastore = {
|
|
1175
|
+
get: () => JsonValue | undefined;
|
|
1176
|
+
set: (state: JsonValue) => void | Promise<void>;
|
|
1177
|
+
addListener: (callback: (state: JsonValue) => void) => () => void;
|
|
1178
|
+
};
|
|
1179
|
+
type SpriteFrameDatastoreContext = {
|
|
1180
|
+
spriteId: string;
|
|
1181
|
+
spriteInstanceId: string;
|
|
1182
|
+
};
|
|
1183
|
+
|
|
1184
|
+
type Props$5 = {
|
|
1185
|
+
featureId: string;
|
|
1186
|
+
buildId: string;
|
|
1187
|
+
surfaceKey: string;
|
|
1188
|
+
datastore?: SpriteFrameDatastore;
|
|
1189
|
+
};
|
|
1190
|
+
declare const RoughFeature: svelte.Component<Props$5, {}, "">;
|
|
1191
|
+
type RoughFeature = ReturnType<typeof RoughFeature>;
|
|
1192
|
+
|
|
1193
|
+
type Props$4 = {
|
|
1194
|
+
surface: SurfaceDefinition;
|
|
1195
|
+
getDatastore?: (context: SpriteFrameDatastoreContext) => SpriteFrameDatastore | undefined;
|
|
1196
|
+
};
|
|
1197
|
+
declare const RoughSurface: svelte.Component<Props$4, {}, "">;
|
|
1198
|
+
type RoughSurface = ReturnType<typeof RoughSurface>;
|
|
1199
|
+
|
|
1200
|
+
type Props$3 = {
|
|
1201
|
+
children?: Snippet;
|
|
1202
|
+
class?: string;
|
|
1203
|
+
type?: 'button' | 'submit' | 'reset';
|
|
1204
|
+
disabled?: boolean;
|
|
1205
|
+
onclick?: (event: MouseEvent) => void;
|
|
1206
|
+
role?: string;
|
|
1207
|
+
block?: boolean;
|
|
1208
|
+
iconOnly?: boolean;
|
|
1209
|
+
alignStart?: boolean;
|
|
1210
|
+
'aria-label'?: string;
|
|
1211
|
+
'aria-haspopup'?: boolean | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog';
|
|
1212
|
+
'aria-expanded'?: boolean;
|
|
1213
|
+
};
|
|
1214
|
+
declare const SecondaryButton: svelte.Component<Props$3, {}, "">;
|
|
1215
|
+
type SecondaryButton = ReturnType<typeof SecondaryButton>;
|
|
1216
|
+
|
|
1217
|
+
type Props$2 = {
|
|
1218
|
+
surfaceId: string;
|
|
1219
|
+
onselect?: (sprite: Sprite, spriteBuild: SpriteBuild) => Promise<void> | void;
|
|
1220
|
+
};
|
|
1221
|
+
declare const SpriteBuildMenu: svelte.Component<Props$2, {}, "">;
|
|
1222
|
+
type SpriteBuildMenu = ReturnType<typeof SpriteBuildMenu>;
|
|
1223
|
+
|
|
1224
|
+
type Props$1 = {
|
|
1225
|
+
spriteId: string;
|
|
1226
|
+
spriteBuildId: string;
|
|
1227
|
+
artifactUrl?: string;
|
|
1228
|
+
toolList: readonly AnyTool[];
|
|
1229
|
+
datastore?: SpriteFrameDatastore;
|
|
1230
|
+
isMock?: boolean;
|
|
1231
|
+
spriteInstanceId: string | undefined;
|
|
1232
|
+
minHeight?: number;
|
|
1233
|
+
maxHeight?: number;
|
|
1234
|
+
};
|
|
1235
|
+
declare const SpriteFrame: svelte.Component<Props$1, {}, "">;
|
|
1236
|
+
type SpriteFrame = ReturnType<typeof SpriteFrame>;
|
|
1237
|
+
|
|
1238
|
+
type Props = {
|
|
1239
|
+
toolList: readonly AnyTool[];
|
|
1240
|
+
spriteId: string;
|
|
1241
|
+
onclose?: () => void;
|
|
1242
|
+
onpublish?: (sprite: Sprite, spriteBuild: SpriteBuild) => void;
|
|
1243
|
+
};
|
|
1244
|
+
declare const RoughEditModal: svelte.Component<Props, {}, "">;
|
|
1245
|
+
type RoughEditModal = ReturnType<typeof RoughEditModal>;
|
|
1246
|
+
|
|
1247
|
+
/**
|
|
1248
|
+
* DOM custom-element typings for the published npm artifact.
|
|
1249
|
+
*
|
|
1250
|
+
* This module is NOT part of the runtime bundle — it is a types-only source
|
|
1251
|
+
* file fed into the declaration bundler (`scripts/build-package-types.ts`) so
|
|
1252
|
+
* `dist/index.d.ts` teaches customer TypeScript about the public custom-element
|
|
1253
|
+
* tags. Element property shapes are derived from the generated Svelte component
|
|
1254
|
+
* prop types rather than hand-duplicated, so they stay in sync with the
|
|
1255
|
+
* components.
|
|
1256
|
+
*/
|
|
1257
|
+
|
|
1258
|
+
type RoughSurfaceElement = HTMLElement & ComponentProps<typeof RoughSurface>;
|
|
1259
|
+
type RoughCreateModalElement = HTMLElement & ComponentProps<typeof RoughCreateModal>;
|
|
1260
|
+
type RoughEditModalElement = HTMLElement & ComponentProps<typeof RoughEditModal>;
|
|
1261
|
+
type RoughEditButtonElement = HTMLElement & ComponentProps<typeof RoughEditButton>;
|
|
1262
|
+
type RoughFeatureElement = HTMLElement & ComponentProps<typeof RoughFeature>;
|
|
1263
|
+
declare global {
|
|
1264
|
+
interface HTMLElementTagNameMap {
|
|
1265
|
+
'rough-surface': RoughSurfaceElement;
|
|
1266
|
+
'rough-create-modal': RoughCreateModalElement;
|
|
1267
|
+
'rough-edit-modal': RoughEditModalElement;
|
|
1268
|
+
'rough-edit-button': RoughEditButtonElement;
|
|
1269
|
+
'rough-feature': RoughFeatureElement;
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
export { Mutation, PrimaryButton, Query, ResizeHandle, RoughCreateModal, RoughEditButton, RoughFeature, RoughSurface, SecondaryButton, SpriteBuildMenu, SpriteFrame, Subscription, defineSurface, getRoughFeatures, initRough, openRoughCreate, registerSurfaceEntry };
|
|
1274
|
+
export type { JsonValue, RoughCreateModalElement, RoughEditButtonElement, RoughEditModalElement, RoughFeatureElement, RoughSurfaceElement, Sprite, SpriteBuild, SpriteFrameDatastore, SpriteFrameDatastoreContext, SurfaceDefinition };
|