@tailor-platform/sdk 1.74.0 → 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 +26 -0
- package/dist/application-BJKNlv8c.mjs +3 -0
- package/dist/{application-DwmoI6ZQ.mjs → application-DYshsH-K.mjs} +61 -11
- 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/commands/tailordb/migrate/snapshot.d.mts +1 -16
- package/dist/cli/index.mjs +23 -34
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +2 -2
- package/dist/cli/lib.mjs +3 -3
- package/dist/cli/lib.mjs.map +1 -1
- 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 +113 -5
- package/dist/configure/index.mjs.map +1 -1
- package/dist/configure/services/index.d.mts +3 -1
- package/dist/configure/services/tailordb/schema.d.mts +5 -19
- 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/configure/types/field-runtime.d.mts +17 -0
- package/dist/configure/types/type.d.mts +1 -18
- package/dist/field-runtime-9bfXBAOK.mjs +183 -0
- package/dist/field-runtime-9bfXBAOK.mjs.map +1 -0
- 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/plugin/builtin/seed/index.mjs +1 -1
- 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-Zkg3SUwi.mjs → runtime-CJ5usBOu.mjs} +456 -397
- package/dist/runtime-CJ5usBOu.mjs.map +1 -0
- package/dist/{schema-DAdZSFOd.mjs → schema-Dl_y0m9e.mjs} +8 -167
- package/dist/schema-Dl_y0m9e.mjs.map +1 -0
- package/dist/secretmanager-Bd45j7an.mjs +98 -0
- package/dist/secretmanager-Bd45j7an.mjs.map +1 -0
- package/dist/{seed-DoMTMLcm.mjs → seed-fm0LeYP2.mjs} +14 -3
- package/dist/seed-fm0LeYP2.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/types-BwzB2okW.mjs +199 -0
- package/dist/types-BwzB2okW.mjs.map +1 -0
- package/dist/types-KlawuVKa.mjs +4 -0
- 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.d.mts +8 -1
- package/dist/vitest/index.mjs +779 -1
- package/dist/vitest/index.mjs.map +1 -1
- package/dist/vitest/mock.d.mts +8 -363
- package/dist/vitest/mocks/aigateway.d.mts +30 -0
- package/dist/vitest/mocks/authconnection.d.mts +28 -0
- package/dist/vitest/mocks/file.d.mts +41 -0
- package/dist/vitest/mocks/iconv.d.mts +27 -0
- package/dist/vitest/mocks/idp.d.mts +44 -0
- package/dist/vitest/mocks/secretmanager.d.mts +33 -0
- package/dist/vitest/mocks/tailordb.d.mts +71 -0
- package/dist/vitest/mocks/workflow.d.mts +117 -0
- package/dist/vitest/setup.mjs +2 -2
- package/dist/workflow-DSwnYPPP.mjs.map +1 -1
- package/docs/configuration.md +24 -0
- package/docs/services/workflow.md +78 -0
- package/package.json +8 -8
- package/dist/application-BndtMTFY.mjs +0 -3
- package/dist/application-DwmoI6ZQ.mjs.map +0 -1
- package/dist/field-DOsJCPFa.mjs +0 -22
- package/dist/field-DOsJCPFa.mjs.map +0 -1
- package/dist/globals-B8XX5TRB.mjs.map +0 -1
- package/dist/job-CtU73PGa.mjs.map +0 -1
- package/dist/mock-Ce1GCi4-.mjs +0 -871
- package/dist/mock-Ce1GCi4-.mjs.map +0 -1
- package/dist/registry-BozuxbPp.mjs.map +0 -1
- package/dist/runtime-Zkg3SUwi.mjs.map +0 -1
- package/dist/schema-DAdZSFOd.mjs.map +0 -1
- package/dist/seed-DoMTMLcm.mjs.map +0 -1
- package/dist/types-qhFZ8y9B.mjs +0 -4
- package/dist/types-ywCGpzDZ.mjs +0 -360
- package/dist/types-ywCGpzDZ.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
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
|
+
|
|
9
|
+
## 1.74.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#1669](https://github.com/tailor-platform/sdk/pull/1669) [`6313353`](https://github.com/tailor-platform/sdk/commit/6313353a81642a8d52d4559dc37044c9365ca241) Thanks [@dqn](https://github.com/dqn)! - Preserve special characters when exporting TailorDB ERD viewer HTML and generated seed scripts.
|
|
14
|
+
|
|
15
|
+
- [#1670](https://github.com/tailor-platform/sdk/pull/1670) [`8c18c3b`](https://github.com/tailor-platform/sdk/commit/8c18c3bc1ee3a37e3258def1d15b9cc05b33aec4) Thanks [@dqn](https://github.com/dqn)! - Keep resolver and TailorDB field parsing behavior aligned.
|
|
16
|
+
|
|
17
|
+
- [#1682](https://github.com/tailor-platform/sdk/pull/1682) [`1e9ef08`](https://github.com/tailor-platform/sdk/commit/1e9ef0874f4ccea99874baf160d70d9ad8ad9688) Thanks [@toiroakr](https://github.com/toiroakr)! - Fix a type error introduced in a previous release where an array field's `.index()`/`.unique()`/`.clone()`/`pickFields()` typing could become incompatible with itself when a field's shape flowed through an unresolved generic (e.g. a module-authoring helper's `ReturnType<typeof genericFn>` with no explicit type arguments). This could surface as a spurious `TS2322`/`TS2345` type error when wiring a `db.type()` result produced by one generic helper into another.
|
|
18
|
+
|
|
19
|
+
- [#1668](https://github.com/tailor-platform/sdk/pull/1668) [`abcdca5`](https://github.com/tailor-platform/sdk/commit/abcdca5808e487547030ac6163bf4429d976bb54) Thanks [@dqn](https://github.com/dqn)! - Remove the obsolete `MigrationInfo` type export from `@tailor-platform/sdk/cli`.
|
|
20
|
+
|
|
21
|
+
- [#1661](https://github.com/tailor-platform/sdk/pull/1661) [`3ccbae3`](https://github.com/tailor-platform/sdk/commit/3ccbae3f02cdaddbacd8849a8c097101e3c8a050) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency tsx to v4.22.5
|
|
22
|
+
|
|
23
|
+
- [#1666](https://github.com/tailor-platform/sdk/pull/1666) [`1d61fed`](https://github.com/tailor-platform/sdk/commit/1d61fed82e6433dd90f2137dbd2049bc3c74b706) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update @opentelemetry
|
|
24
|
+
|
|
25
|
+
- [#1667](https://github.com/tailor-platform/sdk/pull/1667) [`2110fd1`](https://github.com/tailor-platform/sdk/commit/2110fd1f4e27733934179f02af503efc175ee280) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency undici to v8.6.0
|
|
26
|
+
|
|
27
|
+
- [#1675](https://github.com/tailor-platform/sdk/pull/1675) [`15e721c`](https://github.com/tailor-platform/sdk/commit/15e721c610123395ccd0fa44c4bf8895d84b6584) Thanks [@dqn](https://github.com/dqn)! - Refactor Vitest mock helpers without changing their public APIs or behavior.
|
|
28
|
+
|
|
3
29
|
## 1.74.0
|
|
4
30
|
|
|
5
31
|
### Minor Changes
|
|
@@ -6,7 +6,7 @@ import { n as enumConstantsPlugin, t as EnumConstantsGeneratorID } from "./enum-
|
|
|
6
6
|
import { t as multiline } from "./multiline-sfHpTZZK.mjs";
|
|
7
7
|
import { n as fileUtilsPlugin, t as FileUtilsGeneratorID } from "./file-utils-DcyIPFQh.mjs";
|
|
8
8
|
import { n as kyselyTypePlugin, t as KyselyGeneratorID } from "./kysely-type-D-zflMGf.mjs";
|
|
9
|
-
import { n as seedPlugin, r as isPluginGeneratedType, t as SeedGeneratorID } from "./seed-
|
|
9
|
+
import { n as seedPlugin, r as isPluginGeneratedType, t as SeedGeneratorID } from "./seed-fm0LeYP2.mjs";
|
|
10
10
|
import { t as readPackageJson } from "./package-json-8b0O9TlX.mjs";
|
|
11
11
|
import { i as userAgent, n as tightenSecretFilePermissions, r as writeSecretFile } from "./secret-file-VSVGy1V0.mjs";
|
|
12
12
|
import { t as createCLIError } from "./errors-Dtf2WPaW.mjs";
|
|
@@ -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.
|
|
@@ -606,6 +607,44 @@ async function fetchAll(fn) {
|
|
|
606
607
|
return items;
|
|
607
608
|
}
|
|
608
609
|
/**
|
|
610
|
+
* @internal
|
|
611
|
+
* @param error - Error value to inspect
|
|
612
|
+
* @returns Whether the error is a Connect NotFound error
|
|
613
|
+
*/
|
|
614
|
+
function isNotFoundError(error) {
|
|
615
|
+
return error instanceof ConnectError && error.code === Code.NotFound;
|
|
616
|
+
}
|
|
617
|
+
/**
|
|
618
|
+
* Fetch all paginated resources, treating an absent resource group as empty.
|
|
619
|
+
* @template T
|
|
620
|
+
* @param fn - Page fetcher returning items and next page token
|
|
621
|
+
* @returns Items fetched before pagination completes or the fetcher raises NotFound
|
|
622
|
+
*/
|
|
623
|
+
async function fetchAllTolerant(fn) {
|
|
624
|
+
return await fetchAll(async (pageToken, maxPageSize) => {
|
|
625
|
+
try {
|
|
626
|
+
return await fn(pageToken, maxPageSize);
|
|
627
|
+
} catch (error) {
|
|
628
|
+
if (isNotFoundError(error)) return [[], ""];
|
|
629
|
+
throw error;
|
|
630
|
+
}
|
|
631
|
+
});
|
|
632
|
+
}
|
|
633
|
+
/**
|
|
634
|
+
* Fetch a single resource, treating NotFound as an absent value.
|
|
635
|
+
* @template T
|
|
636
|
+
* @param fn - Resource getter
|
|
637
|
+
* @returns Fetched resource, or undefined when the getter raises NotFound
|
|
638
|
+
*/
|
|
639
|
+
async function getOrNull(fn) {
|
|
640
|
+
try {
|
|
641
|
+
return await fn();
|
|
642
|
+
} catch (error) {
|
|
643
|
+
if (isNotFoundError(error)) return;
|
|
644
|
+
throw error;
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
609
648
|
* Fetch paginated resources with an optional upper bound on the number of
|
|
610
649
|
* items returned. When `limit` is 0 or undefined the function behaves
|
|
611
650
|
* like `fetchAll` and returns every page. When `limit` is positive the
|
|
@@ -676,7 +715,7 @@ async function resolveStaticWebsiteUrls(client, workspaceId, urls, context, opti
|
|
|
676
715
|
logger.warn(`Static website "${siteName}" has no URL assigned yet. Excluding from ${context}.`);
|
|
677
716
|
return [];
|
|
678
717
|
} catch (error) {
|
|
679
|
-
if (error
|
|
718
|
+
if (isNotFoundError(error) && expectedLocalNames?.has(siteName)) return [url];
|
|
680
719
|
logger.warn(`Static website "${siteName}" not found for ${context} configuration. Excluding from ${context}.`);
|
|
681
720
|
return [];
|
|
682
721
|
}
|
|
@@ -2610,7 +2649,8 @@ function detectTriggerCalls(program, sourceText) {
|
|
|
2610
2649
|
if (triggerCall) calls.push({
|
|
2611
2650
|
identifierName: triggerCall.identifierName,
|
|
2612
2651
|
callRange: triggerCall.callRange,
|
|
2613
|
-
argsText: triggerCall.argsText
|
|
2652
|
+
argsText: triggerCall.argsText,
|
|
2653
|
+
optionsText: triggerCall.optionsText
|
|
2614
2654
|
});
|
|
2615
2655
|
for (const key of Object.keys(node)) {
|
|
2616
2656
|
const child = node[key];
|
|
@@ -2874,7 +2914,8 @@ function detectExtendedTriggerCalls(program, sourceText, workflowNames, jobNames
|
|
|
2874
2914
|
kind: "job",
|
|
2875
2915
|
identifierName: triggerCall.identifierName,
|
|
2876
2916
|
callRange: triggerCall.callRange,
|
|
2877
|
-
argsText: triggerCall.argsText
|
|
2917
|
+
argsText: triggerCall.argsText,
|
|
2918
|
+
optionsText: triggerCall.optionsText
|
|
2878
2919
|
});
|
|
2879
2920
|
}
|
|
2880
2921
|
for (const key of Object.keys(node)) {
|
|
@@ -2950,7 +2991,8 @@ function transformFunctionTriggers(source, workflowNameMap, jobNameMap, workflow
|
|
|
2950
2991
|
} else {
|
|
2951
2992
|
const jobName = jobNameMap.get(call.identifierName);
|
|
2952
2993
|
if (jobName) {
|
|
2953
|
-
const
|
|
2994
|
+
const optionsPart = call.optionsText !== void 0 ? `, ${call.optionsText}` : "";
|
|
2995
|
+
const transformedCall = `(async () => tailor.workflow.triggerJobFunction("${jobName}", ${call.argsText || "undefined"}${optionsPart}))()`;
|
|
2954
2996
|
replacements.push({
|
|
2955
2997
|
start: call.callRange.start,
|
|
2956
2998
|
end: call.callRange.end,
|
|
@@ -4360,7 +4402,7 @@ async function fetchExternalTailorDBTypeNameSources(args) {
|
|
|
4360
4402
|
});
|
|
4361
4403
|
return [tailordbTypes, nextPageToken ?? ""];
|
|
4362
4404
|
} catch (error) {
|
|
4363
|
-
if (error
|
|
4405
|
+
if (isNotFoundError(error)) return [[], ""];
|
|
4364
4406
|
throw error;
|
|
4365
4407
|
}
|
|
4366
4408
|
});
|
|
@@ -5555,7 +5597,8 @@ function transformWorkflowSource(source, targetJobName, targetJobExportName, oth
|
|
|
5555
5597
|
if (isInsideRemovedRange(call.callRange.start)) continue;
|
|
5556
5598
|
const jobName = jobNameMap.get(call.identifierName);
|
|
5557
5599
|
if (jobName) {
|
|
5558
|
-
const
|
|
5600
|
+
const optionsPart = call.optionsText !== void 0 ? `, ${call.optionsText}` : "";
|
|
5601
|
+
const transformedCall = `(async () => tailor.workflow.triggerJobFunction("${jobName}", ${call.argsText || "undefined"}${optionsPart}))()`;
|
|
5559
5602
|
replacements.push({
|
|
5560
5603
|
start: call.callRange.start,
|
|
5561
5604
|
end: call.callRange.end,
|
|
@@ -5812,6 +5855,13 @@ const RetryPolicySchema = z.object({
|
|
|
5812
5855
|
path: ["initialBackoff"]
|
|
5813
5856
|
});
|
|
5814
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
|
+
});
|
|
5815
5865
|
const WorkflowSchema = z.object({
|
|
5816
5866
|
name: z.string().describe("Workflow name"),
|
|
5817
5867
|
mainJob: WorkflowJobSchema.describe("Main job that starts the workflow"),
|
|
@@ -6532,5 +6582,5 @@ async function loadApplication(params) {
|
|
|
6532
6582
|
}
|
|
6533
6583
|
|
|
6534
6584
|
//#endregion
|
|
6535
|
-
export {
|
|
6536
|
-
//# 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
|