@equinor/fusion-framework 1.1.0-alpha.2 → 1.1.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.js +7 -17
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/modules.js +6 -0
- package/dist/esm/modules.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/index.d.ts +5 -19
- package/dist/types/modules.d.ts +9 -0
- package/package.json +6 -11
- package/src/index.ts +15 -48
- package/src/modules.ts +16 -0
- package/tsconfig.json +15 -5
- package/README.md +0 -170
- package/dist/build/index.js +0 -13194
- package/dist/build/index.js.map +0 -1
- package/dist/build/src/index.d.ts +0 -28
- package/dist/build/src/services/config.auth.d.ts +0 -3
- package/dist/build/src/services/config.http.d.ts +0 -3
- package/dist/build/src/services/create-services.d.ts +0 -3
- package/dist/build/src/services/http/http-client-msal.d.ts +0 -9
- package/dist/build/src/services/http/http-client.d.ts +0 -31
- package/dist/build/src/services/http/http-configurator.d.ts +0 -25
- package/dist/build/src/services/http/http-provider.d.ts +0 -11
- package/dist/build/src/services/http/index.d.ts +0 -4
- package/dist/build/src/services/index.d.ts +0 -5
- package/dist/build/src/services/types.d.ts +0 -33
- package/dist/build/src/util/process-operators.d.ts +0 -9
- package/dist/build/tsconfig.rollup.tsbuildinfo +0 -1
- package/dist/esm/services/config.auth.js +0 -32
- package/dist/esm/services/config.auth.js.map +0 -1
- package/dist/esm/services/config.http.js +0 -23
- package/dist/esm/services/config.http.js.map +0 -1
- package/dist/esm/services/create-services.js +0 -21
- package/dist/esm/services/create-services.js.map +0 -1
- package/dist/esm/services/http/http-client-msal.js +0 -11
- package/dist/esm/services/http/http-client-msal.js.map +0 -1
- package/dist/esm/services/http/http-client.js +0 -54
- package/dist/esm/services/http/http-client.js.map +0 -1
- package/dist/esm/services/http/http-configurator.js +0 -23
- package/dist/esm/services/http/http-configurator.js.map +0 -1
- package/dist/esm/services/http/http-provider.js +0 -25
- package/dist/esm/services/http/http-provider.js.map +0 -1
- package/dist/esm/services/http/index.js +0 -5
- package/dist/esm/services/http/index.js.map +0 -1
- package/dist/esm/services/index.js +0 -4
- package/dist/esm/services/index.js.map +0 -1
- package/dist/esm/services/types.js +0 -2
- package/dist/esm/services/types.js.map +0 -1
- package/dist/esm/util/process-operators.js +0 -25
- package/dist/esm/util/process-operators.js.map +0 -1
- package/dist/types/services/config.auth.d.ts +0 -3
- package/dist/types/services/config.http.d.ts +0 -3
- package/dist/types/services/create-services.d.ts +0 -3
- package/dist/types/services/http/http-client-msal.d.ts +0 -9
- package/dist/types/services/http/http-client.d.ts +0 -31
- package/dist/types/services/http/http-configurator.d.ts +0 -25
- package/dist/types/services/http/http-provider.d.ts +0 -11
- package/dist/types/services/http/index.d.ts +0 -4
- package/dist/types/services/index.d.ts +0 -5
- package/dist/types/services/types.d.ts +0 -33
- package/dist/types/util/process-operators.d.ts +0 -9
- package/services/package.json +0 -7
- package/src/services/config.auth.ts +0 -37
- package/src/services/config.http.ts +0 -33
- package/src/services/create-services.ts +0 -26
- package/src/services/http/http-client-msal.ts +0 -19
- package/src/services/http/http-client.ts +0 -167
- package/src/services/http/http-configurator.ts +0 -66
- package/src/services/http/http-provider.ts +0 -32
- package/src/services/http/index.ts +0 -4
- package/src/services/index.ts +0 -6
- package/src/services/types.ts +0 -33
- package/src/util/process-operators.ts +0 -50
package/src/services/index.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export type { Services, ServiceInitiator, ServiceConfig } from './types';
|
|
2
|
-
export { createServices } from './create-services';
|
|
3
|
-
export { default } from './create-services';
|
|
4
|
-
|
|
5
|
-
export { HttpClientMsal, HttpClient } from './http';
|
|
6
|
-
export type { HttpClientMsal as FusionClient } from './http';
|
package/src/services/types.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { HttpClientConfigurator, HttpClientMsal, HttpClientProvider } from './http';
|
|
2
|
-
|
|
3
|
-
// TODO
|
|
4
|
-
export interface AuthClient {
|
|
5
|
-
acquireToken(req: { scopes: string[] }): Promise<{ accessToken: string } | void>;
|
|
6
|
-
login(): void;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface AuthProvider {
|
|
10
|
-
acquireToken(req: { scopes: string[] }): Promise<{ accessToken: string } | void>;
|
|
11
|
-
acquireAccessToken(req: { scopes: string[] }): Promise<string | void>;
|
|
12
|
-
login(): void;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export type Services = {
|
|
16
|
-
auth: AuthProvider;
|
|
17
|
-
http: HttpClientProvider<HttpClientMsal>;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export type ServiceInitiator = (config: ServiceConfig) => void | Promise<void>;
|
|
21
|
-
|
|
22
|
-
export interface ServiceConfig {
|
|
23
|
-
auth: {
|
|
24
|
-
client?: AuthClient;
|
|
25
|
-
configureClient: (tennant: string, client: string, cb?: string) => void;
|
|
26
|
-
};
|
|
27
|
-
http: HttpClientConfigurator<HttpClientMsal>;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export type ServiceConfigurator = (
|
|
31
|
-
config: Partial<ServiceConfig>,
|
|
32
|
-
services?: Services
|
|
33
|
-
) => (services: Partial<Services>) => Partial<Services> | Promise<Partial<Services>>;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { BehaviorSubject, from, Observable } from 'rxjs';
|
|
2
|
-
import { withLatestFrom, concatMap, last } from 'rxjs/operators';
|
|
3
|
-
|
|
4
|
-
export type ProcessOperator<T, R = T> = (request: T) => R | void | Promise<R | void>;
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Container for sync/async operators.
|
|
8
|
-
* Pipes each operator sequential
|
|
9
|
-
*/
|
|
10
|
-
export class ProcessOperators<T> {
|
|
11
|
-
protected _operators: Record<string, ProcessOperator<T>> = {};
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Add a new operator (throw error if allready defined)
|
|
15
|
-
*/
|
|
16
|
-
add(key: string, operator: ProcessOperator<T>): ProcessOperators<T> {
|
|
17
|
-
if (Object.keys(this._operators).includes(key))
|
|
18
|
-
throw Error(`Operator [${key}] allready defined`);
|
|
19
|
-
return this.set(key, operator);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Add or sets a operator
|
|
24
|
-
*/
|
|
25
|
-
set(key: string, operator: ProcessOperator<T>): ProcessOperators<T> {
|
|
26
|
-
this._operators[key] = operator;
|
|
27
|
-
return this;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Get a operator, will return undefined on invalid key.
|
|
32
|
-
*/
|
|
33
|
-
get(key: string): ProcessOperator<T> {
|
|
34
|
-
return this._operators[key];
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Process registered processors.
|
|
39
|
-
*/
|
|
40
|
-
process(request: T): Observable<T> {
|
|
41
|
-
const request$ = new BehaviorSubject<T>(request);
|
|
42
|
-
from(Object.values(this._operators))
|
|
43
|
-
.pipe(
|
|
44
|
-
withLatestFrom(request$),
|
|
45
|
-
concatMap(async ([operator, value]) => (await operator(value)) || value)
|
|
46
|
-
)
|
|
47
|
-
.subscribe(request$);
|
|
48
|
-
return request$.pipe(last());
|
|
49
|
-
}
|
|
50
|
-
}
|