@tailor-platform/sdk 1.84.0 → 1.85.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 +26 -0
- package/dist/application-C-zsrNjn.mjs +3 -0
- package/dist/{application-CnCljDwk.mjs → application-m5tYtz0-.mjs} +235 -62
- package/dist/application-m5tYtz0-.mjs.map +1 -0
- package/dist/cli/commands/deploy/tailordb/index.d.mts +1 -0
- package/dist/cli/commands/generate/seed/bundler.d.mts +2 -1
- package/dist/cli/commands/tailordb/migrate/schema-checks.d.mts +5 -0
- package/dist/cli/index.mjs +229 -22
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.mjs +92 -36
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/completion/zsh-worker.zsh +52 -2
- package/dist/node-builtins-CmaL2Cbq.mjs +36 -0
- package/dist/node-builtins-CmaL2Cbq.mjs.map +1 -0
- package/dist/plugin/builtin/seed/index.mjs +1 -1
- package/dist/{register-typescript-runtime-BCvWR3HC.mjs → register-typescript-runtime-nG-n9lPw.mjs} +336 -268
- package/dist/register-typescript-runtime-nG-n9lPw.mjs.map +1 -0
- package/dist/{seed-DFFigL8V.mjs → seed-6eTFj-3Q.mjs} +158 -41
- package/dist/seed-6eTFj-3Q.mjs.map +1 -0
- package/dist/vitest/index.mjs +3 -35
- package/dist/vitest/index.mjs.map +1 -1
- package/docs/cli/tailordb.md +29 -7
- package/docs/cli-reference.md +16 -15
- package/docs/generator/builtin.md +7 -0
- package/docs/services/tailordb-migration.md +11 -2
- package/package.json +7 -8
- package/dist/application-5FOWIxFQ.mjs +0 -3
- package/dist/application-CnCljDwk.mjs.map +0 -1
- package/dist/register-typescript-runtime-BCvWR3HC.mjs.map +0 -1
- package/dist/seed-DFFigL8V.mjs.map +0 -1
package/dist/{register-typescript-runtime-BCvWR3HC.mjs → register-typescript-runtime-nG-n9lPw.mjs}
RENAMED
|
@@ -2,13 +2,13 @@ import { t as db } from "./schema-CYrle8JZ.mjs";
|
|
|
2
2
|
import { $ as CreateAuthHookRequestSchema, B as IdPLang, Bt as Subgraph_ServiceType, C as CreateStaticWebsiteRequestSchema, Ct as AuthInvokerSchema, D as CreateSecretManagerSecretRequestSchema, Dt as AuthSCIMAttribute_Type, Et as AuthSCIMAttribute_Mutability, Ft as CreateApplicationRequestSchema, H as IdPPermissionPermit, Ht as UpdateAIGatewayRequestSchema, I as PipelineResolver_OperationType, It as GetApplicationSchemaHealthResponse_ApplicationSchemaHealthStatus, Jt as FilterSchema, K as CreateExecutorExecutorRequestSchema, Kt as ConditionSchema, L as CreateIdPServiceRequestSchema, Lt as UpdateApplicationRequestSchema, M as CreatePipelineServiceRequestSchema, Mt as UserProfileProviderConfig_UserProfileProviderType, N as UpdatePipelineResolverRequestSchema, O as CreateSecretManagerVaultRequestSchema, Ot as AuthSCIMAttribute_Uniqueness, P as UpdatePipelineServiceRequestSchema, Q as CreateAuthConnectionRequestSchema, R as UpdateIdPServiceRequestSchema, S as AddCustomDomainRequestSchema, St as AuthIDPConfig_AuthType, Tt as AuthOAuth2Client_GrantType, U as FunctionExecution_Status, V as IdPPermissionOperator, Vt as CreateAIGatewayRequestSchema, X as ExecutorTargetType, Y as ExecutorJobStatus, Yt as PageDirection, Z as ExecutorTriggerType, _ as TailorDBGQLPermission_Permit, _t as UpdateUserProfileConfigRequestSchema, a as CreateWorkflowRequestSchema, at as CreateAuthServiceRequestSchema, b as TailorDBType_Permission_Permit, bt as AuthConnection_Type, ct as UpdateAuthConnectionRequestSchema, d as CreateTailorDBServiceRequestSchema, dt as UpdateAuthMachineUserRequestSchema, et as CreateAuthIDPConfigRequestSchema, f as CreateTailorDBTypeRequestSchema, ft as UpdateAuthOAuth2ClientRequestSchema, g as TailorDBGQLPermission_Operator, gt as UpdateTenantConfigRequestSchema, h as TailorDBGQLPermission_Action, ht as UpdateAuthServiceRequestSchema, i as CreateWorkflowJobFunctionRequestSchema, it as CreateAuthSCIMResourceRequestSchema, j as CreatePipelineResolverRequestSchema, jt as TenantProviderConfig_TenantProviderType, k as UpdateSecretManagerSecretRequestSchema, kt as AuthSCIMConfig_AuthorizationType, l as WorkflowExecution_Status, lt as UpdateAuthHookRequestSchema, mt as UpdateAuthSCIMResourceRequestSchema, nt as CreateAuthOAuth2ClientRequestSchema, o as UpdateWorkflowJobFunctionExecutionPolicyRequestSchema, ot as CreateTenantConfigRequestSchema, p as UpdateTailorDBTypeRequestSchema, pt as UpdateAuthSCIMConfigRequestSchema, q as UpdateExecutorExecutorRequestSchema, qt as Condition_Operator, r as CreateWorkflowJobFunctionExecutionPolicyRequestSchema, rt as CreateAuthSCIMConfigRequestSchema, s as UpdateWorkflowRequestSchema, st as CreateUserProfileConfigRequestSchema, t as WorkspacePlatformUserRole, tt as CreateAuthMachineUserRequestSchema, u as WorkflowJobExecution_Status, ut as UpdateAuthIDPConfigRequestSchema, v as TailorDBTypeSchema, w as UpdateStaticWebsiteRequestSchema, wt as AuthOAuth2Client_ClientType, x as TailorDBType_PermitAction, xt as AuthHookPoint, y as TailorDBType_Permission_Operator, yt as AuthConnection_Status, zt as ApplicationSchemaUpdateAttemptStatus } from "./workspace_resource_pb-DXnO2AT-.mjs";
|
|
3
3
|
import { t as assertDefined } from "./assert-DBxo8jPo.mjs";
|
|
4
4
|
import { a as parseBoolean, i as symbols, n as logger, o as renderTable, r as styles, t as CIPromptError } from "./logger-CXQq9YIp.mjs";
|
|
5
|
-
import {
|
|
5
|
+
import { $ as LOG_LEVELS, A as hashContent, B as getConsoleBaseUrl, D as hasGenerationHooks, E as getPluginGenerationDependencies, F as fetchAllTolerant, G as initOperatorClient, H as getOrNull, I as fetchMachineUserToken, J as normalizeBaseUrl, K as isDefaultPlatform, L as fetchPaged, N as defaultPlatformBaseUrl, O as createBundleCache, P as fetchAll, Q as createApplyLimiter, T as createBundleLog, U as getPlatformBaseUrl, V as getOAuth2ClientId, W as initOAuth2Client, X as resolveStaticWebsiteUrls, Y as rememberPlatformConfigForToken, Z as byName, _ as stringifyFunction, b as resolveTSConfigWithFallback, d as buildExecutorArgsExpr, f as buildResolverOperationHookExpr, g as TailorDBTypeSchema$1, h as assertUniqueTailorDBTypeNamesWithExternal, i as resolverBundleKey, j as hashFile, k as getDistDir, l as HTTP_METHODS, m as assertUniqueLocalTailorDBTypeNames, n as generatePluginFilesIfNeeded, o as WorkflowJobFunctionExecutionPolicySchema, q as isNotFoundError, r as loadApplication, t as defineApplication, v as createGeneratedEntryResolverPlugin, x as platformBundleDefinePlugin, y as createTsconfigPathsPlugin } from "./application-m5tYtz0-.mjs";
|
|
6
6
|
import { o as loadFilesWithIgnores, s as functionSchema, t as createExecutorService } from "./service-CPJWhTLn.mjs";
|
|
7
7
|
import { n as enumConstantsPlugin, t as EnumConstantsGeneratorID } from "./enum-constants-j9QBF0cB.mjs";
|
|
8
8
|
import { t as multiline } from "./multiline-sfHpTZZK.mjs";
|
|
9
9
|
import { n as fileUtilsPlugin, t as FileUtilsGeneratorID } from "./file-utils-DcyIPFQh.mjs";
|
|
10
10
|
import { n as kyselyTypePlugin, t as KyselyGeneratorID } from "./kysely-type-D-zflMGf.mjs";
|
|
11
|
-
import { n as seedPlugin, t as SeedGeneratorID } from "./seed-
|
|
11
|
+
import { n as seedPlugin, t as SeedGeneratorID } from "./seed-6eTFj-3Q.mjs";
|
|
12
12
|
import { t as readPackageJson } from "./package-json-8b0O9TlX.mjs";
|
|
13
13
|
import { t as userAgent } from "./user-agent-DX2Jnw0-.mjs";
|
|
14
14
|
import { r as isCLIError, t as createCLIError } from "./errors-DVFS0AZk.mjs";
|
|
@@ -9544,6 +9544,283 @@ function handleOptionalToRequiredError(error, messages) {
|
|
|
9544
9544
|
throw error;
|
|
9545
9545
|
}
|
|
9546
9546
|
|
|
9547
|
+
//#endregion
|
|
9548
|
+
//#region src/cli/commands/tailordb/migrate/schema-checks.ts
|
|
9549
|
+
/**
|
|
9550
|
+
* Schema validation checks shared between `deploy` and
|
|
9551
|
+
* `tailordb migration validate`.
|
|
9552
|
+
*
|
|
9553
|
+
* These checks are read-only: they compare local type definitions, the
|
|
9554
|
+
* migration snapshot history, and the remote schema without mutating any
|
|
9555
|
+
* state.
|
|
9556
|
+
*/
|
|
9557
|
+
/**
|
|
9558
|
+
* Convert a runtime TailorDBService to the snapshot-shaped deploy input.
|
|
9559
|
+
* @param service - Loaded TailorDB service (after `loadTypes()`)
|
|
9560
|
+
* @returns The canonical snapshot-shaped deploy input for downstream plan/apply phases.
|
|
9561
|
+
*/
|
|
9562
|
+
function toTailorDBDeployInput(service) {
|
|
9563
|
+
const types = {};
|
|
9564
|
+
for (const [typeName, type] of Object.entries(service.types)) types[typeName] = createSnapshotType(type);
|
|
9565
|
+
return {
|
|
9566
|
+
namespace: service.namespace,
|
|
9567
|
+
config: service.config,
|
|
9568
|
+
types
|
|
9569
|
+
};
|
|
9570
|
+
}
|
|
9571
|
+
/**
|
|
9572
|
+
* Fetch all TailorDB types from remote for a namespace
|
|
9573
|
+
* @param {OperatorClient} client - Operator client instance
|
|
9574
|
+
* @param {string} workspaceId - Workspace ID
|
|
9575
|
+
* @param {string} namespace - TailorDB namespace
|
|
9576
|
+
* @returns {Promise<ProtoTailorDBType[]>} Remote TailorDB types
|
|
9577
|
+
*/
|
|
9578
|
+
async function fetchRemoteTypes(client, workspaceId, namespace) {
|
|
9579
|
+
return fetchAllTolerant(async (pageToken, maxPageSize) => {
|
|
9580
|
+
const { tailordbTypes, nextPageToken } = await client.listTailorDBTypes({
|
|
9581
|
+
workspaceId,
|
|
9582
|
+
namespaceName: namespace,
|
|
9583
|
+
pageToken,
|
|
9584
|
+
pageSize: maxPageSize
|
|
9585
|
+
});
|
|
9586
|
+
return [tailordbTypes, nextPageToken];
|
|
9587
|
+
});
|
|
9588
|
+
}
|
|
9589
|
+
async function fetchRemoteGqlPermissions(client, workspaceId, namespace) {
|
|
9590
|
+
return fetchAllTolerant(async (pageToken, maxPageSize) => {
|
|
9591
|
+
const { permissions, nextPageToken } = await client.listTailorDBGQLPermissions({
|
|
9592
|
+
workspaceId,
|
|
9593
|
+
namespaceName: namespace,
|
|
9594
|
+
pageToken,
|
|
9595
|
+
pageSize: maxPageSize
|
|
9596
|
+
});
|
|
9597
|
+
return [permissions, nextPageToken];
|
|
9598
|
+
});
|
|
9599
|
+
}
|
|
9600
|
+
function definedWhenNotEmpty(value) {
|
|
9601
|
+
return Object.keys(value).length > 0 ? value : void 0;
|
|
9602
|
+
}
|
|
9603
|
+
function namespaceConfig(config, tailorDBInputs, namespace) {
|
|
9604
|
+
return tailorDBInputs.find((input) => input.namespace === namespace)?.config ?? config.db?.[namespace];
|
|
9605
|
+
}
|
|
9606
|
+
function namespaceGqlOperations(config, tailorDBInputs, namespace) {
|
|
9607
|
+
return namespaceConfig(config, tailorDBInputs, namespace)?.gqlOperations;
|
|
9608
|
+
}
|
|
9609
|
+
const GQL_OPERATION_KEYS = [
|
|
9610
|
+
"create",
|
|
9611
|
+
"update",
|
|
9612
|
+
"delete",
|
|
9613
|
+
"read"
|
|
9614
|
+
];
|
|
9615
|
+
function configuredDisabledGqlOperations(operations) {
|
|
9616
|
+
if (!operations) return void 0;
|
|
9617
|
+
if (operations === "query") return {
|
|
9618
|
+
create: false,
|
|
9619
|
+
update: false,
|
|
9620
|
+
delete: false
|
|
9621
|
+
};
|
|
9622
|
+
const disabled = {};
|
|
9623
|
+
for (const key of GQL_OPERATION_KEYS) if (operations[key] === false) disabled[key] = false;
|
|
9624
|
+
return definedWhenNotEmpty(disabled);
|
|
9625
|
+
}
|
|
9626
|
+
function appliedConfiguredDisabledGqlOperations(remoteDisabled, configuredDisabled) {
|
|
9627
|
+
if (!remoteDisabled || !configuredDisabled) return void 0;
|
|
9628
|
+
const disabled = {};
|
|
9629
|
+
for (const key of GQL_OPERATION_KEYS) if (configuredDisabled[key] === false && remoteDisabled[key]) disabled[key] = false;
|
|
9630
|
+
return definedWhenNotEmpty(disabled);
|
|
9631
|
+
}
|
|
9632
|
+
function deployComparableSnapshot(snapshot, remoteTypes, gqlOperations) {
|
|
9633
|
+
const remoteTypesByName = new Map(remoteTypes.map((type) => [type.name, type]));
|
|
9634
|
+
const configuredDisabled = configuredDisabledGqlOperations(gqlOperations);
|
|
9635
|
+
const types = {};
|
|
9636
|
+
for (const [typeName, type] of Object.entries(snapshot.types)) {
|
|
9637
|
+
const settings = { ...type.settings };
|
|
9638
|
+
const remoteSettings = remoteTypesByName.get(typeName)?.schema?.settings;
|
|
9639
|
+
if (type.settings?.publishEvents === void 0 && remoteSettings?.publishRecordEvents) settings.publishEvents = true;
|
|
9640
|
+
if (type.settings?.gqlOperations === void 0) {
|
|
9641
|
+
const disabled = appliedConfiguredDisabledGqlOperations(remoteSettings?.disableGqlOperations, configuredDisabled);
|
|
9642
|
+
if (disabled) settings.gqlOperations = disabled;
|
|
9643
|
+
}
|
|
9644
|
+
const comparableType = { ...type };
|
|
9645
|
+
const comparableSettings = definedWhenNotEmpty(settings);
|
|
9646
|
+
if (comparableSettings) comparableType.settings = comparableSettings;
|
|
9647
|
+
else delete comparableType.settings;
|
|
9648
|
+
types[typeName] = comparableType;
|
|
9649
|
+
}
|
|
9650
|
+
return {
|
|
9651
|
+
...snapshot,
|
|
9652
|
+
types
|
|
9653
|
+
};
|
|
9654
|
+
}
|
|
9655
|
+
async function getRemoteMigrationNumberState(client, workspaceId, namespace) {
|
|
9656
|
+
const trn = resourceTrn(workspaceId, "tailordb", namespace);
|
|
9657
|
+
const metadata = await getOrNull(async () => {
|
|
9658
|
+
const { metadata } = await client.getMetadata({ trn });
|
|
9659
|
+
return metadata;
|
|
9660
|
+
});
|
|
9661
|
+
if (!metadata) return {
|
|
9662
|
+
metadataExists: false,
|
|
9663
|
+
number: null
|
|
9664
|
+
};
|
|
9665
|
+
const label = metadata.labels[MIGRATION_LABEL_KEY];
|
|
9666
|
+
if (!label) return {
|
|
9667
|
+
metadataExists: true,
|
|
9668
|
+
number: null
|
|
9669
|
+
};
|
|
9670
|
+
return {
|
|
9671
|
+
metadataExists: true,
|
|
9672
|
+
number: parseMigrationLabelNumber(label)
|
|
9673
|
+
};
|
|
9674
|
+
}
|
|
9675
|
+
/**
|
|
9676
|
+
* Get the current migration number from remote metadata
|
|
9677
|
+
* @param {OperatorClient} client - Operator client instance
|
|
9678
|
+
* @param {string} workspaceId - Workspace ID
|
|
9679
|
+
* @param {string} namespace - TailorDB namespace
|
|
9680
|
+
* @returns {Promise<number | null>} Current migration number, or null if no migration label exists
|
|
9681
|
+
*/
|
|
9682
|
+
async function getRemoteMigrationNumber(client, workspaceId, namespace) {
|
|
9683
|
+
return (await getRemoteMigrationNumberState(client, workspaceId, namespace)).number;
|
|
9684
|
+
}
|
|
9685
|
+
/**
|
|
9686
|
+
* Verify remote schema matches the expected snapshot state
|
|
9687
|
+
* @param {OperatorClient} client - Operator client instance
|
|
9688
|
+
* @param {string} workspaceId - Workspace ID
|
|
9689
|
+
* @param {NamespaceWithMigrations[]} namespacesWithMigrations - Namespaces with migration config
|
|
9690
|
+
* @param {LoadedConfig} config - Loaded application config
|
|
9691
|
+
* @param {ReadonlyArray<TailorDBDeployInput>} tailorDBInputs - Deploy inputs for namespace defaults
|
|
9692
|
+
* @returns {Promise<RemoteSchemaVerificationResult[]>} Verification results per namespace
|
|
9693
|
+
*/
|
|
9694
|
+
async function verifyRemoteSchema(client, workspaceId, namespacesWithMigrations, config, tailorDBInputs) {
|
|
9695
|
+
const results = [];
|
|
9696
|
+
for (const { namespace, migrationsDir } of namespacesWithMigrations) {
|
|
9697
|
+
const { metadataExists, number: remoteMigrationNumber } = await getRemoteMigrationNumberState(client, workspaceId, namespace);
|
|
9698
|
+
if (remoteMigrationNumber === null) {
|
|
9699
|
+
results.push({
|
|
9700
|
+
namespace,
|
|
9701
|
+
remoteMigrationNumber: 0,
|
|
9702
|
+
drifts: [],
|
|
9703
|
+
hasDrift: false,
|
|
9704
|
+
skipped: metadataExists ? "no_migration_label" : "not_deployed"
|
|
9705
|
+
});
|
|
9706
|
+
continue;
|
|
9707
|
+
}
|
|
9708
|
+
if (remoteMigrationNumber > getLatestMigrationNumber(migrationsDir)) {
|
|
9709
|
+
results.push({
|
|
9710
|
+
namespace,
|
|
9711
|
+
remoteMigrationNumber,
|
|
9712
|
+
drifts: [],
|
|
9713
|
+
hasDrift: false,
|
|
9714
|
+
checkpointMissingLocal: true
|
|
9715
|
+
});
|
|
9716
|
+
continue;
|
|
9717
|
+
}
|
|
9718
|
+
const expectedSnapshot = reconstructSnapshotFromMigrations(migrationsDir, remoteMigrationNumber);
|
|
9719
|
+
if (!expectedSnapshot) {
|
|
9720
|
+
results.push({
|
|
9721
|
+
namespace,
|
|
9722
|
+
remoteMigrationNumber,
|
|
9723
|
+
drifts: [],
|
|
9724
|
+
hasDrift: false,
|
|
9725
|
+
skipped: "no_snapshot"
|
|
9726
|
+
});
|
|
9727
|
+
continue;
|
|
9728
|
+
}
|
|
9729
|
+
const [remoteTypes, remoteGqlPermissions] = await Promise.all([fetchRemoteTypes(client, workspaceId, namespace), fetchRemoteGqlPermissions(client, workspaceId, namespace)]);
|
|
9730
|
+
const drifts = compareRemoteWithSnapshot(remoteTypes, deployComparableSnapshot(expectedSnapshot, remoteTypes, namespaceGqlOperations(config, tailorDBInputs, namespace)), remoteGqlPermissions);
|
|
9731
|
+
results.push({
|
|
9732
|
+
namespace,
|
|
9733
|
+
remoteMigrationNumber,
|
|
9734
|
+
drifts,
|
|
9735
|
+
hasDrift: drifts.length > 0
|
|
9736
|
+
});
|
|
9737
|
+
}
|
|
9738
|
+
return results;
|
|
9739
|
+
}
|
|
9740
|
+
/**
|
|
9741
|
+
* Log common causes of remote schema drift and how to resolve them
|
|
9742
|
+
*/
|
|
9743
|
+
function logRemoteDriftGuidance() {
|
|
9744
|
+
logger.info("This may indicate:");
|
|
9745
|
+
logger.info(" - Another developer applied different migrations", { mode: "plain" });
|
|
9746
|
+
logger.info(" - Manual schema changes were made directly", { mode: "plain" });
|
|
9747
|
+
logger.info(" - Migration history is out of sync", { mode: "plain" });
|
|
9748
|
+
logger.newline();
|
|
9749
|
+
logger.info("To resolve:");
|
|
9750
|
+
logger.info(" - Run 'tailor-sdk tailordb migration status' to compare local vs remote.", { mode: "plain" });
|
|
9751
|
+
logger.info(" - If remote is correct, update local types and run 'migration generate'.", { mode: "plain" });
|
|
9752
|
+
logger.info(" - If local migration history is correct, run 'migration sync <N>' to overwrite remote.", { mode: "plain" });
|
|
9753
|
+
logger.info(" - If only bookkeeping is stale, run 'migration set <N>'.", { mode: "plain" });
|
|
9754
|
+
}
|
|
9755
|
+
/**
|
|
9756
|
+
* Format remote schema verification results for display
|
|
9757
|
+
* @param {RemoteSchemaVerificationResult[]} results - Verification results
|
|
9758
|
+
* @returns {string} Formatted results string
|
|
9759
|
+
*/
|
|
9760
|
+
function formatRemoteVerificationResults(results) {
|
|
9761
|
+
const lines = [];
|
|
9762
|
+
for (const result of results) {
|
|
9763
|
+
if (!result.hasDrift) continue;
|
|
9764
|
+
lines.push(`Namespace: ${result.namespace}`);
|
|
9765
|
+
lines.push(` Remote migration: ${formatMigrationNumber(result.remoteMigrationNumber)}`);
|
|
9766
|
+
lines.push(` Differences:`);
|
|
9767
|
+
lines.push(formatSchemaDrifts(result.drifts));
|
|
9768
|
+
lines.push("");
|
|
9769
|
+
}
|
|
9770
|
+
return lines.join("\n");
|
|
9771
|
+
}
|
|
9772
|
+
/**
|
|
9773
|
+
* Check if there are schema differences between migration snapshots and local definitions
|
|
9774
|
+
* @param {ReadonlyMap<string, Record<string, TailorDBSnapshotType>>} typesByNamespace - Snapshot-shaped local types by namespace
|
|
9775
|
+
* @param {NamespaceWithMigrations[]} namespacesWithMigrations - Namespaces with migrations config
|
|
9776
|
+
* @returns {Promise<MigrationCheckResult[]>} Results for each namespace
|
|
9777
|
+
*/
|
|
9778
|
+
async function checkMigrationDiffs(typesByNamespace, namespacesWithMigrations) {
|
|
9779
|
+
const results = [];
|
|
9780
|
+
for (const { namespace, migrationsDir } of namespacesWithMigrations) {
|
|
9781
|
+
const localTypes = typesByNamespace.get(namespace);
|
|
9782
|
+
if (!localTypes) continue;
|
|
9783
|
+
const previousSnapshot = reconstructSnapshotFromMigrations(migrationsDir);
|
|
9784
|
+
if (!previousSnapshot) {
|
|
9785
|
+
results.push({
|
|
9786
|
+
namespace,
|
|
9787
|
+
migrationsDir,
|
|
9788
|
+
hasDiff: true,
|
|
9789
|
+
diff: void 0
|
|
9790
|
+
});
|
|
9791
|
+
continue;
|
|
9792
|
+
}
|
|
9793
|
+
const diff = compareLocalTypesWithSnapshot(previousSnapshot, localTypes, namespace);
|
|
9794
|
+
results.push({
|
|
9795
|
+
namespace,
|
|
9796
|
+
migrationsDir,
|
|
9797
|
+
hasDiff: hasChanges(diff),
|
|
9798
|
+
diff: hasChanges(diff) ? diff : void 0
|
|
9799
|
+
});
|
|
9800
|
+
}
|
|
9801
|
+
return results;
|
|
9802
|
+
}
|
|
9803
|
+
/**
|
|
9804
|
+
* Format migration check results for display
|
|
9805
|
+
* @param {MigrationCheckResult[]} results - Migration check results
|
|
9806
|
+
* @returns {string} Formatted results string
|
|
9807
|
+
*/
|
|
9808
|
+
function formatMigrationCheckResults(results) {
|
|
9809
|
+
const lines = [];
|
|
9810
|
+
for (const result of results) {
|
|
9811
|
+
if (!result.hasDiff) continue;
|
|
9812
|
+
lines.push(`Namespace: ${result.namespace}`);
|
|
9813
|
+
if (!result.diff) lines.push(" No migration snapshot found. Run 'tailor-sdk tailordb migration generate' first.");
|
|
9814
|
+
else {
|
|
9815
|
+
lines.push(` ${formatDiffSummary(result.diff)}`);
|
|
9816
|
+
lines.push("");
|
|
9817
|
+
lines.push(formatMigrationDiff(result.diff));
|
|
9818
|
+
}
|
|
9819
|
+
lines.push("");
|
|
9820
|
+
}
|
|
9821
|
+
return lines.join("\n");
|
|
9822
|
+
}
|
|
9823
|
+
|
|
9547
9824
|
//#endregion
|
|
9548
9825
|
//#region src/cli/commands/tailordb/migrate/bundler.ts
|
|
9549
9826
|
/**
|
|
@@ -9592,31 +9869,39 @@ async function bundleMigrationScript(sourceFile, namespace, migrationNumber, env
|
|
|
9592
9869
|
}
|
|
9593
9870
|
`;
|
|
9594
9871
|
fs$1.writeFileSync(entryPath, entryContent);
|
|
9595
|
-
const
|
|
9872
|
+
const projectDir = baseDir ?? path.dirname(absoluteSourcePath);
|
|
9873
|
+
const tsconfig = await resolveTSConfigWithFallback(projectDir);
|
|
9874
|
+
const bundleLog = createBundleLog({ tsconfig });
|
|
9875
|
+
const result = await rolldown.build({
|
|
9876
|
+
plugins: [
|
|
9877
|
+
createGeneratedEntryResolverPlugin(entryPath, projectDir),
|
|
9878
|
+
createTsconfigPathsPlugin(),
|
|
9879
|
+
platformBundleDefinePlugin
|
|
9880
|
+
],
|
|
9881
|
+
input: entryPath,
|
|
9882
|
+
write: false,
|
|
9883
|
+
output: {
|
|
9884
|
+
format: "esm",
|
|
9885
|
+
sourcemap: false,
|
|
9886
|
+
minify: false,
|
|
9887
|
+
codeSplitting: false,
|
|
9888
|
+
globals: { tailordb: "tailordb" }
|
|
9889
|
+
},
|
|
9890
|
+
external: ["tailordb"],
|
|
9891
|
+
resolve: { conditionNames: ["node", "import"] },
|
|
9892
|
+
tsconfig,
|
|
9893
|
+
treeshake: {
|
|
9894
|
+
moduleSideEffects: false,
|
|
9895
|
+
annotations: true,
|
|
9896
|
+
unknownGlobalSideEffects: false
|
|
9897
|
+
},
|
|
9898
|
+
...bundleLog.options
|
|
9899
|
+
});
|
|
9900
|
+
bundleLog.assertAllResolved();
|
|
9596
9901
|
return {
|
|
9597
9902
|
namespace,
|
|
9598
9903
|
migrationNumber,
|
|
9599
|
-
bundledCode:
|
|
9600
|
-
plugins: [platformBundleDefinePlugin],
|
|
9601
|
-
input: entryPath,
|
|
9602
|
-
write: false,
|
|
9603
|
-
output: {
|
|
9604
|
-
format: "esm",
|
|
9605
|
-
sourcemap: false,
|
|
9606
|
-
minify: false,
|
|
9607
|
-
codeSplitting: false,
|
|
9608
|
-
globals: { tailordb: "tailordb" }
|
|
9609
|
-
},
|
|
9610
|
-
external: ["tailordb"],
|
|
9611
|
-
resolve: { conditionNames: ["node", "import"] },
|
|
9612
|
-
tsconfig,
|
|
9613
|
-
treeshake: {
|
|
9614
|
-
moduleSideEffects: false,
|
|
9615
|
-
annotations: true,
|
|
9616
|
-
unknownGlobalSideEffects: false
|
|
9617
|
-
},
|
|
9618
|
-
logLevel: "silent"
|
|
9619
|
-
})).output[0].code
|
|
9904
|
+
bundledCode: result.output[0].code
|
|
9620
9905
|
};
|
|
9621
9906
|
}
|
|
9622
9907
|
|
|
@@ -10045,169 +10330,6 @@ function groupMigrationsByNamespace(migrations) {
|
|
|
10045
10330
|
|
|
10046
10331
|
//#endregion
|
|
10047
10332
|
//#region src/cli/commands/deploy/tailordb/index.ts
|
|
10048
|
-
/**
|
|
10049
|
-
* Fetch all TailorDB types from remote for a namespace
|
|
10050
|
-
* @param {OperatorClient} client - Operator client instance
|
|
10051
|
-
* @param {string} workspaceId - Workspace ID
|
|
10052
|
-
* @param {string} namespace - TailorDB namespace
|
|
10053
|
-
* @returns {Promise<ProtoTailorDBType[]>} Remote TailorDB types
|
|
10054
|
-
*/
|
|
10055
|
-
async function fetchRemoteTypes(client, workspaceId, namespace) {
|
|
10056
|
-
return fetchAllTolerant(async (pageToken, maxPageSize) => {
|
|
10057
|
-
const { tailordbTypes, nextPageToken } = await client.listTailorDBTypes({
|
|
10058
|
-
workspaceId,
|
|
10059
|
-
namespaceName: namespace,
|
|
10060
|
-
pageToken,
|
|
10061
|
-
pageSize: maxPageSize
|
|
10062
|
-
});
|
|
10063
|
-
return [tailordbTypes, nextPageToken];
|
|
10064
|
-
});
|
|
10065
|
-
}
|
|
10066
|
-
async function fetchRemoteGqlPermissions(client, workspaceId, namespace) {
|
|
10067
|
-
return fetchAllTolerant(async (pageToken, maxPageSize) => {
|
|
10068
|
-
const { permissions, nextPageToken } = await client.listTailorDBGQLPermissions({
|
|
10069
|
-
workspaceId,
|
|
10070
|
-
namespaceName: namespace,
|
|
10071
|
-
pageToken,
|
|
10072
|
-
pageSize: maxPageSize
|
|
10073
|
-
});
|
|
10074
|
-
return [permissions, nextPageToken];
|
|
10075
|
-
});
|
|
10076
|
-
}
|
|
10077
|
-
function definedWhenNotEmpty(value) {
|
|
10078
|
-
return Object.keys(value).length > 0 ? value : void 0;
|
|
10079
|
-
}
|
|
10080
|
-
function namespaceConfig(config, tailorDBInputs, namespace) {
|
|
10081
|
-
return tailorDBInputs.find((input) => input.namespace === namespace)?.config ?? config.db?.[namespace];
|
|
10082
|
-
}
|
|
10083
|
-
function namespaceGqlOperations(config, tailorDBInputs, namespace) {
|
|
10084
|
-
return namespaceConfig(config, tailorDBInputs, namespace)?.gqlOperations;
|
|
10085
|
-
}
|
|
10086
|
-
const GQL_OPERATION_KEYS = [
|
|
10087
|
-
"create",
|
|
10088
|
-
"update",
|
|
10089
|
-
"delete",
|
|
10090
|
-
"read"
|
|
10091
|
-
];
|
|
10092
|
-
function configuredDisabledGqlOperations(operations) {
|
|
10093
|
-
if (!operations) return void 0;
|
|
10094
|
-
if (operations === "query") return {
|
|
10095
|
-
create: false,
|
|
10096
|
-
update: false,
|
|
10097
|
-
delete: false
|
|
10098
|
-
};
|
|
10099
|
-
const disabled = {};
|
|
10100
|
-
for (const key of GQL_OPERATION_KEYS) if (operations[key] === false) disabled[key] = false;
|
|
10101
|
-
return definedWhenNotEmpty(disabled);
|
|
10102
|
-
}
|
|
10103
|
-
function appliedConfiguredDisabledGqlOperations(remoteDisabled, configuredDisabled) {
|
|
10104
|
-
if (!remoteDisabled || !configuredDisabled) return void 0;
|
|
10105
|
-
const disabled = {};
|
|
10106
|
-
for (const key of GQL_OPERATION_KEYS) if (configuredDisabled[key] === false && remoteDisabled[key]) disabled[key] = false;
|
|
10107
|
-
return definedWhenNotEmpty(disabled);
|
|
10108
|
-
}
|
|
10109
|
-
function deployComparableSnapshot(snapshot, remoteTypes, gqlOperations) {
|
|
10110
|
-
const remoteTypesByName = new Map(remoteTypes.map((type) => [type.name, type]));
|
|
10111
|
-
const configuredDisabled = configuredDisabledGqlOperations(gqlOperations);
|
|
10112
|
-
const types = {};
|
|
10113
|
-
for (const [typeName, type] of Object.entries(snapshot.types)) {
|
|
10114
|
-
const settings = { ...type.settings };
|
|
10115
|
-
const remoteSettings = remoteTypesByName.get(typeName)?.schema?.settings;
|
|
10116
|
-
if (type.settings?.publishEvents === void 0 && remoteSettings?.publishRecordEvents) settings.publishEvents = true;
|
|
10117
|
-
if (type.settings?.gqlOperations === void 0) {
|
|
10118
|
-
const disabled = appliedConfiguredDisabledGqlOperations(remoteSettings?.disableGqlOperations, configuredDisabled);
|
|
10119
|
-
if (disabled) settings.gqlOperations = disabled;
|
|
10120
|
-
}
|
|
10121
|
-
const comparableType = { ...type };
|
|
10122
|
-
const comparableSettings = definedWhenNotEmpty(settings);
|
|
10123
|
-
if (comparableSettings) comparableType.settings = comparableSettings;
|
|
10124
|
-
else delete comparableType.settings;
|
|
10125
|
-
types[typeName] = comparableType;
|
|
10126
|
-
}
|
|
10127
|
-
return {
|
|
10128
|
-
...snapshot,
|
|
10129
|
-
types
|
|
10130
|
-
};
|
|
10131
|
-
}
|
|
10132
|
-
/**
|
|
10133
|
-
* Get the current migration number from remote metadata
|
|
10134
|
-
* @param {OperatorClient} client - Operator client instance
|
|
10135
|
-
* @param {string} workspaceId - Workspace ID
|
|
10136
|
-
* @param {string} namespace - TailorDB namespace
|
|
10137
|
-
* @returns {Promise<number | null>} Current migration number, or null if no migration label exists
|
|
10138
|
-
*/
|
|
10139
|
-
async function getRemoteMigrationNumber(client, workspaceId, namespace) {
|
|
10140
|
-
try {
|
|
10141
|
-
const trn = resourceTrn(workspaceId, "tailordb", namespace);
|
|
10142
|
-
const { metadata } = await client.getMetadata({ trn });
|
|
10143
|
-
const label = metadata?.labels["sdk-migration"];
|
|
10144
|
-
if (!label) return null;
|
|
10145
|
-
const match = label.match(/^m(\d+)$/);
|
|
10146
|
-
return match ? parseInt(assertDefined(match[1], "migration label capture group missing"), 10) : null;
|
|
10147
|
-
} catch {
|
|
10148
|
-
return null;
|
|
10149
|
-
}
|
|
10150
|
-
}
|
|
10151
|
-
/**
|
|
10152
|
-
* Verify remote schema matches the expected snapshot state
|
|
10153
|
-
* @param {OperatorClient} client - Operator client instance
|
|
10154
|
-
* @param {string} workspaceId - Workspace ID
|
|
10155
|
-
* @param {NamespaceWithMigrations[]} namespacesWithMigrations - Namespaces with migration config
|
|
10156
|
-
* @param {LoadedConfig} config - Loaded application config
|
|
10157
|
-
* @param {ReadonlyArray<TailorDBDeployInput>} tailorDBInputs - Deploy inputs for namespace defaults
|
|
10158
|
-
* @returns {Promise<RemoteSchemaVerificationResult[]>} Verification results per namespace
|
|
10159
|
-
*/
|
|
10160
|
-
async function verifyRemoteSchema(client, workspaceId, namespacesWithMigrations, config, tailorDBInputs) {
|
|
10161
|
-
const results = [];
|
|
10162
|
-
for (const { namespace, migrationsDir } of namespacesWithMigrations) {
|
|
10163
|
-
const remoteMigrationNumber = await getRemoteMigrationNumber(client, workspaceId, namespace);
|
|
10164
|
-
if (remoteMigrationNumber === null) {
|
|
10165
|
-
results.push({
|
|
10166
|
-
namespace,
|
|
10167
|
-
remoteMigrationNumber: 0,
|
|
10168
|
-
drifts: [],
|
|
10169
|
-
hasDrift: false
|
|
10170
|
-
});
|
|
10171
|
-
continue;
|
|
10172
|
-
}
|
|
10173
|
-
const expectedSnapshot = reconstructSnapshotFromMigrations(migrationsDir, remoteMigrationNumber);
|
|
10174
|
-
if (!expectedSnapshot) {
|
|
10175
|
-
results.push({
|
|
10176
|
-
namespace,
|
|
10177
|
-
remoteMigrationNumber,
|
|
10178
|
-
drifts: [],
|
|
10179
|
-
hasDrift: false
|
|
10180
|
-
});
|
|
10181
|
-
continue;
|
|
10182
|
-
}
|
|
10183
|
-
const [remoteTypes, remoteGqlPermissions] = await Promise.all([fetchRemoteTypes(client, workspaceId, namespace), fetchRemoteGqlPermissions(client, workspaceId, namespace)]);
|
|
10184
|
-
const drifts = compareRemoteWithSnapshot(remoteTypes, deployComparableSnapshot(expectedSnapshot, remoteTypes, namespaceGqlOperations(config, tailorDBInputs, namespace)), remoteGqlPermissions);
|
|
10185
|
-
results.push({
|
|
10186
|
-
namespace,
|
|
10187
|
-
remoteMigrationNumber,
|
|
10188
|
-
drifts,
|
|
10189
|
-
hasDrift: drifts.length > 0
|
|
10190
|
-
});
|
|
10191
|
-
}
|
|
10192
|
-
return results;
|
|
10193
|
-
}
|
|
10194
|
-
/**
|
|
10195
|
-
* Format remote schema verification results for display
|
|
10196
|
-
* @param {RemoteSchemaVerificationResult[]} results - Verification results
|
|
10197
|
-
* @returns {string} Formatted results string
|
|
10198
|
-
*/
|
|
10199
|
-
function formatRemoteVerificationResults(results) {
|
|
10200
|
-
const lines = [];
|
|
10201
|
-
for (const result of results) {
|
|
10202
|
-
if (!result.hasDrift) continue;
|
|
10203
|
-
lines.push(`Namespace: ${result.namespace}`);
|
|
10204
|
-
lines.push(` Remote migration: ${formatMigrationNumber(result.remoteMigrationNumber)}`);
|
|
10205
|
-
lines.push(` Differences:`);
|
|
10206
|
-
lines.push(formatSchemaDrifts(result.drifts));
|
|
10207
|
-
lines.push("");
|
|
10208
|
-
}
|
|
10209
|
-
return lines.join("\n");
|
|
10210
|
-
}
|
|
10211
10333
|
const MIGRATION_FILE_KINDS = [
|
|
10212
10334
|
"schema",
|
|
10213
10335
|
"diff",
|
|
@@ -10266,20 +10388,19 @@ async function validateAndDetectMigrations(client, workspaceId, typesByNamespace
|
|
|
10266
10388
|
throw new Error("Schema migration check failed");
|
|
10267
10389
|
}
|
|
10268
10390
|
const remoteVerificationResults = await verifyRemoteSchema(client, workspaceId, namespacesWithMigrations, config, tailorDBInputs);
|
|
10391
|
+
const missingCheckpointResults = remoteVerificationResults.filter((result) => result.checkpointMissingLocal);
|
|
10392
|
+
if (missingCheckpointResults.length > 0) {
|
|
10393
|
+
logger.error("Remote migration checkpoint is not in the local migration history:");
|
|
10394
|
+
for (const result of missingCheckpointResults) logger.log(` ${result.namespace}: ${formatMigrationNumber(result.remoteMigrationNumber)}`);
|
|
10395
|
+
logger.newline();
|
|
10396
|
+
logger.info("Pull the latest migration files, or run 'tailor-sdk tailordb migration status' to compare.");
|
|
10397
|
+
throw new Error("Remote migration checkpoint verification failed");
|
|
10398
|
+
}
|
|
10269
10399
|
if (remoteVerificationResults.some((r) => r.hasDrift)) {
|
|
10270
10400
|
logger.error("Remote schema drift detected:");
|
|
10271
10401
|
logger.log(formatRemoteVerificationResults(remoteVerificationResults));
|
|
10272
10402
|
logger.newline();
|
|
10273
|
-
|
|
10274
|
-
logger.info(" - Another developer applied different migrations", { mode: "plain" });
|
|
10275
|
-
logger.info(" - Manual schema changes were made directly", { mode: "plain" });
|
|
10276
|
-
logger.info(" - Migration history is out of sync", { mode: "plain" });
|
|
10277
|
-
logger.newline();
|
|
10278
|
-
logger.info("To resolve:");
|
|
10279
|
-
logger.info(" - Run 'tailor-sdk tailordb migration status' to compare local vs remote.", { mode: "plain" });
|
|
10280
|
-
logger.info(" - If remote is correct, update local types and run 'migration generate'.", { mode: "plain" });
|
|
10281
|
-
logger.info(" - If local migration history is correct, run 'migration sync <N>' to overwrite remote.", { mode: "plain" });
|
|
10282
|
-
logger.info(" - If only bookkeeping is stale, run 'migration set <N>'.", { mode: "plain" });
|
|
10403
|
+
logRemoteDriftGuidance();
|
|
10283
10404
|
logger.newline();
|
|
10284
10405
|
logger.info("Use '--no-schema-check' to skip this check (not recommended).");
|
|
10285
10406
|
throw new Error("Remote schema verification failed");
|
|
@@ -10317,7 +10438,7 @@ async function reconcileMigrationLabels(client, workspaceId, namespacesWithMigra
|
|
|
10317
10438
|
for (const { namespace, migrationsDir } of namespacesWithMigrations) {
|
|
10318
10439
|
if (getMigrationFiles(migrationsDir).length === 0) continue;
|
|
10319
10440
|
const targetVersion = getLatestMigrationNumber(migrationsDir);
|
|
10320
|
-
const currentVersion = await getRemoteMigrationNumber(client, workspaceId, namespace);
|
|
10441
|
+
const currentVersion = await getRemoteMigrationNumber(client, workspaceId, namespace).catch(() => null);
|
|
10321
10442
|
if (currentVersion === targetVersion) continue;
|
|
10322
10443
|
await updateMigrationLabel(client, workspaceId, namespace, targetVersion);
|
|
10323
10444
|
const from = currentVersion === null ? "<unset>" : formatMigrationNumber(currentVersion);
|
|
@@ -10756,19 +10877,10 @@ async function rollbackSingleMigrationPrePhase(client, changeSet, migration, wor
|
|
|
10756
10877
|
}
|
|
10757
10878
|
}
|
|
10758
10879
|
/**
|
|
10759
|
-
*
|
|
10760
|
-
* @param
|
|
10761
|
-
* @returns
|
|
10880
|
+
* Plan TailorDB-related changes based on current and desired state.
|
|
10881
|
+
* @param context - Planning context
|
|
10882
|
+
* @returns Planned changes
|
|
10762
10883
|
*/
|
|
10763
|
-
function toTailorDBDeployInput(service) {
|
|
10764
|
-
const types = {};
|
|
10765
|
-
for (const [typeName, type] of Object.entries(service.types)) types[typeName] = createSnapshotType(type);
|
|
10766
|
-
return {
|
|
10767
|
-
namespace: service.namespace,
|
|
10768
|
-
config: service.config,
|
|
10769
|
-
types
|
|
10770
|
-
};
|
|
10771
|
-
}
|
|
10772
10884
|
async function planTailorDB(context) {
|
|
10773
10885
|
const { client, workspaceId, application, forRemoval, config, noSchemaCheck, forceApplyAll = false } = context;
|
|
10774
10886
|
const tailordbs = [];
|
|
@@ -11156,57 +11268,6 @@ function normalizeComparableGqlPermission(permission) {
|
|
|
11156
11268
|
actions: (policy.actions ?? []).toSorted((left, right) => left - right)
|
|
11157
11269
|
})) };
|
|
11158
11270
|
}
|
|
11159
|
-
/**
|
|
11160
|
-
* Check if there are schema differences between migration snapshots and local definitions
|
|
11161
|
-
* @param {ReadonlyMap<string, Record<string, TailorDBSnapshotType>>} typesByNamespace - Snapshot-shaped local types by namespace
|
|
11162
|
-
* @param {NamespaceWithMigrations[]} namespacesWithMigrations - Namespaces with migrations config
|
|
11163
|
-
* @returns {Promise<MigrationCheckResult[]>} Results for each namespace
|
|
11164
|
-
*/
|
|
11165
|
-
async function checkMigrationDiffs(typesByNamespace, namespacesWithMigrations) {
|
|
11166
|
-
const results = [];
|
|
11167
|
-
for (const { namespace, migrationsDir } of namespacesWithMigrations) {
|
|
11168
|
-
const localTypes = typesByNamespace.get(namespace);
|
|
11169
|
-
if (!localTypes) continue;
|
|
11170
|
-
const previousSnapshot = reconstructSnapshotFromMigrations(migrationsDir);
|
|
11171
|
-
if (!previousSnapshot) {
|
|
11172
|
-
results.push({
|
|
11173
|
-
namespace,
|
|
11174
|
-
migrationsDir,
|
|
11175
|
-
hasDiff: true,
|
|
11176
|
-
diff: void 0
|
|
11177
|
-
});
|
|
11178
|
-
continue;
|
|
11179
|
-
}
|
|
11180
|
-
const diff = compareLocalTypesWithSnapshot(previousSnapshot, localTypes, namespace);
|
|
11181
|
-
results.push({
|
|
11182
|
-
namespace,
|
|
11183
|
-
migrationsDir,
|
|
11184
|
-
hasDiff: hasChanges(diff),
|
|
11185
|
-
diff: hasChanges(diff) ? diff : void 0
|
|
11186
|
-
});
|
|
11187
|
-
}
|
|
11188
|
-
return results;
|
|
11189
|
-
}
|
|
11190
|
-
/**
|
|
11191
|
-
* Format migration check results for display
|
|
11192
|
-
* @param {MigrationCheckResult[]} results - Migration check results
|
|
11193
|
-
* @returns {string} Formatted results string
|
|
11194
|
-
*/
|
|
11195
|
-
function formatMigrationCheckResults(results) {
|
|
11196
|
-
const lines = [];
|
|
11197
|
-
for (const result of results) {
|
|
11198
|
-
if (!result.hasDiff) continue;
|
|
11199
|
-
lines.push(`Namespace: ${result.namespace}`);
|
|
11200
|
-
if (!result.diff) lines.push(" No migration snapshot found. Run 'tailor-sdk tailordb migration generate' first.");
|
|
11201
|
-
else {
|
|
11202
|
-
lines.push(` ${formatDiffSummary(result.diff)}`);
|
|
11203
|
-
lines.push("");
|
|
11204
|
-
lines.push(formatMigrationDiff(result.diff));
|
|
11205
|
-
}
|
|
11206
|
-
lines.push("");
|
|
11207
|
-
}
|
|
11208
|
-
return lines.join("\n");
|
|
11209
|
-
}
|
|
11210
11271
|
|
|
11211
11272
|
//#endregion
|
|
11212
11273
|
//#region src/cli/commands/deploy/workflow.ts
|
|
@@ -19344,7 +19405,7 @@ async function generate(options) {
|
|
|
19344
19405
|
if (options.init) await handleInitOption(namespacesWithMigrations, options.yes);
|
|
19345
19406
|
let pluginManager;
|
|
19346
19407
|
if (plugins.length > 0) pluginManager = new PluginManager(plugins);
|
|
19347
|
-
const { defineApplication } = await import("./application-
|
|
19408
|
+
const { defineApplication } = await import("./application-C-zsrNjn.mjs");
|
|
19348
19409
|
const application = defineApplication({
|
|
19349
19410
|
config,
|
|
19350
19411
|
pluginManager
|
|
@@ -20558,8 +20619,13 @@ async function bundleQueryScript(engine, baseDir) {
|
|
|
20558
20619
|
const entryContent = engine === "sql" ? createSqlEntry() : createGqlEntry();
|
|
20559
20620
|
fs$1.writeFileSync(entryPath, entryContent);
|
|
20560
20621
|
const tsconfig = await resolveTSConfigWithFallback(baseDir);
|
|
20561
|
-
|
|
20562
|
-
|
|
20622
|
+
const bundleLog = createBundleLog({ tsconfig });
|
|
20623
|
+
const result = await rolldown.build({
|
|
20624
|
+
plugins: [
|
|
20625
|
+
createGeneratedEntryResolverPlugin(entryPath, baseDir),
|
|
20626
|
+
createTsconfigPathsPlugin(),
|
|
20627
|
+
platformBundleDefinePlugin
|
|
20628
|
+
],
|
|
20563
20629
|
input: entryPath,
|
|
20564
20630
|
write: false,
|
|
20565
20631
|
output: {
|
|
@@ -20577,8 +20643,10 @@ async function bundleQueryScript(engine, baseDir) {
|
|
|
20577
20643
|
annotations: true,
|
|
20578
20644
|
unknownGlobalSideEffects: false
|
|
20579
20645
|
},
|
|
20580
|
-
|
|
20581
|
-
})
|
|
20646
|
+
...bundleLog.options
|
|
20647
|
+
});
|
|
20648
|
+
bundleLog.assertAllResolved();
|
|
20649
|
+
return result.output[0].code;
|
|
20582
20650
|
}
|
|
20583
20651
|
|
|
20584
20652
|
//#endregion
|
|
@@ -21472,5 +21540,5 @@ async function registerTypeScriptRuntime(hookUrl) {
|
|
|
21472
21540
|
}
|
|
21473
21541
|
|
|
21474
21542
|
//#endregion
|
|
21475
|
-
export { listFolders as $,
|
|
21476
|
-
//# sourceMappingURL=register-typescript-runtime-
|
|
21543
|
+
export { listFolders as $, writePlatformConfig as $n, logRemoteDriftGuidance as $t, generate as A, hasChanges as An, startCommand as At, remove as B, deleteUserTokens as Bn, deploy as Bt, waitWorkflowExecution as C, isValidMigrationNumber as Cn, listCommand$8 as Ct, listWorkflows as D, parseMigrationNumberArg as Dn, jobsCommand as Dt, listCommand$2 as E, formatMigrationNumber as En, getExecutorWaitFailureMessage as Et, openInConfiguredEditor as F, generateUserTypes as Fn, getWorkflowExecution as Ft, treeCommand as G, loadConsoleBaseUrl as Gn, createWorkspace$1 as Gt, updateCommand$1 as H, hasAnyUserTokenEntry as Hn, listCommand$9 as Ht, show as I, prompt as In, listWorkflowExecutions as It, getCommand$1 as J, loadWorkspaceId as Jn, ensureConfigId as Jt, listCommand$3 as K, loadMachineUserName as Kn, formatKeyValueTable as Kt, showCommand as L, apiCall as Ln, functionExecutionStatusToString as Lt, generateMigrationScript as M, resourceTrn as Mn, getCommand$5 as Mt, writeDbTypesFile as N, sdkNameLabelKey as Nn, getWorkflow as Nt, truncate as O, formatDiffSummary as On, listExecutorJobs as Ot, getConfiguredEditorCommand as P, PluginManager as Pn, executionsCommand as Pt, listCommand$4 as Q, saveUserTokens as Qn, checkMigrationDiffs as Qt, extractOwnedNamespaces as R, assertWritable as Rn, getCommand$6 as Rt, waitCommand as S, getNextMigrationNumber as Sn, triggerExecutor as St, resumeWorkflow as T, reconstructSnapshotFromMigrations as Tn, getExecutorJob as Tt, updateOrganization as U, hasUserTokenEntry as Un, listWorkspaces as Ut, removeCommand$1 as V, fetchLatestToken as Vn, deployFromCLI as Vt, organizationTree as W, loadAccessToken as Wn, createCommand$1 as Wt, updateCommand$2 as X, readPlatformConfig as Xn, waitForExecution as Xt, getOrganization as Y, platformConfigFromProfile as Yn, executeScript as Yt, updateFolder as Z, resolveUserTokenKey as Zn, bundleMigrationScript as Zt, deleteWorkspace as _, formatSchemaDrifts as _n, getCommand$4 as _t, updateUser as a, compareSnapshotWithRemote as an, isVerbose as ar, createFolder as at, getAppHealth as b, getMigrationFilePath as bn, webhookCommand as bt, listCommand as c, DB_TYPES_FILE_NAME as cn, paginationArgs as cr, getCommand$3 as ct, inviteUser as d, MIGRATE_FILE_NAME as dn, workspaceArgs as dr, tokenCommand as dt, toTailorDBDeployInput as en, defineAppCommand as er, getCommand$2 as et, restoreCommand as f, SCHEMA_FILE_NAME as fn, listCommand$6 as ft, deleteCommand as g, createSnapshotFromLocalTypes as gn, listFunctionRegistries as gt, getWorkspace as h, compareSnapshots as hn, listCommand$7 as ht, updateCommand as i, parseMigrationLabelNumber as in, deploymentArgs as ir, createCommand as it, generateCommand as j, getNamespacesWithMigrations as jn, startWorkflow as jt, truncateCommand as k, formatMigrationDiff as kn, watchExecutorJob as kt, listUsers as l, DIFF_FILE_NAME as ln, resolveMachineUserInputSource as lr, getOAuth2Client as lt, getCommand as m, compareLocalTypesWithSnapshot as mn, generate$1 as mt, query as n, MIGRATION_LABEL_KEY as nn, configArg as nr, deleteCommand$1 as nt, removeCommand as o, generateAllTypeManifestsFromSnapshot as on, multiConfigArg as or, listCommand$5 as ot, restoreWorkspace as p, assertValidMigrationFiles as pn, listMachineUsers as pt, listOrganizations as q, loadStoredUserTokens as qn, workspaceNameSchema as qt, queryCommand as r, handleOptionalToRequiredError as rn, confirmationArgs as rr, deleteFolder as rt, removeUser as s, protoGqlPermission as sn, pagedLogArgs as sr, listOAuth2Clients as st, registerTypeScriptRuntime as t, verifyRemoteSchema as tn, commonArgs as tr, getFolder as tt, inviteCommand as u, INITIAL_SCHEMA_NUMBER as un, toPageDirection as ur, getMachineUserToken as ut, listApps as v, getLatestMigrationNumber as vn, getFunctionRegistry as vt, resumeCommand as w, loadDiff as wn, listExecutors as wt, healthCommand as x, getMigrationFiles as xn, triggerCommand as xt, listCommand$1 as y, getMigrationDirPath as yn, listWebhookExecutors as yt, logBetaWarning as z, loadConfig as zn, getExecutor as zt };
|
|
21544
|
+
//# sourceMappingURL=register-typescript-runtime-nG-n9lPw.mjs.map
|