New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

conjure-client

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

conjure-client - npm Package Compare versions

Comparing version 2.3.0 to 2.4.0

6

lib/fetchBridge/fetchBridge.d.ts

@@ -49,2 +49,7 @@ /**

constructor(params: IFetchBridgeParams);
call<T>(serviceName: string, endpointPath: string, endpointName: string, method: string, data?: any, headers?: {
[p: string]: string | number | boolean | undefined | null;
}, queryArguments?: {
[p: string]: any;
}, pathArguments?: any[], requestMediaType?: string, responseMediaType?: string): Promise<T>;
callEndpoint<T>(params: IHttpEndpointOptions): Promise<T>;

@@ -58,2 +63,3 @@ private makeFetchCall;

private normalizeWithNoLeadingSlash;
private getMediaType;
}

@@ -79,2 +79,17 @@ "use strict";

}
FetchBridge.prototype.call = function (serviceName, endpointPath, endpointName, method, data, headers, queryArguments, pathArguments, requestMediaType, responseMediaType) {
return this.callEndpoint({
serviceName: serviceName,
endpointPath: endpointPath,
endpointName: endpointName,
method: method,
data: data,
headers: headers == null ? {} : headers,
requestMediaType: requestMediaType == null ? httpApiBridge_1.MediaType.APPLICATION_JSON : this.getMediaType(requestMediaType),
responseMediaType: responseMediaType == null ? httpApiBridge_1.MediaType.APPLICATION_JSON : this.getMediaType(responseMediaType),
queryArguments: queryArguments == null ? {} : queryArguments,
pathArguments: pathArguments == null ? [] : pathArguments,
binaryAsStream: true,
});
};
FetchBridge.prototype.callEndpoint = function (params) {

@@ -255,2 +270,21 @@ return __awaiter(this, void 0, void 0, function () {

};
FetchBridge.prototype.getMediaType = function (value) {
if (value === httpApiBridge_1.MediaType.APPLICATION_JSON) {
return httpApiBridge_1.MediaType.APPLICATION_JSON;
}
else if (value === httpApiBridge_1.MediaType.APPLICATION_OCTET_STREAM) {
return httpApiBridge_1.MediaType.APPLICATION_OCTET_STREAM;
}
else if (value === httpApiBridge_1.MediaType.APPLICATION_X_WWW_FORM_URLENCODED) {
return httpApiBridge_1.MediaType.APPLICATION_X_WWW_FORM_URLENCODED;
}
else if (value === httpApiBridge_1.MediaType.MULTIPART_FORM_DATA) {
return httpApiBridge_1.MediaType.MULTIPART_FORM_DATA;
}
else if (value === httpApiBridge_1.MediaType.TEXT_PLAIN) {
return httpApiBridge_1.MediaType.TEXT_PLAIN;
}
// TODO(forozco): use safe errors
throw new Error("Unexpected media type " + value);
};
FetchBridge.ACCEPT_HEADER = "accept";

@@ -257,0 +291,0 @@ return FetchBridge;

2

lib/generated/index.d.ts

@@ -1,1 +0,1 @@

export declare const IMPLEMENTATION_VERSION = "2.3.0";
export declare const IMPLEMENTATION_VERSION = "2.4.0";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.IMPLEMENTATION_VERSION = '2.3.0';
exports.IMPLEMENTATION_VERSION = '2.4.0';
//# sourceMappingURL=index.js.map

@@ -52,2 +52,31 @@ /**

callEndpoint<T>(parameters: IHttpEndpointOptions): Promise<T>;
/**
* Identical to callEndpoint replacing a request object with individual parameters to reduce the total code size
* because of the field name overhead.
*/
call<T>(
/** Conjure service name. Doesn't affect the network request. */
serviceName: string,
/** Conjure endpoint name. Doesn't affect the network request. */
endpointName: string,
/** HTTP method. */
method: string,
/** Path to make a request to, e.g. "/foo/{param1}/bar". */
endpointPath: string,
/** Data to send in the body. */
data?: any,
/** HTTP headers. */
headers?: {
[header: string]: string | number | boolean | undefined | null;
},
/** Key-value mappings to be appended to the request query string. */
queryParams?: {
[paramName: string]: any;
},
/** Values to be interpolated into the endpointPath. */
pathArguments?: any[],
/** MIME type of the outgoing request, if absent defaults to "application/json" */
requestMediaType?: string,
/** MIME type of the expected server response, if absent defaults to "application/json" */
responseMediaType?: string): Promise<T>;
}
{
"name": "conjure-client",
"version": "2.3.0",
"version": "2.4.0",
"description": "An HTTP bridge library for use in front end applications and generated conjure code",

@@ -5,0 +5,0 @@ "sideEffects": false,

@@ -69,2 +69,31 @@ /**

public call<T>(
serviceName: string,
endpointPath: string,
endpointName: string,
method: string,
data?: any,
headers?: { [p: string]: string | number | boolean | undefined | null },
queryArguments?: { [p: string]: any },
pathArguments?: any[],
requestMediaType?: string,
responseMediaType?: string,
): Promise<T> {
return this.callEndpoint({
serviceName,
endpointPath,
endpointName,
method,
data,
headers: headers == null ? {} : headers,
requestMediaType:
requestMediaType == null ? MediaType.APPLICATION_JSON : this.getMediaType(requestMediaType),
responseMediaType:
responseMediaType == null ? MediaType.APPLICATION_JSON : this.getMediaType(responseMediaType),
queryArguments: queryArguments == null ? {} : queryArguments,
pathArguments: pathArguments == null ? [] : pathArguments,
binaryAsStream: true,
});
}
public async callEndpoint<T>(params: IHttpEndpointOptions): Promise<T> {

@@ -234,2 +263,18 @@ const fetchPromise = this.makeFetchCall(params);

}
private getMediaType(value: string): MediaType {
if (value === MediaType.APPLICATION_JSON) {
return MediaType.APPLICATION_JSON;
} else if (value === MediaType.APPLICATION_OCTET_STREAM) {
return MediaType.APPLICATION_OCTET_STREAM;
} else if (value === MediaType.APPLICATION_X_WWW_FORM_URLENCODED) {
return MediaType.APPLICATION_X_WWW_FORM_URLENCODED;
} else if (value === MediaType.MULTIPART_FORM_DATA) {
return MediaType.MULTIPART_FORM_DATA;
} else if (value === MediaType.TEXT_PLAIN) {
return MediaType.TEXT_PLAIN;
}
// TODO(forozco): use safe errors
throw new Error("Unexpected media type " + value);
}
}

@@ -1,1 +0,1 @@

export const IMPLEMENTATION_VERSION = '2.3.0';
export const IMPLEMENTATION_VERSION = '2.4.0';

@@ -63,2 +63,29 @@ /**

callEndpoint<T>(parameters: IHttpEndpointOptions): Promise<T>;
/**
* Identical to callEndpoint replacing a request object with individual parameters to reduce the total code size
* because of the field name overhead.
*/
call<T>(
/** Conjure service name. Doesn't affect the network request. */
serviceName: string,
/** Conjure endpoint name. Doesn't affect the network request. */
endpointName: string,
/** HTTP method. */
method: string,
/** Path to make a request to, e.g. "/foo/{param1}/bar". */
endpointPath: string,
/** Data to send in the body. */
data?: any,
/** HTTP headers. */
headers?: { [header: string]: string | number | boolean | undefined | null },
/** Key-value mappings to be appended to the request query string. */
queryParams?: { [paramName: string]: any },
/** Values to be interpolated into the endpointPath. */
pathArguments?: any[],
/** MIME type of the outgoing request, if absent defaults to "application/json" */
requestMediaType?: string,
/** MIME type of the expected server response, if absent defaults to "application/json" */
responseMediaType?: string,
): Promise<T>;
}

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