@utcp/http 1.0.13 → 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 CHANGED
@@ -4105,7 +4105,8 @@ var HttpCallTemplateSchema = external_exports.object({
4105
4105
  return new import_sdk.AuthSerializer().validateDict(val);
4106
4106
  }
4107
4107
  return val;
4108
- }).describe("Authentication configuration for generated tools")
4108
+ }).describe("Authentication configuration for generated tools"),
4109
+ allowed_communication_protocols: external_exports.array(external_exports.string()).optional().describe("Optional list of allowed communication protocol types for tools within this manual.")
4109
4110
  });
4110
4111
  var HttpCallTemplateSerializer = class extends import_sdk2.Serializer {
4111
4112
  toDict(obj) {
@@ -4119,7 +4120,8 @@ var HttpCallTemplateSerializer = class extends import_sdk2.Serializer {
4119
4120
  auth_tools: obj.auth_tools ? new import_sdk.AuthSerializer().toDict(obj.auth_tools) : null,
4120
4121
  headers: obj.headers,
4121
4122
  body_field: obj.body_field,
4122
- header_fields: obj.header_fields
4123
+ header_fields: obj.header_fields,
4124
+ allowed_communication_protocols: obj.allowed_communication_protocols
4123
4125
  };
4124
4126
  }
4125
4127
  validateDict(obj) {
@@ -4146,7 +4148,8 @@ var StreamableHttpCallTemplateSchema = external_exports.object({
4146
4148
  auth: import_sdk3.AuthSchema.optional().describe("Optional authentication configuration."),
4147
4149
  headers: external_exports.record(external_exports.string(), external_exports.string()).optional().describe("Optional static headers to include in requests."),
4148
4150
  body_field: external_exports.string().nullable().optional().describe("The name of the single input field to be sent as the request body."),
4149
- header_fields: external_exports.array(external_exports.string()).nullable().optional().describe("List of input fields to be sent as request headers.")
4151
+ header_fields: external_exports.array(external_exports.string()).nullable().optional().describe("List of input fields to be sent as request headers."),
4152
+ allowed_communication_protocols: external_exports.array(external_exports.string()).optional().describe("Optional list of allowed communication protocol types for tools within this manual.")
4150
4153
  });
4151
4154
  var StreamableHttpCallTemplateSerializer = class extends import_sdk4.Serializer {
4152
4155
  /**
@@ -4165,7 +4168,8 @@ var StreamableHttpCallTemplateSerializer = class extends import_sdk4.Serializer
4165
4168
  auth: obj.auth,
4166
4169
  headers: obj.headers,
4167
4170
  body_field: obj.body_field,
4168
- header_fields: obj.header_fields
4171
+ header_fields: obj.header_fields,
4172
+ allowed_communication_protocols: obj.allowed_communication_protocols
4169
4173
  };
4170
4174
  }
4171
4175
  /**
@@ -4195,7 +4199,8 @@ var SseCallTemplateSchema = external_exports.object({
4195
4199
  auth: import_sdk5.AuthSchema.optional().describe("Optional authentication configuration."),
4196
4200
  headers: external_exports.record(external_exports.string(), external_exports.string()).optional().describe("Optional static headers for the initial connection."),
4197
4201
  body_field: external_exports.string().nullable().optional().describe("The name of the single input field to be sent as the request body."),
4198
- header_fields: external_exports.array(external_exports.string()).nullable().optional().describe("List of input fields to be sent as request headers for the initial connection.")
4202
+ header_fields: external_exports.array(external_exports.string()).nullable().optional().describe("List of input fields to be sent as request headers for the initial connection."),
4203
+ allowed_communication_protocols: external_exports.array(external_exports.string()).optional().describe("Optional list of allowed communication protocol types for tools within this manual.")
4199
4204
  });
4200
4205
  var SseCallTemplateSerializer = class extends import_sdk6.Serializer {
4201
4206
  /**
@@ -4213,7 +4218,8 @@ var SseCallTemplateSerializer = class extends import_sdk6.Serializer {
4213
4218
  auth: obj.auth,
4214
4219
  headers: obj.headers,
4215
4220
  body_field: obj.body_field,
4216
- header_fields: obj.header_fields
4221
+ header_fields: obj.header_fields,
4222
+ allowed_communication_protocols: obj.allowed_communication_protocols
4217
4223
  };
4218
4224
  }
4219
4225
  /**
@@ -4243,6 +4249,7 @@ var OpenApiConverter = class {
4243
4249
  spec_url;
4244
4250
  base_url;
4245
4251
  auth_tools;
4252
+ headers;
4246
4253
  placeholder_counter = 0;
4247
4254
  call_template_name;
4248
4255
  /**
@@ -4260,6 +4267,7 @@ var OpenApiConverter = class {
4260
4267
  this.spec_url = options?.specUrl;
4261
4268
  this.base_url = options?.baseUrl;
4262
4269
  this.auth_tools = options?.authTools;
4270
+ this.headers = options?.headers;
4263
4271
  this.placeholder_counter = 0;
4264
4272
  let callTemplateName = options?.callTemplateName;
4265
4273
  if (!callTemplateName) {
@@ -4398,6 +4406,7 @@ var OpenApiConverter = class {
4398
4406
  url: fullUrl,
4399
4407
  body_field: bodyField ?? void 0,
4400
4408
  header_fields: headerFields.length > 0 ? headerFields : void 0,
4409
+ headers: this.headers,
4401
4410
  auth,
4402
4411
  content_type: "application/json",
4403
4412
  timeout: 30
@@ -4532,6 +4541,9 @@ var OpenApiConverter = class {
4532
4541
  * @returns An Auth object or undefined if no authentication is specified.
4533
4542
  */
4534
4543
  _extractAuth(operation) {
4544
+ if (this.auth_tools === null) {
4545
+ return void 0;
4546
+ }
4535
4547
  let securityRequirements = operation.security || [];
4536
4548
  if (!securityRequirements.length) {
4537
4549
  securityRequirements = this.spec.security || [];
@@ -4745,7 +4757,9 @@ var HttpCommunicationProtocol = class {
4745
4757
  this._logInfo(`Assuming OpenAPI spec from '${httpCallTemplate.name}'. Converting to UTCP manual.`);
4746
4758
  const converter = new OpenApiConverter(responseData, {
4747
4759
  specUrl: httpCallTemplate.url,
4748
- callTemplateName: httpCallTemplate.name
4760
+ callTemplateName: httpCallTemplate.name,
4761
+ authTools: httpCallTemplate.auth_tools,
4762
+ headers: httpCallTemplate.headers
4749
4763
  });
4750
4764
  utcpManual = converter.convert();
4751
4765
  } else {