@tscircuit/fake-snippets 0.0.119 → 0.0.120
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/bun-tests/fake-snippets-api/routes/bug_reports/create.test.ts +37 -0
- package/bun-tests/fake-snippets-api/routes/bug_reports/upload_file.test.ts +89 -0
- package/bun.lock +2 -2
- package/dist/bundle.js +758 -504
- package/dist/index.d.ts +131 -6
- package/dist/index.js +90 -1
- package/dist/schema.d.ts +177 -7
- package/dist/schema.js +29 -1
- package/fake-snippets-api/lib/db/db-client.ts +89 -0
- package/fake-snippets-api/lib/db/schema.ts +29 -0
- package/fake-snippets-api/routes/api/bug_reports/create.ts +43 -0
- package/fake-snippets-api/routes/api/bug_reports/upload_file.ts +113 -0
- package/package.json +2 -2
- package/src/components/Header.tsx +16 -0
- package/src/components/PackageCard.tsx +7 -4
- package/src/components/PackageSearchResults.tsx +1 -7
- package/src/components/SearchComponent.tsx +64 -53
- package/src/components/TrendingPackagesCarousel.tsx +16 -23
- package/src/components/ViewPackagePage/components/mobile-sidebar.tsx +3 -2
- package/src/components/ViewPackagePage/components/preview-image-squares.tsx +6 -3
- package/src/hooks/use-preview-images.ts +22 -17
- package/src/hooks/useUpdatePackageFilesMutation.ts +8 -0
- package/src/lib/utils/getPackagePreviewImageUrl.ts +15 -0
- package/src/pages/dashboard.tsx +0 -1
- package/src/pages/editor.tsx +12 -9
- package/src/pages/organization-profile.tsx +0 -1
- package/src/pages/package-editor.tsx +13 -9
- package/src/pages/user-profile.tsx +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -270,6 +270,61 @@ declare const orderFileSchema: z.ZodObject<{
|
|
|
270
270
|
content_bytes: Uint8Array<ArrayBuffer> | null;
|
|
271
271
|
}>;
|
|
272
272
|
type OrderFile = z.infer<typeof orderFileSchema>;
|
|
273
|
+
declare const bugReportSchema: z.ZodObject<{
|
|
274
|
+
bug_report_id: z.ZodString;
|
|
275
|
+
reporter_account_id: z.ZodString;
|
|
276
|
+
text: z.ZodNullable<z.ZodString>;
|
|
277
|
+
is_auto_deleted: z.ZodDefault<z.ZodBoolean>;
|
|
278
|
+
delete_at: z.ZodNullable<z.ZodString>;
|
|
279
|
+
created_at: z.ZodString;
|
|
280
|
+
file_count: z.ZodNumber;
|
|
281
|
+
}, "strip", z.ZodTypeAny, {
|
|
282
|
+
created_at: string;
|
|
283
|
+
bug_report_id: string;
|
|
284
|
+
reporter_account_id: string;
|
|
285
|
+
text: string | null;
|
|
286
|
+
is_auto_deleted: boolean;
|
|
287
|
+
delete_at: string | null;
|
|
288
|
+
file_count: number;
|
|
289
|
+
}, {
|
|
290
|
+
created_at: string;
|
|
291
|
+
bug_report_id: string;
|
|
292
|
+
reporter_account_id: string;
|
|
293
|
+
text: string | null;
|
|
294
|
+
delete_at: string | null;
|
|
295
|
+
file_count: number;
|
|
296
|
+
is_auto_deleted?: boolean | undefined;
|
|
297
|
+
}>;
|
|
298
|
+
type BugReport = z.infer<typeof bugReportSchema>;
|
|
299
|
+
declare const bugReportFileSchema: z.ZodObject<{
|
|
300
|
+
bug_report_file_id: z.ZodString;
|
|
301
|
+
bug_report_id: z.ZodString;
|
|
302
|
+
file_path: z.ZodString;
|
|
303
|
+
content_mimetype: z.ZodString;
|
|
304
|
+
is_text: z.ZodBoolean;
|
|
305
|
+
created_at: z.ZodString;
|
|
306
|
+
content_text: z.ZodNullable<z.ZodString>;
|
|
307
|
+
content_bytes: z.ZodNullable<z.ZodType<Uint8Array<ArrayBuffer>, z.ZodTypeDef, Uint8Array<ArrayBuffer>>>;
|
|
308
|
+
}, "strip", z.ZodTypeAny, {
|
|
309
|
+
created_at: string;
|
|
310
|
+
content_text: string | null;
|
|
311
|
+
content_bytes: Uint8Array<ArrayBuffer> | null;
|
|
312
|
+
bug_report_id: string;
|
|
313
|
+
bug_report_file_id: string;
|
|
314
|
+
file_path: string;
|
|
315
|
+
content_mimetype: string;
|
|
316
|
+
is_text: boolean;
|
|
317
|
+
}, {
|
|
318
|
+
created_at: string;
|
|
319
|
+
content_text: string | null;
|
|
320
|
+
content_bytes: Uint8Array<ArrayBuffer> | null;
|
|
321
|
+
bug_report_id: string;
|
|
322
|
+
bug_report_file_id: string;
|
|
323
|
+
file_path: string;
|
|
324
|
+
content_mimetype: string;
|
|
325
|
+
is_text: boolean;
|
|
326
|
+
}>;
|
|
327
|
+
type BugReportFile = z.infer<typeof bugReportFileSchema>;
|
|
273
328
|
declare const orderQuoteSchema: z.ZodObject<{
|
|
274
329
|
order_quote_id: z.ZodString;
|
|
275
330
|
account_id: z.ZodNullable<z.ZodString>;
|
|
@@ -657,8 +712,8 @@ declare const packageFileSchema: z.ZodObject<{
|
|
|
657
712
|
}, "strip", z.ZodTypeAny, {
|
|
658
713
|
package_release_id: string;
|
|
659
714
|
created_at: string;
|
|
660
|
-
package_file_id: string;
|
|
661
715
|
file_path: string;
|
|
716
|
+
package_file_id: string;
|
|
662
717
|
content_text?: string | null | undefined;
|
|
663
718
|
content_mimetype?: string | null | undefined;
|
|
664
719
|
is_release_tarball?: boolean | undefined;
|
|
@@ -666,8 +721,8 @@ declare const packageFileSchema: z.ZodObject<{
|
|
|
666
721
|
}, {
|
|
667
722
|
package_release_id: string;
|
|
668
723
|
created_at: string;
|
|
669
|
-
package_file_id: string;
|
|
670
724
|
file_path: string;
|
|
725
|
+
package_file_id: string;
|
|
671
726
|
content_text?: string | null | undefined;
|
|
672
727
|
content_mimetype?: string | null | undefined;
|
|
673
728
|
is_release_tarball?: boolean | undefined;
|
|
@@ -1094,8 +1149,8 @@ declare const createDatabase: ({ seed }?: {
|
|
|
1094
1149
|
packageFiles: {
|
|
1095
1150
|
package_release_id: string;
|
|
1096
1151
|
created_at: string;
|
|
1097
|
-
package_file_id: string;
|
|
1098
1152
|
file_path: string;
|
|
1153
|
+
package_file_id: string;
|
|
1099
1154
|
content_text?: string | null | undefined;
|
|
1100
1155
|
content_mimetype?: string | null | undefined;
|
|
1101
1156
|
is_release_tarball?: boolean | undefined;
|
|
@@ -1353,7 +1408,26 @@ declare const createDatabase: ({ seed }?: {
|
|
|
1353
1408
|
preview_url?: string | null | undefined;
|
|
1354
1409
|
build_logs?: string | null | undefined;
|
|
1355
1410
|
}[];
|
|
1356
|
-
|
|
1411
|
+
bugReports: {
|
|
1412
|
+
created_at: string;
|
|
1413
|
+
bug_report_id: string;
|
|
1414
|
+
reporter_account_id: string;
|
|
1415
|
+
text: string | null;
|
|
1416
|
+
is_auto_deleted: boolean;
|
|
1417
|
+
delete_at: string | null;
|
|
1418
|
+
file_count: number;
|
|
1419
|
+
}[];
|
|
1420
|
+
bugReportFiles: {
|
|
1421
|
+
created_at: string;
|
|
1422
|
+
content_text: string | null;
|
|
1423
|
+
content_bytes: Uint8Array<ArrayBuffer> | null;
|
|
1424
|
+
bug_report_id: string;
|
|
1425
|
+
bug_report_file_id: string;
|
|
1426
|
+
file_path: string;
|
|
1427
|
+
content_mimetype: string;
|
|
1428
|
+
is_text: boolean;
|
|
1429
|
+
}[];
|
|
1430
|
+
}, "addOrder" | "getOrderById" | "getOrderFilesByOrderId" | "addOrderQuote" | "getOrderQuoteById" | "getJlcpcbOrderStatesByOrderId" | "getJlcpcbOrderStepRunsByJlcpcbOrderStateId" | "updateOrder" | "addJlcpcbOrderState" | "updateJlcpcbOrderState" | "addOrderFile" | "getOrderFileById" | "addBugReport" | "getBugReportById" | "addBugReportFile" | "getBugReportFilesByBugReportId" | "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" | "addOrganization" | "getOrgs" | "getOrg" | "addOrganizationAccount" | "getOrganizationAccount" | "getOrganizationAccounts" | "removeOrganizationAccount" | "updateOrganization"> & {
|
|
1357
1431
|
addOrder: (order: Omit<Order, "order_id">) => Order;
|
|
1358
1432
|
getOrderById: (orderId: string) => Order | undefined;
|
|
1359
1433
|
getOrderFilesByOrderId: (orderId: string) => OrderFile[];
|
|
@@ -1370,6 +1444,22 @@ declare const createDatabase: ({ seed }?: {
|
|
|
1370
1444
|
updateJlcpcbOrderState: (orderId: string, updates: Partial<JlcpcbOrderState>) => void;
|
|
1371
1445
|
addOrderFile: (orderFile: Omit<OrderFile, "order_file_id">) => OrderFile;
|
|
1372
1446
|
getOrderFileById: (orderFileId: string) => OrderFile | undefined;
|
|
1447
|
+
addBugReport: ({ reporter_account_id, text, is_auto_deleted, delete_at, }: {
|
|
1448
|
+
reporter_account_id: string;
|
|
1449
|
+
text?: string | null;
|
|
1450
|
+
is_auto_deleted?: boolean;
|
|
1451
|
+
delete_at?: string | null;
|
|
1452
|
+
}) => BugReport;
|
|
1453
|
+
getBugReportById: (bugReportId: string) => BugReport | undefined;
|
|
1454
|
+
addBugReportFile: ({ bug_report_id, file_path, content_mimetype, is_text, content_text, content_bytes, }: {
|
|
1455
|
+
bug_report_id: string;
|
|
1456
|
+
file_path: string;
|
|
1457
|
+
content_mimetype: string;
|
|
1458
|
+
is_text: boolean;
|
|
1459
|
+
content_text: string | null;
|
|
1460
|
+
content_bytes: Uint8Array | null;
|
|
1461
|
+
}) => BugReportFile;
|
|
1462
|
+
getBugReportFilesByBugReportId: (bugReportId: string) => BugReportFile[];
|
|
1373
1463
|
addAccount: (account: Omit<Account, "account_id" | "is_tscircuit_staff"> & Partial<Pick<Account, "account_id" | "is_tscircuit_staff">>) => {
|
|
1374
1464
|
is_tscircuit_staff: boolean;
|
|
1375
1465
|
github_username: string;
|
|
@@ -1614,8 +1704,8 @@ declare const createDatabase: ({ seed }?: {
|
|
|
1614
1704
|
packageFiles: {
|
|
1615
1705
|
package_release_id: string;
|
|
1616
1706
|
created_at: string;
|
|
1617
|
-
package_file_id: string;
|
|
1618
1707
|
file_path: string;
|
|
1708
|
+
package_file_id: string;
|
|
1619
1709
|
content_text?: string | null | undefined;
|
|
1620
1710
|
content_mimetype?: string | null | undefined;
|
|
1621
1711
|
is_release_tarball?: boolean | undefined;
|
|
@@ -1873,7 +1963,26 @@ declare const createDatabase: ({ seed }?: {
|
|
|
1873
1963
|
preview_url?: string | null | undefined;
|
|
1874
1964
|
build_logs?: string | null | undefined;
|
|
1875
1965
|
}[];
|
|
1876
|
-
|
|
1966
|
+
bugReports: {
|
|
1967
|
+
created_at: string;
|
|
1968
|
+
bug_report_id: string;
|
|
1969
|
+
reporter_account_id: string;
|
|
1970
|
+
text: string | null;
|
|
1971
|
+
is_auto_deleted: boolean;
|
|
1972
|
+
delete_at: string | null;
|
|
1973
|
+
file_count: number;
|
|
1974
|
+
}[];
|
|
1975
|
+
bugReportFiles: {
|
|
1976
|
+
created_at: string;
|
|
1977
|
+
content_text: string | null;
|
|
1978
|
+
content_bytes: Uint8Array<ArrayBuffer> | null;
|
|
1979
|
+
bug_report_id: string;
|
|
1980
|
+
bug_report_file_id: string;
|
|
1981
|
+
file_path: string;
|
|
1982
|
+
content_mimetype: string;
|
|
1983
|
+
is_text: boolean;
|
|
1984
|
+
}[];
|
|
1985
|
+
}, "addOrder" | "getOrderById" | "getOrderFilesByOrderId" | "addOrderQuote" | "getOrderQuoteById" | "getJlcpcbOrderStatesByOrderId" | "getJlcpcbOrderStepRunsByJlcpcbOrderStateId" | "updateOrder" | "addJlcpcbOrderState" | "updateJlcpcbOrderState" | "addOrderFile" | "getOrderFileById" | "addBugReport" | "getBugReportById" | "addBugReportFile" | "getBugReportFilesByBugReportId" | "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" | "addOrganization" | "getOrgs" | "getOrg" | "addOrganizationAccount" | "getOrganizationAccount" | "getOrganizationAccounts" | "removeOrganizationAccount" | "updateOrganization"> & {
|
|
1877
1986
|
addOrder: (order: Omit<Order, "order_id">) => Order;
|
|
1878
1987
|
getOrderById: (orderId: string) => Order | undefined;
|
|
1879
1988
|
getOrderFilesByOrderId: (orderId: string) => OrderFile[];
|
|
@@ -1890,6 +1999,22 @@ declare const createDatabase: ({ seed }?: {
|
|
|
1890
1999
|
updateJlcpcbOrderState: (orderId: string, updates: Partial<JlcpcbOrderState>) => void;
|
|
1891
2000
|
addOrderFile: (orderFile: Omit<OrderFile, "order_file_id">) => OrderFile;
|
|
1892
2001
|
getOrderFileById: (orderFileId: string) => OrderFile | undefined;
|
|
2002
|
+
addBugReport: ({ reporter_account_id, text, is_auto_deleted, delete_at, }: {
|
|
2003
|
+
reporter_account_id: string;
|
|
2004
|
+
text?: string | null;
|
|
2005
|
+
is_auto_deleted?: boolean;
|
|
2006
|
+
delete_at?: string | null;
|
|
2007
|
+
}) => BugReport;
|
|
2008
|
+
getBugReportById: (bugReportId: string) => BugReport | undefined;
|
|
2009
|
+
addBugReportFile: ({ bug_report_id, file_path, content_mimetype, is_text, content_text, content_bytes, }: {
|
|
2010
|
+
bug_report_id: string;
|
|
2011
|
+
file_path: string;
|
|
2012
|
+
content_mimetype: string;
|
|
2013
|
+
is_text: boolean;
|
|
2014
|
+
content_text: string | null;
|
|
2015
|
+
content_bytes: Uint8Array | null;
|
|
2016
|
+
}) => BugReportFile;
|
|
2017
|
+
getBugReportFilesByBugReportId: (bugReportId: string) => BugReportFile[];
|
|
1893
2018
|
addAccount: (account: Omit<Account, "account_id" | "is_tscircuit_staff"> & Partial<Pick<Account, "account_id" | "is_tscircuit_staff">>) => {
|
|
1894
2019
|
is_tscircuit_staff: boolean;
|
|
1895
2020
|
github_username: string;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// fake-snippets-api/lib/db/db-client.ts
|
|
2
|
+
import { randomUUID } from "crypto";
|
|
2
3
|
import { hoist } from "zustand-hoist";
|
|
3
4
|
import { createStore } from "zustand/vanilla";
|
|
4
5
|
import { combine } from "zustand/middleware";
|
|
@@ -92,6 +93,29 @@ var orderFileSchema = z.object({
|
|
|
92
93
|
content_text: z.string().nullable(),
|
|
93
94
|
content_bytes: z.instanceof(Uint8Array).nullable()
|
|
94
95
|
});
|
|
96
|
+
var bugReportSchema = z.object({
|
|
97
|
+
bug_report_id: z.string().uuid(),
|
|
98
|
+
reporter_account_id: z.string(),
|
|
99
|
+
text: z.string().nullable(),
|
|
100
|
+
is_auto_deleted: z.boolean().default(false),
|
|
101
|
+
delete_at: z.string().datetime().nullable(),
|
|
102
|
+
created_at: z.string().datetime(),
|
|
103
|
+
file_count: z.number().int()
|
|
104
|
+
});
|
|
105
|
+
var bugReportFileSchema = z.object({
|
|
106
|
+
bug_report_file_id: z.string().uuid(),
|
|
107
|
+
bug_report_id: z.string().uuid(),
|
|
108
|
+
file_path: z.string(),
|
|
109
|
+
content_mimetype: z.string(),
|
|
110
|
+
is_text: z.boolean(),
|
|
111
|
+
created_at: z.string().datetime(),
|
|
112
|
+
content_text: z.string().nullable(),
|
|
113
|
+
content_bytes: z.instanceof(Uint8Array).nullable()
|
|
114
|
+
});
|
|
115
|
+
var bugReportFileResponseSchema = bugReportFileSchema.omit({
|
|
116
|
+
content_text: true,
|
|
117
|
+
content_bytes: true
|
|
118
|
+
});
|
|
95
119
|
var shippingOptionSchema = z.object({
|
|
96
120
|
carrier: z.string(),
|
|
97
121
|
service: z.string(),
|
|
@@ -397,7 +421,9 @@ var databaseSchema = z.object({
|
|
|
397
421
|
aiReviews: z.array(aiReviewSchema).default([]),
|
|
398
422
|
datasheets: z.array(datasheetSchema).default([]),
|
|
399
423
|
githubInstallations: z.array(githubInstallationSchema).default([]),
|
|
400
|
-
packageBuilds: z.array(packageBuildSchema).default([])
|
|
424
|
+
packageBuilds: z.array(packageBuildSchema).default([]),
|
|
425
|
+
bugReports: z.array(bugReportSchema).default([]),
|
|
426
|
+
bugReportFiles: z.array(bugReportFileSchema).default([])
|
|
401
427
|
});
|
|
402
428
|
|
|
403
429
|
// fake-snippets-api/lib/db/autoload-dev-packages.ts
|
|
@@ -2517,6 +2543,69 @@ var initializer = combine(databaseSchema.parse({}), (set, get) => ({
|
|
|
2517
2543
|
const state = get();
|
|
2518
2544
|
return state.orderFiles.find((file) => file.order_file_id === orderFileId);
|
|
2519
2545
|
},
|
|
2546
|
+
addBugReport: ({
|
|
2547
|
+
reporter_account_id,
|
|
2548
|
+
text,
|
|
2549
|
+
is_auto_deleted,
|
|
2550
|
+
delete_at
|
|
2551
|
+
}) => {
|
|
2552
|
+
const normalizedIsAutoDeleted = Boolean(is_auto_deleted);
|
|
2553
|
+
if (normalizedIsAutoDeleted && !delete_at) {
|
|
2554
|
+
throw new Error("delete_at is required when is_auto_deleted is true");
|
|
2555
|
+
}
|
|
2556
|
+
const normalizedDeleteAt = normalizedIsAutoDeleted ? delete_at ?? null : null;
|
|
2557
|
+
const bugReport = bugReportSchema.parse({
|
|
2558
|
+
bug_report_id: randomUUID(),
|
|
2559
|
+
reporter_account_id,
|
|
2560
|
+
text: text ?? null,
|
|
2561
|
+
is_auto_deleted: normalizedIsAutoDeleted,
|
|
2562
|
+
delete_at: normalizedDeleteAt,
|
|
2563
|
+
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2564
|
+
file_count: 0
|
|
2565
|
+
});
|
|
2566
|
+
set((state) => ({
|
|
2567
|
+
bugReports: [...state.bugReports, bugReport]
|
|
2568
|
+
}));
|
|
2569
|
+
return bugReport;
|
|
2570
|
+
},
|
|
2571
|
+
getBugReportById: (bugReportId) => {
|
|
2572
|
+
const state = get();
|
|
2573
|
+
return state.bugReports.find(
|
|
2574
|
+
(bugReport) => bugReport.bug_report_id === bugReportId
|
|
2575
|
+
);
|
|
2576
|
+
},
|
|
2577
|
+
addBugReportFile: ({
|
|
2578
|
+
bug_report_id,
|
|
2579
|
+
file_path,
|
|
2580
|
+
content_mimetype,
|
|
2581
|
+
is_text,
|
|
2582
|
+
content_text,
|
|
2583
|
+
content_bytes
|
|
2584
|
+
}) => {
|
|
2585
|
+
const bugReportFile = bugReportFileSchema.parse({
|
|
2586
|
+
bug_report_file_id: randomUUID(),
|
|
2587
|
+
bug_report_id,
|
|
2588
|
+
file_path,
|
|
2589
|
+
content_mimetype,
|
|
2590
|
+
is_text,
|
|
2591
|
+
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2592
|
+
content_text,
|
|
2593
|
+
content_bytes
|
|
2594
|
+
});
|
|
2595
|
+
set((state) => ({
|
|
2596
|
+
bugReportFiles: [...state.bugReportFiles, bugReportFile],
|
|
2597
|
+
bugReports: state.bugReports.map(
|
|
2598
|
+
(bugReport) => bugReport.bug_report_id === bug_report_id ? { ...bugReport, file_count: bugReport.file_count + 1 } : bugReport
|
|
2599
|
+
)
|
|
2600
|
+
}));
|
|
2601
|
+
return bugReportFile;
|
|
2602
|
+
},
|
|
2603
|
+
getBugReportFilesByBugReportId: (bugReportId) => {
|
|
2604
|
+
const state = get();
|
|
2605
|
+
return state.bugReportFiles.filter(
|
|
2606
|
+
(file) => file.bug_report_id === bugReportId
|
|
2607
|
+
);
|
|
2608
|
+
},
|
|
2520
2609
|
addAccount: (account) => {
|
|
2521
2610
|
const newAccount = {
|
|
2522
2611
|
account_id: account.account_id || `account_${get().idCounter + 1}`,
|
package/dist/schema.d.ts
CHANGED
|
@@ -338,6 +338,85 @@ declare const orderFileSchema: z.ZodObject<{
|
|
|
338
338
|
content_bytes: Uint8Array<ArrayBuffer> | null;
|
|
339
339
|
}>;
|
|
340
340
|
type OrderFile = z.infer<typeof orderFileSchema>;
|
|
341
|
+
declare const bugReportSchema: z.ZodObject<{
|
|
342
|
+
bug_report_id: z.ZodString;
|
|
343
|
+
reporter_account_id: z.ZodString;
|
|
344
|
+
text: z.ZodNullable<z.ZodString>;
|
|
345
|
+
is_auto_deleted: z.ZodDefault<z.ZodBoolean>;
|
|
346
|
+
delete_at: z.ZodNullable<z.ZodString>;
|
|
347
|
+
created_at: z.ZodString;
|
|
348
|
+
file_count: z.ZodNumber;
|
|
349
|
+
}, "strip", z.ZodTypeAny, {
|
|
350
|
+
created_at: string;
|
|
351
|
+
bug_report_id: string;
|
|
352
|
+
reporter_account_id: string;
|
|
353
|
+
text: string | null;
|
|
354
|
+
is_auto_deleted: boolean;
|
|
355
|
+
delete_at: string | null;
|
|
356
|
+
file_count: number;
|
|
357
|
+
}, {
|
|
358
|
+
created_at: string;
|
|
359
|
+
bug_report_id: string;
|
|
360
|
+
reporter_account_id: string;
|
|
361
|
+
text: string | null;
|
|
362
|
+
delete_at: string | null;
|
|
363
|
+
file_count: number;
|
|
364
|
+
is_auto_deleted?: boolean | undefined;
|
|
365
|
+
}>;
|
|
366
|
+
type BugReport = z.infer<typeof bugReportSchema>;
|
|
367
|
+
declare const bugReportFileSchema: z.ZodObject<{
|
|
368
|
+
bug_report_file_id: z.ZodString;
|
|
369
|
+
bug_report_id: z.ZodString;
|
|
370
|
+
file_path: z.ZodString;
|
|
371
|
+
content_mimetype: z.ZodString;
|
|
372
|
+
is_text: z.ZodBoolean;
|
|
373
|
+
created_at: z.ZodString;
|
|
374
|
+
content_text: z.ZodNullable<z.ZodString>;
|
|
375
|
+
content_bytes: z.ZodNullable<z.ZodType<Uint8Array<ArrayBuffer>, z.ZodTypeDef, Uint8Array<ArrayBuffer>>>;
|
|
376
|
+
}, "strip", z.ZodTypeAny, {
|
|
377
|
+
created_at: string;
|
|
378
|
+
content_text: string | null;
|
|
379
|
+
content_bytes: Uint8Array<ArrayBuffer> | null;
|
|
380
|
+
bug_report_id: string;
|
|
381
|
+
bug_report_file_id: string;
|
|
382
|
+
file_path: string;
|
|
383
|
+
content_mimetype: string;
|
|
384
|
+
is_text: boolean;
|
|
385
|
+
}, {
|
|
386
|
+
created_at: string;
|
|
387
|
+
content_text: string | null;
|
|
388
|
+
content_bytes: Uint8Array<ArrayBuffer> | null;
|
|
389
|
+
bug_report_id: string;
|
|
390
|
+
bug_report_file_id: string;
|
|
391
|
+
file_path: string;
|
|
392
|
+
content_mimetype: string;
|
|
393
|
+
is_text: boolean;
|
|
394
|
+
}>;
|
|
395
|
+
declare const bugReportFileResponseSchema: z.ZodObject<Omit<{
|
|
396
|
+
bug_report_file_id: z.ZodString;
|
|
397
|
+
bug_report_id: z.ZodString;
|
|
398
|
+
file_path: z.ZodString;
|
|
399
|
+
content_mimetype: z.ZodString;
|
|
400
|
+
is_text: z.ZodBoolean;
|
|
401
|
+
created_at: z.ZodString;
|
|
402
|
+
content_text: z.ZodNullable<z.ZodString>;
|
|
403
|
+
content_bytes: z.ZodNullable<z.ZodType<Uint8Array<ArrayBuffer>, z.ZodTypeDef, Uint8Array<ArrayBuffer>>>;
|
|
404
|
+
}, "content_text" | "content_bytes">, "strip", z.ZodTypeAny, {
|
|
405
|
+
created_at: string;
|
|
406
|
+
bug_report_id: string;
|
|
407
|
+
bug_report_file_id: string;
|
|
408
|
+
file_path: string;
|
|
409
|
+
content_mimetype: string;
|
|
410
|
+
is_text: boolean;
|
|
411
|
+
}, {
|
|
412
|
+
created_at: string;
|
|
413
|
+
bug_report_id: string;
|
|
414
|
+
bug_report_file_id: string;
|
|
415
|
+
file_path: string;
|
|
416
|
+
content_mimetype: string;
|
|
417
|
+
is_text: boolean;
|
|
418
|
+
}>;
|
|
419
|
+
type BugReportFile = z.infer<typeof bugReportFileSchema>;
|
|
341
420
|
declare const shippingOptionSchema: z.ZodObject<{
|
|
342
421
|
carrier: z.ZodString;
|
|
343
422
|
service: z.ZodString;
|
|
@@ -830,8 +909,8 @@ declare const packageFileSchema: z.ZodObject<{
|
|
|
830
909
|
}, "strip", z.ZodTypeAny, {
|
|
831
910
|
package_release_id: string;
|
|
832
911
|
created_at: string;
|
|
833
|
-
package_file_id: string;
|
|
834
912
|
file_path: string;
|
|
913
|
+
package_file_id: string;
|
|
835
914
|
content_text?: string | null | undefined;
|
|
836
915
|
content_mimetype?: string | null | undefined;
|
|
837
916
|
is_release_tarball?: boolean | undefined;
|
|
@@ -839,8 +918,8 @@ declare const packageFileSchema: z.ZodObject<{
|
|
|
839
918
|
}, {
|
|
840
919
|
package_release_id: string;
|
|
841
920
|
created_at: string;
|
|
842
|
-
package_file_id: string;
|
|
843
921
|
file_path: string;
|
|
922
|
+
package_file_id: string;
|
|
844
923
|
content_text?: string | null | undefined;
|
|
845
924
|
content_mimetype?: string | null | undefined;
|
|
846
925
|
is_release_tarball?: boolean | undefined;
|
|
@@ -1482,8 +1561,8 @@ declare const databaseSchema: z.ZodObject<{
|
|
|
1482
1561
|
}, "strip", z.ZodTypeAny, {
|
|
1483
1562
|
package_release_id: string;
|
|
1484
1563
|
created_at: string;
|
|
1485
|
-
package_file_id: string;
|
|
1486
1564
|
file_path: string;
|
|
1565
|
+
package_file_id: string;
|
|
1487
1566
|
content_text?: string | null | undefined;
|
|
1488
1567
|
content_mimetype?: string | null | undefined;
|
|
1489
1568
|
is_release_tarball?: boolean | undefined;
|
|
@@ -1491,8 +1570,8 @@ declare const databaseSchema: z.ZodObject<{
|
|
|
1491
1570
|
}, {
|
|
1492
1571
|
package_release_id: string;
|
|
1493
1572
|
created_at: string;
|
|
1494
|
-
package_file_id: string;
|
|
1495
1573
|
file_path: string;
|
|
1574
|
+
package_file_id: string;
|
|
1496
1575
|
content_text?: string | null | undefined;
|
|
1497
1576
|
content_mimetype?: string | null | undefined;
|
|
1498
1577
|
is_release_tarball?: boolean | undefined;
|
|
@@ -2286,6 +2365,59 @@ declare const databaseSchema: z.ZodObject<{
|
|
|
2286
2365
|
preview_url?: string | null | undefined;
|
|
2287
2366
|
build_logs?: string | null | undefined;
|
|
2288
2367
|
}>, "many">>;
|
|
2368
|
+
bugReports: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
2369
|
+
bug_report_id: z.ZodString;
|
|
2370
|
+
reporter_account_id: z.ZodString;
|
|
2371
|
+
text: z.ZodNullable<z.ZodString>;
|
|
2372
|
+
is_auto_deleted: z.ZodDefault<z.ZodBoolean>;
|
|
2373
|
+
delete_at: z.ZodNullable<z.ZodString>;
|
|
2374
|
+
created_at: z.ZodString;
|
|
2375
|
+
file_count: z.ZodNumber;
|
|
2376
|
+
}, "strip", z.ZodTypeAny, {
|
|
2377
|
+
created_at: string;
|
|
2378
|
+
bug_report_id: string;
|
|
2379
|
+
reporter_account_id: string;
|
|
2380
|
+
text: string | null;
|
|
2381
|
+
is_auto_deleted: boolean;
|
|
2382
|
+
delete_at: string | null;
|
|
2383
|
+
file_count: number;
|
|
2384
|
+
}, {
|
|
2385
|
+
created_at: string;
|
|
2386
|
+
bug_report_id: string;
|
|
2387
|
+
reporter_account_id: string;
|
|
2388
|
+
text: string | null;
|
|
2389
|
+
delete_at: string | null;
|
|
2390
|
+
file_count: number;
|
|
2391
|
+
is_auto_deleted?: boolean | undefined;
|
|
2392
|
+
}>, "many">>;
|
|
2393
|
+
bugReportFiles: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
2394
|
+
bug_report_file_id: z.ZodString;
|
|
2395
|
+
bug_report_id: z.ZodString;
|
|
2396
|
+
file_path: z.ZodString;
|
|
2397
|
+
content_mimetype: z.ZodString;
|
|
2398
|
+
is_text: z.ZodBoolean;
|
|
2399
|
+
created_at: z.ZodString;
|
|
2400
|
+
content_text: z.ZodNullable<z.ZodString>;
|
|
2401
|
+
content_bytes: z.ZodNullable<z.ZodType<Uint8Array<ArrayBuffer>, z.ZodTypeDef, Uint8Array<ArrayBuffer>>>;
|
|
2402
|
+
}, "strip", z.ZodTypeAny, {
|
|
2403
|
+
created_at: string;
|
|
2404
|
+
content_text: string | null;
|
|
2405
|
+
content_bytes: Uint8Array<ArrayBuffer> | null;
|
|
2406
|
+
bug_report_id: string;
|
|
2407
|
+
bug_report_file_id: string;
|
|
2408
|
+
file_path: string;
|
|
2409
|
+
content_mimetype: string;
|
|
2410
|
+
is_text: boolean;
|
|
2411
|
+
}, {
|
|
2412
|
+
created_at: string;
|
|
2413
|
+
content_text: string | null;
|
|
2414
|
+
content_bytes: Uint8Array<ArrayBuffer> | null;
|
|
2415
|
+
bug_report_id: string;
|
|
2416
|
+
bug_report_file_id: string;
|
|
2417
|
+
file_path: string;
|
|
2418
|
+
content_mimetype: string;
|
|
2419
|
+
is_text: boolean;
|
|
2420
|
+
}>, "many">>;
|
|
2289
2421
|
}, "strip", z.ZodTypeAny, {
|
|
2290
2422
|
idCounter: number;
|
|
2291
2423
|
snippets: {
|
|
@@ -2367,8 +2499,8 @@ declare const databaseSchema: z.ZodObject<{
|
|
|
2367
2499
|
packageFiles: {
|
|
2368
2500
|
package_release_id: string;
|
|
2369
2501
|
created_at: string;
|
|
2370
|
-
package_file_id: string;
|
|
2371
2502
|
file_path: string;
|
|
2503
|
+
package_file_id: string;
|
|
2372
2504
|
content_text?: string | null | undefined;
|
|
2373
2505
|
content_mimetype?: string | null | undefined;
|
|
2374
2506
|
is_release_tarball?: boolean | undefined;
|
|
@@ -2626,6 +2758,25 @@ declare const databaseSchema: z.ZodObject<{
|
|
|
2626
2758
|
preview_url?: string | null | undefined;
|
|
2627
2759
|
build_logs?: string | null | undefined;
|
|
2628
2760
|
}[];
|
|
2761
|
+
bugReports: {
|
|
2762
|
+
created_at: string;
|
|
2763
|
+
bug_report_id: string;
|
|
2764
|
+
reporter_account_id: string;
|
|
2765
|
+
text: string | null;
|
|
2766
|
+
is_auto_deleted: boolean;
|
|
2767
|
+
delete_at: string | null;
|
|
2768
|
+
file_count: number;
|
|
2769
|
+
}[];
|
|
2770
|
+
bugReportFiles: {
|
|
2771
|
+
created_at: string;
|
|
2772
|
+
content_text: string | null;
|
|
2773
|
+
content_bytes: Uint8Array<ArrayBuffer> | null;
|
|
2774
|
+
bug_report_id: string;
|
|
2775
|
+
bug_report_file_id: string;
|
|
2776
|
+
file_path: string;
|
|
2777
|
+
content_mimetype: string;
|
|
2778
|
+
is_text: boolean;
|
|
2779
|
+
}[];
|
|
2629
2780
|
}, {
|
|
2630
2781
|
idCounter?: number | undefined;
|
|
2631
2782
|
snippets?: {
|
|
@@ -2707,8 +2858,8 @@ declare const databaseSchema: z.ZodObject<{
|
|
|
2707
2858
|
packageFiles?: {
|
|
2708
2859
|
package_release_id: string;
|
|
2709
2860
|
created_at: string;
|
|
2710
|
-
package_file_id: string;
|
|
2711
2861
|
file_path: string;
|
|
2862
|
+
package_file_id: string;
|
|
2712
2863
|
content_text?: string | null | undefined;
|
|
2713
2864
|
content_mimetype?: string | null | undefined;
|
|
2714
2865
|
is_release_tarball?: boolean | undefined;
|
|
@@ -2966,7 +3117,26 @@ declare const databaseSchema: z.ZodObject<{
|
|
|
2966
3117
|
preview_url?: string | null | undefined;
|
|
2967
3118
|
build_logs?: string | null | undefined;
|
|
2968
3119
|
}[] | undefined;
|
|
3120
|
+
bugReports?: {
|
|
3121
|
+
created_at: string;
|
|
3122
|
+
bug_report_id: string;
|
|
3123
|
+
reporter_account_id: string;
|
|
3124
|
+
text: string | null;
|
|
3125
|
+
delete_at: string | null;
|
|
3126
|
+
file_count: number;
|
|
3127
|
+
is_auto_deleted?: boolean | undefined;
|
|
3128
|
+
}[] | undefined;
|
|
3129
|
+
bugReportFiles?: {
|
|
3130
|
+
created_at: string;
|
|
3131
|
+
content_text: string | null;
|
|
3132
|
+
content_bytes: Uint8Array<ArrayBuffer> | null;
|
|
3133
|
+
bug_report_id: string;
|
|
3134
|
+
bug_report_file_id: string;
|
|
3135
|
+
file_path: string;
|
|
3136
|
+
content_mimetype: string;
|
|
3137
|
+
is_text: boolean;
|
|
3138
|
+
}[] | undefined;
|
|
2969
3139
|
}>;
|
|
2970
3140
|
type DatabaseSchema = z.infer<typeof databaseSchema>;
|
|
2971
3141
|
|
|
2972
|
-
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 OrgAccount, type Organization, type Package, type PackageBuild, type PackageFile, type PackageRelease, type PublicOrgSchema, type QuotedComponent, type Session, type ShippingOption, type Snippet, type UserPermissions, accountPackageSchema, accountSchema, accountSnippetSchema, aiReviewSchema, databaseSchema, datasheetPinInformationSchema, datasheetSchema, errorResponseSchema, errorSchema, githubInstallationSchema, jlcpcbOrderStateSchema, jlcpcbOrderStepRunSchema, loginPageSchema, orderFileSchema, orderQuoteSchema, orderSchema, orgAccountSchema, orgSchema, packageBuildSchema, packageFileSchema, packageReleaseSchema, packageSchema, publicOrgSchema, quotedComponentSchema, sessionSchema, shippingInfoSchema, snippetSchema, userPermissionsSchema };
|
|
3142
|
+
export { type Account, type AccountPackage, type AccountSnippet, type AiReview, type BugReport, type BugReportFile, type DatabaseSchema, type Datasheet, type GithubInstallation, type JlcpcbOrderState, type JlcpcbOrderStepRun, type LoginPage, type Order, type OrderFile, type OrderQuote, type OrgAccount, type Organization, type Package, type PackageBuild, type PackageFile, type PackageRelease, type PublicOrgSchema, type QuotedComponent, type Session, type ShippingOption, type Snippet, type UserPermissions, accountPackageSchema, accountSchema, accountSnippetSchema, aiReviewSchema, bugReportFileResponseSchema, bugReportFileSchema, bugReportSchema, databaseSchema, datasheetPinInformationSchema, datasheetSchema, errorResponseSchema, errorSchema, githubInstallationSchema, jlcpcbOrderStateSchema, jlcpcbOrderStepRunSchema, loginPageSchema, orderFileSchema, orderQuoteSchema, orderSchema, orgAccountSchema, orgSchema, packageBuildSchema, packageFileSchema, packageReleaseSchema, packageSchema, publicOrgSchema, quotedComponentSchema, sessionSchema, shippingInfoSchema, snippetSchema, userPermissionsSchema };
|
package/dist/schema.js
CHANGED
|
@@ -87,6 +87,29 @@ var orderFileSchema = z.object({
|
|
|
87
87
|
content_text: z.string().nullable(),
|
|
88
88
|
content_bytes: z.instanceof(Uint8Array).nullable()
|
|
89
89
|
});
|
|
90
|
+
var bugReportSchema = z.object({
|
|
91
|
+
bug_report_id: z.string().uuid(),
|
|
92
|
+
reporter_account_id: z.string(),
|
|
93
|
+
text: z.string().nullable(),
|
|
94
|
+
is_auto_deleted: z.boolean().default(false),
|
|
95
|
+
delete_at: z.string().datetime().nullable(),
|
|
96
|
+
created_at: z.string().datetime(),
|
|
97
|
+
file_count: z.number().int()
|
|
98
|
+
});
|
|
99
|
+
var bugReportFileSchema = z.object({
|
|
100
|
+
bug_report_file_id: z.string().uuid(),
|
|
101
|
+
bug_report_id: z.string().uuid(),
|
|
102
|
+
file_path: z.string(),
|
|
103
|
+
content_mimetype: z.string(),
|
|
104
|
+
is_text: z.boolean(),
|
|
105
|
+
created_at: z.string().datetime(),
|
|
106
|
+
content_text: z.string().nullable(),
|
|
107
|
+
content_bytes: z.instanceof(Uint8Array).nullable()
|
|
108
|
+
});
|
|
109
|
+
var bugReportFileResponseSchema = bugReportFileSchema.omit({
|
|
110
|
+
content_text: true,
|
|
111
|
+
content_bytes: true
|
|
112
|
+
});
|
|
90
113
|
var shippingOptionSchema = z.object({
|
|
91
114
|
carrier: z.string(),
|
|
92
115
|
service: z.string(),
|
|
@@ -392,13 +415,18 @@ var databaseSchema = z.object({
|
|
|
392
415
|
aiReviews: z.array(aiReviewSchema).default([]),
|
|
393
416
|
datasheets: z.array(datasheetSchema).default([]),
|
|
394
417
|
githubInstallations: z.array(githubInstallationSchema).default([]),
|
|
395
|
-
packageBuilds: z.array(packageBuildSchema).default([])
|
|
418
|
+
packageBuilds: z.array(packageBuildSchema).default([]),
|
|
419
|
+
bugReports: z.array(bugReportSchema).default([]),
|
|
420
|
+
bugReportFiles: z.array(bugReportFileSchema).default([])
|
|
396
421
|
});
|
|
397
422
|
export {
|
|
398
423
|
accountPackageSchema,
|
|
399
424
|
accountSchema,
|
|
400
425
|
accountSnippetSchema,
|
|
401
426
|
aiReviewSchema,
|
|
427
|
+
bugReportFileResponseSchema,
|
|
428
|
+
bugReportFileSchema,
|
|
429
|
+
bugReportSchema,
|
|
402
430
|
databaseSchema,
|
|
403
431
|
datasheetPinInformationSchema,
|
|
404
432
|
datasheetSchema,
|