@tailor-platform/sdk 1.74.1 → 1.75.0
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 +6 -0
- package/dist/application-BJKNlv8c.mjs +3 -0
- package/dist/{application-BsH6tkZC.mjs → application-DYshsH-K.mjs} +20 -8
- package/dist/application-DYshsH-K.mjs.map +1 -0
- package/dist/brand-Eo4pLXPJ.mjs.map +1 -1
- package/dist/cli/commands/deploy/workflow-execution-policy.d.mts +1 -0
- package/dist/cli/index.mjs +4 -4
- package/dist/cli/lib.mjs +2 -2
- package/dist/completion/zsh-worker.zsh +9 -9
- package/dist/configure/config/types.d.mts +3 -1
- package/dist/configure/index.d.mts +3 -1
- package/dist/configure/index.mjs +111 -3
- package/dist/configure/index.mjs.map +1 -1
- package/dist/configure/services/index.d.mts +3 -1
- package/dist/configure/services/workflow/execution-policy.d.mts +71 -0
- package/dist/configure/services/workflow/execution-policy.types.d.mts +104 -0
- package/dist/configure/services/workflow/index.d.mts +3 -1
- package/dist/configure/services/workflow/job.d.mts +7 -3
- package/dist/{globals-B8XX5TRB.mjs → globals-CcU1ONiK.mjs} +2 -2
- package/dist/globals-CcU1ONiK.mjs.map +1 -0
- package/dist/{job-CtU73PGa.mjs → job-D-PbD1P3.mjs} +5 -3
- package/dist/job-D-PbD1P3.mjs.map +1 -0
- package/dist/{registry-BozuxbPp.mjs → registry-NfSW0BRo.mjs} +4 -3
- package/dist/registry-NfSW0BRo.mjs.map +1 -0
- package/dist/runtime/globals.d.mts +1 -1
- package/dist/runtime/index.d.mts +1 -1
- package/dist/runtime/workflow.d.mts +22 -3
- package/dist/{runtime-DV1EnfMs.mjs → runtime-CJ5usBOu.mjs} +230 -6
- package/dist/runtime-CJ5usBOu.mjs.map +1 -0
- package/dist/{service_pb-CIrhGwHk.mjs → service_pb-4unFyubn.mjs} +16 -6
- package/dist/{service_pb-CIrhGwHk.mjs.map → service_pb-4unFyubn.mjs.map} +1 -1
- package/dist/{service_pb-DjwIn4jO.mjs → service_pb-D-PXRoMg.mjs} +1 -1
- package/dist/tailor-proto/src/tailor/v1/service_pb.d.mts +1 -1
- package/dist/tailor-proto/src/tailor/v1/workflow_pb.d.mts +29 -9
- package/dist/tailor-proto/src/tailor/v1/workflow_resource_pb.d.mts +35 -1
- package/dist/utils/test/index.mjs +1 -1
- package/dist/utils/test/index.mjs.map +1 -1
- package/dist/vitest/environment.mjs +1 -1
- package/dist/vitest/index.mjs +15 -12
- package/dist/vitest/index.mjs.map +1 -1
- package/dist/vitest/mocks/workflow.d.mts +5 -3
- package/dist/vitest/setup.mjs +1 -1
- package/dist/workflow-DSwnYPPP.mjs.map +1 -1
- package/docs/configuration.md +24 -0
- package/docs/services/workflow.md +78 -0
- package/package.json +1 -1
- package/dist/application-BsH6tkZC.mjs.map +0 -1
- package/dist/application-CSUhZMb5.mjs +0 -3
- package/dist/globals-B8XX5TRB.mjs.map +0 -1
- package/dist/job-CtU73PGa.mjs.map +0 -1
- package/dist/registry-BozuxbPp.mjs.map +0 -1
- package/dist/runtime-DV1EnfMs.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @tailor-platform/sdk
|
|
2
2
|
|
|
3
|
+
## 1.75.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#1679](https://github.com/tailor-platform/sdk/pull/1679) [`4ff2b23`](https://github.com/tailor-platform/sdk/commit/4ff2b23d84c5dd5f1692cc3b3f7b32b273b4d550) Thanks [@k1LoW](https://github.com/k1LoW)! - Add workflow job function execution policies. Declare them with `defineWorkflowExecutionPolicies` (or the single-key `defineWorkflowExecutionPolicy`), register them via `workflow.executionPolicies` on `defineConfig`, and pass the policy's `key` (or, for wildcard policies declared with `matchType: "prefix"`, the value returned by `keyFor(suffix)`) through the new `executionPolicyKey` option on `triggerJobFunction` / `job.trigger()` to apply the platform-side concurrency cap. `executionPolicyKey` only accepts values produced by a declared policy. `keyFor` joins the prefix and suffix with `.` by default; override it with `separator`, passed as the second argument to `defineWorkflowExecutionPolicies` (applies to every policy in the group) or as a `def` field on a single `defineWorkflowExecutionPolicy`.
|
|
8
|
+
|
|
3
9
|
## 1.74.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -294,7 +294,7 @@ function initOAuth2Client(config) {
|
|
|
294
294
|
*/
|
|
295
295
|
async function initOperatorClient(accessToken, config) {
|
|
296
296
|
const platformConfig = config ?? getPlatformConfigForToken(accessToken);
|
|
297
|
-
const [{ createTracingInterceptor }, { OperatorService }] = await Promise.all([import("./interceptor-D-q1rvRl.mjs"), import("./service_pb-
|
|
297
|
+
const [{ createTracingInterceptor }, { OperatorService }] = await Promise.all([import("./interceptor-D-q1rvRl.mjs"), import("./service_pb-D-PXRoMg.mjs")]);
|
|
298
298
|
const interceptors = [
|
|
299
299
|
await userAgentInterceptor(),
|
|
300
300
|
await bearerTokenInterceptor(accessToken),
|
|
@@ -464,7 +464,8 @@ const RETRY_SAFE_CREATE_METHODS = /* @__PURE__ */ new Set([
|
|
|
464
464
|
"CreateTailorDBType",
|
|
465
465
|
"CreateTenantConfig",
|
|
466
466
|
"CreateUserProfileConfig",
|
|
467
|
-
"CreateWorkflow"
|
|
467
|
+
"CreateWorkflow",
|
|
468
|
+
"CreateWorkflowJobFunctionExecutionPolicy"
|
|
468
469
|
]);
|
|
469
470
|
/**
|
|
470
471
|
* Whether an error is an `AlreadyExists` from a retry-safe Create RPC.
|
|
@@ -2648,7 +2649,8 @@ function detectTriggerCalls(program, sourceText) {
|
|
|
2648
2649
|
if (triggerCall) calls.push({
|
|
2649
2650
|
identifierName: triggerCall.identifierName,
|
|
2650
2651
|
callRange: triggerCall.callRange,
|
|
2651
|
-
argsText: triggerCall.argsText
|
|
2652
|
+
argsText: triggerCall.argsText,
|
|
2653
|
+
optionsText: triggerCall.optionsText
|
|
2652
2654
|
});
|
|
2653
2655
|
for (const key of Object.keys(node)) {
|
|
2654
2656
|
const child = node[key];
|
|
@@ -2912,7 +2914,8 @@ function detectExtendedTriggerCalls(program, sourceText, workflowNames, jobNames
|
|
|
2912
2914
|
kind: "job",
|
|
2913
2915
|
identifierName: triggerCall.identifierName,
|
|
2914
2916
|
callRange: triggerCall.callRange,
|
|
2915
|
-
argsText: triggerCall.argsText
|
|
2917
|
+
argsText: triggerCall.argsText,
|
|
2918
|
+
optionsText: triggerCall.optionsText
|
|
2916
2919
|
});
|
|
2917
2920
|
}
|
|
2918
2921
|
for (const key of Object.keys(node)) {
|
|
@@ -2988,7 +2991,8 @@ function transformFunctionTriggers(source, workflowNameMap, jobNameMap, workflow
|
|
|
2988
2991
|
} else {
|
|
2989
2992
|
const jobName = jobNameMap.get(call.identifierName);
|
|
2990
2993
|
if (jobName) {
|
|
2991
|
-
const
|
|
2994
|
+
const optionsPart = call.optionsText !== void 0 ? `, ${call.optionsText}` : "";
|
|
2995
|
+
const transformedCall = `(async () => tailor.workflow.triggerJobFunction("${jobName}", ${call.argsText || "undefined"}${optionsPart}))()`;
|
|
2992
2996
|
replacements.push({
|
|
2993
2997
|
start: call.callRange.start,
|
|
2994
2998
|
end: call.callRange.end,
|
|
@@ -5593,7 +5597,8 @@ function transformWorkflowSource(source, targetJobName, targetJobExportName, oth
|
|
|
5593
5597
|
if (isInsideRemovedRange(call.callRange.start)) continue;
|
|
5594
5598
|
const jobName = jobNameMap.get(call.identifierName);
|
|
5595
5599
|
if (jobName) {
|
|
5596
|
-
const
|
|
5600
|
+
const optionsPart = call.optionsText !== void 0 ? `, ${call.optionsText}` : "";
|
|
5601
|
+
const transformedCall = `(async () => tailor.workflow.triggerJobFunction("${jobName}", ${call.argsText || "undefined"}${optionsPart}))()`;
|
|
5597
5602
|
replacements.push({
|
|
5598
5603
|
start: call.callRange.start,
|
|
5599
5604
|
end: call.callRange.end,
|
|
@@ -5850,6 +5855,13 @@ const RetryPolicySchema = z.object({
|
|
|
5850
5855
|
path: ["initialBackoff"]
|
|
5851
5856
|
});
|
|
5852
5857
|
const ConcurrencyPolicySchema = z.object({ maxConcurrentExecutions: z.number().int().min(1).max(1e3).describe("Maximum number of concurrent executions (1-1000)") });
|
|
5858
|
+
const ExecutionPolicyNameSchema = z.string().regex(/^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$/, "Invalid execution policy name: must match [a-z0-9-] (3-63 chars; must start and end with [a-z0-9])").describe("Workspace-unique execution policy name embedded in the resource TRN");
|
|
5859
|
+
const ExecutionPolicyKeySchema = z.string().regex(/^[a-z0-9][a-z0-9_:.-]{0,62}[a-z0-9*]$/, "Invalid execution policy key: must match [a-z0-9_:.-] (2-64 chars; must start with [a-z0-9] and end with [a-z0-9] or a trailing '*')").describe("Execution policy key passed to triggerJobFunction's executionPolicyKey option");
|
|
5860
|
+
const WorkflowJobFunctionExecutionPolicySchema = z.object({
|
|
5861
|
+
name: ExecutionPolicyNameSchema,
|
|
5862
|
+
key: ExecutionPolicyKeySchema,
|
|
5863
|
+
concurrencyPolicy: ConcurrencyPolicySchema.optional().describe("Optional per-key concurrency cap for job function dispatches matching this policy")
|
|
5864
|
+
});
|
|
5853
5865
|
const WorkflowSchema = z.object({
|
|
5854
5866
|
name: z.string().describe("Workflow name"),
|
|
5855
5867
|
mainJob: WorkflowJobSchema.describe("Main job that starts the workflow"),
|
|
@@ -6570,5 +6582,5 @@ async function loadApplication(params) {
|
|
|
6570
6582
|
}
|
|
6571
6583
|
|
|
6572
6584
|
//#endregion
|
|
6573
|
-
export {
|
|
6574
|
-
//# sourceMappingURL=application-
|
|
6585
|
+
export { getOAuth2ClientId as $, hasAnyUserTokenEntry as A, readPlatformConfig as B, createBundleCache as C, loadConfig as D, hashFile as E, loadMachineUserName as F, defaultPlatformBaseUrl as G, saveUserTokens as H, loadPlatformClientConfig as I, fetchMachineUserToken as J, fetchAll as K, loadStoredUserTokens as L, loadAccessToken as M, loadConfigPath as N, deleteUserTokens as O, loadConsoleBaseUrl as P, getConsoleBaseUrl as Q, loadWorkspaceId as R, hasGenerationHooks as S, hashContent as T, writePlatformConfig as U, resolveUserTokenKey as V, closeConnectionPool as W, fetchPlatformMachineUserToken as X, fetchPaged as Y, fetchUserInfo as Z, platformBundleDefinePlugin as _, resolveInlineSourcemap as a, resolveStaticWebsiteUrls as at, resolveBundleLogLevel as b, ResolverSchema as c, buildExecutorArgsExpr as d, getOrNull as et, buildResolverOperationHookExpr as f, stringifyFunction as g, TailorDBTypeSchema as h, resolverBundleKey as i, isDefaultPlatform as it, hasUserTokenEntry as j, fetchLatestToken as k, HTTP_METHODS as l, assertUniqueTailorDBTypeNamesWithExternal as m, generatePluginFilesIfNeeded as n, initOAuth2Client as nt, WorkflowJobFunctionExecutionPolicySchema as o, byName as ot, assertUniqueLocalTailorDBTypeNames as p, fetchAllTolerant as q, loadApplication as r, initOperatorClient as rt, WorkflowJobSchema as s, defineApplication as t, getPlatformBaseUrl as tt, INVOKER_EXPR as u, composeFunctionTreeshakeOptions as v, getDistDir as w, getPluginGenerationDependencies as x, createLogLevelTreeshakeOptions as y, platformConfigFromProfile as z };
|
|
6586
|
+
//# sourceMappingURL=application-DYshsH-K.mjs.map
|