@tscircuit/fake-snippets 0.0.105 → 0.0.107
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/CLAUDE.md +92 -0
- package/api/generated-index.js +3 -4
- package/bun-tests/fake-snippets-api/routes/package_builds/get.test.ts +294 -0
- package/bun-tests/fake-snippets-api/routes/package_builds/list.test.ts +304 -0
- package/dist/bundle.js +698 -335
- package/dist/index.d.ts +147 -4
- package/dist/index.js +195 -7
- package/dist/schema.d.ts +206 -1
- package/dist/schema.js +31 -2
- package/fake-snippets-api/lib/db/db-client.ts +60 -3
- package/fake-snippets-api/lib/db/schema.ts +31 -0
- package/fake-snippets-api/lib/db/seed.ts +139 -2
- package/fake-snippets-api/lib/public-mapping/public-map-package-build.ts +41 -0
- package/fake-snippets-api/routes/api/package_builds/get.ts +70 -0
- package/fake-snippets-api/routes/api/package_builds/list.ts +97 -0
- package/package.json +3 -2
- package/src/App.tsx +21 -5
- package/src/components/PackageBreadcrumb.tsx +111 -0
- package/src/components/ViewPackagePage/components/sidebar-releases-section.tsx +22 -11
- package/src/components/preview/BuildsList.tsx +196 -211
- package/src/components/preview/ConnectedPackagesList.tsx +54 -25
- package/src/components/preview/ConnectedRepoOverview.tsx +63 -35
- package/src/components/preview/{ConnectedRepoDashboard.tsx → PackageReleasesDashboard.tsx} +33 -71
- package/src/components/preview/index.tsx +20 -77
- package/src/hooks/use-package-builds.ts +87 -0
- package/src/hooks/use-package-release-by-id-or-version.ts +36 -0
- package/src/hooks/use-package-release.ts +32 -0
- package/src/lib/utils/isUuid.ts +5 -0
- package/src/pages/preview-build.tsx +3 -3
- package/src/pages/release-builds.tsx +107 -0
- package/src/pages/release-detail.tsx +118 -0
- package/src/pages/releases.tsx +51 -0
- package/src/pages/view-connected-repo.tsx +0 -18
package/dist/index.d.ts
CHANGED
|
@@ -520,6 +520,7 @@ declare const packageReleaseSchema: z.ZodObject<{
|
|
|
520
520
|
ai_review_requested: z.ZodDefault<z.ZodBoolean>;
|
|
521
521
|
is_pr_preview: z.ZodDefault<z.ZodBoolean>;
|
|
522
522
|
github_pr_number: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
523
|
+
latest_package_build_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
523
524
|
}, "strip", z.ZodTypeAny, {
|
|
524
525
|
package_release_id: string;
|
|
525
526
|
created_at: string;
|
|
@@ -556,6 +557,7 @@ declare const packageReleaseSchema: z.ZodObject<{
|
|
|
556
557
|
ai_review_error?: any;
|
|
557
558
|
ai_review_logs?: any[] | null | undefined;
|
|
558
559
|
github_pr_number?: number | null | undefined;
|
|
560
|
+
latest_package_build_id?: string | null | undefined;
|
|
559
561
|
}, {
|
|
560
562
|
package_release_id: string;
|
|
561
563
|
created_at: string;
|
|
@@ -592,6 +594,7 @@ declare const packageReleaseSchema: z.ZodObject<{
|
|
|
592
594
|
ai_review_requested?: boolean | undefined;
|
|
593
595
|
is_pr_preview?: boolean | undefined;
|
|
594
596
|
github_pr_number?: number | null | undefined;
|
|
597
|
+
latest_package_build_id?: string | null | undefined;
|
|
595
598
|
}>;
|
|
596
599
|
type PackageRelease = z.infer<typeof packageReleaseSchema>;
|
|
597
600
|
declare const packageFileSchema: z.ZodObject<{
|
|
@@ -821,6 +824,80 @@ declare const jlcpcbOrderStepRunSchema: z.ZodObject<{
|
|
|
821
824
|
error_message?: string | null | undefined;
|
|
822
825
|
}>;
|
|
823
826
|
type JlcpcbOrderStepRun = z.infer<typeof jlcpcbOrderStepRunSchema>;
|
|
827
|
+
declare const packageBuildSchema: z.ZodObject<{
|
|
828
|
+
package_build_id: z.ZodString;
|
|
829
|
+
package_release_id: z.ZodString;
|
|
830
|
+
created_at: z.ZodString;
|
|
831
|
+
transpilation_in_progress: z.ZodDefault<z.ZodBoolean>;
|
|
832
|
+
transpilation_started_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
833
|
+
transpilation_completed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
834
|
+
transpilation_logs: z.ZodDefault<z.ZodArray<z.ZodAny, "many">>;
|
|
835
|
+
transpilation_error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
836
|
+
circuit_json_build_in_progress: z.ZodDefault<z.ZodBoolean>;
|
|
837
|
+
circuit_json_build_started_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
838
|
+
circuit_json_build_completed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
839
|
+
circuit_json_build_logs: z.ZodDefault<z.ZodArray<z.ZodAny, "many">>;
|
|
840
|
+
circuit_json_build_error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
841
|
+
build_in_progress: z.ZodDefault<z.ZodBoolean>;
|
|
842
|
+
build_started_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
843
|
+
build_completed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
844
|
+
build_error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
845
|
+
build_error_last_updated_at: z.ZodString;
|
|
846
|
+
preview_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
847
|
+
build_logs: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
848
|
+
branch_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
849
|
+
commit_message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
850
|
+
commit_author: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
851
|
+
}, "strip", z.ZodTypeAny, {
|
|
852
|
+
package_release_id: string;
|
|
853
|
+
created_at: string;
|
|
854
|
+
transpilation_in_progress: boolean;
|
|
855
|
+
transpilation_logs: any[];
|
|
856
|
+
circuit_json_build_in_progress: boolean;
|
|
857
|
+
circuit_json_build_logs: any[];
|
|
858
|
+
package_build_id: string;
|
|
859
|
+
build_in_progress: boolean;
|
|
860
|
+
build_error_last_updated_at: string;
|
|
861
|
+
circuit_json_build_error?: string | null | undefined;
|
|
862
|
+
transpilation_error?: string | null | undefined;
|
|
863
|
+
transpilation_started_at?: string | null | undefined;
|
|
864
|
+
transpilation_completed_at?: string | null | undefined;
|
|
865
|
+
circuit_json_build_started_at?: string | null | undefined;
|
|
866
|
+
circuit_json_build_completed_at?: string | null | undefined;
|
|
867
|
+
build_started_at?: string | null | undefined;
|
|
868
|
+
build_completed_at?: string | null | undefined;
|
|
869
|
+
build_error?: string | null | undefined;
|
|
870
|
+
preview_url?: string | null | undefined;
|
|
871
|
+
build_logs?: string | null | undefined;
|
|
872
|
+
branch_name?: string | null | undefined;
|
|
873
|
+
commit_message?: string | null | undefined;
|
|
874
|
+
commit_author?: string | null | undefined;
|
|
875
|
+
}, {
|
|
876
|
+
package_release_id: string;
|
|
877
|
+
created_at: string;
|
|
878
|
+
package_build_id: string;
|
|
879
|
+
build_error_last_updated_at: string;
|
|
880
|
+
circuit_json_build_error?: string | null | undefined;
|
|
881
|
+
transpilation_error?: string | null | undefined;
|
|
882
|
+
transpilation_in_progress?: boolean | undefined;
|
|
883
|
+
transpilation_started_at?: string | null | undefined;
|
|
884
|
+
transpilation_completed_at?: string | null | undefined;
|
|
885
|
+
transpilation_logs?: any[] | undefined;
|
|
886
|
+
circuit_json_build_in_progress?: boolean | undefined;
|
|
887
|
+
circuit_json_build_started_at?: string | null | undefined;
|
|
888
|
+
circuit_json_build_completed_at?: string | null | undefined;
|
|
889
|
+
circuit_json_build_logs?: any[] | undefined;
|
|
890
|
+
build_in_progress?: boolean | undefined;
|
|
891
|
+
build_started_at?: string | null | undefined;
|
|
892
|
+
build_completed_at?: string | null | undefined;
|
|
893
|
+
build_error?: string | null | undefined;
|
|
894
|
+
preview_url?: string | null | undefined;
|
|
895
|
+
build_logs?: string | null | undefined;
|
|
896
|
+
branch_name?: string | null | undefined;
|
|
897
|
+
commit_message?: string | null | undefined;
|
|
898
|
+
commit_author?: string | null | undefined;
|
|
899
|
+
}>;
|
|
900
|
+
type PackageBuild = z.infer<typeof packageBuildSchema>;
|
|
824
901
|
|
|
825
902
|
declare const createDatabase: ({ seed }?: {
|
|
826
903
|
seed?: boolean;
|
|
@@ -886,6 +963,7 @@ declare const createDatabase: ({ seed }?: {
|
|
|
886
963
|
ai_review_error?: any;
|
|
887
964
|
ai_review_logs?: any[] | null | undefined;
|
|
888
965
|
github_pr_number?: number | null | undefined;
|
|
966
|
+
latest_package_build_id?: string | null | undefined;
|
|
889
967
|
}[];
|
|
890
968
|
packageFiles: {
|
|
891
969
|
package_release_id: string;
|
|
@@ -1100,7 +1178,32 @@ declare const createDatabase: ({ seed }?: {
|
|
|
1100
1178
|
access_token?: string | null | undefined;
|
|
1101
1179
|
access_token_expires_at?: string | null | undefined;
|
|
1102
1180
|
}[];
|
|
1103
|
-
|
|
1181
|
+
packageBuilds: {
|
|
1182
|
+
package_release_id: string;
|
|
1183
|
+
created_at: string;
|
|
1184
|
+
transpilation_in_progress: boolean;
|
|
1185
|
+
transpilation_logs: any[];
|
|
1186
|
+
circuit_json_build_in_progress: boolean;
|
|
1187
|
+
circuit_json_build_logs: any[];
|
|
1188
|
+
package_build_id: string;
|
|
1189
|
+
build_in_progress: boolean;
|
|
1190
|
+
build_error_last_updated_at: string;
|
|
1191
|
+
circuit_json_build_error?: string | null | undefined;
|
|
1192
|
+
transpilation_error?: string | null | undefined;
|
|
1193
|
+
transpilation_started_at?: string | null | undefined;
|
|
1194
|
+
transpilation_completed_at?: string | null | undefined;
|
|
1195
|
+
circuit_json_build_started_at?: string | null | undefined;
|
|
1196
|
+
circuit_json_build_completed_at?: string | null | undefined;
|
|
1197
|
+
build_started_at?: string | null | undefined;
|
|
1198
|
+
build_completed_at?: string | null | undefined;
|
|
1199
|
+
build_error?: string | null | undefined;
|
|
1200
|
+
preview_url?: string | null | undefined;
|
|
1201
|
+
build_logs?: string | null | undefined;
|
|
1202
|
+
branch_name?: string | null | undefined;
|
|
1203
|
+
commit_message?: string | null | undefined;
|
|
1204
|
+
commit_author?: string | null | undefined;
|
|
1205
|
+
}[];
|
|
1206
|
+
}, "addOrder" | "getOrderById" | "getOrderFilesByOrderId" | "addOrderQuote" | "getOrderQuoteById" | "getJlcpcbOrderStatesByOrderId" | "getJlcpcbOrderStepRunsByJlcpcbOrderStateId" | "updateOrder" | "addJlcpcbOrderState" | "updateJlcpcbOrderState" | "addOrderFile" | "getOrderFileById" | "addAccount" | "addAccountPackage" | "getAccountPackageById" | "updateAccountPackage" | "deleteAccountPackage" | "addSnippet" | "getLatestSnippets" | "getTrendingSnippets" | "getPackagesByAuthor" | "getSnippetByAuthorAndName" | "updateSnippet" | "getSnippetById" | "searchSnippets" | "searchPackages" | "searchAccounts" | "deleteSnippet" | "addSession" | "getSessions" | "createLoginPage" | "getLoginPage" | "updateLoginPage" | "getAccount" | "updateAccount" | "createSession" | "addStar" | "removeStar" | "hasStarred" | "addPackage" | "updatePackage" | "getPackageById" | "getPackageReleaseById" | "addPackageRelease" | "updatePackageRelease" | "deletePackageFile" | "addPackageFile" | "updatePackageFile" | "getStarCount" | "getPackageFilesByReleaseId" | "updatePackageReleaseFsSha" | "addAiReview" | "updateAiReview" | "getAiReviewById" | "listAiReviews" | "addDatasheet" | "getDatasheetById" | "getDatasheetByChipName" | "listDatasheets" | "updateDatasheet" | "addPackageBuild" | "getPackageBuildById" | "getPackageBuildsByReleaseId" | "updatePackageBuild"> & {
|
|
1104
1207
|
addOrder: (order: Omit<Order, "order_id">) => Order;
|
|
1105
1208
|
getOrderById: (orderId: string) => Order | undefined;
|
|
1106
1209
|
getOrderFilesByOrderId: (orderId: string) => OrderFile[];
|
|
@@ -1137,7 +1240,10 @@ declare const createDatabase: ({ seed }?: {
|
|
|
1137
1240
|
getAccountPackageById: (accountPackageId: string) => AccountPackage | undefined;
|
|
1138
1241
|
updateAccountPackage: (accountPackageId: string, updates: Partial<AccountPackage>) => void;
|
|
1139
1242
|
deleteAccountPackage: (accountPackageId: string) => boolean;
|
|
1140
|
-
addSnippet: (snippet: Omit<z.input<typeof snippetSchema>, "snippet_id" | "package_release_id">
|
|
1243
|
+
addSnippet: (snippet: Omit<z.input<typeof snippetSchema>, "snippet_id" | "package_release_id"> & {
|
|
1244
|
+
creator_account_id?: string;
|
|
1245
|
+
github_repo_full_name?: string;
|
|
1246
|
+
}) => Snippet;
|
|
1141
1247
|
getLatestSnippets: (limit: number) => Snippet[];
|
|
1142
1248
|
getTrendingSnippets: (limit: number, since: string) => Snippet[];
|
|
1143
1249
|
getPackagesByAuthor: (authorName?: string) => Package[];
|
|
@@ -1193,6 +1299,10 @@ declare const createDatabase: ({ seed }?: {
|
|
|
1193
1299
|
is_popular?: boolean;
|
|
1194
1300
|
}) => Datasheet[];
|
|
1195
1301
|
updateDatasheet: (datasheetId: string, updates: Partial<Datasheet>) => Datasheet | undefined;
|
|
1302
|
+
addPackageBuild: (packageBuild: Omit<PackageBuild, "package_build_id">) => PackageBuild;
|
|
1303
|
+
getPackageBuildById: (packageBuildId: string) => PackageBuild | undefined;
|
|
1304
|
+
getPackageBuildsByReleaseId: (packageReleaseId: string) => PackageBuild[];
|
|
1305
|
+
updatePackageBuild: (packageBuildId: string, updates: Partial<PackageBuild>) => PackageBuild | undefined;
|
|
1196
1306
|
}> & Omit<{
|
|
1197
1307
|
idCounter: number;
|
|
1198
1308
|
snippets: {
|
|
@@ -1255,6 +1365,7 @@ declare const createDatabase: ({ seed }?: {
|
|
|
1255
1365
|
ai_review_error?: any;
|
|
1256
1366
|
ai_review_logs?: any[] | null | undefined;
|
|
1257
1367
|
github_pr_number?: number | null | undefined;
|
|
1368
|
+
latest_package_build_id?: string | null | undefined;
|
|
1258
1369
|
}[];
|
|
1259
1370
|
packageFiles: {
|
|
1260
1371
|
package_release_id: string;
|
|
@@ -1469,7 +1580,32 @@ declare const createDatabase: ({ seed }?: {
|
|
|
1469
1580
|
access_token?: string | null | undefined;
|
|
1470
1581
|
access_token_expires_at?: string | null | undefined;
|
|
1471
1582
|
}[];
|
|
1472
|
-
|
|
1583
|
+
packageBuilds: {
|
|
1584
|
+
package_release_id: string;
|
|
1585
|
+
created_at: string;
|
|
1586
|
+
transpilation_in_progress: boolean;
|
|
1587
|
+
transpilation_logs: any[];
|
|
1588
|
+
circuit_json_build_in_progress: boolean;
|
|
1589
|
+
circuit_json_build_logs: any[];
|
|
1590
|
+
package_build_id: string;
|
|
1591
|
+
build_in_progress: boolean;
|
|
1592
|
+
build_error_last_updated_at: string;
|
|
1593
|
+
circuit_json_build_error?: string | null | undefined;
|
|
1594
|
+
transpilation_error?: string | null | undefined;
|
|
1595
|
+
transpilation_started_at?: string | null | undefined;
|
|
1596
|
+
transpilation_completed_at?: string | null | undefined;
|
|
1597
|
+
circuit_json_build_started_at?: string | null | undefined;
|
|
1598
|
+
circuit_json_build_completed_at?: string | null | undefined;
|
|
1599
|
+
build_started_at?: string | null | undefined;
|
|
1600
|
+
build_completed_at?: string | null | undefined;
|
|
1601
|
+
build_error?: string | null | undefined;
|
|
1602
|
+
preview_url?: string | null | undefined;
|
|
1603
|
+
build_logs?: string | null | undefined;
|
|
1604
|
+
branch_name?: string | null | undefined;
|
|
1605
|
+
commit_message?: string | null | undefined;
|
|
1606
|
+
commit_author?: string | null | undefined;
|
|
1607
|
+
}[];
|
|
1608
|
+
}, "addOrder" | "getOrderById" | "getOrderFilesByOrderId" | "addOrderQuote" | "getOrderQuoteById" | "getJlcpcbOrderStatesByOrderId" | "getJlcpcbOrderStepRunsByJlcpcbOrderStateId" | "updateOrder" | "addJlcpcbOrderState" | "updateJlcpcbOrderState" | "addOrderFile" | "getOrderFileById" | "addAccount" | "addAccountPackage" | "getAccountPackageById" | "updateAccountPackage" | "deleteAccountPackage" | "addSnippet" | "getLatestSnippets" | "getTrendingSnippets" | "getPackagesByAuthor" | "getSnippetByAuthorAndName" | "updateSnippet" | "getSnippetById" | "searchSnippets" | "searchPackages" | "searchAccounts" | "deleteSnippet" | "addSession" | "getSessions" | "createLoginPage" | "getLoginPage" | "updateLoginPage" | "getAccount" | "updateAccount" | "createSession" | "addStar" | "removeStar" | "hasStarred" | "addPackage" | "updatePackage" | "getPackageById" | "getPackageReleaseById" | "addPackageRelease" | "updatePackageRelease" | "deletePackageFile" | "addPackageFile" | "updatePackageFile" | "getStarCount" | "getPackageFilesByReleaseId" | "updatePackageReleaseFsSha" | "addAiReview" | "updateAiReview" | "getAiReviewById" | "listAiReviews" | "addDatasheet" | "getDatasheetById" | "getDatasheetByChipName" | "listDatasheets" | "updateDatasheet" | "addPackageBuild" | "getPackageBuildById" | "getPackageBuildsByReleaseId" | "updatePackageBuild"> & {
|
|
1473
1609
|
addOrder: (order: Omit<Order, "order_id">) => Order;
|
|
1474
1610
|
getOrderById: (orderId: string) => Order | undefined;
|
|
1475
1611
|
getOrderFilesByOrderId: (orderId: string) => OrderFile[];
|
|
@@ -1506,7 +1642,10 @@ declare const createDatabase: ({ seed }?: {
|
|
|
1506
1642
|
getAccountPackageById: (accountPackageId: string) => AccountPackage | undefined;
|
|
1507
1643
|
updateAccountPackage: (accountPackageId: string, updates: Partial<AccountPackage>) => void;
|
|
1508
1644
|
deleteAccountPackage: (accountPackageId: string) => boolean;
|
|
1509
|
-
addSnippet: (snippet: Omit<z.input<typeof snippetSchema>, "snippet_id" | "package_release_id">
|
|
1645
|
+
addSnippet: (snippet: Omit<z.input<typeof snippetSchema>, "snippet_id" | "package_release_id"> & {
|
|
1646
|
+
creator_account_id?: string;
|
|
1647
|
+
github_repo_full_name?: string;
|
|
1648
|
+
}) => Snippet;
|
|
1510
1649
|
getLatestSnippets: (limit: number) => Snippet[];
|
|
1511
1650
|
getTrendingSnippets: (limit: number, since: string) => Snippet[];
|
|
1512
1651
|
getPackagesByAuthor: (authorName?: string) => Package[];
|
|
@@ -1562,6 +1701,10 @@ declare const createDatabase: ({ seed }?: {
|
|
|
1562
1701
|
is_popular?: boolean;
|
|
1563
1702
|
}) => Datasheet[];
|
|
1564
1703
|
updateDatasheet: (datasheetId: string, updates: Partial<Datasheet>) => Datasheet | undefined;
|
|
1704
|
+
addPackageBuild: (packageBuild: Omit<PackageBuild, "package_build_id">) => PackageBuild;
|
|
1705
|
+
getPackageBuildById: (packageBuildId: string) => PackageBuild | undefined;
|
|
1706
|
+
getPackageBuildsByReleaseId: (packageReleaseId: string) => PackageBuild[];
|
|
1707
|
+
updatePackageBuild: (packageBuildId: string, updates: Partial<PackageBuild>) => PackageBuild | undefined;
|
|
1565
1708
|
};
|
|
1566
1709
|
type DbClient = ReturnType<typeof createDatabase>;
|
|
1567
1710
|
|
package/dist/index.js
CHANGED
|
@@ -212,7 +212,9 @@ var packageReleaseSchema = z.object({
|
|
|
212
212
|
ai_review_requested: z.boolean().default(false),
|
|
213
213
|
// Preview
|
|
214
214
|
is_pr_preview: z.boolean().default(false),
|
|
215
|
-
github_pr_number: z.number().nullable().optional()
|
|
215
|
+
github_pr_number: z.number().nullable().optional(),
|
|
216
|
+
// Latest Build Reference
|
|
217
|
+
latest_package_build_id: z.string().nullable().optional()
|
|
216
218
|
});
|
|
217
219
|
var packageFileSchema = z.object({
|
|
218
220
|
package_file_id: z.string(),
|
|
@@ -291,6 +293,31 @@ var jlcpcbOrderStepRunSchema = z.object({
|
|
|
291
293
|
error_message: z.string().nullable().default(null),
|
|
292
294
|
created_at: z.string()
|
|
293
295
|
});
|
|
296
|
+
var packageBuildSchema = z.object({
|
|
297
|
+
package_build_id: z.string().uuid(),
|
|
298
|
+
package_release_id: z.string(),
|
|
299
|
+
created_at: z.string().datetime(),
|
|
300
|
+
transpilation_in_progress: z.boolean().default(false),
|
|
301
|
+
transpilation_started_at: z.string().datetime().nullable().optional(),
|
|
302
|
+
transpilation_completed_at: z.string().datetime().nullable().optional(),
|
|
303
|
+
transpilation_logs: z.array(z.any()).default([]),
|
|
304
|
+
transpilation_error: z.string().nullable().optional(),
|
|
305
|
+
circuit_json_build_in_progress: z.boolean().default(false),
|
|
306
|
+
circuit_json_build_started_at: z.string().datetime().nullable().optional(),
|
|
307
|
+
circuit_json_build_completed_at: z.string().datetime().nullable().optional(),
|
|
308
|
+
circuit_json_build_logs: z.array(z.any()).default([]),
|
|
309
|
+
circuit_json_build_error: z.string().nullable().optional(),
|
|
310
|
+
build_in_progress: z.boolean().default(false),
|
|
311
|
+
build_started_at: z.string().datetime().nullable().optional(),
|
|
312
|
+
build_completed_at: z.string().datetime().nullable().optional(),
|
|
313
|
+
build_error: z.string().nullable().optional(),
|
|
314
|
+
build_error_last_updated_at: z.string().datetime(),
|
|
315
|
+
preview_url: z.string().nullable().optional(),
|
|
316
|
+
build_logs: z.string().nullable().optional(),
|
|
317
|
+
branch_name: z.string().nullable().optional(),
|
|
318
|
+
commit_message: z.string().nullable().optional(),
|
|
319
|
+
commit_author: z.string().nullable().optional()
|
|
320
|
+
});
|
|
294
321
|
var databaseSchema = z.object({
|
|
295
322
|
idCounter: z.number().default(0),
|
|
296
323
|
snippets: z.array(snippetSchema).default([]),
|
|
@@ -309,7 +336,8 @@ var databaseSchema = z.object({
|
|
|
309
336
|
orderQuotes: z.array(orderQuoteSchema).default([]),
|
|
310
337
|
aiReviews: z.array(aiReviewSchema).default([]),
|
|
311
338
|
datasheets: z.array(datasheetSchema).default([]),
|
|
312
|
-
githubInstallations: z.array(githubInstallationSchema).default([])
|
|
339
|
+
githubInstallations: z.array(githubInstallationSchema).default([]),
|
|
340
|
+
packageBuilds: z.array(packageBuildSchema).default([])
|
|
313
341
|
});
|
|
314
342
|
|
|
315
343
|
// fake-snippets-api/lib/db/autoload-dev-packages.ts
|
|
@@ -508,10 +536,12 @@ var seed = (db) => {
|
|
|
508
536
|
if (process.env.AUTOLOAD_PACKAGES === "true") {
|
|
509
537
|
loadAutoloadPackages(db);
|
|
510
538
|
}
|
|
511
|
-
db.addSnippet({
|
|
539
|
+
const { package_release_id: packageReleaseId1 } = db.addSnippet({
|
|
512
540
|
name: "testuser/my-test-board",
|
|
513
541
|
unscoped_name: "my-test-board",
|
|
542
|
+
github_repo_full_name: "testuser/my-test-board",
|
|
514
543
|
owner_name: "testuser",
|
|
544
|
+
creator_account_id: account_id,
|
|
515
545
|
code: `
|
|
516
546
|
import { A555Timer } from "@tsci/seveibar.a555timer"
|
|
517
547
|
|
|
@@ -1017,6 +1047,41 @@ export default () => (
|
|
|
1017
1047
|
}
|
|
1018
1048
|
]
|
|
1019
1049
|
});
|
|
1050
|
+
const firstBuild = db.addPackageBuild({
|
|
1051
|
+
package_release_id: packageReleaseId1,
|
|
1052
|
+
created_at: new Date(Date.now() - 15e3).toISOString(),
|
|
1053
|
+
// 15 seconds ago
|
|
1054
|
+
transpilation_in_progress: false,
|
|
1055
|
+
transpilation_started_at: new Date(Date.now() - 15e3).toISOString(),
|
|
1056
|
+
transpilation_completed_at: new Date(Date.now() - 14e3).toISOString(),
|
|
1057
|
+
transpilation_logs: [
|
|
1058
|
+
"[INFO] Starting transpilation...",
|
|
1059
|
+
"[INFO] Parsing package code",
|
|
1060
|
+
"[ERROR] Failed to parse TypeScript definitions",
|
|
1061
|
+
"[ERROR] Invalid syntax in component declaration"
|
|
1062
|
+
],
|
|
1063
|
+
transpilation_error: "TypeScript compilation failed: Syntax error in component declaration",
|
|
1064
|
+
circuit_json_build_in_progress: false,
|
|
1065
|
+
circuit_json_build_started_at: null,
|
|
1066
|
+
circuit_json_build_completed_at: null,
|
|
1067
|
+
circuit_json_build_logs: [],
|
|
1068
|
+
circuit_json_build_error: "Build cancelled due to transpilation failure",
|
|
1069
|
+
build_in_progress: false,
|
|
1070
|
+
build_started_at: new Date(Date.now() - 15e3).toISOString(),
|
|
1071
|
+
build_completed_at: new Date(Date.now() - 14e3).toISOString(),
|
|
1072
|
+
build_error: "Build failed: Unable to complete transpilation step",
|
|
1073
|
+
build_error_last_updated_at: new Date(Date.now() - 14e3).toISOString(),
|
|
1074
|
+
preview_url: null,
|
|
1075
|
+
build_logs: "Build process:\n1. Environment setup - OK\n2. Dependency resolution - OK\n3. Code compilation - FAILED\nError: Invalid syntax in component declaration\nBuild terminated with errors",
|
|
1076
|
+
branch_name: "main",
|
|
1077
|
+
commit_message: "Attempted build of a555timer-square-wave package",
|
|
1078
|
+
commit_author: "testuser"
|
|
1079
|
+
});
|
|
1080
|
+
const release1 = db.getPackageReleaseById(packageReleaseId1);
|
|
1081
|
+
db.updatePackageRelease({
|
|
1082
|
+
...release1,
|
|
1083
|
+
latest_package_build_id: firstBuild.package_build_id
|
|
1084
|
+
});
|
|
1020
1085
|
db.addSnippet({
|
|
1021
1086
|
name: "seveibar/a555timer",
|
|
1022
1087
|
unscoped_name: "a555timer",
|
|
@@ -1544,10 +1609,11 @@ exports.A555Timer = A555Timer;
|
|
|
1544
1609
|
}
|
|
1545
1610
|
]
|
|
1546
1611
|
});
|
|
1547
|
-
db.addSnippet({
|
|
1612
|
+
const { package_release_id: packageReleaseId2 } = db.addSnippet({
|
|
1548
1613
|
name: "testuser/a555timer-square-wave",
|
|
1549
1614
|
unscoped_name: "a555timer-square-wave",
|
|
1550
1615
|
owner_name: "testuser",
|
|
1616
|
+
creator_account_id: account_id,
|
|
1551
1617
|
code: `
|
|
1552
1618
|
import { A555Timer } from "@tsci/seveibar.a555timer"
|
|
1553
1619
|
|
|
@@ -1560,6 +1626,7 @@ export const SquareWaveModule = () => (
|
|
|
1560
1626
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1561
1627
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1562
1628
|
snippet_type: "package",
|
|
1629
|
+
github_repo_full_name: "testuser/test",
|
|
1563
1630
|
description: "A simple package that outputs a square waveform using the a555timer",
|
|
1564
1631
|
circuit_json: [
|
|
1565
1632
|
{
|
|
@@ -2053,6 +2120,83 @@ export const SquareWaveModule = () => (
|
|
|
2053
2120
|
}
|
|
2054
2121
|
]
|
|
2055
2122
|
});
|
|
2123
|
+
const failedBuild = db.addPackageBuild({
|
|
2124
|
+
package_release_id: packageReleaseId2,
|
|
2125
|
+
created_at: new Date(Date.now() - 15e3).toISOString(),
|
|
2126
|
+
// 15 seconds ago
|
|
2127
|
+
transpilation_in_progress: false,
|
|
2128
|
+
transpilation_started_at: new Date(Date.now() - 15e3).toISOString(),
|
|
2129
|
+
transpilation_completed_at: new Date(Date.now() - 14e3).toISOString(),
|
|
2130
|
+
transpilation_logs: [
|
|
2131
|
+
"[INFO] Starting transpilation...",
|
|
2132
|
+
"[INFO] Parsing package code",
|
|
2133
|
+
"[ERROR] Failed to parse TypeScript definitions",
|
|
2134
|
+
"[ERROR] Invalid syntax in component declaration"
|
|
2135
|
+
],
|
|
2136
|
+
transpilation_error: "TypeScript compilation failed: Syntax error in component declaration",
|
|
2137
|
+
circuit_json_build_in_progress: false,
|
|
2138
|
+
circuit_json_build_started_at: null,
|
|
2139
|
+
circuit_json_build_completed_at: null,
|
|
2140
|
+
circuit_json_build_logs: [],
|
|
2141
|
+
circuit_json_build_error: "Build cancelled due to transpilation failure",
|
|
2142
|
+
build_in_progress: false,
|
|
2143
|
+
build_started_at: new Date(Date.now() - 15e3).toISOString(),
|
|
2144
|
+
build_completed_at: new Date(Date.now() - 14e3).toISOString(),
|
|
2145
|
+
build_error: "Build failed: Unable to complete transpilation step",
|
|
2146
|
+
build_error_last_updated_at: new Date(Date.now() - 14e3).toISOString(),
|
|
2147
|
+
preview_url: null,
|
|
2148
|
+
build_logs: "Build process:\n1. Environment setup - OK\n2. Dependency resolution - OK\n3. Code compilation - FAILED\nError: Invalid syntax in component declaration\nBuild terminated with errors",
|
|
2149
|
+
branch_name: "main",
|
|
2150
|
+
commit_message: "Attempted build of a555timer-square-wave package",
|
|
2151
|
+
commit_author: "testuser"
|
|
2152
|
+
});
|
|
2153
|
+
const successfulBuild = db.addPackageBuild({
|
|
2154
|
+
package_release_id: packageReleaseId2,
|
|
2155
|
+
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2156
|
+
transpilation_in_progress: false,
|
|
2157
|
+
transpilation_started_at: new Date(Date.now() - 5e3).toISOString(),
|
|
2158
|
+
// Started 5 seconds ago
|
|
2159
|
+
transpilation_completed_at: new Date(Date.now() - 3e3).toISOString(),
|
|
2160
|
+
// Completed 3 seconds ago
|
|
2161
|
+
transpilation_logs: [
|
|
2162
|
+
"[INFO] Starting transpilation...",
|
|
2163
|
+
"[INFO] Parsing package code",
|
|
2164
|
+
"[INFO] Generating TypeScript definitions",
|
|
2165
|
+
"[INFO] Compiling to JavaScript",
|
|
2166
|
+
"[SUCCESS] Transpilation completed successfully"
|
|
2167
|
+
],
|
|
2168
|
+
transpilation_error: null,
|
|
2169
|
+
circuit_json_build_in_progress: false,
|
|
2170
|
+
circuit_json_build_started_at: new Date(Date.now() - 3e3).toISOString(),
|
|
2171
|
+
// Started after transpilation
|
|
2172
|
+
circuit_json_build_completed_at: new Date(Date.now() - 1e3).toISOString(),
|
|
2173
|
+
// Completed 1 second ago
|
|
2174
|
+
circuit_json_build_logs: [
|
|
2175
|
+
"[INFO] Starting circuit JSON build...",
|
|
2176
|
+
"[INFO] Analyzing component structure",
|
|
2177
|
+
"[INFO] Generating port configurations",
|
|
2178
|
+
"[INFO] Validating circuit connections",
|
|
2179
|
+
"[SUCCESS] Circuit JSON build completed"
|
|
2180
|
+
],
|
|
2181
|
+
circuit_json_build_error: null,
|
|
2182
|
+
build_in_progress: false,
|
|
2183
|
+
build_started_at: new Date(Date.now() - 1e4).toISOString(),
|
|
2184
|
+
// Started 10 seconds ago
|
|
2185
|
+
build_completed_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2186
|
+
// Just completed
|
|
2187
|
+
build_error: null,
|
|
2188
|
+
build_error_last_updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2189
|
+
preview_url: "http://localhost:3000/preview/package_build_1",
|
|
2190
|
+
build_logs: "Build process:\n1. Environment setup - OK\n2. Dependency resolution - OK\n3. Code compilation - OK\n4. Circuit validation - OK\n5. Package assembly - OK\nBuild completed successfully",
|
|
2191
|
+
branch_name: "main",
|
|
2192
|
+
commit_message: "Initial build of a555timer-square-wave package",
|
|
2193
|
+
commit_author: "testuser"
|
|
2194
|
+
});
|
|
2195
|
+
const release2 = db.getPackageReleaseById(packageReleaseId2);
|
|
2196
|
+
db.updatePackageRelease({
|
|
2197
|
+
...release2,
|
|
2198
|
+
latest_package_build_id: successfulBuild.package_build_id
|
|
2199
|
+
});
|
|
2056
2200
|
db.addOrder({
|
|
2057
2201
|
account_id,
|
|
2058
2202
|
is_running: false,
|
|
@@ -2268,7 +2412,7 @@ var initializer = combine(databaseSchema.parse({}), (set, get) => ({
|
|
|
2268
2412
|
const nextId = newState.idCounter + 1;
|
|
2269
2413
|
const newPackage = {
|
|
2270
2414
|
package_id: `pkg_${nextId}`,
|
|
2271
|
-
creator_account_id: snippet.owner_name,
|
|
2415
|
+
creator_account_id: snippet.creator_account_id ?? snippet.owner_name,
|
|
2272
2416
|
// Using owner_name as account_id since we don't have context
|
|
2273
2417
|
owner_org_id: "",
|
|
2274
2418
|
// Empty string instead of null to match type
|
|
@@ -2283,7 +2427,7 @@ var initializer = combine(databaseSchema.parse({}), (set, get) => ({
|
|
|
2283
2427
|
star_count: 0,
|
|
2284
2428
|
created_at: currentTime,
|
|
2285
2429
|
updated_at: currentTime,
|
|
2286
|
-
github_repo_full_name: null,
|
|
2430
|
+
github_repo_full_name: snippet.github_repo_full_name || null,
|
|
2287
2431
|
ai_description: "placeholder ai description",
|
|
2288
2432
|
ai_usage_instructions: "placeholder ai usage instructions",
|
|
2289
2433
|
is_snippet: true,
|
|
@@ -2307,7 +2451,8 @@ var initializer = combine(databaseSchema.parse({}), (set, get) => ({
|
|
|
2307
2451
|
created_at: currentTime,
|
|
2308
2452
|
updated_at: currentTime,
|
|
2309
2453
|
has_transpiled: true,
|
|
2310
|
-
transpilation_error: null
|
|
2454
|
+
transpilation_error: null,
|
|
2455
|
+
...snippet.name == "testuser/my-test-board" ? { is_pr_preview: true, github_pr_number: 69 } : {}
|
|
2311
2456
|
});
|
|
2312
2457
|
const packageFiles = [];
|
|
2313
2458
|
let fileIdCounter = nextId;
|
|
@@ -3209,6 +3354,49 @@ var initializer = combine(databaseSchema.parse({}), (set, get) => ({
|
|
|
3209
3354
|
return { ...state, datasheets };
|
|
3210
3355
|
});
|
|
3211
3356
|
return updated;
|
|
3357
|
+
},
|
|
3358
|
+
addPackageBuild: (packageBuild) => {
|
|
3359
|
+
const newPackageBuild = {
|
|
3360
|
+
package_build_id: crypto.randomUUID(),
|
|
3361
|
+
...packageBuild
|
|
3362
|
+
};
|
|
3363
|
+
set((state) => ({
|
|
3364
|
+
packageBuilds: [...state.packageBuilds, newPackageBuild],
|
|
3365
|
+
// Automatically update the package release to reference this as the latest build
|
|
3366
|
+
packageReleases: state.packageReleases.map(
|
|
3367
|
+
(release) => release.package_release_id === packageBuild.package_release_id ? {
|
|
3368
|
+
...release,
|
|
3369
|
+
latest_package_build_id: newPackageBuild.package_build_id
|
|
3370
|
+
} : release
|
|
3371
|
+
)
|
|
3372
|
+
}));
|
|
3373
|
+
return newPackageBuild;
|
|
3374
|
+
},
|
|
3375
|
+
getPackageBuildById: (packageBuildId) => {
|
|
3376
|
+
const state = get();
|
|
3377
|
+
return state.packageBuilds.find(
|
|
3378
|
+
(pb) => pb.package_build_id === packageBuildId
|
|
3379
|
+
);
|
|
3380
|
+
},
|
|
3381
|
+
getPackageBuildsByReleaseId: (packageReleaseId) => {
|
|
3382
|
+
const state = get();
|
|
3383
|
+
return state.packageBuilds.filter((pb) => pb.package_release_id === packageReleaseId).sort(
|
|
3384
|
+
(a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime()
|
|
3385
|
+
);
|
|
3386
|
+
},
|
|
3387
|
+
updatePackageBuild: (packageBuildId, updates) => {
|
|
3388
|
+
let updated;
|
|
3389
|
+
set((state) => {
|
|
3390
|
+
const index = state.packageBuilds.findIndex(
|
|
3391
|
+
(pb) => pb.package_build_id === packageBuildId
|
|
3392
|
+
);
|
|
3393
|
+
if (index === -1) return state;
|
|
3394
|
+
const packageBuilds = [...state.packageBuilds];
|
|
3395
|
+
packageBuilds[index] = { ...packageBuilds[index], ...updates };
|
|
3396
|
+
updated = packageBuilds[index];
|
|
3397
|
+
return { ...state, packageBuilds };
|
|
3398
|
+
});
|
|
3399
|
+
return updated;
|
|
3212
3400
|
}
|
|
3213
3401
|
}));
|
|
3214
3402
|
|