@ampsec/platform-client 11.0.0 → 11.2.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 (31) hide show
  1. package/build/src/FilterCriteria.d.ts +2 -0
  2. package/build/src/dto/enums/index.d.ts +1 -0
  3. package/build/src/dto/enums/index.js +1 -0
  4. package/build/src/dto/enums/index.js.map +1 -1
  5. package/build/src/dto/enums/jobExecution.status.d.ts +7 -0
  6. package/build/src/dto/enums/jobExecution.status.js +13 -0
  7. package/build/src/dto/enums/jobExecution.status.js.map +1 -0
  8. package/build/src/dto/platform/index.d.ts +2 -0
  9. package/build/src/dto/platform/index.js +2 -0
  10. package/build/src/dto/platform/index.js.map +1 -1
  11. package/build/src/dto/platform/platform.jobExecutionState.dto.d.ts +26 -0
  12. package/build/src/dto/platform/platform.jobExecutionState.dto.js +3 -0
  13. package/build/src/dto/platform/platform.jobExecutionState.dto.js.map +1 -0
  14. package/build/src/dto/platform/platform.jobSpec.dto.d.ts +30 -0
  15. package/build/src/dto/platform/platform.jobSpec.dto.js +3 -0
  16. package/build/src/dto/platform/platform.jobSpec.dto.js.map +1 -0
  17. package/build/src/services/AmpSdk.d.ts +4 -0
  18. package/build/src/services/AmpSdk.js +2 -0
  19. package/build/src/services/AmpSdk.js.map +1 -1
  20. package/build/src/services/constants.d.ts +2 -0
  21. package/build/src/services/constants.js +2 -0
  22. package/build/src/services/constants.js.map +1 -1
  23. package/package.json +1 -1
  24. package/src/FilterCriteria.ts +2 -0
  25. package/src/dto/enums/index.ts +1 -0
  26. package/src/dto/enums/jobExecution.status.ts +8 -0
  27. package/src/dto/platform/index.ts +2 -0
  28. package/src/dto/platform/platform.jobExecutionState.dto.ts +29 -0
  29. package/src/dto/platform/platform.jobSpec.dto.ts +34 -0
  30. package/src/services/AmpSdk.ts +6 -0
  31. package/src/services/constants.ts +2 -0
@@ -15,4 +15,6 @@ export type FilterCriteria = {
15
15
  uid?: string;
16
16
  /** Asset ID */
17
17
  aid?: string;
18
+ /** catch all bucket for other fields */
19
+ [key: string]: string | number | boolean | undefined;
18
20
  };
@@ -2,3 +2,4 @@ export * from './agent.status';
2
2
  export * from './connector.status';
3
3
  export * from './finding.severity';
4
4
  export * from './finding.status';
5
+ export * from './jobExecution.status';
@@ -18,4 +18,5 @@ __exportStar(require("./agent.status"), exports);
18
18
  __exportStar(require("./connector.status"), exports);
19
19
  __exportStar(require("./finding.severity"), exports);
20
20
  __exportStar(require("./finding.status"), exports);
