@xyo-network/module-model 2.90.2 → 2.90.4
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/ModuleQueryResult.d.cts +6 -2
- package/dist/browser/ModuleQueryResult.d.cts.map +1 -1
- package/dist/browser/ModuleQueryResult.d.mts +6 -2
- package/dist/browser/ModuleQueryResult.d.mts.map +1 -1
- package/dist/browser/ModuleQueryResult.d.ts +6 -2
- package/dist/browser/ModuleQueryResult.d.ts.map +1 -1
- package/dist/browser/Payload/ModuleState.d.cts +4 -1
- package/dist/browser/Payload/ModuleState.d.cts.map +1 -1
- package/dist/browser/Payload/ModuleState.d.mts +4 -1
- package/dist/browser/Payload/ModuleState.d.mts.map +1 -1
- package/dist/browser/Payload/ModuleState.d.ts +4 -1
- package/dist/browser/Payload/ModuleState.d.ts.map +1 -1
- package/dist/browser/index.cjs +4 -0
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.js +4 -0
- package/dist/browser/index.js.map +1 -1
- package/dist/node/ModuleQueryResult.d.cts +6 -2
- package/dist/node/ModuleQueryResult.d.cts.map +1 -1
- package/dist/node/ModuleQueryResult.d.mts +6 -2
- package/dist/node/ModuleQueryResult.d.mts.map +1 -1
- package/dist/node/ModuleQueryResult.d.ts +6 -2
- package/dist/node/ModuleQueryResult.d.ts.map +1 -1
- package/dist/node/Payload/ModuleState.d.cts +4 -1
- package/dist/node/Payload/ModuleState.d.cts.map +1 -1
- package/dist/node/Payload/ModuleState.d.mts +4 -1
- package/dist/node/Payload/ModuleState.d.mts.map +1 -1
- package/dist/node/Payload/ModuleState.d.ts +4 -1
- package/dist/node/Payload/ModuleState.d.ts.map +1 -1
- package/dist/node/index.cjs +5 -0
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.js +4 -0
- package/dist/node/index.js.map +1 -1
- package/package.json +14 -14
- package/src/ModuleQueryResult.ts +6 -2
- package/src/Payload/ModuleState.ts +5 -1
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { BoundWitness } from '@xyo-network/boundwitness-model';
|
|
2
|
-
import { ModuleError, Payload } from '@xyo-network/payload-model';
|
|
3
|
-
export type ModuleQueryResult =
|
|
2
|
+
import { ModuleError, Payload, WithMeta } from '@xyo-network/payload-model';
|
|
3
|
+
export type ModuleQueryResult<P extends Payload = Payload, E extends ModuleError = ModuleError, B extends BoundWitness = BoundWitness> = [
|
|
4
|
+
WithMeta<B>,
|
|
5
|
+
WithMeta<P>[],
|
|
6
|
+
WithMeta<E>[]
|
|
7
|
+
];
|
|
4
8
|
//# sourceMappingURL=ModuleQueryResult.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModuleQueryResult.d.ts","sourceRoot":"","sources":["../../src/ModuleQueryResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAC9D,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;
|
|
1
|
+
{"version":3,"file":"ModuleQueryResult.d.ts","sourceRoot":"","sources":["../../src/ModuleQueryResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAC9D,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAE3E,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,EAAE,CAAC,SAAS,WAAW,GAAG,WAAW,EAAE,CAAC,SAAS,YAAY,GAAG,YAAY,IAAI;IACvI,QAAQ,CAAC,CAAC,CAAC;IACX,QAAQ,CAAC,CAAC,CAAC,EAAE;IACb,QAAQ,CAAC,CAAC,CAAC,EAAE;CACd,CAAA"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { BoundWitness } from '@xyo-network/boundwitness-model';
|
|
2
|
-
import { ModuleError, Payload } from '@xyo-network/payload-model';
|
|
3
|
-
export type ModuleQueryResult =
|
|
2
|
+
import { ModuleError, Payload, WithMeta } from '@xyo-network/payload-model';
|
|
3
|
+
export type ModuleQueryResult<P extends Payload = Payload, E extends ModuleError = ModuleError, B extends BoundWitness = BoundWitness> = [
|
|
4
|
+
WithMeta<B>,
|
|
5
|
+
WithMeta<P>[],
|
|
6
|
+
WithMeta<E>[]
|
|
7
|
+
];
|
|
4
8
|
//# sourceMappingURL=ModuleQueryResult.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModuleQueryResult.d.ts","sourceRoot":"","sources":["../../src/ModuleQueryResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAC9D,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;
|
|
1
|
+
{"version":3,"file":"ModuleQueryResult.d.ts","sourceRoot":"","sources":["../../src/ModuleQueryResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAC9D,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAE3E,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,EAAE,CAAC,SAAS,WAAW,GAAG,WAAW,EAAE,CAAC,SAAS,YAAY,GAAG,YAAY,IAAI;IACvI,QAAQ,CAAC,CAAC,CAAC;IACX,QAAQ,CAAC,CAAC,CAAC,EAAE;IACb,QAAQ,CAAC,CAAC,CAAC,EAAE;CACd,CAAA"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { BoundWitness } from '@xyo-network/boundwitness-model';
|
|
2
|
-
import { ModuleError, Payload } from '@xyo-network/payload-model';
|
|
3
|
-
export type ModuleQueryResult =
|
|
2
|
+
import { ModuleError, Payload, WithMeta } from '@xyo-network/payload-model';
|
|
3
|
+
export type ModuleQueryResult<P extends Payload = Payload, E extends ModuleError = ModuleError, B extends BoundWitness = BoundWitness> = [
|
|
4
|
+
WithMeta<B>,
|
|
5
|
+
WithMeta<P>[],
|
|
6
|
+
WithMeta<E>[]
|
|
7
|
+
];
|
|
4
8
|
//# sourceMappingURL=ModuleQueryResult.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModuleQueryResult.d.ts","sourceRoot":"","sources":["../../src/ModuleQueryResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAC9D,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;
|
|
1
|
+
{"version":3,"file":"ModuleQueryResult.d.ts","sourceRoot":"","sources":["../../src/ModuleQueryResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAC9D,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAE3E,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,EAAE,CAAC,SAAS,WAAW,GAAG,WAAW,EAAE,CAAC,SAAS,YAAY,GAAG,YAAY,IAAI;IACvI,QAAQ,CAAC,CAAC,CAAC;IACX,QAAQ,CAAC,CAAC,CAAC,EAAE;IACb,QAAQ,CAAC,CAAC,CAAC,EAAE;CACd,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Payload } from '@xyo-network/payload-model';
|
|
1
|
+
import { Payload, WithMeta } from '@xyo-network/payload-model';
|
|
2
2
|
export interface StateDictionary {
|
|
3
3
|
[key: string]: string | number | undefined;
|
|
4
4
|
}
|
|
@@ -11,4 +11,7 @@ export type ModuleState<T extends StateDictionary = StateDictionary> = Payload<S
|
|
|
11
11
|
export declare const isModuleState: <T extends StateDictionary = StateDictionary>(payload?: Payload | null) => payload is import("@xyo-network/payload-model").SchemaFields & object & State<T> & {
|
|
12
12
|
schema: "network.xyo.module.state";
|
|
13
13
|
};
|
|
14
|
+
export declare const isModuleStateWithMeta: <T extends StateDictionary = StateDictionary>(payload?: Payload | null) => payload is WithMeta<import("@xyo-network/payload-model").SchemaFields & object & State<T> & {
|
|
15
|
+
schema: "network.xyo.module.state";
|
|
16
|
+
}>;
|
|
14
17
|
//# sourceMappingURL=ModuleState.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModuleState.d.ts","sourceRoot":"","sources":["../../../src/Payload/ModuleState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,OAAO,EAAE,MAAM,4BAA4B,CAAA;
|
|
1
|
+
{"version":3,"file":"ModuleState.d.ts","sourceRoot":"","sources":["../../../src/Payload/ModuleState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAErF,MAAM,WAAW,eAAe;IAC9B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;CAC3C;AACD,MAAM,WAAW,KAAK,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe;IAChE,KAAK,EAAE,CAAC,CAAA;CACT;AAED,eAAO,MAAM,iBAAiB,4BAAsC,CAAA;AACpE,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAA;AAExD,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAA;AAE3G,eAAO,MAAM,aAAa,0DAA2D,OAAO,GAAG,IAAI;;CAElG,CAAA;AAED,eAAO,MAAM,qBAAqB,0DAA2D,OAAO,GAAG,IAAI;;EAE1G,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Payload } from '@xyo-network/payload-model';
|
|
1
|
+
import { Payload, WithMeta } from '@xyo-network/payload-model';
|
|
2
2
|
export interface StateDictionary {
|
|
3
3
|
[key: string]: string | number | undefined;
|
|
4
4
|
}
|
|
@@ -11,4 +11,7 @@ export type ModuleState<T extends StateDictionary = StateDictionary> = Payload<S
|
|
|
11
11
|
export declare const isModuleState: <T extends StateDictionary = StateDictionary>(payload?: Payload | null) => payload is import("@xyo-network/payload-model").SchemaFields & object & State<T> & {
|
|
12
12
|
schema: "network.xyo.module.state";
|
|
13
13
|
};
|
|
14
|
+
export declare const isModuleStateWithMeta: <T extends StateDictionary = StateDictionary>(payload?: Payload | null) => payload is WithMeta<import("@xyo-network/payload-model").SchemaFields & object & State<T> & {
|
|
15
|
+
schema: "network.xyo.module.state";
|
|
16
|
+
}>;
|
|
14
17
|
//# sourceMappingURL=ModuleState.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModuleState.d.ts","sourceRoot":"","sources":["../../../src/Payload/ModuleState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,OAAO,EAAE,MAAM,4BAA4B,CAAA;
|
|
1
|
+
{"version":3,"file":"ModuleState.d.ts","sourceRoot":"","sources":["../../../src/Payload/ModuleState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAErF,MAAM,WAAW,eAAe;IAC9B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;CAC3C;AACD,MAAM,WAAW,KAAK,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe;IAChE,KAAK,EAAE,CAAC,CAAA;CACT;AAED,eAAO,MAAM,iBAAiB,4BAAsC,CAAA;AACpE,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAA;AAExD,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAA;AAE3G,eAAO,MAAM,aAAa,0DAA2D,OAAO,GAAG,IAAI;;CAElG,CAAA;AAED,eAAO,MAAM,qBAAqB,0DAA2D,OAAO,GAAG,IAAI;;EAE1G,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Payload } from '@xyo-network/payload-model';
|
|
1
|
+
import { Payload, WithMeta } from '@xyo-network/payload-model';
|
|
2
2
|
export interface StateDictionary {
|
|
3
3
|
[key: string]: string | number | undefined;
|
|
4
4
|
}
|
|
@@ -11,4 +11,7 @@ export type ModuleState<T extends StateDictionary = StateDictionary> = Payload<S
|
|
|
11
11
|
export declare const isModuleState: <T extends StateDictionary = StateDictionary>(payload?: Payload | null) => payload is import("@xyo-network/payload-model").SchemaFields & object & State<T> & {
|
|
12
12
|
schema: "network.xyo.module.state";
|
|
13
13
|
};
|
|
14
|
+
export declare const isModuleStateWithMeta: <T extends StateDictionary = StateDictionary>(payload?: Payload | null) => payload is WithMeta<import("@xyo-network/payload-model").SchemaFields & object & State<T> & {
|
|
15
|
+
schema: "network.xyo.module.state";
|
|
16
|
+
}>;
|
|
14
17
|
//# sourceMappingURL=ModuleState.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModuleState.d.ts","sourceRoot":"","sources":["../../../src/Payload/ModuleState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,OAAO,EAAE,MAAM,4BAA4B,CAAA;
|
|
1
|
+
{"version":3,"file":"ModuleState.d.ts","sourceRoot":"","sources":["../../../src/Payload/ModuleState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAErF,MAAM,WAAW,eAAe;IAC9B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;CAC3C;AACD,MAAM,WAAW,KAAK,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe;IAChE,KAAK,EAAE,CAAC,CAAA;CACT;AAED,eAAO,MAAM,iBAAiB,4BAAsC,CAAA;AACpE,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAA;AAExD,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAA;AAE3G,eAAO,MAAM,aAAa,0DAA2D,OAAO,GAAG,IAAI;;CAElG,CAAA;AAED,eAAO,MAAM,qBAAqB,0DAA2D,OAAO,GAAG,IAAI;;EAE1G,CAAA"}
|
package/dist/browser/index.cjs
CHANGED
|
@@ -48,6 +48,7 @@ __export(src_exports, {
|
|
|
48
48
|
isModuleObject: () => isModuleObject,
|
|
49
49
|
isModuleResolver: () => isModuleResolver,
|
|
50
50
|
isModuleState: () => isModuleState,
|
|
51
|
+
isModuleStateWithMeta: () => isModuleStateWithMeta,
|
|
51
52
|
requiredModuleInstanceFunctions: () => requiredModuleInstanceFunctions,
|
|
52
53
|
requiredModuleQueries: () => requiredModuleQueries,
|
|
53
54
|
requiredModuleShape: () => requiredModuleShape,
|
|
@@ -394,6 +395,9 @@ var ModuleStateSchema = "network.xyo.module.state";
|
|
|
394
395
|
var isModuleState = /* @__PURE__ */ __name((payload) => {
|
|
395
396
|
return (0, import_payload_model.isPayloadOfSchemaType)(ModuleStateSchema)(payload);
|
|
396
397
|
}, "isModuleState");
|
|
398
|
+
var isModuleStateWithMeta = /* @__PURE__ */ __name((payload) => {
|
|
399
|
+
return (0, import_payload_model.isPayloadOfSchemaType)(ModuleStateSchema)(payload);
|
|
400
|
+
}, "isModuleStateWithMeta");
|
|
397
401
|
|
|
398
402
|
// src/withModule.ts
|
|
399
403
|
var WithFactory = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts","../../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":["export * from './Config'\nexport * from './CreatableModule'\nexport * from './EventsModels'\nexport * from './instance'\nexport * from './Labels'\nexport * from './lib'\nexport * from './module'\nexport * from './ModuleDescription'\nexport * from './ModuleParams'\nexport * from './ModuleQueryHandlerResult'\nexport * from './ModuleQueryResult'\nexport * from './Payload'\nexport * from './Queries'\nexport * from './withModule'\n","import { Address } from '@xylabs/hex'\nimport { EmptyObject, WithAdditional } from '@xylabs/object'\nimport { RetryConfig } from '@xylabs/retry'\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 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 readonly retry?: RetryConfig\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 '@xylabs/object'\n\nimport { isModuleInstance } from './isModuleInstance'\n\nexport const asModuleInstance = AsObjectFactory.create(isModuleInstance)\n","import { IsObjectFactory, ObjectTypeShape, TypeCheck } from '@xylabs/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 '@xylabs/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 '@xylabs/object'\n\nimport { isModuleObject } from './isModuleObject'\n\nexport const asModuleObject = AsObjectFactory.create(isModuleObject)\n","import { IsObjectFactory, ObjectTypeShape } from '@xylabs/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 '@xylabs/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 '@xylabs/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 { IsObjectFactory, TypeCheck } from '@xylabs/object'\nimport { Promisable } from '@xylabs/promise'\n\nimport { ModuleEventData } from '../EventsModels'\nimport { Module, ModuleQueryFunctions } from '../module'\nimport { ModuleParams } from '../ModuleParams'\n\nexport type ModulePipeLine = 'one-to-one' | 'one-to-many' | 'many-to-one' | 'many-to-many'\n\nexport const isModuleResolver = (value?: unknown): value is ModuleResolver => {\n return typeof (value as Partial<ModuleResolver>).resolve === 'function'\n}\n\nexport interface ModuleResolver {\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 ModuleResolverInstance extends ModuleResolver {\n addResolver: (resolver: ModuleResolverInstance) => this\n removeResolver: (resolver: ModuleResolverInstance) => this\n}\n\nexport interface ModuleInstance<TParams extends ModuleParams = ModuleParams, TEventData extends ModuleEventData = ModuleEventData>\n extends Module<TParams, TEventData>,\n ModuleResolver,\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<ModuleResolverInstance, 'resolve'>\n\n readonly pipeline?: ModulePipeLine\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<ModuleResolverInstance, '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 '@xylabs/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":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACQO,IAAMA,qBAAyC;;;ACiB/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,oBAAyB;AACzB,oBAAsB;AAOf,IAAMC,gBAAN,MAAMA,eAAAA;EARb,OAQaA;;;EACXC;EAEAC;EAEAC;EAEAC;EAEAC;EAEAC,YACEJ,kBACAK,QACAF,SAAiB,CAAC,GAClB;AACA,SAAKH,kBAAkBA;AACvB,SAAKE,gBAAgBG;AACrB,SAAKN,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AA;AAChC,aAAOO,yBAAS;OAAIjB;OAAwBM;GAAkB,EAAEI,KAAAA;AAClE,GAFiC;;;AC9BjC,2BAA+C;AASxC,IAAMW,oBAAoB;AAK1B,IAAMC,gBAAgB,wBAA8CC,YAAAA;AACzE,aAAOC,4CAAsCH,iBAAAA,EAAmBE,OAAAA;AAClE,GAF6B;;;ACTtB,IAAME,cAAc;EACzBC,QAAQ,CAAmBC,cAAAA;AACzB,WAAO,CAELC,SAEAC,YAAAA;AAEA,aAAOF,UAAUC,OAAAA,IAAUC,QAAQD,OAAAA,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","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","import_assert","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","import_object","import_object","import_object","ModuleDescriptionSchema","ModuleDescribeQuerySchema","ModuleDiscoverQuerySchema","ModuleManifestQuerySchema","AddressPreviousHashSchema","AddressSchema","ModuleAddressQuerySchema","ModuleSubscribeQuerySchema","import_object","requiredModuleShape","address","config","params","queries","query","queryable","factory","IsObjectFactory","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","import_object","isModuleResolver","value","resolve","IsInstanceFactory","IsObjectFactory","duplicateModules","value","index","array","findIndex","v","address","import_lodash","JSONPrimitiveChecks","isUndefined","isNull","isBoolean","isNumber","isString","JSONComplexChecks","isPlainObject","isArray","serializable","field","depth","depthExceeded","decrementDepth","undefined","recursiveSerializable","nestedSerializable","overSome","every","valid","serializableField","ModuleStateSchema","isModuleState","payload","isPayloadOfSchemaType","WithFactory","create","typeCheck","module","closure","undefined","withModule","isModule","withModuleInstance","isModuleInstance"]}
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../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":["export * from './Config'\nexport * from './CreatableModule'\nexport * from './EventsModels'\nexport * from './instance'\nexport * from './Labels'\nexport * from './lib'\nexport * from './module'\nexport * from './ModuleDescription'\nexport * from './ModuleParams'\nexport * from './ModuleQueryHandlerResult'\nexport * from './ModuleQueryResult'\nexport * from './Payload'\nexport * from './Queries'\nexport * from './withModule'\n","import { Address } from '@xylabs/hex'\nimport { EmptyObject, WithAdditional } from '@xylabs/object'\nimport { RetryConfig } from '@xylabs/retry'\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 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 readonly retry?: RetryConfig\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 '@xylabs/object'\n\nimport { isModuleInstance } from './isModuleInstance'\n\nexport const asModuleInstance = AsObjectFactory.create(isModuleInstance)\n","import { IsObjectFactory, ObjectTypeShape, TypeCheck } from '@xylabs/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 '@xylabs/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 '@xylabs/object'\n\nimport { isModuleObject } from './isModuleObject'\n\nexport const asModuleObject = AsObjectFactory.create(isModuleObject)\n","import { IsObjectFactory, ObjectTypeShape } from '@xylabs/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 '@xylabs/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 '@xylabs/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 { IsObjectFactory, TypeCheck } from '@xylabs/object'\nimport { Promisable } from '@xylabs/promise'\n\nimport { ModuleEventData } from '../EventsModels'\nimport { Module, ModuleQueryFunctions } from '../module'\nimport { ModuleParams } from '../ModuleParams'\n\nexport type ModulePipeLine = 'one-to-one' | 'one-to-many' | 'many-to-one' | 'many-to-many'\n\nexport const isModuleResolver = (value?: unknown): value is ModuleResolver => {\n return typeof (value as Partial<ModuleResolver>).resolve === 'function'\n}\n\nexport interface ModuleResolver {\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 ModuleResolverInstance extends ModuleResolver {\n addResolver: (resolver: ModuleResolverInstance) => this\n removeResolver: (resolver: ModuleResolverInstance) => this\n}\n\nexport interface ModuleInstance<TParams extends ModuleParams = ModuleParams, TEventData extends ModuleEventData = ModuleEventData>\n extends Module<TParams, TEventData>,\n ModuleResolver,\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<ModuleResolverInstance, 'resolve'>\n\n readonly pipeline?: ModulePipeLine\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<ModuleResolverInstance, '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, WithMeta } 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\nexport const isModuleStateWithMeta = <T extends StateDictionary = StateDictionary>(payload?: Payload | null): payload is WithMeta<ModuleState<T>> => {\n return isPayloadOfSchemaType<WithMeta<ModuleState<T>>>(ModuleStateSchema)(payload)\n}\n","import { TypeCheck } from '@xylabs/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":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACQO,IAAMA,qBAAyC;;;ACiB/C,SAASC,kBAAAA;AACd,SAAO,CAAqCC,gBAAAA;AAC1CA;EACF;AACF;AAJgBD;;;ACjBT,IAAME,4BAA4B,wBAACC,SAAAA;AAExC,SAAOC,O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AC,YAAAA;AAEA,aAAOF,UAAUC,OAAAA,IAAUC,QAAQD,OAAAA,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","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","import_assert","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","import_object","import_object","import_object","ModuleDescriptionSchema","ModuleDescribeQuerySchema","ModuleDiscoverQuerySchema","ModuleManifestQuerySchema","AddressPreviousHashSchema","AddressSchema","ModuleAddressQuerySchema","ModuleSubscribeQuerySchema","import_object","requiredModuleShape","address","config","params","queries","query","queryable","factory","IsObjectFactory","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","import_object","isModuleResolver","value","resolve","IsInstanceFactory","IsObjectFactory","duplicateModules","value","index","array","findIndex","v","address","import_lodash","JSONPrimitiveChecks","isUndefined","isNull","isBoolean","isNumber","isString","JSONComplexChecks","isPlainObject","isArray","serializable","field","depth","depthExceeded","decrementDepth","undefined","recursiveSerializable","nestedSerializable","overSome","every","valid","serializableField","ModuleStateSchema","isModuleState","payload","isPayloadOfSchemaType","isModuleStateWithMeta","WithFactory","create","typeCheck","module","closure","undefined","withModule","isModule","withModuleInstance","isModuleInstance"]}
|
package/dist/browser/index.js
CHANGED
|
@@ -336,6 +336,9 @@ var ModuleStateSchema = "network.xyo.module.state";
|
|
|
336
336
|
var isModuleState = /* @__PURE__ */ __name((payload) => {
|
|
337
337
|
return isPayloadOfSchemaType(ModuleStateSchema)(payload);
|
|
338
338
|
}, "isModuleState");
|
|
339
|
+
var isModuleStateWithMeta = /* @__PURE__ */ __name((payload) => {
|
|
340
|
+
return isPayloadOfSchemaType(ModuleStateSchema)(payload);
|
|
341
|
+
}, "isModuleStateWithMeta");
|
|
339
342
|
|
|
340
343
|
// src/withModule.ts
|
|
341
344
|
var WithFactory = {
|
|
@@ -375,6 +378,7 @@ export {
|
|
|
375
378
|
isModuleObject,
|
|
376
379
|
isModuleResolver,
|
|
377
380
|
isModuleState,
|
|
381
|
+
isModuleStateWithMeta,
|
|
378
382
|
requiredModuleInstanceFunctions,
|
|
379
383
|
requiredModuleQueries,
|
|
380
384
|
requiredModuleShape,
|
|
@@ -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 '@xylabs/object'\nimport { RetryConfig } from '@xylabs/retry'\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 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 readonly retry?: RetryConfig\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 '@xylabs/object'\n\nimport { isModuleInstance } from './isModuleInstance'\n\nexport const asModuleInstance = AsObjectFactory.create(isModuleInstance)\n","import { IsObjectFactory, ObjectTypeShape, TypeCheck } from '@xylabs/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 '@xylabs/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 '@xylabs/object'\n\nimport { isModuleObject } from './isModuleObject'\n\nexport const asModuleObject = AsObjectFactory.create(isModuleObject)\n","import { IsObjectFactory, ObjectTypeShape } from '@xylabs/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 '@xylabs/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 '@xylabs/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 { IsObjectFactory, TypeCheck } from '@xylabs/object'\nimport { Promisable } from '@xylabs/promise'\n\nimport { ModuleEventData } from '../EventsModels'\nimport { Module, ModuleQueryFunctions } from '../module'\nimport { ModuleParams } from '../ModuleParams'\n\nexport type ModulePipeLine = 'one-to-one' | 'one-to-many' | 'many-to-one' | 'many-to-many'\n\nexport const isModuleResolver = (value?: unknown): value is ModuleResolver => {\n return typeof (value as Partial<ModuleResolver>).resolve === 'function'\n}\n\nexport interface ModuleResolver {\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 ModuleResolverInstance extends ModuleResolver {\n addResolver: (resolver: ModuleResolverInstance) => this\n removeResolver: (resolver: ModuleResolverInstance) => this\n}\n\nexport interface ModuleInstance<TParams extends ModuleParams = ModuleParams, TEventData extends ModuleEventData = ModuleEventData>\n extends Module<TParams, TEventData>,\n ModuleResolver,\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<ModuleResolverInstance, 'resolve'>\n\n readonly pipeline?: ModulePipeLine\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<ModuleResolverInstance, '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 '@xylabs/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":";;;;AAQO,IAAMA,qBAAyC;;;ACiB/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,QA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AOM,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","isModuleResolver","value","resolve","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"]}
|
|
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 '@xylabs/object'\nimport { RetryConfig } from '@xylabs/retry'\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 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 readonly retry?: RetryConfig\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 '@xylabs/object'\n\nimport { isModuleInstance } from './isModuleInstance'\n\nexport const asModuleInstance = AsObjectFactory.create(isModuleInstance)\n","import { IsObjectFactory, ObjectTypeShape, TypeCheck } from '@xylabs/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 '@xylabs/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 '@xylabs/object'\n\nimport { isModuleObject } from './isModuleObject'\n\nexport const asModuleObject = AsObjectFactory.create(isModuleObject)\n","import { IsObjectFactory, ObjectTypeShape } from '@xylabs/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 '@xylabs/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 '@xylabs/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 { IsObjectFactory, TypeCheck } from '@xylabs/object'\nimport { Promisable } from '@xylabs/promise'\n\nimport { ModuleEventData } from '../EventsModels'\nimport { Module, ModuleQueryFunctions } from '../module'\nimport { ModuleParams } from '../ModuleParams'\n\nexport type ModulePipeLine = 'one-to-one' | 'one-to-many' | 'many-to-one' | 'many-to-many'\n\nexport const isModuleResolver = (value?: unknown): value is ModuleResolver => {\n return typeof (value as Partial<ModuleResolver>).resolve === 'function'\n}\n\nexport interface ModuleResolver {\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 ModuleResolverInstance extends ModuleResolver {\n addResolver: (resolver: ModuleResolverInstance) => this\n removeResolver: (resolver: ModuleResolverInstance) => this\n}\n\nexport interface ModuleInstance<TParams extends ModuleParams = ModuleParams, TEventData extends ModuleEventData = ModuleEventData>\n extends Module<TParams, TEventData>,\n ModuleResolver,\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<ModuleResolverInstance, 'resolve'>\n\n readonly pipeline?: ModulePipeLine\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<ModuleResolverInstance, '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, WithMeta } 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\nexport const isModuleStateWithMeta = <T extends StateDictionary = StateDictionary>(payload?: Payload | null): payload is WithMeta<ModuleState<T>> => {\n return isPayloadOfSchemaType<WithMeta<ModuleState<T>>>(ModuleStateSchema)(payload)\n}\n","import { TypeCheck } from '@xylabs/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":";;;;AAQO,IAAMA,qBAAyC;;;ACiB/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;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gB;AAChB,aAAO;IACT;AAGAC,mBAAAA;AAEA,UAAMG,qBAAqB,wBAACN,WAA4BO,SAASX,iBAAAA,EAAmBI,MAAAA,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,6BAAgD;AASlD,IAAMC,oBAAoB;AAK1B,IAAMC,gBAAgB,wBAA8CC,YAAAA;AACzE,SAAOC,sBAAsCH,iBAAAA,EAAmBE,OAAAA;AAClE,GAF6B;AAItB,IAAME,wBAAwB,wBAA8CF,YAAAA;AACjF,SAAOC,sBAAgDH,iBAAAA,EAAmBE,OAAAA;AAC5E,GAFqC;;;ACb9B,IAAMG,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","isModuleResolver","value","resolve","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","isModuleStateWithMeta","WithFactory","create","typeCheck","module","closure","undefined","withModule","isModule","withModuleInstance","isModuleInstance"]}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { BoundWitness } from '@xyo-network/boundwitness-model';
|
|
2
|
-
import { ModuleError, Payload } from '@xyo-network/payload-model';
|
|
3
|
-
export type ModuleQueryResult =
|
|
2
|
+
import { ModuleError, Payload, WithMeta } from '@xyo-network/payload-model';
|
|
3
|
+
export type ModuleQueryResult<P extends Payload = Payload, E extends ModuleError = ModuleError, B extends BoundWitness = BoundWitness> = [
|
|
4
|
+
WithMeta<B>,
|
|
5
|
+
WithMeta<P>[],
|
|
6
|
+
WithMeta<E>[]
|
|
7
|
+
];
|
|
4
8
|
//# sourceMappingURL=ModuleQueryResult.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModuleQueryResult.d.ts","sourceRoot":"","sources":["../../src/ModuleQueryResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAC9D,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;
|
|
1
|
+
{"version":3,"file":"ModuleQueryResult.d.ts","sourceRoot":"","sources":["../../src/ModuleQueryResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAC9D,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAE3E,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,EAAE,CAAC,SAAS,WAAW,GAAG,WAAW,EAAE,CAAC,SAAS,YAAY,GAAG,YAAY,IAAI;IACvI,QAAQ,CAAC,CAAC,CAAC;IACX,QAAQ,CAAC,CAAC,CAAC,EAAE;IACb,QAAQ,CAAC,CAAC,CAAC,EAAE;CACd,CAAA"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { BoundWitness } from '@xyo-network/boundwitness-model';
|
|
2
|
-
import { ModuleError, Payload } from '@xyo-network/payload-model';
|
|
3
|
-
export type ModuleQueryResult =
|
|
2
|
+
import { ModuleError, Payload, WithMeta } from '@xyo-network/payload-model';
|
|
3
|
+
export type ModuleQueryResult<P extends Payload = Payload, E extends ModuleError = ModuleError, B extends BoundWitness = BoundWitness> = [
|
|
4
|
+
WithMeta<B>,
|
|
5
|
+
WithMeta<P>[],
|
|
6
|
+
WithMeta<E>[]
|
|
7
|
+
];
|
|
4
8
|
//# sourceMappingURL=ModuleQueryResult.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModuleQueryResult.d.ts","sourceRoot":"","sources":["../../src/ModuleQueryResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAC9D,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;
|
|
1
|
+
{"version":3,"file":"ModuleQueryResult.d.ts","sourceRoot":"","sources":["../../src/ModuleQueryResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAC9D,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAE3E,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,EAAE,CAAC,SAAS,WAAW,GAAG,WAAW,EAAE,CAAC,SAAS,YAAY,GAAG,YAAY,IAAI;IACvI,QAAQ,CAAC,CAAC,CAAC;IACX,QAAQ,CAAC,CAAC,CAAC,EAAE;IACb,QAAQ,CAAC,CAAC,CAAC,EAAE;CACd,CAAA"}
|