@discovercloudai/shared 1.0.0

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.
Files changed (69) hide show
  1. package/dist/context/access-context.d.ts +7 -0
  2. package/dist/context/access-context.js +2 -0
  3. package/dist/context/index.d.ts +1 -0
  4. package/dist/context/index.js +17 -0
  5. package/dist/dto/account.dto.d.ts +9 -0
  6. package/dist/dto/account.dto.js +2 -0
  7. package/dist/dto/auth-service.dtos.d.ts +51 -0
  8. package/dist/dto/auth-service.dtos.js +2 -0
  9. package/dist/dto/index.d.ts +3 -0
  10. package/dist/dto/index.js +19 -0
  11. package/dist/dto/membership.dto.d.ts +11 -0
  12. package/dist/dto/membership.dto.js +2 -0
  13. package/dist/dto/organization.dto.d.ts +10 -0
  14. package/dist/dto/organization.dto.js +2 -0
  15. package/dist/dto/response.dto.d.ts +54 -0
  16. package/dist/dto/response.dto.js +2 -0
  17. package/dist/dto/response.dtos.d.ts +48 -0
  18. package/dist/dto/response.dtos.js +2 -0
  19. package/dist/dto/user-service.dtos.d.ts +54 -0
  20. package/dist/dto/user-service.dtos.js +2 -0
  21. package/dist/dto/user.dto.d.ts +10 -0
  22. package/dist/dto/user.dto.js +2 -0
  23. package/dist/enums/account-status.enum.d.ts +5 -0
  24. package/dist/enums/account-status.enum.js +9 -0
  25. package/dist/enums/auth-service.enums.d.ts +12 -0
  26. package/dist/enums/auth-service.enums.js +17 -0
  27. package/dist/enums/index.d.ts +3 -0
  28. package/dist/enums/index.js +19 -0
  29. package/dist/enums/membership-status.enum.d.ts +5 -0
  30. package/dist/enums/membership-status.enum.js +9 -0
  31. package/dist/enums/organization-role.enum.d.ts +6 -0
  32. package/dist/enums/organization-role.enum.js +10 -0
  33. package/dist/enums/organization-status.enum.d.ts +5 -0
  34. package/dist/enums/organization-status.enum.js +9 -0
  35. package/dist/enums/permissions.types.d.ts +12 -0
  36. package/dist/enums/permissions.types.js +17 -0
  37. package/dist/enums/user-role.enum.d.ts +7 -0
  38. package/dist/enums/user-role.enum.js +11 -0
  39. package/dist/enums/user-service.enums.d.ts +32 -0
  40. package/dist/enums/user-service.enums.js +41 -0
  41. package/dist/enums/user-status.enum.d.ts +5 -0
  42. package/dist/enums/user-status.enum.js +9 -0
  43. package/dist/errors/app-error.d.ts +6 -0
  44. package/dist/errors/app-error.js +19 -0
  45. package/dist/errors/http-errors.d.ts +22 -0
  46. package/dist/errors/http-errors.js +46 -0
  47. package/dist/errors/index.d.ts +2 -0
  48. package/dist/errors/index.js +18 -0
  49. package/dist/index.d.ts +5 -0
  50. package/dist/index.js +21 -0
  51. package/dist/internal/internal-jwt.service.d.ts +13 -0
  52. package/dist/internal/internal-jwt.service.js +88 -0
  53. package/dist/internal/internal-jwt.types.d.ts +7 -0
  54. package/dist/internal/internal-jwt.types.js +2 -0
  55. package/dist/internal/internal-key-manager.d.ts +16 -0
  56. package/dist/internal/internal-key-manager.js +67 -0
  57. package/dist/internal/registry.d.ts +8 -0
  58. package/dist/internal/registry.js +34 -0
  59. package/dist/internal/service-client.d.ts +9 -0
  60. package/dist/internal/service-client.js +94 -0
  61. package/dist/permissions/global-permissions.d.ts +3 -0
  62. package/dist/permissions/global-permissions.js +30 -0
  63. package/dist/permissions/index.d.ts +3 -0
  64. package/dist/permissions/index.js +19 -0
  65. package/dist/permissions/is-allowed.d.ts +3 -0
  66. package/dist/permissions/is-allowed.js +16 -0
  67. package/dist/permissions/org-permissions.d.ts +3 -0
  68. package/dist/permissions/org-permissions.js +19 -0
  69. package/package.json +28 -0
