@utcp/http 1.1.0 → 1.1.1
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/index.cjs +9 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -321,8 +321,19 @@ declare class SseCommunicationProtocol implements CommunicationProtocol {
|
|
|
321
321
|
interface OpenApiConverterOptions {
|
|
322
322
|
specUrl?: string;
|
|
323
323
|
callTemplateName?: string;
|
|
324
|
-
|
|
324
|
+
/**
|
|
325
|
+
* Authentication configuration for generated tools.
|
|
326
|
+
* - undefined: Auto-generate placeholder auth from OpenAPI security schemes
|
|
327
|
+
* - null: Explicitly disable auth for all generated tools
|
|
328
|
+
* - Auth object: Use the provided auth configuration
|
|
329
|
+
*/
|
|
330
|
+
authTools?: Auth | null;
|
|
325
331
|
baseUrl?: string;
|
|
332
|
+
/**
|
|
333
|
+
* Static headers to include in all generated tool call templates.
|
|
334
|
+
* These headers will be sent with every tool request.
|
|
335
|
+
*/
|
|
336
|
+
headers?: Record<string, string>;
|
|
326
337
|
}
|
|
327
338
|
/**
|
|
328
339
|
* REQUIRED
|
|
@@ -338,6 +349,7 @@ declare class OpenApiConverter {
|
|
|
338
349
|
private spec_url;
|
|
339
350
|
private base_url;
|
|
340
351
|
private auth_tools;
|
|
352
|
+
private headers;
|
|
341
353
|
private placeholder_counter;
|
|
342
354
|
private call_template_name;
|
|
343
355
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -321,8 +321,19 @@ declare class SseCommunicationProtocol implements CommunicationProtocol {
|
|
|
321
321
|
interface OpenApiConverterOptions {
|
|
322
322
|
specUrl?: string;
|
|
323
323
|
callTemplateName?: string;
|
|
324
|
-
|
|
324
|
+
/**
|
|
325
|
+
* Authentication configuration for generated tools.
|
|
326
|
+
* - undefined: Auto-generate placeholder auth from OpenAPI security schemes
|
|
327
|
+
* - null: Explicitly disable auth for all generated tools
|
|
328
|
+
* - Auth object: Use the provided auth configuration
|
|
329
|
+
*/
|
|
330
|
+
authTools?: Auth | null;
|
|
325
331
|
baseUrl?: string;
|
|
332
|
+
/**
|
|
333
|
+
* Static headers to include in all generated tool call templates.
|
|
334
|
+
* These headers will be sent with every tool request.
|
|
335
|
+
*/
|
|
336
|
+
headers?: Record<string, string>;
|
|
326
337
|
}
|
|
327
338
|
/**
|
|
328
339
|
* REQUIRED
|
|
@@ -338,6 +349,7 @@ declare class OpenApiConverter {
|
|
|
338
349
|
private spec_url;
|
|
339
350
|
private base_url;
|
|
340
351
|
private auth_tools;
|
|
352
|
+
private headers;
|
|
341
353
|
private placeholder_counter;
|
|
342
354
|
private call_template_name;
|
|
343
355
|
/**
|
package/dist/index.js
CHANGED
|
@@ -4211,6 +4211,7 @@ var OpenApiConverter = class {
|
|
|
4211
4211
|
spec_url;
|
|
4212
4212
|
base_url;
|
|
4213
4213
|
auth_tools;
|
|
4214
|
+
headers;
|
|
4214
4215
|
placeholder_counter = 0;
|
|
4215
4216
|
call_template_name;
|
|
4216
4217
|
/**
|
|
@@ -4228,6 +4229,7 @@ var OpenApiConverter = class {
|
|
|
4228
4229
|
this.spec_url = options?.specUrl;
|
|
4229
4230
|
this.base_url = options?.baseUrl;
|
|
4230
4231
|
this.auth_tools = options?.authTools;
|
|
4232
|
+
this.headers = options?.headers;
|
|
4231
4233
|
this.placeholder_counter = 0;
|
|
4232
4234
|
let callTemplateName = options?.callTemplateName;
|
|
4233
4235
|
if (!callTemplateName) {
|
|
@@ -4366,6 +4368,7 @@ var OpenApiConverter = class {
|
|
|
4366
4368
|
url: fullUrl,
|
|
4367
4369
|
body_field: bodyField ?? void 0,
|
|
4368
4370
|
header_fields: headerFields.length > 0 ? headerFields : void 0,
|
|
4371
|
+
headers: this.headers,
|
|
4369
4372
|
auth,
|
|
4370
4373
|
content_type: "application/json",
|
|
4371
4374
|
timeout: 30
|
|
@@ -4500,6 +4503,9 @@ var OpenApiConverter = class {
|
|
|
4500
4503
|
* @returns An Auth object or undefined if no authentication is specified.
|
|
4501
4504
|
*/
|
|
4502
4505
|
_extractAuth(operation) {
|
|
4506
|
+
if (this.auth_tools === null) {
|
|
4507
|
+
return void 0;
|
|
4508
|
+
}
|
|
4503
4509
|
let securityRequirements = operation.security || [];
|
|
4504
4510
|
if (!securityRequirements.length) {
|
|
4505
4511
|
securityRequirements = this.spec.security || [];
|
|
@@ -4713,7 +4719,9 @@ var HttpCommunicationProtocol = class {
|
|
|
4713
4719
|
this._logInfo(`Assuming OpenAPI spec from '${httpCallTemplate.name}'. Converting to UTCP manual.`);
|
|
4714
4720
|
const converter = new OpenApiConverter(responseData, {
|
|
4715
4721
|
specUrl: httpCallTemplate.url,
|
|
4716
|
-
callTemplateName: httpCallTemplate.name
|
|
4722
|
+
callTemplateName: httpCallTemplate.name,
|
|
4723
|
+
authTools: httpCallTemplate.auth_tools,
|
|
4724
|
+
headers: httpCallTemplate.headers
|
|
4717
4725
|
});
|
|
4718
4726
|
utcpManual = converter.convert();
|
|
4719
4727
|
} else {
|