@tailor-platform/sdk 1.56.1 → 1.57.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 +12 -0
- package/README.md +0 -23
- package/dist/{application-DuT_ae02.mjs → application-CdkoGX27.mjs} +7 -4
- package/dist/application-CdkoGX27.mjs.map +1 -0
- package/dist/application-x_mURdR0.mjs +4 -0
- package/dist/cli/erd-viewer-assets/app.js +1181 -0
- package/dist/cli/erd-viewer-assets/index.html +73 -0
- package/dist/cli/erd-viewer-assets/serve.json +13 -0
- package/dist/cli/erd-viewer-assets/styles.css +789 -0
- package/dist/cli/index.mjs +685 -344
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +6 -1
- package/dist/cli/lib.mjs +2 -2
- package/dist/client-DLPEPJ_s.mjs.map +1 -1
- package/dist/{runtime-745lvg7i.mjs → runtime-1YuaoNr8.mjs} +36 -63
- package/dist/runtime-1YuaoNr8.mjs.map +1 -0
- package/docs/cli/tailordb.md +31 -26
- package/docs/cli-reference.md +2 -2
- package/package.json +1 -3
- package/dist/application-CC3oaSay.mjs +0 -4
- package/dist/application-DuT_ae02.mjs.map +0 -1
- package/dist/runtime-745lvg7i.mjs.map +0 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { t as db } from "./schema-DKsNhbav.mjs";
|
|
3
3
|
import { $ as FilterSchema, A as FunctionExecution_Status, B as AuthOAuth2Client_GrantType, C as TailorDBType_Permission_Operator, D as IdPLang, E as PipelineResolver_OperationType, F as AuthConnection_Type, H as AuthSCIMAttribute_Type, I as AuthHookPoint, J as GetApplicationSchemaHealthResponse_ApplicationSchemaHealthStatus, K as TenantProviderConfig_TenantProviderType, L as AuthIDPConfig_AuthType, M as ExecutorJobStatus, N as ExecutorTargetType, O as IdPPermissionOperator, P as ExecutorTriggerType, Q as Condition_Operator, R as AuthInvokerSchema, S as TailorDBGQLPermission_Permit, T as TailorDBType_PermitAction, U as AuthSCIMAttribute_Uniqueness, V as AuthSCIMAttribute_Mutability, W as AuthSCIMConfig_AuthorizationType, X as Subgraph_ServiceType, Y as ApplicationSchemaUpdateAttemptStatus, Z as ConditionSchema, _ as WorkspacePlatformUserRole, a as fetchMachineUserToken, b as TailorDBGQLPermission_Action, d as initOperatorClient, et as PageDirection, g as OperatorService, h as userAgent, i as fetchAll, k as IdPPermissionPermit, m as resolveStaticWebsiteUrls, o as fetchPaged, p as platformBaseUrl, q as UserProfileProviderConfig_UserProfileProviderType, v as WorkflowExecution_Status, w as TailorDBType_Permission_Permit, x as TailorDBGQLPermission_Operator, y as WorkflowJobExecution_Status, z as AuthOAuth2Client_ClientType } from "./client-DLPEPJ_s.mjs";
|
|
4
4
|
import { a as parseBoolean, i as symbols, n as logger, r as styles, t as CIPromptError } from "./logger-DpJyJvNz.mjs";
|
|
5
|
-
import { D as
|
|
5
|
+
import { C as loadConfig, D as loadConfigPath, E as loadAccessToken, M as writePlatformConfig, O as loadWorkspaceId, S as hashFile, b as getDistDir, c as createExecutorService, d as buildExecutorArgsExpr, f as buildResolverOperationHookExpr, h as loadFilesWithIgnores, k as readPlatformConfig, m as stringifyFunction, n as generatePluginFilesIfNeeded, p as TailorDBTypeSchema, r as loadApplication, s as HTTP_METHODS, t as defineApplication, y as createBundleCache } from "./application-CdkoGX27.mjs";
|
|
6
6
|
import { t as multiline } from "./multiline-Cf9ODpr1.mjs";
|
|
7
7
|
import { t as readPackageJson } from "./package-json-DcQApfPQ.mjs";
|
|
8
8
|
import { n as isCLIError, t as createCLIError } from "./errors-EsY4XO6O.mjs";
|
|
@@ -2134,7 +2134,7 @@ function hashValue(value) {
|
|
|
2134
2134
|
//#endregion
|
|
2135
2135
|
//#region src/cli/commands/deploy/auth-connection.ts
|
|
2136
2136
|
function connectionTrn(workspaceId, name) {
|
|
2137
|
-
return `${trnPrefix(workspaceId)}:
|
|
2137
|
+
return `${trnPrefix(workspaceId)}:auth_connection:${name}`;
|
|
2138
2138
|
}
|
|
2139
2139
|
function buildConnectionRequest(workspaceId, name, config) {
|
|
2140
2140
|
return {
|
|
@@ -2156,11 +2156,6 @@ function buildConnectionRequest(workspaceId, name, config) {
|
|
|
2156
2156
|
}
|
|
2157
2157
|
};
|
|
2158
2158
|
}
|
|
2159
|
-
/**
|
|
2160
|
-
* Compute a hash of the full connection config for change detection.
|
|
2161
|
-
* @param config - Auth connection config
|
|
2162
|
-
* @returns SHA-256 hex digest
|
|
2163
|
-
*/
|
|
2164
2159
|
function hashConnectionConfig(config) {
|
|
2165
2160
|
return hashValue(JSON.stringify({
|
|
2166
2161
|
type: config.type,
|
|
@@ -2172,12 +2167,6 @@ function hashConnectionConfig(config) {
|
|
|
2172
2167
|
tokenUrl: config.tokenUrl ?? ""
|
|
2173
2168
|
}));
|
|
2174
2169
|
}
|
|
2175
|
-
/**
|
|
2176
|
-
* Check whether the non-secret fields of an existing connection differ from the desired config.
|
|
2177
|
-
* @param existing - Existing connection from the server
|
|
2178
|
-
* @param desired - Desired connection config
|
|
2179
|
-
* @returns true if any non-secret field has changed
|
|
2180
|
-
*/
|
|
2181
2170
|
function hasNonSecretFieldChanged(existing, desired) {
|
|
2182
2171
|
if (existing.config.case !== "oauth2") return true;
|
|
2183
2172
|
const oauth2 = existing.config.value;
|
|
@@ -2213,45 +2202,32 @@ async function planAuthConnections(client, workspaceId, appName, appId, auths) {
|
|
|
2213
2202
|
}
|
|
2214
2203
|
});
|
|
2215
2204
|
const existingConnections = {};
|
|
2216
|
-
let metadataSupported = true;
|
|
2217
2205
|
await Promise.all(existingList.map(async (resource) => {
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
};
|
|
2225
|
-
} catch (error) {
|
|
2226
|
-
if (error instanceof ConnectError && error.code === Code.InvalidArgument) {
|
|
2227
|
-
metadataSupported = false;
|
|
2228
|
-
existingConnections[resource.name] = {
|
|
2229
|
-
resource,
|
|
2230
|
-
label: void 0
|
|
2231
|
-
};
|
|
2232
|
-
} else throw error;
|
|
2233
|
-
}
|
|
2206
|
+
const { metadata } = await client.getMetadata({ trn: connectionTrn(workspaceId, resource.name) });
|
|
2207
|
+
existingConnections[resource.name] = {
|
|
2208
|
+
resource,
|
|
2209
|
+
label: metadata?.labels[sdkNameLabelKey],
|
|
2210
|
+
allLabels: metadata?.labels
|
|
2211
|
+
};
|
|
2234
2212
|
}));
|
|
2235
2213
|
const state = loadSecretsState();
|
|
2236
2214
|
for (const [name, config] of Object.entries(desiredConnections)) {
|
|
2237
2215
|
const existing = existingConnections[name];
|
|
2238
|
-
const metaRequest =
|
|
2216
|
+
const metaRequest = await buildMetaRequest({
|
|
2239
2217
|
trn: connectionTrn(workspaceId, name),
|
|
2240
2218
|
appName,
|
|
2241
2219
|
appId
|
|
2242
|
-
})
|
|
2220
|
+
});
|
|
2243
2221
|
if (existing) {
|
|
2244
|
-
if (!isOwnedByApp(existing.allLabels, appName, appId)) {
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
});
|
|
2254
|
-
}
|
|
2222
|
+
if (!isOwnedByApp(existing.allLabels, appName, appId)) if (existing.label) conflicts.push({
|
|
2223
|
+
resourceType: "Auth connection",
|
|
2224
|
+
resourceName: name,
|
|
2225
|
+
currentOwner: existing.label
|
|
2226
|
+
});
|
|
2227
|
+
else unmanaged.push({
|
|
2228
|
+
resourceType: "Auth connection",
|
|
2229
|
+
resourceName: name
|
|
2230
|
+
});
|
|
2255
2231
|
const currentHash = hashConnectionConfig(config);
|
|
2256
2232
|
const storedHash = state.connections?.[name];
|
|
2257
2233
|
if (hasNonSecretFieldChanged(existing.resource, config) || currentHash !== storedHash) changeSet.replaces.push({
|
|
@@ -2263,6 +2239,10 @@ async function planAuthConnections(client, workspaceId, appName, appId, auths) {
|
|
|
2263
2239
|
createRequest: buildConnectionRequest(workspaceId, name, config),
|
|
2264
2240
|
metaRequest
|
|
2265
2241
|
});
|
|
2242
|
+
else if (!existing.label) changeSet.updates.push({
|
|
2243
|
+
name,
|
|
2244
|
+
metaRequest
|
|
2245
|
+
});
|
|
2266
2246
|
else changeSet.unchanged.push({ name });
|
|
2267
2247
|
delete existingConnections[name];
|
|
2268
2248
|
} else changeSet.creates.push({
|
|
@@ -2278,7 +2258,7 @@ async function planAuthConnections(client, workspaceId, appName, appId, auths) {
|
|
|
2278
2258
|
resourceOwners.add(entry.label);
|
|
2279
2259
|
continue;
|
|
2280
2260
|
}
|
|
2281
|
-
if (owned
|
|
2261
|
+
if (owned) changeSet.deletes.push({
|
|
2282
2262
|
name,
|
|
2283
2263
|
request: {
|
|
2284
2264
|
workspaceId,
|
|
@@ -2293,20 +2273,6 @@ async function planAuthConnections(client, workspaceId, appName, appId, auths) {
|
|
|
2293
2273
|
resourceOwners
|
|
2294
2274
|
};
|
|
2295
2275
|
}
|
|
2296
|
-
/**
|
|
2297
|
-
* Attempt to set metadata, silently ignoring InvalidArgument errors
|
|
2298
|
-
* when the platform does not yet support auth-connection TRNs.
|
|
2299
|
-
* @param client - Operator client instance
|
|
2300
|
-
* @param metaRequest - Metadata request to send
|
|
2301
|
-
*/
|
|
2302
|
-
async function trySetMetadata(client, metaRequest) {
|
|
2303
|
-
try {
|
|
2304
|
-
await client.setMetadata(metaRequest);
|
|
2305
|
-
} catch (error) {
|
|
2306
|
-
if (error instanceof ConnectError && error.code === Code.InvalidArgument) return;
|
|
2307
|
-
throw error;
|
|
2308
|
-
}
|
|
2309
|
-
}
|
|
2310
2276
|
function extractOAuth2Config(connection) {
|
|
2311
2277
|
if (!connection) return void 0;
|
|
2312
2278
|
const config = connection.config;
|
|
@@ -2333,13 +2299,16 @@ async function applyAuthConnections(client, result, phase) {
|
|
|
2333
2299
|
if (phase === "create-update") {
|
|
2334
2300
|
await Promise.all(changeSet.creates.map(async (create) => {
|
|
2335
2301
|
await client.createAuthConnection(create.request);
|
|
2336
|
-
|
|
2302
|
+
await client.setMetadata(create.metaRequest);
|
|
2337
2303
|
}));
|
|
2338
2304
|
for (const replace of changeSet.replaces) {
|
|
2339
2305
|
await client.revokeAuthConnection(replace.revokeRequest);
|
|
2340
2306
|
await client.createAuthConnection(replace.createRequest);
|
|
2341
|
-
|
|
2307
|
+
await client.setMetadata(replace.metaRequest);
|
|
2342
2308
|
}
|
|
2309
|
+
await Promise.all(changeSet.updates.map(async (update) => {
|
|
2310
|
+
await client.setMetadata(update.metaRequest);
|
|
2311
|
+
}));
|
|
2343
2312
|
const state = loadSecretsState();
|
|
2344
2313
|
if (!state.connections) state.connections = {};
|
|
2345
2314
|
for (const create of changeSet.creates) {
|
|
@@ -10121,6 +10090,10 @@ async function deploy(options) {
|
|
|
10121
10090
|
resourceType: "OAuth2 client (client type change)",
|
|
10122
10091
|
resourceName: replace.name
|
|
10123
10092
|
});
|
|
10093
|
+
for (const del of auth.changeSet.connection.deletes) importantDeletions.push({
|
|
10094
|
+
resourceType: "Auth connection",
|
|
10095
|
+
resourceName: del.name
|
|
10096
|
+
});
|
|
10124
10097
|
for (const del of secretManager.vaultChangeSet.deletes) importantDeletions.push({
|
|
10125
10098
|
resourceType: "Secret Manager vault",
|
|
10126
10099
|
resourceName: del.name
|
|
@@ -14515,7 +14488,7 @@ async function generate(options) {
|
|
|
14515
14488
|
if (options.init) await handleInitOption(namespacesWithMigrations, options.yes);
|
|
14516
14489
|
let pluginManager;
|
|
14517
14490
|
if (plugins.length > 0) pluginManager = new PluginManager(plugins);
|
|
14518
|
-
const { defineApplication } = await import("./application-
|
|
14491
|
+
const { defineApplication } = await import("./application-x_mURdR0.mjs");
|
|
14519
14492
|
const application = defineApplication({
|
|
14520
14493
|
config,
|
|
14521
14494
|
pluginManager
|
|
@@ -16707,5 +16680,5 @@ function isDeno() {
|
|
|
16707
16680
|
}
|
|
16708
16681
|
|
|
16709
16682
|
//#endregion
|
|
16710
|
-
export { listCommand$5 as $, compareSnapshots as $t, truncate as A,
|
|
16711
|
-
//# sourceMappingURL=runtime-
|
|
16683
|
+
export { listCommand$5 as $, compareSnapshots as $t, truncate as A, toPageDirection as An, startCommand as At, logBetaWarning as B, getExecutor as Bt, listCommand$2 as C, commonArgs as Cn, triggerExecutor as Ct, resumeWorkflow as D, isVerbose as Dn, jobsCommand as Dt, resumeCommand as E, deploymentArgs as En, getExecutorJob as Et, writeDbTypesFile as F, getWorkflowExecution as Ft, organizationTree as G, parseMigrationLabelNumber as Gt, removeCommand$1 as H, executeScript as Ht, getConfiguredEditorCommand as I, listWorkflowExecutions as It, listOrganizations as J, DIFF_FILE_NAME as Jt, treeCommand as K, bundleMigrationScript as Kt, openInConfiguredEditor as L, functionExecutionStatusToString as Lt, generate as M, getCommand$5 as Mt, generateCommand as N, getWorkflow as Nt, listCommand$3 as O, pagedLogArgs as On, listExecutorJobs as Ot, generateMigrationScript as P, executionsCommand as Pt, updateFolder as Q, compareLocalTypesWithSnapshot as Qt, show as R, formatKeyValueTable as Rt, listApps as S, defineAppCommand as Sn, triggerCommand as St, healthCommand as T, confirmationArgs as Tn, listExecutors as Tt, updateCommand$1 as U, waitForExecution$1 as Ut, remove as V, deploy as Vt, updateOrganization as W, MIGRATION_LABEL_KEY as Wt, getOrganization as X, MIGRATE_FILE_NAME as Xt, getCommand$1 as Y, INITIAL_SCHEMA_NUMBER as Yt, updateCommand$2 as Z, SCHEMA_FILE_NAME as Zt, getWorkspace as _, generateUserTypes as _n, listFunctionRegistries as _t, updateUser as a, getNextMigrationNumber as an, createCommand$1 as at, createCommand as b, apiCall as bn, listWebhookExecutors as bt, listCommand as c, reconstructSnapshotFromMigrations as cn, listOAuth2Clients as ct, inviteUser as d, formatMigrationDiff as dn, getMachineUserToken as dt, createSnapshotFromLocalTypes as en, listFolders as et, restoreCommand as f, hasChanges as fn, tokenCommand as ft, getCommand as g, PluginManager as gn, listCommand$8 as gt, listWorkspaces as h, trnPrefix as hn, generate$1 as ht, updateCommand as i, getMigrationFiles as in, deleteFolder as it, truncateCommand as j, workspaceArgs as jn, startWorkflow as jt, listWorkflows as k, paginationArgs as kn, watchExecutorJob as kt, listUsers as l, formatMigrationNumber as ln, getCommand$3 as lt, listCommand$1 as m, sdkNameLabelKey as mn, listMachineUsers as mt, query as n, getMigrationDirPath as nn, getFolder as nt, removeCommand as o, isValidMigrationNumber as on, createFolder as ot, restoreWorkspace as p, getNamespacesWithMigrations as pn, listCommand$7 as pt, listCommand$4 as q, DB_TYPES_FILE_NAME as qt, queryCommand as r, getMigrationFilePath as rn, deleteCommand$1 as rt, removeUser as s, loadDiff as sn, listCommand$6 as st, isNativeTypeScriptRuntime as t, getLatestMigrationNumber as tn, getCommand$2 as tt, inviteCommand as u, formatDiffSummary as un, getOAuth2Client as ut, deleteCommand as v, prompt as vn, getCommand$4 as vt, getAppHealth as w, configArg as wn, listCommand$9 as wt, createWorkspace as x, assertWritable as xn, webhookCommand as xt, deleteWorkspace as y, apiCommand as yn, getFunctionRegistry as yt, showCommand as z, getCommand$6 as zt };
|
|
16684
|
+
//# sourceMappingURL=runtime-1YuaoNr8.mjs.map
|