@tscircuit/cli 0.1.1495 → 0.1.1496
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/cli/main.js +681 -249
- package/dist/lib/index.js +337 -234
- package/package.json +5 -3
package/dist/cli/main.js
CHANGED
|
@@ -100763,7 +100763,7 @@ var import_perfect_cli = __toESM2(require_dist2(), 1);
|
|
|
100763
100763
|
// lib/getVersion.ts
|
|
100764
100764
|
import { createRequire as createRequire2 } from "node:module";
|
|
100765
100765
|
// package.json
|
|
100766
|
-
var version = "0.1.
|
|
100766
|
+
var version = "0.1.1495";
|
|
100767
100767
|
var package_default = {
|
|
100768
100768
|
name: "@tscircuit/cli",
|
|
100769
100769
|
version,
|
|
@@ -100780,6 +100780,7 @@ var package_default = {
|
|
|
100780
100780
|
"@tscircuit/circuit-json-schematic-placement-analysis": "github:tscircuit/circuit-json-schematic-placement-analysis#b6d5fe675adc26a2fc988aa081e6fb51e6bf696a",
|
|
100781
100781
|
"@tscircuit/eval": "^0.0.915",
|
|
100782
100782
|
"@tscircuit/fake-snippets": "^0.0.182",
|
|
100783
|
+
"@tscircuit/fake-ul-kicad-proxy": "github:tscircuit/fake-ul-kicad-proxy#d174c33c1b17a52d7a9dc3c2b5506d6fd593bed7",
|
|
100783
100784
|
"@tscircuit/file-server": "^0.0.32",
|
|
100784
100785
|
"@tscircuit/image-utils": "^0.0.3",
|
|
100785
100786
|
"@tscircuit/krt-wasm": "^0.1.0",
|
|
@@ -100787,6 +100788,7 @@ var package_default = {
|
|
|
100787
100788
|
"@tscircuit/props": "^0.0.546",
|
|
100788
100789
|
"@tscircuit/runframe": "^0.0.2074",
|
|
100789
100790
|
"@tscircuit/schematic-match-adapt": "^0.0.22",
|
|
100791
|
+
"@tscircuit/ti-parts-engine": "github:tscircuit/ti-parts-engine#cead194495b8fbfb73a88b5995ce86a4b61a9d04",
|
|
100790
100792
|
"@tscircuit/solver-utils": "0.0.16",
|
|
100791
100793
|
"@types/bun": "^1.2.2",
|
|
100792
100794
|
"@types/configstore": "^6.0.2",
|
|
@@ -100824,7 +100826,7 @@ var package_default = {
|
|
|
100824
100826
|
jszip: "^3.10.1",
|
|
100825
100827
|
"jwt-decode": "^4.0.0",
|
|
100826
100828
|
"kicad-component-converter": "^0.1.40",
|
|
100827
|
-
"kicad-to-circuit-json": "^0.0.
|
|
100829
|
+
"kicad-to-circuit-json": "^0.0.96",
|
|
100828
100830
|
kicadts: "^0.0.45",
|
|
100829
100831
|
kleur: "^4.1.5",
|
|
100830
100832
|
ky: "^1.7.4",
|
|
@@ -100838,7 +100840,7 @@ var package_default = {
|
|
|
100838
100840
|
semver: "^7.6.3",
|
|
100839
100841
|
stepts: "^0.0.3",
|
|
100840
100842
|
tempy: "^3.1.0",
|
|
100841
|
-
tscircuit: "
|
|
100843
|
+
tscircuit: "0.0.1885-libonly",
|
|
100842
100844
|
tsx: "^4.7.1",
|
|
100843
100845
|
"typed-ky": "^0.0.4",
|
|
100844
100846
|
zod: "^3.23.8"
|
|
@@ -250235,9 +250237,6 @@ class WinterSpecMultiPartFormDataResponse extends WinterSpecResponse {
|
|
|
250235
250237
|
return new Response(formData, this.options);
|
|
250236
250238
|
}
|
|
250237
250239
|
}
|
|
250238
|
-
function createWinterSpecRequest(request, options) {
|
|
250239
|
-
return Object.assign(request, options);
|
|
250240
|
-
}
|
|
250241
250240
|
function mergeHeaders2(h12, h22) {
|
|
250242
250241
|
return new Headers(Object.fromEntries([
|
|
250243
250242
|
...h12 instanceof Headers ? h12 : new Headers(h12 ?? undefined).entries() ?? [],
|
|
@@ -250251,7 +250250,6 @@ var DEFAULT_CONTEXT = {
|
|
|
250251
250250
|
multipartFormData: WinterSpecResponse.multipartFormData,
|
|
250252
250251
|
custom: WinterSpecResponse.custom
|
|
250253
250252
|
};
|
|
250254
|
-
var getDefaultContext = () => ({ ...DEFAULT_CONTEXT });
|
|
250255
250253
|
|
|
250256
250254
|
// node_modules/winterspec/dist/serve/create-node-server-from-route-map.js
|
|
250257
250255
|
var import_next_route_matcher = __toESM2(require_dist8(), 1);
|
|
@@ -250259,7 +250257,119 @@ var import_next_route_matcher = __toESM2(require_dist8(), 1);
|
|
|
250259
250257
|
// node_modules/winterspec/dist/create-with-winter-spec.js
|
|
250260
250258
|
import { z as z5 } from "zod";
|
|
250261
250259
|
|
|
250262
|
-
// node_modules/winterspec/dist/
|
|
250260
|
+
// node_modules/winterspec/dist/middleware/with-input-validation.js
|
|
250261
|
+
import { z as z4, ZodError as ZodError2, ZodFirstPartyTypeKind as ZodFirstPartyTypeKind2 } from "zod";
|
|
250262
|
+
|
|
250263
|
+
// node_modules/winterspec/dist/serve/create-winter-spec-from-route-map.js
|
|
250264
|
+
var import_next_route_matcher2 = __toESM2(require_dist8(), 1);
|
|
250265
|
+
|
|
250266
|
+
// node_modules/winterspec/dist/adapters/node.js
|
|
250267
|
+
var EdgePrimitives = __toESM2(require_dist6(), 1);
|
|
250268
|
+
var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
|
|
250269
|
+
const transformToNode = transformToNodeBuilder({
|
|
250270
|
+
defaultOrigin: `http://localhost${port ? `:${port}` : ""}`
|
|
250271
|
+
});
|
|
250272
|
+
return transformToNode((req) => winterSpec.makeRequest(req, {
|
|
250273
|
+
middleware
|
|
250274
|
+
}));
|
|
250275
|
+
};
|
|
250276
|
+
|
|
250277
|
+
// node_modules/@tscircuit/file-server/dist/bundle.js
|
|
250278
|
+
var import_next_route_matcher4 = __toESM2(require_dist8(), 1);
|
|
250279
|
+
|
|
250280
|
+
// node_modules/@tscircuit/file-server/node_modules/winterspec/dist/types/web-handler.js
|
|
250281
|
+
class WinterSpecResponse2 {
|
|
250282
|
+
statusCode() {
|
|
250283
|
+
return this.options.status ?? 200;
|
|
250284
|
+
}
|
|
250285
|
+
status(status) {
|
|
250286
|
+
this.options.status = status;
|
|
250287
|
+
return this;
|
|
250288
|
+
}
|
|
250289
|
+
header(key, value) {
|
|
250290
|
+
this.options.headers = mergeHeaders3(this.options.headers, {
|
|
250291
|
+
[key]: value
|
|
250292
|
+
});
|
|
250293
|
+
return this;
|
|
250294
|
+
}
|
|
250295
|
+
headers(headers) {
|
|
250296
|
+
this.options.headers = mergeHeaders3(this.options.headers, headers);
|
|
250297
|
+
return this;
|
|
250298
|
+
}
|
|
250299
|
+
statusText(statusText) {
|
|
250300
|
+
this.options.statusText = statusText;
|
|
250301
|
+
return this;
|
|
250302
|
+
}
|
|
250303
|
+
constructor(options = {}) {
|
|
250304
|
+
this.options = options;
|
|
250305
|
+
}
|
|
250306
|
+
static json(...args) {
|
|
250307
|
+
return new WinterSpecJsonResponse2(...args);
|
|
250308
|
+
}
|
|
250309
|
+
static multipartFormData(...args) {
|
|
250310
|
+
return new WinterSpecMultiPartFormDataResponse2(...args);
|
|
250311
|
+
}
|
|
250312
|
+
static custom(...args) {
|
|
250313
|
+
return new WinterSpecCustomResponse2(...args);
|
|
250314
|
+
}
|
|
250315
|
+
}
|
|
250316
|
+
|
|
250317
|
+
class WinterSpecJsonResponse2 extends WinterSpecResponse2 {
|
|
250318
|
+
constructor(data, options = {}) {
|
|
250319
|
+
super(options);
|
|
250320
|
+
this.data = data;
|
|
250321
|
+
this.options.headers = mergeHeaders3(this.options.headers, {
|
|
250322
|
+
"Content-Type": "application/json"
|
|
250323
|
+
});
|
|
250324
|
+
}
|
|
250325
|
+
serializeToResponse(schema) {
|
|
250326
|
+
return new Response(JSON.stringify(schema.parse(this.data)), this.options);
|
|
250327
|
+
}
|
|
250328
|
+
}
|
|
250329
|
+
|
|
250330
|
+
class WinterSpecCustomResponse2 extends WinterSpecResponse2 {
|
|
250331
|
+
constructor(data, contentType, options = {}) {
|
|
250332
|
+
super(options);
|
|
250333
|
+
this.data = data;
|
|
250334
|
+
this.contentType = contentType;
|
|
250335
|
+
this.options.headers = mergeHeaders3(this.options.headers, {
|
|
250336
|
+
"Content-Type": contentType
|
|
250337
|
+
});
|
|
250338
|
+
}
|
|
250339
|
+
serializeToResponse(schema) {
|
|
250340
|
+
return new Response(schema.parse(this.data), this.options);
|
|
250341
|
+
}
|
|
250342
|
+
}
|
|
250343
|
+
class WinterSpecMultiPartFormDataResponse2 extends WinterSpecResponse2 {
|
|
250344
|
+
constructor(data, options = {}) {
|
|
250345
|
+
super(options);
|
|
250346
|
+
this.data = data;
|
|
250347
|
+
this.options.headers = mergeHeaders3(this.options.headers, {
|
|
250348
|
+
"Content-Type": "multipart/form-data"
|
|
250349
|
+
});
|
|
250350
|
+
}
|
|
250351
|
+
serializeToResponse(schema) {
|
|
250352
|
+
const formData = new FormData;
|
|
250353
|
+
for (const [key, value] of Object.entries(schema.parse(this.data))) {
|
|
250354
|
+
formData.append(key, value instanceof Blob ? value : String(value));
|
|
250355
|
+
}
|
|
250356
|
+
return new Response(formData, this.options);
|
|
250357
|
+
}
|
|
250358
|
+
}
|
|
250359
|
+
function createWinterSpecRequest2(request, options) {
|
|
250360
|
+
return Object.assign(request, options);
|
|
250361
|
+
}
|
|
250362
|
+
function mergeHeaders3(h12, h22) {
|
|
250363
|
+
return new Headers(Object.fromEntries([
|
|
250364
|
+
...h12 instanceof Headers ? h12 : new Headers(h12 ?? undefined).entries() ?? [],
|
|
250365
|
+
...h22 instanceof Headers ? h22 : new Headers(h22 ?? undefined).entries() ?? []
|
|
250366
|
+
]));
|
|
250367
|
+
}
|
|
250368
|
+
|
|
250369
|
+
// node_modules/@tscircuit/file-server/node_modules/winterspec/dist/create-with-winter-spec.js
|
|
250370
|
+
import { z as z7 } from "zod";
|
|
250371
|
+
|
|
250372
|
+
// node_modules/@tscircuit/file-server/node_modules/winterspec/dist/lib/format-zod-error.js
|
|
250263
250373
|
var zodIssueToString = (issue) => {
|
|
250264
250374
|
if (issue.path.join(".") === "") {
|
|
250265
250375
|
return issue.message;
|
|
@@ -250269,7 +250379,7 @@ var zodIssueToString = (issue) => {
|
|
|
250269
250379
|
}
|
|
250270
250380
|
return `${issue.message} for "${issue.path.join(".")}"`;
|
|
250271
250381
|
};
|
|
250272
|
-
var
|
|
250382
|
+
var formatZodError2 = (error) => {
|
|
250273
250383
|
let message;
|
|
250274
250384
|
if (error.issues.length === 1) {
|
|
250275
250385
|
const issue = error.issues[0];
|
|
@@ -250285,7 +250395,7 @@ var formatZodError = (error) => {
|
|
|
250285
250395
|
return message;
|
|
250286
250396
|
};
|
|
250287
250397
|
|
|
250288
|
-
// node_modules/winterspec/dist/middleware/http-exceptions.js
|
|
250398
|
+
// node_modules/@tscircuit/file-server/node_modules/winterspec/dist/middleware/http-exceptions.js
|
|
250289
250399
|
class WinterSpecMiddlewareError extends Error {
|
|
250290
250400
|
constructor(message, status = 500) {
|
|
250291
250401
|
super(message);
|
|
@@ -250296,79 +250406,79 @@ class WinterSpecMiddlewareError extends Error {
|
|
|
250296
250406
|
}
|
|
250297
250407
|
}
|
|
250298
250408
|
|
|
250299
|
-
class
|
|
250409
|
+
class MethodNotAllowedError2 extends WinterSpecMiddlewareError {
|
|
250300
250410
|
constructor(allowedMethods) {
|
|
250301
250411
|
super(`only ${allowedMethods.join(",")} accepted`, 405);
|
|
250302
250412
|
}
|
|
250303
250413
|
}
|
|
250304
|
-
class
|
|
250414
|
+
class BadRequestError2 extends WinterSpecMiddlewareError {
|
|
250305
250415
|
constructor(message) {
|
|
250306
250416
|
super(message, 400);
|
|
250307
250417
|
}
|
|
250308
250418
|
}
|
|
250309
250419
|
|
|
250310
|
-
class
|
|
250420
|
+
class InvalidQueryParamsError2 extends BadRequestError2 {
|
|
250311
250421
|
constructor(message) {
|
|
250312
250422
|
super(message);
|
|
250313
250423
|
}
|
|
250314
250424
|
}
|
|
250315
250425
|
|
|
250316
|
-
class
|
|
250426
|
+
class InvalidContentTypeError2 extends BadRequestError2 {
|
|
250317
250427
|
constructor(message) {
|
|
250318
250428
|
super(message);
|
|
250319
250429
|
}
|
|
250320
250430
|
}
|
|
250321
250431
|
|
|
250322
|
-
class
|
|
250432
|
+
class InputParsingError2 extends BadRequestError2 {
|
|
250323
250433
|
constructor(message) {
|
|
250324
250434
|
super(message);
|
|
250325
250435
|
}
|
|
250326
250436
|
}
|
|
250327
250437
|
|
|
250328
|
-
class
|
|
250438
|
+
class InputValidationError2 extends BadRequestError2 {
|
|
250329
250439
|
constructor(error) {
|
|
250330
|
-
super(
|
|
250440
|
+
super(formatZodError2(error));
|
|
250331
250441
|
}
|
|
250332
250442
|
}
|
|
250333
250443
|
|
|
250334
|
-
class
|
|
250444
|
+
class ResponseValidationError2 extends WinterSpecMiddlewareError {
|
|
250335
250445
|
constructor(error) {
|
|
250336
|
-
super(
|
|
250446
|
+
super(formatZodError2(error), 500);
|
|
250337
250447
|
}
|
|
250338
250448
|
}
|
|
250339
250449
|
|
|
250340
|
-
// node_modules/winterspec/dist/middleware/with-methods.js
|
|
250341
|
-
var
|
|
250450
|
+
// node_modules/@tscircuit/file-server/node_modules/winterspec/dist/middleware/with-methods.js
|
|
250451
|
+
var withMethods2 = (methods) => (req, ctx, next) => {
|
|
250342
250452
|
if (!methods.includes(req.method)) {
|
|
250343
|
-
throw new
|
|
250453
|
+
throw new MethodNotAllowedError2(methods);
|
|
250344
250454
|
}
|
|
250345
250455
|
return next(req, ctx);
|
|
250346
250456
|
};
|
|
250347
250457
|
|
|
250348
|
-
// node_modules/winterspec/dist/middleware/with-input-validation.js
|
|
250349
|
-
import { z as
|
|
250458
|
+
// node_modules/@tscircuit/file-server/node_modules/winterspec/dist/middleware/with-input-validation.js
|
|
250459
|
+
import { z as z6, ZodError as ZodError3, ZodFirstPartyTypeKind as ZodFirstPartyTypeKind3 } from "zod";
|
|
250350
250460
|
var getZodObjectSchemaFromZodEffectSchema = (isZodEffect, schema) => {
|
|
250351
250461
|
if (!isZodEffect) {
|
|
250352
250462
|
return schema;
|
|
250353
250463
|
}
|
|
250354
250464
|
let currentSchema = schema;
|
|
250355
|
-
while (currentSchema instanceof
|
|
250465
|
+
while (currentSchema instanceof z6.ZodEffects) {
|
|
250356
250466
|
currentSchema = currentSchema._def.schema;
|
|
250357
250467
|
}
|
|
250358
250468
|
return currentSchema;
|
|
250359
250469
|
};
|
|
250360
250470
|
var getZodDefFromZodSchemaHelpers = (schema) => {
|
|
250361
250471
|
const special_zod_types = [
|
|
250362
|
-
|
|
250363
|
-
|
|
250364
|
-
|
|
250472
|
+
ZodFirstPartyTypeKind3.ZodOptional,
|
|
250473
|
+
ZodFirstPartyTypeKind3.ZodDefault,
|
|
250474
|
+
ZodFirstPartyTypeKind3.ZodEffects
|
|
250365
250475
|
];
|
|
250366
250476
|
while (special_zod_types.includes(schema._def.typeName)) {
|
|
250367
|
-
if (schema._def.typeName ===
|
|
250477
|
+
if (schema._def.typeName === ZodFirstPartyTypeKind3.ZodOptional || schema._def.typeName === ZodFirstPartyTypeKind3.ZodDefault) {
|
|
250368
250478
|
schema = schema._def.innerType;
|
|
250369
250479
|
continue;
|
|
250370
250480
|
}
|
|
250371
|
-
if (schema._def.typeName ===
|
|
250481
|
+
if (schema._def.typeName === ZodFirstPartyTypeKind3.ZodEffects) {
|
|
250372
250482
|
schema = schema._def.schema;
|
|
250373
250483
|
continue;
|
|
250374
250484
|
}
|
|
@@ -250376,9 +250486,9 @@ var getZodDefFromZodSchemaHelpers = (schema) => {
|
|
|
250376
250486
|
return schema._def;
|
|
250377
250487
|
};
|
|
250378
250488
|
var tryGetZodSchemaAsObject = (schema) => {
|
|
250379
|
-
const isZodEffect = schema._def.typeName ===
|
|
250489
|
+
const isZodEffect = schema._def.typeName === ZodFirstPartyTypeKind3.ZodEffects;
|
|
250380
250490
|
const safe_schema = getZodObjectSchemaFromZodEffectSchema(isZodEffect, schema);
|
|
250381
|
-
const isZodObject = safe_schema._def.typeName ===
|
|
250491
|
+
const isZodObject = safe_schema._def.typeName === ZodFirstPartyTypeKind3.ZodObject;
|
|
250382
250492
|
if (!isZodObject) {
|
|
250383
250493
|
return;
|
|
250384
250494
|
}
|
|
@@ -250386,11 +250496,11 @@ var tryGetZodSchemaAsObject = (schema) => {
|
|
|
250386
250496
|
};
|
|
250387
250497
|
var isZodSchemaArray = (schema) => {
|
|
250388
250498
|
const def = getZodDefFromZodSchemaHelpers(schema);
|
|
250389
|
-
return def.typeName ===
|
|
250499
|
+
return def.typeName === ZodFirstPartyTypeKind3.ZodArray;
|
|
250390
250500
|
};
|
|
250391
250501
|
var isZodSchemaBoolean = (schema) => {
|
|
250392
250502
|
const def = getZodDefFromZodSchemaHelpers(schema);
|
|
250393
|
-
return def.typeName ===
|
|
250503
|
+
return def.typeName === ZodFirstPartyTypeKind3.ZodBoolean;
|
|
250394
250504
|
};
|
|
250395
250505
|
var parseQueryParams = (schema, input, supportedArrayFormats) => {
|
|
250396
250506
|
const parsed_input = Object.assign({}, input);
|
|
@@ -250433,7 +250543,7 @@ var validateQueryParams = (inputUrl, schema, supportedArrayFormats) => {
|
|
|
250433
250543
|
for (const [schemaKey, value] of Object.entries(obj_schema.shape)) {
|
|
250434
250544
|
if (isZodSchemaArray(value)) {
|
|
250435
250545
|
if (key === `${schemaKey}[]` && !supportedArrayFormats.includes("brackets")) {
|
|
250436
|
-
throw new
|
|
250546
|
+
throw new InvalidQueryParamsError2(`Bracket syntax not supported for query param "${schemaKey}"`);
|
|
250437
250547
|
}
|
|
250438
250548
|
}
|
|
250439
250549
|
}
|
|
@@ -250441,26 +250551,26 @@ var validateQueryParams = (inputUrl, schema, supportedArrayFormats) => {
|
|
|
250441
250551
|
if (key_schema) {
|
|
250442
250552
|
if (isZodSchemaArray(key_schema)) {
|
|
250443
250553
|
if (seenKeys.has(key) && !supportedArrayFormats.includes("repeat")) {
|
|
250444
|
-
throw new
|
|
250554
|
+
throw new InvalidQueryParamsError2(`Repeated parameters not supported for duplicate query param "${key}"`);
|
|
250445
250555
|
}
|
|
250446
250556
|
}
|
|
250447
250557
|
}
|
|
250448
250558
|
seenKeys.add(key);
|
|
250449
250559
|
}
|
|
250450
250560
|
};
|
|
250451
|
-
var
|
|
250561
|
+
var withInputValidation2 = (input) => async (req, ctx, next) => {
|
|
250452
250562
|
const { supportedArrayFormats } = input;
|
|
250453
250563
|
if (input.formData && input.jsonBody || input.formData && input.commonParams) {
|
|
250454
250564
|
throw new Error("Cannot use formData with jsonBody or commonParams");
|
|
250455
250565
|
}
|
|
250456
250566
|
if ((req.method === "POST" || req.method === "PATCH") && (input.jsonBody || input.commonParams) && !req.headers.get("content-type")?.includes("application/json")) {
|
|
250457
|
-
throw new
|
|
250567
|
+
throw new InvalidContentTypeError2(`${req.method} requests must have Content-Type header with "application/json"`);
|
|
250458
250568
|
}
|
|
250459
250569
|
if (input.urlEncodedFormData && req.method !== "GET" && !req.headers.get("content-type")?.includes("application/x-www-form-urlencoded")) {
|
|
250460
|
-
throw new
|
|
250570
|
+
throw new InvalidContentTypeError2(`Must have Content-Type header with "application/x-www-form-urlencoded"`);
|
|
250461
250571
|
}
|
|
250462
250572
|
if (input.formData && (req.method === "POST" || req.method === "PATCH") && !req.headers.get("content-type")?.includes("multipart/form-data")) {
|
|
250463
|
-
throw new
|
|
250573
|
+
throw new InvalidContentTypeError2(`${req.method} requests must have Content-Type header with "multipart/form-data"`);
|
|
250464
250574
|
}
|
|
250465
250575
|
const originalParams = Object.fromEntries(new URL(req.url).searchParams.entries());
|
|
250466
250576
|
let jsonBody;
|
|
@@ -250469,7 +250579,7 @@ var withInputValidation = (input) => async (req, ctx, next) => {
|
|
|
250469
250579
|
jsonBody = await req.clone().json();
|
|
250470
250580
|
} catch (e4) {
|
|
250471
250581
|
if (!input.jsonBody?.isOptional()) {
|
|
250472
|
-
throw new
|
|
250582
|
+
throw new InputParsingError2("Error while parsing JSON body");
|
|
250473
250583
|
}
|
|
250474
250584
|
}
|
|
250475
250585
|
}
|
|
@@ -250480,7 +250590,7 @@ var withInputValidation = (input) => async (req, ctx, next) => {
|
|
|
250480
250590
|
multiPartFormData = Object.fromEntries(multiPartFormData.entries());
|
|
250481
250591
|
} catch (e4) {
|
|
250482
250592
|
if (!input.formData?.isOptional()) {
|
|
250483
|
-
throw new
|
|
250593
|
+
throw new InputParsingError2("Error while parsing form data");
|
|
250484
250594
|
}
|
|
250485
250595
|
}
|
|
250486
250596
|
}
|
|
@@ -250491,7 +250601,7 @@ var withInputValidation = (input) => async (req, ctx, next) => {
|
|
|
250491
250601
|
urlEncodedFormData = Object.fromEntries(params2.entries());
|
|
250492
250602
|
} catch (e4) {
|
|
250493
250603
|
if (!input.urlEncodedFormData?.isOptional()) {
|
|
250494
|
-
throw new
|
|
250604
|
+
throw new InputParsingError2("Error while parsing url encoded form data");
|
|
250495
250605
|
}
|
|
250496
250606
|
}
|
|
250497
250607
|
}
|
|
@@ -250524,19 +250634,19 @@ var withInputValidation = (input) => async (req, ctx, next) => {
|
|
|
250524
250634
|
req.commonParams = parseQueryParams(input.commonParams, originalCombinedParams, supportedArrayFormats);
|
|
250525
250635
|
}
|
|
250526
250636
|
} catch (error) {
|
|
250527
|
-
if (error instanceof
|
|
250637
|
+
if (error instanceof BadRequestError2) {
|
|
250528
250638
|
throw error;
|
|
250529
250639
|
}
|
|
250530
|
-
if (error instanceof
|
|
250531
|
-
throw new
|
|
250640
|
+
if (error instanceof ZodError3) {
|
|
250641
|
+
throw new InputValidationError2(error);
|
|
250532
250642
|
}
|
|
250533
|
-
throw new
|
|
250643
|
+
throw new InputParsingError2("Error while parsing input");
|
|
250534
250644
|
}
|
|
250535
250645
|
return next(req, ctx);
|
|
250536
250646
|
};
|
|
250537
250647
|
|
|
250538
|
-
// node_modules/winterspec/dist/middleware/with-unhandled-exception-handling.js
|
|
250539
|
-
var
|
|
250648
|
+
// node_modules/@tscircuit/file-server/node_modules/winterspec/dist/middleware/with-unhandled-exception-handling.js
|
|
250649
|
+
var withUnhandledExceptionHandling2 = async (req, ctx, next) => {
|
|
250540
250650
|
try {
|
|
250541
250651
|
return await next(req, ctx);
|
|
250542
250652
|
} catch (e4) {
|
|
@@ -250553,7 +250663,7 @@ var withUnhandledExceptionHandling = async (req, ctx, next) => {
|
|
|
250553
250663
|
}
|
|
250554
250664
|
};
|
|
250555
250665
|
|
|
250556
|
-
// node_modules/winterspec/dist/create-with-winter-spec.js
|
|
250666
|
+
// node_modules/@tscircuit/file-server/node_modules/winterspec/dist/create-with-winter-spec.js
|
|
250557
250667
|
var attachMetadataToRouteFn = ({ globalSpec, routeSpec }, routeFn) => {
|
|
250558
250668
|
routeFn._globalSpec = globalSpec;
|
|
250559
250669
|
routeFn._routeSpec = routeSpec;
|
|
@@ -250567,16 +250677,16 @@ var createWithWinterSpec = (globalSpec) => {
|
|
|
250567
250677
|
const onMultipleAuthMiddlewareFailures = globalSpec.onMultipleAuthMiddlewareFailures ?? routeSpec.onMultipleAuthMiddlewareFailures;
|
|
250568
250678
|
const supportedAuthMiddlewares = new Set(routeSpec.auth == null || routeSpec.auth === "none" ? [] : Array.isArray(routeSpec.auth) ? routeSpec.auth : [routeSpec.auth]);
|
|
250569
250679
|
const authMiddlewares = Object.entries(globalSpec.authMiddleware).filter(([k4, _4]) => supportedAuthMiddlewares.has(k4)).map(([_4, v3]) => v3);
|
|
250570
|
-
return await
|
|
250680
|
+
return await wrapMiddlewares2([
|
|
250571
250681
|
...typeof _injectedWinterSpecMiddleware !== "undefined" ? _injectedWinterSpecMiddleware : [],
|
|
250572
|
-
|
|
250682
|
+
withUnhandledExceptionHandling2,
|
|
250573
250683
|
serializeResponse(globalSpec, routeSpec, false),
|
|
250574
250684
|
...globalSpec.beforeAuthMiddleware ?? [],
|
|
250575
250685
|
firstAuthMiddlewareThatSucceeds(authMiddlewares, onMultipleAuthMiddlewareFailures),
|
|
250576
250686
|
...globalSpec.afterAuthMiddleware ?? [],
|
|
250577
250687
|
...routeSpec.middleware ?? [],
|
|
250578
|
-
|
|
250579
|
-
|
|
250688
|
+
withMethods2(routeSpec.methods),
|
|
250689
|
+
withInputValidation2({
|
|
250580
250690
|
supportedArrayFormats: globalSpec.supportedArrayFormats ?? [
|
|
250581
250691
|
"brackets",
|
|
250582
250692
|
"comma",
|
|
@@ -250596,17 +250706,17 @@ var createWithWinterSpec = (globalSpec) => {
|
|
|
250596
250706
|
function serializeResponse(globalSpec, routeSpec, skipValidation = false) {
|
|
250597
250707
|
return async (req, ctx, next) => {
|
|
250598
250708
|
const rawResponse = await next(req, ctx);
|
|
250599
|
-
const statusCode = rawResponse instanceof
|
|
250709
|
+
const statusCode = rawResponse instanceof WinterSpecResponse2 ? rawResponse.statusCode() : rawResponse.status;
|
|
250600
250710
|
const isSuccess = statusCode >= 200 && statusCode < 300;
|
|
250601
250711
|
try {
|
|
250602
250712
|
const response = serializeToResponse(isSuccess && !skipValidation && (globalSpec.shouldValidateResponses ?? true), routeSpec, rawResponse);
|
|
250603
250713
|
return response;
|
|
250604
250714
|
} catch (err) {
|
|
250605
|
-
throw new
|
|
250715
|
+
throw new ResponseValidationError2(err);
|
|
250606
250716
|
}
|
|
250607
250717
|
};
|
|
250608
250718
|
}
|
|
250609
|
-
async function
|
|
250719
|
+
async function wrapMiddlewares2(middlewares, routeFn, request, ctx) {
|
|
250610
250720
|
return await middlewares.reduceRight((next, middleware) => {
|
|
250611
250721
|
return async (req, ctx2) => {
|
|
250612
250722
|
return middleware(req, ctx2, next);
|
|
@@ -250615,17 +250725,17 @@ async function wrapMiddlewares(middlewares, routeFn, request, ctx) {
|
|
|
250615
250725
|
}
|
|
250616
250726
|
function serializeToResponse(shouldValidateResponse, routeSpec, response) {
|
|
250617
250727
|
if (!shouldValidateResponse) {
|
|
250618
|
-
return "serializeToResponse" in response ? response.serializeToResponse(
|
|
250728
|
+
return "serializeToResponse" in response ? response.serializeToResponse(z7.any()) : response;
|
|
250619
250729
|
}
|
|
250620
|
-
if (response instanceof
|
|
250621
|
-
if (response instanceof
|
|
250622
|
-
return response.serializeToResponse(routeSpec.jsonResponse ??
|
|
250730
|
+
if (response instanceof WinterSpecResponse2) {
|
|
250731
|
+
if (response instanceof WinterSpecJsonResponse2) {
|
|
250732
|
+
return response.serializeToResponse(routeSpec.jsonResponse ?? z7.any());
|
|
250623
250733
|
}
|
|
250624
|
-
if (response instanceof
|
|
250625
|
-
return response.serializeToResponse(routeSpec.multipartFormDataResponse ??
|
|
250734
|
+
if (response instanceof WinterSpecMultiPartFormDataResponse2) {
|
|
250735
|
+
return response.serializeToResponse(routeSpec.multipartFormDataResponse ?? z7.any());
|
|
250626
250736
|
}
|
|
250627
|
-
if (response instanceof
|
|
250628
|
-
return response.serializeToResponse(
|
|
250737
|
+
if (response instanceof WinterSpecCustomResponse2) {
|
|
250738
|
+
return response.serializeToResponse(z7.any());
|
|
250629
250739
|
}
|
|
250630
250740
|
}
|
|
250631
250741
|
if ("serializeToResponse" in response) {
|
|
@@ -250662,8 +250772,16 @@ function firstAuthMiddlewareThatSucceeds(authMiddlewares, onMultipleAuthMiddlewa
|
|
|
250662
250772
|
};
|
|
250663
250773
|
}
|
|
250664
250774
|
|
|
250665
|
-
// node_modules/winterspec/dist/types/
|
|
250666
|
-
|
|
250775
|
+
// node_modules/@tscircuit/file-server/node_modules/winterspec/dist/types/context.js
|
|
250776
|
+
var DEFAULT_CONTEXT2 = {
|
|
250777
|
+
json: WinterSpecResponse2.json,
|
|
250778
|
+
multipartFormData: WinterSpecResponse2.multipartFormData,
|
|
250779
|
+
custom: WinterSpecResponse2.custom
|
|
250780
|
+
};
|
|
250781
|
+
var getDefaultContext2 = () => ({ ...DEFAULT_CONTEXT2 });
|
|
250782
|
+
|
|
250783
|
+
// node_modules/@tscircuit/file-server/node_modules/winterspec/dist/types/winter-spec.js
|
|
250784
|
+
function makeRequestAgainstWinterSpec2(winterSpec, options = {}) {
|
|
250667
250785
|
return async (request) => {
|
|
250668
250786
|
const { routeMatcher, routeMapWithHandlers, handle404 = () => new Response("Not found", {
|
|
250669
250787
|
status: 404
|
|
@@ -250691,42 +250809,27 @@ function makeRequestAgainstWinterSpec(winterSpec, options = {}) {
|
|
|
250691
250809
|
}
|
|
250692
250810
|
const { matchedRoute, routeParams } = routeMatcher(pathname) ?? {};
|
|
250693
250811
|
let routeFn = matchedRoute && routeMapWithHandlers[matchedRoute];
|
|
250694
|
-
const winterSpecRequest =
|
|
250812
|
+
const winterSpecRequest = createWinterSpecRequest2(request, {
|
|
250695
250813
|
winterSpec,
|
|
250696
250814
|
routeParams: routeParams ?? {}
|
|
250697
250815
|
});
|
|
250698
250816
|
if (!routeFn) {
|
|
250699
|
-
return await handle404(winterSpecRequest,
|
|
250817
|
+
return await handle404(winterSpecRequest, getDefaultContext2());
|
|
250700
250818
|
}
|
|
250701
|
-
return
|
|
250819
|
+
return wrapMiddlewares2(options.middleware ?? [], routeFn, winterSpecRequest, getDefaultContext2());
|
|
250702
250820
|
};
|
|
250703
250821
|
}
|
|
250704
|
-
|
|
250705
|
-
|
|
250706
|
-
var
|
|
250707
|
-
|
|
250708
|
-
|
|
250709
|
-
|
|
250710
|
-
|
|
250711
|
-
const transformToNode = transformToNodeBuilder({
|
|
250712
|
-
defaultOrigin: `http://localhost${port ? `:${port}` : ""}`
|
|
250713
|
-
});
|
|
250714
|
-
return transformToNode((req) => winterSpec.makeRequest(req, {
|
|
250715
|
-
middleware
|
|
250716
|
-
}));
|
|
250717
|
-
};
|
|
250718
|
-
|
|
250719
|
-
// node_modules/@tscircuit/file-server/dist/bundle.js
|
|
250720
|
-
var import_next_route_matcher3 = __toESM2(require_dist8(), 1);
|
|
250721
|
-
// node_modules/winterspec/dist/config/config.js
|
|
250722
|
-
import { z as z6 } from "zod";
|
|
250723
|
-
var winterSpecConfigSchema = z6.object({
|
|
250724
|
-
rootDirectory: z6.string().optional(),
|
|
250725
|
-
tsconfigPath: z6.string().optional(),
|
|
250726
|
-
routesDirectory: z6.string().optional(),
|
|
250727
|
-
platform: z6.enum(["node", "wintercg-minimal"]).default("wintercg-minimal").optional()
|
|
250822
|
+
// node_modules/@tscircuit/file-server/node_modules/winterspec/dist/config/config.js
|
|
250823
|
+
import { z as z8 } from "zod";
|
|
250824
|
+
var winterSpecConfigSchema = z8.object({
|
|
250825
|
+
rootDirectory: z8.string().optional(),
|
|
250826
|
+
tsconfigPath: z8.string().optional(),
|
|
250827
|
+
routesDirectory: z8.string().optional(),
|
|
250828
|
+
platform: z8.enum(["node", "wintercg-minimal"]).default("wintercg-minimal").optional()
|
|
250728
250829
|
}).strict();
|
|
250729
|
-
// node_modules/
|
|
250830
|
+
// node_modules/@tscircuit/file-server/node_modules/winterspec/dist/serve/create-winter-spec-from-route-map.js
|
|
250831
|
+
var import_next_route_matcher3 = __toESM2(require_dist8(), 1);
|
|
250832
|
+
// node_modules/@tscircuit/file-server/node_modules/zustand/esm/vanilla.mjs
|
|
250730
250833
|
var createStoreImpl = (createState) => {
|
|
250731
250834
|
let state;
|
|
250732
250835
|
const listeners = /* @__PURE__ */ new Set;
|
|
@@ -250793,20 +250896,20 @@ var hoist = (store) => {
|
|
|
250793
250896
|
return hoistState(hoistActions(store));
|
|
250794
250897
|
};
|
|
250795
250898
|
|
|
250796
|
-
// node_modules/zustand/esm/middleware.mjs
|
|
250899
|
+
// node_modules/@tscircuit/file-server/node_modules/zustand/esm/middleware.mjs
|
|
250797
250900
|
var combine = (initialState, create) => (...a2) => Object.assign({}, initialState, create(...a2));
|
|
250798
250901
|
|
|
250799
250902
|
// node_modules/@tscircuit/file-server/dist/bundle.js
|
|
250800
|
-
import { z as
|
|
250903
|
+
import { z as z10 } from "zod";
|
|
250801
250904
|
import { z as z24 } from "zod";
|
|
250802
250905
|
import { z as z32 } from "zod";
|
|
250803
250906
|
import { z as z42 } from "zod";
|
|
250804
250907
|
import { z as z52 } from "zod";
|
|
250805
250908
|
import { z as z62 } from "zod";
|
|
250806
250909
|
import { z as z72 } from "zod";
|
|
250807
|
-
import { z as
|
|
250910
|
+
import { z as z82 } from "zod";
|
|
250808
250911
|
import { z as z92 } from "zod";
|
|
250809
|
-
import { z as
|
|
250912
|
+
import { z as z102 } from "zod";
|
|
250810
250913
|
import { z as z11 } from "zod";
|
|
250811
250914
|
import { Buffer as Buffer2 } from "node:buffer";
|
|
250812
250915
|
import { z as z12 } from "zod";
|
|
@@ -250818,31 +250921,31 @@ import { z as z17 } from "zod";
|
|
|
250818
250921
|
import { z as z18 } from "zod";
|
|
250819
250922
|
import { z as z19 } from "zod";
|
|
250820
250923
|
import { z as z20 } from "zod";
|
|
250821
|
-
var fileSchema =
|
|
250822
|
-
file_id:
|
|
250823
|
-
file_path:
|
|
250824
|
-
text_content:
|
|
250825
|
-
binary_content_b64:
|
|
250826
|
-
created_at:
|
|
250924
|
+
var fileSchema = z10.object({
|
|
250925
|
+
file_id: z10.string(),
|
|
250926
|
+
file_path: z10.string(),
|
|
250927
|
+
text_content: z10.string().optional(),
|
|
250928
|
+
binary_content_b64: z10.string().optional(),
|
|
250929
|
+
created_at: z10.string()
|
|
250827
250930
|
}).refine((data) => data.text_content !== undefined !== (data.binary_content_b64 !== undefined), {
|
|
250828
250931
|
message: "Provide either text_content or binary_content_b64",
|
|
250829
250932
|
path: ["text_content"]
|
|
250830
250933
|
});
|
|
250831
|
-
var eventSchema =
|
|
250832
|
-
event_id:
|
|
250833
|
-
event_type:
|
|
250834
|
-
|
|
250835
|
-
|
|
250836
|
-
|
|
250934
|
+
var eventSchema = z10.object({
|
|
250935
|
+
event_id: z10.string(),
|
|
250936
|
+
event_type: z10.union([
|
|
250937
|
+
z10.literal("FILE_UPDATED"),
|
|
250938
|
+
z10.literal("FILE_DELETED"),
|
|
250939
|
+
z10.literal("FILE_CREATED")
|
|
250837
250940
|
]),
|
|
250838
|
-
file_path:
|
|
250839
|
-
created_at:
|
|
250840
|
-
initiator:
|
|
250941
|
+
file_path: z10.string(),
|
|
250942
|
+
created_at: z10.string(),
|
|
250943
|
+
initiator: z10.string().optional()
|
|
250841
250944
|
});
|
|
250842
|
-
var databaseSchema =
|
|
250843
|
-
idCounter:
|
|
250844
|
-
files:
|
|
250845
|
-
events:
|
|
250945
|
+
var databaseSchema = z10.object({
|
|
250946
|
+
idCounter: z10.number().default(0),
|
|
250947
|
+
files: z10.array(fileSchema).default([]),
|
|
250948
|
+
events: z10.array(eventSchema).default([])
|
|
250846
250949
|
});
|
|
250847
250950
|
function normalizePath2(path52) {
|
|
250848
250951
|
if (!path52 || path52 === "/")
|
|
@@ -251272,16 +251375,16 @@ var create_default2 = withRouteSpec({
|
|
|
251272
251375
|
});
|
|
251273
251376
|
var list_default3 = withRouteSpec({
|
|
251274
251377
|
methods: ["GET"],
|
|
251275
|
-
queryParams:
|
|
251276
|
-
since:
|
|
251277
|
-
event_type:
|
|
251378
|
+
queryParams: z82.object({
|
|
251379
|
+
since: z82.string().optional(),
|
|
251380
|
+
event_type: z82.string().optional()
|
|
251278
251381
|
}),
|
|
251279
|
-
jsonResponse:
|
|
251280
|
-
event_list:
|
|
251281
|
-
event_id:
|
|
251282
|
-
event_type:
|
|
251283
|
-
file_path:
|
|
251284
|
-
created_at:
|
|
251382
|
+
jsonResponse: z82.object({
|
|
251383
|
+
event_list: z82.array(z82.object({
|
|
251384
|
+
event_id: z82.string(),
|
|
251385
|
+
event_type: z82.string(),
|
|
251386
|
+
file_path: z82.string().optional(),
|
|
251387
|
+
created_at: z82.string()
|
|
251285
251388
|
}).passthrough())
|
|
251286
251389
|
})
|
|
251287
251390
|
})((req, ctx) => {
|
|
@@ -251299,12 +251402,12 @@ var reset_default = withRouteSpec({
|
|
|
251299
251402
|
});
|
|
251300
251403
|
var delete_default = withRouteSpec({
|
|
251301
251404
|
methods: ["POST", "DELETE"],
|
|
251302
|
-
commonParams:
|
|
251303
|
-
file_id:
|
|
251304
|
-
file_path:
|
|
251305
|
-
initiator:
|
|
251405
|
+
commonParams: z102.object({
|
|
251406
|
+
file_id: z102.string().optional(),
|
|
251407
|
+
file_path: z102.string().optional(),
|
|
251408
|
+
initiator: z102.string().optional()
|
|
251306
251409
|
}),
|
|
251307
|
-
jsonResponse:
|
|
251410
|
+
jsonResponse: z102.union([z102.null(), z102.object({ error: z102.string() })])
|
|
251308
251411
|
})(async (req, ctx) => {
|
|
251309
251412
|
const { file_id, file_path, initiator } = req.commonParams;
|
|
251310
251413
|
if (!file_id && !file_path) {
|
|
@@ -251670,9 +251773,9 @@ var routeMapWithHandlers = {
|
|
|
251670
251773
|
"/": routes_default
|
|
251671
251774
|
};
|
|
251672
251775
|
var winterSpec = {
|
|
251673
|
-
routeMatcher:
|
|
251776
|
+
routeMatcher: import_next_route_matcher4.getRouteMatcher(Object.keys(routeMapWithHandlers)),
|
|
251674
251777
|
routeMapWithHandlers,
|
|
251675
|
-
makeRequest: async (req, options) =>
|
|
251778
|
+
makeRequest: async (req, options) => makeRequestAgainstWinterSpec2(winterSpec, options)(req)
|
|
251676
251779
|
};
|
|
251677
251780
|
var stdin_default = winterSpec;
|
|
251678
251781
|
|
|
@@ -254185,9 +254288,9 @@ import { z as z43 } from "zod";
|
|
|
254185
254288
|
import { z as z53 } from "zod";
|
|
254186
254289
|
import { z as z63 } from "zod";
|
|
254187
254290
|
import { z as z73 } from "zod";
|
|
254188
|
-
import { z as
|
|
254291
|
+
import { z as z83 } from "zod";
|
|
254189
254292
|
import { z as z93 } from "zod";
|
|
254190
|
-
import { z as
|
|
254293
|
+
import { z as z103 } from "zod";
|
|
254191
254294
|
import { z as z112 } from "zod";
|
|
254192
254295
|
import { z as z122 } from "zod";
|
|
254193
254296
|
import { z as z132 } from "zod";
|
|
@@ -254302,8 +254405,8 @@ var M15 = defineExcellonDrillCommand({
|
|
|
254302
254405
|
});
|
|
254303
254406
|
var M16 = defineExcellonDrillCommand({
|
|
254304
254407
|
command_code: "M16",
|
|
254305
|
-
schema:
|
|
254306
|
-
command_code:
|
|
254408
|
+
schema: z83.object({
|
|
254409
|
+
command_code: z83.literal("M16").default("M16")
|
|
254307
254410
|
}),
|
|
254308
254411
|
stringify: () => "M16"
|
|
254309
254412
|
});
|
|
@@ -254316,8 +254419,8 @@ var M30 = defineExcellonDrillCommand({
|
|
|
254316
254419
|
});
|
|
254317
254420
|
var M48 = defineExcellonDrillCommand({
|
|
254318
254421
|
command_code: "M48",
|
|
254319
|
-
schema:
|
|
254320
|
-
command_code:
|
|
254422
|
+
schema: z103.object({
|
|
254423
|
+
command_code: z103.literal("M48").default("M48")
|
|
254321
254424
|
}),
|
|
254322
254425
|
stringify: () => "M48"
|
|
254323
254426
|
});
|
|
@@ -257147,8 +257250,8 @@ __export4(external_exports2, {
|
|
|
257147
257250
|
ZodDiscriminatedUnion: () => ZodDiscriminatedUnion2,
|
|
257148
257251
|
ZodEffects: () => ZodEffects2,
|
|
257149
257252
|
ZodEnum: () => ZodEnum2,
|
|
257150
|
-
ZodError: () =>
|
|
257151
|
-
ZodFirstPartyTypeKind: () =>
|
|
257253
|
+
ZodError: () => ZodError4,
|
|
257254
|
+
ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind4,
|
|
257152
257255
|
ZodFunction: () => ZodFunction2,
|
|
257153
257256
|
ZodIntersection: () => ZodIntersection2,
|
|
257154
257257
|
ZodIssueCode: () => ZodIssueCode2,
|
|
@@ -257387,7 +257490,7 @@ var quotelessJson2 = (obj) => {
|
|
|
257387
257490
|
const json2 = JSON.stringify(obj, null, 2);
|
|
257388
257491
|
return json2.replace(/"([^"]+)":/g, "$1:");
|
|
257389
257492
|
};
|
|
257390
|
-
var
|
|
257493
|
+
var ZodError4 = class _ZodError2 extends Error {
|
|
257391
257494
|
get errors() {
|
|
257392
257495
|
return this.issues;
|
|
257393
257496
|
}
|
|
@@ -257477,8 +257580,8 @@ var ZodError3 = class _ZodError2 extends Error {
|
|
|
257477
257580
|
return this.flatten();
|
|
257478
257581
|
}
|
|
257479
257582
|
};
|
|
257480
|
-
|
|
257481
|
-
const error = new
|
|
257583
|
+
ZodError4.create = (issues) => {
|
|
257584
|
+
const error = new ZodError4(issues);
|
|
257482
257585
|
return error;
|
|
257483
257586
|
};
|
|
257484
257587
|
var errorMap2 = (issue, _ctx) => {
|
|
@@ -257729,7 +257832,7 @@ var handleResult2 = (ctx, result) => {
|
|
|
257729
257832
|
get error() {
|
|
257730
257833
|
if (this._error)
|
|
257731
257834
|
return this._error;
|
|
257732
|
-
const error = new
|
|
257835
|
+
const error = new ZodError4(ctx.common.issues);
|
|
257733
257836
|
this._error = error;
|
|
257734
257837
|
return this._error;
|
|
257735
257838
|
}
|
|
@@ -257928,7 +258031,7 @@ var ZodType2 = class {
|
|
|
257928
258031
|
_refinement(refinement) {
|
|
257929
258032
|
return new ZodEffects2({
|
|
257930
258033
|
schema: this,
|
|
257931
|
-
typeName:
|
|
258034
|
+
typeName: ZodFirstPartyTypeKind4.ZodEffects,
|
|
257932
258035
|
effect: { type: "refinement", refinement }
|
|
257933
258036
|
});
|
|
257934
258037
|
}
|
|
@@ -257993,7 +258096,7 @@ var ZodType2 = class {
|
|
|
257993
258096
|
return new ZodEffects2({
|
|
257994
258097
|
...processCreateParams2(this._def),
|
|
257995
258098
|
schema: this,
|
|
257996
|
-
typeName:
|
|
258099
|
+
typeName: ZodFirstPartyTypeKind4.ZodEffects,
|
|
257997
258100
|
effect: { type: "transform", transform: transform2 }
|
|
257998
258101
|
});
|
|
257999
258102
|
}
|
|
@@ -258003,12 +258106,12 @@ var ZodType2 = class {
|
|
|
258003
258106
|
...processCreateParams2(this._def),
|
|
258004
258107
|
innerType: this,
|
|
258005
258108
|
defaultValue: defaultValueFunc,
|
|
258006
|
-
typeName:
|
|
258109
|
+
typeName: ZodFirstPartyTypeKind4.ZodDefault
|
|
258007
258110
|
});
|
|
258008
258111
|
}
|
|
258009
258112
|
brand() {
|
|
258010
258113
|
return new ZodBranded2({
|
|
258011
|
-
typeName:
|
|
258114
|
+
typeName: ZodFirstPartyTypeKind4.ZodBranded,
|
|
258012
258115
|
type: this,
|
|
258013
258116
|
...processCreateParams2(this._def)
|
|
258014
258117
|
});
|
|
@@ -258019,7 +258122,7 @@ var ZodType2 = class {
|
|
|
258019
258122
|
...processCreateParams2(this._def),
|
|
258020
258123
|
innerType: this,
|
|
258021
258124
|
catchValue: catchValueFunc,
|
|
258022
|
-
typeName:
|
|
258125
|
+
typeName: ZodFirstPartyTypeKind4.ZodCatch
|
|
258023
258126
|
});
|
|
258024
258127
|
}
|
|
258025
258128
|
describe(description) {
|
|
@@ -258660,7 +258763,7 @@ var ZodString2 = class _ZodString2 extends ZodType2 {
|
|
|
258660
258763
|
ZodString2.create = (params2) => {
|
|
258661
258764
|
return new ZodString2({
|
|
258662
258765
|
checks: [],
|
|
258663
|
-
typeName:
|
|
258766
|
+
typeName: ZodFirstPartyTypeKind4.ZodString,
|
|
258664
258767
|
coerce: params2?.coerce ?? false,
|
|
258665
258768
|
...processCreateParams2(params2)
|
|
258666
258769
|
});
|
|
@@ -258900,7 +259003,7 @@ var ZodNumber2 = class _ZodNumber2 extends ZodType2 {
|
|
|
258900
259003
|
ZodNumber2.create = (params2) => {
|
|
258901
259004
|
return new ZodNumber2({
|
|
258902
259005
|
checks: [],
|
|
258903
|
-
typeName:
|
|
259006
|
+
typeName: ZodFirstPartyTypeKind4.ZodNumber,
|
|
258904
259007
|
coerce: params2?.coerce || false,
|
|
258905
259008
|
...processCreateParams2(params2)
|
|
258906
259009
|
});
|
|
@@ -259072,7 +259175,7 @@ var ZodBigInt2 = class _ZodBigInt2 extends ZodType2 {
|
|
|
259072
259175
|
ZodBigInt2.create = (params2) => {
|
|
259073
259176
|
return new ZodBigInt2({
|
|
259074
259177
|
checks: [],
|
|
259075
|
-
typeName:
|
|
259178
|
+
typeName: ZodFirstPartyTypeKind4.ZodBigInt,
|
|
259076
259179
|
coerce: params2?.coerce ?? false,
|
|
259077
259180
|
...processCreateParams2(params2)
|
|
259078
259181
|
});
|
|
@@ -259097,7 +259200,7 @@ var ZodBoolean2 = class extends ZodType2 {
|
|
|
259097
259200
|
};
|
|
259098
259201
|
ZodBoolean2.create = (params2) => {
|
|
259099
259202
|
return new ZodBoolean2({
|
|
259100
|
-
typeName:
|
|
259203
|
+
typeName: ZodFirstPartyTypeKind4.ZodBoolean,
|
|
259101
259204
|
coerce: params2?.coerce || false,
|
|
259102
259205
|
...processCreateParams2(params2)
|
|
259103
259206
|
});
|
|
@@ -259207,7 +259310,7 @@ ZodDate2.create = (params2) => {
|
|
|
259207
259310
|
return new ZodDate2({
|
|
259208
259311
|
checks: [],
|
|
259209
259312
|
coerce: params2?.coerce || false,
|
|
259210
|
-
typeName:
|
|
259313
|
+
typeName: ZodFirstPartyTypeKind4.ZodDate,
|
|
259211
259314
|
...processCreateParams2(params2)
|
|
259212
259315
|
});
|
|
259213
259316
|
};
|
|
@@ -259228,7 +259331,7 @@ var ZodSymbol2 = class extends ZodType2 {
|
|
|
259228
259331
|
};
|
|
259229
259332
|
ZodSymbol2.create = (params2) => {
|
|
259230
259333
|
return new ZodSymbol2({
|
|
259231
|
-
typeName:
|
|
259334
|
+
typeName: ZodFirstPartyTypeKind4.ZodSymbol,
|
|
259232
259335
|
...processCreateParams2(params2)
|
|
259233
259336
|
});
|
|
259234
259337
|
};
|
|
@@ -259249,7 +259352,7 @@ var ZodUndefined2 = class extends ZodType2 {
|
|
|
259249
259352
|
};
|
|
259250
259353
|
ZodUndefined2.create = (params2) => {
|
|
259251
259354
|
return new ZodUndefined2({
|
|
259252
|
-
typeName:
|
|
259355
|
+
typeName: ZodFirstPartyTypeKind4.ZodUndefined,
|
|
259253
259356
|
...processCreateParams2(params2)
|
|
259254
259357
|
});
|
|
259255
259358
|
};
|
|
@@ -259270,7 +259373,7 @@ var ZodNull2 = class extends ZodType2 {
|
|
|
259270
259373
|
};
|
|
259271
259374
|
ZodNull2.create = (params2) => {
|
|
259272
259375
|
return new ZodNull2({
|
|
259273
|
-
typeName:
|
|
259376
|
+
typeName: ZodFirstPartyTypeKind4.ZodNull,
|
|
259274
259377
|
...processCreateParams2(params2)
|
|
259275
259378
|
});
|
|
259276
259379
|
};
|
|
@@ -259285,7 +259388,7 @@ var ZodAny2 = class extends ZodType2 {
|
|
|
259285
259388
|
};
|
|
259286
259389
|
ZodAny2.create = (params2) => {
|
|
259287
259390
|
return new ZodAny2({
|
|
259288
|
-
typeName:
|
|
259391
|
+
typeName: ZodFirstPartyTypeKind4.ZodAny,
|
|
259289
259392
|
...processCreateParams2(params2)
|
|
259290
259393
|
});
|
|
259291
259394
|
};
|
|
@@ -259300,7 +259403,7 @@ var ZodUnknown2 = class extends ZodType2 {
|
|
|
259300
259403
|
};
|
|
259301
259404
|
ZodUnknown2.create = (params2) => {
|
|
259302
259405
|
return new ZodUnknown2({
|
|
259303
|
-
typeName:
|
|
259406
|
+
typeName: ZodFirstPartyTypeKind4.ZodUnknown,
|
|
259304
259407
|
...processCreateParams2(params2)
|
|
259305
259408
|
});
|
|
259306
259409
|
};
|
|
@@ -259317,7 +259420,7 @@ var ZodNever2 = class extends ZodType2 {
|
|
|
259317
259420
|
};
|
|
259318
259421
|
ZodNever2.create = (params2) => {
|
|
259319
259422
|
return new ZodNever2({
|
|
259320
|
-
typeName:
|
|
259423
|
+
typeName: ZodFirstPartyTypeKind4.ZodNever,
|
|
259321
259424
|
...processCreateParams2(params2)
|
|
259322
259425
|
});
|
|
259323
259426
|
};
|
|
@@ -259338,7 +259441,7 @@ var ZodVoid2 = class extends ZodType2 {
|
|
|
259338
259441
|
};
|
|
259339
259442
|
ZodVoid2.create = (params2) => {
|
|
259340
259443
|
return new ZodVoid2({
|
|
259341
|
-
typeName:
|
|
259444
|
+
typeName: ZodFirstPartyTypeKind4.ZodVoid,
|
|
259342
259445
|
...processCreateParams2(params2)
|
|
259343
259446
|
});
|
|
259344
259447
|
};
|
|
@@ -259439,7 +259542,7 @@ ZodArray2.create = (schema, params2) => {
|
|
|
259439
259542
|
minLength: null,
|
|
259440
259543
|
maxLength: null,
|
|
259441
259544
|
exactLength: null,
|
|
259442
|
-
typeName:
|
|
259545
|
+
typeName: ZodFirstPartyTypeKind4.ZodArray,
|
|
259443
259546
|
...processCreateParams2(params2)
|
|
259444
259547
|
});
|
|
259445
259548
|
};
|
|
@@ -259617,7 +259720,7 @@ var ZodObject2 = class _ZodObject2 extends ZodType2 {
|
|
|
259617
259720
|
...this._def.shape(),
|
|
259618
259721
|
...merging._def.shape()
|
|
259619
259722
|
}),
|
|
259620
|
-
typeName:
|
|
259723
|
+
typeName: ZodFirstPartyTypeKind4.ZodObject
|
|
259621
259724
|
});
|
|
259622
259725
|
return merged;
|
|
259623
259726
|
}
|
|
@@ -259700,7 +259803,7 @@ ZodObject2.create = (shape, params2) => {
|
|
|
259700
259803
|
shape: () => shape,
|
|
259701
259804
|
unknownKeys: "strip",
|
|
259702
259805
|
catchall: ZodNever2.create(),
|
|
259703
|
-
typeName:
|
|
259806
|
+
typeName: ZodFirstPartyTypeKind4.ZodObject,
|
|
259704
259807
|
...processCreateParams2(params2)
|
|
259705
259808
|
});
|
|
259706
259809
|
};
|
|
@@ -259709,7 +259812,7 @@ ZodObject2.strictCreate = (shape, params2) => {
|
|
|
259709
259812
|
shape: () => shape,
|
|
259710
259813
|
unknownKeys: "strict",
|
|
259711
259814
|
catchall: ZodNever2.create(),
|
|
259712
|
-
typeName:
|
|
259815
|
+
typeName: ZodFirstPartyTypeKind4.ZodObject,
|
|
259713
259816
|
...processCreateParams2(params2)
|
|
259714
259817
|
});
|
|
259715
259818
|
};
|
|
@@ -259718,7 +259821,7 @@ ZodObject2.lazycreate = (shape, params2) => {
|
|
|
259718
259821
|
shape,
|
|
259719
259822
|
unknownKeys: "strip",
|
|
259720
259823
|
catchall: ZodNever2.create(),
|
|
259721
|
-
typeName:
|
|
259824
|
+
typeName: ZodFirstPartyTypeKind4.ZodObject,
|
|
259722
259825
|
...processCreateParams2(params2)
|
|
259723
259826
|
});
|
|
259724
259827
|
};
|
|
@@ -259738,7 +259841,7 @@ var ZodUnion2 = class extends ZodType2 {
|
|
|
259738
259841
|
return result.result;
|
|
259739
259842
|
}
|
|
259740
259843
|
}
|
|
259741
|
-
const unionErrors = results.map((result) => new
|
|
259844
|
+
const unionErrors = results.map((result) => new ZodError4(result.ctx.common.issues));
|
|
259742
259845
|
addIssueToContext2(ctx, {
|
|
259743
259846
|
code: ZodIssueCode2.invalid_union,
|
|
259744
259847
|
unionErrors
|
|
@@ -259794,7 +259897,7 @@ var ZodUnion2 = class extends ZodType2 {
|
|
|
259794
259897
|
ctx.common.issues.push(...dirty.ctx.common.issues);
|
|
259795
259898
|
return dirty.result;
|
|
259796
259899
|
}
|
|
259797
|
-
const unionErrors = issues.map((issues2) => new
|
|
259900
|
+
const unionErrors = issues.map((issues2) => new ZodError4(issues2));
|
|
259798
259901
|
addIssueToContext2(ctx, {
|
|
259799
259902
|
code: ZodIssueCode2.invalid_union,
|
|
259800
259903
|
unionErrors
|
|
@@ -259809,7 +259912,7 @@ var ZodUnion2 = class extends ZodType2 {
|
|
|
259809
259912
|
ZodUnion2.create = (types2, params2) => {
|
|
259810
259913
|
return new ZodUnion2({
|
|
259811
259914
|
options: types2,
|
|
259812
|
-
typeName:
|
|
259915
|
+
typeName: ZodFirstPartyTypeKind4.ZodUnion,
|
|
259813
259916
|
...processCreateParams2(params2)
|
|
259814
259917
|
});
|
|
259815
259918
|
};
|
|
@@ -259904,7 +260007,7 @@ var ZodDiscriminatedUnion2 = class _ZodDiscriminatedUnion2 extends ZodType2 {
|
|
|
259904
260007
|
}
|
|
259905
260008
|
}
|
|
259906
260009
|
return new _ZodDiscriminatedUnion2({
|
|
259907
|
-
typeName:
|
|
260010
|
+
typeName: ZodFirstPartyTypeKind4.ZodDiscriminatedUnion,
|
|
259908
260011
|
discriminator,
|
|
259909
260012
|
options,
|
|
259910
260013
|
optionsMap,
|
|
@@ -259999,7 +260102,7 @@ ZodIntersection2.create = (left, right, params2) => {
|
|
|
259999
260102
|
return new ZodIntersection2({
|
|
260000
260103
|
left,
|
|
260001
260104
|
right,
|
|
260002
|
-
typeName:
|
|
260105
|
+
typeName: ZodFirstPartyTypeKind4.ZodIntersection,
|
|
260003
260106
|
...processCreateParams2(params2)
|
|
260004
260107
|
});
|
|
260005
260108
|
};
|
|
@@ -260065,7 +260168,7 @@ ZodTuple2.create = (schemas, params2) => {
|
|
|
260065
260168
|
}
|
|
260066
260169
|
return new ZodTuple2({
|
|
260067
260170
|
items: schemas,
|
|
260068
|
-
typeName:
|
|
260171
|
+
typeName: ZodFirstPartyTypeKind4.ZodTuple,
|
|
260069
260172
|
rest: null,
|
|
260070
260173
|
...processCreateParams2(params2)
|
|
260071
260174
|
});
|
|
@@ -260111,14 +260214,14 @@ var ZodRecord2 = class _ZodRecord2 extends ZodType2 {
|
|
|
260111
260214
|
return new _ZodRecord2({
|
|
260112
260215
|
keyType: first,
|
|
260113
260216
|
valueType: second,
|
|
260114
|
-
typeName:
|
|
260217
|
+
typeName: ZodFirstPartyTypeKind4.ZodRecord,
|
|
260115
260218
|
...processCreateParams2(third)
|
|
260116
260219
|
});
|
|
260117
260220
|
}
|
|
260118
260221
|
return new _ZodRecord2({
|
|
260119
260222
|
keyType: ZodString2.create(),
|
|
260120
260223
|
valueType: first,
|
|
260121
|
-
typeName:
|
|
260224
|
+
typeName: ZodFirstPartyTypeKind4.ZodRecord,
|
|
260122
260225
|
...processCreateParams2(second)
|
|
260123
260226
|
});
|
|
260124
260227
|
}
|
|
@@ -260185,7 +260288,7 @@ ZodMap2.create = (keyType, valueType, params2) => {
|
|
|
260185
260288
|
return new ZodMap2({
|
|
260186
260289
|
valueType,
|
|
260187
260290
|
keyType,
|
|
260188
|
-
typeName:
|
|
260291
|
+
typeName: ZodFirstPartyTypeKind4.ZodMap,
|
|
260189
260292
|
...processCreateParams2(params2)
|
|
260190
260293
|
});
|
|
260191
260294
|
};
|
|
@@ -260270,7 +260373,7 @@ ZodSet2.create = (valueType, params2) => {
|
|
|
260270
260373
|
valueType,
|
|
260271
260374
|
minSize: null,
|
|
260272
260375
|
maxSize: null,
|
|
260273
|
-
typeName:
|
|
260376
|
+
typeName: ZodFirstPartyTypeKind4.ZodSet,
|
|
260274
260377
|
...processCreateParams2(params2)
|
|
260275
260378
|
});
|
|
260276
260379
|
};
|
|
@@ -260316,7 +260419,7 @@ var ZodFunction2 = class _ZodFunction2 extends ZodType2 {
|
|
|
260316
260419
|
if (this._def.returns instanceof ZodPromise2) {
|
|
260317
260420
|
const me3 = this;
|
|
260318
260421
|
return OK2(async function(...args) {
|
|
260319
|
-
const error = new
|
|
260422
|
+
const error = new ZodError4([]);
|
|
260320
260423
|
const parsedArgs = await me3._def.args.parseAsync(args, params2).catch((e4) => {
|
|
260321
260424
|
error.addIssue(makeArgsIssue(args, e4));
|
|
260322
260425
|
throw error;
|
|
@@ -260333,12 +260436,12 @@ var ZodFunction2 = class _ZodFunction2 extends ZodType2 {
|
|
|
260333
260436
|
return OK2(function(...args) {
|
|
260334
260437
|
const parsedArgs = me3._def.args.safeParse(args, params2);
|
|
260335
260438
|
if (!parsedArgs.success) {
|
|
260336
|
-
throw new
|
|
260439
|
+
throw new ZodError4([makeArgsIssue(args, parsedArgs.error)]);
|
|
260337
260440
|
}
|
|
260338
260441
|
const result = Reflect.apply(fn3, this, parsedArgs.data);
|
|
260339
260442
|
const parsedReturns = me3._def.returns.safeParse(result, params2);
|
|
260340
260443
|
if (!parsedReturns.success) {
|
|
260341
|
-
throw new
|
|
260444
|
+
throw new ZodError4([makeReturnsIssue(result, parsedReturns.error)]);
|
|
260342
260445
|
}
|
|
260343
260446
|
return parsedReturns.data;
|
|
260344
260447
|
});
|
|
@@ -260374,7 +260477,7 @@ var ZodFunction2 = class _ZodFunction2 extends ZodType2 {
|
|
|
260374
260477
|
return new _ZodFunction2({
|
|
260375
260478
|
args: args ? args : ZodTuple2.create([]).rest(ZodUnknown2.create()),
|
|
260376
260479
|
returns: returns || ZodUnknown2.create(),
|
|
260377
|
-
typeName:
|
|
260480
|
+
typeName: ZodFirstPartyTypeKind4.ZodFunction,
|
|
260378
260481
|
...processCreateParams2(params2)
|
|
260379
260482
|
});
|
|
260380
260483
|
}
|
|
@@ -260392,7 +260495,7 @@ var ZodLazy2 = class extends ZodType2 {
|
|
|
260392
260495
|
ZodLazy2.create = (getter, params2) => {
|
|
260393
260496
|
return new ZodLazy2({
|
|
260394
260497
|
getter,
|
|
260395
|
-
typeName:
|
|
260498
|
+
typeName: ZodFirstPartyTypeKind4.ZodLazy,
|
|
260396
260499
|
...processCreateParams2(params2)
|
|
260397
260500
|
});
|
|
260398
260501
|
};
|
|
@@ -260416,14 +260519,14 @@ var ZodLiteral2 = class extends ZodType2 {
|
|
|
260416
260519
|
ZodLiteral2.create = (value, params2) => {
|
|
260417
260520
|
return new ZodLiteral2({
|
|
260418
260521
|
value,
|
|
260419
|
-
typeName:
|
|
260522
|
+
typeName: ZodFirstPartyTypeKind4.ZodLiteral,
|
|
260420
260523
|
...processCreateParams2(params2)
|
|
260421
260524
|
});
|
|
260422
260525
|
};
|
|
260423
260526
|
function createZodEnum2(values, params2) {
|
|
260424
260527
|
return new ZodEnum2({
|
|
260425
260528
|
values,
|
|
260426
|
-
typeName:
|
|
260529
|
+
typeName: ZodFirstPartyTypeKind4.ZodEnum,
|
|
260427
260530
|
...processCreateParams2(params2)
|
|
260428
260531
|
});
|
|
260429
260532
|
}
|
|
@@ -260526,7 +260629,7 @@ var ZodNativeEnum2 = class extends ZodType2 {
|
|
|
260526
260629
|
ZodNativeEnum2.create = (values, params2) => {
|
|
260527
260630
|
return new ZodNativeEnum2({
|
|
260528
260631
|
values,
|
|
260529
|
-
typeName:
|
|
260632
|
+
typeName: ZodFirstPartyTypeKind4.ZodNativeEnum,
|
|
260530
260633
|
...processCreateParams2(params2)
|
|
260531
260634
|
});
|
|
260532
260635
|
};
|
|
@@ -260556,7 +260659,7 @@ var ZodPromise2 = class extends ZodType2 {
|
|
|
260556
260659
|
ZodPromise2.create = (schema, params2) => {
|
|
260557
260660
|
return new ZodPromise2({
|
|
260558
260661
|
type: schema,
|
|
260559
|
-
typeName:
|
|
260662
|
+
typeName: ZodFirstPartyTypeKind4.ZodPromise,
|
|
260560
260663
|
...processCreateParams2(params2)
|
|
260561
260664
|
});
|
|
260562
260665
|
};
|
|
@@ -260565,7 +260668,7 @@ var ZodEffects2 = class extends ZodType2 {
|
|
|
260565
260668
|
return this._def.schema;
|
|
260566
260669
|
}
|
|
260567
260670
|
sourceType() {
|
|
260568
|
-
return this._def.schema._def.typeName ===
|
|
260671
|
+
return this._def.schema._def.typeName === ZodFirstPartyTypeKind4.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
260569
260672
|
}
|
|
260570
260673
|
_parse(input) {
|
|
260571
260674
|
const { status, ctx } = this._processInputParams(input);
|
|
@@ -260686,7 +260789,7 @@ var ZodEffects2 = class extends ZodType2 {
|
|
|
260686
260789
|
ZodEffects2.create = (schema, effect, params2) => {
|
|
260687
260790
|
return new ZodEffects2({
|
|
260688
260791
|
schema,
|
|
260689
|
-
typeName:
|
|
260792
|
+
typeName: ZodFirstPartyTypeKind4.ZodEffects,
|
|
260690
260793
|
effect,
|
|
260691
260794
|
...processCreateParams2(params2)
|
|
260692
260795
|
});
|
|
@@ -260695,7 +260798,7 @@ ZodEffects2.createWithPreprocess = (preprocess, schema, params2) => {
|
|
|
260695
260798
|
return new ZodEffects2({
|
|
260696
260799
|
schema,
|
|
260697
260800
|
effect: { type: "preprocess", transform: preprocess },
|
|
260698
|
-
typeName:
|
|
260801
|
+
typeName: ZodFirstPartyTypeKind4.ZodEffects,
|
|
260699
260802
|
...processCreateParams2(params2)
|
|
260700
260803
|
});
|
|
260701
260804
|
};
|
|
@@ -260714,7 +260817,7 @@ var ZodOptional2 = class extends ZodType2 {
|
|
|
260714
260817
|
ZodOptional2.create = (type, params2) => {
|
|
260715
260818
|
return new ZodOptional2({
|
|
260716
260819
|
innerType: type,
|
|
260717
|
-
typeName:
|
|
260820
|
+
typeName: ZodFirstPartyTypeKind4.ZodOptional,
|
|
260718
260821
|
...processCreateParams2(params2)
|
|
260719
260822
|
});
|
|
260720
260823
|
};
|
|
@@ -260733,7 +260836,7 @@ var ZodNullable2 = class extends ZodType2 {
|
|
|
260733
260836
|
ZodNullable2.create = (type, params2) => {
|
|
260734
260837
|
return new ZodNullable2({
|
|
260735
260838
|
innerType: type,
|
|
260736
|
-
typeName:
|
|
260839
|
+
typeName: ZodFirstPartyTypeKind4.ZodNullable,
|
|
260737
260840
|
...processCreateParams2(params2)
|
|
260738
260841
|
});
|
|
260739
260842
|
};
|
|
@@ -260757,7 +260860,7 @@ var ZodDefault2 = class extends ZodType2 {
|
|
|
260757
260860
|
ZodDefault2.create = (type, params2) => {
|
|
260758
260861
|
return new ZodDefault2({
|
|
260759
260862
|
innerType: type,
|
|
260760
|
-
typeName:
|
|
260863
|
+
typeName: ZodFirstPartyTypeKind4.ZodDefault,
|
|
260761
260864
|
defaultValue: typeof params2.default === "function" ? params2.default : () => params2.default,
|
|
260762
260865
|
...processCreateParams2(params2)
|
|
260763
260866
|
});
|
|
@@ -260785,7 +260888,7 @@ var ZodCatch2 = class extends ZodType2 {
|
|
|
260785
260888
|
status: "valid",
|
|
260786
260889
|
value: result2.status === "valid" ? result2.value : this._def.catchValue({
|
|
260787
260890
|
get error() {
|
|
260788
|
-
return new
|
|
260891
|
+
return new ZodError4(newCtx.common.issues);
|
|
260789
260892
|
},
|
|
260790
260893
|
input: newCtx.data
|
|
260791
260894
|
})
|
|
@@ -260796,7 +260899,7 @@ var ZodCatch2 = class extends ZodType2 {
|
|
|
260796
260899
|
status: "valid",
|
|
260797
260900
|
value: result.status === "valid" ? result.value : this._def.catchValue({
|
|
260798
260901
|
get error() {
|
|
260799
|
-
return new
|
|
260902
|
+
return new ZodError4(newCtx.common.issues);
|
|
260800
260903
|
},
|
|
260801
260904
|
input: newCtx.data
|
|
260802
260905
|
})
|
|
@@ -260810,7 +260913,7 @@ var ZodCatch2 = class extends ZodType2 {
|
|
|
260810
260913
|
ZodCatch2.create = (type, params2) => {
|
|
260811
260914
|
return new ZodCatch2({
|
|
260812
260915
|
innerType: type,
|
|
260813
|
-
typeName:
|
|
260916
|
+
typeName: ZodFirstPartyTypeKind4.ZodCatch,
|
|
260814
260917
|
catchValue: typeof params2.catch === "function" ? params2.catch : () => params2.catch,
|
|
260815
260918
|
...processCreateParams2(params2)
|
|
260816
260919
|
});
|
|
@@ -260832,7 +260935,7 @@ var ZodNaN2 = class extends ZodType2 {
|
|
|
260832
260935
|
};
|
|
260833
260936
|
ZodNaN2.create = (params2) => {
|
|
260834
260937
|
return new ZodNaN2({
|
|
260835
|
-
typeName:
|
|
260938
|
+
typeName: ZodFirstPartyTypeKind4.ZodNaN,
|
|
260836
260939
|
...processCreateParams2(params2)
|
|
260837
260940
|
});
|
|
260838
260941
|
};
|
|
@@ -260902,7 +261005,7 @@ var ZodPipeline2 = class _ZodPipeline2 extends ZodType2 {
|
|
|
260902
261005
|
return new _ZodPipeline2({
|
|
260903
261006
|
in: a2,
|
|
260904
261007
|
out: b,
|
|
260905
|
-
typeName:
|
|
261008
|
+
typeName: ZodFirstPartyTypeKind4.ZodPipeline
|
|
260906
261009
|
});
|
|
260907
261010
|
}
|
|
260908
261011
|
};
|
|
@@ -260924,7 +261027,7 @@ var ZodReadonly2 = class extends ZodType2 {
|
|
|
260924
261027
|
ZodReadonly2.create = (type, params2) => {
|
|
260925
261028
|
return new ZodReadonly2({
|
|
260926
261029
|
innerType: type,
|
|
260927
|
-
typeName:
|
|
261030
|
+
typeName: ZodFirstPartyTypeKind4.ZodReadonly,
|
|
260928
261031
|
...processCreateParams2(params2)
|
|
260929
261032
|
});
|
|
260930
261033
|
};
|
|
@@ -260958,7 +261061,7 @@ function custom2(check, _params = {}, fatal) {
|
|
|
260958
261061
|
var late2 = {
|
|
260959
261062
|
object: ZodObject2.lazycreate
|
|
260960
261063
|
};
|
|
260961
|
-
var
|
|
261064
|
+
var ZodFirstPartyTypeKind4;
|
|
260962
261065
|
(function(ZodFirstPartyTypeKind22) {
|
|
260963
261066
|
ZodFirstPartyTypeKind22["ZodString"] = "ZodString";
|
|
260964
261067
|
ZodFirstPartyTypeKind22["ZodNumber"] = "ZodNumber";
|
|
@@ -260996,7 +261099,7 @@ var ZodFirstPartyTypeKind3;
|
|
|
260996
261099
|
ZodFirstPartyTypeKind22["ZodBranded"] = "ZodBranded";
|
|
260997
261100
|
ZodFirstPartyTypeKind22["ZodPipeline"] = "ZodPipeline";
|
|
260998
261101
|
ZodFirstPartyTypeKind22["ZodReadonly"] = "ZodReadonly";
|
|
260999
|
-
})(
|
|
261102
|
+
})(ZodFirstPartyTypeKind4 || (ZodFirstPartyTypeKind4 = {}));
|
|
261000
261103
|
var instanceOfType2 = (cls, params2 = {
|
|
261001
261104
|
message: `Input not instance of ${cls.name}`
|
|
261002
261105
|
}) => custom2((data) => data instanceof cls, params2);
|
|
@@ -267444,9 +267547,9 @@ import { z as z410 } from "zod";
|
|
|
267444
267547
|
import { z as z54 } from "zod";
|
|
267445
267548
|
import { z as z64 } from "zod";
|
|
267446
267549
|
import { z as z74 } from "zod";
|
|
267447
|
-
import { z as
|
|
267550
|
+
import { z as z84 } from "zod";
|
|
267448
267551
|
import { z as z94 } from "zod";
|
|
267449
|
-
import { z as
|
|
267552
|
+
import { z as z104 } from "zod";
|
|
267450
267553
|
import { z as z113 } from "zod";
|
|
267451
267554
|
import { z as z143 } from "zod";
|
|
267452
267555
|
import { z as z123 } from "zod";
|
|
@@ -267520,7 +267623,7 @@ import { z as z80 } from "zod";
|
|
|
267520
267623
|
import { z as z81 } from "zod";
|
|
267521
267624
|
import { z as z822 } from "zod";
|
|
267522
267625
|
import { z as z832 } from "zod";
|
|
267523
|
-
import { z as
|
|
267626
|
+
import { z as z842 } from "zod";
|
|
267524
267627
|
import { z as z85 } from "zod";
|
|
267525
267628
|
import { z as z86 } from "zod";
|
|
267526
267629
|
import { z as z87 } from "zod";
|
|
@@ -267540,7 +267643,7 @@ import { z as z100 } from "zod";
|
|
|
267540
267643
|
import { z as z101 } from "zod";
|
|
267541
267644
|
import { z as z1022 } from "zod";
|
|
267542
267645
|
import { z as z1032 } from "zod";
|
|
267543
|
-
import { z as
|
|
267646
|
+
import { z as z1042 } from "zod";
|
|
267544
267647
|
import { z as z105 } from "zod";
|
|
267545
267648
|
import { z as z106 } from "zod";
|
|
267546
267649
|
import { z as z107 } from "zod";
|
|
@@ -268148,10 +268251,10 @@ var pcbRenderLayer3 = z74.enum([
|
|
|
268148
268251
|
"drill"
|
|
268149
268252
|
]);
|
|
268150
268253
|
expectTypesMatch4(true);
|
|
268151
|
-
var asset3 =
|
|
268152
|
-
project_relative_path:
|
|
268153
|
-
url:
|
|
268154
|
-
mimetype:
|
|
268254
|
+
var asset3 = z84.object({
|
|
268255
|
+
project_relative_path: z84.string(),
|
|
268256
|
+
url: z84.string(),
|
|
268257
|
+
mimetype: z84.string()
|
|
268155
268258
|
});
|
|
268156
268259
|
expectTypesMatch4(true);
|
|
268157
268260
|
var kicadAt4 = point7.extend({
|
|
@@ -268222,29 +268325,29 @@ var kicadFootprintMetadata4 = z94.object({
|
|
|
268222
268325
|
model: kicadFootprintModel4.optional()
|
|
268223
268326
|
});
|
|
268224
268327
|
expectTypesMatch4(true);
|
|
268225
|
-
var kicadSymbolPinNumbers4 =
|
|
268226
|
-
hide:
|
|
268328
|
+
var kicadSymbolPinNumbers4 = z104.object({
|
|
268329
|
+
hide: z104.boolean().optional()
|
|
268227
268330
|
});
|
|
268228
268331
|
expectTypesMatch4(true);
|
|
268229
|
-
var kicadSymbolPinNames4 =
|
|
268332
|
+
var kicadSymbolPinNames4 = z104.object({
|
|
268230
268333
|
offset: distance8.optional(),
|
|
268231
|
-
hide:
|
|
268334
|
+
hide: z104.boolean().optional()
|
|
268232
268335
|
});
|
|
268233
268336
|
expectTypesMatch4(true);
|
|
268234
|
-
var kicadSymbolEffects4 =
|
|
268337
|
+
var kicadSymbolEffects4 = z104.object({
|
|
268235
268338
|
font: kicadFont4.optional(),
|
|
268236
|
-
justify:
|
|
268237
|
-
hide:
|
|
268339
|
+
justify: z104.union([z104.string(), z104.array(z104.string())]).optional(),
|
|
268340
|
+
hide: z104.boolean().optional()
|
|
268238
268341
|
});
|
|
268239
268342
|
expectTypesMatch4(true);
|
|
268240
|
-
var kicadSymbolProperty4 =
|
|
268241
|
-
value:
|
|
268242
|
-
id:
|
|
268343
|
+
var kicadSymbolProperty4 = z104.object({
|
|
268344
|
+
value: z104.string(),
|
|
268345
|
+
id: z104.union([z104.number(), z104.string()]).optional(),
|
|
268243
268346
|
at: kicadAt4.optional(),
|
|
268244
268347
|
effects: kicadSymbolEffects4.optional()
|
|
268245
268348
|
});
|
|
268246
268349
|
expectTypesMatch4(true);
|
|
268247
|
-
var kicadSymbolProperties4 =
|
|
268350
|
+
var kicadSymbolProperties4 = z104.object({
|
|
268248
268351
|
Reference: kicadSymbolProperty4.optional(),
|
|
268249
268352
|
Value: kicadSymbolProperty4.optional(),
|
|
268250
268353
|
Footprint: kicadSymbolProperty4.optional(),
|
|
@@ -268254,16 +268357,16 @@ var kicadSymbolProperties4 = z103.object({
|
|
|
268254
268357
|
ki_fp_filters: kicadSymbolProperty4.optional()
|
|
268255
268358
|
});
|
|
268256
268359
|
expectTypesMatch4(true);
|
|
268257
|
-
var kicadSymbolMetadata4 =
|
|
268258
|
-
symbolName:
|
|
268259
|
-
extends:
|
|
268360
|
+
var kicadSymbolMetadata4 = z104.object({
|
|
268361
|
+
symbolName: z104.string().optional(),
|
|
268362
|
+
extends: z104.string().optional(),
|
|
268260
268363
|
pinNumbers: kicadSymbolPinNumbers4.optional(),
|
|
268261
268364
|
pinNames: kicadSymbolPinNames4.optional(),
|
|
268262
|
-
excludeFromSim:
|
|
268263
|
-
inBom:
|
|
268264
|
-
onBoard:
|
|
268365
|
+
excludeFromSim: z104.boolean().optional(),
|
|
268366
|
+
inBom: z104.boolean().optional(),
|
|
268367
|
+
onBoard: z104.boolean().optional(),
|
|
268265
268368
|
properties: kicadSymbolProperties4.optional(),
|
|
268266
|
-
embeddedFonts:
|
|
268369
|
+
embeddedFonts: z104.boolean().optional()
|
|
268267
268370
|
});
|
|
268268
268371
|
expectTypesMatch4(true);
|
|
268269
268372
|
var base_circuit_json_error3 = z113.object({
|
|
@@ -269075,19 +269178,19 @@ var schematic_manual_edit_conflict_warning3 = z832.object({
|
|
|
269075
269178
|
source_component_id: z832.string()
|
|
269076
269179
|
}).describe("Warning emitted when a component has both manual placement and explicit schX/schY coordinates");
|
|
269077
269180
|
expectTypesMatch4(true);
|
|
269078
|
-
var schematic_group3 =
|
|
269079
|
-
type:
|
|
269181
|
+
var schematic_group3 = z842.object({
|
|
269182
|
+
type: z842.literal("schematic_group"),
|
|
269080
269183
|
schematic_group_id: getZodPrefixedIdWithDefault3("schematic_group"),
|
|
269081
|
-
source_group_id:
|
|
269082
|
-
is_subcircuit:
|
|
269083
|
-
subcircuit_id:
|
|
269184
|
+
source_group_id: z842.string(),
|
|
269185
|
+
is_subcircuit: z842.boolean().optional(),
|
|
269186
|
+
subcircuit_id: z842.string().optional(),
|
|
269084
269187
|
width: length3,
|
|
269085
269188
|
height: length3,
|
|
269086
269189
|
center: point7,
|
|
269087
|
-
schematic_component_ids:
|
|
269088
|
-
show_as_schematic_box:
|
|
269089
|
-
name:
|
|
269090
|
-
description:
|
|
269190
|
+
schematic_component_ids: z842.array(z842.string()),
|
|
269191
|
+
show_as_schematic_box: z842.boolean().optional(),
|
|
269192
|
+
name: z842.string().optional(),
|
|
269193
|
+
description: z842.string().optional()
|
|
269091
269194
|
}).describe("Defines a group of components on the schematic");
|
|
269092
269195
|
expectTypesMatch4(true);
|
|
269093
269196
|
var schematic_table3 = z85.object({
|
|
@@ -269766,23 +269869,23 @@ var pcb_net3 = z1032.object({
|
|
|
269766
269869
|
highlight_color: z1032.string().optional()
|
|
269767
269870
|
}).describe("Defines a net on the PCB");
|
|
269768
269871
|
expectTypesMatch4(true);
|
|
269769
|
-
var pcb_via3 =
|
|
269770
|
-
type:
|
|
269872
|
+
var pcb_via3 = z1042.object({
|
|
269873
|
+
type: z1042.literal("pcb_via"),
|
|
269771
269874
|
pcb_via_id: getZodPrefixedIdWithDefault3("pcb_via"),
|
|
269772
|
-
pcb_group_id:
|
|
269773
|
-
subcircuit_id:
|
|
269774
|
-
subcircuit_connectivity_map_key:
|
|
269875
|
+
pcb_group_id: z1042.string().optional(),
|
|
269876
|
+
subcircuit_id: z1042.string().optional(),
|
|
269877
|
+
subcircuit_connectivity_map_key: z1042.string().optional(),
|
|
269775
269878
|
x: distance8,
|
|
269776
269879
|
y: distance8,
|
|
269777
269880
|
outer_diameter: distance8.default("0.6mm"),
|
|
269778
269881
|
hole_diameter: distance8.default("0.25mm"),
|
|
269779
269882
|
from_layer: layer_ref3.optional(),
|
|
269780
269883
|
to_layer: layer_ref3.optional(),
|
|
269781
|
-
layers:
|
|
269782
|
-
pcb_trace_id:
|
|
269783
|
-
net_is_assignable:
|
|
269784
|
-
net_assigned:
|
|
269785
|
-
is_tented:
|
|
269884
|
+
layers: z1042.array(layer_ref3),
|
|
269885
|
+
pcb_trace_id: z1042.string().optional(),
|
|
269886
|
+
net_is_assignable: z1042.boolean().optional(),
|
|
269887
|
+
net_assigned: z1042.boolean().optional(),
|
|
269888
|
+
is_tented: z1042.boolean().optional()
|
|
269786
269889
|
}).describe("Defines a via on the PCB");
|
|
269787
269890
|
expectTypesMatch4(true);
|
|
269788
269891
|
var pcb_board3 = z105.object({
|
|
@@ -277330,17 +277433,317 @@ Fuse2.use = function(...plugins) {
|
|
|
277330
277433
|
plugins.forEach((plugin) => register2(plugin));
|
|
277331
277434
|
};
|
|
277332
277435
|
var entry_default = Fuse2;
|
|
277436
|
+
// node_modules/@tscircuit/ti-parts-engine/lib/kicad-archive/readKicadArchive.ts
|
|
277437
|
+
var import_jszip6 = __toESM2(require_lib4(), 1);
|
|
277438
|
+
// node_modules/@tscircuit/ti-parts-engine/lib/kicad-archive/readFirstKicadLibraryFilesFromArchive.ts
|
|
277439
|
+
var import_jszip7 = __toESM2(require_lib4(), 1);
|
|
277440
|
+
// node_modules/@tscircuit/ti-parts-engine/lib/kicad-archive/readFirstKicadModFromArchive.ts
|
|
277441
|
+
var import_jszip8 = __toESM2(require_lib4(), 1);
|
|
277442
|
+
// node_modules/@tscircuit/ti-parts-engine/lib/ultra-librarian-bridge-client/normalizeBaseUrl.ts
|
|
277443
|
+
function normalizeBaseUrl(baseUrl) {
|
|
277444
|
+
return baseUrl.replace(/\/+$/, "");
|
|
277445
|
+
}
|
|
277446
|
+
|
|
277447
|
+
// node_modules/@tscircuit/ti-parts-engine/lib/ultra-librarian-bridge-client/types.ts
|
|
277448
|
+
var DEFAULT_BASE_URL = "https://ti-api-cors-proxy.seve.workers.dev/";
|
|
277449
|
+
var DEFAULT_KICAD_VERSION = 6;
|
|
277450
|
+
|
|
277451
|
+
// node_modules/@tscircuit/ti-parts-engine/lib/ultra-librarian-bridge-client/paths.ts
|
|
277452
|
+
function buildSearchPath(request) {
|
|
277453
|
+
const query = requireNonEmptyString("query", request.query);
|
|
277454
|
+
const exactOnly = request.exactOnly ?? true;
|
|
277455
|
+
const limit = request.limit ?? 1;
|
|
277456
|
+
assertPositiveInteger("limit", limit);
|
|
277457
|
+
const params2 = new URLSearchParams({
|
|
277458
|
+
q: query,
|
|
277459
|
+
exact_only: String(exactOnly),
|
|
277460
|
+
limit: String(limit)
|
|
277461
|
+
});
|
|
277462
|
+
return `/v1/parts/search?${params2.toString()}`;
|
|
277463
|
+
}
|
|
277464
|
+
function buildKicadExportPath(request) {
|
|
277465
|
+
const mpn = requireNonEmptyString("mpn", request.mpn);
|
|
277466
|
+
const version2 = request.version ?? DEFAULT_KICAD_VERSION;
|
|
277467
|
+
assertPositiveInteger("version", version2);
|
|
277468
|
+
const params2 = new URLSearchParams({
|
|
277469
|
+
mpn,
|
|
277470
|
+
version: String(version2)
|
|
277471
|
+
});
|
|
277472
|
+
return `/v1/export/kicad?${params2.toString()}`;
|
|
277473
|
+
}
|
|
277474
|
+
function requireNonEmptyString(name, value) {
|
|
277475
|
+
const trimmedValue = value.trim();
|
|
277476
|
+
if (trimmedValue.length === 0) {
|
|
277477
|
+
throw new Error(`${name} is required.`);
|
|
277478
|
+
}
|
|
277479
|
+
return trimmedValue;
|
|
277480
|
+
}
|
|
277481
|
+
function assertPositiveInteger(name, value) {
|
|
277482
|
+
if (!Number.isInteger(value) || value < 1) {
|
|
277483
|
+
throw new Error(`${name} must be a positive integer.`);
|
|
277484
|
+
}
|
|
277485
|
+
}
|
|
277486
|
+
|
|
277487
|
+
// node_modules/@tscircuit/ti-parts-engine/lib/ultra-librarian-bridge-client/createDefaultBridgeFetch.ts
|
|
277488
|
+
var createDefaultBridgeFetch = () => {
|
|
277489
|
+
return async (input, init2) => {
|
|
277490
|
+
const targetUrl = input.toString();
|
|
277491
|
+
const proxyEndpointUrl = getTscircuitProxyEndpointUrl(targetUrl);
|
|
277492
|
+
if (!proxyEndpointUrl) {
|
|
277493
|
+
return globalThis.fetch(input, init2);
|
|
277494
|
+
}
|
|
277495
|
+
const headers = new Headers(init2?.headers);
|
|
277496
|
+
headers.set("X-Target-Url", targetUrl);
|
|
277497
|
+
const targetOrigin = safeGetOrigin(targetUrl);
|
|
277498
|
+
if (targetOrigin) {
|
|
277499
|
+
headers.set("X-Sender-Origin", targetOrigin);
|
|
277500
|
+
}
|
|
277501
|
+
return globalThis.fetch(proxyEndpointUrl, {
|
|
277502
|
+
...init2,
|
|
277503
|
+
headers
|
|
277504
|
+
});
|
|
277505
|
+
};
|
|
277506
|
+
};
|
|
277507
|
+
function getTscircuitProxyEndpointUrl(targetUrl) {
|
|
277508
|
+
if (typeof window === "undefined" || !window.location) {
|
|
277509
|
+
return null;
|
|
277510
|
+
}
|
|
277511
|
+
const targetOrigin = safeGetOrigin(targetUrl);
|
|
277512
|
+
const currentOrigin = window.location.origin;
|
|
277513
|
+
if (!targetOrigin || targetOrigin === currentOrigin) {
|
|
277514
|
+
return null;
|
|
277515
|
+
}
|
|
277516
|
+
if (window.TSCIRCUIT_FILESERVER_API_BASE_URL) {
|
|
277517
|
+
return `${window.TSCIRCUIT_FILESERVER_API_BASE_URL.replace(/\/+$/, "")}/proxy`;
|
|
277518
|
+
}
|
|
277519
|
+
if (isLocalHttpOrigin(currentOrigin)) {
|
|
277520
|
+
return `${currentOrigin}/proxy`;
|
|
277521
|
+
}
|
|
277522
|
+
return null;
|
|
277523
|
+
}
|
|
277524
|
+
function safeGetOrigin(url2) {
|
|
277525
|
+
try {
|
|
277526
|
+
return new URL(url2).origin;
|
|
277527
|
+
} catch {
|
|
277528
|
+
return null;
|
|
277529
|
+
}
|
|
277530
|
+
}
|
|
277531
|
+
function isLocalHttpOrigin(origin) {
|
|
277532
|
+
try {
|
|
277533
|
+
const url2 = new URL(origin);
|
|
277534
|
+
return (url2.protocol === "http:" || url2.protocol === "https:") && (url2.hostname === "localhost" || url2.hostname === "127.0.0.1" || url2.hostname === "::1");
|
|
277535
|
+
} catch {
|
|
277536
|
+
return false;
|
|
277537
|
+
}
|
|
277538
|
+
}
|
|
277333
277539
|
|
|
277540
|
+
// node_modules/@tscircuit/ti-parts-engine/lib/ultra-librarian-bridge-client/requestArchive.ts
|
|
277541
|
+
async function requestArchive(options) {
|
|
277542
|
+
const url2 = buildRequestUrl(options.baseUrl, options.path);
|
|
277543
|
+
logRequest(options.logger, url2);
|
|
277544
|
+
const response = await options.fetchImpl(url2, {
|
|
277545
|
+
headers: createBridgeHeaders(options.partnerToken, "application/zip"),
|
|
277546
|
+
redirect: "follow"
|
|
277547
|
+
});
|
|
277548
|
+
if (!response.ok) {
|
|
277549
|
+
throw new Error(`KiCad export failed with ${response.status} ${response.statusText}: ${await readErrorBody(response)}`);
|
|
277550
|
+
}
|
|
277551
|
+
const contentType = response.headers.get("content-type") ?? "unknown";
|
|
277552
|
+
if (!contentType.includes("application/zip") && !contentType.includes("application/octet-stream")) {
|
|
277553
|
+
throw new Error(`Expected application/zip but received ${contentType}.`);
|
|
277554
|
+
}
|
|
277555
|
+
return {
|
|
277556
|
+
archiveBuffer: await response.arrayBuffer(),
|
|
277557
|
+
contentType
|
|
277558
|
+
};
|
|
277559
|
+
}
|
|
277560
|
+
function createBridgeHeaders(partnerToken, accept) {
|
|
277561
|
+
const headers = {
|
|
277562
|
+
Accept: accept
|
|
277563
|
+
};
|
|
277564
|
+
if (partnerToken) {
|
|
277565
|
+
headers.Authorization = `Bearer ${partnerToken}`;
|
|
277566
|
+
}
|
|
277567
|
+
return headers;
|
|
277568
|
+
}
|
|
277569
|
+
function buildRequestUrl(baseUrl, path67) {
|
|
277570
|
+
return `${normalizeBaseUrl(baseUrl)}${path67}`;
|
|
277571
|
+
}
|
|
277572
|
+
function logRequest(logger, url2) {
|
|
277573
|
+
if (!logger)
|
|
277574
|
+
return;
|
|
277575
|
+
const requestUrl = new URL(url2);
|
|
277576
|
+
logger.log(`GET ${requestUrl.pathname}${requestUrl.search}`);
|
|
277577
|
+
}
|
|
277578
|
+
async function readErrorBody(response) {
|
|
277579
|
+
const bodyText = (await response.text()).trim();
|
|
277580
|
+
return bodyText.length > 0 ? bodyText : "<empty response body>";
|
|
277581
|
+
}
|
|
277582
|
+
|
|
277583
|
+
// node_modules/@tscircuit/ti-parts-engine/lib/ultra-librarian-bridge-client/requestJson.ts
|
|
277584
|
+
async function requestJson(options) {
|
|
277585
|
+
const url2 = buildRequestUrl2(options.baseUrl, options.path);
|
|
277586
|
+
logRequest2(options.logger, url2);
|
|
277587
|
+
const response = await options.fetchImpl(url2, {
|
|
277588
|
+
headers: createBridgeHeaders2(options.partnerToken, "application/json")
|
|
277589
|
+
});
|
|
277590
|
+
if (!response.ok) {
|
|
277591
|
+
throw new Error(`Search request failed with ${response.status} ${response.statusText}: ${await readErrorBody2(response)}`);
|
|
277592
|
+
}
|
|
277593
|
+
return asJsonValue(await response.json());
|
|
277594
|
+
}
|
|
277595
|
+
function createBridgeHeaders2(partnerToken, accept) {
|
|
277596
|
+
const headers = {
|
|
277597
|
+
Accept: accept
|
|
277598
|
+
};
|
|
277599
|
+
if (partnerToken) {
|
|
277600
|
+
headers.Authorization = `Bearer ${partnerToken}`;
|
|
277601
|
+
}
|
|
277602
|
+
return headers;
|
|
277603
|
+
}
|
|
277604
|
+
function buildRequestUrl2(baseUrl, path67) {
|
|
277605
|
+
return `${normalizeBaseUrl(baseUrl)}${path67}`;
|
|
277606
|
+
}
|
|
277607
|
+
function logRequest2(logger, url2) {
|
|
277608
|
+
if (!logger)
|
|
277609
|
+
return;
|
|
277610
|
+
const requestUrl = new URL(url2);
|
|
277611
|
+
logger.log(`GET ${requestUrl.pathname}${requestUrl.search}`);
|
|
277612
|
+
}
|
|
277613
|
+
async function readErrorBody2(response) {
|
|
277614
|
+
const bodyText = (await response.text()).trim();
|
|
277615
|
+
return bodyText.length > 0 ? bodyText : "<empty response body>";
|
|
277616
|
+
}
|
|
277617
|
+
function asJsonValue(value) {
|
|
277618
|
+
return value;
|
|
277619
|
+
}
|
|
277620
|
+
|
|
277621
|
+
// node_modules/@tscircuit/ti-parts-engine/lib/ultra-librarian-bridge-client/search-response.ts
|
|
277622
|
+
function extractSearchResults(payload) {
|
|
277623
|
+
if (Array.isArray(payload)) {
|
|
277624
|
+
return payload.filter(isSearchPartResult);
|
|
277625
|
+
}
|
|
277626
|
+
if (!isJsonObject(payload)) {
|
|
277627
|
+
return [];
|
|
277628
|
+
}
|
|
277629
|
+
for (const key of ["results", "items", "parts", "data"]) {
|
|
277630
|
+
const value = payload[key];
|
|
277631
|
+
if (Array.isArray(value)) {
|
|
277632
|
+
return value.filter(isSearchPartResult);
|
|
277633
|
+
}
|
|
277634
|
+
}
|
|
277635
|
+
return [];
|
|
277636
|
+
}
|
|
277637
|
+
function isJsonObject(value) {
|
|
277638
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
277639
|
+
}
|
|
277640
|
+
function isSearchPartResult(value) {
|
|
277641
|
+
return isJsonObject(value);
|
|
277642
|
+
}
|
|
277643
|
+
|
|
277644
|
+
// node_modules/@tscircuit/ti-parts-engine/lib/ultra-librarian-bridge-client/createUltraLibrarianBridgeClient.ts
|
|
277645
|
+
function createUltraLibrarianBridgeClient(options = {}) {
|
|
277646
|
+
const partnerToken = normalizeOptionalString(options.partnerToken);
|
|
277647
|
+
const baseUrl = normalizeBaseUrl(options.baseUrl ?? DEFAULT_BASE_URL);
|
|
277648
|
+
const fetchImpl = options.fetch ?? createDefaultBridgeFetch();
|
|
277649
|
+
const logger = options.logger;
|
|
277650
|
+
return {
|
|
277651
|
+
baseUrl,
|
|
277652
|
+
async searchParts(request) {
|
|
277653
|
+
const path67 = buildSearchPath(request);
|
|
277654
|
+
const rawPayload = await requestJson({
|
|
277655
|
+
fetchImpl,
|
|
277656
|
+
baseUrl,
|
|
277657
|
+
path: path67,
|
|
277658
|
+
partnerToken,
|
|
277659
|
+
logger
|
|
277660
|
+
});
|
|
277661
|
+
return {
|
|
277662
|
+
rawPayload,
|
|
277663
|
+
results: extractSearchResults(rawPayload)
|
|
277664
|
+
};
|
|
277665
|
+
},
|
|
277666
|
+
async downloadKicadArchive(request) {
|
|
277667
|
+
const path67 = buildKicadExportPath(request);
|
|
277668
|
+
return await requestArchive({
|
|
277669
|
+
fetchImpl,
|
|
277670
|
+
baseUrl,
|
|
277671
|
+
path: path67,
|
|
277672
|
+
partnerToken,
|
|
277673
|
+
logger
|
|
277674
|
+
});
|
|
277675
|
+
}
|
|
277676
|
+
};
|
|
277677
|
+
}
|
|
277678
|
+
function normalizeOptionalString(value) {
|
|
277679
|
+
const trimmedValue = value?.trim();
|
|
277680
|
+
return trimmedValue ? trimmedValue : undefined;
|
|
277681
|
+
}
|
|
277682
|
+
// node_modules/@tscircuit/ti-parts-engine/lib/ti-parts-engine/TiPartsEngine.ts
|
|
277683
|
+
class TiPartsEngine {
|
|
277684
|
+
options;
|
|
277685
|
+
constructor(options = {}) {
|
|
277686
|
+
this.options = options;
|
|
277687
|
+
this.searchParts = this.searchParts.bind(this);
|
|
277688
|
+
this.downloadKicadArchive = this.downloadKicadArchive.bind(this);
|
|
277689
|
+
this.findPart = this.findPart.bind(this);
|
|
277690
|
+
}
|
|
277691
|
+
async findPart({ sourceComponent }) {
|
|
277692
|
+
const manufacturerPartNumber = getManufacturerPartNumber(sourceComponent);
|
|
277693
|
+
if (!manufacturerPartNumber) {
|
|
277694
|
+
return {};
|
|
277695
|
+
}
|
|
277696
|
+
const searchResponse = await this.searchParts({
|
|
277697
|
+
query: manufacturerPartNumber,
|
|
277698
|
+
exactOnly: true,
|
|
277699
|
+
limit: 1
|
|
277700
|
+
});
|
|
277701
|
+
const matchingPart = searchResponse.results[0];
|
|
277702
|
+
if (!matchingPart) {
|
|
277703
|
+
return {};
|
|
277704
|
+
}
|
|
277705
|
+
const resolvedPartNumber = matchingPart?.mpn ?? matchingPart?.manufacturer_part_number ?? matchingPart?.part_number ?? matchingPart?.gpn ?? manufacturerPartNumber;
|
|
277706
|
+
return {
|
|
277707
|
+
ti: [resolvedPartNumber]
|
|
277708
|
+
};
|
|
277709
|
+
}
|
|
277710
|
+
async searchParts(request) {
|
|
277711
|
+
return await this.createClient().searchParts(request);
|
|
277712
|
+
}
|
|
277713
|
+
async downloadKicadArchive(request) {
|
|
277714
|
+
return await this.createClient().downloadKicadArchive(request);
|
|
277715
|
+
}
|
|
277716
|
+
createClient() {
|
|
277717
|
+
return createUltraLibrarianBridgeClient(this.options);
|
|
277718
|
+
}
|
|
277719
|
+
}
|
|
277720
|
+
function getManufacturerPartNumber(sourceComponent) {
|
|
277721
|
+
if (!isRecord2(sourceComponent)) {
|
|
277722
|
+
return null;
|
|
277723
|
+
}
|
|
277724
|
+
const value = sourceComponent.manufacturer_part_number;
|
|
277725
|
+
return typeof value === "string" && value.trim() ? value : null;
|
|
277726
|
+
}
|
|
277727
|
+
function isRecord2(value) {
|
|
277728
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
277729
|
+
}
|
|
277730
|
+
// node_modules/@tscircuit/ti-parts-engine/lib/ti-parts-engine/createTiFootprintLibrary.ts
|
|
277731
|
+
import {
|
|
277732
|
+
KicadFootprintToCircuitJsonConverter,
|
|
277733
|
+
KicadSymbolToCircuitJsonConverter
|
|
277734
|
+
} from "kicad-to-circuit-json";
|
|
277334
277735
|
// cli/search/register.ts
|
|
277335
277736
|
var registerSearch = (program3) => {
|
|
277336
|
-
program3.command("search").description("Search for footprints, CAD models or packages in the tscircuit ecosystem").argument("<query...>", "Search query (e.g. keyword, author, or package name)").option("--kicad", "Search KiCad footprints").option("--jlcpcb", "Search JLCPCB components").option("--lcsc", "Alias for --jlcpcb").option("--tscircuit", "Search tscircuit registry packages").option("--json", "Output search results as JSON").action(async (queryParts, opts) => {
|
|
277737
|
+
program3.command("search").description("Search for footprints, CAD models or packages in the tscircuit ecosystem").argument("<query...>", "Search query (e.g. keyword, author, or package name)").option("--kicad", "Search KiCad footprints").option("--jlcpcb", "Search JLCPCB components").option("--lcsc", "Alias for --jlcpcb").option("--ti", "Search Texas Instruments components").option("--tscircuit", "Search tscircuit registry packages").option("--json", "Output search results as JSON").action(async (queryParts, opts) => {
|
|
277337
277738
|
const query = getQueryFromParts(queryParts);
|
|
277338
|
-
const hasFilters = opts.kicad || opts.jlcpcb || opts.lcsc || opts.tscircuit;
|
|
277739
|
+
const hasFilters = opts.kicad || opts.jlcpcb || opts.lcsc || opts.ti || opts.tscircuit;
|
|
277339
277740
|
const searchKicad = opts.kicad;
|
|
277340
277741
|
const searchJlc = opts.jlcpcb || opts.lcsc || !hasFilters;
|
|
277742
|
+
const searchTi = opts.ti;
|
|
277341
277743
|
const searchTscircuit = opts.tscircuit;
|
|
277342
277744
|
let results = { packages: [] };
|
|
277343
277745
|
let jlcResults = [];
|
|
277746
|
+
let tiResults = [];
|
|
277344
277747
|
let kicadResults = [];
|
|
277345
277748
|
try {
|
|
277346
277749
|
if (searchTscircuit) {
|
|
@@ -277354,6 +277757,17 @@ var registerSearch = (program3) => {
|
|
|
277354
277757
|
const jlcResponse = await fetch(jlcSearchUrl).then((r4) => r4.json());
|
|
277355
277758
|
jlcResults = jlcResponse?.components ?? [];
|
|
277356
277759
|
}
|
|
277760
|
+
if (searchTi) {
|
|
277761
|
+
const tiPartsEngine = new TiPartsEngine({
|
|
277762
|
+
baseUrl: process.env.TSCIRCUIT_TI_API_BASE_URL
|
|
277763
|
+
});
|
|
277764
|
+
const tiResponse = await tiPartsEngine.searchParts({
|
|
277765
|
+
query,
|
|
277766
|
+
exactOnly: false,
|
|
277767
|
+
limit: 10
|
|
277768
|
+
});
|
|
277769
|
+
tiResults = tiResponse.results;
|
|
277770
|
+
}
|
|
277357
277771
|
if (searchKicad) {
|
|
277358
277772
|
const kicadFiles = await fetch("https://kicad-mod-cache.tscircuit.com/kicad_files.json").then((r4) => r4.json());
|
|
277359
277773
|
const fuse = new entry_default(kicadFiles);
|
|
@@ -277376,6 +277790,10 @@ var registerSearch = (program3) => {
|
|
|
277376
277790
|
...jlcResults.map((comp) => ({
|
|
277377
277791
|
source: "jlcpcb",
|
|
277378
277792
|
...comp
|
|
277793
|
+
})),
|
|
277794
|
+
...tiResults.map((part) => ({
|
|
277795
|
+
source: "ti",
|
|
277796
|
+
...part
|
|
277379
277797
|
}))
|
|
277380
277798
|
];
|
|
277381
277799
|
console.log(JSON.stringify({
|
|
@@ -277384,10 +277802,11 @@ var registerSearch = (program3) => {
|
|
|
277384
277802
|
}, null, 2));
|
|
277385
277803
|
return;
|
|
277386
277804
|
}
|
|
277387
|
-
if (!kicadResults.length && !results.packages.length && !jlcResults.length) {
|
|
277805
|
+
if (!kicadResults.length && !results.packages.length && !jlcResults.length && !tiResults.length) {
|
|
277388
277806
|
const sources = [
|
|
277389
277807
|
searchTscircuit && "tscircuit registry",
|
|
277390
277808
|
searchJlc && "JLCPCB",
|
|
277809
|
+
searchTi && "Texas Instruments",
|
|
277391
277810
|
searchKicad && "KiCad"
|
|
277392
277811
|
].filter(Boolean);
|
|
277393
277812
|
console.log(kleur_default.yellow(`No results found for "${query}" in ${sources.join(", ")}.`));
|
|
@@ -277414,6 +277833,19 @@ var registerSearch = (program3) => {
|
|
|
277414
277833
|
console.log(`${idx + 1}. ${comp.mfr} (C${comp.lcsc}) - ${comp.description} (stock: ${comp.stock.toLocaleString("en-US")})`);
|
|
277415
277834
|
});
|
|
277416
277835
|
}
|
|
277836
|
+
if (tiResults.length) {
|
|
277837
|
+
console.log(kleur_default.bold().underline(`Found ${tiResults.length} component(s) from Texas Instruments:`));
|
|
277838
|
+
tiResults.forEach((part, idx) => {
|
|
277839
|
+
const mpn = part.mpn ?? part.manufacturer_part_number ?? part.name ?? "?";
|
|
277840
|
+
const assets = [
|
|
277841
|
+
part.symbol_available === true && "symbol",
|
|
277842
|
+
part.footprint_available === true && "footprint",
|
|
277843
|
+
part.threed_available === true && "3D model"
|
|
277844
|
+
].filter(Boolean);
|
|
277845
|
+
const assetStr = assets.length ? ` - ${assets.join(", ")} available` : "";
|
|
277846
|
+
console.log(`${idx + 1}. ${mpn}${assetStr}`);
|
|
277847
|
+
});
|
|
277848
|
+
}
|
|
277417
277849
|
console.log(`
|
|
277418
277850
|
`);
|
|
277419
277851
|
});
|