@schemavaults/auth-common 0.9.8 → 0.10.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/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { ERROR_MESSAGE_CATALOG, isValidErrorId } from "./auth-error-message-catalog";
1
+ export { ERROR_MESSAGE_CATALOG, isValidErrorId, } from "./auth-error-message-catalog";
2
2
  export type { SchemaVaultsAuthErrorId } from "./auth-error-message-catalog";
3
3
  export { userDataSchema, type UserData } from "./user_data";
4
4
  export * from "./credentials";
@@ -19,8 +19,8 @@ export { appIdSchema } from "@schemavaults/app-definitions";
19
19
  export { audienceSchema, audienceRefSchema } from "./audience-schema";
20
20
  export { inviteCodeFormatSchema, inviteCodeDefinitionSchema, } from "./invite-code";
21
21
  export type { InviteCode, InviteCodeDefinition } from "./invite-code";
22
- export { organizationIdSchema, isValidOrganizationID, RESERVED_ORGANIZATION_IDS, organizationDefinitionSchema, hardcodedOrgs, SCHEMAVAULTS_ORGANIZATION_ID, MAXIMUM_USER_ORGANIZATIONS, MINIMUM_ORGANIZATION_ID_LENGTH, MAXIMUM_ORGANIZATION_ID_LENGTH, inviteMemberInputModes, inviteMemberFormSchema, organizationInvitationStatusTypes, organizationInvitationStatusSchema, organizationInvitationSchema, } from "./organizations";
23
- export type { OrganizationID, OrganizationDefinition, InviteMemberInputMode, InviteMemberFormValues, InviteMemberSubmitData, OrganizationInvitationStatus, OrganizationInvitation, UserPendingInvitation, OrganizationInvitationWithUserData, } from "./organizations";
22
+ export { organizationIdSchema, isValidOrganizationID, RESERVED_ORGANIZATION_IDS, organizationDefinitionSchema, hardcodedOrgs, SCHEMAVAULTS_ORGANIZATION_ID, MAXIMUM_USER_ORGANIZATIONS, MINIMUM_ORGANIZATION_ID_LENGTH, MAXIMUM_ORGANIZATION_ID_LENGTH, inviteMemberInputModes, inviteMemberFormSchema, organizationInvitationStatusTypes, organizationInvitationStatusSchema, organizationInvitationSchema, organizationMembershipRoleTypes, organizationMembershipRoleTypeSchema, isValidOrganizationMembershipRoleType, } from "./organizations";
23
+ export type { OrganizationID, OrganizationDefinition, InviteMemberInputMode, InviteMemberFormValues, InviteMemberSubmitData, OrganizationInvitationStatus, OrganizationInvitation, UserPendingInvitation, OrganizationInvitationWithUserData, OrganizationMembershipRoleType, } from "./organizations";
24
24
  export { MaximumBrowserCookieSize } from "./MaximumBrowserCookieSize";
25
25
  export { RefreshTokenCookieName, RefreshTokenExpiryCookieName, } from "./RefreshTokenCookieNames";
26
26
  export { AccessTokenCookieName, AccessTokenExpiryCookieName, } from "./AccessTokenCookieNames";
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { ERROR_MESSAGE_CATALOG, isValidErrorId } from "./auth-error-message-catalog";
1
+ export { ERROR_MESSAGE_CATALOG, isValidErrorId, } from "./auth-error-message-catalog";
2
2
  export { userDataSchema } from "./user_data";
3
3
  export * from "./credentials";
4
4
  // Shapes of tokens
@@ -12,7 +12,7 @@ export { PRODUCTION_AUTH_SERVER_URL } from "@schemavaults/app-definitions";
12
12
  export { appIdSchema } from "@schemavaults/app-definitions";
13
13
  export { audienceSchema, audienceRefSchema } from "./audience-schema";
14
14
  export { inviteCodeFormatSchema, inviteCodeDefinitionSchema, } from "./invite-code";
15
- export { organizationIdSchema, isValidOrganizationID, RESERVED_ORGANIZATION_IDS, organizationDefinitionSchema, hardcodedOrgs, SCHEMAVAULTS_ORGANIZATION_ID, MAXIMUM_USER_ORGANIZATIONS, MINIMUM_ORGANIZATION_ID_LENGTH, MAXIMUM_ORGANIZATION_ID_LENGTH, inviteMemberInputModes, inviteMemberFormSchema, organizationInvitationStatusTypes, organizationInvitationStatusSchema, organizationInvitationSchema, } from "./organizations";
15
+ export { organizationIdSchema, isValidOrganizationID, RESERVED_ORGANIZATION_IDS, organizationDefinitionSchema, hardcodedOrgs, SCHEMAVAULTS_ORGANIZATION_ID, MAXIMUM_USER_ORGANIZATIONS, MINIMUM_ORGANIZATION_ID_LENGTH, MAXIMUM_ORGANIZATION_ID_LENGTH, inviteMemberInputModes, inviteMemberFormSchema, organizationInvitationStatusTypes, organizationInvitationStatusSchema, organizationInvitationSchema, organizationMembershipRoleTypes, organizationMembershipRoleTypeSchema, isValidOrganizationMembershipRoleType, } from "./organizations";
16
16
  export { MaximumBrowserCookieSize } from "./MaximumBrowserCookieSize";
17
17
  export { RefreshTokenCookieName, RefreshTokenExpiryCookieName, } from "./RefreshTokenCookieNames";
