diff --git a/CHANGELOG.md b/CHANGELOG.md index ce8c78f1..0847bb61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `sortBy` and `sortDirection` to `FormSearchOptions` - `emailClassificationId` to form schema +- optional `emailAddress` property to `createJob()` job `details` for sending job notification emails ## [13.1.7] - 2026-06-18 diff --git a/package-lock.json b/package-lock.json index 7f692a24..46b64019 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1641,7 +1641,7 @@ }, "node_modules/@oneblink/types": { "version": "1.0.0", - "resolved": "git+ssh://git@github.com/oneblink/types.git#7b9448e00309780bdd7d65993278231a7e30596d", + "resolved": "git+ssh://git@github.com/oneblink/types.git#2efbcc5818202693b13fef39ebb9ea2402f1815b", "dev": true, "license": "GPL-3.0-only", "dependencies": { diff --git a/src/classes/Jobs.ts b/src/classes/Jobs.ts index ec7a1f85..c998d897 100644 --- a/src/classes/Jobs.ts +++ b/src/classes/Jobs.ts @@ -16,6 +16,7 @@ const newJobSchema = Joi.object() description: Joi.string(), type: Joi.string(), priority: Joi.number(), + emailAddress: Joi.string().email(), }), }) @@ -54,6 +55,7 @@ export default class Jobs extends OneBlinkAPI { * description: 'Job description', * type: 'Type', * priority: 3, + * emailAddress: 'user@domain.io', * }, * } * diff --git a/tests/jobs.test.ts b/tests/jobs.test.ts index ff9782bb..4a81ee2e 100644 --- a/tests/jobs.test.ts +++ b/tests/jobs.test.ts @@ -95,6 +95,36 @@ describe('Jobs SDK Class', () => { ).rejects.toThrow('"details.priority" must be a number') }) }) + + describe('should reject with correct validation errors for "details.emailAddress"', () => { + test('string', async () => { + const jobs = await getJobsSdk() + return expect( + jobs.createJob({ + username: 'username', + formId: 1, + details: { + title: 'job title', + // @ts-expect-error Expecting throw + emailAddress: 123, + }, + }), + ).rejects.toThrow('"details.emailAddress" must be a string') + }) + test('invalid email', async () => { + const jobs = await getJobsSdk() + return expect( + jobs.createJob({ + username: 'username', + formId: 1, + details: { + title: 'job title', + emailAddress: 'not-an-email', + }, + }), + ).rejects.toThrow('"details.emailAddress" must be a valid email') + }) + }) }) describe('API Calls', () => {