@mastra/server 0.21.0-alpha.1 → 0.21.0-alpha.4
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/CHANGELOG.md +23 -0
- package/dist/{chunk-SBWOUCO3.cjs → chunk-7HDOBOGG.cjs} +717 -2716
- package/dist/chunk-7HDOBOGG.cjs.map +1 -0
- package/dist/{chunk-5BNQIYQN.js → chunk-AW5BU3RQ.js} +6 -3
- package/dist/chunk-AW5BU3RQ.js.map +1 -0
- package/dist/{chunk-DTBJ3D22.js → chunk-FWO7VQDC.js} +268 -2267
- package/dist/chunk-FWO7VQDC.js.map +1 -0
- package/dist/{chunk-H2CO44WB.js → chunk-FZNS32WJ.js} +4 -4
- package/dist/{chunk-H2CO44WB.js.map → chunk-FZNS32WJ.js.map} +1 -1
- package/dist/{chunk-6BMOC6SA.cjs → chunk-OYL5TBJW.cjs} +4 -4
- package/dist/{chunk-6BMOC6SA.cjs.map → chunk-OYL5TBJW.cjs.map} +1 -1
- package/dist/{chunk-KQZPT7AO.js → chunk-SIW6CYO3.js} +7 -7
- package/dist/{chunk-KQZPT7AO.js.map → chunk-SIW6CYO3.js.map} +1 -1
- package/dist/{chunk-LNT5N7XW.cjs → chunk-SPRRK3P7.cjs} +6 -3
- package/dist/chunk-SPRRK3P7.cjs.map +1 -0
- package/dist/{chunk-3LGGSMCC.cjs → chunk-XVPBGW6Y.cjs} +9 -9
- package/dist/{chunk-3LGGSMCC.cjs.map → chunk-XVPBGW6Y.cjs.map} +1 -1
- package/dist/server/handlers/agent-builder.cjs +16 -16
- package/dist/server/handlers/agent-builder.d.ts.map +1 -1
- package/dist/server/handlers/agent-builder.js +1 -1
- package/dist/server/handlers/memory.d.ts +2 -2
- package/dist/server/handlers/scores.cjs +7 -7
- package/dist/server/handlers/scores.d.ts +9 -108
- package/dist/server/handlers/scores.d.ts.map +1 -1
- package/dist/server/handlers/scores.js +1 -1
- package/dist/server/handlers.cjs +4 -4
- package/dist/server/handlers.js +2 -2
- package/dist/{token-JT637FZG.cjs → token-53CFGXUO.cjs} +10 -10
- package/dist/{token-JT637FZG.cjs.map → token-53CFGXUO.cjs.map} +1 -1
- package/dist/{token-352SFL4N.js → token-WAEKDUVY.js} +8 -8
- package/dist/{token-352SFL4N.js.map → token-WAEKDUVY.js.map} +1 -1
- package/dist/token-util-LY37VCIN.js +7 -0
- package/dist/{token-util-75OQWZ4W.js.map → token-util-LY37VCIN.js.map} +1 -1
- package/dist/token-util-S4A355II.cjs +9 -0
- package/dist/{token-util-WGALAXWM.cjs.map → token-util-S4A355II.cjs.map} +1 -1
- package/package.json +2 -2
- package/dist/chunk-5BNQIYQN.js.map +0 -1
- package/dist/chunk-DTBJ3D22.js.map +0 -1
- package/dist/chunk-LNT5N7XW.cjs.map +0 -1
- package/dist/chunk-SBWOUCO3.cjs.map +0 -1
- package/dist/token-util-75OQWZ4W.js +0 -7
- package/dist/token-util-WGALAXWM.cjs +0 -9
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getWorkflowByIdHandler, getWorkflowRunByIdHandler, getWorkflowRunExecutionResultHandler, createWorkflowRunHandler, startAsyncWorkflowHandler, startWorkflowRunHandler, watchWorkflowHandler, streamWorkflowHandler, streamVNextWorkflowHandler, resumeAsyncWorkflowHandler, resumeWorkflowHandler, getWorkflowRunsHandler, cancelWorkflowRunHandler, sendWorkflowRunEventHandler } from './chunk-DB63UMTV.js';
|
|
2
|
-
import { require_token_error } from './chunk-
|
|
2
|
+
import { require_token_error } from './chunk-FZNS32WJ.js';
|
|
3
3
|
import { openai } from './chunk-ZULZ2752.js';
|
|
4
4
|
import { createIdGenerator, AISDKError, isAbortError, getErrorMessage, APICallError, delay, safeParseJSON, safeValidateTypes, convertAsyncIteratorToReadableStream, validatorSymbol } from './chunk-RQK4FQUD.js';
|
|
5
5
|
import { WorkflowRegistry, getWorkflowInfo } from './chunk-YWOK4F5A.js';
|
|
@@ -10,7 +10,7 @@ import { Agent, tryGenerateWithJsonFallback, tryStreamWithJsonFallback, MessageL
|
|
|
10
10
|
import { MastraMemory, MemoryProcessor } from '@mastra/core/memory';
|
|
11
11
|
import { generateEmptyFromSchema } from '@mastra/core/utils';
|
|
12
12
|
import { z, ZodObject, ZodFirstPartyTypeKind } from 'zod';
|
|
13
|
-
import * as
|
|
13
|
+
import * as z42 from 'zod/v4';
|
|
14
14
|
import { z as z$1 } from 'zod/v4';
|
|
15
15
|
import { ZodFirstPartyTypeKind as ZodFirstPartyTypeKind$1 } from 'zod/v3';
|
|
16
16
|
import { createTool } from '@mastra/core/tools';
|
|
@@ -24,28 +24,28 @@ import { ModelRouterLanguageModel } from '@mastra/core/llm';
|
|
|
24
24
|
import { tmpdir } from 'os';
|
|
25
25
|
import { createStep, createWorkflow } from '@mastra/core/workflows';
|
|
26
26
|
|
|
27
|
-
// ../../node_modules/.pnpm/@vercel+oidc@3.0.
|
|
27
|
+
// ../../node_modules/.pnpm/@vercel+oidc@3.0.1/node_modules/@vercel/oidc/dist/get-context.js
|
|
28
28
|
var require_get_context = __commonJS({
|
|
29
|
-
"../../node_modules/.pnpm/@vercel+oidc@3.0.
|
|
30
|
-
var
|
|
29
|
+
"../../node_modules/.pnpm/@vercel+oidc@3.0.1/node_modules/@vercel/oidc/dist/get-context.js"(exports, module) {
|
|
30
|
+
var __defProp4 = Object.defineProperty;
|
|
31
31
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
32
32
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
33
33
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
34
|
-
var
|
|
35
|
-
for (var
|
|
36
|
-
|
|
34
|
+
var __export4 = (target, all) => {
|
|
35
|
+
for (var name20 in all)
|
|
36
|
+
__defProp4(target, name20, { get: all[name20], enumerable: true });
|
|
37
37
|
};
|
|
38
38
|
var __copyProps = (to, from, except, desc) => {
|
|
39
39
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
40
40
|
for (let key of __getOwnPropNames(from))
|
|
41
41
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
42
|
-
|
|
42
|
+
__defProp4(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
43
43
|
}
|
|
44
44
|
return to;
|
|
45
45
|
};
|
|
46
|
-
var __toCommonJS = (mod) => __copyProps(
|
|
46
|
+
var __toCommonJS = (mod) => __copyProps(__defProp4({}, "__esModule", { value: true }), mod);
|
|
47
47
|
var get_context_exports = {};
|
|
48
|
-
|
|
48
|
+
__export4(get_context_exports, {
|
|
49
49
|
SYMBOL_FOR_REQ_CONTEXT: () => SYMBOL_FOR_REQ_CONTEXT,
|
|
50
50
|
getContext: () => getContext3
|
|
51
51
|
});
|
|
@@ -58,28 +58,28 @@ var require_get_context = __commonJS({
|
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
60
|
|
|
61
|
-
// ../../node_modules/.pnpm/@vercel+oidc@3.0.
|
|
61
|
+
// ../../node_modules/.pnpm/@vercel+oidc@3.0.1/node_modules/@vercel/oidc/dist/get-vercel-oidc-token.js
|
|
62
62
|
var require_get_vercel_oidc_token = __commonJS({
|
|
63
|
-
"../../node_modules/.pnpm/@vercel+oidc@3.0.
|
|
64
|
-
var
|
|
63
|
+
"../../node_modules/.pnpm/@vercel+oidc@3.0.1/node_modules/@vercel/oidc/dist/get-vercel-oidc-token.js"(exports, module) {
|
|
64
|
+
var __defProp4 = Object.defineProperty;
|
|
65
65
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
66
66
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
67
67
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
68
|
-
var
|
|
69
|
-
for (var
|
|
70
|
-
|
|
68
|
+
var __export4 = (target, all) => {
|
|
69
|
+
for (var name20 in all)
|
|
70
|
+
__defProp4(target, name20, { get: all[name20], enumerable: true });
|
|
71
71
|
};
|
|
72
72
|
var __copyProps = (to, from, except, desc) => {
|
|
73
73
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
74
74
|
for (let key of __getOwnPropNames(from))
|
|
75
75
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
76
|
-
|
|
76
|
+
__defProp4(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
77
77
|
}
|
|
78
78
|
return to;
|
|
79
79
|
};
|
|
80
|
-
var __toCommonJS = (mod) => __copyProps(
|
|
80
|
+
var __toCommonJS = (mod) => __copyProps(__defProp4({}, "__esModule", { value: true }), mod);
|
|
81
81
|
var get_vercel_oidc_token_exports = {};
|
|
82
|
-
|
|
82
|
+
__export4(get_vercel_oidc_token_exports, {
|
|
83
83
|
getVercelOidcToken: () => getVercelOidcToken3,
|
|
84
84
|
getVercelOidcTokenSync: () => getVercelOidcTokenSync2
|
|
85
85
|
});
|
|
@@ -96,8 +96,8 @@ var require_get_vercel_oidc_token = __commonJS({
|
|
|
96
96
|
}
|
|
97
97
|
try {
|
|
98
98
|
const [{ getTokenPayload, isExpired }, { refreshToken }] = await Promise.all([
|
|
99
|
-
await import('./token-util-
|
|
100
|
-
await import('./token-
|
|
99
|
+
await import('./token-util-LY37VCIN.js'),
|
|
100
|
+
await import('./token-WAEKDUVY.js')
|
|
101
101
|
]);
|
|
102
102
|
if (!token || isExpired(getTokenPayload(token))) {
|
|
103
103
|
await refreshToken();
|
|
@@ -124,28 +124,28 @@ ${error.message}`;
|
|
|
124
124
|
}
|
|
125
125
|
});
|
|
126
126
|
|
|
127
|
-
// ../../node_modules/.pnpm/@vercel+oidc@3.0.
|
|
127
|
+
// ../../node_modules/.pnpm/@vercel+oidc@3.0.1/node_modules/@vercel/oidc/dist/index.js
|
|
128
128
|
var require_dist = __commonJS({
|
|
129
|
-
"../../node_modules/.pnpm/@vercel+oidc@3.0.
|
|
130
|
-
var
|
|
129
|
+
"../../node_modules/.pnpm/@vercel+oidc@3.0.1/node_modules/@vercel/oidc/dist/index.js"(exports, module) {
|
|
130
|
+
var __defProp4 = Object.defineProperty;
|
|
131
131
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
132
132
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
133
133
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
134
|
-
var
|
|
135
|
-
for (var
|
|
136
|
-
|
|
134
|
+
var __export4 = (target, all) => {
|
|
135
|
+
for (var name20 in all)
|
|
136
|
+
__defProp4(target, name20, { get: all[name20], enumerable: true });
|
|
137
137
|
};
|
|
138
138
|
var __copyProps = (to, from, except, desc) => {
|
|
139
139
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
140
140
|
for (let key of __getOwnPropNames(from))
|
|
141
141
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
142
|
-
|
|
142
|
+
__defProp4(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
143
143
|
}
|
|
144
144
|
return to;
|
|
145
145
|
};
|
|
146
|
-
var __toCommonJS = (mod) => __copyProps(
|
|
146
|
+
var __toCommonJS = (mod) => __copyProps(__defProp4({}, "__esModule", { value: true }), mod);
|
|
147
147
|
var src_exports = {};
|
|
148
|
-
|
|
148
|
+
__export4(src_exports, {
|
|
149
149
|
getContext: () => import_get_context.getContext,
|
|
150
150
|
getVercelOidcToken: () => import_get_vercel_oidc_token.getVercelOidcToken,
|
|
151
151
|
getVercelOidcTokenSync: () => import_get_vercel_oidc_token.getVercelOidcTokenSync
|
|
@@ -279,8 +279,8 @@ var require_ignore = __commonJS({
|
|
|
279
279
|
TMP_KEY_IGNORE = Symbol.for("node-ignore");
|
|
280
280
|
}
|
|
281
281
|
var KEY_IGNORE = TMP_KEY_IGNORE;
|
|
282
|
-
var define = (
|
|
283
|
-
Object.defineProperty(
|
|
282
|
+
var define = (object3, key, value) => {
|
|
283
|
+
Object.defineProperty(object3, key, { value });
|
|
284
284
|
return value;
|
|
285
285
|
};
|
|
286
286
|
var REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g;
|
|
@@ -776,11 +776,11 @@ var getRefs = (options) => {
|
|
|
776
776
|
flags: { hasReferencedOpenAiAnyType: false },
|
|
777
777
|
currentPath,
|
|
778
778
|
propertyPath: void 0,
|
|
779
|
-
seen: new Map(Object.entries(_options.definitions).map(([
|
|
779
|
+
seen: new Map(Object.entries(_options.definitions).map(([name20, def]) => [
|
|
780
780
|
def._def,
|
|
781
781
|
{
|
|
782
782
|
def: def._def,
|
|
783
|
-
path: [..._options.basePath, _options.definitionPath,
|
|
783
|
+
path: [..._options.basePath, _options.definitionPath, name20],
|
|
784
784
|
// Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now.
|
|
785
785
|
jsonSchema: void 0
|
|
786
786
|
}
|
|
@@ -1229,8 +1229,8 @@ function parseStringDef(def, refs) {
|
|
|
1229
1229
|
}
|
|
1230
1230
|
return res;
|
|
1231
1231
|
}
|
|
1232
|
-
function escapeLiteralCheckValue(
|
|
1233
|
-
return refs.patternStrategy === "escape" ? escapeNonAlphaNumeric(
|
|
1232
|
+
function escapeLiteralCheckValue(literal, refs) {
|
|
1233
|
+
return refs.patternStrategy === "escape" ? escapeNonAlphaNumeric(literal) : literal;
|
|
1234
1234
|
}
|
|
1235
1235
|
var ALPHA_NUMERIC = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
|
|
1236
1236
|
function escapeNonAlphaNumeric(source) {
|
|
@@ -1448,11 +1448,11 @@ function parseMapDef(def, refs) {
|
|
|
1448
1448
|
|
|
1449
1449
|
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js
|
|
1450
1450
|
function parseNativeEnumDef(def) {
|
|
1451
|
-
const
|
|
1451
|
+
const object3 = def.values;
|
|
1452
1452
|
const actualKeys = Object.keys(def.values).filter((key) => {
|
|
1453
|
-
return typeof
|
|
1453
|
+
return typeof object3[object3[key]] !== "number";
|
|
1454
1454
|
});
|
|
1455
|
-
const actualValues = actualKeys.map((key) =>
|
|
1455
|
+
const actualValues = actualKeys.map((key) => object3[key]);
|
|
1456
1456
|
const parsedTypes = Array.from(new Set(actualValues.map((values) => typeof values)));
|
|
1457
1457
|
return {
|
|
1458
1458
|
type: parsedTypes.length === 1 ? parsedTypes[0] === "string" ? "string" : "number" : ["string", "number"],
|
|
@@ -1902,17 +1902,17 @@ function parseDef(def, refs, forceResolution = false) {
|
|
|
1902
1902
|
const newItem = { def, path: refs.currentPath, jsonSchema: void 0 };
|
|
1903
1903
|
refs.seen.set(def, newItem);
|
|
1904
1904
|
const jsonSchemaOrGetter = selectParser(def, def.typeName, refs);
|
|
1905
|
-
const
|
|
1906
|
-
if (
|
|
1907
|
-
addMeta(def, refs,
|
|
1905
|
+
const jsonSchema3 = typeof jsonSchemaOrGetter === "function" ? parseDef(jsonSchemaOrGetter(), refs) : jsonSchemaOrGetter;
|
|
1906
|
+
if (jsonSchema3) {
|
|
1907
|
+
addMeta(def, refs, jsonSchema3);
|
|
1908
1908
|
}
|
|
1909
1909
|
if (refs.postProcess) {
|
|
1910
|
-
const postProcessResult = refs.postProcess(
|
|
1911
|
-
newItem.jsonSchema =
|
|
1910
|
+
const postProcessResult = refs.postProcess(jsonSchema3, def, refs);
|
|
1911
|
+
newItem.jsonSchema = jsonSchema3;
|
|
1912
1912
|
return postProcessResult;
|
|
1913
1913
|
}
|
|
1914
|
-
newItem.jsonSchema =
|
|
1915
|
-
return
|
|
1914
|
+
newItem.jsonSchema = jsonSchema3;
|
|
1915
|
+
return jsonSchema3;
|
|
1916
1916
|
}
|
|
1917
1917
|
var get$ref = (item, refs) => {
|
|
1918
1918
|
switch (refs.$refStrategy) {
|
|
@@ -1930,30 +1930,30 @@ var get$ref = (item, refs) => {
|
|
|
1930
1930
|
}
|
|
1931
1931
|
}
|
|
1932
1932
|
};
|
|
1933
|
-
var addMeta = (def, refs,
|
|
1933
|
+
var addMeta = (def, refs, jsonSchema3) => {
|
|
1934
1934
|
if (def.description) {
|
|
1935
|
-
|
|
1935
|
+
jsonSchema3.description = def.description;
|
|
1936
1936
|
if (refs.markdownDescription) {
|
|
1937
|
-
|
|
1937
|
+
jsonSchema3.markdownDescription = def.description;
|
|
1938
1938
|
}
|
|
1939
1939
|
}
|
|
1940
|
-
return
|
|
1940
|
+
return jsonSchema3;
|
|
1941
1941
|
};
|
|
1942
1942
|
|
|
1943
1943
|
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js
|
|
1944
1944
|
var zodToJsonSchema = (schema, options) => {
|
|
1945
1945
|
const refs = getRefs(options);
|
|
1946
|
-
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [
|
|
1946
|
+
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name21, schema2]) => ({
|
|
1947
1947
|
...acc,
|
|
1948
|
-
[
|
|
1948
|
+
[name21]: parseDef(schema2._def, {
|
|
1949
1949
|
...refs,
|
|
1950
|
-
currentPath: [...refs.basePath, refs.definitionPath,
|
|
1950
|
+
currentPath: [...refs.basePath, refs.definitionPath, name21]
|
|
1951
1951
|
}, true) ?? parseAnyDef(refs)
|
|
1952
1952
|
}), {}) : void 0;
|
|
1953
|
-
const
|
|
1954
|
-
const main = parseDef(schema._def,
|
|
1953
|
+
const name20 = typeof options === "string" ? options : options?.nameStrategy === "title" ? void 0 : options?.name;
|
|
1954
|
+
const main = parseDef(schema._def, name20 === void 0 ? refs : {
|
|
1955
1955
|
...refs,
|
|
1956
|
-
currentPath: [...refs.basePath, refs.definitionPath,
|
|
1956
|
+
currentPath: [...refs.basePath, refs.definitionPath, name20]
|
|
1957
1957
|
}, false) ?? parseAnyDef(refs);
|
|
1958
1958
|
const title = typeof options === "object" && options.name !== void 0 && options.nameStrategy === "title" ? options.name : void 0;
|
|
1959
1959
|
if (title !== void 0) {
|
|
@@ -1977,18 +1977,18 @@ var zodToJsonSchema = (schema, options) => {
|
|
|
1977
1977
|
};
|
|
1978
1978
|
}
|
|
1979
1979
|
}
|
|
1980
|
-
const combined =
|
|
1980
|
+
const combined = name20 === void 0 ? definitions ? {
|
|
1981
1981
|
...main,
|
|
1982
1982
|
[refs.definitionPath]: definitions
|
|
1983
1983
|
} : main : {
|
|
1984
1984
|
$ref: [
|
|
1985
1985
|
...refs.$refStrategy === "relative" ? [] : refs.basePath,
|
|
1986
1986
|
refs.definitionPath,
|
|
1987
|
-
|
|
1987
|
+
name20
|
|
1988
1988
|
].join("/"),
|
|
1989
1989
|
[refs.definitionPath]: {
|
|
1990
1990
|
...definitions,
|
|
1991
|
-
[
|
|
1991
|
+
[name20]: main
|
|
1992
1992
|
}
|
|
1993
1993
|
};
|
|
1994
1994
|
if (refs.target === "jsonSchema7") {
|
|
@@ -2006,10 +2006,10 @@ var zodToJsonSchema = (schema, options) => {
|
|
|
2006
2006
|
var esm_default = zodToJsonSchema;
|
|
2007
2007
|
|
|
2008
2008
|
// ../schema-compat/dist/chunk-GWTUXMDD.js
|
|
2009
|
-
function zodToJsonSchema2(
|
|
2009
|
+
function zodToJsonSchema2(zodSchema3, target = "jsonSchema7", strategy = "relative") {
|
|
2010
2010
|
const fn = "toJSONSchema";
|
|
2011
2011
|
if (fn in z) {
|
|
2012
|
-
return z[fn](
|
|
2012
|
+
return z[fn](zodSchema3, {
|
|
2013
2013
|
unrepresentable: "any",
|
|
2014
2014
|
override: (ctx) => {
|
|
2015
2015
|
const def = ctx.zodSchema?._zod?.def;
|
|
@@ -2020,7 +2020,7 @@ function zodToJsonSchema2(zodSchema4, target = "jsonSchema7", strategy = "relati
|
|
|
2020
2020
|
}
|
|
2021
2021
|
});
|
|
2022
2022
|
} else {
|
|
2023
|
-
return esm_default(
|
|
2023
|
+
return esm_default(zodSchema3, {
|
|
2024
2024
|
$refStrategy: strategy,
|
|
2025
2025
|
target
|
|
2026
2026
|
});
|
|
@@ -2620,8 +2620,8 @@ function formatDataStreamPart(type, value) {
|
|
|
2620
2620
|
`;
|
|
2621
2621
|
}
|
|
2622
2622
|
function zodSchema(zodSchema22, options) {
|
|
2623
|
-
var
|
|
2624
|
-
const useReferences = (
|
|
2623
|
+
var _a20;
|
|
2624
|
+
const useReferences = (_a20 = void 0 ) != null ? _a20 : false;
|
|
2625
2625
|
return jsonSchema(
|
|
2626
2626
|
esm_default(zodSchema22, {
|
|
2627
2627
|
$refStrategy: useReferences ? "root" : "none",
|
|
@@ -2734,11 +2734,11 @@ var major = VERSION.split(".")[0];
|
|
|
2734
2734
|
var GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for("opentelemetry.js.api." + major);
|
|
2735
2735
|
var _global = _globalThis;
|
|
2736
2736
|
function registerGlobal(type, instance, diag, allowOverride) {
|
|
2737
|
-
var
|
|
2737
|
+
var _a20;
|
|
2738
2738
|
if (allowOverride === void 0) {
|
|
2739
2739
|
allowOverride = false;
|
|
2740
2740
|
}
|
|
2741
|
-
var api = _global[GLOBAL_OPENTELEMETRY_API_KEY] = (
|
|
2741
|
+
var api = _global[GLOBAL_OPENTELEMETRY_API_KEY] = (_a20 = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _a20 !== void 0 ? _a20 : {
|
|
2742
2742
|
version: VERSION
|
|
2743
2743
|
};
|
|
2744
2744
|
if (!allowOverride && api[type]) {
|
|
@@ -2756,8 +2756,8 @@ function registerGlobal(type, instance, diag, allowOverride) {
|
|
|
2756
2756
|
return true;
|
|
2757
2757
|
}
|
|
2758
2758
|
function getGlobal(type) {
|
|
2759
|
-
var
|
|
2760
|
-
var globalVersion = (
|
|
2759
|
+
var _a20, _b8;
|
|
2760
|
+
var globalVersion = (_a20 = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _a20 === void 0 ? void 0 : _a20.version;
|
|
2761
2761
|
if (!globalVersion || !isCompatible(globalVersion)) {
|
|
2762
2762
|
return;
|
|
2763
2763
|
}
|
|
@@ -2934,13 +2934,13 @@ var DiagAPI = (
|
|
|
2934
2934
|
}
|
|
2935
2935
|
var self = this;
|
|
2936
2936
|
var setLogger = function(logger, optionsOrLogLevel) {
|
|
2937
|
-
var
|
|
2937
|
+
var _a20, _b8, _c;
|
|
2938
2938
|
if (optionsOrLogLevel === void 0) {
|
|
2939
2939
|
optionsOrLogLevel = { logLevel: DiagLogLevel.INFO };
|
|
2940
2940
|
}
|
|
2941
2941
|
if (logger === self) {
|
|
2942
2942
|
var err = new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");
|
|
2943
|
-
self.error((
|
|
2943
|
+
self.error((_a20 = err.stack) !== null && _a20 !== void 0 ? _a20 : err.message);
|
|
2944
2944
|
return false;
|
|
2945
2945
|
}
|
|
2946
2946
|
if (typeof optionsOrLogLevel === "number") {
|
|
@@ -3111,12 +3111,12 @@ var ContextAPI = (
|
|
|
3111
3111
|
return this._getContextManager().active();
|
|
3112
3112
|
};
|
|
3113
3113
|
ContextAPI2.prototype.with = function(context, fn, thisArg) {
|
|
3114
|
-
var
|
|
3114
|
+
var _a20;
|
|
3115
3115
|
var args = [];
|
|
3116
3116
|
for (var _i = 3; _i < arguments.length; _i++) {
|
|
3117
3117
|
args[_i - 3] = arguments[_i];
|
|
3118
3118
|
}
|
|
3119
|
-
return (
|
|
3119
|
+
return (_a20 = this._getContextManager()).with.apply(_a20, __spreadArray4([context, fn, thisArg], __read4(args), false));
|
|
3120
3120
|
};
|
|
3121
3121
|
ContextAPI2.prototype.bind = function(context, target) {
|
|
3122
3122
|
return this._getContextManager().bind(context, target);
|
|
@@ -3211,8 +3211,8 @@ function setSpanContext(context, spanContext) {
|
|
|
3211
3211
|
return setSpan(context, new NonRecordingSpan(spanContext));
|
|
3212
3212
|
}
|
|
3213
3213
|
function getSpanContext(context) {
|
|
3214
|
-
var
|
|
3215
|
-
return (
|
|
3214
|
+
var _a20;
|
|
3215
|
+
return (_a20 = getSpan(context)) === null || _a20 === void 0 ? void 0 : _a20.spanContext();
|
|
3216
3216
|
}
|
|
3217
3217
|
|
|
3218
3218
|
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.js
|
|
@@ -3238,7 +3238,7 @@ var NoopTracer = (
|
|
|
3238
3238
|
(function() {
|
|
3239
3239
|
function NoopTracer2() {
|
|
3240
3240
|
}
|
|
3241
|
-
NoopTracer2.prototype.startSpan = function(
|
|
3241
|
+
NoopTracer2.prototype.startSpan = function(name20, options, context) {
|
|
3242
3242
|
if (context === void 0) {
|
|
3243
3243
|
context = contextApi.active();
|
|
3244
3244
|
}
|
|
@@ -3253,7 +3253,7 @@ var NoopTracer = (
|
|
|
3253
3253
|
return new NonRecordingSpan();
|
|
3254
3254
|
}
|
|
3255
3255
|
};
|
|
3256
|
-
NoopTracer2.prototype.startActiveSpan = function(
|
|
3256
|
+
NoopTracer2.prototype.startActiveSpan = function(name20, arg2, arg3, arg4) {
|
|
3257
3257
|
var opts;
|
|
3258
3258
|
var ctx;
|
|
3259
3259
|
var fn;
|
|
@@ -3270,7 +3270,7 @@ var NoopTracer = (
|
|
|
3270
3270
|
fn = arg4;
|
|
3271
3271
|
}
|
|
3272
3272
|
var parentContext = ctx !== null && ctx !== void 0 ? ctx : contextApi.active();
|
|
3273
|
-
var span = this.startSpan(
|
|
3273
|
+
var span = this.startSpan(name20, opts, parentContext);
|
|
3274
3274
|
var contextWithSpanSet = setSpan(parentContext, span);
|
|
3275
3275
|
return contextApi.with(contextWithSpanSet, fn, void 0, span);
|
|
3276
3276
|
};
|
|
@@ -3286,14 +3286,14 @@ var NOOP_TRACER = new NoopTracer();
|
|
|
3286
3286
|
var ProxyTracer = (
|
|
3287
3287
|
/** @class */
|
|
3288
3288
|
(function() {
|
|
3289
|
-
function ProxyTracer2(_provider,
|
|
3289
|
+
function ProxyTracer2(_provider, name20, version, options) {
|
|
3290
3290
|
this._provider = _provider;
|
|
3291
|
-
this.name =
|
|
3291
|
+
this.name = name20;
|
|
3292
3292
|
this.version = version;
|
|
3293
3293
|
this.options = options;
|
|
3294
3294
|
}
|
|
3295
|
-
ProxyTracer2.prototype.startSpan = function(
|
|
3296
|
-
return this._getTracer().startSpan(
|
|
3295
|
+
ProxyTracer2.prototype.startSpan = function(name20, options, context) {
|
|
3296
|
+
return this._getTracer().startSpan(name20, options, context);
|
|
3297
3297
|
};
|
|
3298
3298
|
ProxyTracer2.prototype.startActiveSpan = function(_name, _options, _context, _fn) {
|
|
3299
3299
|
var tracer = this._getTracer();
|
|
@@ -3334,20 +3334,20 @@ var ProxyTracerProvider = (
|
|
|
3334
3334
|
(function() {
|
|
3335
3335
|
function ProxyTracerProvider2() {
|
|
3336
3336
|
}
|
|
3337
|
-
ProxyTracerProvider2.prototype.getTracer = function(
|
|
3338
|
-
var
|
|
3339
|
-
return (
|
|
3337
|
+
ProxyTracerProvider2.prototype.getTracer = function(name20, version, options) {
|
|
3338
|
+
var _a20;
|
|
3339
|
+
return (_a20 = this.getDelegateTracer(name20, version, options)) !== null && _a20 !== void 0 ? _a20 : new ProxyTracer(this, name20, version, options);
|
|
3340
3340
|
};
|
|
3341
3341
|
ProxyTracerProvider2.prototype.getDelegate = function() {
|
|
3342
|
-
var
|
|
3343
|
-
return (
|
|
3342
|
+
var _a20;
|
|
3343
|
+
return (_a20 = this._delegate) !== null && _a20 !== void 0 ? _a20 : NOOP_TRACER_PROVIDER;
|
|
3344
3344
|
};
|
|
3345
3345
|
ProxyTracerProvider2.prototype.setDelegate = function(delegate) {
|
|
3346
3346
|
this._delegate = delegate;
|
|
3347
3347
|
};
|
|
3348
|
-
ProxyTracerProvider2.prototype.getDelegateTracer = function(
|
|
3349
|
-
var
|
|
3350
|
-
return (
|
|
3348
|
+
ProxyTracerProvider2.prototype.getDelegateTracer = function(name20, version, options) {
|
|
3349
|
+
var _a20;
|
|
3350
|
+
return (_a20 = this._delegate) === null || _a20 === void 0 ? void 0 : _a20.getTracer(name20, version, options);
|
|
3351
3351
|
};
|
|
3352
3352
|
return ProxyTracerProvider2;
|
|
3353
3353
|
})()
|
|
@@ -3393,8 +3393,8 @@ var TraceAPI = (
|
|
|
3393
3393
|
TraceAPI2.prototype.getTracerProvider = function() {
|
|
3394
3394
|
return getGlobal(API_NAME3) || this._proxyTracerProvider;
|
|
3395
3395
|
};
|
|
3396
|
-
TraceAPI2.prototype.getTracer = function(
|
|
3397
|
-
return this.getTracerProvider().getTracer(
|
|
3396
|
+
TraceAPI2.prototype.getTracer = function(name20, version) {
|
|
3397
|
+
return this.getTracerProvider().getTracer(name20, version);
|
|
3398
3398
|
};
|
|
3399
3399
|
TraceAPI2.prototype.disable = function() {
|
|
3400
3400
|
unregisterGlobal(API_NAME3, DiagAPI.instance());
|
|
@@ -3732,13 +3732,13 @@ function selectTelemetryAttributes({
|
|
|
3732
3732
|
return { ...attributes2, [key]: value };
|
|
3733
3733
|
}, {});
|
|
3734
3734
|
}
|
|
3735
|
-
function splitArray(
|
|
3735
|
+
function splitArray(array, chunkSize) {
|
|
3736
3736
|
if (chunkSize <= 0) {
|
|
3737
3737
|
throw new Error("chunkSize must be greater than 0");
|
|
3738
3738
|
}
|
|
3739
3739
|
const result = [];
|
|
3740
|
-
for (let i = 0; i <
|
|
3741
|
-
result.push(
|
|
3740
|
+
for (let i = 0; i < array.length; i += chunkSize) {
|
|
3741
|
+
result.push(array.slice(i, i + chunkSize));
|
|
3742
3742
|
}
|
|
3743
3743
|
return result;
|
|
3744
3744
|
}
|
|
@@ -4565,13 +4565,13 @@ var _AISDKError = class _AISDKError2 extends Error {
|
|
|
4565
4565
|
* @param {unknown} [params.cause] - The underlying cause of the error.
|
|
4566
4566
|
*/
|
|
4567
4567
|
constructor({
|
|
4568
|
-
name:
|
|
4568
|
+
name: name143,
|
|
4569
4569
|
message,
|
|
4570
4570
|
cause
|
|
4571
4571
|
}) {
|
|
4572
4572
|
super(message);
|
|
4573
4573
|
this[_a17] = true;
|
|
4574
|
-
this.name =
|
|
4574
|
+
this.name = name143;
|
|
4575
4575
|
this.cause = cause;
|
|
4576
4576
|
}
|
|
4577
4577
|
/**
|
|
@@ -4582,8 +4582,8 @@ var _AISDKError = class _AISDKError2 extends Error {
|
|
|
4582
4582
|
static isInstance(error) {
|
|
4583
4583
|
return _AISDKError2.hasMarker(error, marker17);
|
|
4584
4584
|
}
|
|
4585
|
-
static hasMarker(error,
|
|
4586
|
-
const markerSymbol = Symbol.for(
|
|
4585
|
+
static hasMarker(error, marker153) {
|
|
4586
|
+
const markerSymbol = Symbol.for(marker153);
|
|
4587
4587
|
return error != null && typeof error === "object" && markerSymbol in error && typeof error[markerSymbol] === "boolean" && error[markerSymbol] === true;
|
|
4588
4588
|
}
|
|
4589
4589
|
};
|
|
@@ -4675,15 +4675,15 @@ var marker72 = `vercel.ai.error.${name62}`;
|
|
|
4675
4675
|
var symbol72 = Symbol.for(marker72);
|
|
4676
4676
|
var _a72;
|
|
4677
4677
|
var JSONParseError = class extends AISDKError2 {
|
|
4678
|
-
constructor({ text:
|
|
4678
|
+
constructor({ text: text3, cause }) {
|
|
4679
4679
|
super({
|
|
4680
4680
|
name: name62,
|
|
4681
|
-
message: `JSON parsing failed: Text: ${
|
|
4681
|
+
message: `JSON parsing failed: Text: ${text3}.
|
|
4682
4682
|
Error message: ${getErrorMessage2(cause)}`,
|
|
4683
4683
|
cause
|
|
4684
4684
|
});
|
|
4685
4685
|
this[_a72] = true;
|
|
4686
|
-
this.text =
|
|
4686
|
+
this.text = text3;
|
|
4687
4687
|
}
|
|
4688
4688
|
static isInstance(error) {
|
|
4689
4689
|
return AISDKError2.hasMarker(error, marker72);
|
|
@@ -4916,11 +4916,11 @@ function extractResponseHeaders(response) {
|
|
|
4916
4916
|
return Object.fromEntries([...response.headers]);
|
|
4917
4917
|
}
|
|
4918
4918
|
function getRuntimeEnvironmentUserAgent(globalThisAny = globalThis) {
|
|
4919
|
-
var
|
|
4919
|
+
var _a20, _b8, _c;
|
|
4920
4920
|
if (globalThisAny.window) {
|
|
4921
4921
|
return `runtime/browser`;
|
|
4922
4922
|
}
|
|
4923
|
-
if ((
|
|
4923
|
+
if ((_a20 = globalThisAny.navigator) == null ? void 0 : _a20.userAgent) {
|
|
4924
4924
|
return `runtime/${globalThisAny.navigator.userAgent.toLowerCase()}`;
|
|
4925
4925
|
}
|
|
4926
4926
|
if ((_c = (_b8 = globalThisAny.process) == null ? void 0 : _b8.versions) == null ? void 0 : _c.node) {
|
|
@@ -4931,9 +4931,9 @@ function getRuntimeEnvironmentUserAgent(globalThisAny = globalThis) {
|
|
|
4931
4931
|
}
|
|
4932
4932
|
return "runtime/unknown";
|
|
4933
4933
|
}
|
|
4934
|
-
function removeUndefinedEntries(
|
|
4934
|
+
function removeUndefinedEntries(record) {
|
|
4935
4935
|
return Object.fromEntries(
|
|
4936
|
-
Object.entries(
|
|
4936
|
+
Object.entries(record).filter(([_key, value]) => value != null)
|
|
4937
4937
|
);
|
|
4938
4938
|
}
|
|
4939
4939
|
function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
|
|
@@ -5101,12 +5101,12 @@ function loadOptionalSetting({
|
|
|
5101
5101
|
}
|
|
5102
5102
|
var suspectProtoRx = /"__proto__"\s*:/;
|
|
5103
5103
|
var suspectConstructorRx = /"constructor"\s*:/;
|
|
5104
|
-
function _parse(
|
|
5105
|
-
const obj = JSON.parse(
|
|
5104
|
+
function _parse(text3) {
|
|
5105
|
+
const obj = JSON.parse(text3);
|
|
5106
5106
|
if (obj === null || typeof obj !== "object") {
|
|
5107
5107
|
return obj;
|
|
5108
5108
|
}
|
|
5109
|
-
if (suspectProtoRx.test(
|
|
5109
|
+
if (suspectProtoRx.test(text3) === false && suspectConstructorRx.test(text3) === false) {
|
|
5110
5110
|
return obj;
|
|
5111
5111
|
}
|
|
5112
5112
|
return filter(obj);
|
|
@@ -5133,11 +5133,11 @@ function filter(obj) {
|
|
|
5133
5133
|
}
|
|
5134
5134
|
return obj;
|
|
5135
5135
|
}
|
|
5136
|
-
function secureJsonParse(
|
|
5136
|
+
function secureJsonParse(text3) {
|
|
5137
5137
|
const { stackTraceLimit } = Error;
|
|
5138
5138
|
Error.stackTraceLimit = 0;
|
|
5139
5139
|
try {
|
|
5140
|
-
return _parse(
|
|
5140
|
+
return _parse(text3);
|
|
5141
5141
|
} finally {
|
|
5142
5142
|
Error.stackTraceLimit = stackTraceLimit;
|
|
5143
5143
|
}
|
|
@@ -5178,12 +5178,12 @@ async function safeValidateTypes2({
|
|
|
5178
5178
|
value,
|
|
5179
5179
|
schema
|
|
5180
5180
|
}) {
|
|
5181
|
-
const
|
|
5181
|
+
const validator2 = asValidator(schema);
|
|
5182
5182
|
try {
|
|
5183
|
-
if (
|
|
5183
|
+
if (validator2.validate == null) {
|
|
5184
5184
|
return { success: true, value, rawValue: value };
|
|
5185
5185
|
}
|
|
5186
|
-
const result = await
|
|
5186
|
+
const result = await validator2.validate(value);
|
|
5187
5187
|
if (result.success) {
|
|
5188
5188
|
return { success: true, value: result.value, rawValue: value };
|
|
5189
5189
|
}
|
|
@@ -5201,11 +5201,11 @@ async function safeValidateTypes2({
|
|
|
5201
5201
|
}
|
|
5202
5202
|
}
|
|
5203
5203
|
async function parseJSON({
|
|
5204
|
-
text:
|
|
5204
|
+
text: text3,
|
|
5205
5205
|
schema
|
|
5206
5206
|
}) {
|
|
5207
5207
|
try {
|
|
5208
|
-
const value = secureJsonParse(
|
|
5208
|
+
const value = secureJsonParse(text3);
|
|
5209
5209
|
if (schema == null) {
|
|
5210
5210
|
return value;
|
|
5211
5211
|
}
|
|
@@ -5214,15 +5214,15 @@ async function parseJSON({
|
|
|
5214
5214
|
if (JSONParseError.isInstance(error) || TypeValidationError.isInstance(error)) {
|
|
5215
5215
|
throw error;
|
|
5216
5216
|
}
|
|
5217
|
-
throw new JSONParseError({ text:
|
|
5217
|
+
throw new JSONParseError({ text: text3, cause: error });
|
|
5218
5218
|
}
|
|
5219
5219
|
}
|
|
5220
5220
|
async function safeParseJSON2({
|
|
5221
|
-
text:
|
|
5221
|
+
text: text3,
|
|
5222
5222
|
schema
|
|
5223
5223
|
}) {
|
|
5224
5224
|
try {
|
|
5225
|
-
const value = secureJsonParse(
|
|
5225
|
+
const value = secureJsonParse(text3);
|
|
5226
5226
|
if (schema == null) {
|
|
5227
5227
|
return { success: true, value, rawValue: value };
|
|
5228
5228
|
}
|
|
@@ -5230,7 +5230,7 @@ async function safeParseJSON2({
|
|
|
5230
5230
|
} catch (error) {
|
|
5231
5231
|
return {
|
|
5232
5232
|
success: false,
|
|
5233
|
-
error: JSONParseError.isInstance(error) ? error : new JSONParseError({ text:
|
|
5233
|
+
error: JSONParseError.isInstance(error) ? error : new JSONParseError({ text: text3, cause: error }),
|
|
5234
5234
|
rawValue: void 0
|
|
5235
5235
|
};
|
|
5236
5236
|
}
|
|
@@ -5483,11 +5483,11 @@ function parseAnyDef2() {
|
|
|
5483
5483
|
return {};
|
|
5484
5484
|
}
|
|
5485
5485
|
function parseArrayDef2(def, refs) {
|
|
5486
|
-
var
|
|
5486
|
+
var _a20, _b8, _c;
|
|
5487
5487
|
const res = {
|
|
5488
5488
|
type: "array"
|
|
5489
5489
|
};
|
|
5490
|
-
if (((
|
|
5490
|
+
if (((_a20 = def.type) == null ? void 0 : _a20._def) && ((_c = (_b8 = def.type) == null ? void 0 : _b8._def) == null ? void 0 : _c.typeName) !== ZodFirstPartyTypeKind$1.ZodAny) {
|
|
5491
5491
|
res.items = parseDef2(def.type._def, {
|
|
5492
5492
|
...refs,
|
|
5493
5493
|
currentPath: [...refs.currentPath, "items"]
|
|
@@ -5831,8 +5831,8 @@ function parseStringDef2(def, refs) {
|
|
|
5831
5831
|
}
|
|
5832
5832
|
return res;
|
|
5833
5833
|
}
|
|
5834
|
-
function escapeLiteralCheckValue2(
|
|
5835
|
-
return refs.patternStrategy === "escape" ? escapeNonAlphaNumeric2(
|
|
5834
|
+
function escapeLiteralCheckValue2(literal, refs) {
|
|
5835
|
+
return refs.patternStrategy === "escape" ? escapeNonAlphaNumeric2(literal) : literal;
|
|
5836
5836
|
}
|
|
5837
5837
|
var ALPHA_NUMERIC2 = new Set(
|
|
5838
5838
|
"ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789"
|
|
@@ -5848,8 +5848,8 @@ function escapeNonAlphaNumeric2(source) {
|
|
|
5848
5848
|
return result;
|
|
5849
5849
|
}
|
|
5850
5850
|
function addFormat2(schema, value, message, refs) {
|
|
5851
|
-
var
|
|
5852
|
-
if (schema.format || ((
|
|
5851
|
+
var _a20;
|
|
5852
|
+
if (schema.format || ((_a20 = schema.anyOf) == null ? void 0 : _a20.some((x) => x.format))) {
|
|
5853
5853
|
if (!schema.anyOf) {
|
|
5854
5854
|
schema.anyOf = [];
|
|
5855
5855
|
}
|
|
@@ -5868,8 +5868,8 @@ function addFormat2(schema, value, message, refs) {
|
|
|
5868
5868
|
}
|
|
5869
5869
|
}
|
|
5870
5870
|
function addPattern2(schema, regex, message, refs) {
|
|
5871
|
-
var
|
|
5872
|
-
if (schema.pattern || ((
|
|
5871
|
+
var _a20;
|
|
5872
|
+
if (schema.pattern || ((_a20 = schema.allOf) == null ? void 0 : _a20.some((x) => x.pattern))) {
|
|
5873
5873
|
if (!schema.allOf) {
|
|
5874
5874
|
schema.allOf = [];
|
|
5875
5875
|
}
|
|
@@ -5888,7 +5888,7 @@ function addPattern2(schema, regex, message, refs) {
|
|
|
5888
5888
|
}
|
|
5889
5889
|
}
|
|
5890
5890
|
function stringifyRegExpWithFlags2(regex, refs) {
|
|
5891
|
-
var
|
|
5891
|
+
var _a20;
|
|
5892
5892
|
if (!refs.applyRegexFlags || !regex.flags) {
|
|
5893
5893
|
return regex.source;
|
|
5894
5894
|
}
|
|
@@ -5918,7 +5918,7 @@ function stringifyRegExpWithFlags2(regex, refs) {
|
|
|
5918
5918
|
pattern += source[i];
|
|
5919
5919
|
pattern += `${source[i - 2]}-${source[i]}`.toUpperCase();
|
|
5920
5920
|
inCharRange = false;
|
|
5921
|
-
} else if (source[i + 1] === "-" && ((
|
|
5921
|
+
} else if (source[i + 1] === "-" && ((_a20 = source[i + 2]) == null ? void 0 : _a20.match(/[a-z]/))) {
|
|
5922
5922
|
pattern += source[i];
|
|
5923
5923
|
inCharRange = true;
|
|
5924
5924
|
} else {
|
|
@@ -5960,13 +5960,13 @@ function stringifyRegExpWithFlags2(regex, refs) {
|
|
|
5960
5960
|
return pattern;
|
|
5961
5961
|
}
|
|
5962
5962
|
function parseRecordDef2(def, refs) {
|
|
5963
|
-
var
|
|
5963
|
+
var _a20, _b8, _c, _d, _e, _f;
|
|
5964
5964
|
const schema = {
|
|
5965
5965
|
type: "object",
|
|
5966
|
-
additionalProperties: (
|
|
5966
|
+
additionalProperties: (_a20 = parseDef2(def.valueType._def, {
|
|
5967
5967
|
...refs,
|
|
5968
5968
|
currentPath: [...refs.currentPath, "additionalProperties"]
|
|
5969
|
-
})) != null ?
|
|
5969
|
+
})) != null ? _a20 : refs.allowedAdditionalProperties
|
|
5970
5970
|
};
|
|
5971
5971
|
if (((_b8 = def.keyType) == null ? void 0 : _b8._def.typeName) === ZodFirstPartyTypeKind$1.ZodString && ((_c = def.keyType._def.checks) == null ? void 0 : _c.length)) {
|
|
5972
5972
|
const { type, ...keyType } = parseStringDef2(def.keyType._def, refs);
|
|
@@ -6017,11 +6017,11 @@ function parseMapDef2(def, refs) {
|
|
|
6017
6017
|
};
|
|
6018
6018
|
}
|
|
6019
6019
|
function parseNativeEnumDef2(def) {
|
|
6020
|
-
const
|
|
6020
|
+
const object3 = def.values;
|
|
6021
6021
|
const actualKeys = Object.keys(def.values).filter((key) => {
|
|
6022
|
-
return typeof
|
|
6022
|
+
return typeof object3[object3[key]] !== "number";
|
|
6023
6023
|
});
|
|
6024
|
-
const actualValues = actualKeys.map((key) =>
|
|
6024
|
+
const actualValues = actualKeys.map((key) => object3[key]);
|
|
6025
6025
|
const parsedTypes = Array.from(
|
|
6026
6026
|
new Set(actualValues.map((values) => typeof values))
|
|
6027
6027
|
);
|
|
@@ -6225,8 +6225,8 @@ function safeIsOptional2(schema) {
|
|
|
6225
6225
|
}
|
|
6226
6226
|
}
|
|
6227
6227
|
var parseOptionalDef2 = (def, refs) => {
|
|
6228
|
-
var
|
|
6229
|
-
if (refs.currentPath.toString() === ((
|
|
6228
|
+
var _a20;
|
|
6229
|
+
if (refs.currentPath.toString() === ((_a20 = refs.propertyPath) == null ? void 0 : _a20.toString())) {
|
|
6230
6230
|
return parseDef2(def.innerType._def, refs);
|
|
6231
6231
|
}
|
|
6232
6232
|
const innerSchema = parseDef2(def.innerType._def, {
|
|
@@ -6396,10 +6396,10 @@ var selectParser2 = (def, typeName, refs) => {
|
|
|
6396
6396
|
}
|
|
6397
6397
|
};
|
|
6398
6398
|
function parseDef2(def, refs, forceResolution = false) {
|
|
6399
|
-
var
|
|
6399
|
+
var _a20;
|
|
6400
6400
|
const seenItem = refs.seen.get(def);
|
|
6401
6401
|
if (refs.override) {
|
|
6402
|
-
const overrideResult = (
|
|
6402
|
+
const overrideResult = (_a20 = refs.override) == null ? void 0 : _a20.call(
|
|
6403
6403
|
refs,
|
|
6404
6404
|
def,
|
|
6405
6405
|
refs,
|
|
@@ -6465,11 +6465,11 @@ var getRefs2 = (options) => {
|
|
|
6465
6465
|
currentPath,
|
|
6466
6466
|
propertyPath: void 0,
|
|
6467
6467
|
seen: new Map(
|
|
6468
|
-
Object.entries(_options.definitions).map(([
|
|
6468
|
+
Object.entries(_options.definitions).map(([name20, def]) => [
|
|
6469
6469
|
def._def,
|
|
6470
6470
|
{
|
|
6471
6471
|
def: def._def,
|
|
6472
|
-
path: [..._options.basePath, _options.definitionPath,
|
|
6472
|
+
path: [..._options.basePath, _options.definitionPath, name20],
|
|
6473
6473
|
// Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now.
|
|
6474
6474
|
jsonSchema: void 0
|
|
6475
6475
|
}
|
|
@@ -6478,50 +6478,50 @@ var getRefs2 = (options) => {
|
|
|
6478
6478
|
};
|
|
6479
6479
|
};
|
|
6480
6480
|
var zodToJsonSchema3 = (schema, options) => {
|
|
6481
|
-
var
|
|
6481
|
+
var _a20;
|
|
6482
6482
|
const refs = getRefs2(options);
|
|
6483
6483
|
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce(
|
|
6484
|
-
(acc, [
|
|
6485
|
-
var
|
|
6484
|
+
(acc, [name25, schema2]) => {
|
|
6485
|
+
var _a25;
|
|
6486
6486
|
return {
|
|
6487
6487
|
...acc,
|
|
6488
|
-
[
|
|
6488
|
+
[name25]: (_a25 = parseDef2(
|
|
6489
6489
|
schema2._def,
|
|
6490
6490
|
{
|
|
6491
6491
|
...refs,
|
|
6492
|
-
currentPath: [...refs.basePath, refs.definitionPath,
|
|
6492
|
+
currentPath: [...refs.basePath, refs.definitionPath, name25]
|
|
6493
6493
|
},
|
|
6494
6494
|
true
|
|
6495
|
-
)) != null ?
|
|
6495
|
+
)) != null ? _a25 : parseAnyDef2()
|
|
6496
6496
|
};
|
|
6497
6497
|
},
|
|
6498
6498
|
{}
|
|
6499
6499
|
) : void 0;
|
|
6500
|
-
const
|
|
6501
|
-
const main = (
|
|
6500
|
+
const name20 = typeof options === "string" ? options : (options == null ? void 0 : options.nameStrategy) === "title" ? void 0 : options == null ? void 0 : options.name;
|
|
6501
|
+
const main = (_a20 = parseDef2(
|
|
6502
6502
|
schema._def,
|
|
6503
|
-
|
|
6503
|
+
name20 === void 0 ? refs : {
|
|
6504
6504
|
...refs,
|
|
6505
|
-
currentPath: [...refs.basePath, refs.definitionPath,
|
|
6505
|
+
currentPath: [...refs.basePath, refs.definitionPath, name20]
|
|
6506
6506
|
},
|
|
6507
6507
|
false
|
|
6508
|
-
)) != null ?
|
|
6508
|
+
)) != null ? _a20 : parseAnyDef2();
|
|
6509
6509
|
const title = typeof options === "object" && options.name !== void 0 && options.nameStrategy === "title" ? options.name : void 0;
|
|
6510
6510
|
if (title !== void 0) {
|
|
6511
6511
|
main.title = title;
|
|
6512
6512
|
}
|
|
6513
|
-
const combined =
|
|
6513
|
+
const combined = name20 === void 0 ? definitions ? {
|
|
6514
6514
|
...main,
|
|
6515
6515
|
[refs.definitionPath]: definitions
|
|
6516
6516
|
} : main : {
|
|
6517
6517
|
$ref: [
|
|
6518
6518
|
...refs.$refStrategy === "relative" ? [] : refs.basePath,
|
|
6519
6519
|
refs.definitionPath,
|
|
6520
|
-
|
|
6520
|
+
name20
|
|
6521
6521
|
].join("/"),
|
|
6522
6522
|
[refs.definitionPath]: {
|
|
6523
6523
|
...definitions,
|
|
6524
|
-
[
|
|
6524
|
+
[name20]: main
|
|
6525
6525
|
}
|
|
6526
6526
|
};
|
|
6527
6527
|
combined.$schema = "http://json-schema.org/draft-07/schema#";
|
|
@@ -6529,8 +6529,8 @@ var zodToJsonSchema3 = (schema, options) => {
|
|
|
6529
6529
|
};
|
|
6530
6530
|
var zod_to_json_schema_default = zodToJsonSchema3;
|
|
6531
6531
|
function zod3Schema(zodSchema22, options) {
|
|
6532
|
-
var
|
|
6533
|
-
const useReferences = (
|
|
6532
|
+
var _a20;
|
|
6533
|
+
const useReferences = (_a20 = void 0 ) != null ? _a20 : false;
|
|
6534
6534
|
return jsonSchema2(
|
|
6535
6535
|
zod_to_json_schema_default(zodSchema22, {
|
|
6536
6536
|
$refStrategy: useReferences ? "root" : "none"
|
|
@@ -6544,16 +6544,16 @@ function zod3Schema(zodSchema22, options) {
|
|
|
6544
6544
|
);
|
|
6545
6545
|
}
|
|
6546
6546
|
function zod4Schema(zodSchema22, options) {
|
|
6547
|
-
var
|
|
6548
|
-
const useReferences = (
|
|
6549
|
-
const z4JSONSchema =
|
|
6547
|
+
var _a20;
|
|
6548
|
+
const useReferences = (_a20 = void 0 ) != null ? _a20 : false;
|
|
6549
|
+
const z4JSONSchema = z42.toJSONSchema(zodSchema22, {
|
|
6550
6550
|
target: "draft-7",
|
|
6551
6551
|
io: "output",
|
|
6552
6552
|
reused: useReferences ? "ref" : "inline"
|
|
6553
6553
|
});
|
|
6554
6554
|
return jsonSchema2(z4JSONSchema, {
|
|
6555
6555
|
validate: async (value) => {
|
|
6556
|
-
const result = await
|
|
6556
|
+
const result = await z42.safeParseAsync(zodSchema22, value);
|
|
6557
6557
|
return result.success ? { success: true, value: result.data } : { success: false, error: result.error };
|
|
6558
6558
|
}
|
|
6559
6559
|
});
|
|
@@ -6857,14 +6857,14 @@ var gatewayErrorResponseSchema = z$1.object({
|
|
|
6857
6857
|
})
|
|
6858
6858
|
});
|
|
6859
6859
|
function asGatewayError(error, authMethod) {
|
|
6860
|
-
var
|
|
6860
|
+
var _a84;
|
|
6861
6861
|
if (GatewayError.isInstance(error)) {
|
|
6862
6862
|
return error;
|
|
6863
6863
|
}
|
|
6864
6864
|
if (APICallError2.isInstance(error)) {
|
|
6865
6865
|
return createGatewayErrorFromResponse({
|
|
6866
6866
|
response: extractApiCallResponse(error),
|
|
6867
|
-
statusCode: (
|
|
6867
|
+
statusCode: (_a84 = error.statusCode) != null ? _a84 : 500,
|
|
6868
6868
|
defaultMessage: "Gateway request failed",
|
|
6869
6869
|
cause: error,
|
|
6870
6870
|
authMethod
|
|
@@ -7140,7 +7140,7 @@ var GatewayEmbeddingModel = class {
|
|
|
7140
7140
|
abortSignal,
|
|
7141
7141
|
providerOptions
|
|
7142
7142
|
}) {
|
|
7143
|
-
var
|
|
7143
|
+
var _a84;
|
|
7144
7144
|
const resolvedHeaders = await resolve(this.config.headers());
|
|
7145
7145
|
try {
|
|
7146
7146
|
const {
|
|
@@ -7171,7 +7171,7 @@ var GatewayEmbeddingModel = class {
|
|
|
7171
7171
|
});
|
|
7172
7172
|
return {
|
|
7173
7173
|
embeddings: responseBody.embeddings,
|
|
7174
|
-
usage: (
|
|
7174
|
+
usage: (_a84 = responseBody.usage) != null ? _a84 : void 0,
|
|
7175
7175
|
providerMetadata: responseBody.providerMetadata,
|
|
7176
7176
|
response: { headers: responseHeaders, body: rawValue }
|
|
7177
7177
|
};
|
|
@@ -7195,16 +7195,16 @@ var gatewayEmbeddingResponseSchema = z$1.object({
|
|
|
7195
7195
|
providerMetadata: z$1.record(z$1.string(), z$1.record(z$1.string(), z$1.unknown())).optional()
|
|
7196
7196
|
});
|
|
7197
7197
|
async function getVercelRequestId() {
|
|
7198
|
-
var
|
|
7199
|
-
return (
|
|
7198
|
+
var _a84;
|
|
7199
|
+
return (_a84 = (0, import_oidc.getContext)().headers) == null ? void 0 : _a84["x-vercel-id"];
|
|
7200
7200
|
}
|
|
7201
7201
|
var VERSION3 = "1.0.33" ;
|
|
7202
7202
|
var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
|
|
7203
7203
|
function createGatewayProvider(options = {}) {
|
|
7204
|
-
var
|
|
7204
|
+
var _a84, _b8;
|
|
7205
7205
|
let pendingMetadata = null;
|
|
7206
7206
|
let metadataCache = null;
|
|
7207
|
-
const cacheRefreshMillis = (
|
|
7207
|
+
const cacheRefreshMillis = (_a84 = options.metadataCacheRefreshMillis) != null ? _a84 : 1e3 * 60 * 5;
|
|
7208
7208
|
let lastFetchTime = 0;
|
|
7209
7209
|
const baseURL = (_b8 = withoutTrailingSlash(options.baseURL)) != null ? _b8 : "https://ai-gateway.vercel.sh/v1/ai";
|
|
7210
7210
|
const getHeaders = async () => {
|
|
@@ -7259,8 +7259,8 @@ function createGatewayProvider(options = {}) {
|
|
|
7259
7259
|
});
|
|
7260
7260
|
};
|
|
7261
7261
|
const getAvailableModels = async () => {
|
|
7262
|
-
var
|
|
7263
|
-
const now = (_c = (_b9 = (
|
|
7262
|
+
var _a94, _b9, _c;
|
|
7263
|
+
const now = (_c = (_b9 = (_a94 = options._internal) == null ? void 0 : _a94.currentDate) == null ? void 0 : _b9.call(_a94).getTime()) != null ? _c : Date.now();
|
|
7264
7264
|
if (!pendingMetadata || now - lastFetchTime > cacheRefreshMillis) {
|
|
7265
7265
|
lastFetchTime = now;
|
|
7266
7266
|
pendingMetadata = new GatewayFetchMetadata({
|
|
@@ -7881,6 +7881,9 @@ function prepareRetries2({
|
|
|
7881
7881
|
})
|
|
7882
7882
|
};
|
|
7883
7883
|
}
|
|
7884
|
+
function stepCountIs(stepCount) {
|
|
7885
|
+
return ({ steps }) => steps.length === stepCount;
|
|
7886
|
+
}
|
|
7884
7887
|
createIdGenerator2({
|
|
7885
7888
|
prefix: "aitxt",
|
|
7886
7889
|
size: 24
|
|
@@ -8355,13 +8358,13 @@ createIdGenerator2({
|
|
|
8355
8358
|
prefix: "aitxt",
|
|
8356
8359
|
size: 24
|
|
8357
8360
|
});
|
|
8358
|
-
function splitArray2(
|
|
8361
|
+
function splitArray2(array, chunkSize) {
|
|
8359
8362
|
if (chunkSize <= 0) {
|
|
8360
8363
|
throw new Error("chunkSize must be greater than 0");
|
|
8361
8364
|
}
|
|
8362
8365
|
const result = [];
|
|
8363
|
-
for (let i = 0; i <
|
|
8364
|
-
result.push(
|
|
8366
|
+
for (let i = 0; i < array.length; i += chunkSize) {
|
|
8367
|
+
result.push(array.slice(i, i + chunkSize));
|
|
8365
8368
|
}
|
|
8366
8369
|
return result;
|
|
8367
8370
|
}
|
|
@@ -9592,50 +9595,50 @@ function isValidWithSchema(schema, value) {
|
|
|
9592
9595
|
return schema.safeParse(value).success;
|
|
9593
9596
|
}
|
|
9594
9597
|
var NotHandler = class {
|
|
9595
|
-
apply(
|
|
9596
|
-
if (!schema.not) return
|
|
9598
|
+
apply(zodSchema3, schema) {
|
|
9599
|
+
if (!schema.not) return zodSchema3;
|
|
9597
9600
|
const notSchema = convertJsonSchemaToZod(schema.not);
|
|
9598
|
-
return
|
|
9601
|
+
return zodSchema3.refine(
|
|
9599
9602
|
(value) => !isValidWithSchema(notSchema, value),
|
|
9600
9603
|
{ message: "Value must not match the 'not' schema" }
|
|
9601
9604
|
);
|
|
9602
9605
|
}
|
|
9603
9606
|
};
|
|
9604
9607
|
var UniqueItemsHandler = class {
|
|
9605
|
-
apply(
|
|
9608
|
+
apply(zodSchema3, schema) {
|
|
9606
9609
|
const arraySchema = schema;
|
|
9607
|
-
if (arraySchema.uniqueItems !== true) return
|
|
9608
|
-
return
|
|
9610
|
+
if (arraySchema.uniqueItems !== true) return zodSchema3;
|
|
9611
|
+
return zodSchema3.refine(createUniqueItemsValidator(), {
|
|
9609
9612
|
message: "Array items must be unique"
|
|
9610
9613
|
});
|
|
9611
9614
|
}
|
|
9612
9615
|
};
|
|
9613
9616
|
var AllOfHandler = class {
|
|
9614
|
-
apply(
|
|
9615
|
-
if (!schema.allOf || schema.allOf.length === 0) return
|
|
9617
|
+
apply(zodSchema3, schema) {
|
|
9618
|
+
if (!schema.allOf || schema.allOf.length === 0) return zodSchema3;
|
|
9616
9619
|
const allOfSchemas = schema.allOf.map((s) => convertJsonSchemaToZod(s));
|
|
9617
9620
|
return allOfSchemas.reduce(
|
|
9618
9621
|
(acc, s) => z$1.intersection(acc, s),
|
|
9619
|
-
|
|
9622
|
+
zodSchema3
|
|
9620
9623
|
);
|
|
9621
9624
|
}
|
|
9622
9625
|
};
|
|
9623
9626
|
var AnyOfHandler = class {
|
|
9624
|
-
apply(
|
|
9625
|
-
if (!schema.anyOf || schema.anyOf.length === 0) return
|
|
9627
|
+
apply(zodSchema3, schema) {
|
|
9628
|
+
if (!schema.anyOf || schema.anyOf.length === 0) return zodSchema3;
|
|
9626
9629
|
const anyOfSchema = schema.anyOf.length === 1 ? convertJsonSchemaToZod(schema.anyOf[0]) : z$1.union([
|
|
9627
9630
|
convertJsonSchemaToZod(schema.anyOf[0]),
|
|
9628
9631
|
convertJsonSchemaToZod(schema.anyOf[1]),
|
|
9629
9632
|
...schema.anyOf.slice(2).map((s) => convertJsonSchemaToZod(s))
|
|
9630
9633
|
]);
|
|
9631
|
-
return z$1.intersection(
|
|
9634
|
+
return z$1.intersection(zodSchema3, anyOfSchema);
|
|
9632
9635
|
}
|
|
9633
9636
|
};
|
|
9634
9637
|
var OneOfHandler = class {
|
|
9635
|
-
apply(
|
|
9636
|
-
if (!schema.oneOf || schema.oneOf.length === 0) return
|
|
9638
|
+
apply(zodSchema3, schema) {
|
|
9639
|
+
if (!schema.oneOf || schema.oneOf.length === 0) return zodSchema3;
|
|
9637
9640
|
const oneOfSchemas = schema.oneOf.map((s) => convertJsonSchemaToZod(s));
|
|
9638
|
-
return
|
|
9641
|
+
return zodSchema3.refine(
|
|
9639
9642
|
(value) => {
|
|
9640
9643
|
let validCount = 0;
|
|
9641
9644
|
for (const oneOfSchema of oneOfSchemas) {
|
|
@@ -9652,12 +9655,12 @@ var OneOfHandler = class {
|
|
|
9652
9655
|
}
|
|
9653
9656
|
};
|
|
9654
9657
|
var PrefixItemsHandler = class {
|
|
9655
|
-
apply(
|
|
9658
|
+
apply(zodSchema3, schema) {
|
|
9656
9659
|
const arraySchema = schema;
|
|
9657
9660
|
if (arraySchema.prefixItems && Array.isArray(arraySchema.prefixItems)) {
|
|
9658
9661
|
const prefixItems = arraySchema.prefixItems;
|
|
9659
9662
|
const prefixSchemas = prefixItems.map((itemSchema) => convertJsonSchemaToZod(itemSchema));
|
|
9660
|
-
return
|
|
9663
|
+
return zodSchema3.refine(
|
|
9661
9664
|
(value) => {
|
|
9662
9665
|
if (!Array.isArray(value)) return true;
|
|
9663
9666
|
for (let i = 0; i < Math.min(value.length, prefixSchemas.length); i++) {
|
|
@@ -9682,16 +9685,16 @@ var PrefixItemsHandler = class {
|
|
|
9682
9685
|
{ message: "Array does not match prefixItems schema" }
|
|
9683
9686
|
);
|
|
9684
9687
|
}
|
|
9685
|
-
return
|
|
9688
|
+
return zodSchema3;
|
|
9686
9689
|
}
|
|
9687
9690
|
};
|
|
9688
9691
|
var ObjectPropertiesHandler = class {
|
|
9689
|
-
apply(
|
|
9692
|
+
apply(zodSchema3, schema) {
|
|
9690
9693
|
const objectSchema = schema;
|
|
9691
9694
|
if (!objectSchema.properties && !objectSchema.required && objectSchema.additionalProperties !== false) {
|
|
9692
|
-
return
|
|
9695
|
+
return zodSchema3;
|
|
9693
9696
|
}
|
|
9694
|
-
if (
|
|
9697
|
+
if (zodSchema3 instanceof z$1.ZodObject || zodSchema3 instanceof z$1.ZodRecord) {
|
|
9695
9698
|
const shape = {};
|
|
9696
9699
|
if (objectSchema.properties) {
|
|
9697
9700
|
for (const [key, propSchema] of Object.entries(objectSchema.properties)) {
|
|
@@ -9718,7 +9721,7 @@ var ObjectPropertiesHandler = class {
|
|
|
9718
9721
|
return z$1.object(shape).passthrough();
|
|
9719
9722
|
}
|
|
9720
9723
|
}
|
|
9721
|
-
return
|
|
9724
|
+
return zodSchema3.refine(
|
|
9722
9725
|
(value) => {
|
|
9723
9726
|
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
9724
9727
|
return true;
|
|
@@ -9760,13 +9763,13 @@ var ObjectPropertiesHandler = class {
|
|
|
9760
9763
|
}
|
|
9761
9764
|
};
|
|
9762
9765
|
var EnumComplexHandler = class {
|
|
9763
|
-
apply(
|
|
9764
|
-
if (!schema.enum || schema.enum.length === 0) return
|
|
9766
|
+
apply(zodSchema3, schema) {
|
|
9767
|
+
if (!schema.enum || schema.enum.length === 0) return zodSchema3;
|
|
9765
9768
|
const complexValues = schema.enum.filter(
|
|
9766
9769
|
(v) => Array.isArray(v) || typeof v === "object" && v !== null
|
|
9767
9770
|
);
|
|
9768
|
-
if (complexValues.length === 0) return
|
|
9769
|
-
return
|
|
9771
|
+
if (complexValues.length === 0) return zodSchema3;
|
|
9772
|
+
return zodSchema3.refine(
|
|
9770
9773
|
(value) => {
|
|
9771
9774
|
if (typeof value !== "object" || value === null) return true;
|
|
9772
9775
|
return complexValues.some(
|
|
@@ -9778,32 +9781,32 @@ var EnumComplexHandler = class {
|
|
|
9778
9781
|
}
|
|
9779
9782
|
};
|
|
9780
9783
|
var ConstComplexHandler = class {
|
|
9781
|
-
apply(
|
|
9782
|
-
if (schema.const === void 0) return
|
|
9784
|
+
apply(zodSchema3, schema) {
|
|
9785
|
+
if (schema.const === void 0) return zodSchema3;
|
|
9783
9786
|
const constValue = schema.const;
|
|
9784
9787
|
if (typeof constValue !== "object" || constValue === null) {
|
|
9785
|
-
return
|
|
9788
|
+
return zodSchema3;
|
|
9786
9789
|
}
|
|
9787
|
-
return
|
|
9790
|
+
return zodSchema3.refine(
|
|
9788
9791
|
(value) => deepEqual(value, constValue),
|
|
9789
9792
|
{ message: "Value must equal the const value" }
|
|
9790
9793
|
);
|
|
9791
9794
|
}
|
|
9792
9795
|
};
|
|
9793
9796
|
var MetadataHandler = class {
|
|
9794
|
-
apply(
|
|
9797
|
+
apply(zodSchema3, schema) {
|
|
9795
9798
|
if (schema.description) {
|
|
9796
|
-
|
|
9799
|
+
zodSchema3 = zodSchema3.describe(schema.description);
|
|
9797
9800
|
}
|
|
9798
|
-
return
|
|
9801
|
+
return zodSchema3;
|
|
9799
9802
|
}
|
|
9800
9803
|
};
|
|
9801
9804
|
var ProtoRequiredHandler = class {
|
|
9802
|
-
apply(
|
|
9803
|
-
var
|
|
9805
|
+
apply(zodSchema3, schema) {
|
|
9806
|
+
var _a20;
|
|
9804
9807
|
const objectSchema = schema;
|
|
9805
|
-
if (!((
|
|
9806
|
-
return
|
|
9808
|
+
if (!((_a20 = objectSchema.required) == null ? void 0 : _a20.includes("__proto__")) || schema.type !== void 0) {
|
|
9809
|
+
return zodSchema3;
|
|
9807
9810
|
}
|
|
9808
9811
|
return z$1.any().refine(
|
|
9809
9812
|
(value) => this.validateRequired(value, objectSchema.required),
|
|
@@ -9820,14 +9823,14 @@ var ProtoRequiredHandler = class {
|
|
|
9820
9823
|
}
|
|
9821
9824
|
};
|
|
9822
9825
|
var ContainsHandler = class {
|
|
9823
|
-
apply(
|
|
9824
|
-
var
|
|
9826
|
+
apply(zodSchema3, schema) {
|
|
9827
|
+
var _a20;
|
|
9825
9828
|
const arraySchema = schema;
|
|
9826
|
-
if (arraySchema.contains === void 0) return
|
|
9829
|
+
if (arraySchema.contains === void 0) return zodSchema3;
|
|
9827
9830
|
const containsSchema = convertJsonSchemaToZod(arraySchema.contains);
|
|
9828
|
-
const minContains = (
|
|
9831
|
+
const minContains = (_a20 = arraySchema.minContains) != null ? _a20 : 1;
|
|
9829
9832
|
const maxContains = arraySchema.maxContains;
|
|
9830
|
-
return
|
|
9833
|
+
return zodSchema3.refine(
|
|
9831
9834
|
(value) => {
|
|
9832
9835
|
if (!Array.isArray(value)) {
|
|
9833
9836
|
return true;
|
|
@@ -9936,32 +9939,32 @@ function convertJsonSchemaToZod(schema) {
|
|
|
9936
9939
|
allowedSchemas.push(objectSchema);
|
|
9937
9940
|
}
|
|
9938
9941
|
}
|
|
9939
|
-
let
|
|
9942
|
+
let zodSchema3;
|
|
9940
9943
|
if (allowedSchemas.length === 0) {
|
|
9941
|
-
|
|
9944
|
+
zodSchema3 = z$1.never();
|
|
9942
9945
|
} else if (allowedSchemas.length === 1) {
|
|
9943
|
-
|
|
9946
|
+
zodSchema3 = allowedSchemas[0];
|
|
9944
9947
|
} else {
|
|
9945
9948
|
const hasConstraints = Object.keys(schema).some(
|
|
9946
9949
|
(key) => key !== "$schema" && key !== "title" && key !== "description"
|
|
9947
9950
|
);
|
|
9948
9951
|
if (!hasConstraints) {
|
|
9949
|
-
|
|
9952
|
+
zodSchema3 = z$1.any();
|
|
9950
9953
|
} else {
|
|
9951
|
-
|
|
9954
|
+
zodSchema3 = z$1.union(allowedSchemas);
|
|
9952
9955
|
}
|
|
9953
9956
|
}
|
|
9954
9957
|
for (const handler of refinementHandlers) {
|
|
9955
|
-
|
|
9958
|
+
zodSchema3 = handler.apply(zodSchema3, schema);
|
|
9956
9959
|
}
|
|
9957
|
-
return
|
|
9960
|
+
return zodSchema3;
|
|
9958
9961
|
}
|
|
9959
9962
|
function convertJsonSchemaToZod2(schema) {
|
|
9960
|
-
function addMetadata(
|
|
9961
|
-
if (
|
|
9962
|
-
|
|
9963
|
+
function addMetadata(zodSchema3, jsonSchema3) {
|
|
9964
|
+
if (jsonSchema3.description) {
|
|
9965
|
+
zodSchema3 = zodSchema3.describe(jsonSchema3.description);
|
|
9963
9966
|
}
|
|
9964
|
-
return
|
|
9967
|
+
return zodSchema3;
|
|
9965
9968
|
}
|
|
9966
9969
|
if (schema.const !== void 0) {
|
|
9967
9970
|
if (typeof schema.const === "string") {
|
|
@@ -10067,13 +10070,13 @@ function convertJsonSchemaToZod2(schema) {
|
|
|
10067
10070
|
shape[key] = shape[key].optional();
|
|
10068
10071
|
}
|
|
10069
10072
|
}
|
|
10070
|
-
let
|
|
10073
|
+
let zodSchema3;
|
|
10071
10074
|
if (schema.additionalProperties !== false) {
|
|
10072
|
-
|
|
10075
|
+
zodSchema3 = z.object(shape).passthrough();
|
|
10073
10076
|
} else {
|
|
10074
|
-
|
|
10077
|
+
zodSchema3 = z.object(shape);
|
|
10075
10078
|
}
|
|
10076
|
-
return addMetadata(
|
|
10079
|
+
return addMetadata(zodSchema3, schema);
|
|
10077
10080
|
}
|
|
10078
10081
|
return addMetadata(z.object({}), schema);
|
|
10079
10082
|
case "array": {
|
|
@@ -10650,11 +10653,11 @@ ${workingMemory}`;
|
|
|
10650
10653
|
release();
|
|
10651
10654
|
}
|
|
10652
10655
|
}
|
|
10653
|
-
chunkText(
|
|
10656
|
+
chunkText(text3, tokenSize = 4096) {
|
|
10654
10657
|
const charSize = tokenSize * CHARS_PER_TOKEN;
|
|
10655
10658
|
const chunks = [];
|
|
10656
10659
|
let currentChunk = "";
|
|
10657
|
-
const words =
|
|
10660
|
+
const words = text3.split(/\s+/);
|
|
10658
10661
|
for (const word of words) {
|
|
10659
10662
|
const wordWithSpace = currentChunk ? " " + word : word;
|
|
10660
10663
|
if (currentChunk.length + wordWithSpace.length > charSize) {
|
|
@@ -10816,10 +10819,10 @@ ${workingMemory}`;
|
|
|
10816
10819
|
}
|
|
10817
10820
|
return newMessage;
|
|
10818
10821
|
}
|
|
10819
|
-
parseWorkingMemory(
|
|
10822
|
+
parseWorkingMemory(text3) {
|
|
10820
10823
|
if (!this.threadConfig.workingMemory?.enabled) return null;
|
|
10821
10824
|
const workingMemoryRegex = /<working_memory>([^]*?)<\/working_memory>/g;
|
|
10822
|
-
const matches =
|
|
10825
|
+
const matches = text3.match(workingMemoryRegex);
|
|
10823
10826
|
const match = matches?.[0];
|
|
10824
10827
|
if (match) {
|
|
10825
10828
|
return match.replace(/<\/?working_memory>/g, "").trim();
|
|
@@ -11119,12 +11122,12 @@ var _Tiktoken = class {
|
|
|
11119
11122
|
this.textMap.set(rank, bytes);
|
|
11120
11123
|
}
|
|
11121
11124
|
this.specialTokens = { ...ranks.special_tokens, ...extendedSpecialTokens };
|
|
11122
|
-
this.inverseSpecialTokens = Object.entries(this.specialTokens).reduce((memo, [
|
|
11123
|
-
memo[rank] = this.textEncoder.encode(
|
|
11125
|
+
this.inverseSpecialTokens = Object.entries(this.specialTokens).reduce((memo, [text3, rank]) => {
|
|
11126
|
+
memo[rank] = this.textEncoder.encode(text3);
|
|
11124
11127
|
return memo;
|
|
11125
11128
|
}, {});
|
|
11126
11129
|
}
|
|
11127
|
-
encode(
|
|
11130
|
+
encode(text3, allowedSpecial = [], disallowedSpecial = "all") {
|
|
11128
11131
|
const regexes = new RegExp(this.patStr, "ug");
|
|
11129
11132
|
const specialRegex = _Tiktoken.specialTokenRegex(
|
|
11130
11133
|
Object.keys(this.specialTokens)
|
|
@@ -11142,7 +11145,7 @@ var _Tiktoken = class {
|
|
|
11142
11145
|
const disallowedSpecialRegex = _Tiktoken.specialTokenRegex([
|
|
11143
11146
|
...disallowedSpecialSet
|
|
11144
11147
|
]);
|
|
11145
|
-
const specialMatch =
|
|
11148
|
+
const specialMatch = text3.match(disallowedSpecialRegex);
|
|
11146
11149
|
if (specialMatch != null) {
|
|
11147
11150
|
throw new Error(
|
|
11148
11151
|
`The text contains a special token that is not allowed: ${specialMatch[0]}`
|
|
@@ -11155,13 +11158,13 @@ var _Tiktoken = class {
|
|
|
11155
11158
|
let startFind = start;
|
|
11156
11159
|
while (true) {
|
|
11157
11160
|
specialRegex.lastIndex = startFind;
|
|
11158
|
-
nextSpecial = specialRegex.exec(
|
|
11161
|
+
nextSpecial = specialRegex.exec(text3);
|
|
11159
11162
|
if (nextSpecial == null || allowedSpecialSet.has(nextSpecial[0]))
|
|
11160
11163
|
break;
|
|
11161
11164
|
startFind = nextSpecial.index + 1;
|
|
11162
11165
|
}
|
|
11163
|
-
const end = nextSpecial?.index ??
|
|
11164
|
-
for (const match of
|
|
11166
|
+
const end = nextSpecial?.index ?? text3.length;
|
|
11167
|
+
for (const match of text3.substring(start, end).matchAll(regexes)) {
|
|
11165
11168
|
const piece = this.textEncoder.encode(match[0]);
|
|
11166
11169
|
const token2 = this.rankMap.get(piece.join(","));
|
|
11167
11170
|
if (token2 != null) {
|
|
@@ -11309,2008 +11312,6 @@ var TokenLimiter = class extends MemoryProcessor {
|
|
|
11309
11312
|
|
|
11310
11313
|
// ../agent-builder/dist/index.js
|
|
11311
11314
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
11312
|
-
var createIdGenerator3 = ({
|
|
11313
|
-
prefix,
|
|
11314
|
-
size = 16,
|
|
11315
|
-
alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
|
|
11316
|
-
separator = "-"
|
|
11317
|
-
} = {}) => {
|
|
11318
|
-
const generator = () => {
|
|
11319
|
-
const alphabetLength = alphabet.length;
|
|
11320
|
-
const chars = new Array(size);
|
|
11321
|
-
for (let i = 0; i < size; i++) {
|
|
11322
|
-
chars[i] = alphabet[Math.random() * alphabetLength | 0];
|
|
11323
|
-
}
|
|
11324
|
-
return chars.join("");
|
|
11325
|
-
};
|
|
11326
|
-
if (prefix == null) {
|
|
11327
|
-
return generator;
|
|
11328
|
-
}
|
|
11329
|
-
if (alphabet.includes(separator)) {
|
|
11330
|
-
throw new InvalidArgumentError2({
|
|
11331
|
-
argument: "separator",
|
|
11332
|
-
message: `The separator "${separator}" must not be part of the alphabet "${alphabet}".`
|
|
11333
|
-
});
|
|
11334
|
-
}
|
|
11335
|
-
return () => `${prefix}${separator}${generator()}`;
|
|
11336
|
-
};
|
|
11337
|
-
createIdGenerator3();
|
|
11338
|
-
var suspectProtoRx2 = /"__proto__"\s*:/;
|
|
11339
|
-
var suspectConstructorRx2 = /"constructor"\s*:/;
|
|
11340
|
-
function _parse2(text4) {
|
|
11341
|
-
const obj = JSON.parse(text4);
|
|
11342
|
-
if (obj === null || typeof obj !== "object") {
|
|
11343
|
-
return obj;
|
|
11344
|
-
}
|
|
11345
|
-
if (suspectProtoRx2.test(text4) === false && suspectConstructorRx2.test(text4) === false) {
|
|
11346
|
-
return obj;
|
|
11347
|
-
}
|
|
11348
|
-
return filter2(obj);
|
|
11349
|
-
}
|
|
11350
|
-
function filter2(obj) {
|
|
11351
|
-
let next = [obj];
|
|
11352
|
-
while (next.length) {
|
|
11353
|
-
const nodes = next;
|
|
11354
|
-
next = [];
|
|
11355
|
-
for (const node of nodes) {
|
|
11356
|
-
if (Object.prototype.hasOwnProperty.call(node, "__proto__")) {
|
|
11357
|
-
throw new SyntaxError("Object contains forbidden prototype property");
|
|
11358
|
-
}
|
|
11359
|
-
if (Object.prototype.hasOwnProperty.call(node, "constructor") && Object.prototype.hasOwnProperty.call(node.constructor, "prototype")) {
|
|
11360
|
-
throw new SyntaxError("Object contains forbidden prototype property");
|
|
11361
|
-
}
|
|
11362
|
-
for (const key in node) {
|
|
11363
|
-
const value = node[key];
|
|
11364
|
-
if (value && typeof value === "object") {
|
|
11365
|
-
next.push(value);
|
|
11366
|
-
}
|
|
11367
|
-
}
|
|
11368
|
-
}
|
|
11369
|
-
}
|
|
11370
|
-
return obj;
|
|
11371
|
-
}
|
|
11372
|
-
function secureJsonParse2(text4) {
|
|
11373
|
-
const { stackTraceLimit } = Error;
|
|
11374
|
-
Error.stackTraceLimit = 0;
|
|
11375
|
-
try {
|
|
11376
|
-
return _parse2(text4);
|
|
11377
|
-
} finally {
|
|
11378
|
-
Error.stackTraceLimit = stackTraceLimit;
|
|
11379
|
-
}
|
|
11380
|
-
}
|
|
11381
|
-
var validatorSymbol3 = Symbol.for("vercel.ai.validator");
|
|
11382
|
-
function validator2(validate) {
|
|
11383
|
-
return { [validatorSymbol3]: true, validate };
|
|
11384
|
-
}
|
|
11385
|
-
function isValidator2(value) {
|
|
11386
|
-
return typeof value === "object" && value !== null && validatorSymbol3 in value && value[validatorSymbol3] === true && "validate" in value;
|
|
11387
|
-
}
|
|
11388
|
-
function asValidator2(value) {
|
|
11389
|
-
return isValidator2(value) ? value : typeof value === "function" ? value() : standardSchemaValidator2(value);
|
|
11390
|
-
}
|
|
11391
|
-
function standardSchemaValidator2(standardSchema) {
|
|
11392
|
-
return validator2(async (value) => {
|
|
11393
|
-
const result = await standardSchema["~standard"].validate(value);
|
|
11394
|
-
return result.issues == null ? { success: true, value: result.value } : {
|
|
11395
|
-
success: false,
|
|
11396
|
-
error: new TypeValidationError({
|
|
11397
|
-
value,
|
|
11398
|
-
cause: result.issues
|
|
11399
|
-
})
|
|
11400
|
-
};
|
|
11401
|
-
});
|
|
11402
|
-
}
|
|
11403
|
-
async function safeValidateTypes3({
|
|
11404
|
-
value,
|
|
11405
|
-
schema
|
|
11406
|
-
}) {
|
|
11407
|
-
const validator22 = asValidator2(schema);
|
|
11408
|
-
try {
|
|
11409
|
-
if (validator22.validate == null) {
|
|
11410
|
-
return { success: true, value, rawValue: value };
|
|
11411
|
-
}
|
|
11412
|
-
const result = await validator22.validate(value);
|
|
11413
|
-
if (result.success) {
|
|
11414
|
-
return { success: true, value: result.value, rawValue: value };
|
|
11415
|
-
}
|
|
11416
|
-
return {
|
|
11417
|
-
success: false,
|
|
11418
|
-
error: TypeValidationError.wrap({ value, cause: result.error }),
|
|
11419
|
-
rawValue: value
|
|
11420
|
-
};
|
|
11421
|
-
} catch (error) {
|
|
11422
|
-
return {
|
|
11423
|
-
success: false,
|
|
11424
|
-
error: TypeValidationError.wrap({ value, cause: error }),
|
|
11425
|
-
rawValue: value
|
|
11426
|
-
};
|
|
11427
|
-
}
|
|
11428
|
-
}
|
|
11429
|
-
async function safeParseJSON3({
|
|
11430
|
-
text: text4,
|
|
11431
|
-
schema
|
|
11432
|
-
}) {
|
|
11433
|
-
try {
|
|
11434
|
-
const value = secureJsonParse2(text4);
|
|
11435
|
-
if (schema == null) {
|
|
11436
|
-
return { success: true, value, rawValue: value };
|
|
11437
|
-
}
|
|
11438
|
-
return await safeValidateTypes3({ value, schema });
|
|
11439
|
-
} catch (error) {
|
|
11440
|
-
return {
|
|
11441
|
-
success: false,
|
|
11442
|
-
error: JSONParseError.isInstance(error) ? error : new JSONParseError({ text: text4, cause: error }),
|
|
11443
|
-
rawValue: void 0
|
|
11444
|
-
};
|
|
11445
|
-
}
|
|
11446
|
-
}
|
|
11447
|
-
var getRelativePath3 = (pathA, pathB) => {
|
|
11448
|
-
let i = 0;
|
|
11449
|
-
for (; i < pathA.length && i < pathB.length; i++) {
|
|
11450
|
-
if (pathA[i] !== pathB[i]) break;
|
|
11451
|
-
}
|
|
11452
|
-
return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
|
|
11453
|
-
};
|
|
11454
|
-
var ignoreOverride3 = Symbol(
|
|
11455
|
-
"Let zodToJsonSchema decide on which parser to use"
|
|
11456
|
-
);
|
|
11457
|
-
var defaultOptions3 = {
|
|
11458
|
-
name: void 0,
|
|
11459
|
-
$refStrategy: "root",
|
|
11460
|
-
basePath: ["#"],
|
|
11461
|
-
effectStrategy: "input",
|
|
11462
|
-
pipeStrategy: "all",
|
|
11463
|
-
dateStrategy: "format:date-time",
|
|
11464
|
-
mapStrategy: "entries",
|
|
11465
|
-
removeAdditionalStrategy: "passthrough",
|
|
11466
|
-
allowedAdditionalProperties: true,
|
|
11467
|
-
rejectedAdditionalProperties: false,
|
|
11468
|
-
definitionPath: "definitions",
|
|
11469
|
-
strictUnions: false,
|
|
11470
|
-
definitions: {},
|
|
11471
|
-
errorMessages: false,
|
|
11472
|
-
patternStrategy: "escape",
|
|
11473
|
-
applyRegexFlags: false,
|
|
11474
|
-
emailStrategy: "format:email",
|
|
11475
|
-
base64Strategy: "contentEncoding:base64",
|
|
11476
|
-
nameStrategy: "ref"
|
|
11477
|
-
};
|
|
11478
|
-
var getDefaultOptions3 = (options) => typeof options === "string" ? {
|
|
11479
|
-
...defaultOptions3,
|
|
11480
|
-
name: options
|
|
11481
|
-
} : {
|
|
11482
|
-
...defaultOptions3,
|
|
11483
|
-
...options
|
|
11484
|
-
};
|
|
11485
|
-
function parseAnyDef3() {
|
|
11486
|
-
return {};
|
|
11487
|
-
}
|
|
11488
|
-
function parseArrayDef3(def, refs) {
|
|
11489
|
-
var _a21, _b8, _c;
|
|
11490
|
-
const res = {
|
|
11491
|
-
type: "array"
|
|
11492
|
-
};
|
|
11493
|
-
if (((_a21 = def.type) == null ? void 0 : _a21._def) && ((_c = (_b8 = def.type) == null ? void 0 : _b8._def) == null ? void 0 : _c.typeName) !== ZodFirstPartyTypeKind$1.ZodAny) {
|
|
11494
|
-
res.items = parseDef3(def.type._def, {
|
|
11495
|
-
...refs,
|
|
11496
|
-
currentPath: [...refs.currentPath, "items"]
|
|
11497
|
-
});
|
|
11498
|
-
}
|
|
11499
|
-
if (def.minLength) {
|
|
11500
|
-
res.minItems = def.minLength.value;
|
|
11501
|
-
}
|
|
11502
|
-
if (def.maxLength) {
|
|
11503
|
-
res.maxItems = def.maxLength.value;
|
|
11504
|
-
}
|
|
11505
|
-
if (def.exactLength) {
|
|
11506
|
-
res.minItems = def.exactLength.value;
|
|
11507
|
-
res.maxItems = def.exactLength.value;
|
|
11508
|
-
}
|
|
11509
|
-
return res;
|
|
11510
|
-
}
|
|
11511
|
-
function parseBigintDef3(def) {
|
|
11512
|
-
const res = {
|
|
11513
|
-
type: "integer",
|
|
11514
|
-
format: "int64"
|
|
11515
|
-
};
|
|
11516
|
-
if (!def.checks) return res;
|
|
11517
|
-
for (const check of def.checks) {
|
|
11518
|
-
switch (check.kind) {
|
|
11519
|
-
case "min":
|
|
11520
|
-
if (check.inclusive) {
|
|
11521
|
-
res.minimum = check.value;
|
|
11522
|
-
} else {
|
|
11523
|
-
res.exclusiveMinimum = check.value;
|
|
11524
|
-
}
|
|
11525
|
-
break;
|
|
11526
|
-
case "max":
|
|
11527
|
-
if (check.inclusive) {
|
|
11528
|
-
res.maximum = check.value;
|
|
11529
|
-
} else {
|
|
11530
|
-
res.exclusiveMaximum = check.value;
|
|
11531
|
-
}
|
|
11532
|
-
break;
|
|
11533
|
-
case "multipleOf":
|
|
11534
|
-
res.multipleOf = check.value;
|
|
11535
|
-
break;
|
|
11536
|
-
}
|
|
11537
|
-
}
|
|
11538
|
-
return res;
|
|
11539
|
-
}
|
|
11540
|
-
function parseBooleanDef3() {
|
|
11541
|
-
return { type: "boolean" };
|
|
11542
|
-
}
|
|
11543
|
-
function parseBrandedDef3(_def, refs) {
|
|
11544
|
-
return parseDef3(_def.type._def, refs);
|
|
11545
|
-
}
|
|
11546
|
-
var parseCatchDef3 = (def, refs) => {
|
|
11547
|
-
return parseDef3(def.innerType._def, refs);
|
|
11548
|
-
};
|
|
11549
|
-
function parseDateDef3(def, refs, overrideDateStrategy) {
|
|
11550
|
-
const strategy = overrideDateStrategy != null ? overrideDateStrategy : refs.dateStrategy;
|
|
11551
|
-
if (Array.isArray(strategy)) {
|
|
11552
|
-
return {
|
|
11553
|
-
anyOf: strategy.map((item, i) => parseDateDef3(def, refs, item))
|
|
11554
|
-
};
|
|
11555
|
-
}
|
|
11556
|
-
switch (strategy) {
|
|
11557
|
-
case "string":
|
|
11558
|
-
case "format:date-time":
|
|
11559
|
-
return {
|
|
11560
|
-
type: "string",
|
|
11561
|
-
format: "date-time"
|
|
11562
|
-
};
|
|
11563
|
-
case "format:date":
|
|
11564
|
-
return {
|
|
11565
|
-
type: "string",
|
|
11566
|
-
format: "date"
|
|
11567
|
-
};
|
|
11568
|
-
case "integer":
|
|
11569
|
-
return integerDateParser3(def);
|
|
11570
|
-
}
|
|
11571
|
-
}
|
|
11572
|
-
var integerDateParser3 = (def) => {
|
|
11573
|
-
const res = {
|
|
11574
|
-
type: "integer",
|
|
11575
|
-
format: "unix-time"
|
|
11576
|
-
};
|
|
11577
|
-
for (const check of def.checks) {
|
|
11578
|
-
switch (check.kind) {
|
|
11579
|
-
case "min":
|
|
11580
|
-
res.minimum = check.value;
|
|
11581
|
-
break;
|
|
11582
|
-
case "max":
|
|
11583
|
-
res.maximum = check.value;
|
|
11584
|
-
break;
|
|
11585
|
-
}
|
|
11586
|
-
}
|
|
11587
|
-
return res;
|
|
11588
|
-
};
|
|
11589
|
-
function parseDefaultDef3(_def, refs) {
|
|
11590
|
-
return {
|
|
11591
|
-
...parseDef3(_def.innerType._def, refs),
|
|
11592
|
-
default: _def.defaultValue()
|
|
11593
|
-
};
|
|
11594
|
-
}
|
|
11595
|
-
function parseEffectsDef3(_def, refs) {
|
|
11596
|
-
return refs.effectStrategy === "input" ? parseDef3(_def.schema._def, refs) : parseAnyDef3();
|
|
11597
|
-
}
|
|
11598
|
-
function parseEnumDef3(def) {
|
|
11599
|
-
return {
|
|
11600
|
-
type: "string",
|
|
11601
|
-
enum: Array.from(def.values)
|
|
11602
|
-
};
|
|
11603
|
-
}
|
|
11604
|
-
var isJsonSchema7AllOfType3 = (type) => {
|
|
11605
|
-
if ("type" in type && type.type === "string") return false;
|
|
11606
|
-
return "allOf" in type;
|
|
11607
|
-
};
|
|
11608
|
-
function parseIntersectionDef3(def, refs) {
|
|
11609
|
-
const allOf = [
|
|
11610
|
-
parseDef3(def.left._def, {
|
|
11611
|
-
...refs,
|
|
11612
|
-
currentPath: [...refs.currentPath, "allOf", "0"]
|
|
11613
|
-
}),
|
|
11614
|
-
parseDef3(def.right._def, {
|
|
11615
|
-
...refs,
|
|
11616
|
-
currentPath: [...refs.currentPath, "allOf", "1"]
|
|
11617
|
-
})
|
|
11618
|
-
].filter((x) => !!x);
|
|
11619
|
-
const mergedAllOf = [];
|
|
11620
|
-
allOf.forEach((schema) => {
|
|
11621
|
-
if (isJsonSchema7AllOfType3(schema)) {
|
|
11622
|
-
mergedAllOf.push(...schema.allOf);
|
|
11623
|
-
} else {
|
|
11624
|
-
let nestedSchema = schema;
|
|
11625
|
-
if ("additionalProperties" in schema && schema.additionalProperties === false) {
|
|
11626
|
-
const { additionalProperties, ...rest } = schema;
|
|
11627
|
-
nestedSchema = rest;
|
|
11628
|
-
}
|
|
11629
|
-
mergedAllOf.push(nestedSchema);
|
|
11630
|
-
}
|
|
11631
|
-
});
|
|
11632
|
-
return mergedAllOf.length ? { allOf: mergedAllOf } : void 0;
|
|
11633
|
-
}
|
|
11634
|
-
function parseLiteralDef3(def) {
|
|
11635
|
-
const parsedType = typeof def.value;
|
|
11636
|
-
if (parsedType !== "bigint" && parsedType !== "number" && parsedType !== "boolean" && parsedType !== "string") {
|
|
11637
|
-
return {
|
|
11638
|
-
type: Array.isArray(def.value) ? "array" : "object"
|
|
11639
|
-
};
|
|
11640
|
-
}
|
|
11641
|
-
return {
|
|
11642
|
-
type: parsedType === "bigint" ? "integer" : parsedType,
|
|
11643
|
-
const: def.value
|
|
11644
|
-
};
|
|
11645
|
-
}
|
|
11646
|
-
var emojiRegex3 = void 0;
|
|
11647
|
-
var zodPatterns3 = {
|
|
11648
|
-
/**
|
|
11649
|
-
* `c` was changed to `[cC]` to replicate /i flag
|
|
11650
|
-
*/
|
|
11651
|
-
cuid: /^[cC][^\s-]{8,}$/,
|
|
11652
|
-
cuid2: /^[0-9a-z]+$/,
|
|
11653
|
-
ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
|
|
11654
|
-
/**
|
|
11655
|
-
* `a-z` was added to replicate /i flag
|
|
11656
|
-
*/
|
|
11657
|
-
email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,
|
|
11658
|
-
/**
|
|
11659
|
-
* Constructed a valid Unicode RegExp
|
|
11660
|
-
*
|
|
11661
|
-
* Lazily instantiate since this type of regex isn't supported
|
|
11662
|
-
* in all envs (e.g. React Native).
|
|
11663
|
-
*
|
|
11664
|
-
* See:
|
|
11665
|
-
* https://github.com/colinhacks/zod/issues/2433
|
|
11666
|
-
* Fix in Zod:
|
|
11667
|
-
* https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b
|
|
11668
|
-
*/
|
|
11669
|
-
emoji: () => {
|
|
11670
|
-
if (emojiRegex3 === void 0) {
|
|
11671
|
-
emojiRegex3 = RegExp(
|
|
11672
|
-
"^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",
|
|
11673
|
-
"u"
|
|
11674
|
-
);
|
|
11675
|
-
}
|
|
11676
|
-
return emojiRegex3;
|
|
11677
|
-
},
|
|
11678
|
-
/**
|
|
11679
|
-
* Unused
|
|
11680
|
-
*/
|
|
11681
|
-
uuid: /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,
|
|
11682
|
-
/**
|
|
11683
|
-
* Unused
|
|
11684
|
-
*/
|
|
11685
|
-
ipv4: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,
|
|
11686
|
-
ipv4Cidr: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,
|
|
11687
|
-
/**
|
|
11688
|
-
* Unused
|
|
11689
|
-
*/
|
|
11690
|
-
ipv6: /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,
|
|
11691
|
-
ipv6Cidr: /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,
|
|
11692
|
-
base64: /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,
|
|
11693
|
-
base64url: /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,
|
|
11694
|
-
nanoid: /^[a-zA-Z0-9_-]{21}$/,
|
|
11695
|
-
jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
|
|
11696
|
-
};
|
|
11697
|
-
function parseStringDef3(def, refs) {
|
|
11698
|
-
const res = {
|
|
11699
|
-
type: "string"
|
|
11700
|
-
};
|
|
11701
|
-
if (def.checks) {
|
|
11702
|
-
for (const check of def.checks) {
|
|
11703
|
-
switch (check.kind) {
|
|
11704
|
-
case "min":
|
|
11705
|
-
res.minLength = typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value;
|
|
11706
|
-
break;
|
|
11707
|
-
case "max":
|
|
11708
|
-
res.maxLength = typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value;
|
|
11709
|
-
break;
|
|
11710
|
-
case "email":
|
|
11711
|
-
switch (refs.emailStrategy) {
|
|
11712
|
-
case "format:email":
|
|
11713
|
-
addFormat3(res, "email", check.message, refs);
|
|
11714
|
-
break;
|
|
11715
|
-
case "format:idn-email":
|
|
11716
|
-
addFormat3(res, "idn-email", check.message, refs);
|
|
11717
|
-
break;
|
|
11718
|
-
case "pattern:zod":
|
|
11719
|
-
addPattern3(res, zodPatterns3.email, check.message, refs);
|
|
11720
|
-
break;
|
|
11721
|
-
}
|
|
11722
|
-
break;
|
|
11723
|
-
case "url":
|
|
11724
|
-
addFormat3(res, "uri", check.message, refs);
|
|
11725
|
-
break;
|
|
11726
|
-
case "uuid":
|
|
11727
|
-
addFormat3(res, "uuid", check.message, refs);
|
|
11728
|
-
break;
|
|
11729
|
-
case "regex":
|
|
11730
|
-
addPattern3(res, check.regex, check.message, refs);
|
|
11731
|
-
break;
|
|
11732
|
-
case "cuid":
|
|
11733
|
-
addPattern3(res, zodPatterns3.cuid, check.message, refs);
|
|
11734
|
-
break;
|
|
11735
|
-
case "cuid2":
|
|
11736
|
-
addPattern3(res, zodPatterns3.cuid2, check.message, refs);
|
|
11737
|
-
break;
|
|
11738
|
-
case "startsWith":
|
|
11739
|
-
addPattern3(
|
|
11740
|
-
res,
|
|
11741
|
-
RegExp(`^${escapeLiteralCheckValue3(check.value, refs)}`),
|
|
11742
|
-
check.message,
|
|
11743
|
-
refs
|
|
11744
|
-
);
|
|
11745
|
-
break;
|
|
11746
|
-
case "endsWith":
|
|
11747
|
-
addPattern3(
|
|
11748
|
-
res,
|
|
11749
|
-
RegExp(`${escapeLiteralCheckValue3(check.value, refs)}$`),
|
|
11750
|
-
check.message,
|
|
11751
|
-
refs
|
|
11752
|
-
);
|
|
11753
|
-
break;
|
|
11754
|
-
case "datetime":
|
|
11755
|
-
addFormat3(res, "date-time", check.message, refs);
|
|
11756
|
-
break;
|
|
11757
|
-
case "date":
|
|
11758
|
-
addFormat3(res, "date", check.message, refs);
|
|
11759
|
-
break;
|
|
11760
|
-
case "time":
|
|
11761
|
-
addFormat3(res, "time", check.message, refs);
|
|
11762
|
-
break;
|
|
11763
|
-
case "duration":
|
|
11764
|
-
addFormat3(res, "duration", check.message, refs);
|
|
11765
|
-
break;
|
|
11766
|
-
case "length":
|
|
11767
|
-
res.minLength = typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value;
|
|
11768
|
-
res.maxLength = typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value;
|
|
11769
|
-
break;
|
|
11770
|
-
case "includes": {
|
|
11771
|
-
addPattern3(
|
|
11772
|
-
res,
|
|
11773
|
-
RegExp(escapeLiteralCheckValue3(check.value, refs)),
|
|
11774
|
-
check.message,
|
|
11775
|
-
refs
|
|
11776
|
-
);
|
|
11777
|
-
break;
|
|
11778
|
-
}
|
|
11779
|
-
case "ip": {
|
|
11780
|
-
if (check.version !== "v6") {
|
|
11781
|
-
addFormat3(res, "ipv4", check.message, refs);
|
|
11782
|
-
}
|
|
11783
|
-
if (check.version !== "v4") {
|
|
11784
|
-
addFormat3(res, "ipv6", check.message, refs);
|
|
11785
|
-
}
|
|
11786
|
-
break;
|
|
11787
|
-
}
|
|
11788
|
-
case "base64url":
|
|
11789
|
-
addPattern3(res, zodPatterns3.base64url, check.message, refs);
|
|
11790
|
-
break;
|
|
11791
|
-
case "jwt":
|
|
11792
|
-
addPattern3(res, zodPatterns3.jwt, check.message, refs);
|
|
11793
|
-
break;
|
|
11794
|
-
case "cidr": {
|
|
11795
|
-
if (check.version !== "v6") {
|
|
11796
|
-
addPattern3(res, zodPatterns3.ipv4Cidr, check.message, refs);
|
|
11797
|
-
}
|
|
11798
|
-
if (check.version !== "v4") {
|
|
11799
|
-
addPattern3(res, zodPatterns3.ipv6Cidr, check.message, refs);
|
|
11800
|
-
}
|
|
11801
|
-
break;
|
|
11802
|
-
}
|
|
11803
|
-
case "emoji":
|
|
11804
|
-
addPattern3(res, zodPatterns3.emoji(), check.message, refs);
|
|
11805
|
-
break;
|
|
11806
|
-
case "ulid": {
|
|
11807
|
-
addPattern3(res, zodPatterns3.ulid, check.message, refs);
|
|
11808
|
-
break;
|
|
11809
|
-
}
|
|
11810
|
-
case "base64": {
|
|
11811
|
-
switch (refs.base64Strategy) {
|
|
11812
|
-
case "format:binary": {
|
|
11813
|
-
addFormat3(res, "binary", check.message, refs);
|
|
11814
|
-
break;
|
|
11815
|
-
}
|
|
11816
|
-
case "contentEncoding:base64": {
|
|
11817
|
-
res.contentEncoding = "base64";
|
|
11818
|
-
break;
|
|
11819
|
-
}
|
|
11820
|
-
case "pattern:zod": {
|
|
11821
|
-
addPattern3(res, zodPatterns3.base64, check.message, refs);
|
|
11822
|
-
break;
|
|
11823
|
-
}
|
|
11824
|
-
}
|
|
11825
|
-
break;
|
|
11826
|
-
}
|
|
11827
|
-
case "nanoid": {
|
|
11828
|
-
addPattern3(res, zodPatterns3.nanoid, check.message, refs);
|
|
11829
|
-
}
|
|
11830
|
-
}
|
|
11831
|
-
}
|
|
11832
|
-
}
|
|
11833
|
-
return res;
|
|
11834
|
-
}
|
|
11835
|
-
function escapeLiteralCheckValue3(literal7, refs) {
|
|
11836
|
-
return refs.patternStrategy === "escape" ? escapeNonAlphaNumeric3(literal7) : literal7;
|
|
11837
|
-
}
|
|
11838
|
-
var ALPHA_NUMERIC3 = new Set(
|
|
11839
|
-
"ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789"
|
|
11840
|
-
);
|
|
11841
|
-
function escapeNonAlphaNumeric3(source) {
|
|
11842
|
-
let result = "";
|
|
11843
|
-
for (let i = 0; i < source.length; i++) {
|
|
11844
|
-
if (!ALPHA_NUMERIC3.has(source[i])) {
|
|
11845
|
-
result += "\\";
|
|
11846
|
-
}
|
|
11847
|
-
result += source[i];
|
|
11848
|
-
}
|
|
11849
|
-
return result;
|
|
11850
|
-
}
|
|
11851
|
-
function addFormat3(schema, value, message, refs) {
|
|
11852
|
-
var _a21;
|
|
11853
|
-
if (schema.format || ((_a21 = schema.anyOf) == null ? void 0 : _a21.some((x) => x.format))) {
|
|
11854
|
-
if (!schema.anyOf) {
|
|
11855
|
-
schema.anyOf = [];
|
|
11856
|
-
}
|
|
11857
|
-
if (schema.format) {
|
|
11858
|
-
schema.anyOf.push({
|
|
11859
|
-
format: schema.format
|
|
11860
|
-
});
|
|
11861
|
-
delete schema.format;
|
|
11862
|
-
}
|
|
11863
|
-
schema.anyOf.push({
|
|
11864
|
-
format: value,
|
|
11865
|
-
...message && refs.errorMessages && { errorMessage: { format: message } }
|
|
11866
|
-
});
|
|
11867
|
-
} else {
|
|
11868
|
-
schema.format = value;
|
|
11869
|
-
}
|
|
11870
|
-
}
|
|
11871
|
-
function addPattern3(schema, regex, message, refs) {
|
|
11872
|
-
var _a21;
|
|
11873
|
-
if (schema.pattern || ((_a21 = schema.allOf) == null ? void 0 : _a21.some((x) => x.pattern))) {
|
|
11874
|
-
if (!schema.allOf) {
|
|
11875
|
-
schema.allOf = [];
|
|
11876
|
-
}
|
|
11877
|
-
if (schema.pattern) {
|
|
11878
|
-
schema.allOf.push({
|
|
11879
|
-
pattern: schema.pattern
|
|
11880
|
-
});
|
|
11881
|
-
delete schema.pattern;
|
|
11882
|
-
}
|
|
11883
|
-
schema.allOf.push({
|
|
11884
|
-
pattern: stringifyRegExpWithFlags3(regex, refs),
|
|
11885
|
-
...message && refs.errorMessages && { errorMessage: { pattern: message } }
|
|
11886
|
-
});
|
|
11887
|
-
} else {
|
|
11888
|
-
schema.pattern = stringifyRegExpWithFlags3(regex, refs);
|
|
11889
|
-
}
|
|
11890
|
-
}
|
|
11891
|
-
function stringifyRegExpWithFlags3(regex, refs) {
|
|
11892
|
-
var _a21;
|
|
11893
|
-
if (!refs.applyRegexFlags || !regex.flags) {
|
|
11894
|
-
return regex.source;
|
|
11895
|
-
}
|
|
11896
|
-
const flags = {
|
|
11897
|
-
i: regex.flags.includes("i"),
|
|
11898
|
-
// Case-insensitive
|
|
11899
|
-
m: regex.flags.includes("m"),
|
|
11900
|
-
// `^` and `$` matches adjacent to newline characters
|
|
11901
|
-
s: regex.flags.includes("s")
|
|
11902
|
-
// `.` matches newlines
|
|
11903
|
-
};
|
|
11904
|
-
const source = flags.i ? regex.source.toLowerCase() : regex.source;
|
|
11905
|
-
let pattern = "";
|
|
11906
|
-
let isEscaped = false;
|
|
11907
|
-
let inCharGroup = false;
|
|
11908
|
-
let inCharRange = false;
|
|
11909
|
-
for (let i = 0; i < source.length; i++) {
|
|
11910
|
-
if (isEscaped) {
|
|
11911
|
-
pattern += source[i];
|
|
11912
|
-
isEscaped = false;
|
|
11913
|
-
continue;
|
|
11914
|
-
}
|
|
11915
|
-
if (flags.i) {
|
|
11916
|
-
if (inCharGroup) {
|
|
11917
|
-
if (source[i].match(/[a-z]/)) {
|
|
11918
|
-
if (inCharRange) {
|
|
11919
|
-
pattern += source[i];
|
|
11920
|
-
pattern += `${source[i - 2]}-${source[i]}`.toUpperCase();
|
|
11921
|
-
inCharRange = false;
|
|
11922
|
-
} else if (source[i + 1] === "-" && ((_a21 = source[i + 2]) == null ? void 0 : _a21.match(/[a-z]/))) {
|
|
11923
|
-
pattern += source[i];
|
|
11924
|
-
inCharRange = true;
|
|
11925
|
-
} else {
|
|
11926
|
-
pattern += `${source[i]}${source[i].toUpperCase()}`;
|
|
11927
|
-
}
|
|
11928
|
-
continue;
|
|
11929
|
-
}
|
|
11930
|
-
} else if (source[i].match(/[a-z]/)) {
|
|
11931
|
-
pattern += `[${source[i]}${source[i].toUpperCase()}]`;
|
|
11932
|
-
continue;
|
|
11933
|
-
}
|
|
11934
|
-
}
|
|
11935
|
-
if (flags.m) {
|
|
11936
|
-
if (source[i] === "^") {
|
|
11937
|
-
pattern += `(^|(?<=[\r
|
|
11938
|
-
]))`;
|
|
11939
|
-
continue;
|
|
11940
|
-
} else if (source[i] === "$") {
|
|
11941
|
-
pattern += `($|(?=[\r
|
|
11942
|
-
]))`;
|
|
11943
|
-
continue;
|
|
11944
|
-
}
|
|
11945
|
-
}
|
|
11946
|
-
if (flags.s && source[i] === ".") {
|
|
11947
|
-
pattern += inCharGroup ? `${source[i]}\r
|
|
11948
|
-
` : `[${source[i]}\r
|
|
11949
|
-
]`;
|
|
11950
|
-
continue;
|
|
11951
|
-
}
|
|
11952
|
-
pattern += source[i];
|
|
11953
|
-
if (source[i] === "\\") {
|
|
11954
|
-
isEscaped = true;
|
|
11955
|
-
} else if (inCharGroup && source[i] === "]") {
|
|
11956
|
-
inCharGroup = false;
|
|
11957
|
-
} else if (!inCharGroup && source[i] === "[") {
|
|
11958
|
-
inCharGroup = true;
|
|
11959
|
-
}
|
|
11960
|
-
}
|
|
11961
|
-
return pattern;
|
|
11962
|
-
}
|
|
11963
|
-
function parseRecordDef3(def, refs) {
|
|
11964
|
-
var _a21, _b8, _c, _d, _e, _f;
|
|
11965
|
-
const schema = {
|
|
11966
|
-
type: "object",
|
|
11967
|
-
additionalProperties: (_a21 = parseDef3(def.valueType._def, {
|
|
11968
|
-
...refs,
|
|
11969
|
-
currentPath: [...refs.currentPath, "additionalProperties"]
|
|
11970
|
-
})) != null ? _a21 : refs.allowedAdditionalProperties
|
|
11971
|
-
};
|
|
11972
|
-
if (((_b8 = def.keyType) == null ? void 0 : _b8._def.typeName) === ZodFirstPartyTypeKind$1.ZodString && ((_c = def.keyType._def.checks) == null ? void 0 : _c.length)) {
|
|
11973
|
-
const { type, ...keyType } = parseStringDef3(def.keyType._def, refs);
|
|
11974
|
-
return {
|
|
11975
|
-
...schema,
|
|
11976
|
-
propertyNames: keyType
|
|
11977
|
-
};
|
|
11978
|
-
} else if (((_d = def.keyType) == null ? void 0 : _d._def.typeName) === ZodFirstPartyTypeKind$1.ZodEnum) {
|
|
11979
|
-
return {
|
|
11980
|
-
...schema,
|
|
11981
|
-
propertyNames: {
|
|
11982
|
-
enum: def.keyType._def.values
|
|
11983
|
-
}
|
|
11984
|
-
};
|
|
11985
|
-
} else if (((_e = def.keyType) == null ? void 0 : _e._def.typeName) === ZodFirstPartyTypeKind$1.ZodBranded && def.keyType._def.type._def.typeName === ZodFirstPartyTypeKind$1.ZodString && ((_f = def.keyType._def.type._def.checks) == null ? void 0 : _f.length)) {
|
|
11986
|
-
const { type, ...keyType } = parseBrandedDef3(
|
|
11987
|
-
def.keyType._def,
|
|
11988
|
-
refs
|
|
11989
|
-
);
|
|
11990
|
-
return {
|
|
11991
|
-
...schema,
|
|
11992
|
-
propertyNames: keyType
|
|
11993
|
-
};
|
|
11994
|
-
}
|
|
11995
|
-
return schema;
|
|
11996
|
-
}
|
|
11997
|
-
function parseMapDef3(def, refs) {
|
|
11998
|
-
if (refs.mapStrategy === "record") {
|
|
11999
|
-
return parseRecordDef3(def, refs);
|
|
12000
|
-
}
|
|
12001
|
-
const keys = parseDef3(def.keyType._def, {
|
|
12002
|
-
...refs,
|
|
12003
|
-
currentPath: [...refs.currentPath, "items", "items", "0"]
|
|
12004
|
-
}) || parseAnyDef3();
|
|
12005
|
-
const values = parseDef3(def.valueType._def, {
|
|
12006
|
-
...refs,
|
|
12007
|
-
currentPath: [...refs.currentPath, "items", "items", "1"]
|
|
12008
|
-
}) || parseAnyDef3();
|
|
12009
|
-
return {
|
|
12010
|
-
type: "array",
|
|
12011
|
-
maxItems: 125,
|
|
12012
|
-
items: {
|
|
12013
|
-
type: "array",
|
|
12014
|
-
items: [keys, values],
|
|
12015
|
-
minItems: 2,
|
|
12016
|
-
maxItems: 2
|
|
12017
|
-
}
|
|
12018
|
-
};
|
|
12019
|
-
}
|
|
12020
|
-
function parseNativeEnumDef3(def) {
|
|
12021
|
-
const object8 = def.values;
|
|
12022
|
-
const actualKeys = Object.keys(def.values).filter((key) => {
|
|
12023
|
-
return typeof object8[object8[key]] !== "number";
|
|
12024
|
-
});
|
|
12025
|
-
const actualValues = actualKeys.map((key) => object8[key]);
|
|
12026
|
-
const parsedTypes = Array.from(
|
|
12027
|
-
new Set(actualValues.map((values) => typeof values))
|
|
12028
|
-
);
|
|
12029
|
-
return {
|
|
12030
|
-
type: parsedTypes.length === 1 ? parsedTypes[0] === "string" ? "string" : "number" : ["string", "number"],
|
|
12031
|
-
enum: actualValues
|
|
12032
|
-
};
|
|
12033
|
-
}
|
|
12034
|
-
function parseNeverDef3() {
|
|
12035
|
-
return { not: parseAnyDef3() };
|
|
12036
|
-
}
|
|
12037
|
-
function parseNullDef3() {
|
|
12038
|
-
return {
|
|
12039
|
-
type: "null"
|
|
12040
|
-
};
|
|
12041
|
-
}
|
|
12042
|
-
var primitiveMappings3 = {
|
|
12043
|
-
ZodString: "string",
|
|
12044
|
-
ZodNumber: "number",
|
|
12045
|
-
ZodBigInt: "integer",
|
|
12046
|
-
ZodBoolean: "boolean",
|
|
12047
|
-
ZodNull: "null"
|
|
12048
|
-
};
|
|
12049
|
-
function parseUnionDef3(def, refs) {
|
|
12050
|
-
const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;
|
|
12051
|
-
if (options.every(
|
|
12052
|
-
(x) => x._def.typeName in primitiveMappings3 && (!x._def.checks || !x._def.checks.length)
|
|
12053
|
-
)) {
|
|
12054
|
-
const types = options.reduce((types2, x) => {
|
|
12055
|
-
const type = primitiveMappings3[x._def.typeName];
|
|
12056
|
-
return type && !types2.includes(type) ? [...types2, type] : types2;
|
|
12057
|
-
}, []);
|
|
12058
|
-
return {
|
|
12059
|
-
type: types.length > 1 ? types : types[0]
|
|
12060
|
-
};
|
|
12061
|
-
} else if (options.every((x) => x._def.typeName === "ZodLiteral" && !x.description)) {
|
|
12062
|
-
const types = options.reduce(
|
|
12063
|
-
(acc, x) => {
|
|
12064
|
-
const type = typeof x._def.value;
|
|
12065
|
-
switch (type) {
|
|
12066
|
-
case "string":
|
|
12067
|
-
case "number":
|
|
12068
|
-
case "boolean":
|
|
12069
|
-
return [...acc, type];
|
|
12070
|
-
case "bigint":
|
|
12071
|
-
return [...acc, "integer"];
|
|
12072
|
-
case "object":
|
|
12073
|
-
if (x._def.value === null) return [...acc, "null"];
|
|
12074
|
-
case "symbol":
|
|
12075
|
-
case "undefined":
|
|
12076
|
-
case "function":
|
|
12077
|
-
default:
|
|
12078
|
-
return acc;
|
|
12079
|
-
}
|
|
12080
|
-
},
|
|
12081
|
-
[]
|
|
12082
|
-
);
|
|
12083
|
-
if (types.length === options.length) {
|
|
12084
|
-
const uniqueTypes = types.filter((x, i, a) => a.indexOf(x) === i);
|
|
12085
|
-
return {
|
|
12086
|
-
type: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0],
|
|
12087
|
-
enum: options.reduce(
|
|
12088
|
-
(acc, x) => {
|
|
12089
|
-
return acc.includes(x._def.value) ? acc : [...acc, x._def.value];
|
|
12090
|
-
},
|
|
12091
|
-
[]
|
|
12092
|
-
)
|
|
12093
|
-
};
|
|
12094
|
-
}
|
|
12095
|
-
} else if (options.every((x) => x._def.typeName === "ZodEnum")) {
|
|
12096
|
-
return {
|
|
12097
|
-
type: "string",
|
|
12098
|
-
enum: options.reduce(
|
|
12099
|
-
(acc, x) => [
|
|
12100
|
-
...acc,
|
|
12101
|
-
...x._def.values.filter((x2) => !acc.includes(x2))
|
|
12102
|
-
],
|
|
12103
|
-
[]
|
|
12104
|
-
)
|
|
12105
|
-
};
|
|
12106
|
-
}
|
|
12107
|
-
return asAnyOf3(def, refs);
|
|
12108
|
-
}
|
|
12109
|
-
var asAnyOf3 = (def, refs) => {
|
|
12110
|
-
const anyOf = (def.options instanceof Map ? Array.from(def.options.values()) : def.options).map(
|
|
12111
|
-
(x, i) => parseDef3(x._def, {
|
|
12112
|
-
...refs,
|
|
12113
|
-
currentPath: [...refs.currentPath, "anyOf", `${i}`]
|
|
12114
|
-
})
|
|
12115
|
-
).filter(
|
|
12116
|
-
(x) => !!x && (!refs.strictUnions || typeof x === "object" && Object.keys(x).length > 0)
|
|
12117
|
-
);
|
|
12118
|
-
return anyOf.length ? { anyOf } : void 0;
|
|
12119
|
-
};
|
|
12120
|
-
function parseNullableDef3(def, refs) {
|
|
12121
|
-
if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(
|
|
12122
|
-
def.innerType._def.typeName
|
|
12123
|
-
) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
|
|
12124
|
-
return {
|
|
12125
|
-
type: [
|
|
12126
|
-
primitiveMappings3[def.innerType._def.typeName],
|
|
12127
|
-
"null"
|
|
12128
|
-
]
|
|
12129
|
-
};
|
|
12130
|
-
}
|
|
12131
|
-
const base = parseDef3(def.innerType._def, {
|
|
12132
|
-
...refs,
|
|
12133
|
-
currentPath: [...refs.currentPath, "anyOf", "0"]
|
|
12134
|
-
});
|
|
12135
|
-
return base && { anyOf: [base, { type: "null" }] };
|
|
12136
|
-
}
|
|
12137
|
-
function parseNumberDef3(def) {
|
|
12138
|
-
const res = {
|
|
12139
|
-
type: "number"
|
|
12140
|
-
};
|
|
12141
|
-
if (!def.checks) return res;
|
|
12142
|
-
for (const check of def.checks) {
|
|
12143
|
-
switch (check.kind) {
|
|
12144
|
-
case "int":
|
|
12145
|
-
res.type = "integer";
|
|
12146
|
-
break;
|
|
12147
|
-
case "min":
|
|
12148
|
-
if (check.inclusive) {
|
|
12149
|
-
res.minimum = check.value;
|
|
12150
|
-
} else {
|
|
12151
|
-
res.exclusiveMinimum = check.value;
|
|
12152
|
-
}
|
|
12153
|
-
break;
|
|
12154
|
-
case "max":
|
|
12155
|
-
if (check.inclusive) {
|
|
12156
|
-
res.maximum = check.value;
|
|
12157
|
-
} else {
|
|
12158
|
-
res.exclusiveMaximum = check.value;
|
|
12159
|
-
}
|
|
12160
|
-
break;
|
|
12161
|
-
case "multipleOf":
|
|
12162
|
-
res.multipleOf = check.value;
|
|
12163
|
-
break;
|
|
12164
|
-
}
|
|
12165
|
-
}
|
|
12166
|
-
return res;
|
|
12167
|
-
}
|
|
12168
|
-
function parseObjectDef3(def, refs) {
|
|
12169
|
-
const result = {
|
|
12170
|
-
type: "object",
|
|
12171
|
-
properties: {}
|
|
12172
|
-
};
|
|
12173
|
-
const required = [];
|
|
12174
|
-
const shape = def.shape();
|
|
12175
|
-
for (const propName in shape) {
|
|
12176
|
-
let propDef = shape[propName];
|
|
12177
|
-
if (propDef === void 0 || propDef._def === void 0) {
|
|
12178
|
-
continue;
|
|
12179
|
-
}
|
|
12180
|
-
const propOptional = safeIsOptional3(propDef);
|
|
12181
|
-
const parsedDef = parseDef3(propDef._def, {
|
|
12182
|
-
...refs,
|
|
12183
|
-
currentPath: [...refs.currentPath, "properties", propName],
|
|
12184
|
-
propertyPath: [...refs.currentPath, "properties", propName]
|
|
12185
|
-
});
|
|
12186
|
-
if (parsedDef === void 0) {
|
|
12187
|
-
continue;
|
|
12188
|
-
}
|
|
12189
|
-
result.properties[propName] = parsedDef;
|
|
12190
|
-
if (!propOptional) {
|
|
12191
|
-
required.push(propName);
|
|
12192
|
-
}
|
|
12193
|
-
}
|
|
12194
|
-
if (required.length) {
|
|
12195
|
-
result.required = required;
|
|
12196
|
-
}
|
|
12197
|
-
const additionalProperties = decideAdditionalProperties3(def, refs);
|
|
12198
|
-
if (additionalProperties !== void 0) {
|
|
12199
|
-
result.additionalProperties = additionalProperties;
|
|
12200
|
-
}
|
|
12201
|
-
return result;
|
|
12202
|
-
}
|
|
12203
|
-
function decideAdditionalProperties3(def, refs) {
|
|
12204
|
-
if (def.catchall._def.typeName !== "ZodNever") {
|
|
12205
|
-
return parseDef3(def.catchall._def, {
|
|
12206
|
-
...refs,
|
|
12207
|
-
currentPath: [...refs.currentPath, "additionalProperties"]
|
|
12208
|
-
});
|
|
12209
|
-
}
|
|
12210
|
-
switch (def.unknownKeys) {
|
|
12211
|
-
case "passthrough":
|
|
12212
|
-
return refs.allowedAdditionalProperties;
|
|
12213
|
-
case "strict":
|
|
12214
|
-
return refs.rejectedAdditionalProperties;
|
|
12215
|
-
case "strip":
|
|
12216
|
-
return refs.removeAdditionalStrategy === "strict" ? refs.allowedAdditionalProperties : refs.rejectedAdditionalProperties;
|
|
12217
|
-
}
|
|
12218
|
-
}
|
|
12219
|
-
function safeIsOptional3(schema) {
|
|
12220
|
-
try {
|
|
12221
|
-
return schema.isOptional();
|
|
12222
|
-
} catch (e2) {
|
|
12223
|
-
return true;
|
|
12224
|
-
}
|
|
12225
|
-
}
|
|
12226
|
-
var parseOptionalDef3 = (def, refs) => {
|
|
12227
|
-
var _a21;
|
|
12228
|
-
if (refs.currentPath.toString() === ((_a21 = refs.propertyPath) == null ? void 0 : _a21.toString())) {
|
|
12229
|
-
return parseDef3(def.innerType._def, refs);
|
|
12230
|
-
}
|
|
12231
|
-
const innerSchema = parseDef3(def.innerType._def, {
|
|
12232
|
-
...refs,
|
|
12233
|
-
currentPath: [...refs.currentPath, "anyOf", "1"]
|
|
12234
|
-
});
|
|
12235
|
-
return innerSchema ? { anyOf: [{ not: parseAnyDef3() }, innerSchema] } : parseAnyDef3();
|
|
12236
|
-
};
|
|
12237
|
-
var parsePipelineDef3 = (def, refs) => {
|
|
12238
|
-
if (refs.pipeStrategy === "input") {
|
|
12239
|
-
return parseDef3(def.in._def, refs);
|
|
12240
|
-
} else if (refs.pipeStrategy === "output") {
|
|
12241
|
-
return parseDef3(def.out._def, refs);
|
|
12242
|
-
}
|
|
12243
|
-
const a = parseDef3(def.in._def, {
|
|
12244
|
-
...refs,
|
|
12245
|
-
currentPath: [...refs.currentPath, "allOf", "0"]
|
|
12246
|
-
});
|
|
12247
|
-
const b = parseDef3(def.out._def, {
|
|
12248
|
-
...refs,
|
|
12249
|
-
currentPath: [...refs.currentPath, "allOf", a ? "1" : "0"]
|
|
12250
|
-
});
|
|
12251
|
-
return {
|
|
12252
|
-
allOf: [a, b].filter((x) => x !== void 0)
|
|
12253
|
-
};
|
|
12254
|
-
};
|
|
12255
|
-
function parsePromiseDef3(def, refs) {
|
|
12256
|
-
return parseDef3(def.type._def, refs);
|
|
12257
|
-
}
|
|
12258
|
-
function parseSetDef3(def, refs) {
|
|
12259
|
-
const items = parseDef3(def.valueType._def, {
|
|
12260
|
-
...refs,
|
|
12261
|
-
currentPath: [...refs.currentPath, "items"]
|
|
12262
|
-
});
|
|
12263
|
-
const schema = {
|
|
12264
|
-
type: "array",
|
|
12265
|
-
uniqueItems: true,
|
|
12266
|
-
items
|
|
12267
|
-
};
|
|
12268
|
-
if (def.minSize) {
|
|
12269
|
-
schema.minItems = def.minSize.value;
|
|
12270
|
-
}
|
|
12271
|
-
if (def.maxSize) {
|
|
12272
|
-
schema.maxItems = def.maxSize.value;
|
|
12273
|
-
}
|
|
12274
|
-
return schema;
|
|
12275
|
-
}
|
|
12276
|
-
function parseTupleDef3(def, refs) {
|
|
12277
|
-
if (def.rest) {
|
|
12278
|
-
return {
|
|
12279
|
-
type: "array",
|
|
12280
|
-
minItems: def.items.length,
|
|
12281
|
-
items: def.items.map(
|
|
12282
|
-
(x, i) => parseDef3(x._def, {
|
|
12283
|
-
...refs,
|
|
12284
|
-
currentPath: [...refs.currentPath, "items", `${i}`]
|
|
12285
|
-
})
|
|
12286
|
-
).reduce(
|
|
12287
|
-
(acc, x) => x === void 0 ? acc : [...acc, x],
|
|
12288
|
-
[]
|
|
12289
|
-
),
|
|
12290
|
-
additionalItems: parseDef3(def.rest._def, {
|
|
12291
|
-
...refs,
|
|
12292
|
-
currentPath: [...refs.currentPath, "additionalItems"]
|
|
12293
|
-
})
|
|
12294
|
-
};
|
|
12295
|
-
} else {
|
|
12296
|
-
return {
|
|
12297
|
-
type: "array",
|
|
12298
|
-
minItems: def.items.length,
|
|
12299
|
-
maxItems: def.items.length,
|
|
12300
|
-
items: def.items.map(
|
|
12301
|
-
(x, i) => parseDef3(x._def, {
|
|
12302
|
-
...refs,
|
|
12303
|
-
currentPath: [...refs.currentPath, "items", `${i}`]
|
|
12304
|
-
})
|
|
12305
|
-
).reduce(
|
|
12306
|
-
(acc, x) => x === void 0 ? acc : [...acc, x],
|
|
12307
|
-
[]
|
|
12308
|
-
)
|
|
12309
|
-
};
|
|
12310
|
-
}
|
|
12311
|
-
}
|
|
12312
|
-
function parseUndefinedDef3() {
|
|
12313
|
-
return {
|
|
12314
|
-
not: parseAnyDef3()
|
|
12315
|
-
};
|
|
12316
|
-
}
|
|
12317
|
-
function parseUnknownDef3() {
|
|
12318
|
-
return parseAnyDef3();
|
|
12319
|
-
}
|
|
12320
|
-
var parseReadonlyDef3 = (def, refs) => {
|
|
12321
|
-
return parseDef3(def.innerType._def, refs);
|
|
12322
|
-
};
|
|
12323
|
-
var selectParser3 = (def, typeName, refs) => {
|
|
12324
|
-
switch (typeName) {
|
|
12325
|
-
case ZodFirstPartyTypeKind$1.ZodString:
|
|
12326
|
-
return parseStringDef3(def, refs);
|
|
12327
|
-
case ZodFirstPartyTypeKind$1.ZodNumber:
|
|
12328
|
-
return parseNumberDef3(def);
|
|
12329
|
-
case ZodFirstPartyTypeKind$1.ZodObject:
|
|
12330
|
-
return parseObjectDef3(def, refs);
|
|
12331
|
-
case ZodFirstPartyTypeKind$1.ZodBigInt:
|
|
12332
|
-
return parseBigintDef3(def);
|
|
12333
|
-
case ZodFirstPartyTypeKind$1.ZodBoolean:
|
|
12334
|
-
return parseBooleanDef3();
|
|
12335
|
-
case ZodFirstPartyTypeKind$1.ZodDate:
|
|
12336
|
-
return parseDateDef3(def, refs);
|
|
12337
|
-
case ZodFirstPartyTypeKind$1.ZodUndefined:
|
|
12338
|
-
return parseUndefinedDef3();
|
|
12339
|
-
case ZodFirstPartyTypeKind$1.ZodNull:
|
|
12340
|
-
return parseNullDef3();
|
|
12341
|
-
case ZodFirstPartyTypeKind$1.ZodArray:
|
|
12342
|
-
return parseArrayDef3(def, refs);
|
|
12343
|
-
case ZodFirstPartyTypeKind$1.ZodUnion:
|
|
12344
|
-
case ZodFirstPartyTypeKind$1.ZodDiscriminatedUnion:
|
|
12345
|
-
return parseUnionDef3(def, refs);
|
|
12346
|
-
case ZodFirstPartyTypeKind$1.ZodIntersection:
|
|
12347
|
-
return parseIntersectionDef3(def, refs);
|
|
12348
|
-
case ZodFirstPartyTypeKind$1.ZodTuple:
|
|
12349
|
-
return parseTupleDef3(def, refs);
|
|
12350
|
-
case ZodFirstPartyTypeKind$1.ZodRecord:
|
|
12351
|
-
return parseRecordDef3(def, refs);
|
|
12352
|
-
case ZodFirstPartyTypeKind$1.ZodLiteral:
|
|
12353
|
-
return parseLiteralDef3(def);
|
|
12354
|
-
case ZodFirstPartyTypeKind$1.ZodEnum:
|
|
12355
|
-
return parseEnumDef3(def);
|
|
12356
|
-
case ZodFirstPartyTypeKind$1.ZodNativeEnum:
|
|
12357
|
-
return parseNativeEnumDef3(def);
|
|
12358
|
-
case ZodFirstPartyTypeKind$1.ZodNullable:
|
|
12359
|
-
return parseNullableDef3(def, refs);
|
|
12360
|
-
case ZodFirstPartyTypeKind$1.ZodOptional:
|
|
12361
|
-
return parseOptionalDef3(def, refs);
|
|
12362
|
-
case ZodFirstPartyTypeKind$1.ZodMap:
|
|
12363
|
-
return parseMapDef3(def, refs);
|
|
12364
|
-
case ZodFirstPartyTypeKind$1.ZodSet:
|
|
12365
|
-
return parseSetDef3(def, refs);
|
|
12366
|
-
case ZodFirstPartyTypeKind$1.ZodLazy:
|
|
12367
|
-
return () => def.getter()._def;
|
|
12368
|
-
case ZodFirstPartyTypeKind$1.ZodPromise:
|
|
12369
|
-
return parsePromiseDef3(def, refs);
|
|
12370
|
-
case ZodFirstPartyTypeKind$1.ZodNaN:
|
|
12371
|
-
case ZodFirstPartyTypeKind$1.ZodNever:
|
|
12372
|
-
return parseNeverDef3();
|
|
12373
|
-
case ZodFirstPartyTypeKind$1.ZodEffects:
|
|
12374
|
-
return parseEffectsDef3(def, refs);
|
|
12375
|
-
case ZodFirstPartyTypeKind$1.ZodAny:
|
|
12376
|
-
return parseAnyDef3();
|
|
12377
|
-
case ZodFirstPartyTypeKind$1.ZodUnknown:
|
|
12378
|
-
return parseUnknownDef3();
|
|
12379
|
-
case ZodFirstPartyTypeKind$1.ZodDefault:
|
|
12380
|
-
return parseDefaultDef3(def, refs);
|
|
12381
|
-
case ZodFirstPartyTypeKind$1.ZodBranded:
|
|
12382
|
-
return parseBrandedDef3(def, refs);
|
|
12383
|
-
case ZodFirstPartyTypeKind$1.ZodReadonly:
|
|
12384
|
-
return parseReadonlyDef3(def, refs);
|
|
12385
|
-
case ZodFirstPartyTypeKind$1.ZodCatch:
|
|
12386
|
-
return parseCatchDef3(def, refs);
|
|
12387
|
-
case ZodFirstPartyTypeKind$1.ZodPipeline:
|
|
12388
|
-
return parsePipelineDef3(def, refs);
|
|
12389
|
-
case ZodFirstPartyTypeKind$1.ZodFunction:
|
|
12390
|
-
case ZodFirstPartyTypeKind$1.ZodVoid:
|
|
12391
|
-
case ZodFirstPartyTypeKind$1.ZodSymbol:
|
|
12392
|
-
return void 0;
|
|
12393
|
-
default:
|
|
12394
|
-
return /* @__PURE__ */ ((_) => void 0)();
|
|
12395
|
-
}
|
|
12396
|
-
};
|
|
12397
|
-
function parseDef3(def, refs, forceResolution = false) {
|
|
12398
|
-
var _a21;
|
|
12399
|
-
const seenItem = refs.seen.get(def);
|
|
12400
|
-
if (refs.override) {
|
|
12401
|
-
const overrideResult = (_a21 = refs.override) == null ? void 0 : _a21.call(
|
|
12402
|
-
refs,
|
|
12403
|
-
def,
|
|
12404
|
-
refs,
|
|
12405
|
-
seenItem,
|
|
12406
|
-
forceResolution
|
|
12407
|
-
);
|
|
12408
|
-
if (overrideResult !== ignoreOverride3) {
|
|
12409
|
-
return overrideResult;
|
|
12410
|
-
}
|
|
12411
|
-
}
|
|
12412
|
-
if (seenItem && !forceResolution) {
|
|
12413
|
-
const seenSchema = get$ref3(seenItem, refs);
|
|
12414
|
-
if (seenSchema !== void 0) {
|
|
12415
|
-
return seenSchema;
|
|
12416
|
-
}
|
|
12417
|
-
}
|
|
12418
|
-
const newItem = { def, path: refs.currentPath, jsonSchema: void 0 };
|
|
12419
|
-
refs.seen.set(def, newItem);
|
|
12420
|
-
const jsonSchemaOrGetter = selectParser3(def, def.typeName, refs);
|
|
12421
|
-
const jsonSchema22 = typeof jsonSchemaOrGetter === "function" ? parseDef3(jsonSchemaOrGetter(), refs) : jsonSchemaOrGetter;
|
|
12422
|
-
if (jsonSchema22) {
|
|
12423
|
-
addMeta3(def, refs, jsonSchema22);
|
|
12424
|
-
}
|
|
12425
|
-
if (refs.postProcess) {
|
|
12426
|
-
const postProcessResult = refs.postProcess(jsonSchema22, def, refs);
|
|
12427
|
-
newItem.jsonSchema = jsonSchema22;
|
|
12428
|
-
return postProcessResult;
|
|
12429
|
-
}
|
|
12430
|
-
newItem.jsonSchema = jsonSchema22;
|
|
12431
|
-
return jsonSchema22;
|
|
12432
|
-
}
|
|
12433
|
-
var get$ref3 = (item, refs) => {
|
|
12434
|
-
switch (refs.$refStrategy) {
|
|
12435
|
-
case "root":
|
|
12436
|
-
return { $ref: item.path.join("/") };
|
|
12437
|
-
case "relative":
|
|
12438
|
-
return { $ref: getRelativePath3(refs.currentPath, item.path) };
|
|
12439
|
-
case "none":
|
|
12440
|
-
case "seen": {
|
|
12441
|
-
if (item.path.length < refs.currentPath.length && item.path.every((value, index) => refs.currentPath[index] === value)) {
|
|
12442
|
-
console.warn(
|
|
12443
|
-
`Recursive reference detected at ${refs.currentPath.join(
|
|
12444
|
-
"/"
|
|
12445
|
-
)}! Defaulting to any`
|
|
12446
|
-
);
|
|
12447
|
-
return parseAnyDef3();
|
|
12448
|
-
}
|
|
12449
|
-
return refs.$refStrategy === "seen" ? parseAnyDef3() : void 0;
|
|
12450
|
-
}
|
|
12451
|
-
}
|
|
12452
|
-
};
|
|
12453
|
-
var addMeta3 = (def, refs, jsonSchema22) => {
|
|
12454
|
-
if (def.description) {
|
|
12455
|
-
jsonSchema22.description = def.description;
|
|
12456
|
-
}
|
|
12457
|
-
return jsonSchema22;
|
|
12458
|
-
};
|
|
12459
|
-
var getRefs3 = (options) => {
|
|
12460
|
-
const _options = getDefaultOptions3(options);
|
|
12461
|
-
const currentPath = _options.name !== void 0 ? [..._options.basePath, _options.definitionPath, _options.name] : _options.basePath;
|
|
12462
|
-
return {
|
|
12463
|
-
..._options,
|
|
12464
|
-
currentPath,
|
|
12465
|
-
propertyPath: void 0,
|
|
12466
|
-
seen: new Map(
|
|
12467
|
-
Object.entries(_options.definitions).map(([name21, def]) => [
|
|
12468
|
-
def._def,
|
|
12469
|
-
{
|
|
12470
|
-
def: def._def,
|
|
12471
|
-
path: [..._options.basePath, _options.definitionPath, name21],
|
|
12472
|
-
// Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now.
|
|
12473
|
-
jsonSchema: void 0
|
|
12474
|
-
}
|
|
12475
|
-
])
|
|
12476
|
-
)
|
|
12477
|
-
};
|
|
12478
|
-
};
|
|
12479
|
-
var zodToJsonSchema4 = (schema, options) => {
|
|
12480
|
-
var _a21;
|
|
12481
|
-
const refs = getRefs3(options);
|
|
12482
|
-
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce(
|
|
12483
|
-
(acc, [name26, schema2]) => {
|
|
12484
|
-
var _a26;
|
|
12485
|
-
return {
|
|
12486
|
-
...acc,
|
|
12487
|
-
[name26]: (_a26 = parseDef3(
|
|
12488
|
-
schema2._def,
|
|
12489
|
-
{
|
|
12490
|
-
...refs,
|
|
12491
|
-
currentPath: [...refs.basePath, refs.definitionPath, name26]
|
|
12492
|
-
},
|
|
12493
|
-
true
|
|
12494
|
-
)) != null ? _a26 : parseAnyDef3()
|
|
12495
|
-
};
|
|
12496
|
-
},
|
|
12497
|
-
{}
|
|
12498
|
-
) : void 0;
|
|
12499
|
-
const name21 = typeof options === "string" ? options : (options == null ? void 0 : options.nameStrategy) === "title" ? void 0 : options == null ? void 0 : options.name;
|
|
12500
|
-
const main = (_a21 = parseDef3(
|
|
12501
|
-
schema._def,
|
|
12502
|
-
name21 === void 0 ? refs : {
|
|
12503
|
-
...refs,
|
|
12504
|
-
currentPath: [...refs.basePath, refs.definitionPath, name21]
|
|
12505
|
-
},
|
|
12506
|
-
false
|
|
12507
|
-
)) != null ? _a21 : parseAnyDef3();
|
|
12508
|
-
const title = typeof options === "object" && options.name !== void 0 && options.nameStrategy === "title" ? options.name : void 0;
|
|
12509
|
-
if (title !== void 0) {
|
|
12510
|
-
main.title = title;
|
|
12511
|
-
}
|
|
12512
|
-
const combined = name21 === void 0 ? definitions ? {
|
|
12513
|
-
...main,
|
|
12514
|
-
[refs.definitionPath]: definitions
|
|
12515
|
-
} : main : {
|
|
12516
|
-
$ref: [
|
|
12517
|
-
...refs.$refStrategy === "relative" ? [] : refs.basePath,
|
|
12518
|
-
refs.definitionPath,
|
|
12519
|
-
name21
|
|
12520
|
-
].join("/"),
|
|
12521
|
-
[refs.definitionPath]: {
|
|
12522
|
-
...definitions,
|
|
12523
|
-
[name21]: main
|
|
12524
|
-
}
|
|
12525
|
-
};
|
|
12526
|
-
combined.$schema = "http://json-schema.org/draft-07/schema#";
|
|
12527
|
-
return combined;
|
|
12528
|
-
};
|
|
12529
|
-
var zod_to_json_schema_default2 = zodToJsonSchema4;
|
|
12530
|
-
function zod3Schema2(zodSchema22, options) {
|
|
12531
|
-
var _a21;
|
|
12532
|
-
const useReferences = (_a21 = void 0 ) != null ? _a21 : false;
|
|
12533
|
-
return jsonSchema3(
|
|
12534
|
-
// defer json schema creation to avoid unnecessary computation when only validation is needed
|
|
12535
|
-
() => zod_to_json_schema_default2(zodSchema22, {
|
|
12536
|
-
$refStrategy: useReferences ? "root" : "none"
|
|
12537
|
-
}),
|
|
12538
|
-
{
|
|
12539
|
-
validate: async (value) => {
|
|
12540
|
-
const result = await zodSchema22.safeParseAsync(value);
|
|
12541
|
-
return result.success ? { success: true, value: result.data } : { success: false, error: result.error };
|
|
12542
|
-
}
|
|
12543
|
-
}
|
|
12544
|
-
);
|
|
12545
|
-
}
|
|
12546
|
-
function zod4Schema2(zodSchema22, options) {
|
|
12547
|
-
var _a21;
|
|
12548
|
-
const useReferences = (_a21 = void 0 ) != null ? _a21 : false;
|
|
12549
|
-
return jsonSchema3(
|
|
12550
|
-
// defer json schema creation to avoid unnecessary computation when only validation is needed
|
|
12551
|
-
() => z104.toJSONSchema(zodSchema22, {
|
|
12552
|
-
target: "draft-7",
|
|
12553
|
-
io: "output",
|
|
12554
|
-
reused: useReferences ? "ref" : "inline"
|
|
12555
|
-
}),
|
|
12556
|
-
{
|
|
12557
|
-
validate: async (value) => {
|
|
12558
|
-
const result = await z104.safeParseAsync(zodSchema22, value);
|
|
12559
|
-
return result.success ? { success: true, value: result.data } : { success: false, error: result.error };
|
|
12560
|
-
}
|
|
12561
|
-
}
|
|
12562
|
-
);
|
|
12563
|
-
}
|
|
12564
|
-
function isZod4Schema2(zodSchema22) {
|
|
12565
|
-
return "_zod" in zodSchema22;
|
|
12566
|
-
}
|
|
12567
|
-
function zodSchema3(zodSchema22, options) {
|
|
12568
|
-
if (isZod4Schema2(zodSchema22)) {
|
|
12569
|
-
return zod4Schema2(zodSchema22);
|
|
12570
|
-
} else {
|
|
12571
|
-
return zod3Schema2(zodSchema22);
|
|
12572
|
-
}
|
|
12573
|
-
}
|
|
12574
|
-
var schemaSymbol3 = Symbol.for("vercel.ai.schema");
|
|
12575
|
-
function jsonSchema3(jsonSchema22, {
|
|
12576
|
-
validate
|
|
12577
|
-
} = {}) {
|
|
12578
|
-
return {
|
|
12579
|
-
[schemaSymbol3]: true,
|
|
12580
|
-
_type: void 0,
|
|
12581
|
-
// should never be used directly
|
|
12582
|
-
[validatorSymbol3]: true,
|
|
12583
|
-
get jsonSchema() {
|
|
12584
|
-
if (typeof jsonSchema22 === "function") {
|
|
12585
|
-
jsonSchema22 = jsonSchema22();
|
|
12586
|
-
}
|
|
12587
|
-
return jsonSchema22;
|
|
12588
|
-
},
|
|
12589
|
-
validate
|
|
12590
|
-
};
|
|
12591
|
-
}
|
|
12592
|
-
function isSchema3(value) {
|
|
12593
|
-
return typeof value === "object" && value !== null && schemaSymbol3 in value && value[schemaSymbol3] === true && "jsonSchema" in value && "validate" in value;
|
|
12594
|
-
}
|
|
12595
|
-
function asSchema3(schema) {
|
|
12596
|
-
return schema == null ? jsonSchema3({
|
|
12597
|
-
properties: {},
|
|
12598
|
-
additionalProperties: false
|
|
12599
|
-
}) : isSchema3(schema) ? schema : typeof schema === "function" ? schema() : zodSchema3(schema);
|
|
12600
|
-
}
|
|
12601
|
-
var __defProp4 = Object.defineProperty;
|
|
12602
|
-
var __export4 = (target, all) => {
|
|
12603
|
-
for (var name172 in all)
|
|
12604
|
-
__defProp4(target, name172, { get: all[name172], enumerable: true });
|
|
12605
|
-
};
|
|
12606
|
-
var name74 = "AI_NoObjectGeneratedError";
|
|
12607
|
-
var marker75 = `vercel.ai.error.${name74}`;
|
|
12608
|
-
var symbol75 = Symbol.for(marker75);
|
|
12609
|
-
var _a75;
|
|
12610
|
-
var NoObjectGeneratedError3 = class extends AISDKError2 {
|
|
12611
|
-
constructor({
|
|
12612
|
-
message = "No object generated.",
|
|
12613
|
-
cause,
|
|
12614
|
-
text: text22,
|
|
12615
|
-
response,
|
|
12616
|
-
usage,
|
|
12617
|
-
finishReason
|
|
12618
|
-
}) {
|
|
12619
|
-
super({ name: name74, message, cause });
|
|
12620
|
-
this[_a75] = true;
|
|
12621
|
-
this.text = text22;
|
|
12622
|
-
this.response = response;
|
|
12623
|
-
this.usage = usage;
|
|
12624
|
-
this.finishReason = finishReason;
|
|
12625
|
-
}
|
|
12626
|
-
static isInstance(error) {
|
|
12627
|
-
return AISDKError2.hasMarker(error, marker75);
|
|
12628
|
-
}
|
|
12629
|
-
};
|
|
12630
|
-
_a75 = symbol75;
|
|
12631
|
-
var dataContentSchema3 = z104.union([
|
|
12632
|
-
z104.string(),
|
|
12633
|
-
z104.instanceof(Uint8Array),
|
|
12634
|
-
z104.instanceof(ArrayBuffer),
|
|
12635
|
-
z104.custom(
|
|
12636
|
-
// Buffer might not be available in some environments such as CloudFlare:
|
|
12637
|
-
(value) => {
|
|
12638
|
-
var _a172, _b8;
|
|
12639
|
-
return (_b8 = (_a172 = globalThis.Buffer) == null ? void 0 : _a172.isBuffer(value)) != null ? _b8 : false;
|
|
12640
|
-
},
|
|
12641
|
-
{ message: "Must be a Buffer" }
|
|
12642
|
-
)
|
|
12643
|
-
]);
|
|
12644
|
-
var jsonValueSchema3 = z104.lazy(
|
|
12645
|
-
() => z104.union([
|
|
12646
|
-
z104.null(),
|
|
12647
|
-
z104.string(),
|
|
12648
|
-
z104.number(),
|
|
12649
|
-
z104.boolean(),
|
|
12650
|
-
z104.record(z104.string(), jsonValueSchema3),
|
|
12651
|
-
z104.array(jsonValueSchema3)
|
|
12652
|
-
])
|
|
12653
|
-
);
|
|
12654
|
-
var providerMetadataSchema3 = z104.record(
|
|
12655
|
-
z104.string(),
|
|
12656
|
-
z104.record(z104.string(), jsonValueSchema3)
|
|
12657
|
-
);
|
|
12658
|
-
var textPartSchema3 = z104.object({
|
|
12659
|
-
type: z104.literal("text"),
|
|
12660
|
-
text: z104.string(),
|
|
12661
|
-
providerOptions: providerMetadataSchema3.optional()
|
|
12662
|
-
});
|
|
12663
|
-
var imagePartSchema3 = z104.object({
|
|
12664
|
-
type: z104.literal("image"),
|
|
12665
|
-
image: z104.union([dataContentSchema3, z104.instanceof(URL)]),
|
|
12666
|
-
mediaType: z104.string().optional(),
|
|
12667
|
-
providerOptions: providerMetadataSchema3.optional()
|
|
12668
|
-
});
|
|
12669
|
-
var filePartSchema3 = z104.object({
|
|
12670
|
-
type: z104.literal("file"),
|
|
12671
|
-
data: z104.union([dataContentSchema3, z104.instanceof(URL)]),
|
|
12672
|
-
filename: z104.string().optional(),
|
|
12673
|
-
mediaType: z104.string(),
|
|
12674
|
-
providerOptions: providerMetadataSchema3.optional()
|
|
12675
|
-
});
|
|
12676
|
-
var reasoningPartSchema3 = z104.object({
|
|
12677
|
-
type: z104.literal("reasoning"),
|
|
12678
|
-
text: z104.string(),
|
|
12679
|
-
providerOptions: providerMetadataSchema3.optional()
|
|
12680
|
-
});
|
|
12681
|
-
var toolCallPartSchema3 = z104.object({
|
|
12682
|
-
type: z104.literal("tool-call"),
|
|
12683
|
-
toolCallId: z104.string(),
|
|
12684
|
-
toolName: z104.string(),
|
|
12685
|
-
input: z104.unknown(),
|
|
12686
|
-
providerOptions: providerMetadataSchema3.optional(),
|
|
12687
|
-
providerExecuted: z104.boolean().optional()
|
|
12688
|
-
});
|
|
12689
|
-
var outputSchema2 = z104.discriminatedUnion("type", [
|
|
12690
|
-
z104.object({
|
|
12691
|
-
type: z104.literal("text"),
|
|
12692
|
-
value: z104.string()
|
|
12693
|
-
}),
|
|
12694
|
-
z104.object({
|
|
12695
|
-
type: z104.literal("json"),
|
|
12696
|
-
value: jsonValueSchema3
|
|
12697
|
-
}),
|
|
12698
|
-
z104.object({
|
|
12699
|
-
type: z104.literal("error-text"),
|
|
12700
|
-
value: z104.string()
|
|
12701
|
-
}),
|
|
12702
|
-
z104.object({
|
|
12703
|
-
type: z104.literal("error-json"),
|
|
12704
|
-
value: jsonValueSchema3
|
|
12705
|
-
}),
|
|
12706
|
-
z104.object({
|
|
12707
|
-
type: z104.literal("content"),
|
|
12708
|
-
value: z104.array(
|
|
12709
|
-
z104.union([
|
|
12710
|
-
z104.object({
|
|
12711
|
-
type: z104.literal("text"),
|
|
12712
|
-
text: z104.string()
|
|
12713
|
-
}),
|
|
12714
|
-
z104.object({
|
|
12715
|
-
type: z104.literal("media"),
|
|
12716
|
-
data: z104.string(),
|
|
12717
|
-
mediaType: z104.string()
|
|
12718
|
-
})
|
|
12719
|
-
])
|
|
12720
|
-
)
|
|
12721
|
-
})
|
|
12722
|
-
]);
|
|
12723
|
-
var toolResultPartSchema3 = z104.object({
|
|
12724
|
-
type: z104.literal("tool-result"),
|
|
12725
|
-
toolCallId: z104.string(),
|
|
12726
|
-
toolName: z104.string(),
|
|
12727
|
-
output: outputSchema2,
|
|
12728
|
-
providerOptions: providerMetadataSchema3.optional()
|
|
12729
|
-
});
|
|
12730
|
-
var systemModelMessageSchema2 = z104.object(
|
|
12731
|
-
{
|
|
12732
|
-
role: z104.literal("system"),
|
|
12733
|
-
content: z104.string(),
|
|
12734
|
-
providerOptions: providerMetadataSchema3.optional()
|
|
12735
|
-
}
|
|
12736
|
-
);
|
|
12737
|
-
var userModelMessageSchema2 = z104.object({
|
|
12738
|
-
role: z104.literal("user"),
|
|
12739
|
-
content: z104.union([
|
|
12740
|
-
z104.string(),
|
|
12741
|
-
z104.array(z104.union([textPartSchema3, imagePartSchema3, filePartSchema3]))
|
|
12742
|
-
]),
|
|
12743
|
-
providerOptions: providerMetadataSchema3.optional()
|
|
12744
|
-
});
|
|
12745
|
-
var assistantModelMessageSchema2 = z104.object({
|
|
12746
|
-
role: z104.literal("assistant"),
|
|
12747
|
-
content: z104.union([
|
|
12748
|
-
z104.string(),
|
|
12749
|
-
z104.array(
|
|
12750
|
-
z104.union([
|
|
12751
|
-
textPartSchema3,
|
|
12752
|
-
filePartSchema3,
|
|
12753
|
-
reasoningPartSchema3,
|
|
12754
|
-
toolCallPartSchema3,
|
|
12755
|
-
toolResultPartSchema3
|
|
12756
|
-
])
|
|
12757
|
-
)
|
|
12758
|
-
]),
|
|
12759
|
-
providerOptions: providerMetadataSchema3.optional()
|
|
12760
|
-
});
|
|
12761
|
-
var toolModelMessageSchema2 = z104.object({
|
|
12762
|
-
role: z104.literal("tool"),
|
|
12763
|
-
content: z104.array(toolResultPartSchema3),
|
|
12764
|
-
providerOptions: providerMetadataSchema3.optional()
|
|
12765
|
-
});
|
|
12766
|
-
z104.union([
|
|
12767
|
-
systemModelMessageSchema2,
|
|
12768
|
-
userModelMessageSchema2,
|
|
12769
|
-
assistantModelMessageSchema2,
|
|
12770
|
-
toolModelMessageSchema2
|
|
12771
|
-
]);
|
|
12772
|
-
function stepCountIs(stepCount) {
|
|
12773
|
-
return ({ steps }) => steps.length === stepCount;
|
|
12774
|
-
}
|
|
12775
|
-
createIdGenerator3({
|
|
12776
|
-
prefix: "aitxt",
|
|
12777
|
-
size: 24
|
|
12778
|
-
});
|
|
12779
|
-
function fixJson3(input) {
|
|
12780
|
-
const stack = ["ROOT"];
|
|
12781
|
-
let lastValidIndex = -1;
|
|
12782
|
-
let literalStart = null;
|
|
12783
|
-
function processValueStart(char, i, swapState) {
|
|
12784
|
-
{
|
|
12785
|
-
switch (char) {
|
|
12786
|
-
case '"': {
|
|
12787
|
-
lastValidIndex = i;
|
|
12788
|
-
stack.pop();
|
|
12789
|
-
stack.push(swapState);
|
|
12790
|
-
stack.push("INSIDE_STRING");
|
|
12791
|
-
break;
|
|
12792
|
-
}
|
|
12793
|
-
case "f":
|
|
12794
|
-
case "t":
|
|
12795
|
-
case "n": {
|
|
12796
|
-
lastValidIndex = i;
|
|
12797
|
-
literalStart = i;
|
|
12798
|
-
stack.pop();
|
|
12799
|
-
stack.push(swapState);
|
|
12800
|
-
stack.push("INSIDE_LITERAL");
|
|
12801
|
-
break;
|
|
12802
|
-
}
|
|
12803
|
-
case "-": {
|
|
12804
|
-
stack.pop();
|
|
12805
|
-
stack.push(swapState);
|
|
12806
|
-
stack.push("INSIDE_NUMBER");
|
|
12807
|
-
break;
|
|
12808
|
-
}
|
|
12809
|
-
case "0":
|
|
12810
|
-
case "1":
|
|
12811
|
-
case "2":
|
|
12812
|
-
case "3":
|
|
12813
|
-
case "4":
|
|
12814
|
-
case "5":
|
|
12815
|
-
case "6":
|
|
12816
|
-
case "7":
|
|
12817
|
-
case "8":
|
|
12818
|
-
case "9": {
|
|
12819
|
-
lastValidIndex = i;
|
|
12820
|
-
stack.pop();
|
|
12821
|
-
stack.push(swapState);
|
|
12822
|
-
stack.push("INSIDE_NUMBER");
|
|
12823
|
-
break;
|
|
12824
|
-
}
|
|
12825
|
-
case "{": {
|
|
12826
|
-
lastValidIndex = i;
|
|
12827
|
-
stack.pop();
|
|
12828
|
-
stack.push(swapState);
|
|
12829
|
-
stack.push("INSIDE_OBJECT_START");
|
|
12830
|
-
break;
|
|
12831
|
-
}
|
|
12832
|
-
case "[": {
|
|
12833
|
-
lastValidIndex = i;
|
|
12834
|
-
stack.pop();
|
|
12835
|
-
stack.push(swapState);
|
|
12836
|
-
stack.push("INSIDE_ARRAY_START");
|
|
12837
|
-
break;
|
|
12838
|
-
}
|
|
12839
|
-
}
|
|
12840
|
-
}
|
|
12841
|
-
}
|
|
12842
|
-
function processAfterObjectValue(char, i) {
|
|
12843
|
-
switch (char) {
|
|
12844
|
-
case ",": {
|
|
12845
|
-
stack.pop();
|
|
12846
|
-
stack.push("INSIDE_OBJECT_AFTER_COMMA");
|
|
12847
|
-
break;
|
|
12848
|
-
}
|
|
12849
|
-
case "}": {
|
|
12850
|
-
lastValidIndex = i;
|
|
12851
|
-
stack.pop();
|
|
12852
|
-
break;
|
|
12853
|
-
}
|
|
12854
|
-
}
|
|
12855
|
-
}
|
|
12856
|
-
function processAfterArrayValue(char, i) {
|
|
12857
|
-
switch (char) {
|
|
12858
|
-
case ",": {
|
|
12859
|
-
stack.pop();
|
|
12860
|
-
stack.push("INSIDE_ARRAY_AFTER_COMMA");
|
|
12861
|
-
break;
|
|
12862
|
-
}
|
|
12863
|
-
case "]": {
|
|
12864
|
-
lastValidIndex = i;
|
|
12865
|
-
stack.pop();
|
|
12866
|
-
break;
|
|
12867
|
-
}
|
|
12868
|
-
}
|
|
12869
|
-
}
|
|
12870
|
-
for (let i = 0; i < input.length; i++) {
|
|
12871
|
-
const char = input[i];
|
|
12872
|
-
const currentState = stack[stack.length - 1];
|
|
12873
|
-
switch (currentState) {
|
|
12874
|
-
case "ROOT":
|
|
12875
|
-
processValueStart(char, i, "FINISH");
|
|
12876
|
-
break;
|
|
12877
|
-
case "INSIDE_OBJECT_START": {
|
|
12878
|
-
switch (char) {
|
|
12879
|
-
case '"': {
|
|
12880
|
-
stack.pop();
|
|
12881
|
-
stack.push("INSIDE_OBJECT_KEY");
|
|
12882
|
-
break;
|
|
12883
|
-
}
|
|
12884
|
-
case "}": {
|
|
12885
|
-
lastValidIndex = i;
|
|
12886
|
-
stack.pop();
|
|
12887
|
-
break;
|
|
12888
|
-
}
|
|
12889
|
-
}
|
|
12890
|
-
break;
|
|
12891
|
-
}
|
|
12892
|
-
case "INSIDE_OBJECT_AFTER_COMMA": {
|
|
12893
|
-
switch (char) {
|
|
12894
|
-
case '"': {
|
|
12895
|
-
stack.pop();
|
|
12896
|
-
stack.push("INSIDE_OBJECT_KEY");
|
|
12897
|
-
break;
|
|
12898
|
-
}
|
|
12899
|
-
}
|
|
12900
|
-
break;
|
|
12901
|
-
}
|
|
12902
|
-
case "INSIDE_OBJECT_KEY": {
|
|
12903
|
-
switch (char) {
|
|
12904
|
-
case '"': {
|
|
12905
|
-
stack.pop();
|
|
12906
|
-
stack.push("INSIDE_OBJECT_AFTER_KEY");
|
|
12907
|
-
break;
|
|
12908
|
-
}
|
|
12909
|
-
}
|
|
12910
|
-
break;
|
|
12911
|
-
}
|
|
12912
|
-
case "INSIDE_OBJECT_AFTER_KEY": {
|
|
12913
|
-
switch (char) {
|
|
12914
|
-
case ":": {
|
|
12915
|
-
stack.pop();
|
|
12916
|
-
stack.push("INSIDE_OBJECT_BEFORE_VALUE");
|
|
12917
|
-
break;
|
|
12918
|
-
}
|
|
12919
|
-
}
|
|
12920
|
-
break;
|
|
12921
|
-
}
|
|
12922
|
-
case "INSIDE_OBJECT_BEFORE_VALUE": {
|
|
12923
|
-
processValueStart(char, i, "INSIDE_OBJECT_AFTER_VALUE");
|
|
12924
|
-
break;
|
|
12925
|
-
}
|
|
12926
|
-
case "INSIDE_OBJECT_AFTER_VALUE": {
|
|
12927
|
-
processAfterObjectValue(char, i);
|
|
12928
|
-
break;
|
|
12929
|
-
}
|
|
12930
|
-
case "INSIDE_STRING": {
|
|
12931
|
-
switch (char) {
|
|
12932
|
-
case '"': {
|
|
12933
|
-
stack.pop();
|
|
12934
|
-
lastValidIndex = i;
|
|
12935
|
-
break;
|
|
12936
|
-
}
|
|
12937
|
-
case "\\": {
|
|
12938
|
-
stack.push("INSIDE_STRING_ESCAPE");
|
|
12939
|
-
break;
|
|
12940
|
-
}
|
|
12941
|
-
default: {
|
|
12942
|
-
lastValidIndex = i;
|
|
12943
|
-
}
|
|
12944
|
-
}
|
|
12945
|
-
break;
|
|
12946
|
-
}
|
|
12947
|
-
case "INSIDE_ARRAY_START": {
|
|
12948
|
-
switch (char) {
|
|
12949
|
-
case "]": {
|
|
12950
|
-
lastValidIndex = i;
|
|
12951
|
-
stack.pop();
|
|
12952
|
-
break;
|
|
12953
|
-
}
|
|
12954
|
-
default: {
|
|
12955
|
-
lastValidIndex = i;
|
|
12956
|
-
processValueStart(char, i, "INSIDE_ARRAY_AFTER_VALUE");
|
|
12957
|
-
break;
|
|
12958
|
-
}
|
|
12959
|
-
}
|
|
12960
|
-
break;
|
|
12961
|
-
}
|
|
12962
|
-
case "INSIDE_ARRAY_AFTER_VALUE": {
|
|
12963
|
-
switch (char) {
|
|
12964
|
-
case ",": {
|
|
12965
|
-
stack.pop();
|
|
12966
|
-
stack.push("INSIDE_ARRAY_AFTER_COMMA");
|
|
12967
|
-
break;
|
|
12968
|
-
}
|
|
12969
|
-
case "]": {
|
|
12970
|
-
lastValidIndex = i;
|
|
12971
|
-
stack.pop();
|
|
12972
|
-
break;
|
|
12973
|
-
}
|
|
12974
|
-
default: {
|
|
12975
|
-
lastValidIndex = i;
|
|
12976
|
-
break;
|
|
12977
|
-
}
|
|
12978
|
-
}
|
|
12979
|
-
break;
|
|
12980
|
-
}
|
|
12981
|
-
case "INSIDE_ARRAY_AFTER_COMMA": {
|
|
12982
|
-
processValueStart(char, i, "INSIDE_ARRAY_AFTER_VALUE");
|
|
12983
|
-
break;
|
|
12984
|
-
}
|
|
12985
|
-
case "INSIDE_STRING_ESCAPE": {
|
|
12986
|
-
stack.pop();
|
|
12987
|
-
lastValidIndex = i;
|
|
12988
|
-
break;
|
|
12989
|
-
}
|
|
12990
|
-
case "INSIDE_NUMBER": {
|
|
12991
|
-
switch (char) {
|
|
12992
|
-
case "0":
|
|
12993
|
-
case "1":
|
|
12994
|
-
case "2":
|
|
12995
|
-
case "3":
|
|
12996
|
-
case "4":
|
|
12997
|
-
case "5":
|
|
12998
|
-
case "6":
|
|
12999
|
-
case "7":
|
|
13000
|
-
case "8":
|
|
13001
|
-
case "9": {
|
|
13002
|
-
lastValidIndex = i;
|
|
13003
|
-
break;
|
|
13004
|
-
}
|
|
13005
|
-
case "e":
|
|
13006
|
-
case "E":
|
|
13007
|
-
case "-":
|
|
13008
|
-
case ".": {
|
|
13009
|
-
break;
|
|
13010
|
-
}
|
|
13011
|
-
case ",": {
|
|
13012
|
-
stack.pop();
|
|
13013
|
-
if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") {
|
|
13014
|
-
processAfterArrayValue(char, i);
|
|
13015
|
-
}
|
|
13016
|
-
if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") {
|
|
13017
|
-
processAfterObjectValue(char, i);
|
|
13018
|
-
}
|
|
13019
|
-
break;
|
|
13020
|
-
}
|
|
13021
|
-
case "}": {
|
|
13022
|
-
stack.pop();
|
|
13023
|
-
if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") {
|
|
13024
|
-
processAfterObjectValue(char, i);
|
|
13025
|
-
}
|
|
13026
|
-
break;
|
|
13027
|
-
}
|
|
13028
|
-
case "]": {
|
|
13029
|
-
stack.pop();
|
|
13030
|
-
if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") {
|
|
13031
|
-
processAfterArrayValue(char, i);
|
|
13032
|
-
}
|
|
13033
|
-
break;
|
|
13034
|
-
}
|
|
13035
|
-
default: {
|
|
13036
|
-
stack.pop();
|
|
13037
|
-
break;
|
|
13038
|
-
}
|
|
13039
|
-
}
|
|
13040
|
-
break;
|
|
13041
|
-
}
|
|
13042
|
-
case "INSIDE_LITERAL": {
|
|
13043
|
-
const partialLiteral = input.substring(literalStart, i + 1);
|
|
13044
|
-
if (!"false".startsWith(partialLiteral) && !"true".startsWith(partialLiteral) && !"null".startsWith(partialLiteral)) {
|
|
13045
|
-
stack.pop();
|
|
13046
|
-
if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") {
|
|
13047
|
-
processAfterObjectValue(char, i);
|
|
13048
|
-
} else if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") {
|
|
13049
|
-
processAfterArrayValue(char, i);
|
|
13050
|
-
}
|
|
13051
|
-
} else {
|
|
13052
|
-
lastValidIndex = i;
|
|
13053
|
-
}
|
|
13054
|
-
break;
|
|
13055
|
-
}
|
|
13056
|
-
}
|
|
13057
|
-
}
|
|
13058
|
-
let result = input.slice(0, lastValidIndex + 1);
|
|
13059
|
-
for (let i = stack.length - 1; i >= 0; i--) {
|
|
13060
|
-
const state = stack[i];
|
|
13061
|
-
switch (state) {
|
|
13062
|
-
case "INSIDE_STRING": {
|
|
13063
|
-
result += '"';
|
|
13064
|
-
break;
|
|
13065
|
-
}
|
|
13066
|
-
case "INSIDE_OBJECT_KEY":
|
|
13067
|
-
case "INSIDE_OBJECT_AFTER_KEY":
|
|
13068
|
-
case "INSIDE_OBJECT_AFTER_COMMA":
|
|
13069
|
-
case "INSIDE_OBJECT_START":
|
|
13070
|
-
case "INSIDE_OBJECT_BEFORE_VALUE":
|
|
13071
|
-
case "INSIDE_OBJECT_AFTER_VALUE": {
|
|
13072
|
-
result += "}";
|
|
13073
|
-
break;
|
|
13074
|
-
}
|
|
13075
|
-
case "INSIDE_ARRAY_START":
|
|
13076
|
-
case "INSIDE_ARRAY_AFTER_COMMA":
|
|
13077
|
-
case "INSIDE_ARRAY_AFTER_VALUE": {
|
|
13078
|
-
result += "]";
|
|
13079
|
-
break;
|
|
13080
|
-
}
|
|
13081
|
-
case "INSIDE_LITERAL": {
|
|
13082
|
-
const partialLiteral = input.substring(literalStart, input.length);
|
|
13083
|
-
if ("true".startsWith(partialLiteral)) {
|
|
13084
|
-
result += "true".slice(partialLiteral.length);
|
|
13085
|
-
} else if ("false".startsWith(partialLiteral)) {
|
|
13086
|
-
result += "false".slice(partialLiteral.length);
|
|
13087
|
-
} else if ("null".startsWith(partialLiteral)) {
|
|
13088
|
-
result += "null".slice(partialLiteral.length);
|
|
13089
|
-
}
|
|
13090
|
-
}
|
|
13091
|
-
}
|
|
13092
|
-
}
|
|
13093
|
-
return result;
|
|
13094
|
-
}
|
|
13095
|
-
async function parsePartialJson3(jsonText) {
|
|
13096
|
-
if (jsonText === void 0) {
|
|
13097
|
-
return { value: void 0, state: "undefined-input" };
|
|
13098
|
-
}
|
|
13099
|
-
let result = await safeParseJSON3({ text: jsonText });
|
|
13100
|
-
if (result.success) {
|
|
13101
|
-
return { value: result.value, state: "successful-parse" };
|
|
13102
|
-
}
|
|
13103
|
-
result = await safeParseJSON3({ text: fixJson3(jsonText) });
|
|
13104
|
-
if (result.success) {
|
|
13105
|
-
return { value: result.value, state: "repaired-parse" };
|
|
13106
|
-
}
|
|
13107
|
-
return { value: void 0, state: "failed-parse" };
|
|
13108
|
-
}
|
|
13109
|
-
createIdGenerator3({
|
|
13110
|
-
prefix: "aitxt",
|
|
13111
|
-
size: 24
|
|
13112
|
-
});
|
|
13113
|
-
createIdGenerator3({ prefix: "aiobj", size: 24 });
|
|
13114
|
-
createIdGenerator3({ prefix: "aiobj", size: 24 });
|
|
13115
|
-
var output_exports3 = {};
|
|
13116
|
-
__export4(output_exports3, {
|
|
13117
|
-
object: () => object32,
|
|
13118
|
-
text: () => text3
|
|
13119
|
-
});
|
|
13120
|
-
var text3 = () => ({
|
|
13121
|
-
type: "text",
|
|
13122
|
-
responseFormat: { type: "text" },
|
|
13123
|
-
async parsePartial({ text: text22 }) {
|
|
13124
|
-
return { partial: text22 };
|
|
13125
|
-
},
|
|
13126
|
-
async parseOutput({ text: text22 }) {
|
|
13127
|
-
return text22;
|
|
13128
|
-
}
|
|
13129
|
-
});
|
|
13130
|
-
var object32 = ({
|
|
13131
|
-
schema: inputSchema
|
|
13132
|
-
}) => {
|
|
13133
|
-
const schema = asSchema3(inputSchema);
|
|
13134
|
-
return {
|
|
13135
|
-
type: "object",
|
|
13136
|
-
responseFormat: {
|
|
13137
|
-
type: "json",
|
|
13138
|
-
schema: schema.jsonSchema
|
|
13139
|
-
},
|
|
13140
|
-
async parsePartial({ text: text22 }) {
|
|
13141
|
-
const result = await parsePartialJson3(text22);
|
|
13142
|
-
switch (result.state) {
|
|
13143
|
-
case "failed-parse":
|
|
13144
|
-
case "undefined-input":
|
|
13145
|
-
return void 0;
|
|
13146
|
-
case "repaired-parse":
|
|
13147
|
-
case "successful-parse":
|
|
13148
|
-
return {
|
|
13149
|
-
// Note: currently no validation of partial results:
|
|
13150
|
-
partial: result.value
|
|
13151
|
-
};
|
|
13152
|
-
default: {
|
|
13153
|
-
const _exhaustiveCheck = result.state;
|
|
13154
|
-
throw new Error(`Unsupported parse state: ${_exhaustiveCheck}`);
|
|
13155
|
-
}
|
|
13156
|
-
}
|
|
13157
|
-
},
|
|
13158
|
-
async parseOutput({ text: text22 }, context) {
|
|
13159
|
-
const parseResult = await safeParseJSON3({ text: text22 });
|
|
13160
|
-
if (!parseResult.success) {
|
|
13161
|
-
throw new NoObjectGeneratedError3({
|
|
13162
|
-
message: "No object generated: could not parse the response.",
|
|
13163
|
-
cause: parseResult.error,
|
|
13164
|
-
text: text22,
|
|
13165
|
-
response: context.response,
|
|
13166
|
-
usage: context.usage,
|
|
13167
|
-
finishReason: context.finishReason
|
|
13168
|
-
});
|
|
13169
|
-
}
|
|
13170
|
-
const validationResult = await safeValidateTypes3({
|
|
13171
|
-
value: parseResult.value,
|
|
13172
|
-
schema
|
|
13173
|
-
});
|
|
13174
|
-
if (!validationResult.success) {
|
|
13175
|
-
throw new NoObjectGeneratedError3({
|
|
13176
|
-
message: "No object generated: response did not match schema.",
|
|
13177
|
-
cause: validationResult.error,
|
|
13178
|
-
text: text22,
|
|
13179
|
-
response: context.response,
|
|
13180
|
-
usage: context.usage,
|
|
13181
|
-
finishReason: context.finishReason
|
|
13182
|
-
});
|
|
13183
|
-
}
|
|
13184
|
-
return validationResult.value;
|
|
13185
|
-
}
|
|
13186
|
-
};
|
|
13187
|
-
};
|
|
13188
|
-
var ClientOrServerImplementationSchema3 = z104.looseObject({
|
|
13189
|
-
name: z104.string(),
|
|
13190
|
-
version: z104.string()
|
|
13191
|
-
});
|
|
13192
|
-
var BaseParamsSchema3 = z104.looseObject({
|
|
13193
|
-
_meta: z104.optional(z104.object({}).loose())
|
|
13194
|
-
});
|
|
13195
|
-
var ResultSchema3 = BaseParamsSchema3;
|
|
13196
|
-
var RequestSchema3 = z104.object({
|
|
13197
|
-
method: z104.string(),
|
|
13198
|
-
params: z104.optional(BaseParamsSchema3)
|
|
13199
|
-
});
|
|
13200
|
-
var ServerCapabilitiesSchema3 = z104.looseObject({
|
|
13201
|
-
experimental: z104.optional(z104.object({}).loose()),
|
|
13202
|
-
logging: z104.optional(z104.object({}).loose()),
|
|
13203
|
-
prompts: z104.optional(
|
|
13204
|
-
z104.looseObject({
|
|
13205
|
-
listChanged: z104.optional(z104.boolean())
|
|
13206
|
-
})
|
|
13207
|
-
),
|
|
13208
|
-
resources: z104.optional(
|
|
13209
|
-
z104.looseObject({
|
|
13210
|
-
subscribe: z104.optional(z104.boolean()),
|
|
13211
|
-
listChanged: z104.optional(z104.boolean())
|
|
13212
|
-
})
|
|
13213
|
-
),
|
|
13214
|
-
tools: z104.optional(
|
|
13215
|
-
z104.looseObject({
|
|
13216
|
-
listChanged: z104.optional(z104.boolean())
|
|
13217
|
-
})
|
|
13218
|
-
)
|
|
13219
|
-
});
|
|
13220
|
-
ResultSchema3.extend({
|
|
13221
|
-
protocolVersion: z104.string(),
|
|
13222
|
-
capabilities: ServerCapabilitiesSchema3,
|
|
13223
|
-
serverInfo: ClientOrServerImplementationSchema3,
|
|
13224
|
-
instructions: z104.optional(z104.string())
|
|
13225
|
-
});
|
|
13226
|
-
var PaginatedResultSchema3 = ResultSchema3.extend({
|
|
13227
|
-
nextCursor: z104.optional(z104.string())
|
|
13228
|
-
});
|
|
13229
|
-
var ToolSchema3 = z104.object({
|
|
13230
|
-
name: z104.string(),
|
|
13231
|
-
description: z104.optional(z104.string()),
|
|
13232
|
-
inputSchema: z104.object({
|
|
13233
|
-
type: z104.literal("object"),
|
|
13234
|
-
properties: z104.optional(z104.object({}).loose())
|
|
13235
|
-
}).loose()
|
|
13236
|
-
}).loose();
|
|
13237
|
-
PaginatedResultSchema3.extend({
|
|
13238
|
-
tools: z104.array(ToolSchema3)
|
|
13239
|
-
});
|
|
13240
|
-
var TextContentSchema3 = z104.object({
|
|
13241
|
-
type: z104.literal("text"),
|
|
13242
|
-
text: z104.string()
|
|
13243
|
-
}).loose();
|
|
13244
|
-
var ImageContentSchema3 = z104.object({
|
|
13245
|
-
type: z104.literal("image"),
|
|
13246
|
-
data: z104.base64(),
|
|
13247
|
-
mimeType: z104.string()
|
|
13248
|
-
}).loose();
|
|
13249
|
-
var ResourceContentsSchema3 = z104.object({
|
|
13250
|
-
/**
|
|
13251
|
-
* The URI of this resource.
|
|
13252
|
-
*/
|
|
13253
|
-
uri: z104.string(),
|
|
13254
|
-
/**
|
|
13255
|
-
* The MIME type of this resource, if known.
|
|
13256
|
-
*/
|
|
13257
|
-
mimeType: z104.optional(z104.string())
|
|
13258
|
-
}).loose();
|
|
13259
|
-
var TextResourceContentsSchema3 = ResourceContentsSchema3.extend({
|
|
13260
|
-
text: z104.string()
|
|
13261
|
-
});
|
|
13262
|
-
var BlobResourceContentsSchema3 = ResourceContentsSchema3.extend({
|
|
13263
|
-
blob: z104.base64()
|
|
13264
|
-
});
|
|
13265
|
-
var EmbeddedResourceSchema3 = z104.object({
|
|
13266
|
-
type: z104.literal("resource"),
|
|
13267
|
-
resource: z104.union([TextResourceContentsSchema3, BlobResourceContentsSchema3])
|
|
13268
|
-
}).loose();
|
|
13269
|
-
ResultSchema3.extend({
|
|
13270
|
-
content: z104.array(
|
|
13271
|
-
z104.union([TextContentSchema3, ImageContentSchema3, EmbeddedResourceSchema3])
|
|
13272
|
-
),
|
|
13273
|
-
isError: z104.boolean().default(false).optional()
|
|
13274
|
-
}).or(
|
|
13275
|
-
ResultSchema3.extend({
|
|
13276
|
-
toolResult: z104.unknown()
|
|
13277
|
-
})
|
|
13278
|
-
);
|
|
13279
|
-
var JSONRPC_VERSION3 = "2.0";
|
|
13280
|
-
var JSONRPCRequestSchema3 = z104.object({
|
|
13281
|
-
jsonrpc: z104.literal(JSONRPC_VERSION3),
|
|
13282
|
-
id: z104.union([z104.string(), z104.number().int()])
|
|
13283
|
-
}).merge(RequestSchema3).strict();
|
|
13284
|
-
var JSONRPCResponseSchema3 = z104.object({
|
|
13285
|
-
jsonrpc: z104.literal(JSONRPC_VERSION3),
|
|
13286
|
-
id: z104.union([z104.string(), z104.number().int()]),
|
|
13287
|
-
result: ResultSchema3
|
|
13288
|
-
}).strict();
|
|
13289
|
-
var JSONRPCErrorSchema3 = z104.object({
|
|
13290
|
-
jsonrpc: z104.literal(JSONRPC_VERSION3),
|
|
13291
|
-
id: z104.union([z104.string(), z104.number().int()]),
|
|
13292
|
-
error: z104.object({
|
|
13293
|
-
code: z104.number().int(),
|
|
13294
|
-
message: z104.string(),
|
|
13295
|
-
data: z104.optional(z104.unknown())
|
|
13296
|
-
})
|
|
13297
|
-
}).strict();
|
|
13298
|
-
var JSONRPCNotificationSchema3 = z104.object({
|
|
13299
|
-
jsonrpc: z104.literal(JSONRPC_VERSION3)
|
|
13300
|
-
}).merge(
|
|
13301
|
-
z104.object({
|
|
13302
|
-
method: z104.string(),
|
|
13303
|
-
params: z104.optional(BaseParamsSchema3)
|
|
13304
|
-
})
|
|
13305
|
-
).strict();
|
|
13306
|
-
z104.union([
|
|
13307
|
-
JSONRPCRequestSchema3,
|
|
13308
|
-
JSONRPCNotificationSchema3,
|
|
13309
|
-
JSONRPCResponseSchema3,
|
|
13310
|
-
JSONRPCErrorSchema3
|
|
13311
|
-
]);
|
|
13312
|
-
|
|
13313
|
-
// ../agent-builder/dist/index.js
|
|
13314
11315
|
var UNIT_KINDS = ["mcp-server", "tool", "workflow", "agent", "integration", "network", "other"];
|
|
13315
11316
|
var TemplateUnitSchema = z.object({
|
|
13316
11317
|
kind: z.enum(UNIT_KINDS),
|
|
@@ -15483,14 +13484,14 @@ export const mastra = new Mastra({
|
|
|
15483
13484
|
noEmit: true
|
|
15484
13485
|
};
|
|
15485
13486
|
const host = {
|
|
15486
|
-
getSourceFile: (
|
|
13487
|
+
getSourceFile: (name20) => name20 === fileName ? sourceFile : void 0,
|
|
15487
13488
|
writeFile: () => {
|
|
15488
13489
|
},
|
|
15489
13490
|
getCurrentDirectory: () => "",
|
|
15490
13491
|
getDirectories: () => [],
|
|
15491
|
-
fileExists: (
|
|
15492
|
-
readFile: (
|
|
15493
|
-
getCanonicalFileName: (
|
|
13492
|
+
fileExists: (name20) => name20 === fileName,
|
|
13493
|
+
readFile: (name20) => name20 === fileName ? fileContent : void 0,
|
|
13494
|
+
getCanonicalFileName: (name20) => name20,
|
|
15494
13495
|
useCaseSensitiveFileNames: () => true,
|
|
15495
13496
|
getNewLine: () => "\n",
|
|
15496
13497
|
getDefaultLibFileName: () => "lib.d.ts"
|
|
@@ -16872,25 +14873,25 @@ var packageMergeStep = createStep({
|
|
|
16872
14873
|
const tplDevDeps = ensureObj(packageInfo.devDependencies);
|
|
16873
14874
|
const tplPeerDeps = ensureObj(packageInfo.peerDependencies);
|
|
16874
14875
|
const tplScripts = ensureObj(packageInfo.scripts);
|
|
16875
|
-
const existsAnywhere = (
|
|
16876
|
-
for (const [
|
|
16877
|
-
if (!existsAnywhere(
|
|
16878
|
-
targetPkg.dependencies[
|
|
14876
|
+
const existsAnywhere = (name20) => name20 in targetPkg.dependencies || name20 in targetPkg.devDependencies || name20 in targetPkg.peerDependencies;
|
|
14877
|
+
for (const [name20, ver] of Object.entries(tplDeps)) {
|
|
14878
|
+
if (!existsAnywhere(name20)) {
|
|
14879
|
+
targetPkg.dependencies[name20] = String(ver);
|
|
16879
14880
|
}
|
|
16880
14881
|
}
|
|
16881
|
-
for (const [
|
|
16882
|
-
if (!existsAnywhere(
|
|
16883
|
-
targetPkg.devDependencies[
|
|
14882
|
+
for (const [name20, ver] of Object.entries(tplDevDeps)) {
|
|
14883
|
+
if (!existsAnywhere(name20)) {
|
|
14884
|
+
targetPkg.devDependencies[name20] = String(ver);
|
|
16884
14885
|
}
|
|
16885
14886
|
}
|
|
16886
|
-
for (const [
|
|
16887
|
-
if (!(
|
|
16888
|
-
targetPkg.peerDependencies[
|
|
14887
|
+
for (const [name20, ver] of Object.entries(tplPeerDeps)) {
|
|
14888
|
+
if (!(name20 in targetPkg.peerDependencies)) {
|
|
14889
|
+
targetPkg.peerDependencies[name20] = String(ver);
|
|
16889
14890
|
}
|
|
16890
14891
|
}
|
|
16891
14892
|
const prefix = `template:${slug}:`;
|
|
16892
|
-
for (const [
|
|
16893
|
-
const newKey = `${prefix}${
|
|
14893
|
+
for (const [name20, cmd] of Object.entries(tplScripts)) {
|
|
14894
|
+
const newKey = `${prefix}${name20}`;
|
|
16894
14895
|
if (!(newKey in targetPkg.scripts)) {
|
|
16895
14896
|
targetPkg.scripts[newKey] = String(cmd);
|
|
16896
14897
|
}
|
|
@@ -16975,9 +14976,9 @@ var programmaticFileCopyStep = createStep({
|
|
|
16975
14976
|
return "unknown";
|
|
16976
14977
|
}
|
|
16977
14978
|
};
|
|
16978
|
-
const convertNaming = (
|
|
16979
|
-
const baseName = basename(
|
|
16980
|
-
const ext = extname(
|
|
14979
|
+
const convertNaming = (name20, convention) => {
|
|
14980
|
+
const baseName = basename(name20, extname(name20));
|
|
14981
|
+
const ext = extname(name20);
|
|
16981
14982
|
switch (convention) {
|
|
16982
14983
|
case "camelCase":
|
|
16983
14984
|
return baseName.replace(/[-_]/g, "").replace(/([A-Z])/g, (match, p1, offset) => offset === 0 ? p1.toLowerCase() : p1) + ext;
|
|
@@ -16988,7 +14989,7 @@ var programmaticFileCopyStep = createStep({
|
|
|
16988
14989
|
case "PascalCase":
|
|
16989
14990
|
return baseName.replace(/[-_]/g, "").replace(/^[a-z]/, (match) => match.toUpperCase()) + ext;
|
|
16990
14991
|
default:
|
|
16991
|
-
return
|
|
14992
|
+
return name20;
|
|
16992
14993
|
}
|
|
16993
14994
|
};
|
|
16994
14995
|
for (const unit of orderedUnits) {
|
|
@@ -19476,5 +17477,5 @@ var sendAgentBuilderActionRunEventHandler = createAgentBuilderWorkflowHandler(
|
|
|
19476
17477
|
);
|
|
19477
17478
|
|
|
19478
17479
|
export { agent_builder_exports, cancelAgentBuilderActionRunHandler, createAgentBuilderActionRunHandler, getAgentBuilderActionByIdHandler, getAgentBuilderActionRunByIdHandler, getAgentBuilderActionRunExecutionResultHandler, getAgentBuilderActionRunsHandler, getAgentBuilderActionsHandler, resumeAgentBuilderActionHandler, resumeAsyncAgentBuilderActionHandler, sendAgentBuilderActionRunEventHandler, startAgentBuilderActionRunHandler, startAsyncAgentBuilderActionHandler, streamAgentBuilderActionHandler, streamVNextAgentBuilderActionHandler, watchAgentBuilderActionHandler };
|
|
19479
|
-
//# sourceMappingURL=chunk-
|
|
19480
|
-
//# sourceMappingURL=chunk-
|
|
17480
|
+
//# sourceMappingURL=chunk-FWO7VQDC.js.map
|
|
17481
|
+
//# sourceMappingURL=chunk-FWO7VQDC.js.map
|