@@ -0,0 +1,7 @@
1
+ import { OrganizationMemberDTO, OrganizationDTO } from "../dto";
2
+ import { AccountRole } from "../enums";
3
+ export interface AccessContext {
4
+ accountRole: AccountRole;
5
+ organization?: OrganizationDTO;
6
+ membership?: OrganizationMemberDTO;
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export * from "./access-context.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./access-context.js"), exports);
@@ -0,0 +1,9 @@
1
+ import { AccountStatus } from "../enums";
2
+ export interface AccountDTO {
3
+ id: string;
4
+ email: string;
5
+ isVerified: boolean;
6
+ status: AccountStatus;
7
+ createdAt: Date;
8
+ updatedAt: Date;
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,51 @@
1
+ import { AccountStatus } from "../enums";
2
+ export interface AccountDTO {
3
+ id: string;
4
+ email: string;
5
+ isVerified: boolean;
6
+ status: AccountStatus;
7
+ createdAt: Date;
8
+ updatedAt: Date;
9
+ }
10
+ export interface EmailVerificationDTO {
11
+ id: string;
12
+ accountId: string;
13
+ token: string;
14
+ expiresAt: Date;
15
+ isUsed: boolean;
16
+ createdAt: Date;
17
+ }
18
+ export interface OAuthIdentityDTO {
19
+ id: string;
20
+ accountId: string;
21
+ provider: string;
22
+ providerId: string;
23
+ accessToken: string | null;
24
+ refreshToken: string | null;
25
+ createdAt: Date;
26
+ updatedAt: Date;
27
+ }
28
+ export interface PasswordResetDTO {
29
+ id: string;
30
+ accountId: string;
31
+ token: string;
32
+ expiresAt: Date;
33
+ isUsed: boolean;
34
+ createdAt: Date;
35
+ }
36
+ export interface SessionDTO {
37
+ id: string;
38
+ accountId: string;
39
+ token: string;
40
+ expiresAt: Date;
41
+ revokedAt: Date | null;
42
+ ipAddress: string | null;
43
+ userAgent: string | null;
44
+ device: string | null;
45
+ createdAt: Date;
46
+ updatedAt: Date;
47
+ }
48
+ export interface TokensResponseDto {
49
+ accessToken: string;
50
+ refreshToken: string;
51
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export * from "./user-service.dtos";
2
+ export * from "./auth-service.dtos";
3
+ export * from "./response.dtos";
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./user-service.dtos"), exports);
18
+ __exportStar(require("./auth-service.dtos"), exports);
19
+ __exportStar(require("./response.dtos"), exports);
@@ -0,0 +1,11 @@
1
+ import { OrganizationRole, MembershipStatus } from "../enums";
2
+ export interface MembershipDTO {
3
+ id: string;
4
+ userId: string;
5
+ organizationId: string;
6
+ role: OrganizationRole;
7
+ status: MembershipStatus;
8
+ createdAt: Date;
9
+ updatedAt: Date;
10
+ deletedAt: Date | null;
11
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ import { OrganizationStatus } from "../enums";
2
+ export interface OrganizationDTO {
3
+ id: string;
4
+ name: string;
5
+ slug: string;
6
+ status: OrganizationStatus;
7
+ createdAt: Date;
8
+ updatedAt: Date;
9
+ deletedAt: Date | null;
10
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,54 @@
1
+ export interface ApiMeta {
2
+ requestId: string | null;
3
+ timestamp: string;
4
+ }
5
+ export interface ApiSuccessResponse<T> {
6
+ success: true;
7
+ data: T;
8
+ meta: ApiMeta;
9
+ }
10
+ export interface ApiErrorResponse {
11
+ success: false;
12
+ error: {
13
+ code?: string;
14
+ message: string;
15
+ details?: any;
16
+ };
17
+ meta: ApiMeta;
18
+ }
19
+ export interface MessageResponseDto {
20
+ message: string;
21
+ }
22
+ export interface TokensResponseDto {
23
+ accessToken: string;
24
+ refreshToken: string;
25
+ }
26
+ export interface LoggedOutResponseDto {
27
+ loggedOut: boolean;
28
+ }
29
+ export interface LoggedOutAllResponseDto {
30
+ loggedOutAll: boolean;
31
+ }
32
+ export interface SuspendedResponseDto {
33
+ suspended: boolean;
34
+ }
35
+ export interface ActivatedResponseDto {
36
+ activated: boolean;
37
+ }
38
+ export interface DeletedResponseDto {
39
+ deleted: boolean;
40
+ }
41
+ export interface RevokedResponseDto {
42
+ revoked: boolean;
43
+ }
44
+ export interface SessionDto {
45
+ id: string;
46
+ isActive: boolean;
47
+ ipAddress: string | null;
48
+ userAgent: string | null;
49
+ device: string | null;
50
+ createdAt: Date;
51
+ updatedAt: Date;
52
+ expiresAt: Date | null;
53
+ revokedAt: Date | null;
54
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,48 @@
1
+ export interface ApiMeta {
2
+ requestId: string | null;
3
+ timestamp: string;
4
+ }
5
+ export interface ApiSuccessResponse<T> {
6
+ success: true;
7
+ data: T;
8
+ meta: ApiMeta;
9
+ }
10
+ export interface ApiErrorResponse {
11
+ success: false;
12
+ error: {
13
+ code?: string;
14
+ message: string;
15
+ details?: unknown;
16
+ };
17
+ meta: ApiMeta;
18
+ }
19
+ export interface MessageResponseDto {
20
+ message: string;
21
+ }
22
+ export interface LoggedOutResponseDto {
23
+ loggedOut: boolean;
24
+ }
25
+ export interface LoggedOutAllResponseDto {
26
+ loggedOutAll: boolean;
27
+ }
28
+ export interface SuspendedResponseDto {
29
+ suspended: boolean;
30
+ }
31
+ export interface ActivatedResponseDto {
32
+ activated: boolean;
33
+ }
34
+ export interface DeletedResponseDto {
35
+ deleted: boolean;
36
+ }
37
+ export interface RevokedResponseDto {
38
+ revoked: boolean;
39
+ }
40
+ export interface AddedResponseDto {
41
+ added: boolean;
42
+ }
43
+ export interface UpdatedResponseDto {
44
+ updated: boolean;
45
+ }
46
+ export interface CreatedResponseDto {
47
+ created: boolean;
48
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,54 @@
1
+ import { OrganizationRole, MembershipStatus, OrganizationStatus, Theme, Currency, UserStatus } from "../enums";
2
+ export interface UserDTO {
3
+ id: string;
4
+ email: string;
5
+ status: UserStatus;
6
+ createdAt: Date;
7
+ updatedAt: Date;
8
+ deletedAt: Date | null;
9
+ }
10
+ export interface UserProfileDTO {
11
+ id: string | null;
12
+ userId: string;
13
+ displayName: string | null;
14
+ avatarUrl: string | null;
15
+ jobTitle: string | null;
16
+ bio: string | null;
17
+ timezone: string | null;
18
+ locale: string;
19
+ country: string | null;
20
+ pronouns: string | null;
21
+ createdAt: Date;
22
+ updatedAt: Date;
23
+ deletedAt: Date | null;
24
+ }
25
+ export interface UserPreferencesDTO {
26
+ id: string | null;
27
+ userId: string;
28
+ theme: Theme;
29
+ language: string;
30
+ currency: Currency;
31
+ emailAlerts: boolean;
32
+ createdAt: Date;
33
+ updatedAt: Date;
34
+ deletedAt: Date | null;
35
+ }
36
+ export interface OrganizationDTO {
37
+ id: string;
38
+ name: string;
39
+ slug: string;
40
+ status: OrganizationStatus;
41
+ createdAt: Date;
42
+ updatedAt: Date;
43
+ deletedAt: Date | null;
44
+ }
45
+ export interface OrganizationMemberDTO {
46
+ id: string;
47
+ userId: string;
48
+ organizationId: string;
49
+ role: OrganizationRole;
50
+ status: MembershipStatus;
51
+ createdAt: Date;
52
+ updatedAt: Date;
53
+ deletedAt: Date | null;
54
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ import { UserStatus, UserRole } from "../enums";
2
+ export interface UserDTO {
3
+ id: string;
4
+ email: string;
5
+ status: UserStatus;
6
+ role: UserRole;
7
+ createdAt: Date;
8
+ updatedAt: Date;
9
+ deletedAt: Date | null;
10
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ export declare enum AccountStatus {
2
+ ACTIVE = "ACTIVE",
3
+ SUSPENDED = "SUSPENDED",
4
+ DELETED = "DELETED"
5
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AccountStatus = void 0;
4
+ var AccountStatus;
5
+ (function (AccountStatus) {
6
+ AccountStatus["ACTIVE"] = "ACTIVE";
7
+ AccountStatus["SUSPENDED"] = "SUSPENDED";
8
+ AccountStatus["DELETED"] = "DELETED";
9
+ })(AccountStatus || (exports.AccountStatus = AccountStatus = {}));
@@ -0,0 +1,12 @@
1
+ export declare enum AccountStatus {
2
+ ACTIVE = "ACTIVE",
3
+ SUSPENDED = "SUSPENDED",
4
+ DELETED = "DELETED"
5
+ }
6
+ export declare enum AccountRole {
7
+ SUPERADMIN = "SUPERADMIN",
8
+ ADMIN = "ADMIN",
9
+ SUPPORT = "SUPPORT",
10
+ MODERATOR = "MODERATOR",
11
+ USER = "USER"
12
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AccountRole = exports.AccountStatus = void 0;
4
+ var AccountStatus;
5
+ (function (AccountStatus) {
6
+ AccountStatus["ACTIVE"] = "ACTIVE";
7
+ AccountStatus["SUSPENDED"] = "SUSPENDED";
8
+ AccountStatus["DELETED"] = "DELETED";
9
+ })(AccountStatus || (exports.AccountStatus = AccountStatus = {}));
10
+ var AccountRole;
11
+ (function (AccountRole) {
12
+ AccountRole["SUPERADMIN"] = "SUPERADMIN";
13
+ AccountRole["ADMIN"] = "ADMIN";
14
+ AccountRole["SUPPORT"] = "SUPPORT";
15
+ AccountRole["MODERATOR"] = "MODERATOR";
16
+ AccountRole["USER"] = "USER";
17
+ })(AccountRole || (exports.AccountRole = AccountRole = {}));
@@ -0,0 +1,3 @@
1
+ export * from "./user-service.enums";
2
+ export * from "./auth-service.enums";
3
+ export * from "./permissions.types";
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./user-service.enums"), exports);
18
+ __exportStar(require("./auth-service.enums"), exports);
19
+ __exportStar(require("./permissions.types"), exports);
@@ -0,0 +1,5 @@
1
+ export declare enum MembershipStatus {
2
+ ACTIVE = "ACTIVE",
3
+ INVITED = "INVITED",
4
+ SUSPENDED = "SUSPENDED"
5
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MembershipStatus = void 0;
4
+ var MembershipStatus;
5
+ (function (MembershipStatus) {
6
+ MembershipStatus["ACTIVE"] = "ACTIVE";
7
+ MembershipStatus["INVITED"] = "INVITED";
8
+ MembershipStatus["SUSPENDED"] = "SUSPENDED";
9
+ })(MembershipStatus || (exports.MembershipStatus = MembershipStatus = {}));
@@ -0,0 +1,6 @@
1
+ export declare enum OrganizationRole {
2
+ OWNER = "OWNER",
3
+ ADMIN = "ADMIN",
4
+ EDITOR = "EDITOR",
5
+ VIEWER = "VIEWER"
6
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OrganizationRole = void 0;
4
+ var OrganizationRole;
5
+ (function (OrganizationRole) {
6
+ OrganizationRole["OWNER"] = "OWNER";
7
+ OrganizationRole["ADMIN"] = "ADMIN";
8
+ OrganizationRole["EDITOR"] = "EDITOR";
9
+ OrganizationRole["VIEWER"] = "VIEWER";
10
+ })(OrganizationRole || (exports.OrganizationRole = OrganizationRole = {}));
@@ -0,0 +1,5 @@
1
+ export declare enum OrganizationStatus {
2
+ ACTIVE = "ACTIVE",
3
+ SUSPENDED = "SUSPENDED",
4
+ CLOSED = "CLOSED"
5
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OrganizationStatus = void 0;
4
+ var OrganizationStatus;
5
+ (function (OrganizationStatus) {
6
+ OrganizationStatus["ACTIVE"] = "ACTIVE";
7
+ OrganizationStatus["SUSPENDED"] = "SUSPENDED";
8
+ OrganizationStatus["CLOSED"] = "CLOSED";
9
+ })(OrganizationStatus || (exports.OrganizationStatus = OrganizationStatus = {}));
@@ -0,0 +1,12 @@
1
+ export declare enum GlobalPermission {
2
+ MANAGE_SYSTEM = "manage_system",
3
+ MANAGE_ALL_ORGS = "manage_all_orgs",
4
+ MANAGE_USERS = "manage_users",
5
+ VIEW_SYSTEM_LOGS = "view_system_logs",
6
+ SUPPORT_ACTIONS = "support_actions",
7
+ MODERATE_CONTENT = "moderate_content"
8
+ }
9
+ export declare enum OrgPermission {
10
+ MANAGE_ORG = "manage_org",
11
+ MANAGE_MEMBERS = "manage_members"
12
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OrgPermission = exports.GlobalPermission = void 0;
4
+ var GlobalPermission;
5
+ (function (GlobalPermission) {
6
+ GlobalPermission["MANAGE_SYSTEM"] = "manage_system";
7
+ GlobalPermission["MANAGE_ALL_ORGS"] = "manage_all_orgs";
8
+ GlobalPermission["MANAGE_USERS"] = "manage_users";
9
+ GlobalPermission["VIEW_SYSTEM_LOGS"] = "view_system_logs";
10
+ GlobalPermission["SUPPORT_ACTIONS"] = "support_actions";
11
+ GlobalPermission["MODERATE_CONTENT"] = "moderate_content";
12
+ })(GlobalPermission || (exports.GlobalPermission = GlobalPermission = {}));
13
+ var OrgPermission;
14
+ (function (OrgPermission) {
15
+ OrgPermission["MANAGE_ORG"] = "manage_org";
16
+ OrgPermission["MANAGE_MEMBERS"] = "manage_members";
17
+ })(OrgPermission || (exports.OrgPermission = OrgPermission = {}));
@@ -0,0 +1,7 @@
1
+ export declare enum UserRole {
2
+ SUPERADMIN = "SUPERADMIN",
3
+ ADMIN = "ADMIN",
4
+ SUPPORT = "SUPPORT",
5
+ MODERATOR = "MODERATOR",
6
+ USER = "USER"
7
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UserRole = void 0;
4
+ var UserRole;
5
+ (function (UserRole) {
6
+ UserRole["SUPERADMIN"] = "SUPERADMIN";
7
+ UserRole["ADMIN"] = "ADMIN";
8
+ UserRole["SUPPORT"] = "SUPPORT";
9
+ UserRole["MODERATOR"] = "MODERATOR";
10
+ UserRole["USER"] = "USER";
11
+ })(UserRole || (exports.UserRole = UserRole = {}));
@@ -0,0 +1,32 @@
1
+ export declare enum OrganizationRole {
2
+ OWNER = "OWNER",
3
+ ADMIN = "ADMIN",
4
+ EDITOR = "EDITOR",
5
+ VIEWER = "VIEWER"
6
+ }
7
+ export declare enum UserStatus {
8
+ ACTIVE = "ACTIVE",
9
+ SUSPENDED = "SUSPENDED",
10
+ DELETED = "DELETED"
11
+ }
12
+ export declare enum OrganizationStatus {
13
+ ACTIVE = "ACTIVE",
14
+ SUSPENDED = "SUSPENDED",
15
+ CLOSED = "CLOSED"
16
+ }
17
+ export declare enum MembershipStatus {
18
+ ACTIVE = "ACTIVE",
19
+ INVITED = "INVITED",
20
+ SUSPENDED = "SUSPENDED"
21
+ }
22
+ export declare enum Theme {
23
+ LIGHT = "LIGHT",
24
+ DARK = "DARK",
25
+ SYSTEM = "SYSTEM"
26
+ }
27
+ export declare enum Currency {
28
+ USD = "USD",
29
+ EUR = "EUR",
30
+ GBP = "GBP",
31
+ INR = "INR"
32
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Currency = exports.Theme = exports.MembershipStatus = exports.OrganizationStatus = exports.UserStatus = exports.OrganizationRole = void 0;
4
+ var OrganizationRole;
5
+ (function (OrganizationRole) {
6
+ OrganizationRole["OWNER"] = "OWNER";
7
+ OrganizationRole["ADMIN"] = "ADMIN";
8
+ OrganizationRole["EDITOR"] = "EDITOR";
9
+ OrganizationRole["VIEWER"] = "VIEWER";
10
+ })(OrganizationRole || (exports.OrganizationRole = OrganizationRole = {}));
11
+ var UserStatus;
12
+ (function (UserStatus) {
13
+ UserStatus["ACTIVE"] = "ACTIVE";
14
+ UserStatus["SUSPENDED"] = "SUSPENDED";
15
+ UserStatus["DELETED"] = "DELETED";
16
+ })(UserStatus || (exports.UserStatus = UserStatus = {}));
17
+ var OrganizationStatus;
18
+ (function (OrganizationStatus) {
19
+ OrganizationStatus["ACTIVE"] = "ACTIVE";
20
+ OrganizationStatus["SUSPENDED"] = "SUSPENDED";
21
+ OrganizationStatus["CLOSED"] = "CLOSED";
22
+ })(OrganizationStatus || (exports.OrganizationStatus = OrganizationStatus = {}));
23
+ var MembershipStatus;
24
+ (function (MembershipStatus) {
25
+ MembershipStatus["ACTIVE"] = "ACTIVE";
26
+ MembershipStatus["INVITED"] = "INVITED";
27
+ MembershipStatus["SUSPENDED"] = "SUSPENDED";
28
+ })(MembershipStatus || (exports.MembershipStatus = MembershipStatus = {}));
29
+ var Theme;
30
+ (function (Theme) {
31
+ Theme["LIGHT"] = "LIGHT";
32
+ Theme["DARK"] = "DARK";
33
+ Theme["SYSTEM"] = "SYSTEM";
34
+ })(Theme || (exports.Theme = Theme = {}));
35
+ var Currency;
36
+ (function (Currency) {
37
+ Currency["USD"] = "USD";
38
+ Currency["EUR"] = "EUR";
39
+ Currency["GBP"] = "GBP";
40
+ Currency["INR"] = "INR";
41
+ })(Currency || (exports.Currency = Currency = {}));
@@ -0,0 +1,5 @@
1
+ export declare enum UserStatus {
2
+ ACTIVE = "ACTIVE",
3
+ SUSPENDED = "SUSPENDED",
4
+ DELETED = "DELETED"
5
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UserStatus = void 0;
4
+ var UserStatus;
5
+ (function (UserStatus) {
6
+ UserStatus["ACTIVE"] = "ACTIVE";
7
+ UserStatus["SUSPENDED"] = "SUSPENDED";
8
+ UserStatus["DELETED"] = "DELETED";
9
+ })(UserStatus || (exports.UserStatus = UserStatus = {}));
@@ -0,0 +1,6 @@
1
+ export declare class AppError extends Error {
2
+ readonly code: string;
3
+ readonly statusCode: number;
4
+ readonly details?: any;
5
+ constructor(code: string, statusCode: number, message: string, details?: any);
6
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppError = void 0;
4
+ class AppError extends Error {
5
+ constructor(code, statusCode, message, details) {
6
+ super(message);
7
+ this.code = code;
8
+ this.statusCode = statusCode;
9
+ this.details = details;
10
+ this.name = this.constructor.name;
11
+ // A simple runtime check is all you need now.
12
+ // TypeScript knows this exists because of @types/node.
13
+ if (typeof Error.captureStackTrace === "function") {
14
+ Error.captureStackTrace(this, this.constructor);
15
+ }
16
+ Object.freeze(this);
17
+ }
18
+ }
19
+ exports.AppError = AppError;