@botpress/adk 1.3.11 → 1.3.13
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.
|
@@ -13,7 +13,7 @@ export declare class ValidationErrors {
|
|
|
13
13
|
static missingRequiredField(file: string, field: string): ValidationError;
|
|
14
14
|
static invalidDependenciesSyntax(error: string, line?: number): ValidationError;
|
|
15
15
|
static invalidVersionFormat(integration: string, version: string): ValidationError;
|
|
16
|
-
static unknownIntegration(integration: string, source: string): ValidationError;
|
|
16
|
+
static unknownIntegration(integration: string, source: string, detailedMessage?: string): ValidationError;
|
|
17
17
|
static integrationVersionError(integration: string, errorMessage: string): ValidationError;
|
|
18
18
|
static unknownInterface(errorMessage: string): ValidationError;
|
|
19
19
|
static incompatibleVersion(integration: string, required: string, available: string): ValidationError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation-errors.d.ts","sourceRoot":"","sources":["../../src/agent-project/validation-errors.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAGhB,MAAM,YAAY,CAAC;AAEpB;;GAEG;AAEH,qBAAa,gBAAgB;IAC3B,MAAM,CAAC,KAAK,EAAG,iBAAiB,CAAU;IAG1C,MAAM,CAAC,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe;IAWvD,MAAM,CAAC,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,eAAe;IAWzE,MAAM,CAAC,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe;IAYzD,MAAM,CAAC,gBAAgB,CACrB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,WAAW,GAAG,MAAM,GAC7B,eAAe;IAYlB,MAAM,CAAC,mBAAmB,CACxB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,IAAI,CAAC,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,MAAM,GACd,eAAe;IAalB,MAAM,CAA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M,EACb,MAAM,CAAC,EAAE,MAAM,GACd,eAAe;IAalB,MAAM,CAAC,SAAS,CACd,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,IAAI,CAAC,EAAE,MAAM,GACZ,eAAe;IAYlB,MAAM,CAAC,WAAW,CAChB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GACZ,eAAe;IAalB,MAAM,CAAC,mBAAmB,CACxB,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,GACd,eAAe;IAalB,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,eAAe;IAU5D,MAAM,CAAC,OAAO,CACZ,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,MAAM,EACb,IAAI,CAAC,EAAE,MAAM,GACZ,eAAe;CAUnB"}
|
package/dist/index.js
CHANGED
|
@@ -2183,14 +2183,14 @@ class ValidationErrors {
|
|
|
2183
2183
|
context: { integration, version }
|
|
2184
2184
|
};
|
|
2185
2185
|
}
|
|
2186
|
-
static unknownIntegration(integration, source) {
|
|
2186
|
+
static unknownIntegration(integration, source, detailedMessage) {
|
|
2187
2187
|
return {
|
|
2188
2188
|
$type: ValidationErrors.$type,
|
|
2189
2189
|
code: "UNKNOWN_INTEGRATION" /* UNKNOWN_INTEGRATION */,
|
|
2190
2190
|
severity: "error" /* ERROR */,
|
|
2191
|
-
message: `Unknown integration '${integration}' from source '${source}'`,
|
|
2191
|
+
message: detailedMessage || `Unknown integration '${integration}' from source '${source}'`,
|
|
2192
2192
|
file: "dependencies.json",
|
|
2193
|
-
hint: `Check if the integration name is correct or if it exists in ${source}`,
|
|
2193
|
+
hint: detailedMessage ? undefined : `Check if the integration name is correct or if it exists in ${source}`,
|
|
2194
2194
|
context: { integration, source }
|
|
2195
2195
|
};
|
|
2196
2196
|
}
|
|
@@ -2483,7 +2483,8 @@ class IntegrationManager {
|
|
|
2483
2483
|
if (error instanceof Error && error.message.includes("version")) {
|
|
2484
2484
|
errors.push(ValidationErrors.integrationVersionError(integration.alias, error.message));
|
|
2485
2485
|
} else {
|
|
2486
|
-
|
|
2486
|
+
const errorMessage = error instanceof Error ? error.message : undefined;
|
|
2487
|
+
errors.push(ValidationErrors.unknownIntegration(integration.alias, integration.ref.fullName, errorMessage));
|
|
2487
2488
|
}
|
|
2488
2489
|
}
|
|
2489
2490
|
});
|
|
@@ -2503,51 +2504,80 @@ class IntegrationManager {
|
|
|
2503
2504
|
}
|
|
2504
2505
|
}
|
|
2505
2506
|
const client = await this.getClient();
|
|
2506
|
-
|
|
2507
|
-
|
|
2507
|
+
const integration = await this._findPrivateOrPublicIntegration(client, ref);
|
|
2508
|
+
if (!integration) {
|
|
2509
|
+
throw await this._buildIntegrationNotFoundError(client, ref);
|
|
2510
|
+
}
|
|
2511
|
+
await this.cache.setResolution(ref.name, ref.version, ref.workspace, integration.id, integration.updatedAt);
|
|
2512
|
+
const definition = integration;
|
|
2513
|
+
await this.cache.setDefinition(integration.id, integration.updatedAt, definition);
|
|
2514
|
+
return definition;
|
|
2515
|
+
}
|
|
2516
|
+
async _findPrivateOrPublicIntegration(client, ref) {
|
|
2517
|
+
const privateIntegration = await this._findPrivateIntegration(client, ref);
|
|
2518
|
+
if (privateIntegration) {
|
|
2519
|
+
return privateIntegration;
|
|
2520
|
+
}
|
|
2521
|
+
const publicIntegration = await this._findPublicIntegration(client, ref);
|
|
2522
|
+
if (publicIntegration) {
|
|
2523
|
+
return publicIntegration;
|
|
2524
|
+
}
|
|
2525
|
+
return;
|
|
2526
|
+
}
|
|
2527
|
+
async _findPrivateIntegration(client, ref) {
|
|
2508
2528
|
try {
|
|
2509
|
-
|
|
2529
|
+
const version = ref.workspace && ref.version !== "latest" ? "latest" : ref.version;
|
|
2530
|
+
const response = await client.getIntegrationByName({
|
|
2531
|
+
name: ref.fullName,
|
|
2532
|
+
version
|
|
2533
|
+
});
|
|
2534
|
+
return response.integration;
|
|
2535
|
+
} catch (error) {
|
|
2536
|
+
if (this._isResourceNotFoundError(error)) {
|
|
2537
|
+
return;
|
|
2538
|
+
}
|
|
2539
|
+
throw error;
|
|
2540
|
+
}
|
|
2541
|
+
}
|
|
2542
|
+
async _findPublicIntegration(client, ref) {
|
|
2543
|
+
try {
|
|
2544
|
+
const response = await client.getPublicIntegration({
|
|
2510
2545
|
name: ref.fullName,
|
|
2511
2546
|
version: ref.version
|
|
2512
2547
|
});
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
version: ref.version
|
|
2518
|
-
});
|
|
2519
|
-
} catch (publicError) {
|
|
2520
|
-
versionError = publicError;
|
|
2548
|
+
return response.integration;
|
|
2549
|
+
} catch (error) {
|
|
2550
|
+
if (this._isResourceNotFoundError(error)) {
|
|
2551
|
+
return;
|
|
2521
2552
|
}
|
|
2553
|
+
throw error;
|
|
2522
2554
|
}
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
}
|
|
2555
|
+
}
|
|
2556
|
+
_isResourceNotFoundError(error) {
|
|
2557
|
+
if (error && typeof error === "object" && "type" in error) {
|
|
2558
|
+
return error.type === "ResourceNotFound";
|
|
2559
|
+
}
|
|
2560
|
+
return false;
|
|
2561
|
+
}
|
|
2562
|
+
async _buildIntegrationNotFoundError(client, ref) {
|
|
2563
|
+
if (!ref.workspace) {
|
|
2564
|
+
return new Error(`Integration "${ref.name}" not found in the official Botpress hub`);
|
|
2565
|
+
}
|
|
2566
|
+
let currentWorkspaceHandle;
|
|
2567
|
+
try {
|
|
2568
|
+
const credentials = this.options.credentials || await auth.getActiveCredentials();
|
|
2569
|
+
const workspaceId = this.options.workspaceId || credentials.workspaceId;
|
|
2570
|
+
if (workspaceId) {
|
|
2571
|
+
const currentWorkspace = await client.getWorkspace({ id: workspaceId });
|
|
2572
|
+
currentWorkspaceHandle = currentWorkspace?.handle;
|
|
2542
2573
|
}
|
|
2543
|
-
|
|
2544
|
-
|
|
2574
|
+
} catch {
|
|
2575
|
+
return new Error(`Integration "${ref.name}" not found in workspace "${ref.workspace}"`);
|
|
2545
2576
|
}
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
return definition;
|
|
2577
|
+
if (currentWorkspaceHandle === ref.workspace) {
|
|
2578
|
+
return new Error(`Integration "${ref.name}" not found in workspace "${ref.workspace}". ` + `Are you sure you published the integration? ` + `Run 'adk deploy' to publish it to your workspace.`);
|
|
2579
|
+
}
|
|
2580
|
+
return new Error(`Integration "${ref.name}" not found in workspace "${ref.workspace}". ` + `This integration may be private. Private integrations can only be installed in the same workspace. ` + `If you want to share this integration with other workspaces, deploy it with --visibility="unlisted" or --visibility="public".`);
|
|
2551
2581
|
}
|
|
2552
2582
|
validateIntegration(integration) {
|
|
2553
2583
|
const errors = [];
|
|
@@ -4496,7 +4526,7 @@ class AgentProjectGenerator {
|
|
|
4496
4526
|
deploy: "adk deploy"
|
|
4497
4527
|
},
|
|
4498
4528
|
dependencies: {
|
|
4499
|
-
"@botpress/runtime": `^${"1.3.
|
|
4529
|
+
"@botpress/runtime": `^${"1.3.13"}`
|
|
4500
4530
|
},
|
|
4501
4531
|
devDependencies: {
|
|
4502
4532
|
typescript: "^5.0.0"
|
|
@@ -7341,5 +7371,5 @@ export {
|
|
|
7341
7371
|
AgentProject
|
|
7342
7372
|
};
|
|
7343
7373
|
|
|
7344
|
-
//# debugId=
|
|
7374
|
+
//# debugId=19C19096A4A5691C64756E2164756E21
|
|
7345
7375
|
//# sourceMappingURL=index.js.map
|