orbitx-core-models 11.103.0 → 11.112.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 (52) hide show
  1. package/dist/index.d.ts +14 -2
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +29 -1
  4. package/dist/interfaces/agent.interface.d.ts +6 -1
  5. package/dist/interfaces/agent.interface.d.ts.map +1 -1
  6. package/dist/interfaces/callSession.interface.d.ts +6 -0
  7. package/dist/interfaces/callSession.interface.d.ts.map +1 -1
  8. package/dist/interfaces/request.interface.d.ts +33 -0
  9. package/dist/interfaces/request.interface.d.ts.map +1 -0
  10. package/dist/interfaces/request.interface.js +2 -0
  11. package/dist/interfaces/role.interface.d.ts +12 -0
  12. package/dist/interfaces/role.interface.d.ts.map +1 -0
  13. package/dist/interfaces/role.interface.js +2 -0
  14. package/dist/interfaces/user.interface.d.ts +5 -0
  15. package/dist/interfaces/user.interface.d.ts.map +1 -1
  16. package/dist/models/agent.model.d.ts.map +1 -1
  17. package/dist/models/agent.model.js +21 -2
  18. package/dist/models/callSession.model.d.ts.map +1 -1
  19. package/dist/models/callSession.model.js +12 -0
  20. package/dist/models/request.model.d.ts +9 -0
  21. package/dist/models/request.model.d.ts.map +1 -0
  22. package/dist/models/request.model.js +150 -0
  23. package/dist/models/role.model.d.ts +8 -0
  24. package/dist/models/role.model.d.ts.map +1 -0
  25. package/dist/models/role.model.js +72 -0
  26. package/dist/models/user.model.d.ts.map +1 -1
  27. package/dist/models/user.model.js +21 -0
  28. package/dist/permissions/resolve.d.ts +50 -0
  29. package/dist/permissions/resolve.d.ts.map +1 -0
  30. package/dist/permissions/resolve.js +68 -0
  31. package/dist/permissions/seeds/roles.seed.d.ts +19 -0
  32. package/dist/permissions/seeds/roles.seed.d.ts.map +1 -0
  33. package/dist/permissions/seeds/roles.seed.js +169 -0
  34. package/dist/permissions/treeUtils.d.ts +9 -0
  35. package/dist/permissions/treeUtils.d.ts.map +1 -0
  36. package/dist/permissions/treeUtils.js +46 -0
  37. package/dist/permissions/trees/client.tree.d.ts +3 -0
  38. package/dist/permissions/trees/client.tree.d.ts.map +1 -0
  39. package/dist/permissions/trees/client.tree.js +99 -0
  40. package/dist/permissions/trees/employee.tree.d.ts +3 -0
  41. package/dist/permissions/trees/employee.tree.d.ts.map +1 -0
  42. package/dist/permissions/trees/employee.tree.js +35 -0
  43. package/dist/permissions/trees/ops.tree.d.ts +3 -0
  44. package/dist/permissions/trees/ops.tree.d.ts.map +1 -0
  45. package/dist/permissions/trees/ops.tree.js +173 -0
  46. package/dist/permissions/trees/partner.tree.d.ts +3 -0
  47. package/dist/permissions/trees/partner.tree.d.ts.map +1 -0
  48. package/dist/permissions/trees/partner.tree.js +71 -0
  49. package/dist/permissions/types.d.ts +9 -0
  50. package/dist/permissions/types.d.ts.map +1 -0
  51. package/dist/permissions/types.js +4 -0
  52. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -30,6 +30,8 @@ import { LoginOtp } from "./models/loginOtp.model";
30
30
  import { Counter } from "./models/counter.model";
31
31
  import { Employee } from "./models/employee.model";
32
32
  import { CallSession } from "./models/callSession.model";
33
+ import { Request } from "./models/request.model";
34
+ import { Role } from "./models/role.model";
33
35
  import { IChat } from "./interfaces/chat.interface";
34
36
  import { IMacro } from "./interfaces/macro.interface";
35
37
  import { IVertical } from "./interfaces/vertical.interface";
@@ -61,6 +63,16 @@ import { ISession } from "./interfaces/session.interface";
61
63
  import { ILoginOtp } from "./interfaces/loginOtp.interface";
62
64
  import { IEmployee } from "./interfaces/employee.interface";
63
65
  import { ICallSession, CallSessionStatus, CallSessionDirection } from "./interfaces/callSession.interface";
