@tailor-platform/sdk 1.82.0 → 1.84.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 +40 -0
- package/dist/application-5FOWIxFQ.mjs +3 -0
- package/dist/{application-CVeA53ok.mjs → application-CnCljDwk.mjs} +15 -10
- package/dist/application-CnCljDwk.mjs.map +1 -0
- package/dist/cli/commands/deploy/tailordb/index.d.mts +1 -0
- package/dist/cli/commands/generate/service.d.mts +1 -1
- package/dist/cli/commands/generate/types.d.mts +1 -1
- package/dist/cli/commands/tailordb/migrate/diff-calculator.d.mts +11 -1
- package/dist/cli/commands/tailordb/migrate/snapshot.d.mts +1 -1
- package/dist/cli/index.mjs +65 -10
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +1 -1
- package/dist/cli/lib.mjs +2 -2
- package/dist/cli/shared/client.d.mts +28 -3
- package/dist/cli/skills.d.mts +1 -1
- package/dist/completion/zsh-worker.zsh +35 -22
- package/dist/configure/index.d.mts +2 -2
- package/dist/configure/index.mjs +173 -5
- package/dist/configure/index.mjs.map +1 -1
- package/dist/configure/services/executor/index.d.mts +2 -2
- package/dist/configure/services/executor/trigger/event.d.mts +245 -2
- package/dist/configure/services/executor/trigger/index.d.mts +3 -3
- package/dist/configure/services/index.d.mts +2 -2
- package/dist/configure/services/tailordb/index.d.mts +0 -1
- package/dist/configure/services/workflow/execution-policy.d.mts +2 -2
- package/dist/configure/services/workflow/job.d.mts +9 -0
- package/dist/configure/services/workflow/workflow.d.mts +10 -0
- package/dist/{globals-DUqEetIh.mjs → globals-DraXTdqg.mjs} +6 -5
- package/dist/globals-DraXTdqg.mjs.map +1 -0
- package/dist/{register-typescript-runtime-O7zQNif0.mjs → register-typescript-runtime-BCvWR3HC.mjs} +518 -123
- package/dist/register-typescript-runtime-BCvWR3HC.mjs.map +1 -0
- package/dist/{registry-CXi7rJq7.mjs → registry-Ct0Wgxp1.mjs} +3 -3
- package/dist/registry-Ct0Wgxp1.mjs.map +1 -0
- package/dist/runtime/index.mjs +1 -1
- package/dist/runtime/workflow.d.mts +39 -21
- package/dist/runtime/workflow.mjs +2 -2
- package/dist/{service-B0MaodSg.mjs → service-CPJWhTLn.mjs} +29 -2
- package/dist/service-CPJWhTLn.mjs.map +1 -0
- package/dist/service-Cigg_U-v.mjs +3 -0
- package/dist/{service_pb-BwZRiNug.mjs → service_pb-D5--My_M.mjs} +5 -5
- package/dist/service_pb-D5--My_M.mjs.map +1 -0
- package/dist/{service_pb-wRkxUta6.mjs → service_pb-i8CmnQP4.mjs} +1 -1
- package/dist/tailor-proto/src/tailor/v1/application_pb.d.mts +106 -1
- package/dist/tailor-proto/src/tailor/v1/executor_resource_pb.d.mts +24 -1
- package/dist/tailor-proto/src/tailor/v1/function_pb.d.mts +49 -1
- package/dist/tailor-proto/src/tailor/v1/service_pb.d.mts +89 -6
- package/dist/tailor-proto/src/tailor/v1/telemetryrouter_resource_pb.d.mts +26 -1
- package/dist/tailor-proto/src/tailor/v1/workflow_pb.d.mts +101 -1
- package/dist/tailor-proto/src/tailor/v1/workflow_resource_pb.d.mts +22 -1
- package/dist/types/executor.generated.d.mts +23 -3
- package/dist/utils/test/index.mjs +18 -12
- package/dist/utils/test/index.mjs.map +1 -1
- package/dist/utils/test/mock.d.mts +2 -2
- package/dist/vitest/environment.mjs +1 -1
- package/dist/vitest/index.mjs +30 -24
- package/dist/vitest/index.mjs.map +1 -1
- package/dist/vitest/mocks/file.d.mts +1 -1
- package/dist/vitest/mocks/workflow.d.mts +20 -15
- package/dist/vitest/setup.mjs +1 -1
- package/dist/{workflow-CkIDJpdg.mjs → workflow-B2mwc7aT.mjs} +17 -9
- package/dist/workflow-B2mwc7aT.mjs.map +1 -0
- package/dist/{workspace_resource_pb-UGK1SSn_.mjs → workspace_resource_pb-DXnO2AT-.mjs} +7 -7
- package/dist/workspace_resource_pb-DXnO2AT-.mjs.map +1 -0
- package/docs/cli/tailordb.md +14 -12
- package/docs/cli-reference.md +15 -15
- package/docs/runtime.md +1 -1
- package/docs/services/executor.md +83 -3
- package/docs/services/idp.md +3 -3
- package/docs/services/tailordb-migration.md +18 -5
- package/docs/services/workflow.md +28 -2
- package/docs/testing.md +1 -1
- package/package.json +16 -16
- package/dist/application-CP0W2sQo.mjs +0 -3
- package/dist/application-CVeA53ok.mjs.map +0 -1
- package/dist/globals-DUqEetIh.mjs.map +0 -1
- package/dist/register-typescript-runtime-O7zQNif0.mjs.map +0 -1
- package/dist/registry-CXi7rJq7.mjs.map +0 -1
- package/dist/service-B0MaodSg.mjs.map +0 -1
- package/dist/service-KnAiVofD.mjs +0 -3
- package/dist/service_pb-BwZRiNug.mjs.map +0 -1
- package/dist/workflow-CkIDJpdg.mjs.map +0 -1
- package/dist/workspace_resource_pb-UGK1SSn_.mjs.map +0 -1
|
@@ -4,5 +4,6 @@ import "../../../../tailor-proto/src/tailor/v1/tailordb_pb.mjs";
|
|
|
4
4
|
import "../../../../tailor-proto/src/tailor/v1/metadata_pb.mjs";
|
|
5
5
|
import "../../../shared/client.mjs";
|
|
6
6
|
import "../types.mjs";
|
|
7
|
+
import "../../tailordb/migrate/config.mjs";
|
|
7
8
|
import "../../tailordb/migrate/snapshot.mjs";
|
|
8
9
|
import "@bufbuild/protobuf";
|
|
@@ -3,7 +3,7 @@ import "../../../plugin/types.mjs";
|
|
|
3
3
|
import "../../../plugin/manager.mjs";
|
|
4
4
|
import "../../shared/config-loader.mjs";
|
|
5
5
|
import "../../services/application.mjs";
|
|
6
|
-
import
|
|
6
|
+
import "./types.mjs";
|
|
7
7
|
import { GenerateOptions } from "./options.mjs";
|
|
8
8
|
//#region src/cli/commands/generate/service.d.ts
|
|
9
9
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PluginAttachment } from "../../../configure/services/tailordb/types.mjs";
|
|
2
2
|
import { IdProvider, OAuth2Client } from "../../../types/auth.generated.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { TailorDBType, TypeSourceInfoEntry } from "../../../parser/service/tailordb/types.mjs";
|
|
4
4
|
import { Executor } from "../../../types/executor.generated.mjs";
|
|
5
5
|
import { Resolver } from "../../../types/resolver.generated.mjs";
|
|
6
6
|
import "../../../plugin/types.mjs";
|
|
@@ -174,6 +174,16 @@ interface MigrationDiff {
|
|
|
174
174
|
warnings: WarningChangeInfo[];
|
|
175
175
|
/** Whether a migration script is required to handle data migration */
|
|
176
176
|
requiresMigrationScript: boolean;
|
|
177
|
+
/** Explicit acknowledgment that this migration needs no script despite breaking changes */
|
|
178
|
+
scriptSkipped?: ScriptSkippedInfo;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Acknowledgment that a migration requiring a script intentionally has none.
|
|
182
|
+
* Recorded by `tailordb migration script <n> --no-script --reason "..."`.
|
|
183
|
+
*/
|
|
184
|
+
interface ScriptSkippedInfo {
|
|
185
|
+
reason: string;
|
|
186
|
+
acknowledgedAt: string;
|
|
177
187
|
}
|
|
178
188
|
/**
|
|
179
189
|
* Breaking change information in migration diff
|
|
@@ -219,4 +229,4 @@ declare function formatMigrationDiff(diff: MigrationDiff): string;
|
|
|
219
229
|
*/
|
|
220
230
|
declare function formatDiffSummary(diff: MigrationDiff): string;
|
|
221
231
|
//#endregion
|
|
222
|
-
export { BreakingChangeInfo, DiffChange, FieldAddedChange, FieldModifiedChange, FieldRemovedChange, FileAddedChange, FileModifiedChange, FileRemovedChange, IndexAddedChange, IndexModifiedChange, IndexRemovedChange, MigrationDiff, PermissionModifiedChange, RelationshipAddedChange, RelationshipModifiedChange, RelationshipRemovedChange, SnapshotPermissionState, SnapshotTypeSettingsState, TypeAddedChange, TypeModifiedChange, TypeRemovedChange, TypeSettingsModifiedChange, TypeSettingsPatch, WarningChangeInfo, formatDiffSummary, formatMigrationDiff, hasChanges };
|
|
232
|
+
export { BreakingChangeInfo, DiffChange, FieldAddedChange, FieldModifiedChange, FieldRemovedChange, FileAddedChange, FileModifiedChange, FileRemovedChange, IndexAddedChange, IndexModifiedChange, IndexRemovedChange, MigrationDiff, PermissionModifiedChange, RelationshipAddedChange, RelationshipModifiedChange, RelationshipRemovedChange, ScriptSkippedInfo, SnapshotPermissionState, SnapshotTypeSettingsState, TypeAddedChange, TypeModifiedChange, TypeRemovedChange, TypeSettingsModifiedChange, TypeSettingsPatch, WarningChangeInfo, formatDiffSummary, formatMigrationDiff, hasChanges };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TailorDBType } from "../../../../parser/service/tailordb/types.mjs";
|
|
2
2
|
import "../../../../tailor-proto/src/tailor/v1/tailordb_resource_pb.mjs";
|
|
3
|
-
import { NormalizedSchemaSnapshot, SchemaSnapshot, SnapshotActionPermission, SnapshotEnumValue, SnapshotFieldConfig,
|
|
3
|
+
import { NormalizedSchemaSnapshot, SchemaSnapshot, SnapshotActionPermission, SnapshotEnumValue, SnapshotFieldConfig, SnapshotGqlPermission, SnapshotGqlPermissionPolicy, SnapshotIndexConfig, SnapshotPermissionCondition, SnapshotPermissionOperand, SnapshotRecordPermission, SnapshotRelationship, TailorDBSnapshotType } from "./snapshot-types.mjs";
|
|
4
4
|
import { MigrationDiff } from "./diff-calculator.mjs";
|
|
5
5
|
//#region src/cli/commands/tailordb/migrate/snapshot.d.ts
|
|
6
6
|
/**
|
package/dist/cli/index.mjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { r as parseInputFields } from "../schema-CYrle8JZ.mjs";
|
|
3
|
-
import { At as PATScope, Ct as AuthInvokerSchema, E as CustomDomainStatus, W as FunctionExecution_Type } from "../workspace_resource_pb-
|
|
3
|
+
import { At as PATScope, Ct as AuthInvokerSchema, E as CustomDomainStatus, W as FunctionExecution_Type } from "../workspace_resource_pb-DXnO2AT-.mjs";
|
|
4
4
|
import { t as assertDefined } from "../assert-DBxo8jPo.mjs";
|
|
5
5
|
import { n as logger, r as styles } from "../logger-CXQq9YIp.mjs";
|
|
6
|
-
import { $n as deploymentArgs, $t as handleOptionalToRequiredError, An as generateUserTypes, At as startCommand, Bn as loadConsoleBaseUrl, Ct as listCommand$7, Dn as resourceTrn, Dt as jobsCommand, E as listCommand$13, En as getNamespacesWithMigrations, F as openInConfiguredEditor, Fn as deleteUserTokens, G as treeCommand, Gn as readPlatformConfig, H as updateCommand$3, Hn as loadStoredUserTokens, Ht as listCommand$16, In as fetchLatestToken, J as getCommand$5, Jn as writePlatformConfig, Jt as ensureConfigId, K as listCommand$12, Kn as resolveUserTokenKey, Kt as formatKeyValueTable, L as showCommand, Ln as hasAnyUserTokenEntry, Lt as functionExecutionStatusToString, M as generateMigrationScript, Mn as apiCall, Mt as getCommand$6, N as writeDbTypesFile, Nn as assertWritable, On as sdkNameLabelKey, P as getConfiguredEditorCommand, Pn as loadConfig, Pt as executionsCommand, Q as listCommand$11, Qn as confirmationArgs, Qt as MIGRATION_LABEL_KEY, R as extractOwnedNamespaces, Rn as hasUserTokenEntry, Rt as getCommand$1, S as waitCommand, Sn as parseMigrationNumberArg, Tn as hasChanges, Un as loadWorkspaceId, V as removeCommand$1, Vn as loadMachineUserName, Vt as deployFromCLI, Wn as platformConfigFromProfile, Wt as createCommand$4, X as updateCommand$2, Xn as commonArgs, Yn as defineAppCommand, Yt as executeScript, Zn as configArg, _t as getCommand$2, ar as toPageDirection, bn as reconstructSnapshotFromMigrations, bt as webhookCommand, c as listCommand$15, ct as getCommand$3, dt as tokenCommand, en as parseMigrationLabelNumber, er as isVerbose, et as getCommand$4, f as restoreCommand, fn as createSnapshotFromLocalTypes, ft as listCommand$9, g as deleteCommand$5, gn as getMigrationFiles, hn as getMigrationFilePath, ht as listCommand$8, i as updateCommand$4, ir as resolveMachineUserInputSource, it as createCommand$3, j as generateCommand$1, jn as prompt, k as truncateCommand, kn as PluginManager, ln as assertValidMigrationFiles, m as getCommand$7, mt as generate, nn as generateAllTypeManifestsFromSnapshot, nr as pagedLogArgs, nt as deleteCommand$4, o as removeCommand, on as INITIAL_SCHEMA_NUMBER, or as workspaceArgs, ot as listCommand$10, pn as getLatestMigrationNumber, qn as saveUserTokens, qt as workspaceNameSchema, r as queryCommand, rn as protoGqlPermission, rr as paginationArgs, t as registerTypeScriptRuntime, tn as compareSnapshotWithRemote, tr as multiConfigArg, u as inviteCommand, un as compareLocalTypesWithSnapshot, vn as isValidMigrationNumber, w as resumeCommand, wn as formatMigrationDiff, x as healthCommand, xn as formatMigrationNumber, xt as triggerCommand, y as listCommand$14, yn as loadDiff, z as logBetaWarning, zn as loadAccessToken } from "../register-typescript-runtime-
|
|
7
|
-
import { A as defaultPlatformBaseUrl, D as hashContent$1, E as getDistDir, F as fetchPlatformMachineUserToken, H as initOperatorClient, I as fetchUserInfo, M as fetchAllTolerant, P as fetchPaged, S as resolveBundleLogLevel, U as isDefaultPlatform, V as initOAuth2Client, a as resolveInlineSourcemap, b as composeFunctionTreeshakeOptions, c as ResolverSchema, j as fetchAll, k as closeConnectionPool, p as buildResolverPermissionAndInputCheckExpr, s as WorkflowJobSchema, t as defineApplication, u as INVOKER_EXPR, v as resolveTSConfigWithFallback, x as createLogLevelTreeshakeOptions, y as platformBundleDefinePlugin, z as getOrNull } from "../application-
|
|
8
|
-
import { n as ExecutorSchema } from "../service-
|
|
6
|
+
import { $n as deploymentArgs, $t as handleOptionalToRequiredError, An as generateUserTypes, At as startCommand, Bn as loadConsoleBaseUrl, Ct as listCommand$7, Dn as resourceTrn, Dt as jobsCommand, E as listCommand$13, En as getNamespacesWithMigrations, F as openInConfiguredEditor, Fn as deleteUserTokens, G as treeCommand, Gn as readPlatformConfig, H as updateCommand$3, Hn as loadStoredUserTokens, Ht as listCommand$16, In as fetchLatestToken, J as getCommand$5, Jn as writePlatformConfig, Jt as ensureConfigId, K as listCommand$12, Kn as resolveUserTokenKey, Kt as formatKeyValueTable, L as showCommand, Ln as hasAnyUserTokenEntry, Lt as functionExecutionStatusToString, M as generateMigrationScript, Mn as apiCall, Mt as getCommand$6, N as writeDbTypesFile, Nn as assertWritable, On as sdkNameLabelKey, P as getConfiguredEditorCommand, Pn as loadConfig, Pt as executionsCommand, Q as listCommand$11, Qn as confirmationArgs, Qt as MIGRATION_LABEL_KEY, R as extractOwnedNamespaces, Rn as hasUserTokenEntry, Rt as getCommand$1, S as waitCommand, Sn as parseMigrationNumberArg, Tn as hasChanges, Un as loadWorkspaceId, V as removeCommand$1, Vn as loadMachineUserName, Vt as deployFromCLI, Wn as platformConfigFromProfile, Wt as createCommand$4, X as updateCommand$2, Xn as commonArgs, Yn as defineAppCommand, Yt as executeScript, Zn as configArg, _t as getCommand$2, ar as toPageDirection, bn as reconstructSnapshotFromMigrations, bt as webhookCommand, c as listCommand$15, ct as getCommand$3, dt as tokenCommand, en as parseMigrationLabelNumber, er as isVerbose, et as getCommand$4, f as restoreCommand, fn as createSnapshotFromLocalTypes, ft as listCommand$9, g as deleteCommand$5, gn as getMigrationFiles, hn as getMigrationFilePath, ht as listCommand$8, i as updateCommand$4, ir as resolveMachineUserInputSource, it as createCommand$3, j as generateCommand$1, jn as prompt, k as truncateCommand, kn as PluginManager, ln as assertValidMigrationFiles, m as getCommand$7, mt as generate, nn as generateAllTypeManifestsFromSnapshot, nr as pagedLogArgs, nt as deleteCommand$4, o as removeCommand, on as INITIAL_SCHEMA_NUMBER, or as workspaceArgs, ot as listCommand$10, pn as getLatestMigrationNumber, qn as saveUserTokens, qt as workspaceNameSchema, r as queryCommand, rn as protoGqlPermission, rr as paginationArgs, t as registerTypeScriptRuntime, tn as compareSnapshotWithRemote, tr as multiConfigArg, u as inviteCommand, un as compareLocalTypesWithSnapshot, vn as isValidMigrationNumber, w as resumeCommand, wn as formatMigrationDiff, x as healthCommand, xn as formatMigrationNumber, xt as triggerCommand, y as listCommand$14, yn as loadDiff, z as logBetaWarning, zn as loadAccessToken } from "../register-typescript-runtime-BCvWR3HC.mjs";
|
|
7
|
+
import { A as defaultPlatformBaseUrl, D as hashContent$1, E as getDistDir, F as fetchPlatformMachineUserToken, H as initOperatorClient, I as fetchUserInfo, M as fetchAllTolerant, P as fetchPaged, S as resolveBundleLogLevel, U as isDefaultPlatform, V as initOAuth2Client, a as resolveInlineSourcemap, b as composeFunctionTreeshakeOptions, c as ResolverSchema, j as fetchAll, k as closeConnectionPool, p as buildResolverPermissionAndInputCheckExpr, s as WorkflowJobSchema, t as defineApplication, u as INVOKER_EXPR, v as resolveTSConfigWithFallback, x as createLogLevelTreeshakeOptions, y as platformBundleDefinePlugin, z as getOrNull } from "../application-CnCljDwk.mjs";
|
|
8
|
+
import { n as ExecutorSchema } from "../service-CPJWhTLn.mjs";
|
|
9
9
|
import { t as multiline } from "../multiline-sfHpTZZK.mjs";
|
|
10
10
|
import { t as isPluginGeneratedType } from "../type-source-DH_LH20p.mjs";
|
|
11
11
|
import { t as readPackageJson } from "../package-json-8b0O9TlX.mjs";
|
|
12
12
|
import { t as userAgent } from "../user-agent-DX2Jnw0-.mjs";
|
|
13
13
|
import { n as errorToJson, r as isCLIError, t as createCLIError } from "../errors-DVFS0AZk.mjs";
|
|
14
|
-
import { t as OperatorService } from "../service_pb-
|
|
14
|
+
import { t as OperatorService } from "../service_pb-D5--My_M.mjs";
|
|
15
15
|
import { a as JSON_FOOTER_MARKER, i as CRASH_LOG_EXTENSION, o as parseCrashReportConfig, r as sendCrashReport, t as initCrashReporting } from "../crashreport-DMYuHnBN.mjs";
|
|
16
16
|
import { arg, defineCommand, runCommand, runMain } from "politty";
|
|
17
17
|
import { withCompletionCommand } from "politty/completion";
|
|
@@ -6469,6 +6469,42 @@ const erdCommand = defineCommand({
|
|
|
6469
6469
|
* automatically require one.
|
|
6470
6470
|
*/
|
|
6471
6471
|
/**
|
|
6472
|
+
* Record in diff.json that a migration requiring a script intentionally has none.
|
|
6473
|
+
* @param {MarkScriptSkippedOptions} options - Target migration and skip reason
|
|
6474
|
+
* @returns {ScriptSkippedInfo} The recorded acknowledgment
|
|
6475
|
+
*/
|
|
6476
|
+
function markMigrationScriptSkipped(options) {
|
|
6477
|
+
const { migrationsDir, migrationNumber, reason } = options;
|
|
6478
|
+
const label = formatMigrationNumber(migrationNumber);
|
|
6479
|
+
const normalizedReason = reason.trim();
|
|
6480
|
+
if (!normalizedReason) throw new Error("Migration script skip reason must not be empty.");
|
|
6481
|
+
const diffPath = getMigrationFilePath(migrationsDir, migrationNumber, "diff");
|
|
6482
|
+
if (!fs$1.existsSync(diffPath)) throw new Error(`Migration ${label} not found in ${migrationsDir}. Expected ${diffPath}.`);
|
|
6483
|
+
const diff = loadDiff(diffPath);
|
|
6484
|
+
if (!diff.requiresMigrationScript) throw new Error(`Migration ${label} does not require a migration script; nothing to skip.`);
|
|
6485
|
+
if (diff.scriptSkipped) throw new Error(`Migration ${label} already has a script skip recorded (${diff.scriptSkipped.acknowledgedAt}: ${diff.scriptSkipped.reason}).`);
|
|
6486
|
+
const migratePath = getMigrationFilePath(migrationsDir, migrationNumber, "migrate");
|
|
6487
|
+
if (fs$1.existsSync(migratePath)) throw new Error(`Migration script exists at ${migratePath}. Delete migrate.ts first if this migration should run without a script.`);
|
|
6488
|
+
const scriptSkipped = {
|
|
6489
|
+
reason: normalizedReason,
|
|
6490
|
+
acknowledgedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
6491
|
+
};
|
|
6492
|
+
const raw = JSON.parse(fs$1.readFileSync(diffPath, "utf-8"));
|
|
6493
|
+
raw.scriptSkipped = scriptSkipped;
|
|
6494
|
+
fs$1.writeFileSync(diffPath, JSON.stringify(raw, null, 2));
|
|
6495
|
+
return scriptSkipped;
|
|
6496
|
+
}
|
|
6497
|
+
/**
|
|
6498
|
+
* Remove a script skip acknowledgment after a real migration script is created.
|
|
6499
|
+
* @param diffPath - Migration diff file to update
|
|
6500
|
+
*/
|
|
6501
|
+
function clearMigrationScriptSkipped(diffPath) {
|
|
6502
|
+
const raw = JSON.parse(fs$1.readFileSync(diffPath, "utf-8"));
|
|
6503
|
+
if (!Object.hasOwn(raw, "scriptSkipped")) return;
|
|
6504
|
+
delete raw.scriptSkipped;
|
|
6505
|
+
fs$1.writeFileSync(diffPath, JSON.stringify(raw, null, 2));
|
|
6506
|
+
}
|
|
6507
|
+
/**
|
|
6472
6508
|
* Add a migrate.ts template to an existing migration directory.
|
|
6473
6509
|
* @param {ScriptOptions} options - Command options
|
|
6474
6510
|
*/
|
|
@@ -6481,6 +6517,20 @@ async function script(options) {
|
|
|
6481
6517
|
if (namespacesWithMigrations.length === 0) throw new Error("No TailorDB services with migrations configuration found");
|
|
6482
6518
|
const targetNamespace = resolveTargetNamespace(namespacesWithMigrations, options.namespace);
|
|
6483
6519
|
const { migrationsDir } = assertDefined(namespacesWithMigrations.find((ns) => ns.namespace === targetNamespace), "namespace with migrations not found");
|
|
6520
|
+
if (options.noScript) {
|
|
6521
|
+
const reason = options.reason?.trim();
|
|
6522
|
+
if (!reason) throw new Error("--reason is required with --no-script.");
|
|
6523
|
+
const scriptSkipped = markMigrationScriptSkipped({
|
|
6524
|
+
migrationsDir,
|
|
6525
|
+
migrationNumber,
|
|
6526
|
+
reason
|
|
6527
|
+
});
|
|
6528
|
+
logger.success(`Recorded that migration ${styles.bold(options.number)} in namespace ${styles.bold(targetNamespace)} intentionally has no migration script`);
|
|
6529
|
+
logger.info(` Reason: ${scriptSkipped.reason}`);
|
|
6530
|
+
logger.info(` Diff file: ${getMigrationFilePath(migrationsDir, migrationNumber, "diff")}`);
|
|
6531
|
+
return;
|
|
6532
|
+
}
|
|
6533
|
+
if (options.reason !== void 0) throw new Error("--reason can only be used together with --no-script.");
|
|
6484
6534
|
const diffPath = getMigrationFilePath(migrationsDir, migrationNumber, "diff");
|
|
6485
6535
|
if (!fs$1.existsSync(diffPath)) throw new Error(`Migration ${options.number} not found in ${migrationsDir}. Expected ${diffPath}.`);
|
|
6486
6536
|
const migratePath = getMigrationFilePath(migrationsDir, migrationNumber, "migrate");
|
|
@@ -6491,6 +6541,7 @@ async function script(options) {
|
|
|
6491
6541
|
const scriptContent = generateMigrationScript(diff);
|
|
6492
6542
|
await fsPromises.writeFile(migratePath, scriptContent);
|
|
6493
6543
|
await writeDbTypesFile(previousSnapshot, migrationsDir, migrationNumber, diff);
|
|
6544
|
+
clearMigrationScriptSkipped(diffPath);
|
|
6494
6545
|
logger.success(`Added migration script for migration ${styles.bold(options.number)} in namespace ${styles.bold(targetNamespace)}`);
|
|
6495
6546
|
logger.info(` Migration script: ${migratePath}`);
|
|
6496
6547
|
logger.info(` DB types: ${getMigrationFilePath(migrationsDir, migrationNumber, "db")}`);
|
|
@@ -6520,7 +6571,7 @@ function resolveTargetNamespace(namespacesWithMigrations, requested) {
|
|
|
6520
6571
|
}
|
|
6521
6572
|
const scriptCommand = defineAppCommand({
|
|
6522
6573
|
name: "script",
|
|
6523
|
-
description: "Add a migration script (migrate.ts) template to an existing migration directory.",
|
|
6574
|
+
description: "Add a migration script (migrate.ts) template to an existing migration directory, or record with --no-script that a migration intentionally has none.",
|
|
6524
6575
|
args: z.object({
|
|
6525
6576
|
...configArg,
|
|
6526
6577
|
number: arg(z.string(), {
|
|
@@ -6530,13 +6581,17 @@ const scriptCommand = defineAppCommand({
|
|
|
6530
6581
|
namespace: arg(z.string().optional(), {
|
|
6531
6582
|
alias: "n",
|
|
6532
6583
|
description: "Target TailorDB namespace (required if multiple namespaces exist)"
|
|
6533
|
-
})
|
|
6584
|
+
}),
|
|
6585
|
+
"no-script": arg(z.boolean().optional(), { description: "Record that this migration intentionally runs without a migration script (requires --reason)" }),
|
|
6586
|
+
reason: arg(z.string().optional(), { description: "Reason why no migration script is needed (used with --no-script)" })
|
|
6534
6587
|
}).strict(),
|
|
6535
6588
|
run: async (args) => {
|
|
6536
6589
|
await script({
|
|
6537
6590
|
configPath: args.config,
|
|
6538
6591
|
number: args.number,
|
|
6539
|
-
namespace: args.namespace
|
|
6592
|
+
namespace: args.namespace,
|
|
6593
|
+
noScript: args["no-script"],
|
|
6594
|
+
reason: args.reason
|
|
6540
6595
|
});
|
|
6541
6596
|
}
|
|
6542
6597
|
});
|
|
@@ -6784,7 +6839,7 @@ async function fetchRemoteTypes(client, workspaceId, namespace) {
|
|
|
6784
6839
|
async function assertMigrationsReproduceLocalTypes(loaded, target) {
|
|
6785
6840
|
const { config, plugins } = loaded;
|
|
6786
6841
|
const pluginManager = plugins.length > 0 ? new PluginManager(plugins) : void 0;
|
|
6787
|
-
const { defineApplication, generatePluginFilesIfNeeded } = await import("../application-
|
|
6842
|
+
const { defineApplication, generatePluginFilesIfNeeded } = await import("../application-5FOWIxFQ.mjs");
|
|
6788
6843
|
const application = defineApplication({
|
|
6789
6844
|
config,
|
|
6790
6845
|
pluginManager
|
|
@@ -6796,7 +6851,7 @@ async function assertMigrationsReproduceLocalTypes(loaded, target) {
|
|
|
6796
6851
|
await service.processNamespacePlugins();
|
|
6797
6852
|
}
|
|
6798
6853
|
const pluginExecutorFiles = generatePluginFilesIfNeeded(pluginManager, application.tailorDBServices, config.path);
|
|
6799
|
-
const executorService = application.executorService ?? (pluginExecutorFiles.length > 0 ? (await import("../service-
|
|
6854
|
+
const executorService = application.executorService ?? (pluginExecutorFiles.length > 0 ? (await import("../service-Cigg_U-v.mjs")).createExecutorService({
|
|
6800
6855
|
config: { files: [] },
|
|
6801
6856
|
baseDir: path.dirname(config.path)
|
|
6802
6857
|
}) : void 0);
|