@tailor-platform/sdk 1.18.0 → 1.19.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.
Files changed (59) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/{application-gWUyKuzv.mjs → application-A6PZjujv.mjs} +81 -64
  3. package/dist/application-A6PZjujv.mjs.map +1 -0
  4. package/dist/application-nPS5veK6.mjs +9 -0
  5. package/dist/cli/index.mjs +8 -6
  6. package/dist/cli/index.mjs.map +1 -1
  7. package/dist/cli/lib.d.mts +12 -6
  8. package/dist/cli/lib.mjs +9 -7
  9. package/dist/cli/lib.mjs.map +1 -1
  10. package/dist/configure/index.d.mts +3 -3
  11. package/dist/configure/index.mjs +1 -1
  12. package/dist/{enum-constants-Cwd4qdpa.mjs → enum-constants-CGVvu3dd.mjs} +1 -1
  13. package/dist/{enum-constants-Cwd4qdpa.mjs.map → enum-constants-CGVvu3dd.mjs.map} +1 -1
  14. package/dist/{file-utils-cqcpFk87.mjs → file-utils-GX_tGWl4.mjs} +1 -1
  15. package/dist/{file-utils-cqcpFk87.mjs.map → file-utils-GX_tGWl4.mjs.map} +1 -1
  16. package/dist/{index-SqWgrTnF.d.mts → index-B6pvy1MK.d.mts} +2 -2
  17. package/dist/{index-sSDpuVQY.d.mts → index-B91ZpOcd.d.mts} +2 -2
  18. package/dist/{index-BKXch-td.d.mts → index-CPzbMghQ.d.mts} +2 -2
  19. package/dist/{index-DP8EB9FK.d.mts → index-ClLZCbcm.d.mts} +9 -3
  20. package/dist/{index-C3Ib7pFc.d.mts → index-DDqKNFh4.d.mts} +2 -2
  21. package/dist/interceptor-D8MeZOxX.mjs +33 -0
  22. package/dist/interceptor-D8MeZOxX.mjs.map +1 -0
  23. package/dist/{jiti-DHlauMCo.mjs → jiti-DfS9jItj.mjs} +1 -1
  24. package/dist/{jiti-DHlauMCo.mjs.map → jiti-DfS9jItj.mjs.map} +1 -1
  25. package/dist/{kysely-type-DtUUoAi3.mjs → kysely-type-Cpq5TNGY.mjs} +2 -1
  26. package/dist/kysely-type-Cpq5TNGY.mjs.map +1 -0
  27. package/dist/package-json-DUY2kB6z.mjs +17 -0
  28. package/dist/package-json-DUY2kB6z.mjs.map +1 -0
  29. package/dist/package-json-Dd1AnA5F.mjs +3 -0
  30. package/dist/plugin/builtin/enum-constants/index.d.mts +2 -2
  31. package/dist/plugin/builtin/enum-constants/index.mjs +1 -1
  32. package/dist/plugin/builtin/file-utils/index.d.mts +2 -2
  33. package/dist/plugin/builtin/file-utils/index.mjs +1 -1
  34. package/dist/plugin/builtin/kysely-type/index.d.mts +2 -2
  35. package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
  36. package/dist/plugin/builtin/seed/index.d.mts +2 -2
  37. package/dist/plugin/builtin/seed/index.mjs +1 -1
  38. package/dist/plugin/index.d.mts +1 -1
  39. package/dist/{schema-WDvc7Zel.mjs → schema-D5Cpd8fQ.mjs} +45 -3
  40. package/dist/schema-D5Cpd8fQ.mjs.map +1 -0
  41. package/dist/{seed-Dm7lrGZ3.mjs → seed-CeUEANfQ.mjs} +1 -1
  42. package/dist/{seed-Dm7lrGZ3.mjs.map → seed-CeUEANfQ.mjs.map} +1 -1
  43. package/dist/{src-i4uqS1G4.mjs → src-Bb1UVstT.mjs} +1 -1
  44. package/dist/{src-i4uqS1G4.mjs.map → src-Bb1UVstT.mjs.map} +1 -1
  45. package/dist/telemetry-9A1BZqbl.mjs +3 -0
  46. package/dist/telemetry-rFq0QdvJ.mjs +84 -0
  47. package/dist/telemetry-rFq0QdvJ.mjs.map +1 -0
  48. package/dist/{types-Bhl_wAM2.d.mts → types-CJF3Y1x8.d.mts} +9 -2
  49. package/dist/{types-DdvTxFiD.d.mts → types-CblXasFV.d.mts} +33 -9
  50. package/dist/types-ClK_HJ0G.mjs.map +1 -1
  51. package/dist/{update-BoNKMti-.mjs → update-Cr5c7h1r.mjs} +221 -151
  52. package/dist/update-Cr5c7h1r.mjs.map +1 -0
  53. package/dist/utils/test/index.d.mts +3 -3
  54. package/package.json +7 -1
  55. package/dist/application-Csj7Ow5Q.mjs +0 -8
  56. package/dist/application-gWUyKuzv.mjs.map +0 -1
  57. package/dist/kysely-type-DtUUoAi3.mjs.map +0 -1
  58. package/dist/schema-WDvc7Zel.mjs.map +0 -1
  59. package/dist/update-BoNKMti-.mjs.map +0 -1