18
18
  export { AccessTokenCookieName, AccessTokenExpiryCookieName, } from "./AccessTokenCookieNames";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAGrF,OAAO,EAAE,cAAc,EAAiB,MAAM,aAAa,CAAC;AAE5D,cAAc,eAAe,CAAC;AAG9B,mBAAmB;AACnB,cAAc,cAAc,CAAC;AAM7B,cAAc,cAAc,CAAC;AAG7B,cAAc,QAAQ,CAAC;AAGvB,OAAO,EACL,wBAAwB,GAEzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,yBAAyB,EAEzB,uCAAuC,GAExC,MAAM,yBAAyB,CAAC;AAEjC,cAAc,mCAAmC,CAAC;AAGlD,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAE5D,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtE,OAAO,EACL,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,yBAAyB,EACzB,4BAA4B,EAC5B,aAAa,EACb,4BAA4B,EAC5B,0BAA0B,EAC1B,8BAA8B,EAC9B,8BAA8B,EAC9B,s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AA4B,EAC5B,aAAa,EACb,4BAA4B,EAC5B,0BAA0B,EAC1B,8BAA8B,EAC9B,8BAA8B,EAC9B,sBAAsB,EACtB,sBAAsB,EACtB,iCAAiC,EACjC,kCAAkC,EAClC,4BAA4B,EAC5B,+BAA+B,EAC/B,oCAAoC,EACpC,qCAAqC,GACtC,MAAM,iBAAiB,CAAC;AAczB,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,OAAO,EACL,sBAAsB,EACtB,4BAA4B,GAC7B,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,qBAAqB,EACrB,2BAA2B,GAC5B,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,wCAAwC,EAAE,MAAM,4CAA4C,CAAC;AAEtG,OAAO,EAAE,kCAAkC,EAAE,MAAM,0CAA0C,CAAC;AAE9F,OAAO,EACL,uBAAuB,EACvB,6BAA6B,EAC7B,4BAA4B,EAC5B,wBAAwB,GACzB,MAAM,cAAc,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import { z } from "zod";
