@tailor-platform/sdk 1.24.0 → 1.25.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.
Files changed (65) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/{app-config-BNKHurwr.d.mts → app-config-QzNOFnEy.d.mts} +26 -3
  3. package/dist/application-B4ORumjE.mjs +8 -0
  4. package/dist/{application-DThE2HW7.mjs → application-iRp2OYMz.mjs} +36 -15
  5. package/dist/application-iRp2OYMz.mjs.map +1 -0
  6. package/dist/brand-BOaOlsiP.mjs +36 -0
  7. package/dist/brand-BOaOlsiP.mjs.map +1 -0
  8. package/dist/cli/index.mjs +9 -9
  9. package/dist/cli/lib.d.mts +6 -7
  10. package/dist/cli/lib.mjs +10 -10
  11. package/dist/configure/index.d.mts +5 -5
  12. package/dist/configure/index.mjs +33 -7
  13. package/dist/configure/index.mjs.map +1 -1
  14. package/dist/{enum-constants-B5Nl-yzx.mjs → enum-constants-BxdLbhsW.mjs} +1 -1
  15. package/dist/{enum-constants-B5Nl-yzx.mjs.map → enum-constants-BxdLbhsW.mjs.map} +1 -1
  16. package/dist/{env-CHwmMyfF.d.mts → env-jndw86T4.d.mts} +2 -2
  17. package/dist/{file-utils-sEOwAdJ4.mjs → file-utils-C2r3AVbI.mjs} +1 -1
  18. package/dist/{file-utils-sEOwAdJ4.mjs.map → file-utils-C2r3AVbI.mjs.map} +1 -1
  19. package/dist/{index-Df0aH5zp.d.mts → index-BuWllBxZ.d.mts} +4 -4
  20. package/dist/{index-DhtKJmgi.d.mts → index-DZRZdh71.d.mts} +2 -2
  21. package/dist/{index-zZUL7_2B.d.mts → index-Do7zo7z-.d.mts} +2 -2
  22. package/dist/{index-BrIZ1rm2.d.mts → index-DoxGF8-i.d.mts} +2 -2
  23. package/dist/{index-DkRJwNw2.d.mts → index-VZq4IAEK.d.mts} +2 -2
  24. package/dist/{interceptor-B-0OmiDZ.mjs → interceptor-DVy32eIG.mjs} +1 -1
  25. package/dist/{interceptor-B-0OmiDZ.mjs.map → interceptor-DVy32eIG.mjs.map} +1 -1
  26. package/dist/{job-CnqcfVTI.mjs → job-BQDunsd7.mjs} +3 -3
  27. package/dist/{job-CnqcfVTI.mjs.map → job-BQDunsd7.mjs.map} +1 -1
  28. package/dist/{kysely-type-CSlcwNFH.mjs → kysely-type-DzLBuVp6.mjs} +1 -1
  29. package/dist/{kysely-type-CSlcwNFH.mjs.map → kysely-type-DzLBuVp6.mjs.map} +1 -1
  30. package/dist/package-json-BKA36WTo.mjs +3 -0
  31. package/dist/{package-json-4G3gLWMd.mjs → package-json-DnbGCOkg.mjs} +1 -1
  32. package/dist/{package-json-4G3gLWMd.mjs.map → package-json-DnbGCOkg.mjs.map} +1 -1
  33. package/dist/plugin/builtin/enum-constants/index.d.mts +2 -2
  34. package/dist/plugin/builtin/enum-constants/index.mjs +1 -1
  35. package/dist/plugin/builtin/file-utils/index.d.mts +2 -2
  36. package/dist/plugin/builtin/file-utils/index.mjs +1 -1
  37. package/dist/plugin/builtin/kysely-type/index.d.mts +2 -2
  38. package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
  39. package/dist/plugin/builtin/seed/index.d.mts +2 -2
  40. package/dist/plugin/builtin/seed/index.mjs +1 -1
  41. package/dist/plugin/index.d.mts +2 -2
  42. package/dist/{plugin-CE-BZZgX.d.mts → plugin-3sT6Tcq0.d.mts} +1 -1
  43. package/dist/{query-CV5n7DRd.mjs → query-D3UyoG68.mjs} +286 -16
  44. package/dist/query-D3UyoG68.mjs.map +1 -0
  45. package/dist/{schema-0ByCZ2Ym.mjs → schema-Fbfeq9gi.mjs} +3 -3
  46. package/dist/{schema-0ByCZ2Ym.mjs.map → schema-Fbfeq9gi.mjs.map} +1 -1
  47. package/dist/seed/index.d.mts +29 -0
  48. package/dist/seed/index.mjs +89 -0
  49. package/dist/seed/index.mjs.map +1 -0
  50. package/dist/{seed-Cl5QXYsL.mjs → seed-DkKAheSe.mjs} +64 -7
  51. package/dist/seed-DkKAheSe.mjs.map +1 -0
  52. package/dist/telemetry-J6dpByo2.mjs +3 -0
  53. package/dist/{telemetry-BPviAbME.mjs → telemetry-d_lgTL33.mjs} +2 -2
  54. package/dist/{telemetry-BPviAbME.mjs.map → telemetry-d_lgTL33.mjs.map} +1 -1
  55. package/dist/utils/test/index.d.mts +3 -3
  56. package/dist/utils/test/index.mjs +2 -2
  57. package/package.json +7 -2
  58. package/dist/application-DThE2HW7.mjs.map +0 -1
  59. package/dist/application-P1by1htu.mjs +0 -8
  60. package/dist/brand-64NrPh_e.mjs +0 -28
  61. package/dist/brand-64NrPh_e.mjs.map +0 -1
  62. package/dist/package-json-BqvUKPBM.mjs +0 -3
  63. package/dist/query-CV5n7DRd.mjs.map +0 -1
  64. package/dist/seed-Cl5QXYsL.mjs.map +0 -1
  65. package/dist/telemetry-Dq5FZUH0.mjs +0 -3