@@ -1,5 +1,7 @@
1
- import { t as db } from "./schema-WDvc7Zel.mjs";
2
- import { $ as UserProfileProviderConfig_UserProfileProviderType, A as TailorDBGQLPermission_Action, B as ExecutorJobStatus, C as platformBaseUrl, D as WorkspacePlatformUserRole, E as readPackageJson, F as TailorDBType_PermitAction, G as AuthOAuth2Client_ClientType, H as ExecutorTriggerType, I as PipelineResolver_OperationType, J as AuthSCIMAttribute_Type, K as AuthOAuth2Client_GrantType, L as IdPLang, M as TailorDBGQLPermission_Permit, N as TailorDBType_Permission_Operator, O as WorkflowExecution_Status, P as TailorDBType_Permission_Permit, Q as TenantProviderConfig_TenantProviderType, R as FunctionExecution_Status, S as initOperatorClient, T as userAgent, U as AuthIDPConfig_AuthType, V as ExecutorTargetType, W as AuthInvokerSchema, X as AuthSCIMConfig_AuthorizationType, Y as AuthSCIMAttribute_Uniqueness, _ as writePlatformConfig, a as buildExecutorArgsExpr, at as ApplicationSchemaUpdateAttemptStatus, c as createExecutorService, ct as styles, et as GetApplicationSchemaHealthResponse_ApplicationSchemaHealthStatus, f as loadAccessToken, g as readPlatformConfig, h as loadWorkspaceId, i as loadConfig, it as PageDirection, j as TailorDBGQLPermission_Operator, k as WorkflowJobExecution_Status, l as OAuth2ClientSchema, lt as symbols, m as loadOrganizationId, n as generatePluginFilesIfNeeded, nt as Condition_Operator, o as buildResolverOperationHookExpr, ot as Subgraph_ServiceType, p as loadFolderId, q as AuthSCIMAttribute_Mutability, r as loadApplication, rt as FilterSchema, s as getDistDir, st as logger, t as defineApplication, tt as ConditionSchema, u as stringifyFunction, v as fetchAll, w as resolveStaticWebsiteUrls, y as fetchMachineUserToken } from "./application-gWUyKuzv.mjs";
1
+ import { t as db } from "./schema-D5Cpd8fQ.mjs";
2
+ import { $ as GetApplicationSchemaHealthResponse_ApplicationSchemaHealthStatus, A as TailorDBGQLPermission_Operator, B as ExecutorTargetType, C as platformBaseUrl, D as WorkflowExecution_Status, E as WorkspacePlatformUserRole, F as PipelineResolver_OperationType, G as AuthOAuth2Client_GrantType, H as AuthIDPConfig_AuthType, I as IdPLang, J as AuthSCIMAttribute_Uniqueness, K as AuthSCIMAttribute_Mutability, L as FunctionExecution_Status, M as TailorDBType_Permission_Operator, N as TailorDBType_Permission_Permit, O as WorkflowJobExecution_Status, P as TailorDBType_PermitAction, Q as UserProfileProviderConfig_UserProfileProviderType, S as initOperatorClient, T as userAgent, U as AuthInvokerSchema, V as ExecutorTriggerType, W as AuthOAuth2Client_ClientType, Y as AuthSCIMConfig_AuthorizationType, Z as TenantProviderConfig_TenantProviderType, _ as writePlatformConfig, a as buildExecutorArgsExpr, at as Subgraph_ServiceType, c as createExecutorService, ct as symbols, et as ConditionSchema, f as loadAccessToken, g as readPlatformConfig, h as loadWorkspaceId, i as loadConfig, it as ApplicationSchemaUpdateAttemptStatus, j as TailorDBGQLPermission_Permit, k as TailorDBGQLPermission_Action, l as OAuth2ClientSchema, m as loadOrganizationId, n as generatePluginFilesIfNeeded, nt as FilterSchema, o as buildResolverOperationHookExpr, ot as logger, p as loadFolderId, q as AuthSCIMAttribute_Type, r as loadApplication, rt as PageDirection, s as getDistDir, st as styles, t as defineApplication, tt as Condition_Operator, u as stringifyFunction, v as fetchAll, w as resolveStaticWebsiteUrls, y as fetchMachineUserToken, z as ExecutorJobStatus } from "./application-A6PZjujv.mjs";
3
+ import { t as readPackageJson } from "./package-json-DUY2kB6z.mjs";
4
+ import { r as withSpan } from "./telemetry-rFq0QdvJ.mjs";
3
5
  import { createRequire } from "node:module";
4
6
  import { arg, defineCommand, runCommand } from "politty";
5
7
  import { z } from "zod";
