@tailor-platform/sdk 1.45.0 → 1.45.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 +8 -0
- package/dist/{actor-CzX_hVOP.d.mts → actor-BmxQeMFP.d.mts} +2 -2
- package/dist/{application-BsSJZRCq.mjs → application-B4zVVNRS.mjs} +26 -26
- package/dist/application-B4zVVNRS.mjs.map +1 -0
- package/dist/application-BIzicxMA.mjs +4 -0
- package/dist/cli/index.mjs +29 -29
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +6 -6
- package/dist/cli/lib.mjs +8 -8
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/{client-DcuQRqSd.mjs → client-BwXkoiMq.mjs} +3 -3
- package/dist/{client-DcuQRqSd.mjs.map → client-BwXkoiMq.mjs.map} +1 -1
- package/dist/{client-IsYnTV5A.mjs → client-DTaArWQr.mjs} +1 -1
- package/dist/configure/index.d.mts +4 -4
- package/dist/{crash-report-DQen2i_W.mjs → crash-report-BUHzuzDn.mjs} +1 -1
- package/dist/{crash-report-DVZsX1bs.mjs → crash-report-CtYCva4d.mjs} +3 -3
- package/dist/{crash-report-DVZsX1bs.mjs.map → crash-report-CtYCva4d.mjs.map} +1 -1
- package/dist/{errors-_M2TVoWh.mjs → errors-wNQxQQBH.mjs} +1 -1
- package/dist/{errors-_M2TVoWh.mjs.map → errors-wNQxQQBH.mjs.map} +1 -1
- package/dist/{file-utils-775qWKoo.mjs → file-utils-DjNi_3U_.mjs} +9 -9
- package/dist/file-utils-DjNi_3U_.mjs.map +1 -0
- package/dist/{index-Bd-0JRjy.d.mts → index-B5_4Tzm2.d.mts} +2 -2
- package/dist/{index-DIz-15Cx.d.mts → index-BBvPd9Uv.d.mts} +2 -2
- package/dist/{index-CemBzf4z.d.mts → index-DUKJPEwq.d.mts} +4 -4
- package/dist/{index-SnYVi8ww.d.mts → index-DV-5OIEv.d.mts} +2 -2
- package/dist/{index-C_f357K2.d.mts → index-Dxe6alSZ.d.mts} +2 -2
- package/dist/{interceptor-4UC-KTno.mjs → interceptor-CrcDfLPq.mjs} +1 -1
- package/dist/{interceptor-4UC-KTno.mjs.map → interceptor-CrcDfLPq.mjs.map} +1 -1
- package/dist/{kysely-type-BQsYEZoY.mjs → kysely-type-B8aRz_oC.mjs} +6 -6
- package/dist/kysely-type-B8aRz_oC.mjs.map +1 -0
- package/dist/multiline-e3IpANmS.mjs +39 -0
- package/dist/multiline-e3IpANmS.mjs.map +1 -0
- package/dist/{package-json-CRzw5eUf.mjs → package-json-6Px8bDpG.mjs} +1 -1
- package/dist/{package-json-CRzw5eUf.mjs.map → package-json-6Px8bDpG.mjs.map} +1 -1
- package/dist/package-json-7sRXVndJ.mjs +4 -0
- package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
- package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
- package/dist/plugin/builtin/file-utils/index.mjs +1 -1
- package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
- package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
- package/dist/plugin/builtin/seed/index.d.mts +1 -1
- package/dist/plugin/builtin/seed/index.mjs +1 -1
- package/dist/plugin/index.d.mts +2 -2
- package/dist/{repl-editor-DjycioU-.mjs → repl-editor-BlT2dFtm.mjs} +1 -1
- package/dist/{repl-editor-DjycioU-.mjs.map → repl-editor-BlT2dFtm.mjs.map} +1 -1
- package/dist/{runtime-Bmq4L9pj.mjs → runtime-D5AJYWnF.mjs} +17 -17
- package/dist/runtime-D5AJYWnF.mjs.map +1 -0
- package/dist/{seed-BkVKgsxf.mjs → seed-DrKY5yIF.mjs} +15 -15
- package/dist/seed-DrKY5yIF.mjs.map +1 -0
- package/dist/{service-CCnx_IFw.mjs → service-CCgw66c6.mjs} +2 -2
- package/dist/{service-CCnx_IFw.mjs.map → service-CCgw66c6.mjs.map} +1 -1
- package/dist/{tailor-db-field-CY1D1PtT.d.mts → tailor-db-field-Hx9OqPWY.d.mts} +1 -1
- package/dist/telemetry-BvI1EgMG.mjs +4 -0
- package/dist/{telemetry-B6Le9XT-.mjs → telemetry-DXitz4RH.mjs} +2 -2
- package/dist/{telemetry-B6Le9XT-.mjs.map → telemetry-DXitz4RH.mjs.map} +1 -1
- package/dist/utils/test/index.d.mts +3 -3
- package/dist/{workflow.generated--YammZcl.d.mts → workflow.generated-DFljpJh7.d.mts} +2 -2
- package/package.json +3 -4
- package/dist/application-BsSJZRCq.mjs.map +0 -1
- package/dist/application-C0O80PUX.mjs +0 -4
- package/dist/file-utils-775qWKoo.mjs.map +0 -1
- package/dist/kysely-type-BQsYEZoY.mjs.map +0 -1
- package/dist/package-json-DR_mqrCW.mjs +0 -4
- package/dist/runtime-Bmq4L9pj.mjs.map +0 -1
- package/dist/seed-BkVKgsxf.mjs.map +0 -1
- package/dist/telemetry-C_WXxIo0.mjs +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @tailor-platform/sdk
|
|
2
2
|
|
|
3
|
+
## 1.45.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1110](https://github.com/tailor-platform/sdk/pull/1110) [`ba93ca3`](https://github.com/tailor-platform/sdk/commit/ba93ca3543c2927857dc79616ec680ed2b008ad1) Thanks [@toiroakr](https://github.com/toiroakr)! - Drop the `multiline-ts` dependency in favour of an in-tree implementation. The upstream package ships a `preinstall: npx only-allow pnpm` hook that, when a fresh copy is resolved (e.g. `npx create-tailor-sdk@latest`), causes npm's exec lock to time out with `ECOMPROMISED`. Replacing the dependency removes that failure path. Also drops `multiline-ts` from the `pnpm-workspace.yaml` `allowBuilds` list emitted by `create-tailor-sdk`.
|
|
8
|
+
|
|
9
|
+
- [#1109](https://github.com/tailor-platform/sdk/pull/1109) [`9965ba5`](https://github.com/tailor-platform/sdk/commit/9965ba5f3aefee43119d979fb827fef0160d618a) Thanks [@toiroakr](https://github.com/toiroakr)! - Fix workflow job bundling to also transform `workflow.trigger()` and `job.trigger()` calls in `.mts`, `.cts`, `.mjs`, and `.cjs` files. Previously the rolldown transform plugin only matched `.ts` and `.js`, so trigger calls in non-default extensions were silently left as raw method calls and failed at runtime. The default-import resolver also strips trailing extensions so `import wf from "./simple.mjs"` resolves to the same workflow as `import wf from "./simple"`.
|
|
10
|
+
|
|
3
11
|
## 1.45.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="@tailor-platform/function-types" />
|
|
2
|
-
import { Bt as InferredAttributeMap, zt as InferredAttributeList } from "./tailor-db-field-
|
|
2
|
+
import { Bt as InferredAttributeMap, zt as InferredAttributeList } from "./tailor-db-field-Hx9OqPWY.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/types/env.d.ts
|
|
5
5
|
interface Env {}
|
|
@@ -27,4 +27,4 @@ type TailorActor = {
|
|
|
27
27
|
};
|
|
28
28
|
//#endregion
|
|
29
29
|
export { Env as n, TailorEnv as r, TailorActor as t };
|
|
30
|
-
//# sourceMappingURL=actor-
|
|
30
|
+
//# sourceMappingURL=actor-BmxQeMFP.d.mts.map
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
|
|
2
|
-
import { u as initOAuth2Client } from "./client-
|
|
2
|
+
import { u as initOAuth2Client } from "./client-BwXkoiMq.mjs";
|
|
3
3
|
import { n as isSdkBranded } from "./brand-Ll48SMXe.mjs";
|
|
4
4
|
import { a as parseBoolean, n as logger, r as styles } from "./logger-DTNAMYGy.mjs";
|
|
5
5
|
import { n as enumConstantsPlugin, t as EnumConstantsGeneratorID } from "./enum-constants-C3KSpsYj.mjs";
|
|
6
|
-
import {
|
|
7
|
-
import { n as
|
|
8
|
-
import { n as
|
|
9
|
-
import { t as
|
|
6
|
+
import { t as multiline } from "./multiline-e3IpANmS.mjs";
|
|
7
|
+
import { n as fileUtilsPlugin, t as FileUtilsGeneratorID } from "./file-utils-DjNi_3U_.mjs";
|
|
8
|
+
import { n as kyselyTypePlugin, t as KyselyGeneratorID } from "./kysely-type-B8aRz_oC.mjs";
|
|
9
|
+
import { n as seedPlugin, r as isPluginGeneratedType, t as SeedGeneratorID } from "./seed-DrKY5yIF.mjs";
|
|
10
|
+
import { t as readPackageJson } from "./package-json-6Px8bDpG.mjs";
|
|
10
11
|
import { createRequire } from "node:module";
|
|
11
12
|
import { z } from "zod";
|
|
12
13
|
import * as fs$1 from "node:fs";
|
|
@@ -14,7 +15,6 @@ import { mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
|
14
15
|
import * as path from "pathe";
|
|
15
16
|
import { join, resolve } from "pathe";
|
|
16
17
|
import { pathToFileURL } from "node:url";
|
|
17
|
-
import ml from "multiline-ts";
|
|
18
18
|
import * as os from "node:os";
|
|
19
19
|
import { parseTOML, parseYAML, stringifyYAML } from "confbox";
|
|
20
20
|
import { findUpSync } from "find-up-simple";
|
|
@@ -252,7 +252,7 @@ async function readPlatformConfig() {
|
|
|
252
252
|
if (typeof version === "number" && version > LATEST_CONFIG_VERSION) {
|
|
253
253
|
const minSdk = "min_sdk_version" in rawConfig ? String(rawConfig.min_sdk_version) : void 0;
|
|
254
254
|
const updateHint = minSdk ? `Please update your SDK to >= ${minSdk}: pnpm update @tailor-platform/sdk` : "Please update your SDK: pnpm update @tailor-platform/sdk";
|
|
255
|
-
throw new Error(
|
|
255
|
+
throw new Error(multiline`
|
|
256
256
|
Config file uses version ${String(version)}, but this SDK only supports up to version ${String(LATEST_CONFIG_VERSION)}.
|
|
257
257
|
${updateHint}
|
|
258
258
|
`);
|
|
@@ -260,7 +260,7 @@ async function readPlatformConfig() {
|
|
|
260
260
|
const v2Result = pfConfigSchemaV2.safeParse(rawConfig);
|
|
261
261
|
if (v2Result.success) {
|
|
262
262
|
if (v2Result.data.latest_min_sdk_version) {
|
|
263
|
-
if (lt((await readPackageJson()).version ?? "0.0.0", v2Result.data.latest_min_sdk_version)) logger.warn(
|
|
263
|
+
if (lt((await readPackageJson()).version ?? "0.0.0", v2Result.data.latest_min_sdk_version)) logger.warn(multiline`
|
|
264
264
|
A newer config version (${String(v2Result.data.latest_version)}) is available.
|
|
265
265
|
Please update your SDK to >= ${v2Result.data.latest_min_sdk_version}: pnpm update @tailor-platform/sdk
|
|
266
266
|
`);
|
|
@@ -269,7 +269,7 @@ async function readPlatformConfig() {
|
|
|
269
269
|
}
|
|
270
270
|
const v1Result = pfConfigSchemaV1.safeParse(rawConfig);
|
|
271
271
|
if (v1Result.success) return migrateV1ToV2(v1Result.data);
|
|
272
|
-
throw new Error(
|
|
272
|
+
throw new Error(multiline`
|
|
273
273
|
Failed to parse config file at ${configPath}.
|
|
274
274
|
The file may be corrupted or created by an incompatible SDK version.
|
|
275
275
|
`);
|
|
@@ -366,7 +366,7 @@ async function loadWorkspaceId(opts) {
|
|
|
366
366
|
if (!wsId) throw new Error(`Profile "${profile}" not found`);
|
|
367
367
|
return validateUUID(wsId, `profile "${profile}"`);
|
|
368
368
|
}
|
|
369
|
-
throw new Error(
|
|
369
|
+
throw new Error(multiline`
|
|
370
370
|
Workspace ID not found.
|
|
371
371
|
Please specify workspace ID via --workspace-id option or TAILOR_PLATFORM_WORKSPACE_ID environment variable.
|
|
372
372
|
`);
|
|
@@ -393,7 +393,7 @@ async function loadAccessToken(opts) {
|
|
|
393
393
|
user = u;
|
|
394
394
|
} else {
|
|
395
395
|
const u = pfConfig.current_user;
|
|
396
|
-
if (!u) throw new Error(
|
|
396
|
+
if (!u) throw new Error(multiline`
|
|
397
397
|
Tailor Platform token not found.
|
|
398
398
|
Please specify token via TAILOR_PLATFORM_TOKEN environment variable or login using 'tailor-sdk login' command.
|
|
399
399
|
`);
|
|
@@ -410,7 +410,7 @@ async function loadAccessToken(opts) {
|
|
|
410
410
|
async function resolveTokens(userEntry, user) {
|
|
411
411
|
if (userEntry.storage === "keyring") {
|
|
412
412
|
const tokens = await loadKeyringTokens(user);
|
|
413
|
-
if (!tokens) throw new Error(
|
|
413
|
+
if (!tokens) throw new Error(multiline`
|
|
414
414
|
Credentials not found in OS keyring for "${user}".
|
|
415
415
|
Please run 'tailor-sdk login' and try again.
|
|
416
416
|
`);
|
|
@@ -460,13 +460,13 @@ async function deleteUserTokens(config, user) {
|
|
|
460
460
|
*/
|
|
461
461
|
async function fetchLatestToken(config, user) {
|
|
462
462
|
const userEntry = config.users[user];
|
|
463
|
-
if (!userEntry) throw new Error(
|
|
463
|
+
if (!userEntry) throw new Error(multiline`
|
|
464
464
|
User "${user}" not found.
|
|
465
465
|
Please verify your user name and login using 'tailor-sdk login' command.
|
|
466
466
|
`);
|
|
467
467
|
const tokens = await resolveTokens(userEntry, user);
|
|
468
468
|
if (new Date(userEntry.token_expires_at) > /* @__PURE__ */ new Date()) return tokens.accessToken;
|
|
469
|
-
if (!tokens.refreshToken) throw new Error(
|
|
469
|
+
if (!tokens.refreshToken) throw new Error(multiline`
|
|
470
470
|
Token expired.
|
|
471
471
|
Please run 'tailor-sdk login' and try again.
|
|
472
472
|
`);
|
|
@@ -479,7 +479,7 @@ async function fetchLatestToken(config, user) {
|
|
|
479
479
|
expiresAt: Date.parse(userEntry.token_expires_at)
|
|
480
480
|
});
|
|
481
481
|
} catch {
|
|
482
|
-
throw new Error(
|
|
482
|
+
throw new Error(multiline`
|
|
483
483
|
Failed to refresh token. Your session may have expired.
|
|
484
484
|
Please run 'tailor-sdk login' and try again.
|
|
485
485
|
`);
|
|
@@ -859,7 +859,7 @@ function generateExecutorFileContentNew(info, executor, outputDir, typeGeneratio
|
|
|
859
859
|
const imports = [];
|
|
860
860
|
for (const [, importInfo] of typeImports) imports.push(`import { ${importInfo.variableName} } from "${importInfo.importPath}";`);
|
|
861
861
|
const contextCode = generateContextCode(context, typeImports);
|
|
862
|
-
return
|
|
862
|
+
return multiline`
|
|
863
863
|
/**
|
|
864
864
|
* Auto-generated executor by plugin: ${info.pluginId}
|
|
865
865
|
* DO NOT EDIT - This file is generated by @tailor-platform/sdk
|
|
@@ -945,7 +945,7 @@ function generateExecutorFileContentLegacy(executor) {
|
|
|
945
945
|
const operationCode = generateOperationCode(executor.operation);
|
|
946
946
|
const injectDeclarations = generateInjectDeclarations(executor.operation.kind === "function" ? executor.operation.inject : void 0);
|
|
947
947
|
const descriptionLine = executor.description ? `\n description: ${JSON.stringify(executor.description)},` : "";
|
|
948
|
-
return
|
|
948
|
+
return multiline`
|
|
949
949
|
/**
|
|
950
950
|
* Auto-generated executor by plugin
|
|
951
951
|
* DO NOT EDIT - This file is generated by @tailor-platform/sdk
|
|
@@ -1180,7 +1180,7 @@ function generateTypeFileContent(info) {
|
|
|
1180
1180
|
const { type, pluginId, sourceTypeName, kind } = info;
|
|
1181
1181
|
const variableName = toCamelCase(type.name);
|
|
1182
1182
|
const fieldsCode = generateFieldsCode(type);
|
|
1183
|
-
return
|
|
1183
|
+
return multiline`
|
|
1184
1184
|
/**
|
|
1185
1185
|
* Auto-generated type by plugin: ${pluginId}
|
|
1186
1186
|
* Source type: ${sourceTypeName}
|
|
@@ -1987,7 +1987,7 @@ function transformFunctionTriggers(source, workflowNameMap, jobNameMap, workflow
|
|
|
1987
1987
|
const currentDir = currentFilePath.replace(/[/\\][^/\\]+$/, "");
|
|
1988
1988
|
for (const [localName, importSource] of defaultImports) {
|
|
1989
1989
|
if (!importSource.startsWith(".")) continue;
|
|
1990
|
-
const resolvedPath = resolvePath(currentDir, importSource);
|
|
1990
|
+
const resolvedPath = resolvePath(currentDir, importSource).replace(/\.(ts|mts|cts|js|mjs|cjs)$/, "");
|
|
1991
1991
|
const workflowName = workflowFileMap.get(resolvedPath);
|
|
1992
1992
|
if (workflowName) {
|
|
1993
1993
|
localWorkflowNameMap.set(localName, workflowName);
|
|
@@ -2125,7 +2125,7 @@ function createTriggerTransformPlugin(triggerContext) {
|
|
|
2125
2125
|
return {
|
|
2126
2126
|
name: "trigger-transform",
|
|
2127
2127
|
transform: {
|
|
2128
|
-
filter: { id: { include: [/\.ts
|
|
2128
|
+
filter: { id: { include: [/\.(ts|mts|cts|js|mjs|cjs)$/] } },
|
|
2129
2129
|
handler(code, id) {
|
|
2130
2130
|
if (!code.includes(".trigger(")) return null;
|
|
2131
2131
|
return { code: transformFunctionTriggers(code, triggerContext.workflowNameMap, triggerContext.jobNameMap, triggerContext.workflowFileMap, id, triggerContext.authNamespace) };
|
|
@@ -2173,7 +2173,7 @@ async function bundleAuthHooks(options) {
|
|
|
2173
2173
|
}),
|
|
2174
2174
|
async build(cachePlugins) {
|
|
2175
2175
|
const entryPath = path.join(outputDir, `${functionName}.entry.js`);
|
|
2176
|
-
const entryContent =
|
|
2176
|
+
const entryContent = multiline`
|
|
2177
2177
|
import _config from "${absoluteConfigPath}";
|
|
2178
2178
|
const __auth_hook_function = _config.${handlerAccessPath};
|
|
2179
2179
|
export { __auth_hook_function as main };
|
|
@@ -3989,7 +3989,7 @@ async function bundleSingleExecutor(executor, outputDir, tsconfig, triggerContex
|
|
|
3989
3989
|
contextHash,
|
|
3990
3990
|
async build(cachePlugins) {
|
|
3991
3991
|
const entryPath = path.join(outputDir, `${executor.name}.entry.js`);
|
|
3992
|
-
const entryContent =
|
|
3992
|
+
const entryContent = multiline`
|
|
3993
3993
|
import _internalExecutor from "${path.resolve(executor.sourceFile)}";
|
|
3994
3994
|
|
|
3995
3995
|
const __executor_function = async (args) => {
|
|
@@ -4186,7 +4186,7 @@ async function bundleSingleResolver(resolver, outputDir, tsconfig, triggerContex
|
|
|
4186
4186
|
contextHash,
|
|
4187
4187
|
async build(cachePlugins) {
|
|
4188
4188
|
const entryPath = path.join(outputDir, `${resolver.name}.entry.js`);
|
|
4189
|
-
const entryContent =
|
|
4189
|
+
const entryContent = multiline`
|
|
4190
4190
|
import _internalResolver from "${path.resolve(resolver.sourceFile)}";
|
|
4191
4191
|
import { t } from "@tailor-platform/sdk";
|
|
4192
4192
|
|
|
@@ -4589,7 +4589,7 @@ async function bundleSingleJob(job, allJobs, outputDir, tsconfig, env, triggerCo
|
|
|
4589
4589
|
async build(cachePlugins) {
|
|
4590
4590
|
const entryPath = path.join(outputDir, `${job.name}.entry.js`);
|
|
4591
4591
|
const absoluteSourcePath = path.resolve(job.sourceFile);
|
|
4592
|
-
const entryContent =
|
|
4592
|
+
const entryContent = multiline`
|
|
4593
4593
|
import { ${job.exportName} } from "${absoluteSourcePath}";
|
|
4594
4594
|
|
|
4595
4595
|
export async function main(input) {
|
|
@@ -4606,7 +4606,7 @@ async function bundleSingleJob(job, allJobs, outputDir, tsconfig, env, triggerCo
|
|
|
4606
4606
|
const plugins = [{
|
|
4607
4607
|
name: "workflow-transform",
|
|
4608
4608
|
transform: {
|
|
4609
|
-
filter: { id: { include: [/\.ts
|
|
4609
|
+
filter: { id: { include: [/\.(ts|mts|cts|js|mjs|cjs)$/] } },
|
|
4610
4610
|
handler(code, id) {
|
|
4611
4611
|
if (!code.includes("createWorkflowJob") && !code.includes("createWorkflow") && !code.includes(".trigger(")) return null;
|
|
4612
4612
|
let transformed = code;
|
|
@@ -5318,4 +5318,4 @@ async function loadApplication(params) {
|
|
|
5318
5318
|
|
|
5319
5319
|
//#endregion
|
|
5320
5320
|
export { loadWorkspaceId as C, writePlatformConfig as D, saveUserTokens as E, loadAccessToken as S, resolveTokens as T, getDistDir as _, WorkflowJobSchema as a, deleteUserTokens as b, ExecutorSchema as c, buildResolverOperationHookExpr as d, OAuth2ClientSchema as f, createBundleCache as g, loadFilesWithIgnores as h, resolveInlineSourcemap as i, INVOKER_EXPR as l, stringifyFunction as m, generatePluginFilesIfNeeded as n, ResolverSchema as o, TailorDBTypeSchema as p, loadApplication as r, createExecutorService as s, defineApplication as t, buildExecutorArgsExpr as u, hashFile as v, readPlatformConfig as w, fetchLatestToken as x, loadConfig as y };
|
|
5321
|
-
//# sourceMappingURL=application-
|
|
5321
|
+
//# sourceMappingURL=application-B4zVVNRS.mjs.map
|