@tscircuit/fake-snippets 0.0.148 → 0.0.150

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/index.d.ts CHANGED
@@ -1069,7 +1069,6 @@ declare const orgSchema: z.ZodObject<{
1069
1069
  org_display_name: z.ZodOptional<z.ZodString>;
1070
1070
  github_handle: z.ZodNullable<z.ZodString>;
1071
1071
  tscircuit_handle: z.ZodNullable<z.ZodString>;
1072
- org_name: z.ZodString;
1073
1072
  }, "strip", z.ZodTypeAny, {
1074
1073
  created_at: string;
1075
1074
  tscircuit_handle: string | null;
@@ -1077,7 +1076,6 @@ declare const orgSchema: z.ZodObject<{
1077
1076
  owner_account_id: string;
1078
1077
  is_personal_org: boolean;
1079
1078
  github_handle: string | null;
1080
- org_name: string;
1081
1079
  org_display_name?: string | undefined;
1082
1080
  }, {
1083
1081
  created_at: string;
@@ -1085,7 +1083,6 @@ declare const orgSchema: z.ZodObject<{
1085
1083
  org_id: string;
1086
1084
  owner_account_id: string;
1087
1085
  github_handle: string | null;
1088
- org_name: string;
1089
1086
  is_personal_org?: boolean | undefined;
1090
1087
  org_display_name?: string | undefined;
1091
1088
  }>;
@@ -1113,6 +1110,53 @@ declare const orgAccountSchema: z.ZodObject<{
1113
1110
  can_manage_org?: boolean | undefined;
1114
1111
  }>;
1115
1112
  type OrgAccount = z.infer<typeof orgAccountSchema>;
1113
+ declare const orgInvitationSchema: z.ZodObject<{
1114
+ org_invitation_id: z.ZodString;
1115
+ org_id: z.ZodString;
1116
+ invitee_email: z.ZodNullable<z.ZodString>;
1117
+ inviter_account_id: z.ZodString;
1118
+ invitation_token: z.ZodString;
1119
+ is_link_invite: z.ZodDefault<z.ZodBoolean>;
1120
+ is_pending: z.ZodDefault<z.ZodBoolean>;
1121
+ is_accepted: z.ZodDefault<z.ZodBoolean>;
1122
+ is_expired: z.ZodDefault<z.ZodBoolean>;
1123
+ is_revoked: z.ZodDefault<z.ZodBoolean>;
1124
+ created_at: z.ZodString;
1125
+ expires_at: z.ZodString;
1126
+ accepted_at: z.ZodNullable<z.ZodString>;
1127
+ accepted_by_account_id: z.ZodNullable<z.ZodString>;
1128
+ }, "strip", z.ZodTypeAny, {
1129
+ created_at: string;
1130
+ expires_at: string;
1131
+ org_id: string;
1132
+ org_invitation_id: string;
1133
+ invitee_email: string | null;
1134
+ inviter_account_id: string;
1135
+ invitation_token: string;
1136
+ is_link_invite: boolean;
1137
+ is_pending: boolean;
1138
+ is_accepted: boolean;
1139
+ is_expired: boolean;
1140
+ is_revoked: boolean;
1141
+ accepted_at: string | null;
1142
+ accepted_by_account_id: string | null;
1143
+ }, {
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
+ accepted_at: string | null;
1152
+ accepted_by_account_id: string | null;
1153
+ is_link_invite?: boolean | undefined;
1154
+ is_pending?: boolean | undefined;
1155
+ is_accepted?: boolean | undefined;
1156
+ is_expired?: boolean | undefined;
1157
+ is_revoked?: boolean | undefined;
1158
+ }>;
1159
+ type OrgInvitation = z.infer<typeof orgInvitationSchema>;
1116
1160
  declare const userPermissionsSchema: z.ZodObject<{
1117
1161
  can_manage_org: z.ZodOptional<z.ZodBoolean>;
1118
1162
  can_manage_package: z.ZodOptional<z.ZodBoolean>;
@@ -1319,7 +1363,6 @@ declare const createDatabase: ({ seed }?: {
1319
1363
  owner_account_id: string;
1320
1364
  is_personal_org: boolean;
1321
1365
  github_handle: string | null;
1322
- org_name: string;
1323
1366
  org_display_name?: string | undefined;
1324
1367
  }[];
1325
1368
  orgAccounts: {
@@ -1330,6 +1373,22 @@ declare const createDatabase: ({ seed }?: {
1330
1373
  is_owner: boolean;
1331
1374
  can_manage_org: boolean;
1332
1375
  }[];
1376
+ orgInvitations: {
1377
+ created_at: string;
1378
+ expires_at: string;
1379
+ org_id: string;
1380
+ org_invitation_id: string;
1381
+ invitee_email: string | null;
1382
+ inviter_account_id: string;
1383
+ invitation_token: string;
1384
+ is_link_invite: boolean;
1385
+ is_pending: boolean;
1386
+ is_accepted: boolean;
1387
+ is_expired: boolean;
1388
+ is_revoked: boolean;
1389
+ accepted_at: string | null;
1390
+ accepted_by_account_id: string | null;
1391
+ }[];
1333
1392
  orderFiles: {
1334
1393
  order_id: string;
1335
1394
  order_file_id: string;
@@ -1500,7 +1559,7 @@ declare const createDatabase: ({ seed }?: {
1500
1559
  content_mimetype: string;
1501
1560
  is_text: boolean;
1502
1561
  }[];
1503
- }, "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"> & {
1562
+ }, "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"> & {
1504
1563
  addOrder: (order: Omit<Order, "order_id">) => Order;
1505
1564
  getOrderById: (orderId: string) => Order | undefined;
1506
1565
  getOrderFilesByOrderId: (orderId: string) => OrderFile[];
@@ -1626,7 +1685,7 @@ declare const createDatabase: ({ seed }?: {
1626
1685
  getPackageBuildsByReleaseId: (packageReleaseId: string) => PackageBuild[];
1627
1686
  updatePackageBuild: (packageBuildId: string, updates: Partial<PackageBuild>) => PackageBuild | undefined;
1628
1687
  addOrganization: (organization: {
1629
- name: string;
1688
+ name?: string;
1630
1689
  org_id?: string;
1631
1690
  is_personal_org?: boolean;
1632
1691
  owner_account_id: string;
@@ -1640,7 +1699,6 @@ declare const createDatabase: ({ seed }?: {
1640
1699
  owner_account_id: string;
1641
1700
  is_personal_org: boolean;
1642
1701
  github_handle: string | null;
1643
- org_name: string;
1644
1702
  org_display_name?: string | undefined;
1645
1703
  };
1646
1704
  getOrgs: (filters?: {
@@ -1661,12 +1719,10 @@ declare const createDatabase: ({ seed }?: {
1661
1719
  owner_account_id: string;
1662
1720
  is_personal_org: boolean;
1663
1721
  github_handle: string | null;
1664
- org_name: string;
1665
1722
  org_display_name?: string | undefined;
1666
1723
  }[];
1667
1724
  getOrg: (filters: {
1668
1725
  org_id?: string;
1669
- org_name?: string;
1670
1726
  github_handle?: string;
1671
1727
  tscircuit_handle?: string;
1672
1728
  }, auth?: {
@@ -1681,7 +1737,6 @@ declare const createDatabase: ({ seed }?: {
1681
1737
  owner_account_id: string;
1682
1738
  is_personal_org: boolean;
1683
1739
  github_handle: string | null;
1684
- org_name: string;
1685
1740
  org_display_name?: string | undefined;
1686
1741
  } | null;
1687
1742
  addOrganizationAccount: (organizationAccount: {
@@ -1715,6 +1770,15 @@ declare const createDatabase: ({ seed }?: {
1715
1770
  updateOrganization: (orgId: string, updates: Partial<Organization>) => Organization | undefined;
1716
1771
  deleteOrganization: (orgId: string) => boolean;
1717
1772
  deleteAccount: (accountId: string) => boolean;
1773
+ addOrgInvitation: (invitation: {
1774
+ org_id: string;
1775
+ invitee_email: string;
1776
+ inviter_account_id: string;
1777
+ invitation_token: string;
1778
+ }) => OrgInvitation;
1779
+ getOrgInvitationByToken: (token: string) => OrgInvitation | undefined;
1780
+ listOrgInvitations: (orgId: string) => OrgInvitation[];
1781
+ updateOrgInvitation: (invitationId: string, updates: Partial<OrgInvitation>) => OrgInvitation | undefined;
1718
1782
  }> & Omit<{
1719
1783
  idCounter: number;
1720
1784
  snippets: {
@@ -1907,7 +1971,6 @@ declare const createDatabase: ({ seed }?: {
1907
1971
  owner_account_id: string;
1908
1972
  is_personal_org: boolean;
1909
1973
  github_handle: string | null;
1910
- org_name: string;
1911
1974
  org_display_name?: string | undefined;
1912
1975
  }[];
1913
1976
  orgAccounts: {
@@ -1918,6 +1981,22 @@ declare const createDatabase: ({ seed }?: {
1918
1981
  is_owner: boolean;
1919
1982
  can_manage_org: boolean;
1920
1983
  }[];
1984
+ orgInvitations: {
1985
+ created_at: string;
1986
+ expires_at: string;
1987
+ org_id: string;
1988
+ org_invitation_id: string;
1989
+ invitee_email: string | null;
1990
+ inviter_account_id: string;
1991
+ invitation_token: string;
1992
+ is_link_invite: boolean;
1993
+ is_pending: boolean;
1994
+ is_accepted: boolean;
1995
+ is_expired: boolean;
1996
+ is_revoked: boolean;
1997
+ accepted_at: string | null;
1998
+ accepted_by_account_id: string | null;
1999
+ }[];
1921
2000
  orderFiles: {
1922
2001
  order_id: string;
1923
2002
  order_file_id: string;
@@ -2088,7 +2167,7 @@ declare const createDatabase: ({ seed }?: {
2088
2167
  content_mimetype: string;
2089
2168
  is_text: boolean;
2090
2169
  }[];
2091
- }, "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"> & {
2170
+ }, "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"> & {
2092
2171
  addOrder: (order: Omit<Order, "order_id">) => Order;
2093
2172
  getOrderById: (orderId: string) => Order | undefined;
2094
2173
  getOrderFilesByOrderId: (orderId: string) => OrderFile[];
@@ -2214,7 +2293,7 @@ declare const createDatabase: ({ seed }?: {
2214
2293
  getPackageBuildsByReleaseId: (packageReleaseId: string) => PackageBuild[];
2215
2294
  updatePackageBuild: (packageBuildId: string, updates: Partial<PackageBuild>) => PackageBuild | undefined;
2216
2295
  addOrganization: (organization: {
2217
- name: string;
2296
+ name?: string;
2218
2297
  org_id?: string;
2219
2298
  is_personal_org?: boolean;
2220
2299
  owner_account_id: string;
@@ -2228,7 +2307,6 @@ declare const createDatabase: ({ seed }?: {
2228
2307
  owner_account_id: string;
2229
2308
  is_personal_org: boolean;
2230
2309
  github_handle: string | null;
2231
- org_name: string;
2232
2310
  org_display_name?: string | undefined;
2233
2311
  };
2234
2312
  getOrgs: (filters?: {
@@ -2249,12 +2327,10 @@ declare const createDatabase: ({ seed }?: {
2249
2327
  owner_account_id: string;
2250
2328
  is_personal_org: boolean;
2251
2329
  github_handle: string | null;
2252
- org_name: string;
2253
2330
  org_display_name?: string | undefined;
2254
2331
  }[];
2255
2332
  getOrg: (filters: {
2256
2333
  org_id?: string;
2257
- org_name?: string;
2258
2334
  github_handle?: string;
2259
2335
  tscircuit_handle?: string;
2260
2336
  }, auth?: {
@@ -2269,7 +2345,6 @@ declare const createDatabase: ({ seed }?: {
2269
2345
  owner_account_id: string;
2270
2346
  is_personal_org: boolean;
2271
2347
  github_handle: string | null;
2272
- org_name: string;
2273
2348
  org_display_name?: string | undefined;
2274
2349
  } | null;
2275
2350
  addOrganizationAccount: (organizationAccount: {
@@ -2303,6 +2378,15 @@ declare const createDatabase: ({ seed }?: {
2303
2378
  updateOrganization: (orgId: string, updates: Partial<Organization>) => Organization | undefined;
2304
2379
  deleteOrganization: (orgId: string) => boolean;
2305
2380
  deleteAccount: (accountId: string) => boolean;
2381
+ addOrgInvitation: (invitation: {
2382
+ org_id: string;
2383
+ invitee_email: string;
2384
+ inviter_account_id: string;
2385
+ invitation_token: string;
2386
+ }) => OrgInvitation;
2387
+ getOrgInvitationByToken: (token: string) => OrgInvitation | undefined;
2388
+ listOrgInvitations: (orgId: string) => OrgInvitation[];
2389
+ updateOrgInvitation: (invitationId: string, updates: Partial<OrgInvitation>) => OrgInvitation | undefined;
2306
2390
  };
2307
2391
  type DbClient = ReturnType<typeof createDatabase>;
2308
2392
 
package/dist/index.js CHANGED
@@ -390,8 +390,7 @@ var orgSchema = z.object({
390
390
  created_at: z.string().datetime(),
391
391
  org_display_name: z.string().optional(),
392
392
  github_handle: z.string().nullable(),
393
- tscircuit_handle: z.string().nullable(),
394
- org_name: z.string()
393
+ tscircuit_handle: z.string().nullable()
395
394
  });
396
395
  var orgAccountSchema = z.object({
397
396
  org_account_id: z.string(),
@@ -401,6 +400,22 @@ var orgAccountSchema = z.object({
401
400
  created_at: z.string().datetime(),
402
401
  can_manage_org: z.boolean().default(false)
403
402
  });
403
+ var orgInvitationSchema = z.object({
404
+ org_invitation_id: z.string(),
405
+ org_id: z.string(),
406
+ invitee_email: z.string().email().nullable(),
407
+ inviter_account_id: z.string(),
408
+ invitation_token: z.string(),
409
+ is_link_invite: z.boolean().default(false),
410
+ is_pending: z.boolean().default(true),
411
+ is_accepted: z.boolean().default(false),
412
+ is_expired: z.boolean().default(false),
413
+ is_revoked: z.boolean().default(false),
414
+ created_at: z.string().datetime(),
415
+ expires_at: z.string().datetime(),
416
+ accepted_at: z.string().datetime().nullable(),
417
+ accepted_by_account_id: z.string().nullable()
418
+ });
404
419
  var userPermissionsSchema = z.object({
405
420
  can_manage_org: z.boolean().optional(),
406
421
  can_manage_package: z.boolean().optional()
@@ -432,6 +447,7 @@ var databaseSchema = z.object({
432
447
  orders: z.array(orderSchema).default([]),
433
448
  organizations: z.array(orgSchema).default([]),
434
449
  orgAccounts: z.array(orgAccountSchema).default([]),
450
+ orgInvitations: z.array(orgInvitationSchema).default([]),
435
451
  orderFiles: z.array(orderFileSchema).default([]),
436
452
  accountSnippets: z.array(accountSnippetSchema).default([]),
437
453
  accountPackages: z.array(accountPackageSchema).default([]),
@@ -445,9 +461,9 @@ var databaseSchema = z.object({
445
461
  bugReports: z.array(bugReportSchema).default([]),
446
462
  bugReportFiles: z.array(bugReportFileSchema).default([])
447
463
  });
448
- var tscircuitHandleSchema = z.string().min(1).max(40).regex(
449
- /^[0-9A-Za-z_-]+$/,
450
- "tscircuit_handle may only contain letters, numbers, underscores, and hyphens"
464
+ var tscircuitHandleSchema = z.string().min(5).max(40).regex(
465
+ /^[0-9A-Za-z][0-9A-Za-z_-]*[0-9A-Za-z]$/,
466
+ "tscircuit_handle must start and end with a letter or number, and may only contain letters, numbers, underscores, and hyphens"
451
467
  );
452
468
 
453
469
  // fake-snippets-api/lib/db/autoload-dev-packages.ts
@@ -2475,7 +2491,7 @@ export const SquareWaveModule = () => (
2475
2491
  });
2476
2492
  const testOrg = db.addOrganization({
2477
2493
  org_display_name: "Test Organization",
2478
- name: "test-organization",
2494
+ tscircuit_handle: "test-organization",
2479
2495
  github_handle: "tscircuit",
2480
2496
  owner_account_id: account_id
2481
2497
  });
@@ -3846,13 +3862,12 @@ var initializer = combine(databaseSchema.parse({}), (set, get) => ({
3846
3862
  },
3847
3863
  addOrganization: (organization) => {
3848
3864
  const newOrganization = {
3849
- org_name: organization.name,
3850
3865
  org_id: organization.org_id || `org_${get().idCounter + 1}`,
3851
3866
  github_handle: organization.github_handle ?? null,
3852
3867
  is_personal_org: organization.is_personal_org || false,
3853
3868
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
3854
- org_display_name: organization.org_display_name ?? organization.name,
3855
- tscircuit_handle: organization.tscircuit_handle || organization.name,
3869
+ org_display_name: organization.org_display_name ?? organization.tscircuit_handle ?? void 0,
3870
+ tscircuit_handle: organization.tscircuit_handle || organization.name || null,
3856
3871
  ...organization
3857
3872
  };
3858
3873
  set((state) => ({
@@ -3927,9 +3942,6 @@ var initializer = combine(databaseSchema.parse({}), (set, get) => ({
3927
3942
  if (filters?.org_id) {
3928
3943
  orgs = orgs.filter((org2) => org2.org_id === filters.org_id);
3929
3944
  }
3930
- if (filters?.org_name) {
3931
- orgs = orgs.filter((org2) => org2.org_name === filters.org_name);
3932
- }
3933
3945
  if (filters?.github_handle) {
3934
3946
  orgs = orgs.filter((org2) => org2.github_handle === filters.github_handle);
3935
3947
  }
@@ -4082,6 +4094,60 @@ var initializer = combine(databaseSchema.parse({}), (set, get) => ({
4082
4094
  return state;
4083
4095
  });
4084
4096
  return deleted;
4097
+ },
4098
+ addOrgInvitation: (invitation) => {
4099
+ const expiresAt = /* @__PURE__ */ new Date();
4100
+ expiresAt.setDate(expiresAt.getDate() + 7);
4101
+ const newInvitation = {
4102
+ org_invitation_id: `org_invitation_${get().idCounter + 1}`,
4103
+ org_id: invitation.org_id,
4104
+ invitee_email: invitation.invitee_email,
4105
+ inviter_account_id: invitation.inviter_account_id,
4106
+ invitation_token: invitation.invitation_token,
4107
+ is_link_invite: false,
4108
+ is_pending: true,
4109
+ is_accepted: false,
4110
+ is_expired: false,
4111
+ is_revoked: false,
4112
+ created_at: (/* @__PURE__ */ new Date()).toISOString(),
4113
+ expires_at: expiresAt.toISOString(),
4114
+ accepted_at: null,
4115
+ accepted_by_account_id: null
4116
+ };
4117
+ set((state) => ({
4118
+ orgInvitations: [...state.orgInvitations, newInvitation],
4119
+ idCounter: state.idCounter + 1
4120
+ }));
4121
+ return newInvitation;
4122
+ },
4123
+ getOrgInvitationByToken: (token) => {
4124
+ const state = get();
4125
+ return state.orgInvitations.find(
4126
+ (invitation) => invitation.invitation_token === token
4127
+ );
4128
+ },
4129
+ listOrgInvitations: (orgId) => {
4130
+ const state = get();
4131
+ return state.orgInvitations.filter(
4132
+ (invitation) => invitation.org_id === orgId
4133
+ );
4134
+ },
4135
+ updateOrgInvitation: (invitationId, updates) => {
4136
+ let updatedInvitation;
4137
+ set((state) => {
4138
+ const index = state.orgInvitations.findIndex(
4139
+ (inv) => inv.org_invitation_id === invitationId
4140
+ );
4141
+ if (index === -1) return state;
4142
+ const updatedInvitations = [...state.orgInvitations];
4143
+ updatedInvitations[index] = {
4144
+ ...updatedInvitations[index],
4145
+ ...updates
4146
+ };
4147
+ updatedInvitation = updatedInvitations[index];
4148
+ return { ...state, orgInvitations: updatedInvitations };
4149
+ });
4150
+ return updatedInvitation;
4085
4151
  }
4086
4152
  }));
4087
4153
 
package/dist/schema.d.ts CHANGED
@@ -1286,7 +1286,6 @@ declare const orgSchema: z.ZodObject<{
1286
1286
  org_display_name: z.ZodOptional<z.ZodString>;
1287
1287
  github_handle: z.ZodNullable<z.ZodString>;
1288
1288
  tscircuit_handle: z.ZodNullable<z.ZodString>;
1289
- org_name: z.ZodString;
1290
1289
  }, "strip", z.ZodTypeAny, {
1291
1290
  created_at: string;
1292
1291
  tscircuit_handle: string | null;
@@ -1294,7 +1293,6 @@ declare const orgSchema: z.ZodObject<{
1294
1293
  owner_account_id: string;
1295
1294
  is_personal_org: boolean;
1296
1295
  github_handle: string | null;
1297
- org_name: string;
1298
1296
  org_display_name?: string | undefined;
1299
1297
  }, {
1300
1298
  created_at: string;
@@ -1302,7 +1300,6 @@ declare const orgSchema: z.ZodObject<{
1302
1300
  org_id: string;
1303
1301
  owner_account_id: string;
1304
1302
  github_handle: string | null;
1305
- org_name: string;
1306
1303
  is_personal_org?: boolean | undefined;
1307
1304
  org_display_name?: string | undefined;
1308
1305
  }>;
@@ -1330,6 +1327,53 @@ declare const orgAccountSchema: z.ZodObject<{
1330
1327
  can_manage_org?: boolean | undefined;
1331
1328
  }>;
1332
1329
  type OrgAccount = z.infer<typeof orgAccountSchema>;
1330
+ declare const orgInvitationSchema: z.ZodObject<{
1331
+ org_invitation_id: z.ZodString;
1332
+ org_id: z.ZodString;
1333
+ invitee_email: z.ZodNullable<z.ZodString>;
1334
+ inviter_account_id: z.ZodString;
1335
+ invitation_token: z.ZodString;
1336
+ is_link_invite: z.ZodDefault<z.ZodBoolean>;
1337
+ is_pending: z.ZodDefault<z.ZodBoolean>;
1338
+ is_accepted: z.ZodDefault<z.ZodBoolean>;
1339
+ is_expired: z.ZodDefault<z.ZodBoolean>;
1340
+ is_revoked: z.ZodDefault<z.ZodBoolean>;
1341
+ created_at: z.ZodString;
1342
+ expires_at: z.ZodString;
1343
+ accepted_at: z.ZodNullable<z.ZodString>;
1344
+ accepted_by_account_id: z.ZodNullable<z.ZodString>;
1345
+ }, "strip", z.ZodTypeAny, {
1346
+ created_at: string;
1347
+ expires_at: string;
1348
+ org_id: string;
1349
+ org_invitation_id: string;
1350
+ invitee_email: string | null;
1351
+ inviter_account_id: string;
1352
+ invitation_token: string;
1353
+ is_link_invite: boolean;
1354
+ is_pending: boolean;
1355
+ is_accepted: boolean;
1356
+ is_expired: boolean;
1357
+ is_revoked: boolean;
1358
+ accepted_at: string | null;
1359
+ accepted_by_account_id: string | null;
1360
+ }, {
1361
+ created_at: string;
1362
+ expires_at: string;
1363
+ org_id: string;
1364
+ org_invitation_id: string;
1365
+ invitee_email: string | null;
1366
+ inviter_account_id: string;
1367
+ invitation_token: string;
1368
+ accepted_at: string | null;
1369
+ accepted_by_account_id: string | null;
1370
+ is_link_invite?: boolean | undefined;
1371
+ is_pending?: boolean | undefined;
1372
+ is_accepted?: boolean | undefined;
1373
+ is_expired?: boolean | undefined;
1374
+ is_revoked?: boolean | undefined;
1375
+ }>;
1376
+ type OrgInvitation = z.infer<typeof orgInvitationSchema>;
1333
1377
  declare const userPermissionsSchema: z.ZodObject<{
1334
1378
  can_manage_org: z.ZodOptional<z.ZodBoolean>;
1335
1379
  can_manage_package: z.ZodOptional<z.ZodBoolean>;
@@ -1971,7 +2015,6 @@ declare const databaseSchema: z.ZodObject<{
1971
2015
  org_display_name: z.ZodOptional<z.ZodString>;
1972
2016
  github_handle: z.ZodNullable<z.ZodString>;
1973
2017
  tscircuit_handle: z.ZodNullable<z.ZodString>;
1974
- org_name: z.ZodString;
1975
2018
  }, "strip", z.ZodTypeAny, {
1976
2019
  created_at: string;
1977
2020
  tscircuit_handle: string | null;
@@ -1979,7 +2022,6 @@ declare const databaseSchema: z.ZodObject<{
1979
2022
  owner_account_id: string;
1980
2023
  is_personal_org: boolean;
1981
2024
  github_handle: string | null;
1982
- org_name: string;
1983
2025
  org_display_name?: string | undefined;
1984
2026
  }, {
1985
2027
  created_at: string;
@@ -1987,7 +2029,6 @@ declare const databaseSchema: z.ZodObject<{
1987
2029
  org_id: string;
1988
2030
  owner_account_id: string;
1989
2031
  github_handle: string | null;
1990
- org_name: string;
1991
2032
  is_personal_org?: boolean | undefined;
1992
2033
  org_display_name?: string | undefined;
1993
2034
  }>, "many">>;
@@ -2013,6 +2054,52 @@ declare const databaseSchema: z.ZodObject<{
2013
2054
  is_owner?: boolean | undefined;
2014
2055
  can_manage_org?: boolean | undefined;
2015
2056
  }>, "many">>;
2057
+ orgInvitations: z.ZodDefault<z.ZodArray<z.ZodObject<{
2058
+ org_invitation_id: z.ZodString;
2059
+ org_id: z.ZodString;
2060
+ invitee_email: z.ZodNullable<z.ZodString>;
2061
+ inviter_account_id: z.ZodString;
2062
+ invitation_token: z.ZodString;
2063
+ is_link_invite: z.ZodDefault<z.ZodBoolean>;
2064
+ is_pending: z.ZodDefault<z.ZodBoolean>;
2065
+ is_accepted: z.ZodDefault<z.ZodBoolean>;
2066
+ is_expired: z.ZodDefault<z.ZodBoolean>;
2067
+ is_revoked: z.ZodDefault<z.ZodBoolean>;
2068
+ created_at: z.ZodString;
2069
+ expires_at: z.ZodString;
2070
+ accepted_at: z.ZodNullable<z.ZodString>;
2071
+ accepted_by_account_id: z.ZodNullable<z.ZodString>;
2072
+ }, "strip", z.ZodTypeAny, {
2073
+ created_at: string;
2074
+ expires_at: string;
2075
+ org_id: string;
2076
+ org_invitation_id: string;
2077
+ invitee_email: string | null;
2078
+ inviter_account_id: string;
2079
+ invitation_token: string;
2080
+ is_link_invite: boolean;
2081
+ is_pending: boolean;
2082
+ is_accepted: boolean;
2083
+ is_expired: boolean;
2084
+ is_revoked: boolean;
2085
+ accepted_at: string | null;
2086
+ accepted_by_account_id: string | null;
2087
+ }, {
2088
+ created_at: string;
2089
+ expires_at: string;
2090
+ org_id: string;
2091
+ org_invitation_id: string;
2092
+ invitee_email: string | null;
2093
+ inviter_account_id: string;
2094
+ invitation_token: string;
2095
+ accepted_at: string | null;
2096
+ accepted_by_account_id: string | null;
2097
+ is_link_invite?: boolean | undefined;
2098
+ is_pending?: boolean | undefined;
2099
+ is_accepted?: boolean | undefined;
2100
+ is_expired?: boolean | undefined;
2101
+ is_revoked?: boolean | undefined;
2102
+ }>, "many">>;
2016
2103
  orderFiles: z.ZodDefault<z.ZodArray<z.ZodObject<{
2017
2104
  order_file_id: z.ZodString;
2018
2105
  order_id: z.ZodString;
@@ -2729,7 +2816,6 @@ declare const databaseSchema: z.ZodObject<{
2729
2816
  owner_account_id: string;
2730
2817
  is_personal_org: boolean;
2731
2818
  github_handle: string | null;
2732
- org_name: string;
2733
2819
  org_display_name?: string | undefined;
2734
2820
  }[];
2735
2821
  orgAccounts: {
@@ -2740,6 +2826,22 @@ declare const databaseSchema: z.ZodObject<{
2740
2826
  is_owner: boolean;
2741
2827
  can_manage_org: boolean;
2742
2828
  }[];
2829
+ orgInvitations: {
2830
+ created_at: string;
2831
+ expires_at: string;
2832
+ org_id: string;
2833
+ org_invitation_id: string;
2834
+ invitee_email: string | null;
2835
+ inviter_account_id: string;
2836
+ invitation_token: string;
2837
+ is_link_invite: boolean;
2838
+ is_pending: boolean;
2839
+ is_accepted: boolean;
2840
+ is_expired: boolean;
2841
+ is_revoked: boolean;
2842
+ accepted_at: string | null;
2843
+ accepted_by_account_id: string | null;
2844
+ }[];
2743
2845
  orderFiles: {
2744
2846
  order_id: string;
2745
2847
  order_file_id: string;
@@ -3101,7 +3203,6 @@ declare const databaseSchema: z.ZodObject<{
3101
3203
  org_id: string;
3102
3204
  owner_account_id: string;
3103
3205
  github_handle: string | null;
3104
- org_name: string;
3105
3206
  is_personal_org?: boolean | undefined;
3106
3207
  org_display_name?: string | undefined;
3107
3208
  }[] | undefined;
@@ -3113,6 +3214,22 @@ declare const databaseSchema: z.ZodObject<{
3113
3214
  is_owner?: boolean | undefined;
3114
3215
  can_manage_org?: boolean | undefined;
3115
3216
  }[] | undefined;
3217
+ orgInvitations?: {
3218
+ created_at: string;
3219
+ expires_at: string;
3220
+ org_id: string;
3221
+ org_invitation_id: string;
3222
+ invitee_email: string | null;
3223
+ inviter_account_id: string;
3224
+ invitation_token: string;
3225
+ accepted_at: string | null;
3226
+ accepted_by_account_id: string | null;
3227
+ is_link_invite?: boolean | undefined;
3228
+ is_pending?: boolean | undefined;
3229
+ is_accepted?: boolean | undefined;
3230
+ is_expired?: boolean | undefined;
3231
+ is_revoked?: boolean | undefined;
3232
+ }[] | undefined;
3116
3233
  orderFiles?: {
3117
3234
  order_id: string;
3118
3235
  order_file_id: string;
@@ -3287,4 +3404,4 @@ declare const databaseSchema: z.ZodObject<{
3287
3404
  type DatabaseSchema = z.infer<typeof databaseSchema>;
3288
3405
  declare const tscircuitHandleSchema: z.ZodString;
3289
3406
 
3290
- 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 PublicAccount, 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, publicAccountSchema, publicOrgSchema, quotedComponentSchema, sessionSchema, shippingInfoSchema, snippetSchema, tscircuitHandleSchema, userPermissionsSchema };
3407
+ 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 OrgInvitation, type Organization, type Package, type PackageBuild, type PackageFile, type PackageRelease, type PublicAccount, 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, orgInvitationSchema, orgSchema, packageBuildSchema, packageFileSchema, packageReleaseSchema, packageSchema, publicAccountSchema, publicOrgSchema, quotedComponentSchema, sessionSchema, shippingInfoSchema, snippetSchema, tscircuitHandleSchema, userPermissionsSchema };