@@ -1,10 +1,11 @@
1
- import { t as db } from "./schema-0ByCZ2Ym.mjs";
2
- import { $ as AuthSCIMAttribute_Mutability, A as platformBaseUrl, B as TailorDBType_Permission_Permit, C as readPlatformConfig, E as fetchMachineUserToken, F as WorkflowJobExecution_Status, H as PipelineResolver_OperationType, I as TailorDBGQLPermission_Action, J as ExecutorTriggerType, K as ExecutorJobStatus, L as TailorDBGQLPermission_Operator, M as userAgent, N as WorkspacePlatformUserRole, P as WorkflowExecution_Status, Q as AuthOAuth2Client_GrantType, R as TailorDBGQLPermission_Permit, S as loadWorkspaceId, T as fetchAll, U as IdPLang, V as TailorDBType_PermitAction, W as FunctionExecution_Status, X as AuthInvokerSchema, Y as AuthIDPConfig_AuthType, Z as AuthOAuth2Client_ClientType, _ as hashFile, a as loadConfig, at as UserProfileProviderConfig_UserProfileProviderType, b as loadFolderId, ct as Condition_Operator, d as TailorDBTypeSchema, dt as ApplicationSchemaUpdateAttemptStatus, et as AuthSCIMAttribute_Type, f as stringifyFunction, ft as Subgraph_ServiceType, g as getDistDir, h as createBundleCache, ht as symbols, it as TenantProviderConfig_TenantProviderType, j as resolveStaticWebsiteUrls, k as initOperatorClient, l as OAuth2ClientSchema, lt as FilterSchema, m as loadFilesWithIgnores, mt as styles, n as generatePluginFilesIfNeeded, nt as AuthSCIMConfig_AuthorizationType, ot as GetApplicationSchemaHealthResponse_ApplicationSchemaHealthStatus, p as tailorUserMap, pt as logger, q as ExecutorTargetType, r as loadApplication, s as createExecutorService, st as ConditionSchema, t as defineApplication, tt as AuthSCIMAttribute_Uniqueness, ut as PageDirection, w as writePlatformConfig, x as loadOrganizationId, y as loadAccessToken, z as TailorDBType_Permission_Operator } from "./application-DThE2HW7.mjs";
3
- import { t as readPackageJson } from "./package-json-4G3gLWMd.mjs";
4
- import { r as withSpan } from "./telemetry-BPviAbME.mjs";
1
+ import { t as db } from "./schema-Fbfeq9gi.mjs";
2
+ import { $ as AuthSCIMAttribute_Mutability, A as platformBaseUrl, B as TailorDBType_Permission_Permit, C as readPlatformConfig, E as fetchMachineUserToken, F as WorkflowJobExecution_Status, H as PipelineResolver_OperationType, I as TailorDBGQLPermission_Action, J as ExecutorTriggerType, K as ExecutorJobStatus, L as TailorDBGQLPermission_Operator, M as userAgent, N as WorkspacePlatformUserRole, P as WorkflowExecution_Status, Q as AuthOAuth2Client_GrantType, R as TailorDBGQLPermission_Permit, S as loadWorkspaceId, T as fetchAll, U as IdPLang, V as TailorDBType_PermitAction, W as FunctionExecution_Status, X as AuthInvokerSchema, Y as AuthIDPConfig_AuthType, Z as AuthOAuth2Client_ClientType, _ as hashFile, a as loadConfig, at as UserProfileProviderConfig_UserProfileProviderType, b as loadFolderId, ct as Condition_Operator, d as TailorDBTypeSchema, dt as ApplicationSchemaUpdateAttemptStatus, et as AuthSCIMAttribute_Type, f as stringifyFunction, ft as Subgraph_ServiceType, g as getDistDir, h as createBundleCache, ht as symbols, it as TenantProviderConfig_TenantProviderType, j as resolveStaticWebsiteUrls, k as initOperatorClient, l as OAuth2ClientSchema, lt as FilterSchema, m as loadFilesWithIgnores, mt as styles, n as generatePluginFilesIfNeeded, nt as AuthSCIMConfig_AuthorizationType, ot as GetApplicationSchemaHealthResponse_ApplicationSchemaHealthStatus, p as tailorUserMap, pt as logger, q as ExecutorTargetType, r as loadApplication, s as createExecutorService, st as ConditionSchema, t as defineApplication, tt as AuthSCIMAttribute_Uniqueness, ut as PageDirection, w as writePlatformConfig, x as loadOrganizationId, y as loadAccessToken, z as TailorDBType_Permission_Operator } from "./application-iRp2OYMz.mjs";
3
+ import { t as readPackageJson } from "./package-json-DnbGCOkg.mjs";
4
+ import { r as withSpan } from "./telemetry-d_lgTL33.mjs";
5
5
  import { arg, defineCommand, runCommand } from "politty";
