@tailor-platform/sdk 1.33.2 → 1.35.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 +16 -0
- package/dist/{application-CYPU-WIc.mjs → application-BnJRroGX.mjs} +19 -3
- package/dist/application-BnJRroGX.mjs.map +1 -0
- package/dist/application-mGasp_EX.mjs +4 -0
- package/dist/cli/index.mjs +291 -40
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +6 -6
- package/dist/cli/lib.mjs +4 -4
- package/dist/{client-ea1w8SmG.mjs → client-BmQP4kKS.mjs} +1 -1
- package/dist/{client-CYGsf3Zl.mjs → client-CA2NM_4R.mjs} +10 -2
- package/dist/{client-CYGsf3Zl.mjs.map → client-CA2NM_4R.mjs.map} +1 -1
- package/dist/configure/index.d.mts +5 -5
- package/dist/configure/index.mjs +3 -0
- package/dist/configure/index.mjs.map +1 -1
- package/dist/{crash-report-CbueUPaP.mjs → crash-report-Bd2T8BhU.mjs} +1 -1
- package/dist/{crash-report-OXafT1iS.mjs → crash-report-CPkI2-cp.mjs} +2 -2
- package/dist/{crash-report-OXafT1iS.mjs.map → crash-report-CPkI2-cp.mjs.map} +1 -1
- package/dist/{env-BvIWsJxg.d.mts → env-MSlwZt8l.d.mts} +2 -2
- package/dist/{index-0H-YH8Ya.d.mts → index-B1Fgxi8D.d.mts} +2 -2
- package/dist/{index-BM2SqNfO.d.mts → index-BBlE_vQF.d.mts} +2 -2
- package/dist/{index-mAV9kYJA.d.mts → index-BG7YCyXF.d.mts} +2 -2
- package/dist/{index-BU6fmwJC.d.mts → index-D-tMAFVp.d.mts} +2 -2
- package/dist/{index-DlivLpTN.d.mts → index-wCoQup4y.d.mts} +8 -8
- package/dist/kysely/index.d.mts +2 -1
- package/dist/kysely/index.mjs.map +1 -1
- package/dist/{kysely-type-BwMqaL3z.mjs → kysely-type-DtnNdHn3.mjs} +5 -2
- package/dist/kysely-type-DtnNdHn3.mjs.map +1 -0
- package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
- package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
- package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
- package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
- package/dist/plugin/builtin/seed/index.d.mts +1 -1
- package/dist/plugin/index.d.mts +2 -2
- package/dist/{plugin-DQqzlulP.d.mts → plugin-CZaJ3_QR.d.mts} +34 -3
- package/dist/{runtime-CxDrzUC0.mjs → runtime-D4O-RfcH.mjs} +286 -52
- package/dist/runtime-D4O-RfcH.mjs.map +1 -0
- package/dist/utils/test/index.d.mts +2 -2
- package/dist/{workflow.generated-u9MgzqbM.d.mts → workflow.generated-IZ3kLjC_.d.mts} +2 -2
- package/docs/cli/auth.md +162 -1
- package/docs/cli-reference.md +9 -6
- package/docs/services/auth.md +115 -0
- package/package.json +1 -1
- package/dist/application-CYPU-WIc.mjs.map +0 -1
- package/dist/application-dnB8CQiT.mjs +0 -4
- package/dist/kysely-type-BwMqaL3z.mjs.map +0 -1
- package/dist/runtime-CxDrzUC0.mjs.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
import { A as ExecutorTriggerType, C as TailorDBType_PermitAction, E as FunctionExecution_Status, F as
|
|
2
|
+
import { A as ExecutorTriggerType, B as AuthSCIMConfig_AuthorizationType, C as TailorDBType_PermitAction, E as FunctionExecution_Status, F as AuthOAuth2Client_ClientType, G as ConditionSchema, H as TenantProviderConfig_TenantProviderType, I as AuthOAuth2Client_GrantType, J as PageDirection, K as Condition_Operator, L as AuthSCIMAttribute_Mutability, M as AuthHookPoint, N as AuthIDPConfig_AuthType, O as ExecutorJobStatus, P as AuthInvokerSchema, R as AuthSCIMAttribute_Type, S as TailorDBType_Permission_Permit, T as IdPLang, U as UserProfileProviderConfig_UserProfileProviderType, W as GetApplicationSchemaHealthResponse_ApplicationSchemaHealthStatus, X as Subgraph_ServiceType, Y as ApplicationSchemaUpdateAttemptStatus, _ as WorkflowJobExecution_Status, a as fetchMachineUserToken, b as TailorDBGQLPermission_Permit, f as platformBaseUrl, g as WorkflowExecution_Status, h as WorkspacePlatformUserRole, i as fetchAll, j as AuthConnection_Type, k as ExecutorTargetType, m as userAgent, p as resolveStaticWebsiteUrls, q as FilterSchema, u as initOperatorClient, v as TailorDBGQLPermission_Action, w as PipelineResolver_OperationType, x as TailorDBType_Permission_Operator, y as TailorDBGQLPermission_Operator, z as AuthSCIMAttribute_Uniqueness } from "./client-CA2NM_4R.mjs";
|
|
3
3
|
import { t as db } from "./schema-D27cW0Ca.mjs";
|
|
4
4
|
import { i as symbols, n as logger, r as styles, t as CIPromptError } from "./logger-qz-Y4sBV.mjs";
|
|
5
5
|
import { t as readPackageJson } from "./package-json-CfUqjJaQ.mjs";
|
|
6
|
-
import { S as readPlatformConfig, T as writePlatformConfig, _ as hashFile, a as loadConfig, b as loadAccessToken, c as createExecutorService, d as TailorDBTypeSchema, f as stringifyFunction, g as getDistDir, h as createBundleCache, m as loadFilesWithIgnores, n as generatePluginFilesIfNeeded, p as tailorUserMap, r as loadApplication, t as defineApplication, u as OAuth2ClientSchema, x as loadWorkspaceId } from "./application-
|
|
6
|
+
import { S as readPlatformConfig, T as writePlatformConfig, _ as hashFile, a as loadConfig, b as loadAccessToken, c as createExecutorService, d as TailorDBTypeSchema, f as stringifyFunction, g as getDistDir, h as createBundleCache, m as loadFilesWithIgnores, n as generatePluginFilesIfNeeded, p as tailorUserMap, r as loadApplication, t as defineApplication, u as OAuth2ClientSchema, x as loadWorkspaceId } from "./application-BnJRroGX.mjs";
|
|
7
7
|
import { r as withSpan } from "./telemetry-CREcGK8y.mjs";
|
|
8
8
|
import { arg, createDefineCommand, defineCommand, runCommand } from "politty";
|
|
9
9
|
import { z } from "zod";
|
|
@@ -1217,6 +1217,276 @@ function protoSubgraph(subgraph) {
|
|
|
1217
1217
|
};
|
|
1218
1218
|
}
|
|
1219
1219
|
|
|
1220
|
+
//#endregion
|
|
1221
|
+
//#region src/cli/commands/apply/secrets-state.ts
|
|
1222
|
+
const SecretsStateSchema = z.object({
|
|
1223
|
+
vaults: z.record(z.string(), z.record(z.string(), z.string())),
|
|
1224
|
+
connections: z.record(z.string(), z.string()).optional()
|
|
1225
|
+
});
|
|
1226
|
+
/**
|
|
1227
|
+
* Get the file path for the secrets state JSON.
|
|
1228
|
+
* @returns Absolute path to secrets-state.json
|
|
1229
|
+
*/
|
|
1230
|
+
function getSecretsStatePath() {
|
|
1231
|
+
return path.join(getDistDir(), "secrets-state.json");
|
|
1232
|
+
}
|
|
1233
|
+
/**
|
|
1234
|
+
* Load secrets hash state from disk.
|
|
1235
|
+
* @returns Persisted state, or empty state if file is missing or corrupted
|
|
1236
|
+
*/
|
|
1237
|
+
function loadSecretsState() {
|
|
1238
|
+
const filePath = getSecretsStatePath();
|
|
1239
|
+
if (!existsSync(filePath)) return { vaults: {} };
|
|
1240
|
+
try {
|
|
1241
|
+
const raw = readFileSync(filePath, "utf-8");
|
|
1242
|
+
return SecretsStateSchema.parse(JSON.parse(raw));
|
|
1243
|
+
} catch {
|
|
1244
|
+
return { vaults: {} };
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
/**
|
|
1248
|
+
* Save secrets hash state to disk.
|
|
1249
|
+
* @param state - The secrets state to persist
|
|
1250
|
+
*/
|
|
1251
|
+
function saveSecretsState(state) {
|
|
1252
|
+
const filePath = getSecretsStatePath();
|
|
1253
|
+
mkdirSync(path.dirname(filePath), { recursive: true });
|
|
1254
|
+
writeFileSync(filePath, JSON.stringify(state, null, 2), "utf-8");
|
|
1255
|
+
}
|
|
1256
|
+
/**
|
|
1257
|
+
* Compute SHA-256 hex digest of a value.
|
|
1258
|
+
* @param value - The string to hash
|
|
1259
|
+
* @returns Hex-encoded SHA-256 hash
|
|
1260
|
+
*/
|
|
1261
|
+
function hashValue(value) {
|
|
1262
|
+
return createHash("sha256").update(value).digest("hex");
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1265
|
+
//#endregion
|
|
1266
|
+
//#region src/cli/commands/apply/auth-connection.ts
|
|
1267
|
+
function connectionTrn(workspaceId, name) {
|
|
1268
|
+
return `${trnPrefix(workspaceId)}:auth-connection:${name}`;
|
|
1269
|
+
}
|
|
1270
|
+
function buildConnectionRequest(workspaceId, name, config) {
|
|
1271
|
+
return {
|
|
1272
|
+
workspaceId,
|
|
1273
|
+
connection: {
|
|
1274
|
+
name,
|
|
1275
|
+
type: AuthConnection_Type.OAUTH2,
|
|
1276
|
+
config: {
|
|
1277
|
+
case: "oauth2",
|
|
1278
|
+
value: {
|
|
1279
|
+
providerUrl: config.providerUrl,
|
|
1280
|
+
issuerUrl: config.issuerUrl,
|
|
1281
|
+
clientId: config.clientId,
|
|
1282
|
+
clientSecret: config.clientSecret,
|
|
1283
|
+
authUrl: config.authUrl ?? "",
|
|
1284
|
+
tokenUrl: config.tokenUrl ?? ""
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
};
|
|
1289
|
+
}
|
|
1290
|
+
/**
|
|
1291
|
+
* Compute a hash of the full connection config for change detection.
|
|
1292
|
+
* @param config - Auth connection config
|
|
1293
|
+
* @returns SHA-256 hex digest
|
|
1294
|
+
*/
|
|
1295
|
+
function hashConnectionConfig(config) {
|
|
1296
|
+
return hashValue(JSON.stringify({
|
|
1297
|
+
type: config.type,
|
|
1298
|
+
providerUrl: config.providerUrl,
|
|
1299
|
+
issuerUrl: config.issuerUrl,
|
|
1300
|
+
clientId: config.clientId,
|
|
1301
|
+
clientSecret: config.clientSecret,
|
|
1302
|
+
authUrl: config.authUrl ?? "",
|
|
1303
|
+
tokenUrl: config.tokenUrl ?? ""
|
|
1304
|
+
}));
|
|
1305
|
+
}
|
|
1306
|
+
/**
|
|
1307
|
+
* Check whether the non-secret fields of an existing connection differ from the desired config.
|
|
1308
|
+
* @param existing - Existing connection from the server
|
|
1309
|
+
* @param desired - Desired connection config
|
|
1310
|
+
* @returns true if any non-secret field has changed
|
|
1311
|
+
*/
|
|
1312
|
+
function hasNonSecretFieldChanged(existing, desired) {
|
|
1313
|
+
if (existing.config.case !== "oauth2") return true;
|
|
1314
|
+
const oauth2 = existing.config.value;
|
|
1315
|
+
return oauth2.providerUrl !== desired.providerUrl || oauth2.issuerUrl !== desired.issuerUrl || oauth2.clientId !== desired.clientId || oauth2.authUrl !== (desired.authUrl ?? "") || oauth2.tokenUrl !== (desired.tokenUrl ?? "");
|
|
1316
|
+
}
|
|
1317
|
+
/**
|
|
1318
|
+
* Plan auth connection changes based on current and desired state.
|
|
1319
|
+
* @param client - Operator client instance
|
|
1320
|
+
* @param workspaceId - Workspace ID
|
|
1321
|
+
* @param appName - Application name for ownership
|
|
1322
|
+
* @param auths - Auth services with connection configs
|
|
1323
|
+
* @returns Planned changes for auth connections
|
|
1324
|
+
*/
|
|
1325
|
+
async function planAuthConnections(client, workspaceId, appName, auths) {
|
|
1326
|
+
const changeSet = createChangeSet("Auth connections");
|
|
1327
|
+
const conflicts = [];
|
|
1328
|
+
const unmanaged = [];
|
|
1329
|
+
const resourceOwners = /* @__PURE__ */ new Set();
|
|
1330
|
+
const desiredConnections = {};
|
|
1331
|
+
for (const auth of auths) if (auth.connections) for (const [name, config] of Object.entries(auth.connections)) desiredConnections[name] = config;
|
|
1332
|
+
const existingList = await fetchAll(async (pageToken, maxPageSize) => {
|
|
1333
|
+
try {
|
|
1334
|
+
const { connections, nextPageToken } = await client.listAuthConnections({
|
|
1335
|
+
workspaceId,
|
|
1336
|
+
pageToken,
|
|
1337
|
+
pageSize: maxPageSize
|
|
1338
|
+
});
|
|
1339
|
+
return [connections, nextPageToken];
|
|
1340
|
+
} catch (error) {
|
|
1341
|
+
if (error instanceof ConnectError && error.code === Code.NotFound) return [[], ""];
|
|
1342
|
+
throw error;
|
|
1343
|
+
}
|
|
1344
|
+
});
|
|
1345
|
+
const existingConnections = {};
|
|
1346
|
+
let metadataSupported = true;
|
|
1347
|
+
await Promise.all(existingList.map(async (resource) => {
|
|
1348
|
+
try {
|
|
1349
|
+
const { metadata } = await client.getMetadata({ trn: connectionTrn(workspaceId, resource.name) });
|
|
1350
|
+
existingConnections[resource.name] = {
|
|
1351
|
+
resource,
|
|
1352
|
+
label: metadata?.labels[sdkNameLabelKey]
|
|
1353
|
+
};
|
|
1354
|
+
} catch (error) {
|
|
1355
|
+
if (error instanceof ConnectError && error.code === Code.InvalidArgument) {
|
|
1356
|
+
metadataSupported = false;
|
|
1357
|
+
existingConnections[resource.name] = {
|
|
1358
|
+
resource,
|
|
1359
|
+
label: void 0
|
|
1360
|
+
};
|
|
1361
|
+
} else throw error;
|
|
1362
|
+
}
|
|
1363
|
+
}));
|
|
1364
|
+
const state = loadSecretsState();
|
|
1365
|
+
for (const [name, config] of Object.entries(desiredConnections)) {
|
|
1366
|
+
const existing = existingConnections[name];
|
|
1367
|
+
const metaRequest = metadataSupported ? await buildMetaRequest(connectionTrn(workspaceId, name), appName) : void 0;
|
|
1368
|
+
if (existing) {
|
|
1369
|
+
if (metadataSupported && !existing.label) unmanaged.push({
|
|
1370
|
+
resourceType: "Auth connection",
|
|
1371
|
+
resourceName: name
|
|
1372
|
+
});
|
|
1373
|
+
else if (existing.label && existing.label !== appName) conflicts.push({
|
|
1374
|
+
resourceType: "Auth connection",
|
|
1375
|
+
resourceName: name,
|
|
1376
|
+
currentOwner: existing.label
|
|
1377
|
+
});
|
|
1378
|
+
const currentHash = hashConnectionConfig(config);
|
|
1379
|
+
const storedHash = state.connections?.[name];
|
|
1380
|
+
if (hasNonSecretFieldChanged(existing.resource, config) || currentHash !== storedHash) changeSet.replaces.push({
|
|
1381
|
+
name,
|
|
1382
|
+
revokeRequest: {
|
|
1383
|
+
workspaceId,
|
|
1384
|
+
connectionName: name
|
|
1385
|
+
},
|
|
1386
|
+
createRequest: buildConnectionRequest(workspaceId, name, config),
|
|
1387
|
+
metaRequest
|
|
1388
|
+
});
|
|
1389
|
+
else changeSet.unchanged.push({ name });
|
|
1390
|
+
delete existingConnections[name];
|
|
1391
|
+
} else changeSet.creates.push({
|
|
1392
|
+
name,
|
|
1393
|
+
request: buildConnectionRequest(workspaceId, name, config),
|
|
1394
|
+
metaRequest
|
|
1395
|
+
});
|
|
1396
|
+
}
|
|
1397
|
+
for (const [name, entry] of Object.entries(existingConnections)) {
|
|
1398
|
+
if (!entry) continue;
|
|
1399
|
+
if (entry.label && entry.label !== appName) {
|
|
1400
|
+
resourceOwners.add(entry.label);
|
|
1401
|
+
continue;
|
|
1402
|
+
}
|
|
1403
|
+
if (entry.label === appName || !metadataSupported) changeSet.deletes.push({
|
|
1404
|
+
name,
|
|
1405
|
+
request: {
|
|
1406
|
+
workspaceId,
|
|
1407
|
+
connectionName: name
|
|
1408
|
+
}
|
|
1409
|
+
});
|
|
1410
|
+
}
|
|
1411
|
+
return {
|
|
1412
|
+
changeSet,
|
|
1413
|
+
conflicts,
|
|
1414
|
+
unmanaged,
|
|
1415
|
+
resourceOwners
|
|
1416
|
+
};
|
|
1417
|
+
}
|
|
1418
|
+
/**
|
|
1419
|
+
* Attempt to set metadata, silently ignoring InvalidArgument errors
|
|
1420
|
+
* when the platform does not yet support auth-connection TRNs.
|
|
1421
|
+
* @param client - Operator client instance
|
|
1422
|
+
* @param metaRequest - Metadata request to send
|
|
1423
|
+
*/
|
|
1424
|
+
async function trySetMetadata(client, metaRequest) {
|
|
1425
|
+
try {
|
|
1426
|
+
await client.setMetadata(metaRequest);
|
|
1427
|
+
} catch (error) {
|
|
1428
|
+
if (error instanceof ConnectError && error.code === Code.InvalidArgument) return;
|
|
1429
|
+
throw error;
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
function extractOAuth2Config(connection) {
|
|
1433
|
+
if (!connection) return void 0;
|
|
1434
|
+
const config = connection.config;
|
|
1435
|
+
if (!config || config.case !== "oauth2" || !config.value) return void 0;
|
|
1436
|
+
const v = config.value;
|
|
1437
|
+
return {
|
|
1438
|
+
type: "oauth2",
|
|
1439
|
+
providerUrl: v.providerUrl ?? "",
|
|
1440
|
+
issuerUrl: v.issuerUrl ?? "",
|
|
1441
|
+
clientId: v.clientId ?? "",
|
|
1442
|
+
clientSecret: v.clientSecret ?? "",
|
|
1443
|
+
authUrl: v.authUrl || void 0,
|
|
1444
|
+
tokenUrl: v.tokenUrl || void 0
|
|
1445
|
+
};
|
|
1446
|
+
}
|
|
1447
|
+
/**
|
|
1448
|
+
* Apply auth connection changes for the given phase.
|
|
1449
|
+
* @param client - Operator client instance
|
|
1450
|
+
* @param result - Planned auth connection changes
|
|
1451
|
+
* @param phase - Apply phase
|
|
1452
|
+
*/
|
|
1453
|
+
async function applyAuthConnections(client, result, phase) {
|
|
1454
|
+
const { changeSet } = result;
|
|
1455
|
+
if (phase === "create-update") {
|
|
1456
|
+
await Promise.all(changeSet.creates.map(async (create) => {
|
|
1457
|
+
await client.createAuthConnection(create.request);
|
|
1458
|
+
if (create.metaRequest) await trySetMetadata(client, create.metaRequest);
|
|
1459
|
+
}));
|
|
1460
|
+
for (const replace of changeSet.replaces) {
|
|
1461
|
+
await client.revokeAuthConnection(replace.revokeRequest);
|
|
1462
|
+
await client.createAuthConnection(replace.createRequest);
|
|
1463
|
+
if (replace.metaRequest) await trySetMetadata(client, replace.metaRequest);
|
|
1464
|
+
}
|
|
1465
|
+
const state = loadSecretsState();
|
|
1466
|
+
if (!state.connections) state.connections = {};
|
|
1467
|
+
for (const create of changeSet.creates) {
|
|
1468
|
+
const oauth2 = extractOAuth2Config(create.request.connection);
|
|
1469
|
+
if (oauth2) state.connections[create.name] = hashConnectionConfig(oauth2);
|
|
1470
|
+
}
|
|
1471
|
+
for (const replace of changeSet.replaces) {
|
|
1472
|
+
const oauth2 = extractOAuth2Config(replace.createRequest.connection);
|
|
1473
|
+
if (oauth2) state.connections[replace.name] = hashConnectionConfig(oauth2);
|
|
1474
|
+
}
|
|
1475
|
+
saveSecretsState(state);
|
|
1476
|
+
} else if (phase === "delete-resources" || phase === "delete") {
|
|
1477
|
+
await Promise.all(changeSet.deletes.map(async (del) => {
|
|
1478
|
+
await client.revokeAuthConnection(del.request);
|
|
1479
|
+
}));
|
|
1480
|
+
if (changeSet.deletes.length > 0) {
|
|
1481
|
+
const state = loadSecretsState();
|
|
1482
|
+
if (state.connections) {
|
|
1483
|
+
for (const del of changeSet.deletes) delete state.connections[del.name];
|
|
1484
|
+
saveSecretsState(state);
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1489
|
+
|
|
1220
1490
|
//#endregion
|
|
1221
1491
|
//#region src/cli/commands/apply/function-registry.ts
|
|
1222
1492
|
const CHUNK_SIZE = 64 * 1024;
|
|
@@ -1869,6 +2139,7 @@ async function applyAuth(client, result, phase = "create-update") {
|
|
|
1869
2139
|
await client.updateAuthService(update.request);
|
|
1870
2140
|
await client.setMetadata(update.metaRequest);
|
|
1871
2141
|
})]);
|
|
2142
|
+
if (changeSet.connection) await applyAuthConnections(client, { changeSet: changeSet.connection }, "create-update");
|
|
1872
2143
|
await Promise.all([...changeSet.idpConfig.creates.map(async (create) => {
|
|
1873
2144
|
if (create.idpConfig.kind === "BuiltInIdP") create.request.idpConfig.config = await protoBuiltinIdPConfig(client, create.request.workspaceId, create.idpConfig);
|
|
1874
2145
|
return client.createAuthIDPConfig(create.request);
|
|
@@ -1903,6 +2174,7 @@ async function applyAuth(client, result, phase = "create-update") {
|
|
|
1903
2174
|
await Promise.all(changeSet.tenantConfig.deletes.map((del) => client.deleteTenantConfig(del.request)));
|
|
1904
2175
|
await Promise.all(changeSet.userProfileConfig.deletes.map((del) => client.deleteUserProfileConfig(del.request)));
|
|
1905
2176
|
await Promise.all(changeSet.idpConfig.deletes.map((del) => client.deleteAuthIDPConfig(del.request)));
|
|
2177
|
+
if (changeSet.connection) await applyAuthConnections(client, { changeSet: changeSet.connection }, "delete-resources");
|
|
1906
2178
|
} else if (phase === "delete-services") await Promise.all(changeSet.service.deletes.map((del) => client.deleteAuthService(del.request)));
|
|
1907
2179
|
}
|
|
1908
2180
|
/**
|
|
@@ -1919,7 +2191,7 @@ async function planAuth(context) {
|
|
|
1919
2191
|
}
|
|
1920
2192
|
const { changeSet: serviceChangeSet, conflicts, unmanaged, resourceOwners } = await planServices$2(client, workspaceId, application.name, auths, forceApplyAll);
|
|
1921
2193
|
const deletedServices = serviceChangeSet.deletes.map((del) => del.name);
|
|
1922
|
-
const [idpConfigChangeSet, userProfileConfigChangeSet, tenantConfigChangeSet, machineUserChangeSet, authHookChangeSet, oauth2ClientChangeSet, scimChangeSet, scimResourceChangeSet] = await Promise.all([
|
|
2194
|
+
const [idpConfigChangeSet, userProfileConfigChangeSet, tenantConfigChangeSet, machineUserChangeSet, authHookChangeSet, oauth2ClientChangeSet, scimChangeSet, scimResourceChangeSet, connectionResult] = await Promise.all([
|
|
1923
2195
|
planIdPConfigs(client, workspaceId, auths, deletedServices, forceApplyAll),
|
|
1924
2196
|
planUserProfileConfigs(client, workspaceId, auths, deletedServices, forceApplyAll),
|
|
1925
2197
|
planTenantConfigs(client, workspaceId, auths, deletedServices, forceApplyAll),
|
|
@@ -1927,7 +2199,8 @@ async function planAuth(context) {
|
|
|
1927
2199
|
planAuthHooks(client, workspaceId, auths, deletedServices, forceApplyAll),
|
|
1928
2200
|
planOAuth2Clients(client, workspaceId, auths, deletedServices, forceApplyAll),
|
|
1929
2201
|
planSCIMConfigs(client, workspaceId, auths, deletedServices),
|
|
1930
|
-
planSCIMResources(client, workspaceId, auths, deletedServices)
|
|
2202
|
+
planSCIMResources(client, workspaceId, auths, deletedServices),
|
|
2203
|
+
planAuthConnections(client, workspaceId, application.name, auths)
|
|
1931
2204
|
]);
|
|
1932
2205
|
serviceChangeSet.print();
|
|
1933
2206
|
idpConfigChangeSet.print();
|
|
@@ -1938,6 +2211,7 @@ async function planAuth(context) {
|
|
|
1938
2211
|
oauth2ClientChangeSet.print();
|
|
1939
2212
|
scimChangeSet.print();
|
|
1940
2213
|
scimResourceChangeSet.print();
|
|
2214
|
+
connectionResult.changeSet.print();
|
|
1941
2215
|
return {
|
|
1942
2216
|
changeSet: {
|
|
1943
2217
|
service: serviceChangeSet,
|
|
@@ -1948,11 +2222,12 @@ async function planAuth(context) {
|
|
|
1948
2222
|
authHook: authHookChangeSet,
|
|
1949
2223
|
oauth2Client: oauth2ClientChangeSet,
|
|
1950
2224
|
scim: scimChangeSet,
|
|
1951
|
-
scimResource: scimResourceChangeSet
|
|
2225
|
+
scimResource: scimResourceChangeSet,
|
|
2226
|
+
connection: connectionResult.changeSet
|
|
1952
2227
|
},
|
|
1953
|
-
conflicts,
|
|
1954
|
-
unmanaged,
|
|
1955
|
-
resourceOwners
|
|
2228
|
+
conflicts: [...conflicts, ...connectionResult.conflicts],
|
|
2229
|
+
unmanaged: [...unmanaged, ...connectionResult.unmanaged],
|
|
2230
|
+
resourceOwners: new Set([...resourceOwners, ...connectionResult.resourceOwners])
|
|
1956
2231
|
};
|
|
1957
2232
|
}
|
|
1958
2233
|
function trn$4(workspaceId, name) {
|
|
@@ -3832,48 +4107,6 @@ function protoFields(fields, baseName, isInput) {
|
|
|
3832
4107
|
});
|
|
3833
4108
|
}
|
|
3834
4109
|
|
|
3835
|
-
//#endregion
|
|
3836
|
-
//#region src/cli/commands/apply/secrets-state.ts
|
|
3837
|
-
const SecretsStateSchema = z.object({ vaults: z.record(z.string(), z.record(z.string(), z.string())) });
|
|
3838
|
-
/**
|
|
3839
|
-
* Get the file path for the secrets state JSON.
|
|
3840
|
-
* @returns Absolute path to secrets-state.json
|
|
3841
|
-
*/
|
|
3842
|
-
function getSecretsStatePath() {
|
|
3843
|
-
return path.join(getDistDir(), "secrets-state.json");
|
|
3844
|
-
}
|
|
3845
|
-
/**
|
|
3846
|
-
* Load secrets hash state from disk.
|
|
3847
|
-
* @returns Persisted state, or empty state if file is missing or corrupted
|
|
3848
|
-
*/
|
|
3849
|
-
function loadSecretsState() {
|
|
3850
|
-
const filePath = getSecretsStatePath();
|
|
3851
|
-
if (!existsSync(filePath)) return { vaults: {} };
|
|
3852
|
-
try {
|
|
3853
|
-
const raw = readFileSync(filePath, "utf-8");
|
|
3854
|
-
return SecretsStateSchema.parse(JSON.parse(raw));
|
|
3855
|
-
} catch {
|
|
3856
|
-
return { vaults: {} };
|
|
3857
|
-
}
|
|
3858
|
-
}
|
|
3859
|
-
/**
|
|
3860
|
-
* Save secrets hash state to disk.
|
|
3861
|
-
* @param state - The secrets state to persist
|
|
3862
|
-
*/
|
|
3863
|
-
function saveSecretsState(state) {
|
|
3864
|
-
const filePath = getSecretsStatePath();
|
|
3865
|
-
mkdirSync(path.dirname(filePath), { recursive: true });
|
|
3866
|
-
writeFileSync(filePath, JSON.stringify(state, null, 2), "utf-8");
|
|
3867
|
-
}
|
|
3868
|
-
/**
|
|
3869
|
-
* Compute SHA-256 hex digest of a value.
|
|
3870
|
-
* @param value - The string to hash
|
|
3871
|
-
* @returns Hex-encoded SHA-256 hash
|
|
3872
|
-
*/
|
|
3873
|
-
function hashValue(value) {
|
|
3874
|
-
return createHash("sha256").update(value).digest("hex");
|
|
3875
|
-
}
|
|
3876
|
-
|
|
3877
4110
|
//#endregion
|
|
3878
4111
|
//#region src/cli/commands/apply/secret-manager.ts
|
|
3879
4112
|
/**
|
|
@@ -7403,6 +7636,7 @@ function printPlanSummary(results) {
|
|
|
7403
7636
|
results.auth.changeSet.authHook,
|
|
7404
7637
|
results.auth.changeSet.scim,
|
|
7405
7638
|
results.auth.changeSet.scimResource,
|
|
7639
|
+
...results.auth.changeSet.connection ? [results.auth.changeSet.connection] : [],
|
|
7406
7640
|
results.pipeline.changeSet.service,
|
|
7407
7641
|
results.pipeline.changeSet.resolver,
|
|
7408
7642
|
results.app,
|
|
@@ -11691,7 +11925,7 @@ async function generate(options) {
|
|
|
11691
11925
|
if (options.init) await handleInitOption(namespacesWithMigrations, options.yes);
|
|
11692
11926
|
let pluginManager;
|
|
11693
11927
|
if (plugins.length > 0) pluginManager = new PluginManager(plugins);
|
|
11694
|
-
const { defineApplication } = await import("./application-
|
|
11928
|
+
const { defineApplication } = await import("./application-mGasp_EX.mjs");
|
|
11695
11929
|
const application = defineApplication({
|
|
11696
11930
|
config,
|
|
11697
11931
|
pluginManager
|
|
@@ -13894,4 +14128,4 @@ function isDeno() {
|
|
|
13894
14128
|
|
|
13895
14129
|
//#endregion
|
|
13896
14130
|
export { getFolder as $, getNextMigrationNumber as $t, listWorkflows as A, functionExecutionStatusToString as At, updateCommand$1 as B, DB_TYPES_FILE_NAME as Bt, listApps as C, startCommand as Ct, resumeCommand as D, executionsCommand as Dt, healthCommand as E, getWorkflow as Et, show as F, executeScript as Ft, listOrganizations as G, compareLocalTypesWithSnapshot as Gt, organizationTree as H, INITIAL_SCHEMA_NUMBER as Ht, showCommand as I, waitForExecution$1 as It, updateCommand$2 as J, formatMigrationNumber as Jt, getCommand$1 as K, compareSnapshots as Kt, logBetaWarning as L, MIGRATION_LABEL_KEY as Lt, truncateCommand as M, getCommand$5 as Mt, generate as N, getExecutor as Nt, resumeWorkflow as O, getWorkflowExecution as Ot, generateCommand as P, apply as Pt, getCommand$2 as Q, getMigrationFiles as Qt, remove as R, parseMigrationLabelNumber as Rt, createWorkspace as S, watchExecutorJob as St, getAppHealth as T, getCommand$4 as Tt, treeCommand as U, MIGRATE_FILE_NAME as Ut, updateOrganization as V, DIFF_FILE_NAME as Vt, listCommand$4 as W, SCHEMA_FILE_NAME as Wt, listCommand$5 as X, getMigrationDirPath as Xt, updateFolder as Y, getLatestMigrationNumber as Yt, listFolders as Z, getMigrationFilePath as Zt, getCommand as _, isVerbose as _n, listCommand$8 as _t, updateCommand as a, hasChanges as an, listOAuth2Clients as at, deleteWorkspace as b, jobsCommand as bt, removeUser as c, sdkNameLabelKey as cn, getMachineUserToken as ct, inviteCommand as d, apiCall as dn, listMachineUsers as dt, isValidMigrationNumber as en, deleteCommand$1 as et, inviteUser as f, apiCommand as fn, generate$1 as ft, listWorkspaces as g, deploymentArgs as gn, triggerExecutor as gt, listCommand$1 as h, confirmationArgs as hn, triggerCommand as ht, isCLIError as i, formatMigrationDiff as in, listCommand$6 as it, truncate as j, formatKeyValueTable as jt, listCommand$3 as k, listWorkflowExecutions as kt, listCommand as l, trnPrefix as ln, tokenCommand as lt, restoreWorkspace as m, commonArgs as mn, webhookCommand as mt, query as n, reconstructSnapshotFromMigrations as nn, createCommand$1 as nt, updateUser as o, getNamespacesWithMigrations as on, getCommand$3 as ot, restoreCommand as p, defineAppCommand as pn, listWebhookExecutors as pt, getOrganization as q, createSnapshotFromLocalTypes as qt, queryCommand as r, formatDiffSummary as rn, createFolder as rt, removeCommand as s, prompt as sn, getOAuth2Client as st, isNativeTypeScriptRuntime as t, loadDiff as tn, deleteFolder as tt, listUsers as u, generateUserTypes as un, listCommand$7 as ut, getWorkspace as v, workspaceArgs as vn, listExecutors as vt, listCommand$2 as w, startWorkflow as wt, createCommand as x, listExecutorJobs as xt, deleteCommand as y, getExecutorJob as yt, removeCommand$1 as z, bundleMigrationScript as zt };
|
|
13897
|
-
//# sourceMappingURL=runtime-
|
|
14131
|
+
//# sourceMappingURL=runtime-D4O-RfcH.mjs.map
|