@@ -159,6 +161,8 @@ const withCommonArgs = (handler) => async (args) => {
159
161
  try {
160
162
  if ("json" in args && typeof args.json === "boolean") logger.jsonMode = args.json;
161
163
  loadEnvFiles(args["env-file"], args["env-file-if-exists"]);
164
+ const { initTelemetry } = await import("./telemetry-9A1BZqbl.mjs");
165
+ await initTelemetry();
162
166
  await handler(args);
163
167
  } catch (error) {
164
168
  if (isCLIError(error)) {
@@ -169,6 +173,9 @@ const withCommonArgs = (handler) => async (args) => {
169
173
  if (args.verbose && error.stack) logger.debug(`\nStack trace:\n${error.stack}`);
170
174
  } else logger.error(`Unknown error: ${error}`);
171
175
  process.exit(1);
176
+ } finally {
177
+ const { shutdownTelemetry } = await import("./telemetry-9A1BZqbl.mjs");
178
+ await shutdownTelemetry();
172
179
  }
173
180
  process.exit(0);
174
181
  };
@@ -1113,9 +1120,11 @@ async function planClients(client, workspaceId, idps, deletedServices) {
1113
1120
  }
1114
1121
  });
1115
1122
  };
1116
- for (const idp of idps) {
1123
+ const clientsByIdp = await Promise.all(idps.map((idp) => fetchClients(idp.name)));
1124
+ for (let i = 0; i < idps.length; i++) {
1125
+ const idp = idps[i];
1117
1126
  const namespaceName = idp.name;
1118
- const existingClients = await fetchClients(namespaceName);
1127
+ const existingClients = clientsByIdp[i];
1119
1128
  const existingNameMap = /* @__PURE__ */ new Map();
1120
1129
  existingClients.forEach((client$1) => {
1121
1130
  existingNameMap.set(client$1.name, client$1.clientSecret);
@@ -1147,16 +1156,20 @@ async function planClients(client, workspaceId, idps, deletedServices) {
1147
1156
  });
1148
1157
  });
1149
1158
  }