21
+ __exportStar(require("./jobExecution.status"), exports);
21
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/dto/enums/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,qDAAmC;AACnC,qDAAmC;AACnC,mDAAiC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/dto/enums/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,qDAAmC;AACnC,qDAAmC;AACnC,mDAAiC;AACjC,wDAAsC"}
@@ -0,0 +1,7 @@
1
+ export declare enum JobExecutionStatus {
2
+ SCHEDULED = "SCHEDULED",
3
+ PAUSED = "PAUSED",
4
+ RUNNING = "RUNNING",
5
+ FAILED = "FAILED",
6
+ SUCCEEDED = "SUCCEEDED"
7
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JobExecutionStatus = void 0;
4
+ /* eslint-disable no-unused-vars */
5
+ var JobExecutionStatus;
6
+ (function (JobExecutionStatus) {
7
+ JobExecutionStatus["SCHEDULED"] = "SCHEDULED";
8
+ JobExecutionStatus["PAUSED"] = "PAUSED";
9
+ JobExecutionStatus["RUNNING"] = "RUNNING";
10
+ JobExecutionStatus["FAILED"] = "FAILED";
11
+ JobExecutionStatus["SUCCEEDED"] = "SUCCEEDED";
12
+ })(JobExecutionStatus = exports.JobExecutionStatus || (exports.JobExecutionStatus = {}));
13
+ //# sourceMappingURL=jobExecution.status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jobExecution.status.js","sourceRoot":"","sources":["../../../../src/dto/enums/jobExecution.status.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AACnC,IAAY,kBAMX;AAND,WAAY,kBAAkB;IAC5B,6CAAuB,CAAA;IACvB,uCAAiB,CAAA;IACjB,yCAAmB,CAAA;IACnB,uCAAiB,CAAA;IACjB,6CAAuB,CAAA;AACzB,CAAC,EANW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAM7B"}
@@ -2,6 +2,8 @@ export * from './platform.agents.dto';
2
2
  export * from './platform.assets.dto';
3
3
  export * from './platform.connectors.dto';
4
4
  export * from './platform.findings.dto';
5
+ export * from './platform.jobExecutionState.dto';
6
+ export * from './platform.jobSpec.dto';
5
7
  export * from './platform.providers.dto';
6
8
  export * from './platform.reportResults.dto';
7
9
  export * from './platform.saasAssets.dto';
@@ -18,6 +18,8 @@ __exportStar(require("./platform.agents.dto"), exports);
18
18
  __exportStar(require("./platform.assets.dto"), exports);
19
19
  __exportStar(require("./platform.connectors.dto"), exports);
20
20
  __exportStar(require("./platform.findings.dto"), exports);
21
+ __exportStar(require("./platform.jobExecutionState.dto"), exports);
22
+ __exportStar(require("./platform.jobSpec.dto"), exports);
21
23
  __exportStar(require("./platform.providers.dto"), exports);
22
24
  __exportStar(require("./platform.reportResults.dto"), exports);
23
25
  __exportStar(require("./platform.saasAssets.dto"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/dto/platform/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC;AACtC,wDAAsC;AACtC,4DAA0C;AAC1C,0DAAwC;AACxC,2DAAyC;AACzC,+DAA6C;AAC7C,4DAA0C;AAC1C,gEAA8C;AAC9C,2DAAyC;AACzC,yDAAuC;AACvC,uDAAqC;AACrC,qDAAmC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/dto/platform/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC;AACtC,wDAAsC;AACtC,4DAA0C;AAC1C,0DAAwC;AACxC,mEAAiD;AACjD,yDAAuC;AACvC,2DAAyC;AACzC,+DAA6C;AAC7C,4DAA0C;AAC1C,gEAA8C;AAC9C,2DAAyC;AACzC,yDAAuC;AACvC,uDAAqC;AACrC,qDAAmC"}
@@ -0,0 +1,26 @@
1
+ import { BaseDto, BaseUpsertDto } from '../base.dto';
2
+ import { JobExecutionStatus } from '../enums/jobExecution.status';
3
+ import { TenantBased, UpsertTenantBased } from './tenant.based.dto';
4
+ export type JobExecutionPagination = {
5
+ /** Expected number of object to process for whole job. */
6
+ expected: number;
7
+ /** Total number of object that have already been processed. */
8
+ processed: number;
9
+ };
10
+ export type PlatformJobExecutionStateUpsertDto = BaseUpsertDto & {
11
+ /** `JobSpecification` ID */
12
+ specId: string;
13
+ /** Latest execution status */
14
+ status: JobExecutionStatus;
15
+ /** Date the job execution started */
16
+ startedAt: Date;
17
+ /** Optional date the job execution finished */
18
+ finishedAt: Date | null;
19
+ /** High level indication of progress */
20
+ pagination: JobExecutionPagination;
21
+ /** Optional error message. */
22
+ error: string | null;
23
+ /** Scratch space for job executors to maintain state incase of failure. */
24
+ scratch: unknown;
25
+ } & UpsertTenantBased;
26
+ export type PlatformJobExecutionStateDto = BaseDto & PlatformJobExecutionStateUpsertDto & TenantBased;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=platform.jobExecutionState.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform.jobExecutionState.dto.js","sourceRoot":"","sources":["../../../../src/dto/platform/platform.jobExecutionState.dto.ts"],"names":[],"mappings":""}
@@ -0,0 +1,30 @@
1
+ import { BaseDto, BaseUpsertDto } from '../base.dto';
2
+ import { JobExecutionStatus } from '../enums/jobExecution.status';
3
+ import { TenantBased, UpsertTenantBased } from './tenant.based.dto';
4
+ export type BasicJobSchedule = {
5
+ kind: 'basic';
6
+ offset: number;
7
+ interval: number;
8
+ };
9
+ export type IngestionPipelineContext = {
10
+ kind: 'INGESTION_PIPELINE_CONTEXT';
11
+ cid: string;
12
+ scratch: unknown;
13
+ };
14
+ export type PlatformJobSpecUpsertDto = BaseUpsertDto & {
15
+ /** Human readable name of the Job Specification */
16
+ displayValue: string;
17
+ /** Connector Id */
18
+ cid: string;
19
+ /** Schedule configuration for the job. */
20
+ schedule: BasicJobSchedule;
21
+ /** Context for the job execution, e.g. ingestion pipeline */
22
+ inputContext: IngestionPipelineContext;
23
+ /** Status of the current or latest job execution */
24
+ status: JobExecutionStatus;
25
+ /** Date of the next job execution */
26
+ nextExecutionAt: string;
27
+ /** Optional error message from the latest execution. Expected to be `null` if `status=JobExecutionStatus.SUCCEEDED */
28
+ error: string | null;
29
+ } & UpsertTenantBased;
30
+ export type PlatformJobSpecDto = BaseDto & PlatformJobSpecUpsertDto & TenantBased;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=platform.jobSpec.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform.jobSpec.dto.js","sourceRoot":"","sources":["../../../../src/dto/platform/platform.jobSpec.dto.ts"],"names":[],"mappings":""}
@@ -2,6 +2,8 @@ import { PlatformAgentDto, PlatformAgentUpsertDto, PlatformAssetDto, PlatformAss
2
2
  import { AmpEntityService, AmpGlobalEntityService, AmpSaaSEntityService } from './entity.service';
3
3
  import { AmpDataService } from './data.service';
4
4
  import { AmpRestClientOptions, RestClient } from './rest';
5
+ import { PlatformJobSpecDto, PlatformJobSpecUpsertDto } from '../dto/platform/platform.jobSpec.dto';
6
+ import { PlatformJobExecutionStateDto, PlatformJobExecutionStateUpsertDto } from '../dto/platform/platform.jobExecutionState.dto';
5
7
  export type AmpSdkOptions = AmpRestClientOptions;
6
8
  /**
7
9
  * AMP API
@@ -19,6 +21,8 @@ export declare class AmpSdkServices {
19
21
  readonly asset: AmpGlobalEntityService<PlatformAssetUpsertDto, PlatformAssetDto>;
20
22
  readonly connectors: AmpEntityService<PlatformConnectorUpsertDto, PlatformConnectorDto>;
21
23
  readonly findings: AmpSaaSEntityService<PlatformFindingUpsertDto, PlatformFindingDto>;
24
+ readonly jobExecutions: AmpEntityService<PlatformJobExecutionStateUpsertDto, PlatformJobExecutionStateDto>;
25
+ readonly jobs: AmpEntityService<PlatformJobSpecUpsertDto, PlatformJobSpecDto>;
22
26
  readonly providers: AmpDataService<ProviderDto>;
23
27
  readonly reportResults: AmpSaaSEntityService<PlatformReportResultUpsertDto, PlatformReportResultDto>;
24
28
  readonly saasAssets: AmpSaaSEntityService<PlatformSaasAssetUpsertDto, PlatformSaasAssetDto>;
@@ -22,6 +22,8 @@ class AmpSdkServices {
22
22
  this.asset = new entity_service_1.AmpGlobalEntityServiceImpl(rest, constants_1.KIND.ASSETS, constants_1.TARGET_API_PLATFORM);
23
23
  this.connectors = new entity_service_1.AmpEntityServiceImpl(rest, constants_1.KIND.CONNECTORS, constants_1.TARGET_API_PLATFORM);
24
24
  this.findings = new entity_service_1.AmpSaaSEntityServiceImpl(rest, constants_1.KIND.FINDINGS, constants_1.TARGET_API_PLATFORM);
25
+ this.jobExecutions = new entity_service_1.AmpEntityServiceImpl(rest, constants_1.KIND.JOB_EXECUTIONS, constants_1.TARGET_API_PLATFORM);
26
+ this.jobs = new entity_service_1.AmpEntityServiceImpl(rest, constants_1.KIND.JOB_SPEC, constants_1.TARGET_API_PLATFORM);
25
27
  this.providers = new data_service_1.AmpDataServiceImpl(rest, constants_1.KIND.PROVIDERS, constants_1.TARGET_API_AGENT);
26
28
  this.reportResults = new entity_service_1.AmpSaaSEntityServiceImpl(rest, constants_1.KIND.REPORT_RESULTS, constants_1.TARGET_API_PLATFORM);
27
29
  this.saasAssets = new entity_service_1.AmpSaaSEntityServiceImpl(rest, constants_1.KIND.SAAS_ASSETS, constants_1.TARGET_API_PLATFORM);
@@ -1 +1 @@
1
- {"version":3,"file":"AmpSdk.js","sourceRoot":"","sources":["../../../src/services/AmpSdk.ts"],"names":[],"mappings":";;;AAuBA,qDAA4K;AAC5K,iDAAkE;AAClE,iCAA0E;AAC1E,2CAAwE;AAIxE;;;;;;;;;;GAUG;AACH,MAAa,cAAc;IAazB,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,2CAA0B,CAA2C,IAAI,EAAE,gBAAI,CAAC,MAAM,EAAE,+BAAmB,CAAC,CAAC;QAC9H,IAAI,CAAC,UAAU,GAAG,IAAI,qCAAoB,CAAmD,IAAI,EAAE,gBAAI,CAAC,UAAU,EAAE,+BAAmB,CAAC,CAAC;QACzI,IAAI,CAAC,QAAQ,GAAG,IAAI,yCAAwB,CAA+C,IAAI,EAAE,gBAAI,CAAC,QAAQ,EAAE,+BAAmB,CAAC,CAAC;QACrI,IAAI,CAAC,SAAS,GAAG,IAAI,iCAAkB,CAAc,IAAI,EAAE,gBAAI,CAAC,SAAS,EAAE,4BAAgB,CAAC,CAAC;QAC7F,IAAI,CAAC,aAAa,GAAG,IAAI,yCAAwB,CAAyD,IAAI,EAAE,gBAAI,CAAC,cAAc,EAAE,+BAAmB,CAAC,CAAC;QAC1J,IAAI,CAAC,UAAU,GAAG,IAAI,yCAAwB,CAAmD,IAAI,EAAE,gBAAI,CAAC,WAAW,EAAE,+BAAmB,CAAC,CAAC;QAC9I,IAAI,CAAC,cAAc,GAAG,IAAI,yCAAwB,CAA2D,IAAI,EAAE,gBAAI,CAAC,eAAe,EAAE,+BAAmB,CAAC,CAAC;QAC9J,IAAI,CAAC,SAAS,GAAG,IAAI,yCAAwB,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
14
16
  REPORT_RESULTS: string;
15
17
  SAAS_ASSETS: string;
@@ -9,6 +9,8 @@ exports.KIND = {
9
9
  ASSETS: 'assets',
10
10
  CONNECTORS: 'connectors',
11
11
  FINDINGS: 'findings',
12
+ JOB_EXECUTIONS: 'jobs_executions',
13
+ JOB_SPEC: 'jobs',
12
14
  PROVIDERS: 'providers',
13
15
  REPORT_RESULTS: 'report_results',
14
16
  SAAS_ASSETS: 'saas_assets',
@@ -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;AAEpC,QAAA,IAAI,GAAG;IAClB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,UAAU,EAAE,YAAY;IACxB,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;IACtB,cAAc,EAAE,gBAAgB;IAChC,WAAW,EAAE,aAAa;IAC1B,eAAe,EAAE,iBAAiB;IAClC,UAAU,EAAE,YAAY;IACxB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;CACf,CAAC;AAEW,QAAA,OAAO,GAAG;IACrB,YAAY,EAAE,cAAc;IAC5B,yBAAyB,EAAE,qCAAqC;IAChE,yBAAyB,EAAE,qCAAqC;IAChE,iBAAiB,EAAE,mBAAmB;IACtC,qBAAqB,EAAE,uBAAuB;IAC9C,YAAY,EAAE,0BAA0B;IACxC,qBAAqB,EAAE,uBAAuB;IAC9C,gBAAgB,EAAE,kBAAkB;IACpC,mBAAmB;IACnB,kBAAkB,EAAE,cAAc;CACnC,CAAC"}
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;AAEpC,QAAA,IAAI,GAAG;IAClB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,UAAU,EAAE,YAAY;IACxB,QAAQ,EAAE,UAAU;IACpB,cAAc,EAAE,iBAAiB;IACjC,QAAQ,EAAE,MAAM;IAChB,SAAS,EAAE,WAAW;IACtB,cAAc,EAAE,gBAAgB;IAChC,WAAW,EAAE,aAAa;IAC1B,eAAe,EAAE,iBAAiB;IAClC,UAAU,EAAE,YAAY;IACxB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;CACf,CAAC;AAEW,QAAA,OAAO,GAAG;IACrB,YAAY,EAAE,cAAc;IAC5B,yBAAyB,EAAE,qCAAqC;IAChE,yBAAyB,EAAE,qCAAqC;IAChE,iBAAiB,EAAE,mBAAmB;IACtC,qBAAqB,EAAE,uBAAuB;IAC9C,YAAY,EAAE,0BAA0B;IACxC,qBAAqB,EAAE,uBAAuB;IAC9C,gBAAgB,EAAE,kBAAkB;IACpC,mBAAmB;IACnB,kBAAkB,EAAE,cAAc;CACnC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ampsec/platform-client",
3
- "version": "11.0.0",
3
+ "version": "11.2.0",
4
4
  "description": "",
5
5
  "main": "build/src/index.js",
6
6
  "runkitExampleFilename": "example/main.js",
@@ -15,4 +15,6 @@ export type FilterCriteria = {
15
15
  uid?: string;
16
16
  /** Asset ID */
17
17
  aid?: string;
18
+ /** catch all bucket for other fields */
19
+ [key: string]: string | number | boolean | undefined;
18
20
  };
@@ -2,3 +2,4 @@ export * from './agent.status';
2
2
  export * from './connector.status';
3
3
  export * from './finding.severity';
4
4
  export * from './finding.status';
5
+ export * from './jobExecution.status';
@@ -0,0 +1,8 @@
1
+ /* eslint-disable no-unused-vars */
2
+ export enum JobExecutionStatus {
3
+ SCHEDULED = 'SCHEDULED',
4
+ PAUSED = 'PAUSED',
5
+ RUNNING = 'RUNNING',
6
+ FAILED = 'FAILED',
7
+ SUCCEEDED = 'SUCCEEDED',
8
+ }
@@ -2,6 +2,8 @@ export * from './platform.agents.dto';
2
2
  export * from './platform.assets.dto';
3
3
  export * from './platform.connectors.dto';
4
4
  export * from './platform.findings.dto';
5
+ export * from './platform.jobExecutionState.dto';
6
+ export * from './platform.jobSpec.dto';
5
7
  export * from './platform.providers.dto';
6
8
  export * from './platform.reportResults.dto';
7
9
  export * from './platform.saasAssets.dto';
@@ -0,0 +1,29 @@
1
+ import {BaseDto, BaseUpsertDto} from '../base.dto';
2
+ import {JobExecutionStatus} from '../enums/jobExecution.status';
3
+ import {TenantBased, UpsertTenantBased} from './tenant.based.dto';
4
+
5
+ export type JobExecutionPagination = {
6
+ /** Expected number of object to process for whole job. */
7
+ expected: number;
8
+ /** Total number of object that have already been processed. */
9
+ processed: number;
10
+ };
11
+
12
+ export type PlatformJobExecutionStateUpsertDto = BaseUpsertDto & {
13
+ /** `JobSpecification` ID */
14
+ specId: string;
15
+ /** Latest execution status */
16
+ status: JobExecutionStatus;
17
+ /** Date the job execution started */
18
+ startedAt: Date;
19
+ /** Optional date the job execution finished */
20
+ finishedAt: Date | null;
21
+ /** High level indication of progress */
22
+ pagination: JobExecutionPagination;
23
+ /** Optional error message. */
24
+ error: string | null;
25
+ /** Scratch space for job executors to maintain state incase of failure. */
26
+ scratch: unknown;
27
+ } & UpsertTenantBased;
28
+
29
+ export type PlatformJobExecutionStateDto = BaseDto & PlatformJobExecutionStateUpsertDto & TenantBased;
@@ -0,0 +1,34 @@
1
+ import {BaseDto, BaseUpsertDto} from '../base.dto';
2
+ import {JobExecutionStatus} from '../enums/jobExecution.status';
3
+ import {TenantBased, UpsertTenantBased} from './tenant.based.dto';
4
+
5
+ export type BasicJobSchedule = {
6
+ kind: 'basic';
7
+ offset: number;
8
+ interval: number;
9
+ };
10
+
11
+ export type IngestionPipelineContext = {
12
+ kind: 'INGESTION_PIPELINE_CONTEXT';
13
+ cid: string;
14
+ scratch: unknown;
15
+ };
16
+
17
+ export type PlatformJobSpecUpsertDto = BaseUpsertDto & {
18
+ /** Human readable name of the Job Specification */
19
+ displayValue: string;
20
+ /** Connector Id */
21
+ cid: string;
22
+ /** Schedule configuration for the job. */
23
+ schedule: BasicJobSchedule;
24
+ /** Context for the job execution, e.g. ingestion pipeline */
25
+ inputContext: IngestionPipelineContext;
26
+ /** Status of the current or latest job execution */
27
+ status: JobExecutionStatus;
28
+ /** Date of the next job execution */
29
+ nextExecutionAt: string;
30
+ /** Optional error message from the latest execution. Expected to be `null` if `status=JobExecutionStatus.SUCCEEDED */
31
+ error: string | null;
32
+ } & UpsertTenantBased;
33
+
34
+ export type PlatformJobSpecDto = BaseDto & PlatformJobSpecUpsertDto & TenantBased;
@@ -25,6 +25,8 @@ import {AmpEntityService, AmpEntityServiceImpl, AmpGlobalEntityService, AmpGloba
25
25
  import {AmpDataService, AmpDataServiceImpl} from './data.service';
26
26
  import {AmpRestClientOptions, RestClient, getAmpRestClient} from './rest';
27
27
  import {KIND, TARGET_API_AGENT, TARGET_API_PLATFORM} from './constants';
28
+ import {PlatformJobSpecDto, PlatformJobSpecUpsertDto} from '../dto/platform/platform.jobSpec.dto';
29
+ import {PlatformJobExecutionStateDto, PlatformJobExecutionStateUpsertDto} from '../dto/platform/platform.jobExecutionState.dto';
28
30
 
29
31
  export type AmpSdkOptions = AmpRestClientOptions;
30
32
 
@@ -44,6 +46,8 @@ export class AmpSdkServices {
44
46
  readonly asset: AmpGlobalEntityService<PlatformAssetUpsertDto, PlatformAssetDto>;
45
47
  readonly connectors: AmpEntityService<PlatformConnectorUpsertDto, PlatformConnectorDto>;
46
48
  readonly findings: AmpSaaSEntityService<PlatformFindingUpsertDto, PlatformFindingDto>;
49
+ readonly jobExecutions: AmpEntityService<PlatformJobExecutionStateUpsertDto, PlatformJobExecutionStateDto>;
50
+ readonly jobs: AmpEntityService<PlatformJobSpecUpsertDto, PlatformJobSpecDto>;
47
51
  readonly providers: AmpDataService<ProviderDto>;
48
52
  readonly reportResults: AmpSaaSEntityService<PlatformReportResultUpsertDto, PlatformReportResultDto>;
49
53
  readonly saasAssets: AmpSaaSEntityService<PlatformSaasAssetUpsertDto, PlatformSaasAssetDto>;
@@ -57,6 +61,8 @@ export class AmpSdkServices {
57
61
  this.asset = new AmpGlobalEntityServiceImpl<PlatformAssetUpsertDto, PlatformAssetDto>(rest, KIND.ASSETS, TARGET_API_PLATFORM);
58
62
  this.connectors = new AmpEntityServiceImpl<PlatformConnectorUpsertDto, PlatformConnectorDto>(rest, KIND.CONNECTORS, TARGET_API_PLATFORM);
59
63
  this.findings = new AmpSaaSEntityServiceImpl<PlatformFindingUpsertDto, PlatformFindingDto>(rest, KIND.FINDINGS, TARGET_API_PLATFORM);
64
+ this.jobExecutions = new AmpEntityServiceImpl<PlatformJobExecutionStateUpsertDto, PlatformJobExecutionStateDto>(rest, KIND.JOB_EXECUTIONS, TARGET_API_PLATFORM);
65
+ this.jobs = new AmpEntityServiceImpl<PlatformJobSpecUpsertDto, PlatformJobSpecDto>(rest, KIND.JOB_SPEC, TARGET_API_PLATFORM);
60
66
  this.providers = new AmpDataServiceImpl<ProviderDto>(rest, KIND.PROVIDERS, TARGET_API_AGENT);
61
67
  this.reportResults = new AmpSaaSEntityServiceImpl<PlatformReportResultUpsertDto, PlatformReportResultDto>(rest, KIND.REPORT_RESULTS, TARGET_API_PLATFORM);
62
68
  this.saasAssets = new AmpSaaSEntityServiceImpl<PlatformSaasAssetUpsertDto, PlatformSaasAssetDto>(rest, KIND.SAAS_ASSETS, TARGET_API_PLATFORM);
@@ -13,6 +13,8 @@ export const KIND = {
13
13
  ASSETS: 'assets',
14
14
  CONNECTORS: 'connectors',
15
15
  FINDINGS: 'findings',
16
+ JOB_EXECUTIONS: 'jobs_executions',
17
+ JOB_SPEC: 'jobs',
16
18
  PROVIDERS: 'providers',
17
19
  REPORT_RESULTS: 'report_results',
18
20
  SAAS_ASSETS: 'saas_assets',