@wixc3/engine-core
Advanced tools
Comparing version 2.0.2 to 3.1.0
@@ -1,2 +0,2 @@ | ||
import { EQUAL, TuppleToUnion as TupleToUnion } from 'typescript-type-utils'; | ||
import { TupleToUnion } from 'typescript-type-utils'; | ||
import { LogMessage } from './common-types'; | ||
@@ -8,4 +8,2 @@ import { Config } from './entities/config'; | ||
import { CREATE_RUNTIME, REGISTER_VALUE } from './symbols'; | ||
/*************** TEST KIT ***************/ | ||
export declare function type_check<U extends true, T extends (...args: U[]) => U>(_fn: T): void; | ||
/*************** HELPER TYPES ***************/ | ||
@@ -74,5 +72,5 @@ export declare type MapBy<T extends any[] | undefined, FIELD extends keyof TupleToUnion<T>> = { | ||
declare type FilterEnv<T extends EntityMap, EnvFilter extends string, Key extends 'visibleAt' | 'providedFrom'> = Pick<T, FilterENVKeys<T, EnvFilter, Key>>; | ||
declare type MapType<X extends EntityMap> = ({ | ||
declare type MapType<X extends EntityMap> = { | ||
[k in keyof X]: X[k]['type']; | ||
}); | ||
}; | ||
declare type MapRecordType<X extends Record<string, { | ||
@@ -83,10 +81,10 @@ type: any; | ||
}; | ||
export declare type MapToProxyType<T extends EntityMap> = ({ | ||
export declare type MapToProxyType<T extends EntityMap> = { | ||
[K in keyof T]: T[K]['proxyType']; | ||
}); | ||
}; | ||
export declare type MapToPartialType<T extends { | ||
[k: string]: any; | ||
}> = ({ | ||
}> = { | ||
[K in keyof T]: Partial<T[K]['type']>; | ||
}); | ||
}; | ||
declare type MapProxyTypesForEnv<T extends EntityMap, EnvFilter extends string, Key extends 'visibleAt' | 'providedFrom'> = MapToProxyType<FilterEnv<T, EnvFilter, Key>>; | ||
@@ -103,10 +101,10 @@ declare type MapTypesForEnv<T extends EntityMap, EnvFilter extends string, Key extends 'visibleAt' | 'providedFrom'> = MapType<FilterEnv<T, EnvFilter, Key>>; | ||
export declare type Running<T extends UnknownFeatureDef, ENV extends string> = MapProxyTypesForEnv<T['api'], ENV | EnvType<typeof Universal>, 'visibleAt'>; | ||
export declare type RunningFeatures<T extends SomeFeature[], ENV extends string, FeatureMap extends MapBy<T, 'id'> = MapBy<T, 'id'>> = ({ | ||
export declare type RunningFeatures<T extends SomeFeature[], ENV extends string, FeatureMap extends MapBy<T, 'id'> = MapBy<T, 'id'>> = { | ||
[I in keyof FeatureMap]: Running<FeatureMap[I], ENV>; | ||
}); | ||
declare type SettingUpFeature<ID extends string, API extends EntityMap, ENV extends string> = ({ | ||
}; | ||
declare type SettingUpFeature<ID extends string, API extends EntityMap, ENV extends string> = { | ||
id: ID; | ||
run: (fn: () => unknown) => void; | ||
onDispose: (fn: DisposeFunction) => void; | ||
} & MapVisibleInputs<API, ENV> & MapToProxyType<GetRemoteOutputs<API>> & MapToProxyType<GetOnlyLocalUniversalOutputs<API>>); | ||
} & MapVisibleInputs<API, ENV> & MapToProxyType<GetRemoteOutputs<API>> & MapToProxyType<GetOnlyLocalUniversalOutputs<API>>; | ||
export declare type RegisteringFeature<API extends EntityMap, ENV extends string, ProvidedOutputs extends MapTypesForEnv<GetOutputs<API>, ENV, 'providedFrom'> = MapTypesForEnv<GetOutputs<API>, ENV, 'providedFrom'>> = keyof ProvidedOutputs extends never ? null : ProvidedOutputs; | ||
@@ -136,37 +134,2 @@ export interface SetupHandlerEnvironmentContext<EnvironmentContext extends Record<string, Context<any>>> { | ||
export declare type TopLevelConfig = Array<[string, object]>; | ||
export declare namespace Tests { | ||
type FromString = EQUAL<EnvType<'main'>, 'main'>; | ||
type FromEnvArray = EQUAL<EnvType<[{ | ||
env: 'main'; | ||
}]>, 'main'>; | ||
type FromEnv = EQUAL<EnvType<{ | ||
env: 'main'; | ||
}>, 'main'>; | ||
type FromEnvArrayMultiple = EQUAL<EnvType<[{ | ||
env: 'main'; | ||
}, { | ||
env: 'main1'; | ||
}]>, 'main' | 'main1'>; | ||
type FromEnvEmptyArray = EQUAL<EnvType<[]>, any>; | ||
type RunningEmpty = EQUAL<Running<{ | ||
id: ''; | ||
api: {}; | ||
}, 'main'>, {}>; | ||
type RunningProvidesApiInputTypes = EQUAL<Running<{ | ||
id: ''; | ||
api: { | ||
x: Entity<string, string, 'main', 'main', 'input', false>; | ||
}; | ||
}, 'main'>, { | ||
x: string; | ||
}>; | ||
type RunningProvidesApiOutputTypes = EQUAL<Running<{ | ||
id: ''; | ||
api: { | ||
x: Entity<string, string, 'main', 'main', 'output', false>; | ||
}; | ||
}, 'main'>, { | ||
x: string; | ||
}>; | ||
} | ||
export interface LoggerTransport { | ||
@@ -173,0 +136,0 @@ name: string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const symbols_1 = require("./symbols"); | ||
/*************** TEST KIT ***************/ | ||
function type_check(_fn) { | ||
/* */ | ||
} | ||
exports.type_check = type_check; | ||
var LogLevel; | ||
@@ -10,0 +5,0 @@ (function (LogLevel) { |
{ | ||
"name": "@wixc3/engine-core", | ||
"version": "2.0.2", | ||
"version": "3.1.0", | ||
"main": "cjs/index.js", | ||
@@ -19,3 +19,3 @@ "types": "cjs/index.d.ts", | ||
"socket.io-client": "^2.2.0", | ||
"typescript-type-utils": "^0.0.3" | ||
"typescript-type-utils": "^0.1.0" | ||
}, | ||
@@ -22,0 +22,0 @@ "files": [ |
@@ -1,2 +0,2 @@ | ||
import { EQUAL, TuppleToUnion as TupleToUnion } from 'typescript-type-utils'; | ||
import { TupleToUnion } from 'typescript-type-utils'; | ||
import { LogMessage } from './common-types'; | ||
@@ -9,8 +9,2 @@ import { Config } from './entities/config'; | ||
/*************** TEST KIT ***************/ | ||
export function type_check<U extends true, T extends (...args: U[]) => U>(_fn: T) { | ||
/* */ | ||
} | ||
/*************** HELPER TYPES ***************/ | ||
@@ -68,4 +62,2 @@ | ||
type AnyInput = Entity<any, any, any, any, 'input', false>; | ||
// TODO: fix me | ||
// type AnyNonRemoteOutput = Entity<any, never, any, any, 'output'> | ||
@@ -75,3 +67,2 @@ export type GetInputs<T extends EntityMap> = JustFilter<T, AnyInput>; | ||
// export type GetRemoteOutputs<T extends EntityMap> = JustFilterReverse<GetOutputs<T>, AnyNonRemoteOutput> | ||
export type GetRemoteOutputs<T extends EntityMap> = JustFilter<T, AnyRemote>; | ||
@@ -109,17 +100,9 @@ export type GetOnlyLocalUniversalOutputs<T extends EntityMap> = JustFilter<T, OnlyLocalUniversalOutput>; | ||
// type HideEnv<T extends EntityMap, EnvFilter extends string, Key extends 'visibleAt' | 'providedFrom'> = Pick< | ||
// T, | ||
// Exclude<keyof T, FilterENVKeys<T, EnvFilter, Key>> | ||
// > | ||
// prettier-ignore | ||
type MapType<X extends EntityMap> = ({ [k in keyof X]: X[k]['type'] }); | ||
type MapType<X extends EntityMap> = { [k in keyof X]: X[k]['type'] }; | ||
type MapRecordType<X extends Record<string, { type: any }>> = { [k in keyof X]: X[k]['type'] }; | ||
// prettier-ignore | ||
export type MapToProxyType<T extends EntityMap> = ({ | ||
[K in keyof T]: T[K]['proxyType'] | ||
}); | ||
// prettier-ignore | ||
export type MapToPartialType<T extends { [k: string]: any }> = ({ [K in keyof T]: Partial<T[K]['type']> }); | ||
export type MapToProxyType<T extends EntityMap> = { | ||
[K in keyof T]: T[K]['proxyType']; | ||
}; | ||
export type MapToPartialType<T extends { [k: string]: any }> = { [K in keyof T]: Partial<T[K]['type']> }; | ||
@@ -159,3 +142,2 @@ type MapProxyTypesForEnv< | ||
// prettier-ignore | ||
export type RunningFeatures< | ||
@@ -165,14 +147,12 @@ T extends SomeFeature[], | ||
FeatureMap extends MapBy<T, 'id'> = MapBy<T, 'id'> | ||
> = ({ [I in keyof FeatureMap]: Running<FeatureMap[I], ENV> }); | ||
> = { [I in keyof FeatureMap]: Running<FeatureMap[I], ENV> }; | ||
// prettier-ignore | ||
type SettingUpFeature<ID extends string, API extends EntityMap, ENV extends string> = ({ | ||
id: ID | ||
run: (fn: () => unknown) => void | ||
onDispose: (fn: DisposeFunction) => void | ||
type SettingUpFeature<ID extends string, API extends EntityMap, ENV extends string> = { | ||
id: ID; | ||
run: (fn: () => unknown) => void; | ||
onDispose: (fn: DisposeFunction) => void; | ||
} & MapVisibleInputs<API, ENV> & | ||
MapToProxyType<GetRemoteOutputs<API>> & | ||
MapToProxyType<GetOnlyLocalUniversalOutputs<API>>); | ||
MapToProxyType<GetOnlyLocalUniversalOutputs<API>>; | ||
// prettier-ignore | ||
export type RegisteringFeature< | ||
@@ -231,21 +211,2 @@ API extends EntityMap, | ||
// tslint:disable-next-line:no-namespace | ||
export declare namespace Tests { | ||
export type FromString = EQUAL<EnvType<'main'>, 'main'>; | ||
export type FromEnvArray = EQUAL<EnvType<[{ env: 'main' }]>, 'main'>; | ||
export type FromEnv = EQUAL<EnvType<{ env: 'main' }>, 'main'>; | ||
export type FromEnvArrayMultiple = EQUAL<EnvType<[{ env: 'main' }, { env: 'main1' }]>, 'main' | 'main1'>; | ||
export type FromEnvEmptyArray = EQUAL<EnvType<[]>, any>; | ||
export type RunningEmpty = EQUAL<Running<{ id: ''; api: {} }, 'main'>, {}>; | ||
export type RunningProvidesApiInputTypes = EQUAL< | ||
Running<{ id: ''; api: { x: Entity<string, string, 'main', 'main', 'input', false> } }, 'main'>, | ||
{ x: string } | ||
>; | ||
export type RunningProvidesApiOutputTypes = EQUAL< | ||
Running<{ id: ''; api: { x: Entity<string, string, 'main', 'main', 'output', false> } }, 'main'>, | ||
{ x: string } | ||
>; | ||
} | ||
export interface LoggerTransport { | ||
@@ -252,0 +213,0 @@ name: string; |
Sorry, the diff of this file is not supported yet
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
249001
152
4247
+ Addedtypescript-type-utils@0.1.0(transitive)
- Removedtypescript-type-utils@0.0.3(transitive)
Updatedtypescript-type-utils@^0.1.0