2
2
  export declare const inviteCodeDefinitionSchema: z.ZodObject<{
3
3
  created_at: z.ZodNumber;
4
- created_by: z.ZodOptional<z.ZodString>;
5
4
  invite_code: z.ZodString;
5
+ created_by: z.ZodOptional<z.ZodString>;
6
6
  max_uses: z.ZodNumber;
7
7
  description: z.ZodOptional<z.ZodString>;
8
8
  }, "strict", z.ZodTypeAny, {
@@ -1,10 +1,10 @@
1
1
  import type { PotentiallyValidTokenSource } from "./token-source";
2
2
  import type { DecodeTokenFn } from "./decode-token-type";
3
+ import type { UserData } from "../user_data";
3
4
  export interface IDecodeSeveralJwtsInputOptions {
4
5
  token_sources: readonly PotentiallyValidTokenSource[];
5
6
  decodeJWT: DecodeTokenFn;
6
7
  jwt_audience: string;
7
8
  }
8
- type DecodeTokenOutput = Awaited<ReturnType<DecodeTokenFn>>;
9
- export declare function decodeJWTs({ token_sources, decodeJWT, jwt_audience }: IDecodeSeveralJwtsInputOptions, debug?: boolean): Promise<DecodeTokenOutput>;
9
+ export declare function decodeJWTs({ token_sources, decodeJWT, jwt_audience }: IDecodeSeveralJwtsInputOptions, debug?: boolean): Promise<UserData>;
10
10
  export default decodeJWTs;
@@ -1 +1 @@
1
- {"version":3,"file":"decode-jwts.js","sourceRoot":"","sources":["../../src/middleware/decode-jwts.ts"],"names":[],"mappings":"AAYA,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,EAAE,aAAa,EAAE,SAAS,EAAE,YAAY,EAAkC,EAC1E,QAAiB,KAAK;IAEtB,MAAM,eAAe,GAAW,aAAa,CAAC,MAAM,CAAC;IACrD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,eAAe,KAAK,CAAC,EAAE,CAAC;QAC3D,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAChE,CAAC;IACD,OAAO,CAAC,MAAM,CACZ,OAAO,eAAe,KAAK,QAAQ,IAAI,eAAe,GAAG,CAAC,EAC1D,oFAAoF,CACrF,CAAC;IAEF,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACnD,CAAC;IAED,MAAM,mBAAmB,GAAiC,aAAa,CAAC,GAAG,CACzE,UAAU,KAAkC;QAC1C,MAAM,IAAI,GAAmB,KAAK,CAAC,IAAI,CAAC;QAExC,MAAM,cAAc,GAA+B,SAAS,CAAC;YAC3D,IAAI;YACJ,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,YAAY;SACb,CAAC,CAAC;QACH,OAAO,cAAc,CAAC;IACxB,CAAC,CACF,CAAC;IAEF,MAAM,aAAa,GACjB,MAAM,OAAO,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC;IAEhD,MAAM,uBAAuB,GAAG,aAAa,CAAC,MAAM,CAClD,SAAS,kBAAkB,CACzB,MAA+C;QAE/C,OAAO,MAAM,CAAC,MAAM,KAAK,W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,CAAC;YAC9C,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YAC1B,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YAC1B,IAAI,OAAO,CAAC,GAAG,KAAK,OAAO,CAAC,GAAG,EAAE,CAAC;gBAChC,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;YAC1C,CAAC;YACD,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC;QACD,IAAI,QAAQ,CAAC,IAAI,KAAK,CAAC,IAAI,QAAQ,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;YAC/C,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;QACjE,CAAC;aAAM,IAAI,UAAU,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;QACpE,CAAC;IACH,CAAC;IACD,4BAA4B,EAAE,CAAC;IAE/B,4FAA4F;IAC5F,OAAO,CAAC,MAAM,CACZ,2BAA2B,IAAI,CAAC,EAChC,oGAAoG,CACrG,CAAC;IACF,MAAM,qBAAqB,GAAa,uBAAuB,CAAC,CAAC,CAAC,CAAC;IAEnE,OAAO,qBAAqB,CAAC;AAC/B,CAAC;AAED,eAAe,UAAU,CAAC"}
@@ -1,9 +1,6 @@
1
1
  import type { UserData } from "../user_data";
2
2
  import type { PotentiallyValidTokenSource } from "./token-source";
3
- import type { OrganizationID } from "../organizations";
4
3
  export interface DecodeTokenFnInputOptions extends PotentiallyValidTokenSource {
5
4
  jwt_audience: string;
6
5
  }
7
- export type DecodeTokenFn = (opts: DecodeTokenFnInputOptions) => Promise<UserData & {
8
- orgs: readonly OrganizationID[];
9
- }>;
6
+ export type DecodeTokenFn = (opts: DecodeTokenFnInputOptions) => Promise<UserData>;
@@ -1,4 +1,4 @@
1
- export { organizationIdSchema, isValidOrganizationID, RESERVED_ORGANIZATION_IDS } from "./organization_id";
1
+ export { organizationIdSchema, isValidOrganizationID, RESERVED_ORGANIZATION_IDS, } from "./organization_id";
2
2
  export type { OrganizationID } from "./organization_id";
3
3
  export { organizationDefinitionSchema } from "./organization_definition";
4
4
  export type { OrganizationDefinition } from "./organization_definition";
@@ -9,3 +9,5 @@ export { inviteMemberInputModes, inviteMemberFormSchema, } from "./invite_member
9
9
  export type { InviteMemberInputMode, InviteMemberFormValues, InviteMemberSubmitData, } from "./invite_member_form";
10
10
  export { organizationInvitationStatusTypes, organizationInvitationStatusSchema, organizationInvitationSchema, } from "./organization_invitation";
11
11
  export type { OrganizationInvitationStatus, OrganizationInvitation, UserPendingInvitation, OrganizationInvitationWithUserData, } from "./organization_invitation";
12
+ export { organizationMembershipRoleTypes, organizationMembershipRoleTypeSchema, isValidOrganizationMembershipRoleType, } from "./organization-membership-role-type";
13
+ export type { OrganizationMembershipRoleType } from "./organization-membership-role-type";
@@ -1,8 +1,9 @@
1
- export { organizationIdSchema, isValidOrganizationID, RESERVED_ORGANIZATION_IDS } from "./organization_id";
1
+ export { organizationIdSchema, isValidOrganizationID, RESERVED_ORGANIZATION_IDS, } from "./organization_id";
2
2
  export { organizationDefinitionSchema } from "./organization_definition";
3
3
  export { SCHEMAVAULTS_ORGANIZATION_ID } from "./schemavaults_org_id";
4
4
  export { hardcodedOrgs } from "./hardcoded_orgs";
5
5
  export { MAXIMUM_USER_ORGANIZATIONS, MINIMUM_ORGANIZATION_ID_LENGTH, MAXIMUM_ORGANIZATION_ID_LENGTH, } from "./organization_constants";
6
6
  export { inviteMemberInputModes, inviteMemberFormSchema, } from "./invite_member_form";
7
7
  export { organizationInvitationStatusTypes, organizationInvitationStatusSchema, organizationInvitationSchema, } from "./organization_invitation";
8
+ export { organizationMembershipRoleTypes, organizationMembershipRoleTypeSchema, isValidOrganizationMembershipRoleType, } from "./organization-membership-role-type";
8
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/organizations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAG3G,OAAO,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AAGzE,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAErE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EACL,0BAA0B,EAC1B,8BAA8B,EAC9B,8BAA8B,GAC/B,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAO9B,OAAO,EACL,iCAAiC,EACjC,kCAAkC,EAClC,4BAA4B,GAC7B,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/organizations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,yBAAyB,GAC1B,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AAGzE,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAErE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EACL,0BAA0B,EAC1B,8BAA8B,EAC9B,8BAA8B,GAC/B,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAO9B,OAAO,EACL,iCAAiC,EACjC,kCAAkC,EAClC,4BAA4B,GAC7B,MAAM,2BAA2B,CAAC;AAQnC,OAAO,EACL,+BAA+B,EAC/B,oCAAoC,EACpC,qCAAqC,GACtC,MAAM,qCAAqC,CAAC"}
@@ -8,19 +8,19 @@ export declare const inviteMemberFormSchema: z.ZodEffects<z.ZodObject<{
8
8
  identifier: z.ZodUnion<[z.ZodString, z.ZodString]>;
9
9
  }, "strict", z.ZodTypeAny, {
10
10
  organization_id: string;
11
- input_mode: "email" | "uid";
11
+ input_mode: "uid" | "email";
12
12
  identifier: string;
13
13
  }, {
14
14
  organization_id: string;
15
- input_mode: "email" | "uid";
15
+ input_mode: "uid" | "email";
16
16
  identifier: string;
17
17
  }>, {
18
18
  organization_id: string;
19
- input_mode: "email" | "uid";
19
+ input_mode: "uid" | "email";
20
20
  identifier: string;
21
21
  }, {
22
22
  organization_id: string;
23
- input_mode: "email" | "uid";
23
+ input_mode: "uid" | "email";
24
24
  identifier: string;
25
25
  }>;
26
26
  export type InviteMemberFormValues = z.infer<typeof inviteMemberFormSchema>;
@@ -0,0 +1,5 @@
1
+ import { z } from "zod";
2
+ export declare const organizationMembershipRoleTypes: readonly ["owner", "admin", "member"];
3
+ export type OrganizationMembershipRoleType = (typeof organizationMembershipRoleTypes)[number];
4
+ export declare const organizationMembershipRoleTypeSchema: z.ZodEffects<z.ZodString, "admin" | "owner" | "member", string>;
5
+ export declare function isValidOrganizationMembershipRoleType(role: string): role is OrganizationMembershipRoleType;
@@ -0,0 +1,19 @@
1
+ import { z } from "zod";
2
+ export const organizationMembershipRoleTypes = [
3
+ "owner",
4
+ "admin", // For virtual admin memberships in the schemavaults org
5
+ "member",
6
+ ];
7
+ export const organizationMembershipRoleTypeSchema = z.string().refine((maybeValidRole) => {
8
+ const validRoles = organizationMembershipRoleTypes;
9
+ if (validRoles.includes(maybeValidRole)) {
10
+ return true;
11
+ }
12
+ return false;
13
+ }, `Invalid organization membership role! Should be one of: ${organizationMembershipRoleTypes.map((s) => `'${s}'`).join(", ")}`);
14
+ export function isValidOrganizationMembershipRoleType(role) {
15
+ if (typeof role !== "string")
16
+ return false;
17
+ return organizationMembershipRoleTypeSchema.safeParse(role).success;
18
+ }
19
+ //# sourceMappingURL=organization-membership-role-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organization-membership-role-type.js","sourceRoot":"","sources":["../../src/organizations/organization-membership-role-type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,+BAA+B,GAAG;IAC7C,OAAO;IACP,OAAO,EAAE,wDAAwD;IACjE,QAAQ;CAC4B,CAAC;AAKvC,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CACnE,CACE,cAAsB,EAC4B,EAAE;IACpD,MAAM,UAAU,GAAsB,+BAA+B,CAAC;IACtE,IAAI,UAAU,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,EACD,2DAA2D,+BAA+B,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC7H,CAAC;AAEF,MAAM,UAAU,qCAAqC,CACnD,IAAY;IAEZ,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC3C,OAAO,oCAAoC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC;AACtE,CAAC"}
@@ -1,18 +1,18 @@
1
1
  import { z } from "zod";
2
2
  export declare const organizationDefinitionSchema: z.ZodObject<{
3
+ created_at: z.ZodNumber;
3
4
  organization_id: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
4
5
  name: z.ZodString;
5
- created_at: z.ZodNumber;
6
6
  created_by: z.ZodNullable<z.ZodOptional<z.ZodString>>;
7
7
  }, "strict", z.ZodTypeAny, {
8
+ created_at: number;
8
9
  organization_id: string;
9
10
  name: string;
10
- created_at: number;
11
11
  created_by?: string | null | undefined;
12
12
  }, {
13
+ created_at: number;
13
14
  organization_id: string;
14
15
  name: string;
15
- created_at: number;
16
16
  created_by?: string | null | undefined;
17
17
  }>;
18
18
  export type OrganizationDefinition = z.infer<typeof organizationDefinitionSchema>;
@@ -63,8 +63,8 @@ export declare const organizationInvitationSchema: z.ZodObject<{
63
63
  }, "strip", z.ZodTypeAny, {
64
64
  status: "pending" | "accepted" | "declined" | "revoked" | "expired";
65
65
  expires_at: number;
66
- organization_id: string;
67
66
  created_at: number;
67
+ organization_id: string;
68
68
  invitation_id: string;
69
69
  inviter_uid: string;
70
70
  invitee_uid: string;
@@ -75,8 +75,8 @@ export declare const organizationInvitationSchema: z.ZodObject<{
75
75
  }, {
76
76
  status: "pending" | "accepted" | "declined" | "revoked" | "expired";
77
77
  expires_at: number;
78
- organization_id: string;
79
78
  created_at: number;
79
+ organization_id: string;
80
80
  invitation_id: string;
81
81
  inviter_uid: string;
82
82
  invitee_uid: string;
@@ -6,7 +6,6 @@ export declare const successfullyGeneratedTokensRecordSchema: z.ZodEffects<z.Zod
6
6
  exp: z.ZodNumber;
7
7
  token: z.ZodString;
8
8
  aud: z.ZodString;
9
- orgs: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, "many">>;
10
9
  } & {
11
10
  type: z.ZodLiteral<"access">;
12
11
  }, "strict", z.ZodTypeAny, {
@@ -16,7 +15,6 @@ export declare const successfullyGeneratedTokensRecordSchema: z.ZodEffects<z.Zod
16
15
  exp: number;
17
16
  token: string;
18
17
  aud: string;
19
- orgs?: string[] | undefined;
20
18
  }, {
21
19
  type: "access";
22
20
  uid: string;
@@ -24,7 +22,6 @@ export declare const successfullyGeneratedTokensRecordSchema: z.ZodEffects<z.Zod
24
22
  exp: number;
25
23
  token: string;
26
24
  aud: string;
27
- orgs?: string[] | undefined;
28
25
  }>, z.ZodLiteral<"AS_HTTP_ONLY_COOKIE">]>>>;
29
26
  refresh: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
30
27
  uid: z.ZodString;
@@ -32,7 +29,6 @@ export declare const successfullyGeneratedTokensRecordSchema: z.ZodEffects<z.Zod
32
29
  exp: z.ZodNumber;
33
30
  token: z.ZodString;
34
31
  aud: z.ZodString;
35
- orgs: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, "many">>;
36
32
  } & {
37
33
  type: z.ZodLiteral<"refresh">;
38
34
  }, "strict", z.ZodTypeAny, {
@@ -42,7 +38,6 @@ export declare const successfullyGeneratedTokensRecordSchema: z.ZodEffects<z.Zod
42
38
  exp: number;
43
39
  token: string;
44
40
  aud: string;
45
- orgs?: string[] | undefined;
46
41
  }, {
47
42
  type: "refresh";
48
43
  uid: string;
@@ -50,7 +45,6 @@ export declare const successfullyGeneratedTokensRecordSchema: z.ZodEffects<z.Zod
50
45
  exp: number;
51
46
  token: string;
52
47
  aud: string;
53
- orgs?: string[] | undefined;
54
48
  }>, z.ZodLiteral<"AS_HTTP_ONLY_COOKIE">]>>;
