@tailor-platform/sdk 1.73.3 → 1.74.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 +44 -0
- package/dist/{application-DgTCDMZY.mjs → application-BsH6tkZC.mjs} +96 -17
- package/dist/application-BsH6tkZC.mjs.map +1 -0
- package/dist/application-CSUhZMb5.mjs +3 -0
- package/dist/cli/commands/deploy/apply-phases.d.mts +1 -0
- package/dist/cli/commands/executor/trigger.d.mts +1 -1
- package/dist/cli/commands/tailordb/migrate/snapshot.d.mts +1 -16
- package/dist/cli/index.mjs +121 -43
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +4 -4
- package/dist/cli/lib.mjs +3 -3
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/cli/shared/client.d.mts +1 -1
- package/dist/completion/zsh-worker.zsh +28 -3
- package/dist/configure/index.mjs +2 -2
- package/dist/configure/services/tailordb/schema.d.mts +5 -19
- package/dist/configure/types/field-runtime.d.mts +17 -0
- package/dist/configure/types/type.d.mts +1 -18
- package/dist/field-runtime-9bfXBAOK.mjs +183 -0
- package/dist/field-runtime-9bfXBAOK.mjs.map +1 -0
- package/dist/plugin/builtin/seed/index.mjs +1 -1
- package/dist/{repl-editor-BmQOyZJd.mjs → repl-editor-BCozyiNq.mjs} +3 -2
- package/dist/{repl-editor-BmQOyZJd.mjs.map → repl-editor-BCozyiNq.mjs.map} +1 -1
- package/dist/{runtime-SxHHEzVb.mjs → runtime-DV1EnfMs.mjs} +2130 -1538
- package/dist/runtime-DV1EnfMs.mjs.map +1 -0
- package/dist/{schema-DAdZSFOd.mjs → schema-Dl_y0m9e.mjs} +8 -167
- package/dist/schema-Dl_y0m9e.mjs.map +1 -0
- package/dist/secretmanager-Bd45j7an.mjs +98 -0
- package/dist/secretmanager-Bd45j7an.mjs.map +1 -0
- package/dist/{seed-DoMTMLcm.mjs → seed-fm0LeYP2.mjs} +14 -3
- package/dist/seed-fm0LeYP2.mjs.map +1 -0
- package/dist/{service-DiEtAsvc.mjs → service-BCRJ-3NV.mjs} +18 -1
- package/dist/{service-DiEtAsvc.mjs.map → service-BCRJ-3NV.mjs.map} +1 -1
- package/dist/service-CPMlIg3X.mjs +3 -0
- package/dist/tailor-proto/src/tailor/v1/aigateway_pb.d.mts +2 -2
- package/dist/tailor-proto/src/tailor/v1/aigateway_resource_pb.d.mts +1 -1
- package/dist/tailor-proto/src/tailor/v1/application_pb.d.mts +1 -1
- package/dist/tailor-proto/src/tailor/v1/application_resource_pb.d.mts +1 -1
- package/dist/tailor-proto/src/tailor/v1/auth_pb.d.mts +1 -1
- package/dist/tailor-proto/src/tailor/v1/auth_resource_pb.d.mts +1 -1
- package/dist/tailor-proto/src/tailor/v1/events_pb.d.mts +1 -1
- package/dist/tailor-proto/src/tailor/v1/events_resource_pb.d.mts +1 -1
- package/dist/tailor-proto/src/tailor/v1/executor_pb.d.mts +1 -1
- package/dist/tailor-proto/src/tailor/v1/executor_resource_pb.d.mts +1 -1
- package/dist/tailor-proto/src/tailor/v1/function_pb.d.mts +1 -1
- package/dist/tailor-proto/src/tailor/v1/function_registry_pb.d.mts +1 -1
- package/dist/tailor-proto/src/tailor/v1/function_resource_pb.d.mts +1 -1
- package/dist/tailor-proto/src/tailor/v1/http_adapter_resource_pb.d.mts +1 -1
- package/dist/tailor-proto/src/tailor/v1/idp_pb.d.mts +1 -1
- package/dist/tailor-proto/src/tailor/v1/idp_resource_pb.d.mts +1 -1
- package/dist/tailor-proto/src/tailor/v1/metadata_pb.d.mts +1 -1
- package/dist/tailor-proto/src/tailor/v1/metadata_resource_pb.d.mts +1 -1
- package/dist/tailor-proto/src/tailor/v1/meter_pb.d.mts +1 -1
- package/dist/tailor-proto/src/tailor/v1/pipeline_pb.d.mts +1 -1
- package/dist/tailor-proto/src/tailor/v1/pipeline_resource_pb.d.mts +1 -1
- package/dist/tailor-proto/src/tailor/v1/resource_pb.d.mts +1 -1
- package/dist/tailor-proto/src/tailor/v1/secret_manager_pb.d.mts +1 -1
- package/dist/tailor-proto/src/tailor/v1/secret_manager_resource_pb.d.mts +1 -1
- package/dist/tailor-proto/src/tailor/v1/service_pb.d.mts +2 -2
- package/dist/tailor-proto/src/tailor/v1/stateflow_pb.d.mts +1 -1
- package/dist/tailor-proto/src/tailor/v1/stateflow_resource_pb.d.mts +1 -1
- package/dist/tailor-proto/src/tailor/v1/staticwebsite_pb.d.mts +1 -1
- package/dist/tailor-proto/src/tailor/v1/staticwebsite_resource_pb.d.mts +1 -1
- package/dist/tailor-proto/src/tailor/v1/tailordb_pb.d.mts +1 -1
- package/dist/tailor-proto/src/tailor/v1/tailordb_resource_pb.d.mts +1 -1
- package/dist/tailor-proto/src/tailor/v1/telemetryrouter_pb.d.mts +1 -1
- package/dist/tailor-proto/src/tailor/v1/telemetryrouter_resource_pb.d.mts +1 -1
- package/dist/tailor-proto/src/tailor/v1/workflow_pb.d.mts +1 -1
- package/dist/tailor-proto/src/tailor/v1/workflow_resource_pb.d.mts +1 -1
- package/dist/tailor-proto/src/tailor/v1/workspace_pb.d.mts +2 -2
- package/dist/tailor-proto/src/tailor/v1/workspace_resource_pb.d.mts +1 -1
- package/dist/types-BwzB2okW.mjs +199 -0
- package/dist/types-BwzB2okW.mjs.map +1 -0
- package/dist/types-KlawuVKa.mjs +4 -0
- package/dist/vitest/index.d.mts +8 -1
- package/dist/vitest/index.mjs +778 -2
- package/dist/vitest/index.mjs.map +1 -1
- package/dist/vitest/mock.d.mts +8 -363
- package/dist/vitest/mocks/aigateway.d.mts +30 -0
- package/dist/vitest/mocks/authconnection.d.mts +28 -0
- package/dist/vitest/mocks/file.d.mts +41 -0
- package/dist/vitest/mocks/iconv.d.mts +27 -0
- package/dist/vitest/mocks/idp.d.mts +44 -0
- package/dist/vitest/mocks/secretmanager.d.mts +33 -0
- package/dist/vitest/mocks/tailordb.d.mts +71 -0
- package/dist/vitest/mocks/workflow.d.mts +115 -0
- package/dist/vitest/setup.mjs +1 -1
- package/docs/cli/application.md +21 -11
- package/docs/cli/setup.md +25 -0
- package/docs/cli-reference.md +1 -0
- package/package.json +15 -15
- package/dist/application-BAo_zFA4.mjs +0 -3
- package/dist/application-DgTCDMZY.mjs.map +0 -1
- package/dist/field-DOsJCPFa.mjs +0 -22
- package/dist/field-DOsJCPFa.mjs.map +0 -1
- package/dist/mock-Ce1GCi4-.mjs +0 -871
- package/dist/mock-Ce1GCi4-.mjs.map +0 -1
- package/dist/runtime-SxHHEzVb.mjs.map +0 -1
- package/dist/schema-DAdZSFOd.mjs.map +0 -1
- package/dist/seed-DoMTMLcm.mjs.map +0 -1
- package/dist/service-BXmdFwSH.mjs +0 -3
- package/dist/types-qhFZ8y9B.mjs +0 -4
- package/dist/types-ywCGpzDZ.mjs +0 -360
- package/dist/types-ywCGpzDZ.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IncomingWebhookTrigger, ScheduleTriggerInput } from "../../../types/executor.generated.mjs";
|
|
2
|
-
import { JsonObject } from "@bufbuild/protobuf";
|
|
3
2
|
import { z } from "zod";
|
|
3
|
+
import { JsonObject } from "@bufbuild/protobuf";
|
|
4
4
|
|
|
5
5
|
//#region src/cli/commands/executor/trigger.d.ts
|
|
6
6
|
type ManualTrigger = IncomingWebhookTrigger | ScheduleTriggerInput;
|
|
@@ -21,21 +21,6 @@ declare const DB_TYPES_FILE_NAME = "db.ts";
|
|
|
21
21
|
* Migration file type
|
|
22
22
|
*/
|
|
23
23
|
type MigrationFileType = "schema" | "diff" | "migrate" | "db";
|
|
24
|
-
/**
|
|
25
|
-
* Information about a migration
|
|
26
|
-
*/
|
|
27
|
-
interface MigrationInfo {
|
|
28
|
-
/** Migration number (e.g., 1, 2, 3) */
|
|
29
|
-
number: number;
|
|
30
|
-
/** Migration number as 4-digit string (e.g., "0001", "0002") */
|
|
31
|
-
numberStr: string;
|
|
32
|
-
/** Migration file type */
|
|
33
|
-
type: MigrationFileType;
|
|
34
|
-
/** Path to migration file */
|
|
35
|
-
path: string;
|
|
36
|
-
/** Parsed content (schema snapshot or diff) */
|
|
37
|
-
content: SchemaSnapshot | MigrationDiff;
|
|
38
|
-
}
|
|
39
24
|
/**
|
|
40
25
|
* Get migration directory path for a given number
|
|
41
26
|
* @param {string} migrationsDir - Base migrations directory path
|
|
@@ -110,4 +95,4 @@ declare function compareSnapshots(previous: SchemaSnapshot, current: SchemaSnaps
|
|
|
110
95
|
*/
|
|
111
96
|
declare function compareLocalTypesWithSnapshot(snapshot: SchemaSnapshot, localTypes: Record<string, TailorDBSnapshotType>, namespace: string): MigrationDiff;
|
|
112
97
|
//#endregion
|
|
113
|
-
export { DB_TYPES_FILE_NAME, DIFF_FILE_NAME, INITIAL_SCHEMA_NUMBER, MIGRATE_FILE_NAME, MigrationFileType,
|
|
98
|
+
export { DB_TYPES_FILE_NAME, DIFF_FILE_NAME, INITIAL_SCHEMA_NUMBER, MIGRATE_FILE_NAME, MigrationFileType, type NormalizedSchemaSnapshot, SCHEMA_FILE_NAME, type SchemaSnapshot, type SnapshotFieldConfig, type TailorDBSnapshotType, compareLocalTypesWithSnapshot, compareSnapshots, createSnapshotFromLocalTypes, getLatestMigrationNumber, getMigrationDirPath, getMigrationFilePath, getMigrationFiles, getNextMigrationNumber, reconstructSnapshotFromMigrations };
|
package/dist/cli/index.mjs
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import { C as CustomDomainStatus, R as FunctionExecution_Type, mt as AuthInvokerSchema, xt as PATScope } from "../service_pb-CIrhGwHk.mjs";
|
|
3
3
|
import { t as assertDefined } from "../assert-DBxo8jPo.mjs";
|
|
4
4
|
import { n as logger, r as styles } from "../logger-BEiZZ3qT.mjs";
|
|
5
|
-
import { $t as
|
|
6
|
-
import { $ as
|
|
7
|
-
import { n as ExecutorSchema } from "../service-
|
|
5
|
+
import { $t as compareSnapshotWithRemote, A as listCommand$12, An as apiCommand, Bn as pagedLogArgs, C as listCommand$13, Cn as hasChanges, Dn as PluginManager, Dt as listCommand$6, E as waitCommand, En as sdkNameLabelKey, F as generateCommand$1, Fn as configArg, G as removeCommand$1, Gt as deploy, H as extractOwnedNamespaces, Hn as toPageDirection, Ht as formatKeyValueTable, I as generateMigrationScript, In as confirmationArgs, It as getCommand$6, K as updateCommand$3, Kt as ensureConfigId, L as writeDbTypesFile, Ln as deploymentArgs, Mn as assertWritable, N as truncateCommand, Nn as defineAppCommand, O as resumeCommand, On as generateUserTypes, Pn as commonArgs, Pt as startCommand, Q as getCommand$5, Qt as parseMigrationLabelNumber, R as getConfiguredEditorCommand, Rn as isVerbose, Rt as executionsCommand, Sn as formatMigrationDiff, T as healthCommand, Tn as resourceTrn, Tt as triggerCommand, U as logBetaWarning, Un as workspaceArgs, Ut as getCommand$1, V as showCommand, Vn as paginationArgs, Vt as functionExecutionStatusToString, X as listCommand$11, Xt as MIGRATION_LABEL_KEY, Y as treeCommand, Zt as handleOptionalToRequiredError, _n as loadDiff, b as createCommand$4, bn as parseMigrationNumberArg, c as listCommand$14, cn as compareLocalTypesWithSnapshot, ct as createCommand$3, dn as getLatestMigrationNumber, en as generateAllTypeManifestsFromSnapshot, et as updateCommand$2, f as restoreCommand, ft as getCommand$3, g as getCommand$7, gn as isValidMigrationNumber, gt as listCommand$8, ht as tokenCommand, i as updateCommand$4, in as INITIAL_SCHEMA_NUMBER, it as getCommand$4, jt as jobsCommand, kn as prompt, m as listCommand$15, mn as getMigrationFiles, nt as listCommand$10, o as removeCommand, ot as deleteCommand$4, pn as getMigrationFilePath, qt as executeScript, r as queryCommand, sn as assertValidMigrationFiles, t as isNativeTypeScriptRuntime, tn as protoGqlPermission, u as inviteCommand, un as createSnapshotFromLocalTypes, ut as listCommand$9, v as deleteCommand$5, vn as reconstructSnapshotFromMigrations, vt as generate, wn as getNamespacesWithMigrations, wt as webhookCommand, xt as getCommand$2, yn as formatMigrationNumber, yt as listCommand$7, z as openInConfiguredEditor, zn as multiConfigArg } from "../runtime-DV1EnfMs.mjs";
|
|
6
|
+
import { $ as getOrNull, A as hasUserTokenEntry, B as resolveUserTokenKey, C as getDistDir, D as deleteUserTokens, E as loadConfig, G as fetchAll, H as writePlatformConfig, I as loadStoredUserTokens, J as fetchPaged, K as fetchAllTolerant, L as loadWorkspaceId, N as loadConsoleBaseUrl, O as fetchLatestToken, P as loadMachineUserName, R as platformConfigFromProfile, U as closeConnectionPool, V as saveUserTokens, W as defaultPlatformBaseUrl, X as fetchUserInfo, Y as fetchPlatformMachineUserToken, _ as composeFunctionTreeshakeOptions, a as resolveInlineSourcemap, g as platformBundleDefinePlugin, j as loadAccessToken, k as hasAnyUserTokenEntry, l as INVOKER_EXPR, nt as initOperatorClient, o as WorkflowJobSchema, rt as isDefaultPlatform, s as ResolverSchema, t as defineApplication, tt as initOAuth2Client, v as createLogLevelTreeshakeOptions, w as hashContent$1, y as resolveBundleLogLevel, z as readPlatformConfig } from "../application-BsH6tkZC.mjs";
|
|
7
|
+
import { n as ExecutorSchema } from "../service-BCRJ-3NV.mjs";
|
|
8
8
|
import { t as multiline } from "../multiline-sfHpTZZK.mjs";
|
|
9
|
-
import { r as isPluginGeneratedType } from "../seed-
|
|
9
|
+
import { r as isPluginGeneratedType } from "../seed-fm0LeYP2.mjs";
|
|
10
10
|
import { t as readPackageJson } from "../package-json-8b0O9TlX.mjs";
|
|
11
11
|
import { i as userAgent } from "../secret-file-VSVGy1V0.mjs";
|
|
12
12
|
import { n as isCLIError } from "../errors-Dtf2WPaW.mjs";
|
|
@@ -474,7 +474,8 @@ const deployCommand$1 = defineAppCommand({
|
|
|
474
474
|
aliases: ["apply"],
|
|
475
475
|
description: "Deploy your application by applying the Tailor configuration.",
|
|
476
476
|
args: z.object({
|
|
477
|
-
...
|
|
477
|
+
...workspaceArgs,
|
|
478
|
+
...multiConfigArg,
|
|
478
479
|
...confirmationArgs,
|
|
479
480
|
"dry-run": arg(z.boolean().optional(), {
|
|
480
481
|
alias: "d",
|
|
@@ -1287,7 +1288,7 @@ async function detectFunctionType(options) {
|
|
|
1287
1288
|
const rawInput = module.default.input;
|
|
1288
1289
|
let inputSchema;
|
|
1289
1290
|
if (rawInput) {
|
|
1290
|
-
const { t } = await import("../types-
|
|
1291
|
+
const { t } = await import("../types-KlawuVKa.mjs");
|
|
1291
1292
|
inputSchema = t.object(rawInput);
|
|
1292
1293
|
}
|
|
1293
1294
|
return {
|
|
@@ -2006,7 +2007,7 @@ const folderCommand = defineCommand({
|
|
|
2006
2007
|
description: "Manage organization folders.",
|
|
2007
2008
|
subCommands: {
|
|
2008
2009
|
create: createCommand$3,
|
|
2009
|
-
delete: deleteCommand$
|
|
2010
|
+
delete: deleteCommand$4,
|
|
2010
2011
|
get: getCommand$4,
|
|
2011
2012
|
list: listCommand$10,
|
|
2012
2013
|
update: updateCommand$2
|
|
@@ -2116,7 +2117,7 @@ const createCommand$2 = defineAppCommand({
|
|
|
2116
2117
|
|
|
2117
2118
|
//#endregion
|
|
2118
2119
|
//#region src/cli/commands/profile/delete.ts
|
|
2119
|
-
const deleteCommand$
|
|
2120
|
+
const deleteCommand$3 = defineAppCommand({
|
|
2120
2121
|
name: "delete",
|
|
2121
2122
|
description: "Delete a profile.",
|
|
2122
2123
|
args: z.object({ name: arg(z.string(), {
|
|
@@ -2273,7 +2274,7 @@ const profileCommand = defineCommand({
|
|
|
2273
2274
|
description: "Manage workspace profiles (user + workspace combinations).",
|
|
2274
2275
|
subCommands: {
|
|
2275
2276
|
create: createCommand$2,
|
|
2276
|
-
delete: deleteCommand$
|
|
2277
|
+
delete: deleteCommand$3,
|
|
2277
2278
|
list: listCommand$4,
|
|
2278
2279
|
update: updateCommand$1
|
|
2279
2280
|
},
|
|
@@ -2601,7 +2602,7 @@ const createCommand$1 = defineAppCommand({
|
|
|
2601
2602
|
|
|
2602
2603
|
//#endregion
|
|
2603
2604
|
//#region src/cli/commands/secret/vault/delete.ts
|
|
2604
|
-
const deleteCommand$
|
|
2605
|
+
const deleteCommand$2 = defineAppCommand({
|
|
2605
2606
|
name: "delete",
|
|
2606
2607
|
description: "Delete a Secret Manager vault.",
|
|
2607
2608
|
args: z.object({
|
|
@@ -2697,7 +2698,7 @@ const vaultCommand = defineCommand({
|
|
|
2697
2698
|
description: "Manage Secret Manager vaults.",
|
|
2698
2699
|
subCommands: {
|
|
2699
2700
|
create: createCommand$1,
|
|
2700
|
-
delete: deleteCommand$
|
|
2701
|
+
delete: deleteCommand$2,
|
|
2701
2702
|
list: listCommand$3
|
|
2702
2703
|
},
|
|
2703
2704
|
async run() {
|
|
@@ -3782,6 +3783,75 @@ async function checkGitHub(options) {
|
|
|
3782
3783
|
throw new Error(`Detected ${String(findings.length)} drift finding(s) across ${String(count)} target(s). Re-run \`tailor-sdk setup\` to regenerate, or address each finding above.`);
|
|
3783
3784
|
}
|
|
3784
3785
|
|
|
3786
|
+
//#endregion
|
|
3787
|
+
//#region src/cli/commands/setup/delete.ts
|
|
3788
|
+
function normalizeRelPath(input) {
|
|
3789
|
+
return input.replaceAll("\\", "/").replace(/\/{2,}/g, "/").replace(/^\.\//, "").replace(/\/$/, "");
|
|
3790
|
+
}
|
|
3791
|
+
function targetKey(target) {
|
|
3792
|
+
return `${target.kind}:${target.workspaceName}`;
|
|
3793
|
+
}
|
|
3794
|
+
function resolveMatch(outputDir, targets, input) {
|
|
3795
|
+
const relPath = normalizeRelPath(input);
|
|
3796
|
+
const absPath = resolveWithinRoot(outputDir, relPath);
|
|
3797
|
+
if (absPath === null) throw new Error(`"${input}" must be a path inside the repository.`);
|
|
3798
|
+
const target = targets.find((t) => t.file === relPath);
|
|
3799
|
+
if (!target) throw new Error(`"${relPath}" is not a managed workflow/action file (not recorded in .github/tailor-sdk.lock). Only files generated by \`tailor-sdk setup\` can be deleted with this command.`);
|
|
3800
|
+
return {
|
|
3801
|
+
relPath,
|
|
3802
|
+
absPath,
|
|
3803
|
+
target
|
|
3804
|
+
};
|
|
3805
|
+
}
|
|
3806
|
+
function warnCoordinatorReferences(allTargets, deletedKeys, match) {
|
|
3807
|
+
if (match.target.kind !== "action") return;
|
|
3808
|
+
for (const coordinator of allTargets) if (coordinator.kind === "coordinate" && coordinator.inputs.actionDirs?.includes(match.target.inputs.dir) && !deletedKeys.has(targetKey(coordinator))) logger.warn(`Coordinator "${coordinator.workspaceName}" still references this action's directory (${match.target.inputs.dir}). Re-run \`tailor-sdk setup coordinate\` without --action ${match.target.workspaceName} to remove it there too.`);
|
|
3809
|
+
}
|
|
3810
|
+
/**
|
|
3811
|
+
* Delete managed workflow/action files and their `.github/tailor-sdk.lock` entries.
|
|
3812
|
+
*
|
|
3813
|
+
* Refuses to touch files that are not recorded in the lock, so it never
|
|
3814
|
+
* deletes hand-written workflows or the user-owned tailor-setup action.
|
|
3815
|
+
* @param options - Delete options
|
|
3816
|
+
*/
|
|
3817
|
+
async function setupDelete(options) {
|
|
3818
|
+
logBetaWarning("setup");
|
|
3819
|
+
const { outputDir, yes } = options;
|
|
3820
|
+
const lock = readLock(outputDir);
|
|
3821
|
+
if (!lock || lock.targets.length === 0) throw new Error("No managed workflows found (.github/tailor-sdk.lock is missing or empty). Run `tailor-sdk setup branch` (or another setup subcommand) first.");
|
|
3822
|
+
const matches = [...new Set(options.files.map(normalizeRelPath))].map((relPath) => resolveMatch(outputDir, lock.targets, relPath));
|
|
3823
|
+
const deletedKeys = new Set(matches.map((m) => targetKey(m.target)));
|
|
3824
|
+
for (const match of matches) warnCoordinatorReferences(lock.targets, deletedKeys, match);
|
|
3825
|
+
if (!yes) {
|
|
3826
|
+
const list = matches.map((m) => m.relPath).join("\n ");
|
|
3827
|
+
if (!await prompt.confirm({
|
|
3828
|
+
message: `This will delete the following file(s) and their .github/tailor-sdk.lock entries:\n ${list}\nContinue?`,
|
|
3829
|
+
default: false
|
|
3830
|
+
})) {
|
|
3831
|
+
logger.info("Delete cancelled.");
|
|
3832
|
+
return;
|
|
3833
|
+
}
|
|
3834
|
+
}
|
|
3835
|
+
const remaining = [...lock.targets];
|
|
3836
|
+
try {
|
|
3837
|
+
for (const { relPath, absPath, target } of matches) {
|
|
3838
|
+
fs$1.rmSync(absPath, { force: true });
|
|
3839
|
+
if (target.kind === "action") {
|
|
3840
|
+
const dir = path.dirname(absPath);
|
|
3841
|
+
if (fs$1.existsSync(dir) && fs$1.readdirSync(dir).length === 0) fs$1.rmdirSync(dir);
|
|
3842
|
+
}
|
|
3843
|
+
const index = remaining.findIndex((t) => targetKey(t) === targetKey(target));
|
|
3844
|
+
if (index !== -1) remaining.splice(index, 1);
|
|
3845
|
+
logger.success(`Deleted ${styles.path(relPath)} (${target.kind} ${target.workspaceName})`);
|
|
3846
|
+
}
|
|
3847
|
+
} finally {
|
|
3848
|
+
if (remaining.length !== lock.targets.length) writeLock(outputDir, {
|
|
3849
|
+
version: 1,
|
|
3850
|
+
targets: remaining
|
|
3851
|
+
});
|
|
3852
|
+
}
|
|
3853
|
+
}
|
|
3854
|
+
|
|
3785
3855
|
//#endregion
|
|
3786
3856
|
//#region src/cli/commands/setup/index.ts
|
|
3787
3857
|
const checkCommand = defineAppCommand({
|
|
@@ -3940,6 +4010,24 @@ const previewCommand = defineAppCommand({
|
|
|
3940
4010
|
});
|
|
3941
4011
|
}
|
|
3942
4012
|
});
|
|
4013
|
+
const deleteCommand$1 = defineAppCommand({
|
|
4014
|
+
name: "delete",
|
|
4015
|
+
description: "Delete managed workflow/action file(s) and their .github/tailor-sdk.lock entries.",
|
|
4016
|
+
args: z.object({
|
|
4017
|
+
...confirmationArgs,
|
|
4018
|
+
files: arg(z.string().array().min(1), {
|
|
4019
|
+
positional: true,
|
|
4020
|
+
description: "Workflow/action file(s) to delete, as generated under .github/workflows or .github/actions"
|
|
4021
|
+
})
|
|
4022
|
+
}).strict(),
|
|
4023
|
+
run: async (args) => {
|
|
4024
|
+
await setupDelete({
|
|
4025
|
+
files: args.files,
|
|
4026
|
+
yes: args.yes,
|
|
4027
|
+
outputDir: process.cwd()
|
|
4028
|
+
});
|
|
4029
|
+
}
|
|
4030
|
+
});
|
|
3943
4031
|
const setupCommand = defineCommand({
|
|
3944
4032
|
name: "setup",
|
|
3945
4033
|
description: "Generate CI deploy workflows for your project. (beta)",
|
|
@@ -3949,7 +4037,8 @@ const setupCommand = defineCommand({
|
|
|
3949
4037
|
preview: previewCommand,
|
|
3950
4038
|
action: actionCommand,
|
|
3951
4039
|
coordinate: coordinateCommand,
|
|
3952
|
-
check: checkCommand
|
|
4040
|
+
check: checkCommand,
|
|
4041
|
+
delete: deleteCommand$1
|
|
3953
4042
|
}
|
|
3954
4043
|
});
|
|
3955
4044
|
|
|
@@ -4763,7 +4852,7 @@ function buildViewerHtml(options) {
|
|
|
4763
4852
|
const currentSchemaScript = options.currentSchema === void 0 ? "" : `\n <script type="application/json" id="erd-current-schema">${JSON.stringify(options.currentSchema).replaceAll("<", "\\u003c")}<\/script>`;
|
|
4764
4853
|
const diffScript = options.diff === void 0 ? "" : `\n <script type="application/json" id="erd-diff">${JSON.stringify(options.diff).replaceAll("<", "\\u003c")}<\/script>`;
|
|
4765
4854
|
const inlineScript = `<script type="module">\n${appJs.replace(/<\/script/gi, "<\\/script")}\n<\/script>`;
|
|
4766
|
-
return html.replace("<title>TailorDB ERD</title>", `<title>${escapeHtml(options.title ?? "TailorDB ERD")}</title>`).replace(STYLES_LINK, `<style>\n${css}\n</style>`).replace(APP_SCRIPT, `${embedScript}${currentSchemaScript}${diffScript}\n ${inlineScript}`);
|
|
4855
|
+
return html.replace("<title>TailorDB ERD</title>", () => `<title>${escapeHtml(options.title ?? "TailorDB ERD")}</title>`).replace(STYLES_LINK, () => `<style>\n${css}\n</style>`).replace(APP_SCRIPT, () => `${embedScript}${currentSchemaScript}${diffScript}\n ${inlineScript}`);
|
|
4767
4856
|
}
|
|
4768
4857
|
/**
|
|
4769
4858
|
* Write the self-contained TailorDB ERD viewer to `<distDir>/index.html`.
|
|
@@ -5934,19 +6023,14 @@ const statusCommand = defineAppCommand({
|
|
|
5934
6023
|
//#endregion
|
|
5935
6024
|
//#region src/cli/commands/tailordb/migrate/sync.ts
|
|
5936
6025
|
async function fetchRemoteGqlPermissions(client, workspaceId, namespace) {
|
|
5937
|
-
return
|
|
5938
|
-
|
|
5939
|
-
|
|
5940
|
-
|
|
5941
|
-
|
|
5942
|
-
|
|
5943
|
-
|
|
5944
|
-
|
|
5945
|
-
return [permissions, nextPageToken];
|
|
5946
|
-
} catch (error) {
|
|
5947
|
-
if (error instanceof ConnectError && error.code === Code.NotFound) return [[], ""];
|
|
5948
|
-
throw error;
|
|
5949
|
-
}
|
|
6026
|
+
return fetchAllTolerant(async (pageToken, maxPageSize) => {
|
|
6027
|
+
const { permissions, nextPageToken } = await client.listTailorDBGQLPermissions({
|
|
6028
|
+
workspaceId,
|
|
6029
|
+
namespaceName: namespace,
|
|
6030
|
+
pageToken,
|
|
6031
|
+
pageSize: maxPageSize
|
|
6032
|
+
});
|
|
6033
|
+
return [permissions, nextPageToken];
|
|
5950
6034
|
});
|
|
5951
6035
|
}
|
|
5952
6036
|
async function fetchRemoteTypes(client, workspaceId, namespace) {
|
|
@@ -5986,7 +6070,7 @@ async function fetchRemoteTypes(client, workspaceId, namespace) {
|
|
|
5986
6070
|
async function assertMigrationsReproduceLocalTypes(loaded, target) {
|
|
5987
6071
|
const { config, plugins } = loaded;
|
|
5988
6072
|
const pluginManager = plugins.length > 0 ? new PluginManager(plugins) : void 0;
|
|
5989
|
-
const { defineApplication, generatePluginFilesIfNeeded } = await import("../application-
|
|
6073
|
+
const { defineApplication, generatePluginFilesIfNeeded } = await import("../application-CSUhZMb5.mjs");
|
|
5990
6074
|
const application = defineApplication({
|
|
5991
6075
|
config,
|
|
5992
6076
|
pluginManager
|
|
@@ -5998,7 +6082,7 @@ async function assertMigrationsReproduceLocalTypes(loaded, target) {
|
|
|
5998
6082
|
await service.processNamespacePlugins();
|
|
5999
6083
|
}
|
|
6000
6084
|
const pluginExecutorFiles = generatePluginFilesIfNeeded(pluginManager, application.tailorDBServices, config.path);
|
|
6001
|
-
const executorService = application.executorService ?? (pluginExecutorFiles.length > 0 ? (await import("../service-
|
|
6085
|
+
const executorService = application.executorService ?? (pluginExecutorFiles.length > 0 ? (await import("../service-CPMlIg3X.mjs")).createExecutorService({ config: { files: [] } }) : void 0);
|
|
6002
6086
|
await executorService?.loadExecutors();
|
|
6003
6087
|
if (pluginExecutorFiles.length > 0) await executorService?.loadPluginExecutorFiles([...pluginExecutorFiles]);
|
|
6004
6088
|
const executorUsedTypes = /* @__PURE__ */ new Set();
|
|
@@ -6033,21 +6117,15 @@ async function assertMigrationsReproduceLocalTypes(loaded, target) {
|
|
|
6033
6117
|
* @returns Existing labels and the parsed current migration number
|
|
6034
6118
|
*/
|
|
6035
6119
|
async function fetchRemoteMigrationState(client, trn) {
|
|
6036
|
-
|
|
6120
|
+
const labels = (await getOrNull(async () => {
|
|
6037
6121
|
const { metadata } = await client.getMetadata({ trn });
|
|
6038
|
-
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
}
|
|
6045
|
-
if (error instanceof ConnectError && error.code === Code.NotFound) return {
|
|
6046
|
-
labels: {},
|
|
6047
|
-
current: null
|
|
6048
|
-
};
|
|
6049
|
-
throw error;
|
|
6050
|
-
}
|
|
6122
|
+
return metadata;
|
|
6123
|
+
}))?.labels ?? {};
|
|
6124
|
+
const label = labels[MIGRATION_LABEL_KEY];
|
|
6125
|
+
return {
|
|
6126
|
+
labels,
|
|
6127
|
+
current: label ? parseMigrationLabelNumber(label) : null
|
|
6128
|
+
};
|
|
6051
6129
|
}
|
|
6052
6130
|
function selectTargetNamespace(namespacesWithMigrations, requested) {
|
|
6053
6131
|
if (namespacesWithMigrations.length === 0) throw new Error("No TailorDB services with migrations configuration found");
|
|
@@ -6668,7 +6746,7 @@ const workspaceCommand = defineCommand({
|
|
|
6668
6746
|
subCommands: {
|
|
6669
6747
|
app: appCommand,
|
|
6670
6748
|
create: createCommand$4,
|
|
6671
|
-
delete: deleteCommand$
|
|
6749
|
+
delete: deleteCommand$5,
|
|
6672
6750
|
get: getCommand$7,
|
|
6673
6751
|
list: listCommand$15,
|
|
6674
6752
|
restore: restoreCommand,
|