@unchainedshop/utils 2.13.0 → 3.0.0-alpha2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"build-obfuscated-fields-filter.d.ts","sourceRoot":"","sources":["../src/build-obfuscated-fields-filter.ts"],"names":[],"mappings":"AAYA,QAAA,MAAM,2BAA2B,0BAA0B,MAAM,EAAE,uBA2BlE,CAAC;AAEF,eAAe,2BAA2B,CAAC"}
1
+ {"version":3,"file":"build-obfuscated-fields-filter.d.ts","sourceRoot":"","sources":["../src/build-obfuscated-fields-filter.ts"],"names":[],"mappings":"AAWA,QAAA,MAAM,2BAA2B,0BAA0B,MAAM,EAAE,uBA2BlE,CAAC;AAEF,eAAe,2BAA2B,CAAC"}
@@ -1,8 +1,7 @@
1
1
  const defaultObfuscatedFields = [
2
2
  'password',
3
- 'plainPassword',
4
- 'newPlainPassword',
5
- 'oldPlainPassword',
3
+ 'newPassword',
4
+ 'oldPassword',
6
5
  'authorization',
7
6
  'secret',
8
7
  'accesskey',
@@ -1 +1 @@
1
- {"version":3,"file":"build-obfuscated-fields-filter.js","sourceRoot":"","sources":["../src/build-obfuscated-fields-filter.ts"],"names":[],"mappings":"AAAA,MAAM,uBAAuB,GAAG;IAC9B,UAAU;IACV,eAAe;IACf,kBAAkB;IAClB,kBAAkB;IAClB,eAAe;IACf,QAAQ;IACR,WAAW;IACX,aAAa;IACb,OAAO;CACR,CAAC;AAEF,MAAM,2BAA2B,GAAG,CAAC,uBAAiC,EAAE,EAAE,EAAE;IAC1E,MAAM,eAAe,GAAG,oBAAoB,IAAI,uBAAuB,CAAC;IAExE,MAAM,wBAAwB,GAAG,CAAC,IAAI,EAAE,EAAE;QACxC,IAAI,CAAC,IAAI;YAAE,OAAO,IAAI,CAAC;QAEvB,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YACxB,OAAO,IAAI,CAAC,GAAG,CAA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AI,EAAE,EAAE,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC,CAAC;QAC5D,CAAC;QAED,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC7B,MAAM,IAAI,GAAG,IAAI,CAAC;YAClB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;gBAChC,IAAI,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;oBAClC,IAAI,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC;gBACvB,CAAC;qBAAM,CAAC;oBACN,IAAI,CAAC,GAAG,CAAC,GAAG,wBAAwB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;gBAClD,CAAC;YACH,CAAC,CAAC,CAAC;YAEH,OAAO,IAAI,CAAC,CAAC,2BAA2B;QAC1C,CAAC;QAED,OAAO,IAAI,CAAC,CAAC,wCAAwC;IACvD,CAAC,CAAC;IAEF,OAAO,wBAAwB,CAAC;AAClC,CAAC,CAAC;AAEF,eAAe,2BAA2B,CAAC"}
@@ -4,8 +4,4 @@ export declare const systemLocale: LocaleType;
4
4
  export declare const resolveBestSupported: (acceptLanguage: string, supportedLocales: LocalesType) => LocaleType;
5
5
  export declare const resolveBestCountry: (localeCountry: any, shopCountry: any, countries: any) => any;
6
6
  export declare const resolveBestCurrency: (localeCurrency: any, currencies: Array<Currency>) => string;
7
- export declare const resolveUserRemoteAddress: (req: any) => {
8
- remoteAddress: any;
9
- remotePort: any;
10
- };
11
7
  //# sourceMappingURL=locale-helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"locale-helpers.d.ts","sourceRoot":"","sources":["../src/locale-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAC9D,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,QAAQ,CAAC;AAO3E,eAAO,MAAM,YAAY,YAAuD,CAAC;AAEjF,eAAO,MAAM,oBAAoB,mBACf,MAAM,oBACJ,WAAW,KAC5B,UAKF,CAAC;AAEF,eAAO,MAAM,kBAAkB,+DAa9B,CAAC;AAEF,eAAO,MAAM,mBAAmB,oCAAgC,KAAK,CAAC,QAAQ,CAAC,WAc9E,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;CAYpC,CAAC"}
1
+ {"version":3,"file":"locale-helpers.d.ts","sourceRoot":"","sources":["../src/locale-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAC9D,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,QAAQ,CAAC;AAO3E,eAAO,MAAM,YAAY,YAAuD,CAAC;AAEjF,eAAO,MAAM,oBAAoB,mBACf,MAAM,oBACJ,WAAW,KAC5B,UAKF,CAAC;AAEF,eAAO,MAAM,kBAAkB,+DAa9B,CAAC;AAEF,eAAO,MAAM,mBAAmB,oCAAgC,KAAK,CAAC,QAAQ,CAAC,WAc9E,CAAC"}
@@ -36,13 +36,4 @@ export const resolveBestCurrency = (localeCurrency, currencies) => {
36
36
  }
37
37
  return currencies?.[0]?.isoCode || UNCHAINED_CURRENCY;
38
38
  };
39
- export const resolveUserRemoteAddress = (req) => {
40
- const remoteAddress = req.headers['x-real-ip'] ||
41
- req.headers['x-forwarded-for'] ||
42
- req.connection?.remoteAddress ||
43
- req.socket?.remoteAddress ||
44
- req.connection?.socket?.remoteAddress;
45
- const remotePort = req.connection?.remotePort || req.socket?.remotePort || req.connection?.socket?.remotePort;
46
- return { remoteAddress, remotePort };
47
- };
48
39
  //# sourceMappingURL=locale-helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"locale-helpers.js","sourceRoot":"","sources":["../src/locale-helpers.ts"],"names":[],"mappings":"AAEA,OAAO,SAAS,MAAM,QAAQ,CAAC;AAE/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OAAO,gBAAgB,CAAC,OAAO,CAAC;QAClC,CAAC;IACH,CAAC;IAED,MAAM,gBAAgB,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,KAAK,kBAAkB,CAAC,CAAC;IAChG,IAAI,gBAAgB,EAAE,CAAC;QACrB,OAAO,gBAAgB,CAAC,OAAO,CAAC;IAClC,CAAC;IAED,OAAO,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,IAAI,kBAAkB,CAAC;AACxD,CAAC,CAAC"}
@@ -21,65 +21,4 @@ export { BasePricingDirector } from './director/BasePricingDirector.js';
21
21
  export { BasePricingSheet } from './director/BasePricingSheet.js';
22
22
  export { BaseDiscountAdapter } from './director/BaseDiscountAdapter.js';
23
23
  export { BaseDiscountDirector } from './director/BaseDiscountDirector.js';
24
- /*
25
-
26
- function resolveBestCountry(
27
- contextCountry: string,
28
- headerCountry: string | string[],
29
- countries: Array<Country>,
30
- ): string;
31
- function resolveUserRemoteAddress(req: IncomingMessage): {
32
- remoteAddress: string;
33
- remotePort: string;
34
- };
35
-
36
- function objectInvert(obj: Record<string, string>): Record<string, string>;
37
-
38
- const systemLocale: Locale;
39
-
40
- const Schemas: {
41
- timestampFields: TimestampFields;
42
- User: SimpleSchema;
43
- Address: SimpleSchema;
44
- Contact: SimpleSchema;
45
- };
46
-
47
- // Director
48
- const BaseAdapter: IBaseAdapter;
49
- const BaseDirector: <Adapter extends IBaseAdapter>(
50
- directorName: string,
51
- options?: {
52
- adapterSortKey?: string;
53
- adapterKeyField?: string;
54
- },
55
- ) => IBaseDirector<Adapter>;
56
-
57
- const BaseDiscountAdapter: Omit<IDiscountAdapter, 'key' | 'label' | 'version'>;
58
- const BaseDiscountDirector: (directorName: string) => IDiscountDirector;
59
-
60
- const BasePricingAdapter: <
61
- AdapterContext extends BasePricingAdapterContext,
62
- Calculation extends PricingCalculation,
63
- >() => IPricingAdapter<AdapterContext, Calculation, IPricingSheet<Calculation>>;
64
-
65
- const BasePricingDirector: <
66
- PricingContext extends BasePricingContext,
67
- AdapterPricingContext extends BasePricingAdapterContext,
68
- Calculation extends PricingCalculation,
69
- Adapter extends IPricingAdapter<AdapterPricingContext, Calculation, IPricingSheet<Calculation>>,
70
- >(
71
- directorName: string,
72
- ) => IPricingDirector<
73
- PricingContext,
74
- Calculation,
75
- AdapterPricingContext,
76
- IPricingSheet<Calculation>,
77
- Adapter
78
- >;
79
-
80
- const BasePricingSheet: <Calculation extends PricingCalculation>(
81
- params: PricingSheetParams<Calculation>,
82
- ) => IBasePricingSheet<Calculation>;
83
-
84
- */
85
24
  //# sourceMappingURL=utils-index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils-index.js","sourceRoot":"","sources":["../src/utils-index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC;AAEhD,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAE7F;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,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AAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unchainedshop/utils",
3
- "version": "2.13.0",
3
+ "version": "3.0.0-alpha2",
4
4
  "main": "lib/utils-index.js",
5
5
  "exports": {
6
6
  ".": "./lib/utils-index.js",
@@ -30,15 +30,14 @@
30
30
  },
31
31
  "homepage": "https://github.com/unchainedshop/unchained#readme",
32
32
  "dependencies": {
33
- "@unchainedshop/logger": "^2.13.0",
34
- "abort-controller": "3.0.0",
33
+ "@unchainedshop/logger": "^3.0.0-alpha2",
35
34
  "hashids": "^2.3.0",
36
35
  "locale": "0.1.0",
37
36
  "simpl-schema": "^3.4.6"
38
37
  },
39
38
  "devDependencies": {
40
39
  "@types/node": "^20.14.12",
41
- "@unchainedshop/types": "^2.13.0",
40
+ "@unchainedshop/types": "^3.0.0-alpha2",
42
41
  "jest": "^29.7.0",
43
42
  "typescript": "^5.5.4"
44
43
  }
@@ -1,8 +1,7 @@
1
1
  const defaultObfuscatedFields = [
2
2
  'password',
3
- 'plainPassword',
4
- 'newPlainPassword',
5
- 'oldPlainPassword',
3
+ 'newPassword',
4
+ 'oldPassword',
6
5
  'authorization',
7
6
  'secret',
8
7
  'accesskey',
@@ -48,17 +48,3 @@ export const resolveBestCurrency = (localeCurrency, currencies: Array<Currency>)
48
48
 
49
49
  return currencies?.[0]?.isoCode || UNCHAINED_CURRENCY;
50
50
  };
51
-
52
- export const resolveUserRemoteAddress = (req) => {
53
- const remoteAddress =
54
- req.headers['x-real-ip'] ||
55
- req.headers['x-forwarded-for'] ||
56
- req.connection?.remoteAddress ||
57
- req.socket?.remoteAddress ||
58
- req.connection?.socket?.remoteAddress;
59
-
60
- const remotePort =
61
- req.connection?.remotePort || req.socket?.remotePort || req.connection?.socket?.remotePort;
62
-
63
- return { remoteAddress, remotePort };
64
- };
@@ -1,7 +1,6 @@
1
1
  import {
2
2
  resolveBestCountry,
3
3
  resolveBestSupported,
4
- resolveUserRemoteAddress,
5
4
  slugify,
6
5
  systemLocale,
7
6
  } from '@unchainedshop/utils';
@@ -13,7 +12,6 @@ describe('Utils', () => {
13
12
  expect(systemLocale).toBeDefined();
14
13
  expect(resolveBestCountry).toBeInstanceOf(Function)
15
14
  expect(resolveBestSupported).toBeInstanceOf(Function)
16
- expect(resolveUserRemoteAddress).toBeInstanceOf(Function)
17
15
  });
18
16
 
19
17
  describe('generateHashId', () => {
@@ -26,65 +26,3 @@ export { BasePricingDirector } from './director/BasePricingDirector.js';
26
26
  export { BasePricingSheet } from './director/BasePricingSheet.js';
27
27
  export { BaseDiscountAdapter } from './director/BaseDiscountAdapter.js';
28
28
  export { BaseDiscountDirector } from './director/BaseDiscountDirector.js';
29
-
30
- /*
31
-
32
- function resolveBestCountry(
33
- contextCountry: string,
34
- headerCountry: string | string[],
35
- countries: Array<Country>,
36
- ): string;
37
- function resolveUserRemoteAddress(req: IncomingMessage): {
38
- remoteAddress: string;
39
- remotePort: string;
40
- };
41
-
42
- function objectInvert(obj: Record<string, string>): Record<string, string>;
43
-
44
- const systemLocale: Locale;
45
-
46
- const Schemas: {
47
- timestampFields: TimestampFields;
48
- User: SimpleSchema;
49
- Address: SimpleSchema;
50
- Contact: SimpleSchema;
51
- };
52
-
53
- // Director
54
- const BaseAdapter: IBaseAdapter;
55
- const BaseDirector: <Adapter extends IBaseAdapter>(
56
- directorName: string,
57
- options?: {
58
- adapterSortKey?: string;
59
- adapterKeyField?: string;
60
- },
61
- ) => IBaseDirector<Adapter>;
62
-
63
- const BaseDiscountAdapter: Omit<IDiscountAdapter, 'key' | 'label' | 'version'>;
64
- const BaseDiscountDirector: (directorName: string) => IDiscountDirector;
65
-
66
- const BasePricingAdapter: <
67
- AdapterContext extends BasePricingAdapterContext,
68
- Calculation extends PricingCalculation,
69
- >() => IPricingAdapter<AdapterContext, Calculation, IPricingSheet<Calculation>>;
70
-
71
- const BasePricingDirector: <
72
- PricingContext extends BasePricingContext,
73
- AdapterPricingContext extends BasePricingAdapterContext,
74
- Calculation extends PricingCalculation,
75
- Adapter extends IPricingAdapter<AdapterPricingContext, Calculation, IPricingSheet<Calculation>>,
76
- >(
77
- directorName: string,
78
- ) => IPricingDirector<
79
- PricingContext,
80
- Calculation,
81
- AdapterPricingContext,
82
- IPricingSheet<Calculation>,
83
- Adapter
84
- >;
85
-
86
- const BasePricingSheet: <Calculation extends PricingCalculation>(
87
- params: PricingSheetParams<Calculation>,
88
- ) => IBasePricingSheet<Calculation>;
89
-
90
- */