55
49
  refresh_token_expiry: z.ZodOptional<z.ZodNumber>;
56
50
  }, "strict", z.ZodTypeAny, {
@@ -61,7 +55,6 @@ export declare const successfullyGeneratedTokensRecordSchema: z.ZodEffects<z.Zod
61
55
  exp: number;
62
56
  token: string;
63
57
  aud: string;
64
- orgs?: string[] | undefined;
65
58
  } | "AS_HTTP_ONLY_COOKIE" | undefined;
66
59
  access?: Record<string, {
67
60
  type: "access";
@@ -70,7 +63,6 @@ export declare const successfullyGeneratedTokensRecordSchema: z.ZodEffects<z.Zod
70
63
  exp: number;
71
64
  token: string;
72
65
  aud: string;
73
- orgs?: string[] | undefined;
74
66
  } | "AS_HTTP_ONLY_COOKIE"> | undefined;
75
67
  refresh_token_expiry?: number | undefined;
76
68
  }, {
@@ -81,7 +73,6 @@ export declare const successfullyGeneratedTokensRecordSchema: z.ZodEffects<z.Zod
81
73
  exp: number;
82
74
  token: string;
83
75
  aud: string;
84
- orgs?: string[] | undefined;
85
76
  } | "AS_HTTP_ONLY_COOKIE" | undefined;
86
77
  access?: Record<string, {
87
78
  type: "access";
@@ -90,7 +81,6 @@ export declare const successfullyGeneratedTokensRecordSchema: z.ZodEffects<z.Zod
90
81
  exp: number;
91
82
  token: string;
92
83
  aud: string;
93
- orgs?: string[] | undefined;
94
84
  } | "AS_HTTP_ONLY_COOKIE"> | undefined;
95
85
  refresh_token_expiry?: number | undefined;
