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

@xyo-network/module-model

Package Overview
Dependencies
Maintainers
0
Versions
707
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xyo-network/module-model - npm Package Compare versions

Comparing version 3.0.7 to 3.0.8

dist/neutral/cache.d.ts

803

dist/neutral/index.d.ts

@@ -1,783 +0,20 @@

import * as _xyo_network_payload_model from '@xyo-network/payload-model';
import { Schema, Payload, ModuleError, WithMeta, Query } from '@xyo-network/payload-model';
import { Address } from '@xylabs/hex';
import * as _xylabs_object from '@xylabs/object';
import { EmptyObject, WithAdditional, BaseParams, TypeCheck, AnyObject, ObjectTypeShape, IsObjectFactory, JsonValue } from '@xylabs/object';
import { LogLevel, Logger } from '@xylabs/logger';
import { RetryConfig } from '@xylabs/retry';
import * as _xyo_network_account_model from '@xyo-network/account-model';
import { AccountInstance } from '@xyo-network/account-model';
import { EventArgs, EventData, EventFunctions } from '@xyo-network/module-events';
import { BoundWitness, QueryBoundWitness } from '@xyo-network/boundwitness-model';
import * as _xylabs_promise from '@xylabs/promise';
import { Promisable } from '@xylabs/promise';
import { ModuleManifestPayload } from '@xyo-network/manifest-model';
interface CacheConfig {
max?: number;
maxSize?: number;
ttl?: number;
}
declare const MODULE_PATH_SEPARATOR: ":";
declare const DisallowedModuleIdentifierCharacters: {
' ': boolean;
'!': boolean;
'"': boolean;
'#': boolean;
$: boolean;
'%': boolean;
'&': boolean;
"'": boolean;
'(': boolean;
')': boolean;
'*': boolean;
',': boolean;
'.': boolean;
'/': boolean;
':': boolean;
';': boolean;
'<': boolean;
'=': boolean;
'>': boolean;
'?': boolean;
'@': boolean;
'[': boolean;
']': boolean;
'^': boolean;
_: boolean;
'{': boolean;
'|': boolean;
'}': boolean;
'~': boolean;
};
type ReservedModuleIdentifierCharacter = keyof typeof DisallowedModuleIdentifierCharacters;
declare const ReservedModuleIdentifierCharacters: Set<":" | " " | "!" | "\"" | "#" | "$" | "%" | "&" | "'" | "(" | ")" | "*" | "," | "." | "/" | ";" | "<" | "=" | ">" | "?" | "@" | "[" | "]" | "^" | "_" | "{" | "|" | "}" | "~">;
type ModuleName = Exclude<string, 'reserved-module-name-56487634'>;
type ModuleIdentifier = ColonPair<ModuleIdentifierPart> | ColonPair<ColonPair<ModuleIdentifierPart>> | ColonPair<ColonPair<ColonPair<ModuleIdentifierPart>>> | ColonPair<ColonPair<ColonPair<ColonPair<ModuleIdentifierPart>>>> | ColonPair<ColonPair<ColonPair<ColonPair<ColonPair<ModuleIdentifierPart>>>>> | ColonPair<ColonPair<ColonPair<ColonPair<ColonPair<ColonPair<ModuleIdentifierPart>>>>>> | ColonPair<ColonPair<ColonPair<ColonPair<ColonPair<ColonPair<ColonPair<ModuleIdentifierPart>>>>>>>;
type ColonPair<T extends string> = `${T}:${T}` | T;
type ModuleIdentifierPart = Exclude<Address | ModuleName, '*'>;
declare const isModuleName: (value: unknown) => value is ModuleName;
declare const includesReservedModuleIdentifierCharacter: (value: unknown) => boolean;
declare const isModuleIdentifierPart: (value: unknown) => value is ModuleIdentifierPart;
interface ArchivingModuleConfig {
readonly archiving?: {
readonly archivists?: ModuleIdentifier[];
readonly queries?: Schema[];
};
}
interface Labels {
[key: string]: string | undefined;
}
interface WithLabels<T extends Labels = Labels> {
labels: T;
}
interface WithOptionalLabels<T extends Labels = Labels> {
labels?: T;
}
declare const hasAllLabels: (source?: Labels, required?: Labels) => boolean;
declare const ModuleLimitationLabelName = "network.xyo.module.limitation";
type ModuleLimitationLabelName = typeof ModuleLimitationLabelName;
declare const ModuleLimitationViewLabel: {
ModuleLimitationLabelName: string;
};
type CosigningAddressSet = Address[];
interface ModuleSecurityConfig {
readonly allowAnonymous?: boolean;
readonly allowed?: Record<Schema, (Address | CosigningAddressSet)[]>;
readonly disallowed?: Record<Schema, Address[]>;
}
interface ModuleConfigFields {
readonly allowedQueries?: Schema[] | undefined;
readonly archivist?: ModuleIdentifier;
readonly certify?: boolean;
readonly consoleLogger?: LogLevel;
readonly labels?: Labels;
readonly name?: ModuleName;
readonly paging?: Record<string, {
size?: number;
}>;
readonly retry?: RetryConfig;
readonly security?: ModuleSecurityConfig;
readonly sign?: boolean;
readonly storeQueries?: boolean;
readonly timestamp?: boolean;
}
type ModuleConfigSchema = 'network.xyo.module.config';
declare const ModuleConfigSchema: ModuleConfigSchema;
type ModuleConfig<TConfig extends EmptyObject | Payload | void = void, TSchema extends Schema | void = void> = Payload<WithAdditional<ArchivingModuleConfig & ModuleConfigFields, TConfig>, TSchema extends Schema ? TSchema : TConfig extends Payload ? TConfig['schema'] : ModuleConfigSchema>;
type AnyConfigSchema<TConfig extends Omit<ModuleConfig, 'schema'> & {
schema: string;
} = Omit<ModuleConfig, 'schema'> & {
schema: string;
}> = ModuleConfig<TConfig, string>;
type OptionalConfigSchema<TConfig extends AnyConfigSchema<ModuleConfig> = AnyConfigSchema<ModuleConfig>> = Omit<TConfig, 'schema'> & {
schema?: TConfig['schema'];
};
type AnyModuleConfig = AnyConfigSchema<ModuleConfig>;
type ModuleEventArgs<TModule extends object = object, TArgs extends EventArgs | undefined = undefined> = TArgs extends EventArgs ? {
mod: TModule;
} & TArgs : {
mod: TModule;
};
type ModuleBusyEventArgs<TModule extends object = object> = ModuleEventArgs<TModule, {
busy: boolean;
}>;
interface ModuleBusyEventData<TModule extends object = object> extends EventData {
moduleBusy: ModuleBusyEventArgs<TModule>;
}
type ModuleErrorEventArgs<TModule extends object = object> = ModuleEventArgs<TModule, {
error: Error;
}>;
interface ModuleErrorEventData<TModule extends object = object> extends EventData {
moduleError: ModuleErrorEventArgs<TModule>;
}
type ModuleQueryResult<P extends Payload = Payload, E extends ModuleError = ModuleError, B extends BoundWitness = BoundWitness> = [
WithMeta<B>,
WithMeta<P>[],
WithMeta<E>[]
];
type ModuleQueriedEventArgs<TModule extends object = object> = ModuleEventArgs<TModule, {
payloads?: Payload[];
query: QueryBoundWitness;
result: ModuleQueryResult;
}>;
interface ModuleQueriedEventData<TModule extends object = object> extends EventData {
moduleQueried: ModuleQueriedEventArgs<TModule>;
}
interface ModuleEventData<TModule extends object = object> extends ModuleQueriedEventData<TModule>, ModuleBusyEventData<TModule>, ModuleErrorEventData<TModule> {
}
type ModuleIdentifierTransformerFunc = (id: ModuleIdentifier) => Promisable<ModuleIdentifier | undefined>;
interface ModuleIdentifierTransformer {
transform: ModuleIdentifierTransformerFunc;
}
type ModuleParams<TConfig extends AnyConfigSchema<ModuleConfig> | void = void, TAdditionalParams extends EmptyObject | void = void> = WithAdditional<BaseParams<{
account?: AccountInstance | 'random';
addToResolvers?: boolean;
additionalSigners?: AccountInstance[];
allowNameResolution?: boolean;
config: TConfig extends AnyConfigSchema<ModuleConfig> ? TConfig : AnyConfigSchema<ModuleConfig>;
ephemeralQueryAccountEnabled?: boolean;
moduleIdentifierTransformers?: ModuleIdentifierTransformer[];
}>, TAdditionalParams>;
interface ModuleFields<TParams extends ModuleParams = ModuleParams> {
address: Address;
config: TParams['config'];
id: string;
modName?: ModuleName;
params: TParams;
previousHash: () => Promisable<string | undefined>;
queries: string[];
query: <T extends QueryBoundWitness = QueryBoundWitness, TConf extends ModuleConfig = ModuleConfig>(query: T, payloads?: Payload[], queryConfig?: TConf) => Promisable<ModuleQueryResult>;
queryable: <T extends QueryBoundWitness = QueryBoundWitness, TConf extends ModuleConfig = ModuleConfig>(query: T, payloads?: Payload[], queryConfig?: TConf) => Promisable<boolean>;
start?: () => Promisable<boolean>;
stop?: () => Promisable<boolean>;
}
interface Module<TParams extends ModuleParams = ModuleParams, TEventData extends ModuleEventData<object> = ModuleEventData<object>> extends ModuleFields<TParams>, EventFunctions<TEventData> {
}
declare const asModule: {
<TType extends Module<_xylabs_object.BaseParamsFields & {
account?: _xyo_network_account_model.AccountInstance | "random";
addToResolvers?: boolean;
additionalSigners?: _xyo_network_account_model.AccountInstance[];
allowNameResolution?: boolean;
config: _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & Omit<ArchivingModuleConfig & ModuleConfigFields & _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
schema: "network.xyo.module.config";
}, "schema"> & {
schema: string;
};
ephemeralQueryAccountEnabled?: boolean;
moduleIdentifierTransformers?: ModuleIdentifierTransformer[];
}, ModuleEventData<object>>>(value: _xylabs_promise.AnyNonPromise, config?: _xylabs_object.TypeCheckConfig): TType | undefined;
<TType extends Module<_xylabs_object.BaseParamsFields & {
account?: _xyo_network_account_model.AccountInstance | "random";
addToResolvers?: boolean;
additionalSigners?: _xyo_network_account_model.AccountInstance[];
allowNameResolution?: boolean;
config: _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & Omit<ArchivingModuleConfig & ModuleConfigFields & _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
schema: "network.xyo.module.config";
}, "schema"> & {
schema: string;
};
ephemeralQueryAccountEnabled?: boolean;
moduleIdentifierTransformers?: ModuleIdentifierTransformer[];
}, ModuleEventData<object>>>(value: _xylabs_promise.AnyNonPromise, assert: _xylabs_object.StringOrAlertFunction<Module<_xylabs_object.BaseParamsFields & {
account?: _xyo_network_account_model.AccountInstance | "random";
addToResolvers?: boolean;
additionalSigners?: _xyo_network_account_model.AccountInstance[];
allowNameResolution?: boolean;
config: _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & Omit<ArchivingModuleConfig & ModuleConfigFields & _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
schema: "network.xyo.module.config";
}, "schema"> & {
schema: string;
};
ephemeralQueryAccountEnabled?: boolean;
moduleIdentifierTransformers?: ModuleIdentifierTransformer[];
}, ModuleEventData<object>>>, config?: _xylabs_object.TypeCheckConfig): TType;
};
declare const asModuleObject: {
<TType extends Module<_xylabs_object.BaseParamsFields & {
account?: _xyo_network_account_model.AccountInstance | "random";
addToResolvers?: boolean;
additionalSigners?: _xyo_network_account_model.AccountInstance[];
allowNameResolution?: boolean;
config: _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & Omit<ArchivingModuleConfig & ModuleConfigFields & _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
schema: "network.xyo.module.config";
}, "schema"> & {
schema: string;
};
ephemeralQueryAccountEnabled?: boolean;
moduleIdentifierTransformers?: ModuleIdentifierTransformer[];
}, ModuleEventData<object>>>(value: _xylabs_promise.AnyNonPromise, config?: _xylabs_object.TypeCheckConfig): TType | undefined;
<TType extends Module<_xylabs_object.BaseParamsFields & {
account?: _xyo_network_account_model.AccountInstance | "random";
addToResolvers?: boolean;
additionalSigners?: _xyo_network_account_model.AccountInstance[];
allowNameResolution?: boolean;
config: _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & Omit<ArchivingModuleConfig & ModuleConfigFields & _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
schema: "network.xyo.module.config";
}, "schema"> & {
schema: string;
};
ephemeralQueryAccountEnabled?: boolean;
moduleIdentifierTransformers?: ModuleIdentifierTransformer[];
}, ModuleEventData<object>>>(value: _xylabs_promise.AnyNonPromise, assert: _xylabs_object.StringOrAlertFunction<Module<_xylabs_object.BaseParamsFields & {
account?: _xyo_network_account_model.AccountInstance | "random";
addToResolvers?: boolean;
additionalSigners?: _xyo_network_account_model.AccountInstance[];
allowNameResolution?: boolean;
config: _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & Omit<ArchivingModuleConfig & ModuleConfigFields & _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
schema: "network.xyo.module.config";
}, "schema"> & {
schema: string;
};
ephemeralQueryAccountEnabled?: boolean;
moduleIdentifierTransformers?: ModuleIdentifierTransformer[];
}, ModuleEventData<object>>>, config?: _xylabs_object.TypeCheckConfig): TType;
};
declare const requiredModuleQueries: Schema[];
declare const isModule: TypeCheck<Module>;
type ModuleTypeCheck<T extends Module = Module> = TypeCheck<T>;
declare class IsModuleFactory<T extends Module = Module> {
create(expectedQueries?: string[], additionalChecks?: TypeCheck<AnyObject | EmptyObject>[]): ModuleTypeCheck<T>;
}
declare const requiredModuleShape: ObjectTypeShape;
declare const isModuleObject: _xylabs_object.TypeCheck<Module<_xylabs_object.BaseParamsFields & {
account?: _xyo_network_account_model.AccountInstance | "random";
addToResolvers?: boolean;
additionalSigners?: _xyo_network_account_model.AccountInstance[];
allowNameResolution?: boolean;
config: _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & Omit<ArchivingModuleConfig & ModuleConfigFields & _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
schema: "network.xyo.module.config";
}, "schema"> & {
schema: string;
};
ephemeralQueryAccountEnabled?: boolean;
moduleIdentifierTransformers?: ModuleIdentifierTransformer[];
}, ModuleEventData<object>>>;
declare const AddressSchema: "network.xyo.address";
type AddressSchema = typeof AddressSchema;
declare const AddressChildSchema: "network.xyo.address.child";
type AddressChildSchema = typeof AddressChildSchema;
interface AddressFields {
address: Address;
}
type AddressPayload = Payload<AddressFields, AddressSchema>;
interface AddressChildFields extends AddressFields {
path?: string;
root?: Address;
}
type AddressChildPayload = Payload<AddressChildFields, AddressChildSchema>;
declare const AddressPreviousHashSchema: "network.xyo.address.hash.previous";
type AddressPreviousHashSchema = typeof AddressPreviousHashSchema;
type AddressPreviousHashPayload = Payload<{
address: Address;
previousHash?: string;
}, AddressPreviousHashSchema>;
interface ModuleDescription {
address: Address;
children?: string[];
name?: ModuleName;
queries: string[];
}
declare const ModuleDescriptionSchema: "network.xyo.module.description";
type ModuleDescriptionSchema = typeof ModuleDescriptionSchema;
type ModuleDescriptionPayload = Payload<ModuleDescription, ModuleDescriptionSchema>;
interface StateDictionary {
[key: string]: string | number | undefined;
}
interface State<T extends StateDictionary = StateDictionary> {
state: T;
}
declare const ModuleStateSchema: "network.xyo.module.state";
type ModuleStateSchema = typeof ModuleStateSchema;
type ModuleState<T extends StateDictionary = StateDictionary> = Payload<State<T>, ModuleStateSchema>;
declare const isModuleState: <T extends StateDictionary = StateDictionary>(payload?: Payload | null) => payload is ModuleState<T>;
declare const isModuleStateWithMeta: <T extends StateDictionary = StateDictionary>(payload?: Payload | null) => payload is WithMeta<ModuleState<T>>;
interface ModuleQueryFunctions {
manifest: (maxDepth?: number, ignoreAddresses?: Address[]) => Promisable<ModuleManifestPayload>;
manifestQuery: (account: AccountInstance, maxDepth?: number, ignoreAddresses?: Address[]) => Promisable<ModuleQueryResult<ModuleManifestPayload>>;
moduleAddress: () => Promisable<(AddressPreviousHashPayload | AddressPayload)[]>;
state: () => Promisable<Payload[]>;
stateQuery: (account: AccountInstance) => Promisable<ModuleQueryResult>;
}
type Direction = 'up' | 'down' | 'all';
type Visibility = 'public' | 'private' | 'all';
interface ResolveStrategy {
maxDepth?: number;
required?: boolean | 'warn' | 'log';
retry?: number;
timeout?: number;
}
interface ObjectFilterOptions<T extends EmptyObject = AnyObject> extends ResolveStrategy {
direction?: Direction;
identity?: TypeCheck<T>;
}
interface AddressObjectFilter<T extends EmptyObject = AnyObject> extends ObjectFilterOptions<T> {
address: Address[];
}
declare const isAddressObjectFilter: <T extends EmptyObject = AnyObject>(value: unknown) => value is AddressObjectFilter<T>;
interface NameObjectFilter<T extends EmptyObject = AnyObject> extends ObjectFilterOptions<T> {
name: ModuleName[];
}
declare const isNameObjectFilter: <T extends EmptyObject = AnyObject>(value: unknown) => value is NameObjectFilter<T>;
interface QueryObjectFilter<T extends EmptyObject = AnyObject> extends ObjectFilterOptions<T> {
query: string[][];
}
declare const isQueryObjectFilter: <T extends EmptyObject = AnyObject>(value: unknown) => value is QueryObjectFilter<T>;
type AnyObjectFilter<T extends EmptyObject = AnyObject> = Partial<AddressObjectFilter<T>> & Partial<NameObjectFilter<T>> & Partial<QueryObjectFilter<T>>;
type ObjectFilter<T extends EmptyObject> = ObjectFilterOptions<T> | AddressObjectFilter<T> | NameObjectFilter<T> | QueryObjectFilter<T>;
declare const isObjectResolver: <T extends EmptyObject = AnyObject>(value?: unknown) => value is ObjectResolver<T>;
declare enum ObjectResolverPriority {
Disabled = -1,
VeryLow = 0,
Low = 1,
Normal = 2,
High = 3,
VeryHigh = 4
}
interface ObjectResolver<TResult extends EmptyObject> {
priority: ObjectResolverPriority;
resolve<T extends TResult = TResult>(): Promisable<T | undefined>;
resolve<T extends TResult = TResult>(all: '*', options?: ObjectFilterOptions<T>): Promisable<T[]>;
resolve<T extends TResult = TResult>(id: ModuleIdentifier, options?: ObjectFilterOptions<T>): Promisable<T | undefined>;
resolve<T extends TResult = TResult>(filter: ObjectFilter<T>, options?: ObjectFilterOptions<T>): Promisable<T[]>;
resolve<T extends TResult = TResult>(filter?: ObjectFilter<T>, options?: ObjectFilterOptions<T>): Promisable<T[]>;
resolve<T extends TResult = TResult>(idOrFilter?: ObjectFilter<T> | ModuleIdentifier, options?: ObjectFilterOptions<T>): Promisable<T | T[] | undefined>;
resolvePrivate<T extends TResult = TResult>(all: '*', options?: ObjectFilterOptions<T>): Promise<T[]>;
resolvePrivate<T extends TResult = TResult>(id: ModuleIdentifier, options?: ObjectFilterOptions<T>): Promise<T | undefined>;
resolvePrivate<T extends TResult = TResult>(id: ModuleIdentifier, options?: ObjectFilterOptions<T>): Promise<T | T[] | undefined>;
}
interface ObjectResolverInstance<TResult extends EmptyObject> extends ObjectResolver<TResult> {
addResolver: (resolver: ObjectResolverInstance<TResult>) => this;
removeResolver: (resolver: ObjectResolverInstance<TResult>) => this;
}
type ModulePipeLine = Lowercase<'one-to-one' | 'one-to-many' | 'many-to-one' | 'many-to-many'>;
type ModuleStatus = 'started' | 'stopped' | 'dead' | 'wrapped' | 'proxy';
declare class DeadModuleError extends Error {
id: ModuleIdentifier;
error: Error | undefined;
constructor(id: ModuleIdentifier, error: Error | undefined, msg?: string);
}
interface AddressToWeakInstanceCache {
get: (address: Address) => WeakRef<ModuleInstance> | null;
set: (address: Address, instance: WeakRef<ModuleInstance> | null) => void;
}
interface ModuleFamilyFunctions {
account?: AccountInstance | undefined;
addParent: (mod: ModuleInstance) => void;
addressCache?: (direction: Direction, includePrivate: boolean) => AddressToWeakInstanceCache | undefined;
modName?: ModuleName;
parents: () => Promisable<ModuleInstance[]>;
privateChildren: () => Promisable<ModuleInstance[]>;
publicChildren: () => Promisable<ModuleInstance[]>;
removeParent: (address: Address) => void;
siblings: () => Promisable<ModuleInstance[]>;
}
interface ModuleInstance<TParams extends ModuleParams = ModuleParams, TEventData extends ModuleEventData = ModuleEventData> extends Module<TParams, TEventData>, ObjectResolver<ModuleInstance>, ModuleQueryFunctions, ModuleFamilyFunctions {
readonly pipeline?: ModulePipeLine;
readonly status: ModuleStatus;
}
type InstanceTypeCheck<T extends ModuleInstance = ModuleInstance> = TypeCheck<T>;
declare class IsInstanceFactory<T extends ModuleInstance = ModuleInstance> extends IsObjectFactory<T> {
}
declare const asModuleInstance: {
<TType extends ModuleInstance<_xylabs_object.BaseParamsFields & {
account?: _xyo_network_account_model.AccountInstance | "random";
addToResolvers?: boolean;
additionalSigners?: _xyo_network_account_model.AccountInstance[];
allowNameResolution?: boolean;
config: _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & Omit<ArchivingModuleConfig & ModuleConfigFields & _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
schema: "network.xyo.module.config";
}, "schema"> & {
schema: string;
};
ephemeralQueryAccountEnabled?: boolean;
moduleIdentifierTransformers?: ModuleIdentifierTransformer[];
}, ModuleEventData<object>>>(value: _xylabs_promise.AnyNonPromise, config?: _xylabs_object.TypeCheckConfig): TType | undefined;
<TType extends ModuleInstance<_xylabs_object.BaseParamsFields & {
account?: _xyo_network_account_model.AccountInstance | "random";
addToResolvers?: boolean;
additionalSigners?: _xyo_network_account_model.AccountInstance[];
allowNameResolution?: boolean;
config: _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & Omit<ArchivingModuleConfig & ModuleConfigFields & _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
schema: "network.xyo.module.config";
}, "schema"> & {
schema: string;
};
ephemeralQueryAccountEnabled?: boolean;
moduleIdentifierTransformers?: ModuleIdentifierTransformer[];
}, ModuleEventData<object>>>(value: _xylabs_promise.AnyNonPromise, assert: _xylabs_object.StringOrAlertFunction<ModuleInstance<_xylabs_object.BaseParamsFields & {
account?: _xyo_network_account_model.AccountInstance | "random";
addToResolvers?: boolean;
additionalSigners?: _xyo_network_account_model.AccountInstance[];
allowNameResolution?: boolean;
config: _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & Omit<ArchivingModuleConfig & ModuleConfigFields & _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
schema: "network.xyo.module.config";
}, "schema"> & {
schema: string;
};
ephemeralQueryAccountEnabled?: boolean;
moduleIdentifierTransformers?: ModuleIdentifierTransformer[];
}, ModuleEventData<object>>>, config?: _xylabs_object.TypeCheckConfig): TType;
};
declare const isModuleResolver: (value?: unknown) => value is ObjectResolver<ModuleInstance<_xylabs_object.BaseParamsFields & {
account?: _xyo_network_account_model.AccountInstance | "random";
addToResolvers?: boolean;
additionalSigners?: _xyo_network_account_model.AccountInstance[];
allowNameResolution?: boolean;
config: _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & Omit<ArchivingModuleConfig & ModuleConfigFields & _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
schema: "network.xyo.module.config";
}, "schema"> & {
schema: string;
};
ephemeralQueryAccountEnabled?: boolean;
moduleIdentifierTransformers?: ModuleIdentifierTransformer[];
}, ModuleEventData<object>>>;
interface ModuleResolver<TResult extends ModuleInstance = ModuleInstance> extends ObjectResolver<TResult> {
}
interface ModuleNameResolver {
readonly root: ModuleInstance;
resolveIdentifier(id: ModuleIdentifier, options?: ObjectFilterOptions): Promisable<Address | undefined>;
}
interface ModuleResolverInstance<TResult extends ModuleInstance = ModuleInstance> extends ModuleResolver<TResult>, ModuleNameResolver {
addResolver: (resolver: ModuleResolverInstance<TResult>) => this;
removeResolver: (resolver: ModuleResolverInstance<TResult>) => this;
}
interface AttachableModuleInstance<TParams extends ModuleParams = ModuleParams, TEventData extends ModuleEventData = ModuleEventData> extends ModuleInstance<TParams, TEventData> {
readonly downResolver: ModuleResolverInstance;
readonly privateResolver: ModuleResolverInstance;
readonly upResolver: ModuleResolverInstance;
}
type AttachableModuleInstanceTypeCheck<T extends AttachableModuleInstance = AttachableModuleInstance> = TypeCheck<T>;
declare class IsAttachableModuleInstanceFactory<T extends AttachableModuleInstance = AttachableModuleInstance> extends IsObjectFactory<T> {
}
declare const asAttachableModuleInstance: {
<TType extends AttachableModuleInstance<_xylabs_object.BaseParamsFields & {
account?: _xyo_network_account_model.AccountInstance | "random";
addToResolvers?: boolean;
additionalSigners?: _xyo_network_account_model.AccountInstance[];
allowNameResolution?: boolean;
config: _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & Omit<ArchivingModuleConfig & ModuleConfigFields & _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
schema: "network.xyo.module.config";
}, "schema"> & {
schema: string;
};
ephemeralQueryAccountEnabled?: boolean;
moduleIdentifierTransformers?: ModuleIdentifierTransformer[];
}, ModuleEventData<object>>>(value: _xylabs_promise.AnyNonPromise, config?: _xylabs_object.TypeCheckConfig): TType | undefined;
<TType extends AttachableModuleInstance<_xylabs_object.BaseParamsFields & {
account?: _xyo_network_account_model.AccountInstance | "random";
addToResolvers?: boolean;
additionalSigners?: _xyo_network_account_model.AccountInstance[];
allowNameResolution?: boolean;
config: _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & Omit<ArchivingModuleConfig & ModuleConfigFields & _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
schema: "network.xyo.module.config";
}, "schema"> & {
schema: string;
};
ephemeralQueryAccountEnabled?: boolean;
moduleIdentifierTransformers?: ModuleIdentifierTransformer[];
}, ModuleEventData<object>>>(value: _xylabs_promise.AnyNonPromise, assert: _xylabs_object.StringOrAlertFunction<AttachableModuleInstance<_xylabs_object.BaseParamsFields & {
account?: _xyo_network_account_model.AccountInstance | "random";
addToResolvers?: boolean;
additionalSigners?: _xyo_network_account_model.AccountInstance[];
allowNameResolution?: boolean;
config: _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & Omit<ArchivingModuleConfig & ModuleConfigFields & _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
schema: "network.xyo.module.config";
}, "schema"> & {
schema: string;
};
ephemeralQueryAccountEnabled?: boolean;
moduleIdentifierTransformers?: ModuleIdentifierTransformer[];
}, ModuleEventData<object>>>, config?: _xylabs_object.TypeCheckConfig): TType;
};
declare const requiredAttachableModuleInstanceFunctions: ObjectTypeShape;
declare const isAttachableModuleInstance: TypeCheck<AttachableModuleInstance>;
declare const requiredModuleInstanceFunctions: ObjectTypeShape;
declare const isModuleInstance: TypeCheck<ModuleInstance>;
interface ModuleFilterOptions<T extends ModuleInstance = ModuleInstance> extends ObjectFilterOptions<T> {
}
declare const isAddressModuleFilter: (value: unknown) => value is AddressObjectFilter<ModuleInstance<_xylabs_object.BaseParamsFields & {
account?: _xyo_network_account_model.AccountInstance | "random";
addToResolvers?: boolean;
additionalSigners?: _xyo_network_account_model.AccountInstance[];
allowNameResolution?: boolean;
config: _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & Omit<ArchivingModuleConfig & ModuleConfigFields & _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
schema: "network.xyo.module.config";
}, "schema"> & {
schema: string;
};
ephemeralQueryAccountEnabled?: boolean;
moduleIdentifierTransformers?: ModuleIdentifierTransformer[];
}, ModuleEventData<object>>>;
declare const isNameModuleFilter: (value: unknown) => value is NameObjectFilter<ModuleInstance<_xylabs_object.BaseParamsFields & {
account?: _xyo_network_account_model.AccountInstance | "random";
addToResolvers?: boolean;
additionalSigners?: _xyo_network_account_model.AccountInstance[];
allowNameResolution?: boolean;
config: _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & Omit<ArchivingModuleConfig & ModuleConfigFields & _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
schema: "network.xyo.module.config";
}, "schema"> & {
schema: string;
};
ephemeralQueryAccountEnabled?: boolean;
moduleIdentifierTransformers?: ModuleIdentifierTransformer[];
}, ModuleEventData<object>>>;
declare const isQueryModuleFilter: (value: unknown) => value is QueryObjectFilter<ModuleInstance<_xylabs_object.BaseParamsFields & {
account?: _xyo_network_account_model.AccountInstance | "random";
addToResolvers?: boolean;
additionalSigners?: _xyo_network_account_model.AccountInstance[];
allowNameResolution?: boolean;
config: _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & Omit<ArchivingModuleConfig & ModuleConfigFields & _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
schema: "network.xyo.module.config";
}, "schema"> & {
schema: string;
};
ephemeralQueryAccountEnabled?: boolean;
moduleIdentifierTransformers?: ModuleIdentifierTransformer[];
}, ModuleEventData<object>>>;
type AnyModuleFilter<T extends ModuleInstance = ModuleInstance> = AnyObjectFilter<T>;
type AddressModuleFilter<T extends ModuleInstance = ModuleInstance> = AddressObjectFilter<T>;
type NameModuleFilter<T extends ModuleInstance = ModuleInstance> = NameObjectFilter<T>;
type QueryModuleFilter<T extends ModuleInstance = ModuleInstance> = QueryObjectFilter<T>;
type ModuleFilter<T extends ModuleInstance = ModuleInstance> = ObjectFilter<T>;
interface ModuleRepository<T extends ModuleInstance = ModuleInstance> extends ModuleResolverInstance<T> {
add(mod: T): this;
add(mod: T[]): this;
add(mod: T | T[]): this;
remove(address: Address | string[]): this;
}
type CreatableModuleFactory<T extends AttachableModuleInstance | void = void> = Omit<CreatableModule<T extends AttachableModuleInstance ? T : AttachableModuleInstance>, 'new' | 'create'> & {
create<T extends AttachableModuleInstance>(this: CreatableModuleFactory<T>, params?: T['params']): Promise<T>;
};
interface CreatableModule<T extends AttachableModuleInstance = AttachableModuleInstance> {
configSchemas: Schema[];
defaultConfigSchema: Schema;
defaultLogger?: Logger;
new (privateConstructorKey: string, params: T['params'], account: AccountInstance, address: Address): T;
_noOverride(functionName: string): void;
create<T extends AttachableModuleInstance>(this: CreatableModule<T>, params?: T['params']): Promise<T>;
factory<T extends AttachableModuleInstance>(this: CreatableModule<T>, params?: T['params']): CreatableModuleFactory<T>;
}
declare function creatableModule<TModule extends AttachableModuleInstance = AttachableModuleInstance>(): <U extends CreatableModule<TModule>>(constructor: U) => void;
declare function creatableModuleFactory<TModule extends AttachableModuleInstance = AttachableModuleInstance>(): <U extends CreatableModuleFactory<TModule>>(constructor: U) => void;
type LabeledCreatableModuleFactory<T extends AttachableModuleInstance | void = void> = CreatableModuleFactory<T> & WithOptionalLabels;
declare const hasLabels: (factory: CreatableModuleFactory | LabeledCreatableModuleFactory) => factory is LabeledCreatableModuleFactory;
declare function labeledCreatableModuleFactory<TModule extends AttachableModuleInstance = AttachableModuleInstance>(): <U extends LabeledCreatableModuleFactory<TModule>>(constructor: U) => void;
interface CreatableModuleRegistry {
[key: Schema]: (CreatableModuleFactory | LabeledCreatableModuleFactory)[] | undefined;
}
declare const registerCreatableModuleFactory: <TModule extends AttachableModuleInstance>(registry: CreatableModuleRegistry, factory: CreatableModuleFactory<TModule> | LabeledCreatableModuleFactory<TModule>, labels?: Labels, primary?: boolean | Schema | Schema[]) => void;
declare const registerCreatableModuleFactories: (factories: (CreatableModuleFactory | LabeledCreatableModuleFactory)[], registry?: CreatableModuleRegistry, primary?: boolean) => CreatableModuleRegistry;
declare const assignCreatableModuleRegistry: (target?: CreatableModuleRegistry, ...sources: CreatableModuleRegistry[]) => CreatableModuleRegistry;
declare class ModuleFactory<TModule extends AttachableModuleInstance> implements CreatableModuleFactory<TModule> {
configSchemas: CreatableModuleFactory<TModule>['configSchemas'];
creatableModule: CreatableModule<TModule>;
defaultConfigSchema: Schema;
defaultLogger?: Logger | undefined;
defaultParams?: Omit<TModule['params'], 'config'> & {
config?: Partial<TModule['params']['config']>;
};
labels?: Labels;
constructor(creatableModule: CreatableModule<TModule>, params?: Omit<TModule['params'], 'config'> & {
config?: Partial<TModule['params']['config']>;
}, labels?: Labels);
static withParams<T extends AttachableModuleInstance>(creatableModule: CreatableModule<T>, params?: Omit<T['params'], 'config'> & {
config?: T['params']['config'];
}, labels?: Labels): ModuleFactory<T>;
_getRootFunction(funcName: string): any;
_noOverride(functionName: string): void;
create<T extends AttachableModuleInstance>(this: CreatableModuleFactory<T>, params?: TModule['params'] | undefined): Promise<T>;
factory<T extends AttachableModuleInstance>(this: CreatableModule<T>, _params?: T['params'] | undefined): CreatableModuleFactory<T>;
}
declare class ModuleDetailsError extends Error {
details?: JsonValue | undefined;
constructor(message: string, details?: JsonValue | undefined);
}
declare const duplicateModules: (value: Module, index: number, array: Module[]) => value is Module;
declare const serializable: (field: unknown, depth?: number) => boolean | null;
declare const serializableField: (field: unknown) => boolean;
type ModuleQueryHandlerResult = Payload[];
type ModuleManifestQuerySchema = 'network.xyo.query.module.manifest';
declare const ModuleManifestQuerySchema: ModuleManifestQuerySchema;
type ModuleManifestQuery = Query<{
maxDepth?: number;
schema: ModuleManifestQuerySchema;
}>;
type ModuleAddressQuerySchema = 'network.xyo.query.module.address';
declare const ModuleAddressQuerySchema: ModuleAddressQuerySchema;
type ModuleAddressQuery = Query<{
schema: ModuleAddressQuerySchema;
}>;
declare const ModuleStateQuerySchema: "network.xyo.query.module.state";
type ModuleStateQuerySchema = typeof ModuleStateQuerySchema;
type ModuleStateQuery = Query<void, ModuleStateQuerySchema>;
type ModuleSubscribeQuerySchema = 'network.xyo.query.module.subscribe';
declare const ModuleSubscribeQuerySchema: ModuleSubscribeQuerySchema;
interface ModuleSubscribeFilter {
schema?: string[];
}
type ModuleSubscribeQuery = Query<{
address: Address;
filter?: ModuleSubscribeFilter | null;
maxQueue?: number;
schema: ModuleSubscribeQuerySchema;
}>;
type ModuleQueries = ModuleAddressQuery | ModuleSubscribeQuery | ModuleManifestQuery | ModuleStateQuery;
type ModuleResolveDirection = 'all' | 'up' | 'down';
declare const resolveAddressToInstanceDown: (root: ModuleInstance, address: Address, includePrivate?: boolean | undefined, ignore?: Address[]) => Promise<ModuleInstance | undefined>;
declare const resolveAddressToInstanceSiblings: (root: ModuleInstance, address: Address, includePrivate?: boolean | undefined, ignore?: Address[]) => Promise<ModuleInstance | undefined>;
declare const resolveAddressToInstanceUp: (root: ModuleInstance, address: Address, includePrivate?: boolean | undefined, ignore?: Address[]) => Promise<ModuleInstance | undefined>;
declare const resolveAddressToInstanceAll: (root: ModuleInstance, address: Address, includePrivate?: boolean | undefined, ignore?: Address[]) => Promise<ModuleInstance | undefined>;
declare const resolveAddressToInstance: (root: ModuleInstance, address: Address, includePrivate?: boolean | undefined, ignore?: Address[], direction?: ModuleResolveDirection) => Promise<ModuleInstance | undefined>;
declare const resolveAllUp: (root: ModuleInstance, maxDepth?: number, exclude?: Address[]) => Promise<ModuleInstance[]>;
declare const resolveAllDown: (root: ModuleInstance, maxDepth?: number, exclude?: Address[], includePrivate?: boolean) => Promise<ModuleInstance[]>;
declare const resolveAll: (root: ModuleInstance, maxDepth?: number, exclude?: Address[]) => Promise<ModuleInstance[]>;
declare class ResolveHelperStatic {
static defaultLogger?: Logger;
static transformers: ModuleIdentifierTransformer[];
}
interface ResolveHelperConfig {
address: Address;
dead?: boolean;
downResolver?: ModuleResolver;
logger?: Logger;
mod: ModuleInstance;
privateResolver?: ModuleResolver;
transformers: ModuleIdentifierTransformer[];
upResolver?: ModuleResolver;
}
declare class ResolveHelper extends ResolveHelperStatic {
static resolve<T extends ModuleInstance = ModuleInstance>(config: ResolveHelperConfig, all: '*', options?: ModuleFilterOptions<T>): Promise<T[]>;
static resolve<T extends ModuleInstance = ModuleInstance>(config: ResolveHelperConfig, filter: ModuleFilter, options?: ModuleFilterOptions<T>): Promise<T[]>;
static resolve<T extends ModuleInstance = ModuleInstance>(config: ResolveHelperConfig, id: ModuleIdentifier, options?: ModuleFilterOptions<T>): Promise<T | undefined>;
static resolveModuleIdentifier<T extends ModuleInstance = ModuleInstance>(resolver: ModuleResolver, path: ModuleIdentifier, required?: boolean): Promise<T | undefined>;
static traceModuleIdentifier(resolver: ModuleResolver, path: ModuleIdentifier): Promise<Lowercase<string>[]>;
static transformModuleIdentifier(identifier: ModuleIdentifier, transformers?: ModuleIdentifierTransformer[]): Promise<string | undefined>;
static validateRequiredResolve(required: boolean | 'warn' | 'log', result: ModuleInstance[] | ModuleInstance | undefined, idOrFilter: ModuleIdentifier | ModuleFilter, logger?: Logger | undefined): void;
}
declare const resolveLocalNameToAddressUp: (root: ModuleInstance, modName: ModuleName) => Promise<Address | undefined>;
declare const resolveLocalNameToAddressDown: (root: ModuleInstance, modName: ModuleName, includePrivate?: boolean | undefined) => Promise<Address | undefined>;
declare const resolveLocalNameToAddressAll: (root: ModuleInstance, modName: ModuleName, includePrivate?: boolean | undefined) => Promise<Address | undefined>;
declare const resolveLocalNameToAddress: (root: ModuleInstance, modName: ModuleName, includePrivate?: boolean | undefined, direction?: ModuleResolveDirection) => Promise<Address | undefined>;
declare const resolveLocalNameToInstanceUp: (root: ModuleInstance, modName: ModuleName) => Promise<ModuleInstance | undefined>;
declare const resolveLocalNameToInstanceDown: (root: ModuleInstance, modName: ModuleName, includePrivate?: boolean | undefined) => Promise<ModuleInstance | undefined>;
declare const resolveLocalNameToInstanceAll: (root: ModuleInstance, modName: ModuleName, includePrivate?: boolean) => Promise<ModuleInstance | undefined>;
declare const resolveLocalNameToInstance: (root: ModuleInstance, modName: ModuleName, includePrivate?: boolean, direction?: ModuleResolveDirection) => Promise<ModuleInstance | undefined>;
declare const resolvePathToAddress: (root: ModuleInstance, path: string, includePrivate?: boolean | undefined, transformers?: ModuleIdentifierTransformer[]) => Promise<Address | undefined>;
declare const resolvePathToInstance: (root: ModuleInstance, path: string, includePrivate?: boolean | undefined, transformers?: ModuleIdentifierTransformer[]) => Promise<ModuleInstance | undefined>;
declare const transformModuleIdentifier: (id: ModuleIdentifier, transformers: ModuleIdentifierTransformer[]) => Promise<ModuleIdentifier | undefined>;
declare const WithFactory: {
create: <T extends object>(typeCheck: TypeCheck<T>) => <R>(mod: any, closure: (mod: T) => R) => R | undefined;
};
declare const withModule: <R>(mod: any, closure: (mod: Module<_xylabs_object.BaseParamsFields & {
account?: _xyo_network_account_model.AccountInstance | "random";
addToResolvers?: boolean;
additionalSigners?: _xyo_network_account_model.AccountInstance[];
allowNameResolution?: boolean;
config: _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & Omit<ArchivingModuleConfig & ModuleConfigFields & _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
schema: "network.xyo.module.config";
}, "schema"> & {
schema: string;
};
ephemeralQueryAccountEnabled?: boolean;
moduleIdentifierTransformers?: ModuleIdentifierTransformer[];
}, ModuleEventData<object>>) => R) => R | undefined;
declare const withModuleInstance: <R>(mod: any, closure: (mod: ModuleInstance<_xylabs_object.BaseParamsFields & {
account?: _xyo_network_account_model.AccountInstance | "random";
addToResolvers?: boolean;
additionalSigners?: _xyo_network_account_model.AccountInstance[];
allowNameResolution?: boolean;
config: _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & Omit<ArchivingModuleConfig & ModuleConfigFields & _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
schema: "network.xyo.module.config";
}, "schema"> & {
schema: string;
};
ephemeralQueryAccountEnabled?: boolean;
moduleIdentifierTransformers?: ModuleIdentifierTransformer[];
}, ModuleEventData<object>>) => R) => R | undefined;
export { type AddressChildFields, type AddressChildPayload, AddressChildSchema, type AddressFields, type AddressModuleFilter, type AddressObjectFilter, type AddressPayload, type AddressPreviousHashPayload, AddressPreviousHashSchema, AddressSchema, type AddressToWeakInstanceCache, type AnyConfigSchema, type AnyModuleConfig, type AnyModuleFilter, type AnyObjectFilter, type ArchivingModuleConfig, type AttachableModuleInstance, type AttachableModuleInstanceTypeCheck, type CacheConfig, type ColonPair, type CosigningAddressSet, type CreatableModule, type CreatableModuleFactory, type CreatableModuleRegistry, DeadModuleError, type Direction, DisallowedModuleIdentifierCharacters, type InstanceTypeCheck, IsAttachableModuleInstanceFactory, IsInstanceFactory, IsModuleFactory, type LabeledCreatableModuleFactory, type Labels, MODULE_PATH_SEPARATOR, type Module, type ModuleAddressQuery, ModuleAddressQuerySchema, type ModuleBusyEventArgs, type ModuleBusyEventData, type ModuleConfig, type ModuleConfigFields, ModuleConfigSchema, type ModuleDescription, type ModuleDescriptionPayload, ModuleDescriptionSchema, ModuleDetailsError, type ModuleErrorEventArgs, type ModuleErrorEventData, type ModuleEventArgs, type ModuleEventData, ModuleFactory, type ModuleFamilyFunctions, type ModuleFields, type ModuleFilter, type ModuleFilterOptions, type ModuleIdentifier, type ModuleIdentifierPart, type ModuleIdentifierTransformer, type ModuleIdentifierTransformerFunc, type ModuleInstance, ModuleLimitationLabelName, ModuleLimitationViewLabel, type ModuleManifestQuery, ModuleManifestQuerySchema, type ModuleName, type ModuleNameResolver, type ModuleParams, type ModulePipeLine, type ModuleQueriedEventArgs, type ModuleQueriedEventData, type ModuleQueries, type ModuleQueryFunctions, type ModuleQueryHandlerResult, type ModuleQueryResult, type ModuleRepository, type ModuleResolveDirection, type ModuleResolver, type ModuleResolverInstance, type ModuleSecurityConfig, type ModuleState, type ModuleStateQuery, ModuleStateQuerySchema, ModuleStateSchema, type ModuleStatus, type ModuleSubscribeFilter, type ModuleSubscribeQuery, ModuleSubscribeQuerySchema, type ModuleTypeCheck, type NameModuleFilter, type NameObjectFilter, type ObjectFilter, type ObjectFilterOptions, type ObjectResolver, type ObjectResolverInstance, ObjectResolverPriority, type OptionalConfigSchema, type QueryModuleFilter, type QueryObjectFilter, type ReservedModuleIdentifierCharacter, ReservedModuleIdentifierCharacters, ResolveHelper, type ResolveHelperConfig, type ResolveStrategy, type State, type StateDictionary, type Visibility, WithFactory, type WithLabels, type WithOptionalLabels, asAttachableModuleInstance, asModule, asModuleInstance, asModuleObject, assignCreatableModuleRegistry, creatableModule, creatableModuleFactory, duplicateModules, hasAllLabels, hasLabels, includesReservedModuleIdentifierCharacter, isAddressModuleFilter, isAddressObjectFilter, isAttachableModuleInstance, isModule, isModuleIdentifierPart, isModuleInstance, isModuleName, isModuleObject, isModuleResolver, isModuleState, isModuleStateWithMeta, isNameModuleFilter, isNameObjectFilter, isObjectResolver, isQueryModuleFilter, isQueryObjectFilter, labeledCreatableModuleFactory, registerCreatableModuleFactories, registerCreatableModuleFactory, requiredAttachableModuleInstanceFunctions, requiredModuleInstanceFunctions, requiredModuleQueries, requiredModuleShape, resolveAddressToInstance, resolveAddressToInstanceAll, resolveAddressToInstanceDown, resolveAddressToInstanceSiblings, resolveAddressToInstanceUp, resolveAll, resolveAllDown, resolveAllUp, resolveLocalNameToAddress, resolveLocalNameToAddressAll, resolveLocalNameToAddressDown, resolveLocalNameToAddressUp, resolveLocalNameToInstance, resolveLocalNameToInstanceAll, resolveLocalNameToInstanceDown, resolveLocalNameToInstanceUp, resolvePathToAddress, resolvePathToInstance, serializable, serializableField, transformModuleIdentifier, withModule, withModuleInstance };
export * from './cache.ts';
export * from './Config/index.ts';
export * from './CreatableModule/index.ts';
export * from './DetailsError.ts';
export * from './EventsModels/index.ts';
export * from './instance/index.ts';
export * from './Labels/index.ts';
export * from './lib/index.ts';
export * from './module/index.ts';
export * from './ModuleDescription.ts';
export * from './ModuleIdentifier.ts';
export * from './ModuleIdentifierTransformer.ts';
export * from './ModuleParams.ts';
export * from './ModuleQueryHandlerResult.ts';
export * from './ModuleQueryResult.ts';
export * from './Payload/index.ts';
export * from './Queries/index.ts';
export * from './ResolveHelper/index.ts';
export * from './withModule.ts';
//# sourceMappingURL=index.d.ts.map
{
"name": "@xyo-network/module-model",
"version": "3.0.7",
"version": "3.0.8",
"description": "Primary SDK for using XYO Protocol 2.0",

@@ -32,19 +32,19 @@ "homepage": "https://xyo.network",

"dependencies": {
"@xylabs/assert": "^4.0.2",
"@xylabs/exists": "^4.0.2",
"@xylabs/hex": "^4.0.2",
"@xylabs/lodash": "^4.0.2",
"@xylabs/logger": "^4.0.2",
"@xylabs/object": "^4.0.2",
"@xylabs/promise": "^4.0.2",
"@xylabs/retry": "^4.0.2",
"@xyo-network/account-model": "^3.0.7",
"@xyo-network/boundwitness-model": "^3.0.7",
"@xyo-network/manifest-model": "^3.0.7",
"@xyo-network/module-events": "^3.0.7",
"@xyo-network/payload-model": "^3.0.7"
"@xylabs/assert": "^4.0.3",
"@xylabs/exists": "^4.0.3",
"@xylabs/hex": "^4.0.3",
"@xylabs/lodash": "^4.0.3",
"@xylabs/logger": "^4.0.3",
"@xylabs/object": "^4.0.3",
"@xylabs/promise": "^4.0.3",
"@xylabs/retry": "^4.0.3",
"@xyo-network/account-model": "^3.0.8",
"@xyo-network/boundwitness-model": "^3.0.8",
"@xyo-network/manifest-model": "^3.0.8",
"@xyo-network/module-events": "^3.0.8",
"@xyo-network/payload-model": "^3.0.8"
},
"devDependencies": {
"@xylabs/ts-scripts-yarn3": "^4.0.0",
"@xylabs/tsconfig": "^4.0.0",
"@xylabs/ts-scripts-yarn3": "^4.0.7",
"@xylabs/tsconfig": "^4.0.7",
"typescript": "^5.5.4"

@@ -51,0 +51,0 @@ },

@@ -36,3 +36,4 @@ import type { LogLevel } from '@xylabs/logger'

/** @field The query schemas and allowed/disallowed addresses which are allowed to issue them against the module. If both allowed and disallowed is specified, then disallowed takes priority. */
/** @field The query schemas and allowed/disallowed addresses which are allowed to issue them against the module.
* If both allowed and disallowed is specified, then disallowed takes priority. */
readonly security?: ModuleSecurityConfig

@@ -39,0 +40,0 @@

@@ -64,5 +64,8 @@ import { assertEx } from '@xylabs/assert'

const schema = factory.creatableModule.defaultConfigSchema
const mergedParams: TModule['params'] = merge({}, factory.defaultParams, params, {
config: merge({}, factory.defaultParams?.config, params?.config, { schema }),
})
const mergedParams: TModule['params'] = merge(
{},
factory.defaultParams,
params,
{ config: merge({}, factory.defaultParams?.config, params?.config, { schema }) },
)
return factory.creatableModule.create<T>(mergedParams)

@@ -69,0 +72,0 @@ }