6
6
  import { z } from "zod";
7
7
  import * as fs$1 from "node:fs";
8
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
8
9
  import { parseEnv } from "node:util";
9
10
  import * as path from "pathe";
10
11
  import chalk from "chalk";
@@ -17,6 +18,7 @@ import { tmpdir } from "node:os";
17
18
  import { findUpSync } from "find-up-simple";
18
19
  import ml from "multiline-ts";
19
20
  import * as crypto from "node:crypto";
21
+ import { createHash } from "node:crypto";
20
22
  import { pathToFileURL } from "node:url";
21
23
  import * as inflection from "inflection";
22
24
  import * as rolldown from "rolldown";
@@ -213,7 +215,7 @@ const withCommonArgs = (handler) => async (args) => {
213
215
  try {
214
216
  if ("json" in args && typeof args.json === "boolean") logger.jsonMode = args.json;
215
217
  loadEnvFiles(args["env-file"], args["env-file-if-exists"]);
216
- const { initTelemetry } = await import("./telemetry-Dq5FZUH0.mjs");
218
+ const { initTelemetry } = await import("./telemetry-J6dpByo2.mjs");
217
219
  await initTelemetry();
218
220
  await handler(args);
219
221
  } catch (error) {
@@ -226,7 +228,7 @@ const withCommonArgs = (handler) => async (args) => {
226
228
  } else logger.error(`Unknown error: ${error}`);
227
229
  process.exit(1);
228
230
  } finally {
229
- const { shutdownTelemetry } = await import("./telemetry-Dq5FZUH0.mjs");
231
+ const { shutdownTelemetry } = await import("./telemetry-J6dpByo2.mjs");
230
232
  await shutdownTelemetry();
231
233
  }
232
234
  process.exit(0);
@@ -3251,6 +3253,257 @@ function protoFields(fields, baseName, isInput) {
3251
3253
  });
3252
3254
  }
3253
3255
 
