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

@equinor/fusion-framework-module-app

Package Overview
Dependencies
Maintainers
0
Versions
186
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 6.0.0-next-ad690a9e34895039f4df7dd6d6f505206fa9fa23 to 6.0.0-next-e2f0f5f45ddcf734f0d1c8a7ea2fb5e761f7b8f0

dist/esm/AppClient.Selectors.js

2

CHANGELOG.md
# Change Log
## 6.0.0-next-ad690a9e34895039f4df7dd6d6f505206fa9fa23
## 6.0.0-next-e2f0f5f45ddcf734f0d1c8a7ea2fb5e761f7b8f0

@@ -5,0 +5,0 @@ ### Major Changes

@@ -38,4 +38,5 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

import { jsonSelector } from '@equinor/fusion-framework-module-http/selectors';
import { ApiApplicationSchema } from './application.schema';
import { ApiApplicationSchema } from './schemas';
import { AppConfigError, AppManifestError } from './errors';
import { AppConfigSelector } from './AppClient.Selectors';
/**

@@ -104,2 +105,3 @@ * Transforms an ApiApplicationSchema object into an AppManifest object.

return client.json(`/apps/${appKey}/builds/${tag}/config`, {
selector: AppConfigSelector,
headers: {

@@ -106,0 +108,0 @@ 'Api-Version': '1.0',

@@ -16,5 +16,5 @@ import { ActionInstanceMap, ActionTypes } from '@equinor/fusion-observable';

/** Config loading */
setConfig: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[config: AppConfig], AppConfig, "set_config", never, never>;
setConfig: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[config: AppConfig<import("../AppConfig").ConfigEnvironment>], AppConfig<import("../AppConfig").ConfigEnvironment>, "set_config", never, never>;
fetchConfig: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[manifest: AppManifest], AppManifest, "fetch_config::request", never, never> & {
success: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[config: AppConfig], AppConfig, "fetch_config::success", never, never>;
success: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[config: AppConfig<import("../AppConfig").ConfigEnvironment>], AppConfig<import("../AppConfig").ConfigEnvironment>, "fetch_config::success", never, never>;
failure: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[error: unknown], unknown, "fetch_config::failure", never, never>;

@@ -47,5 +47,5 @@ };

/** Config loading */
setConfig: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[config: AppConfig], AppConfig, "set_config", never, never>;
setConfig: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[config: AppConfig<import("../AppConfig").ConfigEnvironment>], AppConfig<import("../AppConfig").ConfigEnvironment>, "set_config", never, never>;
fetchConfig: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[manifest: AppManifest], AppManifest, "fetch_config::request", never, never> & {
success: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[config: AppConfig], AppConfig, "fetch_config::success", never, never>;
success: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[config: AppConfig<import("../AppConfig").ConfigEnvironment>], AppConfig<import("../AppConfig").ConfigEnvironment>, "fetch_config::success", never, never>;
failure: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[error: unknown], unknown, "fetch_config::failure", never, never>;

@@ -52,0 +52,0 @@ };

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

import type { AppConfig, AppModulesInstance, AppScriptModule } from '../types';
import type { AppModulesInstance, AppScriptModule, AppManifest, AppConfig, ConfigEnvironment } from '../types';
import { Observable } from '@equinor/fusion-observable';

@@ -8,3 +8,2 @@ import type { AppModuleProvider } from '../AppModuleProvider';

import { AppBundleState, AppBundleStateInitial } from './types';
import { AppManifest } from '../types';
import './events';

@@ -17,3 +16,3 @@ export declare function filterEmpty<T>(): OperatorFunction<T | null | undefined, T>;

