@xyo-network/node-model 4.0.3 → 4.1.0
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/types → build/neutral}/typeChecks.d.ts +3 -2
- package/build/neutral/typeChecks.d.ts.map +1 -0
- package/dist/neutral/index.d.ts +129 -0
- package/dist/neutral/index.mjs +1 -2
- package/dist/neutral/index.mjs.map +1 -1
- package/package.json +12 -12
- package/src/typeChecks.ts +3 -4
- package/dist/types/typeChecks.d.ts.map +0 -1
- /package/{dist/types → build/neutral}/ChildCertification.d.ts +0 -0
- /package/{dist/types → build/neutral}/ChildCertification.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/Config.d.ts +0 -0
- /package/{dist/types → build/neutral}/Config.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/EventsModels/ModuleAttached.d.ts +0 -0
- /package/{dist/types → build/neutral}/EventsModels/ModuleAttached.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/EventsModels/ModuleDetached.d.ts +0 -0
- /package/{dist/types → build/neutral}/EventsModels/ModuleDetached.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/EventsModels/ModuleRegistered.d.ts +0 -0
- /package/{dist/types → build/neutral}/EventsModels/ModuleRegistered.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/EventsModels/ModuleUnregistered.d.ts +0 -0
- /package/{dist/types → build/neutral}/EventsModels/ModuleUnregistered.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/EventsModels/index.d.ts +0 -0
- /package/{dist/types → build/neutral}/EventsModels/index.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/Node.d.ts +0 -0
- /package/{dist/types → build/neutral}/Node.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/Params.d.ts +0 -0
- /package/{dist/types → build/neutral}/Params.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/Queries/Attach.d.ts +0 -0
- /package/{dist/types → build/neutral}/Queries/Attach.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/Queries/Attached.d.ts +0 -0
- /package/{dist/types → build/neutral}/Queries/Attached.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/Queries/Certify.d.ts +0 -0
- /package/{dist/types → build/neutral}/Queries/Certify.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/Queries/Detach.d.ts +0 -0
- /package/{dist/types → build/neutral}/Queries/Detach.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/Queries/Registered.d.ts +0 -0
- /package/{dist/types → build/neutral}/Queries/Registered.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/Queries/index.d.ts +0 -0
- /package/{dist/types → build/neutral}/Queries/index.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/attachable/AttachableInstance.d.ts +0 -0
- /package/{dist/types → build/neutral}/attachable/AttachableInstance.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/attachable/asAttachableInstance.d.ts +0 -0
- /package/{dist/types → build/neutral}/attachable/asAttachableInstance.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/attachable/index.d.ts +0 -0
- /package/{dist/types → build/neutral}/attachable/index.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/attachable/isAttachableInstance.d.ts +0 -0
- /package/{dist/types → build/neutral}/attachable/isAttachableInstance.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/index.d.ts +0 -0
- /package/{dist/types → build/neutral}/index.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/instance.d.ts +0 -0
- /package/{dist/types → build/neutral}/instance.d.ts.map +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { TypeCheck } from '@xylabs/object';
|
|
1
2
|
import type { NodeInstance } from './instance.ts';
|
|
2
3
|
import type { NodeModule } from './Node.ts';
|
|
3
|
-
export declare const isNodeInstance:
|
|
4
|
-
export declare const isNodeModule:
|
|
4
|
+
export declare const isNodeInstance: TypeCheck<NodeInstance>;
|
|
5
|
+
export declare const isNodeModule: TypeCheck<NodeModule>;
|
|
5
6
|
export declare const asNodeModule: import("@xylabs/object").AsTypeFunction<NodeModule<import("./Params.ts").NodeParams<import("@xyo-network/module-model").AnyConfigSchema<import("./Config.ts").NodeConfig>>, import("./Node.ts").NodeModuleEventData>>;
|
|
6
7
|
export declare const asNodeInstance: import("@xylabs/object").AsTypeFunction<NodeInstance<import("./Params.ts").NodeParams<import("@xyo-network/module-model").AnyConfigSchema<import("./Config.ts").NodeConfig>>, import("./Node.ts").NodeModuleEventData>>;
|
|
7
8
|
export declare const withNodeModule: <R>(mod: any, closure: (mod: NodeModule<import("./Params.ts").NodeParams<import("@xyo-network/module-model").AnyConfigSchema<import("./Config.ts").NodeConfig>>, import("./Node.ts").NodeModuleEventData>) => R) => R | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeChecks.d.ts","sourceRoot":"","sources":["../../src/typeChecks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAM/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAK3C,eAAO,MAAM,cAAc,EAAE,SAAS,CAAC,YAAY,CASlD,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,SAAS,CAAC,UAAU,CAAuE,CAAA;AAEtH,eAAO,MAAM,YAAY,uNAAuC,CAAA;AAChE,eAAO,MAAM,cAAc,yNAAyC,CAAA;AACpE,eAAO,MAAM,cAAc,mOAAmC,CAAA;AAC9D,eAAO,MAAM,gBAAgB,qOAAqC,CAAA"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import * as _xylabs_object from '@xylabs/object';
|
|
2
|
+
import { EmptyObject, WithAdditional, TypeCheck, IsObjectFactory } from '@xylabs/object';
|
|
3
|
+
import * as _xyo_network_module_model from '@xyo-network/module-model';
|
|
4
|
+
import { Module, ModuleEventArgs, ModuleConfig, AnyConfigSchema, ModuleParams, ModuleEventData, ModuleIdentifier, ModuleQueryResult, AddressPayload, AttachableModuleInstance, ModuleInstance, ModuleQueries } from '@xyo-network/module-model';
|
|
5
|
+
import { Address } from '@xylabs/hex';
|
|
6
|
+
import { AccountInstance } from '@xyo-network/account-model';
|
|
7
|
+
import { Payload, Query } from '@xyo-network/payload-model';
|
|
8
|
+
import { EventData } from '@xylabs/events';
|
|
9
|
+
import { ObjectTypeShape } from '@xylabs/typeof';
|
|
10
|
+
|
|
11
|
+
declare const ChildCertificationSchema: "network.xyo.child.certification";
|
|
12
|
+
type ChildCertificationSchema = typeof ChildCertificationSchema;
|
|
13
|
+
interface ChildCertificationFields {
|
|
14
|
+
address: Address;
|
|
15
|
+
expiration: number;
|
|
16
|
+
}
|
|
17
|
+
type ChildCertification = Payload<ChildCertificationFields, ChildCertificationSchema>;
|
|
18
|
+
|
|
19
|
+
type ModuleAttachedEventArgs<TModule extends Module = Module> = ModuleEventArgs<TModule>;
|
|
20
|
+
interface ModuleAttachedEventData extends EventData {
|
|
21
|
+
moduleAttached: ModuleAttachedEventArgs;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
type ModuleDetachedEventArgs<TModule extends Module = Module> = ModuleEventArgs<TModule>;
|
|
25
|
+
interface ModuleDetachedEventData extends EventData {
|
|
26
|
+
moduleDetached: ModuleDetachedEventArgs;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
type ModuleRegisteredEventArgs<TModule extends Module = Module> = ModuleEventArgs<TModule>;
|
|
30
|
+
interface ModuleRegisteredEventData extends EventData {
|
|
31
|
+
moduleRegistered: ModuleRegisteredEventArgs;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
type ModuleUnregisteredEventArgs<TModule extends Module = Module> = ModuleEventArgs<TModule>;
|
|
35
|
+
interface ModuleUnregisteredEventData extends EventData {
|
|
36
|
+
moduleUnregistered: ModuleUnregisteredEventArgs;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
declare const NodeConfigSchema: "network.xyo.node.config";
|
|
40
|
+
type NodeConfigSchema = typeof NodeConfigSchema;
|
|
41
|
+
type NodeConfig<TConfig extends EmptyObject | Payload | void = void, TSchema extends string | void = void> = ModuleConfig<WithAdditional<{
|
|
42
|
+
archivist?: string;
|
|
43
|
+
}, TConfig>, TSchema extends void ? TConfig extends Payload ? TConfig['schema'] : NodeConfigSchema : TSchema>;
|
|
44
|
+
|
|
45
|
+
interface NodeParams<TConfig extends AnyConfigSchema<NodeConfig> = AnyConfigSchema<NodeConfig>> extends ModuleParams<TConfig> {
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface NodeModuleEventData extends ModuleAttachedEventData, ModuleDetachedEventData, ModuleRegisteredEventData, ModuleUnregisteredEventData, ModuleEventData {
|
|
49
|
+
}
|
|
50
|
+
interface NodeModule<TParams extends NodeParams = NodeParams, TEventData extends NodeModuleEventData = NodeModuleEventData> extends Module<TParams, TEventData> {
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
interface NodeQueryFunctions {
|
|
54
|
+
attach: (id: ModuleIdentifier, external?: boolean) => Promise<Address | undefined>;
|
|
55
|
+
attachQuery: (id: ModuleIdentifier, external?: boolean, account?: AccountInstance) => Promise<ModuleQueryResult<AddressPayload>>;
|
|
56
|
+
attached: () => Promise<Address[]>;
|
|
57
|
+
attachedQuery: (account?: AccountInstance) => Promise<ModuleQueryResult<AddressPayload>>;
|
|
58
|
+
certify: (id: ModuleIdentifier) => Promise<ChildCertificationFields | undefined>;
|
|
59
|
+
certifyQuery: (id: ModuleIdentifier, account?: AccountInstance) => Promise<ModuleQueryResult<ChildCertification>>;
|
|
60
|
+
detach: (id: ModuleIdentifier) => Promise<Address | undefined>;
|
|
61
|
+
detachQuery: (id: ModuleIdentifier, account?: AccountInstance) => Promise<ModuleQueryResult<AddressPayload>>;
|
|
62
|
+
registered: () => Promise<Address[]>;
|
|
63
|
+
registeredQuery: (account?: AccountInstance) => Promise<ModuleQueryResult<AddressPayload>>;
|
|
64
|
+
}
|
|
65
|
+
interface NodeRegistrationFunctions {
|
|
66
|
+
register?: (mod: AttachableModuleInstance) => Promise<void>;
|
|
67
|
+
registeredModules?: () => AttachableModuleInstance[];
|
|
68
|
+
unregister?: (mod: ModuleInstance) => Promise<ModuleInstance>;
|
|
69
|
+
}
|
|
70
|
+
interface NodeInstance<TParams extends NodeParams = NodeParams, TEventData extends NodeModuleEventData = NodeModuleEventData> extends NodeModule<TParams, TEventData>, NodeQueryFunctions, NodeRegistrationFunctions, ModuleInstance<TParams, TEventData> {
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
interface AttachableNodeInstance<TParams extends NodeParams = NodeParams, TEventData extends NodeModuleEventData = NodeModuleEventData> extends NodeModule<TParams, TEventData>, AttachableModuleInstance<TParams, TEventData>, NodeInstance<TParams, TEventData> {
|
|
74
|
+
}
|
|
75
|
+
type AttachableNodeInstanceTypeCheck<T extends AttachableNodeInstance = AttachableNodeInstance> = TypeCheck<T>;
|
|
76
|
+
declare class IsAttachableNodeInstanceFactory<T extends AttachableNodeInstance = AttachableNodeInstance> extends IsObjectFactory<T> {
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
declare const asAttachableNodeInstance: _xylabs_object.AsTypeFunction<AttachableNodeInstance<NodeParams<_xyo_network_module_model.AnyConfigSchema<NodeConfig>>, NodeModuleEventData>>;
|
|
80
|
+
|
|
81
|
+
declare const requiredAttachableNodeInstanceFunctions: ObjectTypeShape;
|
|
82
|
+
declare const isAttachableNodeInstance: TypeCheck<AttachableNodeInstance>;
|
|
83
|
+
|
|
84
|
+
declare const NodeAttachQuerySchema: "network.xyo.query.node.attach";
|
|
85
|
+
type NodeAttachQuerySchema = typeof NodeAttachQuerySchema;
|
|
86
|
+
type NodeAttachQuery = Query<{
|
|
87
|
+
external?: boolean;
|
|
88
|
+
id: ModuleIdentifier;
|
|
89
|
+
schema: NodeAttachQuerySchema;
|
|
90
|
+
}>;
|
|
91
|
+
|
|
92
|
+
declare const NodeAttachedQuerySchema: "network.xyo.query.node.attached";
|
|
93
|
+
type NodeAttachedQuerySchema = typeof NodeAttachedQuerySchema;
|
|
94
|
+
type NodeAttachedQuery = Query<{
|
|
95
|
+
schema: NodeAttachedQuerySchema;
|
|
96
|
+
}>;
|
|
97
|
+
|
|
98
|
+
declare const NodeCertifyQuerySchema: "network.xyo.query.node.certify";
|
|
99
|
+
type NodeCertifyQuerySchema = typeof NodeCertifyQuerySchema;
|
|
100
|
+
type NodeCertifyQuery = Query<{
|
|
101
|
+
id: ModuleIdentifier;
|
|
102
|
+
schema: NodeCertifyQuerySchema;
|
|
103
|
+
}>;
|
|
104
|
+
|
|
105
|
+
declare const NodeDetachQuerySchema: "network.xyo.query.node.detach";
|
|
106
|
+
type NodeDetachQuerySchema = typeof NodeDetachQuerySchema;
|
|
107
|
+
type NodeDetachQuery = Query<{
|
|
108
|
+
id: ModuleIdentifier;
|
|
109
|
+
schema: NodeDetachQuerySchema;
|
|
110
|
+
}>;
|
|
111
|
+
|
|
112
|
+
declare const NodeRegisteredQuerySchema: "network.xyo.query.node.registered";
|
|
113
|
+
type NodeRegisteredQuerySchema = typeof NodeRegisteredQuerySchema;
|
|
114
|
+
type NodeRegisteredQuery = Query<{
|
|
115
|
+
schema: NodeRegisteredQuerySchema;
|
|
116
|
+
}>;
|
|
117
|
+
|
|
118
|
+
type NodeQueries = NodeAttachQuery | NodeCertifyQuery | NodeDetachQuery | NodeAttachedQuery | NodeRegisteredQuery;
|
|
119
|
+
type NodeModuleQueries = ModuleQueries | NodeQueries;
|
|
120
|
+
|
|
121
|
+
declare const isNodeInstance: TypeCheck<NodeInstance>;
|
|
122
|
+
declare const isNodeModule: TypeCheck<NodeModule>;
|
|
123
|
+
declare const asNodeModule: _xylabs_object.AsTypeFunction<NodeModule<NodeParams<_xyo_network_module_model.AnyConfigSchema<NodeConfig>>, NodeModuleEventData>>;
|
|
124
|
+
declare const asNodeInstance: _xylabs_object.AsTypeFunction<NodeInstance<NodeParams<_xyo_network_module_model.AnyConfigSchema<NodeConfig>>, NodeModuleEventData>>;
|
|
125
|
+
declare const withNodeModule: <R>(mod: any, closure: (mod: NodeModule<NodeParams<_xyo_network_module_model.AnyConfigSchema<NodeConfig>>, NodeModuleEventData>) => R) => R | undefined;
|
|
126
|
+
declare const withNodeInstance: <R>(mod: any, closure: (mod: NodeInstance<NodeParams<_xyo_network_module_model.AnyConfigSchema<NodeConfig>>, NodeModuleEventData>) => R) => R | undefined;
|
|
127
|
+
|
|
128
|
+
export { ChildCertificationSchema, IsAttachableNodeInstanceFactory, NodeAttachQuerySchema, NodeAttachedQuerySchema, NodeCertifyQuerySchema, NodeConfigSchema, NodeDetachQuerySchema, NodeRegisteredQuerySchema, asAttachableNodeInstance, asNodeInstance, asNodeModule, isAttachableNodeInstance, isNodeInstance, isNodeModule, requiredAttachableNodeInstanceFunctions, withNodeInstance, withNodeModule };
|
|
129
|
+
export type { AttachableNodeInstance, AttachableNodeInstanceTypeCheck, ChildCertification, ChildCertificationFields, ModuleAttachedEventArgs, ModuleAttachedEventData, ModuleDetachedEventArgs, ModuleDetachedEventData, ModuleRegisteredEventArgs, ModuleRegisteredEventData, ModuleUnregisteredEventArgs, ModuleUnregisteredEventData, NodeAttachQuery, NodeAttachedQuery, NodeCertifyQuery, NodeConfig, NodeDetachQuery, NodeInstance, NodeModule, NodeModuleEventData, NodeModuleQueries, NodeParams, NodeQueries, NodeQueryFunctions, NodeRegisteredQuery, NodeRegistrationFunctions };
|
package/dist/neutral/index.mjs
CHANGED
|
@@ -41,8 +41,7 @@ var isNodeInstance = instanceFactory.create(
|
|
|
41
41
|
},
|
|
42
42
|
[isModuleInstance]
|
|
43
43
|
);
|
|
44
|
-
var
|
|
45
|
-
var isNodeModule = moduleFactory.create([NodeAttachedQuerySchema]);
|
|
44
|
+
var isNodeModule = new IsModuleFactory().create([NodeAttachedQuerySchema]);
|
|
46
45
|
var asNodeModule = AsObjectFactory.create(isNodeModule);
|
|
47
46
|
var asNodeInstance = AsObjectFactory.create(isNodeInstance);
|
|
48
47
|
var withNodeModule = WithFactory.create(isNodeModule);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/attachable/asAttachableInstance.ts","../../src/attachable/isAttachableInstance.ts","../../src/typeChecks.ts","../../src/Queries/Attach.ts","../../src/Queries/Attached.ts","../../src/Queries/Certify.ts","../../src/Queries/Detach.ts","../../src/Queries/Registered.ts","../../src/attachable/AttachableInstance.ts","../../src/ChildCertification.ts","../../src/Config.ts"],"sourcesContent":["import { AsObjectFactory } from '@xylabs/object'\n\nimport { isAttachableNodeInstance } from './isAttachableInstance.ts'\n\nexport const asAttachableNodeInstance = AsObjectFactory.create(isAttachableNodeInstance)\n","import type { TypeCheck } from '@xylabs/object'\nimport { IsObjectFactory } from '@xylabs/object'\nimport type { ObjectTypeShape } from '@xylabs/typeof'\nimport { isAttachableModuleInstance } from '@xyo-network/module-model'\n\nimport { isNodeInstance } from '../typeChecks.ts'\nimport type { AttachableNodeInstance } from './AttachableInstance.ts'\n\nexport const requiredAttachableNodeInstanceFunctions: ObjectTypeShape = {}\n\n// we do not use IsInstanceFactory here to prevent a cycle\nconst factory = new IsObjectFactory<AttachableNodeInstance>()\n\nexport const isAttachableNodeInstance: TypeCheck<AttachableNodeInstance> = factory.create(requiredAttachableNodeInstanceFunctions, [\n isNodeInstance,\n isAttachableModuleInstance,\n])\n","import { AsObjectFactory } from '@xylabs/object'\nimport {\n IsInstanceFactory, IsModuleFactory, isModuleInstance, WithFactory,\n} from '@xyo-network/module-model'\n\nimport type { NodeInstance } from './instance.ts'\nimport type { NodeModule } from './Node.ts'\nimport { NodeAttachedQuerySchema } from './Queries/index.ts'\n\nconst instanceFactory = new IsInstanceFactory<NodeInstance>()\n\nexport const isNodeInstance = instanceFactory.create(\n {\n attach: 'function',\n attached: 'function',\n certify: 'function',\n detach: 'function',\n registered: 'function',\n },\n [isModuleInstance],\n)\n\
|
|
1
|
+
{"version":3,"sources":["../../src/attachable/asAttachableInstance.ts","../../src/attachable/isAttachableInstance.ts","../../src/typeChecks.ts","../../src/Queries/Attach.ts","../../src/Queries/Attached.ts","../../src/Queries/Certify.ts","../../src/Queries/Detach.ts","../../src/Queries/Registered.ts","../../src/attachable/AttachableInstance.ts","../../src/ChildCertification.ts","../../src/Config.ts"],"sourcesContent":["import { AsObjectFactory } from '@xylabs/object'\n\nimport { isAttachableNodeInstance } from './isAttachableInstance.ts'\n\nexport const asAttachableNodeInstance = AsObjectFactory.create(isAttachableNodeInstance)\n","import type { TypeCheck } from '@xylabs/object'\nimport { IsObjectFactory } from '@xylabs/object'\nimport type { ObjectTypeShape } from '@xylabs/typeof'\nimport { isAttachableModuleInstance } from '@xyo-network/module-model'\n\nimport { isNodeInstance } from '../typeChecks.ts'\nimport type { AttachableNodeInstance } from './AttachableInstance.ts'\n\nexport const requiredAttachableNodeInstanceFunctions: ObjectTypeShape = {}\n\n// we do not use IsInstanceFactory here to prevent a cycle\nconst factory = new IsObjectFactory<AttachableNodeInstance>()\n\nexport const isAttachableNodeInstance: TypeCheck<AttachableNodeInstance> = factory.create(requiredAttachableNodeInstanceFunctions, [\n isNodeInstance,\n isAttachableModuleInstance,\n])\n","import type { TypeCheck } from '@xylabs/object'\nimport { AsObjectFactory } from '@xylabs/object'\nimport {\n IsInstanceFactory, IsModuleFactory, isModuleInstance, WithFactory,\n} from '@xyo-network/module-model'\n\nimport type { NodeInstance } from './instance.ts'\nimport type { NodeModule } from './Node.ts'\nimport { NodeAttachedQuerySchema } from './Queries/index.ts'\n\nconst instanceFactory = new IsInstanceFactory<NodeInstance>()\n\nexport const isNodeInstance: TypeCheck<NodeInstance> = instanceFactory.create(\n {\n attach: 'function',\n attached: 'function',\n certify: 'function',\n detach: 'function',\n registered: 'function',\n },\n [isModuleInstance],\n)\n\nexport const isNodeModule: TypeCheck<NodeModule> = new IsModuleFactory<NodeModule>().create([NodeAttachedQuerySchema])\n\nexport const asNodeModule = AsObjectFactory.create(isNodeModule)\nexport const asNodeInstance = AsObjectFactory.create(isNodeInstance)\nexport const withNodeModule = WithFactory.create(isNodeModule)\nexport const withNodeInstance = WithFactory.create(isNodeInstance)\n","import type { ModuleIdentifier } from '@xyo-network/module-model'\nimport type { Query } from '@xyo-network/payload-model'\n\nexport const NodeAttachQuerySchema = 'network.xyo.query.node.attach' as const\nexport type NodeAttachQuerySchema = typeof NodeAttachQuerySchema\n\nexport type NodeAttachQuery = Query<{\n external?: boolean\n id: ModuleIdentifier\n schema: NodeAttachQuerySchema\n}>\n","import type { Query } from '@xyo-network/payload-model'\n\nexport const NodeAttachedQuerySchema = 'network.xyo.query.node.attached' as const\nexport type NodeAttachedQuerySchema = typeof NodeAttachedQuerySchema\n\nexport type NodeAttachedQuery = Query<{\n schema: NodeAttachedQuerySchema\n}>\n","import type { ModuleIdentifier } from '@xyo-network/module-model'\nimport type { Query } from '@xyo-network/payload-model'\n\nexport const NodeCertifyQuerySchema = 'network.xyo.query.node.certify' as const\nexport type NodeCertifyQuerySchema = typeof NodeCertifyQuerySchema\n\nexport type NodeCertifyQuery = Query<{\n id: ModuleIdentifier\n schema: NodeCertifyQuerySchema\n}>\n","import type { ModuleIdentifier } from '@xyo-network/module-model'\nimport type { Query } from '@xyo-network/payload-model'\n\nexport const NodeDetachQuerySchema = 'network.xyo.query.node.detach' as const\nexport type NodeDetachQuerySchema = typeof NodeDetachQuerySchema\n\nexport type NodeDetachQuery = Query<{\n id: ModuleIdentifier\n schema: NodeDetachQuerySchema\n}>\n","import type { Query } from '@xyo-network/payload-model'\n\nexport const NodeRegisteredQuerySchema = 'network.xyo.query.node.registered' as const\nexport type NodeRegisteredQuerySchema = typeof NodeRegisteredQuerySchema\n\nexport type NodeRegisteredQuery = Query<{\n schema: NodeRegisteredQuerySchema\n}>\n","import type { TypeCheck } from '@xylabs/object'\nimport { IsObjectFactory } from '@xylabs/object'\nimport type { AttachableModuleInstance } from '@xyo-network/module-model'\n\nimport type { NodeInstance } from '../instance.ts'\nimport type { NodeModule, NodeModuleEventData } from '../Node.ts'\nimport type { NodeParams } from '../Params.ts'\n\nexport interface AttachableNodeInstance<TParams extends NodeParams = NodeParams, TEventData extends NodeModuleEventData = NodeModuleEventData>\n extends NodeModule<TParams, TEventData>,\n AttachableModuleInstance<TParams, TEventData>,\n NodeInstance<TParams, TEventData> {}\n\nexport type AttachableNodeInstanceTypeCheck<T extends AttachableNodeInstance = AttachableNodeInstance> = TypeCheck<T>\n\nexport class IsAttachableNodeInstanceFactory<T extends AttachableNodeInstance = AttachableNodeInstance> extends IsObjectFactory<T> {}\n","import type { Address } from '@xylabs/hex'\nimport type { Payload } from '@xyo-network/payload-model'\n\nexport const ChildCertificationSchema = 'network.xyo.child.certification' as const\nexport type ChildCertificationSchema = typeof ChildCertificationSchema\n\nexport interface ChildCertificationFields {\n address: Address\n expiration: number\n}\n\nexport type ChildCertification = Payload<ChildCertificationFields, ChildCertificationSchema>\n","import type { EmptyObject, WithAdditional } from '@xylabs/object'\nimport type { ModuleConfig } from '@xyo-network/module-model'\nimport type { Payload } from '@xyo-network/payload-model'\n\nexport const NodeConfigSchema = 'network.xyo.node.config' as const\nexport type NodeConfigSchema = typeof NodeConfigSchema\n\nexport type NodeConfig<TConfig extends EmptyObject | Payload | void = void, TSchema extends string | void = void> = ModuleConfig<\n WithAdditional<\n {\n archivist?: string\n },\n TConfig\n >,\n TSchema extends void\n ? TConfig extends Payload\n ? TConfig['schema']\n : NodeConfigSchema\n : TSchema\n>\n"],"mappings":";AAAA,SAAS,mBAAAA,wBAAuB;;;ACChC,SAAS,uBAAuB;AAEhC,SAAS,kCAAkC;;;ACF3C,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EAAmB;AAAA,EAAiB;AAAA,EAAkB;AAAA,OACjD;;;ACDA,IAAM,wBAAwB;;;ACD9B,IAAM,0BAA0B;;;ACChC,IAAM,yBAAyB;;;ACA/B,IAAM,wBAAwB;;;ACD9B,IAAM,4BAA4B;;;ALQzC,IAAM,kBAAkB,IAAI,kBAAgC;AAErD,IAAM,iBAA0C,gBAAgB;AAAA,EACrE;AAAA,IACE,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,YAAY;AAAA,EACd;AAAA,EACA,CAAC,gBAAgB;AACnB;AAEO,IAAM,eAAsC,IAAI,gBAA4B,EAAE,OAAO,CAAC,uBAAuB,CAAC;AAE9G,IAAM,eAAe,gBAAgB,OAAO,YAAY;AACxD,IAAM,iBAAiB,gBAAgB,OAAO,cAAc;AAC5D,IAAM,iBAAiB,YAAY,OAAO,YAAY;AACtD,IAAM,mBAAmB,YAAY,OAAO,cAAc;;;ADpB1D,IAAM,0CAA2D,CAAC;AAGzE,IAAM,UAAU,IAAI,gBAAwC;AAErD,IAAM,2BAA8D,QAAQ,OAAO,yCAAyC;AAAA,EACjI;AAAA,EACA;AACF,CAAC;;;ADZM,IAAM,2BAA2BC,iBAAgB,OAAO,wBAAwB;;;AQHvF,SAAS,mBAAAC,wBAAuB;AAczB,IAAM,kCAAN,cAAyGA,iBAAmB;AAAC;;;ACZ7H,IAAM,2BAA2B;;;ACCjC,IAAM,mBAAmB;","names":["AsObjectFactory","AsObjectFactory","IsObjectFactory"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/node-model",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -21,25 +21,25 @@
|
|
|
21
21
|
"type": "module",
|
|
22
22
|
"exports": {
|
|
23
23
|
".": {
|
|
24
|
-
"types": "./dist/
|
|
24
|
+
"types": "./dist/neutral/index.d.ts",
|
|
25
25
|
"default": "./dist/neutral/index.mjs"
|
|
26
26
|
},
|
|
27
27
|
"./package.json": "./package.json"
|
|
28
28
|
},
|
|
29
29
|
"module": "dist/neutral/index.mjs",
|
|
30
|
-
"types": "dist/
|
|
30
|
+
"types": "dist/neutral/index.d.ts",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@xylabs/events": "^4.13.
|
|
33
|
-
"@xylabs/hex": "^4.13.
|
|
34
|
-
"@xylabs/object": "^4.13.
|
|
35
|
-
"@xylabs/typeof": "^4.13.
|
|
36
|
-
"@xyo-network/account-model": "^4.0
|
|
37
|
-
"@xyo-network/module-model": "^4.0
|
|
38
|
-
"@xyo-network/payload-model": "^4.0
|
|
32
|
+
"@xylabs/events": "^4.13.15",
|
|
33
|
+
"@xylabs/hex": "^4.13.15",
|
|
34
|
+
"@xylabs/object": "^4.13.15",
|
|
35
|
+
"@xylabs/typeof": "^4.13.15",
|
|
36
|
+
"@xyo-network/account-model": "^4.1.0",
|
|
37
|
+
"@xyo-network/module-model": "^4.1.0",
|
|
38
|
+
"@xyo-network/payload-model": "^4.1.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@xylabs/ts-scripts-yarn3": "^
|
|
42
|
-
"@xylabs/tsconfig": "^
|
|
41
|
+
"@xylabs/ts-scripts-yarn3": "^7.0.0-rc.20",
|
|
42
|
+
"@xylabs/tsconfig": "^7.0.0-rc.20",
|
|
43
43
|
"typescript": "^5.8.3"
|
|
44
44
|
},
|
|
45
45
|
"publishConfig": {
|
package/src/typeChecks.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TypeCheck } from '@xylabs/object'
|
|
1
2
|
import { AsObjectFactory } from '@xylabs/object'
|
|
2
3
|
import {
|
|
3
4
|
IsInstanceFactory, IsModuleFactory, isModuleInstance, WithFactory,
|
|
@@ -9,7 +10,7 @@ import { NodeAttachedQuerySchema } from './Queries/index.ts'
|
|
|
9
10
|
|
|
10
11
|
const instanceFactory = new IsInstanceFactory<NodeInstance>()
|
|
11
12
|
|
|
12
|
-
export const isNodeInstance = instanceFactory.create(
|
|
13
|
+
export const isNodeInstance: TypeCheck<NodeInstance> = instanceFactory.create(
|
|
13
14
|
{
|
|
14
15
|
attach: 'function',
|
|
15
16
|
attached: 'function',
|
|
@@ -20,9 +21,7 @@ export const isNodeInstance = instanceFactory.create(
|
|
|
20
21
|
[isModuleInstance],
|
|
21
22
|
)
|
|
22
23
|
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
export const isNodeModule = moduleFactory.create([NodeAttachedQuerySchema])
|
|
24
|
+
export const isNodeModule: TypeCheck<NodeModule> = new IsModuleFactory<NodeModule>().create([NodeAttachedQuerySchema])
|
|
26
25
|
|
|
27
26
|
export const asNodeModule = AsObjectFactory.create(isNodeModule)
|
|
28
27
|
export const asNodeInstance = AsObjectFactory.create(isNodeInstance)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typeChecks.d.ts","sourceRoot":"","sources":["../../src/typeChecks.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAK3C,eAAO,MAAM,cAAc,oNAS1B,CAAA;AAID,eAAO,MAAM,YAAY,mOAAkD,CAAA;AAE3E,eAAO,MAAM,YAAY,uNAAuC,CAAA;AAChE,eAAO,MAAM,cAAc,yNAAyC,CAAA;AACpE,eAAO,MAAM,cAAc,mOAAmC,CAAA;AAC9D,eAAO,MAAM,gBAAgB,qOAAqC,CAAA"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|