3256
+ //#endregion
3257
+ //#region src/cli/commands/apply/secrets-state.ts
3258
+ const SecretsStateSchema = z.object({ vaults: z.record(z.string(), z.record(z.string(), z.string())) });
3259
+ /**
3260
+ * Get the file path for the secrets state JSON.
3261
+ * @returns Absolute path to secrets-state.json
3262
+ */
3263
+ function getSecretsStatePath() {
3264
+ return path.join(getDistDir(), "secrets-state.json");
3265
+ }
3266
+ /**
3267
+ * Load secrets hash state from disk.
3268
+ * @returns Persisted state, or empty state if file is missing or corrupted
3269
+ */
3270
+ function loadSecretsState() {
3271
+ const filePath = getSecretsStatePath();
3272
+ if (!existsSync(filePath)) return { vaults: {} };
3273
+ try {
3274
+ const raw = readFileSync(filePath, "utf-8");
3275
+ return SecretsStateSchema.parse(JSON.parse(raw));
3276
+ } catch {
3277
+ return { vaults: {} };
3278
+ }
3279
+ }
3280
+ /**
3281
+ * Save secrets hash state to disk.
3282
+ * @param state - The secrets state to persist
3283
+ */
3284
+ function saveSecretsState(state) {
3285
+ const filePath = getSecretsStatePath();
3286
+ mkdirSync(path.dirname(filePath), { recursive: true });
3287
+ writeFileSync(filePath, JSON.stringify(state, null, 2), "utf-8");
3288
+ }
3289
+ /**
3290
+ * Compute SHA-256 hex digest of a value.
3291
+ * @param value - The string to hash
3292
+ * @returns Hex-encoded SHA-256 hash
3293
+ */
3294
+ function hashValue(value) {
3295
+ return createHash("sha256").update(value).digest("hex");
3296
+ }
3297
+
3298
+ //#endregion
3299
+ //#region src/cli/commands/apply/secret-manager.ts
3300
+ /**
3301
+ * Plan secret manager changes based on current and desired state.
3302
+ * @param context - Planning context
3303
+ * @returns Planned changes for vaults and secrets
3304
+ */
3305
+ async function planSecretManager(context) {
3306
+ const { client, workspaceId, application, forRemoval } = context;
3307
+ const secretVaults = forRemoval ? [] : application.secrets;
3308
+ const vaultChangeSet = createChangeSet("Secret Manager vaults");
3309
+ const secretChangeSet = createChangeSet("Secret Manager secrets");
3310
+ const conflicts = [];
3311
+ const unmanaged = [];
3312
+ const resourceOwners = /* @__PURE__ */ new Set();
3313
+ const existingVaultList = await fetchAll(async (pageToken, maxPageSize) => {
3314
+ try {
3315
+ const { vaults, nextPageToken } = await client.listSecretManagerVaults({
3316
+ workspaceId,
3317
+ pageToken,
3318
+ pageSize: maxPageSize
3319
+ });
3320
+ return [vaults, nextPageToken];
3321
+ } catch (error) {
3322
+ if (error instanceof ConnectError && error.code === Code.NotFound) return [[], ""];
3323
+ throw error;
3324
+ }
3325
+ });
3326
+ const existingVaults = {};
3327
+ await Promise.all(existingVaultList.map(async (resource) => {
3328
+ const { metadata } = await client.getMetadata({ trn: vaultTrn(workspaceId, resource.name) });
3329
+ existingVaults[resource.name] = {
3330
+ resource,
3331
+ label: metadata?.labels[sdkNameLabelKey]
3332
+ };
3333
+ }));
3334
+ const state = loadSecretsState();
3335
+ await Promise.all(secretVaults.map(async (vault) => {
3336
+ const vaultName = vault.vaultName;
3337
+ const existing = existingVaults[vaultName];
3338
+ if (existing) {
3339
+ if (!existing.label) unmanaged.push({
3340
+ resourceType: "Secret Manager vault",
3341
+ resourceName: vaultName
3342
+ });
3343
+ else if (existing.label !== application.name) conflicts.push({
3344
+ resourceType: "Secret Manager vault",
3345
+ resourceName: vaultName,
3346
+ currentOwner: existing.label
3347
+ });
3348
+ vaultChangeSet.updates.push({
3349
+ name: vaultName,
3350
+ workspaceId
3351
+ });
3352
+ delete existingVaults[vaultName];
3353
+ } else vaultChangeSet.creates.push({
3354
+ name: vaultName,
3355
+ workspaceId
3356
+ });
3357
+ let existingSecrets = [];
3358
+ if (existing) existingSecrets = (await fetchAll(async (pageToken, maxPageSize) => {
3359
+ try {
3360
+ const { secrets, nextPageToken } = await client.listSecretManagerSecrets({
3361
+ workspaceId,
3362
+ secretmanagerVaultName: vaultName,
3363
+ pageToken,
3364
+ pageSize: maxPageSize
3365
+ });
3366
+ return [secrets, nextPageToken];
3367
+ } catch (error) {
3368
+ if (error instanceof ConnectError && error.code === Code.NotFound) return [[], ""];
3369
+ throw error;
3370
+ }
3371
+ })).map((s) => s.name);
3372
+ const existingSet = new Set(existingSecrets);
3373
+ for (const secret of vault.secrets) if (existingSet.has(secret.name)) {
3374
+ if (hashValue(secret.value) !== state.vaults[vaultName]?.[secret.name]) secretChangeSet.updates.push({
3375
+ name: `${vaultName}/${secret.name}`,
3376
+ secretName: secret.name,
3377
+ workspaceId,
3378
+ vaultName,
3379
+ value: secret.value
3380
+ });
3381
+ existingSet.delete(secret.name);
3382
+ } else secretChangeSet.creates.push({
3383
+ name: `${vaultName}/${secret.name}`,
3384
+ secretName: secret.name,
3385
+ workspaceId,
3386
+ vaultName,
3387
+ value: secret.value
3388
+ });
3389
+ for (const orphanName of existingSet) secretChangeSet.deletes.push({
3390
+ name: `${vaultName}/${orphanName}`,
3391
+ secretName: orphanName,
3392
+ workspaceId,
3393
+ vaultName
3394
+ });
3395
+ }));
3396
+ for (const [name, entry] of Object.entries(existingVaults)) {
3397
+ if (!entry) continue;
3398
+ const label = entry.label;
3399
+ if (label && label !== application.name) resourceOwners.add(label);
3400
+ if (label === application.name) {
3401
+ const secrets = await fetchAll(async (pageToken, maxPageSize) => {
3402
+ try {
3403
+ const { secrets: secrets$1, nextPageToken } = await client.listSecretManagerSecrets({
3404
+ workspaceId,
3405
+ secretmanagerVaultName: name,
3406
+ pageToken,
3407
+ pageSize: maxPageSize
3408
+ });
3409
+ return [secrets$1, nextPageToken];
3410
+ } catch (error) {
3411
+ if (error instanceof ConnectError && error.code === Code.NotFound) return [[], ""];
3412
+ throw error;
3413
+ }
3414
+ });
3415
+ for (const secret of secrets) secretChangeSet.deletes.push({
3416
+ name: `${name}/${secret.name}`,
3417
+ secretName: secret.name,
3418
+ workspaceId,
3419
+ vaultName: name
3420
+ });
3421
+ vaultChangeSet.deletes.push({
3422
+ name,
3423
+ workspaceId
3424
+ });
3425
+ }
3426
+ }
3427
+ vaultChangeSet.print();
3428
+ secretChangeSet.print();
3429
+ return {
3430
+ vaultChangeSet,
3431
+ secretChangeSet,
3432
+ conflicts,
3433
+ unmanaged,
3434
+ resourceOwners
3435
+ };
3436
+ }
3437
+ function vaultTrn(workspaceId, name) {
3438
+ return `trn:v1:workspace:${workspaceId}:vault:${name}`;
3439
+ }
3440
+ /**
3441
+ * Apply secret manager changes for the given phase.
3442
+ * @param client - Operator client instance
3443
+ * @param result - Planned secret changes
3444
+ * @param phase - Apply phase
3445
+ * @param application - Application to read secrets from for hash state persistence
3446
+ * @returns Promise that resolves when secret changes are applied
3447
+ */
3448
+ async function applySecretManager(client, result, phase = "create-update", application) {
3449
+ const { vaultChangeSet, secretChangeSet } = result;
3450
+ if (phase === "create-update") {
3451
+ await Promise.all(vaultChangeSet.creates.map(async (create$1) => {
3452
+ await client.createSecretManagerVault({
3453
+ workspaceId: create$1.workspaceId,
3454
+ secretmanagerVaultName: create$1.name
3455
+ });
3456
+ if (application) {
3457
+ const metaRequest = await buildMetaRequest(vaultTrn(create$1.workspaceId, create$1.name), application.name);
3458
+ await client.setMetadata(metaRequest);
3459
+ }
3460
+ }));
3461
+ if (application) await Promise.all(vaultChangeSet.updates.map(async (update) => {
3462
+ const metaRequest = await buildMetaRequest(vaultTrn(update.workspaceId, update.name), application.name);
3463
+ await client.setMetadata(metaRequest);
3464
+ }));
3465
+ await Promise.all(secretChangeSet.creates.map((create$1) => client.createSecretManagerSecret({
3466
+ workspaceId: create$1.workspaceId,
3467
+ secretmanagerVaultName: create$1.vaultName,
3468
+ secretmanagerSecretName: create$1.secretName,
3469
+ secretmanagerSecretValue: create$1.value
3470
+ })));
3471
+ await Promise.all(secretChangeSet.updates.map((update) => client.updateSecretManagerSecret({
3472
+ workspaceId: update.workspaceId,
3473
+ secretmanagerVaultName: update.vaultName,
3474
+ secretmanagerSecretName: update.secretName,
3475
+ secretmanagerSecretValue: update.value
3476
+ })));
3477
+ if (application) {
3478
+ const state = loadSecretsState();
3479
+ for (const vault of application.secrets) {
3480
+ if (!state.vaults[vault.vaultName]) state.vaults[vault.vaultName] = {};
3481
+ for (const secret of vault.secrets) state.vaults[vault.vaultName][secret.name] = hashValue(secret.value);
3482
+ }
3483
+ saveSecretsState(state);
3484
+ }
3485
+ } else if (phase === "delete") {
3486
+ await Promise.all(secretChangeSet.deletes.map((del) => client.deleteSecretManagerSecret({
3487
+ workspaceId: del.workspaceId,
3488
+ secretmanagerVaultName: del.vaultName,
3489
+ secretmanagerSecretName: del.secretName
3490
+ })));
3491
+ await Promise.all(vaultChangeSet.deletes.map((del) => client.deleteSecretManagerVault({
3492
+ workspaceId: del.workspaceId,
3493
+ secretmanagerVaultName: del.name
3494
+ })));
3495
+ if (secretChangeSet.deletes.length > 0 || vaultChangeSet.deletes.length > 0) {
3496
+ const state = loadSecretsState();
3497
+ for (const del of secretChangeSet.deletes) if (state.vaults[del.vaultName]) {
3498
+ delete state.vaults[del.vaultName][del.secretName];
3499
+ if (Object.keys(state.vaults[del.vaultName]).length === 0) delete state.vaults[del.vaultName];
3500
+ }
3501
+ for (const del of vaultChangeSet.deletes) delete state.vaults[del.name];
3502
+ saveSecretsState(state);
3503
+ }
3504
+ }
3505
+ }
3506
+
3254
3507
  //#endregion
