@xyo-network/module-model 3.0.2 → 3.0.3
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/index.mjs.map +1 -1
- package/package.json +18 -18
- package/src/Config/Archiving.ts +2 -2
- package/src/Config/Config.ts +4 -4
- package/src/Config/Fields.ts +6 -6
- package/src/Config/Security.ts +2 -2
- package/src/CreatableModule/CreatableModule.ts +5 -5
- package/src/CreatableModule/CreatableModuleRegistry.ts +5 -5
- package/src/CreatableModule/LabeledCreatableModuleFactory.ts +3 -3
- package/src/CreatableModule/ModuleFactory.ts +5 -5
- package/src/DetailsError.ts +1 -1
- package/src/EventsModels/ModuleBusy.ts +2 -2
- package/src/EventsModels/ModuleError.ts +2 -2
- package/src/EventsModels/ModuleEventArgs.ts +1 -1
- package/src/EventsModels/ModuleEventData.ts +3 -3
- package/src/EventsModels/ModuleQueried.ts +5 -5
- package/src/ModuleDescription.ts +2 -2
- package/src/ModuleIdentifier.ts +2 -1
- package/src/ModuleIdentifierTransformer.ts +2 -2
- package/src/ModuleParams.ts +4 -4
- package/src/ModuleQueryHandlerResult.ts +1 -1
- package/src/ModuleQueryResult.ts +2 -2
- package/src/Payload/Address.ts +2 -2
- package/src/Payload/AddressPreviousHash.ts +2 -2
- package/src/Payload/Description.ts +2 -2
- package/src/Payload/ModuleState.ts +2 -1
- package/src/Queries/Manifest.ts +1 -1
- package/src/Queries/ModuleAddress/Query.ts +1 -1
- package/src/Queries/State.ts +1 -1
- package/src/Queries/Subscribe.ts +2 -2
- package/src/Queries/index.ts +4 -4
- package/src/ResolveHelper/ResolveHelper.ts +8 -5
- package/src/ResolveHelper/ResolveHelperStatic.ts +2 -2
- package/src/ResolveHelper/resolveAddressToInstance.ts +3 -3
- package/src/ResolveHelper/resolveAll.ts +2 -2
- package/src/ResolveHelper/resolveLocalNameToAddress.ts +4 -4
- package/src/ResolveHelper/resolveLocalNameToInstance.ts +3 -3
- package/src/ResolveHelper/resolvePathToAddress.ts +3 -3
- package/src/ResolveHelper/resolvePathToInstance.ts +2 -2
- package/src/ResolveHelper/traceModuleIdentifier.ts +4 -3
- package/src/ResolveHelper/transformModuleIdentifier.ts +2 -2
- package/src/instance/Instance.ts +12 -11
- package/src/instance/ModuleFilter.ts +7 -6
- package/src/instance/ModuleRepository.ts +3 -3
- package/src/instance/ModuleResolver.ts +7 -6
- package/src/instance/ObjectFilter.ts +3 -3
- package/src/instance/ObjectResolver.ts +4 -4
- package/src/instance/attachable/AttachableInstance.ts +6 -5
- package/src/instance/attachable/isAttachableInstance.ts +3 -2
- package/src/instance/isModuleInstance.ts +3 -2
- package/src/lib/duplicateModules.ts +1 -1
- package/src/module/IsModuleFactory.ts +3 -3
- package/src/module/Module.ts +4 -4
- package/src/module/ModuleFields.ts +9 -9
- package/src/module/ModuleQueryFunctions.ts +7 -7
- package/src/module/isModule.ts +3 -3
- package/src/module/isModuleObject.ts +3 -2
- package/src/withModule.ts +1 -1
- package/xy.config.ts +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { assertEx } from '@xylabs/assert'
|
|
2
2
|
import { merge } from '@xylabs/lodash'
|
|
3
|
-
import { Logger } from '@xylabs/logger'
|
|
4
|
-
import { Schema } from '@xyo-network/payload-model'
|
|
3
|
+
import type { Logger } from '@xylabs/logger'
|
|
4
|
+
import type { Schema } from '@xyo-network/payload-model'
|
|
5
5
|
|
|
6
|
-
import { AttachableModuleInstance } from '../instance/index.ts'
|
|
7
|
-
import { Labels, WithOptionalLabels } from '../Labels/index.ts'
|
|
8
|
-
import { CreatableModule, CreatableModuleFactory } from './CreatableModule.ts'
|
|
6
|
+
import type { AttachableModuleInstance } from '../instance/index.ts'
|
|
7
|
+
import type { Labels, WithOptionalLabels } from '../Labels/index.ts'
|
|
8
|
+
import type { CreatableModule, CreatableModuleFactory } from './CreatableModule.ts'
|
|
9
9
|
|
|
10
10
|
export class ModuleFactory<TModule extends AttachableModuleInstance> implements CreatableModuleFactory<TModule> {
|
|
11
11
|
configSchemas: CreatableModuleFactory<TModule>['configSchemas']
|
package/src/DetailsError.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { EventData } from '@xyo-network/module-events'
|
|
1
|
+
import type { EventData } from '@xyo-network/module-events'
|
|
2
2
|
|
|
3
|
-
import { ModuleEventArgs } from './ModuleEventArgs.ts'
|
|
3
|
+
import type { ModuleEventArgs } from './ModuleEventArgs.ts'
|
|
4
4
|
|
|
5
5
|
export type ModuleBusyEventArgs<TModule extends object = object> = ModuleEventArgs<
|
|
6
6
|
TModule,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { EventData } from '@xyo-network/module-events'
|
|
1
|
+
import type { EventData } from '@xyo-network/module-events'
|
|
2
2
|
|
|
3
|
-
import { ModuleEventArgs } from './ModuleEventArgs.ts'
|
|
3
|
+
import type { ModuleEventArgs } from './ModuleEventArgs.ts'
|
|
4
4
|
|
|
5
5
|
export type ModuleErrorEventArgs<TModule extends object = object> = ModuleEventArgs<
|
|
6
6
|
TModule,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ModuleBusyEventData } from './ModuleBusy.ts'
|
|
2
|
-
import { ModuleErrorEventData } from './ModuleError.ts'
|
|
3
|
-
import { ModuleQueriedEventData } from './ModuleQueried.ts'
|
|
1
|
+
import type { ModuleBusyEventData } from './ModuleBusy.ts'
|
|
2
|
+
import type { ModuleErrorEventData } from './ModuleError.ts'
|
|
3
|
+
import type { ModuleQueriedEventData } from './ModuleQueried.ts'
|
|
4
4
|
|
|
5
5
|
export interface ModuleEventData<TModule extends object = object>
|
|
6
6
|
extends ModuleQueriedEventData<TModule>,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { QueryBoundWitness } from '@xyo-network/boundwitness-model'
|
|
2
|
-
import { EventData } from '@xyo-network/module-events'
|
|
3
|
-
import { Payload } from '@xyo-network/payload-model'
|
|
1
|
+
import type { QueryBoundWitness } from '@xyo-network/boundwitness-model'
|
|
2
|
+
import type { EventData } from '@xyo-network/module-events'
|
|
3
|
+
import type { Payload } from '@xyo-network/payload-model'
|
|
4
4
|
|
|
5
|
-
import { ModuleQueryResult } from '../ModuleQueryResult.ts'
|
|
6
|
-
import { ModuleEventArgs } from './ModuleEventArgs.ts'
|
|
5
|
+
import type { ModuleQueryResult } from '../ModuleQueryResult.ts'
|
|
6
|
+
import type { ModuleEventArgs } from './ModuleEventArgs.ts'
|
|
7
7
|
|
|
8
8
|
export type ModuleQueriedEventArgs<TModule extends object = object> = ModuleEventArgs<
|
|
9
9
|
TModule,
|
package/src/ModuleDescription.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Address } from '@xylabs/hex'
|
|
1
|
+
import type { Address } from '@xylabs/hex'
|
|
2
2
|
|
|
3
|
-
import { ModuleName } from './ModuleIdentifier.ts'
|
|
3
|
+
import type { ModuleName } from './ModuleIdentifier.ts'
|
|
4
4
|
export interface ModuleDescription {
|
|
5
5
|
address: Address
|
|
6
6
|
children?: string[]
|
package/src/ModuleIdentifier.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Promisable } from '@xylabs/promise'
|
|
1
|
+
import type { Promisable } from '@xylabs/promise'
|
|
2
2
|
|
|
3
|
-
import { ModuleIdentifier } from './ModuleIdentifier.ts'
|
|
3
|
+
import type { ModuleIdentifier } from './ModuleIdentifier.ts'
|
|
4
4
|
|
|
5
5
|
export type ModuleIdentifierTransformerFunc = (id: ModuleIdentifier) => Promisable<ModuleIdentifier | undefined>
|
|
6
6
|
|
package/src/ModuleParams.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { BaseParams, EmptyObject, WithAdditional } from '@xylabs/object'
|
|
2
|
-
import { AccountInstance } from '@xyo-network/account-model'
|
|
1
|
+
import type { BaseParams, EmptyObject, WithAdditional } from '@xylabs/object'
|
|
2
|
+
import type { AccountInstance } from '@xyo-network/account-model'
|
|
3
3
|
|
|
4
|
-
import { AnyConfigSchema, ModuleConfig } from './Config/index.ts'
|
|
5
|
-
import { ModuleIdentifierTransformer } from './ModuleIdentifierTransformer.ts'
|
|
4
|
+
import type { AnyConfigSchema, ModuleConfig } from './Config/index.ts'
|
|
5
|
+
import type { ModuleIdentifierTransformer } from './ModuleIdentifierTransformer.ts'
|
|
6
6
|
|
|
7
7
|
export type ModuleParams<
|
|
8
8
|
TConfig extends AnyConfigSchema<ModuleConfig> | void = void,
|
package/src/ModuleQueryResult.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BoundWitness } from '@xyo-network/boundwitness-model'
|
|
2
|
-
import { ModuleError, Payload, WithMeta } from '@xyo-network/payload-model'
|
|
1
|
+
import type { BoundWitness } from '@xyo-network/boundwitness-model'
|
|
2
|
+
import type { ModuleError, Payload, WithMeta } from '@xyo-network/payload-model'
|
|
3
3
|
|
|
4
4
|
export type ModuleQueryResult<P extends Payload = Payload, E extends ModuleError = ModuleError, B extends BoundWitness = BoundWitness> = [
|
|
5
5
|
WithMeta<B>,
|
package/src/Payload/Address.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Address } from '@xylabs/hex'
|
|
2
|
-
import { Payload } from '@xyo-network/payload-model'
|
|
1
|
+
import type { Address } from '@xylabs/hex'
|
|
2
|
+
import type { Payload } from '@xyo-network/payload-model'
|
|
3
3
|
|
|
4
4
|
export const AddressSchema = 'network.xyo.address' as const
|
|
5
5
|
export type AddressSchema = typeof AddressSchema
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Address } from '@xylabs/hex'
|
|
2
|
-
import { Payload } from '@xyo-network/payload-model'
|
|
1
|
+
import type { Address } from '@xylabs/hex'
|
|
2
|
+
import type { Payload } from '@xyo-network/payload-model'
|
|
3
3
|
|
|
4
4
|
export const AddressPreviousHashSchema = 'network.xyo.address.hash.previous' as const
|
|
5
5
|
export type AddressPreviousHashSchema = typeof AddressPreviousHashSchema
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Payload } from '@xyo-network/payload-model'
|
|
1
|
+
import type { Payload } from '@xyo-network/payload-model'
|
|
2
2
|
|
|
3
|
-
import { ModuleDescription } from '../ModuleDescription.ts'
|
|
3
|
+
import type { ModuleDescription } from '../ModuleDescription.ts'
|
|
4
4
|
|
|
5
5
|
export const ModuleDescriptionSchema = 'network.xyo.module.description' as const
|
|
6
6
|
export type ModuleDescriptionSchema = typeof ModuleDescriptionSchema
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Payload, WithMeta } from '@xyo-network/payload-model'
|
|
2
|
+
import { isPayloadOfSchemaType } from '@xyo-network/payload-model'
|
|
2
3
|
|
|
3
4
|
export interface StateDictionary {
|
|
4
5
|
[key: string]: string | number | undefined
|
package/src/Queries/Manifest.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Query } from '@xyo-network/payload-model'
|
|
1
|
+
import type { Query } from '@xyo-network/payload-model'
|
|
2
2
|
|
|
3
3
|
export type ModuleManifestQuerySchema = 'network.xyo.query.module.manifest'
|
|
4
4
|
export const ModuleManifestQuerySchema: ModuleManifestQuerySchema = 'network.xyo.query.module.manifest'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Query } from '@xyo-network/payload-model'
|
|
1
|
+
import type { Query } from '@xyo-network/payload-model'
|
|
2
2
|
|
|
3
3
|
export type ModuleAddressQuerySchema = 'network.xyo.query.module.address'
|
|
4
4
|
export const ModuleAddressQuerySchema: ModuleAddressQuerySchema = 'network.xyo.query.module.address'
|
package/src/Queries/State.ts
CHANGED
package/src/Queries/Subscribe.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Address } from '@xylabs/hex'
|
|
2
|
-
import { Query } from '@xyo-network/payload-model'
|
|
1
|
+
import type { Address } from '@xylabs/hex'
|
|
2
|
+
import type { Query } from '@xyo-network/payload-model'
|
|
3
3
|
|
|
4
4
|
export type ModuleSubscribeQuerySchema = 'network.xyo.query.module.subscribe'
|
|
5
5
|
export const ModuleSubscribeQuerySchema: ModuleSubscribeQuerySchema = 'network.xyo.query.module.subscribe'
|
package/src/Queries/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ModuleManifestQuery } from './Manifest.ts'
|
|
2
|
-
import { ModuleAddressQuery } from './ModuleAddress/index.ts'
|
|
3
|
-
import { ModuleStateQuery } from './State.ts'
|
|
4
|
-
import { ModuleSubscribeQuery } from './Subscribe.ts'
|
|
1
|
+
import type { ModuleManifestQuery } from './Manifest.ts'
|
|
2
|
+
import type { ModuleAddressQuery } from './ModuleAddress/index.ts'
|
|
3
|
+
import type { ModuleStateQuery } from './State.ts'
|
|
4
|
+
import type { ModuleSubscribeQuery } from './Subscribe.ts'
|
|
5
5
|
|
|
6
6
|
export * from './Manifest.ts'
|
|
7
7
|
export * from './ModuleAddress/index.ts'
|
|
@@ -2,14 +2,17 @@
|
|
|
2
2
|
/* eslint-disable complexity */
|
|
3
3
|
import { assertEx } from '@xylabs/assert'
|
|
4
4
|
import { exists } from '@xylabs/exists'
|
|
5
|
-
import { Address
|
|
6
|
-
import {
|
|
5
|
+
import type { Address } from '@xylabs/hex'
|
|
6
|
+
import { isAddress } from '@xylabs/hex'
|
|
7
|
+
import type { Logger } from '@xylabs/logger'
|
|
8
|
+
import { IdLogger } from '@xylabs/logger'
|
|
7
9
|
import { toJsonString } from '@xylabs/object'
|
|
8
10
|
|
|
9
|
-
import {
|
|
11
|
+
import type { ModuleFilter, ModuleFilterOptions, ModuleInstance, ModuleResolver } from '../instance/index.ts'
|
|
12
|
+
import { asModuleInstance } from '../instance/index.ts'
|
|
10
13
|
import { duplicateModules } from '../lib/index.ts'
|
|
11
|
-
import { ModuleIdentifier } from '../ModuleIdentifier.ts'
|
|
12
|
-
import { ModuleIdentifierTransformer } from '../ModuleIdentifierTransformer.ts'
|
|
14
|
+
import type { ModuleIdentifier } from '../ModuleIdentifier.ts'
|
|
15
|
+
import type { ModuleIdentifierTransformer } from '../ModuleIdentifierTransformer.ts'
|
|
13
16
|
import { ResolveHelperStatic } from './ResolveHelperStatic.ts'
|
|
14
17
|
import { resolvePathToAddress } from './resolvePathToAddress.ts'
|
|
15
18
|
import { traceModuleIdentifier } from './traceModuleIdentifier.ts'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Logger } from '@xylabs/logger'
|
|
1
|
+
import type { Logger } from '@xylabs/logger'
|
|
2
2
|
|
|
3
|
-
import { ModuleIdentifierTransformer } from '../ModuleIdentifierTransformer.ts'
|
|
3
|
+
import type { ModuleIdentifierTransformer } from '../ModuleIdentifierTransformer.ts'
|
|
4
4
|
|
|
5
5
|
// eslint-disable-next-line unicorn/no-static-only-class
|
|
6
6
|
export class ResolveHelperStatic {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Address } from '@xylabs/hex'
|
|
1
|
+
import type { Address } from '@xylabs/hex'
|
|
2
2
|
|
|
3
|
-
import { ModuleInstance } from '../instance/index.ts'
|
|
4
|
-
import { ModuleResolveDirection } from './model.ts'
|
|
3
|
+
import type { ModuleInstance } from '../instance/index.ts'
|
|
4
|
+
import type { ModuleResolveDirection } from './model.ts'
|
|
5
5
|
|
|
6
6
|
export const resolveAddressToInstanceDown = async (
|
|
7
7
|
root: ModuleInstance,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Address } from '@xylabs/hex'
|
|
1
|
+
import type { Address } from '@xylabs/hex'
|
|
2
2
|
|
|
3
|
-
import { ModuleInstance } from '../instance/index.ts'
|
|
3
|
+
import type { ModuleInstance } from '../instance/index.ts'
|
|
4
4
|
import { duplicateModules } from '../lib/index.ts'
|
|
5
5
|
|
|
6
6
|
export const resolveAllUp = async (root: ModuleInstance, maxDepth = 10, exclude: Address[] = []): Promise<ModuleInstance[]> => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Address } from '@xylabs/hex'
|
|
1
|
+
import type { Address } from '@xylabs/hex'
|
|
2
2
|
|
|
3
|
-
import { ModuleInstance } from '../instance/index.ts'
|
|
4
|
-
import { ModuleName } from '../ModuleIdentifier.ts'
|
|
5
|
-
import { ModuleResolveDirection } from './model.ts'
|
|
3
|
+
import type { ModuleInstance } from '../instance/index.ts'
|
|
4
|
+
import type { ModuleName } from '../ModuleIdentifier.ts'
|
|
5
|
+
import type { ModuleResolveDirection } from './model.ts'
|
|
6
6
|
import {
|
|
7
7
|
resolveLocalNameToInstance,
|
|
8
8
|
resolveLocalNameToInstanceAll,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ModuleInstance } from '../instance/index.ts'
|
|
2
|
-
import { ModuleName } from '../ModuleIdentifier.ts'
|
|
3
|
-
import { ModuleResolveDirection } from './model.ts'
|
|
1
|
+
import type { ModuleInstance } from '../instance/index.ts'
|
|
2
|
+
import type { ModuleName } from '../ModuleIdentifier.ts'
|
|
3
|
+
import type { ModuleResolveDirection } from './model.ts'
|
|
4
4
|
|
|
5
5
|
export const resolveLocalNameToInstanceUp = async (root: ModuleInstance, modName: ModuleName): Promise<ModuleInstance | undefined> => {
|
|
6
6
|
const parents = (await root.parents?.()) ?? []
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Address } from '@xylabs/hex'
|
|
1
|
+
import type { Address } from '@xylabs/hex'
|
|
2
2
|
|
|
3
|
-
import { ModuleInstance } from '../instance/index.ts'
|
|
4
|
-
import { ModuleIdentifierTransformer } from '../ModuleIdentifierTransformer.ts'
|
|
3
|
+
import type { ModuleInstance } from '../instance/index.ts'
|
|
4
|
+
import type { ModuleIdentifierTransformer } from '../ModuleIdentifierTransformer.ts'
|
|
5
5
|
import { ResolveHelperStatic } from './ResolveHelperStatic.ts'
|
|
6
6
|
import { resolvePathToInstance } from './resolvePathToInstance.ts'
|
|
7
7
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { assertEx } from '@xylabs/assert'
|
|
2
2
|
import { asAddress } from '@xylabs/hex'
|
|
3
3
|
|
|
4
|
-
import { ModuleInstance } from '../instance/index.ts'
|
|
4
|
+
import type { ModuleInstance } from '../instance/index.ts'
|
|
5
5
|
import { MODULE_PATH_SEPARATOR } from '../ModuleIdentifier.ts'
|
|
6
|
-
import { ModuleIdentifierTransformer } from '../ModuleIdentifierTransformer.ts'
|
|
6
|
+
import type { ModuleIdentifierTransformer } from '../ModuleIdentifierTransformer.ts'
|
|
7
7
|
import { resolveAddressToInstance } from './resolveAddressToInstance.ts'
|
|
8
8
|
import { ResolveHelperStatic } from './ResolveHelperStatic.ts'
|
|
9
9
|
import { resolveLocalNameToAddress } from './resolveLocalNameToAddress.ts'
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { assertEx } from '@xylabs/assert'
|
|
2
|
-
import { Address } from '@xylabs/hex'
|
|
2
|
+
import type { Address } from '@xylabs/hex'
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import type { ModuleResolver } from '../instance/index.ts'
|
|
5
|
+
import { asModuleInstance } from '../instance/index.ts'
|
|
6
|
+
import type { ModuleIdentifier } from '../ModuleIdentifier.ts'
|
|
6
7
|
|
|
7
8
|
export const traceModuleIdentifier = async (resolver: ModuleResolver, path: ModuleIdentifier): Promise<Address[]> => {
|
|
8
9
|
const parts = path.split(':')
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ModuleIdentifier } from '../ModuleIdentifier.ts'
|
|
2
|
-
import { ModuleIdentifierTransformer } from '../ModuleIdentifierTransformer.ts'
|
|
1
|
+
import type { ModuleIdentifier } from '../ModuleIdentifier.ts'
|
|
2
|
+
import type { ModuleIdentifierTransformer } from '../ModuleIdentifierTransformer.ts'
|
|
3
3
|
|
|
4
4
|
export const transformModuleIdentifier = async (
|
|
5
5
|
id: ModuleIdentifier,
|
package/src/instance/Instance.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { Address } from '@xylabs/hex'
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
1
|
+
import type { Address } from '@xylabs/hex'
|
|
2
|
+
import type { TypeCheck } from '@xylabs/object'
|
|
3
|
+
import { IsObjectFactory, toJsonString } from '@xylabs/object'
|
|
4
|
+
import type { Promisable } from '@xylabs/promise'
|
|
5
|
+
import type { AccountInstance } from '@xyo-network/account-model'
|
|
6
|
+
|
|
7
|
+
import type { ModuleEventData } from '../EventsModels/index.ts'
|
|
8
|
+
import type { Module, ModuleQueryFunctions } from '../module/index.ts'
|
|
9
|
+
import type { ModuleIdentifier, ModuleName } from '../ModuleIdentifier.ts'
|
|
10
|
+
import type { ModuleParams } from '../ModuleParams.ts'
|
|
11
|
+
import type { Direction } from './ObjectFilter.ts'
|
|
12
|
+
import type { ObjectResolver } from './ObjectResolver.ts'
|
|
12
13
|
|
|
13
14
|
export type ModulePipeLine = Lowercase<'one-to-one' | 'one-to-many' | 'many-to-one' | 'many-to-many'>
|
|
14
15
|
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { ModuleInstance } from './Instance.ts'
|
|
2
|
-
import {
|
|
1
|
+
import type { ModuleInstance } from './Instance.ts'
|
|
2
|
+
import type {
|
|
3
3
|
AddressObjectFilter,
|
|
4
4
|
AnyObjectFilter,
|
|
5
|
-
isAddressObjectFilter,
|
|
6
|
-
isNameObjectFilter,
|
|
7
|
-
isQueryObjectFilter,
|
|
8
5
|
NameObjectFilter,
|
|
9
6
|
ObjectFilter,
|
|
10
7
|
ObjectFilterOptions,
|
|
11
|
-
QueryObjectFilter
|
|
8
|
+
QueryObjectFilter } from './ObjectFilter.ts'
|
|
9
|
+
import {
|
|
10
|
+
isAddressObjectFilter,
|
|
11
|
+
isNameObjectFilter,
|
|
12
|
+
isQueryObjectFilter,
|
|
12
13
|
} from './ObjectFilter.ts'
|
|
13
14
|
|
|
14
15
|
export interface ModuleFilterOptions<T extends ModuleInstance = ModuleInstance> extends ObjectFilterOptions<T> {}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Address } from '@xylabs/hex'
|
|
1
|
+
import type { Address } from '@xylabs/hex'
|
|
2
2
|
|
|
3
|
-
import { ModuleInstance } from './Instance.ts'
|
|
4
|
-
import { ModuleResolverInstance } from './ModuleResolver.ts'
|
|
3
|
+
import type { ModuleInstance } from './Instance.ts'
|
|
4
|
+
import type { ModuleResolverInstance } from './ModuleResolver.ts'
|
|
5
5
|
|
|
6
6
|
export interface ModuleRepository<T extends ModuleInstance = ModuleInstance> extends ModuleResolverInstance<T> {
|
|
7
7
|
add(mod: T): this
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { Address } from '@xylabs/hex'
|
|
2
|
-
import { Promisable } from '@xylabs/promise'
|
|
1
|
+
import type { Address } from '@xylabs/hex'
|
|
2
|
+
import type { Promisable } from '@xylabs/promise'
|
|
3
3
|
|
|
4
|
-
import { ModuleIdentifier } from '../ModuleIdentifier.ts'
|
|
5
|
-
import { ModuleInstance } from './Instance.ts'
|
|
6
|
-
import { ObjectFilterOptions } from './ObjectFilter.ts'
|
|
7
|
-
import {
|
|
4
|
+
import type { ModuleIdentifier } from '../ModuleIdentifier.ts'
|
|
5
|
+
import type { ModuleInstance } from './Instance.ts'
|
|
6
|
+
import type { ObjectFilterOptions } from './ObjectFilter.ts'
|
|
7
|
+
import type { ObjectResolver } from './ObjectResolver.ts'
|
|
8
|
+
import { isObjectResolver } from './ObjectResolver.ts'
|
|
8
9
|
|
|
9
10
|
export const isModuleResolver = isObjectResolver<ModuleInstance>
|
|
10
11
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Address } from '@xylabs/hex'
|
|
2
|
-
import { AnyObject, EmptyObject, TypeCheck } from '@xylabs/object'
|
|
1
|
+
import type { Address } from '@xylabs/hex'
|
|
2
|
+
import type { AnyObject, EmptyObject, TypeCheck } from '@xylabs/object'
|
|
3
3
|
|
|
4
|
-
import { ModuleName } from '../ModuleIdentifier.ts'
|
|
4
|
+
import type { ModuleName } from '../ModuleIdentifier.ts'
|
|
5
5
|
|
|
6
6
|
export type Direction = 'up' | 'down' | 'all'
|
|
7
7
|
export type Visibility = 'public' | 'private' | 'all'
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AnyObject, EmptyObject } from '@xylabs/object'
|
|
2
|
-
import { Promisable } from '@xylabs/promise'
|
|
1
|
+
import type { AnyObject, EmptyObject } from '@xylabs/object'
|
|
2
|
+
import type { Promisable } from '@xylabs/promise'
|
|
3
3
|
|
|
4
|
-
import { ModuleIdentifier } from '../ModuleIdentifier.ts'
|
|
5
|
-
import { ObjectFilter, ObjectFilterOptions } from './ObjectFilter.ts'
|
|
4
|
+
import type { ModuleIdentifier } from '../ModuleIdentifier.ts'
|
|
5
|
+
import type { ObjectFilter, ObjectFilterOptions } from './ObjectFilter.ts'
|
|
6
6
|
|
|
7
7
|
export const isObjectResolver = <T extends EmptyObject = AnyObject>(value?: unknown): value is ObjectResolver<T> => {
|
|
8
8
|
return typeof (value as Partial<ObjectResolver<T>>).resolve === 'function'
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { TypeCheck } from '@xylabs/object'
|
|
2
|
+
import { IsObjectFactory } from '@xylabs/object'
|
|
2
3
|
|
|
3
|
-
import { ModuleEventData } from '../../EventsModels/index.ts'
|
|
4
|
-
import { ModuleParams } from '../../ModuleParams.ts'
|
|
5
|
-
import { ModuleInstance } from '../Instance.ts'
|
|
6
|
-
import { ModuleResolverInstance } from '../ModuleResolver.ts'
|
|
4
|
+
import type { ModuleEventData } from '../../EventsModels/index.ts'
|
|
5
|
+
import type { ModuleParams } from '../../ModuleParams.ts'
|
|
6
|
+
import type { ModuleInstance } from '../Instance.ts'
|
|
7
|
+
import type { ModuleResolverInstance } from '../ModuleResolver.ts'
|
|
7
8
|
|
|
8
9
|
export interface AttachableModuleInstance<TParams extends ModuleParams = ModuleParams, TEventData extends ModuleEventData = ModuleEventData>
|
|
9
10
|
extends ModuleInstance<TParams, TEventData> {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ObjectTypeShape, TypeCheck } from '@xylabs/object'
|
|
2
|
+
import { IsObjectFactory } from '@xylabs/object'
|
|
2
3
|
|
|
3
4
|
import { isModuleInstance } from '../isModuleInstance.ts'
|
|
4
|
-
import { AttachableModuleInstance } from './AttachableInstance.ts'
|
|
5
|
+
import type { AttachableModuleInstance } from './AttachableInstance.ts'
|
|
5
6
|
|
|
6
7
|
export const requiredAttachableModuleInstanceFunctions: ObjectTypeShape = {
|
|
7
8
|
downResolver: 'object',
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ObjectTypeShape, TypeCheck } from '@xylabs/object'
|
|
2
|
+
import { IsObjectFactory } from '@xylabs/object'
|
|
2
3
|
|
|
3
4
|
import { isModule } from '../module/index.ts'
|
|
4
|
-
import { ModuleInstance } from './Instance.ts'
|
|
5
|
+
import type { ModuleInstance } from './Instance.ts'
|
|
5
6
|
|
|
6
7
|
export const requiredModuleInstanceFunctions: ObjectTypeShape = {
|
|
7
8
|
manifest: 'function',
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { AnyObject, EmptyObject, TypeCheck } from '@xylabs/object'
|
|
2
|
-
import { AnyNonPromise } from '@xylabs/promise'
|
|
1
|
+
import type { AnyObject, EmptyObject, TypeCheck } from '@xylabs/object'
|
|
2
|
+
import type { AnyNonPromise } from '@xylabs/promise'
|
|
3
3
|
|
|
4
4
|
import { asModuleObject } from './asModuleObject.ts'
|
|
5
5
|
import { isModuleObject } from './isModuleObject.ts'
|
|
6
|
-
import { Module } from './Module.ts'
|
|
6
|
+
import type { Module } from './Module.ts'
|
|
7
7
|
|
|
8
8
|
export type ModuleTypeCheck<T extends Module = Module> = TypeCheck<T>
|
|
9
9
|
|
package/src/module/Module.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { EventFunctions } from '@xyo-network/module-events'
|
|
1
|
+
import type { EventFunctions } from '@xyo-network/module-events'
|
|
2
2
|
|
|
3
|
-
import { ModuleEventData } from '../EventsModels/index.ts'
|
|
4
|
-
import { ModuleParams } from '../ModuleParams.ts'
|
|
5
|
-
import { ModuleFields } from './ModuleFields.ts'
|
|
3
|
+
import type { ModuleEventData } from '../EventsModels/index.ts'
|
|
4
|
+
import type { ModuleParams } from '../ModuleParams.ts'
|
|
5
|
+
import type { ModuleFields } from './ModuleFields.ts'
|
|
6
6
|
|
|
7
7
|
export interface Module<TParams extends ModuleParams = ModuleParams, TEventData extends ModuleEventData<object> = ModuleEventData<object>>
|
|
8
8
|
extends ModuleFields<TParams>,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Address } from '@xylabs/hex'
|
|
2
|
-
import { Promisable } from '@xylabs/promise'
|
|
3
|
-
import { QueryBoundWitness } from '@xyo-network/boundwitness-model'
|
|
4
|
-
import { Payload } from '@xyo-network/payload-model'
|
|
5
|
-
|
|
6
|
-
import { ModuleConfig } from '../Config/index.ts'
|
|
7
|
-
import { ModuleName } from '../ModuleIdentifier.ts'
|
|
8
|
-
import { ModuleParams } from '../ModuleParams.ts'
|
|
9
|
-
import { ModuleQueryResult } from '../ModuleQueryResult.ts'
|
|
1
|
+
import type { Address } from '@xylabs/hex'
|
|
2
|
+
import type { Promisable } from '@xylabs/promise'
|
|
3
|
+
import type { QueryBoundWitness } from '@xyo-network/boundwitness-model'
|
|
4
|
+
import type { Payload } from '@xyo-network/payload-model'
|
|
5
|
+
|
|
6
|
+
import type { ModuleConfig } from '../Config/index.ts'
|
|
7
|
+
import type { ModuleName } from '../ModuleIdentifier.ts'
|
|
8
|
+
import type { ModuleParams } from '../ModuleParams.ts'
|
|
9
|
+
import type { ModuleQueryResult } from '../ModuleQueryResult.ts'
|
|
10
10
|
|
|
11
11
|
export interface ModuleFields<TParams extends ModuleParams = ModuleParams> {
|
|
12
12
|
address: Address
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Address } from '@xylabs/hex'
|
|
2
|
-
import { Promisable } from '@xylabs/promise'
|
|
3
|
-
import { AccountInstance } from '@xyo-network/account-model'
|
|
4
|
-
import { ModuleManifestPayload } from '@xyo-network/manifest-model'
|
|
5
|
-
import { Payload } from '@xyo-network/payload-model'
|
|
1
|
+
import type { Address } from '@xylabs/hex'
|
|
2
|
+
import type { Promisable } from '@xylabs/promise'
|
|
3
|
+
import type { AccountInstance } from '@xyo-network/account-model'
|
|
4
|
+
import type { ModuleManifestPayload } from '@xyo-network/manifest-model'
|
|
5
|
+
import type { Payload } from '@xyo-network/payload-model'
|
|
6
6
|
|
|
7
|
-
import { ModuleQueryResult } from '../ModuleQueryResult.ts'
|
|
8
|
-
import { AddressPayload, AddressPreviousHashPayload } from '../Payload/index.ts'
|
|
7
|
+
import type { ModuleQueryResult } from '../ModuleQueryResult.ts'
|
|
8
|
+
import type { AddressPayload, AddressPreviousHashPayload } from '../Payload/index.ts'
|
|
9
9
|
|
|
10
10
|
export interface ModuleQueryFunctions {
|
|
11
11
|
manifest: (maxDepth?: number, ignoreAddresses?: Address[]) => Promisable<ModuleManifestPayload>
|
package/src/module/isModule.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { TypeCheck } from '@xylabs/object'
|
|
2
|
-
import { Schema } from '@xyo-network/payload-model'
|
|
1
|
+
import type { TypeCheck } from '@xylabs/object'
|
|
2
|
+
import type { Schema } from '@xyo-network/payload-model'
|
|
3
3
|
|
|
4
4
|
import { ModuleStateQuerySchema } from '../Queries/index.ts'
|
|
5
5
|
import { IsModuleFactory } from './IsModuleFactory.ts'
|
|
6
6
|
import { isModuleObject } from './isModuleObject.ts'
|
|
7
|
-
import { Module } from './Module.ts'
|
|
7
|
+
import type { Module } from './Module.ts'
|
|
8
8
|
|
|
9
9
|
export const requiredModuleQueries: Schema[] = [ModuleStateQuerySchema]
|
|
10
10
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ObjectTypeShape } from '@xylabs/object'
|
|
2
|
+
import { IsObjectFactory } from '@xylabs/object'
|
|
2
3
|
|
|
3
|
-
import { Module } from './Module.ts'
|
|
4
|
+
import type { Module } from './Module.ts'
|
|
4
5
|
|
|
5
6
|
export const requiredModuleShape: ObjectTypeShape = {
|
|
6
7
|
address: 'string',
|
package/src/withModule.ts
CHANGED