1150
- for (const namespaceName of deletedServices) (await fetchClients(namespaceName)).forEach((client$1) => {
1151
- changeSet.deletes.push({
1152
- name: client$1.name,
1153
- request: {
1154
- workspaceId,
1155
- namespaceName,
1156
- name: client$1.name
1157
- }
1159
+ const deletedClientsByService = await Promise.all(deletedServices.map((namespaceName) => fetchClients(namespaceName)));
1160
+ for (let i = 0; i < deletedServices.length; i++) {
1161
+ const namespaceName = deletedServices[i];
1162
+ deletedClientsByService[i].forEach((client$1) => {
1163
+ changeSet.deletes.push({
1164
+ name: client$1.name,
1165
+ request: {
1166
+ workspaceId,
1167
+ namespaceName,
1168
+ name: client$1.name
1169
+ }
1170
+ });
1158
1171
  });
1159
- });
1172
+ }
1160
1173
  return changeSet;
1161
1174
  }
1162
1175
  function convertLang(lang) {
@@ -1234,13 +1247,15 @@ async function planAuth(context) {
1234
1247
  }
1235
1248
  const { changeSet: serviceChangeSet, conflicts, unmanaged, resourceOwners } = await planServices$2(client, workspaceId, application.name, auths);
1236
1249
  const deletedServices = serviceChangeSet.deletes.map((del) => del.name);
1237
- const idpConfigChangeSet = await planIdPConfigs(client, workspaceId, auths, deletedServices);
1238
- const userProfileConfigChangeSet = await planUserProfileConfigs(client, workspaceId, auths, deletedServices);
1239
- const tenantConfigChangeSet = await planTenantConfigs(client, workspaceId, auths, deletedServices);
1240
- const machineUserChangeSet = await planMachineUsers(client, workspaceId, auths, deletedServices);
1241
- const oauth2ClientChangeSet = await planOAuth2Clients(client, workspaceId, auths, deletedServices);
1242
- const scimChangeSet = await planSCIMConfigs(client, workspaceId, auths, deletedServices);
1243
- const scimResourceChangeSet = await planSCIMResources(client, workspaceId, auths, deletedServices);
1250
+ const [idpConfigChangeSet, userProfileConfigChangeSet, tenantConfigChangeSet, machineUserChangeSet, oauth2ClientChangeSet, scimChangeSet, scimResourceChangeSet] = await Promise.all([
1251
+ planIdPConfigs(client, workspaceId, auths, deletedServices),
1252
+ planUserProfileConfigs(client, workspaceId, auths, deletedServices),
1253
+ planTenantConfigs(client, workspaceId, auths, deletedServices),
1254
+ planMachineUsers(client, workspaceId, auths, deletedServices),
1255
+ planOAuth2Clients(client, workspaceId, auths, deletedServices),
1256
+ planSCIMConfigs(client, workspaceId, auths, deletedServices),
1257
+ planSCIMResources(client, workspaceId, auths, deletedServices)
1258
+ ]);
1244
1259
  serviceChangeSet.print();
1245
1260
  idpConfigChangeSet.print();
1246
1261
  userProfileConfigChangeSet.print();
@@ -2661,6 +2676,10 @@ const SCALAR_TYPE_MAP = {
2661
2676
  kind: "ScalarType",
2662
2677
  name: "Float"
2663
2678
  },
2679
+ decimal: {
2680
+ kind: "CustomScalarType",
2681
+ name: "Decimal"
2682
+ },
2664
2683
  boolean: {
2665
2684
  kind: "ScalarType",
2666
2685
  name: "Boolean"
@@ -3345,6 +3364,7 @@ function createSnapshotFieldConfig(field) {
3345
3364
  ...field.config.serial.maxValue !== void 0 && { maxValue: field.config.serial.maxValue },
3346
3365
  ...field.config.serial.format && { format: field.config.serial.format }
3347
3366
  };
3367
+ if (field.config.scale !== void 0) config.scale = field.config.scale;
3348
3368
  if (field.config.fields && Object.keys(field.config.fields).length > 0) {
3349
3369
  config.fields = {};
3350
3370
  for (const [nestedName, nestedConfig] of Object.entries(field.config.fields)) config.fields[nestedName] = createSnapshotFieldConfigFromOperatorConfig(nestedConfig);
@@ -3389,6 +3409,7 @@ function createSnapshotFieldConfigFromOperatorConfig(fieldConfig) {
3389
3409
  ...fieldConfig.serial.maxValue !== void 0 && { maxValue: fieldConfig.serial.maxValue },
3390
3410
  ...fieldConfig.serial.format && { format: fieldConfig.serial.format }
3391
3411
  };
3412
+ if (fieldConfig.scale !== void 0) config.scale = fieldConfig.scale;
3392
3413
  if (fieldConfig.fields && Object.keys(fieldConfig.fields).length > 0) {
3393
3414
  config.fields = {};
3394
3415
  for (const [nestedName, nestedConfig] of Object.entries(fieldConfig.fields)) config.fields[nestedName] = createSnapshotFieldConfigFromOperatorConfig(nestedConfig);
@@ -3775,6 +3796,7 @@ function areFieldsDifferent(oldField, newField) {
3775
3796
  if (oldSerial.maxValue !== newSerial.maxValue) return true;
3776
3797
  if ((oldSerial.format ?? "") !== (newSerial.format ?? "")) return true;
3777
3798
  }
3799
+ if (oldField.scale !== newField.scale) return true;
3778
3800
  const oldFields = oldField.fields ?? {};
3779
3801
  const newFields = newField.fields ?? {};
3780
3802
  const oldFieldNames = Object.keys(oldFields);
@@ -4197,6 +4219,7 @@ function convertRemoteFieldsToSnapshot(remoteType) {
4197
4219
  ...remoteField.serial.maxValue && { maxValue: Number(remoteField.serial.maxValue) },
4198
4220
  ...remoteField.serial.format && { format: remoteField.serial.format }
4199
4221
  };
4222
+ if (remoteField.scale !== void 0) config.scale = remoteField.scale;
4200
4223
  fields[fieldName] = config;
4201
4224
  }
4202
4225
  return fields;
@@ -4241,6 +4264,7 @@ function compareFields(typeName, fieldName, remoteField, snapshotField) {
4241
4264
  const remoteVector = remoteField.vector ?? false;
4242
4265
  const snapshotVector = snapshotField.vector ?? false;
4243
4266
  if (remoteVector !== snapshotVector) differences.push(`vector: remote=${remoteVector}, expected=${snapshotVector}`);
4267
+ if (remoteField.scale !== snapshotField.scale) differences.push(`scale: remote=${remoteField.scale}, expected=${snapshotField.scale}`);
4244
4268
  if (differences.length > 0) return {
4245
4269
  typeName,
4246
4270
  kind: "field_mismatch",
@@ -5160,8 +5184,7 @@ async function planTailorDB(context) {
5160
5184
  const executors = forRemoval ? [] : Object.values(await application.executorService?.loadExecutors() ?? {});
5161
5185
  const { changeSet: serviceChangeSet, conflicts, unmanaged, resourceOwners } = await planServices(client, workspaceId, application.name, tailordbs);
5162
5186
  const deletedServices = serviceChangeSet.deletes.map((del) => del.name);
5163
- const typeChangeSet = await planTypes(client, workspaceId, tailordbs, executors, deletedServices);
5164
- const gqlPermissionChangeSet = await planGqlPermissions(client, workspaceId, tailordbs, deletedServices);
5187
+ const [typeChangeSet, gqlPermissionChangeSet] = await Promise.all([planTypes(client, workspaceId, tailordbs, executors, deletedServices), planGqlPermissions(client, workspaceId, tailordbs, deletedServices)]);
5165
5188
  serviceChangeSet.print();
5166
5189
  typeChangeSet.print();
5167
5190
  gqlPermissionChangeSet.print();
@@ -5376,7 +5399,8 @@ function generateTailorDBTypeManifest(type, executorUsedTypes, namespaceGqlOpera
5376
5399
  start: fieldConfig.serial.start,
5377
5400
  ...fieldConfig.serial.maxValue && { maxValue: fieldConfig.serial.maxValue },
5378
5401
  ...fieldConfig.serial.format && { format: fieldConfig.serial.format }
5379
- } }
5402
+ } },
5403
+ ...fieldConfig.scale !== void 0 && { scale: fieldConfig.scale }
5380
5404
  };
5381
5405
  if (fieldConfig.type === "nested" && fieldConfig.fields) fieldEntry.fields = processNestedFields(fieldConfig.fields);
5382
5406
  fields[fieldName] = fieldEntry;
@@ -5460,7 +5484,8 @@ function processNestedFields(fields) {
5460
5484
  foreignKey: false,
5461
5485
  vector: false,
5462
5486
  ...toProtoFieldHooks(nestedFieldConfig),
5463
- fields: deepNestedFields
5487
+ fields: deepNestedFields,
5488
+ ...nestedFieldConfig.scale !== void 0 && { scale: nestedFieldConfig.scale }
5464
5489
  };
5465
5490
  } else nestedFields[nestedFieldName] = {
5466
5491
  type: nestedType,
@@ -5478,7 +5503,8 @@ function processNestedFields(fields) {
5478
5503
  start: nestedFieldConfig.serial.start,
5479
5504
  ...nestedFieldConfig.serial.maxValue && { maxValue: nestedFieldConfig.serial.maxValue },
5480
5505
  ...nestedFieldConfig.serial.format && { format: nestedFieldConfig.serial.format }
5481
- } }
5506
+ } },
5507
+ ...nestedFieldConfig.scale !== void 0 && { scale: nestedFieldConfig.scale }
5482
5508
  };
