From fc20ec3369f32d75b95742651db508585b95d8b8 Mon Sep 17 00:00:00 2001 From: shortcuts Date: Thu, 28 Aug 2025 12:38:42 +0200 Subject: [PATCH 1/6] feat(ingestion): add put task endpoint --- specs/ingestion/common/schemas/task.yml | 40 ++++++++- specs/ingestion/paths/tasks/v2/taskID.yml | 29 ++++++- tests/CTS/requests/ingestion/createTask.json | 12 +-- .../requests/ingestion/fullUpdateTask.json | 87 +++++++++++++++++++ 4 files changed, 157 insertions(+), 11 deletions(-) create mode 100644 tests/CTS/requests/ingestion/fullUpdateTask.json diff --git a/specs/ingestion/common/schemas/task.yml b/specs/ingestion/common/schemas/task.yml index 727b9348c8f..84ab494c191 100644 --- a/specs/ingestion/common/schemas/task.yml +++ b/specs/ingestion/common/schemas/task.yml @@ -179,10 +179,41 @@ TaskCreateResponse: - taskID - createdAt -TaskUpdate: +TaskFullUpdate: type: object additionalProperties: false description: API request body for updating a task. + properties: + destinationID: + $ref: './common.yml#/destinationID' + action: + $ref: '#/ActionType' + subscriptionAction: + $ref: '#/ActionType' + cron: + $ref: '#/Cron' + enabled: + type: boolean + description: Whether the task is enabled. + failureThreshold: + $ref: '#/failureThreshold' + input: + $ref: '#/TaskInput' + cursor: + $ref: './common.yml#/cursor' + notifications: + $ref: '#/Notifications' + policies: + $ref: '#/Policies' + required: + - destinationID + - action + +# TODO: rename TaskUpdate to TaskPartialUpdate next major +TaskUpdate: + type: object + additionalProperties: false + description: API request body for partially updating a task. properties: destinationID: $ref: './common.yml#/destinationID' @@ -215,8 +246,7 @@ TaskUpdateV1: input: $ref: '#/TaskInput' enabled: - type: boolean - description: Whether the task is enabled. + $ref: '#/Enabled' failureThreshold: $ref: '#/failureThreshold' @@ -309,6 +339,10 @@ Cron: description: Cron expression for the task's schedule. example: '* * 1 * *' +Enabled: + type: boolean + description: Whether the task is enabled. + ScheduleTriggerType: type: string description: Task runs on a schedule. diff --git a/specs/ingestion/paths/tasks/v2/taskID.yml b/specs/ingestion/paths/tasks/v2/taskID.yml index e45b4d46df1..77cf67f5903 100644 --- a/specs/ingestion/paths/tasks/v2/taskID.yml +++ b/specs/ingestion/paths/tasks/v2/taskID.yml @@ -20,11 +20,36 @@ get: '400': $ref: '../../../../common/responses/BadRequest.yml' +put: + tags: + - tasks + summary: Fully updates a task + description: Fully updates a task by its ID, use partialUpdateTask if you only want to update a subset of fields. + operationId: fullUpdateTask + parameters: + - $ref: '../../../common/parameters.yml#/pathTaskID' + requestBody: + content: + application/json: + schema: + $ref: '../../../common/schemas/task.yml#/TaskFullUpdate' + required: true + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '../../../common/schemas/task.yml#/TaskUpdateResponse' + '400': + $ref: '../../../../common/responses/BadRequest.yml' + +# TODO: rename taskUpdate to taskPartialUpdate next major patch: tags: - tasks - summary: Update a task - description: Updates a task by its ID. + summary: Partially updates a task + description: Partially updates a task by its ID. operationId: updateTask parameters: - $ref: '../../../common/parameters.yml#/pathTaskID' diff --git a/tests/CTS/requests/ingestion/createTask.json b/tests/CTS/requests/ingestion/createTask.json index c141ea5f121..341e7108a86 100644 --- a/tests/CTS/requests/ingestion/createTask.json +++ b/tests/CTS/requests/ingestion/createTask.json @@ -3,7 +3,7 @@ "testName": "task without cron", "parameters": { "sourceID": "search", - "destinationID": "destinationName", + "destinationID": "destinationID", "action": "replace" }, "request": { @@ -11,7 +11,7 @@ "method": "POST", "body": { "sourceID": "search", - "destinationID": "destinationName", + "destinationID": "destinationID", "action": "replace" } } @@ -20,7 +20,7 @@ "testName": "task with cron", "parameters": { "sourceID": "search", - "destinationID": "destinationName", + "destinationID": "destinationID", "cron": "* * * * *", "action": "replace", "notifications": { @@ -37,7 +37,7 @@ "method": "POST", "body": { "sourceID": "search", - "destinationID": "destinationName", + "destinationID": "destinationID", "cron": "* * * * *", "action": "replace", "notifications": { @@ -55,7 +55,7 @@ "testName": "task shopify", "parameters": { "sourceID": "search", - "destinationID": "destinationName", + "destinationID": "destinationID", "cron": "* * * * *", "action": "replace", "input": { @@ -72,7 +72,7 @@ "method": "POST", "body": { "sourceID": "search", - "destinationID": "destinationName", + "destinationID": "destinationID", "cron": "* * * * *", "action": "replace", "input": { diff --git a/tests/CTS/requests/ingestion/fullUpdateTask.json b/tests/CTS/requests/ingestion/fullUpdateTask.json new file mode 100644 index 00000000000..17c7f912645 --- /dev/null +++ b/tests/CTS/requests/ingestion/fullUpdateTask.json @@ -0,0 +1,87 @@ +[ + { + "testName": "task without cron", + "parameters": { + "taskID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f", + "destinationID": "destinationID", + "action": "replace" + }, + "request": { + "path": "/2/tasks/6c02aeb1-775e-418e-870b-1faccd4b2c0f", + "method": "POST", + "body": { + "destinationID": "destinationID", + "action": "replace" + } + } + }, + { + "testName": "task with cron", + "parameters": { + "taskID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f", + "destinationID": "destinationID", + "cron": "* * * * *", + "action": "replace", + "notifications": { + "email": { + "enabled": true + } + }, + "policies": { + "criticalThreshold": 8 + } + }, + "request": { + "path": "/2/tasks/6c02aeb1-775e-418e-870b-1faccd4b2c0f", + "method": "POST", + "body": { + "destinationID": "destinationID", + "cron": "* * * * *", + "action": "replace", + "notifications": { + "email": { + "enabled": true + } + }, + "policies": { + "criticalThreshold": 8 + } + } + } + }, +{ + "testName": "task shopify", + "parameters": { + "taskID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f", + "destinationID": "destinationID", + "cron": "* * * * *", + "action": "replace", + "input": { + "streams": [ + { + "name": "foo", + "syncMode": "incremental" + } + ] + } + }, + "request": { + "path": "/2/tasks/6c02aeb1-775e-418e-870b-1faccd4b2c0f", + "method": "POST", + "body": { + "sourceID": "search", + "destinationID": "destinationID", + "cron": "* * * * *", + "action": "replace", + "input": { + "streams": [ + { + "name": "foo", + "syncMode": "incremental" + } + ] + } + } + } + } +] From 87c634f559fff2c3296beb89263ca92302ca47b5 Mon Sep 17 00:00:00 2001 From: shortcuts Date: Thu, 28 Aug 2025 12:51:34 +0200 Subject: [PATCH 2/6] fix: cts --- .../requests/ingestion/fullUpdateTask.json | 28 +++++++++++-------- tests/output/javascript/yarn.lock | 28 +++++++++---------- 2 files changed, 31 insertions(+), 25 deletions(-) diff --git a/tests/CTS/requests/ingestion/fullUpdateTask.json b/tests/CTS/requests/ingestion/fullUpdateTask.json index 17c7f912645..caf903af2b9 100644 --- a/tests/CTS/requests/ingestion/fullUpdateTask.json +++ b/tests/CTS/requests/ingestion/fullUpdateTask.json @@ -3,8 +3,10 @@ "testName": "task without cron", "parameters": { "taskID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f", - "destinationID": "destinationID", - "action": "replace" + "taskFullUpdate": { + "destinationID": "destinationID", + "action": "replace" + } }, "request": { "path": "/2/tasks/6c02aeb1-775e-418e-870b-1faccd4b2c0f", @@ -19,16 +21,18 @@ "testName": "task with cron", "parameters": { "taskID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f", - "destinationID": "destinationID", - "cron": "* * * * *", - "action": "replace", - "notifications": { - "email": { - "enabled": true + "taskFullUpdate": { + "destinationID": "destinationID", + "cron": "* * * * *", + "action": "replace", + "notifications": { + "email": { + "enabled": true + } + }, + "policies": { + "criticalThreshold": 8 } - }, - "policies": { - "criticalThreshold": 8 } }, "request": { @@ -53,6 +57,7 @@ "testName": "task shopify", "parameters": { "taskID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f", + "taskFullUpdate": { "destinationID": "destinationID", "cron": "* * * * *", "action": "replace", @@ -64,6 +69,7 @@ } ] } + } }, "request": { "path": "/2/tasks/6c02aeb1-775e-418e-870b-1faccd4b2c0f", diff --git a/tests/output/javascript/yarn.lock b/tests/output/javascript/yarn.lock index 9a1e0705631..b1b1049d551 100644 --- a/tests/output/javascript/yarn.lock +++ b/tests/output/javascript/yarn.lock @@ -427,12 +427,12 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:22.16.5": - version: 22.16.5 - resolution: "@types/node@npm:22.16.5" +"@types/node@npm:22.18.0": + version: 22.18.0 + resolution: "@types/node@npm:22.18.0" dependencies: undici-types: "npm:~6.21.0" - checksum: 10/ba45b5c9113cbc5edb12960fcfe7e80db2c998af5c1931264240695b27d756570d92462150b95781bd67a03aa82111cc970ab0f4504eb99213edff8bf425354e + checksum: 10/c4e4cdac52aae71e120fb4a02a08f774366e8bd6654de9376fb1113fb66cfa2706176b72f188069cdecdb40e5cdde2befa031dc720a0cc0b1e349af9e38492ad languageName: node linkType: hard @@ -1022,9 +1022,9 @@ __metadata: "@algolia/client-composition": "link:../../../clients/algoliasearch-client-javascript/packages/client-composition" "@algolia/composition": "link:../../../clients/algoliasearch-client-javascript/packages/composition" "@algolia/requester-testing": "link:../../../clients/algoliasearch-client-javascript/packages/requester-testing" - "@types/node": "npm:22.16.5" + "@types/node": "npm:22.18.0" algoliasearch: "link:../../../clients/algoliasearch-client-javascript/packages/algoliasearch" - typescript: "npm:5.8.3" + typescript: "npm:5.9.2" vitest: "npm:3.2.4" languageName: unknown linkType: soft @@ -1621,23 +1621,23 @@ __metadata: languageName: node linkType: hard -"typescript@npm:5.8.3": - version: 5.8.3 - resolution: "typescript@npm:5.8.3" +"typescript@npm:5.9.2": + version: 5.9.2 + resolution: "typescript@npm:5.9.2" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: 10/65c40944c51b513b0172c6710ee62e951b70af6f75d5a5da745cb7fab132c09ae27ffdf7838996e3ed603bb015dadd099006658046941bd0ba30340cc563ae92 + checksum: 10/cc2fe6c822819de5d453fa25aa9f32096bf70dde215d481faa1ad84a283dfb264e33988ed8f6d36bc803dd0b16dbe943efa311a798ef76d5b3892a05dfbfd628 languageName: node linkType: hard -"typescript@patch:typescript@npm%3A5.8.3#optional!builtin": - version: 5.8.3 - resolution: "typescript@patch:typescript@npm%3A5.8.3#optional!builtin::version=5.8.3&hash=5786d5" +"typescript@patch:typescript@npm%3A5.9.2#optional!builtin": + version: 5.9.2 + resolution: "typescript@patch:typescript@npm%3A5.9.2#optional!builtin::version=5.9.2&hash=5786d5" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: 10/b9b1e73dabac5dc730c041325dbd9c99467c1b0d239f1b74ec3b90d831384af3e2ba973946232df670519147eb51a2c20f6f96163cea2b359f03de1e2091cc4f + checksum: 10/bd810ab13e8e557225a8b5122370385440b933e4e077d5c7641a8afd207fdc8be9c346e3c678adba934b64e0e70b0acf5eef9493ea05170a48ce22bef845fdc7 languageName: node linkType: hard From 2675885ac85ff64a92fef34e501d9a5807b0c58b Mon Sep 17 00:00:00 2001 From: shortcuts Date: Thu, 28 Aug 2025 13:21:02 +0200 Subject: [PATCH 3/6] fix: cts --- tests/CTS/requests/ingestion/fullUpdateTask.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/CTS/requests/ingestion/fullUpdateTask.json b/tests/CTS/requests/ingestion/fullUpdateTask.json index caf903af2b9..e2784a3918e 100644 --- a/tests/CTS/requests/ingestion/fullUpdateTask.json +++ b/tests/CTS/requests/ingestion/fullUpdateTask.json @@ -10,7 +10,7 @@ }, "request": { "path": "/2/tasks/6c02aeb1-775e-418e-870b-1faccd4b2c0f", - "method": "POST", + "method": "PUT", "body": { "destinationID": "destinationID", "action": "replace" @@ -37,7 +37,7 @@ }, "request": { "path": "/2/tasks/6c02aeb1-775e-418e-870b-1faccd4b2c0f", - "method": "POST", + "method": "PUT", "body": { "destinationID": "destinationID", "cron": "* * * * *", @@ -73,7 +73,7 @@ }, "request": { "path": "/2/tasks/6c02aeb1-775e-418e-870b-1faccd4b2c0f", - "method": "POST", + "method": "PUT", "body": { "sourceID": "search", "destinationID": "destinationID", From 1d4ce17da1209a8ebdc9f8725cad35ab8bff3263 Mon Sep 17 00:00:00 2001 From: shortcuts Date: Thu, 28 Aug 2025 13:28:24 +0200 Subject: [PATCH 4/6] fix: cts --- tests/CTS/requests/ingestion/fullUpdateTask.json | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/CTS/requests/ingestion/fullUpdateTask.json b/tests/CTS/requests/ingestion/fullUpdateTask.json index e2784a3918e..ee5f3dc1dbe 100644 --- a/tests/CTS/requests/ingestion/fullUpdateTask.json +++ b/tests/CTS/requests/ingestion/fullUpdateTask.json @@ -75,7 +75,6 @@ "path": "/2/tasks/6c02aeb1-775e-418e-870b-1faccd4b2c0f", "method": "PUT", "body": { - "sourceID": "search", "destinationID": "destinationID", "cron": "* * * * *", "action": "replace", From 2b3a2d8c7fc2db971c3c12bfa76d34cea5632315 Mon Sep 17 00:00:00 2001 From: shortcuts Date: Thu, 28 Aug 2025 14:17:39 +0200 Subject: [PATCH 5/6] fix: test names --- tests/CTS/requests/ingestion/fullUpdateTask.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/CTS/requests/ingestion/fullUpdateTask.json b/tests/CTS/requests/ingestion/fullUpdateTask.json index ee5f3dc1dbe..150d2f5fa98 100644 --- a/tests/CTS/requests/ingestion/fullUpdateTask.json +++ b/tests/CTS/requests/ingestion/fullUpdateTask.json @@ -1,6 +1,6 @@ [ { - "testName": "task without cron", + "testName": "fully replace task without cron", "parameters": { "taskID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f", "taskFullUpdate": { @@ -18,7 +18,7 @@ } }, { - "testName": "task with cron", + "testName": "fully replace task with cron", "parameters": { "taskID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f", "taskFullUpdate": { @@ -54,7 +54,7 @@ } }, { - "testName": "task shopify", + "testName": "fully replace task shopify", "parameters": { "taskID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f", "taskFullUpdate": { From f2e304c085be1f76e77e3bec9b12ea4ca688f4ed Mon Sep 17 00:00:00 2001 From: shortcuts Date: Thu, 28 Aug 2025 14:50:08 +0200 Subject: [PATCH 6/6] chore: replaceTask --- specs/ingestion/common/schemas/task.yml | 2 +- specs/ingestion/paths/tasks/v2/taskID.yml | 4 +-- .../{fullUpdateTask.json => replaceTask.json} | 28 +++++++++---------- 3 files changed, 17 insertions(+), 17 deletions(-) rename tests/CTS/requests/ingestion/{fullUpdateTask.json => replaceTask.json} (84%) diff --git a/specs/ingestion/common/schemas/task.yml b/specs/ingestion/common/schemas/task.yml index 84ab494c191..a25d30c9213 100644 --- a/specs/ingestion/common/schemas/task.yml +++ b/specs/ingestion/common/schemas/task.yml @@ -179,7 +179,7 @@ TaskCreateResponse: - taskID - createdAt -TaskFullUpdate: +TaskReplace: type: object additionalProperties: false description: API request body for updating a task. diff --git a/specs/ingestion/paths/tasks/v2/taskID.yml b/specs/ingestion/paths/tasks/v2/taskID.yml index 77cf67f5903..8d4e4556a5a 100644 --- a/specs/ingestion/paths/tasks/v2/taskID.yml +++ b/specs/ingestion/paths/tasks/v2/taskID.yml @@ -25,14 +25,14 @@ put: - tasks summary: Fully updates a task description: Fully updates a task by its ID, use partialUpdateTask if you only want to update a subset of fields. - operationId: fullUpdateTask + operationId: replaceTask parameters: - $ref: '../../../common/parameters.yml#/pathTaskID' requestBody: content: application/json: schema: - $ref: '../../../common/schemas/task.yml#/TaskFullUpdate' + $ref: '../../../common/schemas/task.yml#/TaskReplace' required: true responses: '200': diff --git a/tests/CTS/requests/ingestion/fullUpdateTask.json b/tests/CTS/requests/ingestion/replaceTask.json similarity index 84% rename from tests/CTS/requests/ingestion/fullUpdateTask.json rename to tests/CTS/requests/ingestion/replaceTask.json index 150d2f5fa98..dbd212b22c1 100644 --- a/tests/CTS/requests/ingestion/fullUpdateTask.json +++ b/tests/CTS/requests/ingestion/replaceTask.json @@ -3,7 +3,7 @@ "testName": "fully replace task without cron", "parameters": { "taskID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f", - "taskFullUpdate": { + "taskReplace": { "destinationID": "destinationID", "action": "replace" } @@ -21,7 +21,7 @@ "testName": "fully replace task with cron", "parameters": { "taskID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f", - "taskFullUpdate": { + "taskReplace": { "destinationID": "destinationID", "cron": "* * * * *", "action": "replace", @@ -57,18 +57,18 @@ "testName": "fully replace task shopify", "parameters": { "taskID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f", - "taskFullUpdate": { - "destinationID": "destinationID", - "cron": "* * * * *", - "action": "replace", - "input": { - "streams": [ - { - "name": "foo", - "syncMode": "incremental" - } - ] - } + "taskReplace": { + "destinationID": "destinationID", + "cron": "* * * * *", + "action": "replace", + "input": { + "streams": [ + { + "name": "foo", + "syncMode": "incremental" + } + ] + } } }, "request": {