@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/schema.d.ts
CHANGED
|
@@ -994,6 +994,80 @@ declare const jlcpcbOrderStepRunSchema: z.ZodObject<{
|
|
|
994
994
|
error_message?: string | null | undefined;
|
|
995
995
|
}>;
|
|
996
996
|
type JlcpcbOrderStepRun = z.infer<typeof jlcpcbOrderStepRunSchema>;
|
|
997
|
+
declare const packageBuildSchema: z.ZodObject<{
|
|
998
|
+
package_build_id: z.ZodString;
|
|
999
|
+
package_release_id: z.ZodString;
|
|
1000
|
+
created_at: z.ZodString;
|
|
1001
|
+
transpilation_in_progress: z.ZodDefault<z.ZodBoolean>;
|
|
1002
|
+
transpilation_started_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1003
|
+
transpilation_completed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1004
|
+
transpilation_logs: z.ZodDefault<z.ZodArray<z.ZodAny, "many">>;
|
|
1005
|
+
transpilation_error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1006
|
+
circuit_json_build_in_progress: z.ZodDefault<z.ZodBoolean>;
|
|
1007
|
+
circuit_json_build_started_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1008
|
+
circuit_json_build_completed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1009
|
+
circuit_json_build_logs: z.ZodDefault<z.ZodArray<z.ZodAny, "many">>;
|
|
1010
|
+
circuit_json_build_error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1011
|
+
build_in_progress: z.ZodDefault<z.ZodBoolean>;
|
|
1012
|
+
build_started_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1013
|
+
build_completed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1014
|
+
build_error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1015
|
+
build_error_last_updated_at: z.ZodString;
|
|
1016
|
+
preview_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1017
|
+
build_logs: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1018
|
+
branch_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1019
|
+
commit_message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1020
|
+
commit_author: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1021
|
+
}, "strip", z.ZodTypeAny, {
|
|
1022
|
+
package_release_id: string;
|
|
1023
|
+
created_at: string;
|
|
1024
|
+
transpilation_in_progress: boolean;
|
|
1025
|
+
transpilation_logs: any[];
|
|
1026
|
+
circuit_json_build_in_progress: boolean;
|
|
1027
|
+
circuit_json_build_logs: any[];
|
|
1028
|
+
package_build_id: string;
|
|
1029
|
+
build_in_progress: boolean;
|
|
1030
|
+
build_error_last_updated_at: string;
|
|
1031
|
+
circuit_json_build_error?: string | null | undefined;
|
|
1032
|
+
transpilation_error?: string | null | undefined;
|
|
1033
|
+
transpilation_started_at?: string | null | undefined;
|
|
1034
|
+
transpilation_completed_at?: string | null | undefined;
|
|
1035
|
+
circuit_json_build_started_at?: string | null | undefined;
|
|
1036
|
+
circuit_json_build_completed_at?: string | null | undefined;
|
|
1037
|
+
build_started_at?: string | null | undefined;
|
|
1038
|
+
build_completed_at?: string | null | undefined;
|
|
1039
|
+
build_error?: string | null | undefined;
|
|
1040
|
+
preview_url?: string | null | undefined;
|
|
1041
|
+
build_logs?: string | null | undefined;
|
|
1042
|
+
branch_name?: string | null | undefined;
|
|
1043
|
+
commit_message?: string | null | undefined;
|
|
1044
|
+
commit_author?: string | null | undefined;
|
|
1045
|
+
}, {
|
|
1046
|
+
package_release_id: string;
|
|
1047
|
+
created_at: string;
|
|
1048
|
+
package_build_id: string;
|
|
1049
|
+
build_error_last_updated_at: string;
|
|
1050
|
+
circuit_json_build_error?: string | null | undefined;
|
|
1051
|
+
transpilation_error?: string | null | undefined;
|
|
1052
|
+
transpilation_in_progress?: boolean | undefined;
|
|
1053
|
+
transpilation_started_at?: string | null | undefined;
|
|
1054
|
+
transpilation_completed_at?: string | null | undefined;
|
|
1055
|
+
transpilation_logs?: any[] | undefined;
|
|
1056
|
+
circuit_json_build_in_progress?: boolean | undefined;
|
|
1057
|
+
circuit_json_build_started_at?: string | null | undefined;
|
|
1058
|
+
circuit_json_build_completed_at?: string | null | undefined;
|
|
1059
|
+
circuit_json_build_logs?: any[] | undefined;
|
|
1060
|
+
build_in_progress?: boolean | undefined;
|
|
1061
|
+
build_started_at?: string | null | undefined;
|
|
1062
|
+
build_completed_at?: string | null | undefined;
|
|
1063
|
+
build_error?: string | null | undefined;
|
|
1064
|
+
preview_url?: string | null | undefined;
|
|
1065
|
+
build_logs?: string | null | undefined;
|
|
1066
|
+
branch_name?: string | null | undefined;
|
|
1067
|
+
commit_message?: string | null | undefined;
|
|
1068
|
+
commit_author?: string | null | undefined;
|
|
1069
|
+
}>;
|
|
1070
|
+
type PackageBuild = z.infer<typeof packageBuildSchema>;
|
|
997
1071
|
declare const databaseSchema: z.ZodObject<{
|
|
998
1072
|
idCounter: z.ZodDefault<z.ZodNumber>;
|
|
999
1073
|
snippets: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
@@ -1850,6 +1924,79 @@ declare const databaseSchema: z.ZodObject<{
|
|
|
1850
1924
|
access_token?: string | null | undefined;
|
|
1851
1925
|
access_token_expires_at?: string | null | undefined;
|
|
1852
1926
|
}>, "many">>;
|
|
1927
|
+
packageBuilds: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
1928
|
+
package_build_id: z.ZodString;
|
|
1929
|
+
package_release_id: z.ZodString;
|
|
1930
|
+
created_at: z.ZodString;
|
|
1931
|
+
transpilation_in_progress: z.ZodDefault<z.ZodBoolean>;
|
|
1932
|
+
transpilation_started_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1933
|
+
transpilation_completed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1934
|
+
transpilation_logs: z.ZodDefault<z.ZodArray<z.ZodAny, "many">>;
|
|
1935
|
+
transpilation_error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1936
|
+
circuit_json_build_in_progress: z.ZodDefault<z.ZodBoolean>;
|
|
1937
|
+
circuit_json_build_started_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1938
|
+
circuit_json_build_completed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1939
|
+
circuit_json_build_logs: z.ZodDefault<z.ZodArray<z.ZodAny, "many">>;
|
|
1940
|
+
circuit_json_build_error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1941
|
+
build_in_progress: z.ZodDefault<z.ZodBoolean>;
|
|
1942
|
+
build_started_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1943
|
+
build_completed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1944
|
+
build_error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1945
|
+
build_error_last_updated_at: z.ZodString;
|
|
1946
|
+
preview_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1947
|
+
build_logs: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1948
|
+
branch_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1949
|
+
commit_message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1950
|
+
commit_author: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1951
|
+
}, "strip", z.ZodTypeAny, {
|
|
1952
|
+
package_release_id: string;
|
|
1953
|
+
created_at: string;
|
|
1954
|
+
transpilation_in_progress: boolean;
|
|
1955
|
+
transpilation_logs: any[];
|
|
1956
|
+
circuit_json_build_in_progress: boolean;
|
|
1957
|
+
circuit_json_build_logs: any[];
|
|
1958
|
+
package_build_id: string;
|
|
1959
|
+
build_in_progress: boolean;
|
|
1960
|
+
build_error_last_updated_at: string;
|
|
1961
|
+
circuit_json_build_error?: string | null | undefined;
|
|
1962
|
+
transpilation_error?: string | null | undefined;
|
|
1963
|
+
transpilation_started_at?: string | null | undefined;
|
|
1964
|
+
transpilation_completed_at?: string | null | undefined;
|
|
1965
|
+
circuit_json_build_started_at?: string | null | undefined;
|
|
1966
|
+
circuit_json_build_completed_at?: string | null | undefined;
|
|
1967
|
+
build_started_at?: string | null | undefined;
|
|
1968
|
+
build_completed_at?: string | null | undefined;
|
|
1969
|
+
build_error?: string | null | undefined;
|
|
1970
|
+
preview_url?: string | null | undefined;
|
|
1971
|
+
build_logs?: string | null | undefined;
|
|
1972
|
+
branch_name?: string | null | undefined;
|
|
1973
|
+
commit_message?: string | null | undefined;
|
|
1974
|
+
commit_author?: string | null | undefined;
|
|
1975
|
+
}, {
|
|
1976
|
+
package_release_id: string;
|
|
1977
|
+
created_at: string;
|
|
1978
|
+
package_build_id: string;
|
|
1979
|
+
build_error_last_updated_at: string;
|
|
1980
|
+
circuit_json_build_error?: string | null | undefined;
|
|
1981
|
+
transpilation_error?: string | null | undefined;
|
|
1982
|
+
transpilation_in_progress?: boolean | undefined;
|
|
1983
|
+
transpilation_started_at?: string | null | undefined;
|
|
1984
|
+
transpilation_completed_at?: string | null | undefined;
|
|
1985
|
+
transpilation_logs?: any[] | undefined;
|
|
1986
|
+
circuit_json_build_in_progress?: boolean | undefined;
|
|
1987
|
+
circuit_json_build_started_at?: string | null | undefined;
|
|
1988
|
+
circuit_json_build_completed_at?: string | null | undefined;
|
|
1989
|
+
circuit_json_build_logs?: any[] | undefined;
|
|
1990
|
+
build_in_progress?: boolean | undefined;
|
|
1991
|
+
build_started_at?: string | null | undefined;
|
|
1992
|
+
build_completed_at?: string | null | undefined;
|
|
1993
|
+
build_error?: string | null | undefined;
|
|
1994
|
+
preview_url?: string | null | undefined;
|
|
1995
|
+
build_logs?: string | null | undefined;
|
|
1996
|
+
branch_name?: string | null | undefined;
|
|
1997
|
+
commit_message?: string | null | undefined;
|
|
1998
|
+
commit_author?: string | null | undefined;
|
|
1999
|
+
}>, "many">>;
|
|
1853
2000
|
}, "strip", z.ZodTypeAny, {
|
|
1854
2001
|
idCounter: number;
|
|
1855
2002
|
snippets: {
|
|
@@ -2126,6 +2273,31 @@ declare const databaseSchema: z.ZodObject<{
|
|
|
2126
2273
|
access_token?: string | null | undefined;
|
|
2127
2274
|
access_token_expires_at?: string | null | undefined;
|
|
2128
2275
|
}[];
|
|
2276
|
+
packageBuilds: {
|
|
2277
|
+
package_release_id: string;
|
|
2278
|
+
created_at: string;
|
|
2279
|
+
transpilation_in_progress: boolean;
|
|
2280
|
+
transpilation_logs: any[];
|
|
2281
|
+
circuit_json_build_in_progress: boolean;
|
|
2282
|
+
circuit_json_build_logs: any[];
|
|
2283
|
+
package_build_id: string;
|
|
2284
|
+
build_in_progress: boolean;
|
|
2285
|
+
build_error_last_updated_at: string;
|
|
2286
|
+
circuit_json_build_error?: string | null | undefined;
|
|
2287
|
+
transpilation_error?: string | null | undefined;
|
|
2288
|
+
transpilation_started_at?: string | null | undefined;
|
|
2289
|
+
transpilation_completed_at?: string | null | undefined;
|
|
2290
|
+
circuit_json_build_started_at?: string | null | undefined;
|
|
2291
|
+
circuit_json_build_completed_at?: string | null | undefined;
|
|
2292
|
+
build_started_at?: string | null | undefined;
|
|
2293
|
+
build_completed_at?: string | null | undefined;
|
|
2294
|
+
build_error?: string | null | undefined;
|
|
2295
|
+
preview_url?: string | null | undefined;
|
|
2296
|
+
build_logs?: string | null | undefined;
|
|
2297
|
+
branch_name?: string | null | undefined;
|
|
2298
|
+
commit_message?: string | null | undefined;
|
|
2299
|
+
commit_author?: string | null | undefined;
|
|
2300
|
+
}[];
|
|
2129
2301
|
}, {
|
|
2130
2302
|
idCounter?: number | undefined;
|
|
2131
2303
|
snippets?: {
|
|
@@ -2402,7 +2574,32 @@ declare const databaseSchema: z.ZodObject<{
|
|
|
2402
2574
|
access_token?: string | null | undefined;
|
|
2403
2575
|
access_token_expires_at?: string | null | undefined;
|
|
2404
2576
|
}[] | undefined;
|
|
2577
|
+
packageBuilds?: {
|
|
2578
|
+
package_release_id: string;
|
|
2579
|
+
created_at: string;
|
|
2580
|
+
package_build_id: string;
|
|
2581
|
+
build_error_last_updated_at: string;
|
|
2582
|
+
circuit_json_build_error?: string | null | undefined;
|
|
2583
|
+
transpilation_error?: string | null | undefined;
|
|
2584
|
+
transpilation_in_progress?: boolean | undefined;
|
|
2585
|
+
transpilation_started_at?: string | null | undefined;
|
|
2586
|
+
transpilation_completed_at?: string | null | undefined;
|
|
2587
|
+
transpilation_logs?: any[] | undefined;
|
|
2588
|
+
circuit_json_build_in_progress?: boolean | undefined;
|
|
2589
|
+
circuit_json_build_started_at?: string | null | undefined;
|
|
2590
|
+
circuit_json_build_completed_at?: string | null | undefined;
|
|
2591
|
+
circuit_json_build_logs?: any[] | undefined;
|
|
2592
|
+
build_in_progress?: boolean | undefined;
|
|
2593
|
+
build_started_at?: string | null | undefined;
|
|
2594
|
+
build_completed_at?: string | null | undefined;
|
|
2595
|
+
build_error?: string | null | undefined;
|
|
2596
|
+
preview_url?: string | null | undefined;
|
|
2597
|
+
build_logs?: string | null | undefined;
|
|
2598
|
+
branch_name?: string | null | undefined;
|
|
2599
|
+
commit_message?: string | null | undefined;
|
|
2600
|
+
commit_author?: string | null | undefined;
|
|
2601
|
+
}[] | undefined;
|
|
2405
2602
|
}>;
|
|
2406
2603
|
type DatabaseSchema = z.infer<typeof databaseSchema>;
|
|
2407
2604
|
|
|
2408
|
-
export { type Account, type AccountPackage, type AccountSnippet, type AiReview, type DatabaseSchema, type Datasheet, type GithubInstallation, type JlcpcbOrderState, type JlcpcbOrderStepRun, type LoginPage, type Order, type OrderFile, type OrderQuote, type Package, type PackageFile, type PackageRelease, type QuotedComponent, type Session, type ShippingOption, type Snippet, accountPackageSchema, accountSchema, accountSnippetSchema, aiReviewSchema, databaseSchema, datasheetPinInformationSchema, datasheetSchema, errorResponseSchema, errorSchema, githubInstallationSchema, jlcpcbOrderStateSchema, jlcpcbOrderStepRunSchema, loginPageSchema, orderFileSchema, orderQuoteSchema, orderSchema, packageFileSchema, packageReleaseSchema, packageSchema, quotedComponentSchema, sessionSchema, shippingInfoSchema, snippetSchema };
|
|
2605
|
+
export { type Account, type AccountPackage, type AccountSnippet, type AiReview, type DatabaseSchema, type Datasheet, type GithubInstallation, type JlcpcbOrderState, type JlcpcbOrderStepRun, type LoginPage, type Order, type OrderFile, type OrderQuote, type Package, type PackageBuild, type PackageFile, type PackageRelease, type QuotedComponent, type Session, type ShippingOption, type Snippet, accountPackageSchema, accountSchema, accountSnippetSchema, aiReviewSchema, databaseSchema, datasheetPinInformationSchema, datasheetSchema, errorResponseSchema, errorSchema, githubInstallationSchema, jlcpcbOrderStateSchema, jlcpcbOrderStepRunSchema, loginPageSchema, orderFileSchema, orderQuoteSchema, orderSchema, packageBuildSchema, packageFileSchema, packageReleaseSchema, packageSchema, quotedComponentSchema, sessionSchema, shippingInfoSchema, snippetSchema };
|
package/dist/schema.js
CHANGED
|
@@ -286,6 +286,31 @@ var jlcpcbOrderStepRunSchema = z.object({
|
|
|
286
286
|
error_message: z.string().nullable().default(null),
|
|
287
287
|
created_at: z.string()
|
|
288
288
|
});
|
|
289
|
+
var packageBuildSchema = z.object({
|
|
290
|
+
package_build_id: z.string().uuid(),
|
|
291
|
+
package_release_id: z.string(),
|
|
292
|
+
created_at: z.string().datetime(),
|
|
293
|
+
transpilation_in_progress: z.boolean().default(false),
|
|
294
|
+
transpilation_started_at: z.string().datetime().nullable().optional(),
|
|
295
|
+
transpilation_completed_at: z.string().datetime().nullable().optional(),
|
|
296
|
+
transpilation_logs: z.array(z.any()).default([]),
|
|
297
|
+
transpilation_error: z.string().nullable().optional(),
|
|
298
|
+
circuit_json_build_in_progress: z.boolean().default(false),
|
|
299
|
+
circuit_json_build_started_at: z.string().datetime().nullable().optional(),
|
|
300
|
+
circuit_json_build_completed_at: z.string().datetime().nullable().optional(),
|
|
301
|
+
circuit_json_build_logs: z.array(z.any()).default([]),
|
|
302
|
+
circuit_json_build_error: z.string().nullable().optional(),
|
|
303
|
+
build_in_progress: z.boolean().default(false),
|
|
304
|
+
build_started_at: z.string().datetime().nullable().optional(),
|
|
305
|
+
build_completed_at: z.string().datetime().nullable().optional(),
|
|
306
|
+
build_error: z.string().nullable().optional(),
|
|
307
|
+
build_error_last_updated_at: z.string().datetime(),
|
|
308
|
+
preview_url: z.string().nullable().optional(),
|
|
309
|
+
build_logs: z.string().nullable().optional(),
|
|
310
|
+
branch_name: z.string().nullable().optional(),
|
|
311
|
+
commit_message: z.string().nullable().optional(),
|
|
312
|
+
commit_author: z.string().nullable().optional()
|
|
313
|
+
});
|
|
289
314
|
var databaseSchema = z.object({
|
|
290
315
|
idCounter: z.number().default(0),
|
|
291
316
|
snippets: z.array(snippetSchema).default([]),
|
|
@@ -304,7 +329,8 @@ var databaseSchema = z.object({
|
|
|
304
329
|
orderQuotes: z.array(orderQuoteSchema).default([]),
|
|
305
330
|
aiReviews: z.array(aiReviewSchema).default([]),
|
|
306
331
|
datasheets: z.array(datasheetSchema).default([]),
|
|
307
|
-
githubInstallations: z.array(githubInstallationSchema).default([])
|
|
332
|
+
githubInstallations: z.array(githubInstallationSchema).default([]),
|
|
333
|
+
packageBuilds: z.array(packageBuildSchema).default([])
|
|
308
334
|
});
|
|
309
335
|
export {
|
|
310
336
|
accountPackageSchema,
|
|
@@ -323,6 +349,7 @@ export {
|
|
|
323
349
|
orderFileSchema,
|
|
324
350
|
orderQuoteSchema,
|
|
325
351
|
orderSchema,
|
|
352
|
+
packageBuildSchema,
|
|
326
353
|
packageFileSchema,
|
|
327
354
|
packageReleaseSchema,
|
|
328
355
|
packageSchema,
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
type PackageFile,
|
|
17
17
|
type PackageRelease,
|
|
18
18
|
packageReleaseSchema,
|
|
19
|
+
type PackageBuild,
|
|
19
20
|
type AiReview,
|
|
20
21
|
aiReviewSchema,
|
|
21
22
|
type Datasheet,
|
|
@@ -241,7 +242,7 @@ const initializer = combine(databaseSchema.parse({}), (set, get) => ({
|
|
|
241
242
|
snippet: Omit<
|
|
242
243
|
z.input<typeof snippetSchema>,
|
|
243
244
|
"snippet_id" | "package_release_id"
|
|
244
|
-
|
|
245
|
+
> & { creator_account_id?: string; github_repo_full_name?: string },
|
|
245
246
|
): Snippet => {
|
|
246
247
|
const timestamp = Date.now()
|
|
247
248
|
const currentTime = new Date(timestamp).toISOString()
|
|
@@ -252,7 +253,7 @@ const initializer = combine(databaseSchema.parse({}), (set, get) => ({
|
|
|
252
253
|
// Create the package that will serve as our snippet
|
|
253
254
|
const newPackage = {
|
|
254
255
|
package_id: `pkg_${nextId}`,
|
|
255
|
-
creator_account_id: snippet.owner_name, // Using owner_name as account_id since we don't have context
|
|
256
|
+
creator_account_id: snippet.creator_account_id ?? snippet.owner_name, // Using owner_name as account_id since we don't have context
|
|
256
257
|
owner_org_id: "", // Empty string instead of null to match type
|
|
257
258
|
owner_github_username: snippet.owner_name,
|
|
258
259
|
is_source_from_github: false,
|
|
@@ -265,7 +266,7 @@ const initializer = combine(databaseSchema.parse({}), (set, get) => ({
|
|
|
265
266
|
star_count: 0,
|
|
266
267
|
created_at: currentTime,
|
|
267
268
|
updated_at: currentTime,
|
|
268
|
-
github_repo_full_name: null,
|
|
269
|
+
github_repo_full_name: snippet.github_repo_full_name || null,
|
|
269
270
|
ai_description: "placeholder ai description",
|
|
270
271
|
ai_usage_instructions: "placeholder ai usage instructions",
|
|
271
272
|
is_snippet: true,
|
|
@@ -292,6 +293,9 @@ const initializer = combine(databaseSchema.parse({}), (set, get) => ({
|
|
|
292
293
|
updated_at: currentTime,
|
|
293
294
|
has_transpiled: true,
|
|
294
295
|
transpilation_error: null,
|
|
296
|
+
...(snippet.name == "testuser/my-test-board"
|
|
297
|
+
? { is_pr_preview: true, github_pr_number: 69 }
|
|
298
|
+
: {}),
|
|
295
299
|
})
|
|
296
300
|
|
|
297
301
|
// Add all the files
|
|
@@ -1475,4 +1479,48 @@ const initializer = combine(databaseSchema.parse({}), (set, get) => ({
|
|
|
1475
1479
|
})
|
|
1476
1480
|
return updated
|
|
1477
1481
|
},
|
|
1482
|
+
addPackageBuild: (
|
|
1483
|
+
packageBuild: Omit<PackageBuild, "package_build_id">,
|
|
1484
|
+
): PackageBuild => {
|
|
1485
|
+
const newPackageBuild = {
|
|
1486
|
+
package_build_id: crypto.randomUUID(),
|
|
1487
|
+
...packageBuild,
|
|
1488
|
+
}
|
|
1489
|
+
set((state) => ({
|
|
1490
|
+
packageBuilds: [...state.packageBuilds, newPackageBuild],
|
|
1491
|
+
}))
|
|
1492
|
+
return newPackageBuild
|
|
1493
|
+
},
|
|
1494
|
+
getPackageBuildById: (packageBuildId: string): PackageBuild | undefined => {
|
|
1495
|
+
const state = get()
|
|
1496
|
+
return state.packageBuilds.find(
|
|
1497
|
+
(pb) => pb.package_build_id === packageBuildId,
|
|
1498
|
+
)
|
|
1499
|
+
},
|
|
1500
|
+
getPackageBuildsByReleaseId: (packageReleaseId: string): PackageBuild[] => {
|
|
1501
|
+
const state = get()
|
|
1502
|
+
return state.packageBuilds
|
|
1503
|
+
.filter((pb) => pb.package_release_id === packageReleaseId)
|
|
1504
|
+
.sort(
|
|
1505
|
+
(a, b) =>
|
|
1506
|
+
new Date(b.created_at).getTime() - new Date(a.created_at).getTime(),
|
|
1507
|
+
)
|
|
1508
|
+
},
|
|
1509
|
+
updatePackageBuild: (
|
|
1510
|
+
packageBuildId: string,
|
|
1511
|
+
updates: Partial<PackageBuild>,
|
|
1512
|
+
): PackageBuild | undefined => {
|
|
1513
|
+
let updated: PackageBuild | undefined
|
|
1514
|
+
set((state) => {
|
|
1515
|
+
const index = state.packageBuilds.findIndex(
|
|
1516
|
+
(pb) => pb.package_build_id === packageBuildId,
|
|
1517
|
+
)
|
|
1518
|
+
if (index === -1) return state
|
|
1519
|
+
const packageBuilds = [...state.packageBuilds]
|
|
1520
|
+
packageBuilds[index] = { ...packageBuilds[index], ...updates }
|
|
1521
|
+
updated = packageBuilds[index]
|
|
1522
|
+
return { ...state, packageBuilds }
|
|
1523
|
+
})
|
|
1524
|
+
return updated
|
|
1525
|
+
},
|
|
1478
1526
|
}))
|
|
@@ -346,6 +346,33 @@ export const jlcpcbOrderStepRunSchema = z.object({
|
|
|
346
346
|
})
|
|
347
347
|
export type JlcpcbOrderStepRun = z.infer<typeof jlcpcbOrderStepRunSchema>
|
|
348
348
|
|
|
349
|
+
export const packageBuildSchema = z.object({
|
|
350
|
+
package_build_id: z.string().uuid(),
|
|
351
|
+
package_release_id: z.string(),
|
|
352
|
+
created_at: z.string().datetime(),
|
|
353
|
+
transpilation_in_progress: z.boolean().default(false),
|
|
354
|
+
transpilation_started_at: z.string().datetime().nullable().optional(),
|
|
355
|
+
transpilation_completed_at: z.string().datetime().nullable().optional(),
|
|
356
|
+
transpilation_logs: z.array(z.any()).default([]),
|
|
357
|
+
transpilation_error: z.string().nullable().optional(),
|
|
358
|
+
circuit_json_build_in_progress: z.boolean().default(false),
|
|
359
|
+
circuit_json_build_started_at: z.string().datetime().nullable().optional(),
|
|
360
|
+
circuit_json_build_completed_at: z.string().datetime().nullable().optional(),
|
|
361
|
+
circuit_json_build_logs: z.array(z.any()).default([]),
|
|
362
|
+
circuit_json_build_error: z.string().nullable().optional(),
|
|
363
|
+
build_in_progress: z.boolean().default(false),
|
|
364
|
+
build_started_at: z.string().datetime().nullable().optional(),
|
|
365
|
+
build_completed_at: z.string().datetime().nullable().optional(),
|
|
366
|
+
build_error: z.string().nullable().optional(),
|
|
367
|
+
build_error_last_updated_at: z.string().datetime(),
|
|
368
|
+
preview_url: z.string().nullable().optional(),
|
|
369
|
+
build_logs: z.string().nullable().optional(),
|
|
370
|
+
branch_name: z.string().nullable().optional(),
|
|
371
|
+
commit_message: z.string().nullable().optional(),
|
|
372
|
+
commit_author: z.string().nullable().optional(),
|
|
373
|
+
})
|
|
374
|
+
export type PackageBuild = z.infer<typeof packageBuildSchema>
|
|
375
|
+
|
|
349
376
|
export const databaseSchema = z.object({
|
|
350
377
|
idCounter: z.number().default(0),
|
|
351
378
|
snippets: z.array(snippetSchema).default([]),
|
|
@@ -365,5 +392,6 @@ export const databaseSchema = z.object({
|
|
|
365
392
|
aiReviews: z.array(aiReviewSchema).default([]),
|
|
366
393
|
datasheets: z.array(datasheetSchema).default([]),
|
|
367
394
|
githubInstallations: z.array(githubInstallationSchema).default([]),
|
|
395
|
+
packageBuilds: z.array(packageBuildSchema).default([]),
|
|
368
396
|
})
|
|
369
397
|
export type DatabaseSchema = z.infer<typeof databaseSchema>
|
|
@@ -26,10 +26,12 @@ export const seed = (db: DbClient) => {
|
|
|
26
26
|
loadAutoloadPackages(db)
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
db.addSnippet({
|
|
29
|
+
const { package_release_id: packageReleaseId1 } = db.addSnippet({
|
|
30
30
|
name: "testuser/my-test-board",
|
|
31
31
|
unscoped_name: "my-test-board",
|
|
32
|
+
github_repo_full_name: "testuser/my-test-board",
|
|
32
33
|
owner_name: "testuser",
|
|
34
|
+
creator_account_id: account_id,
|
|
33
35
|
code: `
|
|
34
36
|
import { A555Timer } from "@tsci/seveibar.a555timer"
|
|
35
37
|
|
|
@@ -536,6 +538,42 @@ export default () => (
|
|
|
536
538
|
],
|
|
537
539
|
})
|
|
538
540
|
|
|
541
|
+
db.addPackageBuild({
|
|
542
|
+
package_release_id: packageReleaseId1,
|
|
543
|
+
created_at: new Date(Date.now() - 15000).toISOString(), // 15 seconds ago
|
|
544
|
+
transpilation_in_progress: false,
|
|
545
|
+
transpilation_started_at: new Date(Date.now() - 15000).toISOString(),
|
|
546
|
+
transpilation_completed_at: new Date(Date.now() - 14000).toISOString(),
|
|
547
|
+
transpilation_logs: [
|
|
548
|
+
"[INFO] Starting transpilation...",
|
|
549
|
+
"[INFO] Parsing package code",
|
|
550
|
+
"[ERROR] Failed to parse TypeScript definitions",
|
|
551
|
+
"[ERROR] Invalid syntax in component declaration",
|
|
552
|
+
],
|
|
553
|
+
transpilation_error:
|
|
554
|
+
"TypeScript compilation failed: Syntax error in component declaration",
|
|
555
|
+
circuit_json_build_in_progress: false,
|
|
556
|
+
circuit_json_build_started_at: null,
|
|
557
|
+
circuit_json_build_completed_at: null,
|
|
558
|
+
circuit_json_build_logs: [],
|
|
559
|
+
circuit_json_build_error: "Build cancelled due to transpilation failure",
|
|
560
|
+
build_in_progress: false,
|
|
561
|
+
build_started_at: new Date(Date.now() - 15000).toISOString(),
|
|
562
|
+
build_completed_at: new Date(Date.now() - 14000).toISOString(),
|
|
563
|
+
build_error: "Build failed: Unable to complete transpilation step",
|
|
564
|
+
build_error_last_updated_at: new Date(Date.now() - 14000).toISOString(),
|
|
565
|
+
preview_url: null,
|
|
566
|
+
build_logs:
|
|
567
|
+
"Build process:\n" +
|
|
568
|
+
"1. Environment setup - OK\n" +
|
|
569
|
+
"2. Dependency resolution - OK\n" +
|
|
570
|
+
"3. Code compilation - FAILED\n" +
|
|
571
|
+
"Error: Invalid syntax in component declaration\n" +
|
|
572
|
+
"Build terminated with errors",
|
|
573
|
+
branch_name: "main",
|
|
574
|
+
commit_message: "Attempted build of a555timer-square-wave package",
|
|
575
|
+
commit_author: "testuser",
|
|
576
|
+
})
|
|
539
577
|
// Define the @tsci/seveibar.a555timer package
|
|
540
578
|
db.addSnippet({
|
|
541
579
|
name: "seveibar/a555timer",
|
|
@@ -1067,10 +1105,11 @@ exports.A555Timer = A555Timer;
|
|
|
1067
1105
|
|
|
1068
1106
|
// Add a snippet that outputs a square waveform using the a555timer
|
|
1069
1107
|
|
|
1070
|
-
db.addSnippet({
|
|
1108
|
+
const { package_release_id: packageReleaseId2 } = db.addSnippet({
|
|
1071
1109
|
name: "testuser/a555timer-square-wave",
|
|
1072
1110
|
unscoped_name: "a555timer-square-wave",
|
|
1073
1111
|
owner_name: "testuser",
|
|
1112
|
+
creator_account_id: account_id,
|
|
1074
1113
|
code: `
|
|
1075
1114
|
import { A555Timer } from "@tsci/seveibar.a555timer"
|
|
1076
1115
|
|
|
@@ -1084,6 +1123,7 @@ export const SquareWaveModule = () => (
|
|
|
1084
1123
|
created_at: new Date().toISOString(),
|
|
1085
1124
|
updated_at: new Date().toISOString(),
|
|
1086
1125
|
snippet_type: "package",
|
|
1126
|
+
github_repo_full_name: "testuser/test",
|
|
1087
1127
|
description:
|
|
1088
1128
|
"A simple package that outputs a square waveform using the a555timer",
|
|
1089
1129
|
circuit_json: [
|
|
@@ -1579,6 +1619,89 @@ export const SquareWaveModule = () => (
|
|
|
1579
1619
|
],
|
|
1580
1620
|
})
|
|
1581
1621
|
|
|
1622
|
+
// Add failed build first
|
|
1623
|
+
db.addPackageBuild({
|
|
1624
|
+
package_release_id: packageReleaseId2,
|
|
1625
|
+
created_at: new Date(Date.now() - 15000).toISOString(), // 15 seconds ago
|
|
1626
|
+
transpilation_in_progress: false,
|
|
1627
|
+
transpilation_started_at: new Date(Date.now() - 15000).toISOString(),
|
|
1628
|
+
transpilation_completed_at: new Date(Date.now() - 14000).toISOString(),
|
|
1629
|
+
transpilation_logs: [
|
|
1630
|
+
"[INFO] Starting transpilation...",
|
|
1631
|
+
"[INFO] Parsing package code",
|
|
1632
|
+
"[ERROR] Failed to parse TypeScript definitions",
|
|
1633
|
+
"[ERROR] Invalid syntax in component declaration",
|
|
1634
|
+
],
|
|
1635
|
+
transpilation_error:
|
|
1636
|
+
"TypeScript compilation failed: Syntax error in component declaration",
|
|
1637
|
+
circuit_json_build_in_progress: false,
|
|
1638
|
+
circuit_json_build_started_at: null,
|
|
1639
|
+
circuit_json_build_completed_at: null,
|
|
1640
|
+
circuit_json_build_logs: [],
|
|
1641
|
+
circuit_json_build_error: "Build cancelled due to transpilation failure",
|
|
1642
|
+
build_in_progress: false,
|
|
1643
|
+
build_started_at: new Date(Date.now() - 15000).toISOString(),
|
|
1644
|
+
build_completed_at: new Date(Date.now() - 14000).toISOString(),
|
|
1645
|
+
build_error: "Build failed: Unable to complete transpilation step",
|
|
1646
|
+
build_error_last_updated_at: new Date(Date.now() - 14000).toISOString(),
|
|
1647
|
+
preview_url: null,
|
|
1648
|
+
build_logs:
|
|
1649
|
+
"Build process:\n" +
|
|
1650
|
+
"1. Environment setup - OK\n" +
|
|
1651
|
+
"2. Dependency resolution - OK\n" +
|
|
1652
|
+
"3. Code compilation - FAILED\n" +
|
|
1653
|
+
"Error: Invalid syntax in component declaration\n" +
|
|
1654
|
+
"Build terminated with errors",
|
|
1655
|
+
branch_name: "main",
|
|
1656
|
+
commit_message: "Attempted build of a555timer-square-wave package",
|
|
1657
|
+
commit_author: "testuser",
|
|
1658
|
+
})
|
|
1659
|
+
|
|
1660
|
+
// Add successful build
|
|
1661
|
+
db.addPackageBuild({
|
|
1662
|
+
package_release_id: packageReleaseId2,
|
|
1663
|
+
created_at: new Date().toISOString(),
|
|
1664
|
+
transpilation_in_progress: false,
|
|
1665
|
+
transpilation_started_at: new Date(Date.now() - 5000).toISOString(), // Started 5 seconds ago
|
|
1666
|
+
transpilation_completed_at: new Date(Date.now() - 3000).toISOString(), // Completed 3 seconds ago
|
|
1667
|
+
transpilation_logs: [
|
|
1668
|
+
"[INFO] Starting transpilation...",
|
|
1669
|
+
"[INFO] Parsing package code",
|
|
1670
|
+
"[INFO] Generating TypeScript definitions",
|
|
1671
|
+
"[INFO] Compiling to JavaScript",
|
|
1672
|
+
"[SUCCESS] Transpilation completed successfully",
|
|
1673
|
+
],
|
|
1674
|
+
transpilation_error: null,
|
|
1675
|
+
circuit_json_build_in_progress: false,
|
|
1676
|
+
circuit_json_build_started_at: new Date(Date.now() - 3000).toISOString(), // Started after transpilation
|
|
1677
|
+
circuit_json_build_completed_at: new Date(Date.now() - 1000).toISOString(), // Completed 1 second ago
|
|
1678
|
+
circuit_json_build_logs: [
|
|
1679
|
+
"[INFO] Starting circuit JSON build...",
|
|
1680
|
+
"[INFO] Analyzing component structure",
|
|
1681
|
+
"[INFO] Generating port configurations",
|
|
1682
|
+
"[INFO] Validating circuit connections",
|
|
1683
|
+
"[SUCCESS] Circuit JSON build completed",
|
|
1684
|
+
],
|
|
1685
|
+
circuit_json_build_error: null,
|
|
1686
|
+
build_in_progress: false,
|
|
1687
|
+
build_started_at: new Date(Date.now() - 10000).toISOString(), // Started 10 seconds ago
|
|
1688
|
+
build_completed_at: new Date().toISOString(), // Just completed
|
|
1689
|
+
build_error: null,
|
|
1690
|
+
build_error_last_updated_at: new Date().toISOString(),
|
|
1691
|
+
preview_url: "http://localhost:3000/preview/package_build_1",
|
|
1692
|
+
build_logs:
|
|
1693
|
+
"Build process:\n" +
|
|
1694
|
+
"1. Environment setup - OK\n" +
|
|
1695
|
+
"2. Dependency resolution - OK\n" +
|
|
1696
|
+
"3. Code compilation - OK\n" +
|
|
1697
|
+
"4. Circuit validation - OK\n" +
|
|
1698
|
+
"5. Package assembly - OK\n" +
|
|
1699
|
+
"Build completed successfully",
|
|
1700
|
+
branch_name: "main",
|
|
1701
|
+
commit_message: "Initial build of a555timer-square-wave package",
|
|
1702
|
+
commit_author: "testuser",
|
|
1703
|
+
})
|
|
1704
|
+
|
|
1582
1705
|
db.addOrder({
|
|
1583
1706
|
account_id,
|
|
1584
1707
|
is_running: false,
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as ZT from "fake-snippets-api/lib/db/schema"
|
|
2
|
+
|
|
3
|
+
export const publicMapPackageBuild = (
|
|
4
|
+
internalPackageBuild: ZT.PackageBuild,
|
|
5
|
+
options: {
|
|
6
|
+
include_logs?: boolean
|
|
7
|
+
} = {
|
|
8
|
+
include_logs: false,
|
|
9
|
+
},
|
|
10
|
+
): ZT.PackageBuild => {
|
|
11
|
+
const result = {
|
|
12
|
+
...internalPackageBuild,
|
|
13
|
+
created_at: internalPackageBuild.created_at,
|
|
14
|
+
transpilation_started_at: internalPackageBuild.transpilation_started_at,
|
|
15
|
+
transpilation_completed_at: internalPackageBuild.transpilation_completed_at,
|
|
16
|
+
transpilation_logs: options.include_logs
|
|
17
|
+
? internalPackageBuild.transpilation_logs
|
|
18
|
+
: [],
|
|
19
|
+
transpilation_error: internalPackageBuild.transpilation_error,
|
|
20
|
+
circuit_json_build_started_at:
|
|
21
|
+
internalPackageBuild.circuit_json_build_started_at,
|
|
22
|
+
circuit_json_build_completed_at:
|
|
23
|
+
internalPackageBuild.circuit_json_build_completed_at,
|
|
24
|
+
circuit_json_build_logs: options.include_logs
|
|
25
|
+
? internalPackageBuild.circuit_json_build_logs
|
|
26
|
+
: [],
|
|
27
|
+
circuit_json_build_error: internalPackageBuild.circuit_json_build_error,
|
|
28
|
+
build_started_at: internalPackageBuild.build_started_at,
|
|
29
|
+
build_completed_at: internalPackageBuild.build_completed_at,
|
|
30
|
+
build_error: internalPackageBuild.build_error,
|
|
31
|
+
build_error_last_updated_at:
|
|
32
|
+
internalPackageBuild.build_error_last_updated_at,
|
|
33
|
+
preview_url: internalPackageBuild.preview_url,
|
|
34
|
+
build_logs: options.include_logs ? internalPackageBuild.build_logs : null,
|
|
35
|
+
branch_name: internalPackageBuild.branch_name,
|
|
36
|
+
commit_message: internalPackageBuild.commit_message,
|
|
37
|
+
commit_author: internalPackageBuild.commit_author,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return result
|
|
41
|
+
}
|