@statelyai/sdk 0.40.0 → 0.41.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 +10 -0
- package/dist/assetStorage.d.mts +1 -1
- package/dist/chunk-D1OLi6Wq.mjs +46 -0
- package/dist/editorHostProtocol.d.mts +3 -3
- package/dist/embed.d.mts +4 -3
- package/dist/embed.mjs +1 -1
- package/dist/{graph-9CApplKH.d.mts → graph-DbZdSisK.d.mts} +1 -1
- package/dist/graph.d.mts +1 -1
- package/dist/{index-gyYPC8rD.d.mts → index-DqF1xP8P.d.mts} +50 -399
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +3 -3
- package/dist/{inspect-COd1d8sJ.mjs → inspect-CDjr4saL.mjs} +1 -1
- package/dist/{inspect-C8SpNJKF.d.mts → inspect-ruD95iBM.d.mts} +1 -1
- package/dist/inspect.d.mts +2 -2
- package/dist/inspect.mjs +2 -2
- package/dist/machineGraph-DYtFKHlq-BpWpGU22.mjs +3 -0
- package/dist/machineGraph-DYtFKHlq-ChbeTHlv.mjs +1023 -0
- package/dist/patchTypes.d.mts +1 -1
- package/dist/{protocol-DUehXGus.d.mts → protocol-BvElOcXs.d.mts} +4 -3
- package/dist/protocol.d.mts +1 -1
- package/dist/relay.d.mts +1 -1
- package/dist/rolldown-runtime-95iHPtFO-Bo6l7CbO.mjs +114 -0
- package/dist/{studio-D0XNCqKr.mjs → schemas-DsQ8UYlM.mjs} +36 -1649
- package/dist/sourceCoverage.d.mts +101 -0
- package/dist/sourceCoverage.mjs +3572 -0
- package/dist/studio-DH7OeLao.mjs +1604 -0
- package/dist/{studio-DeFtdrGS.d.mts → studio-DRw9sxCm.d.mts} +10 -2
- package/dist/studio.d.mts +1 -1
- package/dist/studio.mjs +1 -1
- package/dist/{version-CRlxeCo2.mjs → version-eag6cuvm.mjs} +1 -1
- package/dist/xstateSource-BUCx2xA4-CWteIFJn.d.mts +451 -0
- package/dist/xstateSource-JvwXWv6G-KnMMoZlG.mjs +151753 -0
- package/package.json +7 -3
- /package/dist/{editor-sync-types-Ch5P5XRj.d.mts → editor-sync-types-BjgSBGxf.d.mts} +0 -0
- /package/dist/{patchTypes-BZ7gzwAP.d.mts → patchTypes-BFlvJTDJ.d.mts} +0 -0
|
@@ -1,340 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as __exportAll } from "./chunk-D1OLi6Wq.mjs";
|
|
2
2
|
|
|
3
|
-
//#region \0rolldown/runtime.js
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
6
|
-
var __exportAll = (all, no_symbols) => {
|
|
7
|
-
let target = {};
|
|
8
|
-
for (var name in all) {
|
|
9
|
-
__defProp(target, name, {
|
|
10
|
-
get: all[name],
|
|
11
|
-
enumerable: true
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
if (!no_symbols) {
|
|
15
|
-
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
16
|
-
}
|
|
17
|
-
return target;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
//#endregion
|
|
21
|
-
//#region ../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@8.5.0_zod@4.4.3/node_modules/@asteasolutions/zod-to-openapi/dist/index.cjs
|
|
22
|
-
var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
23
|
-
/******************************************************************************
|
|
24
|
-
Copyright (c) Microsoft Corporation.
|
|
25
|
-
|
|
26
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
27
|
-
purpose with or without fee is hereby granted.
|
|
28
|
-
|
|
29
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
30
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
31
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
32
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
33
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
34
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
35
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
36
|
-
***************************************************************************** */
|
|
37
|
-
function __rest(s, e) {
|
|
38
|
-
var t = {};
|
|
39
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
40
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function") {
|
|
41
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
42
|
-
}
|
|
43
|
-
return t;
|
|
44
|
-
}
|
|
45
|
-
const ZodTypeKeys = {
|
|
46
|
-
ZodAny: "any",
|
|
47
|
-
ZodArray: "array",
|
|
48
|
-
ZodBigInt: "bigint",
|
|
49
|
-
ZodBoolean: "boolean",
|
|
50
|
-
ZodDefault: "default",
|
|
51
|
-
ZodPrefault: "prefault",
|
|
52
|
-
ZodTransform: "transform",
|
|
53
|
-
ZodEnum: "enum",
|
|
54
|
-
ZodIntersection: "intersection",
|
|
55
|
-
ZodLazy: "lazy",
|
|
56
|
-
ZodLiteral: "literal",
|
|
57
|
-
ZodNever: "never",
|
|
58
|
-
ZodNull: "null",
|
|
59
|
-
ZodNullable: "nullable",
|
|
60
|
-
ZodNumber: "number",
|
|
61
|
-
ZodNonOptional: "nonoptional",
|
|
62
|
-
ZodObject: "object",
|
|
63
|
-
ZodOptional: "optional",
|
|
64
|
-
ZodPipe: "pipe",
|
|
65
|
-
ZodReadonly: "readonly",
|
|
66
|
-
ZodRecord: "record",
|
|
67
|
-
ZodString: "string",
|
|
68
|
-
ZodTuple: "tuple",
|
|
69
|
-
ZodType: "type",
|
|
70
|
-
ZodUnion: "union",
|
|
71
|
-
ZodDiscriminatedUnion: "union",
|
|
72
|
-
ZodUnknown: "unknown",
|
|
73
|
-
ZodVoid: "void",
|
|
74
|
-
ZodDate: "date",
|
|
75
|
-
ZodTemplateLiteral: "template_literal"
|
|
76
|
-
};
|
|
77
|
-
function isZodType(schema, typeNames) {
|
|
78
|
-
return (Array.isArray(typeNames) ? typeNames : [typeNames]).some((typeName) => {
|
|
79
|
-
var _a;
|
|
80
|
-
const typeNameMatch = ((_a = schema === null || schema === void 0 ? void 0 : schema.def) === null || _a === void 0 ? void 0 : _a.type) === ZodTypeKeys[typeName];
|
|
81
|
-
if (typeName === "ZodDiscriminatedUnion") return typeNameMatch && "discriminator" in schema.def;
|
|
82
|
-
return typeNameMatch;
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
function isAnyZodType(schema) {
|
|
86
|
-
return schema && "def" in schema;
|
|
87
|
-
}
|
|
88
|
-
var $ZodRegistry = class {
|
|
89
|
-
constructor() {
|
|
90
|
-
this._map = /* @__PURE__ */ new Map();
|
|
91
|
-
this._idmap = /* @__PURE__ */ new Map();
|
|
92
|
-
}
|
|
93
|
-
add(schema, ..._meta) {
|
|
94
|
-
const meta = _meta[0];
|
|
95
|
-
this._map.set(schema, meta);
|
|
96
|
-
if (meta && typeof meta === "object" && "id" in meta) {
|
|
97
|
-
if (this._idmap.has(meta.id)) throw new Error(`ID ${meta.id} already exists in the registry`);
|
|
98
|
-
this._idmap.set(meta.id, schema);
|
|
99
|
-
}
|
|
100
|
-
return this;
|
|
101
|
-
}
|
|
102
|
-
clear() {
|
|
103
|
-
this._map = /* @__PURE__ */ new Map();
|
|
104
|
-
this._idmap = /* @__PURE__ */ new Map();
|
|
105
|
-
return this;
|
|
106
|
-
}
|
|
107
|
-
remove(schema) {
|
|
108
|
-
const meta = this._map.get(schema);
|
|
109
|
-
if (meta && typeof meta === "object" && "id" in meta) this._idmap.delete(meta.id);
|
|
110
|
-
this._map.delete(schema);
|
|
111
|
-
return this;
|
|
112
|
-
}
|
|
113
|
-
get(schema) {
|
|
114
|
-
const p = schema._zod.parent;
|
|
115
|
-
if (p) {
|
|
116
|
-
const pm = { ...this.get(p) ?? {} };
|
|
117
|
-
delete pm.id;
|
|
118
|
-
return {
|
|
119
|
-
...pm,
|
|
120
|
-
...this._map.get(schema)
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
return this._map.get(schema);
|
|
124
|
-
}
|
|
125
|
-
has(schema) {
|
|
126
|
-
return this._map.has(schema);
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
function registry() {
|
|
130
|
-
return new $ZodRegistry();
|
|
131
|
-
}
|
|
132
|
-
function isUndefined(value) {
|
|
133
|
-
return value === void 0;
|
|
134
|
-
}
|
|
135
|
-
function omit(object, keys) {
|
|
136
|
-
const result = {};
|
|
137
|
-
Object.entries(object).forEach(([key, value]) => {
|
|
138
|
-
if (!keys.some((keyToOmit) => keyToOmit === key)) result[key] = value;
|
|
139
|
-
});
|
|
140
|
-
return result;
|
|
141
|
-
}
|
|
142
|
-
function omitBy(object, predicate) {
|
|
143
|
-
const result = {};
|
|
144
|
-
Object.entries(object).forEach(([key, value]) => {
|
|
145
|
-
if (!predicate(value, key)) result[key] = value;
|
|
146
|
-
});
|
|
147
|
-
return result;
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* @deprecated This is not really deprecated but this should always be used with
|
|
151
|
-
* caution. Using it may alter the behavior of the library and the generated schemas.
|
|
152
|
-
*/
|
|
153
|
-
const zodToOpenAPIRegistry = registry();
|
|
154
|
-
var Metadata = class {
|
|
155
|
-
static collectMetadata(schema, metadata) {
|
|
156
|
-
const currentMetadata = this.getMetadataFromRegistry(schema);
|
|
157
|
-
const _internal = Object.assign(Object.assign({}, currentMetadata === null || currentMetadata === void 0 ? void 0 : currentMetadata._internal), metadata === null || metadata === void 0 ? void 0 : metadata._internal);
|
|
158
|
-
const param = Object.assign(Object.assign({}, currentMetadata === null || currentMetadata === void 0 ? void 0 : currentMetadata.param), metadata === null || metadata === void 0 ? void 0 : metadata.param);
|
|
159
|
-
const totalMetadata = Object.assign(Object.assign(Object.assign(Object.assign({}, Object.keys(_internal).length > 0 ? { _internal } : {}), currentMetadata), metadata), Object.keys(param).length > 0 ? { param } : {});
|
|
160
|
-
if (isZodType(schema, [
|
|
161
|
-
"ZodOptional",
|
|
162
|
-
"ZodNullable",
|
|
163
|
-
"ZodDefault",
|
|
164
|
-
"ZodPrefault",
|
|
165
|
-
"ZodReadonly",
|
|
166
|
-
"ZodNonOptional"
|
|
167
|
-
]) && isAnyZodType(schema._zod.def.innerType)) return this.collectMetadata(schema._zod.def.innerType, totalMetadata);
|
|
168
|
-
if (isZodType(schema, "ZodPipe")) {
|
|
169
|
-
const inSchema = schema._zod.def.in;
|
|
170
|
-
const outSchema = schema._zod.def.out;
|
|
171
|
-
if (isZodType(inSchema, "ZodTransform") && isAnyZodType(outSchema)) return this.collectMetadata(outSchema, totalMetadata);
|
|
172
|
-
if (isAnyZodType(inSchema)) return this.collectMetadata(inSchema, totalMetadata);
|
|
173
|
-
}
|
|
174
|
-
return totalMetadata;
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* @deprecated Use one of `getOpenApiMetadata` or `getInternalMetadata` instead
|
|
178
|
-
*/
|
|
179
|
-
static getMetadata(zodSchema) {
|
|
180
|
-
return this.collectMetadata(zodSchema);
|
|
181
|
-
}
|
|
182
|
-
static getOpenApiMetadata(zodSchema) {
|
|
183
|
-
const metadata = this.collectMetadata(zodSchema);
|
|
184
|
-
const _a = metadata !== null && metadata !== void 0 ? metadata : {}, { _internal } = _a;
|
|
185
|
-
return __rest(_a, ["_internal"]);
|
|
186
|
-
}
|
|
187
|
-
static getInternalMetadata(zodSchema) {
|
|
188
|
-
var _a;
|
|
189
|
-
return (_a = this.collectMetadata(zodSchema)) === null || _a === void 0 ? void 0 : _a._internal;
|
|
190
|
-
}
|
|
191
|
-
static getParamMetadata(zodSchema) {
|
|
192
|
-
const metadata = this.collectMetadata(zodSchema);
|
|
193
|
-
return Object.assign(Object.assign({}, metadata), { param: Object.assign(Object.assign({}, (metadata === null || metadata === void 0 ? void 0 : metadata.description) ? { description: metadata.description } : {}), metadata === null || metadata === void 0 ? void 0 : metadata.param) });
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* A method that omits all custom keys added to the regular OpenAPI
|
|
197
|
-
* metadata properties
|
|
198
|
-
*/
|
|
199
|
-
static buildSchemaMetadata(metadata) {
|
|
200
|
-
return omitBy(omit(metadata, ["param", "_internal"]), isUndefined);
|
|
201
|
-
}
|
|
202
|
-
static buildParameterMetadata(metadata) {
|
|
203
|
-
return omitBy(metadata, isUndefined);
|
|
204
|
-
}
|
|
205
|
-
static applySchemaMetadata(initialData, metadata) {
|
|
206
|
-
return omitBy(Object.assign(Object.assign({}, initialData), this.buildSchemaMetadata(metadata)), isUndefined);
|
|
207
|
-
}
|
|
208
|
-
static getRefId(zodSchema) {
|
|
209
|
-
var _a;
|
|
210
|
-
return (_a = this.getInternalMetadata(zodSchema)) === null || _a === void 0 ? void 0 : _a.refId;
|
|
211
|
-
}
|
|
212
|
-
static unwrapChained(schema) {
|
|
213
|
-
return this.unwrapUntil(schema);
|
|
214
|
-
}
|
|
215
|
-
static getDefaultValue(zodSchema) {
|
|
216
|
-
var _a;
|
|
217
|
-
const unwrapped = (_a = this.unwrapUntil(zodSchema, "ZodDefault")) !== null && _a !== void 0 ? _a : this.unwrapUntil(zodSchema, "ZodPrefault");
|
|
218
|
-
return unwrapped === null || unwrapped === void 0 ? void 0 : unwrapped._zod.def.defaultValue;
|
|
219
|
-
}
|
|
220
|
-
static unwrapUntil(schema, typeName) {
|
|
221
|
-
if (typeName && isZodType(schema, typeName)) return schema;
|
|
222
|
-
if (isZodType(schema, [
|
|
223
|
-
"ZodOptional",
|
|
224
|
-
"ZodNullable",
|
|
225
|
-
"ZodDefault",
|
|
226
|
-
"ZodPrefault",
|
|
227
|
-
"ZodReadonly",
|
|
228
|
-
"ZodNonOptional"
|
|
229
|
-
]) && isAnyZodType(schema._zod.def.innerType)) return this.unwrapUntil(schema._zod.def.innerType, typeName);
|
|
230
|
-
if (isZodType(schema, "ZodPipe")) {
|
|
231
|
-
const inSchema = schema._zod.def.in;
|
|
232
|
-
const outSchema = schema._zod.def.out;
|
|
233
|
-
if (isZodType(inSchema, "ZodTransform") && isAnyZodType(outSchema)) return this.unwrapUntil(outSchema, typeName);
|
|
234
|
-
if (isAnyZodType(inSchema)) return this.unwrapUntil(inSchema, typeName);
|
|
235
|
-
}
|
|
236
|
-
return typeName ? void 0 : schema;
|
|
237
|
-
}
|
|
238
|
-
static getMetadataFromInternalRegistry(zodSchema) {
|
|
239
|
-
return zodToOpenAPIRegistry.get(zodSchema);
|
|
240
|
-
}
|
|
241
|
-
static getMetadataFromRegistry(zodSchema) {
|
|
242
|
-
const internal = this.getMetadataFromInternalRegistry(zodSchema);
|
|
243
|
-
const general = zodSchema.meta();
|
|
244
|
-
if (!internal) return general;
|
|
245
|
-
const { _internal } = internal, rest = __rest(internal, ["_internal"]);
|
|
246
|
-
const _a = general !== null && general !== void 0 ? general : {}, { id, title } = _a, restGeneral = __rest(_a, ["id", "title"]);
|
|
247
|
-
return Object.assign(Object.assign(Object.assign({ _internal: Object.assign(Object.assign({}, id ? { refId: id } : {}), _internal) }, rest), title ? { description: title } : {}), restGeneral);
|
|
248
|
-
}
|
|
249
|
-
static setMetadataInRegistry(zodSchema, metadata) {
|
|
250
|
-
zodToOpenAPIRegistry.add(zodSchema, metadata);
|
|
251
|
-
}
|
|
252
|
-
};
|
|
253
|
-
function preserveMetadataFromModifier(zodSchema, modifier) {
|
|
254
|
-
const zodModifier = zodSchema[modifier];
|
|
255
|
-
if (typeof zodModifier !== "function") return;
|
|
256
|
-
zodSchema[modifier] = function(...args) {
|
|
257
|
-
const result = zodModifier.apply(this, args);
|
|
258
|
-
const meta = Metadata.getMetadataFromRegistry(this);
|
|
259
|
-
if (meta) Metadata.setMetadataInRegistry(result, meta);
|
|
260
|
-
return result;
|
|
261
|
-
};
|
|
262
|
-
}
|
|
263
|
-
function extendZodWithOpenApi(zod) {
|
|
264
|
-
if (typeof zod.ZodType.prototype.openapi !== "undefined") return;
|
|
265
|
-
zod.ZodType.prototype.openapi = function(...args) {
|
|
266
|
-
const { refId, metadata, options } = getOpenApiConfiguration(...args);
|
|
267
|
-
const _a = metadata !== null && metadata !== void 0 ? metadata : {}, { param } = _a, restOfOpenApi = __rest(_a, ["param"]);
|
|
268
|
-
const allMetadata = Metadata.getMetadataFromRegistry(this);
|
|
269
|
-
const _b = allMetadata !== null && allMetadata !== void 0 ? allMetadata : {}, { _internal: internalMetadata } = _b, currentMetadata = __rest(_b, ["_internal"]);
|
|
270
|
-
const _internal = Object.assign(Object.assign(Object.assign({}, internalMetadata), options), refId ? { refId } : void 0);
|
|
271
|
-
const resultMetadata = Object.assign(Object.assign(Object.assign({}, currentMetadata), restOfOpenApi), (currentMetadata === null || currentMetadata === void 0 ? void 0 : currentMetadata.param) || param ? { param: Object.assign(Object.assign({}, currentMetadata === null || currentMetadata === void 0 ? void 0 : currentMetadata.param), param) } : void 0);
|
|
272
|
-
const result = new this.constructor(this._def);
|
|
273
|
-
function setMetadata(schema) {
|
|
274
|
-
Metadata.setMetadataInRegistry(schema, Object.assign(Object.assign({}, Object.keys(_internal).length > 0 ? { _internal } : void 0), resultMetadata));
|
|
275
|
-
}
|
|
276
|
-
setMetadata(result);
|
|
277
|
-
/**
|
|
278
|
-
* In order to handle z.json() which is implemented as:
|
|
279
|
-
*
|
|
280
|
-
* const jsonSchema = lazy(() => { return union([ ... ]) });
|
|
281
|
-
* return jsonSchema;
|
|
282
|
-
*
|
|
283
|
-
* We need to not only set the metadata to the resulting schema (which would be different
|
|
284
|
-
* from `jsonSchema`), but also to the original lazy schema so that the _internal metadata (refId)
|
|
285
|
-
* is also present in the internally used `jsonSchema`.
|
|
286
|
-
*/
|
|
287
|
-
if (isZodType(result, "ZodLazy")) setMetadata(this);
|
|
288
|
-
if (isZodType(result, "ZodObject")) {
|
|
289
|
-
const currentMetadata = Metadata.getMetadataFromRegistry(result);
|
|
290
|
-
const originalExtend = result.extend;
|
|
291
|
-
result.extend = function(...args) {
|
|
292
|
-
const extendedResult = originalExtend.apply(result, args);
|
|
293
|
-
const _a = currentMetadata !== null && currentMetadata !== void 0 ? currentMetadata : {}, { _internal } = _a, rest = __rest(_a, ["_internal"]);
|
|
294
|
-
Metadata.setMetadataInRegistry(extendedResult, { _internal: { extendedFrom: (_internal === null || _internal === void 0 ? void 0 : _internal.refId) ? {
|
|
295
|
-
refId: _internal.refId,
|
|
296
|
-
schema: result
|
|
297
|
-
} : _internal === null || _internal === void 0 ? void 0 : _internal.extendedFrom } });
|
|
298
|
-
return extendedResult.openapi(rest);
|
|
299
|
-
};
|
|
300
|
-
preserveMetadataFromModifier(result, "catchall");
|
|
301
|
-
}
|
|
302
|
-
preserveMetadataFromModifier(result, "optional");
|
|
303
|
-
preserveMetadataFromModifier(result, "nullable");
|
|
304
|
-
preserveMetadataFromModifier(result, "default");
|
|
305
|
-
preserveMetadataFromModifier(result, "transform");
|
|
306
|
-
preserveMetadataFromModifier(result, "refine");
|
|
307
|
-
preserveMetadataFromModifier(result, "length");
|
|
308
|
-
preserveMetadataFromModifier(result, "min");
|
|
309
|
-
preserveMetadataFromModifier(result, "max");
|
|
310
|
-
const originalMeta = result.meta;
|
|
311
|
-
result.meta = function(...args) {
|
|
312
|
-
const result = originalMeta.apply(this, args);
|
|
313
|
-
if (args[0]) {
|
|
314
|
-
const meta = Metadata.getMetadataFromInternalRegistry(this);
|
|
315
|
-
if (meta) Metadata.setMetadataInRegistry(result, Object.assign(Object.assign({}, meta), args[0]));
|
|
316
|
-
}
|
|
317
|
-
return result;
|
|
318
|
-
};
|
|
319
|
-
return result;
|
|
320
|
-
};
|
|
321
|
-
}
|
|
322
|
-
function getOpenApiConfiguration(refOrOpenapi, metadataOrOptions, options) {
|
|
323
|
-
if (typeof refOrOpenapi === "string") return {
|
|
324
|
-
refId: refOrOpenapi,
|
|
325
|
-
metadata: metadataOrOptions,
|
|
326
|
-
options
|
|
327
|
-
};
|
|
328
|
-
return {
|
|
329
|
-
refId: void 0,
|
|
330
|
-
metadata: refOrOpenapi,
|
|
331
|
-
options: metadataOrOptions
|
|
332
|
-
};
|
|
333
|
-
}
|
|
334
|
-
exports.extendZodWithOpenApi = extendZodWithOpenApi;
|
|
335
|
-
}));
|
|
336
|
-
|
|
337
|
-
//#endregion
|
|
338
3
|
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/core.js
|
|
339
4
|
var _a$1;
|
|
340
5
|
/** A special constant with type `never` */
|
|
@@ -1228,14 +893,14 @@ const safeDecodeAsync$1 = /* @__PURE__ */ _safeDecodeAsync($ZodRealError);
|
|
|
1228
893
|
var regexes_exports = /* @__PURE__ */ __exportAll({
|
|
1229
894
|
base64: () => base64$1,
|
|
1230
895
|
base64url: () => base64url$1,
|
|
1231
|
-
bigint: () => bigint$
|
|
1232
|
-
boolean: () => boolean$
|
|
896
|
+
bigint: () => bigint$1,
|
|
897
|
+
boolean: () => boolean$1,
|
|
1233
898
|
browserEmail: () => browserEmail,
|
|
1234
899
|
cidrv4: () => cidrv4$1,
|
|
1235
900
|
cidrv6: () => cidrv6$1,
|
|
1236
901
|
cuid: () => cuid$1,
|
|
1237
902
|
cuid2: () => cuid2$1,
|
|
1238
|
-
date: () => date$
|
|
903
|
+
date: () => date$2,
|
|
1239
904
|
datetime: () => datetime$1,
|
|
1240
905
|
domain: () => domain,
|
|
1241
906
|
duration: () => duration$1,
|
|
@@ -1260,7 +925,7 @@ var regexes_exports = /* @__PURE__ */ __exportAll({
|
|
|
1260
925
|
md5_hex: () => md5_hex,
|
|
1261
926
|
nanoid: () => nanoid$1,
|
|
1262
927
|
null: () => _null$2,
|
|
1263
|
-
number: () => number$
|
|
928
|
+
number: () => number$1,
|
|
1264
929
|
rfc5322Email: () => rfc5322Email,
|
|
1265
930
|
sha1_base64: () => sha1_base64,
|
|
1266
931
|
sha1_base64url: () => sha1_base64url,
|
|
@@ -1274,7 +939,7 @@ var regexes_exports = /* @__PURE__ */ __exportAll({
|
|
|
1274
939
|
sha512_base64: () => sha512_base64,
|
|
1275
940
|
sha512_base64url: () => sha512_base64url,
|
|
1276
941
|
sha512_hex: () => sha512_hex,
|
|
1277
|
-
string: () => string$
|
|
942
|
+
string: () => string$1,
|
|
1278
943
|
time: () => time$1,
|
|
1279
944
|
ulid: () => ulid$1,
|
|
1280
945
|
undefined: () => _undefined$2,
|
|
@@ -1342,7 +1007,7 @@ const domain = /^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$
|
|
|
1342
1007
|
const httpProtocol = /^https?$/;
|
|
1343
1008
|
const e164$1 = /^\+[1-9]\d{6,14}$/;
|
|
1344
1009
|
const dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
|
|
1345
|
-
const date$
|
|
1010
|
+
const date$2 = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
|
|
1346
1011
|
function timeSource(args) {
|
|
1347
1012
|
const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
|
|
1348
1013
|
return typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
|
|
@@ -1358,14 +1023,14 @@ function datetime$1(args) {
|
|
|
1358
1023
|
const timeRegex = `${time}(?:${opts.join("|")})`;
|
|
1359
1024
|
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
|
|
1360
1025
|
}
|
|
1361
|
-
const string$
|
|
1026
|
+
const string$1 = (params) => {
|
|
1362
1027
|
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
|
1363
1028
|
return new RegExp(`^${regex}$`);
|
|
1364
1029
|
};
|
|
1365
|
-
const bigint$
|
|
1030
|
+
const bigint$1 = /^-?\d+n?$/;
|
|
1366
1031
|
const integer = /^-?\d+$/;
|
|
1367
|
-
const number$
|
|
1368
|
-
const boolean$
|
|
1032
|
+
const number$1 = /^-?\d+(?:\.\d+)?$/;
|
|
1033
|
+
const boolean$1 = /^(?:true|false)$/i;
|
|
1369
1034
|
const _null$2 = /^null$/i;
|
|
1370
1035
|
const _undefined$2 = /^undefined$/i;
|
|
1371
1036
|
const lowercase = /^[^A-Z]*$/;
|
|
@@ -2032,7 +1697,7 @@ const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
2032
1697
|
});
|
|
2033
1698
|
const $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
|
|
2034
1699
|
$ZodType.init(inst, def);
|
|
2035
|
-
inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string$
|
|
1700
|
+
inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string$1(inst._zod.bag);
|
|
2036
1701
|
inst._zod.parse = (payload, _) => {
|
|
2037
1702
|
if (def.coerce) try {
|
|
2038
1703
|
payload.value = String(payload.value);
|
|
@@ -2171,7 +1836,7 @@ const $ZodISODateTime = /* @__PURE__ */ $constructor("$ZodISODateTime", (inst, d
|
|
|
2171
1836
|
$ZodStringFormat.init(inst, def);
|
|
2172
1837
|
});
|
|
2173
1838
|
const $ZodISODate = /* @__PURE__ */ $constructor("$ZodISODate", (inst, def) => {
|
|
2174
|
-
def.pattern ?? (def.pattern = date$
|
|
1839
|
+
def.pattern ?? (def.pattern = date$2);
|
|
2175
1840
|
$ZodStringFormat.init(inst, def);
|
|
2176
1841
|
});
|
|
2177
1842
|
const $ZodISOTime = /* @__PURE__ */ $constructor("$ZodISOTime", (inst, def) => {
|
|
@@ -2331,7 +1996,7 @@ const $ZodCustomStringFormat = /* @__PURE__ */ $constructor("$ZodCustomStringFor
|
|
|
2331
1996
|
});
|
|
2332
1997
|
const $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
|
|
2333
1998
|
$ZodType.init(inst, def);
|
|
2334
|
-
inst._zod.pattern = inst._zod.bag.pattern ?? number$
|
|
1999
|
+
inst._zod.pattern = inst._zod.bag.pattern ?? number$1;
|
|
2335
2000
|
inst._zod.parse = (payload, _ctx) => {
|
|
2336
2001
|
if (def.coerce) try {
|
|
2337
2002
|
payload.value = Number(payload.value);
|
|
@@ -2355,7 +2020,7 @@ const $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumberFormat", (inst,
|
|
|
2355
2020
|
});
|
|
2356
2021
|
const $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
|
|
2357
2022
|
$ZodType.init(inst, def);
|
|
2358
|
-
inst._zod.pattern = boolean$
|
|
2023
|
+
inst._zod.pattern = boolean$1;
|
|
2359
2024
|
inst._zod.parse = (payload, _ctx) => {
|
|
2360
2025
|
if (def.coerce) try {
|
|
2361
2026
|
payload.value = Boolean(payload.value);
|
|
@@ -2373,7 +2038,7 @@ const $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
|
|
|
2373
2038
|
});
|
|
2374
2039
|
const $ZodBigInt = /* @__PURE__ */ $constructor("$ZodBigInt", (inst, def) => {
|
|
2375
2040
|
$ZodType.init(inst, def);
|
|
2376
|
-
inst._zod.pattern = bigint$
|
|
2041
|
+
inst._zod.pattern = bigint$1;
|
|
2377
2042
|
inst._zod.parse = (payload, _ctx) => {
|
|
2378
2043
|
if (def.coerce) try {
|
|
2379
2044
|
payload.value = BigInt(payload.value);
|
|
@@ -3183,7 +2848,7 @@ const $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
3183
2848
|
issues: []
|
|
3184
2849
|
}, ctx);
|
|
3185
2850
|
if (keyResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
|
|
3186
|
-
if (typeof key === "string" && number$
|
|
2851
|
+
if (typeof key === "string" && number$1.test(key) && keyResult.issues.length) {
|
|
3187
2852
|
const retryResult = def.keyType._zod.run({
|
|
3188
2853
|
value: Number(key),
|
|
3189
2854
|
issues: []
|
|
@@ -11773,7 +11438,7 @@ var iso_exports = /* @__PURE__ */ __exportAll({
|
|
|
11773
11438
|
ZodISODateTime: () => ZodISODateTime,
|
|
11774
11439
|
ZodISODuration: () => ZodISODuration,
|
|
11775
11440
|
ZodISOTime: () => ZodISOTime,
|
|
11776
|
-
date: () => date$
|
|
11441
|
+
date: () => date$1,
|
|
11777
11442
|
datetime: () => datetime,
|
|
11778
11443
|
duration: () => duration,
|
|
11779
11444
|
time: () => time
|
|
@@ -11789,7 +11454,7 @@ const ZodISODate = /* @__PURE__ */ $constructor("ZodISODate", (inst, def) => {
|
|
|
11789
11454
|
$ZodISODate.init(inst, def);
|
|
11790
11455
|
ZodStringFormat.init(inst, def);
|
|
11791
11456
|
});
|
|
11792
|
-
function date$
|
|
11457
|
+
function date$1(params) {
|
|
11793
11458
|
return _isoDate(ZodISODate, params);
|
|
11794
11459
|
}
|
|
11795
11460
|
const ZodISOTime = /* @__PURE__ */ $constructor("ZodISOTime", (inst, def) => {
|
|
@@ -11925,8 +11590,8 @@ var schemas_exports = /* @__PURE__ */ __exportAll({
|
|
|
11925
11590
|
array: () => array,
|
|
11926
11591
|
base64: () => base64,
|
|
11927
11592
|
base64url: () => base64url,
|
|
11928
|
-
bigint: () => bigint
|
|
11929
|
-
boolean: () => boolean
|
|
11593
|
+
bigint: () => bigint,
|
|
11594
|
+
boolean: () => boolean,
|
|
11930
11595
|
catch: () => _catch,
|
|
11931
11596
|
check: () => check,
|
|
11932
11597
|
cidrv4: () => cidrv4,
|
|
@@ -11935,7 +11600,7 @@ var schemas_exports = /* @__PURE__ */ __exportAll({
|
|
|
11935
11600
|
cuid: () => cuid,
|
|
11936
11601
|
cuid2: () => cuid2,
|
|
11937
11602
|
custom: () => custom,
|
|
11938
|
-
date: () => date
|
|
11603
|
+
date: () => date,
|
|
11939
11604
|
describe: () => describe,
|
|
11940
11605
|
discriminatedUnion: () => discriminatedUnion,
|
|
11941
11606
|
e164: () => e164,
|
|
@@ -11979,7 +11644,7 @@ var schemas_exports = /* @__PURE__ */ __exportAll({
|
|
|
11979
11644
|
null: () => _null,
|
|
11980
11645
|
nullable: () => nullable,
|
|
11981
11646
|
nullish: () => nullish,
|
|
11982
|
-
number: () => number
|
|
11647
|
+
number: () => number,
|
|
11983
11648
|
object: () => object,
|
|
11984
11649
|
optional: () => optional,
|
|
11985
11650
|
partialRecord: () => partialRecord,
|
|
@@ -11992,7 +11657,7 @@ var schemas_exports = /* @__PURE__ */ __exportAll({
|
|
|
11992
11657
|
refine: () => refine,
|
|
11993
11658
|
set: () => set,
|
|
11994
11659
|
strictObject: () => strictObject,
|
|
11995
|
-
string: () => string
|
|
11660
|
+
string: () => string,
|
|
11996
11661
|
stringFormat: () => stringFormat,
|
|
11997
11662
|
stringbool: () => stringbool,
|
|
11998
11663
|
success: () => success,
|
|
@@ -12261,11 +11926,11 @@ const ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
|
|
|
12261
11926
|
inst.cidrv6 = (params) => inst.check(_cidrv6(ZodCIDRv6, params));
|
|
12262
11927
|
inst.e164 = (params) => inst.check(_e164(ZodE164, params));
|
|
12263
11928
|
inst.datetime = (params) => inst.check(datetime(params));
|
|
12264
|
-
inst.date = (params) => inst.check(date$
|
|
11929
|
+
inst.date = (params) => inst.check(date$1(params));
|
|
12265
11930
|
inst.time = (params) => inst.check(time(params));
|
|
12266
11931
|
inst.duration = (params) => inst.check(duration(params));
|
|
12267
11932
|
});
|
|
12268
|
-
function string
|
|
11933
|
+
function string(params) {
|
|
12269
11934
|
return _string(ZodString, params);
|
|
12270
11935
|
}
|
|
12271
11936
|
const ZodStringFormat = /* @__PURE__ */ $constructor("ZodStringFormat", (inst, def) => {
|
|
@@ -12517,7 +12182,7 @@ const ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
|
|
|
12517
12182
|
inst.isFinite = true;
|
|
12518
12183
|
inst.format = bag.format ?? null;
|
|
12519
12184
|
});
|
|
12520
|
-
function number
|
|
12185
|
+
function number(params) {
|
|
12521
12186
|
return _number(ZodNumber, params);
|
|
12522
12187
|
}
|
|
12523
12188
|
const ZodNumberFormat = /* @__PURE__ */ $constructor("ZodNumberFormat", (inst, def) => {
|
|
@@ -12544,7 +12209,7 @@ const ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
|
|
|
12544
12209
|
ZodType.init(inst, def);
|
|
12545
12210
|
inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json, params);
|
|
12546
12211
|
});
|
|
12547
|
-
function boolean
|
|
12212
|
+
function boolean(params) {
|
|
12548
12213
|
return _boolean(ZodBoolean, params);
|
|
12549
12214
|
}
|
|
12550
12215
|
const ZodBigInt = /* @__PURE__ */ $constructor("ZodBigInt", (inst, def) => {
|
|
@@ -12569,7 +12234,7 @@ const ZodBigInt = /* @__PURE__ */ $constructor("ZodBigInt", (inst, def) => {
|
|
|
12569
12234
|
inst.maxValue = bag.maximum ?? null;
|
|
12570
12235
|
inst.format = bag.format ?? null;
|
|
12571
12236
|
});
|
|
12572
|
-
function bigint
|
|
12237
|
+
function bigint(params) {
|
|
12573
12238
|
return _bigint(ZodBigInt, params);
|
|
12574
12239
|
}
|
|
12575
12240
|
const ZodBigIntFormat = /* @__PURE__ */ $constructor("ZodBigIntFormat", (inst, def) => {
|
|
@@ -12648,7 +12313,7 @@ const ZodDate = /* @__PURE__ */ $constructor("ZodDate", (inst, def) => {
|
|
|
12648
12313
|
inst.minDate = c.minimum ? new Date(c.minimum) : null;
|
|
12649
12314
|
inst.maxDate = c.maximum ? new Date(c.maximum) : null;
|
|
12650
12315
|
});
|
|
12651
|
-
function date
|
|
12316
|
+
function date(params) {
|
|
12652
12317
|
return _date(ZodDate, params);
|
|
12653
12318
|
}
|
|
12654
12319
|
const ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
|
|
@@ -12851,7 +12516,7 @@ const ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
|
|
|
12851
12516
|
function record(keyType, valueType, params) {
|
|
12852
12517
|
if (!valueType || !valueType._zod) return new ZodRecord({
|
|
12853
12518
|
type: "record",
|
|
12854
|
-
keyType: string
|
|
12519
|
+
keyType: string(),
|
|
12855
12520
|
valueType: keyType,
|
|
12856
12521
|
...normalizeParams(valueType)
|
|
12857
12522
|
});
|
|
@@ -13296,12 +12961,12 @@ const stringbool = (...args) => _stringbool({
|
|
|
13296
12961
|
function json(params) {
|
|
13297
12962
|
const jsonSchema = lazy(() => {
|
|
13298
12963
|
return union([
|
|
13299
|
-
string
|
|
13300
|
-
number
|
|
13301
|
-
boolean
|
|
12964
|
+
string(params),
|
|
12965
|
+
number(),
|
|
12966
|
+
boolean(),
|
|
13302
12967
|
_null(),
|
|
13303
12968
|
array(jsonSchema),
|
|
13304
|
-
record(string
|
|
12969
|
+
record(string(), jsonSchema)
|
|
13305
12970
|
]);
|
|
13306
12971
|
});
|
|
13307
12972
|
return jsonSchema;
|
|
@@ -13315,1282 +12980,4 @@ function preprocess(fn, schema) {
|
|
|
13315
12980
|
}
|
|
13316
12981
|
|
|
13317
12982
|
//#endregion
|
|
13318
|
-
|
|
13319
|
-
/** @deprecated Use the raw string literal codes instead, e.g. "invalid_type". */
|
|
13320
|
-
const ZodIssueCode = {
|
|
13321
|
-
invalid_type: "invalid_type",
|
|
13322
|
-
too_big: "too_big",
|
|
13323
|
-
too_small: "too_small",
|
|
13324
|
-
invalid_format: "invalid_format",
|
|
13325
|
-
not_multiple_of: "not_multiple_of",
|
|
13326
|
-
unrecognized_keys: "unrecognized_keys",
|
|
13327
|
-
invalid_union: "invalid_union",
|
|
13328
|
-
invalid_key: "invalid_key",
|
|
13329
|
-
invalid_element: "invalid_element",
|
|
13330
|
-
invalid_value: "invalid_value",
|
|
13331
|
-
custom: "custom"
|
|
13332
|
-
};
|
|
13333
|
-
/** @deprecated Use `z.config(params)` instead. */
|
|
13334
|
-
function setErrorMap(map) {
|
|
13335
|
-
config({ customError: map });
|
|
13336
|
-
}
|
|
13337
|
-
/** @deprecated Use `z.config()` instead. */
|
|
13338
|
-
function getErrorMap() {
|
|
13339
|
-
return config().customError;
|
|
13340
|
-
}
|
|
13341
|
-
/** @deprecated Do not use. Stub definition, only included for zod-to-json-schema compatibility. */
|
|
13342
|
-
var ZodFirstPartyTypeKind;
|
|
13343
|
-
(function(ZodFirstPartyTypeKind) {})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
|
|
13344
|
-
|
|
13345
|
-
//#endregion
|
|
13346
|
-
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/from-json-schema.js
|
|
13347
|
-
const z = {
|
|
13348
|
-
...schemas_exports,
|
|
13349
|
-
...checks_exports,
|
|
13350
|
-
iso: iso_exports
|
|
13351
|
-
};
|
|
13352
|
-
const RECOGNIZED_KEYS = /* @__PURE__ */ new Set([
|
|
13353
|
-
"$schema",
|
|
13354
|
-
"$ref",
|
|
13355
|
-
"$defs",
|
|
13356
|
-
"definitions",
|
|
13357
|
-
"$id",
|
|
13358
|
-
"id",
|
|
13359
|
-
"$comment",
|
|
13360
|
-
"$anchor",
|
|
13361
|
-
"$vocabulary",
|
|
13362
|
-
"$dynamicRef",
|
|
13363
|
-
"$dynamicAnchor",
|
|
13364
|
-
"type",
|
|
13365
|
-
"enum",
|
|
13366
|
-
"const",
|
|
13367
|
-
"anyOf",
|
|
13368
|
-
"oneOf",
|
|
13369
|
-
"allOf",
|
|
13370
|
-
"not",
|
|
13371
|
-
"properties",
|
|
13372
|
-
"required",
|
|
13373
|
-
"additionalProperties",
|
|
13374
|
-
"patternProperties",
|
|
13375
|
-
"propertyNames",
|
|
13376
|
-
"minProperties",
|
|
13377
|
-
"maxProperties",
|
|
13378
|
-
"items",
|
|
13379
|
-
"prefixItems",
|
|
13380
|
-
"additionalItems",
|
|
13381
|
-
"minItems",
|
|
13382
|
-
"maxItems",
|
|
13383
|
-
"uniqueItems",
|
|
13384
|
-
"contains",
|
|
13385
|
-
"minContains",
|
|
13386
|
-
"maxContains",
|
|
13387
|
-
"minLength",
|
|
13388
|
-
"maxLength",
|
|
13389
|
-
"pattern",
|
|
13390
|
-
"format",
|
|
13391
|
-
"minimum",
|
|
13392
|
-
"maximum",
|
|
13393
|
-
"exclusiveMinimum",
|
|
13394
|
-
"exclusiveMaximum",
|
|
13395
|
-
"multipleOf",
|
|
13396
|
-
"description",
|
|
13397
|
-
"default",
|
|
13398
|
-
"contentEncoding",
|
|
13399
|
-
"contentMediaType",
|
|
13400
|
-
"contentSchema",
|
|
13401
|
-
"unevaluatedItems",
|
|
13402
|
-
"unevaluatedProperties",
|
|
13403
|
-
"if",
|
|
13404
|
-
"then",
|
|
13405
|
-
"else",
|
|
13406
|
-
"dependentSchemas",
|
|
13407
|
-
"dependentRequired",
|
|
13408
|
-
"nullable",
|
|
13409
|
-
"readOnly"
|
|
13410
|
-
]);
|
|
13411
|
-
function detectVersion(schema, defaultTarget) {
|
|
13412
|
-
const $schema = schema.$schema;
|
|
13413
|
-
if ($schema === "https://json-schema.org/draft/2020-12/schema") return "draft-2020-12";
|
|
13414
|
-
if ($schema === "http://json-schema.org/draft-07/schema#") return "draft-7";
|
|
13415
|
-
if ($schema === "http://json-schema.org/draft-04/schema#") return "draft-4";
|
|
13416
|
-
return defaultTarget ?? "draft-2020-12";
|
|
13417
|
-
}
|
|
13418
|
-
function resolveRef(ref, ctx) {
|
|
13419
|
-
if (!ref.startsWith("#")) throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
13420
|
-
const path = ref.slice(1).split("/").filter(Boolean);
|
|
13421
|
-
if (path.length === 0) return ctx.rootSchema;
|
|
13422
|
-
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
13423
|
-
if (path[0] === defsKey) {
|
|
13424
|
-
const key = path[1];
|
|
13425
|
-
if (!key || !ctx.defs[key]) throw new Error(`Reference not found: ${ref}`);
|
|
13426
|
-
return ctx.defs[key];
|
|
13427
|
-
}
|
|
13428
|
-
throw new Error(`Reference not found: ${ref}`);
|
|
13429
|
-
}
|
|
13430
|
-
function convertBaseSchema(schema, ctx) {
|
|
13431
|
-
if (schema.not !== void 0) {
|
|
13432
|
-
if (typeof schema.not === "object" && Object.keys(schema.not).length === 0) return z.never();
|
|
13433
|
-
throw new Error("not is not supported in Zod (except { not: {} } for never)");
|
|
13434
|
-
}
|
|
13435
|
-
if (schema.unevaluatedItems !== void 0) throw new Error("unevaluatedItems is not supported");
|
|
13436
|
-
if (schema.unevaluatedProperties !== void 0) throw new Error("unevaluatedProperties is not supported");
|
|
13437
|
-
if (schema.if !== void 0 || schema.then !== void 0 || schema.else !== void 0) throw new Error("Conditional schemas (if/then/else) are not supported");
|
|
13438
|
-
if (schema.dependentSchemas !== void 0 || schema.dependentRequired !== void 0) throw new Error("dependentSchemas and dependentRequired are not supported");
|
|
13439
|
-
if (schema.$ref) {
|
|
13440
|
-
const refPath = schema.$ref;
|
|
13441
|
-
if (ctx.refs.has(refPath)) return ctx.refs.get(refPath);
|
|
13442
|
-
if (ctx.processing.has(refPath)) return z.lazy(() => {
|
|
13443
|
-
if (!ctx.refs.has(refPath)) throw new Error(`Circular reference not resolved: ${refPath}`);
|
|
13444
|
-
return ctx.refs.get(refPath);
|
|
13445
|
-
});
|
|
13446
|
-
ctx.processing.add(refPath);
|
|
13447
|
-
const zodSchema = convertSchema(resolveRef(refPath, ctx), ctx);
|
|
13448
|
-
ctx.refs.set(refPath, zodSchema);
|
|
13449
|
-
ctx.processing.delete(refPath);
|
|
13450
|
-
return zodSchema;
|
|
13451
|
-
}
|
|
13452
|
-
if (schema.enum !== void 0) {
|
|
13453
|
-
const enumValues = schema.enum;
|
|
13454
|
-
if (ctx.version === "openapi-3.0" && schema.nullable === true && enumValues.length === 1 && enumValues[0] === null) return z.null();
|
|
13455
|
-
if (enumValues.length === 0) return z.never();
|
|
13456
|
-
if (enumValues.length === 1) return z.literal(enumValues[0]);
|
|
13457
|
-
if (enumValues.every((v) => typeof v === "string")) return z.enum(enumValues);
|
|
13458
|
-
const literalSchemas = enumValues.map((v) => z.literal(v));
|
|
13459
|
-
if (literalSchemas.length < 2) return literalSchemas[0];
|
|
13460
|
-
return z.union([
|
|
13461
|
-
literalSchemas[0],
|
|
13462
|
-
literalSchemas[1],
|
|
13463
|
-
...literalSchemas.slice(2)
|
|
13464
|
-
]);
|
|
13465
|
-
}
|
|
13466
|
-
if (schema.const !== void 0) return z.literal(schema.const);
|
|
13467
|
-
const type = schema.type;
|
|
13468
|
-
if (Array.isArray(type)) {
|
|
13469
|
-
const typeSchemas = type.map((t) => {
|
|
13470
|
-
return convertBaseSchema({
|
|
13471
|
-
...schema,
|
|
13472
|
-
type: t
|
|
13473
|
-
}, ctx);
|
|
13474
|
-
});
|
|
13475
|
-
if (typeSchemas.length === 0) return z.never();
|
|
13476
|
-
if (typeSchemas.length === 1) return typeSchemas[0];
|
|
13477
|
-
return z.union(typeSchemas);
|
|
13478
|
-
}
|
|
13479
|
-
if (!type) return z.any();
|
|
13480
|
-
let zodSchema;
|
|
13481
|
-
switch (type) {
|
|
13482
|
-
case "string": {
|
|
13483
|
-
let stringSchema = z.string();
|
|
13484
|
-
if (schema.format) {
|
|
13485
|
-
const format = schema.format;
|
|
13486
|
-
if (format === "email") stringSchema = stringSchema.check(z.email());
|
|
13487
|
-
else if (format === "uri" || format === "uri-reference") stringSchema = stringSchema.check(z.url());
|
|
13488
|
-
else if (format === "uuid" || format === "guid") stringSchema = stringSchema.check(z.uuid());
|
|
13489
|
-
else if (format === "date-time") stringSchema = stringSchema.check(z.iso.datetime());
|
|
13490
|
-
else if (format === "date") stringSchema = stringSchema.check(z.iso.date());
|
|
13491
|
-
else if (format === "time") stringSchema = stringSchema.check(z.iso.time());
|
|
13492
|
-
else if (format === "duration") stringSchema = stringSchema.check(z.iso.duration());
|
|
13493
|
-
else if (format === "ipv4") stringSchema = stringSchema.check(z.ipv4());
|
|
13494
|
-
else if (format === "ipv6") stringSchema = stringSchema.check(z.ipv6());
|
|
13495
|
-
else if (format === "mac") stringSchema = stringSchema.check(z.mac());
|
|
13496
|
-
else if (format === "cidr") stringSchema = stringSchema.check(z.cidrv4());
|
|
13497
|
-
else if (format === "cidr-v6") stringSchema = stringSchema.check(z.cidrv6());
|
|
13498
|
-
else if (format === "base64") stringSchema = stringSchema.check(z.base64());
|
|
13499
|
-
else if (format === "base64url") stringSchema = stringSchema.check(z.base64url());
|
|
13500
|
-
else if (format === "e164") stringSchema = stringSchema.check(z.e164());
|
|
13501
|
-
else if (format === "jwt") stringSchema = stringSchema.check(z.jwt());
|
|
13502
|
-
else if (format === "emoji") stringSchema = stringSchema.check(z.emoji());
|
|
13503
|
-
else if (format === "nanoid") stringSchema = stringSchema.check(z.nanoid());
|
|
13504
|
-
else if (format === "cuid") stringSchema = stringSchema.check(z.cuid());
|
|
13505
|
-
else if (format === "cuid2") stringSchema = stringSchema.check(z.cuid2());
|
|
13506
|
-
else if (format === "ulid") stringSchema = stringSchema.check(z.ulid());
|
|
13507
|
-
else if (format === "xid") stringSchema = stringSchema.check(z.xid());
|
|
13508
|
-
else if (format === "ksuid") stringSchema = stringSchema.check(z.ksuid());
|
|
13509
|
-
}
|
|
13510
|
-
if (typeof schema.minLength === "number") stringSchema = stringSchema.min(schema.minLength);
|
|
13511
|
-
if (typeof schema.maxLength === "number") stringSchema = stringSchema.max(schema.maxLength);
|
|
13512
|
-
if (schema.pattern) stringSchema = stringSchema.regex(new RegExp(schema.pattern));
|
|
13513
|
-
zodSchema = stringSchema;
|
|
13514
|
-
break;
|
|
13515
|
-
}
|
|
13516
|
-
case "number":
|
|
13517
|
-
case "integer": {
|
|
13518
|
-
let numberSchema = type === "integer" ? z.number().int() : z.number();
|
|
13519
|
-
if (typeof schema.minimum === "number") numberSchema = numberSchema.min(schema.minimum);
|
|
13520
|
-
if (typeof schema.maximum === "number") numberSchema = numberSchema.max(schema.maximum);
|
|
13521
|
-
if (typeof schema.exclusiveMinimum === "number") numberSchema = numberSchema.gt(schema.exclusiveMinimum);
|
|
13522
|
-
else if (schema.exclusiveMinimum === true && typeof schema.minimum === "number") numberSchema = numberSchema.gt(schema.minimum);
|
|
13523
|
-
if (typeof schema.exclusiveMaximum === "number") numberSchema = numberSchema.lt(schema.exclusiveMaximum);
|
|
13524
|
-
else if (schema.exclusiveMaximum === true && typeof schema.maximum === "number") numberSchema = numberSchema.lt(schema.maximum);
|
|
13525
|
-
if (typeof schema.multipleOf === "number") numberSchema = numberSchema.multipleOf(schema.multipleOf);
|
|
13526
|
-
zodSchema = numberSchema;
|
|
13527
|
-
break;
|
|
13528
|
-
}
|
|
13529
|
-
case "boolean":
|
|
13530
|
-
zodSchema = z.boolean();
|
|
13531
|
-
break;
|
|
13532
|
-
case "null":
|
|
13533
|
-
zodSchema = z.null();
|
|
13534
|
-
break;
|
|
13535
|
-
case "object": {
|
|
13536
|
-
const shape = {};
|
|
13537
|
-
const properties = schema.properties || {};
|
|
13538
|
-
const requiredSet = new Set(schema.required || []);
|
|
13539
|
-
for (const [key, propSchema] of Object.entries(properties)) {
|
|
13540
|
-
const propZodSchema = convertSchema(propSchema, ctx);
|
|
13541
|
-
shape[key] = requiredSet.has(key) ? propZodSchema : propZodSchema.optional();
|
|
13542
|
-
}
|
|
13543
|
-
if (schema.propertyNames) {
|
|
13544
|
-
const keySchema = convertSchema(schema.propertyNames, ctx);
|
|
13545
|
-
const valueSchema = schema.additionalProperties && typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) : z.any();
|
|
13546
|
-
if (Object.keys(shape).length === 0) {
|
|
13547
|
-
zodSchema = z.record(keySchema, valueSchema);
|
|
13548
|
-
break;
|
|
13549
|
-
}
|
|
13550
|
-
const objectSchema = z.object(shape).passthrough();
|
|
13551
|
-
const recordSchema = z.looseRecord(keySchema, valueSchema);
|
|
13552
|
-
zodSchema = z.intersection(objectSchema, recordSchema);
|
|
13553
|
-
break;
|
|
13554
|
-
}
|
|
13555
|
-
if (schema.patternProperties) {
|
|
13556
|
-
const patternProps = schema.patternProperties;
|
|
13557
|
-
const patternKeys = Object.keys(patternProps);
|
|
13558
|
-
const looseRecords = [];
|
|
13559
|
-
for (const pattern of patternKeys) {
|
|
13560
|
-
const patternValue = convertSchema(patternProps[pattern], ctx);
|
|
13561
|
-
const keySchema = z.string().regex(new RegExp(pattern));
|
|
13562
|
-
looseRecords.push(z.looseRecord(keySchema, patternValue));
|
|
13563
|
-
}
|
|
13564
|
-
const schemasToIntersect = [];
|
|
13565
|
-
if (Object.keys(shape).length > 0) schemasToIntersect.push(z.object(shape).passthrough());
|
|
13566
|
-
schemasToIntersect.push(...looseRecords);
|
|
13567
|
-
if (schemasToIntersect.length === 0) zodSchema = z.object({}).passthrough();
|
|
13568
|
-
else if (schemasToIntersect.length === 1) zodSchema = schemasToIntersect[0];
|
|
13569
|
-
else {
|
|
13570
|
-
let result = z.intersection(schemasToIntersect[0], schemasToIntersect[1]);
|
|
13571
|
-
for (let i = 2; i < schemasToIntersect.length; i++) result = z.intersection(result, schemasToIntersect[i]);
|
|
13572
|
-
zodSchema = result;
|
|
13573
|
-
}
|
|
13574
|
-
break;
|
|
13575
|
-
}
|
|
13576
|
-
const objectSchema = z.object(shape);
|
|
13577
|
-
if (schema.additionalProperties === false) zodSchema = objectSchema.strict();
|
|
13578
|
-
else if (typeof schema.additionalProperties === "object") zodSchema = objectSchema.catchall(convertSchema(schema.additionalProperties, ctx));
|
|
13579
|
-
else zodSchema = objectSchema.passthrough();
|
|
13580
|
-
break;
|
|
13581
|
-
}
|
|
13582
|
-
case "array": {
|
|
13583
|
-
const prefixItems = schema.prefixItems;
|
|
13584
|
-
const items = schema.items;
|
|
13585
|
-
if (prefixItems && Array.isArray(prefixItems)) {
|
|
13586
|
-
const tupleItems = prefixItems.map((item) => convertSchema(item, ctx));
|
|
13587
|
-
const rest = items && typeof items === "object" && !Array.isArray(items) ? convertSchema(items, ctx) : void 0;
|
|
13588
|
-
if (rest) zodSchema = z.tuple(tupleItems).rest(rest);
|
|
13589
|
-
else zodSchema = z.tuple(tupleItems);
|
|
13590
|
-
if (typeof schema.minItems === "number") zodSchema = zodSchema.check(z.minLength(schema.minItems));
|
|
13591
|
-
if (typeof schema.maxItems === "number") zodSchema = zodSchema.check(z.maxLength(schema.maxItems));
|
|
13592
|
-
} else if (Array.isArray(items)) {
|
|
13593
|
-
const tupleItems = items.map((item) => convertSchema(item, ctx));
|
|
13594
|
-
const rest = schema.additionalItems && typeof schema.additionalItems === "object" ? convertSchema(schema.additionalItems, ctx) : void 0;
|
|
13595
|
-
if (rest) zodSchema = z.tuple(tupleItems).rest(rest);
|
|
13596
|
-
else zodSchema = z.tuple(tupleItems);
|
|
13597
|
-
if (typeof schema.minItems === "number") zodSchema = zodSchema.check(z.minLength(schema.minItems));
|
|
13598
|
-
if (typeof schema.maxItems === "number") zodSchema = zodSchema.check(z.maxLength(schema.maxItems));
|
|
13599
|
-
} else if (items !== void 0) {
|
|
13600
|
-
const element = convertSchema(items, ctx);
|
|
13601
|
-
let arraySchema = z.array(element);
|
|
13602
|
-
if (typeof schema.minItems === "number") arraySchema = arraySchema.min(schema.minItems);
|
|
13603
|
-
if (typeof schema.maxItems === "number") arraySchema = arraySchema.max(schema.maxItems);
|
|
13604
|
-
zodSchema = arraySchema;
|
|
13605
|
-
} else zodSchema = z.array(z.any());
|
|
13606
|
-
break;
|
|
13607
|
-
}
|
|
13608
|
-
default: throw new Error(`Unsupported type: ${type}`);
|
|
13609
|
-
}
|
|
13610
|
-
return zodSchema;
|
|
13611
|
-
}
|
|
13612
|
-
function convertSchema(schema, ctx) {
|
|
13613
|
-
if (typeof schema === "boolean") return schema ? z.any() : z.never();
|
|
13614
|
-
let baseSchema = convertBaseSchema(schema, ctx);
|
|
13615
|
-
const hasExplicitType = schema.type || schema.enum !== void 0 || schema.const !== void 0;
|
|
13616
|
-
if (schema.anyOf && Array.isArray(schema.anyOf)) {
|
|
13617
|
-
const options = schema.anyOf.map((s) => convertSchema(s, ctx));
|
|
13618
|
-
const anyOfUnion = z.union(options);
|
|
13619
|
-
baseSchema = hasExplicitType ? z.intersection(baseSchema, anyOfUnion) : anyOfUnion;
|
|
13620
|
-
}
|
|
13621
|
-
if (schema.oneOf && Array.isArray(schema.oneOf)) {
|
|
13622
|
-
const options = schema.oneOf.map((s) => convertSchema(s, ctx));
|
|
13623
|
-
const oneOfUnion = z.xor(options);
|
|
13624
|
-
baseSchema = hasExplicitType ? z.intersection(baseSchema, oneOfUnion) : oneOfUnion;
|
|
13625
|
-
}
|
|
13626
|
-
if (schema.allOf && Array.isArray(schema.allOf)) if (schema.allOf.length === 0) baseSchema = hasExplicitType ? baseSchema : z.any();
|
|
13627
|
-
else {
|
|
13628
|
-
let result = hasExplicitType ? baseSchema : convertSchema(schema.allOf[0], ctx);
|
|
13629
|
-
const startIdx = hasExplicitType ? 0 : 1;
|
|
13630
|
-
for (let i = startIdx; i < schema.allOf.length; i++) result = z.intersection(result, convertSchema(schema.allOf[i], ctx));
|
|
13631
|
-
baseSchema = result;
|
|
13632
|
-
}
|
|
13633
|
-
if (schema.nullable === true && ctx.version === "openapi-3.0") baseSchema = z.nullable(baseSchema);
|
|
13634
|
-
if (schema.readOnly === true) baseSchema = z.readonly(baseSchema);
|
|
13635
|
-
if (schema.default !== void 0) baseSchema = baseSchema.default(schema.default);
|
|
13636
|
-
const extraMeta = {};
|
|
13637
|
-
for (const key of [
|
|
13638
|
-
"$id",
|
|
13639
|
-
"id",
|
|
13640
|
-
"$comment",
|
|
13641
|
-
"$anchor",
|
|
13642
|
-
"$vocabulary",
|
|
13643
|
-
"$dynamicRef",
|
|
13644
|
-
"$dynamicAnchor"
|
|
13645
|
-
]) if (key in schema) extraMeta[key] = schema[key];
|
|
13646
|
-
for (const key of [
|
|
13647
|
-
"contentEncoding",
|
|
13648
|
-
"contentMediaType",
|
|
13649
|
-
"contentSchema"
|
|
13650
|
-
]) if (key in schema) extraMeta[key] = schema[key];
|
|
13651
|
-
for (const key of Object.keys(schema)) if (!RECOGNIZED_KEYS.has(key)) extraMeta[key] = schema[key];
|
|
13652
|
-
if (Object.keys(extraMeta).length > 0) ctx.registry.add(baseSchema, extraMeta);
|
|
13653
|
-
if (schema.description) baseSchema = baseSchema.describe(schema.description);
|
|
13654
|
-
return baseSchema;
|
|
13655
|
-
}
|
|
13656
|
-
/**
|
|
13657
|
-
* Converts a JSON Schema to a Zod schema. This function should be considered semi-experimental. It's behavior is liable to change. */
|
|
13658
|
-
function fromJSONSchema(schema, params) {
|
|
13659
|
-
if (typeof schema === "boolean") return schema ? z.any() : z.never();
|
|
13660
|
-
let normalized;
|
|
13661
|
-
try {
|
|
13662
|
-
normalized = JSON.parse(JSON.stringify(schema));
|
|
13663
|
-
} catch {
|
|
13664
|
-
throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas");
|
|
13665
|
-
}
|
|
13666
|
-
const ctx = {
|
|
13667
|
-
version: detectVersion(normalized, params?.defaultTarget),
|
|
13668
|
-
defs: normalized.$defs || normalized.definitions || {},
|
|
13669
|
-
refs: /* @__PURE__ */ new Map(),
|
|
13670
|
-
processing: /* @__PURE__ */ new Set(),
|
|
13671
|
-
rootSchema: normalized,
|
|
13672
|
-
registry: params?.registry ?? globalRegistry
|
|
13673
|
-
};
|
|
13674
|
-
return convertSchema(normalized, ctx);
|
|
13675
|
-
}
|
|
13676
|
-
|
|
13677
|
-
//#endregion
|
|
13678
|
-
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/coerce.js
|
|
13679
|
-
var coerce_exports = /* @__PURE__ */ __exportAll({
|
|
13680
|
-
bigint: () => bigint,
|
|
13681
|
-
boolean: () => boolean,
|
|
13682
|
-
date: () => date,
|
|
13683
|
-
number: () => number,
|
|
13684
|
-
string: () => string
|
|
13685
|
-
});
|
|
13686
|
-
function string(params) {
|
|
13687
|
-
return _coercedString(ZodString, params);
|
|
13688
|
-
}
|
|
13689
|
-
function number(params) {
|
|
13690
|
-
return _coercedNumber(ZodNumber, params);
|
|
13691
|
-
}
|
|
13692
|
-
function boolean(params) {
|
|
13693
|
-
return _coercedBoolean(ZodBoolean, params);
|
|
13694
|
-
}
|
|
13695
|
-
function bigint(params) {
|
|
13696
|
-
return _coercedBigint(ZodBigInt, params);
|
|
13697
|
-
}
|
|
13698
|
-
function date(params) {
|
|
13699
|
-
return _coercedDate(ZodDate, params);
|
|
13700
|
-
}
|
|
13701
|
-
|
|
13702
|
-
//#endregion
|
|
13703
|
-
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/external.js
|
|
13704
|
-
var external_exports = /* @__PURE__ */ __exportAll({
|
|
13705
|
-
$brand: () => $brand,
|
|
13706
|
-
$input: () => $input,
|
|
13707
|
-
$output: () => $output,
|
|
13708
|
-
NEVER: () => NEVER,
|
|
13709
|
-
TimePrecision: () => TimePrecision,
|
|
13710
|
-
ZodAny: () => ZodAny,
|
|
13711
|
-
ZodArray: () => ZodArray,
|
|
13712
|
-
ZodBase64: () => ZodBase64,
|
|
13713
|
-
ZodBase64URL: () => ZodBase64URL,
|
|
13714
|
-
ZodBigInt: () => ZodBigInt,
|
|
13715
|
-
ZodBigIntFormat: () => ZodBigIntFormat,
|
|
13716
|
-
ZodBoolean: () => ZodBoolean,
|
|
13717
|
-
ZodCIDRv4: () => ZodCIDRv4,
|
|
13718
|
-
ZodCIDRv6: () => ZodCIDRv6,
|
|
13719
|
-
ZodCUID: () => ZodCUID,
|
|
13720
|
-
ZodCUID2: () => ZodCUID2,
|
|
13721
|
-
ZodCatch: () => ZodCatch,
|
|
13722
|
-
ZodCodec: () => ZodCodec,
|
|
13723
|
-
ZodCustom: () => ZodCustom,
|
|
13724
|
-
ZodCustomStringFormat: () => ZodCustomStringFormat,
|
|
13725
|
-
ZodDate: () => ZodDate,
|
|
13726
|
-
ZodDefault: () => ZodDefault,
|
|
13727
|
-
ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
|
|
13728
|
-
ZodE164: () => ZodE164,
|
|
13729
|
-
ZodEmail: () => ZodEmail,
|
|
13730
|
-
ZodEmoji: () => ZodEmoji,
|
|
13731
|
-
ZodEnum: () => ZodEnum,
|
|
13732
|
-
ZodError: () => ZodError,
|
|
13733
|
-
ZodExactOptional: () => ZodExactOptional,
|
|
13734
|
-
ZodFile: () => ZodFile,
|
|
13735
|
-
ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
|
|
13736
|
-
ZodFunction: () => ZodFunction,
|
|
13737
|
-
ZodGUID: () => ZodGUID,
|
|
13738
|
-
ZodIPv4: () => ZodIPv4,
|
|
13739
|
-
ZodIPv6: () => ZodIPv6,
|
|
13740
|
-
ZodISODate: () => ZodISODate,
|
|
13741
|
-
ZodISODateTime: () => ZodISODateTime,
|
|
13742
|
-
ZodISODuration: () => ZodISODuration,
|
|
13743
|
-
ZodISOTime: () => ZodISOTime,
|
|
13744
|
-
ZodIntersection: () => ZodIntersection,
|
|
13745
|
-
ZodIssueCode: () => ZodIssueCode,
|
|
13746
|
-
ZodJWT: () => ZodJWT,
|
|
13747
|
-
ZodKSUID: () => ZodKSUID,
|
|
13748
|
-
ZodLazy: () => ZodLazy,
|
|
13749
|
-
ZodLiteral: () => ZodLiteral,
|
|
13750
|
-
ZodMAC: () => ZodMAC,
|
|
13751
|
-
ZodMap: () => ZodMap,
|
|
13752
|
-
ZodNaN: () => ZodNaN,
|
|
13753
|
-
ZodNanoID: () => ZodNanoID,
|
|
13754
|
-
ZodNever: () => ZodNever,
|
|
13755
|
-
ZodNonOptional: () => ZodNonOptional,
|
|
13756
|
-
ZodNull: () => ZodNull,
|
|
13757
|
-
ZodNullable: () => ZodNullable,
|
|
13758
|
-
ZodNumber: () => ZodNumber,
|
|
13759
|
-
ZodNumberFormat: () => ZodNumberFormat,
|
|
13760
|
-
ZodObject: () => ZodObject,
|
|
13761
|
-
ZodOptional: () => ZodOptional,
|
|
13762
|
-
ZodPipe: () => ZodPipe,
|
|
13763
|
-
ZodPrefault: () => ZodPrefault,
|
|
13764
|
-
ZodPreprocess: () => ZodPreprocess,
|
|
13765
|
-
ZodPromise: () => ZodPromise,
|
|
13766
|
-
ZodReadonly: () => ZodReadonly,
|
|
13767
|
-
ZodRealError: () => ZodRealError,
|
|
13768
|
-
ZodRecord: () => ZodRecord,
|
|
13769
|
-
ZodSet: () => ZodSet,
|
|
13770
|
-
ZodString: () => ZodString,
|
|
13771
|
-
ZodStringFormat: () => ZodStringFormat,
|
|
13772
|
-
ZodSuccess: () => ZodSuccess,
|
|
13773
|
-
ZodSymbol: () => ZodSymbol,
|
|
13774
|
-
ZodTemplateLiteral: () => ZodTemplateLiteral,
|
|
13775
|
-
ZodTransform: () => ZodTransform,
|
|
13776
|
-
ZodTuple: () => ZodTuple,
|
|
13777
|
-
ZodType: () => ZodType,
|
|
13778
|
-
ZodULID: () => ZodULID,
|
|
13779
|
-
ZodURL: () => ZodURL,
|
|
13780
|
-
ZodUUID: () => ZodUUID,
|
|
13781
|
-
ZodUndefined: () => ZodUndefined,
|
|
13782
|
-
ZodUnion: () => ZodUnion,
|
|
13783
|
-
ZodUnknown: () => ZodUnknown,
|
|
13784
|
-
ZodVoid: () => ZodVoid,
|
|
13785
|
-
ZodXID: () => ZodXID,
|
|
13786
|
-
ZodXor: () => ZodXor,
|
|
13787
|
-
_ZodString: () => _ZodString,
|
|
13788
|
-
_default: () => _default,
|
|
13789
|
-
_function: () => _function,
|
|
13790
|
-
any: () => any,
|
|
13791
|
-
array: () => array,
|
|
13792
|
-
base64: () => base64,
|
|
13793
|
-
base64url: () => base64url,
|
|
13794
|
-
bigint: () => bigint$1,
|
|
13795
|
-
boolean: () => boolean$1,
|
|
13796
|
-
catch: () => _catch,
|
|
13797
|
-
check: () => check,
|
|
13798
|
-
cidrv4: () => cidrv4,
|
|
13799
|
-
cidrv6: () => cidrv6,
|
|
13800
|
-
clone: () => clone,
|
|
13801
|
-
codec: () => codec,
|
|
13802
|
-
coerce: () => coerce_exports,
|
|
13803
|
-
config: () => config,
|
|
13804
|
-
core: () => core_exports,
|
|
13805
|
-
cuid: () => cuid,
|
|
13806
|
-
cuid2: () => cuid2,
|
|
13807
|
-
custom: () => custom,
|
|
13808
|
-
date: () => date$1,
|
|
13809
|
-
decode: () => decode,
|
|
13810
|
-
decodeAsync: () => decodeAsync,
|
|
13811
|
-
describe: () => describe,
|
|
13812
|
-
discriminatedUnion: () => discriminatedUnion,
|
|
13813
|
-
e164: () => e164,
|
|
13814
|
-
email: () => email,
|
|
13815
|
-
emoji: () => emoji,
|
|
13816
|
-
encode: () => encode,
|
|
13817
|
-
encodeAsync: () => encodeAsync,
|
|
13818
|
-
endsWith: () => _endsWith,
|
|
13819
|
-
enum: () => _enum,
|
|
13820
|
-
exactOptional: () => exactOptional,
|
|
13821
|
-
file: () => file,
|
|
13822
|
-
flattenError: () => flattenError,
|
|
13823
|
-
float32: () => float32,
|
|
13824
|
-
float64: () => float64,
|
|
13825
|
-
formatError: () => formatError,
|
|
13826
|
-
fromJSONSchema: () => fromJSONSchema,
|
|
13827
|
-
function: () => _function,
|
|
13828
|
-
getErrorMap: () => getErrorMap,
|
|
13829
|
-
globalRegistry: () => globalRegistry,
|
|
13830
|
-
gt: () => _gt,
|
|
13831
|
-
gte: () => _gte,
|
|
13832
|
-
guid: () => guid,
|
|
13833
|
-
hash: () => hash,
|
|
13834
|
-
hex: () => hex,
|
|
13835
|
-
hostname: () => hostname,
|
|
13836
|
-
httpUrl: () => httpUrl,
|
|
13837
|
-
includes: () => _includes,
|
|
13838
|
-
instanceof: () => _instanceof,
|
|
13839
|
-
int: () => int,
|
|
13840
|
-
int32: () => int32,
|
|
13841
|
-
int64: () => int64,
|
|
13842
|
-
intersection: () => intersection,
|
|
13843
|
-
invertCodec: () => invertCodec,
|
|
13844
|
-
ipv4: () => ipv4,
|
|
13845
|
-
ipv6: () => ipv6,
|
|
13846
|
-
iso: () => iso_exports,
|
|
13847
|
-
json: () => json,
|
|
13848
|
-
jwt: () => jwt,
|
|
13849
|
-
keyof: () => keyof,
|
|
13850
|
-
ksuid: () => ksuid,
|
|
13851
|
-
lazy: () => lazy,
|
|
13852
|
-
length: () => _length,
|
|
13853
|
-
literal: () => literal,
|
|
13854
|
-
locales: () => locales_exports,
|
|
13855
|
-
looseObject: () => looseObject,
|
|
13856
|
-
looseRecord: () => looseRecord,
|
|
13857
|
-
lowercase: () => _lowercase,
|
|
13858
|
-
lt: () => _lt,
|
|
13859
|
-
lte: () => _lte,
|
|
13860
|
-
mac: () => mac,
|
|
13861
|
-
map: () => map,
|
|
13862
|
-
maxLength: () => _maxLength,
|
|
13863
|
-
maxSize: () => _maxSize,
|
|
13864
|
-
meta: () => meta,
|
|
13865
|
-
mime: () => _mime,
|
|
13866
|
-
minLength: () => _minLength,
|
|
13867
|
-
minSize: () => _minSize,
|
|
13868
|
-
multipleOf: () => _multipleOf,
|
|
13869
|
-
nan: () => nan,
|
|
13870
|
-
nanoid: () => nanoid,
|
|
13871
|
-
nativeEnum: () => nativeEnum,
|
|
13872
|
-
negative: () => _negative,
|
|
13873
|
-
never: () => never,
|
|
13874
|
-
nonnegative: () => _nonnegative,
|
|
13875
|
-
nonoptional: () => nonoptional,
|
|
13876
|
-
nonpositive: () => _nonpositive,
|
|
13877
|
-
normalize: () => _normalize,
|
|
13878
|
-
null: () => _null,
|
|
13879
|
-
nullable: () => nullable,
|
|
13880
|
-
nullish: () => nullish,
|
|
13881
|
-
number: () => number$1,
|
|
13882
|
-
object: () => object,
|
|
13883
|
-
optional: () => optional,
|
|
13884
|
-
overwrite: () => _overwrite,
|
|
13885
|
-
parse: () => parse,
|
|
13886
|
-
parseAsync: () => parseAsync,
|
|
13887
|
-
partialRecord: () => partialRecord,
|
|
13888
|
-
pipe: () => pipe,
|
|
13889
|
-
positive: () => _positive,
|
|
13890
|
-
prefault: () => prefault,
|
|
13891
|
-
preprocess: () => preprocess,
|
|
13892
|
-
prettifyError: () => prettifyError,
|
|
13893
|
-
promise: () => promise,
|
|
13894
|
-
property: () => _property,
|
|
13895
|
-
readonly: () => readonly,
|
|
13896
|
-
record: () => record,
|
|
13897
|
-
refine: () => refine,
|
|
13898
|
-
regex: () => _regex,
|
|
13899
|
-
regexes: () => regexes_exports,
|
|
13900
|
-
registry: () => registry,
|
|
13901
|
-
safeDecode: () => safeDecode,
|
|
13902
|
-
safeDecodeAsync: () => safeDecodeAsync,
|
|
13903
|
-
safeEncode: () => safeEncode,
|
|
13904
|
-
safeEncodeAsync: () => safeEncodeAsync,
|
|
13905
|
-
safeParse: () => safeParse,
|
|
13906
|
-
safeParseAsync: () => safeParseAsync,
|
|
13907
|
-
set: () => set,
|
|
13908
|
-
setErrorMap: () => setErrorMap,
|
|
13909
|
-
size: () => _size,
|
|
13910
|
-
slugify: () => _slugify,
|
|
13911
|
-
startsWith: () => _startsWith,
|
|
13912
|
-
strictObject: () => strictObject,
|
|
13913
|
-
string: () => string$1,
|
|
13914
|
-
stringFormat: () => stringFormat,
|
|
13915
|
-
stringbool: () => stringbool,
|
|
13916
|
-
success: () => success,
|
|
13917
|
-
superRefine: () => superRefine,
|
|
13918
|
-
symbol: () => symbol,
|
|
13919
|
-
templateLiteral: () => templateLiteral,
|
|
13920
|
-
toJSONSchema: () => toJSONSchema,
|
|
13921
|
-
toLowerCase: () => _toLowerCase,
|
|
13922
|
-
toUpperCase: () => _toUpperCase,
|
|
13923
|
-
transform: () => transform,
|
|
13924
|
-
treeifyError: () => treeifyError,
|
|
13925
|
-
trim: () => _trim,
|
|
13926
|
-
tuple: () => tuple,
|
|
13927
|
-
uint32: () => uint32,
|
|
13928
|
-
uint64: () => uint64,
|
|
13929
|
-
ulid: () => ulid,
|
|
13930
|
-
undefined: () => _undefined,
|
|
13931
|
-
union: () => union,
|
|
13932
|
-
unknown: () => unknown,
|
|
13933
|
-
uppercase: () => _uppercase,
|
|
13934
|
-
url: () => url,
|
|
13935
|
-
util: () => util_exports,
|
|
13936
|
-
uuid: () => uuid,
|
|
13937
|
-
uuidv4: () => uuidv4,
|
|
13938
|
-
uuidv6: () => uuidv6,
|
|
13939
|
-
uuidv7: () => uuidv7,
|
|
13940
|
-
void: () => _void,
|
|
13941
|
-
xid: () => xid,
|
|
13942
|
-
xor: () => xor
|
|
13943
|
-
});
|
|
13944
|
-
config(en_default());
|
|
13945
|
-
|
|
13946
|
-
//#endregion
|
|
13947
|
-
//#region ../api-contract/dist/openapi.mjs
|
|
13948
|
-
var import_dist = require_dist();
|
|
13949
|
-
(0, import_dist.extendZodWithOpenApi)(external_exports);
|
|
13950
|
-
|
|
13951
|
-
//#endregion
|
|
13952
|
-
//#region ../api-contract/dist/errors.mjs
|
|
13953
|
-
/**
|
|
13954
|
-
* Error shape returned by every `/api/v1` machine operation (and by the shared
|
|
13955
|
-
* auth guard). Each operation registers its own error schema component in the
|
|
13956
|
-
* OpenAPI document, so this is a factory rather than a single shared instance.
|
|
13957
|
-
*/
|
|
13958
|
-
function createApiErrorResponseSchema() {
|
|
13959
|
-
return object({
|
|
13960
|
-
error: string$1(),
|
|
13961
|
-
issues: array(unknown()).optional()
|
|
13962
|
-
});
|
|
13963
|
-
}
|
|
13964
|
-
const apiErrorResponseSchema = createApiErrorResponseSchema();
|
|
13965
|
-
/**
|
|
13966
|
-
* Canonical error codes for the `/api/v1` resource operations. Machine
|
|
13967
|
-
* operations keep the flat `{ error: string }` shape above unchanged; the
|
|
13968
|
-
* nested envelope below applies to resource operations only.
|
|
13969
|
-
*/
|
|
13970
|
-
const resourceErrorCodeSchema = _enum([
|
|
13971
|
-
"bad_request",
|
|
13972
|
-
"unauthenticated",
|
|
13973
|
-
"forbidden",
|
|
13974
|
-
"not_found",
|
|
13975
|
-
"conflict",
|
|
13976
|
-
"payload_too_large",
|
|
13977
|
-
"rate_limited",
|
|
13978
|
-
"capability_disabled",
|
|
13979
|
-
"upstream_error",
|
|
13980
|
-
"internal_error"
|
|
13981
|
-
]);
|
|
13982
|
-
/** Factory, matching `createApiErrorResponseSchema`, for per-route OpenAPI components. */
|
|
13983
|
-
function createResourceApiErrorResponseSchema() {
|
|
13984
|
-
return object({ error: object({
|
|
13985
|
-
code: resourceErrorCodeSchema,
|
|
13986
|
-
message: string$1(),
|
|
13987
|
-
issues: array(unknown()).optional(),
|
|
13988
|
-
retryable: boolean$1().optional()
|
|
13989
|
-
}) });
|
|
13990
|
-
}
|
|
13991
|
-
const resourceApiErrorResponseSchema = createResourceApiErrorResponseSchema();
|
|
13992
|
-
|
|
13993
|
-
//#endregion
|
|
13994
|
-
//#region ../api-contract/dist/xgraph.mjs
|
|
13995
|
-
const looseRecordSchema = record(string$1(), unknown());
|
|
13996
|
-
const pointSchema = object({
|
|
13997
|
-
x: number$1(),
|
|
13998
|
-
y: number$1()
|
|
13999
|
-
});
|
|
14000
|
-
const graphModeSchema = _enum([
|
|
14001
|
-
"directed",
|
|
14002
|
-
"undirected",
|
|
14003
|
-
"bidirectional"
|
|
14004
|
-
]);
|
|
14005
|
-
const nodeDataSchema = looseRecordSchema.refine((data) => !("parentId" in data), "XGraph node data must not contain parentId; use node.parentId.");
|
|
14006
|
-
const xgraphNodeSchema = object({
|
|
14007
|
-
id: string$1(),
|
|
14008
|
-
type: string$1().optional(),
|
|
14009
|
-
parentId: string$1().nullable().optional(),
|
|
14010
|
-
sourceId: string$1().optional(),
|
|
14011
|
-
targetId: string$1().optional(),
|
|
14012
|
-
label: string$1().nullable().optional(),
|
|
14013
|
-
data: nodeDataSchema.optional(),
|
|
14014
|
-
x: number$1().optional(),
|
|
14015
|
-
y: number$1().optional(),
|
|
14016
|
-
width: number$1().optional(),
|
|
14017
|
-
height: number$1().optional(),
|
|
14018
|
-
position: pointSchema.optional(),
|
|
14019
|
-
dx: number$1().optional(),
|
|
14020
|
-
dy: number$1().optional()
|
|
14021
|
-
}).passthrough();
|
|
14022
|
-
const xgraphEdgeSchema = object({
|
|
14023
|
-
id: string$1(),
|
|
14024
|
-
type: string$1().optional(),
|
|
14025
|
-
sourceId: string$1(),
|
|
14026
|
-
targetId: string$1(),
|
|
14027
|
-
mode: graphModeSchema.optional(),
|
|
14028
|
-
label: string$1().nullable().optional(),
|
|
14029
|
-
data: unknown().optional(),
|
|
14030
|
-
x: number$1().optional(),
|
|
14031
|
-
y: number$1().optional(),
|
|
14032
|
-
width: number$1().optional(),
|
|
14033
|
-
height: number$1().optional(),
|
|
14034
|
-
position: pointSchema.optional(),
|
|
14035
|
-
dx: number$1().optional(),
|
|
14036
|
-
dy: number$1().optional()
|
|
14037
|
-
}).passthrough();
|
|
14038
|
-
/** XGraph wire shape accepted and emitted at API boundaries. */
|
|
14039
|
-
const xgraphSchema = object({
|
|
14040
|
-
xgraphSchemaVersion: literal("1.0.0").optional(),
|
|
14041
|
-
id: string$1().optional(),
|
|
14042
|
-
type: string$1().optional(),
|
|
14043
|
-
mode: graphModeSchema.optional(),
|
|
14044
|
-
parentId: string$1().nullable().optional(),
|
|
14045
|
-
initialNodeId: string$1().nullable().optional(),
|
|
14046
|
-
nodes: array(xgraphNodeSchema),
|
|
14047
|
-
edges: array(xgraphEdgeSchema),
|
|
14048
|
-
data: unknown().optional(),
|
|
14049
|
-
layout: unknown().nullable().optional(),
|
|
14050
|
-
annotations: array(unknown()).optional(),
|
|
14051
|
-
direction: _enum([
|
|
14052
|
-
"up",
|
|
14053
|
-
"down",
|
|
14054
|
-
"left",
|
|
14055
|
-
"right"
|
|
14056
|
-
]).optional(),
|
|
14057
|
-
style: looseRecordSchema.optional()
|
|
14058
|
-
}).passthrough();
|
|
14059
|
-
|
|
14060
|
-
//#endregion
|
|
14061
|
-
//#region ../api-contract/dist/resources.mjs
|
|
14062
|
-
/**
|
|
14063
|
-
* Canonical schemas for persistent `/api/v1` resources plus the owned,
|
|
14064
|
-
* deterministic code-extraction operation.
|
|
14065
|
-
*
|
|
14066
|
-
* These models are canonical, not upstream-shaped: providers (e.g. the Stately
|
|
14067
|
-
* Registry adapter) are responsible for translating upstream envelopes,
|
|
14068
|
-
* identifier quirks and casing into these shapes. No `{ data }` envelope
|
|
14069
|
-
* appears anywhere; all timestamps are ISO strings.
|
|
14070
|
-
*/
|
|
14071
|
-
/**
|
|
14072
|
-
* XState major versions the editor targets (see
|
|
14073
|
-
* `packages/editor/src/formats/xstate.ts`).
|
|
14074
|
-
*/
|
|
14075
|
-
const xstateVersionSchema = union([literal(5), literal(6)]);
|
|
14076
|
-
const projectVisibilitySchema = _enum([
|
|
14077
|
-
"public",
|
|
14078
|
-
"unlisted",
|
|
14079
|
-
"private"
|
|
14080
|
-
]);
|
|
14081
|
-
const verifyResultSchema = object({
|
|
14082
|
-
valid: literal(true),
|
|
14083
|
-
tokenScope: _enum(["user", "project"])
|
|
14084
|
-
});
|
|
14085
|
-
/**
|
|
14086
|
-
* Entitlements for the authenticated caller.
|
|
14087
|
-
*
|
|
14088
|
-
* Internal contract: this is not published as an `/api/v1` operation. Editor
|
|
14089
|
-
* feature gating resolves it server-side through the resource provider and
|
|
14090
|
-
* hands the mapped result to the client (see
|
|
14091
|
-
* `packages/editor/src/entitlements`).
|
|
14092
|
-
*
|
|
14093
|
-
* `entitlements` is an open set of provider-defined strings; unknown values are
|
|
14094
|
-
* ignored rather than rejected.
|
|
14095
|
-
*/
|
|
14096
|
-
const entitlementsResultSchema = object({
|
|
14097
|
-
subscription: object({
|
|
14098
|
-
tier: string$1(),
|
|
14099
|
-
status: string$1()
|
|
14100
|
-
}).nullable(),
|
|
14101
|
-
entitlements: array(string$1())
|
|
14102
|
-
});
|
|
14103
|
-
/**
|
|
14104
|
-
* Which editor format a machine's stored definition is in: `digraph` is the
|
|
14105
|
-
* original (legacy) editor's format, `xgraph` the current one.
|
|
14106
|
-
*/
|
|
14107
|
-
const machineDefinitionFormatSchema = _enum(["digraph", "xgraph"]);
|
|
14108
|
-
/**
|
|
14109
|
-
* `name` and `updatedAt` are optional: some upstream project envelopes only
|
|
14110
|
-
* return machine ids. Providers that can supply them cheaply should.
|
|
14111
|
-
*/
|
|
14112
|
-
const projectMachineSummarySchema = object({
|
|
14113
|
-
machineId: string$1(),
|
|
14114
|
-
name: string$1().optional(),
|
|
14115
|
-
updatedAt: string$1().optional(),
|
|
14116
|
-
format: machineDefinitionFormatSchema.optional()
|
|
14117
|
-
});
|
|
14118
|
-
/**
|
|
14119
|
-
* A project list row. It carries the project's machine roster, not just its
|
|
14120
|
-
* metadata, so a client can mount a whole workspace from one `projects.list`
|
|
14121
|
-
* response and fetch definitions lazily.
|
|
14122
|
-
*/
|
|
14123
|
-
const projectSummarySchema = object({
|
|
14124
|
-
projectId: string$1(),
|
|
14125
|
-
projectVersionId: string$1(),
|
|
14126
|
-
name: string$1(),
|
|
14127
|
-
ownership: _enum(["personal", "team"]).optional(),
|
|
14128
|
-
description: string$1().nullable(),
|
|
14129
|
-
visibility: projectVisibilitySchema,
|
|
14130
|
-
createdAt: string$1(),
|
|
14131
|
-
updatedAt: string$1(),
|
|
14132
|
-
rootMachineId: string$1().nullable().optional(),
|
|
14133
|
-
machines: array(projectMachineSummarySchema).optional(),
|
|
14134
|
-
permissions: object({ canEdit: boolean$1() }).optional(),
|
|
14135
|
-
allowedVisibility: array(projectVisibilitySchema).optional()
|
|
14136
|
-
});
|
|
14137
|
-
const projectSchema = projectSummarySchema.extend({
|
|
14138
|
-
rootMachineId: string$1().nullable(),
|
|
14139
|
-
machines: array(projectMachineSummarySchema),
|
|
14140
|
-
permissions: object({ canEdit: boolean$1() })
|
|
14141
|
-
});
|
|
14142
|
-
const machineSchema = object({
|
|
14143
|
-
machineId: string$1(),
|
|
14144
|
-
name: string$1(),
|
|
14145
|
-
projectId: string$1().optional(),
|
|
14146
|
-
projectVersionId: string$1(),
|
|
14147
|
-
definition: unknown(),
|
|
14148
|
-
graph: xgraphSchema.optional(),
|
|
14149
|
-
createdAt: string$1().optional(),
|
|
14150
|
-
updatedAt: string$1().optional(),
|
|
14151
|
-
format: machineDefinitionFormatSchema.optional()
|
|
14152
|
-
});
|
|
14153
|
-
const machineVersionSchema = object({
|
|
14154
|
-
machineVersionId: string$1(),
|
|
14155
|
-
machineId: string$1(),
|
|
14156
|
-
versionNumber: number$1(),
|
|
14157
|
-
name: string$1(),
|
|
14158
|
-
definition: unknown(),
|
|
14159
|
-
createdAt: string$1(),
|
|
14160
|
-
updatedAt: string$1(),
|
|
14161
|
-
format: machineDefinitionFormatSchema.optional()
|
|
14162
|
-
});
|
|
14163
|
-
/** Version-history row without the definition payload. */
|
|
14164
|
-
const machineVersionSummarySchema = object({
|
|
14165
|
-
machineVersionId: string$1(),
|
|
14166
|
-
machineId: string$1(),
|
|
14167
|
-
versionNumber: number$1(),
|
|
14168
|
-
name: string$1().nullable(),
|
|
14169
|
-
status: string$1(),
|
|
14170
|
-
parentVersionId: string$1().nullable(),
|
|
14171
|
-
createdAt: string$1(),
|
|
14172
|
-
updatedAt: string$1(),
|
|
14173
|
-
format: machineDefinitionFormatSchema.optional()
|
|
14174
|
-
});
|
|
14175
|
-
/** Result of converting a machine's stored definition to XGraph in place. */
|
|
14176
|
-
const machinesConvertResultSchema = object({
|
|
14177
|
-
machine: machineSchema,
|
|
14178
|
-
created: boolean$1(),
|
|
14179
|
-
version: object({
|
|
14180
|
-
machineVersionId: string$1(),
|
|
14181
|
-
versionNumber: number$1(),
|
|
14182
|
-
name: string$1().nullable()
|
|
14183
|
-
})
|
|
14184
|
-
});
|
|
14185
|
-
/**
|
|
14186
|
-
* A project the caller may fork a machine into, with the version ids a fork
|
|
14187
|
-
* can target. `projectVersionIds` is ordered as the provider reports it.
|
|
14188
|
-
*/
|
|
14189
|
-
const projectDestinationProjectSchema = object({
|
|
14190
|
-
projectId: string$1(),
|
|
14191
|
-
name: string$1(),
|
|
14192
|
-
visibility: projectVisibilitySchema,
|
|
14193
|
-
projectVersionIds: array(string$1())
|
|
14194
|
-
});
|
|
14195
|
-
/**
|
|
14196
|
-
* Fork destinations grouped by owner. The caller's personal projects are one
|
|
14197
|
-
* owner alongside each team; `ownerId` is opaque and provider-defined.
|
|
14198
|
-
*/
|
|
14199
|
-
const projectDestinationSchema = object({
|
|
14200
|
-
ownerId: string$1(),
|
|
14201
|
-
name: string$1(),
|
|
14202
|
-
projects: array(projectDestinationProjectSchema)
|
|
14203
|
-
});
|
|
14204
|
-
/** Result of forking a machine into a new or existing project version. */
|
|
14205
|
-
const machinesForkResultSchema = object({
|
|
14206
|
-
machine: machineSchema,
|
|
14207
|
-
projectVersionId: string$1(),
|
|
14208
|
-
projectId: string$1()
|
|
14209
|
-
});
|
|
14210
|
-
/**
|
|
14211
|
-
* The version holding a machine's pre-conversion (legacy editor) definition.
|
|
14212
|
-
* `versionId` is `null` when the machine has no such version, which is the
|
|
14213
|
-
* signal that the legacy editor cannot be re-entered for it.
|
|
14214
|
-
*/
|
|
14215
|
-
const machineLegacyVersionSchema = object({ versionId: string$1().nullable() });
|
|
14216
|
-
/** Result of restoring a machine's legacy-editor definition. */
|
|
14217
|
-
const machinesRestoreLegacyResultSchema = object({
|
|
14218
|
-
machine: machineSchema,
|
|
14219
|
-
version: object({
|
|
14220
|
-
machineVersionId: string$1(),
|
|
14221
|
-
versionNumber: number$1(),
|
|
14222
|
-
name: string$1().nullable()
|
|
14223
|
-
})
|
|
14224
|
-
});
|
|
14225
|
-
/**
|
|
14226
|
-
* Result of restoring a machine to one of its own versions.
|
|
14227
|
-
*
|
|
14228
|
-
* `capturedVersion` is the new version holding the machine's *pre-restore*
|
|
14229
|
-
* definition, so the restore itself is undoable. It is `null` when the restore
|
|
14230
|
-
* was a no-op (the machine already held that version's definition), which is
|
|
14231
|
-
* the signal that no history row was added.
|
|
14232
|
-
*/
|
|
14233
|
-
const machinesRestoreVersionResultSchema = object({
|
|
14234
|
-
machine: machineSchema,
|
|
14235
|
-
capturedVersion: machineVersionSummarySchema.nullable()
|
|
14236
|
-
});
|
|
14237
|
-
const extractedMachinesSchema = object({ machines: array(object({
|
|
14238
|
-
config: record(string$1(), unknown()),
|
|
14239
|
-
machineIndex: number$1().int().nonnegative().optional()
|
|
14240
|
-
})) });
|
|
14241
|
-
const projectsCreateRequestSchema = object({
|
|
14242
|
-
name: string$1().min(1),
|
|
14243
|
-
visibility: projectVisibilitySchema
|
|
14244
|
-
});
|
|
14245
|
-
const projectsUpdateRequestSchema = object({
|
|
14246
|
-
name: string$1().min(1).optional(),
|
|
14247
|
-
description: string$1().nullable().optional(),
|
|
14248
|
-
visibility: projectVisibilitySchema.optional()
|
|
14249
|
-
}).refine((value) => value.name !== void 0 || value.description !== void 0 || value.visibility !== void 0, { message: "At least one of `name`, `description` or `visibility` is required." });
|
|
14250
|
-
const machinesCreateRequestSchema = object({
|
|
14251
|
-
projectVersionId: string$1().min(1),
|
|
14252
|
-
xstateVersion: xstateVersionSchema,
|
|
14253
|
-
name: string$1().min(1).optional(),
|
|
14254
|
-
definition: unknown().optional()
|
|
14255
|
-
});
|
|
14256
|
-
const machinesUpdateRequestSchema = object({
|
|
14257
|
-
name: string$1().min(1).optional(),
|
|
14258
|
-
definition: unknown().optional(),
|
|
14259
|
-
expectedUpdatedAt: string$1().min(1).optional()
|
|
14260
|
-
}).refine((value) => value.name !== void 0 || value.definition !== void 0, { message: "At least one of `name` or `definition` is required." });
|
|
14261
|
-
/**
|
|
14262
|
-
* `status` is canonical lowercase; providers map it to their own casing.
|
|
14263
|
-
* Omitting `definition` snapshots the machine's current definition.
|
|
14264
|
-
*/
|
|
14265
|
-
const machineVersionsCreateRequestSchema = object({
|
|
14266
|
-
name: string$1().min(1).optional(),
|
|
14267
|
-
definition: unknown().optional(),
|
|
14268
|
-
status: _enum(["committed", "auto"]).optional(),
|
|
14269
|
-
parentVersionId: string$1().min(1).optional()
|
|
14270
|
-
});
|
|
14271
|
-
const machinesConvertRequestSchema = object({
|
|
14272
|
-
definition: xgraphSchema,
|
|
14273
|
-
expectedUpdatedAt: string$1().min(1),
|
|
14274
|
-
keepOriginalVersion: boolean$1().optional()
|
|
14275
|
-
});
|
|
14276
|
-
/**
|
|
14277
|
-
* Fork a machine into exactly one target: an existing project version, or a
|
|
14278
|
-
* new project to create for it. Both, or neither, is a client bug.
|
|
14279
|
-
*/
|
|
14280
|
-
const machinesForkRequestSchema = object({
|
|
14281
|
-
targetProjectVersionId: string$1().min(1).optional(),
|
|
14282
|
-
targetProject: object({
|
|
14283
|
-
name: string$1().min(1),
|
|
14284
|
-
visibility: projectVisibilitySchema,
|
|
14285
|
-
teamId: string$1().min(1).optional()
|
|
14286
|
-
}).optional(),
|
|
14287
|
-
machineName: string$1().min(1).optional(),
|
|
14288
|
-
xstateVersion: xstateVersionSchema.optional()
|
|
14289
|
-
}).refine((value) => value.targetProjectVersionId === void 0 !== (value.targetProject === void 0), { message: "Exactly one of `targetProjectVersionId` or `targetProject` is required." });
|
|
14290
|
-
const machinesRestoreLegacyRequestSchema = object({
|
|
14291
|
-
versionId: string$1().min(1).optional(),
|
|
14292
|
-
expectedUpdatedAt: string$1().min(1),
|
|
14293
|
-
reason: string$1().optional()
|
|
14294
|
-
});
|
|
14295
|
-
const machinesRestoreVersionRequestSchema = object({ expectedUpdatedAt: string$1().min(1).optional() });
|
|
14296
|
-
const codeExtractMachinesRequestSchema = object({
|
|
14297
|
-
code: string$1().min(1),
|
|
14298
|
-
xstateVersion: xstateVersionSchema.optional()
|
|
14299
|
-
});
|
|
14300
|
-
const authVerifyResponseSchema = verifyResultSchema;
|
|
14301
|
-
const projectsListResponseSchema = array(projectSummarySchema);
|
|
14302
|
-
const projectsGetResponseSchema = projectSchema;
|
|
14303
|
-
const projectsCreateResponseSchema = projectSchema;
|
|
14304
|
-
const projectsUpdateResponseSchema = projectSchema;
|
|
14305
|
-
const projectsDeleteResponseSchema = object({ projectId: string$1() });
|
|
14306
|
-
const projectsListMachinesResponseSchema = array(projectMachineSummarySchema);
|
|
14307
|
-
const projectsDestinationsResponseSchema = array(projectDestinationSchema);
|
|
14308
|
-
const machinesCreateResponseSchema = machineSchema;
|
|
14309
|
-
const machinesGetResponseSchema = machineSchema;
|
|
14310
|
-
const machinesUpdateResponseSchema = machineSchema;
|
|
14311
|
-
const machinesGetVersionResponseSchema = machineVersionSchema;
|
|
14312
|
-
const machineVersionsListResponseSchema = array(machineVersionSummarySchema);
|
|
14313
|
-
const machineVersionsCreateResponseSchema = machineVersionSchema;
|
|
14314
|
-
const machinesConvertDefinitionResponseSchema = machinesConvertResultSchema;
|
|
14315
|
-
const machinesForkResponseSchema = machinesForkResultSchema;
|
|
14316
|
-
const machinesGetLegacyVersionResponseSchema = machineLegacyVersionSchema;
|
|
14317
|
-
const machinesRestoreLegacyResponseSchema = machinesRestoreLegacyResultSchema;
|
|
14318
|
-
const machinesRestoreVersionResponseSchema = machinesRestoreVersionResultSchema;
|
|
14319
|
-
const codeExtractMachinesResponseSchema = extractedMachinesSchema;
|
|
14320
|
-
/**
|
|
14321
|
-
* Request/response schema pairs keyed by resource capability name. Kept here
|
|
14322
|
-
* rather than on the `Capability` metadata entries so that the capability
|
|
14323
|
-
* registry stays plain, serialisable data.
|
|
14324
|
-
*/
|
|
14325
|
-
const resourceOperationSchemas = {
|
|
14326
|
-
"auth.verify": { response: authVerifyResponseSchema },
|
|
14327
|
-
"projects.list": { response: projectsListResponseSchema },
|
|
14328
|
-
"projects.create": {
|
|
14329
|
-
request: projectsCreateRequestSchema,
|
|
14330
|
-
response: projectsCreateResponseSchema
|
|
14331
|
-
},
|
|
14332
|
-
"projects.get": { response: projectsGetResponseSchema },
|
|
14333
|
-
"projects.update": {
|
|
14334
|
-
request: projectsUpdateRequestSchema,
|
|
14335
|
-
response: projectsUpdateResponseSchema
|
|
14336
|
-
},
|
|
14337
|
-
"projects.delete": { response: projectsDeleteResponseSchema },
|
|
14338
|
-
"projects.listMachines": { response: projectsListMachinesResponseSchema },
|
|
14339
|
-
"projects.destinations": { response: projectsDestinationsResponseSchema },
|
|
14340
|
-
"machines.create": {
|
|
14341
|
-
request: machinesCreateRequestSchema,
|
|
14342
|
-
response: machinesCreateResponseSchema
|
|
14343
|
-
},
|
|
14344
|
-
"machines.get": { response: machinesGetResponseSchema },
|
|
14345
|
-
"machines.getVersion": { response: machinesGetVersionResponseSchema },
|
|
14346
|
-
"machines.update": {
|
|
14347
|
-
request: machinesUpdateRequestSchema,
|
|
14348
|
-
response: machinesUpdateResponseSchema
|
|
14349
|
-
},
|
|
14350
|
-
"machines.versions.list": { response: machineVersionsListResponseSchema },
|
|
14351
|
-
"machines.versions.create": {
|
|
14352
|
-
request: machineVersionsCreateRequestSchema,
|
|
14353
|
-
response: machineVersionsCreateResponseSchema
|
|
14354
|
-
},
|
|
14355
|
-
"machines.convertDefinition": {
|
|
14356
|
-
request: machinesConvertRequestSchema,
|
|
14357
|
-
response: machinesConvertDefinitionResponseSchema
|
|
14358
|
-
},
|
|
14359
|
-
"machines.fork": {
|
|
14360
|
-
request: machinesForkRequestSchema,
|
|
14361
|
-
response: machinesForkResponseSchema
|
|
14362
|
-
},
|
|
14363
|
-
"machines.getLegacyVersion": { response: machinesGetLegacyVersionResponseSchema },
|
|
14364
|
-
"machines.restoreLegacy": {
|
|
14365
|
-
request: machinesRestoreLegacyRequestSchema,
|
|
14366
|
-
response: machinesRestoreLegacyResponseSchema
|
|
14367
|
-
},
|
|
14368
|
-
"machines.restoreVersion": {
|
|
14369
|
-
request: machinesRestoreVersionRequestSchema,
|
|
14370
|
-
response: machinesRestoreVersionResponseSchema
|
|
14371
|
-
}
|
|
14372
|
-
};
|
|
14373
|
-
/** Provider-independent operations implemented by this repository. */
|
|
14374
|
-
const codeOperationSchemas = { "code.extractMachines": {
|
|
14375
|
-
request: codeExtractMachinesRequestSchema,
|
|
14376
|
-
response: codeExtractMachinesResponseSchema
|
|
14377
|
-
} };
|
|
14378
|
-
/** Every owned API operation with a canonical request/response contract. */
|
|
14379
|
-
const operationSchemas = {
|
|
14380
|
-
...resourceOperationSchemas,
|
|
14381
|
-
...codeOperationSchemas
|
|
14382
|
-
};
|
|
14383
|
-
|
|
14384
|
-
//#endregion
|
|
14385
|
-
//#region src/studio.ts
|
|
14386
|
-
/**
|
|
14387
|
-
* Remote client for the owned Stately resource contract (`/api/v1/*`).
|
|
14388
|
-
*
|
|
14389
|
-
* Every method targets our own routes (never the legacy Registry API), sends
|
|
14390
|
-
* JSON bodies with a bearer credential, and validates responses against the
|
|
14391
|
-
* canonical Zod schemas from `@statelyai/api-contract`. Responses are canonical
|
|
14392
|
-
* values directly: there is no `{ data }` envelope. Errors use the nested
|
|
14393
|
-
* envelope `{ error: { code, message, issues?, retryable? } }`.
|
|
14394
|
-
*/
|
|
14395
|
-
/** Default base URL of the editor/API deployment hosting `/api/v1`. */
|
|
14396
|
-
const DEFAULT_STATELY_BASE_URL = "https://editor.stately.ai";
|
|
14397
|
-
var StudioApiError = class extends Error {
|
|
14398
|
-
status;
|
|
14399
|
-
/** Canonical resource error code, when the server sent one. */
|
|
14400
|
-
code;
|
|
14401
|
-
issues;
|
|
14402
|
-
retryable;
|
|
14403
|
-
constructor(message, status, options = {}) {
|
|
14404
|
-
super(message);
|
|
14405
|
-
this.name = "StudioApiError";
|
|
14406
|
-
this.status = status;
|
|
14407
|
-
this.code = options.code;
|
|
14408
|
-
this.issues = options.issues;
|
|
14409
|
-
this.retryable = options.retryable;
|
|
14410
|
-
}
|
|
14411
|
-
};
|
|
14412
|
-
function getFetch(fetchImpl) {
|
|
14413
|
-
const resolvedFetch = fetchImpl ?? globalThis.fetch;
|
|
14414
|
-
if (!resolvedFetch) throw new Error("No fetch implementation available. Pass one via createStatelyClient({ fetch }).");
|
|
14415
|
-
return resolvedFetch;
|
|
14416
|
-
}
|
|
14417
|
-
function joinApiUrl(baseUrl, path) {
|
|
14418
|
-
return `${baseUrl.replace(/\/+$/, "")}/api/v1${path}`;
|
|
14419
|
-
}
|
|
14420
|
-
async function parseJson(response) {
|
|
14421
|
-
if (!response.headers.get("content-type")?.includes("application/json")) return null;
|
|
14422
|
-
return response.json().catch(() => null);
|
|
14423
|
-
}
|
|
14424
|
-
function toApiError(data, status) {
|
|
14425
|
-
const parsed = resourceApiErrorResponseSchema.safeParse(data);
|
|
14426
|
-
if (parsed.success) {
|
|
14427
|
-
const { code, message, issues, retryable } = parsed.data.error;
|
|
14428
|
-
return new StudioApiError(message, status, {
|
|
14429
|
-
code,
|
|
14430
|
-
issues,
|
|
14431
|
-
retryable
|
|
14432
|
-
});
|
|
14433
|
-
}
|
|
14434
|
-
if (typeof data === "object" && data !== null && "error" in data && typeof data.error === "string") return new StudioApiError(data.error, status);
|
|
14435
|
-
return new StudioApiError(`HTTP ${status}`, status);
|
|
14436
|
-
}
|
|
14437
|
-
function normalizeVisibility(visibility) {
|
|
14438
|
-
return visibility.toLowerCase();
|
|
14439
|
-
}
|
|
14440
|
-
function normalizeXStateVersion(xstateVersion) {
|
|
14441
|
-
return xstateVersion === void 0 || xstateVersion === 4 ? 5 : xstateVersion;
|
|
14442
|
-
}
|
|
14443
|
-
function normalizeExtractXStateVersion(xstateVersion) {
|
|
14444
|
-
return xstateVersion === 4 ? 5 : xstateVersion;
|
|
14445
|
-
}
|
|
14446
|
-
function withMachineAlias(machine) {
|
|
14447
|
-
return {
|
|
14448
|
-
...machine,
|
|
14449
|
-
definition: machine.definition,
|
|
14450
|
-
id: machine.machineId
|
|
14451
|
-
};
|
|
14452
|
-
}
|
|
14453
|
-
function withProjectAlias(project) {
|
|
14454
|
-
return {
|
|
14455
|
-
...project,
|
|
14456
|
-
id: project.projectVersionId
|
|
14457
|
-
};
|
|
14458
|
-
}
|
|
14459
|
-
function isCredentialLike(value) {
|
|
14460
|
-
if (typeof value === "string") return true;
|
|
14461
|
-
return typeof value === "object" && value !== null && "type" in value && (value.type === "api_key" || value.type === "oauth");
|
|
14462
|
-
}
|
|
14463
|
-
function createStatelyClient(options = {}) {
|
|
14464
|
-
const baseUrl = options.baseUrl ?? DEFAULT_STATELY_BASE_URL;
|
|
14465
|
-
const fetchImpl = getFetch(options.fetch);
|
|
14466
|
-
const defaultCredential = options.credential ?? (options.apiKey ? {
|
|
14467
|
-
type: "api_key",
|
|
14468
|
-
token: options.apiKey
|
|
14469
|
-
} : void 0);
|
|
14470
|
-
const defaultAuthMode = options.authMode ?? "auto";
|
|
14471
|
-
async function request(path, init, schema, requestOptions = {}) {
|
|
14472
|
-
const headers = new Headers(init.headers);
|
|
14473
|
-
const authMode = requestOptions.authMode ?? defaultAuthMode;
|
|
14474
|
-
const credential = requestOptions.credential ?? defaultCredential;
|
|
14475
|
-
if (authMode !== "none") {
|
|
14476
|
-
const token = getCredentialToken(credential);
|
|
14477
|
-
if (authMode === "bearer" && (!token || !credential)) throw new StudioApiError("No Stately credential configured. Pass createStatelyClient({ credential }) or use authMode: \"auto\" to let the server decide whether authentication is required.", 401, { code: "unauthenticated" });
|
|
14478
|
-
if (token && credential) headers.set("Authorization", createAuthorizationHeader(credential));
|
|
14479
|
-
}
|
|
14480
|
-
const response = await fetchImpl(joinApiUrl(baseUrl, path), {
|
|
14481
|
-
...init,
|
|
14482
|
-
headers,
|
|
14483
|
-
...requestOptions.signal ? { signal: requestOptions.signal } : {}
|
|
14484
|
-
});
|
|
14485
|
-
const data = await parseJson(response);
|
|
14486
|
-
if (!response.ok) throw toApiError(data, response.status);
|
|
14487
|
-
const parsed = schema.safeParse(data);
|
|
14488
|
-
if (!parsed.success) throw new StudioApiError(`Unexpected response for ${path}: ${parsed.error.message}`, response.status, {
|
|
14489
|
-
code: "internal_error",
|
|
14490
|
-
issues: [...parsed.error.issues]
|
|
14491
|
-
});
|
|
14492
|
-
return parsed.data;
|
|
14493
|
-
}
|
|
14494
|
-
function jsonInit(method, body) {
|
|
14495
|
-
return {
|
|
14496
|
-
method,
|
|
14497
|
-
headers: { "Content-Type": "application/json" },
|
|
14498
|
-
body: JSON.stringify(body)
|
|
14499
|
-
};
|
|
14500
|
-
}
|
|
14501
|
-
const projects = {
|
|
14502
|
-
list(requestOptions) {
|
|
14503
|
-
return request("/projects", { method: "GET" }, projectsListResponseSchema, requestOptions);
|
|
14504
|
-
},
|
|
14505
|
-
create(input, requestOptions) {
|
|
14506
|
-
return request("/projects", jsonInit("POST", {
|
|
14507
|
-
name: input.name,
|
|
14508
|
-
visibility: normalizeVisibility(input.visibility)
|
|
14509
|
-
}), projectSchema, requestOptions).then(withProjectAlias);
|
|
14510
|
-
},
|
|
14511
|
-
get(projectId, requestOptions) {
|
|
14512
|
-
return request(`/projects/${encodeURIComponent(projectId)}`, { method: "GET" }, projectSchema, requestOptions).then(withProjectAlias);
|
|
14513
|
-
},
|
|
14514
|
-
update(projectId, input, requestOptions) {
|
|
14515
|
-
return request(`/projects/${encodeURIComponent(projectId)}`, jsonInit("PATCH", {
|
|
14516
|
-
...input.name !== void 0 ? { name: input.name } : {},
|
|
14517
|
-
...input.description !== void 0 ? { description: input.description } : {},
|
|
14518
|
-
...input.visibility !== void 0 ? { visibility: normalizeVisibility(input.visibility) } : {}
|
|
14519
|
-
}), projectSchema, requestOptions).then(withProjectAlias);
|
|
14520
|
-
},
|
|
14521
|
-
delete(projectId, requestOptions) {
|
|
14522
|
-
return request(`/projects/${encodeURIComponent(projectId)}`, { method: "DELETE" }, projectsDeleteResponseSchema, requestOptions);
|
|
14523
|
-
},
|
|
14524
|
-
listMachines(projectId, requestOptions) {
|
|
14525
|
-
return request(`/projects/${encodeURIComponent(projectId)}/machines`, { method: "GET" }, projectsListMachinesResponseSchema, requestOptions);
|
|
14526
|
-
},
|
|
14527
|
-
async ensure(input, requestOptions) {
|
|
14528
|
-
if (input.matchConnectedRepo !== false) {
|
|
14529
|
-
const match = (await projects.list(requestOptions)).find((candidate) => candidate.name === input.name);
|
|
14530
|
-
if (match) return projects.get(match.projectId, requestOptions);
|
|
14531
|
-
}
|
|
14532
|
-
return projects.create(input, requestOptions);
|
|
14533
|
-
}
|
|
14534
|
-
};
|
|
14535
|
-
const machines = {
|
|
14536
|
-
create(input, requestOptions) {
|
|
14537
|
-
return request("/machines", jsonInit("POST", {
|
|
14538
|
-
projectVersionId: input.projectVersionId,
|
|
14539
|
-
xstateVersion: normalizeXStateVersion(input.xstateVersion),
|
|
14540
|
-
...input.name !== void 0 ? { name: input.name } : {},
|
|
14541
|
-
...input.definition !== void 0 ? { definition: input.definition } : {}
|
|
14542
|
-
}), machineSchema, requestOptions).then((machine) => withMachineAlias(machine));
|
|
14543
|
-
},
|
|
14544
|
-
async createMany(input, requestOptions) {
|
|
14545
|
-
return [await machines.create(input, requestOptions)];
|
|
14546
|
-
},
|
|
14547
|
-
get(machineId, getOptions = {}) {
|
|
14548
|
-
return request(`/machines/${encodeURIComponent(machineId)}`, { method: "GET" }, machineSchema, getOptions).then((machine) => withMachineAlias(machine));
|
|
14549
|
-
},
|
|
14550
|
-
getVersion(machineId, versionId, requestOptions) {
|
|
14551
|
-
return request(`/machines/${encodeURIComponent(machineId)}/versions/${encodeURIComponent(versionId)}`, { method: "GET" }, machineVersionSchema, requestOptions);
|
|
14552
|
-
},
|
|
14553
|
-
update(machineIdOrInput, inputOrOptions, maybeOptions) {
|
|
14554
|
-
const machineId = typeof machineIdOrInput === "string" ? machineIdOrInput : machineIdOrInput.machineId ?? machineIdOrInput.id;
|
|
14555
|
-
if (!machineId) throw new StudioApiError("machines.update requires a machine id.", 400, { code: "bad_request" });
|
|
14556
|
-
const input = (typeof machineIdOrInput === "string" ? inputOrOptions : machineIdOrInput) ?? {};
|
|
14557
|
-
const requestOptions = typeof machineIdOrInput === "string" ? maybeOptions : inputOrOptions;
|
|
14558
|
-
return request(`/machines/${encodeURIComponent(machineId)}`, jsonInit("PATCH", {
|
|
14559
|
-
...input.name !== void 0 ? { name: input.name } : {},
|
|
14560
|
-
...input.definition !== void 0 ? { definition: input.definition } : {},
|
|
14561
|
-
...input.expectedUpdatedAt !== void 0 ? { expectedUpdatedAt: input.expectedUpdatedAt } : {}
|
|
14562
|
-
}), machineSchema, requestOptions).then((machine) => withMachineAlias(machine));
|
|
14563
|
-
}
|
|
14564
|
-
};
|
|
14565
|
-
return {
|
|
14566
|
-
auth: { verify(credentialOrOptions, verifyOptions) {
|
|
14567
|
-
return request("/auth/verify", { method: "GET" }, verifyResultSchema, isCredentialLike(credentialOrOptions) ? {
|
|
14568
|
-
...verifyOptions,
|
|
14569
|
-
credential: credentialOrOptions
|
|
14570
|
-
} : credentialOrOptions ?? verifyOptions ?? {});
|
|
14571
|
-
} },
|
|
14572
|
-
projects,
|
|
14573
|
-
machines,
|
|
14574
|
-
code: { extractMachines(codeOrInput, extractOptions = {}) {
|
|
14575
|
-
const input = typeof codeOrInput === "string" ? {
|
|
14576
|
-
code: codeOrInput,
|
|
14577
|
-
xstateVersion: extractOptions.xstateVersion
|
|
14578
|
-
} : codeOrInput;
|
|
14579
|
-
const legacyOptions = extractOptions;
|
|
14580
|
-
const credential = legacyOptions.credential ?? (legacyOptions.apiKey ? {
|
|
14581
|
-
type: "api_key",
|
|
14582
|
-
token: legacyOptions.apiKey
|
|
14583
|
-
} : void 0);
|
|
14584
|
-
return request("/code/extract-machines", jsonInit("POST", {
|
|
14585
|
-
code: input.code,
|
|
14586
|
-
xstateVersion: normalizeExtractXStateVersion(input.xstateVersion)
|
|
14587
|
-
}), extractedMachinesSchema, {
|
|
14588
|
-
...extractOptions,
|
|
14589
|
-
credential
|
|
14590
|
-
});
|
|
14591
|
-
} }
|
|
14592
|
-
};
|
|
14593
|
-
}
|
|
14594
|
-
|
|
14595
|
-
//#endregion
|
|
14596
|
-
export { StudioApiError as n, createStatelyClient as r, DEFAULT_STATELY_BASE_URL as t };
|
|
12983
|
+
export { ZodString as $, uuid as $n, _property as $r, int as $t, ZodJWT as A, preprocess as An, _coercedDate as Ar, boolean as At, ZodNull as B, stringbool as Bn, _lte as Br, discriminatedUnion as Bt, ZodExactOptional as C, config as Ci, nullish as Cn, iso_exports as Cr, _undefined as Ct, ZodIPv4 as D, partialRecord as Dn, TimePrecision as Dr, base64 as Dt, ZodGUID as E, optional as En, toJSONSchema as Er, array as Et, ZodMap as F, schemas_exports as Fn, _gte as Fr, cuid as Ft, ZodOptional as G, transform as Gn, _minSize as Gr, file as Gt, ZodNumber as H, superRefine as Hn, _maxSize as Hr, email as Ht, ZodNaN as I, set as In, _includes as Ir, cuid2 as It, ZodPreprocess as J, uint64 as Jn, _nonnegative as Jr, guid as Jt, ZodPipe as K, tuple as Kn, _multipleOf as Kr, float32 as Kt, ZodNanoID as L, strictObject as Ln, _length as Lr, custom as Lt, ZodLazy as M, readonly as Mn, _coercedString as Mr, cidrv4 as Mt, ZodLiteral as N, record as Nn, _endsWith as Nr, cidrv6 as Nt, ZodIPv6 as O, pipe as On, _coercedBigint as Or, base64url as Ot, ZodMAC as P, refine as Pn, _gt as Pr, codec as Pt, ZodSet as Q, url as Qn, _positive as Qr, httpUrl as Qt, ZodNever as R, string as Rn, _lowercase as Rr, date as Rt, ZodEnum as S, NEVER as Si, nullable as Sn, ZodISOTime as Sr, _null as St, ZodFunction as T, object as Tn, core_exports as Tr, any as Tt, ZodNumberFormat as U, symbol as Un, _mime as Ur, emoji as Ut, ZodNullable as V, success as Vn, _maxLength as Vr, e164 as Vt, ZodObject as W, templateLiteral as Wn, _minLength as Wr, exactOptional as Wt, ZodReadonly as X, union as Xn, _normalize as Xr, hex as Xt, ZodPromise as Y, ulid as Yn, _nonpositive as Yr, hash as Yt, ZodRecord as Z, unknown as Zn, _overwrite as Zr, hostname as Zt, ZodDefault as _, prettifyError as _i, nan as _n, ZodError as _r, _catch as _t, ZodBigInt as a, _toUpperCase as ai, ipv6 as an, decode as ar, ZodTuple as at, ZodEmail as b, util_exports as bi, never as bn, ZodISODateTime as br, _function as bt, ZodCIDRv4 as c, $input as ci, keyof as cn, encodeAsync as cr, ZodURL as ct, ZodCUID2 as d, registry as di, literal as dn, safeDecode as dr, ZodUnion as dt, _regex as ei, int32 as en, uuidv4 as er, ZodStringFormat as et, ZodCatch as f, locales_exports as fi, looseObject as fn, safeDecodeAsync as fr, ZodUnknown as ft, ZodDate as g, formatError as gi, meta as gn, safeParseAsync as gr, _ZodString as gt, ZodCustomStringFormat as h, flattenError as hi, map as hn, safeParse as hr, ZodXor as ht, ZodBase64URL as i, _toLowerCase as ii, ipv4 as in, xor as ir, ZodTransform as it, ZodKSUID as j, promise as jn, _coercedNumber as jr, check as jt, ZodIntersection as k, prefault as kn, _coercedBoolean as kr, bigint as kt, ZodCIDRv6 as l, $output as li, ksuid as ln, parse as lr, ZodUUID as lt, ZodCustom as m, regexes_exports as mi, mac as mn, safeEncodeAsync as mr, ZodXID as mt, ZodArray as n, _slugify as ni, intersection as nn, uuidv7 as nr, ZodSymbol as nt, ZodBigIntFormat as o, _trim as oi, json as on, decodeAsync as or, ZodType as ot, ZodCodec as p, en_default as pi, looseRecord as pn, safeEncode as pr, ZodVoid as pt, ZodPrefault as q, uint32 as qn, _negative as qr, float64 as qt, ZodBase64 as r, _startsWith as ri, invertCodec as rn, xid as rr, ZodTemplateLiteral as rt, ZodBoolean as s, _uppercase as si, jwt as sn, encode as sr, ZodULID as st, ZodAny as t, _size as ti, int64 as tn, uuidv6 as tr, ZodSuccess as tt, ZodCUID as u, globalRegistry as ui, lazy as un, parseAsync as ur, ZodUndefined as ut, ZodDiscriminatedUnion as v, treeifyError as vi, nanoid as vn, ZodRealError as vr, _default as vt, ZodFile as w, number as wn, checks_exports as wr, _void as wt, ZodEmoji as x, $brand as xi, nonoptional as xn, ZodISODuration as xr, _instanceof as xt, ZodE164 as y, clone as yi, nativeEnum as yn, ZodISODate as yr, _enum as yt, ZodNonOptional as z, stringFormat as zn, _lt as zr, describe as zt };
|