@tscircuit/fake-snippets 0.0.149 → 0.0.151
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/dist/bundle.js +872 -409
- package/dist/index.d.ts +145 -19
- package/dist/index.js +83 -4
- package/dist/schema.d.ts +191 -25
- package/dist/schema.js +29 -4
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -988,17 +988,17 @@ declare const packageBuildSchema: z.ZodObject<{
|
|
|
988
988
|
transpilation_in_progress: z.ZodDefault<z.ZodBoolean>;
|
|
989
989
|
transpilation_started_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
990
990
|
transpilation_completed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
991
|
-
transpilation_logs: z.
|
|
991
|
+
transpilation_logs: z.ZodNullable<z.ZodArray<z.ZodAny, "many">>;
|
|
992
992
|
transpilation_error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
993
993
|
circuit_json_build_in_progress: z.ZodDefault<z.ZodBoolean>;
|
|
994
994
|
circuit_json_build_started_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
995
995
|
circuit_json_build_completed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
996
|
-
circuit_json_build_logs: z.
|
|
996
|
+
circuit_json_build_logs: z.ZodNullable<z.ZodArray<z.ZodAny, "many">>;
|
|
997
997
|
circuit_json_build_error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
998
998
|
image_generation_in_progress: z.ZodDefault<z.ZodBoolean>;
|
|
999
999
|
image_generation_started_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1000
1000
|
image_generation_completed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1001
|
-
image_generation_logs: z.
|
|
1001
|
+
image_generation_logs: z.ZodNullable<z.ZodArray<z.ZodAny, "many">>;
|
|
1002
1002
|
image_generation_error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1003
1003
|
build_in_progress: z.ZodDefault<z.ZodBoolean>;
|
|
1004
1004
|
build_started_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -1007,15 +1007,21 @@ declare const packageBuildSchema: z.ZodObject<{
|
|
|
1007
1007
|
build_error_last_updated_at: z.ZodString;
|
|
1008
1008
|
preview_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1009
1009
|
build_logs: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1010
|
+
user_code_started_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1011
|
+
user_code_completed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1012
|
+
user_code_error: z.ZodOptional<z.ZodNullable<z.ZodAny>>;
|
|
1013
|
+
user_code_build_logs: z.ZodNullable<z.ZodArray<z.ZodAny, "many">>;
|
|
1014
|
+
user_code_log_stream_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1010
1015
|
}, "strip", z.ZodTypeAny, {
|
|
1011
1016
|
package_release_id: string;
|
|
1012
1017
|
created_at: string;
|
|
1013
1018
|
transpilation_in_progress: boolean;
|
|
1014
|
-
transpilation_logs: any[];
|
|
1019
|
+
transpilation_logs: any[] | null;
|
|
1020
|
+
user_code_build_logs: any[] | null;
|
|
1015
1021
|
circuit_json_build_in_progress: boolean;
|
|
1016
|
-
circuit_json_build_logs: any[];
|
|
1022
|
+
circuit_json_build_logs: any[] | null;
|
|
1017
1023
|
image_generation_in_progress: boolean;
|
|
1018
|
-
image_generation_logs: any[];
|
|
1024
|
+
image_generation_logs: any[] | null;
|
|
1019
1025
|
package_build_id: string;
|
|
1020
1026
|
build_in_progress: boolean;
|
|
1021
1027
|
build_error_last_updated_at: string;
|
|
@@ -1023,6 +1029,10 @@ declare const packageBuildSchema: z.ZodObject<{
|
|
|
1023
1029
|
transpilation_error?: string | null | undefined;
|
|
1024
1030
|
transpilation_started_at?: string | null | undefined;
|
|
1025
1031
|
transpilation_completed_at?: string | null | undefined;
|
|
1032
|
+
user_code_started_at?: string | null | undefined;
|
|
1033
|
+
user_code_completed_at?: string | null | undefined;
|
|
1034
|
+
user_code_error?: any;
|
|
1035
|
+
user_code_log_stream_url?: string | null | undefined;
|
|
1026
1036
|
circuit_json_build_started_at?: string | null | undefined;
|
|
1027
1037
|
circuit_json_build_completed_at?: string | null | undefined;
|
|
1028
1038
|
image_generation_started_at?: string | null | undefined;
|
|
@@ -1036,6 +1046,10 @@ declare const packageBuildSchema: z.ZodObject<{
|
|
|
1036
1046
|
}, {
|
|
1037
1047
|
package_release_id: string;
|
|
1038
1048
|
created_at: string;
|
|
1049
|
+
transpilation_logs: any[] | null;
|
|
1050
|
+
user_code_build_logs: any[] | null;
|
|
1051
|
+
circuit_json_build_logs: any[] | null;
|
|
1052
|
+
image_generation_logs: any[] | null;
|
|
1039
1053
|
package_build_id: string;
|
|
1040
1054
|
build_error_last_updated_at: string;
|
|
1041
1055
|
circuit_json_build_error?: string | null | undefined;
|
|
@@ -1043,15 +1057,16 @@ declare const packageBuildSchema: z.ZodObject<{
|
|
|
1043
1057
|
transpilation_in_progress?: boolean | undefined;
|
|
1044
1058
|
transpilation_started_at?: string | null | undefined;
|
|
1045
1059
|
transpilation_completed_at?: string | null | undefined;
|
|
1046
|
-
|
|
1060
|
+
user_code_started_at?: string | null | undefined;
|
|
1061
|
+
user_code_completed_at?: string | null | undefined;
|
|
1062
|
+
user_code_error?: any;
|
|
1063
|
+
user_code_log_stream_url?: string | null | undefined;
|
|
1047
1064
|
circuit_json_build_in_progress?: boolean | undefined;
|
|
1048
1065
|
circuit_json_build_started_at?: string | null | undefined;
|
|
1049
1066
|
circuit_json_build_completed_at?: string | null | undefined;
|
|
1050
|
-
circuit_json_build_logs?: any[] | undefined;
|
|
1051
1067
|
image_generation_in_progress?: boolean | undefined;
|
|
1052
1068
|
image_generation_started_at?: string | null | undefined;
|
|
1053
1069
|
image_generation_completed_at?: string | null | undefined;
|
|
1054
|
-
image_generation_logs?: any[] | undefined;
|
|
1055
1070
|
image_generation_error?: string | null | undefined;
|
|
1056
1071
|
build_in_progress?: boolean | undefined;
|
|
1057
1072
|
build_started_at?: string | null | undefined;
|
|
@@ -1110,6 +1125,53 @@ declare const orgAccountSchema: z.ZodObject<{
|
|
|
1110
1125
|
can_manage_org?: boolean | undefined;
|
|
1111
1126
|
}>;
|
|
1112
1127
|
type OrgAccount = z.infer<typeof orgAccountSchema>;
|
|
1128
|
+
declare const orgInvitationSchema: z.ZodObject<{
|
|
1129
|
+
org_invitation_id: z.ZodString;
|
|
1130
|
+
org_id: z.ZodString;
|
|
1131
|
+
invitee_email: z.ZodNullable<z.ZodString>;
|
|
1132
|
+
inviter_account_id: z.ZodString;
|
|
1133
|
+
invitation_token: z.ZodString;
|
|
1134
|
+
is_link_invite: z.ZodDefault<z.ZodBoolean>;
|
|
1135
|
+
is_pending: z.ZodDefault<z.ZodBoolean>;
|
|
1136
|
+
is_accepted: z.ZodDefault<z.ZodBoolean>;
|
|
1137
|
+
is_expired: z.ZodDefault<z.ZodBoolean>;
|
|
1138
|
+
is_revoked: z.ZodDefault<z.ZodBoolean>;
|
|
1139
|
+
created_at: z.ZodString;
|
|
1140
|
+
expires_at: z.ZodString;
|
|
1141
|
+
accepted_at: z.ZodNullable<z.ZodString>;
|
|
1142
|
+
accepted_by_account_id: z.ZodNullable<z.ZodString>;
|
|
1143
|
+
}, "strip", z.ZodTypeAny, {
|
|
1144
|
+
created_at: string;
|
|
1145
|
+
expires_at: string;
|
|
1146
|
+
org_id: string;
|
|
1147
|
+
org_invitation_id: string;
|
|
1148
|
+
invitee_email: string | null;
|
|
1149
|
+
inviter_account_id: string;
|
|
1150
|
+
invitation_token: string;
|
|
1151
|
+
is_link_invite: boolean;
|
|
1152
|
+
is_pending: boolean;
|
|
1153
|
+
is_accepted: boolean;
|
|
1154
|
+
is_expired: boolean;
|
|
1155
|
+
is_revoked: boolean;
|
|
1156
|
+
accepted_at: string | null;
|
|
1157
|
+
accepted_by_account_id: string | null;
|
|
1158
|
+
}, {
|
|
1159
|
+
created_at: string;
|
|
1160
|
+
expires_at: string;
|
|
1161
|
+
org_id: string;
|
|
1162
|
+
org_invitation_id: string;
|
|
1163
|
+
invitee_email: string | null;
|
|
1164
|
+
inviter_account_id: string;
|
|
1165
|
+
invitation_token: string;
|
|
1166
|
+
accepted_at: string | null;
|
|
1167
|
+
accepted_by_account_id: string | null;
|
|
1168
|
+
is_link_invite?: boolean | undefined;
|
|
1169
|
+
is_pending?: boolean | undefined;
|
|
1170
|
+
is_accepted?: boolean | undefined;
|
|
1171
|
+
is_expired?: boolean | undefined;
|
|
1172
|
+
is_revoked?: boolean | undefined;
|
|
1173
|
+
}>;
|
|
1174
|
+
type OrgInvitation = z.infer<typeof orgInvitationSchema>;
|
|
1113
1175
|
declare const userPermissionsSchema: z.ZodObject<{
|
|
1114
1176
|
can_manage_org: z.ZodOptional<z.ZodBoolean>;
|
|
1115
1177
|
can_manage_package: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1326,6 +1388,22 @@ declare const createDatabase: ({ seed }?: {
|
|
|
1326
1388
|
is_owner: boolean;
|
|
1327
1389
|
can_manage_org: boolean;
|
|
1328
1390
|
}[];
|
|
1391
|
+
orgInvitations: {
|
|
1392
|
+
created_at: string;
|
|
1393
|
+
expires_at: string;
|
|
1394
|
+
org_id: string;
|
|
1395
|
+
org_invitation_id: string;
|
|
1396
|
+
invitee_email: string | null;
|
|
1397
|
+
inviter_account_id: string;
|
|
1398
|
+
invitation_token: string;
|
|
1399
|
+
is_link_invite: boolean;
|
|
1400
|
+
is_pending: boolean;
|
|
1401
|
+
is_accepted: boolean;
|
|
1402
|
+
is_expired: boolean;
|
|
1403
|
+
is_revoked: boolean;
|
|
1404
|
+
accepted_at: string | null;
|
|
1405
|
+
accepted_by_account_id: string | null;
|
|
1406
|
+
}[];
|
|
1329
1407
|
orderFiles: {
|
|
1330
1408
|
order_id: string;
|
|
1331
1409
|
order_file_id: string;
|
|
@@ -1454,11 +1532,12 @@ declare const createDatabase: ({ seed }?: {
|
|
|
1454
1532
|
package_release_id: string;
|
|
1455
1533
|
created_at: string;
|
|
1456
1534
|
transpilation_in_progress: boolean;
|
|
1457
|
-
transpilation_logs: any[];
|
|
1535
|
+
transpilation_logs: any[] | null;
|
|
1536
|
+
user_code_build_logs: any[] | null;
|
|
1458
1537
|
circuit_json_build_in_progress: boolean;
|
|
1459
|
-
circuit_json_build_logs: any[];
|
|
1538
|
+
circuit_json_build_logs: any[] | null;
|
|
1460
1539
|
image_generation_in_progress: boolean;
|
|
1461
|
-
image_generation_logs: any[];
|
|
1540
|
+
image_generation_logs: any[] | null;
|
|
1462
1541
|
package_build_id: string;
|
|
1463
1542
|
build_in_progress: boolean;
|
|
1464
1543
|
build_error_last_updated_at: string;
|
|
@@ -1466,6 +1545,10 @@ declare const createDatabase: ({ seed }?: {
|
|
|
1466
1545
|
transpilation_error?: string | null | undefined;
|
|
1467
1546
|
transpilation_started_at?: string | null | undefined;
|
|
1468
1547
|
transpilation_completed_at?: string | null | undefined;
|
|
1548
|
+
user_code_started_at?: string | null | undefined;
|
|
1549
|
+
user_code_completed_at?: string | null | undefined;
|
|
1550
|
+
user_code_error?: any;
|
|
1551
|
+
user_code_log_stream_url?: string | null | undefined;
|
|
1469
1552
|
circuit_json_build_started_at?: string | null | undefined;
|
|
1470
1553
|
circuit_json_build_completed_at?: string | null | undefined;
|
|
1471
1554
|
image_generation_started_at?: string | null | undefined;
|
|
@@ -1496,7 +1579,7 @@ declare const createDatabase: ({ seed }?: {
|
|
|
1496
1579
|
content_mimetype: string;
|
|
1497
1580
|
is_text: boolean;
|
|
1498
1581
|
}[];
|
|
1499
|
-
}, "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" | "deleteSession" | "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" | "updateOrganizationAccount" | "updateOrganization" | "deleteOrganization" | "deleteAccount"> & {
|
|
1582
|
+
}, "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" | "deleteSession" | "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" | "updateOrganizationAccount" | "updateOrganization" | "deleteOrganization" | "deleteAccount" | "addOrgInvitation" | "getOrgInvitationByToken" | "listOrgInvitations" | "updateOrgInvitation"> & {
|
|
1500
1583
|
addOrder: (order: Omit<Order, "order_id">) => Order;
|
|
1501
1584
|
getOrderById: (orderId: string) => Order | undefined;
|
|
1502
1585
|
getOrderFilesByOrderId: (orderId: string) => OrderFile[];
|
|
@@ -1617,7 +1700,9 @@ declare const createDatabase: ({ seed }?: {
|
|
|
1617
1700
|
is_popular?: boolean;
|
|
1618
1701
|
}) => Datasheet[];
|
|
1619
1702
|
updateDatasheet: (datasheetId: string, updates: Partial<Datasheet>) => Datasheet | undefined;
|
|
1620
|
-
addPackageBuild: (packageBuild: Omit<z.input<typeof packageBuildSchema>, "package_build_id"
|
|
1703
|
+
addPackageBuild: (packageBuild: Partial<Omit<z.input<typeof packageBuildSchema>, "package_build_id">> & {
|
|
1704
|
+
package_release_id: string;
|
|
1705
|
+
}) => PackageBuild;
|
|
1621
1706
|
getPackageBuildById: (packageBuildId: string) => PackageBuild | undefined;
|
|
1622
1707
|
getPackageBuildsByReleaseId: (packageReleaseId: string) => PackageBuild[];
|
|
1623
1708
|
updatePackageBuild: (packageBuildId: string, updates: Partial<PackageBuild>) => PackageBuild | undefined;
|
|
@@ -1707,6 +1792,15 @@ declare const createDatabase: ({ seed }?: {
|
|
|
1707
1792
|
updateOrganization: (orgId: string, updates: Partial<Organization>) => Organization | undefined;
|
|
1708
1793
|
deleteOrganization: (orgId: string) => boolean;
|
|
1709
1794
|
deleteAccount: (accountId: string) => boolean;
|
|
1795
|
+
addOrgInvitation: (invitation: {
|
|
1796
|
+
org_id: string;
|
|
1797
|
+
invitee_email: string;
|
|
1798
|
+
inviter_account_id: string;
|
|
1799
|
+
invitation_token: string;
|
|
1800
|
+
}) => OrgInvitation;
|
|
1801
|
+
getOrgInvitationByToken: (token: string) => OrgInvitation | undefined;
|
|
1802
|
+
listOrgInvitations: (orgId: string) => OrgInvitation[];
|
|
1803
|
+
updateOrgInvitation: (invitationId: string, updates: Partial<OrgInvitation>) => OrgInvitation | undefined;
|
|
1710
1804
|
}> & Omit<{
|
|
1711
1805
|
idCounter: number;
|
|
1712
1806
|
snippets: {
|
|
@@ -1909,6 +2003,22 @@ declare const createDatabase: ({ seed }?: {
|
|
|
1909
2003
|
is_owner: boolean;
|
|
1910
2004
|
can_manage_org: boolean;
|
|
1911
2005
|
}[];
|
|
2006
|
+
orgInvitations: {
|
|
2007
|
+
created_at: string;
|
|
2008
|
+
expires_at: string;
|
|
2009
|
+
org_id: string;
|
|
2010
|
+
org_invitation_id: string;
|
|
2011
|
+
invitee_email: string | null;
|
|
2012
|
+
inviter_account_id: string;
|
|
2013
|
+
invitation_token: string;
|
|
2014
|
+
is_link_invite: boolean;
|
|
2015
|
+
is_pending: boolean;
|
|
2016
|
+
is_accepted: boolean;
|
|
2017
|
+
is_expired: boolean;
|
|
2018
|
+
is_revoked: boolean;
|
|
2019
|
+
accepted_at: string | null;
|
|
2020
|
+
accepted_by_account_id: string | null;
|
|
2021
|
+
}[];
|
|
1912
2022
|
orderFiles: {
|
|
1913
2023
|
order_id: string;
|
|
1914
2024
|
order_file_id: string;
|
|
@@ -2037,11 +2147,12 @@ declare const createDatabase: ({ seed }?: {
|
|
|
2037
2147
|
package_release_id: string;
|
|
2038
2148
|
created_at: string;
|
|
2039
2149
|
transpilation_in_progress: boolean;
|
|
2040
|
-
transpilation_logs: any[];
|
|
2150
|
+
transpilation_logs: any[] | null;
|
|
2151
|
+
user_code_build_logs: any[] | null;
|
|
2041
2152
|
circuit_json_build_in_progress: boolean;
|
|
2042
|
-
circuit_json_build_logs: any[];
|
|
2153
|
+
circuit_json_build_logs: any[] | null;
|
|
2043
2154
|
image_generation_in_progress: boolean;
|
|
2044
|
-
image_generation_logs: any[];
|
|
2155
|
+
image_generation_logs: any[] | null;
|
|
2045
2156
|
package_build_id: string;
|
|
2046
2157
|
build_in_progress: boolean;
|
|
2047
2158
|
build_error_last_updated_at: string;
|
|
@@ -2049,6 +2160,10 @@ declare const createDatabase: ({ seed }?: {
|
|
|
2049
2160
|
transpilation_error?: string | null | undefined;
|
|
2050
2161
|
transpilation_started_at?: string | null | undefined;
|
|
2051
2162
|
transpilation_completed_at?: string | null | undefined;
|
|
2163
|
+
user_code_started_at?: string | null | undefined;
|
|
2164
|
+
user_code_completed_at?: string | null | undefined;
|
|
2165
|
+
user_code_error?: any;
|
|
2166
|
+
user_code_log_stream_url?: string | null | undefined;
|
|
2052
2167
|
circuit_json_build_started_at?: string | null | undefined;
|
|
2053
2168
|
circuit_json_build_completed_at?: string | null | undefined;
|
|
2054
2169
|
image_generation_started_at?: string | null | undefined;
|
|
@@ -2079,7 +2194,7 @@ declare const createDatabase: ({ seed }?: {
|
|
|
2079
2194
|
content_mimetype: string;
|
|
2080
2195
|
is_text: boolean;
|
|
2081
2196
|
}[];
|
|
2082
|
-
}, "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" | "deleteSession" | "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" | "updateOrganizationAccount" | "updateOrganization" | "deleteOrganization" | "deleteAccount"> & {
|
|
2197
|
+
}, "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" | "deleteSession" | "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" | "updateOrganizationAccount" | "updateOrganization" | "deleteOrganization" | "deleteAccount" | "addOrgInvitation" | "getOrgInvitationByToken" | "listOrgInvitations" | "updateOrgInvitation"> & {
|
|
2083
2198
|
addOrder: (order: Omit<Order, "order_id">) => Order;
|
|
2084
2199
|
getOrderById: (orderId: string) => Order | undefined;
|
|
2085
2200
|
getOrderFilesByOrderId: (orderId: string) => OrderFile[];
|
|
@@ -2200,7 +2315,9 @@ declare const createDatabase: ({ seed }?: {
|
|
|
2200
2315
|
is_popular?: boolean;
|
|
2201
2316
|
}) => Datasheet[];
|
|
2202
2317
|
updateDatasheet: (datasheetId: string, updates: Partial<Datasheet>) => Datasheet | undefined;
|
|
2203
|
-
addPackageBuild: (packageBuild: Omit<z.input<typeof packageBuildSchema>, "package_build_id"
|
|
2318
|
+
addPackageBuild: (packageBuild: Partial<Omit<z.input<typeof packageBuildSchema>, "package_build_id">> & {
|
|
2319
|
+
package_release_id: string;
|
|
2320
|
+
}) => PackageBuild;
|
|
2204
2321
|
getPackageBuildById: (packageBuildId: string) => PackageBuild | undefined;
|
|
2205
2322
|
getPackageBuildsByReleaseId: (packageReleaseId: string) => PackageBuild[];
|
|
2206
2323
|
updatePackageBuild: (packageBuildId: string, updates: Partial<PackageBuild>) => PackageBuild | undefined;
|
|
@@ -2290,6 +2407,15 @@ declare const createDatabase: ({ seed }?: {
|
|
|
2290
2407
|
updateOrganization: (orgId: string, updates: Partial<Organization>) => Organization | undefined;
|
|
2291
2408
|
deleteOrganization: (orgId: string) => boolean;
|
|
2292
2409
|
deleteAccount: (accountId: string) => boolean;
|
|
2410
|
+
addOrgInvitation: (invitation: {
|
|
2411
|
+
org_id: string;
|
|
2412
|
+
invitee_email: string;
|
|
2413
|
+
inviter_account_id: string;
|
|
2414
|
+
invitation_token: string;
|
|
2415
|
+
}) => OrgInvitation;
|
|
2416
|
+
getOrgInvitationByToken: (token: string) => OrgInvitation | undefined;
|
|
2417
|
+
listOrgInvitations: (orgId: string) => OrgInvitation[];
|
|
2418
|
+
updateOrgInvitation: (invitationId: string, updates: Partial<OrgInvitation>) => OrgInvitation | undefined;
|
|
2293
2419
|
};
|
|
2294
2420
|
type DbClient = ReturnType<typeof createDatabase>;
|
|
2295
2421
|
|
package/dist/index.js
CHANGED
|
@@ -13,6 +13,7 @@ var errorSchema = z.object({
|
|
|
13
13
|
var errorResponseSchema = z.object({
|
|
14
14
|
error: errorSchema
|
|
15
15
|
});
|
|
16
|
+
var log = z.any();
|
|
16
17
|
var snippetSchema = z.object({
|
|
17
18
|
snippet_id: z.string(),
|
|
18
19
|
package_release_id: z.string(),
|
|
@@ -363,17 +364,17 @@ var packageBuildSchema = z.object({
|
|
|
363
364
|
transpilation_in_progress: z.boolean().default(false),
|
|
364
365
|
transpilation_started_at: z.string().datetime().nullable().optional(),
|
|
365
366
|
transpilation_completed_at: z.string().datetime().nullable().optional(),
|
|
366
|
-
transpilation_logs: z.array(
|
|
367
|
+
transpilation_logs: z.array(log).nullable(),
|
|
367
368
|
transpilation_error: z.string().nullable().optional(),
|
|
368
369
|
circuit_json_build_in_progress: z.boolean().default(false),
|
|
369
370
|
circuit_json_build_started_at: z.string().datetime().nullable().optional(),
|
|
370
371
|
circuit_json_build_completed_at: z.string().datetime().nullable().optional(),
|
|
371
|
-
circuit_json_build_logs: z.array(
|
|
372
|
+
circuit_json_build_logs: z.array(log).nullable(),
|
|
372
373
|
circuit_json_build_error: z.string().nullable().optional(),
|
|
373
374
|
image_generation_in_progress: z.boolean().default(false),
|
|
374
375
|
image_generation_started_at: z.string().datetime().nullable().optional(),
|
|
375
376
|
image_generation_completed_at: z.string().datetime().nullable().optional(),
|
|
376
|
-
image_generation_logs: z.array(
|
|
377
|
+
image_generation_logs: z.array(log).nullable(),
|
|
377
378
|
image_generation_error: z.string().nullable().optional(),
|
|
378
379
|
build_in_progress: z.boolean().default(false),
|
|
379
380
|
build_started_at: z.string().datetime().nullable().optional(),
|
|
@@ -381,7 +382,12 @@ var packageBuildSchema = z.object({
|
|
|
381
382
|
build_error: z.string().nullable().optional(),
|
|
382
383
|
build_error_last_updated_at: z.string().datetime(),
|
|
383
384
|
preview_url: z.string().nullable().optional(),
|
|
384
|
-
build_logs: z.string().nullable().optional()
|
|
385
|
+
build_logs: z.string().nullable().optional(),
|
|
386
|
+
user_code_started_at: z.string().datetime().nullable().optional(),
|
|
387
|
+
user_code_completed_at: z.string().datetime().nullable().optional(),
|
|
388
|
+
user_code_error: z.any().nullable().optional(),
|
|
389
|
+
user_code_build_logs: z.array(log).nullable(),
|
|
390
|
+
user_code_log_stream_url: z.string().nullable().optional()
|
|
385
391
|
});
|
|
386
392
|
var orgSchema = z.object({
|
|
387
393
|
org_id: z.string(),
|
|
@@ -400,6 +406,22 @@ var orgAccountSchema = z.object({
|
|
|
400
406
|
created_at: z.string().datetime(),
|
|
401
407
|
can_manage_org: z.boolean().default(false)
|
|
402
408
|
});
|
|
409
|
+
var orgInvitationSchema = z.object({
|
|
410
|
+
org_invitation_id: z.string(),
|
|
411
|
+
org_id: z.string(),
|
|
412
|
+
invitee_email: z.string().email().nullable(),
|
|
413
|
+
inviter_account_id: z.string(),
|
|
414
|
+
invitation_token: z.string(),
|
|
415
|
+
is_link_invite: z.boolean().default(false),
|
|
416
|
+
is_pending: z.boolean().default(true),
|
|
417
|
+
is_accepted: z.boolean().default(false),
|
|
418
|
+
is_expired: z.boolean().default(false),
|
|
419
|
+
is_revoked: z.boolean().default(false),
|
|
420
|
+
created_at: z.string().datetime(),
|
|
421
|
+
expires_at: z.string().datetime(),
|
|
422
|
+
accepted_at: z.string().datetime().nullable(),
|
|
423
|
+
accepted_by_account_id: z.string().nullable()
|
|
424
|
+
});
|
|
403
425
|
var userPermissionsSchema = z.object({
|
|
404
426
|
can_manage_org: z.boolean().optional(),
|
|
405
427
|
can_manage_package: z.boolean().optional()
|
|
@@ -431,6 +453,7 @@ var databaseSchema = z.object({
|
|
|
431
453
|
orders: z.array(orderSchema).default([]),
|
|
432
454
|
organizations: z.array(orgSchema).default([]),
|
|
433
455
|
orgAccounts: z.array(orgAccountSchema).default([]),
|
|
456
|
+
orgInvitations: z.array(orgInvitationSchema).default([]),
|
|
434
457
|
orderFiles: z.array(orderFileSchema).default([]),
|
|
435
458
|
accountSnippets: z.array(accountSnippetSchema).default([]),
|
|
436
459
|
accountPackages: z.array(accountPackageSchema).default([]),
|
|
@@ -3803,6 +3826,8 @@ var initializer = combine(databaseSchema.parse({}), (set, get) => ({
|
|
|
3803
3826
|
addPackageBuild: (packageBuild) => {
|
|
3804
3827
|
const newPackageBuild = packageBuildSchema.parse({
|
|
3805
3828
|
package_build_id: crypto.randomUUID(),
|
|
3829
|
+
user_code_build_logs: null,
|
|
3830
|
+
image_generation_logs: null,
|
|
3806
3831
|
...packageBuild
|
|
3807
3832
|
});
|
|
3808
3833
|
set((state) => ({
|
|
@@ -4077,6 +4102,60 @@ var initializer = combine(databaseSchema.parse({}), (set, get) => ({
|
|
|
4077
4102
|
return state;
|
|
4078
4103
|
});
|
|
4079
4104
|
return deleted;
|
|
4105
|
+
},
|
|
4106
|
+
addOrgInvitation: (invitation) => {
|
|
4107
|
+
const expiresAt = /* @__PURE__ */ new Date();
|
|
4108
|
+
expiresAt.setDate(expiresAt.getDate() + 7);
|
|
4109
|
+
const newInvitation = {
|
|
4110
|
+
org_invitation_id: `org_invitation_${get().idCounter + 1}`,
|
|
4111
|
+
org_id: invitation.org_id,
|
|
4112
|
+
invitee_email: invitation.invitee_email,
|
|
4113
|
+
inviter_account_id: invitation.inviter_account_id,
|
|
4114
|
+
invitation_token: invitation.invitation_token,
|
|
4115
|
+
is_link_invite: false,
|
|
4116
|
+
is_pending: true,
|
|
4117
|
+
is_accepted: false,
|
|
4118
|
+
is_expired: false,
|
|
4119
|
+
is_revoked: false,
|
|
4120
|
+
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4121
|
+
expires_at: expiresAt.toISOString(),
|
|
4122
|
+
accepted_at: null,
|
|
4123
|
+
accepted_by_account_id: null
|
|
4124
|
+
};
|
|
4125
|
+
set((state) => ({
|
|
4126
|
+
orgInvitations: [...state.orgInvitations, newInvitation],
|
|
4127
|
+
idCounter: state.idCounter + 1
|
|
4128
|
+
}));
|
|
4129
|
+
return newInvitation;
|
|
4130
|
+
},
|
|
4131
|
+
getOrgInvitationByToken: (token) => {
|
|
4132
|
+
const state = get();
|
|
4133
|
+
return state.orgInvitations.find(
|
|
4134
|
+
(invitation) => invitation.invitation_token === token
|
|
4135
|
+
);
|
|
4136
|
+
},
|
|
4137
|
+
listOrgInvitations: (orgId) => {
|
|
4138
|
+
const state = get();
|
|
4139
|
+
return state.orgInvitations.filter(
|
|
4140
|
+
(invitation) => invitation.org_id === orgId
|
|
4141
|
+
);
|
|
4142
|
+
},
|
|
4143
|
+
updateOrgInvitation: (invitationId, updates) => {
|
|
4144
|
+
let updatedInvitation;
|
|
4145
|
+
set((state) => {
|
|
4146
|
+
const index = state.orgInvitations.findIndex(
|
|
4147
|
+
(inv) => inv.org_invitation_id === invitationId
|
|
4148
|
+
);
|
|
4149
|
+
if (index === -1) return state;
|
|
4150
|
+
const updatedInvitations = [...state.orgInvitations];
|
|
4151
|
+
updatedInvitations[index] = {
|
|
4152
|
+
...updatedInvitations[index],
|
|
4153
|
+
...updates
|
|
4154
|
+
};
|
|
4155
|
+
updatedInvitation = updatedInvitations[index];
|
|
4156
|
+
return { ...state, orgInvitations: updatedInvitations };
|
|
4157
|
+
});
|
|
4158
|
+
return updatedInvitation;
|
|
4080
4159
|
}
|
|
4081
4160
|
}));
|
|
4082
4161
|
|