@equinor/fusion
Advanced tools
Comparing version 0.1.35 to 0.1.36
@@ -60,5 +60,8 @@ import { MutableRefObject } from "react"; | ||
export declare const defaultSettings: CoreSettings; | ||
export declare type FusionContextOptions = { | ||
loadBundlesFromDisk: boolean; | ||
}; | ||
declare const FusionContext: import("react").Context<IFusionContext>; | ||
export declare const createFusionContext: (authContainer: IAuthContainer, serviceResolver: ServiceResolver, refs: Refs) => IFusionContext; | ||
export declare const createFusionContext: (authContainer: IAuthContainer, serviceResolver: ServiceResolver, refs: Refs, options?: FusionContextOptions | undefined) => IFusionContext; | ||
export declare const useFusionContext: () => IFusionContext; | ||
export default FusionContext; |
@@ -17,5 +17,5 @@ import { createContext, useContext } from "react"; | ||
const FusionContext = createContext({}); | ||
export const createFusionContext = (authContainer, serviceResolver, refs) => { | ||
export const createFusionContext = (authContainer, serviceResolver, refs, options) => { | ||
const abortControllerManager = new AbortControllerManager(); | ||
const resourceCollections = createResourceCollections(serviceResolver); | ||
const resourceCollections = createResourceCollections(serviceResolver, options); | ||
const resourceCache = new ResourceCache(); | ||
@@ -22,0 +22,0 @@ const httpClient = new HttpClient(authContainer, resourceCache, abortControllerManager); |
import BaseResourceCollection from "./BaseResourceCollection"; | ||
import ServiceResolver from './ServiceResolver'; | ||
import { FusionContextOptions } from '../../core/FusionContext'; | ||
export default class FusionResourceCollection extends BaseResourceCollection { | ||
options?: FusionContextOptions; | ||
constructor(serviceResolver: ServiceResolver, options?: FusionContextOptions); | ||
protected getBaseUrl(): string; | ||
apps(): string; | ||
app(appKey: string): string; | ||
appManifest(appKey: string): string; | ||
appScript(appKey: string): string; | ||
private getBundlesPath; | ||
private getManifestFileName; | ||
} |
import BaseResourceCollection from "./BaseResourceCollection"; | ||
import combineUrls from "../../utils/combineUrls"; | ||
export default class FusionResourceCollection extends BaseResourceCollection { | ||
constructor(serviceResolver, options) { | ||
super(serviceResolver); | ||
this.options = options; | ||
} | ||
getBaseUrl() { | ||
@@ -8,10 +12,22 @@ return this.serviceResolver.getFusionBaseUrl(); | ||
apps() { | ||
return combineUrls(this.getBaseUrl(), "bundles", "apps"); | ||
return combineUrls(this.getBaseUrl(), this.getBundlesPath(), "apps"); | ||
} | ||
appManifest(appKey) { | ||
app(appKey) { | ||
return combineUrls(this.apps(), appKey); | ||
} | ||
appManifest(appKey) { | ||
return combineUrls(this.app(appKey), this.getManifestFileName()); | ||
} | ||
appScript(appKey) { | ||
return this.appManifest(appKey) + ".js"; | ||
if (this.options && this.options.loadBundlesFromDisk) { | ||
return combineUrls(this.app(appKey), `app-bundle.js?v=${(+new Date)}`); | ||
} | ||
return this.app(appKey) + ".js"; | ||
} | ||
getBundlesPath() { | ||
return this.options && this.options.loadBundlesFromDisk ? "js" : "bundles"; | ||
} | ||
getManifestFileName() { | ||
return this.options && this.options.loadBundlesFromDisk ? `app-manifest.json?v=${(+new Date)}` : ""; | ||
} | ||
} |
@@ -5,2 +5,3 @@ import DataProxyResourceCollection from "./DataProxyResourceCollection"; | ||
import ServiceResolver from "./ServiceResolver"; | ||
import { FusionContextOptions } from "../../core/FusionContext"; | ||
declare type ResourceCollections = { | ||
@@ -12,3 +13,3 @@ dataProxy: DataProxyResourceCollection; | ||
export { DataProxyResourceCollection }; | ||
export declare const createResourceCollections: (serviceResolver: ServiceResolver) => ResourceCollections; | ||
export declare const createResourceCollections: (serviceResolver: ServiceResolver, options?: FusionContextOptions | undefined) => ResourceCollections; | ||
export default ResourceCollections; |
@@ -5,6 +5,6 @@ import DataProxyResourceCollection from "./DataProxyResourceCollection"; | ||
export { DataProxyResourceCollection }; | ||
export const createResourceCollections = (serviceResolver) => ({ | ||
export const createResourceCollections = (serviceResolver, options) => ({ | ||
dataProxy: new DataProxyResourceCollection(serviceResolver), | ||
fusion: new FusionResourceCollection(serviceResolver), | ||
fusion: new FusionResourceCollection(serviceResolver, options), | ||
context: new ContextResourceCollection(serviceResolver), | ||
}); |
@@ -5,3 +5,6 @@ declare type ServiceResolver = { | ||
getContextBaseUrl: () => string; | ||
getOrgBaseUrl: () => string; | ||
getPowerBiBaseUrl: () => string; | ||
getTasksBaseUrl: () => string; | ||
}; | ||
export default ServiceResolver; |
{ | ||
"name": "@equinor/fusion", | ||
"version": "0.1.35", | ||
"version": "0.1.36", | ||
"description": "Everything a Fusion app needs to communicate with the core", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
111927
2576