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

@trimble-oss/trimble-id

Package Overview
Dependencies
Maintainers
7
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@trimble-oss/trimble-id - npm Package Compare versions

Comparing version 0.0.5-a1 to 0.0.5-a2

HttpClient.d.ts

2

AnalyticsHttpClient.js

@@ -28,3 +28,3 @@ (function (root, factory) {

sdkName = "@trimble-oss/trimble-id";
sdkVersion = "0.0.5a1";
sdkVersion = "0.0.5a2";

@@ -31,0 +31,0 @@ constructor() {

@@ -1,28 +0,15 @@

import HttpClient from "./HttpClient";
import { ITokenProvider } from "./ITokenProvider";
/**
* @description Http client provider for API using bearer token authorization
* @param tokenProvider can be a token provider like ClientCredentialTokenProvider
* @param {string} baseAddress
*/
declare class BearerTokenHttpClientProvider {
/**
* @description Public constructor for BearerTokenHttpClientProvider class
* @param tokenProvider can be a token provider like ClientCredentialTokenProvider
* @param {string} baseAddress
*/
constructor(tokenProvider: ITokenProvider, baseAddress: string);
import HttpClient from "./HttpClient"
/**
* @description Retrieves the client with the bearer token authorization
* @returns {PromiseLike<any>} A promise that retrieves the client on completion
*/
RetrieveClient(): Promise<typeof HttpClient>;
/**
* @description Retrieves the consumer key of the application
* @returns {string} It retrieves the consumer key of the application.
*/
RetrieveConsumerKey(): string;
/**
* @description Http client provider for API using bearer token authorization
* @param tokenProvider can be a token provider like ClientCredentialTokenProvider
* @param {string} baseAddress
*/
declare var BearerTokenHttpClientProvider: {
new(tokenProvider: ITokenProvider, baseAddress: string): {
RetrieveClient(): Promise<typeof HttpClient>;
RetrieveConsumerKey(): string;
};
}
export default BearerTokenHttpClientProvider
export default BearerTokenHttpClientProvider;

@@ -29,48 +29,49 @@ 'use strict';

*/
class BearerTokenHttpClientProvider {
var BearerTokenHttpClientProvider = function (tokenProvider, baseAddress) {
this._tokenProvider = tokenProvider;
this._baseAddress = baseAddress;
constructor(tokenProvider, baseAddress) {
this._tokenProvider = tokenProvider;
this._baseAddress = baseAddress;
this._consumerKey = this.RetrieveConsumerKey();
//Send analytics
this._analyticshttpclient = new imports.AnalyticsHttpClient()
this._analyticshttpclient.sendInitEvent(this.constructor.name, this._consumerKey);
}
//Send analytics
this._analyticshttpclient = new imports.AnalyticsHttpClient()
this._analyticshttpclient.sendInitEvent(this.constructor.name);
};
/**
* @description Retrieves the client with the bearer token authorization
* @returns {PromiseLike<any>} A promise that retrieves the client on completion
*/
RetrieveClient() {
//Send analytics
this._analyticshttpclient.sendMethodEvent("RetrieveClient", this._consumerKey);
/**
* @function
* @name RetrieveClaimset
* @returns {PromiseLike<any>} A promise that retrieves the client on completion
*/
BearerTokenHttpClientProvider.prototype.RetrieveClient = function () {
//Send analytics
this._analyticshttpclient.sendMethodEvent("RetrieveClient");
let self = this;
return new Promise(function (resolve, reject) {
self._tokenProvider.RetrieveToken()
.then((token) => {
let settings = {
headers: {
Authorization: 'Bearer ' + token,
}
};
resolve(new imports.HttpClient(self._baseAddress, settings));
})
.catch(reject);
});
};
var self = this;
return new Promise(function (resolve, reject) {
self._tokenProvider.RetrieveToken()
.then((token) => {
var settings = {
headers: {
Authorization: 'Bearer ' + token,
}
};
resolve(new imports.HttpClient(self._baseAddress, settings));
})
.catch(reject);
});
};
/**
* @description Retrieves the consumer key of the application
* @returns {string} It retrieves the consumer key of the application.
*/
RetrieveConsumerKey(){
if (this._tokenProvider != null) {
return this._tokenProvider._consumerKey;
}
return null;
};
}
return BearerTokenHttpClientProvider
/**
* @function
* @name RetrieveConsumerKey
* @returns {string} It retrieves the consumer key of the application.
*/
BearerTokenHttpClientProvider.prototype.RetrieveConsumerKey = function () {
if (this._tokenProvider != null) {
return this._tokenProvider._consumerKey;
}
return null;
};
// Exposed public methods
return BearerTokenHttpClientProvider;
}));

@@ -23,2 +23,7 @@ 'use strict';

/**
* Represents an HTTP client.
* @param baseAddress The base address of the HTTP client.
* @param defaultSettings The default settings for the HTTP client.
*/
var _httpClient = function (baseAddress = null, defaultSettings = {}) {

@@ -66,2 +71,10 @@ this._baseAddress = baseAddress;

/**
* Sends an HTTP POST request to the specified relative address.
*
* @param {string} relativeAddress - The relative address to send the request to.
* @param {any} value - The data to send with the request (optional).
* @param {object} requestSettings - The additional settings for the request (optional).
* @returns {Promise<any>} A promise that resolves with the response data if the request is successful, or rejects with an error message if the request fails.
*/
_httpClient.prototype.httpPost = function (relativeAddress, value = null, requestSettings = {}) {

@@ -88,2 +101,9 @@ var self = this;

/**
* Performs an HTTP GET request.
*
* @param {string} relativeAddress - The relative address of the resource.
* @param {object} requestSettings - The settings for the request.
* @returns {Promise<any>} - A promise that resolves with the response data.
*/
_httpClient.prototype.httpGet = function (relativeAddress, requestSettings = {}) {

@@ -109,2 +129,10 @@ var self = this;

/**
* Sends an HTTP PUT request to the specified relative address.
*
* @param {string} relativeAddress - The relative address to send the request to.
* @param {any} value - The data to send in the request body.
* @param {object} requestSettings - Additional settings for the request.
* @returns {Promise<any>} A promise that resolves with the response data if the request is successful, or rejects with an error message if the request fails.
*/
_httpClient.prototype.httpPut = function (relativeAddress, value = null, requestSettings = {}) {

@@ -131,2 +159,9 @@ var self = this;

/**
* Sends an HTTP PUT request and returns the full response.
* @param {string} relativeAddress - The relative address of the API endpoint.
* @param {any} value - The data to be sent in the request body.
* @param {object} requestSettings - Additional settings for the request.
* @returns {Promise<any>} A promise that resolves with the full response or rejects with an error.
*/
_httpClient.prototype.httpPut_FullResponse = function (relativeAddress, value = null, requestSettings = {}) {

@@ -153,2 +188,10 @@ var self = this;

/**
* Sends an HTTP PATCH request to the specified relative address.
*
* @param {string} relativeAddress - The relative address to send the request to.
* @param {any} value - The value to be sent in the request body.
* @param {object} requestSettings - Additional settings for the request.
* @returns {Promise<any>} A promise that resolves with the response data if the request is successful, or rejects with an error message if the request fails.
*/
_httpClient.prototype.httpPatch = function (relativeAddress, value = null, requestSettings = {}) {

@@ -175,2 +218,10 @@ var self = this;

/**
* Sends an HTTP DELETE request to the specified relative address.
*
* @param {string} relativeAddress - The relative address to send the DELETE request to.
* @param {any} content - The content to include in the request body.
* @param {object} requestSettings - The additional settings for the request.
* @returns {Promise<any>} A promise that resolves with the response data if the request is successful, or rejects with an error message if the request fails.
*/
_httpClient.prototype.httpDelete = function (relativeAddress, content = null, requestSettings = {}) {

@@ -198,2 +249,9 @@ var self = this;

/**
* Sends an HTTP POST request with JSON data.
* @param {string} relativeUrl - The relative URL to send the request to.
* @param {any} value - The JSON data to send in the request body.
* @param {object} requestSettings - Additional settings for the request (optional).
* @returns {Promise<any>} A promise that resolves with the response JSON or rejects with an error.
*/
_httpClient.prototype.httpPostJSON = function (relativeUrl, value, requestSettings = {}) {

@@ -217,2 +275,8 @@ var self = this;

/**
* Sends an HTTP GET request and returns the response as JSON.
* @param {string} relativeUrl - The relative URL to send the GET request to.
* @param {object} requestSettings - Additional settings for the request (optional).
* @returns {Promise<any>} - A promise that resolves with the JSON response.
*/
_httpClient.prototype.httpGetJSON = function (relativeUrl, requestSettings = {}) {

@@ -235,2 +299,9 @@ var self = this;

/**
* Sends an HTTP PUT request with JSON data.
* @param {string} relativeUrl - The relative URL to send the request to.
* @param {any} value - The JSON data to send in the request body.
* @param {object} requestSettings - Additional settings for the request (optional).
* @returns {Promise<any>} - A promise that resolves with the response data.
*/
_httpClient.prototype.httpPutJSON = function (relativeUrl, value, requestSettings = {}) {

@@ -254,2 +325,9 @@ var self = this;

/**
* Sends an HTTP PATCH request with JSON payload.
* @param {string} relativeUrl - The relative URL to send the request to.
* @param {any} value - The JSON payload to send with the request.
* @param {object} requestSettings - Additional settings for the request (optional).
* @returns {Promise<any>} A promise that resolves with the parsed JSON response, or undefined if the response is empty.
*/
_httpClient.prototype.httpPatchJSON = function (relativeUrl, value, requestSettings = {}) {

@@ -273,2 +351,9 @@ var self = this;

/**
* Sends an HTTP DELETE request and returns the response as JSON.
* @param {string} relativeUrl - The relative URL for the request.
* @param {any} content - The content to send with the request (optional).
* @param {object} requestSettings - Additional settings for the request (optional).
* @returns {Promise<any>} A promise that resolves with the parsed JSON response, or undefined if the response is empty.
*/
_httpClient.prototype.httpDeleteJSON = function (relativeUrl, content = null, requestSettings = {}) {

@@ -275,0 +360,0 @@ var self = this;

@@ -25,2 +25,6 @@ export { default as OpenIdEndpointProvider } from './OpenIdEndpointProvider'

export {default as SimpleHttpClientProvider } from './SimpleHttpClientProvider';
export { default as HttpClient } from './HttpClient';
export { default as AnalyticsHttpClient } from './AnalyticsHttpClient';

@@ -26,3 +26,7 @@ module.exports = {

SimpleHttpClientProvider: require('./SimpleHttpClientProvider'),
HttpClient: require('./HttpClient'),
AnalyticsHttpClient: require('./AnalyticsHttpClient')
}
{
"name": "@trimble-oss/trimble-id",
"version": "0.0.5a1",
"version": "0.0.5a2",
"description": "Trimble Identity SDK for JavaScript/ TypeScript",

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

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