@botpress/adk 1.12.0 → 1.12.2
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/bot-generator/generator.d.ts.map +1 -1
- package/dist/bot-generator/integration-sync.d.ts.map +1 -1
- package/dist/generators/integration-types.d.ts +2 -2
- package/dist/generators/integration-types.d.ts.map +1 -1
- package/dist/generators/tests.d.ts.map +1 -1
- package/dist/index.js +138 -62
- package/dist/index.js.map +9 -9
- package/dist/integrations/checker.d.ts.map +1 -1
- package/dist/integrations/operations.d.ts +1 -0
- package/dist/integrations/operations.d.ts.map +1 -1
- package/dist/integrations/sync-manager.d.ts.map +1 -1
- package/dist/tables/table-manager.d.ts.map +1 -1
- package/dist/tables/types.d.ts +4 -0
- package/dist/tables/types.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/bot-generator/generator.ts"],"names":[],"mappings":"AA4BA,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,YAAY,CAAA;CACpD;AAkBD,qBAAa,YAAY;IACvB,OAAO,CAAC,WAAW,CAAQ;IAC3B,OAAO,CAAC,UAAU,CAAQ;gBAEd,OAAO,EAAE,mBAAmB;YAK1B,kBAAkB;YAuBlB,sBAAsB;IAsB9B,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;YA+BjB,yBAAyB;YAkEzB,kBAAkB;YAKlB,oBAAoB;YAKpB,gBAAgB;YAKhB,kBAAkB;YAKlB,0BAA0B;YAK1B,kBAAkB;YAKlB,qBAAqB;YAKrB,yBAAyB;YAKzB,mBAAmB;YAMnB,8BAA8B;YAM9B,oBAAoB;YAyEpB,uBAAuB;YA8FvB,8BAA8B;YAiC9B,4BAA4B;YA2B5B,qBAAqB;
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/bot-generator/generator.ts"],"names":[],"mappings":"AA4BA,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,YAAY,CAAA;CACpD;AAkBD,qBAAa,YAAY;IACvB,OAAO,CAAC,WAAW,CAAQ;IAC3B,OAAO,CAAC,UAAU,CAAQ;gBAEd,OAAO,EAAE,mBAAmB;YAK1B,kBAAkB;YAuBlB,sBAAsB;IAsB9B,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;YA+BjB,yBAAyB;YAkEzB,kBAAkB;YAKlB,oBAAoB;YAKpB,gBAAgB;YAKhB,kBAAkB;YAKlB,0BAA0B;YAK1B,kBAAkB;YAKlB,qBAAqB;YAKrB,yBAAyB;YAKzB,mBAAmB;YAMnB,8BAA8B;YAM9B,oBAAoB;YAyEpB,uBAAuB;YA8FvB,8BAA8B;YAiC9B,4BAA4B;YA2B5B,qBAAqB;YA8XrB,gBAAgB;YAoChB,mBAAmB;YAgBnB,gBAAgB;YAiChB,mBAAmB;YAyBnB,UAAU;YAWV,aAAa;IAgBrB,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC;IA6ZnC,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;CAOzC;AAED,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CA0CpF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration-sync.d.ts","sourceRoot":"","sources":["../../src/bot-generator/integration-sync.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,eAAe,EAAE,CAAA;IACzB,MAAM,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAChD;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,WAAW,CAAQ;IAC3B,OAAO,CAAC,cAAc,CAAQ;IAC9B,OAAO,CAAC,aAAa,CAAQ;gBAEjB,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM;IAMvD;;OAEG;YACW,iBAAiB;IAqC/B;;OAEG;YACW,mBAAmB;IA6BjC;;OAEG;YACW,kBAAkB;IAqBhC;;OAEG;YACW,uBAAuB;
|
|
1
|
+
{"version":3,"file":"integration-sync.d.ts","sourceRoot":"","sources":["../../src/bot-generator/integration-sync.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,eAAe,EAAE,CAAA;IACzB,MAAM,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAChD;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,WAAW,CAAQ;IAC3B,OAAO,CAAC,cAAc,CAAQ;IAC9B,OAAO,CAAC,aAAa,CAAQ;gBAEjB,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM;IAMvD;;OAEG;YACW,iBAAiB;IAqC/B;;OAEG;YACW,mBAAmB;IA6BjC;;OAEG;YACW,kBAAkB;IAqBhC;;OAEG;YACW,uBAAuB;IAkBrC;;OAEG;YACW,uBAAuB;IAQrC;;OAEG;IACG,gBAAgB,IAAI,OAAO,CAAC,UAAU,CAAC;CAuC9C"}
|
|
@@ -6,7 +6,7 @@ declare const getIntegrationNames: (integration: ParsedIntegration) => {
|
|
|
6
6
|
channels: string;
|
|
7
7
|
events: string;
|
|
8
8
|
users: string;
|
|
9
|
-
|
|
9
|
+
configurations: string;
|
|
10
10
|
};
|
|
11
11
|
paths: {
|
|
12
12
|
index: string;
|
|
@@ -14,7 +14,7 @@ declare const getIntegrationNames: (integration: ParsedIntegration) => {
|
|
|
14
14
|
channels: string;
|
|
15
15
|
events: string;
|
|
16
16
|
users: string;
|
|
17
|
-
|
|
17
|
+
configurations: string;
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
20
|
export declare function generateIntegrationTypes(integration: ParsedIntegration): Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration-types.d.ts","sourceRoot":"","sources":["../../src/generators/integration-types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAgB5D,QAAA,MAAM,mBAAmB,GAAI,aAAa,iBAAiB;;;;;;;;;;;;;;;;;CAiBzD,CAAA;AAEF,wBAAsB,wBAAwB,CAAC,WAAW,EAAE,iBAAiB,GAAG,OAAO,CAAC;IACtF,KAAK,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAA;IAC7C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC9B,CAAC,
|
|
1
|
+
{"version":3,"file":"integration-types.d.ts","sourceRoot":"","sources":["../../src/generators/integration-types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAgB5D,QAAA,MAAM,mBAAmB,GAAI,aAAa,iBAAiB;;;;;;;;;;;;;;;;;CAiBzD,CAAA;AAEF,wBAAsB,wBAAwB,CAAC,WAAW,EAAE,iBAAiB,GAAG,OAAO,CAAC;IACtF,KAAK,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAA;IAC7C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC9B,CAAC,CAyRD"}
|
|
@@ -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;;;;;;;;iBAkBi3/6B,CAAC;uBAA0H,CAAC;;;;;;;;iBAAuU,CAAC;uBAAyH,CAAC;;;;sBAAsM,CAAC;;;;;;;iBAA6S,CAAC;uBAA0H,CAAC;oBAAkC,CAAC;qBAAoC,CAAC;;;;;;;;;;;sBAA2Y,CAAC;;;;;;;iBAA8O,CAAC;uBAA2H,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAApnlN,CAAC;uBAA0H,CAAC;;;;;;;;iBAAuU,CAAC;uBAAyH,CAAC;;;;sBAAsM,CAAC;;;;;;;iBAA6S,CAAC;uBAA0H,CAAC;oBAAkC,CAAC;qBAAoC,CAAC;;;;;;;;;;;sBAA2Y,CAAC;;;;;;;iBAA8O,CAAC;uBAA2H,CAAC;;;;;;;;;;;;;;;;;;;;;;EADlxiuB,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.12.
|
|
657
|
+
}, ADK_VERSION = "1.12.2", 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.12.
|
|
800
|
+
version: "1.12.2",
|
|
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.27.3",
|
|
845
|
-
"@botpress/client": "^1.
|
|
845
|
+
"@botpress/client": "^1.28.0",
|
|
846
846
|
"@botpress/cognitive": "^0.2.0",
|
|
847
|
-
"@botpress/runtime": "^1.12.
|
|
847
|
+
"@botpress/runtime": "^1.12.2",
|
|
848
848
|
"@botpress/sdk": "^4.18.1",
|
|
849
849
|
"@bpinternal/jex": "^1.2.4",
|
|
850
850
|
"@bpinternal/yargs-extra": "^0.0.21",
|
|
@@ -3172,30 +3172,38 @@ class IntegrationOperations {
|
|
|
3172
3172
|
} catch (error) {
|
|
3173
3173
|
throw new Error(`Failed to add integration: ${error instanceof Error ? error.message : String(error)}`);
|
|
3174
3174
|
}
|
|
3175
|
-
let requiresConfiguration = false;
|
|
3176
|
-
requiresConfiguration = Object.values(integrationDefinition.configurations).some((config2) => config2.identifier?.required === true);
|
|
3177
|
-
if (!requiresConfiguration && integrationDefinition.configuration) {
|
|
3178
|
-
const config2 = integrationDefinition.configuration;
|
|
3179
|
-
const schema = config2.schema;
|
|
3180
|
-
requiresConfiguration = schema?.required && schema.required.length > 0;
|
|
3181
|
-
}
|
|
3182
3175
|
const actualVersion = integrationDefinition.version;
|
|
3183
3176
|
const integrationVersion = `${ref.fullName}@${actualVersion}`;
|
|
3184
3177
|
const existingEntry = dependencies.integrations[alias];
|
|
3185
3178
|
const existingConfig = existingEntry && typeof existingEntry === "object" ? existingEntry.config : undefined;
|
|
3186
|
-
const
|
|
3179
|
+
const existingConfigurationType = existingEntry && typeof existingEntry === "object" ? existingEntry.configurationType : undefined;
|
|
3180
|
+
const configurationType = existingConfigurationType || this.selectBestConfigurationType(integrationDefinition.configurations);
|
|
3181
|
+
let requiresConfiguration = false;
|
|
3182
|
+
const selectedConfigDef = configurationType && integrationDefinition.configurations?.[configurationType] || integrationDefinition.configurations?.["default"] || integrationDefinition.configuration;
|
|
3183
|
+
if (selectedConfigDef) {
|
|
3184
|
+
if (selectedConfigDef.identifier?.required === true) {
|
|
3185
|
+
requiresConfiguration = true;
|
|
3186
|
+
}
|
|
3187
|
+
if (selectedConfigDef.schema?.required && selectedConfigDef.schema.required.length > 0) {
|
|
3188
|
+
requiresConfiguration = true;
|
|
3189
|
+
}
|
|
3190
|
+
}
|
|
3191
|
+
const config = requiresConfiguration && !existingConfig ? this.getPlaceholderConfig(integrationDefinition, configurationType) : existingConfig;
|
|
3187
3192
|
if (existingEntry && typeof existingEntry === "object" && "version" in existingEntry) {
|
|
3193
|
+
const resolvedConfigType = existingEntry.configurationType || configurationType;
|
|
3188
3194
|
dependencies.integrations[alias] = {
|
|
3189
|
-
|
|
3190
|
-
|
|
3195
|
+
version: integrationVersion,
|
|
3196
|
+
enabled: existingEntry.enabled,
|
|
3197
|
+
...resolvedConfigType ? { configurationType: resolvedConfigType } : {},
|
|
3198
|
+
config: existingEntry.config
|
|
3191
3199
|
};
|
|
3192
3200
|
} else {
|
|
3193
|
-
|
|
3201
|
+
dependencies.integrations[alias] = {
|
|
3194
3202
|
version: integrationVersion,
|
|
3195
3203
|
enabled: !requiresConfiguration,
|
|
3204
|
+
...configurationType ? { configurationType } : {},
|
|
3196
3205
|
config
|
|
3197
3206
|
};
|
|
3198
|
-
dependencies.integrations[alias] = newEntry;
|
|
3199
3207
|
}
|
|
3200
3208
|
const configWriter = new ConfigWriter(project.path);
|
|
3201
3209
|
await configWriter.updateDependencies(dependencies);
|
|
@@ -3205,11 +3213,27 @@ class IntegrationOperations {
|
|
|
3205
3213
|
newVersion: actualVersion
|
|
3206
3214
|
};
|
|
3207
3215
|
}
|
|
3208
|
-
|
|
3216
|
+
selectBestConfigurationType(configurations) {
|
|
3217
|
+
if (!configurations || Object.keys(configurations).length === 0) {
|
|
3218
|
+
return;
|
|
3219
|
+
}
|
|
3220
|
+
const keys = Object.keys(configurations);
|
|
3221
|
+
if (keys.length === 1) {
|
|
3222
|
+
return keys[0];
|
|
3223
|
+
}
|
|
3224
|
+
const priority = ["apiKey", "api", "api_key", "token", "default", "refreshToken", "oauth", "oauth2"];
|
|
3225
|
+
for (const preferred of priority) {
|
|
3226
|
+
const match = keys.find((k) => k.toLowerCase() === preferred.toLowerCase());
|
|
3227
|
+
if (match)
|
|
3228
|
+
return match;
|
|
3229
|
+
}
|
|
3230
|
+
return keys[0];
|
|
3231
|
+
}
|
|
3232
|
+
getPlaceholderConfig(integrationDefinition, configurationType) {
|
|
3209
3233
|
const configPlaceholder = {};
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
const schema =
|
|
3234
|
+
const configDef = configurationType && integrationDefinition.configurations?.[configurationType] || integrationDefinition.configurations?.["default"] || integrationDefinition.configuration;
|
|
3235
|
+
if (configDef) {
|
|
3236
|
+
const schema = configDef.schema;
|
|
3213
3237
|
if (schema?.required && schema.required.length > 0) {
|
|
3214
3238
|
const properties = schema.properties || {};
|
|
3215
3239
|
for (const fieldName of schema.required) {
|
|
@@ -3225,7 +3249,6 @@ class IntegrationOperations {
|
|
|
3225
3249
|
}
|
|
3226
3250
|
}
|
|
3227
3251
|
if (Object.keys(configPlaceholder).length > 0) {
|
|
3228
|
-
console.log("Generated config placeholders:", configPlaceholder);
|
|
3229
3252
|
return configPlaceholder;
|
|
3230
3253
|
}
|
|
3231
3254
|
}
|
|
@@ -3487,8 +3510,8 @@ class IntegrationChecker {
|
|
|
3487
3510
|
result.needsConfiguration = true;
|
|
3488
3511
|
}
|
|
3489
3512
|
if (config !== undefined) {
|
|
3490
|
-
const configType = configurationType ?? installedIntegration.configurationType
|
|
3491
|
-
const schema = configType
|
|
3513
|
+
const configType = configurationType ?? installedIntegration.configurationType;
|
|
3514
|
+
const schema = configType && definition.configurations?.[configType]?.schema || definition.configurations?.["default"]?.schema || definition.configuration?.schema;
|
|
3492
3515
|
const schemaProperties = schema?.properties || {};
|
|
3493
3516
|
const allKeys = new Set([
|
|
3494
3517
|
...Object.keys(installedIntegration.configuration || {}),
|
|
@@ -3573,7 +3596,8 @@ class IntegrationSyncManager {
|
|
|
3573
3596
|
[result.alias]: {
|
|
3574
3597
|
integrationId: result.desiredIntegrationId || result.definition.id,
|
|
3575
3598
|
enabled: result.desiredInstallStatus === "enabled",
|
|
3576
|
-
configuration: result.desiredConfiguration || {}
|
|
3599
|
+
configuration: result.desiredConfiguration || {},
|
|
3600
|
+
configurationType: result.desiredConfigurationType
|
|
3577
3601
|
}
|
|
3578
3602
|
}
|
|
3579
3603
|
});
|
|
@@ -6139,7 +6163,7 @@ class AgentProjectGenerator {
|
|
|
6139
6163
|
deploy: "adk deploy"
|
|
6140
6164
|
},
|
|
6141
6165
|
dependencies: {
|
|
6142
|
-
"@botpress/runtime": `^${"1.12.
|
|
6166
|
+
"@botpress/runtime": `^${"1.12.2"}`
|
|
6143
6167
|
},
|
|
6144
6168
|
devDependencies: {
|
|
6145
6169
|
typescript: "^5.9.3"
|
|
@@ -6490,7 +6514,7 @@ var getIntegrationNames = (integration) => ({
|
|
|
6490
6514
|
channels: `Integration_Channels_${getPascalAlias(integration)}`,
|
|
6491
6515
|
events: `Integration_Events_${getPascalAlias(integration)}`,
|
|
6492
6516
|
users: `Integration_Users_${getPascalAlias(integration)}`,
|
|
6493
|
-
|
|
6517
|
+
configurations: `Integration_Configurations_${getPascalAlias(integration)}`
|
|
6494
6518
|
},
|
|
6495
6519
|
paths: {
|
|
6496
6520
|
index: path17.join(snakeCase(getPascalAlias(integration)), `index.ts`),
|
|
@@ -6498,7 +6522,7 @@ var getIntegrationNames = (integration) => ({
|
|
|
6498
6522
|
channels: path17.join(snakeCase(getPascalAlias(integration)), `channels.ts`),
|
|
6499
6523
|
events: path17.join(snakeCase(getPascalAlias(integration)), `events.ts`),
|
|
6500
6524
|
users: path17.join(snakeCase(getPascalAlias(integration)), `users.ts`),
|
|
6501
|
-
|
|
6525
|
+
configurations: path17.join(snakeCase(getPascalAlias(integration)), `configurations.ts`)
|
|
6502
6526
|
}
|
|
6503
6527
|
});
|
|
6504
6528
|
async function generateIntegrationTypes(integration) {
|
|
@@ -6524,20 +6548,20 @@ async function generateIntegrationTypes(integration) {
|
|
|
6524
6548
|
import { Integration_Channels_${getPascalAlias(integration)} } from "${rel(names.paths.channels)}";
|
|
6525
6549
|
import { Integration_Events_${getPascalAlias(integration)} } from "${rel(names.paths.events)}";
|
|
6526
6550
|
import { Integration_Users_${getPascalAlias(integration)} } from "${rel(names.paths.users)}";
|
|
6527
|
-
import {
|
|
6551
|
+
import { Integration_Configurations_${getPascalAlias(integration)} } from "${rel(names.paths.configurations)}";
|
|
6528
6552
|
|
|
6529
6553
|
export * from "${rel(names.paths.actions)}";
|
|
6530
6554
|
export * from "${rel(names.paths.channels)}";
|
|
6531
6555
|
export * from "${rel(names.paths.events)}";
|
|
6532
6556
|
export * from "${rel(names.paths.users)}";
|
|
6533
|
-
export * from "${rel(names.paths.
|
|
6557
|
+
export * from "${rel(names.paths.configurations)}";
|
|
6534
6558
|
|
|
6535
6559
|
export type Integration_All_${getPascalAlias(integration)} = {
|
|
6536
6560
|
actions: Integration_Actions_${getPascalAlias(integration)};
|
|
6537
6561
|
channels: Integration_Channels_${getPascalAlias(integration)};
|
|
6538
6562
|
events: Integration_Events_${getPascalAlias(integration)};
|
|
6539
6563
|
users: Integration_Users_${getPascalAlias(integration)};
|
|
6540
|
-
|
|
6564
|
+
configurations: Integration_Configurations_${getPascalAlias(integration)};
|
|
6541
6565
|
};
|
|
6542
6566
|
`;
|
|
6543
6567
|
let tActions = `
|
|
@@ -6676,34 +6700,67 @@ Description: ${tag?.description}`);
|
|
|
6676
6700
|
tags: ${userTagsUnion};
|
|
6677
6701
|
};
|
|
6678
6702
|
`;
|
|
6679
|
-
let
|
|
6703
|
+
let tConfigurations = `
|
|
6680
6704
|
////////////////////////////////////////////////////////
|
|
6681
6705
|
// DO NOT EDIT THIS FILE DIRECTLY
|
|
6682
6706
|
// This file is auto-generated from the Botpress ADK
|
|
6683
6707
|
// ADK Version: ${ADK_VERSION}
|
|
6684
6708
|
// Integration: ${integration.definition?.name}
|
|
6685
6709
|
// Version: ${integration.definition?.version}
|
|
6686
|
-
// File: ${names.paths.
|
|
6710
|
+
// File: ${names.paths.configurations}
|
|
6687
6711
|
// Hash: ${hash}
|
|
6688
6712
|
// Updated at: ${integration.definition?.updatedAt}
|
|
6689
6713
|
////////////////////////////////////////////////////////
|
|
6690
6714
|
|
|
6691
|
-
export type
|
|
6692
|
-
const
|
|
6693
|
-
|
|
6694
|
-
|
|
6695
|
-
const
|
|
6696
|
-
|
|
6697
|
-
|
|
6698
|
-
}
|
|
6699
|
-
|
|
6700
|
-
|
|
6701
|
-
|
|
6702
|
-
|
|
6715
|
+
export type Integration_Configurations_${getPascalAlias(integration)} = `;
|
|
6716
|
+
const configEntries = [];
|
|
6717
|
+
if (integration.definition?.configuration) {
|
|
6718
|
+
const defaultConfig = integration.definition.configuration;
|
|
6719
|
+
const title = defaultConfig.title || "Default";
|
|
6720
|
+
const description = defaultConfig.description || "Default configuration";
|
|
6721
|
+
const schema = defaultConfig.schema;
|
|
6722
|
+
let tsType = "{}";
|
|
6723
|
+
if (schema) {
|
|
6724
|
+
tsType = transforms.fromJSONSchema(schema).toTypescriptType();
|
|
6725
|
+
}
|
|
6726
|
+
const jsdocLines = ["/**"];
|
|
6727
|
+
jsdocLines.push(` * @title ${title}`);
|
|
6728
|
+
if (description) {
|
|
6729
|
+
jsdocLines.push(` * ${description}`);
|
|
6730
|
+
}
|
|
6731
|
+
jsdocLines.push(" */");
|
|
6732
|
+
configEntries.push(`${jsdocLines.join(`
|
|
6733
|
+
`)}
|
|
6734
|
+
default: ${tsType}`);
|
|
6735
|
+
}
|
|
6736
|
+
if (integration.definition?.configurations) {
|
|
6737
|
+
for (const [key, config] of Object.entries(integration.definition.configurations)) {
|
|
6738
|
+
const title = config.title || key;
|
|
6739
|
+
const description = config.description || "";
|
|
6740
|
+
const schema = config.schema;
|
|
6741
|
+
let tsType = "{}";
|
|
6742
|
+
if (schema) {
|
|
6743
|
+
tsType = transforms.fromJSONSchema(schema).toTypescriptType();
|
|
6744
|
+
}
|
|
6745
|
+
const jsdocLines = ["/**"];
|
|
6746
|
+
jsdocLines.push(` * @title ${title}`);
|
|
6747
|
+
if (description) {
|
|
6748
|
+
jsdocLines.push(` * ${description}`);
|
|
6749
|
+
}
|
|
6750
|
+
jsdocLines.push(" */");
|
|
6751
|
+
configEntries.push(`${jsdocLines.join(`
|
|
6752
|
+
`)}
|
|
6753
|
+
${key}: ${tsType}`);
|
|
6703
6754
|
}
|
|
6704
6755
|
}
|
|
6705
|
-
|
|
6706
|
-
|
|
6756
|
+
if (configEntries.length > 0) {
|
|
6757
|
+
tConfigurations += `{
|
|
6758
|
+
${configEntries.join(`;
|
|
6759
|
+
`)};
|
|
6760
|
+
};`;
|
|
6761
|
+
} else {
|
|
6762
|
+
tConfigurations += `Record<string, never>;`;
|
|
6763
|
+
}
|
|
6707
6764
|
return {
|
|
6708
6765
|
names,
|
|
6709
6766
|
files: {
|
|
@@ -6712,7 +6769,7 @@ Description: ${tag?.description}`);
|
|
|
6712
6769
|
[names.paths.channels]: await formatCode(tChannels),
|
|
6713
6770
|
[names.paths.events]: await formatCode(tEvents),
|
|
6714
6771
|
[names.paths.users]: await formatCode(tUsers),
|
|
6715
|
-
[names.paths.
|
|
6772
|
+
[names.paths.configurations]: await formatCode(tConfigurations)
|
|
6716
6773
|
}
|
|
6717
6774
|
};
|
|
6718
6775
|
}
|
|
@@ -7636,7 +7693,6 @@ class IntegrationSync {
|
|
|
7636
7693
|
await command.output();
|
|
7637
7694
|
}
|
|
7638
7695
|
async renameIntegrationFolder(integration) {
|
|
7639
|
-
console.log(integration.name, integration.alias);
|
|
7640
7696
|
const sourceFolder = path28.join(this.bpModulesPath, integration.name.replace("/", "-"));
|
|
7641
7697
|
const targetFolder = path28.join(this.bpModulesPath, `integration_${integration.alias}`);
|
|
7642
7698
|
if (!existsSync4(sourceFolder)) {
|
|
@@ -7907,7 +7963,7 @@ class BotGenerator {
|
|
|
7907
7963
|
let aliases = new Set;
|
|
7908
7964
|
let files = new Set;
|
|
7909
7965
|
for (const integration of integrations.integrations) {
|
|
7910
|
-
if (integration.
|
|
7966
|
+
if (integration.definition) {
|
|
7911
7967
|
const types6 = await generateIntegrationTypes(integration);
|
|
7912
7968
|
const importPath = `./${path32.join("integrations", types6.names.paths.index).replace(/\\/g, "/")}`;
|
|
7913
7969
|
aliases.add(`"${integration.alias}": import("${importPath}").${types6.names.typings.index}`);
|
|
@@ -8448,15 +8504,14 @@ configuration: {
|
|
|
8448
8504
|
},
|
|
8449
8505
|
},
|
|
8450
8506
|
});
|
|
8451
|
-
|
|
8452
|
-
|
|
8507
|
+
`;
|
|
8508
|
+
const integrationsSection = addIntegrations.length > 0 ? `
|
|
8453
8509
|
` + addIntegrations.join(`
|
|
8454
|
-
`) : ""
|
|
8510
|
+
`) : "";
|
|
8511
|
+
const fullContent = content + integrationsSection + `
|
|
8455
8512
|
|
|
8456
|
-
|
|
8457
|
-
|
|
8458
|
-
`;
|
|
8459
|
-
await createFile(path32.join(this.outputPath, "bot.definition.ts"), await formatCode(content));
|
|
8513
|
+
export default bot;`;
|
|
8514
|
+
await createFile(path32.join(this.outputPath, "bot.definition.ts"), await formatCode(fullContent));
|
|
8460
8515
|
}
|
|
8461
8516
|
async generateBotIndex() {
|
|
8462
8517
|
const content = dedent`
|
|
@@ -9193,7 +9248,9 @@ class TableManager {
|
|
|
9193
9248
|
tables.push({
|
|
9194
9249
|
name: tableRef.definition.name,
|
|
9195
9250
|
factor: tableRef.definition.factor,
|
|
9196
|
-
schema: tableRef.definition.schema
|
|
9251
|
+
schema: tableRef.definition.schema,
|
|
9252
|
+
keyColumn: tableRef.definition.keyColumn,
|
|
9253
|
+
tags: tableRef.definition.tags
|
|
9197
9254
|
});
|
|
9198
9255
|
} catch {}
|
|
9199
9256
|
}
|
|
@@ -9219,7 +9276,9 @@ class TableManager {
|
|
|
9219
9276
|
updatedAt: table.updatedAt || new Date().toISOString(),
|
|
9220
9277
|
factor: table.factor || 1,
|
|
9221
9278
|
schema: table.schema,
|
|
9222
|
-
rowCount
|
|
9279
|
+
rowCount,
|
|
9280
|
+
keyColumn: table.keyColumn || "",
|
|
9281
|
+
tags: table.tags || {}
|
|
9223
9282
|
};
|
|
9224
9283
|
}));
|
|
9225
9284
|
return tablesWithCounts;
|
|
@@ -9247,11 +9306,13 @@ class TableManager {
|
|
|
9247
9306
|
const cleanedRemoteSchema = this.cleanSchemaForComparison(remote.schema);
|
|
9248
9307
|
const { differences, columnChanges } = this.analyzeColumnChanges(local.schema, remote.schema);
|
|
9249
9308
|
const factorMatches = (local.factor || 1) === (remote.factor || 1);
|
|
9309
|
+
const keyColumnMatches = (local.keyColumn || "") === (remote.keyColumn || "");
|
|
9310
|
+
const tagsMatch = JSON.stringify(local.tags || {}) === JSON.stringify(remote.tags || {});
|
|
9250
9311
|
const localSchema = transforms4.fromJSONSchema(cleanedLocalSchema);
|
|
9251
9312
|
const remoteSchema = transforms4.fromJSONSchema(cleanedRemoteSchema);
|
|
9252
9313
|
const schemasEqual = localSchema.isEqual(remoteSchema);
|
|
9253
9314
|
const hasMetadataChanges = differences.length > 0;
|
|
9254
|
-
if (!schemasEqual || !factorMatches || hasMetadataChanges) {
|
|
9315
|
+
if (!schemasEqual || !factorMatches || hasMetadataChanges || !keyColumnMatches || !tagsMatch) {
|
|
9255
9316
|
const reasons = [];
|
|
9256
9317
|
if (differences.length > 0) {
|
|
9257
9318
|
reasons.push("schema changes detected");
|
|
@@ -9262,6 +9323,14 @@ class TableManager {
|
|
|
9262
9323
|
differences.push(`⚡ Factor: ${remote.factor || 1} → ${local.factor || 1}`);
|
|
9263
9324
|
reasons.push("factor changed");
|
|
9264
9325
|
}
|
|
9326
|
+
if (!keyColumnMatches) {
|
|
9327
|
+
differences.push(`\uD83D\uDD11 Key Column: "${remote.keyColumn || ""}" → "${local.keyColumn || ""}"`);
|
|
9328
|
+
reasons.push("key column changed");
|
|
9329
|
+
}
|
|
9330
|
+
if (!tagsMatch) {
|
|
9331
|
+
differences.push(`\uD83C\uDFF7️ Tags updated: ${JSON.stringify(remote.tags || {})} → ${JSON.stringify(local.tags || {})}`);
|
|
9332
|
+
reasons.push("tags changed");
|
|
9333
|
+
}
|
|
9265
9334
|
const schemaForUpdate = this.createSchemaForUpdate(local.schema, columnChanges);
|
|
9266
9335
|
items.push({
|
|
9267
9336
|
operation: "update" /* Update */,
|
|
@@ -9341,7 +9410,9 @@ class TableManager {
|
|
|
9341
9410
|
name: item.localTable.name,
|
|
9342
9411
|
factor: item.localTable.factor || 1,
|
|
9343
9412
|
schema: item.localTable.schema,
|
|
9344
|
-
isComputeEnabled: true
|
|
9413
|
+
isComputeEnabled: true,
|
|
9414
|
+
keyColumn: item.localTable.keyColumn || "",
|
|
9415
|
+
tags: item.localTable.tags || {}
|
|
9345
9416
|
});
|
|
9346
9417
|
success.push(item);
|
|
9347
9418
|
}
|
|
@@ -9362,13 +9433,18 @@ class TableManager {
|
|
|
9362
9433
|
}
|
|
9363
9434
|
let schemaToUse = item.schemaForUpdate || item.localTable.schema;
|
|
9364
9435
|
const localFactor = item.localTable.factor || 1;
|
|
9436
|
+
const localKeyColumn = item.localTable.keyColumn || "";
|
|
9437
|
+
const localTags = item.localTable.tags || {};
|
|
9365
9438
|
if (!schemaToUse.required) {
|
|
9366
9439
|
schemaToUse = { ...schemaToUse, required: [] };
|
|
9367
9440
|
}
|
|
9368
9441
|
await client.updateTable({
|
|
9369
9442
|
table: item.localTable.name,
|
|
9370
9443
|
factor: localFactor,
|
|
9371
|
-
schema: schemaToUse
|
|
9444
|
+
schema: schemaToUse,
|
|
9445
|
+
tags: localTags,
|
|
9446
|
+
keyColumn: localKeyColumn,
|
|
9447
|
+
isComputeEnabled: true
|
|
9372
9448
|
});
|
|
9373
9449
|
success.push(item);
|
|
9374
9450
|
}
|
|
@@ -10934,5 +11010,5 @@ export {
|
|
|
10934
11010
|
AgentProject
|
|
10935
11011
|
};
|
|
10936
11012
|
|
|
10937
|
-
//# debugId=
|
|
11013
|
+
//# debugId=4A3ECF72EBA6C21464756E2164756E21
|
|
10938
11014
|
//# sourceMappingURL=index.js.map
|