@xyo-network/node-model 5.3.22 → 5.3.25
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/package.json +14 -15
- package/src/ChildCertification.ts +0 -12
- package/src/Config.ts +0 -24
- package/src/EventsModels/ModuleAttached.ts +0 -8
- package/src/EventsModels/ModuleDetached.ts +0 -8
- package/src/EventsModels/ModuleRegistered.ts +0 -8
- package/src/EventsModels/ModuleUnregistered.ts +0 -8
- package/src/EventsModels/index.ts +0 -4
- package/src/Node.ts +0 -16
- package/src/Params.ts +0 -13
- package/src/Queries/Attach.ts +0 -11
- package/src/Queries/Attached.ts +0 -8
- package/src/Queries/Certify.ts +0 -10
- package/src/Queries/Detach.ts +0 -10
- package/src/Queries/Registered.ts +0 -8
- package/src/Queries/index.ts +0 -16
- package/src/attachable/AttachableInstance.ts +0 -16
- package/src/attachable/asAttachableInstance.ts +0 -5
- package/src/attachable/index.ts +0 -3
- package/src/attachable/isAttachableInstance.ts +0 -16
- package/src/index.ts +0 -9
- package/src/instance.ts +0 -34
- package/src/typeChecks.ts +0 -35
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/node-model",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.25",
|
|
4
4
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -30,32 +30,31 @@
|
|
|
30
30
|
"types": "dist/neutral/index.d.ts",
|
|
31
31
|
"files": [
|
|
32
32
|
"dist",
|
|
33
|
-
"src",
|
|
34
33
|
"!**/*.bench.*",
|
|
35
34
|
"!**/*.spec.*",
|
|
36
35
|
"!**/*.test.*",
|
|
37
36
|
"README.md"
|
|
38
37
|
],
|
|
39
38
|
"dependencies": {
|
|
40
|
-
"@xyo-network/account-model": "~5.3.
|
|
41
|
-
"@xyo-network/
|
|
42
|
-
"@xyo-network/
|
|
39
|
+
"@xyo-network/account-model": "~5.3.25",
|
|
40
|
+
"@xyo-network/payload-model": "~5.3.25",
|
|
41
|
+
"@xyo-network/module-model": "~5.3.25"
|
|
43
42
|
},
|
|
44
43
|
"devDependencies": {
|
|
45
44
|
"@opentelemetry/api": "^1.9.1",
|
|
46
45
|
"@types/node": "^25.5.0",
|
|
47
|
-
"@xylabs/sdk-js": "^5.0.
|
|
48
|
-
"@xylabs/ts-scripts-common": "~7.6.
|
|
49
|
-
"@xylabs/ts-scripts-
|
|
50
|
-
"@xylabs/tsconfig": "~7.6.
|
|
46
|
+
"@xylabs/sdk-js": "^5.0.93",
|
|
47
|
+
"@xylabs/ts-scripts-common": "~7.6.16",
|
|
48
|
+
"@xylabs/ts-scripts-pnpm": "~7.6.16",
|
|
49
|
+
"@xylabs/tsconfig": "~7.6.16",
|
|
51
50
|
"acorn": "^8.16.0",
|
|
52
51
|
"axios": "^1.14.0",
|
|
53
|
-
"
|
|
54
|
-
"esbuild": "^0.27.4",
|
|
55
|
-
"eslint": "^10.1.0",
|
|
56
|
-
"rollup": "^4.60.1",
|
|
52
|
+
"esbuild": "^0.28.0",
|
|
57
53
|
"typescript": "~5.9.3",
|
|
58
|
-
"zod": "^4.3.6"
|
|
54
|
+
"zod": "^4.3.6",
|
|
55
|
+
"@xyo-network/account-model": "~5.3.25",
|
|
56
|
+
"@xyo-network/module-model": "~5.3.25",
|
|
57
|
+
"@xyo-network/payload-model": "~5.3.25"
|
|
59
58
|
},
|
|
60
59
|
"peerDependencies": {
|
|
61
60
|
"@xylabs/sdk-js": "^5",
|
|
@@ -64,4 +63,4 @@
|
|
|
64
63
|
"publishConfig": {
|
|
65
64
|
"access": "public"
|
|
66
65
|
}
|
|
67
|
-
}
|
|
66
|
+
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { Address } from '@xylabs/sdk-js'
|
|
2
|
-
import { asSchema, type Payload } from '@xyo-network/payload-model'
|
|
3
|
-
|
|
4
|
-
export const ChildCertificationSchema = asSchema('network.xyo.child.certification', true)
|
|
5
|
-
export type ChildCertificationSchema = typeof ChildCertificationSchema
|
|
6
|
-
|
|
7
|
-
export interface ChildCertificationFields {
|
|
8
|
-
address: Address
|
|
9
|
-
expiration: number
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export type ChildCertification = Payload<ChildCertificationFields, ChildCertificationSchema>
|
package/src/Config.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { EmptyObject, WithAdditional } from '@xylabs/sdk-js'
|
|
2
|
-
import type { ModuleConfig } from '@xyo-network/module-model'
|
|
3
|
-
import type {
|
|
4
|
-
Payload,
|
|
5
|
-
Schema,
|
|
6
|
-
} from '@xyo-network/payload-model'
|
|
7
|
-
import { asSchema } from '@xyo-network/payload-model'
|
|
8
|
-
|
|
9
|
-
export const NodeConfigSchema = asSchema('network.xyo.node.config', true)
|
|
10
|
-
export type NodeConfigSchema = typeof NodeConfigSchema
|
|
11
|
-
|
|
12
|
-
export type NodeConfig<TConfig extends EmptyObject | Payload | void = void, TSchema extends Schema | void = void> = ModuleConfig<
|
|
13
|
-
WithAdditional<
|
|
14
|
-
{
|
|
15
|
-
archivist?: string
|
|
16
|
-
},
|
|
17
|
-
TConfig
|
|
18
|
-
>,
|
|
19
|
-
TSchema extends void
|
|
20
|
-
? TConfig extends Payload
|
|
21
|
-
? TConfig['schema']
|
|
22
|
-
: NodeConfigSchema
|
|
23
|
-
: TSchema
|
|
24
|
-
>
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { EventData } from '@xylabs/sdk-js'
|
|
2
|
-
import type { ModuleEventArgs, QueryableModule } from '@xyo-network/module-model'
|
|
3
|
-
|
|
4
|
-
export type ModuleAttachedEventArgs<TModule extends QueryableModule = QueryableModule> = ModuleEventArgs<TModule>
|
|
5
|
-
|
|
6
|
-
export interface ModuleAttachedEventData extends EventData {
|
|
7
|
-
moduleAttached: ModuleAttachedEventArgs
|
|
8
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { EventData } from '@xylabs/sdk-js'
|
|
2
|
-
import type { ModuleEventArgs, QueryableModule } from '@xyo-network/module-model'
|
|
3
|
-
|
|
4
|
-
export type ModuleDetachedEventArgs<TModule extends QueryableModule = QueryableModule> = ModuleEventArgs<TModule>
|
|
5
|
-
|
|
6
|
-
export interface ModuleDetachedEventData extends EventData {
|
|
7
|
-
moduleDetached: ModuleDetachedEventArgs
|
|
8
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { EventData } from '@xylabs/sdk-js'
|
|
2
|
-
import type { ModuleEventArgs, QueryableModule } from '@xyo-network/module-model'
|
|
3
|
-
|
|
4
|
-
export type ModuleRegisteredEventArgs<TModule extends QueryableModule = QueryableModule> = ModuleEventArgs<TModule>
|
|
5
|
-
|
|
6
|
-
export interface ModuleRegisteredEventData extends EventData {
|
|
7
|
-
moduleRegistered: ModuleRegisteredEventArgs
|
|
8
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { EventData } from '@xylabs/sdk-js'
|
|
2
|
-
import type { ModuleEventArgs, QueryableModule } from '@xyo-network/module-model'
|
|
3
|
-
|
|
4
|
-
export type ModuleUnregisteredEventArgs<TModule extends QueryableModule = QueryableModule> = ModuleEventArgs<TModule>
|
|
5
|
-
|
|
6
|
-
export interface ModuleUnregisteredEventData extends EventData {
|
|
7
|
-
moduleUnregistered: ModuleUnregisteredEventArgs
|
|
8
|
-
}
|
package/src/Node.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ModuleEventData, QueryableModule } from '@xyo-network/module-model'
|
|
2
|
-
|
|
3
|
-
import type {
|
|
4
|
-
ModuleAttachedEventData, ModuleDetachedEventData, ModuleRegisteredEventData, ModuleUnregisteredEventData,
|
|
5
|
-
} from './EventsModels/index.ts'
|
|
6
|
-
import type { NodeParams } from './Params.ts'
|
|
7
|
-
|
|
8
|
-
export interface NodeModuleEventData
|
|
9
|
-
extends ModuleAttachedEventData,
|
|
10
|
-
ModuleDetachedEventData,
|
|
11
|
-
ModuleRegisteredEventData,
|
|
12
|
-
ModuleUnregisteredEventData,
|
|
13
|
-
ModuleEventData {}
|
|
14
|
-
|
|
15
|
-
export interface NodeModule<TParams extends NodeParams = NodeParams, TEventData extends NodeModuleEventData = NodeModuleEventData>
|
|
16
|
-
extends QueryableModule<TParams, TEventData> {}
|
package/src/Params.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
AnyConfigSchema, ModuleInstanceParams, QueryableModuleParams,
|
|
3
|
-
} from '@xyo-network/module-model'
|
|
4
|
-
|
|
5
|
-
import type { NodeConfig } from './Config.ts'
|
|
6
|
-
|
|
7
|
-
export interface NodeParams<
|
|
8
|
-
TConfig extends AnyConfigSchema<NodeConfig> = AnyConfigSchema<NodeConfig>,
|
|
9
|
-
> extends QueryableModuleParams<TConfig> {}
|
|
10
|
-
|
|
11
|
-
export interface NodeInstanceParams<
|
|
12
|
-
TConfig extends AnyConfigSchema<NodeConfig> = AnyConfigSchema<NodeConfig>,
|
|
13
|
-
> extends ModuleInstanceParams<TConfig> {}
|
package/src/Queries/Attach.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { ModuleIdentifier } from '@xyo-network/module-model'
|
|
2
|
-
import { asSchema, type Query } from '@xyo-network/payload-model'
|
|
3
|
-
|
|
4
|
-
export const NodeAttachQuerySchema = asSchema('network.xyo.query.node.attach', true)
|
|
5
|
-
export type NodeAttachQuerySchema = typeof NodeAttachQuerySchema
|
|
6
|
-
|
|
7
|
-
export type NodeAttachQuery = Query<{
|
|
8
|
-
external?: boolean
|
|
9
|
-
id: ModuleIdentifier
|
|
10
|
-
schema: NodeAttachQuerySchema
|
|
11
|
-
}>
|
package/src/Queries/Attached.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { asSchema, type Query } from '@xyo-network/payload-model'
|
|
2
|
-
|
|
3
|
-
export const NodeAttachedQuerySchema = asSchema('network.xyo.query.node.attached', true)
|
|
4
|
-
export type NodeAttachedQuerySchema = typeof NodeAttachedQuerySchema
|
|
5
|
-
|
|
6
|
-
export type NodeAttachedQuery = Query<{
|
|
7
|
-
schema: NodeAttachedQuerySchema
|
|
8
|
-
}>
|
package/src/Queries/Certify.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { ModuleIdentifier } from '@xyo-network/module-model'
|
|
2
|
-
import { asSchema, type Query } from '@xyo-network/payload-model'
|
|
3
|
-
|
|
4
|
-
export const NodeCertifyQuerySchema = asSchema('network.xyo.query.node.certify', true)
|
|
5
|
-
export type NodeCertifyQuerySchema = typeof NodeCertifyQuerySchema
|
|
6
|
-
|
|
7
|
-
export type NodeCertifyQuery = Query<{
|
|
8
|
-
id: ModuleIdentifier
|
|
9
|
-
schema: NodeCertifyQuerySchema
|
|
10
|
-
}>
|
package/src/Queries/Detach.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { ModuleIdentifier } from '@xyo-network/module-model'
|
|
2
|
-
import { asSchema, type Query } from '@xyo-network/payload-model'
|
|
3
|
-
|
|
4
|
-
export const NodeDetachQuerySchema = asSchema('network.xyo.query.node.detach', true)
|
|
5
|
-
export type NodeDetachQuerySchema = typeof NodeDetachQuerySchema
|
|
6
|
-
|
|
7
|
-
export type NodeDetachQuery = Query<{
|
|
8
|
-
id: ModuleIdentifier
|
|
9
|
-
schema: NodeDetachQuerySchema
|
|
10
|
-
}>
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { asSchema, type Query } from '@xyo-network/payload-model'
|
|
2
|
-
|
|
3
|
-
export const NodeRegisteredQuerySchema = asSchema('network.xyo.query.node.registered', true)
|
|
4
|
-
export type NodeRegisteredQuerySchema = typeof NodeRegisteredQuerySchema
|
|
5
|
-
|
|
6
|
-
export type NodeRegisteredQuery = Query<{
|
|
7
|
-
schema: NodeRegisteredQuerySchema
|
|
8
|
-
}>
|
package/src/Queries/index.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ModuleQueries } from '@xyo-network/module-model'
|
|
2
|
-
|
|
3
|
-
import type { NodeAttachQuery } from './Attach.ts'
|
|
4
|
-
import type { NodeAttachedQuery } from './Attached.ts'
|
|
5
|
-
import type { NodeCertifyQuery } from './Certify.ts'
|
|
6
|
-
import type { NodeDetachQuery } from './Detach.ts'
|
|
7
|
-
import type { NodeRegisteredQuery } from './Registered.ts'
|
|
8
|
-
|
|
9
|
-
export * from './Attach.ts'
|
|
10
|
-
export * from './Attached.ts'
|
|
11
|
-
export * from './Certify.ts'
|
|
12
|
-
export * from './Detach.ts'
|
|
13
|
-
export * from './Registered.ts'
|
|
14
|
-
|
|
15
|
-
export type NodeQueries = NodeAttachQuery | NodeCertifyQuery | NodeDetachQuery | NodeAttachedQuery | NodeRegisteredQuery
|
|
16
|
-
export type NodeModuleQueries = ModuleQueries | NodeQueries
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { TypeCheck } from '@xylabs/sdk-js'
|
|
2
|
-
import { IsObjectFactory } from '@xylabs/sdk-js'
|
|
3
|
-
import type { AttachableModuleInstance } from '@xyo-network/module-model'
|
|
4
|
-
|
|
5
|
-
import type { NodeInstance } from '../instance.ts'
|
|
6
|
-
import type { NodeModule, NodeModuleEventData } from '../Node.ts'
|
|
7
|
-
import type { NodeParams } from '../Params.ts'
|
|
8
|
-
|
|
9
|
-
export interface AttachableNodeInstance<TParams extends NodeParams = NodeParams, TEventData extends NodeModuleEventData = NodeModuleEventData>
|
|
10
|
-
extends NodeModule<TParams, TEventData>,
|
|
11
|
-
AttachableModuleInstance<TParams, TEventData>,
|
|
12
|
-
NodeInstance<TParams, TEventData> {}
|
|
13
|
-
|
|
14
|
-
export type AttachableNodeInstanceTypeCheck<T extends AttachableNodeInstance = AttachableNodeInstance> = TypeCheck<T>
|
|
15
|
-
|
|
16
|
-
export class IsAttachableNodeInstanceFactory<T extends AttachableNodeInstance = AttachableNodeInstance> extends IsObjectFactory<T> {}
|
package/src/attachable/index.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ObjectTypeShape, TypeCheck } from '@xylabs/sdk-js'
|
|
2
|
-
import { IsObjectFactory } from '@xylabs/sdk-js'
|
|
3
|
-
import { isAttachableModuleInstance } from '@xyo-network/module-model'
|
|
4
|
-
|
|
5
|
-
import { isNodeInstance } from '../typeChecks.ts'
|
|
6
|
-
import type { AttachableNodeInstance } from './AttachableInstance.ts'
|
|
7
|
-
|
|
8
|
-
export const requiredAttachableNodeInstanceFunctions: ObjectTypeShape = {}
|
|
9
|
-
|
|
10
|
-
// we do not use IsInstanceFactory here to prevent a cycle
|
|
11
|
-
const factory = new IsObjectFactory<AttachableNodeInstance>()
|
|
12
|
-
|
|
13
|
-
export const isAttachableNodeInstance: TypeCheck<AttachableNodeInstance> = factory.create(requiredAttachableNodeInstanceFunctions, [
|
|
14
|
-
isNodeInstance,
|
|
15
|
-
isAttachableModuleInstance,
|
|
16
|
-
])
|
package/src/index.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export * from './attachable/index.ts'
|
|
2
|
-
export * from './ChildCertification.ts'
|
|
3
|
-
export * from './Config.ts'
|
|
4
|
-
export * from './EventsModels/index.ts'
|
|
5
|
-
export * from './instance.ts'
|
|
6
|
-
export * from './Node.ts'
|
|
7
|
-
export * from './Params.ts'
|
|
8
|
-
export * from './Queries/index.ts'
|
|
9
|
-
export * from './typeChecks.ts'
|
package/src/instance.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { Address } from '@xylabs/sdk-js'
|
|
2
|
-
import type { AccountInstance } from '@xyo-network/account-model'
|
|
3
|
-
import type {
|
|
4
|
-
AddressPayload, AttachableModuleInstance, ModuleIdentifier, ModuleInstance, ModuleQueryResult,
|
|
5
|
-
} from '@xyo-network/module-model'
|
|
6
|
-
|
|
7
|
-
import type { ChildCertification, ChildCertificationFields } from './ChildCertification.ts'
|
|
8
|
-
import type { NodeModule, NodeModuleEventData } from './Node.ts'
|
|
9
|
-
import type { NodeParams } from './Params.ts'
|
|
10
|
-
|
|
11
|
-
export interface NodeQueryFunctions {
|
|
12
|
-
attach: (id: ModuleIdentifier, external?: boolean) => Promise<Address | undefined>
|
|
13
|
-
attachQuery: (id: ModuleIdentifier, external?: boolean, account?: AccountInstance) => Promise<ModuleQueryResult<AddressPayload>>
|
|
14
|
-
attached: () => Promise<Address[]>
|
|
15
|
-
attachedQuery: (account?: AccountInstance) => Promise<ModuleQueryResult<AddressPayload>>
|
|
16
|
-
certify: (id: ModuleIdentifier) => Promise<ChildCertificationFields | undefined>
|
|
17
|
-
certifyQuery: (id: ModuleIdentifier, account?: AccountInstance) => Promise<ModuleQueryResult<ChildCertification>>
|
|
18
|
-
detach: (id: ModuleIdentifier) => Promise<Address | undefined>
|
|
19
|
-
detachQuery: (id: ModuleIdentifier, account?: AccountInstance) => Promise<ModuleQueryResult<AddressPayload>>
|
|
20
|
-
registered: () => Promise<Address[]>
|
|
21
|
-
registeredQuery: (account?: AccountInstance) => Promise<ModuleQueryResult<AddressPayload>>
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface NodeRegistrationFunctions {
|
|
25
|
-
register?: (mod: AttachableModuleInstance) => Promise<void>
|
|
26
|
-
registeredModules?: () => AttachableModuleInstance[]
|
|
27
|
-
unregister?: (mod: ModuleInstance) => Promise<ModuleInstance>
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface NodeInstance<TParams extends NodeParams = NodeParams, TEventData extends NodeModuleEventData = NodeModuleEventData>
|
|
31
|
-
extends NodeModule<TParams, TEventData>,
|
|
32
|
-
NodeQueryFunctions,
|
|
33
|
-
NodeRegistrationFunctions,
|
|
34
|
-
ModuleInstance<TParams, TEventData> {}
|
package/src/typeChecks.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { TypeCheck } from '@xylabs/sdk-js'
|
|
2
|
-
import { AsObjectFactory } from '@xylabs/sdk-js'
|
|
3
|
-
import {
|
|
4
|
-
// eslint-disable-next-line sonarjs/deprecation
|
|
5
|
-
IsInstanceFactory, isModuleInstance, IsQueryableModuleFactory, WithFactory,
|
|
6
|
-
} from '@xyo-network/module-model'
|
|
7
|
-
|
|
8
|
-
import type { NodeInstance } from './instance.ts'
|
|
9
|
-
import type { NodeModule } from './Node.ts'
|
|
10
|
-
import { NodeAttachedQuerySchema } from './Queries/index.ts'
|
|
11
|
-
|
|
12
|
-
const instanceFactory = new IsInstanceFactory<NodeInstance>()
|
|
13
|
-
|
|
14
|
-
export const isNodeInstance: TypeCheck<NodeInstance> = instanceFactory.create(
|
|
15
|
-
{
|
|
16
|
-
attach: 'function',
|
|
17
|
-
attached: 'function',
|
|
18
|
-
certify: 'function',
|
|
19
|
-
detach: 'function',
|
|
20
|
-
registered: 'function',
|
|
21
|
-
},
|
|
22
|
-
[isModuleInstance],
|
|
23
|
-
)
|
|
24
|
-
|
|
25
|
-
export const isNodeModule: TypeCheck<NodeModule> = new IsQueryableModuleFactory<NodeModule>().create([NodeAttachedQuerySchema])
|
|
26
|
-
|
|
27
|
-
export const asNodeModule = AsObjectFactory.create(isNodeModule)
|
|
28
|
-
export const asNodeInstance = AsObjectFactory.create(isNodeInstance)
|
|
29
|
-
|
|
30
|
-
/** @deprecated use narrowing instead [ if(is) ] */
|
|
31
|
-
// eslint-disable-next-line sonarjs/deprecation, @typescript-eslint/no-deprecated
|
|
32
|
-
export const withNodeModule = WithFactory.create(isNodeModule)
|
|
33
|
-
/** @deprecated use narrowing instead [ if(is) ] */
|
|
34
|
-
// eslint-disable-next-line sonarjs/deprecation, @typescript-eslint/no-deprecated
|
|
35
|
-
export const withNodeInstance = WithFactory.create(isNodeInstance)
|