64
- export { Chat, Message, User, Vertical, Macro, Partner, Company, CompanySettings, Review, Wallet, StripeLog, Transaction, Lead, TierConfig, TierProgress, MonthlyTierSnapshot, Product, Plan, PlanOption, Addon, Subscription, Visitor, Group, Agent, LeadLedger, Invoice, LeadDispute, Session, LoginOtp, Counter, Employee, CallSession, };
65
- export type { IChat, IMessage, IUser, IVertical, IMacro, IPartner, ICompany, IOnboardingStep, ITwilioConfig, ICompanySettings, ICallConnectSettings, ILeadConfig, ILeadFields, IReview, IWallet, IStripeLog, ITransaction, ILead, ITierConfig, ITierProgress, IMonthlyTierSnapshot, IProduct, IPlan, IPlanOption, IAddon, ISubscription, IVisitor, IGroup, IAgent, ILeadLedger, IInvoice, ILeadDispute, ISession, ILoginOtp, IEmployee, ICallSession, CallSessionStatus, CallSessionDirection, };
66
+ import { IRequest, IRequestAttachment, IRequestDetails, RequestCategory, RequestStatus } from "./interfaces/request.interface";
67
+ import { IRole } from "./interfaces/role.interface";
68
+ import { Dashboard, PermissionNode, DASHBOARDS } from "./permissions/types";
69
+ import { opsTree } from "./permissions/trees/ops.tree";
70
+ import { employeeTree } from "./permissions/trees/employee.tree";
71
+ import { partnerTree } from "./permissions/trees/partner.tree";
72
+ import { clientTree } from "./permissions/trees/client.tree";
73
+ import { getTree, getAllKeys, getParentKey, getAncestorKeys } from "./permissions/treeUtils";
74
+ import { resolveEffectivePermissions, hasPermission, validateGrantedKeys, validateExtraKeys, getFullAccessKeys, PermissionSource, ValidationResult } from "./permissions/resolve";
75
+ import { roleSeeds, RoleSeed } from "./permissions/seeds/roles.seed";
76
+ export { Chat, Message, User, Vertical, Macro, Partner, Company, CompanySettings, Review, Wallet, StripeLog, Transaction, Lead, TierConfig, TierProgress, MonthlyTierSnapshot, Product, Plan, PlanOption, Addon, Subscription, Visitor, Group, Agent, LeadLedger, Invoice, LeadDispute, Session, LoginOtp, Counter, Employee, CallSession, Request, Role, opsTree, employeeTree, partnerTree, clientTree, DASHBOARDS, getTree, getAllKeys, getParentKey, getAncestorKeys, resolveEffectivePermissions, hasPermission, validateGrantedKeys, validateExtraKeys, getFullAccessKeys, roleSeeds, };
77
+ export type { IChat, IMessage, IUser, IVertical, IMacro, IPartner, ICompany, IOnboardingStep, ITwilioConfig, ICompanySettings, ICallConnectSettings, ILeadConfig, ILeadFields, IReview, IWallet, IStripeLog, ITransaction, ILead, ITierConfig, ITierProgress, IMonthlyTierSnapshot, IProduct, IPlan, IPlanOption, IAddon, ISubscription, IVisitor, IGroup, IAgent, ILeadLedger, IInvoice, ILeadDispute, ISession, ILoginOtp, IEmployee, ICallSession, CallSessionStatus, CallSessionDirection, IRequest, IRequestAttachment, IRequestDetails, RequestCategory, RequestStatus, IRole, Dashboard, PermissionNode, PermissionSource, ValidationResult, RoleSeed, };
66
78
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,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,MAAM,oCAAoC,CAAC;AAE3G,OAAO,EACL,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,KAAK,EACL,OAAO,EACP,OAAO,EACP,eAAe,EACf,MAAM,EACN,MAAM,EACN,SAAS,EACT,WAAW,EACX,IAAI,EACJ,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,OAAO,EACP,IAAI,EACJ,UAAU,EACV,KAAK,EACL,YAAY,EACZ,OAAO,EACP,KAAK,EACL,KAAK,EACL,UAAU,EACV,OAAO,EACP,WAAW,EACX,OAAO,EACP,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,WAAW,GACZ,CAAC;AACF,YAAY,EACV,KAAK,EACL,QAAQ,EACR,KAAK,EACL,SAAS,EACT,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACpB,WAAW,EACX,WAAW,EACX,OAAO,EACP,OAAO,EACP,UAAU,EACV,YAAY,EACZ,KAAK,EACL,WAAW,EACX,aAAa,EACb,oBAAoB,EACpB,QAAQ,EACR,KAAK,EACL,WAAW,EACX,MAAM,EACN,aAAa,EACb,QAAQ,EACR,MAAM,EACN,MAAM,EACN,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,oBAAoB,GACrB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,w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f,eAAe,EACf,aAAa,EACb,KAAK,EACL,SAAS,EACT,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,QAAQ,GACT,CAAC"}
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CallSession = exports.Employee = exports.Counter = exports.LoginOtp = exports.Session = exports.LeadDispute = exports.Invoice = exports.LeadLedger = exports.Agent = exports.Group = exports.Visitor = exports.Subscription = exports.Addon = exports.PlanOption = exports.Plan = exports.Product = exports.MonthlyTierSnapshot = exports.TierProgress = exports.TierConfig = exports.Lead = exports.Transaction = exports.StripeLog = exports.Wallet = exports.Review = exports.CompanySettings = exports.Company = exports.Partner = exports.Macro = exports.Vertical = exports.User = exports.Message = exports.Chat = void 0;
3
+ exports.roleSeeds = exports.getFullAccessKeys = exports.validateExtraKeys = exports.validateGrantedKeys = exports.hasPermission = exports.resolveEffectivePermissions = exports.getAncestorKeys = exports.getParentKey = exports.getAllKeys = exports.getTree = exports.DASHBOARDS = exports.clientTree = exports.partnerTree = exports.employeeTree = exports.opsTree = exports.Role = exports.Request = exports.CallSession = exports.Employee = exports.Counter = exports.LoginOtp = exports.Session = exports.LeadDispute = exports.Invoice = exports.LeadLedger = exports.Agent = exports.Group = exports.Visitor = exports.Subscription = exports.Addon = exports.PlanOption = exports.Plan = exports.Product = exports.MonthlyTierSnapshot = exports.TierProgress = exports.TierConfig = exports.Lead = exports.Transaction = exports.StripeLog = exports.Wallet = exports.Review = exports.CompanySettings = exports.Company = exports.Partner = exports.Macro = exports.Vertical = exports.User = exports.Message = exports.Chat = void 0;
4
4
  // MODELS
