@ampsec/platform-client 58.9.2 → 58.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/build/src/FilterCriteria.d.ts +795 -40
  2. package/build/src/FilterCriteria.js +82 -0
  3. package/build/src/FilterCriteria.js.map +1 -1
  4. package/build/src/dto/assets.dto.d.ts +10 -1
  5. package/build/src/dto/base.dto.d.ts +27 -9
  6. package/build/src/dto/base.dto.js +2 -4
  7. package/build/src/dto/base.dto.js.map +1 -1
  8. package/build/src/dto/coverage.dto.d.ts +11 -11
  9. package/build/src/dto/flows.dto.d.ts +819 -0
  10. package/build/src/dto/flows.dto.js +85 -0
  11. package/build/src/dto/flows.dto.js.map +1 -0
  12. package/build/src/dto/index.d.ts +1 -0
  13. package/build/src/dto/index.js +1 -0
  14. package/build/src/dto/index.js.map +1 -1
  15. package/build/src/dto/platform/index.d.ts +1 -0
  16. package/build/src/dto/platform/index.js +1 -0
  17. package/build/src/dto/platform/index.js.map +1 -1
  18. package/build/src/dto/platform/platform.flows.dto.d.ts +540 -0
  19. package/build/src/dto/platform/platform.flows.dto.js +32 -0
  20. package/build/src/dto/platform/platform.flows.dto.js.map +1 -0
  21. package/build/src/dto/platform/tenant.based.dto.d.ts +40 -8
  22. package/build/src/dto/platform/tenant.based.dto.js +7 -0
  23. package/build/src/dto/platform/tenant.based.dto.js.map +1 -1
  24. package/build/src/dto/saasAssets.dto.d.ts +10 -1
  25. package/build/src/dto/saasUsers.dto.d.ts +15 -6
  26. package/build/src/services/AmpSdk.d.ts +3 -0
  27. package/build/src/services/AmpSdk.js +2 -0
  28. package/build/src/services/AmpSdk.js.map +1 -1
  29. package/build/src/services/constants.d.ts +2 -0
  30. package/build/src/services/constants.js +2 -0
  31. package/build/src/services/constants.js.map +1 -1
  32. package/build/src/services/utils.d.ts +3 -0
  33. package/build/src/services/utils.js +16 -1
  34. package/build/src/services/utils.js.map +1 -1
  35. package/package.json +2 -1
  36. package/src/FilterCriteria.ts +104 -39
  37. package/src/dto/base.dto.ts +4 -6
  38. package/src/dto/flows.dto.ts +107 -0
  39. package/src/dto/index.ts +1 -0
  40. package/src/dto/platform/index.ts +1 -0
  41. package/src/dto/platform/platform.flows.dto.ts +38 -0
  42. package/src/dto/platform/tenant.based.dto.ts +8 -9
  43. package/src/services/AmpSdk.ts +5 -0
  44. package/src/services/constants.ts +2 -0
  45. package/src/services/utils.ts +16 -0
@@ -0,0 +1,38 @@
1
+ import {z} from 'zod';
2
+ import {_FlowSpecDto, _FlowSpecUpsertDto, _FlowStateDto, _FlowStateUpsertDto} from '../flows.dto';
3
+ import {_TenantBased, _UpsertTenantBased} from './tenant.based.dto';
4
+
5
+ /*
6
+ * /====================\
7
+ * | FlowSpec |
8
+ * \====================/
9
+ */
10
+ export const _PlatformFlowSpecUpsertDto = _FlowSpecUpsertDto;
11
+ export type PlatformFlowSpecUpsertDto = z.infer<typeof _PlatformFlowSpecUpsertDto>;
12
+
13
+ export const _PlatformFlowSpecDto = _FlowSpecDto;
14
+ export type PlatformFlowSpecDto = z.infer<typeof _PlatformFlowSpecDto>;
15
+
16
+ /*
17
+ * /=====================\
18
+ * | FlowState |
19
+ * \=====================/
20
+ */
21
+ export const _PlatformFlowStateUpsertDto = _FlowStateUpsertDto.merge(_UpsertTenantBased);
22
+ export type PlatformFlowStateUpsertDto = z.infer<typeof _PlatformFlowStateUpsertDto>;
23
+
24
+ export const _PlatformFlowStateDto = _FlowStateDto.merge(_TenantBased);
25
+ export type PlatformFlowStateDto = z.infer<typeof _PlatformFlowStateDto>;
26
+
27
+ export const NOOP_FLOW_SPEC: PlatformFlowSpecDto = {
28
+ id: '000000000000',
29
+ createdAt: '2023-04-17T13:00:00.000Z',
30
+ updatedAt: '2023-04-17T13:00:00.000Z',
31
+ deletedAt: null,
32
+ name: 'NOOP - DROP TRIGGER EVENT',
33
+ fslStrategy: 'STANDARD',
34
+ triggerFilter: {
35
+ trigger: 'noop',
36
+ },
37
+ filter: {},
38
+ };
@@ -1,11 +1,10 @@
1
- import {BaseDto, BaseUpsertDto} from '../base.dto';
1
+ import {z} from 'zod';
2
+ import {_BaseDto} from '../base.dto';
2
3
 
