@sudobility/types 1.9.37 → 1.9.38

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.
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview Entity Type Definitions
4
+ * @description Core types for the entity/organization system used across shapeshyft and whisperly
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.InvitationStatus = exports.EntityRole = exports.EntityType = void 0;
8
+ // ========================================
9
+ // ENUMS
10
+ // ========================================
11
+ /**
12
+ * Type of entity.
13
+ * - personal: Auto-created for each user, cannot be deleted
14
+ * - organization: User-created, supports multiple members
15
+ */
16
+ var EntityType;
17
+ (function (EntityType) {
18
+ EntityType["PERSONAL"] = "personal";
19
+ EntityType["ORGANIZATION"] = "organization";
20
+ })(EntityType || (exports.EntityType = EntityType = {}));
21
+ /**
22
+ * Role of a user within an entity.
23
+ * Determines permissions for various operations.
24
+ */
25
+ var EntityRole;
26
+ (function (EntityRole) {
27
+ /** Full access: manage entity, members, projects, and API keys */
28
+ EntityRole["ADMIN"] = "admin";
29
+ /** Can create/edit projects and API keys, but cannot manage members */
30
+ EntityRole["MANAGER"] = "manager";
31
+ /** Read-only access to projects and API keys */
32
+ EntityRole["VIEWER"] = "viewer";
33
+ })(EntityRole || (exports.EntityRole = EntityRole = {}));
34
+ /**
35
+ * Status of an entity invitation.
36
+ */
37
+ var InvitationStatus;
38
+ (function (InvitationStatus) {
39
+ /** Invitation sent, awaiting response */
40
+ InvitationStatus["PENDING"] = "pending";
41
+ /** Invitation accepted, user is now a member */
42
+ InvitationStatus["ACCEPTED"] = "accepted";
43
+ /** Invitation declined by the invitee */
44
+ InvitationStatus["DECLINED"] = "declined";
45
+ /** Invitation expired (not accepted within time limit) */
46
+ InvitationStatus["EXPIRED"] = "expired";
47
+ })(InvitationStatus || (exports.InvitationStatus = InvitationStatus = {}));
48
+ //# sourceMappingURL=entity.js.map
@@ -0,0 +1,135 @@
1
+ /**
2
+ * @fileoverview Entity Type Definitions
3
+ * @description Core types for the entity/organization system used across shapeshyft and whisperly
4
+ */
5
+ /**
6
+ * Type of entity.
7
+ * - personal: Auto-created for each user, cannot be deleted
8
+ * - organization: User-created, supports multiple members
9
+ */
10
+ export declare enum EntityType {
11
+ PERSONAL = "personal",
12
+ ORGANIZATION = "organization"
13
+ }
14
+ /**
15
+ * Role of a user within an entity.
16
+ * Determines permissions for various operations.
17
+ */
18
+ export declare enum EntityRole {
19
+ /** Full access: manage entity, members, projects, and API keys */
20
+ ADMIN = "admin",
21
+ /** Can create/edit projects and API keys, but cannot manage members */
22
+ MANAGER = "manager",
23
+ /** Read-only access to projects and API keys */
24
+ VIEWER = "viewer"
25
+ }
26
+ /**
27
+ * Status of an entity invitation.
28
+ */
29
+ export declare enum InvitationStatus {
30
+ /** Invitation sent, awaiting response */
31
+ PENDING = "pending",
32
+ /** Invitation accepted, user is now a member */
33
+ ACCEPTED = "accepted",
34
+ /** Invitation declined by the invitee */
35
+ DECLINED = "declined",
36
+ /** Invitation expired (not accepted within time limit) */
37
+ EXPIRED = "expired"
38
+ }
39
+ /**
40
+ * An entity represents a workspace that can own projects and API keys.
41
+ * Can be either a personal workspace (one per user) or an organization (shared).
42
+ */
43
+ export interface Entity {
44
+ /** Unique identifier (UUID) */
45
+ id: string;
46
+ /** URL-friendly slug (8-12 alphanumeric characters) */
47
+ entitySlug: string;
48
+ /** Type of entity: personal or organization */
49
+ entityType: EntityType;
50
+ /** Display name shown in UI */
51
+ displayName: string;
52
+ /** Optional description */
53
+ description: string | null;
54
+ /** Optional avatar URL */
55
+ avatarUrl: string | null;
56
+ /** User ID of the entity owner/creator */
57
+ ownerUserId: string;
58
+ /** ISO 8601 timestamp of creation */
59
+ createdAt: string;
60
+ /** ISO 8601 timestamp of last update */
61
+ updatedAt: string;
62
+ }
63
+ /**
64
+ * Entity with the current user's role included.
65
+ * Used when listing entities for a user.
66
+ */
67
+ export interface EntityWithRole extends Entity {
68
+ /** Current user's role in this entity */
69
+ userRole: EntityRole;
70
+ }
71
+ /**
72
+ * Minimal user information for display in member lists.
73
+ */
74
+ export interface EntityMemberUser {
75
+ /** User's unique identifier */
76
+ id: string;
77
+ /** User's email address */
78
+ email: string | null;
79
+ /** User's display name */
80
+ displayName: string | null;
81
+ }
82
+ /**
83
+ * A membership record linking a user to an entity with a specific role.
84
+ */
85
+ export interface EntityMember {
86
+ /** Unique identifier (UUID) */
87
+ id: string;
88
+ /** Entity this membership belongs to */
89
+ entityId: string;
90
+ /** User who is a member */
91
+ userId: string;
92
+ /** User's role in the entity */
93
+ role: EntityRole;
94
+ /** ISO 8601 timestamp when user joined */
95
+ joinedAt: string;
96
+ /** ISO 8601 timestamp of record creation */
97
+ createdAt: string;
98
+ /** ISO 8601 timestamp of last update */
99
+ updatedAt: string;
100
+ /** Populated user information (when joined) */
101
+ user?: EntityMemberUser;
102
+ }
103
+ /**
104
+ * An invitation for a user to join an entity.
105
+ * Stored with email address to support inviting users who haven't signed up yet.
106
+ */
107
+ export interface EntityInvitation {
108
+ /** Unique identifier (UUID) */
109
+ id: string;
110
+ /** Entity the user is invited to join */
111
+ entityId: string;
112
+ /** Email address of the invitee */
113
+ email: string;
114
+ /** Role the user will have upon accepting */
115
+ role: EntityRole;
116
+ /** Current status of the invitation */
117
+ status: InvitationStatus;
118
+ /** User ID of who sent the invitation */
119
+ invitedByUserId: string;
120
+ /** Unique token for accepting/declining (included in invitation link) */
121
+ token: string;
122
+ /** ISO 8601 timestamp when invitation expires */
123
+ expiresAt: string;
124
+ /** ISO 8601 timestamp when invitation was accepted (null if not accepted) */
125
+ acceptedAt: string | null;
126
+ /** ISO 8601 timestamp of creation */
127
+ createdAt: string;
128
+ /** ISO 8601 timestamp of last update */
129
+ updatedAt: string;
130
+ /** Populated entity information (when joined) */
131
+ entity?: Entity;
132
+ /** Populated inviter information (when joined) */
133
+ invitedBy?: EntityMemberUser;
134
+ }
135
+ //# sourceMappingURL=entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../../src/types/entity/entity.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;;;GAIG;AACH,oBAAY,UAAU;IACpB,QAAQ,aAAa;IACrB,YAAY,iBAAiB;CAC9B;AAED;;;GAGG;AACH,oBAAY,UAAU;IACpB,kEAAkE;IAClE,KAAK,UAAU;IACf,uEAAuE;IACvE,OAAO,YAAY;IACnB,gDAAgD;IAChD,MAAM,WAAW;CAClB;AAED;;GAEG;AACH,oBAAY,gBAAgB;IAC1B,yCAAyC;IACzC,OAAO,YAAY;IACnB,gDAAgD;IAChD,QAAQ,aAAa;IACrB,yCAAyC;IACzC,QAAQ,aAAa;IACrB,0DAA0D;IAC1D,OAAO,YAAY;CACpB;AAMD;;;GAGG;AACH,MAAM,WAAW,MAAM;IACrB,+BAA+B;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,uDAAuD;IACvD,UAAU,EAAE,MAAM,CAAC;IACnB,+CAA+C;IAC/C,UAAU,EAAE,UAAU,CAAC;IACvB,+BAA+B;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,2BAA2B;IAC3B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,0BAA0B;IAC1B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,0CAA0C;IAC1C,WAAW,EAAE,MAAM,CAAC;IACpB,qCAAqC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,wCAAwC;IACxC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,cAAe,SAAQ,MAAM;IAC5C,yCAAyC;IACzC,QAAQ,EAAE,UAAU,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,+BAA+B;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,2BAA2B;IAC3B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,0BAA0B;IAC1B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,+BAA+B;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,wCAAwC;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,2BAA2B;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,gCAAgC;IAChC,IAAI,EAAE,UAAU,CAAC;IACjB,0CAA0C;IAC1C,QAAQ,EAAE,MAAM,CAAC;IACjB,4CAA4C;IAC5C,SAAS,EAAE,MAAM,CAAC;IAClB,wCAAwC;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,+CAA+C;IAC/C,IAAI,CAAC,EAAE,gBAAgB,CAAC;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,+BAA+B;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,6CAA6C;IAC7C,IAAI,EAAE,UAAU,CAAC;IACjB,uCAAuC;IACvC,MAAM,EAAE,gBAAgB,CAAC;IACzB,yCAAyC;IACzC,eAAe,EAAE,MAAM,CAAC;IACxB,yEAAyE;IACzE,KAAK,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,SAAS,EAAE,MAAM,CAAC;IAClB,6EAA6E;IAC7E,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,qCAAqC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,wCAAwC;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,iDAAiD;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,SAAS,CAAC,EAAE,gBAAgB,CAAC;CAC9B"}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview Entity Type Definitions
4
+ * @description Core types for the entity/organization system used across shapeshyft and whisperly
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.InvitationStatus = exports.EntityRole = exports.EntityType = void 0;
8
+ // ========================================
9
+ // ENUMS
10
+ // ========================================
11
+ /**
12
+ * Type of entity.
13
+ * - personal: Auto-created for each user, cannot be deleted
14
+ * - organization: User-created, supports multiple members
15
+ */
16
+ var EntityType;
17
+ (function (EntityType) {
18
+ EntityType["PERSONAL"] = "personal";
19
+ EntityType["ORGANIZATION"] = "organization";
20
+ })(EntityType || (exports.EntityType = EntityType = {}));
21
+ /**
22
+ * Role of a user within an entity.
23
+ * Determines permissions for various operations.
24
+ */
25
+ var EntityRole;
26
+ (function (EntityRole) {
27
+ /** Full access: manage entity, members, projects, and API keys */
28
+ EntityRole["ADMIN"] = "admin";
29
+ /** Can create/edit projects and API keys, but cannot manage members */
30
+ EntityRole["MANAGER"] = "manager";
31
+ /** Read-only access to projects and API keys */
32
+ EntityRole["VIEWER"] = "viewer";
33
+ })(EntityRole || (exports.EntityRole = EntityRole = {}));
34
+ /**
35
+ * Status of an entity invitation.
36
+ */
37
+ var InvitationStatus;
38
+ (function (InvitationStatus) {
39
+ /** Invitation sent, awaiting response */
40
+ InvitationStatus["PENDING"] = "pending";
41
+ /** Invitation accepted, user is now a member */
42
+ InvitationStatus["ACCEPTED"] = "accepted";
43
+ /** Invitation declined by the invitee */
44
+ InvitationStatus["DECLINED"] = "declined";
45
+ /** Invitation expired (not accepted within time limit) */
46
+ InvitationStatus["EXPIRED"] = "expired";
47
+ })(InvitationStatus || (exports.InvitationStatus = InvitationStatus = {}));
48
+ //# sourceMappingURL=entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity.js","sourceRoot":"","sources":["../../../src/types/entity/entity.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2CAA2C;AAC3C,QAAQ;AACR,2CAA2C;AAE3C;;;;GAIG;AACH,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,mCAAqB,CAAA;IACrB,2CAA6B,CAAA;AAC/B,CAAC,EAHW,UAAU,0BAAV,UAAU,QAGrB;AAED;;;GAGG;AACH,IAAY,UAOX;AAPD,WAAY,UAAU;IACpB,kEAAkE;IAClE,6BAAe,CAAA;IACf,uEAAuE;IACvE,iCAAmB,CAAA;IACnB,gDAAgD;IAChD,+BAAiB,CAAA;AACnB,CAAC,EAPW,UAAU,0BAAV,UAAU,QAOrB;AAED;;GAEG;AACH,IAAY,gBASX;AATD,WAAY,gBAAgB;IAC1B,yCAAyC;IACzC,uCAAmB,CAAA;IACnB,gDAAgD;IAChD,yCAAqB,CAAA;IACrB,yCAAyC;IACzC,yCAAqB,CAAA;IACrB,0DAA0D;IAC1D,uCAAmB,CAAA;AACrB,CAAC,EATW,gBAAgB,gCAAhB,gBAAgB,QAS3B"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview Entity Types Module
4
+ * @description Exports all entity-related types for organization/workspace management
5
+ */
6
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
+ if (k2 === undefined) k2 = k;
8
+ var desc = Object.getOwnPropertyDescriptor(m, k);
9
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
+ desc = { enumerable: true, get: function() { return m[k]; } };
11
+ }
12
+ Object.defineProperty(o, k2, desc);
13
+ }) : (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ o[k2] = m[k];
16
+ }));
17
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
18
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ // Core entity types and enums
22
+ __exportStar(require("./entity"), exports);
23
+ // Request types
24
+ __exportStar(require("./requests"), exports);
25
+ // Response types
26
+ __exportStar(require("./responses"), exports);
27
+ // Permission types and utilities
28
+ __exportStar(require("./permissions"), exports);
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @fileoverview Entity Types Module
3
+ * @description Exports all entity-related types for organization/workspace management
4
+ */
5
+ export * from './entity';
6
+ export * from './requests';
7
+ export * from './responses';
8
+ export * from './permissions';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/entity/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,cAAc,UAAU,CAAC;AAGzB,cAAc,YAAY,CAAC;AAG3B,cAAc,aAAa,CAAC;AAG5B,cAAc,eAAe,CAAC"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview Entity Types Module
4
+ * @description Exports all entity-related types for organization/workspace management
5
+ */
6
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
+ if (k2 === undefined) k2 = k;
8
+ var desc = Object.getOwnPropertyDescriptor(m, k);
9
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
+ desc = { enumerable: true, get: function() { return m[k]; } };
11
+ }
12
+ Object.defineProperty(o, k2, desc);
13
+ }) : (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ o[k2] = m[k];
16
+ }));
17
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
18
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ // Core entity types and enums
22
+ __exportStar(require("./entity"), exports);
23
+ // Request types
24
+ __exportStar(require("./requests"), exports);
25
+ // Response types
26
+ __exportStar(require("./responses"), exports);
27
+ // Permission types and utilities
28
+ __exportStar(require("./permissions"), exports);
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/entity/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;AAEH,8BAA8B;AAC9B,2CAAyB;AAEzB,gBAAgB;AAChB,6CAA2B;AAE3B,iBAAiB;AACjB,8CAA4B;AAE5B,iCAAiC;AACjC,gDAA8B"}
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview Entity Permission Type Definitions
4
+ * @description Permission types and constants for role-based access control
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.ROLE_PERMISSIONS = void 0;
8
+ exports.getPermissionsForRole = getPermissionsForRole;
9
+ exports.hasPermission = hasPermission;
10
+ const entity_1 = require("./entity");
11
+ // ========================================
12
+ // ROLE PERMISSION MAPPINGS
13
+ // ========================================
14
+ /**
15
+ * Permission set for the Admin role.
16
+ * Full access to all entity operations.
17
+ */
18
+ const ADMIN_PERMISSIONS = {
19
+ canViewEntity: true,
20
+ canEditEntity: true,
21
+ canDeleteEntity: true,
22
+ canManageMembers: true,
23
+ canInviteMembers: true,
24
+ canManageProjects: true,
25
+ canCreateProjects: true,
26
+ canViewProjects: true,
27
+ canManageApiKeys: true,
28
+ canViewApiKeys: true,
29
+ };
30
+ /**
31
+ * Permission set for the Manager role.
32
+ * Can manage projects and API keys, but not entity settings or members.
33
+ */
34
+ const MANAGER_PERMISSIONS = {
35
+ canViewEntity: true,
36
+ canEditEntity: false,
37
+ canDeleteEntity: false,
38
+ canManageMembers: false,
39
+ canInviteMembers: false,
40
+ canManageProjects: true,
41
+ canCreateProjects: true,
42
+ canViewProjects: true,
43
+ canManageApiKeys: true,
44
+ canViewApiKeys: true,
45
+ };
46
+ /**
47
+ * Permission set for the Viewer role.
48
+ * Read-only access to projects and API keys.
49
+ */
50
+ const VIEWER_PERMISSIONS = {
51
+ canViewEntity: true,
52
+ canEditEntity: false,
53
+ canDeleteEntity: false,
54
+ canManageMembers: false,
55
+ canInviteMembers: false,
56
+ canManageProjects: false,
57
+ canCreateProjects: false,
58
+ canViewProjects: true,
59
+ canManageApiKeys: false,
60
+ canViewApiKeys: true,
61
+ };
62
+ /**
63
+ * Maps each role to its permission set.
64
+ * Used by permission checking utilities.
65
+ */
66
+ exports.ROLE_PERMISSIONS = {
67
+ [entity_1.EntityRole.ADMIN]: ADMIN_PERMISSIONS,
68
+ [entity_1.EntityRole.MANAGER]: MANAGER_PERMISSIONS,
69
+ [entity_1.EntityRole.VIEWER]: VIEWER_PERMISSIONS,
70
+ };
71
+ // ========================================
72
+ // UTILITY FUNCTIONS
73
+ // ========================================
74
+ /**
75
+ * Get permissions for a given role.
76
+ * @param role - The entity role
77
+ * @returns The permission set for that role
78
+ */
79
+ function getPermissionsForRole(role) {
80
+ return exports.ROLE_PERMISSIONS[role];
81
+ }
82
+ /**
83
+ * Check if a role has a specific permission.
84
+ * @param role - The entity role to check
85
+ * @param permission - The permission key to check
86
+ * @returns Whether the role has the permission
87
+ */
88
+ function hasPermission(role, permission) {
89
+ return exports.ROLE_PERMISSIONS[role][permission];
90
+ }
91
+ //# sourceMappingURL=permissions.js.map
@@ -0,0 +1,50 @@
1
+ /**
2
+ * @fileoverview Entity Permission Type Definitions
3
+ * @description Permission types and constants for role-based access control
4
+ */
5
+ import { EntityRole } from './entity';
6
+ /**
7
+ * Defines all available permissions within an entity.
8
+ * Each permission maps to a specific action a user can perform.
9
+ */
10
+ export interface EntityPermissions {
11
+ /** Can view entity details and settings */
12
+ canViewEntity: boolean;
13
+ /** Can edit entity name, description, avatar */
14
+ canEditEntity: boolean;
15
+ /** Can delete the entity (organizations only) */
16
+ canDeleteEntity: boolean;
17
+ /** Can add, remove, and change roles of members */
18
+ canManageMembers: boolean;
19
+ /** Can send invitations to new members */
20
+ canInviteMembers: boolean;
21
+ /** Can create, edit, and delete projects */
22
+ canManageProjects: boolean;
23
+ /** Can create new projects */
24
+ canCreateProjects: boolean;
25
+ /** Can view projects and their details */
26
+ canViewProjects: boolean;
27
+ /** Can create, edit, and delete API keys */
28
+ canManageApiKeys: boolean;
29
+ /** Can view and use API keys for invocations */
30
+ canViewApiKeys: boolean;
31
+ }
32
+ /**
33
+ * Maps each role to its permission set.
34
+ * Used by permission checking utilities.
35
+ */
36
+ export declare const ROLE_PERMISSIONS: Record<EntityRole, EntityPermissions>;
37
+ /**
38
+ * Get permissions for a given role.
39
+ * @param role - The entity role
40
+ * @returns The permission set for that role
41
+ */
42
+ export declare function getPermissionsForRole(role: EntityRole): EntityPermissions;
43
+ /**
44
+ * Check if a role has a specific permission.
45
+ * @param role - The entity role to check
46
+ * @param permission - The permission key to check
47
+ * @returns Whether the role has the permission
48
+ */
49
+ export declare function hasPermission(role: EntityRole, permission: keyof EntityPermissions): boolean;
50
+ //# sourceMappingURL=permissions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../../src/types/entity/permissions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAMtC;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,2CAA2C;IAC3C,aAAa,EAAE,OAAO,CAAC;IACvB,gDAAgD;IAChD,aAAa,EAAE,OAAO,CAAC;IACvB,iDAAiD;IACjD,eAAe,EAAE,OAAO,CAAC;IACzB,mDAAmD;IACnD,gBAAgB,EAAE,OAAO,CAAC;IAC1B,0CAA0C;IAC1C,gBAAgB,EAAE,OAAO,CAAC;IAC1B,4CAA4C;IAC5C,iBAAiB,EAAE,OAAO,CAAC;IAC3B,8BAA8B;IAC9B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,0CAA0C;IAC1C,eAAe,EAAE,OAAO,CAAC;IACzB,4CAA4C;IAC5C,gBAAgB,EAAE,OAAO,CAAC;IAC1B,gDAAgD;IAChD,cAAc,EAAE,OAAO,CAAC;CACzB;AAyDD;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,UAAU,EAAE,iBAAiB,CAIlE,CAAC;AAMF;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,UAAU,GAAG,iBAAiB,CAEzE;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,UAAU,EAChB,UAAU,EAAE,MAAM,iBAAiB,GAClC,OAAO,CAET"}
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview Entity Permission Type Definitions
4
+ * @description Permission types and constants for role-based access control
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.ROLE_PERMISSIONS = void 0;
8
+ exports.getPermissionsForRole = getPermissionsForRole;
9
+ exports.hasPermission = hasPermission;
10
+ const entity_1 = require("./entity");
11
+ // ========================================
12
+ // ROLE PERMISSION MAPPINGS
13
+ // ========================================
14
+ /**
15
+ * Permission set for the Admin role.
16
+ * Full access to all entity operations.
17
+ */
18
+ const ADMIN_PERMISSIONS = {
19
+ canViewEntity: true,
20
+ canEditEntity: true,
21
+ canDeleteEntity: true,
22
+ canManageMembers: true,
23
+ canInviteMembers: true,
24
+ canManageProjects: true,
25
+ canCreateProjects: true,
26
+ canViewProjects: true,
27
+ canManageApiKeys: true,
28
+ canViewApiKeys: true,
29
+ };
30
+ /**
31
+ * Permission set for the Manager role.
32
+ * Can manage projects and API keys, but not entity settings or members.
33
+ */
34
+ const MANAGER_PERMISSIONS = {
35
+ canViewEntity: true,
36
+ canEditEntity: false,
37
+ canDeleteEntity: false,
38
+ canManageMembers: false,
39
+ canInviteMembers: false,
40
+ canManageProjects: true,
41
+ canCreateProjects: true,
42
+ canViewProjects: true,
43
+ canManageApiKeys: true,
44
+ canViewApiKeys: true,
45
+ };
46
+ /**
47
+ * Permission set for the Viewer role.
48
+ * Read-only access to projects and API keys.
49
+ */
50
+ const VIEWER_PERMISSIONS = {
51
+ canViewEntity: true,
52
+ canEditEntity: false,
53
+ canDeleteEntity: false,
54
+ canManageMembers: false,
55
+ canInviteMembers: false,
56
+ canManageProjects: false,
57
+ canCreateProjects: false,
58
+ canViewProjects: true,
59
+ canManageApiKeys: false,
60
+ canViewApiKeys: true,
61
+ };
62
+ /**
63
+ * Maps each role to its permission set.
64
+ * Used by permission checking utilities.
65
+ */
66
+ exports.ROLE_PERMISSIONS = {
67
+ [entity_1.EntityRole.ADMIN]: ADMIN_PERMISSIONS,
68
+ [entity_1.EntityRole.MANAGER]: MANAGER_PERMISSIONS,
69
+ [entity_1.EntityRole.VIEWER]: VIEWER_PERMISSIONS,
70
+ };
71
+ // ========================================
72
+ // UTILITY FUNCTIONS
73
+ // ========================================
74
+ /**
75
+ * Get permissions for a given role.
76
+ * @param role - The entity role
77
+ * @returns The permission set for that role
78
+ */
79
+ function getPermissionsForRole(role) {
80
+ return exports.ROLE_PERMISSIONS[role];
81
+ }
82
+ /**
83
+ * Check if a role has a specific permission.
84
+ * @param role - The entity role to check
85
+ * @param permission - The permission key to check
86
+ * @returns Whether the role has the permission
87
+ */
88
+ function hasPermission(role, permission) {
89
+ return exports.ROLE_PERMISSIONS[role][permission];
90
+ }
91
+ //# sourceMappingURL=permissions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"permissions.js","sourceRoot":"","sources":["../../../src/types/entity/permissions.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AA6GH,sDAEC;AAQD,sCAKC;AA1HD,qCAAsC;AAiCtC,2CAA2C;AAC3C,2BAA2B;AAC3B,2CAA2C;AAE3C;;;GAGG;AACH,MAAM,iBAAiB,GAAsB;IAC3C,aAAa,EAAE,IAAI;IACnB,aAAa,EAAE,IAAI;IACnB,eAAe,EAAE,IAAI;IACrB,gBAAgB,EAAE,IAAI;IACtB,gBAAgB,EAAE,IAAI;IACtB,iBAAiB,EAAE,IAAI;IACvB,iBAAiB,EAAE,IAAI;IACvB,eAAe,EAAE,IAAI;IACrB,gBAAgB,EAAE,IAAI;IACtB,cAAc,EAAE,IAAI;CACrB,CAAC;AAEF;;;GAGG;AACH,MAAM,mBAAmB,GAAsB;IAC7C,aAAa,EAAE,IAAI;IACnB,aAAa,EAAE,KAAK;IACpB,eAAe,EAAE,KAAK;IACtB,gBAAgB,EAAE,KAAK;IACvB,gBAAgB,EAAE,KAAK;IACvB,iBAAiB,EAAE,IAAI;IACvB,iBAAiB,EAAE,IAAI;IACvB,eAAe,EAAE,IAAI;IACrB,gBAAgB,EAAE,IAAI;IACtB,cAAc,EAAE,IAAI;CACrB,CAAC;AAEF;;;GAGG;AACH,MAAM,kBAAkB,GAAsB;IAC5C,aAAa,EAAE,IAAI;IACnB,aAAa,EAAE,KAAK;IACpB,eAAe,EAAE,KAAK;IACtB,gBAAgB,EAAE,KAAK;IACvB,gBAAgB,EAAE,KAAK;IACvB,iBAAiB,EAAE,KAAK;IACxB,iBAAiB,EAAE,KAAK;IACxB,eAAe,EAAE,IAAI;IACrB,gBAAgB,EAAE,KAAK;IACvB,cAAc,EAAE,IAAI;CACrB,CAAC;AAEF;;;GAGG;AACU,QAAA,gBAAgB,GAA0C;IACrE,CAAC,mBAAU,CAAC,KAAK,CAAC,EAAE,iBAAiB;IACrC,CAAC,mBAAU,CAAC,OAAO,CAAC,EAAE,mBAAmB;IACzC,CAAC,mBAAU,CAAC,MAAM,CAAC,EAAE,kBAAkB;CACxC,CAAC;AAEF,2CAA2C;AAC3C,oBAAoB;AACpB,2CAA2C;AAE3C;;;;GAIG;AACH,SAAgB,qBAAqB,CAAC,IAAgB;IACpD,OAAO,wBAAgB,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC;AAED;;;;;GAKG;AACH,SAAgB,aAAa,CAC3B,IAAgB,EAChB,UAAmC;IAEnC,OAAO,wBAAgB,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,CAAC;AAC5C,CAAC"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview Entity Request Type Definitions
4
+ * @description Request types for entity API endpoints
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ //# sourceMappingURL=requests.js.map
@@ -0,0 +1,64 @@
1
+ /**
2
+ * @fileoverview Entity Request Type Definitions
3
+ * @description Request types for entity API endpoints
4
+ */
5
+ import type { EntityRole } from './entity';
6
+ /**
7
+ * Request to create a new organization entity.
8
+ * Personal entities are created automatically and cannot be created via API.
9
+ */
10
+ export interface CreateEntityRequest {
11
+ /** Display name for the organization */
12
+ displayName: string;
13
+ /** Optional custom slug (8-12 alphanumeric). Auto-generated if not provided */
14
+ entitySlug?: string;
15
+ /** Optional description */
16
+ description?: string;
17
+ }
18
+ /**
19
+ * Request to update an entity's details.
20
+ * Only admins can update entity settings.
21
+ */
22
+ export interface UpdateEntityRequest {
23
+ /** New display name */
24
+ displayName?: string;
25
+ /** New slug (must be unique and available) */
26
+ entitySlug?: string;
27
+ /** New description */
28
+ description?: string;
29
+ /** New avatar URL */
30
+ avatarUrl?: string;
31
+ }
32
+ /**
33
+ * Request to update a member's role.
34
+ * Only admins can update member roles.
35
+ */
36
+ export interface UpdateMemberRoleRequest {
37
+ /** New role for the member */
38
+ role: EntityRole;
39
+ }
40
+ /**
41
+ * Request to invite a user to join an entity.
42
+ * Only admins can send invitations.
43
+ */
44
+ export interface InviteMemberRequest {
45
+ /** Email address of the user to invite */
46
+ email: string;
47
+ /** Role to assign when invitation is accepted */
48
+ role: EntityRole;
49
+ }
50
+ /**
51
+ * Request to accept an invitation using its token.
52
+ */
53
+ export interface AcceptInvitationRequest {
54
+ /** Unique invitation token from the invitation link */
55
+ token: string;
56
+ }
57
+ /**
58
+ * Request to decline an invitation using its token.
59
+ */
60
+ export interface DeclineInvitationRequest {
61
+ /** Unique invitation token from the invitation link */
62
+ token: string;
63
+ }
64
+ //# sourceMappingURL=requests.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../../src/types/entity/requests.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAM3C;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,wCAAwC;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,+EAA+E;IAC/E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2BAA2B;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,uBAAuB;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8CAA8C;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,sBAAsB;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAMD;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,8BAA8B;IAC9B,IAAI,EAAE,UAAU,CAAC;CAClB;AAMD;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,0CAA0C;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,IAAI,EAAE,UAAU,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAC;CACf"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview Entity Request Type Definitions
4
+ * @description Request types for entity API endpoints
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ //# sourceMappingURL=requests.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requests.js","sourceRoot":"","sources":["../../../src/types/entity/requests.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview Entity Response Type Definitions
4
+ * @description Response types for entity API endpoints
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ //# sourceMappingURL=responses.js.map
@@ -0,0 +1,48 @@
1
+ /**
2
+ * @fileoverview Entity Response Type Definitions
3
+ * @description Response types for entity API endpoints
4
+ */
5
+ import type { BaseResponse } from '../common';
6
+ import type { Entity, EntityWithRole, EntityMember, EntityInvitation } from './entity';
7
+ /**
8
+ * Response for single entity operations (get, create, update).
9
+ */
10
+ export type EntityResponse = BaseResponse<Entity>;
11
+ /**
12
+ * Response for listing user's entities.
13
+ * Includes the user's role in each entity.
14
+ */
15
+ export type EntityWithRoleListResponse = BaseResponse<EntityWithRole[]>;
16
+ /**
17
+ * Response for getting a single entity with role.
18
+ */
19
+ export type EntityWithRoleResponse = BaseResponse<EntityWithRole>;
20
+ /**
21
+ * Response for single member operations (add, update role).
22
+ */
23
+ export type EntityMemberResponse = BaseResponse<EntityMember>;
24
+ /**
25
+ * Response for listing entity members.
26
+ */
27
+ export type EntityMemberListResponse = BaseResponse<EntityMember[]>;
28
+ /**
29
+ * Response for single invitation operations (create, accept, decline).
30
+ */
31
+ export type EntityInvitationResponse = BaseResponse<EntityInvitation>;
32
+ /**
33
+ * Response for listing invitations.
34
+ */
35
+ export type EntityInvitationListResponse = BaseResponse<EntityInvitation[]>;
36
+ /**
37
+ * Response for checking if an entity slug is available.
38
+ */
39
+ export interface SlugAvailabilityData {
40
+ /** The slug that was checked */
41
+ slug: string;
42
+ /** Whether the slug is available for use */
43
+ available: boolean;
44
+ /** Suggested alternative if not available */
45
+ suggestion?: string;
46
+ }
47
+ export type SlugAvailabilityResponse = BaseResponse<SlugAvailabilityData>;
48
+ //# sourceMappingURL=responses.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../../src/types/entity/responses.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EACV,MAAM,EACN,cAAc,EACd,YAAY,EACZ,gBAAgB,EACjB,MAAM,UAAU,CAAC;AAMlB;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;AAElD;;;GAGG;AACH,MAAM,MAAM,0BAA0B,GAAG,YAAY,CAAC,cAAc,EAAE,CAAC,CAAC;AAExE;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,YAAY,CAAC,cAAc,CAAC,CAAC;AAMlE;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,YAAY,CAAC,YAAY,CAAC,CAAC;AAE9D;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG,YAAY,CAAC,YAAY,EAAE,CAAC,CAAC;AAMpE;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG,YAAY,CAAC,gBAAgB,CAAC,CAAC;AAEtE;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG,YAAY,CAAC,gBAAgB,EAAE,CAAC,CAAC;AAM5E;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,4CAA4C;IAC5C,SAAS,EAAE,OAAO,CAAC;IACnB,6CAA6C;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,wBAAwB,GAAG,YAAY,CAAC,oBAAoB,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview Entity Response Type Definitions
4
+ * @description Response types for entity API endpoints
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ //# sourceMappingURL=responses.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"responses.js","sourceRoot":"","sources":["../../../src/types/entity/responses.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
@@ -26,4 +26,6 @@ __exportStar(require("./config"), exports);
26
26
  __exportStar(require("./infrastructure"), exports);