@@ -8,3 +8,4 @@ import type { ModuleInstance } from './Instance.ts'

ObjectFilterOptions,
QueryObjectFilter } from './ObjectFilter.ts'
QueryObjectFilter,
} from './ObjectFilter.ts'
import {

@@ -11,0 +12,0 @@ isAddressObjectFilter,

import type { Address } from '@xylabs/hex'
import type { AnyObject, EmptyObject, TypeCheck } from '@xylabs/object'
import type {
AnyObject, EmptyObject, TypeCheck,
} from '@xylabs/object'

@@ -4,0 +6,0 @@ import type { ModuleName } from '../ModuleIdentifier.ts'

export const ModuleLimitationLabelName = 'network.xyo.module.limitation'
export type ModuleLimitationLabelName = typeof ModuleLimitationLabelName
export const ModuleLimitationViewLabel = {
ModuleLimitationLabelName: 'view',
}
export const ModuleLimitationViewLabel = { ModuleLimitationLabelName: 'view' }
// Inspired by https://stackoverflow.com/a/49079549/2803259
import { every, isArray, isBoolean, isNull, isNumber, isPlainObject, isString, isUndefined, overSome } from '@xylabs/lodash'
import {
every, isArray, isBoolean, isNull, isNumber, isPlainObject, isString, isUndefined, overSome,
} from '@xylabs/lodash'

@@ -5,0 +7,0 @@ const JSONPrimitiveChecks = [isUndefined, isNull, isBoolean, isNumber, isString]

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

import type { AnyObject, EmptyObject, TypeCheck } from '@xylabs/object'
import type {
AnyObject, EmptyObject, TypeCheck,
} from '@xylabs/object'
import type { AnyNonPromise } from '@xylabs/promise'

@@ -3,0 +5,0 @@

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

import type { BaseParams, EmptyObject, WithAdditional } from '@xylabs/object'
import type {
BaseParams, EmptyObject, WithAdditional,
} from '@xylabs/object'
import type { AccountInstance } from '@xyo-network/account-model'

@@ -3,0 +5,0 @@

import type { BoundWitness } from '@xyo-network/boundwitness-model'
import type { ModuleError, Payload, WithMeta } from '@xyo-network/payload-model'
import type {
ModuleError, Payload, WithMeta,
} from '@xyo-network/payload-model'

@@ -4,0 +6,0 @@ export type ModuleQueryResult<P extends Payload = Payload, E extends ModuleError = ModuleError, B extends BoundWitness = BoundWitness> = [

@@ -11,3 +11,5 @@ /* eslint-disable max-statements */

import type { ModuleFilter, ModuleFilterOptions, ModuleInstance, ModuleResolver } from '../instance/index.ts'
import type {
ModuleFilter, ModuleFilterOptions, ModuleInstance, ModuleResolver,
} from '../instance/index.ts'
import { asModuleInstance } from '../instance/index.ts'

@@ -92,11 +94,19 @@ import { duplicateModules } from '../lib/index.ts'

idOrFilter: ModuleFilter<T> | ModuleIdentifier = '*',
{ maxDepth = 3, required = 'log', ...options }: ModuleFilterOptions<T> = {},
{
maxDepth = 3, required = 'log', ...options
}: ModuleFilterOptions<T> = {},
): Promise<T | T[] | undefined> {
const { transformers, mod, logger = this.defaultLogger, dead = false, upResolver, downResolver, privateResolver } = config
const {
transformers, mod, logger = this.defaultLogger, dead = false, upResolver, downResolver, privateResolver,
} = config
const log = logger ? new IdLogger(logger, () => `ResolveHelper [${mod.id}][${idOrFilter}]`) : undefined
const downLocalOptions: ModuleFilterOptions<T> = { ...options, direction: 'down', maxDepth, required: false }
const downLocalOptions: ModuleFilterOptions<T> = {
...options, direction: 'down', maxDepth, required: false,
}
const upLocalOptions: ModuleFilterOptions<T> = { ...downLocalOptions, direction: 'up' }
const childOptions: ModuleFilterOptions<T> = { ...options, maxDepth: maxDepth - 1, required: false }
const childOptions: ModuleFilterOptions<T> = {
...options, maxDepth: maxDepth - 1, required: false,
}

@@ -103,0 +113,0 @@ const direction = options?.direction ?? 'all'

@@ -5,5 +5,3 @@ import type { XyTsupConfig } from '@xylabs/ts-scripts-yarn3'

browser: {},
neutral: {
src: true,
},
neutral: { src: true },
node: {},

@@ -10,0 +8,0 @@ },

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