@wixc3/engine-core
Advanced tools
Comparing version 47.0.0 to 47.1.0
@@ -122,3 +122,2 @@ "use strict"; | ||
apiProxy(instanceToken, { id: api }, serviceComConfig = {}) { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return | ||
return new Proxy(Object.create(null), { | ||
@@ -139,10 +138,7 @@ get: (obj, method) => { | ||
if (typeof method === 'string') { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access | ||
let runtimeMethod = obj[method]; | ||
if (!runtimeMethod) { | ||
runtimeMethod = async (...args) => this.callMethod((await instanceToken).id, api, method, args, this.rootEnvId, serviceComConfig); | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access | ||
obj[method] = runtimeMethod; | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return | ||
return runtimeMethod; | ||
@@ -816,3 +812,3 @@ } | ||
if (typeof onMethod !== 'string') { | ||
throw 'onMethod ref must be a string'; | ||
throw new Error('onMethod ref must be a string'); | ||
} | ||
@@ -819,0 +815,0 @@ return { |
@@ -42,3 +42,3 @@ "use strict"; | ||
cancellationTriggers.set(iframe, () => { | ||
reject('Cancelled environment initialization in an iframe'); | ||
reject(new Error('Cancelled environment initialization in an iframe')); | ||
}); | ||
@@ -45,0 +45,0 @@ }); |
@@ -43,3 +43,3 @@ import { SERVICE_CONFIG } from '../symbols.js'; | ||
} & { | ||
[K in Extract<keyof T, keyof Object>]: never; | ||
[K in Extract<keyof T, keyof object>]: never; | ||
}; | ||
@@ -46,0 +46,0 @@ export type MultiEnvAsyncApi<T extends object> = { |
@@ -34,3 +34,5 @@ import { SetMultiMap } from '@wixc3/patterns'; | ||
static context<T extends FeatureClass>(this: T): InstanceType<T>['context']; | ||
static use<T extends FeatureClass>(this: T, c: PartialFeatureConfig<InstanceType<T>['api']>): [InstanceType<T>["id"], PartialFeatureConfig<InstanceType<T>["api"]>]; | ||
static configure<T extends FeatureClass>(this: T, c: PartialFeatureConfig<InstanceType<T>['api']>): [InstanceType<T>["id"], PartialFeatureConfig<InstanceType<T>["api"]>]; | ||
/** @deprecated use {@link Feature.configure} instead */ | ||
static use: typeof Feature.configure; | ||
static setup<T extends FeatureClass, E extends AnyEnvironment>(this: T, environment: E, setupHandler: SetupHandler<T, E>): T; | ||
@@ -37,0 +39,0 @@ static setupContext<T extends FeatureClass, E extends AnyEnvironment, C extends keyof InstanceType<T>['context'] & string>(this: T, environment: E, context: C, setupHandler: ContextHandler<T, E, C>): T; |
"use strict"; | ||
var _a; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -51,3 +52,3 @@ exports.setup = exports.Feature = void 0; | ||
} | ||
static use(c) { | ||
static configure(c) { | ||
return provideConfig(this, c); | ||
@@ -63,4 +64,7 @@ } | ||
exports.Feature = Feature; | ||
_a = Feature; | ||
Feature.runtimeInfo = undefined; // each class should have its own runtime info | ||
Feature.isEngineFeature = true; | ||
/** @deprecated use {@link Feature.configure} instead */ | ||
Feature.use = _a.configure; | ||
function createRuntimeInfo() { | ||
@@ -67,0 +71,0 @@ return { |
@@ -27,13 +27,9 @@ "use strict"; | ||
if (mode === true) { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access | ||
func = composeCompare(func, (a, b) => compareAny(b[key], a[key])); | ||
} | ||
else if (mode === false) { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access | ||
func = composeCompare(func, (a, b) => compareAny(a[key], b[key])); | ||
} | ||
else { | ||
func = composeCompare(func, | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access | ||
(a, b) => getItemOrder(mode, a[key]) - getItemOrder(mode, b[key])); | ||
func = composeCompare(func, (a, b) => getItemOrder(mode, a[key]) - getItemOrder(mode, b[key])); | ||
} | ||
@@ -40,0 +36,0 @@ } |
@@ -47,3 +47,2 @@ "use strict"; | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return | ||
return inputValue || this.getApiProxy(runtimeEngine, serviceKey); | ||
@@ -55,3 +54,2 @@ } | ||
if (this.remoteAccess) { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return | ||
return this.getApiProxy(context, context.entityID(featureID, entityKey)); | ||
@@ -58,0 +56,0 @@ } |
@@ -12,2 +12,3 @@ "use strict"; | ||
scriptEl.onload = () => res(win); | ||
// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors | ||
scriptEl.onerror = (e) => rej(e); | ||
@@ -20,7 +21,7 @@ win.document.head.appendChild(scriptEl); | ||
const currentScript = globalObj?.document?.currentScript; | ||
const optionsFromScript = new URLSearchParams(currentScript && currentScript.dataset.engineRunOptions || undefined); | ||
const optionsFromScript = new URLSearchParams((currentScript && currentScript.dataset.engineRunOptions) || undefined); | ||
const optionsBeforeInject = new Map([...optionsFromScript, ...urlParams]); | ||
const optionsAfterInject = globalObj?.engineEntryOptions?.({ | ||
currentRunOptions: optionsBeforeInject, | ||
envName | ||
envName, | ||
}); | ||
@@ -27,0 +28,0 @@ return optionsAfterInject || optionsBeforeInject; |
@@ -95,3 +95,3 @@ "use strict"; | ||
window.removeEventListener('message', configsHandler); | ||
error ? rej(error) : res(config); | ||
error ? rej(new Error(error)) : res(config); | ||
} | ||
@@ -98,0 +98,0 @@ }; |
{ | ||
"name": "@wixc3/engine-core", | ||
"version": "47.0.0", | ||
"version": "47.1.0", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "exports": { |
@@ -190,3 +190,2 @@ import { SetMultiMap, isDisposable } from '@wixc3/patterns'; | ||
): AsyncApi<T> { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return | ||
return new Proxy(Object.create(null), { | ||
@@ -208,3 +207,2 @@ get: (obj, method) => { | ||
if (typeof method === 'string') { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access | ||
let runtimeMethod = obj[method]; | ||
@@ -221,6 +219,4 @@ if (!runtimeMethod) { | ||
); | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access | ||
obj[method] = runtimeMethod; | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return | ||
return runtimeMethod; | ||
@@ -986,3 +982,3 @@ } | ||
if (typeof onMethod !== 'string') { | ||
throw 'onMethod ref must be a string'; | ||
throw new Error('onMethod ref must be a string'); | ||
} | ||
@@ -989,0 +985,0 @@ return { |
@@ -84,3 +84,3 @@ import type { Communication } from '../communication.js'; | ||
cancellationTriggers.set(iframe, () => { | ||
reject('Cancelled environment initialization in an iframe'); | ||
reject(new Error('Cancelled environment initialization in an iframe')); | ||
}); | ||
@@ -87,0 +87,0 @@ }); |
@@ -64,3 +64,3 @@ import { SERVICE_CONFIG } from '../symbols.js'; | ||
} & { | ||
[K in Extract<keyof T, keyof Object>]: never; | ||
[K in Extract<keyof T, keyof object>]: never; | ||
}; | ||
@@ -67,0 +67,0 @@ |
@@ -67,5 +67,7 @@ import { SetMultiMap } from '@wixc3/patterns'; | ||
} | ||
static use<T extends FeatureClass>(this: T, c: PartialFeatureConfig<InstanceType<T>['api']>) { | ||
static configure<T extends FeatureClass>(this: T, c: PartialFeatureConfig<InstanceType<T>['api']>) { | ||
return provideConfig(this, c); | ||
} | ||
/** @deprecated use {@link Feature.configure} instead */ | ||
static use = this.configure; | ||
static setup<T extends FeatureClass, E extends AnyEnvironment>( | ||
@@ -72,0 +74,0 @@ this: T, |
@@ -36,6 +36,4 @@ import { CREATE_RUNTIME } from '../symbols.js'; | ||
if (mode === true) { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access | ||
func = composeCompare<T>(func, (a: any, b: any) => compareAny(b[key], a[key])); | ||
} else if (mode === false) { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access | ||
func = composeCompare<T>(func, (a: any, b: any) => compareAny(a[key], b[key])); | ||
@@ -45,3 +43,2 @@ } else { | ||
func, | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access | ||
(a: any, b: any) => getItemOrder(mode, a[key]) - getItemOrder(mode, b[key]), | ||
@@ -48,0 +45,0 @@ ); |
@@ -15,11 +15,8 @@ import COM from '../communication.feature.js'; | ||
export type ServiceRuntime<T extends object, ProvidedFrom> = ProvidedFrom extends Environment< | ||
string, | ||
EnvironmentTypes, | ||
'single' | ||
> | ||
? AsyncApi<T> | ||
: ProvidedFrom extends Environment<string, EnvironmentTypes, 'multi', any> | ||
? MultiEnvAsyncApi<T> | ||
: AsyncApi<T>; | ||
export type ServiceRuntime<T extends object, ProvidedFrom> = | ||
ProvidedFrom extends Environment<string, EnvironmentTypes, 'single'> | ||
? AsyncApi<T> | ||
: ProvidedFrom extends Environment<string, EnvironmentTypes, 'multi', any> | ||
? MultiEnvAsyncApi<T> | ||
: AsyncApi<T>; | ||
@@ -86,3 +83,2 @@ export class Service< | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return | ||
return inputValue || this.getApiProxy(runtimeEngine, serviceKey); | ||
@@ -95,3 +91,2 @@ } | ||
if (this.remoteAccess) { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return | ||
return this.getApiProxy(context, context.entityID(featureID, entityKey)); | ||
@@ -98,0 +93,0 @@ } |
@@ -10,2 +10,3 @@ import { IRunOptions } from '../types'; | ||
scriptEl.onload = () => res(win); | ||
// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors | ||
scriptEl.onerror = (e) => rej(e); | ||
@@ -17,4 +18,4 @@ win.document.head.appendChild(scriptEl); | ||
interface EngineWebEntryGlobalObj { | ||
document?: { currentScript: { dataset: { engineRunOptions?: string | null } } | null }, | ||
location?: { search?: string } | ||
document?: { currentScript: { dataset: { engineRunOptions?: string | null } } | null }; | ||
location?: { search?: string }; | ||
@@ -28,9 +29,11 @@ engineEntryOptions?: (options: { currentRunOptions: IRunOptions; envName: string }) => IRunOptions; | ||
const optionsFromScript = new URLSearchParams(currentScript && currentScript.dataset.engineRunOptions || undefined); | ||
const optionsFromScript = new URLSearchParams( | ||
(currentScript && currentScript.dataset.engineRunOptions) || undefined, | ||
); | ||
const optionsBeforeInject = new Map([...optionsFromScript, ...urlParams]); | ||
const optionsAfterInject = globalObj?.engineEntryOptions?.({ | ||
currentRunOptions: optionsBeforeInject, | ||
envName | ||
envName, | ||
}); | ||
return optionsAfterInject || optionsBeforeInject; | ||
} |
@@ -126,3 +126,3 @@ import { IRunOptions, type TopLevelConfig } from './types.js'; | ||
window.removeEventListener('message', configsHandler); | ||
error ? rej(error) : res(config); | ||
error ? rej(new Error(error)) : res(config); | ||
} | ||
@@ -129,0 +129,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
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
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
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
1362609
13518