@anvailabs/agentbrowser-mcp 1.8.16 → 1.8.17
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/dist/bin.js +2070 -312
- package/dist/index.js +2060 -310
- package/dist/mcp-server.d.ts +1 -0
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +33 -3
- package/dist/mcp-server.js.map +1 -1
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -119,12 +119,24 @@ function IsAsyncIterator2(value) {
|
|
|
119
119
|
function IsIterator2(value) {
|
|
120
120
|
return IsObject2(value) && globalThis.Symbol.iterator in value;
|
|
121
121
|
}
|
|
122
|
+
function IsStandardObject(value) {
|
|
123
|
+
return IsObject2(value) && (globalThis.Object.getPrototypeOf(value) === Object.prototype || globalThis.Object.getPrototypeOf(value) === null);
|
|
124
|
+
}
|
|
122
125
|
function IsPromise(value) {
|
|
123
126
|
return value instanceof globalThis.Promise;
|
|
124
127
|
}
|
|
125
128
|
function IsDate2(value) {
|
|
126
129
|
return value instanceof Date && globalThis.Number.isFinite(value.getTime());
|
|
127
130
|
}
|
|
131
|
+
function IsMap(value) {
|
|
132
|
+
return value instanceof globalThis.Map;
|
|
133
|
+
}
|
|
134
|
+
function IsSet(value) {
|
|
135
|
+
return value instanceof globalThis.Set;
|
|
136
|
+
}
|
|
137
|
+
function IsTypedArray(value) {
|
|
138
|
+
return globalThis.ArrayBuffer.isView(value);
|
|
139
|
+
}
|
|
128
140
|
function IsUint8Array2(value) {
|
|
129
141
|
return value instanceof globalThis.Uint8Array;
|
|
130
142
|
}
|
|
@@ -2647,9 +2659,9 @@ var TransformEncodeBuilder = class {
|
|
|
2647
2659
|
this.decode = decode;
|
|
2648
2660
|
}
|
|
2649
2661
|
EncodeTransform(encode, schema) {
|
|
2650
|
-
const
|
|
2651
|
-
const
|
|
2652
|
-
const Codec = { Encode, Decode };
|
|
2662
|
+
const Encode2 = (value) => schema[TransformKind].Encode(encode(value));
|
|
2663
|
+
const Decode2 = (value) => this.decode(schema[TransformKind].Decode(value));
|
|
2664
|
+
const Codec = { Encode: Encode2, Decode: Decode2 };
|
|
2653
2665
|
return { ...schema, [TransformKind]: Codec };
|
|
2654
2666
|
}
|
|
2655
2667
|
EncodeSchema(encode, schema) {
|
|
@@ -4032,202 +4044,1226 @@ function Errors(...args) {
|
|
|
4032
4044
|
return new ValueErrorIterator(iterator);
|
|
4033
4045
|
}
|
|
4034
4046
|
|
|
4035
|
-
// ../../node_modules/.pnpm/@sinclair+typebox@0.34.52/node_modules/@sinclair/typebox/build/esm/value/
|
|
4036
|
-
var
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4047
|
+
// ../../node_modules/.pnpm/@sinclair+typebox@0.34.52/node_modules/@sinclair/typebox/build/esm/value/assert/assert.mjs
|
|
4048
|
+
var __classPrivateFieldSet = function(receiver, state, value, kind, f) {
|
|
4049
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4050
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4051
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
4052
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
4053
|
+
};
|
|
4054
|
+
var __classPrivateFieldGet = function(receiver, state, kind, f) {
|
|
4055
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
4056
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4057
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
4058
|
+
};
|
|
4059
|
+
var _AssertError_instances;
|
|
4060
|
+
var _AssertError_iterator;
|
|
4061
|
+
var _AssertError_Iterator;
|
|
4062
|
+
var AssertError = class extends TypeBoxError {
|
|
4063
|
+
constructor(iterator) {
|
|
4064
|
+
const error2 = iterator.First();
|
|
4065
|
+
super(error2 === void 0 ? "Invalid Value" : error2.message);
|
|
4066
|
+
_AssertError_instances.add(this);
|
|
4067
|
+
_AssertError_iterator.set(this, void 0);
|
|
4068
|
+
__classPrivateFieldSet(this, _AssertError_iterator, iterator, "f");
|
|
4041
4069
|
this.error = error2;
|
|
4042
4070
|
}
|
|
4071
|
+
/** Returns an iterator for each error in this value. */
|
|
4072
|
+
Errors() {
|
|
4073
|
+
return new ValueErrorIterator(__classPrivateFieldGet(this, _AssertError_instances, "m", _AssertError_Iterator).call(this));
|
|
4074
|
+
}
|
|
4043
4075
|
};
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4076
|
+
_AssertError_iterator = /* @__PURE__ */ new WeakMap(), _AssertError_instances = /* @__PURE__ */ new WeakSet(), _AssertError_Iterator = function* _AssertError_Iterator2() {
|
|
4077
|
+
if (this.error)
|
|
4078
|
+
yield this.error;
|
|
4079
|
+
yield* __classPrivateFieldGet(this, _AssertError_iterator, "f");
|
|
4080
|
+
};
|
|
4081
|
+
function AssertValue(schema, references, value) {
|
|
4082
|
+
if (Check(schema, references, value))
|
|
4083
|
+
return;
|
|
4084
|
+
throw new AssertError(Errors(schema, references, value));
|
|
4085
|
+
}
|
|
4086
|
+
function Assert(...args) {
|
|
4087
|
+
return args.length === 3 ? AssertValue(args[0], args[1], args[2]) : AssertValue(args[0], [], args[1]);
|
|
4088
|
+
}
|
|
4089
|
+
|
|
4090
|
+
// ../../node_modules/.pnpm/@sinclair+typebox@0.34.52/node_modules/@sinclair/typebox/build/esm/value/clone/clone.mjs
|
|
4091
|
+
function FromObject10(value) {
|
|
4092
|
+
const Acc = {};
|
|
4093
|
+
for (const key of Object.getOwnPropertyNames(value)) {
|
|
4094
|
+
Acc[key] = Clone2(value[key]);
|
|
4095
|
+
}
|
|
4096
|
+
for (const key of Object.getOwnPropertySymbols(value)) {
|
|
4097
|
+
Acc[key] = Clone2(value[key]);
|
|
4098
|
+
}
|
|
4099
|
+
return Acc;
|
|
4100
|
+
}
|
|
4101
|
+
function FromArray9(value) {
|
|
4102
|
+
return value.map((element) => Clone2(element));
|
|
4103
|
+
}
|
|
4104
|
+
function FromTypedArray(value) {
|
|
4105
|
+
return value.slice();
|
|
4106
|
+
}
|
|
4107
|
+
function FromMap(value) {
|
|
4108
|
+
return new Map(Clone2([...value.entries()]));
|
|
4109
|
+
}
|
|
4110
|
+
function FromSet(value) {
|
|
4111
|
+
return new Set(Clone2([...value.entries()]));
|
|
4112
|
+
}
|
|
4113
|
+
function FromDate4(value) {
|
|
4114
|
+
return new Date(value.toISOString());
|
|
4115
|
+
}
|
|
4116
|
+
function FromValue2(value) {
|
|
4117
|
+
return value;
|
|
4118
|
+
}
|
|
4119
|
+
function Clone2(value) {
|
|
4120
|
+
if (IsArray2(value))
|
|
4121
|
+
return FromArray9(value);
|
|
4122
|
+
if (IsDate2(value))
|
|
4123
|
+
return FromDate4(value);
|
|
4124
|
+
if (IsTypedArray(value))
|
|
4125
|
+
return FromTypedArray(value);
|
|
4126
|
+
if (IsMap(value))
|
|
4127
|
+
return FromMap(value);
|
|
4128
|
+
if (IsSet(value))
|
|
4129
|
+
return FromSet(value);
|
|
4130
|
+
if (IsObject2(value))
|
|
4131
|
+
return FromObject10(value);
|
|
4132
|
+
if (IsValueType(value))
|
|
4133
|
+
return FromValue2(value);
|
|
4134
|
+
throw new Error("ValueClone: Unable to clone value");
|
|
4135
|
+
}
|
|
4136
|
+
|
|
4137
|
+
// ../../node_modules/.pnpm/@sinclair+typebox@0.34.52/node_modules/@sinclair/typebox/build/esm/value/create/create.mjs
|
|
4138
|
+
var ValueCreateError = class extends TypeBoxError {
|
|
4139
|
+
constructor(schema, message) {
|
|
4140
|
+
super(message);
|
|
4047
4141
|
this.schema = schema;
|
|
4048
|
-
this.path = path;
|
|
4049
|
-
this.value = value;
|
|
4050
|
-
this.error = error2;
|
|
4051
4142
|
}
|
|
4052
4143
|
};
|
|
4053
|
-
function
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4144
|
+
function FromDefault(value) {
|
|
4145
|
+
return IsFunction2(value) ? value() : Clone2(value);
|
|
4146
|
+
}
|
|
4147
|
+
function FromAny4(schema, references) {
|
|
4148
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
4149
|
+
return FromDefault(schema.default);
|
|
4150
|
+
} else {
|
|
4151
|
+
return {};
|
|
4152
|
+
}
|
|
4153
|
+
}
|
|
4154
|
+
function FromArgument4(schema, references) {
|
|
4155
|
+
return {};
|
|
4156
|
+
}
|
|
4157
|
+
function FromArray10(schema, references) {
|
|
4158
|
+
if (schema.uniqueItems === true && !HasPropertyKey2(schema, "default")) {
|
|
4159
|
+
throw new ValueCreateError(schema, "Array with the uniqueItems constraint requires a default value");
|
|
4160
|
+
} else if ("contains" in schema && !HasPropertyKey2(schema, "default")) {
|
|
4161
|
+
throw new ValueCreateError(schema, "Array with the contains constraint requires a default value");
|
|
4162
|
+
} else if ("default" in schema) {
|
|
4163
|
+
return FromDefault(schema.default);
|
|
4164
|
+
} else if (schema.minItems !== void 0) {
|
|
4165
|
+
return Array.from({ length: schema.minItems }).map((item) => {
|
|
4166
|
+
return Visit7(schema.items, references);
|
|
4167
|
+
});
|
|
4168
|
+
} else {
|
|
4169
|
+
return [];
|
|
4058
4170
|
}
|
|
4059
4171
|
}
|
|
4060
|
-
function
|
|
4061
|
-
|
|
4172
|
+
function FromAsyncIterator6(schema, references) {
|
|
4173
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
4174
|
+
return FromDefault(schema.default);
|
|
4175
|
+
} else {
|
|
4176
|
+
return (async function* () {
|
|
4177
|
+
})();
|
|
4178
|
+
}
|
|
4062
4179
|
}
|
|
4063
|
-
function
|
|
4064
|
-
if (
|
|
4065
|
-
return
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
const knownProperties = { ...value };
|
|
4069
|
-
for (const [knownKey, knownSchema] of knownEntries)
|
|
4070
|
-
if (knownKey in knownProperties) {
|
|
4071
|
-
knownProperties[knownKey] = Visit7(knownSchema, references, `${path}/${knownKey}`, knownProperties[knownKey]);
|
|
4072
|
-
}
|
|
4073
|
-
if (!IsTransform(schema.unevaluatedProperties)) {
|
|
4074
|
-
return Default(schema, path, knownProperties);
|
|
4180
|
+
function FromBigInt4(schema, references) {
|
|
4181
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
4182
|
+
return FromDefault(schema.default);
|
|
4183
|
+
} else {
|
|
4184
|
+
return BigInt(0);
|
|
4075
4185
|
}
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4186
|
+
}
|
|
4187
|
+
function FromBoolean4(schema, references) {
|
|
4188
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
4189
|
+
return FromDefault(schema.default);
|
|
4190
|
+
} else {
|
|
4191
|
+
return false;
|
|
4192
|
+
}
|
|
4193
|
+
}
|
|
4194
|
+
function FromConstructor6(schema, references) {
|
|
4195
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
4196
|
+
return FromDefault(schema.default);
|
|
4197
|
+
} else {
|
|
4198
|
+
const value = Visit7(schema.returns, references);
|
|
4199
|
+
if (typeof value === "object" && !Array.isArray(value)) {
|
|
4200
|
+
return class {
|
|
4201
|
+
constructor() {
|
|
4202
|
+
for (const [key, val] of Object.entries(value)) {
|
|
4203
|
+
const self = this;
|
|
4204
|
+
self[key] = val;
|
|
4205
|
+
}
|
|
4206
|
+
}
|
|
4207
|
+
};
|
|
4208
|
+
} else {
|
|
4209
|
+
return class {
|
|
4210
|
+
};
|
|
4082
4211
|
}
|
|
4083
|
-
|
|
4212
|
+
}
|
|
4084
4213
|
}
|
|
4085
|
-
function
|
|
4086
|
-
|
|
4214
|
+
function FromDate5(schema, references) {
|
|
4215
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
4216
|
+
return FromDefault(schema.default);
|
|
4217
|
+
} else if (schema.minimumTimestamp !== void 0) {
|
|
4218
|
+
return new Date(schema.minimumTimestamp);
|
|
4219
|
+
} else {
|
|
4220
|
+
return /* @__PURE__ */ new Date();
|
|
4221
|
+
}
|
|
4222
|
+
}
|
|
4223
|
+
function FromFunction6(schema, references) {
|
|
4224
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
4225
|
+
return FromDefault(schema.default);
|
|
4226
|
+
} else {
|
|
4227
|
+
return () => Visit7(schema.returns, references);
|
|
4228
|
+
}
|
|
4229
|
+
}
|
|
4230
|
+
function FromImport3(schema, references) {
|
|
4231
|
+
const definitions = globalThis.Object.values(schema.$defs);
|
|
4087
4232
|
const target = schema.$defs[schema.$ref];
|
|
4088
|
-
|
|
4089
|
-
|
|
4233
|
+
return Visit7(target, [...references, ...definitions]);
|
|
4234
|
+
}
|
|
4235
|
+
function FromInteger4(schema, references) {
|
|
4236
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
4237
|
+
return FromDefault(schema.default);
|
|
4238
|
+
} else if (schema.minimum !== void 0) {
|
|
4239
|
+
return schema.minimum;
|
|
4240
|
+
} else {
|
|
4241
|
+
return 0;
|
|
4242
|
+
}
|
|
4090
4243
|
}
|
|
4091
|
-
function
|
|
4092
|
-
|
|
4244
|
+
function FromIntersect11(schema, references) {
|
|
4245
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
4246
|
+
return FromDefault(schema.default);
|
|
4247
|
+
} else {
|
|
4248
|
+
const value = schema.allOf.reduce((acc, schema2) => {
|
|
4249
|
+
const next = Visit7(schema2, references);
|
|
4250
|
+
return typeof next === "object" ? { ...acc, ...next } : next;
|
|
4251
|
+
}, {});
|
|
4252
|
+
if (!Check(schema, references, value))
|
|
4253
|
+
throw new ValueCreateError(schema, "Intersect produced invalid value. Consider using a default value.");
|
|
4254
|
+
return value;
|
|
4255
|
+
}
|
|
4093
4256
|
}
|
|
4094
|
-
function
|
|
4095
|
-
if (
|
|
4096
|
-
return
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
if (!HasPropertyKey2(knownProperties, key))
|
|
4101
|
-
continue;
|
|
4102
|
-
if (IsUndefined2(knownProperties[key]) && (!IsUndefined3(schema.properties[key]) || TypeSystemPolicy.IsExactOptionalProperty(knownProperties, key)))
|
|
4103
|
-
continue;
|
|
4104
|
-
knownProperties[key] = Visit7(schema.properties[key], references, `${path}/${key}`, knownProperties[key]);
|
|
4257
|
+
function FromIterator6(schema, references) {
|
|
4258
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
4259
|
+
return FromDefault(schema.default);
|
|
4260
|
+
} else {
|
|
4261
|
+
return (function* () {
|
|
4262
|
+
})();
|
|
4105
4263
|
}
|
|
4106
|
-
|
|
4107
|
-
|
|
4264
|
+
}
|
|
4265
|
+
function FromLiteral5(schema, references) {
|
|
4266
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
4267
|
+
return FromDefault(schema.default);
|
|
4268
|
+
} else {
|
|
4269
|
+
return schema.const;
|
|
4108
4270
|
}
|
|
4109
|
-
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
4110
|
-
const additionalProperties = schema.additionalProperties;
|
|
4111
|
-
const unknownProperties = { ...knownProperties };
|
|
4112
|
-
for (const key of unknownKeys)
|
|
4113
|
-
if (!knownKeys.includes(key)) {
|
|
4114
|
-
unknownProperties[key] = Default(additionalProperties, `${path}/${key}`, unknownProperties[key]);
|
|
4115
|
-
}
|
|
4116
|
-
return Default(schema, path, unknownProperties);
|
|
4117
4271
|
}
|
|
4118
|
-
function
|
|
4119
|
-
if (
|
|
4120
|
-
return
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4272
|
+
function FromNever4(schema, references) {
|
|
4273
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
4274
|
+
return FromDefault(schema.default);
|
|
4275
|
+
} else {
|
|
4276
|
+
throw new ValueCreateError(schema, "Never types cannot be created. Consider using a default value.");
|
|
4277
|
+
}
|
|
4278
|
+
}
|
|
4279
|
+
function FromNot4(schema, references) {
|
|
4280
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
4281
|
+
return FromDefault(schema.default);
|
|
4282
|
+
} else {
|
|
4283
|
+
throw new ValueCreateError(schema, "Not types must have a default value");
|
|
4284
|
+
}
|
|
4285
|
+
}
|
|
4286
|
+
function FromNull4(schema, references) {
|
|
4287
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
4288
|
+
return FromDefault(schema.default);
|
|
4289
|
+
} else {
|
|
4290
|
+
return null;
|
|
4291
|
+
}
|
|
4292
|
+
}
|
|
4293
|
+
function FromNumber4(schema, references) {
|
|
4294
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
4295
|
+
return FromDefault(schema.default);
|
|
4296
|
+
} else if (schema.minimum !== void 0) {
|
|
4297
|
+
return schema.minimum;
|
|
4298
|
+
} else {
|
|
4299
|
+
return 0;
|
|
4300
|
+
}
|
|
4301
|
+
}
|
|
4302
|
+
function FromObject11(schema, references) {
|
|
4303
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
4304
|
+
return FromDefault(schema.default);
|
|
4305
|
+
} else {
|
|
4306
|
+
const required = new Set(schema.required);
|
|
4307
|
+
const Acc = {};
|
|
4308
|
+
for (const [key, subschema] of Object.entries(schema.properties)) {
|
|
4309
|
+
if (!required.has(key))
|
|
4310
|
+
continue;
|
|
4311
|
+
Acc[key] = Visit7(subschema, references);
|
|
4127
4312
|
}
|
|
4128
|
-
|
|
4129
|
-
return Default(schema, path, knownProperties);
|
|
4313
|
+
return Acc;
|
|
4130
4314
|
}
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4315
|
+
}
|
|
4316
|
+
function FromPromise6(schema, references) {
|
|
4317
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
4318
|
+
return FromDefault(schema.default);
|
|
4319
|
+
} else {
|
|
4320
|
+
return Promise.resolve(Visit7(schema.item, references));
|
|
4321
|
+
}
|
|
4322
|
+
}
|
|
4323
|
+
function FromRecord6(schema, references) {
|
|
4324
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
4325
|
+
return FromDefault(schema.default);
|
|
4326
|
+
} else {
|
|
4327
|
+
return {};
|
|
4328
|
+
}
|
|
4329
|
+
}
|
|
4330
|
+
function FromRef7(schema, references) {
|
|
4331
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
4332
|
+
return FromDefault(schema.default);
|
|
4333
|
+
} else {
|
|
4334
|
+
return Visit7(Deref(schema, references), references);
|
|
4335
|
+
}
|
|
4336
|
+
}
|
|
4337
|
+
function FromRegExp4(schema, references) {
|
|
4338
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
4339
|
+
return FromDefault(schema.default);
|
|
4340
|
+
} else {
|
|
4341
|
+
throw new ValueCreateError(schema, "RegExp types cannot be created. Consider using a default value.");
|
|
4342
|
+
}
|
|
4343
|
+
}
|
|
4344
|
+
function FromString4(schema, references) {
|
|
4345
|
+
if (schema.pattern !== void 0) {
|
|
4346
|
+
if (!HasPropertyKey2(schema, "default")) {
|
|
4347
|
+
throw new ValueCreateError(schema, "String types with patterns must specify a default value");
|
|
4348
|
+
} else {
|
|
4349
|
+
return FromDefault(schema.default);
|
|
4350
|
+
}
|
|
4351
|
+
} else if (schema.format !== void 0) {
|
|
4352
|
+
if (!HasPropertyKey2(schema, "default")) {
|
|
4353
|
+
throw new ValueCreateError(schema, "String types with formats must specify a default value");
|
|
4354
|
+
} else {
|
|
4355
|
+
return FromDefault(schema.default);
|
|
4137
4356
|
}
|
|
4138
|
-
|
|
4357
|
+
} else {
|
|
4358
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
4359
|
+
return FromDefault(schema.default);
|
|
4360
|
+
} else if (schema.minLength !== void 0) {
|
|
4361
|
+
return Array.from({ length: schema.minLength }).map(() => " ").join("");
|
|
4362
|
+
} else {
|
|
4363
|
+
return "";
|
|
4364
|
+
}
|
|
4365
|
+
}
|
|
4139
4366
|
}
|
|
4140
|
-
function
|
|
4141
|
-
|
|
4142
|
-
|
|
4367
|
+
function FromSymbol4(schema, references) {
|
|
4368
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
4369
|
+
return FromDefault(schema.default);
|
|
4370
|
+
} else if ("value" in schema) {
|
|
4371
|
+
return Symbol.for(schema.value);
|
|
4372
|
+
} else {
|
|
4373
|
+
return /* @__PURE__ */ Symbol();
|
|
4374
|
+
}
|
|
4143
4375
|
}
|
|
4144
|
-
function
|
|
4145
|
-
|
|
4146
|
-
|
|
4376
|
+
function FromTemplateLiteral6(schema, references) {
|
|
4377
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
4378
|
+
return FromDefault(schema.default);
|
|
4379
|
+
}
|
|
4380
|
+
if (!IsTemplateLiteralFinite(schema))
|
|
4381
|
+
throw new ValueCreateError(schema, "Can only create template literals that produce a finite variants. Consider using a default value.");
|
|
4382
|
+
const generated = TemplateLiteralGenerate(schema);
|
|
4383
|
+
return generated[0];
|
|
4147
4384
|
}
|
|
4148
|
-
function
|
|
4149
|
-
|
|
4385
|
+
function FromThis3(schema, references) {
|
|
4386
|
+
if (recursiveDepth++ > recursiveMaxDepth)
|
|
4387
|
+
throw new ValueCreateError(schema, "Cannot create recursive type as it appears possibly infinite. Consider using a default.");
|
|
4388
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
4389
|
+
return FromDefault(schema.default);
|
|
4390
|
+
} else {
|
|
4391
|
+
return Visit7(Deref(schema, references), references);
|
|
4392
|
+
}
|
|
4150
4393
|
}
|
|
4151
|
-
function
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
return
|
|
4394
|
+
function FromTuple8(schema, references) {
|
|
4395
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
4396
|
+
return FromDefault(schema.default);
|
|
4397
|
+
}
|
|
4398
|
+
if (schema.items === void 0) {
|
|
4399
|
+
return [];
|
|
4400
|
+
} else {
|
|
4401
|
+
return Array.from({ length: schema.minItems }).map((_, index) => Visit7(schema.items[index], references));
|
|
4402
|
+
}
|
|
4403
|
+
}
|
|
4404
|
+
function FromUndefined4(schema, references) {
|
|
4405
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
4406
|
+
return FromDefault(schema.default);
|
|
4407
|
+
} else {
|
|
4408
|
+
return void 0;
|
|
4409
|
+
}
|
|
4410
|
+
}
|
|
4411
|
+
function FromUnion13(schema, references) {
|
|
4412
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
4413
|
+
return FromDefault(schema.default);
|
|
4414
|
+
} else if (schema.anyOf.length === 0) {
|
|
4415
|
+
throw new Error("ValueCreate.Union: Cannot create Union with zero variants");
|
|
4416
|
+
} else {
|
|
4417
|
+
return Visit7(schema.anyOf[0], references);
|
|
4418
|
+
}
|
|
4419
|
+
}
|
|
4420
|
+
function FromUint8Array4(schema, references) {
|
|
4421
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
4422
|
+
return FromDefault(schema.default);
|
|
4423
|
+
} else if (schema.minByteLength !== void 0) {
|
|
4424
|
+
return new Uint8Array(schema.minByteLength);
|
|
4425
|
+
} else {
|
|
4426
|
+
return new Uint8Array(0);
|
|
4427
|
+
}
|
|
4428
|
+
}
|
|
4429
|
+
function FromUnknown4(schema, references) {
|
|
4430
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
4431
|
+
return FromDefault(schema.default);
|
|
4432
|
+
} else {
|
|
4433
|
+
return {};
|
|
4434
|
+
}
|
|
4435
|
+
}
|
|
4436
|
+
function FromVoid4(schema, references) {
|
|
4437
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
4438
|
+
return FromDefault(schema.default);
|
|
4439
|
+
} else {
|
|
4440
|
+
return void 0;
|
|
4441
|
+
}
|
|
4442
|
+
}
|
|
4443
|
+
function FromKind3(schema, references) {
|
|
4444
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
4445
|
+
return FromDefault(schema.default);
|
|
4446
|
+
} else {
|
|
4447
|
+
throw new Error("User defined types must specify a default value");
|
|
4157
4448
|
}
|
|
4158
|
-
return Default(schema, path, value);
|
|
4159
4449
|
}
|
|
4160
|
-
function Visit7(schema, references
|
|
4450
|
+
function Visit7(schema, references) {
|
|
4161
4451
|
const references_ = Pushref(schema, references);
|
|
4162
4452
|
const schema_ = schema;
|
|
4163
|
-
switch (
|
|
4453
|
+
switch (schema_[Kind]) {
|
|
4454
|
+
case "Any":
|
|
4455
|
+
return FromAny4(schema_, references_);
|
|
4456
|
+
case "Argument":
|
|
4457
|
+
return FromArgument4(schema_, references_);
|
|
4164
4458
|
case "Array":
|
|
4165
|
-
return
|
|
4459
|
+
return FromArray10(schema_, references_);
|
|
4460
|
+
case "AsyncIterator":
|
|
4461
|
+
return FromAsyncIterator6(schema_, references_);
|
|
4462
|
+
case "BigInt":
|
|
4463
|
+
return FromBigInt4(schema_, references_);
|
|
4464
|
+
case "Boolean":
|
|
4465
|
+
return FromBoolean4(schema_, references_);
|
|
4466
|
+
case "Constructor":
|
|
4467
|
+
return FromConstructor6(schema_, references_);
|
|
4468
|
+
case "Date":
|
|
4469
|
+
return FromDate5(schema_, references_);
|
|
4470
|
+
case "Function":
|
|
4471
|
+
return FromFunction6(schema_, references_);
|
|
4166
4472
|
case "Import":
|
|
4167
|
-
return FromImport3(schema_, references_
|
|
4473
|
+
return FromImport3(schema_, references_);
|
|
4474
|
+
case "Integer":
|
|
4475
|
+
return FromInteger4(schema_, references_);
|
|
4168
4476
|
case "Intersect":
|
|
4169
|
-
return FromIntersect11(schema_, references_
|
|
4477
|
+
return FromIntersect11(schema_, references_);
|
|
4478
|
+
case "Iterator":
|
|
4479
|
+
return FromIterator6(schema_, references_);
|
|
4480
|
+
case "Literal":
|
|
4481
|
+
return FromLiteral5(schema_, references_);
|
|
4482
|
+
case "Never":
|
|
4483
|
+
return FromNever4(schema_, references_);
|
|
4170
4484
|
case "Not":
|
|
4171
|
-
return FromNot4(schema_, references_
|
|
4485
|
+
return FromNot4(schema_, references_);
|
|
4486
|
+
case "Null":
|
|
4487
|
+
return FromNull4(schema_, references_);
|
|
4488
|
+
case "Number":
|
|
4489
|
+
return FromNumber4(schema_, references_);
|
|
4172
4490
|
case "Object":
|
|
4173
|
-
return
|
|
4491
|
+
return FromObject11(schema_, references_);
|
|
4492
|
+
case "Promise":
|
|
4493
|
+
return FromPromise6(schema_, references_);
|
|
4174
4494
|
case "Record":
|
|
4175
|
-
return FromRecord6(schema_, references_
|
|
4495
|
+
return FromRecord6(schema_, references_);
|
|
4176
4496
|
case "Ref":
|
|
4177
|
-
return FromRef7(schema_, references_
|
|
4497
|
+
return FromRef7(schema_, references_);
|
|
4498
|
+
case "RegExp":
|
|
4499
|
+
return FromRegExp4(schema_, references_);
|
|
4500
|
+
case "String":
|
|
4501
|
+
return FromString4(schema_, references_);
|
|
4178
4502
|
case "Symbol":
|
|
4179
|
-
return
|
|
4503
|
+
return FromSymbol4(schema_, references_);
|
|
4504
|
+
case "TemplateLiteral":
|
|
4505
|
+
return FromTemplateLiteral6(schema_, references_);
|
|
4180
4506
|
case "This":
|
|
4181
|
-
return FromThis3(schema_, references_
|
|
4507
|
+
return FromThis3(schema_, references_);
|
|
4182
4508
|
case "Tuple":
|
|
4183
|
-
return FromTuple8(schema_, references_
|
|
4509
|
+
return FromTuple8(schema_, references_);
|
|
4510
|
+
case "Undefined":
|
|
4511
|
+
return FromUndefined4(schema_, references_);
|
|
4184
4512
|
case "Union":
|
|
4185
|
-
return FromUnion13(schema_, references_
|
|
4513
|
+
return FromUnion13(schema_, references_);
|
|
4514
|
+
case "Uint8Array":
|
|
4515
|
+
return FromUint8Array4(schema_, references_);
|
|
4516
|
+
case "Unknown":
|
|
4517
|
+
return FromUnknown4(schema_, references_);
|
|
4518
|
+
case "Void":
|
|
4519
|
+
return FromVoid4(schema_, references_);
|
|
4186
4520
|
default:
|
|
4187
|
-
|
|
4521
|
+
if (!type_exports2.Has(schema_[Kind]))
|
|
4522
|
+
throw new ValueCreateError(schema_, "Unknown type");
|
|
4523
|
+
return FromKind3(schema_, references_);
|
|
4188
4524
|
}
|
|
4189
4525
|
}
|
|
4190
|
-
|
|
4191
|
-
|
|
4526
|
+
var recursiveMaxDepth = 512;
|
|
4527
|
+
var recursiveDepth = 0;
|
|
4528
|
+
function Create2(...args) {
|
|
4529
|
+
recursiveDepth = 0;
|
|
4530
|
+
return args.length === 2 ? Visit7(args[0], args[1]) : Visit7(args[0], []);
|
|
4192
4531
|
}
|
|
4193
4532
|
|
|
4194
|
-
// ../../node_modules/.pnpm/@sinclair+typebox@0.34.52/node_modules/@sinclair/typebox/build/esm/value/
|
|
4195
|
-
var
|
|
4196
|
-
constructor(schema,
|
|
4197
|
-
super(
|
|
4533
|
+
// ../../node_modules/.pnpm/@sinclair+typebox@0.34.52/node_modules/@sinclair/typebox/build/esm/value/cast/cast.mjs
|
|
4534
|
+
var ValueCastError = class extends TypeBoxError {
|
|
4535
|
+
constructor(schema, message) {
|
|
4536
|
+
super(message);
|
|
4198
4537
|
this.schema = schema;
|
|
4199
|
-
this.value = value;
|
|
4200
|
-
this.error = error2;
|
|
4201
4538
|
}
|
|
4202
4539
|
};
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4540
|
+
function ScoreUnion(schema, references, value) {
|
|
4541
|
+
if (schema[Kind] === "Object" && typeof value === "object" && !IsNull2(value)) {
|
|
4542
|
+
const object = schema;
|
|
4543
|
+
const keys = Object.getOwnPropertyNames(value);
|
|
4544
|
+
const entries = Object.entries(object.properties);
|
|
4545
|
+
return entries.reduce((acc, [key, schema2]) => {
|
|
4546
|
+
const literal = schema2[Kind] === "Literal" && schema2.const === value[key] ? 100 : 0;
|
|
4547
|
+
const checks = Check(schema2, references, value[key]) ? 10 : 0;
|
|
4548
|
+
const exists = keys.includes(key) ? 1 : 0;
|
|
4549
|
+
return acc + (literal + checks + exists);
|
|
4550
|
+
}, 0);
|
|
4551
|
+
} else if (schema[Kind] === "Union") {
|
|
4552
|
+
const schemas = schema.anyOf.map((schema2) => Deref(schema2, references));
|
|
4553
|
+
const scores = schemas.map((schema2) => ScoreUnion(schema2, references, value));
|
|
4554
|
+
return Math.max(...scores);
|
|
4555
|
+
} else {
|
|
4556
|
+
return Check(schema, references, value) ? 1 : 0;
|
|
4210
4557
|
}
|
|
4211
|
-
}
|
|
4212
|
-
function
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4558
|
+
}
|
|
4559
|
+
function SelectUnion(union, references, value) {
|
|
4560
|
+
const schemas = union.anyOf.map((schema) => Deref(schema, references));
|
|
4561
|
+
let [select, best] = [schemas[0], 0];
|
|
4562
|
+
for (const schema of schemas) {
|
|
4563
|
+
const score = ScoreUnion(schema, references, value);
|
|
4564
|
+
if (score > best) {
|
|
4565
|
+
select = schema;
|
|
4566
|
+
best = score;
|
|
4567
|
+
}
|
|
4217
4568
|
}
|
|
4569
|
+
return select;
|
|
4218
4570
|
}
|
|
4219
|
-
function
|
|
4220
|
-
|
|
4221
|
-
|
|
4571
|
+
function CastUnion(union, references, value) {
|
|
4572
|
+
if ("default" in union) {
|
|
4573
|
+
return typeof value === "function" ? union.default : Clone2(union.default);
|
|
4574
|
+
} else {
|
|
4575
|
+
const schema = SelectUnion(union, references, value);
|
|
4576
|
+
return Cast(schema, references, value);
|
|
4577
|
+
}
|
|
4222
4578
|
}
|
|
4223
|
-
function
|
|
4579
|
+
function DefaultClone(schema, references, value) {
|
|
4580
|
+
return Check(schema, references, value) ? Clone2(value) : Create2(schema, references);
|
|
4581
|
+
}
|
|
4582
|
+
function Default(schema, references, value) {
|
|
4583
|
+
return Check(schema, references, value) ? value : Create2(schema, references);
|
|
4584
|
+
}
|
|
4585
|
+
function FromArray11(schema, references, value) {
|
|
4586
|
+
if (Check(schema, references, value))
|
|
4587
|
+
return Clone2(value);
|
|
4588
|
+
const created = IsArray2(value) ? Clone2(value) : Create2(schema, references);
|
|
4589
|
+
const minimum = IsNumber2(schema.minItems) && created.length < schema.minItems ? [...created, ...Array.from({ length: schema.minItems - created.length }, () => null)] : created;
|
|
4590
|
+
const maximum = IsNumber2(schema.maxItems) && minimum.length > schema.maxItems ? minimum.slice(0, schema.maxItems) : minimum;
|
|
4591
|
+
const casted = maximum.map((value2) => Visit8(schema.items, references, value2));
|
|
4592
|
+
if (schema.uniqueItems !== true)
|
|
4593
|
+
return casted;
|
|
4594
|
+
const unique = [...new Set(casted)];
|
|
4595
|
+
if (!Check(schema, references, unique))
|
|
4596
|
+
throw new ValueCastError(schema, "Array cast produced invalid data due to uniqueItems constraint");
|
|
4597
|
+
return unique;
|
|
4598
|
+
}
|
|
4599
|
+
function FromConstructor7(schema, references, value) {
|
|
4600
|
+
if (Check(schema, references, value))
|
|
4601
|
+
return Create2(schema, references);
|
|
4602
|
+
const required = new Set(schema.returns.required || []);
|
|
4603
|
+
const result = function() {
|
|
4604
|
+
};
|
|
4605
|
+
for (const [key, property] of Object.entries(schema.returns.properties)) {
|
|
4606
|
+
if (!required.has(key) && value.prototype[key] === void 0)
|
|
4607
|
+
continue;
|
|
4608
|
+
result.prototype[key] = Visit8(property, references, value.prototype[key]);
|
|
4609
|
+
}
|
|
4610
|
+
return result;
|
|
4611
|
+
}
|
|
4612
|
+
function FromImport4(schema, references, value) {
|
|
4613
|
+
const definitions = globalThis.Object.values(schema.$defs);
|
|
4614
|
+
const target = schema.$defs[schema.$ref];
|
|
4615
|
+
return Visit8(target, [...references, ...definitions], value);
|
|
4616
|
+
}
|
|
4617
|
+
function IntersectAssign(correct, value) {
|
|
4618
|
+
if (IsObject2(correct) && !IsObject2(value) || !IsObject2(correct) && IsObject2(value))
|
|
4619
|
+
return correct;
|
|
4620
|
+
if (!IsObject2(correct) || !IsObject2(value))
|
|
4621
|
+
return value;
|
|
4622
|
+
return globalThis.Object.getOwnPropertyNames(correct).reduce((result, key) => {
|
|
4623
|
+
const property = key in value ? IntersectAssign(correct[key], value[key]) : correct[key];
|
|
4624
|
+
return { ...result, [key]: property };
|
|
4625
|
+
}, {});
|
|
4626
|
+
}
|
|
4627
|
+
function FromIntersect12(schema, references, value) {
|
|
4628
|
+
if (Check(schema, references, value))
|
|
4629
|
+
return value;
|
|
4630
|
+
const correct = Create2(schema, references);
|
|
4631
|
+
const assigned = IntersectAssign(correct, value);
|
|
4632
|
+
return Check(schema, references, assigned) ? assigned : correct;
|
|
4633
|
+
}
|
|
4634
|
+
function FromNever5(schema, references, value) {
|
|
4635
|
+
throw new ValueCastError(schema, "Never types cannot be cast");
|
|
4636
|
+
}
|
|
4637
|
+
function FromObject12(schema, references, value) {
|
|
4638
|
+
if (Check(schema, references, value))
|
|
4639
|
+
return value;
|
|
4640
|
+
if (value === null || typeof value !== "object")
|
|
4641
|
+
return Create2(schema, references);
|
|
4642
|
+
const required = new Set(schema.required || []);
|
|
4643
|
+
const result = {};
|
|
4644
|
+
for (const [key, property] of Object.entries(schema.properties)) {
|
|
4645
|
+
if (!required.has(key) && value[key] === void 0)
|
|
4646
|
+
continue;
|
|
4647
|
+
result[key] = Visit8(property, references, value[key]);
|
|
4648
|
+
}
|
|
4649
|
+
if (typeof schema.additionalProperties === "object") {
|
|
4650
|
+
const propertyNames = Object.getOwnPropertyNames(schema.properties);
|
|
4651
|
+
for (const propertyName of Object.getOwnPropertyNames(value)) {
|
|
4652
|
+
if (propertyNames.includes(propertyName))
|
|
4653
|
+
continue;
|
|
4654
|
+
result[propertyName] = Visit8(schema.additionalProperties, references, value[propertyName]);
|
|
4655
|
+
}
|
|
4656
|
+
}
|
|
4657
|
+
return result;
|
|
4658
|
+
}
|
|
4659
|
+
function FromRecord7(schema, references, value) {
|
|
4660
|
+
if (Check(schema, references, value))
|
|
4661
|
+
return Clone2(value);
|
|
4662
|
+
if (value === null || typeof value !== "object" || Array.isArray(value) || value instanceof Date)
|
|
4663
|
+
return Create2(schema, references);
|
|
4664
|
+
const subschemaPropertyName = Object.getOwnPropertyNames(schema.patternProperties)[0];
|
|
4665
|
+
const subschema = schema.patternProperties[subschemaPropertyName];
|
|
4666
|
+
const result = {};
|
|
4667
|
+
for (const [propKey, propValue] of Object.entries(value)) {
|
|
4668
|
+
result[propKey] = Visit8(subschema, references, propValue);
|
|
4669
|
+
}
|
|
4670
|
+
return result;
|
|
4671
|
+
}
|
|
4672
|
+
function FromRef8(schema, references, value) {
|
|
4673
|
+
return Visit8(Deref(schema, references), references, value);
|
|
4674
|
+
}
|
|
4675
|
+
function FromThis4(schema, references, value) {
|
|
4676
|
+
return Visit8(Deref(schema, references), references, value);
|
|
4677
|
+
}
|
|
4678
|
+
function FromTuple9(schema, references, value) {
|
|
4679
|
+
if (Check(schema, references, value))
|
|
4680
|
+
return Clone2(value);
|
|
4681
|
+
if (!IsArray2(value))
|
|
4682
|
+
return Create2(schema, references);
|
|
4683
|
+
if (schema.items === void 0)
|
|
4684
|
+
return [];
|
|
4685
|
+
return schema.items.map((schema2, index) => Visit8(schema2, references, value[index]));
|
|
4686
|
+
}
|
|
4687
|
+
function FromUnion14(schema, references, value) {
|
|
4688
|
+
return Check(schema, references, value) ? Clone2(value) : CastUnion(schema, references, value);
|
|
4689
|
+
}
|
|
4690
|
+
function Visit8(schema, references, value) {
|
|
4691
|
+
const references_ = IsString2(schema.$id) ? Pushref(schema, references) : references;
|
|
4692
|
+
const schema_ = schema;
|
|
4693
|
+
switch (schema[Kind]) {
|
|
4694
|
+
// --------------------------------------------------------------
|
|
4695
|
+
// Structural
|
|
4696
|
+
// --------------------------------------------------------------
|
|
4697
|
+
case "Array":
|
|
4698
|
+
return FromArray11(schema_, references_, value);
|
|
4699
|
+
case "Constructor":
|
|
4700
|
+
return FromConstructor7(schema_, references_, value);
|
|
4701
|
+
case "Import":
|
|
4702
|
+
return FromImport4(schema_, references_, value);
|
|
4703
|
+
case "Intersect":
|
|
4704
|
+
return FromIntersect12(schema_, references_, value);
|
|
4705
|
+
case "Never":
|
|
4706
|
+
return FromNever5(schema_, references_, value);
|
|
4707
|
+
case "Object":
|
|
4708
|
+
return FromObject12(schema_, references_, value);
|
|
4709
|
+
case "Record":
|
|
4710
|
+
return FromRecord7(schema_, references_, value);
|
|
4711
|
+
case "Ref":
|
|
4712
|
+
return FromRef8(schema_, references_, value);
|
|
4713
|
+
case "This":
|
|
4714
|
+
return FromThis4(schema_, references_, value);
|
|
4715
|
+
case "Tuple":
|
|
4716
|
+
return FromTuple9(schema_, references_, value);
|
|
4717
|
+
case "Union":
|
|
4718
|
+
return FromUnion14(schema_, references_, value);
|
|
4719
|
+
// --------------------------------------------------------------
|
|
4720
|
+
// DefaultClone
|
|
4721
|
+
// --------------------------------------------------------------
|
|
4722
|
+
case "Date":
|
|
4723
|
+
case "Symbol":
|
|
4724
|
+
case "Uint8Array":
|
|
4725
|
+
return DefaultClone(schema, references, value);
|
|
4726
|
+
// --------------------------------------------------------------
|
|
4727
|
+
// Default
|
|
4728
|
+
// --------------------------------------------------------------
|
|
4729
|
+
default:
|
|
4730
|
+
return Default(schema_, references_, value);
|
|
4731
|
+
}
|
|
4732
|
+
}
|
|
4733
|
+
function Cast(...args) {
|
|
4734
|
+
return args.length === 3 ? Visit8(args[0], args[1], args[2]) : Visit8(args[0], [], args[1]);
|
|
4735
|
+
}
|
|
4736
|
+
|
|
4737
|
+
// ../../node_modules/.pnpm/@sinclair+typebox@0.34.52/node_modules/@sinclair/typebox/build/esm/value/clean/clean.mjs
|
|
4738
|
+
function IsCheckable(schema) {
|
|
4739
|
+
return IsKind(schema) && schema[Kind] !== "Unsafe";
|
|
4740
|
+
}
|
|
4741
|
+
function FromArray12(schema, references, value) {
|
|
4742
|
+
if (!IsArray2(value))
|
|
4743
|
+
return value;
|
|
4744
|
+
return value.map((value2) => Visit9(schema.items, references, value2));
|
|
4745
|
+
}
|
|
4746
|
+
function FromImport5(schema, references, value) {
|
|
4747
|
+
const definitions = globalThis.Object.values(schema.$defs);
|
|
4748
|
+
const target = schema.$defs[schema.$ref];
|
|
4749
|
+
return Visit9(target, [...references, ...definitions], value);
|
|
4750
|
+
}
|
|
4751
|
+
function FromIntersect13(schema, references, value) {
|
|
4752
|
+
const unevaluatedProperties = schema.unevaluatedProperties;
|
|
4753
|
+
const intersections = schema.allOf.map((schema2) => Visit9(schema2, references, Clone2(value)));
|
|
4754
|
+
const composite = intersections.reduce((acc, value2) => IsObject2(value2) ? { ...acc, ...value2 } : value2, {});
|
|
4755
|
+
if (!IsObject2(value) || !IsObject2(composite) || !IsKind(unevaluatedProperties))
|
|
4756
|
+
return composite;
|
|
4757
|
+
const knownkeys = KeyOfPropertyKeys(schema);
|
|
4758
|
+
for (const key of Object.getOwnPropertyNames(value)) {
|
|
4759
|
+
if (knownkeys.includes(key))
|
|
4760
|
+
continue;
|
|
4761
|
+
if (Check(unevaluatedProperties, references, value[key])) {
|
|
4762
|
+
composite[key] = Visit9(unevaluatedProperties, references, value[key]);
|
|
4763
|
+
}
|
|
4764
|
+
}
|
|
4765
|
+
return composite;
|
|
4766
|
+
}
|
|
4767
|
+
function FromObject13(schema, references, value) {
|
|
4768
|
+
if (!IsObject2(value) || IsArray2(value))
|
|
4769
|
+
return value;
|
|
4770
|
+
const additionalProperties = schema.additionalProperties;
|
|
4771
|
+
for (const key of Object.getOwnPropertyNames(value)) {
|
|
4772
|
+
if (HasPropertyKey2(schema.properties, key)) {
|
|
4773
|
+
value[key] = Visit9(schema.properties[key], references, value[key]);
|
|
4774
|
+
continue;
|
|
4775
|
+
}
|
|
4776
|
+
if (IsKind(additionalProperties) && Check(additionalProperties, references, value[key])) {
|
|
4777
|
+
value[key] = Visit9(additionalProperties, references, value[key]);
|
|
4778
|
+
continue;
|
|
4779
|
+
}
|
|
4780
|
+
delete value[key];
|
|
4781
|
+
}
|
|
4782
|
+
return value;
|
|
4783
|
+
}
|
|
4784
|
+
function FromRecord8(schema, references, value) {
|
|
4785
|
+
if (!IsObject2(value))
|
|
4786
|
+
return value;
|
|
4787
|
+
const additionalProperties = schema.additionalProperties;
|
|
4788
|
+
const propertyKeys = Object.getOwnPropertyNames(value);
|
|
4789
|
+
const [propertyKey, propertySchema] = Object.entries(schema.patternProperties)[0];
|
|
4790
|
+
const propertyKeyTest = new RegExp(propertyKey);
|
|
4791
|
+
for (const key of propertyKeys) {
|
|
4792
|
+
if (propertyKeyTest.test(key)) {
|
|
4793
|
+
value[key] = Visit9(propertySchema, references, value[key]);
|
|
4794
|
+
continue;
|
|
4795
|
+
}
|
|
4796
|
+
if (IsKind(additionalProperties) && Check(additionalProperties, references, value[key])) {
|
|
4797
|
+
value[key] = Visit9(additionalProperties, references, value[key]);
|
|
4798
|
+
continue;
|
|
4799
|
+
}
|
|
4800
|
+
delete value[key];
|
|
4801
|
+
}
|
|
4802
|
+
return value;
|
|
4803
|
+
}
|
|
4804
|
+
function FromRef9(schema, references, value) {
|
|
4805
|
+
return Visit9(Deref(schema, references), references, value);
|
|
4806
|
+
}
|
|
4807
|
+
function FromThis5(schema, references, value) {
|
|
4808
|
+
return Visit9(Deref(schema, references), references, value);
|
|
4809
|
+
}
|
|
4810
|
+
function FromTuple10(schema, references, value) {
|
|
4811
|
+
if (!IsArray2(value))
|
|
4812
|
+
return value;
|
|
4813
|
+
if (IsUndefined2(schema.items))
|
|
4814
|
+
return [];
|
|
4815
|
+
const length = Math.min(value.length, schema.items.length);
|
|
4816
|
+
for (let i = 0; i < length; i++) {
|
|
4817
|
+
value[i] = Visit9(schema.items[i], references, value[i]);
|
|
4818
|
+
}
|
|
4819
|
+
return value.length > length ? value.slice(0, length) : value;
|
|
4820
|
+
}
|
|
4821
|
+
function FromUnion15(schema, references, value) {
|
|
4822
|
+
for (const inner of schema.anyOf) {
|
|
4823
|
+
if (IsCheckable(inner) && Check(inner, references, value)) {
|
|
4824
|
+
return Visit9(inner, references, value);
|
|
4825
|
+
}
|
|
4826
|
+
}
|
|
4827
|
+
return value;
|
|
4828
|
+
}
|
|
4829
|
+
function Visit9(schema, references, value) {
|
|
4830
|
+
const references_ = IsString2(schema.$id) ? Pushref(schema, references) : references;
|
|
4831
|
+
const schema_ = schema;
|
|
4832
|
+
switch (schema_[Kind]) {
|
|
4833
|
+
case "Array":
|
|
4834
|
+
return FromArray12(schema_, references_, value);
|
|
4835
|
+
case "Import":
|
|
4836
|
+
return FromImport5(schema_, references_, value);
|
|
4837
|
+
case "Intersect":
|
|
4838
|
+
return FromIntersect13(schema_, references_, value);
|
|
4839
|
+
case "Object":
|
|
4840
|
+
return FromObject13(schema_, references_, value);
|
|
4841
|
+
case "Record":
|
|
4842
|
+
return FromRecord8(schema_, references_, value);
|
|
4843
|
+
case "Ref":
|
|
4844
|
+
return FromRef9(schema_, references_, value);
|
|
4845
|
+
case "This":
|
|
4846
|
+
return FromThis5(schema_, references_, value);
|
|
4847
|
+
case "Tuple":
|
|
4848
|
+
return FromTuple10(schema_, references_, value);
|
|
4849
|
+
case "Union":
|
|
4850
|
+
return FromUnion15(schema_, references_, value);
|
|
4851
|
+
default:
|
|
4852
|
+
return value;
|
|
4853
|
+
}
|
|
4854
|
+
}
|
|
4855
|
+
function Clean(...args) {
|
|
4856
|
+
return args.length === 3 ? Visit9(args[0], args[1], args[2]) : Visit9(args[0], [], args[1]);
|
|
4857
|
+
}
|
|
4858
|
+
|
|
4859
|
+
// ../../node_modules/.pnpm/@sinclair+typebox@0.34.52/node_modules/@sinclair/typebox/build/esm/value/convert/convert.mjs
|
|
4860
|
+
function IsStringNumeric(value) {
|
|
4861
|
+
return IsString2(value) && !isNaN(value) && !isNaN(parseFloat(value));
|
|
4862
|
+
}
|
|
4863
|
+
function IsValueToString(value) {
|
|
4864
|
+
return IsBigInt2(value) || IsBoolean2(value) || IsNumber2(value);
|
|
4865
|
+
}
|
|
4866
|
+
function IsValueTrue(value) {
|
|
4867
|
+
return value === true || IsNumber2(value) && value === 1 || IsBigInt2(value) && value === BigInt("1") || IsString2(value) && (value.toLowerCase() === "true" || value === "1");
|
|
4868
|
+
}
|
|
4869
|
+
function IsValueFalse(value) {
|
|
4870
|
+
return value === false || IsNumber2(value) && (value === 0 || Object.is(value, -0)) || IsBigInt2(value) && value === BigInt("0") || IsString2(value) && (value.toLowerCase() === "false" || value === "0" || value === "-0");
|
|
4871
|
+
}
|
|
4872
|
+
function IsTimeStringWithTimeZone(value) {
|
|
4873
|
+
return IsString2(value) && /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(value);
|
|
4874
|
+
}
|
|
4875
|
+
function IsTimeStringWithoutTimeZone(value) {
|
|
4876
|
+
return IsString2(value) && /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(value);
|
|
4877
|
+
}
|
|
4878
|
+
function IsDateTimeStringWithTimeZone(value) {
|
|
4879
|
+
return IsString2(value) && /^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(value);
|
|
4880
|
+
}
|
|
4881
|
+
function IsDateTimeStringWithoutTimeZone(value) {
|
|
4882
|
+
return IsString2(value) && /^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(value);
|
|
4883
|
+
}
|
|
4884
|
+
function IsDateString(value) {
|
|
4885
|
+
return IsString2(value) && /^\d\d\d\d-[0-1]\d-[0-3]\d$/i.test(value);
|
|
4886
|
+
}
|
|
4887
|
+
function TryConvertLiteralString(value, target) {
|
|
4888
|
+
const conversion = TryConvertString(value);
|
|
4889
|
+
return conversion === target ? conversion : value;
|
|
4890
|
+
}
|
|
4891
|
+
function TryConvertLiteralNumber(value, target) {
|
|
4892
|
+
const conversion = TryConvertNumber(value);
|
|
4893
|
+
return conversion === target ? conversion : value;
|
|
4894
|
+
}
|
|
4895
|
+
function TryConvertLiteralBoolean(value, target) {
|
|
4896
|
+
const conversion = TryConvertBoolean(value);
|
|
4897
|
+
return conversion === target ? conversion : value;
|
|
4898
|
+
}
|
|
4899
|
+
function TryConvertLiteral(schema, value) {
|
|
4900
|
+
return IsString2(schema.const) ? TryConvertLiteralString(value, schema.const) : IsNumber2(schema.const) ? TryConvertLiteralNumber(value, schema.const) : IsBoolean2(schema.const) ? TryConvertLiteralBoolean(value, schema.const) : value;
|
|
4901
|
+
}
|
|
4902
|
+
function TryConvertBoolean(value) {
|
|
4903
|
+
return IsValueTrue(value) ? true : IsValueFalse(value) ? false : value;
|
|
4904
|
+
}
|
|
4905
|
+
function TryConvertBigInt(value) {
|
|
4906
|
+
const truncateInteger = (value2) => value2.split(".")[0];
|
|
4907
|
+
return IsStringNumeric(value) ? BigInt(truncateInteger(value)) : IsNumber2(value) ? BigInt(Math.trunc(value)) : IsValueFalse(value) ? BigInt(0) : IsValueTrue(value) ? BigInt(1) : value;
|
|
4908
|
+
}
|
|
4909
|
+
function TryConvertString(value) {
|
|
4910
|
+
return IsSymbol2(value) && value.description !== void 0 ? value.description.toString() : IsValueToString(value) ? value.toString() : value;
|
|
4911
|
+
}
|
|
4912
|
+
function TryConvertNumber(value) {
|
|
4913
|
+
return IsStringNumeric(value) ? parseFloat(value) : IsValueTrue(value) ? 1 : IsValueFalse(value) ? 0 : value;
|
|
4914
|
+
}
|
|
4915
|
+
function TryConvertInteger(value) {
|
|
4916
|
+
return IsStringNumeric(value) ? parseInt(value) : IsNumber2(value) ? Math.trunc(value) : IsValueTrue(value) ? 1 : IsValueFalse(value) ? 0 : value;
|
|
4917
|
+
}
|
|
4918
|
+
function TryConvertNull(value) {
|
|
4919
|
+
return IsString2(value) && value.toLowerCase() === "null" ? null : value;
|
|
4920
|
+
}
|
|
4921
|
+
function TryConvertUndefined(value) {
|
|
4922
|
+
return IsString2(value) && value === "undefined" ? void 0 : value;
|
|
4923
|
+
}
|
|
4924
|
+
function TryConvertDate(value) {
|
|
4925
|
+
return IsDate2(value) ? value : IsNumber2(value) ? new Date(value) : IsValueTrue(value) ? /* @__PURE__ */ new Date(1) : IsValueFalse(value) ? /* @__PURE__ */ new Date(0) : IsStringNumeric(value) ? new Date(parseInt(value)) : IsTimeStringWithoutTimeZone(value) ? /* @__PURE__ */ new Date(`1970-01-01T${value}.000Z`) : IsTimeStringWithTimeZone(value) ? /* @__PURE__ */ new Date(`1970-01-01T${value}`) : IsDateTimeStringWithoutTimeZone(value) ? /* @__PURE__ */ new Date(`${value}.000Z`) : IsDateTimeStringWithTimeZone(value) ? new Date(value) : IsDateString(value) ? /* @__PURE__ */ new Date(`${value}T00:00:00.000Z`) : value;
|
|
4926
|
+
}
|
|
4927
|
+
function Default2(value) {
|
|
4928
|
+
return value;
|
|
4929
|
+
}
|
|
4930
|
+
function FromArray13(schema, references, value) {
|
|
4931
|
+
const elements = IsArray2(value) ? value : [value];
|
|
4932
|
+
return elements.map((element) => Visit10(schema.items, references, element));
|
|
4933
|
+
}
|
|
4934
|
+
function FromBigInt5(schema, references, value) {
|
|
4935
|
+
return TryConvertBigInt(value);
|
|
4936
|
+
}
|
|
4937
|
+
function FromBoolean5(schema, references, value) {
|
|
4938
|
+
return TryConvertBoolean(value);
|
|
4939
|
+
}
|
|
4940
|
+
function FromDate6(schema, references, value) {
|
|
4941
|
+
return TryConvertDate(value);
|
|
4942
|
+
}
|
|
4943
|
+
function FromImport6(schema, references, value) {
|
|
4944
|
+
const definitions = globalThis.Object.values(schema.$defs);
|
|
4945
|
+
const target = schema.$defs[schema.$ref];
|
|
4946
|
+
return Visit10(target, [...references, ...definitions], value);
|
|
4947
|
+
}
|
|
4948
|
+
function FromInteger5(schema, references, value) {
|
|
4949
|
+
return TryConvertInteger(value);
|
|
4950
|
+
}
|
|
4951
|
+
function FromIntersect14(schema, references, value) {
|
|
4952
|
+
return schema.allOf.reduce((value2, schema2) => Visit10(schema2, references, value2), value);
|
|
4953
|
+
}
|
|
4954
|
+
function FromLiteral6(schema, references, value) {
|
|
4955
|
+
return TryConvertLiteral(schema, value);
|
|
4956
|
+
}
|
|
4957
|
+
function FromNull5(schema, references, value) {
|
|
4958
|
+
return TryConvertNull(value);
|
|
4959
|
+
}
|
|
4960
|
+
function FromNumber5(schema, references, value) {
|
|
4961
|
+
return TryConvertNumber(value);
|
|
4962
|
+
}
|
|
4963
|
+
function FromObject14(schema, references, value) {
|
|
4964
|
+
if (!IsObject2(value) || IsArray2(value))
|
|
4965
|
+
return value;
|
|
4966
|
+
for (const propertyKey of Object.getOwnPropertyNames(schema.properties)) {
|
|
4967
|
+
if (!HasPropertyKey2(value, propertyKey))
|
|
4968
|
+
continue;
|
|
4969
|
+
value[propertyKey] = Visit10(schema.properties[propertyKey], references, value[propertyKey]);
|
|
4970
|
+
}
|
|
4971
|
+
return value;
|
|
4972
|
+
}
|
|
4973
|
+
function FromRecord9(schema, references, value) {
|
|
4974
|
+
const isConvertable = IsObject2(value) && !IsArray2(value);
|
|
4975
|
+
if (!isConvertable)
|
|
4976
|
+
return value;
|
|
4977
|
+
const propertyKey = Object.getOwnPropertyNames(schema.patternProperties)[0];
|
|
4978
|
+
const property = schema.patternProperties[propertyKey];
|
|
4979
|
+
for (const [propKey, propValue] of Object.entries(value)) {
|
|
4980
|
+
value[propKey] = Visit10(property, references, propValue);
|
|
4981
|
+
}
|
|
4982
|
+
return value;
|
|
4983
|
+
}
|
|
4984
|
+
function FromRef10(schema, references, value) {
|
|
4985
|
+
return Visit10(Deref(schema, references), references, value);
|
|
4986
|
+
}
|
|
4987
|
+
function FromString5(schema, references, value) {
|
|
4988
|
+
return TryConvertString(value);
|
|
4989
|
+
}
|
|
4990
|
+
function FromSymbol5(schema, references, value) {
|
|
4991
|
+
return IsString2(value) || IsNumber2(value) ? Symbol(value) : value;
|
|
4992
|
+
}
|
|
4993
|
+
function FromThis6(schema, references, value) {
|
|
4994
|
+
return Visit10(Deref(schema, references), references, value);
|
|
4995
|
+
}
|
|
4996
|
+
function FromTuple11(schema, references, value) {
|
|
4997
|
+
const isConvertable = IsArray2(value) && !IsUndefined2(schema.items);
|
|
4998
|
+
if (!isConvertable)
|
|
4999
|
+
return value;
|
|
5000
|
+
return value.map((value2, index) => {
|
|
5001
|
+
return index < schema.items.length ? Visit10(schema.items[index], references, value2) : value2;
|
|
5002
|
+
});
|
|
5003
|
+
}
|
|
5004
|
+
function FromUndefined5(schema, references, value) {
|
|
5005
|
+
return TryConvertUndefined(value);
|
|
5006
|
+
}
|
|
5007
|
+
function FromUnion16(schema, references, value) {
|
|
5008
|
+
for (const subschema of schema.anyOf) {
|
|
5009
|
+
if (Check(subschema, references, value)) {
|
|
5010
|
+
return value;
|
|
5011
|
+
}
|
|
5012
|
+
}
|
|
5013
|
+
for (const subschema of schema.anyOf) {
|
|
5014
|
+
const converted = Visit10(subschema, references, Clone2(value));
|
|
5015
|
+
if (!Check(subschema, references, converted))
|
|
5016
|
+
continue;
|
|
5017
|
+
return converted;
|
|
5018
|
+
}
|
|
5019
|
+
return value;
|
|
5020
|
+
}
|
|
5021
|
+
function Visit10(schema, references, value) {
|
|
5022
|
+
const references_ = Pushref(schema, references);
|
|
5023
|
+
const schema_ = schema;
|
|
5024
|
+
switch (schema[Kind]) {
|
|
5025
|
+
case "Array":
|
|
5026
|
+
return FromArray13(schema_, references_, value);
|
|
5027
|
+
case "BigInt":
|
|
5028
|
+
return FromBigInt5(schema_, references_, value);
|
|
5029
|
+
case "Boolean":
|
|
5030
|
+
return FromBoolean5(schema_, references_, value);
|
|
5031
|
+
case "Date":
|
|
5032
|
+
return FromDate6(schema_, references_, value);
|
|
5033
|
+
case "Import":
|
|
5034
|
+
return FromImport6(schema_, references_, value);
|
|
5035
|
+
case "Integer":
|
|
5036
|
+
return FromInteger5(schema_, references_, value);
|
|
5037
|
+
case "Intersect":
|
|
5038
|
+
return FromIntersect14(schema_, references_, value);
|
|
5039
|
+
case "Literal":
|
|
5040
|
+
return FromLiteral6(schema_, references_, value);
|
|
5041
|
+
case "Null":
|
|
5042
|
+
return FromNull5(schema_, references_, value);
|
|
5043
|
+
case "Number":
|
|
5044
|
+
return FromNumber5(schema_, references_, value);
|
|
5045
|
+
case "Object":
|
|
5046
|
+
return FromObject14(schema_, references_, value);
|
|
5047
|
+
case "Record":
|
|
5048
|
+
return FromRecord9(schema_, references_, value);
|
|
5049
|
+
case "Ref":
|
|
5050
|
+
return FromRef10(schema_, references_, value);
|
|
5051
|
+
case "String":
|
|
5052
|
+
return FromString5(schema_, references_, value);
|
|
5053
|
+
case "Symbol":
|
|
5054
|
+
return FromSymbol5(schema_, references_, value);
|
|
5055
|
+
case "This":
|
|
5056
|
+
return FromThis6(schema_, references_, value);
|
|
5057
|
+
case "Tuple":
|
|
5058
|
+
return FromTuple11(schema_, references_, value);
|
|
5059
|
+
case "Undefined":
|
|
5060
|
+
return FromUndefined5(schema_, references_, value);
|
|
5061
|
+
case "Union":
|
|
5062
|
+
return FromUnion16(schema_, references_, value);
|
|
5063
|
+
default:
|
|
5064
|
+
return Default2(value);
|
|
5065
|
+
}
|
|
5066
|
+
}
|
|
5067
|
+
function Convert(...args) {
|
|
5068
|
+
return args.length === 3 ? Visit10(args[0], args[1], args[2]) : Visit10(args[0], [], args[1]);
|
|
5069
|
+
}
|
|
5070
|
+
|
|
5071
|
+
// ../../node_modules/.pnpm/@sinclair+typebox@0.34.52/node_modules/@sinclair/typebox/build/esm/value/transform/decode.mjs
|
|
5072
|
+
var TransformDecodeCheckError = class extends TypeBoxError {
|
|
5073
|
+
constructor(schema, value, error2) {
|
|
5074
|
+
super(`Unable to decode value as it does not match the expected schema`);
|
|
5075
|
+
this.schema = schema;
|
|
5076
|
+
this.value = value;
|
|
5077
|
+
this.error = error2;
|
|
5078
|
+
}
|
|
5079
|
+
};
|
|
5080
|
+
var TransformDecodeError = class extends TypeBoxError {
|
|
5081
|
+
constructor(schema, path, value, error2) {
|
|
5082
|
+
super(error2 instanceof Error ? error2.message : "Unknown error");
|
|
5083
|
+
this.schema = schema;
|
|
5084
|
+
this.path = path;
|
|
5085
|
+
this.value = value;
|
|
5086
|
+
this.error = error2;
|
|
5087
|
+
}
|
|
5088
|
+
};
|
|
5089
|
+
function Default3(schema, path, value) {
|
|
5090
|
+
try {
|
|
5091
|
+
return IsTransform(schema) ? schema[TransformKind].Decode(value) : value;
|
|
5092
|
+
} catch (error2) {
|
|
5093
|
+
throw new TransformDecodeError(schema, path, value, error2);
|
|
5094
|
+
}
|
|
5095
|
+
}
|
|
5096
|
+
function FromArray14(schema, references, path, value) {
|
|
5097
|
+
return IsArray2(value) ? Default3(schema, path, value.map((value2, index) => Visit11(schema.items, references, `${path}/${index}`, value2))) : Default3(schema, path, value);
|
|
5098
|
+
}
|
|
5099
|
+
function FromIntersect15(schema, references, path, value) {
|
|
5100
|
+
if (!IsObject2(value) || IsValueType(value))
|
|
5101
|
+
return Default3(schema, path, value);
|
|
5102
|
+
const knownEntries = KeyOfPropertyEntries(schema);
|
|
5103
|
+
const knownKeys = knownEntries.map((entry) => entry[0]);
|
|
5104
|
+
const knownProperties = { ...value };
|
|
5105
|
+
for (const [knownKey, knownSchema] of knownEntries)
|
|
5106
|
+
if (knownKey in knownProperties) {
|
|
5107
|
+
knownProperties[knownKey] = Visit11(knownSchema, references, `${path}/${knownKey}`, knownProperties[knownKey]);
|
|
5108
|
+
}
|
|
5109
|
+
if (!IsTransform(schema.unevaluatedProperties)) {
|
|
5110
|
+
return Default3(schema, path, knownProperties);
|
|
5111
|
+
}
|
|
5112
|
+
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
5113
|
+
const unevaluatedProperties = schema.unevaluatedProperties;
|
|
5114
|
+
const unknownProperties = { ...knownProperties };
|
|
5115
|
+
for (const key of unknownKeys)
|
|
5116
|
+
if (!knownKeys.includes(key)) {
|
|
5117
|
+
unknownProperties[key] = Default3(unevaluatedProperties, `${path}/${key}`, unknownProperties[key]);
|
|
5118
|
+
}
|
|
5119
|
+
return Default3(schema, path, unknownProperties);
|
|
5120
|
+
}
|
|
5121
|
+
function FromImport7(schema, references, path, value) {
|
|
5122
|
+
const additional = globalThis.Object.values(schema.$defs);
|
|
5123
|
+
const target = schema.$defs[schema.$ref];
|
|
5124
|
+
const result = Visit11(target, [...references, ...additional], path, value);
|
|
5125
|
+
return Default3(schema, path, result);
|
|
5126
|
+
}
|
|
5127
|
+
function FromNot5(schema, references, path, value) {
|
|
5128
|
+
return Default3(schema, path, Visit11(schema.not, references, path, value));
|
|
5129
|
+
}
|
|
5130
|
+
function FromObject15(schema, references, path, value) {
|
|
5131
|
+
if (!IsObject2(value))
|
|
5132
|
+
return Default3(schema, path, value);
|
|
5133
|
+
const knownKeys = KeyOfPropertyKeys(schema);
|
|
5134
|
+
const knownProperties = { ...value };
|
|
5135
|
+
for (const key of knownKeys) {
|
|
5136
|
+
if (!HasPropertyKey2(knownProperties, key))
|
|
5137
|
+
continue;
|
|
5138
|
+
if (IsUndefined2(knownProperties[key]) && (!IsUndefined3(schema.properties[key]) || TypeSystemPolicy.IsExactOptionalProperty(knownProperties, key)))
|
|
5139
|
+
continue;
|
|
5140
|
+
knownProperties[key] = Visit11(schema.properties[key], references, `${path}/${key}`, knownProperties[key]);
|
|
5141
|
+
}
|
|
5142
|
+
if (!IsSchema(schema.additionalProperties)) {
|
|
5143
|
+
return Default3(schema, path, knownProperties);
|
|
5144
|
+
}
|
|
5145
|
+
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
5146
|
+
const additionalProperties = schema.additionalProperties;
|
|
5147
|
+
const unknownProperties = { ...knownProperties };
|
|
5148
|
+
for (const key of unknownKeys)
|
|
5149
|
+
if (!knownKeys.includes(key)) {
|
|
5150
|
+
unknownProperties[key] = Default3(additionalProperties, `${path}/${key}`, unknownProperties[key]);
|
|
5151
|
+
}
|
|
5152
|
+
return Default3(schema, path, unknownProperties);
|
|
5153
|
+
}
|
|
5154
|
+
function FromRecord10(schema, references, path, value) {
|
|
5155
|
+
if (!IsObject2(value))
|
|
5156
|
+
return Default3(schema, path, value);
|
|
5157
|
+
const pattern = Object.getOwnPropertyNames(schema.patternProperties)[0];
|
|
5158
|
+
const knownKeys = new RegExp(pattern);
|
|
5159
|
+
const knownProperties = { ...value };
|
|
5160
|
+
for (const key of Object.getOwnPropertyNames(value))
|
|
5161
|
+
if (knownKeys.test(key)) {
|
|
5162
|
+
knownProperties[key] = Visit11(schema.patternProperties[pattern], references, `${path}/${key}`, knownProperties[key]);
|
|
5163
|
+
}
|
|
5164
|
+
if (!IsSchema(schema.additionalProperties)) {
|
|
5165
|
+
return Default3(schema, path, knownProperties);
|
|
5166
|
+
}
|
|
5167
|
+
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
5168
|
+
const additionalProperties = schema.additionalProperties;
|
|
5169
|
+
const unknownProperties = { ...knownProperties };
|
|
5170
|
+
for (const key of unknownKeys)
|
|
5171
|
+
if (!knownKeys.test(key)) {
|
|
5172
|
+
unknownProperties[key] = Default3(additionalProperties, `${path}/${key}`, unknownProperties[key]);
|
|
5173
|
+
}
|
|
5174
|
+
return Default3(schema, path, unknownProperties);
|
|
5175
|
+
}
|
|
5176
|
+
function FromRef11(schema, references, path, value) {
|
|
5177
|
+
const target = Deref(schema, references);
|
|
5178
|
+
return Default3(schema, path, Visit11(target, references, path, value));
|
|
5179
|
+
}
|
|
5180
|
+
function FromThis7(schema, references, path, value) {
|
|
5181
|
+
const target = Deref(schema, references);
|
|
5182
|
+
return Default3(schema, path, Visit11(target, references, path, value));
|
|
5183
|
+
}
|
|
5184
|
+
function FromTuple12(schema, references, path, value) {
|
|
5185
|
+
return IsArray2(value) && IsArray2(schema.items) ? Default3(schema, path, schema.items.map((schema2, index) => Visit11(schema2, references, `${path}/${index}`, value[index]))) : Default3(schema, path, value);
|
|
5186
|
+
}
|
|
5187
|
+
function FromUnion17(schema, references, path, value) {
|
|
5188
|
+
for (const subschema of schema.anyOf) {
|
|
5189
|
+
if (!Check(subschema, references, value))
|
|
5190
|
+
continue;
|
|
5191
|
+
const decoded = Visit11(subschema, references, path, value);
|
|
5192
|
+
return Default3(schema, path, decoded);
|
|
5193
|
+
}
|
|
5194
|
+
return Default3(schema, path, value);
|
|
5195
|
+
}
|
|
5196
|
+
function Visit11(schema, references, path, value) {
|
|
5197
|
+
const references_ = Pushref(schema, references);
|
|
5198
|
+
const schema_ = schema;
|
|
5199
|
+
switch (schema[Kind]) {
|
|
5200
|
+
case "Array":
|
|
5201
|
+
return FromArray14(schema_, references_, path, value);
|
|
5202
|
+
case "Import":
|
|
5203
|
+
return FromImport7(schema_, references_, path, value);
|
|
5204
|
+
case "Intersect":
|
|
5205
|
+
return FromIntersect15(schema_, references_, path, value);
|
|
5206
|
+
case "Not":
|
|
5207
|
+
return FromNot5(schema_, references_, path, value);
|
|
5208
|
+
case "Object":
|
|
5209
|
+
return FromObject15(schema_, references_, path, value);
|
|
5210
|
+
case "Record":
|
|
5211
|
+
return FromRecord10(schema_, references_, path, value);
|
|
5212
|
+
case "Ref":
|
|
5213
|
+
return FromRef11(schema_, references_, path, value);
|
|
5214
|
+
case "Symbol":
|
|
5215
|
+
return Default3(schema_, path, value);
|
|
5216
|
+
case "This":
|
|
5217
|
+
return FromThis7(schema_, references_, path, value);
|
|
5218
|
+
case "Tuple":
|
|
5219
|
+
return FromTuple12(schema_, references_, path, value);
|
|
5220
|
+
case "Union":
|
|
5221
|
+
return FromUnion17(schema_, references_, path, value);
|
|
5222
|
+
default:
|
|
5223
|
+
return Default3(schema_, path, value);
|
|
5224
|
+
}
|
|
5225
|
+
}
|
|
5226
|
+
function TransformDecode(schema, references, value) {
|
|
5227
|
+
return Visit11(schema, references, "", value);
|
|
5228
|
+
}
|
|
5229
|
+
|
|
5230
|
+
// ../../node_modules/.pnpm/@sinclair+typebox@0.34.52/node_modules/@sinclair/typebox/build/esm/value/transform/encode.mjs
|
|
5231
|
+
var TransformEncodeCheckError = class extends TypeBoxError {
|
|
5232
|
+
constructor(schema, value, error2) {
|
|
5233
|
+
super(`The encoded value does not match the expected schema`);
|
|
5234
|
+
this.schema = schema;
|
|
5235
|
+
this.value = value;
|
|
5236
|
+
this.error = error2;
|
|
5237
|
+
}
|
|
5238
|
+
};
|
|
5239
|
+
var TransformEncodeError = class extends TypeBoxError {
|
|
5240
|
+
constructor(schema, path, value, error2) {
|
|
5241
|
+
super(`${error2 instanceof Error ? error2.message : "Unknown error"}`);
|
|
5242
|
+
this.schema = schema;
|
|
5243
|
+
this.path = path;
|
|
5244
|
+
this.value = value;
|
|
5245
|
+
this.error = error2;
|
|
5246
|
+
}
|
|
5247
|
+
};
|
|
5248
|
+
function Default4(schema, path, value) {
|
|
5249
|
+
try {
|
|
5250
|
+
return IsTransform(schema) ? schema[TransformKind].Encode(value) : value;
|
|
5251
|
+
} catch (error2) {
|
|
5252
|
+
throw new TransformEncodeError(schema, path, value, error2);
|
|
5253
|
+
}
|
|
5254
|
+
}
|
|
5255
|
+
function FromArray15(schema, references, path, value) {
|
|
5256
|
+
const defaulted = Default4(schema, path, value);
|
|
5257
|
+
return IsArray2(defaulted) ? defaulted.map((value2, index) => Visit12(schema.items, references, `${path}/${index}`, value2)) : defaulted;
|
|
5258
|
+
}
|
|
5259
|
+
function FromImport8(schema, references, path, value) {
|
|
4224
5260
|
const additional = globalThis.Object.values(schema.$defs);
|
|
4225
5261
|
const target = schema.$defs[schema.$ref];
|
|
4226
|
-
const result =
|
|
4227
|
-
return
|
|
5262
|
+
const result = Default4(schema, path, value);
|
|
5263
|
+
return Visit12(target, [...references, ...additional], path, result);
|
|
4228
5264
|
}
|
|
4229
|
-
function
|
|
4230
|
-
const defaulted =
|
|
5265
|
+
function FromIntersect16(schema, references, path, value) {
|
|
5266
|
+
const defaulted = Default4(schema, path, value);
|
|
4231
5267
|
if (!IsObject2(value) || IsValueType(value))
|
|
4232
5268
|
return defaulted;
|
|
4233
5269
|
const knownEntries = KeyOfPropertyEntries(schema);
|
|
@@ -4235,7 +5271,7 @@ function FromIntersect12(schema, references, path, value) {
|
|
|
4235
5271
|
const knownProperties = { ...defaulted };
|
|
4236
5272
|
for (const [knownKey, knownSchema] of knownEntries)
|
|
4237
5273
|
if (knownKey in knownProperties) {
|
|
4238
|
-
knownProperties[knownKey] =
|
|
5274
|
+
knownProperties[knownKey] = Visit12(knownSchema, references, `${path}/${knownKey}`, knownProperties[knownKey]);
|
|
4239
5275
|
}
|
|
4240
5276
|
if (!IsTransform(schema.unevaluatedProperties)) {
|
|
4241
5277
|
return knownProperties;
|
|
@@ -4245,15 +5281,15 @@ function FromIntersect12(schema, references, path, value) {
|
|
|
4245
5281
|
const properties = { ...knownProperties };
|
|
4246
5282
|
for (const key of unknownKeys)
|
|
4247
5283
|
if (!knownKeys.includes(key)) {
|
|
4248
|
-
properties[key] =
|
|
5284
|
+
properties[key] = Default4(unevaluatedProperties, `${path}/${key}`, properties[key]);
|
|
4249
5285
|
}
|
|
4250
5286
|
return properties;
|
|
4251
5287
|
}
|
|
4252
|
-
function
|
|
4253
|
-
return
|
|
5288
|
+
function FromNot6(schema, references, path, value) {
|
|
5289
|
+
return Default4(schema.not, path, Default4(schema, path, value));
|
|
4254
5290
|
}
|
|
4255
|
-
function
|
|
4256
|
-
const defaulted =
|
|
5291
|
+
function FromObject16(schema, references, path, value) {
|
|
5292
|
+
const defaulted = Default4(schema, path, value);
|
|
4257
5293
|
if (!IsObject2(defaulted))
|
|
4258
5294
|
return defaulted;
|
|
4259
5295
|
const knownKeys = KeyOfPropertyKeys(schema);
|
|
@@ -4263,7 +5299,7 @@ function FromObject11(schema, references, path, value) {
|
|
|
4263
5299
|
continue;
|
|
4264
5300
|
if (IsUndefined2(knownProperties[key]) && (!IsUndefined3(schema.properties[key]) || TypeSystemPolicy.IsExactOptionalProperty(knownProperties, key)))
|
|
4265
5301
|
continue;
|
|
4266
|
-
knownProperties[key] =
|
|
5302
|
+
knownProperties[key] = Visit12(schema.properties[key], references, `${path}/${key}`, knownProperties[key]);
|
|
4267
5303
|
}
|
|
4268
5304
|
if (!IsSchema(schema.additionalProperties)) {
|
|
4269
5305
|
return knownProperties;
|
|
@@ -4273,12 +5309,12 @@ function FromObject11(schema, references, path, value) {
|
|
|
4273
5309
|
const properties = { ...knownProperties };
|
|
4274
5310
|
for (const key of unknownKeys)
|
|
4275
5311
|
if (!knownKeys.includes(key)) {
|
|
4276
|
-
properties[key] =
|
|
5312
|
+
properties[key] = Default4(additionalProperties, `${path}/${key}`, properties[key]);
|
|
4277
5313
|
}
|
|
4278
5314
|
return properties;
|
|
4279
5315
|
}
|
|
4280
|
-
function
|
|
4281
|
-
const defaulted =
|
|
5316
|
+
function FromRecord11(schema, references, path, value) {
|
|
5317
|
+
const defaulted = Default4(schema, path, value);
|
|
4282
5318
|
if (!IsObject2(value))
|
|
4283
5319
|
return defaulted;
|
|
4284
5320
|
const pattern = Object.getOwnPropertyNames(schema.patternProperties)[0];
|
|
@@ -4286,7 +5322,7 @@ function FromRecord7(schema, references, path, value) {
|
|
|
4286
5322
|
const knownProperties = { ...defaulted };
|
|
4287
5323
|
for (const key of Object.getOwnPropertyNames(value))
|
|
4288
5324
|
if (knownKeys.test(key)) {
|
|
4289
|
-
knownProperties[key] =
|
|
5325
|
+
knownProperties[key] = Visit12(schema.patternProperties[pattern], references, `${path}/${key}`, knownProperties[key]);
|
|
4290
5326
|
}
|
|
4291
5327
|
if (!IsSchema(schema.additionalProperties)) {
|
|
4292
5328
|
return knownProperties;
|
|
@@ -4296,126 +5332,126 @@ function FromRecord7(schema, references, path, value) {
|
|
|
4296
5332
|
const properties = { ...knownProperties };
|
|
4297
5333
|
for (const key of unknownKeys)
|
|
4298
5334
|
if (!knownKeys.test(key)) {
|
|
4299
|
-
properties[key] =
|
|
5335
|
+
properties[key] = Default4(additionalProperties, `${path}/${key}`, properties[key]);
|
|
4300
5336
|
}
|
|
4301
5337
|
return properties;
|
|
4302
5338
|
}
|
|
4303
|
-
function
|
|
5339
|
+
function FromRef12(schema, references, path, value) {
|
|
4304
5340
|
const target = Deref(schema, references);
|
|
4305
|
-
const resolved =
|
|
4306
|
-
return
|
|
5341
|
+
const resolved = Visit12(target, references, path, value);
|
|
5342
|
+
return Default4(schema, path, resolved);
|
|
4307
5343
|
}
|
|
4308
|
-
function
|
|
5344
|
+
function FromThis8(schema, references, path, value) {
|
|
4309
5345
|
const target = Deref(schema, references);
|
|
4310
|
-
const resolved =
|
|
4311
|
-
return
|
|
5346
|
+
const resolved = Visit12(target, references, path, value);
|
|
5347
|
+
return Default4(schema, path, resolved);
|
|
4312
5348
|
}
|
|
4313
|
-
function
|
|
4314
|
-
const value1 =
|
|
4315
|
-
return IsArray2(schema.items) ? schema.items.map((schema2, index) =>
|
|
5349
|
+
function FromTuple13(schema, references, path, value) {
|
|
5350
|
+
const value1 = Default4(schema, path, value);
|
|
5351
|
+
return IsArray2(schema.items) ? schema.items.map((schema2, index) => Visit12(schema2, references, `${path}/${index}`, value1[index])) : [];
|
|
4316
5352
|
}
|
|
4317
|
-
function
|
|
5353
|
+
function FromUnion18(schema, references, path, value) {
|
|
4318
5354
|
for (const subschema of schema.anyOf) {
|
|
4319
5355
|
if (!Check(subschema, references, value))
|
|
4320
5356
|
continue;
|
|
4321
|
-
const value1 =
|
|
4322
|
-
return
|
|
5357
|
+
const value1 = Visit12(subschema, references, path, value);
|
|
5358
|
+
return Default4(schema, path, value1);
|
|
4323
5359
|
}
|
|
4324
5360
|
for (const subschema of schema.anyOf) {
|
|
4325
|
-
const value1 =
|
|
5361
|
+
const value1 = Visit12(subschema, references, path, value);
|
|
4326
5362
|
if (!Check(schema, references, value1))
|
|
4327
5363
|
continue;
|
|
4328
|
-
return
|
|
5364
|
+
return Default4(schema, path, value1);
|
|
4329
5365
|
}
|
|
4330
|
-
return
|
|
5366
|
+
return Default4(schema, path, value);
|
|
4331
5367
|
}
|
|
4332
|
-
function
|
|
5368
|
+
function Visit12(schema, references, path, value) {
|
|
4333
5369
|
const references_ = Pushref(schema, references);
|
|
4334
5370
|
const schema_ = schema;
|
|
4335
5371
|
switch (schema[Kind]) {
|
|
4336
5372
|
case "Array":
|
|
4337
|
-
return
|
|
5373
|
+
return FromArray15(schema_, references_, path, value);
|
|
4338
5374
|
case "Import":
|
|
4339
|
-
return
|
|
5375
|
+
return FromImport8(schema_, references_, path, value);
|
|
4340
5376
|
case "Intersect":
|
|
4341
|
-
return
|
|
5377
|
+
return FromIntersect16(schema_, references_, path, value);
|
|
4342
5378
|
case "Not":
|
|
4343
|
-
return
|
|
5379
|
+
return FromNot6(schema_, references_, path, value);
|
|
4344
5380
|
case "Object":
|
|
4345
|
-
return
|
|
5381
|
+
return FromObject16(schema_, references_, path, value);
|
|
4346
5382
|
case "Record":
|
|
4347
|
-
return
|
|
5383
|
+
return FromRecord11(schema_, references_, path, value);
|
|
4348
5384
|
case "Ref":
|
|
4349
|
-
return
|
|
5385
|
+
return FromRef12(schema_, references_, path, value);
|
|
4350
5386
|
case "This":
|
|
4351
|
-
return
|
|
5387
|
+
return FromThis8(schema_, references_, path, value);
|
|
4352
5388
|
case "Tuple":
|
|
4353
|
-
return
|
|
5389
|
+
return FromTuple13(schema_, references_, path, value);
|
|
4354
5390
|
case "Union":
|
|
4355
|
-
return
|
|
5391
|
+
return FromUnion18(schema_, references_, path, value);
|
|
4356
5392
|
default:
|
|
4357
|
-
return
|
|
5393
|
+
return Default4(schema_, path, value);
|
|
4358
5394
|
}
|
|
4359
5395
|
}
|
|
4360
5396
|
function TransformEncode(schema, references, value) {
|
|
4361
|
-
return
|
|
5397
|
+
return Visit12(schema, references, "", value);
|
|
4362
5398
|
}
|
|
4363
5399
|
|
|
4364
5400
|
// ../../node_modules/.pnpm/@sinclair+typebox@0.34.52/node_modules/@sinclair/typebox/build/esm/value/transform/has.mjs
|
|
4365
|
-
function
|
|
4366
|
-
return IsTransform(schema) ||
|
|
5401
|
+
function FromArray16(schema, references) {
|
|
5402
|
+
return IsTransform(schema) || Visit13(schema.items, references);
|
|
4367
5403
|
}
|
|
4368
|
-
function
|
|
4369
|
-
return IsTransform(schema) ||
|
|
5404
|
+
function FromAsyncIterator7(schema, references) {
|
|
5405
|
+
return IsTransform(schema) || Visit13(schema.items, references);
|
|
4370
5406
|
}
|
|
4371
|
-
function
|
|
4372
|
-
return IsTransform(schema) ||
|
|
5407
|
+
function FromConstructor8(schema, references) {
|
|
5408
|
+
return IsTransform(schema) || Visit13(schema.returns, references) || schema.parameters.some((schema2) => Visit13(schema2, references));
|
|
4373
5409
|
}
|
|
4374
|
-
function
|
|
4375
|
-
return IsTransform(schema) ||
|
|
5410
|
+
function FromFunction7(schema, references) {
|
|
5411
|
+
return IsTransform(schema) || Visit13(schema.returns, references) || schema.parameters.some((schema2) => Visit13(schema2, references));
|
|
4376
5412
|
}
|
|
4377
|
-
function
|
|
4378
|
-
return IsTransform(schema) || IsTransform(schema.unevaluatedProperties) || schema.allOf.some((schema2) =>
|
|
5413
|
+
function FromIntersect17(schema, references) {
|
|
5414
|
+
return IsTransform(schema) || IsTransform(schema.unevaluatedProperties) || schema.allOf.some((schema2) => Visit13(schema2, references));
|
|
4379
5415
|
}
|
|
4380
|
-
function
|
|
5416
|
+
function FromImport9(schema, references) {
|
|
4381
5417
|
const additional = globalThis.Object.getOwnPropertyNames(schema.$defs).reduce((result, key) => [...result, schema.$defs[key]], []);
|
|
4382
5418
|
const target = schema.$defs[schema.$ref];
|
|
4383
|
-
return IsTransform(schema) ||
|
|
5419
|
+
return IsTransform(schema) || Visit13(target, [...additional, ...references]);
|
|
4384
5420
|
}
|
|
4385
|
-
function
|
|
4386
|
-
return IsTransform(schema) ||
|
|
5421
|
+
function FromIterator7(schema, references) {
|
|
5422
|
+
return IsTransform(schema) || Visit13(schema.items, references);
|
|
4387
5423
|
}
|
|
4388
|
-
function
|
|
4389
|
-
return IsTransform(schema) ||
|
|
5424
|
+
function FromNot7(schema, references) {
|
|
5425
|
+
return IsTransform(schema) || Visit13(schema.not, references);
|
|
4390
5426
|
}
|
|
4391
|
-
function
|
|
4392
|
-
return IsTransform(schema) || Object.values(schema.properties).some((schema2) =>
|
|
5427
|
+
function FromObject17(schema, references) {
|
|
5428
|
+
return IsTransform(schema) || Object.values(schema.properties).some((schema2) => Visit13(schema2, references)) || IsSchema(schema.additionalProperties) && Visit13(schema.additionalProperties, references);
|
|
4393
5429
|
}
|
|
4394
|
-
function
|
|
4395
|
-
return IsTransform(schema) ||
|
|
5430
|
+
function FromPromise7(schema, references) {
|
|
5431
|
+
return IsTransform(schema) || Visit13(schema.item, references);
|
|
4396
5432
|
}
|
|
4397
|
-
function
|
|
5433
|
+
function FromRecord12(schema, references) {
|
|
4398
5434
|
const pattern = Object.getOwnPropertyNames(schema.patternProperties)[0];
|
|
4399
5435
|
const property = schema.patternProperties[pattern];
|
|
4400
|
-
return IsTransform(schema) ||
|
|
5436
|
+
return IsTransform(schema) || Visit13(property, references) || IsSchema(schema.additionalProperties) && IsTransform(schema.additionalProperties);
|
|
4401
5437
|
}
|
|
4402
|
-
function
|
|
5438
|
+
function FromRef13(schema, references) {
|
|
4403
5439
|
if (IsTransform(schema))
|
|
4404
5440
|
return true;
|
|
4405
|
-
return
|
|
5441
|
+
return Visit13(Deref(schema, references), references);
|
|
4406
5442
|
}
|
|
4407
|
-
function
|
|
5443
|
+
function FromThis9(schema, references) {
|
|
4408
5444
|
if (IsTransform(schema))
|
|
4409
5445
|
return true;
|
|
4410
|
-
return
|
|
5446
|
+
return Visit13(Deref(schema, references), references);
|
|
4411
5447
|
}
|
|
4412
|
-
function
|
|
4413
|
-
return IsTransform(schema) || !IsUndefined2(schema.items) && schema.items.some((schema2) =>
|
|
5448
|
+
function FromTuple14(schema, references) {
|
|
5449
|
+
return IsTransform(schema) || !IsUndefined2(schema.items) && schema.items.some((schema2) => Visit13(schema2, references));
|
|
4414
5450
|
}
|
|
4415
|
-
function
|
|
4416
|
-
return IsTransform(schema) || schema.anyOf.some((schema2) =>
|
|
5451
|
+
function FromUnion19(schema, references) {
|
|
5452
|
+
return IsTransform(schema) || schema.anyOf.some((schema2) => Visit13(schema2, references));
|
|
4417
5453
|
}
|
|
4418
|
-
function
|
|
5454
|
+
function Visit13(schema, references) {
|
|
4419
5455
|
const references_ = Pushref(schema, references);
|
|
4420
5456
|
const schema_ = schema;
|
|
4421
5457
|
if (schema.$id && visited.has(schema.$id))
|
|
@@ -4424,35 +5460,35 @@ function Visit9(schema, references) {
|
|
|
4424
5460
|
visited.add(schema.$id);
|
|
4425
5461
|
switch (schema[Kind]) {
|
|
4426
5462
|
case "Array":
|
|
4427
|
-
return
|
|
5463
|
+
return FromArray16(schema_, references_);
|
|
4428
5464
|
case "AsyncIterator":
|
|
4429
|
-
return
|
|
5465
|
+
return FromAsyncIterator7(schema_, references_);
|
|
4430
5466
|
case "Constructor":
|
|
4431
|
-
return
|
|
5467
|
+
return FromConstructor8(schema_, references_);
|
|
4432
5468
|
case "Function":
|
|
4433
|
-
return
|
|
5469
|
+
return FromFunction7(schema_, references_);
|
|
4434
5470
|
case "Import":
|
|
4435
|
-
return
|
|
5471
|
+
return FromImport9(schema_, references_);
|
|
4436
5472
|
case "Intersect":
|
|
4437
|
-
return
|
|
5473
|
+
return FromIntersect17(schema_, references_);
|
|
4438
5474
|
case "Iterator":
|
|
4439
|
-
return
|
|
5475
|
+
return FromIterator7(schema_, references_);
|
|
4440
5476
|
case "Not":
|
|
4441
|
-
return
|
|
5477
|
+
return FromNot7(schema_, references_);
|
|
4442
5478
|
case "Object":
|
|
4443
|
-
return
|
|
5479
|
+
return FromObject17(schema_, references_);
|
|
4444
5480
|
case "Promise":
|
|
4445
|
-
return
|
|
5481
|
+
return FromPromise7(schema_, references_);
|
|
4446
5482
|
case "Record":
|
|
4447
|
-
return
|
|
5483
|
+
return FromRecord12(schema_, references_);
|
|
4448
5484
|
case "Ref":
|
|
4449
|
-
return
|
|
5485
|
+
return FromRef13(schema_, references_);
|
|
4450
5486
|
case "This":
|
|
4451
|
-
return
|
|
5487
|
+
return FromThis9(schema_, references_);
|
|
4452
5488
|
case "Tuple":
|
|
4453
|
-
return
|
|
5489
|
+
return FromTuple14(schema_, references_);
|
|
4454
5490
|
case "Union":
|
|
4455
|
-
return
|
|
5491
|
+
return FromUnion19(schema_, references_);
|
|
4456
5492
|
default:
|
|
4457
5493
|
return IsTransform(schema);
|
|
4458
5494
|
}
|
|
@@ -4460,8 +5496,604 @@ function Visit9(schema, references) {
|
|
|
4460
5496
|
var visited = /* @__PURE__ */ new Set();
|
|
4461
5497
|
function HasTransform(schema, references) {
|
|
4462
5498
|
visited.clear();
|
|
4463
|
-
return
|
|
5499
|
+
return Visit13(schema, references);
|
|
5500
|
+
}
|
|
5501
|
+
|
|
5502
|
+
// ../../node_modules/.pnpm/@sinclair+typebox@0.34.52/node_modules/@sinclair/typebox/build/esm/value/decode/decode.mjs
|
|
5503
|
+
function Decode(...args) {
|
|
5504
|
+
const [schema, references, value] = args.length === 3 ? [args[0], args[1], args[2]] : [args[0], [], args[1]];
|
|
5505
|
+
if (!Check(schema, references, value))
|
|
5506
|
+
throw new TransformDecodeCheckError(schema, value, Errors(schema, references, value).First());
|
|
5507
|
+
return HasTransform(schema, references) ? TransformDecode(schema, references, value) : value;
|
|
5508
|
+
}
|
|
5509
|
+
|
|
5510
|
+
// ../../node_modules/.pnpm/@sinclair+typebox@0.34.52/node_modules/@sinclair/typebox/build/esm/value/default/default.mjs
|
|
5511
|
+
function ValueOrDefault(schema, value) {
|
|
5512
|
+
const defaultValue = HasPropertyKey2(schema, "default") ? schema.default : void 0;
|
|
5513
|
+
const clone = IsFunction2(defaultValue) ? defaultValue() : Clone2(defaultValue);
|
|
5514
|
+
return IsUndefined2(value) ? clone : IsObject2(value) && IsObject2(clone) ? Object.assign(clone, value) : value;
|
|
5515
|
+
}
|
|
5516
|
+
function HasDefaultProperty(schema) {
|
|
5517
|
+
return IsKind(schema) && "default" in schema;
|
|
5518
|
+
}
|
|
5519
|
+
function FromArray17(schema, references, value) {
|
|
5520
|
+
if (IsArray2(value)) {
|
|
5521
|
+
for (let i = 0; i < value.length; i++) {
|
|
5522
|
+
value[i] = Visit14(schema.items, references, value[i]);
|
|
5523
|
+
}
|
|
5524
|
+
return value;
|
|
5525
|
+
}
|
|
5526
|
+
const defaulted = ValueOrDefault(schema, value);
|
|
5527
|
+
if (!IsArray2(defaulted))
|
|
5528
|
+
return defaulted;
|
|
5529
|
+
for (let i = 0; i < defaulted.length; i++) {
|
|
5530
|
+
defaulted[i] = Visit14(schema.items, references, defaulted[i]);
|
|
5531
|
+
}
|
|
5532
|
+
return defaulted;
|
|
5533
|
+
}
|
|
5534
|
+
function FromDate7(schema, references, value) {
|
|
5535
|
+
return IsDate2(value) ? value : ValueOrDefault(schema, value);
|
|
5536
|
+
}
|
|
5537
|
+
function FromImport10(schema, references, value) {
|
|
5538
|
+
const definitions = globalThis.Object.values(schema.$defs);
|
|
5539
|
+
const target = schema.$defs[schema.$ref];
|
|
5540
|
+
return Visit14(target, [...references, ...definitions], value);
|
|
5541
|
+
}
|
|
5542
|
+
function FromIntersect18(schema, references, value) {
|
|
5543
|
+
const defaulted = ValueOrDefault(schema, value);
|
|
5544
|
+
return schema.allOf.reduce((acc, schema2) => {
|
|
5545
|
+
const next = Visit14(schema2, references, defaulted);
|
|
5546
|
+
return IsObject2(next) ? { ...acc, ...next } : next;
|
|
5547
|
+
}, {});
|
|
5548
|
+
}
|
|
5549
|
+
function FromObject18(schema, references, value) {
|
|
5550
|
+
const defaulted = ValueOrDefault(schema, value);
|
|
5551
|
+
if (!IsObject2(defaulted))
|
|
5552
|
+
return defaulted;
|
|
5553
|
+
const knownPropertyKeys = Object.getOwnPropertyNames(schema.properties);
|
|
5554
|
+
for (const key of knownPropertyKeys) {
|
|
5555
|
+
const propertyValue = Visit14(schema.properties[key], references, defaulted[key]);
|
|
5556
|
+
if (IsUndefined2(propertyValue))
|
|
5557
|
+
continue;
|
|
5558
|
+
defaulted[key] = Visit14(schema.properties[key], references, defaulted[key]);
|
|
5559
|
+
}
|
|
5560
|
+
if (!HasDefaultProperty(schema.additionalProperties))
|
|
5561
|
+
return defaulted;
|
|
5562
|
+
for (const key of Object.getOwnPropertyNames(defaulted)) {
|
|
5563
|
+
if (knownPropertyKeys.includes(key))
|
|
5564
|
+
continue;
|
|
5565
|
+
defaulted[key] = Visit14(schema.additionalProperties, references, defaulted[key]);
|
|
5566
|
+
}
|
|
5567
|
+
return defaulted;
|
|
5568
|
+
}
|
|
5569
|
+
function FromRecord13(schema, references, value) {
|
|
5570
|
+
const defaulted = ValueOrDefault(schema, value);
|
|
5571
|
+
if (!IsObject2(defaulted))
|
|
5572
|
+
return defaulted;
|
|
5573
|
+
const additionalPropertiesSchema = schema.additionalProperties;
|
|
5574
|
+
const [propertyKeyPattern, propertySchema] = Object.entries(schema.patternProperties)[0];
|
|
5575
|
+
const knownPropertyKey = new RegExp(propertyKeyPattern);
|
|
5576
|
+
for (const key of Object.getOwnPropertyNames(defaulted)) {
|
|
5577
|
+
if (!(knownPropertyKey.test(key) && HasDefaultProperty(propertySchema)))
|
|
5578
|
+
continue;
|
|
5579
|
+
defaulted[key] = Visit14(propertySchema, references, defaulted[key]);
|
|
5580
|
+
}
|
|
5581
|
+
if (!HasDefaultProperty(additionalPropertiesSchema))
|
|
5582
|
+
return defaulted;
|
|
5583
|
+
for (const key of Object.getOwnPropertyNames(defaulted)) {
|
|
5584
|
+
if (knownPropertyKey.test(key))
|
|
5585
|
+
continue;
|
|
5586
|
+
defaulted[key] = Visit14(additionalPropertiesSchema, references, defaulted[key]);
|
|
5587
|
+
}
|
|
5588
|
+
return defaulted;
|
|
5589
|
+
}
|
|
5590
|
+
function FromRef14(schema, references, value) {
|
|
5591
|
+
return Visit14(Deref(schema, references), references, ValueOrDefault(schema, value));
|
|
5592
|
+
}
|
|
5593
|
+
function FromThis10(schema, references, value) {
|
|
5594
|
+
return Visit14(Deref(schema, references), references, value);
|
|
5595
|
+
}
|
|
5596
|
+
function FromTuple15(schema, references, value) {
|
|
5597
|
+
const defaulted = ValueOrDefault(schema, value);
|
|
5598
|
+
if (!IsArray2(defaulted) || IsUndefined2(schema.items))
|
|
5599
|
+
return defaulted;
|
|
5600
|
+
const [items, max] = [schema.items, Math.max(schema.items.length, defaulted.length)];
|
|
5601
|
+
for (let i = 0; i < max; i++) {
|
|
5602
|
+
if (i < items.length)
|
|
5603
|
+
defaulted[i] = Visit14(items[i], references, defaulted[i]);
|
|
5604
|
+
}
|
|
5605
|
+
return defaulted;
|
|
5606
|
+
}
|
|
5607
|
+
function FromUnion20(schema, references, value) {
|
|
5608
|
+
const defaulted = ValueOrDefault(schema, value);
|
|
5609
|
+
for (const inner of schema.anyOf) {
|
|
5610
|
+
const result = Visit14(inner, references, Clone2(defaulted));
|
|
5611
|
+
if (Check(inner, references, result)) {
|
|
5612
|
+
return result;
|
|
5613
|
+
}
|
|
5614
|
+
}
|
|
5615
|
+
return defaulted;
|
|
5616
|
+
}
|
|
5617
|
+
function Visit14(schema, references, value) {
|
|
5618
|
+
const references_ = Pushref(schema, references);
|
|
5619
|
+
const schema_ = schema;
|
|
5620
|
+
switch (schema_[Kind]) {
|
|
5621
|
+
case "Array":
|
|
5622
|
+
return FromArray17(schema_, references_, value);
|
|
5623
|
+
case "Date":
|
|
5624
|
+
return FromDate7(schema_, references_, value);
|
|
5625
|
+
case "Import":
|
|
5626
|
+
return FromImport10(schema_, references_, value);
|
|
5627
|
+
case "Intersect":
|
|
5628
|
+
return FromIntersect18(schema_, references_, value);
|
|
5629
|
+
case "Object":
|
|
5630
|
+
return FromObject18(schema_, references_, value);
|
|
5631
|
+
case "Record":
|
|
5632
|
+
return FromRecord13(schema_, references_, value);
|
|
5633
|
+
case "Ref":
|
|
5634
|
+
return FromRef14(schema_, references_, value);
|
|
5635
|
+
case "This":
|
|
5636
|
+
return FromThis10(schema_, references_, value);
|
|
5637
|
+
case "Tuple":
|
|
5638
|
+
return FromTuple15(schema_, references_, value);
|
|
5639
|
+
case "Union":
|
|
5640
|
+
return FromUnion20(schema_, references_, value);
|
|
5641
|
+
default:
|
|
5642
|
+
return ValueOrDefault(schema_, value);
|
|
5643
|
+
}
|
|
5644
|
+
}
|
|
5645
|
+
function Default5(...args) {
|
|
5646
|
+
return args.length === 3 ? Visit14(args[0], args[1], args[2]) : Visit14(args[0], [], args[1]);
|
|
5647
|
+
}
|
|
5648
|
+
|
|
5649
|
+
// ../../node_modules/.pnpm/@sinclair+typebox@0.34.52/node_modules/@sinclair/typebox/build/esm/value/pointer/pointer.mjs
|
|
5650
|
+
var pointer_exports = {};
|
|
5651
|
+
__export(pointer_exports, {
|
|
5652
|
+
Delete: () => Delete3,
|
|
5653
|
+
Format: () => Format,
|
|
5654
|
+
Get: () => Get3,
|
|
5655
|
+
Has: () => Has3,
|
|
5656
|
+
Set: () => Set4,
|
|
5657
|
+
ValuePointerRootDeleteError: () => ValuePointerRootDeleteError,
|
|
5658
|
+
ValuePointerRootSetError: () => ValuePointerRootSetError
|
|
5659
|
+
});
|
|
5660
|
+
var ValuePointerRootSetError = class extends TypeBoxError {
|
|
5661
|
+
constructor(value, path, update) {
|
|
5662
|
+
super("Cannot set root value");
|
|
5663
|
+
this.value = value;
|
|
5664
|
+
this.path = path;
|
|
5665
|
+
this.update = update;
|
|
5666
|
+
}
|
|
5667
|
+
};
|
|
5668
|
+
var ValuePointerRootDeleteError = class extends TypeBoxError {
|
|
5669
|
+
constructor(value, path) {
|
|
5670
|
+
super("Cannot delete root value");
|
|
5671
|
+
this.value = value;
|
|
5672
|
+
this.path = path;
|
|
5673
|
+
}
|
|
5674
|
+
};
|
|
5675
|
+
function Escape2(component) {
|
|
5676
|
+
return component.indexOf("~") === -1 ? component : component.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
5677
|
+
}
|
|
5678
|
+
function* Format(pointer) {
|
|
5679
|
+
if (pointer === "")
|
|
5680
|
+
return;
|
|
5681
|
+
let [start, end] = [0, 0];
|
|
5682
|
+
for (let i = 0; i < pointer.length; i++) {
|
|
5683
|
+
const char = pointer.charAt(i);
|
|
5684
|
+
if (char === "/") {
|
|
5685
|
+
if (i === 0) {
|
|
5686
|
+
start = i + 1;
|
|
5687
|
+
} else {
|
|
5688
|
+
end = i;
|
|
5689
|
+
yield Escape2(pointer.slice(start, end));
|
|
5690
|
+
start = i + 1;
|
|
5691
|
+
}
|
|
5692
|
+
} else {
|
|
5693
|
+
end = i;
|
|
5694
|
+
}
|
|
5695
|
+
}
|
|
5696
|
+
yield Escape2(pointer.slice(start));
|
|
5697
|
+
}
|
|
5698
|
+
function Set4(value, pointer, update) {
|
|
5699
|
+
if (pointer === "")
|
|
5700
|
+
throw new ValuePointerRootSetError(value, pointer, update);
|
|
5701
|
+
let [owner, next, key] = [null, value, ""];
|
|
5702
|
+
for (const component of Format(pointer)) {
|
|
5703
|
+
if (next[component] === void 0)
|
|
5704
|
+
next[component] = {};
|
|
5705
|
+
owner = next;
|
|
5706
|
+
next = next[component];
|
|
5707
|
+
key = component;
|
|
5708
|
+
}
|
|
5709
|
+
owner[key] = update;
|
|
5710
|
+
}
|
|
5711
|
+
function Delete3(value, pointer) {
|
|
5712
|
+
if (pointer === "")
|
|
5713
|
+
throw new ValuePointerRootDeleteError(value, pointer);
|
|
5714
|
+
let [owner, next, key] = [null, value, ""];
|
|
5715
|
+
for (const component of Format(pointer)) {
|
|
5716
|
+
if (next[component] === void 0 || next[component] === null)
|
|
5717
|
+
return;
|
|
5718
|
+
owner = next;
|
|
5719
|
+
next = next[component];
|
|
5720
|
+
key = component;
|
|
5721
|
+
}
|
|
5722
|
+
if (Array.isArray(owner)) {
|
|
5723
|
+
const index = parseInt(key);
|
|
5724
|
+
owner.splice(index, 1);
|
|
5725
|
+
} else {
|
|
5726
|
+
delete owner[key];
|
|
5727
|
+
}
|
|
5728
|
+
}
|
|
5729
|
+
function Has3(value, pointer) {
|
|
5730
|
+
if (pointer === "")
|
|
5731
|
+
return true;
|
|
5732
|
+
let [owner, next, key] = [null, value, ""];
|
|
5733
|
+
for (const component of Format(pointer)) {
|
|
5734
|
+
if (next[component] === void 0)
|
|
5735
|
+
return false;
|
|
5736
|
+
owner = next;
|
|
5737
|
+
next = next[component];
|
|
5738
|
+
key = component;
|
|
5739
|
+
}
|
|
5740
|
+
return Object.getOwnPropertyNames(owner).includes(key);
|
|
5741
|
+
}
|
|
5742
|
+
function Get3(value, pointer) {
|
|
5743
|
+
if (pointer === "")
|
|
5744
|
+
return value;
|
|
5745
|
+
let current = value;
|
|
5746
|
+
for (const component of Format(pointer)) {
|
|
5747
|
+
if (current[component] === void 0)
|
|
5748
|
+
return void 0;
|
|
5749
|
+
current = current[component];
|
|
5750
|
+
}
|
|
5751
|
+
return current;
|
|
5752
|
+
}
|
|
5753
|
+
|
|
5754
|
+
// ../../node_modules/.pnpm/@sinclair+typebox@0.34.52/node_modules/@sinclair/typebox/build/esm/value/equal/equal.mjs
|
|
5755
|
+
function ObjectType3(left, right) {
|
|
5756
|
+
if (!IsObject2(right))
|
|
5757
|
+
return false;
|
|
5758
|
+
const leftKeys = [...Object.keys(left), ...Object.getOwnPropertySymbols(left)];
|
|
5759
|
+
const rightKeys = [...Object.keys(right), ...Object.getOwnPropertySymbols(right)];
|
|
5760
|
+
if (leftKeys.length !== rightKeys.length)
|
|
5761
|
+
return false;
|
|
5762
|
+
return leftKeys.every((key) => Equal(left[key], right[key]));
|
|
5763
|
+
}
|
|
5764
|
+
function DateType3(left, right) {
|
|
5765
|
+
return IsDate2(right) && left.getTime() === right.getTime();
|
|
5766
|
+
}
|
|
5767
|
+
function ArrayType3(left, right) {
|
|
5768
|
+
if (!IsArray2(right) || left.length !== right.length)
|
|
5769
|
+
return false;
|
|
5770
|
+
return left.every((value, index) => Equal(value, right[index]));
|
|
5771
|
+
}
|
|
5772
|
+
function TypedArrayType(left, right) {
|
|
5773
|
+
if (!IsTypedArray(right) || left.length !== right.length || Object.getPrototypeOf(left).constructor.name !== Object.getPrototypeOf(right).constructor.name)
|
|
5774
|
+
return false;
|
|
5775
|
+
return left.every((value, index) => Equal(value, right[index]));
|
|
5776
|
+
}
|
|
5777
|
+
function ValueType(left, right) {
|
|
5778
|
+
return left === right;
|
|
5779
|
+
}
|
|
5780
|
+
function Equal(left, right) {
|
|
5781
|
+
if (IsDate2(left))
|
|
5782
|
+
return DateType3(left, right);
|
|
5783
|
+
if (IsTypedArray(left))
|
|
5784
|
+
return TypedArrayType(left, right);
|
|
5785
|
+
if (IsArray2(left))
|
|
5786
|
+
return ArrayType3(left, right);
|
|
5787
|
+
if (IsObject2(left))
|
|
5788
|
+
return ObjectType3(left, right);
|
|
5789
|
+
if (IsValueType(left))
|
|
5790
|
+
return ValueType(left, right);
|
|
5791
|
+
throw new Error("ValueEquals: Unable to compare value");
|
|
5792
|
+
}
|
|
5793
|
+
|
|
5794
|
+
// ../../node_modules/.pnpm/@sinclair+typebox@0.34.52/node_modules/@sinclair/typebox/build/esm/value/delta/delta.mjs
|
|
5795
|
+
var Insert = Object2({
|
|
5796
|
+
type: Literal("insert"),
|
|
5797
|
+
path: String2(),
|
|
5798
|
+
value: Unknown()
|
|
5799
|
+
});
|
|
5800
|
+
var Update = Object2({
|
|
5801
|
+
type: Literal("update"),
|
|
5802
|
+
path: String2(),
|
|
5803
|
+
value: Unknown()
|
|
5804
|
+
});
|
|
5805
|
+
var Delete4 = Object2({
|
|
5806
|
+
type: Literal("delete"),
|
|
5807
|
+
path: String2()
|
|
5808
|
+
});
|
|
5809
|
+
var Edit = Union([Insert, Update, Delete4]);
|
|
5810
|
+
var ValueDiffError = class extends TypeBoxError {
|
|
5811
|
+
constructor(value, message) {
|
|
5812
|
+
super(message);
|
|
5813
|
+
this.value = value;
|
|
5814
|
+
}
|
|
5815
|
+
};
|
|
5816
|
+
function CreateUpdate(path, value) {
|
|
5817
|
+
return { type: "update", path, value };
|
|
5818
|
+
}
|
|
5819
|
+
function CreateInsert(path, value) {
|
|
5820
|
+
return { type: "insert", path, value };
|
|
5821
|
+
}
|
|
5822
|
+
function CreateDelete(path) {
|
|
5823
|
+
return { type: "delete", path };
|
|
5824
|
+
}
|
|
5825
|
+
function AssertDiffable(value) {
|
|
5826
|
+
if (globalThis.Object.getOwnPropertySymbols(value).length > 0)
|
|
5827
|
+
throw new ValueDiffError(value, "Cannot diff objects with symbols");
|
|
5828
|
+
}
|
|
5829
|
+
function* ObjectType4(path, current, next) {
|
|
5830
|
+
AssertDiffable(current);
|
|
5831
|
+
AssertDiffable(next);
|
|
5832
|
+
if (!IsStandardObject(next))
|
|
5833
|
+
return yield CreateUpdate(path, next);
|
|
5834
|
+
const currentKeys = globalThis.Object.getOwnPropertyNames(current);
|
|
5835
|
+
const nextKeys = globalThis.Object.getOwnPropertyNames(next);
|
|
5836
|
+
for (const key of nextKeys) {
|
|
5837
|
+
if (HasPropertyKey2(current, key))
|
|
5838
|
+
continue;
|
|
5839
|
+
yield CreateInsert(`${path}/${key}`, next[key]);
|
|
5840
|
+
}
|
|
5841
|
+
for (const key of currentKeys) {
|
|
5842
|
+
if (!HasPropertyKey2(next, key))
|
|
5843
|
+
continue;
|
|
5844
|
+
if (Equal(current, next))
|
|
5845
|
+
continue;
|
|
5846
|
+
yield* Visit15(`${path}/${key}`, current[key], next[key]);
|
|
5847
|
+
}
|
|
5848
|
+
for (const key of currentKeys) {
|
|
5849
|
+
if (HasPropertyKey2(next, key))
|
|
5850
|
+
continue;
|
|
5851
|
+
yield CreateDelete(`${path}/${key}`);
|
|
5852
|
+
}
|
|
5853
|
+
}
|
|
5854
|
+
function* ArrayType4(path, current, next) {
|
|
5855
|
+
if (!IsArray2(next))
|
|
5856
|
+
return yield CreateUpdate(path, next);
|
|
5857
|
+
for (let i = 0; i < Math.min(current.length, next.length); i++) {
|
|
5858
|
+
yield* Visit15(`${path}/${i}`, current[i], next[i]);
|
|
5859
|
+
}
|
|
5860
|
+
for (let i = 0; i < next.length; i++) {
|
|
5861
|
+
if (i < current.length)
|
|
5862
|
+
continue;
|
|
5863
|
+
yield CreateInsert(`${path}/${i}`, next[i]);
|
|
5864
|
+
}
|
|
5865
|
+
for (let i = current.length - 1; i >= 0; i--) {
|
|
5866
|
+
if (i < next.length)
|
|
5867
|
+
continue;
|
|
5868
|
+
yield CreateDelete(`${path}/${i}`);
|
|
5869
|
+
}
|
|
5870
|
+
}
|
|
5871
|
+
function* TypedArrayType2(path, current, next) {
|
|
5872
|
+
if (!IsTypedArray(next) || current.length !== next.length || globalThis.Object.getPrototypeOf(current).constructor.name !== globalThis.Object.getPrototypeOf(next).constructor.name)
|
|
5873
|
+
return yield CreateUpdate(path, next);
|
|
5874
|
+
for (let i = 0; i < Math.min(current.length, next.length); i++) {
|
|
5875
|
+
yield* Visit15(`${path}/${i}`, current[i], next[i]);
|
|
5876
|
+
}
|
|
5877
|
+
}
|
|
5878
|
+
function* ValueType2(path, current, next) {
|
|
5879
|
+
if (current === next)
|
|
5880
|
+
return;
|
|
5881
|
+
yield CreateUpdate(path, next);
|
|
5882
|
+
}
|
|
5883
|
+
function* Visit15(path, current, next) {
|
|
5884
|
+
if (IsStandardObject(current))
|
|
5885
|
+
return yield* ObjectType4(path, current, next);
|
|
5886
|
+
if (IsArray2(current))
|
|
5887
|
+
return yield* ArrayType4(path, current, next);
|
|
5888
|
+
if (IsTypedArray(current))
|
|
5889
|
+
return yield* TypedArrayType2(path, current, next);
|
|
5890
|
+
if (IsValueType(current))
|
|
5891
|
+
return yield* ValueType2(path, current, next);
|
|
5892
|
+
throw new ValueDiffError(current, "Unable to diff value");
|
|
5893
|
+
}
|
|
5894
|
+
function Diff(current, next) {
|
|
5895
|
+
return [...Visit15("", current, next)];
|
|
5896
|
+
}
|
|
5897
|
+
function IsRootUpdate(edits) {
|
|
5898
|
+
return edits.length > 0 && edits[0].path === "" && edits[0].type === "update";
|
|
5899
|
+
}
|
|
5900
|
+
function IsIdentity(edits) {
|
|
5901
|
+
return edits.length === 0;
|
|
5902
|
+
}
|
|
5903
|
+
function Patch(current, edits) {
|
|
5904
|
+
if (IsRootUpdate(edits)) {
|
|
5905
|
+
return Clone2(edits[0].value);
|
|
5906
|
+
}
|
|
5907
|
+
if (IsIdentity(edits)) {
|
|
5908
|
+
return Clone2(current);
|
|
5909
|
+
}
|
|
5910
|
+
const clone = Clone2(current);
|
|
5911
|
+
for (const edit of edits) {
|
|
5912
|
+
switch (edit.type) {
|
|
5913
|
+
case "insert": {
|
|
5914
|
+
pointer_exports.Set(clone, edit.path, edit.value);
|
|
5915
|
+
break;
|
|
5916
|
+
}
|
|
5917
|
+
case "update": {
|
|
5918
|
+
pointer_exports.Set(clone, edit.path, edit.value);
|
|
5919
|
+
break;
|
|
5920
|
+
}
|
|
5921
|
+
case "delete": {
|
|
5922
|
+
pointer_exports.Delete(clone, edit.path);
|
|
5923
|
+
break;
|
|
5924
|
+
}
|
|
5925
|
+
}
|
|
5926
|
+
}
|
|
5927
|
+
return clone;
|
|
5928
|
+
}
|
|
5929
|
+
|
|
5930
|
+
// ../../node_modules/.pnpm/@sinclair+typebox@0.34.52/node_modules/@sinclair/typebox/build/esm/value/encode/encode.mjs
|
|
5931
|
+
function Encode(...args) {
|
|
5932
|
+
const [schema, references, value] = args.length === 3 ? [args[0], args[1], args[2]] : [args[0], [], args[1]];
|
|
5933
|
+
const encoded = HasTransform(schema, references) ? TransformEncode(schema, references, value) : value;
|
|
5934
|
+
if (!Check(schema, references, encoded))
|
|
5935
|
+
throw new TransformEncodeCheckError(schema, encoded, Errors(schema, references, encoded).First());
|
|
5936
|
+
return encoded;
|
|
5937
|
+
}
|
|
5938
|
+
|
|
5939
|
+
// ../../node_modules/.pnpm/@sinclair+typebox@0.34.52/node_modules/@sinclair/typebox/build/esm/value/mutate/mutate.mjs
|
|
5940
|
+
function IsStandardObject2(value) {
|
|
5941
|
+
return IsObject2(value) && !IsArray2(value);
|
|
5942
|
+
}
|
|
5943
|
+
var ValueMutateError = class extends TypeBoxError {
|
|
5944
|
+
constructor(message) {
|
|
5945
|
+
super(message);
|
|
5946
|
+
}
|
|
5947
|
+
};
|
|
5948
|
+
function ObjectType5(root, path, current, next) {
|
|
5949
|
+
if (!IsStandardObject2(current)) {
|
|
5950
|
+
pointer_exports.Set(root, path, Clone2(next));
|
|
5951
|
+
} else {
|
|
5952
|
+
const currentKeys = Object.getOwnPropertyNames(current);
|
|
5953
|
+
const nextKeys = Object.getOwnPropertyNames(next);
|
|
5954
|
+
for (const currentKey of currentKeys) {
|
|
5955
|
+
if (!nextKeys.includes(currentKey)) {
|
|
5956
|
+
delete current[currentKey];
|
|
5957
|
+
}
|
|
5958
|
+
}
|
|
5959
|
+
for (const nextKey of nextKeys) {
|
|
5960
|
+
if (!currentKeys.includes(nextKey)) {
|
|
5961
|
+
current[nextKey] = null;
|
|
5962
|
+
}
|
|
5963
|
+
}
|
|
5964
|
+
for (const nextKey of nextKeys) {
|
|
5965
|
+
Visit16(root, `${path}/${nextKey}`, current[nextKey], next[nextKey]);
|
|
5966
|
+
}
|
|
5967
|
+
}
|
|
5968
|
+
}
|
|
5969
|
+
function ArrayType5(root, path, current, next) {
|
|
5970
|
+
if (!IsArray2(current)) {
|
|
5971
|
+
pointer_exports.Set(root, path, Clone2(next));
|
|
5972
|
+
} else {
|
|
5973
|
+
for (let index = 0; index < next.length; index++) {
|
|
5974
|
+
Visit16(root, `${path}/${index}`, current[index], next[index]);
|
|
5975
|
+
}
|
|
5976
|
+
current.splice(next.length);
|
|
5977
|
+
}
|
|
5978
|
+
}
|
|
5979
|
+
function TypedArrayType3(root, path, current, next) {
|
|
5980
|
+
if (IsTypedArray(current) && current.length === next.length) {
|
|
5981
|
+
for (let i = 0; i < current.length; i++) {
|
|
5982
|
+
current[i] = next[i];
|
|
5983
|
+
}
|
|
5984
|
+
} else {
|
|
5985
|
+
pointer_exports.Set(root, path, Clone2(next));
|
|
5986
|
+
}
|
|
4464
5987
|
}
|
|
5988
|
+
function ValueType3(root, path, current, next) {
|
|
5989
|
+
if (current === next)
|
|
5990
|
+
return;
|
|
5991
|
+
pointer_exports.Set(root, path, next);
|
|
5992
|
+
}
|
|
5993
|
+
function Visit16(root, path, current, next) {
|
|
5994
|
+
if (IsArray2(next))
|
|
5995
|
+
return ArrayType5(root, path, current, next);
|
|
5996
|
+
if (IsTypedArray(next))
|
|
5997
|
+
return TypedArrayType3(root, path, current, next);
|
|
5998
|
+
if (IsStandardObject2(next))
|
|
5999
|
+
return ObjectType5(root, path, current, next);
|
|
6000
|
+
if (IsValueType(next))
|
|
6001
|
+
return ValueType3(root, path, current, next);
|
|
6002
|
+
}
|
|
6003
|
+
function IsNonMutableValue(value) {
|
|
6004
|
+
return IsTypedArray(value) || IsValueType(value);
|
|
6005
|
+
}
|
|
6006
|
+
function IsMismatchedValue(current, next) {
|
|
6007
|
+
return IsStandardObject2(current) && IsArray2(next) || IsArray2(current) && IsStandardObject2(next);
|
|
6008
|
+
}
|
|
6009
|
+
function Mutate(current, next) {
|
|
6010
|
+
if (IsNonMutableValue(current) || IsNonMutableValue(next))
|
|
6011
|
+
throw new ValueMutateError("Only object and array types can be mutated at the root level");
|
|
6012
|
+
if (IsMismatchedValue(current, next))
|
|
6013
|
+
throw new ValueMutateError("Cannot assign due type mismatch of assignable values");
|
|
6014
|
+
Visit16(current, "", current, next);
|
|
6015
|
+
}
|
|
6016
|
+
|
|
6017
|
+
// ../../node_modules/.pnpm/@sinclair+typebox@0.34.52/node_modules/@sinclair/typebox/build/esm/value/parse/parse.mjs
|
|
6018
|
+
var ParseError = class extends TypeBoxError {
|
|
6019
|
+
constructor(message) {
|
|
6020
|
+
super(message);
|
|
6021
|
+
}
|
|
6022
|
+
};
|
|
6023
|
+
var ParseRegistry;
|
|
6024
|
+
(function(ParseRegistry2) {
|
|
6025
|
+
const registry = /* @__PURE__ */ new Map([
|
|
6026
|
+
["Assert", (type, references, value) => {
|
|
6027
|
+
Assert(type, references, value);
|
|
6028
|
+
return value;
|
|
6029
|
+
}],
|
|
6030
|
+
["Cast", (type, references, value) => Cast(type, references, value)],
|
|
6031
|
+
["Clean", (type, references, value) => Clean(type, references, value)],
|
|
6032
|
+
["Clone", (_type, _references, value) => Clone2(value)],
|
|
6033
|
+
["Convert", (type, references, value) => Convert(type, references, value)],
|
|
6034
|
+
["Decode", (type, references, value) => HasTransform(type, references) ? TransformDecode(type, references, value) : value],
|
|
6035
|
+
["Default", (type, references, value) => Default5(type, references, value)],
|
|
6036
|
+
["Encode", (type, references, value) => HasTransform(type, references) ? TransformEncode(type, references, value) : value]
|
|
6037
|
+
]);
|
|
6038
|
+
function Delete5(key) {
|
|
6039
|
+
registry.delete(key);
|
|
6040
|
+
}
|
|
6041
|
+
ParseRegistry2.Delete = Delete5;
|
|
6042
|
+
function Set5(key, callback) {
|
|
6043
|
+
registry.set(key, callback);
|
|
6044
|
+
}
|
|
6045
|
+
ParseRegistry2.Set = Set5;
|
|
6046
|
+
function Get4(key) {
|
|
6047
|
+
return registry.get(key);
|
|
6048
|
+
}
|
|
6049
|
+
ParseRegistry2.Get = Get4;
|
|
6050
|
+
})(ParseRegistry || (ParseRegistry = {}));
|
|
6051
|
+
var ParseDefault = [
|
|
6052
|
+
"Clone",
|
|
6053
|
+
"Clean",
|
|
6054
|
+
"Default",
|
|
6055
|
+
"Convert",
|
|
6056
|
+
"Assert",
|
|
6057
|
+
"Decode"
|
|
6058
|
+
];
|
|
6059
|
+
function ParseValue(operations, type, references, value) {
|
|
6060
|
+
return operations.reduce((value2, operationKey) => {
|
|
6061
|
+
const operation = ParseRegistry.Get(operationKey);
|
|
6062
|
+
if (IsUndefined2(operation))
|
|
6063
|
+
throw new ParseError(`Unable to find Parse operation '${operationKey}'`);
|
|
6064
|
+
return operation(type, references, value2);
|
|
6065
|
+
}, value);
|
|
6066
|
+
}
|
|
6067
|
+
function Parse(...args) {
|
|
6068
|
+
const [operations, schema, references, value] = args.length === 4 ? [args[0], args[1], args[2], args[3]] : args.length === 3 ? IsArray2(args[0]) ? [args[0], args[1], [], args[2]] : [ParseDefault, args[0], args[1], args[2]] : args.length === 2 ? [ParseDefault, args[0], [], args[1]] : (() => {
|
|
6069
|
+
throw new ParseError("Invalid Arguments");
|
|
6070
|
+
})();
|
|
6071
|
+
return ParseValue(operations, schema, references, value);
|
|
6072
|
+
}
|
|
6073
|
+
|
|
6074
|
+
// ../../node_modules/.pnpm/@sinclair+typebox@0.34.52/node_modules/@sinclair/typebox/build/esm/value/value/value.mjs
|
|
6075
|
+
var value_exports2 = {};
|
|
6076
|
+
__export(value_exports2, {
|
|
6077
|
+
Assert: () => Assert,
|
|
6078
|
+
Cast: () => Cast,
|
|
6079
|
+
Check: () => Check,
|
|
6080
|
+
Clean: () => Clean,
|
|
6081
|
+
Clone: () => Clone2,
|
|
6082
|
+
Convert: () => Convert,
|
|
6083
|
+
Create: () => Create2,
|
|
6084
|
+
Decode: () => Decode,
|
|
6085
|
+
Default: () => Default5,
|
|
6086
|
+
Diff: () => Diff,
|
|
6087
|
+
Edit: () => Edit,
|
|
6088
|
+
Encode: () => Encode,
|
|
6089
|
+
Equal: () => Equal,
|
|
6090
|
+
Errors: () => Errors,
|
|
6091
|
+
Hash: () => Hash,
|
|
6092
|
+
Mutate: () => Mutate,
|
|
6093
|
+
Parse: () => Parse,
|
|
6094
|
+
Patch: () => Patch,
|
|
6095
|
+
ValueErrorIterator: () => ValueErrorIterator
|
|
6096
|
+
});
|
|
4465
6097
|
|
|
4466
6098
|
// ../protocol/dist/types.js
|
|
4467
6099
|
var REF_PATTERN = /^e\d+_\d+$/;
|
|
@@ -5046,7 +6678,7 @@ var Character;
|
|
|
5046
6678
|
})(Character || (Character = {}));
|
|
5047
6679
|
var Identifier;
|
|
5048
6680
|
(function(Identifier2) {
|
|
5049
|
-
function
|
|
6681
|
+
function Encode2($id) {
|
|
5050
6682
|
const buffer = [];
|
|
5051
6683
|
for (let i = 0; i < $id.length; i++) {
|
|
5052
6684
|
const code = $id.charCodeAt(i);
|
|
@@ -5058,7 +6690,7 @@ var Identifier;
|
|
|
5058
6690
|
}
|
|
5059
6691
|
return buffer.join("").replace(/__/g, "_");
|
|
5060
6692
|
}
|
|
5061
|
-
Identifier2.Encode =
|
|
6693
|
+
Identifier2.Encode = Encode2;
|
|
5062
6694
|
})(Identifier || (Identifier = {}));
|
|
5063
6695
|
function StringConstant(value) {
|
|
5064
6696
|
if (!IsString2(value))
|
|
@@ -5110,13 +6742,13 @@ var TypeCompiler;
|
|
|
5110
6742
|
function IsAnyOrUnknown2(schema) {
|
|
5111
6743
|
return schema[Kind] === "Any" || schema[Kind] === "Unknown";
|
|
5112
6744
|
}
|
|
5113
|
-
function*
|
|
6745
|
+
function* FromAny5(schema, references, value) {
|
|
5114
6746
|
yield "true";
|
|
5115
6747
|
}
|
|
5116
|
-
function*
|
|
6748
|
+
function* FromArgument5(schema, references, value) {
|
|
5117
6749
|
yield "true";
|
|
5118
6750
|
}
|
|
5119
|
-
function*
|
|
6751
|
+
function* FromArray18(schema, references, value) {
|
|
5120
6752
|
yield `Array.isArray(${value})`;
|
|
5121
6753
|
const [parameter, accumulator] = [CreateParameter("value", "any"), CreateParameter("acc", "number")];
|
|
5122
6754
|
if (IsNumber2(schema.maxItems))
|
|
@@ -5140,10 +6772,10 @@ var TypeCompiler;
|
|
|
5140
6772
|
yield `((${parameter}) => { ${block} )(${value})`;
|
|
5141
6773
|
}
|
|
5142
6774
|
}
|
|
5143
|
-
function*
|
|
6775
|
+
function* FromAsyncIterator8(schema, references, value) {
|
|
5144
6776
|
yield `(typeof value === 'object' && Symbol.asyncIterator in ${value})`;
|
|
5145
6777
|
}
|
|
5146
|
-
function*
|
|
6778
|
+
function* FromBigInt6(schema, references, value) {
|
|
5147
6779
|
yield `(typeof ${value} === 'bigint')`;
|
|
5148
6780
|
if (IsBigInt2(schema.exclusiveMaximum))
|
|
5149
6781
|
yield `${value} < BigInt(${schema.exclusiveMaximum})`;
|
|
@@ -5156,13 +6788,13 @@ var TypeCompiler;
|
|
|
5156
6788
|
if (IsBigInt2(schema.multipleOf))
|
|
5157
6789
|
yield `(${value} % BigInt(${schema.multipleOf})) === 0`;
|
|
5158
6790
|
}
|
|
5159
|
-
function*
|
|
6791
|
+
function* FromBoolean6(schema, references, value) {
|
|
5160
6792
|
yield `(typeof ${value} === 'boolean')`;
|
|
5161
6793
|
}
|
|
5162
|
-
function*
|
|
5163
|
-
yield*
|
|
6794
|
+
function* FromConstructor9(schema, references, value) {
|
|
6795
|
+
yield* Visit17(schema.returns, references, `${value}.prototype`);
|
|
5164
6796
|
}
|
|
5165
|
-
function*
|
|
6797
|
+
function* FromDate8(schema, references, value) {
|
|
5166
6798
|
yield `(${value} instanceof Date) && Number.isFinite(${value}.getTime())`;
|
|
5167
6799
|
if (IsNumber2(schema.exclusiveMaximumTimestamp))
|
|
5168
6800
|
yield `${value}.getTime() < ${schema.exclusiveMaximumTimestamp}`;
|
|
@@ -5175,16 +6807,16 @@ var TypeCompiler;
|
|
|
5175
6807
|
if (IsNumber2(schema.multipleOfTimestamp))
|
|
5176
6808
|
yield `(${value}.getTime() % ${schema.multipleOfTimestamp}) === 0`;
|
|
5177
6809
|
}
|
|
5178
|
-
function*
|
|
6810
|
+
function* FromFunction8(schema, references, value) {
|
|
5179
6811
|
yield `(typeof ${value} === 'function')`;
|
|
5180
6812
|
}
|
|
5181
|
-
function*
|
|
6813
|
+
function* FromImport11(schema, references, value) {
|
|
5182
6814
|
const members = globalThis.Object.getOwnPropertyNames(schema.$defs).reduce((result, key) => {
|
|
5183
6815
|
return [...result, schema.$defs[key]];
|
|
5184
6816
|
}, []);
|
|
5185
|
-
yield*
|
|
6817
|
+
yield* Visit17(Ref(schema.$ref), [...references, ...members], value);
|
|
5186
6818
|
}
|
|
5187
|
-
function*
|
|
6819
|
+
function* FromInteger6(schema, references, value) {
|
|
5188
6820
|
yield `Number.isInteger(${value})`;
|
|
5189
6821
|
if (IsNumber2(schema.exclusiveMaximum))
|
|
5190
6822
|
yield `${value} < ${schema.exclusiveMaximum}`;
|
|
@@ -5197,7 +6829,7 @@ var TypeCompiler;
|
|
|
5197
6829
|
if (IsNumber2(schema.multipleOf))
|
|
5198
6830
|
yield `(${value} % ${schema.multipleOf}) === 0`;
|
|
5199
6831
|
}
|
|
5200
|
-
function*
|
|
6832
|
+
function* FromIntersect19(schema, references, value) {
|
|
5201
6833
|
const check1 = schema.allOf.map((schema2) => CreateExpression(schema2, references, value)).join(" && ");
|
|
5202
6834
|
if (schema.unevaluatedProperties === false) {
|
|
5203
6835
|
const keyCheck = CreateVariable(`${new RegExp(KeyOfPattern(schema))};`);
|
|
@@ -5211,10 +6843,10 @@ var TypeCompiler;
|
|
|
5211
6843
|
yield `(${check1})`;
|
|
5212
6844
|
}
|
|
5213
6845
|
}
|
|
5214
|
-
function*
|
|
6846
|
+
function* FromIterator8(schema, references, value) {
|
|
5215
6847
|
yield `(typeof value === 'object' && Symbol.iterator in ${value})`;
|
|
5216
6848
|
}
|
|
5217
|
-
function*
|
|
6849
|
+
function* FromLiteral7(schema, references, value) {
|
|
5218
6850
|
if (typeof schema.const === "number" || typeof schema.const === "boolean") {
|
|
5219
6851
|
yield `(${value} === ${schema.const})`;
|
|
5220
6852
|
} else if (typeof schema.const === "string") {
|
|
@@ -5223,17 +6855,17 @@ var TypeCompiler;
|
|
|
5223
6855
|
throw Error("Invalid Literal Value");
|
|
5224
6856
|
}
|
|
5225
6857
|
}
|
|
5226
|
-
function*
|
|
6858
|
+
function* FromNever6(schema, references, value) {
|
|
5227
6859
|
yield `false`;
|
|
5228
6860
|
}
|
|
5229
|
-
function*
|
|
6861
|
+
function* FromNot8(schema, references, value) {
|
|
5230
6862
|
const expression = CreateExpression(schema.not, references, value);
|
|
5231
6863
|
yield `(!${expression})`;
|
|
5232
6864
|
}
|
|
5233
|
-
function*
|
|
6865
|
+
function* FromNull6(schema, references, value) {
|
|
5234
6866
|
yield `(${value} === null)`;
|
|
5235
6867
|
}
|
|
5236
|
-
function*
|
|
6868
|
+
function* FromNumber6(schema, references, value) {
|
|
5237
6869
|
yield Policy.IsNumberLike(value);
|
|
5238
6870
|
if (IsNumber2(schema.exclusiveMaximum))
|
|
5239
6871
|
yield `${value} < ${schema.exclusiveMaximum}`;
|
|
@@ -5246,7 +6878,7 @@ var TypeCompiler;
|
|
|
5246
6878
|
if (IsNumber2(schema.multipleOf))
|
|
5247
6879
|
yield `(${value} % ${schema.multipleOf}) === 0`;
|
|
5248
6880
|
}
|
|
5249
|
-
function*
|
|
6881
|
+
function* FromObject19(schema, references, value) {
|
|
5250
6882
|
yield Policy.IsObjectLike(value);
|
|
5251
6883
|
if (IsNumber2(schema.minProperties))
|
|
5252
6884
|
yield `Object.getOwnPropertyNames(${value}).length >= ${schema.minProperties}`;
|
|
@@ -5257,7 +6889,7 @@ var TypeCompiler;
|
|
|
5257
6889
|
const memberExpression = MemberExpression(value, knownKey);
|
|
5258
6890
|
const property = schema.properties[knownKey];
|
|
5259
6891
|
if (schema.required && schema.required.includes(knownKey)) {
|
|
5260
|
-
yield*
|
|
6892
|
+
yield* Visit17(property, references, memberExpression);
|
|
5261
6893
|
if (ExtendsUndefinedCheck(property) || IsAnyOrUnknown2(property))
|
|
5262
6894
|
yield `(${StringConstant(knownKey)} in ${value})`;
|
|
5263
6895
|
} else {
|
|
@@ -5279,10 +6911,10 @@ var TypeCompiler;
|
|
|
5279
6911
|
yield `(Object.getOwnPropertyNames(${value}).every(key => ${keys}.includes(key) || ${expression}))`;
|
|
5280
6912
|
}
|
|
5281
6913
|
}
|
|
5282
|
-
function*
|
|
6914
|
+
function* FromPromise8(schema, references, value) {
|
|
5283
6915
|
yield `${value} instanceof Promise`;
|
|
5284
6916
|
}
|
|
5285
|
-
function*
|
|
6917
|
+
function* FromRecord14(schema, references, value) {
|
|
5286
6918
|
yield Policy.IsRecordLike(value);
|
|
5287
6919
|
if (IsNumber2(schema.minProperties))
|
|
5288
6920
|
yield `Object.getOwnPropertyNames(${value}).length >= ${schema.minProperties}`;
|
|
@@ -5295,13 +6927,13 @@ var TypeCompiler;
|
|
|
5295
6927
|
const expression = `(${variable}.test(key) ? ${check1} : ${check2})`;
|
|
5296
6928
|
yield `(Object.entries(${value}).every(([key, value]) => ${expression}))`;
|
|
5297
6929
|
}
|
|
5298
|
-
function*
|
|
6930
|
+
function* FromRef15(schema, references, value) {
|
|
5299
6931
|
const target = Deref(schema, references);
|
|
5300
6932
|
if (state.functions.has(schema.$ref))
|
|
5301
6933
|
return yield `${CreateFunctionName(schema.$ref)}(${value})`;
|
|
5302
|
-
yield*
|
|
6934
|
+
yield* Visit17(target, references, value);
|
|
5303
6935
|
}
|
|
5304
|
-
function*
|
|
6936
|
+
function* FromRegExp5(schema, references, value) {
|
|
5305
6937
|
const variable = CreateVariable(`${new RegExp(schema.source, schema.flags)};`);
|
|
5306
6938
|
yield `(typeof ${value} === 'string')`;
|
|
5307
6939
|
if (IsNumber2(schema.maxLength))
|
|
@@ -5310,7 +6942,7 @@ var TypeCompiler;
|
|
|
5310
6942
|
yield `${value}.length >= ${schema.minLength}`;
|
|
5311
6943
|
yield `${variable}.test(${value})`;
|
|
5312
6944
|
}
|
|
5313
|
-
function*
|
|
6945
|
+
function* FromString6(schema, references, value) {
|
|
5314
6946
|
yield `(typeof ${value} === 'string')`;
|
|
5315
6947
|
if (IsNumber2(schema.maxLength))
|
|
5316
6948
|
yield `${value}.length <= ${schema.maxLength}`;
|
|
@@ -5324,18 +6956,18 @@ var TypeCompiler;
|
|
|
5324
6956
|
yield `format(${StringConstant(schema.format)}, ${value})`;
|
|
5325
6957
|
}
|
|
5326
6958
|
}
|
|
5327
|
-
function*
|
|
6959
|
+
function* FromSymbol6(schema, references, value) {
|
|
5328
6960
|
yield `(typeof ${value} === 'symbol')`;
|
|
5329
6961
|
}
|
|
5330
|
-
function*
|
|
6962
|
+
function* FromTemplateLiteral7(schema, references, value) {
|
|
5331
6963
|
yield `(typeof ${value} === 'string')`;
|
|
5332
6964
|
const variable = CreateVariable(`${new RegExp(schema.pattern)};`);
|
|
5333
6965
|
yield `${variable}.test(${value})`;
|
|
5334
6966
|
}
|
|
5335
|
-
function*
|
|
6967
|
+
function* FromThis11(schema, references, value) {
|
|
5336
6968
|
yield `${CreateFunctionName(schema.$ref)}(${value})`;
|
|
5337
6969
|
}
|
|
5338
|
-
function*
|
|
6970
|
+
function* FromTuple16(schema, references, value) {
|
|
5339
6971
|
yield `Array.isArray(${value})`;
|
|
5340
6972
|
if (schema.items === void 0)
|
|
5341
6973
|
return yield `${value}.length === 0`;
|
|
@@ -5345,32 +6977,32 @@ var TypeCompiler;
|
|
|
5345
6977
|
yield `${expression}`;
|
|
5346
6978
|
}
|
|
5347
6979
|
}
|
|
5348
|
-
function*
|
|
6980
|
+
function* FromUndefined6(schema, references, value) {
|
|
5349
6981
|
yield `${value} === undefined`;
|
|
5350
6982
|
}
|
|
5351
|
-
function*
|
|
6983
|
+
function* FromUnion21(schema, references, value) {
|
|
5352
6984
|
const expressions = schema.anyOf.map((schema2) => CreateExpression(schema2, references, value));
|
|
5353
6985
|
yield `(${expressions.join(" || ")})`;
|
|
5354
6986
|
}
|
|
5355
|
-
function*
|
|
6987
|
+
function* FromUint8Array5(schema, references, value) {
|
|
5356
6988
|
yield `${value} instanceof Uint8Array`;
|
|
5357
6989
|
if (IsNumber2(schema.maxByteLength))
|
|
5358
6990
|
yield `(${value}.length <= ${schema.maxByteLength})`;
|
|
5359
6991
|
if (IsNumber2(schema.minByteLength))
|
|
5360
6992
|
yield `(${value}.length >= ${schema.minByteLength})`;
|
|
5361
6993
|
}
|
|
5362
|
-
function*
|
|
6994
|
+
function* FromUnknown5(schema, references, value) {
|
|
5363
6995
|
yield "true";
|
|
5364
6996
|
}
|
|
5365
|
-
function*
|
|
6997
|
+
function* FromVoid5(schema, references, value) {
|
|
5366
6998
|
yield Policy.IsVoidLike(value);
|
|
5367
6999
|
}
|
|
5368
|
-
function*
|
|
7000
|
+
function* FromKind4(schema, references, value) {
|
|
5369
7001
|
const instance = state.instances.size;
|
|
5370
7002
|
state.instances.set(instance, schema);
|
|
5371
7003
|
yield `kind(${StringConstant(schema[Kind])}, ${instance}, ${value})`;
|
|
5372
7004
|
}
|
|
5373
|
-
function*
|
|
7005
|
+
function* Visit17(schema, references, value, useHoisting = true) {
|
|
5374
7006
|
const references_ = IsString2(schema.$id) ? [...references, schema] : references;
|
|
5375
7007
|
const schema_ = schema;
|
|
5376
7008
|
if (useHoisting && IsString2(schema.$id)) {
|
|
@@ -5386,75 +7018,75 @@ var TypeCompiler;
|
|
|
5386
7018
|
}
|
|
5387
7019
|
switch (schema_[Kind]) {
|
|
5388
7020
|
case "Any":
|
|
5389
|
-
return yield*
|
|
7021
|
+
return yield* FromAny5(schema_, references_, value);
|
|
5390
7022
|
case "Argument":
|
|
5391
|
-
return yield*
|
|
7023
|
+
return yield* FromArgument5(schema_, references_, value);
|
|
5392
7024
|
case "Array":
|
|
5393
|
-
return yield*
|
|
7025
|
+
return yield* FromArray18(schema_, references_, value);
|
|
5394
7026
|
case "AsyncIterator":
|
|
5395
|
-
return yield*
|
|
7027
|
+
return yield* FromAsyncIterator8(schema_, references_, value);
|
|
5396
7028
|
case "BigInt":
|
|
5397
|
-
return yield*
|
|
7029
|
+
return yield* FromBigInt6(schema_, references_, value);
|
|
5398
7030
|
case "Boolean":
|
|
5399
|
-
return yield*
|
|
7031
|
+
return yield* FromBoolean6(schema_, references_, value);
|
|
5400
7032
|
case "Constructor":
|
|
5401
|
-
return yield*
|
|
7033
|
+
return yield* FromConstructor9(schema_, references_, value);
|
|
5402
7034
|
case "Date":
|
|
5403
|
-
return yield*
|
|
7035
|
+
return yield* FromDate8(schema_, references_, value);
|
|
5404
7036
|
case "Function":
|
|
5405
|
-
return yield*
|
|
7037
|
+
return yield* FromFunction8(schema_, references_, value);
|
|
5406
7038
|
case "Import":
|
|
5407
|
-
return yield*
|
|
7039
|
+
return yield* FromImport11(schema_, references_, value);
|
|
5408
7040
|
case "Integer":
|
|
5409
|
-
return yield*
|
|
7041
|
+
return yield* FromInteger6(schema_, references_, value);
|
|
5410
7042
|
case "Intersect":
|
|
5411
|
-
return yield*
|
|
7043
|
+
return yield* FromIntersect19(schema_, references_, value);
|
|
5412
7044
|
case "Iterator":
|
|
5413
|
-
return yield*
|
|
7045
|
+
return yield* FromIterator8(schema_, references_, value);
|
|
5414
7046
|
case "Literal":
|
|
5415
|
-
return yield*
|
|
7047
|
+
return yield* FromLiteral7(schema_, references_, value);
|
|
5416
7048
|
case "Never":
|
|
5417
|
-
return yield*
|
|
7049
|
+
return yield* FromNever6(schema_, references_, value);
|
|
5418
7050
|
case "Not":
|
|
5419
|
-
return yield*
|
|
7051
|
+
return yield* FromNot8(schema_, references_, value);
|
|
5420
7052
|
case "Null":
|
|
5421
|
-
return yield*
|
|
7053
|
+
return yield* FromNull6(schema_, references_, value);
|
|
5422
7054
|
case "Number":
|
|
5423
|
-
return yield*
|
|
7055
|
+
return yield* FromNumber6(schema_, references_, value);
|
|
5424
7056
|
case "Object":
|
|
5425
|
-
return yield*
|
|
7057
|
+
return yield* FromObject19(schema_, references_, value);
|
|
5426
7058
|
case "Promise":
|
|
5427
|
-
return yield*
|
|
7059
|
+
return yield* FromPromise8(schema_, references_, value);
|
|
5428
7060
|
case "Record":
|
|
5429
|
-
return yield*
|
|
7061
|
+
return yield* FromRecord14(schema_, references_, value);
|
|
5430
7062
|
case "Ref":
|
|
5431
|
-
return yield*
|
|
7063
|
+
return yield* FromRef15(schema_, references_, value);
|
|
5432
7064
|
case "RegExp":
|
|
5433
|
-
return yield*
|
|
7065
|
+
return yield* FromRegExp5(schema_, references_, value);
|
|
5434
7066
|
case "String":
|
|
5435
|
-
return yield*
|
|
7067
|
+
return yield* FromString6(schema_, references_, value);
|
|
5436
7068
|
case "Symbol":
|
|
5437
|
-
return yield*
|
|
7069
|
+
return yield* FromSymbol6(schema_, references_, value);
|
|
5438
7070
|
case "TemplateLiteral":
|
|
5439
|
-
return yield*
|
|
7071
|
+
return yield* FromTemplateLiteral7(schema_, references_, value);
|
|
5440
7072
|
case "This":
|
|
5441
|
-
return yield*
|
|
7073
|
+
return yield* FromThis11(schema_, references_, value);
|
|
5442
7074
|
case "Tuple":
|
|
5443
|
-
return yield*
|
|
7075
|
+
return yield* FromTuple16(schema_, references_, value);
|
|
5444
7076
|
case "Undefined":
|
|
5445
|
-
return yield*
|
|
7077
|
+
return yield* FromUndefined6(schema_, references_, value);
|
|
5446
7078
|
case "Union":
|
|
5447
|
-
return yield*
|
|
7079
|
+
return yield* FromUnion21(schema_, references_, value);
|
|
5448
7080
|
case "Uint8Array":
|
|
5449
|
-
return yield*
|
|
7081
|
+
return yield* FromUint8Array5(schema_, references_, value);
|
|
5450
7082
|
case "Unknown":
|
|
5451
|
-
return yield*
|
|
7083
|
+
return yield* FromUnknown5(schema_, references_, value);
|
|
5452
7084
|
case "Void":
|
|
5453
|
-
return yield*
|
|
7085
|
+
return yield* FromVoid5(schema_, references_, value);
|
|
5454
7086
|
default:
|
|
5455
7087
|
if (!type_exports2.Has(schema_[Kind]))
|
|
5456
7088
|
throw new TypeCompilerUnknownTypeError(schema);
|
|
5457
|
-
return yield*
|
|
7089
|
+
return yield* FromKind4(schema_, references_, value);
|
|
5458
7090
|
}
|
|
5459
7091
|
}
|
|
5460
7092
|
const state = {
|
|
@@ -5468,7 +7100,7 @@ var TypeCompiler;
|
|
|
5468
7100
|
// exterior kind instances
|
|
5469
7101
|
};
|
|
5470
7102
|
function CreateExpression(schema, references, value, useHoisting = true) {
|
|
5471
|
-
return `(${[...
|
|
7103
|
+
return `(${[...Visit17(schema, references, value, useHoisting)].join(" && ")})`;
|
|
5472
7104
|
}
|
|
5473
7105
|
function CreateFunctionName($id) {
|
|
5474
7106
|
return `check_${Identifier.Encode($id)}`;
|
|
@@ -5482,7 +7114,7 @@ var TypeCompiler;
|
|
|
5482
7114
|
const [newline, pad] = ["\n", (length) => "".padStart(length, " ")];
|
|
5483
7115
|
const parameter = CreateParameter("value", "any");
|
|
5484
7116
|
const returns = CreateReturns("boolean");
|
|
5485
|
-
const expression = [...
|
|
7117
|
+
const expression = [...Visit17(schema, references, value, useHoisting)].map((expression2) => `${pad(4)}${expression2}`).join(` &&${newline}`);
|
|
5486
7118
|
return `function ${name}(${parameter})${returns} {${newline}${pad(2)}return (${newline}${expression}${newline}${pad(2)})
|
|
5487
7119
|
}`;
|
|
5488
7120
|
}
|
|
@@ -5728,6 +7360,95 @@ var ControlGrantSchema = Type.Intersect([
|
|
|
5728
7360
|
Type.Object({ token: Type.String() })
|
|
5729
7361
|
]);
|
|
5730
7362
|
|
|
7363
|
+
// ../protocol/dist/autofill.js
|
|
7364
|
+
var text = () => Type.String({ minLength: 1, maxLength: 512 });
|
|
7365
|
+
var strict = { additionalProperties: false };
|
|
7366
|
+
var AutofillMatchSchema = Type.Object({
|
|
7367
|
+
role: Type.Optional(text()),
|
|
7368
|
+
label: Type.Optional(text()),
|
|
7369
|
+
labelRegex: Type.Optional(text()),
|
|
7370
|
+
dataAutomationId: Type.Optional(text()),
|
|
7371
|
+
block: Type.Optional(Type.Object({ id: Type.Optional(text()), label: Type.Optional(text()) }, { ...strict, minProperties: 1 }))
|
|
7372
|
+
}, { ...strict, minProperties: 1 });
|
|
7373
|
+
var AutofillRequestSchema = Type.Object({
|
|
7374
|
+
fields: Type.Array(Type.Object({
|
|
7375
|
+
match: AutofillMatchSchema,
|
|
7376
|
+
value: Type.Optional(Type.String({ maxLength: 8192 })),
|
|
7377
|
+
option: Type.Optional(Type.Object({ value: Type.String({ maxLength: 8192 }) }, strict)),
|
|
7378
|
+
verify: Type.Optional(Type.Union([Type.Literal("exact"), Type.Literal("none")])),
|
|
7379
|
+
strategy: Type.Optional(Type.Union([Type.Literal("native-input"), Type.Literal("native-select")]))
|
|
7380
|
+
}, strict), { minItems: 1, maxItems: 50 }),
|
|
7381
|
+
policy: Type.Optional(Type.Object({
|
|
7382
|
+
onAmbiguous: Type.Optional(Type.Union([Type.Literal("fail"), Type.Literal("skip")])),
|
|
7383
|
+
onVerifyFail: Type.Optional(Type.Union([Type.Literal("fail"), Type.Literal("skip"), Type.Literal("retry")])),
|
|
7384
|
+
maxReobserve: Type.Optional(Type.Integer({ minimum: 0, maximum: 5 })),
|
|
7385
|
+
settleMs: Type.Optional(Type.Integer({ minimum: 0, maximum: 2e3 })),
|
|
7386
|
+
timeoutMs: Type.Optional(Type.Integer({ minimum: 1, maximum: 24e4 }))
|
|
7387
|
+
}, strict))
|
|
7388
|
+
}, strict);
|
|
7389
|
+
var AutofillReceiptSchema = Type.Object({
|
|
7390
|
+
field: Type.Integer({ minimum: 0, maximum: 49 }),
|
|
7391
|
+
match: AutofillMatchSchema,
|
|
7392
|
+
resolvedRef: Type.Optional(Type.String()),
|
|
7393
|
+
blockIdentity: Type.Optional(Type.String()),
|
|
7394
|
+
actionId: Type.Optional(Type.String()),
|
|
7395
|
+
status: Type.Union(["verified", "unverified", "skipped", "failed", "uncertain", "not_attempted"].map((value) => Type.Literal(value))),
|
|
7396
|
+
verified: Type.Boolean(),
|
|
7397
|
+
actual: Type.Optional(Type.String({ maxLength: 512 })),
|
|
7398
|
+
actualTruncated: Type.Optional(Type.Boolean()),
|
|
7399
|
+
error: Type.Optional(Type.Object({ code: Type.String(), message: Type.String() }, strict))
|
|
7400
|
+
}, strict);
|
|
7401
|
+
var AutofillReportSchema = Type.Object({
|
|
7402
|
+
ok: Type.Boolean(),
|
|
7403
|
+
receipts: Type.Array(AutofillReceiptSchema, { maxItems: 50 }),
|
|
7404
|
+
elapsedMs: Type.Number({ minimum: 0 }),
|
|
7405
|
+
snapshot: Type.Optional(Type.Object({
|
|
7406
|
+
artifactId: Type.String(),
|
|
7407
|
+
contentType: Type.Optional(Type.String()),
|
|
7408
|
+
sizeBytes: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
7409
|
+
warnings: Type.Optional(Type.Array(Type.String()))
|
|
7410
|
+
}, strict)),
|
|
7411
|
+
snapshotError: Type.Optional(Type.String())
|
|
7412
|
+
}, strict);
|
|
7413
|
+
function labelPattern(pattern) {
|
|
7414
|
+
const start = pattern.startsWith("^");
|
|
7415
|
+
const end = pattern.endsWith("$");
|
|
7416
|
+
const body = pattern.slice(start ? 1 : 0, end ? -1 : void 0);
|
|
7417
|
+
const parts = body.split(".*");
|
|
7418
|
+
if (parts.some((p) => /[\\[\]{}()+?*|.^$]/.test(p)))
|
|
7419
|
+
throw new Error("labelRegex supports only literals, .* and optional ^/$ anchors");
|
|
7420
|
+
return (label) => {
|
|
7421
|
+
let offset = 0;
|
|
7422
|
+
for (const [index, part] of parts.entries()) {
|
|
7423
|
+
const at = label.indexOf(part, offset);
|
|
7424
|
+
if (at < 0 || index === 0 && start && at !== 0)
|
|
7425
|
+
return false;
|
|
7426
|
+
offset = at + part.length;
|
|
7427
|
+
}
|
|
7428
|
+
if (!end)
|
|
7429
|
+
return true;
|
|
7430
|
+
const last = parts[parts.length - 1] ?? "";
|
|
7431
|
+
return label.endsWith(last) && (parts.length > 1 || !start || offset === label.length);
|
|
7432
|
+
};
|
|
7433
|
+
}
|
|
7434
|
+
function parseAutofillRequest(input) {
|
|
7435
|
+
if (!value_exports2.Check(AutofillRequestSchema, input))
|
|
7436
|
+
throw new Error("Invalid autofill request: bounded fields[] and policy required; unknown properties are rejected");
|
|
7437
|
+
const request = structuredClone(input);
|
|
7438
|
+
for (const field of request.fields) {
|
|
7439
|
+
if (field.value === void 0 === (field.option === void 0))
|
|
7440
|
+
throw new Error("Each autofill field requires exactly one of value or option.value");
|
|
7441
|
+
const match = field.match;
|
|
7442
|
+
if (!match.label && !match.labelRegex && !match.dataAutomationId)
|
|
7443
|
+
throw new Error("Each autofill match requires label, labelRegex or dataAutomationId");
|
|
7444
|
+
if (match.labelRegex !== void 0)
|
|
7445
|
+
labelPattern(match.labelRegex);
|
|
7446
|
+
if (field.strategy === "native-input" && field.value === void 0 || field.strategy === "native-select" && field.option === void 0)
|
|
7447
|
+
throw new Error("Autofill strategy does not match value/option");
|
|
7448
|
+
}
|
|
7449
|
+
return request;
|
|
7450
|
+
}
|
|
7451
|
+
|
|
5731
7452
|
// ../sdk-typescript/dist/client.js
|
|
5732
7453
|
var AgentBrowserError = class extends Error {
|
|
5733
7454
|
code;
|
|
@@ -5757,7 +7478,7 @@ var HttpClient = class {
|
|
|
5757
7478
|
async requestJson(path, init = {}) {
|
|
5758
7479
|
const operationId = path.startsWith("/v1/sessions/") && !path.includes("/control") && init.method && init.method !== "GET" ? init.operationId ?? this.headers["x-agentbrowser-operation-id"] ?? crypto.randomUUID() : void 0;
|
|
5759
7480
|
const controller = new AbortController();
|
|
5760
|
-
const timeoutId = setTimeout(() => controller.abort(), this.timeoutMs);
|
|
7481
|
+
const timeoutId = setTimeout(() => controller.abort(), init.timeoutMs ?? this.timeoutMs);
|
|
5761
7482
|
try {
|
|
5762
7483
|
const response = await fetch(`${this.baseUrl}${path}`, {
|
|
5763
7484
|
method: init.method ?? "GET",
|
|
@@ -5899,7 +7620,15 @@ var SessionsClient = class {
|
|
|
5899
7620
|
const body = await this.http.requestJson(`/v1/sessions/${sessionId}/events/replay${query}`);
|
|
5900
7621
|
return body.events;
|
|
5901
7622
|
}
|
|
5902
|
-
/**
|
|
7623
|
+
/** Structured native form filling; choose an operation ID before dispatch. */
|
|
7624
|
+
async autofill(sessionId, pageId, request, options = {}) {
|
|
7625
|
+
return this.http.requestJson(`/v1/sessions/${sessionId}/pages/${pageId}/autofill`, {
|
|
7626
|
+
method: "POST",
|
|
7627
|
+
body: request,
|
|
7628
|
+
...options,
|
|
7629
|
+
timeoutMs: Math.min(24e4, request.policy?.timeoutMs ?? 24e4) + 3e4
|
|
7630
|
+
});
|
|
7631
|
+
}
|
|
5903
7632
|
async plan(sessionId, pageId, actions, options = {}) {
|
|
5904
7633
|
return this.http.requestJson(`/v1/sessions/${sessionId}/pages/${pageId}/plan`, {
|
|
5905
7634
|
method: "POST",
|
|
@@ -6105,6 +7834,35 @@ function buildTools(client) {
|
|
|
6105
7834
|
return await client.sessions.snapshot(sessionId, pageId);
|
|
6106
7835
|
}
|
|
6107
7836
|
},
|
|
7837
|
+
{
|
|
7838
|
+
name: "browser_autofill",
|
|
7839
|
+
description: "Fill and verify structured fields in one serial server operation. Match labels within a unique fieldset block (id or legend label). Supports native text inputs and single selects; custom widgets are refused. Verification retries only read; uncertain writes stop the batch. Returns per-field receipts and an authorized raw HTML artifact. Performs no explicit submit action; page input/change handlers may commit effects. After a lost response, inspect browser_operation before any further write.",
|
|
7840
|
+
inputSchema: {
|
|
7841
|
+
type: "object",
|
|
7842
|
+
additionalProperties: false,
|
|
7843
|
+
properties: {
|
|
7844
|
+
sessionId: { type: "string" },
|
|
7845
|
+
pageId: { type: "string" },
|
|
7846
|
+
...AutofillRequestSchema.properties
|
|
7847
|
+
},
|
|
7848
|
+
required: ["sessionId", "pageId", "fields"]
|
|
7849
|
+
},
|
|
7850
|
+
handler: async (args) => {
|
|
7851
|
+
const [sessionId, pageId] = sessionAndPage(args);
|
|
7852
|
+
if (!client.sessions.autofill)
|
|
7853
|
+
throw new UsageError("Client does not support autofill");
|
|
7854
|
+
let payload;
|
|
7855
|
+
try {
|
|
7856
|
+
payload = parseAutofillRequest({
|
|
7857
|
+
fields: args.fields,
|
|
7858
|
+
...args.policy !== void 0 ? { policy: args.policy } : {}
|
|
7859
|
+
});
|
|
7860
|
+
} catch (error2) {
|
|
7861
|
+
throw new UsageError(error2 instanceof Error ? error2.message : "Invalid autofill request");
|
|
7862
|
+
}
|
|
7863
|
+
return await client.sessions.autofill(sessionId, pageId, payload, ...operationOptions(args));
|
|
7864
|
+
}
|
|
7865
|
+
},
|
|
6108
7866
|
{
|
|
6109
7867
|
name: "browser_plan",
|
|
6110
7868
|
description: "Execute a batched action plan in one call (TD-BROWSER-8). Each action: {action: fill|click|press|scroll, target?: {ref}, value?, key?}. Steps run sequentially; the first hard failure aborts with per-step results. Best paired with browser_snapshot: address refs from its `fields` in one round trip. A step for a field that only appears after a prior step (Phase 2) may declare `waitForLabel` (substring match on the element name) instead of `target` - the executor waits for it to appear (bounded by `waitMs`, default 5000) and resolves the ref itself; a miss aborts the plan with a typed PLAN_WAIT_TIMEOUT. On forms with repeated field labels (multi-section layouts, generically-labeled toggles), keep a plan to one section or logical group and re-observe between sections: self-heal matches stale refs by role and label, so identical labels make long plans abort mid-way even when every ref was valid at plan start.",
|
|
@@ -6399,7 +8157,7 @@ function buildMcpServer(deps) {
|
|
|
6399
8157
|
for (const tool of tools) {
|
|
6400
8158
|
if (deps.sessionId && Array.isArray(tool.inputSchema.required))
|
|
6401
8159
|
tool.inputSchema.required = tool.inputSchema.required.filter((name) => name !== "sessionId");
|
|
6402
|
-
if (["browser_act", "browser_plan", "browser_navigate"].includes(tool.name)) {
|
|
8160
|
+
if (["browser_act", "browser_plan", "browser_autofill", "browser_navigate"].includes(tool.name)) {
|
|
6403
8161
|
tool.inputSchema.properties.operationId = {
|
|
6404
8162
|
type: "string",
|
|
6405
8163
|
pattern: "^[a-zA-Z0-9_-]{1,128}$",
|
|
@@ -6483,7 +8241,7 @@ function buildMcpServer(deps) {
|
|
|
6483
8241
|
try {
|
|
6484
8242
|
if (deps.sessionId && args.sessionId !== void 0 && args.sessionId !== deps.sessionId)
|
|
6485
8243
|
throw new UsageError("This MCP connection is bound to another session");
|
|
6486
|
-
if (deps.sessionId && ["browser_act", "browser_plan", "browser_navigate"].includes(name) && args.operationId === void 0)
|
|
8244
|
+
if (deps.sessionId && ["browser_act", "browser_plan", "browser_autofill", "browser_navigate"].includes(name) && args.operationId === void 0)
|
|
6487
8245
|
throw new UsageError("operationId is required for a delegated mutation; choose it before dispatch so a lost response can be reconciled");
|
|
6488
8246
|
const result = await tool.handler(deps.sessionId ? { ...args, sessionId: deps.sessionId } : args);
|
|
6489
8247
|
return ok(message.id, textResult(result));
|