*/
export interface IApp<TEnv = any, TModules extends Array<AnyModule> | unknown = unknown> {
export interface IApp<TEnv extends ConfigEnvironment = ConfigEnvironment, TModules extends Array<AnyModule> | unknown = unknown> {
/**

@@ -139,3 +138,3 @@ * Returns an observable that emits the app manifest.

}
export declare class App<TEnv = any, TModules extends Array<AnyModule> | unknown = unknown> implements IApp<TEnv, TModules> {
export declare class App<TEnv extends ConfigEnvironment = ConfigEnvironment, TModules extends Array<AnyModule> | unknown = unknown> implements IApp<TEnv, TModules> {
#private;

@@ -150,4 +149,4 @@ get manifest$(): Observable<AppManifest>;

get manifestAsync(): Promise<Readonly<AppManifest>>;
get config(): Readonly<AppConfig<TEnv>> | undefined;
get configAsync(): Promise<Readonly<AppConfig<TEnv>>>;
get config(): AppConfig<TEnv> | undefined;
get configAsync(): Promise<AppConfig<TEnv>>;
get instance(): AppModulesInstance<TModules> | undefined;

@@ -154,0 +153,0 @@ constructor(value: AppBundleStateInitial, args: {

@@ -8,3 +8,3 @@ import { AppBundleState, AppBundleStateInitial } from './types';

}, never> | {
payload: import("..").AppConfig;
payload: import("..").AppConfig<import("../AppConfig").ConfigEnvironment>;
type: "set_config";

@@ -33,3 +33,3 @@ } | {

} | {
payload: import("..").AppConfig;
payload: import("..").AppConfig<import("../AppConfig").ConfigEnvironment>;
type: "fetch_config::success";

@@ -36,0 +36,0 @@ } | {

@@ -1,3 +0,16 @@

import type { AppManifest, AppConfig, AppModulesInstance, AppScriptModule } from '../types';
export type AppBundleState<TConfig = any, TModules = any> = {
import type { AppManifest, AppConfig, AppModulesInstance, AppScriptModule, ConfigEnvironment } from '../types';
/**
* Represents the state of an application bundle.
*
* @template TConfig - The type of the configuration environment, defaults to `ConfigEnvironment`.
* @template TModules - The type of the modules, defaults to `any`.
*
* @property {string} appKey - A unique key identifying the application.
* @property {Set<string>} status - A set of strings representing the status of the application.
* @property {AppManifest} [manifest] - An optional manifest describing the application.
* @property {AppConfig<TConfig>} [config] - An optional configuration object for the application.
* @property {AppScriptModule} [modules] - An optional script module for the application.
* @property {AppModulesInstance<TModules>} [instance] - An optional instance of the application modules.
*/
export type AppBundleState<TConfig extends ConfigEnvironment = ConfigEnvironment, TModules = any> = {
appKey: string;

@@ -10,2 +23,8 @@ status: Set<string>;

};
export type AppBundleStateInitial<TConfig = any, TModules = any> = Omit<AppBundleState<TConfig, TModules>, 'status'>;
/**
* Represents the initial state of an application bundle, excluding the 'status' property.
*
* @template TConfig - The configuration environment type, defaults to `ConfigEnvironment`.
* @template TModules - The type of modules included in the application bundle, defaults to `any`.
*/
export type AppBundleStateInitial<TConfig extends ConfigEnvironment = ConfigEnvironment, TModules = any> = Omit<AppBundleState<TConfig, TModules>, 'status'>;
import { Observable, ObservableInput } from 'rxjs';
import { IHttpClient } from '@equinor/fusion-framework-module-http';
import { AppConfig, AppManifest } from './types';
import type { AppConfig, AppManifest, ConfigEnvironment } from './types';
export interface IAppClient extends Disposable {

@@ -20,3 +20,3 @@ /**

*/
getAppConfig: <TType = unknown>(args: {
getAppConfig: <TType extends ConfigEnvironment = ConfigEnvironment>(args: {
appKey: string;

@@ -39,3 +39,3 @@ tag?: string;

} | undefined): Observable<AppManifest[]>;
getAppConfig<TType = unknown>(args: {
getAppConfig<TType extends ConfigEnvironment = ConfigEnvironment>(args: {
appKey: string;

@@ -42,0 +42,0 @@ tag?: string;

import { Observable } from 'rxjs';
import { ModuleType } from '@equinor/fusion-framework-module';
import { EventModule } from '@equinor/fusion-framework-module-event';
import type { AppConfig, AppManifest, CurrentApp } from './types';
import type { AppConfig, AppManifest, ConfigEnvironment, CurrentApp } from './types';
import { App, IApp } from './app/App';

@@ -41,3 +41,3 @@ import { AppModuleConfig } from './AppConfigurator';

*/
getAppConfig<TType = unknown>(appKey: string, tag?: string): Observable<AppConfig<TType>>;
getAppConfig<TType extends ConfigEnvironment = ConfigEnvironment>(appKey: string, tag?: string): Observable<AppConfig<TType>>;
/**

@@ -44,0 +44,0 @@ * set the current application, will internally resolve manifest

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

import { AnyModule, CombinedModules, ModulesInstance } from '@equinor/fusion-framework-module';
import type { AnyModule, CombinedModules, ModulesInstance } from '@equinor/fusion-framework-module';
import type { EventModule } from '@equinor/fusion-framework-module-event';

@@ -6,8 +6,11 @@ import type { HttpModule } from '@equinor/fusion-framework-module-http';

import type { ServiceDiscoveryModule } from '@equinor/fusion-framework-module-service-discovery';
import IApp from './app';
import type { AppConfig } from './AppConfig';
import type IApp from './app';
export type ConfigEnvironment = Record<string, unknown>;
export type { AppConfig } from './AppConfig';
type Fusion = any;
export type AppEnv<TConfig = unknown, TProps = unknown> = {
export type AppEnv<TEnv extends ConfigEnvironment = ConfigEnvironment, TProps = unknown> = {
basename?: string;
manifest?: AppManifest;
config?: AppConfig<TConfig>;
config?: AppConfig<TEnv>;
props?: TProps;

@@ -17,3 +20,3 @@ };

export type AppType = 'standalone' | 'report' | 'launcher' | 'template';
export type CurrentApp<TModules extends Array<AnyModule> = [], TEnv = any> = IApp<TEnv, TModules> | null | undefined;
export type CurrentApp<TModules extends Array<AnyModule> = [], TEnv extends ConfigEnvironment = ConfigEnvironment> = IApp<TEnv, TModules> | null | undefined;
type Nullable<T> = T | null | undefined;

@@ -76,10 +79,2 @@ type AppPerson = {

}
export type Endpoint = {
url: string;
scopes?: string[];
};
export type AppConfig<TEnvironment = unknown> = {
environment?: TEnvironment;
endpoints?: Record<string, Endpoint>;
};
/**

@@ -89,3 +84,3 @@ * @template TEnvironment - name of hosted environment

*/
export type AppBundle<TEnvironment = unknown, TModule = unknown> = {
export type AppBundle<TEnvironment extends ConfigEnvironment = ConfigEnvironment, TModule = unknown> = {
manifest: AppManifest;

@@ -109,2 +104,1 @@ config: AppConfig<TEnvironment>;

export type AppModulesInstance<TModules extends Array<AnyModule> | unknown = unknown> = ModulesInstance<AppModules<TModules>>;
export {};
{
"name": "@equinor/fusion-framework-module-app",
"version": "6.0.0-next-ad690a9e34895039f4df7dd6d6f505206fa9fa23",
"version": "6.0.0-next-e2f0f5f45ddcf734f0d1c8a7ea2fb5e761f7b8f0",
"description": "",
"main": "dist/esm/index.js",
"type": "module",
"exports": {

@@ -15,2 +16,6 @@ ".": {

},
"./schemas.js": {
"import": "./dist/esm/schemas.js",
"types": "./dist/types/schemas.d.ts"
},
"./app": {

@@ -22,5 +27,2 @@ "import": "./dist/esm/app/index.js",

"import": "./dist/esm/app/*.js"
},
"./application.schema.js": {
"import": "./dist/esm/application.schema.js"
}

@@ -34,2 +36,5 @@ },

],
"schemas.js": [
"dist/types/schemas.d.ts"
],
"app": [

@@ -58,4 +63,4 @@ "dist/types/app/index.d.ts"

"zod": "^3.23.8",
"@equinor/fusion-query": "^5.1.3",
"@equinor/fusion-observable": "^8.4.1"
"@equinor/fusion-observable": "^8.4.1",
"@equinor/fusion-query": "^5.1.3"
},

@@ -67,4 +72,4 @@ "devDependencies": {

"@equinor/fusion-framework-module-msal": "^3.1.5",
"@equinor/fusion-framework-module-service-discovery": "^8.0.1",
"@equinor/fusion-framework-module-http": "^6.2.0"
"@equinor/fusion-framework-module-http": "^6.2.0",
"@equinor/fusion-framework-module-service-discovery": "^8.0.1"
},

@@ -71,0 +76,0 @@ "scripts": {

@@ -1,2 +0,8 @@

import type { AppConfig, AppModulesInstance, AppScriptModule } from '../types';
import type {
AppModulesInstance,
AppScriptModule,
AppManifest,
AppConfig,
ConfigEnvironment,
} from '../types';
import { FlowSubject, Observable } from '@equinor/fusion-observable';

@@ -20,3 +26,2 @@

import { AppBundleState, AppBundleStateInitial } from './types';
import { AppManifest } from '../types';

@@ -36,3 +41,6 @@ import './events';

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export interface IApp<TEnv = any, TModules extends Array<AnyModule> | unknown = unknown> {
export interface IApp<
TEnv extends ConfigEnvironment = ConfigEnvironment,
TModules extends Array<AnyModule> | unknown = unknown,
> {
/**

@@ -180,4 +188,6 @@ * Returns an observable that emits the app manifest.

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export class App<TEnv = any, TModules extends Array<AnyModule> | unknown = unknown>
implements IApp<TEnv, TModules>
export class App<
TEnv extends ConfigEnvironment = ConfigEnvironment,
TModules extends Array<AnyModule> | unknown = unknown,
> implements IApp<TEnv, TModules>
{

@@ -197,3 +207,3 @@ #state: FlowSubject<AppBundleState, Actions>;

return this.#state.pipe(
map(({ config }) => config),
map(({ config }) => config as AppConfig<TEnv>),
filterEmpty(),

@@ -236,7 +246,7 @@ );

get config(): Readonly<AppConfig<TEnv>> | undefined {
return this.state.config;
get config(): AppConfig<TEnv> | undefined {
return this.state.config as AppConfig<TEnv>;
}
get configAsync(): Promise<Readonly<AppConfig<TEnv>>> {
get configAsync(): Promise<AppConfig<TEnv>> {
return firstValueFrom(this.config$);

@@ -243,0 +253,0 @@ }

@@ -1,5 +0,27 @@

import type { AppManifest, AppConfig, AppModulesInstance, AppScriptModule } from '../types';
import type {
AppManifest,
AppConfig,
AppModulesInstance,
AppScriptModule,
ConfigEnvironment,
} from '../types';
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type AppBundleState<TConfig = any, TModules = any> = {
/**
* Represents the state of an application bundle.
*
* @template TConfig - The type of the configuration environment, defaults to `ConfigEnvironment`.
* @template TModules - The type of the modules, defaults to `any`.
*
* @property {string} appKey - A unique key identifying the application.
* @property {Set<string>} status - A set of strings representing the status of the application.
* @property {AppManifest} [manifest] - An optional manifest describing the application.
* @property {AppConfig<TConfig>} [config] - An optional configuration object for the application.
* @property {AppScriptModule} [modules] - An optional script module for the application.
* @property {AppModulesInstance<TModules>} [instance] - An optional instance of the application modules.
*/
export type AppBundleState<
TConfig extends ConfigEnvironment = ConfigEnvironment,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
TModules = any,
> = {
appKey: string;

@@ -13,6 +35,12 @@ status: Set<string>;

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type AppBundleStateInitial<TConfig = any, TModules = any> = Omit<
AppBundleState<TConfig, TModules>,
'status'
>;
/**
* Represents the initial state of an application bundle, excluding the 'status' property.
*
* @template TConfig - The configuration environment type, defaults to `ConfigEnvironment`.
* @template TModules - The type of modules included in the application bundle, defaults to `any`.
*/
export type AppBundleStateInitial<
TConfig extends ConfigEnvironment = ConfigEnvironment,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
TModules = any,
> = Omit<AppBundleState<TConfig, TModules>, 'status'>;

@@ -9,6 +9,7 @@ import { catchError, map, Observable, ObservableInput } from 'rxjs';

import { ApiApplicationSchema } from './application.schema';
import { ApiApplicationSchema } from './schemas';
import { AppConfig, AppManifest } from './types';
import type { AppConfig, AppManifest, ConfigEnvironment } from './types';
import { AppConfigError, AppManifestError } from './errors';
import { AppConfigSelector } from './AppClient.Selectors';

@@ -29,3 +30,3 @@ export interface IAppClient extends Disposable {

*/
getAppConfig: <TType = unknown>(args: {
getAppConfig: <TType extends ConfigEnvironment = ConfigEnvironment>(args: {
appKey: string;

@@ -108,2 +109,3 @@ tag?: string;

return client.json(`/apps/${appKey}/builds/${tag}/config`, {
selector: AppConfigSelector,
headers: {

@@ -142,3 +144,3 @@ 'Api-Version': '1.0',

getAppConfig<TType = unknown>(args: {
getAppConfig<TType extends ConfigEnvironment = ConfigEnvironment>(args: {
appKey: string;

@@ -145,0 +147,0 @@ tag?: string;

@@ -15,3 +15,3 @@ import {

import type { AppConfig, AppManifest, CurrentApp } from './types';
import type { AppConfig, AppManifest, ConfigEnvironment, CurrentApp } from './types';

@@ -119,3 +119,3 @@ import { App, filterEmpty, IApp } from './app/App';

*/
public getAppConfig<TType = unknown>(
public getAppConfig<TType extends ConfigEnvironment = ConfigEnvironment>(
appKey: string,

@@ -122,0 +122,0 @@ tag?: string,

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

import { AnyModule, CombinedModules, ModulesInstance } from '@equinor/fusion-framework-module';
import type { AnyModule, CombinedModules, ModulesInstance } from '@equinor/fusion-framework-module';
import type { EventModule } from '@equinor/fusion-framework-module-event';

@@ -6,4 +6,8 @@ import type { HttpModule } from '@equinor/fusion-framework-module-http';

import type { ServiceDiscoveryModule } from '@equinor/fusion-framework-module-service-discovery';
import IApp from './app';
import type { AppConfig } from './AppConfig';
import type IApp from './app';
export type ConfigEnvironment = Record<string, unknown>;
export type { AppConfig } from './AppConfig';
// TODO

@@ -13,6 +17,6 @@ // eslint-disable-next-line @typescript-eslint/no-explicit-any

export type AppEnv<TConfig = unknown, TProps = unknown> = {
export type AppEnv<TEnv extends ConfigEnvironment = ConfigEnvironment, TProps = unknown> = {
basename?: string;
manifest?: AppManifest;
config?: AppConfig<TConfig>;
config?: AppConfig<TEnv>;
props?: TProps;

@@ -27,7 +31,6 @@ };

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type CurrentApp<TModules extends Array<AnyModule> = [], TEnv = any> =
| IApp<TEnv, TModules>
| null
| undefined;
export type CurrentApp<
TModules extends Array<AnyModule> = [],
TEnv extends ConfigEnvironment = ConfigEnvironment,
> = IApp<TEnv, TModules> | null | undefined;

@@ -97,9 +100,2 @@ type Nullable<T> = T | null | undefined;

export type Endpoint = { url: string; scopes?: string[] };
export type AppConfig<TEnvironment = unknown> = {
environment?: TEnvironment;
endpoints?: Record<string, Endpoint>;
};
/**

@@ -109,3 +105,6 @@ * @template TEnvironment - name of hosted environment

*/
export type AppBundle<TEnvironment = unknown, TModule = unknown> = {
export type AppBundle<
TEnvironment extends ConfigEnvironment = ConfigEnvironment,
TModule = unknown,
> = {
manifest: AppManifest;

@@ -112,0 +111,0 @@ config: AppConfig<TEnvironment>;

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