@xpert-ai/plugin-sdk 3.18.5 → 3.18.7
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 +35 -0
- package/README.md +44 -0
- package/data-workbench.cjs.default.js +1 -0
- package/data-workbench.cjs.js +669 -0
- package/data-workbench.cjs.mjs +2 -0
- package/data-workbench.d.ts +1 -0
- package/data-workbench.esm.js +663 -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/core/runtime-capability.d.ts +4 -0
- package/src/lib/core/strategy-bus.d.ts +3 -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-pagination.d.ts +6 -0
- package/src/lib/data/datasource/workbench-sql-lexer.d.ts +11 -0
- package/src/lib/data/datasource/workbench-sql-syntax.d.ts +3 -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/rag/analyzer/index.d.ts +3 -0
- package/src/lib/rag/analyzer/strategy.decorator.d.ts +2 -0
- package/src/lib/rag/analyzer/strategy.interface.d.ts +11 -0
- package/src/lib/rag/analyzer/strategy.registry.d.ts +8 -0
- package/src/lib/rag/index.d.ts +1 -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/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.cjs.js
CHANGED
|
@@ -24,6 +24,7 @@ var yaml = require('yaml');
|
|
|
24
24
|
var Ajv = require('ajv');
|
|
25
25
|
var schemaDraft04 = require('ajv/dist/refs/json-schema-draft-06.json');
|
|
26
26
|
var _axios = require('axios');
|
|
27
|
+
var dataWorkbench = require('./data-workbench.cjs.js');
|
|
27
28
|
var base = require('@langchain/core/callbacks/base');
|
|
28
29
|
var outputs = require('@langchain/core/outputs');
|
|
29
30
|
var messages = require('@langchain/core/messages');
|
|
@@ -514,6 +515,15 @@ function runWithRequestContext(req, res, next) {
|
|
|
514
515
|
}
|
|
515
516
|
|
|
516
517
|
exports.StrategyBus = class StrategyBus {
|
|
518
|
+
registerRemovalGuard(guard) {
|
|
519
|
+
this.removalGuards.add(guard);
|
|
520
|
+
return ()=>{
|
|
521
|
+
this.removalGuards.delete(guard);
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
async assertCanRemove(scopeKey, pluginNames) {
|
|
525
|
+
for (const guard of this.removalGuards)await guard(scopeKey, pluginNames);
|
|
526
|
+
}
|
|
517
527
|
upsert(strategyType, entry) {
|
|
518
528
|
this.subject.next({
|
|
519
529
|
type: 'UPSERT',
|
|
@@ -531,6 +541,7 @@ exports.StrategyBus = class StrategyBus {
|
|
|
531
541
|
} : {}));
|
|
532
542
|
}
|
|
533
543
|
constructor(){
|
|
544
|
+
this.removalGuards = new Set();
|
|
534
545
|
this.subject = new rxjs.Subject();
|
|
535
546
|
this.events$ = this.subject.asObservable();
|
|
536
547
|
}
|
|
@@ -1030,6 +1041,34 @@ exports.KnowledgeStrategyRegistry = __decorate([
|
|
|
1030
1041
|
])
|
|
1031
1042
|
], exports.KnowledgeStrategyRegistry);
|
|
1032
1043
|
|
|
1044
|
+
const KEYWORD_ANALYZER_STRATEGY = 'KEYWORD_ANALYZER_STRATEGY';
|
|
1045
|
+
const KeywordAnalyzerStrategy = (provider)=>common.applyDecorators(common.SetMetadata(KEYWORD_ANALYZER_STRATEGY, provider), common.SetMetadata(STRATEGY_META_KEY, KEYWORD_ANALYZER_STRATEGY));
|
|
1046
|
+
|
|
1047
|
+
exports.KeywordAnalyzerRegistry = class KeywordAnalyzerRegistry extends BaseStrategyRegistry {
|
|
1048
|
+
/** Resolve a pinned source without allowing a higher-priority scope to shadow it. */ getBySource(provider, source, organizationId) {
|
|
1049
|
+
var _this_strategies_get;
|
|
1050
|
+
if (!this.resolveStrategyScopeKeys(organizationId).includes(source.scopeKey)) return undefined;
|
|
1051
|
+
const strategy = (_this_strategies_get = this.strategies.get(source.scopeKey)) == null ? void 0 : _this_strategies_get.get(provider);
|
|
1052
|
+
if (!strategy) return undefined;
|
|
1053
|
+
const registered = this.getSource(strategy);
|
|
1054
|
+
if (registered.kind !== source.kind || registered.scopeKey !== source.scopeKey) return undefined;
|
|
1055
|
+
if (source.kind === 'plugin' && (registered.kind !== 'plugin' || registered.pluginName !== source.pluginName)) {
|
|
1056
|
+
return undefined;
|
|
1057
|
+
}
|
|
1058
|
+
return strategy;
|
|
1059
|
+
}
|
|
1060
|
+
constructor(discoveryService, reflector){
|
|
1061
|
+
super(KEYWORD_ANALYZER_STRATEGY, discoveryService, reflector);
|
|
1062
|
+
}
|
|
1063
|
+
};
|
|
1064
|
+
exports.KeywordAnalyzerRegistry = __decorate([
|
|
1065
|
+
common.Injectable(),
|
|
1066
|
+
__metadata("design:paramtypes", [
|
|
1067
|
+
core.DiscoveryService,
|
|
1068
|
+
core.Reflector
|
|
1069
|
+
])
|
|
1070
|
+
], exports.KeywordAnalyzerRegistry);
|
|
1071
|
+
|
|
1033
1072
|
const TOOLSET_STRATEGY = 'TOOLSET_STRATEGY';
|
|
1034
1073
|
/**
|
|
1035
1074
|
* Decorator to mark a provider as a Toolset Strategy
|
|
@@ -5966,9 +6005,164 @@ function freezeItems(items) {
|
|
|
5966
6005
|
const XPERT_TOOL_PROVIDER = 'XPERT_TOOL_PROVIDER';
|
|
5967
6006
|
const XPERT_TOOL_PROVIDER_METADATA = 'XPERT_TOOL_PROVIDER_METADATA';
|
|
5968
6007
|
const XPERT_TOOL_METHOD_METADATA = 'XPERT_TOOL_METHOD_METADATA';
|
|
5969
|
-
/** Marks one injectable business service as a
|
|
6008
|
+
/** Marks one injectable business service as a shared Tool, Resource and Prompt provider. */ const XpertToolProvider = (options)=>common.applyDecorators(common.Injectable(), common.SetMetadata(XPERT_TOOL_PROVIDER, options.provider), common.SetMetadata(XPERT_TOOL_PROVIDER_METADATA, Object.freeze(_extends._extends({}, options))), common.SetMetadata(STRATEGY_META_KEY, XPERT_TOOL_PROVIDER));
|
|
5970
6009
|
/** Exposes one business method through an Agent Middleware, native MCP, or both. */ const XpertTool = (options)=>common.SetMetadata(XPERT_TOOL_METHOD_METADATA, Object.freeze(_extends._extends({}, options)));
|
|
5971
6010
|
|
|
6011
|
+
/** Child overrides hide parent declarations, including undecorated overrides and accessors. */ function collectProviderMethods(instance) {
|
|
6012
|
+
const methods = [];
|
|
6013
|
+
const seen = new Set();
|
|
6014
|
+
let prototype = Object.getPrototypeOf(instance);
|
|
6015
|
+
while(prototype && prototype !== Object.prototype){
|
|
6016
|
+
for (const methodName of Object.getOwnPropertyNames(prototype)){
|
|
6017
|
+
var _Object_getOwnPropertyDescriptor;
|
|
6018
|
+
if (methodName === 'constructor' || seen.has(methodName)) continue;
|
|
6019
|
+
seen.add(methodName);
|
|
6020
|
+
const method = (_Object_getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor(prototype, methodName)) == null ? void 0 : _Object_getOwnPropertyDescriptor.value;
|
|
6021
|
+
if (typeof method === 'function') methods.push({
|
|
6022
|
+
methodName,
|
|
6023
|
+
method
|
|
6024
|
+
});
|
|
6025
|
+
}
|
|
6026
|
+
prototype = Object.getPrototypeOf(prototype);
|
|
6027
|
+
}
|
|
6028
|
+
return methods;
|
|
6029
|
+
}
|
|
6030
|
+
|
|
6031
|
+
function _object_without_properties_loose$2(source, excluded) {
|
|
6032
|
+
if (source == null) return {};
|
|
6033
|
+
var target = {};
|
|
6034
|
+
var sourceKeys = Object.keys(source);
|
|
6035
|
+
var key, i;
|
|
6036
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
6037
|
+
key = sourceKeys[i];
|
|
6038
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
6039
|
+
target[key] = source[key];
|
|
6040
|
+
}
|
|
6041
|
+
return target;
|
|
6042
|
+
}
|
|
6043
|
+
|
|
6044
|
+
const MCP_METHOD_METADATA = 'XPERT_MCP_METHOD_METADATA';
|
|
6045
|
+
/** The decorated method receives ResourceReadContext and returns McpResourceReadResult. */ const XpertResource = (options)=>common.SetMetadata(MCP_METHOD_METADATA, {
|
|
6046
|
+
kind: 'resource',
|
|
6047
|
+
options: Object.freeze(_extends._extends({}, options))
|
|
6048
|
+
});
|
|
6049
|
+
/** The decorated method receives URI arguments and ResourceReadContext. */ const XpertResourceTemplate = (options)=>common.SetMetadata(MCP_METHOD_METADATA, {
|
|
6050
|
+
kind: 'resource-template',
|
|
6051
|
+
options: Object.freeze(_extends._extends({}, options))
|
|
6052
|
+
});
|
|
6053
|
+
/** The decorated method receives prompt arguments and ToolExecutionContext. */ const XpertPrompt = (options)=>common.SetMetadata(MCP_METHOD_METADATA, {
|
|
6054
|
+
kind: 'prompt',
|
|
6055
|
+
options: Object.freeze(_extends._extends({}, options))
|
|
6056
|
+
});
|
|
6057
|
+
function describeXpertMcpMethods(instance) {
|
|
6058
|
+
const result = [];
|
|
6059
|
+
for (const { methodName, method } of collectProviderMethods(instance)){
|
|
6060
|
+
var _metadata_options_uri, _metadata_options_uriTemplate, _metadata_options_name;
|
|
6061
|
+
const metadata = Reflect.getMetadata(MCP_METHOD_METADATA, method);
|
|
6062
|
+
if (!metadata) continue;
|
|
6063
|
+
const { options } = metadata;
|
|
6064
|
+
if (!/^[A-Za-z0-9_-]{1,191}$/.test(options.key)) throw new Error(`Invalid MCP capability key '${options.key}'.`);
|
|
6065
|
+
var _options_requiredContext;
|
|
6066
|
+
const contexts = (_options_requiredContext = options.requiredContext) != null ? _options_requiredContext : [];
|
|
6067
|
+
if (new Set(contexts).size !== contexts.length || contexts.some((context)=>!contracts.MCP_REQUIRED_CONTEXTS.includes(context))) {
|
|
6068
|
+
throw new Error(`MCP capability '${options.key}' declares invalid execution contexts.`);
|
|
6069
|
+
}
|
|
6070
|
+
if (metadata.kind === 'resource' && !((_metadata_options_uri = metadata.options.uri) == null ? void 0 : _metadata_options_uri.trim())) {
|
|
6071
|
+
throw new Error(`Resource '${options.key}' requires a URI.`);
|
|
6072
|
+
}
|
|
6073
|
+
if (metadata.kind === 'resource-template' && !((_metadata_options_uriTemplate = metadata.options.uriTemplate) == null ? void 0 : _metadata_options_uriTemplate.trim())) {
|
|
6074
|
+
throw new Error(`Resource template '${options.key}' requires a URI template.`);
|
|
6075
|
+
}
|
|
6076
|
+
if (metadata.kind === 'prompt' && !((_metadata_options_name = metadata.options.name) == null ? void 0 : _metadata_options_name.trim())) {
|
|
6077
|
+
throw new Error(`Prompt '${options.key}' requires a name.`);
|
|
6078
|
+
}
|
|
6079
|
+
if (metadata.kind !== 'resource' && metadata.options.completionMethod) {
|
|
6080
|
+
callable(instance, metadata.options.completionMethod);
|
|
6081
|
+
}
|
|
6082
|
+
result.push(Object.freeze(_extends._extends({}, metadata, {
|
|
6083
|
+
methodName
|
|
6084
|
+
})));
|
|
6085
|
+
}
|
|
6086
|
+
return Object.freeze(result);
|
|
6087
|
+
}
|
|
6088
|
+
/** One catalog for runtime publication and fingerprinting; legacy declarations remain supported. */ function resolveXpertMcpExtensions(instance, descriptor) {
|
|
6089
|
+
const legacy = 'getMcpExtensions' in instance && typeof instance.getMcpExtensions === 'function' ? instance.getMcpExtensions == null ? void 0 : instance.getMcpExtensions.call(instance) : undefined;
|
|
6090
|
+
var _legacy_resources;
|
|
6091
|
+
const resources = [
|
|
6092
|
+
...(_legacy_resources = legacy == null ? void 0 : legacy.resources) != null ? _legacy_resources : []
|
|
6093
|
+
];
|
|
6094
|
+
var _legacy_resourceTemplates;
|
|
6095
|
+
const resourceTemplates = [
|
|
6096
|
+
...(_legacy_resourceTemplates = legacy == null ? void 0 : legacy.resourceTemplates) != null ? _legacy_resourceTemplates : []
|
|
6097
|
+
];
|
|
6098
|
+
var _legacy_prompts;
|
|
6099
|
+
const prompts = [
|
|
6100
|
+
...(_legacy_prompts = legacy == null ? void 0 : legacy.prompts) != null ? _legacy_prompts : []
|
|
6101
|
+
];
|
|
6102
|
+
var _descriptor_mcpMethods;
|
|
6103
|
+
for (const _ref of (_descriptor_mcpMethods = descriptor == null ? void 0 : descriptor.mcpMethods) != null ? _descriptor_mcpMethods : describeXpertMcpMethods(instance)){
|
|
6104
|
+
let definition = _ref;
|
|
6105
|
+
const method = callable(instance, definition.methodName);
|
|
6106
|
+
switch(definition.kind){
|
|
6107
|
+
case 'resource':
|
|
6108
|
+
resources.push(_extends._extends({}, definition.options, {
|
|
6109
|
+
read: method
|
|
6110
|
+
}));
|
|
6111
|
+
break;
|
|
6112
|
+
case 'resource-template':
|
|
6113
|
+
{
|
|
6114
|
+
const _definition_options = definition.options, { completionMethod } = _definition_options, options = _object_without_properties_loose$2(_definition_options, [
|
|
6115
|
+
"completionMethod"
|
|
6116
|
+
]);
|
|
6117
|
+
resourceTemplates.push(_extends._extends({}, options, {
|
|
6118
|
+
read: method
|
|
6119
|
+
}, completionMethod ? {
|
|
6120
|
+
complete: callable(instance, completionMethod)
|
|
6121
|
+
} : {}));
|
|
6122
|
+
break;
|
|
6123
|
+
}
|
|
6124
|
+
case 'prompt':
|
|
6125
|
+
{
|
|
6126
|
+
const _definition_options = definition.options, { completionMethod } = _definition_options, options = _object_without_properties_loose$2(_definition_options, [
|
|
6127
|
+
"completionMethod"
|
|
6128
|
+
]);
|
|
6129
|
+
prompts.push(_extends._extends({}, options, {
|
|
6130
|
+
get: method
|
|
6131
|
+
}, completionMethod ? {
|
|
6132
|
+
complete: callable(instance, completionMethod)
|
|
6133
|
+
} : {}));
|
|
6134
|
+
break;
|
|
6135
|
+
}
|
|
6136
|
+
}
|
|
6137
|
+
}
|
|
6138
|
+
assertUnique(resources, (item)=>item.key, 'resource key');
|
|
6139
|
+
assertUnique(resources, (item)=>item.uri, 'resource URI');
|
|
6140
|
+
assertUnique(resourceTemplates, (item)=>item.key, 'resource template key');
|
|
6141
|
+
assertUnique(resourceTemplates, (item)=>item.uriTemplate, 'resource template URI');
|
|
6142
|
+
assertUnique(prompts, (item)=>item.key, 'prompt key');
|
|
6143
|
+
assertUnique(prompts, (item)=>item.name, 'prompt name');
|
|
6144
|
+
return {
|
|
6145
|
+
resources,
|
|
6146
|
+
resourceTemplates,
|
|
6147
|
+
prompts
|
|
6148
|
+
};
|
|
6149
|
+
}
|
|
6150
|
+
function callable(instance, name) {
|
|
6151
|
+
var _collectProviderMethods_find;
|
|
6152
|
+
// Match discovery semantics: accessors and non-method overrides are not executable handlers.
|
|
6153
|
+
const method = (_collectProviderMethods_find = collectProviderMethods(instance).find((item)=>item.methodName === name)) == null ? void 0 : _collectProviderMethods_find.method;
|
|
6154
|
+
if (typeof method !== 'function') throw new Error(`MCP method '${name}' is not callable.`);
|
|
6155
|
+
return method.bind(instance);
|
|
6156
|
+
}
|
|
6157
|
+
function assertUnique(items, key, label) {
|
|
6158
|
+
const seen = new Set();
|
|
6159
|
+
for (const item of items){
|
|
6160
|
+
const value = key(item);
|
|
6161
|
+
if (seen.has(value)) throw new Error(`MCP ${label} '${value}' is declared more than once.`);
|
|
6162
|
+
seen.add(value);
|
|
6163
|
+
}
|
|
6164
|
+
}
|
|
6165
|
+
|
|
5972
6166
|
const PROVIDER_PATTERN = /^[a-z][a-z0-9_]*$/;
|
|
5973
6167
|
const MIDDLEWARE_PROVIDER_PATTERN = /^[A-Za-z][A-Za-z0-9_]*$/;
|
|
5974
6168
|
const COMPONENT_KEY_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
@@ -6011,31 +6205,24 @@ function describeXpertToolProvider(instance) {
|
|
|
6011
6205
|
options: toolOptions
|
|
6012
6206
|
});
|
|
6013
6207
|
});
|
|
6014
|
-
|
|
6015
|
-
|
|
6208
|
+
const mcpMethods = describeXpertMcpMethods(instance);
|
|
6209
|
+
if (!tools.length && !mcpMethods.length) {
|
|
6210
|
+
throw new Error(`Provider '${options.provider}' does not declare any decorated capability methods.`);
|
|
6016
6211
|
}
|
|
6017
6212
|
return Object.freeze({
|
|
6018
6213
|
options: Object.freeze(_extends._extends({}, options)),
|
|
6019
|
-
tools: Object.freeze(tools)
|
|
6214
|
+
tools: Object.freeze(tools),
|
|
6215
|
+
mcpMethods
|
|
6020
6216
|
});
|
|
6021
6217
|
}
|
|
6022
6218
|
function collectDecoratedMethods(instance) {
|
|
6023
6219
|
const result = [];
|
|
6024
|
-
const
|
|
6025
|
-
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
const method = Reflect.get(prototype, methodName);
|
|
6031
|
-
if (typeof method !== 'function') continue;
|
|
6032
|
-
const options = Reflect.getMetadata(XPERT_TOOL_METHOD_METADATA, method);
|
|
6033
|
-
if (options) result.push({
|
|
6034
|
-
methodName,
|
|
6035
|
-
options
|
|
6036
|
-
});
|
|
6037
|
-
}
|
|
6038
|
-
prototype = Object.getPrototypeOf(prototype);
|
|
6220
|
+
for (const { methodName, method } of collectProviderMethods(instance)){
|
|
6221
|
+
const options = Reflect.getMetadata(XPERT_TOOL_METHOD_METADATA, method);
|
|
6222
|
+
if (options) result.push({
|
|
6223
|
+
methodName,
|
|
6224
|
+
options
|
|
6225
|
+
});
|
|
6039
6226
|
}
|
|
6040
6227
|
return result;
|
|
6041
6228
|
}
|
|
@@ -6088,15 +6275,12 @@ function validateToolOptions(options, methodName) {
|
|
|
6088
6275
|
if (options.resultFormat && options.resultFormat !== 'dto' && options.resultFormat !== 'tool_result') {
|
|
6089
6276
|
throw new Error(`Tool '${options.name}' declares an invalid resultFormat.`);
|
|
6090
6277
|
}
|
|
6091
|
-
if (options.resultFormat === 'tool_result' && !options.outputSchema) {
|
|
6092
|
-
throw new Error(`Tool '${options.name}' requires outputSchema for tool_result.`);
|
|
6093
|
-
}
|
|
6094
6278
|
if (!TOOL_NAME_PATTERN.test(options.name) || options.name.length > 191) {
|
|
6095
6279
|
throw new Error(`Method '${methodName}' declares invalid Tool name '${options.name}'.`);
|
|
6096
6280
|
}
|
|
6097
6281
|
if (!((_options_description = options.description) == null ? void 0 : _options_description.trim())) throw new Error(`Tool '${options.name}' requires a description.`);
|
|
6098
6282
|
assertStrictObjectSchema(options.inputSchema, options.name, 'input');
|
|
6099
|
-
if (options.mcp && !options.outputSchema) {
|
|
6283
|
+
if (options.mcp && !options.outputSchema && options.resultFormat !== 'tool_result') {
|
|
6100
6284
|
throw new Error(`MCP Tool '${options.name}' requires an outputSchema.`);
|
|
6101
6285
|
}
|
|
6102
6286
|
if (options.mcp && options.outputSchema) {
|
|
@@ -6106,6 +6290,14 @@ function validateToolOptions(options, methodName) {
|
|
|
6106
6290
|
throw new Error(`MCP Tool '${options.name}' requires at least one execution context.`);
|
|
6107
6291
|
}
|
|
6108
6292
|
if (options.mcp) {
|
|
6293
|
+
const transportSchema = options.mcp.inputSchema;
|
|
6294
|
+
if (transportSchema && typeof transportSchema.parseAsync !== 'function') {
|
|
6295
|
+
throw new Error(`MCP Tool '${options.name}' requires a Zod transport input schema.`);
|
|
6296
|
+
}
|
|
6297
|
+
const task = options.mcp.task;
|
|
6298
|
+
if (task && (task.mode !== 'optional' && task.mode !== 'required' || task.maxLifetimeMs !== undefined && (!Number.isSafeInteger(task.maxLifetimeMs) || task.maxLifetimeMs <= 0))) {
|
|
6299
|
+
throw new Error(`MCP Tool '${options.name}' declares invalid task execution policy.`);
|
|
6300
|
+
}
|
|
6109
6301
|
if (options.mcp.defaultApprovalMode !== undefined && !includesValue(contracts.MCP_CAPABILITY_APPROVAL_MODES, options.mcp.defaultApprovalMode)) {
|
|
6110
6302
|
throw new Error(`MCP Tool '${options.name}' declares invalid defaultApprovalMode.`);
|
|
6111
6303
|
}
|
|
@@ -6288,7 +6480,7 @@ const contentSchema = v3.z.discriminatedUnion('type', [
|
|
|
6288
6480
|
var _result_content;
|
|
6289
6481
|
const envelope = v3.z.object({
|
|
6290
6482
|
content: v3.z.array(contentSchema).max(32).optional(),
|
|
6291
|
-
structuredContent: outputSchema,
|
|
6483
|
+
structuredContent: outputSchema != null ? outputSchema : v3.z.unknown().optional(),
|
|
6292
6484
|
isError: v3.z.boolean().optional()
|
|
6293
6485
|
}).strict();
|
|
6294
6486
|
const result = await envelope.parseAsync(value);
|
|
@@ -6324,7 +6516,7 @@ const contentSchema = v3.z.discriminatedUnion('type', [
|
|
|
6324
6516
|
// MCP clients may expose only content to the model. Keep the validated DTO
|
|
6325
6517
|
// readable there too, while retaining binary blocks and App structured data.
|
|
6326
6518
|
const text = JSON.stringify(result.structuredContent);
|
|
6327
|
-
if (!content.some((item)=>item.type === 'text' && item.text === text)) content.push({
|
|
6519
|
+
if (text !== undefined && !content.some((item)=>item.type === 'text' && item.text === text)) content.push({
|
|
6328
6520
|
type: 'text',
|
|
6329
6521
|
text
|
|
6330
6522
|
});
|
|
@@ -6445,7 +6637,11 @@ let DecoratedBuiltinToolset = class DecoratedBuiltinToolset extends modelProvide
|
|
|
6445
6637
|
this.pluginName = pluginName;
|
|
6446
6638
|
this.pluginVersion = pluginVersion;
|
|
6447
6639
|
this.tools = [];
|
|
6640
|
+
const extensions = resolveXpertMcpExtensions(instance, descriptor);
|
|
6448
6641
|
_class_private_field_loose_base(this, _definitions)[_definitions] = _extends._extends({
|
|
6642
|
+
resources: extensions == null ? void 0 : extensions.resources,
|
|
6643
|
+
resourceTemplates: extensions == null ? void 0 : extensions.resourceTemplates,
|
|
6644
|
+
prompts: extensions == null ? void 0 : extensions.prompts,
|
|
6449
6645
|
instructions: descriptor.options.instructions,
|
|
6450
6646
|
tools: descriptor.tools.filter((item)=>!!item.options.mcp).map((item)=>createMcpTool(instance, item))
|
|
6451
6647
|
}, ((_descriptor_options_apps = descriptor.options.apps) == null ? void 0 : _descriptor_options_apps.length) ? {
|
|
@@ -6460,7 +6656,7 @@ function createAgentTool(instance, descriptor, middlewareContext, middlewareOpti
|
|
|
6460
6656
|
return tools.tool(async (input, config)=>{
|
|
6461
6657
|
const parsedInput = await descriptor.options.inputSchema.parseAsync(input);
|
|
6462
6658
|
const output = await invoke(parsedInput, agentExecutionContext(middlewareContext, middlewareOptions, config));
|
|
6463
|
-
if (descriptor.options.resultFormat === 'tool_result'
|
|
6659
|
+
if (descriptor.options.resultFormat === 'tool_result') {
|
|
6464
6660
|
const result = await resolveToolResult(output, (value)=>parseDecoratedToolResult(value, descriptor.options.outputSchema));
|
|
6465
6661
|
var _result_isError;
|
|
6466
6662
|
return [
|
|
@@ -6488,24 +6684,28 @@ function createAgentTool(instance, descriptor, middlewareContext, middlewareOpti
|
|
|
6488
6684
|
function createMcpTool(instance, descriptor) {
|
|
6489
6685
|
const mcp = descriptor.options.mcp;
|
|
6490
6686
|
const outputSchema = descriptor.options.outputSchema;
|
|
6491
|
-
if (!mcp
|
|
6687
|
+
if (!mcp) throw new Error(`MCP Tool '${descriptor.options.name}' is incomplete.`);
|
|
6492
6688
|
const invoke = getXpertToolMethod(instance, descriptor);
|
|
6493
|
-
var _mcp_visibility;
|
|
6689
|
+
var _mcp_inputSchema, _mcp_visibility;
|
|
6494
6690
|
return _extends._extends({
|
|
6495
6691
|
name: descriptor.options.name
|
|
6496
6692
|
}, descriptor.options.title ? {
|
|
6497
6693
|
title: descriptor.options.title
|
|
6498
6694
|
} : {}, {
|
|
6499
6695
|
description: descriptor.options.description,
|
|
6500
|
-
inputSchema: descriptor.options.inputSchema
|
|
6501
|
-
|
|
6696
|
+
inputSchema: (_mcp_inputSchema = mcp.inputSchema) != null ? _mcp_inputSchema : descriptor.options.inputSchema
|
|
6697
|
+
}, outputSchema ? {
|
|
6698
|
+
outputSchema
|
|
6699
|
+
} : {}, {
|
|
6502
6700
|
exposure: {
|
|
6503
6701
|
mcp: {
|
|
6504
6702
|
eligible: true
|
|
6505
6703
|
}
|
|
6506
6704
|
},
|
|
6507
6705
|
behavior: mcp.behavior
|
|
6508
|
-
}, mcp.
|
|
6706
|
+
}, mcp.task ? {
|
|
6707
|
+
task: mcp.task
|
|
6708
|
+
} : {}, mcp.defaultApprovalMode ? {
|
|
6509
6709
|
defaultApprovalMode: mcp.defaultApprovalMode
|
|
6510
6710
|
} : {}, {
|
|
6511
6711
|
requiredContext: [
|
|
@@ -6526,12 +6726,13 @@ function createMcpTool(instance, descriptor) {
|
|
|
6526
6726
|
} : {}, {
|
|
6527
6727
|
execute: async (input, context)=>{
|
|
6528
6728
|
const parsedInput = await descriptor.options.inputSchema.parseAsync(input);
|
|
6529
|
-
const
|
|
6729
|
+
const transportInput = mcp.inputSchema ? await mcp.inputSchema.parseAsync(parsedInput) : parsedInput;
|
|
6730
|
+
const output = await invoke(transportInput, mcpExecutionContext(context));
|
|
6530
6731
|
if (descriptor.options.resultFormat === 'tool_result') {
|
|
6531
6732
|
return resolveToolResult(output, (value)=>parseDecoratedToolResult(value, outputSchema));
|
|
6532
6733
|
}
|
|
6533
6734
|
return resolveToolResult(output, async (value)=>{
|
|
6534
|
-
const parsedOutput = await outputSchema.parseAsync(value);
|
|
6735
|
+
const parsedOutput = outputSchema ? await outputSchema.parseAsync(value) : value;
|
|
6535
6736
|
// Serialize once so text-only clients and MCP Apps receive the same JSON-safe DTO.
|
|
6536
6737
|
const text = stringifyDto(parsedOutput, descriptor.options.name);
|
|
6537
6738
|
return {
|
|
@@ -6548,6 +6749,7 @@ function createMcpTool(instance, descriptor) {
|
|
|
6548
6749
|
});
|
|
6549
6750
|
}
|
|
6550
6751
|
function agentExecutionContext(context, middlewareOptions, config) {
|
|
6752
|
+
var _context_runtime_capabilities;
|
|
6551
6753
|
const configurable = config.configurable;
|
|
6552
6754
|
const requestId = readString(configurable, 'tool_call_id');
|
|
6553
6755
|
const executionId = readString(configurable, 'executionId');
|
|
@@ -6576,11 +6778,13 @@ function agentExecutionContext(context, middlewareOptions, config) {
|
|
|
6576
6778
|
} : {}, {
|
|
6577
6779
|
signal: config.signal,
|
|
6578
6780
|
host: {
|
|
6781
|
+
files: (_context_runtime_capabilities = context.runtime.capabilities) == null ? void 0 : _context_runtime_capabilities.get(modelProvider.WorkspaceFilesRuntimeCapability),
|
|
6579
6782
|
models: {
|
|
6580
6783
|
createModelClient: context.runtime.createModelClient,
|
|
6581
6784
|
getModelProvider: context.runtime.getModelProvider
|
|
6582
6785
|
}
|
|
6583
6786
|
},
|
|
6787
|
+
xpertFeatures: context.xpertFeatures,
|
|
6584
6788
|
middlewareOptions
|
|
6585
6789
|
});
|
|
6586
6790
|
}
|
|
@@ -6687,6 +6891,2872 @@ exports.XpertToolProviderCoordinator = __decorate([
|
|
|
6687
6891
|
])
|
|
6688
6892
|
], exports.XpertToolProviderCoordinator);
|
|
6689
6893
|
|
|
6894
|
+
function _define_property$h(obj, key, value) {
|
|
6895
|
+
if (key in obj) {
|
|
6896
|
+
Object.defineProperty(obj, key, {
|
|
6897
|
+
value: value,
|
|
6898
|
+
enumerable: true,
|
|
6899
|
+
configurable: true,
|
|
6900
|
+
writable: true
|
|
6901
|
+
});
|
|
6902
|
+
} else {
|
|
6903
|
+
obj[key] = value;
|
|
6904
|
+
}
|
|
6905
|
+
return obj;
|
|
6906
|
+
}
|
|
6907
|
+
function _object_spread$h(target) {
|
|
6908
|
+
for(var i = 1; i < arguments.length; i++){
|
|
6909
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
6910
|
+
var ownKeys = Object.keys(source);
|
|
6911
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
6912
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
6913
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
6914
|
+
}));
|
|
6915
|
+
}
|
|
6916
|
+
ownKeys.forEach(function(key) {
|
|
6917
|
+
_define_property$h(target, key, source[key]);
|
|
6918
|
+
});
|
|
6919
|
+
}
|
|
6920
|
+
return target;
|
|
6921
|
+
}
|
|
6922
|
+
var ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
|
|
6923
|
+
var defaultOptions = {
|
|
6924
|
+
name: undefined,
|
|
6925
|
+
$refStrategy: "root",
|
|
6926
|
+
basePath: [
|
|
6927
|
+
"#"
|
|
6928
|
+
],
|
|
6929
|
+
effectStrategy: "input",
|
|
6930
|
+
pipeStrategy: "all",
|
|
6931
|
+
dateStrategy: "format:date-time",
|
|
6932
|
+
mapStrategy: "entries",
|
|
6933
|
+
removeAdditionalStrategy: "passthrough",
|
|
6934
|
+
allowedAdditionalProperties: true,
|
|
6935
|
+
rejectedAdditionalProperties: false,
|
|
6936
|
+
definitionPath: "definitions",
|
|
6937
|
+
target: "jsonSchema7",
|
|
6938
|
+
strictUnions: false,
|
|
6939
|
+
definitions: {},
|
|
6940
|
+
errorMessages: false,
|
|
6941
|
+
markdownDescription: false,
|
|
6942
|
+
patternStrategy: "escape",
|
|
6943
|
+
applyRegexFlags: false,
|
|
6944
|
+
emailStrategy: "format:email",
|
|
6945
|
+
base64Strategy: "contentEncoding:base64",
|
|
6946
|
+
nameStrategy: "ref",
|
|
6947
|
+
openAiAnyTypeName: "OpenAiAnyType"
|
|
6948
|
+
};
|
|
6949
|
+
var getDefaultOptions = function(options) {
|
|
6950
|
+
return _object_spread$h({}, defaultOptions, options);
|
|
6951
|
+
};
|
|
6952
|
+
|
|
6953
|
+
function _array_like_to_array$f(arr, len) {
|
|
6954
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
6955
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
6956
|
+
return arr2;
|
|
6957
|
+
}
|
|
6958
|
+
function _array_with_holes(arr) {
|
|
6959
|
+
if (Array.isArray(arr)) return arr;
|
|
6960
|
+
}
|
|
6961
|
+
function _array_without_holes$f(arr) {
|
|
6962
|
+
if (Array.isArray(arr)) return _array_like_to_array$f(arr);
|
|
6963
|
+
}
|
|
6964
|
+
function _define_property$g(obj, key, value) {
|
|
6965
|
+
if (key in obj) {
|
|
6966
|
+
Object.defineProperty(obj, key, {
|
|
6967
|
+
value: value,
|
|
6968
|
+
enumerable: true,
|
|
6969
|
+
configurable: true,
|
|
6970
|
+
writable: true
|
|
6971
|
+
});
|
|
6972
|
+
} else {
|
|
6973
|
+
obj[key] = value;
|
|
6974
|
+
}
|
|
6975
|
+
return obj;
|
|
6976
|
+
}
|
|
6977
|
+
function _iterable_to_array$f(iter) {
|
|
6978
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
6979
|
+
}
|
|
6980
|
+
function _iterable_to_array_limit(arr, i) {
|
|
6981
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
6982
|
+
if (_i == null) return;
|
|
6983
|
+
var _arr = [];
|
|
6984
|
+
var _n = true;
|
|
6985
|
+
var _d = false;
|
|
6986
|
+
var _s, _e;
|
|
6987
|
+
try {
|
|
6988
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
6989
|
+
_arr.push(_s.value);
|
|
6990
|
+
if (i && _arr.length === i) break;
|
|
6991
|
+
}
|
|
6992
|
+
} catch (err) {
|
|
6993
|
+
_d = true;
|
|
6994
|
+
_e = err;
|
|
6995
|
+
} finally{
|
|
6996
|
+
try {
|
|
6997
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
6998
|
+
} finally{
|
|
6999
|
+
if (_d) throw _e;
|
|
7000
|
+
}
|
|
7001
|
+
}
|
|
7002
|
+
return _arr;
|
|
7003
|
+
}
|
|
7004
|
+
function _non_iterable_rest() {
|
|
7005
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
7006
|
+
}
|
|
7007
|
+
function _non_iterable_spread$f() {
|
|
7008
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
7009
|
+
}
|
|
7010
|
+
function _object_spread$g(target) {
|
|
7011
|
+
for(var i = 1; i < arguments.length; i++){
|
|
7012
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
7013
|
+
var ownKeys = Object.keys(source);
|
|
7014
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
7015
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
7016
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
7017
|
+
}));
|
|
7018
|
+
}
|
|
7019
|
+
ownKeys.forEach(function(key) {
|
|
7020
|
+
_define_property$g(target, key, source[key]);
|
|
7021
|
+
});
|
|
7022
|
+
}
|
|
7023
|
+
return target;
|
|
7024
|
+
}
|
|
7025
|
+
function ownKeys$f(object, enumerableOnly) {
|
|
7026
|
+
var keys = Object.keys(object);
|
|
7027
|
+
if (Object.getOwnPropertySymbols) {
|
|
7028
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
7029
|
+
keys.push.apply(keys, symbols);
|
|
7030
|
+
}
|
|
7031
|
+
return keys;
|
|
7032
|
+
}
|
|
7033
|
+
function _object_spread_props$f(target, source) {
|
|
7034
|
+
source = source != null ? source : {};
|
|
7035
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
7036
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
7037
|
+
} else {
|
|
7038
|
+
ownKeys$f(Object(source)).forEach(function(key) {
|
|
7039
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
7040
|
+
});
|
|
7041
|
+
}
|
|
7042
|
+
return target;
|
|
7043
|
+
}
|
|
7044
|
+
function _sliced_to_array(arr, i) {
|
|
7045
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array$f(arr, i) || _non_iterable_rest();
|
|
7046
|
+
}
|
|
7047
|
+
function _to_consumable_array$f(arr) {
|
|
7048
|
+
return _array_without_holes$f(arr) || _iterable_to_array$f(arr) || _unsupported_iterable_to_array$f(arr) || _non_iterable_spread$f();
|
|
7049
|
+
}
|
|
7050
|
+
function _unsupported_iterable_to_array$f(o, minLen) {
|
|
7051
|
+
if (!o) return;
|
|
7052
|
+
if (typeof o === "string") return _array_like_to_array$f(o, minLen);
|
|
7053
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
7054
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
7055
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
7056
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$f(o, minLen);
|
|
7057
|
+
}
|
|
7058
|
+
var getRefs = function(options) {
|
|
7059
|
+
var _options = getDefaultOptions(options);
|
|
7060
|
+
var currentPath = _options.name !== undefined ? _to_consumable_array$f(_options.basePath).concat([
|
|
7061
|
+
_options.definitionPath,
|
|
7062
|
+
_options.name
|
|
7063
|
+
]) : _options.basePath;
|
|
7064
|
+
return _object_spread_props$f(_object_spread$g({}, _options), {
|
|
7065
|
+
flags: {
|
|
7066
|
+
hasReferencedOpenAiAnyType: false
|
|
7067
|
+
},
|
|
7068
|
+
currentPath: currentPath,
|
|
7069
|
+
propertyPath: undefined,
|
|
7070
|
+
seen: new Map(Object.entries(_options.definitions).map(function(param) {
|
|
7071
|
+
var _param = _sliced_to_array(param, 2), name = _param[0], def = _param[1];
|
|
7072
|
+
return [
|
|
7073
|
+
def._def,
|
|
7074
|
+
{
|
|
7075
|
+
def: def._def,
|
|
7076
|
+
path: _to_consumable_array$f(_options.basePath).concat([
|
|
7077
|
+
_options.definitionPath,
|
|
7078
|
+
name
|
|
7079
|
+
]),
|
|
7080
|
+
// Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now.
|
|
7081
|
+
jsonSchema: undefined
|
|
7082
|
+
}
|
|
7083
|
+
];
|
|
7084
|
+
}))
|
|
7085
|
+
});
|
|
7086
|
+
};
|
|
7087
|
+
|
|
7088
|
+
function _define_property$f(obj, key, value) {
|
|
7089
|
+
if (key in obj) {
|
|
7090
|
+
Object.defineProperty(obj, key, {
|
|
7091
|
+
value: value,
|
|
7092
|
+
enumerable: true,
|
|
7093
|
+
configurable: true,
|
|
7094
|
+
writable: true
|
|
7095
|
+
});
|
|
7096
|
+
} else {
|
|
7097
|
+
obj[key] = value;
|
|
7098
|
+
}
|
|
7099
|
+
return obj;
|
|
7100
|
+
}
|
|
7101
|
+
function _object_spread$f(target) {
|
|
7102
|
+
for(var i = 1; i < arguments.length; i++){
|
|
7103
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
7104
|
+
var ownKeys = Object.keys(source);
|
|
7105
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
7106
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
7107
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
7108
|
+
}));
|
|
7109
|
+
}
|
|
7110
|
+
ownKeys.forEach(function(key) {
|
|
7111
|
+
_define_property$f(target, key, source[key]);
|
|
7112
|
+
});
|
|
7113
|
+
}
|
|
7114
|
+
return target;
|
|
7115
|
+
}
|
|
7116
|
+
function ownKeys$e(object, enumerableOnly) {
|
|
7117
|
+
var keys = Object.keys(object);
|
|
7118
|
+
if (Object.getOwnPropertySymbols) {
|
|
7119
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
7120
|
+
keys.push.apply(keys, symbols);
|
|
7121
|
+
}
|
|
7122
|
+
return keys;
|
|
7123
|
+
}
|
|
7124
|
+
function _object_spread_props$e(target, source) {
|
|
7125
|
+
source = source != null ? source : {};
|
|
7126
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
7127
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
7128
|
+
} else {
|
|
7129
|
+
ownKeys$e(Object(source)).forEach(function(key) {
|
|
7130
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
7131
|
+
});
|
|
7132
|
+
}
|
|
7133
|
+
return target;
|
|
7134
|
+
}
|
|
7135
|
+
function addErrorMessage(res, key, errorMessage, refs) {
|
|
7136
|
+
if (!(refs === null || refs === void 0 ? void 0 : refs.errorMessages)) return;
|
|
7137
|
+
if (errorMessage) {
|
|
7138
|
+
res.errorMessage = _object_spread_props$e(_object_spread$f({}, res.errorMessage), _define_property$f({}, key, errorMessage));
|
|
7139
|
+
}
|
|
7140
|
+
}
|
|
7141
|
+
function setResponseValueAndErrors(res, key, value, errorMessage, refs) {
|
|
7142
|
+
res[key] = value;
|
|
7143
|
+
addErrorMessage(res, key, errorMessage, refs);
|
|
7144
|
+
}
|
|
7145
|
+
|
|
7146
|
+
function _array_like_to_array$e(arr, len) {
|
|
7147
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
7148
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
7149
|
+
return arr2;
|
|
7150
|
+
}
|
|
7151
|
+
function _array_without_holes$e(arr) {
|
|
7152
|
+
if (Array.isArray(arr)) return _array_like_to_array$e(arr);
|
|
7153
|
+
}
|
|
7154
|
+
function _iterable_to_array$e(iter) {
|
|
7155
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
7156
|
+
}
|
|
7157
|
+
function _non_iterable_spread$e() {
|
|
7158
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
7159
|
+
}
|
|
7160
|
+
function _to_consumable_array$e(arr) {
|
|
7161
|
+
return _array_without_holes$e(arr) || _iterable_to_array$e(arr) || _unsupported_iterable_to_array$e(arr) || _non_iterable_spread$e();
|
|
7162
|
+
}
|
|
7163
|
+
function _unsupported_iterable_to_array$e(o, minLen) {
|
|
7164
|
+
if (!o) return;
|
|
7165
|
+
if (typeof o === "string") return _array_like_to_array$e(o, minLen);
|
|
7166
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
7167
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
7168
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
7169
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$e(o, minLen);
|
|
7170
|
+
}
|
|
7171
|
+
var getRelativePath = function(pathA, pathB) {
|
|
7172
|
+
var i = 0;
|
|
7173
|
+
for(; i < pathA.length && i < pathB.length; i++){
|
|
7174
|
+
if (pathA[i] !== pathB[i]) break;
|
|
7175
|
+
}
|
|
7176
|
+
return [
|
|
7177
|
+
(pathA.length - i).toString()
|
|
7178
|
+
].concat(_to_consumable_array$e(pathB.slice(i))).join("/");
|
|
7179
|
+
};
|
|
7180
|
+
|
|
7181
|
+
function _array_like_to_array$d(arr, len) {
|
|
7182
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
7183
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
7184
|
+
return arr2;
|
|
7185
|
+
}
|
|
7186
|
+
function _array_without_holes$d(arr) {
|
|
7187
|
+
if (Array.isArray(arr)) return _array_like_to_array$d(arr);
|
|
7188
|
+
}
|
|
7189
|
+
function _iterable_to_array$d(iter) {
|
|
7190
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
7191
|
+
}
|
|
7192
|
+
function _non_iterable_spread$d() {
|
|
7193
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
7194
|
+
}
|
|
7195
|
+
function _to_consumable_array$d(arr) {
|
|
7196
|
+
return _array_without_holes$d(arr) || _iterable_to_array$d(arr) || _unsupported_iterable_to_array$d(arr) || _non_iterable_spread$d();
|
|
7197
|
+
}
|
|
7198
|
+
function _unsupported_iterable_to_array$d(o, minLen) {
|
|
7199
|
+
if (!o) return;
|
|
7200
|
+
if (typeof o === "string") return _array_like_to_array$d(o, minLen);
|
|
7201
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
7202
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
7203
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
7204
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$d(o, minLen);
|
|
7205
|
+
}
|
|
7206
|
+
function parseAnyDef(refs) {
|
|
7207
|
+
if (refs.target !== "openAi") {
|
|
7208
|
+
return {};
|
|
7209
|
+
}
|
|
7210
|
+
var anyDefinitionPath = _to_consumable_array$d(refs.basePath).concat([
|
|
7211
|
+
refs.definitionPath,
|
|
7212
|
+
refs.openAiAnyTypeName
|
|
7213
|
+
]);
|
|
7214
|
+
refs.flags.hasReferencedOpenAiAnyType = true;
|
|
7215
|
+
return {
|
|
7216
|
+
$ref: refs.$refStrategy === "relative" ? getRelativePath(anyDefinitionPath, refs.currentPath) : anyDefinitionPath.join("/")
|
|
7217
|
+
};
|
|
7218
|
+
}
|
|
7219
|
+
|
|
7220
|
+
function _array_like_to_array$c(arr, len) {
|
|
7221
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
7222
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
7223
|
+
return arr2;
|
|
7224
|
+
}
|
|
7225
|
+
function _array_without_holes$c(arr) {
|
|
7226
|
+
if (Array.isArray(arr)) return _array_like_to_array$c(arr);
|
|
7227
|
+
}
|
|
7228
|
+
function _define_property$e(obj, key, value) {
|
|
7229
|
+
if (key in obj) {
|
|
7230
|
+
Object.defineProperty(obj, key, {
|
|
7231
|
+
value: value,
|
|
7232
|
+
enumerable: true,
|
|
7233
|
+
configurable: true,
|
|
7234
|
+
writable: true
|
|
7235
|
+
});
|
|
7236
|
+
} else {
|
|
7237
|
+
obj[key] = value;
|
|
7238
|
+
}
|
|
7239
|
+
return obj;
|
|
7240
|
+
}
|
|
7241
|
+
function _iterable_to_array$c(iter) {
|
|
7242
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
7243
|
+
}
|
|
7244
|
+
function _non_iterable_spread$c() {
|
|
7245
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
7246
|
+
}
|
|
7247
|
+
function _object_spread$e(target) {
|
|
7248
|
+
for(var i = 1; i < arguments.length; i++){
|
|
7249
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
7250
|
+
var ownKeys = Object.keys(source);
|
|
7251
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
7252
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
7253
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
7254
|
+
}));
|
|
7255
|
+
}
|
|
7256
|
+
ownKeys.forEach(function(key) {
|
|
7257
|
+
_define_property$e(target, key, source[key]);
|
|
7258
|
+
});
|
|
7259
|
+
}
|
|
7260
|
+
return target;
|
|
7261
|
+
}
|
|
7262
|
+
function ownKeys$d(object, enumerableOnly) {
|
|
7263
|
+
var keys = Object.keys(object);
|
|
7264
|
+
if (Object.getOwnPropertySymbols) {
|
|
7265
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
7266
|
+
keys.push.apply(keys, symbols);
|
|
7267
|
+
}
|
|
7268
|
+
return keys;
|
|
7269
|
+
}
|
|
7270
|
+
function _object_spread_props$d(target, source) {
|
|
7271
|
+
source = source != null ? source : {};
|
|
7272
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
7273
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
7274
|
+
} else {
|
|
7275
|
+
ownKeys$d(Object(source)).forEach(function(key) {
|
|
7276
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
7277
|
+
});
|
|
7278
|
+
}
|
|
7279
|
+
return target;
|
|
7280
|
+
}
|
|
7281
|
+
function _to_consumable_array$c(arr) {
|
|
7282
|
+
return _array_without_holes$c(arr) || _iterable_to_array$c(arr) || _unsupported_iterable_to_array$c(arr) || _non_iterable_spread$c();
|
|
7283
|
+
}
|
|
7284
|
+
function _unsupported_iterable_to_array$c(o, minLen) {
|
|
7285
|
+
if (!o) return;
|
|
7286
|
+
if (typeof o === "string") return _array_like_to_array$c(o, minLen);
|
|
7287
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
7288
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
7289
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
7290
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$c(o, minLen);
|
|
7291
|
+
}
|
|
7292
|
+
function parseArrayDef(def, refs) {
|
|
7293
|
+
var _def_type, _def_type__def, _def_type1;
|
|
7294
|
+
var res = {
|
|
7295
|
+
type: "array"
|
|
7296
|
+
};
|
|
7297
|
+
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) !== v3.ZodFirstPartyTypeKind.ZodAny) {
|
|
7298
|
+
res.items = parseDef(def.type._def, _object_spread_props$d(_object_spread$e({}, refs), {
|
|
7299
|
+
currentPath: _to_consumable_array$c(refs.currentPath).concat([
|
|
7300
|
+
"items"
|
|
7301
|
+
])
|
|
7302
|
+
}));
|
|
7303
|
+
}
|
|
7304
|
+
if (def.minLength) {
|
|
7305
|
+
setResponseValueAndErrors(res, "minItems", def.minLength.value, def.minLength.message, refs);
|
|
7306
|
+
}
|
|
7307
|
+
if (def.maxLength) {
|
|
7308
|
+
setResponseValueAndErrors(res, "maxItems", def.maxLength.value, def.maxLength.message, refs);
|
|
7309
|
+
}
|
|
7310
|
+
if (def.exactLength) {
|
|
7311
|
+
setResponseValueAndErrors(res, "minItems", def.exactLength.value, def.exactLength.message, refs);
|
|
7312
|
+
setResponseValueAndErrors(res, "maxItems", def.exactLength.value, def.exactLength.message, refs);
|
|
7313
|
+
}
|
|
7314
|
+
return res;
|
|
7315
|
+
}
|
|
7316
|
+
|
|
7317
|
+
function parseBigintDef(def, refs) {
|
|
7318
|
+
var res = {
|
|
7319
|
+
type: "integer",
|
|
7320
|
+
format: "int64"
|
|
7321
|
+
};
|
|
7322
|
+
if (!def.checks) return res;
|
|
7323
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
7324
|
+
try {
|
|
7325
|
+
for(var _iterator = def.checks[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
7326
|
+
var check = _step.value;
|
|
7327
|
+
switch(check.kind){
|
|
7328
|
+
case "min":
|
|
7329
|
+
if (refs.target === "jsonSchema7") {
|
|
7330
|
+
if (check.inclusive) {
|
|
7331
|
+
setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
|
|
7332
|
+
} else {
|
|
7333
|
+
setResponseValueAndErrors(res, "exclusiveMinimum", check.value, check.message, refs);
|
|
7334
|
+
}
|
|
7335
|
+
} else {
|
|
7336
|
+
if (!check.inclusive) {
|
|
7337
|
+
res.exclusiveMinimum = true;
|
|
7338
|
+
}
|
|
7339
|
+
setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
|
|
7340
|
+
}
|
|
7341
|
+
break;
|
|
7342
|
+
case "max":
|
|
7343
|
+
if (refs.target === "jsonSchema7") {
|
|
7344
|
+
if (check.inclusive) {
|
|
7345
|
+
setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
|
|
7346
|
+
} else {
|
|
7347
|
+
setResponseValueAndErrors(res, "exclusiveMaximum", check.value, check.message, refs);
|
|
7348
|
+
}
|
|
7349
|
+
} else {
|
|
7350
|
+
if (!check.inclusive) {
|
|
7351
|
+
res.exclusiveMaximum = true;
|
|
7352
|
+
}
|
|
7353
|
+
setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
|
|
7354
|
+
}
|
|
7355
|
+
break;
|
|
7356
|
+
case "multipleOf":
|
|
7357
|
+
setResponseValueAndErrors(res, "multipleOf", check.value, check.message, refs);
|
|
7358
|
+
break;
|
|
7359
|
+
}
|
|
7360
|
+
}
|
|
7361
|
+
} catch (err) {
|
|
7362
|
+
_didIteratorError = true;
|
|
7363
|
+
_iteratorError = err;
|
|
7364
|
+
} finally{
|
|
7365
|
+
try {
|
|
7366
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
7367
|
+
_iterator.return();
|
|
7368
|
+
}
|
|
7369
|
+
} finally{
|
|
7370
|
+
if (_didIteratorError) {
|
|
7371
|
+
throw _iteratorError;
|
|
7372
|
+
}
|
|
7373
|
+
}
|
|
7374
|
+
}
|
|
7375
|
+
return res;
|
|
7376
|
+
}
|
|
7377
|
+
|
|
7378
|
+
function parseBooleanDef() {
|
|
7379
|
+
return {
|
|
7380
|
+
type: "boolean"
|
|
7381
|
+
};
|
|
7382
|
+
}
|
|
7383
|
+
|
|
7384
|
+
function parseBrandedDef(_def, refs) {
|
|
7385
|
+
return parseDef(_def.type._def, refs);
|
|
7386
|
+
}
|
|
7387
|
+
|
|
7388
|
+
var parseCatchDef = function(def, refs) {
|
|
7389
|
+
return parseDef(def.innerType._def, refs);
|
|
7390
|
+
};
|
|
7391
|
+
|
|
7392
|
+
function parseDateDef(def, refs, overrideDateStrategy) {
|
|
7393
|
+
var strategy = overrideDateStrategy !== null && overrideDateStrategy !== void 0 ? overrideDateStrategy : refs.dateStrategy;
|
|
7394
|
+
if (Array.isArray(strategy)) {
|
|
7395
|
+
return {
|
|
7396
|
+
anyOf: strategy.map(function(item, i) {
|
|
7397
|
+
return parseDateDef(def, refs, item);
|
|
7398
|
+
})
|
|
7399
|
+
};
|
|
7400
|
+
}
|
|
7401
|
+
switch(strategy){
|
|
7402
|
+
case "string":
|
|
7403
|
+
case "format:date-time":
|
|
7404
|
+
return {
|
|
7405
|
+
type: "string",
|
|
7406
|
+
format: "date-time"
|
|
7407
|
+
};
|
|
7408
|
+
case "format:date":
|
|
7409
|
+
return {
|
|
7410
|
+
type: "string",
|
|
7411
|
+
format: "date"
|
|
7412
|
+
};
|
|
7413
|
+
case "integer":
|
|
7414
|
+
return integerDateParser(def, refs);
|
|
7415
|
+
}
|
|
7416
|
+
}
|
|
7417
|
+
var integerDateParser = function(def, refs) {
|
|
7418
|
+
var res = {
|
|
7419
|
+
type: "integer",
|
|
7420
|
+
format: "unix-time"
|
|
7421
|
+
};
|
|
7422
|
+
if (refs.target === "openApi3") {
|
|
7423
|
+
return res;
|
|
7424
|
+
}
|
|
7425
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
7426
|
+
try {
|
|
7427
|
+
for(var _iterator = def.checks[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
7428
|
+
var check = _step.value;
|
|
7429
|
+
switch(check.kind){
|
|
7430
|
+
case "min":
|
|
7431
|
+
setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
|
|
7432
|
+
break;
|
|
7433
|
+
case "max":
|
|
7434
|
+
setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
|
|
7435
|
+
break;
|
|
7436
|
+
}
|
|
7437
|
+
}
|
|
7438
|
+
} catch (err) {
|
|
7439
|
+
_didIteratorError = true;
|
|
7440
|
+
_iteratorError = err;
|
|
7441
|
+
} finally{
|
|
7442
|
+
try {
|
|
7443
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
7444
|
+
_iterator.return();
|
|
7445
|
+
}
|
|
7446
|
+
} finally{
|
|
7447
|
+
if (_didIteratorError) {
|
|
7448
|
+
throw _iteratorError;
|
|
7449
|
+
}
|
|
7450
|
+
}
|
|
7451
|
+
}
|
|
7452
|
+
return res;
|
|
7453
|
+
};
|
|
7454
|
+
|
|
7455
|
+
function _define_property$d(obj, key, value) {
|
|
7456
|
+
if (key in obj) {
|
|
7457
|
+
Object.defineProperty(obj, key, {
|
|
7458
|
+
value: value,
|
|
7459
|
+
enumerable: true,
|
|
7460
|
+
configurable: true,
|
|
7461
|
+
writable: true
|
|
7462
|
+
});
|
|
7463
|
+
} else {
|
|
7464
|
+
obj[key] = value;
|
|
7465
|
+
}
|
|
7466
|
+
return obj;
|
|
7467
|
+
}
|
|
7468
|
+
function _object_spread$d(target) {
|
|
7469
|
+
for(var i = 1; i < arguments.length; i++){
|
|
7470
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
7471
|
+
var ownKeys = Object.keys(source);
|
|
7472
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
7473
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
7474
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
7475
|
+
}));
|
|
7476
|
+
}
|
|
7477
|
+
ownKeys.forEach(function(key) {
|
|
7478
|
+
_define_property$d(target, key, source[key]);
|
|
7479
|
+
});
|
|
7480
|
+
}
|
|
7481
|
+
return target;
|
|
7482
|
+
}
|
|
7483
|
+
function ownKeys$c(object, enumerableOnly) {
|
|
7484
|
+
var keys = Object.keys(object);
|
|
7485
|
+
if (Object.getOwnPropertySymbols) {
|
|
7486
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
7487
|
+
keys.push.apply(keys, symbols);
|
|
7488
|
+
}
|
|
7489
|
+
return keys;
|
|
7490
|
+
}
|
|
7491
|
+
function _object_spread_props$c(target, source) {
|
|
7492
|
+
source = source != null ? source : {};
|
|
7493
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
7494
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
7495
|
+
} else {
|
|
7496
|
+
ownKeys$c(Object(source)).forEach(function(key) {
|
|
7497
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
7498
|
+
});
|
|
7499
|
+
}
|
|
7500
|
+
return target;
|
|
7501
|
+
}
|
|
7502
|
+
function parseDefaultDef(_def, refs) {
|
|
7503
|
+
return _object_spread_props$c(_object_spread$d({}, parseDef(_def.innerType._def, refs)), {
|
|
7504
|
+
default: _def.defaultValue()
|
|
7505
|
+
});
|
|
7506
|
+
}
|
|
7507
|
+
|
|
7508
|
+
function parseEffectsDef(_def, refs) {
|
|
7509
|
+
return refs.effectStrategy === "input" ? parseDef(_def.schema._def, refs) : parseAnyDef(refs);
|
|
7510
|
+
}
|
|
7511
|
+
|
|
7512
|
+
function parseEnumDef(def) {
|
|
7513
|
+
return {
|
|
7514
|
+
type: "string",
|
|
7515
|
+
enum: Array.from(def.values)
|
|
7516
|
+
};
|
|
7517
|
+
}
|
|
7518
|
+
|
|
7519
|
+
function _array_like_to_array$b(arr, len) {
|
|
7520
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
7521
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
7522
|
+
return arr2;
|
|
7523
|
+
}
|
|
7524
|
+
function _array_without_holes$b(arr) {
|
|
7525
|
+
if (Array.isArray(arr)) return _array_like_to_array$b(arr);
|
|
7526
|
+
}
|
|
7527
|
+
function _define_property$c(obj, key, value) {
|
|
7528
|
+
if (key in obj) {
|
|
7529
|
+
Object.defineProperty(obj, key, {
|
|
7530
|
+
value: value,
|
|
7531
|
+
enumerable: true,
|
|
7532
|
+
configurable: true,
|
|
7533
|
+
writable: true
|
|
7534
|
+
});
|
|
7535
|
+
} else {
|
|
7536
|
+
obj[key] = value;
|
|
7537
|
+
}
|
|
7538
|
+
return obj;
|
|
7539
|
+
}
|
|
7540
|
+
function _iterable_to_array$b(iter) {
|
|
7541
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
7542
|
+
}
|
|
7543
|
+
function _non_iterable_spread$b() {
|
|
7544
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
7545
|
+
}
|
|
7546
|
+
function _object_spread$c(target) {
|
|
7547
|
+
for(var i = 1; i < arguments.length; i++){
|
|
7548
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
7549
|
+
var ownKeys = Object.keys(source);
|
|
7550
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
7551
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
7552
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
7553
|
+
}));
|
|
7554
|
+
}
|
|
7555
|
+
ownKeys.forEach(function(key) {
|
|
7556
|
+
_define_property$c(target, key, source[key]);
|
|
7557
|
+
});
|
|
7558
|
+
}
|
|
7559
|
+
return target;
|
|
7560
|
+
}
|
|
7561
|
+
function ownKeys$b(object, enumerableOnly) {
|
|
7562
|
+
var keys = Object.keys(object);
|
|
7563
|
+
if (Object.getOwnPropertySymbols) {
|
|
7564
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
7565
|
+
keys.push.apply(keys, symbols);
|
|
7566
|
+
}
|
|
7567
|
+
return keys;
|
|
7568
|
+
}
|
|
7569
|
+
function _object_spread_props$b(target, source) {
|
|
7570
|
+
source = source != null ? source : {};
|
|
7571
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
7572
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
7573
|
+
} else {
|
|
7574
|
+
ownKeys$b(Object(source)).forEach(function(key) {
|
|
7575
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
7576
|
+
});
|
|
7577
|
+
}
|
|
7578
|
+
return target;
|
|
7579
|
+
}
|
|
7580
|
+
function _object_without_properties$1(source, excluded) {
|
|
7581
|
+
if (source == null) return {};
|
|
7582
|
+
var target = _object_without_properties_loose$1(source, excluded);
|
|
7583
|
+
var key, i;
|
|
7584
|
+
if (Object.getOwnPropertySymbols) {
|
|
7585
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
7586
|
+
for(i = 0; i < sourceSymbolKeys.length; i++){
|
|
7587
|
+
key = sourceSymbolKeys[i];
|
|
7588
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
7589
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
7590
|
+
target[key] = source[key];
|
|
7591
|
+
}
|
|
7592
|
+
}
|
|
7593
|
+
return target;
|
|
7594
|
+
}
|
|
7595
|
+
function _object_without_properties_loose$1(source, excluded) {
|
|
7596
|
+
if (source == null) return {};
|
|
7597
|
+
var target = {};
|
|
7598
|
+
var sourceKeys = Object.keys(source);
|
|
7599
|
+
var key, i;
|
|
7600
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
7601
|
+
key = sourceKeys[i];
|
|
7602
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
7603
|
+
target[key] = source[key];
|
|
7604
|
+
}
|
|
7605
|
+
return target;
|
|
7606
|
+
}
|
|
7607
|
+
function _to_consumable_array$b(arr) {
|
|
7608
|
+
return _array_without_holes$b(arr) || _iterable_to_array$b(arr) || _unsupported_iterable_to_array$b(arr) || _non_iterable_spread$b();
|
|
7609
|
+
}
|
|
7610
|
+
function _unsupported_iterable_to_array$b(o, minLen) {
|
|
7611
|
+
if (!o) return;
|
|
7612
|
+
if (typeof o === "string") return _array_like_to_array$b(o, minLen);
|
|
7613
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
7614
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
7615
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
7616
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$b(o, minLen);
|
|
7617
|
+
}
|
|
7618
|
+
var isJsonSchema7AllOfType = function(type) {
|
|
7619
|
+
if ("type" in type && type.type === "string") return false;
|
|
7620
|
+
return "allOf" in type;
|
|
7621
|
+
};
|
|
7622
|
+
function parseIntersectionDef(def, refs) {
|
|
7623
|
+
var allOf = [
|
|
7624
|
+
parseDef(def.left._def, _object_spread_props$b(_object_spread$c({}, refs), {
|
|
7625
|
+
currentPath: _to_consumable_array$b(refs.currentPath).concat([
|
|
7626
|
+
"allOf",
|
|
7627
|
+
"0"
|
|
7628
|
+
])
|
|
7629
|
+
})),
|
|
7630
|
+
parseDef(def.right._def, _object_spread_props$b(_object_spread$c({}, refs), {
|
|
7631
|
+
currentPath: _to_consumable_array$b(refs.currentPath).concat([
|
|
7632
|
+
"allOf",
|
|
7633
|
+
"1"
|
|
7634
|
+
])
|
|
7635
|
+
}))
|
|
7636
|
+
].filter(function(x) {
|
|
7637
|
+
return !!x;
|
|
7638
|
+
});
|
|
7639
|
+
var unevaluatedProperties = refs.target === "jsonSchema2019-09" ? {
|
|
7640
|
+
unevaluatedProperties: false
|
|
7641
|
+
} : undefined;
|
|
7642
|
+
var mergedAllOf = [];
|
|
7643
|
+
// If either of the schemas is an allOf, merge them into a single allOf
|
|
7644
|
+
allOf.forEach(function(schema) {
|
|
7645
|
+
if (isJsonSchema7AllOfType(schema)) {
|
|
7646
|
+
var _mergedAllOf;
|
|
7647
|
+
(_mergedAllOf = mergedAllOf).push.apply(_mergedAllOf, _to_consumable_array$b(schema.allOf));
|
|
7648
|
+
if (schema.unevaluatedProperties === undefined) {
|
|
7649
|
+
// If one of the schemas has no unevaluatedProperties set,
|
|
7650
|
+
// the merged schema should also have no unevaluatedProperties set
|
|
7651
|
+
unevaluatedProperties = undefined;
|
|
7652
|
+
}
|
|
7653
|
+
} else {
|
|
7654
|
+
var nestedSchema = schema;
|
|
7655
|
+
if ("additionalProperties" in schema && schema.additionalProperties === false) {
|
|
7656
|
+
schema.additionalProperties; var rest = _object_without_properties$1(schema, [
|
|
7657
|
+
"additionalProperties"
|
|
7658
|
+
]);
|
|
7659
|
+
nestedSchema = rest;
|
|
7660
|
+
} else {
|
|
7661
|
+
// As soon as one of the schemas has additionalProperties set not to false, we allow unevaluatedProperties
|
|
7662
|
+
unevaluatedProperties = undefined;
|
|
7663
|
+
}
|
|
7664
|
+
mergedAllOf.push(nestedSchema);
|
|
7665
|
+
}
|
|
7666
|
+
});
|
|
7667
|
+
return mergedAllOf.length ? _object_spread$c({
|
|
7668
|
+
allOf: mergedAllOf
|
|
7669
|
+
}, unevaluatedProperties) : undefined;
|
|
7670
|
+
}
|
|
7671
|
+
|
|
7672
|
+
function _type_of$2(obj) {
|
|
7673
|
+
"@swc/helpers - typeof";
|
|
7674
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
7675
|
+
}
|
|
7676
|
+
function parseLiteralDef(def, refs) {
|
|
7677
|
+
var parsedType = _type_of$2(def.value);
|
|
7678
|
+
if (parsedType !== "bigint" && parsedType !== "number" && parsedType !== "boolean" && parsedType !== "string") {
|
|
7679
|
+
return {
|
|
7680
|
+
type: Array.isArray(def.value) ? "array" : "object"
|
|
7681
|
+
};
|
|
7682
|
+
}
|
|
7683
|
+
if (refs.target === "openApi3") {
|
|
7684
|
+
return {
|
|
7685
|
+
type: parsedType === "bigint" ? "integer" : parsedType,
|
|
7686
|
+
enum: [
|
|
7687
|
+
def.value
|
|
7688
|
+
]
|
|
7689
|
+
};
|
|
7690
|
+
}
|
|
7691
|
+
return {
|
|
7692
|
+
type: parsedType === "bigint" ? "integer" : parsedType,
|
|
7693
|
+
const: def.value
|
|
7694
|
+
};
|
|
7695
|
+
}
|
|
7696
|
+
|
|
7697
|
+
function _define_property$b(obj, key, value) {
|
|
7698
|
+
if (key in obj) {
|
|
7699
|
+
Object.defineProperty(obj, key, {
|
|
7700
|
+
value: value,
|
|
7701
|
+
enumerable: true,
|
|
7702
|
+
configurable: true,
|
|
7703
|
+
writable: true
|
|
7704
|
+
});
|
|
7705
|
+
} else {
|
|
7706
|
+
obj[key] = value;
|
|
7707
|
+
}
|
|
7708
|
+
return obj;
|
|
7709
|
+
}
|
|
7710
|
+
function _object_spread$b(target) {
|
|
7711
|
+
for(var i = 1; i < arguments.length; i++){
|
|
7712
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
7713
|
+
var ownKeys = Object.keys(source);
|
|
7714
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
7715
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
7716
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
7717
|
+
}));
|
|
7718
|
+
}
|
|
7719
|
+
ownKeys.forEach(function(key) {
|
|
7720
|
+
_define_property$b(target, key, source[key]);
|
|
7721
|
+
});
|
|
7722
|
+
}
|
|
7723
|
+
return target;
|
|
7724
|
+
}
|
|
7725
|
+
var emojiRegex = undefined;
|
|
7726
|
+
/**
|
|
7727
|
+
* Generated from the regular expressions found here as of 2024-05-22:
|
|
7728
|
+
* https://github.com/colinhacks/zod/blob/master/src/types.ts.
|
|
7729
|
+
*
|
|
7730
|
+
* Expressions with /i flag have been changed accordingly.
|
|
7731
|
+
*/ var zodPatterns = {
|
|
7732
|
+
/**
|
|
7733
|
+
* `c` was changed to `[cC]` to replicate /i flag
|
|
7734
|
+
*/ cuid: /^[cC][^\s-]{8,}$/,
|
|
7735
|
+
cuid2: /^[0-9a-z]+$/,
|
|
7736
|
+
ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
|
|
7737
|
+
/**
|
|
7738
|
+
* `a-z` was added to replicate /i flag
|
|
7739
|
+
*/ email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,
|
|
7740
|
+
/**
|
|
7741
|
+
* Constructed a valid Unicode RegExp
|
|
7742
|
+
*
|
|
7743
|
+
* Lazily instantiate since this type of regex isn't supported
|
|
7744
|
+
* in all envs (e.g. React Native).
|
|
7745
|
+
*
|
|
7746
|
+
* See:
|
|
7747
|
+
* https://github.com/colinhacks/zod/issues/2433
|
|
7748
|
+
* Fix in Zod:
|
|
7749
|
+
* https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b
|
|
7750
|
+
*/ emoji: function() {
|
|
7751
|
+
if (emojiRegex === undefined) {
|
|
7752
|
+
emojiRegex = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u");
|
|
7753
|
+
}
|
|
7754
|
+
return emojiRegex;
|
|
7755
|
+
},
|
|
7756
|
+
/**
|
|
7757
|
+
* Unused
|
|
7758
|
+
*/ 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}$/,
|
|
7759
|
+
/**
|
|
7760
|
+
* Unused
|
|
7761
|
+
*/ 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])$/,
|
|
7762
|
+
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])$/,
|
|
7763
|
+
/**
|
|
7764
|
+
* Unused
|
|
7765
|
+
*/ 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})))$/,
|
|
7766
|
+
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])$/,
|
|
7767
|
+
base64: /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,
|
|
7768
|
+
base64url: /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,
|
|
7769
|
+
nanoid: /^[a-zA-Z0-9_-]{21}$/,
|
|
7770
|
+
jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
|
|
7771
|
+
};
|
|
7772
|
+
function parseStringDef(def, refs) {
|
|
7773
|
+
var res = {
|
|
7774
|
+
type: "string"
|
|
7775
|
+
};
|
|
7776
|
+
if (def.checks) {
|
|
7777
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
7778
|
+
try {
|
|
7779
|
+
for(var _iterator = def.checks[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
7780
|
+
var check = _step.value;
|
|
7781
|
+
switch(check.kind){
|
|
7782
|
+
case "min":
|
|
7783
|
+
setResponseValueAndErrors(res, "minLength", typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value, check.message, refs);
|
|
7784
|
+
break;
|
|
7785
|
+
case "max":
|
|
7786
|
+
setResponseValueAndErrors(res, "maxLength", typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value, check.message, refs);
|
|
7787
|
+
break;
|
|
7788
|
+
case "email":
|
|
7789
|
+
switch(refs.emailStrategy){
|
|
7790
|
+
case "format:email":
|
|
7791
|
+
addFormat(res, "email", check.message, refs);
|
|
7792
|
+
break;
|
|
7793
|
+
case "format:idn-email":
|
|
7794
|
+
addFormat(res, "idn-email", check.message, refs);
|
|
7795
|
+
break;
|
|
7796
|
+
case "pattern:zod":
|
|
7797
|
+
addPattern(res, zodPatterns.email, check.message, refs);
|
|
7798
|
+
break;
|
|
7799
|
+
}
|
|
7800
|
+
break;
|
|
7801
|
+
case "url":
|
|
7802
|
+
addFormat(res, "uri", check.message, refs);
|
|
7803
|
+
break;
|
|
7804
|
+
case "uuid":
|
|
7805
|
+
addFormat(res, "uuid", check.message, refs);
|
|
7806
|
+
break;
|
|
7807
|
+
case "regex":
|
|
7808
|
+
addPattern(res, check.regex, check.message, refs);
|
|
7809
|
+
break;
|
|
7810
|
+
case "cuid":
|
|
7811
|
+
addPattern(res, zodPatterns.cuid, check.message, refs);
|
|
7812
|
+
break;
|
|
7813
|
+
case "cuid2":
|
|
7814
|
+
addPattern(res, zodPatterns.cuid2, check.message, refs);
|
|
7815
|
+
break;
|
|
7816
|
+
case "startsWith":
|
|
7817
|
+
addPattern(res, RegExp("^".concat(escapeLiteralCheckValue(check.value, refs))), check.message, refs);
|
|
7818
|
+
break;
|
|
7819
|
+
case "endsWith":
|
|
7820
|
+
addPattern(res, RegExp("".concat(escapeLiteralCheckValue(check.value, refs), "$")), check.message, refs);
|
|
7821
|
+
break;
|
|
7822
|
+
case "datetime":
|
|
7823
|
+
addFormat(res, "date-time", check.message, refs);
|
|
7824
|
+
break;
|
|
7825
|
+
case "date":
|
|
7826
|
+
addFormat(res, "date", check.message, refs);
|
|
7827
|
+
break;
|
|
7828
|
+
case "time":
|
|
7829
|
+
addFormat(res, "time", check.message, refs);
|
|
7830
|
+
break;
|
|
7831
|
+
case "duration":
|
|
7832
|
+
addFormat(res, "duration", check.message, refs);
|
|
7833
|
+
break;
|
|
7834
|
+
case "length":
|
|
7835
|
+
setResponseValueAndErrors(res, "minLength", typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value, check.message, refs);
|
|
7836
|
+
setResponseValueAndErrors(res, "maxLength", typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value, check.message, refs);
|
|
7837
|
+
break;
|
|
7838
|
+
case "includes":
|
|
7839
|
+
{
|
|
7840
|
+
addPattern(res, RegExp(escapeLiteralCheckValue(check.value, refs)), check.message, refs);
|
|
7841
|
+
break;
|
|
7842
|
+
}
|
|
7843
|
+
case "ip":
|
|
7844
|
+
{
|
|
7845
|
+
if (check.version !== "v6") {
|
|
7846
|
+
addFormat(res, "ipv4", check.message, refs);
|
|
7847
|
+
}
|
|
7848
|
+
if (check.version !== "v4") {
|
|
7849
|
+
addFormat(res, "ipv6", check.message, refs);
|
|
7850
|
+
}
|
|
7851
|
+
break;
|
|
7852
|
+
}
|
|
7853
|
+
case "base64url":
|
|
7854
|
+
addPattern(res, zodPatterns.base64url, check.message, refs);
|
|
7855
|
+
break;
|
|
7856
|
+
case "jwt":
|
|
7857
|
+
addPattern(res, zodPatterns.jwt, check.message, refs);
|
|
7858
|
+
break;
|
|
7859
|
+
case "cidr":
|
|
7860
|
+
{
|
|
7861
|
+
if (check.version !== "v6") {
|
|
7862
|
+
addPattern(res, zodPatterns.ipv4Cidr, check.message, refs);
|
|
7863
|
+
}
|
|
7864
|
+
if (check.version !== "v4") {
|
|
7865
|
+
addPattern(res, zodPatterns.ipv6Cidr, check.message, refs);
|
|
7866
|
+
}
|
|
7867
|
+
break;
|
|
7868
|
+
}
|
|
7869
|
+
case "emoji":
|
|
7870
|
+
addPattern(res, zodPatterns.emoji(), check.message, refs);
|
|
7871
|
+
break;
|
|
7872
|
+
case "ulid":
|
|
7873
|
+
{
|
|
7874
|
+
addPattern(res, zodPatterns.ulid, check.message, refs);
|
|
7875
|
+
break;
|
|
7876
|
+
}
|
|
7877
|
+
case "base64":
|
|
7878
|
+
{
|
|
7879
|
+
switch(refs.base64Strategy){
|
|
7880
|
+
case "format:binary":
|
|
7881
|
+
{
|
|
7882
|
+
addFormat(res, "binary", check.message, refs);
|
|
7883
|
+
break;
|
|
7884
|
+
}
|
|
7885
|
+
case "contentEncoding:base64":
|
|
7886
|
+
{
|
|
7887
|
+
setResponseValueAndErrors(res, "contentEncoding", "base64", check.message, refs);
|
|
7888
|
+
break;
|
|
7889
|
+
}
|
|
7890
|
+
case "pattern:zod":
|
|
7891
|
+
{
|
|
7892
|
+
addPattern(res, zodPatterns.base64, check.message, refs);
|
|
7893
|
+
break;
|
|
7894
|
+
}
|
|
7895
|
+
}
|
|
7896
|
+
break;
|
|
7897
|
+
}
|
|
7898
|
+
case "nanoid":
|
|
7899
|
+
{
|
|
7900
|
+
addPattern(res, zodPatterns.nanoid, check.message, refs);
|
|
7901
|
+
}
|
|
7902
|
+
case "toLowerCase":
|
|
7903
|
+
case "toUpperCase":
|
|
7904
|
+
case "trim":
|
|
7905
|
+
break;
|
|
7906
|
+
default:
|
|
7907
|
+
(function(_) {})(check);
|
|
7908
|
+
}
|
|
7909
|
+
}
|
|
7910
|
+
} catch (err) {
|
|
7911
|
+
_didIteratorError = true;
|
|
7912
|
+
_iteratorError = err;
|
|
7913
|
+
} finally{
|
|
7914
|
+
try {
|
|
7915
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
7916
|
+
_iterator.return();
|
|
7917
|
+
}
|
|
7918
|
+
} finally{
|
|
7919
|
+
if (_didIteratorError) {
|
|
7920
|
+
throw _iteratorError;
|
|
7921
|
+
}
|
|
7922
|
+
}
|
|
7923
|
+
}
|
|
7924
|
+
}
|
|
7925
|
+
return res;
|
|
7926
|
+
}
|
|
7927
|
+
function escapeLiteralCheckValue(literal, refs) {
|
|
7928
|
+
return refs.patternStrategy === "escape" ? escapeNonAlphaNumeric(literal) : literal;
|
|
7929
|
+
}
|
|
7930
|
+
var ALPHA_NUMERIC = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
|
|
7931
|
+
function escapeNonAlphaNumeric(source) {
|
|
7932
|
+
var result = "";
|
|
7933
|
+
for(var i = 0; i < source.length; i++){
|
|
7934
|
+
if (!ALPHA_NUMERIC.has(source[i])) {
|
|
7935
|
+
result += "\\";
|
|
7936
|
+
}
|
|
7937
|
+
result += source[i];
|
|
7938
|
+
}
|
|
7939
|
+
return result;
|
|
7940
|
+
}
|
|
7941
|
+
// Adds a "format" keyword to the schema. If a format exists, both formats will be joined in an allOf-node, along with subsequent ones.
|
|
7942
|
+
function addFormat(schema, value, message, refs) {
|
|
7943
|
+
var _schema_anyOf;
|
|
7944
|
+
if (schema.format || ((_schema_anyOf = schema.anyOf) === null || _schema_anyOf === void 0 ? void 0 : _schema_anyOf.some(function(x) {
|
|
7945
|
+
return x.format;
|
|
7946
|
+
}))) {
|
|
7947
|
+
if (!schema.anyOf) {
|
|
7948
|
+
schema.anyOf = [];
|
|
7949
|
+
}
|
|
7950
|
+
if (schema.format) {
|
|
7951
|
+
schema.anyOf.push(_object_spread$b({
|
|
7952
|
+
format: schema.format
|
|
7953
|
+
}, schema.errorMessage && refs.errorMessages && {
|
|
7954
|
+
errorMessage: {
|
|
7955
|
+
format: schema.errorMessage.format
|
|
7956
|
+
}
|
|
7957
|
+
}));
|
|
7958
|
+
delete schema.format;
|
|
7959
|
+
if (schema.errorMessage) {
|
|
7960
|
+
delete schema.errorMessage.format;
|
|
7961
|
+
if (Object.keys(schema.errorMessage).length === 0) {
|
|
7962
|
+
delete schema.errorMessage;
|
|
7963
|
+
}
|
|
7964
|
+
}
|
|
7965
|
+
}
|
|
7966
|
+
schema.anyOf.push(_object_spread$b({
|
|
7967
|
+
format: value
|
|
7968
|
+
}, message && refs.errorMessages && {
|
|
7969
|
+
errorMessage: {
|
|
7970
|
+
format: message
|
|
7971
|
+
}
|
|
7972
|
+
}));
|
|
7973
|
+
} else {
|
|
7974
|
+
setResponseValueAndErrors(schema, "format", value, message, refs);
|
|
7975
|
+
}
|
|
7976
|
+
}
|
|
7977
|
+
// Adds a "pattern" keyword to the schema. If a pattern exists, both patterns will be joined in an allOf-node, along with subsequent ones.
|
|
7978
|
+
function addPattern(schema, regex, message, refs) {
|
|
7979
|
+
var _schema_allOf;
|
|
7980
|
+
if (schema.pattern || ((_schema_allOf = schema.allOf) === null || _schema_allOf === void 0 ? void 0 : _schema_allOf.some(function(x) {
|
|
7981
|
+
return x.pattern;
|
|
7982
|
+
}))) {
|
|
7983
|
+
if (!schema.allOf) {
|
|
7984
|
+
schema.allOf = [];
|
|
7985
|
+
}
|
|
7986
|
+
if (schema.pattern) {
|
|
7987
|
+
schema.allOf.push(_object_spread$b({
|
|
7988
|
+
pattern: schema.pattern
|
|
7989
|
+
}, schema.errorMessage && refs.errorMessages && {
|
|
7990
|
+
errorMessage: {
|
|
7991
|
+
pattern: schema.errorMessage.pattern
|
|
7992
|
+
}
|
|
7993
|
+
}));
|
|
7994
|
+
delete schema.pattern;
|
|
7995
|
+
if (schema.errorMessage) {
|
|
7996
|
+
delete schema.errorMessage.pattern;
|
|
7997
|
+
if (Object.keys(schema.errorMessage).length === 0) {
|
|
7998
|
+
delete schema.errorMessage;
|
|
7999
|
+
}
|
|
8000
|
+
}
|
|
8001
|
+
}
|
|
8002
|
+
schema.allOf.push(_object_spread$b({
|
|
8003
|
+
pattern: stringifyRegExpWithFlags(regex, refs)
|
|
8004
|
+
}, message && refs.errorMessages && {
|
|
8005
|
+
errorMessage: {
|
|
8006
|
+
pattern: message
|
|
8007
|
+
}
|
|
8008
|
+
}));
|
|
8009
|
+
} else {
|
|
8010
|
+
setResponseValueAndErrors(schema, "pattern", stringifyRegExpWithFlags(regex, refs), message, refs);
|
|
8011
|
+
}
|
|
8012
|
+
}
|
|
8013
|
+
// Mutate z.string.regex() in a best attempt to accommodate for regex flags when applyRegexFlags is true
|
|
8014
|
+
function stringifyRegExpWithFlags(regex, refs) {
|
|
8015
|
+
if (!refs.applyRegexFlags || !regex.flags) {
|
|
8016
|
+
return regex.source;
|
|
8017
|
+
}
|
|
8018
|
+
// Currently handled flags
|
|
8019
|
+
var flags = {
|
|
8020
|
+
i: regex.flags.includes("i"),
|
|
8021
|
+
m: regex.flags.includes("m"),
|
|
8022
|
+
s: regex.flags.includes("s")
|
|
8023
|
+
};
|
|
8024
|
+
// 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!
|
|
8025
|
+
var source = flags.i ? regex.source.toLowerCase() : regex.source;
|
|
8026
|
+
var pattern = "";
|
|
8027
|
+
var isEscaped = false;
|
|
8028
|
+
var inCharGroup = false;
|
|
8029
|
+
var inCharRange = false;
|
|
8030
|
+
for(var i = 0; i < source.length; i++){
|
|
8031
|
+
if (isEscaped) {
|
|
8032
|
+
pattern += source[i];
|
|
8033
|
+
isEscaped = false;
|
|
8034
|
+
continue;
|
|
8035
|
+
}
|
|
8036
|
+
if (flags.i) {
|
|
8037
|
+
if (inCharGroup) {
|
|
8038
|
+
if (source[i].match(/[a-z]/)) {
|
|
8039
|
+
var _source_;
|
|
8040
|
+
if (inCharRange) {
|
|
8041
|
+
pattern += source[i];
|
|
8042
|
+
pattern += "".concat(source[i - 2], "-").concat(source[i]).toUpperCase();
|
|
8043
|
+
inCharRange = false;
|
|
8044
|
+
} else if (source[i + 1] === "-" && ((_source_ = source[i + 2]) === null || _source_ === void 0 ? void 0 : _source_.match(/[a-z]/))) {
|
|
8045
|
+
pattern += source[i];
|
|
8046
|
+
inCharRange = true;
|
|
8047
|
+
} else {
|
|
8048
|
+
pattern += "".concat(source[i]).concat(source[i].toUpperCase());
|
|
8049
|
+
}
|
|
8050
|
+
continue;
|
|
8051
|
+
}
|
|
8052
|
+
} else if (source[i].match(/[a-z]/)) {
|
|
8053
|
+
pattern += "[".concat(source[i]).concat(source[i].toUpperCase(), "]");
|
|
8054
|
+
continue;
|
|
8055
|
+
}
|
|
8056
|
+
}
|
|
8057
|
+
if (flags.m) {
|
|
8058
|
+
if (source[i] === "^") {
|
|
8059
|
+
pattern += "(^|(?<=[\r\n]))";
|
|
8060
|
+
continue;
|
|
8061
|
+
} else if (source[i] === "$") {
|
|
8062
|
+
pattern += "($|(?=[\r\n]))";
|
|
8063
|
+
continue;
|
|
8064
|
+
}
|
|
8065
|
+
}
|
|
8066
|
+
if (flags.s && source[i] === ".") {
|
|
8067
|
+
pattern += inCharGroup ? "".concat(source[i], "\r\n") : "[".concat(source[i], "\r\n]");
|
|
8068
|
+
continue;
|
|
8069
|
+
}
|
|
8070
|
+
pattern += source[i];
|
|
8071
|
+
if (source[i] === "\\") {
|
|
8072
|
+
isEscaped = true;
|
|
8073
|
+
} else if (inCharGroup && source[i] === "]") {
|
|
8074
|
+
inCharGroup = false;
|
|
8075
|
+
} else if (!inCharGroup && source[i] === "[") {
|
|
8076
|
+
inCharGroup = true;
|
|
8077
|
+
}
|
|
8078
|
+
}
|
|
8079
|
+
try {
|
|
8080
|
+
new RegExp(pattern);
|
|
8081
|
+
} catch (e) {
|
|
8082
|
+
console.warn("Could not convert regex pattern at ".concat(refs.currentPath.join("/"), " to a flag-independent form! Falling back to the flag-ignorant source"));
|
|
8083
|
+
return regex.source;
|
|
8084
|
+
}
|
|
8085
|
+
return pattern;
|
|
8086
|
+
}
|
|
8087
|
+
|
|
8088
|
+
function _array_like_to_array$a(arr, len) {
|
|
8089
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
8090
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
8091
|
+
return arr2;
|
|
8092
|
+
}
|
|
8093
|
+
function _array_without_holes$a(arr) {
|
|
8094
|
+
if (Array.isArray(arr)) return _array_like_to_array$a(arr);
|
|
8095
|
+
}
|
|
8096
|
+
function _define_property$a(obj, key, value) {
|
|
8097
|
+
if (key in obj) {
|
|
8098
|
+
Object.defineProperty(obj, key, {
|
|
8099
|
+
value: value,
|
|
8100
|
+
enumerable: true,
|
|
8101
|
+
configurable: true,
|
|
8102
|
+
writable: true
|
|
8103
|
+
});
|
|
8104
|
+
} else {
|
|
8105
|
+
obj[key] = value;
|
|
8106
|
+
}
|
|
8107
|
+
return obj;
|
|
8108
|
+
}
|
|
8109
|
+
function _iterable_to_array$a(iter) {
|
|
8110
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
8111
|
+
}
|
|
8112
|
+
function _non_iterable_spread$a() {
|
|
8113
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
8114
|
+
}
|
|
8115
|
+
function _object_spread$a(target) {
|
|
8116
|
+
for(var i = 1; i < arguments.length; i++){
|
|
8117
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
8118
|
+
var ownKeys = Object.keys(source);
|
|
8119
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
8120
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
8121
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
8122
|
+
}));
|
|
8123
|
+
}
|
|
8124
|
+
ownKeys.forEach(function(key) {
|
|
8125
|
+
_define_property$a(target, key, source[key]);
|
|
8126
|
+
});
|
|
8127
|
+
}
|
|
8128
|
+
return target;
|
|
8129
|
+
}
|
|
8130
|
+
function ownKeys$a(object, enumerableOnly) {
|
|
8131
|
+
var keys = Object.keys(object);
|
|
8132
|
+
if (Object.getOwnPropertySymbols) {
|
|
8133
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
8134
|
+
keys.push.apply(keys, symbols);
|
|
8135
|
+
}
|
|
8136
|
+
return keys;
|
|
8137
|
+
}
|
|
8138
|
+
function _object_spread_props$a(target, source) {
|
|
8139
|
+
source = source != null ? source : {};
|
|
8140
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
8141
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
8142
|
+
} else {
|
|
8143
|
+
ownKeys$a(Object(source)).forEach(function(key) {
|
|
8144
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
8145
|
+
});
|
|
8146
|
+
}
|
|
8147
|
+
return target;
|
|
8148
|
+
}
|
|
8149
|
+
function _object_without_properties(source, excluded) {
|
|
8150
|
+
if (source == null) return {};
|
|
8151
|
+
var target = _object_without_properties_loose(source, excluded);
|
|
8152
|
+
var key, i;
|
|
8153
|
+
if (Object.getOwnPropertySymbols) {
|
|
8154
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
8155
|
+
for(i = 0; i < sourceSymbolKeys.length; i++){
|
|
8156
|
+
key = sourceSymbolKeys[i];
|
|
8157
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
8158
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
8159
|
+
target[key] = source[key];
|
|
8160
|
+
}
|
|
8161
|
+
}
|
|
8162
|
+
return target;
|
|
8163
|
+
}
|
|
8164
|
+
function _object_without_properties_loose(source, excluded) {
|
|
8165
|
+
if (source == null) return {};
|
|
8166
|
+
var target = {};
|
|
8167
|
+
var sourceKeys = Object.keys(source);
|
|
8168
|
+
var key, i;
|
|
8169
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
8170
|
+
key = sourceKeys[i];
|
|
8171
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
8172
|
+
target[key] = source[key];
|
|
8173
|
+
}
|
|
8174
|
+
return target;
|
|
8175
|
+
}
|
|
8176
|
+
function _to_consumable_array$a(arr) {
|
|
8177
|
+
return _array_without_holes$a(arr) || _iterable_to_array$a(arr) || _unsupported_iterable_to_array$a(arr) || _non_iterable_spread$a();
|
|
8178
|
+
}
|
|
8179
|
+
function _unsupported_iterable_to_array$a(o, minLen) {
|
|
8180
|
+
if (!o) return;
|
|
8181
|
+
if (typeof o === "string") return _array_like_to_array$a(o, minLen);
|
|
8182
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
8183
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
8184
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
8185
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$a(o, minLen);
|
|
8186
|
+
}
|
|
8187
|
+
function parseRecordDef(def, refs) {
|
|
8188
|
+
var _def_keyType, _def_keyType1, _def_keyType__def_checks, _def_keyType2, _def_keyType3, _def_keyType__def_type__def_checks;
|
|
8189
|
+
if (refs.target === "openAi") {
|
|
8190
|
+
console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");
|
|
8191
|
+
}
|
|
8192
|
+
if (refs.target === "openApi3" && ((_def_keyType = def.keyType) === null || _def_keyType === void 0 ? void 0 : _def_keyType._def.typeName) === v3.ZodFirstPartyTypeKind.ZodEnum) {
|
|
8193
|
+
return {
|
|
8194
|
+
type: "object",
|
|
8195
|
+
required: def.keyType._def.values,
|
|
8196
|
+
properties: def.keyType._def.values.reduce(function(acc, key) {
|
|
8197
|
+
var _parseDef;
|
|
8198
|
+
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), {
|
|
8199
|
+
currentPath: _to_consumable_array$a(refs.currentPath).concat([
|
|
8200
|
+
"properties",
|
|
8201
|
+
key
|
|
8202
|
+
])
|
|
8203
|
+
}))) !== null && _parseDef !== void 0 ? _parseDef : parseAnyDef(refs)));
|
|
8204
|
+
}, {}),
|
|
8205
|
+
additionalProperties: refs.rejectedAdditionalProperties
|
|
8206
|
+
};
|
|
8207
|
+
}
|
|
8208
|
+
var _parseDef;
|
|
8209
|
+
var schema = {
|
|
8210
|
+
type: "object",
|
|
8211
|
+
additionalProperties: (_parseDef = parseDef(def.valueType._def, _object_spread_props$a(_object_spread$a({}, refs), {
|
|
8212
|
+
currentPath: _to_consumable_array$a(refs.currentPath).concat([
|
|
8213
|
+
"additionalProperties"
|
|
8214
|
+
])
|
|
8215
|
+
}))) !== null && _parseDef !== void 0 ? _parseDef : refs.allowedAdditionalProperties
|
|
8216
|
+
};
|
|
8217
|
+
if (refs.target === "openApi3") {
|
|
8218
|
+
return schema;
|
|
8219
|
+
}
|
|
8220
|
+
if (((_def_keyType1 = def.keyType) === null || _def_keyType1 === void 0 ? void 0 : _def_keyType1._def.typeName) === v3.ZodFirstPartyTypeKind.ZodString && ((_def_keyType__def_checks = def.keyType._def.checks) === null || _def_keyType__def_checks === void 0 ? void 0 : _def_keyType__def_checks.length)) {
|
|
8221
|
+
var _parseStringDef = parseStringDef(def.keyType._def, refs); _parseStringDef.type; var keyType = _object_without_properties(_parseStringDef, [
|
|
8222
|
+
"type"
|
|
8223
|
+
]);
|
|
8224
|
+
return _object_spread_props$a(_object_spread$a({}, schema), {
|
|
8225
|
+
propertyNames: keyType
|
|
8226
|
+
});
|
|
8227
|
+
} else if (((_def_keyType2 = def.keyType) === null || _def_keyType2 === void 0 ? void 0 : _def_keyType2._def.typeName) === v3.ZodFirstPartyTypeKind.ZodEnum) {
|
|
8228
|
+
return _object_spread_props$a(_object_spread$a({}, schema), {
|
|
8229
|
+
propertyNames: {
|
|
8230
|
+
enum: def.keyType._def.values
|
|
8231
|
+
}
|
|
8232
|
+
});
|
|
8233
|
+
} else if (((_def_keyType3 = def.keyType) === null || _def_keyType3 === void 0 ? void 0 : _def_keyType3._def.typeName) === v3.ZodFirstPartyTypeKind.ZodBranded && def.keyType._def.type._def.typeName === v3.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)) {
|
|
8234
|
+
var _parseBrandedDef = parseBrandedDef(def.keyType._def, refs); _parseBrandedDef.type; var keyType1 = _object_without_properties(_parseBrandedDef, [
|
|
8235
|
+
"type"
|
|
8236
|
+
]);
|
|
8237
|
+
return _object_spread_props$a(_object_spread$a({}, schema), {
|
|
8238
|
+
propertyNames: keyType1
|
|
8239
|
+
});
|
|
8240
|
+
}
|
|
8241
|
+
return schema;
|
|
8242
|
+
}
|
|
8243
|
+
|
|
8244
|
+
function _array_like_to_array$9(arr, len) {
|
|
8245
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
8246
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
8247
|
+
return arr2;
|
|
8248
|
+
}
|
|
8249
|
+
function _array_without_holes$9(arr) {
|
|
8250
|
+
if (Array.isArray(arr)) return _array_like_to_array$9(arr);
|
|
8251
|
+
}
|
|
8252
|
+
function _define_property$9(obj, key, value) {
|
|
8253
|
+
if (key in obj) {
|
|
8254
|
+
Object.defineProperty(obj, key, {
|
|
8255
|
+
value: value,
|
|
8256
|
+
enumerable: true,
|
|
8257
|
+
configurable: true,
|
|
8258
|
+
writable: true
|
|
8259
|
+
});
|
|
8260
|
+
} else {
|
|
8261
|
+
obj[key] = value;
|
|
8262
|
+
}
|
|
8263
|
+
return obj;
|
|
8264
|
+
}
|
|
8265
|
+
function _iterable_to_array$9(iter) {
|
|
8266
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
8267
|
+
}
|
|
8268
|
+
function _non_iterable_spread$9() {
|
|
8269
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
8270
|
+
}
|
|
8271
|
+
function _object_spread$9(target) {
|
|
8272
|
+
for(var i = 1; i < arguments.length; i++){
|
|
8273
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
8274
|
+
var ownKeys = Object.keys(source);
|
|
8275
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
8276
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
8277
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
8278
|
+
}));
|
|
8279
|
+
}
|
|
8280
|
+
ownKeys.forEach(function(key) {
|
|
8281
|
+
_define_property$9(target, key, source[key]);
|
|
8282
|
+
});
|
|
8283
|
+
}
|
|
8284
|
+
return target;
|
|
8285
|
+
}
|
|
8286
|
+
function ownKeys$9(object, enumerableOnly) {
|
|
8287
|
+
var keys = Object.keys(object);
|
|
8288
|
+
if (Object.getOwnPropertySymbols) {
|
|
8289
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
8290
|
+
keys.push.apply(keys, symbols);
|
|
8291
|
+
}
|
|
8292
|
+
return keys;
|
|
8293
|
+
}
|
|
8294
|
+
function _object_spread_props$9(target, source) {
|
|
8295
|
+
source = source != null ? source : {};
|
|
8296
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
8297
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
8298
|
+
} else {
|
|
8299
|
+
ownKeys$9(Object(source)).forEach(function(key) {
|
|
8300
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
8301
|
+
});
|
|
8302
|
+
}
|
|
8303
|
+
return target;
|
|
8304
|
+
}
|
|
8305
|
+
function _to_consumable_array$9(arr) {
|
|
8306
|
+
return _array_without_holes$9(arr) || _iterable_to_array$9(arr) || _unsupported_iterable_to_array$9(arr) || _non_iterable_spread$9();
|
|
8307
|
+
}
|
|
8308
|
+
function _unsupported_iterable_to_array$9(o, minLen) {
|
|
8309
|
+
if (!o) return;
|
|
8310
|
+
if (typeof o === "string") return _array_like_to_array$9(o, minLen);
|
|
8311
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
8312
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
8313
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
8314
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$9(o, minLen);
|
|
8315
|
+
}
|
|
8316
|
+
function parseMapDef(def, refs) {
|
|
8317
|
+
if (refs.mapStrategy === "record") {
|
|
8318
|
+
return parseRecordDef(def, refs);
|
|
8319
|
+
}
|
|
8320
|
+
var keys = parseDef(def.keyType._def, _object_spread_props$9(_object_spread$9({}, refs), {
|
|
8321
|
+
currentPath: _to_consumable_array$9(refs.currentPath).concat([
|
|
8322
|
+
"items",
|
|
8323
|
+
"items",
|
|
8324
|
+
"0"
|
|
8325
|
+
])
|
|
8326
|
+
})) || parseAnyDef(refs);
|
|
8327
|
+
var values = parseDef(def.valueType._def, _object_spread_props$9(_object_spread$9({}, refs), {
|
|
8328
|
+
currentPath: _to_consumable_array$9(refs.currentPath).concat([
|
|
8329
|
+
"items",
|
|
8330
|
+
"items",
|
|
8331
|
+
"1"
|
|
8332
|
+
])
|
|
8333
|
+
})) || parseAnyDef(refs);
|
|
8334
|
+
return {
|
|
8335
|
+
type: "array",
|
|
8336
|
+
maxItems: 125,
|
|
8337
|
+
items: {
|
|
8338
|
+
type: "array",
|
|
8339
|
+
items: [
|
|
8340
|
+
keys,
|
|
8341
|
+
values
|
|
8342
|
+
],
|
|
8343
|
+
minItems: 2,
|
|
8344
|
+
maxItems: 2
|
|
8345
|
+
}
|
|
8346
|
+
};
|
|
8347
|
+
}
|
|
8348
|
+
|
|
8349
|
+
function _type_of$1(obj) {
|
|
8350
|
+
"@swc/helpers - typeof";
|
|
8351
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
8352
|
+
}
|
|
8353
|
+
function parseNativeEnumDef(def) {
|
|
8354
|
+
var object = def.values;
|
|
8355
|
+
var actualKeys = Object.keys(def.values).filter(function(key) {
|
|
8356
|
+
return typeof object[object[key]] !== "number";
|
|
8357
|
+
});
|
|
8358
|
+
var actualValues = actualKeys.map(function(key) {
|
|
8359
|
+
return object[key];
|
|
8360
|
+
});
|
|
8361
|
+
var parsedTypes = Array.from(new Set(actualValues.map(function(values) {
|
|
8362
|
+
return typeof values === "undefined" ? "undefined" : _type_of$1(values);
|
|
8363
|
+
})));
|
|
8364
|
+
return {
|
|
8365
|
+
type: parsedTypes.length === 1 ? parsedTypes[0] === "string" ? "string" : "number" : [
|
|
8366
|
+
"string",
|
|
8367
|
+
"number"
|
|
8368
|
+
],
|
|
8369
|
+
enum: actualValues
|
|
8370
|
+
};
|
|
8371
|
+
}
|
|
8372
|
+
|
|
8373
|
+
function _array_like_to_array$8(arr, len) {
|
|
8374
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
8375
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
8376
|
+
return arr2;
|
|
8377
|
+
}
|
|
8378
|
+
function _array_without_holes$8(arr) {
|
|
8379
|
+
if (Array.isArray(arr)) return _array_like_to_array$8(arr);
|
|
8380
|
+
}
|
|
8381
|
+
function _define_property$8(obj, key, value) {
|
|
8382
|
+
if (key in obj) {
|
|
8383
|
+
Object.defineProperty(obj, key, {
|
|
8384
|
+
value: value,
|
|
8385
|
+
enumerable: true,
|
|
8386
|
+
configurable: true,
|
|
8387
|
+
writable: true
|
|
8388
|
+
});
|
|
8389
|
+
} else {
|
|
8390
|
+
obj[key] = value;
|
|
8391
|
+
}
|
|
8392
|
+
return obj;
|
|
8393
|
+
}
|
|
8394
|
+
function _iterable_to_array$8(iter) {
|
|
8395
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
8396
|
+
}
|
|
8397
|
+
function _non_iterable_spread$8() {
|
|
8398
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
8399
|
+
}
|
|
8400
|
+
function _object_spread$8(target) {
|
|
8401
|
+
for(var i = 1; i < arguments.length; i++){
|
|
8402
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
8403
|
+
var ownKeys = Object.keys(source);
|
|
8404
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
8405
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
8406
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
8407
|
+
}));
|
|
8408
|
+
}
|
|
8409
|
+
ownKeys.forEach(function(key) {
|
|
8410
|
+
_define_property$8(target, key, source[key]);
|
|
8411
|
+
});
|
|
8412
|
+
}
|
|
8413
|
+
return target;
|
|
8414
|
+
}
|
|
8415
|
+
function ownKeys$8(object, enumerableOnly) {
|
|
8416
|
+
var keys = Object.keys(object);
|
|
8417
|
+
if (Object.getOwnPropertySymbols) {
|
|
8418
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
8419
|
+
keys.push.apply(keys, symbols);
|
|
8420
|
+
}
|
|
8421
|
+
return keys;
|
|
8422
|
+
}
|
|
8423
|
+
function _object_spread_props$8(target, source) {
|
|
8424
|
+
source = source != null ? source : {};
|
|
8425
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
8426
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
8427
|
+
} else {
|
|
8428
|
+
ownKeys$8(Object(source)).forEach(function(key) {
|
|
8429
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
8430
|
+
});
|
|
8431
|
+
}
|
|
8432
|
+
return target;
|
|
8433
|
+
}
|
|
8434
|
+
function _to_consumable_array$8(arr) {
|
|
8435
|
+
return _array_without_holes$8(arr) || _iterable_to_array$8(arr) || _unsupported_iterable_to_array$8(arr) || _non_iterable_spread$8();
|
|
8436
|
+
}
|
|
8437
|
+
function _unsupported_iterable_to_array$8(o, minLen) {
|
|
8438
|
+
if (!o) return;
|
|
8439
|
+
if (typeof o === "string") return _array_like_to_array$8(o, minLen);
|
|
8440
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
8441
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
8442
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
8443
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$8(o, minLen);
|
|
8444
|
+
}
|
|
8445
|
+
function parseNeverDef(refs) {
|
|
8446
|
+
return refs.target === "openAi" ? undefined : {
|
|
8447
|
+
not: parseAnyDef(_object_spread_props$8(_object_spread$8({}, refs), {
|
|
8448
|
+
currentPath: _to_consumable_array$8(refs.currentPath).concat([
|
|
8449
|
+
"not"
|
|
8450
|
+
])
|
|
8451
|
+
}))
|
|
8452
|
+
};
|
|
8453
|
+
}
|
|
8454
|
+
|
|
8455
|
+
function parseNullDef(refs) {
|
|
8456
|
+
return refs.target === "openApi3" ? {
|
|
8457
|
+
enum: [
|
|
8458
|
+
"null"
|
|
8459
|
+
],
|
|
8460
|
+
nullable: true
|
|
8461
|
+
} : {
|
|
8462
|
+
type: "null"
|
|
8463
|
+
};
|
|
8464
|
+
}
|
|
8465
|
+
|
|
8466
|
+
function _array_like_to_array$7(arr, len) {
|
|
8467
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
8468
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
8469
|
+
return arr2;
|
|
8470
|
+
}
|
|
8471
|
+
function _array_without_holes$7(arr) {
|
|
8472
|
+
if (Array.isArray(arr)) return _array_like_to_array$7(arr);
|
|
8473
|
+
}
|
|
8474
|
+
function _define_property$7(obj, key, value) {
|
|
8475
|
+
if (key in obj) {
|
|
8476
|
+
Object.defineProperty(obj, key, {
|
|
8477
|
+
value: value,
|
|
8478
|
+
enumerable: true,
|
|
8479
|
+
configurable: true,
|
|
8480
|
+
writable: true
|
|
8481
|
+
});
|
|
8482
|
+
} else {
|
|
8483
|
+
obj[key] = value;
|
|
8484
|
+
}
|
|
8485
|
+
return obj;
|
|
8486
|
+
}
|
|
8487
|
+
function _instanceof(left, right) {
|
|
8488
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
8489
|
+
return !!right[Symbol.hasInstance](left);
|
|
8490
|
+
} else {
|
|
8491
|
+
return left instanceof right;
|
|
8492
|
+
}
|
|
8493
|
+
}
|
|
8494
|
+
function _iterable_to_array$7(iter) {
|
|
8495
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
8496
|
+
}
|
|
8497
|
+
function _non_iterable_spread$7() {
|
|
8498
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
8499
|
+
}
|
|
8500
|
+
function _object_spread$7(target) {
|
|
8501
|
+
for(var i = 1; i < arguments.length; i++){
|
|
8502
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
8503
|
+
var ownKeys = Object.keys(source);
|
|
8504
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
8505
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
8506
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
8507
|
+
}));
|
|
8508
|
+
}
|
|
8509
|
+
ownKeys.forEach(function(key) {
|
|
8510
|
+
_define_property$7(target, key, source[key]);
|
|
8511
|
+
});
|
|
8512
|
+
}
|
|
8513
|
+
return target;
|
|
8514
|
+
}
|
|
8515
|
+
function ownKeys$7(object, enumerableOnly) {
|
|
8516
|
+
var keys = Object.keys(object);
|
|
8517
|
+
if (Object.getOwnPropertySymbols) {
|
|
8518
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
8519
|
+
keys.push.apply(keys, symbols);
|
|
8520
|
+
}
|
|
8521
|
+
return keys;
|
|
8522
|
+
}
|
|
8523
|
+
function _object_spread_props$7(target, source) {
|
|
8524
|
+
source = source != null ? source : {};
|
|
8525
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
8526
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
8527
|
+
} else {
|
|
8528
|
+
ownKeys$7(Object(source)).forEach(function(key) {
|
|
8529
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
8530
|
+
});
|
|
8531
|
+
}
|
|
8532
|
+
return target;
|
|
8533
|
+
}
|
|
8534
|
+
function _to_consumable_array$7(arr) {
|
|
8535
|
+
return _array_without_holes$7(arr) || _iterable_to_array$7(arr) || _unsupported_iterable_to_array$7(arr) || _non_iterable_spread$7();
|
|
8536
|
+
}
|
|
8537
|
+
function _type_of(obj) {
|
|
8538
|
+
"@swc/helpers - typeof";
|
|
8539
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
8540
|
+
}
|
|
8541
|
+
function _unsupported_iterable_to_array$7(o, minLen) {
|
|
8542
|
+
if (!o) return;
|
|
8543
|
+
if (typeof o === "string") return _array_like_to_array$7(o, minLen);
|
|
8544
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
8545
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
8546
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
8547
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$7(o, minLen);
|
|
8548
|
+
}
|
|
8549
|
+
var primitiveMappings = {
|
|
8550
|
+
ZodString: "string",
|
|
8551
|
+
ZodNumber: "number",
|
|
8552
|
+
ZodBigInt: "integer",
|
|
8553
|
+
ZodBoolean: "boolean",
|
|
8554
|
+
ZodNull: "null"
|
|
8555
|
+
};
|
|
8556
|
+
function parseUnionDef(def, refs) {
|
|
8557
|
+
if (refs.target === "openApi3") return asAnyOf(def, refs);
|
|
8558
|
+
var options = _instanceof(def.options, Map) ? Array.from(def.options.values()) : def.options;
|
|
8559
|
+
// This blocks tries to look ahead a bit to produce nicer looking schemas with type array instead of anyOf.
|
|
8560
|
+
if (options.every(function(x) {
|
|
8561
|
+
return x._def.typeName in primitiveMappings && (!x._def.checks || !x._def.checks.length);
|
|
8562
|
+
})) {
|
|
8563
|
+
// all types in union are primitive and lack checks, so might as well squash into {type: [...]}
|
|
8564
|
+
var types = options.reduce(function(types, x) {
|
|
8565
|
+
var type = primitiveMappings[x._def.typeName]; //Can be safely casted due to row 43
|
|
8566
|
+
return type && !types.includes(type) ? _to_consumable_array$7(types).concat([
|
|
8567
|
+
type
|
|
8568
|
+
]) : types;
|
|
8569
|
+
}, []);
|
|
8570
|
+
return {
|
|
8571
|
+
type: types.length > 1 ? types : types[0]
|
|
8572
|
+
};
|
|
8573
|
+
} else if (options.every(function(x) {
|
|
8574
|
+
return x._def.typeName === "ZodLiteral" && !x.description;
|
|
8575
|
+
})) {
|
|
8576
|
+
// all options literals
|
|
8577
|
+
var types1 = options.reduce(function(acc, x) {
|
|
8578
|
+
var type = _type_of(x._def.value);
|
|
8579
|
+
switch(type){
|
|
8580
|
+
case "string":
|
|
8581
|
+
case "number":
|
|
8582
|
+
case "boolean":
|
|
8583
|
+
return _to_consumable_array$7(acc).concat([
|
|
8584
|
+
type
|
|
8585
|
+
]);
|
|
8586
|
+
case "bigint":
|
|
8587
|
+
return _to_consumable_array$7(acc).concat([
|
|
8588
|
+
"integer"
|
|
8589
|
+
]);
|
|
8590
|
+
case "object":
|
|
8591
|
+
if (x._def.value === null) return _to_consumable_array$7(acc).concat([
|
|
8592
|
+
"null"
|
|
8593
|
+
]);
|
|
8594
|
+
case "symbol":
|
|
8595
|
+
case "undefined":
|
|
8596
|
+
case "function":
|
|
8597
|
+
default:
|
|
8598
|
+
return acc;
|
|
8599
|
+
}
|
|
8600
|
+
}, []);
|
|
8601
|
+
if (types1.length === options.length) {
|
|
8602
|
+
// all the literals are primitive, as far as null can be considered primitive
|
|
8603
|
+
var uniqueTypes = types1.filter(function(x, i, a) {
|
|
8604
|
+
return a.indexOf(x) === i;
|
|
8605
|
+
});
|
|
8606
|
+
return {
|
|
8607
|
+
type: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0],
|
|
8608
|
+
enum: options.reduce(function(acc, x) {
|
|
8609
|
+
return acc.includes(x._def.value) ? acc : _to_consumable_array$7(acc).concat([
|
|
8610
|
+
x._def.value
|
|
8611
|
+
]);
|
|
8612
|
+
}, [])
|
|
8613
|
+
};
|
|
8614
|
+
}
|
|
8615
|
+
} else if (options.every(function(x) {
|
|
8616
|
+
return x._def.typeName === "ZodEnum";
|
|
8617
|
+
})) {
|
|
8618
|
+
return {
|
|
8619
|
+
type: "string",
|
|
8620
|
+
enum: options.reduce(function(acc, x) {
|
|
8621
|
+
return _to_consumable_array$7(acc).concat(_to_consumable_array$7(x._def.values.filter(function(x) {
|
|
8622
|
+
return !acc.includes(x);
|
|
8623
|
+
})));
|
|
8624
|
+
}, [])
|
|
8625
|
+
};
|
|
8626
|
+
}
|
|
8627
|
+
return asAnyOf(def, refs);
|
|
8628
|
+
}
|
|
8629
|
+
var asAnyOf = function(def, refs) {
|
|
8630
|
+
var anyOf = (_instanceof(def.options, Map) ? Array.from(def.options.values()) : def.options).map(function(x, i) {
|
|
8631
|
+
return parseDef(x._def, _object_spread_props$7(_object_spread$7({}, refs), {
|
|
8632
|
+
currentPath: _to_consumable_array$7(refs.currentPath).concat([
|
|
8633
|
+
"anyOf",
|
|
8634
|
+
"".concat(i)
|
|
8635
|
+
])
|
|
8636
|
+
}));
|
|
8637
|
+
}).filter(function(x) {
|
|
8638
|
+
return !!x && (!refs.strictUnions || typeof x === "object" && Object.keys(x).length > 0);
|
|
8639
|
+
});
|
|
8640
|
+
return anyOf.length ? {
|
|
8641
|
+
anyOf: anyOf
|
|
8642
|
+
} : undefined;
|
|
8643
|
+
};
|
|
8644
|
+
|
|
8645
|
+
function _array_like_to_array$6(arr, len) {
|
|
8646
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
8647
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
8648
|
+
return arr2;
|
|
8649
|
+
}
|
|
8650
|
+
function _array_without_holes$6(arr) {
|
|
8651
|
+
if (Array.isArray(arr)) return _array_like_to_array$6(arr);
|
|
8652
|
+
}
|
|
8653
|
+
function _define_property$6(obj, key, value) {
|
|
8654
|
+
if (key in obj) {
|
|
8655
|
+
Object.defineProperty(obj, key, {
|
|
8656
|
+
value: value,
|
|
8657
|
+
enumerable: true,
|
|
8658
|
+
configurable: true,
|
|
8659
|
+
writable: true
|
|
8660
|
+
});
|
|
8661
|
+
} else {
|
|
8662
|
+
obj[key] = value;
|
|
8663
|
+
}
|
|
8664
|
+
return obj;
|
|
8665
|
+
}
|
|
8666
|
+
function _iterable_to_array$6(iter) {
|
|
8667
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
8668
|
+
}
|
|
8669
|
+
function _non_iterable_spread$6() {
|
|
8670
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
8671
|
+
}
|
|
8672
|
+
function _object_spread$6(target) {
|
|
8673
|
+
for(var i = 1; i < arguments.length; i++){
|
|
8674
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
8675
|
+
var ownKeys = Object.keys(source);
|
|
8676
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
8677
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
8678
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
8679
|
+
}));
|
|
8680
|
+
}
|
|
8681
|
+
ownKeys.forEach(function(key) {
|
|
8682
|
+
_define_property$6(target, key, source[key]);
|
|
8683
|
+
});
|
|
8684
|
+
}
|
|
8685
|
+
return target;
|
|
8686
|
+
}
|
|
8687
|
+
function ownKeys$6(object, enumerableOnly) {
|
|
8688
|
+
var keys = Object.keys(object);
|
|
8689
|
+
if (Object.getOwnPropertySymbols) {
|
|
8690
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
8691
|
+
keys.push.apply(keys, symbols);
|
|
8692
|
+
}
|
|
8693
|
+
return keys;
|
|
8694
|
+
}
|
|
8695
|
+
function _object_spread_props$6(target, source) {
|
|
8696
|
+
source = source != null ? source : {};
|
|
8697
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
8698
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
8699
|
+
} else {
|
|
8700
|
+
ownKeys$6(Object(source)).forEach(function(key) {
|
|
8701
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
8702
|
+
});
|
|
8703
|
+
}
|
|
8704
|
+
return target;
|
|
8705
|
+
}
|
|
8706
|
+
function _to_consumable_array$6(arr) {
|
|
8707
|
+
return _array_without_holes$6(arr) || _iterable_to_array$6(arr) || _unsupported_iterable_to_array$6(arr) || _non_iterable_spread$6();
|
|
8708
|
+
}
|
|
8709
|
+
function _unsupported_iterable_to_array$6(o, minLen) {
|
|
8710
|
+
if (!o) return;
|
|
8711
|
+
if (typeof o === "string") return _array_like_to_array$6(o, minLen);
|
|
8712
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
8713
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
8714
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
8715
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
|
|
8716
|
+
}
|
|
8717
|
+
function parseNullableDef(def, refs) {
|
|
8718
|
+
if ([
|
|
8719
|
+
"ZodString",
|
|
8720
|
+
"ZodNumber",
|
|
8721
|
+
"ZodBigInt",
|
|
8722
|
+
"ZodBoolean",
|
|
8723
|
+
"ZodNull"
|
|
8724
|
+
].includes(def.innerType._def.typeName) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
|
|
8725
|
+
if (refs.target === "openApi3") {
|
|
8726
|
+
return {
|
|
8727
|
+
type: primitiveMappings[def.innerType._def.typeName],
|
|
8728
|
+
nullable: true
|
|
8729
|
+
};
|
|
8730
|
+
}
|
|
8731
|
+
return {
|
|
8732
|
+
type: [
|
|
8733
|
+
primitiveMappings[def.innerType._def.typeName],
|
|
8734
|
+
"null"
|
|
8735
|
+
]
|
|
8736
|
+
};
|
|
8737
|
+
}
|
|
8738
|
+
if (refs.target === "openApi3") {
|
|
8739
|
+
var base = parseDef(def.innerType._def, _object_spread_props$6(_object_spread$6({}, refs), {
|
|
8740
|
+
currentPath: _to_consumable_array$6(refs.currentPath)
|
|
8741
|
+
}));
|
|
8742
|
+
if (base && "$ref" in base) return {
|
|
8743
|
+
allOf: [
|
|
8744
|
+
base
|
|
8745
|
+
],
|
|
8746
|
+
nullable: true
|
|
8747
|
+
};
|
|
8748
|
+
return base && _object_spread_props$6(_object_spread$6({}, base), {
|
|
8749
|
+
nullable: true
|
|
8750
|
+
});
|
|
8751
|
+
}
|
|
8752
|
+
var base1 = parseDef(def.innerType._def, _object_spread_props$6(_object_spread$6({}, refs), {
|
|
8753
|
+
currentPath: _to_consumable_array$6(refs.currentPath).concat([
|
|
8754
|
+
"anyOf",
|
|
8755
|
+
"0"
|
|
8756
|
+
])
|
|
8757
|
+
}));
|
|
8758
|
+
return base1 && {
|
|
8759
|
+
anyOf: [
|
|
8760
|
+
base1,
|
|
8761
|
+
{
|
|
8762
|
+
type: "null"
|
|
8763
|
+
}
|
|
8764
|
+
]
|
|
8765
|
+
};
|
|
8766
|
+
}
|
|
8767
|
+
|
|
8768
|
+
function parseNumberDef(def, refs) {
|
|
8769
|
+
var res = {
|
|
8770
|
+
type: "number"
|
|
8771
|
+
};
|
|
8772
|
+
if (!def.checks) return res;
|
|
8773
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
8774
|
+
try {
|
|
8775
|
+
for(var _iterator = def.checks[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
8776
|
+
var check = _step.value;
|
|
8777
|
+
switch(check.kind){
|
|
8778
|
+
case "int":
|
|
8779
|
+
res.type = "integer";
|
|
8780
|
+
addErrorMessage(res, "type", check.message, refs);
|
|
8781
|
+
break;
|
|
8782
|
+
case "min":
|
|
8783
|
+
if (refs.target === "jsonSchema7") {
|
|
8784
|
+
if (check.inclusive) {
|
|
8785
|
+
setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
|
|
8786
|
+
} else {
|
|
8787
|
+
setResponseValueAndErrors(res, "exclusiveMinimum", check.value, check.message, refs);
|
|
8788
|
+
}
|
|
8789
|
+
} else {
|
|
8790
|
+
if (!check.inclusive) {
|
|
8791
|
+
res.exclusiveMinimum = true;
|
|
8792
|
+
}
|
|
8793
|
+
setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
|
|
8794
|
+
}
|
|
8795
|
+
break;
|
|
8796
|
+
case "max":
|
|
8797
|
+
if (refs.target === "jsonSchema7") {
|
|
8798
|
+
if (check.inclusive) {
|
|
8799
|
+
setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
|
|
8800
|
+
} else {
|
|
8801
|
+
setResponseValueAndErrors(res, "exclusiveMaximum", check.value, check.message, refs);
|
|
8802
|
+
}
|
|
8803
|
+
} else {
|
|
8804
|
+
if (!check.inclusive) {
|
|
8805
|
+
res.exclusiveMaximum = true;
|
|
8806
|
+
}
|
|
8807
|
+
setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
|
|
8808
|
+
}
|
|
8809
|
+
break;
|
|
8810
|
+
case "multipleOf":
|
|
8811
|
+
setResponseValueAndErrors(res, "multipleOf", check.value, check.message, refs);
|
|
8812
|
+
break;
|
|
8813
|
+
}
|
|
8814
|
+
}
|
|
8815
|
+
} catch (err) {
|
|
8816
|
+
_didIteratorError = true;
|
|
8817
|
+
_iteratorError = err;
|
|
8818
|
+
} finally{
|
|
8819
|
+
try {
|
|
8820
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
8821
|
+
_iterator.return();
|
|
8822
|
+
}
|
|
8823
|
+
} finally{
|
|
8824
|
+
if (_didIteratorError) {
|
|
8825
|
+
throw _iteratorError;
|
|
8826
|
+
}
|
|
8827
|
+
}
|
|
8828
|
+
}
|
|
8829
|
+
return res;
|
|
8830
|
+
}
|
|
8831
|
+
|
|
8832
|
+
function _array_like_to_array$5(arr, len) {
|
|
8833
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
8834
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
8835
|
+
return arr2;
|
|
8836
|
+
}
|
|
8837
|
+
function _array_without_holes$5(arr) {
|
|
8838
|
+
if (Array.isArray(arr)) return _array_like_to_array$5(arr);
|
|
8839
|
+
}
|
|
8840
|
+
function _define_property$5(obj, key, value) {
|
|
8841
|
+
if (key in obj) {
|
|
8842
|
+
Object.defineProperty(obj, key, {
|
|
8843
|
+
value: value,
|
|
8844
|
+
enumerable: true,
|
|
8845
|
+
configurable: true,
|
|
8846
|
+
writable: true
|
|
8847
|
+
});
|
|
8848
|
+
} else {
|
|
8849
|
+
obj[key] = value;
|
|
8850
|
+
}
|
|
8851
|
+
return obj;
|
|
8852
|
+
}
|
|
8853
|
+
function _iterable_to_array$5(iter) {
|
|
8854
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
8855
|
+
}
|
|
8856
|
+
function _non_iterable_spread$5() {
|
|
8857
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
8858
|
+
}
|
|
8859
|
+
function _object_spread$5(target) {
|
|
8860
|
+
for(var i = 1; i < arguments.length; i++){
|
|
8861
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
8862
|
+
var ownKeys = Object.keys(source);
|
|
8863
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
8864
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
8865
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
8866
|
+
}));
|
|
8867
|
+
}
|
|
8868
|
+
ownKeys.forEach(function(key) {
|
|
8869
|
+
_define_property$5(target, key, source[key]);
|
|
8870
|
+
});
|
|
8871
|
+
}
|
|
8872
|
+
return target;
|
|
8873
|
+
}
|
|
8874
|
+
function ownKeys$5(object, enumerableOnly) {
|
|
8875
|
+
var keys = Object.keys(object);
|
|
8876
|
+
if (Object.getOwnPropertySymbols) {
|
|
8877
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
8878
|
+
keys.push.apply(keys, symbols);
|
|
8879
|
+
}
|
|
8880
|
+
return keys;
|
|
8881
|
+
}
|
|
8882
|
+
function _object_spread_props$5(target, source) {
|
|
8883
|
+
source = source != null ? source : {};
|
|
8884
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
8885
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
8886
|
+
} else {
|
|
8887
|
+
ownKeys$5(Object(source)).forEach(function(key) {
|
|
8888
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
8889
|
+
});
|
|
8890
|
+
}
|
|
8891
|
+
return target;
|
|
8892
|
+
}
|
|
8893
|
+
function _to_consumable_array$5(arr) {
|
|
8894
|
+
return _array_without_holes$5(arr) || _iterable_to_array$5(arr) || _unsupported_iterable_to_array$5(arr) || _non_iterable_spread$5();
|
|
8895
|
+
}
|
|
8896
|
+
function _unsupported_iterable_to_array$5(o, minLen) {
|
|
8897
|
+
if (!o) return;
|
|
8898
|
+
if (typeof o === "string") return _array_like_to_array$5(o, minLen);
|
|
8899
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
8900
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
8901
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
8902
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
|
|
8903
|
+
}
|
|
8904
|
+
function parseObjectDef(def, refs) {
|
|
8905
|
+
var forceOptionalIntoNullable = refs.target === "openAi";
|
|
8906
|
+
var result = {
|
|
8907
|
+
type: "object",
|
|
8908
|
+
properties: {}
|
|
8909
|
+
};
|
|
8910
|
+
var required = [];
|
|
8911
|
+
var shape = def.shape();
|
|
8912
|
+
for(var propName in shape){
|
|
8913
|
+
var propDef = shape[propName];
|
|
8914
|
+
if (propDef === undefined || propDef._def === undefined) {
|
|
8915
|
+
continue;
|
|
8916
|
+
}
|
|
8917
|
+
var propOptional = safeIsOptional(propDef);
|
|
8918
|
+
if (propOptional && forceOptionalIntoNullable) {
|
|
8919
|
+
if (propDef._def.typeName === "ZodOptional") {
|
|
8920
|
+
propDef = propDef._def.innerType;
|
|
8921
|
+
}
|
|
8922
|
+
if (!propDef.isNullable()) {
|
|
8923
|
+
propDef = propDef.nullable();
|
|
8924
|
+
}
|
|
8925
|
+
propOptional = false;
|
|
8926
|
+
}
|
|
8927
|
+
var parsedDef = parseDef(propDef._def, _object_spread_props$5(_object_spread$5({}, refs), {
|
|
8928
|
+
currentPath: _to_consumable_array$5(refs.currentPath).concat([
|
|
8929
|
+
"properties",
|
|
8930
|
+
propName
|
|
8931
|
+
]),
|
|
8932
|
+
propertyPath: _to_consumable_array$5(refs.currentPath).concat([
|
|
8933
|
+
"properties",
|
|
8934
|
+
propName
|
|
8935
|
+
])
|
|
8936
|
+
}));
|
|
8937
|
+
if (parsedDef === undefined) {
|
|
8938
|
+
continue;
|
|
8939
|
+
}
|
|
8940
|
+
result.properties[propName] = parsedDef;
|
|
8941
|
+
if (!propOptional) {
|
|
8942
|
+
required.push(propName);
|
|
8943
|
+
}
|
|
8944
|
+
}
|
|
8945
|
+
if (required.length) {
|
|
8946
|
+
result.required = required;
|
|
8947
|
+
}
|
|
8948
|
+
var additionalProperties = decideAdditionalProperties(def, refs);
|
|
8949
|
+
if (additionalProperties !== undefined) {
|
|
8950
|
+
result.additionalProperties = additionalProperties;
|
|
8951
|
+
}
|
|
8952
|
+
return result;
|
|
8953
|
+
}
|
|
8954
|
+
function decideAdditionalProperties(def, refs) {
|
|
8955
|
+
if (def.catchall._def.typeName !== "ZodNever") {
|
|
8956
|
+
return parseDef(def.catchall._def, _object_spread_props$5(_object_spread$5({}, refs), {
|
|
8957
|
+
currentPath: _to_consumable_array$5(refs.currentPath).concat([
|
|
8958
|
+
"additionalProperties"
|
|
8959
|
+
])
|
|
8960
|
+
}));
|
|
8961
|
+
}
|
|
8962
|
+
switch(def.unknownKeys){
|
|
8963
|
+
case "passthrough":
|
|
8964
|
+
return refs.allowedAdditionalProperties;
|
|
8965
|
+
case "strict":
|
|
8966
|
+
return refs.rejectedAdditionalProperties;
|
|
8967
|
+
case "strip":
|
|
8968
|
+
return refs.removeAdditionalStrategy === "strict" ? refs.allowedAdditionalProperties : refs.rejectedAdditionalProperties;
|
|
8969
|
+
}
|
|
8970
|
+
}
|
|
8971
|
+
function safeIsOptional(schema) {
|
|
8972
|
+
try {
|
|
8973
|
+
return schema.isOptional();
|
|
8974
|
+
} catch (e) {
|
|
8975
|
+
return true;
|
|
8976
|
+
}
|
|
8977
|
+
}
|
|
8978
|
+
|
|
8979
|
+
function _array_like_to_array$4(arr, len) {
|
|
8980
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
8981
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
8982
|
+
return arr2;
|
|
8983
|
+
}
|
|
8984
|
+
function _array_without_holes$4(arr) {
|
|
8985
|
+
if (Array.isArray(arr)) return _array_like_to_array$4(arr);
|
|
8986
|
+
}
|
|
8987
|
+
function _define_property$4(obj, key, value) {
|
|
8988
|
+
if (key in obj) {
|
|
8989
|
+
Object.defineProperty(obj, key, {
|
|
8990
|
+
value: value,
|
|
8991
|
+
enumerable: true,
|
|
8992
|
+
configurable: true,
|
|
8993
|
+
writable: true
|
|
8994
|
+
});
|
|
8995
|
+
} else {
|
|
8996
|
+
obj[key] = value;
|
|
8997
|
+
}
|
|
8998
|
+
return obj;
|
|
8999
|
+
}
|
|
9000
|
+
function _iterable_to_array$4(iter) {
|
|
9001
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
9002
|
+
}
|
|
9003
|
+
function _non_iterable_spread$4() {
|
|
9004
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
9005
|
+
}
|
|
9006
|
+
function _object_spread$4(target) {
|
|
9007
|
+
for(var i = 1; i < arguments.length; i++){
|
|
9008
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
9009
|
+
var ownKeys = Object.keys(source);
|
|
9010
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
9011
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
9012
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
9013
|
+
}));
|
|
9014
|
+
}
|
|
9015
|
+
ownKeys.forEach(function(key) {
|
|
9016
|
+
_define_property$4(target, key, source[key]);
|
|
9017
|
+
});
|
|
9018
|
+
}
|
|
9019
|
+
return target;
|
|
9020
|
+
}
|
|
9021
|
+
function ownKeys$4(object, enumerableOnly) {
|
|
9022
|
+
var keys = Object.keys(object);
|
|
9023
|
+
if (Object.getOwnPropertySymbols) {
|
|
9024
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
9025
|
+
keys.push.apply(keys, symbols);
|
|
9026
|
+
}
|
|
9027
|
+
return keys;
|
|
9028
|
+
}
|
|
9029
|
+
function _object_spread_props$4(target, source) {
|
|
9030
|
+
source = source != null ? source : {};
|
|
9031
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
9032
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
9033
|
+
} else {
|
|
9034
|
+
ownKeys$4(Object(source)).forEach(function(key) {
|
|
9035
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
9036
|
+
});
|
|
9037
|
+
}
|
|
9038
|
+
return target;
|
|
9039
|
+
}
|
|
9040
|
+
function _to_consumable_array$4(arr) {
|
|
9041
|
+
return _array_without_holes$4(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$4(arr) || _non_iterable_spread$4();
|
|
9042
|
+
}
|
|
9043
|
+
function _unsupported_iterable_to_array$4(o, minLen) {
|
|
9044
|
+
if (!o) return;
|
|
9045
|
+
if (typeof o === "string") return _array_like_to_array$4(o, minLen);
|
|
9046
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
9047
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
9048
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
9049
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
|
|
9050
|
+
}
|
|
9051
|
+
var parseOptionalDef = function(def, refs) {
|
|
9052
|
+
var _refs_propertyPath;
|
|
9053
|
+
if (refs.currentPath.toString() === ((_refs_propertyPath = refs.propertyPath) === null || _refs_propertyPath === void 0 ? void 0 : _refs_propertyPath.toString())) {
|
|
9054
|
+
return parseDef(def.innerType._def, refs);
|
|
9055
|
+
}
|
|
9056
|
+
var innerSchema = parseDef(def.innerType._def, _object_spread_props$4(_object_spread$4({}, refs), {
|
|
9057
|
+
currentPath: _to_consumable_array$4(refs.currentPath).concat([
|
|
9058
|
+
"anyOf",
|
|
9059
|
+
"1"
|
|
9060
|
+
])
|
|
9061
|
+
}));
|
|
9062
|
+
return innerSchema ? {
|
|
9063
|
+
anyOf: [
|
|
9064
|
+
{
|
|
9065
|
+
not: parseAnyDef(refs)
|
|
9066
|
+
},
|
|
9067
|
+
innerSchema
|
|
9068
|
+
]
|
|
9069
|
+
} : parseAnyDef(refs);
|
|
9070
|
+
};
|
|
9071
|
+
|
|
9072
|
+
function _array_like_to_array$3(arr, len) {
|
|
9073
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
9074
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
9075
|
+
return arr2;
|
|
9076
|
+
}
|
|
9077
|
+
function _array_without_holes$3(arr) {
|
|
9078
|
+
if (Array.isArray(arr)) return _array_like_to_array$3(arr);
|
|
9079
|
+
}
|
|
9080
|
+
function _define_property$3(obj, key, value) {
|
|
9081
|
+
if (key in obj) {
|
|
9082
|
+
Object.defineProperty(obj, key, {
|
|
9083
|
+
value: value,
|
|
9084
|
+
enumerable: true,
|
|
9085
|
+
configurable: true,
|
|
9086
|
+
writable: true
|
|
9087
|
+
});
|
|
9088
|
+
} else {
|
|
9089
|
+
obj[key] = value;
|
|
9090
|
+
}
|
|
9091
|
+
return obj;
|
|
9092
|
+
}
|
|
9093
|
+
function _iterable_to_array$3(iter) {
|
|
9094
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
9095
|
+
}
|
|
9096
|
+
function _non_iterable_spread$3() {
|
|
9097
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
9098
|
+
}
|
|
9099
|
+
function _object_spread$3(target) {
|
|
9100
|
+
for(var i = 1; i < arguments.length; i++){
|
|
9101
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
9102
|
+
var ownKeys = Object.keys(source);
|
|
9103
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
9104
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
9105
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
9106
|
+
}));
|
|
9107
|
+
}
|
|
9108
|
+
ownKeys.forEach(function(key) {
|
|
9109
|
+
_define_property$3(target, key, source[key]);
|
|
9110
|
+
});
|
|
9111
|
+
}
|
|
9112
|
+
return target;
|
|
9113
|
+
}
|
|
9114
|
+
function ownKeys$3(object, enumerableOnly) {
|
|
9115
|
+
var keys = Object.keys(object);
|
|
9116
|
+
if (Object.getOwnPropertySymbols) {
|
|
9117
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
9118
|
+
keys.push.apply(keys, symbols);
|
|
9119
|
+
}
|
|
9120
|
+
return keys;
|
|
9121
|
+
}
|
|
9122
|
+
function _object_spread_props$3(target, source) {
|
|
9123
|
+
source = source != null ? source : {};
|
|
9124
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
9125
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
9126
|
+
} else {
|
|
9127
|
+
ownKeys$3(Object(source)).forEach(function(key) {
|
|
9128
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
9129
|
+
});
|
|
9130
|
+
}
|
|
9131
|
+
return target;
|
|
9132
|
+
}
|
|
9133
|
+
function _to_consumable_array$3(arr) {
|
|
9134
|
+
return _array_without_holes$3(arr) || _iterable_to_array$3(arr) || _unsupported_iterable_to_array$3(arr) || _non_iterable_spread$3();
|
|
9135
|
+
}
|
|
9136
|
+
function _unsupported_iterable_to_array$3(o, minLen) {
|
|
9137
|
+
if (!o) return;
|
|
9138
|
+
if (typeof o === "string") return _array_like_to_array$3(o, minLen);
|
|
9139
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
9140
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
9141
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
9142
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
|
|
9143
|
+
}
|
|
9144
|
+
var parsePipelineDef = function(def, refs) {
|
|
9145
|
+
if (refs.pipeStrategy === "input") {
|
|
9146
|
+
return parseDef(def.in._def, refs);
|
|
9147
|
+
} else if (refs.pipeStrategy === "output") {
|
|
9148
|
+
return parseDef(def.out._def, refs);
|
|
9149
|
+
}
|
|
9150
|
+
var a = parseDef(def.in._def, _object_spread_props$3(_object_spread$3({}, refs), {
|
|
9151
|
+
currentPath: _to_consumable_array$3(refs.currentPath).concat([
|
|
9152
|
+
"allOf",
|
|
9153
|
+
"0"
|
|
9154
|
+
])
|
|
9155
|
+
}));
|
|
9156
|
+
var b = parseDef(def.out._def, _object_spread_props$3(_object_spread$3({}, refs), {
|
|
9157
|
+
currentPath: _to_consumable_array$3(refs.currentPath).concat([
|
|
9158
|
+
"allOf",
|
|
9159
|
+
a ? "1" : "0"
|
|
9160
|
+
])
|
|
9161
|
+
}));
|
|
9162
|
+
return {
|
|
9163
|
+
allOf: [
|
|
9164
|
+
a,
|
|
9165
|
+
b
|
|
9166
|
+
].filter(function(x) {
|
|
9167
|
+
return x !== undefined;
|
|
9168
|
+
})
|
|
9169
|
+
};
|
|
9170
|
+
};
|
|
9171
|
+
|
|
9172
|
+
function parsePromiseDef(def, refs) {
|
|
9173
|
+
return parseDef(def.type._def, refs);
|
|
9174
|
+
}
|
|
9175
|
+
|
|
9176
|
+
function _array_like_to_array$2(arr, len) {
|
|
9177
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
9178
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
9179
|
+
return arr2;
|
|
9180
|
+
}
|
|
9181
|
+
function _array_without_holes$2(arr) {
|
|
9182
|
+
if (Array.isArray(arr)) return _array_like_to_array$2(arr);
|
|
9183
|
+
}
|
|
9184
|
+
function _define_property$2(obj, key, value) {
|
|
9185
|
+
if (key in obj) {
|
|
9186
|
+
Object.defineProperty(obj, key, {
|
|
9187
|
+
value: value,
|
|
9188
|
+
enumerable: true,
|
|
9189
|
+
configurable: true,
|
|
9190
|
+
writable: true
|
|
9191
|
+
});
|
|
9192
|
+
} else {
|
|
9193
|
+
obj[key] = value;
|
|
9194
|
+
}
|
|
9195
|
+
return obj;
|
|
9196
|
+
}
|
|
9197
|
+
function _iterable_to_array$2(iter) {
|
|
9198
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
9199
|
+
}
|
|
9200
|
+
function _non_iterable_spread$2() {
|
|
9201
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
9202
|
+
}
|
|
9203
|
+
function _object_spread$2(target) {
|
|
9204
|
+
for(var i = 1; i < arguments.length; i++){
|
|
9205
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
9206
|
+
var ownKeys = Object.keys(source);
|
|
9207
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
9208
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
9209
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
9210
|
+
}));
|
|
9211
|
+
}
|
|
9212
|
+
ownKeys.forEach(function(key) {
|
|
9213
|
+
_define_property$2(target, key, source[key]);
|
|
9214
|
+
});
|
|
9215
|
+
}
|
|
9216
|
+
return target;
|
|
9217
|
+
}
|
|
9218
|
+
function ownKeys$2(object, enumerableOnly) {
|
|
9219
|
+
var keys = Object.keys(object);
|
|
9220
|
+
if (Object.getOwnPropertySymbols) {
|
|
9221
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
9222
|
+
keys.push.apply(keys, symbols);
|
|
9223
|
+
}
|
|
9224
|
+
return keys;
|
|
9225
|
+
}
|
|
9226
|
+
function _object_spread_props$2(target, source) {
|
|
9227
|
+
source = source != null ? source : {};
|
|
9228
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
9229
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
9230
|
+
} else {
|
|
9231
|
+
ownKeys$2(Object(source)).forEach(function(key) {
|
|
9232
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
9233
|
+
});
|
|
9234
|
+
}
|
|
9235
|
+
return target;
|
|
9236
|
+
}
|
|
9237
|
+
function _to_consumable_array$2(arr) {
|
|
9238
|
+
return _array_without_holes$2(arr) || _iterable_to_array$2(arr) || _unsupported_iterable_to_array$2(arr) || _non_iterable_spread$2();
|
|
9239
|
+
}
|
|
9240
|
+
function _unsupported_iterable_to_array$2(o, minLen) {
|
|
9241
|
+
if (!o) return;
|
|
9242
|
+
if (typeof o === "string") return _array_like_to_array$2(o, minLen);
|
|
9243
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
9244
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
9245
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
9246
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
|
|
9247
|
+
}
|
|
9248
|
+
function parseSetDef(def, refs) {
|
|
9249
|
+
var items = parseDef(def.valueType._def, _object_spread_props$2(_object_spread$2({}, refs), {
|
|
9250
|
+
currentPath: _to_consumable_array$2(refs.currentPath).concat([
|
|
9251
|
+
"items"
|
|
9252
|
+
])
|
|
9253
|
+
}));
|
|
9254
|
+
var schema = {
|
|
9255
|
+
type: "array",
|
|
9256
|
+
uniqueItems: true,
|
|
9257
|
+
items: items
|
|
9258
|
+
};
|
|
9259
|
+
if (def.minSize) {
|
|
9260
|
+
setResponseValueAndErrors(schema, "minItems", def.minSize.value, def.minSize.message, refs);
|
|
9261
|
+
}
|
|
9262
|
+
if (def.maxSize) {
|
|
9263
|
+
setResponseValueAndErrors(schema, "maxItems", def.maxSize.value, def.maxSize.message, refs);
|
|
9264
|
+
}
|
|
9265
|
+
return schema;
|
|
9266
|
+
}
|
|
9267
|
+
|
|
9268
|
+
function _array_like_to_array$1(arr, len) {
|
|
9269
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
9270
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
9271
|
+
return arr2;
|
|
9272
|
+
}
|
|
9273
|
+
function _array_without_holes$1(arr) {
|
|
9274
|
+
if (Array.isArray(arr)) return _array_like_to_array$1(arr);
|
|
9275
|
+
}
|
|
9276
|
+
function _define_property$1(obj, key, value) {
|
|
9277
|
+
if (key in obj) {
|
|
9278
|
+
Object.defineProperty(obj, key, {
|
|
9279
|
+
value: value,
|
|
9280
|
+
enumerable: true,
|
|
9281
|
+
configurable: true,
|
|
9282
|
+
writable: true
|
|
9283
|
+
});
|
|
9284
|
+
} else {
|
|
9285
|
+
obj[key] = value;
|
|
9286
|
+
}
|
|
9287
|
+
return obj;
|
|
9288
|
+
}
|
|
9289
|
+
function _iterable_to_array$1(iter) {
|
|
9290
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
9291
|
+
}
|
|
9292
|
+
function _non_iterable_spread$1() {
|
|
9293
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
9294
|
+
}
|
|
9295
|
+
function _object_spread$1(target) {
|
|
9296
|
+
for(var i = 1; i < arguments.length; i++){
|
|
9297
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
9298
|
+
var ownKeys = Object.keys(source);
|
|
9299
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
9300
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
9301
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
9302
|
+
}));
|
|
9303
|
+
}
|
|
9304
|
+
ownKeys.forEach(function(key) {
|
|
9305
|
+
_define_property$1(target, key, source[key]);
|
|
9306
|
+
});
|
|
9307
|
+
}
|
|
9308
|
+
return target;
|
|
9309
|
+
}
|
|
9310
|
+
function ownKeys$1(object, enumerableOnly) {
|
|
9311
|
+
var keys = Object.keys(object);
|
|
9312
|
+
if (Object.getOwnPropertySymbols) {
|
|
9313
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
9314
|
+
keys.push.apply(keys, symbols);
|
|
9315
|
+
}
|
|
9316
|
+
return keys;
|
|
9317
|
+
}
|
|
9318
|
+
function _object_spread_props$1(target, source) {
|
|
9319
|
+
source = source != null ? source : {};
|
|
9320
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
9321
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
9322
|
+
} else {
|
|
9323
|
+
ownKeys$1(Object(source)).forEach(function(key) {
|
|
9324
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
9325
|
+
});
|
|
9326
|
+
}
|
|
9327
|
+
return target;
|
|
9328
|
+
}
|
|
9329
|
+
function _to_consumable_array$1(arr) {
|
|
9330
|
+
return _array_without_holes$1(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$1(arr) || _non_iterable_spread$1();
|
|
9331
|
+
}
|
|
9332
|
+
function _unsupported_iterable_to_array$1(o, minLen) {
|
|
9333
|
+
if (!o) return;
|
|
9334
|
+
if (typeof o === "string") return _array_like_to_array$1(o, minLen);
|
|
9335
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
9336
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
9337
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
9338
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
|
|
9339
|
+
}
|
|
9340
|
+
function parseTupleDef(def, refs) {
|
|
9341
|
+
if (def.rest) {
|
|
9342
|
+
return {
|
|
9343
|
+
type: "array",
|
|
9344
|
+
minItems: def.items.length,
|
|
9345
|
+
items: def.items.map(function(x, i) {
|
|
9346
|
+
return parseDef(x._def, _object_spread_props$1(_object_spread$1({}, refs), {
|
|
9347
|
+
currentPath: _to_consumable_array$1(refs.currentPath).concat([
|
|
9348
|
+
"items",
|
|
9349
|
+
"".concat(i)
|
|
9350
|
+
])
|
|
9351
|
+
}));
|
|
9352
|
+
}).reduce(function(acc, x) {
|
|
9353
|
+
return x === undefined ? acc : _to_consumable_array$1(acc).concat([
|
|
9354
|
+
x
|
|
9355
|
+
]);
|
|
9356
|
+
}, []),
|
|
9357
|
+
additionalItems: parseDef(def.rest._def, _object_spread_props$1(_object_spread$1({}, refs), {
|
|
9358
|
+
currentPath: _to_consumable_array$1(refs.currentPath).concat([
|
|
9359
|
+
"additionalItems"
|
|
9360
|
+
])
|
|
9361
|
+
}))
|
|
9362
|
+
};
|
|
9363
|
+
} else {
|
|
9364
|
+
return {
|
|
9365
|
+
type: "array",
|
|
9366
|
+
minItems: def.items.length,
|
|
9367
|
+
maxItems: def.items.length,
|
|
9368
|
+
items: def.items.map(function(x, i) {
|
|
9369
|
+
return parseDef(x._def, _object_spread_props$1(_object_spread$1({}, refs), {
|
|
9370
|
+
currentPath: _to_consumable_array$1(refs.currentPath).concat([
|
|
9371
|
+
"items",
|
|
9372
|
+
"".concat(i)
|
|
9373
|
+
])
|
|
9374
|
+
}));
|
|
9375
|
+
}).reduce(function(acc, x) {
|
|
9376
|
+
return x === undefined ? acc : _to_consumable_array$1(acc).concat([
|
|
9377
|
+
x
|
|
9378
|
+
]);
|
|
9379
|
+
}, [])
|
|
9380
|
+
};
|
|
9381
|
+
}
|
|
9382
|
+
}
|
|
9383
|
+
|
|
9384
|
+
function parseUndefinedDef(refs) {
|
|
9385
|
+
return {
|
|
9386
|
+
not: parseAnyDef(refs)
|
|
9387
|
+
};
|
|
9388
|
+
}
|
|
9389
|
+
|
|
9390
|
+
function parseUnknownDef(refs) {
|
|
9391
|
+
return parseAnyDef(refs);
|
|
9392
|
+
}
|
|
9393
|
+
|
|
9394
|
+
var parseReadonlyDef = function(def, refs) {
|
|
9395
|
+
return parseDef(def.innerType._def, refs);
|
|
9396
|
+
};
|
|
9397
|
+
|
|
9398
|
+
var selectParser = function(def, typeName, refs) {
|
|
9399
|
+
switch(typeName){
|
|
9400
|
+
case v3.ZodFirstPartyTypeKind.ZodString:
|
|
9401
|
+
return parseStringDef(def, refs);
|
|
9402
|
+
case v3.ZodFirstPartyTypeKind.ZodNumber:
|
|
9403
|
+
return parseNumberDef(def, refs);
|
|
9404
|
+
case v3.ZodFirstPartyTypeKind.ZodObject:
|
|
9405
|
+
return parseObjectDef(def, refs);
|
|
9406
|
+
case v3.ZodFirstPartyTypeKind.ZodBigInt:
|
|
9407
|
+
return parseBigintDef(def, refs);
|
|
9408
|
+
case v3.ZodFirstPartyTypeKind.ZodBoolean:
|
|
9409
|
+
return parseBooleanDef();
|
|
9410
|
+
case v3.ZodFirstPartyTypeKind.ZodDate:
|
|
9411
|
+
return parseDateDef(def, refs);
|
|
9412
|
+
case v3.ZodFirstPartyTypeKind.ZodUndefined:
|
|
9413
|
+
return parseUndefinedDef(refs);
|
|
9414
|
+
case v3.ZodFirstPartyTypeKind.ZodNull:
|
|
9415
|
+
return parseNullDef(refs);
|
|
9416
|
+
case v3.ZodFirstPartyTypeKind.ZodArray:
|
|
9417
|
+
return parseArrayDef(def, refs);
|
|
9418
|
+
case v3.ZodFirstPartyTypeKind.ZodUnion:
|
|
9419
|
+
case v3.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:
|
|
9420
|
+
return parseUnionDef(def, refs);
|
|
9421
|
+
case v3.ZodFirstPartyTypeKind.ZodIntersection:
|
|
9422
|
+
return parseIntersectionDef(def, refs);
|
|
9423
|
+
case v3.ZodFirstPartyTypeKind.ZodTuple:
|
|
9424
|
+
return parseTupleDef(def, refs);
|
|
9425
|
+
case v3.ZodFirstPartyTypeKind.ZodRecord:
|
|
9426
|
+
return parseRecordDef(def, refs);
|
|
9427
|
+
case v3.ZodFirstPartyTypeKind.ZodLiteral:
|
|
9428
|
+
return parseLiteralDef(def, refs);
|
|
9429
|
+
case v3.ZodFirstPartyTypeKind.ZodEnum:
|
|
9430
|
+
return parseEnumDef(def);
|
|
9431
|
+
case v3.ZodFirstPartyTypeKind.ZodNativeEnum:
|
|
9432
|
+
return parseNativeEnumDef(def);
|
|
9433
|
+
case v3.ZodFirstPartyTypeKind.ZodNullable:
|
|
9434
|
+
return parseNullableDef(def, refs);
|
|
9435
|
+
case v3.ZodFirstPartyTypeKind.ZodOptional:
|
|
9436
|
+
return parseOptionalDef(def, refs);
|
|
9437
|
+
case v3.ZodFirstPartyTypeKind.ZodMap:
|
|
9438
|
+
return parseMapDef(def, refs);
|
|
9439
|
+
case v3.ZodFirstPartyTypeKind.ZodSet:
|
|
9440
|
+
return parseSetDef(def, refs);
|
|
9441
|
+
case v3.ZodFirstPartyTypeKind.ZodLazy:
|
|
9442
|
+
return function() {
|
|
9443
|
+
return def.getter()._def;
|
|
9444
|
+
};
|
|
9445
|
+
case v3.ZodFirstPartyTypeKind.ZodPromise:
|
|
9446
|
+
return parsePromiseDef(def, refs);
|
|
9447
|
+
case v3.ZodFirstPartyTypeKind.ZodNaN:
|
|
9448
|
+
case v3.ZodFirstPartyTypeKind.ZodNever:
|
|
9449
|
+
return parseNeverDef(refs);
|
|
9450
|
+
case v3.ZodFirstPartyTypeKind.ZodEffects:
|
|
9451
|
+
return parseEffectsDef(def, refs);
|
|
9452
|
+
case v3.ZodFirstPartyTypeKind.ZodAny:
|
|
9453
|
+
return parseAnyDef(refs);
|
|
9454
|
+
case v3.ZodFirstPartyTypeKind.ZodUnknown:
|
|
9455
|
+
return parseUnknownDef(refs);
|
|
9456
|
+
case v3.ZodFirstPartyTypeKind.ZodDefault:
|
|
9457
|
+
return parseDefaultDef(def, refs);
|
|
9458
|
+
case v3.ZodFirstPartyTypeKind.ZodBranded:
|
|
9459
|
+
return parseBrandedDef(def, refs);
|
|
9460
|
+
case v3.ZodFirstPartyTypeKind.ZodReadonly:
|
|
9461
|
+
return parseReadonlyDef(def, refs);
|
|
9462
|
+
case v3.ZodFirstPartyTypeKind.ZodCatch:
|
|
9463
|
+
return parseCatchDef(def, refs);
|
|
9464
|
+
case v3.ZodFirstPartyTypeKind.ZodPipeline:
|
|
9465
|
+
return parsePipelineDef(def, refs);
|
|
9466
|
+
case v3.ZodFirstPartyTypeKind.ZodFunction:
|
|
9467
|
+
case v3.ZodFirstPartyTypeKind.ZodVoid:
|
|
9468
|
+
case v3.ZodFirstPartyTypeKind.ZodSymbol:
|
|
9469
|
+
return undefined;
|
|
9470
|
+
default:
|
|
9471
|
+
return function(_) {
|
|
9472
|
+
return undefined;
|
|
9473
|
+
}();
|
|
9474
|
+
}
|
|
9475
|
+
};
|
|
9476
|
+
|
|
9477
|
+
function parseDef(def, refs) {
|
|
9478
|
+
var forceResolution = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
|
|
9479
|
+
var seenItem = refs.seen.get(def);
|
|
9480
|
+
if (refs.override) {
|
|
9481
|
+
var _refs_override;
|
|
9482
|
+
var overrideResult = (_refs_override = refs.override) === null || _refs_override === void 0 ? void 0 : _refs_override.call(refs, def, refs, seenItem, forceResolution);
|
|
9483
|
+
if (overrideResult !== ignoreOverride) {
|
|
9484
|
+
return overrideResult;
|
|
9485
|
+
}
|
|
9486
|
+
}
|
|
9487
|
+
if (seenItem && !forceResolution) {
|
|
9488
|
+
var seenSchema = get$ref(seenItem, refs);
|
|
9489
|
+
if (seenSchema !== undefined) {
|
|
9490
|
+
return seenSchema;
|
|
9491
|
+
}
|
|
9492
|
+
}
|
|
9493
|
+
var newItem = {
|
|
9494
|
+
def: def,
|
|
9495
|
+
path: refs.currentPath,
|
|
9496
|
+
jsonSchema: undefined
|
|
9497
|
+
};
|
|
9498
|
+
refs.seen.set(def, newItem);
|
|
9499
|
+
var jsonSchemaOrGetter = selectParser(def, def.typeName, refs);
|
|
9500
|
+
// If the return was a function, then the inner definition needs to be extracted before a call to parseDef (recursive)
|
|
9501
|
+
var jsonSchema = typeof jsonSchemaOrGetter === "function" ? parseDef(jsonSchemaOrGetter(), refs) : jsonSchemaOrGetter;
|
|
9502
|
+
if (jsonSchema) {
|
|
9503
|
+
addMeta(def, refs, jsonSchema);
|
|
9504
|
+
}
|
|
9505
|
+
if (refs.postProcess) {
|
|
9506
|
+
var postProcessResult = refs.postProcess(jsonSchema, def, refs);
|
|
9507
|
+
newItem.jsonSchema = jsonSchema;
|
|
9508
|
+
return postProcessResult;
|
|
9509
|
+
}
|
|
9510
|
+
newItem.jsonSchema = jsonSchema;
|
|
9511
|
+
return jsonSchema;
|
|
9512
|
+
}
|
|
9513
|
+
var get$ref = function(item, refs) {
|
|
9514
|
+
switch(refs.$refStrategy){
|
|
9515
|
+
case "root":
|
|
9516
|
+
return {
|
|
9517
|
+
$ref: item.path.join("/")
|
|
9518
|
+
};
|
|
9519
|
+
case "relative":
|
|
9520
|
+
return {
|
|
9521
|
+
$ref: getRelativePath(refs.currentPath, item.path)
|
|
9522
|
+
};
|
|
9523
|
+
case "none":
|
|
9524
|
+
case "seen":
|
|
9525
|
+
{
|
|
9526
|
+
if (item.path.length < refs.currentPath.length && item.path.every(function(value, index) {
|
|
9527
|
+
return refs.currentPath[index] === value;
|
|
9528
|
+
})) {
|
|
9529
|
+
console.warn("Recursive reference detected at ".concat(refs.currentPath.join("/"), "! Defaulting to any"));
|
|
9530
|
+
return parseAnyDef(refs);
|
|
9531
|
+
}
|
|
9532
|
+
return refs.$refStrategy === "seen" ? parseAnyDef(refs) : undefined;
|
|
9533
|
+
}
|
|
9534
|
+
}
|
|
9535
|
+
};
|
|
9536
|
+
var addMeta = function(def, refs, jsonSchema) {
|
|
9537
|
+
if (def.description) {
|
|
9538
|
+
jsonSchema.description = def.description;
|
|
9539
|
+
if (refs.markdownDescription) {
|
|
9540
|
+
jsonSchema.markdownDescription = def.description;
|
|
9541
|
+
}
|
|
9542
|
+
}
|
|
9543
|
+
return jsonSchema;
|
|
9544
|
+
};
|
|
9545
|
+
|
|
9546
|
+
function _array_like_to_array(arr, len) {
|
|
9547
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
9548
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
9549
|
+
return arr2;
|
|
9550
|
+
}
|
|
9551
|
+
function _array_without_holes(arr) {
|
|
9552
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
9553
|
+
}
|
|
9554
|
+
function _define_property(obj, key, value) {
|
|
9555
|
+
if (key in obj) {
|
|
9556
|
+
Object.defineProperty(obj, key, {
|
|
9557
|
+
value: value,
|
|
9558
|
+
enumerable: true,
|
|
9559
|
+
configurable: true,
|
|
9560
|
+
writable: true
|
|
9561
|
+
});
|
|
9562
|
+
} else {
|
|
9563
|
+
obj[key] = value;
|
|
9564
|
+
}
|
|
9565
|
+
return obj;
|
|
9566
|
+
}
|
|
9567
|
+
function _iterable_to_array(iter) {
|
|
9568
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
9569
|
+
}
|
|
9570
|
+
function _non_iterable_spread() {
|
|
9571
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
9572
|
+
}
|
|
9573
|
+
function _object_spread(target) {
|
|
9574
|
+
for(var i = 1; i < arguments.length; i++){
|
|
9575
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
9576
|
+
var ownKeys = Object.keys(source);
|
|
9577
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
9578
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
9579
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
9580
|
+
}));
|
|
9581
|
+
}
|
|
9582
|
+
ownKeys.forEach(function(key) {
|
|
9583
|
+
_define_property(target, key, source[key]);
|
|
9584
|
+
});
|
|
9585
|
+
}
|
|
9586
|
+
return target;
|
|
9587
|
+
}
|
|
9588
|
+
function ownKeys(object, enumerableOnly) {
|
|
9589
|
+
var keys = Object.keys(object);
|
|
9590
|
+
if (Object.getOwnPropertySymbols) {
|
|
9591
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
9592
|
+
keys.push.apply(keys, symbols);
|
|
9593
|
+
}
|
|
9594
|
+
return keys;
|
|
9595
|
+
}
|
|
9596
|
+
function _object_spread_props(target, source) {
|
|
9597
|
+
source = source != null ? source : {};
|
|
9598
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
9599
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
9600
|
+
} else {
|
|
9601
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
9602
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
9603
|
+
});
|
|
9604
|
+
}
|
|
9605
|
+
return target;
|
|
9606
|
+
}
|
|
9607
|
+
function _to_consumable_array(arr) {
|
|
9608
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
9609
|
+
}
|
|
9610
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
9611
|
+
if (!o) return;
|
|
9612
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
9613
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
9614
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
9615
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
9616
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
9617
|
+
}
|
|
9618
|
+
var zodToJsonSchema = function(schema, options) {
|
|
9619
|
+
var refs = getRefs(options);
|
|
9620
|
+
var definitions = undefined;
|
|
9621
|
+
var name = void 0 ;
|
|
9622
|
+
var _parseDef;
|
|
9623
|
+
var main = (_parseDef = parseDef(schema._def, refs , false)) !== null && _parseDef !== void 0 ? _parseDef : parseAnyDef(refs);
|
|
9624
|
+
if (refs.flags.hasReferencedOpenAiAnyType) {
|
|
9625
|
+
if (!definitions) {
|
|
9626
|
+
definitions = {};
|
|
9627
|
+
}
|
|
9628
|
+
if (!definitions[refs.openAiAnyTypeName]) {
|
|
9629
|
+
definitions[refs.openAiAnyTypeName] = {
|
|
9630
|
+
// Skipping "object" as no properties can be defined and additionalProperties must be "false"
|
|
9631
|
+
type: [
|
|
9632
|
+
"string",
|
|
9633
|
+
"number",
|
|
9634
|
+
"integer",
|
|
9635
|
+
"boolean",
|
|
9636
|
+
"array",
|
|
9637
|
+
"null"
|
|
9638
|
+
],
|
|
9639
|
+
items: {
|
|
9640
|
+
$ref: refs.$refStrategy === "relative" ? "1" : _to_consumable_array(refs.basePath).concat([
|
|
9641
|
+
refs.definitionPath,
|
|
9642
|
+
refs.openAiAnyTypeName
|
|
9643
|
+
]).join("/")
|
|
9644
|
+
}
|
|
9645
|
+
};
|
|
9646
|
+
}
|
|
9647
|
+
}
|
|
9648
|
+
var combined = name === undefined ? definitions ? _object_spread_props(_object_spread({}, main), _define_property({}, refs.definitionPath, definitions)) : main : _define_property({
|
|
9649
|
+
$ref: _to_consumable_array(refs.$refStrategy === "relative" ? [] : refs.basePath).concat([
|
|
9650
|
+
refs.definitionPath,
|
|
9651
|
+
name
|
|
9652
|
+
]).join("/")
|
|
9653
|
+
}, refs.definitionPath, _object_spread_props(_object_spread({}, definitions), _define_property({}, name, main)));
|
|
9654
|
+
if (refs.target === "jsonSchema7") {
|
|
9655
|
+
combined.$schema = "http://json-schema.org/draft-07/schema#";
|
|
9656
|
+
} else if (refs.target === "jsonSchema2019-09" || refs.target === "openAi") {
|
|
9657
|
+
combined.$schema = "https://json-schema.org/draft/2019-09/schema#";
|
|
9658
|
+
}
|
|
9659
|
+
if (refs.target === "openAi" && ("anyOf" in combined || "oneOf" in combined || "allOf" in combined || "type" in combined && Array.isArray(combined.type))) {
|
|
9660
|
+
console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");
|
|
9661
|
+
}
|
|
9662
|
+
return combined;
|
|
9663
|
+
};
|
|
9664
|
+
|
|
9665
|
+
function runtimeToolProviderComponent(provider) {
|
|
9666
|
+
var _extensions_resources, _extensions_resourceTemplates, _extensions_prompts;
|
|
9667
|
+
const descriptor = describeXpertToolProvider(provider);
|
|
9668
|
+
const options = descriptor.options;
|
|
9669
|
+
const extensions = resolveXpertMcpExtensions(provider, descriptor);
|
|
9670
|
+
// Fingerprint declarations only; never execute resource, prompt or completion handlers.
|
|
9671
|
+
const capabilities = _extends._extends({}, (extensions == null ? void 0 : (_extensions_resources = extensions.resources) == null ? void 0 : _extensions_resources.length) ? {
|
|
9672
|
+
resources: extensions.resources.map((_param)=>{
|
|
9673
|
+
var { read } = _param, definition = _object_without_properties_loose$2(_param, [
|
|
9674
|
+
"read"
|
|
9675
|
+
]);
|
|
9676
|
+
return definition;
|
|
9677
|
+
})
|
|
9678
|
+
} : {}, (extensions == null ? void 0 : (_extensions_resourceTemplates = extensions.resourceTemplates) == null ? void 0 : _extensions_resourceTemplates.length) ? {
|
|
9679
|
+
resourceTemplates: extensions.resourceTemplates.map((_param)=>{
|
|
9680
|
+
var { read, complete } = _param, definition = _object_without_properties_loose$2(_param, [
|
|
9681
|
+
"read",
|
|
9682
|
+
"complete"
|
|
9683
|
+
]);
|
|
9684
|
+
return _extends._extends({}, definition, {
|
|
9685
|
+
supportsCompletion: !!complete
|
|
9686
|
+
});
|
|
9687
|
+
})
|
|
9688
|
+
} : {}, (extensions == null ? void 0 : (_extensions_prompts = extensions.prompts) == null ? void 0 : _extensions_prompts.length) ? {
|
|
9689
|
+
prompts: extensions.prompts.map((_param)=>{
|
|
9690
|
+
var { get, complete } = _param, definition = _object_without_properties_loose$2(_param, [
|
|
9691
|
+
"get",
|
|
9692
|
+
"complete"
|
|
9693
|
+
]);
|
|
9694
|
+
return _extends._extends({}, definition, {
|
|
9695
|
+
hasCompletionHandler: !!complete
|
|
9696
|
+
});
|
|
9697
|
+
})
|
|
9698
|
+
} : {});
|
|
9699
|
+
const tools = descriptor.tools.map((tool)=>{
|
|
9700
|
+
var _tool_options_title, _tool_middlewareProvider, _tool_options_mcp_visibility;
|
|
9701
|
+
return {
|
|
9702
|
+
name: tool.options.name,
|
|
9703
|
+
title: (_tool_options_title = tool.options.title) != null ? _tool_options_title : null,
|
|
9704
|
+
description: tool.options.description,
|
|
9705
|
+
middleware: (_tool_middlewareProvider = tool.middlewareProvider) != null ? _tool_middlewareProvider : null,
|
|
9706
|
+
mcp: tool.options.mcp ? _extends._extends({}, tool.options.mcp.inputSchema ? {
|
|
9707
|
+
transportInputSchema: JSON.parse(JSON.stringify(zodToJsonSchema(tool.options.mcp.inputSchema)))
|
|
9708
|
+
} : {}, tool.options.mcp.task ? {
|
|
9709
|
+
task: tool.options.mcp.task
|
|
9710
|
+
} : {}, {
|
|
9711
|
+
behavior: tool.options.mcp.behavior,
|
|
9712
|
+
requiredContext: [
|
|
9713
|
+
...tool.options.mcp.requiredContext
|
|
9714
|
+
],
|
|
9715
|
+
visibility: [
|
|
9716
|
+
...(_tool_options_mcp_visibility = tool.options.mcp.visibility) != null ? _tool_options_mcp_visibility : [
|
|
9717
|
+
'model'
|
|
9718
|
+
]
|
|
9719
|
+
],
|
|
9720
|
+
inputSchema: JSON.parse(JSON.stringify(zodToJsonSchema(tool.options.inputSchema))),
|
|
9721
|
+
outputSchema: tool.options.outputSchema ? JSON.parse(JSON.stringify(zodToJsonSchema(tool.options.outputSchema))) : null
|
|
9722
|
+
}) : null
|
|
9723
|
+
};
|
|
9724
|
+
});
|
|
9725
|
+
var _options_description, _options_instructions;
|
|
9726
|
+
const config = {
|
|
9727
|
+
provider: options.provider,
|
|
9728
|
+
name: options.name,
|
|
9729
|
+
description: (_options_description = options.description) != null ? _options_description : null,
|
|
9730
|
+
instructions: (_options_instructions = options.instructions) != null ? _options_instructions : null,
|
|
9731
|
+
runtimeDiscovered: true,
|
|
9732
|
+
nativeMcp: true,
|
|
9733
|
+
toolCount: tools.filter((tool)=>!!tool.mcp).length
|
|
9734
|
+
};
|
|
9735
|
+
const metadata = {
|
|
9736
|
+
runtimeDiscovered: true,
|
|
9737
|
+
nativeMcp: true,
|
|
9738
|
+
toolNames: tools.filter((tool)=>!!tool.mcp).map((tool)=>tool.name)
|
|
9739
|
+
};
|
|
9740
|
+
return {
|
|
9741
|
+
componentType: contracts.PLUGIN_COMPONENT_TYPE.TOOLSET,
|
|
9742
|
+
componentKey: options.componentKey,
|
|
9743
|
+
config,
|
|
9744
|
+
metadata,
|
|
9745
|
+
definitionHash: node_crypto.createHash('sha256').update(stableJson(_extends._extends({
|
|
9746
|
+
config,
|
|
9747
|
+
metadata,
|
|
9748
|
+
tools
|
|
9749
|
+
}, capabilities))).digest('hex')
|
|
9750
|
+
};
|
|
9751
|
+
}
|
|
9752
|
+
function stableJson(value) {
|
|
9753
|
+
if (value === undefined) return 'null';
|
|
9754
|
+
if (value === null || typeof value !== 'object') return JSON.stringify(value);
|
|
9755
|
+
if (Array.isArray(value)) return `[${value.map((item)=>stableJson(item)).join(',')}]`;
|
|
9756
|
+
const entries = Object.entries(value).sort(([left], [right])=>left.localeCompare(right));
|
|
9757
|
+
return `{${entries.map(([key, item])=>`${JSON.stringify(key)}:${stableJson(item)}`).join(',')}}`;
|
|
9758
|
+
}
|
|
9759
|
+
|
|
6690
9760
|
Object.defineProperty(exports, "ASSISTANT_CHAT_SEND_MESSAGE_COMMAND", {
|
|
6691
9761
|
enumerable: true,
|
|
6692
9762
|
get: function () { return contracts.ASSISTANT_CHAT_SEND_MESSAGE_COMMAND; }
|
|
@@ -6705,12 +9775,15 @@ exports.DefaultAgentMiddlewareRuntimeCapabilityRegistry = modelProvider.DefaultR
|
|
|
6705
9775
|
exports.DefaultRuntimeCapabilityRegistry = modelProvider.DefaultRuntimeCapabilityRegistry;
|
|
6706
9776
|
exports.KnowledgeDocumentVisualAssetsRuntimeCapability = modelProvider.KnowledgeDocumentVisualAssetsRuntimeCapability;
|
|
6707
9777
|
exports.KnowledgeDocumentVisualAssetsRuntimeFactoryCapability = modelProvider.KnowledgeDocumentVisualAssetsRuntimeFactoryCapability;
|
|
9778
|
+
exports.KnowledgeGraphRuntimeCapability = modelProvider.KnowledgeGraphRuntimeCapability;
|
|
6708
9779
|
exports.KnowledgebaseDocumentsRuntimeCapability = modelProvider.KnowledgebaseDocumentsRuntimeCapability;
|
|
6709
9780
|
exports.KnowledgebaseProvisioningRuntimeCapability = modelProvider.KnowledgebaseProvisioningRuntimeCapability;
|
|
6710
9781
|
exports.KnowledgebaseRuntimeCapability = modelProvider.KnowledgebaseRuntimeCapability;
|
|
6711
9782
|
exports.ModelProviderBuiltinToolset = modelProvider.ModelProviderBuiltinToolset;
|
|
6712
9783
|
exports.ProjectAccessRuntimeCapability = modelProvider.ProjectAccessRuntimeCapability;
|
|
6713
9784
|
exports.ProjectProvisioningRuntimeCapability = modelProvider.ProjectProvisioningRuntimeCapability;
|
|
9785
|
+
exports.RUNTIME_CAPABILITY_PROVIDER = modelProvider.RUNTIME_CAPABILITY_PROVIDER;
|
|
9786
|
+
exports.RuntimeCapabilityProvider = modelProvider.RuntimeCapabilityProvider;
|
|
6714
9787
|
exports.SANDBOX_JOB_ERROR_CODES = modelProvider.SANDBOX_JOB_ERROR_CODES;
|
|
6715
9788
|
exports.SANDBOX_JOB_PROGRESS_PREFIX = modelProvider.SANDBOX_JOB_PROGRESS_PREFIX;
|
|
6716
9789
|
exports.SandboxJobRuntimeError = modelProvider.SandboxJobRuntimeError;
|
|
@@ -6720,6 +9793,11 @@ exports.WorkspaceFilesRuntimeCapability = modelProvider.WorkspaceFilesRuntimeCap
|
|
|
6720
9793
|
exports.XPERT_RUNTIME_CAPABILITIES_TOKEN = modelProvider.XPERT_RUNTIME_CAPABILITIES_TOKEN;
|
|
6721
9794
|
exports.createRuntimeCapability = modelProvider.createRuntimeCapability;
|
|
6722
9795
|
exports.isSandboxJobRuntimeError = modelProvider.isSandboxJobRuntimeError;
|
|
9796
|
+
exports.DataSourceRuntimeCapability = dataWorkbench.DataSourceRuntimeCapability;
|
|
9797
|
+
exports.SqlDatabaseWorkbenchAdapter = dataWorkbench.SqlDatabaseWorkbenchAdapter;
|
|
9798
|
+
exports.quoteDatabaseIdentifier = dataWorkbench.quoteDatabaseIdentifier;
|
|
9799
|
+
exports.requireReadStatement = dataWorkbench.requireReadStatement;
|
|
9800
|
+
exports.splitWorkbenchSql = dataWorkbench.splitWorkbenchSql;
|
|
6723
9801
|
exports.ModelProviderHttpClient = modelProviderHttpClient.ModelProviderHttpClient;
|
|
6724
9802
|
exports.ModelProviderHttpError = modelProviderHttpClient.ModelProviderHttpError;
|
|
6725
9803
|
exports.CONNECTOR_AUTHORIZATION_MODES = connector.CONNECTOR_AUTHORIZATION_MODES;
|
|
@@ -6809,7 +9887,9 @@ exports.ImageUnderstandingStrategy = ImageUnderstandingStrategy;
|
|
|
6809
9887
|
exports.IntegrationStrategyKey = IntegrationStrategyKey;
|
|
6810
9888
|
exports.JUMP_TO_TARGETS = JUMP_TO_TARGETS;
|
|
6811
9889
|
exports.JsonSchemaValidator = JsonSchemaValidator;
|
|
9890
|
+
exports.KEYWORD_ANALYZER_STRATEGY = KEYWORD_ANALYZER_STRATEGY;
|
|
6812
9891
|
exports.KNOWLEDGE_STRATEGY = KNOWLEDGE_STRATEGY;
|
|
9892
|
+
exports.KeywordAnalyzerStrategy = KeywordAnalyzerStrategy;
|
|
6813
9893
|
exports.KnowledgeStrategyKey = KnowledgeStrategyKey;
|
|
6814
9894
|
exports.LLMUsage = LLMUsage;
|
|
6815
9895
|
exports.LargeLanguageModel = LargeLanguageModel;
|
|
@@ -6889,6 +9969,9 @@ exports.XPERT_TOOL_PROVIDER = XPERT_TOOL_PROVIDER;
|
|
|
6889
9969
|
exports.XPERT_TOOL_PROVIDER_METADATA = XPERT_TOOL_PROVIDER_METADATA;
|
|
6890
9970
|
exports.XPERT_TOOL_RESULT_FORMAT_VERSION = XPERT_TOOL_RESULT_FORMAT_VERSION;
|
|
6891
9971
|
exports.XpFileSystem = XpFileSystem;
|
|
9972
|
+
exports.XpertPrompt = XpertPrompt;
|
|
9973
|
+
exports.XpertResource = XpertResource;
|
|
9974
|
+
exports.XpertResourceTemplate = XpertResourceTemplate;
|
|
6892
9975
|
exports.XpertServerPlugin = XpertServerPlugin;
|
|
6893
9976
|
exports.XpertTool = XpertTool;
|
|
6894
9977
|
exports.XpertToolProvider = XpertToolProvider;
|
|
@@ -6956,7 +10039,9 @@ exports.resolveSandboxTerminalAdapter = resolveSandboxTerminalAdapter;
|
|
|
6956
10039
|
exports.resolveStrategyMetadataTarget = resolveStrategyMetadataTarget;
|
|
6957
10040
|
exports.resolveTenantGlobalScopeKey = resolveTenantGlobalScopeKey;
|
|
6958
10041
|
exports.resolveTokenUsage = resolveTokenUsage;
|
|
10042
|
+
exports.resolveXpertMcpExtensions = resolveXpertMcpExtensions;
|
|
6959
10043
|
exports.runWithRequestContext = runWithRequestContext;
|
|
10044
|
+
exports.runtimeToolProviderComponent = runtimeToolProviderComponent;
|
|
6960
10045
|
exports.secondsToMilliseconds = secondsToMilliseconds;
|
|
6961
10046
|
exports.setDefaultTenantId = setDefaultTenantId;
|
|
6962
10047
|
exports.sumTokenUsage = sumTokenUsage;
|