27
27
  // Subscription types (rate limits, etc.)
28
28
  __exportStar(require("./subscription"), exports);
29
+ // Entity types (organizations, workspaces, members)
30
+ __exportStar(require("./entity"), exports);
29
31
  //# sourceMappingURL=index.js.map
@@ -4,4 +4,5 @@ export * from './blockchain';
4
4
  export * from './config';
5
5
  export * from './infrastructure';
6
6
  export * from './subscription';
7
+ export * from './entity';
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AACA,cAAc,UAAU,CAAC;AAGzB,cAAc,YAAY,CAAC;AAG3B,cAAc,cAAc,CAAC;AAG7B,cAAc,UAAU,CAAC;AAGzB,cAAc,kBAAkB,CAAC;AAGjC,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AACA,cAAc,UAAU,CAAC;AAGzB,cAAc,YAAY,CAAC;AAG3B,cAAc,cAAc,CAAC;AAG7B,cAAc,UAAU,CAAC;AAGzB,cAAc,kBAAkB,CAAC;AAGjC,cAAc,gBAAgB,CAAC;AAG/B,cAAc,UAAU,CAAC"}
@@ -26,4 +26,6 @@ __exportStar(require("./config"), exports);
26
26
  __exportStar(require("./infrastructure"), exports);
27
27
  // Subscription types (rate limits, etc.)
28
28
  __exportStar(require("./subscription"), exports);
29
+ // Entity types (organizations, workspaces, members)
30
+ __exportStar(require("./entity"), exports);
29
31
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uBAAuB;AACvB,2CAAyB;AAEzB,wBAAwB;AACxB,6CAA2B;AAE3B,8BAA8B;AAC9B,+CAA6B;AAE7B,4BAA4B;AAC5B,2CAAyB;AAEzB,uBAAuB;AACvB,mDAAiC;AAEjC,yCAAyC;AACzC,iDAA+B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uBAAuB;AACvB,2CAAyB;AAEzB,wBAAwB;AACxB,6CAA2B;AAE3B,8BAA8B;AAC9B,+CAA6B;AAE7B,4BAA4B;AAC5B,2CAAyB;AAEzB,uBAAuB;AACvB,mDAAiC;AAEjC,yCAAyC;AACzC,iDAA+B;AAE/B,oDAAoD;AACpD,2CAAyB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sudobility/types",
3
- "version": "1.9.37",
3
+ "version": "1.9.38",
4
4
  "description": "Comprehensive TypeScript types, interfaces, and utilities for Web3 email applications - optimized for AI-assisted development",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",