Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@influxdata/oats

Package Overview
Dependencies
Maintainers
17
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@influxdata/oats - npm Package Compare versions

Comparing version 0.4.0 to 0.5.0

59

dist/format.js

@@ -44,3 +44,3 @@ "use strict";

options: RequestOptions = {}
): Promise<${resultName(pathOp)}> =>
): Promise<${resultName(pathOp)}> =>
request(

@@ -71,3 +71,22 @@ "${pathOp.operation.toUpperCase()}",

const request = async (
export type RequestHandler = (
url: string,
query: string,
init: RequestInit
) => {url: string, query: string, init: RequestInit}
export type ResponseHandler = (
status: number,
headers: Headers,
data: any
) => {status: number, headers: Headers, data: any}
const RequestContext = function(
requestHandler: RequestHandler,
responseHandler: ResponseHandler
) {
this.requestHandler = requestHandler
this.responseHandler = responseHandler
}
RequestContext.prototype.request = async function(
method: string,

@@ -77,3 +96,3 @@ url: string,

options: RequestOptions = {}
): Promise<any> => {
): Promise<any> {
const requestHeaders = new Headers(params.headers)

@@ -95,10 +114,16 @@ const contentType = requestHeaders.get("Content-Type") || ""

const response = await fetch(\`\${url}\${query}\`, {
const {
url: middlewareUrl,
query: middlewareQuery,
init,
} = this.requestHandler(url, query, {
method,
body,
credentials: "same-origin",
credentials: 'same-origin',
signal: options.signal,
headers: requestHeaders
headers: requestHeaders,
})
const response = await fetch(\`\${middlewareUrl}\${middlewareQuery}\`, init)
const { status, headers } = response

@@ -117,6 +142,26 @@ const responseContentType = headers.get("Content-Type") || ""

return { status, headers, data }
return this.responseHandler(status, headers, data)
}
RequestContext.prototype.setRequestHandler = function(requestHandler: RequestHandler) {
this.requestHandler = requestHandler
}
RequestContext.prototype.setResponseHandler = function(responseHandler: ResponseHandler) {
this.responseHandler = responseHandler
}
const rc = new RequestContext(
(url, query, init) => {
return {url, query, init}
},
(status, headers, data) => {
return {status, headers, data}
}
)
const request = rc.request.bind(rc)
export const setRequestHandler = rc.setRequestHandler.bind(rc)
export const setResponseHandler = rc.setResponseHandler.bind(rc)
`.trim();

@@ -123,0 +168,0 @@ }

2

package.json
{
"name": "@influxdata/oats",
"version": "0.4.0",
"version": "0.5.0",
"description": "",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc