@squiz/job-runner-lib 2.10.0 → 2.10.2

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 (23) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/lib/domains/job/errors/ConflictError.d.ts +14 -0
  3. package/lib/domains/job/errors/Error.constants.d.ts +4 -0
  4. package/lib/domains/job/errors/index.d.ts +1 -0
  5. package/lib/domains/job/model/Base/Base.d.ts +5 -0
  6. package/lib/domains/job/model/JobExecution/JobExecution.d.ts +15 -3
  7. package/lib/domains/job/repository/JobExecutionRepository/JobExecutionRepository.d.ts +3 -6
  8. package/lib/domains/job/repository/JobExecutionRepository/utils/convertDynamoDbItemToJobExecution/convertDynamoDbItemToJobExecution.spec.d.ts +1 -0
  9. package/lib/index.js +11 -11
  10. package/lib/index.js.map +4 -4
  11. package/package.json +4 -3
  12. package/src/domains/job/errors/ConflictError.ts +19 -0
  13. package/src/domains/job/errors/Error.constants.ts +4 -0
  14. package/src/domains/job/errors/index.ts +1 -0
  15. package/src/domains/job/model/Base/Base.ts +6 -0
  16. package/src/domains/job/model/JobExecution/JobExecution.ts +17 -3
  17. package/src/domains/job/model/JobExecution/mocks/JobExecution.mock.ts +1 -0
  18. package/src/domains/job/model/JobExecution/mocks/JobExecutionDto.mock.ts +3 -0
  19. package/src/domains/job/model/JobExecution/mocks/JobExecutionRecord.mock.ts +1 -0
  20. package/src/domains/job/repository/JobExecutionRepository/JobExecutionRepository.spec.ts +77 -16
  21. package/src/domains/job/repository/JobExecutionRepository/JobExecutionRepository.ts +19 -15
  22. package/src/domains/job/repository/JobExecutionRepository/utils/convertDynamoDbItemToJobExecution/convertDynamoDbItemToJobExecution.spec.ts +48 -0
  23. package/src/domains/job/repository/JobExecutionRepository/utils/convertDynamoDbItemToJobExecution/convertDynamoDbItemToJobExecution.ts +1 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Change Log
2
2
 
3
+ ## 2.10.2
4
+
5
+ ### Patch Changes
6
+
7
+ - df97f89: fixed issue reading partial job execution from dynamo
8
+
9
+ ## 2.10.1
10
+
11
+ ### Patch Changes
12
+
13
+ - 67d4d90: Updated virus-scanner-lib.
14
+
3
15
  ## 2.10.0
4
16
 
5
17
  ### Minor Changes
@@ -0,0 +1,14 @@
1
+ /*!
2
+ * @license
3
+ * Copyright Squiz Australia Pty Ltd. All Rights Reserved.
4
+ */
5
+ import { ErrorWithHttpStatusCode } from './ErrorWithHttpStatusCode';
6
+ /**
7
+ * Conflict error (409).
8
+ * @export
9
+ * @class ConflictError
10
+ * @extends {ErrorWithHttpStatusCode}
11
+ */
12
+ export declare class ConflictError extends ErrorWithHttpStatusCode {
13
+ constructor(details: string, message?: string);
14
+ }
@@ -23,6 +23,10 @@ export declare const ERRORS: {
23
23
  code: number;
24
24
  name: string;
25
25
  };
26
+ conflict: {
27
+ code: number;
28
+ name: string;
29
+ };
26
30
  };
