@xyo-network/module-model 2.98.2 → 2.98.3

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 (35) hide show
  1. package/dist/browser/CreatableModule/index.d.cts +0 -1
  2. package/dist/browser/CreatableModule/index.d.cts.map +1 -1
  3. package/dist/browser/CreatableModule/index.d.mts +0 -1
  4. package/dist/browser/CreatableModule/index.d.mts.map +1 -1
  5. package/dist/browser/CreatableModule/index.d.ts +0 -1
  6. package/dist/browser/CreatableModule/index.d.ts.map +1 -1
  7. package/dist/browser/index.cjs +15 -101
  8. package/dist/browser/index.cjs.map +1 -1
  9. package/dist/browser/index.js +15 -101
  10. package/dist/browser/index.js.map +1 -1
  11. package/dist/node/CreatableModule/index.d.cts +0 -1
  12. package/dist/node/CreatableModule/index.d.cts.map +1 -1
  13. package/dist/node/CreatableModule/index.d.mts +0 -1
  14. package/dist/node/CreatableModule/index.d.mts.map +1 -1
  15. package/dist/node/CreatableModule/index.d.ts +0 -1
  16. package/dist/node/CreatableModule/index.d.ts.map +1 -1
  17. package/dist/node/index.cjs +15 -102
  18. package/dist/node/index.cjs.map +1 -1
  19. package/dist/node/index.js +15 -101
  20. package/dist/node/index.js.map +1 -1
  21. package/package.json +7 -7
  22. package/src/CreatableModule/index.ts +0 -1
  23. package/dist/browser/CreatableModule/ModuleFactoryLocator.d.cts +0 -47
  24. package/dist/browser/CreatableModule/ModuleFactoryLocator.d.cts.map +0 -1
  25. package/dist/browser/CreatableModule/ModuleFactoryLocator.d.mts +0 -47
  26. package/dist/browser/CreatableModule/ModuleFactoryLocator.d.mts.map +0 -1
  27. package/dist/browser/CreatableModule/ModuleFactoryLocator.d.ts +0 -47
  28. package/dist/browser/CreatableModule/ModuleFactoryLocator.d.ts.map +0 -1
  29. package/dist/node/CreatableModule/ModuleFactoryLocator.d.cts +0 -47
  30. package/dist/node/CreatableModule/ModuleFactoryLocator.d.cts.map +0 -1
  31. package/dist/node/CreatableModule/ModuleFactoryLocator.d.mts +0 -47
  32. package/dist/node/CreatableModule/ModuleFactoryLocator.d.mts.map +0 -1
  33. package/dist/node/CreatableModule/ModuleFactoryLocator.d.ts +0 -47
  34. package/dist/node/CreatableModule/ModuleFactoryLocator.d.ts.map +0 -1
  35. package/src/CreatableModule/ModuleFactoryLocator.ts +0 -96
