@mondaydotcomorg/atp-server 0.19.17 → 0.20.0

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
@@ -6324,7 +6324,7 @@ function convertOperation(path, method, operation, spec, baseURL, options, auth)
6324
6324
  const inputSchema = buildInputSchema(operation, spec);
6325
6325
  const outputSchema = buildOutputSchema(operation, spec);
6326
6326
  extractAnnotations(operation, operationKey, options.annotations);
6327
- const handler = /* @__PURE__ */ __name(async (params) => {
6327
+ const handler = /* @__PURE__ */ __name(async (params, handlerContext) => {
6328
6328
  const input = params || {};
6329
6329
  let requestPath = path;
6330
6330
  const queryParams = {};
@@ -6332,7 +6332,18 @@ function convertOperation(path, method, operation, spec, baseURL, options, auth)
6332
6332
  const headers = {
6333
6333
  "Content-Type": "application/json"
6334
6334
  };
6335
- if (auth) {
6335
+ let context;
6336
+ if (options.contextProvider) {
6337
+ context = await options.contextProvider(handlerContext?.requestContext);
6338
+ }
6339
+ if (options.headerProvider) {
6340
+ const dynamicHeaders = await options.headerProvider(input, context);
6341
+ Object.assign(headers, dynamicHeaders);
6342
+ atpRuntime.log.debug("Added headers from headerProvider", {
6343
+ keys: Object.keys(dynamicHeaders)
6344
+ });
6345
+ }
6346
+ if (auth && !headers["Authorization"]) {
6336
6347
  if (auth.scheme === "bearer" && auth.envVar) {
6337
6348
  let token = null;
6338
6349
  if (options.authProvider) {