@tailor-platform/sdk 0.16.0 → 0.16.1
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.
- package/CHANGELOG.md +12 -0
- package/README.md +1 -0
- package/dist/cli/api.mjs +1 -1
- package/dist/cli/index.mjs +1 -1
- package/dist/{resume-ar5nEitS.mjs → resume-DvbIclRU.mjs} +11 -4
- package/dist/{resume-ar5nEitS.mjs.map → resume-DvbIclRU.mjs.map} +1 -1
- package/docs/cli-reference.md +141 -0
- package/docs/core-concepts.md +13 -13
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @tailor-platform/sdk
|
|
2
2
|
|
|
3
|
+
## 0.16.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#160](https://github.com/tailor-platform/sdk/pull/160) [`1406523`](https://github.com/tailor-platform/sdk/commit/14065237e5f0b05cf898c0fff196e1eb599fb96f) Thanks [@toiroakr](https://github.com/toiroakr)! - fix: correctly determine create/update for workflow job functions
|
|
8
|
+
|
|
9
|
+
Previously, the SDK used `hasExistingWorkflows` (based on workflow updates) to decide whether to use `createWorkflowJobFunction` or `updateWorkflowJobFunction`. This caused errors when renaming job functions, as renamed jobs were incorrectly sent to the update API which requires the job to already exist.
|
|
10
|
+
|
|
11
|
+
Now the SDK fetches the actual list of existing job function names via `listWorkflowJobFunctions` API and correctly uses:
|
|
12
|
+
- `createWorkflowJobFunction` for new job names (including renamed jobs)
|
|
13
|
+
- `updateWorkflowJobFunction` for existing job names
|
|
14
|
+
|
|
3
15
|
## 0.16.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/README.md
CHANGED
package/dist/cli/api.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { apply, generate, generateUserTypes, loadAccessToken, loadConfig, loadWorkspaceId, machineUserList, machineUserToken, oauth2ClientGet, oauth2ClientList, remove, show, workflowExecutionGet, workflowExecutionsList, workflowGet, workflowList, workflowResume, workflowStart, workspaceCreate, workspaceDelete, workspaceList } from "../resume-
|
|
1
|
+
import { apply, generate, generateUserTypes, loadAccessToken, loadConfig, loadWorkspaceId, machineUserList, machineUserToken, oauth2ClientGet, oauth2ClientList, remove, show, workflowExecutionGet, workflowExecutionsList, workflowGet, workflowList, workflowResume, workflowStart, workspaceCreate, workspaceDelete, workspaceList } from "../resume-DvbIclRU.mjs";
|
|
2
2
|
import "../job-CL8myeqs.mjs";
|
|
3
3
|
import { register } from "node:module";
|
|
4
4
|
|
package/dist/cli/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { PATScope, applyCommand, commonArgs, createCommand, deleteCommand, executionsCommand, fetchAll, fetchLatestToken, fetchUserInfo, formatArgs, generateCommand, getCommand, getCommand$1, initOAuth2Client, initOperatorClient, listCommand as listCommand$1, listCommand$1 as listCommand$6, listCommand$2 as listCommand$7, listCommand$3 as listCommand, loadAccessToken, loadConfig, loadWorkspaceId, parseFormat, printWithFormat, readPackageJson, readPlatformConfig, removeCommand, resumeCommand, showCommand, startCommand, tokenCommand, withCommonArgs, writePlatformConfig } from "../resume-
|
|
2
|
+
import { PATScope, applyCommand, commonArgs, createCommand, deleteCommand, executionsCommand, fetchAll, fetchLatestToken, fetchUserInfo, formatArgs, generateCommand, getCommand, getCommand$1, initOAuth2Client, initOperatorClient, listCommand as listCommand$1, listCommand$1 as listCommand$6, listCommand$2 as listCommand$7, listCommand$3 as listCommand, loadAccessToken, loadConfig, loadWorkspaceId, parseFormat, printWithFormat, readPackageJson, readPlatformConfig, removeCommand, resumeCommand, showCommand, startCommand, tokenCommand, withCommonArgs, writePlatformConfig } from "../resume-DvbIclRU.mjs";
|
|
3
3
|
import "../job-CL8myeqs.mjs";
|
|
4
4
|
import { register } from "node:module";
|
|
5
5
|
import { defineCommand, runCommand, runMain } from "citty";
|
|
@@ -147487,7 +147487,7 @@ function filterJobFunctionVersions(allVersions, usedJobNames) {
|
|
|
147487
147487
|
/**
|
|
147488
147488
|
* Register job functions used by any workflow.
|
|
147489
147489
|
* Only registers jobs that are actually used (based on usedJobNames in changeSet).
|
|
147490
|
-
* Uses
|
|
147490
|
+
* Uses create for new jobs and update for existing jobs.
|
|
147491
147491
|
*/
|
|
147492
147492
|
async function registerJobFunctions(client, changeSet) {
|
|
147493
147493
|
const jobFunctionVersions = {};
|
|
@@ -147496,11 +147496,18 @@ async function registerJobFunctions(client, changeSet) {
|
|
|
147496
147496
|
const { workspaceId, scripts } = firstWorkflow;
|
|
147497
147497
|
const allUsedJobNames = /* @__PURE__ */ new Set();
|
|
147498
147498
|
for (const item of [...changeSet.creates, ...changeSet.updates]) for (const jobName of item.usedJobNames) allUsedJobNames.add(jobName);
|
|
147499
|
-
const
|
|
147499
|
+
const existingJobNames = await fetchAll(async (pageToken) => {
|
|
147500
|
+
const response = await client.listWorkflowJobFunctions({
|
|
147501
|
+
workspaceId,
|
|
147502
|
+
pageToken
|
|
147503
|
+
});
|
|
147504
|
+
return [response.jobFunctions.map((j) => j.name), response.nextPageToken];
|
|
147505
|
+
});
|
|
147506
|
+
const existingJobNamesSet = new Set(existingJobNames);
|
|
147500
147507
|
const results = await Promise.all(Array.from(allUsedJobNames).map(async (jobName) => {
|
|
147501
147508
|
const script = scripts.get(jobName);
|
|
147502
147509
|
if (!script) throw new Error(`No bundled script found for job "${jobName}". Please run "generate" command before "apply".`);
|
|
147503
|
-
const response =
|
|
147510
|
+
const response = existingJobNamesSet.has(jobName) ? await client.updateWorkflowJobFunction({
|
|
147504
147511
|
workspaceId,
|
|
147505
147512
|
jobFunctionName: jobName,
|
|
147506
147513
|
script
|
|
@@ -149946,4 +149953,4 @@ const resumeCommand = defineCommand({
|
|
|
149946
149953
|
|
|
149947
149954
|
//#endregion
|
|
149948
149955
|
export { PATScope, apply, applyCommand, commonArgs, createCommand, deleteCommand, executionsCommand, fetchAll, fetchLatestToken, fetchUserInfo, formatArgs, generate, generateCommand, generateUserTypes, getCommand, getCommand$1, initOAuth2Client, initOperatorClient, listCommand, listCommand$1, listCommand$2, listCommand$3, loadAccessToken, loadConfig, loadWorkspaceId, machineUserList, machineUserToken, oauth2ClientGet, oauth2ClientList, parseFormat, printWithFormat, readPackageJson, readPlatformConfig, remove, removeCommand, resumeCommand, show, showCommand, startCommand, tokenCommand, withCommonArgs, workflowExecutionGet, workflowExecutionsList, workflowGet, workflowList, workflowResume, workflowStart, workspaceCreate, workspaceDelete, workspaceList, writePlatformConfig };
|
|
149949
|
-
//# sourceMappingURL=resume-
|
|
149956
|
+
//# sourceMappingURL=resume-DvbIclRU.mjs.map
|