@xyo-network/module-model 2.84.18 → 2.85.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/browser/Config.d.cts +1 -1
- package/dist/browser/Config.d.cts.map +1 -1
- package/dist/browser/Config.d.mts +1 -1
- package/dist/browser/Config.d.mts.map +1 -1
- package/dist/browser/Config.d.ts +1 -1
- package/dist/browser/Config.d.ts.map +1 -1
- package/dist/browser/ModuleParams.d.cts +0 -2
- package/dist/browser/ModuleParams.d.cts.map +1 -1
- package/dist/browser/ModuleParams.d.mts +0 -2
- package/dist/browser/ModuleParams.d.mts.map +1 -1
- package/dist/browser/ModuleParams.d.ts +0 -2
- package/dist/browser/ModuleParams.d.ts.map +1 -1
- package/dist/browser/index.cjs +104 -65
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.js +106 -65
- package/dist/browser/index.js.map +1 -1
- package/dist/node/Config.d.cts +1 -1
- package/dist/node/Config.d.cts.map +1 -1
- package/dist/node/Config.d.mts +1 -1
- package/dist/node/Config.d.mts.map +1 -1
- package/dist/node/Config.d.ts +1 -1
- package/dist/node/Config.d.ts.map +1 -1
- package/dist/node/ModuleParams.d.cts +0 -2
- package/dist/node/ModuleParams.d.cts.map +1 -1
- package/dist/node/ModuleParams.d.mts +0 -2
- package/dist/node/ModuleParams.d.mts.map +1 -1
- package/dist/node/ModuleParams.d.ts +0 -2
- package/dist/node/ModuleParams.d.ts.map +1 -1
- package/dist/node/index.cjs +104 -69
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.js +106 -69
- package/dist/node/index.js.map +1 -1
- package/package.json +8 -9
- package/src/Config.ts +1 -1
- package/src/ModuleParams.ts +0 -2
package/dist/node/index.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
1
4
|
// src/Config.ts
|
|
2
5
|
var ModuleConfigSchema = "network.xyo.module.config";
|
|
3
6
|
|
|
@@ -7,35 +10,39 @@ function creatableModule() {
|
|
|
7
10
|
constructor;
|
|
8
11
|
};
|
|
9
12
|
}
|
|
13
|
+
__name(creatableModule, "creatableModule");
|
|
10
14
|
|
|
11
15
|
// src/CreatableModule/CreatableModuleRegistry.ts
|
|
12
|
-
var toCreatableModuleRegistry = (dict) => {
|
|
16
|
+
var toCreatableModuleRegistry = /* @__PURE__ */ __name((dict) => {
|
|
13
17
|
return Object.entries(dict).reduce((registry, [schema, factory4]) => {
|
|
14
|
-
registry[schema] = Array.isArray(factory4) ? factory4 : [
|
|
18
|
+
registry[schema] = Array.isArray(factory4) ? factory4 : [
|
|
19
|
+
factory4
|
|
20
|
+
];
|
|
15
21
|
return registry;
|
|
16
22
|
}, {});
|
|
17
|
-
};
|
|
18
|
-
var assignCreatableModuleRegistry = (target = {}, ...sources) => {
|
|
19
|
-
sources.map(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
}, "toCreatableModuleRegistry");
|
|
24
|
+
var assignCreatableModuleRegistry = /* @__PURE__ */ __name((target = {}, ...sources) => {
|
|
25
|
+
sources.map((source) => Object.entries(source).map(([schema, factories]) => {
|
|
26
|
+
if (factories) {
|
|
27
|
+
const existingFactories = target[schema];
|
|
28
|
+
target[schema] = existingFactories ? target[schema] = [
|
|
29
|
+
...existingFactories,
|
|
30
|
+
...factories
|
|
31
|
+
] : factories;
|
|
32
|
+
}
|
|
33
|
+
}));
|
|
27
34
|
return target;
|
|
28
|
-
};
|
|
35
|
+
}, "assignCreatableModuleRegistry");
|
|
29
36
|
|
|
30
37
|
// src/CreatableModule/LabeledCreatableModuleFactory.ts
|
|
31
|
-
var hasLabels = (factory4) => {
|
|
38
|
+
var hasLabels = /* @__PURE__ */ __name((factory4) => {
|
|
32
39
|
return factory4.labels !== void 0;
|
|
33
|
-
};
|
|
40
|
+
}, "hasLabels");
|
|
34
41
|
|
|
35
42
|
// src/CreatableModule/ModuleFactory.ts
|
|
36
43
|
import { assertEx } from "@xylabs/assert";
|
|
37
44
|
import { merge } from "@xylabs/lodash";
|
|
38
|
-
var
|
|
45
|
+
var _ModuleFactory = class _ModuleFactory {
|
|
39
46
|
configSchemas;
|
|
40
47
|
creatableModule;
|
|
41
48
|
defaultLogger;
|
|
@@ -70,7 +77,9 @@ var ModuleFactory = class _ModuleFactory {
|
|
|
70
77
|
const factory4 = this;
|
|
71
78
|
const schema = factory4.creatableModule.configSchema;
|
|
72
79
|
const mergedParams = merge({}, factory4.defaultParams, params, {
|
|
73
|
-
config: merge({}, (_a = factory4.defaultParams) == null ? void 0 : _a.config, params == null ? void 0 : params.config, {
|
|
80
|
+
config: merge({}, (_a = factory4.defaultParams) == null ? void 0 : _a.config, params == null ? void 0 : params.config, {
|
|
81
|
+
schema
|
|
82
|
+
})
|
|
74
83
|
});
|
|
75
84
|
return factory4.creatableModule.create(mergedParams);
|
|
76
85
|
}
|
|
@@ -78,36 +87,39 @@ var ModuleFactory = class _ModuleFactory {
|
|
|
78
87
|
throw new Error("Method not implemented.");
|
|
79
88
|
}
|
|
80
89
|
};
|
|
90
|
+
__name(_ModuleFactory, "ModuleFactory");
|
|
91
|
+
var ModuleFactory = _ModuleFactory;
|
|
81
92
|
|
|
82
93
|
// src/CreatableModule/ModuleFactoryLocator.ts
|
|
83
94
|
import { assertEx as assertEx2 } from "@xylabs/assert";
|
|
84
95
|
|
|
85
96
|
// src/Labels/Labels.ts
|
|
86
|
-
var hasAllLabels = (source, required) => {
|
|
97
|
+
var hasAllLabels = /* @__PURE__ */ __name((source, required) => {
|
|
87
98
|
if (!required)
|
|
88
99
|
return true;
|
|
89
100
|
return Object.entries(required).every(([key, value]) => {
|
|
90
101
|
return (source == null ? void 0 : source.hasOwnProperty(key)) && (source == null ? void 0 : source[key]) === value;
|
|
91
102
|
});
|
|
92
|
-
};
|
|
103
|
+
}, "hasAllLabels");
|
|
93
104
|
|
|
94
105
|
// src/CreatableModule/ModuleFactoryLocator.ts
|
|
95
|
-
var
|
|
106
|
+
var _ModuleFactoryLocator = class _ModuleFactoryLocator {
|
|
107
|
+
_registry;
|
|
96
108
|
constructor(_registry = {}) {
|
|
97
109
|
this._registry = _registry;
|
|
98
110
|
}
|
|
99
111
|
/**
|
|
100
|
-
|
|
101
|
-
|
|
112
|
+
* The current registry for the module factory
|
|
113
|
+
*/
|
|
102
114
|
get registry() {
|
|
103
115
|
return this._registry;
|
|
104
116
|
}
|
|
105
117
|
/**
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
118
|
+
* Locates a module factory that matches the supplied schema and labels
|
|
119
|
+
* @param schema The config schema for the module
|
|
120
|
+
* @param labels The labels for the module factory
|
|
121
|
+
* @returns A module factory that matches the supplied schema and labels or throws if one is not found
|
|
122
|
+
*/
|
|
111
123
|
locate(schema, labels) {
|
|
112
124
|
return assertEx2(this.tryLocate(schema, labels), () => {
|
|
113
125
|
const configString = `config schema [${schema}]`;
|
|
@@ -116,9 +128,9 @@ var ModuleFactoryLocator = class {
|
|
|
116
128
|
});
|
|
117
129
|
}
|
|
118
130
|
/**
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
131
|
+
* Registers a single module factory (with optional tags) with the locator
|
|
132
|
+
* @param additional Additional module factories to register
|
|
133
|
+
*/
|
|
122
134
|
register(mod, labels) {
|
|
123
135
|
mod.configSchemas.map((schema) => {
|
|
124
136
|
const existingFactories = this._registry[schema];
|
|
@@ -130,40 +142,44 @@ var ModuleFactoryLocator = class {
|
|
|
130
142
|
// Merge module & supplied labels
|
|
131
143
|
labels: Object.assign({}, mod.labels ?? {}, labels ?? {})
|
|
132
144
|
};
|
|
133
|
-
this._registry[schema] = existingFactories ? [
|
|
145
|
+
this._registry[schema] = existingFactories ? [
|
|
146
|
+
...existingFactories,
|
|
147
|
+
factory4
|
|
148
|
+
] : [
|
|
149
|
+
factory4
|
|
150
|
+
];
|
|
134
151
|
});
|
|
135
152
|
return this;
|
|
136
153
|
}
|
|
137
154
|
/**
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
155
|
+
* Registers multiple module factories with the locator
|
|
156
|
+
* @param additional Additional module factories to register
|
|
157
|
+
*/
|
|
141
158
|
registerMany(additional) {
|
|
142
159
|
Object.entries(additional).map(([schema, factories]) => {
|
|
143
160
|
if (factories) {
|
|
144
161
|
const existingFactories = this._registry[schema];
|
|
145
|
-
this._registry[schema] = existingFactories ? [
|
|
162
|
+
this._registry[schema] = existingFactories ? [
|
|
163
|
+
...existingFactories,
|
|
164
|
+
...factories
|
|
165
|
+
] : factories;
|
|
146
166
|
}
|
|
147
167
|
});
|
|
148
168
|
return this;
|
|
149
169
|
}
|
|
150
170
|
/**
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
171
|
+
* Tries to locate a module factory that matches the supplied schema and labels
|
|
172
|
+
* @param schema The config schema for the module
|
|
173
|
+
* @param labels The labels for the module factory
|
|
174
|
+
* @returns A module factory that matches the supplied schema and labels or undefined
|
|
175
|
+
*/
|
|
156
176
|
tryLocate(schema, labels) {
|
|
157
177
|
var _a, _b;
|
|
158
|
-
return labels ? (
|
|
159
|
-
// Find the first factory that has labels and has all the labels provided
|
|
160
|
-
(_a = this._registry[schema]) == null ? void 0 : _a.filter(hasLabels).find((factory4) => hasAllLabels(factory4 == null ? void 0 : factory4.labels, labels))
|
|
161
|
-
) : (
|
|
162
|
-
// Otherwise, return the first factory
|
|
163
|
-
(_b = this._registry[schema]) == null ? void 0 : _b[0]
|
|
164
|
-
);
|
|
178
|
+
return labels ? (_a = this._registry[schema]) == null ? void 0 : _a.filter(hasLabels).find((factory4) => hasAllLabels(factory4 == null ? void 0 : factory4.labels, labels)) : (_b = this._registry[schema]) == null ? void 0 : _b[0];
|
|
165
179
|
}
|
|
166
180
|
};
|
|
181
|
+
__name(_ModuleFactoryLocator, "ModuleFactoryLocator");
|
|
182
|
+
var ModuleFactoryLocator = _ModuleFactoryLocator;
|
|
167
183
|
|
|
168
184
|
// src/instance/asModuleInstance.ts
|
|
169
185
|
import { AsObjectFactory as AsObjectFactory3 } from "@xyo-network/object";
|
|
@@ -216,7 +232,7 @@ var isModuleObject = factory.create(requiredModuleShape);
|
|
|
216
232
|
var asModuleObject = AsObjectFactory.create(isModuleObject);
|
|
217
233
|
|
|
218
234
|
// src/module/IsModuleFactory.ts
|
|
219
|
-
var
|
|
235
|
+
var _IsModuleFactory = class _IsModuleFactory {
|
|
220
236
|
create(expectedQueries, additionalChecks) {
|
|
221
237
|
return (obj, config) => {
|
|
222
238
|
const module = asModuleObject(obj);
|
|
@@ -226,6 +242,8 @@ var IsModuleFactory = class {
|
|
|
226
242
|
};
|
|
227
243
|
}
|
|
228
244
|
};
|
|
245
|
+
__name(_IsModuleFactory, "IsModuleFactory");
|
|
246
|
+
var IsModuleFactory = _IsModuleFactory;
|
|
229
247
|
|
|
230
248
|
// src/module/isModule.ts
|
|
231
249
|
var requiredModuleQueries = [
|
|
@@ -233,11 +251,11 @@ var requiredModuleQueries = [
|
|
|
233
251
|
//ModuleDescribeQuerySchema,
|
|
234
252
|
//ModuleAddressQuerySchema,
|
|
235
253
|
ModuleDiscoverQuerySchema
|
|
236
|
-
//ModuleManifestQuerySchema,
|
|
237
|
-
//ModuleSubscribeQuerySchema,
|
|
238
254
|
];
|
|
239
255
|
var factory2 = new IsModuleFactory();
|
|
240
|
-
var isModule = factory2.create(requiredModuleQueries, [
|
|
256
|
+
var isModule = factory2.create(requiredModuleQueries, [
|
|
257
|
+
isModuleObject
|
|
258
|
+
]);
|
|
241
259
|
|
|
242
260
|
// src/module/asModule.ts
|
|
243
261
|
var asModule = AsObjectFactory2.create(isModule);
|
|
@@ -250,50 +268,69 @@ var requiredModuleInstanceFunctions = {
|
|
|
250
268
|
moduleAddress: "function"
|
|
251
269
|
};
|
|
252
270
|
var factory3 = new IsObjectFactory2();
|
|
253
|
-
var isModuleInstance = factory3.create(requiredModuleInstanceFunctions, [
|
|
271
|
+
var isModuleInstance = factory3.create(requiredModuleInstanceFunctions, [
|
|
272
|
+
isModule
|
|
273
|
+
]);
|
|
254
274
|
|
|
255
275
|
// src/instance/asModuleInstance.ts
|
|
256
276
|
var asModuleInstance = AsObjectFactory3.create(isModuleInstance);
|
|
257
277
|
|
|
258
278
|
// src/instance/ModuleInstance.ts
|
|
259
279
|
import { IsObjectFactory as IsObjectFactory3 } from "@xyo-network/object";
|
|
260
|
-
var
|
|
280
|
+
var _IsInstanceFactory = class _IsInstanceFactory extends IsObjectFactory3 {
|
|
261
281
|
};
|
|
282
|
+
__name(_IsInstanceFactory, "IsInstanceFactory");
|
|
283
|
+
var IsInstanceFactory = _IsInstanceFactory;
|
|
262
284
|
|
|
263
285
|
// src/lib/duplicateModules.ts
|
|
264
|
-
var duplicateModules = (value, index, array) => {
|
|
286
|
+
var duplicateModules = /* @__PURE__ */ __name((value, index, array) => {
|
|
265
287
|
return array.findIndex((v) => v.address === value.address) === index;
|
|
266
|
-
};
|
|
288
|
+
}, "duplicateModules");
|
|
267
289
|
|
|
268
290
|
// src/lib/serializable.ts
|
|
269
291
|
import { every, isArray, isBoolean, isNull, isNumber, isPlainObject, isString, isUndefined, overSome } from "@xylabs/lodash";
|
|
270
|
-
var JSONPrimitiveChecks = [
|
|
271
|
-
|
|
272
|
-
|
|
292
|
+
var JSONPrimitiveChecks = [
|
|
293
|
+
isUndefined,
|
|
294
|
+
isNull,
|
|
295
|
+
isBoolean,
|
|
296
|
+
isNumber,
|
|
297
|
+
isString
|
|
298
|
+
];
|
|
299
|
+
var JSONComplexChecks = [
|
|
300
|
+
isPlainObject,
|
|
301
|
+
isArray
|
|
302
|
+
];
|
|
303
|
+
var serializable = /* @__PURE__ */ __name((field, depth) => {
|
|
273
304
|
let depthExceeded = false;
|
|
274
|
-
const decrementDepth = () => depth ? depth-- : void 0;
|
|
275
|
-
const recursiveSerializable = (field2) => {
|
|
305
|
+
const decrementDepth = /* @__PURE__ */ __name(() => depth ? depth-- : void 0, "decrementDepth");
|
|
306
|
+
const recursiveSerializable = /* @__PURE__ */ __name((field2) => {
|
|
276
307
|
if (depth !== void 0 && depth < 1) {
|
|
277
308
|
depthExceeded = true;
|
|
278
309
|
return false;
|
|
279
310
|
}
|
|
280
311
|
decrementDepth();
|
|
281
|
-
const nestedSerializable = (field3) => overSome(JSONComplexChecks)(field3) && every(field3, recursiveSerializable);
|
|
282
|
-
return overSome([
|
|
283
|
-
|
|
312
|
+
const nestedSerializable = /* @__PURE__ */ __name((field3) => overSome(JSONComplexChecks)(field3) && every(field3, recursiveSerializable), "nestedSerializable");
|
|
313
|
+
return overSome([
|
|
314
|
+
...JSONPrimitiveChecks,
|
|
315
|
+
nestedSerializable
|
|
316
|
+
])(field2);
|
|
317
|
+
}, "recursiveSerializable");
|
|
284
318
|
const valid = recursiveSerializable(field);
|
|
285
319
|
return depthExceeded ? null : valid;
|
|
286
|
-
};
|
|
287
|
-
var serializableField = (field) => {
|
|
288
|
-
return overSome([
|
|
289
|
-
|
|
320
|
+
}, "serializable");
|
|
321
|
+
var serializableField = /* @__PURE__ */ __name((field) => {
|
|
322
|
+
return overSome([
|
|
323
|
+
...JSONPrimitiveChecks,
|
|
324
|
+
...JSONComplexChecks
|
|
325
|
+
])(field);
|
|
326
|
+
}, "serializableField");
|
|
290
327
|
|
|
291
328
|
// src/Payload/ModuleState.ts
|
|
292
329
|
import { isPayloadOfSchemaType } from "@xyo-network/payload-model";
|
|
293
330
|
var ModuleStateSchema = "network.xyo.module.state";
|
|
294
|
-
var isModuleState = (payload) => {
|
|
331
|
+
var isModuleState = /* @__PURE__ */ __name((payload) => {
|
|
295
332
|
return isPayloadOfSchemaType(ModuleStateSchema)(payload);
|
|
296
|
-
};
|
|
333
|
+
}, "isModuleState");
|
|
297
334
|
|
|
298
335
|
// src/withModule.ts
|
|
299
336
|
var WithFactory = {
|
package/dist/node/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Config.ts","../../src/CreatableModule/CreatableModule.ts","../../src/CreatableModule/CreatableModuleRegistry.ts","../../src/CreatableModule/LabeledCreatableModuleFactory.ts","../../src/CreatableModule/ModuleFactory.ts","../../src/CreatableModule/ModuleFactoryLocator.ts","../../src/Labels/Labels.ts","../../src/instance/asModuleInstance.ts","../../src/instance/isModuleInstance.ts","../../src/module/asModule.ts","../../src/Queries/Describe/Payload.ts","../../src/Queries/Describe/Query.ts","../../src/Queries/Discover.ts","../../src/Queries/Manifest.ts","../../src/Queries/ModuleAddress/Payload.ts","../../src/Queries/ModuleAddress/Query.ts","../../src/Queries/Subscribe.ts","../../src/module/asModuleObject.ts","../../src/module/isModuleObject.ts","../../src/module/IsModuleFactory.ts","../../src/module/isModule.ts","../../src/instance/ModuleInstance.ts","../../src/lib/duplicateModules.ts","../../src/lib/serializable.ts","../../src/Payload/ModuleState.ts","../../src/withModule.ts"],"sourcesContent":["import { Address } from '@xylabs/hex'\nimport { EmptyObject, WithAdditional } from '@xyo-network/object'\nimport { Payload, Schema } from '@xyo-network/payload-model'\n\nimport { Labels } from './Labels'\n\nexport type ModuleConfigSchema = 'network.xyo.module.config'\nexport const ModuleConfigSchema: ModuleConfigSchema = 'network.xyo.module.config'\n\nexport type CosigningAddressSet = string[]\nexport type SchemaString = string\nexport type ModuleName = string\nexport type NameOrAddress = Address | ModuleName\n\nexport interface ArchivingModuleConfig {\n readonly archiving?: {\n readonly archivists?: NameOrAddress[]\n }\n}\n\nexport type ModuleConfig<TConfig extends EmptyObject | Payload | void = void, TSchema extends Schema | void = void> = Payload<\n WithAdditional<\n {\n /** @field The path to use when creating the account */\n accountDerivationPath?: string\n\n /** @field The name/address of the Archivist to use for this module */\n readonly archivist?: NameOrAddress\n\n /**\n * @field The labels used for this module. If a label is specified, then the\n * ModuleFactoryLocator will attempt to find a ModuleFactory with the corresponding\n * labels to construct this module.\n */\n readonly labels?: Labels\n\n /** @field Friendly name of module (not collision resistent). Can be used to resolve module when registered/attached to Node. */\n readonly name?: string\n\n /** @field paging settings for queries */\n readonly paging?: Record<string, { size?: number }>\n\n schema: TConfig extends Payload ? TConfig['schema'] : ModuleConfigSchema\n\n /** @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. */\n readonly security?: {\n /** @field Will the module process queries that have unsigned BoundWitness in query tuples */\n readonly allowAnonymous?: boolean\n\n /** @field If schema in record, then only these address sets can access query */\n readonly allowed?: Record<SchemaString, (Address | CosigningAddressSet)[]>\n\n /** @field If schema in record, then anyone except these addresses can access query */\n readonly disallowed?: Record<SchemaString, Address[]>\n }\n\n /** @field sign every query */\n readonly sign?: boolean\n\n /** @field Store the queries made to the module in an archivist if possible */\n readonly storeQueries?: boolean\n\n /** @field add a timestamp payload to every query */\n readonly timestamp?: boolean\n } & ArchivingModuleConfig,\n TConfig\n >,\n TSchema\n>\n\nexport type AnyConfigSchema<TConfig extends Omit<ModuleConfig, 'schema'> & { schema: string } = Omit<ModuleConfig, 'schema'> & { schema: string }> =\n ModuleConfig<TConfig, string>\n\nexport type OptionalConfigSchema<TConfig extends AnyConfigSchema<ModuleConfig> = AnyConfigSchema<ModuleConfig>> = Omit<TConfig, 'schema'> & {\n schema?: TConfig['schema']\n}\n\nexport type AnyModuleConfig = AnyConfigSchema<ModuleConfig>\n","import { Logger } from '@xylabs/logger'\nimport { AccountInstance } from '@xyo-network/account-model'\n\nimport { ModuleInstance } from '../instance'\n\nexport type CreatableModuleFactory<T extends ModuleInstance = ModuleInstance> = Omit<Omit<CreatableModule<T>, 'new'>, 'create'> & {\n create<T extends ModuleInstance>(this: CreatableModuleFactory<T>, params?: T['params']): Promise<T>\n}\n\nexport interface CreatableModule<T extends ModuleInstance = ModuleInstance> {\n configSchema: string\n configSchemas: string[]\n defaultLogger?: Logger\n new (privateConstructorKey: string, params: T['params'], account: AccountInstance): T\n _noOverride(functionName: string): void\n create<T extends ModuleInstance>(this: CreatableModule<T>, params?: T['params']): Promise<T>\n factory<T extends ModuleInstance>(this: CreatableModule<T>, params?: T['params']): CreatableModuleFactory<T>\n}\n\n/**\n * Class annotation to be used to decorate Modules which support\n * an asynchronous creation pattern\n * @returns The decorated Module requiring it implement the members\n * of the CreatableModule as statics properties/methods\n */\nexport function creatableModule<TModule extends ModuleInstance = ModuleInstance>() {\n return <U extends CreatableModule<TModule>>(constructor: U) => {\n constructor\n }\n}\n","import { CreatableModuleFactory } from './CreatableModule'\nimport { CreatableModuleDictionary } from './CreatableModuleDictionary'\nimport { LabeledCreatableModuleFactory } from './LabeledCreatableModuleFactory'\n\nexport interface CreatableModuleRegistry {\n [key: string]: (CreatableModuleFactory | LabeledCreatableModuleFactory)[] | undefined\n}\n\nexport const toCreatableModuleRegistry = (dict: CreatableModuleDictionary | CreatableModuleRegistry): CreatableModuleRegistry => {\n // eslint-disable-next-line unicorn/no-array-reduce\n return Object.entries(dict).reduce((registry, [schema, factory]) => {\n registry[schema] = Array.isArray(factory) ? factory : [factory]\n return registry\n }, {} as CreatableModuleRegistry)\n}\n\nexport const assignCreatableModuleRegistry = (\n target: CreatableModuleRegistry = {},\n ...sources: CreatableModuleRegistry[]\n): CreatableModuleRegistry => {\n sources.map((source) =>\n Object.entries(source).map(([schema, factories]) => {\n if (factories) {\n const existingFactories = target[schema]\n target[schema] = existingFactories ? (target[schema] = [...existingFactories, ...factories]) : factories\n }\n }),\n )\n return target\n}\n","import { ModuleInstance } from '../instance'\nimport { WithOptionalLabels } from '../Labels'\nimport { CreatableModuleFactory } from './CreatableModule'\n\nexport type LabeledCreatableModuleFactory<T extends ModuleInstance = ModuleInstance> = CreatableModuleFactory<T> & WithOptionalLabels\n\nexport const hasLabels = (factory: CreatableModuleFactory | LabeledCreatableModuleFactory): factory is LabeledCreatableModuleFactory => {\n return (factory as LabeledCreatableModuleFactory).labels !== undefined\n}\n","import { assertEx } from '@xylabs/assert'\nimport { merge } from '@xylabs/lodash'\nimport { Logger } from '@xylabs/logger'\n\nimport { ModuleInstance } from '../instance'\nimport { Labels, WithOptionalLabels } from '../Labels'\nimport { CreatableModule, CreatableModuleFactory } from './CreatableModule'\n\nexport class ModuleFactory<TModule extends ModuleInstance> implements CreatableModuleFactory<TModule> {\n configSchemas: CreatableModuleFactory<TModule>['configSchemas']\n\n creatableModule: CreatableModule<TModule>\n\n defaultLogger?: Logger | undefined\n\n defaultParams?: Omit<TModule['params'], 'config'> & { config?: Partial<TModule['params']['config']> }\n\n labels?: Labels\n\n constructor(\n creatableModule: CreatableModule<TModule>,\n params?: Omit<TModule['params'], 'config'> & { config?: Partial<TModule['params']['config']> },\n labels: Labels = {},\n ) {\n this.creatableModule = creatableModule\n this.defaultParams = params\n this.configSchemas = creatableModule.configSchemas\n this.labels = Object.assign({}, (creatableModule as WithOptionalLabels).labels ?? {}, labels ?? {})\n }\n\n get configSchema(): string {\n return this.configSchemas[0]\n }\n\n static withParams<T extends ModuleInstance>(\n creatableModule: CreatableModule<T>,\n params?: Omit<T['params'], 'config'> & { config?: T['params']['config'] },\n labels: Labels = {},\n ) {\n return new ModuleFactory(creatableModule, params, labels)\n }\n\n _getRootFunction(funcName: string) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let anyThis = this as any\n while (anyThis.__proto__[funcName]) {\n anyThis = anyThis.__proto__\n }\n return anyThis[funcName]\n }\n\n _noOverride(functionName: string) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const thisFunc = (this as any)[functionName]\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const rootFunc = this._getRootFunction(functionName)\n assertEx(thisFunc === rootFunc, `Override not allowed for [${functionName}] - override ${functionName}Handler instead`)\n }\n\n create<T extends ModuleInstance>(this: CreatableModuleFactory<T>, params?: TModule['params'] | undefined): Promise<T> {\n const factory = this as ModuleFactory<T>\n const schema = factory.creatableModule.configSchema\n const mergedParams: TModule['params'] = merge({}, factory.defaultParams, params, {\n config: merge({}, factory.defaultParams?.config, params?.config, { schema }),\n })\n return factory.creatableModule.create<T>(mergedParams)\n }\n\n factory<T extends ModuleInstance>(this: CreatableModule<T>, _params?: T['params'] | undefined): CreatableModuleFactory<T> {\n throw new Error('Method not implemented.')\n }\n}\n","import { assertEx } from '@xylabs/assert'\n\nimport { ModuleInstance } from '../instance'\nimport { hasAllLabels, Labels } from '../Labels'\nimport { CreatableModuleFactory } from './CreatableModule'\nimport { CreatableModuleRegistry } from './CreatableModuleRegistry'\nimport { hasLabels, LabeledCreatableModuleFactory } from './LabeledCreatableModuleFactory'\n\n/**\n * A class which encapsulates the Service Locator Pattern for Module Factories\n */\nexport class ModuleFactoryLocator {\n constructor(protected readonly _registry: CreatableModuleRegistry = {}) {}\n\n /**\n * The current registry for the module factory\n */\n get registry(): Readonly<CreatableModuleRegistry> {\n return this._registry\n }\n\n /**\n * Locates a module factory that matches the supplied schema and labels\n * @param schema The config schema for the module\n * @param labels The labels for the module factory\n * @returns A module factory that matches the supplied schema and labels or throws if one is not found\n */\n locate(schema: string, labels?: Labels): CreatableModuleFactory | LabeledCreatableModuleFactory {\n return assertEx(this.tryLocate(schema, labels), () => {\n const configString = `config schema [${schema}]`\n const labelsString = labels ? ` & labels [${JSON.stringify(labels)}]` : ''\n return `No module factory for the supplied ${configString}${labelsString} registered`\n })\n }\n\n /**\n * Registers a single module factory (with optional tags) with the locator\n * @param additional Additional module factories to register\n */\n register<TModule extends ModuleInstance>(mod: CreatableModuleFactory<TModule>, labels?: Labels): this {\n mod.configSchemas.map((schema) => {\n const existingFactories = this._registry[schema]\n const factory: LabeledCreatableModuleFactory<TModule> = {\n // Destructure instance properties\n ...mod,\n // Copy static methods\n create: mod.create.bind(mod) as LabeledCreatableModuleFactory<TModule>['create'],\n // Merge module & supplied labels\n labels: Object.assign({}, (mod as LabeledCreatableModuleFactory).labels ?? {}, labels ?? {}),\n }\n this._registry[schema] = existingFactories ? [...existingFactories, factory] : [factory]\n })\n return this\n }\n\n /**\n * Registers multiple module factories with the locator\n * @param additional Additional module factories to register\n */\n registerMany(additional: CreatableModuleRegistry): this {\n Object.entries(additional).map(([schema, factories]) => {\n if (factories) {\n const existingFactories = this._registry[schema]\n this._registry[schema] = existingFactories ? [...existingFactories, ...factories] : factories\n }\n })\n return this\n }\n\n /**\n * Tries to locate a module factory that matches the supplied schema and labels\n * @param schema The config schema for the module\n * @param labels The labels for the module factory\n * @returns A module factory that matches the supplied schema and labels or undefined\n */\n tryLocate(schema: string, labels?: Labels): CreatableModuleFactory | LabeledCreatableModuleFactory | undefined {\n // If labels were provided\n return labels\n ? // Find the first factory that has labels and has all the labels provided\n this._registry[schema]?.filter(hasLabels).find((factory) => hasAllLabels(factory?.labels, labels))\n : // Otherwise, return the first factory\n this._registry[schema]?.[0]\n }\n}\n","/**\n * Object used to represent labels identifying a resource.\n */\nexport interface Labels {\n [key: string]: string | undefined\n}\n\n/**\n * Interface for objects that have labels.\n */\nexport interface WithLabels<T extends Labels = Labels> {\n labels: T\n}\n\n/**\n * Interface for objects that have labels.\n */\nexport interface WithOptionalLabels<T extends Labels = Labels> {\n labels?: T\n}\n\n/**\n * Returns true if the source object has all the labels from the required set\n * @param source Source object to check against\n * @param required Set of labels to check for in source\n * @returns True of the source object has all the labels from the required set\n */\nexport const hasAllLabels = (source?: Labels, required?: Labels): boolean => {\n if (!required) return true\n return Object.entries(required).every(([key, value]) => {\n // eslint-disable-next-line no-prototype-builtins\n return source?.hasOwnProperty(key as keyof typeof source) && source?.[key as keyof typeof source] === value\n })\n}\n","import { AsObjectFactory } from '@xyo-network/object'\n\nimport { isModuleInstance } from './isModuleInstance'\n\nexport const asModuleInstance = AsObjectFactory.create(isModuleInstance)\n","import { IsObjectFactory, ObjectTypeShape, TypeCheck } from '@xyo-network/object'\n\nimport { isModule } from '../module'\nimport { ModuleInstance } from './ModuleInstance'\n\nexport const requiredModuleInstanceFunctions: ObjectTypeShape = {\n describe: 'function',\n discover: 'function',\n manifest: 'function',\n moduleAddress: 'function',\n}\n\n//we do not use IsInstanceFactory here to prevent a cycle\nconst factory = new IsObjectFactory<ModuleInstance>()\n\nexport const isModuleInstance: TypeCheck<ModuleInstance> = factory.create(requiredModuleInstanceFunctions, [isModule])\n","import { AsObjectFactory } from '@xyo-network/object'\n\nimport { isModule } from './isModule'\n\nexport const asModule = AsObjectFactory.create(isModule)\n","import { Payload } from '@xyo-network/payload-model'\n\nimport { ModuleDescription } from '../../ModuleDescription'\n\nexport const ModuleDescriptionSchema = 'network.xyo.module.description'\nexport type ModuleDescriptionSchema = typeof ModuleDescriptionSchema\n\nexport type ModuleDescriptionPayload = Payload<ModuleDescription, ModuleDescriptionSchema>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ModuleDescribeQuerySchema = 'network.xyo.query.module.describe'\nexport const ModuleDescribeQuerySchema: ModuleDescribeQuerySchema = 'network.xyo.query.module.describe'\n\nexport type ModuleDescribeQuery = Query<{\n schema: ModuleDescribeQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ModuleDiscoverQuerySchema = 'network.xyo.query.module.discover'\nexport const ModuleDiscoverQuerySchema: ModuleDiscoverQuerySchema = 'network.xyo.query.module.discover'\n\nexport type ModuleDiscoverQuery = Query<{\n maxDepth?: number\n schema: ModuleDiscoverQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ModuleManifestQuerySchema = 'network.xyo.query.module.manifest'\nexport const ModuleManifestQuerySchema: ModuleManifestQuerySchema = 'network.xyo.query.module.manifest'\n\nexport type ModuleManifestQuery = Query<{\n maxDepth?: number\n schema: ModuleManifestQuerySchema\n}>\n","import { AddressSchema } from '@xyo-network/address-payload-plugin'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport const AddressPreviousHashSchema = `${AddressSchema}.hash.previous`\nexport type AddressPreviousHashSchema = typeof AddressPreviousHashSchema\n\nexport type AddressPreviousHashPayload = Payload<{\n address: string\n previousHash?: string\n schema: AddressPreviousHashSchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ModuleAddressQuerySchema = 'network.xyo.query.module.address'\nexport const ModuleAddressQuerySchema: ModuleAddressQuerySchema = 'network.xyo.query.module.address'\n\nexport type ModuleAddressQuery = Query<{\n schema: ModuleAddressQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ModuleSubscribeQuerySchema = 'network.xyo.query.module.subscribe'\nexport const ModuleSubscribeQuerySchema: ModuleSubscribeQuerySchema = 'network.xyo.query.module.subscribe'\n\nexport interface ModuleSubscribeFilter {\n /** @field if specified, at least one of the schemas must be present in the boundwtness to generate a notification */\n schema?: string[]\n}\n\n//requests notification when a boundwitness is added to the modules chain that meets the filter criteria\nexport type ModuleSubscribeQuery = Query<{\n /** @field The address that will receive notifications */\n address: string\n /** @field A subscribe with a null for filter is an unsubscribe */\n filter?: ModuleSubscribeFilter | null\n /** @field The maximum events queued per send [may increase frequency] */\n maxQueue?: number\n schema: ModuleSubscribeQuerySchema\n}>\n","import { AsObjectFactory } from '@xyo-network/object'\n\nimport { isModuleObject } from './isModuleObject'\n\nexport const asModuleObject = AsObjectFactory.create(isModuleObject)\n","import { IsObjectFactory, ObjectTypeShape } from '@xyo-network/object'\n\nimport { Module } from './Module'\n\nexport const requiredModuleShape: ObjectTypeShape = {\n address: 'string',\n config: 'object',\n params: 'object',\n queries: 'array',\n query: 'function',\n queryable: 'function',\n}\n\nconst factory = new IsObjectFactory<Module>()\n\nexport const isModuleObject = factory.create(requiredModuleShape)\n","import { AnyObject, EmptyObject, TypeCheck } from '@xyo-network/object'\n\nimport { asModuleObject } from './asModuleObject'\nimport { isModuleObject } from './isModuleObject'\nimport { Module } from './Module'\n\nexport type ModuleTypeCheck<T extends Module = Module> = TypeCheck<T>\n\nexport class IsModuleFactory<T extends Module = Module> {\n create(expectedQueries?: string[], additionalChecks?: TypeCheck<AnyObject | EmptyObject>[]): ModuleTypeCheck<T> {\n return (obj: unknown, config): obj is T => {\n const module = asModuleObject(obj)\n const result =\n isModuleObject(module, config) &&\n (expectedQueries?.reduce((prev, query) => prev && module.queries.includes(query), true) ?? true) &&\n //perform additional checks\n (additionalChecks?.reduce((prev, check) => prev && check(obj, config), true) ?? true)\n return result\n }\n }\n}\n","import { TypeCheck } from '@xyo-network/object'\n\nimport { ModuleDiscoverQuerySchema } from '../Queries'\nimport { IsModuleFactory } from './IsModuleFactory'\nimport { isModuleObject } from './isModuleObject'\nimport { Module } from './Module'\n\nexport const requiredModuleQueries: string[] = [\n /* We need to update this once live module conform */\n //ModuleDescribeQuerySchema,\n //ModuleAddressQuerySchema,\n ModuleDiscoverQuerySchema,\n //ModuleManifestQuerySchema,\n //ModuleSubscribeQuerySchema,\n]\n\n//we do not use IsInstanceFactory here to prevent a cycle\nconst factory = new IsModuleFactory<Module>()\n\nexport const isModule: TypeCheck<Module> = factory.create(requiredModuleQueries, [isModuleObject])\n","import { Promisable } from '@xylabs/promise'\nimport { IsObjectFactory, TypeCheck } from '@xyo-network/object'\n\nimport { ModuleEventData } from '../EventsModels'\nimport { Module, ModuleQueryFunctions } from '../module'\nimport { ModuleParams } from '../ModuleParams'\n\nexport interface ResolveFunctions {\n resolve<T extends ModuleInstance = ModuleInstance>(filter?: ModuleFilter<T>, options?: ModuleFilterOptions<T>): Promisable<T[]>\n resolve<T extends ModuleInstance = ModuleInstance>(nameOrAddress: string, options?: ModuleFilterOptions<T>): Promisable<T | undefined>\n resolve<T extends ModuleInstance = ModuleInstance>(\n nameOrAddressOrFilter?: ModuleFilter<T> | string,\n options?: ModuleFilterOptions<T>,\n ): Promisable<T | T[] | undefined>\n}\n\nexport interface ModuleResolver extends ResolveFunctions {\n addResolver: (resolver: ModuleResolver) => this\n isModuleResolver: boolean\n removeResolver: (resolver: ModuleResolver) => this\n}\n\nexport type ModuleInstance<TParams extends ModuleParams = ModuleParams, TEventData extends ModuleEventData = ModuleEventData> = Module<\n TParams,\n TEventData\n> &\n ResolveFunctions &\n ModuleQueryFunctions & {\n /* The resolver is a 'down' resolver. It can resolve the module or any children (if it is a node for example), that are in the module*/\n readonly downResolver: Omit<ModuleResolver, 'resolve'>\n\n /* The resolver is a 'up' resolver. It can resolve the parent or any children of the parent*/\n /* This is set by a NodeModule when attaching to the module */\n readonly upResolver: Omit<ModuleResolver, 'resolve'>\n }\n\nexport type InstanceTypeCheck<T extends ModuleInstance = ModuleInstance> = TypeCheck<T>\n\nexport class IsInstanceFactory<T extends ModuleInstance = ModuleInstance> extends IsObjectFactory<T> {}\n\nexport interface ModuleFilterOptions<T extends ModuleInstance = ModuleInstance> {\n direction?: 'up' | 'down' | 'all'\n identity?: InstanceTypeCheck<T>\n maxDepth?: number\n visibility?: 'public' | 'private' | 'all'\n}\n\nexport interface AddressModuleFilter<T extends ModuleInstance = ModuleInstance> extends ModuleFilterOptions<T> {\n address: string[]\n}\n\nexport interface NameModuleFilter<T extends ModuleInstance = ModuleInstance> extends ModuleFilterOptions<T> {\n name: string[]\n}\n\nexport interface QueryModuleFilter<T extends ModuleInstance = ModuleInstance> extends ModuleFilterOptions<T> {\n query: string[][]\n}\n\nexport type AnyModuleFilter<T extends ModuleInstance = ModuleInstance> = Partial<AddressModuleFilter<T>> &\n Partial<NameModuleFilter<T>> &\n Partial<QueryModuleFilter<T>>\n\nexport type ModuleFilter<T extends ModuleInstance = ModuleInstance> =\n | ModuleFilterOptions<T>\n | AddressModuleFilter<T>\n | NameModuleFilter<T>\n | QueryModuleFilter<T>\n","import { Module } from '../module'\n\n/**\n * Used to filter duplicates from an array of modules\n * @example: modulesArray.filter(duplicateModules)\n * @param value Current Module\n * @param index Current Module's index\n * @param array Module Array\n * @returns True if the Module's address is the first occurrence of\n * that address in the array, false otherwise\n */\nexport const duplicateModules = (value: Module, index: number, array: Module[]): value is Module => {\n return array.findIndex((v) => v.address === value.address) === index\n}\n","// Inspired by https://stackoverflow.com/a/49079549/2803259\n\nimport { every, isArray, isBoolean, isNull, isNumber, isPlainObject, isString, isUndefined, overSome } from '@xylabs/lodash'\n\nconst JSONPrimitiveChecks = [isUndefined, isNull, isBoolean, isNumber, isString]\nconst JSONComplexChecks = [isPlainObject, isArray]\n\nexport const serializable = (field: unknown, depth?: number): boolean | null => {\n let depthExceeded = false\n const decrementDepth = () => (depth ? depth-- : undefined)\n\n const recursiveSerializable = (field: unknown) => {\n if (depth !== undefined && depth < 1) {\n depthExceeded = true\n return false\n }\n\n // decrement during every recursion\n decrementDepth()\n\n const nestedSerializable = (field: unknown): boolean => overSome(JSONComplexChecks)(field) && every(field as object, recursiveSerializable)\n\n return overSome([...JSONPrimitiveChecks, nestedSerializable])(field)\n }\n\n const valid = recursiveSerializable(field)\n\n return depthExceeded ? null : valid\n}\n\nexport const serializableField = (field: unknown) => {\n return overSome([...JSONPrimitiveChecks, ...JSONComplexChecks])(field)\n}\n","import { isPayloadOfSchemaType, Payload } from '@xyo-network/payload-model'\n\nexport interface StateDictionary {\n [key: string]: string | number | undefined\n}\nexport interface State<T extends StateDictionary = StateDictionary> {\n state: T\n}\n\nexport const ModuleStateSchema = 'network.xyo.module.state' as const\nexport type ModuleStateSchema = typeof ModuleStateSchema\n\nexport type ModuleState<T extends StateDictionary = StateDictionary> = Payload<State<T>, ModuleStateSchema>\n\nexport const isModuleState = <T extends StateDictionary = StateDictionary>(payload?: Payload | null): payload is ModuleState<T> => {\n return isPayloadOfSchemaType<ModuleState<T>>(ModuleStateSchema)(payload)\n}\n","import { TypeCheck } from '@xyo-network/object'\n\nimport { isModuleInstance } from './instance'\nimport { isModule } from './module'\n\nexport const WithFactory = {\n create: <T extends object>(typeCheck: TypeCheck<T>) => {\n return <R>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n module: any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n closure: (module: T) => R,\n ): R | undefined => {\n return typeCheck(module) ? closure(module) : undefined\n }\n },\n}\n\nexport const withModule = WithFactory.create(isModule)\nexport const withModuleInstance = WithFactory.create(isModuleInstance)\n"],"mappings":";AAOO,IAAM,qBAAyC;;;ACkB/C,S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,gBAAgB,CAA8C,YAAwD;AACjI,SAAO,sBAAsC,iBAAiB,EAAE,OAAO;AACzE;;;ACXO,IAAM,cAAc;AAAA,EACzB,QAAQ,CAAmB,cAA4B;AACrD,WAAO,CAEL,QAEA,YACkB;AAClB,aAAO,UAAU,MAAM,IAAI,QAAQ,MAAM,IAAI;AAAA,IAC/C;AAAA,EACF;AACF;AAEO,IAAM,aAAa,YAAY,OAAO,QAAQ;AAC9C,IAAM,qBAAqB,YAAY,OAAO,gBAAgB;","names":["factory","factory","creatableModule","factory","assertEx","assertEx","factory","AsObjectFactory","IsObjectFactory","AsObjectFactory","factory","AsObjectFactory","factory","IsObjectFactory","AsObjectFactory","IsObjectFactory","field"]}
|
|
1
|
+
{"version":3,"sources":["../../src/Config.ts","../../src/CreatableModule/CreatableModule.ts","../../src/CreatableModule/CreatableModuleRegistry.ts","../../src/CreatableModule/LabeledCreatableModuleFactory.ts","../../src/CreatableModule/ModuleFactory.ts","../../src/CreatableModule/ModuleFactoryLocator.ts","../../src/Labels/Labels.ts","../../src/instance/asModuleInstance.ts","../../src/instance/isModuleInstance.ts","../../src/module/asModule.ts","../../src/Queries/Describe/Payload.ts","../../src/Queries/Describe/Query.ts","../../src/Queries/Discover.ts","../../src/Queries/Manifest.ts","../../src/Queries/ModuleAddress/Payload.ts","../../src/Queries/ModuleAddress/Query.ts","../../src/Queries/Subscribe.ts","../../src/module/asModuleObject.ts","../../src/module/isModuleObject.ts","../../src/module/IsModuleFactory.ts","../../src/module/isModule.ts","../../src/instance/ModuleInstance.ts","../../src/lib/duplicateModules.ts","../../src/lib/serializable.ts","../../src/Payload/ModuleState.ts","../../src/withModule.ts"],"sourcesContent":["import { Address } from '@xylabs/hex'\nimport { EmptyObject, WithAdditional } from '@xyo-network/object'\nimport { Payload, Schema } from '@xyo-network/payload-model'\n\nimport { Labels } from './Labels'\n\nexport type ModuleConfigSchema = 'network.xyo.module.config'\nexport const ModuleConfigSchema: ModuleConfigSchema = 'network.xyo.module.config'\n\nexport type CosigningAddressSet = string[]\nexport type SchemaString = string\nexport type ModuleName = string\nexport type NameOrAddress = Address | ModuleName\n\nexport interface ArchivingModuleConfig {\n readonly archiving?: {\n readonly archivists?: NameOrAddress[]\n }\n}\n\nexport type ModuleConfig<TConfig extends EmptyObject | Payload | void = void, TSchema extends Schema | void = void> = Payload<\n WithAdditional<\n {\n /** @field The path to use when creating the account */\n accountPath?: string\n\n /** @field The name/address of the Archivist to use for this module */\n readonly archivist?: NameOrAddress\n\n /**\n * @field The labels used for this module. If a label is specified, then the\n * ModuleFactoryLocator will attempt to find a ModuleFactory with the corresponding\n * labels to construct this module.\n */\n readonly labels?: Labels\n\n /** @field Friendly name of module (not collision resistent). Can be used to resolve module when registered/attached to Node. */\n readonly name?: string\n\n /** @field paging settings for queries */\n readonly paging?: Record<string, { size?: number }>\n\n schema: TConfig extends Payload ? TConfig['schema'] : ModuleConfigSchema\n\n /** @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. */\n readonly security?: {\n /** @field Will the module process queries that have unsigned BoundWitness in query tuples */\n readonly allowAnonymous?: boolean\n\n /** @field If schema in record, then only these address sets can access query */\n readonly allowed?: Record<SchemaString, (Address | CosigningAddressSet)[]>\n\n /** @field If schema in record, then anyone except these addresses can access query */\n readonly disallowed?: Record<SchemaString, Address[]>\n }\n\n /** @field sign every query */\n readonly sign?: boolean\n\n /** @field Store the queries made to the module in an archivist if possible */\n readonly storeQueries?: boolean\n\n /** @field add a timestamp payload to every query */\n readonly timestamp?: boolean\n } & ArchivingModuleConfig,\n TConfig\n >,\n TSchema\n>\n\nexport type AnyConfigSchema<TConfig extends Omit<ModuleConfig, 'schema'> & { schema: string } = Omit<ModuleConfig, 'schema'> & { schema: string }> =\n ModuleConfig<TConfig, string>\n\nexport type OptionalConfigSchema<TConfig extends AnyConfigSchema<ModuleConfig> = AnyConfigSchema<ModuleConfig>> = Omit<TConfig, 'schema'> & {\n schema?: TConfig['schema']\n}\n\nexport type AnyModuleConfig = AnyConfigSchema<ModuleConfig>\n","import { Logger } from '@xylabs/logger'\nimport { AccountInstance } from '@xyo-network/account-model'\n\nimport { ModuleInstance } from '../instance'\n\nexport type CreatableModuleFactory<T extends ModuleInstance = ModuleInstance> = Omit<Omit<CreatableModule<T>, 'new'>, 'create'> & {\n create<T extends ModuleInstance>(this: CreatableModuleFactory<T>, params?: T['params']): Promise<T>\n}\n\nexport interface CreatableModule<T extends ModuleInstance = ModuleInstance> {\n configSchema: string\n configSchemas: string[]\n defaultLogger?: Logger\n new (privateConstructorKey: string, params: T['params'], account: AccountInstance): T\n _noOverride(functionName: string): void\n create<T extends ModuleInstance>(this: CreatableModule<T>, params?: T['params']): Promise<T>\n factory<T extends ModuleInstance>(this: CreatableModule<T>, params?: T['params']): CreatableModuleFactory<T>\n}\n\n/**\n * Class annotation to be used to decorate Modules which support\n * an asynchronous creation pattern\n * @returns The decorated Module requiring it implement the members\n * of the CreatableModule as statics properties/methods\n */\nexport function creatableModule<TModule extends ModuleInstance = ModuleInstance>() {\n return <U extends CreatableModule<TModule>>(constructor: U) => {\n constructor\n }\n}\n","import { CreatableModuleFactory } from './CreatableModule'\nimport { CreatableModuleDictionary } from './CreatableModuleDictionary'\nimport { LabeledCreatableModuleFactory } from './LabeledCreatableModuleFactory'\n\nexport interface CreatableModuleRegistry {\n [key: string]: (CreatableModuleFactory | LabeledCreatableModuleFactory)[] | undefined\n}\n\nexport const toCreatableModuleRegistry = (dict: CreatableModuleDictionary | CreatableModuleRegistry): CreatableModuleRegistry => {\n // eslint-disable-next-line unicorn/no-array-reduce\n return Object.entries(dict).reduce((registry, [schema, factory]) => {\n registry[schema] = Array.isArray(factory) ? factory : [factory]\n return registry\n }, {} as CreatableModuleRegistry)\n}\n\nexport const assignCreatableModuleRegistry = (\n target: CreatableModuleRegistry = {},\n ...sources: CreatableModuleRegistry[]\n): CreatableModuleRegistry => {\n sources.map((source) =>\n Object.entries(source).map(([schema, factories]) => {\n if (factories) {\n const existingFactories = target[schema]\n target[schema] = existingFactories ? (target[schema] = [...existingFactories, ...factories]) : factories\n }\n }),\n )\n return target\n}\n","import { ModuleInstance } from '../instance'\nimport { WithOptionalLabels } from '../Labels'\nimport { CreatableModuleFactory } from './CreatableModule'\n\nexport type LabeledCreatableModuleFactory<T extends ModuleInstance = ModuleInstance> = CreatableModuleFactory<T> & WithOptionalLabels\n\nexport const hasLabels = (factory: CreatableModuleFactory | LabeledCreatableModuleFactory): factory is LabeledCreatableModuleFactory => {\n return (factory as LabeledCreatableModuleFactory).labels !== undefined\n}\n","import { assertEx } from '@xylabs/assert'\nimport { merge } from '@xylabs/lodash'\nimport { Logger } from '@xylabs/logger'\n\nimport { ModuleInstance } from '../instance'\nimport { Labels, WithOptionalLabels } from '../Labels'\nimport { CreatableModule, CreatableModuleFactory } from './CreatableModule'\n\nexport class ModuleFactory<TModule extends ModuleInstance> implements CreatableModuleFactory<TModule> {\n configSchemas: CreatableModuleFactory<TModule>['configSchemas']\n\n creatableModule: CreatableModule<TModule>\n\n defaultLogger?: Logger | undefined\n\n defaultParams?: Omit<TModule['params'], 'config'> & { config?: Partial<TModule['params']['config']> }\n\n labels?: Labels\n\n constructor(\n creatableModule: CreatableModule<TModule>,\n params?: Omit<TModule['params'], 'config'> & { config?: Partial<TModule['params']['config']> },\n labels: Labels = {},\n ) {\n this.creatableModule = creatableModule\n this.defaultParams = params\n this.configSchemas = creatableModule.configSchemas\n this.labels = Object.assign({}, (creatableModule as WithOptionalLabels).labels ?? {}, labels ?? {})\n }\n\n get configSchema(): string {\n return this.configSchemas[0]\n }\n\n static withParams<T extends ModuleInstance>(\n creatableModule: CreatableModule<T>,\n params?: Omit<T['params'], 'config'> & { config?: T['params']['config'] },\n labels: Labels = {},\n ) {\n return new ModuleFactory(creatableModule, params, labels)\n }\n\n _getRootFunction(funcName: string) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let anyThis = this as any\n while (anyThis.__proto__[funcName]) {\n anyThis = anyThis.__proto__\n }\n return anyThis[funcName]\n }\n\n _noOverride(functionName: string) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const thisFunc = (this as any)[functionName]\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const rootFunc = this._getRootFunction(functionName)\n assertEx(thisFunc === rootFunc, `Override not allowed for [${functionName}] - override ${functionName}Handler instead`)\n }\n\n create<T extends ModuleInstance>(this: CreatableModuleFactory<T>, params?: TModule['params'] | undefined): Promise<T> {\n const factory = this as ModuleFactory<T>\n const schema = factory.creatableModule.configSchema\n const mergedParams: TModule['params'] = merge({}, factory.defaultParams, params, {\n config: merge({}, factory.defaultParams?.config, params?.config, { schema }),\n })\n return factory.creatableModule.create<T>(mergedParams)\n }\n\n factory<T extends ModuleInstance>(this: CreatableModule<T>, _params?: T['params'] | undefined): CreatableModuleFactory<T> {\n throw new Error('Method not implemented.')\n }\n}\n","import { assertEx } from '@xylabs/assert'\n\nimport { ModuleInstance } from '../instance'\nimport { hasAllLabels, Labels } from '../Labels'\nimport { CreatableModuleFactory } from './CreatableModule'\nimport { CreatableModuleRegistry } from './CreatableModuleRegistry'\nimport { hasLabels, LabeledCreatableModuleFactory } from './LabeledCreatableModuleFactory'\n\n/**\n * A class which encapsulates the Service Locator Pattern for Module Factories\n */\nexport class ModuleFactoryLocator {\n constructor(protected readonly _registry: CreatableModuleRegistry = {}) {}\n\n /**\n * The current registry for the module factory\n */\n get registry(): Readonly<CreatableModuleRegistry> {\n return this._registry\n }\n\n /**\n * Locates a module factory that matches the supplied schema and labels\n * @param schema The config schema for the module\n * @param labels The labels for the module factory\n * @returns A module factory that matches the supplied schema and labels or throws if one is not found\n */\n locate(schema: string, labels?: Labels): CreatableModuleFactory | LabeledCreatableModuleFactory {\n return assertEx(this.tryLocate(schema, labels), () => {\n const configString = `config schema [${schema}]`\n const labelsString = labels ? ` & labels [${JSON.stringify(labels)}]` : ''\n return `No module factory for the supplied ${configString}${labelsString} registered`\n })\n }\n\n /**\n * Registers a single module factory (with optional tags) with the locator\n * @param additional Additional module factories to register\n */\n register<TModule extends ModuleInstance>(mod: CreatableModuleFactory<TModule>, labels?: Labels): this {\n mod.configSchemas.map((schema) => {\n const existingFactories = this._registry[schema]\n const factory: LabeledCreatableModuleFactory<TModule> = {\n // Destructure instance properties\n ...mod,\n // Copy static methods\n create: mod.create.bind(mod) as LabeledCreatableModuleFactory<TModule>['create'],\n // Merge module & supplied labels\n labels: Object.assign({}, (mod as LabeledCreatableModuleFactory).labels ?? {}, labels ?? {}),\n }\n this._registry[schema] = existingFactories ? [...existingFactories, factory] : [factory]\n })\n return this\n }\n\n /**\n * Registers multiple module factories with the locator\n * @param additional Additional module factories to register\n */\n registerMany(additional: CreatableModuleRegistry): this {\n Object.entries(additional).map(([schema, factories]) => {\n if (factories) {\n const existingFactories = this._registry[schema]\n this._registry[schema] = existingFactories ? [...existingFactories, ...factories] : factories\n }\n })\n return this\n }\n\n /**\n * Tries to locate a module factory that matches the supplied schema and labels\n * @param schema The config schema for the module\n * @param labels The labels for the module factory\n * @returns A module factory that matches the supplied schema and labels or undefined\n */\n tryLocate(schema: string, labels?: Labels): CreatableModuleFactory | LabeledCreatableModuleFactory | undefined {\n // If labels were provided\n return labels\n ? // Find the first factory that has labels and has all the labels provided\n this._registry[schema]?.filter(hasLabels).find((factory) => hasAllLabels(factory?.labels, labels))\n : // Otherwise, return the first factory\n this._registry[schema]?.[0]\n }\n}\n","/**\n * Object used to represent labels identifying a resource.\n */\nexport interface Labels {\n [key: string]: string | undefined\n}\n\n/**\n * Interface for objects that have labels.\n */\nexport interface WithLabels<T extends Labels = Labels> {\n labels: T\n}\n\n/**\n * Interface for objects that have labels.\n */\nexport interface WithOptionalLabels<T extends Labels = Labels> {\n labels?: T\n}\n\n/**\n * Returns true if the source object has all the labels from the required set\n * @param source Source object to check against\n * @param required Set of labels to check for in source\n * @returns True of the source object has all the labels from the required set\n */\nexport const hasAllLabels = (source?: Labels, required?: Labels): boolean => {\n if (!required) return true\n return Object.entries(required).every(([key, value]) => {\n // eslint-disable-next-line no-prototype-builtins\n return source?.hasOwnProperty(key as keyof typeof source) && source?.[key as keyof typeof source] === value\n })\n}\n","import { AsObjectFactory } from '@xyo-network/object'\n\nimport { isModuleInstance } from './isModuleInstance'\n\nexport const asModuleInstance = AsObjectFactory.create(isModuleInstance)\n","import { IsObjectFactory, ObjectTypeShape, TypeCheck } from '@xyo-network/object'\n\nimport { isModule } from '../module'\nimport { ModuleInstance } from './ModuleInstance'\n\nexport const requiredModuleInstanceFunctions: ObjectTypeShape = {\n describe: 'function',\n discover: 'function',\n manifest: 'function',\n moduleAddress: 'function',\n}\n\n//we do not use IsInstanceFactory here to prevent a cycle\nconst factory = new IsObjectFactory<ModuleInstance>()\n\nexport const isModuleInstance: TypeCheck<ModuleInstance> = factory.create(requiredModuleInstanceFunctions, [isModule])\n","import { AsObjectFactory } from '@xyo-network/object'\n\nimport { isModule } from './isModule'\n\nexport const asModule = AsObjectFactory.create(isModule)\n","import { Payload } from '@xyo-network/payload-model'\n\nimport { ModuleDescription } from '../../ModuleDescription'\n\nexport const ModuleDescriptionSchema = 'network.xyo.module.description'\nexport type ModuleDescriptionSchema = typeof ModuleDescriptionSchema\n\nexport type ModuleDescriptionPayload = Payload<ModuleDescription, ModuleDescriptionSchema>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ModuleDescribeQuerySchema = 'network.xyo.query.module.describe'\nexport const ModuleDescribeQuerySchema: ModuleDescribeQuerySchema = 'network.xyo.query.module.describe'\n\nexport type ModuleDescribeQuery = Query<{\n schema: ModuleDescribeQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ModuleDiscoverQuerySchema = 'network.xyo.query.module.discover'\nexport const ModuleDiscoverQuerySchema: ModuleDiscoverQuerySchema = 'network.xyo.query.module.discover'\n\nexport type ModuleDiscoverQuery = Query<{\n maxDepth?: number\n schema: ModuleDiscoverQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ModuleManifestQuerySchema = 'network.xyo.query.module.manifest'\nexport const ModuleManifestQuerySchema: ModuleManifestQuerySchema = 'network.xyo.query.module.manifest'\n\nexport type ModuleManifestQuery = Query<{\n maxDepth?: number\n schema: ModuleManifestQuerySchema\n}>\n","import { AddressSchema } from '@xyo-network/address-payload-plugin'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport const AddressPreviousHashSchema = `${AddressSchema}.hash.previous`\nexport type AddressPreviousHashSchema = typeof AddressPreviousHashSchema\n\nexport type AddressPreviousHashPayload = Payload<{\n address: string\n previousHash?: string\n schema: AddressPreviousHashSchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ModuleAddressQuerySchema = 'network.xyo.query.module.address'\nexport const ModuleAddressQuerySchema: ModuleAddressQuerySchema = 'network.xyo.query.module.address'\n\nexport type ModuleAddressQuery = Query<{\n schema: ModuleAddressQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ModuleSubscribeQuerySchema = 'network.xyo.query.module.subscribe'\nexport const ModuleSubscribeQuerySchema: ModuleSubscribeQuerySchema = 'network.xyo.query.module.subscribe'\n\nexport interface ModuleSubscribeFilter {\n /** @field if specified, at least one of the schemas must be present in the boundwtness to generate a notification */\n schema?: string[]\n}\n\n//requests notification when a boundwitness is added to the modules chain that meets the filter criteria\nexport type ModuleSubscribeQuery = Query<{\n /** @field The address that will receive notifications */\n address: string\n /** @field A subscribe with a null for filter is an unsubscribe */\n filter?: ModuleSubscribeFilter | null\n /** @field The maximum events queued per send [may increase frequency] */\n maxQueue?: number\n schema: ModuleSubscribeQuerySchema\n}>\n","import { AsObjectFactory } from '@xyo-network/object'\n\nimport { isModuleObject } from './isModuleObject'\n\nexport const asModuleObject = AsObjectFactory.create(isModuleObject)\n","import { IsObjectFactory, ObjectTypeShape } from '@xyo-network/object'\n\nimport { Module } from './Module'\n\nexport const requiredModuleShape: ObjectTypeShape = {\n address: 'string',\n config: 'object',\n params: 'object',\n queries: 'array',\n query: 'function',\n queryable: 'function',\n}\n\nconst factory = new IsObjectFactory<Module>()\n\nexport const isModuleObject = factory.create(requiredModuleShape)\n","import { AnyObject, EmptyObject, TypeCheck } from '@xyo-network/object'\n\nimport { asModuleObject } from './asModuleObject'\nimport { isModuleObject } from './isModuleObject'\nimport { Module } from './Module'\n\nexport type ModuleTypeCheck<T extends Module = Module> = TypeCheck<T>\n\nexport class IsModuleFactory<T extends Module = Module> {\n create(expectedQueries?: string[], additionalChecks?: TypeCheck<AnyObject | EmptyObject>[]): ModuleTypeCheck<T> {\n return (obj: unknown, config): obj is T => {\n const module = asModuleObject(obj)\n const result =\n isModuleObject(module, config) &&\n (expectedQueries?.reduce((prev, query) => prev && module.queries.includes(query), true) ?? true) &&\n //perform additional checks\n (additionalChecks?.reduce((prev, check) => prev && check(obj, config), true) ?? true)\n return result\n }\n }\n}\n","import { TypeCheck } from '@xyo-network/object'\n\nimport { ModuleDiscoverQuerySchema } from '../Queries'\nimport { IsModuleFactory } from './IsModuleFactory'\nimport { isModuleObject } from './isModuleObject'\nimport { Module } from './Module'\n\nexport const requiredModuleQueries: string[] = [\n /* We need to update this once live module conform */\n //ModuleDescribeQuerySchema,\n //ModuleAddressQuerySchema,\n ModuleDiscoverQuerySchema,\n //ModuleManifestQuerySchema,\n //ModuleSubscribeQuerySchema,\n]\n\n//we do not use IsInstanceFactory here to prevent a cycle\nconst factory = new IsModuleFactory<Module>()\n\nexport const isModule: TypeCheck<Module> = factory.create(requiredModuleQueries, [isModuleObject])\n","import { Promisable } from '@xylabs/promise'\nimport { IsObjectFactory, TypeCheck } from '@xyo-network/object'\n\nimport { ModuleEventData } from '../EventsModels'\nimport { Module, ModuleQueryFunctions } from '../module'\nimport { ModuleParams } from '../ModuleParams'\n\nexport interface ResolveFunctions {\n resolve<T extends ModuleInstance = ModuleInstance>(filter?: ModuleFilter<T>, options?: ModuleFilterOptions<T>): Promisable<T[]>\n resolve<T extends ModuleInstance = ModuleInstance>(nameOrAddress: string, options?: ModuleFilterOptions<T>): Promisable<T | undefined>\n resolve<T extends ModuleInstance = ModuleInstance>(\n nameOrAddressOrFilter?: ModuleFilter<T> | string,\n options?: ModuleFilterOptions<T>,\n ): Promisable<T | T[] | undefined>\n}\n\nexport interface ModuleResolver extends ResolveFunctions {\n addResolver: (resolver: ModuleResolver) => this\n isModuleResolver: boolean\n removeResolver: (resolver: ModuleResolver) => this\n}\n\nexport type ModuleInstance<TParams extends ModuleParams = ModuleParams, TEventData extends ModuleEventData = ModuleEventData> = Module<\n TParams,\n TEventData\n> &\n ResolveFunctions &\n ModuleQueryFunctions & {\n /* The resolver is a 'down' resolver. It can resolve the module or any children (if it is a node for example), that are in the module*/\n readonly downResolver: Omit<ModuleResolver, 'resolve'>\n\n /* The resolver is a 'up' resolver. It can resolve the parent or any children of the parent*/\n /* This is set by a NodeModule when attaching to the module */\n readonly upResolver: Omit<ModuleResolver, 'resolve'>\n }\n\nexport type InstanceTypeCheck<T extends ModuleInstance = ModuleInstance> = TypeCheck<T>\n\nexport class IsInstanceFactory<T extends ModuleInstance = ModuleInstance> extends IsObjectFactory<T> {}\n\nexport interface ModuleFilterOptions<T extends ModuleInstance = ModuleInstance> {\n direction?: 'up' | 'down' | 'all'\n identity?: InstanceTypeCheck<T>\n maxDepth?: number\n visibility?: 'public' | 'private' | 'all'\n}\n\nexport interface AddressModuleFilter<T extends ModuleInstance = ModuleInstance> extends ModuleFilterOptions<T> {\n address: string[]\n}\n\nexport interface NameModuleFilter<T extends ModuleInstance = ModuleInstance> extends ModuleFilterOptions<T> {\n name: string[]\n}\n\nexport interface QueryModuleFilter<T extends ModuleInstance = ModuleInstance> extends ModuleFilterOptions<T> {\n query: string[][]\n}\n\nexport type AnyModuleFilter<T extends ModuleInstance = ModuleInstance> = Partial<AddressModuleFilter<T>> &\n Partial<NameModuleFilter<T>> &\n Partial<QueryModuleFilter<T>>\n\nexport type ModuleFilter<T extends ModuleInstance = ModuleInstance> =\n | ModuleFilterOptions<T>\n | AddressModuleFilter<T>\n | NameModuleFilter<T>\n | QueryModuleFilter<T>\n","import { Module } from '../module'\n\n/**\n * Used to filter duplicates from an array of modules\n * @example: modulesArray.filter(duplicateModules)\n * @param value Current Module\n * @param index Current Module's index\n * @param array Module Array\n * @returns True if the Module's address is the first occurrence of\n * that address in the array, false otherwise\n */\nexport const duplicateModules = (value: Module, index: number, array: Module[]): value is Module => {\n return array.findIndex((v) => v.address === value.address) === index\n}\n","// Inspired by https://stackoverflow.com/a/49079549/2803259\n\nimport { every, isArray, isBoolean, isNull, isNumber, isPlainObject, isString, isUndefined, overSome } from '@xylabs/lodash'\n\nconst JSONPrimitiveChecks = [isUndefined, isNull, isBoolean, isNumber, isString]\nconst JSONComplexChecks = [isPlainObject, isArray]\n\nexport const serializable = (field: unknown, depth?: number): boolean | null => {\n let depthExceeded = false\n const decrementDepth = () => (depth ? depth-- : undefined)\n\n const recursiveSerializable = (field: unknown) => {\n if (depth !== undefined && depth < 1) {\n depthExceeded = true\n return false\n }\n\n // decrement during every recursion\n decrementDepth()\n\n const nestedSerializable = (field: unknown): boolean => overSome(JSONComplexChecks)(field) && every(field as object, recursiveSerializable)\n\n return overSome([...JSONPrimitiveChecks, nestedSerializable])(field)\n }\n\n const valid = recursiveSerializable(field)\n\n return depthExceeded ? null : valid\n}\n\nexport const serializableField = (field: unknown) => {\n return overSome([...JSONPrimitiveChecks, ...JSONComplexChecks])(field)\n}\n","import { isPayloadOfSchemaType, Payload } from '@xyo-network/payload-model'\n\nexport interface StateDictionary {\n [key: string]: string | number | undefined\n}\nexport interface State<T extends StateDictionary = StateDictionary> {\n state: T\n}\n\nexport const ModuleStateSchema = 'network.xyo.module.state' as const\nexport type ModuleStateSchema = typeof ModuleStateSchema\n\nexport type ModuleState<T extends StateDictionary = StateDictionary> = Payload<State<T>, ModuleStateSchema>\n\nexport const isModuleState = <T extends StateDictionary = StateDictionary>(payload?: Payload | null): payload is ModuleState<T> => {\n return isPayloadOfSchemaType<ModuleState<T>>(ModuleStateSchema)(payload)\n}\n","import { TypeCheck } from '@xyo-network/object'\n\nimport { isModuleInstance } from './instance'\nimport { isModule } from './module'\n\nexport const WithFactory = {\n create: <T extends object>(typeCheck: TypeCheck<T>) => {\n return <R>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n module: any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n closure: (module: T) => R,\n ): R | undefined => {\n return typeCheck(module) ? closure(module) : undefined\n }\n },\n}\n\nexport const withModule = WithFactory.create(isModule)\nexport const withModuleInstance = WithFactory.create(isModuleInstance)\n"],"mappings":";;;;AAOO,IAAMA,qBAAyC;;;ACkB/C,SAASC,kBAAAA;AACd,SAAO,CAAqCC,gBAAAA;AAC1CA;EACF;AACF;AAJgBD;;;ACjBT,IAAME,4BAA4B,wBAACC,SAAAA;AAExC,SAAOC,OAAOC,QAAQF,IAAAA,EAAMG,OAAO,CAACC,UAAU,CAACC,QAAQC,QAAAA,MAAQ;AAC7DF,aAASC,MAAAA,IAAUE,MAAMC,QAAQF,QAAAA,IAAWA,WAAU;MAACA;;AACvD,WAAOF;EACT,GAAG,CAAC,CAAA;AACN,GANyC;AAQlC,IAAMK,gCAAgC,wBAC3CC,SAAkC,CAAC,MAChCC,YAAAA;AAEHA,UAAQC,IAAI,CAACC,WACXZ,OAAOC,QAAQW,MAAAA,EAAQD,IAAI,CAAC,CAACP,QAAQS,SAAAA,MAAU;AAC7C,QAAIA,WAAW;AACb,YAAMC,oBAAoBL,OAAOL,MAAAA;AACjCK,aAAOL,MAAAA,IAAUU,oBAAqBL,OAAOL,MAAAA,IAAU;WAAIU;WAAsBD;UAAcA;IACjG;EACF,CAAA,CAAA;AAEF,SAAOJ;AACT,GAb6C;;;ACVtC,IAAMM,YAAY,wBAACC,aAAAA;AACxB,SAAQA,SAA0CC,WAAWC;AAC/D,GAFyB;;;ACNzB,SAASC,gBAAgB;AACzB,SAASC,aAAa;AAOf,IAAMC,iBAAN,MAAMA,eAAAA;EACXC;EAEAC;EAE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AA,KAAUQ,MAAMR,QAAiBK,qBAAAA,GAA1F;AAE3B,WAAOE,SAAS;SAAIjB;MAAqBgB;KAAmB,EAAEN,MAAAA;EAChE,GAZ8B;AAc9B,QAAMS,QAAQJ,sBAAsBL,KAAAA;AAEpC,SAAOE,gBAAgB,OAAOO;AAChC,GArB4B;AAuBrB,IAAMC,oBAAoB,wBAACV,UAAAA;AAChC,SAAOO,SAAS;OAAIjB;OAAwBM;GAAkB,EAAEI,KAAAA;AAClE,GAFiC;;;AC9BjC,SAASW,6BAAsC;AASxC,IAAMC,oBAAoB;AAK1B,IAAMC,gBAAgB,wBAA8CC,YAAAA;AACzE,SAAOC,sBAAsCH,iBAAAA,EAAmBE,OAAAA;AAClE,GAF6B;;;ACTtB,IAAME,cAAc;EACzBC,QAAQ,CAAmBC,cAAAA;AACzB,WAAO,CAELC,QAEAC,YAAAA;AAEA,aAAOF,UAAUC,MAAAA,IAAUC,QAAQD,MAAAA,IAAUE;IAC/C;EACF;AACF;AAEO,IAAMC,aAAaN,YAAYC,OAAOM,QAAAA;AACtC,IAAMC,qBAAqBR,YAAYC,OAAOQ,gBAAAA;","names":["ModuleConfigSchema","creatableModule","constructor","toCreatableModuleRegistry","dict","Object","entries","reduce","registry","schema","factory","Array","isArray","assignCreatableModuleRegistry","target","sources","map","source","factories","existingFactories","hasLabels","factory","labels","undefined","assertEx","merge","ModuleFactory","configSchemas","creatableModule","defaultLogger","defaultParams","labels","constructor","params","Object","assign","configSchema","withParams","_getRootFunction","funcName","anyThis","__proto__","_noOverride","functionName","thisFunc","rootFunc","assertEx","create","factory","schema","mergedParams","merge","config","_params","Error","assertEx","hasAllLabels","source","required","Object","entries","every","key","value","hasOwnProperty","ModuleFactoryLocator","constructor","_registry","registry","locate","schema","labels","assertEx","tryLocate","configString","labelsString","JSON","stringify","register","mod","configSchemas","map","existingFactories","factory","create","bind","Object","assign","registerMany","additional","entries","factories","filter","hasLabels","find","hasAllLabels","AsObjectFactory","IsObjectFactory","AsObjectFactory","ModuleDescriptionSchema","ModuleDescribeQuerySchema","ModuleDiscoverQuerySchema","ModuleManifestQuerySchema","AddressSchema","AddressPreviousHashSchema","ModuleAddressQuerySchema","ModuleSubscribeQuerySchema","AsObjectFactory","IsObjectFactory","requiredModuleShape","address","config","params","queries","query","queryable","factory","isModuleObject","create","asModuleObject","AsObjectFactory","create","isModuleObject","IsModuleFactory","create","expectedQueries","additionalChecks","obj","config","module","asModuleObject","result","isModuleObject","reduce","prev","query","queries","includes","check","requiredModuleQueries","ModuleDiscoverQuerySchema","factory","IsModuleFactory","isModule","create","isModuleObject","asModule","AsObjectFactory","create","isModule","requiredModuleInstanceFunctions","describe","discover","manifest","moduleAddress","factory","IsObjectFactory","isModuleInstance","create","isModule","asModuleInstance","AsObjectFactory","create","isModuleInstance","IsObjectFactory","IsInstanceFactory","IsObjectFactory","duplicateModules","value","index","array","findIndex","v","address","every","isArray","isBoolean","isNull","isNumber","isPlainObject","isString","isUndefined","overSome","JSONPrimitiveChecks","isUndefined","isNull","isBoolean","isNumber","isString","JSONComplexChecks","isPlainObject","isArray","serializable","field","depth","depthExceeded","decrementDepth","undefined","recursiveSerializable","nestedSerializable","overSome","every","valid","serializableField","isPayloadOfSchemaType","ModuleStateSchema","isModuleState","payload","isPayloadOfSchemaType","WithFactory","create","typeCheck","module","closure","undefined","withModule","isModule","withModuleInstance","isModuleInstance"]}
|
package/package.json
CHANGED
|
@@ -15,14 +15,13 @@
|
|
|
15
15
|
"@xylabs/lodash": "^2.13.20",
|
|
16
16
|
"@xylabs/logger": "^2.13.20",
|
|
17
17
|
"@xylabs/promise": "^2.13.20",
|
|
18
|
-
"@xyo-network/account-model": "~2.
|
|
19
|
-
"@xyo-network/address-payload-plugin": "~2.
|
|
20
|
-
"@xyo-network/boundwitness-model": "~2.
|
|
21
|
-
"@xyo-network/manifest-model": "~2.
|
|
22
|
-
"@xyo-network/module-events": "~2.
|
|
23
|
-
"@xyo-network/object": "~2.
|
|
24
|
-
"@xyo-network/payload-model": "~2.
|
|
25
|
-
"@xyo-network/wallet-model": "~2.84.18"
|
|
18
|
+
"@xyo-network/account-model": "~2.85.0",
|
|
19
|
+
"@xyo-network/address-payload-plugin": "~2.85.0",
|
|
20
|
+
"@xyo-network/boundwitness-model": "~2.85.0",
|
|
21
|
+
"@xyo-network/manifest-model": "~2.85.0",
|
|
22
|
+
"@xyo-network/module-events": "~2.85.0",
|
|
23
|
+
"@xyo-network/object": "~2.85.0",
|
|
24
|
+
"@xyo-network/payload-model": "~2.85.0"
|
|
26
25
|
},
|
|
27
26
|
"devDependencies": {
|
|
28
27
|
"@xylabs/ts-scripts-yarn3": "^3.2.25",
|
|
@@ -68,6 +67,6 @@
|
|
|
68
67
|
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js.git"
|
|
69
68
|
},
|
|
70
69
|
"sideEffects": false,
|
|
71
|
-
"version": "2.
|
|
70
|
+
"version": "2.85.0",
|
|
72
71
|
"type": "module"
|
|
73
72
|
}
|
package/src/Config.ts
CHANGED
|
@@ -22,7 +22,7 @@ export type ModuleConfig<TConfig extends EmptyObject | Payload | void = void, TS
|
|
|
22
22
|
WithAdditional<
|
|
23
23
|
{
|
|
24
24
|
/** @field The path to use when creating the account */
|
|
25
|
-
|
|
25
|
+
accountPath?: string
|
|
26
26
|
|
|
27
27
|
/** @field The name/address of the Archivist to use for this module */
|
|
28
28
|
readonly archivist?: NameOrAddress
|
package/src/ModuleParams.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { AccountInstance } from '@xyo-network/account-model'
|
|
2
2
|
import { BaseParams, EmptyObject, WithAdditional } from '@xyo-network/object'
|
|
3
|
-
import { WalletInstance } from '@xyo-network/wallet-model'
|
|
4
3
|
|
|
5
4
|
import { AnyConfigSchema, ModuleConfig } from './Config'
|
|
6
5
|
|
|
@@ -12,7 +11,6 @@ export type ModuleParams<
|
|
|
12
11
|
account?: AccountInstance | 'random'
|
|
13
12
|
config: TConfig extends AnyConfigSchema<ModuleConfig> ? TConfig : AnyConfigSchema<ModuleConfig>
|
|
14
13
|
ephemeralQueryAccountEnabled?: boolean
|
|
15
|
-
wallet?: WalletInstance
|
|
16
14
|
}>,
|
|
17
15
|
TAdditionalParams
|
|
18
16
|
>
|