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QAAS,EAAO,QAChB,eAAgB,EAAO,eACvB,WAAY,EAAO,WACnB,QAAS,EAAO,SAGZ,EAAmB,0BAAwB,UAC/C,EACA,GAmBF,OAhBA,EAAW,UAAY,SAAC,EAAQ,EAAc,EAAQ,EAAkB,QAC/C,IAAnB,IAA8B,EAAiB,SACxC,IAAP,IAAkB,EAAK,IAE3B,IAAM,EAAU,CACZ,KAAM,EAAO,cACb,KAAM,EAAgB,qBAAY,MAAM,GAAc,OAAO,GAC7D,QAAS,EAAiB,SAAW,GACrC,QAAS,EAAiB,SAAW,EACrC,YAAa,EAAiB,YAC9B,KAAM,GAGV,OAAO,EAAiB,YAAY,EAAS,EAAU,EAAkB,EAAO,OACjF,EAEM,CACR,E,aAEc,kB","file":"/npm/aws-api-gateway-client-ok@0.3.8/dist/apigClient.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/aws-api-gateway-client-ok@0.3.8/dist/apigClient.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","/*\n * Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\").\n * You may not use this file except in compliance with the License.\n * A copy of the License is located at\n *\n *  http://aws.amazon.com/apache2.0\n *\n * or in the \"license\" file accompanying this file. This file is distributed\n * on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n * express or implied. See the License for the specific language governing\n * permissions and limitations under the License.\n */\n\nimport uritemplate from 'url-template';\nimport apiGatewayClientFactory from './lib/apiGatewayCore/apiGatewayClient';\n\nconst apigClientFactory = {};\n\nconst removeEmpty = (obj) => {\n  Object.keys(obj).forEach((key) =>\n    (obj[key] && typeof obj[key] === 'object') && removeEmpty(obj[key])\n    || (obj[key] === undefined) && delete obj[key]\n  );\n  return obj;\n};\n\napigClientFactory.newClient = (config = {}) => {\n  const apigClient = {};\n\n  config = Object.assign({\n    accessKey: '',\n    secretKey: '',\n    sessionToken: '',\n    region: '',\n    apiKey: '',\n    invokeUrl: '',\n    service: 'execute-api',\n    defaultContentType: 'application/json',\n    defaultAcceptType: 'application/json',\n    systemClockOffset: 0,\n    headers: {},\n    host: undefined,\n  }, removeEmpty(config));\n\n  // extract endpoint and path from url\n  const invokeUrl = config.invokeUrl;\n  if (!invokeUrl) {\n    throw new Error(\"invokeUrl must be specified!\");\n  }\n\n  const endpoint = /(^https?:\\/\\/[^/]+)/g.exec(invokeUrl)[1];\n  const pathComponent = invokeUrl.substring(endpoint.length);\n\n  const sigV4ClientConfig = {\n    accessKey: config.accessKey,\n    secretKey: config.secretKey,\n    sessionToken: config.sessionToken,\n    serviceName: config.service,\n    region: config.region,\n    endpoint: endpoint,\n    defaultContentType: config.defaultContentType,\n    defaultAcceptType: config.defaultAcceptType,\n    systemClockOffset: config.systemClockOffset,\n    retries: config.retries,\n    retryCondition: config.retryCondition,\n    retryDelay: config.retryDelay,\n    host: config.host,\n  };\n\n  let authType = 'NONE';\n  if (\n    sigV4ClientConfig.accessKey !== undefined\n    && sigV4ClientConfig.accessKey !== ''\n    && sigV4ClientConfig.secretKey !== undefined\n    && sigV4ClientConfig.secretKey !== ''\n  ) {\n      authType = 'AWS_IAM';\n  }\n\n  const simpleHttpClientConfig = {\n    endpoint: endpoint,\n    defaultContentType: config.defaultContentType,\n    defaultAcceptType: config.defaultAcceptType,\n    retries: config.retries,\n    retryCondition: config.retryCondition,\n    retryDelay: config.retryDelay,\n    headers: config.headers,\n  };\n\n  const apiGatewayClient = apiGatewayClientFactory.newClient(\n    simpleHttpClientConfig,\n    sigV4ClientConfig\n  );\n\n  apigClient.invokeApi = (params, pathTemplate, method, additionalParams, body) => {\n    if (additionalParams===undefined) additionalParams={};\n    if (body===undefined) body='';\n\n    const request = {\n        verb: method.toUpperCase(),\n        path: pathComponent + uritemplate.parse(pathTemplate).expand(params),\n        headers: additionalParams.headers || {},\n        timeout: additionalParams.timeout || 0,\n        queryParams: additionalParams.queryParams,\n        body: body\n    };\n\n    return apiGatewayClient.makeRequest(request, authType, additionalParams, config.apiKey);\n  };\n\n  return apigClient;\n};\n\nexport default apigClientFactory;\n"]}