@@ -1 +0,0 @@
1
- {"version":3,"file":"ModuleFactoryLocator.d.ts","sourceRoot":"","sources":["../../../src/CreatableModule/ModuleFactoryLocator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAEnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AACtD,OAAO,EAAgB,MAAM,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AACnE,OAAO,EAAa,6BAA6B,EAAE,MAAM,iCAAiC,CAAA;AAE1F;;GAEG;AACH,qBAAa,oBAAoB;IACnB,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,uBAAuB;gBAAlC,SAAS,GAAE,uBAA4B;IAEtE;;OAEG;IACH,IAAI,QAAQ,IAAI,QAAQ,CAAC,uBAAuB,CAAC,CAEhD;IAED;;;;;OAKG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,sBAAsB,GAAG,6BAA6B;IAO/F;;;OAGG;IACH,QAAQ,CAAC,GAAG,EAAE,sBAAsB,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;IAQ5D;;;OAGG;IACH,YAAY,CAAC,IAAI,EAAE,sBAAsB,EAAE,GAAG,IAAI;IAOlD;;;OAGG;IACH,WAAW,CAAC,OAAO,SAAS,wBAAwB,EAClD,GAAG,EAAE,sBAAsB,CAAC,OAAO,CAAC,EACpC,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,UAAQ,GACd,IAAI;IAcP;;;;;OAKG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,sBAAsB,GAAG,6BAA6B,GAAG,SAAS;CAQ/G"}
@@ -1,47 +0,0 @@
1
- import { Schema } from '@xyo-network/payload-model';
2
- import { AttachableModuleInstance } from '../instance';
3
- import { Labels } from '../Labels';
4
- import { CreatableModuleFactory } from './CreatableModule';
5
- import { CreatableModuleRegistry } from './CreatableModuleRegistry';
6
- import { LabeledCreatableModuleFactory } from './LabeledCreatableModuleFactory';
7
- /**
8
- * A class which encapsulates the Service Locator Pattern for Module Factories
9
- */
10
- export declare class ModuleFactoryLocator {
11
- protected readonly _registry: CreatableModuleRegistry;
12
- constructor(_registry?: CreatableModuleRegistry);
13
- /**
14
- * The current registry for the module factory
15
- */
16
- get registry(): Readonly<CreatableModuleRegistry>;
17
- /**
18
- * Locates a module factory that matches the supplied schema and labels
19
- * @param schema The config schema for the module
20
- * @param labels The labels for the module factory
21
- * @returns A module factory that matches the supplied schema and labels or throws if one is not found
22
- */
23
- locate(schema: string, labels?: Labels): CreatableModuleFactory | LabeledCreatableModuleFactory;
24
- /**
25
- * Registers a single module factory (with optional tags) with the locator
26
- * @param additional Additional module factories to register
27
- */
28
- register(mod: CreatableModuleFactory, labels?: Labels): this;
29
- /**
30
- * Registers multiple module factories with the locator
31
- * @param additional Additional module factories to register
32
- */
33
- registerMany(mods: CreatableModuleFactory[]): this;
34
- /**
35
- * Registers a single module factory (with optional tags) with the locator & a specific schema
36
- * @param additional Additional module factories to register
37
- */
38
- registerOne<TModule extends AttachableModuleInstance>(mod: CreatableModuleFactory<TModule>, schema: Schema, labels?: Labels, primary?: boolean): this;
39
- /**
40
- * Tries to locate a module factory that matches the supplied schema and labels
41
- * @param schema The config schema for the module
42
- * @param labels The labels for the module factory
43
- * @returns A module factory that matches the supplied schema and labels or undefined
44
- */
45
- tryLocate(schema: string, labels?: Labels): CreatableModuleFactory | LabeledCreatableModuleFactory | undefined;
46
- }
47
- //# sourceMappingURL=ModuleFactoryLocator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ModuleFactoryLocator.d.ts","sourceRoot":"","sources":["../../../src/CreatableModule/ModuleFactoryLocator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAEnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AACtD,OAAO,EAAgB,MAAM,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AACnE,OAAO,EAAa,6BAA6B,EAAE,MAAM,iCAAiC,CAAA;AAE1F;;GAEG;AACH,qBAAa,oBAAoB;IACnB,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,uBAAuB;gBAAlC,SAAS,GAAE,uBAA4B;IAEtE;;OAEG;IACH,IAAI,QAAQ,IAAI,QAAQ,CAAC,uBAAuB,CAAC,CAEhD;IAED;;;;;OAKG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,sBAAsB,GAAG,6BAA6B;IAO/F;;;OAGG;IACH,QAAQ,CAAC,GAAG,EAAE,sBAAsB,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;IAQ5D;;;OAGG;IACH,YAAY,CAAC,IAAI,EAAE,sBAAsB,EAAE,GAAG,IAAI;IAOlD;;;OAGG;IACH,WAAW,CAAC,OAAO,SAAS,wBAAwB,EAClD,GAAG,EAAE,sBAAsB,CAAC,OAAO,CAAC,EACpC,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,UAAQ,GACd,IAAI;IAcP;;;;;OAKG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,sBAAsB,GAAG,6BAA6B,GAAG,SAAS;CAQ/G"}
@@ -1,47 +0,0 @@
1
- import { Schema } from '@xyo-network/payload-model';
2
- import { AttachableModuleInstance } from '../instance';
3
- import { Labels } from '../Labels';
4
- import { CreatableModuleFactory } from './CreatableModule';
5
- import { CreatableModuleRegistry } from './CreatableModuleRegistry';
6
- import { LabeledCreatableModuleFactory } from './LabeledCreatableModuleFactory';
7
- /**
8
- * A class which encapsulates the Service Locator Pattern for Module Factories
9
- */
10
- export declare class ModuleFactoryLocator {
11
- protected readonly _registry: CreatableModuleRegistry;
12
- constructor(_registry?: CreatableModuleRegistry);
13
- /**
14
- * The current registry for the module factory
15
- */
16
- get registry(): Readonly<CreatableModuleRegistry>;
17
- /**
18
- * Locates a module factory that matches the supplied schema and labels
19
- * @param schema The config schema for the module
20
- * @param labels The labels for the module factory
21
- * @returns A module factory that matches the supplied schema and labels or throws if one is not found
22
- */
23
- locate(schema: string, labels?: Labels): CreatableModuleFactory | LabeledCreatableModuleFactory;
24
- /**
25
- * Registers a single module factory (with optional tags) with the locator
26
- * @param additional Additional module factories to register
27
- */
28
- register(mod: CreatableModuleFactory, labels?: Labels): this;
29
- /**
30
- * Registers multiple module factories with the locator
31
- * @param additional Additional module factories to register
32
- */
33
- registerMany(mods: CreatableModuleFactory[]): this;
34
- /**
35
- * Registers a single module factory (with optional tags) with the locator & a specific schema
36
- * @param additional Additional module factories to register
37
- */
38
- registerOne<TModule extends AttachableModuleInstance>(mod: CreatableModuleFactory<TModule>, schema: Schema, labels?: Labels, primary?: boolean): this;
39
- /**
40
- * Tries to locate a module factory that matches the supplied schema and labels
41
- * @param schema The config schema for the module
42
- * @param labels The labels for the module factory
43
- * @returns A module factory that matches the supplied schema and labels or undefined
44
- */
45
- tryLocate(schema: string, labels?: Labels): CreatableModuleFactory | LabeledCreatableModuleFactory | undefined;
46
- }
47
- //# sourceMappingURL=ModuleFactoryLocator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ModuleFactoryLocator.d.ts","sourceRoot":"","sources":["../../../src/CreatableModule/ModuleFactoryLocator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAEnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AACtD,OAAO,EAAgB,MAAM,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AACnE,OAAO,EAAa,6BAA6B,EAAE,MAAM,iCAAiC,CAAA;AAE1F;;GAEG;AACH,qBAAa,oBAAoB;IACnB,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,uBAAuB;gBAAlC,SAAS,GAAE,uBAA4B;IAEtE;;OAEG;IACH,IAAI,QAAQ,IAAI,QAAQ,CAAC,uBAAuB,CAAC,CAEhD;IAED;;;;;OAKG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,sBAAsB,GAAG,6BAA6B;IAO/F;;;OAGG;IACH,QAAQ,CAAC,GAAG,EAAE,sBAAsB,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;IAQ5D;;;OAGG;IACH,YAAY,CAAC,IAAI,EAAE,sBAAsB,EAAE,GAAG,IAAI;IAOlD;;;OAGG;IACH,WAAW,CAAC,OAAO,SAAS,wBAAwB,EAClD,GAAG,EAAE,sBAAsB,CAAC,OAAO,CAAC,EACpC,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,UAAQ,GACd,IAAI;IAcP;;;;;OAKG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,sBAAsB,GAAG,6BAA6B,GAAG,SAAS;CAQ/G"}
@@ -1,47 +0,0 @@
1
- import { Schema } from '@xyo-network/payload-model';
2
- import { AttachableModuleInstance } from '../instance';
3
- import { Labels } from '../Labels';
4
- import { CreatableModuleFactory } from './CreatableModule';
5
- import { CreatableModuleRegistry } from './CreatableModuleRegistry';
6
- import { LabeledCreatableModuleFactory } from './LabeledCreatableModuleFactory';
7
- /**
8
- * A class which encapsulates the Service Locator Pattern for Module Factories
9
- */
10
- export declare class ModuleFactoryLocator {
11
- protected readonly _registry: CreatableModuleRegistry;
12
- constructor(_registry?: CreatableModuleRegistry);
13
- /**
14
- * The current registry for the module factory
15
- */
16
- get registry(): Readonly<CreatableModuleRegistry>;
17
- /**
18
- * Locates a module factory that matches the supplied schema and labels
19
- * @param schema The config schema for the module
20
- * @param labels The labels for the module factory
21
- * @returns A module factory that matches the supplied schema and labels or throws if one is not found
22
- */
23
- locate(schema: string, labels?: Labels): CreatableModuleFactory | LabeledCreatableModuleFactory;
24
- /**
25
- * Registers a single module factory (with optional tags) with the locator
26
- * @param additional Additional module factories to register
27
- */
28
- register(mod: CreatableModuleFactory, labels?: Labels): this;
29
- /**
30
- * Registers multiple module factories with the locator
31
- * @param additional Additional module factories to register
32
- */
33
- registerMany(mods: CreatableModuleFactory[]): this;
34
- /**
35
- * Registers a single module factory (with optional tags) with the locator & a specific schema
36
- * @param additional Additional module factories to register
37
- */
38
- registerOne<TModule extends AttachableModuleInstance>(mod: CreatableModuleFactory<TModule>, schema: Schema, labels?: Labels, primary?: boolean): this;
39
- /**
40
- * Tries to locate a module factory that matches the supplied schema and labels
41
- * @param schema The config schema for the module
42
- * @param labels The labels for the module factory
43
- * @returns A module factory that matches the supplied schema and labels or undefined
44
- */
45
- tryLocate(schema: string, labels?: Labels): CreatableModuleFactory | LabeledCreatableModuleFactory | undefined;
46
- }
47
- //# sourceMappingURL=ModuleFactoryLocator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ModuleFactoryLocator.d.ts","sourceRoot":"","sources":["../../../src/CreatableModule/ModuleFactoryLocator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAEnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AACtD,OAAO,EAAgB,MAAM,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AACnE,OAAO,EAAa,6BAA6B,EAAE,MAAM,iCAAiC,CAAA;AAE1F;;GAEG;AACH,qBAAa,oBAAoB;IACnB,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,uBAAuB;gBAAlC,SAAS,GAAE,uBAA4B;IAEtE;;OAEG;IACH,IAAI,QAAQ,IAAI,QAAQ,CAAC,uBAAuB,CAAC,CAEhD;IAED;;;;;OAKG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,sBAAsB,GAAG,6BAA6B;IAO/F;;;OAGG;IACH,QAAQ,CAAC,GAAG,EAAE,sBAAsB,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;IAQ5D;;;OAGG;IACH,YAAY,CAAC,IAAI,EAAE,sBAAsB,EAAE,GAAG,IAAI;IAOlD;;;OAGG;IACH,WAAW,CAAC,OAAO,SAAS,wBAAwB,EAClD,GAAG,EAAE,sBAAsB,CAAC,OAAO,CAAC,EACpC,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,UAAQ,GACd,IAAI;IAcP;;;;;OAKG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,sBAAsB,GAAG,6BAA6B,GAAG,SAAS;CAQ/G"}
@@ -1,47 +0,0 @@
1
- import { Schema } from '@xyo-network/payload-model';
2
- import { AttachableModuleInstance } from '../instance';
3
- import { Labels } from '../Labels';
4
- import { CreatableModuleFactory } from './CreatableModule';
5
- import { CreatableModuleRegistry } from './CreatableModuleRegistry';
6
- import { LabeledCreatableModuleFactory } from './LabeledCreatableModuleFactory';
7
- /**
8
- * A class which encapsulates the Service Locator Pattern for Module Factories
9
- */
10
- export declare class ModuleFactoryLocator {
11
- protected readonly _registry: CreatableModuleRegistry;
12
- constructor(_registry?: CreatableModuleRegistry);
13
- /**
14
- * The current registry for the module factory
15
- */
16
- get registry(): Readonly<CreatableModuleRegistry>;
17
- /**
18
- * Locates a module factory that matches the supplied schema and labels
19
- * @param schema The config schema for the module
20
- * @param labels The labels for the module factory
21
- * @returns A module factory that matches the supplied schema and labels or throws if one is not found
22
- */
23
- locate(schema: string, labels?: Labels): CreatableModuleFactory | LabeledCreatableModuleFactory;
24
- /**
25
- * Registers a single module factory (with optional tags) with the locator
26
- * @param additional Additional module factories to register
27
- */
28
- register(mod: CreatableModuleFactory, labels?: Labels): this;
29
- /**
30
- * Registers multiple module factories with the locator
31
- * @param additional Additional module factories to register
32
- */
33
- registerMany(mods: CreatableModuleFactory[]): this;
34
- /**
35
- * Registers a single module factory (with optional tags) with the locator & a specific schema
36
- * @param additional Additional module factories to register
37
- */
38
- registerOne<TModule extends AttachableModuleInstance>(mod: CreatableModuleFactory<TModule>, schema: Schema, labels?: Labels, primary?: boolean): this;
39
- /**
40
- * Tries to locate a module factory that matches the supplied schema and labels
41
- * @param schema The config schema for the module
42
- * @param labels The labels for the module factory
43
- * @returns A module factory that matches the supplied schema and labels or undefined
44
- */
45
- tryLocate(schema: string, labels?: Labels): CreatableModuleFactory | LabeledCreatableModuleFactory | undefined;
46
- }
47
- //# sourceMappingURL=ModuleFactoryLocator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ModuleFactoryLocator.d.ts","sourceRoot":"","sources":["../../../src/CreatableModule/ModuleFactoryLocator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAEnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AACtD,OAAO,EAAgB,MAAM,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AACnE,OAAO,EAAa,6BAA6B,EAAE,MAAM,iCAAiC,CAAA;AAE1F;;GAEG;AACH,qBAAa,oBAAoB;IACnB,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,uBAAuB;gBAAlC,SAAS,GAAE,uBAA4B;IAEtE;;OAEG;IACH,IAAI,QAAQ,IAAI,QAAQ,CAAC,uBAAuB,CAAC,CAEhD;IAED;;;;;OAKG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,sBAAsB,GAAG,6BAA6B;IAO/F;;;OAGG;IACH,QAAQ,CAAC,GAAG,EAAE,sBAAsB,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;IAQ5D;;;OAGG;IACH,YAAY,CAAC,IAAI,EAAE,sBAAsB,EAAE,GAAG,IAAI;IAOlD;;;OAGG;IACH,WAAW,CAAC,OAAO,SAAS,wBAAwB,EAClD,GAAG,EAAE,sBAAsB,CAAC,OAAO,CAAC,EACpC,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,UAAQ,GACd,IAAI;IAcP;;;;;OAKG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,sBAAsB,GAAG,6BAA6B,GAAG,SAAS;CAQ/G"}
@@ -1,47 +0,0 @@
1
- import { Schema } from '@xyo-network/payload-model';
2
- import { AttachableModuleInstance } from '../instance';
3
- import { Labels } from '../Labels';
4
- import { CreatableModuleFactory } from './CreatableModule';
5
- import { CreatableModuleRegistry } from './CreatableModuleRegistry';
6
- import { LabeledCreatableModuleFactory } from './LabeledCreatableModuleFactory';
7
- /**
8
- * A class which encapsulates the Service Locator Pattern for Module Factories
9
- */
10
- export declare class ModuleFactoryLocator {
11
- protected readonly _registry: CreatableModuleRegistry;
12
- constructor(_registry?: CreatableModuleRegistry);
13
- /**
14
- * The current registry for the module factory
15
- */
16
- get registry(): Readonly<CreatableModuleRegistry>;
17
- /**
18
- * Locates a module factory that matches the supplied schema and labels
19
- * @param schema The config schema for the module
20
- * @param labels The labels for the module factory
21
- * @returns A module factory that matches the supplied schema and labels or throws if one is not found
22
- */
23
- locate(schema: string, labels?: Labels): CreatableModuleFactory | LabeledCreatableModuleFactory;
24
- /**
25
- * Registers a single module factory (with optional tags) with the locator
26
- * @param additional Additional module factories to register
27
- */
28
- register(mod: CreatableModuleFactory, labels?: Labels): this;
29
- /**
30
- * Registers multiple module factories with the locator
31
- * @param additional Additional module factories to register
32
- */
33
- registerMany(mods: CreatableModuleFactory[]): this;
34
- /**
35
- * Registers a single module factory (with optional tags) with the locator & a specific schema
36
- * @param additional Additional module factories to register
37
- */
38
- registerOne<TModule extends AttachableModuleInstance>(mod: CreatableModuleFactory<TModule>, schema: Schema, labels?: Labels, primary?: boolean): this;
39
- /**
40
- * Tries to locate a module factory that matches the supplied schema and labels
41
- * @param schema The config schema for the module
42
- * @param labels The labels for the module factory
43
- * @returns A module factory that matches the supplied schema and labels or undefined
44
- */
45
- tryLocate(schema: string, labels?: Labels): CreatableModuleFactory | LabeledCreatableModuleFactory | undefined;
46
- }
47
- //# sourceMappingURL=ModuleFactoryLocator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ModuleFactoryLocator.d.ts","sourceRoot":"","sources":["../../../src/CreatableModule/ModuleFactoryLocator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAEnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AACtD,OAAO,EAAgB,MAAM,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AACnE,OAAO,EAAa,6BAA6B,EAAE,MAAM,iCAAiC,CAAA;AAE1F;;GAEG;AACH,qBAAa,oBAAoB;IACnB,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,uBAAuB;gBAAlC,SAAS,GAAE,uBAA4B;IAEtE;;OAEG;IACH,IAAI,QAAQ,IAAI,QAAQ,CAAC,uBAAuB,CAAC,CAEhD;IAED;;;;;OAKG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,sBAAsB,GAAG,6BAA6B;IAO/F;;;OAGG;IACH,QAAQ,CAAC,GAAG,EAAE,sBAAsB,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;IAQ5D;;;OAGG;IACH,YAAY,CAAC,IAAI,EAAE,sBAAsB,EAAE,GAAG,IAAI;IAOlD;;;OAGG;IACH,WAAW,CAAC,OAAO,SAAS,wBAAwB,EAClD,GAAG,EAAE,sBAAsB,CAAC,OAAO,CAAC,EACpC,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,UAAQ,GACd,IAAI;IAcP;;;;;OAKG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,sBAAsB,GAAG,6BAA6B,GAAG,SAAS;CAQ/G"}
@@ -1,96 +0,0 @@
1
- import { assertEx } from '@xylabs/assert'
2
- import { Schema } from '@xyo-network/payload-model'
3
-
4
- import { AttachableModuleInstance } from '../instance'
5
- import { hasAllLabels, Labels } from '../Labels'
6
- import { CreatableModuleFactory } from './CreatableModule'
7
- import { CreatableModuleRegistry } from './CreatableModuleRegistry'
8
- import { hasLabels, LabeledCreatableModuleFactory } from './LabeledCreatableModuleFactory'
9
-
10
- /**
11
- * A class which encapsulates the Service Locator Pattern for Module Factories
12
- */
13
- export class ModuleFactoryLocator {
14
- constructor(protected readonly _registry: CreatableModuleRegistry = {}) {}
15
-
16
- /**
17
- * The current registry for the module factory
18
- */
19
- get registry(): Readonly<CreatableModuleRegistry> {
20
- return this._registry
21
- }
22
-
23
- /**
24
- * Locates a module factory that matches the supplied schema and labels
25
- * @param schema The config schema for the module
26
- * @param labels The labels for the module factory
27
- * @returns A module factory that matches the supplied schema and labels or throws if one is not found
28
- */
29
- locate(schema: string, labels?: Labels): CreatableModuleFactory | LabeledCreatableModuleFactory {
30
- return assertEx(
31
- this.tryLocate(schema, labels),
32
- () => `No module factory for the supplied ${`config schema [${schema}]`}${labels ? ` & labels [${JSON.stringify(labels)}]` : ''} registered`,
33
- )
34
- }
35
-
36
- /**
37
- * Registers a single module factory (with optional tags) with the locator
38
- * @param additional Additional module factories to register
39
- */
40
- register(mod: CreatableModuleFactory, labels?: Labels): this {
41
- this.registerOne(mod, mod.defaultConfigSchema, labels, true)
42
- mod.configSchemas.map((schema) => {
43
- this.registerOne(mod, schema, labels, false)
44
- })
45
- return this
46
- }
47
-
48
- /**
49
- * Registers multiple module factories with the locator
50
- * @param additional Additional module factories to register
51
- */
52
- registerMany(mods: CreatableModuleFactory[]): this {
53
- for (const mod of mods) {
54
- this.register(mod)
55
- }
56
- return this
57
- }
58
-
59
- /**
60
- * Registers a single module factory (with optional tags) with the locator & a specific schema
61
- * @param additional Additional module factories to register
62
- */
63
- registerOne<TModule extends AttachableModuleInstance>(
64
- mod: CreatableModuleFactory<TModule>,
65
- schema: Schema,
66
- labels?: Labels,
67
- primary = false,
68
- ): this {
69
- const existingFactories = this._registry[schema]
70
- const factory: LabeledCreatableModuleFactory<TModule> = {
71
- // Destructure instance properties
72
- ...mod,
73
- // Copy static methods
74
- create: mod.create.bind(mod) as LabeledCreatableModuleFactory<TModule>['create'],
75
- // Merge module & supplied labels
76
- labels: Object.assign({}, (mod as LabeledCreatableModuleFactory).labels ?? {}, labels ?? {}),
77
- }
78
- this._registry[schema] = primary ? [factory, ...(existingFactories ?? [])] : [...(existingFactories ?? []), factory]
79
- return this
80
- }
81
-
82
- /**
83
- * Tries to locate a module factory that matches the supplied schema and labels
84
- * @param schema The config schema for the module
85
- * @param labels The labels for the module factory
86
- * @returns A module factory that matches the supplied schema and labels or undefined
87
- */
88
- tryLocate(schema: string, labels?: Labels): CreatableModuleFactory | LabeledCreatableModuleFactory | undefined {
89
- // If labels were provided
90
- return labels ?
91
- // Find the first factory that has labels and has all the labels provided
92
- this._registry[schema]?.filter(hasLabels).find((factory) => hasAllLabels(factory?.labels, labels))
93
- : // Otherwise, return the first factory
94
- this._registry[schema]?.[0]
95
- }
96
- }