@xyo-network/module-model 5.3.20 → 5.3.24
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/neutral/Payload/Address.d.ts +1 -1
- package/dist/neutral/Payload/Address.d.ts.map +1 -1
- package/dist/neutral/Payload/ModuleState.d.ts +1 -1
- package/dist/neutral/Payload/ModuleState.d.ts.map +1 -1
- package/package.json +24 -14
- package/src/Config/Archiving.ts +0 -10
- package/src/Config/Config.ts +0 -29
- package/src/Config/Fields.ts +0 -47
- package/src/Config/Reentrancy.ts +0 -6
- package/src/Config/Security.ts +0 -15
- package/src/Config/index.ts +0 -5
- package/src/CreatableModule/CreatableModule.ts +0 -42
- package/src/CreatableModule/CreatableModuleRegistry.ts +0 -102
- package/src/CreatableModule/LabeledCreatableModule.ts +0 -20
- package/src/CreatableModule/LabeledCreatableModuleFactory.ts +0 -21
- package/src/CreatableModule/ModuleFactory.ts +0 -60
- package/src/CreatableModule/index.ts +0 -5
- package/src/DetailsError.ts +0 -13
- package/src/EventsModels/ModuleBusy.ts +0 -14
- package/src/EventsModels/ModuleError.ts +0 -14
- package/src/EventsModels/ModuleEventArgs.ts +0 -9
- package/src/EventsModels/ModuleEventData.ts +0 -8
- package/src/EventsModels/ModuleQueried.ts +0 -19
- package/src/EventsModels/index.ts +0 -5
- package/src/Labels/Labels.ts +0 -33
- package/src/Labels/index.ts +0 -2
- package/src/Labels/standard/View.ts +0 -4
- package/src/Labels/standard/index.ts +0 -1
- package/src/ModuleDescription.ts +0 -9
- package/src/ModuleFactoryLocatorInstance.ts +0 -47
- package/src/ModuleIdentifier.ts +0 -69
- package/src/ModuleIdentifierTransformer.ts +0 -9
- package/src/ModuleQueryHandlerResult.ts +0 -3
- package/src/ModuleQueryResult.ts +0 -8
- package/src/ModuleStatusReporter.ts +0 -3
- package/src/Payload/Address.ts +0 -37
- package/src/Payload/AddressPreviousHash.ts +0 -13
- package/src/Payload/Description.ts +0 -8
- package/src/Payload/ModuleState.ts +0 -29
- package/src/Payload/index.ts +0 -4
- package/src/Queries/Manifest.ts +0 -9
- package/src/Queries/ModuleAddress/Query.ts +0 -8
- package/src/Queries/ModuleAddress/index.ts +0 -1
- package/src/Queries/State.ts +0 -6
- package/src/Queries/Subscribe.ts +0 -21
- package/src/Queries/index.ts +0 -11
- package/src/QueryableModule/IsQueryableModuleFactory.ts +0 -34
- package/src/QueryableModule/QueryableModule.ts +0 -14
- package/src/QueryableModule/QueryableModuleFields.ts +0 -37
- package/src/QueryableModule/QueryableModuleFunctions.ts +0 -18
- package/src/QueryableModule/QueryableModuleParams.ts +0 -20
- package/src/QueryableModule/asQueryableModule.ts +0 -8
- package/src/QueryableModule/asQueryableModuleObject.ts +0 -8
- package/src/QueryableModule/index.ts +0 -9
- package/src/QueryableModule/isQueryableModule.ts +0 -20
- package/src/QueryableModule/isQueryableModuleObject.ts +0 -20
- package/src/ResolveHelper/ResolveHelper.ts +0 -213
- package/src/ResolveHelper/ResolveHelperStatic.ts +0 -9
- package/src/ResolveHelper/index.ts +0 -9
- package/src/ResolveHelper/model.ts +0 -1
- package/src/ResolveHelper/resolveAddressToInstance.ts +0 -94
- package/src/ResolveHelper/resolveAll.ts +0 -53
- package/src/ResolveHelper/resolveLocalNameToAddress.ts +0 -40
- package/src/ResolveHelper/resolveLocalNameToInstance.ts +0 -47
- package/src/ResolveHelper/resolvePathToAddress.ts +0 -15
- package/src/ResolveHelper/resolvePathToInstance.ts +0 -36
- package/src/ResolveHelper/traceModuleIdentifier.ts +0 -19
- package/src/ResolveHelper/transformModuleIdentifier.ts +0 -13
- package/src/cache.ts +0 -5
- package/src/index.ts +0 -20
- package/src/instance/Instance.ts +0 -68
- package/src/instance/ModuleFilter.ts +0 -33
- package/src/instance/ModuleInstanceParams.ts +0 -11
- package/src/instance/ModuleRepository.ts +0 -12
- package/src/instance/ModuleResolver.ts +0 -21
- package/src/instance/ObjectFilter.ts +0 -48
- package/src/instance/ObjectResolver.ts +0 -40
- package/src/instance/asModuleInstance.ts +0 -5
- package/src/instance/attachable/AttachableInstance.ts +0 -25
- package/src/instance/attachable/asAttachableInstance.ts +0 -5
- package/src/instance/attachable/index.ts +0 -3
- package/src/instance/attachable/isAttachableInstance.ts +0 -17
- package/src/instance/index.ts +0 -10
- package/src/instance/isModuleInstance.ts +0 -15
- package/src/lib/duplicateModules.ts +0 -14
- package/src/lib/index.ts +0 -2
- package/src/lib/serializable.ts +0 -30
- package/src/withModule.ts +0 -15
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { ModuleInstance } from './Instance.ts'
|
|
2
|
-
import type {
|
|
3
|
-
AddressObjectFilter,
|
|
4
|
-
AnyObjectFilter,
|
|
5
|
-
NameObjectFilter,
|
|
6
|
-
ObjectFilter,
|
|
7
|
-
ObjectFilterOptions,
|
|
8
|
-
QueryObjectFilter,
|
|
9
|
-
} from './ObjectFilter.ts'
|
|
10
|
-
import {
|
|
11
|
-
isAddressObjectFilter,
|
|
12
|
-
isNameObjectFilter,
|
|
13
|
-
isQueryObjectFilter,
|
|
14
|
-
} from './ObjectFilter.ts'
|
|
15
|
-
|
|
16
|
-
export interface ModuleFilterOptions<T extends ModuleInstance = ModuleInstance> extends ObjectFilterOptions<T> {}
|
|
17
|
-
|
|
18
|
-
export const isAddressModuleFilter = isAddressObjectFilter<ModuleInstance>
|
|
19
|
-
|
|
20
|
-
export const isNameModuleFilter = isNameObjectFilter<ModuleInstance>
|
|
21
|
-
|
|
22
|
-
export const isQueryModuleFilter = isQueryObjectFilter<ModuleInstance>
|
|
23
|
-
|
|
24
|
-
export type AnyModuleFilter<T extends ModuleInstance = ModuleInstance> = AnyObjectFilter<T>
|
|
25
|
-
|
|
26
|
-
export type AddressModuleFilter<T extends ModuleInstance = ModuleInstance> = AddressObjectFilter<T>
|
|
27
|
-
|
|
28
|
-
export type NameModuleFilter<T extends ModuleInstance = ModuleInstance> = NameObjectFilter<T>
|
|
29
|
-
|
|
30
|
-
export type QueryModuleFilter<T extends ModuleInstance = ModuleInstance> = QueryObjectFilter<T>
|
|
31
|
-
|
|
32
|
-
/** @deprecated use ModuleIdentifier instead */
|
|
33
|
-
export type ModuleFilter<T extends ModuleInstance = ModuleInstance> = ObjectFilter<T>
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { AnyConfigSchema, ModuleConfig } from '../Config/index.ts'
|
|
2
|
-
import type { QueryableModuleParams } from '../QueryableModule/index.ts'
|
|
3
|
-
import type { ModuleInstance } from './Instance.ts'
|
|
4
|
-
|
|
5
|
-
export type ModuleInstanceChildrenParams = {
|
|
6
|
-
privateChildren?: ModuleInstance[]
|
|
7
|
-
publicChildren?: ModuleInstance[]
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface ModuleInstanceParams<TConfig extends AnyConfigSchema<ModuleConfig> = AnyConfigSchema<ModuleConfig>> extends
|
|
11
|
-
QueryableModuleParams<TConfig>, ModuleInstanceChildrenParams {}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { Address } from '@xylabs/sdk-js'
|
|
2
|
-
|
|
3
|
-
import type { ModuleInstance } from './Instance.ts'
|
|
4
|
-
import type { ModuleResolverInstance } from './ModuleResolver.ts'
|
|
5
|
-
|
|
6
|
-
export interface ModuleRepository<T extends ModuleInstance = ModuleInstance> extends ModuleResolverInstance<T> {
|
|
7
|
-
add(mod: T): this
|
|
8
|
-
add(mod: T[]): this
|
|
9
|
-
add(mod: T | T[]): this
|
|
10
|
-
|
|
11
|
-
remove(address: Address | string[]): this
|
|
12
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { Address, Promisable } from '@xylabs/sdk-js'
|
|
2
|
-
|
|
3
|
-
import type { ModuleIdentifier } from '../ModuleIdentifier.ts'
|
|
4
|
-
import type { ModuleInstance } from './Instance.ts'
|
|
5
|
-
import type { ObjectFilterOptions } from './ObjectFilter.ts'
|
|
6
|
-
import type { ObjectResolver } from './ObjectResolver.ts'
|
|
7
|
-
import { isObjectResolver } from './ObjectResolver.ts'
|
|
8
|
-
|
|
9
|
-
export const isModuleResolver = isObjectResolver<ModuleInstance>
|
|
10
|
-
|
|
11
|
-
export interface ModuleResolver<TResult extends ModuleInstance = ModuleInstance> extends ObjectResolver<TResult> {}
|
|
12
|
-
|
|
13
|
-
export interface ModuleNameResolver {
|
|
14
|
-
readonly root: ModuleInstance
|
|
15
|
-
resolveIdentifier(id: ModuleIdentifier, options?: ObjectFilterOptions): Promisable<Address | undefined>
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface ModuleResolverInstance<TResult extends ModuleInstance = ModuleInstance> extends ModuleResolver<TResult>, ModuleNameResolver {
|
|
19
|
-
addResolver: (resolver: ModuleResolverInstance<TResult>) => this
|
|
20
|
-
removeResolver: (resolver: ModuleResolverInstance<TResult>) => this
|
|
21
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
Address,
|
|
3
|
-
AnyObject, EmptyObject, TypeCheck,
|
|
4
|
-
} from '@xylabs/sdk-js'
|
|
5
|
-
|
|
6
|
-
import type { ModuleName } from '../ModuleIdentifier.ts'
|
|
7
|
-
|
|
8
|
-
export type Direction = 'up' | 'down' | 'all'
|
|
9
|
-
export type Visibility = 'public' | 'private' | 'all'
|
|
10
|
-
|
|
11
|
-
export interface ResolveStrategy {
|
|
12
|
-
maxDepth?: number
|
|
13
|
-
required?: boolean | 'warn' | 'log'
|
|
14
|
-
retry?: number
|
|
15
|
-
timeout?: number
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface ObjectFilterOptions<T extends EmptyObject = AnyObject> extends ResolveStrategy {
|
|
19
|
-
direction?: Direction
|
|
20
|
-
identity?: TypeCheck<T>
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface AddressObjectFilter<T extends EmptyObject = AnyObject> extends ObjectFilterOptions<T> {
|
|
24
|
-
address: Address[]
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export const isAddressObjectFilter = <T extends EmptyObject = AnyObject>(value: unknown): value is AddressObjectFilter<T> =>
|
|
28
|
-
(value as AddressObjectFilter<T>).address !== undefined
|
|
29
|
-
|
|
30
|
-
export interface NameObjectFilter<T extends EmptyObject = AnyObject> extends ObjectFilterOptions<T> {
|
|
31
|
-
name: ModuleName[]
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export const isNameObjectFilter = <T extends EmptyObject = AnyObject>(value: unknown): value is NameObjectFilter<T> =>
|
|
35
|
-
(value as NameObjectFilter<T>).name !== undefined
|
|
36
|
-
|
|
37
|
-
export interface QueryObjectFilter<T extends EmptyObject = AnyObject> extends ObjectFilterOptions<T> {
|
|
38
|
-
query: string[][]
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export const isQueryObjectFilter = <T extends EmptyObject = AnyObject>(value: unknown): value is QueryObjectFilter<T> =>
|
|
42
|
-
(value as QueryObjectFilter<T>).query !== undefined
|
|
43
|
-
|
|
44
|
-
export type AnyObjectFilter<T extends EmptyObject = AnyObject> = Partial<AddressObjectFilter<T>>
|
|
45
|
-
& Partial<NameObjectFilter<T>>
|
|
46
|
-
& Partial<QueryObjectFilter<T>>
|
|
47
|
-
|
|
48
|
-
export type ObjectFilter<T extends EmptyObject> = ObjectFilterOptions<T> | AddressObjectFilter<T> | NameObjectFilter<T> | QueryObjectFilter<T>
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
AnyObject, EmptyObject, Promisable,
|
|
3
|
-
} from '@xylabs/sdk-js'
|
|
4
|
-
|
|
5
|
-
import type { ModuleIdentifier } from '../ModuleIdentifier.ts'
|
|
6
|
-
import type { ObjectFilterOptions } from './ObjectFilter.ts'
|
|
7
|
-
|
|
8
|
-
export const isObjectResolver = <T extends EmptyObject = AnyObject>(value?: unknown): value is ObjectResolver<T> => {
|
|
9
|
-
return typeof (value as Partial<ObjectResolver<T>>).resolve === 'function'
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const ObjectResolverPriority = {
|
|
13
|
-
Disabled: -1,
|
|
14
|
-
VeryLow: 0,
|
|
15
|
-
Low: 1,
|
|
16
|
-
Normal: 2,
|
|
17
|
-
High: 3,
|
|
18
|
-
VeryHigh: 4,
|
|
19
|
-
} as const
|
|
20
|
-
|
|
21
|
-
export type ObjectResolverPriority = typeof ObjectResolverPriority[keyof typeof ObjectResolverPriority]
|
|
22
|
-
|
|
23
|
-
export interface ObjectResolver<TResult extends EmptyObject> {
|
|
24
|
-
priority: ObjectResolverPriority
|
|
25
|
-
resolve<T extends TResult = TResult>(all: '*', options?: ObjectFilterOptions<T>): Promisable<T[]>
|
|
26
|
-
resolve<T extends TResult = TResult>(id: ModuleIdentifier, options?: ObjectFilterOptions<T>): Promisable<T | undefined>
|
|
27
|
-
resolve<T extends TResult = TResult>(
|
|
28
|
-
id?: ModuleIdentifier,
|
|
29
|
-
options?: ObjectFilterOptions<T>,
|
|
30
|
-
): Promisable<T | T[] | undefined>
|
|
31
|
-
|
|
32
|
-
resolvePrivate<T extends TResult = TResult>(all: '*', options?: ObjectFilterOptions<T>): Promise<T[]>
|
|
33
|
-
resolvePrivate<T extends TResult = TResult>(id: ModuleIdentifier, options?: ObjectFilterOptions<T>): Promise<T | undefined>
|
|
34
|
-
resolvePrivate<T extends TResult = TResult>(id: ModuleIdentifier, options?: ObjectFilterOptions<T>): Promise<T | T[] | undefined>
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface ObjectResolverInstance<TResult extends EmptyObject> extends ObjectResolver<TResult> {
|
|
38
|
-
addResolver: (resolver: ObjectResolverInstance<TResult>) => this
|
|
39
|
-
removeResolver: (resolver: ObjectResolverInstance<TResult>) => this
|
|
40
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { CreatableInstance, TypeCheck } from '@xylabs/sdk-js'
|
|
2
|
-
import { IsObjectFactory } from '@xylabs/sdk-js'
|
|
3
|
-
|
|
4
|
-
import type { ModuleEventData } from '../../EventsModels/index.ts'
|
|
5
|
-
import type { QueryableModuleParams } from '../../QueryableModule/index.ts'
|
|
6
|
-
import type { ModuleInstance } from '../Instance.ts'
|
|
7
|
-
import type { ModuleResolverInstance } from '../ModuleResolver.ts'
|
|
8
|
-
|
|
9
|
-
export interface AttachableModuleInstance<TParams extends QueryableModuleParams = QueryableModuleParams, TEventData extends ModuleEventData = ModuleEventData>
|
|
10
|
-
extends ModuleInstance<TParams, TEventData>, CreatableInstance<TParams, TEventData> {
|
|
11
|
-
config: TParams['config']
|
|
12
|
-
/* The resolver is a 'down' resolver. It can resolve the module or any children (if it is a node for example), that are in the module */
|
|
13
|
-
readonly downResolver: ModuleResolverInstance
|
|
14
|
-
|
|
15
|
-
// The resolver that gets called by children (usually only Nodes have this)
|
|
16
|
-
readonly privateResolver: ModuleResolverInstance
|
|
17
|
-
|
|
18
|
-
/* The resolver is a 'up' resolver. It can resolve the parent or any children of the parent */
|
|
19
|
-
/* This is set by a NodeModule when attaching to the module */
|
|
20
|
-
readonly upResolver: ModuleResolverInstance
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export type AttachableModuleInstanceTypeCheck<T extends AttachableModuleInstance = AttachableModuleInstance> = TypeCheck<T>
|
|
24
|
-
|
|
25
|
-
export class IsAttachableModuleInstanceFactory<T extends AttachableModuleInstance = AttachableModuleInstance> extends IsObjectFactory<T> {}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { ObjectTypeShape, TypeCheck } from '@xylabs/sdk-js'
|
|
2
|
-
import { IsObjectFactory } from '@xylabs/sdk-js'
|
|
3
|
-
|
|
4
|
-
import { isModuleInstance } from '../isModuleInstance.ts'
|
|
5
|
-
import type { AttachableModuleInstance } from './AttachableInstance.ts'
|
|
6
|
-
|
|
7
|
-
export const requiredAttachableModuleInstanceFunctions: ObjectTypeShape = {
|
|
8
|
-
downResolver: 'object',
|
|
9
|
-
upResolver: 'object',
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// we do not use IsInstanceFactory here to prevent a cycle
|
|
13
|
-
const factory = new IsObjectFactory<AttachableModuleInstance>()
|
|
14
|
-
|
|
15
|
-
export const isAttachableModuleInstance: TypeCheck<AttachableModuleInstance> = factory.create(requiredAttachableModuleInstanceFunctions, [
|
|
16
|
-
isModuleInstance,
|
|
17
|
-
])
|
package/src/instance/index.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from './asModuleInstance.ts'
|
|
2
|
-
export * from './attachable/index.ts'
|
|
3
|
-
export * from './Instance.ts'
|
|
4
|
-
export * from './isModuleInstance.ts'
|
|
5
|
-
export * from './ModuleFilter.ts'
|
|
6
|
-
export * from './ModuleInstanceParams.ts'
|
|
7
|
-
export * from './ModuleRepository.ts'
|
|
8
|
-
export * from './ModuleResolver.ts'
|
|
9
|
-
export * from './ObjectFilter.ts'
|
|
10
|
-
export * from './ObjectResolver.ts'
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { ObjectTypeShape, TypeCheck } from '@xylabs/sdk-js'
|
|
2
|
-
import { IsObjectFactory } from '@xylabs/sdk-js'
|
|
3
|
-
|
|
4
|
-
import { isQueryableModule } from '../QueryableModule/index.ts'
|
|
5
|
-
import type { ModuleInstance } from './Instance.ts'
|
|
6
|
-
|
|
7
|
-
export const requiredModuleInstanceFunctions: ObjectTypeShape = {
|
|
8
|
-
manifest: 'function',
|
|
9
|
-
state: 'function',
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// we do not use IsInstanceFactory here to prevent a cycle
|
|
13
|
-
const factory = new IsObjectFactory<ModuleInstance>()
|
|
14
|
-
|
|
15
|
-
export const isModuleInstance: TypeCheck<ModuleInstance> = factory.create(requiredModuleInstanceFunctions, [isQueryableModule])
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { QueryableModule } from '../QueryableModule/index.ts'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Used to filter duplicates from an array of modules
|
|
5
|
-
* @example: modulesArray.filter(duplicateModules)
|
|
6
|
-
* @param value Current Module
|
|
7
|
-
* @param index Current Module's index
|
|
8
|
-
* @param array Module Array
|
|
9
|
-
* @returns True if the Module's address is the first occurrence of
|
|
10
|
-
* that address in the array, false otherwise
|
|
11
|
-
*/
|
|
12
|
-
export const duplicateModules = (value: QueryableModule, index: number, array: QueryableModule[]): value is QueryableModule => {
|
|
13
|
-
return array.findIndex(v => v.address === value.address) === index
|
|
14
|
-
}
|
package/src/lib/index.ts
DELETED
package/src/lib/serializable.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export const isSerializable = (value: unknown, maxDepth = 10): boolean => {
|
|
2
|
-
if (maxDepth <= 0) {
|
|
3
|
-
return false
|
|
4
|
-
}
|
|
5
|
-
if (value === null || typeof value === 'boolean' || typeof value === 'number' || typeof value === 'string') {
|
|
6
|
-
return true
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
if (Array.isArray(value)) {
|
|
10
|
-
return value.every(item => isSerializable(item, maxDepth - 1))
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
if (typeof value === 'object') {
|
|
14
|
-
if (value instanceof Date || value instanceof RegExp) {
|
|
15
|
-
return true
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// Check for non-serializable objects like Set and Map
|
|
19
|
-
if (value instanceof Set || value instanceof Map) {
|
|
20
|
-
return false
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (value !== null && value !== undefined) {
|
|
24
|
-
return Object.values(value).every(item => isSerializable(item, maxDepth - 1))
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// Exclude functions, symbols, undefined, and BigInt explicitly
|
|
29
|
-
return false
|
|
30
|
-
}
|
package/src/withModule.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { TypeCheck } from '@xylabs/sdk-js'
|
|
2
|
-
|
|
3
|
-
/** @deprecated use narrowing instead [ if(is) ] */
|
|
4
|
-
export const WithFactory = {
|
|
5
|
-
create: <T extends object>(typeCheck: TypeCheck<T>) => {
|
|
6
|
-
return <R>(
|
|
7
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
|
-
mod: any,
|
|
9
|
-
|
|
10
|
-
closure: (mod: T) => R,
|
|
11
|
-
): R | undefined => {
|
|
12
|
-
return typeCheck(mod) ? closure(mod) : undefined
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
}
|