5
5
  const chat_model_1 = require("./models/chat.model");
6
6
  Object.defineProperty(exports, "Chat", { enumerable: true, get: function () { return chat_model_1.Chat; } });
@@ -66,3 +66,31 @@ const employee_model_1 = require("./models/employee.model");
66
66
  Object.defineProperty(exports, "Employee", { enumerable: true, get: function () { return employee_model_1.Employee; } });
67
67
  const callSession_model_1 = require("./models/callSession.model");
68
68
  Object.defineProperty(exports, "CallSession", { enumerable: true, get: function () { return callSession_model_1.CallSession; } });
69
+ const request_model_1 = require("./models/request.model");
70
+ Object.defineProperty(exports, "Request", { enumerable: true, get: function () { return request_model_1.Request; } });
71
+ const role_model_1 = require("./models/role.model");
72
+ Object.defineProperty(exports, "Role", { enumerable: true, get: function () { return role_model_1.Role; } });
73
+ // PERMISSIONS
74
+ const types_1 = require("./permissions/types");
75
+ Object.defineProperty(exports, "DASHBOARDS", { enumerable: true, get: function () { return types_1.DASHBOARDS; } });
76
+ const ops_tree_1 = require("./permissions/trees/ops.tree");
77
+ Object.defineProperty(exports, "opsTree", { enumerable: true, get: function () { return ops_tree_1.opsTree; } });
78
+ const employee_tree_1 = require("./permissions/trees/employee.tree");
79
+ Object.defineProperty(exports, "employeeTree", { enumerable: true, get: function () { return employee_tree_1.employeeTree; } });
80
+ const partner_tree_1 = require("./permissions/trees/partner.tree");
81
+ Object.defineProperty(exports, "partnerTree", { enumerable: true, get: function () { return partner_tree_1.partnerTree; } });
82
+ const client_tree_1 = require("./permissions/trees/client.tree");
83
+ Object.defineProperty(exports, "clientTree", { enumerable: true, get: function () { return client_tree_1.clientTree; } });
84
+ const treeUtils_1 = require("./permissions/treeUtils");
85
+ Object.defineProperty(exports, "getTree", { enumerable: true, get: function () { return treeUtils_1.getTree; } });
86
+ Object.defineProperty(exports, "getAllKeys", { enumerable: true, get: function () { return treeUtils_1.getAllKeys; } });
87
+ Object.defineProperty(exports, "getParentKey", { enumerable: true, get: function () { return treeUtils_1.getParentKey; } });
88
+ Object.defineProperty(exports, "getAncestorKeys", { enumerable: true, get: function () { return treeUtils_1.getAncestorKeys; } });
89
+ const resolve_1 = require("./permissions/resolve");
90
+ Object.defineProperty(exports, "resolveEffectivePermissions", { enumerable: true, get: function () { return resolve_1.resolveEffectivePermissions; } });
91
+ Object.defineProperty(exports, "hasPermission", { enumerable: true, get: function () { return resolve_1.hasPermission; } });
92
+ Object.defineProperty(exports, "validateGrantedKeys", { enumerable: true, get: function () { return resolve_1.validateGrantedKeys; } });
93
+ Object.defineProperty(exports, "validateExtraKeys", { enumerable: true, get: function () { return resolve_1.validateExtraKeys; } });
94
+ Object.defineProperty(exports, "getFullAccessKeys", { enumerable: true, get: function () { return resolve_1.getFullAccessKeys; } });
95
+ const roles_seed_1 = require("./permissions/seeds/roles.seed");
96
+ Object.defineProperty(exports, "roleSeeds", { enumerable: true, get: function () { return roles_seed_1.roleSeeds; } });
@@ -1,6 +1,6 @@
1
1
  import { Document, Schema } from "mongoose";
