@xyo-network/module-model 2.84.19 → 2.85.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/Config.d.cts +0 -2
- package/dist/browser/Config.d.cts.map +1 -1
- package/dist/browser/Config.d.mts +0 -2
- package/dist/browser/Config.d.mts.map +1 -1
- package/dist/browser/Config.d.ts +0 -2
- package/dist/browser/Config.d.ts.map +1 -1
- package/dist/browser/ModuleParams.d.cts +0 -2
- package/dist/browser/ModuleParams.d.cts.map +1 -1
- package/dist/browser/ModuleParams.d.mts +0 -2
- package/dist/browser/ModuleParams.d.mts.map +1 -1
- package/dist/browser/ModuleParams.d.ts +0 -2
- package/dist/browser/ModuleParams.d.ts.map +1 -1
- package/dist/browser/index.cjs +104 -65
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.js +106 -65
- package/dist/browser/index.js.map +1 -1
- package/dist/node/Config.d.cts +0 -2
- package/dist/node/Config.d.cts.map +1 -1
- package/dist/node/Config.d.mts +0 -2
- package/dist/node/Config.d.mts.map +1 -1
- package/dist/node/Config.d.ts +0 -2
- package/dist/node/Config.d.ts.map +1 -1
- package/dist/node/ModuleParams.d.cts +0 -2
- package/dist/node/ModuleParams.d.cts.map +1 -1
- package/dist/node/ModuleParams.d.mts +0 -2
- package/dist/node/ModuleParams.d.mts.map +1 -1
- package/dist/node/ModuleParams.d.ts +0 -2
- package/dist/node/ModuleParams.d.ts.map +1 -1
- package/dist/node/index.cjs +104 -69
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.js +106 -69
- package/dist/node/index.js.map +1 -1
- package/package.json +8 -9
- package/src/Config.ts +0 -3
- package/src/ModuleParams.ts +0 -2
|
@@ -14,8 +14,6 @@ export interface ArchivingModuleConfig {
|
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
export type ModuleConfig<TConfig extends EmptyObject | Payload | void = void, TSchema extends Schema | void = void> = Payload<WithAdditional<{
|
|
17
|
-
/** @field The path to use when creating the account */
|
|
18
|
-
accountDerivationPath?: string;
|
|
19
17
|
/** @field The name/address of the Archivist to use for this module */
|
|
20
18
|
readonly archivist?: NameOrAddress;
|
|
21
19
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../src/Config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACrC,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAE5D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,MAAM,MAAM,kBAAkB,GAAG,2BAA2B,CAAA;AAC5D,eAAO,MAAM,kBAAkB,EAAE,kBAAgD,CAAA;AAEjF,MAAM,MAAM,mBAAmB,GAAG,MAAM,EAAE,CAAA;AAC1C,MAAM,MAAM,YAAY,GAAG,MAAM,CAAA;AACjC,MAAM,MAAM,UAAU,GAAG,MAAM,CAAA;AAC/B,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,UAAU,CAAA;AAEhD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,SAAS,CAAC,EAAE;QACnB,QAAQ,CAAC,UAAU,CAAC,EAAE,aAAa,EAAE,CAAA;KACtC,CAAA;CACF;AAED,MAAM,MAAM,YAAY,CAAC,OAAO,SAAS,WAAW,GAAG,OAAO,GAAG,IAAI,GAAG,IAAI,EAAE,OAAO,SAAS,MAAM,GAAG,IAAI,GAAG,IAAI,IAAI,OAAO,CAC3H,cAAc,CACZ;IACE,
|
|
1
|
+
{"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../src/Config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACrC,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA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EjC,gFAAgF;QAChF,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,YAAY,EAAE,CAAC,OAAO,GAAG,mBAAmB,CAAC,EAAE,CAAC,CAAA;QAE1E,sFAAsF;QACtF,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,YAAY,EAAE,OAAO,EAAE,CAAC,CAAA;KACtD,CAAA;IAED,8BAA8B;IAC9B,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAA;IAEvB,8EAA8E;IAC9E,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAA;IAE/B,qDAAqD;IACrD,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAC7B,GAAG,qBAAqB,EACzB,OAAO,CACR,EACD,OAAO,CACR,CAAA;AAED,MAAM,MAAM,eAAe,CAAC,OAAO,SAAS,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,IAC/I,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;AAE/B,MAAM,MAAM,oBAAoB,CAAC,OAAO,SAAS,eAAe,CAAC,YAAY,CAAC,GAAG,eAAe,CAAC,YAAY,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG;IAC1I,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,eAAe,CAAC,YAAY,CAAC,CAAA"}
|
|
@@ -14,8 +14,6 @@ export interface ArchivingModuleConfig {
|
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
export type ModuleConfig<TConfig extends EmptyObject | Payload | void = void, TSchema extends Schema | void = void> = Payload<WithAdditional<{
|
|
17
|
-
/** @field The path to use when creating the account */
|
|
18
|
-
accountDerivationPath?: string;
|
|
19
17
|
/** @field The name/address of the Archivist to use for this module */
|
|
20
18
|
readonly archivist?: NameOrAddress;
|
|
21
19
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../src/Config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACrC,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAE5D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,MAAM,MAAM,kBAAkB,GAAG,2BAA2B,CAAA;AAC5D,eAAO,MAAM,kBAAkB,EAAE,kBAAgD,CAAA;AAEjF,MAAM,MAAM,mBAAmB,GAAG,MAAM,EAAE,CAAA;AAC1C,MAAM,MAAM,YAAY,GAAG,MAAM,CAAA;AACjC,MAAM,MAAM,UAAU,GAAG,MAAM,CAAA;AAC/B,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,UAAU,CAAA;AAEhD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,SAAS,CAAC,EAAE;QACnB,QAAQ,CAAC,UAAU,CAAC,EAAE,aAAa,EAAE,CAAA;KACtC,CAAA;CACF;AAED,MAAM,MAAM,YAAY,CAAC,OAAO,SAAS,WAAW,GAAG,OAAO,GAAG,IAAI,GAAG,IAAI,EAAE,OAAO,SAAS,MAAM,GAAG,IAAI,GAAG,IAAI,IAAI,OAAO,CAC3H,cAAc,CACZ;IACE,
|
|
1
|
+
{"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../src/Config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACrC,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACjE,OAAO,EAAE,OAAO,EAAE,MAA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AO,CAAC,EAAE,MAAM,CAAC,YAAY,EAAE,CAAC,OAAO,GAAG,mBAAmB,CAAC,EAAE,CAAC,CAAA;QAE1E,sFAAsF;QACtF,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,YAAY,EAAE,OAAO,EAAE,CAAC,CAAA;KACtD,CAAA;IAED,8BAA8B;IAC9B,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAA;IAEvB,8EAA8E;IAC9E,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAA;IAE/B,qDAAqD;IACrD,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAC7B,GAAG,qBAAqB,EACzB,OAAO,CACR,EACD,OAAO,CACR,CAAA;AAED,MAAM,MAAM,eAAe,CAAC,OAAO,SAAS,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,IAC/I,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;AAE/B,MAAM,MAAM,oBAAoB,CAAC,OAAO,SAAS,eAAe,CAAC,YAAY,CAAC,GAAG,eAAe,CAAC,YAAY,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG;IAC1I,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,eAAe,CAAC,YAAY,CAAC,CAAA"}
|
package/dist/browser/Config.d.ts
CHANGED
|
@@ -14,8 +14,6 @@ export interface ArchivingModuleConfig {
|
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
export type ModuleConfig<TConfig extends EmptyObject | Payload | void = void, TSchema extends Schema | void = void> = Payload<WithAdditional<{
|
|
17
|
-
/** @field The path to use when creating the account */
|
|
18
|
-
accountDerivationPath?: string;
|
|
19
17
|
/** @field The name/address of the Archivist to use for this module */
|
|
20
18
|
readonly archivist?: NameOrAddress;
|
|
21
19
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../src/Config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACrC,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAE5D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,MAAM,MAAM,kBAAkB,GAAG,2BAA2B,CAAA;AAC5D,eAAO,MAAM,kBAAkB,EAAE,kBAAgD,CAAA;AAEjF,MAAM,MAAM,mBAAmB,GAAG,MAAM,EAAE,CAAA;AAC1C,MAAM,MAAM,YAAY,GAAG,MAAM,CAAA;AACjC,MAAM,MAAM,UAAU,GAAG,MAAM,CAAA;AAC/B,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,UAAU,CAAA;AAEhD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,SAAS,CAAC,EAAE;QACnB,QAAQ,CAAC,UAAU,CAAC,EAAE,aAAa,EAAE,CAAA;KACtC,CAAA;CACF;AAED,MAAM,MAAM,YAAY,CAAC,OAAO,SAAS,WAAW,GAAG,OAAO,GAAG,IAAI,GAAG,IAAI,EAAE,OAAO,SAAS,MAAM,GAAG,IAAI,GAAG,IAAI,IAAI,OAAO,CAC3H,cAAc,CACZ;IACE,
|
|
1
|
+
{"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../src/Config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACrC,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,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,EAAE,MAAM,CAAC,YAAY,EAAE,CAAC,OAAO,GAAG,mBAAmB,CAAC,EAAE,CAAC,CAAA;QAE1E,sFAAsF;QACtF,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,YAAY,EAAE,OAAO,EAAE,CAAC,CAAA;KACtD,CAAA;IAED,8BAA8B;IAC9B,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAA;IAEvB,8EAA8E;IAC9E,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAA;IAE/B,qDAAqD;IACrD,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAC7B,GAAG,qBAAqB,EACzB,OAAO,CACR,EACD,OAAO,CACR,CAAA;AAED,MAAM,MAAM,eAAe,CAAC,OAAO,SAAS,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,IAC/I,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;AAE/B,MAAM,MAAM,oBAAoB,CAAC,OAAO,SAAS,eAAe,CAAC,YAAY,CAAC,GAAG,eAAe,CAAC,YAAY,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG;IAC1I,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,eAAe,CAAC,YAAY,CAAC,CAAA"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { AccountInstance } from '@xyo-network/account-model';
|
|
2
2
|
import { BaseParams, EmptyObject, WithAdditional } from '@xyo-network/object';
|
|
3
|
-
import { WalletInstance } from '@xyo-network/wallet-model';
|
|
4
3
|
import { AnyConfigSchema, ModuleConfig } from './Config';
|
|
5
4
|
export type ModuleParams<TConfig extends AnyConfigSchema<ModuleConfig> | void = void, TAdditionalParams extends EmptyObject | void = void> = WithAdditional<BaseParams<{
|
|
6
5
|
account?: AccountInstance | 'random';
|
|
7
6
|
config: TConfig extends AnyConfigSchema<ModuleConfig> ? TConfig : AnyConfigSchema<ModuleConfig>;
|
|
8
7
|
ephemeralQueryAccountEnabled?: boolean;
|
|
9
|
-
wallet?: WalletInstance;
|
|
10
8
|
}>, TAdditionalParams>;
|
|
11
9
|
//# sourceMappingURL=ModuleParams.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModuleParams.d.ts","sourceRoot":"","sources":["../../src/ModuleParams.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAC5D,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"ModuleParams.d.ts","sourceRoot":"","sources":["../../src/ModuleParams.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAC5D,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAE7E,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAExD,MAAM,MAAM,YAAY,CACtB,OAAO,SAAS,eAAe,CAAC,YAAY,CAAC,GAAG,IAAI,GAAG,IAAI,EAC3D,iBAAiB,SAAS,WAAW,GAAG,IAAI,GAAG,IAAI,IACjD,cAAc,CAChB,UAAU,CAAC;IACT,OAAO,CAAC,EAAE,eAAe,GAAG,QAAQ,CAAA;IACpC,MAAM,EAAE,OAAO,SAAS,eAAe,CAAC,YAAY,CAAC,GAAG,OAAO,GAAG,eAAe,CAAC,YAAY,CAAC,CAAA;IAC/F,4BAA4B,CAAC,EAAE,OAAO,CAAA;CACvC,CAAC,EACF,iBAAiB,CAClB,CAAA"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { AccountInstance } from '@xyo-network/account-model';
|
|
2
2
|
import { BaseParams, EmptyObject, WithAdditional } from '@xyo-network/object';
|
|
3
|
-
import { WalletInstance } from '@xyo-network/wallet-model';
|
|
4
3
|
import { AnyConfigSchema, ModuleConfig } from './Config';
|
|
5
4
|
export type ModuleParams<TConfig extends AnyConfigSchema<ModuleConfig> | void = void, TAdditionalParams extends EmptyObject | void = void> = WithAdditional<BaseParams<{
|
|
6
5
|
account?: AccountInstance | 'random';
|
|
7
6
|
config: TConfig extends AnyConfigSchema<ModuleConfig> ? TConfig : AnyConfigSchema<ModuleConfig>;
|
|
8
7
|
ephemeralQueryAccountEnabled?: boolean;
|
|
9
|
-
wallet?: WalletInstance;
|
|
10
8
|
}>, TAdditionalParams>;
|
|
11
9
|
//# sourceMappingURL=ModuleParams.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModuleParams.d.ts","sourceRoot":"","sources":["../../src/ModuleParams.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAC5D,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"ModuleParams.d.ts","sourceRoot":"","sources":["../../src/ModuleParams.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAC5D,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAE7E,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAExD,MAAM,MAAM,YAAY,CACtB,OAAO,SAAS,eAAe,CAAC,YAAY,CAAC,GAAG,IAAI,GAAG,IAAI,EAC3D,iBAAiB,SAAS,WAAW,GAAG,IAAI,GAAG,IAAI,IACjD,cAAc,CAChB,UAAU,CAAC;IACT,OAAO,CAAC,EAAE,eAAe,GAAG,QAAQ,CAAA;IACpC,MAAM,EAAE,OAAO,SAAS,eAAe,CAAC,YAAY,CAAC,GAAG,OAAO,GAAG,eAAe,CAAC,YAAY,CAAC,CAAA;IAC/F,4BAA4B,CAAC,EAAE,OAAO,CAAA;CACvC,CAAC,EACF,iBAAiB,CAClB,CAAA"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { AccountInstance } from '@xyo-network/account-model';
|
|
2
2
|
import { BaseParams, EmptyObject, WithAdditional } from '@xyo-network/object';
|
|
3
|
-
import { WalletInstance } from '@xyo-network/wallet-model';
|
|
4
3
|
import { AnyConfigSchema, ModuleConfig } from './Config';
|
|
5
4
|
export type ModuleParams<TConfig extends AnyConfigSchema<ModuleConfig> | void = void, TAdditionalParams extends EmptyObject | void = void> = WithAdditional<BaseParams<{
|
|
6
5
|
account?: AccountInstance | 'random';
|
|
7
6
|
config: TConfig extends AnyConfigSchema<ModuleConfig> ? TConfig : AnyConfigSchema<ModuleConfig>;
|
|
8
7
|
ephemeralQueryAccountEnabled?: boolean;
|
|
9
|
-
wallet?: WalletInstance;
|
|
10
8
|
}>, TAdditionalParams>;
|
|
11
9
|
//# sourceMappingURL=ModuleParams.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModuleParams.d.ts","sourceRoot":"","sources":["../../src/ModuleParams.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAC5D,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"ModuleParams.d.ts","sourceRoot":"","sources":["../../src/ModuleParams.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAC5D,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAE7E,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAExD,MAAM,MAAM,YAAY,CACtB,OAAO,SAAS,eAAe,CAAC,YAAY,CAAC,GAAG,IAAI,GAAG,IAAI,EAC3D,iBAAiB,SAAS,WAAW,GAAG,IAAI,GAAG,IAAI,IACjD,cAAc,CAChB,UAAU,CAAC;IACT,OAAO,CAAC,EAAE,eAAe,GAAG,QAAQ,CAAA;IACpC,MAAM,EAAE,OAAO,SAAS,eAAe,CAAC,YAAY,CAAC,GAAG,OAAO,GAAG,eAAe,CAAC,YAAY,CAAC,CAAA;IAC/F,4BAA4B,CAAC,EAAE,OAAO,CAAA;CACvC,CAAC,EACF,iBAAiB,CAClB,CAAA"}
|
package/dist/browser/index.cjs
CHANGED
|
@@ -3,6 +3,7 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
7
|
var __export = (target, all) => {
|
|
7
8
|
for (var name in all)
|
|
8
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -66,35 +67,42 @@ function creatableModule() {
|
|
|
66
67
|
constructor;
|
|
67
68
|
};
|
|
68
69
|
}
|
|
70
|
+
__name(creatableModule, "creatableModule");
|
|
69
71
|
|
|
70
72
|
// src/CreatableModule/CreatableModuleRegistry.ts
|
|
71
|
-
var toCreatableModuleRegistry = (dict) => {
|
|
73
|
+
var toCreatableModuleRegistry = /* @__PURE__ */ __name((dict) => {
|
|
72
74
|
return Object.entries(dict).reduce((registry, [schema, factory4]) => {
|
|
73
|
-
registry[schema] = Array.isArray(factory4) ? factory4 : [
|
|
75
|
+
registry[schema] = Array.isArray(factory4) ? factory4 : [
|
|
76
|
+
factory4
|
|
77
|
+
];
|
|
74
78
|
return registry;
|
|
75
79
|
}, {});
|
|
76
|
-
};
|
|
77
|
-
var assignCreatableModuleRegistry = (target = {}, ...sources) => {
|
|
78
|
-
sources.map(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
}, "toCreatableModuleRegistry");
|
|
81
|
+
var assignCreatableModuleRegistry = /* @__PURE__ */ __name((target = {}, ...sources) => {
|
|
82
|
+
sources.map((source) => Object.entries(source).map(([schema, factories]) => {
|
|
83
|
+
if (factories) {
|
|
84
|
+
const existingFactories = target[schema];
|
|
85
|
+
target[schema] = existingFactories ? target[schema] = [
|
|
86
|
+
...existingFactories,
|
|
87
|
+
...factories
|
|
88
|
+
] : factories;
|
|
89
|
+
}
|
|
90
|
+
}));
|
|
86
91
|
return target;
|
|
87
|
-
};
|
|
92
|
+
}, "assignCreatableModuleRegistry");
|
|
88
93
|
|
|
89
94
|
// src/CreatableModule/LabeledCreatableModuleFactory.ts
|
|
90
|
-
var hasLabels = (factory4) => {
|
|
95
|
+
var hasLabels = /* @__PURE__ */ __name((factory4) => {
|
|
91
96
|
return factory4.labels !== void 0;
|
|
92
|
-
};
|
|
97
|
+
}, "hasLabels");
|
|
93
98
|
|
|
94
99
|
// src/CreatableModule/ModuleFactory.ts
|
|
95
100
|
var import_assert = require("@xylabs/assert");
|
|
96
101
|
var import_lodash = require("@xylabs/lodash");
|
|
97
102
|
var ModuleFactory = class _ModuleFactory {
|
|
103
|
+
static {
|
|
104
|
+
__name(this, "ModuleFactory");
|
|
105
|
+
}
|
|
98
106
|
configSchemas;
|
|
99
107
|
creatableModule;
|
|
100
108
|
defaultLogger;
|
|
@@ -128,7 +136,9 @@ var ModuleFactory = class _ModuleFactory {
|
|
|
128
136
|
const factory4 = this;
|
|
129
137
|
const schema = factory4.creatableModule.configSchema;
|
|
130
138
|
const mergedParams = (0, import_lodash.merge)({}, factory4.defaultParams, params, {
|
|
131
|
-
config: (0, import_lodash.merge)({}, factory4.defaultParams?.config, params?.config, {
|
|
139
|
+
config: (0, import_lodash.merge)({}, factory4.defaultParams?.config, params?.config, {
|
|
140
|
+
schema
|
|
141
|
+
})
|
|
132
142
|
});
|
|
133
143
|
return factory4.creatableModule.create(mergedParams);
|
|
134
144
|
}
|
|
@@ -141,31 +151,35 @@ var ModuleFactory = class _ModuleFactory {
|
|
|
141
151
|
var import_assert2 = require("@xylabs/assert");
|
|
142
152
|
|
|
143
153
|
// src/Labels/Labels.ts
|
|
144
|
-
var hasAllLabels = (source, required) => {
|
|
154
|
+
var hasAllLabels = /* @__PURE__ */ __name((source, required) => {
|
|
145
155
|
if (!required)
|
|
146
156
|
return true;
|
|
147
157
|
return Object.entries(required).every(([key, value]) => {
|
|
148
158
|
return source?.hasOwnProperty(key) && source?.[key] === value;
|
|
149
159
|
});
|
|
150
|
-
};
|
|
160
|
+
}, "hasAllLabels");
|
|
151
161
|
|
|
152
162
|
// src/CreatableModule/ModuleFactoryLocator.ts
|
|
153
163
|
var ModuleFactoryLocator = class {
|
|
164
|
+
static {
|
|
165
|
+
__name(this, "ModuleFactoryLocator");
|
|
166
|
+
}
|
|
167
|
+
_registry;
|
|
154
168
|
constructor(_registry = {}) {
|
|
155
169
|
this._registry = _registry;
|
|
156
170
|
}
|
|
157
171
|
/**
|
|
158
|
-
|
|
159
|
-
|
|
172
|
+
* The current registry for the module factory
|
|
173
|
+
*/
|
|
160
174
|
get registry() {
|
|
161
175
|
return this._registry;
|
|
162
176
|
}
|
|
163
177
|
/**
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
178
|
+
* Locates a module factory that matches the supplied schema and labels
|
|
179
|
+
* @param schema The config schema for the module
|
|
180
|
+
* @param labels The labels for the module factory
|
|
181
|
+
* @returns A module factory that matches the supplied schema and labels or throws if one is not found
|
|
182
|
+
*/
|
|
169
183
|
locate(schema, labels) {
|
|
170
184
|
return (0, import_assert2.assertEx)(this.tryLocate(schema, labels), () => {
|
|
171
185
|
const configString = `config schema [${schema}]`;
|
|
@@ -174,9 +188,9 @@ var ModuleFactoryLocator = class {
|
|
|
174
188
|
});
|
|
175
189
|
}
|
|
176
190
|
/**
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
191
|
+
* Registers a single module factory (with optional tags) with the locator
|
|
192
|
+
* @param additional Additional module factories to register
|
|
193
|
+
*/
|
|
180
194
|
register(mod, labels) {
|
|
181
195
|
mod.configSchemas.map((schema) => {
|
|
182
196
|
const existingFactories = this._registry[schema];
|
|
@@ -188,37 +202,39 @@ var ModuleFactoryLocator = class {
|
|
|
188
202
|
// Merge module & supplied labels
|
|
189
203
|
labels: Object.assign({}, mod.labels ?? {}, labels ?? {})
|
|
190
204
|
};
|
|
191
|
-
this._registry[schema] = existingFactories ? [
|
|
205
|
+
this._registry[schema] = existingFactories ? [
|
|
206
|
+
...existingFactories,
|
|
207
|
+
factory4
|
|
208
|
+
] : [
|
|
209
|
+
factory4
|
|
210
|
+
];
|
|
192
211
|
});
|
|
193
212
|
return this;
|
|
194
213
|
}
|
|
195
214
|
/**
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
215
|
+
* Registers multiple module factories with the locator
|
|
216
|
+
* @param additional Additional module factories to register
|
|
217
|
+
*/
|
|
199
218
|
registerMany(additional) {
|
|
200
219
|
Object.entries(additional).map(([schema, factories]) => {
|
|
201
220
|
if (factories) {
|
|
202
221
|
const existingFactories = this._registry[schema];
|
|
203
|
-
this._registry[schema] = existingFactories ? [
|
|
222
|
+
this._registry[schema] = existingFactories ? [
|
|
223
|
+
...existingFactories,
|
|
224
|
+
...factories
|
|
225
|
+
] : factories;
|
|
204
226
|
}
|
|
205
227
|
});
|
|
206
228
|
return this;
|
|
207
229
|
}
|
|
208
230
|
/**
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
231
|
+
* Tries to locate a module factory that matches the supplied schema and labels
|
|
232
|
+
* @param schema The config schema for the module
|
|
233
|
+
* @param labels The labels for the module factory
|
|
234
|
+
* @returns A module factory that matches the supplied schema and labels or undefined
|
|
235
|
+
*/
|
|
214
236
|
tryLocate(schema, labels) {
|
|
215
|
-
return labels ? (
|
|
216
|
-
// Find the first factory that has labels and has all the labels provided
|
|
217
|
-
this._registry[schema]?.filter(hasLabels).find((factory4) => hasAllLabels(factory4?.labels, labels))
|
|
218
|
-
) : (
|
|
219
|
-
// Otherwise, return the first factory
|
|
220
|
-
this._registry[schema]?.[0]
|
|
221
|
-
);
|
|
237
|
+
return labels ? this._registry[schema]?.filter(hasLabels).find((factory4) => hasAllLabels(factory4?.labels, labels)) : this._registry[schema]?.[0];
|
|
222
238
|
}
|
|
223
239
|
};
|
|
224
240
|
|
|
@@ -274,6 +290,9 @@ var asModuleObject = import_object2.AsObjectFactory.create(isModuleObject);
|
|
|
274
290
|
|
|
275
291
|
// src/module/IsModuleFactory.ts
|
|
276
292
|
var IsModuleFactory = class {
|
|
293
|
+
static {
|
|
294
|
+
__name(this, "IsModuleFactory");
|
|
295
|
+
}
|
|
277
296
|
create(expectedQueries, additionalChecks) {
|
|
278
297
|
return (obj, config) => {
|
|
279
298
|
const module2 = asModuleObject(obj);
|
|
@@ -290,11 +309,11 @@ var requiredModuleQueries = [
|
|
|
290
309
|
//ModuleDescribeQuerySchema,
|
|
291
310
|
//ModuleAddressQuerySchema,
|
|
292
311
|
ModuleDiscoverQuerySchema
|
|
293
|
-
//ModuleManifestQuerySchema,
|
|
294
|
-
//ModuleSubscribeQuerySchema,
|
|
295
312
|
];
|
|
296
313
|
var factory2 = new IsModuleFactory();
|
|
297
|
-
var isModule = factory2.create(requiredModuleQueries, [
|
|
314
|
+
var isModule = factory2.create(requiredModuleQueries, [
|
|
315
|
+
isModuleObject
|
|
316
|
+
]);
|
|
298
317
|
|
|
299
318
|
// src/module/asModule.ts
|
|
300
319
|
var asModule = import_object3.AsObjectFactory.create(isModule);
|
|
@@ -307,7 +326,9 @@ var requiredModuleInstanceFunctions = {
|
|
|
307
326
|
moduleAddress: "function"
|
|
308
327
|
};
|
|
309
328
|
var factory3 = new import_object4.IsObjectFactory();
|
|
310
|
-
var isModuleInstance = factory3.create(requiredModuleInstanceFunctions, [
|
|
329
|
+
var isModuleInstance = factory3.create(requiredModuleInstanceFunctions, [
|
|
330
|
+
isModule
|
|
331
|
+
]);
|
|
311
332
|
|
|
312
333
|
// src/instance/asModuleInstance.ts
|
|
313
334
|
var asModuleInstance = import_object5.AsObjectFactory.create(isModuleInstance);
|
|
@@ -315,42 +336,60 @@ var asModuleInstance = import_object5.AsObjectFactory.create(isModuleInstance);
|
|
|
315
336
|
// src/instance/ModuleInstance.ts
|
|
316
337
|
var import_object6 = require("@xyo-network/object");
|
|
317
338
|
var IsInstanceFactory = class extends import_object6.IsObjectFactory {
|
|
339
|
+
static {
|
|
340
|
+
__name(this, "IsInstanceFactory");
|
|
341
|
+
}
|
|
318
342
|
};
|
|
319
343
|
|
|
320
344
|
// src/lib/duplicateModules.ts
|
|
321
|
-
var duplicateModules = (value, index, array) => {
|
|
345
|
+
var duplicateModules = /* @__PURE__ */ __name((value, index, array) => {
|
|
322
346
|
return array.findIndex((v) => v.address === value.address) === index;
|
|
323
|
-
};
|
|
347
|
+
}, "duplicateModules");
|
|
324
348
|
|
|
325
349
|
// src/lib/serializable.ts
|
|
326
350
|
var import_lodash2 = require("@xylabs/lodash");
|
|
327
|
-
var JSONPrimitiveChecks = [
|
|
328
|
-
|
|
329
|
-
|
|
351
|
+
var JSONPrimitiveChecks = [
|
|
352
|
+
import_lodash2.isUndefined,
|
|
353
|
+
import_lodash2.isNull,
|
|
354
|
+
import_lodash2.isBoolean,
|
|
355
|
+
import_lodash2.isNumber,
|
|
356
|
+
import_lodash2.isString
|
|
357
|
+
];
|
|
358
|
+
var JSONComplexChecks = [
|
|
359
|
+
import_lodash2.isPlainObject,
|
|
360
|
+
import_lodash2.isArray
|
|
361
|
+
];
|
|
362
|
+
var serializable = /* @__PURE__ */ __name((field, depth) => {
|
|
330
363
|
let depthExceeded = false;
|
|
331
|
-
const decrementDepth = () => depth ? depth-- : void 0;
|
|
332
|
-
const recursiveSerializable = (field2) => {
|
|
364
|
+
const decrementDepth = /* @__PURE__ */ __name(() => depth ? depth-- : void 0, "decrementDepth");
|
|
365
|
+
const recursiveSerializable = /* @__PURE__ */ __name((field2) => {
|
|
333
366
|
if (depth !== void 0 && depth < 1) {
|
|
334
367
|
depthExceeded = true;
|
|
335
368
|
return false;
|
|
336
369
|
}
|
|
337
370
|
decrementDepth();
|
|
338
|
-
const nestedSerializable = (field3) => (0, import_lodash2.overSome)(JSONComplexChecks)(field3) && (0, import_lodash2.every)(field3, recursiveSerializable);
|
|
339
|
-
return (0, import_lodash2.overSome)([
|
|
340
|
-
|
|
371
|
+
const nestedSerializable = /* @__PURE__ */ __name((field3) => (0, import_lodash2.overSome)(JSONComplexChecks)(field3) && (0, import_lodash2.every)(field3, recursiveSerializable), "nestedSerializable");
|
|
372
|
+
return (0, import_lodash2.overSome)([
|
|
373
|
+
...JSONPrimitiveChecks,
|
|
374
|
+
nestedSerializable
|
|
375
|
+
])(field2);
|
|
376
|
+
}, "recursiveSerializable");
|
|
341
377
|
const valid = recursiveSerializable(field);
|
|
342
378
|
return depthExceeded ? null : valid;
|
|
343
|
-
};
|
|
344
|
-
var serializableField = (field) => {
|
|
345
|
-
return (0, import_lodash2.overSome)([
|
|
346
|
-
|
|
379
|
+
}, "serializable");
|
|
380
|
+
var serializableField = /* @__PURE__ */ __name((field) => {
|
|
381
|
+
return (0, import_lodash2.overSome)([
|
|
382
|
+
...JSONPrimitiveChecks,
|
|
383
|
+
...JSONComplexChecks
|
|
384
|
+
])(field);
|
|
385
|
+
}, "serializableField");
|
|
347
386
|
|
|
348
387
|
// src/Payload/ModuleState.ts
|
|
349
388
|
var import_payload_model = require("@xyo-network/payload-model");
|
|
350
389
|
var ModuleStateSchema = "network.xyo.module.state";
|
|
351
|
-
var isModuleState = (payload) => {
|
|
390
|
+
var isModuleState = /* @__PURE__ */ __name((payload) => {
|
|
352
391
|
return (0, import_payload_model.isPayloadOfSchemaType)(ModuleStateSchema)(payload);
|
|
353
|
-
};
|
|
392
|
+
}, "isModuleState");
|
|
354
393
|
|
|
355
394
|
// src/withModule.ts
|
|
356
395
|
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 '@xyo-network/object'\nimport { Payload, Schema } from '@xyo-network/payload-model'\n\nimport { Labels } from './Labels'\n\nexport type ModuleConfigSchema = 'network.xyo.module.config'\nexport const ModuleConfigSchema: ModuleConfigSchema = 'network.xyo.module.config'\n\nexport type CosigningAddressSet = string[]\nexport type SchemaString = string\nexport type ModuleName = string\nexport type NameOrAddress = Address | ModuleName\n\nexport interface ArchivingModuleConfig {\n readonly archiving?: {\n readonly archivists?: NameOrAddress[]\n }\n}\n\nexport type ModuleConfig<TConfig extends EmptyObject | Payload | void = void, TSchema extends Schema | void = void> = Payload<\n WithAdditional<\n {\n /** @field The path to use when creating the account */\n accountDerivationPath?: string\n\n /** @field The name/address of the Archivist to use for this module */\n readonly archivist?: NameOrAddress\n\n /**\n * @field The labels used for this module. If a label is specified, then the\n * ModuleFactoryLocator will attempt to find a ModuleFactory with the corresponding\n * labels to construct this module.\n */\n readonly labels?: Labels\n\n /** @field Friendly name of module (not collision resistent). Can be used to resolve module when registered/attached to Node. */\n readonly name?: string\n\n /** @field paging settings for queries */\n readonly paging?: Record<string, { size?: number }>\n\n schema: TConfig extends Payload ? TConfig['schema'] : ModuleConfigSchema\n\n /** @field The query schemas and allowed/disallowed addresses which are allowed to issue them against the module. If both allowed and disallowed is specified, then disallowed takes priority. */\n readonly security?: {\n /** @field Will the module process queries that have unsigned BoundWitness in query tuples */\n readonly allowAnonymous?: boolean\n\n /** @field If schema in record, then only these address sets can access query */\n readonly allowed?: Record<SchemaString, (Address | CosigningAddressSet)[]>\n\n /** @field If schema in record, then anyone except these addresses can access query */\n readonly disallowed?: Record<SchemaString, Address[]>\n }\n\n /** @field sign every query */\n readonly sign?: boolean\n\n /** @field Store the queries made to the module in an archivist if possible */\n readonly storeQueries?: boolean\n\n /** @field add a timestamp payload to every query */\n readonly timestamp?: boolean\n } & ArchivingModuleConfig,\n TConfig\n >,\n TSchema\n>\n\nexport type AnyConfigSchema<TConfig extends Omit<ModuleConfig, 'schema'> & { schema: string } = Omit<ModuleConfig, 'schema'> & { schema: string }> =\n ModuleConfig<TConfig, string>\n\nexport type OptionalConfigSchema<TConfig extends AnyConfigSchema<ModuleConfig> = AnyConfigSchema<ModuleConfig>> = Omit<TConfig, 'schema'> & {\n schema?: TConfig['schema']\n}\n\nexport type AnyModuleConfig = AnyConfigSchema<ModuleConfig>\n","import { Logger } from '@xylabs/logger'\nimport { AccountInstance } from '@xyo-network/account-model'\n\nimport { ModuleInstance } from '../instance'\n\nexport type CreatableModuleFactory<T extends ModuleInstance = ModuleInstance> = Omit<Omit<CreatableModule<T>, 'new'>, 'create'> & {\n create<T extends ModuleInstance>(this: CreatableModuleFactory<T>, params?: T['params']): Promise<T>\n}\n\nexport interface CreatableModule<T extends ModuleInstance = ModuleInstance> {\n configSchema: string\n configSchemas: string[]\n defaultLogger?: Logger\n new (privateConstructorKey: string, params: T['params'], account: AccountInstance): T\n _noOverride(functionName: string): void\n create<T extends ModuleInstance>(this: CreatableModule<T>, params?: T['params']): Promise<T>\n factory<T extends ModuleInstance>(this: CreatableModule<T>, params?: T['params']): CreatableModuleFactory<T>\n}\n\n/**\n * Class annotation to be used to decorate Modules which support\n * an asynchronous creation pattern\n * @returns The decorated Module requiring it implement the members\n * of the CreatableModule as statics properties/methods\n */\nexport function creatableModule<TModule extends ModuleInstance = ModuleInstance>() {\n return <U extends CreatableModule<TModule>>(constructor: U) => {\n constructor\n }\n}\n","import { CreatableModuleFactory } from './CreatableModule'\nimport { CreatableModuleDictionary } from './CreatableModuleDictionary'\nimport { LabeledCreatableModuleFactory } from './LabeledCreatableModuleFactory'\n\nexport interface CreatableModuleRegistry {\n [key: string]: (CreatableModuleFactory | LabeledCreatableModuleFactory)[] | undefined\n}\n\nexport const toCreatableModuleRegistry = (dict: CreatableModuleDictionary | CreatableModuleRegistry): CreatableModuleRegistry => {\n // eslint-disable-next-line unicorn/no-array-reduce\n return Object.entries(dict).reduce((registry, [schema, factory]) => {\n registry[schema] = Array.isArray(factory) ? factory : [factory]\n return registry\n }, {} as CreatableModuleRegistry)\n}\n\nexport const assignCreatableModuleRegistry = (\n target: CreatableModuleRegistry = {},\n ...sources: CreatableModuleRegistry[]\n): CreatableModuleRegistry => {\n sources.map((source) =>\n Object.entries(source).map(([schema, factories]) => {\n if (factories) {\n const existingFactories = target[schema]\n target[schema] = existingFactories ? (target[schema] = [...existingFactories, ...factories]) : factories\n }\n }),\n )\n return target\n}\n","import { ModuleInstance } from '../instance'\nimport { WithOptionalLabels } from '../Labels'\nimport { CreatableModuleFactory } from './CreatableModule'\n\nexport type LabeledCreatableModuleFactory<T extends ModuleInstance = ModuleInstance> = CreatableModuleFactory<T> & WithOptionalLabels\n\nexport const hasLabels = (factory: CreatableModuleFactory | LabeledCreatableModuleFactory): factory is LabeledCreatableModuleFactory => {\n return (factory as LabeledCreatableModuleFactory).labels !== undefined\n}\n","import { assertEx } from '@xylabs/assert'\nimport { merge } from '@xylabs/lodash'\nimport { Logger } from '@xylabs/logger'\n\nimport { ModuleInstance } from '../instance'\nimport { Labels, WithOptionalLabels } from '../Labels'\nimport { CreatableModule, CreatableModuleFactory } from './CreatableModule'\n\nexport class ModuleFactory<TModule extends ModuleInstance> implements CreatableModuleFactory<TModule> {\n configSchemas: CreatableModuleFactory<TModule>['configSchemas']\n\n creatableModule: CreatableModule<TModule>\n\n defaultLogger?: Logger | undefined\n\n defaultParams?: Omit<TModule['params'], 'config'> & { config?: Partial<TModule['params']['config']> }\n\n labels?: Labels\n\n constructor(\n creatableModule: CreatableModule<TModule>,\n params?: Omit<TModule['params'], 'config'> & { config?: Partial<TModule['params']['config']> },\n labels: Labels = {},\n ) {\n this.creatableModule = creatableModule\n this.defaultParams = params\n this.configSchemas = creatableModule.configSchemas\n this.labels = Object.assign({}, (creatableModule as WithOptionalLabels).labels ?? {}, labels ?? {})\n }\n\n get configSchema(): string {\n return this.configSchemas[0]\n }\n\n static withParams<T extends ModuleInstance>(\n creatableModule: CreatableModule<T>,\n params?: Omit<T['params'], 'config'> & { config?: T['params']['config'] },\n labels: Labels = {},\n ) {\n return new ModuleFactory(creatableModule, params, labels)\n }\n\n _getRootFunction(funcName: string) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let anyThis = this as any\n while (anyThis.__proto__[funcName]) {\n anyThis = anyThis.__proto__\n }\n return anyThis[funcName]\n }\n\n _noOverride(functionName: string) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const thisFunc = (this as any)[functionName]\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const rootFunc = this._getRootFunction(functionName)\n assertEx(thisFunc === rootFunc, `Override not allowed for [${functionName}] - override ${functionName}Handler instead`)\n }\n\n create<T extends ModuleInstance>(this: CreatableModuleFactory<T>, params?: TModule['params'] | undefined): Promise<T> {\n const factory = this as ModuleFactory<T>\n const schema = factory.creatableModule.configSchema\n const mergedParams: TModule['params'] = merge({}, factory.defaultParams, params, {\n config: merge({}, factory.defaultParams?.config, params?.config, { schema }),\n })\n return factory.creatableModule.create<T>(mergedParams)\n }\n\n factory<T extends ModuleInstance>(this: CreatableModule<T>, _params?: T['params'] | undefined): CreatableModuleFactory<T> {\n throw new Error('Method not implemented.')\n }\n}\n","import { assertEx } from '@xylabs/assert'\n\nimport { ModuleInstance } from '../instance'\nimport { hasAllLabels, Labels } from '../Labels'\nimport { CreatableModuleFactory } from './CreatableModule'\nimport { CreatableModuleRegistry } from './CreatableModuleRegistry'\nimport { hasLabels, LabeledCreatableModuleFactory } from './LabeledCreatableModuleFactory'\n\n/**\n * A class which encapsulates the Service Locator Pattern for Module Factories\n */\nexport class ModuleFactoryLocator {\n constructor(protected readonly _registry: CreatableModuleRegistry = {}) {}\n\n /**\n * The current registry for the module factory\n */\n get registry(): Readonly<CreatableModuleRegistry> {\n return this._registry\n }\n\n /**\n * Locates a module factory that matches the supplied schema and labels\n * @param schema The config schema for the module\n * @param labels The labels for the module factory\n * @returns A module factory that matches the supplied schema and labels or throws if one is not found\n */\n locate(schema: string, labels?: Labels): CreatableModuleFactory | LabeledCreatableModuleFactory {\n return assertEx(this.tryLocate(schema, labels), () => {\n const configString = `config schema [${schema}]`\n const labelsString = labels ? ` & labels [${JSON.stringify(labels)}]` : ''\n return `No module factory for the supplied ${configString}${labelsString} registered`\n })\n }\n\n /**\n * Registers a single module factory (with optional tags) with the locator\n * @param additional Additional module factories to register\n */\n register<TModule extends ModuleInstance>(mod: CreatableModuleFactory<TModule>, labels?: Labels): this {\n mod.configSchemas.map((schema) => {\n const existingFactories = this._registry[schema]\n const factory: LabeledCreatableModuleFactory<TModule> = {\n // Destructure instance properties\n ...mod,\n // Copy static methods\n create: mod.create.bind(mod) as LabeledCreatableModuleFactory<TModule>['create'],\n // Merge module & supplied labels\n labels: Object.assign({}, (mod as LabeledCreatableModuleFactory).labels ?? {}, labels ?? {}),\n }\n this._registry[schema] = existingFactories ? [...existingFactories, factory] : [factory]\n })\n return this\n }\n\n /**\n * Registers multiple module factories with the locator\n * @param additional Additional module factories to register\n */\n registerMany(additional: CreatableModuleRegistry): this {\n Object.entries(additional).map(([schema, factories]) => {\n if (factories) {\n const existingFactories = this._registry[schema]\n this._registry[schema] = existingFactories ? [...existingFactories, ...factories] : factories\n }\n })\n return this\n }\n\n /**\n * Tries to locate a module factory that matches the supplied schema and labels\n * @param schema The config schema for the module\n * @param labels The labels for the module factory\n * @returns A module factory that matches the supplied schema and labels or undefined\n */\n tryLocate(schema: string, labels?: Labels): CreatableModuleFactory | LabeledCreatableModuleFactory | undefined {\n // If labels were provided\n return labels\n ? // Find the first factory that has labels and has all the labels provided\n this._registry[schema]?.filter(hasLabels).find((factory) => hasAllLabels(factory?.labels, labels))\n : // Otherwise, return the first factory\n this._registry[schema]?.[0]\n }\n}\n","/**\n * Object used to represent labels identifying a resource.\n */\nexport interface Labels {\n [key: string]: string | undefined\n}\n\n/**\n * Interface for objects that have labels.\n */\nexport interface WithLabels<T extends Labels = Labels> {\n labels: T\n}\n\n/**\n * Interface for objects that have labels.\n */\nexport interface WithOptionalLabels<T extends Labels = Labels> {\n labels?: T\n}\n\n/**\n * Returns true if the source object has all the labels from the required set\n * @param source Source object to check against\n * @param required Set of labels to check for in source\n * @returns True of the source object has all the labels from the required set\n */\nexport const hasAllLabels = (source?: Labels, required?: Labels): boolean => {\n if (!required) return true\n return Object.entries(required).every(([key, value]) => {\n // eslint-disable-next-line no-prototype-builtins\n return source?.hasOwnProperty(key as keyof typeof source) && source?.[key as keyof typeof source] === value\n })\n}\n","import { AsObjectFactory } from '@xyo-network/object'\n\nimport { isModuleInstance } from './isModuleInstance'\n\nexport const asModuleInstance = AsObjectFactory.create(isModuleInstance)\n","import { IsObjectFactory, ObjectTypeShape, TypeCheck } from '@xyo-network/object'\n\nimport { isModule } from '../module'\nimport { ModuleInstance } from './ModuleInstance'\n\nexport const requiredModuleInstanceFunctions: ObjectTypeShape = {\n describe: 'function',\n discover: 'function',\n manifest: 'function',\n moduleAddress: 'function',\n}\n\n//we do not use IsInstanceFactory here to prevent a cycle\nconst factory = new IsObjectFactory<ModuleInstance>()\n\nexport const isModuleInstance: TypeCheck<ModuleInstance> = factory.create(requiredModuleInstanceFunctions, [isModule])\n","import { AsObjectFactory } from '@xyo-network/object'\n\nimport { isModule } from './isModule'\n\nexport const asModule = AsObjectFactory.create(isModule)\n","import { Payload } from '@xyo-network/payload-model'\n\nimport { ModuleDescription } from '../../ModuleDescription'\n\nexport const ModuleDescriptionSchema = 'network.xyo.module.description'\nexport type ModuleDescriptionSchema = typeof ModuleDescriptionSchema\n\nexport type ModuleDescriptionPayload = Payload<ModuleDescription, ModuleDescriptionSchema>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ModuleDescribeQuerySchema = 'network.xyo.query.module.describe'\nexport const ModuleDescribeQuerySchema: ModuleDescribeQuerySchema = 'network.xyo.query.module.describe'\n\nexport type ModuleDescribeQuery = Query<{\n schema: ModuleDescribeQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ModuleDiscoverQuerySchema = 'network.xyo.query.module.discover'\nexport const ModuleDiscoverQuerySchema: ModuleDiscoverQuerySchema = 'network.xyo.query.module.discover'\n\nexport type ModuleDiscoverQuery = Query<{\n maxDepth?: number\n schema: ModuleDiscoverQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ModuleManifestQuerySchema = 'network.xyo.query.module.manifest'\nexport const ModuleManifestQuerySchema: ModuleManifestQuerySchema = 'network.xyo.query.module.manifest'\n\nexport type ModuleManifestQuery = Query<{\n maxDepth?: number\n schema: ModuleManifestQuerySchema\n}>\n","import { AddressSchema } from '@xyo-network/address-payload-plugin'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport const AddressPreviousHashSchema = `${AddressSchema}.hash.previous`\nexport type AddressPreviousHashSchema = typeof AddressPreviousHashSchema\n\nexport type AddressPreviousHashPayload = Payload<{\n address: string\n previousHash?: string\n schema: AddressPreviousHashSchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ModuleAddressQuerySchema = 'network.xyo.query.module.address'\nexport const ModuleAddressQuerySchema: ModuleAddressQuerySchema = 'network.xyo.query.module.address'\n\nexport type ModuleAddressQuery = Query<{\n schema: ModuleAddressQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ModuleSubscribeQuerySchema = 'network.xyo.query.module.subscribe'\nexport const ModuleSubscribeQuerySchema: ModuleSubscribeQuerySchema = 'network.xyo.query.module.subscribe'\n\nexport interface ModuleSubscribeFilter {\n /** @field if specified, at least one of the schemas must be present in the boundwtness to generate a notification */\n schema?: string[]\n}\n\n//requests notification when a boundwitness is added to the modules chain that meets the filter criteria\nexport type ModuleSubscribeQuery = Query<{\n /** @field The address that will receive notifications */\n address: string\n /** @field A subscribe with a null for filter is an unsubscribe */\n filter?: ModuleSubscribeFilter | null\n /** @field The maximum events queued per send [may increase frequency] */\n maxQueue?: number\n schema: ModuleSubscribeQuerySchema\n}>\n","import { AsObjectFactory } from '@xyo-network/object'\n\nimport { isModuleObject } from './isModuleObject'\n\nexport const asModuleObject = AsObjectFactory.create(isModuleObject)\n","import { IsObjectFactory, ObjectTypeShape } from '@xyo-network/object'\n\nimport { Module } from './Module'\n\nexport const requiredModuleShape: ObjectTypeShape = {\n address: 'string',\n config: 'object',\n params: 'object',\n queries: 'array',\n query: 'function',\n queryable: 'function',\n}\n\nconst factory = new IsObjectFactory<Module>()\n\nexport const isModuleObject = factory.create(requiredModuleShape)\n","import { AnyObject, EmptyObject, TypeCheck } from '@xyo-network/object'\n\nimport { asModuleObject } from './asModuleObject'\nimport { isModuleObject } from './isModuleObject'\nimport { Module } from './Module'\n\nexport type ModuleTypeCheck<T extends Module = Module> = TypeCheck<T>\n\nexport class IsModuleFactory<T extends Module = Module> {\n create(expectedQueries?: string[], additionalChecks?: TypeCheck<AnyObject | EmptyObject>[]): ModuleTypeCheck<T> {\n return (obj: unknown, config): obj is T => {\n const module = asModuleObject(obj)\n const result =\n isModuleObject(module, config) &&\n (expectedQueries?.reduce((prev, query) => prev && module.queries.includes(query), true) ?? true) &&\n //perform additional checks\n (additionalChecks?.reduce((prev, check) => prev && check(obj, config), true) ?? true)\n return result\n }\n }\n}\n","import { TypeCheck } from '@xyo-network/object'\n\nimport { ModuleDiscoverQuerySchema } from '../Queries'\nimport { IsModuleFactory } from './IsModuleFactory'\nimport { isModuleObject } from './isModuleObject'\nimport { Module } from './Module'\n\nexport const requiredModuleQueries: string[] = [\n /* We need to update this once live module conform */\n //ModuleDescribeQuerySchema,\n //ModuleAddressQuerySchema,\n ModuleDiscoverQuerySchema,\n //ModuleManifestQuerySchema,\n //ModuleSubscribeQuerySchema,\n]\n\n//we do not use IsInstanceFactory here to prevent a cycle\nconst factory = new IsModuleFactory<Module>()\n\nexport const isModule: TypeCheck<Module> = factory.create(requiredModuleQueries, [isModuleObject])\n","import { Promisable } from '@xylabs/promise'\nimport { IsObjectFactory, TypeCheck } from '@xyo-network/object'\n\nimport { ModuleEventData } from '../EventsModels'\nimport { Module, ModuleQueryFunctions } from '../module'\nimport { ModuleParams } from '../ModuleParams'\n\nexport interface ResolveFunctions {\n resolve<T extends ModuleInstance = ModuleInstance>(filter?: ModuleFilter<T>, options?: ModuleFilterOptions<T>): Promisable<T[]>\n resolve<T extends ModuleInstance = ModuleInstance>(nameOrAddress: string, options?: ModuleFilterOptions<T>): Promisable<T | undefined>\n resolve<T extends ModuleInstance = ModuleInstance>(\n nameOrAddressOrFilter?: ModuleFilter<T> | string,\n options?: ModuleFilterOptions<T>,\n ): Promisable<T | T[] | undefined>\n}\n\nexport interface ModuleResolver extends ResolveFunctions {\n addResolver: (resolver: ModuleResolver) => this\n isModuleResolver: boolean\n removeResolver: (resolver: ModuleResolver) => this\n}\n\nexport type ModuleInstance<TParams extends ModuleParams = ModuleParams, TEventData extends ModuleEventData = ModuleEventData> = Module<\n TParams,\n TEventData\n> &\n ResolveFunctions &\n ModuleQueryFunctions & {\n /* The resolver is a 'down' resolver. It can resolve the module or any children (if it is a node for example), that are in the module*/\n readonly downResolver: Omit<ModuleResolver, 'resolve'>\n\n /* The resolver is a 'up' resolver. It can resolve the parent or any children of the parent*/\n /* This is set by a NodeModule when attaching to the module */\n readonly upResolver: Omit<ModuleResolver, 'resolve'>\n }\n\nexport type InstanceTypeCheck<T extends ModuleInstance = ModuleInstance> = TypeCheck<T>\n\nexport class IsInstanceFactory<T extends ModuleInstance = ModuleInstance> extends IsObjectFactory<T> {}\n\nexport interface ModuleFilterOptions<T extends ModuleInstance = ModuleInstance> {\n direction?: 'up' | 'down' | 'all'\n identity?: InstanceTypeCheck<T>\n maxDepth?: number\n visibility?: 'public' | 'private' | 'all'\n}\n\nexport interface AddressModuleFilter<T extends ModuleInstance = ModuleInstance> extends ModuleFilterOptions<T> {\n address: string[]\n}\n\nexport interface NameModuleFilter<T extends ModuleInstance = ModuleInstance> extends ModuleFilterOptions<T> {\n name: string[]\n}\n\nexport interface QueryModuleFilter<T extends ModuleInstance = ModuleInstance> extends ModuleFilterOptions<T> {\n query: string[][]\n}\n\nexport type AnyModuleFilter<T extends ModuleInstance = ModuleInstance> = Partial<AddressModuleFilter<T>> &\n Partial<NameModuleFilter<T>> &\n Partial<QueryModuleFilter<T>>\n\nexport type ModuleFilter<T extends ModuleInstance = ModuleInstance> =\n | ModuleFilterOptions<T>\n | AddressModuleFilter<T>\n | NameModuleFilter<T>\n | QueryModuleFilter<T>\n","import { Module } from '../module'\n\n/**\n * Used to filter duplicates from an array of modules\n * @example: modulesArray.filter(duplicateModules)\n * @param value Current Module\n * @param index Current Module's index\n * @param array Module Array\n * @returns True if the Module's address is the first occurrence of\n * that address in the array, false otherwise\n */\nexport const duplicateModules = (value: Module, index: number, array: Module[]): value is Module => {\n return array.findIndex((v) => v.address === value.address) === index\n}\n","// Inspired by https://stackoverflow.com/a/49079549/2803259\n\nimport { every, isArray, isBoolean, isNull, isNumber, isPlainObject, isString, isUndefined, overSome } from '@xylabs/lodash'\n\nconst JSONPrimitiveChecks = [isUndefined, isNull, isBoolean, isNumber, isString]\nconst JSONComplexChecks = [isPlainObject, isArray]\n\nexport const serializable = (field: unknown, depth?: number): boolean | null => {\n let depthExceeded = false\n const decrementDepth = () => (depth ? depth-- : undefined)\n\n const recursiveSerializable = (field: unknown) => {\n if (depth !== undefined && depth < 1) {\n depthExceeded = true\n return false\n }\n\n // decrement during every recursion\n decrementDepth()\n\n const nestedSerializable = (field: unknown): boolean => overSome(JSONComplexChecks)(field) && every(field as object, recursiveSerializable)\n\n return overSome([...JSONPrimitiveChecks, nestedSerializable])(field)\n }\n\n const valid = recursiveSerializable(field)\n\n return depthExceeded ? null : valid\n}\n\nexport const serializableField = (field: unknown) => {\n return overSome([...JSONPrimitiveChecks, ...JSONComplexChecks])(field)\n}\n","import { isPayloadOfSchemaType, Payload } from '@xyo-network/payload-model'\n\nexport interface StateDictionary {\n [key: string]: string | number | undefined\n}\nexport interface State<T extends StateDictionary = StateDictionary> {\n state: T\n}\n\nexport const ModuleStateSchema = 'network.xyo.module.state' as const\nexport type ModuleStateSchema = typeof ModuleStateSchema\n\nexport type ModuleState<T extends StateDictionary = StateDictionary> = Payload<State<T>, ModuleStateSchema>\n\nexport const isModuleState = <T extends StateDictionary = StateDictionary>(payload?: Payload | null): payload is ModuleState<T> => {\n return isPayloadOfSchemaType<ModuleState<T>>(ModuleStateSchema)(payload)\n}\n","import { TypeCheck } from '@xyo-network/object'\n\nimport { isModuleInstance } from './instance'\nimport { isModule } from './module'\n\nexport const WithFactory = {\n create: <T extends object>(typeCheck: TypeCheck<T>) => {\n return <R>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n module: any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n closure: (module: T) => R,\n ): R | undefined => {\n return typeCheck(module) ? closure(module) : undefined\n }\n },\n}\n\nexport const withModule = WithFactory.create(isModule)\nexport const withModuleInstance = WithFactory.create(isModuleInstance)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACOO,IAAM,qBAAyC;;;ACkB/C,SAAS,kBAAmE;AACjF,SAAO,CAAqC,gBAAmB;AAC7D;AAAA,EACF;AACF;;;ACrBO,IAAM,4BAA4B,CAAC,SAAuF;AAE/H,SAAO,OAAO,QAAQ,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,QAAQA,QAAO,MAAM;AAClE,aAAS,MAAM,IAAI,MAAM,QAAQA,QAAO,IAAIA,WAAU,CAACA,QAAO;AAC9D,WAAO;AAAA,EACT,GAAG,CAAC,CAA4B;AAClC;AAEO,IAAM,gCAAgC,CAC3C,SAAkC,CAAC,MAChC,YACyB;AAC5B,UAAQ;AAAA,IAAI,CAAC,WACX,OAAO,QAAQ,MAAM,EAAE,IAAI,CAAC,CAAC,QAAQ,SAAS,MAAM;AAClD,UAAI,WAAW;AACb,cAAM,oBAAoB,OAAO,MAAM;AACvC,eAAO,MAAM,IAAI,oBAAqB,OAAO,MAAM,IAAI,CAAC,GAAG,mBAAmB,GAAG,SA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AAU;AAEhD,QAAM,wBAAwB,CAACC,WAAmB;AAChD,QAAI,UAAU,UAAa,QAAQ,GAAG;AACpC,sBAAgB;AAChB,aAAO;AAAA,IACT;AAGA,mBAAe;AAEf,UAAM,qBAAqB,CAACA,eAA4B,yBAAS,iBAAiB,EAAEA,MAAK,SAAK,sBAAMA,QAAiB,qBAAqB;AAE1I,eAAO,yBAAS,CAAC,GAAG,qBAAqB,kBAAkB,CAAC,EAAEA,MAAK;AAAA,EACrE;AAEA,QAAM,QAAQ,sBAAsB,KAAK;AAEzC,SAAO,gBAAgB,OAAO;AAChC;AAEO,IAAM,oBAAoB,CAAC,UAAmB;AACnD,aAAO,yBAAS,CAAC,GAAG,qBAAqB,GAAG,iBAAiB,CAAC,EAAE,KAAK;AACvE;;;AChCA,2BAA+C;AASxC,IAAM,oBAAoB;AAK1B,IAAM,gBAAgB,CAA8C,YAAwD;AACjI,aAAO,4CAAsC,iBAAiB,EAAE,OAAO;AACzE;;;ACXO,IAAM,cAAc;AAAA,EACzB,QAAQ,CAAmB,cAA4B;AACrD,WAAO,CAELC,SAEA,YACkB;AAClB,aAAO,UAAUA,OAAM,IAAI,QAAQA,OAAM,IAAI;AAAA,IAC/C;AAAA,EACF;AACF;AAEO,IAAM,aAAa,YAAY,OAAO,QAAQ;AAC9C,IAAM,qBAAqB,YAAY,OAAO,gBAAgB;","names":["factory","factory","creatableModule","factory","import_assert","factory","import_object","import_object","import_object","import_object","module","factory","factory","import_object","import_lodash","field","module"]}
|
|
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 '@xyo-network/object'\nimport { Payload, Schema } from '@xyo-network/payload-model'\n\nimport { Labels } from './Labels'\n\nexport type ModuleConfigSchema = 'network.xyo.module.config'\nexport const ModuleConfigSchema: ModuleConfigSchema = 'network.xyo.module.config'\n\nexport type CosigningAddressSet = string[]\nexport type SchemaString = string\nexport type ModuleName = string\nexport type NameOrAddress = Address | ModuleName\n\nexport interface ArchivingModuleConfig {\n readonly archiving?: {\n readonly archivists?: NameOrAddress[]\n }\n}\n\nexport type ModuleConfig<TConfig extends EmptyObject | Payload | void = void, TSchema extends Schema | void = void> = Payload<\n WithAdditional<\n {\n /** @field The name/address of the Archivist to use for this module */\n readonly archivist?: NameOrAddress\n\n /**\n * @field The labels used for this module. If a label is specified, then the\n * ModuleFactoryLocator will attempt to find a ModuleFactory with the corresponding\n * labels to construct this module.\n */\n readonly labels?: Labels\n\n /** @field Friendly name of module (not collision resistent). Can be used to resolve module when registered/attached to Node. */\n readonly name?: string\n\n /** @field paging settings for queries */\n readonly paging?: Record<string, { size?: number }>\n\n schema: TConfig extends Payload ? TConfig['schema'] : ModuleConfigSchema\n\n /** @field The query schemas and allowed/disallowed addresses which are allowed to issue them against the module. If both allowed and disallowed is specified, then disallowed takes priority. */\n readonly security?: {\n /** @field Will the module process queries that have unsigned BoundWitness in query tuples */\n readonly allowAnonymous?: boolean\n\n /** @field If schema in record, then only these address sets can access query */\n readonly allowed?: Record<SchemaString, (Address | CosigningAddressSet)[]>\n\n /** @field If schema in record, then anyone except these addresses can access query */\n readonly disallowed?: Record<SchemaString, Address[]>\n }\n\n /** @field sign every query */\n readonly sign?: boolean\n\n /** @field Store the queries made to the module in an archivist if possible */\n readonly storeQueries?: boolean\n\n /** @field add a timestamp payload to every query */\n readonly timestamp?: boolean\n } & ArchivingModuleConfig,\n TConfig\n >,\n TSchema\n>\n\nexport type AnyConfigSchema<TConfig extends Omit<ModuleConfig, 'schema'> & { schema: string } = Omit<ModuleConfig, 'schema'> & { schema: string }> =\n ModuleConfig<TConfig, string>\n\nexport type OptionalConfigSchema<TConfig extends AnyConfigSchema<ModuleConfig> = AnyConfigSchema<ModuleConfig>> = Omit<TConfig, 'schema'> & {\n schema?: TConfig['schema']\n}\n\nexport type AnyModuleConfig = AnyConfigSchema<ModuleConfig>\n","import { Logger } from '@xylabs/logger'\nimport { AccountInstance } from '@xyo-network/account-model'\n\nimport { ModuleInstance } from '../instance'\n\nexport type CreatableModuleFactory<T extends ModuleInstance = ModuleInstance> = Omit<Omit<CreatableModule<T>, 'new'>, 'create'> & {\n create<T extends ModuleInstance>(this: CreatableModuleFactory<T>, params?: T['params']): Promise<T>\n}\n\nexport interface CreatableModule<T extends ModuleInstance = ModuleInstance> {\n configSchema: string\n configSchemas: string[]\n defaultLogger?: Logger\n new (privateConstructorKey: string, params: T['params'], account: AccountInstance): T\n _noOverride(functionName: string): void\n create<T extends ModuleInstance>(this: CreatableModule<T>, params?: T['params']): Promise<T>\n factory<T extends ModuleInstance>(this: CreatableModule<T>, params?: T['params']): CreatableModuleFactory<T>\n}\n\n/**\n * Class annotation to be used to decorate Modules which support\n * an asynchronous creation pattern\n * @returns The decorated Module requiring it implement the members\n * of the CreatableModule as statics properties/methods\n */\nexport function creatableModule<TModule extends ModuleInstance = ModuleInstance>() {\n return <U extends CreatableModule<TModule>>(constructor: U) => {\n constructor\n }\n}\n","import { CreatableModuleFactory } from './CreatableModule'\nimport { CreatableModuleDictionary } from './CreatableModuleDictionary'\nimport { LabeledCreatableModuleFactory } from './LabeledCreatableModuleFactory'\n\nexport interface CreatableModuleRegistry {\n [key: string]: (CreatableModuleFactory | LabeledCreatableModuleFactory)[] | undefined\n}\n\nexport const toCreatableModuleRegistry = (dict: CreatableModuleDictionary | CreatableModuleRegistry): CreatableModuleRegistry => {\n // eslint-disable-next-line unicorn/no-array-reduce\n return Object.entries(dict).reduce((registry, [schema, factory]) => {\n registry[schema] = Array.isArray(factory) ? factory : [factory]\n return registry\n }, {} as CreatableModuleRegistry)\n}\n\nexport const assignCreatableModuleRegistry = (\n target: CreatableModuleRegistry = {},\n ...sources: CreatableModuleRegistry[]\n): CreatableModuleRegistry => {\n sources.map((source) =>\n Object.entries(source).map(([schema, factories]) => {\n if (factories) {\n const existingFactories = target[schema]\n target[schema] = existingFactories ? (target[schema] = [...existingFactories, ...factories]) : factories\n }\n }),\n )\n return target\n}\n","import { ModuleInstance } from '../instance'\nimport { WithOptionalLabels } from '../Labels'\nimport { CreatableModuleFactory } from './CreatableModule'\n\nexport type LabeledCreatableModuleFactory<T extends ModuleInstance = ModuleInstance> = CreatableModuleFactory<T> & WithOptionalLabels\n\nexport const hasLabels = (factory: CreatableModuleFactory | LabeledCreatableModuleFactory): factory is LabeledCreatableModuleFactory => {\n return (factory as LabeledCreatableModuleFactory).labels !== undefined\n}\n","import { assertEx } from '@xylabs/assert'\nimport { merge } from '@xylabs/lodash'\nimport { Logger } from '@xylabs/logger'\n\nimport { ModuleInstance } from '../instance'\nimport { Labels, WithOptionalLabels } from '../Labels'\nimport { CreatableModule, CreatableModuleFactory } from './CreatableModule'\n\nexport class ModuleFactory<TModule extends ModuleInstance> implements CreatableModuleFactory<TModule> {\n configSchemas: CreatableModuleFactory<TModule>['configSchemas']\n\n creatableModule: CreatableModule<TModule>\n\n defaultLogger?: Logger | undefined\n\n defaultParams?: Omit<TModule['params'], 'config'> & { config?: Partial<TModule['params']['config']> }\n\n labels?: Labels\n\n constructor(\n creatableModule: CreatableModule<TModule>,\n params?: Omit<TModule['params'], 'config'> & { config?: Partial<TModule['params']['config']> },\n labels: Labels = {},\n ) {\n this.creatableModule = creatableModule\n this.defaultParams = params\n this.configSchemas = creatableModule.configSchemas\n this.labels = Object.assign({}, (creatableModule as WithOptionalLabels).labels ?? {}, labels ?? {})\n }\n\n get configSchema(): string {\n return this.configSchemas[0]\n }\n\n static withParams<T extends ModuleInstance>(\n creatableModule: CreatableModule<T>,\n params?: Omit<T['params'], 'config'> & { config?: T['params']['config'] },\n labels: Labels = {},\n ) {\n return new ModuleFactory(creatableModule, params, labels)\n }\n\n _getRootFunction(funcName: string) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let anyThis = this as any\n while (anyThis.__proto__[funcName]) {\n anyThis = anyThis.__proto__\n }\n return anyThis[funcName]\n }\n\n _noOverride(functionName: string) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const thisFunc = (this as any)[functionName]\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const rootFunc = this._getRootFunction(functionName)\n assertEx(thisFunc === rootFunc, `Override not allowed for [${functionName}] - override ${functionName}Handler instead`)\n }\n\n create<T extends ModuleInstance>(this: CreatableModuleFactory<T>, params?: TModule['params'] | undefined): Promise<T> {\n const factory = this as ModuleFactory<T>\n const schema = factory.creatableModule.configSchema\n const mergedParams: TModule['params'] = merge({}, factory.defaultParams, params, {\n config: merge({}, factory.defaultParams?.config, params?.config, { schema }),\n })\n return factory.creatableModule.create<T>(mergedParams)\n }\n\n factory<T extends ModuleInstance>(this: CreatableModule<T>, _params?: T['params'] | undefined): CreatableModuleFactory<T> {\n throw new Error('Method not implemented.')\n }\n}\n","import { assertEx } from '@xylabs/assert'\n\nimport { ModuleInstance } from '../instance'\nimport { hasAllLabels, Labels } from '../Labels'\nimport { CreatableModuleFactory } from './CreatableModule'\nimport { CreatableModuleRegistry } from './CreatableModuleRegistry'\nimport { hasLabels, LabeledCreatableModuleFactory } from './LabeledCreatableModuleFactory'\n\n/**\n * A class which encapsulates the Service Locator Pattern for Module Factories\n */\nexport class ModuleFactoryLocator {\n constructor(protected readonly _registry: CreatableModuleRegistry = {}) {}\n\n /**\n * The current registry for the module factory\n */\n get registry(): Readonly<CreatableModuleRegistry> {\n return this._registry\n }\n\n /**\n * Locates a module factory that matches the supplied schema and labels\n * @param schema The config schema for the module\n * @param labels The labels for the module factory\n * @returns A module factory that matches the supplied schema and labels or throws if one is not found\n */\n locate(schema: string, labels?: Labels): CreatableModuleFactory | LabeledCreatableModuleFactory {\n return assertEx(this.tryLocate(schema, labels), () => {\n const configString = `config schema [${schema}]`\n const labelsString = labels ? ` & labels [${JSON.stringify(labels)}]` : ''\n return `No module factory for the supplied ${configString}${labelsString} registered`\n })\n }\n\n /**\n * Registers a single module factory (with optional tags) with the locator\n * @param additional Additional module factories to register\n */\n register<TModule extends ModuleInstance>(mod: CreatableModuleFactory<TModule>, labels?: Labels): this {\n mod.configSchemas.map((schema) => {\n const existingFactories = this._registry[schema]\n const factory: LabeledCreatableModuleFactory<TModule> = {\n // Destructure instance properties\n ...mod,\n // Copy static methods\n create: mod.create.bind(mod) as LabeledCreatableModuleFactory<TModule>['create'],\n // Merge module & supplied labels\n labels: Object.assign({}, (mod as LabeledCreatableModuleFactory).labels ?? {}, labels ?? {}),\n }\n this._registry[schema] = existingFactories ? [...existingFactories, factory] : [factory]\n })\n return this\n }\n\n /**\n * Registers multiple module factories with the locator\n * @param additional Additional module factories to register\n */\n registerMany(additional: CreatableModuleRegistry): this {\n Object.entries(additional).map(([schema, factories]) => {\n if (factories) {\n const existingFactories = this._registry[schema]\n this._registry[schema] = existingFactories ? [...existingFactories, ...factories] : factories\n }\n })\n return this\n }\n\n /**\n * Tries to locate a module factory that matches the supplied schema and labels\n * @param schema The config schema for the module\n * @param labels The labels for the module factory\n * @returns A module factory that matches the supplied schema and labels or undefined\n */\n tryLocate(schema: string, labels?: Labels): CreatableModuleFactory | LabeledCreatableModuleFactory | undefined {\n // If labels were provided\n return labels\n ? // Find the first factory that has labels and has all the labels provided\n this._registry[schema]?.filter(hasLabels).find((factory) => hasAllLabels(factory?.labels, labels))\n : // Otherwise, return the first factory\n this._registry[schema]?.[0]\n }\n}\n","/**\n * Object used to represent labels identifying a resource.\n */\nexport interface Labels {\n [key: string]: string | undefined\n}\n\n/**\n * Interface for objects that have labels.\n */\nexport interface WithLabels<T extends Labels = Labels> {\n labels: T\n}\n\n/**\n * Interface for objects that have labels.\n */\nexport interface WithOptionalLabels<T extends Labels = Labels> {\n labels?: T\n}\n\n/**\n * Returns true if the source object has all the labels from the required set\n * @param source Source object to check against\n * @param required Set of labels to check for in source\n * @returns True of the source object has all the labels from the required set\n */\nexport const hasAllLabels = (source?: Labels, required?: Labels): boolean => {\n if (!required) return true\n return Object.entries(required).every(([key, value]) => {\n // eslint-disable-next-line no-prototype-builtins\n return source?.hasOwnProperty(key as keyof typeof source) && source?.[key as keyof typeof source] === value\n })\n}\n","import { AsObjectFactory } from '@xyo-network/object'\n\nimport { isModuleInstance } from './isModuleInstance'\n\nexport const asModuleInstance = AsObjectFactory.create(isModuleInstance)\n","import { IsObjectFactory, ObjectTypeShape, TypeCheck } from '@xyo-network/object'\n\nimport { isModule } from '../module'\nimport { ModuleInstance } from './ModuleInstance'\n\nexport const requiredModuleInstanceFunctions: ObjectTypeShape = {\n describe: 'function',\n discover: 'function',\n manifest: 'function',\n moduleAddress: 'function',\n}\n\n//we do not use IsInstanceFactory here to prevent a cycle\nconst factory = new IsObjectFactory<ModuleInstance>()\n\nexport const isModuleInstance: TypeCheck<ModuleInstance> = factory.create(requiredModuleInstanceFunctions, [isModule])\n","import { AsObjectFactory } from '@xyo-network/object'\n\nimport { isModule } from './isModule'\n\nexport const asModule = AsObjectFactory.create(isModule)\n","import { Payload } from '@xyo-network/payload-model'\n\nimport { ModuleDescription } from '../../ModuleDescription'\n\nexport const ModuleDescriptionSchema = 'network.xyo.module.description'\nexport type ModuleDescriptionSchema = typeof ModuleDescriptionSchema\n\nexport type ModuleDescriptionPayload = Payload<ModuleDescription, ModuleDescriptionSchema>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ModuleDescribeQuerySchema = 'network.xyo.query.module.describe'\nexport const ModuleDescribeQuerySchema: ModuleDescribeQuerySchema = 'network.xyo.query.module.describe'\n\nexport type ModuleDescribeQuery = Query<{\n schema: ModuleDescribeQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ModuleDiscoverQuerySchema = 'network.xyo.query.module.discover'\nexport const ModuleDiscoverQuerySchema: ModuleDiscoverQuerySchema = 'network.xyo.query.module.discover'\n\nexport type ModuleDiscoverQuery = Query<{\n maxDepth?: number\n schema: ModuleDiscoverQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ModuleManifestQuerySchema = 'network.xyo.query.module.manifest'\nexport const ModuleManifestQuerySchema: ModuleManifestQuerySchema = 'network.xyo.query.module.manifest'\n\nexport type ModuleManifestQuery = Query<{\n maxDepth?: number\n schema: ModuleManifestQuerySchema\n}>\n","import { AddressSchema } from '@xyo-network/address-payload-plugin'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport const AddressPreviousHashSchema = `${AddressSchema}.hash.previous`\nexport type AddressPreviousHashSchema = typeof AddressPreviousHashSchema\n\nexport type AddressPreviousHashPayload = Payload<{\n address: string\n previousHash?: string\n schema: AddressPreviousHashSchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ModuleAddressQuerySchema = 'network.xyo.query.module.address'\nexport const ModuleAddressQuerySchema: ModuleAddressQuerySchema = 'network.xyo.query.module.address'\n\nexport type ModuleAddressQuery = Query<{\n schema: ModuleAddressQuerySchema\n}>\n","import { Query } from '@xyo-network/payload-model'\n\nexport type ModuleSubscribeQuerySchema = 'network.xyo.query.module.subscribe'\nexport const ModuleSubscribeQuerySchema: ModuleSubscribeQuerySchema = 'network.xyo.query.module.subscribe'\n\nexport interface ModuleSubscribeFilter {\n /** @field if specified, at least one of the schemas must be present in the boundwtness to generate a notification */\n schema?: string[]\n}\n\n//requests notification when a boundwitness is added to the modules chain that meets the filter criteria\nexport type ModuleSubscribeQuery = Query<{\n /** @field The address that will receive notifications */\n address: string\n /** @field A subscribe with a null for filter is an unsubscribe */\n filter?: ModuleSubscribeFilter | null\n /** @field The maximum events queued per send [may increase frequency] */\n maxQueue?: number\n schema: ModuleSubscribeQuerySchema\n}>\n","import { AsObjectFactory } from '@xyo-network/object'\n\nimport { isModuleObject } from './isModuleObject'\n\nexport const asModuleObject = AsObjectFactory.create(isModuleObject)\n","import { IsObjectFactory, ObjectTypeShape } from '@xyo-network/object'\n\nimport { Module } from './Module'\n\nexport const requiredModuleShape: ObjectTypeShape = {\n address: 'string',\n config: 'object',\n params: 'object',\n queries: 'array',\n query: 'function',\n queryable: 'function',\n}\n\nconst factory = new IsObjectFactory<Module>()\n\nexport const isModuleObject = factory.create(requiredModuleShape)\n","import { AnyObject, EmptyObject, TypeCheck } from '@xyo-network/object'\n\nimport { asModuleObject } from './asModuleObject'\nimport { isModuleObject } from './isModuleObject'\nimport { Module } from './Module'\n\nexport type ModuleTypeCheck<T extends Module = Module> = TypeCheck<T>\n\nexport class IsModuleFactory<T extends Module = Module> {\n create(expectedQueries?: string[], additionalChecks?: TypeCheck<AnyObject | EmptyObject>[]): ModuleTypeCheck<T> {\n return (obj: unknown, config): obj is T => {\n const module = asModuleObject(obj)\n const result =\n isModuleObject(module, config) &&\n (expectedQueries?.reduce((prev, query) => prev && module.queries.includes(query), true) ?? true) &&\n //perform additional checks\n (additionalChecks?.reduce((prev, check) => prev && check(obj, config), true) ?? true)\n return result\n }\n }\n}\n","import { TypeCheck } from '@xyo-network/object'\n\nimport { ModuleDiscoverQuerySchema } from '../Queries'\nimport { IsModuleFactory } from './IsModuleFactory'\nimport { isModuleObject } from './isModuleObject'\nimport { Module } from './Module'\n\nexport const requiredModuleQueries: string[] = [\n /* We need to update this once live module conform */\n //ModuleDescribeQuerySchema,\n //ModuleAddressQuerySchema,\n ModuleDiscoverQuerySchema,\n //ModuleManifestQuerySchema,\n //ModuleSubscribeQuerySchema,\n]\n\n//we do not use IsInstanceFactory here to prevent a cycle\nconst factory = new IsModuleFactory<Module>()\n\nexport const isModule: TypeCheck<Module> = factory.create(requiredModuleQueries, [isModuleObject])\n","import { Promisable } from '@xylabs/promise'\nimport { IsObjectFactory, TypeCheck } from '@xyo-network/object'\n\nimport { ModuleEventData } from '../EventsModels'\nimport { Module, ModuleQueryFunctions } from '../module'\nimport { ModuleParams } from '../ModuleParams'\n\nexport interface ResolveFunctions {\n resolve<T extends ModuleInstance = ModuleInstance>(filter?: ModuleFilter<T>, options?: ModuleFilterOptions<T>): Promisable<T[]>\n resolve<T extends ModuleInstance = ModuleInstance>(nameOrAddress: string, options?: ModuleFilterOptions<T>): Promisable<T | undefined>\n resolve<T extends ModuleInstance = ModuleInstance>(\n nameOrAddressOrFilter?: ModuleFilter<T> | string,\n options?: ModuleFilterOptions<T>,\n ): Promisable<T | T[] | undefined>\n}\n\nexport interface ModuleResolver extends ResolveFunctions {\n addResolver: (resolver: ModuleResolver) => this\n isModuleResolver: boolean\n removeResolver: (resolver: ModuleResolver) => this\n}\n\nexport type ModuleInstance<TParams extends ModuleParams = ModuleParams, TEventData extends ModuleEventData = ModuleEventData> = Module<\n TParams,\n TEventData\n> &\n ResolveFunctions &\n ModuleQueryFunctions & {\n /* The resolver is a 'down' resolver. It can resolve the module or any children (if it is a node for example), that are in the module*/\n readonly downResolver: Omit<ModuleResolver, 'resolve'>\n\n /* The resolver is a 'up' resolver. It can resolve the parent or any children of the parent*/\n /* This is set by a NodeModule when attaching to the module */\n readonly upResolver: Omit<ModuleResolver, 'resolve'>\n }\n\nexport type InstanceTypeCheck<T extends ModuleInstance = ModuleInstance> = TypeCheck<T>\n\nexport class IsInstanceFactory<T extends ModuleInstance = ModuleInstance> extends IsObjectFactory<T> {}\n\nexport interface ModuleFilterOptions<T extends ModuleInstance = ModuleInstance> {\n direction?: 'up' | 'down' | 'all'\n identity?: InstanceTypeCheck<T>\n maxDepth?: number\n visibility?: 'public' | 'private' | 'all'\n}\n\nexport interface AddressModuleFilter<T extends ModuleInstance = ModuleInstance> extends ModuleFilterOptions<T> {\n address: string[]\n}\n\nexport interface NameModuleFilter<T extends ModuleInstance = ModuleInstance> extends ModuleFilterOptions<T> {\n name: string[]\n}\n\nexport interface QueryModuleFilter<T extends ModuleInstance = ModuleInstance> extends ModuleFilterOptions<T> {\n query: string[][]\n}\n\nexport type AnyModuleFilter<T extends ModuleInstance = ModuleInstance> = Partial<AddressModuleFilter<T>> &\n Partial<NameModuleFilter<T>> &\n Partial<QueryModuleFilter<T>>\n\nexport type ModuleFilter<T extends ModuleInstance = ModuleInstance> =\n | ModuleFilterOptions<T>\n | AddressModuleFilter<T>\n | NameModuleFilter<T>\n | QueryModuleFilter<T>\n","import { Module } from '../module'\n\n/**\n * Used to filter duplicates from an array of modules\n * @example: modulesArray.filter(duplicateModules)\n * @param value Current Module\n * @param index Current Module's index\n * @param array Module Array\n * @returns True if the Module's address is the first occurrence of\n * that address in the array, false otherwise\n */\nexport const duplicateModules = (value: Module, index: number, array: Module[]): value is Module => {\n return array.findIndex((v) => v.address === value.address) === index\n}\n","// Inspired by https://stackoverflow.com/a/49079549/2803259\n\nimport { every, isArray, isBoolean, isNull, isNumber, isPlainObject, isString, isUndefined, overSome } from '@xylabs/lodash'\n\nconst JSONPrimitiveChecks = [isUndefined, isNull, isBoolean, isNumber, isString]\nconst JSONComplexChecks = [isPlainObject, isArray]\n\nexport const serializable = (field: unknown, depth?: number): boolean | null => {\n let depthExceeded = false\n const decrementDepth = () => (depth ? depth-- : undefined)\n\n const recursiveSerializable = (field: unknown) => {\n if (depth !== undefined && depth < 1) {\n depthExceeded = true\n return false\n }\n\n // decrement during every recursion\n decrementDepth()\n\n const nestedSerializable = (field: unknown): boolean => overSome(JSONComplexChecks)(field) && every(field as object, recursiveSerializable)\n\n return overSome([...JSONPrimitiveChecks, nestedSerializable])(field)\n }\n\n const valid = recursiveSerializable(field)\n\n return depthExceeded ? null : valid\n}\n\nexport const serializableField = (field: unknown) => {\n return overSome([...JSONPrimitiveChecks, ...JSONComplexChecks])(field)\n}\n","import { isPayloadOfSchemaType, Payload } from '@xyo-network/payload-model'\n\nexport interface StateDictionary {\n [key: string]: string | number | undefined\n}\nexport interface State<T extends StateDictionary = StateDictionary> {\n state: T\n}\n\nexport const ModuleStateSchema = 'network.xyo.module.state' as const\nexport type ModuleStateSchema = typeof ModuleStateSchema\n\nexport type ModuleState<T extends StateDictionary = StateDictionary> = Payload<State<T>, ModuleStateSchema>\n\nexport const isModuleState = <T extends StateDictionary = StateDictionary>(payload?: Payload | null): payload is ModuleState<T> => {\n return isPayloadOfSchemaType<ModuleState<T>>(ModuleStateSchema)(payload)\n}\n","import { TypeCheck } from '@xyo-network/object'\n\nimport { isModuleInstance } from './instance'\nimport { isModule } from './module'\n\nexport const WithFactory = {\n create: <T extends object>(typeCheck: TypeCheck<T>) => {\n return <R>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n module: any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n closure: (module: T) => R,\n ): R | undefined => {\n return typeCheck(module) ? closure(module) : undefined\n }\n },\n}\n\nexport const withModule = WithFactory.create(isModule)\nexport const withModuleInstance = WithFactory.create(isModuleInstance)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACOO,IAAMA,qBAAyC;;;ACkB/C,SAASC,kBAAAA;AACd,SAAO,CAAqCC,gBAAAA;AAC1CA;EACF;AACF;AAJgBD;;;ACjBT,IAAME,4B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AOQ,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","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"]}
|