3255
3508
  //#region src/cli/commands/apply/staticwebsite.ts
3256
3509
  /**
@@ -6382,7 +6635,7 @@ async function apply(options) {
6382
6635
  const functionEntries = collectFunctionEntries(application, workflowService?.jobs ?? []);
6383
6636
  const dryRun = options?.dryRun ?? false;
6384
6637
  const yes = options?.yes ?? false;
6385
- const { functionRegistry, tailorDB, staticWebsite, idp, auth, pipeline, app, executor, workflow } = await withSpan("plan", async () => {
6638
+ const { functionRegistry, tailorDB, staticWebsite, idp, auth, pipeline, app, executor, workflow, secretManager } = await withSpan("plan", async () => {
6386
6639
  const ctx = {
6387
6640
  client,
6388
6641
  workspaceId,
@@ -6391,7 +6644,7 @@ async function apply(options) {
6391
6644
  config,
6392
6645
  noSchemaCheck: options?.noSchemaCheck
6393
6646
  };
6394
- const [functionRegistry$1, tailorDB$1, staticWebsite$1, idp$1, auth$1, pipeline$1, app$1, executor$1, workflow$1] = await Promise.all([
6647
+ const [functionRegistry$1, tailorDB$1, staticWebsite$1, idp$1, auth$1, pipeline$1, app$1, executor$1, workflow$1, secretManager$1] = await Promise.all([
6395
6648
  withSpan("plan.functionRegistry", () => planFunctionRegistry(client, workspaceId, application.name, functionEntries)),
6396
6649
  withSpan("plan.tailorDB", () => planTailorDB(ctx)),
6397
6650
  withSpan("plan.staticWebsite", () => planStaticWebsite(ctx)),
@@ -6400,7 +6653,8 @@ async function apply(options) {
6400
6653
  withSpan("plan.pipeline", () => planPipeline(ctx)),
6401
6654
  withSpan("plan.application", () => planApplication(ctx)),
6402
6655
  withSpan("plan.executor", () => planExecutor(ctx)),
6403
- withSpan("plan.workflow", () => planWorkflow(client, workspaceId, application.name, workflowService?.workflows ?? {}, workflowBuildResult?.mainJobDeps ?? {}))
6656
+ withSpan("plan.workflow", () => planWorkflow(client, workspaceId, application.name, workflowService?.workflows ?? {}, workflowBuildResult?.mainJobDeps ?? {})),
6657
+ withSpan("plan.secretManager", () => planSecretManager(ctx))
6404
6658
  ]);
6405
6659
  return {
6406
6660
  functionRegistry: functionRegistry$1,
@@ -6411,7 +6665,8 @@ async function apply(options) {
6411
6665
  pipeline: pipeline$1,
6412
6666
  app: app$1,
6413
6667
  executor: executor$1,
6414
- workflow: workflow$1
6668
+ workflow: workflow$1,
6669
+ secretManager: secretManager$1
6415
6670
  };
6416
6671
  });
6417
6672
  await withSpan("confirm", async () => {
@@ -6423,7 +6678,8 @@ async function apply(options) {
6423
6678
  ...auth.conflicts,
6424
6679
  ...pipeline.conflicts,
6425
6680
  ...executor.conflicts,
6426
- ...workflow.conflicts
6681
+ ...workflow.conflicts,
6682
+ ...secretManager.conflicts
6427
6683
  ];
6428
6684
  await confirmOwnerConflict(allConflicts, application.name, yes);
6429
6685
  await confirmUnmanagedResources([
@@ -6434,7 +6690,8 @@ async function apply(options) {
6434
6690
  ...auth.unmanaged,
6435
6691
  ...pipeline.unmanaged,
6436
6692
  ...executor.unmanaged,
6437
- ...workflow.unmanaged
6693
+ ...workflow.unmanaged,
6694
+ ...secretManager.unmanaged
6438
6695
  ], application.name, yes);
6439
6696
  const importantDeletions = [];
6440
6697
  for (const del of tailorDB.changeSet.type.deletes) importantDeletions.push({
@@ -6453,6 +6710,14 @@ async function apply(options) {
6453
6710
  resourceType: "OAuth2 client (client type change)",
6454
6711
  resourceName: replace.name
6455
6712
  });
6713
+ for (const del of secretManager.vaultChangeSet.deletes) importantDeletions.push({
6714
+ resourceType: "Secret Manager vault",
6715
+ resourceName: del.name
6716
+ });
6717
+ for (const del of secretManager.secretChangeSet.deletes) importantDeletions.push({
6718
+ resourceType: "Secret Manager secret",
6719
+ resourceName: del.name
6720
+ });
6456
6721
  await confirmImportantResourceDeletion(importantDeletions, yes);
6457
6722
  const resourceOwners = new Set([
6458
6723
  ...functionRegistry.resourceOwners,
@@ -6462,7 +6727,8 @@ async function apply(options) {
6462
6727
  ...auth.resourceOwners,
6463
6728
  ...pipeline.resourceOwners,
6464
6729
  ...executor.resourceOwners,
6465
- ...workflow.resourceOwners
6730
+ ...workflow.resourceOwners,
6731
+ ...secretManager.resourceOwners
6466
6732
  ]);
6467
6733
  const emptyApps = [...new Set(allConflicts.map((c) => c.currentOwner))].filter((owner) => !resourceOwners.has(owner));
6468
6734
  for (const emptyApp of emptyApps) app.deletes.push({
@@ -6478,6 +6744,7 @@ async function apply(options) {
6478
6744
  return;
6479
6745
  }
6480
6746
  await withSpan("apply.createUpdateServices", async () => {
6747
+ await applySecretManager(client, secretManager, "create-update", application);
6481
6748
  await applyFunctionRegistry(client, workspaceId, functionRegistry, "create-update");
6482
6749
  await applyStaticWebsite(client, staticWebsite, "create-update");
6483
6750
  await applyIdP(client, idp, "create-update");
@@ -6499,6 +6766,7 @@ async function apply(options) {
6499
6766
  await applyWorkflow(client, workflow, "delete");
6500
6767
  await applyExecutor(client, executor, "delete");
6501
6768
  await applyStaticWebsite(client, staticWebsite, "delete");
6769
+ await applySecretManager(client, secretManager, "delete");
6502
6770
  });
6503
6771
  await withSpan("apply.deleteApplication", () => applyApplication(client, app, "delete"));
6504
6772
  await withSpan("apply.deleteSubgraphServices", async () => {
@@ -9400,7 +9668,8 @@ async function execRemove(client, workspaceId, application, config, confirm) {
9400
9668
  const executor = await planExecutor(ctx);
9401
9669
  const workflow = await planWorkflow(client, workspaceId, application.name, {}, {});
9402
9670
  const functionRegistry = await planFunctionRegistry(client, workspaceId, application.name, []);
9403
- if (tailorDB.changeSet.service.deletes.length === 0 && staticWebsite.changeSet.deletes.length === 0 && idp.changeSet.service.deletes.length === 0 && auth.changeSet.service.deletes.length === 0 && pipeline.changeSet.service.deletes.length === 0 && app.deletes.length === 0 && executor.changeSet.deletes.length === 0 && workflow.changeSet.deletes.length === 0 && functionRegistry.changeSet.deletes.length === 0) return;
9671
+ const secretManager = await planSecretManager(ctx);
9672
+ if (tailorDB.changeSet.service.deletes.length === 0 && staticWebsite.changeSet.deletes.length === 0 && idp.changeSet.service.deletes.length === 0 && auth.changeSet.service.deletes.length === 0 && pipeline.changeSet.service.deletes.length === 0 && app.deletes.length === 0 && executor.changeSet.deletes.length === 0 && workflow.changeSet.deletes.length === 0 && functionRegistry.changeSet.deletes.length === 0 && secretManager.vaultChangeSet.deletes.length === 0 && secretManager.secretChangeSet.deletes.length === 0) return;
9404
9673
  if (confirm) await confirm();
9405
9674
  await applyWorkflow(client, workflow, "delete");
9406
9675
  await applyExecutor(client, executor, "delete");
@@ -9415,6 +9684,7 @@ async function execRemove(client, workspaceId, application, config, confirm) {
9415
9684
  await applyTailorDB(client, tailorDB, "delete-resources");
9416
9685
  await applyTailorDB(client, tailorDB, "delete-services");
9417
9686
  await applyFunctionRegistry(client, workspaceId, functionRegistry, "delete");
9687
+ await applySecretManager(client, secretManager, "delete");
9418
9688
  }
9419
9689
  /**
9420
9690
  * Remove all resources managed by the current application.
@@ -10101,7 +10371,7 @@ async function generate(options) {
10101
10371
  if (options.init) await handleInitOption(namespacesWithMigrations, options.yes);
10102
10372
  let pluginManager;
10103
10373
  if (plugins.length > 0) pluginManager = new PluginManager(plugins);
10104
- const { defineApplication: defineApplication$1 } = await import("./application-P1by1htu.mjs");
10374
+ const { defineApplication: defineApplication$1 } = await import("./application-B4ORumjE.mjs");
10105
10375
  const application = defineApplication$1({
10106
10376
  config,
10107
10377
  pluginManager
@@ -12275,4 +12545,4 @@ function printGqlResult(result, options = {}) {
12275
12545
 
12276
12546
  //#endregion
12277
12547
  export { getExecutorJob as $, truncateCommand as A, getMigrationDirPath as At, getCommand$1 as B, getNamespacesWithMigrations as Bt, getAppHealth as C, MIGRATE_FILE_NAME as Ct, listCommand$3 as D, createSnapshotFromLocalTypes as Dt, resumeWorkflow as E, compareSnapshots as Et, showCommand as F, loadDiff as Ft, listMachineUsers as G, commonArgs as Gt, getMachineUserToken as H, generateUserTypes as Ht, remove as I, reconstructSnapshotFromMigrations as It, webhookCommand as J, jsonArgs as Jt, generate$1 as K, confirmationArgs as Kt, removeCommand$1 as L, formatDiffSummary as Lt, generateCommand as M, getMigrationFiles as Mt, logBetaWarning as N, getNextMigrationNumber as Nt, listWorkflows as O, formatMigrationNumber as Ot, show as P, isValidMigrationNumber as Pt, listExecutors as Q, listCommand$4 as R, formatMigrationDiff as Rt, listCommand$2 as S, INITIAL_SCHEMA_NUMBER as St, resumeCommand as T, compareLocalTypesWithSnapshot as Tt, tokenCommand as U, apiCall as Ut, getOAuth2Client as V, trnPrefix as Vt, listCommand$5 as W, apiCommand as Wt, triggerExecutor as X, workspaceArgs as Xt, triggerCommand as Y, withCommonArgs as Yt, listCommand$6 as Z, deleteCommand as _, MIGRATION_LABEL_KEY as _t, removeCommand as a, getCommand$2 as at, createWorkspace as b, DB_TYPES_FILE_NAME as bt, listUsers as c, getWorkflowExecution as ct, restoreCommand as d, formatKeyValueTable as dt, jobsCommand as et, restoreWorkspace as f, getCommand$3 as ft, getWorkspace as g, waitForExecution$1 as gt, getCommand as h, executeScript as ht, updateUser as i, startWorkflow as it, generate as j, getMigrationFilePath as jt, truncate as k, getLatestMigrationNumber as kt, inviteCommand as l, listWorkflowExecutions as lt, listWorkspaces as m, apply as mt, queryCommand as n, watchExecutorJob as nt, removeUser as o, getWorkflow as ot, listCommand$1 as p, getExecutor as pt, listWebhookExecutors as q, deploymentArgs as qt, updateCommand as r, startCommand as rt, listCommand as s, executionsCommand as st, query as t, listExecutorJobs as tt, inviteUser as u, functionExecutionStatusToString as ut, deleteWorkspace as v, parseMigrationLabelNumber as vt, healthCommand as w, SCHEMA_FILE_NAME as wt, listApps as x, DIFF_FILE_NAME as xt, createCommand as y, bundleMigrationScript as yt, listOAuth2Clients as z, hasChanges as zt };
12278
- //# sourceMappingURL=query-CV5n7DRd.mjs.map
12548
+ //# sourceMappingURL=query-D3UyoG68.mjs.map