@tscircuit/fake-snippets 0.0.105 → 0.0.106
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/api/generated-index.js +1 -1
- 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 +771 -334
- package/dist/index.d.ts +142 -4
- package/dist/index.js +175 -6
- package/dist/schema.d.ts +198 -1
- package/dist/schema.js +28 -1
- package/fake-snippets-api/lib/db/db-client.ts +51 -3
- package/fake-snippets-api/lib/db/schema.ts +28 -0
- package/fake-snippets-api/lib/db/seed.ts +125 -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/latest.ts +109 -0
- package/fake-snippets-api/routes/api/package_builds/list.ts +98 -0
- package/package.json +1 -1
- package/src/App.tsx +2 -1
- package/src/components/ViewPackagePage/components/sidebar-releases-section.tsx +8 -7
- package/src/components/preview/BuildsList.tsx +267 -188
- package/src/components/preview/ConnectedPackagesList.tsx +36 -24
- package/src/components/preview/ConnectedRepoDashboard.tsx +19 -13
- package/src/components/preview/ConnectedRepoOverview.tsx +52 -34
- package/src/components/preview/index.tsx +13 -73
- package/src/hooks/use-package-builds.ts +135 -0
- package/src/pages/view-connected-repo.tsx +38 -7
package/dist/index.d.ts
CHANGED
|
@@ -821,6 +821,80 @@ declare const jlcpcbOrderStepRunSchema: z.ZodObject<{
|
|
|
821
821
|
error_message?: string | null | undefined;
|
|
822
822
|
}>;
|
|
823
823
|
type JlcpcbOrderStepRun = z.infer<typeof jlcpcbOrderStepRunSchema>;
|
|
824
|
+
declare const packageBuildSchema: z.ZodObject<{
|
|
825
|
+
package_build_id: z.ZodString;
|
|
826
|
+
package_release_id: z.ZodString;
|
|
827
|
+
created_at: z.ZodString;
|
|
828
|
+
transpilation_in_progress: z.ZodDefault<z.ZodBoolean>;
|
|
829
|
+
transpilation_started_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
830
|
+
transpilation_completed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
831
|
+
transpilation_logs: z.ZodDefault<z.ZodArray<z.ZodAny, "many">>;
|
|
832
|
+
transpilation_error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
833
|
+
circuit_json_build_in_progress: z.ZodDefault<z.ZodBoolean>;
|
|
834
|
+
circuit_json_build_started_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
835
|
+
circuit_json_build_completed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
836
|
+
circuit_json_build_logs: z.ZodDefault<z.ZodArray<z.ZodAny, "many">>;
|
|
837
|
+
circuit_json_build_error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
838
|
+
build_in_progress: z.ZodDefault<z.ZodBoolean>;
|
|
839
|
+
build_started_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
840
|
+
build_completed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
841
|
+
build_error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
842
|
+
build_error_last_updated_at: z.ZodString;
|
|
843
|
+
preview_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
844
|
+
build_logs: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
845
|
+
branch_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
846
|
+
commit_message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
847
|
+
commit_author: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
848
|
+
}, "strip", z.ZodTypeAny, {
|
|
849
|
+
package_release_id: string;
|
|
850
|
+
created_at: string;
|
|
851
|
+
transpilation_in_progress: boolean;
|
|
852
|
+
transpilation_logs: any[];
|
|
853
|
+
circuit_json_build_in_progress: boolean;
|
|
854
|
+
circuit_json_build_logs: any[];
|
|
855
|
+
package_build_id: string;
|
|
856
|
+
build_in_progress: boolean;
|
|
857
|
+
build_error_last_updated_at: string;
|
|
858
|
+
circuit_json_build_error?: string | null | undefined;
|
|
859
|
+
transpilation_error?: string | null | undefined;
|
|
860
|
+
transpilation_started_at?: string | null | undefined;
|
|
861
|
+
transpilation_completed_at?: string | null | undefined;
|
|
862
|
+
circuit_json_build_started_at?: string | null | undefined;
|
|
863
|
+
circuit_json_build_completed_at?: string | null | undefined;
|
|
864
|
+
build_started_at?: string | null | undefined;
|
|
865
|
+
build_completed_at?: string | null | undefined;
|
|
866
|
+
build_error?: string | null | undefined;
|
|
867
|
+
preview_url?: string | null | undefined;
|
|
868
|
+
build_logs?: string | null | undefined;
|
|
869
|
+
branch_name?: string | null | undefined;
|
|
870
|
+
commit_message?: string | null | undefined;
|
|
871
|
+
commit_author?: string | null | undefined;
|
|
872
|
+
}, {
|
|
873
|
+
package_release_id: string;
|
|
874
|
+
created_at: string;
|
|
875
|
+
package_build_id: string;
|
|
876
|
+
build_error_last_updated_at: string;
|
|
877
|
+
circuit_json_build_error?: string | null | undefined;
|
|
878
|
+
transpilation_error?: string | null | undefined;
|
|
879
|
+
transpilation_in_progress?: boolean | undefined;
|
|
880
|
+
transpilation_started_at?: string | null | undefined;
|
|
881
|
+
transpilation_completed_at?: string | null | undefined;
|
|
882
|
+
transpilation_logs?: any[] | undefined;
|
|
883
|
+
circuit_json_build_in_progress?: boolean | undefined;
|
|
884
|
+
circuit_json_build_started_at?: string | null | undefined;
|
|
885
|
+
circuit_json_build_completed_at?: string | null | undefined;
|
|
886
|
+
circuit_json_build_logs?: any[] | undefined;
|
|
887
|
+
build_in_progress?: boolean | undefined;
|
|
888
|
+
build_started_at?: string | null | undefined;
|
|
889
|
+
build_completed_at?: string | null | undefined;
|
|
890
|
+
build_error?: string | null | undefined;
|
|
891
|
+
preview_url?: string | null | undefined;
|
|
892
|
+
build_logs?: string | null | undefined;
|
|
893
|
+
branch_name?: string | null | undefined;
|
|
894
|
+
commit_message?: string | null | undefined;
|
|
895
|
+
commit_author?: string | null | undefined;
|
|
896
|
+
}>;
|
|
897
|
+
type PackageBuild = z.infer<typeof packageBuildSchema>;
|
|
824
898
|
|
|
825
899
|
declare const createDatabase: ({ seed }?: {
|
|
826
900
|
seed?: boolean;
|
|
@@ -1100,7 +1174,32 @@ declare const createDatabase: ({ seed }?: {
|
|
|
1100
1174
|
access_token?: string | null | undefined;
|
|
1101
1175
|
access_token_expires_at?: string | null | undefined;
|
|
1102
1176
|
}[];
|
|
1103
|
-
|
|
1177
|
+
packageBuilds: {
|
|
1178
|
+
package_release_id: string;
|
|
1179
|
+
created_at: string;
|
|
1180
|
+
transpilation_in_progress: boolean;
|
|
1181
|
+
transpilation_logs: any[];
|
|
1182
|
+
circuit_json_build_in_progress: boolean;
|
|
1183
|
+
circuit_json_build_logs: any[];
|
|
1184
|
+
package_build_id: string;
|
|
1185
|
+
build_in_progress: boolean;
|
|
1186
|
+
build_error_last_updated_at: string;
|
|
1187
|
+
circuit_json_build_error?: string | null | undefined;
|
|
1188
|
+
transpilation_error?: string | null | undefined;
|
|
1189
|
+
transpilation_started_at?: string | null | undefined;
|
|
1190
|
+
transpilation_completed_at?: string | null | undefined;
|
|
1191
|
+
circuit_json_build_started_at?: string | null | undefined;
|
|
1192
|
+
circuit_json_build_completed_at?: string | null | undefined;
|
|
1193
|
+
build_started_at?: string | null | undefined;
|
|
1194
|
+
build_completed_at?: string | null | undefined;
|
|
1195
|
+
build_error?: string | null | undefined;
|
|
1196
|
+
preview_url?: string | null | undefined;
|
|
1197
|
+
build_logs?: string | null | undefined;
|
|
1198
|
+
branch_name?: string | null | undefined;
|
|
1199
|
+
commit_message?: string | null | undefined;
|
|
1200
|
+
commit_author?: string | null | undefined;
|
|
1201
|
+
}[];
|
|
1202
|
+
}, "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
1203
|
addOrder: (order: Omit<Order, "order_id">) => Order;
|
|
1105
1204
|
getOrderById: (orderId: string) => Order | undefined;
|
|
1106
1205
|
getOrderFilesByOrderId: (orderId: string) => OrderFile[];
|
|
@@ -1137,7 +1236,10 @@ declare const createDatabase: ({ seed }?: {
|
|
|
1137
1236
|
getAccountPackageById: (accountPackageId: string) => AccountPackage | undefined;
|
|
1138
1237
|
updateAccountPackage: (accountPackageId: string, updates: Partial<AccountPackage>) => void;
|
|
1139
1238
|
deleteAccountPackage: (accountPackageId: string) => boolean;
|
|
1140
|
-
addSnippet: (snippet: Omit<z.input<typeof snippetSchema>, "snippet_id" | "package_release_id">
|
|
1239
|
+
addSnippet: (snippet: Omit<z.input<typeof snippetSchema>, "snippet_id" | "package_release_id"> & {
|
|
1240
|
+
creator_account_id?: string;
|
|
1241
|
+
github_repo_full_name?: string;
|
|
1242
|
+
}) => Snippet;
|
|
1141
1243
|
getLatestSnippets: (limit: number) => Snippet[];
|
|
1142
1244
|
getTrendingSnippets: (limit: number, since: string) => Snippet[];
|
|
1143
1245
|
getPackagesByAuthor: (authorName?: string) => Package[];
|
|
@@ -1193,6 +1295,10 @@ declare const createDatabase: ({ seed }?: {
|
|
|
1193
1295
|
is_popular?: boolean;
|
|
1194
1296
|
}) => Datasheet[];
|
|
1195
1297
|
updateDatasheet: (datasheetId: string, updates: Partial<Datasheet>) => Datasheet | undefined;
|
|
1298
|
+
addPackageBuild: (packageBuild: Omit<PackageBuild, "package_build_id">) => PackageBuild;
|
|
1299
|
+
getPackageBuildById: (packageBuildId: string) => PackageBuild | undefined;
|
|
1300
|
+
getPackageBuildsByReleaseId: (packageReleaseId: string) => PackageBuild[];
|
|
1301
|
+
updatePackageBuild: (packageBuildId: string, updates: Partial<PackageBuild>) => PackageBuild | undefined;
|
|
1196
1302
|
}> & Omit<{
|
|
1197
1303
|
idCounter: number;
|
|
1198
1304
|
snippets: {
|
|
@@ -1469,7 +1575,32 @@ declare const createDatabase: ({ seed }?: {
|
|
|
1469
1575
|
access_token?: string | null | undefined;
|
|
1470
1576
|
access_token_expires_at?: string | null | undefined;
|
|
1471
1577
|
}[];
|
|
1472
|
-
|
|
1578
|
+
packageBuilds: {
|
|
1579
|
+
package_release_id: string;
|
|
1580
|
+
created_at: string;
|
|
1581
|
+
transpilation_in_progress: boolean;
|
|
1582
|
+
transpilation_logs: any[];
|
|
1583
|
+
circuit_json_build_in_progress: boolean;
|
|
1584
|
+
circuit_json_build_logs: any[];
|
|
1585
|
+
package_build_id: string;
|
|
1586
|
+
build_in_progress: boolean;
|
|
1587
|
+
build_error_last_updated_at: string;
|
|
1588
|
+
circuit_json_build_error?: string | null | undefined;
|
|
1589
|
+
transpilation_error?: string | null | undefined;
|
|
1590
|
+
transpilation_started_at?: string | null | undefined;
|
|
1591
|
+
transpilation_completed_at?: string | null | undefined;
|
|
1592
|
+
circuit_json_build_started_at?: string | null | undefined;
|
|
1593
|
+
circuit_json_build_completed_at?: string | null | undefined;
|
|
1594
|
+
build_started_at?: string | null | undefined;
|
|
1595
|
+
build_completed_at?: string | null | undefined;
|
|
1596
|
+
build_error?: string | null | undefined;
|
|
1597
|
+
preview_url?: string | null | undefined;
|
|
1598
|
+
build_logs?: string | null | undefined;
|
|
1599
|
+
branch_name?: string | null | undefined;
|
|
1600
|
+
commit_message?: string | null | undefined;
|
|
1601
|
+
commit_author?: string | null | undefined;
|
|
1602
|
+
}[];
|
|
1603
|
+
}, "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
1604
|
addOrder: (order: Omit<Order, "order_id">) => Order;
|
|
1474
1605
|
getOrderById: (orderId: string) => Order | undefined;
|
|
1475
1606
|
getOrderFilesByOrderId: (orderId: string) => OrderFile[];
|
|
@@ -1506,7 +1637,10 @@ declare const createDatabase: ({ seed }?: {
|
|
|
1506
1637
|
getAccountPackageById: (accountPackageId: string) => AccountPackage | undefined;
|
|
1507
1638
|
updateAccountPackage: (accountPackageId: string, updates: Partial<AccountPackage>) => void;
|
|
1508
1639
|
deleteAccountPackage: (accountPackageId: string) => boolean;
|
|
1509
|
-
addSnippet: (snippet: Omit<z.input<typeof snippetSchema>, "snippet_id" | "package_release_id">
|
|
1640
|
+
addSnippet: (snippet: Omit<z.input<typeof snippetSchema>, "snippet_id" | "package_release_id"> & {
|
|
1641
|
+
creator_account_id?: string;
|
|
1642
|
+
github_repo_full_name?: string;
|
|
1643
|
+
}) => Snippet;
|
|
1510
1644
|
getLatestSnippets: (limit: number) => Snippet[];
|
|
1511
1645
|
getTrendingSnippets: (limit: number, since: string) => Snippet[];
|
|
1512
1646
|
getPackagesByAuthor: (authorName?: string) => Package[];
|
|
@@ -1562,6 +1696,10 @@ declare const createDatabase: ({ seed }?: {
|
|
|
1562
1696
|
is_popular?: boolean;
|
|
1563
1697
|
}) => Datasheet[];
|
|
1564
1698
|
updateDatasheet: (datasheetId: string, updates: Partial<Datasheet>) => Datasheet | undefined;
|
|
1699
|
+
addPackageBuild: (packageBuild: Omit<PackageBuild, "package_build_id">) => PackageBuild;
|
|
1700
|
+
getPackageBuildById: (packageBuildId: string) => PackageBuild | undefined;
|
|
1701
|
+
getPackageBuildsByReleaseId: (packageReleaseId: string) => PackageBuild[];
|
|
1702
|
+
updatePackageBuild: (packageBuildId: string, updates: Partial<PackageBuild>) => PackageBuild | undefined;
|
|
1565
1703
|
};
|
|
1566
1704
|
type DbClient = ReturnType<typeof createDatabase>;
|
|
1567
1705
|
|
package/dist/index.js
CHANGED
|
@@ -291,6 +291,31 @@ var jlcpcbOrderStepRunSchema = z.object({
|
|
|
291
291
|
error_message: z.string().nullable().default(null),
|
|
292
292
|
created_at: z.string()
|
|
293
293
|
});
|
|
294
|
+
var packageBuildSchema = z.object({
|
|
295
|
+
package_build_id: z.string().uuid(),
|
|
296
|
+
package_release_id: z.string(),
|
|
297
|
+
created_at: z.string().datetime(),
|
|
298
|
+
transpilation_in_progress: z.boolean().default(false),
|
|
299
|
+
transpilation_started_at: z.string().datetime().nullable().optional(),
|
|
300
|
+
transpilation_completed_at: z.string().datetime().nullable().optional(),
|
|
301
|
+
transpilation_logs: z.array(z.any()).default([]),
|
|
302
|
+
transpilation_error: z.string().nullable().optional(),
|
|
303
|
+
circuit_json_build_in_progress: z.boolean().default(false),
|
|
304
|
+
circuit_json_build_started_at: z.string().datetime().nullable().optional(),
|
|
305
|
+
circuit_json_build_completed_at: z.string().datetime().nullable().optional(),
|
|
306
|
+
circuit_json_build_logs: z.array(z.any()).default([]),
|
|
307
|
+
circuit_json_build_error: z.string().nullable().optional(),
|
|
308
|
+
build_in_progress: z.boolean().default(false),
|
|
309
|
+
build_started_at: z.string().datetime().nullable().optional(),
|
|
310
|
+
build_completed_at: z.string().datetime().nullable().optional(),
|
|
311
|
+
build_error: z.string().nullable().optional(),
|
|
312
|
+
build_error_last_updated_at: z.string().datetime(),
|
|
313
|
+
preview_url: z.string().nullable().optional(),
|
|
314
|
+
build_logs: z.string().nullable().optional(),
|
|
315
|
+
branch_name: z.string().nullable().optional(),
|
|
316
|
+
commit_message: z.string().nullable().optional(),
|
|
317
|
+
commit_author: z.string().nullable().optional()
|
|
318
|
+
});
|
|
294
319
|
var databaseSchema = z.object({
|
|
295
320
|
idCounter: z.number().default(0),
|
|
296
321
|
snippets: z.array(snippetSchema).default([]),
|
|
@@ -309,7 +334,8 @@ var databaseSchema = z.object({
|
|
|
309
334
|
orderQuotes: z.array(orderQuoteSchema).default([]),
|
|
310
335
|
aiReviews: z.array(aiReviewSchema).default([]),
|
|
311
336
|
datasheets: z.array(datasheetSchema).default([]),
|
|
312
|
-
githubInstallations: z.array(githubInstallationSchema).default([])
|
|
337
|
+
githubInstallations: z.array(githubInstallationSchema).default([]),
|
|
338
|
+
packageBuilds: z.array(packageBuildSchema).default([])
|
|
313
339
|
});
|
|
314
340
|
|
|
315
341
|
// fake-snippets-api/lib/db/autoload-dev-packages.ts
|
|
@@ -508,10 +534,12 @@ var seed = (db) => {
|
|
|
508
534
|
if (process.env.AUTOLOAD_PACKAGES === "true") {
|
|
509
535
|
loadAutoloadPackages(db);
|
|
510
536
|
}
|
|
511
|
-
db.addSnippet({
|
|
537
|
+
const { package_release_id: packageReleaseId1 } = db.addSnippet({
|
|
512
538
|
name: "testuser/my-test-board",
|
|
513
539
|
unscoped_name: "my-test-board",
|
|
540
|
+
github_repo_full_name: "testuser/my-test-board",
|
|
514
541
|
owner_name: "testuser",
|
|
542
|
+
creator_account_id: account_id,
|
|
515
543
|
code: `
|
|
516
544
|
import { A555Timer } from "@tsci/seveibar.a555timer"
|
|
517
545
|
|
|
@@ -1017,6 +1045,36 @@ export default () => (
|
|
|
1017
1045
|
}
|
|
1018
1046
|
]
|
|
1019
1047
|
});
|
|
1048
|
+
db.addPackageBuild({
|
|
1049
|
+
package_release_id: packageReleaseId1,
|
|
1050
|
+
created_at: new Date(Date.now() - 15e3).toISOString(),
|
|
1051
|
+
// 15 seconds ago
|
|
1052
|
+
transpilation_in_progress: false,
|
|
1053
|
+
transpilation_started_at: new Date(Date.now() - 15e3).toISOString(),
|
|
1054
|
+
transpilation_completed_at: new Date(Date.now() - 14e3).toISOString(),
|
|
1055
|
+
transpilation_logs: [
|
|
1056
|
+
"[INFO] Starting transpilation...",
|
|
1057
|
+
"[INFO] Parsing package code",
|
|
1058
|
+
"[ERROR] Failed to parse TypeScript definitions",
|
|
1059
|
+
"[ERROR] Invalid syntax in component declaration"
|
|
1060
|
+
],
|
|
1061
|
+
transpilation_error: "TypeScript compilation failed: Syntax error in component declaration",
|
|
1062
|
+
circuit_json_build_in_progress: false,
|
|
1063
|
+
circuit_json_build_started_at: null,
|
|
1064
|
+
circuit_json_build_completed_at: null,
|
|
1065
|
+
circuit_json_build_logs: [],
|
|
1066
|
+
circuit_json_build_error: "Build cancelled due to transpilation failure",
|
|
1067
|
+
build_in_progress: false,
|
|
1068
|
+
build_started_at: new Date(Date.now() - 15e3).toISOString(),
|
|
1069
|
+
build_completed_at: new Date(Date.now() - 14e3).toISOString(),
|
|
1070
|
+
build_error: "Build failed: Unable to complete transpilation step",
|
|
1071
|
+
build_error_last_updated_at: new Date(Date.now() - 14e3).toISOString(),
|
|
1072
|
+
preview_url: null,
|
|
1073
|
+
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",
|
|
1074
|
+
branch_name: "main",
|
|
1075
|
+
commit_message: "Attempted build of a555timer-square-wave package",
|
|
1076
|
+
commit_author: "testuser"
|
|
1077
|
+
});
|
|
1020
1078
|
db.addSnippet({
|
|
1021
1079
|
name: "seveibar/a555timer",
|
|
1022
1080
|
unscoped_name: "a555timer",
|
|
@@ -1544,10 +1602,11 @@ exports.A555Timer = A555Timer;
|
|
|
1544
1602
|
}
|
|
1545
1603
|
]
|
|
1546
1604
|
});
|
|
1547
|
-
db.addSnippet({
|
|
1605
|
+
const { package_release_id: packageReleaseId2 } = db.addSnippet({
|
|
1548
1606
|
name: "testuser/a555timer-square-wave",
|
|
1549
1607
|
unscoped_name: "a555timer-square-wave",
|
|
1550
1608
|
owner_name: "testuser",
|
|
1609
|
+
creator_account_id: account_id,
|
|
1551
1610
|
code: `
|
|
1552
1611
|
import { A555Timer } from "@tsci/seveibar.a555timer"
|
|
1553
1612
|
|
|
@@ -1560,6 +1619,7 @@ export const SquareWaveModule = () => (
|
|
|
1560
1619
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1561
1620
|
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1562
1621
|
snippet_type: "package",
|
|
1622
|
+
github_repo_full_name: "testuser/test",
|
|
1563
1623
|
description: "A simple package that outputs a square waveform using the a555timer",
|
|
1564
1624
|
circuit_json: [
|
|
1565
1625
|
{
|
|
@@ -2053,6 +2113,78 @@ export const SquareWaveModule = () => (
|
|
|
2053
2113
|
}
|
|
2054
2114
|
]
|
|
2055
2115
|
});
|
|
2116
|
+
db.addPackageBuild({
|
|
2117
|
+
package_release_id: packageReleaseId2,
|
|
2118
|
+
created_at: new Date(Date.now() - 15e3).toISOString(),
|
|
2119
|
+
// 15 seconds ago
|
|
2120
|
+
transpilation_in_progress: false,
|
|
2121
|
+
transpilation_started_at: new Date(Date.now() - 15e3).toISOString(),
|
|
2122
|
+
transpilation_completed_at: new Date(Date.now() - 14e3).toISOString(),
|
|
2123
|
+
transpilation_logs: [
|
|
2124
|
+
"[INFO] Starting transpilation...",
|
|
2125
|
+
"[INFO] Parsing package code",
|
|
2126
|
+
"[ERROR] Failed to parse TypeScript definitions",
|
|
2127
|
+
"[ERROR] Invalid syntax in component declaration"
|
|
2128
|
+
],
|
|
2129
|
+
transpilation_error: "TypeScript compilation failed: Syntax error in component declaration",
|
|
2130
|
+
circuit_json_build_in_progress: false,
|
|
2131
|
+
circuit_json_build_started_at: null,
|
|
2132
|
+
circuit_json_build_completed_at: null,
|
|
2133
|
+
circuit_json_build_logs: [],
|
|
2134
|
+
circuit_json_build_error: "Build cancelled due to transpilation failure",
|
|
2135
|
+
build_in_progress: false,
|
|
2136
|
+
build_started_at: new Date(Date.now() - 15e3).toISOString(),
|
|
2137
|
+
build_completed_at: new Date(Date.now() - 14e3).toISOString(),
|
|
2138
|
+
build_error: "Build failed: Unable to complete transpilation step",
|
|
2139
|
+
build_error_last_updated_at: new Date(Date.now() - 14e3).toISOString(),
|
|
2140
|
+
preview_url: null,
|
|
2141
|
+
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",
|
|
2142
|
+
branch_name: "main",
|
|
2143
|
+
commit_message: "Attempted build of a555timer-square-wave package",
|
|
2144
|
+
commit_author: "testuser"
|
|
2145
|
+
});
|
|
2146
|
+
db.addPackageBuild({
|
|
2147
|
+
package_release_id: packageReleaseId2,
|
|
2148
|
+
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2149
|
+
transpilation_in_progress: false,
|
|
2150
|
+
transpilation_started_at: new Date(Date.now() - 5e3).toISOString(),
|
|
2151
|
+
// Started 5 seconds ago
|
|
2152
|
+
transpilation_completed_at: new Date(Date.now() - 3e3).toISOString(),
|
|
2153
|
+
// Completed 3 seconds ago
|
|
2154
|
+
transpilation_logs: [
|
|
2155
|
+
"[INFO] Starting transpilation...",
|
|
2156
|
+
"[INFO] Parsing package code",
|
|
2157
|
+
"[INFO] Generating TypeScript definitions",
|
|
2158
|
+
"[INFO] Compiling to JavaScript",
|
|
2159
|
+
"[SUCCESS] Transpilation completed successfully"
|
|
2160
|
+
],
|
|
2161
|
+
transpilation_error: null,
|
|
2162
|
+
circuit_json_build_in_progress: false,
|
|
2163
|
+
circuit_json_build_started_at: new Date(Date.now() - 3e3).toISOString(),
|
|
2164
|
+
// Started after transpilation
|
|
2165
|
+
circuit_json_build_completed_at: new Date(Date.now() - 1e3).toISOString(),
|
|
2166
|
+
// Completed 1 second ago
|
|
2167
|
+
circuit_json_build_logs: [
|
|
2168
|
+
"[INFO] Starting circuit JSON build...",
|
|
2169
|
+
"[INFO] Analyzing component structure",
|
|
2170
|
+
"[INFO] Generating port configurations",
|
|
2171
|
+
"[INFO] Validating circuit connections",
|
|
2172
|
+
"[SUCCESS] Circuit JSON build completed"
|
|
2173
|
+
],
|
|
2174
|
+
circuit_json_build_error: null,
|
|
2175
|
+
build_in_progress: false,
|
|
2176
|
+
build_started_at: new Date(Date.now() - 1e4).toISOString(),
|
|
2177
|
+
// Started 10 seconds ago
|
|
2178
|
+
build_completed_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2179
|
+
// Just completed
|
|
2180
|
+
build_error: null,
|
|
2181
|
+
build_error_last_updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2182
|
+
preview_url: "http://localhost:3000/preview/package_build_1",
|
|
2183
|
+
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",
|
|
2184
|
+
branch_name: "main",
|
|
2185
|
+
commit_message: "Initial build of a555timer-square-wave package",
|
|
2186
|
+
commit_author: "testuser"
|
|
2187
|
+
});
|
|
2056
2188
|
db.addOrder({
|
|
2057
2189
|
account_id,
|
|
2058
2190
|
is_running: false,
|
|
@@ -2268,7 +2400,7 @@ var initializer = combine(databaseSchema.parse({}), (set, get) => ({
|
|
|
2268
2400
|
const nextId = newState.idCounter + 1;
|
|
2269
2401
|
const newPackage = {
|
|
2270
2402
|
package_id: `pkg_${nextId}`,
|
|
2271
|
-
creator_account_id: snippet.owner_name,
|
|
2403
|
+
creator_account_id: snippet.creator_account_id ?? snippet.owner_name,
|
|
2272
2404
|
// Using owner_name as account_id since we don't have context
|
|
2273
2405
|
owner_org_id: "",
|
|
2274
2406
|
// Empty string instead of null to match type
|
|
@@ -2283,7 +2415,7 @@ var initializer = combine(databaseSchema.parse({}), (set, get) => ({
|
|
|
2283
2415
|
star_count: 0,
|
|
2284
2416
|
created_at: currentTime,
|
|
2285
2417
|
updated_at: currentTime,
|
|
2286
|
-
github_repo_full_name: null,
|
|
2418
|
+
github_repo_full_name: snippet.github_repo_full_name || null,
|
|
2287
2419
|
ai_description: "placeholder ai description",
|
|
2288
2420
|
ai_usage_instructions: "placeholder ai usage instructions",
|
|
2289
2421
|
is_snippet: true,
|
|
@@ -2307,7 +2439,8 @@ var initializer = combine(databaseSchema.parse({}), (set, get) => ({
|
|
|
2307
2439
|
created_at: currentTime,
|
|
2308
2440
|
updated_at: currentTime,
|
|
2309
2441
|
has_transpiled: true,
|
|
2310
|
-
transpilation_error: null
|
|
2442
|
+
transpilation_error: null,
|
|
2443
|
+
...snippet.name == "testuser/my-test-board" ? { is_pr_preview: true, github_pr_number: 69 } : {}
|
|
2311
2444
|
});
|
|
2312
2445
|
const packageFiles = [];
|
|
2313
2446
|
let fileIdCounter = nextId;
|
|
@@ -3209,6 +3342,42 @@ var initializer = combine(databaseSchema.parse({}), (set, get) => ({
|
|
|
3209
3342
|
return { ...state, datasheets };
|
|
3210
3343
|
});
|
|
3211
3344
|
return updated;
|
|
3345
|
+
},
|
|
3346
|
+
addPackageBuild: (packageBuild) => {
|
|
3347
|
+
const newPackageBuild = {
|
|
3348
|
+
package_build_id: crypto.randomUUID(),
|
|
3349
|
+
...packageBuild
|
|
3350
|
+
};
|
|
3351
|
+
set((state) => ({
|
|
3352
|
+
packageBuilds: [...state.packageBuilds, newPackageBuild]
|
|
3353
|
+
}));
|
|
3354
|
+
return newPackageBuild;
|
|
3355
|
+
},
|
|
3356
|
+
getPackageBuildById: (packageBuildId) => {
|
|
3357
|
+
const state = get();
|
|
3358
|
+
return state.packageBuilds.find(
|
|
3359
|
+
(pb) => pb.package_build_id === packageBuildId
|
|
3360
|
+
);
|
|
3361
|
+
},
|
|
3362
|
+
getPackageBuildsByReleaseId: (packageReleaseId) => {
|
|
3363
|
+
const state = get();
|
|
3364
|
+
return state.packageBuilds.filter((pb) => pb.package_release_id === packageReleaseId).sort(
|
|
3365
|
+
(a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime()
|
|
3366
|
+
);
|
|
3367
|
+
},
|
|
3368
|
+
updatePackageBuild: (packageBuildId, updates) => {
|
|
3369
|
+
let updated;
|
|
3370
|
+
set((state) => {
|
|
3371
|
+
const index = state.packageBuilds.findIndex(
|
|
3372
|
+
(pb) => pb.package_build_id === packageBuildId
|
|
3373
|
+
);
|
|
3374
|
+
if (index === -1) return state;
|
|
3375
|
+
const packageBuilds = [...state.packageBuilds];
|
|
3376
|
+
packageBuilds[index] = { ...packageBuilds[index], ...updates };
|
|
3377
|
+
updated = packageBuilds[index];
|
|
3378
|
+
return { ...state, packageBuilds };
|
|
3379
|
+
});
|
|
3380
|
+
return updated;
|
|
3212
3381
|
}
|
|
3213
3382
|
}));
|
|
3214
3383
|
|