@circuit-forge/eda-core 1.0.0

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.
Files changed (75) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +50 -0
  3. package/dist/erc/checker.d.ts +15 -0
  4. package/dist/erc/checker.d.ts.map +1 -0
  5. package/dist/erc/checker.js +267 -0
  6. package/dist/erc/checker.js.map +1 -0
  7. package/dist/erc/codes.d.ts +15 -0
  8. package/dist/erc/codes.d.ts.map +1 -0
  9. package/dist/erc/codes.js +48 -0
  10. package/dist/erc/codes.js.map +1 -0
  11. package/dist/erc/index.d.ts +7 -0
  12. package/dist/erc/index.d.ts.map +1 -0
  13. package/dist/erc/index.js +14 -0
  14. package/dist/erc/index.js.map +1 -0
  15. package/dist/index.d.ts +20 -0
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/index.js +79 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/netlist/generator.d.ts +32 -0
  20. package/dist/netlist/generator.d.ts.map +1 -0
  21. package/dist/netlist/generator.js +183 -0
  22. package/dist/netlist/generator.js.map +1 -0
  23. package/dist/netlist/index.d.ts +6 -0
  24. package/dist/netlist/index.d.ts.map +1 -0
  25. package/dist/netlist/index.js +20 -0
  26. package/dist/netlist/index.js.map +1 -0
  27. package/dist/netlist/sanitizer.d.ts +45 -0
  28. package/dist/netlist/sanitizer.d.ts.map +1 -0
  29. package/dist/netlist/sanitizer.js +145 -0
  30. package/dist/netlist/sanitizer.js.map +1 -0
  31. package/dist/parser/csv-parser.d.ts +27 -0
  32. package/dist/parser/csv-parser.d.ts.map +1 -0
  33. package/dist/parser/csv-parser.js +198 -0
  34. package/dist/parser/csv-parser.js.map +1 -0
  35. package/dist/parser/index.d.ts +6 -0
  36. package/dist/parser/index.d.ts.map +1 -0
  37. package/dist/parser/index.js +15 -0
  38. package/dist/parser/index.js.map +1 -0
  39. package/dist/parser/netlist-parser.d.ts +25 -0
  40. package/dist/parser/netlist-parser.d.ts.map +1 -0
  41. package/dist/parser/netlist-parser.js +260 -0
  42. package/dist/parser/netlist-parser.js.map +1 -0
  43. package/dist/schemas/analysis.schema.d.ts +298 -0
  44. package/dist/schemas/analysis.schema.d.ts.map +1 -0
  45. package/dist/schemas/analysis.schema.js +91 -0
  46. package/dist/schemas/analysis.schema.js.map +1 -0
  47. package/dist/schemas/circuit.schema.d.ts +405 -0
  48. package/dist/schemas/circuit.schema.d.ts.map +1 -0
  49. package/dist/schemas/circuit.schema.js +121 -0
  50. package/dist/schemas/circuit.schema.js.map +1 -0
  51. package/dist/types/analysis.d.ts +61 -0
  52. package/dist/types/analysis.d.ts.map +1 -0
  53. package/dist/types/analysis.js +119 -0
  54. package/dist/types/analysis.js.map +1 -0
  55. package/dist/types/circuit.d.ts +94 -0
  56. package/dist/types/circuit.d.ts.map +1 -0
  57. package/dist/types/circuit.js +32 -0
  58. package/dist/types/circuit.js.map +1 -0
  59. package/dist/types/erc.d.ts +68 -0
  60. package/dist/types/erc.d.ts.map +1 -0
  61. package/dist/types/erc.js +33 -0
  62. package/dist/types/erc.js.map +1 -0
  63. package/dist/types/simulation.d.ts +61 -0
  64. package/dist/types/simulation.d.ts.map +1 -0
  65. package/dist/types/simulation.js +43 -0
  66. package/dist/types/simulation.js.map +1 -0
  67. package/dist/utils/index.d.ts +5 -0
  68. package/dist/utils/index.d.ts.map +1 -0
  69. package/dist/utils/index.js +14 -0
  70. package/dist/utils/index.js.map +1 -0
  71. package/dist/utils/unit-parser.d.ts +47 -0
  72. package/dist/utils/unit-parser.d.ts.map +1 -0
  73. package/dist/utils/unit-parser.js +229 -0
  74. package/dist/utils/unit-parser.js.map +1 -0
  75. package/package.json +58 -0
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SimulationRequestSchema = exports.ProbeSchema = exports.AnalysisConfigSchema = exports.OpAnalysisSchema = exports.DcAnalysisSchema = exports.AcAnalysisSchema = exports.TranAnalysisSchema = exports.SpiceValueSchema = void 0;
4
+ exports.validateAnalysisConfig = validateAnalysisConfig;
5
+ exports.safeValidateAnalysisConfig = safeValidateAnalysisConfig;
6
+ exports.validateSimulationRequest = validateSimulationRequest;
7
+ /**
8
+ * Zod schemas for analysis configuration validation
9
+ */
10
+ const zod_1 = require("zod");
11
+ /**
12
+ * SPICE value format - number with optional suffix
13
+ */
14
+ exports.SpiceValueSchema = zod_1.z.string().regex(/^[+-]?\d*\.?\d+(?:[eE][+-]?\d+)?\s*[a-zA-Z]*$/, 'Invalid SPICE value format');
15
+ /**
16
+ * Transient analysis schema
17
+ */
18
+ exports.TranAnalysisSchema = zod_1.z.object({
19
+ type: zod_1.z.literal('tran'),
20
+ stopTime: exports.SpiceValueSchema,
21
+ stepTime: exports.SpiceValueSchema.optional(),
22
+ startTime: exports.SpiceValueSchema.optional(),
23
+ maxStep: exports.SpiceValueSchema.optional(),
24
+ uic: zod_1.z.boolean().optional(),
25
+ });
26
+ /**
27
+ * AC analysis schema
28
+ */
29
+ exports.AcAnalysisSchema = zod_1.z.object({
30
+ type: zod_1.z.literal('ac'),
31
+ variation: zod_1.z.enum(['dec', 'oct', 'lin']),
32
+ points: zod_1.z.number().int().positive().max(10000),
33
+ startFreq: exports.SpiceValueSchema,
34
+ stopFreq: exports.SpiceValueSchema,
35
+ });
36
+ /**
37
+ * DC analysis schema
38
+ */
39
+ exports.DcAnalysisSchema = zod_1.z.object({
40
+ type: zod_1.z.literal('dc'),
41
+ source: zod_1.z.string().regex(/^[A-Z][A-Z0-9]*[0-9]+$/i, 'Invalid source designator'),
42
+ startVal: exports.SpiceValueSchema,
43
+ stopVal: exports.SpiceValueSchema,
44
+ increment: exports.SpiceValueSchema,
45
+ });
46
+ /**
47
+ * Operating point analysis schema
48
+ */
49
+ exports.OpAnalysisSchema = zod_1.z.object({
50
+ type: zod_1.z.literal('op'),
51
+ });
52
+ /**
53
+ * Combined analysis config schema
54
+ */
55
+ exports.AnalysisConfigSchema = zod_1.z.discriminatedUnion('type', [
56
+ exports.TranAnalysisSchema,
57
+ exports.AcAnalysisSchema,
58
+ exports.DcAnalysisSchema,
59
+ exports.OpAnalysisSchema,
60
+ ]);
61
+ /**
62
+ * Probe schema
63
+ */
64
+ exports.ProbeSchema = zod_1.z.string().regex(/^[vi]\([a-zA-Z0-9_]+(?:,[a-zA-Z0-9_]+)?\)$/i, 'Invalid probe format. Use v(node) or i(device)');
65
+ /**
66
+ * Simulation request schema
67
+ */
68
+ exports.SimulationRequestSchema = zod_1.z.object({
69
+ analysisConfig: exports.AnalysisConfigSchema,
70
+ probes: zod_1.z.array(exports.ProbeSchema).max(100).optional(),
71
+ modelAssets: zod_1.z.array(zod_1.z.string().uuid()).max(10).optional(),
72
+ });
73
+ /**
74
+ * Validate analysis config
75
+ */
76
+ function validateAnalysisConfig(data) {
77
+ return exports.AnalysisConfigSchema.parse(data);
78
+ }
79
+ /**
80
+ * Safe validate analysis config
81
+ */
82
+ function safeValidateAnalysisConfig(data) {
83
+ return exports.AnalysisConfigSchema.safeParse(data);
84
+ }
85
+ /**
86
+ * Validate simulation request
87
+ */
88
+ function validateSimulationRequest(data) {
89
+ return exports.SimulationRequestSchema.parse(data);
90
+ }
91
+ //# sourceMappingURL=analysis.schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analysis.schema.js","sourceRoot":"","sources":["../../src/schemas/analysis.schema.ts"],"names":[],"mappings":";;;AA2FA,wDAEC;AAKD,gEAIC;AAKD,8DAEC;AA7GD;;GAEG;AACH,6BAAwB;AAExB;;GAEG;AACU,QAAA,gBAAgB,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAC5C,+CAA+C,EAC/C,4BAA4B,CAC/B,CAAC;AAEF;;GAEG;AACU,QAAA,kBAAkB,GAAG,OAAC,CAAC,MAAM,CAAC;IACvC,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,MAAM,CAAC;IACvB,QAAQ,EAAE,wBAAgB;IAC1B,QAAQ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AAC,CAAC,MAAM,EAAE,CAAC,KAAK,CACvC,6CAA6C,EAC7C,gDAAgD,CACnD,CAAC;AAEF;;GAEG;AACU,QAAA,uBAAuB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC5C,cAAc,EAAE,4BAAoB;IACpC,MAAM,EAAE,OAAC,CAAC,KAAK,CAAC,mBAAW,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IAChD,WAAW,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE;CAC7D,CAAC,CAAC;AASH;;GAEG;AACH,SAAgB,sBAAsB,CAAC,IAAa;IAChD,OAAO,4BAAoB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC;AAED;;GAEG;AACH,SAAgB,0BAA0B,CACtC,IAAa;IAEb,OAAO,4BAAoB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AAChD,CAAC;AAED;;GAEG;AACH,SAAgB,yBAAyB,CAAC,IAAa;IACnD,OAAO,+BAAuB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,405 @@
1
+ /**
2
+ * Zod schemas for circuit validation
3
+ */
4
+ import { z } from 'zod';
5
+ /**
6
+ * Component type enum schema
7
+ */
8
+ export declare const ComponentTypeSchema: z.ZodEnum<["resistor", "capacitor", "inductor", "voltage_source", "current_source", "diode", "ground"]>;
9
+ /**
10
+ * Pin connection schema
11
+ */
12
+ export declare const PinConnectionSchema: z.ZodObject<{
13
+ pinId: z.ZodString;
14
+ netId: z.ZodString;
15
+ }, "strip", z.ZodTypeAny, {
16
+ pinId: string;
17
+ netId: string;
18
+ }, {
19
+ pinId: string;
20
+ netId: string;
21
+ }>;
22
+ /**
23
+ * Component schema
24
+ */
25
+ export declare const ComponentSchema: z.ZodObject<{
26
+ id: z.ZodString;
27
+ type: z.ZodEnum<["resistor", "capacitor", "inductor", "voltage_source", "current_source", "diode", "ground"]>;
28
+ designator: z.ZodString;
29
+ value: z.ZodOptional<z.ZodString>;
30
+ model: z.ZodOptional<z.ZodString>;
31
+ pins: z.ZodArray<z.ZodObject<{
32
+ pinId: z.ZodString;
33
+ netId: z.ZodString;
34
+ }, "strip", z.ZodTypeAny, {
35
+ pinId: string;
36
+ netId: string;
37
+ }, {
38
+ pinId: string;
39
+ netId: string;
40
+ }>, "many">;
41
+ properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
42
+ }, "strip", z.ZodTypeAny, {
43
+ type: "resistor" | "capacitor" | "inductor" | "voltage_source" | "current_source" | "diode" | "ground";
44
+ id: string;
45
+ designator: string;
46
+ pins: {
47
+ pinId: string;
48
+ netId: string;
49
+ }[];
50
+ value?: string | undefined;
51
+ model?: string | undefined;
52
+ properties?: Record<string, unknown> | undefined;
53
+ }, {
54
+ type: "resistor" | "capacitor" | "inductor" | "voltage_source" | "current_source" | "diode" | "ground";
55
+ id: string;
56
+ designator: string;
57
+ pins: {
58
+ pinId: string;
59
+ netId: string;
60
+ }[];
61
+ value?: string | undefined;
62
+ model?: string | undefined;
63
+ properties?: Record<string, unknown> | undefined;
64
+ }>;
65
+ /**
66
+ * Net schema
67
+ */
68
+ export declare const NetSchema: z.ZodObject<{
69
+ id: z.ZodString;
70
+ name: z.ZodString;
71
+ isGround: z.ZodOptional<z.ZodBoolean>;
72
+ }, "strip", z.ZodTypeAny, {
73
+ id: string;
74
+ name: string;
75
+ isGround?: boolean | undefined;
76
+ }, {
77
+ id: string;
78
+ name: string;
79
+ isGround?: boolean | undefined;
80
+ }>;
81
+ /**
82
+ * Circuit metadata schema
83
+ */
84
+ export declare const CircuitMetadataSchema: z.ZodObject<{
85
+ name: z.ZodOptional<z.ZodString>;
86
+ description: z.ZodOptional<z.ZodString>;
87
+ author: z.ZodOptional<z.ZodString>;
88
+ createdAt: z.ZodOptional<z.ZodString>;
89
+ updatedAt: z.ZodOptional<z.ZodString>;
90
+ }, "strip", z.ZodTypeAny, {
91
+ name?: string | undefined;
92
+ description?: string | undefined;
93
+ author?: string | undefined;
94
+ createdAt?: string | undefined;
95
+ updatedAt?: string | undefined;
96
+ }, {
97
+ name?: string | undefined;
98
+ description?: string | undefined;
99
+ author?: string | undefined;
100
+ createdAt?: string | undefined;
101
+ updatedAt?: string | undefined;
102
+ }>;
103
+ /**
104
+ * Main CircuitJson schema
105
+ */
106
+ export declare const CircuitJsonSchema: z.ZodObject<{
107
+ version: z.ZodString;
108
+ components: z.ZodArray<z.ZodObject<{
109
+ id: z.ZodString;
110
+ type: z.ZodEnum<["resistor", "capacitor", "inductor", "voltage_source", "current_source", "diode", "ground"]>;
111
+ designator: z.ZodString;
112
+ value: z.ZodOptional<z.ZodString>;
113
+ model: z.ZodOptional<z.ZodString>;
114
+ pins: z.ZodArray<z.ZodObject<{
115
+ pinId: z.ZodString;
116
+ netId: z.ZodString;
117
+ }, "strip", z.ZodTypeAny, {
118
+ pinId: string;
119
+ netId: string;
120
+ }, {
121
+ pinId: string;
122
+ netId: string;
123
+ }>, "many">;
124
+ properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
125
+ }, "strip", z.ZodTypeAny, {
126
+ type: "resistor" | "capacitor" | "inductor" | "voltage_source" | "current_source" | "diode" | "ground";
127
+ id: string;
128
+ designator: string;
129
+ pins: {
130
+ pinId: string;
131
+ netId: string;
132
+ }[];
133
+ value?: string | undefined;
134
+ model?: string | undefined;
135
+ properties?: Record<string, unknown> | undefined;
136
+ }, {
137
+ type: "resistor" | "capacitor" | "inductor" | "voltage_source" | "current_source" | "diode" | "ground";
138
+ id: string;
139
+ designator: string;
140
+ pins: {
141
+ pinId: string;
142
+ netId: string;
143
+ }[];
144
+ value?: string | undefined;
145
+ model?: string | undefined;
146
+ properties?: Record<string, unknown> | undefined;
147
+ }>, "many">;
148
+ nets: z.ZodArray<z.ZodObject<{
149
+ id: z.ZodString;
150
+ name: z.ZodString;
151
+ isGround: z.ZodOptional<z.ZodBoolean>;
152
+ }, "strip", z.ZodTypeAny, {
153
+ id: string;
154
+ name: string;
155
+ isGround?: boolean | undefined;
156
+ }, {
157
+ id: string;
158
+ name: string;
159
+ isGround?: boolean | undefined;
160
+ }>, "many">;
161
+ metadata: z.ZodOptional<z.ZodObject<{
162
+ name: z.ZodOptional<z.ZodString>;
163
+ description: z.ZodOptional<z.ZodString>;
164
+ author: z.ZodOptional<z.ZodString>;
165
+ createdAt: z.ZodOptional<z.ZodString>;
166
+ updatedAt: z.ZodOptional<z.ZodString>;
167
+ }, "strip", z.ZodTypeAny, {
168
+ name?: string | undefined;
169
+ description?: string | undefined;
170
+ author?: string | undefined;
171
+ createdAt?: string | undefined;
172
+ updatedAt?: string | undefined;
173
+ }, {
174
+ name?: string | undefined;
175
+ description?: string | undefined;
176
+ author?: string | undefined;
177
+ createdAt?: string | undefined;
178
+ updatedAt?: string | undefined;
179
+ }>>;
180
+ }, "strip", z.ZodTypeAny, {
181
+ version: string;
182
+ components: {
183
+ type: "resistor" | "capacitor" | "inductor" | "voltage_source" | "current_source" | "diode" | "ground";
184
+ id: string;
185
+ designator: string;
186
+ pins: {
187
+ pinId: string;
188
+ netId: string;
189
+ }[];
190
+ value?: string | undefined;
191
+ model?: string | undefined;
192
+ properties?: Record<string, unknown> | undefined;
193
+ }[];
194
+ nets: {
195
+ id: string;
196
+ name: string;
197
+ isGround?: boolean | undefined;
198
+ }[];
199
+ metadata?: {
200
+ name?: string | undefined;
201
+ description?: string | undefined;
202
+ author?: string | undefined;
203
+ createdAt?: string | undefined;
204
+ updatedAt?: string | undefined;
205
+ } | undefined;
206
+ }, {
207
+ version: string;
208
+ components: {
209
+ type: "resistor" | "capacitor" | "inductor" | "voltage_source" | "current_source" | "diode" | "ground";
210
+ id: string;
211
+ designator: string;
212
+ pins: {
213
+ pinId: string;
214
+ netId: string;
215
+ }[];
216
+ value?: string | undefined;
217
+ model?: string | undefined;
218
+ properties?: Record<string, unknown> | undefined;
219
+ }[];
220
+ nets: {
221
+ id: string;
222
+ name: string;
223
+ isGround?: boolean | undefined;
224
+ }[];
225
+ metadata?: {
226
+ name?: string | undefined;
227
+ description?: string | undefined;
228
+ author?: string | undefined;
229
+ createdAt?: string | undefined;
230
+ updatedAt?: string | undefined;
231
+ } | undefined;
232
+ }>;
233
+ /**
234
+ * Viewport schema
235
+ */
236
+ export declare const ViewportSchema: z.ZodObject<{
237
+ x: z.ZodNumber;
238
+ y: z.ZodNumber;
239
+ zoom: z.ZodNumber;
240
+ }, "strip", z.ZodTypeAny, {
241
+ x: number;
242
+ y: number;
243
+ zoom: number;
244
+ }, {
245
+ x: number;
246
+ y: number;
247
+ zoom: number;
248
+ }>;
249
+ /**
250
+ * Position schema
251
+ */
252
+ export declare const PositionSchema: z.ZodObject<{
253
+ x: z.ZodNumber;
254
+ y: z.ZodNumber;
255
+ rotation: z.ZodOptional<z.ZodEnum<["0", "90", "180", "270"]>>;
256
+ }, "strip", z.ZodTypeAny, {
257
+ x: number;
258
+ y: number;
259
+ rotation?: "0" | "90" | "180" | "270" | undefined;
260
+ }, {
261
+ x: number;
262
+ y: number;
263
+ rotation?: "0" | "90" | "180" | "270" | undefined;
264
+ }>;
265
+ /**
266
+ * Wire schema
267
+ */
268
+ export declare const WireSchema: z.ZodObject<{
269
+ netId: z.ZodString;
270
+ points: z.ZodArray<z.ZodObject<{
271
+ x: z.ZodNumber;
272
+ y: z.ZodNumber;
273
+ }, "strip", z.ZodTypeAny, {
274
+ x: number;
275
+ y: number;
276
+ }, {
277
+ x: number;
278
+ y: number;
279
+ }>, "many">;
280
+ }, "strip", z.ZodTypeAny, {
281
+ netId: string;
282
+ points: {
283
+ x: number;
284
+ y: number;
285
+ }[];
286
+ }, {
287
+ netId: string;
288
+ points: {
289
+ x: number;
290
+ y: number;
291
+ }[];
292
+ }>;
293
+ /**
294
+ * UI JSON schema
295
+ */
296
+ export declare const UiJsonSchema: z.ZodObject<{
297
+ viewport: z.ZodOptional<z.ZodObject<{
298
+ x: z.ZodNumber;
299
+ y: z.ZodNumber;
300
+ zoom: z.ZodNumber;
301
+ }, "strip", z.ZodTypeAny, {
302
+ x: number;
303
+ y: number;
304
+ zoom: number;
305
+ }, {
306
+ x: number;
307
+ y: number;
308
+ zoom: number;
309
+ }>>;
310
+ positions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
311
+ x: z.ZodNumber;
312
+ y: z.ZodNumber;
313
+ rotation: z.ZodOptional<z.ZodEnum<["0", "90", "180", "270"]>>;
314
+ }, "strip", z.ZodTypeAny, {
315
+ x: number;
316
+ y: number;
317
+ rotation?: "0" | "90" | "180" | "270" | undefined;
318
+ }, {
319
+ x: number;
320
+ y: number;
321
+ rotation?: "0" | "90" | "180" | "270" | undefined;
322
+ }>>>;
323
+ wires: z.ZodOptional<z.ZodArray<z.ZodObject<{
324
+ netId: z.ZodString;
325
+ points: z.ZodArray<z.ZodObject<{
326
+ x: z.ZodNumber;
327
+ y: z.ZodNumber;
328
+ }, "strip", z.ZodTypeAny, {
329
+ x: number;
330
+ y: number;
331
+ }, {
332
+ x: number;
333
+ y: number;
334
+ }>, "many">;
335
+ }, "strip", z.ZodTypeAny, {
336
+ netId: string;
337
+ points: {
338
+ x: number;
339
+ y: number;
340
+ }[];
341
+ }, {
342
+ netId: string;
343
+ points: {
344
+ x: number;
345
+ y: number;
346
+ }[];
347
+ }>, "many">>;
348
+ }, "strip", z.ZodTypeAny, {
349
+ viewport?: {
350
+ x: number;
351
+ y: number;
352
+ zoom: number;
353
+ } | undefined;
354
+ positions?: Record<string, {
355
+ x: number;
356
+ y: number;
357
+ rotation?: "0" | "90" | "180" | "270" | undefined;
358
+ }> | undefined;
359
+ wires?: {
360
+ netId: string;
361
+ points: {
362
+ x: number;
363
+ y: number;
364
+ }[];
365
+ }[] | undefined;
366
+ }, {
367
+ viewport?: {
368
+ x: number;
369
+ y: number;
370
+ zoom: number;
371
+ } | undefined;
372
+ positions?: Record<string, {
373
+ x: number;
374
+ y: number;
375
+ rotation?: "0" | "90" | "180" | "270" | undefined;
376
+ }> | undefined;
377
+ wires?: {
378
+ netId: string;
379
+ points: {
380
+ x: number;
381
+ y: number;
382
+ }[];
383
+ }[] | undefined;
384
+ }>;
385
+ /**
386
+ * Type exports from schemas
387
+ */
388
+ export type CircuitJsonInput = z.input<typeof CircuitJsonSchema>;
389
+ export type CircuitJsonOutput = z.output<typeof CircuitJsonSchema>;
390
+ export type ComponentInput = z.input<typeof ComponentSchema>;
391
+ export type NetInput = z.input<typeof NetSchema>;
392
+ export type UiJsonInput = z.input<typeof UiJsonSchema>;
393
+ /**
394
+ * Validate circuit JSON
395
+ */
396
+ export declare function validateCircuitJson(data: unknown): CircuitJsonOutput;
397
+ /**
398
+ * Safe validate circuit JSON (returns result instead of throwing)
399
+ */
400
+ export declare function safeValidateCircuitJson(data: unknown): z.SafeParseReturnType<CircuitJsonInput, CircuitJsonOutput>;
401
+ /**
402
+ * Validate UI JSON
403
+ */
404
+ export declare function validateUiJson(data: unknown): z.output<typeof UiJsonSchema>;
405
+ //# sourceMappingURL=circuit.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"circuit.schema.d.ts","sourceRoot":"","sources":["../../src/schemas/circuit.schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,eAAO,MAAM,mBAAmB,yGAQ9B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;EAG9B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQ1B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;EAIpB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;EAMh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EAAE,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,YAAY,CAAC,CAE3E"}
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UiJsonSchema = exports.WireSchema = exports.PositionSchema = exports.ViewportSchema = exports.CircuitJsonSchema = exports.CircuitMetadataSchema = exports.NetSchema = exports.ComponentSchema = exports.PinConnectionSchema = exports.ComponentTypeSchema = void 0;
4
+ exports.validateCircuitJson = validateCircuitJson;
5
+ exports.safeValidateCircuitJson = safeValidateCircuitJson;
6
+ exports.validateUiJson = validateUiJson;
7
+ /**
8
+ * Zod schemas for circuit validation
9
+ */
10
+ const zod_1 = require("zod");
11
+ /**
12
+ * Component type enum schema
13
+ */
14
+ exports.ComponentTypeSchema = zod_1.z.enum([
15
+ 'resistor',
16
+ 'capacitor',
17
+ 'inductor',
18
+ 'voltage_source',
19
+ 'current_source',
20
+ 'diode',
21
+ 'ground',
22
+ ]);
23
+ /**
24
+ * Pin connection schema
25
+ */
26
+ exports.PinConnectionSchema = zod_1.z.object({
27
+ pinId: zod_1.z.string().min(1).max(50),
28
+ netId: zod_1.z.string().min(1).max(100),
29
+ });
30
+ /**
31
+ * Component schema
32
+ */
33
+ exports.ComponentSchema = zod_1.z.object({
34
+ id: zod_1.z.string().min(1).max(100),
35
+ type: exports.ComponentTypeSchema,
36
+ designator: zod_1.z.string().regex(/^[A-Z][A-Z0-9]*[0-9]+$/i, 'Invalid designator format'),
37
+ value: zod_1.z.string().max(100).optional(),
38
+ model: zod_1.z.string().max(100).optional(),
39
+ pins: zod_1.z.array(exports.PinConnectionSchema).min(1).max(20),
40
+ properties: zod_1.z.record(zod_1.z.unknown()).optional(),
41
+ });
42
+ /**
43
+ * Net schema
44
+ */
45
+ exports.NetSchema = zod_1.z.object({
46
+ id: zod_1.z.string().min(1).max(100),
47
+ name: zod_1.z.string().min(1).max(100),
48
+ isGround: zod_1.z.boolean().optional(),
49
+ });
50
+ /**
51
+ * Circuit metadata schema
52
+ */
53
+ exports.CircuitMetadataSchema = zod_1.z.object({
54
+ name: zod_1.z.string().max(200).optional(),
55
+ description: zod_1.z.string().max(2000).optional(),
56
+ author: zod_1.z.string().max(100).optional(),
57
+ createdAt: zod_1.z.string().optional(),
58
+ updatedAt: zod_1.z.string().optional(),
59
+ });
60
+ /**
61
+ * Main CircuitJson schema
62
+ */
63
+ exports.CircuitJsonSchema = zod_1.z.object({
64
+ version: zod_1.z.string().regex(/^\d+\.\d+$/),
65
+ components: zod_1.z.array(exports.ComponentSchema).max(1000),
66
+ nets: zod_1.z.array(exports.NetSchema).max(1000),
67
+ metadata: exports.CircuitMetadataSchema.optional(),
68
+ });
69
+ /**
70
+ * Viewport schema
71
+ */
72
+ exports.ViewportSchema = zod_1.z.object({
73
+ x: zod_1.z.number(),
74
+ y: zod_1.z.number(),
75
+ zoom: zod_1.z.number().positive(),
76
+ });
77
+ /**
78
+ * Position schema
79
+ */
80
+ exports.PositionSchema = zod_1.z.object({
81
+ x: zod_1.z.number(),
82
+ y: zod_1.z.number(),
83
+ rotation: zod_1.z.enum(['0', '90', '180', '270']).optional(),
84
+ });
85
+ /**
86
+ * Wire schema
87
+ */
88
+ exports.WireSchema = zod_1.z.object({
89
+ netId: zod_1.z.string(),
90
+ points: zod_1.z.array(zod_1.z.object({
91
+ x: zod_1.z.number(),
92
+ y: zod_1.z.number(),
93
+ })),
94
+ });
95
+ /**
96
+ * UI JSON schema
97
+ */
98
+ exports.UiJsonSchema = zod_1.z.object({
99
+ viewport: exports.ViewportSchema.optional(),
100
+ positions: zod_1.z.record(exports.PositionSchema).optional(),
101
+ wires: zod_1.z.array(exports.WireSchema).optional(),
102
+ });
103
+ /**
104
+ * Validate circuit JSON
105
+ */
106
+ function validateCircuitJson(data) {
107
+ return exports.CircuitJsonSchema.parse(data);
108
+ }
109
+ /**
110
+ * Safe validate circuit JSON (returns result instead of throwing)
111
+ */
112
+ function safeValidateCircuitJson(data) {
113
+ return exports.CircuitJsonSchema.safeParse(data);
114
+ }
115
+ /**
116
+ * Validate UI JSON
117
+ */
118
+ function validateUiJson(data) {
119
+ return exports.UiJsonSchema.parse(data);
120
+ }
121
+ //# sourceMappingURL=circuit.schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"circuit.schema.js","sourceRoot":"","sources":["../../src/schemas/circuit.schema.ts"],"names":[],"mappings":";;;AAyHA,kDAEC;AAKD,0DAIC;AAKD,wCAEC;AA3ID;;GAEG;AACH,6BAAwB;AAExB;;GAEG;AACU,QAAA,mBAAmB,GAAG,OAAC,CAAC,IAAI,CAAC;IACtC,UAAU;IACV,WAAW;IACX,UAAU;IACV,gBAAgB;IAChB,gBAAgB;IAChB,OAAO;IACP,QAAQ;CACX,CAAC,CAAC;AAEH;;GAEG;AACU,QAAA,mBAAmB,GAAG,OAAC,CAAC,MAAM,CAAC;IACxC,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;IAChC,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;CACpC,CAAC,CAAC;AAEH;;GAEG;AACU,QAAA,eAAe,GAAG,OAAC,CAAC,MAAM,CAAC;IACpC,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IAC9B,IAAI,EAAE,2BAAmB;IACzB,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,yBAAyB,EAAE,2BAA2B,CAAC;IACpF,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IACrC,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IACr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,EAAE;CACxC,CAAC,CAAC;AAWH;;GAEG;AACH,SAAgB,mBAAmB,CAAC,IAAa;IAC7C,OAAO,yBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AACzC,CAAC;AAED;;GAEG;AACH,SAAgB,uBAAuB,CACnC,IAAa;IAEb,OAAO,yBAAiB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AAC7C,CAAC;AAED;;GAEG;AACH,SAAgB,cAAc,CAAC,IAAa;IACxC,OAAO,oBAAY,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AACpC,CAAC"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Analysis configuration types for SPICE simulations
3
+ */
4
+ /**
5
+ * Union type for all analysis configurations
6
+ */
7
+ export type AnalysisConfig = TranAnalysis | AcAnalysis | DcAnalysis | OpAnalysis;
8
+ /**
9
+ * Transient analysis - time domain simulation
10
+ */
11
+ export interface TranAnalysis {
12
+ type: 'tran';
13
+ stopTime: string;
14
+ stepTime?: string;
15
+ startTime?: string;
16
+ maxStep?: string;
17
+ uic?: boolean;
18
+ }
19
+ /**
20
+ * AC analysis - frequency domain (small-signal)
21
+ */
22
+ export interface AcAnalysis {
23
+ type: 'ac';
24
+ variation: 'dec' | 'oct' | 'lin';
25
+ points: number;
26
+ startFreq: string;
27
+ stopFreq: string;
28
+ }
29
+ /**
30
+ * DC analysis - DC sweep
31
+ */
32
+ export interface DcAnalysis {
33
+ type: 'dc';
34
+ source: string;
35
+ startVal: string;
36
+ stopVal: string;
37
+ increment: string;
38
+ }
39
+ /**
40
+ * Operating point analysis - single DC solution
41
+ */
42
+ export interface OpAnalysis {
43
+ type: 'op';
44
+ }
45
+ /**
46
+ * Get the analysis type string
47
+ */
48
+ export declare function getAnalysisType(config: AnalysisConfig): string;
49
+ /**
50
+ * Convert analysis config to SPICE command
51
+ */
52
+ export declare function analysisToSpice(config: AnalysisConfig): string;
53
+ /**
54
+ * Parse a SPICE value string to a number
55
+ */
56
+ export declare function parseSpiceValue(value: string): number;
57
+ /**
58
+ * Format a number as a SPICE value string
59
+ */
60
+ export declare function formatSpiceValue(value: number): string;
61
+ //# sourceMappingURL=analysis.d.ts.map