@tailor-platform/sdk 1.45.2 → 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 +66 -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 +101 -61
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +13 -13
- package/dist/cli/lib.mjs +4 -4
- package/dist/cli/lib.mjs.map +1 -1
- 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/{crash-report-BUHzuzDn.mjs → crashreport-B8lVOx0U.mjs} +1 -1
- package/dist/{crash-report-CtYCva4d.mjs → crashreport-CKJwnWsX.mjs} +9 -9
- package/dist/crashreport-CKJwnWsX.mjs.map +1 -0
- 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-DUKJPEwq.d.mts → index-BoU_52Du.d.mts} +6 -6
- 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-D97Ydu2S.mjs → runtime-DDYL2Zf1.mjs} +148 -70
- 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/telemetry-21afNV9_.mjs +4 -0
- package/dist/{telemetry-DXitz4RH.mjs → telemetry-DcL8Fsm_.mjs} +1 -1
- package/dist/{telemetry-DXitz4RH.mjs.map → telemetry-DcL8Fsm_.mjs.map} +1 -1
- 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/application.md +19 -17
- package/docs/cli/crashreport.md +119 -0
- package/docs/cli/executor.md +9 -9
- package/docs/cli/function.md +5 -5
- package/docs/cli/setup.md +1 -0
- package/docs/cli/tailordb.md +1 -1
- package/docs/cli/workflow.md +8 -8
- package/docs/cli-reference.md +8 -8
- package/docs/quickstart.md +2 -2
- package/docs/services/auth.md +2 -2
- package/docs/services/secret.md +4 -4
- package/docs/services/tailordb-migration.md +10 -10
- package/docs/services/tailordb.md +44 -13
- 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-BIzicxMA.mjs +0 -4
- package/dist/client-BwXkoiMq.mjs.map +0 -1
- package/dist/crash-report-CtYCva4d.mjs.map +0 -1
- package/dist/runtime-D97Ydu2S.mjs.map +0 -1
- package/dist/schema-DBq6hr6h.mjs.map +0 -1
- package/dist/telemetry-BvI1EgMG.mjs +0 -4
- package/docs/cli/crash-report.md +0 -118
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
|
-
import { $ as FilterSchema, A as FunctionExecution_Status, B as AuthOAuth2Client_GrantType, C as TailorDBType_Permission_Operator, D as IdPLang, E as PipelineResolver_OperationType, F as AuthConnection_Type, H as AuthSCIMAttribute_Type, I as AuthHookPoint, J as GetApplicationSchemaHealthResponse_ApplicationSchemaHealthStatus, K as TenantProviderConfig_TenantProviderType, L as AuthIDPConfig_AuthType, M as ExecutorJobStatus, N as ExecutorTargetType, O as IdPPermissionOperator, P as ExecutorTriggerType, Q as Condition_Operator, R as AuthInvokerSchema, S as TailorDBGQLPermission_Permit, T as TailorDBType_PermitAction, U as AuthSCIMAttribute_Uniqueness, V as AuthSCIMAttribute_Mutability, W as AuthSCIMConfig_AuthorizationType, X as Subgraph_ServiceType, Y as ApplicationSchemaUpdateAttemptStatus, Z as ConditionSchema, _ as WorkspacePlatformUserRole, a as fetchMachineUserToken, b as TailorDBGQLPermission_Action, d as initOperatorClient, et as PageDirection, g as OperatorService, h as userAgent, i as fetchAll, k as IdPPermissionPermit, m as resolveStaticWebsiteUrls, o as fetchPaged, p as platformBaseUrl, q as UserProfileProviderConfig_UserProfileProviderType, v as WorkflowExecution_Status, w as TailorDBType_Permission_Permit, x as TailorDBGQLPermission_Operator, y as WorkflowJobExecution_Status, z as AuthOAuth2Client_ClientType } from "./client-
|
|
3
|
-
import {
|
|
2
|
+
import { $ as FilterSchema, A as FunctionExecution_Status, B as AuthOAuth2Client_GrantType, C as TailorDBType_Permission_Operator, D as IdPLang, E as PipelineResolver_OperationType, F as AuthConnection_Type, H as AuthSCIMAttribute_Type, I as AuthHookPoint, J as GetApplicationSchemaHealthResponse_ApplicationSchemaHealthStatus, K as TenantProviderConfig_TenantProviderType, L as AuthIDPConfig_AuthType, M as ExecutorJobStatus, N as ExecutorTargetType, O as IdPPermissionOperator, P as ExecutorTriggerType, Q as Condition_Operator, R as AuthInvokerSchema, S as TailorDBGQLPermission_Permit, T as TailorDBType_PermitAction, U as AuthSCIMAttribute_Uniqueness, V as AuthSCIMAttribute_Mutability, W as AuthSCIMConfig_AuthorizationType, X as Subgraph_ServiceType, Y as ApplicationSchemaUpdateAttemptStatus, Z as ConditionSchema, _ as WorkspacePlatformUserRole, a as fetchMachineUserToken, b as TailorDBGQLPermission_Action, d as initOperatorClient, et as PageDirection, g as OperatorService, h as userAgent, i as fetchAll, k as IdPPermissionPermit, m as resolveStaticWebsiteUrls, o as fetchPaged, p as platformBaseUrl, q as UserProfileProviderConfig_UserProfileProviderType, v as WorkflowExecution_Status, w as TailorDBType_Permission_Permit, x as TailorDBGQLPermission_Operator, y as WorkflowJobExecution_Status, z as AuthOAuth2Client_ClientType } from "./client-COfsXV69.mjs";
|
|
3
|
+
import { r as db } from "./tailordb-Bg9-TZj1.mjs";
|
|
4
4
|
import { a as parseBoolean, i as symbols, n as logger, r as styles, t as CIPromptError } from "./logger-DTNAMYGy.mjs";
|
|
5
|
-
import { C as loadWorkspaceId, D as writePlatformConfig, S as loadAccessToken, _ as getDistDir, d as buildResolverOperationHookExpr, f as OAuth2ClientSchema, g as createBundleCache, h as loadFilesWithIgnores, m as stringifyFunction, n as generatePluginFilesIfNeeded, p as TailorDBTypeSchema, r as loadApplication, s as createExecutorService, t as defineApplication, u as buildExecutorArgsExpr, v as hashFile, w as readPlatformConfig, y as loadConfig } from "./application-
|
|
5
|
+
import { C as loadWorkspaceId, D as writePlatformConfig, S as loadAccessToken, _ as getDistDir, d as buildResolverOperationHookExpr, f as OAuth2ClientSchema, g as createBundleCache, h as loadFilesWithIgnores, m as stringifyFunction, n as generatePluginFilesIfNeeded, p as TailorDBTypeSchema, r as loadApplication, s as createExecutorService, t as defineApplication, u as buildExecutorArgsExpr, v as hashFile, w as readPlatformConfig, y as loadConfig } from "./application-TasSqBTD.mjs";
|
|
6
6
|
import { t as multiline } from "./multiline-e3IpANmS.mjs";
|
|
7
7
|
import { t as readPackageJson } from "./package-json-6Px8bDpG.mjs";
|
|
8
8
|
import { n as isCLIError, t as createCLIError } from "./errors-wNQxQQBH.mjs";
|
|
9
|
-
import { r as withSpan } from "./telemetry-
|
|
9
|
+
import { r as withSpan } from "./telemetry-DcL8Fsm_.mjs";
|
|
10
10
|
import { arg, createDefineCommand, defineCommand, runCommand } from "politty";
|
|
11
11
|
import { z } from "zod";
|
|
12
12
|
import * as fs$1 from "node:fs";
|
|
@@ -25,13 +25,13 @@ import * as crypto from "node:crypto";
|
|
|
25
25
|
import { createHash } from "node:crypto";
|
|
26
26
|
import { resolveTSConfig } from "pkg-types";
|
|
27
27
|
import { ScalarType, create, fromJson, toJson } from "@bufbuild/protobuf";
|
|
28
|
+
import { ExitPromptError } from "@inquirer/core";
|
|
29
|
+
import { confirm, input, password } from "@inquirer/prompts";
|
|
30
|
+
import { isCI } from "std-env";
|
|
28
31
|
import * as rolldown from "rolldown";
|
|
29
32
|
import * as fs from "node:fs/promises";
|
|
30
33
|
import { glob } from "node:fs/promises";
|
|
31
34
|
import * as inflection from "inflection";
|
|
32
|
-
import { ExitPromptError } from "@inquirer/core";
|
|
33
|
-
import { confirm, input, password } from "@inquirer/prompts";
|
|
34
|
-
import { isCI } from "std-env";
|
|
35
35
|
import { setTimeout as setTimeout$1 } from "timers/promises";
|
|
36
36
|
import { spawn } from "node:child_process";
|
|
37
37
|
import { watch } from "chokidar";
|
|
@@ -598,6 +598,30 @@ Values already present in \`--body\` are never overridden. If a value cannot be
|
|
|
598
598
|
}
|
|
599
599
|
});
|
|
600
600
|
|
|
601
|
+
//#endregion
|
|
602
|
+
//#region src/cli/shared/prompt.ts
|
|
603
|
+
/**
|
|
604
|
+
* Wraps a prompt function with CI guard and cancellation handling.
|
|
605
|
+
* @param fn - A prompt function from `@inquirer/prompts`
|
|
606
|
+
* @returns A wrapped function that throws in CI and exits on cancel
|
|
607
|
+
*/
|
|
608
|
+
function withGuard(fn) {
|
|
609
|
+
return async (...args) => {
|
|
610
|
+
if (isCI) throw new CIPromptError();
|
|
611
|
+
try {
|
|
612
|
+
return await fn(...args);
|
|
613
|
+
} catch (error) {
|
|
614
|
+
if (error instanceof ExitPromptError) process.exit(130);
|
|
615
|
+
throw error;
|
|
616
|
+
}
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
const prompt = {
|
|
620
|
+
confirm: withGuard(confirm),
|
|
621
|
+
text: withGuard(input),
|
|
622
|
+
password: withGuard(password)
|
|
623
|
+
};
|
|
624
|
+
|
|
601
625
|
//#endregion
|
|
602
626
|
//#region src/cli/cache/types.ts
|
|
603
627
|
const cacheOutputFileSchema = z.object({
|
|
@@ -812,7 +836,7 @@ ${machineUserFields}
|
|
|
812
836
|
return multiline`
|
|
813
837
|
// This file is auto-generated by @tailor-platform/sdk
|
|
814
838
|
// Do not edit this file manually
|
|
815
|
-
// Regenerated automatically when running 'tailor-sdk
|
|
839
|
+
// Regenerated automatically when running 'tailor-sdk deploy' or 'tailor-sdk generate'
|
|
816
840
|
|
|
817
841
|
declare module "@tailor-platform/sdk" {
|
|
818
842
|
interface AttributeMap ${mapBody}
|
|
@@ -1098,6 +1122,66 @@ var PluginManager = class {
|
|
|
1098
1122
|
return results;
|
|
1099
1123
|
}
|
|
1100
1124
|
/**
|
|
1125
|
+
* Run every plugin attachment for a single TailorDB type in order, threading the
|
|
1126
|
+
* extended type through the chain. Returns plain data (no logging, no shared state)
|
|
1127
|
+
* so the caller decides how to apply updates and render progress.
|
|
1128
|
+
* @param params - The raw type, its attachments, and the target namespace
|
|
1129
|
+
* @returns Final extended type (if any), generated types, and render events
|
|
1130
|
+
*/
|
|
1131
|
+
async processAttachmentsForType(params) {
|
|
1132
|
+
const { rawType, attachments, namespace } = params;
|
|
1133
|
+
let currentType = rawType;
|
|
1134
|
+
let extendedType;
|
|
1135
|
+
const generatedTypes = [];
|
|
1136
|
+
const events = [];
|
|
1137
|
+
for (const attachment of attachments) {
|
|
1138
|
+
const result = await this.processAttachment({
|
|
1139
|
+
type: currentType,
|
|
1140
|
+
typeConfig: attachment.config,
|
|
1141
|
+
namespace,
|
|
1142
|
+
pluginId: attachment.pluginId
|
|
1143
|
+
});
|
|
1144
|
+
if (!result.success) throw new Error(result.error);
|
|
1145
|
+
const output = result.output;
|
|
1146
|
+
const extendFields = output.extends?.fields;
|
|
1147
|
+
if (extendFields && Object.keys(extendFields).length > 0) {
|
|
1148
|
+
currentType = this.extendType({
|
|
1149
|
+
originalType: currentType,
|
|
1150
|
+
extendFields,
|
|
1151
|
+
pluginId: attachment.pluginId
|
|
1152
|
+
});
|
|
1153
|
+
extendedType = currentType;
|
|
1154
|
+
events.push({
|
|
1155
|
+
kind: "extended",
|
|
1156
|
+
typeName: currentType.name,
|
|
1157
|
+
fieldCount: Object.keys(extendFields).length,
|
|
1158
|
+
pluginId: attachment.pluginId
|
|
1159
|
+
});
|
|
1160
|
+
}
|
|
1161
|
+
const plugin = this.getPlugin(attachment.pluginId);
|
|
1162
|
+
for (const [kind, gen] of Object.entries(output.types ?? {})) {
|
|
1163
|
+
generatedTypes.push({
|
|
1164
|
+
typeName: gen.name,
|
|
1165
|
+
type: gen,
|
|
1166
|
+
kind,
|
|
1167
|
+
pluginId: attachment.pluginId,
|
|
1168
|
+
pluginImportPath: this.getPluginImportPath(attachment.pluginId) ?? "",
|
|
1169
|
+
pluginConfig: plugin?.pluginConfig
|
|
1170
|
+
});
|
|
1171
|
+
events.push({
|
|
1172
|
+
kind: "generated",
|
|
1173
|
+
typeName: gen.name,
|
|
1174
|
+
pluginId: attachment.pluginId
|
|
1175
|
+
});
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
return {
|
|
1179
|
+
extendedType,
|
|
1180
|
+
generatedTypes,
|
|
1181
|
+
events
|
|
1182
|
+
};
|
|
1183
|
+
}
|
|
1184
|
+
/**
|
|
1101
1185
|
* Get plugins that have onNamespaceLoaded method
|
|
1102
1186
|
* @returns Array of plugin IDs that support namespace processing
|
|
1103
1187
|
*/
|
|
@@ -1239,7 +1323,7 @@ function copyMetadataToExtendedType(original, extended) {
|
|
|
1239
1323
|
}
|
|
1240
1324
|
|
|
1241
1325
|
//#endregion
|
|
1242
|
-
//#region src/cli/commands/
|
|
1326
|
+
//#region src/cli/commands/deploy/change-set.ts
|
|
1243
1327
|
/**
|
|
1244
1328
|
* Create a new ChangeSet for tracking resource changes.
|
|
1245
1329
|
* @param title - Title for the change set
|
|
@@ -1308,7 +1392,7 @@ function formatPlanSummary(summary) {
|
|
|
1308
1392
|
}
|
|
1309
1393
|
|
|
1310
1394
|
//#endregion
|
|
1311
|
-
//#region src/cli/commands/
|
|
1395
|
+
//#region src/cli/commands/deploy/compare.ts
|
|
1312
1396
|
/**
|
|
1313
1397
|
* Stable JSON-like serialization that sorts object keys and ignores proto runtime metadata.
|
|
1314
1398
|
* @param value - Value to serialize
|
|
@@ -1348,7 +1432,7 @@ function areNormalizedEqual(left, right) {
|
|
|
1348
1432
|
}
|
|
1349
1433
|
|
|
1350
1434
|
//#endregion
|
|
1351
|
-
//#region src/cli/commands/
|
|
1435
|
+
//#region src/cli/commands/deploy/label.ts
|
|
1352
1436
|
/**
|
|
1353
1437
|
* Build TRN prefix for a workspace.
|
|
1354
1438
|
* @param workspaceId - Workspace ID
|
|
@@ -1389,7 +1473,7 @@ async function buildMetaRequest(trn, appName, existingLabels) {
|
|
|
1389
1473
|
}
|
|
1390
1474
|
|
|
1391
1475
|
//#endregion
|
|
1392
|
-
//#region src/cli/commands/
|
|
1476
|
+
//#region src/cli/commands/deploy/application.ts
|
|
1393
1477
|
/**
|
|
1394
1478
|
* Apply application changes for the given phase.
|
|
1395
1479
|
* @param client - Operator client instance
|
|
@@ -1572,7 +1656,7 @@ function protoSubgraph(subgraph) {
|
|
|
1572
1656
|
}
|
|
1573
1657
|
|
|
1574
1658
|
//#endregion
|
|
1575
|
-
//#region src/cli/commands/
|
|
1659
|
+
//#region src/cli/commands/deploy/secrets-state.ts
|
|
1576
1660
|
const SecretsStateSchema = z.object({
|
|
1577
1661
|
vaults: z.record(z.string(), z.record(z.string(), z.string())),
|
|
1578
1662
|
connections: z.record(z.string(), z.string()).optional()
|
|
@@ -1617,7 +1701,7 @@ function hashValue(value) {
|
|
|
1617
1701
|
}
|
|
1618
1702
|
|
|
1619
1703
|
//#endregion
|
|
1620
|
-
//#region src/cli/commands/
|
|
1704
|
+
//#region src/cli/commands/deploy/auth-connection.ts
|
|
1621
1705
|
function connectionTrn(workspaceId, name) {
|
|
1622
1706
|
return `${trnPrefix(workspaceId)}:auth-connection:${name}`;
|
|
1623
1707
|
}
|
|
@@ -1842,7 +1926,7 @@ async function applyAuthConnections(client, result, phase) {
|
|
|
1842
1926
|
}
|
|
1843
1927
|
|
|
1844
1928
|
//#endregion
|
|
1845
|
-
//#region src/cli/commands/
|
|
1929
|
+
//#region src/cli/commands/deploy/function-registry.ts
|
|
1846
1930
|
const CHUNK_SIZE = 64 * 1024;
|
|
1847
1931
|
/**
|
|
1848
1932
|
* Compute SHA-256 content hash for a script string.
|
|
@@ -2169,7 +2253,7 @@ async function applyFunctionRegistry(client, workspaceId, result, phase = "creat
|
|
|
2169
2253
|
}
|
|
2170
2254
|
|
|
2171
2255
|
//#endregion
|
|
2172
|
-
//#region src/cli/commands/
|
|
2256
|
+
//#region src/cli/commands/deploy/grouped-display.ts
|
|
2173
2257
|
/**
|
|
2174
2258
|
* Convert grouped function registry changes into mutable name sets.
|
|
2175
2259
|
* @param changes - Grouped function registry changes
|
|
@@ -2484,7 +2568,7 @@ function parseIdPPermission(rawPermission) {
|
|
|
2484
2568
|
}
|
|
2485
2569
|
|
|
2486
2570
|
//#endregion
|
|
2487
|
-
//#region src/cli/commands/
|
|
2571
|
+
//#region src/cli/commands/deploy/idp.ts
|
|
2488
2572
|
/**
|
|
2489
2573
|
* Build the vault name for an IdP client.
|
|
2490
2574
|
* @param namespaceName - IdP namespace name
|
|
@@ -2945,7 +3029,7 @@ function protoIdPOperand(operand) {
|
|
|
2945
3029
|
}
|
|
2946
3030
|
|
|
2947
3031
|
//#endregion
|
|
2948
|
-
//#region src/cli/commands/
|
|
3032
|
+
//#region src/cli/commands/deploy/auth.ts
|
|
2949
3033
|
/**
|
|
2950
3034
|
* Apply auth-related changes for the given phase.
|
|
2951
3035
|
* @param client - Operator client instance
|
|
@@ -4076,31 +4160,7 @@ async function planAuthHooks(client, workspaceId, auths, deletedServices, forceA
|
|
|
4076
4160
|
}
|
|
4077
4161
|
|
|
4078
4162
|
//#endregion
|
|
4079
|
-
//#region src/cli/
|
|
4080
|
-
/**
|
|
4081
|
-
* Wraps a prompt function with CI guard and cancellation handling.
|
|
4082
|
-
* @param fn - A prompt function from `@inquirer/prompts`
|
|
4083
|
-
* @returns A wrapped function that throws in CI and exits on cancel
|
|
4084
|
-
*/
|
|
4085
|
-
function withGuard(fn) {
|
|
4086
|
-
return async (...args) => {
|
|
4087
|
-
if (isCI) throw new CIPromptError();
|
|
4088
|
-
try {
|
|
4089
|
-
return await fn(...args);
|
|
4090
|
-
} catch (error) {
|
|
4091
|
-
if (error instanceof ExitPromptError) process.exit(130);
|
|
4092
|
-
throw error;
|
|
4093
|
-
}
|
|
4094
|
-
};
|
|
4095
|
-
}
|
|
4096
|
-
const prompt = {
|
|
4097
|
-
confirm: withGuard(confirm),
|
|
4098
|
-
text: withGuard(input),
|
|
4099
|
-
password: withGuard(password)
|
|
4100
|
-
};
|
|
4101
|
-
|
|
4102
|
-
//#endregion
|
|
4103
|
-
//#region src/cli/commands/apply/confirm.ts
|
|
4163
|
+
//#region src/cli/commands/deploy/confirm.ts
|
|
4104
4164
|
/**
|
|
4105
4165
|
* Confirm reassignment of resources when owner conflicts are detected.
|
|
4106
4166
|
* @param conflicts - Detected owner conflicts
|
|
@@ -4185,7 +4245,7 @@ async function confirmImportantResourceDeletion(resources, yes) {
|
|
|
4185
4245
|
}
|
|
4186
4246
|
|
|
4187
4247
|
//#endregion
|
|
4188
|
-
//#region src/cli/commands/
|
|
4248
|
+
//#region src/cli/commands/deploy/auth-invoker.ts
|
|
4189
4249
|
/**
|
|
4190
4250
|
* Normalize an authInvoker value to the object form required by the proto payload.
|
|
4191
4251
|
*
|
|
@@ -4211,7 +4271,7 @@ function normalizeAuthInvoker(authInvoker, authNamespace, context) {
|
|
|
4211
4271
|
}
|
|
4212
4272
|
|
|
4213
4273
|
//#endregion
|
|
4214
|
-
//#region src/cli/commands/
|
|
4274
|
+
//#region src/cli/commands/deploy/executor.ts
|
|
4215
4275
|
/**
|
|
4216
4276
|
* Apply executor-related changes for the given phase.
|
|
4217
4277
|
* @param client - Operator client instance
|
|
@@ -4589,7 +4649,7 @@ function protoExecutor(application, executor) {
|
|
|
4589
4649
|
}
|
|
4590
4650
|
|
|
4591
4651
|
//#endregion
|
|
4592
|
-
//#region src/cli/commands/
|
|
4652
|
+
//#region src/cli/commands/deploy/resolver.ts
|
|
4593
4653
|
const SCALAR_TYPE_MAP = {
|
|
4594
4654
|
uuid: {
|
|
4595
4655
|
kind: "ScalarType",
|
|
@@ -4960,7 +5020,7 @@ function protoFields(fields, baseName, isInput) {
|
|
|
4960
5020
|
}
|
|
4961
5021
|
|
|
4962
5022
|
//#endregion
|
|
4963
|
-
//#region src/cli/commands/
|
|
5023
|
+
//#region src/cli/commands/deploy/secret-manager.ts
|
|
4964
5024
|
/**
|
|
4965
5025
|
* Plan secret manager changes based on current and desired state.
|
|
4966
5026
|
* @param context - Planning context
|
|
@@ -5181,7 +5241,7 @@ async function applySecretManager(client, result, phase = "create-update", appli
|
|
|
5181
5241
|
}
|
|
5182
5242
|
|
|
5183
5243
|
//#endregion
|
|
5184
|
-
//#region src/cli/commands/
|
|
5244
|
+
//#region src/cli/commands/deploy/staticwebsite.ts
|
|
5185
5245
|
/**
|
|
5186
5246
|
* Apply static website changes for the given phase.
|
|
5187
5247
|
* @param client - Operator client instance
|
|
@@ -5521,6 +5581,22 @@ const DB_TYPES_FILE_NAME = "db.ts";
|
|
|
5521
5581
|
*/
|
|
5522
5582
|
const MIGRATION_NUMBER_PATTERN = /^\d{4}$/;
|
|
5523
5583
|
/**
|
|
5584
|
+
* Platform default scale for decimal fields when scale is not explicitly specified.
|
|
5585
|
+
* Must stay in sync with the platform's default decimal scale.
|
|
5586
|
+
*/
|
|
5587
|
+
const DEFAULT_DECIMAL_SCALE = 6;
|
|
5588
|
+
/**
|
|
5589
|
+
* Resolve the effective scale of a field for comparison purposes.
|
|
5590
|
+
* Decimal fields without an explicit scale are stored on the platform with the
|
|
5591
|
+
* default scale, so we normalize unset values to the default to avoid false drift.
|
|
5592
|
+
* @param {SnapshotFieldConfig} field - Field configuration
|
|
5593
|
+
* @returns {number | undefined} Effective scale, or undefined for non-decimal fields without scale
|
|
5594
|
+
*/
|
|
5595
|
+
function getEffectiveScale(field) {
|
|
5596
|
+
if (field.scale !== void 0) return field.scale;
|
|
5597
|
+
if (field.type === "decimal") return 6;
|
|
5598
|
+
}
|
|
5599
|
+
/**
|
|
5524
5600
|
* Validate that a migration number follows the expected format (4-digit number)
|
|
5525
5601
|
* @param {string} numberStr - Migration number string to validate
|
|
5526
5602
|
* @returns {boolean} True if number matches expected format
|
|
@@ -6037,7 +6113,7 @@ function areFieldsDifferent(oldField, newField) {
|
|
|
6037
6113
|
if (oldSerial.maxValue !== newSerial.maxValue) return true;
|
|
6038
6114
|
if ((oldSerial.format ?? "") !== (newSerial.format ?? "")) return true;
|
|
6039
6115
|
}
|
|
6040
|
-
if (oldField
|
|
6116
|
+
if (getEffectiveScale(oldField) !== getEffectiveScale(newField)) return true;
|
|
6041
6117
|
const oldFields = oldField.fields ?? {};
|
|
6042
6118
|
const newFields = newField.fields ?? {};
|
|
6043
6119
|
const oldFieldNames = Object.keys(oldFields);
|
|
@@ -6505,7 +6581,9 @@ function compareFields(typeName, fieldName, remoteField, snapshotField) {
|
|
|
6505
6581
|
const remoteVector = remoteField.vector ?? false;
|
|
6506
6582
|
const snapshotVector = snapshotField.vector ?? false;
|
|
6507
6583
|
if (remoteVector !== snapshotVector) differences.push(`vector: remote=${remoteVector}, expected=${snapshotVector}`);
|
|
6508
|
-
|
|
6584
|
+
const remoteScale = getEffectiveScale(remoteField);
|
|
6585
|
+
const snapshotScale = getEffectiveScale(snapshotField);
|
|
6586
|
+
if (remoteScale !== snapshotScale) differences.push(`scale: remote=${remoteScale}, expected=${snapshotScale}`);
|
|
6509
6587
|
if (differences.length > 0) return {
|
|
6510
6588
|
typeName,
|
|
6511
6589
|
kind: "field_mismatch",
|
|
@@ -6926,7 +7004,7 @@ function spinner(options) {
|
|
|
6926
7004
|
}
|
|
6927
7005
|
|
|
6928
7006
|
//#endregion
|
|
6929
|
-
//#region src/cli/commands/
|
|
7007
|
+
//#region src/cli/commands/deploy/tailordb/migration.ts
|
|
6930
7008
|
/**
|
|
6931
7009
|
* Migration execution service for TailorDB migrations
|
|
6932
7010
|
*
|
|
@@ -7101,7 +7179,7 @@ function groupMigrationsByNamespace(migrations) {
|
|
|
7101
7179
|
}
|
|
7102
7180
|
|
|
7103
7181
|
//#endregion
|
|
7104
|
-
//#region src/cli/commands/
|
|
7182
|
+
//#region src/cli/commands/deploy/tailordb/index.ts
|
|
7105
7183
|
/**
|
|
7106
7184
|
* Fetch all TailorDB types from remote for a namespace
|
|
7107
7185
|
* @param {OperatorClient} client - Operator client instance
|
|
@@ -8347,7 +8425,7 @@ function formatMigrationCheckResults(results) {
|
|
|
8347
8425
|
}
|
|
8348
8426
|
|
|
8349
8427
|
//#endregion
|
|
8350
|
-
//#region src/cli/commands/
|
|
8428
|
+
//#region src/cli/commands/deploy/workflow.ts
|
|
8351
8429
|
/**
|
|
8352
8430
|
* Apply workflow changes for the given phase.
|
|
8353
8431
|
* @param client - Operator client instance
|
|
@@ -8636,7 +8714,7 @@ function normalizeRetryPolicyForCompare(policy) {
|
|
|
8636
8714
|
}
|
|
8637
8715
|
|
|
8638
8716
|
//#endregion
|
|
8639
|
-
//#region src/cli/commands/
|
|
8717
|
+
//#region src/cli/commands/deploy/deploy.ts
|
|
8640
8718
|
function applicationTrn(workspaceId, name) {
|
|
8641
8719
|
return `trn:v1:workspace:${workspaceId}:application:${name}`;
|
|
8642
8720
|
}
|
|
@@ -8816,13 +8894,13 @@ function summarizePlanResults(results, displayEntries, serviceActions) {
|
|
|
8816
8894
|
return summary;
|
|
8817
8895
|
}
|
|
8818
8896
|
/**
|
|
8819
|
-
*
|
|
8820
|
-
* @param options - Options for
|
|
8897
|
+
* Deploy the configured application to the Tailor platform.
|
|
8898
|
+
* @param options - Options for deploy execution
|
|
8821
8899
|
* @returns Promise that resolves to `{ bundledScripts }` when `buildOnly` is true, otherwise void
|
|
8822
8900
|
*/
|
|
8823
|
-
async function
|
|
8824
|
-
return withSpan("
|
|
8825
|
-
rootSpan.setAttribute("
|
|
8901
|
+
async function deploy(options) {
|
|
8902
|
+
return withSpan("deploy", async (rootSpan) => {
|
|
8903
|
+
rootSpan.setAttribute("deploy.dry_run", options?.dryRun ?? false);
|
|
8826
8904
|
const { config, application, workflowBuildResult, bundledScripts, buildOnly } = await withSpan("build", async () => {
|
|
8827
8905
|
const { config, plugins } = await withSpan("build.loadConfig", () => loadConfig(options?.configPath));
|
|
8828
8906
|
const dryRun = options?.dryRun ?? false;
|
|
@@ -9751,7 +9829,7 @@ const executionsCommand = defineAppCommand({
|
|
|
9751
9829
|
args: z.object({
|
|
9752
9830
|
...workspaceArgs,
|
|
9753
9831
|
...pagedLogArgs,
|
|
9754
|
-
|
|
9832
|
+
"execution-id": arg(z.string().optional(), {
|
|
9755
9833
|
positional: true,
|
|
9756
9834
|
description: "Execution ID (if provided, shows details)"
|
|
9757
9835
|
}),
|
|
@@ -10330,11 +10408,11 @@ const jobsCommand = defineAppCommand({
|
|
|
10330
10408
|
],
|
|
10331
10409
|
args: z.object({
|
|
10332
10410
|
...workspaceArgs,
|
|
10333
|
-
|
|
10411
|
+
"executor-name": arg(z.string(), {
|
|
10334
10412
|
positional: true,
|
|
10335
10413
|
description: "Executor name"
|
|
10336
10414
|
}),
|
|
10337
|
-
|
|
10415
|
+
"job-id": arg(z.string().optional(), {
|
|
10338
10416
|
positional: true,
|
|
10339
10417
|
description: "Job ID (if provided, shows job details)"
|
|
10340
10418
|
}),
|
|
@@ -10583,7 +10661,7 @@ The \`--logs\` option displays logs from the downstream execution when available
|
|
|
10583
10661
|
],
|
|
10584
10662
|
args: z.object({
|
|
10585
10663
|
...workspaceArgs,
|
|
10586
|
-
|
|
10664
|
+
"executor-name": arg(z.string(), {
|
|
10587
10665
|
positional: true,
|
|
10588
10666
|
description: "Executor name"
|
|
10589
10667
|
}),
|
|
@@ -13132,7 +13210,7 @@ function generateMigrationScript(diff) {
|
|
|
13132
13210
|
* This script handles data migration for breaking schema changes.
|
|
13133
13211
|
* Edit this file to implement your data migration logic.
|
|
13134
13212
|
*
|
|
13135
|
-
* The transaction is managed by the
|
|
13213
|
+
* The transaction is managed by the deploy command.
|
|
13136
13214
|
* If any operation fails, all changes will be rolled back.
|
|
13137
13215
|
*/
|
|
13138
13216
|
|
|
@@ -13291,7 +13369,7 @@ async function generate(options) {
|
|
|
13291
13369
|
if (options.init) await handleInitOption(namespacesWithMigrations, options.yes);
|
|
13292
13370
|
let pluginManager;
|
|
13293
13371
|
if (plugins.length > 0) pluginManager = new PluginManager(plugins);
|
|
13294
|
-
const { defineApplication } = await import("./application-
|
|
13372
|
+
const { defineApplication } = await import("./application-CN9Htzup.mjs");
|
|
13295
13373
|
const application = defineApplication({
|
|
13296
13374
|
config,
|
|
13297
13375
|
pluginManager
|
|
@@ -13388,7 +13466,7 @@ async function generateDiffFromSnapshot(previousSnapshot, currentSnapshot, migra
|
|
|
13388
13466
|
if (result.dbTypesFilePath) logger.info(` DB types: ${result.dbTypesFilePath}`);
|
|
13389
13467
|
logger.newline();
|
|
13390
13468
|
logger.log("A migration script was generated for breaking changes.");
|
|
13391
|
-
logger.log("Please review and edit the script before running 'tailor-sdk
|
|
13469
|
+
logger.log("Please review and edit the script before running 'tailor-sdk deploy'.");
|
|
13392
13470
|
const editor = getConfiguredEditorCommand();
|
|
13393
13471
|
if (!editor) return;
|
|
13394
13472
|
try {
|
|
@@ -13727,7 +13805,7 @@ const resumeCommand = defineAppCommand({
|
|
|
13727
13805
|
description: "Resume a failed or pending workflow execution.",
|
|
13728
13806
|
args: z.object({
|
|
13729
13807
|
...workspaceArgs,
|
|
13730
|
-
|
|
13808
|
+
"execution-id": arg(z.string(), {
|
|
13731
13809
|
positional: true,
|
|
13732
13810
|
description: "Failed execution ID"
|
|
13733
13811
|
}),
|
|
@@ -15106,7 +15184,7 @@ async function runRepl(options) {
|
|
|
15106
15184
|
const execute = await prepareQueryExecutor(options);
|
|
15107
15185
|
const historyPath = getReplHistoryPath(options.engine, options.profile, options.workspaceId);
|
|
15108
15186
|
const validate = createReplValidator(options.engine);
|
|
15109
|
-
const { highlightSqlLine, highlightGraphqlLine, replTransform } = await import("./repl-editor-
|
|
15187
|
+
const { highlightSqlLine, highlightGraphqlLine, replTransform } = await import("./repl-editor-CZpLlOBj.mjs");
|
|
15110
15188
|
const highlight = options.engine === "sql" ? highlightSqlLine : highlightGraphqlLine;
|
|
15111
15189
|
const prompt = createPrompt({
|
|
15112
15190
|
prefix: "",
|
|
@@ -15439,5 +15517,5 @@ function isDeno() {
|
|
|
15439
15517
|
}
|
|
15440
15518
|
|
|
15441
15519
|
//#endregion
|
|
15442
|
-
export { deleteCommand$1 as $, getMigrationDirPath as $t, truncate as A, executionsCommand as At, updateOrganization as B, MIGRATION_LABEL_KEY as Bt, listCommand$2 as C, toPageDirection as Cn, jobsCommand as Ct, resumeWorkflow as D, startWorkflow as Dt, resumeCommand as E, startCommand as Et, showCommand as F, getCommand$6 as Ft, getCommand$1 as G, INITIAL_SCHEMA_NUMBER as Gt, treeCommand as H, bundleMigrationScript as Ht, logBetaWarning as I, getExecutor as It, updateFolder as J, compareLocalTypesWithSnapshot as Jt, getOrganization as K, MIGRATE_FILE_NAME as Kt, remove as L,
|
|
15443
|
-
//# sourceMappingURL=runtime-
|
|
15520
|
+
export { deleteCommand$1 as $, getMigrationDirPath as $t, truncate as A, executionsCommand as At, updateOrganization as B, MIGRATION_LABEL_KEY as Bt, listCommand$2 as C, toPageDirection as Cn, jobsCommand as Ct, resumeWorkflow as D, startWorkflow as Dt, resumeCommand as E, startCommand as Et, showCommand as F, getCommand$6 as Ft, getCommand$1 as G, INITIAL_SCHEMA_NUMBER as Gt, treeCommand as H, bundleMigrationScript as Ht, logBetaWarning as I, getExecutor as It, updateFolder as J, compareLocalTypesWithSnapshot as Jt, getOrganization as K, MIGRATE_FILE_NAME as Kt, remove as L, deploy as Lt, generate as M, listWorkflowExecutions as Mt, generateCommand as N, functionExecutionStatusToString as Nt, listCommand$3 as O, getCommand$5 as Ot, show as P, formatKeyValueTable as Pt, getFolder as Q, getLatestMigrationNumber as Qt, removeCommand$1 as R, executeScript as Rt, listApps as S, paginationArgs as Sn, getExecutorJob as St, healthCommand as T, watchExecutorJob as Tt, listCommand$4 as U, DB_TYPES_FILE_NAME as Ut, organizationTree as V, parseMigrationLabelNumber as Vt, listOrganizations as W, DIFF_FILE_NAME as Wt, listFolders as X, createSnapshotFromLocalTypes as Xt, listCommand$5 as Y, compareSnapshots as Yt, getCommand$2 as Z, formatMigrationNumber as Zt, getWorkspace as _, commonArgs as _n, webhookCommand as _t, updateUser as a, reconstructSnapshotFromMigrations as an, getCommand$3 as at, createCommand as b, isVerbose as bn, listCommand$9 as bt, listCommand as c, hasChanges as cn, tokenCommand as ct, inviteUser as d, trnPrefix as dn, generate$1 as dt, getMigrationFilePath as en, deleteFolder as et, restoreCommand as f, generateUserTypes as fn, listCommand$8 as ft, getCommand as g, defineAppCommand as gn, listWebhookExecutors as gt, listWorkspaces as h, apiCall as hn, getFunctionRegistry as ht, updateCommand as i, loadDiff as in, listOAuth2Clients as it, truncateCommand as j, getWorkflowExecution as jt, listWorkflows as k, getWorkflow as kt, listUsers as l, getNamespacesWithMigrations as ln, listCommand$7 as lt, listCommand$1 as m, apiCommand as mn, getCommand$4 as mt, query as n, getNextMigrationNumber as nn, createFolder as nt, removeCommand as o, formatDiffSummary as on, getOAuth2Client as ot, restoreWorkspace as p, prompt as pn, listFunctionRegistries as pt, updateCommand$2 as q, SCHEMA_FILE_NAME as qt, queryCommand as r, isValidMigrationNumber as rn, listCommand$6 as rt, removeUser as s, formatMigrationDiff as sn, getMachineUserToken as st, isNativeTypeScriptRuntime as t, getMigrationFiles as tn, createCommand$1 as tt, inviteCommand as u, sdkNameLabelKey as un, listMachineUsers as ut, deleteCommand as v, confirmationArgs as vn, triggerCommand as vt, getAppHealth as w, workspaceArgs as wn, listExecutorJobs as wt, createWorkspace as x, pagedLogArgs as xn, listExecutors as xt, deleteWorkspace as y, deploymentArgs as yn, triggerExecutor as yt, updateCommand$1 as z, waitForExecution$1 as zt };
|
|
15521
|
+
//# sourceMappingURL=runtime-DDYL2Zf1.mjs.map
|