/*! * @license * Copyright Squiz Australia Pty Ltd. All Rights Reserved. */ import { AttributeValue } from '@aws-sdk/client-dynamodb'; import { MANIFEST_MODELS } from '@squiz/dx-json-schema-lib'; import { EntityType } from '../constants/Repository.constants'; /** * Job manifest interface. * @export * @interface JobManifest */ export interface JobManifest { /** * The name of the job manifest. * @type {string} * @memberof JobManifest */ name: string; /** * The version of the job the manifest is associated with. * @type {string} * @memberof JobManifest */ version: string; /** * The job timeout. * Minimum: 10 minutes. * Maximum: 8 hours (28800 seconds). * @type {number} * @memberof JobManifest */ timeoutSeconds: number; /** * The relative file path of the job code. * @type {string} * @memberof JobManifest */ entryFile: string; /** * The definition of the main job function. * @type {MANIFEST_MODELS.JobV1.JobFunction} * @memberof JobManifest */ entryFunction: MANIFEST_MODELS.JobV1.JobFunction; /** * The number of these jobs that can be run at once. * @type {number} * @memberof JobManifest */ concurrency: number; /** * The runtime image the job should execute against (e.g. `node:20`, `node:24`). * @type {string} * @memberof JobManifest */ image: string; /** * Whether failed job code executions should be retried automatically. * @type {boolean} * @memberof JobManifest */ autoRetry: boolean; /** * The DynamoDB record type ('job'). * @type {EntityType} * @memberof JobManifest */ type: EntityType; } /** * The Job Manifest record attributes stored in DynamoDB. * @export * @interface JobManifestRecord */ export interface JobManifestRecord { /** * The partition key ('manifest'). * @type {EntityType} * @memberof JobManifestRecord */ pk: EntityType; /** * The sort key ('name-version'). * @type {string} * @memberof JobManifestRecord */ sk: string; /** * The manifest's job name. * @type {string} * @memberof JobManifestRecord */ name: string; /** * The manifest's job version. * @type {string} * @memberof JobManifestRecord */ version: string; /** * The job timeout. * Minimum: 5 seconds. * Maximum: 8 hours (28800 seconds). * @type {number} * @memberof JobManifestRecord */ timeoutSeconds: number; /** * The relative file path of the job code. * @type {string} * @memberof JobManifestRecord */ entryFile: string; /** * The definition of the main job function. * @type {MANIFEST_MODELS.JobV1.JobFunction} * @memberof JobManifestRecord */ entryFunction: MANIFEST_MODELS.JobV1.JobFunction; /** * The number of these jobs that can be run at once. * @type {number} * @memberof JobManifestRecord */ concurrency: number; /** * The runtime image the job should execute against (e.g. `node:20`, `node:24`). * @type {string} * @memberof JobManifestRecord */ image: string; /** * Whether failed job code executions should be retried automatically. * @type {boolean} * @memberof JobManifestRecord */ autoRetry: boolean; } export type JobManifestDto = Record; /** * The request body for creating a job (POST /job-manifest). * @export */ export type CreateJobManifestRequest = Omit & Partial>; /** * The request body for updating a job (PUT /job-manifest). * @export */ export type UpdateJobManifestRequest = Partial>; export type JobManifestSk = Pick;