@supernova-studio/model 0.54.35 → 0.55.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supernova-studio/model",
3
- "version": "0.54.35",
3
+ "version": "0.55.1",
4
4
  "description": "Supernova Data Models",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1 +1,2 @@
1
1
  export * from "./design-system-invite";
2
+ export * from "./workspace-invite";
@@ -0,0 +1,29 @@
1
+ import { z } from "zod";
2
+ import { User } from "../users/user";
3
+ import { Workspace } from "../workspace/workspace";
4
+ import { WorkspaceRoleSchema } from "../workspace/workspace-role";
5
+
6
+ /**
7
+ * Object describing who is going to receive the email.
8
+ *
9
+ * Normally recepient is just an email, however in some cases email can be tailored
10
+ * for who receives it. In this case the email has cutomization based on the role of the
11
+ * recepient in the workspace.
12
+ */
13
+ export const WorkspaceInviteEmailRecipient = z.object({
14
+ email: z.string(),
15
+ role: WorkspaceRoleSchema,
16
+ });
17
+
18
+ /**
19
+ * Object describing the necessary data to send an email notifying a user that
20
+ * they've been added to a workspace.
21
+ */
22
+ export const WorkspaceInviteEmailData = z.object({
23
+ workspace: Workspace,
24
+ invitedBy: User,
25
+ documentationDomain: z.string().optional(),
26
+ });
27
+
28
+ export type WorkspaceInviteEmailRecipient = z.infer<typeof WorkspaceInviteEmailRecipient>;
29
+ export type WorkspaceInviteEmailData = z.infer<typeof WorkspaceInviteEmailData>;
@@ -1,5 +1,7 @@
1
- import { WorkspaceRole } from "./workspace-role";
2
1
  import { z } from "zod";
2
+ import { DbCreateInputOmit, DbUpdate } from "../helpers";
3
+ import { OmitStrict } from "../utils";
4
+ import { WorkspaceRole } from "./workspace-role";
3
5
 
4
6
  export const WorkspaceInvitation = z.object({
5
7
  id: z.string(),
@@ -12,3 +14,9 @@ export const WorkspaceInvitation = z.object({
12
14
  });
13
15
 
14
16
  export type WorkspaceInvitation = z.infer<typeof WorkspaceInvitation>;
17
+
18
+ export type CreateWorkspaceInvitation = DbCreateInputOmit<WorkspaceInvitation>;
19
+ export type UpdateWorkspaceInvitation = OmitStrict<
20
+ DbUpdate<WorkspaceInvitation>,
21
+ "email" | "invitedBy" | "workspaceId"
22
+ >;
@@ -1,6 +1,8 @@
1
+ import { z } from "zod";
2
+ import { DbCreateInputOmit, DbUpdate } from "../helpers";
1
3
  import { UserNotificationSettings } from "../users";
4
+ import { OmitStrict } from "../utils";
2
5
  import { WorkspaceRole } from "./workspace-role";
3
- import { z } from "zod";
4
6
 
5
7
  export const WorkspaceMembership = z.object({
6
8
  id: z.string(),
@@ -12,6 +14,9 @@ export const WorkspaceMembership = z.object({
12
14
 
13
15
  export type WorkspaceMembership = z.infer<typeof WorkspaceMembership>;
14
16
 
17
+ export type CreateWorkspaceMembership = DbCreateInputOmit<WorkspaceMembership>;
18
+ export type UpdateWorkspaceMembership = OmitStrict<DbUpdate<WorkspaceMembership>, "userId" | "workspaceId">;
19
+
15
20
  export const UpdateMembershipRolesInput = z.object({
16
21
  members: z.array(
17
22
  z.object({
@@ -20,4 +25,5 @@ export const UpdateMembershipRolesInput = z.object({
20
25
  })
21
26
  ),
22
27
  });
28
+
23
29
  export type UpdateMembershipRolesInput = z.infer<typeof UpdateMembershipRolesInput>;