@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.
- package/CHANGELOG.md +21 -0
- package/dist/{application-gWUyKuzv.mjs → application-A6PZjujv.mjs} +81 -64
- package/dist/application-A6PZjujv.mjs.map +1 -0
- package/dist/application-nPS5veK6.mjs +9 -0
- package/dist/cli/index.mjs +8 -6
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +12 -6
- package/dist/cli/lib.mjs +9 -7
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/configure/index.d.mts +3 -3
- package/dist/configure/index.mjs +1 -1
- package/dist/{enum-constants-Cwd4qdpa.mjs → enum-constants-CGVvu3dd.mjs} +1 -1
- package/dist/{enum-constants-Cwd4qdpa.mjs.map → enum-constants-CGVvu3dd.mjs.map} +1 -1
- package/dist/{file-utils-cqcpFk87.mjs → file-utils-GX_tGWl4.mjs} +1 -1
- package/dist/{file-utils-cqcpFk87.mjs.map → file-utils-GX_tGWl4.mjs.map} +1 -1
- package/dist/{index-SqWgrTnF.d.mts → index-B6pvy1MK.d.mts} +2 -2
- package/dist/{index-sSDpuVQY.d.mts → index-B91ZpOcd.d.mts} +2 -2
- package/dist/{index-BKXch-td.d.mts → index-CPzbMghQ.d.mts} +2 -2
- package/dist/{index-DP8EB9FK.d.mts → index-ClLZCbcm.d.mts} +9 -3
- package/dist/{index-C3Ib7pFc.d.mts → index-DDqKNFh4.d.mts} +2 -2
- package/dist/interceptor-D8MeZOxX.mjs +33 -0
- package/dist/interceptor-D8MeZOxX.mjs.map +1 -0
- package/dist/{jiti-DHlauMCo.mjs → jiti-DfS9jItj.mjs} +1 -1
- package/dist/{jiti-DHlauMCo.mjs.map → jiti-DfS9jItj.mjs.map} +1 -1
- package/dist/{kysely-type-DtUUoAi3.mjs → kysely-type-Cpq5TNGY.mjs} +2 -1
- package/dist/kysely-type-Cpq5TNGY.mjs.map +1 -0
- package/dist/package-json-DUY2kB6z.mjs +17 -0
- package/dist/package-json-DUY2kB6z.mjs.map +1 -0
- package/dist/package-json-Dd1AnA5F.mjs +3 -0
- package/dist/plugin/builtin/enum-constants/index.d.mts +2 -2
- package/dist/plugin/builtin/enum-constants/index.mjs +1 -1
- package/dist/plugin/builtin/file-utils/index.d.mts +2 -2
- package/dist/plugin/builtin/file-utils/index.mjs +1 -1
- package/dist/plugin/builtin/kysely-type/index.d.mts +2 -2
- package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
- package/dist/plugin/builtin/seed/index.d.mts +2 -2
- package/dist/plugin/builtin/seed/index.mjs +1 -1
- package/dist/plugin/index.d.mts +1 -1
- package/dist/{schema-WDvc7Zel.mjs → schema-D5Cpd8fQ.mjs} +45 -3
- package/dist/schema-D5Cpd8fQ.mjs.map +1 -0
- package/dist/{seed-Dm7lrGZ3.mjs → seed-CeUEANfQ.mjs} +1 -1
- package/dist/{seed-Dm7lrGZ3.mjs.map → seed-CeUEANfQ.mjs.map} +1 -1
- package/dist/{src-i4uqS1G4.mjs → src-Bb1UVstT.mjs} +1 -1
- package/dist/{src-i4uqS1G4.mjs.map → src-Bb1UVstT.mjs.map} +1 -1
- package/dist/telemetry-9A1BZqbl.mjs +3 -0
- package/dist/telemetry-rFq0QdvJ.mjs +84 -0
- package/dist/telemetry-rFq0QdvJ.mjs.map +1 -0
- package/dist/{types-Bhl_wAM2.d.mts → types-CJF3Y1x8.d.mts} +9 -2
- package/dist/{types-DdvTxFiD.d.mts → types-CblXasFV.d.mts} +33 -9
- package/dist/types-ClK_HJ0G.mjs.map +1 -1
- package/dist/{update-BoNKMti-.mjs → update-Cr5c7h1r.mjs} +221 -151
- package/dist/update-Cr5c7h1r.mjs.map +1 -0
- package/dist/utils/test/index.d.mts +3 -3
- package/package.json +7 -1
- package/dist/application-Csj7Ow5Q.mjs +0 -8
- package/dist/application-gWUyKuzv.mjs.map +0 -1
- package/dist/kysely-type-DtUUoAi3.mjs.map +0 -1
- package/dist/schema-WDvc7Zel.mjs.map +0 -1
- package/dist/update-BoNKMti-.mjs.map +0 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { t as db } from "./schema-
|
|
2
|
-
import { $ as
|
|
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
|
-
|
|
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 =
|
|
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
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
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
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
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
|
-
|
|
5986
|
-
|
|
5987
|
-
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
|
|
5991
|
-
|
|
5992
|
-
|
|
5993
|
-
|
|
5994
|
-
|
|
5995
|
-
|
|
5996
|
-
|
|
5997
|
-
|
|
5998
|
-
|
|
5999
|
-
|
|
6000
|
-
|
|
6001
|
-
|
|
6002
|
-
|
|
6003
|
-
|
|
6004
|
-
|
|
6005
|
-
|
|
6006
|
-
|
|
6007
|
-
|
|
6008
|
-
|
|
6009
|
-
|
|
6010
|
-
|
|
6011
|
-
client
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
|
|
6015
|
-
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
|
|
6019
|
-
|
|
6020
|
-
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
|
|
6035
|
-
|
|
6036
|
-
|
|
6037
|
-
|
|
6038
|
-
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
|
|
6048
|
-
|
|
6049
|
-
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
|
|
6069
|
-
|
|
6070
|
-
|
|
6071
|
-
|
|
6072
|
-
|
|
6073
|
-
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
|
|
6077
|
-
|
|
6078
|
-
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
|
|
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":
|
|
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-
|
|
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-
|
|
10944
|
+
//# sourceMappingURL=update-Cr5c7h1r.mjs.map
|