@botpress/adk 1.7.16 → 1.7.18
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/dist/generators/tests.d.ts.map +1 -1
- package/dist/index.js +297 -20
- package/dist/index.js.map +4 -4
- package/dist/tables/index.d.ts +1 -1
- package/dist/tables/index.d.ts.map +1 -1
- package/dist/tables/{manager.d.ts → table-manager.d.ts} +8 -2
- package/dist/tables/table-manager.d.ts.map +1 -0
- package/dist/tables/types.d.ts +13 -0
- package/dist/tables/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/tables/manager.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tests.d.ts","sourceRoot":"","sources":["../../src/generators/tests.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,oBAAoB,GAAI,aAAa,MAAM,EAAE,SAAS,MAAM,oDAiBrE,CAAA;AAEJ,eAAO,MAAM,kBAAkB,GAAI,KAAK,MAAM,EAAE,SAAS,MAAM;;;;;;;;
|
|
1
|
+
{"version":3,"file":"tests.d.ts","sourceRoot":"","sources":["../../src/generators/tests.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,oBAAoB,GAAI,aAAa,MAAM,EAAE,SAAS,MAAM,oDAiBrE,CAAA;AAEJ,eAAO,MAAM,kBAAkB,GAAI,KAAK,MAAM,EAAE,SAAS,MAAM;;;;;;;;iBAkB+jk6B,CAAC;uBAA0H,CAAC;;;;;;;;iBAAuU,CAAC;uBAAyH,CAAC;;;;sBAAsM,CAAC;;;;;;;iBAA6S,CAAC;uBAA0H,CAAC;oBAAkC,CAAC;qBAAoC,CAAC;;;;;;;;;;;sBAA2Y,CAAC;;;;;;;iBAA8O,CAAC;uBAA2H,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAA35/M,CAAC;uBAA0H,CAAC;;;;;;;;iBAAuU,CAAC;uBAAyH,CAAC;;;;sBAAsM,CAAC;;;;;;;iBAA6S,CAAC;uBAA0H,CAAC;oBAAkC,CAAC;qBAAoC,CAAC;;;;;;;;;;;sBAA2Y,CAAC;;;;;;;iBAA8O,CAAC;uBAA2H,CAAC;;;;;;;;;;;;;;;;;;;;;;EADzrstB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -654,7 +654,7 @@ var PRETTIER_CONFIG, formatCode = async (code, filepath) => {
|
|
|
654
654
|
`));
|
|
655
655
|
return code;
|
|
656
656
|
}
|
|
657
|
-
}, ADK_VERSION = "1.7.
|
|
657
|
+
}, ADK_VERSION = "1.7.18", relative2 = (from, to) => {
|
|
658
658
|
const fromDir = path10.dirname(from);
|
|
659
659
|
const relative3 = path10.relative(fromDir, to);
|
|
660
660
|
return relative3.startsWith(".") ? relative3 : `./${relative3}`;
|
|
@@ -797,7 +797,7 @@ var init_integration_action_types = __esm(() => {
|
|
|
797
797
|
var require_package = __commonJS((exports, module) => {
|
|
798
798
|
module.exports = {
|
|
799
799
|
name: "@botpress/adk",
|
|
800
|
-
version: "1.7.
|
|
800
|
+
version: "1.7.18",
|
|
801
801
|
description: "Core ADK library for building AI agents on Botpress",
|
|
802
802
|
type: "module",
|
|
803
803
|
main: "dist/index.js",
|
|
@@ -842,9 +842,9 @@ var require_package = __commonJS((exports, module) => {
|
|
|
842
842
|
},
|
|
843
843
|
dependencies: {
|
|
844
844
|
"@botpress/cli": "^4.23",
|
|
845
|
-
"@botpress/client": "^1.27.
|
|
845
|
+
"@botpress/client": "^1.27.2",
|
|
846
846
|
"@botpress/cognitive": "^0.2.0",
|
|
847
|
-
"@botpress/runtime": "^1.7.
|
|
847
|
+
"@botpress/runtime": "^1.7.18",
|
|
848
848
|
"@botpress/sdk": "^4.18.1",
|
|
849
849
|
"@bpinternal/yargs-extra": "^0.0.21",
|
|
850
850
|
"@parcel/watcher": "^2.5.1",
|
|
@@ -4829,7 +4829,7 @@ class AgentProjectGenerator {
|
|
|
4829
4829
|
deploy: "adk deploy"
|
|
4830
4830
|
},
|
|
4831
4831
|
dependencies: {
|
|
4832
|
-
"@botpress/runtime": `^${"1.7.
|
|
4832
|
+
"@botpress/runtime": `^${"1.7.18"}`
|
|
4833
4833
|
},
|
|
4834
4834
|
devDependencies: {
|
|
4835
4835
|
typescript: "^5.9.3"
|
|
@@ -7337,7 +7337,7 @@ async function generateBotProject(options) {
|
|
|
7337
7337
|
});
|
|
7338
7338
|
}
|
|
7339
7339
|
}
|
|
7340
|
-
// src/tables/manager.ts
|
|
7340
|
+
// src/tables/table-manager.ts
|
|
7341
7341
|
import { Client as Client11 } from "@botpress/client";
|
|
7342
7342
|
import { transforms as transforms4 } from "@botpress/sdk";
|
|
7343
7343
|
class TableManager {
|
|
@@ -7368,6 +7368,233 @@ class TableManager {
|
|
|
7368
7368
|
throw new Error(`Operation "${operation}" requires a bot ID. ` + "Please deploy your agent first or create agent.json with botId and workspaceId.");
|
|
7369
7369
|
}
|
|
7370
7370
|
}
|
|
7371
|
+
getSchemaType(schema) {
|
|
7372
|
+
if (schema.type) {
|
|
7373
|
+
if (schema.type === "array" && schema.items?.type) {
|
|
7374
|
+
return `array<${schema.items.type}>`;
|
|
7375
|
+
}
|
|
7376
|
+
return schema.type;
|
|
7377
|
+
}
|
|
7378
|
+
if (schema.$ref) {
|
|
7379
|
+
return schema.$ref.split("/").pop() || "unknown";
|
|
7380
|
+
}
|
|
7381
|
+
return "unknown";
|
|
7382
|
+
}
|
|
7383
|
+
calculateRenameScore(oldName, newName, oldSchema, newSchema, oldPosition, newPosition) {
|
|
7384
|
+
let score = 0;
|
|
7385
|
+
if (oldPosition === newPosition) {
|
|
7386
|
+
score += 3;
|
|
7387
|
+
} else if (Math.abs(oldPosition - newPosition) <= 1) {
|
|
7388
|
+
score += 1;
|
|
7389
|
+
}
|
|
7390
|
+
const oldDesc = (oldSchema?.description || "").toLowerCase();
|
|
7391
|
+
const newDesc = (newSchema?.description || "").toLowerCase();
|
|
7392
|
+
if (oldDesc && newDesc && oldDesc === newDesc) {
|
|
7393
|
+
score += 5;
|
|
7394
|
+
} else if (oldDesc && newDesc && oldDesc.length > 5 && newDesc.length > 5) {
|
|
7395
|
+
if (oldDesc.includes(newDesc) || newDesc.includes(oldDesc)) {
|
|
7396
|
+
score += 2;
|
|
7397
|
+
} else {
|
|
7398
|
+
const oldWords = oldDesc.split(/\s+/);
|
|
7399
|
+
const newWords = newDesc.split(/\s+/);
|
|
7400
|
+
const commonWords = oldWords.filter((w) => newWords.includes(w) && w.length > 3);
|
|
7401
|
+
if (commonWords.length >= 2) {
|
|
7402
|
+
score += 1;
|
|
7403
|
+
}
|
|
7404
|
+
}
|
|
7405
|
+
}
|
|
7406
|
+
const oldOptional = oldSchema?.type?.includes("null") || oldSchema?.nullable === true;
|
|
7407
|
+
const newOptional = newSchema?.type?.includes("null") || newSchema?.nullable === true;
|
|
7408
|
+
if (oldOptional === newOptional) {
|
|
7409
|
+
score += 1;
|
|
7410
|
+
}
|
|
7411
|
+
const oldSearchable = oldSchema?.["x-zui"]?.searchable;
|
|
7412
|
+
const newSearchable = newSchema?.["x-zui"]?.searchable;
|
|
7413
|
+
if (oldSearchable === newSearchable) {
|
|
7414
|
+
score += 1;
|
|
7415
|
+
}
|
|
7416
|
+
return score;
|
|
7417
|
+
}
|
|
7418
|
+
cleanSchemaForComparison(schema) {
|
|
7419
|
+
if (!schema || typeof schema !== "object") {
|
|
7420
|
+
return schema;
|
|
7421
|
+
}
|
|
7422
|
+
const cleaned = Array.isArray(schema) ? [...schema] : { ...schema };
|
|
7423
|
+
if (cleaned["x-zui"]) {
|
|
7424
|
+
const xZui = { ...cleaned["x-zui"] };
|
|
7425
|
+
delete xZui.index;
|
|
7426
|
+
if (Object.keys(xZui).length === 0) {
|
|
7427
|
+
delete cleaned["x-zui"];
|
|
7428
|
+
} else {
|
|
7429
|
+
cleaned["x-zui"] = xZui;
|
|
7430
|
+
}
|
|
7431
|
+
}
|
|
7432
|
+
if (cleaned.properties) {
|
|
7433
|
+
const cleanedProps = {};
|
|
7434
|
+
for (const [key, value] of Object.entries(cleaned.properties)) {
|
|
7435
|
+
cleanedProps[key] = this.cleanSchemaForComparison(value);
|
|
7436
|
+
}
|
|
7437
|
+
cleaned.properties = cleanedProps;
|
|
7438
|
+
}
|
|
7439
|
+
if (cleaned.items) {
|
|
7440
|
+
cleaned.items = this.cleanSchemaForComparison(cleaned.items);
|
|
7441
|
+
}
|
|
7442
|
+
delete cleaned.additionalProperties;
|
|
7443
|
+
return cleaned;
|
|
7444
|
+
}
|
|
7445
|
+
analyzeColumnChanges(local, remote) {
|
|
7446
|
+
const differences = [];
|
|
7447
|
+
const columnChanges = [];
|
|
7448
|
+
if (!local || !remote) {
|
|
7449
|
+
return { differences, columnChanges };
|
|
7450
|
+
}
|
|
7451
|
+
const cleanedLocal = this.cleanSchemaForComparison(local);
|
|
7452
|
+
const cleanedRemote = this.cleanSchemaForComparison(remote);
|
|
7453
|
+
const localProps = cleanedLocal.properties || {};
|
|
7454
|
+
const remoteProps = cleanedRemote.properties || {};
|
|
7455
|
+
const localKeys = Object.keys(localProps);
|
|
7456
|
+
const remoteKeys = Object.keys(remoteProps);
|
|
7457
|
+
const addedKeys = localKeys.filter((k) => !remoteKeys.includes(k));
|
|
7458
|
+
const removedKeys = remoteKeys.filter((k) => !localKeys.includes(k));
|
|
7459
|
+
const commonKeys = localKeys.filter((k) => remoteKeys.includes(k));
|
|
7460
|
+
const addedByType = new Map;
|
|
7461
|
+
const removedByType = new Map;
|
|
7462
|
+
for (const key of addedKeys) {
|
|
7463
|
+
const localType = this.getSchemaType(localProps[key]);
|
|
7464
|
+
if (!addedByType.has(localType)) {
|
|
7465
|
+
addedByType.set(localType, []);
|
|
7466
|
+
}
|
|
7467
|
+
addedByType.get(localType).push(key);
|
|
7468
|
+
}
|
|
7469
|
+
for (const key of removedKeys) {
|
|
7470
|
+
const remoteType = this.getSchemaType(remoteProps[key]);
|
|
7471
|
+
if (!removedByType.has(remoteType)) {
|
|
7472
|
+
removedByType.set(remoteType, []);
|
|
7473
|
+
}
|
|
7474
|
+
removedByType.get(remoteType).push(key);
|
|
7475
|
+
}
|
|
7476
|
+
const renamedColumns = new Set;
|
|
7477
|
+
for (const [type, removedCols] of removedByType.entries()) {
|
|
7478
|
+
const addedCols = addedByType.get(type) || [];
|
|
7479
|
+
if (removedCols.length === 0 || addedCols.length === 0) {
|
|
7480
|
+
continue;
|
|
7481
|
+
}
|
|
7482
|
+
const matches = [];
|
|
7483
|
+
for (const removed of removedCols) {
|
|
7484
|
+
for (const added of addedCols) {
|
|
7485
|
+
const score = this.calculateRenameScore(removed, added, remoteProps[removed], localProps[added], remoteKeys.indexOf(removed), localKeys.indexOf(added));
|
|
7486
|
+
if (score > 0) {
|
|
7487
|
+
matches.push({ removed, added, score });
|
|
7488
|
+
}
|
|
7489
|
+
}
|
|
7490
|
+
}
|
|
7491
|
+
matches.sort((a, b) => b.score - a.score);
|
|
7492
|
+
const usedRemoved = new Set;
|
|
7493
|
+
const usedAdded = new Set;
|
|
7494
|
+
for (const match of matches) {
|
|
7495
|
+
if (usedRemoved.has(match.removed) || usedAdded.has(match.added)) {
|
|
7496
|
+
continue;
|
|
7497
|
+
}
|
|
7498
|
+
if (match.score >= 2) {
|
|
7499
|
+
columnChanges.push({
|
|
7500
|
+
type: "rename",
|
|
7501
|
+
columnName: match.added,
|
|
7502
|
+
oldColumnName: match.removed,
|
|
7503
|
+
oldType: type,
|
|
7504
|
+
newType: type,
|
|
7505
|
+
details: `Column "${match.removed}" → "${match.added}"`
|
|
7506
|
+
});
|
|
7507
|
+
differences.push(`↔️ Renamed column "${match.removed}" → "${match.added}" (${type})`);
|
|
7508
|
+
renamedColumns.add(match.removed);
|
|
7509
|
+
renamedColumns.add(match.added);
|
|
7510
|
+
usedRemoved.add(match.removed);
|
|
7511
|
+
usedAdded.add(match.added);
|
|
7512
|
+
}
|
|
7513
|
+
}
|
|
7514
|
+
}
|
|
7515
|
+
const localRequired = cleanedLocal.required || [];
|
|
7516
|
+
const remoteRequired = cleanedRemote.required || [];
|
|
7517
|
+
for (const key of addedKeys) {
|
|
7518
|
+
if (!renamedColumns.has(key)) {
|
|
7519
|
+
const localType = this.getSchemaType(localProps[key]);
|
|
7520
|
+
const isRequired = localRequired.includes(key);
|
|
7521
|
+
columnChanges.push({
|
|
7522
|
+
type: "add",
|
|
7523
|
+
columnName: key,
|
|
7524
|
+
newType: localType
|
|
7525
|
+
});
|
|
7526
|
+
const requiredSuffix = isRequired ? " - required" : "";
|
|
7527
|
+
differences.push(`➕ Added column "${key}" (${localType})${requiredSuffix}`);
|
|
7528
|
+
}
|
|
7529
|
+
}
|
|
7530
|
+
for (const key of removedKeys) {
|
|
7531
|
+
if (!renamedColumns.has(key)) {
|
|
7532
|
+
const remoteType = this.getSchemaType(remoteProps[key]);
|
|
7533
|
+
const wasRequired = remoteRequired.includes(key);
|
|
7534
|
+
columnChanges.push({
|
|
7535
|
+
type: "remove",
|
|
7536
|
+
columnName: key,
|
|
7537
|
+
oldType: remoteType
|
|
7538
|
+
});
|
|
7539
|
+
const requiredSuffix = wasRequired ? " - was required" : "";
|
|
7540
|
+
differences.push(`➖ Removed column "${key}" (${remoteType})${requiredSuffix}`);
|
|
7541
|
+
}
|
|
7542
|
+
}
|
|
7543
|
+
for (const key of commonKeys) {
|
|
7544
|
+
const localCol = localProps[key];
|
|
7545
|
+
const remoteCol = remoteProps[key];
|
|
7546
|
+
const localType = this.getSchemaType(localCol);
|
|
7547
|
+
const remoteType = this.getSchemaType(remoteCol);
|
|
7548
|
+
if (localType !== remoteType) {
|
|
7549
|
+
columnChanges.push({
|
|
7550
|
+
type: "modify",
|
|
7551
|
+
columnName: key,
|
|
7552
|
+
oldType: remoteType,
|
|
7553
|
+
newType: localType,
|
|
7554
|
+
details: `Type changed from ${remoteType} to ${localType}`
|
|
7555
|
+
});
|
|
7556
|
+
differences.push(`\uD83D\uDD00 Column "${key}": type changed from ${remoteType} to ${localType}`);
|
|
7557
|
+
}
|
|
7558
|
+
const localSearchable = localCol?.["x-zui"]?.searchable;
|
|
7559
|
+
const remoteSearchable = remoteCol?.["x-zui"]?.searchable;
|
|
7560
|
+
if (localSearchable !== remoteSearchable) {
|
|
7561
|
+
differences.push(`\uD83D\uDD0D Column "${key}": searchable ${remoteSearchable ? "disabled" : "enabled"} (was ${remoteSearchable ? "enabled" : "disabled"})`);
|
|
7562
|
+
}
|
|
7563
|
+
const localRequired2 = cleanedLocal.required?.includes(key) || false;
|
|
7564
|
+
const remoteRequired2 = cleanedRemote.required?.includes(key) || false;
|
|
7565
|
+
if (localRequired2 !== remoteRequired2) {
|
|
7566
|
+
differences.push(`${localRequired2 ? "\uD83D\uDD12" : "\uD83D\uDD13"} Column "${key}": ${localRequired2 ? "now required" : "now optional"}`);
|
|
7567
|
+
}
|
|
7568
|
+
const cleanedLocalCol = this.cleanSchemaForComparison(localCol);
|
|
7569
|
+
const cleanedRemoteCol = this.cleanSchemaForComparison(remoteCol);
|
|
7570
|
+
if (JSON.stringify(cleanedLocalCol) !== JSON.stringify(cleanedRemoteCol) && localType === remoteType) {
|
|
7571
|
+
const localDesc = localCol?.description;
|
|
7572
|
+
const remoteDesc = remoteCol?.description;
|
|
7573
|
+
if (localDesc !== remoteDesc) {
|
|
7574
|
+
differences.push(`\uD83D\uDCAC Column "${key}": description updated`);
|
|
7575
|
+
}
|
|
7576
|
+
}
|
|
7577
|
+
}
|
|
7578
|
+
return { differences, columnChanges };
|
|
7579
|
+
}
|
|
7580
|
+
createSchemaForUpdate(localSchema, columnChanges) {
|
|
7581
|
+
const updatedSchema = JSON.parse(JSON.stringify(localSchema));
|
|
7582
|
+
if (!updatedSchema.properties) {
|
|
7583
|
+
updatedSchema.properties = {};
|
|
7584
|
+
}
|
|
7585
|
+
if (!updatedSchema.required) {
|
|
7586
|
+
updatedSchema.required = [];
|
|
7587
|
+
}
|
|
7588
|
+
for (const change of columnChanges) {
|
|
7589
|
+
if (change.type === "remove") {
|
|
7590
|
+
updatedSchema.properties[change.columnName] = { type: "null" };
|
|
7591
|
+
if (updatedSchema.required && updatedSchema.required.includes(change.columnName)) {
|
|
7592
|
+
updatedSchema.required = updatedSchema.required.filter((req) => req !== change.columnName);
|
|
7593
|
+
}
|
|
7594
|
+
}
|
|
7595
|
+
}
|
|
7596
|
+
return updatedSchema;
|
|
7597
|
+
}
|
|
7371
7598
|
async getLocalTables() {
|
|
7372
7599
|
const tables = [];
|
|
7373
7600
|
for (const tableRef of this.project.tables) {
|
|
@@ -7377,7 +7604,7 @@ class TableManager {
|
|
|
7377
7604
|
factor: tableRef.definition.factor,
|
|
7378
7605
|
schema: tableRef.definition.schema
|
|
7379
7606
|
});
|
|
7380
|
-
} catch
|
|
7607
|
+
} catch {}
|
|
7381
7608
|
}
|
|
7382
7609
|
return tables;
|
|
7383
7610
|
}
|
|
@@ -7386,13 +7613,25 @@ class TableManager {
|
|
|
7386
7613
|
const client = await this.getClient();
|
|
7387
7614
|
try {
|
|
7388
7615
|
const response = await client.listTables({});
|
|
7389
|
-
|
|
7390
|
-
|
|
7391
|
-
|
|
7392
|
-
|
|
7393
|
-
|
|
7394
|
-
|
|
7616
|
+
const tablesWithCounts = await Promise.all(response.tables.map(async (table) => {
|
|
7617
|
+
let rowCount = 0;
|
|
7618
|
+
try {
|
|
7619
|
+
const tableInfo = await client.getTable({ table: table.name });
|
|
7620
|
+
rowCount = tableInfo.rows || 0;
|
|
7621
|
+
} catch (error) {
|
|
7622
|
+
console.warn(`Failed to get row count for table ${table.name}:`, error);
|
|
7623
|
+
}
|
|
7624
|
+
return {
|
|
7625
|
+
id: table.id,
|
|
7626
|
+
name: table.name,
|
|
7627
|
+
createdAt: table.createdAt || new Date().toISOString(),
|
|
7628
|
+
updatedAt: table.updatedAt || new Date().toISOString(),
|
|
7629
|
+
factor: table.factor || 1,
|
|
7630
|
+
schema: table.schema,
|
|
7631
|
+
rowCount
|
|
7632
|
+
};
|
|
7395
7633
|
}));
|
|
7634
|
+
return tablesWithCounts;
|
|
7396
7635
|
} catch (error) {
|
|
7397
7636
|
console.error("Failed to list remote tables:", error);
|
|
7398
7637
|
return [];
|
|
@@ -7413,14 +7652,34 @@ class TableManager {
|
|
|
7413
7652
|
});
|
|
7414
7653
|
} else {
|
|
7415
7654
|
try {
|
|
7416
|
-
const
|
|
7417
|
-
const
|
|
7418
|
-
|
|
7655
|
+
const cleanedLocalSchema = this.cleanSchemaForComparison(local.schema);
|
|
7656
|
+
const cleanedRemoteSchema = this.cleanSchemaForComparison(remote.schema);
|
|
7657
|
+
const { differences, columnChanges } = this.analyzeColumnChanges(local.schema, remote.schema);
|
|
7658
|
+
const factorMatches = (local.factor || 1) === (remote.factor || 1);
|
|
7659
|
+
const localSchema = transforms4.fromJSONSchema(cleanedLocalSchema);
|
|
7660
|
+
const remoteSchema = transforms4.fromJSONSchema(cleanedRemoteSchema);
|
|
7661
|
+
const schemasEqual = localSchema.isEqual(remoteSchema);
|
|
7662
|
+
const hasMetadataChanges = differences.length > 0;
|
|
7663
|
+
if (!schemasEqual || !factorMatches || hasMetadataChanges) {
|
|
7664
|
+
const reasons = [];
|
|
7665
|
+
if (differences.length > 0) {
|
|
7666
|
+
reasons.push("schema changes detected");
|
|
7667
|
+
} else if (!schemasEqual) {
|
|
7668
|
+
reasons.push("schema metadata changed");
|
|
7669
|
+
}
|
|
7670
|
+
if (!factorMatches) {
|
|
7671
|
+
differences.push(`⚡ Factor: ${remote.factor || 1} → ${local.factor || 1}`);
|
|
7672
|
+
reasons.push("factor changed");
|
|
7673
|
+
}
|
|
7674
|
+
const schemaForUpdate = this.createSchemaForUpdate(local.schema, columnChanges);
|
|
7419
7675
|
items.push({
|
|
7420
7676
|
operation: "update" /* Update */,
|
|
7421
7677
|
localTable: local,
|
|
7422
7678
|
remoteTable: remote,
|
|
7423
|
-
reason:
|
|
7679
|
+
reason: `Table ${reasons.join(" and ")}`,
|
|
7680
|
+
differences: differences.length > 0 ? differences : undefined,
|
|
7681
|
+
columnChanges: columnChanges.length > 0 ? columnChanges : undefined,
|
|
7682
|
+
schemaForUpdate
|
|
7424
7683
|
});
|
|
7425
7684
|
} else {
|
|
7426
7685
|
items.push({
|
|
@@ -7430,7 +7689,7 @@ class TableManager {
|
|
|
7430
7689
|
reason: "Table schema is up to date"
|
|
7431
7690
|
});
|
|
7432
7691
|
}
|
|
7433
|
-
} catch
|
|
7692
|
+
} catch {
|
|
7434
7693
|
items.push({
|
|
7435
7694
|
operation: "update" /* Update */,
|
|
7436
7695
|
localTable: local,
|
|
@@ -7498,9 +7757,27 @@ class TableManager {
|
|
|
7498
7757
|
break;
|
|
7499
7758
|
case "update" /* Update */:
|
|
7500
7759
|
if (item.localTable && item.remoteTable) {
|
|
7760
|
+
if (item.columnChanges) {
|
|
7761
|
+
const renames = item.columnChanges.filter((c) => c.type === "rename");
|
|
7762
|
+
for (const rename of renames) {
|
|
7763
|
+
if (rename.oldColumnName && rename.columnName) {
|
|
7764
|
+
await client.renameTableColumn({
|
|
7765
|
+
table: item.localTable.name,
|
|
7766
|
+
name: rename.oldColumnName,
|
|
7767
|
+
newName: rename.columnName
|
|
7768
|
+
});
|
|
7769
|
+
}
|
|
7770
|
+
}
|
|
7771
|
+
}
|
|
7772
|
+
let schemaToUse = item.schemaForUpdate || item.localTable.schema;
|
|
7773
|
+
const localFactor = item.localTable.factor || 1;
|
|
7774
|
+
if (!schemaToUse.required) {
|
|
7775
|
+
schemaToUse = { ...schemaToUse, required: [] };
|
|
7776
|
+
}
|
|
7501
7777
|
await client.updateTable({
|
|
7502
7778
|
table: item.localTable.name,
|
|
7503
|
-
|
|
7779
|
+
factor: localFactor,
|
|
7780
|
+
schema: schemaToUse
|
|
7504
7781
|
});
|
|
7505
7782
|
success.push(item);
|
|
7506
7783
|
}
|
|
@@ -8093,5 +8370,5 @@ export {
|
|
|
8093
8370
|
AgentProject
|
|
8094
8371
|
};
|
|
8095
8372
|
|
|
8096
|
-
//# debugId=
|
|
8373
|
+
//# debugId=E2B8ECAD0716A8AB64756E2164756E21
|
|
8097
8374
|
//# sourceMappingURL=index.js.map
|