@tscircuit/cli 0.1.1566 → 0.1.1567
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 +247 -679
- package/dist/lib/index.js +234 -337
- package/package.json +1 -3
package/dist/cli/main.js
CHANGED
|
@@ -93628,7 +93628,7 @@ var import_perfect_cli = __toESM2(require_dist2(), 1);
|
|
|
93628
93628
|
// lib/getVersion.ts
|
|
93629
93629
|
import { createRequire as createRequire2 } from "node:module";
|
|
93630
93630
|
// package.json
|
|
93631
|
-
var version = "0.1.
|
|
93631
|
+
var version = "0.1.1566";
|
|
93632
93632
|
var package_default = {
|
|
93633
93633
|
name: "@tscircuit/cli",
|
|
93634
93634
|
version,
|
|
@@ -93645,7 +93645,6 @@ var package_default = {
|
|
|
93645
93645
|
"@tscircuit/circuit-json-schematic-placement-analysis": "github:tscircuit/circuit-json-schematic-placement-analysis#b6d5fe675adc26a2fc988aa081e6fb51e6bf696a",
|
|
93646
93646
|
"@tscircuit/eval": "^0.0.954",
|
|
93647
93647
|
"@tscircuit/fake-snippets": "^0.0.182",
|
|
93648
|
-
"@tscircuit/fake-ul-kicad-proxy": "github:tscircuit/fake-ul-kicad-proxy#d174c33c1b17a52d7a9dc3c2b5506d6fd593bed7",
|
|
93649
93648
|
"@tscircuit/file-server": "^0.0.32",
|
|
93650
93649
|
"@tscircuit/image-utils": "^0.0.8",
|
|
93651
93650
|
"@tscircuit/krt-wasm": "^0.1.6",
|
|
@@ -93653,7 +93652,6 @@ var package_default = {
|
|
|
93653
93652
|
"@tscircuit/props": "^0.0.555",
|
|
93654
93653
|
"@tscircuit/runframe": "^0.0.2126",
|
|
93655
93654
|
"@tscircuit/schematic-match-adapt": "^0.0.22",
|
|
93656
|
-
"@tscircuit/ti-parts-engine": "github:tscircuit/ti-parts-engine#cead194495b8fbfb73a88b5995ce86a4b61a9d04",
|
|
93657
93655
|
"@tscircuit/solver-utils": "0.0.16",
|
|
93658
93656
|
"@types/bun": "^1.2.2",
|
|
93659
93657
|
"@types/configstore": "^6.0.2",
|
|
@@ -261356,6 +261354,9 @@ class WinterSpecMultiPartFormDataResponse extends WinterSpecResponse {
|
|
|
261356
261354
|
return new Response(formData, this.options);
|
|
261357
261355
|
}
|
|
261358
261356
|
}
|
|
261357
|
+
function createWinterSpecRequest(request, options) {
|
|
261358
|
+
return Object.assign(request, options);
|
|
261359
|
+
}
|
|
261359
261360
|
function mergeHeaders2(h12, h23) {
|
|
261360
261361
|
return new Headers(Object.fromEntries([
|
|
261361
261362
|
...h12 instanceof Headers ? h12 : new Headers(h12 ?? undefined).entries() ?? [],
|
|
@@ -261369,6 +261370,7 @@ var DEFAULT_CONTEXT = {
|
|
|
261369
261370
|
multipartFormData: WinterSpecResponse.multipartFormData,
|
|
261370
261371
|
custom: WinterSpecResponse.custom
|
|
261371
261372
|
};
|
|
261373
|
+
var getDefaultContext = () => ({ ...DEFAULT_CONTEXT });
|
|
261372
261374
|
|
|
261373
261375
|
// node_modules/winterspec/dist/serve/create-node-server-from-route-map.js
|
|
261374
261376
|
var import_next_route_matcher = __toESM2(require_dist8(), 1);
|
|
@@ -261376,119 +261378,7 @@ var import_next_route_matcher = __toESM2(require_dist8(), 1);
|
|
|
261376
261378
|
// node_modules/winterspec/dist/create-with-winter-spec.js
|
|
261377
261379
|
import { z as z5 } from "zod";
|
|
261378
261380
|
|
|
261379
|
-
// node_modules/winterspec/dist/
|
|
261380
|
-
import { z as z4, ZodError as ZodError2, ZodFirstPartyTypeKind as ZodFirstPartyTypeKind2 } from "zod";
|
|
261381
|
-
|
|
261382
|
-
// node_modules/winterspec/dist/serve/create-winter-spec-from-route-map.js
|
|
261383
|
-
var import_next_route_matcher2 = __toESM2(require_dist8(), 1);
|
|
261384
|
-
|
|
261385
|
-
// node_modules/winterspec/dist/adapters/node.js
|
|
261386
|
-
var EdgePrimitives = __toESM2(require_dist6(), 1);
|
|
261387
|
-
var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
|
|
261388
|
-
const transformToNode = transformToNodeBuilder({
|
|
261389
|
-
defaultOrigin: `http://localhost${port ? `:${port}` : ""}`
|
|
261390
|
-
});
|
|
261391
|
-
return transformToNode((req) => winterSpec.makeRequest(req, {
|
|
261392
|
-
middleware
|
|
261393
|
-
}));
|
|
261394
|
-
};
|
|
261395
|
-
|
|
261396
|
-
// node_modules/@tscircuit/file-server/dist/bundle.js
|
|
261397
|
-
var import_next_route_matcher4 = __toESM2(require_dist8(), 1);
|
|
261398
|
-
|
|
261399
|
-
// node_modules/@tscircuit/file-server/node_modules/winterspec/dist/types/web-handler.js
|
|
261400
|
-
class WinterSpecResponse2 {
|
|
261401
|
-
statusCode() {
|
|
261402
|
-
return this.options.status ?? 200;
|
|
261403
|
-
}
|
|
261404
|
-
status(status) {
|
|
261405
|
-
this.options.status = status;
|
|
261406
|
-
return this;
|
|
261407
|
-
}
|
|
261408
|
-
header(key, value) {
|
|
261409
|
-
this.options.headers = mergeHeaders3(this.options.headers, {
|
|
261410
|
-
[key]: value
|
|
261411
|
-
});
|
|
261412
|
-
return this;
|
|
261413
|
-
}
|
|
261414
|
-
headers(headers) {
|
|
261415
|
-
this.options.headers = mergeHeaders3(this.options.headers, headers);
|
|
261416
|
-
return this;
|
|
261417
|
-
}
|
|
261418
|
-
statusText(statusText) {
|
|
261419
|
-
this.options.statusText = statusText;
|
|
261420
|
-
return this;
|
|
261421
|
-
}
|
|
261422
|
-
constructor(options = {}) {
|
|
261423
|
-
this.options = options;
|
|
261424
|
-
}
|
|
261425
|
-
static json(...args) {
|
|
261426
|
-
return new WinterSpecJsonResponse2(...args);
|
|
261427
|
-
}
|
|
261428
|
-
static multipartFormData(...args) {
|
|
261429
|
-
return new WinterSpecMultiPartFormDataResponse2(...args);
|
|
261430
|
-
}
|
|
261431
|
-
static custom(...args) {
|
|
261432
|
-
return new WinterSpecCustomResponse2(...args);
|
|
261433
|
-
}
|
|
261434
|
-
}
|
|
261435
|
-
|
|
261436
|
-
class WinterSpecJsonResponse2 extends WinterSpecResponse2 {
|
|
261437
|
-
constructor(data, options = {}) {
|
|
261438
|
-
super(options);
|
|
261439
|
-
this.data = data;
|
|
261440
|
-
this.options.headers = mergeHeaders3(this.options.headers, {
|
|
261441
|
-
"Content-Type": "application/json"
|
|
261442
|
-
});
|
|
261443
|
-
}
|
|
261444
|
-
serializeToResponse(schema) {
|
|
261445
|
-
return new Response(JSON.stringify(schema.parse(this.data)), this.options);
|
|
261446
|
-
}
|
|
261447
|
-
}
|
|
261448
|
-
|
|
261449
|
-
class WinterSpecCustomResponse2 extends WinterSpecResponse2 {
|
|
261450
|
-
constructor(data, contentType, options = {}) {
|
|
261451
|
-
super(options);
|
|
261452
|
-
this.data = data;
|
|
261453
|
-
this.contentType = contentType;
|
|
261454
|
-
this.options.headers = mergeHeaders3(this.options.headers, {
|
|
261455
|
-
"Content-Type": contentType
|
|
261456
|
-
});
|
|
261457
|
-
}
|
|
261458
|
-
serializeToResponse(schema) {
|
|
261459
|
-
return new Response(schema.parse(this.data), this.options);
|
|
261460
|
-
}
|
|
261461
|
-
}
|
|
261462
|
-
class WinterSpecMultiPartFormDataResponse2 extends WinterSpecResponse2 {
|
|
261463
|
-
constructor(data, options = {}) {
|
|
261464
|
-
super(options);
|
|
261465
|
-
this.data = data;
|
|
261466
|
-
this.options.headers = mergeHeaders3(this.options.headers, {
|
|
261467
|
-
"Content-Type": "multipart/form-data"
|
|
261468
|
-
});
|
|
261469
|
-
}
|
|
261470
|
-
serializeToResponse(schema) {
|
|
261471
|
-
const formData = new FormData;
|
|
261472
|
-
for (const [key, value] of Object.entries(schema.parse(this.data))) {
|
|
261473
|
-
formData.append(key, value instanceof Blob ? value : String(value));
|
|
261474
|
-
}
|
|
261475
|
-
return new Response(formData, this.options);
|
|
261476
|
-
}
|
|
261477
|
-
}
|
|
261478
|
-
function createWinterSpecRequest2(request, options) {
|
|
261479
|
-
return Object.assign(request, options);
|
|
261480
|
-
}
|
|
261481
|
-
function mergeHeaders3(h12, h23) {
|
|
261482
|
-
return new Headers(Object.fromEntries([
|
|
261483
|
-
...h12 instanceof Headers ? h12 : new Headers(h12 ?? undefined).entries() ?? [],
|
|
261484
|
-
...h23 instanceof Headers ? h23 : new Headers(h23 ?? undefined).entries() ?? []
|
|
261485
|
-
]));
|
|
261486
|
-
}
|
|
261487
|
-
|
|
261488
|
-
// node_modules/@tscircuit/file-server/node_modules/winterspec/dist/create-with-winter-spec.js
|
|
261489
|
-
import { z as z7 } from "zod";
|
|
261490
|
-
|
|
261491
|
-
// node_modules/@tscircuit/file-server/node_modules/winterspec/dist/lib/format-zod-error.js
|
|
261381
|
+
// node_modules/winterspec/dist/lib/format-zod-error.js
|
|
261492
261382
|
var zodIssueToString = (issue) => {
|
|
261493
261383
|
if (issue.path.join(".") === "") {
|
|
261494
261384
|
return issue.message;
|
|
@@ -261498,7 +261388,7 @@ var zodIssueToString = (issue) => {
|
|
|
261498
261388
|
}
|
|
261499
261389
|
return `${issue.message} for "${issue.path.join(".")}"`;
|
|
261500
261390
|
};
|
|
261501
|
-
var
|
|
261391
|
+
var formatZodError = (error2) => {
|
|
261502
261392
|
let message;
|
|
261503
261393
|
if (error2.issues.length === 1) {
|
|
261504
261394
|
const issue = error2.issues[0];
|
|
@@ -261514,7 +261404,7 @@ var formatZodError2 = (error2) => {
|
|
|
261514
261404
|
return message;
|
|
261515
261405
|
};
|
|
261516
261406
|
|
|
261517
|
-
// node_modules
|
|
261407
|
+
// node_modules/winterspec/dist/middleware/http-exceptions.js
|
|
261518
261408
|
class WinterSpecMiddlewareError extends Error {
|
|
261519
261409
|
constructor(message, status = 500) {
|
|
261520
261410
|
super(message);
|
|
@@ -261525,79 +261415,79 @@ class WinterSpecMiddlewareError extends Error {
|
|
|
261525
261415
|
}
|
|
261526
261416
|
}
|
|
261527
261417
|
|
|
261528
|
-
class
|
|
261418
|
+
class MethodNotAllowedError extends WinterSpecMiddlewareError {
|
|
261529
261419
|
constructor(allowedMethods) {
|
|
261530
261420
|
super(`only ${allowedMethods.join(",")} accepted`, 405);
|
|
261531
261421
|
}
|
|
261532
261422
|
}
|
|
261533
|
-
class
|
|
261423
|
+
class BadRequestError extends WinterSpecMiddlewareError {
|
|
261534
261424
|
constructor(message) {
|
|
261535
261425
|
super(message, 400);
|
|
261536
261426
|
}
|
|
261537
261427
|
}
|
|
261538
261428
|
|
|
261539
|
-
class
|
|
261429
|
+
class InvalidQueryParamsError extends BadRequestError {
|
|
261540
261430
|
constructor(message) {
|
|
261541
261431
|
super(message);
|
|
261542
261432
|
}
|
|
261543
261433
|
}
|
|
261544
261434
|
|
|
261545
|
-
class
|
|
261435
|
+
class InvalidContentTypeError extends BadRequestError {
|
|
261546
261436
|
constructor(message) {
|
|
261547
261437
|
super(message);
|
|
261548
261438
|
}
|
|
261549
261439
|
}
|
|
261550
261440
|
|
|
261551
|
-
class
|
|
261441
|
+
class InputParsingError extends BadRequestError {
|
|
261552
261442
|
constructor(message) {
|
|
261553
261443
|
super(message);
|
|
261554
261444
|
}
|
|
261555
261445
|
}
|
|
261556
261446
|
|
|
261557
|
-
class
|
|
261447
|
+
class InputValidationError extends BadRequestError {
|
|
261558
261448
|
constructor(error2) {
|
|
261559
|
-
super(
|
|
261449
|
+
super(formatZodError(error2));
|
|
261560
261450
|
}
|
|
261561
261451
|
}
|
|
261562
261452
|
|
|
261563
|
-
class
|
|
261453
|
+
class ResponseValidationError extends WinterSpecMiddlewareError {
|
|
261564
261454
|
constructor(error2) {
|
|
261565
|
-
super(
|
|
261455
|
+
super(formatZodError(error2), 500);
|
|
261566
261456
|
}
|
|
261567
261457
|
}
|
|
261568
261458
|
|
|
261569
|
-
// node_modules
|
|
261570
|
-
var
|
|
261459
|
+
// node_modules/winterspec/dist/middleware/with-methods.js
|
|
261460
|
+
var withMethods = (methods) => (req, ctx, next) => {
|
|
261571
261461
|
if (!methods.includes(req.method)) {
|
|
261572
|
-
throw new
|
|
261462
|
+
throw new MethodNotAllowedError(methods);
|
|
261573
261463
|
}
|
|
261574
261464
|
return next(req, ctx);
|
|
261575
261465
|
};
|
|
261576
261466
|
|
|
261577
|
-
// node_modules
|
|
261578
|
-
import { z as
|
|
261467
|
+
// node_modules/winterspec/dist/middleware/with-input-validation.js
|
|
261468
|
+
import { z as z4, ZodError as ZodError2, ZodFirstPartyTypeKind as ZodFirstPartyTypeKind2 } from "zod";
|
|
261579
261469
|
var getZodObjectSchemaFromZodEffectSchema = (isZodEffect, schema) => {
|
|
261580
261470
|
if (!isZodEffect) {
|
|
261581
261471
|
return schema;
|
|
261582
261472
|
}
|
|
261583
261473
|
let currentSchema = schema;
|
|
261584
|
-
while (currentSchema instanceof
|
|
261474
|
+
while (currentSchema instanceof z4.ZodEffects) {
|
|
261585
261475
|
currentSchema = currentSchema._def.schema;
|
|
261586
261476
|
}
|
|
261587
261477
|
return currentSchema;
|
|
261588
261478
|
};
|
|
261589
261479
|
var getZodDefFromZodSchemaHelpers = (schema) => {
|
|
261590
261480
|
const special_zod_types = [
|
|
261591
|
-
|
|
261592
|
-
|
|
261593
|
-
|
|
261481
|
+
ZodFirstPartyTypeKind2.ZodOptional,
|
|
261482
|
+
ZodFirstPartyTypeKind2.ZodDefault,
|
|
261483
|
+
ZodFirstPartyTypeKind2.ZodEffects
|
|
261594
261484
|
];
|
|
261595
261485
|
while (special_zod_types.includes(schema._def.typeName)) {
|
|
261596
|
-
if (schema._def.typeName ===
|
|
261486
|
+
if (schema._def.typeName === ZodFirstPartyTypeKind2.ZodOptional || schema._def.typeName === ZodFirstPartyTypeKind2.ZodDefault) {
|
|
261597
261487
|
schema = schema._def.innerType;
|
|
261598
261488
|
continue;
|
|
261599
261489
|
}
|
|
261600
|
-
if (schema._def.typeName ===
|
|
261490
|
+
if (schema._def.typeName === ZodFirstPartyTypeKind2.ZodEffects) {
|
|
261601
261491
|
schema = schema._def.schema;
|
|
261602
261492
|
continue;
|
|
261603
261493
|
}
|
|
@@ -261605,9 +261495,9 @@ var getZodDefFromZodSchemaHelpers = (schema) => {
|
|
|
261605
261495
|
return schema._def;
|
|
261606
261496
|
};
|
|
261607
261497
|
var tryGetZodSchemaAsObject = (schema) => {
|
|
261608
|
-
const isZodEffect = schema._def.typeName ===
|
|
261498
|
+
const isZodEffect = schema._def.typeName === ZodFirstPartyTypeKind2.ZodEffects;
|
|
261609
261499
|
const safe_schema = getZodObjectSchemaFromZodEffectSchema(isZodEffect, schema);
|
|
261610
|
-
const isZodObject = safe_schema._def.typeName ===
|
|
261500
|
+
const isZodObject = safe_schema._def.typeName === ZodFirstPartyTypeKind2.ZodObject;
|
|
261611
261501
|
if (!isZodObject) {
|
|
261612
261502
|
return;
|
|
261613
261503
|
}
|
|
@@ -261615,11 +261505,11 @@ var tryGetZodSchemaAsObject = (schema) => {
|
|
|
261615
261505
|
};
|
|
261616
261506
|
var isZodSchemaArray = (schema) => {
|
|
261617
261507
|
const def = getZodDefFromZodSchemaHelpers(schema);
|
|
261618
|
-
return def.typeName ===
|
|
261508
|
+
return def.typeName === ZodFirstPartyTypeKind2.ZodArray;
|
|
261619
261509
|
};
|
|
261620
261510
|
var isZodSchemaBoolean = (schema) => {
|
|
261621
261511
|
const def = getZodDefFromZodSchemaHelpers(schema);
|
|
261622
|
-
return def.typeName ===
|
|
261512
|
+
return def.typeName === ZodFirstPartyTypeKind2.ZodBoolean;
|
|
261623
261513
|
};
|
|
261624
261514
|
var parseQueryParams = (schema, input, supportedArrayFormats) => {
|
|
261625
261515
|
const parsed_input = Object.assign({}, input);
|
|
@@ -261662,7 +261552,7 @@ var validateQueryParams = (inputUrl, schema, supportedArrayFormats) => {
|
|
|
261662
261552
|
for (const [schemaKey, value] of Object.entries(obj_schema.shape)) {
|
|
261663
261553
|
if (isZodSchemaArray(value)) {
|
|
261664
261554
|
if (key === `${schemaKey}[]` && !supportedArrayFormats.includes("brackets")) {
|
|
261665
|
-
throw new
|
|
261555
|
+
throw new InvalidQueryParamsError(`Bracket syntax not supported for query param "${schemaKey}"`);
|
|
261666
261556
|
}
|
|
261667
261557
|
}
|
|
261668
261558
|
}
|
|
@@ -261670,26 +261560,26 @@ var validateQueryParams = (inputUrl, schema, supportedArrayFormats) => {
|
|
|
261670
261560
|
if (key_schema) {
|
|
261671
261561
|
if (isZodSchemaArray(key_schema)) {
|
|
261672
261562
|
if (seenKeys.has(key) && !supportedArrayFormats.includes("repeat")) {
|
|
261673
|
-
throw new
|
|
261563
|
+
throw new InvalidQueryParamsError(`Repeated parameters not supported for duplicate query param "${key}"`);
|
|
261674
261564
|
}
|
|
261675
261565
|
}
|
|
261676
261566
|
}
|
|
261677
261567
|
seenKeys.add(key);
|
|
261678
261568
|
}
|
|
261679
261569
|
};
|
|
261680
|
-
var
|
|
261570
|
+
var withInputValidation = (input) => async (req, ctx, next) => {
|
|
261681
261571
|
const { supportedArrayFormats } = input;
|
|
261682
261572
|
if (input.formData && input.jsonBody || input.formData && input.commonParams) {
|
|
261683
261573
|
throw new Error("Cannot use formData with jsonBody or commonParams");
|
|
261684
261574
|
}
|
|
261685
261575
|
if ((req.method === "POST" || req.method === "PATCH") && (input.jsonBody || input.commonParams) && !req.headers.get("content-type")?.includes("application/json")) {
|
|
261686
|
-
throw new
|
|
261576
|
+
throw new InvalidContentTypeError(`${req.method} requests must have Content-Type header with "application/json"`);
|
|
261687
261577
|
}
|
|
261688
261578
|
if (input.urlEncodedFormData && req.method !== "GET" && !req.headers.get("content-type")?.includes("application/x-www-form-urlencoded")) {
|
|
261689
|
-
throw new
|
|
261579
|
+
throw new InvalidContentTypeError(`Must have Content-Type header with "application/x-www-form-urlencoded"`);
|
|
261690
261580
|
}
|
|
261691
261581
|
if (input.formData && (req.method === "POST" || req.method === "PATCH") && !req.headers.get("content-type")?.includes("multipart/form-data")) {
|
|
261692
|
-
throw new
|
|
261582
|
+
throw new InvalidContentTypeError(`${req.method} requests must have Content-Type header with "multipart/form-data"`);
|
|
261693
261583
|
}
|
|
261694
261584
|
const originalParams = Object.fromEntries(new URL(req.url).searchParams.entries());
|
|
261695
261585
|
let jsonBody;
|
|
@@ -261698,7 +261588,7 @@ var withInputValidation2 = (input) => async (req, ctx, next) => {
|
|
|
261698
261588
|
jsonBody = await req.clone().json();
|
|
261699
261589
|
} catch (e4) {
|
|
261700
261590
|
if (!input.jsonBody?.isOptional()) {
|
|
261701
|
-
throw new
|
|
261591
|
+
throw new InputParsingError("Error while parsing JSON body");
|
|
261702
261592
|
}
|
|
261703
261593
|
}
|
|
261704
261594
|
}
|
|
@@ -261709,7 +261599,7 @@ var withInputValidation2 = (input) => async (req, ctx, next) => {
|
|
|
261709
261599
|
multiPartFormData = Object.fromEntries(multiPartFormData.entries());
|
|
261710
261600
|
} catch (e4) {
|
|
261711
261601
|
if (!input.formData?.isOptional()) {
|
|
261712
|
-
throw new
|
|
261602
|
+
throw new InputParsingError("Error while parsing form data");
|
|
261713
261603
|
}
|
|
261714
261604
|
}
|
|
261715
261605
|
}
|
|
@@ -261720,7 +261610,7 @@ var withInputValidation2 = (input) => async (req, ctx, next) => {
|
|
|
261720
261610
|
urlEncodedFormData = Object.fromEntries(params2.entries());
|
|
261721
261611
|
} catch (e4) {
|
|
261722
261612
|
if (!input.urlEncodedFormData?.isOptional()) {
|
|
261723
|
-
throw new
|
|
261613
|
+
throw new InputParsingError("Error while parsing url encoded form data");
|
|
261724
261614
|
}
|
|
261725
261615
|
}
|
|
261726
261616
|
}
|
|
@@ -261753,19 +261643,19 @@ var withInputValidation2 = (input) => async (req, ctx, next) => {
|
|
|
261753
261643
|
req.commonParams = parseQueryParams(input.commonParams, originalCombinedParams, supportedArrayFormats);
|
|
261754
261644
|
}
|
|
261755
261645
|
} catch (error2) {
|
|
261756
|
-
if (error2 instanceof
|
|
261646
|
+
if (error2 instanceof BadRequestError) {
|
|
261757
261647
|
throw error2;
|
|
261758
261648
|
}
|
|
261759
|
-
if (error2 instanceof
|
|
261760
|
-
throw new
|
|
261649
|
+
if (error2 instanceof ZodError2) {
|
|
261650
|
+
throw new InputValidationError(error2);
|
|
261761
261651
|
}
|
|
261762
|
-
throw new
|
|
261652
|
+
throw new InputParsingError("Error while parsing input");
|
|
261763
261653
|
}
|
|
261764
261654
|
return next(req, ctx);
|
|
261765
261655
|
};
|
|
261766
261656
|
|
|
261767
|
-
// node_modules
|
|
261768
|
-
var
|
|
261657
|
+
// node_modules/winterspec/dist/middleware/with-unhandled-exception-handling.js
|
|
261658
|
+
var withUnhandledExceptionHandling = async (req, ctx, next) => {
|
|
261769
261659
|
try {
|
|
261770
261660
|
return await next(req, ctx);
|
|
261771
261661
|
} catch (e4) {
|
|
@@ -261782,7 +261672,7 @@ var withUnhandledExceptionHandling2 = async (req, ctx, next) => {
|
|
|
261782
261672
|
}
|
|
261783
261673
|
};
|
|
261784
261674
|
|
|
261785
|
-
// node_modules
|
|
261675
|
+
// node_modules/winterspec/dist/create-with-winter-spec.js
|
|
261786
261676
|
var attachMetadataToRouteFn = ({ globalSpec, routeSpec }, routeFn) => {
|
|
261787
261677
|
routeFn._globalSpec = globalSpec;
|
|
261788
261678
|
routeFn._routeSpec = routeSpec;
|
|
@@ -261796,16 +261686,16 @@ var createWithWinterSpec = (globalSpec) => {
|
|
|
261796
261686
|
const onMultipleAuthMiddlewareFailures = globalSpec.onMultipleAuthMiddlewareFailures ?? routeSpec.onMultipleAuthMiddlewareFailures;
|
|
261797
261687
|
const supportedAuthMiddlewares = new Set(routeSpec.auth == null || routeSpec.auth === "none" ? [] : Array.isArray(routeSpec.auth) ? routeSpec.auth : [routeSpec.auth]);
|
|
261798
261688
|
const authMiddlewares = Object.entries(globalSpec.authMiddleware).filter(([k4, _4]) => supportedAuthMiddlewares.has(k4)).map(([_4, v4]) => v4);
|
|
261799
|
-
return await
|
|
261689
|
+
return await wrapMiddlewares([
|
|
261800
261690
|
...typeof _injectedWinterSpecMiddleware !== "undefined" ? _injectedWinterSpecMiddleware : [],
|
|
261801
|
-
|
|
261691
|
+
withUnhandledExceptionHandling,
|
|
261802
261692
|
serializeResponse(globalSpec, routeSpec, false),
|
|
261803
261693
|
...globalSpec.beforeAuthMiddleware ?? [],
|
|
261804
261694
|
firstAuthMiddlewareThatSucceeds(authMiddlewares, onMultipleAuthMiddlewareFailures),
|
|
261805
261695
|
...globalSpec.afterAuthMiddleware ?? [],
|
|
261806
261696
|
...routeSpec.middleware ?? [],
|
|
261807
|
-
|
|
261808
|
-
|
|
261697
|
+
withMethods(routeSpec.methods),
|
|
261698
|
+
withInputValidation({
|
|
261809
261699
|
supportedArrayFormats: globalSpec.supportedArrayFormats ?? [
|
|
261810
261700
|
"brackets",
|
|
261811
261701
|
"comma",
|
|
@@ -261825,17 +261715,17 @@ var createWithWinterSpec = (globalSpec) => {
|
|
|
261825
261715
|
function serializeResponse(globalSpec, routeSpec, skipValidation = false) {
|
|
261826
261716
|
return async (req, ctx, next) => {
|
|
261827
261717
|
const rawResponse = await next(req, ctx);
|
|
261828
|
-
const statusCode = rawResponse instanceof
|
|
261718
|
+
const statusCode = rawResponse instanceof WinterSpecResponse ? rawResponse.statusCode() : rawResponse.status;
|
|
261829
261719
|
const isSuccess = statusCode >= 200 && statusCode < 300;
|
|
261830
261720
|
try {
|
|
261831
261721
|
const response = serializeToResponse(isSuccess && !skipValidation && (globalSpec.shouldValidateResponses ?? true), routeSpec, rawResponse);
|
|
261832
261722
|
return response;
|
|
261833
261723
|
} catch (err) {
|
|
261834
|
-
throw new
|
|
261724
|
+
throw new ResponseValidationError(err);
|
|
261835
261725
|
}
|
|
261836
261726
|
};
|
|
261837
261727
|
}
|
|
261838
|
-
async function
|
|
261728
|
+
async function wrapMiddlewares(middlewares, routeFn, request, ctx) {
|
|
261839
261729
|
return await middlewares.reduceRight((next, middleware) => {
|
|
261840
261730
|
return async (req, ctx2) => {
|
|
261841
261731
|
return middleware(req, ctx2, next);
|
|
@@ -261844,17 +261734,17 @@ async function wrapMiddlewares2(middlewares, routeFn, request, ctx) {
|
|
|
261844
261734
|
}
|
|
261845
261735
|
function serializeToResponse(shouldValidateResponse, routeSpec, response) {
|
|
261846
261736
|
if (!shouldValidateResponse) {
|
|
261847
|
-
return "serializeToResponse" in response ? response.serializeToResponse(
|
|
261737
|
+
return "serializeToResponse" in response ? response.serializeToResponse(z5.any()) : response;
|
|
261848
261738
|
}
|
|
261849
|
-
if (response instanceof
|
|
261850
|
-
if (response instanceof
|
|
261851
|
-
return response.serializeToResponse(routeSpec.jsonResponse ??
|
|
261739
|
+
if (response instanceof WinterSpecResponse) {
|
|
261740
|
+
if (response instanceof WinterSpecJsonResponse) {
|
|
261741
|
+
return response.serializeToResponse(routeSpec.jsonResponse ?? z5.any());
|
|
261852
261742
|
}
|
|
261853
|
-
if (response instanceof
|
|
261854
|
-
return response.serializeToResponse(routeSpec.multipartFormDataResponse ??
|
|
261743
|
+
if (response instanceof WinterSpecMultiPartFormDataResponse) {
|
|
261744
|
+
return response.serializeToResponse(routeSpec.multipartFormDataResponse ?? z5.any());
|
|
261855
261745
|
}
|
|
261856
|
-
if (response instanceof
|
|
261857
|
-
return response.serializeToResponse(
|
|
261746
|
+
if (response instanceof WinterSpecCustomResponse) {
|
|
261747
|
+
return response.serializeToResponse(z5.any());
|
|
261858
261748
|
}
|
|
261859
261749
|
}
|
|
261860
261750
|
if ("serializeToResponse" in response) {
|
|
@@ -261891,16 +261781,8 @@ function firstAuthMiddlewareThatSucceeds(authMiddlewares, onMultipleAuthMiddlewa
|
|
|
261891
261781
|
};
|
|
261892
261782
|
}
|
|
261893
261783
|
|
|
261894
|
-
// node_modules
|
|
261895
|
-
|
|
261896
|
-
json: WinterSpecResponse2.json,
|
|
261897
|
-
multipartFormData: WinterSpecResponse2.multipartFormData,
|
|
261898
|
-
custom: WinterSpecResponse2.custom
|
|
261899
|
-
};
|
|
261900
|
-
var getDefaultContext2 = () => ({ ...DEFAULT_CONTEXT2 });
|
|
261901
|
-
|
|
261902
|
-
// node_modules/@tscircuit/file-server/node_modules/winterspec/dist/types/winter-spec.js
|
|
261903
|
-
function makeRequestAgainstWinterSpec2(winterSpec, options = {}) {
|
|
261784
|
+
// node_modules/winterspec/dist/types/winter-spec.js
|
|
261785
|
+
function makeRequestAgainstWinterSpec(winterSpec, options = {}) {
|
|
261904
261786
|
return async (request) => {
|
|
261905
261787
|
const { routeMatcher, routeMapWithHandlers, handle404 = () => new Response("Not found", {
|
|
261906
261788
|
status: 404
|
|
@@ -261928,27 +261810,42 @@ function makeRequestAgainstWinterSpec2(winterSpec, options = {}) {
|
|
|
261928
261810
|
}
|
|
261929
261811
|
const { matchedRoute, routeParams } = routeMatcher(pathname) ?? {};
|
|
261930
261812
|
let routeFn = matchedRoute && routeMapWithHandlers[matchedRoute];
|
|
261931
|
-
const winterSpecRequest =
|
|
261813
|
+
const winterSpecRequest = createWinterSpecRequest(request, {
|
|
261932
261814
|
winterSpec,
|
|
261933
261815
|
routeParams: routeParams ?? {}
|
|
261934
261816
|
});
|
|
261935
261817
|
if (!routeFn) {
|
|
261936
|
-
return await handle404(winterSpecRequest,
|
|
261818
|
+
return await handle404(winterSpecRequest, getDefaultContext());
|
|
261937
261819
|
}
|
|
261938
|
-
return
|
|
261820
|
+
return wrapMiddlewares(options.middleware ?? [], routeFn, winterSpecRequest, getDefaultContext());
|
|
261939
261821
|
};
|
|
261940
261822
|
}
|
|
261941
|
-
|
|
261942
|
-
|
|
261943
|
-
var
|
|
261944
|
-
|
|
261945
|
-
|
|
261946
|
-
|
|
261947
|
-
|
|
261948
|
-
|
|
261949
|
-
|
|
261823
|
+
|
|
261824
|
+
// node_modules/winterspec/dist/serve/create-winter-spec-from-route-map.js
|
|
261825
|
+
var import_next_route_matcher2 = __toESM2(require_dist8(), 1);
|
|
261826
|
+
|
|
261827
|
+
// node_modules/winterspec/dist/adapters/node.js
|
|
261828
|
+
var EdgePrimitives = __toESM2(require_dist6(), 1);
|
|
261829
|
+
var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
|
|
261830
|
+
const transformToNode = transformToNodeBuilder({
|
|
261831
|
+
defaultOrigin: `http://localhost${port ? `:${port}` : ""}`
|
|
261832
|
+
});
|
|
261833
|
+
return transformToNode((req) => winterSpec.makeRequest(req, {
|
|
261834
|
+
middleware
|
|
261835
|
+
}));
|
|
261836
|
+
};
|
|
261837
|
+
|
|
261838
|
+
// node_modules/@tscircuit/file-server/dist/bundle.js
|
|
261950
261839
|
var import_next_route_matcher3 = __toESM2(require_dist8(), 1);
|
|
261951
|
-
// node_modules
|
|
261840
|
+
// node_modules/winterspec/dist/config/config.js
|
|
261841
|
+
import { z as z6 } from "zod";
|
|
261842
|
+
var winterSpecConfigSchema = z6.object({
|
|
261843
|
+
rootDirectory: z6.string().optional(),
|
|
261844
|
+
tsconfigPath: z6.string().optional(),
|
|
261845
|
+
routesDirectory: z6.string().optional(),
|
|
261846
|
+
platform: z6.enum(["node", "wintercg-minimal"]).default("wintercg-minimal").optional()
|
|
261847
|
+
}).strict();
|
|
261848
|
+
// node_modules/zustand/esm/vanilla.mjs
|
|
261952
261849
|
var createStoreImpl = (createState) => {
|
|
261953
261850
|
let state;
|
|
261954
261851
|
const listeners = /* @__PURE__ */ new Set;
|
|
@@ -262015,20 +261912,20 @@ var hoist = (store) => {
|
|
|
262015
261912
|
return hoistState(hoistActions(store));
|
|
262016
261913
|
};
|
|
262017
261914
|
|
|
262018
|
-
// node_modules
|
|
261915
|
+
// node_modules/zustand/esm/middleware.mjs
|
|
262019
261916
|
var combine = (initialState, create) => (...a3) => Object.assign({}, initialState, create(...a3));
|
|
262020
261917
|
|
|
262021
261918
|
// node_modules/@tscircuit/file-server/dist/bundle.js
|
|
262022
|
-
import { z as
|
|
261919
|
+
import { z as z7 } from "zod";
|
|
262023
261920
|
import { z as z23 } from "zod";
|
|
262024
261921
|
import { z as z32 } from "zod";
|
|
262025
261922
|
import { z as z42 } from "zod";
|
|
262026
261923
|
import { z as z52 } from "zod";
|
|
262027
261924
|
import { z as z62 } from "zod";
|
|
262028
261925
|
import { z as z72 } from "zod";
|
|
262029
|
-
import { z as
|
|
261926
|
+
import { z as z8 } from "zod";
|
|
262030
261927
|
import { z as z92 } from "zod";
|
|
262031
|
-
import { z as
|
|
261928
|
+
import { z as z10 } from "zod";
|
|
262032
261929
|
import { z as z11 } from "zod";
|
|
262033
261930
|
import { Buffer as Buffer2 } from "node:buffer";
|
|
262034
261931
|
import { z as z12 } from "zod";
|
|
@@ -262040,31 +261937,31 @@ import { z as z17 } from "zod";
|
|
|
262040
261937
|
import { z as z18 } from "zod";
|
|
262041
261938
|
import { z as z19 } from "zod";
|
|
262042
261939
|
import { z as z20 } from "zod";
|
|
262043
|
-
var fileSchema =
|
|
262044
|
-
file_id:
|
|
262045
|
-
file_path:
|
|
262046
|
-
text_content:
|
|
262047
|
-
binary_content_b64:
|
|
262048
|
-
created_at:
|
|
261940
|
+
var fileSchema = z7.object({
|
|
261941
|
+
file_id: z7.string(),
|
|
261942
|
+
file_path: z7.string(),
|
|
261943
|
+
text_content: z7.string().optional(),
|
|
261944
|
+
binary_content_b64: z7.string().optional(),
|
|
261945
|
+
created_at: z7.string()
|
|
262049
261946
|
}).refine((data) => data.text_content !== undefined !== (data.binary_content_b64 !== undefined), {
|
|
262050
261947
|
message: "Provide either text_content or binary_content_b64",
|
|
262051
261948
|
path: ["text_content"]
|
|
262052
261949
|
});
|
|
262053
|
-
var eventSchema =
|
|
262054
|
-
event_id:
|
|
262055
|
-
event_type:
|
|
262056
|
-
|
|
262057
|
-
|
|
262058
|
-
|
|
261950
|
+
var eventSchema = z7.object({
|
|
261951
|
+
event_id: z7.string(),
|
|
261952
|
+
event_type: z7.union([
|
|
261953
|
+
z7.literal("FILE_UPDATED"),
|
|
261954
|
+
z7.literal("FILE_DELETED"),
|
|
261955
|
+
z7.literal("FILE_CREATED")
|
|
262059
261956
|
]),
|
|
262060
|
-
file_path:
|
|
262061
|
-
created_at:
|
|
262062
|
-
initiator:
|
|
261957
|
+
file_path: z7.string(),
|
|
261958
|
+
created_at: z7.string(),
|
|
261959
|
+
initiator: z7.string().optional()
|
|
262063
261960
|
});
|
|
262064
|
-
var databaseSchema =
|
|
262065
|
-
idCounter:
|
|
262066
|
-
files:
|
|
262067
|
-
events:
|
|
261961
|
+
var databaseSchema = z7.object({
|
|
261962
|
+
idCounter: z7.number().default(0),
|
|
261963
|
+
files: z7.array(fileSchema).default([]),
|
|
261964
|
+
events: z7.array(eventSchema).default([])
|
|
262068
261965
|
});
|
|
262069
261966
|
function normalizePath3(path52) {
|
|
262070
261967
|
if (!path52 || path52 === "/")
|
|
@@ -262494,16 +262391,16 @@ var create_default2 = withRouteSpec({
|
|
|
262494
262391
|
});
|
|
262495
262392
|
var list_default3 = withRouteSpec({
|
|
262496
262393
|
methods: ["GET"],
|
|
262497
|
-
queryParams:
|
|
262498
|
-
since:
|
|
262499
|
-
event_type:
|
|
262394
|
+
queryParams: z8.object({
|
|
262395
|
+
since: z8.string().optional(),
|
|
262396
|
+
event_type: z8.string().optional()
|
|
262500
262397
|
}),
|
|
262501
|
-
jsonResponse:
|
|
262502
|
-
event_list:
|
|
262503
|
-
event_id:
|
|
262504
|
-
event_type:
|
|
262505
|
-
file_path:
|
|
262506
|
-
created_at:
|
|
262398
|
+
jsonResponse: z8.object({
|
|
262399
|
+
event_list: z8.array(z8.object({
|
|
262400
|
+
event_id: z8.string(),
|
|
262401
|
+
event_type: z8.string(),
|
|
262402
|
+
file_path: z8.string().optional(),
|
|
262403
|
+
created_at: z8.string()
|
|
262507
262404
|
}).passthrough())
|
|
262508
262405
|
})
|
|
262509
262406
|
})((req, ctx) => {
|
|
@@ -262521,12 +262418,12 @@ var reset_default = withRouteSpec({
|
|
|
262521
262418
|
});
|
|
262522
262419
|
var delete_default = withRouteSpec({
|
|
262523
262420
|
methods: ["POST", "DELETE"],
|
|
262524
|
-
commonParams:
|
|
262525
|
-
file_id:
|
|
262526
|
-
file_path:
|
|
262527
|
-
initiator:
|
|
262421
|
+
commonParams: z10.object({
|
|
262422
|
+
file_id: z10.string().optional(),
|
|
262423
|
+
file_path: z10.string().optional(),
|
|
262424
|
+
initiator: z10.string().optional()
|
|
262528
262425
|
}),
|
|
262529
|
-
jsonResponse:
|
|
262426
|
+
jsonResponse: z10.union([z10.null(), z10.object({ error: z10.string() })])
|
|
262530
262427
|
})(async (req, ctx) => {
|
|
262531
262428
|
const { file_id, file_path, initiator } = req.commonParams;
|
|
262532
262429
|
if (!file_id && !file_path) {
|
|
@@ -262892,9 +262789,9 @@ var routeMapWithHandlers = {
|
|
|
262892
262789
|
"/": routes_default
|
|
262893
262790
|
};
|
|
262894
262791
|
var winterSpec = {
|
|
262895
|
-
routeMatcher:
|
|
262792
|
+
routeMatcher: import_next_route_matcher3.getRouteMatcher(Object.keys(routeMapWithHandlers)),
|
|
262896
262793
|
routeMapWithHandlers,
|
|
262897
|
-
makeRequest: async (req, options) =>
|
|
262794
|
+
makeRequest: async (req, options) => makeRequestAgainstWinterSpec(winterSpec, options)(req)
|
|
262898
262795
|
};
|
|
262899
262796
|
var stdin_default = winterSpec;
|
|
262900
262797
|
|
|
@@ -265440,9 +265337,9 @@ import { z as z43 } from "zod";
|
|
|
265440
265337
|
import { z as z53 } from "zod";
|
|
265441
265338
|
import { z as z63 } from "zod";
|
|
265442
265339
|
import { z as z73 } from "zod";
|
|
265443
|
-
import { z as
|
|
265340
|
+
import { z as z82 } from "zod";
|
|
265444
265341
|
import { z as z93 } from "zod";
|
|
265445
|
-
import { z as
|
|
265342
|
+
import { z as z102 } from "zod";
|
|
265446
265343
|
import { z as z112 } from "zod";
|
|
265447
265344
|
import { z as z122 } from "zod";
|
|
265448
265345
|
import { z as z132 } from "zod";
|
|
@@ -265557,8 +265454,8 @@ var M15 = defineExcellonDrillCommand({
|
|
|
265557
265454
|
});
|
|
265558
265455
|
var M16 = defineExcellonDrillCommand({
|
|
265559
265456
|
command_code: "M16",
|
|
265560
|
-
schema:
|
|
265561
|
-
command_code:
|
|
265457
|
+
schema: z82.object({
|
|
265458
|
+
command_code: z82.literal("M16").default("M16")
|
|
265562
265459
|
}),
|
|
265563
265460
|
stringify: () => "M16"
|
|
265564
265461
|
});
|
|
@@ -265571,8 +265468,8 @@ var M30 = defineExcellonDrillCommand({
|
|
|
265571
265468
|
});
|
|
265572
265469
|
var M48 = defineExcellonDrillCommand({
|
|
265573
265470
|
command_code: "M48",
|
|
265574
|
-
schema:
|
|
265575
|
-
command_code:
|
|
265471
|
+
schema: z102.object({
|
|
265472
|
+
command_code: z102.literal("M48").default("M48")
|
|
265576
265473
|
}),
|
|
265577
265474
|
stringify: () => "M48"
|
|
265578
265475
|
});
|
|
@@ -268402,8 +268299,8 @@ __export4(external_exports2, {
|
|
|
268402
268299
|
ZodDiscriminatedUnion: () => ZodDiscriminatedUnion2,
|
|
268403
268300
|
ZodEffects: () => ZodEffects2,
|
|
268404
268301
|
ZodEnum: () => ZodEnum2,
|
|
268405
|
-
ZodError: () =>
|
|
268406
|
-
ZodFirstPartyTypeKind: () =>
|
|
268302
|
+
ZodError: () => ZodError3,
|
|
268303
|
+
ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind3,
|
|
268407
268304
|
ZodFunction: () => ZodFunction2,
|
|
268408
268305
|
ZodIntersection: () => ZodIntersection2,
|
|
268409
268306
|
ZodIssueCode: () => ZodIssueCode2,
|
|
@@ -268642,7 +268539,7 @@ var quotelessJson2 = (obj) => {
|
|
|
268642
268539
|
const json2 = JSON.stringify(obj, null, 2);
|
|
268643
268540
|
return json2.replace(/"([^"]+)":/g, "$1:");
|
|
268644
268541
|
};
|
|
268645
|
-
var
|
|
268542
|
+
var ZodError3 = class _ZodError2 extends Error {
|
|
268646
268543
|
get errors() {
|
|
268647
268544
|
return this.issues;
|
|
268648
268545
|
}
|
|
@@ -268732,8 +268629,8 @@ var ZodError4 = class _ZodError2 extends Error {
|
|
|
268732
268629
|
return this.flatten();
|
|
268733
268630
|
}
|
|
268734
268631
|
};
|
|
268735
|
-
|
|
268736
|
-
const error2 = new
|
|
268632
|
+
ZodError3.create = (issues) => {
|
|
268633
|
+
const error2 = new ZodError3(issues);
|
|
268737
268634
|
return error2;
|
|
268738
268635
|
};
|
|
268739
268636
|
var errorMap2 = (issue, _ctx) => {
|
|
@@ -268984,7 +268881,7 @@ var handleResult2 = (ctx, result) => {
|
|
|
268984
268881
|
get error() {
|
|
268985
268882
|
if (this._error)
|
|
268986
268883
|
return this._error;
|
|
268987
|
-
const error2 = new
|
|
268884
|
+
const error2 = new ZodError3(ctx.common.issues);
|
|
268988
268885
|
this._error = error2;
|
|
268989
268886
|
return this._error;
|
|
268990
268887
|
}
|
|
@@ -269183,7 +269080,7 @@ var ZodType2 = class {
|
|
|
269183
269080
|
_refinement(refinement) {
|
|
269184
269081
|
return new ZodEffects2({
|
|
269185
269082
|
schema: this,
|
|
269186
|
-
typeName:
|
|
269083
|
+
typeName: ZodFirstPartyTypeKind3.ZodEffects,
|
|
269187
269084
|
effect: { type: "refinement", refinement }
|
|
269188
269085
|
});
|
|
269189
269086
|
}
|
|
@@ -269248,7 +269145,7 @@ var ZodType2 = class {
|
|
|
269248
269145
|
return new ZodEffects2({
|
|
269249
269146
|
...processCreateParams2(this._def),
|
|
269250
269147
|
schema: this,
|
|
269251
|
-
typeName:
|
|
269148
|
+
typeName: ZodFirstPartyTypeKind3.ZodEffects,
|
|
269252
269149
|
effect: { type: "transform", transform: transform2 }
|
|
269253
269150
|
});
|
|
269254
269151
|
}
|
|
@@ -269258,12 +269155,12 @@ var ZodType2 = class {
|
|
|
269258
269155
|
...processCreateParams2(this._def),
|
|
269259
269156
|
innerType: this,
|
|
269260
269157
|
defaultValue: defaultValueFunc,
|
|
269261
|
-
typeName:
|
|
269158
|
+
typeName: ZodFirstPartyTypeKind3.ZodDefault
|
|
269262
269159
|
});
|
|
269263
269160
|
}
|
|
269264
269161
|
brand() {
|
|
269265
269162
|
return new ZodBranded2({
|
|
269266
|
-
typeName:
|
|
269163
|
+
typeName: ZodFirstPartyTypeKind3.ZodBranded,
|
|
269267
269164
|
type: this,
|
|
269268
269165
|
...processCreateParams2(this._def)
|
|
269269
269166
|
});
|
|
@@ -269274,7 +269171,7 @@ var ZodType2 = class {
|
|
|
269274
269171
|
...processCreateParams2(this._def),
|
|
269275
269172
|
innerType: this,
|
|
269276
269173
|
catchValue: catchValueFunc,
|
|
269277
|
-
typeName:
|
|
269174
|
+
typeName: ZodFirstPartyTypeKind3.ZodCatch
|
|
269278
269175
|
});
|
|
269279
269176
|
}
|
|
269280
269177
|
describe(description) {
|
|
@@ -269915,7 +269812,7 @@ var ZodString2 = class _ZodString2 extends ZodType2 {
|
|
|
269915
269812
|
ZodString2.create = (params2) => {
|
|
269916
269813
|
return new ZodString2({
|
|
269917
269814
|
checks: [],
|
|
269918
|
-
typeName:
|
|
269815
|
+
typeName: ZodFirstPartyTypeKind3.ZodString,
|
|
269919
269816
|
coerce: params2?.coerce ?? false,
|
|
269920
269817
|
...processCreateParams2(params2)
|
|
269921
269818
|
});
|
|
@@ -270155,7 +270052,7 @@ var ZodNumber2 = class _ZodNumber2 extends ZodType2 {
|
|
|
270155
270052
|
ZodNumber2.create = (params2) => {
|
|
270156
270053
|
return new ZodNumber2({
|
|
270157
270054
|
checks: [],
|
|
270158
|
-
typeName:
|
|
270055
|
+
typeName: ZodFirstPartyTypeKind3.ZodNumber,
|
|
270159
270056
|
coerce: params2?.coerce || false,
|
|
270160
270057
|
...processCreateParams2(params2)
|
|
270161
270058
|
});
|
|
@@ -270327,7 +270224,7 @@ var ZodBigInt2 = class _ZodBigInt2 extends ZodType2 {
|
|
|
270327
270224
|
ZodBigInt2.create = (params2) => {
|
|
270328
270225
|
return new ZodBigInt2({
|
|
270329
270226
|
checks: [],
|
|
270330
|
-
typeName:
|
|
270227
|
+
typeName: ZodFirstPartyTypeKind3.ZodBigInt,
|
|
270331
270228
|
coerce: params2?.coerce ?? false,
|
|
270332
270229
|
...processCreateParams2(params2)
|
|
270333
270230
|
});
|
|
@@ -270352,7 +270249,7 @@ var ZodBoolean2 = class extends ZodType2 {
|
|
|
270352
270249
|
};
|
|
270353
270250
|
ZodBoolean2.create = (params2) => {
|
|
270354
270251
|
return new ZodBoolean2({
|
|
270355
|
-
typeName:
|
|
270252
|
+
typeName: ZodFirstPartyTypeKind3.ZodBoolean,
|
|
270356
270253
|
coerce: params2?.coerce || false,
|
|
270357
270254
|
...processCreateParams2(params2)
|
|
270358
270255
|
});
|
|
@@ -270462,7 +270359,7 @@ ZodDate2.create = (params2) => {
|
|
|
270462
270359
|
return new ZodDate2({
|
|
270463
270360
|
checks: [],
|
|
270464
270361
|
coerce: params2?.coerce || false,
|
|
270465
|
-
typeName:
|
|
270362
|
+
typeName: ZodFirstPartyTypeKind3.ZodDate,
|
|
270466
270363
|
...processCreateParams2(params2)
|
|
270467
270364
|
});
|
|
270468
270365
|
};
|
|
@@ -270483,7 +270380,7 @@ var ZodSymbol2 = class extends ZodType2 {
|
|
|
270483
270380
|
};
|
|
270484
270381
|
ZodSymbol2.create = (params2) => {
|
|
270485
270382
|
return new ZodSymbol2({
|
|
270486
|
-
typeName:
|
|
270383
|
+
typeName: ZodFirstPartyTypeKind3.ZodSymbol,
|
|
270487
270384
|
...processCreateParams2(params2)
|
|
270488
270385
|
});
|
|
270489
270386
|
};
|
|
@@ -270504,7 +270401,7 @@ var ZodUndefined2 = class extends ZodType2 {
|
|
|
270504
270401
|
};
|
|
270505
270402
|
ZodUndefined2.create = (params2) => {
|
|
270506
270403
|
return new ZodUndefined2({
|
|
270507
|
-
typeName:
|
|
270404
|
+
typeName: ZodFirstPartyTypeKind3.ZodUndefined,
|
|
270508
270405
|
...processCreateParams2(params2)
|
|
270509
270406
|
});
|
|
270510
270407
|
};
|
|
@@ -270525,7 +270422,7 @@ var ZodNull2 = class extends ZodType2 {
|
|
|
270525
270422
|
};
|
|
270526
270423
|
ZodNull2.create = (params2) => {
|
|
270527
270424
|
return new ZodNull2({
|
|
270528
|
-
typeName:
|
|
270425
|
+
typeName: ZodFirstPartyTypeKind3.ZodNull,
|
|
270529
270426
|
...processCreateParams2(params2)
|
|
270530
270427
|
});
|
|
270531
270428
|
};
|
|
@@ -270540,7 +270437,7 @@ var ZodAny2 = class extends ZodType2 {
|
|
|
270540
270437
|
};
|
|
270541
270438
|
ZodAny2.create = (params2) => {
|
|
270542
270439
|
return new ZodAny2({
|
|
270543
|
-
typeName:
|
|
270440
|
+
typeName: ZodFirstPartyTypeKind3.ZodAny,
|
|
270544
270441
|
...processCreateParams2(params2)
|
|
270545
270442
|
});
|
|
270546
270443
|
};
|
|
@@ -270555,7 +270452,7 @@ var ZodUnknown2 = class extends ZodType2 {
|
|
|
270555
270452
|
};
|
|
270556
270453
|
ZodUnknown2.create = (params2) => {
|
|
270557
270454
|
return new ZodUnknown2({
|
|
270558
|
-
typeName:
|
|
270455
|
+
typeName: ZodFirstPartyTypeKind3.ZodUnknown,
|
|
270559
270456
|
...processCreateParams2(params2)
|
|
270560
270457
|
});
|
|
270561
270458
|
};
|
|
@@ -270572,7 +270469,7 @@ var ZodNever2 = class extends ZodType2 {
|
|
|
270572
270469
|
};
|
|
270573
270470
|
ZodNever2.create = (params2) => {
|
|
270574
270471
|
return new ZodNever2({
|
|
270575
|
-
typeName:
|
|
270472
|
+
typeName: ZodFirstPartyTypeKind3.ZodNever,
|
|
270576
270473
|
...processCreateParams2(params2)
|
|
270577
270474
|
});
|
|
270578
270475
|
};
|
|
@@ -270593,7 +270490,7 @@ var ZodVoid2 = class extends ZodType2 {
|
|
|
270593
270490
|
};
|
|
270594
270491
|
ZodVoid2.create = (params2) => {
|
|
270595
270492
|
return new ZodVoid2({
|
|
270596
|
-
typeName:
|
|
270493
|
+
typeName: ZodFirstPartyTypeKind3.ZodVoid,
|
|
270597
270494
|
...processCreateParams2(params2)
|
|
270598
270495
|
});
|
|
270599
270496
|
};
|
|
@@ -270694,7 +270591,7 @@ ZodArray2.create = (schema, params2) => {
|
|
|
270694
270591
|
minLength: null,
|
|
270695
270592
|
maxLength: null,
|
|
270696
270593
|
exactLength: null,
|
|
270697
|
-
typeName:
|
|
270594
|
+
typeName: ZodFirstPartyTypeKind3.ZodArray,
|
|
270698
270595
|
...processCreateParams2(params2)
|
|
270699
270596
|
});
|
|
270700
270597
|
};
|
|
@@ -270872,7 +270769,7 @@ var ZodObject2 = class _ZodObject2 extends ZodType2 {
|
|
|
270872
270769
|
...this._def.shape(),
|
|
270873
270770
|
...merging._def.shape()
|
|
270874
270771
|
}),
|
|
270875
|
-
typeName:
|
|
270772
|
+
typeName: ZodFirstPartyTypeKind3.ZodObject
|
|
270876
270773
|
});
|
|
270877
270774
|
return merged;
|
|
270878
270775
|
}
|
|
@@ -270955,7 +270852,7 @@ ZodObject2.create = (shape, params2) => {
|
|
|
270955
270852
|
shape: () => shape,
|
|
270956
270853
|
unknownKeys: "strip",
|
|
270957
270854
|
catchall: ZodNever2.create(),
|
|
270958
|
-
typeName:
|
|
270855
|
+
typeName: ZodFirstPartyTypeKind3.ZodObject,
|
|
270959
270856
|
...processCreateParams2(params2)
|
|
270960
270857
|
});
|
|
270961
270858
|
};
|
|
@@ -270964,7 +270861,7 @@ ZodObject2.strictCreate = (shape, params2) => {
|
|
|
270964
270861
|
shape: () => shape,
|
|
270965
270862
|
unknownKeys: "strict",
|
|
270966
270863
|
catchall: ZodNever2.create(),
|
|
270967
|
-
typeName:
|
|
270864
|
+
typeName: ZodFirstPartyTypeKind3.ZodObject,
|
|
270968
270865
|
...processCreateParams2(params2)
|
|
270969
270866
|
});
|
|
270970
270867
|
};
|
|
@@ -270973,7 +270870,7 @@ ZodObject2.lazycreate = (shape, params2) => {
|
|
|
270973
270870
|
shape,
|
|
270974
270871
|
unknownKeys: "strip",
|
|
270975
270872
|
catchall: ZodNever2.create(),
|
|
270976
|
-
typeName:
|
|
270873
|
+
typeName: ZodFirstPartyTypeKind3.ZodObject,
|
|
270977
270874
|
...processCreateParams2(params2)
|
|
270978
270875
|
});
|
|
270979
270876
|
};
|
|
@@ -270993,7 +270890,7 @@ var ZodUnion2 = class extends ZodType2 {
|
|
|
270993
270890
|
return result.result;
|
|
270994
270891
|
}
|
|
270995
270892
|
}
|
|
270996
|
-
const unionErrors = results.map((result) => new
|
|
270893
|
+
const unionErrors = results.map((result) => new ZodError3(result.ctx.common.issues));
|
|
270997
270894
|
addIssueToContext2(ctx, {
|
|
270998
270895
|
code: ZodIssueCode2.invalid_union,
|
|
270999
270896
|
unionErrors
|
|
@@ -271049,7 +270946,7 @@ var ZodUnion2 = class extends ZodType2 {
|
|
|
271049
270946
|
ctx.common.issues.push(...dirty.ctx.common.issues);
|
|
271050
270947
|
return dirty.result;
|
|
271051
270948
|
}
|
|
271052
|
-
const unionErrors = issues.map((issues2) => new
|
|
270949
|
+
const unionErrors = issues.map((issues2) => new ZodError3(issues2));
|
|
271053
270950
|
addIssueToContext2(ctx, {
|
|
271054
270951
|
code: ZodIssueCode2.invalid_union,
|
|
271055
270952
|
unionErrors
|
|
@@ -271064,7 +270961,7 @@ var ZodUnion2 = class extends ZodType2 {
|
|
|
271064
270961
|
ZodUnion2.create = (types2, params2) => {
|
|
271065
270962
|
return new ZodUnion2({
|
|
271066
270963
|
options: types2,
|
|
271067
|
-
typeName:
|
|
270964
|
+
typeName: ZodFirstPartyTypeKind3.ZodUnion,
|
|
271068
270965
|
...processCreateParams2(params2)
|
|
271069
270966
|
});
|
|
271070
270967
|
};
|
|
@@ -271159,7 +271056,7 @@ var ZodDiscriminatedUnion2 = class _ZodDiscriminatedUnion2 extends ZodType2 {
|
|
|
271159
271056
|
}
|
|
271160
271057
|
}
|
|
271161
271058
|
return new _ZodDiscriminatedUnion2({
|
|
271162
|
-
typeName:
|
|
271059
|
+
typeName: ZodFirstPartyTypeKind3.ZodDiscriminatedUnion,
|
|
271163
271060
|
discriminator,
|
|
271164
271061
|
options,
|
|
271165
271062
|
optionsMap,
|
|
@@ -271254,7 +271151,7 @@ ZodIntersection2.create = (left, right, params2) => {
|
|
|
271254
271151
|
return new ZodIntersection2({
|
|
271255
271152
|
left,
|
|
271256
271153
|
right,
|
|
271257
|
-
typeName:
|
|
271154
|
+
typeName: ZodFirstPartyTypeKind3.ZodIntersection,
|
|
271258
271155
|
...processCreateParams2(params2)
|
|
271259
271156
|
});
|
|
271260
271157
|
};
|
|
@@ -271320,7 +271217,7 @@ ZodTuple2.create = (schemas, params2) => {
|
|
|
271320
271217
|
}
|
|
271321
271218
|
return new ZodTuple2({
|
|
271322
271219
|
items: schemas,
|
|
271323
|
-
typeName:
|
|
271220
|
+
typeName: ZodFirstPartyTypeKind3.ZodTuple,
|
|
271324
271221
|
rest: null,
|
|
271325
271222
|
...processCreateParams2(params2)
|
|
271326
271223
|
});
|
|
@@ -271366,14 +271263,14 @@ var ZodRecord2 = class _ZodRecord2 extends ZodType2 {
|
|
|
271366
271263
|
return new _ZodRecord2({
|
|
271367
271264
|
keyType: first,
|
|
271368
271265
|
valueType: second,
|
|
271369
|
-
typeName:
|
|
271266
|
+
typeName: ZodFirstPartyTypeKind3.ZodRecord,
|
|
271370
271267
|
...processCreateParams2(third)
|
|
271371
271268
|
});
|
|
271372
271269
|
}
|
|
271373
271270
|
return new _ZodRecord2({
|
|
271374
271271
|
keyType: ZodString2.create(),
|
|
271375
271272
|
valueType: first,
|
|
271376
|
-
typeName:
|
|
271273
|
+
typeName: ZodFirstPartyTypeKind3.ZodRecord,
|
|
271377
271274
|
...processCreateParams2(second)
|
|
271378
271275
|
});
|
|
271379
271276
|
}
|
|
@@ -271440,7 +271337,7 @@ ZodMap2.create = (keyType, valueType, params2) => {
|
|
|
271440
271337
|
return new ZodMap2({
|
|
271441
271338
|
valueType,
|
|
271442
271339
|
keyType,
|
|
271443
|
-
typeName:
|
|
271340
|
+
typeName: ZodFirstPartyTypeKind3.ZodMap,
|
|
271444
271341
|
...processCreateParams2(params2)
|
|
271445
271342
|
});
|
|
271446
271343
|
};
|
|
@@ -271525,7 +271422,7 @@ ZodSet2.create = (valueType, params2) => {
|
|
|
271525
271422
|
valueType,
|
|
271526
271423
|
minSize: null,
|
|
271527
271424
|
maxSize: null,
|
|
271528
|
-
typeName:
|
|
271425
|
+
typeName: ZodFirstPartyTypeKind3.ZodSet,
|
|
271529
271426
|
...processCreateParams2(params2)
|
|
271530
271427
|
});
|
|
271531
271428
|
};
|
|
@@ -271571,7 +271468,7 @@ var ZodFunction2 = class _ZodFunction2 extends ZodType2 {
|
|
|
271571
271468
|
if (this._def.returns instanceof ZodPromise2) {
|
|
271572
271469
|
const me3 = this;
|
|
271573
271470
|
return OK2(async function(...args) {
|
|
271574
|
-
const error2 = new
|
|
271471
|
+
const error2 = new ZodError3([]);
|
|
271575
271472
|
const parsedArgs = await me3._def.args.parseAsync(args, params2).catch((e4) => {
|
|
271576
271473
|
error2.addIssue(makeArgsIssue(args, e4));
|
|
271577
271474
|
throw error2;
|
|
@@ -271588,12 +271485,12 @@ var ZodFunction2 = class _ZodFunction2 extends ZodType2 {
|
|
|
271588
271485
|
return OK2(function(...args) {
|
|
271589
271486
|
const parsedArgs = me3._def.args.safeParse(args, params2);
|
|
271590
271487
|
if (!parsedArgs.success) {
|
|
271591
|
-
throw new
|
|
271488
|
+
throw new ZodError3([makeArgsIssue(args, parsedArgs.error)]);
|
|
271592
271489
|
}
|
|
271593
271490
|
const result = Reflect.apply(fn3, this, parsedArgs.data);
|
|
271594
271491
|
const parsedReturns = me3._def.returns.safeParse(result, params2);
|
|
271595
271492
|
if (!parsedReturns.success) {
|
|
271596
|
-
throw new
|
|
271493
|
+
throw new ZodError3([makeReturnsIssue(result, parsedReturns.error)]);
|
|
271597
271494
|
}
|
|
271598
271495
|
return parsedReturns.data;
|
|
271599
271496
|
});
|
|
@@ -271629,7 +271526,7 @@ var ZodFunction2 = class _ZodFunction2 extends ZodType2 {
|
|
|
271629
271526
|
return new _ZodFunction2({
|
|
271630
271527
|
args: args ? args : ZodTuple2.create([]).rest(ZodUnknown2.create()),
|
|
271631
271528
|
returns: returns || ZodUnknown2.create(),
|
|
271632
|
-
typeName:
|
|
271529
|
+
typeName: ZodFirstPartyTypeKind3.ZodFunction,
|
|
271633
271530
|
...processCreateParams2(params2)
|
|
271634
271531
|
});
|
|
271635
271532
|
}
|
|
@@ -271647,7 +271544,7 @@ var ZodLazy2 = class extends ZodType2 {
|
|
|
271647
271544
|
ZodLazy2.create = (getter, params2) => {
|
|
271648
271545
|
return new ZodLazy2({
|
|
271649
271546
|
getter,
|
|
271650
|
-
typeName:
|
|
271547
|
+
typeName: ZodFirstPartyTypeKind3.ZodLazy,
|
|
271651
271548
|
...processCreateParams2(params2)
|
|
271652
271549
|
});
|
|
271653
271550
|
};
|
|
@@ -271671,14 +271568,14 @@ var ZodLiteral2 = class extends ZodType2 {
|
|
|
271671
271568
|
ZodLiteral2.create = (value, params2) => {
|
|
271672
271569
|
return new ZodLiteral2({
|
|
271673
271570
|
value,
|
|
271674
|
-
typeName:
|
|
271571
|
+
typeName: ZodFirstPartyTypeKind3.ZodLiteral,
|
|
271675
271572
|
...processCreateParams2(params2)
|
|
271676
271573
|
});
|
|
271677
271574
|
};
|
|
271678
271575
|
function createZodEnum2(values, params2) {
|
|
271679
271576
|
return new ZodEnum2({
|
|
271680
271577
|
values,
|
|
271681
|
-
typeName:
|
|
271578
|
+
typeName: ZodFirstPartyTypeKind3.ZodEnum,
|
|
271682
271579
|
...processCreateParams2(params2)
|
|
271683
271580
|
});
|
|
271684
271581
|
}
|
|
@@ -271781,7 +271678,7 @@ var ZodNativeEnum2 = class extends ZodType2 {
|
|
|
271781
271678
|
ZodNativeEnum2.create = (values, params2) => {
|
|
271782
271679
|
return new ZodNativeEnum2({
|
|
271783
271680
|
values,
|
|
271784
|
-
typeName:
|
|
271681
|
+
typeName: ZodFirstPartyTypeKind3.ZodNativeEnum,
|
|
271785
271682
|
...processCreateParams2(params2)
|
|
271786
271683
|
});
|
|
271787
271684
|
};
|
|
@@ -271811,7 +271708,7 @@ var ZodPromise2 = class extends ZodType2 {
|
|
|
271811
271708
|
ZodPromise2.create = (schema, params2) => {
|
|
271812
271709
|
return new ZodPromise2({
|
|
271813
271710
|
type: schema,
|
|
271814
|
-
typeName:
|
|
271711
|
+
typeName: ZodFirstPartyTypeKind3.ZodPromise,
|
|
271815
271712
|
...processCreateParams2(params2)
|
|
271816
271713
|
});
|
|
271817
271714
|
};
|
|
@@ -271820,7 +271717,7 @@ var ZodEffects2 = class extends ZodType2 {
|
|
|
271820
271717
|
return this._def.schema;
|
|
271821
271718
|
}
|
|
271822
271719
|
sourceType() {
|
|
271823
|
-
return this._def.schema._def.typeName ===
|
|
271720
|
+
return this._def.schema._def.typeName === ZodFirstPartyTypeKind3.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
271824
271721
|
}
|
|
271825
271722
|
_parse(input) {
|
|
271826
271723
|
const { status, ctx } = this._processInputParams(input);
|
|
@@ -271941,7 +271838,7 @@ var ZodEffects2 = class extends ZodType2 {
|
|
|
271941
271838
|
ZodEffects2.create = (schema, effect, params2) => {
|
|
271942
271839
|
return new ZodEffects2({
|
|
271943
271840
|
schema,
|
|
271944
|
-
typeName:
|
|
271841
|
+
typeName: ZodFirstPartyTypeKind3.ZodEffects,
|
|
271945
271842
|
effect,
|
|
271946
271843
|
...processCreateParams2(params2)
|
|
271947
271844
|
});
|
|
@@ -271950,7 +271847,7 @@ ZodEffects2.createWithPreprocess = (preprocess, schema, params2) => {
|
|
|
271950
271847
|
return new ZodEffects2({
|
|
271951
271848
|
schema,
|
|
271952
271849
|
effect: { type: "preprocess", transform: preprocess },
|
|
271953
|
-
typeName:
|
|
271850
|
+
typeName: ZodFirstPartyTypeKind3.ZodEffects,
|
|
271954
271851
|
...processCreateParams2(params2)
|
|
271955
271852
|
});
|
|
271956
271853
|
};
|
|
@@ -271969,7 +271866,7 @@ var ZodOptional2 = class extends ZodType2 {
|
|
|
271969
271866
|
ZodOptional2.create = (type, params2) => {
|
|
271970
271867
|
return new ZodOptional2({
|
|
271971
271868
|
innerType: type,
|
|
271972
|
-
typeName:
|
|
271869
|
+
typeName: ZodFirstPartyTypeKind3.ZodOptional,
|
|
271973
271870
|
...processCreateParams2(params2)
|
|
271974
271871
|
});
|
|
271975
271872
|
};
|
|
@@ -271988,7 +271885,7 @@ var ZodNullable2 = class extends ZodType2 {
|
|
|
271988
271885
|
ZodNullable2.create = (type, params2) => {
|
|
271989
271886
|
return new ZodNullable2({
|
|
271990
271887
|
innerType: type,
|
|
271991
|
-
typeName:
|
|
271888
|
+
typeName: ZodFirstPartyTypeKind3.ZodNullable,
|
|
271992
271889
|
...processCreateParams2(params2)
|
|
271993
271890
|
});
|
|
271994
271891
|
};
|
|
@@ -272012,7 +271909,7 @@ var ZodDefault2 = class extends ZodType2 {
|
|
|
272012
271909
|
ZodDefault2.create = (type, params2) => {
|
|
272013
271910
|
return new ZodDefault2({
|
|
272014
271911
|
innerType: type,
|
|
272015
|
-
typeName:
|
|
271912
|
+
typeName: ZodFirstPartyTypeKind3.ZodDefault,
|
|
272016
271913
|
defaultValue: typeof params2.default === "function" ? params2.default : () => params2.default,
|
|
272017
271914
|
...processCreateParams2(params2)
|
|
272018
271915
|
});
|
|
@@ -272040,7 +271937,7 @@ var ZodCatch2 = class extends ZodType2 {
|
|
|
272040
271937
|
status: "valid",
|
|
272041
271938
|
value: result2.status === "valid" ? result2.value : this._def.catchValue({
|
|
272042
271939
|
get error() {
|
|
272043
|
-
return new
|
|
271940
|
+
return new ZodError3(newCtx.common.issues);
|
|
272044
271941
|
},
|
|
272045
271942
|
input: newCtx.data
|
|
272046
271943
|
})
|
|
@@ -272051,7 +271948,7 @@ var ZodCatch2 = class extends ZodType2 {
|
|
|
272051
271948
|
status: "valid",
|
|
272052
271949
|
value: result.status === "valid" ? result.value : this._def.catchValue({
|
|
272053
271950
|
get error() {
|
|
272054
|
-
return new
|
|
271951
|
+
return new ZodError3(newCtx.common.issues);
|
|
272055
271952
|
},
|
|
272056
271953
|
input: newCtx.data
|
|
272057
271954
|
})
|
|
@@ -272065,7 +271962,7 @@ var ZodCatch2 = class extends ZodType2 {
|
|
|
272065
271962
|
ZodCatch2.create = (type, params2) => {
|
|
272066
271963
|
return new ZodCatch2({
|
|
272067
271964
|
innerType: type,
|
|
272068
|
-
typeName:
|
|
271965
|
+
typeName: ZodFirstPartyTypeKind3.ZodCatch,
|
|
272069
271966
|
catchValue: typeof params2.catch === "function" ? params2.catch : () => params2.catch,
|
|
272070
271967
|
...processCreateParams2(params2)
|
|
272071
271968
|
});
|
|
@@ -272087,7 +271984,7 @@ var ZodNaN2 = class extends ZodType2 {
|
|
|
272087
271984
|
};
|
|
272088
271985
|
ZodNaN2.create = (params2) => {
|
|
272089
271986
|
return new ZodNaN2({
|
|
272090
|
-
typeName:
|
|
271987
|
+
typeName: ZodFirstPartyTypeKind3.ZodNaN,
|
|
272091
271988
|
...processCreateParams2(params2)
|
|
272092
271989
|
});
|
|
272093
271990
|
};
|
|
@@ -272157,7 +272054,7 @@ var ZodPipeline2 = class _ZodPipeline2 extends ZodType2 {
|
|
|
272157
272054
|
return new _ZodPipeline2({
|
|
272158
272055
|
in: a3,
|
|
272159
272056
|
out: b3,
|
|
272160
|
-
typeName:
|
|
272057
|
+
typeName: ZodFirstPartyTypeKind3.ZodPipeline
|
|
272161
272058
|
});
|
|
272162
272059
|
}
|
|
272163
272060
|
};
|
|
@@ -272179,7 +272076,7 @@ var ZodReadonly2 = class extends ZodType2 {
|
|
|
272179
272076
|
ZodReadonly2.create = (type, params2) => {
|
|
272180
272077
|
return new ZodReadonly2({
|
|
272181
272078
|
innerType: type,
|
|
272182
|
-
typeName:
|
|
272079
|
+
typeName: ZodFirstPartyTypeKind3.ZodReadonly,
|
|
272183
272080
|
...processCreateParams2(params2)
|
|
272184
272081
|
});
|
|
272185
272082
|
};
|
|
@@ -272213,7 +272110,7 @@ function custom2(check, _params = {}, fatal) {
|
|
|
272213
272110
|
var late2 = {
|
|
272214
272111
|
object: ZodObject2.lazycreate
|
|
272215
272112
|
};
|
|
272216
|
-
var
|
|
272113
|
+
var ZodFirstPartyTypeKind3;
|
|
272217
272114
|
(function(ZodFirstPartyTypeKind22) {
|
|
272218
272115
|
ZodFirstPartyTypeKind22["ZodString"] = "ZodString";
|
|
272219
272116
|
ZodFirstPartyTypeKind22["ZodNumber"] = "ZodNumber";
|
|
@@ -272251,7 +272148,7 @@ var ZodFirstPartyTypeKind4;
|
|
|
272251
272148
|
ZodFirstPartyTypeKind22["ZodBranded"] = "ZodBranded";
|
|
272252
272149
|
ZodFirstPartyTypeKind22["ZodPipeline"] = "ZodPipeline";
|
|
272253
272150
|
ZodFirstPartyTypeKind22["ZodReadonly"] = "ZodReadonly";
|
|
272254
|
-
})(
|
|
272151
|
+
})(ZodFirstPartyTypeKind3 || (ZodFirstPartyTypeKind3 = {}));
|
|
272255
272152
|
var instanceOfType2 = (cls, params2 = {
|
|
272256
272153
|
message: `Input not instance of ${cls.name}`
|
|
272257
272154
|
}) => custom2((data) => data instanceof cls, params2);
|
|
@@ -278699,9 +278596,9 @@ import { z as z410 } from "zod";
|
|
|
278699
278596
|
import { z as z54 } from "zod";
|
|
278700
278597
|
import { z as z64 } from "zod";
|
|
278701
278598
|
import { z as z74 } from "zod";
|
|
278702
|
-
import { z as
|
|
278599
|
+
import { z as z83 } from "zod";
|
|
278703
278600
|
import { z as z94 } from "zod";
|
|
278704
|
-
import { z as
|
|
278601
|
+
import { z as z103 } from "zod";
|
|
278705
278602
|
import { z as z113 } from "zod";
|
|
278706
278603
|
import { z as z143 } from "zod";
|
|
278707
278604
|
import { z as z123 } from "zod";
|
|
@@ -278775,7 +278672,7 @@ import { z as z80 } from "zod";
|
|
|
278775
278672
|
import { z as z81 } from "zod";
|
|
278776
278673
|
import { z as z822 } from "zod";
|
|
278777
278674
|
import { z as z832 } from "zod";
|
|
278778
|
-
import { z as
|
|
278675
|
+
import { z as z84 } from "zod";
|
|
278779
278676
|
import { z as z85 } from "zod";
|
|
278780
278677
|
import { z as z86 } from "zod";
|
|
278781
278678
|
import { z as z87 } from "zod";
|
|
@@ -278795,7 +278692,7 @@ import { z as z100 } from "zod";
|
|
|
278795
278692
|
import { z as z101 } from "zod";
|
|
278796
278693
|
import { z as z1022 } from "zod";
|
|
278797
278694
|
import { z as z1032 } from "zod";
|
|
278798
|
-
import { z as
|
|
278695
|
+
import { z as z104 } from "zod";
|
|
278799
278696
|
import { z as z105 } from "zod";
|
|
278800
278697
|
import { z as z106 } from "zod";
|
|
278801
278698
|
import { z as z107 } from "zod";
|
|
@@ -279403,10 +279300,10 @@ var pcbRenderLayer2 = z74.enum([
|
|
|
279403
279300
|
"drill"
|
|
279404
279301
|
]);
|
|
279405
279302
|
expectTypesMatch3(true);
|
|
279406
|
-
var asset2 =
|
|
279407
|
-
project_relative_path:
|
|
279408
|
-
url:
|
|
279409
|
-
mimetype:
|
|
279303
|
+
var asset2 = z83.object({
|
|
279304
|
+
project_relative_path: z83.string(),
|
|
279305
|
+
url: z83.string(),
|
|
279306
|
+
mimetype: z83.string()
|
|
279410
279307
|
});
|
|
279411
279308
|
expectTypesMatch3(true);
|
|
279412
279309
|
var kicadAt3 = point11.extend({
|
|
@@ -279477,29 +279374,29 @@ var kicadFootprintMetadata3 = z94.object({
|
|
|
279477
279374
|
model: kicadFootprintModel3.optional()
|
|
279478
279375
|
});
|
|
279479
279376
|
expectTypesMatch3(true);
|
|
279480
|
-
var kicadSymbolPinNumbers3 =
|
|
279481
|
-
hide:
|
|
279377
|
+
var kicadSymbolPinNumbers3 = z103.object({
|
|
279378
|
+
hide: z103.boolean().optional()
|
|
279482
279379
|
});
|
|
279483
279380
|
expectTypesMatch3(true);
|
|
279484
|
-
var kicadSymbolPinNames3 =
|
|
279381
|
+
var kicadSymbolPinNames3 = z103.object({
|
|
279485
279382
|
offset: distance51.optional(),
|
|
279486
|
-
hide:
|
|
279383
|
+
hide: z103.boolean().optional()
|
|
279487
279384
|
});
|
|
279488
279385
|
expectTypesMatch3(true);
|
|
279489
|
-
var kicadSymbolEffects3 =
|
|
279386
|
+
var kicadSymbolEffects3 = z103.object({
|
|
279490
279387
|
font: kicadFont3.optional(),
|
|
279491
|
-
justify:
|
|
279492
|
-
hide:
|
|
279388
|
+
justify: z103.union([z103.string(), z103.array(z103.string())]).optional(),
|
|
279389
|
+
hide: z103.boolean().optional()
|
|
279493
279390
|
});
|
|
279494
279391
|
expectTypesMatch3(true);
|
|
279495
|
-
var kicadSymbolProperty3 =
|
|
279496
|
-
value:
|
|
279497
|
-
id:
|
|
279392
|
+
var kicadSymbolProperty3 = z103.object({
|
|
279393
|
+
value: z103.string(),
|
|
279394
|
+
id: z103.union([z103.number(), z103.string()]).optional(),
|
|
279498
279395
|
at: kicadAt3.optional(),
|
|
279499
279396
|
effects: kicadSymbolEffects3.optional()
|
|
279500
279397
|
});
|
|
279501
279398
|
expectTypesMatch3(true);
|
|
279502
|
-
var kicadSymbolProperties3 =
|
|
279399
|
+
var kicadSymbolProperties3 = z103.object({
|
|
279503
279400
|
Reference: kicadSymbolProperty3.optional(),
|
|
279504
279401
|
Value: kicadSymbolProperty3.optional(),
|
|
279505
279402
|
Footprint: kicadSymbolProperty3.optional(),
|
|
@@ -279509,16 +279406,16 @@ var kicadSymbolProperties3 = z104.object({
|
|
|
279509
279406
|
ki_fp_filters: kicadSymbolProperty3.optional()
|
|
279510
279407
|
});
|
|
279511
279408
|
expectTypesMatch3(true);
|
|
279512
|
-
var kicadSymbolMetadata3 =
|
|
279513
|
-
symbolName:
|
|
279514
|
-
extends:
|
|
279409
|
+
var kicadSymbolMetadata3 = z103.object({
|
|
279410
|
+
symbolName: z103.string().optional(),
|
|
279411
|
+
extends: z103.string().optional(),
|
|
279515
279412
|
pinNumbers: kicadSymbolPinNumbers3.optional(),
|
|
279516
279413
|
pinNames: kicadSymbolPinNames3.optional(),
|
|
279517
|
-
excludeFromSim:
|
|
279518
|
-
inBom:
|
|
279519
|
-
onBoard:
|
|
279414
|
+
excludeFromSim: z103.boolean().optional(),
|
|
279415
|
+
inBom: z103.boolean().optional(),
|
|
279416
|
+
onBoard: z103.boolean().optional(),
|
|
279520
279417
|
properties: kicadSymbolProperties3.optional(),
|
|
279521
|
-
embeddedFonts:
|
|
279418
|
+
embeddedFonts: z103.boolean().optional()
|
|
279522
279419
|
});
|
|
279523
279420
|
expectTypesMatch3(true);
|
|
279524
279421
|
var base_circuit_json_error2 = z113.object({
|
|
@@ -280330,19 +280227,19 @@ var schematic_manual_edit_conflict_warning3 = z832.object({
|
|
|
280330
280227
|
source_component_id: z832.string()
|
|
280331
280228
|
}).describe("Warning emitted when a component has both manual placement and explicit schX/schY coordinates");
|
|
280332
280229
|
expectTypesMatch3(true);
|
|
280333
|
-
var schematic_group2 =
|
|
280334
|
-
type:
|
|
280230
|
+
var schematic_group2 = z84.object({
|
|
280231
|
+
type: z84.literal("schematic_group"),
|
|
280335
280232
|
schematic_group_id: getZodPrefixedIdWithDefault2("schematic_group"),
|
|
280336
|
-
source_group_id:
|
|
280337
|
-
is_subcircuit:
|
|
280338
|
-
subcircuit_id:
|
|
280233
|
+
source_group_id: z84.string(),
|
|
280234
|
+
is_subcircuit: z84.boolean().optional(),
|
|
280235
|
+
subcircuit_id: z84.string().optional(),
|
|
280339
280236
|
width: length69,
|
|
280340
280237
|
height: length69,
|
|
280341
280238
|
center: point11,
|
|
280342
|
-
schematic_component_ids:
|
|
280343
|
-
show_as_schematic_box:
|
|
280344
|
-
name:
|
|
280345
|
-
description:
|
|
280239
|
+
schematic_component_ids: z84.array(z84.string()),
|
|
280240
|
+
show_as_schematic_box: z84.boolean().optional(),
|
|
280241
|
+
name: z84.string().optional(),
|
|
280242
|
+
description: z84.string().optional()
|
|
280346
280243
|
}).describe("Defines a group of components on the schematic");
|
|
280347
280244
|
expectTypesMatch3(true);
|
|
280348
280245
|
var schematic_table2 = z85.object({
|
|
@@ -281021,23 +280918,23 @@ var pcb_net2 = z1032.object({
|
|
|
281021
280918
|
highlight_color: z1032.string().optional()
|
|
281022
280919
|
}).describe("Defines a net on the PCB");
|
|
281023
280920
|
expectTypesMatch3(true);
|
|
281024
|
-
var pcb_via2 =
|
|
281025
|
-
type:
|
|
280921
|
+
var pcb_via2 = z104.object({
|
|
280922
|
+
type: z104.literal("pcb_via"),
|
|
281026
280923
|
pcb_via_id: getZodPrefixedIdWithDefault2("pcb_via"),
|
|
281027
|
-
pcb_group_id:
|
|
281028
|
-
subcircuit_id:
|
|
281029
|
-
subcircuit_connectivity_map_key:
|
|
280924
|
+
pcb_group_id: z104.string().optional(),
|
|
280925
|
+
subcircuit_id: z104.string().optional(),
|
|
280926
|
+
subcircuit_connectivity_map_key: z104.string().optional(),
|
|
281030
280927
|
x: distance51,
|
|
281031
280928
|
y: distance51,
|
|
281032
280929
|
outer_diameter: distance51.default("0.6mm"),
|
|
281033
280930
|
hole_diameter: distance51.default("0.25mm"),
|
|
281034
280931
|
from_layer: layer_ref3.optional(),
|
|
281035
280932
|
to_layer: layer_ref3.optional(),
|
|
281036
|
-
layers:
|
|
281037
|
-
pcb_trace_id:
|
|
281038
|
-
net_is_assignable:
|
|
281039
|
-
net_assigned:
|
|
281040
|
-
is_tented:
|
|
280933
|
+
layers: z104.array(layer_ref3),
|
|
280934
|
+
pcb_trace_id: z104.string().optional(),
|
|
280935
|
+
net_is_assignable: z104.boolean().optional(),
|
|
280936
|
+
net_assigned: z104.boolean().optional(),
|
|
280937
|
+
is_tented: z104.boolean().optional()
|
|
281041
280938
|
}).describe("Defines a via on the PCB");
|
|
281042
280939
|
expectTypesMatch3(true);
|
|
281043
280940
|
var pcb_board2 = z105.object({
|
|
@@ -288585,317 +288482,17 @@ Fuse2.use = function(...plugins) {
|
|
|
288585
288482
|
plugins.forEach((plugin) => register2(plugin));
|
|
288586
288483
|
};
|
|
288587
288484
|
var entry_default = Fuse2;
|
|
288588
|
-
// node_modules/@tscircuit/ti-parts-engine/lib/kicad-archive/readKicadArchive.ts
|
|
288589
|
-
var import_jszip6 = __toESM2(require_lib4(), 1);
|
|
288590
|
-
// node_modules/@tscircuit/ti-parts-engine/lib/kicad-archive/readFirstKicadLibraryFilesFromArchive.ts
|
|
288591
|
-
var import_jszip7 = __toESM2(require_lib4(), 1);
|
|
288592
|
-
// node_modules/@tscircuit/ti-parts-engine/lib/kicad-archive/readFirstKicadModFromArchive.ts
|
|
288593
|
-
var import_jszip8 = __toESM2(require_lib4(), 1);
|
|
288594
|
-
// node_modules/@tscircuit/ti-parts-engine/lib/ultra-librarian-bridge-client/normalizeBaseUrl.ts
|
|
288595
|
-
function normalizeBaseUrl(baseUrl) {
|
|
288596
|
-
return baseUrl.replace(/\/+$/, "");
|
|
288597
|
-
}
|
|
288598
|
-
|
|
288599
|
-
// node_modules/@tscircuit/ti-parts-engine/lib/ultra-librarian-bridge-client/types.ts
|
|
288600
|
-
var DEFAULT_BASE_URL = "https://ti-api-cors-proxy.seve.workers.dev/";
|
|
288601
|
-
var DEFAULT_KICAD_VERSION = 6;
|
|
288602
|
-
|
|
288603
|
-
// node_modules/@tscircuit/ti-parts-engine/lib/ultra-librarian-bridge-client/paths.ts
|
|
288604
|
-
function buildSearchPath(request) {
|
|
288605
|
-
const query = requireNonEmptyString("query", request.query);
|
|
288606
|
-
const exactOnly = request.exactOnly ?? true;
|
|
288607
|
-
const limit = request.limit ?? 1;
|
|
288608
|
-
assertPositiveInteger("limit", limit);
|
|
288609
|
-
const params2 = new URLSearchParams({
|
|
288610
|
-
q: query,
|
|
288611
|
-
exact_only: String(exactOnly),
|
|
288612
|
-
limit: String(limit)
|
|
288613
|
-
});
|
|
288614
|
-
return `/v1/parts/search?${params2.toString()}`;
|
|
288615
|
-
}
|
|
288616
|
-
function buildKicadExportPath(request) {
|
|
288617
|
-
const mpn = requireNonEmptyString("mpn", request.mpn);
|
|
288618
|
-
const version3 = request.version ?? DEFAULT_KICAD_VERSION;
|
|
288619
|
-
assertPositiveInteger("version", version3);
|
|
288620
|
-
const params2 = new URLSearchParams({
|
|
288621
|
-
mpn,
|
|
288622
|
-
version: String(version3)
|
|
288623
|
-
});
|
|
288624
|
-
return `/v1/export/kicad?${params2.toString()}`;
|
|
288625
|
-
}
|
|
288626
|
-
function requireNonEmptyString(name, value) {
|
|
288627
|
-
const trimmedValue = value.trim();
|
|
288628
|
-
if (trimmedValue.length === 0) {
|
|
288629
|
-
throw new Error(`${name} is required.`);
|
|
288630
|
-
}
|
|
288631
|
-
return trimmedValue;
|
|
288632
|
-
}
|
|
288633
|
-
function assertPositiveInteger(name, value) {
|
|
288634
|
-
if (!Number.isInteger(value) || value < 1) {
|
|
288635
|
-
throw new Error(`${name} must be a positive integer.`);
|
|
288636
|
-
}
|
|
288637
|
-
}
|
|
288638
|
-
|
|
288639
|
-
// node_modules/@tscircuit/ti-parts-engine/lib/ultra-librarian-bridge-client/createDefaultBridgeFetch.ts
|
|
288640
|
-
var createDefaultBridgeFetch = () => {
|
|
288641
|
-
return async (input, init2) => {
|
|
288642
|
-
const targetUrl = input.toString();
|
|
288643
|
-
const proxyEndpointUrl = getTscircuitProxyEndpointUrl(targetUrl);
|
|
288644
|
-
if (!proxyEndpointUrl) {
|
|
288645
|
-
return globalThis.fetch(input, init2);
|
|
288646
|
-
}
|
|
288647
|
-
const headers = new Headers(init2?.headers);
|
|
288648
|
-
headers.set("X-Target-Url", targetUrl);
|
|
288649
|
-
const targetOrigin = safeGetOrigin(targetUrl);
|
|
288650
|
-
if (targetOrigin) {
|
|
288651
|
-
headers.set("X-Sender-Origin", targetOrigin);
|
|
288652
|
-
}
|
|
288653
|
-
return globalThis.fetch(proxyEndpointUrl, {
|
|
288654
|
-
...init2,
|
|
288655
|
-
headers
|
|
288656
|
-
});
|
|
288657
|
-
};
|
|
288658
|
-
};
|
|
288659
|
-
function getTscircuitProxyEndpointUrl(targetUrl) {
|
|
288660
|
-
if (typeof window === "undefined" || !window.location) {
|
|
288661
|
-
return null;
|
|
288662
|
-
}
|
|
288663
|
-
const targetOrigin = safeGetOrigin(targetUrl);
|
|
288664
|
-
const currentOrigin = window.location.origin;
|
|
288665
|
-
if (!targetOrigin || targetOrigin === currentOrigin) {
|
|
288666
|
-
return null;
|
|
288667
|
-
}
|
|
288668
|
-
if (window.TSCIRCUIT_FILESERVER_API_BASE_URL) {
|
|
288669
|
-
return `${window.TSCIRCUIT_FILESERVER_API_BASE_URL.replace(/\/+$/, "")}/proxy`;
|
|
288670
|
-
}
|
|
288671
|
-
if (isLocalHttpOrigin(currentOrigin)) {
|
|
288672
|
-
return `${currentOrigin}/proxy`;
|
|
288673
|
-
}
|
|
288674
|
-
return null;
|
|
288675
|
-
}
|
|
288676
|
-
function safeGetOrigin(url2) {
|
|
288677
|
-
try {
|
|
288678
|
-
return new URL(url2).origin;
|
|
288679
|
-
} catch {
|
|
288680
|
-
return null;
|
|
288681
|
-
}
|
|
288682
|
-
}
|
|
288683
|
-
function isLocalHttpOrigin(origin) {
|
|
288684
|
-
try {
|
|
288685
|
-
const url2 = new URL(origin);
|
|
288686
|
-
return (url2.protocol === "http:" || url2.protocol === "https:") && (url2.hostname === "localhost" || url2.hostname === "127.0.0.1" || url2.hostname === "::1");
|
|
288687
|
-
} catch {
|
|
288688
|
-
return false;
|
|
288689
|
-
}
|
|
288690
|
-
}
|
|
288691
288485
|
|
|
288692
|
-
// node_modules/@tscircuit/ti-parts-engine/lib/ultra-librarian-bridge-client/requestArchive.ts
|
|
288693
|
-
async function requestArchive(options) {
|
|
288694
|
-
const url2 = buildRequestUrl(options.baseUrl, options.path);
|
|
288695
|
-
logRequest(options.logger, url2);
|
|
288696
|
-
const response = await options.fetchImpl(url2, {
|
|
288697
|
-
headers: createBridgeHeaders(options.partnerToken, "application/zip"),
|
|
288698
|
-
redirect: "follow"
|
|
288699
|
-
});
|
|
288700
|
-
if (!response.ok) {
|
|
288701
|
-
throw new Error(`KiCad export failed with ${response.status} ${response.statusText}: ${await readErrorBody(response)}`);
|
|
288702
|
-
}
|
|
288703
|
-
const contentType = response.headers.get("content-type") ?? "unknown";
|
|
288704
|
-
if (!contentType.includes("application/zip") && !contentType.includes("application/octet-stream")) {
|
|
288705
|
-
throw new Error(`Expected application/zip but received ${contentType}.`);
|
|
288706
|
-
}
|
|
288707
|
-
return {
|
|
288708
|
-
archiveBuffer: await response.arrayBuffer(),
|
|
288709
|
-
contentType
|
|
288710
|
-
};
|
|
288711
|
-
}
|
|
288712
|
-
function createBridgeHeaders(partnerToken, accept) {
|
|
288713
|
-
const headers = {
|
|
288714
|
-
Accept: accept
|
|
288715
|
-
};
|
|
288716
|
-
if (partnerToken) {
|
|
288717
|
-
headers.Authorization = `Bearer ${partnerToken}`;
|
|
288718
|
-
}
|
|
288719
|
-
return headers;
|
|
288720
|
-
}
|
|
288721
|
-
function buildRequestUrl(baseUrl, path68) {
|
|
288722
|
-
return `${normalizeBaseUrl(baseUrl)}${path68}`;
|
|
288723
|
-
}
|
|
288724
|
-
function logRequest(logger, url2) {
|
|
288725
|
-
if (!logger)
|
|
288726
|
-
return;
|
|
288727
|
-
const requestUrl = new URL(url2);
|
|
288728
|
-
logger.log(`GET ${requestUrl.pathname}${requestUrl.search}`);
|
|
288729
|
-
}
|
|
288730
|
-
async function readErrorBody(response) {
|
|
288731
|
-
const bodyText = (await response.text()).trim();
|
|
288732
|
-
return bodyText.length > 0 ? bodyText : "<empty response body>";
|
|
288733
|
-
}
|
|
288734
|
-
|
|
288735
|
-
// node_modules/@tscircuit/ti-parts-engine/lib/ultra-librarian-bridge-client/requestJson.ts
|
|
288736
|
-
async function requestJson(options) {
|
|
288737
|
-
const url2 = buildRequestUrl2(options.baseUrl, options.path);
|
|
288738
|
-
logRequest2(options.logger, url2);
|
|
288739
|
-
const response = await options.fetchImpl(url2, {
|
|
288740
|
-
headers: createBridgeHeaders2(options.partnerToken, "application/json")
|
|
288741
|
-
});
|
|
288742
|
-
if (!response.ok) {
|
|
288743
|
-
throw new Error(`Search request failed with ${response.status} ${response.statusText}: ${await readErrorBody2(response)}`);
|
|
288744
|
-
}
|
|
288745
|
-
return asJsonValue(await response.json());
|
|
288746
|
-
}
|
|
288747
|
-
function createBridgeHeaders2(partnerToken, accept) {
|
|
288748
|
-
const headers = {
|
|
288749
|
-
Accept: accept
|
|
288750
|
-
};
|
|
288751
|
-
if (partnerToken) {
|
|
288752
|
-
headers.Authorization = `Bearer ${partnerToken}`;
|
|
288753
|
-
}
|
|
288754
|
-
return headers;
|
|
288755
|
-
}
|
|
288756
|
-
function buildRequestUrl2(baseUrl, path68) {
|
|
288757
|
-
return `${normalizeBaseUrl(baseUrl)}${path68}`;
|
|
288758
|
-
}
|
|
288759
|
-
function logRequest2(logger, url2) {
|
|
288760
|
-
if (!logger)
|
|
288761
|
-
return;
|
|
288762
|
-
const requestUrl = new URL(url2);
|
|
288763
|
-
logger.log(`GET ${requestUrl.pathname}${requestUrl.search}`);
|
|
288764
|
-
}
|
|
288765
|
-
async function readErrorBody2(response) {
|
|
288766
|
-
const bodyText = (await response.text()).trim();
|
|
288767
|
-
return bodyText.length > 0 ? bodyText : "<empty response body>";
|
|
288768
|
-
}
|
|
288769
|
-
function asJsonValue(value) {
|
|
288770
|
-
return value;
|
|
288771
|
-
}
|
|
288772
|
-
|
|
288773
|
-
// node_modules/@tscircuit/ti-parts-engine/lib/ultra-librarian-bridge-client/search-response.ts
|
|
288774
|
-
function extractSearchResults(payload) {
|
|
288775
|
-
if (Array.isArray(payload)) {
|
|
288776
|
-
return payload.filter(isSearchPartResult);
|
|
288777
|
-
}
|
|
288778
|
-
if (!isJsonObject(payload)) {
|
|
288779
|
-
return [];
|
|
288780
|
-
}
|
|
288781
|
-
for (const key of ["results", "items", "parts", "data"]) {
|
|
288782
|
-
const value = payload[key];
|
|
288783
|
-
if (Array.isArray(value)) {
|
|
288784
|
-
return value.filter(isSearchPartResult);
|
|
288785
|
-
}
|
|
288786
|
-
}
|
|
288787
|
-
return [];
|
|
288788
|
-
}
|
|
288789
|
-
function isJsonObject(value) {
|
|
288790
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
288791
|
-
}
|
|
288792
|
-
function isSearchPartResult(value) {
|
|
288793
|
-
return isJsonObject(value);
|
|
288794
|
-
}
|
|
288795
|
-
|
|
288796
|
-
// node_modules/@tscircuit/ti-parts-engine/lib/ultra-librarian-bridge-client/createUltraLibrarianBridgeClient.ts
|
|
288797
|
-
function createUltraLibrarianBridgeClient(options = {}) {
|
|
288798
|
-
const partnerToken = normalizeOptionalString(options.partnerToken);
|
|
288799
|
-
const baseUrl = normalizeBaseUrl(options.baseUrl ?? DEFAULT_BASE_URL);
|
|
288800
|
-
const fetchImpl = options.fetch ?? createDefaultBridgeFetch();
|
|
288801
|
-
const logger = options.logger;
|
|
288802
|
-
return {
|
|
288803
|
-
baseUrl,
|
|
288804
|
-
async searchParts(request) {
|
|
288805
|
-
const path68 = buildSearchPath(request);
|
|
288806
|
-
const rawPayload = await requestJson({
|
|
288807
|
-
fetchImpl,
|
|
288808
|
-
baseUrl,
|
|
288809
|
-
path: path68,
|
|
288810
|
-
partnerToken,
|
|
288811
|
-
logger
|
|
288812
|
-
});
|
|
288813
|
-
return {
|
|
288814
|
-
rawPayload,
|
|
288815
|
-
results: extractSearchResults(rawPayload)
|
|
288816
|
-
};
|
|
288817
|
-
},
|
|
288818
|
-
async downloadKicadArchive(request) {
|
|
288819
|
-
const path68 = buildKicadExportPath(request);
|
|
288820
|
-
return await requestArchive({
|
|
288821
|
-
fetchImpl,
|
|
288822
|
-
baseUrl,
|
|
288823
|
-
path: path68,
|
|
288824
|
-
partnerToken,
|
|
288825
|
-
logger
|
|
288826
|
-
});
|
|
288827
|
-
}
|
|
288828
|
-
};
|
|
288829
|
-
}
|
|
288830
|
-
function normalizeOptionalString(value) {
|
|
288831
|
-
const trimmedValue = value?.trim();
|
|
288832
|
-
return trimmedValue ? trimmedValue : undefined;
|
|
288833
|
-
}
|
|
288834
|
-
// node_modules/@tscircuit/ti-parts-engine/lib/ti-parts-engine/TiPartsEngine.ts
|
|
288835
|
-
class TiPartsEngine {
|
|
288836
|
-
options;
|
|
288837
|
-
constructor(options = {}) {
|
|
288838
|
-
this.options = options;
|
|
288839
|
-
this.searchParts = this.searchParts.bind(this);
|
|
288840
|
-
this.downloadKicadArchive = this.downloadKicadArchive.bind(this);
|
|
288841
|
-
this.findPart = this.findPart.bind(this);
|
|
288842
|
-
}
|
|
288843
|
-
async findPart({ sourceComponent }) {
|
|
288844
|
-
const manufacturerPartNumber = getManufacturerPartNumber(sourceComponent);
|
|
288845
|
-
if (!manufacturerPartNumber) {
|
|
288846
|
-
return {};
|
|
288847
|
-
}
|
|
288848
|
-
const searchResponse = await this.searchParts({
|
|
288849
|
-
query: manufacturerPartNumber,
|
|
288850
|
-
exactOnly: true,
|
|
288851
|
-
limit: 1
|
|
288852
|
-
});
|
|
288853
|
-
const matchingPart = searchResponse.results[0];
|
|
288854
|
-
if (!matchingPart) {
|
|
288855
|
-
return {};
|
|
288856
|
-
}
|
|
288857
|
-
const resolvedPartNumber = matchingPart?.mpn ?? matchingPart?.manufacturer_part_number ?? matchingPart?.part_number ?? matchingPart?.gpn ?? manufacturerPartNumber;
|
|
288858
|
-
return {
|
|
288859
|
-
ti: [resolvedPartNumber]
|
|
288860
|
-
};
|
|
288861
|
-
}
|
|
288862
|
-
async searchParts(request) {
|
|
288863
|
-
return await this.createClient().searchParts(request);
|
|
288864
|
-
}
|
|
288865
|
-
async downloadKicadArchive(request) {
|
|
288866
|
-
return await this.createClient().downloadKicadArchive(request);
|
|
288867
|
-
}
|
|
288868
|
-
createClient() {
|
|
288869
|
-
return createUltraLibrarianBridgeClient(this.options);
|
|
288870
|
-
}
|
|
288871
|
-
}
|
|
288872
|
-
function getManufacturerPartNumber(sourceComponent) {
|
|
288873
|
-
if (!isRecord2(sourceComponent)) {
|
|
288874
|
-
return null;
|
|
288875
|
-
}
|
|
288876
|
-
const value = sourceComponent.manufacturer_part_number;
|
|
288877
|
-
return typeof value === "string" && value.trim() ? value : null;
|
|
288878
|
-
}
|
|
288879
|
-
function isRecord2(value) {
|
|
288880
|
-
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
288881
|
-
}
|
|
288882
|
-
// node_modules/@tscircuit/ti-parts-engine/lib/ti-parts-engine/createTiFootprintLibrary.ts
|
|
288883
|
-
import {
|
|
288884
|
-
KicadFootprintToCircuitJsonConverter as KicadFootprintToCircuitJsonConverter2,
|
|
288885
|
-
KicadSymbolToCircuitJsonConverter
|
|
288886
|
-
} from "kicad-to-circuit-json";
|
|
288887
288486
|
// cli/search/register.ts
|
|
288888
288487
|
var registerSearch = (program3) => {
|
|
288889
|
-
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("--
|
|
288488
|
+
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) => {
|
|
288890
288489
|
const query = getQueryFromParts(queryParts);
|
|
288891
|
-
const hasFilters = opts.kicad || opts.jlcpcb || opts.lcsc || opts.
|
|
288490
|
+
const hasFilters = opts.kicad || opts.jlcpcb || opts.lcsc || opts.tscircuit;
|
|
288892
288491
|
const searchKicad = opts.kicad;
|
|
288893
288492
|
const searchJlc = opts.jlcpcb || opts.lcsc || !hasFilters;
|
|
288894
|
-
const searchTi = opts.ti;
|
|
288895
288493
|
const searchTscircuit = opts.tscircuit;
|
|
288896
288494
|
let results = { packages: [] };
|
|
288897
288495
|
let jlcResults = [];
|
|
288898
|
-
let tiResults = [];
|
|
288899
288496
|
let kicadResults = [];
|
|
288900
288497
|
try {
|
|
288901
288498
|
if (searchTscircuit) {
|
|
@@ -288909,17 +288506,6 @@ var registerSearch = (program3) => {
|
|
|
288909
288506
|
const jlcResponse = await fetch(jlcSearchUrl).then((r4) => r4.json());
|
|
288910
288507
|
jlcResults = jlcResponse?.components ?? [];
|
|
288911
288508
|
}
|
|
288912
|
-
if (searchTi) {
|
|
288913
|
-
const tiPartsEngine = new TiPartsEngine({
|
|
288914
|
-
baseUrl: process.env.TSCIRCUIT_TI_API_BASE_URL
|
|
288915
|
-
});
|
|
288916
|
-
const tiResponse = await tiPartsEngine.searchParts({
|
|
288917
|
-
query,
|
|
288918
|
-
exactOnly: false,
|
|
288919
|
-
limit: 10
|
|
288920
|
-
});
|
|
288921
|
-
tiResults = tiResponse.results;
|
|
288922
|
-
}
|
|
288923
288509
|
if (searchKicad) {
|
|
288924
288510
|
const kicadFiles = await fetch("https://kicad-mod-cache.tscircuit.com/kicad_files.json").then((r4) => r4.json());
|
|
288925
288511
|
const fuse = new entry_default(kicadFiles);
|
|
@@ -288942,10 +288528,6 @@ var registerSearch = (program3) => {
|
|
|
288942
288528
|
...jlcResults.map((comp) => ({
|
|
288943
288529
|
source: "jlcpcb",
|
|
288944
288530
|
...comp
|
|
288945
|
-
})),
|
|
288946
|
-
...tiResults.map((part) => ({
|
|
288947
|
-
source: "ti",
|
|
288948
|
-
...part
|
|
288949
288531
|
}))
|
|
288950
288532
|
];
|
|
288951
288533
|
console.log(JSON.stringify({
|
|
@@ -288954,11 +288536,10 @@ var registerSearch = (program3) => {
|
|
|
288954
288536
|
}, null, 2));
|
|
288955
288537
|
return;
|
|
288956
288538
|
}
|
|
288957
|
-
if (!kicadResults.length && !results.packages.length && !jlcResults.length
|
|
288539
|
+
if (!kicadResults.length && !results.packages.length && !jlcResults.length) {
|
|
288958
288540
|
const sources = [
|
|
288959
288541
|
searchTscircuit && "tscircuit registry",
|
|
288960
288542
|
searchJlc && "JLCPCB",
|
|
288961
|
-
searchTi && "Texas Instruments",
|
|
288962
288543
|
searchKicad && "KiCad"
|
|
288963
288544
|
].filter(Boolean);
|
|
288964
288545
|
console.log(kleur_default.yellow(`No results found for "${query}" in ${sources.join(", ")}.`));
|
|
@@ -288985,19 +288566,6 @@ var registerSearch = (program3) => {
|
|
|
288985
288566
|
console.log(`${idx + 1}. ${comp.mfr} (C${comp.lcsc}) - ${comp.description} (stock: ${comp.stock.toLocaleString("en-US")})`);
|
|
288986
288567
|
});
|
|
288987
288568
|
}
|
|
288988
|
-
if (tiResults.length) {
|
|
288989
|
-
console.log(kleur_default.bold().underline(`Found ${tiResults.length} component(s) from Texas Instruments:`));
|
|
288990
|
-
tiResults.forEach((part, idx) => {
|
|
288991
|
-
const mpn = part.mpn ?? part.manufacturer_part_number ?? part.name ?? "?";
|
|
288992
|
-
const assets = [
|
|
288993
|
-
part.symbol_available === true && "symbol",
|
|
288994
|
-
part.footprint_available === true && "footprint",
|
|
288995
|
-
part.threed_available === true && "3D model"
|
|
288996
|
-
].filter(Boolean);
|
|
288997
|
-
const assetStr = assets.length ? ` - ${assets.join(", ")} available` : "";
|
|
288998
|
-
console.log(`${idx + 1}. ${mpn}${assetStr}`);
|
|
288999
|
-
});
|
|
289000
|
-
}
|
|
289001
288569
|
console.log(`
|
|
289002
288570
|
`);
|
|
289003
288571
|
});
|