@xyo-network/module-model 2.98.1 → 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 -117
  8. package/dist/browser/index.cjs.map +1 -1
  9. package/dist/browser/index.js +15 -117
  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 -118
  18. package/dist/node/index.cjs.map +1 -1
  19. package/dist/node/index.js +15 -117
  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 -111
@@ -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<TModule extends AttachableModuleInstance>(mod: CreatableModuleFactory<TModule>, labels?: Labels): this;
29
- /**
30
- * Registers multiple module factories with the locator
31
- * @param additional Additional module factories to register
32
- */
33
- registerMany(additional: CreatableModuleRegistry): 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, overwrite?: boolean, labels?: Labels): 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;IAQ/F;;;OAGG;IACH,QAAQ,CAAC,OAAO,SAAS,wBAAwB,EAAE,GAAG,EAAE,sBAAsB,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;IAQ/G;;;OAGG;IACH,YAAY,CAAC,UAAU,EAAE,uBAAuB,GAAG,IAAI;IAUvD;;;OAGG;IACH,WAAW,CAAC,OAAO,SAAS,wBAAwB,EAClD,GAAG,EAAE,sBAAsB,CAAC,OAAO,CAAC,EACpC,MAAM,EAAE,MAAM,EACd,SAAS,UAAQ,EACjB,MAAM,CAAC,EAAE,MAAM,GACd,IAAI;IAyBP;;;;;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<TModule extends AttachableModuleInstance>(mod: CreatableModuleFactory<TModule>, labels?: Labels): this;
29
- /**
30
- * Registers multiple module factories with the locator
31
- * @param additional Additional module factories to register
32
- */
33
- registerMany(additional: CreatableModuleRegistry): 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, overwrite?: boolean, labels?: Labels): 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;IAQ/F;;;OAGG;IACH,QAAQ,CAAC,OAAO,SAAS,wBAAwB,EAAE,GAAG,EAAE,sBAAsB,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;IAQ/G;;;OAGG;IACH,YAAY,CAAC,UAAU,EAAE,uBAAuB,GAAG,IAAI;IAUvD;;;OAGG;IACH,WAAW,CAAC,OAAO,SAAS,wBAAwB,EAClD,GAAG,EAAE,sBAAsB,CAAC,OAAO,CAAC,EACpC,MAAM,EAAE,MAAM,EACd,SAAS,UAAQ,EACjB,MAAM,CAAC,EAAE,MAAM,GACd,IAAI;IAyBP;;;;;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<TModule extends AttachableModuleInstance>(mod: CreatableModuleFactory<TModule>, labels?: Labels): this;
29
- /**
30
- * Registers multiple module factories with the locator
31
- * @param additional Additional module factories to register
32
- */
33
- registerMany(additional: CreatableModuleRegistry): 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, overwrite?: boolean, labels?: Labels): 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;IAQ/F;;;OAGG;IACH,QAAQ,CAAC,OAAO,SAAS,wBAAwB,EAAE,GAAG,EAAE,sBAAsB,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;IAQ/G;;;OAGG;IACH,YAAY,CAAC,UAAU,EAAE,uBAAuB,GAAG,IAAI;IAUvD;;;OAGG;IACH,WAAW,CAAC,OAAO,SAAS,wBAAwB,EAClD,GAAG,EAAE,sBAAsB,CAAC,OAAO,CAAC,EACpC,MAAM,EAAE,MAAM,EACd,SAAS,UAAQ,EACjB,MAAM,CAAC,EAAE,MAAM,GACd,IAAI;IAyBP;;;;;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<TModule extends AttachableModuleInstance>(mod: CreatableModuleFactory<TModule>, labels?: Labels): this;
29
- /**
30
- * Registers multiple module factories with the locator
31
- * @param additional Additional module factories to register
32
- */
33
- registerMany(additional: CreatableModuleRegistry): 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, overwrite?: boolean, labels?: Labels): 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;IAQ/F;;;OAGG;IACH,QAAQ,CAAC,OAAO,SAAS,wBAAwB,EAAE,GAAG,EAAE,sBAAsB,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;IAQ/G;;;OAGG;IACH,YAAY,CAAC,UAAU,EAAE,uBAAuB,GAAG,IAAI;IAUvD;;;OAGG;IACH,WAAW,CAAC,OAAO,SAAS,wBAAwB,EAClD,GAAG,EAAE,sBAAsB,CAAC,OAAO,CAAC,EACpC,MAAM,EAAE,MAAM,EACd,SAAS,UAAQ,EACjB,MAAM,CAAC,EAAE,MAAM,GACd,IAAI;IAyBP;;;;;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<TModule extends AttachableModuleInstance>(mod: CreatableModuleFactory<TModule>, labels?: Labels): this;
29
- /**
30
- * Registers multiple module factories with the locator
31
- * @param additional Additional module factories to register
32
- */
33
- registerMany(additional: CreatableModuleRegistry): 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, overwrite?: boolean, labels?: Labels): 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=ModuleFactoryLoc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6B,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<TModule extends AttachableModuleInstance>(mod: CreatableModuleFactory<TModule>, labels?: Labels): this;
29
- /**
30
- * Registers multiple module factories with the locator
31
- * @param additional Additional module factories to register
32
- */
33
- registerMany(additional: CreatableModuleRegistry): 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, overwrite?: boolean, labels?: Labels): 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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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(this.tryLocate(schema, labels), () => {
31
- const configString = `config schema [${schema}]`
32
- const labelsString = labels ? ` & labels [${JSON.stringify(labels)}]` : ''
33
- return `No module factory for the supplied ${configString}${labelsString} registered`
34
- })
35
- }
36
-
37
- /**
38
- * Registers a single module factory (with optional tags) with the locator
39
- * @param additional Additional module factories to register
40
- */
41
- register<TModule extends AttachableModuleInstance>(mod: CreatableModuleFactory<TModule>, labels?: Labels): this {
42
- this.registerOne(mod, mod.defaultConfigSchema, true, labels)
43
- mod.configSchemas.map((schema) => {
44
- this.registerOne(mod, schema, false, labels)
45
- })
46
- return this
47
- }
48
-
49
- /**
50
- * Registers multiple module factories with the locator
51
- * @param additional Additional module factories to register
52
- */
53
- registerMany(additional: CreatableModuleRegistry): this {
54
- Object.entries(additional).map(([schema, factories]) => {
55
- if (factories) {
56
- const existingFactories = this._registry[schema]
57
- this._registry[schema] = existingFactories ? [...existingFactories, ...factories] : factories
58
- }
59
- })
60
- return this
61
- }
62
-
63
- /**
64
- * Registers a single module factory (with optional tags) with the locator & a specific schema
65
- * @param additional Additional module factories to register
66
- */
67
- registerOne<TModule extends AttachableModuleInstance>(
68
- mod: CreatableModuleFactory<TModule>,
69
- schema: Schema,
70
- overwrite = false,
71
- labels?: Labels,
72
- ): this {
73
- //if we don't want to overwrite and the factory already exists, return
74
- if (!overwrite) {
75
- const existingFactories = this._registry[schema]
76
- if (existingFactories) {
77
- const existing = existingFactories.find((factory) => (factory as LabeledCreatableModuleFactory).labels === labels)
78
- if (existing) {
79
- return this
80
- }
81
- }
82
- }
83
-
84
- const existingFactories = this._registry[schema]
85
- const factory: LabeledCreatableModuleFactory<TModule> = {
86
- // Destructure instance properties
87
- ...mod,
88
- // Copy static methods
89
- create: mod.create.bind(mod) as LabeledCreatableModuleFactory<TModule>['create'],
90
- // Merge module & supplied labels
91
- labels: Object.assign({}, (mod as LabeledCreatableModuleFactory).labels ?? {}, labels ?? {}),
92
- }
93
- this._registry[schema] = [...(existingFactories ?? []), factory]
94
- return this
95
- }
96
-
97
- /**
98
- * Tries to locate a module factory that matches the supplied schema and labels
99
- * @param schema The config schema for the module
100
- * @param labels The labels for the module factory
101
- * @returns A module factory that matches the supplied schema and labels or undefined
102
- */
103
- tryLocate(schema: string, labels?: Labels): CreatableModuleFactory | LabeledCreatableModuleFactory | undefined {
104
- // If labels were provided
105
- return labels ?
106
- // Find the first factory that has labels and has all the labels provided
107
- this._registry[schema]?.filter(hasLabels).find((factory) => hasAllLabels(factory?.labels, labels))
108
- : // Otherwise, return the first factory
109
- this._registry[schema]?.[0]
110
- }
111
- }