@ampsec/platform-client 66.3.0 → 67.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/src/dto/agents.dto.d.ts +76 -53
- package/build/src/dto/agents.dto.js +15 -10
- package/build/src/dto/agents.dto.js.map +1 -1
- package/build/src/dto/enums/auth.role.d.ts +19 -0
- package/build/src/dto/enums/auth.role.js +20 -1
- package/build/src/dto/enums/auth.role.js.map +1 -1
- package/build/src/dto/findings.dto.js +1 -6
- package/build/src/dto/findings.dto.js.map +1 -1
- package/build/src/dto/platform/platform.agents.dto.d.ts +148 -4
- package/build/src/dto/platform/platform.agents.dto.js +21 -0
- package/build/src/dto/platform/platform.agents.dto.js.map +1 -1
- package/build/src/etag.js +1 -1
- package/build/src/etag.js.map +1 -1
- package/build/src/services/AgentsService.d.ts +18 -41
- package/build/src/services/AgentsService.js +39 -6
- package/build/src/services/AgentsService.js.map +1 -1
- package/build/src/services/AmpSdk.d.ts +3 -2
- package/build/src/services/AmpSdk.js +2 -1
- package/build/src/services/AmpSdk.js.map +1 -1
- package/build/src/services/rest/RestClient.js +8 -1
- package/build/src/services/rest/RestClient.js.map +1 -1
- package/package.json +1 -1
- package/src/dto/agents.dto.ts +22 -34
- package/src/dto/enums/auth.role.ts +29 -1
- package/src/dto/findings.dto.ts +2 -7
- package/src/dto/platform/platform.agents.dto.ts +24 -4
- package/src/etag.ts +1 -1
- package/src/services/AgentsService.ts +43 -10
- package/src/services/AmpSdk.ts +3 -4
- package/src/services/rest/RestClient.ts +8 -1
|
@@ -1,32 +1,23 @@
|
|
|
1
1
|
import { AgentStatus } from './enums/agent.status';
|
|
2
|
-
import { BaseDto, BaseUpsertDto } from './base.dto';
|
|
3
|
-
import { AuthRole } from './enums';
|
|
4
2
|
import { z } from 'zod';
|
|
5
|
-
export
|
|
6
|
-
/** Agent first name */
|
|
7
|
-
firstName: string | null;
|
|
8
|
-
/** Agent last name */
|
|
9
|
-
lastName: string | null;
|
|
10
|
-
/** Status of the Agent, e.g. ACTIVE */
|
|
11
|
-
status: AgentStatus;
|
|
12
|
-
/** External Id */
|
|
13
|
-
email: string;
|
|
14
|
-
/** Agent profile picture */
|
|
15
|
-
pictureUrl?: string;
|
|
16
|
-
};
|
|
17
|
-
export type AgentDto = BaseDto & AgentUpsertDto;
|
|
18
|
-
export declare const _AgentSummaryDto: z.ZodObject<{
|
|
19
|
-
email: z.ZodString;
|
|
20
|
-
status: z.ZodNativeEnum<typeof AgentStatus>;
|
|
21
|
-
firstName: z.ZodNullable<z.ZodString>;
|
|
22
|
-
lastName: z.ZodNullable<z.ZodString>;
|
|
23
|
-
pictureUrl: z.ZodOptional<z.ZodString>;
|
|
24
|
-
role: z.ZodNativeEnum<typeof AuthRole>;
|
|
25
|
-
lastLoggedIn: z.ZodNullable<z.ZodDate>;
|
|
3
|
+
export declare const _AgentDto: z.ZodObject<{
|
|
26
4
|
id: z.ZodString;
|
|
27
5
|
createdAt: z.ZodString;
|
|
28
6
|
updatedAt: z.ZodString;
|
|
29
7
|
deletedAt: z.ZodNullable<z.ZodString>;
|
|
8
|
+
firstName: z.ZodNullable<z.ZodString>;
|
|
9
|
+
lastName: z.ZodNullable<z.ZodString>;
|
|
10
|
+
status: z.ZodNativeEnum<typeof AgentStatus>;
|
|
11
|
+
role: z.ZodNativeEnum<{
|
|
12
|
+
readonly ADMIN: import("./enums").AuthRole.ADMIN;
|
|
13
|
+
readonly AGENT: import("./enums").AuthRole.AGENT;
|
|
14
|
+
readonly OWNER: import("./enums").AuthRole.OWNER;
|
|
15
|
+
readonly REPORT_VIEWER: import("./enums").AuthRole.REPORT_VIEWER;
|
|
16
|
+
readonly VIEWER: import("./enums").AuthRole.VIEWER;
|
|
17
|
+
}>;
|
|
18
|
+
email: z.ZodString;
|
|
19
|
+
pictureUrl: z.ZodNullable<z.ZodString>;
|
|
20
|
+
lastLoggedIn: z.ZodNullable<z.ZodString>;
|
|
30
21
|
}, "strip", z.ZodTypeAny, {
|
|
31
22
|
email: string;
|
|
32
23
|
status: AgentStatus;
|
|
@@ -36,9 +27,9 @@ export declare const _AgentSummaryDto: z.ZodObject<{
|
|
|
36
27
|
deletedAt: string | null;
|
|
37
28
|
firstName: string | null;
|
|
38
29
|
lastName: string | null;
|
|
39
|
-
role: AuthRole;
|
|
40
|
-
|
|
41
|
-
|
|
30
|
+
role: import("./enums").AuthRole.REPORT_VIEWER | import("./enums").AuthRole.VIEWER | import("./enums").AuthRole.AGENT | import("./enums").AuthRole.ADMIN | import("./enums").AuthRole.OWNER;
|
|
31
|
+
pictureUrl: string | null;
|
|
32
|
+
lastLoggedIn: string | null;
|
|
42
33
|
}, {
|
|
43
34
|
email: string;
|
|
44
35
|
status: AgentStatus;
|
|
@@ -48,46 +39,78 @@ export declare const _AgentSummaryDto: z.ZodObject<{
|
|
|
48
39
|
deletedAt: string | null;
|
|
49
40
|
firstName: string | null;
|
|
50
41
|
lastName: string | null;
|
|
51
|
-
role: AuthRole;
|
|
52
|
-
|
|
53
|
-
|
|
42
|
+
role: import("./enums").AuthRole.REPORT_VIEWER | import("./enums").AuthRole.VIEWER | import("./enums").AuthRole.AGENT | import("./enums").AuthRole.ADMIN | import("./enums").AuthRole.OWNER;
|
|
43
|
+
pictureUrl: string | null;
|
|
44
|
+
lastLoggedIn: string | null;
|
|
54
45
|
}>;
|
|
55
|
-
export type
|
|
56
|
-
export declare const
|
|
57
|
-
email: z.
|
|
58
|
-
status: z.
|
|
59
|
-
firstName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
60
|
-
lastName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
61
|
-
pictureUrl: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
62
|
-
role: z.ZodOptional<z.ZodNativeEnum<typeof AuthRole>>;
|
|
63
|
-
lastLoggedIn: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
46
|
+
export type AgentDto = z.infer<typeof _AgentDto>;
|
|
47
|
+
export declare const _AgentUpsertDto: z.ZodObject<{
|
|
48
|
+
email: z.ZodString;
|
|
49
|
+
status: z.ZodNativeEnum<typeof AgentStatus>;
|
|
64
50
|
id: z.ZodOptional<z.ZodString>;
|
|
65
51
|
createdAt: z.ZodOptional<z.ZodString>;
|
|
66
52
|
updatedAt: z.ZodOptional<z.ZodString>;
|
|
67
53
|
deletedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
54
|
+
firstName: z.ZodNullable<z.ZodString>;
|
|
55
|
+
lastName: z.ZodNullable<z.ZodString>;
|
|
56
|
+
role: z.ZodNativeEnum<{
|
|
57
|
+
readonly ADMIN: import("./enums").AuthRole.ADMIN;
|
|
58
|
+
readonly AGENT: import("./enums").AuthRole.AGENT;
|
|
59
|
+
readonly OWNER: import("./enums").AuthRole.OWNER;
|
|
60
|
+
readonly REPORT_VIEWER: import("./enums").AuthRole.REPORT_VIEWER;
|
|
61
|
+
readonly VIEWER: import("./enums").AuthRole.VIEWER;
|
|
62
|
+
}>;
|
|
63
|
+
pictureUrl: z.ZodNullable<z.ZodString>;
|
|
64
|
+
lastLoggedIn: z.ZodNullable<z.ZodString>;
|
|
68
65
|
}, "strip", z.ZodTypeAny, {
|
|
69
|
-
email
|
|
70
|
-
status
|
|
71
|
-
firstName
|
|
72
|
-
lastName
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
lastLoggedIn
|
|
66
|
+
email: string;
|
|
67
|
+
status: AgentStatus;
|
|
68
|
+
firstName: string | null;
|
|
69
|
+
lastName: string | null;
|
|
70
|
+
role: import("./enums").AuthRole.REPORT_VIEWER | import("./enums").AuthRole.VIEWER | import("./enums").AuthRole.AGENT | import("./enums").AuthRole.ADMIN | import("./enums").AuthRole.OWNER;
|
|
71
|
+
pictureUrl: string | null;
|
|
72
|
+
lastLoggedIn: string | null;
|
|
76
73
|
id?: string | undefined;
|
|
77
74
|
createdAt?: string | undefined;
|
|
78
75
|
updatedAt?: string | undefined;
|
|
79
76
|
deletedAt?: string | null | undefined;
|
|
80
77
|
}, {
|
|
81
|
-
email
|
|
82
|
-
status
|
|
83
|
-
firstName
|
|
84
|
-
lastName
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
lastLoggedIn
|
|
78
|
+
email: string;
|
|
79
|
+
status: AgentStatus;
|
|
80
|
+
firstName: string | null;
|
|
81
|
+
lastName: string | null;
|
|
82
|
+
role: import("./enums").AuthRole.REPORT_VIEWER | import("./enums").AuthRole.VIEWER | import("./enums").AuthRole.AGENT | import("./enums").AuthRole.ADMIN | import("./enums").AuthRole.OWNER;
|
|
83
|
+
pictureUrl: string | null;
|
|
84
|
+
lastLoggedIn: string | null;
|
|
88
85
|
id?: string | undefined;
|
|
89
86
|
createdAt?: string | undefined;
|
|
90
87
|
updatedAt?: string | undefined;
|
|
91
88
|
deletedAt?: string | null | undefined;
|
|
92
89
|
}>;
|
|
93
|
-
export type
|
|
90
|
+
export type AgentUpsertDto = z.infer<typeof _AgentUpsertDto>;
|
|
91
|
+
export declare const _AgentInviteDto: z.ZodObject<{
|
|
92
|
+
email: z.ZodString;
|
|
93
|
+
role: z.ZodNativeEnum<{
|
|
94
|
+
readonly ADMIN: import("./enums").AuthRole.ADMIN;
|
|
95
|
+
readonly AGENT: import("./enums").AuthRole.AGENT;
|
|
96
|
+
readonly OWNER: import("./enums").AuthRole.OWNER;
|
|
97
|
+
readonly REPORT_VIEWER: import("./enums").AuthRole.REPORT_VIEWER;
|
|
98
|
+
readonly VIEWER: import("./enums").AuthRole.VIEWER;
|
|
99
|
+
}>;
|
|
100
|
+
firstName: z.ZodOptional<z.ZodString>;
|
|
101
|
+
lastName: z.ZodOptional<z.ZodString>;
|
|
102
|
+
pictureUrl: z.ZodOptional<z.ZodString>;
|
|
103
|
+
}, "strip", z.ZodTypeAny, {
|
|
104
|
+
email: string;
|
|
105
|
+
role: import("./enums").AuthRole.REPORT_VIEWER | import("./enums").AuthRole.VIEWER | import("./enums").AuthRole.AGENT | import("./enums").AuthRole.ADMIN | import("./enums").AuthRole.OWNER;
|
|
106
|
+
firstName?: string | undefined;
|
|
107
|
+
lastName?: string | undefined;
|
|
108
|
+
pictureUrl?: string | undefined;
|
|
109
|
+
}, {
|
|
110
|
+
email: string;
|
|
111
|
+
role: import("./enums").AuthRole.REPORT_VIEWER | import("./enums").AuthRole.VIEWER | import("./enums").AuthRole.AGENT | import("./enums").AuthRole.ADMIN | import("./enums").AuthRole.OWNER;
|
|
112
|
+
firstName?: string | undefined;
|
|
113
|
+
lastName?: string | undefined;
|
|
114
|
+
pictureUrl?: string | undefined;
|
|
115
|
+
}>;
|
|
116
|
+
export type AgentInviteDto = z.infer<typeof _AgentInviteDto>;
|
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports._AgentInviteDto = exports._AgentUpsertDto = exports._AgentDto = void 0;
|
|
4
4
|
const agent_status_1 = require("./enums/agent.status");
|
|
5
5
|
const base_dto_1 = require("./base.dto");
|
|
6
|
-
const enums_1 = require("./enums");
|
|
7
6
|
const zod_1 = require("zod");
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const enums_1 = require("./enums");
|
|
8
|
+
exports._AgentDto = base_dto_1._BaseDto.extend({
|
|
10
9
|
firstName: zod_1.z.string().nullable(),
|
|
11
10
|
lastName: zod_1.z.string().nullable(),
|
|
11
|
+
status: zod_1.z.nativeEnum(agent_status_1.AgentStatus),
|
|
12
|
+
role: zod_1.z.nativeEnum(enums_1.AgentAuthRoles),
|
|
12
13
|
email: zod_1.z.string(),
|
|
14
|
+
pictureUrl: zod_1.z.string().nullable(),
|
|
15
|
+
lastLoggedIn: zod_1.z.string().nullable(),
|
|
16
|
+
});
|
|
17
|
+
exports._AgentUpsertDto = exports._AgentDto.partial(base_dto_1.UPSERT_DTO_MASK);
|
|
18
|
+
exports._AgentInviteDto = zod_1.z.object({
|
|
19
|
+
email: zod_1.z.string(),
|
|
20
|
+
role: zod_1.z.nativeEnum(enums_1.AgentAuthRoles),
|
|
21
|
+
firstName: zod_1.z.string().optional(),
|
|
22
|
+
lastName: zod_1.z.string().optional(),
|
|
13
23
|
pictureUrl: zod_1.z.string().optional(),
|
|
14
|
-
|
|
15
|
-
role: zod_1.z.nativeEnum(enums_1.AuthRole),
|
|
16
|
-
lastLoggedIn: zod_1.z.date().nullable(),
|
|
17
|
-
})
|
|
18
|
-
.merge(base_dto_1._BaseDto);
|
|
19
|
-
exports._AgentSummaryUpsertDto = exports._AgentSummaryDto.partial();
|
|
24
|
+
});
|
|
20
25
|
//# sourceMappingURL=agents.dto.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.dto.js","sourceRoot":"","sources":["../../../src/dto/agents.dto.ts"],"names":[],"mappings":";;;AAAA,uDAAiD;AACjD,
|
|
1
|
+
{"version":3,"file":"agents.dto.js","sourceRoot":"","sources":["../../../src/dto/agents.dto.ts"],"names":[],"mappings":";;;AAAA,uDAAiD;AACjD,yCAAqE;AACrE,6BAAsB;AACtB,mCAAuC;AAE1B,QAAA,SAAS,GAAG,mBAAQ,CAAC,MAAM,CAAC;IACvC,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,MAAM,EAAE,OAAC,CAAC,UAAU,CAAC,0BAAW,CAAC;IACjC,IAAI,EAAE,OAAC,CAAC,UAAU,CAAC,sBAAc,CAAC;IAClC,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;IACjB,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACpC,CAAC,CAAC;AAGU,QAAA,eAAe,GAAG,iBAAS,CAAC,OAAO,CAAC,0BAAe,CAAC,CAAC;AAGrD,QAAA,eAAe,GAAG,OAAC,CAAC,MAAM,CAAC;IACtC,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;IACjB,IAAI,EAAE,OAAC,CAAC,UAAU,CAAC,sBAAc,CAAC;IAClC,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAClC,CAAC,CAAC"}
|
|
@@ -23,3 +23,22 @@ export declare enum AuthRole {
|
|
|
23
23
|
UNKNOWN = "UNKNOWN"
|
|
24
24
|
}
|
|
25
25
|
export declare function lookupAuthRole(role: string): AuthRole;
|
|
26
|
+
export type UserAuthRoles = Extract<AuthRole, AuthRole.USER>;
|
|
27
|
+
export declare const UserAuthRoles: {
|
|
28
|
+
readonly USER: AuthRole.USER;
|
|
29
|
+
};
|
|
30
|
+
export type AgentAuthRoles = Extract<AuthRole, AuthRole.ADMIN | AuthRole.AGENT | AuthRole.OWNER | AuthRole.REPORT_VIEWER | AuthRole.VIEWER>;
|
|
31
|
+
export declare const AgentAuthRoles: {
|
|
32
|
+
readonly ADMIN: AuthRole.ADMIN;
|
|
33
|
+
readonly AGENT: AuthRole.AGENT;
|
|
34
|
+
readonly OWNER: AuthRole.OWNER;
|
|
35
|
+
readonly REPORT_VIEWER: AuthRole.REPORT_VIEWER;
|
|
36
|
+
readonly VIEWER: AuthRole.VIEWER;
|
|
37
|
+
};
|
|
38
|
+
export type PlatformAuthRoles = Extract<AuthRole, AuthRole.CUSTOMER_SUCCESS | AuthRole.OPERATOR | AuthRole.SERVICE_ACCOUNT | AuthRole.SUPPORT>;
|
|
39
|
+
export declare const PlatformAuthRoles: {
|
|
40
|
+
readonly CUSTOMER_SUCCESS: AuthRole.CUSTOMER_SUCCESS;
|
|
41
|
+
readonly OPERATOR: AuthRole.OPERATOR;
|
|
42
|
+
readonly SERVICE_ACCOUNT: AuthRole.SERVICE_ACCOUNT;
|
|
43
|
+
readonly SUPPORT: AuthRole.SUPPORT;
|
|
44
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.lookupAuthRole = exports.AuthRole = void 0;
|
|
3
|
+
exports.PlatformAuthRoles = exports.AgentAuthRoles = exports.UserAuthRoles = exports.lookupAuthRole = exports.AuthRole = void 0;
|
|
4
4
|
var AuthRole;
|
|
5
5
|
(function (AuthRole) {
|
|
6
6
|
/*
|
|
@@ -54,4 +54,23 @@ function lookupAuthRole(role) {
|
|
|
54
54
|
return authRoleLookupMap[role] || AuthRole.UNKNOWN;
|
|
55
55
|
}
|
|
56
56
|
exports.lookupAuthRole = lookupAuthRole;
|
|
57
|
+
// And the const that goes with it
|
|
58
|
+
exports.UserAuthRoles = {
|
|
59
|
+
[AuthRole.USER]: AuthRole.USER,
|
|
60
|
+
};
|
|
61
|
+
// And the const that goes with it
|
|
62
|
+
exports.AgentAuthRoles = {
|
|
63
|
+
[AuthRole.ADMIN]: AuthRole.ADMIN,
|
|
64
|
+
[AuthRole.AGENT]: AuthRole.AGENT,
|
|
65
|
+
[AuthRole.OWNER]: AuthRole.OWNER,
|
|
66
|
+
[AuthRole.REPORT_VIEWER]: AuthRole.REPORT_VIEWER,
|
|
67
|
+
[AuthRole.VIEWER]: AuthRole.VIEWER,
|
|
68
|
+
};
|
|
69
|
+
// And the const that goes with it
|
|
70
|
+
exports.PlatformAuthRoles = {
|
|
71
|
+
[AuthRole.CUSTOMER_SUCCESS]: AuthRole.CUSTOMER_SUCCESS,
|
|
72
|
+
[AuthRole.OPERATOR]: AuthRole.OPERATOR,
|
|
73
|
+
[AuthRole.SERVICE_ACCOUNT]: AuthRole.SERVICE_ACCOUNT,
|
|
74
|
+
[AuthRole.SUPPORT]: AuthRole.SUPPORT,
|
|
75
|
+
};
|
|
57
76
|
//# sourceMappingURL=auth.role.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.role.js","sourceRoot":"","sources":["../../../../src/dto/enums/auth.role.ts"],"names":[],"mappings":";;;AAAA,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;
|
|
1
|
+
{"version":3,"file":"auth.role.js","sourceRoot":"","sources":["../../../../src/dto/enums/auth.role.ts"],"names":[],"mappings":";;;AAAA,IAAY,QAmCX;AAnCD,WAAY,QAAQ;IAClB;;;OAGG;IACH,oCAAoC;IACpC,yBAAa,CAAA;IACb;;;OAGG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K;IAChC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,KAAK;IAChC,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,QAAQ,CAAC,aAAa;IAChD,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM;CAC1B,CAAC;AAIX,kCAAkC;AACrB,QAAA,iBAAiB,GAAG;IAC/B,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,QAAQ,CAAC,gBAAgB;IACtD,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,QAAQ;IACtC,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,QAAQ,CAAC,eAAe;IACpD,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,OAAO;CAC5B,CAAC"}
|
|
@@ -47,12 +47,7 @@ exports._FindingSpecDto = base_dto_1._BaseDto.extend({
|
|
|
47
47
|
kind: zod_1.z.nativeEnum(enums_1.FindingSpecKind),
|
|
48
48
|
score: zod_1.z.number().optional(),
|
|
49
49
|
});
|
|
50
|
-
exports._FindingSpecUpsertDto = exports._FindingSpecDto.partial(
|
|
51
|
-
id: true,
|
|
52
|
-
createdAt: true,
|
|
53
|
-
updatedAt: true,
|
|
54
|
-
deletedAt: true,
|
|
55
|
-
});
|
|
50
|
+
exports._FindingSpecUpsertDto = exports._FindingSpecDto.partial(base_dto_1.UPSERT_DTO_MASK);
|
|
56
51
|
exports._FindingSummaryDto = zod_1.z.object({
|
|
57
52
|
id: zod_1.z.string(),
|
|
58
53
|
cid: zod_1.z.string().optional(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findings.dto.js","sourceRoot":"","sources":["../../../src/dto/findings.dto.ts"],"names":[],"mappings":";;;AAAA,6BAAsB;AAEtB,
|
|
1
|
+
{"version":3,"file":"findings.dto.js","sourceRoot":"","sources":["../../../src/dto/findings.dto.ts"],"names":[],"mappings":";;;AAAA,6BAAs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;IAC5C,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;IACrB,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACpC,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,OAAO,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CAChC,CAAC,CAAC"}
|
|
@@ -1,4 +1,148 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export
|
|
4
|
-
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { AgentStatus } from '../enums';
|
|
3
|
+
export declare const _PlatformAgentMembership: z.ZodObject<{
|
|
4
|
+
tid: z.ZodString;
|
|
5
|
+
role: z.ZodNativeEnum<{
|
|
6
|
+
readonly ADMIN: import("../enums").AuthRole.ADMIN;
|
|
7
|
+
readonly AGENT: import("../enums").AuthRole.AGENT;
|
|
8
|
+
readonly OWNER: import("../enums").AuthRole.OWNER;
|
|
9
|
+
readonly REPORT_VIEWER: import("../enums").AuthRole.REPORT_VIEWER;
|
|
10
|
+
readonly VIEWER: import("../enums").AuthRole.VIEWER;
|
|
11
|
+
}>;
|
|
12
|
+
status: z.ZodNativeEnum<typeof AgentStatus>;
|
|
13
|
+
organization: z.ZodNullable<z.ZodString>;
|
|
14
|
+
department: z.ZodNullable<z.ZodString>;
|
|
15
|
+
lastLoggedIn: z.ZodNullable<z.ZodString>;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
status: AgentStatus;
|
|
18
|
+
tid: string;
|
|
19
|
+
organization: string | null;
|
|
20
|
+
department: string | null;
|
|
21
|
+
role: import("../enums").AuthRole.REPORT_VIEWER | import("../enums").AuthRole.VIEWER | import("../enums").AuthRole.AGENT | import("../enums").AuthRole.ADMIN | import("../enums").AuthRole.OWNER;
|
|
22
|
+
lastLoggedIn: string | null;
|
|
23
|
+
}, {
|
|
24
|
+
status: AgentStatus;
|
|
25
|
+
tid: string;
|
|
26
|
+
organization: string | null;
|
|
27
|
+
department: string | null;
|
|
28
|
+
role: import("../enums").AuthRole.REPORT_VIEWER | import("../enums").AuthRole.VIEWER | import("../enums").AuthRole.AGENT | import("../enums").AuthRole.ADMIN | import("../enums").AuthRole.OWNER;
|
|
29
|
+
lastLoggedIn: string | null;
|
|
30
|
+
}>;
|
|
31
|
+
export type PlatformAgentMembership = z.infer<typeof _PlatformAgentMembership>;
|
|
32
|
+
export declare const _PlatformAgentDto: z.ZodObject<{
|
|
33
|
+
id: z.ZodString;
|
|
34
|
+
createdAt: z.ZodString;
|
|
35
|
+
updatedAt: z.ZodString;
|
|
36
|
+
deletedAt: z.ZodNullable<z.ZodString>;
|
|
37
|
+
firstName: z.ZodNullable<z.ZodString>;
|
|
38
|
+
lastName: z.ZodNullable<z.ZodString>;
|
|
39
|
+
email: z.ZodString;
|
|
40
|
+
memberships: z.ZodArray<z.ZodObject<{
|
|
41
|
+
tid: z.ZodString;
|
|
42
|
+
role: z.ZodNativeEnum<{
|
|
43
|
+
readonly ADMIN: import("../enums").AuthRole.ADMIN;
|
|
44
|
+
readonly AGENT: import("../enums").AuthRole.AGENT;
|
|
45
|
+
readonly OWNER: import("../enums").AuthRole.OWNER;
|
|
46
|
+
readonly REPORT_VIEWER: import("../enums").AuthRole.REPORT_VIEWER;
|
|
47
|
+
readonly VIEWER: import("../enums").AuthRole.VIEWER;
|
|
48
|
+
}>;
|
|
49
|
+
status: z.ZodNativeEnum<typeof AgentStatus>;
|
|
50
|
+
organization: z.ZodNullable<z.ZodString>;
|
|
51
|
+
department: z.ZodNullable<z.ZodString>;
|
|
52
|
+
lastLoggedIn: z.ZodNullable<z.ZodString>;
|
|
53
|
+
}, "strip", z.ZodTypeAny, {
|
|
54
|
+
status: AgentStatus;
|
|
55
|
+
tid: string;
|
|
56
|
+
organization: string | null;
|
|
57
|
+
department: string | null;
|
|
58
|
+
role: import("../enums").AuthRole.REPORT_VIEWER | import("../enums").AuthRole.VIEWER | import("../enums").AuthRole.AGENT | import("../enums").AuthRole.ADMIN | import("../enums").AuthRole.OWNER;
|
|
59
|
+
lastLoggedIn: string | null;
|
|
60
|
+
}, {
|
|
61
|
+
status: AgentStatus;
|
|
62
|
+
tid: string;
|
|
63
|
+
organization: string | null;
|
|
64
|
+
department: string | null;
|
|
65
|
+
role: import("../enums").AuthRole.REPORT_VIEWER | import("../enums").AuthRole.VIEWER | import("../enums").AuthRole.AGENT | import("../enums").AuthRole.ADMIN | import("../enums").AuthRole.OWNER;
|
|
66
|
+
lastLoggedIn: string | null;
|
|
67
|
+
}>, "many">;
|
|
68
|
+
pictureUrl: z.ZodNullable<z.ZodString>;
|
|
69
|
+
}, "strip", z.ZodTypeAny, {
|
|
70
|
+
email: string;
|
|
71
|
+
id: string;
|
|
72
|
+
createdAt: string;
|
|
73
|
+
updatedAt: string;
|
|
74
|
+
deletedAt: string | null;
|
|
75
|
+
firstName: string | null;
|
|
76
|
+
lastName: string | null;
|
|
77
|
+
pictureUrl: string | null;
|
|
78
|
+
memberships: {
|
|
79
|
+
status: AgentStatus;
|
|
80
|
+
tid: string;
|
|
81
|
+
organization: string | null;
|
|
82
|
+
department: string | null;
|
|
83
|
+
role: import("../enums").AuthRole.REPORT_VIEWER | import("../enums").AuthRole.VIEWER | import("../enums").AuthRole.AGENT | import("../enums").AuthRole.ADMIN | import("../enums").AuthRole.OWNER;
|
|
84
|
+
lastLoggedIn: string | null;
|
|
85
|
+
}[];
|
|
86
|
+
}, {
|
|
87
|
+
email: string;
|
|
88
|
+
id: string;
|
|
89
|
+
createdAt: string;
|
|
90
|
+
updatedAt: string;
|
|
91
|
+
deletedAt: string | null;
|
|
92
|
+
firstName: string | null;
|
|
93
|
+
lastName: string | null;
|
|
94
|
+
pictureUrl: string | null;
|
|
95
|
+
memberships: {
|
|
96
|
+
status: AgentStatus;
|
|
97
|
+
tid: string;
|
|
98
|
+
organization: string | null;
|
|
99
|
+
department: string | null;
|
|
100
|
+
role: import("../enums").AuthRole.REPORT_VIEWER | import("../enums").AuthRole.VIEWER | import("../enums").AuthRole.AGENT | import("../enums").AuthRole.ADMIN | import("../enums").AuthRole.OWNER;
|
|
101
|
+
lastLoggedIn: string | null;
|
|
102
|
+
}[];
|
|
103
|
+
}>;
|
|
104
|
+
export type PlatformAgentDto = z.infer<typeof _PlatformAgentDto>;
|
|
105
|
+
export declare const _PlatformAgentUpsertDto: z.ZodObject<{
|
|
106
|
+
email: z.ZodString;
|
|
107
|
+
status: z.ZodNativeEnum<typeof AgentStatus>;
|
|
108
|
+
id: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
109
|
+
createdAt: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
110
|
+
updatedAt: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
111
|
+
deletedAt: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
112
|
+
firstName: z.ZodNullable<z.ZodString>;
|
|
113
|
+
lastName: z.ZodNullable<z.ZodString>;
|
|
114
|
+
role: z.ZodNativeEnum<{
|
|
115
|
+
readonly ADMIN: import("../enums").AuthRole.ADMIN;
|
|
116
|
+
readonly AGENT: import("../enums").AuthRole.AGENT;
|
|
117
|
+
readonly OWNER: import("../enums").AuthRole.OWNER;
|
|
118
|
+
readonly REPORT_VIEWER: import("../enums").AuthRole.REPORT_VIEWER;
|
|
119
|
+
readonly VIEWER: import("../enums").AuthRole.VIEWER;
|
|
120
|
+
}>;
|
|
121
|
+
pictureUrl: z.ZodNullable<z.ZodString>;
|
|
122
|
+
lastLoggedIn: z.ZodNullable<z.ZodString>;
|
|
123
|
+
}, "strip", z.ZodTypeAny, {
|
|
124
|
+
email: string;
|
|
125
|
+
status: AgentStatus;
|
|
126
|
+
firstName: string | null;
|
|
127
|
+
lastName: string | null;
|
|
128
|
+
role: import("../enums").AuthRole.REPORT_VIEWER | import("../enums").AuthRole.VIEWER | import("../enums").AuthRole.AGENT | import("../enums").AuthRole.ADMIN | import("../enums").AuthRole.OWNER;
|
|
129
|
+
pictureUrl: string | null;
|
|
130
|
+
lastLoggedIn: string | null;
|
|
131
|
+
id?: string | undefined;
|
|
132
|
+
createdAt?: string | undefined;
|
|
133
|
+
updatedAt?: string | undefined;
|
|
134
|
+
deletedAt?: string | null | undefined;
|
|
135
|
+
}, {
|
|
136
|
+
email: string;
|
|
137
|
+
status: AgentStatus;
|
|
138
|
+
firstName: string | null;
|
|
139
|
+
lastName: string | null;
|
|
140
|
+
role: import("../enums").AuthRole.REPORT_VIEWER | import("../enums").AuthRole.VIEWER | import("../enums").AuthRole.AGENT | import("../enums").AuthRole.ADMIN | import("../enums").AuthRole.OWNER;
|
|
141
|
+
pictureUrl: string | null;
|
|
142
|
+
lastLoggedIn: string | null;
|
|
143
|
+
id?: string | undefined;
|
|
144
|
+
createdAt?: string | undefined;
|
|
145
|
+
updatedAt?: string | undefined;
|
|
146
|
+
deletedAt?: string | null | undefined;
|
|
147
|
+
}>;
|
|
148
|
+
export type PlatformAgentUpsertDto = z.infer<typeof _PlatformAgentUpsertDto>;
|
|
@@ -1,3 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports._PlatformAgentUpsertDto = exports._PlatformAgentDto = exports._PlatformAgentMembership = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const enums_1 = require("../enums");
|
|
6
|
+
const base_dto_1 = require("../base.dto");
|
|
7
|
+
const agents_dto_1 = require("../agents.dto");
|
|
8
|
+
exports._PlatformAgentMembership = zod_1.z.object({
|
|
9
|
+
tid: zod_1.z.string(),
|
|
10
|
+
role: zod_1.z.nativeEnum(enums_1.AgentAuthRoles),
|
|
11
|
+
status: zod_1.z.nativeEnum(enums_1.AgentStatus),
|
|
12
|
+
organization: zod_1.z.string().nullable(),
|
|
13
|
+
department: zod_1.z.string().nullable(),
|
|
14
|
+
lastLoggedIn: zod_1.z.string().nullable(),
|
|
15
|
+
});
|
|
16
|
+
exports._PlatformAgentDto = base_dto_1._BaseDto.extend({
|
|
17
|
+
firstName: zod_1.z.string().nullable(),
|
|
18
|
+
lastName: zod_1.z.string().nullable(),
|
|
19
|
+
email: zod_1.z.string(),
|
|
20
|
+
memberships: zod_1.z.array(exports._PlatformAgentMembership),
|
|
21
|
+
pictureUrl: zod_1.z.string().nullable(),
|
|
22
|
+
});
|
|
23
|
+
exports._PlatformAgentUpsertDto = agents_dto_1._AgentUpsertDto.partial(base_dto_1.UPSERT_DTO_MASK);
|
|
3
24
|
//# sourceMappingURL=platform.agents.dto.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform.agents.dto.js","sourceRoot":"","sources":["../../../../src/dto/platform/platform.agents.dto.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"platform.agents.dto.js","sourceRoot":"","sources":["../../../../src/dto/platform/platform.agents.dto.ts"],"names":[],"mappings":";;;AAAA,6BAAsB;AACtB,oCAAqD;AACrD,0CAAsD;AACtD,8CAA8C;AAEjC,QAAA,wBAAwB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC/C,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;IACf,IAAI,EAAE,OAAC,CAAC,UAAU,CAAC,sBAAc,CAAC;IAClC,MAAM,EAAE,OAAC,CAAC,UAAU,CAAC,mBAAW,CAAC;IACjC,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACpC,CAAC,CAAC;AAGU,QAAA,iBAAiB,GAAG,mBAAQ,CAAC,MAAM,CAAC;IAC/C,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;IACjB,WAAW,EAAE,OAAC,CAAC,KAAK,CAAC,gCAAwB,CAAC;IAC9C,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAClC,CAAC,CAAC;AAGU,QAAA,uBAAuB,GAAG,4BAAe,CAAC,OAAO,CAAC,0BAAe,CAAC,CAAC"}
|
package/build/src/etag.js
CHANGED
|
@@ -12,7 +12,7 @@ function calculateEtag(model) {
|
|
|
12
12
|
}
|
|
13
13
|
exports.calculateEtag = calculateEtag;
|
|
14
14
|
function withEtag(model) {
|
|
15
|
-
model.etag = calculateEtag(model);
|
|
15
|
+
model.etag = calculateEtag({ ...model, etag: '' });
|
|
16
16
|
}
|
|
17
17
|
exports.withEtag = withEtag;
|
|
18
18
|
function createWithEtag(model) {
|
package/build/src/etag.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"etag.js","sourceRoot":"","sources":["../../src/etag.ts"],"names":[],"mappings":";;;;;;AAAA,8DAA8B;AAG9B,SAAgB,aAAa,CAAC,KAAc;IAC1C,MAAM,UAAU,GAAoB,EAAC,GAAI,KAAgB,EAAC,CAAC;IAC3D,OAAO,UAAU,CAAC,IAAI,CAAC;IACvB,OAAO,IAAA,qBAAG,EAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;AACzC,CAAC;AAJD,sCAIC;AAED,SAAgB,QAAQ,CAAC,KAA4C;IACnE,KAAK,CAAC,IAAI,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"etag.js","sourceRoot":"","sources":["../../src/etag.ts"],"names":[],"mappings":";;;;;;AAAA,8DAA8B;AAG9B,SAAgB,aAAa,CAAC,KAAc;IAC1C,MAAM,UAAU,GAAoB,EAAC,GAAI,KAAgB,EAAC,CAAC;IAC3D,OAAO,UAAU,CAAC,IAAI,CAAC;IACvB,OAAO,IAAA,qBAAG,EAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;AACzC,CAAC;AAJD,sCAIC;AAED,SAAgB,QAAQ,CAAC,KAA4C;IACnE,KAAK,CAAC,IAAI,GAAG,aAAa,CAAC,EAAC,GAAG,KAAK,EAAE,IAAI,EAAE,EAAE,EAAC,CAAC,CAAC;AACnD,CAAC;AAFD,4BAEC;AAED,SAAgB,cAAc,CAA2B,KAAQ;IAC/D,KAAK,CAAC,IAAI,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IAClC,OAAO,KAAK,CAAC;AACf,CAAC;AAHD,wCAGC"}
|
|
@@ -1,46 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { AgentAuthRoles, AgentDto, AgentInviteDto, AgentStatus, AgentUpsertDto, Page, PlatformAgentDto } from '../dto';
|
|
2
|
+
import { AmpDataServiceImpl } from './data.service';
|
|
3
3
|
import { AmpEntityServiceImpl } from './entity.service';
|
|
4
4
|
import { RestClient } from './rest';
|
|
5
|
-
export declare const _AgentSummaryPayload: z.ZodObject<{
|
|
6
|
-
email: z.ZodString;
|
|
7
|
-
status: z.ZodOptional<z.ZodNativeEnum<typeof import("../dto").AgentStatus>>;
|
|
8
|
-
id: z.ZodOptional<z.ZodString>;
|
|
9
|
-
createdAt: z.ZodOptional<z.ZodString>;
|
|
10
|
-
updatedAt: z.ZodOptional<z.ZodString>;
|
|
11
|
-
deletedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
12
|
-
firstName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
13
|
-
lastName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
14
|
-
pictureUrl: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
15
|
-
role: z.ZodNativeEnum<typeof import("../dto").AuthRole>;
|
|
16
|
-
lastLoggedIn: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
17
|
-
}, "strip", z.ZodTypeAny, {
|
|
18
|
-
email: string;
|
|
19
|
-
role: import("../dto").AuthRole;
|
|
20
|
-
status?: import("../dto").AgentStatus | undefined;
|
|
21
|
-
id?: string | undefined;
|
|
22
|
-
createdAt?: string | undefined;
|
|
23
|
-
updatedAt?: string | undefined;
|
|
24
|
-
deletedAt?: string | null | undefined;
|
|
25
|
-
firstName?: string | null | undefined;
|
|
26
|
-
lastName?: string | null | undefined;
|
|
27
|
-
pictureUrl?: string | undefined;
|
|
28
|
-
lastLoggedIn?: Date | null | undefined;
|
|
29
|
-
}, {
|
|
30
|
-
email: string;
|
|
31
|
-
role: import("../dto").AuthRole;
|
|
32
|
-
status?: import("../dto").AgentStatus | undefined;
|
|
33
|
-
id?: string | undefined;
|
|
34
|
-
createdAt?: string | undefined;
|
|
35
|
-
updatedAt?: string | undefined;
|
|
36
|
-
deletedAt?: string | null | undefined;
|
|
37
|
-
firstName?: string | null | undefined;
|
|
38
|
-
lastName?: string | null | undefined;
|
|
39
|
-
pictureUrl?: string | undefined;
|
|
40
|
-
lastLoggedIn?: Date | null | undefined;
|
|
41
|
-
}>;
|
|
42
|
-
export type AgentSummaryPayload = z.infer<typeof _AgentSummaryPayload>;
|
|
43
5
|
export declare class AgentsService extends AmpEntityServiceImpl<AgentUpsertDto, AgentDto> {
|
|
44
6
|
constructor(rest: RestClient);
|
|
45
|
-
invite: (
|
|
7
|
+
invite: (agentInvitePayload: AgentInviteDto) => Promise<Page<AgentDto>>;
|
|
8
|
+
}
|
|
9
|
+
export declare class PlatformAgentService extends AmpDataServiceImpl<PlatformAgentDto> {
|
|
10
|
+
constructor(rest: RestClient);
|
|
11
|
+
create: (email: string) => Promise<import("./rest").RestResponse>;
|
|
12
|
+
delete: (id: string) => Promise<import("./rest").RestResponse>;
|
|
13
|
+
upsertMembership: ({ tid, agentId, role, status }: {
|
|
14
|
+
tid: string;
|
|
15
|
+
agentId: string;
|
|
16
|
+
role: AgentAuthRoles;
|
|
17
|
+
status: AgentStatus;
|
|
18
|
+
}) => Promise<import("./rest").RestResponse>;
|
|
19
|
+
deleteMembership: ({ tid, agentId }: {
|
|
20
|
+
tid: string;
|
|
21
|
+
agentId: string;
|
|
22
|
+
}) => Promise<import("./rest").RestResponse>;
|
|
46
23
|
}
|
|
@@ -1,23 +1,56 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const dto_1 = require("../dto");
|
|
3
|
+
exports.PlatformAgentService = exports.AgentsService = void 0;
|
|
5
4
|
const constants_1 = require("./constants");
|
|
5
|
+
const data_service_1 = require("./data.service");
|
|
6
6
|
const entity_service_1 = require("./entity.service");
|
|
7
|
-
exports._AgentSummaryPayload = dto_1._AgentSummaryUpsertDto.required({ email: true, role: true });
|
|
8
7
|
class AgentsService extends entity_service_1.AmpEntityServiceImpl {
|
|
9
8
|
constructor(rest) {
|
|
10
9
|
super(rest, constants_1.KIND.AGENTS);
|
|
11
|
-
this.invite = async (
|
|
12
|
-
const payload = exports._AgentSummaryPayload.parse(agentSavePayload);
|
|
10
|
+
this.invite = async (agentInvitePayload) => {
|
|
13
11
|
const res = await this.rest.call({
|
|
14
12
|
url: `/${this.targetApi}/v1/${this.kind}/invite`,
|
|
15
13
|
method: 'POST',
|
|
16
|
-
data:
|
|
14
|
+
data: agentInvitePayload,
|
|
17
15
|
});
|
|
18
16
|
return res.data;
|
|
19
17
|
};
|
|
20
18
|
}
|
|
21
19
|
}
|
|
22
20
|
exports.AgentsService = AgentsService;
|
|
21
|
+
class PlatformAgentService extends data_service_1.AmpDataServiceImpl {
|
|
22
|
+
constructor(rest) {
|
|
23
|
+
super(rest, constants_1.KIND.AGENTS, constants_1.TARGET_API_PLATFORM);
|
|
24
|
+
this.create = async (email) => {
|
|
25
|
+
return this.rest.call({
|
|
26
|
+
url: `/${this.targetApi}/v1/${this.kind}`,
|
|
27
|
+
method: 'POST',
|
|
28
|
+
data: { email },
|
|
29
|
+
headers: {
|
|
30
|
+
'Content-Type': 'application/json',
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
this.delete = async (id) => {
|
|
35
|
+
return this.rest.call({
|
|
36
|
+
url: `/${this.targetApi}/v1/${this.kind}/${id}`,
|
|
37
|
+
method: 'DELETE',
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
this.upsertMembership = async ({ tid, agentId, role, status }) => {
|
|
41
|
+
return this.rest.call({
|
|
42
|
+
url: `/${this.targetApi}/v1/${this.kind}/memberships`,
|
|
43
|
+
method: 'PUT',
|
|
44
|
+
data: { tid, agentId, role, status },
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
this.deleteMembership = async ({ tid, agentId }) => {
|
|
48
|
+
return this.rest.call({
|
|
49
|
+
url: `/${this.targetApi}/v1/${this.kind}/memberships/agentId/${agentId}/tid/${tid}`,
|
|
50
|
+
method: 'DELETE',
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.PlatformAgentService = PlatformAgentService;
|
|
23
56
|
//# sourceMappingURL=AgentsService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentsService.js","sourceRoot":"","sources":["../../../src/services/AgentsService.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"AgentsService.js","sourceRoot":"","sources":["../../../src/services/AgentsService.ts"],"names":[],"mappings":";;;AACA,2CAAsD;AACtD,iDAAkD;AAClD,qDAAsD;AAGtD,MAAa,aAAc,SAAQ,qCAA8C;IAC/E,YAAY,IAAgB;QAC1B,KAAK,CAAC,IAAI,EAAE,gBAAI,CAAC,MAAM,CAAC,CAAC;QAE3B,WAAM,GAAG,KAAK,EAAE,kBAAkC,EAA2B,EAAE;YAC7E,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,IAAI,CAA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AE,IAAI,EAAE,MAAM,EAAC;aACnC,CAAC,CAAC;QACL,CAAC,CAAC;QAEF,qBAAgB,GAAG,KAAK,EAAE,EAAC,GAAG,EAAE,OAAO,EAAiC,EAAE,EAAE;YAC1E,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;gBACpB,GAAG,EAAE,IAAI,IAAI,CAAC,SAAS,OAAO,IAAI,CAAC,IAAI,wBAAwB,OAAO,QAAQ,GAAG,EAAE;gBACnF,MAAM,EAAE,QAAQ;aACjB,CAAC,CAAC;QACL,CAAC,CAAC;IAhCF,CAAC;CAiCF;AApCD,oDAoCC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PlatformActionExecutionDto, PlatformActionExecutionUpsertDto,
|
|
1
|
+
import { PlatformActionExecutionDto, PlatformActionExecutionUpsertDto, PlatformCustomActionDto, PlatformCustomActionUpsertDto, PlatformCustomScoreCohortDto, PlatformCustomScoreCohortUpsertDto, PlatformCustomScoreValueDto, PlatformCustomScoreValueUpsertDto, PlatformFindingDto, PlatformFindingSpecDto, PlatformFindingSpecUpsertDto, PlatformFindingUpsertDto, PlatformFlowSpecDto, PlatformFlowSpecUpsertDto, PlatformFlowStateDto, PlatformFlowStateUpsertDto, PlatformJobExecutionStateDto, PlatformJobExecutionStateUpsertDto, PlatformJobSpecDto, PlatformJobSpecUpsertDto, PlatformNotificationDto, PlatformNotificationUpsertDto, PlatformProviderUpsertDto, PlatformReportResultDto, PlatformReportResultUpsertDto, PlatformRiskContributorDto, PlatformRiskContributorUpsertDto, PlatformSaasComponentDto, PlatformSaasComponentUpsertDto, PlatformStagedSaasAssetDto, PlatformStagedSaasAssetUpsertDto, PlatformStagedSaasUserDto, PlatformStagedSaasUserUpsertDto, PlatformTokenDto, PlatformTokenUpsertDto, ProviderDto, TenantDto, TenantUpsertDto } from '../dto';
|
|
2
2
|
import { AmpEntityService, AmpSdkAssetService, AmpSdkTenantService, AmpSdkUserService, TruncatableAmpEntityService } from './entity.service';
|
|
3
3
|
import { AmpRestClientOptions, RestClient } from './rest';
|
|
4
4
|
import { EnumService } from './rest/EnumService';
|
|
@@ -7,6 +7,7 @@ import { AmpSaaSEntityService, AmpSdkSaasAssetService, AmpSdkSaasComponentServic
|
|
|
7
7
|
import { ContentfulService } from './contentful.service';
|
|
8
8
|
import { FindingsInsightsService } from './findingsInsights.service';
|
|
9
9
|
import { PlatformConnectorService } from './connector.platform.service';
|
|
10
|
+
import { PlatformAgentService } from './AgentsService';
|
|
10
11
|
export type AmpSdkOptions = AmpRestClientOptions;
|
|
11
12
|
/**
|
|
12
13
|
* AMP API
|
|
@@ -19,7 +20,7 @@ export type AmpSdkOptions = AmpRestClientOptions;
|
|
|
19
20
|
*/
|
|
20
21
|
export declare class AmpSdkServices {
|
|
21
22
|
readonly actionExecutions: AmpEntityService<PlatformActionExecutionUpsertDto, PlatformActionExecutionDto>;
|
|
22
|
-
readonly agents:
|
|
23
|
+
readonly agents: PlatformAgentService;
|
|
23
24
|
readonly asset: AmpSdkAssetService;
|
|
24
25
|
readonly connectors: PlatformConnectorService;
|
|
25
26
|
readonly contentful: ContentfulService;
|
|
@@ -10,6 +10,7 @@ const saasEntity_service_1 = require("./saasEntity.service");
|
|
|
10
10
|
const contentful_service_1 = require("./contentful.service");
|
|
11
11
|
const findingsInsights_service_1 = require("./findingsInsights.service");
|
|
12
12
|
const connector_platform_service_1 = require("./connector.platform.service");
|
|
13
|
+
const AgentsService_1 = require("./AgentsService");
|
|
13
14
|
/**
|
|
14
15
|
* AMP API
|
|
15
16
|
* This client is a wrapper around the AMP REST API meant to be used by
|
|
@@ -22,7 +23,7 @@ const connector_platform_service_1 = require("./connector.platform.service");
|
|
|
22
23
|
class AmpSdkServices {
|
|
23
24
|
constructor(rest) {
|
|
24
25
|
this.actionExecutions = new entity_service_1.AmpEntityServiceImpl(rest, constants_1.KIND.ACTION_EXECUTION, constants_1.TARGET_API_PLATFORM);
|
|
25
|
-
this.agents = new
|
|
26
|
+
this.agents = new AgentsService_1.PlatformAgentService(rest);
|
|
26
27
|
this.asset = new entity_service_1.AmpSdkAssetService(rest, constants_1.TARGET_API_PLATFORM);
|
|
27
28
|
this.connectors = new connector_platform_service_1.PlatformConnectorService(rest);
|
|
28
29
|
this.contentful = new contentful_service_1.ContentfulService();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AmpSdk.js","sourceRoot":"","sources":["../../../src/services/AmpSdk.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"AmpSdk.js","sourceRoot":"","sources":["../../../src/services/AmpSdk.ts"],"names":[],"mappings":";;;AA0CA,qDAQ0B;AAC1B,iCAA0E;AAC1E,2CAAsD;AACtD,oDAAmE;AACnE,yDAAyD;AACzD,6DAA+J;AAC/J,6DAAuD;AACvD,yEAAmE;AACnE,6EAAsE;AACtE,mDAAqD;AAIrD;;;;;;;;GAQG;AACH,MAAa,cAAc;IAgCzB,YAAY,IAAgB;QAC1B,IAAI,CAAC,gBAAgB,GAAG,IAAI,qCAAoB,CAA+D,IAAI,EAAE,gBAAI,CAAC,gBAAgB,EAAE,+BAAmB,CAAC,CAAC;QACjK,IAAI,CAAC,MAAM,GAAG,IAAI,oCAAoB,CAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,CAAC,KAAK,GAAG,IAAI,mCAAkB,CAAC,IAAI,EAAE,+BAAmB,CAAC,CAAC;QAC/D,IAAI,CAAC,UAAU,GAAG,IAAI,qDAAwB,CAAC,IAAI,CAAC,CAAC;QACrD,IAAI,CAAC,UAAU,GAAG,IAAI,sCAAiB,EAAE,CAAC;QAC1C,IAAI,CAAC,aAAa,GAAG,IAAI,qCAAoB,CAAyD,IAAI,EAAE,gBAAI,CAAC,cAAc,EAAE,+BAAmB,CAAC,CAAC;QACtJ,IAAI,CAAC,kBAAkB,GAAG,IAAI,qCAAoB,CAAmE,IAAI,EAAE,gBAAI,CAAC,oBAAoB,EAAE,+BAAmB,CAAC,CAAC;QAC3K,IAAI,CAAC,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OAAO,CAAC,CAAC;QACvC,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;CACF;AA1ED,wCA0EC"}
|
|
@@ -86,7 +86,14 @@ class DefaultRestClient {
|
|
|
86
86
|
baseURL: options.baseUrl,
|
|
87
87
|
timeout: options.timeout,
|
|
88
88
|
paramsSerializer: params => {
|
|
89
|
-
|
|
89
|
+
let tempParams = qs_1.default.stringify(params, { arrayFormat: 'repeat' });
|
|
90
|
+
// Replacing '=&' with '=null&'
|
|
91
|
+
tempParams = tempParams.replace(/=&/g, '=null&');
|
|
92
|
+
// If qs ends with '=', replacing it with '=null'
|
|
93
|
+
if (tempParams.endsWith('=')) {
|
|
94
|
+
tempParams += 'null';
|
|
95
|
+
}
|
|
96
|
+
return tempParams;
|
|
90
97
|
},
|
|
91
98
|
});
|
|
92
99
|
Object.keys((_b = options.headers) !== null && _b !== void 0 ? _b : {}).forEach(key => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RestClient.js","sourceRoot":"","sources":["../../../../src/services/rest/RestClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAuB;AACvB,4CAAoB;AACpB,+CAA4D;AAG5D,6CAA4E;AAC5E,mCAAmD;AACnD,qDAAiI;AACjI,2CAAoD;AAmCpD;;;;;;GAMG;AACH,MAAa,iBAAiB;IAQ5B,YAAY,UAA6B,EAAE;;
|
|
1
|
+
{"version":3,"file":"RestClient.js","sourceRoot":"","sources":["../../../../src/services/rest/RestClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAuB;AACvB,4CAAoB;AACpB,+CAA4D;AAG5D,6CAA4E;AAC5E,mCAAmD;AACnD,qDAAiI;AACjI,2CAAoD;AAmCpD;;;;;;GAMG;AACH,MAAa,iBAAiB;IAQ5B,YAAY,UAA6B,EAAE;;QA4B3C,SAAI,GAAG,KAAK,EAAE,OAAoB,EAAyB,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@
|
|
|
1
1
|
import {AgentStatus} from './enums/agent.status';
|
|
2
|
-
import {
|
|
3
|
-
import {AuthRole} from './enums';
|
|
2
|
+
import {UPSERT_DTO_MASK, _BaseDto, _BaseUpsertDto} from './base.dto';
|
|
4
3
|
import {z} from 'zod';
|
|
5
|
-
|
|
4
|
+
import {AgentAuthRoles} from './enums';
|
|
6
5
|
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
pictureUrl?: string;
|
|
18
|
-
/** Agent role */
|
|
19
|
-
// TODO: role: AgentRole; // for now all agents are `OWNER`. Need to map role to tenant
|
|
20
|
-
};
|
|
6
|
+
export const _AgentDto = _BaseDto.extend({
|
|
7
|
+
firstName: z.string().nullable(),
|
|
8
|
+
lastName: z.string().nullable(),
|
|
9
|
+
status: z.nativeEnum(AgentStatus),
|
|
10
|
+
role: z.nativeEnum(AgentAuthRoles),
|
|
11
|
+
email: z.string(),
|
|
12
|
+
pictureUrl: z.string().nullable(),
|
|
13
|
+
lastLoggedIn: z.string().nullable(),
|
|
14
|
+
});
|
|
15
|
+
export type AgentDto = z.infer<typeof _AgentDto>;
|
|
21
16
|
|
|
22
|
-
export
|
|
17
|
+
export const _AgentUpsertDto = _AgentDto.partial(UPSERT_DTO_MASK);
|
|
18
|
+
export type AgentUpsertDto = z.infer<typeof _AgentUpsertDto>;
|
|
23
19
|
|
|
24
|
-
export const
|
|
25
|
-
.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
lastLoggedIn: z.date().nullable(),
|
|
33
|
-
})
|
|
34
|
-
.merge(_BaseDto);
|
|
35
|
-
|
|
36
|
-
export type AgentSummaryDto = z.infer<typeof _AgentSummaryDto>;
|
|
37
|
-
|
|
38
|
-
export const _AgentSummaryUpsertDto = _AgentSummaryDto.partial();
|
|
39
|
-
export type AgentSummaryUpsertDto = z.infer<typeof _AgentSummaryUpsertDto>;
|
|
20
|
+
export const _AgentInviteDto = z.object({
|
|
21
|
+
email: z.string(),
|
|
22
|
+
role: z.nativeEnum(AgentAuthRoles),
|
|
23
|
+
firstName: z.string().optional(),
|
|
24
|
+
lastName: z.string().optional(),
|
|
25
|
+
pictureUrl: z.string().optional(),
|
|
26
|
+
});
|
|
27
|
+
export type AgentInviteDto = z.infer<typeof _AgentInviteDto>;
|
|
@@ -46,8 +46,36 @@ const authRoleLookupMap: {[key: string]: AuthRole} = {
|
|
|
46
46
|
SUPPORT: AuthRole.SUPPORT,
|
|
47
47
|
OPERATOR: AuthRole.OPERATOR,
|
|
48
48
|
SERVICE_ACCOUNT: AuthRole.SERVICE_ACCOUNT,
|
|
49
|
-
};
|
|
49
|
+
} as const;
|
|
50
50
|
|
|
51
51
|
export function lookupAuthRole(role: string): AuthRole {
|
|
52
52
|
return authRoleLookupMap[role] || AuthRole.UNKNOWN;
|
|
53
53
|
}
|
|
54
|
+
|
|
55
|
+
// Create the type of the subset
|
|
56
|
+
export type UserAuthRoles = Extract<AuthRole, AuthRole.USER>;
|
|
57
|
+
// And the const that goes with it
|
|
58
|
+
export const UserAuthRoles = {
|
|
59
|
+
[AuthRole.USER]: AuthRole.USER,
|
|
60
|
+
} as const;
|
|
61
|
+
|
|
62
|
+
// Create the type of the subset
|
|
63
|
+
export type AgentAuthRoles = Extract<AuthRole, AuthRole.ADMIN | AuthRole.AGENT | AuthRole.OWNER | AuthRole.REPORT_VIEWER | AuthRole.VIEWER>;
|
|
64
|
+
// And the const that goes with it
|
|
65
|
+
export const AgentAuthRoles = {
|
|
66
|
+
[AuthRole.ADMIN]: AuthRole.ADMIN,
|
|
67
|
+
[AuthRole.AGENT]: AuthRole.AGENT,
|
|
68
|
+
[AuthRole.OWNER]: AuthRole.OWNER,
|
|
69
|
+
[AuthRole.REPORT_VIEWER]: AuthRole.REPORT_VIEWER,
|
|
70
|
+
[AuthRole.VIEWER]: AuthRole.VIEWER,
|
|
71
|
+
} as const;
|
|
72
|
+
|
|
73
|
+
// Create the type of the subset
|
|
74
|
+
export type PlatformAuthRoles = Extract<AuthRole, AuthRole.CUSTOMER_SUCCESS | AuthRole.OPERATOR | AuthRole.SERVICE_ACCOUNT | AuthRole.SUPPORT>;
|
|
75
|
+
// And the const that goes with it
|
|
76
|
+
export const PlatformAuthRoles = {
|
|
77
|
+
[AuthRole.CUSTOMER_SUCCESS]: AuthRole.CUSTOMER_SUCCESS,
|
|
78
|
+
[AuthRole.OPERATOR]: AuthRole.OPERATOR,
|
|
79
|
+
[AuthRole.SERVICE_ACCOUNT]: AuthRole.SERVICE_ACCOUNT,
|
|
80
|
+
[AuthRole.SUPPORT]: AuthRole.SUPPORT,
|
|
81
|
+
} as const;
|
package/src/dto/findings.dto.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {z} from 'zod';
|
|
2
2
|
import {SimpleAssetDto} from './assets.dto';
|
|
3
|
-
import {BaseDto, BaseUpsertDto, _BaseDto} from './base.dto';
|
|
3
|
+
import {BaseDto, BaseUpsertDto, UPSERT_DTO_MASK, _BaseDto} from './base.dto';
|
|
4
4
|
import {Category, FindingKind, FindingSpecKind, SaasComponentKind} from './enums';
|
|
5
5
|
import {FindingOutcome, FindingSeverity, FindingStatus} from './enums';
|
|
6
6
|
import {SimpleProviderDto} from './providers.dto';
|
|
@@ -107,12 +107,7 @@ export const _FindingSpecDto = _BaseDto.extend({
|
|
|
107
107
|
});
|
|
108
108
|
export type FindingSpecDto = z.infer<typeof _FindingSpecDto>;
|
|
109
109
|
|
|
110
|
-
export const _FindingSpecUpsertDto = _FindingSpecDto.partial(
|
|
111
|
-
id: true,
|
|
112
|
-
createdAt: true,
|
|
113
|
-
updatedAt: true,
|
|
114
|
-
deletedAt: true,
|
|
115
|
-
});
|
|
110
|
+
export const _FindingSpecUpsertDto = _FindingSpecDto.partial(UPSERT_DTO_MASK);
|
|
116
111
|
export type FindingSpecUpsertDto = z.infer<typeof _FindingSpecUpsertDto>;
|
|
117
112
|
|
|
118
113
|
export const _FindingSummaryDto = z.object({
|
|
@@ -1,6 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import {z} from 'zod';
|
|
2
|
+
import {AgentAuthRoles, AgentStatus} from '../enums';
|
|
3
|
+
import {UPSERT_DTO_MASK, _BaseDto} from '../base.dto';
|
|
4
|
+
import {_AgentUpsertDto} from '../agents.dto';
|
|
3
5
|
|
|
4
|
-
export
|
|
6
|
+
export const _PlatformAgentMembership = z.object({
|
|
7
|
+
tid: z.string(),
|
|
8
|
+
role: z.nativeEnum(AgentAuthRoles),
|
|
9
|
+
status: z.nativeEnum(AgentStatus),
|
|
10
|
+
organization: z.string().nullable(),
|
|
11
|
+
department: z.string().nullable(),
|
|
12
|
+
lastLoggedIn: z.string().nullable(),
|
|
13
|
+
});
|
|
14
|
+
export type PlatformAgentMembership = z.infer<typeof _PlatformAgentMembership>;
|
|
5
15
|
|
|
6
|
-
export
|
|
16
|
+
export const _PlatformAgentDto = _BaseDto.extend({
|
|
17
|
+
firstName: z.string().nullable(),
|
|
18
|
+
lastName: z.string().nullable(),
|
|
19
|
+
email: z.string(),
|
|
20
|
+
memberships: z.array(_PlatformAgentMembership),
|
|
21
|
+
pictureUrl: z.string().nullable(),
|
|
22
|
+
});
|
|
23
|
+
export type PlatformAgentDto = z.infer<typeof _PlatformAgentDto>;
|
|
24
|
+
|
|
25
|
+
export const _PlatformAgentUpsertDto = _AgentUpsertDto.partial(UPSERT_DTO_MASK);
|
|
26
|
+
export type PlatformAgentUpsertDto = z.infer<typeof _PlatformAgentUpsertDto>;
|
package/src/etag.ts
CHANGED
|
@@ -8,7 +8,7 @@ export function calculateEtag(model: unknown): string {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export function withEtag(model: ChangeAwareDto | ChangeAwareUpsertDto) {
|
|
11
|
-
model.etag = calculateEtag(model);
|
|
11
|
+
model.etag = calculateEtag({...model, etag: ''});
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export function createWithEtag<T extends {etag: string}>(model: T): T {
|
|
@@ -1,25 +1,58 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import {AgentAuthRoles, AgentDto, AgentInviteDto, AgentStatus, AgentUpsertDto, Page, PlatformAgentDto, _AgentUpsertDto} from '../dto';
|
|
2
|
+
import {KIND, TARGET_API_PLATFORM} from './constants';
|
|
3
|
+
import {AmpDataServiceImpl} from './data.service';
|
|
4
4
|
import {AmpEntityServiceImpl} from './entity.service';
|
|
5
5
|
import {RestClient} from './rest';
|
|
6
6
|
|
|
7
|
-
export const _AgentSummaryPayload = _AgentSummaryUpsertDto.required({email: true, role: true});
|
|
8
|
-
export type AgentSummaryPayload = z.infer<typeof _AgentSummaryPayload>;
|
|
9
|
-
|
|
10
7
|
export class AgentsService extends AmpEntityServiceImpl<AgentUpsertDto, AgentDto> {
|
|
11
8
|
constructor(rest: RestClient) {
|
|
12
9
|
super(rest, KIND.AGENTS);
|
|
13
10
|
}
|
|
14
|
-
invite = async (
|
|
15
|
-
const payload = _AgentSummaryPayload.parse(agentSavePayload);
|
|
16
|
-
|
|
11
|
+
invite = async (agentInvitePayload: AgentInviteDto): Promise<Page<AgentDto>> => {
|
|
17
12
|
const res = await this.rest.call({
|
|
18
13
|
url: `/${this.targetApi}/v1/${this.kind}/invite`,
|
|
19
14
|
method: 'POST',
|
|
20
|
-
data:
|
|
15
|
+
data: agentInvitePayload,
|
|
21
16
|
});
|
|
22
17
|
|
|
23
18
|
return res.data as Page<AgentDto>;
|
|
24
19
|
};
|
|
25
20
|
}
|
|
21
|
+
|
|
22
|
+
export class PlatformAgentService extends AmpDataServiceImpl<PlatformAgentDto> {
|
|
23
|
+
constructor(rest: RestClient) {
|
|
24
|
+
super(rest, KIND.AGENTS, TARGET_API_PLATFORM);
|
|
25
|
+
}
|
|
26
|
+
create = async (email: string) => {
|
|
27
|
+
return this.rest.call({
|
|
28
|
+
url: `/${this.targetApi}/v1/${this.kind}`,
|
|
29
|
+
method: 'POST',
|
|
30
|
+
data: {email},
|
|
31
|
+
headers: {
|
|
32
|
+
'Content-Type': 'application/json',
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
delete = async (id: string) => {
|
|
38
|
+
return this.rest.call({
|
|
39
|
+
url: `/${this.targetApi}/v1/${this.kind}/${id}`,
|
|
40
|
+
method: 'DELETE',
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
upsertMembership = async ({tid, agentId, role, status}: {tid: string; agentId: string; role: AgentAuthRoles; status: AgentStatus}) => {
|
|
45
|
+
return this.rest.call({
|
|
46
|
+
url: `/${this.targetApi}/v1/${this.kind}/memberships`,
|
|
47
|
+
method: 'PUT',
|
|
48
|
+
data: {tid, agentId, role, status},
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
deleteMembership = async ({tid, agentId}: {tid: string; agentId: string}) => {
|
|
53
|
+
return this.rest.call({
|
|
54
|
+
url: `/${this.targetApi}/v1/${this.kind}/memberships/agentId/${agentId}/tid/${tid}`,
|
|
55
|
+
method: 'DELETE',
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
}
|
package/src/services/AmpSdk.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PlatformActionExecutionDto,
|
|
3
3
|
PlatformActionExecutionUpsertDto,
|
|
4
|
-
PlatformAgentDto,
|
|
5
|
-
PlatformAgentUpsertDto,
|
|
6
4
|
PlatformCustomActionDto,
|
|
7
5
|
PlatformCustomActionUpsertDto,
|
|
8
6
|
PlatformCustomScoreCohortDto,
|
|
@@ -59,6 +57,7 @@ import {AmpSaaSEntityService, AmpSaaSEntityServiceImpl, AmpSdkSaasAssetService,
|
|
|
59
57
|
import {ContentfulService} from './contentful.service';
|
|
60
58
|
import {FindingsInsightsService} from './findingsInsights.service';
|
|
61
59
|
import {PlatformConnectorService} from './connector.platform.service';
|
|
60
|
+
import {PlatformAgentService} from './AgentsService';
|
|
62
61
|
|
|
63
62
|
export type AmpSdkOptions = AmpRestClientOptions;
|
|
64
63
|
|
|
@@ -73,7 +72,7 @@ export type AmpSdkOptions = AmpRestClientOptions;
|
|
|
73
72
|
*/
|
|
74
73
|
export class AmpSdkServices {
|
|
75
74
|
readonly actionExecutions: AmpEntityService<PlatformActionExecutionUpsertDto, PlatformActionExecutionDto>;
|
|
76
|
-
readonly agents:
|
|
75
|
+
readonly agents: PlatformAgentService;
|
|
77
76
|
readonly asset: AmpSdkAssetService;
|
|
78
77
|
readonly connectors: PlatformConnectorService;
|
|
79
78
|
readonly contentful: ContentfulService;
|
|
@@ -105,7 +104,7 @@ export class AmpSdkServices {
|
|
|
105
104
|
|
|
106
105
|
constructor(rest: RestClient) {
|
|
107
106
|
this.actionExecutions = new AmpEntityServiceImpl<PlatformActionExecutionUpsertDto, PlatformActionExecutionDto>(rest, KIND.ACTION_EXECUTION, TARGET_API_PLATFORM);
|
|
108
|
-
this.agents = new
|
|
107
|
+
this.agents = new PlatformAgentService(rest);
|
|
109
108
|
this.asset = new AmpSdkAssetService(rest, TARGET_API_PLATFORM);
|
|
110
109
|
this.connectors = new PlatformConnectorService(rest);
|
|
111
110
|
this.contentful = new ContentfulService();
|
|
@@ -62,7 +62,14 @@ export class DefaultRestClient implements RestClient {
|
|
|
62
62
|
baseURL: options.baseUrl,
|
|
63
63
|
timeout: options.timeout,
|
|
64
64
|
paramsSerializer: params => {
|
|
65
|
-
|
|
65
|
+
let tempParams = qs.stringify(params, {arrayFormat: 'repeat'});
|
|
66
|
+
// Replacing '=&' with '=null&'
|
|
67
|
+
tempParams = tempParams.replace(/=&/g, '=null&');
|
|
68
|
+
// If qs ends with '=', replacing it with '=null'
|
|
69
|
+
if (tempParams.endsWith('=')) {
|
|
70
|
+
tempParams += 'null';
|
|
71
|
+
}
|
|
72
|
+
return tempParams;
|
|
66
73
|
},
|
|
67
74
|
});
|
|
68
75
|
Object.keys(options.headers ?? {}).forEach(key => {
|