96
86
  }>, {
@@ -101,7 +91,6 @@ export declare const successfullyGeneratedTokensRecordSchema: z.ZodEffects<z.Zod
101
91
  exp: number;
102
92
  token: string;
103
93
  aud: string;
104
- orgs?: string[] | undefined;
105
94
  } | "AS_HTTP_ONLY_COOKIE" | undefined;
106
95
  access?: Record<string, {
107
96
  type: "access";
@@ -110,7 +99,6 @@ export declare const successfullyGeneratedTokensRecordSchema: z.ZodEffects<z.Zod
110
99
  exp: number;
111
100
  token: string;
112
101
  aud: string;
113
- orgs?: string[] | undefined;
114
102
  } | "AS_HTTP_ONLY_COOKIE"> | undefined;
115
103
  refresh_token_expiry?: number | undefined;
116
104
  }, {
@@ -121,7 +109,6 @@ export declare const successfullyGeneratedTokensRecordSchema: z.ZodEffects<z.Zod
121
109
  exp: number;
122
110
  token: string;
123
111
  aud: string;
124
- orgs?: string[] | undefined;
125
112
  } | "AS_HTTP_ONLY_COOKIE" | undefined;
126
113
  access?: Record<string, {
127
114
  type: "access";
@@ -130,7 +117,6 @@ export declare const successfullyGeneratedTokensRecordSchema: z.ZodEffects<z.Zod
130
117
  exp: number;
131
118
  token: string;
132
119
  aud: string;
133
- orgs?: string[] | undefined;
134
120
  } | "AS_HTTP_ONLY_COOKIE"> | undefined;
135
121
  refresh_token_expiry?: number | undefined;
136
122
  }>, {
@@ -141,7 +127,6 @@ export declare const successfullyGeneratedTokensRecordSchema: z.ZodEffects<z.Zod
141
127
  exp: number;
142
128
  token: string;
143
129
  aud: string;
144
- orgs?: string[] | undefined;
145
130
  } | "AS_HTTP_ONLY_COOKIE" | undefined;
146
131
  access?: Record<string, {
147
132
  type: "access";
@@ -150,7 +135,6 @@ export declare const successfullyGeneratedTokensRecordSchema: z.ZodEffects<z.Zod
150
135
  exp: number;
151
136
  token: string;
152
137
  aud: string;
153
- orgs?: string[] | undefined;
154
138
  } | "AS_HTTP_ONLY_COOKIE"> | undefined;
155
139
  refresh_token_expiry?: number | undefined;
156
140
  }, {
@@ -161,7 +145,6 @@ export declare const successfullyGeneratedTokensRecordSchema: z.ZodEffects<z.Zod
161
145
  exp: number;
162
146
  token: string;
163
147
  aud: string;
164
- orgs?: string[] | undefined;
165
148
  } | "AS_HTTP_ONLY_COOKIE" | undefined;
166
149
  access?: Record<string, {
167
150
  type: "access";
@@ -170,7 +153,6 @@ export declare const successfullyGeneratedTokensRecordSchema: z.ZodEffects<z.Zod
170
153
  exp: number;
171
154
  token: string;
172
155
  aud: string;
173
- orgs?: string[] | undefined;
174
156
  } | "AS_HTTP_ONLY_COOKIE"> | undefined;
175
157
  refresh_token_expiry?: number | undefined;
176
158
  }>;
