@tscircuit/fake-snippets 0.0.82 → 0.0.84
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/README.md +5 -2
- package/bun-tests/fake-snippets-api/routes/ai_reviews/create.test.ts +12 -0
- package/bun-tests/fake-snippets-api/routes/ai_reviews/get.test.ts +16 -0
- package/bun-tests/fake-snippets-api/routes/ai_reviews/list.test.ts +14 -0
- package/bun-tests/fake-snippets-api/routes/ai_reviews/process_review.test.ts +16 -0
- package/bun-tests/fake-snippets-api/routes/package_releases/create.test.ts +3 -3
- package/bun.lock +26 -37
- package/dist/bundle.js +590 -427
- package/dist/index.d.ts +83 -11
- package/dist/index.js +50 -2
- package/dist/schema.d.ts +116 -15
- package/dist/schema.js +17 -2
- package/fake-snippets-api/lib/db/db-client.ts +40 -0
- package/fake-snippets-api/lib/db/schema.ts +17 -1
- package/fake-snippets-api/lib/public-mapping/public-map-package-release.ts +14 -1
- package/fake-snippets-api/routes/api/_fake/ai_reviews/process_review.ts +31 -0
- package/fake-snippets-api/routes/api/ai_reviews/create.ts +22 -0
- package/fake-snippets-api/routes/api/ai_reviews/get.ts +24 -0
- package/fake-snippets-api/routes/api/ai_reviews/list.ts +14 -0
- package/fake-snippets-api/routes/api/package_releases/get.ts +11 -3
- package/fake-snippets-api/routes/api/package_releases/list.ts +8 -1
- package/package.json +4 -3
- package/src/App.tsx +0 -2
- package/src/ContextProviders.tsx +1 -1
- package/src/components/Header2.tsx +8 -18
- package/src/components/PackageBuildsPage/package-build-header.tsx +14 -2
- package/src/components/SearchComponent.tsx +46 -8
- package/src/components/ViewPackagePage/hooks/use-toast.tsx +70 -0
- package/src/components/ViewSnippetHeader.tsx +9 -6
- package/src/components/dialogs/edit-package-details-dialog.tsx +5 -10
- package/src/components/dialogs/{import-snippet-dialog.tsx → import-package-dialog.tsx} +25 -24
- package/src/components/package-port/CodeEditorHeader.tsx +7 -6
- package/src/components/ui/toaster.tsx +1 -33
- package/src/hooks/use-current-package-release.ts +10 -1
- package/src/hooks/use-fork-package-mutation.ts +4 -3
- package/src/hooks/use-package-release.ts +15 -14
- package/src/hooks/use-sign-in.ts +10 -8
- package/src/hooks/use-toast.tsx +50 -169
- package/src/hooks/useFileManagement.ts +74 -12
- package/src/hooks/useForkPackageMutation.ts +2 -1
- package/src/hooks/useForkSnippetMutation.ts +2 -1
- package/src/pages/authorize.tsx +164 -8
- package/src/pages/view-package.tsx +1 -0
- package/src/components/ViewPackagePage/hooks/use-toast.ts +0 -191
package/dist/index.d.ts
CHANGED
|
@@ -384,6 +384,32 @@ declare const orderQuoteSchema: z.ZodObject<{
|
|
|
384
384
|
total_cost_without_shipping?: number | undefined;
|
|
385
385
|
}>;
|
|
386
386
|
type OrderQuote = z.infer<typeof orderQuoteSchema>;
|
|
387
|
+
declare const aiReviewSchema: z.ZodObject<{
|
|
388
|
+
ai_review_id: z.ZodString;
|
|
389
|
+
ai_review_text: z.ZodNullable<z.ZodString>;
|
|
390
|
+
start_processing_at: z.ZodNullable<z.ZodString>;
|
|
391
|
+
finished_processing_at: z.ZodNullable<z.ZodString>;
|
|
392
|
+
processing_error: z.ZodNullable<z.ZodAny>;
|
|
393
|
+
created_at: z.ZodString;
|
|
394
|
+
display_status: z.ZodEnum<["pending", "completed", "failed"]>;
|
|
395
|
+
}, "strip", z.ZodTypeAny, {
|
|
396
|
+
created_at: string;
|
|
397
|
+
ai_review_id: string;
|
|
398
|
+
ai_review_text: string | null;
|
|
399
|
+
start_processing_at: string | null;
|
|
400
|
+
finished_processing_at: string | null;
|
|
401
|
+
display_status: "pending" | "completed" | "failed";
|
|
402
|
+
processing_error?: any;
|
|
403
|
+
}, {
|
|
404
|
+
created_at: string;
|
|
405
|
+
ai_review_id: string;
|
|
406
|
+
ai_review_text: string | null;
|
|
407
|
+
start_processing_at: string | null;
|
|
408
|
+
finished_processing_at: string | null;
|
|
409
|
+
display_status: "pending" | "completed" | "failed";
|
|
410
|
+
processing_error?: any;
|
|
411
|
+
}>;
|
|
412
|
+
type AiReview = z.infer<typeof aiReviewSchema>;
|
|
387
413
|
declare const accountPackageSchema: z.ZodObject<{
|
|
388
414
|
account_package_id: z.ZodString;
|
|
389
415
|
account_id: z.ZodString;
|
|
@@ -435,17 +461,21 @@ declare const packageReleaseSchema: z.ZodObject<{
|
|
|
435
461
|
circuit_json_build_completed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
436
462
|
circuit_json_build_logs: z.ZodDefault<z.ZodArray<z.ZodAny, "many">>;
|
|
437
463
|
circuit_json_build_is_stale: z.ZodDefault<z.ZodBoolean>;
|
|
438
|
-
ai_review_text: z.ZodDefault<z.ZodNullable<z.ZodString
|
|
464
|
+
ai_review_text: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
|
|
465
|
+
ai_review_started_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
466
|
+
ai_review_completed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
467
|
+
ai_review_error: z.ZodNullable<z.ZodOptional<z.ZodAny>>;
|
|
468
|
+
ai_review_logs: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodAny, "many">>>;
|
|
439
469
|
ai_review_requested: z.ZodDefault<z.ZodBoolean>;
|
|
440
470
|
}, "strip", z.ZodTypeAny, {
|
|
441
471
|
package_release_id: string;
|
|
442
472
|
created_at: string;
|
|
443
473
|
version: string | null;
|
|
474
|
+
display_status: "error" | "pending" | "building" | "complete";
|
|
444
475
|
package_id: string;
|
|
445
476
|
is_locked: boolean;
|
|
446
477
|
is_latest: boolean;
|
|
447
478
|
has_transpiled: boolean;
|
|
448
|
-
display_status: "error" | "pending" | "building" | "complete";
|
|
449
479
|
transpilation_display_status: "error" | "pending" | "building" | "complete";
|
|
450
480
|
transpilation_in_progress: boolean;
|
|
451
481
|
transpilation_logs: any[];
|
|
@@ -454,8 +484,8 @@ declare const packageReleaseSchema: z.ZodObject<{
|
|
|
454
484
|
circuit_json_build_in_progress: boolean;
|
|
455
485
|
circuit_json_build_logs: any[];
|
|
456
486
|
circuit_json_build_is_stale: boolean;
|
|
457
|
-
ai_review_text: string | null;
|
|
458
487
|
ai_review_requested: boolean;
|
|
488
|
+
ai_review_text?: string | null | undefined;
|
|
459
489
|
commit_sha?: string | null | undefined;
|
|
460
490
|
license?: string | null | undefined;
|
|
461
491
|
circuit_json_build_error?: string | null | undefined;
|
|
@@ -467,6 +497,10 @@ declare const packageReleaseSchema: z.ZodObject<{
|
|
|
467
497
|
transpilation_completed_at?: string | null | undefined;
|
|
468
498
|
circuit_json_build_started_at?: string | null | undefined;
|
|
469
499
|
circuit_json_build_completed_at?: string | null | undefined;
|
|
500
|
+
ai_review_started_at?: string | null | undefined;
|
|
501
|
+
ai_review_completed_at?: string | null | undefined;
|
|
502
|
+
ai_review_error?: any;
|
|
503
|
+
ai_review_logs?: any[] | null | undefined;
|
|
470
504
|
}, {
|
|
471
505
|
package_release_id: string;
|
|
472
506
|
created_at: string;
|
|
@@ -474,6 +508,8 @@ declare const packageReleaseSchema: z.ZodObject<{
|
|
|
474
508
|
package_id: string;
|
|
475
509
|
is_locked: boolean;
|
|
476
510
|
is_latest: boolean;
|
|
511
|
+
ai_review_text?: string | null | undefined;
|
|
512
|
+
display_status?: "error" | "pending" | "building" | "complete" | undefined;
|
|
477
513
|
commit_sha?: string | null | undefined;
|
|
478
514
|
license?: string | null | undefined;
|
|
479
515
|
circuit_json_build_error?: string | null | undefined;
|
|
@@ -481,7 +517,6 @@ declare const packageReleaseSchema: z.ZodObject<{
|
|
|
481
517
|
has_transpiled?: boolean | undefined;
|
|
482
518
|
transpilation_error?: string | null | undefined;
|
|
483
519
|
fs_sha?: string | null | undefined;
|
|
484
|
-
display_status?: "error" | "pending" | "building" | "complete" | undefined;
|
|
485
520
|
total_build_duration_ms?: number | null | undefined;
|
|
486
521
|
transpilation_display_status?: "error" | "pending" | "building" | "complete" | undefined;
|
|
487
522
|
transpilation_in_progress?: boolean | undefined;
|
|
@@ -495,7 +530,10 @@ declare const packageReleaseSchema: z.ZodObject<{
|
|
|
495
530
|
circuit_json_build_completed_at?: string | null | undefined;
|
|
496
531
|
circuit_json_build_logs?: any[] | undefined;
|
|
497
532
|
circuit_json_build_is_stale?: boolean | undefined;
|
|
498
|
-
|
|
533
|
+
ai_review_started_at?: string | null | undefined;
|
|
534
|
+
ai_review_completed_at?: string | null | undefined;
|
|
535
|
+
ai_review_error?: any;
|
|
536
|
+
ai_review_logs?: any[] | null | undefined;
|
|
499
537
|
ai_review_requested?: boolean | undefined;
|
|
500
538
|
}>;
|
|
501
539
|
type PackageRelease = z.infer<typeof packageReleaseSchema>;
|
|
@@ -753,11 +791,11 @@ declare const createDatabase: ({ seed }?: {
|
|
|
753
791
|
package_release_id: string;
|
|
754
792
|
created_at: string;
|
|
755
793
|
version: string | null;
|
|
794
|
+
display_status: "error" | "pending" | "building" | "complete";
|
|
756
795
|
package_id: string;
|
|
757
796
|
is_locked: boolean;
|
|
758
797
|
is_latest: boolean;
|
|
759
798
|
has_transpiled: boolean;
|
|
760
|
-
display_status: "error" | "pending" | "building" | "complete";
|
|
761
799
|
transpilation_display_status: "error" | "pending" | "building" | "complete";
|
|
762
800
|
transpilation_in_progress: boolean;
|
|
763
801
|
transpilation_logs: any[];
|
|
@@ -766,8 +804,8 @@ declare const createDatabase: ({ seed }?: {
|
|
|
766
804
|
circuit_json_build_in_progress: boolean;
|
|
767
805
|
circuit_json_build_logs: any[];
|
|
768
806
|
circuit_json_build_is_stale: boolean;
|
|
769
|
-
ai_review_text: string | null;
|
|
770
807
|
ai_review_requested: boolean;
|
|
808
|
+
ai_review_text?: string | null | undefined;
|
|
771
809
|
commit_sha?: string | null | undefined;
|
|
772
810
|
license?: string | null | undefined;
|
|
773
811
|
circuit_json_build_error?: string | null | undefined;
|
|
@@ -779,6 +817,10 @@ declare const createDatabase: ({ seed }?: {
|
|
|
779
817
|
transpilation_completed_at?: string | null | undefined;
|
|
780
818
|
circuit_json_build_started_at?: string | null | undefined;
|
|
781
819
|
circuit_json_build_completed_at?: string | null | undefined;
|
|
820
|
+
ai_review_started_at?: string | null | undefined;
|
|
821
|
+
ai_review_completed_at?: string | null | undefined;
|
|
822
|
+
ai_review_error?: any;
|
|
823
|
+
ai_review_logs?: any[] | null | undefined;
|
|
782
824
|
}[];
|
|
783
825
|
packageFiles: {
|
|
784
826
|
package_release_id: string;
|
|
@@ -957,7 +999,16 @@ declare const createDatabase: ({ seed }?: {
|
|
|
957
999
|
}[];
|
|
958
1000
|
total_cost_without_shipping: number;
|
|
959
1001
|
}[];
|
|
960
|
-
|
|
1002
|
+
aiReviews: {
|
|
1003
|
+
created_at: string;
|
|
1004
|
+
ai_review_id: string;
|
|
1005
|
+
ai_review_text: string | null;
|
|
1006
|
+
start_processing_at: string | null;
|
|
1007
|
+
finished_processing_at: string | null;
|
|
1008
|
+
display_status: "pending" | "completed" | "failed";
|
|
1009
|
+
processing_error?: any;
|
|
1010
|
+
}[];
|
|
1011
|
+
}, "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" | "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"> & {
|
|
961
1012
|
addOrder: (order: Omit<Order, "order_id">) => Order;
|
|
962
1013
|
getOrderById: (orderId: string) => Order | undefined;
|
|
963
1014
|
getOrderFilesByOrderId: (orderId: string) => OrderFile[];
|
|
@@ -1035,6 +1086,10 @@ declare const createDatabase: ({ seed }?: {
|
|
|
1035
1086
|
* Update fs_sha for a package release based on its files
|
|
1036
1087
|
*/
|
|
1037
1088
|
updatePackageReleaseFsSha: (packageReleaseId: string) => void;
|
|
1089
|
+
addAiReview: (review: Omit<AiReview, "ai_review_id">) => AiReview;
|
|
1090
|
+
updateAiReview: (aiReviewId: string, updates: Partial<AiReview>) => AiReview | undefined;
|
|
1091
|
+
getAiReviewById: (aiReviewId: string) => AiReview | undefined;
|
|
1092
|
+
listAiReviews: () => AiReview[];
|
|
1038
1093
|
}> & Omit<{
|
|
1039
1094
|
idCounter: number;
|
|
1040
1095
|
snippets: {
|
|
@@ -1065,11 +1120,11 @@ declare const createDatabase: ({ seed }?: {
|
|
|
1065
1120
|
package_release_id: string;
|
|
1066
1121
|
created_at: string;
|
|
1067
1122
|
version: string | null;
|
|
1123
|
+
display_status: "error" | "pending" | "building" | "complete";
|
|
1068
1124
|
package_id: string;
|
|
1069
1125
|
is_locked: boolean;
|
|
1070
1126
|
is_latest: boolean;
|
|
1071
1127
|
has_transpiled: boolean;
|
|
1072
|
-
display_status: "error" | "pending" | "building" | "complete";
|
|
1073
1128
|
transpilation_display_status: "error" | "pending" | "building" | "complete";
|
|
1074
1129
|
transpilation_in_progress: boolean;
|
|
1075
1130
|
transpilation_logs: any[];
|
|
@@ -1078,8 +1133,8 @@ declare const createDatabase: ({ seed }?: {
|
|
|
1078
1133
|
circuit_json_build_in_progress: boolean;
|
|
1079
1134
|
circuit_json_build_logs: any[];
|
|
1080
1135
|
circuit_json_build_is_stale: boolean;
|
|
1081
|
-
ai_review_text: string | null;
|
|
1082
1136
|
ai_review_requested: boolean;
|
|
1137
|
+
ai_review_text?: string | null | undefined;
|
|
1083
1138
|
commit_sha?: string | null | undefined;
|
|
1084
1139
|
license?: string | null | undefined;
|
|
1085
1140
|
circuit_json_build_error?: string | null | undefined;
|
|
@@ -1091,6 +1146,10 @@ declare const createDatabase: ({ seed }?: {
|
|
|
1091
1146
|
transpilation_completed_at?: string | null | undefined;
|
|
1092
1147
|
circuit_json_build_started_at?: string | null | undefined;
|
|
1093
1148
|
circuit_json_build_completed_at?: string | null | undefined;
|
|
1149
|
+
ai_review_started_at?: string | null | undefined;
|
|
1150
|
+
ai_review_completed_at?: string | null | undefined;
|
|
1151
|
+
ai_review_error?: any;
|
|
1152
|
+
ai_review_logs?: any[] | null | undefined;
|
|
1094
1153
|
}[];
|
|
1095
1154
|
packageFiles: {
|
|
1096
1155
|
package_release_id: string;
|
|
@@ -1269,7 +1328,16 @@ declare const createDatabase: ({ seed }?: {
|
|
|
1269
1328
|
}[];
|
|
1270
1329
|
total_cost_without_shipping: number;
|
|
1271
1330
|
}[];
|
|
1272
|
-
|
|
1331
|
+
aiReviews: {
|
|
1332
|
+
created_at: string;
|
|
1333
|
+
ai_review_id: string;
|
|
1334
|
+
ai_review_text: string | null;
|
|
1335
|
+
start_processing_at: string | null;
|
|
1336
|
+
finished_processing_at: string | null;
|
|
1337
|
+
display_status: "pending" | "completed" | "failed";
|
|
1338
|
+
processing_error?: any;
|
|
1339
|
+
}[];
|
|
1340
|
+
}, "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" | "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"> & {
|
|
1273
1341
|
addOrder: (order: Omit<Order, "order_id">) => Order;
|
|
1274
1342
|
getOrderById: (orderId: string) => Order | undefined;
|
|
1275
1343
|
getOrderFilesByOrderId: (orderId: string) => OrderFile[];
|
|
@@ -1347,6 +1415,10 @@ declare const createDatabase: ({ seed }?: {
|
|
|
1347
1415
|
* Update fs_sha for a package release based on its files
|
|
1348
1416
|
*/
|
|
1349
1417
|
updatePackageReleaseFsSha: (packageReleaseId: string) => void;
|
|
1418
|
+
addAiReview: (review: Omit<AiReview, "ai_review_id">) => AiReview;
|
|
1419
|
+
updateAiReview: (aiReviewId: string, updates: Partial<AiReview>) => AiReview | undefined;
|
|
1420
|
+
getAiReviewById: (aiReviewId: string) => AiReview | undefined;
|
|
1421
|
+
listAiReviews: () => AiReview[];
|
|
1350
1422
|
};
|
|
1351
1423
|
type DbClient = ReturnType<typeof createDatabase>;
|
|
1352
1424
|
|
package/dist/index.js
CHANGED
|
@@ -120,6 +120,15 @@ var orderQuoteSchema = z.object({
|
|
|
120
120
|
shipping_options: z.array(shippingOptionSchema),
|
|
121
121
|
total_cost_without_shipping: z.number().default(0)
|
|
122
122
|
});
|
|
123
|
+
var aiReviewSchema = z.object({
|
|
124
|
+
ai_review_id: z.string().uuid(),
|
|
125
|
+
ai_review_text: z.string().nullable(),
|
|
126
|
+
start_processing_at: z.string().datetime().nullable(),
|
|
127
|
+
finished_processing_at: z.string().datetime().nullable(),
|
|
128
|
+
processing_error: z.any().nullable(),
|
|
129
|
+
created_at: z.string().datetime(),
|
|
130
|
+
display_status: z.enum(["pending", "completed", "failed"])
|
|
131
|
+
});
|
|
123
132
|
var accountSnippetSchema = z.object({
|
|
124
133
|
account_id: z.string(),
|
|
125
134
|
snippet_id: z.string(),
|
|
@@ -167,7 +176,11 @@ var packageReleaseSchema = z.object({
|
|
|
167
176
|
circuit_json_build_logs: z.array(z.any()).default([]),
|
|
168
177
|
circuit_json_build_is_stale: z.boolean().default(false),
|
|
169
178
|
// AI Review
|
|
170
|
-
ai_review_text: z.string().nullable().default(null),
|
|
179
|
+
ai_review_text: z.string().nullable().default(null).optional(),
|
|
180
|
+
ai_review_started_at: z.string().datetime().nullable().optional(),
|
|
181
|
+
ai_review_completed_at: z.string().datetime().nullable().optional(),
|
|
182
|
+
ai_review_error: z.any().optional().nullable(),
|
|
183
|
+
ai_review_logs: z.array(z.any()).optional().nullable(),
|
|
171
184
|
ai_review_requested: z.boolean().default(false)
|
|
172
185
|
});
|
|
173
186
|
var packageFileSchema = z.object({
|
|
@@ -260,7 +273,8 @@ var databaseSchema = z.object({
|
|
|
260
273
|
accountPackages: z.array(accountPackageSchema).default([]),
|
|
261
274
|
jlcpcbOrderState: z.array(jlcpcbOrderStateSchema).default([]),
|
|
262
275
|
jlcpcbOrderStepRuns: z.array(jlcpcbOrderStepRunSchema).default([]),
|
|
263
|
-
orderQuotes: z.array(orderQuoteSchema).default([])
|
|
276
|
+
orderQuotes: z.array(orderQuoteSchema).default([]),
|
|
277
|
+
aiReviews: z.array(aiReviewSchema).default([])
|
|
264
278
|
});
|
|
265
279
|
|
|
266
280
|
// fake-snippets-api/lib/db/autoload-dev-packages.ts
|
|
@@ -3045,6 +3059,40 @@ var initializer = combine(databaseSchema.parse({}), (set, get) => ({
|
|
|
3045
3059
|
(pkg) => pkg.latest_package_release_id === packageReleaseId ? { ...pkg, latest_package_release_fs_sha: fsSha } : pkg
|
|
3046
3060
|
)
|
|
3047
3061
|
}));
|
|
3062
|
+
},
|
|
3063
|
+
addAiReview: (review) => {
|
|
3064
|
+
const base = aiReviewSchema.omit({ ai_review_id: true }).parse(review);
|
|
3065
|
+
const newReview = {
|
|
3066
|
+
ai_review_id: crypto.randomUUID(),
|
|
3067
|
+
...base
|
|
3068
|
+
};
|
|
3069
|
+
set((state) => ({
|
|
3070
|
+
aiReviews: [...state.aiReviews, newReview],
|
|
3071
|
+
idCounter: state.idCounter + 1
|
|
3072
|
+
}));
|
|
3073
|
+
return newReview;
|
|
3074
|
+
},
|
|
3075
|
+
updateAiReview: (aiReviewId, updates) => {
|
|
3076
|
+
let updated;
|
|
3077
|
+
set((state) => {
|
|
3078
|
+
const index = state.aiReviews.findIndex(
|
|
3079
|
+
(ar) => ar.ai_review_id === aiReviewId
|
|
3080
|
+
);
|
|
3081
|
+
if (index === -1) return state;
|
|
3082
|
+
const aiReviews = [...state.aiReviews];
|
|
3083
|
+
aiReviews[index] = { ...aiReviews[index], ...updates };
|
|
3084
|
+
updated = aiReviews[index];
|
|
3085
|
+
return { ...state, aiReviews };
|
|
3086
|
+
});
|
|
3087
|
+
return updated;
|
|
3088
|
+
},
|
|
3089
|
+
getAiReviewById: (aiReviewId) => {
|
|
3090
|
+
const state = get();
|
|
3091
|
+
return state.aiReviews.find((ar) => ar.ai_review_id === aiReviewId);
|
|
3092
|
+
},
|
|
3093
|
+
listAiReviews: () => {
|
|
3094
|
+
const state = get();
|
|
3095
|
+
return state.aiReviews;
|
|
3048
3096
|
}
|
|
3049
3097
|
}));
|
|
3050
3098
|
|
package/dist/schema.d.ts
CHANGED
|
@@ -489,6 +489,32 @@ declare const orderQuoteSchema: z.ZodObject<{
|
|
|
489
489
|
total_cost_without_shipping?: number | undefined;
|
|
490
490
|
}>;
|
|
491
491
|
type OrderQuote = z.infer<typeof orderQuoteSchema>;
|
|
492
|
+
declare const aiReviewSchema: z.ZodObject<{
|
|
493
|
+
ai_review_id: z.ZodString;
|
|
494
|
+
ai_review_text: z.ZodNullable<z.ZodString>;
|
|
495
|
+
start_processing_at: z.ZodNullable<z.ZodString>;
|
|
496
|
+
finished_processing_at: z.ZodNullable<z.ZodString>;
|
|
497
|
+
processing_error: z.ZodNullable<z.ZodAny>;
|
|
498
|
+
created_at: z.ZodString;
|
|
499
|
+
display_status: z.ZodEnum<["pending", "completed", "failed"]>;
|
|
500
|
+
}, "strip", z.ZodTypeAny, {
|
|
501
|
+
created_at: string;
|
|
502
|
+
ai_review_id: string;
|
|
503
|
+
ai_review_text: string | null;
|
|
504
|
+
start_processing_at: string | null;
|
|
505
|
+
finished_processing_at: string | null;
|
|
506
|
+
display_status: "pending" | "completed" | "failed";
|
|
507
|
+
processing_error?: any;
|
|
508
|
+
}, {
|
|
509
|
+
created_at: string;
|
|
510
|
+
ai_review_id: string;
|
|
511
|
+
ai_review_text: string | null;
|
|
512
|
+
start_processing_at: string | null;
|
|
513
|
+
finished_processing_at: string | null;
|
|
514
|
+
display_status: "pending" | "completed" | "failed";
|
|
515
|
+
processing_error?: any;
|
|
516
|
+
}>;
|
|
517
|
+
type AiReview = z.infer<typeof aiReviewSchema>;
|
|
492
518
|
declare const accountSnippetSchema: z.ZodObject<{
|
|
493
519
|
account_id: z.ZodString;
|
|
494
520
|
snippet_id: z.ZodString;
|
|
@@ -560,17 +586,21 @@ declare const packageReleaseSchema: z.ZodObject<{
|
|
|
560
586
|
circuit_json_build_completed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
561
587
|
circuit_json_build_logs: z.ZodDefault<z.ZodArray<z.ZodAny, "many">>;
|
|
562
588
|
circuit_json_build_is_stale: z.ZodDefault<z.ZodBoolean>;
|
|
563
|
-
ai_review_text: z.ZodDefault<z.ZodNullable<z.ZodString
|
|
589
|
+
ai_review_text: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
|
|
590
|
+
ai_review_started_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
591
|
+
ai_review_completed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
592
|
+
ai_review_error: z.ZodNullable<z.ZodOptional<z.ZodAny>>;
|
|
593
|
+
ai_review_logs: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodAny, "many">>>;
|
|
564
594
|
ai_review_requested: z.ZodDefault<z.ZodBoolean>;
|
|
565
595
|
}, "strip", z.ZodTypeAny, {
|
|
566
596
|
package_release_id: string;
|
|
567
597
|
created_at: string;
|
|
568
598
|
version: string | null;
|
|
599
|
+
display_status: "error" | "pending" | "building" | "complete";
|
|
569
600
|
package_id: string;
|
|
570
601
|
is_locked: boolean;
|
|
571
602
|
is_latest: boolean;
|
|
572
603
|
has_transpiled: boolean;
|
|
573
|
-
display_status: "error" | "pending" | "building" | "complete";
|
|
574
604
|
transpilation_display_status: "error" | "pending" | "building" | "complete";
|
|
575
605
|
transpilation_in_progress: boolean;
|
|
576
606
|
transpilation_logs: any[];
|
|
@@ -579,8 +609,8 @@ declare const packageReleaseSchema: z.ZodObject<{
|
|
|
579
609
|
circuit_json_build_in_progress: boolean;
|
|
580
610
|
circuit_json_build_logs: any[];
|
|
581
611
|
circuit_json_build_is_stale: boolean;
|
|
582
|
-
ai_review_text: string | null;
|
|
583
612
|
ai_review_requested: boolean;
|
|
613
|
+
ai_review_text?: string | null | undefined;
|
|
584
614
|
commit_sha?: string | null | undefined;
|
|
585
615
|
license?: string | null | undefined;
|
|
586
616
|
circuit_json_build_error?: string | null | undefined;
|
|
@@ -592,6 +622,10 @@ declare const packageReleaseSchema: z.ZodObject<{
|
|
|
592
622
|
transpilation_completed_at?: string | null | undefined;
|
|
593
623
|
circuit_json_build_started_at?: string | null | undefined;
|
|
594
624
|
circuit_json_build_completed_at?: string | null | undefined;
|
|
625
|
+
ai_review_started_at?: string | null | undefined;
|
|
626
|
+
ai_review_completed_at?: string | null | undefined;
|
|
627
|
+
ai_review_error?: any;
|
|
628
|
+
ai_review_logs?: any[] | null | undefined;
|
|
595
629
|
}, {
|
|
596
630
|
package_release_id: string;
|
|
597
631
|
created_at: string;
|
|
@@ -599,6 +633,8 @@ declare const packageReleaseSchema: z.ZodObject<{
|
|
|
599
633
|
package_id: string;
|
|
600
634
|
is_locked: boolean;
|
|
601
635
|
is_latest: boolean;
|
|
636
|
+
ai_review_text?: string | null | undefined;
|
|
637
|
+
display_status?: "error" | "pending" | "building" | "complete" | undefined;
|
|
602
638
|
commit_sha?: string | null | undefined;
|
|
603
639
|
license?: string | null | undefined;
|
|
604
640
|
circuit_json_build_error?: string | null | undefined;
|
|
@@ -606,7 +642,6 @@ declare const packageReleaseSchema: z.ZodObject<{
|
|
|
606
642
|
has_transpiled?: boolean | undefined;
|
|
607
643
|
transpilation_error?: string | null | undefined;
|
|
608
644
|
fs_sha?: string | null | undefined;
|
|
609
|
-
display_status?: "error" | "pending" | "building" | "complete" | undefined;
|
|
610
645
|
total_build_duration_ms?: number | null | undefined;
|
|
611
646
|
transpilation_display_status?: "error" | "pending" | "building" | "complete" | undefined;
|
|
612
647
|
transpilation_in_progress?: boolean | undefined;
|
|
@@ -620,7 +655,10 @@ declare const packageReleaseSchema: z.ZodObject<{
|
|
|
620
655
|
circuit_json_build_completed_at?: string | null | undefined;
|
|
621
656
|
circuit_json_build_logs?: any[] | undefined;
|
|
622
657
|
circuit_json_build_is_stale?: boolean | undefined;
|
|
623
|
-
|
|
658
|
+
ai_review_started_at?: string | null | undefined;
|
|
659
|
+
ai_review_completed_at?: string | null | undefined;
|
|
660
|
+
ai_review_error?: any;
|
|
661
|
+
ai_review_logs?: any[] | null | undefined;
|
|
624
662
|
ai_review_requested?: boolean | undefined;
|
|
625
663
|
}>;
|
|
626
664
|
type PackageRelease = z.infer<typeof packageReleaseSchema>;
|
|
@@ -945,17 +983,21 @@ declare const databaseSchema: z.ZodObject<{
|
|
|
945
983
|
circuit_json_build_completed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
946
984
|
circuit_json_build_logs: z.ZodDefault<z.ZodArray<z.ZodAny, "many">>;
|
|
947
985
|
circuit_json_build_is_stale: z.ZodDefault<z.ZodBoolean>;
|
|
948
|
-
ai_review_text: z.ZodDefault<z.ZodNullable<z.ZodString
|
|
986
|
+
ai_review_text: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
|
|
987
|
+
ai_review_started_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
988
|
+
ai_review_completed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
989
|
+
ai_review_error: z.ZodNullable<z.ZodOptional<z.ZodAny>>;
|
|
990
|
+
ai_review_logs: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodAny, "many">>>;
|
|
949
991
|
ai_review_requested: z.ZodDefault<z.ZodBoolean>;
|
|
950
992
|
}, "strip", z.ZodTypeAny, {
|
|
951
993
|
package_release_id: string;
|
|
952
994
|
created_at: string;
|
|
953
995
|
version: string | null;
|
|
996
|
+
display_status: "error" | "pending" | "building" | "complete";
|
|
954
997
|
package_id: string;
|
|
955
998
|
is_locked: boolean;
|
|
956
999
|
is_latest: boolean;
|
|
957
1000
|
has_transpiled: boolean;
|
|
958
|
-
display_status: "error" | "pending" | "building" | "complete";
|
|
959
1001
|
transpilation_display_status: "error" | "pending" | "building" | "complete";
|
|
960
1002
|
transpilation_in_progress: boolean;
|
|
961
1003
|
transpilation_logs: any[];
|
|
@@ -964,8 +1006,8 @@ declare const databaseSchema: z.ZodObject<{
|
|
|
964
1006
|
circuit_json_build_in_progress: boolean;
|
|
965
1007
|
circuit_json_build_logs: any[];
|
|
966
1008
|
circuit_json_build_is_stale: boolean;
|
|
967
|
-
ai_review_text: string | null;
|
|
968
1009
|
ai_review_requested: boolean;
|
|
1010
|
+
ai_review_text?: string | null | undefined;
|
|
969
1011
|
commit_sha?: string | null | undefined;
|
|
970
1012
|
license?: string | null | undefined;
|
|
971
1013
|
circuit_json_build_error?: string | null | undefined;
|
|
@@ -977,6 +1019,10 @@ declare const databaseSchema: z.ZodObject<{
|
|
|
977
1019
|
transpilation_completed_at?: string | null | undefined;
|
|
978
1020
|
circuit_json_build_started_at?: string | null | undefined;
|
|
979
1021
|
circuit_json_build_completed_at?: string | null | undefined;
|
|
1022
|
+
ai_review_started_at?: string | null | undefined;
|
|
1023
|
+
ai_review_completed_at?: string | null | undefined;
|
|
1024
|
+
ai_review_error?: any;
|
|
1025
|
+
ai_review_logs?: any[] | null | undefined;
|
|
980
1026
|
}, {
|
|
981
1027
|
package_release_id: string;
|
|
982
1028
|
created_at: string;
|
|
@@ -984,6 +1030,8 @@ declare const databaseSchema: z.ZodObject<{
|
|
|
984
1030
|
package_id: string;
|
|
985
1031
|
is_locked: boolean;
|
|
986
1032
|
is_latest: boolean;
|
|
1033
|
+
ai_review_text?: string | null | undefined;
|
|
1034
|
+
display_status?: "error" | "pending" | "building" | "complete" | undefined;
|
|
987
1035
|
commit_sha?: string | null | undefined;
|
|
988
1036
|
license?: string | null | undefined;
|
|
989
1037
|
circuit_json_build_error?: string | null | undefined;
|
|
@@ -991,7 +1039,6 @@ declare const databaseSchema: z.ZodObject<{
|
|
|
991
1039
|
has_transpiled?: boolean | undefined;
|
|
992
1040
|
transpilation_error?: string | null | undefined;
|
|
993
1041
|
fs_sha?: string | null | undefined;
|
|
994
|
-
display_status?: "error" | "pending" | "building" | "complete" | undefined;
|
|
995
1042
|
total_build_duration_ms?: number | null | undefined;
|
|
996
1043
|
transpilation_display_status?: "error" | "pending" | "building" | "complete" | undefined;
|
|
997
1044
|
transpilation_in_progress?: boolean | undefined;
|
|
@@ -1005,7 +1052,10 @@ declare const databaseSchema: z.ZodObject<{
|
|
|
1005
1052
|
circuit_json_build_completed_at?: string | null | undefined;
|
|
1006
1053
|
circuit_json_build_logs?: any[] | undefined;
|
|
1007
1054
|
circuit_json_build_is_stale?: boolean | undefined;
|
|
1008
|
-
|
|
1055
|
+
ai_review_started_at?: string | null | undefined;
|
|
1056
|
+
ai_review_completed_at?: string | null | undefined;
|
|
1057
|
+
ai_review_error?: any;
|
|
1058
|
+
ai_review_logs?: any[] | null | undefined;
|
|
1009
1059
|
ai_review_requested?: boolean | undefined;
|
|
1010
1060
|
}>, "many">>;
|
|
1011
1061
|
packageFiles: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
@@ -1571,6 +1621,31 @@ declare const databaseSchema: z.ZodObject<{
|
|
|
1571
1621
|
bare_pcb_cost?: number | undefined;
|
|
1572
1622
|
total_cost_without_shipping?: number | undefined;
|
|
1573
1623
|
}>, "many">>;
|
|
1624
|
+
aiReviews: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
1625
|
+
ai_review_id: z.ZodString;
|
|
1626
|
+
ai_review_text: z.ZodNullable<z.ZodString>;
|
|
1627
|
+
start_processing_at: z.ZodNullable<z.ZodString>;
|
|
1628
|
+
finished_processing_at: z.ZodNullable<z.ZodString>;
|
|
1629
|
+
processing_error: z.ZodNullable<z.ZodAny>;
|
|
1630
|
+
created_at: z.ZodString;
|
|
1631
|
+
display_status: z.ZodEnum<["pending", "completed", "failed"]>;
|
|
1632
|
+
}, "strip", z.ZodTypeAny, {
|
|
1633
|
+
created_at: string;
|
|
1634
|
+
ai_review_id: string;
|
|
1635
|
+
ai_review_text: string | null;
|
|
1636
|
+
start_processing_at: string | null;
|
|
1637
|
+
finished_processing_at: string | null;
|
|
1638
|
+
display_status: "pending" | "completed" | "failed";
|
|
1639
|
+
processing_error?: any;
|
|
1640
|
+
}, {
|
|
1641
|
+
created_at: string;
|
|
1642
|
+
ai_review_id: string;
|
|
1643
|
+
ai_review_text: string | null;
|
|
1644
|
+
start_processing_at: string | null;
|
|
1645
|
+
finished_processing_at: string | null;
|
|
1646
|
+
display_status: "pending" | "completed" | "failed";
|
|
1647
|
+
processing_error?: any;
|
|
1648
|
+
}>, "many">>;
|
|
1574
1649
|
}, "strip", z.ZodTypeAny, {
|
|
1575
1650
|
idCounter: number;
|
|
1576
1651
|
snippets: {
|
|
@@ -1601,11 +1676,11 @@ declare const databaseSchema: z.ZodObject<{
|
|
|
1601
1676
|
package_release_id: string;
|
|
1602
1677
|
created_at: string;
|
|
1603
1678
|
version: string | null;
|
|
1679
|
+
display_status: "error" | "pending" | "building" | "complete";
|
|
1604
1680
|
package_id: string;
|
|
1605
1681
|
is_locked: boolean;
|
|
1606
1682
|
is_latest: boolean;
|
|
1607
1683
|
has_transpiled: boolean;
|
|
1608
|
-
display_status: "error" | "pending" | "building" | "complete";
|
|
1609
1684
|
transpilation_display_status: "error" | "pending" | "building" | "complete";
|
|
1610
1685
|
transpilation_in_progress: boolean;
|
|
1611
1686
|
transpilation_logs: any[];
|
|
@@ -1614,8 +1689,8 @@ declare const databaseSchema: z.ZodObject<{
|
|
|
1614
1689
|
circuit_json_build_in_progress: boolean;
|
|
1615
1690
|
circuit_json_build_logs: any[];
|
|
1616
1691
|
circuit_json_build_is_stale: boolean;
|
|
1617
|
-
ai_review_text: string | null;
|
|
1618
1692
|
ai_review_requested: boolean;
|
|
1693
|
+
ai_review_text?: string | null | undefined;
|
|
1619
1694
|
commit_sha?: string | null | undefined;
|
|
1620
1695
|
license?: string | null | undefined;
|
|
1621
1696
|
circuit_json_build_error?: string | null | undefined;
|
|
@@ -1627,6 +1702,10 @@ declare const databaseSchema: z.ZodObject<{
|
|
|
1627
1702
|
transpilation_completed_at?: string | null | undefined;
|
|
1628
1703
|
circuit_json_build_started_at?: string | null | undefined;
|
|
1629
1704
|
circuit_json_build_completed_at?: string | null | undefined;
|
|
1705
|
+
ai_review_started_at?: string | null | undefined;
|
|
1706
|
+
ai_review_completed_at?: string | null | undefined;
|
|
1707
|
+
ai_review_error?: any;
|
|
1708
|
+
ai_review_logs?: any[] | null | undefined;
|
|
1630
1709
|
}[];
|
|
1631
1710
|
packageFiles: {
|
|
1632
1711
|
package_release_id: string;
|
|
@@ -1805,6 +1884,15 @@ declare const databaseSchema: z.ZodObject<{
|
|
|
1805
1884
|
}[];
|
|
1806
1885
|
total_cost_without_shipping: number;
|
|
1807
1886
|
}[];
|
|
1887
|
+
aiReviews: {
|
|
1888
|
+
created_at: string;
|
|
1889
|
+
ai_review_id: string;
|
|
1890
|
+
ai_review_text: string | null;
|
|
1891
|
+
start_processing_at: string | null;
|
|
1892
|
+
finished_processing_at: string | null;
|
|
1893
|
+
display_status: "pending" | "completed" | "failed";
|
|
1894
|
+
processing_error?: any;
|
|
1895
|
+
}[];
|
|
1808
1896
|
}, {
|
|
1809
1897
|
idCounter?: number | undefined;
|
|
1810
1898
|
snippets?: {
|
|
@@ -1838,6 +1926,8 @@ declare const databaseSchema: z.ZodObject<{
|
|
|
1838
1926
|
package_id: string;
|
|
1839
1927
|
is_locked: boolean;
|
|
1840
1928
|
is_latest: boolean;
|
|
1929
|
+
ai_review_text?: string | null | undefined;
|
|
1930
|
+
display_status?: "error" | "pending" | "building" | "complete" | undefined;
|
|
1841
1931
|
commit_sha?: string | null | undefined;
|
|
1842
1932
|
license?: string | null | undefined;
|
|
1843
1933
|
circuit_json_build_error?: string | null | undefined;
|
|
@@ -1845,7 +1935,6 @@ declare const databaseSchema: z.ZodObject<{
|
|
|
1845
1935
|
has_transpiled?: boolean | undefined;
|
|
1846
1936
|
transpilation_error?: string | null | undefined;
|
|
1847
1937
|
fs_sha?: string | null | undefined;
|
|
1848
|
-
display_status?: "error" | "pending" | "building" | "complete" | undefined;
|
|
1849
1938
|
total_build_duration_ms?: number | null | undefined;
|
|
1850
1939
|
transpilation_display_status?: "error" | "pending" | "building" | "complete" | undefined;
|
|
1851
1940
|
transpilation_in_progress?: boolean | undefined;
|
|
@@ -1859,7 +1948,10 @@ declare const databaseSchema: z.ZodObject<{
|
|
|
1859
1948
|
circuit_json_build_completed_at?: string | null | undefined;
|
|
1860
1949
|
circuit_json_build_logs?: any[] | undefined;
|
|
1861
1950
|
circuit_json_build_is_stale?: boolean | undefined;
|
|
1862
|
-
|
|
1951
|
+
ai_review_started_at?: string | null | undefined;
|
|
1952
|
+
ai_review_completed_at?: string | null | undefined;
|
|
1953
|
+
ai_review_error?: any;
|
|
1954
|
+
ai_review_logs?: any[] | null | undefined;
|
|
1863
1955
|
ai_review_requested?: boolean | undefined;
|
|
1864
1956
|
}[] | undefined;
|
|
1865
1957
|
packageFiles?: {
|
|
@@ -2039,7 +2131,16 @@ declare const databaseSchema: z.ZodObject<{
|
|
|
2039
2131
|
bare_pcb_cost?: number | undefined;
|
|
2040
2132
|
total_cost_without_shipping?: number | undefined;
|
|
2041
2133
|
}[] | undefined;
|
|
2134
|
+
aiReviews?: {
|
|
2135
|
+
created_at: string;
|
|
2136
|
+
ai_review_id: string;
|
|
2137
|
+
ai_review_text: string | null;
|
|
2138
|
+
start_processing_at: string | null;
|
|
2139
|
+
finished_processing_at: string | null;
|
|
2140
|
+
display_status: "pending" | "completed" | "failed";
|
|
2141
|
+
processing_error?: any;
|
|
2142
|
+
}[] | undefined;
|
|
2042
2143
|
}>;
|
|
2043
2144
|
type DatabaseSchema = z.infer<typeof databaseSchema>;
|
|
2044
2145
|
|
|
2045
|
-
export { type Account, type AccountPackage, type AccountSnippet, type DatabaseSchema, 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, databaseSchema, errorResponseSchema, errorSchema, jlcpcbOrderStateSchema, jlcpcbOrderStepRunSchema, loginPageSchema, orderFileSchema, orderQuoteSchema, orderSchema, packageFileSchema, packageReleaseSchema, packageSchema, quotedComponentSchema, sessionSchema, shippingInfoSchema, snippetSchema };
|
|
2146
|
+
export { type Account, type AccountPackage, type AccountSnippet, type AiReview, type DatabaseSchema, 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, errorResponseSchema, errorSchema, jlcpcbOrderStateSchema, jlcpcbOrderStepRunSchema, loginPageSchema, orderFileSchema, orderQuoteSchema, orderSchema, packageFileSchema, packageReleaseSchema, packageSchema, quotedComponentSchema, sessionSchema, shippingInfoSchema, snippetSchema };
|
package/dist/schema.js
CHANGED
|
@@ -115,6 +115,15 @@ var orderQuoteSchema = z.object({
|
|
|
115
115
|
shipping_options: z.array(shippingOptionSchema),
|
|
116
116
|
total_cost_without_shipping: z.number().default(0)
|
|
117
117
|
});
|
|
118
|
+
var aiReviewSchema = z.object({
|
|
119
|
+
ai_review_id: z.string().uuid(),
|
|
120
|
+
ai_review_text: z.string().nullable(),
|
|
121
|
+
start_processing_at: z.string().datetime().nullable(),
|
|
122
|
+
finished_processing_at: z.string().datetime().nullable(),
|
|
123
|
+
processing_error: z.any().nullable(),
|
|
124
|
+
created_at: z.string().datetime(),
|
|
125
|
+
display_status: z.enum(["pending", "completed", "failed"])
|
|
126
|
+
});
|
|
118
127
|
var accountSnippetSchema = z.object({
|
|
119
128
|
account_id: z.string(),
|
|
120
129
|
snippet_id: z.string(),
|
|
@@ -162,7 +171,11 @@ var packageReleaseSchema = z.object({
|
|
|
162
171
|
circuit_json_build_logs: z.array(z.any()).default([]),
|
|
163
172
|
circuit_json_build_is_stale: z.boolean().default(false),
|
|
164
173
|
// AI Review
|
|
165
|
-
ai_review_text: z.string().nullable().default(null),
|
|
174
|
+
ai_review_text: z.string().nullable().default(null).optional(),
|
|
175
|
+
ai_review_started_at: z.string().datetime().nullable().optional(),
|
|
176
|
+
ai_review_completed_at: z.string().datetime().nullable().optional(),
|
|
177
|
+
ai_review_error: z.any().optional().nullable(),
|
|
178
|
+
ai_review_logs: z.array(z.any()).optional().nullable(),
|
|
166
179
|
ai_review_requested: z.boolean().default(false)
|
|
167
180
|
});
|
|
168
181
|
var packageFileSchema = z.object({
|
|
@@ -255,12 +268,14 @@ var databaseSchema = z.object({
|
|
|
255
268
|
accountPackages: z.array(accountPackageSchema).default([]),
|
|
256
269
|
jlcpcbOrderState: z.array(jlcpcbOrderStateSchema).default([]),
|
|
257
270
|
jlcpcbOrderStepRuns: z.array(jlcpcbOrderStepRunSchema).default([]),
|
|
258
|
-
orderQuotes: z.array(orderQuoteSchema).default([])
|
|
271
|
+
orderQuotes: z.array(orderQuoteSchema).default([]),
|
|
272
|
+
aiReviews: z.array(aiReviewSchema).default([])
|
|
259
273
|
});
|
|
260
274
|
export {
|
|
261
275
|
accountPackageSchema,
|
|
262
276
|
accountSchema,
|
|
263
277
|
accountSnippetSchema,
|
|
278
|
+
aiReviewSchema,
|
|
264
279
|
databaseSchema,
|
|
265
280
|
errorResponseSchema,
|
|
266
281
|
errorSchema,
|