@teardown/schemas 2.0.34 → 2.0.36

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": "@teardown/schemas",
3
- "version": "2.0.34",
3
+ "version": "2.0.36",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -98,11 +98,11 @@
98
98
  },
99
99
  "dependencies": {
100
100
  "@sinclair/typebox": "^0.34.41",
101
- "@teardown/types": "2.0.34"
101
+ "@teardown/types": "2.0.36"
102
102
  },
103
103
  "devDependencies": {
104
104
  "@biomejs/biome": "2.3.10",
105
- "@teardown/tsconfig": "2.0.34",
105
+ "@teardown/tsconfig": "2.0.36",
106
106
  "typescript": "5.9.3"
107
107
  },
108
108
  "peerDependencies": {
@@ -1,5 +1,5 @@
1
1
  import { type Static, Type } from "@sinclair/typebox";
2
- import { OrgRoleWithOrgSchema } from "../orgs/schemas";
2
+ import { OrgInvitationWithOrgSchema, OrgRoleWithOrgSchema } from "../orgs/schemas";
3
3
 
4
4
  /**
5
5
  * User schema
@@ -86,3 +86,31 @@ export const MeErrorResponseSchema = Type.Object({
86
86
  error: MeErrorSchema,
87
87
  });
88
88
  export type MeErrorResponse = Static<typeof MeErrorResponseSchema>;
89
+
90
+ /**
91
+ * Me invitations response schema
92
+ * Returns pending invitations for the current user
93
+ */
94
+ export const MeInvitationsResponseSchema = Type.Object({
95
+ invitations: Type.Array(OrgInvitationWithOrgSchema),
96
+ });
97
+ export type MeInvitationsResponse = Static<typeof MeInvitationsResponseSchema>;
98
+
99
+ /**
100
+ * Accept invitation response schema
101
+ */
102
+ export const AcceptInvitationResponseSchema = Type.Object({
103
+ success: Type.Literal(true),
104
+ data: Type.Object({
105
+ membership: OrgRoleWithOrgSchema,
106
+ }),
107
+ });
108
+ export type AcceptInvitationResponse = Static<typeof AcceptInvitationResponseSchema>;
109
+
110
+ /**
111
+ * Decline invitation response schema
112
+ */
113
+ export const DeclineInvitationResponseSchema = Type.Object({
114
+ success: Type.Literal(true),
115
+ });
116
+ export type DeclineInvitationResponse = Static<typeof DeclineInvitationResponseSchema>;
@@ -175,6 +175,19 @@ export const OrgInvitationSchema = Type.Object({
175
175
  });
176
176
  export type OrgInvitation = Static<typeof OrgInvitationSchema>;
177
177
 
178
+ /**
179
+ * Org invitation with org info schema
180
+ * Used for displaying pending invitations to users
181
+ */
182
+ export const OrgInvitationWithOrgSchema = Type.Composite([
183
+ OrgInvitationSchema,
184
+ Type.Object({
185
+ org_name: Type.String(),
186
+ org_slug: SlugSchema,
187
+ }),
188
+ ]);
189
+ export type OrgInvitationWithOrg = Static<typeof OrgInvitationWithOrgSchema>;
190
+
178
191
  /**
179
192
  * Parse and validate an OrgInvitationStatusEnum value
180
193
  */
@@ -351,6 +364,14 @@ export const OrgErrorSchema = Type.Union([
351
364
  code: Type.Literal("CANNOT_CHANGE_OWNER_ROLE"),
352
365
  message: Type.String(),
353
366
  }),
367
+ Type.Object({
368
+ code: Type.Literal("INVITATION_EXPIRED"),
369
+ message: Type.String(),
370
+ }),
371
+ Type.Object({
372
+ code: Type.Literal("EMAIL_MISMATCH"),
373
+ message: Type.String(),
374
+ }),
354
375
  ]);
355
376
  export type OrgError = Static<typeof OrgErrorSchema>;
356
377