3
- export type UpsertTenantBased = BaseUpsertDto & {
4
- /** Tenant Id */
5
- tid?: string;
6
- };
4
+ export const _TenantBased = _BaseDto.extend({
5
+ tid: z.string(),
6
+ });
7
+ export type TenantBased = z.infer<typeof _TenantBased>;
7
8
 
8
- export type TenantBased = BaseDto & {
9
- /** Tenant Id */
10
- tid: string;
11
- };
9
+ export const _UpsertTenantBased = _TenantBased.partial();
10
+ export type UpsertTenantBased = z.infer<typeof _UpsertTenantBased>;
@@ -28,6 +28,7 @@ import {AmpSdkSettingsService} from './settings.service';
28
28
  import {AmpSaaSEntityService, AmpSaaSEntityServiceImpl, AmpSdkSaasAssetService, AmpSdkSaasComponentService, AmpSdkSaasUserService} from './saasEntity.service';
29
29
  import {ContentfulService} from './contentful.service';
30
30
  import {FindingsInsightsService} from './findingsInsights.service';
31
+ import {PlatformFlowSpecDto, PlatformFlowSpecUpsertDto, PlatformFlowStateDto, PlatformFlowStateUpsertDto} from '../dto/platform/platform.flows.dto';
31
32
 
32
33
  export type AmpSdkOptions = AmpRestClientOptions;
33
34
 
@@ -48,6 +49,8 @@ export class AmpSdkServices {
48
49
  readonly enums: EnumService;
49
50
  readonly findings: AmpSaaSEntityService<PlatformFindingUpsertDto, PlatformFindingDto>;
50
51
  readonly findingsInsights: FindingsInsightsService;
52
+ readonly flowSpecs: AmpSaaSEntityService<PlatformFlowSpecUpsertDto, PlatformFlowSpecDto>;
53
+ readonly flowStates: AmpSaaSEntityService<PlatformFlowStateUpsertDto, PlatformFlowStateDto>;
51
54
  readonly jobExecutions: AmpEntityService<PlatformJobExecutionStateUpsertDto, PlatformJobExecutionStateDto>;
52
55
  readonly jobs: AmpEntityService<PlatformJobSpecUpsertDto, PlatformJobSpecDto>;
53
56
  readonly notifications: AmpEntityService<PlatformNotificationUpsertDto, PlatformNotificationDto>;
@@ -70,6 +73,8 @@ export class AmpSdkServices {
70
73
  this.enums = new DefaultEnumService(rest, TARGET_API_PLATFORM);
71
74
  this.findings = new AmpSaaSEntityServiceImpl<PlatformFindingUpsertDto, PlatformFindingDto>(rest, KIND.FINDINGS, TARGET_API_PLATFORM);
72
75
  this.findingsInsights = new FindingsInsightsService(rest, KIND.FINDINGS_INSIGHTS, TARGET_API_PLATFORM);
76
+ this.flowSpecs = new AmpSaaSEntityServiceImpl<PlatformFlowSpecUpsertDto, PlatformFlowSpecDto>(rest, KIND.FLOW_SPECS, TARGET_API_PLATFORM);
77
+ this.flowStates = new AmpSaaSEntityServiceImpl<PlatformFlowStateUpsertDto, PlatformFlowStateDto>(rest, KIND.FLOW_STATES, TARGET_API_PLATFORM);
73
78
  this.jobExecutions = new AmpEntityServiceImpl<PlatformJobExecutionStateUpsertDto, PlatformJobExecutionStateDto>(rest, KIND.JOB_EXECUTIONS, TARGET_API_PLATFORM);
74
79
  this.jobs = new AmpEntityServiceImpl<PlatformJobSpecUpsertDto, PlatformJobSpecDto>(rest, KIND.JOB_SPEC, TARGET_API_PLATFORM);
75
80
  this.notifications = new AmpEntityServiceImpl<PlatformNotificationUpsertDto, PlatformNotificationDto>(rest, KIND.NOTIFICATIONS, TARGET_API_PLATFORM);
@@ -18,6 +18,8 @@ export const KIND = {
18
18
  ENUM_TITLES: 'titles',
19
19
  FINDINGS: 'findings',
20
20
  FINDINGS_INSIGHTS: 'findings_insights',
21
+ FLOW_SPECS: 'flow_specs',
22
+ FLOW_STATES: 'flow_states',
21
23
  JOB_EXECUTIONS: 'job_executions',
22
24
  JOB_SPEC: 'jobs',
23
25
  NOTIFICATIONS: 'notifications',
@@ -1,4 +1,20 @@
1
1
  import _ from 'lodash';
2
+ import {customAlphabet} from 'nanoid';
3
+
4
+ const alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
5
+ const idGenerator = customAlphabet(alphabet, 12);
6
+
7
+ export const genAmpId = (length = 12): string => {
8
+ return idGenerator(length);
9
+ };
10
+
11
+ export const genShortAmpId = (): string => {
12
+ return genAmpId(6);
13
+ };
14
+
15
+ export const genLongAmpId = (): string => {
16
+ return genAmpId(32);
17
+ };
2
18
 
3
19
  export function formatMacAddress(raw: string): string {
4
20
  const lower = raw.toLowerCase().replace(/[^a-f0-9]/g, '');