@xyo-network/module-model 5.2.27 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/neutral/Config/Config.d.ts +5 -3
  2. package/dist/neutral/Config/Config.d.ts.map +1 -1
  3. package/dist/neutral/Config/Fields.d.ts +2 -0
  4. package/dist/neutral/Config/Fields.d.ts.map +1 -1
  5. package/dist/neutral/CreatableModule/CreatableModuleRegistry.d.ts +1 -1
  6. package/dist/neutral/CreatableModule/CreatableModuleRegistry.d.ts.map +1 -1
  7. package/dist/neutral/Payload/Address.d.ts +6 -2
  8. package/dist/neutral/Payload/Address.d.ts.map +1 -1
  9. package/dist/neutral/Payload/AddressPreviousHash.d.ts +4 -2
  10. package/dist/neutral/Payload/AddressPreviousHash.d.ts.map +1 -1
  11. package/dist/neutral/Payload/Description.d.ts +4 -2
  12. package/dist/neutral/Payload/Description.d.ts.map +1 -1
  13. package/dist/neutral/Payload/ModuleState.d.ts +3 -1
  14. package/dist/neutral/Payload/ModuleState.d.ts.map +1 -1
  15. package/dist/neutral/Queries/Manifest.d.ts +4 -2
  16. package/dist/neutral/Queries/Manifest.d.ts.map +1 -1
  17. package/dist/neutral/Queries/ModuleAddress/Query.d.ts +4 -2
  18. package/dist/neutral/Queries/ModuleAddress/Query.d.ts.map +1 -1
  19. package/dist/neutral/Queries/State.d.ts +4 -2
  20. package/dist/neutral/Queries/State.d.ts.map +1 -1
  21. package/dist/neutral/Queries/Subscribe.d.ts +4 -2
  22. package/dist/neutral/Queries/Subscribe.d.ts.map +1 -1
  23. package/dist/neutral/index.mjs +31 -13
  24. package/dist/neutral/index.mjs.map +1 -1
  25. package/package.json +5 -5
  26. package/src/Config/Config.ts +5 -3
  27. package/src/Config/Fields.ts +3 -0
  28. package/src/CreatableModule/CreatableModuleRegistry.ts +3 -2
  29. package/src/Payload/Address.ts +5 -3
  30. package/src/Payload/AddressPreviousHash.ts +2 -2
  31. package/src/Payload/Description.ts +2 -2
  32. package/src/Payload/ModuleState.ts +4 -2
  33. package/src/Queries/Manifest.ts +2 -2
  34. package/src/Queries/ModuleAddress/Query.ts +2 -2
  35. package/src/Queries/State.ts +2 -2
  36. package/src/Queries/Subscribe.ts +2 -2
@@ -1,9 +1,11 @@
1
1
  import type { EmptyObject } from '@xylabs/sdk-js';
2
- import type { Payload, Schema } from '@xyo-network/payload-model';
2
+ import { type Payload, type Schema } from '@xyo-network/payload-model';
3
3
  import type { ArchivingModuleConfig } from './Archiving.ts';
4
4
  import type { ModuleConfigFields } from './Fields.ts';
5
5
  import type { ArchivingReentrancyConfig } from './Reentrancy.ts';
6
- export declare const ModuleConfigSchema: "network.xyo.module.config";
6
+ export declare const ModuleConfigSchema: "network.xyo.module.config" & {
7
+ readonly __schema: true;
8
+ };
7
9
  export type ModuleConfigSchema = typeof ModuleConfigSchema;
8
10
  export type WithAdditional<T extends EmptyObject = EmptyObject, TAdditional extends EmptyObject = EmptyObject> = T & TAdditional;
9
11
  export type ModuleConfig<TConfig extends EmptyObject | Payload = EmptyObject, TSchema extends Schema | void = void> = Payload<WithAdditional<ArchivingModuleConfig & ModuleConfigFields & ArchivingReentrancyConfig, TConfig>, TSchema extends void ? TConfig extends Payload ? TConfig['schema'] : Schema : TSchema>;
