@tscircuit/cli 0.1.1565 → 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 +258 -679
- package/dist/lib/index.js +245 -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
|
|
|
@@ -263108,6 +263005,17 @@ var createHttpServer = async ({
|
|
|
263108
263005
|
return;
|
|
263109
263006
|
} catch {}
|
|
263110
263007
|
}
|
|
263008
|
+
const globalStandalonePath = process.env.TSCIRCUIT_GLOBAL_STANDALONE_FILE_PATH;
|
|
263009
|
+
if (globalStandalonePath) {
|
|
263010
|
+
try {
|
|
263011
|
+
const content = fs50.readFileSync(globalStandalonePath, "utf8");
|
|
263012
|
+
res2.writeHead(200, {
|
|
263013
|
+
"Content-Type": "application/javascript; charset=utf-8"
|
|
263014
|
+
});
|
|
263015
|
+
res2.end(content);
|
|
263016
|
+
return;
|
|
263017
|
+
} catch {}
|
|
263018
|
+
}
|
|
263111
263019
|
res2.writeHead(200, {
|
|
263112
263020
|
"Content-Type": "application/javascript; charset=utf-8"
|
|
263113
263021
|
});
|
|
@@ -265429,9 +265337,9 @@ import { z as z43 } from "zod";
|
|
|
265429
265337
|
import { z as z53 } from "zod";
|
|
265430
265338
|
import { z as z63 } from "zod";
|
|
265431
265339
|
import { z as z73 } from "zod";
|
|
265432
|
-
import { z as
|
|
265340
|
+
import { z as z82 } from "zod";
|
|
265433
265341
|
import { z as z93 } from "zod";
|
|
265434
|
-
import { z as
|
|
265342
|
+
import { z as z102 } from "zod";
|
|
265435
265343
|
import { z as z112 } from "zod";
|
|
265436
265344
|
import { z as z122 } from "zod";
|
|
265437
265345
|
import { z as z132 } from "zod";
|
|
@@ -265546,8 +265454,8 @@ var M15 = defineExcellonDrillCommand({
|
|
|
265546
265454
|
});
|
|
265547
265455
|
var M16 = defineExcellonDrillCommand({
|
|
265548
265456
|
command_code: "M16",
|
|
265549
|
-
schema:
|
|
265550
|
-
command_code:
|
|
265457
|
+
schema: z82.object({
|
|
265458
|
+
command_code: z82.literal("M16").default("M16")
|
|
265551
265459
|
}),
|
|
265552
265460
|
stringify: () => "M16"
|
|
265553
265461
|
});
|
|
@@ -265560,8 +265468,8 @@ var M30 = defineExcellonDrillCommand({
|
|
|
265560
265468
|
});
|
|
265561
265469
|
var M48 = defineExcellonDrillCommand({
|
|
265562
265470
|
command_code: "M48",
|
|
265563
|
-
schema:
|
|
265564
|
-
command_code:
|
|
265471
|
+
schema: z102.object({
|
|
265472
|
+
command_code: z102.literal("M48").default("M48")
|
|
265565
265473
|
}),
|
|
265566
265474
|
stringify: () => "M48"
|
|
265567
265475
|
});
|
|
@@ -268391,8 +268299,8 @@ __export4(external_exports2, {
|
|
|
268391
268299
|
ZodDiscriminatedUnion: () => ZodDiscriminatedUnion2,
|
|
268392
268300
|
ZodEffects: () => ZodEffects2,
|
|
268393
268301
|
ZodEnum: () => ZodEnum2,
|
|
268394
|
-
ZodError: () =>
|
|
268395
|
-
ZodFirstPartyTypeKind: () =>
|
|
268302
|
+
ZodError: () => ZodError3,
|
|
268303
|
+
ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind3,
|
|
268396
268304
|
ZodFunction: () => ZodFunction2,
|
|
268397
268305
|
ZodIntersection: () => ZodIntersection2,
|
|
268398
268306
|
ZodIssueCode: () => ZodIssueCode2,
|
|
@@ -268631,7 +268539,7 @@ var quotelessJson2 = (obj) => {
|
|
|
268631
268539
|
const json2 = JSON.stringify(obj, null, 2);
|
|
268632
268540
|
return json2.replace(/"([^"]+)":/g, "$1:");
|
|
268633
268541
|
};
|
|
268634
|
-
var
|
|
268542
|
+
var ZodError3 = class _ZodError2 extends Error {
|
|
268635
268543
|
get errors() {
|
|
268636
268544
|
return this.issues;
|
|
268637
268545
|
}
|
|
@@ -268721,8 +268629,8 @@ var ZodError4 = class _ZodError2 extends Error {
|
|
|
268721
268629
|
return this.flatten();
|
|
268722
268630
|
}
|
|
268723
268631
|
};
|
|
268724
|
-
|
|
268725
|
-
const error2 = new
|
|
268632
|
+
ZodError3.create = (issues) => {
|
|
268633
|
+
const error2 = new ZodError3(issues);
|
|
268726
268634
|
return error2;
|
|
268727
268635
|
};
|
|
268728
268636
|
var errorMap2 = (issue, _ctx) => {
|
|
@@ -268973,7 +268881,7 @@ var handleResult2 = (ctx, result) => {
|
|
|
268973
268881
|
get error() {
|
|
268974
268882
|
if (this._error)
|
|
268975
268883
|
return this._error;
|
|
268976
|
-
const error2 = new
|
|
268884
|
+
const error2 = new ZodError3(ctx.common.issues);
|
|
268977
268885
|
this._error = error2;
|
|
268978
268886
|
return this._error;
|
|
268979
268887
|
}
|
|
@@ -269172,7 +269080,7 @@ var ZodType2 = class {
|
|
|
269172
269080
|
_refinement(refinement) {
|
|
269173
269081
|
return new ZodEffects2({
|
|
269174
269082
|
schema: this,
|
|
269175
|
-
typeName:
|
|
269083
|
+
typeName: ZodFirstPartyTypeKind3.ZodEffects,
|
|
269176
269084
|
effect: { type: "refinement", refinement }
|
|
269177
269085
|
});
|
|
269178
269086
|
}
|
|
@@ -269237,7 +269145,7 @@ var ZodType2 = class {
|
|
|
269237
269145
|
return new ZodEffects2({
|
|
269238
269146
|
...processCreateParams2(this._def),
|
|
269239
269147
|
schema: this,
|
|
269240
|
-
typeName:
|
|
269148
|
+
typeName: ZodFirstPartyTypeKind3.ZodEffects,
|
|
269241
269149
|
effect: { type: "transform", transform: transform2 }
|
|
269242
269150
|
});
|
|
269243
269151
|
}
|
|
@@ -269247,12 +269155,12 @@ var ZodType2 = class {
|
|
|
269247
269155
|
...processCreateParams2(this._def),
|
|
269248
269156
|
innerType: this,
|
|
269249
269157
|
defaultValue: defaultValueFunc,
|
|
269250
|
-
typeName:
|
|
269158
|
+
typeName: ZodFirstPartyTypeKind3.ZodDefault
|
|
269251
269159
|
});
|
|
269252
269160
|
}
|
|
269253
269161
|
brand() {
|
|
269254
269162
|
return new ZodBranded2({
|
|
269255
|
-
typeName:
|
|
269163
|
+
typeName: ZodFirstPartyTypeKind3.ZodBranded,
|
|
269256
269164
|
type: this,
|
|
269257
269165
|
...processCreateParams2(this._def)
|
|
269258
269166
|
});
|
|
@@ -269263,7 +269171,7 @@ var ZodType2 = class {
|
|
|
269263
269171
|
...processCreateParams2(this._def),
|
|
269264
269172
|
innerType: this,
|
|
269265
269173
|
catchValue: catchValueFunc,
|
|
269266
|
-
typeName:
|
|
269174
|
+
typeName: ZodFirstPartyTypeKind3.ZodCatch
|
|
269267
269175
|
});
|
|
269268
269176
|
}
|
|
269269
269177
|
describe(description) {
|
|
@@ -269904,7 +269812,7 @@ var ZodString2 = class _ZodString2 extends ZodType2 {
|
|
|
269904
269812
|
ZodString2.create = (params2) => {
|
|
269905
269813
|
return new ZodString2({
|
|
269906
269814
|
checks: [],
|
|
269907
|
-
typeName:
|
|
269815
|
+
typeName: ZodFirstPartyTypeKind3.ZodString,
|
|
269908
269816
|
coerce: params2?.coerce ?? false,
|
|
269909
269817
|
...processCreateParams2(params2)
|
|
269910
269818
|
});
|
|
@@ -270144,7 +270052,7 @@ var ZodNumber2 = class _ZodNumber2 extends ZodType2 {
|
|
|
270144
270052
|
ZodNumber2.create = (params2) => {
|
|
270145
270053
|
return new ZodNumber2({
|
|
270146
270054
|
checks: [],
|
|
270147
|
-
typeName:
|
|
270055
|
+
typeName: ZodFirstPartyTypeKind3.ZodNumber,
|
|
270148
270056
|
coerce: params2?.coerce || false,
|
|
270149
270057
|
...processCreateParams2(params2)
|
|
270150
270058
|
});
|
|
@@ -270316,7 +270224,7 @@ var ZodBigInt2 = class _ZodBigInt2 extends ZodType2 {
|
|
|
270316
270224
|
ZodBigInt2.create = (params2) => {
|
|
270317
270225
|
return new ZodBigInt2({
|
|
270318
270226
|
checks: [],
|
|
270319
|
-
typeName:
|
|
270227
|
+
typeName: ZodFirstPartyTypeKind3.ZodBigInt,
|
|
270320
270228
|
coerce: params2?.coerce ?? false,
|
|
270321
270229
|
...processCreateParams2(params2)
|
|
270322
270230
|
});
|
|
@@ -270341,7 +270249,7 @@ var ZodBoolean2 = class extends ZodType2 {
|
|
|
270341
270249
|
};
|
|
270342
270250
|
ZodBoolean2.create = (params2) => {
|
|
270343
270251
|
return new ZodBoolean2({
|
|
270344
|
-
typeName:
|
|
270252
|
+
typeName: ZodFirstPartyTypeKind3.ZodBoolean,
|
|
270345
270253
|
coerce: params2?.coerce || false,
|
|
270346
270254
|
...processCreateParams2(params2)
|
|
270347
270255
|
});
|
|
@@ -270451,7 +270359,7 @@ ZodDate2.create = (params2) => {
|
|
|
270451
270359
|
return new ZodDate2({
|
|
270452
270360
|
checks: [],
|
|
270453
270361
|
coerce: params2?.coerce || false,
|
|
270454
|
-
typeName:
|
|
270362
|
+
typeName: ZodFirstPartyTypeKind3.ZodDate,
|
|
270455
270363
|
...processCreateParams2(params2)
|
|
270456
270364
|
});
|
|
270457
270365
|
};
|
|
@@ -270472,7 +270380,7 @@ var ZodSymbol2 = class extends ZodType2 {
|
|
|
270472
270380
|
};
|
|
270473
270381
|
ZodSymbol2.create = (params2) => {
|
|
270474
270382
|
return new ZodSymbol2({
|
|
270475
|
-
typeName:
|
|
270383
|
+
typeName: ZodFirstPartyTypeKind3.ZodSymbol,
|
|
270476
270384
|
...processCreateParams2(params2)
|
|
270477
270385
|
});
|
|
270478
270386
|
};
|
|
@@ -270493,7 +270401,7 @@ var ZodUndefined2 = class extends ZodType2 {
|
|
|
270493
270401
|
};
|
|
270494
270402
|
ZodUndefined2.create = (params2) => {
|
|
270495
270403
|
return new ZodUndefined2({
|
|
270496
|
-
typeName:
|
|
270404
|
+
typeName: ZodFirstPartyTypeKind3.ZodUndefined,
|
|
270497
270405
|
...processCreateParams2(params2)
|
|
270498
270406
|
});
|
|
270499
270407
|
};
|
|
@@ -270514,7 +270422,7 @@ var ZodNull2 = class extends ZodType2 {
|
|
|
270514
270422
|
};
|
|
270515
270423
|
ZodNull2.create = (params2) => {
|
|
270516
270424
|
return new ZodNull2({
|
|
270517
|
-
typeName:
|
|
270425
|
+
typeName: ZodFirstPartyTypeKind3.ZodNull,
|
|
270518
270426
|
...processCreateParams2(params2)
|
|
270519
270427
|
});
|
|
270520
270428
|
};
|
|
@@ -270529,7 +270437,7 @@ var ZodAny2 = class extends ZodType2 {
|
|
|
270529
270437
|
};
|
|
270530
270438
|
ZodAny2.create = (params2) => {
|
|
270531
270439
|
return new ZodAny2({
|
|
270532
|
-
typeName:
|
|
270440
|
+
typeName: ZodFirstPartyTypeKind3.ZodAny,
|
|
270533
270441
|
...processCreateParams2(params2)
|
|
270534
270442
|
});
|
|
270535
270443
|
};
|
|
@@ -270544,7 +270452,7 @@ var ZodUnknown2 = class extends ZodType2 {
|
|
|
270544
270452
|
};
|
|
270545
270453
|
ZodUnknown2.create = (params2) => {
|
|
270546
270454
|
return new ZodUnknown2({
|
|
270547
|
-
typeName:
|
|
270455
|
+
typeName: ZodFirstPartyTypeKind3.ZodUnknown,
|
|
270548
270456
|
...processCreateParams2(params2)
|
|
270549
270457
|
});
|
|
270550
270458
|
};
|
|
@@ -270561,7 +270469,7 @@ var ZodNever2 = class extends ZodType2 {
|
|
|
270561
270469
|
};
|
|
270562
270470
|
ZodNever2.create = (params2) => {
|
|
270563
270471
|
return new ZodNever2({
|
|
270564
|
-
typeName:
|
|
270472
|
+
typeName: ZodFirstPartyTypeKind3.ZodNever,
|
|
270565
270473
|
...processCreateParams2(params2)
|
|
270566
270474
|
});
|
|
270567
270475
|
};
|
|
@@ -270582,7 +270490,7 @@ var ZodVoid2 = class extends ZodType2 {
|
|
|
270582
270490
|
};
|
|
270583
270491
|
ZodVoid2.create = (params2) => {
|
|
270584
270492
|
return new ZodVoid2({
|
|
270585
|
-
typeName:
|
|
270493
|
+
typeName: ZodFirstPartyTypeKind3.ZodVoid,
|
|
270586
270494
|
...processCreateParams2(params2)
|
|
270587
270495
|
});
|
|
270588
270496
|
};
|
|
@@ -270683,7 +270591,7 @@ ZodArray2.create = (schema, params2) => {
|
|
|
270683
270591
|
minLength: null,
|
|
270684
270592
|
maxLength: null,
|
|
270685
270593
|
exactLength: null,
|
|
270686
|
-
typeName:
|
|
270594
|
+
typeName: ZodFirstPartyTypeKind3.ZodArray,
|
|
270687
270595
|
...processCreateParams2(params2)
|
|
270688
270596
|
});
|
|
270689
270597
|
};
|
|
@@ -270861,7 +270769,7 @@ var ZodObject2 = class _ZodObject2 extends ZodType2 {
|
|
|
270861
270769
|
...this._def.shape(),
|
|
270862
270770
|
...merging._def.shape()
|
|
270863
270771
|
}),
|
|
270864
|
-
typeName:
|
|
270772
|
+
typeName: ZodFirstPartyTypeKind3.ZodObject
|
|
270865
270773
|
});
|
|
270866
270774
|
return merged;
|
|
270867
270775
|
}
|
|
@@ -270944,7 +270852,7 @@ ZodObject2.create = (shape, params2) => {
|
|
|
270944
270852
|
shape: () => shape,
|
|
270945
270853
|
unknownKeys: "strip",
|
|
270946
270854
|
catchall: ZodNever2.create(),
|
|
270947
|
-
typeName:
|
|
270855
|
+
typeName: ZodFirstPartyTypeKind3.ZodObject,
|
|
270948
270856
|
...processCreateParams2(params2)
|
|
270949
270857
|
});
|
|
270950
270858
|
};
|
|
@@ -270953,7 +270861,7 @@ ZodObject2.strictCreate = (shape, params2) => {
|
|
|
270953
270861
|
shape: () => shape,
|
|
270954
270862
|
unknownKeys: "strict",
|
|
270955
270863
|
catchall: ZodNever2.create(),
|
|
270956
|
-
typeName:
|
|
270864
|
+
typeName: ZodFirstPartyTypeKind3.ZodObject,
|
|
270957
270865
|
...processCreateParams2(params2)
|
|
270958
270866
|
});
|
|
270959
270867
|
};
|
|
@@ -270962,7 +270870,7 @@ ZodObject2.lazycreate = (shape, params2) => {
|
|
|
270962
270870
|
shape,
|
|
270963
270871
|
unknownKeys: "strip",
|
|
270964
270872
|
catchall: ZodNever2.create(),
|
|
270965
|
-
typeName:
|
|
270873
|
+
typeName: ZodFirstPartyTypeKind3.ZodObject,
|
|
270966
270874
|
...processCreateParams2(params2)
|
|
270967
270875
|
});
|
|
270968
270876
|
};
|
|
@@ -270982,7 +270890,7 @@ var ZodUnion2 = class extends ZodType2 {
|
|
|
270982
270890
|
return result.result;
|
|
270983
270891
|
}
|
|
270984
270892
|
}
|
|
270985
|
-
const unionErrors = results.map((result) => new
|
|
270893
|
+
const unionErrors = results.map((result) => new ZodError3(result.ctx.common.issues));
|
|
270986
270894
|
addIssueToContext2(ctx, {
|
|
270987
270895
|
code: ZodIssueCode2.invalid_union,
|
|
270988
270896
|
unionErrors
|
|
@@ -271038,7 +270946,7 @@ var ZodUnion2 = class extends ZodType2 {
|
|
|
271038
270946
|
ctx.common.issues.push(...dirty.ctx.common.issues);
|
|
271039
270947
|
return dirty.result;
|
|
271040
270948
|
}
|
|
271041
|
-
const unionErrors = issues.map((issues2) => new
|
|
270949
|
+
const unionErrors = issues.map((issues2) => new ZodError3(issues2));
|
|
271042
270950
|
addIssueToContext2(ctx, {
|
|
271043
270951
|
code: ZodIssueCode2.invalid_union,
|
|
271044
270952
|
unionErrors
|
|
@@ -271053,7 +270961,7 @@ var ZodUnion2 = class extends ZodType2 {
|
|
|
271053
270961
|
ZodUnion2.create = (types2, params2) => {
|
|
271054
270962
|
return new ZodUnion2({
|
|
271055
270963
|
options: types2,
|
|
271056
|
-
typeName:
|
|
270964
|
+
typeName: ZodFirstPartyTypeKind3.ZodUnion,
|
|
271057
270965
|
...processCreateParams2(params2)
|
|
271058
270966
|
});
|
|
271059
270967
|
};
|
|
@@ -271148,7 +271056,7 @@ var ZodDiscriminatedUnion2 = class _ZodDiscriminatedUnion2 extends ZodType2 {
|
|
|
271148
271056
|
}
|
|
271149
271057
|
}
|
|
271150
271058
|
return new _ZodDiscriminatedUnion2({
|
|
271151
|
-
typeName:
|
|
271059
|
+
typeName: ZodFirstPartyTypeKind3.ZodDiscriminatedUnion,
|
|
271152
271060
|
discriminator,
|
|
271153
271061
|
options,
|
|
271154
271062
|
optionsMap,
|
|
@@ -271243,7 +271151,7 @@ ZodIntersection2.create = (left, right, params2) => {
|
|
|
271243
271151
|
return new ZodIntersection2({
|
|
271244
271152
|
left,
|
|
271245
271153
|
right,
|
|
271246
|
-
typeName:
|
|
271154
|
+
typeName: ZodFirstPartyTypeKind3.ZodIntersection,
|
|
271247
271155
|
...processCreateParams2(params2)
|
|
271248
271156
|
});
|
|
271249
271157
|
};
|
|
@@ -271309,7 +271217,7 @@ ZodTuple2.create = (schemas, params2) => {
|
|
|
271309
271217
|
}
|
|
271310
271218
|
return new ZodTuple2({
|
|
271311
271219
|
items: schemas,
|
|
271312
|
-
typeName:
|
|
271220
|
+
typeName: ZodFirstPartyTypeKind3.ZodTuple,
|
|
271313
271221
|
rest: null,
|
|
271314
271222
|
...processCreateParams2(params2)
|
|
271315
271223
|
});
|
|
@@ -271355,14 +271263,14 @@ var ZodRecord2 = class _ZodRecord2 extends ZodType2 {
|
|
|
271355
271263
|
return new _ZodRecord2({
|
|
271356
271264
|
keyType: first,
|
|
271357
271265
|
valueType: second,
|
|
271358
|
-
typeName:
|
|
271266
|
+
typeName: ZodFirstPartyTypeKind3.ZodRecord,
|
|
271359
271267
|
...processCreateParams2(third)
|
|
271360
271268
|
});
|
|
271361
271269
|
}
|
|
271362
271270
|
return new _ZodRecord2({
|
|
271363
271271
|
keyType: ZodString2.create(),
|
|
271364
271272
|
valueType: first,
|
|
271365
|
-
typeName:
|
|
271273
|
+
typeName: ZodFirstPartyTypeKind3.ZodRecord,
|
|
271366
271274
|
...processCreateParams2(second)
|
|
271367
271275
|
});
|
|
271368
271276
|
}
|
|
@@ -271429,7 +271337,7 @@ ZodMap2.create = (keyType, valueType, params2) => {
|
|
|
271429
271337
|
return new ZodMap2({
|
|
271430
271338
|
valueType,
|
|
271431
271339
|
keyType,
|
|
271432
|
-
typeName:
|
|
271340
|
+
typeName: ZodFirstPartyTypeKind3.ZodMap,
|
|
271433
271341
|
...processCreateParams2(params2)
|
|
271434
271342
|
});
|
|
271435
271343
|
};
|
|
@@ -271514,7 +271422,7 @@ ZodSet2.create = (valueType, params2) => {
|
|
|
271514
271422
|
valueType,
|
|
271515
271423
|
minSize: null,
|
|
271516
271424
|
maxSize: null,
|
|
271517
|
-
typeName:
|
|
271425
|
+
typeName: ZodFirstPartyTypeKind3.ZodSet,
|
|
271518
271426
|
...processCreateParams2(params2)
|
|
271519
271427
|
});
|
|
271520
271428
|
};
|
|
@@ -271560,7 +271468,7 @@ var ZodFunction2 = class _ZodFunction2 extends ZodType2 {
|
|
|
271560
271468
|
if (this._def.returns instanceof ZodPromise2) {
|
|
271561
271469
|
const me3 = this;
|
|
271562
271470
|
return OK2(async function(...args) {
|
|
271563
|
-
const error2 = new
|
|
271471
|
+
const error2 = new ZodError3([]);
|
|
271564
271472
|
const parsedArgs = await me3._def.args.parseAsync(args, params2).catch((e4) => {
|
|
271565
271473
|
error2.addIssue(makeArgsIssue(args, e4));
|
|
271566
271474
|
throw error2;
|
|
@@ -271577,12 +271485,12 @@ var ZodFunction2 = class _ZodFunction2 extends ZodType2 {
|
|
|
271577
271485
|
return OK2(function(...args) {
|
|
271578
271486
|
const parsedArgs = me3._def.args.safeParse(args, params2);
|
|
271579
271487
|
if (!parsedArgs.success) {
|
|
271580
|
-
throw new
|
|
271488
|
+
throw new ZodError3([makeArgsIssue(args, parsedArgs.error)]);
|
|
271581
271489
|
}
|
|
271582
271490
|
const result = Reflect.apply(fn3, this, parsedArgs.data);
|
|
271583
271491
|
const parsedReturns = me3._def.returns.safeParse(result, params2);
|
|
271584
271492
|
if (!parsedReturns.success) {
|
|
271585
|
-
throw new
|
|
271493
|
+
throw new ZodError3([makeReturnsIssue(result, parsedReturns.error)]);
|
|
271586
271494
|
}
|
|
271587
271495
|
return parsedReturns.data;
|
|
271588
271496
|
});
|
|
@@ -271618,7 +271526,7 @@ var ZodFunction2 = class _ZodFunction2 extends ZodType2 {
|
|
|
271618
271526
|
return new _ZodFunction2({
|
|
271619
271527
|
args: args ? args : ZodTuple2.create([]).rest(ZodUnknown2.create()),
|
|
271620
271528
|
returns: returns || ZodUnknown2.create(),
|
|
271621
|
-
typeName:
|
|
271529
|
+
typeName: ZodFirstPartyTypeKind3.ZodFunction,
|
|
271622
271530
|
...processCreateParams2(params2)
|
|
271623
271531
|
});
|
|
271624
271532
|
}
|
|
@@ -271636,7 +271544,7 @@ var ZodLazy2 = class extends ZodType2 {
|
|
|
271636
271544
|
ZodLazy2.create = (getter, params2) => {
|
|
271637
271545
|
return new ZodLazy2({
|
|
271638
271546
|
getter,
|
|
271639
|
-
typeName:
|
|
271547
|
+
typeName: ZodFirstPartyTypeKind3.ZodLazy,
|
|
271640
271548
|
...processCreateParams2(params2)
|
|
271641
271549
|
});
|
|
271642
271550
|
};
|
|
@@ -271660,14 +271568,14 @@ var ZodLiteral2 = class extends ZodType2 {
|
|
|
271660
271568
|
ZodLiteral2.create = (value, params2) => {
|
|
271661
271569
|
return new ZodLiteral2({
|
|
271662
271570
|
value,
|
|
271663
|
-
typeName:
|
|
271571
|
+
typeName: ZodFirstPartyTypeKind3.ZodLiteral,
|
|
271664
271572
|
...processCreateParams2(params2)
|
|
271665
271573
|
});
|
|
271666
271574
|
};
|
|
271667
271575
|
function createZodEnum2(values, params2) {
|
|
271668
271576
|
return new ZodEnum2({
|
|
271669
271577
|
values,
|
|
271670
|
-
typeName:
|
|
271578
|
+
typeName: ZodFirstPartyTypeKind3.ZodEnum,
|
|
271671
271579
|
...processCreateParams2(params2)
|
|
271672
271580
|
});
|
|
271673
271581
|
}
|
|
@@ -271770,7 +271678,7 @@ var ZodNativeEnum2 = class extends ZodType2 {
|
|
|
271770
271678
|
ZodNativeEnum2.create = (values, params2) => {
|
|
271771
271679
|
return new ZodNativeEnum2({
|
|
271772
271680
|
values,
|
|
271773
|
-
typeName:
|
|
271681
|
+
typeName: ZodFirstPartyTypeKind3.ZodNativeEnum,
|
|
271774
271682
|
...processCreateParams2(params2)
|
|
271775
271683
|
});
|
|
271776
271684
|
};
|
|
@@ -271800,7 +271708,7 @@ var ZodPromise2 = class extends ZodType2 {
|
|
|
271800
271708
|
ZodPromise2.create = (schema, params2) => {
|
|
271801
271709
|
return new ZodPromise2({
|
|
271802
271710
|
type: schema,
|
|
271803
|
-
typeName:
|
|
271711
|
+
typeName: ZodFirstPartyTypeKind3.ZodPromise,
|
|
271804
271712
|
...processCreateParams2(params2)
|
|
271805
271713
|
});
|
|
271806
271714
|
};
|
|
@@ -271809,7 +271717,7 @@ var ZodEffects2 = class extends ZodType2 {
|
|
|
271809
271717
|
return this._def.schema;
|
|
271810
271718
|
}
|
|
271811
271719
|
sourceType() {
|
|
271812
|
-
return this._def.schema._def.typeName ===
|
|
271720
|
+
return this._def.schema._def.typeName === ZodFirstPartyTypeKind3.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
271813
271721
|
}
|
|
271814
271722
|
_parse(input) {
|
|
271815
271723
|
const { status, ctx } = this._processInputParams(input);
|
|
@@ -271930,7 +271838,7 @@ var ZodEffects2 = class extends ZodType2 {
|
|
|
271930
271838
|
ZodEffects2.create = (schema, effect, params2) => {
|
|
271931
271839
|
return new ZodEffects2({
|
|
271932
271840
|
schema,
|
|
271933
|
-
typeName:
|
|
271841
|
+
typeName: ZodFirstPartyTypeKind3.ZodEffects,
|
|
271934
271842
|
effect,
|
|
271935
271843
|
...processCreateParams2(params2)
|
|
271936
271844
|
});
|
|
@@ -271939,7 +271847,7 @@ ZodEffects2.createWithPreprocess = (preprocess, schema, params2) => {
|
|
|
271939
271847
|
return new ZodEffects2({
|
|
271940
271848
|
schema,
|
|
271941
271849
|
effect: { type: "preprocess", transform: preprocess },
|
|
271942
|
-
typeName:
|
|
271850
|
+
typeName: ZodFirstPartyTypeKind3.ZodEffects,
|
|
271943
271851
|
...processCreateParams2(params2)
|
|
271944
271852
|
});
|
|
271945
271853
|
};
|
|
@@ -271958,7 +271866,7 @@ var ZodOptional2 = class extends ZodType2 {
|
|
|
271958
271866
|
ZodOptional2.create = (type, params2) => {
|
|
271959
271867
|
return new ZodOptional2({
|
|
271960
271868
|
innerType: type,
|
|
271961
|
-
typeName:
|
|
271869
|
+
typeName: ZodFirstPartyTypeKind3.ZodOptional,
|
|
271962
271870
|
...processCreateParams2(params2)
|
|
271963
271871
|
});
|
|
271964
271872
|
};
|
|
@@ -271977,7 +271885,7 @@ var ZodNullable2 = class extends ZodType2 {
|
|
|
271977
271885
|
ZodNullable2.create = (type, params2) => {
|
|
271978
271886
|
return new ZodNullable2({
|
|
271979
271887
|
innerType: type,
|
|
271980
|
-
typeName:
|
|
271888
|
+
typeName: ZodFirstPartyTypeKind3.ZodNullable,
|
|
271981
271889
|
...processCreateParams2(params2)
|
|
271982
271890
|
});
|
|
271983
271891
|
};
|
|
@@ -272001,7 +271909,7 @@ var ZodDefault2 = class extends ZodType2 {
|
|
|
272001
271909
|
ZodDefault2.create = (type, params2) => {
|
|
272002
271910
|
return new ZodDefault2({
|
|
272003
271911
|
innerType: type,
|
|
272004
|
-
typeName:
|
|
271912
|
+
typeName: ZodFirstPartyTypeKind3.ZodDefault,
|
|
272005
271913
|
defaultValue: typeof params2.default === "function" ? params2.default : () => params2.default,
|
|
272006
271914
|
...processCreateParams2(params2)
|
|
272007
271915
|
});
|
|
@@ -272029,7 +271937,7 @@ var ZodCatch2 = class extends ZodType2 {
|
|
|
272029
271937
|
status: "valid",
|
|
272030
271938
|
value: result2.status === "valid" ? result2.value : this._def.catchValue({
|
|
272031
271939
|
get error() {
|
|
272032
|
-
return new
|
|
271940
|
+
return new ZodError3(newCtx.common.issues);
|
|
272033
271941
|
},
|
|
272034
271942
|
input: newCtx.data
|
|
272035
271943
|
})
|
|
@@ -272040,7 +271948,7 @@ var ZodCatch2 = class extends ZodType2 {
|
|
|
272040
271948
|
status: "valid",
|
|
272041
271949
|
value: result.status === "valid" ? result.value : this._def.catchValue({
|
|
272042
271950
|
get error() {
|
|
272043
|
-
return new
|
|
271951
|
+
return new ZodError3(newCtx.common.issues);
|
|
272044
271952
|
},
|
|
272045
271953
|
input: newCtx.data
|
|
272046
271954
|
})
|
|
@@ -272054,7 +271962,7 @@ var ZodCatch2 = class extends ZodType2 {
|
|
|
272054
271962
|
ZodCatch2.create = (type, params2) => {
|
|
272055
271963
|
return new ZodCatch2({
|
|
272056
271964
|
innerType: type,
|
|
272057
|
-
typeName:
|
|
271965
|
+
typeName: ZodFirstPartyTypeKind3.ZodCatch,
|
|
272058
271966
|
catchValue: typeof params2.catch === "function" ? params2.catch : () => params2.catch,
|
|
272059
271967
|
...processCreateParams2(params2)
|
|
272060
271968
|
});
|
|
@@ -272076,7 +271984,7 @@ var ZodNaN2 = class extends ZodType2 {
|
|
|
272076
271984
|
};
|
|
272077
271985
|
ZodNaN2.create = (params2) => {
|
|
272078
271986
|
return new ZodNaN2({
|
|
272079
|
-
typeName:
|
|
271987
|
+
typeName: ZodFirstPartyTypeKind3.ZodNaN,
|
|
272080
271988
|
...processCreateParams2(params2)
|
|
272081
271989
|
});
|
|
272082
271990
|
};
|
|
@@ -272146,7 +272054,7 @@ var ZodPipeline2 = class _ZodPipeline2 extends ZodType2 {
|
|
|
272146
272054
|
return new _ZodPipeline2({
|
|
272147
272055
|
in: a3,
|
|
272148
272056
|
out: b3,
|
|
272149
|
-
typeName:
|
|
272057
|
+
typeName: ZodFirstPartyTypeKind3.ZodPipeline
|
|
272150
272058
|
});
|
|
272151
272059
|
}
|
|
272152
272060
|
};
|
|
@@ -272168,7 +272076,7 @@ var ZodReadonly2 = class extends ZodType2 {
|
|
|
272168
272076
|
ZodReadonly2.create = (type, params2) => {
|
|
272169
272077
|
return new ZodReadonly2({
|
|
272170
272078
|
innerType: type,
|
|
272171
|
-
typeName:
|
|
272079
|
+
typeName: ZodFirstPartyTypeKind3.ZodReadonly,
|
|
272172
272080
|
...processCreateParams2(params2)
|
|
272173
272081
|
});
|
|
272174
272082
|
};
|
|
@@ -272202,7 +272110,7 @@ function custom2(check, _params = {}, fatal) {
|
|
|
272202
272110
|
var late2 = {
|
|
272203
272111
|
object: ZodObject2.lazycreate
|
|
272204
272112
|
};
|
|
272205
|
-
var
|
|
272113
|
+
var ZodFirstPartyTypeKind3;
|
|
272206
272114
|
(function(ZodFirstPartyTypeKind22) {
|
|
272207
272115
|
ZodFirstPartyTypeKind22["ZodString"] = "ZodString";
|
|
272208
272116
|
ZodFirstPartyTypeKind22["ZodNumber"] = "ZodNumber";
|
|
@@ -272240,7 +272148,7 @@ var ZodFirstPartyTypeKind4;
|
|
|
272240
272148
|
ZodFirstPartyTypeKind22["ZodBranded"] = "ZodBranded";
|
|
272241
272149
|
ZodFirstPartyTypeKind22["ZodPipeline"] = "ZodPipeline";
|
|
272242
272150
|
ZodFirstPartyTypeKind22["ZodReadonly"] = "ZodReadonly";
|
|
272243
|
-
})(
|
|
272151
|
+
})(ZodFirstPartyTypeKind3 || (ZodFirstPartyTypeKind3 = {}));
|
|
272244
272152
|
var instanceOfType2 = (cls, params2 = {
|
|
272245
272153
|
message: `Input not instance of ${cls.name}`
|
|
272246
272154
|
}) => custom2((data) => data instanceof cls, params2);
|
|
@@ -278688,9 +278596,9 @@ import { z as z410 } from "zod";
|
|
|
278688
278596
|
import { z as z54 } from "zod";
|
|
278689
278597
|
import { z as z64 } from "zod";
|
|
278690
278598
|
import { z as z74 } from "zod";
|
|
278691
|
-
import { z as
|
|
278599
|
+
import { z as z83 } from "zod";
|
|
278692
278600
|
import { z as z94 } from "zod";
|
|
278693
|
-
import { z as
|
|
278601
|
+
import { z as z103 } from "zod";
|
|
278694
278602
|
import { z as z113 } from "zod";
|
|
278695
278603
|
import { z as z143 } from "zod";
|
|
278696
278604
|
import { z as z123 } from "zod";
|
|
@@ -278764,7 +278672,7 @@ import { z as z80 } from "zod";
|
|
|
278764
278672
|
import { z as z81 } from "zod";
|
|
278765
278673
|
import { z as z822 } from "zod";
|
|
278766
278674
|
import { z as z832 } from "zod";
|
|
278767
|
-
import { z as
|
|
278675
|
+
import { z as z84 } from "zod";
|
|
278768
278676
|
import { z as z85 } from "zod";
|
|
278769
278677
|
import { z as z86 } from "zod";
|
|
278770
278678
|
import { z as z87 } from "zod";
|
|
@@ -278784,7 +278692,7 @@ import { z as z100 } from "zod";
|
|
|
278784
278692
|
import { z as z101 } from "zod";
|
|
278785
278693
|
import { z as z1022 } from "zod";
|
|
278786
278694
|
import { z as z1032 } from "zod";
|
|
278787
|
-
import { z as
|
|
278695
|
+
import { z as z104 } from "zod";
|
|
278788
278696
|
import { z as z105 } from "zod";
|
|
278789
278697
|
import { z as z106 } from "zod";
|
|
278790
278698
|
import { z as z107 } from "zod";
|
|
@@ -279392,10 +279300,10 @@ var pcbRenderLayer2 = z74.enum([
|
|
|
279392
279300
|
"drill"
|
|
279393
279301
|
]);
|
|
279394
279302
|
expectTypesMatch3(true);
|
|
279395
|
-
var asset2 =
|
|
279396
|
-
project_relative_path:
|
|
279397
|
-
url:
|
|
279398
|
-
mimetype:
|
|
279303
|
+
var asset2 = z83.object({
|
|
279304
|
+
project_relative_path: z83.string(),
|
|
279305
|
+
url: z83.string(),
|
|
279306
|
+
mimetype: z83.string()
|
|
279399
279307
|
});
|
|
279400
279308
|
expectTypesMatch3(true);
|
|
279401
279309
|
var kicadAt3 = point11.extend({
|
|
@@ -279466,29 +279374,29 @@ var kicadFootprintMetadata3 = z94.object({
|
|
|
279466
279374
|
model: kicadFootprintModel3.optional()
|
|
279467
279375
|
});
|
|
279468
279376
|
expectTypesMatch3(true);
|
|
279469
|
-
var kicadSymbolPinNumbers3 =
|
|
279470
|
-
hide:
|
|
279377
|
+
var kicadSymbolPinNumbers3 = z103.object({
|
|
279378
|
+
hide: z103.boolean().optional()
|
|
279471
279379
|
});
|
|
279472
279380
|
expectTypesMatch3(true);
|
|
279473
|
-
var kicadSymbolPinNames3 =
|
|
279381
|
+
var kicadSymbolPinNames3 = z103.object({
|
|
279474
279382
|
offset: distance51.optional(),
|
|
279475
|
-
hide:
|
|
279383
|
+
hide: z103.boolean().optional()
|
|
279476
279384
|
});
|
|
279477
279385
|
expectTypesMatch3(true);
|
|
279478
|
-
var kicadSymbolEffects3 =
|
|
279386
|
+
var kicadSymbolEffects3 = z103.object({
|
|
279479
279387
|
font: kicadFont3.optional(),
|
|
279480
|
-
justify:
|
|
279481
|
-
hide:
|
|
279388
|
+
justify: z103.union([z103.string(), z103.array(z103.string())]).optional(),
|
|
279389
|
+
hide: z103.boolean().optional()
|
|
279482
279390
|
});
|
|
279483
279391
|
expectTypesMatch3(true);
|
|
279484
|
-
var kicadSymbolProperty3 =
|
|
279485
|
-
value:
|
|
279486
|
-
id:
|
|
279392
|
+
var kicadSymbolProperty3 = z103.object({
|
|
279393
|
+
value: z103.string(),
|
|
279394
|
+
id: z103.union([z103.number(), z103.string()]).optional(),
|
|
279487
279395
|
at: kicadAt3.optional(),
|
|
279488
279396
|
effects: kicadSymbolEffects3.optional()
|
|
279489
279397
|
});
|
|
279490
279398
|
expectTypesMatch3(true);
|
|
279491
|
-
var kicadSymbolProperties3 =
|
|
279399
|
+
var kicadSymbolProperties3 = z103.object({
|
|
279492
279400
|
Reference: kicadSymbolProperty3.optional(),
|
|
279493
279401
|
Value: kicadSymbolProperty3.optional(),
|
|
279494
279402
|
Footprint: kicadSymbolProperty3.optional(),
|
|
@@ -279498,16 +279406,16 @@ var kicadSymbolProperties3 = z104.object({
|
|
|
279498
279406
|
ki_fp_filters: kicadSymbolProperty3.optional()
|
|
279499
279407
|
});
|
|
279500
279408
|
expectTypesMatch3(true);
|
|
279501
|
-
var kicadSymbolMetadata3 =
|
|
279502
|
-
symbolName:
|
|
279503
|
-
extends:
|
|
279409
|
+
var kicadSymbolMetadata3 = z103.object({
|
|
279410
|
+
symbolName: z103.string().optional(),
|
|
279411
|
+
extends: z103.string().optional(),
|
|
279504
279412
|
pinNumbers: kicadSymbolPinNumbers3.optional(),
|
|
279505
279413
|
pinNames: kicadSymbolPinNames3.optional(),
|
|
279506
|
-
excludeFromSim:
|
|
279507
|
-
inBom:
|
|
279508
|
-
onBoard:
|
|
279414
|
+
excludeFromSim: z103.boolean().optional(),
|
|
279415
|
+
inBom: z103.boolean().optional(),
|
|
279416
|
+
onBoard: z103.boolean().optional(),
|
|
279509
279417
|
properties: kicadSymbolProperties3.optional(),
|
|
279510
|
-
embeddedFonts:
|
|
279418
|
+
embeddedFonts: z103.boolean().optional()
|
|
279511
279419
|
});
|
|
279512
279420
|
expectTypesMatch3(true);
|
|
279513
279421
|
var base_circuit_json_error2 = z113.object({
|
|
@@ -280319,19 +280227,19 @@ var schematic_manual_edit_conflict_warning3 = z832.object({
|
|
|
280319
280227
|
source_component_id: z832.string()
|
|
280320
280228
|
}).describe("Warning emitted when a component has both manual placement and explicit schX/schY coordinates");
|
|
280321
280229
|
expectTypesMatch3(true);
|
|
280322
|
-
var schematic_group2 =
|
|
280323
|
-
type:
|
|
280230
|
+
var schematic_group2 = z84.object({
|
|
280231
|
+
type: z84.literal("schematic_group"),
|
|
280324
280232
|
schematic_group_id: getZodPrefixedIdWithDefault2("schematic_group"),
|
|
280325
|
-
source_group_id:
|
|
280326
|
-
is_subcircuit:
|
|
280327
|
-
subcircuit_id:
|
|
280233
|
+
source_group_id: z84.string(),
|
|
280234
|
+
is_subcircuit: z84.boolean().optional(),
|
|
280235
|
+
subcircuit_id: z84.string().optional(),
|
|
280328
280236
|
width: length69,
|
|
280329
280237
|
height: length69,
|
|
280330
280238
|
center: point11,
|
|
280331
|
-
schematic_component_ids:
|
|
280332
|
-
show_as_schematic_box:
|
|
280333
|
-
name:
|
|
280334
|
-
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()
|
|
280335
280243
|
}).describe("Defines a group of components on the schematic");
|
|
280336
280244
|
expectTypesMatch3(true);
|
|
280337
280245
|
var schematic_table2 = z85.object({
|
|
@@ -281010,23 +280918,23 @@ var pcb_net2 = z1032.object({
|
|
|
281010
280918
|
highlight_color: z1032.string().optional()
|
|
281011
280919
|
}).describe("Defines a net on the PCB");
|
|
281012
280920
|
expectTypesMatch3(true);
|
|
281013
|
-
var pcb_via2 =
|
|
281014
|
-
type:
|
|
280921
|
+
var pcb_via2 = z104.object({
|
|
280922
|
+
type: z104.literal("pcb_via"),
|
|
281015
280923
|
pcb_via_id: getZodPrefixedIdWithDefault2("pcb_via"),
|
|
281016
|
-
pcb_group_id:
|
|
281017
|
-
subcircuit_id:
|
|
281018
|
-
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(),
|
|
281019
280927
|
x: distance51,
|
|
281020
280928
|
y: distance51,
|
|
281021
280929
|
outer_diameter: distance51.default("0.6mm"),
|
|
281022
280930
|
hole_diameter: distance51.default("0.25mm"),
|
|
281023
280931
|
from_layer: layer_ref3.optional(),
|
|
281024
280932
|
to_layer: layer_ref3.optional(),
|
|
281025
|
-
layers:
|
|
281026
|
-
pcb_trace_id:
|
|
281027
|
-
net_is_assignable:
|
|
281028
|
-
net_assigned:
|
|
281029
|
-
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()
|
|
281030
280938
|
}).describe("Defines a via on the PCB");
|
|
281031
280939
|
expectTypesMatch3(true);
|
|
281032
280940
|
var pcb_board2 = z105.object({
|
|
@@ -288574,317 +288482,17 @@ Fuse2.use = function(...plugins) {
|
|
|
288574
288482
|
plugins.forEach((plugin) => register2(plugin));
|
|
288575
288483
|
};
|
|
288576
288484
|
var entry_default = Fuse2;
|
|
288577
|
-
// node_modules/@tscircuit/ti-parts-engine/lib/kicad-archive/readKicadArchive.ts
|
|
288578
|
-
var import_jszip6 = __toESM2(require_lib4(), 1);
|
|
288579
|
-
// node_modules/@tscircuit/ti-parts-engine/lib/kicad-archive/readFirstKicadLibraryFilesFromArchive.ts
|
|
288580
|
-
var import_jszip7 = __toESM2(require_lib4(), 1);
|
|
288581
|
-
// node_modules/@tscircuit/ti-parts-engine/lib/kicad-archive/readFirstKicadModFromArchive.ts
|
|
288582
|
-
var import_jszip8 = __toESM2(require_lib4(), 1);
|
|
288583
|
-
// node_modules/@tscircuit/ti-parts-engine/lib/ultra-librarian-bridge-client/normalizeBaseUrl.ts
|
|
288584
|
-
function normalizeBaseUrl(baseUrl) {
|
|
288585
|
-
return baseUrl.replace(/\/+$/, "");
|
|
288586
|
-
}
|
|
288587
|
-
|
|
288588
|
-
// node_modules/@tscircuit/ti-parts-engine/lib/ultra-librarian-bridge-client/types.ts
|
|
288589
|
-
var DEFAULT_BASE_URL = "https://ti-api-cors-proxy.seve.workers.dev/";
|
|
288590
|
-
var DEFAULT_KICAD_VERSION = 6;
|
|
288591
|
-
|
|
288592
|
-
// node_modules/@tscircuit/ti-parts-engine/lib/ultra-librarian-bridge-client/paths.ts
|
|
288593
|
-
function buildSearchPath(request) {
|
|
288594
|
-
const query = requireNonEmptyString("query", request.query);
|
|
288595
|
-
const exactOnly = request.exactOnly ?? true;
|
|
288596
|
-
const limit = request.limit ?? 1;
|
|
288597
|
-
assertPositiveInteger("limit", limit);
|
|
288598
|
-
const params2 = new URLSearchParams({
|
|
288599
|
-
q: query,
|
|
288600
|
-
exact_only: String(exactOnly),
|
|
288601
|
-
limit: String(limit)
|
|
288602
|
-
});
|
|
288603
|
-
return `/v1/parts/search?${params2.toString()}`;
|
|
288604
|
-
}
|
|
288605
|
-
function buildKicadExportPath(request) {
|
|
288606
|
-
const mpn = requireNonEmptyString("mpn", request.mpn);
|
|
288607
|
-
const version3 = request.version ?? DEFAULT_KICAD_VERSION;
|
|
288608
|
-
assertPositiveInteger("version", version3);
|
|
288609
|
-
const params2 = new URLSearchParams({
|
|
288610
|
-
mpn,
|
|
288611
|
-
version: String(version3)
|
|
288612
|
-
});
|
|
288613
|
-
return `/v1/export/kicad?${params2.toString()}`;
|
|
288614
|
-
}
|
|
288615
|
-
function requireNonEmptyString(name, value) {
|
|
288616
|
-
const trimmedValue = value.trim();
|
|
288617
|
-
if (trimmedValue.length === 0) {
|
|
288618
|
-
throw new Error(`${name} is required.`);
|
|
288619
|
-
}
|
|
288620
|
-
return trimmedValue;
|
|
288621
|
-
}
|
|
288622
|
-
function assertPositiveInteger(name, value) {
|
|
288623
|
-
if (!Number.isInteger(value) || value < 1) {
|
|
288624
|
-
throw new Error(`${name} must be a positive integer.`);
|
|
288625
|
-
}
|
|
288626
|
-
}
|
|
288627
|
-
|
|
288628
|
-
// node_modules/@tscircuit/ti-parts-engine/lib/ultra-librarian-bridge-client/createDefaultBridgeFetch.ts
|
|
288629
|
-
var createDefaultBridgeFetch = () => {
|
|
288630
|
-
return async (input, init2) => {
|
|
288631
|
-
const targetUrl = input.toString();
|
|
288632
|
-
const proxyEndpointUrl = getTscircuitProxyEndpointUrl(targetUrl);
|
|
288633
|
-
if (!proxyEndpointUrl) {
|
|
288634
|
-
return globalThis.fetch(input, init2);
|
|
288635
|
-
}
|
|
288636
|
-
const headers = new Headers(init2?.headers);
|
|
288637
|
-
headers.set("X-Target-Url", targetUrl);
|
|
288638
|
-
const targetOrigin = safeGetOrigin(targetUrl);
|
|
288639
|
-
if (targetOrigin) {
|
|
288640
|
-
headers.set("X-Sender-Origin", targetOrigin);
|
|
288641
|
-
}
|
|
288642
|
-
return globalThis.fetch(proxyEndpointUrl, {
|
|
288643
|
-
...init2,
|
|
288644
|
-
headers
|
|
288645
|
-
});
|
|
288646
|
-
};
|
|
288647
|
-
};
|
|
288648
|
-
function getTscircuitProxyEndpointUrl(targetUrl) {
|
|
288649
|
-
if (typeof window === "undefined" || !window.location) {
|
|
288650
|
-
return null;
|
|
288651
|
-
}
|
|
288652
|
-
const targetOrigin = safeGetOrigin(targetUrl);
|
|
288653
|
-
const currentOrigin = window.location.origin;
|
|
288654
|
-
if (!targetOrigin || targetOrigin === currentOrigin) {
|
|
288655
|
-
return null;
|
|
288656
|
-
}
|
|
288657
|
-
if (window.TSCIRCUIT_FILESERVER_API_BASE_URL) {
|
|
288658
|
-
return `${window.TSCIRCUIT_FILESERVER_API_BASE_URL.replace(/\/+$/, "")}/proxy`;
|
|
288659
|
-
}
|
|
288660
|
-
if (isLocalHttpOrigin(currentOrigin)) {
|
|
288661
|
-
return `${currentOrigin}/proxy`;
|
|
288662
|
-
}
|
|
288663
|
-
return null;
|
|
288664
|
-
}
|
|
288665
|
-
function safeGetOrigin(url2) {
|
|
288666
|
-
try {
|
|
288667
|
-
return new URL(url2).origin;
|
|
288668
|
-
} catch {
|
|
288669
|
-
return null;
|
|
288670
|
-
}
|
|
288671
|
-
}
|
|
288672
|
-
function isLocalHttpOrigin(origin) {
|
|
288673
|
-
try {
|
|
288674
|
-
const url2 = new URL(origin);
|
|
288675
|
-
return (url2.protocol === "http:" || url2.protocol === "https:") && (url2.hostname === "localhost" || url2.hostname === "127.0.0.1" || url2.hostname === "::1");
|
|
288676
|
-
} catch {
|
|
288677
|
-
return false;
|
|
288678
|
-
}
|
|
288679
|
-
}
|
|
288680
|
-
|
|
288681
|
-
// node_modules/@tscircuit/ti-parts-engine/lib/ultra-librarian-bridge-client/requestArchive.ts
|
|
288682
|
-
async function requestArchive(options) {
|
|
288683
|
-
const url2 = buildRequestUrl(options.baseUrl, options.path);
|
|
288684
|
-
logRequest(options.logger, url2);
|
|
288685
|
-
const response = await options.fetchImpl(url2, {
|
|
288686
|
-
headers: createBridgeHeaders(options.partnerToken, "application/zip"),
|
|
288687
|
-
redirect: "follow"
|
|
288688
|
-
});
|
|
288689
|
-
if (!response.ok) {
|
|
288690
|
-
throw new Error(`KiCad export failed with ${response.status} ${response.statusText}: ${await readErrorBody(response)}`);
|
|
288691
|
-
}
|
|
288692
|
-
const contentType = response.headers.get("content-type") ?? "unknown";
|
|
288693
|
-
if (!contentType.includes("application/zip") && !contentType.includes("application/octet-stream")) {
|
|
288694
|
-
throw new Error(`Expected application/zip but received ${contentType}.`);
|
|
288695
|
-
}
|
|
288696
|
-
return {
|
|
288697
|
-
archiveBuffer: await response.arrayBuffer(),
|
|
288698
|
-
contentType
|
|
288699
|
-
};
|
|
288700
|
-
}
|
|
288701
|
-
function createBridgeHeaders(partnerToken, accept) {
|
|
288702
|
-
const headers = {
|
|
288703
|
-
Accept: accept
|
|
288704
|
-
};
|
|
288705
|
-
if (partnerToken) {
|
|
288706
|
-
headers.Authorization = `Bearer ${partnerToken}`;
|
|
288707
|
-
}
|
|
288708
|
-
return headers;
|
|
288709
|
-
}
|
|
288710
|
-
function buildRequestUrl(baseUrl, path68) {
|
|
288711
|
-
return `${normalizeBaseUrl(baseUrl)}${path68}`;
|
|
288712
|
-
}
|
|
288713
|
-
function logRequest(logger, url2) {
|
|
288714
|
-
if (!logger)
|
|
288715
|
-
return;
|
|
288716
|
-
const requestUrl = new URL(url2);
|
|
288717
|
-
logger.log(`GET ${requestUrl.pathname}${requestUrl.search}`);
|
|
288718
|
-
}
|
|
288719
|
-
async function readErrorBody(response) {
|
|
288720
|
-
const bodyText = (await response.text()).trim();
|
|
288721
|
-
return bodyText.length > 0 ? bodyText : "<empty response body>";
|
|
288722
|
-
}
|
|
288723
288485
|
|
|
288724
|
-
// node_modules/@tscircuit/ti-parts-engine/lib/ultra-librarian-bridge-client/requestJson.ts
|
|
288725
|
-
async function requestJson(options) {
|
|
288726
|
-
const url2 = buildRequestUrl2(options.baseUrl, options.path);
|
|
288727
|
-
logRequest2(options.logger, url2);
|
|
288728
|
-
const response = await options.fetchImpl(url2, {
|
|
288729
|
-
headers: createBridgeHeaders2(options.partnerToken, "application/json")
|
|
288730
|
-
});
|
|
288731
|
-
if (!response.ok) {
|
|
288732
|
-
throw new Error(`Search request failed with ${response.status} ${response.statusText}: ${await readErrorBody2(response)}`);
|
|
288733
|
-
}
|
|
288734
|
-
return asJsonValue(await response.json());
|
|
288735
|
-
}
|
|
288736
|
-
function createBridgeHeaders2(partnerToken, accept) {
|
|
288737
|
-
const headers = {
|
|
288738
|
-
Accept: accept
|
|
288739
|
-
};
|
|
288740
|
-
if (partnerToken) {
|
|
288741
|
-
headers.Authorization = `Bearer ${partnerToken}`;
|
|
288742
|
-
}
|
|
288743
|
-
return headers;
|
|
288744
|
-
}
|
|
288745
|
-
function buildRequestUrl2(baseUrl, path68) {
|
|
288746
|
-
return `${normalizeBaseUrl(baseUrl)}${path68}`;
|
|
288747
|
-
}
|
|
288748
|
-
function logRequest2(logger, url2) {
|
|
288749
|
-
if (!logger)
|
|
288750
|
-
return;
|
|
288751
|
-
const requestUrl = new URL(url2);
|
|
288752
|
-
logger.log(`GET ${requestUrl.pathname}${requestUrl.search}`);
|
|
288753
|
-
}
|
|
288754
|
-
async function readErrorBody2(response) {
|
|
288755
|
-
const bodyText = (await response.text()).trim();
|
|
288756
|
-
return bodyText.length > 0 ? bodyText : "<empty response body>";
|
|
288757
|
-
}
|
|
288758
|
-
function asJsonValue(value) {
|
|
288759
|
-
return value;
|
|
288760
|
-
}
|
|
288761
|
-
|
|
288762
|
-
// node_modules/@tscircuit/ti-parts-engine/lib/ultra-librarian-bridge-client/search-response.ts
|
|
288763
|
-
function extractSearchResults(payload) {
|
|
288764
|
-
if (Array.isArray(payload)) {
|
|
288765
|
-
return payload.filter(isSearchPartResult);
|
|
288766
|
-
}
|
|
288767
|
-
if (!isJsonObject(payload)) {
|
|
288768
|
-
return [];
|
|
288769
|
-
}
|
|
288770
|
-
for (const key of ["results", "items", "parts", "data"]) {
|
|
288771
|
-
const value = payload[key];
|
|
288772
|
-
if (Array.isArray(value)) {
|
|
288773
|
-
return value.filter(isSearchPartResult);
|
|
288774
|
-
}
|
|
288775
|
-
}
|
|
288776
|
-
return [];
|
|
288777
|
-
}
|
|
288778
|
-
function isJsonObject(value) {
|
|
288779
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
288780
|
-
}
|
|
288781
|
-
function isSearchPartResult(value) {
|
|
288782
|
-
return isJsonObject(value);
|
|
288783
|
-
}
|
|
288784
|
-
|
|
288785
|
-
// node_modules/@tscircuit/ti-parts-engine/lib/ultra-librarian-bridge-client/createUltraLibrarianBridgeClient.ts
|
|
288786
|
-
function createUltraLibrarianBridgeClient(options = {}) {
|
|
288787
|
-
const partnerToken = normalizeOptionalString(options.partnerToken);
|
|
288788
|
-
const baseUrl = normalizeBaseUrl(options.baseUrl ?? DEFAULT_BASE_URL);
|
|
288789
|
-
const fetchImpl = options.fetch ?? createDefaultBridgeFetch();
|
|
288790
|
-
const logger = options.logger;
|
|
288791
|
-
return {
|
|
288792
|
-
baseUrl,
|
|
288793
|
-
async searchParts(request) {
|
|
288794
|
-
const path68 = buildSearchPath(request);
|
|
288795
|
-
const rawPayload = await requestJson({
|
|
288796
|
-
fetchImpl,
|
|
288797
|
-
baseUrl,
|
|
288798
|
-
path: path68,
|
|
288799
|
-
partnerToken,
|
|
288800
|
-
logger
|
|
288801
|
-
});
|
|
288802
|
-
return {
|
|
288803
|
-
rawPayload,
|
|
288804
|
-
results: extractSearchResults(rawPayload)
|
|
288805
|
-
};
|
|
288806
|
-
},
|
|
288807
|
-
async downloadKicadArchive(request) {
|
|
288808
|
-
const path68 = buildKicadExportPath(request);
|
|
288809
|
-
return await requestArchive({
|
|
288810
|
-
fetchImpl,
|
|
288811
|
-
baseUrl,
|
|
288812
|
-
path: path68,
|
|
288813
|
-
partnerToken,
|
|
288814
|
-
logger
|
|
288815
|
-
});
|
|
288816
|
-
}
|
|
288817
|
-
};
|
|
288818
|
-
}
|
|
288819
|
-
function normalizeOptionalString(value) {
|
|
288820
|
-
const trimmedValue = value?.trim();
|
|
288821
|
-
return trimmedValue ? trimmedValue : undefined;
|
|
288822
|
-
}
|
|
288823
|
-
// node_modules/@tscircuit/ti-parts-engine/lib/ti-parts-engine/TiPartsEngine.ts
|
|
288824
|
-
class TiPartsEngine {
|
|
288825
|
-
options;
|
|
288826
|
-
constructor(options = {}) {
|
|
288827
|
-
this.options = options;
|
|
288828
|
-
this.searchParts = this.searchParts.bind(this);
|
|
288829
|
-
this.downloadKicadArchive = this.downloadKicadArchive.bind(this);
|
|
288830
|
-
this.findPart = this.findPart.bind(this);
|
|
288831
|
-
}
|
|
288832
|
-
async findPart({ sourceComponent }) {
|
|
288833
|
-
const manufacturerPartNumber = getManufacturerPartNumber(sourceComponent);
|
|
288834
|
-
if (!manufacturerPartNumber) {
|
|
288835
|
-
return {};
|
|
288836
|
-
}
|
|
288837
|
-
const searchResponse = await this.searchParts({
|
|
288838
|
-
query: manufacturerPartNumber,
|
|
288839
|
-
exactOnly: true,
|
|
288840
|
-
limit: 1
|
|
288841
|
-
});
|
|
288842
|
-
const matchingPart = searchResponse.results[0];
|
|
288843
|
-
if (!matchingPart) {
|
|
288844
|
-
return {};
|
|
288845
|
-
}
|
|
288846
|
-
const resolvedPartNumber = matchingPart?.mpn ?? matchingPart?.manufacturer_part_number ?? matchingPart?.part_number ?? matchingPart?.gpn ?? manufacturerPartNumber;
|
|
288847
|
-
return {
|
|
288848
|
-
ti: [resolvedPartNumber]
|
|
288849
|
-
};
|
|
288850
|
-
}
|
|
288851
|
-
async searchParts(request) {
|
|
288852
|
-
return await this.createClient().searchParts(request);
|
|
288853
|
-
}
|
|
288854
|
-
async downloadKicadArchive(request) {
|
|
288855
|
-
return await this.createClient().downloadKicadArchive(request);
|
|
288856
|
-
}
|
|
288857
|
-
createClient() {
|
|
288858
|
-
return createUltraLibrarianBridgeClient(this.options);
|
|
288859
|
-
}
|
|
288860
|
-
}
|
|
288861
|
-
function getManufacturerPartNumber(sourceComponent) {
|
|
288862
|
-
if (!isRecord2(sourceComponent)) {
|
|
288863
|
-
return null;
|
|
288864
|
-
}
|
|
288865
|
-
const value = sourceComponent.manufacturer_part_number;
|
|
288866
|
-
return typeof value === "string" && value.trim() ? value : null;
|
|
288867
|
-
}
|
|
288868
|
-
function isRecord2(value) {
|
|
288869
|
-
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
288870
|
-
}
|
|
288871
|
-
// node_modules/@tscircuit/ti-parts-engine/lib/ti-parts-engine/createTiFootprintLibrary.ts
|
|
288872
|
-
import {
|
|
288873
|
-
KicadFootprintToCircuitJsonConverter as KicadFootprintToCircuitJsonConverter2,
|
|
288874
|
-
KicadSymbolToCircuitJsonConverter
|
|
288875
|
-
} from "kicad-to-circuit-json";
|
|
288876
288486
|
// cli/search/register.ts
|
|
288877
288487
|
var registerSearch = (program3) => {
|
|
288878
|
-
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) => {
|
|
288879
288489
|
const query = getQueryFromParts(queryParts);
|
|
288880
|
-
const hasFilters = opts.kicad || opts.jlcpcb || opts.lcsc || opts.
|
|
288490
|
+
const hasFilters = opts.kicad || opts.jlcpcb || opts.lcsc || opts.tscircuit;
|
|
288881
288491
|
const searchKicad = opts.kicad;
|
|
288882
288492
|
const searchJlc = opts.jlcpcb || opts.lcsc || !hasFilters;
|
|
288883
|
-
const searchTi = opts.ti;
|
|
288884
288493
|
const searchTscircuit = opts.tscircuit;
|
|
288885
288494
|
let results = { packages: [] };
|
|
288886
288495
|
let jlcResults = [];
|
|
288887
|
-
let tiResults = [];
|
|
288888
288496
|
let kicadResults = [];
|
|
288889
288497
|
try {
|
|
288890
288498
|
if (searchTscircuit) {
|
|
@@ -288898,17 +288506,6 @@ var registerSearch = (program3) => {
|
|
|
288898
288506
|
const jlcResponse = await fetch(jlcSearchUrl).then((r4) => r4.json());
|
|
288899
288507
|
jlcResults = jlcResponse?.components ?? [];
|
|
288900
288508
|
}
|
|
288901
|
-
if (searchTi) {
|
|
288902
|
-
const tiPartsEngine = new TiPartsEngine({
|
|
288903
|
-
baseUrl: process.env.TSCIRCUIT_TI_API_BASE_URL
|
|
288904
|
-
});
|
|
288905
|
-
const tiResponse = await tiPartsEngine.searchParts({
|
|
288906
|
-
query,
|
|
288907
|
-
exactOnly: false,
|
|
288908
|
-
limit: 10
|
|
288909
|
-
});
|
|
288910
|
-
tiResults = tiResponse.results;
|
|
288911
|
-
}
|
|
288912
288509
|
if (searchKicad) {
|
|
288913
288510
|
const kicadFiles = await fetch("https://kicad-mod-cache.tscircuit.com/kicad_files.json").then((r4) => r4.json());
|
|
288914
288511
|
const fuse = new entry_default(kicadFiles);
|
|
@@ -288931,10 +288528,6 @@ var registerSearch = (program3) => {
|
|
|
288931
288528
|
...jlcResults.map((comp) => ({
|
|
288932
288529
|
source: "jlcpcb",
|
|
288933
288530
|
...comp
|
|
288934
|
-
})),
|
|
288935
|
-
...tiResults.map((part) => ({
|
|
288936
|
-
source: "ti",
|
|
288937
|
-
...part
|
|
288938
288531
|
}))
|
|
288939
288532
|
];
|
|
288940
288533
|
console.log(JSON.stringify({
|
|
@@ -288943,11 +288536,10 @@ var registerSearch = (program3) => {
|
|
|
288943
288536
|
}, null, 2));
|
|
288944
288537
|
return;
|
|
288945
288538
|
}
|
|
288946
|
-
if (!kicadResults.length && !results.packages.length && !jlcResults.length
|
|
288539
|
+
if (!kicadResults.length && !results.packages.length && !jlcResults.length) {
|
|
288947
288540
|
const sources = [
|
|
288948
288541
|
searchTscircuit && "tscircuit registry",
|
|
288949
288542
|
searchJlc && "JLCPCB",
|
|
288950
|
-
searchTi && "Texas Instruments",
|
|
288951
288543
|
searchKicad && "KiCad"
|
|
288952
288544
|
].filter(Boolean);
|
|
288953
288545
|
console.log(kleur_default.yellow(`No results found for "${query}" in ${sources.join(", ")}.`));
|
|
@@ -288974,19 +288566,6 @@ var registerSearch = (program3) => {
|
|
|
288974
288566
|
console.log(`${idx + 1}. ${comp.mfr} (C${comp.lcsc}) - ${comp.description} (stock: ${comp.stock.toLocaleString("en-US")})`);
|
|
288975
288567
|
});
|
|
288976
288568
|
}
|
|
288977
|
-
if (tiResults.length) {
|
|
288978
|
-
console.log(kleur_default.bold().underline(`Found ${tiResults.length} component(s) from Texas Instruments:`));
|
|
288979
|
-
tiResults.forEach((part, idx) => {
|
|
288980
|
-
const mpn = part.mpn ?? part.manufacturer_part_number ?? part.name ?? "?";
|
|
288981
|
-
const assets = [
|
|
288982
|
-
part.symbol_available === true && "symbol",
|
|
288983
|
-
part.footprint_available === true && "footprint",
|
|
288984
|
-
part.threed_available === true && "3D model"
|
|
288985
|
-
].filter(Boolean);
|
|
288986
|
-
const assetStr = assets.length ? ` - ${assets.join(", ")} available` : "";
|
|
288987
|
-
console.log(`${idx + 1}. ${mpn}${assetStr}`);
|
|
288988
|
-
});
|
|
288989
|
-
}
|
|
288990
288569
|
console.log(`
|
|
288991
288570
|
`);
|
|
288992
288571
|
});
|