@tailor-platform/sdk 1.46.0 → 1.47.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 +36 -0
- package/dist/{actor-BmxQeMFP.d.mts → actor-DhXSqWTW.d.mts} +2 -2
- package/dist/application-CN9Htzup.mjs +4 -0
- package/dist/{application-B4zVVNRS.mjs → application-TasSqBTD.mjs} +22 -41
- package/dist/application-TasSqBTD.mjs.map +1 -0
- package/dist/cli/index.mjs +33 -15
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +6 -6
- package/dist/cli/lib.mjs +3 -3
- package/dist/{client-BwXkoiMq.mjs → client-COfsXV69.mjs} +31 -120
- package/dist/client-COfsXV69.mjs.map +1 -0
- package/dist/{client-DTaArWQr.mjs → client-DYSkSLRr.mjs} +1 -1
- package/dist/configure/index.d.mts +4 -4
- package/dist/configure/index.mjs +4 -43
- package/dist/configure/index.mjs.map +1 -1
- package/dist/{crashreport-6mcMyWu4.mjs → crashreport-B8lVOx0U.mjs} +1 -1
- package/dist/{crashreport-DGeGj9BF.mjs → crashreport-CKJwnWsX.mjs} +2 -2
- package/dist/{crashreport-DGeGj9BF.mjs.map → crashreport-CKJwnWsX.mjs.map} +1 -1
- package/dist/{index-DV-5OIEv.d.mts → index-BRvNi5q9.d.mts} +2 -2
- package/dist/{index-BBvPd9Uv.d.mts → index-BXyS7xKC.d.mts} +2 -2
- package/dist/{index-Dxe6alSZ.d.mts → index-BbOTbZFf.d.mts} +2 -2
- package/dist/{index-PB0otrDj.d.mts → index-BoU_52Du.d.mts} +4 -4
- package/dist/{index-B5_4Tzm2.d.mts → index-iy-hNfGp.d.mts} +2 -2
- package/dist/{interceptor-CrcDfLPq.mjs → interceptor-CBsqEWDK.mjs} +1 -1
- package/dist/{interceptor-CrcDfLPq.mjs.map → interceptor-CBsqEWDK.mjs.map} +1 -1
- package/dist/mock-BP-9O5On.mjs +796 -0
- package/dist/mock-BP-9O5On.mjs.map +1 -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/kysely-type/index.d.mts +1 -1
- package/dist/plugin/builtin/seed/index.d.mts +1 -1
- package/dist/plugin/index.d.mts +2 -2
- package/dist/{repl-editor-BlT2dFtm.mjs → repl-editor-CZpLlOBj.mjs} +1 -1
- package/dist/{repl-editor-BlT2dFtm.mjs.map → repl-editor-CZpLlOBj.mjs.map} +1 -1
- package/dist/{runtime-B67skpW-.mjs → runtime-DDYL2Zf1.mjs} +86 -8
- package/dist/runtime-DDYL2Zf1.mjs.map +1 -0
- package/dist/{service-CCgw66c6.mjs → service-obEU5gSM.mjs} +1 -1
- package/dist/{service-CCgw66c6.mjs.map → service-obEU5gSM.mjs.map} +1 -1
- package/dist/{tailor-db-field-Hx9OqPWY.d.mts → tailor-db-field-Bn8ZC5lK.d.mts} +1 -1
- package/dist/{schema-DBq6hr6h.mjs → tailordb-Bg9-TZj1.mjs} +42 -2
- package/dist/tailordb-Bg9-TZj1.mjs.map +1 -0
- package/dist/utils/test/index.d.mts +13 -4
- package/dist/utils/test/index.mjs +12 -3
- package/dist/utils/test/index.mjs.map +1 -1
- package/dist/vitest/environment.d.mts +12 -0
- package/dist/vitest/environment.mjs +44 -0
- package/dist/vitest/environment.mjs.map +1 -0
- package/dist/vitest/index.d.mts +345 -0
- package/dist/vitest/index.mjs +350 -0
- package/dist/vitest/index.mjs.map +1 -0
- package/dist/vitest/setup.d.mts +64 -0
- package/dist/vitest/setup.mjs +141 -0
- package/dist/vitest/setup.mjs.map +1 -0
- package/dist/{workflow.generated-DFljpJh7.d.mts → workflow.generated-i7PK4fg-.d.mts} +2 -2
- package/docs/cli/setup.md +1 -0
- package/docs/services/tailordb.md +43 -12
- package/docs/services/workflow.md +1 -1
- package/docs/testing.md +530 -243
- package/package.json +32 -6
- package/dist/application-B4zVVNRS.mjs.map +0 -1
- package/dist/application-Boa_11Nv.mjs +0 -4
- package/dist/client-BwXkoiMq.mjs.map +0 -1
- package/dist/runtime-B67skpW-.mjs.map +0 -1
- package/dist/schema-DBq6hr6h.mjs.map +0 -1
package/dist/cli/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { G as PATScope, R as AuthInvokerSchema, c as fetchUserInfo, d as initOperatorClient, h as userAgent, i as fetchAll, j as FunctionExecution_Type, n as closeConnectionPool, o as fetchPaged, s as fetchPlatformMachineUserToken, u as initOAuth2Client } from "../client-
|
|
3
|
+
import { G as PATScope, R as AuthInvokerSchema, c as fetchUserInfo, d as initOperatorClient, h as userAgent, i as fetchAll, j as FunctionExecution_Type, n as closeConnectionPool, o as fetchPaged, s as fetchPlatformMachineUserToken, u as initOAuth2Client } from "../client-COfsXV69.mjs";
|
|
4
4
|
import { n as logger, r as styles } from "../logger-DTNAMYGy.mjs";
|
|
5
|
-
import { $ as deleteCommand$3, At as executionsCommand, C as listCommand$13, Cn as toPageDirection, Ct as jobsCommand, E as resumeCommand, Et as startCommand, F as showCommand, Ft as getCommand$1, G as getCommand$5, H as treeCommand, I as logBetaWarning, Lt as deploy, N as generateCommand$1, Nt as functionExecutionStatusToString, O as listCommand$12, Ot as getCommand$6, Pt as formatKeyValueTable, R as removeCommand$1, Rt as executeScript, Sn as paginationArgs, T as healthCommand, U as listCommand$11, Vt as parseMigrationLabelNumber, Y as listCommand$10, Z as getCommand$4, Zt as formatMigrationNumber, _n as commonArgs, _t as webhookCommand, at as getCommand$3, b as createCommand$4, bn as isVerbose, bt as listCommand$6, c as listCommand$14, ct as tokenCommand, dn as trnPrefix, dt as generate, en as getMigrationFilePath, f as restoreCommand, ft as listCommand$7, g as getCommand$7, gn as defineAppCommand, i as updateCommand$4, in as loadDiff, j as truncateCommand, ln as getNamespacesWithMigrations, lt as listCommand$8, m as listCommand$15, mn as apiCommand, mt as getCommand$2, o as removeCommand, pn as prompt, q as updateCommand$2, r as queryCommand, rn as isValidMigrationNumber, rt as listCommand$9, t as isNativeTypeScriptRuntime, tn as getMigrationFiles, tt as createCommand$3, u as inviteCommand, un as sdkNameLabelKey, v as deleteCommand$4, vn as confirmationArgs, vt as triggerCommand, wn as workspaceArgs, xn as pagedLogArgs, yn as deploymentArgs, z as updateCommand$3 } from "../runtime-
|
|
6
|
-
import { C as loadWorkspaceId, D as writePlatformConfig, E as saveUserTokens, S as loadAccessToken, T as resolveTokens, _ as getDistDir, a as WorkflowJobSchema, b as deleteUserTokens, c as ExecutorSchema, i as resolveInlineSourcemap, l as INVOKER_EXPR, o as ResolverSchema, w as readPlatformConfig, x as fetchLatestToken, y as loadConfig } from "../application-
|
|
5
|
+
import { $ as deleteCommand$3, At as executionsCommand, C as listCommand$13, Cn as toPageDirection, Ct as jobsCommand, E as resumeCommand, Et as startCommand, F as showCommand, Ft as getCommand$1, G as getCommand$5, H as treeCommand, I as logBetaWarning, Lt as deploy, N as generateCommand$1, Nt as functionExecutionStatusToString, O as listCommand$12, Ot as getCommand$6, Pt as formatKeyValueTable, R as removeCommand$1, Rt as executeScript, Sn as paginationArgs, T as healthCommand, U as listCommand$11, Vt as parseMigrationLabelNumber, Y as listCommand$10, Z as getCommand$4, Zt as formatMigrationNumber, _n as commonArgs, _t as webhookCommand, at as getCommand$3, b as createCommand$4, bn as isVerbose, bt as listCommand$6, c as listCommand$14, ct as tokenCommand, dn as trnPrefix, dt as generate, en as getMigrationFilePath, f as restoreCommand, ft as listCommand$7, g as getCommand$7, gn as defineAppCommand, i as updateCommand$4, in as loadDiff, j as truncateCommand, ln as getNamespacesWithMigrations, lt as listCommand$8, m as listCommand$15, mn as apiCommand, mt as getCommand$2, o as removeCommand, pn as prompt, q as updateCommand$2, r as queryCommand, rn as isValidMigrationNumber, rt as listCommand$9, t as isNativeTypeScriptRuntime, tn as getMigrationFiles, tt as createCommand$3, u as inviteCommand, un as sdkNameLabelKey, v as deleteCommand$4, vn as confirmationArgs, vt as triggerCommand, wn as workspaceArgs, xn as pagedLogArgs, yn as deploymentArgs, z as updateCommand$3 } from "../runtime-DDYL2Zf1.mjs";
|
|
6
|
+
import { C as loadWorkspaceId, D as writePlatformConfig, E as saveUserTokens, S as loadAccessToken, T as resolveTokens, _ as getDistDir, a as WorkflowJobSchema, b as deleteUserTokens, c as ExecutorSchema, i as resolveInlineSourcemap, l as INVOKER_EXPR, o as ResolverSchema, w as readPlatformConfig, x as fetchLatestToken, y as loadConfig } from "../application-TasSqBTD.mjs";
|
|
7
7
|
import { t as multiline } from "../multiline-e3IpANmS.mjs";
|
|
8
8
|
import { t as readPackageJson } from "../package-json-6Px8bDpG.mjs";
|
|
9
9
|
import { n as isCLIError } from "../errors-wNQxQQBH.mjs";
|
|
10
|
-
import { a as JSON_FOOTER_MARKER, i as CRASH_LOG_EXTENSION, o as parseCrashReportConfig, r as sendCrashReport, t as initCrashReporting } from "../crashreport-
|
|
10
|
+
import { a as JSON_FOOTER_MARKER, i as CRASH_LOG_EXTENSION, o as parseCrashReportConfig, r as sendCrashReport, t as initCrashReporting } from "../crashreport-CKJwnWsX.mjs";
|
|
11
11
|
import { createRequire } from "node:module";
|
|
12
12
|
import { arg, defineCommand, runCommand, runMain } from "politty";
|
|
13
13
|
import { withCompletionCommand } from "politty/completion";
|
|
@@ -2458,7 +2458,7 @@ const secretCommand = defineCommand({
|
|
|
2458
2458
|
|
|
2459
2459
|
//#endregion
|
|
2460
2460
|
//#region src/cli/commands/setup/github/deploy.workflow.yml
|
|
2461
|
-
var deploy_workflow_default = "name:
|
|
2461
|
+
var deploy_workflow_default = "name: Tailor Platform\n\non:\n pull_request:\n branches:\n - main\n push:\n branches:\n - main\n workflow_dispatch:\n\nconcurrency:\n group: tailor-__WORKSPACE_NAME__-${{ github.head_ref || github.ref }}\n cancel-in-progress: ${{ github.event_name == 'pull_request' }}\n\njobs:\n # __PLAN_JOB_START__\n plan:\n if: github.event_name == 'pull_request'\n runs-on: ubuntu-latest\n permissions:\n contents: read\n pull-requests: write\n steps:\n - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2\n with:\n fetch-depth: 0\n # __SETUP_STEPS__\n - uses: tailor-platform/actions/plan@e63ed98630a23fa21ee0636abf0f7fb75fcdce40 # v1.1.0\n with:\n workspace-id: ${{ vars.TAILOR_PLATFORM_WORKSPACE_ID }}\n # __WORKING_DIRECTORY__\n platform-client-id: ${{ secrets.PLATFORM_MACHINE_USER_CLIENT_ID }}\n platform-client-secret: ${{ secrets.PLATFORM_MACHINE_USER_CLIENT_SECRET }}\n github-token: ${{ secrets.GITHUB_TOKEN }}\n # __PLAN_JOB_END__\n deploy:\n if: github.event_name != 'pull_request'\n runs-on: ubuntu-latest\n permissions:\n contents: read\n steps:\n - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2\n # __SETUP_STEPS__\n - uses: tailor-platform/actions/deploy@e63ed98630a23fa21ee0636abf0f7fb75fcdce40 # v1.1.0\n with:\n workspace-name: __WORKSPACE_NAME__\n workspace-region: __WORKSPACE_REGION__\n organization-id: __ORGANIZATION_ID__\n folder-id: __FOLDER_ID__\n # __WORKING_DIRECTORY__\n platform-client-id: ${{ secrets.PLATFORM_MACHINE_USER_CLIENT_ID }}\n platform-client-secret: ${{ secrets.PLATFORM_MACHINE_USER_CLIENT_SECRET }}\n";
|
|
2462
2462
|
|
|
2463
2463
|
//#endregion
|
|
2464
2464
|
//#region src/cli/commands/setup/github/setup-bun.yml
|
|
@@ -2501,19 +2501,24 @@ function detectPackageManager(dir) {
|
|
|
2501
2501
|
return "npm";
|
|
2502
2502
|
}
|
|
2503
2503
|
/**
|
|
2504
|
-
* Render the deploy
|
|
2504
|
+
* Render the deploy workflow YAML.
|
|
2505
2505
|
*
|
|
2506
|
-
* Generates a
|
|
2506
|
+
* Generates a workflow that calls the composite deploy action
|
|
2507
2507
|
* from tailor-platform/actions. The environment setup steps (Node.js,
|
|
2508
2508
|
* package manager, dependency install) are generated based on the
|
|
2509
2509
|
* detected package manager.
|
|
2510
|
+
*
|
|
2511
|
+
* If withPlan is true, also includes a plan job that runs on pull requests.
|
|
2512
|
+
* Otherwise, the plan job section delimited by __PLAN_JOB_START__ /
|
|
2513
|
+
* __PLAN_JOB_END__ markers is stripped from the template.
|
|
2510
2514
|
* @param params - Workspace and deployment configuration
|
|
2511
2515
|
* @returns Workflow YAML content
|
|
2512
2516
|
*/
|
|
2513
2517
|
function renderDeploy(params) {
|
|
2514
|
-
const { workspaceName, workspaceRegion, organizationId, folderId, workingDirectory, packageManager } = params;
|
|
2518
|
+
const { workspaceName, workspaceRegion, organizationId, folderId, workingDirectory, packageManager, withPlan } = params;
|
|
2515
2519
|
const workingDirectoryLine = workingDirectory ? ` working-directory: ${workingDirectory}\n` : "";
|
|
2516
|
-
|
|
2520
|
+
const stripPlanSection = (content) => withPlan ? content.replace(/^ *# __PLAN_JOB_(?:START|END)__\n/gm, "") : content.replace(/^ *# __PLAN_JOB_START__\n[\s\S]*?^ *# __PLAN_JOB_END__\n/m, "");
|
|
2521
|
+
return stripPlanSection(deploy_workflow_default).replaceAll("__WORKSPACE_NAME__", () => workspaceName).replaceAll("__WORKSPACE_REGION__", () => workspaceRegion).replaceAll("__ORGANIZATION_ID__", () => organizationId).replaceAll("__FOLDER_ID__", () => folderId).replace(/ *# __WORKING_DIRECTORY__\n/g, () => workingDirectoryLine).replace(/^ *# __SETUP_STEPS__$/gm, () => indentSnippet(setupSteps[packageManager], 6));
|
|
2517
2522
|
}
|
|
2518
2523
|
|
|
2519
2524
|
//#endregion
|
|
@@ -2525,15 +2530,18 @@ function renderDeploy(params) {
|
|
|
2525
2530
|
*/
|
|
2526
2531
|
function buildFiles(options) {
|
|
2527
2532
|
const githubDir = path.join(options.outputDir, ".github");
|
|
2533
|
+
const packageManager = detectPackageManager(options.outputDir);
|
|
2534
|
+
const workingDirectory = options.dir !== "." ? options.dir : void 0;
|
|
2528
2535
|
return [{
|
|
2529
|
-
path: path.join(githubDir, `workflows/
|
|
2536
|
+
path: path.join(githubDir, `workflows/tailor-${options.workspaceName}.yml`),
|
|
2530
2537
|
content: renderDeploy({
|
|
2531
2538
|
workspaceName: options.workspaceName,
|
|
2532
2539
|
workspaceRegion: options.workspaceRegion,
|
|
2533
2540
|
organizationId: options.organizationId,
|
|
2534
2541
|
folderId: options.folderId,
|
|
2535
|
-
workingDirectory
|
|
2536
|
-
packageManager
|
|
2542
|
+
workingDirectory,
|
|
2543
|
+
packageManager,
|
|
2544
|
+
withPlan: options.withPlan
|
|
2537
2545
|
})
|
|
2538
2546
|
}];
|
|
2539
2547
|
}
|
|
@@ -2578,6 +2586,11 @@ function setupGitHub(options) {
|
|
|
2578
2586
|
logger.info("Next steps - set GitHub secrets:");
|
|
2579
2587
|
logger.log(` gh secret set PLATFORM_MACHINE_USER_CLIENT_ID`);
|
|
2580
2588
|
logger.log(` gh secret set PLATFORM_MACHINE_USER_CLIENT_SECRET`);
|
|
2589
|
+
if (options.withPlan) {
|
|
2590
|
+
logger.newline();
|
|
2591
|
+
logger.info("For plan job - set GitHub variable with your workspace ID:");
|
|
2592
|
+
logger.log(` gh variable set TAILOR_PLATFORM_WORKSPACE_ID`);
|
|
2593
|
+
}
|
|
2581
2594
|
}
|
|
2582
2595
|
|
|
2583
2596
|
//#endregion
|
|
@@ -2605,6 +2618,10 @@ const githubCommand = defineAppCommand({
|
|
|
2605
2618
|
dir: arg(z.string().default("."), {
|
|
2606
2619
|
alias: "d",
|
|
2607
2620
|
description: "App directory (for monorepo setups)"
|
|
2621
|
+
}),
|
|
2622
|
+
"with-plan": arg(z.boolean().default(false), {
|
|
2623
|
+
alias: "p",
|
|
2624
|
+
description: "Include plan job for PR previews"
|
|
2608
2625
|
})
|
|
2609
2626
|
}).strict(),
|
|
2610
2627
|
run: (args) => {
|
|
@@ -2614,7 +2631,8 @@ const githubCommand = defineAppCommand({
|
|
|
2614
2631
|
organizationId: args["organization-id"],
|
|
2615
2632
|
folderId: args["folder-id"],
|
|
2616
2633
|
dir: args.dir,
|
|
2617
|
-
outputDir: process.cwd()
|
|
2634
|
+
outputDir: process.cwd(),
|
|
2635
|
+
withPlan: args["with-plan"]
|
|
2618
2636
|
});
|
|
2619
2637
|
}
|
|
2620
2638
|
});
|
|
@@ -3755,7 +3773,7 @@ const upgradeCommand = defineAppCommand({
|
|
|
3755
3773
|
run: async (args) => {
|
|
3756
3774
|
const { initTelemetry } = await import("../telemetry-21afNV9_.mjs");
|
|
3757
3775
|
await initTelemetry();
|
|
3758
|
-
const { upgrade } = await import("../service-
|
|
3776
|
+
const { upgrade } = await import("../service-obEU5gSM.mjs");
|
|
3759
3777
|
await upgrade({
|
|
3760
3778
|
from: args.from,
|
|
3761
3779
|
dryRun: args["dry-run"],
|
|
@@ -4171,7 +4189,7 @@ runMain(mainCommand, {
|
|
|
4171
4189
|
if (isVerbose() && error.stack) logger.debug(`\nStack trace:\n${error.stack}`);
|
|
4172
4190
|
} else logger.error(`Unknown error: ${error}`);
|
|
4173
4191
|
if (!isCLIError(error) && (!(error instanceof Error) || error instanceof TypeError || error instanceof RangeError)) {
|
|
4174
|
-
const { reportCrash } = await import("../crashreport-
|
|
4192
|
+
const { reportCrash } = await import("../crashreport-B8lVOx0U.mjs");
|
|
4175
4193
|
await reportCrash(error, "handledError");
|
|
4176
4194
|
}
|
|
4177
4195
|
}
|