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

@equinor/fusion-framework-module-http

Package Overview
Dependencies
Maintainers
3
Versions
126
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@equinor/fusion-framework-module-http - npm Package Compare versions

Comparing version 2.1.4 to 2.1.5

6

CHANGELOG.md

@@ -6,2 +6,8 @@ # Change Log

## 2.1.5 (2022-11-18)
### Bug Fixes
- **module-http:** add headers to json request ([8223394](https://github.com/equinor/fusion-framework/commit/8223394362a24663bf65442025f0b031aa37a910))
## 2.1.4 (2022-11-11)

@@ -8,0 +14,0 @@

6

dist/esm/configurator.js
import { HttpRequestHandler } from './lib/operators';
export class HttpClientConfigurator {
get clients() {
return Object.assign({}, this._clients);
}
constructor(client) {

@@ -8,5 +11,2 @@ this._clients = {};

}
get clients() {
return Object.assign({}, this._clients);
}
hasClient(name) {

@@ -13,0 +13,0 @@ return Object.keys(this._clients).includes(name);

@@ -18,2 +18,8 @@ var __rest = (this && this.__rest) || function (s, e) {

export class HttpClient {
get request$() {
return this._request$.asObservable();
}
get response$() {
return this._response$.asObservable();
}
constructor(uri, options) {

@@ -29,8 +35,2 @@ var _a, _b;

}
get request$() {
return this._request$.asObservable();
}
get response$() {
return this._response$.asObservable();
}
_init() {

@@ -51,6 +51,7 @@ }

const selector = (_a = args === null || args === void 0 ? void 0 : args.selector) !== null && _a !== void 0 ? _a : jsonSelector;
const header = new Headers(args === null || args === void 0 ? void 0 : args.headers);
header.append('Content-Type', 'application/json');
const headers = new Headers(args === null || args === void 0 ? void 0 : args.headers);
headers.append('Content-Type', 'application/json');
return this.fetch$(path, Object.assign(Object.assign({}, args), { body,
selector }));
selector,
headers }));
}

@@ -57,0 +58,0 @@ json(path, args) {

@@ -16,8 +16,8 @@ export class ClientNotFoundException extends Error {

export class HttpClientProvider {
get defaultHttpRequestHandler() {
return this.config.defaultHttpRequestHandler;
}
constructor(config) {
this.config = config;
}
get defaultHttpRequestHandler() {
return this.config.defaultHttpRequestHandler;
}
hasClient(key) {

@@ -24,0 +24,0 @@ return Object.keys(this.config.clients).includes(key);

@@ -18,3 +18,3 @@ import { HttpRequestHandler } from './lib/operators';

}
export declare type HttpClientRequestInitType<T extends IHttpClient> = T extends IHttpClient<infer U> ? U : never;
export type HttpClientRequestInitType<T extends IHttpClient> = T extends IHttpClient<infer U> ? U : never;
export interface IHttpClientConfigurator<TClient extends IHttpClient = IHttpClient> {

@@ -21,0 +21,0 @@ readonly clients: Record<string, HttpClientOptions<TClient>>;

import type { Observable } from 'rxjs';
import type { FetchRequestInit, FetchRequest, FetchResponse } from '.';
import { HttpClient } from './client';
declare type MsalFetchRequest = FetchRequest & {
type MsalFetchRequest = FetchRequest & {
scopes?: string[];
};
declare type MsalFetchRequestInit<TReturn = unknown, TRequest = FetchRequest, TResponse = FetchResponse> = FetchRequestInit<TReturn, TRequest, TResponse> & Pick<MsalFetchRequest, 'scopes'>;
type MsalFetchRequestInit<TReturn = unknown, TRequest = FetchRequest, TResponse = FetchResponse> = FetchRequestInit<TReturn, TRequest, TResponse> & Pick<MsalFetchRequest, 'scopes'>;
export declare class HttpClientMsal<TRequest extends MsalFetchRequest = MsalFetchRequest, TResponse = FetchResponse> extends HttpClient<TRequest, TResponse> {

@@ -9,0 +9,0 @@ defaultScopes: string[];

@@ -5,3 +5,3 @@ import { Subject } from 'rxjs';

import type { FetchRequest, FetchRequestInit, FetchResponse, IHttpClient, StreamResponse } from '.';
export declare type HttpClientCreateOptions<TRequest extends FetchRequest = FetchRequest, TResponse = Response> = {
export type HttpClientCreateOptions<TRequest extends FetchRequest = FetchRequest, TResponse = Response> = {
requestHandler: IHttpRequestHandler<TRequest>;

@@ -8,0 +8,0 @@ responseHandler: IHttpResponseHandler<TResponse>;

import type { ObservableInput, Observable } from 'rxjs';
import type { IHttpRequestHandler, IHttpResponseHandler } from '../operators/types';
export declare type StreamResponse<T> = Observable<T>;
export declare type FetchRequest = RequestInit & {
export type StreamResponse<T> = Observable<T>;
export type FetchRequest = RequestInit & {
uri: string;
path: string;
};
export declare type FetchResponse<T = unknown> = Response & {
export type FetchResponse<T = unknown> = Response & {
json(): Promise<T>;
};
export declare type FetchRequestInit<TReturn = unknown, TRequest = FetchRequest, TResponse = FetchResponse<TReturn>> = Omit<TRequest, 'uri' | 'path'> & {
export type FetchRequestInit<TReturn = unknown, TRequest = FetchRequest, TResponse = FetchResponse<TReturn>> = Omit<TRequest, 'uri' | 'path'> & {
selector?: (response: TResponse) => ObservableInput<TReturn>;
};
export declare type ClientRequestInit<T extends IHttpClient, TReturn = unknown> = T extends IHttpClient<infer TRequest, infer TResponse> ? FetchRequestInit<TReturn, TRequest, TResponse> : never;
export declare type ExecutionMethod = 'fetch' | 'fetch$' | 'json' | 'json$';
export declare type ExecutionMethodParameters<TMethod extends ExecutionMethod = 'fetch', TClient extends IHttpClient = IHttpClient> = Parameters<TClient[TMethod]>;
export declare type ExecutionResponse<TMethod extends ExecutionMethod = 'fetch', TClient extends IHttpClient = IHttpClient> = ReturnType<TClient[TMethod]>;
export type ClientRequestInit<T extends IHttpClient, TReturn = unknown> = T extends IHttpClient<infer TRequest, infer TResponse> ? FetchRequestInit<TReturn, TRequest, TResponse> : never;
export type ExecutionMethod = 'fetch' | 'fetch$' | 'json' | 'json$';
export type ExecutionMethodParameters<TMethod extends ExecutionMethod = 'fetch', TClient extends IHttpClient = IHttpClient> = Parameters<TClient[TMethod]>;
export type ExecutionResponse<TMethod extends ExecutionMethod = 'fetch', TClient extends IHttpClient = IHttpClient> = ReturnType<TClient[TMethod]>;
export interface IHttpClient<TRequest extends FetchRequest = FetchRequest, TResponse = Response> {

@@ -19,0 +19,0 @@ uri: string;

import type { Observable } from 'rxjs';
import type { FetchRequest } from '../client';
export declare type ProcessOperator<T, R = T> = (request: T) => R | void | Promise<R | void>;
export type ProcessOperator<T, R = T> = (request: T) => R | void | Promise<R | void>;
export interface IProcessOperators<T> {

@@ -5,0 +5,0 @@ add(key: string, operator: ProcessOperator<T>): IProcessOperators<T>;

@@ -6,4 +6,4 @@ import { HttpClientMsal } from './lib/client';

import { MsalModule } from '@equinor/fusion-framework-module-msal';
export declare type HttpModule = Module<'http', IHttpClientProvider, IHttpClientConfigurator>;
export declare type HttpMsalModule = Module<'http', IHttpClientProvider<HttpClientMsal>, IHttpClientConfigurator<HttpClientMsal>, [
export type HttpModule = Module<'http', IHttpClientProvider, IHttpClientConfigurator>;
export type HttpMsalModule = Module<'http', IHttpClientProvider<HttpClientMsal>, IHttpClientConfigurator<HttpClientMsal>, [
MsalModule

@@ -10,0 +10,0 @@ ]>;

{
"name": "@equinor/fusion-framework-module-http",
"version": "2.1.4",
"version": "2.1.5",
"description": "",

@@ -52,3 +52,3 @@ "main": "dist/esm/index.js",

},
"gitHead": "676b6bab4e586885185d21b14bd61f392e76f74d"
"gitHead": "08348a63143c1fc0d62fd75e81271ffc2cab9be4"
}

@@ -86,4 +86,4 @@ import { firstValueFrom, of, Subject } from 'rxjs';

const selector = args?.selector ?? jsonSelector;
const header = new Headers(args?.headers);
header.append('Content-Type', 'application/json');
const headers = new Headers(args?.headers);
headers.append('Content-Type', 'application/json');
return this.fetch$(path, {

@@ -93,2 +93,3 @@ ...args,

selector,
headers,
} as FetchRequestInit<T, TRequest, TResponse>);

@@ -95,0 +96,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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