5483
5509
  });
5484
5510
  return nestedFields;
@@ -5982,131 +6008,174 @@ async function planWorkflow(client, workspaceId, appName, workflows, mainJobDeps
5982
6008
  * @returns Promise that resolves when apply completes
5983
6009
  */
5984
6010
  async function apply(options) {
5985
- const { config, plugins } = await loadConfig(options?.configPath);
5986
- const dryRun = options?.dryRun ?? false;
5987
- const yes = options?.yes ?? false;
5988
- const buildOnly = options?.buildOnly ?? process.env.TAILOR_PLATFORM_SDK_BUILD_ONLY === "true";
5989
- let pluginManager;
5990
- if (plugins.length > 0) pluginManager = new PluginManager(plugins);
5991
- await generateUserTypes({
5992
- config,
5993
- configPath: config.path
5994
- });
5995
- const { application, workflowBuildResult } = await loadApplication({
5996
- config,
5997
- pluginManager
5998
- });
5999
- if (buildOnly) return;
6000
- const client = await initOperatorClient(await loadAccessToken({
6001
- useProfile: true,
6002
- profile: options?.profile
6003
- }));
6004
- const workspaceId = loadWorkspaceId({
6005
- workspaceId: options?.workspaceId,
6006
- profile: options?.profile
6007
- });
6008
- const workflowService = application.workflowService;
6009
- const functionEntries = collectFunctionEntries(application, workflowService?.jobs ?? []);
6010
- const ctx = {
6011
- client,
6012
- workspaceId,
6013
- application,
6014
- forRemoval: false,
6015
- config,
6016
- noSchemaCheck: options?.noSchemaCheck
6017
- };
6018
- const functionRegistry = await planFunctionRegistry(client, workspaceId, application.name, functionEntries);
6019
- const tailorDB = await planTailorDB(ctx);
6020
- const staticWebsite = await planStaticWebsite(ctx);
6021
- const idp = await planIdP(ctx);
6022
- const auth = await planAuth(ctx);
6023
- const pipeline = await planPipeline(ctx);
6024
- const app = await planApplication(ctx);
6025
- const executor = await planExecutor(ctx);
6026
- const workflow = await planWorkflow(client, workspaceId, application.name, workflowService?.workflows ?? {}, workflowBuildResult?.mainJobDeps ?? {});
6027
- const allConflicts = [
6028
- ...functionRegistry.conflicts,
6029
- ...tailorDB.conflicts,
6030
- ...staticWebsite.conflicts,
6031
- ...idp.conflicts,
6032
- ...auth.conflicts,
6033
- ...pipeline.conflicts,
6034
- ...executor.conflicts,
6035
- ...workflow.conflicts
6036
- ];
6037
- await confirmOwnerConflict(allConflicts, application.name, yes);
6038
- await confirmUnmanagedResources([
6039
- ...functionRegistry.unmanaged,
6040
- ...tailorDB.unmanaged,
6041
- ...staticWebsite.unmanaged,
6042
- ...idp.unmanaged,
6043
- ...auth.unmanaged,
6044
- ...pipeline.unmanaged,
6045
- ...executor.unmanaged,
6046
- ...workflow.unmanaged
6047
- ], application.name, yes);
6048
- const importantDeletions = [];
6049
- for (const del of tailorDB.changeSet.type.deletes) importantDeletions.push({
6050
- resourceType: "TailorDB type",
6051
- resourceName: del.name
6052
- });
6053
- for (const del of staticWebsite.changeSet.deletes) importantDeletions.push({
6054
- resourceType: "StaticWebsite",
6055
- resourceName: del.name
6056
- });
6057
- for (const del of auth.changeSet.oauth2Client.deletes) importantDeletions.push({
6058
- resourceType: "OAuth2 client",
6059
- resourceName: del.name
6060
- });
6061
- for (const replace of auth.changeSet.oauth2Client.replaces) importantDeletions.push({
6062
- resourceType: "OAuth2 client (client type change)",
6063
- resourceName: replace.name
6064
- });
6065
- await confirmImportantResourceDeletion(importantDeletions, yes);
6066
- const resourceOwners = new Set([
6067
- ...functionRegistry.resourceOwners,
6068
- ...tailorDB.resourceOwners,
6069
- ...staticWebsite.resourceOwners,
6070
- ...idp.resourceOwners,
6071
- ...auth.resourceOwners,
6072
- ...pipeline.resourceOwners,
6073
- ...executor.resourceOwners,
6074
- ...workflow.resourceOwners
6075
- ]);
6076
- const emptyApps = [...new Set(allConflicts.map((c) => c.currentOwner))].filter((owner) => !resourceOwners.has(owner));
6077
- for (const emptyApp of emptyApps) app.deletes.push({
6078
- name: emptyApp,
6079
- request: {
6080
- workspaceId,
6081
- applicationName: emptyApp
6011
+ return withSpan("apply", async (rootSpan) => {
6012
+ rootSpan.setAttribute("apply.dry_run", options?.dryRun ?? false);
6013
+ const { config, application, workflowBuildResult, buildOnly } = await withSpan("build", async () => {
6014
+ const { config: config$1, plugins } = await withSpan("build.loadConfig", () => loadConfig(options?.configPath));
6015
+ const dryRun$1 = options?.dryRun ?? false;
6016
+ const buildOnly$1 = options?.buildOnly ?? process.env.TAILOR_PLATFORM_SDK_BUILD_ONLY === "true";
6017
+ let pluginManager;
6018
+ if (plugins.length > 0) pluginManager = new PluginManager(plugins);
6019
+ await withSpan("build.generateUserTypes", () => generateUserTypes({
6020
+ config: config$1,
6021
+ configPath: config$1.path
6022
+ }));
6023
+ const { application: application$1, workflowBuildResult: workflowBuildResult$1 } = await withSpan("build.loadApplication", () => loadApplication({
6024
+ config: config$1,
6025
+ pluginManager
6026
+ }));
6027
+ return {
6028
+ config: config$1,
6029
+ plugins,
6030
+ application: application$1,
6031
+ workflowBuildResult: workflowBuildResult$1,
6032
+ dryRun: dryRun$1,
6033
+ buildOnly: buildOnly$1
6034
+ };
6035
+ });
6036
+ if (buildOnly) return;
6037
+ const client = await initOperatorClient(await loadAccessToken({
6038
+ useProfile: true,
6039
+ profile: options?.profile
6040
+ }));
6041
+ const workspaceId = loadWorkspaceId({
6042
+ workspaceId: options?.workspaceId,
6043
+ profile: options?.profile
6044
+ });
6045
+ rootSpan.setAttribute("app.name", application.name);
6046
+ rootSpan.setAttribute("workspace.id", workspaceId);
6047
+ const workflowService = application.workflowService;
6048
+ const functionEntries = collectFunctionEntries(application, workflowService?.jobs ?? []);
6049
+ const dryRun = options?.dryRun ?? false;
6050
+ const yes = options?.yes ?? false;
6051
+ const { functionRegistry, tailorDB, staticWebsite, idp, auth, pipeline, app, executor, workflow } = await withSpan("plan", async () => {
6052
+ const ctx = {
6053
+ client,
6054
+ workspaceId,
6055
+ application,
6056
+ forRemoval: false,
6057
+ config,
6058
+ noSchemaCheck: options?.noSchemaCheck
6059
+ };
6060
+ const [functionRegistry$1, tailorDB$1, staticWebsite$1, idp$1, auth$1, pipeline$1, app$1, executor$1, workflow$1] = await Promise.all([
6061
+ withSpan("plan.functionRegistry", () => planFunctionRegistry(client, workspaceId, application.name, functionEntries)),
6062
+ withSpan("plan.tailorDB", () => planTailorDB(ctx)),
6063
+ withSpan("plan.staticWebsite", () => planStaticWebsite(ctx)),
6064
+ withSpan("plan.idp", () => planIdP(ctx)),
6065
+ withSpan("plan.auth", () => planAuth(ctx)),
6066
+ withSpan("plan.pipeline", () => planPipeline(ctx)),
6067
+ withSpan("plan.application", () => planApplication(ctx)),
6068
+ withSpan("plan.executor", () => planExecutor(ctx)),
6069
+ withSpan("plan.workflow", () => planWorkflow(client, workspaceId, application.name, workflowService?.workflows ?? {}, workflowBuildResult?.mainJobDeps ?? {}))
6070
+ ]);
6071
+ return {
6072
+ functionRegistry: functionRegistry$1,
6073
+ tailorDB: tailorDB$1,
6074
+ staticWebsite: staticWebsite$1,
6075
+ idp: idp$1,
6076
+ auth: auth$1,
6077
+ pipeline: pipeline$1,
6078
+ app: app$1,
6079
+ executor: executor$1,
6080
+ workflow: workflow$1
6081
+ };
6082
+ });
6083
+ await withSpan("confirm", async () => {
6084
+ const allConflicts = [
6085
+ ...functionRegistry.conflicts,
6086
+ ...tailorDB.conflicts,
6087
+ ...staticWebsite.conflicts,
6088
+ ...idp.conflicts,
6089
+ ...auth.conflicts,
6090
+ ...pipeline.conflicts,
6091
+ ...executor.conflicts,
6092
+ ...workflow.conflicts
6093
+ ];
6094
+ await confirmOwnerConflict(allConflicts, application.name, yes);
6095
+ await confirmUnmanagedResources([
6096
+ ...functionRegistry.unmanaged,
6097
+ ...tailorDB.unmanaged,
6098
+ ...staticWebsite.unmanaged,
6099
+ ...idp.unmanaged,
6100
+ ...auth.unmanaged,
6101
+ ...pipeline.unmanaged,
6102
+ ...executor.unmanaged,
6103
+ ...workflow.unmanaged
6104
+ ], application.name, yes);
6105
+ const importantDeletions = [];
6106
+ for (const del of tailorDB.changeSet.type.deletes) importantDeletions.push({
6107
+ resourceType: "TailorDB type",
6108
+ resourceName: del.name
6109
+ });
6110
+ for (const del of staticWebsite.changeSet.deletes) importantDeletions.push({
6111
+ resourceType: "StaticWebsite",
6112
+ resourceName: del.name
6113
+ });
6114
+ for (const del of auth.changeSet.oauth2Client.deletes) importantDeletions.push({
6115
+ resourceType: "OAuth2 client",
6116
+ resourceName: del.name
6117
+ });
6118
+ for (const replace of auth.changeSet.oauth2Client.replaces) importantDeletions.push({
6119
+ resourceType: "OAuth2 client (client type change)",
6120
+ resourceName: replace.name
6121
+ });
6122
+ await confirmImportantResourceDeletion(importantDeletions, yes);
6123
+ const resourceOwners = new Set([
6124
+ ...functionRegistry.resourceOwners,
6125
+ ...tailorDB.resourceOwners,
6126
+ ...staticWebsite.resourceOwners,
6127
+ ...idp.resourceOwners,
6128
+ ...auth.resourceOwners,
6129
+ ...pipeline.resourceOwners,
6130
+ ...executor.resourceOwners,
6131
+ ...workflow.resourceOwners
6132
+ ]);
6133
+ const emptyApps = [...new Set(allConflicts.map((c) => c.currentOwner))].filter((owner) => !resourceOwners.has(owner));
6134
+ for (const emptyApp of emptyApps) app.deletes.push({
6135
+ name: emptyApp,
6136
+ request: {
6137
+ workspaceId,
6138
+ applicationName: emptyApp
6139
+ }
6140
+ });
6141
+ });
6142
+ if (dryRun) {
6143
+ logger.info("Dry run enabled. No changes applied.");
6144
+ return;
6082
6145
  }
6146
+ await withSpan("apply.createUpdateServices", async () => {
6147
+ await applyFunctionRegistry(client, workspaceId, functionRegistry, "create-update");
6148
+ await applyStaticWebsite(client, staticWebsite, "create-update");
6149
+ await applyIdP(client, idp, "create-update");
6150
+ await applyAuth(client, auth, "create-update");
6151
+ await applyTailorDB(client, tailorDB, "create-update");
6152
+ await applyPipeline(client, pipeline, "create-update");
6153
+ });
6154
+ await withSpan("apply.deleteSubgraphResources", async () => {
6155
+ await applyPipeline(client, pipeline, "delete-resources");
6156
+ await applyAuth(client, auth, "delete-resources");
6157
+ await applyIdP(client, idp, "delete-resources");
6158
+ });
6159
+ await withSpan("apply.createUpdateApplication", () => applyApplication(client, app, "create-update"));
6160
+ await withSpan("apply.createUpdateDependentServices", async () => {
6161
+ await applyExecutor(client, executor, "create-update");
6162
+ await applyWorkflow(client, workflow, "create-update");
6163
+ });
6164
+ await withSpan("apply.deleteDependentServices", async () => {
6165
+ await applyWorkflow(client, workflow, "delete");
6166
+ await applyExecutor(client, executor, "delete");
6167
+ await applyStaticWebsite(client, staticWebsite, "delete");
6168
+ });
6169
+ await withSpan("apply.deleteApplication", () => applyApplication(client, app, "delete"));
6170
+ await withSpan("apply.deleteSubgraphServices", async () => {
6171
+ await applyPipeline(client, pipeline, "delete-services");
6172
+ await applyAuth(client, auth, "delete-services");
6173
+ await applyIdP(client, idp, "delete-services");
6174
+ await applyTailorDB(client, tailorDB, "delete-services");
6175
+ });
6176
+ await withSpan("apply.cleanup", () => applyFunctionRegistry(client, workspaceId, functionRegistry, "delete"));
6177
+ logger.success("Successfully applied changes.");
6083
6178
  });
6084
- if (dryRun) {
6085
- logger.info("Dry run enabled. No changes applied.");
6086
- return;
6087
- }
6088
- await applyFunctionRegistry(client, workspaceId, functionRegistry, "create-update");
6089
- await applyStaticWebsite(client, staticWebsite, "create-update");
6090
- await applyIdP(client, idp, "create-update");
6091
- await applyAuth(client, auth, "create-update");
6092
- await applyTailorDB(client, tailorDB, "create-update");
6093
- await applyPipeline(client, pipeline, "create-update");
6094
- await applyPipeline(client, pipeline, "delete-resources");
6095
- await applyAuth(client, auth, "delete-resources");
6096
- await applyIdP(client, idp, "delete-resources");
6097
- await applyApplication(client, app, "create-update");
6098
- await applyExecutor(client, executor, "create-update");
6099
- await applyWorkflow(client, workflow, "create-update");
6100
- await applyWorkflow(client, workflow, "delete");
6101
- await applyExecutor(client, executor, "delete");
6102
- await applyStaticWebsite(client, staticWebsite, "delete");
6103
- await applyApplication(client, app, "delete");
6104
- await applyPipeline(client, pipeline, "delete-services");
6105
- await applyAuth(client, auth, "delete-services");
6106
- await applyIdP(client, idp, "delete-services");
6107
- await applyTailorDB(client, tailorDB, "delete-services");
6108
- await applyFunctionRegistry(client, workspaceId, functionRegistry, "delete");
6109
- logger.success("Successfully applied changes.");
6110
6179
  }
6111
6180
  const applyCommand = defineCommand({
6112
6181
  name: "apply",
@@ -9303,7 +9372,8 @@ function generateTableType(type, breakingChangeFields) {
9303
9372
  function mapToTsType(fieldType) {
9304
9373
  switch (fieldType) {
9305
9374
  case "uuid":
9306
- case "string": return {
9375
+ case "string":
9376
+ case "decimal": return {
9307
9377
  type: "string",
9308
9378
  usedTimestamp: false
9309
9379
  };
@@ -9658,7 +9728,7 @@ async function generate(options) {
9658
9728
  if (options.init) await handleInitOption(namespacesWithMigrations, options.yes);
9659
9729
  let pluginManager;
9660
9730
  if (plugins.length > 0) pluginManager = new PluginManager(plugins);
9661
- const { defineApplication: defineApplication$1 } = await import("./application-Csj7Ow5Q.mjs");
9731
+ const { defineApplication: defineApplication$1 } = await import("./application-nPS5veK6.mjs");
9662
9732
  const application = defineApplication$1({
9663
9733
  config,
9664
9734
  pluginManager
@@ -10871,4 +10941,4 @@ const updateCommand = defineCommand({
10871
10941
 
10872
10942
  //#endregion
10873
10943
  export { jobsCommand as $, generateCommand as A, getMigrationDirPath as At, getMachineUserToken as B, getNamespacesWithMigrations as Bt, resumeCommand as C, MIGRATE_FILE_NAME as Ct, truncate as D, createSnapshotFromLocalTypes as Dt, listWorkflows as E, compareSnapshots as Et, removeCommand$1 as F, loadDiff as Ft, generateCommand$1 as G, commonArgs as Gt, listCommand$5 as H, generateUserTypes as Ht, listCommand$4 as I, reconstructSnapshotFromMigrations as It, triggerCommand as J, jsonArgs as Jt, listWebhookExecutors as K, confirmationArgs as Kt, listOAuth2Clients as L, formatDiffSummary as Lt, show as M, getMigrationFiles as Mt, showCommand as N, getNextMigrationNumber as Nt, truncateCommand as O, formatMigrationNumber as Ot, remove as P, isValidMigrationNumber as Pt, getExecutorJob as Q, getCommand$1 as R, formatMigrationDiff as Rt, healthCommand as S, INITIAL_SCHEMA_NUMBER as St, listCommand$3 as T, compareLocalTypesWithSnapshot as Tt, listMachineUsers as U, apiCall as Ut, tokenCommand as V, trnPrefix as Vt, generate$1 as W, apiCommand as Wt, listCommand$6 as X, workspaceArgs as Xt, triggerExecutor as Y, withCommonArgs as Yt, listExecutors as Z, createCommand as _, MIGRATION_LABEL_KEY as _t, listCommand as a, getWorkflow as at, listCommand$2 as b, DB_TYPES_FILE_NAME as bt, inviteUser as c, listWorkflowExecutions as ct, listCommand$1 as d, getCommand$3 as dt, listExecutorJobs as et, listWorkspaces as f, getExecutor as ft, deleteWorkspace as g, waitForExecution$1 as gt, deleteCommand as h, executeScript as ht, removeUser as i, getCommand$2 as it, logBetaWarning as j, getMigrationFilePath as jt, generate as k, getLatestMigrationNumber as kt, restoreCommand as l, functionExecutionStatusToString as lt, getWorkspace as m, applyCommand as mt, updateUser as n, startCommand as nt, listUsers as o, executionsCommand as ot, getCommand as p, apply as pt, webhookCommand as q, deploymentArgs as qt, removeCommand as r, startWorkflow as rt, inviteCommand as s, getWorkflowExecution as st, updateCommand as t, watchExecutorJob as tt, restoreWorkspace as u, formatKeyValueTable as ut, createWorkspace as v, parseMigrationLabelNumber as vt, resumeWorkflow as w, SCHEMA_FILE_NAME as wt, getAppHealth as x, DIFF_FILE_NAME as xt, listApps as y, bundleMigrationScript as yt, getOAuth2Client as z, hasChanges as zt };
10874
- //# sourceMappingURL=update-BoNKMti-.mjs.map
10944
+ //# sourceMappingURL=update-Cr5c7h1r.mjs.map