@ampsec/platform-client 24.3.1 → 25.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.
@@ -1,4 +1,6 @@
1
- export declare enum AgentRole {
1
+ export declare enum AuthRole {
2
+ /** User can only their own data. */
3
+ USER = "USER",
2
4
  /** Agent can only read data. */
3
5
  REPORT_VIEWER = "REPORT_VIEWER",
4
6
  /** Agent can only read data. */
@@ -9,6 +11,10 @@ export declare enum AgentRole {
9
11
  ADMIN = "ADMIN",
10
12
  /** Agent owns organization. */
11
13
  OWNER = "OWNER",
14
+ /** Token belongs to a customer success manager */
15
+ CUSTOMER_SUCCESS = "CUSTOMER_SUCCESS",
16
+ /** Token belongs to a customer success manager */
17
+ SUPPORT = "SUPPORT",
12
18
  /** Token belongs to an operator. */
13
19
  OPERATOR = "OPERATOR",
14
20
  /** Token belongs to a service account. */
@@ -16,5 +22,4 @@ export declare enum AgentRole {
16
22
  /** Unknown role. Used for validation */
17
23
  UNKNOWN = "UNKNOWN"
18
24
  }
19
- export declare function lookupAgentRole(role: string): AgentRole;
20
- export declare function lookupAgentRoleOrdinal(role: string): number;
25
+ export declare function lookupAuthRole(role: string): AuthRole;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.lookupAuthRole = exports.AuthRole = void 0;
4
+ /* eslint-disable no-unused-vars */
5
+ var AuthRole;
6
+ (function (AuthRole) {
7
+ /*
8
+ * ========= END USER ROLES =========
9
+ * - Chrome Extension
10
+ */
11
+ /** User can only their own data. */
12
+ AuthRole["USER"] = "USER";
13
+ /*
14
+ * ========= AGENT ROLES =========
15
+ * - Security Hub
16
+ */
17
+ /** Agent can only read data. */
18
+ AuthRole["REPORT_VIEWER"] = "REPORT_VIEWER";
19
+ /** Agent can only read data. */
20
+ AuthRole["VIEWER"] = "VIEWER";
21
+ /** Agent can read and write data. */
22
+ AuthRole["AGENT"] = "AGENT";
23
+ /** Agent can read and write data and manage other agents. */
24
+ AuthRole["ADMIN"] = "ADMIN";
25
+ /** Agent owns organization. */
26
+ AuthRole["OWNER"] = "OWNER";
27
+ /*
28
+ * ========= PLATFORM ROLES ========
29
+ * - Admin Portal
30
+ */
31
+ /** Token belongs to a customer success manager */
32
+ AuthRole["CUSTOMER_SUCCESS"] = "CUSTOMER_SUCCESS";
33
+ /** Token belongs to a customer success manager */
34
+ AuthRole["SUPPORT"] = "SUPPORT";
35
+ /** Token belongs to an operator. */
36
+ AuthRole["OPERATOR"] = "OPERATOR";
37
+ /** Token belongs to a service account. */
38
+ AuthRole["SERVICE_ACCOUNT"] = "SERVICE_ACCOUNT";
39
+ /** Unknown role. Used for validation */
40
+ AuthRole["UNKNOWN"] = "UNKNOWN";
41
+ })(AuthRole || (exports.AuthRole = AuthRole = {}));
42
+ const authRoleLookupMap = {
43
+ USER: AuthRole.USER,
44
+ REPORT_VIEWER: AuthRole.REPORT_VIEWER,
45
+ VIEWER: AuthRole.VIEWER,
46
+ AGENT: AuthRole.AGENT,
47
+ ADMIN: AuthRole.ADMIN,
48
+ OWNER: AuthRole.OWNER,
49
+ CUSTOMER_SUCCESS: AuthRole.CUSTOMER_SUCCESS,
50
+ SUPPORT: AuthRole.SUPPORT,
51
+ OPERATOR: AuthRole.OPERATOR,
52
+ SERVICE_ACCOUNT: AuthRole.SERVICE_ACCOUNT,
53
+ };
54
+ function lookupAuthRole(role) {
55
+ return authRoleLookupMap[role] || AuthRole.UNKNOWN;
56
+ }
57
+ exports.lookupAuthRole = lookupAuthRole;
58
+ //# sourceMappingURL=auth.role.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.role.js","sourceRoot":"","sources":["../../../../src/dto/enums/auth.role.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AACnC,IAAY,QAmCX;AAnCD,WAAY,QAAQ;IAClB;;;OAGG;IACH,oCAAoC;IACpC,yBAAa,CAAA;IACb;;;OAGG;IACH,gCAAgC;IAChC,2CAA+B,CAAA;IAC/B,gCAAgC;IAChC,6BAAiB,CAAA;IACjB,qCAAqC;IACrC,2BAAe,CAAA;IACf,6DAA6D;IAC7D,2BAAe,CAAA;IACf,+BAA+B;IAC/B,2BAAe,CAAA;IACf;;;OAGG;IACH,kDAAkD;IAClD,iDAAqC,CAAA;IACrC,kDAAkD;IAClD,+BAAmB,CAAA;IACnB,oCAAoC;IACpC,iCAAqB,CAAA;IACrB,0CAA0C;IAC1C,+CAAmC,CAAA;IACnC,wCAAwC;IACxC,+BAAmB,CAAA;AACrB,CAAC,EAnCW,QAAQ,wBAAR,QAAQ,QAmCnB;AAED,MAAM,iBAAiB,GAA8B;IACnD,IAAI,EAAE,QAAQ,CAAC,IAAI;IACnB,aAAa,EAAE,QAAQ,CAAC,aAAa;IACrC,MAAM,EAAE,QAAQ,CAAC,MAAM;IACvB,KAAK,EAAE,QAAQ,CAAC,KAAK;IACrB,KAAK,EAAE,QAAQ,CAAC,KAAK;IACrB,KAAK,EAAE,QAAQ,CAAC,KAAK;IACrB,gBAAgB,EAAE,QAAQ,CAAC,gBAAgB;IAC3C,OAAO,EAAE,QAAQ,CAAC,OAAO;IACzB,QAAQ,EAAE,QAAQ,CAAC,QAAQ;IAC3B,eAAe,EAAE,QAAQ,CAAC,eAAe;CAC1C,CAAC;AAEF,SAAgB,cAAc,CAAC,IAAY;IACzC,OAAO,iBAAiB,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,OAAO,CAAC;AACrD,CAAC;AAFD,wCAEC"}
@@ -1,4 +1,4 @@
1
- export * from './agent.role';
1
+ export * from './auth.role';
2
2
  export * from './agent.status';
3
3
  export * from './category';
4
4
  export * from './connector.status';
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./agent.role"), exports);
17
+ __exportStar(require("./auth.role"), exports);
18
18
  __exportStar(require("./agent.status"), exports);
19
19
  __exportStar(require("./category"), exports);
20
20
  __exportStar(require("./connector.status"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/dto/enums/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,iDAA+B;AAC/B,6CAA2B;AAC3B,qDAAmC;AACnC,gDAA8B;AAC9B,qDAAmC;AACnC,mDAAiC;AACjC,wDAAsC;AACtC,yDAAuC;AACvC,sDAAoC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/dto/enums/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,iDAA+B;AAC/B,6CAA2B;AAC3B,qDAAmC;AACnC,gDAA8B;AAC9B,qDAAmC;AACnC,mDAAiC;AACjC,wDAAsC;AACtC,yDAAuC;AACvC,sDAAoC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ampsec/platform-client",
3
- "version": "24.3.1",
3
+ "version": "25.0.0",
4
4
  "description": "",
5
5
  "main": "build/src/index.js",
6
6
  "runkitExampleFilename": "example/main.js",
@@ -0,0 +1,54 @@
1
+ /* eslint-disable no-unused-vars */
2
+ export enum AuthRole {
3
+ /*
4
+ * ========= END USER ROLES =========
5
+ * - Chrome Extension
6
+ */
7
+ /** User can only their own data. */
8
+ USER = 'USER',
9
+ /*
10
+ * ========= AGENT ROLES =========
11
+ * - Security Hub
12
+ */
13
+ /** Agent can only read data. */
14
+ REPORT_VIEWER = 'REPORT_VIEWER',
15
+ /** Agent can only read data. */
16
+ VIEWER = 'VIEWER',
17
+ /** Agent can read and write data. */
18
+ AGENT = 'AGENT',
19
+ /** Agent can read and write data and manage other agents. */
20
+ ADMIN = 'ADMIN',
21
+ /** Agent owns organization. */
22
+ OWNER = 'OWNER',
23
+ /*
24
+ * ========= PLATFORM ROLES ========
25
+ * - Admin Portal
26
+ */
27
+ /** Token belongs to a customer success manager */
28
+ CUSTOMER_SUCCESS = 'CUSTOMER_SUCCESS',
29
+ /** Token belongs to a customer success manager */
30
+ SUPPORT = 'SUPPORT',
31
+ /** Token belongs to an operator. */
32
+ OPERATOR = 'OPERATOR',
33
+ /** Token belongs to a service account. */
34
+ SERVICE_ACCOUNT = 'SERVICE_ACCOUNT',
35
+ /** Unknown role. Used for validation */
36
+ UNKNOWN = 'UNKNOWN',
37
+ }
38
+
39
+ const authRoleLookupMap: {[key: string]: AuthRole} = {
40
+ USER: AuthRole.USER,
41
+ REPORT_VIEWER: AuthRole.REPORT_VIEWER,
42
+ VIEWER: AuthRole.VIEWER,
43
+ AGENT: AuthRole.AGENT,
44
+ ADMIN: AuthRole.ADMIN,
45
+ OWNER: AuthRole.OWNER,
46
+ CUSTOMER_SUCCESS: AuthRole.CUSTOMER_SUCCESS,
47
+ SUPPORT: AuthRole.SUPPORT,
48
+ OPERATOR: AuthRole.OPERATOR,
49
+ SERVICE_ACCOUNT: AuthRole.SERVICE_ACCOUNT,
50
+ };
51
+
52
+ export function lookupAuthRole(role: string): AuthRole {
53
+ return authRoleLookupMap[role] || AuthRole.UNKNOWN;
54
+ }
@@ -1,4 +1,4 @@
1
- export * from './agent.role';
1
+ export * from './auth.role';
2
2
  export * from './agent.status';
3
3
  export * from './category';
4
4
  export * from './connector.status';
@@ -1,52 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.lookupAgentRoleOrdinal = exports.lookupAgentRole = exports.AgentRole = void 0;
4
- /* eslint-disable no-unused-vars */
5
- var AgentRole;
6
- (function (AgentRole) {
7
- /** Agent can only read data. */
8
- AgentRole["REPORT_VIEWER"] = "REPORT_VIEWER";
9
- /** Agent can only read data. */
10
- AgentRole["VIEWER"] = "VIEWER";
11
- /** Agent can read and write data. */
12
- AgentRole["AGENT"] = "AGENT";
13
- /** Agent can read and write data and manage other agents. */
14
- AgentRole["ADMIN"] = "ADMIN";
15
- /** Agent owns organization. */
16
- AgentRole["OWNER"] = "OWNER";
17
- /** Token belongs to an operator. */
18
- AgentRole["OPERATOR"] = "OPERATOR";
19
- /** Token belongs to a service account. */
20
- AgentRole["SERVICE_ACCOUNT"] = "SERVICE_ACCOUNT";
21
- /** Unknown role. Used for validation */
22
- AgentRole["UNKNOWN"] = "UNKNOWN";
23
- })(AgentRole || (exports.AgentRole = AgentRole = {}));
24
- const agentRoleLookupMap = {
25
- REPORT_VIEWER: AgentRole.REPORT_VIEWER,
26
- VIEWER: AgentRole.VIEWER,
27
- AGENT: AgentRole.AGENT,
28
- ADMIN: AgentRole.ADMIN,
29
- OWNER: AgentRole.OWNER,
30
- OPERATOR: AgentRole.OPERATOR,
31
- SERVICE_ACCOUNT: AgentRole.SERVICE_ACCOUNT,
32
- };
33
- function lookupAgentRole(role) {
34
- return agentRoleLookupMap[role] || AgentRole.UNKNOWN;
35
- }
36
- exports.lookupAgentRole = lookupAgentRole;
37
- const UNKNOWN_ORDINAL = -99;
38
- const agentRoleOrdinalMap = new Map([
39
- [AgentRole.REPORT_VIEWER, 0],
40
- [AgentRole.VIEWER, 1],
41
- [AgentRole.AGENT, 2],
42
- [AgentRole.ADMIN, 3],
43
- [AgentRole.OWNER, 4],
44
- [AgentRole.OPERATOR, 5],
45
- [AgentRole.SERVICE_ACCOUNT, 6],
46
- [AgentRole.UNKNOWN, UNKNOWN_ORDINAL],
47
- ]);
48
- function lookupAgentRoleOrdinal(role) {
49
- return agentRoleOrdinalMap.get(lookupAgentRole(role)) || UNKNOWN_ORDINAL;
50
- }
51
- exports.lookupAgentRoleOrdinal = lookupAgentRoleOrdinal;
52
- //# sourceMappingURL=agent.role.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"agent.role.js","sourceRoot":"","sources":["../../../../src/dto/enums/agent.role.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AACnC,IAAY,SAiBX;AAjBD,WAAY,SAAS;IACnB,g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C;AAEH,SAAgB,sBAAsB,CAAC,IAAY;IACjD,OAAO,mBAAmB,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,IAAI,eAAe,CAAC;AAC3E,CAAC;AAFD,wDAEC"}
@@ -1,49 +0,0 @@
1
- /* eslint-disable no-unused-vars */
2
- export enum AgentRole {
3
- /** Agent can only read data. */
4
- REPORT_VIEWER = 'REPORT_VIEWER',
5
- /** Agent can only read data. */
6
- VIEWER = 'VIEWER',
7
- /** Agent can read and write data. */
8
- AGENT = 'AGENT',
9
- /** Agent can read and write data and manage other agents. */
10
- ADMIN = 'ADMIN',
11
- /** Agent owns organization. */
12
- OWNER = 'OWNER',
13
- /** Token belongs to an operator. */
14
- OPERATOR = 'OPERATOR',
15
- /** Token belongs to a service account. */
16
- SERVICE_ACCOUNT = 'SERVICE_ACCOUNT',
17
- /** Unknown role. Used for validation */
18
- UNKNOWN = 'UNKNOWN',
19
- }
20
-
21
- const agentRoleLookupMap: {[key: string]: AgentRole} = {
22
- REPORT_VIEWER: AgentRole.REPORT_VIEWER,
23
- VIEWER: AgentRole.VIEWER,
24
- AGENT: AgentRole.AGENT,
25
- ADMIN: AgentRole.ADMIN,
26
- OWNER: AgentRole.OWNER,
27
- OPERATOR: AgentRole.OPERATOR,
28
- SERVICE_ACCOUNT: AgentRole.SERVICE_ACCOUNT,
29
- };
30
-
31
- export function lookupAgentRole(role: string): AgentRole {
32
- return agentRoleLookupMap[role] || AgentRole.UNKNOWN;
33
- }
34
-
35
- const UNKNOWN_ORDINAL = -99;
36
- const agentRoleOrdinalMap: Map<AgentRole, number> = new Map([
37
- [AgentRole.REPORT_VIEWER, 0],
38
- [AgentRole.VIEWER, 1],
39
- [AgentRole.AGENT, 2],
40
- [AgentRole.ADMIN, 3],
41
- [AgentRole.OWNER, 4],
42
- [AgentRole.OPERATOR, 5],
43
- [AgentRole.SERVICE_ACCOUNT, 6],
44
- [AgentRole.UNKNOWN, UNKNOWN_ORDINAL],
45
- ]);
46
-
47
- export function lookupAgentRoleOrdinal(role: string): number {
48
- return agentRoleOrdinalMap.get(lookupAgentRole(role)) || UNKNOWN_ORDINAL;
49
- }