@tscircuit/fake-snippets 0.0.73 → 0.0.75
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/bundle.js +250 -202
- package/dist/index.d.ts +72 -2
- package/dist/index.js +24 -7
- package/dist/schema.d.ts +112 -0
- package/dist/schema.js +18 -1
- package/fake-snippets-api/lib/db/db-client.ts +11 -7
- package/fake-snippets-api/lib/db/schema.ts +25 -0
- package/fake-snippets-api/routes/api/package_releases/rebuild.ts +32 -0
- package/fake-snippets-api/routes/api/package_releases/update.ts +4 -1
- package/package.json +1 -1
- package/src/components/DownloadButtonAndMenu.tsx +26 -8
- package/src/components/Header.tsx +7 -7
- package/src/components/PackageBuildsPage/ErrorObject.ts +12 -0
- package/src/components/PackageBuildsPage/LogContent.tsx +32 -0
- package/src/components/PackageBuildsPage/PackageBuildDetailsPage.tsx +114 -0
- package/src/components/PackageBuildsPage/build-preview-content.tsx +21 -5
- package/src/components/PackageBuildsPage/capitalCase.ts +4 -0
- package/src/components/PackageBuildsPage/collapsible-section.tsx +34 -9
- package/src/components/PackageBuildsPage/getColorForDisplayStatus.ts +17 -0
- package/src/components/PackageBuildsPage/package-build-details-panel.tsx +147 -0
- package/src/components/PackageBuildsPage/{deployment-header.tsx → package-build-header.tsx} +16 -31
- package/src/components/ViewPackagePage/components/main-content-header.tsx +1 -1
- package/src/components/ViewPackagePage/components/package-header.tsx +0 -1
- package/src/components/dialogs/pcb-download-dialog.tsx +113 -0
- package/src/components/package-port/CodeAndPreview.tsx +3 -2
- package/src/components/package-port/CodeEditor.tsx +4 -2
- package/src/hooks/use-create-package-mutation.ts +0 -7
- package/src/hooks/use-current-package-release.ts +28 -0
- package/src/hooks/useFileManagement.ts +26 -21
- package/src/lib/download-fns/download-pcb-svg.ts +35 -0
- package/src/lib/utils/timeAgo.ts +14 -3
- package/src/pages/package-builds.tsx +2 -2
- package/src/components/PackageBuildsPage/DeploymentDetailsPage.tsx +0 -56
- package/src/components/PackageBuildsPage/deployment-details-panel.tsx +0 -84
package/dist/index.d.ts
CHANGED
|
@@ -421,6 +421,20 @@ declare const packageReleaseSchema: z.ZodObject<{
|
|
|
421
421
|
has_transpiled: z.ZodDefault<z.ZodBoolean>;
|
|
422
422
|
transpilation_error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
423
423
|
fs_sha: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
424
|
+
display_status: z.ZodDefault<z.ZodEnum<["pending", "building", "successful", "failed"]>>;
|
|
425
|
+
total_build_duration_ms: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
426
|
+
transpilation_display_status: z.ZodDefault<z.ZodEnum<["pending", "building", "successful", "failed"]>>;
|
|
427
|
+
transpilation_in_progress: z.ZodDefault<z.ZodBoolean>;
|
|
428
|
+
transpilation_started_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
429
|
+
transpilation_completed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
430
|
+
transpilation_logs: z.ZodDefault<z.ZodArray<z.ZodAny, "many">>;
|
|
431
|
+
transpilation_is_stale: z.ZodDefault<z.ZodBoolean>;
|
|
432
|
+
circuit_json_build_display_status: z.ZodDefault<z.ZodEnum<["pending", "building", "successful", "failed"]>>;
|
|
433
|
+
circuit_json_build_in_progress: z.ZodDefault<z.ZodBoolean>;
|
|
434
|
+
circuit_json_build_started_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
435
|
+
circuit_json_build_completed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
436
|
+
circuit_json_build_logs: z.ZodDefault<z.ZodArray<z.ZodAny, "many">>;
|
|
437
|
+
circuit_json_build_is_stale: z.ZodDefault<z.ZodBoolean>;
|
|
424
438
|
}, "strip", z.ZodTypeAny, {
|
|
425
439
|
package_release_id: string;
|
|
426
440
|
created_at: string;
|
|
@@ -429,12 +443,26 @@ declare const packageReleaseSchema: z.ZodObject<{
|
|
|
429
443
|
is_locked: boolean;
|
|
430
444
|
is_latest: boolean;
|
|
431
445
|
has_transpiled: boolean;
|
|
446
|
+
display_status: "pending" | "building" | "successful" | "failed";
|
|
447
|
+
transpilation_display_status: "pending" | "building" | "successful" | "failed";
|
|
448
|
+
transpilation_in_progress: boolean;
|
|
449
|
+
transpilation_logs: any[];
|
|
450
|
+
transpilation_is_stale: boolean;
|
|
451
|
+
circuit_json_build_display_status: "pending" | "building" | "successful" | "failed";
|
|
452
|
+
circuit_json_build_in_progress: boolean;
|
|
453
|
+
circuit_json_build_logs: any[];
|
|
454
|
+
circuit_json_build_is_stale: boolean;
|
|
432
455
|
commit_sha?: string | null | undefined;
|
|
433
456
|
license?: string | null | undefined;
|
|
434
457
|
circuit_json_build_error?: string | null | undefined;
|
|
435
458
|
circuit_json_build_error_last_updated_at?: string | null | undefined;
|
|
436
459
|
transpilation_error?: string | null | undefined;
|
|
437
460
|
fs_sha?: string | null | undefined;
|
|
461
|
+
total_build_duration_ms?: number | null | undefined;
|
|
462
|
+
transpilation_started_at?: string | null | undefined;
|
|
463
|
+
transpilation_completed_at?: string | null | undefined;
|
|
464
|
+
circuit_json_build_started_at?: string | null | undefined;
|
|
465
|
+
circuit_json_build_completed_at?: string | null | undefined;
|
|
438
466
|
}, {
|
|
439
467
|
package_release_id: string;
|
|
440
468
|
created_at: string;
|
|
@@ -449,6 +477,20 @@ declare const packageReleaseSchema: z.ZodObject<{
|
|
|
449
477
|
has_transpiled?: boolean | undefined;
|
|
450
478
|
transpilation_error?: string | null | undefined;
|
|
451
479
|
fs_sha?: string | null | undefined;
|
|
480
|
+
display_status?: "pending" | "building" | "successful" | "failed" | undefined;
|
|
481
|
+
total_build_duration_ms?: number | null | undefined;
|
|
482
|
+
transpilation_display_status?: "pending" | "building" | "successful" | "failed" | undefined;
|
|
483
|
+
transpilation_in_progress?: boolean | undefined;
|
|
484
|
+
transpilation_started_at?: string | null | undefined;
|
|
485
|
+
transpilation_completed_at?: string | null | undefined;
|
|
486
|
+
transpilation_logs?: any[] | undefined;
|
|
487
|
+
transpilation_is_stale?: boolean | undefined;
|
|
488
|
+
circuit_json_build_display_status?: "pending" | "building" | "successful" | "failed" | undefined;
|
|
489
|
+
circuit_json_build_in_progress?: boolean | undefined;
|
|
490
|
+
circuit_json_build_started_at?: string | null | undefined;
|
|
491
|
+
circuit_json_build_completed_at?: string | null | undefined;
|
|
492
|
+
circuit_json_build_logs?: any[] | undefined;
|
|
493
|
+
circuit_json_build_is_stale?: boolean | undefined;
|
|
452
494
|
}>;
|
|
453
495
|
type PackageRelease = z.infer<typeof packageReleaseSchema>;
|
|
454
496
|
declare const packageFileSchema: z.ZodObject<{
|
|
@@ -709,12 +751,26 @@ declare const createDatabase: ({ seed }?: {
|
|
|
709
751
|
is_locked: boolean;
|
|
710
752
|
is_latest: boolean;
|
|
711
753
|
has_transpiled: boolean;
|
|
754
|
+
display_status: "pending" | "building" | "successful" | "failed";
|
|
755
|
+
transpilation_display_status: "pending" | "building" | "successful" | "failed";
|
|
756
|
+
transpilation_in_progress: boolean;
|
|
757
|
+
transpilation_logs: any[];
|
|
758
|
+
transpilation_is_stale: boolean;
|
|
759
|
+
circuit_json_build_display_status: "pending" | "building" | "successful" | "failed";
|
|
760
|
+
circuit_json_build_in_progress: boolean;
|
|
761
|
+
circuit_json_build_logs: any[];
|
|
762
|
+
circuit_json_build_is_stale: boolean;
|
|
712
763
|
commit_sha?: string | null | undefined;
|
|
713
764
|
license?: string | null | undefined;
|
|
714
765
|
circuit_json_build_error?: string | null | undefined;
|
|
715
766
|
circuit_json_build_error_last_updated_at?: string | null | undefined;
|
|
716
767
|
transpilation_error?: string | null | undefined;
|
|
717
768
|
fs_sha?: string | null | undefined;
|
|
769
|
+
total_build_duration_ms?: number | null | undefined;
|
|
770
|
+
transpilation_started_at?: string | null | undefined;
|
|
771
|
+
transpilation_completed_at?: string | null | undefined;
|
|
772
|
+
circuit_json_build_started_at?: string | null | undefined;
|
|
773
|
+
circuit_json_build_completed_at?: string | null | undefined;
|
|
718
774
|
}[];
|
|
719
775
|
packageFiles: {
|
|
720
776
|
package_release_id: string;
|
|
@@ -960,7 +1016,7 @@ declare const createDatabase: ({ seed }?: {
|
|
|
960
1016
|
updatePackage: (packageId: string, updates: Partial<Package>) => Package | undefined;
|
|
961
1017
|
getPackageById: (packageId: string) => Package | undefined;
|
|
962
1018
|
getPackageReleaseById: (packageReleaseId: string) => PackageRelease | undefined;
|
|
963
|
-
addPackageRelease: (packageRelease: Omit<
|
|
1019
|
+
addPackageRelease: (packageRelease: Omit<z.input<typeof packageReleaseSchema>, "package_release_id">) => PackageRelease;
|
|
964
1020
|
updatePackageRelease: (packageRelease: PackageRelease) => void;
|
|
965
1021
|
deletePackageFile: (packageFileId: string) => boolean;
|
|
966
1022
|
addPackageFile: (packageFile: Omit<PackageFile, "package_file_id">) => PackageFile;
|
|
@@ -1005,12 +1061,26 @@ declare const createDatabase: ({ seed }?: {
|
|
|
1005
1061
|
is_locked: boolean;
|
|
1006
1062
|
is_latest: boolean;
|
|
1007
1063
|
has_transpiled: boolean;
|
|
1064
|
+
display_status: "pending" | "building" | "successful" | "failed";
|
|
1065
|
+
transpilation_display_status: "pending" | "building" | "successful" | "failed";
|
|
1066
|
+
transpilation_in_progress: boolean;
|
|
1067
|
+
transpilation_logs: any[];
|
|
1068
|
+
transpilation_is_stale: boolean;
|
|
1069
|
+
circuit_json_build_display_status: "pending" | "building" | "successful" | "failed";
|
|
1070
|
+
circuit_json_build_in_progress: boolean;
|
|
1071
|
+
circuit_json_build_logs: any[];
|
|
1072
|
+
circuit_json_build_is_stale: boolean;
|
|
1008
1073
|
commit_sha?: string | null | undefined;
|
|
1009
1074
|
license?: string | null | undefined;
|
|
1010
1075
|
circuit_json_build_error?: string | null | undefined;
|
|
1011
1076
|
circuit_json_build_error_last_updated_at?: string | null | undefined;
|
|
1012
1077
|
transpilation_error?: string | null | undefined;
|
|
1013
1078
|
fs_sha?: string | null | undefined;
|
|
1079
|
+
total_build_duration_ms?: number | null | undefined;
|
|
1080
|
+
transpilation_started_at?: string | null | undefined;
|
|
1081
|
+
transpilation_completed_at?: string | null | undefined;
|
|
1082
|
+
circuit_json_build_started_at?: string | null | undefined;
|
|
1083
|
+
circuit_json_build_completed_at?: string | null | undefined;
|
|
1014
1084
|
}[];
|
|
1015
1085
|
packageFiles: {
|
|
1016
1086
|
package_release_id: string;
|
|
@@ -1256,7 +1326,7 @@ declare const createDatabase: ({ seed }?: {
|
|
|
1256
1326
|
updatePackage: (packageId: string, updates: Partial<Package>) => Package | undefined;
|
|
1257
1327
|
getPackageById: (packageId: string) => Package | undefined;
|
|
1258
1328
|
getPackageReleaseById: (packageReleaseId: string) => PackageRelease | undefined;
|
|
1259
|
-
addPackageRelease: (packageRelease: Omit<
|
|
1329
|
+
addPackageRelease: (packageRelease: Omit<z.input<typeof packageReleaseSchema>, "package_release_id">) => PackageRelease;
|
|
1260
1330
|
updatePackageRelease: (packageRelease: PackageRelease) => void;
|
|
1261
1331
|
deletePackageFile: (packageFileId: string) => boolean;
|
|
1262
1332
|
addPackageFile: (packageFile: Omit<PackageFile, "package_file_id">) => PackageFile;
|
package/dist/index.js
CHANGED
|
@@ -148,7 +148,24 @@ var packageReleaseSchema = z.object({
|
|
|
148
148
|
circuit_json_build_error_last_updated_at: z.string().datetime().nullable().optional(),
|
|
149
149
|
has_transpiled: z.boolean().default(false),
|
|
150
150
|
transpilation_error: z.string().nullable().optional(),
|
|
151
|
-
fs_sha: z.string().nullable().optional()
|
|
151
|
+
fs_sha: z.string().nullable().optional(),
|
|
152
|
+
// Build Status and Display
|
|
153
|
+
display_status: z.enum(["pending", "building", "successful", "failed"]).default("pending"),
|
|
154
|
+
total_build_duration_ms: z.number().nullable().optional(),
|
|
155
|
+
// Transpilation Process
|
|
156
|
+
transpilation_display_status: z.enum(["pending", "building", "successful", "failed"]).default("pending"),
|
|
157
|
+
transpilation_in_progress: z.boolean().default(false),
|
|
158
|
+
transpilation_started_at: z.string().datetime().nullable().optional(),
|
|
159
|
+
transpilation_completed_at: z.string().datetime().nullable().optional(),
|
|
160
|
+
transpilation_logs: z.array(z.any()).default([]),
|
|
161
|
+
transpilation_is_stale: z.boolean().default(false),
|
|
162
|
+
// Circuit JSON Build Process
|
|
163
|
+
circuit_json_build_display_status: z.enum(["pending", "building", "successful", "failed"]).default("pending"),
|
|
164
|
+
circuit_json_build_in_progress: z.boolean().default(false),
|
|
165
|
+
circuit_json_build_started_at: z.string().datetime().nullable().optional(),
|
|
166
|
+
circuit_json_build_completed_at: z.string().datetime().nullable().optional(),
|
|
167
|
+
circuit_json_build_logs: z.array(z.any()).default([]),
|
|
168
|
+
circuit_json_build_is_stale: z.boolean().default(false)
|
|
152
169
|
});
|
|
153
170
|
var packageFileSchema = z.object({
|
|
154
171
|
package_file_id: z.string(),
|
|
@@ -2224,7 +2241,7 @@ var initializer = combine(databaseSchema.parse({}), (set, get) => ({
|
|
|
2224
2241
|
latest_package_release_id: `package_release_${nextId}`,
|
|
2225
2242
|
latest_package_release_fs_sha: null
|
|
2226
2243
|
};
|
|
2227
|
-
const newPackageRelease = {
|
|
2244
|
+
const newPackageRelease = packageReleaseSchema.parse({
|
|
2228
2245
|
package_release_id: `package_release_${nextId}`,
|
|
2229
2246
|
package_id: newPackage.package_id,
|
|
2230
2247
|
version: "0.0.1",
|
|
@@ -2234,7 +2251,7 @@ var initializer = combine(databaseSchema.parse({}), (set, get) => ({
|
|
|
2234
2251
|
updated_at: currentTime,
|
|
2235
2252
|
has_transpiled: true,
|
|
2236
2253
|
transpilation_error: null
|
|
2237
|
-
};
|
|
2254
|
+
});
|
|
2238
2255
|
const packageFiles = [];
|
|
2239
2256
|
let fileIdCounter = nextId;
|
|
2240
2257
|
packageFiles.push({
|
|
@@ -2941,14 +2958,14 @@ var initializer = combine(databaseSchema.parse({}), (set, get) => ({
|
|
|
2941
2958
|
);
|
|
2942
2959
|
},
|
|
2943
2960
|
addPackageRelease: (packageRelease) => {
|
|
2944
|
-
const
|
|
2961
|
+
const parsed = packageReleaseSchema.parse({
|
|
2945
2962
|
package_release_id: `package_release_${Date.now()}`,
|
|
2946
2963
|
...packageRelease
|
|
2947
|
-
};
|
|
2964
|
+
});
|
|
2948
2965
|
set((state) => ({
|
|
2949
|
-
packageReleases: [...state.packageReleases,
|
|
2966
|
+
packageReleases: [...state.packageReleases, parsed]
|
|
2950
2967
|
}));
|
|
2951
|
-
return
|
|
2968
|
+
return parsed;
|
|
2952
2969
|
},
|
|
2953
2970
|
updatePackageRelease: (packageRelease) => {
|
|
2954
2971
|
set((state) => ({
|
package/dist/schema.d.ts
CHANGED
|
@@ -546,6 +546,20 @@ declare const packageReleaseSchema: z.ZodObject<{
|
|
|
546
546
|
has_transpiled: z.ZodDefault<z.ZodBoolean>;
|
|
547
547
|
transpilation_error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
548
548
|
fs_sha: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
549
|
+
display_status: z.ZodDefault<z.ZodEnum<["pending", "building", "successful", "failed"]>>;
|
|
550
|
+
total_build_duration_ms: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
551
|
+
transpilation_display_status: z.ZodDefault<z.ZodEnum<["pending", "building", "successful", "failed"]>>;
|
|
552
|
+
transpilation_in_progress: z.ZodDefault<z.ZodBoolean>;
|
|
553
|
+
transpilation_started_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
554
|
+
transpilation_completed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
555
|
+
transpilation_logs: z.ZodDefault<z.ZodArray<z.ZodAny, "many">>;
|
|
556
|
+
transpilation_is_stale: z.ZodDefault<z.ZodBoolean>;
|
|
557
|
+
circuit_json_build_display_status: z.ZodDefault<z.ZodEnum<["pending", "building", "successful", "failed"]>>;
|
|
558
|
+
circuit_json_build_in_progress: z.ZodDefault<z.ZodBoolean>;
|
|
559
|
+
circuit_json_build_started_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
560
|
+
circuit_json_build_completed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
561
|
+
circuit_json_build_logs: z.ZodDefault<z.ZodArray<z.ZodAny, "many">>;
|
|
562
|
+
circuit_json_build_is_stale: z.ZodDefault<z.ZodBoolean>;
|
|
549
563
|
}, "strip", z.ZodTypeAny, {
|
|
550
564
|
package_release_id: string;
|
|
551
565
|
created_at: string;
|
|
@@ -554,12 +568,26 @@ declare const packageReleaseSchema: z.ZodObject<{
|
|
|
554
568
|
is_locked: boolean;
|
|
555
569
|
is_latest: boolean;
|
|
556
570
|
has_transpiled: boolean;
|
|
571
|
+
display_status: "pending" | "building" | "successful" | "failed";
|
|
572
|
+
transpilation_display_status: "pending" | "building" | "successful" | "failed";
|
|
573
|
+
transpilation_in_progress: boolean;
|
|
574
|
+
transpilation_logs: any[];
|
|
575
|
+
transpilation_is_stale: boolean;
|
|
576
|
+
circuit_json_build_display_status: "pending" | "building" | "successful" | "failed";
|
|
577
|
+
circuit_json_build_in_progress: boolean;
|
|
578
|
+
circuit_json_build_logs: any[];
|
|
579
|
+
circuit_json_build_is_stale: boolean;
|
|
557
580
|
commit_sha?: string | null | undefined;
|
|
558
581
|
license?: string | null | undefined;
|
|
559
582
|
circuit_json_build_error?: string | null | undefined;
|
|
560
583
|
circuit_json_build_error_last_updated_at?: string | null | undefined;
|
|
561
584
|
transpilation_error?: string | null | undefined;
|
|
562
585
|
fs_sha?: string | null | undefined;
|
|
586
|
+
total_build_duration_ms?: number | null | undefined;
|
|
587
|
+
transpilation_started_at?: string | null | undefined;
|
|
588
|
+
transpilation_completed_at?: string | null | undefined;
|
|
589
|
+
circuit_json_build_started_at?: string | null | undefined;
|
|
590
|
+
circuit_json_build_completed_at?: string | null | undefined;
|
|
563
591
|
}, {
|
|
564
592
|
package_release_id: string;
|
|
565
593
|
created_at: string;
|
|
@@ -574,6 +602,20 @@ declare const packageReleaseSchema: z.ZodObject<{
|
|
|
574
602
|
has_transpiled?: boolean | undefined;
|
|
575
603
|
transpilation_error?: string | null | undefined;
|
|
576
604
|
fs_sha?: string | null | undefined;
|
|
605
|
+
display_status?: "pending" | "building" | "successful" | "failed" | undefined;
|
|
606
|
+
total_build_duration_ms?: number | null | undefined;
|
|
607
|
+
transpilation_display_status?: "pending" | "building" | "successful" | "failed" | undefined;
|
|
608
|
+
transpilation_in_progress?: boolean | undefined;
|
|
609
|
+
transpilation_started_at?: string | null | undefined;
|
|
610
|
+
transpilation_completed_at?: string | null | undefined;
|
|
611
|
+
transpilation_logs?: any[] | undefined;
|
|
612
|
+
transpilation_is_stale?: boolean | undefined;
|
|
613
|
+
circuit_json_build_display_status?: "pending" | "building" | "successful" | "failed" | undefined;
|
|
614
|
+
circuit_json_build_in_progress?: boolean | undefined;
|
|
615
|
+
circuit_json_build_started_at?: string | null | undefined;
|
|
616
|
+
circuit_json_build_completed_at?: string | null | undefined;
|
|
617
|
+
circuit_json_build_logs?: any[] | undefined;
|
|
618
|
+
circuit_json_build_is_stale?: boolean | undefined;
|
|
577
619
|
}>;
|
|
578
620
|
type PackageRelease = z.infer<typeof packageReleaseSchema>;
|
|
579
621
|
declare const packageFileSchema: z.ZodObject<{
|
|
@@ -883,6 +925,20 @@ declare const databaseSchema: z.ZodObject<{
|
|
|
883
925
|
has_transpiled: z.ZodDefault<z.ZodBoolean>;
|
|
884
926
|
transpilation_error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
885
927
|
fs_sha: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
928
|
+
display_status: z.ZodDefault<z.ZodEnum<["pending", "building", "successful", "failed"]>>;
|
|
929
|
+
total_build_duration_ms: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
930
|
+
transpilation_display_status: z.ZodDefault<z.ZodEnum<["pending", "building", "successful", "failed"]>>;
|
|
931
|
+
transpilation_in_progress: z.ZodDefault<z.ZodBoolean>;
|
|
932
|
+
transpilation_started_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
933
|
+
transpilation_completed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
934
|
+
transpilation_logs: z.ZodDefault<z.ZodArray<z.ZodAny, "many">>;
|
|
935
|
+
transpilation_is_stale: z.ZodDefault<z.ZodBoolean>;
|
|
936
|
+
circuit_json_build_display_status: z.ZodDefault<z.ZodEnum<["pending", "building", "successful", "failed"]>>;
|
|
937
|
+
circuit_json_build_in_progress: z.ZodDefault<z.ZodBoolean>;
|
|
938
|
+
circuit_json_build_started_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
939
|
+
circuit_json_build_completed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
940
|
+
circuit_json_build_logs: z.ZodDefault<z.ZodArray<z.ZodAny, "many">>;
|
|
941
|
+
circuit_json_build_is_stale: z.ZodDefault<z.ZodBoolean>;
|
|
886
942
|
}, "strip", z.ZodTypeAny, {
|
|
887
943
|
package_release_id: string;
|
|
888
944
|
created_at: string;
|
|
@@ -891,12 +947,26 @@ declare const databaseSchema: z.ZodObject<{
|
|
|
891
947
|
is_locked: boolean;
|
|
892
948
|
is_latest: boolean;
|
|
893
949
|
has_transpiled: boolean;
|
|
950
|
+
display_status: "pending" | "building" | "successful" | "failed";
|
|
951
|
+
transpilation_display_status: "pending" | "building" | "successful" | "failed";
|
|
952
|
+
transpilation_in_progress: boolean;
|
|
953
|
+
transpilation_logs: any[];
|
|
954
|
+
transpilation_is_stale: boolean;
|
|
955
|
+
circuit_json_build_display_status: "pending" | "building" | "successful" | "failed";
|
|
956
|
+
circuit_json_build_in_progress: boolean;
|
|
957
|
+
circuit_json_build_logs: any[];
|
|
958
|
+
circuit_json_build_is_stale: boolean;
|
|
894
959
|
commit_sha?: string | null | undefined;
|
|
895
960
|
license?: string | null | undefined;
|
|
896
961
|
circuit_json_build_error?: string | null | undefined;
|
|
897
962
|
circuit_json_build_error_last_updated_at?: string | null | undefined;
|
|
898
963
|
transpilation_error?: string | null | undefined;
|
|
899
964
|
fs_sha?: string | null | undefined;
|
|
965
|
+
total_build_duration_ms?: number | null | undefined;
|
|
966
|
+
transpilation_started_at?: string | null | undefined;
|
|
967
|
+
transpilation_completed_at?: string | null | undefined;
|
|
968
|
+
circuit_json_build_started_at?: string | null | undefined;
|
|
969
|
+
circuit_json_build_completed_at?: string | null | undefined;
|
|
900
970
|
}, {
|
|
901
971
|
package_release_id: string;
|
|
902
972
|
created_at: string;
|
|
@@ -911,6 +981,20 @@ declare const databaseSchema: z.ZodObject<{
|
|
|
911
981
|
has_transpiled?: boolean | undefined;
|
|
912
982
|
transpilation_error?: string | null | undefined;
|
|
913
983
|
fs_sha?: string | null | undefined;
|
|
984
|
+
display_status?: "pending" | "building" | "successful" | "failed" | undefined;
|
|
985
|
+
total_build_duration_ms?: number | null | undefined;
|
|
986
|
+
transpilation_display_status?: "pending" | "building" | "successful" | "failed" | undefined;
|
|
987
|
+
transpilation_in_progress?: boolean | undefined;
|
|
988
|
+
transpilation_started_at?: string | null | undefined;
|
|
989
|
+
transpilation_completed_at?: string | null | undefined;
|
|
990
|
+
transpilation_logs?: any[] | undefined;
|
|
991
|
+
transpilation_is_stale?: boolean | undefined;
|
|
992
|
+
circuit_json_build_display_status?: "pending" | "building" | "successful" | "failed" | undefined;
|
|
993
|
+
circuit_json_build_in_progress?: boolean | undefined;
|
|
994
|
+
circuit_json_build_started_at?: string | null | undefined;
|
|
995
|
+
circuit_json_build_completed_at?: string | null | undefined;
|
|
996
|
+
circuit_json_build_logs?: any[] | undefined;
|
|
997
|
+
circuit_json_build_is_stale?: boolean | undefined;
|
|
914
998
|
}>, "many">>;
|
|
915
999
|
packageFiles: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
916
1000
|
package_file_id: z.ZodString;
|
|
@@ -1509,12 +1593,26 @@ declare const databaseSchema: z.ZodObject<{
|
|
|
1509
1593
|
is_locked: boolean;
|
|
1510
1594
|
is_latest: boolean;
|
|
1511
1595
|
has_transpiled: boolean;
|
|
1596
|
+
display_status: "pending" | "building" | "successful" | "failed";
|
|
1597
|
+
transpilation_display_status: "pending" | "building" | "successful" | "failed";
|
|
1598
|
+
transpilation_in_progress: boolean;
|
|
1599
|
+
transpilation_logs: any[];
|
|
1600
|
+
transpilation_is_stale: boolean;
|
|
1601
|
+
circuit_json_build_display_status: "pending" | "building" | "successful" | "failed";
|
|
1602
|
+
circuit_json_build_in_progress: boolean;
|
|
1603
|
+
circuit_json_build_logs: any[];
|
|
1604
|
+
circuit_json_build_is_stale: boolean;
|
|
1512
1605
|
commit_sha?: string | null | undefined;
|
|
1513
1606
|
license?: string | null | undefined;
|
|
1514
1607
|
circuit_json_build_error?: string | null | undefined;
|
|
1515
1608
|
circuit_json_build_error_last_updated_at?: string | null | undefined;
|
|
1516
1609
|
transpilation_error?: string | null | undefined;
|
|
1517
1610
|
fs_sha?: string | null | undefined;
|
|
1611
|
+
total_build_duration_ms?: number | null | undefined;
|
|
1612
|
+
transpilation_started_at?: string | null | undefined;
|
|
1613
|
+
transpilation_completed_at?: string | null | undefined;
|
|
1614
|
+
circuit_json_build_started_at?: string | null | undefined;
|
|
1615
|
+
circuit_json_build_completed_at?: string | null | undefined;
|
|
1518
1616
|
}[];
|
|
1519
1617
|
packageFiles: {
|
|
1520
1618
|
package_release_id: string;
|
|
@@ -1733,6 +1831,20 @@ declare const databaseSchema: z.ZodObject<{
|
|
|
1733
1831
|
has_transpiled?: boolean | undefined;
|
|
1734
1832
|
transpilation_error?: string | null | undefined;
|
|
1735
1833
|
fs_sha?: string | null | undefined;
|
|
1834
|
+
display_status?: "pending" | "building" | "successful" | "failed" | undefined;
|
|
1835
|
+
total_build_duration_ms?: number | null | undefined;
|
|
1836
|
+
transpilation_display_status?: "pending" | "building" | "successful" | "failed" | undefined;
|
|
1837
|
+
transpilation_in_progress?: boolean | undefined;
|
|
1838
|
+
transpilation_started_at?: string | null | undefined;
|
|
1839
|
+
transpilation_completed_at?: string | null | undefined;
|
|
1840
|
+
transpilation_logs?: any[] | undefined;
|
|
1841
|
+
transpilation_is_stale?: boolean | undefined;
|
|
1842
|
+
circuit_json_build_display_status?: "pending" | "building" | "successful" | "failed" | undefined;
|
|
1843
|
+
circuit_json_build_in_progress?: boolean | undefined;
|
|
1844
|
+
circuit_json_build_started_at?: string | null | undefined;
|
|
1845
|
+
circuit_json_build_completed_at?: string | null | undefined;
|
|
1846
|
+
circuit_json_build_logs?: any[] | undefined;
|
|
1847
|
+
circuit_json_build_is_stale?: boolean | undefined;
|
|
1736
1848
|
}[] | undefined;
|
|
1737
1849
|
packageFiles?: {
|
|
1738
1850
|
package_release_id: string;
|
package/dist/schema.js
CHANGED
|
@@ -143,7 +143,24 @@ var packageReleaseSchema = z.object({
|
|
|
143
143
|
circuit_json_build_error_last_updated_at: z.string().datetime().nullable().optional(),
|
|
144
144
|
has_transpiled: z.boolean().default(false),
|
|
145
145
|
transpilation_error: z.string().nullable().optional(),
|
|
146
|
-
fs_sha: z.string().nullable().optional()
|
|
146
|
+
fs_sha: z.string().nullable().optional(),
|
|
147
|
+
// Build Status and Display
|
|
148
|
+
display_status: z.enum(["pending", "building", "successful", "failed"]).default("pending"),
|
|
149
|
+
total_build_duration_ms: z.number().nullable().optional(),
|
|
150
|
+
// Transpilation Process
|
|
151
|
+
transpilation_display_status: z.enum(["pending", "building", "successful", "failed"]).default("pending"),
|
|
152
|
+
transpilation_in_progress: z.boolean().default(false),
|
|
153
|
+
transpilation_started_at: z.string().datetime().nullable().optional(),
|
|
154
|
+
transpilation_completed_at: z.string().datetime().nullable().optional(),
|
|
155
|
+
transpilation_logs: z.array(z.any()).default([]),
|
|
156
|
+
transpilation_is_stale: z.boolean().default(false),
|
|
157
|
+
// Circuit JSON Build Process
|
|
158
|
+
circuit_json_build_display_status: z.enum(["pending", "building", "successful", "failed"]).default("pending"),
|
|
159
|
+
circuit_json_build_in_progress: z.boolean().default(false),
|
|
160
|
+
circuit_json_build_started_at: z.string().datetime().nullable().optional(),
|
|
161
|
+
circuit_json_build_completed_at: z.string().datetime().nullable().optional(),
|
|
162
|
+
circuit_json_build_logs: z.array(z.any()).default([]),
|
|
163
|
+
circuit_json_build_is_stale: z.boolean().default(false)
|
|
147
164
|
});
|
|
148
165
|
var packageFileSchema = z.object({
|
|
149
166
|
package_file_id: z.string(),
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
type Package,
|
|
16
16
|
type PackageFile,
|
|
17
17
|
type PackageRelease,
|
|
18
|
+
packageReleaseSchema,
|
|
18
19
|
type Session,
|
|
19
20
|
type Snippet,
|
|
20
21
|
databaseSchema,
|
|
@@ -276,7 +277,7 @@ const initializer = combine(databaseSchema.parse({}), (set, get) => ({
|
|
|
276
277
|
}
|
|
277
278
|
|
|
278
279
|
// Create package release
|
|
279
|
-
const newPackageRelease = {
|
|
280
|
+
const newPackageRelease = packageReleaseSchema.parse({
|
|
280
281
|
package_release_id: `package_release_${nextId}`,
|
|
281
282
|
package_id: newPackage.package_id,
|
|
282
283
|
version: "0.0.1",
|
|
@@ -286,7 +287,7 @@ const initializer = combine(databaseSchema.parse({}), (set, get) => ({
|
|
|
286
287
|
updated_at: currentTime,
|
|
287
288
|
has_transpiled: true,
|
|
288
289
|
transpilation_error: null,
|
|
289
|
-
}
|
|
290
|
+
})
|
|
290
291
|
|
|
291
292
|
// Add all the files
|
|
292
293
|
const packageFiles: PackageFile[] = []
|
|
@@ -1238,16 +1239,19 @@ const initializer = combine(databaseSchema.parse({}), (set, get) => ({
|
|
|
1238
1239
|
)
|
|
1239
1240
|
},
|
|
1240
1241
|
addPackageRelease: (
|
|
1241
|
-
packageRelease: Omit<
|
|
1242
|
+
packageRelease: Omit<
|
|
1243
|
+
z.input<typeof packageReleaseSchema>,
|
|
1244
|
+
"package_release_id"
|
|
1245
|
+
>,
|
|
1242
1246
|
): PackageRelease => {
|
|
1243
|
-
const
|
|
1247
|
+
const parsed = packageReleaseSchema.parse({
|
|
1244
1248
|
package_release_id: `package_release_${Date.now()}`,
|
|
1245
1249
|
...packageRelease,
|
|
1246
|
-
}
|
|
1250
|
+
})
|
|
1247
1251
|
set((state) => ({
|
|
1248
|
-
packageReleases: [...state.packageReleases,
|
|
1252
|
+
packageReleases: [...state.packageReleases, parsed],
|
|
1249
1253
|
}))
|
|
1250
|
-
return
|
|
1254
|
+
return parsed
|
|
1251
1255
|
},
|
|
1252
1256
|
updatePackageRelease: (packageRelease: PackageRelease): void => {
|
|
1253
1257
|
set((state) => ({
|
|
@@ -176,6 +176,31 @@ export const packageReleaseSchema = z.object({
|
|
|
176
176
|
has_transpiled: z.boolean().default(false),
|
|
177
177
|
transpilation_error: z.string().nullable().optional(),
|
|
178
178
|
fs_sha: z.string().nullable().optional(),
|
|
179
|
+
// Build Status and Display
|
|
180
|
+
display_status: z
|
|
181
|
+
.enum(["pending", "building", "successful", "failed"])
|
|
182
|
+
.default("pending"),
|
|
183
|
+
total_build_duration_ms: z.number().nullable().optional(),
|
|
184
|
+
|
|
185
|
+
// Transpilation Process
|
|
186
|
+
transpilation_display_status: z
|
|
187
|
+
.enum(["pending", "building", "successful", "failed"])
|
|
188
|
+
.default("pending"),
|
|
189
|
+
transpilation_in_progress: z.boolean().default(false),
|
|
190
|
+
transpilation_started_at: z.string().datetime().nullable().optional(),
|
|
191
|
+
transpilation_completed_at: z.string().datetime().nullable().optional(),
|
|
192
|
+
transpilation_logs: z.array(z.any()).default([]),
|
|
193
|
+
transpilation_is_stale: z.boolean().default(false),
|
|
194
|
+
|
|
195
|
+
// Circuit JSON Build Process
|
|
196
|
+
circuit_json_build_display_status: z
|
|
197
|
+
.enum(["pending", "building", "successful", "failed"])
|
|
198
|
+
.default("pending"),
|
|
199
|
+
circuit_json_build_in_progress: z.boolean().default(false),
|
|
200
|
+
circuit_json_build_started_at: z.string().datetime().nullable().optional(),
|
|
201
|
+
circuit_json_build_completed_at: z.string().datetime().nullable().optional(),
|
|
202
|
+
circuit_json_build_logs: z.array(z.any()).default([]),
|
|
203
|
+
circuit_json_build_is_stale: z.boolean().default(false),
|
|
179
204
|
})
|
|
180
205
|
export type PackageRelease = z.infer<typeof packageReleaseSchema>
|
|
181
206
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { withRouteSpec } from "fake-snippets-api/lib/middleware/with-winter-spec"
|
|
2
|
+
import { packageReleaseSchema } from "fake-snippets-api/lib/db/schema"
|
|
3
|
+
import { z } from "zod"
|
|
4
|
+
|
|
5
|
+
export default withRouteSpec({
|
|
6
|
+
methods: ["POST"],
|
|
7
|
+
auth: "session",
|
|
8
|
+
jsonBody: z.object({
|
|
9
|
+
package_release_id: z.string(),
|
|
10
|
+
}),
|
|
11
|
+
jsonResponse: z.object({
|
|
12
|
+
ok: z.boolean(),
|
|
13
|
+
package_release: packageReleaseSchema,
|
|
14
|
+
}),
|
|
15
|
+
})(async (req, ctx) => {
|
|
16
|
+
const { package_release_id } = req.jsonBody
|
|
17
|
+
|
|
18
|
+
const release = ctx.db.getPackageReleaseById(package_release_id)
|
|
19
|
+
|
|
20
|
+
if (!release) {
|
|
21
|
+
return ctx.error(404, {
|
|
22
|
+
error_code: "package_release_not_found",
|
|
23
|
+
message: "Package release not found",
|
|
24
|
+
})
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// In a real API this would trigger a rebuild. Here we simply return the release.
|
|
28
|
+
return ctx.json({
|
|
29
|
+
ok: true,
|
|
30
|
+
package_release: release,
|
|
31
|
+
})
|
|
32
|
+
})
|
|
@@ -11,6 +11,7 @@ export default withRouteSpec({
|
|
|
11
11
|
is_latest: z.boolean().optional(),
|
|
12
12
|
license: z.string().optional(),
|
|
13
13
|
fs_sha: z.string().optional(),
|
|
14
|
+
ready_to_build: z.boolean().optional(),
|
|
14
15
|
}),
|
|
15
16
|
jsonResponse: z.object({
|
|
16
17
|
ok: z.boolean(),
|
|
@@ -23,6 +24,7 @@ export default withRouteSpec({
|
|
|
23
24
|
is_latest,
|
|
24
25
|
license,
|
|
25
26
|
fs_sha,
|
|
27
|
+
ready_to_build,
|
|
26
28
|
} = req.jsonBody
|
|
27
29
|
let releaseId = package_release_id
|
|
28
30
|
|
|
@@ -47,7 +49,7 @@ export default withRouteSpec({
|
|
|
47
49
|
})
|
|
48
50
|
}
|
|
49
51
|
|
|
50
|
-
const delta = { is_locked, is_latest, license, fs_sha }
|
|
52
|
+
const delta = { is_locked, is_latest, license, fs_sha, ready_to_build }
|
|
51
53
|
if (
|
|
52
54
|
Object.keys(delta).filter(
|
|
53
55
|
(k) => delta[k as keyof typeof delta] !== undefined,
|
|
@@ -76,6 +78,7 @@ export default withRouteSpec({
|
|
|
76
78
|
...(is_latest !== undefined && { is_latest }),
|
|
77
79
|
...(license !== undefined && { license }),
|
|
78
80
|
...(fs_sha !== undefined && { fs_sha }),
|
|
81
|
+
...(ready_to_build !== undefined && { ready_to_build }),
|
|
79
82
|
}
|
|
80
83
|
|
|
81
84
|
// Handle is_latest updates atomically
|
package/package.json
CHANGED
|
@@ -13,6 +13,8 @@ import { downloadFabricationFiles } from "@/lib/download-fns/download-fabricatio
|
|
|
13
13
|
import { downloadSchematicSvg } from "@/lib/download-fns/download-schematic-svg"
|
|
14
14
|
import { downloadReadableNetlist } from "@/lib/download-fns/download-readable-netlist"
|
|
15
15
|
import { downloadAssemblySvg } from "@/lib/download-fns/download-assembly-svg"
|
|
16
|
+
import { downloadPcbSvg } from "@/lib/download-fns/download-pcb-svg"
|
|
17
|
+
import { usePcbDownloadDialog } from "@/components/dialogs/pcb-download-dialog"
|
|
16
18
|
import { downloadKicadFiles } from "@/lib/download-fns/download-kicad-files"
|
|
17
19
|
import { AnyCircuitElement } from "circuit-json"
|
|
18
20
|
import { ChevronDown, Download, Hammer } from "lucide-react"
|
|
@@ -31,18 +33,19 @@ export function DownloadButtonAndMenu({
|
|
|
31
33
|
circuitJson,
|
|
32
34
|
}: DownloadButtonAndMenuProps) {
|
|
33
35
|
const notImplemented = useNotImplementedToast()
|
|
36
|
+
const { Dialog: PcbDownloadDialog, openDialog: openPcbDownloadDialog } =
|
|
37
|
+
usePcbDownloadDialog()
|
|
34
38
|
|
|
35
39
|
if (!circuitJson) {
|
|
36
40
|
return (
|
|
37
41
|
<div className={className}>
|
|
38
42
|
<Button
|
|
39
43
|
disabled
|
|
40
|
-
variant="ghost"
|
|
41
44
|
size="sm"
|
|
42
|
-
className="h-9
|
|
45
|
+
className="h-9 bg-muted text-muted-foreground border border-input cursor-not-allowed"
|
|
43
46
|
>
|
|
44
47
|
<Download className="h-4 w-4 mr-1.5" />
|
|
45
|
-
|
|
48
|
+
Download
|
|
46
49
|
<ChevronDown className="h-4 w-4 ml-0.5" />
|
|
47
50
|
</Button>
|
|
48
51
|
</div>
|
|
@@ -54,13 +57,12 @@ export function DownloadButtonAndMenu({
|
|
|
54
57
|
<DropdownMenu>
|
|
55
58
|
<DropdownMenuTrigger asChild>
|
|
56
59
|
<Button
|
|
57
|
-
variant="outline"
|
|
58
60
|
size="sm"
|
|
59
|
-
className="
|
|
61
|
+
className="bg-white text-gray-900 hover:bg-gray-100 border border-gray-300 px-1 pl-2"
|
|
60
62
|
>
|
|
61
|
-
<Download className="
|
|
62
|
-
|
|
63
|
-
<ChevronDown className="
|
|
63
|
+
<Download className="w-4 h-4 mr-2" />
|
|
64
|
+
Download
|
|
65
|
+
<ChevronDown className="w-4 h-4 ml-1" />
|
|
64
66
|
</Button>
|
|
65
67
|
</DropdownMenuTrigger>
|
|
66
68
|
<DropdownMenuContent>
|
|
@@ -175,6 +177,18 @@ export function DownloadButtonAndMenu({
|
|
|
175
177
|
svg
|
|
176
178
|
</span>
|
|
177
179
|
</DropdownMenuItem>
|
|
180
|
+
<DropdownMenuItem
|
|
181
|
+
className="text-xs"
|
|
182
|
+
onSelect={() => {
|
|
183
|
+
openPcbDownloadDialog()
|
|
184
|
+
}}
|
|
185
|
+
>
|
|
186
|
+
<Download className="mr-1 h-3 w-3" />
|
|
187
|
+
<span className="flex-grow mr-6">PCB SVG</span>
|
|
188
|
+
<span className="text-[0.6rem] opacity-80 bg-blue-500 text-white font-mono rounded-md px-1 text-center py-0.5 mr-1">
|
|
189
|
+
svg
|
|
190
|
+
</span>
|
|
191
|
+
</DropdownMenuItem>
|
|
178
192
|
<DropdownMenuItem
|
|
179
193
|
className="text-xs"
|
|
180
194
|
onSelect={() => {
|
|
@@ -219,6 +233,10 @@ export function DownloadButtonAndMenu({
|
|
|
219
233
|
</DropdownMenuItem>
|
|
220
234
|
</DropdownMenuContent>
|
|
221
235
|
</DropdownMenu>
|
|
236
|
+
<PcbDownloadDialog
|
|
237
|
+
circuitJson={circuitJson}
|
|
238
|
+
fileName={snippetUnscopedName || "circuit"}
|
|
239
|
+
/>
|
|
222
240
|
</div>
|
|
223
241
|
)
|
|
224
242
|
}
|