@xpert-ai/plugin-sdk 3.18.4 → 3.18.6
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 +51 -0
- package/README.md +44 -0
- package/data-workbench.cjs.default.js +1 -0
- package/data-workbench.cjs.js +518 -0
- package/data-workbench.cjs.mjs +2 -0
- package/data-workbench.d.ts +1 -0
- package/data-workbench.esm.js +512 -0
- package/index.cjs.js +3118 -33
- package/index.esm.js +3109 -39
- package/model-provider.cjs.js +9 -0
- package/model-provider.esm.js +8 -2
- package/package.json +33 -27
- package/src/data-workbench.d.ts +3 -0
- package/src/lib/ai-model/utils/tokenizer.d.ts +6 -0
- package/src/lib/core/runtime-capability.d.ts +4 -0
- package/src/lib/data/datasource/index.d.ts +3 -0
- package/src/lib/data/datasource/types.d.ts +2 -0
- package/src/lib/data/datasource/workbench-adapter.d.ts +39 -0
- package/src/lib/data/datasource/workbench-sql.d.ts +12 -0
- package/src/lib/data/datasource/workbench.d.ts +133 -0
- package/src/lib/mcp/resource-template.d.ts +2 -3
- package/src/lib/mcp/resource.d.ts +5 -1
- package/src/lib/rag/textsplitter/strategy.interface.d.ts +15 -4
- package/src/lib/rag/transformer/strategy.interface.d.ts +3 -0
- package/src/lib/runtime/capabilities/index.d.ts +1 -0
- package/src/lib/runtime/capabilities/knowledge-graph.d.ts +59 -0
- package/src/lib/runtime/capabilities/workspace-files.d.ts +2 -0
- package/src/lib/tool-provider/component.d.ts +2 -0
- package/src/lib/tool-provider/decorators.d.ts +1 -1
- package/src/lib/tool-provider/index.d.ts +3 -0
- package/src/lib/tool-provider/mcp-methods.d.ts +39 -0
- package/src/lib/tool-provider/provider-methods.d.ts +5 -0
- package/src/lib/tool-provider/tool-result.d.ts +1 -1
- package/src/lib/tool-provider/types.d.ts +12 -1
package/index.esm.js
CHANGED
|
@@ -4,19 +4,19 @@ import { pick } from 'lodash-es';
|
|
|
4
4
|
import { _ as _extends } from './_extends.esm.js';
|
|
5
5
|
import { DiscoveryService, Reflector } from '@nestjs/core';
|
|
6
6
|
import { Subject, filter } from 'rxjs';
|
|
7
|
-
import { LanguagesEnum, ParameterType, AiModelTypeEnum, PriceType, FetchFrom, ModelFeature, ModelPropertyKey, MCP_CAPABILITY_APPROVAL_MODES, MCP_TOOL_RISKS, MCP_TOOL_SIDE_EFFECTS, MCP_TOOL_IDEMPOTENCY,
|
|
7
|
+
import { LanguagesEnum, ParameterType, AiModelTypeEnum, PriceType, FetchFrom, ModelFeature, ModelPropertyKey, MCP_REQUIRED_CONTEXTS, MCP_CAPABILITY_APPROVAL_MODES, MCP_TOOL_RISKS, MCP_TOOL_SIDE_EFFECTS, MCP_TOOL_IDEMPOTENCY, MCP_CAPABILITY_VISIBILITIES, PLUGIN_COMPONENT_TYPE } from '@xpert-ai/contracts';
|
|
8
8
|
export { ASSISTANT_CHAT_SEND_MESSAGE_COMMAND, ASSISTANT_CONTEXT_SET_COMMAND } from '@xpert-ai/contracts';
|
|
9
9
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
10
10
|
import { ExtractJwt } from 'passport-jwt';
|
|
11
11
|
import { verify, JsonWebTokenError } from 'jsonwebtoken';
|
|
12
|
-
import { randomUUID } from 'node:crypto';
|
|
12
|
+
import { randomUUID, createHash } from 'node:crypto';
|
|
13
13
|
import { Command } from '@nestjs/cqrs';
|
|
14
14
|
import * as fs from 'fs';
|
|
15
15
|
import fs__default from 'fs';
|
|
16
16
|
import http from 'http';
|
|
17
17
|
import https from 'https';
|
|
18
|
-
import { c as createRuntimeCapability, B as BuiltinToolset } from './model-provider.esm.js';
|
|
19
|
-
export { A as ActorTokenRuntimeCapability, a as ActorTokenRuntimeFactoryCapability, b as ArtifactsRuntimeCapability, d as BaseTool, e as BaseToolset, D as DefaultAgentMiddlewareRuntimeCapabilityRegistry, D as DefaultRuntimeCapabilityRegistry, K as KnowledgeDocumentVisualAssetsRuntimeCapability, f as KnowledgeDocumentVisualAssetsRuntimeFactoryCapability, g as
|
|
18
|
+
import { c as createRuntimeCapability, B as BuiltinToolset, W as WorkspaceFilesRuntimeCapability } from './model-provider.esm.js';
|
|
19
|
+
export { A as ActorTokenRuntimeCapability, a as ActorTokenRuntimeFactoryCapability, b as ArtifactsRuntimeCapability, d as BaseTool, e as BaseToolset, D as DefaultAgentMiddlewareRuntimeCapabilityRegistry, D as DefaultRuntimeCapabilityRegistry, K as KnowledgeDocumentVisualAssetsRuntimeCapability, f as KnowledgeDocumentVisualAssetsRuntimeFactoryCapability, g as KnowledgeGraphRuntimeCapability, h as KnowledgebaseDocumentsRuntimeCapability, i as KnowledgebaseProvisioningRuntimeCapability, j as KnowledgebaseRuntimeCapability, M as ModelProviderBuiltinToolset, P as ProjectAccessRuntimeCapability, k as ProjectProvisioningRuntimeCapability, R as RUNTIME_CAPABILITY_PROVIDER, l as RuntimeCapabilityProvider, S as SANDBOX_JOB_ERROR_CODES, m as SANDBOX_JOB_PROGRESS_PREFIX, n as SandboxJobRuntimeError, o as SandboxJobsRuntimeCapability, p as WORKSPACE_FILES_SOURCE, X as XPERT_RUNTIME_CAPABILITIES_TOKEN, q as isSandboxJobRuntimeError } from './model-provider.esm.js';
|
|
20
20
|
import fsPromises from 'fs/promises';
|
|
21
21
|
import * as path from 'path';
|
|
22
22
|
import path__default, { join } from 'path';
|
|
@@ -27,6 +27,7 @@ import yaml__default from 'yaml';
|
|
|
27
27
|
import Ajv from 'ajv';
|
|
28
28
|
import schemaDraft04 from 'ajv/dist/refs/json-schema-draft-06.json';
|
|
29
29
|
import * as _axios from 'axios';
|
|
30
|
+
export { DataSourceRuntimeCapability, SqlDatabaseWorkbenchAdapter, quoteDatabaseIdentifier, requireReadStatement, splitWorkbenchSql } from './data-workbench.esm.js';
|
|
30
31
|
import { BaseCallbackHandler } from '@langchain/core/callbacks/base';
|
|
31
32
|
import { ChatGenerationChunk } from '@langchain/core/outputs';
|
|
32
33
|
import { isAIMessageChunk, AIMessage } from '@langchain/core/messages';
|
|
@@ -41,7 +42,7 @@ import { assertConnectorDefinition } from './connector.esm.js';
|
|
|
41
42
|
export { CONNECTOR_AUTHORIZATION_MODES, CONNECTOR_SCOPE_TYPES, getConnectorAuthMethods, getConnectorAuthorizationModes } from './connector.esm.js';
|
|
42
43
|
export { base64ToBytes, bytesToBase64, createCollaborationClient, createCollaborationPresenceStore, createSocketIoTransportAdapter, createYjsDocumentAdapter } from './collaboration-client.esm.js';
|
|
43
44
|
import { tool } from '@langchain/core/tools';
|
|
44
|
-
import { ZodError, z } from 'zod/v3';
|
|
45
|
+
import { ZodError, z, ZodFirstPartyTypeKind } from 'zod/v3';
|
|
45
46
|
|
|
46
47
|
/**
|
|
47
48
|
* Metadata keys used in plugins for defining various aspects like entities, subscribers, and configurations.
|
|
@@ -3633,6 +3634,44 @@ class Speech2TextChatModel extends BaseChatModel {
|
|
|
3633
3634
|
}
|
|
3634
3635
|
|
|
3635
3636
|
const encodingCache = new Map();
|
|
3637
|
+
/** Exact, model-independent text count for hard chunk limits. Treat special-token spellings as literal document text. */ function textEncoding() {
|
|
3638
|
+
const cacheKey = 'encoding:cl100k_base';
|
|
3639
|
+
let encoder = encodingCache.get(cacheKey);
|
|
3640
|
+
if (!encoder) {
|
|
3641
|
+
encoder = getEncoding('cl100k_base');
|
|
3642
|
+
encodingCache.set(cacheKey, encoder);
|
|
3643
|
+
}
|
|
3644
|
+
return encoder;
|
|
3645
|
+
}
|
|
3646
|
+
function countTextTokens(text) {
|
|
3647
|
+
if (!text) return 0;
|
|
3648
|
+
// A hard limit must fail if tokenization fails, never fall back to an estimate.
|
|
3649
|
+
return textEncoding().encode(text, [], []).length;
|
|
3650
|
+
}
|
|
3651
|
+
/** Token boundaries that also end on complete Unicode characters, in UTF-16 source offsets. */ function textTokenBoundaries(text) {
|
|
3652
|
+
const encoder = textEncoding();
|
|
3653
|
+
const tokens = encoder.encode(text, [], []);
|
|
3654
|
+
const boundaries = [
|
|
3655
|
+
{
|
|
3656
|
+
offset: 0,
|
|
3657
|
+
tokens: 0
|
|
3658
|
+
}
|
|
3659
|
+
];
|
|
3660
|
+
let offset = 0;
|
|
3661
|
+
let start = 0;
|
|
3662
|
+
for(let end = 1; end <= tokens.length; end++){
|
|
3663
|
+
const decoded = encoder.decode(tokens.slice(start, end));
|
|
3664
|
+
if (!decoded || !text.startsWith(decoded, offset)) continue;
|
|
3665
|
+
offset += decoded.length;
|
|
3666
|
+
boundaries.push({
|
|
3667
|
+
offset,
|
|
3668
|
+
tokens: end
|
|
3669
|
+
});
|
|
3670
|
+
start = end;
|
|
3671
|
+
}
|
|
3672
|
+
if (offset !== text.length) throw new Error('Tokenization could not preserve the source text.');
|
|
3673
|
+
return boundaries;
|
|
3674
|
+
}
|
|
3636
3675
|
/**
|
|
3637
3676
|
* Fallback token estimation method.
|
|
3638
3677
|
*
|
|
@@ -5910,9 +5949,164 @@ function freezeItems(items) {
|
|
|
5910
5949
|
const XPERT_TOOL_PROVIDER = 'XPERT_TOOL_PROVIDER';
|
|
5911
5950
|
const XPERT_TOOL_PROVIDER_METADATA = 'XPERT_TOOL_PROVIDER_METADATA';
|
|
5912
5951
|
const XPERT_TOOL_METHOD_METADATA = 'XPERT_TOOL_METHOD_METADATA';
|
|
5913
|
-
/** Marks one injectable business service as a
|
|
5952
|
+
/** Marks one injectable business service as a shared Tool, Resource and Prompt provider. */ const XpertToolProvider = (options)=>applyDecorators(Injectable(), SetMetadata(XPERT_TOOL_PROVIDER, options.provider), SetMetadata(XPERT_TOOL_PROVIDER_METADATA, Object.freeze(_extends({}, options))), SetMetadata(STRATEGY_META_KEY, XPERT_TOOL_PROVIDER));
|
|
5914
5953
|
/** Exposes one business method through an Agent Middleware, native MCP, or both. */ const XpertTool = (options)=>SetMetadata(XPERT_TOOL_METHOD_METADATA, Object.freeze(_extends({}, options)));
|
|
5915
5954
|
|
|
5955
|
+
/** Child overrides hide parent declarations, including undecorated overrides and accessors. */ function collectProviderMethods(instance) {
|
|
5956
|
+
const methods = [];
|
|
5957
|
+
const seen = new Set();
|
|
5958
|
+
let prototype = Object.getPrototypeOf(instance);
|
|
5959
|
+
while(prototype && prototype !== Object.prototype){
|
|
5960
|
+
for (const methodName of Object.getOwnPropertyNames(prototype)){
|
|
5961
|
+
var _Object_getOwnPropertyDescriptor;
|
|
5962
|
+
if (methodName === 'constructor' || seen.has(methodName)) continue;
|
|
5963
|
+
seen.add(methodName);
|
|
5964
|
+
const method = (_Object_getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor(prototype, methodName)) == null ? void 0 : _Object_getOwnPropertyDescriptor.value;
|
|
5965
|
+
if (typeof method === 'function') methods.push({
|
|
5966
|
+
methodName,
|
|
5967
|
+
method
|
|
5968
|
+
});
|
|
5969
|
+
}
|
|
5970
|
+
prototype = Object.getPrototypeOf(prototype);
|
|
5971
|
+
}
|
|
5972
|
+
return methods;
|
|
5973
|
+
}
|
|
5974
|
+
|
|
5975
|
+
function _object_without_properties_loose$2(source, excluded) {
|
|
5976
|
+
if (source == null) return {};
|
|
5977
|
+
var target = {};
|
|
5978
|
+
var sourceKeys = Object.keys(source);
|
|
5979
|
+
var key, i;
|
|
5980
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
5981
|
+
key = sourceKeys[i];
|
|
5982
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
5983
|
+
target[key] = source[key];
|
|
5984
|
+
}
|
|
5985
|
+
return target;
|
|
5986
|
+
}
|
|
5987
|
+
|
|
5988
|
+
const MCP_METHOD_METADATA = 'XPERT_MCP_METHOD_METADATA';
|
|
5989
|
+
/** The decorated method receives ResourceReadContext and returns McpResourceReadResult. */ const XpertResource = (options)=>SetMetadata(MCP_METHOD_METADATA, {
|
|
5990
|
+
kind: 'resource',
|
|
5991
|
+
options: Object.freeze(_extends({}, options))
|
|
5992
|
+
});
|
|
5993
|
+
/** The decorated method receives URI arguments and ResourceReadContext. */ const XpertResourceTemplate = (options)=>SetMetadata(MCP_METHOD_METADATA, {
|
|
5994
|
+
kind: 'resource-template',
|
|
5995
|
+
options: Object.freeze(_extends({}, options))
|
|
5996
|
+
});
|
|
5997
|
+
/** The decorated method receives prompt arguments and ToolExecutionContext. */ const XpertPrompt = (options)=>SetMetadata(MCP_METHOD_METADATA, {
|
|
5998
|
+
kind: 'prompt',
|
|
5999
|
+
options: Object.freeze(_extends({}, options))
|
|
6000
|
+
});
|
|
6001
|
+
function describeXpertMcpMethods(instance) {
|
|
6002
|
+
const result = [];
|
|
6003
|
+
for (const { methodName, method } of collectProviderMethods(instance)){
|
|
6004
|
+
var _metadata_options_uri, _metadata_options_uriTemplate, _metadata_options_name;
|
|
6005
|
+
const metadata = Reflect.getMetadata(MCP_METHOD_METADATA, method);
|
|
6006
|
+
if (!metadata) continue;
|
|
6007
|
+
const { options } = metadata;
|
|
6008
|
+
if (!/^[A-Za-z0-9_-]{1,191}$/.test(options.key)) throw new Error(`Invalid MCP capability key '${options.key}'.`);
|
|
6009
|
+
var _options_requiredContext;
|
|
6010
|
+
const contexts = (_options_requiredContext = options.requiredContext) != null ? _options_requiredContext : [];
|
|
6011
|
+
if (new Set(contexts).size !== contexts.length || contexts.some((context)=>!MCP_REQUIRED_CONTEXTS.includes(context))) {
|
|
6012
|
+
throw new Error(`MCP capability '${options.key}' declares invalid execution contexts.`);
|
|
6013
|
+
}
|
|
6014
|
+
if (metadata.kind === 'resource' && !((_metadata_options_uri = metadata.options.uri) == null ? void 0 : _metadata_options_uri.trim())) {
|
|
6015
|
+
throw new Error(`Resource '${options.key}' requires a URI.`);
|
|
6016
|
+
}
|
|
6017
|
+
if (metadata.kind === 'resource-template' && !((_metadata_options_uriTemplate = metadata.options.uriTemplate) == null ? void 0 : _metadata_options_uriTemplate.trim())) {
|
|
6018
|
+
throw new Error(`Resource template '${options.key}' requires a URI template.`);
|
|
6019
|
+
}
|
|
6020
|
+
if (metadata.kind === 'prompt' && !((_metadata_options_name = metadata.options.name) == null ? void 0 : _metadata_options_name.trim())) {
|
|
6021
|
+
throw new Error(`Prompt '${options.key}' requires a name.`);
|
|
6022
|
+
}
|
|
6023
|
+
if (metadata.kind !== 'resource' && metadata.options.completionMethod) {
|
|
6024
|
+
callable(instance, metadata.options.completionMethod);
|
|
6025
|
+
}
|
|
6026
|
+
result.push(Object.freeze(_extends({}, metadata, {
|
|
6027
|
+
methodName
|
|
6028
|
+
})));
|
|
6029
|
+
}
|
|
6030
|
+
return Object.freeze(result);
|
|
6031
|
+
}
|
|
6032
|
+
/** One catalog for runtime publication and fingerprinting; legacy declarations remain supported. */ function resolveXpertMcpExtensions(instance, descriptor) {
|
|
6033
|
+
const legacy = 'getMcpExtensions' in instance && typeof instance.getMcpExtensions === 'function' ? instance.getMcpExtensions == null ? void 0 : instance.getMcpExtensions.call(instance) : undefined;
|
|
6034
|
+
var _legacy_resources;
|
|
6035
|
+
const resources = [
|
|
6036
|
+
...(_legacy_resources = legacy == null ? void 0 : legacy.resources) != null ? _legacy_resources : []
|
|
6037
|
+
];
|
|
6038
|
+
var _legacy_resourceTemplates;
|
|
6039
|
+
const resourceTemplates = [
|
|
6040
|
+
...(_legacy_resourceTemplates = legacy == null ? void 0 : legacy.resourceTemplates) != null ? _legacy_resourceTemplates : []
|
|
6041
|
+
];
|
|
6042
|
+
var _legacy_prompts;
|
|
6043
|
+
const prompts = [
|
|
6044
|
+
...(_legacy_prompts = legacy == null ? void 0 : legacy.prompts) != null ? _legacy_prompts : []
|
|
6045
|
+
];
|
|
6046
|
+
var _descriptor_mcpMethods;
|
|
6047
|
+
for (const _ref of (_descriptor_mcpMethods = descriptor == null ? void 0 : descriptor.mcpMethods) != null ? _descriptor_mcpMethods : describeXpertMcpMethods(instance)){
|
|
6048
|
+
let definition = _ref;
|
|
6049
|
+
const method = callable(instance, definition.methodName);
|
|
6050
|
+
switch(definition.kind){
|
|
6051
|
+
case 'resource':
|
|
6052
|
+
resources.push(_extends({}, definition.options, {
|
|
6053
|
+
read: method
|
|
6054
|
+
}));
|
|
6055
|
+
break;
|
|
6056
|
+
case 'resource-template':
|
|
6057
|
+
{
|
|
6058
|
+
const _definition_options = definition.options, { completionMethod } = _definition_options, options = _object_without_properties_loose$2(_definition_options, [
|
|
6059
|
+
"completionMethod"
|
|
6060
|
+
]);
|
|
6061
|
+
resourceTemplates.push(_extends({}, options, {
|
|
6062
|
+
read: method
|
|
6063
|
+
}, completionMethod ? {
|
|
6064
|
+
complete: callable(instance, completionMethod)
|
|
6065
|
+
} : {}));
|
|
6066
|
+
break;
|
|
6067
|
+
}
|
|
6068
|
+
case 'prompt':
|
|
6069
|
+
{
|
|
6070
|
+
const _definition_options = definition.options, { completionMethod } = _definition_options, options = _object_without_properties_loose$2(_definition_options, [
|
|
6071
|
+
"completionMethod"
|
|
6072
|
+
]);
|
|
6073
|
+
prompts.push(_extends({}, options, {
|
|
6074
|
+
get: method
|
|
6075
|
+
}, completionMethod ? {
|
|
6076
|
+
complete: callable(instance, completionMethod)
|
|
6077
|
+
} : {}));
|
|
6078
|
+
break;
|
|
6079
|
+
}
|
|
6080
|
+
}
|
|
6081
|
+
}
|
|
6082
|
+
assertUnique(resources, (item)=>item.key, 'resource key');
|
|
6083
|
+
assertUnique(resources, (item)=>item.uri, 'resource URI');
|
|
6084
|
+
assertUnique(resourceTemplates, (item)=>item.key, 'resource template key');
|
|
6085
|
+
assertUnique(resourceTemplates, (item)=>item.uriTemplate, 'resource template URI');
|
|
6086
|
+
assertUnique(prompts, (item)=>item.key, 'prompt key');
|
|
6087
|
+
assertUnique(prompts, (item)=>item.name, 'prompt name');
|
|
6088
|
+
return {
|
|
6089
|
+
resources,
|
|
6090
|
+
resourceTemplates,
|
|
6091
|
+
prompts
|
|
6092
|
+
};
|
|
6093
|
+
}
|
|
6094
|
+
function callable(instance, name) {
|
|
6095
|
+
var _collectProviderMethods_find;
|
|
6096
|
+
// Match discovery semantics: accessors and non-method overrides are not executable handlers.
|
|
6097
|
+
const method = (_collectProviderMethods_find = collectProviderMethods(instance).find((item)=>item.methodName === name)) == null ? void 0 : _collectProviderMethods_find.method;
|
|
6098
|
+
if (typeof method !== 'function') throw new Error(`MCP method '${name}' is not callable.`);
|
|
6099
|
+
return method.bind(instance);
|
|
6100
|
+
}
|
|
6101
|
+
function assertUnique(items, key, label) {
|
|
6102
|
+
const seen = new Set();
|
|
6103
|
+
for (const item of items){
|
|
6104
|
+
const value = key(item);
|
|
6105
|
+
if (seen.has(value)) throw new Error(`MCP ${label} '${value}' is declared more than once.`);
|
|
6106
|
+
seen.add(value);
|
|
6107
|
+
}
|
|
6108
|
+
}
|
|
6109
|
+
|
|
5916
6110
|
const PROVIDER_PATTERN = /^[a-z][a-z0-9_]*$/;
|
|
5917
6111
|
const MIDDLEWARE_PROVIDER_PATTERN = /^[A-Za-z][A-Za-z0-9_]*$/;
|
|
5918
6112
|
const COMPONENT_KEY_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
@@ -5955,31 +6149,24 @@ function describeXpertToolProvider(instance) {
|
|
|
5955
6149
|
options: toolOptions
|
|
5956
6150
|
});
|
|
5957
6151
|
});
|
|
5958
|
-
|
|
5959
|
-
|
|
6152
|
+
const mcpMethods = describeXpertMcpMethods(instance);
|
|
6153
|
+
if (!tools.length && !mcpMethods.length) {
|
|
6154
|
+
throw new Error(`Provider '${options.provider}' does not declare any decorated capability methods.`);
|
|
5960
6155
|
}
|
|
5961
6156
|
return Object.freeze({
|
|
5962
6157
|
options: Object.freeze(_extends({}, options)),
|
|
5963
|
-
tools: Object.freeze(tools)
|
|
6158
|
+
tools: Object.freeze(tools),
|
|
6159
|
+
mcpMethods
|
|
5964
6160
|
});
|
|
5965
6161
|
}
|
|
5966
6162
|
function collectDecoratedMethods(instance) {
|
|
5967
6163
|
const result = [];
|
|
5968
|
-
const
|
|
5969
|
-
|
|
5970
|
-
|
|
5971
|
-
|
|
5972
|
-
|
|
5973
|
-
|
|
5974
|
-
const method = Reflect.get(prototype, methodName);
|
|
5975
|
-
if (typeof method !== 'function') continue;
|
|
5976
|
-
const options = Reflect.getMetadata(XPERT_TOOL_METHOD_METADATA, method);
|
|
5977
|
-
if (options) result.push({
|
|
5978
|
-
methodName,
|
|
5979
|
-
options
|
|
5980
|
-
});
|
|
5981
|
-
}
|
|
5982
|
-
prototype = Object.getPrototypeOf(prototype);
|
|
6164
|
+
for (const { methodName, method } of collectProviderMethods(instance)){
|
|
6165
|
+
const options = Reflect.getMetadata(XPERT_TOOL_METHOD_METADATA, method);
|
|
6166
|
+
if (options) result.push({
|
|
6167
|
+
methodName,
|
|
6168
|
+
options
|
|
6169
|
+
});
|
|
5983
6170
|
}
|
|
5984
6171
|
return result;
|
|
5985
6172
|
}
|
|
@@ -6032,15 +6219,12 @@ function validateToolOptions(options, methodName) {
|
|
|
6032
6219
|
if (options.resultFormat && options.resultFormat !== 'dto' && options.resultFormat !== 'tool_result') {
|
|
6033
6220
|
throw new Error(`Tool '${options.name}' declares an invalid resultFormat.`);
|
|
6034
6221
|
}
|
|
6035
|
-
if (options.resultFormat === 'tool_result' && !options.outputSchema) {
|
|
6036
|
-
throw new Error(`Tool '${options.name}' requires outputSchema for tool_result.`);
|
|
6037
|
-
}
|
|
6038
6222
|
if (!TOOL_NAME_PATTERN.test(options.name) || options.name.length > 191) {
|
|
6039
6223
|
throw new Error(`Method '${methodName}' declares invalid Tool name '${options.name}'.`);
|
|
6040
6224
|
}
|
|
6041
6225
|
if (!((_options_description = options.description) == null ? void 0 : _options_description.trim())) throw new Error(`Tool '${options.name}' requires a description.`);
|
|
6042
6226
|
assertStrictObjectSchema(options.inputSchema, options.name, 'input');
|
|
6043
|
-
if (options.mcp && !options.outputSchema) {
|
|
6227
|
+
if (options.mcp && !options.outputSchema && options.resultFormat !== 'tool_result') {
|
|
6044
6228
|
throw new Error(`MCP Tool '${options.name}' requires an outputSchema.`);
|
|
6045
6229
|
}
|
|
6046
6230
|
if (options.mcp && options.outputSchema) {
|
|
@@ -6050,6 +6234,14 @@ function validateToolOptions(options, methodName) {
|
|
|
6050
6234
|
throw new Error(`MCP Tool '${options.name}' requires at least one execution context.`);
|
|
6051
6235
|
}
|
|
6052
6236
|
if (options.mcp) {
|
|
6237
|
+
const transportSchema = options.mcp.inputSchema;
|
|
6238
|
+
if (transportSchema && typeof transportSchema.parseAsync !== 'function') {
|
|
6239
|
+
throw new Error(`MCP Tool '${options.name}' requires a Zod transport input schema.`);
|
|
6240
|
+
}
|
|
6241
|
+
const task = options.mcp.task;
|
|
6242
|
+
if (task && (task.mode !== 'optional' && task.mode !== 'required' || task.maxLifetimeMs !== undefined && (!Number.isSafeInteger(task.maxLifetimeMs) || task.maxLifetimeMs <= 0))) {
|
|
6243
|
+
throw new Error(`MCP Tool '${options.name}' declares invalid task execution policy.`);
|
|
6244
|
+
}
|
|
6053
6245
|
if (options.mcp.defaultApprovalMode !== undefined && !includesValue(MCP_CAPABILITY_APPROVAL_MODES, options.mcp.defaultApprovalMode)) {
|
|
6054
6246
|
throw new Error(`MCP Tool '${options.name}' declares invalid defaultApprovalMode.`);
|
|
6055
6247
|
}
|
|
@@ -6232,7 +6424,7 @@ const contentSchema = z.discriminatedUnion('type', [
|
|
|
6232
6424
|
var _result_content;
|
|
6233
6425
|
const envelope = z.object({
|
|
6234
6426
|
content: z.array(contentSchema).max(32).optional(),
|
|
6235
|
-
structuredContent: outputSchema,
|
|
6427
|
+
structuredContent: outputSchema != null ? outputSchema : z.unknown().optional(),
|
|
6236
6428
|
isError: z.boolean().optional()
|
|
6237
6429
|
}).strict();
|
|
6238
6430
|
const result = await envelope.parseAsync(value);
|
|
@@ -6268,7 +6460,7 @@ const contentSchema = z.discriminatedUnion('type', [
|
|
|
6268
6460
|
// MCP clients may expose only content to the model. Keep the validated DTO
|
|
6269
6461
|
// readable there too, while retaining binary blocks and App structured data.
|
|
6270
6462
|
const text = JSON.stringify(result.structuredContent);
|
|
6271
|
-
if (!content.some((item)=>item.type === 'text' && item.text === text)) content.push({
|
|
6463
|
+
if (text !== undefined && !content.some((item)=>item.type === 'text' && item.text === text)) content.push({
|
|
6272
6464
|
type: 'text',
|
|
6273
6465
|
text
|
|
6274
6466
|
});
|
|
@@ -6389,7 +6581,11 @@ let DecoratedBuiltinToolset = class DecoratedBuiltinToolset extends BuiltinTools
|
|
|
6389
6581
|
this.pluginName = pluginName;
|
|
6390
6582
|
this.pluginVersion = pluginVersion;
|
|
6391
6583
|
this.tools = [];
|
|
6584
|
+
const extensions = resolveXpertMcpExtensions(instance, descriptor);
|
|
6392
6585
|
_class_private_field_loose_base(this, _definitions)[_definitions] = _extends({
|
|
6586
|
+
resources: extensions == null ? void 0 : extensions.resources,
|
|
6587
|
+
resourceTemplates: extensions == null ? void 0 : extensions.resourceTemplates,
|
|
6588
|
+
prompts: extensions == null ? void 0 : extensions.prompts,
|
|
6393
6589
|
instructions: descriptor.options.instructions,
|
|
6394
6590
|
tools: descriptor.tools.filter((item)=>!!item.options.mcp).map((item)=>createMcpTool(instance, item))
|
|
6395
6591
|
}, ((_descriptor_options_apps = descriptor.options.apps) == null ? void 0 : _descriptor_options_apps.length) ? {
|
|
@@ -6404,7 +6600,7 @@ function createAgentTool(instance, descriptor, middlewareContext, middlewareOpti
|
|
|
6404
6600
|
return tool(async (input, config)=>{
|
|
6405
6601
|
const parsedInput = await descriptor.options.inputSchema.parseAsync(input);
|
|
6406
6602
|
const output = await invoke(parsedInput, agentExecutionContext(middlewareContext, middlewareOptions, config));
|
|
6407
|
-
if (descriptor.options.resultFormat === 'tool_result'
|
|
6603
|
+
if (descriptor.options.resultFormat === 'tool_result') {
|
|
6408
6604
|
const result = await resolveToolResult(output, (value)=>parseDecoratedToolResult(value, descriptor.options.outputSchema));
|
|
6409
6605
|
var _result_isError;
|
|
6410
6606
|
return [
|
|
@@ -6432,24 +6628,28 @@ function createAgentTool(instance, descriptor, middlewareContext, middlewareOpti
|
|
|
6432
6628
|
function createMcpTool(instance, descriptor) {
|
|
6433
6629
|
const mcp = descriptor.options.mcp;
|
|
6434
6630
|
const outputSchema = descriptor.options.outputSchema;
|
|
6435
|
-
if (!mcp
|
|
6631
|
+
if (!mcp) throw new Error(`MCP Tool '${descriptor.options.name}' is incomplete.`);
|
|
6436
6632
|
const invoke = getXpertToolMethod(instance, descriptor);
|
|
6437
|
-
var _mcp_visibility;
|
|
6633
|
+
var _mcp_inputSchema, _mcp_visibility;
|
|
6438
6634
|
return _extends({
|
|
6439
6635
|
name: descriptor.options.name
|
|
6440
6636
|
}, descriptor.options.title ? {
|
|
6441
6637
|
title: descriptor.options.title
|
|
6442
6638
|
} : {}, {
|
|
6443
6639
|
description: descriptor.options.description,
|
|
6444
|
-
inputSchema: descriptor.options.inputSchema
|
|
6445
|
-
|
|
6640
|
+
inputSchema: (_mcp_inputSchema = mcp.inputSchema) != null ? _mcp_inputSchema : descriptor.options.inputSchema
|
|
6641
|
+
}, outputSchema ? {
|
|
6642
|
+
outputSchema
|
|
6643
|
+
} : {}, {
|
|
6446
6644
|
exposure: {
|
|
6447
6645
|
mcp: {
|
|
6448
6646
|
eligible: true
|
|
6449
6647
|
}
|
|
6450
6648
|
},
|
|
6451
6649
|
behavior: mcp.behavior
|
|
6452
|
-
}, mcp.
|
|
6650
|
+
}, mcp.task ? {
|
|
6651
|
+
task: mcp.task
|
|
6652
|
+
} : {}, mcp.defaultApprovalMode ? {
|
|
6453
6653
|
defaultApprovalMode: mcp.defaultApprovalMode
|
|
6454
6654
|
} : {}, {
|
|
6455
6655
|
requiredContext: [
|
|
@@ -6470,12 +6670,13 @@ function createMcpTool(instance, descriptor) {
|
|
|
6470
6670
|
} : {}, {
|
|
6471
6671
|
execute: async (input, context)=>{
|
|
6472
6672
|
const parsedInput = await descriptor.options.inputSchema.parseAsync(input);
|
|
6473
|
-
const
|
|
6673
|
+
const transportInput = mcp.inputSchema ? await mcp.inputSchema.parseAsync(parsedInput) : parsedInput;
|
|
6674
|
+
const output = await invoke(transportInput, mcpExecutionContext(context));
|
|
6474
6675
|
if (descriptor.options.resultFormat === 'tool_result') {
|
|
6475
6676
|
return resolveToolResult(output, (value)=>parseDecoratedToolResult(value, outputSchema));
|
|
6476
6677
|
}
|
|
6477
6678
|
return resolveToolResult(output, async (value)=>{
|
|
6478
|
-
const parsedOutput = await outputSchema.parseAsync(value);
|
|
6679
|
+
const parsedOutput = outputSchema ? await outputSchema.parseAsync(value) : value;
|
|
6479
6680
|
// Serialize once so text-only clients and MCP Apps receive the same JSON-safe DTO.
|
|
6480
6681
|
const text = stringifyDto(parsedOutput, descriptor.options.name);
|
|
6481
6682
|
return {
|
|
@@ -6492,6 +6693,7 @@ function createMcpTool(instance, descriptor) {
|
|
|
6492
6693
|
});
|
|
6493
6694
|
}
|
|
6494
6695
|
function agentExecutionContext(context, middlewareOptions, config) {
|
|
6696
|
+
var _context_runtime_capabilities;
|
|
6495
6697
|
const configurable = config.configurable;
|
|
6496
6698
|
const requestId = readString(configurable, 'tool_call_id');
|
|
6497
6699
|
const executionId = readString(configurable, 'executionId');
|
|
@@ -6520,11 +6722,13 @@ function agentExecutionContext(context, middlewareOptions, config) {
|
|
|
6520
6722
|
} : {}, {
|
|
6521
6723
|
signal: config.signal,
|
|
6522
6724
|
host: {
|
|
6725
|
+
files: (_context_runtime_capabilities = context.runtime.capabilities) == null ? void 0 : _context_runtime_capabilities.get(WorkspaceFilesRuntimeCapability),
|
|
6523
6726
|
models: {
|
|
6524
6727
|
createModelClient: context.runtime.createModelClient,
|
|
6525
6728
|
getModelProvider: context.runtime.getModelProvider
|
|
6526
6729
|
}
|
|
6527
6730
|
},
|
|
6731
|
+
xpertFeatures: context.xpertFeatures,
|
|
6528
6732
|
middlewareOptions
|
|
6529
6733
|
});
|
|
6530
6734
|
}
|
|
@@ -6631,4 +6835,2870 @@ XpertToolProviderCoordinator = __decorate([
|
|
|
6631
6835
|
])
|
|
6632
6836
|
], XpertToolProviderCoordinator);
|
|
6633
6837
|
|
|
6634
|
-
|
|
6838
|
+
function _define_property$h(obj, key, value) {
|
|
6839
|
+
if (key in obj) {
|
|
6840
|
+
Object.defineProperty(obj, key, {
|
|
6841
|
+
value: value,
|
|
6842
|
+
enumerable: true,
|
|
6843
|
+
configurable: true,
|
|
6844
|
+
writable: true
|
|
6845
|
+
});
|
|
6846
|
+
} else {
|
|
6847
|
+
obj[key] = value;
|
|
6848
|
+
}
|
|
6849
|
+
return obj;
|
|
6850
|
+
}
|
|
6851
|
+
function _object_spread$h(target) {
|
|
6852
|
+
for(var i = 1; i < arguments.length; i++){
|
|
6853
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
6854
|
+
var ownKeys = Object.keys(source);
|
|
6855
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
6856
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
6857
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
6858
|
+
}));
|
|
6859
|
+
}
|
|
6860
|
+
ownKeys.forEach(function(key) {
|
|
6861
|
+
_define_property$h(target, key, source[key]);
|
|
6862
|
+
});
|
|
6863
|
+
}
|
|
6864
|
+
return target;
|
|
6865
|
+
}
|
|
6866
|
+
var ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
|
|
6867
|
+
var defaultOptions = {
|
|
6868
|
+
name: undefined,
|
|
6869
|
+
$refStrategy: "root",
|
|
6870
|
+
basePath: [
|
|
6871
|
+
"#"
|
|
6872
|
+
],
|
|
6873
|
+
effectStrategy: "input",
|
|
6874
|
+
pipeStrategy: "all",
|
|
6875
|
+
dateStrategy: "format:date-time",
|
|
6876
|
+
mapStrategy: "entries",
|
|
6877
|
+
removeAdditionalStrategy: "passthrough",
|
|
6878
|
+
allowedAdditionalProperties: true,
|
|
6879
|
+
rejectedAdditionalProperties: false,
|
|
6880
|
+
definitionPath: "definitions",
|
|
6881
|
+
target: "jsonSchema7",
|
|
6882
|
+
strictUnions: false,
|
|
6883
|
+
definitions: {},
|
|
6884
|
+
errorMessages: false,
|
|
6885
|
+
markdownDescription: false,
|
|
6886
|
+
patternStrategy: "escape",
|
|
6887
|
+
applyRegexFlags: false,
|
|
6888
|
+
emailStrategy: "format:email",
|
|
6889
|
+
base64Strategy: "contentEncoding:base64",
|
|
6890
|
+
nameStrategy: "ref",
|
|
6891
|
+
openAiAnyTypeName: "OpenAiAnyType"
|
|
6892
|
+
};
|
|
6893
|
+
var getDefaultOptions = function(options) {
|
|
6894
|
+
return _object_spread$h({}, defaultOptions, options);
|
|
6895
|
+
};
|
|
6896
|
+
|
|
6897
|
+
function _array_like_to_array$f(arr, len) {
|
|
6898
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
6899
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
6900
|
+
return arr2;
|
|
6901
|
+
}
|
|
6902
|
+
function _array_with_holes(arr) {
|
|
6903
|
+
if (Array.isArray(arr)) return arr;
|
|
6904
|
+
}
|
|
6905
|
+
function _array_without_holes$f(arr) {
|
|
6906
|
+
if (Array.isArray(arr)) return _array_like_to_array$f(arr);
|
|
6907
|
+
}
|
|
6908
|
+
function _define_property$g(obj, key, value) {
|
|
6909
|
+
if (key in obj) {
|
|
6910
|
+
Object.defineProperty(obj, key, {
|
|
6911
|
+
value: value,
|
|
6912
|
+
enumerable: true,
|
|
6913
|
+
configurable: true,
|
|
6914
|
+
writable: true
|
|
6915
|
+
});
|
|
6916
|
+
} else {
|
|
6917
|
+
obj[key] = value;
|
|
6918
|
+
}
|
|
6919
|
+
return obj;
|
|
6920
|
+
}
|
|
6921
|
+
function _iterable_to_array$f(iter) {
|
|
6922
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
6923
|
+
}
|
|
6924
|
+
function _iterable_to_array_limit(arr, i) {
|
|
6925
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
6926
|
+
if (_i == null) return;
|
|
6927
|
+
var _arr = [];
|
|
6928
|
+
var _n = true;
|
|
6929
|
+
var _d = false;
|
|
6930
|
+
var _s, _e;
|
|
6931
|
+
try {
|
|
6932
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
6933
|
+
_arr.push(_s.value);
|
|
6934
|
+
if (i && _arr.length === i) break;
|
|
6935
|
+
}
|
|
6936
|
+
} catch (err) {
|
|
6937
|
+
_d = true;
|
|
6938
|
+
_e = err;
|
|
6939
|
+
} finally{
|
|
6940
|
+
try {
|
|
6941
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
6942
|
+
} finally{
|
|
6943
|
+
if (_d) throw _e;
|
|
6944
|
+
}
|
|
6945
|
+
}
|
|
6946
|
+
return _arr;
|
|
6947
|
+
}
|
|
6948
|
+
function _non_iterable_rest() {
|
|
6949
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
6950
|
+
}
|
|
6951
|
+
function _non_iterable_spread$f() {
|
|
6952
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
6953
|
+
}
|
|
6954
|
+
function _object_spread$g(target) {
|
|
6955
|
+
for(var i = 1; i < arguments.length; i++){
|
|
6956
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
6957
|
+
var ownKeys = Object.keys(source);
|
|
6958
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
6959
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
6960
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
6961
|
+
}));
|
|
6962
|
+
}
|
|
6963
|
+
ownKeys.forEach(function(key) {
|
|
6964
|
+
_define_property$g(target, key, source[key]);
|
|
6965
|
+
});
|
|
6966
|
+
}
|
|
6967
|
+
return target;
|
|
6968
|
+
}
|
|
6969
|
+
function ownKeys$f(object, enumerableOnly) {
|
|
6970
|
+
var keys = Object.keys(object);
|
|
6971
|
+
if (Object.getOwnPropertySymbols) {
|
|
6972
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
6973
|
+
keys.push.apply(keys, symbols);
|
|
6974
|
+
}
|
|
6975
|
+
return keys;
|
|
6976
|
+
}
|
|
6977
|
+
function _object_spread_props$f(target, source) {
|
|
6978
|
+
source = source != null ? source : {};
|
|
6979
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
6980
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
6981
|
+
} else {
|
|
6982
|
+
ownKeys$f(Object(source)).forEach(function(key) {
|
|
6983
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
6984
|
+
});
|
|
6985
|
+
}
|
|
6986
|
+
return target;
|
|
6987
|
+
}
|
|
6988
|
+
function _sliced_to_array(arr, i) {
|
|
6989
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array$f(arr, i) || _non_iterable_rest();
|
|
6990
|
+
}
|
|
6991
|
+
function _to_consumable_array$f(arr) {
|
|
6992
|
+
return _array_without_holes$f(arr) || _iterable_to_array$f(arr) || _unsupported_iterable_to_array$f(arr) || _non_iterable_spread$f();
|
|
6993
|
+
}
|
|
6994
|
+
function _unsupported_iterable_to_array$f(o, minLen) {
|
|
6995
|
+
if (!o) return;
|
|
6996
|
+
if (typeof o === "string") return _array_like_to_array$f(o, minLen);
|
|
6997
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
6998
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
6999
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
7000
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$f(o, minLen);
|
|
7001
|
+
}
|
|
7002
|
+
var getRefs = function(options) {
|
|
7003
|
+
var _options = getDefaultOptions(options);
|
|
7004
|
+
var currentPath = _options.name !== undefined ? _to_consumable_array$f(_options.basePath).concat([
|
|
7005
|
+
_options.definitionPath,
|
|
7006
|
+
_options.name
|
|
7007
|
+
]) : _options.basePath;
|
|
7008
|
+
return _object_spread_props$f(_object_spread$g({}, _options), {
|
|
7009
|
+
flags: {
|
|
7010
|
+
hasReferencedOpenAiAnyType: false
|
|
7011
|
+
},
|
|
7012
|
+
currentPath: currentPath,
|
|
7013
|
+
propertyPath: undefined,
|
|
7014
|
+
seen: new Map(Object.entries(_options.definitions).map(function(param) {
|
|
7015
|
+
var _param = _sliced_to_array(param, 2), name = _param[0], def = _param[1];
|
|
7016
|
+
return [
|
|
7017
|
+
def._def,
|
|
7018
|
+
{
|
|
7019
|
+
def: def._def,
|
|
7020
|
+
path: _to_consumable_array$f(_options.basePath).concat([
|
|
7021
|
+
_options.definitionPath,
|
|
7022
|
+
name
|
|
7023
|
+
]),
|
|
7024
|
+
// Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now.
|
|
7025
|
+
jsonSchema: undefined
|
|
7026
|
+
}
|
|
7027
|
+
];
|
|
7028
|
+
}))
|
|
7029
|
+
});
|
|
7030
|
+
};
|
|
7031
|
+
|
|
7032
|
+
function _define_property$f(obj, key, value) {
|
|
7033
|
+
if (key in obj) {
|
|
7034
|
+
Object.defineProperty(obj, key, {
|
|
7035
|
+
value: value,
|
|
7036
|
+
enumerable: true,
|
|
7037
|
+
configurable: true,
|
|
7038
|
+
writable: true
|
|
7039
|
+
});
|
|
7040
|
+
} else {
|
|
7041
|
+
obj[key] = value;
|
|
7042
|
+
}
|
|
7043
|
+
return obj;
|
|
7044
|
+
}
|
|
7045
|
+
function _object_spread$f(target) {
|
|
7046
|
+
for(var i = 1; i < arguments.length; i++){
|
|
7047
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
7048
|
+
var ownKeys = Object.keys(source);
|
|
7049
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
7050
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
7051
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
7052
|
+
}));
|
|
7053
|
+
}
|
|
7054
|
+
ownKeys.forEach(function(key) {
|
|
7055
|
+
_define_property$f(target, key, source[key]);
|
|
7056
|
+
});
|
|
7057
|
+
}
|
|
7058
|
+
return target;
|
|
7059
|
+
}
|
|
7060
|
+
function ownKeys$e(object, enumerableOnly) {
|
|
7061
|
+
var keys = Object.keys(object);
|
|
7062
|
+
if (Object.getOwnPropertySymbols) {
|
|
7063
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
7064
|
+
keys.push.apply(keys, symbols);
|
|
7065
|
+
}
|
|
7066
|
+
return keys;
|
|
7067
|
+
}
|
|
7068
|
+
function _object_spread_props$e(target, source) {
|
|
7069
|
+
source = source != null ? source : {};
|
|
7070
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
7071
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
7072
|
+
} else {
|
|
7073
|
+
ownKeys$e(Object(source)).forEach(function(key) {
|
|
7074
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
7075
|
+
});
|
|
7076
|
+
}
|
|
7077
|
+
return target;
|
|
7078
|
+
}
|
|
7079
|
+
function addErrorMessage(res, key, errorMessage, refs) {
|
|
7080
|
+
if (!(refs === null || refs === void 0 ? void 0 : refs.errorMessages)) return;
|
|
7081
|
+
if (errorMessage) {
|
|
7082
|
+
res.errorMessage = _object_spread_props$e(_object_spread$f({}, res.errorMessage), _define_property$f({}, key, errorMessage));
|
|
7083
|
+
}
|
|
7084
|
+
}
|
|
7085
|
+
function setResponseValueAndErrors(res, key, value, errorMessage, refs) {
|
|
7086
|
+
res[key] = value;
|
|
7087
|
+
addErrorMessage(res, key, errorMessage, refs);
|
|
7088
|
+
}
|
|
7089
|
+
|
|
7090
|
+
function _array_like_to_array$e(arr, len) {
|
|
7091
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
7092
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
7093
|
+
return arr2;
|
|
7094
|
+
}
|
|
7095
|
+
function _array_without_holes$e(arr) {
|
|
7096
|
+
if (Array.isArray(arr)) return _array_like_to_array$e(arr);
|
|
7097
|
+
}
|
|
7098
|
+
function _iterable_to_array$e(iter) {
|
|
7099
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
7100
|
+
}
|
|
7101
|
+
function _non_iterable_spread$e() {
|
|
7102
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
7103
|
+
}
|
|
7104
|
+
function _to_consumable_array$e(arr) {
|
|
7105
|
+
return _array_without_holes$e(arr) || _iterable_to_array$e(arr) || _unsupported_iterable_to_array$e(arr) || _non_iterable_spread$e();
|
|
7106
|
+
}
|
|
7107
|
+
function _unsupported_iterable_to_array$e(o, minLen) {
|
|
7108
|
+
if (!o) return;
|
|
7109
|
+
if (typeof o === "string") return _array_like_to_array$e(o, minLen);
|
|
7110
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
7111
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
7112
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
7113
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$e(o, minLen);
|
|
7114
|
+
}
|
|
7115
|
+
var getRelativePath = function(pathA, pathB) {
|
|
7116
|
+
var i = 0;
|
|
7117
|
+
for(; i < pathA.length && i < pathB.length; i++){
|
|
7118
|
+
if (pathA[i] !== pathB[i]) break;
|
|
7119
|
+
}
|
|
7120
|
+
return [
|
|
7121
|
+
(pathA.length - i).toString()
|
|
7122
|
+
].concat(_to_consumable_array$e(pathB.slice(i))).join("/");
|
|
7123
|
+
};
|
|
7124
|
+
|
|
7125
|
+
function _array_like_to_array$d(arr, len) {
|
|
7126
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
7127
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
7128
|
+
return arr2;
|
|
7129
|
+
}
|
|
7130
|
+
function _array_without_holes$d(arr) {
|
|
7131
|
+
if (Array.isArray(arr)) return _array_like_to_array$d(arr);
|
|
7132
|
+
}
|
|
7133
|
+
function _iterable_to_array$d(iter) {
|
|
7134
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
7135
|
+
}
|
|
7136
|
+
function _non_iterable_spread$d() {
|
|
7137
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
7138
|
+
}
|
|
7139
|
+
function _to_consumable_array$d(arr) {
|
|
7140
|
+
return _array_without_holes$d(arr) || _iterable_to_array$d(arr) || _unsupported_iterable_to_array$d(arr) || _non_iterable_spread$d();
|
|
7141
|
+
}
|
|
7142
|
+
function _unsupported_iterable_to_array$d(o, minLen) {
|
|
7143
|
+
if (!o) return;
|
|
7144
|
+
if (typeof o === "string") return _array_like_to_array$d(o, minLen);
|
|
7145
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
7146
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
7147
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
7148
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$d(o, minLen);
|
|
7149
|
+
}
|
|
7150
|
+
function parseAnyDef(refs) {
|
|
7151
|
+
if (refs.target !== "openAi") {
|
|
7152
|
+
return {};
|
|
7153
|
+
}
|
|
7154
|
+
var anyDefinitionPath = _to_consumable_array$d(refs.basePath).concat([
|
|
7155
|
+
refs.definitionPath,
|
|
7156
|
+
refs.openAiAnyTypeName
|
|
7157
|
+
]);
|
|
7158
|
+
refs.flags.hasReferencedOpenAiAnyType = true;
|
|
7159
|
+
return {
|
|
7160
|
+
$ref: refs.$refStrategy === "relative" ? getRelativePath(anyDefinitionPath, refs.currentPath) : anyDefinitionPath.join("/")
|
|
7161
|
+
};
|
|
7162
|
+
}
|
|
7163
|
+
|
|
7164
|
+
function _array_like_to_array$c(arr, len) {
|
|
7165
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
7166
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
7167
|
+
return arr2;
|
|
7168
|
+
}
|
|
7169
|
+
function _array_without_holes$c(arr) {
|
|
7170
|
+
if (Array.isArray(arr)) return _array_like_to_array$c(arr);
|
|
7171
|
+
}
|
|
7172
|
+
function _define_property$e(obj, key, value) {
|
|
7173
|
+
if (key in obj) {
|
|
7174
|
+
Object.defineProperty(obj, key, {
|
|
7175
|
+
value: value,
|
|
7176
|
+
enumerable: true,
|
|
7177
|
+
configurable: true,
|
|
7178
|
+
writable: true
|
|
7179
|
+
});
|
|
7180
|
+
} else {
|
|
7181
|
+
obj[key] = value;
|
|
7182
|
+
}
|
|
7183
|
+
return obj;
|
|
7184
|
+
}
|
|
7185
|
+
function _iterable_to_array$c(iter) {
|
|
7186
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
7187
|
+
}
|
|
7188
|
+
function _non_iterable_spread$c() {
|
|
7189
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
7190
|
+
}
|
|
7191
|
+
function _object_spread$e(target) {
|
|
7192
|
+
for(var i = 1; i < arguments.length; i++){
|
|
7193
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
7194
|
+
var ownKeys = Object.keys(source);
|
|
7195
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
7196
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
7197
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
7198
|
+
}));
|
|
7199
|
+
}
|
|
7200
|
+
ownKeys.forEach(function(key) {
|
|
7201
|
+
_define_property$e(target, key, source[key]);
|
|
7202
|
+
});
|
|
7203
|
+
}
|
|
7204
|
+
return target;
|
|
7205
|
+
}
|
|
7206
|
+
function ownKeys$d(object, enumerableOnly) {
|
|
7207
|
+
var keys = Object.keys(object);
|
|
7208
|
+
if (Object.getOwnPropertySymbols) {
|
|
7209
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
7210
|
+
keys.push.apply(keys, symbols);
|
|
7211
|
+
}
|
|
7212
|
+
return keys;
|
|
7213
|
+
}
|
|
7214
|
+
function _object_spread_props$d(target, source) {
|
|
7215
|
+
source = source != null ? source : {};
|
|
7216
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
7217
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
7218
|
+
} else {
|
|
7219
|
+
ownKeys$d(Object(source)).forEach(function(key) {
|
|
7220
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
7221
|
+
});
|
|
7222
|
+
}
|
|
7223
|
+
return target;
|
|
7224
|
+
}
|
|
7225
|
+
function _to_consumable_array$c(arr) {
|
|
7226
|
+
return _array_without_holes$c(arr) || _iterable_to_array$c(arr) || _unsupported_iterable_to_array$c(arr) || _non_iterable_spread$c();
|
|
7227
|
+
}
|
|
7228
|
+
function _unsupported_iterable_to_array$c(o, minLen) {
|
|
7229
|
+
if (!o) return;
|
|
7230
|
+
if (typeof o === "string") return _array_like_to_array$c(o, minLen);
|
|
7231
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
7232
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
7233
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
7234
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$c(o, minLen);
|
|
7235
|
+
}
|
|
7236
|
+
function parseArrayDef(def, refs) {
|
|
7237
|
+
var _def_type, _def_type__def, _def_type1;
|
|
7238
|
+
var res = {
|
|
7239
|
+
type: "array"
|
|
7240
|
+
};
|
|
7241
|
+
if (((_def_type = def.type) === null || _def_type === void 0 ? void 0 : _def_type._def) && ((_def_type1 = def.type) === null || _def_type1 === void 0 ? void 0 : (_def_type__def = _def_type1._def) === null || _def_type__def === void 0 ? void 0 : _def_type__def.typeName) !== ZodFirstPartyTypeKind.ZodAny) {
|
|
7242
|
+
res.items = parseDef(def.type._def, _object_spread_props$d(_object_spread$e({}, refs), {
|
|
7243
|
+
currentPath: _to_consumable_array$c(refs.currentPath).concat([
|
|
7244
|
+
"items"
|
|
7245
|
+
])
|
|
7246
|
+
}));
|
|
7247
|
+
}
|
|
7248
|
+
if (def.minLength) {
|
|
7249
|
+
setResponseValueAndErrors(res, "minItems", def.minLength.value, def.minLength.message, refs);
|
|
7250
|
+
}
|
|
7251
|
+
if (def.maxLength) {
|
|
7252
|
+
setResponseValueAndErrors(res, "maxItems", def.maxLength.value, def.maxLength.message, refs);
|
|
7253
|
+
}
|
|
7254
|
+
if (def.exactLength) {
|
|
7255
|
+
setResponseValueAndErrors(res, "minItems", def.exactLength.value, def.exactLength.message, refs);
|
|
7256
|
+
setResponseValueAndErrors(res, "maxItems", def.exactLength.value, def.exactLength.message, refs);
|
|
7257
|
+
}
|
|
7258
|
+
return res;
|
|
7259
|
+
}
|
|
7260
|
+
|
|
7261
|
+
function parseBigintDef(def, refs) {
|
|
7262
|
+
var res = {
|
|
7263
|
+
type: "integer",
|
|
7264
|
+
format: "int64"
|
|
7265
|
+
};
|
|
7266
|
+
if (!def.checks) return res;
|
|
7267
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
7268
|
+
try {
|
|
7269
|
+
for(var _iterator = def.checks[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
7270
|
+
var check = _step.value;
|
|
7271
|
+
switch(check.kind){
|
|
7272
|
+
case "min":
|
|
7273
|
+
if (refs.target === "jsonSchema7") {
|
|
7274
|
+
if (check.inclusive) {
|
|
7275
|
+
setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
|
|
7276
|
+
} else {
|
|
7277
|
+
setResponseValueAndErrors(res, "exclusiveMinimum", check.value, check.message, refs);
|
|
7278
|
+
}
|
|
7279
|
+
} else {
|
|
7280
|
+
if (!check.inclusive) {
|
|
7281
|
+
res.exclusiveMinimum = true;
|
|
7282
|
+
}
|
|
7283
|
+
setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
|
|
7284
|
+
}
|
|
7285
|
+
break;
|
|
7286
|
+
case "max":
|
|
7287
|
+
if (refs.target === "jsonSchema7") {
|
|
7288
|
+
if (check.inclusive) {
|
|
7289
|
+
setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
|
|
7290
|
+
} else {
|
|
7291
|
+
setResponseValueAndErrors(res, "exclusiveMaximum", check.value, check.message, refs);
|
|
7292
|
+
}
|
|
7293
|
+
} else {
|
|
7294
|
+
if (!check.inclusive) {
|
|
7295
|
+
res.exclusiveMaximum = true;
|
|
7296
|
+
}
|
|
7297
|
+
setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
|
|
7298
|
+
}
|
|
7299
|
+
break;
|
|
7300
|
+
case "multipleOf":
|
|
7301
|
+
setResponseValueAndErrors(res, "multipleOf", check.value, check.message, refs);
|
|
7302
|
+
break;
|
|
7303
|
+
}
|
|
7304
|
+
}
|
|
7305
|
+
} catch (err) {
|
|
7306
|
+
_didIteratorError = true;
|
|
7307
|
+
_iteratorError = err;
|
|
7308
|
+
} finally{
|
|
7309
|
+
try {
|
|
7310
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
7311
|
+
_iterator.return();
|
|
7312
|
+
}
|
|
7313
|
+
} finally{
|
|
7314
|
+
if (_didIteratorError) {
|
|
7315
|
+
throw _iteratorError;
|
|
7316
|
+
}
|
|
7317
|
+
}
|
|
7318
|
+
}
|
|
7319
|
+
return res;
|
|
7320
|
+
}
|
|
7321
|
+
|
|
7322
|
+
function parseBooleanDef() {
|
|
7323
|
+
return {
|
|
7324
|
+
type: "boolean"
|
|
7325
|
+
};
|
|
7326
|
+
}
|
|
7327
|
+
|
|
7328
|
+
function parseBrandedDef(_def, refs) {
|
|
7329
|
+
return parseDef(_def.type._def, refs);
|
|
7330
|
+
}
|
|
7331
|
+
|
|
7332
|
+
var parseCatchDef = function(def, refs) {
|
|
7333
|
+
return parseDef(def.innerType._def, refs);
|
|
7334
|
+
};
|
|
7335
|
+
|
|
7336
|
+
function parseDateDef(def, refs, overrideDateStrategy) {
|
|
7337
|
+
var strategy = overrideDateStrategy !== null && overrideDateStrategy !== void 0 ? overrideDateStrategy : refs.dateStrategy;
|
|
7338
|
+
if (Array.isArray(strategy)) {
|
|
7339
|
+
return {
|
|
7340
|
+
anyOf: strategy.map(function(item, i) {
|
|
7341
|
+
return parseDateDef(def, refs, item);
|
|
7342
|
+
})
|
|
7343
|
+
};
|
|
7344
|
+
}
|
|
7345
|
+
switch(strategy){
|
|
7346
|
+
case "string":
|
|
7347
|
+
case "format:date-time":
|
|
7348
|
+
return {
|
|
7349
|
+
type: "string",
|
|
7350
|
+
format: "date-time"
|
|
7351
|
+
};
|
|
7352
|
+
case "format:date":
|
|
7353
|
+
return {
|
|
7354
|
+
type: "string",
|
|
7355
|
+
format: "date"
|
|
7356
|
+
};
|
|
7357
|
+
case "integer":
|
|
7358
|
+
return integerDateParser(def, refs);
|
|
7359
|
+
}
|
|
7360
|
+
}
|
|
7361
|
+
var integerDateParser = function(def, refs) {
|
|
7362
|
+
var res = {
|
|
7363
|
+
type: "integer",
|
|
7364
|
+
format: "unix-time"
|
|
7365
|
+
};
|
|
7366
|
+
if (refs.target === "openApi3") {
|
|
7367
|
+
return res;
|
|
7368
|
+
}
|
|
7369
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
7370
|
+
try {
|
|
7371
|
+
for(var _iterator = def.checks[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
7372
|
+
var check = _step.value;
|
|
7373
|
+
switch(check.kind){
|
|
7374
|
+
case "min":
|
|
7375
|
+
setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
|
|
7376
|
+
break;
|
|
7377
|
+
case "max":
|
|
7378
|
+
setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
|
|
7379
|
+
break;
|
|
7380
|
+
}
|
|
7381
|
+
}
|
|
7382
|
+
} catch (err) {
|
|
7383
|
+
_didIteratorError = true;
|
|
7384
|
+
_iteratorError = err;
|
|
7385
|
+
} finally{
|
|
7386
|
+
try {
|
|
7387
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
7388
|
+
_iterator.return();
|
|
7389
|
+
}
|
|
7390
|
+
} finally{
|
|
7391
|
+
if (_didIteratorError) {
|
|
7392
|
+
throw _iteratorError;
|
|
7393
|
+
}
|
|
7394
|
+
}
|
|
7395
|
+
}
|
|
7396
|
+
return res;
|
|
7397
|
+
};
|
|
7398
|
+
|
|
7399
|
+
function _define_property$d(obj, key, value) {
|
|
7400
|
+
if (key in obj) {
|
|
7401
|
+
Object.defineProperty(obj, key, {
|
|
7402
|
+
value: value,
|
|
7403
|
+
enumerable: true,
|
|
7404
|
+
configurable: true,
|
|
7405
|
+
writable: true
|
|
7406
|
+
});
|
|
7407
|
+
} else {
|
|
7408
|
+
obj[key] = value;
|
|
7409
|
+
}
|
|
7410
|
+
return obj;
|
|
7411
|
+
}
|
|
7412
|
+
function _object_spread$d(target) {
|
|
7413
|
+
for(var i = 1; i < arguments.length; i++){
|
|
7414
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
7415
|
+
var ownKeys = Object.keys(source);
|
|
7416
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
7417
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
7418
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
7419
|
+
}));
|
|
7420
|
+
}
|
|
7421
|
+
ownKeys.forEach(function(key) {
|
|
7422
|
+
_define_property$d(target, key, source[key]);
|
|
7423
|
+
});
|
|
7424
|
+
}
|
|
7425
|
+
return target;
|
|
7426
|
+
}
|
|
7427
|
+
function ownKeys$c(object, enumerableOnly) {
|
|
7428
|
+
var keys = Object.keys(object);
|
|
7429
|
+
if (Object.getOwnPropertySymbols) {
|
|
7430
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
7431
|
+
keys.push.apply(keys, symbols);
|
|
7432
|
+
}
|
|
7433
|
+
return keys;
|
|
7434
|
+
}
|
|
7435
|
+
function _object_spread_props$c(target, source) {
|
|
7436
|
+
source = source != null ? source : {};
|
|
7437
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
7438
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
7439
|
+
} else {
|
|
7440
|
+
ownKeys$c(Object(source)).forEach(function(key) {
|
|
7441
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
7442
|
+
});
|
|
7443
|
+
}
|
|
7444
|
+
return target;
|
|
7445
|
+
}
|
|
7446
|
+
function parseDefaultDef(_def, refs) {
|
|
7447
|
+
return _object_spread_props$c(_object_spread$d({}, parseDef(_def.innerType._def, refs)), {
|
|
7448
|
+
default: _def.defaultValue()
|
|
7449
|
+
});
|
|
7450
|
+
}
|
|
7451
|
+
|
|
7452
|
+
function parseEffectsDef(_def, refs) {
|
|
7453
|
+
return refs.effectStrategy === "input" ? parseDef(_def.schema._def, refs) : parseAnyDef(refs);
|
|
7454
|
+
}
|
|
7455
|
+
|
|
7456
|
+
function parseEnumDef(def) {
|
|
7457
|
+
return {
|
|
7458
|
+
type: "string",
|
|
7459
|
+
enum: Array.from(def.values)
|
|
7460
|
+
};
|
|
7461
|
+
}
|
|
7462
|
+
|
|
7463
|
+
function _array_like_to_array$b(arr, len) {
|
|
7464
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
7465
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
7466
|
+
return arr2;
|
|
7467
|
+
}
|
|
7468
|
+
function _array_without_holes$b(arr) {
|
|
7469
|
+
if (Array.isArray(arr)) return _array_like_to_array$b(arr);
|
|
7470
|
+
}
|
|
7471
|
+
function _define_property$c(obj, key, value) {
|
|
7472
|
+
if (key in obj) {
|
|
7473
|
+
Object.defineProperty(obj, key, {
|
|
7474
|
+
value: value,
|
|
7475
|
+
enumerable: true,
|
|
7476
|
+
configurable: true,
|
|
7477
|
+
writable: true
|
|
7478
|
+
});
|
|
7479
|
+
} else {
|
|
7480
|
+
obj[key] = value;
|
|
7481
|
+
}
|
|
7482
|
+
return obj;
|
|
7483
|
+
}
|
|
7484
|
+
function _iterable_to_array$b(iter) {
|
|
7485
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
7486
|
+
}
|
|
7487
|
+
function _non_iterable_spread$b() {
|
|
7488
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
7489
|
+
}
|
|
7490
|
+
function _object_spread$c(target) {
|
|
7491
|
+
for(var i = 1; i < arguments.length; i++){
|
|
7492
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
7493
|
+
var ownKeys = Object.keys(source);
|
|
7494
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
7495
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
7496
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
7497
|
+
}));
|
|
7498
|
+
}
|
|
7499
|
+
ownKeys.forEach(function(key) {
|
|
7500
|
+
_define_property$c(target, key, source[key]);
|
|
7501
|
+
});
|
|
7502
|
+
}
|
|
7503
|
+
return target;
|
|
7504
|
+
}
|
|
7505
|
+
function ownKeys$b(object, enumerableOnly) {
|
|
7506
|
+
var keys = Object.keys(object);
|
|
7507
|
+
if (Object.getOwnPropertySymbols) {
|
|
7508
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
7509
|
+
keys.push.apply(keys, symbols);
|
|
7510
|
+
}
|
|
7511
|
+
return keys;
|
|
7512
|
+
}
|
|
7513
|
+
function _object_spread_props$b(target, source) {
|
|
7514
|
+
source = source != null ? source : {};
|
|
7515
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
7516
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
7517
|
+
} else {
|
|
7518
|
+
ownKeys$b(Object(source)).forEach(function(key) {
|
|
7519
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
7520
|
+
});
|
|
7521
|
+
}
|
|
7522
|
+
return target;
|
|
7523
|
+
}
|
|
7524
|
+
function _object_without_properties$1(source, excluded) {
|
|
7525
|
+
if (source == null) return {};
|
|
7526
|
+
var target = _object_without_properties_loose$1(source, excluded);
|
|
7527
|
+
var key, i;
|
|
7528
|
+
if (Object.getOwnPropertySymbols) {
|
|
7529
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
7530
|
+
for(i = 0; i < sourceSymbolKeys.length; i++){
|
|
7531
|
+
key = sourceSymbolKeys[i];
|
|
7532
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
7533
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
7534
|
+
target[key] = source[key];
|
|
7535
|
+
}
|
|
7536
|
+
}
|
|
7537
|
+
return target;
|
|
7538
|
+
}
|
|
7539
|
+
function _object_without_properties_loose$1(source, excluded) {
|
|
7540
|
+
if (source == null) return {};
|
|
7541
|
+
var target = {};
|
|
7542
|
+
var sourceKeys = Object.keys(source);
|
|
7543
|
+
var key, i;
|
|
7544
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
7545
|
+
key = sourceKeys[i];
|
|
7546
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
7547
|
+
target[key] = source[key];
|
|
7548
|
+
}
|
|
7549
|
+
return target;
|
|
7550
|
+
}
|
|
7551
|
+
function _to_consumable_array$b(arr) {
|
|
7552
|
+
return _array_without_holes$b(arr) || _iterable_to_array$b(arr) || _unsupported_iterable_to_array$b(arr) || _non_iterable_spread$b();
|
|
7553
|
+
}
|
|
7554
|
+
function _unsupported_iterable_to_array$b(o, minLen) {
|
|
7555
|
+
if (!o) return;
|
|
7556
|
+
if (typeof o === "string") return _array_like_to_array$b(o, minLen);
|
|
7557
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
7558
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
7559
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
7560
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$b(o, minLen);
|
|
7561
|
+
}
|
|
7562
|
+
var isJsonSchema7AllOfType = function(type) {
|
|
7563
|
+
if ("type" in type && type.type === "string") return false;
|
|
7564
|
+
return "allOf" in type;
|
|
7565
|
+
};
|
|
7566
|
+
function parseIntersectionDef(def, refs) {
|
|
7567
|
+
var allOf = [
|
|
7568
|
+
parseDef(def.left._def, _object_spread_props$b(_object_spread$c({}, refs), {
|
|
7569
|
+
currentPath: _to_consumable_array$b(refs.currentPath).concat([
|
|
7570
|
+
"allOf",
|
|
7571
|
+
"0"
|
|
7572
|
+
])
|
|
7573
|
+
})),
|
|
7574
|
+
parseDef(def.right._def, _object_spread_props$b(_object_spread$c({}, refs), {
|
|
7575
|
+
currentPath: _to_consumable_array$b(refs.currentPath).concat([
|
|
7576
|
+
"allOf",
|
|
7577
|
+
"1"
|
|
7578
|
+
])
|
|
7579
|
+
}))
|
|
7580
|
+
].filter(function(x) {
|
|
7581
|
+
return !!x;
|
|
7582
|
+
});
|
|
7583
|
+
var unevaluatedProperties = refs.target === "jsonSchema2019-09" ? {
|
|
7584
|
+
unevaluatedProperties: false
|
|
7585
|
+
} : undefined;
|
|
7586
|
+
var mergedAllOf = [];
|
|
7587
|
+
// If either of the schemas is an allOf, merge them into a single allOf
|
|
7588
|
+
allOf.forEach(function(schema) {
|
|
7589
|
+
if (isJsonSchema7AllOfType(schema)) {
|
|
7590
|
+
var _mergedAllOf;
|
|
7591
|
+
(_mergedAllOf = mergedAllOf).push.apply(_mergedAllOf, _to_consumable_array$b(schema.allOf));
|
|
7592
|
+
if (schema.unevaluatedProperties === undefined) {
|
|
7593
|
+
// If one of the schemas has no unevaluatedProperties set,
|
|
7594
|
+
// the merged schema should also have no unevaluatedProperties set
|
|
7595
|
+
unevaluatedProperties = undefined;
|
|
7596
|
+
}
|
|
7597
|
+
} else {
|
|
7598
|
+
var nestedSchema = schema;
|
|
7599
|
+
if ("additionalProperties" in schema && schema.additionalProperties === false) {
|
|
7600
|
+
schema.additionalProperties; var rest = _object_without_properties$1(schema, [
|
|
7601
|
+
"additionalProperties"
|
|
7602
|
+
]);
|
|
7603
|
+
nestedSchema = rest;
|
|
7604
|
+
} else {
|
|
7605
|
+
// As soon as one of the schemas has additionalProperties set not to false, we allow unevaluatedProperties
|
|
7606
|
+
unevaluatedProperties = undefined;
|
|
7607
|
+
}
|
|
7608
|
+
mergedAllOf.push(nestedSchema);
|
|
7609
|
+
}
|
|
7610
|
+
});
|
|
7611
|
+
return mergedAllOf.length ? _object_spread$c({
|
|
7612
|
+
allOf: mergedAllOf
|
|
7613
|
+
}, unevaluatedProperties) : undefined;
|
|
7614
|
+
}
|
|
7615
|
+
|
|
7616
|
+
function _type_of$2(obj) {
|
|
7617
|
+
"@swc/helpers - typeof";
|
|
7618
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
7619
|
+
}
|
|
7620
|
+
function parseLiteralDef(def, refs) {
|
|
7621
|
+
var parsedType = _type_of$2(def.value);
|
|
7622
|
+
if (parsedType !== "bigint" && parsedType !== "number" && parsedType !== "boolean" && parsedType !== "string") {
|
|
7623
|
+
return {
|
|
7624
|
+
type: Array.isArray(def.value) ? "array" : "object"
|
|
7625
|
+
};
|
|
7626
|
+
}
|
|
7627
|
+
if (refs.target === "openApi3") {
|
|
7628
|
+
return {
|
|
7629
|
+
type: parsedType === "bigint" ? "integer" : parsedType,
|
|
7630
|
+
enum: [
|
|
7631
|
+
def.value
|
|
7632
|
+
]
|
|
7633
|
+
};
|
|
7634
|
+
}
|
|
7635
|
+
return {
|
|
7636
|
+
type: parsedType === "bigint" ? "integer" : parsedType,
|
|
7637
|
+
const: def.value
|
|
7638
|
+
};
|
|
7639
|
+
}
|
|
7640
|
+
|
|
7641
|
+
function _define_property$b(obj, key, value) {
|
|
7642
|
+
if (key in obj) {
|
|
7643
|
+
Object.defineProperty(obj, key, {
|
|
7644
|
+
value: value,
|
|
7645
|
+
enumerable: true,
|
|
7646
|
+
configurable: true,
|
|
7647
|
+
writable: true
|
|
7648
|
+
});
|
|
7649
|
+
} else {
|
|
7650
|
+
obj[key] = value;
|
|
7651
|
+
}
|
|
7652
|
+
return obj;
|
|
7653
|
+
}
|
|
7654
|
+
function _object_spread$b(target) {
|
|
7655
|
+
for(var i = 1; i < arguments.length; i++){
|
|
7656
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
7657
|
+
var ownKeys = Object.keys(source);
|
|
7658
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
7659
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
7660
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
7661
|
+
}));
|
|
7662
|
+
}
|
|
7663
|
+
ownKeys.forEach(function(key) {
|
|
7664
|
+
_define_property$b(target, key, source[key]);
|
|
7665
|
+
});
|
|
7666
|
+
}
|
|
7667
|
+
return target;
|
|
7668
|
+
}
|
|
7669
|
+
var emojiRegex = undefined;
|
|
7670
|
+
/**
|
|
7671
|
+
* Generated from the regular expressions found here as of 2024-05-22:
|
|
7672
|
+
* https://github.com/colinhacks/zod/blob/master/src/types.ts.
|
|
7673
|
+
*
|
|
7674
|
+
* Expressions with /i flag have been changed accordingly.
|
|
7675
|
+
*/ var zodPatterns = {
|
|
7676
|
+
/**
|
|
7677
|
+
* `c` was changed to `[cC]` to replicate /i flag
|
|
7678
|
+
*/ cuid: /^[cC][^\s-]{8,}$/,
|
|
7679
|
+
cuid2: /^[0-9a-z]+$/,
|
|
7680
|
+
ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
|
|
7681
|
+
/**
|
|
7682
|
+
* `a-z` was added to replicate /i flag
|
|
7683
|
+
*/ email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,
|
|
7684
|
+
/**
|
|
7685
|
+
* Constructed a valid Unicode RegExp
|
|
7686
|
+
*
|
|
7687
|
+
* Lazily instantiate since this type of regex isn't supported
|
|
7688
|
+
* in all envs (e.g. React Native).
|
|
7689
|
+
*
|
|
7690
|
+
* See:
|
|
7691
|
+
* https://github.com/colinhacks/zod/issues/2433
|
|
7692
|
+
* Fix in Zod:
|
|
7693
|
+
* https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b
|
|
7694
|
+
*/ emoji: function() {
|
|
7695
|
+
if (emojiRegex === undefined) {
|
|
7696
|
+
emojiRegex = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u");
|
|
7697
|
+
}
|
|
7698
|
+
return emojiRegex;
|
|
7699
|
+
},
|
|
7700
|
+
/**
|
|
7701
|
+
* Unused
|
|
7702
|
+
*/ 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}$/,
|
|
7703
|
+
/**
|
|
7704
|
+
* Unused
|
|
7705
|
+
*/ 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])$/,
|
|
7706
|
+
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])$/,
|
|
7707
|
+
/**
|
|
7708
|
+
* Unused
|
|
7709
|
+
*/ 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})))$/,
|
|
7710
|
+
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])$/,
|
|
7711
|
+
base64: /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,
|
|
7712
|
+
base64url: /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,
|
|
7713
|
+
nanoid: /^[a-zA-Z0-9_-]{21}$/,
|
|
7714
|
+
jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
|
|
7715
|
+
};
|
|
7716
|
+
function parseStringDef(def, refs) {
|
|
7717
|
+
var res = {
|
|
7718
|
+
type: "string"
|
|
7719
|
+
};
|
|
7720
|
+
if (def.checks) {
|
|
7721
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
7722
|
+
try {
|
|
7723
|
+
for(var _iterator = def.checks[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
7724
|
+
var check = _step.value;
|
|
7725
|
+
switch(check.kind){
|
|
7726
|
+
case "min":
|
|
7727
|
+
setResponseValueAndErrors(res, "minLength", typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value, check.message, refs);
|
|
7728
|
+
break;
|
|
7729
|
+
case "max":
|
|
7730
|
+
setResponseValueAndErrors(res, "maxLength", typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value, check.message, refs);
|
|
7731
|
+
break;
|
|
7732
|
+
case "email":
|
|
7733
|
+
switch(refs.emailStrategy){
|
|
7734
|
+
case "format:email":
|
|
7735
|
+
addFormat(res, "email", check.message, refs);
|
|
7736
|
+
break;
|
|
7737
|
+
case "format:idn-email":
|
|
7738
|
+
addFormat(res, "idn-email", check.message, refs);
|
|
7739
|
+
break;
|
|
7740
|
+
case "pattern:zod":
|
|
7741
|
+
addPattern(res, zodPatterns.email, check.message, refs);
|
|
7742
|
+
break;
|
|
7743
|
+
}
|
|
7744
|
+
break;
|
|
7745
|
+
case "url":
|
|
7746
|
+
addFormat(res, "uri", check.message, refs);
|
|
7747
|
+
break;
|
|
7748
|
+
case "uuid":
|
|
7749
|
+
addFormat(res, "uuid", check.message, refs);
|
|
7750
|
+
break;
|
|
7751
|
+
case "regex":
|
|
7752
|
+
addPattern(res, check.regex, check.message, refs);
|
|
7753
|
+
break;
|
|
7754
|
+
case "cuid":
|
|
7755
|
+
addPattern(res, zodPatterns.cuid, check.message, refs);
|
|
7756
|
+
break;
|
|
7757
|
+
case "cuid2":
|
|
7758
|
+
addPattern(res, zodPatterns.cuid2, check.message, refs);
|
|
7759
|
+
break;
|
|
7760
|
+
case "startsWith":
|
|
7761
|
+
addPattern(res, RegExp("^".concat(escapeLiteralCheckValue(check.value, refs))), check.message, refs);
|
|
7762
|
+
break;
|
|
7763
|
+
case "endsWith":
|
|
7764
|
+
addPattern(res, RegExp("".concat(escapeLiteralCheckValue(check.value, refs), "$")), check.message, refs);
|
|
7765
|
+
break;
|
|
7766
|
+
case "datetime":
|
|
7767
|
+
addFormat(res, "date-time", check.message, refs);
|
|
7768
|
+
break;
|
|
7769
|
+
case "date":
|
|
7770
|
+
addFormat(res, "date", check.message, refs);
|
|
7771
|
+
break;
|
|
7772
|
+
case "time":
|
|
7773
|
+
addFormat(res, "time", check.message, refs);
|
|
7774
|
+
break;
|
|
7775
|
+
case "duration":
|
|
7776
|
+
addFormat(res, "duration", check.message, refs);
|
|
7777
|
+
break;
|
|
7778
|
+
case "length":
|
|
7779
|
+
setResponseValueAndErrors(res, "minLength", typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value, check.message, refs);
|
|
7780
|
+
setResponseValueAndErrors(res, "maxLength", typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value, check.message, refs);
|
|
7781
|
+
break;
|
|
7782
|
+
case "includes":
|
|
7783
|
+
{
|
|
7784
|
+
addPattern(res, RegExp(escapeLiteralCheckValue(check.value, refs)), check.message, refs);
|
|
7785
|
+
break;
|
|
7786
|
+
}
|
|
7787
|
+
case "ip":
|
|
7788
|
+
{
|
|
7789
|
+
if (check.version !== "v6") {
|
|
7790
|
+
addFormat(res, "ipv4", check.message, refs);
|
|
7791
|
+
}
|
|
7792
|
+
if (check.version !== "v4") {
|
|
7793
|
+
addFormat(res, "ipv6", check.message, refs);
|
|
7794
|
+
}
|
|
7795
|
+
break;
|
|
7796
|
+
}
|
|
7797
|
+
case "base64url":
|
|
7798
|
+
addPattern(res, zodPatterns.base64url, check.message, refs);
|
|
7799
|
+
break;
|
|
7800
|
+
case "jwt":
|
|
7801
|
+
addPattern(res, zodPatterns.jwt, check.message, refs);
|
|
7802
|
+
break;
|
|
7803
|
+
case "cidr":
|
|
7804
|
+
{
|
|
7805
|
+
if (check.version !== "v6") {
|
|
7806
|
+
addPattern(res, zodPatterns.ipv4Cidr, check.message, refs);
|
|
7807
|
+
}
|
|
7808
|
+
if (check.version !== "v4") {
|
|
7809
|
+
addPattern(res, zodPatterns.ipv6Cidr, check.message, refs);
|
|
7810
|
+
}
|
|
7811
|
+
break;
|
|
7812
|
+
}
|
|
7813
|
+
case "emoji":
|
|
7814
|
+
addPattern(res, zodPatterns.emoji(), check.message, refs);
|
|
7815
|
+
break;
|
|
7816
|
+
case "ulid":
|
|
7817
|
+
{
|
|
7818
|
+
addPattern(res, zodPatterns.ulid, check.message, refs);
|
|
7819
|
+
break;
|
|
7820
|
+
}
|
|
7821
|
+
case "base64":
|
|
7822
|
+
{
|
|
7823
|
+
switch(refs.base64Strategy){
|
|
7824
|
+
case "format:binary":
|
|
7825
|
+
{
|
|
7826
|
+
addFormat(res, "binary", check.message, refs);
|
|
7827
|
+
break;
|
|
7828
|
+
}
|
|
7829
|
+
case "contentEncoding:base64":
|
|
7830
|
+
{
|
|
7831
|
+
setResponseValueAndErrors(res, "contentEncoding", "base64", check.message, refs);
|
|
7832
|
+
break;
|
|
7833
|
+
}
|
|
7834
|
+
case "pattern:zod":
|
|
7835
|
+
{
|
|
7836
|
+
addPattern(res, zodPatterns.base64, check.message, refs);
|
|
7837
|
+
break;
|
|
7838
|
+
}
|
|
7839
|
+
}
|
|
7840
|
+
break;
|
|
7841
|
+
}
|
|
7842
|
+
case "nanoid":
|
|
7843
|
+
{
|
|
7844
|
+
addPattern(res, zodPatterns.nanoid, check.message, refs);
|
|
7845
|
+
}
|
|
7846
|
+
case "toLowerCase":
|
|
7847
|
+
case "toUpperCase":
|
|
7848
|
+
case "trim":
|
|
7849
|
+
break;
|
|
7850
|
+
default:
|
|
7851
|
+
(function(_) {})(check);
|
|
7852
|
+
}
|
|
7853
|
+
}
|
|
7854
|
+
} catch (err) {
|
|
7855
|
+
_didIteratorError = true;
|
|
7856
|
+
_iteratorError = err;
|
|
7857
|
+
} finally{
|
|
7858
|
+
try {
|
|
7859
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
7860
|
+
_iterator.return();
|
|
7861
|
+
}
|
|
7862
|
+
} finally{
|
|
7863
|
+
if (_didIteratorError) {
|
|
7864
|
+
throw _iteratorError;
|
|
7865
|
+
}
|
|
7866
|
+
}
|
|
7867
|
+
}
|
|
7868
|
+
}
|
|
7869
|
+
return res;
|
|
7870
|
+
}
|
|
7871
|
+
function escapeLiteralCheckValue(literal, refs) {
|
|
7872
|
+
return refs.patternStrategy === "escape" ? escapeNonAlphaNumeric(literal) : literal;
|
|
7873
|
+
}
|
|
7874
|
+
var ALPHA_NUMERIC = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
|
|
7875
|
+
function escapeNonAlphaNumeric(source) {
|
|
7876
|
+
var result = "";
|
|
7877
|
+
for(var i = 0; i < source.length; i++){
|
|
7878
|
+
if (!ALPHA_NUMERIC.has(source[i])) {
|
|
7879
|
+
result += "\\";
|
|
7880
|
+
}
|
|
7881
|
+
result += source[i];
|
|
7882
|
+
}
|
|
7883
|
+
return result;
|
|
7884
|
+
}
|
|
7885
|
+
// Adds a "format" keyword to the schema. If a format exists, both formats will be joined in an allOf-node, along with subsequent ones.
|
|
7886
|
+
function addFormat(schema, value, message, refs) {
|
|
7887
|
+
var _schema_anyOf;
|
|
7888
|
+
if (schema.format || ((_schema_anyOf = schema.anyOf) === null || _schema_anyOf === void 0 ? void 0 : _schema_anyOf.some(function(x) {
|
|
7889
|
+
return x.format;
|
|
7890
|
+
}))) {
|
|
7891
|
+
if (!schema.anyOf) {
|
|
7892
|
+
schema.anyOf = [];
|
|
7893
|
+
}
|
|
7894
|
+
if (schema.format) {
|
|
7895
|
+
schema.anyOf.push(_object_spread$b({
|
|
7896
|
+
format: schema.format
|
|
7897
|
+
}, schema.errorMessage && refs.errorMessages && {
|
|
7898
|
+
errorMessage: {
|
|
7899
|
+
format: schema.errorMessage.format
|
|
7900
|
+
}
|
|
7901
|
+
}));
|
|
7902
|
+
delete schema.format;
|
|
7903
|
+
if (schema.errorMessage) {
|
|
7904
|
+
delete schema.errorMessage.format;
|
|
7905
|
+
if (Object.keys(schema.errorMessage).length === 0) {
|
|
7906
|
+
delete schema.errorMessage;
|
|
7907
|
+
}
|
|
7908
|
+
}
|
|
7909
|
+
}
|
|
7910
|
+
schema.anyOf.push(_object_spread$b({
|
|
7911
|
+
format: value
|
|
7912
|
+
}, message && refs.errorMessages && {
|
|
7913
|
+
errorMessage: {
|
|
7914
|
+
format: message
|
|
7915
|
+
}
|
|
7916
|
+
}));
|
|
7917
|
+
} else {
|
|
7918
|
+
setResponseValueAndErrors(schema, "format", value, message, refs);
|
|
7919
|
+
}
|
|
7920
|
+
}
|
|
7921
|
+
// Adds a "pattern" keyword to the schema. If a pattern exists, both patterns will be joined in an allOf-node, along with subsequent ones.
|
|
7922
|
+
function addPattern(schema, regex, message, refs) {
|
|
7923
|
+
var _schema_allOf;
|
|
7924
|
+
if (schema.pattern || ((_schema_allOf = schema.allOf) === null || _schema_allOf === void 0 ? void 0 : _schema_allOf.some(function(x) {
|
|
7925
|
+
return x.pattern;
|
|
7926
|
+
}))) {
|
|
7927
|
+
if (!schema.allOf) {
|
|
7928
|
+
schema.allOf = [];
|
|
7929
|
+
}
|
|
7930
|
+
if (schema.pattern) {
|
|
7931
|
+
schema.allOf.push(_object_spread$b({
|
|
7932
|
+
pattern: schema.pattern
|
|
7933
|
+
}, schema.errorMessage && refs.errorMessages && {
|
|
7934
|
+
errorMessage: {
|
|
7935
|
+
pattern: schema.errorMessage.pattern
|
|
7936
|
+
}
|
|
7937
|
+
}));
|
|
7938
|
+
delete schema.pattern;
|
|
7939
|
+
if (schema.errorMessage) {
|
|
7940
|
+
delete schema.errorMessage.pattern;
|
|
7941
|
+
if (Object.keys(schema.errorMessage).length === 0) {
|
|
7942
|
+
delete schema.errorMessage;
|
|
7943
|
+
}
|
|
7944
|
+
}
|
|
7945
|
+
}
|
|
7946
|
+
schema.allOf.push(_object_spread$b({
|
|
7947
|
+
pattern: stringifyRegExpWithFlags(regex, refs)
|
|
7948
|
+
}, message && refs.errorMessages && {
|
|
7949
|
+
errorMessage: {
|
|
7950
|
+
pattern: message
|
|
7951
|
+
}
|
|
7952
|
+
}));
|
|
7953
|
+
} else {
|
|
7954
|
+
setResponseValueAndErrors(schema, "pattern", stringifyRegExpWithFlags(regex, refs), message, refs);
|
|
7955
|
+
}
|
|
7956
|
+
}
|
|
7957
|
+
// Mutate z.string.regex() in a best attempt to accommodate for regex flags when applyRegexFlags is true
|
|
7958
|
+
function stringifyRegExpWithFlags(regex, refs) {
|
|
7959
|
+
if (!refs.applyRegexFlags || !regex.flags) {
|
|
7960
|
+
return regex.source;
|
|
7961
|
+
}
|
|
7962
|
+
// Currently handled flags
|
|
7963
|
+
var flags = {
|
|
7964
|
+
i: regex.flags.includes("i"),
|
|
7965
|
+
m: regex.flags.includes("m"),
|
|
7966
|
+
s: regex.flags.includes("s")
|
|
7967
|
+
};
|
|
7968
|
+
// The general principle here is to step through each character, one at a time, applying mutations as flags require. We keep track when the current character is escaped, and when it's inside a group /like [this]/ or (also) a range like /[a-z]/. The following is fairly brittle imperative code; edit at your peril!
|
|
7969
|
+
var source = flags.i ? regex.source.toLowerCase() : regex.source;
|
|
7970
|
+
var pattern = "";
|
|
7971
|
+
var isEscaped = false;
|
|
7972
|
+
var inCharGroup = false;
|
|
7973
|
+
var inCharRange = false;
|
|
7974
|
+
for(var i = 0; i < source.length; i++){
|
|
7975
|
+
if (isEscaped) {
|
|
7976
|
+
pattern += source[i];
|
|
7977
|
+
isEscaped = false;
|
|
7978
|
+
continue;
|
|
7979
|
+
}
|
|
7980
|
+
if (flags.i) {
|
|
7981
|
+
if (inCharGroup) {
|
|
7982
|
+
if (source[i].match(/[a-z]/)) {
|
|
7983
|
+
var _source_;
|
|
7984
|
+
if (inCharRange) {
|
|
7985
|
+
pattern += source[i];
|
|
7986
|
+
pattern += "".concat(source[i - 2], "-").concat(source[i]).toUpperCase();
|
|
7987
|
+
inCharRange = false;
|
|
7988
|
+
} else if (source[i + 1] === "-" && ((_source_ = source[i + 2]) === null || _source_ === void 0 ? void 0 : _source_.match(/[a-z]/))) {
|
|
7989
|
+
pattern += source[i];
|
|
7990
|
+
inCharRange = true;
|
|
7991
|
+
} else {
|
|
7992
|
+
pattern += "".concat(source[i]).concat(source[i].toUpperCase());
|
|
7993
|
+
}
|
|
7994
|
+
continue;
|
|
7995
|
+
}
|
|
7996
|
+
} else if (source[i].match(/[a-z]/)) {
|
|
7997
|
+
pattern += "[".concat(source[i]).concat(source[i].toUpperCase(), "]");
|
|
7998
|
+
continue;
|
|
7999
|
+
}
|
|
8000
|
+
}
|
|
8001
|
+
if (flags.m) {
|
|
8002
|
+
if (source[i] === "^") {
|
|
8003
|
+
pattern += "(^|(?<=[\r\n]))";
|
|
8004
|
+
continue;
|
|
8005
|
+
} else if (source[i] === "$") {
|
|
8006
|
+
pattern += "($|(?=[\r\n]))";
|
|
8007
|
+
continue;
|
|
8008
|
+
}
|
|
8009
|
+
}
|
|
8010
|
+
if (flags.s && source[i] === ".") {
|
|
8011
|
+
pattern += inCharGroup ? "".concat(source[i], "\r\n") : "[".concat(source[i], "\r\n]");
|
|
8012
|
+
continue;
|
|
8013
|
+
}
|
|
8014
|
+
pattern += source[i];
|
|
8015
|
+
if (source[i] === "\\") {
|
|
8016
|
+
isEscaped = true;
|
|
8017
|
+
} else if (inCharGroup && source[i] === "]") {
|
|
8018
|
+
inCharGroup = false;
|
|
8019
|
+
} else if (!inCharGroup && source[i] === "[") {
|
|
8020
|
+
inCharGroup = true;
|
|
8021
|
+
}
|
|
8022
|
+
}
|
|
8023
|
+
try {
|
|
8024
|
+
new RegExp(pattern);
|
|
8025
|
+
} catch (e) {
|
|
8026
|
+
console.warn("Could not convert regex pattern at ".concat(refs.currentPath.join("/"), " to a flag-independent form! Falling back to the flag-ignorant source"));
|
|
8027
|
+
return regex.source;
|
|
8028
|
+
}
|
|
8029
|
+
return pattern;
|
|
8030
|
+
}
|
|
8031
|
+
|
|
8032
|
+
function _array_like_to_array$a(arr, len) {
|
|
8033
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
8034
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
8035
|
+
return arr2;
|
|
8036
|
+
}
|
|
8037
|
+
function _array_without_holes$a(arr) {
|
|
8038
|
+
if (Array.isArray(arr)) return _array_like_to_array$a(arr);
|
|
8039
|
+
}
|
|
8040
|
+
function _define_property$a(obj, key, value) {
|
|
8041
|
+
if (key in obj) {
|
|
8042
|
+
Object.defineProperty(obj, key, {
|
|
8043
|
+
value: value,
|
|
8044
|
+
enumerable: true,
|
|
8045
|
+
configurable: true,
|
|
8046
|
+
writable: true
|
|
8047
|
+
});
|
|
8048
|
+
} else {
|
|
8049
|
+
obj[key] = value;
|
|
8050
|
+
}
|
|
8051
|
+
return obj;
|
|
8052
|
+
}
|
|
8053
|
+
function _iterable_to_array$a(iter) {
|
|
8054
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
8055
|
+
}
|
|
8056
|
+
function _non_iterable_spread$a() {
|
|
8057
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
8058
|
+
}
|
|
8059
|
+
function _object_spread$a(target) {
|
|
8060
|
+
for(var i = 1; i < arguments.length; i++){
|
|
8061
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
8062
|
+
var ownKeys = Object.keys(source);
|
|
8063
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
8064
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
8065
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
8066
|
+
}));
|
|
8067
|
+
}
|
|
8068
|
+
ownKeys.forEach(function(key) {
|
|
8069
|
+
_define_property$a(target, key, source[key]);
|
|
8070
|
+
});
|
|
8071
|
+
}
|
|
8072
|
+
return target;
|
|
8073
|
+
}
|
|
8074
|
+
function ownKeys$a(object, enumerableOnly) {
|
|
8075
|
+
var keys = Object.keys(object);
|
|
8076
|
+
if (Object.getOwnPropertySymbols) {
|
|
8077
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
8078
|
+
keys.push.apply(keys, symbols);
|
|
8079
|
+
}
|
|
8080
|
+
return keys;
|
|
8081
|
+
}
|
|
8082
|
+
function _object_spread_props$a(target, source) {
|
|
8083
|
+
source = source != null ? source : {};
|
|
8084
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
8085
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
8086
|
+
} else {
|
|
8087
|
+
ownKeys$a(Object(source)).forEach(function(key) {
|
|
8088
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
8089
|
+
});
|
|
8090
|
+
}
|
|
8091
|
+
return target;
|
|
8092
|
+
}
|
|
8093
|
+
function _object_without_properties(source, excluded) {
|
|
8094
|
+
if (source == null) return {};
|
|
8095
|
+
var target = _object_without_properties_loose(source, excluded);
|
|
8096
|
+
var key, i;
|
|
8097
|
+
if (Object.getOwnPropertySymbols) {
|
|
8098
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
8099
|
+
for(i = 0; i < sourceSymbolKeys.length; i++){
|
|
8100
|
+
key = sourceSymbolKeys[i];
|
|
8101
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
8102
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
8103
|
+
target[key] = source[key];
|
|
8104
|
+
}
|
|
8105
|
+
}
|
|
8106
|
+
return target;
|
|
8107
|
+
}
|
|
8108
|
+
function _object_without_properties_loose(source, excluded) {
|
|
8109
|
+
if (source == null) return {};
|
|
8110
|
+
var target = {};
|
|
8111
|
+
var sourceKeys = Object.keys(source);
|
|
8112
|
+
var key, i;
|
|
8113
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
8114
|
+
key = sourceKeys[i];
|
|
8115
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
8116
|
+
target[key] = source[key];
|
|
8117
|
+
}
|
|
8118
|
+
return target;
|
|
8119
|
+
}
|
|
8120
|
+
function _to_consumable_array$a(arr) {
|
|
8121
|
+
return _array_without_holes$a(arr) || _iterable_to_array$a(arr) || _unsupported_iterable_to_array$a(arr) || _non_iterable_spread$a();
|
|
8122
|
+
}
|
|
8123
|
+
function _unsupported_iterable_to_array$a(o, minLen) {
|
|
8124
|
+
if (!o) return;
|
|
8125
|
+
if (typeof o === "string") return _array_like_to_array$a(o, minLen);
|
|
8126
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
8127
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
8128
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
8129
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$a(o, minLen);
|
|
8130
|
+
}
|
|
8131
|
+
function parseRecordDef(def, refs) {
|
|
8132
|
+
var _def_keyType, _def_keyType1, _def_keyType__def_checks, _def_keyType2, _def_keyType3, _def_keyType__def_type__def_checks;
|
|
8133
|
+
if (refs.target === "openAi") {
|
|
8134
|
+
console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");
|
|
8135
|
+
}
|
|
8136
|
+
if (refs.target === "openApi3" && ((_def_keyType = def.keyType) === null || _def_keyType === void 0 ? void 0 : _def_keyType._def.typeName) === ZodFirstPartyTypeKind.ZodEnum) {
|
|
8137
|
+
return {
|
|
8138
|
+
type: "object",
|
|
8139
|
+
required: def.keyType._def.values,
|
|
8140
|
+
properties: def.keyType._def.values.reduce(function(acc, key) {
|
|
8141
|
+
var _parseDef;
|
|
8142
|
+
return _object_spread_props$a(_object_spread$a({}, acc), _define_property$a({}, key, (_parseDef = parseDef(def.valueType._def, _object_spread_props$a(_object_spread$a({}, refs), {
|
|
8143
|
+
currentPath: _to_consumable_array$a(refs.currentPath).concat([
|
|
8144
|
+
"properties",
|
|
8145
|
+
key
|
|
8146
|
+
])
|
|
8147
|
+
}))) !== null && _parseDef !== void 0 ? _parseDef : parseAnyDef(refs)));
|
|
8148
|
+
}, {}),
|
|
8149
|
+
additionalProperties: refs.rejectedAdditionalProperties
|
|
8150
|
+
};
|
|
8151
|
+
}
|
|
8152
|
+
var _parseDef;
|
|
8153
|
+
var schema = {
|
|
8154
|
+
type: "object",
|
|
8155
|
+
additionalProperties: (_parseDef = parseDef(def.valueType._def, _object_spread_props$a(_object_spread$a({}, refs), {
|
|
8156
|
+
currentPath: _to_consumable_array$a(refs.currentPath).concat([
|
|
8157
|
+
"additionalProperties"
|
|
8158
|
+
])
|
|
8159
|
+
}))) !== null && _parseDef !== void 0 ? _parseDef : refs.allowedAdditionalProperties
|
|
8160
|
+
};
|
|
8161
|
+
if (refs.target === "openApi3") {
|
|
8162
|
+
return schema;
|
|
8163
|
+
}
|
|
8164
|
+
if (((_def_keyType1 = def.keyType) === null || _def_keyType1 === void 0 ? void 0 : _def_keyType1._def.typeName) === ZodFirstPartyTypeKind.ZodString && ((_def_keyType__def_checks = def.keyType._def.checks) === null || _def_keyType__def_checks === void 0 ? void 0 : _def_keyType__def_checks.length)) {
|
|
8165
|
+
var _parseStringDef = parseStringDef(def.keyType._def, refs); _parseStringDef.type; var keyType = _object_without_properties(_parseStringDef, [
|
|
8166
|
+
"type"
|
|
8167
|
+
]);
|
|
8168
|
+
return _object_spread_props$a(_object_spread$a({}, schema), {
|
|
8169
|
+
propertyNames: keyType
|
|
8170
|
+
});
|
|
8171
|
+
} else if (((_def_keyType2 = def.keyType) === null || _def_keyType2 === void 0 ? void 0 : _def_keyType2._def.typeName) === ZodFirstPartyTypeKind.ZodEnum) {
|
|
8172
|
+
return _object_spread_props$a(_object_spread$a({}, schema), {
|
|
8173
|
+
propertyNames: {
|
|
8174
|
+
enum: def.keyType._def.values
|
|
8175
|
+
}
|
|
8176
|
+
});
|
|
8177
|
+
} else if (((_def_keyType3 = def.keyType) === null || _def_keyType3 === void 0 ? void 0 : _def_keyType3._def.typeName) === ZodFirstPartyTypeKind.ZodBranded && def.keyType._def.type._def.typeName === ZodFirstPartyTypeKind.ZodString && ((_def_keyType__def_type__def_checks = def.keyType._def.type._def.checks) === null || _def_keyType__def_type__def_checks === void 0 ? void 0 : _def_keyType__def_type__def_checks.length)) {
|
|
8178
|
+
var _parseBrandedDef = parseBrandedDef(def.keyType._def, refs); _parseBrandedDef.type; var keyType1 = _object_without_properties(_parseBrandedDef, [
|
|
8179
|
+
"type"
|
|
8180
|
+
]);
|
|
8181
|
+
return _object_spread_props$a(_object_spread$a({}, schema), {
|
|
8182
|
+
propertyNames: keyType1
|
|
8183
|
+
});
|
|
8184
|
+
}
|
|
8185
|
+
return schema;
|
|
8186
|
+
}
|
|
8187
|
+
|
|
8188
|
+
function _array_like_to_array$9(arr, len) {
|
|
8189
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
8190
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
8191
|
+
return arr2;
|
|
8192
|
+
}
|
|
8193
|
+
function _array_without_holes$9(arr) {
|
|
8194
|
+
if (Array.isArray(arr)) return _array_like_to_array$9(arr);
|
|
8195
|
+
}
|
|
8196
|
+
function _define_property$9(obj, key, value) {
|
|
8197
|
+
if (key in obj) {
|
|
8198
|
+
Object.defineProperty(obj, key, {
|
|
8199
|
+
value: value,
|
|
8200
|
+
enumerable: true,
|
|
8201
|
+
configurable: true,
|
|
8202
|
+
writable: true
|
|
8203
|
+
});
|
|
8204
|
+
} else {
|
|
8205
|
+
obj[key] = value;
|
|
8206
|
+
}
|
|
8207
|
+
return obj;
|
|
8208
|
+
}
|
|
8209
|
+
function _iterable_to_array$9(iter) {
|
|
8210
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
8211
|
+
}
|
|
8212
|
+
function _non_iterable_spread$9() {
|
|
8213
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
8214
|
+
}
|
|
8215
|
+
function _object_spread$9(target) {
|
|
8216
|
+
for(var i = 1; i < arguments.length; i++){
|
|
8217
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
8218
|
+
var ownKeys = Object.keys(source);
|
|
8219
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
8220
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
8221
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
8222
|
+
}));
|
|
8223
|
+
}
|
|
8224
|
+
ownKeys.forEach(function(key) {
|
|
8225
|
+
_define_property$9(target, key, source[key]);
|
|
8226
|
+
});
|
|
8227
|
+
}
|
|
8228
|
+
return target;
|
|
8229
|
+
}
|
|
8230
|
+
function ownKeys$9(object, enumerableOnly) {
|
|
8231
|
+
var keys = Object.keys(object);
|
|
8232
|
+
if (Object.getOwnPropertySymbols) {
|
|
8233
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
8234
|
+
keys.push.apply(keys, symbols);
|
|
8235
|
+
}
|
|
8236
|
+
return keys;
|
|
8237
|
+
}
|
|
8238
|
+
function _object_spread_props$9(target, source) {
|
|
8239
|
+
source = source != null ? source : {};
|
|
8240
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
8241
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
8242
|
+
} else {
|
|
8243
|
+
ownKeys$9(Object(source)).forEach(function(key) {
|
|
8244
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
8245
|
+
});
|
|
8246
|
+
}
|
|
8247
|
+
return target;
|
|
8248
|
+
}
|
|
8249
|
+
function _to_consumable_array$9(arr) {
|
|
8250
|
+
return _array_without_holes$9(arr) || _iterable_to_array$9(arr) || _unsupported_iterable_to_array$9(arr) || _non_iterable_spread$9();
|
|
8251
|
+
}
|
|
8252
|
+
function _unsupported_iterable_to_array$9(o, minLen) {
|
|
8253
|
+
if (!o) return;
|
|
8254
|
+
if (typeof o === "string") return _array_like_to_array$9(o, minLen);
|
|
8255
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
8256
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
8257
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
8258
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$9(o, minLen);
|
|
8259
|
+
}
|
|
8260
|
+
function parseMapDef(def, refs) {
|
|
8261
|
+
if (refs.mapStrategy === "record") {
|
|
8262
|
+
return parseRecordDef(def, refs);
|
|
8263
|
+
}
|
|
8264
|
+
var keys = parseDef(def.keyType._def, _object_spread_props$9(_object_spread$9({}, refs), {
|
|
8265
|
+
currentPath: _to_consumable_array$9(refs.currentPath).concat([
|
|
8266
|
+
"items",
|
|
8267
|
+
"items",
|
|
8268
|
+
"0"
|
|
8269
|
+
])
|
|
8270
|
+
})) || parseAnyDef(refs);
|
|
8271
|
+
var values = parseDef(def.valueType._def, _object_spread_props$9(_object_spread$9({}, refs), {
|
|
8272
|
+
currentPath: _to_consumable_array$9(refs.currentPath).concat([
|
|
8273
|
+
"items",
|
|
8274
|
+
"items",
|
|
8275
|
+
"1"
|
|
8276
|
+
])
|
|
8277
|
+
})) || parseAnyDef(refs);
|
|
8278
|
+
return {
|
|
8279
|
+
type: "array",
|
|
8280
|
+
maxItems: 125,
|
|
8281
|
+
items: {
|
|
8282
|
+
type: "array",
|
|
8283
|
+
items: [
|
|
8284
|
+
keys,
|
|
8285
|
+
values
|
|
8286
|
+
],
|
|
8287
|
+
minItems: 2,
|
|
8288
|
+
maxItems: 2
|
|
8289
|
+
}
|
|
8290
|
+
};
|
|
8291
|
+
}
|
|
8292
|
+
|
|
8293
|
+
function _type_of$1(obj) {
|
|
8294
|
+
"@swc/helpers - typeof";
|
|
8295
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
8296
|
+
}
|
|
8297
|
+
function parseNativeEnumDef(def) {
|
|
8298
|
+
var object = def.values;
|
|
8299
|
+
var actualKeys = Object.keys(def.values).filter(function(key) {
|
|
8300
|
+
return typeof object[object[key]] !== "number";
|
|
8301
|
+
});
|
|
8302
|
+
var actualValues = actualKeys.map(function(key) {
|
|
8303
|
+
return object[key];
|
|
8304
|
+
});
|
|
8305
|
+
var parsedTypes = Array.from(new Set(actualValues.map(function(values) {
|
|
8306
|
+
return typeof values === "undefined" ? "undefined" : _type_of$1(values);
|
|
8307
|
+
})));
|
|
8308
|
+
return {
|
|
8309
|
+
type: parsedTypes.length === 1 ? parsedTypes[0] === "string" ? "string" : "number" : [
|
|
8310
|
+
"string",
|
|
8311
|
+
"number"
|
|
8312
|
+
],
|
|
8313
|
+
enum: actualValues
|
|
8314
|
+
};
|
|
8315
|
+
}
|
|
8316
|
+
|
|
8317
|
+
function _array_like_to_array$8(arr, len) {
|
|
8318
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
8319
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
8320
|
+
return arr2;
|
|
8321
|
+
}
|
|
8322
|
+
function _array_without_holes$8(arr) {
|
|
8323
|
+
if (Array.isArray(arr)) return _array_like_to_array$8(arr);
|
|
8324
|
+
}
|
|
8325
|
+
function _define_property$8(obj, key, value) {
|
|
8326
|
+
if (key in obj) {
|
|
8327
|
+
Object.defineProperty(obj, key, {
|
|
8328
|
+
value: value,
|
|
8329
|
+
enumerable: true,
|
|
8330
|
+
configurable: true,
|
|
8331
|
+
writable: true
|
|
8332
|
+
});
|
|
8333
|
+
} else {
|
|
8334
|
+
obj[key] = value;
|
|
8335
|
+
}
|
|
8336
|
+
return obj;
|
|
8337
|
+
}
|
|
8338
|
+
function _iterable_to_array$8(iter) {
|
|
8339
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
8340
|
+
}
|
|
8341
|
+
function _non_iterable_spread$8() {
|
|
8342
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
8343
|
+
}
|
|
8344
|
+
function _object_spread$8(target) {
|
|
8345
|
+
for(var i = 1; i < arguments.length; i++){
|
|
8346
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
8347
|
+
var ownKeys = Object.keys(source);
|
|
8348
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
8349
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
8350
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
8351
|
+
}));
|
|
8352
|
+
}
|
|
8353
|
+
ownKeys.forEach(function(key) {
|
|
8354
|
+
_define_property$8(target, key, source[key]);
|
|
8355
|
+
});
|
|
8356
|
+
}
|
|
8357
|
+
return target;
|
|
8358
|
+
}
|
|
8359
|
+
function ownKeys$8(object, enumerableOnly) {
|
|
8360
|
+
var keys = Object.keys(object);
|
|
8361
|
+
if (Object.getOwnPropertySymbols) {
|
|
8362
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
8363
|
+
keys.push.apply(keys, symbols);
|
|
8364
|
+
}
|
|
8365
|
+
return keys;
|
|
8366
|
+
}
|
|
8367
|
+
function _object_spread_props$8(target, source) {
|
|
8368
|
+
source = source != null ? source : {};
|
|
8369
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
8370
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
8371
|
+
} else {
|
|
8372
|
+
ownKeys$8(Object(source)).forEach(function(key) {
|
|
8373
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
8374
|
+
});
|
|
8375
|
+
}
|
|
8376
|
+
return target;
|
|
8377
|
+
}
|
|
8378
|
+
function _to_consumable_array$8(arr) {
|
|
8379
|
+
return _array_without_holes$8(arr) || _iterable_to_array$8(arr) || _unsupported_iterable_to_array$8(arr) || _non_iterable_spread$8();
|
|
8380
|
+
}
|
|
8381
|
+
function _unsupported_iterable_to_array$8(o, minLen) {
|
|
8382
|
+
if (!o) return;
|
|
8383
|
+
if (typeof o === "string") return _array_like_to_array$8(o, minLen);
|
|
8384
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
8385
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
8386
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
8387
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$8(o, minLen);
|
|
8388
|
+
}
|
|
8389
|
+
function parseNeverDef(refs) {
|
|
8390
|
+
return refs.target === "openAi" ? undefined : {
|
|
8391
|
+
not: parseAnyDef(_object_spread_props$8(_object_spread$8({}, refs), {
|
|
8392
|
+
currentPath: _to_consumable_array$8(refs.currentPath).concat([
|
|
8393
|
+
"not"
|
|
8394
|
+
])
|
|
8395
|
+
}))
|
|
8396
|
+
};
|
|
8397
|
+
}
|
|
8398
|
+
|
|
8399
|
+
function parseNullDef(refs) {
|
|
8400
|
+
return refs.target === "openApi3" ? {
|
|
8401
|
+
enum: [
|
|
8402
|
+
"null"
|
|
8403
|
+
],
|
|
8404
|
+
nullable: true
|
|
8405
|
+
} : {
|
|
8406
|
+
type: "null"
|
|
8407
|
+
};
|
|
8408
|
+
}
|
|
8409
|
+
|
|
8410
|
+
function _array_like_to_array$7(arr, len) {
|
|
8411
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
8412
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
8413
|
+
return arr2;
|
|
8414
|
+
}
|
|
8415
|
+
function _array_without_holes$7(arr) {
|
|
8416
|
+
if (Array.isArray(arr)) return _array_like_to_array$7(arr);
|
|
8417
|
+
}
|
|
8418
|
+
function _define_property$7(obj, key, value) {
|
|
8419
|
+
if (key in obj) {
|
|
8420
|
+
Object.defineProperty(obj, key, {
|
|
8421
|
+
value: value,
|
|
8422
|
+
enumerable: true,
|
|
8423
|
+
configurable: true,
|
|
8424
|
+
writable: true
|
|
8425
|
+
});
|
|
8426
|
+
} else {
|
|
8427
|
+
obj[key] = value;
|
|
8428
|
+
}
|
|
8429
|
+
return obj;
|
|
8430
|
+
}
|
|
8431
|
+
function _instanceof(left, right) {
|
|
8432
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
8433
|
+
return !!right[Symbol.hasInstance](left);
|
|
8434
|
+
} else {
|
|
8435
|
+
return left instanceof right;
|
|
8436
|
+
}
|
|
8437
|
+
}
|
|
8438
|
+
function _iterable_to_array$7(iter) {
|
|
8439
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
8440
|
+
}
|
|
8441
|
+
function _non_iterable_spread$7() {
|
|
8442
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
8443
|
+
}
|
|
8444
|
+
function _object_spread$7(target) {
|
|
8445
|
+
for(var i = 1; i < arguments.length; i++){
|
|
8446
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
8447
|
+
var ownKeys = Object.keys(source);
|
|
8448
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
8449
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
8450
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
8451
|
+
}));
|
|
8452
|
+
}
|
|
8453
|
+
ownKeys.forEach(function(key) {
|
|
8454
|
+
_define_property$7(target, key, source[key]);
|
|
8455
|
+
});
|
|
8456
|
+
}
|
|
8457
|
+
return target;
|
|
8458
|
+
}
|
|
8459
|
+
function ownKeys$7(object, enumerableOnly) {
|
|
8460
|
+
var keys = Object.keys(object);
|
|
8461
|
+
if (Object.getOwnPropertySymbols) {
|
|
8462
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
8463
|
+
keys.push.apply(keys, symbols);
|
|
8464
|
+
}
|
|
8465
|
+
return keys;
|
|
8466
|
+
}
|
|
8467
|
+
function _object_spread_props$7(target, source) {
|
|
8468
|
+
source = source != null ? source : {};
|
|
8469
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
8470
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
8471
|
+
} else {
|
|
8472
|
+
ownKeys$7(Object(source)).forEach(function(key) {
|
|
8473
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
8474
|
+
});
|
|
8475
|
+
}
|
|
8476
|
+
return target;
|
|
8477
|
+
}
|
|
8478
|
+
function _to_consumable_array$7(arr) {
|
|
8479
|
+
return _array_without_holes$7(arr) || _iterable_to_array$7(arr) || _unsupported_iterable_to_array$7(arr) || _non_iterable_spread$7();
|
|
8480
|
+
}
|
|
8481
|
+
function _type_of(obj) {
|
|
8482
|
+
"@swc/helpers - typeof";
|
|
8483
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
8484
|
+
}
|
|
8485
|
+
function _unsupported_iterable_to_array$7(o, minLen) {
|
|
8486
|
+
if (!o) return;
|
|
8487
|
+
if (typeof o === "string") return _array_like_to_array$7(o, minLen);
|
|
8488
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
8489
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
8490
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
8491
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$7(o, minLen);
|
|
8492
|
+
}
|
|
8493
|
+
var primitiveMappings = {
|
|
8494
|
+
ZodString: "string",
|
|
8495
|
+
ZodNumber: "number",
|
|
8496
|
+
ZodBigInt: "integer",
|
|
8497
|
+
ZodBoolean: "boolean",
|
|
8498
|
+
ZodNull: "null"
|
|
8499
|
+
};
|
|
8500
|
+
function parseUnionDef(def, refs) {
|
|
8501
|
+
if (refs.target === "openApi3") return asAnyOf(def, refs);
|
|
8502
|
+
var options = _instanceof(def.options, Map) ? Array.from(def.options.values()) : def.options;
|
|
8503
|
+
// This blocks tries to look ahead a bit to produce nicer looking schemas with type array instead of anyOf.
|
|
8504
|
+
if (options.every(function(x) {
|
|
8505
|
+
return x._def.typeName in primitiveMappings && (!x._def.checks || !x._def.checks.length);
|
|
8506
|
+
})) {
|
|
8507
|
+
// all types in union are primitive and lack checks, so might as well squash into {type: [...]}
|
|
8508
|
+
var types = options.reduce(function(types, x) {
|
|
8509
|
+
var type = primitiveMappings[x._def.typeName]; //Can be safely casted due to row 43
|
|
8510
|
+
return type && !types.includes(type) ? _to_consumable_array$7(types).concat([
|
|
8511
|
+
type
|
|
8512
|
+
]) : types;
|
|
8513
|
+
}, []);
|
|
8514
|
+
return {
|
|
8515
|
+
type: types.length > 1 ? types : types[0]
|
|
8516
|
+
};
|
|
8517
|
+
} else if (options.every(function(x) {
|
|
8518
|
+
return x._def.typeName === "ZodLiteral" && !x.description;
|
|
8519
|
+
})) {
|
|
8520
|
+
// all options literals
|
|
8521
|
+
var types1 = options.reduce(function(acc, x) {
|
|
8522
|
+
var type = _type_of(x._def.value);
|
|
8523
|
+
switch(type){
|
|
8524
|
+
case "string":
|
|
8525
|
+
case "number":
|
|
8526
|
+
case "boolean":
|
|
8527
|
+
return _to_consumable_array$7(acc).concat([
|
|
8528
|
+
type
|
|
8529
|
+
]);
|
|
8530
|
+
case "bigint":
|
|
8531
|
+
return _to_consumable_array$7(acc).concat([
|
|
8532
|
+
"integer"
|
|
8533
|
+
]);
|
|
8534
|
+
case "object":
|
|
8535
|
+
if (x._def.value === null) return _to_consumable_array$7(acc).concat([
|
|
8536
|
+
"null"
|
|
8537
|
+
]);
|
|
8538
|
+
case "symbol":
|
|
8539
|
+
case "undefined":
|
|
8540
|
+
case "function":
|
|
8541
|
+
default:
|
|
8542
|
+
return acc;
|
|
8543
|
+
}
|
|
8544
|
+
}, []);
|
|
8545
|
+
if (types1.length === options.length) {
|
|
8546
|
+
// all the literals are primitive, as far as null can be considered primitive
|
|
8547
|
+
var uniqueTypes = types1.filter(function(x, i, a) {
|
|
8548
|
+
return a.indexOf(x) === i;
|
|
8549
|
+
});
|
|
8550
|
+
return {
|
|
8551
|
+
type: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0],
|
|
8552
|
+
enum: options.reduce(function(acc, x) {
|
|
8553
|
+
return acc.includes(x._def.value) ? acc : _to_consumable_array$7(acc).concat([
|
|
8554
|
+
x._def.value
|
|
8555
|
+
]);
|
|
8556
|
+
}, [])
|
|
8557
|
+
};
|
|
8558
|
+
}
|
|
8559
|
+
} else if (options.every(function(x) {
|
|
8560
|
+
return x._def.typeName === "ZodEnum";
|
|
8561
|
+
})) {
|
|
8562
|
+
return {
|
|
8563
|
+
type: "string",
|
|
8564
|
+
enum: options.reduce(function(acc, x) {
|
|
8565
|
+
return _to_consumable_array$7(acc).concat(_to_consumable_array$7(x._def.values.filter(function(x) {
|
|
8566
|
+
return !acc.includes(x);
|
|
8567
|
+
})));
|
|
8568
|
+
}, [])
|
|
8569
|
+
};
|
|
8570
|
+
}
|
|
8571
|
+
return asAnyOf(def, refs);
|
|
8572
|
+
}
|
|
8573
|
+
var asAnyOf = function(def, refs) {
|
|
8574
|
+
var anyOf = (_instanceof(def.options, Map) ? Array.from(def.options.values()) : def.options).map(function(x, i) {
|
|
8575
|
+
return parseDef(x._def, _object_spread_props$7(_object_spread$7({}, refs), {
|
|
8576
|
+
currentPath: _to_consumable_array$7(refs.currentPath).concat([
|
|
8577
|
+
"anyOf",
|
|
8578
|
+
"".concat(i)
|
|
8579
|
+
])
|
|
8580
|
+
}));
|
|
8581
|
+
}).filter(function(x) {
|
|
8582
|
+
return !!x && (!refs.strictUnions || typeof x === "object" && Object.keys(x).length > 0);
|
|
8583
|
+
});
|
|
8584
|
+
return anyOf.length ? {
|
|
8585
|
+
anyOf: anyOf
|
|
8586
|
+
} : undefined;
|
|
8587
|
+
};
|
|
8588
|
+
|
|
8589
|
+
function _array_like_to_array$6(arr, len) {
|
|
8590
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
8591
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
8592
|
+
return arr2;
|
|
8593
|
+
}
|
|
8594
|
+
function _array_without_holes$6(arr) {
|
|
8595
|
+
if (Array.isArray(arr)) return _array_like_to_array$6(arr);
|
|
8596
|
+
}
|
|
8597
|
+
function _define_property$6(obj, key, value) {
|
|
8598
|
+
if (key in obj) {
|
|
8599
|
+
Object.defineProperty(obj, key, {
|
|
8600
|
+
value: value,
|
|
8601
|
+
enumerable: true,
|
|
8602
|
+
configurable: true,
|
|
8603
|
+
writable: true
|
|
8604
|
+
});
|
|
8605
|
+
} else {
|
|
8606
|
+
obj[key] = value;
|
|
8607
|
+
}
|
|
8608
|
+
return obj;
|
|
8609
|
+
}
|
|
8610
|
+
function _iterable_to_array$6(iter) {
|
|
8611
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
8612
|
+
}
|
|
8613
|
+
function _non_iterable_spread$6() {
|
|
8614
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
8615
|
+
}
|
|
8616
|
+
function _object_spread$6(target) {
|
|
8617
|
+
for(var i = 1; i < arguments.length; i++){
|
|
8618
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
8619
|
+
var ownKeys = Object.keys(source);
|
|
8620
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
8621
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
8622
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
8623
|
+
}));
|
|
8624
|
+
}
|
|
8625
|
+
ownKeys.forEach(function(key) {
|
|
8626
|
+
_define_property$6(target, key, source[key]);
|
|
8627
|
+
});
|
|
8628
|
+
}
|
|
8629
|
+
return target;
|
|
8630
|
+
}
|
|
8631
|
+
function ownKeys$6(object, enumerableOnly) {
|
|
8632
|
+
var keys = Object.keys(object);
|
|
8633
|
+
if (Object.getOwnPropertySymbols) {
|
|
8634
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
8635
|
+
keys.push.apply(keys, symbols);
|
|
8636
|
+
}
|
|
8637
|
+
return keys;
|
|
8638
|
+
}
|
|
8639
|
+
function _object_spread_props$6(target, source) {
|
|
8640
|
+
source = source != null ? source : {};
|
|
8641
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
8642
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
8643
|
+
} else {
|
|
8644
|
+
ownKeys$6(Object(source)).forEach(function(key) {
|
|
8645
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
8646
|
+
});
|
|
8647
|
+
}
|
|
8648
|
+
return target;
|
|
8649
|
+
}
|
|
8650
|
+
function _to_consumable_array$6(arr) {
|
|
8651
|
+
return _array_without_holes$6(arr) || _iterable_to_array$6(arr) || _unsupported_iterable_to_array$6(arr) || _non_iterable_spread$6();
|
|
8652
|
+
}
|
|
8653
|
+
function _unsupported_iterable_to_array$6(o, minLen) {
|
|
8654
|
+
if (!o) return;
|
|
8655
|
+
if (typeof o === "string") return _array_like_to_array$6(o, minLen);
|
|
8656
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
8657
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
8658
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
8659
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
|
|
8660
|
+
}
|
|
8661
|
+
function parseNullableDef(def, refs) {
|
|
8662
|
+
if ([
|
|
8663
|
+
"ZodString",
|
|
8664
|
+
"ZodNumber",
|
|
8665
|
+
"ZodBigInt",
|
|
8666
|
+
"ZodBoolean",
|
|
8667
|
+
"ZodNull"
|
|
8668
|
+
].includes(def.innerType._def.typeName) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
|
|
8669
|
+
if (refs.target === "openApi3") {
|
|
8670
|
+
return {
|
|
8671
|
+
type: primitiveMappings[def.innerType._def.typeName],
|
|
8672
|
+
nullable: true
|
|
8673
|
+
};
|
|
8674
|
+
}
|
|
8675
|
+
return {
|
|
8676
|
+
type: [
|
|
8677
|
+
primitiveMappings[def.innerType._def.typeName],
|
|
8678
|
+
"null"
|
|
8679
|
+
]
|
|
8680
|
+
};
|
|
8681
|
+
}
|
|
8682
|
+
if (refs.target === "openApi3") {
|
|
8683
|
+
var base = parseDef(def.innerType._def, _object_spread_props$6(_object_spread$6({}, refs), {
|
|
8684
|
+
currentPath: _to_consumable_array$6(refs.currentPath)
|
|
8685
|
+
}));
|
|
8686
|
+
if (base && "$ref" in base) return {
|
|
8687
|
+
allOf: [
|
|
8688
|
+
base
|
|
8689
|
+
],
|
|
8690
|
+
nullable: true
|
|
8691
|
+
};
|
|
8692
|
+
return base && _object_spread_props$6(_object_spread$6({}, base), {
|
|
8693
|
+
nullable: true
|
|
8694
|
+
});
|
|
8695
|
+
}
|
|
8696
|
+
var base1 = parseDef(def.innerType._def, _object_spread_props$6(_object_spread$6({}, refs), {
|
|
8697
|
+
currentPath: _to_consumable_array$6(refs.currentPath).concat([
|
|
8698
|
+
"anyOf",
|
|
8699
|
+
"0"
|
|
8700
|
+
])
|
|
8701
|
+
}));
|
|
8702
|
+
return base1 && {
|
|
8703
|
+
anyOf: [
|
|
8704
|
+
base1,
|
|
8705
|
+
{
|
|
8706
|
+
type: "null"
|
|
8707
|
+
}
|
|
8708
|
+
]
|
|
8709
|
+
};
|
|
8710
|
+
}
|
|
8711
|
+
|
|
8712
|
+
function parseNumberDef(def, refs) {
|
|
8713
|
+
var res = {
|
|
8714
|
+
type: "number"
|
|
8715
|
+
};
|
|
8716
|
+
if (!def.checks) return res;
|
|
8717
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
8718
|
+
try {
|
|
8719
|
+
for(var _iterator = def.checks[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
8720
|
+
var check = _step.value;
|
|
8721
|
+
switch(check.kind){
|
|
8722
|
+
case "int":
|
|
8723
|
+
res.type = "integer";
|
|
8724
|
+
addErrorMessage(res, "type", check.message, refs);
|
|
8725
|
+
break;
|
|
8726
|
+
case "min":
|
|
8727
|
+
if (refs.target === "jsonSchema7") {
|
|
8728
|
+
if (check.inclusive) {
|
|
8729
|
+
setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
|
|
8730
|
+
} else {
|
|
8731
|
+
setResponseValueAndErrors(res, "exclusiveMinimum", check.value, check.message, refs);
|
|
8732
|
+
}
|
|
8733
|
+
} else {
|
|
8734
|
+
if (!check.inclusive) {
|
|
8735
|
+
res.exclusiveMinimum = true;
|
|
8736
|
+
}
|
|
8737
|
+
setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
|
|
8738
|
+
}
|
|
8739
|
+
break;
|
|
8740
|
+
case "max":
|
|
8741
|
+
if (refs.target === "jsonSchema7") {
|
|
8742
|
+
if (check.inclusive) {
|
|
8743
|
+
setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
|
|
8744
|
+
} else {
|
|
8745
|
+
setResponseValueAndErrors(res, "exclusiveMaximum", check.value, check.message, refs);
|
|
8746
|
+
}
|
|
8747
|
+
} else {
|
|
8748
|
+
if (!check.inclusive) {
|
|
8749
|
+
res.exclusiveMaximum = true;
|
|
8750
|
+
}
|
|
8751
|
+
setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
|
|
8752
|
+
}
|
|
8753
|
+
break;
|
|
8754
|
+
case "multipleOf":
|
|
8755
|
+
setResponseValueAndErrors(res, "multipleOf", check.value, check.message, refs);
|
|
8756
|
+
break;
|
|
8757
|
+
}
|
|
8758
|
+
}
|
|
8759
|
+
} catch (err) {
|
|
8760
|
+
_didIteratorError = true;
|
|
8761
|
+
_iteratorError = err;
|
|
8762
|
+
} finally{
|
|
8763
|
+
try {
|
|
8764
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
8765
|
+
_iterator.return();
|
|
8766
|
+
}
|
|
8767
|
+
} finally{
|
|
8768
|
+
if (_didIteratorError) {
|
|
8769
|
+
throw _iteratorError;
|
|
8770
|
+
}
|
|
8771
|
+
}
|
|
8772
|
+
}
|
|
8773
|
+
return res;
|
|
8774
|
+
}
|
|
8775
|
+
|
|
8776
|
+
function _array_like_to_array$5(arr, len) {
|
|
8777
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
8778
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
8779
|
+
return arr2;
|
|
8780
|
+
}
|
|
8781
|
+
function _array_without_holes$5(arr) {
|
|
8782
|
+
if (Array.isArray(arr)) return _array_like_to_array$5(arr);
|
|
8783
|
+
}
|
|
8784
|
+
function _define_property$5(obj, key, value) {
|
|
8785
|
+
if (key in obj) {
|
|
8786
|
+
Object.defineProperty(obj, key, {
|
|
8787
|
+
value: value,
|
|
8788
|
+
enumerable: true,
|
|
8789
|
+
configurable: true,
|
|
8790
|
+
writable: true
|
|
8791
|
+
});
|
|
8792
|
+
} else {
|
|
8793
|
+
obj[key] = value;
|
|
8794
|
+
}
|
|
8795
|
+
return obj;
|
|
8796
|
+
}
|
|
8797
|
+
function _iterable_to_array$5(iter) {
|
|
8798
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
8799
|
+
}
|
|
8800
|
+
function _non_iterable_spread$5() {
|
|
8801
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
8802
|
+
}
|
|
8803
|
+
function _object_spread$5(target) {
|
|
8804
|
+
for(var i = 1; i < arguments.length; i++){
|
|
8805
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
8806
|
+
var ownKeys = Object.keys(source);
|
|
8807
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
8808
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
8809
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
8810
|
+
}));
|
|
8811
|
+
}
|
|
8812
|
+
ownKeys.forEach(function(key) {
|
|
8813
|
+
_define_property$5(target, key, source[key]);
|
|
8814
|
+
});
|
|
8815
|
+
}
|
|
8816
|
+
return target;
|
|
8817
|
+
}
|
|
8818
|
+
function ownKeys$5(object, enumerableOnly) {
|
|
8819
|
+
var keys = Object.keys(object);
|
|
8820
|
+
if (Object.getOwnPropertySymbols) {
|
|
8821
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
8822
|
+
keys.push.apply(keys, symbols);
|
|
8823
|
+
}
|
|
8824
|
+
return keys;
|
|
8825
|
+
}
|
|
8826
|
+
function _object_spread_props$5(target, source) {
|
|
8827
|
+
source = source != null ? source : {};
|
|
8828
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
8829
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
8830
|
+
} else {
|
|
8831
|
+
ownKeys$5(Object(source)).forEach(function(key) {
|
|
8832
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
8833
|
+
});
|
|
8834
|
+
}
|
|
8835
|
+
return target;
|
|
8836
|
+
}
|
|
8837
|
+
function _to_consumable_array$5(arr) {
|
|
8838
|
+
return _array_without_holes$5(arr) || _iterable_to_array$5(arr) || _unsupported_iterable_to_array$5(arr) || _non_iterable_spread$5();
|
|
8839
|
+
}
|
|
8840
|
+
function _unsupported_iterable_to_array$5(o, minLen) {
|
|
8841
|
+
if (!o) return;
|
|
8842
|
+
if (typeof o === "string") return _array_like_to_array$5(o, minLen);
|
|
8843
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
8844
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
8845
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
8846
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
|
|
8847
|
+
}
|
|
8848
|
+
function parseObjectDef(def, refs) {
|
|
8849
|
+
var forceOptionalIntoNullable = refs.target === "openAi";
|
|
8850
|
+
var result = {
|
|
8851
|
+
type: "object",
|
|
8852
|
+
properties: {}
|
|
8853
|
+
};
|
|
8854
|
+
var required = [];
|
|
8855
|
+
var shape = def.shape();
|
|
8856
|
+
for(var propName in shape){
|
|
8857
|
+
var propDef = shape[propName];
|
|
8858
|
+
if (propDef === undefined || propDef._def === undefined) {
|
|
8859
|
+
continue;
|
|
8860
|
+
}
|
|
8861
|
+
var propOptional = safeIsOptional(propDef);
|
|
8862
|
+
if (propOptional && forceOptionalIntoNullable) {
|
|
8863
|
+
if (propDef._def.typeName === "ZodOptional") {
|
|
8864
|
+
propDef = propDef._def.innerType;
|
|
8865
|
+
}
|
|
8866
|
+
if (!propDef.isNullable()) {
|
|
8867
|
+
propDef = propDef.nullable();
|
|
8868
|
+
}
|
|
8869
|
+
propOptional = false;
|
|
8870
|
+
}
|
|
8871
|
+
var parsedDef = parseDef(propDef._def, _object_spread_props$5(_object_spread$5({}, refs), {
|
|
8872
|
+
currentPath: _to_consumable_array$5(refs.currentPath).concat([
|
|
8873
|
+
"properties",
|
|
8874
|
+
propName
|
|
8875
|
+
]),
|
|
8876
|
+
propertyPath: _to_consumable_array$5(refs.currentPath).concat([
|
|
8877
|
+
"properties",
|
|
8878
|
+
propName
|
|
8879
|
+
])
|
|
8880
|
+
}));
|
|
8881
|
+
if (parsedDef === undefined) {
|
|
8882
|
+
continue;
|
|
8883
|
+
}
|
|
8884
|
+
result.properties[propName] = parsedDef;
|
|
8885
|
+
if (!propOptional) {
|
|
8886
|
+
required.push(propName);
|
|
8887
|
+
}
|
|
8888
|
+
}
|
|
8889
|
+
if (required.length) {
|
|
8890
|
+
result.required = required;
|
|
8891
|
+
}
|
|
8892
|
+
var additionalProperties = decideAdditionalProperties(def, refs);
|
|
8893
|
+
if (additionalProperties !== undefined) {
|
|
8894
|
+
result.additionalProperties = additionalProperties;
|
|
8895
|
+
}
|
|
8896
|
+
return result;
|
|
8897
|
+
}
|
|
8898
|
+
function decideAdditionalProperties(def, refs) {
|
|
8899
|
+
if (def.catchall._def.typeName !== "ZodNever") {
|
|
8900
|
+
return parseDef(def.catchall._def, _object_spread_props$5(_object_spread$5({}, refs), {
|
|
8901
|
+
currentPath: _to_consumable_array$5(refs.currentPath).concat([
|
|
8902
|
+
"additionalProperties"
|
|
8903
|
+
])
|
|
8904
|
+
}));
|
|
8905
|
+
}
|
|
8906
|
+
switch(def.unknownKeys){
|
|
8907
|
+
case "passthrough":
|
|
8908
|
+
return refs.allowedAdditionalProperties;
|
|
8909
|
+
case "strict":
|
|
8910
|
+
return refs.rejectedAdditionalProperties;
|
|
8911
|
+
case "strip":
|
|
8912
|
+
return refs.removeAdditionalStrategy === "strict" ? refs.allowedAdditionalProperties : refs.rejectedAdditionalProperties;
|
|
8913
|
+
}
|
|
8914
|
+
}
|
|
8915
|
+
function safeIsOptional(schema) {
|
|
8916
|
+
try {
|
|
8917
|
+
return schema.isOptional();
|
|
8918
|
+
} catch (e) {
|
|
8919
|
+
return true;
|
|
8920
|
+
}
|
|
8921
|
+
}
|
|
8922
|
+
|
|
8923
|
+
function _array_like_to_array$4(arr, len) {
|
|
8924
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
8925
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
8926
|
+
return arr2;
|
|
8927
|
+
}
|
|
8928
|
+
function _array_without_holes$4(arr) {
|
|
8929
|
+
if (Array.isArray(arr)) return _array_like_to_array$4(arr);
|
|
8930
|
+
}
|
|
8931
|
+
function _define_property$4(obj, key, value) {
|
|
8932
|
+
if (key in obj) {
|
|
8933
|
+
Object.defineProperty(obj, key, {
|
|
8934
|
+
value: value,
|
|
8935
|
+
enumerable: true,
|
|
8936
|
+
configurable: true,
|
|
8937
|
+
writable: true
|
|
8938
|
+
});
|
|
8939
|
+
} else {
|
|
8940
|
+
obj[key] = value;
|
|
8941
|
+
}
|
|
8942
|
+
return obj;
|
|
8943
|
+
}
|
|
8944
|
+
function _iterable_to_array$4(iter) {
|
|
8945
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
8946
|
+
}
|
|
8947
|
+
function _non_iterable_spread$4() {
|
|
8948
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
8949
|
+
}
|
|
8950
|
+
function _object_spread$4(target) {
|
|
8951
|
+
for(var i = 1; i < arguments.length; i++){
|
|
8952
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
8953
|
+
var ownKeys = Object.keys(source);
|
|
8954
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
8955
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
8956
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
8957
|
+
}));
|
|
8958
|
+
}
|
|
8959
|
+
ownKeys.forEach(function(key) {
|
|
8960
|
+
_define_property$4(target, key, source[key]);
|
|
8961
|
+
});
|
|
8962
|
+
}
|
|
8963
|
+
return target;
|
|
8964
|
+
}
|
|
8965
|
+
function ownKeys$4(object, enumerableOnly) {
|
|
8966
|
+
var keys = Object.keys(object);
|
|
8967
|
+
if (Object.getOwnPropertySymbols) {
|
|
8968
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
8969
|
+
keys.push.apply(keys, symbols);
|
|
8970
|
+
}
|
|
8971
|
+
return keys;
|
|
8972
|
+
}
|
|
8973
|
+
function _object_spread_props$4(target, source) {
|
|
8974
|
+
source = source != null ? source : {};
|
|
8975
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
8976
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
8977
|
+
} else {
|
|
8978
|
+
ownKeys$4(Object(source)).forEach(function(key) {
|
|
8979
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
8980
|
+
});
|
|
8981
|
+
}
|
|
8982
|
+
return target;
|
|
8983
|
+
}
|
|
8984
|
+
function _to_consumable_array$4(arr) {
|
|
8985
|
+
return _array_without_holes$4(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$4(arr) || _non_iterable_spread$4();
|
|
8986
|
+
}
|
|
8987
|
+
function _unsupported_iterable_to_array$4(o, minLen) {
|
|
8988
|
+
if (!o) return;
|
|
8989
|
+
if (typeof o === "string") return _array_like_to_array$4(o, minLen);
|
|
8990
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
8991
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
8992
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
8993
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
|
|
8994
|
+
}
|
|
8995
|
+
var parseOptionalDef = function(def, refs) {
|
|
8996
|
+
var _refs_propertyPath;
|
|
8997
|
+
if (refs.currentPath.toString() === ((_refs_propertyPath = refs.propertyPath) === null || _refs_propertyPath === void 0 ? void 0 : _refs_propertyPath.toString())) {
|
|
8998
|
+
return parseDef(def.innerType._def, refs);
|
|
8999
|
+
}
|
|
9000
|
+
var innerSchema = parseDef(def.innerType._def, _object_spread_props$4(_object_spread$4({}, refs), {
|
|
9001
|
+
currentPath: _to_consumable_array$4(refs.currentPath).concat([
|
|
9002
|
+
"anyOf",
|
|
9003
|
+
"1"
|
|
9004
|
+
])
|
|
9005
|
+
}));
|
|
9006
|
+
return innerSchema ? {
|
|
9007
|
+
anyOf: [
|
|
9008
|
+
{
|
|
9009
|
+
not: parseAnyDef(refs)
|
|
9010
|
+
},
|
|
9011
|
+
innerSchema
|
|
9012
|
+
]
|
|
9013
|
+
} : parseAnyDef(refs);
|
|
9014
|
+
};
|
|
9015
|
+
|
|
9016
|
+
function _array_like_to_array$3(arr, len) {
|
|
9017
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
9018
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
9019
|
+
return arr2;
|
|
9020
|
+
}
|
|
9021
|
+
function _array_without_holes$3(arr) {
|
|
9022
|
+
if (Array.isArray(arr)) return _array_like_to_array$3(arr);
|
|
9023
|
+
}
|
|
9024
|
+
function _define_property$3(obj, key, value) {
|
|
9025
|
+
if (key in obj) {
|
|
9026
|
+
Object.defineProperty(obj, key, {
|
|
9027
|
+
value: value,
|
|
9028
|
+
enumerable: true,
|
|
9029
|
+
configurable: true,
|
|
9030
|
+
writable: true
|
|
9031
|
+
});
|
|
9032
|
+
} else {
|
|
9033
|
+
obj[key] = value;
|
|
9034
|
+
}
|
|
9035
|
+
return obj;
|
|
9036
|
+
}
|
|
9037
|
+
function _iterable_to_array$3(iter) {
|
|
9038
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
9039
|
+
}
|
|
9040
|
+
function _non_iterable_spread$3() {
|
|
9041
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
9042
|
+
}
|
|
9043
|
+
function _object_spread$3(target) {
|
|
9044
|
+
for(var i = 1; i < arguments.length; i++){
|
|
9045
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
9046
|
+
var ownKeys = Object.keys(source);
|
|
9047
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
9048
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
9049
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
9050
|
+
}));
|
|
9051
|
+
}
|
|
9052
|
+
ownKeys.forEach(function(key) {
|
|
9053
|
+
_define_property$3(target, key, source[key]);
|
|
9054
|
+
});
|
|
9055
|
+
}
|
|
9056
|
+
return target;
|
|
9057
|
+
}
|
|
9058
|
+
function ownKeys$3(object, enumerableOnly) {
|
|
9059
|
+
var keys = Object.keys(object);
|
|
9060
|
+
if (Object.getOwnPropertySymbols) {
|
|
9061
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
9062
|
+
keys.push.apply(keys, symbols);
|
|
9063
|
+
}
|
|
9064
|
+
return keys;
|
|
9065
|
+
}
|
|
9066
|
+
function _object_spread_props$3(target, source) {
|
|
9067
|
+
source = source != null ? source : {};
|
|
9068
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
9069
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
9070
|
+
} else {
|
|
9071
|
+
ownKeys$3(Object(source)).forEach(function(key) {
|
|
9072
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
9073
|
+
});
|
|
9074
|
+
}
|
|
9075
|
+
return target;
|
|
9076
|
+
}
|
|
9077
|
+
function _to_consumable_array$3(arr) {
|
|
9078
|
+
return _array_without_holes$3(arr) || _iterable_to_array$3(arr) || _unsupported_iterable_to_array$3(arr) || _non_iterable_spread$3();
|
|
9079
|
+
}
|
|
9080
|
+
function _unsupported_iterable_to_array$3(o, minLen) {
|
|
9081
|
+
if (!o) return;
|
|
9082
|
+
if (typeof o === "string") return _array_like_to_array$3(o, minLen);
|
|
9083
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
9084
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
9085
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
9086
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
|
|
9087
|
+
}
|
|
9088
|
+
var parsePipelineDef = function(def, refs) {
|
|
9089
|
+
if (refs.pipeStrategy === "input") {
|
|
9090
|
+
return parseDef(def.in._def, refs);
|
|
9091
|
+
} else if (refs.pipeStrategy === "output") {
|
|
9092
|
+
return parseDef(def.out._def, refs);
|
|
9093
|
+
}
|
|
9094
|
+
var a = parseDef(def.in._def, _object_spread_props$3(_object_spread$3({}, refs), {
|
|
9095
|
+
currentPath: _to_consumable_array$3(refs.currentPath).concat([
|
|
9096
|
+
"allOf",
|
|
9097
|
+
"0"
|
|
9098
|
+
])
|
|
9099
|
+
}));
|
|
9100
|
+
var b = parseDef(def.out._def, _object_spread_props$3(_object_spread$3({}, refs), {
|
|
9101
|
+
currentPath: _to_consumable_array$3(refs.currentPath).concat([
|
|
9102
|
+
"allOf",
|
|
9103
|
+
a ? "1" : "0"
|
|
9104
|
+
])
|
|
9105
|
+
}));
|
|
9106
|
+
return {
|
|
9107
|
+
allOf: [
|
|
9108
|
+
a,
|
|
9109
|
+
b
|
|
9110
|
+
].filter(function(x) {
|
|
9111
|
+
return x !== undefined;
|
|
9112
|
+
})
|
|
9113
|
+
};
|
|
9114
|
+
};
|
|
9115
|
+
|
|
9116
|
+
function parsePromiseDef(def, refs) {
|
|
9117
|
+
return parseDef(def.type._def, refs);
|
|
9118
|
+
}
|
|
9119
|
+
|
|
9120
|
+
function _array_like_to_array$2(arr, len) {
|
|
9121
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
9122
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
9123
|
+
return arr2;
|
|
9124
|
+
}
|
|
9125
|
+
function _array_without_holes$2(arr) {
|
|
9126
|
+
if (Array.isArray(arr)) return _array_like_to_array$2(arr);
|
|
9127
|
+
}
|
|
9128
|
+
function _define_property$2(obj, key, value) {
|
|
9129
|
+
if (key in obj) {
|
|
9130
|
+
Object.defineProperty(obj, key, {
|
|
9131
|
+
value: value,
|
|
9132
|
+
enumerable: true,
|
|
9133
|
+
configurable: true,
|
|
9134
|
+
writable: true
|
|
9135
|
+
});
|
|
9136
|
+
} else {
|
|
9137
|
+
obj[key] = value;
|
|
9138
|
+
}
|
|
9139
|
+
return obj;
|
|
9140
|
+
}
|
|
9141
|
+
function _iterable_to_array$2(iter) {
|
|
9142
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
9143
|
+
}
|
|
9144
|
+
function _non_iterable_spread$2() {
|
|
9145
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
9146
|
+
}
|
|
9147
|
+
function _object_spread$2(target) {
|
|
9148
|
+
for(var i = 1; i < arguments.length; i++){
|
|
9149
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
9150
|
+
var ownKeys = Object.keys(source);
|
|
9151
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
9152
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
9153
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
9154
|
+
}));
|
|
9155
|
+
}
|
|
9156
|
+
ownKeys.forEach(function(key) {
|
|
9157
|
+
_define_property$2(target, key, source[key]);
|
|
9158
|
+
});
|
|
9159
|
+
}
|
|
9160
|
+
return target;
|
|
9161
|
+
}
|
|
9162
|
+
function ownKeys$2(object, enumerableOnly) {
|
|
9163
|
+
var keys = Object.keys(object);
|
|
9164
|
+
if (Object.getOwnPropertySymbols) {
|
|
9165
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
9166
|
+
keys.push.apply(keys, symbols);
|
|
9167
|
+
}
|
|
9168
|
+
return keys;
|
|
9169
|
+
}
|
|
9170
|
+
function _object_spread_props$2(target, source) {
|
|
9171
|
+
source = source != null ? source : {};
|
|
9172
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
9173
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
9174
|
+
} else {
|
|
9175
|
+
ownKeys$2(Object(source)).forEach(function(key) {
|
|
9176
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
9177
|
+
});
|
|
9178
|
+
}
|
|
9179
|
+
return target;
|
|
9180
|
+
}
|
|
9181
|
+
function _to_consumable_array$2(arr) {
|
|
9182
|
+
return _array_without_holes$2(arr) || _iterable_to_array$2(arr) || _unsupported_iterable_to_array$2(arr) || _non_iterable_spread$2();
|
|
9183
|
+
}
|
|
9184
|
+
function _unsupported_iterable_to_array$2(o, minLen) {
|
|
9185
|
+
if (!o) return;
|
|
9186
|
+
if (typeof o === "string") return _array_like_to_array$2(o, minLen);
|
|
9187
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
9188
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
9189
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
9190
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
|
|
9191
|
+
}
|
|
9192
|
+
function parseSetDef(def, refs) {
|
|
9193
|
+
var items = parseDef(def.valueType._def, _object_spread_props$2(_object_spread$2({}, refs), {
|
|
9194
|
+
currentPath: _to_consumable_array$2(refs.currentPath).concat([
|
|
9195
|
+
"items"
|
|
9196
|
+
])
|
|
9197
|
+
}));
|
|
9198
|
+
var schema = {
|
|
9199
|
+
type: "array",
|
|
9200
|
+
uniqueItems: true,
|
|
9201
|
+
items: items
|
|
9202
|
+
};
|
|
9203
|
+
if (def.minSize) {
|
|
9204
|
+
setResponseValueAndErrors(schema, "minItems", def.minSize.value, def.minSize.message, refs);
|
|
9205
|
+
}
|
|
9206
|
+
if (def.maxSize) {
|
|
9207
|
+
setResponseValueAndErrors(schema, "maxItems", def.maxSize.value, def.maxSize.message, refs);
|
|
9208
|
+
}
|
|
9209
|
+
return schema;
|
|
9210
|
+
}
|
|
9211
|
+
|
|
9212
|
+
function _array_like_to_array$1(arr, len) {
|
|
9213
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
9214
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
9215
|
+
return arr2;
|
|
9216
|
+
}
|
|
9217
|
+
function _array_without_holes$1(arr) {
|
|
9218
|
+
if (Array.isArray(arr)) return _array_like_to_array$1(arr);
|
|
9219
|
+
}
|
|
9220
|
+
function _define_property$1(obj, key, value) {
|
|
9221
|
+
if (key in obj) {
|
|
9222
|
+
Object.defineProperty(obj, key, {
|
|
9223
|
+
value: value,
|
|
9224
|
+
enumerable: true,
|
|
9225
|
+
configurable: true,
|
|
9226
|
+
writable: true
|
|
9227
|
+
});
|
|
9228
|
+
} else {
|
|
9229
|
+
obj[key] = value;
|
|
9230
|
+
}
|
|
9231
|
+
return obj;
|
|
9232
|
+
}
|
|
9233
|
+
function _iterable_to_array$1(iter) {
|
|
9234
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
9235
|
+
}
|
|
9236
|
+
function _non_iterable_spread$1() {
|
|
9237
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
9238
|
+
}
|
|
9239
|
+
function _object_spread$1(target) {
|
|
9240
|
+
for(var i = 1; i < arguments.length; i++){
|
|
9241
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
9242
|
+
var ownKeys = Object.keys(source);
|
|
9243
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
9244
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
9245
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
9246
|
+
}));
|
|
9247
|
+
}
|
|
9248
|
+
ownKeys.forEach(function(key) {
|
|
9249
|
+
_define_property$1(target, key, source[key]);
|
|
9250
|
+
});
|
|
9251
|
+
}
|
|
9252
|
+
return target;
|
|
9253
|
+
}
|
|
9254
|
+
function ownKeys$1(object, enumerableOnly) {
|
|
9255
|
+
var keys = Object.keys(object);
|
|
9256
|
+
if (Object.getOwnPropertySymbols) {
|
|
9257
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
9258
|
+
keys.push.apply(keys, symbols);
|
|
9259
|
+
}
|
|
9260
|
+
return keys;
|
|
9261
|
+
}
|
|
9262
|
+
function _object_spread_props$1(target, source) {
|
|
9263
|
+
source = source != null ? source : {};
|
|
9264
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
9265
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
9266
|
+
} else {
|
|
9267
|
+
ownKeys$1(Object(source)).forEach(function(key) {
|
|
9268
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
9269
|
+
});
|
|
9270
|
+
}
|
|
9271
|
+
return target;
|
|
9272
|
+
}
|
|
9273
|
+
function _to_consumable_array$1(arr) {
|
|
9274
|
+
return _array_without_holes$1(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$1(arr) || _non_iterable_spread$1();
|
|
9275
|
+
}
|
|
9276
|
+
function _unsupported_iterable_to_array$1(o, minLen) {
|
|
9277
|
+
if (!o) return;
|
|
9278
|
+
if (typeof o === "string") return _array_like_to_array$1(o, minLen);
|
|
9279
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
9280
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
9281
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
9282
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
|
|
9283
|
+
}
|
|
9284
|
+
function parseTupleDef(def, refs) {
|
|
9285
|
+
if (def.rest) {
|
|
9286
|
+
return {
|
|
9287
|
+
type: "array",
|
|
9288
|
+
minItems: def.items.length,
|
|
9289
|
+
items: def.items.map(function(x, i) {
|
|
9290
|
+
return parseDef(x._def, _object_spread_props$1(_object_spread$1({}, refs), {
|
|
9291
|
+
currentPath: _to_consumable_array$1(refs.currentPath).concat([
|
|
9292
|
+
"items",
|
|
9293
|
+
"".concat(i)
|
|
9294
|
+
])
|
|
9295
|
+
}));
|
|
9296
|
+
}).reduce(function(acc, x) {
|
|
9297
|
+
return x === undefined ? acc : _to_consumable_array$1(acc).concat([
|
|
9298
|
+
x
|
|
9299
|
+
]);
|
|
9300
|
+
}, []),
|
|
9301
|
+
additionalItems: parseDef(def.rest._def, _object_spread_props$1(_object_spread$1({}, refs), {
|
|
9302
|
+
currentPath: _to_consumable_array$1(refs.currentPath).concat([
|
|
9303
|
+
"additionalItems"
|
|
9304
|
+
])
|
|
9305
|
+
}))
|
|
9306
|
+
};
|
|
9307
|
+
} else {
|
|
9308
|
+
return {
|
|
9309
|
+
type: "array",
|
|
9310
|
+
minItems: def.items.length,
|
|
9311
|
+
maxItems: def.items.length,
|
|
9312
|
+
items: def.items.map(function(x, i) {
|
|
9313
|
+
return parseDef(x._def, _object_spread_props$1(_object_spread$1({}, refs), {
|
|
9314
|
+
currentPath: _to_consumable_array$1(refs.currentPath).concat([
|
|
9315
|
+
"items",
|
|
9316
|
+
"".concat(i)
|
|
9317
|
+
])
|
|
9318
|
+
}));
|
|
9319
|
+
}).reduce(function(acc, x) {
|
|
9320
|
+
return x === undefined ? acc : _to_consumable_array$1(acc).concat([
|
|
9321
|
+
x
|
|
9322
|
+
]);
|
|
9323
|
+
}, [])
|
|
9324
|
+
};
|
|
9325
|
+
}
|
|
9326
|
+
}
|
|
9327
|
+
|
|
9328
|
+
function parseUndefinedDef(refs) {
|
|
9329
|
+
return {
|
|
9330
|
+
not: parseAnyDef(refs)
|
|
9331
|
+
};
|
|
9332
|
+
}
|
|
9333
|
+
|
|
9334
|
+
function parseUnknownDef(refs) {
|
|
9335
|
+
return parseAnyDef(refs);
|
|
9336
|
+
}
|
|
9337
|
+
|
|
9338
|
+
var parseReadonlyDef = function(def, refs) {
|
|
9339
|
+
return parseDef(def.innerType._def, refs);
|
|
9340
|
+
};
|
|
9341
|
+
|
|
9342
|
+
var selectParser = function(def, typeName, refs) {
|
|
9343
|
+
switch(typeName){
|
|
9344
|
+
case ZodFirstPartyTypeKind.ZodString:
|
|
9345
|
+
return parseStringDef(def, refs);
|
|
9346
|
+
case ZodFirstPartyTypeKind.ZodNumber:
|
|
9347
|
+
return parseNumberDef(def, refs);
|
|
9348
|
+
case ZodFirstPartyTypeKind.ZodObject:
|
|
9349
|
+
return parseObjectDef(def, refs);
|
|
9350
|
+
case ZodFirstPartyTypeKind.ZodBigInt:
|
|
9351
|
+
return parseBigintDef(def, refs);
|
|
9352
|
+
case ZodFirstPartyTypeKind.ZodBoolean:
|
|
9353
|
+
return parseBooleanDef();
|
|
9354
|
+
case ZodFirstPartyTypeKind.ZodDate:
|
|
9355
|
+
return parseDateDef(def, refs);
|
|
9356
|
+
case ZodFirstPartyTypeKind.ZodUndefined:
|
|
9357
|
+
return parseUndefinedDef(refs);
|
|
9358
|
+
case ZodFirstPartyTypeKind.ZodNull:
|
|
9359
|
+
return parseNullDef(refs);
|
|
9360
|
+
case ZodFirstPartyTypeKind.ZodArray:
|
|
9361
|
+
return parseArrayDef(def, refs);
|
|
9362
|
+
case ZodFirstPartyTypeKind.ZodUnion:
|
|
9363
|
+
case ZodFirstPartyTypeKind.ZodDiscriminatedUnion:
|
|
9364
|
+
return parseUnionDef(def, refs);
|
|
9365
|
+
case ZodFirstPartyTypeKind.ZodIntersection:
|
|
9366
|
+
return parseIntersectionDef(def, refs);
|
|
9367
|
+
case ZodFirstPartyTypeKind.ZodTuple:
|
|
9368
|
+
return parseTupleDef(def, refs);
|
|
9369
|
+
case ZodFirstPartyTypeKind.ZodRecord:
|
|
9370
|
+
return parseRecordDef(def, refs);
|
|
9371
|
+
case ZodFirstPartyTypeKind.ZodLiteral:
|
|
9372
|
+
return parseLiteralDef(def, refs);
|
|
9373
|
+
case ZodFirstPartyTypeKind.ZodEnum:
|
|
9374
|
+
return parseEnumDef(def);
|
|
9375
|
+
case ZodFirstPartyTypeKind.ZodNativeEnum:
|
|
9376
|
+
return parseNativeEnumDef(def);
|
|
9377
|
+
case ZodFirstPartyTypeKind.ZodNullable:
|
|
9378
|
+
return parseNullableDef(def, refs);
|
|
9379
|
+
case ZodFirstPartyTypeKind.ZodOptional:
|
|
9380
|
+
return parseOptionalDef(def, refs);
|
|
9381
|
+
case ZodFirstPartyTypeKind.ZodMap:
|
|
9382
|
+
return parseMapDef(def, refs);
|
|
9383
|
+
case ZodFirstPartyTypeKind.ZodSet:
|
|
9384
|
+
return parseSetDef(def, refs);
|
|
9385
|
+
case ZodFirstPartyTypeKind.ZodLazy:
|
|
9386
|
+
return function() {
|
|
9387
|
+
return def.getter()._def;
|
|
9388
|
+
};
|
|
9389
|
+
case ZodFirstPartyTypeKind.ZodPromise:
|
|
9390
|
+
return parsePromiseDef(def, refs);
|
|
9391
|
+
case ZodFirstPartyTypeKind.ZodNaN:
|
|
9392
|
+
case ZodFirstPartyTypeKind.ZodNever:
|
|
9393
|
+
return parseNeverDef(refs);
|
|
9394
|
+
case ZodFirstPartyTypeKind.ZodEffects:
|
|
9395
|
+
return parseEffectsDef(def, refs);
|
|
9396
|
+
case ZodFirstPartyTypeKind.ZodAny:
|
|
9397
|
+
return parseAnyDef(refs);
|
|
9398
|
+
case ZodFirstPartyTypeKind.ZodUnknown:
|
|
9399
|
+
return parseUnknownDef(refs);
|
|
9400
|
+
case ZodFirstPartyTypeKind.ZodDefault:
|
|
9401
|
+
return parseDefaultDef(def, refs);
|
|
9402
|
+
case ZodFirstPartyTypeKind.ZodBranded:
|
|
9403
|
+
return parseBrandedDef(def, refs);
|
|
9404
|
+
case ZodFirstPartyTypeKind.ZodReadonly:
|
|
9405
|
+
return parseReadonlyDef(def, refs);
|
|
9406
|
+
case ZodFirstPartyTypeKind.ZodCatch:
|
|
9407
|
+
return parseCatchDef(def, refs);
|
|
9408
|
+
case ZodFirstPartyTypeKind.ZodPipeline:
|
|
9409
|
+
return parsePipelineDef(def, refs);
|
|
9410
|
+
case ZodFirstPartyTypeKind.ZodFunction:
|
|
9411
|
+
case ZodFirstPartyTypeKind.ZodVoid:
|
|
9412
|
+
case ZodFirstPartyTypeKind.ZodSymbol:
|
|
9413
|
+
return undefined;
|
|
9414
|
+
default:
|
|
9415
|
+
return function(_) {
|
|
9416
|
+
return undefined;
|
|
9417
|
+
}();
|
|
9418
|
+
}
|
|
9419
|
+
};
|
|
9420
|
+
|
|
9421
|
+
function parseDef(def, refs) {
|
|
9422
|
+
var forceResolution = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
|
|
9423
|
+
var seenItem = refs.seen.get(def);
|
|
9424
|
+
if (refs.override) {
|
|
9425
|
+
var _refs_override;
|
|
9426
|
+
var overrideResult = (_refs_override = refs.override) === null || _refs_override === void 0 ? void 0 : _refs_override.call(refs, def, refs, seenItem, forceResolution);
|
|
9427
|
+
if (overrideResult !== ignoreOverride) {
|
|
9428
|
+
return overrideResult;
|
|
9429
|
+
}
|
|
9430
|
+
}
|
|
9431
|
+
if (seenItem && !forceResolution) {
|
|
9432
|
+
var seenSchema = get$ref(seenItem, refs);
|
|
9433
|
+
if (seenSchema !== undefined) {
|
|
9434
|
+
return seenSchema;
|
|
9435
|
+
}
|
|
9436
|
+
}
|
|
9437
|
+
var newItem = {
|
|
9438
|
+
def: def,
|
|
9439
|
+
path: refs.currentPath,
|
|
9440
|
+
jsonSchema: undefined
|
|
9441
|
+
};
|
|
9442
|
+
refs.seen.set(def, newItem);
|
|
9443
|
+
var jsonSchemaOrGetter = selectParser(def, def.typeName, refs);
|
|
9444
|
+
// If the return was a function, then the inner definition needs to be extracted before a call to parseDef (recursive)
|
|
9445
|
+
var jsonSchema = typeof jsonSchemaOrGetter === "function" ? parseDef(jsonSchemaOrGetter(), refs) : jsonSchemaOrGetter;
|
|
9446
|
+
if (jsonSchema) {
|
|
9447
|
+
addMeta(def, refs, jsonSchema);
|
|
9448
|
+
}
|
|
9449
|
+
if (refs.postProcess) {
|
|
9450
|
+
var postProcessResult = refs.postProcess(jsonSchema, def, refs);
|
|
9451
|
+
newItem.jsonSchema = jsonSchema;
|
|
9452
|
+
return postProcessResult;
|
|
9453
|
+
}
|
|
9454
|
+
newItem.jsonSchema = jsonSchema;
|
|
9455
|
+
return jsonSchema;
|
|
9456
|
+
}
|
|
9457
|
+
var get$ref = function(item, refs) {
|
|
9458
|
+
switch(refs.$refStrategy){
|
|
9459
|
+
case "root":
|
|
9460
|
+
return {
|
|
9461
|
+
$ref: item.path.join("/")
|
|
9462
|
+
};
|
|
9463
|
+
case "relative":
|
|
9464
|
+
return {
|
|
9465
|
+
$ref: getRelativePath(refs.currentPath, item.path)
|
|
9466
|
+
};
|
|
9467
|
+
case "none":
|
|
9468
|
+
case "seen":
|
|
9469
|
+
{
|
|
9470
|
+
if (item.path.length < refs.currentPath.length && item.path.every(function(value, index) {
|
|
9471
|
+
return refs.currentPath[index] === value;
|
|
9472
|
+
})) {
|
|
9473
|
+
console.warn("Recursive reference detected at ".concat(refs.currentPath.join("/"), "! Defaulting to any"));
|
|
9474
|
+
return parseAnyDef(refs);
|
|
9475
|
+
}
|
|
9476
|
+
return refs.$refStrategy === "seen" ? parseAnyDef(refs) : undefined;
|
|
9477
|
+
}
|
|
9478
|
+
}
|
|
9479
|
+
};
|
|
9480
|
+
var addMeta = function(def, refs, jsonSchema) {
|
|
9481
|
+
if (def.description) {
|
|
9482
|
+
jsonSchema.description = def.description;
|
|
9483
|
+
if (refs.markdownDescription) {
|
|
9484
|
+
jsonSchema.markdownDescription = def.description;
|
|
9485
|
+
}
|
|
9486
|
+
}
|
|
9487
|
+
return jsonSchema;
|
|
9488
|
+
};
|
|
9489
|
+
|
|
9490
|
+
function _array_like_to_array(arr, len) {
|
|
9491
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
9492
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
9493
|
+
return arr2;
|
|
9494
|
+
}
|
|
9495
|
+
function _array_without_holes(arr) {
|
|
9496
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
9497
|
+
}
|
|
9498
|
+
function _define_property(obj, key, value) {
|
|
9499
|
+
if (key in obj) {
|
|
9500
|
+
Object.defineProperty(obj, key, {
|
|
9501
|
+
value: value,
|
|
9502
|
+
enumerable: true,
|
|
9503
|
+
configurable: true,
|
|
9504
|
+
writable: true
|
|
9505
|
+
});
|
|
9506
|
+
} else {
|
|
9507
|
+
obj[key] = value;
|
|
9508
|
+
}
|
|
9509
|
+
return obj;
|
|
9510
|
+
}
|
|
9511
|
+
function _iterable_to_array(iter) {
|
|
9512
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
9513
|
+
}
|
|
9514
|
+
function _non_iterable_spread() {
|
|
9515
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
9516
|
+
}
|
|
9517
|
+
function _object_spread(target) {
|
|
9518
|
+
for(var i = 1; i < arguments.length; i++){
|
|
9519
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
9520
|
+
var ownKeys = Object.keys(source);
|
|
9521
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
9522
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
9523
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
9524
|
+
}));
|
|
9525
|
+
}
|
|
9526
|
+
ownKeys.forEach(function(key) {
|
|
9527
|
+
_define_property(target, key, source[key]);
|
|
9528
|
+
});
|
|
9529
|
+
}
|
|
9530
|
+
return target;
|
|
9531
|
+
}
|
|
9532
|
+
function ownKeys(object, enumerableOnly) {
|
|
9533
|
+
var keys = Object.keys(object);
|
|
9534
|
+
if (Object.getOwnPropertySymbols) {
|
|
9535
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
9536
|
+
keys.push.apply(keys, symbols);
|
|
9537
|
+
}
|
|
9538
|
+
return keys;
|
|
9539
|
+
}
|
|
9540
|
+
function _object_spread_props(target, source) {
|
|
9541
|
+
source = source != null ? source : {};
|
|
9542
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
9543
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
9544
|
+
} else {
|
|
9545
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
9546
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
9547
|
+
});
|
|
9548
|
+
}
|
|
9549
|
+
return target;
|
|
9550
|
+
}
|
|
9551
|
+
function _to_consumable_array(arr) {
|
|
9552
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
9553
|
+
}
|
|
9554
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
9555
|
+
if (!o) return;
|
|
9556
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
9557
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
9558
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
9559
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
9560
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
9561
|
+
}
|
|
9562
|
+
var zodToJsonSchema = function(schema, options) {
|
|
9563
|
+
var refs = getRefs(options);
|
|
9564
|
+
var definitions = undefined;
|
|
9565
|
+
var name = void 0 ;
|
|
9566
|
+
var _parseDef;
|
|
9567
|
+
var main = (_parseDef = parseDef(schema._def, refs , false)) !== null && _parseDef !== void 0 ? _parseDef : parseAnyDef(refs);
|
|
9568
|
+
if (refs.flags.hasReferencedOpenAiAnyType) {
|
|
9569
|
+
if (!definitions) {
|
|
9570
|
+
definitions = {};
|
|
9571
|
+
}
|
|
9572
|
+
if (!definitions[refs.openAiAnyTypeName]) {
|
|
9573
|
+
definitions[refs.openAiAnyTypeName] = {
|
|
9574
|
+
// Skipping "object" as no properties can be defined and additionalProperties must be "false"
|
|
9575
|
+
type: [
|
|
9576
|
+
"string",
|
|
9577
|
+
"number",
|
|
9578
|
+
"integer",
|
|
9579
|
+
"boolean",
|
|
9580
|
+
"array",
|
|
9581
|
+
"null"
|
|
9582
|
+
],
|
|
9583
|
+
items: {
|
|
9584
|
+
$ref: refs.$refStrategy === "relative" ? "1" : _to_consumable_array(refs.basePath).concat([
|
|
9585
|
+
refs.definitionPath,
|
|
9586
|
+
refs.openAiAnyTypeName
|
|
9587
|
+
]).join("/")
|
|
9588
|
+
}
|
|
9589
|
+
};
|
|
9590
|
+
}
|
|
9591
|
+
}
|
|
9592
|
+
var combined = name === undefined ? definitions ? _object_spread_props(_object_spread({}, main), _define_property({}, refs.definitionPath, definitions)) : main : _define_property({
|
|
9593
|
+
$ref: _to_consumable_array(refs.$refStrategy === "relative" ? [] : refs.basePath).concat([
|
|
9594
|
+
refs.definitionPath,
|
|
9595
|
+
name
|
|
9596
|
+
]).join("/")
|
|
9597
|
+
}, refs.definitionPath, _object_spread_props(_object_spread({}, definitions), _define_property({}, name, main)));
|
|
9598
|
+
if (refs.target === "jsonSchema7") {
|
|
9599
|
+
combined.$schema = "http://json-schema.org/draft-07/schema#";
|
|
9600
|
+
} else if (refs.target === "jsonSchema2019-09" || refs.target === "openAi") {
|
|
9601
|
+
combined.$schema = "https://json-schema.org/draft/2019-09/schema#";
|
|
9602
|
+
}
|
|
9603
|
+
if (refs.target === "openAi" && ("anyOf" in combined || "oneOf" in combined || "allOf" in combined || "type" in combined && Array.isArray(combined.type))) {
|
|
9604
|
+
console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");
|
|
9605
|
+
}
|
|
9606
|
+
return combined;
|
|
9607
|
+
};
|
|
9608
|
+
|
|
9609
|
+
function runtimeToolProviderComponent(provider) {
|
|
9610
|
+
var _extensions_resources, _extensions_resourceTemplates, _extensions_prompts;
|
|
9611
|
+
const descriptor = describeXpertToolProvider(provider);
|
|
9612
|
+
const options = descriptor.options;
|
|
9613
|
+
const extensions = resolveXpertMcpExtensions(provider, descriptor);
|
|
9614
|
+
// Fingerprint declarations only; never execute resource, prompt or completion handlers.
|
|
9615
|
+
const capabilities = _extends({}, (extensions == null ? void 0 : (_extensions_resources = extensions.resources) == null ? void 0 : _extensions_resources.length) ? {
|
|
9616
|
+
resources: extensions.resources.map((_param)=>{
|
|
9617
|
+
var { read } = _param, definition = _object_without_properties_loose$2(_param, [
|
|
9618
|
+
"read"
|
|
9619
|
+
]);
|
|
9620
|
+
return definition;
|
|
9621
|
+
})
|
|
9622
|
+
} : {}, (extensions == null ? void 0 : (_extensions_resourceTemplates = extensions.resourceTemplates) == null ? void 0 : _extensions_resourceTemplates.length) ? {
|
|
9623
|
+
resourceTemplates: extensions.resourceTemplates.map((_param)=>{
|
|
9624
|
+
var { read, complete } = _param, definition = _object_without_properties_loose$2(_param, [
|
|
9625
|
+
"read",
|
|
9626
|
+
"complete"
|
|
9627
|
+
]);
|
|
9628
|
+
return _extends({}, definition, {
|
|
9629
|
+
supportsCompletion: !!complete
|
|
9630
|
+
});
|
|
9631
|
+
})
|
|
9632
|
+
} : {}, (extensions == null ? void 0 : (_extensions_prompts = extensions.prompts) == null ? void 0 : _extensions_prompts.length) ? {
|
|
9633
|
+
prompts: extensions.prompts.map((_param)=>{
|
|
9634
|
+
var { get, complete } = _param, definition = _object_without_properties_loose$2(_param, [
|
|
9635
|
+
"get",
|
|
9636
|
+
"complete"
|
|
9637
|
+
]);
|
|
9638
|
+
return _extends({}, definition, {
|
|
9639
|
+
hasCompletionHandler: !!complete
|
|
9640
|
+
});
|
|
9641
|
+
})
|
|
9642
|
+
} : {});
|
|
9643
|
+
const tools = descriptor.tools.map((tool)=>{
|
|
9644
|
+
var _tool_options_title, _tool_middlewareProvider, _tool_options_mcp_visibility;
|
|
9645
|
+
return {
|
|
9646
|
+
name: tool.options.name,
|
|
9647
|
+
title: (_tool_options_title = tool.options.title) != null ? _tool_options_title : null,
|
|
9648
|
+
description: tool.options.description,
|
|
9649
|
+
middleware: (_tool_middlewareProvider = tool.middlewareProvider) != null ? _tool_middlewareProvider : null,
|
|
9650
|
+
mcp: tool.options.mcp ? _extends({}, tool.options.mcp.inputSchema ? {
|
|
9651
|
+
transportInputSchema: JSON.parse(JSON.stringify(zodToJsonSchema(tool.options.mcp.inputSchema)))
|
|
9652
|
+
} : {}, tool.options.mcp.task ? {
|
|
9653
|
+
task: tool.options.mcp.task
|
|
9654
|
+
} : {}, {
|
|
9655
|
+
behavior: tool.options.mcp.behavior,
|
|
9656
|
+
requiredContext: [
|
|
9657
|
+
...tool.options.mcp.requiredContext
|
|
9658
|
+
],
|
|
9659
|
+
visibility: [
|
|
9660
|
+
...(_tool_options_mcp_visibility = tool.options.mcp.visibility) != null ? _tool_options_mcp_visibility : [
|
|
9661
|
+
'model'
|
|
9662
|
+
]
|
|
9663
|
+
],
|
|
9664
|
+
inputSchema: JSON.parse(JSON.stringify(zodToJsonSchema(tool.options.inputSchema))),
|
|
9665
|
+
outputSchema: tool.options.outputSchema ? JSON.parse(JSON.stringify(zodToJsonSchema(tool.options.outputSchema))) : null
|
|
9666
|
+
}) : null
|
|
9667
|
+
};
|
|
9668
|
+
});
|
|
9669
|
+
var _options_description, _options_instructions;
|
|
9670
|
+
const config = {
|
|
9671
|
+
provider: options.provider,
|
|
9672
|
+
name: options.name,
|
|
9673
|
+
description: (_options_description = options.description) != null ? _options_description : null,
|
|
9674
|
+
instructions: (_options_instructions = options.instructions) != null ? _options_instructions : null,
|
|
9675
|
+
runtimeDiscovered: true,
|
|
9676
|
+
nativeMcp: true,
|
|
9677
|
+
toolCount: tools.filter((tool)=>!!tool.mcp).length
|
|
9678
|
+
};
|
|
9679
|
+
const metadata = {
|
|
9680
|
+
runtimeDiscovered: true,
|
|
9681
|
+
nativeMcp: true,
|
|
9682
|
+
toolNames: tools.filter((tool)=>!!tool.mcp).map((tool)=>tool.name)
|
|
9683
|
+
};
|
|
9684
|
+
return {
|
|
9685
|
+
componentType: PLUGIN_COMPONENT_TYPE.TOOLSET,
|
|
9686
|
+
componentKey: options.componentKey,
|
|
9687
|
+
config,
|
|
9688
|
+
metadata,
|
|
9689
|
+
definitionHash: createHash('sha256').update(stableJson(_extends({
|
|
9690
|
+
config,
|
|
9691
|
+
metadata,
|
|
9692
|
+
tools
|
|
9693
|
+
}, capabilities))).digest('hex')
|
|
9694
|
+
};
|
|
9695
|
+
}
|
|
9696
|
+
function stableJson(value) {
|
|
9697
|
+
if (value === undefined) return 'null';
|
|
9698
|
+
if (value === null || typeof value !== 'object') return JSON.stringify(value);
|
|
9699
|
+
if (Array.isArray(value)) return `[${value.map((item)=>stableJson(item)).join(',')}]`;
|
|
9700
|
+
const entries = Object.entries(value).sort(([left], [right])=>left.localeCompare(right));
|
|
9701
|
+
return `{${entries.map(([key, item])=>`${JSON.stringify(key)}:${stableJson(item)}`).join(',')}}`;
|
|
9702
|
+
}
|
|
9703
|
+
|
|
9704
|
+
export { ACCOUNT_BINDING_PERMISSION_SERVICE_TOKEN, AGENT_CHAT_DISPATCH_ERROR_STEER_TARGET_NOT_RUNNING, AGENT_CHAT_DISPATCH_MESSAGE_TYPE, AGENT_MIDDLEWARE_STRATEGY, AIModel, AIModelProviderNotFoundException, AIModelProviderRegistry, AIModelProviderStrategy, AI_MODEL_PROVIDER, AdapterDataSourceStrategy, AgentMiddlewareRegistry, AgentMiddlewareStrategy, AiModelNotFoundException, AssistantTaskRuntimeCapability, BOUND_IDENTITY_LOGIN_PERMISSION_SERVICE_TOKEN, BUILTIN_GLOBAL_SCOPE, BaseHTTPQueryRunner, BaseQueryRunner, BaseSQLQueryRunner, BaseSandbox, BaseStrategyRegistry, BuiltinToolset, CHAT_CHANNEL, CHAT_CHANNEL_TEXT_LIMITS, COLLABORATION_DOCUMENT_PROVIDER, CONNECTION_COMMAND_ROUTER_TOKEN, CONNECTOR_STRATEGY, CancelConversationCommand, ChatChannel, ChatChannelRegistry, ChatOAICompatReasoningModel, CollaborationDocumentProvider, CollaborationDocumentProviderRegistry, CollaborationRuntimeCapability, CommonParameterRules, ConnectorRuntimeCapability, ConnectorRuntimeFactoryCapability, ConnectorStrategyKey, ConnectorStrategyRegistry, CreateModelClientCommand, CredentialsValidateFailedError, DATASOURCE_STRATEGY, DBCreateTableMode, DBProtocolEnum, DBSyntaxEnum, DBTableAction, DBTableDataAction, DEFAULT_EXECUTION_CONFIG, DEFAULT_SANDBOX_EXECUTION_MAX_OUTPUT_BYTES, DEFAULT_SANDBOX_FILE_OPERATION_EXECUTION_OPTIONS, DEFAULT_SANDBOX_FILE_OPERATION_TIMEOUT_MS, DEFAULT_SANDBOX_FILE_OPERATION_TIMEOUT_SEC, DEFAULT_SANDBOX_FILE_SEARCH_EXECUTION_OPTIONS, DEFAULT_SANDBOX_FILE_SEARCH_TIMEOUT_MS, DEFAULT_SANDBOX_FILE_SEARCH_TIMEOUT_SEC, DEFAULT_SANDBOX_SHELL_EXECUTION_OPTIONS, DEFAULT_SANDBOX_SHELL_TIMEOUT_MS, DEFAULT_SANDBOX_SHELL_TIMEOUT_SEC, DOCUMENT_SOURCE_STRATEGY, DOCUMENT_TRANSFORMER_STRATEGY, DataSourceStrategy, DataSourceStrategyRegistry, DecoratedAgentMiddlewareStrategy, DecoratedToolsetStrategy, DocumentSourceRegistry, DocumentSourceStrategy, DocumentTransformerRegistry, DocumentTransformerStrategy, EVOLUTION_RUNTIME_SERVICE_TOKEN, EVOLUTION_TARGET_PROVIDER, EvolutionChangeRuntimeCapability, EvolutionRuntimeCapability, EvolutionTargetProviderRegistry, EvolutionTargetProviderStrategy, FILE_STORAGE_PROVIDER, FILE_UPLOAD_TARGET_STRATEGY, FileRuntimeCapability, FileStorageProvider, FileStorageProviderRegistry, FileUploadTargetRegistry, FileUploadTargetStrategy, GLOBAL_ORGANIZATION_SCOPE, HANDOFF_PERMISSION_SERVICE_TOKEN, HANDOFF_PROCESSOR_STRATEGY, HANDOFF_QUEUE_SERVICE_TOKEN, HandoffProcessorRegistry, HandoffProcessorStrategy, IMAGE_UNDERSTANDING_STRATEGY, INTEGRATION_PERMISSION_SERVICE_TOKEN, INTEGRATION_STRATEGY, ImageGenerationModel, ImageUnderstandingRegistry, ImageUnderstandingStrategy, IntegrationStrategyKey, IntegrationStrategyRegistry, JUMP_TO_TARGETS, JsonSchemaValidator, KNOWLEDGE_STRATEGY, KnowledgeStrategyKey, KnowledgeStrategyRegistry, LLMUsage, LargeLanguageModel, MANAGED_CONNECTION_REGISTRY_TOKEN, MANAGED_QUEUE_HANDLER_REGISTRY_TOKEN, MANAGED_QUEUE_SERVICE_TOKEN, MCP_CAPABILITY_CHANGE_EVENT_TYPES, MODEL_OUTPUT_VALIDATION_ERROR_CODE, ModelOutputValidationError, ModelProvider, ORGANIZATION_METADATA_KEY, OpenAICompatibleReranker, PERMISSION_OPERATION_METADATA_KEY, PLUGIN_CONFIG_RESOLVER_TOKEN, PLUGIN_JOB_PROCESSOR_METADATA, PLUGIN_METADATA, PLUGIN_METADATA_KEY, PLUGIN_VERSION_METADATA_KEY, PLUGIN_WEBHOOK_AUTH_METADATA_KEY, PLUGIN_WEBHOOK_AUTH_SERVICE_TOKEN, PROVIDE_AI_MODEL_LLM, PROVIDE_AI_MODEL_MODERATION, PROVIDE_AI_MODEL_RERANK, PROVIDE_AI_MODEL_SPEECH2TEXT, PROVIDE_AI_MODEL_TEXT_EMBEDDING, PROVIDE_AI_MODEL_TTS, PluginJobProcessor, PluginWebhookAuth, PluginWebhookAuthGuard, RETRIEVER_STRATEGY, RequestContext, RequestContextMiddleware, RequirePermissionOperation, RerankModel, RetrieverRegistry, RetrieverStrategy, SANDBOX_PROVIDER, SANDBOX_RUNTIME_PROVIDER, SANDBOX_SHELL_TIMEOUT_LIMITS_SEC, SANDBOX_WORKSPACE_MAPPER, SKILL_SOURCE_PROVIDER, SPEECH_TO_TEXT_PERMISSION_SERVICE_TOKEN, SPEECH_TO_TEXT_SERVICE_TOKEN, SSOProviderRegistry, SSOProviderStrategyKey, SSO_BINDING_PERMISSION_SERVICE_TOKEN, SSO_PROVIDER, STRATEGY_META_KEY, SYSTEM_GLOBAL_SCOPE, SandboxProviderRegistry, SandboxProviderStrategy, SandboxRuntimeProviderRegistry, SandboxRuntimeProviderStrategy, SandboxWorkspaceMapperRegistry, SandboxWorkspaceMapperStrategy, SkillSourceProviderRegistry, SkillSourceProviderStrategy, Speech2TextChatModel, SpeechToTextModel, StrategyBus, TENANT_GLOBAL_SCOPE_PREFIX, TENANT_GLOBAL_SCOPE_SUFFIX, TEXT_SPLITTER_STRATEGY, TOOLSET_STRATEGY, TextEmbeddingModelManager, TextSplitterRegistry, TextSplitterStrategy, TextToSpeechModel, ToolsetRegistry, ToolsetStrategy, USER_PERMISSION_SERVICE_TOKEN, VECTOR_STORE_STRATEGY, VIDEO_GENERATION_PERMISSION_SERVICE_TOKEN, VIDEO_GENERATION_SERVICE_TOKEN, VIDEO_GENERATOR_FAMILIES, VIEW_EXTENSION_CACHE_SERVICE_TOKEN, VIEW_EXTENSION_PROVIDER, VectorStoreRegistry, VectorStoreStrategy, VideoGenerationModel, ViewExtensionProvider, ViewExtensionProviderRegistry, WORKFLOW_NODE_STRATEGY, WORKFLOW_TRIGGER_STRATEGY, WorkflowNodeRegistry, WorkflowNodeStrategy, WorkflowTriggerRegistry, WorkflowTriggerStrategy, WorkspaceFilesRuntimeCapability, WrapWorkflowNodeExecutionCommand, XPERT_AGENT_MIDDLEWARE_RUNTIME_TOKEN, XPERT_TOOL_METHOD_METADATA, XPERT_TOOL_PROVIDER, XPERT_TOOL_PROVIDER_METADATA, XPERT_TOOL_RESULT_FORMAT_VERSION, XpFileSystem, XpertPrompt, XpertResource, XpertResourceTemplate, XpertServerPlugin, XpertTool, XpertToolProvider, XpertToolProviderCoordinator, XpertToolProviderRegistry, als, appendSandboxMessage, assertConnectorDefinition, buildSandboxTimeoutMessage, calcTokenUsage, calculateLLMUsagePrice, calculateModelPrice, calculateModelUsageCharge, chunkText, countTextTokens, countTokensSafe, createI18nInstance, createPluginLogger, createRuntimeCapability, defineAgentMessageType, defineChannelMessageType, defineMcpApp, defineMcpCapabilities, defineMcpPrompt, defineMcpResource, defineMcpResourceTemplate, defineXpertTool, derivePluginArtifactNamespace, describeXpertToolProvider, downloadRemoteFile, formatSandboxTimeout, getDefaultTenantId, getErrorMessage, getModelContextSize, getPermissionOperationMetadata, getPositionList, getPositionMap, getRequestContext, getRequiredPermissionOperation, getTenantGlobalScopeKey, getXpertToolMethod, isDevelopmentSandboxRuntimeEnvironment, isModelOutputValidationError, isModelUsagePricingConfig, isRemoteFile, isSandboxBackend, isSandboxManagedServiceAdapter, isSandboxServiceProxyAdapter, isSandboxTerminalAdapter, isStrategyInstance, isStructuredMessageType, isTenantGlobalScopeKey, loadYamlFile, mergeCredentials, mergeParentChildChunks, normalizeContextSize, pluginArtifactTableName, prepareToolResult, processAsyncAIGCManagedJob, renderRemoteModuleIframeHtml, renderRemoteReactIframeHtml, renderRemoteVueIframeHtml, resolveModelUsagePricingSnapshot, resolveSandboxBackend, resolveSandboxExecutionOptions, resolveSandboxManagedServiceAdapter, resolveSandboxServiceProxyAdapter, resolveSandboxTerminalAdapter, resolveStrategyMetadataTarget, resolveTenantGlobalScopeKey, resolveTokenUsage, resolveXpertMcpExtensions, runWithRequestContext, runtimeToolProviderComponent, secondsToMilliseconds, setDefaultTenantId, sumTokenUsage, textTokenBoundaries };
|