@@ -11,7 +13,7 @@ export type AnyConfigSchema<TConfig extends Omit<ModuleConfig, 'schema'> & {
11
13
  schema: Schema;
12
14
  } = Omit<ModuleConfig, 'schema'> & {
13
15
  schema: Schema;
14
- }> = ModuleConfig<TConfig, string>;
16
+ }> = ModuleConfig<TConfig, Schema>;
15
17
  export type OptionalConfigSchema<TConfig extends AnyConfigSchema<ModuleConfig> = AnyConfigSchema<ModuleConfig>> = Omit<TConfig, 'schema'> & {
16
18
  schema?: TConfig['schema'];
17
19
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../../src/Config/Config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EA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,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,IAC7I,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;AAEjC,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"}
@@ -29,6 +29,8 @@ export interface ModuleConfigFields {
29
29
  readonly sign?: boolean;
30
30
  /** @field Store the queries made to the module in an archivist if possible */
31
31
  readonly storeQueries?: boolean;
32
+ /** @field Time Budget setting for spans */
33
+ readonly timeBudget?: number;
32
34
  /** @field add a timestamp payload to every query */
33
35
  readonly timestamp?: boolean;
34
36
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Fields.d.ts","sourceRoot":"","sources":["../../../src/Config/Fields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAExD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAC1E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AAEzD,MAAM,WAAW,kBAAkB;IACjC,0CAA0C;IAC1C,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;IAElC,sEAAsE;IACtE,QAAQ,CAAC,SAAS,CAAC,EAAE,gBAAgB,CAAA;IAErC;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IAExB,QAAQ,C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AgI;IAChI,QAAQ,CAAC,IAAI,CAAC,EAAE,UAAU,CAAA;IAE1B,yCAAyC;IACzC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAEnD,QAAQ,CAAC,KAAK,CAAC,EAAE,WAAW,CAAA;IAE5B;sFACkF;IAClF,QAAQ,CAAC,QAAQ,CAAC,EAAE,oBAAoB,CAAA;IAExC,8BAA8B;IAC9B,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAA;IAEvB,8EAA8E;IAC9E,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAA;IAE/B,2CAA2C;IAC3C,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;IAE5B,qDAAqD;IACrD,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAC7B"}
@@ -1,4 +1,4 @@
1
- import type { Schema } from '@xyo-network/payload-model';
1
+ import { type Schema } from '@xyo-network/payload-model';
2
2
  import type { Labels } from '../Labels/index.ts';
3
3
  import type { CreatableModuleFactory, CreatableModuleInstance } from './CreatableModule.ts';
4
4
  import type { LabeledCreatableModuleFactory } from './LabeledCreatableModuleFactory.ts';
@@ -1 +1 @@
1
- {"version":3,"file":"CreatableModuleRegistry.d.ts","sourceRoot":"","sources":["../../../src/CreatableModule/CreatableModuleRegistry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAExD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,KAAK,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AAC3F,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAA;AAEvF,MAAM,WAAW,uBAAuB;IACtC,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,sBAAsB,GAAG,6BAA6B,CAAC,EAAE,GAAG,SAAS,CAAA;CACtF;AAqBD,eAAO,MAAM,8BAA8B,GAAI,OAAO,SAAS,uBAAuB,EACpF,UAAU,uBAAuB,EACjC,SAAS,sBAAsB,CAAC,OAAO,CAAC,GAAG,6BAA6B,CAAC,OAAO,CAAC,EACjF,SAAS,MAAM;AACf,wEAAwE;AACxE,UAAS,OAAO,GAAG,MAAM,GAAG,MAAM,EAAU,SAsC7C,CAAA;AAED,eAAO,MAAM,gCAAgC,GAC3C,WAAW,CAAC,sBAAsB,GAAG,6BAA6B,CAAC,EAAE,EACrE,WAAU,uBAA4B,EACtC,iBAAe,4BAMhB,CAAA;AAED,6DAA6D;AAC7D,eAAO,MAAM,6BAA6B,GACxC,SAAQ,uBAA4B,EACpC,GAAG,SAAS,uBAAuB,EAAE,KACpC,uBAUF,CAAA"}
1
+ {"version":3,"file":"CreatableModuleRegistry.d.ts","sourceRoot":"","sources":["../../../src/CreatableModule/CreatableModuleRegistry.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAElE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,KAAK,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AAC3F,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAA;AAEvF,MAAM,WAAW,uBAAuB;IACtC,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,sBAAsB,GAAG,6BAA6B,CAAC,EAAE,GAAG,SAAS,CAAA;CACtF;AAqBD,eAAO,MAAM,8BAA8B,GAAI,OAAO,SAAS,uBAAuB,EACpF,UAAU,uBAAuB,EACjC,SAAS,sBAAsB,CAAC,OAAO,CAAC,GAAG,6BAA6B,CAAC,OAAO,CAAC,EACjF,SAAS,MAAM;AACf,wEAAwE;AACxE,UAAS,OAAO,GAAG,MAAM,GAAG,MAAM,EAAU,SAsC7C,CAAA;AAED,eAAO,MAAM,gCAAgC,GAC3C,WAAW,CAAC,sBAAsB,GAAG,6BAA6B,CAAC,EAAE,EACrE,WAAU,uBAA4B,EACtC,iBAAe,4BAMhB,CAAA;AAED,6DAA6D;AAC7D,eAAO,MAAM,6BAA6B,GACxC,SAAQ,uBAA4B,EACpC,GAAG,SAAS,uBAAuB,EAAE,KACpC,uBAWF,CAAA"}
@@ -1,8 +1,12 @@
1
1
  import type { Address } from '@xylabs/sdk-js';
2
2
  import { type Payload } from '@xyo-network/payload-model';
3
- export declare const AddressSchema: "network.xyo.address";
3
+ export declare const AddressSchema: "network.xyo.address" & {
4
+ readonly __schema: true;
5
+ };
4
6
  export type AddressSchema = typeof AddressSchema;
5
- export declare const AddressChildSchema: "network.xyo.address.child";
7
+ export declare const AddressChildSchema: "network.xyo.address.child" & {
8
+ readonly __schema: true;
9
+ };
6
10
  export type AddressChildSchema = typeof AddressChildSchema;
7
11
  export interface AddressFields {
8
12
  address: Address;
@@ -1 +1 @@
1
- {"version":3,"file":"Address.d.ts","sourceRoot":"","sources":["../../../src/Payload/Address.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,EAAyB,KAAK,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEhF,eAAO,MAAM,aAAa,EAAG,qBAA8B,CAAA;AAC3D,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAA;AAEhD,eAAO,MAAM,kBAAkB,EAAG,2BAAoC,CAAA;AACtE,MAAM,MAAM,kBAAkB,GAAG,OAAO,kBAAkB,CAAA;AAE1D,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,aAAa,EAAE,aAAa,CAAC,CAAA;AAElE;;GAEG;AACH,eAAO,MAAM,gBAAgB,6CAAuD,CAAA;AACpF,eAAO,MAAM,gBAAgB,yDAA2C,CAAA;AACxE,eAAO,MAAM,wBAAwB,gFAAmD,CAAA;AAExF,MAAM,WAAW,kBAAmB,SAAQ,aAAa;IACvD;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAED,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAA"}
1
+ {"version":3,"file":"Address.d.ts","sourceRoot":"","sources":["../../../src/Payload/Address.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,EAC4B,KAAK,OAAO,EAC9C,MAAM,4BAA4B,CAAA;AAEnC,eAAO,MAAM,aAAa;;CAAwC,CAAA;AAClE,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAA;AAEhD,eAAO,MAAM,kBAAkB;;CAA8C,CAAA;AAC7E,MAAM,MAAM,kBAAkB,GAAG,OAAO,kBAAkB,CAAA;AAE1D,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,aAAa,EAAE,aAAa,CAAC,CAAA;AAElE;;GAEG;AACH,eAAO,MAAM,gBAAgB,6CAAuD,CAAA;AACpF,eAAO,MAAM,gBAAgB,yDAA2C,CAAA;AACxE,eAAO,MAAM,wBAAwB,gFAAmD,CAAA;AAExF,MAAM,WAAW,kBAAmB,SAAQ,aAAa;IACvD;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAED,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAA"}
@@ -1,6 +1,8 @@
1
1
  import type { Address } from '@xylabs/sdk-js';
2
- import type { Payload } from '@xyo-network/payload-model';
3
- export declare const AddressPreviousHashSchema: "network.xyo.address.hash.previous";
2
+ import { type Payload } from '@xyo-network/payload-model';
3
+ export declare const AddressPreviousHashSchema: "network.xyo.address.hash.previous" & {
4
+ readonly __schema: true;
5
+ };
4
6
  export type AddressPreviousHashSchema = typeof AddressPreviousHashSchema;
5
7
  export type AddressPreviousHashPayload = Payload<{
6
8
  address: Address;
@@ -1 +1 @@
1
- {"version":3,"file":"AddressPreviousHash.d.ts","sourceRoot":"","sources":["../../../src/Payload/AddressPreviousHash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEzD,eAAO,MAAM,yBAAyB,EAAG,mCAA4C,CAAA;AACrF,MAAM,MAAM,yBAAyB,GAAG,OAAO,yBAAyB,CAAA;AAExE,MAAM,MAAM,0BAA0B,GAAG,OAAO,CAC9C;IACE,OAAO,EAAE,OAAO,CAAA;IAChB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,EACD,yBAAyB,CAC1B,CAAA"}
1
+ {"version":3,"file":"AddressPreviousHash.d.ts","sourceRoot":"","sources":["../../../src/Payload/AddressPreviousHash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAY,KAAK,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEnE,eAAO,MAAM,yBAAyB;;CAAsD,CAAA;AAC5F,MAAM,MAAM,yBAAyB,GAAG,OAAO,yBAAyB,CAAA;AAExE,MAAM,MAAM,0BAA0B,GAAG,OAAO,CAC9C;IACE,OAAO,EAAE,OAAO,CAAA;IAChB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,EACD,yBAAyB,CAC1B,CAAA"}
@@ -1,6 +1,8 @@
1
- import type { Payload } from '@xyo-network/payload-model';
1
+ import { type Payload } from '@xyo-network/payload-model';
2
2
  import type { ModuleDescription } from '../ModuleDescription.ts';
3
- export declare const ModuleDescriptionSchema: "network.xyo.module.description";
3
+ export declare const ModuleDescriptionSchema: "network.xyo.module.description" & {
4
+ readonly __schema: true;
5
+ };
4
6
  export type ModuleDescriptionSchema = typeof ModuleDescriptionSchema;
5
7
  export type ModuleDescriptionPayload = Payload<ModuleDescription, ModuleDescriptionSchema>;
6
8
  //# sourceMappingURL=Description.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Description.d.ts","sourceRoot":"","sources":["../../../src/Payload/Description.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAEhE,eAAO,MAAM,uBAAuB,EAAG,gCAAyC,CAAA;AAChF,MAAM,MAAM,uBAAuB,GAAG,OAAO,uBAAuB,CAAA;AAEpE,MAAM,MAAM,wBAAwB,GAAG,OAAO,CAAC,iBAAiB,EAAE,uBAAuB,CAAC,CAAA"}
1
+ {"version":3,"file":"Description.d.ts","sourceRoot":"","sources":["../../../src/Payload/Description.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAEhE,eAAO,MAAM,uBAAuB;;CAAmD,CAAA;AACvF,MAAM,MAAM,uBAAuB,GAAG,OAAO,uBAAuB,CAAA;AAEpE,MAAM,MAAM,wBAAwB,GAAG,OAAO,CAAC,iBAAiB,EAAE,uBAAuB,CAAC,CAAA"}
@@ -5,7 +5,9 @@ export interface StateDictionary {
5
5
  export interface State<T extends StateDictionary = StateDictionary> {
6
6
  state: T;
7
7
  }
8
- export declare const ModuleStateSchema: "network.xyo.module.state";
8
+ export declare const ModuleStateSchema: "network.xyo.module.state" & {
9
+ readonly __schema: true;
10
+ };
9
11
  export type ModuleStateSchema = typeof ModuleStateSchema;
10
12
  export type ModuleState<T extends StateDictionary = StateDictionary> = Payload<State<T>, ModuleStateSchema>;
11
13
  export declare const isModuleState: <T extends StateDictionary = StateDictionary, TInput = unknown>(payload?: TInput) => payload is ModuleState<T> & TInput;
@@ -1 +1 @@
1
- {"version":3,"file":"ModuleState.d.ts","sourceRoot":"","sources":["../../../src/Payload/ModuleState.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAGtE,MAAM,WAAW,eAAe;IAC9B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;CAC/B;AACD,MAAM,WAAW,KAAK,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe;IAChE,KAAK,EAAE,CAAC,CAAA;CACT;AAED,eAAO,MAAM,iBAAiB,EAAG,0BAAmC,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,GAAI,CAAC,SAAS,eAAe,GAAG,eAAe,EAAE,MAAM,GAAG,OAAO,EAAE,UAAU,MAAM,KAAG,OAAO,IAAI,WAAW,CAAC,CAAC,CAAC,GAAG,MAE3I,CAAA;AAED,eAAO,MAAM,wBAAwB,GAAI,CAAC,SAAS,eAAe,GAAG,eAAe,EAClF,MAAM,GAAG,OAAO,EAAE,UAAU,MAAM,KAAG,OAAO,IAAI,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,MAE/E,CAAA;AAED,eAAO,MAAM,aAAa,uEAAsE,CAAA;AAChG,eAAO,MAAM,qBAAqB,8FAA8E,CAAA"}
1
+ {"version":3,"file":"ModuleState.d.ts","sourceRoot":"","sources":["../../../src/Payload/ModuleState.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAKtE,MAAM,WAAW,eAAe;IAC9B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;CAC/B;AACD,MAAM,WAAW,KAAK,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe;IAChE,KAAK,EAAE,CAAC,CAAA;CACT;AAED,eAAO,MAAM,iBAAiB;;CAA6C,CAAA;AAC3E,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,GAAI,CAAC,SAAS,eAAe,GAAG,eAAe,EAAE,MAAM,GAAG,OAAO,EAAE,UAAU,MAAM,KAAG,OAAO,IAAI,WAAW,CAAC,CAAC,CAAC,GAAG,MAE3I,CAAA;AAED,eAAO,MAAM,wBAAwB,GAAI,CAAC,SAAS,eAAe,GAAG,eAAe,EAClF,MAAM,GAAG,OAAO,EAAE,UAAU,MAAM,KAAG,OAAO,IAAI,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,MAE/E,CAAA;AAED,eAAO,MAAM,aAAa,uEAAsE,CAAA;AAChG,eAAO,MAAM,qBAAqB,8FAA8E,CAAA"}
@@ -1,5 +1,7 @@
1
- import type { Query } from '@xyo-network/payload-model';
2
- export declare const ModuleManifestQuerySchema: "network.xyo.query.module.manifest";
1
+ import { type Query } from '@xyo-network/payload-model';
2
+ export declare const ModuleManifestQuerySchema: "network.xyo.query.module.manifest" & {
3
+ readonly __schema: true;
4
+ };
3
5
  export type ModuleManifestQuerySchema = typeof ModuleManifestQuerySchema;
4
6
  export type ModuleManifestQuery = Query<{
5
7
  maxDepth?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"Manifest.d.ts","sourceRoot":"","sources":["../../../src/Queries/Manifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAA;AAEvD,eAAO,MAAM,yBAAyB,EAAG,mCAA4C,CAAA;AACrF,MAAM,MAAM,yBAAyB,GAAG,OAAO,yBAAyB,CAAA;AAExE,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,yBAAyB,CAAA;CAClC,CAAC,CAAA"}
1
+ {"version":3,"file":"Manifest.d.ts","sourceRoot":"","sources":["../../../src/Queries/Manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,KAAK,EAAE,MAAM,4BAA4B,CAAA;AAEjE,eAAO,MAAM,yBAAyB;;CAAsD,CAAA;AAC5F,MAAM,MAAM,yBAAyB,GAAG,OAAO,yBAAyB,CAAA;AAExE,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,yBAAyB,CAAA;CAClC,CAAC,CAAA"}
@@ -1,5 +1,7 @@
1
- import type { Query } from '@xyo-network/payload-model';
2
- export declare const ModuleAddressQuerySchema: "network.xyo.query.module.address";
1
+ import { type Query } from '@xyo-network/payload-model';
2
+ export declare const ModuleAddressQuerySchema: "network.xyo.query.module.address" & {
3
+ readonly __schema: true;
4
+ };
3
5
  export type ModuleAddressQuerySchema = typeof ModuleAddressQuerySchema;
4
6
  export type ModuleAddressQuery = Query<{
5
7
  schema: ModuleAddressQuerySchema;
@@ -1 +1 @@
1
- {"version":3,"file":"Query.d.ts","sourceRoot":"","sources":["../../../../src/Queries/ModuleAddress/Query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAA;AAEvD,eAAO,MAAM,wBAAwB,EAAG,kCAA2C,CAAA;AACnF,MAAM,MAAM,wBAAwB,GAAG,OAAO,wBAAwB,CAAA;AAEtE,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC;IACrC,MAAM,EAAE,wBAAwB,CAAA;CACjC,CAAC,CAAA"}
1
+ {"version":3,"file":"Query.d.ts","sourceRoot":"","sources":["../../../../src/Queries/ModuleAddress/Query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,KAAK,EAAE,MAAM,4BAA4B,CAAA;AAEjE,eAAO,MAAM,wBAAwB;;CAAqD,CAAA;AAC1F,MAAM,MAAM,wBAAwB,GAAG,OAAO,wBAAwB,CAAA;AAEtE,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC;IACrC,MAAM,EAAE,wBAAwB,CAAA;CACjC,CAAC,CAAA"}
@@ -1,5 +1,7 @@
1
- import type { Query } from '@xyo-network/payload-model';
2
- export declare const ModuleStateQuerySchema: "network.xyo.query.module.state";
1
+ import { type Query } from '@xyo-network/payload-model';
2
+ export declare const ModuleStateQuerySchema: "network.xyo.query.module.state" & {
3
+ readonly __schema: true;
4
+ };
3
5
  export type ModuleStateQuerySchema = typeof ModuleStateQuerySchema;
4
6
  export type ModuleStateQuery = Query<void, ModuleStateQuerySchema>;
5
7
  //# sourceMappingURL=State.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"State.d.ts","sourceRoot":"","sources":["../../../src/Queries/State.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAA;AAEvD,eAAO,MAAM,sBAAsB,EAAG,gCAAyC,CAAA;AAC/E,MAAM,MAAM,sBAAsB,GAAG,OAAO,sBAAsB,CAAA;AAElE,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,IAAI,EAAE,sBAAsB,CAAC,CAAA"}
1
+ {"version":3,"file":"State.d.ts","sourceRoot":"","sources":["../../../src/Queries/State.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,KAAK,EAAE,MAAM,4BAA4B,CAAA;AAEjE,eAAO,MAAM,sBAAsB;;CAAmD,CAAA;AACtF,MAAM,MAAM,sBAAsB,GAAG,OAAO,sBAAsB,CAAA;AAElE,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,IAAI,EAAE,sBAAsB,CAAC,CAAA"}
@@ -1,6 +1,8 @@
1
1
  import type { Address } from '@xylabs/sdk-js';
2
- import type { Query } from '@xyo-network/payload-model';
3
- export declare const ModuleSubscribeQuerySchema: "network.xyo.query.module.subscribe";
2
+ import { type Query } from '@xyo-network/payload-model';
3
+ export declare const ModuleSubscribeQuerySchema: "network.xyo.query.module.subscribe" & {
4
+ readonly __schema: true;
5
+ };
4
6
  export type ModuleSubscribeQuerySchema = typeof ModuleSubscribeQuerySchema;
5
7
  export interface ModuleSubscribeFilter {
6
8
  /** @field if specified, at least one of the schemas must be present in the boundwtness to generate a notification */
@@ -1 +1 @@
1
- {"version":3,"file":"Subscribe.d.ts","sourceRoot":"","sources":["../../../src/Queries/Subscribe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAA;AAEvD,eAAO,MAAM,0BAA0B,EAAG,oCAA6C,CAAA;AACvF,MAAM,MAAM,0BAA0B,GAAG,OAAO,0BAA0B,CAAA;AAE1E,MAAM,WAAW,qBAAqB;IACpC,qHAAqH;IACrH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;CAClB;AAGD,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC;IACvC,yDAAyD;IACzD,OAAO,EAAE,OAAO,CAAA;IAChB,kEAAkE;IAClE,MAAM,CAAC,EAAE,qBAAqB,GAAG,IAAI,CAAA;IACrC,yEAAyE;IACzE,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,0BAA0B,CAAA;CACnC,CAAC,CAAA"}
1
+ {"version":3,"file":"Subscribe.d.ts","sourceRoot":"","sources":["../../../src/Queries/Subscribe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAY,KAAK,KAAK,EAAE,MAAM,4BAA4B,CAAA;AAEjE,eAAO,MAAM,0BAA0B;;CAAuD,CAAA;AAC9F,MAAM,MAAM,0BAA0B,GAAG,OAAO,0BAA0B,CAAA;AAE1E,MAAM,WAAW,qBAAqB;IACpC,qHAAqH;IACrH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;CAClB;AAGD,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC;IACvC,yDAAyD;IACzD,OAAO,EAAE,OAAO,CAAA;IAChB,kEAAkE;IAClE,MAAM,CAAC,EAAE,qBAAqB,GAAG,IAAI,CAAA;IACrC,yEAAyE;IACzE,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,0BAA0B,CAAA;CACnC,CAAC,CAAA"}
@@ -1,5 +1,8 @@
1
1
  // src/Config/Config.ts
2
- var ModuleConfigSchema = "network.xyo.module.config";
2
+ import {
3
+ asSchema
4
+ } from "@xyo-network/payload-model";
5
+ var ModuleConfigSchema = asSchema("network.xyo.module.config", true);
3
6
 
4
7
  // src/CreatableModule/CreatableModule.ts
5
8
  function creatableModule() {
@@ -15,6 +18,7 @@ function labeledCreatableModule() {
15
18
 
16
19
  // src/CreatableModule/CreatableModuleRegistry.ts
17
20
  import { isTruthy } from "@xylabs/sdk-js";
21
+ import { asSchema as asSchema2 } from "@xyo-network/payload-model";
18
22
  var buildModuleFactory = (mod, labels) => {
19
23
  const factory5 = {
20
24
  // Destructure instance properties
@@ -65,7 +69,8 @@ var registerCreatableModuleFactories = (factories, registry = {}, primary = fals
65
69
  };
66
70
  var assignCreatableModuleRegistry = (target = {}, ...sources) => {
67
71
  for (const source of sources)
68
- for (const [schema, factories] of Object.entries(source)) {
72
+ for (const [schemaString, factories] of Object.entries(source)) {
73
+ const schema = asSchema2(schemaString, true);
69
74
  if (factories) {
70
75
  const existingFactories = target[schema];
71
76
  target[schema] = [...existingFactories ?? [], ...factories];
@@ -141,16 +146,20 @@ import { IsObjectFactory as IsObjectFactory2 } from "@xylabs/sdk-js";
141
146
  import { AsObjectFactory as AsObjectFactory2 } from "@xylabs/sdk-js";
142
147
 
143
148
  // src/Queries/Manifest.ts
144
- var ModuleManifestQuerySchema = "network.xyo.query.module.manifest";
149
+ import { asSchema as asSchema3 } from "@xyo-network/payload-model";
150
+ var ModuleManifestQuerySchema = asSchema3("network.xyo.query.module.manifest", true);
145
151
 
146
152
  // src/Queries/ModuleAddress/Query.ts
147
- var ModuleAddressQuerySchema = "network.xyo.query.module.address";
153
+ import { asSchema as asSchema4 } from "@xyo-network/payload-model";
154
+ var ModuleAddressQuerySchema = asSchema4("network.xyo.query.module.address", true);
148
155
 
149
156
  // src/Queries/State.ts
150
- var ModuleStateQuerySchema = "network.xyo.query.module.state";
157
+ import { asSchema as asSchema5 } from "@xyo-network/payload-model";
158
+ var ModuleStateQuerySchema = asSchema5("network.xyo.query.module.state", true);
151
159
 
152
160
  // src/Queries/Subscribe.ts
153
- var ModuleSubscribeQuerySchema = "network.xyo.query.module.subscribe";
161
+ import { asSchema as asSchema6 } from "@xyo-network/payload-model";
162
+ var ModuleSubscribeQuerySchema = asSchema6("network.xyo.query.module.subscribe", true);
154
163
 
155
164
  // src/module/asModuleObject.ts
156
165
  import { AsObjectFactory } from "@xylabs/sdk-js";
@@ -352,23 +361,32 @@ var isModuleIdentifierPart = (value) => {
352
361
 
353
362
  // src/Payload/Address.ts
354
363
  import { AsObjectFactory as AsObjectFactory5 } from "@xylabs/sdk-js";
355
- import { isPayloadOfSchemaType } from "@xyo-network/payload-model";
356
- var AddressSchema = "network.xyo.address";
357
- var AddressChildSchema = "network.xyo.address.child";
364
+ import {
365
+ asSchema as asSchema7,
366
+ isPayloadOfSchemaType
367
+ } from "@xyo-network/payload-model";
368
+ var AddressSchema = asSchema7("network.xyo.address", true);
369
+ var AddressChildSchema = asSchema7("network.xyo.address.child", true);
358
370
  var isAddressPayload = isPayloadOfSchemaType(AddressSchema);
359
371
  var asAddressPayload = AsObjectFactory5.create(isAddressPayload);
360
372
  var asOptionalAddressPayload = AsObjectFactory5.createOptional(isAddressPayload);
361
373
 
362
374
  // src/Payload/AddressPreviousHash.ts
363
- var AddressPreviousHashSchema = "network.xyo.address.hash.previous";
375
+ import { asSchema as asSchema8 } from "@xyo-network/payload-model";
376
+ var AddressPreviousHashSchema = asSchema8("network.xyo.address.hash.previous", true);
364
377
 
365
378
  // src/Payload/Description.ts
366
- var ModuleDescriptionSchema = "network.xyo.module.description";
379
+ import { asSchema as asSchema9 } from "@xyo-network/payload-model";
380
+ var ModuleDescriptionSchema = asSchema9("network.xyo.module.description", true);
367
381
 
368
382
  // src/Payload/ModuleState.ts
369
383
  import { AsObjectFactory as AsObjectFactory6 } from "@xylabs/sdk-js";
370
- import { isPayloadOfSchemaType as isPayloadOfSchemaType2, isPayloadOfSchemaTypeWithSources } from "@xyo-network/payload-model";
371
- var ModuleStateSchema = "network.xyo.module.state";
384
+ import {
385
+ asSchema as asSchema10,
386
+ isPayloadOfSchemaType as isPayloadOfSchemaType2,
387
+ isPayloadOfSchemaTypeWithSources
388
+ } from "@xyo-network/payload-model";
389
+ var ModuleStateSchema = asSchema10("network.xyo.module.state", true);
372
390
  var isModuleState = (payload) => {
373
391
  return isPayloadOfSchemaType2(ModuleStateSchema)(payload);
374
392
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Config/Config.ts","../../src/CreatableModule/CreatableModule.ts","../../src/CreatableModule/CreatableModuleRegistry.ts","../../src/CreatableModule/LabeledCreatableModuleFactory.ts","../../src/CreatableModule/ModuleFactory.ts","../../src/DetailsError.ts","../../src/instance/asModuleInstance.ts","../../src/instance/isModuleInstance.ts","../../src/module/asModule.ts","../../src/Queries/Manifest.ts","../../src/Queries/ModuleAddress/Query.ts","../../src/Queries/State.ts","../../src/Queries/Subscribe.ts","../../src/module/asModuleObject.ts","../../src/module/isModuleObject.ts","../../src/module/IsModuleFactory.ts","../../src/module/isModule.ts","../../src/instance/attachable/asAttachableInstance.ts","../../src/instance/attachable/isAttachableInstance.ts","../../src/instance/attachable/AttachableInstance.ts","../../src/instance/Instance.ts","../../src/instance/ObjectFilter.ts","../../src/instance/ModuleFilter.ts","../../src/instance/ObjectResolver.ts","../../src/instance/ModuleResolver.ts","../../src/Labels/Labels.ts","../../src/Labels/standard/View.ts","../../src/lib/duplicateModules.ts","../../src/lib/serializable.ts","../../src/ModuleIdentifier.ts","../../src/Payload/Address.ts","../../src/Payload/AddressPreviousHash.ts","../../src/Payload/Description.ts","../../src/Payload/ModuleState.ts","../../src/ResolveHelper/resolveAddressToInstance.ts","../../src/ResolveHelper/resolveAll.ts","../../src/ResolveHelper/ResolveHelper.ts","../../src/ResolveHelper/ResolveHelperStatic.ts","../../src/ResolveHelper/resolvePathToInstance.ts","../../src/ResolveHelper/resolveLocalNameToInstance.ts","../../src/ResolveHelper/resolveLocalNameToAddress.ts","../../src/ResolveHelper/transformModuleIdentifier.ts","../../src/ResolveHelper/resolvePathToAddress.ts","../../src/ResolveHelper/traceModuleIdentifier.ts","../../src/withModule.ts"],"sourcesContent":["import type { EmptyObject } from '@xylabs/sdk-js'\nimport type { Payload, Schema } from '@xyo-network/payload-model'\n\nimport type { ArchivingModuleConfig } from './Archiving.ts'\nimport type { ModuleConfigFields } from './Fields.ts'\nimport type { ArchivingReentrancyConfig } from './Reentrancy.ts'\n\nexport const ModuleConfigSchema = 'network.xyo.module.config' as const\nexport type ModuleConfigSchema = typeof ModuleConfigSchema\n\nexport type WithAdditional<T extends EmptyObject = EmptyObject, TAdditional extends EmptyObject = EmptyObject>\n = T & TAdditional\n\nexport type ModuleConfig<TConfig extends EmptyObject | Payload = EmptyObject, TSchema extends Schema | void = void> = Payload<\n WithAdditional<ArchivingModuleConfig & ModuleConfigFields & ArchivingReentrancyConfig, TConfig>,\n TSchema extends void ? TConfig extends Payload ? TConfig['schema']\n : Schema : TSchema\n>\n\nexport type AnyConfigSchema<TConfig extends Omit<ModuleConfig, 'schema'> & { schema: Schema } = Omit<ModuleConfig, 'schema'> & { schema: Schema }>\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 type {\n Creatable, CreatableInstance, Logger,\n} from '@xylabs/sdk-js'\nimport type { Schema } from '@xyo-network/payload-model'\n\nimport type { ModuleEventData } from '../EventsModels/index.ts'\nimport type { AttachableModuleInstance } from '../instance/index.ts'\nimport type { WithOptionalLabels } from '../Labels/index.ts'\nimport type { ModuleParams } from '../ModuleParams.ts'\nimport type { LabeledCreatableModuleFactory } from './LabeledCreatableModuleFactory.ts'\n\nexport interface CreatableModuleInstance<TParams extends ModuleParams = ModuleParams, TEventData extends ModuleEventData = ModuleEventData>\n extends CreatableInstance<TParams, TEventData>, AttachableModuleInstance<TParams, TEventData> {}\n\nexport interface CreatableModuleFactory<T extends CreatableModuleInstance = CreatableModuleInstance>\n extends Omit<CreatableModule<T>, 'create' | 'createHandler' | 'paramsHandler'> {\n creatableModule: CreatableModule<T>\n defaultParams?: Partial<T['params']>\n\n create(\n this: CreatableModuleFactory<T>,\n params?: Partial<T['params']>): Promise<T>\n}\n\nexport interface LabeledCreatableModule<T extends CreatableModuleInstance = CreatableModuleInstance> extends CreatableModule<T>, WithOptionalLabels {\n factory(params?: Partial<T['params']>): LabeledCreatableModuleFactory<T>\n}\n\nexport interface CreatableModule<T extends CreatableModuleInstance = CreatableModuleInstance> extends Creatable<T> {\n configSchemas: Schema[]\n defaultConfigSchema: Schema\n defaultLogger?: Logger\n new(key: unknown, params: Partial<T['params']>): T\n factory(params?: Partial<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 CreatableModuleInstance = CreatableModuleInstance>() {\n return <U extends CreatableModule<TModule>>(constructor: U) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n constructor\n }\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 labeledCreatableModule<TModule extends CreatableModuleInstance = CreatableModuleInstance>() {\n return <U extends LabeledCreatableModule<TModule>>(constructor: U) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n constructor\n }\n}\n","import { isTruthy } from '@xylabs/sdk-js'\nimport type { Schema } from '@xyo-network/payload-model'\n\nimport type { Labels } from '../Labels/index.ts'\nimport type { CreatableModuleFactory, CreatableModuleInstance } from './CreatableModule.ts'\nimport type { LabeledCreatableModuleFactory } from './LabeledCreatableModuleFactory.ts'\n\nexport interface CreatableModuleRegistry {\n [key: Schema]: (CreatableModuleFactory | LabeledCreatableModuleFactory)[] | undefined\n}\n\nconst buildModuleFactory = <TModule extends CreatableModuleInstance>(\n mod: CreatableModuleFactory<TModule>,\n labels?: Labels,\n): LabeledCreatableModuleFactory<TModule> => {\n const factory: LabeledCreatableModuleFactory<TModule> = {\n // Destructure instance properties\n ...mod,\n\n configSchemas: mod.configSchemas,\n // Copy static methods\n create: mod.create.bind(mod) as LabeledCreatableModuleFactory<TModule>['create'],\n\n defaultConfigSchema: mod.defaultConfigSchema,\n // Merge module & supplied labels\n labels: { ...(mod as LabeledCreatableModuleFactory).labels, ...labels },\n }\n return factory\n}\n\nexport const registerCreatableModuleFactory = <TModule extends CreatableModuleInstance>(\n registry: CreatableModuleRegistry,\n factory: CreatableModuleFactory<TModule> | LabeledCreatableModuleFactory<TModule>,\n labels?: Labels,\n /** register this as the primary factory for every schema it supports */\n primary: boolean | Schema | Schema[] = false,\n) => {\n const primarySchemas\n = primary !== true && isTruthy(primary)\n ? Array.isArray(primary)\n ? primary\n : [primary]\n : []\n\n for (const primarySchema of primarySchemas) {\n if (!factory.configSchemas.includes(primarySchema)) {\n console.warn(`Primary schema ${primary} not found in factory configSchemas`)\n }\n }\n\n const isPrimaryForSchema = (schema: Schema) => {\n switch (typeof primary) {\n case 'boolean': {\n return primary\n }\n case 'string': {\n return schema === primary\n }\n case 'object': {\n if (Array.isArray(primary)) {\n return primary.includes(schema)\n }\n }\n }\n throw new Error(`Invalid primary value: ${primary}`)\n }\n\n const factoryClone: LabeledCreatableModuleFactory<TModule> = buildModuleFactory(factory, labels)\n // add the defaultConfigSchema as the first key in the registry\n registry[factory.defaultConfigSchema] = [factoryClone, ...(registry[factoryClone.defaultConfigSchema] ?? [])]\n for (const schema of factoryClone.configSchemas) {\n registry[schema] = isPrimaryForSchema(schema) ? [factoryClone, ...(registry[schema] ?? [])] : [...(registry[schema] ?? []), factoryClone]\n }\n}\n\nexport const registerCreatableModuleFactories = (\n factories: (CreatableModuleFactory | LabeledCreatableModuleFactory)[],\n registry: CreatableModuleRegistry = {},\n primary = false,\n) => {\n for (const factory of factories) {\n registerCreatableModuleFactory(registry, factory, undefined, primary)\n }\n return registry\n}\n\n/** @deprecated use registerCreatableModuleFactory instead */\nexport const assignCreatableModuleRegistry = (\n target: CreatableModuleRegistry = {},\n ...sources: CreatableModuleRegistry[]\n): CreatableModuleRegistry => {\n for (const source of sources)\n for (const [schema, factories] of Object.entries(source)) {\n if (factories) {\n const existingFactories = target[schema]\n target[schema] = [...existingFactories ?? [], ...factories]\n }\n }\n\n return target\n}\n","import type { WithOptionalLabels } from '../Labels/index.ts'\nimport type { CreatableModuleFactory, CreatableModuleInstance } from './CreatableModule.ts'\n\nexport type LabeledCreatableModuleFactory<T extends CreatableModuleInstance = CreatableModuleInstance> = CreatableModuleFactory<T> & WithOptionalLabels\n\nexport const hasLabels = (factory: CreatableModuleFactory | LabeledCreatableModuleFactory): factory is LabeledCreatableModuleFactory => {\n return (factory as LabeledCreatableModuleFactory).labels !== undefined\n}\n\n/**\n * Class annotation to be used to decorate Modules which support\n * an asynchronous labeled creation factory pattern\n * @returns The decorated Module requiring it implement the members\n * of the CreatableModule as statics properties/methods\n */\nexport function labeledCreatableModuleFactory<TModule extends CreatableModuleInstance = CreatableModuleInstance>() {\n return <U extends LabeledCreatableModuleFactory<TModule>>(constructor: U) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n constructor\n }\n}\n","import type { Logger } from '@xylabs/sdk-js'\nimport { assertEx } from '@xylabs/sdk-js'\nimport type { Schema } from '@xyo-network/payload-model'\n\nimport type { Labels, WithOptionalLabels } from '../Labels/index.ts'\nimport type {\n CreatableModule, CreatableModuleFactory, CreatableModuleInstance,\n} from './CreatableModule.ts'\n\nexport class ModuleFactory<TModule extends CreatableModuleInstance> implements CreatableModuleFactory<TModule> {\n configSchemas: CreatableModule<TModule>['configSchemas']\n\n creatableModule: CreatableModule<TModule>\n\n defaultConfigSchema: Schema\n\n defaultLogger?: Logger\n\n defaultParams?: Partial<TModule['params']>\n\n labels?: Labels\n\n constructor(\n creatableModule: CreatableModule<TModule>,\n params?: Partial<TModule['params']>,\n labels: Labels = {},\n ) {\n this.creatableModule = creatableModule\n this.defaultParams = params\n this.configSchemas = creatableModule.configSchemas\n this.defaultConfigSchema = creatableModule.defaultConfigSchema\n assertEx(this.configSchemas.includes(this.defaultConfigSchema), () => 'defaultConfigSchema must be in configSchemas')\n this.labels = Object.assign({}, (creatableModule as WithOptionalLabels).labels ?? {}, labels ?? {})\n }\n\n static withParams<T extends CreatableModuleInstance>(\n creatableModule: CreatableModule<T>,\n params?: Partial<T['params']>,\n labels: Labels = {},\n ) {\n return new ModuleFactory<T>(creatableModule, params, labels)\n }\n\n create(this: CreatableModuleFactory<TModule>, params?: Partial<TModule['params']>): Promise<TModule> {\n const mergedParams: TModule['params'] = {\n ...this.defaultParams,\n ...params,\n config: {\n schema: this.creatableModule.defaultConfigSchema,\n ...this.defaultParams?.config,\n ...params?.config,\n },\n } as TModule['params']\n return this.creatableModule.create<TModule>(mergedParams)\n }\n\n factory<T extends CreatableModuleInstance>(this: CreatableModuleFactory<T>, params?: Partial<T['params']>, labels: Labels = {}): CreatableModuleFactory<T> {\n return new ModuleFactory<T>(this.creatableModule, params, labels)\n }\n}\n","import type { JsonValue } from '@xylabs/sdk-js'\n\nexport class ModuleDetailsError extends Error {\n details?: JsonValue\n constructor(\n message: string,\n details?: JsonValue,\n ) {\n super(message)\n this.details = details\n this.name = 'ModuleError'\n }\n}\n","import { AsObjectFactory } from '@xylabs/sdk-js'\n\nimport { isModuleInstance } from './isModuleInstance.ts'\n\nexport const asModuleInstance = AsObjectFactory.create(isModuleInstance)\n","import type { ObjectTypeShape, TypeCheck } from '@xylabs/sdk-js'\nimport { IsObjectFactory } from '@xylabs/sdk-js'\n\nimport { isModule } from '../module/index.ts'\nimport type { ModuleInstance } from './Instance.ts'\n\nexport const requiredModuleInstanceFunctions: ObjectTypeShape = {\n manifest: 'function',\n state: '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/sdk-js'\n\nimport { isModule } from './isModule.ts'\n\nexport const asModule = AsObjectFactory.create(isModule)\n","import type { Query } from '@xyo-network/payload-model'\n\nexport const ModuleManifestQuerySchema = 'network.xyo.query.module.manifest' as const\nexport type ModuleManifestQuerySchema = typeof ModuleManifestQuerySchema\n\nexport type ModuleManifestQuery = Query<{\n maxDepth?: number\n schema: ModuleManifestQuerySchema\n}>\n","import type { Query } from '@xyo-network/payload-model'\n\nexport const ModuleAddressQuerySchema = 'network.xyo.query.module.address' as const\nexport type ModuleAddressQuerySchema = typeof ModuleAddressQuerySchema\n\nexport type ModuleAddressQuery = Query<{\n schema: ModuleAddressQuerySchema\n}>\n","import type { Query } from '@xyo-network/payload-model'\n\nexport const ModuleStateQuerySchema = 'network.xyo.query.module.state' as const\nexport type ModuleStateQuerySchema = typeof ModuleStateQuerySchema\n\nexport type ModuleStateQuery = Query<void, ModuleStateQuerySchema>\n","import type { Address } from '@xylabs/sdk-js'\nimport type { Query } from '@xyo-network/payload-model'\n\nexport const ModuleSubscribeQuerySchema = 'network.xyo.query.module.subscribe' as const\nexport type ModuleSubscribeQuerySchema = typeof ModuleSubscribeQuerySchema\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: Address\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/sdk-js'\n\nimport { isModuleObject } from './isModuleObject.ts'\n\nexport const asModuleObject = AsObjectFactory.create(isModuleObject)\n","import type { ObjectTypeShape, TypeCheck } from '@xylabs/sdk-js'\nimport { IsObjectFactory } from '@xylabs/sdk-js'\n\nimport type { Module } from './Module.ts'\n\nexport const requiredModuleShape: ObjectTypeShape = {\n address: 'string',\n queries: 'array',\n query: 'function',\n}\n\nconst factory = new IsObjectFactory<Module>()\n\nexport const isModuleObject: TypeCheck<Module> = factory.create(requiredModuleShape)\n","import type {\n AnyNonPromise,\n AnyObject, EmptyObject, TypeCheck,\n TypeCheckConfig,\n} from '@xylabs/sdk-js'\n\nimport { asModuleObject } from './asModuleObject.ts'\nimport { isModuleObject } from './isModuleObject.ts'\nimport type { Module } from './Module.ts'\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 const result = (obj: AnyNonPromise, config?: TypeCheckConfig | number): obj is T => {\n const mod = asModuleObject(obj)\n return (\n isModuleObject(mod, config)\n // eslint-disable-next-line unicorn/no-array-reduce\n && (expectedQueries?.reduce((prev, query) => prev && mod.queries.includes(query), true) ?? true)\n // perform additional checks\n // eslint-disable-next-line unicorn/no-array-reduce\n && (additionalChecks?.reduce((prev, check) => prev && check(obj, config), true) ?? true)\n )\n }\n return result\n }\n}\n","import type { TypeCheck } from '@xylabs/sdk-js'\nimport type { Schema } from '@xyo-network/payload-model'\n\nimport { ModuleStateQuerySchema } from '../Queries/index.ts'\nimport { IsModuleFactory } from './IsModuleFactory.ts'\nimport { isModuleObject } from './isModuleObject.ts'\nimport type { Module } from './Module.ts'\n\nexport const requiredModuleQueries: Schema[] = [ModuleStateQuerySchema]\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 { AsObjectFactory } from '@xylabs/sdk-js'\n\nimport { isAttachableModuleInstance } from './isAttachableInstance.ts'\n\nexport const asAttachableModuleInstance = AsObjectFactory.create(isAttachableModuleInstance)\n","import type { ObjectTypeShape, TypeCheck } from '@xylabs/sdk-js'\nimport { IsObjectFactory } from '@xylabs/sdk-js'\n\nimport { isModuleInstance } from '../isModuleInstance.ts'\nimport type { AttachableModuleInstance } from './AttachableInstance.ts'\n\nexport const requiredAttachableModuleInstanceFunctions: ObjectTypeShape = {\n downResolver: 'object',\n upResolver: 'object',\n}\n\n// we do not use IsInstanceFactory here to prevent a cycle\nconst factory = new IsObjectFactory<AttachableModuleInstance>()\n\nexport const isAttachableModuleInstance: TypeCheck<AttachableModuleInstance> = factory.create(requiredAttachableModuleInstanceFunctions, [\n isModuleInstance,\n])\n","import type { CreatableInstance, TypeCheck } from '@xylabs/sdk-js'\nimport { IsObjectFactory } from '@xylabs/sdk-js'\n\nimport type { ModuleEventData } from '../../EventsModels/index.ts'\nimport type { ModuleParams } from '../../ModuleParams.ts'\nimport type { ModuleInstance } from '../Instance.ts'\nimport type { ModuleResolverInstance } from '../ModuleResolver.ts'\n\nexport interface AttachableModuleInstance<TParams extends ModuleParams = ModuleParams, TEventData extends ModuleEventData = ModuleEventData>\n extends ModuleInstance<TParams, TEventData>, CreatableInstance<TParams, TEventData> {\n config: TParams['config']\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: ModuleResolverInstance\n\n // The resolver that gets called by children (usually only Nodes have this)\n readonly privateResolver: ModuleResolverInstance\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: ModuleResolverInstance\n}\n\nexport type AttachableModuleInstanceTypeCheck<T extends AttachableModuleInstance = AttachableModuleInstance> = TypeCheck<T>\n\nexport class IsAttachableModuleInstanceFactory<T extends AttachableModuleInstance = AttachableModuleInstance> extends IsObjectFactory<T> {}\n","import type {\n Address, CreatableStatus, Promisable,\n TypeCheck,\n} from '@xylabs/sdk-js'\nimport { IsObjectFactory, toSafeJsonString } from '@xylabs/sdk-js'\nimport type { AccountInstance } from '@xyo-network/account-model'\n\nimport type { ModuleEventData } from '../EventsModels/index.ts'\nimport type { Module, ModuleQueryFunctions } from '../module/index.ts'\nimport type { ModuleIdentifier, ModuleName } from '../ModuleIdentifier.ts'\nimport type { ModuleParams } from '../ModuleParams.ts'\nimport type { Direction } from './ObjectFilter.ts'\nimport type { ObjectResolver } from './ObjectResolver.ts'\n\nexport type ModulePipeLine = Lowercase<'one-to-one' | 'one-to-many' | 'many-to-one' | 'many-to-many'>\n\nexport type ModuleStatus = CreatableStatus | 'wrapped' | 'proxy'\n\nexport class DeadModuleError extends Error {\n error: Error | undefined\n id: ModuleIdentifier\n constructor(\n id: ModuleIdentifier,\n error: Error | undefined,\n msg = 'Dead Module Error',\n ) {\n super(`${msg} [${id}]: ${error?.message ?? toSafeJsonString(error)}`)\n this.id = id\n this.error = error\n\n // Set the prototype explicitly.\n Object.setPrototypeOf(this, DeadModuleError.prototype)\n }\n}\n\nexport interface AddressToWeakInstanceCache {\n get: (address: Address) => WeakRef<ModuleInstance> | null\n set: (address: Address, instance: WeakRef<ModuleInstance> | null) => void\n}\n\nexport interface ModuleFamilyFunctions {\n account?: AccountInstance\n addParent: (mod: ModuleInstance) => void\n addressCache?: (direction: Direction, includePrivate: boolean) => AddressToWeakInstanceCache | undefined\n modName?: ModuleName\n parents: () => Promisable<ModuleInstance[]>\n privateChildren: () => Promisable<ModuleInstance[]>\n publicChildren: () => Promisable<ModuleInstance[]>\n removeParent: (address: Address) => void\n siblings: () => Promisable<ModuleInstance[]>\n}\n\nexport interface ModuleInstance<TParams extends ModuleParams = ModuleParams, TEventData extends ModuleEventData = ModuleEventData>\n extends Module<TParams, TEventData>,\n ObjectResolver<ModuleInstance>,\n ModuleQueryFunctions,\n ModuleFamilyFunctions {\n readonly pipeline?: ModulePipeLine\n\n // if the module has become non-functional, such as a broken bridge connection, this will be 'dead'\n readonly status: ModuleStatus | null\n}\n\nexport type InstanceTypeCheck<T extends ModuleInstance = ModuleInstance> = TypeCheck<T>\n\nexport class IsInstanceFactory<T extends ModuleInstance = ModuleInstance> extends IsObjectFactory<T> {}\n","import type {\n Address,\n AnyObject, EmptyObject, TypeCheck,\n} from '@xylabs/sdk-js'\n\nimport type { ModuleName } from '../ModuleIdentifier.ts'\n\nexport type Direction = 'up' | 'down' | 'all'\nexport type Visibility = 'public' | 'private' | 'all'\n\nexport interface ResolveStrategy {\n maxDepth?: number\n required?: boolean | 'warn' | 'log'\n retry?: number\n timeout?: number\n}\n\nexport interface ObjectFilterOptions<T extends EmptyObject = AnyObject> extends ResolveStrategy {\n direction?: Direction\n identity?: TypeCheck<T>\n}\n\nexport interface AddressObjectFilter<T extends EmptyObject = AnyObject> extends ObjectFilterOptions<T> {\n address: Address[]\n}\n\nexport const isAddressObjectFilter = <T extends EmptyObject = AnyObject>(value: unknown): value is AddressObjectFilter<T> =>\n (value as AddressObjectFilter<T>).address !== undefined\n\nexport interface NameObjectFilter<T extends EmptyObject = AnyObject> extends ObjectFilterOptions<T> {\n name: ModuleName[]\n}\n\nexport const isNameObjectFilter = <T extends EmptyObject = AnyObject>(value: unknown): value is NameObjectFilter<T> =>\n (value as NameObjectFilter<T>).name !== undefined\n\nexport interface QueryObjectFilter<T extends EmptyObject = AnyObject> extends ObjectFilterOptions<T> {\n query: string[][]\n}\n\nexport const isQueryObjectFilter = <T extends EmptyObject = AnyObject>(value: unknown): value is QueryObjectFilter<T> =>\n (value as QueryObjectFilter<T>).query !== undefined\n\nexport type AnyObjectFilter<T extends EmptyObject = AnyObject> = Partial<AddressObjectFilter<T>>\n & Partial<NameObjectFilter<T>>\n & Partial<QueryObjectFilter<T>>\n\nexport type ObjectFilter<T extends EmptyObject> = ObjectFilterOptions<T> | AddressObjectFilter<T> | NameObjectFilter<T> | QueryObjectFilter<T>\n","import type { ModuleInstance } from './Instance.ts'\nimport type {\n AddressObjectFilter,\n AnyObjectFilter,\n NameObjectFilter,\n ObjectFilter,\n ObjectFilterOptions,\n QueryObjectFilter,\n} from './ObjectFilter.ts'\nimport {\n isAddressObjectFilter,\n isNameObjectFilter,\n isQueryObjectFilter,\n} from './ObjectFilter.ts'\n\nexport interface ModuleFilterOptions<T extends ModuleInstance = ModuleInstance> extends ObjectFilterOptions<T> {}\n\nexport const isAddressModuleFilter = isAddressObjectFilter<ModuleInstance>\n\nexport const isNameModuleFilter = isNameObjectFilter<ModuleInstance>\n\nexport const isQueryModuleFilter = isQueryObjectFilter<ModuleInstance>\n\nexport type AnyModuleFilter<T extends ModuleInstance = ModuleInstance> = AnyObjectFilter<T>\n\nexport type AddressModuleFilter<T extends ModuleInstance = ModuleInstance> = AddressObjectFilter<T>\n\nexport type NameModuleFilter<T extends ModuleInstance = ModuleInstance> = NameObjectFilter<T>\n\nexport type QueryModuleFilter<T extends ModuleInstance = ModuleInstance> = QueryObjectFilter<T>\n\n/** @deprecated use ModuleIdentifier instead */\nexport type ModuleFilter<T extends ModuleInstance = ModuleInstance> = ObjectFilter<T>\n","import type {\n AnyObject, EmptyObject, Promisable,\n} from '@xylabs/sdk-js'\n\nimport type { ModuleIdentifier } from '../ModuleIdentifier.ts'\nimport type { ObjectFilterOptions } from './ObjectFilter.ts'\n\nexport const isObjectResolver = <T extends EmptyObject = AnyObject>(value?: unknown): value is ObjectResolver<T> => {\n return typeof (value as Partial<ObjectResolver<T>>).resolve === 'function'\n}\n\nexport const ObjectResolverPriority = {\n Disabled: -1,\n VeryLow: 0,\n Low: 1,\n Normal: 2,\n High: 3,\n VeryHigh: 4,\n} as const\n\nexport type ObjectResolverPriority = typeof ObjectResolverPriority[keyof typeof ObjectResolverPriority]\n\nexport interface ObjectResolver<TResult extends EmptyObject> {\n priority: ObjectResolverPriority\n /** @deprecated do not pass undefined. If trying to get all, pass '*' */\n resolve<T extends TResult = TResult>(): Promisable<T | undefined>\n resolve<T extends TResult = TResult>(all: '*', options?: ObjectFilterOptions<T>): Promisable<T[]>\n resolve<T extends TResult = TResult>(id: ModuleIdentifier, options?: ObjectFilterOptions<T>): Promisable<T | undefined>\n resolve<T extends TResult = TResult>(\n id?: ModuleIdentifier,\n options?: ObjectFilterOptions<T>,\n ): Promisable<T | T[] | undefined>\n\n resolvePrivate<T extends TResult = TResult>(all: '*', options?: ObjectFilterOptions<T>): Promise<T[]>\n resolvePrivate<T extends TResult = TResult>(id: ModuleIdentifier, options?: ObjectFilterOptions<T>): Promise<T | undefined>\n resolvePrivate<T extends TResult = TResult>(id: ModuleIdentifier, options?: ObjectFilterOptions<T>): Promise<T | T[] | undefined>\n}\n\nexport interface ObjectResolverInstance<TResult extends EmptyObject> extends ObjectResolver<TResult> {\n addResolver: (resolver: ObjectResolverInstance<TResult>) => this\n removeResolver: (resolver: ObjectResolverInstance<TResult>) => this\n}\n","import type { Address, Promisable } from '@xylabs/sdk-js'\n\nimport type { ModuleIdentifier } from '../ModuleIdentifier.ts'\nimport type { ModuleInstance } from './Instance.ts'\nimport type { ObjectFilterOptions } from './ObjectFilter.ts'\nimport type { ObjectResolver } from './ObjectResolver.ts'\nimport { isObjectResolver } from './ObjectResolver.ts'\n\nexport const isModuleResolver = isObjectResolver<ModuleInstance>\n\nexport interface ModuleResolver<TResult extends ModuleInstance = ModuleInstance> extends ObjectResolver<TResult> {}\n\nexport interface ModuleNameResolver {\n readonly root: ModuleInstance\n resolveIdentifier(id: ModuleIdentifier, options?: ObjectFilterOptions): Promisable<Address | undefined>\n}\n\nexport interface ModuleResolverInstance<TResult extends ModuleInstance = ModuleInstance> extends ModuleResolver<TResult>, ModuleNameResolver {\n addResolver: (resolver: ModuleResolverInstance<TResult>) => this\n removeResolver: (resolver: ModuleResolverInstance<TResult>) => this\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 return source?.hasOwnProperty(key as keyof typeof source) && source?.[key as keyof typeof source] === value\n })\n}\n","export const ModuleLimitationLabelName = 'network.xyo.module.limitation'\nexport type ModuleLimitationLabelName = typeof ModuleLimitationLabelName\n\nexport const ModuleLimitationViewLabel = { ModuleLimitationLabelName: 'view' }\n","import type { Module } from '../module/index.ts'\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","export const isSerializable = (value: unknown, maxDepth = 10): boolean => {\n if (maxDepth <= 0) {\n return false\n }\n if (value === null || typeof value === 'boolean' || typeof value === 'number' || typeof value === 'string') {\n return true\n }\n\n if (Array.isArray(value)) {\n return value.every(item => isSerializable(item, maxDepth - 1))\n }\n\n if (typeof value === 'object') {\n if (value instanceof Date || value instanceof RegExp) {\n return true\n }\n\n // Check for non-serializable objects like Set and Map\n if (value instanceof Set || value instanceof Map) {\n return false\n }\n\n if (value !== null && value !== undefined) {\n return Object.values(value).every(item => isSerializable(item, maxDepth - 1))\n }\n }\n\n // Exclude functions, symbols, undefined, and BigInt explicitly\n return false\n}\n","import type { Address } from '@xylabs/sdk-js'\nimport { isAddress } from '@xylabs/sdk-js'\n\nexport const MODULE_PATH_SEPARATOR = ':' as const\n\nexport const DisallowedModuleIdentifierCharacters = {\n ' ': true,\n '!': true,\n '\"': true,\n '#': true,\n '$': true,\n '%': true,\n '&': true,\n \"'\": true,\n '(': true,\n ')': true,\n '*': true,\n ',': true,\n '.': true,\n '/': true,\n ':': true,\n ';': true,\n '<': true,\n '=': true,\n '>': true,\n '?': true,\n '@': true,\n '[': true,\n ']': true,\n '^': true,\n '_': true,\n '{': true,\n '|': true,\n '}': true,\n '~': true,\n}\nexport type ReservedModuleIdentifierCharacter = keyof typeof DisallowedModuleIdentifierCharacters\nexport const ReservedModuleIdentifierCharacters = new Set<ReservedModuleIdentifierCharacter>(\n Object.keys(DisallowedModuleIdentifierCharacters) as ReservedModuleIdentifierCharacter[],\n)\n\n// TODO: Use Brand, but avoid too complex error\n// export type ModuleName = Brand<string, { __moduleName: true }>\nexport type ModuleName = string\n\nexport type ModuleIdentifier\n = | ColonPair<ModuleIdentifierPart>\n | ColonPair<ColonPair<ModuleIdentifierPart>>\n | ColonPair<ColonPair<ColonPair<ModuleIdentifierPart>>>\n | ColonPair<ColonPair<ColonPair<ColonPair<ModuleIdentifierPart>>>>\n | ColonPair<ColonPair<ColonPair<ColonPair<ColonPair<ModuleIdentifierPart>>>>>\n | ColonPair<ColonPair<ColonPair<ColonPair<ColonPair<ColonPair<ModuleIdentifierPart>>>>>>\n | ColonPair<ColonPair<ColonPair<ColonPair<ColonPair<ColonPair<ColonPair<ModuleIdentifierPart>>>>>>>\n\nexport type ColonPair<T extends string> = `${T}:${T}` | T\n\nexport type ModuleIdentifierPart = Exclude<Address | ModuleName, '*'>\n\nexport const isModuleName = (value: unknown): value is ModuleName => {\n return typeof value === 'string' && !isAddress(value) && !includesReservedModuleIdentifierCharacter(value)\n}\n\nexport const includesReservedModuleIdentifierCharacter = (value: unknown): boolean => {\n return typeof value === 'string' && [...value].some(char => ReservedModuleIdentifierCharacters.has(char as ReservedModuleIdentifierCharacter))\n}\n\nexport const isModuleIdentifierPart = (value: unknown): value is ModuleIdentifierPart => {\n return isModuleName(value) || isAddress(value)\n}\n","import type { Address } from '@xylabs/sdk-js'\nimport { AsObjectFactory } from '@xylabs/sdk-js'\nimport { isPayloadOfSchemaType, type Payload } from '@xyo-network/payload-model'\n\nexport const AddressSchema = 'network.xyo.address' as const\nexport type AddressSchema = typeof AddressSchema\n\nexport const AddressChildSchema = 'network.xyo.address.child' as const\nexport type AddressChildSchema = typeof AddressChildSchema\n\nexport interface AddressFields {\n address: Address\n}\n\nexport type AddressPayload = Payload<AddressFields, AddressSchema>\n\n/**\n * Identity function for determining if an object is an Address\n */\nexport const isAddressPayload = isPayloadOfSchemaType<AddressPayload>(AddressSchema)\nexport const asAddressPayload = AsObjectFactory.create(isAddressPayload)\nexport const asOptionalAddressPayload = AsObjectFactory.createOptional(isAddressPayload)\n\nexport interface AddressChildFields extends AddressFields {\n /**\n * The derivation path of the child address\n */\n path?: string\n /**\n * The public address of the root of the hierarchy\n */\n root?: Address\n}\n\nexport type AddressChildPayload = Payload<AddressChildFields, AddressChildSchema>\n","import type { Address } from '@xylabs/sdk-js'\nimport type { Payload } from '@xyo-network/payload-model'\n\nexport const AddressPreviousHashSchema = 'network.xyo.address.hash.previous' as const\nexport type AddressPreviousHashSchema = typeof AddressPreviousHashSchema\n\nexport type AddressPreviousHashPayload = Payload<\n {\n address: Address\n previousHash?: string\n },\n AddressPreviousHashSchema\n>\n","import type { Payload } from '@xyo-network/payload-model'\n\nimport type { ModuleDescription } from '../ModuleDescription.ts'\n\nexport const ModuleDescriptionSchema = 'network.xyo.module.description' as const\nexport type ModuleDescriptionSchema = typeof ModuleDescriptionSchema\n\nexport type ModuleDescriptionPayload = Payload<ModuleDescription, ModuleDescriptionSchema>\n","import { AsObjectFactory } from '@xylabs/sdk-js'\nimport type { Payload, WithSources } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType, isPayloadOfSchemaTypeWithSources } from '@xyo-network/payload-model'\n\nexport interface StateDictionary {\n [key: string]: string | number\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, TInput = unknown>(payload?: TInput): payload is ModuleState<T> & TInput => {\n return isPayloadOfSchemaType<ModuleState<T>>(ModuleStateSchema)(payload)\n}\n\nexport const isModuleStateWithSources = <T extends StateDictionary = StateDictionary,\n TInput = unknown>(payload?: TInput): payload is WithSources<ModuleState<T>> & TInput => {\n return isPayloadOfSchemaTypeWithSources<ModuleState<T>>(ModuleStateSchema)(payload)\n}\n\nexport const asModuleState = AsObjectFactory.create<ModuleState<StateDictionary>>(isModuleState)\nexport const asOptionalModuleState = AsObjectFactory.createOptional<ModuleState<StateDictionary>>(isModuleState)\n","import type { Address } from '@xylabs/sdk-js'\n\nimport type { ModuleInstance } from '../instance/index.ts'\nimport type { ModuleResolveDirection } from './model.ts'\n\nexport const resolveAddressToInstanceDown = async (\n root: ModuleInstance,\n address: Address,\n includePrivate: boolean | undefined = undefined,\n ignore: Address[] = [],\n): Promise<ModuleInstance | undefined> => {\n if (root.address === address) {\n return root\n }\n const cache = root.addressCache?.('up', !!includePrivate)\n const privateChildren = (includePrivate ? await root.privateChildren?.() : []) ?? []\n const publicChildren = (await root.publicChildren?.()) ?? []\n const children = [...privateChildren, ...publicChildren]\n for (const child of children) {\n const found = await resolveAddressToInstanceDown(child, address, includePrivate, ignore)\n if (found) {\n cache?.set(address, new WeakRef(found))\n return found\n }\n }\n cache?.set(address, null)\n}\n\nexport const resolveAddressToInstanceSiblings = async (\n root: ModuleInstance,\n address: Address,\n includePrivate: boolean | undefined = undefined,\n ignore: Address[] = [],\n): Promise<ModuleInstance | undefined> => {\n const siblings = (await root.siblings?.()) ?? []\n for (const sibling of siblings) {\n const found = await resolveAddressToInstanceDown(sibling, address, includePrivate, ignore)\n if (found) {\n return found\n }\n }\n}\n\nexport const resolveAddressToInstanceUp = async (\n root: ModuleInstance,\n address: Address,\n includePrivate: boolean | undefined = undefined,\n ignore: Address[] = [],\n): Promise<ModuleInstance | undefined> => {\n const cache = root.addressCache?.('up', includePrivate ?? true)\n const parents = (await root.parents?.()) ?? []\n for (const parent of parents) {\n const found = await resolveAddressToInstance(parent, address, includePrivate, ignore)\n if (found) {\n cache?.set(address, new WeakRef(found))\n return found\n }\n }\n cache?.set(address, null)\n}\n\nexport const resolveAddressToInstanceAll = async (\n root: ModuleInstance,\n address: Address,\n includePrivate: boolean | undefined = undefined,\n ignore: Address[] = [],\n): Promise<ModuleInstance | undefined> => {\n const cache = root.addressCache?.('all', !!includePrivate)\n const result\n = (await resolveAddressToInstanceDown(root, address, includePrivate ?? false, ignore))\n ?? (await resolveAddressToInstanceUp(root, address, includePrivate ?? true, ignore))\n cache?.set(address, result ? new WeakRef(result) : null)\n return result\n}\n\nexport const resolveAddressToInstance = async (\n root: ModuleInstance,\n address: Address,\n includePrivate: boolean | undefined = undefined,\n ignore: Address[] = [],\n direction: ModuleResolveDirection = 'all',\n): Promise<ModuleInstance | undefined> => {\n switch (direction) {\n case 'all': {\n return await resolveAddressToInstanceAll(root, address, includePrivate, ignore)\n }\n case 'up': {\n return await resolveAddressToInstanceUp(root, address, includePrivate ?? true, ignore)\n }\n case 'down': {\n return await resolveAddressToInstanceDown(root, address, includePrivate ?? false, ignore)\n }\n }\n}\n","import type { Address } from '@xylabs/sdk-js'\n\nimport type { ModuleInstance } from '../instance/index.ts'\nimport { duplicateModules } from '../lib/index.ts'\n\nexport const resolveAllUp = async (root: ModuleInstance, maxDepth = 10, exclude: Address[] = []): Promise<ModuleInstance[]> => {\n if (maxDepth === 0) {\n return [root].filter(mod => !exclude.includes(mod.address))\n }\n const parents = (await root.parents()).filter(mod => !exclude.includes(mod.address))\n return (\n maxDepth > 1\n ? [\n ...(await Promise.all(parents.map(async mod => await resolveAllUp(mod, maxDepth - 1, [...exclude, root.address])))).flat(),\n ...(await Promise.all(parents.map(async mod => await resolveAllDown(mod, maxDepth - 1, [...exclude, root.address], true)))).flat(),\n ...parents,\n root,\n ]\n : [...parents, root])\n .filter(mod => !exclude.includes(mod.address))\n .filter(duplicateModules)\n}\n\nexport const resolveAllDown = async (\n root: ModuleInstance,\n maxDepth = 10,\n exclude: Address[] = [],\n includePrivate = false,\n): Promise<ModuleInstance[]> => {\n if (maxDepth === 0) {\n return [root]\n }\n const children = (await root.publicChildren()).filter(mod => !exclude.includes(mod.address))\n const privateChildren = includePrivate ? (await root.privateChildren()).filter(mod => !exclude.includes(mod.address)) : []\n return (\n maxDepth > 1\n ? [\n ...children,\n ...(await Promise.all(children.map(child => resolveAllDown(child, maxDepth - 1, [...exclude, root.address])))).flat(),\n ...(await Promise.all(privateChildren.map(child => resolveAllDown(child, maxDepth - 1, [...exclude, root.address])))).flat(),\n root,\n ]\n : [...children, root])\n .filter(mod => !exclude.includes(mod.address))\n .filter(duplicateModules)\n}\n\nexport const resolveAll = async (root: ModuleInstance, maxDepth = 10, exclude: Address[] = []): Promise<ModuleInstance[]> => {\n if (maxDepth === 0) {\n return [root]\n }\n return [...(await resolveAllUp(root, maxDepth, exclude)), ...(await resolveAllDown(root, maxDepth, exclude))].filter(duplicateModules)\n}\n","/* eslint-disable max-statements */\n/* eslint-disable complexity */\nimport type { Address, Logger } from '@xylabs/sdk-js'\nimport {\n assertEx,\n exists,\n IdLogger,\n isAddress,\n isDefined, isString, isTruthy, toSafeJsonString,\n} from '@xylabs/sdk-js'\n\nimport type {\n ModuleFilterOptions, ModuleInstance, ModuleResolver,\n} from '../instance/index.ts'\nimport { asModuleInstance } from '../instance/index.ts'\nimport { duplicateModules } from '../lib/index.ts'\nimport type { ModuleIdentifier } from '../ModuleIdentifier.ts'\nimport type { ModuleIdentifierTransformer } from '../ModuleIdentifierTransformer.ts'\nimport { ResolveHelperStatic } from './ResolveHelperStatic.ts'\nimport { resolvePathToAddress } from './resolvePathToAddress.ts'\nimport { traceModuleIdentifier } from './traceModuleIdentifier.ts'\nimport { transformModuleIdentifier } from './transformModuleIdentifier.ts'\n\n/*\n\nResolution rules\n\n1. Resolution is always done from the perspective of the module whose resolve function was called.\n\n2. Requesting '*' will return all the modules that the resolver can see. [limited by maxDepth]\n\n3. Requesting a simple ModuleName (string w/o ':' separator) will return an immediate child that has that name.\n\n4. Requesting a complex ModuleName (string w/ ':' separator) will resolve the first part and then recursively resolve\n the remaining name by calling the first part's resolved module's resolve with the remainder of the name.\n\n5. Requesting an Address (string) will return the module with that address, regardless of how distant it is from the module. [limited by maxDepth]\n\n6. Requesting a ModuleFilter will first request all the modules '*' and then filter them based on the filter settings. [Do we need this mode?]\n\n7. When a string is passed as the ModuleIdentifier, do the following:\n Check if id is complex (contains a ':')\n a) If it is complex, go to #4 above\n b) Call isAddress in the id to see if it is a valid address.\n i) If it is a valid address, go to #5 above\n ii) If it is not a valid address, go to # 3 above\n\n 1: If someone were to name a module with a valid address, that name will not be resolvable.\n 2: If someone were to name a module with a string containing a ':', that name will not be resolvable.\n\n8. Modules have two resolvers, up and down.\n a) Up Traversal\n i) Every module's upResolver also can call it's parent's upResolver\n ii) An upResolver also can see the parent's children's downResolvers\n iii) This means that when traversing upResolvers, you can traverse all the way up. [limited by maxDepth]\n iv) At any point of the up traversal, it can start traversing down to any immediate child, public or private.\n b) Down Traversal\n i) A down traversal is limited to the public children of the module. [The same as scope as calling the 'resolve' function]\n\n9. An up or a down traversal counts against the maxDepth\n\n*/\n\nexport interface ResolveHelperConfig {\n address: Address\n dead?: boolean\n downResolver?: ModuleResolver\n logger?: Logger\n mod: ModuleInstance\n privateResolver?: ModuleResolver\n transformers: ModuleIdentifierTransformer[]\n upResolver?: ModuleResolver\n}\n\nexport class ResolveHelper extends ResolveHelperStatic {\n static async resolve<T extends ModuleInstance = ModuleInstance>(\n config: ResolveHelperConfig,\n all: '*',\n options?: ModuleFilterOptions<T>,\n ): Promise<T[]>\n static async resolve<T extends ModuleInstance = ModuleInstance>(\n config: ResolveHelperConfig,\n id: ModuleIdentifier,\n options?: ModuleFilterOptions<T>,\n ): Promise<T | undefined>\n static async resolve<T extends ModuleInstance = ModuleInstance>(\n config: ResolveHelperConfig,\n id: ModuleIdentifier = '*',\n {\n maxDepth = 3, required = 'log', ...options\n }: ModuleFilterOptions<T> = {},\n ): Promise<T | T[] | undefined> {\n const {\n transformers, mod, logger = this.defaultLogger, dead = false, upResolver, downResolver, privateResolver,\n } = config\n const log = logger ? new IdLogger(logger, () => `ResolveHelper [${mod.id}][${id}]`) : undefined\n\n const downLocalOptions: ModuleFilterOptions<T> = {\n ...options, direction: 'down', maxDepth, required: false,\n }\n const upLocalOptions: ModuleFilterOptions<T> = { ...downLocalOptions, direction: 'up' }\n\n const childOptions: ModuleFilterOptions<T> = {\n ...options, maxDepth: maxDepth - 1, required: false,\n }\n\n const direction = options?.direction ?? 'all'\n const up = direction === 'up' || direction === 'all'\n const down = direction === 'down' || direction === 'all'\n let result: T | T[] | undefined\n log?.debug('start', id, maxDepth)\n if (id === '*') {\n if (dead) {\n log?.warn('failed [dead]', id)\n return []\n }\n const modules = [\n ...(down ? await (downResolver as ModuleResolver).resolve<T>('*', downLocalOptions) : []),\n ...(up ? await (upResolver as ModuleResolver).resolve<T>('*', upLocalOptions) : []),\n ].filter(duplicateModules)\n\n if (modules.length > 0) {\n log?.debug('modules [count]', modules.length)\n log?.debug('modules', toSafeJsonString(modules, 4))\n }\n\n if (maxDepth === 0) {\n return modules\n }\n const childModules = (await Promise.all(modules.map(async mod => await mod.resolve<T>('*', childOptions)))).flat().filter(duplicateModules)\n return [...modules, ...childModules, mod as T].filter(duplicateModules)\n } else {\n switch (typeof id) {\n case 'string': {\n if (dead) {\n return undefined\n }\n\n const resolvedId = assertEx((await resolvePathToAddress(mod, id, false, transformers)) ?? id, () => 'Invalid resolvedId')\n\n const resolvers = [\n [downResolver, downLocalOptions],\n [up ? upResolver : undefined, upLocalOptions],\n [up ? privateResolver : undefined, upLocalOptions],\n ].filter(([resolver]) => exists(resolver)) as [ModuleResolver, ModuleFilterOptions<T>][]\n\n for (const resolver of resolvers) {\n const [resolverInstance] = resolver\n if (!result) {\n result = await this.resolveModuleIdentifier<T>(resolverInstance, resolvedId)\n }\n }\n\n break\n }\n default: {\n break\n }\n }\n }\n this.validateRequiredResolve(required, result, id, logger)\n return result\n }\n\n // resolves a complex module path to addresses\n static async resolveModuleIdentifier<T extends ModuleInstance = ModuleInstance>(\n resolver: ModuleResolver,\n path: ModuleIdentifier,\n required?: boolean,\n ): Promise<T | undefined> {\n const parts = path.split(':')\n const first = parts.shift()\n const firstIsAddress = isAddress(first)\n const resolvedModule\n = (await resolver.resolve(first, { maxDepth: firstIsAddress ? 10 : 1 }))\n ?? (isString(first) ? await resolver.resolvePrivate(first, { maxDepth: firstIsAddress ? 10 : 1 }) : undefined)\n const finalModule = required ? assertEx(resolvedModule, () => `Failed to resolve [${first}] [${firstIsAddress}]`) : resolvedModule\n const firstModule = asModuleInstance(finalModule, () => `Resolved invalid module instance [${first}]`)\n return isDefined(firstModule) ? (parts.length > 0 ? await this.resolveModuleIdentifier<T>(firstModule, parts.join(':')) : firstModule as T) : undefined\n }\n\n // translates a complex module path to addresses\n static traceModuleIdentifier(resolver: ModuleResolver, path: ModuleIdentifier) {\n return traceModuleIdentifier(resolver, path)\n }\n\n static transformModuleIdentifier(identifier: ModuleIdentifier, transformers: ModuleIdentifierTransformer[] = ResolveHelper.transformers) {\n return transformModuleIdentifier(identifier, transformers)\n }\n\n static validateRequiredResolve(\n required: boolean | 'warn' | 'log',\n result: ModuleInstance[] | ModuleInstance | undefined,\n id: ModuleIdentifier,\n logger = this.defaultLogger,\n ) {\n const log = logger ? new IdLogger(logger, () => `validateRequiredResolve [${id}][${result}]`) : undefined\n if (isTruthy(required) && (result === undefined || (Array.isArray(result) && result.length > 0))) {\n switch (required) {\n case 'warn': {\n log?.warn('resolve failed', id)\n break\n }\n case 'log': {\n log?.log('resolve failed', id)\n break\n }\n default: {\n throw new Error(`resolve failed [${id}]`)\n }\n }\n }\n }\n}\n","import type { Logger } from '@xylabs/sdk-js'\n\nimport type { ModuleIdentifierTransformer } from '../ModuleIdentifierTransformer.ts'\n\nexport class ResolveHelperStatic {\n static readonly defaultLogger?: Logger\n // eslint-disable-next-line sonarjs/public-static-readonly\n static transformers: ModuleIdentifierTransformer[] = []\n}\n","import { asAddress, assertEx } from '@xylabs/sdk-js'\n\nimport type { ModuleInstance } from '../instance/index.ts'\nimport { MODULE_PATH_SEPARATOR } from '../ModuleIdentifier.ts'\nimport type { ModuleIdentifierTransformer } from '../ModuleIdentifierTransformer.ts'\nimport { resolveAddressToInstance } from './resolveAddressToInstance.ts'\nimport { ResolveHelperStatic } from './ResolveHelperStatic.ts'\nimport { resolveLocalNameToAddress } from './resolveLocalNameToAddress.ts'\nimport { transformModuleIdentifier } from './transformModuleIdentifier.ts'\n\nexport const resolvePathToInstance = async (\n root: ModuleInstance,\n path: string,\n includePrivate: boolean | undefined = undefined,\n transformers: ModuleIdentifierTransformer[] = ResolveHelperStatic.transformers,\n): Promise<ModuleInstance | undefined> => {\n const parts = path.split(MODULE_PATH_SEPARATOR)\n const first = await transformModuleIdentifier(\n assertEx(parts.shift(), () => `First part is invalid [${path}]`),\n transformers,\n )\n\n if (!first) {\n return undefined\n }\n\n const firstAddress = asAddress(first) ?? (await resolveLocalNameToAddress(root, first, includePrivate))\n\n if (firstAddress) {\n const firstModule = await resolveAddressToInstance(root, firstAddress, includePrivate)\n if (firstModule && parts.length > 0) {\n return resolvePathToInstance(firstModule, parts.join(MODULE_PATH_SEPARATOR))\n }\n return firstModule\n }\n}\n","import type { ModuleInstance } from '../instance/index.ts'\nimport type { ModuleName } from '../ModuleIdentifier.ts'\nimport type { ModuleResolveDirection } from './model.ts'\n\nexport const resolveLocalNameToInstanceUp = async (root: ModuleInstance, modName: ModuleName): Promise<ModuleInstance | undefined> => {\n const parents = (await root.parents?.()) ?? []\n return parents.find(parent => parent.config.name === modName)\n}\n\n// since this is a modName, it only checks the children of the root module\nexport const resolveLocalNameToInstanceDown = async (\n root: ModuleInstance,\n modName: ModuleName,\n includePrivate: boolean | undefined = undefined,\n): Promise<ModuleInstance | undefined> => {\n const privateChildren = (includePrivate ? await root.privateChildren?.() : []) ?? []\n const publicChildren = (await root.publicChildren?.()) ?? []\n const children = [...privateChildren, ...publicChildren]\n return children.find(child => child.config.name === modName)\n}\n\nexport const resolveLocalNameToInstanceAll = async (\n root: ModuleInstance,\n modName: ModuleName,\n includePrivate = false,\n): Promise<ModuleInstance | undefined> => {\n return (await resolveLocalNameToInstanceDown(root, modName, includePrivate)) ?? (await resolveLocalNameToInstanceUp(root, modName))\n}\n\nexport const resolveLocalNameToInstance = async (\n root: ModuleInstance,\n modName: ModuleName,\n includePrivate = false,\n direction: ModuleResolveDirection = 'all',\n): Promise<ModuleInstance | undefined> => {\n switch (direction) {\n case 'all': {\n return await resolveLocalNameToInstanceAll(root, modName, includePrivate)\n }\n case 'up': {\n return await resolveLocalNameToInstanceUp(root, modName)\n }\n case 'down': {\n return await resolveLocalNameToInstanceDown(root, modName, includePrivate)\n }\n }\n}\n","import type { Address } from '@xylabs/sdk-js'\n\nimport type { ModuleInstance } from '../instance/index.ts'\nimport type { ModuleName } from '../ModuleIdentifier.ts'\nimport type { ModuleResolveDirection } from './model.ts'\nimport {\n resolveLocalNameToInstance,\n resolveLocalNameToInstanceAll,\n resolveLocalNameToInstanceDown,\n resolveLocalNameToInstanceUp,\n} from './resolveLocalNameToInstance.ts'\n\nexport const resolveLocalNameToAddressUp = async (root: ModuleInstance, modName: ModuleName): Promise<Address | undefined> => {\n return (await resolveLocalNameToInstanceUp(root, modName))?.address\n}\n\nexport const resolveLocalNameToAddressDown = async (\n root: ModuleInstance,\n modName: ModuleName,\n includePrivate: boolean | undefined = undefined,\n): Promise<Address | undefined> => {\n return (await resolveLocalNameToInstanceDown(root, modName, includePrivate))?.address\n}\n\nexport const resolveLocalNameToAddressAll = async (\n root: ModuleInstance,\n modName: ModuleName,\n includePrivate: boolean | undefined = undefined,\n): Promise<Address | undefined> => {\n return (await resolveLocalNameToInstanceAll(root, modName, includePrivate))?.address\n}\n\nexport const resolveLocalNameToAddress = async (\n root: ModuleInstance,\n modName: ModuleName,\n includePrivate: boolean | undefined = undefined,\n direction: ModuleResolveDirection = 'all',\n): Promise<Address | undefined> => {\n return (await resolveLocalNameToInstance(root, modName, includePrivate, direction))?.address\n}\n","import type { ModuleIdentifier } from '../ModuleIdentifier.ts'\nimport type { ModuleIdentifierTransformer } from '../ModuleIdentifierTransformer.ts'\n\nexport const transformModuleIdentifier = async (\n id: ModuleIdentifier,\n transformers: ModuleIdentifierTransformer[],\n): Promise<ModuleIdentifier | undefined> => {\n let result: ModuleIdentifier | undefined = id\n for (const transformer of transformers) {\n result = await transformer.transform(id)\n }\n return result\n}\n","import type { Address } from '@xylabs/sdk-js'\n\nimport type { ModuleInstance } from '../instance/index.ts'\nimport type { ModuleIdentifierTransformer } from '../ModuleIdentifierTransformer.ts'\nimport { ResolveHelperStatic } from './ResolveHelperStatic.ts'\nimport { resolvePathToInstance } from './resolvePathToInstance.ts'\n\nexport const resolvePathToAddress = async (\n root: ModuleInstance,\n path: string,\n includePrivate: boolean | undefined = undefined,\n transformers: ModuleIdentifierTransformer[] = ResolveHelperStatic.transformers,\n): Promise<Address | undefined> => {\n return (await resolvePathToInstance(root, path, includePrivate, transformers))?.address\n}\n","import type { Address } from '@xylabs/sdk-js'\nimport { assertEx } from '@xylabs/sdk-js'\n\nimport type { ModuleResolver } from '../instance/index.ts'\nimport { asModuleInstance } from '../instance/index.ts'\nimport type { ModuleIdentifier } from '../ModuleIdentifier.ts'\n\nexport const traceModuleIdentifier = async (resolver: ModuleResolver, path: ModuleIdentifier): Promise<Address[]> => {\n const parts = path.split(':')\n const first = parts.shift()\n const firstModule = asModuleInstance(\n assertEx(await resolver.resolve(first, { maxDepth: 1 }), () => `Failed to resolve [${first}]`),\n () => `Resolved invalid module instance [${first}]`,\n )\n if (firstModule) {\n return parts.length > 0 ? [firstModule.address, ...(await traceModuleIdentifier(firstModule, parts.join(':')))] : [firstModule.address]\n }\n return []\n}\n","import type { TypeCheck } from '@xylabs/sdk-js'\n\nimport { isModuleInstance } from './instance/index.ts'\nimport { isModule } from './module/index.ts'\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 mod: any,\n\n closure: (mod: T) => R,\n ): R | undefined => {\n return typeCheck(mod) ? closure(mod) : undefined\n }\n },\n}\n\nexport const withModule = WithFactory.create(isModule)\nexport const withModuleInstance = WithFactory.create(isModuleInstance)\n"],"mappings":";AAOO,IAAM,qBAAqB;;;ACmC3B,SAAS,kBAAqF;AACnG,SAAO,CAAqC,gBAAmB;AAE7D;AAAA,EACF;AACF;AAQO,SAAS,yBAA4F;AAC1G,SAAO,CAA4C,gBAAmB;AAEpE;AAAA,EACF;AACF;;;AC5DA,SAAS,gBAAgB;AAWzB,IAAM,qBAA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KAAK,GAAG;AACrG,WAAO,UAAU,WAAW,IAAK,MAAM,SAAS,IAAI,MAAM,KAAK,wBAA2B,aAAa,MAAM,KAAK,GAAG,CAAC,IAAI,cAAoB;AAAA,EAChJ;AAAA;AAAA,EAGA,OAAO,sBAAsB,UAA0B,MAAwB;AAC7E,WAAO,sBAAsB,UAAU,IAAI;AAAA,EAC7C;AAAA,EAEA,OAAO,0BAA0B,YAA8B,eAA8C,eAAc,cAAc;AACvI,WAAO,0BAA0B,YAAY,YAAY;AAAA,EAC3D;AAAA,EAEA,OAAO,wBACL,UACA,QACA,IACA,SAAS,KAAK,eACd;AACA,UAAM,MAAM,SAAS,IAAI,SAAS,QAAQ,MAAM,4BAA4B,EAAE,KAAK,MAAM,GAAG,IAAI;AAChG,QAAIE,UAAS,QAAQ,MAAM,WAAW,UAAc,MAAM,QAAQ,MAAM,KAAK,OAAO,SAAS,IAAK;AAChG,cAAQ,UAAU;AAAA,QAChB,KAAK,QAAQ;AACX,eAAK,KAAK,kBAAkB,EAAE;AAC9B;AAAA,QACF;AAAA,QACA,KAAK,OAAO;AACV,eAAK,IAAI,kBAAkB,EAAE;AAC7B;AAAA,QACF;AAAA,QACA,SAAS;AACP,gBAAM,IAAI,MAAM,mBAAmB,EAAE,GAAG;AAAA,QAC1C;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;;;AQhNO,IAAM,cAAc;AAAA,EACzB,QAAQ,CAAmB,cAA4B;AACrD,WAAO,CAEL,KAEA,YACkB;AAClB,aAAO,UAAU,GAAG,IAAI,QAAQ,GAAG,IAAI;AAAA,IACzC;AAAA,EACF;AACF;AAEO,IAAM,aAAa,YAAY,OAAO,QAAQ;AAC9C,IAAM,qBAAqB,YAAY,OAAO,gBAAgB;","names":["factory","factory","creatableModule","AsObjectFactory","IsObjectFactory","AsObjectFactory","factory","AsObjectFactory","factory","IsObjectFactory","AsObjectFactory","AsObjectFactory","IsObjectFactory","factory","IsObjectFactory","AsObjectFactory","IsObjectFactory","IsObjectFactory","AsObjectFactory","AsObjectFactory","isPayloadOfSchemaType","assertEx","isAddress","isTruthy","toSafeJsonString","assertEx","assertEx","assertEx","assertEx","toSafeJsonString","mod","assertEx","isAddress","isTruthy"]}
1
+ {"version":3,"sources":["../../src/Config/Config.ts","../../src/CreatableModule/CreatableModule.ts","../../src/CreatableModule/CreatableModuleRegistry.ts","../../src/CreatableModule/LabeledCreatableModuleFactory.ts","../../src/CreatableModule/ModuleFactory.ts","../../src/DetailsError.ts","../../src/instance/asModuleInstance.ts","../../src/instance/isModuleInstance.ts","../../src/module/asModule.ts","../../src/Queries/Manifest.ts","../../src/Queries/ModuleAddress/Query.ts","../../src/Queries/State.ts","../../src/Queries/Subscribe.ts","../../src/module/asModuleObject.ts","../../src/module/isModuleObject.ts","../../src/module/IsModuleFactory.ts","../../src/module/isModule.ts","../../src/instance/attachable/asAttachableInstance.ts","../../src/instance/attachable/isAttachableInstance.ts","../../src/instance/attachable/AttachableInstance.ts","../../src/instance/Instance.ts","../../src/instance/ObjectFilter.ts","../../src/instance/ModuleFilter.ts","../../src/instance/ObjectResolver.ts","../../src/instance/ModuleResolver.ts","../../src/Labels/Labels.ts","../../src/Labels/standard/View.ts","../../src/lib/duplicateModules.ts","../../src/lib/serializable.ts","../../src/ModuleIdentifier.ts","../../src/Payload/Address.ts","../../src/Payload/AddressPreviousHash.ts","../../src/Payload/Description.ts","../../src/Payload/ModuleState.ts","../../src/ResolveHelper/resolveAddressToInstance.ts","../../src/ResolveHelper/resolveAll.ts","../../src/ResolveHelper/ResolveHelper.ts","../../src/ResolveHelper/ResolveHelperStatic.ts","../../src/ResolveHelper/resolvePathToInstance.ts","../../src/ResolveHelper/resolveLocalNameToInstance.ts","../../src/ResolveHelper/resolveLocalNameToAddress.ts","../../src/ResolveHelper/transformModuleIdentifier.ts","../../src/ResolveHelper/resolvePathToAddress.ts","../../src/ResolveHelper/traceModuleIdentifier.ts","../../src/withModule.ts"],"sourcesContent":["import type { EmptyObject } from '@xylabs/sdk-js'\nimport {\n asSchema, type Payload, type Schema,\n} from '@xyo-network/payload-model'\n\nimport type { ArchivingModuleConfig } from './Archiving.ts'\nimport type { ModuleConfigFields } from './Fields.ts'\nimport type { ArchivingReentrancyConfig } from './Reentrancy.ts'\n\nexport const ModuleConfigSchema = asSchema('network.xyo.module.config', true)\nexport type ModuleConfigSchema = typeof ModuleConfigSchema\n\nexport type WithAdditional<T extends EmptyObject = EmptyObject, TAdditional extends EmptyObject = EmptyObject>\n = T & TAdditional\n\nexport type ModuleConfig<TConfig extends EmptyObject | Payload = EmptyObject, TSchema extends Schema | void = void> = Payload<\n WithAdditional<ArchivingModuleConfig & ModuleConfigFields & ArchivingReentrancyConfig, TConfig>,\n TSchema extends void ? TConfig extends Payload ? TConfig['schema']\n : Schema : TSchema\n>\n\nexport type AnyConfigSchema<TConfig extends Omit<ModuleConfig, 'schema'> & { schema: Schema } = Omit<ModuleConfig, 'schema'> & { schema: Schema }>\n = ModuleConfig<TConfig, Schema>\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 type {\n Creatable, CreatableInstance, Logger,\n} from '@xylabs/sdk-js'\nimport type { Schema } from '@xyo-network/payload-model'\n\nimport type { ModuleEventData } from '../EventsModels/index.ts'\nimport type { AttachableModuleInstance } from '../instance/index.ts'\nimport type { WithOptionalLabels } from '../Labels/index.ts'\nimport type { ModuleParams } from '../ModuleParams.ts'\nimport type { LabeledCreatableModuleFactory } from './LabeledCreatableModuleFactory.ts'\n\nexport interface CreatableModuleInstance<TParams extends ModuleParams = ModuleParams, TEventData extends ModuleEventData = ModuleEventData>\n extends CreatableInstance<TParams, TEventData>, AttachableModuleInstance<TParams, TEventData> {}\n\nexport interface CreatableModuleFactory<T extends CreatableModuleInstance = CreatableModuleInstance>\n extends Omit<CreatableModule<T>, 'create' | 'createHandler' | 'paramsHandler'> {\n creatableModule: CreatableModule<T>\n defaultParams?: Partial<T['params']>\n\n create(\n this: CreatableModuleFactory<T>,\n params?: Partial<T['params']>): Promise<T>\n}\n\nexport interface LabeledCreatableModule<T extends CreatableModuleInstance = CreatableModuleInstance> extends CreatableModule<T>, WithOptionalLabels {\n factory(params?: Partial<T['params']>): LabeledCreatableModuleFactory<T>\n}\n\nexport interface CreatableModule<T extends CreatableModuleInstance = CreatableModuleInstance> extends Creatable<T> {\n configSchemas: Schema[]\n defaultConfigSchema: Schema\n defaultLogger?: Logger\n new(key: unknown, params: Partial<T['params']>): T\n factory(params?: Partial<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 CreatableModuleInstance = CreatableModuleInstance>() {\n return <U extends CreatableModule<TModule>>(constructor: U) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n constructor\n }\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 labeledCreatableModule<TModule extends CreatableModuleInstance = CreatableModuleInstance>() {\n return <U extends LabeledCreatableModule<TModule>>(constructor: U) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n constructor\n }\n}\n","import { isTruthy } from '@xylabs/sdk-js'\nimport { asSchema, type Schema } from '@xyo-network/payload-model'\n\nimport type { Labels } from '../Labels/index.ts'\nimport type { CreatableModuleFactory, CreatableModuleInstance } from './CreatableModule.ts'\nimport type { LabeledCreatableModuleFactory } from './LabeledCreatableModuleFactory.ts'\n\nexport interface CreatableModuleRegistry {\n [key: Schema]: (CreatableModuleFactory | LabeledCreatableModuleFactory)[] | undefined\n}\n\nconst buildModuleFactory = <TModule extends CreatableModuleInstance>(\n mod: CreatableModuleFactory<TModule>,\n labels?: Labels,\n): LabeledCreatableModuleFactory<TModule> => {\n const factory: LabeledCreatableModuleFactory<TModule> = {\n // Destructure instance properties\n ...mod,\n\n configSchemas: mod.configSchemas,\n // Copy static methods\n create: mod.create.bind(mod) as LabeledCreatableModuleFactory<TModule>['create'],\n\n defaultConfigSchema: mod.defaultConfigSchema,\n // Merge module & supplied labels\n labels: { ...(mod as LabeledCreatableModuleFactory).labels, ...labels },\n }\n return factory\n}\n\nexport const registerCreatableModuleFactory = <TModule extends CreatableModuleInstance>(\n registry: CreatableModuleRegistry,\n factory: CreatableModuleFactory<TModule> | LabeledCreatableModuleFactory<TModule>,\n labels?: Labels,\n /** register this as the primary factory for every schema it supports */\n primary: boolean | Schema | Schema[] = false,\n) => {\n const primarySchemas\n = primary !== true && isTruthy(primary)\n ? Array.isArray(primary)\n ? primary\n : [primary]\n : []\n\n for (const primarySchema of primarySchemas) {\n if (!factory.configSchemas.includes(primarySchema)) {\n console.warn(`Primary schema ${primary} not found in factory configSchemas`)\n }\n }\n\n const isPrimaryForSchema = (schema: Schema) => {\n switch (typeof primary) {\n case 'boolean': {\n return primary\n }\n case 'string': {\n return schema === primary\n }\n case 'object': {\n if (Array.isArray(primary)) {\n return primary.includes(schema)\n }\n }\n }\n throw new Error(`Invalid primary value: ${primary}`)\n }\n\n const factoryClone: LabeledCreatableModuleFactory<TModule> = buildModuleFactory(factory, labels)\n // add the defaultConfigSchema as the first key in the registry\n registry[factory.defaultConfigSchema] = [factoryClone, ...(registry[factoryClone.defaultConfigSchema] ?? [])]\n for (const schema of factoryClone.configSchemas) {\n registry[schema] = isPrimaryForSchema(schema) ? [factoryClone, ...(registry[schema] ?? [])] : [...(registry[schema] ?? []), factoryClone]\n }\n}\n\nexport const registerCreatableModuleFactories = (\n factories: (CreatableModuleFactory | LabeledCreatableModuleFactory)[],\n registry: CreatableModuleRegistry = {},\n primary = false,\n) => {\n for (const factory of factories) {\n registerCreatableModuleFactory(registry, factory, undefined, primary)\n }\n return registry\n}\n\n/** @deprecated use registerCreatableModuleFactory instead */\nexport const assignCreatableModuleRegistry = (\n target: CreatableModuleRegistry = {},\n ...sources: CreatableModuleRegistry[]\n): CreatableModuleRegistry => {\n for (const source of sources)\n for (const [schemaString, factories] of Object.entries(source)) {\n const schema = asSchema(schemaString, true)\n if (factories) {\n const existingFactories = target[schema]\n target[schema] = [...existingFactories ?? [], ...factories]\n }\n }\n\n return target\n}\n","import type { WithOptionalLabels } from '../Labels/index.ts'\nimport type { CreatableModuleFactory, CreatableModuleInstance } from './CreatableModule.ts'\n\nexport type LabeledCreatableModuleFactory<T extends CreatableModuleInstance = CreatableModuleInstance> = CreatableModuleFactory<T> & WithOptionalLabels\n\nexport const hasLabels = (factory: CreatableModuleFactory | LabeledCreatableModuleFactory): factory is LabeledCreatableModuleFactory => {\n return (factory as LabeledCreatableModuleFactory).labels !== undefined\n}\n\n/**\n * Class annotation to be used to decorate Modules which support\n * an asynchronous labeled creation factory pattern\n * @returns The decorated Module requiring it implement the members\n * of the CreatableModule as statics properties/methods\n */\nexport function labeledCreatableModuleFactory<TModule extends CreatableModuleInstance = CreatableModuleInstance>() {\n return <U extends LabeledCreatableModuleFactory<TModule>>(constructor: U) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n constructor\n }\n}\n","import type { Logger } from '@xylabs/sdk-js'\nimport { assertEx } from '@xylabs/sdk-js'\nimport type { Schema } from '@xyo-network/payload-model'\n\nimport type { Labels, WithOptionalLabels } from '../Labels/index.ts'\nimport type {\n CreatableModule, CreatableModuleFactory, CreatableModuleInstance,\n} from './CreatableModule.ts'\n\nexport class ModuleFactory<TModule extends CreatableModuleInstance> implements CreatableModuleFactory<TModule> {\n configSchemas: CreatableModule<TModule>['configSchemas']\n\n creatableModule: CreatableModule<TModule>\n\n defaultConfigSchema: Schema\n\n defaultLogger?: Logger\n\n defaultParams?: Partial<TModule['params']>\n\n labels?: Labels\n\n constructor(\n creatableModule: CreatableModule<TModule>,\n params?: Partial<TModule['params']>,\n labels: Labels = {},\n ) {\n this.creatableModule = creatableModule\n this.defaultParams = params\n this.configSchemas = creatableModule.configSchemas\n this.defaultConfigSchema = creatableModule.defaultConfigSchema\n assertEx(this.configSchemas.includes(this.defaultConfigSchema), () => 'defaultConfigSchema must be in configSchemas')\n this.labels = Object.assign({}, (creatableModule as WithOptionalLabels).labels ?? {}, labels ?? {})\n }\n\n static withParams<T extends CreatableModuleInstance>(\n creatableModule: CreatableModule<T>,\n params?: Partial<T['params']>,\n labels: Labels = {},\n ) {\n return new ModuleFactory<T>(creatableModule, params, labels)\n }\n\n create(this: CreatableModuleFactory<TModule>, params?: Partial<TModule['params']>): Promise<TModule> {\n const mergedParams: TModule['params'] = {\n ...this.defaultParams,\n ...params,\n config: {\n schema: this.creatableModule.defaultConfigSchema,\n ...this.defaultParams?.config,\n ...params?.config,\n },\n } as TModule['params']\n return this.creatableModule.create<TModule>(mergedParams)\n }\n\n factory<T extends CreatableModuleInstance>(this: CreatableModuleFactory<T>, params?: Partial<T['params']>, labels: Labels = {}): CreatableModuleFactory<T> {\n return new ModuleFactory<T>(this.creatableModule, params, labels)\n }\n}\n","import type { JsonValue } from '@xylabs/sdk-js'\n\nexport class ModuleDetailsError extends Error {\n details?: JsonValue\n constructor(\n message: string,\n details?: JsonValue,\n ) {\n super(message)\n this.details = details\n this.name = 'ModuleError'\n }\n}\n","import { AsObjectFactory } from '@xylabs/sdk-js'\n\nimport { isModuleInstance } from './isModuleInstance.ts'\n\nexport const asModuleInstance = AsObjectFactory.create(isModuleInstance)\n","import type { ObjectTypeShape, TypeCheck } from '@xylabs/sdk-js'\nimport { IsObjectFactory } from '@xylabs/sdk-js'\n\nimport { isModule } from '../module/index.ts'\nimport type { ModuleInstance } from './Instance.ts'\n\nexport const requiredModuleInstanceFunctions: ObjectTypeShape = {\n manifest: 'function',\n state: '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/sdk-js'\n\nimport { isModule } from './isModule.ts'\n\nexport const asModule = AsObjectFactory.create(isModule)\n","import { asSchema, type Query } from '@xyo-network/payload-model'\n\nexport const ModuleManifestQuerySchema = asSchema('network.xyo.query.module.manifest', true)\nexport type ModuleManifestQuerySchema = typeof ModuleManifestQuerySchema\n\nexport type ModuleManifestQuery = Query<{\n maxDepth?: number\n schema: ModuleManifestQuerySchema\n}>\n","import { asSchema, type Query } from '@xyo-network/payload-model'\n\nexport const ModuleAddressQuerySchema = asSchema('network.xyo.query.module.address', true)\nexport type ModuleAddressQuerySchema = typeof ModuleAddressQuerySchema\n\nexport type ModuleAddressQuery = Query<{\n schema: ModuleAddressQuerySchema\n}>\n","import { asSchema, type Query } from '@xyo-network/payload-model'\n\nexport const ModuleStateQuerySchema = asSchema('network.xyo.query.module.state', true)\nexport type ModuleStateQuerySchema = typeof ModuleStateQuerySchema\n\nexport type ModuleStateQuery = Query<void, ModuleStateQuerySchema>\n","import type { Address } from '@xylabs/sdk-js'\nimport { asSchema, type Query } from '@xyo-network/payload-model'\n\nexport const ModuleSubscribeQuerySchema = asSchema('network.xyo.query.module.subscribe', true)\nexport type ModuleSubscribeQuerySchema = typeof ModuleSubscribeQuerySchema\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: Address\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/sdk-js'\n\nimport { isModuleObject } from './isModuleObject.ts'\n\nexport const asModuleObject = AsObjectFactory.create(isModuleObject)\n","import type { ObjectTypeShape, TypeCheck } from '@xylabs/sdk-js'\nimport { IsObjectFactory } from '@xylabs/sdk-js'\n\nimport type { Module } from './Module.ts'\n\nexport const requiredModuleShape: ObjectTypeShape = {\n address: 'string',\n queries: 'array',\n query: 'function',\n}\n\nconst factory = new IsObjectFactory<Module>()\n\nexport const isModuleObject: TypeCheck<Module> = factory.create(requiredModuleShape)\n","import type {\n AnyNonPromise,\n AnyObject, EmptyObject, TypeCheck,\n TypeCheckConfig,\n} from '@xylabs/sdk-js'\n\nimport { asModuleObject } from './asModuleObject.ts'\nimport { isModuleObject } from './isModuleObject.ts'\nimport type { Module } from './Module.ts'\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 const result = (obj: AnyNonPromise, config?: TypeCheckConfig | number): obj is T => {\n const mod = asModuleObject(obj)\n return (\n isModuleObject(mod, config)\n // eslint-disable-next-line unicorn/no-array-reduce\n && (expectedQueries?.reduce((prev, query) => prev && mod.queries.includes(query), true) ?? true)\n // perform additional checks\n // eslint-disable-next-line unicorn/no-array-reduce\n && (additionalChecks?.reduce((prev, check) => prev && check(obj, config), true) ?? true)\n )\n }\n return result\n }\n}\n","import type { TypeCheck } from '@xylabs/sdk-js'\nimport type { Schema } from '@xyo-network/payload-model'\n\nimport { ModuleStateQuerySchema } from '../Queries/index.ts'\nimport { IsModuleFactory } from './IsModuleFactory.ts'\nimport { isModuleObject } from './isModuleObject.ts'\nimport type { Module } from './Module.ts'\n\nexport const requiredModuleQueries: Schema[] = [ModuleStateQuerySchema]\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 { AsObjectFactory } from '@xylabs/sdk-js'\n\nimport { isAttachableModuleInstance } from './isAttachableInstance.ts'\n\nexport const asAttachableModuleInstance = AsObjectFactory.create(isAttachableModuleInstance)\n","import type { ObjectTypeShape, TypeCheck } from '@xylabs/sdk-js'\nimport { IsObjectFactory } from '@xylabs/sdk-js'\n\nimport { isModuleInstance } from '../isModuleInstance.ts'\nimport type { AttachableModuleInstance } from './AttachableInstance.ts'\n\nexport const requiredAttachableModuleInstanceFunctions: ObjectTypeShape = {\n downResolver: 'object',\n upResolver: 'object',\n}\n\n// we do not use IsInstanceFactory here to prevent a cycle\nconst factory = new IsObjectFactory<AttachableModuleInstance>()\n\nexport const isAttachableModuleInstance: TypeCheck<AttachableModuleInstance> = factory.create(requiredAttachableModuleInstanceFunctions, [\n isModuleInstance,\n])\n","import type { CreatableInstance, TypeCheck } from '@xylabs/sdk-js'\nimport { IsObjectFactory } from '@xylabs/sdk-js'\n\nimport type { ModuleEventData } from '../../EventsModels/index.ts'\nimport type { ModuleParams } from '../../ModuleParams.ts'\nimport type { ModuleInstance } from '../Instance.ts'\nimport type { ModuleResolverInstance } from '../ModuleResolver.ts'\n\nexport interface AttachableModuleInstance<TParams extends ModuleParams = ModuleParams, TEventData extends ModuleEventData = ModuleEventData>\n extends ModuleInstance<TParams, TEventData>, CreatableInstance<TParams, TEventData> {\n config: TParams['config']\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: ModuleResolverInstance\n\n // The resolver that gets called by children (usually only Nodes have this)\n readonly privateResolver: ModuleResolverInstance\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: ModuleResolverInstance\n}\n\nexport type AttachableModuleInstanceTypeCheck<T extends AttachableModuleInstance = AttachableModuleInstance> = TypeCheck<T>\n\nexport class IsAttachableModuleInstanceFactory<T extends AttachableModuleInstance = AttachableModuleInstance> extends IsObjectFactory<T> {}\n","import type {\n Address, CreatableStatus, Promisable,\n TypeCheck,\n} from '@xylabs/sdk-js'\nimport { IsObjectFactory, toSafeJsonString } from '@xylabs/sdk-js'\nimport type { AccountInstance } from '@xyo-network/account-model'\n\nimport type { ModuleEventData } from '../EventsModels/index.ts'\nimport type { Module, ModuleQueryFunctions } from '../module/index.ts'\nimport type { ModuleIdentifier, ModuleName } from '../ModuleIdentifier.ts'\nimport type { ModuleParams } from '../ModuleParams.ts'\nimport type { Direction } from './ObjectFilter.ts'\nimport type { ObjectResolver } from './ObjectResolver.ts'\n\nexport type ModulePipeLine = Lowercase<'one-to-one' | 'one-to-many' | 'many-to-one' | 'many-to-many'>\n\nexport type ModuleStatus = CreatableStatus | 'wrapped' | 'proxy'\n\nexport class DeadModuleError extends Error {\n error: Error | undefined\n id: ModuleIdentifier\n constructor(\n id: ModuleIdentifier,\n error: Error | undefined,\n msg = 'Dead Module Error',\n ) {\n super(`${msg} [${id}]: ${error?.message ?? toSafeJsonString(error)}`)\n this.id = id\n this.error = error\n\n // Set the prototype explicitly.\n Object.setPrototypeOf(this, DeadModuleError.prototype)\n }\n}\n\nexport interface AddressToWeakInstanceCache {\n get: (address: Address) => WeakRef<ModuleInstance> | null\n set: (address: Address, instance: WeakRef<ModuleInstance> | null) => void\n}\n\nexport interface ModuleFamilyFunctions {\n account?: AccountInstance\n addParent: (mod: ModuleInstance) => void\n addressCache?: (direction: Direction, includePrivate: boolean) => AddressToWeakInstanceCache | undefined\n modName?: ModuleName\n parents: () => Promisable<ModuleInstance[]>\n privateChildren: () => Promisable<ModuleInstance[]>\n publicChildren: () => Promisable<ModuleInstance[]>\n removeParent: (address: Address) => void\n siblings: () => Promisable<ModuleInstance[]>\n}\n\nexport interface ModuleInstance<TParams extends ModuleParams = ModuleParams, TEventData extends ModuleEventData = ModuleEventData>\n extends Module<TParams, TEventData>,\n ObjectResolver<ModuleInstance>,\n ModuleQueryFunctions,\n ModuleFamilyFunctions {\n readonly pipeline?: ModulePipeLine\n\n // if the module has become non-functional, such as a broken bridge connection, this will be 'dead'\n readonly status: ModuleStatus | null\n}\n\nexport type InstanceTypeCheck<T extends ModuleInstance = ModuleInstance> = TypeCheck<T>\n\nexport class IsInstanceFactory<T extends ModuleInstance = ModuleInstance> extends IsObjectFactory<T> {}\n","import type {\n Address,\n AnyObject, EmptyObject, TypeCheck,\n} from '@xylabs/sdk-js'\n\nimport type { ModuleName } from '../ModuleIdentifier.ts'\n\nexport type Direction = 'up' | 'down' | 'all'\nexport type Visibility = 'public' | 'private' | 'all'\n\nexport interface ResolveStrategy {\n maxDepth?: number\n required?: boolean | 'warn' | 'log'\n retry?: number\n timeout?: number\n}\n\nexport interface ObjectFilterOptions<T extends EmptyObject = AnyObject> extends ResolveStrategy {\n direction?: Direction\n identity?: TypeCheck<T>\n}\n\nexport interface AddressObjectFilter<T extends EmptyObject = AnyObject> extends ObjectFilterOptions<T> {\n address: Address[]\n}\n\nexport const isAddressObjectFilter = <T extends EmptyObject = AnyObject>(value: unknown): value is AddressObjectFilter<T> =>\n (value as AddressObjectFilter<T>).address !== undefined\n\nexport interface NameObjectFilter<T extends EmptyObject = AnyObject> extends ObjectFilterOptions<T> {\n name: ModuleName[]\n}\n\nexport const isNameObjectFilter = <T extends EmptyObject = AnyObject>(value: unknown): value is NameObjectFilter<T> =>\n (value as NameObjectFilter<T>).name !== undefined\n\nexport interface QueryObjectFilter<T extends EmptyObject = AnyObject> extends ObjectFilterOptions<T> {\n query: string[][]\n}\n\nexport const isQueryObjectFilter = <T extends EmptyObject = AnyObject>(value: unknown): value is QueryObjectFilter<T> =>\n (value as QueryObjectFilter<T>).query !== undefined\n\nexport type AnyObjectFilter<T extends EmptyObject = AnyObject> = Partial<AddressObjectFilter<T>>\n & Partial<NameObjectFilter<T>>\n & Partial<QueryObjectFilter<T>>\n\nexport type ObjectFilter<T extends EmptyObject> = ObjectFilterOptions<T> | AddressObjectFilter<T> | NameObjectFilter<T> | QueryObjectFilter<T>\n","import type { ModuleInstance } from './Instance.ts'\nimport type {\n AddressObjectFilter,\n AnyObjectFilter,\n NameObjectFilter,\n ObjectFilter,\n ObjectFilterOptions,\n QueryObjectFilter,\n} from './ObjectFilter.ts'\nimport {\n isAddressObjectFilter,\n isNameObjectFilter,\n isQueryObjectFilter,\n} from './ObjectFilter.ts'\n\nexport interface ModuleFilterOptions<T extends ModuleInstance = ModuleInstance> extends ObjectFilterOptions<T> {}\n\nexport const isAddressModuleFilter = isAddressObjectFilter<ModuleInstance>\n\nexport const isNameModuleFilter = isNameObjectFilter<ModuleInstance>\n\nexport const isQueryModuleFilter = isQueryObjectFilter<ModuleInstance>\n\nexport type AnyModuleFilter<T extends ModuleInstance = ModuleInstance> = AnyObjectFilter<T>\n\nexport type AddressModuleFilter<T extends ModuleInstance = ModuleInstance> = AddressObjectFilter<T>\n\nexport type NameModuleFilter<T extends ModuleInstance = ModuleInstance> = NameObjectFilter<T>\n\nexport type QueryModuleFilter<T extends ModuleInstance = ModuleInstance> = QueryObjectFilter<T>\n\n/** @deprecated use ModuleIdentifier instead */\nexport type ModuleFilter<T extends ModuleInstance = ModuleInstance> = ObjectFilter<T>\n","import type {\n AnyObject, EmptyObject, Promisable,\n} from '@xylabs/sdk-js'\n\nimport type { ModuleIdentifier } from '../ModuleIdentifier.ts'\nimport type { ObjectFilterOptions } from './ObjectFilter.ts'\n\nexport const isObjectResolver = <T extends EmptyObject = AnyObject>(value?: unknown): value is ObjectResolver<T> => {\n return typeof (value as Partial<ObjectResolver<T>>).resolve === 'function'\n}\n\nexport const ObjectResolverPriority = {\n Disabled: -1,\n VeryLow: 0,\n Low: 1,\n Normal: 2,\n High: 3,\n VeryHigh: 4,\n} as const\n\nexport type ObjectResolverPriority = typeof ObjectResolverPriority[keyof typeof ObjectResolverPriority]\n\nexport interface ObjectResolver<TResult extends EmptyObject> {\n priority: ObjectResolverPriority\n /** @deprecated do not pass undefined. If trying to get all, pass '*' */\n resolve<T extends TResult = TResult>(): Promisable<T | undefined>\n resolve<T extends TResult = TResult>(all: '*', options?: ObjectFilterOptions<T>): Promisable<T[]>\n resolve<T extends TResult = TResult>(id: ModuleIdentifier, options?: ObjectFilterOptions<T>): Promisable<T | undefined>\n resolve<T extends TResult = TResult>(\n id?: ModuleIdentifier,\n options?: ObjectFilterOptions<T>,\n ): Promisable<T | T[] | undefined>\n\n resolvePrivate<T extends TResult = TResult>(all: '*', options?: ObjectFilterOptions<T>): Promise<T[]>\n resolvePrivate<T extends TResult = TResult>(id: ModuleIdentifier, options?: ObjectFilterOptions<T>): Promise<T | undefined>\n resolvePrivate<T extends TResult = TResult>(id: ModuleIdentifier, options?: ObjectFilterOptions<T>): Promise<T | T[] | undefined>\n}\n\nexport interface ObjectResolverInstance<TResult extends EmptyObject> extends ObjectResolver<TResult> {\n addResolver: (resolver: ObjectResolverInstance<TResult>) => this\n removeResolver: (resolver: ObjectResolverInstance<TResult>) => this\n}\n","import type { Address, Promisable } from '@xylabs/sdk-js'\n\nimport type { ModuleIdentifier } from '../ModuleIdentifier.ts'\nimport type { ModuleInstance } from './Instance.ts'\nimport type { ObjectFilterOptions } from './ObjectFilter.ts'\nimport type { ObjectResolver } from './ObjectResolver.ts'\nimport { isObjectResolver } from './ObjectResolver.ts'\n\nexport const isModuleResolver = isObjectResolver<ModuleInstance>\n\nexport interface ModuleResolver<TResult extends ModuleInstance = ModuleInstance> extends ObjectResolver<TResult> {}\n\nexport interface ModuleNameResolver {\n readonly root: ModuleInstance\n resolveIdentifier(id: ModuleIdentifier, options?: ObjectFilterOptions): Promisable<Address | undefined>\n}\n\nexport interface ModuleResolverInstance<TResult extends ModuleInstance = ModuleInstance> extends ModuleResolver<TResult>, ModuleNameResolver {\n addResolver: (resolver: ModuleResolverInstance<TResult>) => this\n removeResolver: (resolver: ModuleResolverInstance<TResult>) => this\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 return source?.hasOwnProperty(key as keyof typeof source) && source?.[key as keyof typeof source] === value\n })\n}\n","export const ModuleLimitationLabelName = 'network.xyo.module.limitation'\nexport type ModuleLimitationLabelName = typeof ModuleLimitationLabelName\n\nexport const ModuleLimitationViewLabel = { ModuleLimitationLabelName: 'view' }\n","import type { Module } from '../module/index.ts'\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","export const isSerializable = (value: unknown, maxDepth = 10): boolean => {\n if (maxDepth <= 0) {\n return false\n }\n if (value === null || typeof value === 'boolean' || typeof value === 'number' || typeof value === 'string') {\n return true\n }\n\n if (Array.isArray(value)) {\n return value.every(item => isSerializable(item, maxDepth - 1))\n }\n\n if (typeof value === 'object') {\n if (value instanceof Date || value instanceof RegExp) {\n return true\n }\n\n // Check for non-serializable objects like Set and Map\n if (value instanceof Set || value instanceof Map) {\n return false\n }\n\n if (value !== null && value !== undefined) {\n return Object.values(value).every(item => isSerializable(item, maxDepth - 1))\n }\n }\n\n // Exclude functions, symbols, undefined, and BigInt explicitly\n return false\n}\n","import type { Address } from '@xylabs/sdk-js'\nimport { isAddress } from '@xylabs/sdk-js'\n\nexport const MODULE_PATH_SEPARATOR = ':' as const\n\nexport const DisallowedModuleIdentifierCharacters = {\n ' ': true,\n '!': true,\n '\"': true,\n '#': true,\n '$': true,\n '%': true,\n '&': true,\n \"'\": true,\n '(': true,\n ')': true,\n '*': true,\n ',': true,\n '.': true,\n '/': true,\n ':': true,\n ';': true,\n '<': true,\n '=': true,\n '>': true,\n '?': true,\n '@': true,\n '[': true,\n ']': true,\n '^': true,\n '_': true,\n '{': true,\n '|': true,\n '}': true,\n '~': true,\n}\nexport type ReservedModuleIdentifierCharacter = keyof typeof DisallowedModuleIdentifierCharacters\nexport const ReservedModuleIdentifierCharacters = new Set<ReservedModuleIdentifierCharacter>(\n Object.keys(DisallowedModuleIdentifierCharacters) as ReservedModuleIdentifierCharacter[],\n)\n\n// TODO: Use Brand, but avoid too complex error\n// export type ModuleName = Brand<string, { __moduleName: true }>\nexport type ModuleName = string\n\nexport type ModuleIdentifier\n = | ColonPair<ModuleIdentifierPart>\n | ColonPair<ColonPair<ModuleIdentifierPart>>\n | ColonPair<ColonPair<ColonPair<ModuleIdentifierPart>>>\n | ColonPair<ColonPair<ColonPair<ColonPair<ModuleIdentifierPart>>>>\n | ColonPair<ColonPair<ColonPair<ColonPair<ColonPair<ModuleIdentifierPart>>>>>\n | ColonPair<ColonPair<ColonPair<ColonPair<ColonPair<ColonPair<ModuleIdentifierPart>>>>>>\n | ColonPair<ColonPair<ColonPair<ColonPair<ColonPair<ColonPair<ColonPair<ModuleIdentifierPart>>>>>>>\n\nexport type ColonPair<T extends string> = `${T}:${T}` | T\n\nexport type ModuleIdentifierPart = Exclude<Address | ModuleName, '*'>\n\nexport const isModuleName = (value: unknown): value is ModuleName => {\n return typeof value === 'string' && !isAddress(value) && !includesReservedModuleIdentifierCharacter(value)\n}\n\nexport const includesReservedModuleIdentifierCharacter = (value: unknown): boolean => {\n return typeof value === 'string' && [...value].some(char => ReservedModuleIdentifierCharacters.has(char as ReservedModuleIdentifierCharacter))\n}\n\nexport const isModuleIdentifierPart = (value: unknown): value is ModuleIdentifierPart => {\n return isModuleName(value) || isAddress(value)\n}\n","import type { Address } from '@xylabs/sdk-js'\nimport { AsObjectFactory } from '@xylabs/sdk-js'\nimport {\n asSchema, isPayloadOfSchemaType, type Payload,\n} from '@xyo-network/payload-model'\n\nexport const AddressSchema = asSchema('network.xyo.address', true)\nexport type AddressSchema = typeof AddressSchema\n\nexport const AddressChildSchema = asSchema('network.xyo.address.child', true)\nexport type AddressChildSchema = typeof AddressChildSchema\n\nexport interface AddressFields {\n address: Address\n}\n\nexport type AddressPayload = Payload<AddressFields, AddressSchema>\n\n/**\n * Identity function for determining if an object is an Address\n */\nexport const isAddressPayload = isPayloadOfSchemaType<AddressPayload>(AddressSchema)\nexport const asAddressPayload = AsObjectFactory.create(isAddressPayload)\nexport const asOptionalAddressPayload = AsObjectFactory.createOptional(isAddressPayload)\n\nexport interface AddressChildFields extends AddressFields {\n /**\n * The derivation path of the child address\n */\n path?: string\n /**\n * The public address of the root of the hierarchy\n */\n root?: Address\n}\n\nexport type AddressChildPayload = Payload<AddressChildFields, AddressChildSchema>\n","import type { Address } from '@xylabs/sdk-js'\nimport { asSchema, type Payload } from '@xyo-network/payload-model'\n\nexport const AddressPreviousHashSchema = asSchema('network.xyo.address.hash.previous', true)\nexport type AddressPreviousHashSchema = typeof AddressPreviousHashSchema\n\nexport type AddressPreviousHashPayload = Payload<\n {\n address: Address\n previousHash?: string\n },\n AddressPreviousHashSchema\n>\n","import { asSchema, type Payload } from '@xyo-network/payload-model'\n\nimport type { ModuleDescription } from '../ModuleDescription.ts'\n\nexport const ModuleDescriptionSchema = asSchema('network.xyo.module.description', true)\nexport type ModuleDescriptionSchema = typeof ModuleDescriptionSchema\n\nexport type ModuleDescriptionPayload = Payload<ModuleDescription, ModuleDescriptionSchema>\n","import { AsObjectFactory } from '@xylabs/sdk-js'\nimport type { Payload, WithSources } from '@xyo-network/payload-model'\nimport {\n asSchema, isPayloadOfSchemaType, isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nexport interface StateDictionary {\n [key: string]: string | number\n}\nexport interface State<T extends StateDictionary = StateDictionary> {\n state: T\n}\n\nexport const ModuleStateSchema = asSchema('network.xyo.module.state', true)\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, TInput = unknown>(payload?: TInput): payload is ModuleState<T> & TInput => {\n return isPayloadOfSchemaType<ModuleState<T>>(ModuleStateSchema)(payload)\n}\n\nexport const isModuleStateWithSources = <T extends StateDictionary = StateDictionary,\n TInput = unknown>(payload?: TInput): payload is WithSources<ModuleState<T>> & TInput => {\n return isPayloadOfSchemaTypeWithSources<ModuleState<T>>(ModuleStateSchema)(payload)\n}\n\nexport const asModuleState = AsObjectFactory.create<ModuleState<StateDictionary>>(isModuleState)\nexport const asOptionalModuleState = AsObjectFactory.createOptional<ModuleState<StateDictionary>>(isModuleState)\n","import type { Address } from '@xylabs/sdk-js'\n\nimport type { ModuleInstance } from '../instance/index.ts'\nimport type { ModuleResolveDirection } from './model.ts'\n\nexport const resolveAddressToInstanceDown = async (\n root: ModuleInstance,\n address: Address,\n includePrivate: boolean | undefined = undefined,\n ignore: Address[] = [],\n): Promise<ModuleInstance | undefined> => {\n if (root.address === address) {\n return root\n }\n const cache = root.addressCache?.('up', !!includePrivate)\n const privateChildren = (includePrivate ? await root.privateChildren?.() : []) ?? []\n const publicChildren = (await root.publicChildren?.()) ?? []\n const children = [...privateChildren, ...publicChildren]\n for (const child of children) {\n const found = await resolveAddressToInstanceDown(child, address, includePrivate, ignore)\n if (found) {\n cache?.set(address, new WeakRef(found))\n return found\n }\n }\n cache?.set(address, null)\n}\n\nexport const resolveAddressToInstanceSiblings = async (\n root: ModuleInstance,\n address: Address,\n includePrivate: boolean | undefined = undefined,\n ignore: Address[] = [],\n): Promise<ModuleInstance | undefined> => {\n const siblings = (await root.siblings?.()) ?? []\n for (const sibling of siblings) {\n const found = await resolveAddressToInstanceDown(sibling, address, includePrivate, ignore)\n if (found) {\n return found\n }\n }\n}\n\nexport const resolveAddressToInstanceUp = async (\n root: ModuleInstance,\n address: Address,\n includePrivate: boolean | undefined = undefined,\n ignore: Address[] = [],\n): Promise<ModuleInstance | undefined> => {\n const cache = root.addressCache?.('up', includePrivate ?? true)\n const parents = (await root.parents?.()) ?? []\n for (const parent of parents) {\n const found = await resolveAddressToInstance(parent, address, includePrivate, ignore)\n if (found) {\n cache?.set(address, new WeakRef(found))\n return found\n }\n }\n cache?.set(address, null)\n}\n\nexport const resolveAddressToInstanceAll = async (\n root: ModuleInstance,\n address: Address,\n includePrivate: boolean | undefined = undefined,\n ignore: Address[] = [],\n): Promise<ModuleInstance | undefined> => {\n const cache = root.addressCache?.('all', !!includePrivate)\n const result\n = (await resolveAddressToInstanceDown(root, address, includePrivate ?? false, ignore))\n ?? (await resolveAddressToInstanceUp(root, address, includePrivate ?? true, ignore))\n cache?.set(address, result ? new WeakRef(result) : null)\n return result\n}\n\nexport const resolveAddressToInstance = async (\n root: ModuleInstance,\n address: Address,\n includePrivate: boolean | undefined = undefined,\n ignore: Address[] = [],\n direction: ModuleResolveDirection = 'all',\n): Promise<ModuleInstance | undefined> => {\n switch (direction) {\n case 'all': {\n return await resolveAddressToInstanceAll(root, address, includePrivate, ignore)\n }\n case 'up': {\n return await resolveAddressToInstanceUp(root, address, includePrivate ?? true, ignore)\n }\n case 'down': {\n return await resolveAddressToInstanceDown(root, address, includePrivate ?? false, ignore)\n }\n }\n}\n","import type { Address } from '@xylabs/sdk-js'\n\nimport type { ModuleInstance } from '../instance/index.ts'\nimport { duplicateModules } from '../lib/index.ts'\n\nexport const resolveAllUp = async (root: ModuleInstance, maxDepth = 10, exclude: Address[] = []): Promise<ModuleInstance[]> => {\n if (maxDepth === 0) {\n return [root].filter(mod => !exclude.includes(mod.address))\n }\n const parents = (await root.parents()).filter(mod => !exclude.includes(mod.address))\n return (\n maxDepth > 1\n ? [\n ...(await Promise.all(parents.map(async mod => await resolveAllUp(mod, maxDepth - 1, [...exclude, root.address])))).flat(),\n ...(await Promise.all(parents.map(async mod => await resolveAllDown(mod, maxDepth - 1, [...exclude, root.address], true)))).flat(),\n ...parents,\n root,\n ]\n : [...parents, root])\n .filter(mod => !exclude.includes(mod.address))\n .filter(duplicateModules)\n}\n\nexport const resolveAllDown = async (\n root: ModuleInstance,\n maxDepth = 10,\n exclude: Address[] = [],\n includePrivate = false,\n): Promise<ModuleInstance[]> => {\n if (maxDepth === 0) {\n return [root]\n }\n const children = (await root.publicChildren()).filter(mod => !exclude.includes(mod.address))\n const privateChildren = includePrivate ? (await root.privateChildren()).filter(mod => !exclude.includes(mod.address)) : []\n return (\n maxDepth > 1\n ? [\n ...children,\n ...(await Promise.all(children.map(child => resolveAllDown(child, maxDepth - 1, [...exclude, root.address])))).flat(),\n ...(await Promise.all(privateChildren.map(child => resolveAllDown(child, maxDepth - 1, [...exclude, root.address])))).flat(),\n root,\n ]\n : [...children, root])\n .filter(mod => !exclude.includes(mod.address))\n .filter(duplicateModules)\n}\n\nexport const resolveAll = async (root: ModuleInstance, maxDepth = 10, exclude: Address[] = []): Promise<ModuleInstance[]> => {\n if (maxDepth === 0) {\n return [root]\n }\n return [...(await resolveAllUp(root, maxDepth, exclude)), ...(await resolveAllDown(root, maxDepth, exclude))].filter(duplicateModules)\n}\n","/* eslint-disable max-statements */\n/* eslint-disable complexity */\nimport type { Address, Logger } from '@xylabs/sdk-js'\nimport {\n assertEx,\n exists,\n IdLogger,\n isAddress,\n isDefined, isString, isTruthy, toSafeJsonString,\n} from '@xylabs/sdk-js'\n\nimport type {\n ModuleFilterOptions, ModuleInstance, ModuleResolver,\n} from '../instance/index.ts'\nimport { asModuleInstance } from '../instance/index.ts'\nimport { duplicateModules } from '../lib/index.ts'\nimport type { ModuleIdentifier } from '../ModuleIdentifier.ts'\nimport type { ModuleIdentifierTransformer } from '../ModuleIdentifierTransformer.ts'\nimport { ResolveHelperStatic } from './ResolveHelperStatic.ts'\nimport { resolvePathToAddress } from './resolvePathToAddress.ts'\nimport { traceModuleIdentifier } from './traceModuleIdentifier.ts'\nimport { transformModuleIdentifier } from './transformModuleIdentifier.ts'\n\n/*\n\nResolution rules\n\n1. Resolution is always done from the perspective of the module whose resolve function was called.\n\n2. Requesting '*' will return all the modules that the resolver can see. [limited by maxDepth]\n\n3. Requesting a simple ModuleName (string w/o ':' separator) will return an immediate child that has that name.\n\n4. Requesting a complex ModuleName (string w/ ':' separator) will resolve the first part and then recursively resolve\n the remaining name by calling the first part's resolved module's resolve with the remainder of the name.\n\n5. Requesting an Address (string) will return the module with that address, regardless of how distant it is from the module. [limited by maxDepth]\n\n6. Requesting a ModuleFilter will first request all the modules '*' and then filter them based on the filter settings. [Do we need this mode?]\n\n7. When a string is passed as the ModuleIdentifier, do the following:\n Check if id is complex (contains a ':')\n a) If it is complex, go to #4 above\n b) Call isAddress in the id to see if it is a valid address.\n i) If it is a valid address, go to #5 above\n ii) If it is not a valid address, go to # 3 above\n\n 1: If someone were to name a module with a valid address, that name will not be resolvable.\n 2: If someone were to name a module with a string containing a ':', that name will not be resolvable.\n\n8. Modules have two resolvers, up and down.\n a) Up Traversal\n i) Every module's upResolver also can call it's parent's upResolver\n ii) An upResolver also can see the parent's children's downResolvers\n iii) This means that when traversing upResolvers, you can traverse all the way up. [limited by maxDepth]\n iv) At any point of the up traversal, it can start traversing down to any immediate child, public or private.\n b) Down Traversal\n i) A down traversal is limited to the public children of the module. [The same as scope as calling the 'resolve' function]\n\n9. An up or a down traversal counts against the maxDepth\n\n*/\n\nexport interface ResolveHelperConfig {\n address: Address\n dead?: boolean\n downResolver?: ModuleResolver\n logger?: Logger\n mod: ModuleInstance\n privateResolver?: ModuleResolver\n transformers: ModuleIdentifierTransformer[]\n upResolver?: ModuleResolver\n}\n\nexport class ResolveHelper extends ResolveHelperStatic {\n static async resolve<T extends ModuleInstance = ModuleInstance>(\n config: ResolveHelperConfig,\n all: '*',\n options?: ModuleFilterOptions<T>,\n ): Promise<T[]>\n static async resolve<T extends ModuleInstance = ModuleInstance>(\n config: ResolveHelperConfig,\n id: ModuleIdentifier,\n options?: ModuleFilterOptions<T>,\n ): Promise<T | undefined>\n static async resolve<T extends ModuleInstance = ModuleInstance>(\n config: ResolveHelperConfig,\n id: ModuleIdentifier = '*',\n {\n maxDepth = 3, required = 'log', ...options\n }: ModuleFilterOptions<T> = {},\n ): Promise<T | T[] | undefined> {\n const {\n transformers, mod, logger = this.defaultLogger, dead = false, upResolver, downResolver, privateResolver,\n } = config\n const log = logger ? new IdLogger(logger, () => `ResolveHelper [${mod.id}][${id}]`) : undefined\n\n const downLocalOptions: ModuleFilterOptions<T> = {\n ...options, direction: 'down', maxDepth, required: false,\n }\n const upLocalOptions: ModuleFilterOptions<T> = { ...downLocalOptions, direction: 'up' }\n\n const childOptions: ModuleFilterOptions<T> = {\n ...options, maxDepth: maxDepth - 1, required: false,\n }\n\n const direction = options?.direction ?? 'all'\n const up = direction === 'up' || direction === 'all'\n const down = direction === 'down' || direction === 'all'\n let result: T | T[] | undefined\n log?.debug('start', id, maxDepth)\n if (id === '*') {\n if (dead) {\n log?.warn('failed [dead]', id)\n return []\n }\n const modules = [\n ...(down ? await (downResolver as ModuleResolver).resolve<T>('*', downLocalOptions) : []),\n ...(up ? await (upResolver as ModuleResolver).resolve<T>('*', upLocalOptions) : []),\n ].filter(duplicateModules)\n\n if (modules.length > 0) {\n log?.debug('modules [count]', modules.length)\n log?.debug('modules', toSafeJsonString(modules, 4))\n }\n\n if (maxDepth === 0) {\n return modules\n }\n const childModules = (await Promise.all(modules.map(async mod => await mod.resolve<T>('*', childOptions)))).flat().filter(duplicateModules)\n return [...modules, ...childModules, mod as T].filter(duplicateModules)\n } else {\n switch (typeof id) {\n case 'string': {\n if (dead) {\n return undefined\n }\n\n const resolvedId = assertEx((await resolvePathToAddress(mod, id, false, transformers)) ?? id, () => 'Invalid resolvedId')\n\n const resolvers = [\n [downResolver, downLocalOptions],\n [up ? upResolver : undefined, upLocalOptions],\n [up ? privateResolver : undefined, upLocalOptions],\n ].filter(([resolver]) => exists(resolver)) as [ModuleResolver, ModuleFilterOptions<T>][]\n\n for (const resolver of resolvers) {\n const [resolverInstance] = resolver\n if (!result) {\n result = await this.resolveModuleIdentifier<T>(resolverInstance, resolvedId)\n }\n }\n\n break\n }\n default: {\n break\n }\n }\n }\n this.validateRequiredResolve(required, result, id, logger)\n return result\n }\n\n // resolves a complex module path to addresses\n static async resolveModuleIdentifier<T extends ModuleInstance = ModuleInstance>(\n resolver: ModuleResolver,\n path: ModuleIdentifier,\n required?: boolean,\n ): Promise<T | undefined> {\n const parts = path.split(':')\n const first = parts.shift()\n const firstIsAddress = isAddress(first)\n const resolvedModule\n = (await resolver.resolve(first, { maxDepth: firstIsAddress ? 10 : 1 }))\n ?? (isString(first) ? await resolver.resolvePrivate(first, { maxDepth: firstIsAddress ? 10 : 1 }) : undefined)\n const finalModule = required ? assertEx(resolvedModule, () => `Failed to resolve [${first}] [${firstIsAddress}]`) : resolvedModule\n const firstModule = asModuleInstance(finalModule, () => `Resolved invalid module instance [${first}]`)\n return isDefined(firstModule) ? (parts.length > 0 ? await this.resolveModuleIdentifier<T>(firstModule, parts.join(':')) : firstModule as T) : undefined\n }\n\n // translates a complex module path to addresses\n static traceModuleIdentifier(resolver: ModuleResolver, path: ModuleIdentifier) {\n return traceModuleIdentifier(resolver, path)\n }\n\n static transformModuleIdentifier(identifier: ModuleIdentifier, transformers: ModuleIdentifierTransformer[] = ResolveHelper.transformers) {\n return transformModuleIdentifier(identifier, transformers)\n }\n\n static validateRequiredResolve(\n required: boolean | 'warn' | 'log',\n result: ModuleInstance[] | ModuleInstance | undefined,\n id: ModuleIdentifier,\n logger = this.defaultLogger,\n ) {\n const log = logger ? new IdLogger(logger, () => `validateRequiredResolve [${id}][${result}]`) : undefined\n if (isTruthy(required) && (result === undefined || (Array.isArray(result) && result.length > 0))) {\n switch (required) {\n case 'warn': {\n log?.warn('resolve failed', id)\n break\n }\n case 'log': {\n log?.log('resolve failed', id)\n break\n }\n default: {\n throw new Error(`resolve failed [${id}]`)\n }\n }\n }\n }\n}\n","import type { Logger } from '@xylabs/sdk-js'\n\nimport type { ModuleIdentifierTransformer } from '../ModuleIdentifierTransformer.ts'\n\nexport class ResolveHelperStatic {\n static readonly defaultLogger?: Logger\n // eslint-disable-next-line sonarjs/public-static-readonly\n static transformers: ModuleIdentifierTransformer[] = []\n}\n","import { asAddress, assertEx } from '@xylabs/sdk-js'\n\nimport type { ModuleInstance } from '../instance/index.ts'\nimport { MODULE_PATH_SEPARATOR } from '../ModuleIdentifier.ts'\nimport type { ModuleIdentifierTransformer } from '../ModuleIdentifierTransformer.ts'\nimport { resolveAddressToInstance } from './resolveAddressToInstance.ts'\nimport { ResolveHelperStatic } from './ResolveHelperStatic.ts'\nimport { resolveLocalNameToAddress } from './resolveLocalNameToAddress.ts'\nimport { transformModuleIdentifier } from './transformModuleIdentifier.ts'\n\nexport const resolvePathToInstance = async (\n root: ModuleInstance,\n path: string,\n includePrivate: boolean | undefined = undefined,\n transformers: ModuleIdentifierTransformer[] = ResolveHelperStatic.transformers,\n): Promise<ModuleInstance | undefined> => {\n const parts = path.split(MODULE_PATH_SEPARATOR)\n const first = await transformModuleIdentifier(\n assertEx(parts.shift(), () => `First part is invalid [${path}]`),\n transformers,\n )\n\n if (!first) {\n return undefined\n }\n\n const firstAddress = asAddress(first) ?? (await resolveLocalNameToAddress(root, first, includePrivate))\n\n if (firstAddress) {\n const firstModule = await resolveAddressToInstance(root, firstAddress, includePrivate)\n if (firstModule && parts.length > 0) {\n return resolvePathToInstance(firstModule, parts.join(MODULE_PATH_SEPARATOR))\n }\n return firstModule\n }\n}\n","import type { ModuleInstance } from '../instance/index.ts'\nimport type { ModuleName } from '../ModuleIdentifier.ts'\nimport type { ModuleResolveDirection } from './model.ts'\n\nexport const resolveLocalNameToInstanceUp = async (root: ModuleInstance, modName: ModuleName): Promise<ModuleInstance | undefined> => {\n const parents = (await root.parents?.()) ?? []\n return parents.find(parent => parent.config.name === modName)\n}\n\n// since this is a modName, it only checks the children of the root module\nexport const resolveLocalNameToInstanceDown = async (\n root: ModuleInstance,\n modName: ModuleName,\n includePrivate: boolean | undefined = undefined,\n): Promise<ModuleInstance | undefined> => {\n const privateChildren = (includePrivate ? await root.privateChildren?.() : []) ?? []\n const publicChildren = (await root.publicChildren?.()) ?? []\n const children = [...privateChildren, ...publicChildren]\n return children.find(child => child.config.name === modName)\n}\n\nexport const resolveLocalNameToInstanceAll = async (\n root: ModuleInstance,\n modName: ModuleName,\n includePrivate = false,\n): Promise<ModuleInstance | undefined> => {\n return (await resolveLocalNameToInstanceDown(root, modName, includePrivate)) ?? (await resolveLocalNameToInstanceUp(root, modName))\n}\n\nexport const resolveLocalNameToInstance = async (\n root: ModuleInstance,\n modName: ModuleName,\n includePrivate = false,\n direction: ModuleResolveDirection = 'all',\n): Promise<ModuleInstance | undefined> => {\n switch (direction) {\n case 'all': {\n return await resolveLocalNameToInstanceAll(root, modName, includePrivate)\n }\n case 'up': {\n return await resolveLocalNameToInstanceUp(root, modName)\n }\n case 'down': {\n return await resolveLocalNameToInstanceDown(root, modName, includePrivate)\n }\n }\n}\n","import type { Address } from '@xylabs/sdk-js'\n\nimport type { ModuleInstance } from '../instance/index.ts'\nimport type { ModuleName } from '../ModuleIdentifier.ts'\nimport type { ModuleResolveDirection } from './model.ts'\nimport {\n resolveLocalNameToInstance,\n resolveLocalNameToInstanceAll,\n resolveLocalNameToInstanceDown,\n resolveLocalNameToInstanceUp,\n} from './resolveLocalNameToInstance.ts'\n\nexport const resolveLocalNameToAddressUp = async (root: ModuleInstance, modName: ModuleName): Promise<Address | undefined> => {\n return (await resolveLocalNameToInstanceUp(root, modName))?.address\n}\n\nexport const resolveLocalNameToAddressDown = async (\n root: ModuleInstance,\n modName: ModuleName,\n includePrivate: boolean | undefined = undefined,\n): Promise<Address | undefined> => {\n return (await resolveLocalNameToInstanceDown(root, modName, includePrivate))?.address\n}\n\nexport const resolveLocalNameToAddressAll = async (\n root: ModuleInstance,\n modName: ModuleName,\n includePrivate: boolean | undefined = undefined,\n): Promise<Address | undefined> => {\n return (await resolveLocalNameToInstanceAll(root, modName, includePrivate))?.address\n}\n\nexport const resolveLocalNameToAddress = async (\n root: ModuleInstance,\n modName: ModuleName,\n includePrivate: boolean | undefined = undefined,\n direction: ModuleResolveDirection = 'all',\n): Promise<Address | undefined> => {\n return (await resolveLocalNameToInstance(root, modName, includePrivate, direction))?.address\n}\n","import type { ModuleIdentifier } from '../ModuleIdentifier.ts'\nimport type { ModuleIdentifierTransformer } from '../ModuleIdentifierTransformer.ts'\n\nexport const transformModuleIdentifier = async (\n id: ModuleIdentifier,\n transformers: ModuleIdentifierTransformer[],\n): Promise<ModuleIdentifier | undefined> => {\n let result: ModuleIdentifier | undefined = id\n for (const transformer of transformers) {\n result = await transformer.transform(id)\n }\n return result\n}\n","import type { Address } from '@xylabs/sdk-js'\n\nimport type { ModuleInstance } from '../instance/index.ts'\nimport type { ModuleIdentifierTransformer } from '../ModuleIdentifierTransformer.ts'\nimport { ResolveHelperStatic } from './ResolveHelperStatic.ts'\nimport { resolvePathToInstance } from './resolvePathToInstance.ts'\n\nexport const resolvePathToAddress = async (\n root: ModuleInstance,\n path: string,\n includePrivate: boolean | undefined = undefined,\n transformers: ModuleIdentifierTransformer[] = ResolveHelperStatic.transformers,\n): Promise<Address | undefined> => {\n return (await resolvePathToInstance(root, path, includePrivate, transformers))?.address\n}\n","import type { Address } from '@xylabs/sdk-js'\nimport { assertEx } from '@xylabs/sdk-js'\n\nimport type { ModuleResolver } from '../instance/index.ts'\nimport { asModuleInstance } from '../instance/index.ts'\nimport type { ModuleIdentifier } from '../ModuleIdentifier.ts'\n\nexport const traceModuleIdentifier = async (resolver: ModuleResolver, path: ModuleIdentifier): Promise<Address[]> => {\n const parts = path.split(':')\n const first = parts.shift()\n const firstModule = asModuleInstance(\n assertEx(await resolver.resolve(first, { maxDepth: 1 }), () => `Failed to resolve [${first}]`),\n () => `Resolved invalid module instance [${first}]`,\n )\n if (firstModule) {\n return parts.length > 0 ? [firstModule.address, ...(await traceModuleIdentifier(firstModule, parts.join(':')))] : [firstModule.address]\n }\n return []\n}\n","import type { TypeCheck } from '@xylabs/sdk-js'\n\nimport { isModuleInstance } from './instance/index.ts'\nimport { isModule } from './module/index.ts'\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 mod: any,\n\n closure: (mod: T) => R,\n ): R | undefined => {\n return typeCheck(mod) ? closure(mod) : undefined\n }\n },\n}\n\nexport const withModule = WithFactory.create(isModule)\nexport const withModuleInstance = WithFactory.create(isModuleInstance)\n"],"mappings":";AACA;AAAA,EACE;AAAA,OACK;AAMA,IAAM,qBAAqB,SAAS,6BAA6B,IAAI;;;ACiCrE,SAAS,kBAAqF;AACnG,SAAO,CAAqC,gBAAmB;AAE7D;AAAA,EACF;AACF;AAQO,SAAS,yBAA4F;AAC1G,SAAO,CAA4C,gBAAmB;AAEpE;AAAA,EACF;AACF;;;AC5DA,SAAS,gBAAgB;AACzB,SAAS,YAAAA,iBAA6B;AAUtC,IAAM,qBAAqB,CACzB,KACA,WAC2C;AAC3C,QAAMC,WAAkD;AAAA;AAAA,IAEtD,GAAG;AAAA,IAEH,eAAe,IAAI;AAAA;AAAA,IAEnB,QAAQ,IAAI,OAAO,KAAK,GAAG;AAAA,IAE3B,qBAAqB,IAAI;AAAA;AAAA,IAEzB,QAAQ,EAAE,GAAI,IAAsC,QAAQ,GAAG,OAAO;AAAA,EACxE;AACA,SAAOA;AACT;AAEO,IAAM,iCAAiC,CAC5C,UACAA,UACA,QAEA,UAAuC,UACpC;AACH,QAAM,iBACF,YAAY,QAAQ,SAAS,OAAO,IAClC,MAAM,QAAQ,OAAO,IACnB,UACA,CAAC,OAAO,IACV,CAAC;AAEP,aAAW,iBAAiB,gBAAgB;AAC1C,QAAI,CAACA,SAAQ,cAAc,SAAS,aAAa,GAAG;AAClD,cAAQ,KAAK,kBAAkB,OAAO,qCAAqC;AAAA,IAC7E;AAAA,EACF;AAE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C,IAAI,cAAoB;AAAA,EAChJ;AAAA;AAAA,EAGA,OAAO,sBAAsB,UAA0B,MAAwB;AAC7E,WAAO,sBAAsB,UAAU,IAAI;AAAA,EAC7C;AAAA,EAEA,OAAO,0BAA0B,YAA8B,eAA8C,eAAc,cAAc;AACvI,WAAO,0BAA0B,YAAY,YAAY;AAAA,EAC3D;AAAA,EAEA,OAAO,wBACL,UACA,QACA,IACA,SAAS,KAAK,eACd;AACA,UAAM,MAAM,SAAS,IAAI,SAAS,QAAQ,MAAM,4BAA4B,EAAE,KAAK,MAAM,GAAG,IAAI;AAChG,QAAIE,UAAS,QAAQ,MAAM,WAAW,UAAc,MAAM,QAAQ,MAAM,KAAK,OAAO,SAAS,IAAK;AAChG,cAAQ,UAAU;AAAA,QAChB,KAAK,QAAQ;AACX,eAAK,KAAK,kBAAkB,EAAE;AAC9B;AAAA,QACF;AAAA,QACA,KAAK,OAAO;AACV,eAAK,IAAI,kBAAkB,EAAE;AAC7B;AAAA,QACF;AAAA,QACA,SAAS;AACP,gBAAM,IAAI,MAAM,mBAAmB,EAAE,GAAG;AAAA,QAC1C;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;;;AQhNO,IAAM,cAAc;AAAA,EACzB,QAAQ,CAAmB,cAA4B;AACrD,WAAO,CAEL,KAEA,YACkB;AAClB,aAAO,UAAU,GAAG,IAAI,QAAQ,GAAG,IAAI;AAAA,IACzC;AAAA,EACF;AACF;AAEO,IAAM,aAAa,YAAY,OAAO,QAAQ;AAC9C,IAAM,qBAAqB,YAAY,OAAO,gBAAgB;","names":["asSchema","factory","factory","creatableModule","AsObjectFactory","IsObjectFactory","AsObjectFactory","asSchema","asSchema","asSchema","asSchema","factory","AsObjectFactory","factory","IsObjectFactory","AsObjectFactory","AsObjectFactory","IsObjectFactory","factory","IsObjectFactory","AsObjectFactory","IsObjectFactory","IsObjectFactory","AsObjectFactory","asSchema","asSchema","asSchema","AsObjectFactory","asSchema","isPayloadOfSchemaType","assertEx","isAddress","isTruthy","toSafeJsonString","assertEx","assertEx","assertEx","assertEx","toSafeJsonString","mod","assertEx","isAddress","isTruthy"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/module-model",
3
- "version": "5.2.27",
3
+ "version": "5.3.0",
4
4
  "description": "Primary SDK for using XYO Protocol 2.0",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -37,10 +37,10 @@
37
37
  ],
38
38
  "dependencies": {
39
39
  "@xylabs/sdk-js": "~5.0.64",
40
- "@xyo-network/account-model": "~5.2.27",
41
- "@xyo-network/boundwitness-model": "~5.2.27",
42
- "@xyo-network/manifest-model": "~5.2.27",
43
- "@xyo-network/payload-model": "~5.2.27"
40
+ "@xyo-network/account-model": "~5.3.0",
41
+ "@xyo-network/boundwitness-model": "~5.3.0",
42
+ "@xyo-network/manifest-model": "~5.3.0",
43
+ "@xyo-network/payload-model": "~5.3.0"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@xylabs/ts-scripts-yarn3": "~7.3.2",
@@ -1,11 +1,13 @@
1
1
  import type { EmptyObject } from '@xylabs/sdk-js'
2
- import type { Payload, Schema } from '@xyo-network/payload-model'
2
+ import {
3
+ asSchema, type Payload, type Schema,
4
+ } from '@xyo-network/payload-model'
3
5
 
4
6
  import type { ArchivingModuleConfig } from './Archiving.ts'
5
7
  import type { ModuleConfigFields } from './Fields.ts'
6
8
  import type { ArchivingReentrancyConfig } from './Reentrancy.ts'
7
9
 
8
- export const ModuleConfigSchema = 'network.xyo.module.config' as const
10
+ export const ModuleConfigSchema = asSchema('network.xyo.module.config', true)
9
11
  export type ModuleConfigSchema = typeof ModuleConfigSchema
10
12
 
11
13
  export type WithAdditional<T extends EmptyObject = EmptyObject, TAdditional extends EmptyObject = EmptyObject>
@@ -18,7 +20,7 @@ export type ModuleConfig<TConfig extends EmptyObject | Payload = EmptyObject, TS
18
20
  >
19
21
 
20
22
  export type AnyConfigSchema<TConfig extends Omit<ModuleConfig, 'schema'> & { schema: Schema } = Omit<ModuleConfig, 'schema'> & { schema: Schema }>
21
- = ModuleConfig<TConfig, string>
23
+ = ModuleConfig<TConfig, Schema>
22
24
 
23
25
  export type OptionalConfigSchema<TConfig extends AnyConfigSchema<ModuleConfig> = AnyConfigSchema<ModuleConfig>> = Omit<TConfig, 'schema'> & {
24
26
  schema?: TConfig['schema']
@@ -39,6 +39,9 @@ export interface ModuleConfigFields {
39
39
  /** @field Store the queries made to the module in an archivist if possible */
40
40
  readonly storeQueries?: boolean
41
41
 
42
+ /** @field Time Budget setting for spans */
43
+ readonly timeBudget?: number
44
+
42
45
  /** @field add a timestamp payload to every query */
43
46
  readonly timestamp?: boolean
44
47
  }
@@ -1,5 +1,5 @@
1
1
  import { isTruthy } from '@xylabs/sdk-js'
2
- import type { Schema } from '@xyo-network/payload-model'
2
+ import { asSchema, type Schema } from '@xyo-network/payload-model'
3
3
 
4
4
  import type { Labels } from '../Labels/index.ts'
5
5
  import type { CreatableModuleFactory, CreatableModuleInstance } from './CreatableModule.ts'
@@ -90,7 +90,8 @@ export const assignCreatableModuleRegistry = (
90
90
  ...sources: CreatableModuleRegistry[]
91
91
  ): CreatableModuleRegistry => {
92
92
  for (const source of sources)
93
- for (const [schema, factories] of Object.entries(source)) {
93
+ for (const [schemaString, factories] of Object.entries(source)) {
94
+ const schema = asSchema(schemaString, true)
94
95
  if (factories) {
95
96
  const existingFactories = target[schema]
96
97
  target[schema] = [...existingFactories ?? [], ...factories]
@@ -1,11 +1,13 @@
1
1
  import type { Address } from '@xylabs/sdk-js'
2
2
  import { AsObjectFactory } from '@xylabs/sdk-js'
3
- import { isPayloadOfSchemaType, type Payload } from '@xyo-network/payload-model'
3
+ import {
4
+ asSchema, isPayloadOfSchemaType, type Payload,
5
+ } from '@xyo-network/payload-model'
4
6
 
5
- export const AddressSchema = 'network.xyo.address' as const
7
+ export const AddressSchema = asSchema('network.xyo.address', true)
6
8
  export type AddressSchema = typeof AddressSchema
7
9
 
8
- export const AddressChildSchema = 'network.xyo.address.child' as const
10
+ export const AddressChildSchema = asSchema('network.xyo.address.child', true)
9
11
  export type AddressChildSchema = typeof AddressChildSchema
10
12
 
11
13
  export interface AddressFields {
@@ -1,7 +1,7 @@
1
1
  import type { Address } from '@xylabs/sdk-js'
2
- import type { Payload } from '@xyo-network/payload-model'
2
+ import { asSchema, type Payload } from '@xyo-network/payload-model'
3
3
 
4
- export const AddressPreviousHashSchema = 'network.xyo.address.hash.previous' as const
4
+ export const AddressPreviousHashSchema = asSchema('network.xyo.address.hash.previous', true)
5
5
  export type AddressPreviousHashSchema = typeof AddressPreviousHashSchema
6
6
 
7
7
  export type AddressPreviousHashPayload = Payload<
@@ -1,8 +1,8 @@
1
- import type { Payload } from '@xyo-network/payload-model'
1
+ import { asSchema, type Payload } from '@xyo-network/payload-model'
2
2
 
3
3
  import type { ModuleDescription } from '../ModuleDescription.ts'
4
4
 
5
- export const ModuleDescriptionSchema = 'network.xyo.module.description' as const
5
+ export const ModuleDescriptionSchema = asSchema('network.xyo.module.description', true)
6
6
  export type ModuleDescriptionSchema = typeof ModuleDescriptionSchema
7
7
 
8
8
  export type ModuleDescriptionPayload = Payload<ModuleDescription, ModuleDescriptionSchema>
@@ -1,6 +1,8 @@
1
1
  import { AsObjectFactory } from '@xylabs/sdk-js'
2
2
  import type { Payload, WithSources } from '@xyo-network/payload-model'
3
- import { isPayloadOfSchemaType, isPayloadOfSchemaTypeWithSources } from '@xyo-network/payload-model'
3
+ import {
4
+ asSchema, isPayloadOfSchemaType, isPayloadOfSchemaTypeWithSources,
5
+ } from '@xyo-network/payload-model'
4
6
 
5
7
  export interface StateDictionary {
6
8
  [key: string]: string | number
@@ -9,7 +11,7 @@ export interface State<T extends StateDictionary = StateDictionary> {
9
11
  state: T
10
12
  }
11
13
 
12
- export const ModuleStateSchema = 'network.xyo.module.state' as const
14
+ export const ModuleStateSchema = asSchema('network.xyo.module.state', true)
13
15
  export type ModuleStateSchema = typeof ModuleStateSchema
14
16
 
15
17
  export type ModuleState<T extends StateDictionary = StateDictionary> = Payload<State<T>, ModuleStateSchema>
@@ -1,6 +1,6 @@
1
- import type { Query } from '@xyo-network/payload-model'
1
+ import { asSchema, type Query } from '@xyo-network/payload-model'
2
2
 
3
- export const ModuleManifestQuerySchema = 'network.xyo.query.module.manifest' as const
3
+ export const ModuleManifestQuerySchema = asSchema('network.xyo.query.module.manifest', true)
4
4
  export type ModuleManifestQuerySchema = typeof ModuleManifestQuerySchema
5
5
 
6
6
  export type ModuleManifestQuery = Query<{
@@ -1,6 +1,6 @@
1
- import type { Query } from '@xyo-network/payload-model'
1
+ import { asSchema, type Query } from '@xyo-network/payload-model'
2
2
 
3
- export const ModuleAddressQuerySchema = 'network.xyo.query.module.address' as const
3
+ export const ModuleAddressQuerySchema = asSchema('network.xyo.query.module.address', true)
4
4
  export type ModuleAddressQuerySchema = typeof ModuleAddressQuerySchema
5
5
 
6
6
  export type ModuleAddressQuery = Query<{
@@ -1,6 +1,6 @@
1
- import type { Query } from '@xyo-network/payload-model'
1
+ import { asSchema, type Query } from '@xyo-network/payload-model'
2
2
 
3
- export const ModuleStateQuerySchema = 'network.xyo.query.module.state' as const
3
+ export const ModuleStateQuerySchema = asSchema('network.xyo.query.module.state', true)
4
4
  export type ModuleStateQuerySchema = typeof ModuleStateQuerySchema
5
5
 
6
6
  export type ModuleStateQuery = Query<void, ModuleStateQuerySchema>
@@ -1,7 +1,7 @@
1
1
  import type { Address } from '@xylabs/sdk-js'
2
- import type { Query } from '@xyo-network/payload-model'
2
+ import { asSchema, type Query } from '@xyo-network/payload-model'
3
3
 
4
- export const ModuleSubscribeQuerySchema = 'network.xyo.query.module.subscribe' as const
4
+ export const ModuleSubscribeQuerySchema = asSchema('network.xyo.query.module.subscribe', true)
5
5
  export type ModuleSubscribeQuerySchema = typeof ModuleSubscribeQuerySchema
6
6
 
7
7
  export interface ModuleSubscribeFilter {