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