2
2
  type AgentRole = "agent-chat" | "account-manager" | "admin";
3
- type CurrentStatus = "online" | "away" | "offline";
3
+ type CurrentStatus = string;
4
4
  type PresenceStatus = "available" | "busy";
5
5
  export interface IAgent extends Document {
6
6
  name: string;
@@ -18,6 +18,11 @@ export interface IAgent extends Document {
18
18
  lastLogin?: Date | null;
19
19
  lastActiveAt?: Date | null;
20
20
  ipAddress?: string | null;
21
+ roleId?: Schema.Types.ObjectId | null;
22
+ permissionMode?: "role" | "custom";
23
+ permissionKeys?: string[];
24
+ /** Individually-granted extras on top of roleId -- only used in "role" mode. */
25
+ extraPermissionKeys?: string[];
21
26
  createdAt: Date;
22
27
  updatedAt: Date;
23
28
  comparePassword(input: string): Promise<boolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"agent.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/agent.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAE5C,KAAK,SAAS,GAAG,YAAY,GAAG,iBAAiB,GAAG,OAAO,CAAC;AAC5D,KAAK,aAAa,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;AACnD,KAAK,cAAc,GAAG,WAAW,GAAG,MAAM,CAAC;AAE3C,MAAM,WAAW,MAAO,SAAQ,QAAQ;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,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,CAAC,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IACnC,aAAa,EAAE,aAAa,CAAC;IAC7B,cAAc,EAAE,cAAc,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACxB,YAAY,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAI1B,MAAM,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC;IACtC,cAAc,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IACnC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,gFAAgF;IAChF,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACjD,UAAU,EAAE,OAAO,CAAC;CACrB"}
@@ -14,8 +14,14 @@ export interface ICallSession {
14
14
  direction: CallSessionDirection;
15
15
  recordingSid?: string;
16
16
  recordingUrl?: string;
17
+ /** Index into the dial queue (callConnectLocations + primary fallback) currently being attempted. */
18
+ currentLocationIndex?: number;
19
+ /** Friendly name of the location that actually answered — set when the company leg is answered. */
20
+ locationName?: string;
17
21
  durationSeconds?: number;
18
22
  failureReason?: string;
23
+ /** Timestamp when the post-call recording email was dispatched via SendGrid. */
24
+ transcriptEmailSentAt?: Date;
19
25
  startedAt?: Date;
20
26
  connectedAt?: Date;
21
27
  endedAt?: Date;
@@ -1 +1 @@
1
- {"version":3,"file":"callSession.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/callSession.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,MAAM,MAAM,iBAAiB,GACzB,SAAS,GACT,SAAS,GACT,WAAW,GACX,WAAW,GACX,QAAQ,GACR,MAAM,GACN,WAAW,GACX,WAAW,CAAC;AAEhB,MAAM,MAAM,oBAAoB,GAAG,eAAe,GAAG,eAAe,CAAC;AAErE,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC;IAGrB,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC;IAC1B,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC;IAGvB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,mBAAmB,EAAE,MAAM,CAAC;IAG5B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IAGzB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,SAAS,EAAE,oBAAoB,CAAC;IAGhC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IAGtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IAGvB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,WAAW,CAAC,EAAE,IAAI,CAAC;IACnB,OAAO,CAAC,EAAE,IAAI,CAAC;IAEf,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB"}
1
+ {"version":3,"file":"callSession.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/callSession.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,MAAM,MAAM,iBAAiB,GACzB,SAAS,GACT,SAAS,GACT,WAAW,GACX,WAAW,GACX,QAAQ,GACR,MAAM,GACN,WAAW,GACX,WAAW,CAAC;AAEhB,MAAM,MAAM,oBAAoB,GAAG,eAAe,GAAG,eAAe,CAAC;AAErE,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC;IAGrB,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC;IAC1B,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC;IAGvB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,mBAAmB,EAAE,MAAM,CAAC;IAG5B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IAGzB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,SAAS,EAAE,oBAAoB,CAAC;IAGhC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IAGtB,qGAAqG;IACrG,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,mGAAmG;IACnG,YAAY,CAAC,EAAE,MAAM,CAAC;IAGtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IAGvB,gFAAgF;IAChF,qBAAqB,CAAC,EAAE,IAAI,CAAC;IAG7B,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,WAAW,CAAC,EAAE,IAAI,CAAC;IACnB,OAAO,CAAC,EAAE,IAAI,CAAC;IAEf,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB"}
@@ -0,0 +1,33 @@
1
+ import { Document, Types } from "mongoose";
2
+ export type RequestCategory = "business_information" | "contact_information" | "cancellation" | "change_plan" | "script";
3
+ export type RequestStatus = "pending" | "in_progress" | "resolved";
4
+ export interface IRequestDetails {
5
+ subcategory?: string;
6
+ reason?: string;
7
+ plan?: string;
8
+ folder?: string;
9
+ macro?: string;
10
+ }
11
+ export interface IRequestAttachment {
12
+ url: string;
13
+ s3Key: string;
14
+ fileName: string;
15
+ mimeType: string;
16
+ size: number;
17
+ }
18
+ export interface IRequest extends Document {
19
+ requestId: string;
20
+ companyId: Types.ObjectId;
21
+ category: RequestCategory;
22
+ details: IRequestDetails;
23
+ description?: string;
24
+ attachment?: IRequestAttachment;
25
+ requestedBy: Types.ObjectId;
26
+ status: RequestStatus;
27
+ remarks?: string;
28
+ resolvedBy?: Types.ObjectId;
29
+ resolvedAt?: Date;
30
+ createdAt?: Date;
31
+ updatedAt?: Date;
32
+ }
33
+ //# sourceMappingURL=request.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/request.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAE3C,MAAM,MAAM,eAAe,GACvB,sBAAsB,GACtB,qBAAqB,GACrB,cAAc,GACd,aAAa,GACb,QAAQ,CAAC;AAEb,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,aAAa,GAAG,UAAU,CAAC;AAEnE,MAAM,WAAW,eAAe;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,QAAS,SAAQ,QAAQ;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC;IAC1B,QAAQ,EAAE,eAAe,CAAC;IAC1B,OAAO,EAAE,eAAe,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAChC,WAAW,EAAE,KAAK,CAAC,QAAQ,CAAC;IAC5B,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC;IAC5B,UAAU,CAAC,EAAE,IAAI,CAAC;IAClB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,12 @@
1
+ import mongoose from "mongoose";
2
+ import { Dashboard } from "../permissions/types";
3
+ export interface IRole extends mongoose.Document {
4
+ dashboard: Dashboard;
5
+ key: string;
6
+ label: string;
7
+ isSystemRole: boolean;
8
+ grantedKeys: string[];
9
+ createdAt?: Date;
10
+ updatedAt?: Date;
11
+ }
12
+ //# sourceMappingURL=role.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"role.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/role.interface.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,MAAM,WAAW,KAAM,SAAQ,QAAQ,CAAC,QAAQ;IAC9C,SAAS,EAAE,SAAS,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -19,6 +19,11 @@ export interface IUser extends mongoose.Document {
19
19
  lastLogin?: Date;
20
20
  lockedOut?: boolean;
21
21
  userId: string;
22
+ roleId?: mongoose.Types.ObjectId;
23
+ permissionMode?: "role" | "custom";
24
+ permissionKeys?: string[];
25
+ /** Individually-granted extras on top of roleId -- only used in "role" mode. */
26
+ extraPermissionKeys?: string[];
22
27
  createdAt?: Date;
23
28
  updatedAt?: Date;
24
29
  twoFactorEnabled?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"user.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/user.interface.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,MAAM,WAAW,KAAM,SAAQ,QAAQ,CAAC,QAAQ;IAC9C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EACA,MAAM,GACN,iBAAiB,GACjB,aAAa,GACb,OAAO,GACP,YAAY,GACZ,iBAAiB,GACjB,SAAS,CAAC;IACd,SAAS,EAAE,SAAS,GAAG,SAAS,GAAG,WAAW,CAAC;IAC/C,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC/B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,OAAO,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC;IAClC,aAAa,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAC;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IAC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Y,CAAC,EAAE,IAAI,CAAC;CACrB;AACD,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,IAAI,CAAC;CACrB"}
@@ -1 +1 @@
1
- {"version":3,"file":"agent.model.d.ts","sourceRoot":"","sources":["../../src/models/agent.model.ts"],"names":[],"mappings":"AAEA,OAAiB,EAAU,KAAK,EAAE,MAAM,UAAU,CAAC;AAEnD,OAAO,EAAC,MAAM,EAAC,MAAM,+BAA+B,CAAC;AAuHrD,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,MAAM,CAAgD,CAAC;AACjF,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"agent.model.d.ts","sourceRoot":"","sources":["../../src/models/agent.model.ts"],"names":[],"mappings":"AAEA,OAAiB,EAAU,KAAK,EAAE,MAAM,UAAU,CAAC;AAEnD,OAAO,EAAC,MAAM,EAAC,MAAM,+BAA+B,CAAC;AA8IrD,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,MAAM,CAAgD,CAAC;AACjF,eAAe,KAAK,CAAC"}
@@ -86,7 +86,6 @@ const agentSchema = new mongoose_1.Schema({
86
86
  ],
87
87
  currentStatus: {
88
88
  type: String,
89
- enum: ["online", "away", "offline"],
90
89
  default: "offline",
91
90
  index: true,
92
91
  },
@@ -123,6 +122,26 @@ const agentSchema = new mongoose_1.Schema({
123
122
  type: String,
124
123
  default: null,
125
124
  },
125
+ // ─────────────────────────────────────────────
126
+ // RBAC
127
+ // ─────────────────────────────────────────────
128
+ roleId: {
129
+ type: mongoose_1.Schema.Types.ObjectId,
130
+ ref: "Role",
131
+ default: null,
132
+ index: true,
133
+ },
134
+ permissionMode: {
135
+ type: String,
136
+ enum: ["role", "custom"],
137
+ default: "role",
138
+ },
139
+ // Authoritative only when permissionMode === "custom"; see
140
+ // src/permissions/resolve.ts for how this and roleId are reconciled.
141
+ permissionKeys: [{ type: String }],
142
+ // Individually-granted extras on top of roleId's own grantedKeys --
143
+ // only applied in "role" mode.
144
+ extraPermissionKeys: [{ type: String }],
126
145
  }, {
127
146
  timestamps: true,
128
147
  });
@@ -142,7 +161,7 @@ agentSchema.methods.comparePassword = async function (input) {
142
161
  };
143
162
  agentSchema.virtual("isRoutable").get(function () {
144
163
  return (this.role === "agent-chat" &&
145
- this.currentStatus === "online" &&
164
+ this.currentStatus === "active" &&
146
165
  this.presenceStatus === "available" &&
147
166
  !this.lockedOut);
148
167
  });
@@ -1 +1 @@
1
- {"version":3,"file":"callSession.model.d.ts","sourceRoot":"","sources":["../../src/models/callSession.model.ts"],"names":[],"mappings":"AAAA,OAAO,QAAoB,MAAM,UAAU,CAAC;AAC5C,OAAO,EACL,YAAY,EACb,MAAM,qCAAqC,CAAC;AA0G7C,eAAO,MAAM,WAAW;;;;OAGvB,CAAC;AACF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"callSession.model.d.ts","sourceRoot":"","sources":["../../src/models/callSession.model.ts"],"names":[],"mappings":"AAAA,OAAO,QAAoB,MAAM,UAAU,CAAC;AAC5C,OAAO,EACL,YAAY,EACb,MAAM,qCAAqC,CAAC;AAwH7C,eAAO,MAAM,WAAW;;;;OAGvB,CAAC;AACF,eAAe,WAAW,CAAC"}
@@ -95,11 +95,23 @@ const callSessionSchema = new mongoose_1.Schema({
95
95
  recordingSid: { type: String },
96
96
  recordingUrl: { type: String },
97
97
  // ─────────────────────────────────────────────
98
+ // MULTI-LOCATION ROUTING
99
+ // ─────────────────────────────────────────────
100
+ /** Index in the dial queue currently being attempted (locations + primary fallback). */
101
+ currentLocationIndex: { type: Number, default: 0 },
102
+ /** Friendly name of the location that actually answered. */
103
+ locationName: { type: String },
104
+ // ─────────────────────────────────────────────
98
105
  // METRICS & REASON
99
106
  // ─────────────────────────────────────────────
100
107
  durationSeconds: { type: Number },
101
108
  failureReason: { type: String },
102
109
  // ─────────────────────────────────────────────
110
+ // POST-CALL EMAIL
111
+ // ─────────────────────────────────────────────
112
+ /** Timestamp when the post-call recording email was dispatched via SendGrid. */
113
+ transcriptEmailSentAt: { type: Date },
114
+ // ─────────────────────────────────────────────
103
115
  // TIMESTAMPS
104
116
  // ─────────────────────────────────────────────
105
117
  startedAt: { type: Date },
@@ -0,0 +1,9 @@
1
+ import mongoose from "mongoose";
2
+ import { IRequest } from "../interfaces/request.interface";
3
+ export declare const Request: mongoose.Model<IRequest, {}, {}, {}, mongoose.Document<unknown, {}, IRequest, {}, {}> & IRequest & Required<{
4
+ _id: unknown;
5
+ }> & {
6
+ __v: number;
7
+ }, any>;
8
+ export default Request;
9
+ //# sourceMappingURL=request.model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.model.d.ts","sourceRoot":"","sources":["../../src/models/request.model.ts"],"names":[],"mappings":"AAAA,OAAO,QAAoB,MAAM,UAAU,CAAC;AAE5C,OAAO,EACL,QAAQ,EAGT,MAAM,iCAAiC,CAAC;AAuIzC,eAAO,MAAM,OAAO;;;;OAAqD,CAAC;AAC1E,eAAe,OAAO,CAAC"}
@@ -0,0 +1,150 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.Request = void 0;
37
+ const mongoose_1 = __importStar(require("mongoose"));
38
+ const counter_model_1 = require("./counter.model");
39
+ const requestDetailsSchema = new mongoose_1.Schema({
40
+ subcategory: { type: String, trim: true, maxlength: 150 },
41
+ reason: { type: String, trim: true, maxlength: 150 },
42
+ plan: { type: String, trim: true, maxlength: 150 },
43
+ folder: { type: String, trim: true, maxlength: 150 },
44
+ macro: { type: String, trim: true, maxlength: 150 },
45
+ }, { _id: false });
46
+ const requestAttachmentSchema = new mongoose_1.Schema({
47
+ url: { type: String, required: true, trim: true },
48
+ s3Key: { type: String, required: true, trim: true },
49
+ fileName: { type: String, required: true, trim: true },
50
+ mimeType: { type: String, required: true, trim: true },
51
+ size: { type: Number, required: true, min: 0 },
52
+ }, { _id: false });
53
+ const requestSchema = new mongoose_1.Schema({
54
+ requestId: {
55
+ type: String,
56
+ unique: true,
57
+ immutable: true,
58
+ index: true,
59
+ },
60
+ companyId: {
61
+ type: mongoose_1.Schema.Types.ObjectId,
62
+ ref: "Company",
63
+ required: [true, "Company ID is required"],
64
+ index: true,
65
+ },
66
+ category: {
67
+ type: String,
68
+ enum: [
69
+ "business_information",
70
+ "contact_information",
71
+ "cancellation",
72
+ "change_plan",
73
+ "script",
74
+ ],
75
+ required: [true, "Request category is required"],
76
+ index: true,
77
+ },
78
+ details: {
79
+ type: requestDetailsSchema,
80
+ required: [true, "Request details are required"],
81
+ default: {},
82
+ },
83
+ description: {
84
+ type: String,
85
+ trim: true,
86
+ maxlength: [5000, "Description cannot exceed 5000 characters"],
87
+ },
88
+ attachment: requestAttachmentSchema,
89
+ requestedBy: {
90
+ type: mongoose_1.Schema.Types.ObjectId,
91
+ ref: "User",
92
+ required: [true, "Requested by user ID is required"],
93
+ index: true,
94
+ },
95
+ status: {
96
+ type: String,
97
+ enum: ["pending", "in_progress", "resolved"],
98
+ default: "pending",
99
+ index: true,
100
+ },
101
+ remarks: {
102
+ type: String,
103
+ trim: true,
104
+ maxlength: [5000, "Remarks cannot exceed 5000 characters"],
105
+ },
106
+ resolvedBy: {
107
+ type: mongoose_1.Schema.Types.ObjectId,
108
+ ref: "User",
109
+ },
110
+ resolvedAt: Date,
111
+ }, {
112
+ timestamps: true,
113
+ toJSON: { virtuals: true },
114
+ toObject: { virtuals: true },
115
+ });
116
+ requestSchema.pre("validate", function () {
117
+ const details = this.details || {};
118
+ if (["business_information", "contact_information"].includes(this.category) &&
119
+ !details.subcategory) {
120
+ this.invalidate("details.subcategory", "Request sub-category is required");
121
+ }
122
+ if (this.category === "cancellation" && !details.reason) {
123
+ this.invalidate("details.reason", "Cancellation reason is required");
124
+ }
125
+ if (this.category === "change_plan" && !details.plan) {
126
+ this.invalidate("details.plan", "Requested plan is required");
127
+ }
128
+ if (this.category === "script") {
129
+ if (!details.folder) {
130
+ this.invalidate("details.folder", "Script folder is required");
131
+ }
132
+ if (!details.macro) {
133
+ this.invalidate("details.macro", "Script macro is required");
134
+ }
135
+ }
136
+ if (this.category !== "cancellation" && !this.description) {
137
+ this.invalidate("description", "Request description is required");
138
+ }
139
+ });
140
+ requestSchema.pre("save", async function () {
141
+ if (!this.isNew || this.requestId)
142
+ return;
143
+ const counter = await counter_model_1.Counter.findByIdAndUpdate("requestId", { $inc: { seq: 1 } }, { new: true, upsert: true, setDefaultsOnInsert: true });
144
+ this.requestId = `REQ-${String(counter.seq).padStart(6, "0")}`;
145
+ });
146
+ requestSchema.index({ companyId: 1, createdAt: -1 });
147
+ requestSchema.index({ companyId: 1, status: 1, createdAt: -1 });
148
+ requestSchema.index({ companyId: 1, category: 1, createdAt: -1 });
149
+ exports.Request = mongoose_1.default.model("Request", requestSchema);
150
+ exports.default = exports.Request;
@@ -0,0 +1,8 @@
1
+ import mongoose from "mongoose";
2
+ import { IRole } from "../interfaces/role.interface";
3
+ export declare const Role: mongoose.Model<IRole, {}, {}, {}, mongoose.Document<unknown, {}, IRole, {}, {}> & IRole & Required<{
4
+ _id: unknown;
5
+ }> & {
6
+ __v: number;
7
+ }, any>;
8
+ //# sourceMappingURL=role.model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"role.model.d.ts","sourceRoot":"","sources":["../../src/models/role.model.ts"],"names":[],"mappings":"AAAA,OAAO,QAAoB,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AA6CrD,eAAO,MAAM,IAAI;;;;OAA4C,CAAC"}
@@ -0,0 +1,72 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.Role = void 0;
37
+ const mongoose_1 = __importStar(require("mongoose"));
38
+ const types_1 = require("../permissions/types");
39
+ const roleSchema = new mongoose_1.Schema({
40
+ dashboard: {
41
+ type: String,
42
+ enum: types_1.DASHBOARDS,
43
+ required: true,
44
+ index: true,
45
+ },
46
+ // e.g. "global-admin", "associate-agent", "partner-admin" -- unique per
47
+ // dashboard, not globally (an "admin" key exists on both Partner and
48
+ // Client independently).
49
+ key: {
50
+ type: String,
51
+ required: true,
52
+ trim: true,
53
+ },
54
+ label: {
55
+ type: String,
56
+ required: true,
57
+ trim: true,
58
+ },
59
+ // True for all 8 predefined roles from the spec. Reserved for a future
60
+ // "save a custom set as a reusable named role" feature -- not used by
61
+ // anything today.
62
+ isSystemRole: {
63
+ type: Boolean,
64
+ default: false,
65
+ index: true,
66
+ },
67
+ // Flattened, ancestor-inclusive set of granted permission-tree keys --
68
+ // see src/permissions/resolve.ts for why ancestors are stored explicitly.
69
+ grantedKeys: [{ type: String }],
70
+ }, { timestamps: true });
71
+ roleSchema.index({ dashboard: 1, key: 1 }, { unique: true });
72
+ exports.Role = mongoose_1.default.model("Role", roleSchema);
@@ -1 +1 @@
1
- {"version":3,"file":"user.model.d.ts","sourceRoot":"","sources":["../../src/models/user.model.ts"],"names":[],"mappings":"AAAA,OAAO,QAAoB,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAmNrD,eAAO,MAAM,IAAI;;;;OAA4C,CAAC"}
1
+ {"version":3,"file":"user.model.d.ts","sourceRoot":"","sources":["../../src/models/user.model.ts"],"names":[],"mappings":"AAAA,OAAO,QAAoB,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AA4OrD,eAAO,MAAM,IAAI;;;;OAA4C,CAAC"}
@@ -194,6 +194,27 @@ const userSchema = new mongoose_1.Schema({
194
194
  unique: true,
195
195
  index: true,
196
196
  },
197
+ // ─────────────────────────────────────────────
198
+ // RBAC
199
+ // ─────────────────────────────────────────────
200
+ roleId: {
201
+ type: mongoose_1.Schema.Types.ObjectId,
202
+ ref: "Role",
203
+ default: null,
204
+ index: true,
205
+ },
206
+ permissionMode: {
207
+ type: String,
208
+ enum: ["role", "custom"],
209
+ default: "role",
210
+ },
211
+ // Authoritative only when permissionMode === "custom"; see
212
+ // src/permissions/resolve.ts for how this and roleId are reconciled.
213
+ permissionKeys: [{ type: String }],
214
+ // Individually-granted extras on top of roleId's own grantedKeys --
215
+ // only applied in "role" mode (e.g. one global-admin-adjacent user who
216
+ // also needs a single node nobody else on that role has).
217
+ extraPermissionKeys: [{ type: String }],
197
218
  }, { timestamps: true });
198
219
  // ─────────────────────────────────────────────
199
220
  // PASSWORD HASH