@schemavaults/auth-common 0.12.2 → 0.12.9
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 +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/middleware/default-auth-middleware-rules.d.ts +1 -1
- package/dist/middleware/default-auth-middleware-rules.js +1 -0
- package/dist/middleware/default-auth-middleware-rules.js.map +1 -1
- package/dist/organizations/index.d.ts +4 -0
- package/dist/organizations/index.js +2 -0
- package/dist/organizations/index.js.map +1 -1
- package/dist/organizations/organization_definition.js +1 -5
- package/dist/organizations/organization_definition.js.map +1 -1
- package/dist/organizations/organization_membership_role_details.d.ts +44 -0
- package/dist/organizations/organization_membership_role_details.js +24 -0
- package/dist/organizations/organization_membership_role_details.js.map +1 -0
- package/dist/organizations/organization_name.d.ts +4 -0
- package/dist/organizations/organization_name.js +11 -0
- package/dist/organizations/organization_name.js.map +1 -0
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -20,8 +20,8 @@ export { appIdSchema } from "@schemavaults/app-definitions";
|
|
|
20
20
|
export { audienceSchema, audienceRefSchema } from "./audience-schema";
|
|
21
21
|
export { inviteCodeFormatSchema, inviteCodeDefinitionSchema, } from "./invite-code";
|
|
22
22
|
export type { InviteCode, InviteCodeDefinition } from "./invite-code";
|
|
23
|
-
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";
|
|
24
|
-
export type { OrganizationID, OrganizationDefinition, InviteMemberInputMode, InviteMemberFormValues, InviteMemberSubmitData, OrganizationInvitationStatus, OrganizationInvitation, UserPendingInvitation, OrganizationInvitationWithUserData, OrganizationMembershipRoleType, } from "./organizations";
|
|
23
|
+
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, organizationMembershipRoleDetailsSchema, isValidOrganizationMembershipRoleDetails, } from "./organizations";
|
|
24
|
+
export type { OrganizationID, OrganizationDefinition, InviteMemberInputMode, InviteMemberFormValues, InviteMemberSubmitData, OrganizationInvitationStatus, OrganizationInvitation, UserPendingInvitation, OrganizationInvitationWithUserData, OrganizationMembershipRoleType, OrganizationMembershipRoleDetails, } from "./organizations";
|
|
25
25
|
export { MaximumBrowserCookieSize } from "./MaximumBrowserCookieSize";
|
|
26
26
|
export { RefreshTokenCookieName, RefreshTokenExpiryCookieName, } from "./RefreshTokenCookieNames";
|
|
27
27
|
export { AccessTokenCookieName, AccessTokenExpiryCookieName, } from "./AccessTokenCookieNames";
|
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ export { PRODUCTION_AUTH_SERVER_URL } from "@schemavaults/app-definitions";
|
|
|
13
13
|
export { appIdSchema } from "@schemavaults/app-definitions";
|
|
14
14
|
export { audienceSchema, audienceRefSchema } from "./audience-schema";
|
|
15
15
|
export { inviteCodeFormatSchema, inviteCodeDefinitionSchema, } from "./invite-code";
|
|
16
|
-
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
|
+
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, organizationMembershipRoleDetailsSchema, isValidOrganizationMembershipRoleDetails, } from "./organizations";
|
|
17
17
|
export { MaximumBrowserCookieSize } from "./MaximumBrowserCookieSize";
|
|
18
18
|
export { RefreshTokenCookieName, RefreshTokenExpiryCookieName, } from "./RefreshTokenCookieNames";
|
|
19
19
|
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,EACL,qBAAqB,EACrB,cAAc,GACf,MAAM,8BAA8B,CAAC;AAGtC,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,EACxB,qCAAqC,EACrC,mCAAmC,EACnC,+BAA+B,EAC/B,wCAAwC,GAMzC,MAAM,uBAAuB,CAAC;AAE/B,cAAc,OAAO,CAAC;AACtB,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,sBAAsB,EACtB,sBAAsB,EACtB,iCAAiC,EACjC,kCAAkC,EAClC,4BAA4B,EAC5B,+BAA+B,EAC/B,oCAAoC,EACpC,qCAAqC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,cAAc,GACf,MAAM,8BAA8B,CAAC;AAGtC,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,EACxB,qCAAqC,EACrC,mCAAmC,EACnC,+BAA+B,EAC/B,wCAAwC,GAMzC,MAAM,uBAAuB,CAAC;AAE/B,cAAc,OAAO,CAAC;AACtB,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,sBAAsB,EACtB,sBAAsB,EACtB,iCAAiC,EACjC,kCAAkC,EAClC,4BAA4B,EAC5B,+BAA+B,EAC/B,oCAAoC,EACpC,qCAAqC,EACrC,uCAAuC,EACvC,wCAAwC,GACzC,MAAM,iBAAiB,CAAC;AAezB,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;AAGtB,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,OAAO,EACL,iBAAiB,EACjB,yBAAyB,EACzB,gBAAgB,EAChB,0BAA0B,GAC3B,MAAM,uBAAuB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const defaultAuthMiddlewareRules: {
|
|
2
|
-
readonly public: [[], ["auth", "logout"], ["auth", "authorize"], ["api", "auth", "token"], ["api", "auth", "logout"], ["api", "environment"], ["error"]];
|
|
2
|
+
readonly public: [[], ["auth", "logout"], ["auth", "authorize"], ["api", "auth", "token"], ["api", "auth", "logout"], ["api", "environment"], ["error"], ["auth", "error"]];
|
|
3
3
|
readonly unauthed: [["auth", "login"], ["auth", "register"], ["auth", "forgot-password"]];
|
|
4
4
|
readonly authed: [["account"], ["auth", "account"]];
|
|
5
5
|
readonly admin: [["admin"]];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-auth-middleware-rules.js","sourceRoot":"","sources":["../../src/middleware/default-auth-middleware-rules.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,MAAM,EAAE;QACN,EAAE,EAAE,0BAA0B;QAC9B,CAAC,MAAM,EAAE,QAAQ,CAAC;QAClB,CAAC,MAAM,EAAE,WAAW,CAAC;QACrB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC;QACxB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC;QACzB,CAAC,KAAK,EAAE,aAAa,CAAC,EAAE,0EAA0E;QAClG,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"default-auth-middleware-rules.js","sourceRoot":"","sources":["../../src/middleware/default-auth-middleware-rules.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,MAAM,EAAE;QACN,EAAE,EAAE,0BAA0B;QAC9B,CAAC,MAAM,EAAE,QAAQ,CAAC;QAClB,CAAC,MAAM,EAAE,WAAW,CAAC;QACrB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC;QACxB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC;QACzB,CAAC,KAAK,EAAE,aAAa,CAAC,EAAE,0EAA0E;QAClG,CAAC,OAAO,CAAC;QACT,CAAC,MAAM,EAAE,OAAO,CAAC;KAClB;IACD,QAAQ,EAAE;QACR,CAAC,MAAM,EAAE,OAAO,CAAC;QACjB,CAAC,MAAM,EAAE,UAAU,CAAC;QACpB,CAAC,MAAM,EAAE,iBAAiB,CAAC;KAC5B;IACD,MAAM,EAAE;QACN,mDAAmD;QACnD,CAAC,SAAS,CAAC;QACX,CAAC,MAAM,EAAE,SAAS,CAAC;KACpB;IACD,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;IAClB,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;CACc,CAAC"}
|
|
@@ -2,6 +2,8 @@ export { organizationIdSchema, isValidOrganizationID, RESERVED_ORGANIZATION_IDS,
|
|
|
2
2
|
export type { OrganizationID } from "./organization_id";
|
|
3
3
|
export { organizationDefinitionSchema } from "./organization_definition";
|
|
4
4
|
export type { OrganizationDefinition } from "./organization_definition";
|
|
5
|
+
export { organizationNameSchema, isValidOrganizationName, } from "./organization_name";
|
|
6
|
+
export type { OrganizationName } from "./organization_name";
|
|
5
7
|
export { SCHEMAVAULTS_ORGANIZATION_ID } from "./schemavaults_org_id";
|
|
6
8
|
export { hardcodedOrgs } from "./hardcoded_orgs";
|
|
7
9
|
export { MAXIMUM_USER_ORGANIZATIONS, MINIMUM_ORGANIZATION_ID_LENGTH, MAXIMUM_ORGANIZATION_ID_LENGTH, } from "./organization_constants";
|
|
@@ -11,3 +13,5 @@ export { organizationInvitationStatusTypes, organizationInvitationStatusSchema,
|
|
|
11
13
|
export type { OrganizationInvitationStatus, OrganizationInvitation, UserPendingInvitation, OrganizationInvitationWithUserData, } from "./organization_invitation";
|
|
12
14
|
export { organizationMembershipRoleTypes, organizationMembershipRoleTypeSchema, isValidOrganizationMembershipRoleType, } from "./organization-membership-role-type";
|
|
13
15
|
export type { OrganizationMembershipRoleType } from "./organization-membership-role-type";
|
|
16
|
+
export { organizationMembershipRoleDetailsSchema, isValidOrganizationMembershipRoleDetails, } from "./organization_membership_role_details";
|
|
17
|
+
export type { OrganizationMembershipRoleDetails } from "./organization_membership_role_details";
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export { organizationIdSchema, isValidOrganizationID, RESERVED_ORGANIZATION_IDS, } from "./organization_id";
|
|
2
2
|
export { organizationDefinitionSchema } from "./organization_definition";
|
|
3
|
+
export { organizationNameSchema, isValidOrganizationName, } from "./organization_name";
|
|
3
4
|
export { SCHEMAVAULTS_ORGANIZATION_ID } from "./schemavaults_org_id";
|
|
4
5
|
export { hardcodedOrgs } from "./hardcoded_orgs";
|
|
5
6
|
export { MAXIMUM_USER_ORGANIZATIONS, MINIMUM_ORGANIZATION_ID_LENGTH, MAXIMUM_ORGANIZATION_ID_LENGTH, } from "./organization_constants";
|
|
6
7
|
export { inviteMemberInputModes, inviteMemberFormSchema, } from "./invite_member_form";
|
|
7
8
|
export { organizationInvitationStatusTypes, organizationInvitationStatusSchema, organizationInvitationSchema, } from "./organization_invitation";
|
|
8
9
|
export { organizationMembershipRoleTypes, organizationMembershipRoleTypeSchema, isValidOrganizationMembershipRoleType, } from "./organization-membership-role-type";
|
|
10
|
+
export { organizationMembershipRoleDetailsSchema, isValidOrganizationMembershipRoleDetails, } from "./organization_membership_role_details";
|
|
9
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
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"}
|
|
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,EACL,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,qBAAqB,CAAC;AAG7B,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;AAG7C,OAAO,EACL,uCAAuC,EACvC,wCAAwC,GACzC,MAAM,wCAAwC,CAAC"}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { organizationIdSchema } from "./organization_id";
|
|
3
|
-
import {
|
|
4
|
-
const organizationNameSchema = z
|
|
5
|
-
.string()
|
|
6
|
-
.min(MINIMUM_ORGANIZATION_NAME_LENGTH, `Organization name must be at least ${MINIMUM_ORGANIZATION_NAME_LENGTH} character${MINIMUM_ORGANIZATION_NAME_LENGTH >= 2 ? "s" : ""} long.`)
|
|
7
|
-
.max(MAXIMUM_ORGANIZATION_NAME_LENGTH, `Organization name may not be longer than ${MAXIMUM_ORGANIZATION_NAME_LENGTH} characters long.`);
|
|
3
|
+
import { organizationNameSchema } from "./organization_name";
|
|
8
4
|
export const organizationDefinitionSchema = z
|
|
9
5
|
.object({
|
|
10
6
|
organization_id: organizationIdSchema,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"organization_definition.js","sourceRoot":"","sources":["../../src/organizations/organization_definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,
|
|
1
|
+
{"version":3,"file":"organization_definition.js","sourceRoot":"","sources":["../../src/organizations/organization_definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC;KAC1C,MAAM,CAAC;IACN,eAAe,EAAE,oBAAoB;IACrC,IAAI,EAAE,sBAAsB;IAC5B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;CACpD,CAAC;KACD,QAAQ,CAAC;IACR,eAAe,EAAE,IAAI;IACrB,IAAI,EAAE,IAAI;IACV,UAAU,EAAE,IAAI;CACjB,CAAC;KACD,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { OrganizationMembershipRoleType } from "./organization-membership-role-type";
|
|
3
|
+
/**
|
|
4
|
+
* A single organization-membership row, as returned by
|
|
5
|
+
* `GET /api/me/organizations`. Carries enough info to display a button
|
|
6
|
+
* linking to the org plus the user's role badge.
|
|
7
|
+
*
|
|
8
|
+
* `created_at` is the **organization's** creation timestamp (mirrors
|
|
9
|
+
* `OrganizationDefinition.created_at`).
|
|
10
|
+
* `joined_at` is the timestamp at which **this user** acquired their
|
|
11
|
+
* current role in the organization (the underlying membership row's
|
|
12
|
+
* `created_at` in the database).
|
|
13
|
+
*
|
|
14
|
+
* Distinct from `OrganizationMembershipRoleType` (the role enum) and from
|
|
15
|
+
* the auth-server's internal `OrganizationMembershipRoleDefinition` (DB
|
|
16
|
+
* row shape with `uid` + `membership_declaration_id`).
|
|
17
|
+
*/
|
|
18
|
+
export interface OrganizationMembershipRoleDetails {
|
|
19
|
+
organization_id: string;
|
|
20
|
+
organization_name: string;
|
|
21
|
+
role: OrganizationMembershipRoleType;
|
|
22
|
+
created_at: number;
|
|
23
|
+
joined_at: number;
|
|
24
|
+
}
|
|
25
|
+
export declare const organizationMembershipRoleDetailsSchema: z.ZodObject<{
|
|
26
|
+
created_at: z.ZodNumber;
|
|
27
|
+
organization_id: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
28
|
+
organization_name: z.ZodString;
|
|
29
|
+
joined_at: z.ZodNumber;
|
|
30
|
+
role: z.ZodType<"admin" | "owner" | "member", z.ZodTypeDef, "admin" | "owner" | "member">;
|
|
31
|
+
}, "strict", z.ZodTypeAny, {
|
|
32
|
+
created_at: number;
|
|
33
|
+
organization_id: string;
|
|
34
|
+
organization_name: string;
|
|
35
|
+
joined_at: number;
|
|
36
|
+
role: "admin" | "owner" | "member";
|
|
37
|
+
}, {
|
|
38
|
+
created_at: number;
|
|
39
|
+
organization_id: string;
|
|
40
|
+
organization_name: string;
|
|
41
|
+
joined_at: number;
|
|
42
|
+
role: "admin" | "owner" | "member";
|
|
43
|
+
}>;
|
|
44
|
+
export declare function isValidOrganizationMembershipRoleDetails(value: unknown): value is OrganizationMembershipRoleDetails;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { organizationIdSchema } from "./organization_id";
|
|
3
|
+
import { organizationNameSchema } from "./organization_name";
|
|
4
|
+
import { organizationMembershipRoleTypeSchema } from "./organization-membership-role-type";
|
|
5
|
+
export const organizationMembershipRoleDetailsSchema = z
|
|
6
|
+
.object({
|
|
7
|
+
organization_id: organizationIdSchema,
|
|
8
|
+
organization_name: organizationNameSchema,
|
|
9
|
+
role: organizationMembershipRoleTypeSchema,
|
|
10
|
+
created_at: z.number().int().nonnegative(),
|
|
11
|
+
joined_at: z.number().int().nonnegative(),
|
|
12
|
+
})
|
|
13
|
+
.required({
|
|
14
|
+
organization_id: true,
|
|
15
|
+
organization_name: true,
|
|
16
|
+
role: true,
|
|
17
|
+
created_at: true,
|
|
18
|
+
joined_at: true,
|
|
19
|
+
})
|
|
20
|
+
.strict();
|
|
21
|
+
export function isValidOrganizationMembershipRoleDetails(value) {
|
|
22
|
+
return organizationMembershipRoleDetailsSchema.safeParse(value).success;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=organization_membership_role_details.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"organization_membership_role_details.js","sourceRoot":"","sources":["../../src/organizations/organization_membership_role_details.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,oCAAoC,EAAE,MAAM,qCAAqC,CAAC;AA0B3F,MAAM,CAAC,MAAM,uCAAuC,GAAG,CAAC;KACrD,MAAM,CAAC;IACN,eAAe,EAAE,oBAAoB;IACrC,iBAAiB,EAAE,sBAAsB;IACzC,IAAI,EAAE,oCAAiF;IACvF,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;IAC1C,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;CAC1C,CAAC;KACD,QAAQ,CAAC;IACR,eAAe,EAAE,IAAI;IACrB,iBAAiB,EAAE,IAAI;IACvB,IAAI,EAAE,IAAI;IACV,UAAU,EAAE,IAAI;IAChB,SAAS,EAAE,IAAI;CAChB,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ,MAAM,UAAU,wCAAwC,CACtD,KAAc;IAEd,OAAO,uCAAuC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC1E,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const organizationNameSchema: z.ZodString;
|
|
3
|
+
export type OrganizationName = z.infer<typeof organizationNameSchema>;
|
|
4
|
+
export declare function isValidOrganizationName(organization_name: string): organization_name is OrganizationName;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { MAXIMUM_ORGANIZATION_NAME_LENGTH, MINIMUM_ORGANIZATION_NAME_LENGTH, } from "./organization_constants";
|
|
3
|
+
export const organizationNameSchema = z
|
|
4
|
+
.string()
|
|
5
|
+
.min(MINIMUM_ORGANIZATION_NAME_LENGTH, `Organization name must be at least ${MINIMUM_ORGANIZATION_NAME_LENGTH} character${MINIMUM_ORGANIZATION_NAME_LENGTH >= 2 ? "s" : ""} long.`)
|
|
6
|
+
.max(MAXIMUM_ORGANIZATION_NAME_LENGTH, `Organization name may not be longer than ${MAXIMUM_ORGANIZATION_NAME_LENGTH} characters long.`)
|
|
7
|
+
.regex(/^[a-zA-Z0-9]([a-zA-Z0-9 _-]*[a-zA-Z0-9])?$/, "Organization name may only contain alphanumeric characters, spaces, hyphens, and underscores, and must start and end with an alphanumeric character.");
|
|
8
|
+
export function isValidOrganizationName(organization_name) {
|
|
9
|
+
return organizationNameSchema.safeParse(organization_name).success;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=organization_name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"organization_name.js","sourceRoot":"","sources":["../../src/organizations/organization_name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,gCAAgC,EAChC,gCAAgC,GACjC,MAAM,0BAA0B,CAAC;AAElC,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC;KACpC,MAAM,EAAE;KACR,GAAG,CACF,gCAAgC,EAChC,sCAAsC,gCAAgC,aAAa,gCAAgC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,QAAQ,CAC5I;KACA,GAAG,CACF,gCAAgC,EAChC,4CAA4C,gCAAgC,mBAAmB,CAChG;KACA,KAAK,CACJ,4CAA4C,EAC5C,sJAAsJ,CACvJ,CAAC;AAIJ,MAAM,UAAU,uBAAuB,CACrC,iBAAyB;IAEzB,OAAO,sBAAsB,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC;AACrE,CAAC"}
|
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.12.
|
|
4
|
+
"version": "0.12.9",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"private": false,
|
|
7
7
|
"repository": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"types": "dist/index.d.ts",
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"zod": "3.25.8",
|
|
17
|
-
"@schemavaults/app-definitions": "0.7.
|
|
17
|
+
"@schemavaults/app-definitions": "0.7.1",
|
|
18
18
|
"crypto-js": "4.2.0"
|
|
19
19
|
},
|
|
20
20
|
"scripts": {
|