@@ -199,7 +181,6 @@ export declare const requestTokensResultSchema: z.ZodUnion<[z.ZodObject<{
199
181
  exp: z.ZodNumber;
200
182
  token: z.ZodString;
201
183
  aud: z.ZodString;
202
- orgs: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, "many">>;
203
184
  } & {
204
185
  type: z.ZodLiteral<"access">;
205
186
  }, "strict", z.ZodTypeAny, {
@@ -209,7 +190,6 @@ export declare const requestTokensResultSchema: z.ZodUnion<[z.ZodObject<{
209
190
  exp: number;
210
191
  token: string;
211
192
  aud: string;
212
- orgs?: string[] | undefined;
213
193
  }, {
214
194
  type: "access";
215
195
  uid: string;
@@ -217,7 +197,6 @@ export declare const requestTokensResultSchema: z.ZodUnion<[z.ZodObject<{
217
197
  exp: number;
218
198
  token: string;
219
199
  aud: string;
220
- orgs?: string[] | undefined;
221
200
  }>, z.ZodLiteral<"AS_HTTP_ONLY_COOKIE">]>>>;
222
201
  refresh: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
223
202
  uid: z.ZodString;
@@ -225,7 +204,6 @@ export declare const requestTokensResultSchema: z.ZodUnion<[z.ZodObject<{
225
204
  exp: z.ZodNumber;
226
205
  token: z.ZodString;
227
206
  aud: z.ZodString;
228
- orgs: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, "many">>;
229
207
  } & {
230
208
  type: z.ZodLiteral<"refresh">;
231
209
  }, "strict", z.ZodTypeAny, {
@@ -235,7 +213,6 @@ export declare const requestTokensResultSchema: z.ZodUnion<[z.ZodObject<{
235
213
  exp: number;
236
214
  token: string;
237
215
  aud: string;
238
- orgs?: string[] | undefined;
239
216
  }, {
240
217
  type: "refresh";
241
218
  uid: string;
@@ -243,7 +220,6 @@ export declare const requestTokensResultSchema: z.ZodUnion<[z.ZodObject<{
243
220
  exp: number;
244
221
  token: string;
245
222
  aud: string;
246
- orgs?: string[] | undefined;
247
223
  }>, z.ZodLiteral<"AS_HTTP_ONLY_COOKIE">]>>;
248
224
  refresh_token_expiry: z.ZodOptional<z.ZodNumber>;
249
225
  }, "strict", z.ZodTypeAny, {
@@ -254,7 +230,6 @@ export declare const requestTokensResultSchema: z.ZodUnion<[z.ZodObject<{
254
230
  exp: number;
255
231
  token: string;
256
232
  aud: string;
257
- orgs?: string[] | undefined;
258
233
  } | "AS_HTTP_ONLY_COOKIE" | undefined;
259
234
  access?: Record<string, {
260
235
  type: "access";
@@ -263,7 +238,6 @@ export declare const requestTokensResultSchema: z.ZodUnion<[z.ZodObject<{
263
238
  exp: number;
264
239
  token: string;
265
240
  aud: string;
266
- orgs?: string[] | undefined;
267
241
  } | "AS_HTTP_ONLY_COOKIE"> | undefined;
268
242
  refresh_token_expiry?: number | undefined;
269
243
  }, {
@@ -274,7 +248,6 @@ export declare const requestTokensResultSchema: z.ZodUnion<[z.ZodObject<{
274
248
  exp: number;
275
249
  token: string;
276
250
  aud: string;
277
- orgs?: string[] | undefined;
278
251
  } | "AS_HTTP_ONLY_COOKIE" | undefined;
279
252
  access?: Record<string, {
280
253
  type: "access";
@@ -283,7 +256,6 @@ export declare const requestTokensResultSchema: z.ZodUnion<[z.ZodObject<{
283
256
  exp: number;
284
257
  token: string;
285
258
  aud: string;
286
- orgs?: string[] | undefined;
287
259
  } | "AS_HTTP_ONLY_COOKIE"> | undefined;
288
260
  refresh_token_expiry?: number | undefined;
289
261
  }>, {
@@ -294,7 +266,6 @@ export declare const requestTokensResultSchema: z.ZodUnion<[z.ZodObject<{
294
266
  exp: number;
295
267
  token: string;
296
268
  aud: string;
297
- orgs?: string[] | undefined;
298
269
  } | "AS_HTTP_ONLY_COOKIE" | undefined;
299
270
  access?: Record<string, {
300
271
  type: "access";
@@ -303,7 +274,6 @@ export declare const requestTokensResultSchema: z.ZodUnion<[z.ZodObject<{
303
274
  exp: number;
304
275
  token: string;
305
276
  aud: string;
306
- orgs?: string[] | undefined;
307
277
  } | "AS_HTTP_ONLY_COOKIE"> | undefined;
308
278
  refresh_token_expiry?: number | undefined;
309
279
  }, {
@@ -314,7 +284,6 @@ export declare const requestTokensResultSchema: z.ZodUnion<[z.ZodObject<{
314
284
  exp: number;
315
285
  token: string;
316
286
  aud: string;
317
- orgs?: string[] | undefined;
318
287
  } | "AS_HTTP_ONLY_COOKIE" | undefined;
319
288
  access?: Record<string, {
320
289
  type: "access";
@@ -323,7 +292,6 @@ export declare const requestTokensResultSchema: z.ZodUnion<[z.ZodObject<{
323
292
  exp: number;
324
293
  token: string;
325
294
  aud: string;
326
- orgs?: string[] | undefined;
327
295
  } | "AS_HTTP_ONLY_COOKIE"> | undefined;
328
296
  refresh_token_expiry?: number | undefined;
329
297
  }>, {
@@ -334,7 +302,6 @@ export declare const requestTokensResultSchema: z.ZodUnion<[z.ZodObject<{
334
302
  exp: number;
335
303
  token: string;
336
304
  aud: string;
337
- orgs?: string[] | undefined;
338
305
  } | "AS_HTTP_ONLY_COOKIE" | undefined;
339
306
  access?: Record<string, {
340
307
  type: "access";
@@ -343,7 +310,6 @@ export declare const requestTokensResultSchema: z.ZodUnion<[z.ZodObject<{
343
310
  exp: number;
344
311
  token: string;
345
312
  aud: string;
346
- orgs?: string[] | undefined;
347
313
  } | "AS_HTTP_ONLY_COOKIE"> | undefined;
348
314
  refresh_token_expiry?: number | undefined;
349
315
  }, {
@@ -354,7 +320,6 @@ export declare const requestTokensResultSchema: z.ZodUnion<[z.ZodObject<{
354
320
  exp: number;
355
321
  token: string;
356
322
  aud: string;
357
- orgs?: string[] | undefined;
358
323
  } | "AS_HTTP_ONLY_COOKIE" | undefined;
359
324
  access?: Record<string, {
360
325
  type: "access";
@@ -363,26 +328,25 @@ export declare const requestTokensResultSchema: z.ZodUnion<[z.ZodObject<{
363
328
  exp: number;
364
329
  token: string;
365
330
  aud: string;
366
- orgs?: string[] | undefined;
367
331
  } | "AS_HTTP_ONLY_COOKIE"> | undefined;
368
332
  refresh_token_expiry?: number | undefined;
369
333
  }>>;
370
334
  userData: z.ZodOptional<z.ZodEffects<z.ZodObject<{
371
- created_at: z.ZodNumber;
372
- email: z.ZodString;
373
335
  uid: z.ZodString;
374
336
  sub: z.ZodString;
337
+ email: z.ZodString;
375
338
  email_verified: z.ZodOptional<z.ZodBoolean>;
376
339
  admin: z.ZodOptional<z.ZodBoolean>;
377
340
  phone_number: z.ZodOptional<z.ZodString>;
378
341
  phone_verified: z.ZodOptional<z.ZodBoolean>;
379
342
  disabled: z.ZodOptional<z.ZodBoolean>;
343
+ created_at: z.ZodNumber;
380
344
  invite_code: z.ZodOptional<z.ZodString>;
381
345
  }, "strict", z.ZodTypeAny, {
382
- created_at: number;
383
- email: string;
384
346
  uid: string;
385
347
  sub: string;
348
+ email: string;
349
+ created_at: number;
386
350
  email_verified?: boolean | undefined;
387
351
  admin?: boolean | undefined;
388
352
  phone_number?: string | undefined;
@@ -390,10 +354,10 @@ export declare const requestTokensResultSchema: z.ZodUnion<[z.ZodObject<{
390
354
  disabled?: boolean | undefined;
391
355
  invite_code?: string | undefined;
392
356
  }, {
393
- created_at: number;
394
- email: string;
395
357
  uid: string;
396
358
  sub: string;
359
+ email: string;
360
+ created_at: number;
397
361
  email_verified?: boolean | undefined;
398
362
  admin?: boolean | undefined;
399
363
  phone_number?: string | undefined;
@@ -401,10 +365,10 @@ export declare const requestTokensResultSchema: z.ZodUnion<[z.ZodObject<{
401
365
  disabled?: boolean | undefined;
402
366
  invite_code?: string | undefined;
403
367
  }>, {
404
- created_at: number;
405
- email: string;
406
368
  uid: string;
407
369
  sub: string;
370
+ email: string;
371
+ created_at: number;
408
372
  email_verified?: boolean | undefined;
409
373
  admin?: boolean | undefined;
410
374
  phone_number?: string | undefined;
@@ -412,10 +376,10 @@ export declare const requestTokensResultSchema: z.ZodUnion<[z.ZodObject<{
412
376
  disabled?: boolean | undefined;
413
377
  invite_code?: string | undefined;
414
378
  }, {
415
- created_at: number;
416
- email: string;
417
379
  uid: string;
418
380
  sub: string;
381
+ email: string;
382
+ created_at: number;
419
383
  email_verified?: boolean | undefined;
420
384
  admin?: boolean | undefined;
421
385
  phone_number?: string | undefined;
@@ -437,7 +401,6 @@ export declare const requestTokensResultSchema: z.ZodUnion<[z.ZodObject<{
437
401
  exp: number;
438
402
  token: string;
439
403
  aud: string;
440
- orgs?: string[] | undefined;
441
404
  } | "AS_HTTP_ONLY_COOKIE" | undefined;
442
405
  access?: Record<string, {
443
406
  type: "access";
@@ -446,15 +409,14 @@ export declare const requestTokensResultSchema: z.ZodUnion<[z.ZodObject<{
446
409
  exp: number;
447
410
  token: string;
448
411
  aud: string;
449
- orgs?: string[] | undefined;
450
412
  } | "AS_HTTP_ONLY_COOKIE"> | undefined;
451
413
  refresh_token_expiry?: number | undefined;
452
414
  } | undefined;
453
415
  userData?: {
454
- created_at: number;
455
- email: string;
456
416
  uid: string;
457
417
  sub: string;
418
+ email: string;
419
+ created_at: number;
458
420
  email_verified?: boolean | undefined;
459
421
  admin?: boolean | undefined;
460
422
  phone_number?: string | undefined;
@@ -476,7 +438,6 @@ export declare const requestTokensResultSchema: z.ZodUnion<[z.ZodObject<{
476
438
  exp: number;
477
439
  token: string;
478
440
  aud: string;
479
- orgs?: string[] | undefined;
480
441
  } | "AS_HTTP_ONLY_COOKIE" | undefined;
481
442
  access?: Record<string, {
482
443
  type: "access";
@@ -485,15 +446,14 @@ export declare const requestTokensResultSchema: z.ZodUnion<[z.ZodObject<{
485
446
  exp: number;
486
447
  token: string;
487
448
  aud: string;
488
- orgs?: string[] | undefined;
489
449
  } | "AS_HTTP_ONLY_COOKIE"> | undefined;
490
450
  refresh_token_expiry?: number | undefined;
491
451
  } | undefined;
492
452
  userData?: {
493
- created_at: number;
494
- email: string;
495
453
  uid: string;
496
454
  sub: string;
455
+ email: string;
456
+ created_at: number;
497
457
  email_verified?: boolean | undefined;
498
458
  admin?: boolean | undefined;
499
459
  phone_number?: string | undefined;
@@ -8,7 +8,6 @@ export declare const tokenDataSchema: z.ZodObject<{
8
8
  exp: z.ZodNumber;
9
9
  token: z.ZodString;
10
10
  aud: z.ZodString;
11
- orgs: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, "many">>;
12
11
  }, "strict", z.ZodTypeAny, {
13
12
  type: "refresh" | "access";
14
13
  uid: string;
@@ -16,7 +15,6 @@ export declare const tokenDataSchema: z.ZodObject<{
16
15
  exp: number;
17
16
  token: string;
18
17
  aud: string;
19
- orgs?: string[] | undefined;
20
18
  }, {
21
19
  type: "refresh" | "access";
22
20
  uid: string;
@@ -24,7 +22,6 @@ export declare const tokenDataSchema: z.ZodObject<{
24
22
  exp: number;
25
23
  token: string;
26
24
  aud: string;
27
- orgs?: string[] | undefined;
28
25
  }>;
29
26
  /**
30
27
  * @name AuthToken
@@ -39,7 +36,6 @@ export declare const refreshTokenDataSchema: z.ZodObject<{
39
36
  exp: z.ZodNumber;
40
37
  token: z.ZodString;
41
38
  aud: z.ZodString;
42
- orgs: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, "many">>;
43
39
  } & {
44
40
  type: z.ZodLiteral<"refresh">;
45
41
  }, "strict", z.ZodTypeAny, {
@@ -49,7 +45,6 @@ export declare const refreshTokenDataSchema: z.ZodObject<{
49
45
  exp: number;
50
46
  token: string;
51
47
  aud: string;
52
- orgs?: string[] | undefined;
53
48
  }, {
54
49
  type: "refresh";
55
50
  uid: string;
@@ -57,7 +52,6 @@ export declare const refreshTokenDataSchema: z.ZodObject<{
57
52
  exp: number;
58
53
  token: string;
59
54
  aud: string;
60
- orgs?: string[] | undefined;
61
55
  }>;
62
56
  export declare const accessTokenDataSchema: z.ZodObject<{
63
57
  uid: z.ZodString;
@@ -65,7 +59,6 @@ export declare const accessTokenDataSchema: z.ZodObject<{
65
59
  exp: z.ZodNumber;
66
60
  token: z.ZodString;
67
61
  aud: z.ZodString;
68
- orgs: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, "many">>;
69
62
  } & {
70
63
  type: z.ZodLiteral<"access">;
71
64
  }, "strict", z.ZodTypeAny, {
@@ -75,7 +68,6 @@ export declare const accessTokenDataSchema: z.ZodObject<{
75
68
  exp: number;
76
69
  token: string;
77
70
  aud: string;
78
- orgs?: string[] | undefined;
79
71
  }, {
80
72
  type: "access";
81
73
  uid: string;
@@ -83,7 +75,6 @@ export declare const accessTokenDataSchema: z.ZodObject<{
83
75
  exp: number;
84
76
  token: string;
85
77
  aud: string;
86
- orgs?: string[] | undefined;
87
78
  }>;
88
79
  /**
89
80
  * @name RefreshToken
@@ -1,4 +1,3 @@
1
- import { organizationIdSchema } from "../organizations";
2
1
  import { z } from "zod";
3
2
  const validTokenTypes = z.union([z.literal("refresh"), z.literal("access")]);
4
3
  export const tokenDataSchema = z
@@ -9,7 +8,6 @@ export const tokenDataSchema = z
9
8
  exp: z.number(),
10
9
  token: z.string(),
11
10
  aud: z.string(),
12
- orgs: organizationIdSchema.array().optional(),
13
11
  })
14
12
  .required({
15
13
  type: true,
@@ -1 +1 @@
1
- {"version":3,"file":"token-data.js","sourceRoot":"","sources":["../../src/token-data/token-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AAG7E,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC;KAC7B,MAAM,CAAC;IACN,IAAI,EAAE,eAAe;IACrB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,IAAI,EAAE,oBAAoB,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE;CAC9C,CAAC;KACD,QAAQ,CAAC;IACR,IAAI,EAAE,IAAI;IACV,GAAG,EAAE,IAAI;IACT,GAAG,EAAE,IAAI;IACT,GAAG,EAAE,IAAI;IACT,KAAK,EAAE,IAAI;IACX,GAAG,EAAE,IAAI;CACV,CAAC;KACD,MAAM,EAAE,CAAC;AAUZ,MAAM,CAAC,MAAM,sBAAsB,GAAG,eAAe,CAAC,MAAM,CAAC;IAC3D,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;CAC3B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAG,eAAe,CAAC,MAAM,CAAC;IAC1D,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;CAC1B,CAAC,CAAC"}
1
+ {"version":3,"file":"token-data.js","sourceRoot":"","sources":["../../src/token-data/token-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AAG7E,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC;KAC7B,MAAM,CAAC;IACN,IAAI,EAAE,eAAe;IACrB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;CAChB,CAAC;KACD,QAAQ,CAAC;IACR,IAAI,EAAE,IAAI;IACV,GAAG,EAAE,IAAI;IACT,GAAG,EAAE,IAAI;IACT,GAAG,EAAE,IAAI;IACT,KAAK,EAAE,IAAI;IACX,GAAG,EAAE,IAAI;CACV,CAAC;KACD,MAAM,EAAE,CAAC;AAUZ,MAAM,CAAC,MAAM,sBAAsB,GAAG,eAAe,CAAC,MAAM,CAAC;IAC3D,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;CAC3B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAG,eAAe,CAAC,MAAM,CAAC;IAC1D,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;CAC1B,CAAC,CAAC"}
@@ -1,20 +1,20 @@
1
1
  import { z } from "zod";
2
2
  export declare const userDataSchema: z.ZodEffects<z.ZodObject<{
3
- created_at: z.ZodNumber;
4
- email: z.ZodString;
5
3
  uid: z.ZodString;
6
4
  sub: z.ZodString;
5
+ email: z.ZodString;
7
6
  email_verified: z.ZodOptional<z.ZodBoolean>;
8
7
  admin: z.ZodOptional<z.ZodBoolean>;
9
8
  phone_number: z.ZodOptional<z.ZodString>;
10
9
  phone_verified: z.ZodOptional<z.ZodBoolean>;
11
10
  disabled: z.ZodOptional<z.ZodBoolean>;
11
+ created_at: z.ZodNumber;
12
12
  invite_code: z.ZodOptional<z.ZodString>;
13
13
  }, "strict", z.ZodTypeAny, {
14
- created_at: number;
15
- email: string;
16
14
  uid: string;
17
15
  sub: string;
16
+ email: string;
17
+ created_at: number;
18
18
  email_verified?: boolean | undefined;
19
19
  admin?: boolean | undefined;
20
20
  phone_number?: string | undefined;
@@ -22,10 +22,10 @@ export declare const userDataSchema: z.ZodEffects<z.ZodObject<{
22
22
  disabled?: boolean | undefined;
23
23
  invite_code?: string | undefined;
24
24
  }, {
25
- created_at: number;
26
- email: string;
27
25
  uid: string;
28
26
  sub: string;
27
+ email: string;
28
+ created_at: number;
29
29
  email_verified?: boolean | undefined;
30
30
  admin?: boolean | undefined;
31
31
  phone_number?: string | undefined;
@@ -33,10 +33,10 @@ export declare const userDataSchema: z.ZodEffects<z.ZodObject<{
33
33
  disabled?: boolean | undefined;
34
34
  invite_code?: string | undefined;
35
35
  }>, {
36
- created_at: number;
37
- email: string;
38
36
  uid: string;
39
37
  sub: string;
38
+ email: string;
39
+ created_at: number;
40
40
  email_verified?: boolean | undefined;
41
41
  admin?: boolean | undefined;
42
42
  phone_number?: string | undefined;
@@ -44,10 +44,10 @@ export declare const userDataSchema: z.ZodEffects<z.ZodObject<{
44
44
  disabled?: boolean | undefined;
45
45
  invite_code?: string | undefined;
46
46
  }, {
47
- created_at: number;
48
- email: string;
49
47
  uid: string;
50
48
  sub: string;
49
+ email: string;
50
+ created_at: number;
51
51
  email_verified?: boolean | undefined;
52
52
  admin?: boolean | undefined;
53
53
  phone_number?: string | undefined;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@schemavaults/auth-common",
3
3
  "description": "Types and utility functions for authentication and authorization",
4
- "version": "0.9.8",
4
+ "version": "0.10.1",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
7
7
  "repository": {
@@ -71,6 +71,16 @@
71
71
  "types": "./dist/auth-error-message-catalog.d.ts",
72
72
  "import": "./dist/auth-error-message-catalog.js",
73
73
  "require": "./dist/auth-error-message-catalog.js"
74
+ },
75
+ "./organizations": {
76
+ "types": "./dist/organizations/index.d.ts",
77
+ "import": "./dist/organizations/index.js",
78
+ "require": "./dist/organizations/index.js"
79
+ },
80
+ "./organizations/*": {
81
+ "types": "./dist/organizations/*",
82
+ "import": "./dist/organizations/*",
83
+ "require": "./dist/organizations/*"
74
84
  }
75
85
  }
76
86
  }