@unchainedshop/utils 4.7.2 → 4.8.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.
@@ -3,7 +3,6 @@ export interface IBaseAdapter {
3
3
  key: string;
4
4
  label: string;
5
5
  version: string;
6
- adapterType?: symbol;
7
6
  asString: () => string;
8
7
  log: (message: string, options?: {
9
8
  level?: LogLevel;
@@ -4,6 +4,8 @@ export interface IBaseDirector<Adapter extends IBaseAdapter> {
4
4
  adapterFilter?: (adapter: Adapter) => boolean;
5
5
  }) => Adapter[];
6
6
  getAdapter: (key: string) => Adapter | null;
7
+ registerAdapter: (A: Adapter) => void;
8
+ unregisterAdapter: (key: string) => boolean;
7
9
  }
8
10
  export declare const BaseDirector: <AdapterType extends IBaseAdapter>(directorName: string, options?: {
9
11
  adapterSortKey?: string;
@@ -11,5 +11,11 @@ export const BaseDirector = (directorName, options) => {
11
11
  .toSorted((left, right) => left[sortKey] - right[sortKey])
12
12
  .filter(adapterFilter || (() => true));
13
13
  },
14
+ registerAdapter: (Adapter) => {
15
+ Adapters.set(Adapter[keyField], Adapter);
16
+ },
17
+ unregisterAdapter: (key) => {
18
+ return Adapters.delete(key);
19
+ },
14
20
  };
15
21
  };
@@ -27,10 +27,6 @@ export interface PricingCalculation {
27
27
  amount: number;
28
28
  baseCategory?: string;
29
29
  meta?: any;
30
- discountId?: string;
31
- isTaxable?: boolean;
32
- isNetPrice?: boolean;
33
- rate?: number;
34
30
  }
35
31
  export type NodeOrTree<T> = string | Tree<T>;
36
32
  export type Tree<T> = NodeOrTree<T>[];
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": "4.7.2",
4
+ "version": "4.8.0",
5
5
  "main": "lib/utils-index.js",
6
6
  "types": "lib/utils-index.d.ts",
7
7
  "type": "module",