@ampsec/platform-client 58.9.2 → 58.11.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.
- package/build/src/FilterCriteria.d.ts +795 -40
- package/build/src/FilterCriteria.js +82 -0
- package/build/src/FilterCriteria.js.map +1 -1
- package/build/src/dto/assets.dto.d.ts +10 -1
- package/build/src/dto/base.dto.d.ts +27 -9
- package/build/src/dto/base.dto.js +2 -4
- package/build/src/dto/base.dto.js.map +1 -1
- package/build/src/dto/coverage.dto.d.ts +11 -11
- package/build/src/dto/enums/finding.status.d.ts +3 -1
- package/build/src/dto/enums/finding.status.js +2 -0
- package/build/src/dto/enums/finding.status.js.map +1 -1
- package/build/src/dto/flows.dto.d.ts +819 -0
- package/build/src/dto/flows.dto.js +85 -0
- package/build/src/dto/flows.dto.js.map +1 -0
- package/build/src/dto/index.d.ts +1 -0
- package/build/src/dto/index.js +1 -0
- package/build/src/dto/index.js.map +1 -1
- package/build/src/dto/platform/index.d.ts +1 -0
- package/build/src/dto/platform/index.js +1 -0
- package/build/src/dto/platform/index.js.map +1 -1
- package/build/src/dto/platform/platform.flows.dto.d.ts +540 -0
- package/build/src/dto/platform/platform.flows.dto.js +32 -0
- package/build/src/dto/platform/platform.flows.dto.js.map +1 -0
- package/build/src/dto/platform/tenant.based.dto.d.ts +40 -8
- package/build/src/dto/platform/tenant.based.dto.js +7 -0
- package/build/src/dto/platform/tenant.based.dto.js.map +1 -1
- package/build/src/dto/saasAssets.dto.d.ts +10 -1
- package/build/src/dto/saasUsers.dto.d.ts +15 -6
- package/build/src/services/AmpSdk.d.ts +3 -0
- package/build/src/services/AmpSdk.js +2 -0
- package/build/src/services/AmpSdk.js.map +1 -1
- package/build/src/services/constants.d.ts +2 -0
- package/build/src/services/constants.js +2 -0
- package/build/src/services/constants.js.map +1 -1
- package/build/src/services/utils.d.ts +3 -0
- package/build/src/services/utils.js +16 -1
- package/build/src/services/utils.js.map +1 -1
- package/package.json +2 -1
- package/src/FilterCriteria.ts +104 -39
- package/src/dto/base.dto.ts +4 -6
- package/src/dto/enums/finding.status.ts +2 -0
- package/src/dto/flows.dto.ts +107 -0
- package/src/dto/index.ts +1 -0
- package/src/dto/platform/index.ts +1 -0
- package/src/dto/platform/platform.flows.dto.ts +38 -0
- package/src/dto/platform/tenant.based.dto.ts +8 -9
- package/src/services/AmpSdk.ts +5 -0
- package/src/services/constants.ts +2 -0
- package/src/services/utils.ts +16 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NOOP_FLOW_SPEC = exports._PlatformFlowStateDto = exports._PlatformFlowStateUpsertDto = exports._PlatformFlowSpecDto = exports._PlatformFlowSpecUpsertDto = void 0;
|
|
4
|
+
const flows_dto_1 = require("../flows.dto");
|
|
5
|
+
const tenant_based_dto_1 = require("./tenant.based.dto");
|
|
6
|
+
/*
|
|
7
|
+
* /====================\
|
|
8
|
+
* | FlowSpec |
|
|
9
|
+
* \====================/
|
|
10
|
+
*/
|
|
11
|
+
exports._PlatformFlowSpecUpsertDto = flows_dto_1._FlowSpecUpsertDto;
|
|
12
|
+
exports._PlatformFlowSpecDto = flows_dto_1._FlowSpecDto;
|
|
13
|
+
/*
|
|
14
|
+
* /=====================\
|
|
15
|
+
* | FlowState |
|
|
16
|
+
* \=====================/
|
|
17
|
+
*/
|
|
18
|
+
exports._PlatformFlowStateUpsertDto = flows_dto_1._FlowStateUpsertDto.merge(tenant_based_dto_1._UpsertTenantBased);
|
|
19
|
+
exports._PlatformFlowStateDto = flows_dto_1._FlowStateDto.merge(tenant_based_dto_1._TenantBased);
|
|
20
|
+
exports.NOOP_FLOW_SPEC = {
|
|
21
|
+
id: '000000000000',
|
|
22
|
+
createdAt: '2023-04-17T13:00:00.000Z',
|
|
23
|
+
updatedAt: '2023-04-17T13:00:00.000Z',
|
|
24
|
+
deletedAt: null,
|
|
25
|
+
name: 'NOOP - DROP TRIGGER EVENT',
|
|
26
|
+
fslStrategy: 'STANDARD',
|
|
27
|
+
triggerFilter: {
|
|
28
|
+
trigger: 'noop',
|
|
29
|
+
},
|
|
30
|
+
filter: {},
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=platform.flows.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.flows.dto.js","sourceRoot":"","sources":["../../../../src/dto/platform/platform.flows.dto.ts"],"names":[],"mappings":";;;AACA,4CAAkG;AAClG,yDAAoE;AAEpE;;;;GAIG;AACU,QAAA,0BAA0B,GAAG,8BAAkB,CAAC;AAGhD,QAAA,oBAAoB,GAAG,wBAAY,CAAC;AAGjD;;;;GAIG;AACU,QAAA,2BAA2B,GAAG,+BAAmB,CAAC,KAAK,CAAC,qCAAkB,CAAC,CAAC;AAG5E,QAAA,qBAAqB,GAAG,yBAAa,CAAC,KAAK,CAAC,+BAAY,CAAC,CAAC;AAG1D,QAAA,cAAc,GAAwB;IACjD,EAAE,EAAE,cAAc;IAClB,SAAS,EAAE,0BAA0B;IACrC,SAAS,EAAE,0BAA0B;IACrC,SAAS,EAAE,IAAI;IACf,IAAI,EAAE,2BAA2B;IACjC,WAAW,EAAE,UAAU;IACvB,aAAa,EAAE;QACb,OAAO,EAAE,MAAM;KAChB;IACD,MAAM,EAAE,EAAE;CACX,CAAC"}
|
|
@@ -1,9 +1,41 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const _TenantBased: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
createdAt: z.ZodString;
|
|
5
|
+
updatedAt: z.ZodString;
|
|
6
|
+
deletedAt: z.ZodNullable<z.ZodString>;
|
|
7
|
+
tid: z.ZodString;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
id: string;
|
|
8
10
|
tid: string;
|
|
9
|
-
|
|
11
|
+
createdAt: string;
|
|
12
|
+
updatedAt: string;
|
|
13
|
+
deletedAt: string | null;
|
|
14
|
+
}, {
|
|
15
|
+
id: string;
|
|
16
|
+
tid: string;
|
|
17
|
+
createdAt: string;
|
|
18
|
+
updatedAt: string;
|
|
19
|
+
deletedAt: string | null;
|
|
20
|
+
}>;
|
|
21
|
+
export type TenantBased = z.infer<typeof _TenantBased>;
|
|
22
|
+
export declare const _UpsertTenantBased: z.ZodObject<{
|
|
23
|
+
id: z.ZodOptional<z.ZodString>;
|
|
24
|
+
createdAt: z.ZodOptional<z.ZodString>;
|
|
25
|
+
updatedAt: z.ZodOptional<z.ZodString>;
|
|
26
|
+
deletedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
27
|
+
tid: z.ZodOptional<z.ZodString>;
|
|
28
|
+
}, "strip", z.ZodTypeAny, {
|
|
29
|
+
id?: string | undefined;
|
|
30
|
+
createdAt?: string | undefined;
|
|
31
|
+
updatedAt?: string | undefined;
|
|
32
|
+
deletedAt?: string | null | undefined;
|
|
33
|
+
tid?: string | undefined;
|
|
34
|
+
}, {
|
|
35
|
+
id?: string | undefined;
|
|
36
|
+
createdAt?: string | undefined;
|
|
37
|
+
updatedAt?: string | undefined;
|
|
38
|
+
deletedAt?: string | null | undefined;
|
|
39
|
+
tid?: string | undefined;
|
|
40
|
+
}>;
|
|
41
|
+
export type UpsertTenantBased = z.infer<typeof _UpsertTenantBased>;
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports._UpsertTenantBased = exports._TenantBased = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const base_dto_1 = require("../base.dto");
|
|
6
|
+
exports._TenantBased = base_dto_1._BaseDto.extend({
|
|
7
|
+
tid: zod_1.z.string(),
|
|
8
|
+
});
|
|
9
|
+
exports._UpsertTenantBased = exports._TenantBased.partial();
|
|
3
10
|
//# sourceMappingURL=tenant.based.dto.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tenant.based.dto.js","sourceRoot":"","sources":["../../../../src/dto/platform/tenant.based.dto.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"tenant.based.dto.js","sourceRoot":"","sources":["../../../../src/dto/platform/tenant.based.dto.ts"],"names":[],"mappings":";;;AAAA,6BAAsB;AACtB,0CAAqC;AAExB,QAAA,YAAY,GAAG,mBAAQ,CAAC,MAAM,CAAC;IAC1C,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;CAChB,CAAC,CAAC;AAGU,QAAA,kBAAkB,GAAG,oBAAY,CAAC,OAAO,EAAE,CAAC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const _SaasAssetUpsertDto: z.ZodObject<{
|
|
3
|
-
id: z.ZodOptional<z.
|
|
3
|
+
id: z.ZodOptional<z.ZodString>;
|
|
4
|
+
createdAt: z.ZodOptional<z.ZodString>;
|
|
5
|
+
updatedAt: z.ZodOptional<z.ZodString>;
|
|
6
|
+
deletedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
4
7
|
etag: z.ZodString;
|
|
5
8
|
extKeys: z.ZodObject<{
|
|
6
9
|
extId: z.ZodOptional<z.ZodString>;
|
|
@@ -31,6 +34,9 @@ export declare const _SaasAssetUpsertDto: z.ZodObject<{
|
|
|
31
34
|
sn?: string | undefined;
|
|
32
35
|
};
|
|
33
36
|
id?: string | undefined;
|
|
37
|
+
createdAt?: string | undefined;
|
|
38
|
+
updatedAt?: string | undefined;
|
|
39
|
+
deletedAt?: string | null | undefined;
|
|
34
40
|
uid?: string | undefined;
|
|
35
41
|
meta?: unknown;
|
|
36
42
|
}, {
|
|
@@ -44,6 +50,9 @@ export declare const _SaasAssetUpsertDto: z.ZodObject<{
|
|
|
44
50
|
sn?: string | undefined;
|
|
45
51
|
};
|
|
46
52
|
id?: string | undefined;
|
|
53
|
+
createdAt?: string | undefined;
|
|
54
|
+
updatedAt?: string | undefined;
|
|
55
|
+
deletedAt?: string | null | undefined;
|
|
47
56
|
uid?: string | undefined;
|
|
48
57
|
meta?: unknown;
|
|
49
58
|
}>;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const _SaasUserUpsertDto: z.ZodObject<{
|
|
3
|
-
id: z.ZodOptional<z.
|
|
3
|
+
id: z.ZodOptional<z.ZodString>;
|
|
4
|
+
createdAt: z.ZodOptional<z.ZodString>;
|
|
5
|
+
updatedAt: z.ZodOptional<z.ZodString>;
|
|
6
|
+
deletedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
4
7
|
etag: z.ZodString;
|
|
5
8
|
uid: z.ZodString;
|
|
6
9
|
cid: z.ZodString;
|
|
@@ -8,27 +11,33 @@ export declare const _SaasUserUpsertDto: z.ZodObject<{
|
|
|
8
11
|
extId: z.ZodString;
|
|
9
12
|
meta: z.ZodUnknown;
|
|
10
13
|
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
email: string;
|
|
11
15
|
cid: string;
|
|
12
16
|
uid: string;
|
|
13
|
-
email: string;
|
|
14
17
|
etag: string;
|
|
15
18
|
extId: string;
|
|
16
19
|
id?: string | undefined;
|
|
20
|
+
createdAt?: string | undefined;
|
|
21
|
+
updatedAt?: string | undefined;
|
|
22
|
+
deletedAt?: string | null | undefined;
|
|
17
23
|
meta?: unknown;
|
|
18
24
|
}, {
|
|
25
|
+
email: string;
|
|
19
26
|
cid: string;
|
|
20
27
|
uid: string;
|
|
21
|
-
email: string;
|
|
22
28
|
etag: string;
|
|
23
29
|
extId: string;
|
|
24
30
|
id?: string | undefined;
|
|
31
|
+
createdAt?: string | undefined;
|
|
32
|
+
updatedAt?: string | undefined;
|
|
33
|
+
deletedAt?: string | null | undefined;
|
|
25
34
|
meta?: unknown;
|
|
26
35
|
}>;
|
|
27
36
|
export type SaasUserUpsertDto = z.infer<typeof _SaasUserUpsertDto>;
|
|
28
37
|
export declare const _SaasUserDto: z.ZodObject<{
|
|
38
|
+
email: z.ZodString;
|
|
29
39
|
cid: z.ZodString;
|
|
30
40
|
uid: z.ZodString;
|
|
31
|
-
email: z.ZodString;
|
|
32
41
|
extId: z.ZodString;
|
|
33
42
|
meta: z.ZodUnknown;
|
|
34
43
|
id: z.ZodString;
|
|
@@ -37,24 +46,24 @@ export declare const _SaasUserDto: z.ZodObject<{
|
|
|
37
46
|
deletedAt: z.ZodNullable<z.ZodString>;
|
|
38
47
|
etag: z.ZodString;
|
|
39
48
|
}, "strip", z.ZodTypeAny, {
|
|
49
|
+
email: string;
|
|
40
50
|
id: string;
|
|
41
51
|
cid: string;
|
|
42
52
|
uid: string;
|
|
43
53
|
createdAt: string;
|
|
44
54
|
updatedAt: string;
|
|
45
55
|
deletedAt: string | null;
|
|
46
|
-
email: string;
|
|
47
56
|
etag: string;
|
|
48
57
|
extId: string;
|
|
49
58
|
meta?: unknown;
|
|
50
59
|
}, {
|
|
60
|
+
email: string;
|
|
51
61
|
id: string;
|
|
52
62
|
cid: string;
|
|
53
63
|
uid: string;
|
|
54
64
|
createdAt: string;
|
|
55
65
|
updatedAt: string;
|
|
56
66
|
deletedAt: string | null;
|
|
57
|
-
email: string;
|
|
58
67
|
etag: string;
|
|
59
68
|
extId: string;
|
|
60
69
|
meta?: unknown;
|
|
@@ -8,6 +8,7 @@ import { AmpSdkSettingsService } from './settings.service';
|
|
|
8
8
|
import { AmpSaaSEntityService, AmpSdkSaasAssetService, AmpSdkSaasComponentService, AmpSdkSaasUserService } from './saasEntity.service';
|
|
9
9
|
import { ContentfulService } from './contentful.service';
|
|
10
10
|
import { FindingsInsightsService } from './findingsInsights.service';
|
|
11
|
+
import { PlatformFlowSpecDto, PlatformFlowSpecUpsertDto, PlatformFlowStateDto, PlatformFlowStateUpsertDto } from '../dto/platform/platform.flows.dto';
|
|
11
12
|
export type AmpSdkOptions = AmpRestClientOptions;
|
|
12
13
|
/**
|
|
13
14
|
* AMP API
|
|
@@ -26,6 +27,8 @@ export declare class AmpSdkServices {
|
|
|
26
27
|
readonly enums: EnumService;
|
|
27
28
|
readonly findings: AmpSaaSEntityService<PlatformFindingUpsertDto, PlatformFindingDto>;
|
|
28
29
|
readonly findingsInsights: FindingsInsightsService;
|
|
30
|
+
readonly flowSpecs: AmpSaaSEntityService<PlatformFlowSpecUpsertDto, PlatformFlowSpecDto>;
|
|
31
|
+
readonly flowStates: AmpSaaSEntityService<PlatformFlowStateUpsertDto, PlatformFlowStateDto>;
|
|
29
32
|
readonly jobExecutions: AmpEntityService<PlatformJobExecutionStateUpsertDto, PlatformJobExecutionStateDto>;
|
|
30
33
|
readonly jobs: AmpEntityService<PlatformJobSpecUpsertDto, PlatformJobSpecDto>;
|
|
31
34
|
readonly notifications: AmpEntityService<PlatformNotificationUpsertDto, PlatformNotificationDto>;
|
|
@@ -27,6 +27,8 @@ class AmpSdkServices {
|
|
|
27
27
|
this.enums = new EnumService_1.DefaultEnumService(rest, constants_1.TARGET_API_PLATFORM);
|
|
28
28
|
this.findings = new saasEntity_service_1.AmpSaaSEntityServiceImpl(rest, constants_1.KIND.FINDINGS, constants_1.TARGET_API_PLATFORM);
|
|
29
29
|
this.findingsInsights = new findingsInsights_service_1.FindingsInsightsService(rest, constants_1.KIND.FINDINGS_INSIGHTS, constants_1.TARGET_API_PLATFORM);
|
|
30
|
+
this.flowSpecs = new saasEntity_service_1.AmpSaaSEntityServiceImpl(rest, constants_1.KIND.FLOW_SPECS, constants_1.TARGET_API_PLATFORM);
|
|
31
|
+
this.flowStates = new saasEntity_service_1.AmpSaaSEntityServiceImpl(rest, constants_1.KIND.FLOW_STATES, constants_1.TARGET_API_PLATFORM);
|
|
30
32
|
this.jobExecutions = new entity_service_1.AmpEntityServiceImpl(rest, constants_1.KIND.JOB_EXECUTIONS, constants_1.TARGET_API_PLATFORM);
|
|
31
33
|
this.jobs = new entity_service_1.AmpEntityServiceImpl(rest, constants_1.KIND.JOB_SPEC, constants_1.TARGET_API_PLATFORM);
|
|
32
34
|
this.notifications = new entity_service_1.AmpEntityServiceImpl(rest, constants_1.KIND.NOTIFICATIONS, constants_1.TARGET_API_PLATFORM);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AmpSdk.js","sourceRoot":"","sources":["../../../src/services/AmpSdk.ts"],"names":[],"mappings":";;;AAoBA,qDAAoI;AACpI,iCAA0E;AAC1E,2CAAsD;AAGtD,oDAAmE;AACnE,yDAAyD;AACzD,6DAA+J;AAC/J,6DAAuD;AACvD,yEAAmE;
|
|
1
|
+
{"version":3,"file":"AmpSdk.js","sourceRoot":"","sources":["../../../src/services/AmpSdk.ts"],"names":[],"mappings":";;;AAoBA,qDAAoI;AACpI,iCAA0E;AAC1E,2CAAsD;AAGtD,oDAAmE;AACnE,yDAAyD;AACzD,6DAA+J;AAC/J,6DAAuD;AACvD,yEAAmE;AAKnE;;;;;;;;GAQG;AACH,MAAa,cAAc;IAwBzB,YAAY,IAAgB;QAC1B,IAAI,CAAC,MAAM,GAAG,IAAI,qCAAoB,CAA2C,IAAI,EAAE,gBAAI,CAAC,MAAM,EAAE,+BAAmB,CAAC,CAAC;QACzH,IAAI,CAAC,KAAK,GAAG,IAAI,mCAAkB,CAAC,IAAI,EAAE,+BAAmB,CAAC,CAAC;QAC/D,IAAI,CAAC,UAAU,GAAG,IAAI,qCAAoB,CAAmD,IAAI,EAAE,gBAAI,CAAC,UAAU,EAAE,+BAAmB,CAAC,CAAC;QACzI,IAAI,CAAC,UAAU,GAAG,IAAI,sCAAiB,EAAE,CAAC;QAC1C,IAAI,CAAC,KAAK,GAAG,IAAI,gCAAkB,CAAC,IAAI,EAAE,+BAAmB,CAAC,CAAC;QAC/D,IAAI,CAAC,QAAQ,GAAG,IAAI,6CAAwB,CAA+C,IAAI,EAAE,gBAAI,CAAC,QAAQ,EAAE,+BAAmB,CAA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,EAAE,+BAAmB,CAAC,CAAC;QACtE,IAAI,CAAC,QAAQ,GAAG,IAAI,wCAAqB,CAAC,IAAI,CAAC,CAAC;QAChD,IAAI,CAAC,OAAO,GAAG,IAAI,qCAAoB,CAA6B,IAAI,EAAE,gBAAI,CAAC,OAAO,EAAE,+BAAmB,CAAC,CAAC;QAC7G,IAAI,CAAC,KAAK,GAAG,IAAI,kCAAiB,CAAC,IAAI,EAAE,+BAAmB,CAAC,CAAC;QAC9D,IAAI,CAAC,iBAAiB,GAAG,IAAI,qCAAoB,CAAiE,IAAI,EAAE,gBAAI,CAAC,iBAAiB,EAAE,+BAAmB,CAAC,CAAC;IACvK,CAAC;IAED,MAAM,CAAC,QAAQ,CAAC,OAAsB;QACpC,MAAM,IAAI,GAAG,IAAA,uBAAgB,EAAC,OAAO,CAAC,CAAC;QACvC,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;CACF;AArDD,wCAqDC"}
|
|
@@ -14,6 +14,8 @@ exports.KIND = {
|
|
|
14
14
|
ENUM_TITLES: 'titles',
|
|
15
15
|
FINDINGS: 'findings',
|
|
16
16
|
FINDINGS_INSIGHTS: 'findings_insights',
|
|
17
|
+
FLOW_SPECS: 'flow_specs',
|
|
18
|
+
FLOW_STATES: 'flow_states',
|
|
17
19
|
JOB_EXECUTIONS: 'job_executions',
|
|
18
20
|
JOB_SPEC: 'jobs',
|
|
19
21
|
NOTIFICATIONS: 'notifications',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/services/constants.ts"],"names":[],"mappings":";;;AAIa,QAAA,2BAA2B,GAAG,CAAC,CAAC;AAGhC,QAAA,mBAAmB,GAAc,UAAU,CAAC;AAC5C,QAAA,gBAAgB,GAAc,KAAK,CAAC;AACpC,QAAA,iBAAiB,GAAc,KAAK,CAAC;AAErC,QAAA,IAAI,GAAG;IAClB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,Q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AAY;IACxB,gBAAgB,EAAE,aAAa;IAC/B,kBAAkB,EAAE,eAAe;IACnC,WAAW,EAAE,QAAQ;IACrB,QAAQ,EAAE,UAAU;IACpB,iBAAiB,EAAE,mBAAmB;IACtC,UAAU,EAAE,YAAY;IACxB,WAAW,EAAE,aAAa;IAC1B,cAAc,EAAE,gBAAgB;IAChC,QAAQ,EAAE,MAAM;IAChB,aAAa,EAAE,eAAe;IAC9B,SAAS,EAAE,WAAW;IACtB,cAAc,EAAE,gBAAgB;IAChC,iBAAiB,EAAE,mBAAmB;IACtC,WAAW,EAAE,aAAa;IAC1B,eAAe,EAAE,iBAAiB;IAClC,UAAU,EAAE,YAAY;IACxB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;IACd,cAAc,EAAE,UAAU;IAC1B,iBAAiB,EAAE,mBAAmB;CACvC,CAAC;AAEW,QAAA,OAAO,GAAG;IACrB,YAAY,EAAE,cAAc;IAC5B,yBAAyB,EAAE,qCAAqC;IAChE,yBAAyB,EAAE,qCAAqC;IAChE,gBAAgB,EAAE,kBAAkB;IACpC,iBAAiB,EAAE,mBAAmB;IACtC,qBAAqB,EAAE,uBAAuB;IAC9C,2BAA2B,EAAE,6BAA6B;IAC1D,YAAY,EAAE,0BAA0B;IACxC,qBAAqB,EAAE,uBAAuB;IAC9C,gBAAgB,EAAE,kBAAkB;IACpC,WAAW,EAAE,aAAa;IAC1B,mBAAmB;IACnB,kBAAkB,EAAE,sBAAsB;CAC3C,CAAC"}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
export declare const genAmpId: (length?: number) => string;
|
|
2
|
+
export declare const genShortAmpId: () => string;
|
|
3
|
+
export declare const genLongAmpId: () => string;
|
|
1
4
|
export declare function formatMacAddress(raw: string): string;
|
|
2
5
|
export type AssetDisplayValueMeta = {
|
|
3
6
|
name: string;
|
|
@@ -3,8 +3,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.parseAssetDisplayValue = exports.formatMacAddress = void 0;
|
|
6
|
+
exports.parseAssetDisplayValue = exports.formatMacAddress = exports.genLongAmpId = exports.genShortAmpId = exports.genAmpId = void 0;
|
|
7
7
|
const lodash_1 = __importDefault(require("lodash"));
|
|
8
|
+
const nanoid_1 = require("nanoid");
|
|
9
|
+
const alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
|
|
10
|
+
const idGenerator = (0, nanoid_1.customAlphabet)(alphabet, 12);
|
|
11
|
+
const genAmpId = (length = 12) => {
|
|
12
|
+
return idGenerator(length);
|
|
13
|
+
};
|
|
14
|
+
exports.genAmpId = genAmpId;
|
|
15
|
+
const genShortAmpId = () => {
|
|
16
|
+
return (0, exports.genAmpId)(6);
|
|
17
|
+
};
|
|
18
|
+
exports.genShortAmpId = genShortAmpId;
|
|
19
|
+
const genLongAmpId = () => {
|
|
20
|
+
return (0, exports.genAmpId)(32);
|
|
21
|
+
};
|
|
22
|
+
exports.genLongAmpId = genLongAmpId;
|
|
8
23
|
function formatMacAddress(raw) {
|
|
9
24
|
const lower = raw.toLowerCase().replace(/[^a-f0-9]/g, '');
|
|
10
25
|
return lodash_1.default.chunk(lower.split(''), 2)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/services/utils.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/services/utils.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AACvB,mCAAsC;AAEtC,MAAM,QAAQ,GAAG,gEAAgE,CAAC;AAClF,MAAM,WAAW,GAAG,IAAA,uBAAc,EAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;AAE1C,MAAM,QAAQ,GAAG,CAAC,MA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
"name": "@ampsec/platform-client",
|
|
3
|
-
"version": "58.
|
|
3
|
+
"version": "58.11.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"runkitExampleFilename": "example/main.js",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"immutable": "^5.0.0-beta.4",
|
|
29
29
|
"lodash": "^4.17.21",
|
|
30
30
|
"lodash.omit": "^4.5.0",
|
|
31
|
+
"nanoid": "^3.3.6",
|
|
31
32
|
"qs": "^6.11.2",
|
|
32
33
|
"zod": "^3.22.4"
|
|
33
34
|
},
|
package/src/FilterCriteria.ts
CHANGED
|
@@ -1,47 +1,112 @@
|
|
|
1
|
-
|
|
2
|
-
type OptionalNumberValue = number | null;
|
|
1
|
+
import {z} from 'zod';
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
$
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
$
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
$
|
|
17
|
-
$
|
|
18
|
-
$
|
|
19
|
-
$
|
|
20
|
-
$
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
$
|
|
24
|
-
$
|
|
25
|
-
$
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
$
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
$
|
|
34
|
-
$
|
|
35
|
-
$
|
|
36
|
-
$
|
|
37
|
-
$
|
|
38
|
-
|
|
39
|
-
|
|
3
|
+
const _OptionalStringValue = z.string().nullable();
|
|
4
|
+
const _OptionalNumberValue = z.number().nullable();
|
|
5
|
+
|
|
6
|
+
export const _IdMatcher = z.object({
|
|
7
|
+
$eq: _OptionalStringValue.optional(),
|
|
8
|
+
$ne: _OptionalStringValue.optional(),
|
|
9
|
+
$in: z.array(_OptionalStringValue).optional(),
|
|
10
|
+
$nin: z.array(_OptionalStringValue).optional(),
|
|
11
|
+
});
|
|
12
|
+
export type IdMatcher = z.infer<typeof _IdMatcher>;
|
|
13
|
+
|
|
14
|
+
export const _StringMatcher = z.object({
|
|
15
|
+
$eq: _OptionalStringValue.optional(),
|
|
16
|
+
$neq: _OptionalStringValue.optional(),
|
|
17
|
+
$lt: z.string().optional(),
|
|
18
|
+
$gt: z.string().optional(),
|
|
19
|
+
$lte: z.string().optional(),
|
|
20
|
+
$gte: z.string().optional(),
|
|
21
|
+
$like: z.string().optional(),
|
|
22
|
+
$nlike: z.string().optional(),
|
|
23
|
+
$in: z.array(_OptionalStringValue).optional(),
|
|
24
|
+
$nin: z.array(_OptionalStringValue).optional(),
|
|
25
|
+
});
|
|
26
|
+
export type StringMatcher = z.infer<typeof _StringMatcher>;
|
|
27
|
+
|
|
28
|
+
export const _NumberMatcher = z.object({
|
|
29
|
+
$eq: _OptionalNumberValue.optional(),
|
|
30
|
+
$neq: _OptionalNumberValue.optional(),
|
|
31
|
+
$lt: z.number().optional(),
|
|
32
|
+
$gt: z.number().optional(),
|
|
33
|
+
$lte: z.number().optional(),
|
|
34
|
+
$gte: z.number().optional(),
|
|
35
|
+
$in: z.array(_OptionalNumberValue).optional(),
|
|
36
|
+
$nin: z.array(_OptionalNumberValue).optional(),
|
|
37
|
+
});
|
|
38
|
+
export type NumberMatcher = z.infer<typeof _NumberMatcher>;
|
|
39
|
+
|
|
40
|
+
export const _DateMatcher = z.object({
|
|
41
|
+
$eq: _OptionalStringValue.optional(),
|
|
42
|
+
$neq: _OptionalStringValue.optional(),
|
|
43
|
+
$lt: z.string().optional(),
|
|
44
|
+
$gt: z.string().optional(),
|
|
45
|
+
$lte: z.string().optional(),
|
|
46
|
+
$gte: z.string().optional(),
|
|
47
|
+
});
|
|
48
|
+
export type DateMatcher = z.infer<typeof _DateMatcher>;
|
|
40
49
|
|
|
41
50
|
export type SortOptions = {
|
|
42
51
|
[key: string]: 'ASC' | 'DESC';
|
|
43
52
|
};
|
|
44
53
|
|
|
54
|
+
export const _PaginationFilter = z.object({
|
|
55
|
+
limit: z.number().int().min(1).optional(),
|
|
56
|
+
offset: z.number().int().min(0).optional(),
|
|
57
|
+
});
|
|
58
|
+
export type PaginationFilter = z.infer<typeof _PaginationFilter>;
|
|
59
|
+
|
|
60
|
+
export const _SortFilter = z.object({
|
|
61
|
+
sort: z.record(z.enum(['ASC', 'DESC'])).optional(),
|
|
62
|
+
});
|
|
63
|
+
export type SortFilter = z.infer<typeof _SortFilter>;
|
|
64
|
+
|
|
65
|
+
export const _BaseFilter = _PaginationFilter.merge(_SortFilter);
|
|
66
|
+
export type BaseFilter = z.infer<typeof _BaseFilter>;
|
|
67
|
+
|
|
68
|
+
export const _FilterCriteria = _BaseFilter
|
|
69
|
+
.merge(
|
|
70
|
+
z.object({
|
|
71
|
+
/** Entity ID */
|
|
72
|
+
id: _IdMatcher.optional(),
|
|
73
|
+
/** Tenant ID */
|
|
74
|
+
tid: _IdMatcher.optional(),
|
|
75
|
+
/** Connector ID */
|
|
76
|
+
cid: _IdMatcher.optional(),
|
|
77
|
+
/** Organization name. Defaults to `*` which matches all organizations. */
|
|
78
|
+
organization: z.string().optional(),
|
|
79
|
+
/** Department name. Defaults to `*` which matches all departments. */
|
|
80
|
+
department: z.string().optional(),
|
|
81
|
+
/** User ID */
|
|
82
|
+
uid: _IdMatcher.optional(),
|
|
83
|
+
/** Asset ID */
|
|
84
|
+
aid: _IdMatcher.optional(),
|
|
85
|
+
/** Created at Date */
|
|
86
|
+
createdAt: _DateMatcher.optional(),
|
|
87
|
+
/** Updated at Date */
|
|
88
|
+
updatedAt: _DateMatcher.optional(),
|
|
89
|
+
/** Deleted at Date. `null` if not deleted */
|
|
90
|
+
deletedAt: _DateMatcher.optional(),
|
|
91
|
+
})
|
|
92
|
+
)
|
|
93
|
+
.catchall(
|
|
94
|
+
z.record(
|
|
95
|
+
z.union([
|
|
96
|
+
z.string(),
|
|
97
|
+
z.array(z.string()), //
|
|
98
|
+
_StringMatcher,
|
|
99
|
+
z.number(),
|
|
100
|
+
_NumberMatcher,
|
|
101
|
+
z.boolean(),
|
|
102
|
+
z.null(),
|
|
103
|
+
z.undefined(),
|
|
104
|
+
_SortFilter,
|
|
105
|
+
])
|
|
106
|
+
)
|
|
107
|
+
);
|
|
108
|
+
export type FilterCriteria2 = z.infer<typeof _FilterCriteria>;
|
|
109
|
+
|
|
45
110
|
export type FilterCriteria = {
|
|
46
111
|
/** Number of records to return. */
|
|
47
112
|
limit?: number;
|
|
@@ -70,5 +135,5 @@ export type FilterCriteria = {
|
|
|
70
135
|
/** Deleted at Date. `null` if not deleted */
|
|
71
136
|
deletedAt?: DateMatcher | null;
|
|
72
137
|
/** catch all bucket for other fields */
|
|
73
|
-
[key: string]: string | string[] | StringMatcher | number | NumberMatcher | boolean | null | undefined;
|
|
138
|
+
[key: string]: string | string[] | StringMatcher | number | NumberMatcher | boolean | null | undefined | SortOptions;
|
|
74
139
|
};
|
package/src/dto/base.dto.ts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import {z} from 'zod';
|
|
2
2
|
|
|
3
|
-
export const _BaseUpsertDto = z.object({
|
|
4
|
-
id: z.union([z.string(), z.undefined()]).optional(),
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
export type BaseUpsertDto = z.infer<typeof _BaseUpsertDto>;
|
|
8
|
-
|
|
9
3
|
export const _BaseDto = z.object({
|
|
10
4
|
id: z.string(),
|
|
11
5
|
createdAt: z.string(),
|
|
@@ -15,6 +9,10 @@ export const _BaseDto = z.object({
|
|
|
15
9
|
|
|
16
10
|
export type BaseDto = z.infer<typeof _BaseDto>;
|
|
17
11
|
|
|
12
|
+
export const _BaseUpsertDto = _BaseDto.partial();
|
|
13
|
+
|
|
14
|
+
export type BaseUpsertDto = z.infer<typeof _BaseUpsertDto>;
|
|
15
|
+
|
|
18
16
|
const WithEtag = z.object({etag: z.string()});
|
|
19
17
|
|
|
20
18
|
export const _ChangeAwareUpsertDto = _BaseUpsertDto.merge(WithEtag);
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import {z} from 'zod';
|
|
2
|
+
import {_BaseDto, _BaseUpsertDto} from './base.dto';
|
|
3
|
+
import {_PaginationFilter, _SortFilter} from '../FilterCriteria';
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* /============================\
|
|
7
|
+
* | Events + History |
|
|
8
|
+
* \============================/
|
|
9
|
+
*/
|
|
10
|
+
export const _FlowTriggerEventDto = z.object({
|
|
11
|
+
kind: z.string(),
|
|
12
|
+
tid: z.string(),
|
|
13
|
+
correlationId: z.string().optional(),
|
|
14
|
+
fid: z.string().optional(),
|
|
15
|
+
user: z
|
|
16
|
+
.object({
|
|
17
|
+
uid: z.string().optional(),
|
|
18
|
+
email: z.string().optional(),
|
|
19
|
+
})
|
|
20
|
+
.optional(),
|
|
21
|
+
device: z
|
|
22
|
+
.object({
|
|
23
|
+
aid: z.string().optional(),
|
|
24
|
+
sn: z.string().optional(),
|
|
25
|
+
mac: z.string().optional(),
|
|
26
|
+
})
|
|
27
|
+
.optional(),
|
|
28
|
+
payload: z.unknown().optional(),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export type FlowTriggerEventDto = z.infer<typeof _FlowTriggerEventDto>;
|
|
32
|
+
|
|
33
|
+
export const _FlowSystemEventDto = z.object({
|
|
34
|
+
type: z.string(),
|
|
35
|
+
flowId: z.string(),
|
|
36
|
+
correlationId: z.string().optional(),
|
|
37
|
+
payload: z.unknown().optional(),
|
|
38
|
+
error: z.unknown().optional(),
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export type FlowSystemEventDto = z.infer<typeof _FlowSystemEventDto>;
|
|
42
|
+
|
|
43
|
+
export const _FlowHistoryEntry = z.object({
|
|
44
|
+
nodeName: z.string(),
|
|
45
|
+
ts: z.number(),
|
|
46
|
+
e: _FlowTriggerEventDto.merge(_FlowSystemEventDto).partial(),
|
|
47
|
+
});
|
|
48
|
+
export type FlowHistoryEvent = z.infer<typeof _FlowHistoryEntry>;
|
|
49
|
+
|
|
50
|
+
/*
|
|
51
|
+
* /=====================\
|
|
52
|
+
* | FlowState |
|
|
53
|
+
* \=====================/
|
|
54
|
+
*/
|
|
55
|
+
export const _FlowStateStatusDto = z.enum(['RUNNING', 'ERROR', 'SUCCESS', 'CANCELLED', 'EXPIRED']);
|
|
56
|
+
export type FlowStateStatusDto = z.infer<typeof _FlowStateStatusDto>;
|
|
57
|
+
|
|
58
|
+
export const _FlowStateDto = _BaseDto.extend({
|
|
59
|
+
specId: z.string(),
|
|
60
|
+
uid: z.string().optional(),
|
|
61
|
+
fid: z.string().optional(),
|
|
62
|
+
status: _FlowStateStatusDto,
|
|
63
|
+
nodeName: z.string(),
|
|
64
|
+
totalSteps: z.number(),
|
|
65
|
+
currentStep: z.number(),
|
|
66
|
+
endTime: z.string().nullable(),
|
|
67
|
+
history: z.array(_FlowHistoryEntry),
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
export type FlowStateDto = z.infer<typeof _FlowStateDto>;
|
|
71
|
+
|
|
72
|
+
export const _FlowStateUpsertDto = _FlowStateDto.merge(_BaseUpsertDto);
|
|
73
|
+
export type FlowStateUpsertDto = z.infer<typeof _FlowStateUpsertDto>;
|
|
74
|
+
|
|
75
|
+
export const _FlowStateFilter = _FlowStateDto.omit({history: true}).partial().merge(_PaginationFilter).merge(_SortFilter);
|
|
76
|
+
export type FlowStateFilter = z.infer<typeof _FlowStateFilter>;
|
|
77
|
+
|
|
78
|
+
/*
|
|
79
|
+
* /====================\
|
|
80
|
+
* | FlowSpec |
|
|
81
|
+
* \====================/
|
|
82
|
+
*/
|
|
83
|
+
export const _FlowSpecDto = _BaseDto.merge(
|
|
84
|
+
z.object({
|
|
85
|
+
id: z.string(),
|
|
86
|
+
tid: z.string().optional(),
|
|
87
|
+
name: z.string(),
|
|
88
|
+
fslStrategy: z.enum(['STANDARD']),
|
|
89
|
+
triggerFilter: z.object({
|
|
90
|
+
trigger: z.string(),
|
|
91
|
+
custom: z.record(z.unknown()).optional(),
|
|
92
|
+
}),
|
|
93
|
+
/** cohort filter */
|
|
94
|
+
filter: z.object({
|
|
95
|
+
cohorts: z.unknown().optional(),
|
|
96
|
+
custom: z.record(z.unknown()).optional(),
|
|
97
|
+
}),
|
|
98
|
+
})
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
export type FlowSpecDto = z.infer<typeof _FlowSpecDto>;
|
|
102
|
+
|
|
103
|
+
export const _FlowSpecUpsertDto = _FlowSpecDto.merge(_BaseUpsertDto);
|
|
104
|
+
export type FlowSpecUpsertDto = z.infer<typeof _FlowSpecUpsertDto>;
|
|
105
|
+
|
|
106
|
+
export const _FlowSpecFilter = _FlowSpecDto.omit({triggerFilter: true, filter: true}).partial().merge(_PaginationFilter).merge(_SortFilter);
|
|
107
|
+
export type FlowSpecFilter = z.infer<typeof _FlowSpecFilter>;
|
package/src/dto/index.ts
CHANGED
|
@@ -12,6 +12,7 @@ export * from './enums';
|
|
|
12
12
|
export * from './extKeyMap.dto';
|
|
13
13
|
export * from './findings.dto';
|
|
14
14
|
export * from './findingsInsights.dto';
|
|
15
|
+
export * from './flows.dto';
|
|
15
16
|
export * from './jwt';
|
|
16
17
|
export * from './message.dto';
|
|
17
18
|
export * from './notification.dto';
|
|
@@ -3,6 +3,7 @@ export * from './platform.assets.dto';
|
|
|
3
3
|
export * from './platform.connectors.dto';
|
|
4
4
|
export * from './platform.findingsInsights.dto';
|
|
5
5
|
export * from './platform.findings.dto';
|
|
6
|
+
export * from './platform.flows.dto';
|
|
6
7
|
export * from './platform.jobExecutionState.dto';
|
|
7
8
|
export * from './platform.jobSpec.dto';
|
|
8
9
|
export * from './platform.notification.dto';
|