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

@fusionauth/typescript-client

Package Overview
Dependencies
Maintainers
3
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fusionauth/typescript-client - npm Package Compare versions

Comparing version 1.10.0 to 1.10.1

26

build/src/DefaultRESTClient.d.ts

@@ -6,2 +6,3 @@ import IRESTClient from "./IRESTClient";

* @author Tyler Scott
* @author TJ Peden
*/

@@ -11,10 +12,7 @@ export default class DefaultRESTClient implements IRESTClient {

body: string;
headers: {
[key: string]: string;
};
headers: Record<string, string>;
method: string;
parameters: {
[key: string]: string;
};
parameters: Record<string, string>;
uri: string;
credentials: RequestCredentials;
constructor(host: string);

@@ -27,7 +25,7 @@ /**

*/
withAuthorization(key: any): DefaultRESTClient;
withAuthorization(key: string): DefaultRESTClient;
/**
* Adds a segment to the request uri
*/
withUriSegment(segment: any): DefaultRESTClient;
withUriSegment(segment: string | number): DefaultRESTClient;
/**

@@ -53,7 +51,7 @@ * Get the full url + parameter list

*/
withMethod(method: any): DefaultRESTClient;
withMethod(method: string): DefaultRESTClient;
/**
* Sets the uri of the request
*/
withUri(uri: any): DefaultRESTClient;
withUri(uri: string): DefaultRESTClient;
/**

@@ -65,4 +63,10 @@ * Adds parameters to the request.

*/
withParameter(name: any, value: any): DefaultRESTClient;
withParameter(name: string, value: any): DefaultRESTClient;
/**
* Sets request's credentials.
*
* @param value A string indicating whether credentials will be sent with the request always, never, or only when sent to a same-origin URL.
*/
withCredentials(value: RequestCredentials): DefaultRESTClient;
/**
* Run the request and return a promise. This promise will resolve if the request is successful

@@ -69,0 +73,0 @@ * and reject otherwise.

@@ -17,8 +17,17 @@ "use strict";

*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const ClientResponse_1 = require("./ClientResponse");
let request = require("request");
const cross_fetch_1 = require("cross-fetch");
/**
* @author Brett P
* @author Tyler Scott
* @author TJ Peden
*/

@@ -112,2 +121,11 @@ class DefaultRESTClient {

/**
* Sets request's credentials.
*
* @param value A string indicating whether credentials will be sent with the request always, never, or only when sent to a same-origin URL.
*/
withCredentials(value) {
this.credentials = value;
return this;
}
/**
* Run the request and return a promise. This promise will resolve if the request is successful

@@ -117,30 +135,21 @@ * and reject otherwise.

go() {
return new Promise((resolve, reject) => {
request({
uri: this.getFullUrl(),
method: this.method,
headers: this.headers,
body: this.body
}, (error, response, body) => {
let clientResponse = new ClientResponse_1.default();
if (error) {
clientResponse.exception = error;
reject(clientResponse);
}
else {
clientResponse.statusCode = response.statusCode;
clientResponse.response = body;
try { // Try parsing as json
clientResponse.response = JSON.parse(body);
}
catch (e) {
}
if (clientResponse.wasSuccessful()) {
resolve(clientResponse);
}
else {
reject(clientResponse);
}
}
});
return __awaiter(this, void 0, void 0, function* () {
const clientResponse = new ClientResponse_1.default();
try {
const response = yield cross_fetch_1.default(this.getFullUrl(), {
method: this.method,
headers: this.headers,
body: this.body,
credentials: this.credentials,
});
clientResponse.statusCode = response.status;
clientResponse.response = yield response.json();
}
catch (error) {
clientResponse.exception = error;
}
if (!clientResponse.wasSuccessful()) {
throw clientResponse;
}
return clientResponse;
});

@@ -147,0 +156,0 @@ }

@@ -9,7 +9,7 @@ import ClientResponse from "./ClientResponse";

*/
withAuthorization(key: any): IRESTClient;
withAuthorization(key: string): IRESTClient;
/**
* Adds a segment to the request uri
*/
withUriSegment(segment: any): IRESTClient;
withUriSegment(segment: string | number): IRESTClient;
/**

@@ -31,7 +31,7 @@ * Adds a header to the request.

*/
withMethod(method: any): IRESTClient;
withMethod(method: string): IRESTClient;
/**
* Sets the uri of the request
*/
withUri(uri: any): IRESTClient;
withUri(uri: string): IRESTClient;
/**

@@ -43,4 +43,10 @@ * Adds parameters to the request.

*/
withParameter(name: any, value: any): IRESTClient;
withParameter(name: string, value: any): IRESTClient;
/**
* Sets request's credentials.
*
* @param value A string indicating whether credentials will be sent with the request always, never, or only when sent to a same-origin URL.
*/
withCredentials(value: RequestCredentials): IRESTClient;
/**
* Run the request and return a promise. This promise will resolve if the request is successful

@@ -47,0 +53,0 @@ * and reject otherwise.

{
"name": "@fusionauth/typescript-client",
"version": "1.10.0",
"version": "1.10.1",
"description": "A typescript implementation of the FusionAuth client.",

@@ -54,4 +54,3 @@ "main": "build/index.js",

"dependencies": {
"request": "^2.88.0",
"xhr": "^2.5.0"
"cross-fetch": "^3.0.4"
},

@@ -58,0 +57,0 @@ "browser": {

@@ -8,3 +8,6 @@ ## FusionAuth TypeScript Client

Installation
## Credits
* Thanks to [@tjpeden](https://github.com/tjpeden) for your excellent contributions!
## Installation
To install fusionauth-typescript-client, use npm

@@ -11,0 +14,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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