@unchainedshop/utils 5.0.0-alpha.5 → 5.0.0-alpha.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  # @unchainedshop/utils
5
5
 
6
- Common utility functions and base classes for the Unchained Engine.
6
+ Common utility functions and adapter/director building blocks for the Unchained Engine.
7
7
 
8
8
  ## Installation
9
9
 
@@ -70,14 +70,13 @@ Available under the `calculation` namespace:
70
70
  | `objectInvert` | Invert object keys and values |
71
71
  | `buildObfuscatedFieldsFilter` | Build filter for obfuscating sensitive fields |
72
72
 
73
- ### Director/Adapter Base Classes
73
+ ### Director/Adapter Building Blocks
74
74
 
75
75
  | Export | Description |
76
76
  |--------|-------------|
77
- | `BaseAdapter` | Base class for all adapters with logging support |
78
- | `BaseDirector` | Factory for creating adapter directors |
77
+ | `BaseAdapter` | Base object for adapter implementations with logging support |
79
78
  | `IBaseAdapter` | Interface for adapter implementations |
80
- | `IBaseDirector` | Interface for director implementations |
79
+ | `IBaseDirector` | Interface implemented by the directors in `@unchainedshop/core` (adapters come from the plugin registry) |
81
80
 
82
81
  ### Swiss-specific Helpers
83
82
 
@@ -5,7 +5,3 @@ export interface IBaseDirector<Adapter extends IBaseAdapter> {
5
5
  }) => Adapter[];
6
6
  getAdapter: (key: string) => Adapter | null;
7
7
  }
8
- export declare const BaseDirector: <AdapterType extends IBaseAdapter>(directorName: string, options?: {
9
- adapterSortKey?: string;
10
- adapterKeyField?: string;
11
- }) => IBaseDirector<AdapterType>;
@@ -1,15 +1 @@
1
- export const BaseDirector = (directorName, options) => {
2
- const Adapters = new Map();
3
- const keyField = options?.adapterKeyField || 'key';
4
- return {
5
- getAdapter: (key) => {
6
- return Adapters.get(key) || null;
7
- },
8
- getAdapters: ({ adapterFilter } = {}) => {
9
- const sortKey = options?.adapterSortKey || keyField;
10
- return Array.from(Adapters.values())
11
- .toSorted((left, right) => left[sortKey] - right[sortKey])
12
- .filter(adapterFilter || (() => true));
13
- },
14
- };
15
- };
1
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unchainedshop/utils",
3
3
  "description": "Common utility functions and base classes for the Unchained Engine",
4
- "version": "5.0.0-alpha.5",
4
+ "version": "5.0.0-alpha.8",
5
5
  "main": "lib/utils-index.js",
6
6
  "types": "lib/utils-index.d.ts",
7
7
  "type": "module",
@@ -29,7 +29,7 @@
29
29
  },
30
30
  "homepage": "https://github.com/unchainedshop/unchained#readme",
31
31
  "dependencies": {
32
- "@unchainedshop/logger": "^5.0.0-alpha.5",
32
+ "@unchainedshop/logger": "^5.0.0-alpha.8",
33
33
  "awesome-phonenumber": "^7.8.0"
34
34
  },
35
35
  "devDependencies": {