27
31
  export declare const ERROR_MESSAGES: {
28
32
  paginationEncodeFailed: string;
@@ -1,4 +1,5 @@
1
1
  export * from './BadRequestError';
2
+ export * from './ConflictError';
2
3
  export * from './Error.constants';
3
4
  export * from './ErrorWithHttpStatusCode';
4
5
  export * from './InternalServerError';
@@ -43,3 +43,8 @@ export type ListParameters<TFilters> = {
43
43
  consistentRead?: boolean;
44
44
  limit?: number;
45
45
  };
46
+ export type UpdateOptions = {
47
+ conditionExpression?: string;
48
+ expressionAttributeValues?: Record<string, unknown>;
49
+ expressionAttributeNames?: Record<string, string>;
50
+ };
@@ -53,6 +53,12 @@ export interface JobExecution {
53
53
  * @memberof JobExecution
54
54
  */
55
55
  ecsTaskId: string | null;
56
+ /**
57
+ * The last version of the ECS task event which was handled.
58
+ * @type {(number | null)}
59
+ * @memberof JobExecution
60
+ */
61
+ lastEcsTaskEventVersion: number | null;
56
62
  /**
57
63
  * The time the job run was started.
58
64
  * @type {(string | null)}
@@ -159,19 +165,25 @@ export interface JobExecutionRecord {
159
165
  status: JobExecutionStatus;
160
166
  /**
161
167
  * The version of the job script to execute.
162
- * @type @type {(string)}
168
+ * @type {(string)}
163
169
  * @memberof JobExecutionRecord
164
170
  */
165
171
  version: string;
166
172
  /**
167
173
  * The ECS task ID of the job run.
168
- * @type @type {(string | null)}
174
+ * @type {(string | null)}
169
175
  * @memberof JobExecutionRecord
170
176
  */
171
177
  ecsTaskId: string | null;
178
+ /**
179
+ * The last version of the ECS task event which was handled.
180
+ * @type {(number | null)}
181
+ * @memberof JobExecution
182
+ */
183
+ lastEcsTaskEventVersion: number | null;
172
184
  /**
173
185
  * The time the job run was started.
174
- * @type @type {(string | null)}
186
+ * @type {(string | null)}
175
187
  * @memberof JobExecutionRecord
176
188
  */
177
189
  timeStarted: string | null;
@@ -2,10 +2,11 @@
2
2
  * @license
3
3
  * Copyright Squiz Australia Pty Ltd. All Rights Reserved.
4
4
  */
5
- import { AttributeValue, DynamoDBClient } from '@aws-sdk/client-dynamodb';
5
+ import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
6
6
  import { PaginationInfo, PaginationQueryResponse } from '../../core/pagination';
7
7
  import { CreateJobExecutionRequest, JobExecution, JobExecutionDto, JobExecutionSk, ListJobExecutionParameters, UpdateJobExecutionParameters } from '../../model/JobExecution';
8
8
  import { Repository } from '../AbstractRepository';
9
+ import { UpdateOptions } from '../../model/Base';
9
10
  export declare class JobExecutionRepository extends Repository<JobExecution, JobExecutionDto, JobExecutionSk> {
10
11
  constructor(dynamoDbClient: DynamoDBClient, tableName: string, tenant?: string);
11
12
  begin(createParams: CreateJobExecutionRequest): Promise<JobExecution>;
@@ -46,11 +47,7 @@ export declare class JobExecutionRepository extends Repository<JobExecution, Job
46
47
  * @returns {Promise<JobExecution | null>} The updated record.
47
48
  * @memberof JobExecutionRepository
48
49
  */
49
- update(sk: JobExecutionSk, input: UpdateJobExecutionParameters, options?: {
50
- ConditionExpression?: string;
51
- ExpressionAttributeValues?: Record<string, AttributeValue>;
52
- ExpressionAttributeNames?: Record<string, string>;
53
- }): Promise<JobExecution>;
50
+ update(sk: JobExecutionSk, input: UpdateJobExecutionParameters, options?: UpdateOptions): Promise<JobExecution>;
54
51
  buildSk(sk: JobExecutionSk): string;
55
52
  convertToDynamoDbItem(item: JobExecution): JobExecutionDto;
56
53
  convertToItem(dbItem: JobExecutionDto): JobExecution;