@unchainedshop/utils 3.0.0-alpha2 → 3.0.0-alpha4

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 (76) hide show
  1. package/lib/calculation.d.ts +1 -1
  2. package/lib/calculation.d.ts.map +1 -1
  3. package/lib/director/BaseAdapter.d.ts +10 -1
  4. package/lib/director/BaseAdapter.d.ts.map +1 -1
  5. package/lib/director/BaseAdapter.js.map +1 -1
  6. package/lib/director/BaseDirector.d.ts +9 -1
  7. package/lib/director/BaseDirector.d.ts.map +1 -1
  8. package/lib/director/BaseDirector.js.map +1 -1
  9. package/lib/director/BaseDiscountAdapter.d.ts +36 -1
  10. package/lib/director/BaseDiscountAdapter.d.ts.map +1 -1
  11. package/lib/director/BaseDiscountAdapter.js.map +1 -1
  12. package/lib/director/BaseDiscountDirector.d.ts +11 -1
  13. package/lib/director/BaseDiscountDirector.d.ts.map +1 -1
  14. package/lib/director/BaseDiscountDirector.js.map +1 -1
  15. package/lib/director/BasePricingAdapter.d.ts +45 -2
  16. package/lib/director/BasePricingAdapter.d.ts.map +1 -1
  17. package/lib/director/BasePricingAdapter.js.map +1 -1
  18. package/lib/director/BasePricingDirector.d.ts +14 -1
  19. package/lib/director/BasePricingDirector.d.ts.map +1 -1
  20. package/lib/director/BasePricingDirector.js.map +1 -1
  21. package/lib/director/BasePricingSheet.d.ts +45 -1
  22. package/lib/director/BasePricingSheet.d.ts.map +1 -1
  23. package/lib/director/BasePricingSheet.js.map +1 -1
  24. package/lib/locale-helpers.d.ts +8 -6
  25. package/lib/locale-helpers.d.ts.map +1 -1
  26. package/lib/locale-helpers.js +8 -10
  27. package/lib/locale-helpers.js.map +1 -1
  28. package/lib/object-invert.d.ts +1 -1
  29. package/lib/object-invert.d.ts.map +1 -1
  30. package/lib/object-invert.js.map +1 -1
  31. package/lib/utils-index.d.ts +17 -8
  32. package/lib/utils-index.d.ts.map +1 -1
  33. package/lib/utils-index.js +12 -8
  34. package/lib/utils-index.js.map +1 -1
  35. package/package.json +5 -7
  36. package/src/calculation.test.ts +24 -32
  37. package/src/calculation.ts +1 -1
  38. package/src/director/BaseAdapter.ts +13 -1
  39. package/src/director/BaseDirector.ts +8 -1
  40. package/src/director/BaseDiscountAdapter.ts +32 -1
  41. package/src/director/BaseDiscountDirector.ts +15 -2
  42. package/src/director/BasePricingAdapter.ts +59 -11
  43. package/src/director/BasePricingDirector.ts +36 -9
  44. package/src/director/BasePricingSheet.ts +45 -5
  45. package/src/director/base-director.test.ts +55 -66
  46. package/src/director/base-discount-adapter.test.ts +22 -25
  47. package/src/director/base-price-sheet.test.ts +50 -56
  48. package/src/locale-helpers.ts +17 -16
  49. package/src/object-invert.ts +1 -1
  50. package/src/utils-index.test.ts +47 -57
  51. package/src/utils-index.ts +20 -8
  52. package/lib/schemas/AddressSchema.d.ts +0 -3
  53. package/lib/schemas/AddressSchema.d.ts.map +0 -1
  54. package/lib/schemas/AddressSchema.js +0 -13
  55. package/lib/schemas/AddressSchema.js.map +0 -1
  56. package/lib/schemas/ContactSchema.d.ts +0 -3
  57. package/lib/schemas/ContactSchema.d.ts.map +0 -1
  58. package/lib/schemas/ContactSchema.js +0 -6
  59. package/lib/schemas/ContactSchema.js.map +0 -1
  60. package/lib/schemas/UsersSchema.d.ts +0 -5
  61. package/lib/schemas/UsersSchema.d.ts.map +0 -1
  62. package/lib/schemas/UsersSchema.js +0 -52
  63. package/lib/schemas/UsersSchema.js.map +0 -1
  64. package/lib/schemas/commonSchemaFields.d.ts +0 -35
  65. package/lib/schemas/commonSchemaFields.d.ts.map +0 -1
  66. package/lib/schemas/commonSchemaFields.js +0 -28
  67. package/lib/schemas/commonSchemaFields.js.map +0 -1
  68. package/lib/schemas/index.d.ts +0 -43
  69. package/lib/schemas/index.d.ts.map +0 -1
  70. package/lib/schemas/index.js +0 -14
  71. package/lib/schemas/index.js.map +0 -1
  72. package/src/schemas/AddressSchema.ts +0 -16
  73. package/src/schemas/ContactSchema.ts +0 -9
  74. package/src/schemas/UsersSchema.ts +0 -67
  75. package/src/schemas/commonSchemaFields.ts +0 -29
  76. package/src/schemas/index.ts +0 -18
@@ -1,15 +1,14 @@
1
- import { BaseDiscountAdapter } from "./BaseDiscountAdapter.js";
1
+ import { BaseDiscountAdapter } from './BaseDiscountAdapter.js';
2
2
 
3
- describe("BaseDiscountAdapter instantiation", () => {
3
+ describe('BaseDiscountAdapter instantiation', () => {
4
4
  const adapter = BaseDiscountAdapter;
5
- const context = null
6
- it("should initialize with default values", () => {
5
+ const context = null as any;
6
+ it('should initialize with default values', async () => {
7
7
  expect(adapter.orderIndex).toEqual(0);
8
8
  expect(adapter.log).toEqual(expect.any(Function));
9
- expect(adapter.isManualAdditionAllowed('')).resolves.toEqual(false);
10
- expect(adapter.isManualRemovalAllowed()).resolves.toEqual(false);
11
-
12
- expect(adapter.actions(context)).resolves.toEqual({
9
+ expect(await adapter.isManualAdditionAllowed('')).toEqual(false);
10
+ expect(await adapter.isManualRemovalAllowed()).toEqual(false);
11
+ expect(await adapter.actions(context)).toEqual({
13
12
  isValidForSystemTriggering: expect.any(Function),
14
13
  reserve: expect.any(Function),
15
14
  release: expect.any(Function),
@@ -18,35 +17,33 @@ describe("BaseDiscountAdapter instantiation", () => {
18
17
  });
19
18
  });
20
19
 
21
- describe('actions', ()=> {
22
- const actions = adapter.actions(context)
23
-
20
+ describe('actions', () => {
24
21
  it('isValidForSystemTriggering', async () => {
25
22
  const result = await adapter.actions(context);
26
-
27
- expect(await result.isValidForSystemTriggering()).toEqual(false)
28
- })
23
+ expect(await result.isValidForSystemTriggering()).toEqual(false);
24
+ });
29
25
 
30
26
  it('reserve', async () => {
31
27
  const result = await adapter.actions(context);
32
- expect(await result.reserve({code: ''})).toEqual({})
33
- })
28
+ expect(await result.reserve({ code: '' })).toEqual({});
29
+ });
34
30
 
35
31
  it('release', async () => {
36
32
  const result = await adapter.actions(context);
37
- expect(await result.release()).toEqual(null)
38
- })
33
+ expect(await result.release()).toEqual(null);
34
+ });
39
35
 
40
36
  it('isValidForCodeTriggering', async () => {
41
37
  const result = await adapter.actions(context);
42
- expect(await result.isValidForCodeTriggering({code: ''})).toEqual(false)
43
- })
38
+ expect(await result.isValidForCodeTriggering({ code: '' })).toEqual(false);
39
+ });
44
40
 
45
41
  it('discountForPricingAdapterKey', async () => {
46
42
  const result = await adapter.actions(context);
47
- const calculationSheet = {}
48
- expect(await result.discountForPricingAdapterKey({calculationSheet, pricingAdapterKey: 'key'} as any)).toEqual(null)
49
- })
50
-
51
- })
43
+ const calculationSheet = {};
44
+ expect(
45
+ await result.discountForPricingAdapterKey({ calculationSheet, pricingAdapterKey: 'key' } as any),
46
+ ).toEqual(null);
47
+ });
48
+ });
52
49
  });
@@ -1,4 +1,4 @@
1
- import { BasePricingSheet } from "./BasePricingSheet.js";
1
+ import { BasePricingSheet } from './BasePricingSheet.js';
2
2
 
3
3
  describe('BasePricingSheet', () => {
4
4
  let pricingSheet;
@@ -9,7 +9,7 @@ describe('BasePricingSheet', () => {
9
9
  const calculations = [TAX, DISCOUNT, ITEM1, ITEM2];
10
10
 
11
11
  beforeEach(() => {
12
- pricingSheet = BasePricingSheet({
12
+ pricingSheet = BasePricingSheet({
13
13
  calculation: calculations,
14
14
  });
15
15
  });
@@ -21,86 +21,80 @@ describe('BasePricingSheet', () => {
21
21
  it('gross() returns 0 if the calculation is empty', () => {
22
22
  expect(BasePricingSheet({ calculation: [] }).gross()).toEqual(0);
23
23
  });
24
-
25
24
 
25
+ it('total() calculates the sum of the amounts in the calculations by default', () => {
26
+ expect(pricingSheet.total()).toEqual({ amount: 550, currency: undefined });
27
+ });
26
28
 
27
- it('total() calculates the sum of the amounts in the calculations by default', () => {
28
- expect(pricingSheet.total()).toEqual({ amount: 550, currency: undefined });
29
- });
30
-
31
- it('total() calculates the sum of the amounts in the calculations for a given category', () => {
32
- expect(pricingSheet.total({ category: 'item' })).toEqual({ amount: 400, currency: undefined });
33
- });
29
+ it('total() calculates the sum of the amounts in the calculations for a given category', () => {
30
+ expect(pricingSheet.total({ category: 'item' })).toEqual({ amount: 400, currency: undefined });
31
+ });
34
32
 
35
- it('total() calculates the net sum of the amounts in the calculations if useNetPrice is true', () => {
36
- expect(pricingSheet.total({ useNetPrice: true })).toEqual({ amount: 550, currency: undefined });
37
- });
33
+ it('total() calculates the net sum of the amounts in the calculations if useNetPrice is true', () => {
34
+ expect(pricingSheet.total({ useNetPrice: true })).toEqual({ amount: 550, currency: undefined });
35
+ });
38
36
 
39
- it('total() returns 0 if the calculation is empty', () => {
40
- expect(BasePricingSheet({ calculation: [] }).total()).toEqual({ amount: 0, currency: undefined });
41
- });
42
-
43
- it('calculates the correct net amount', () => {
44
- expect(pricingSheet.net()).toEqual(550);
45
- });
37
+ it('total() returns 0 if the calculation is empty', () => {
38
+ expect(BasePricingSheet({ calculation: [] }).total()).toEqual({ amount: 0, currency: undefined });
39
+ });
46
40
 
47
- it('calculates the correct sum for a given category', () => {
48
- expect(pricingSheet.sum({ category: 'item' })).toEqual(400);
49
- });
41
+ it('calculates the correct net amount', () => {
42
+ expect(pricingSheet.net()).toEqual(550);
43
+ });
50
44
 
51
- it('calculates the correct tax amount', () => {
52
- expect(pricingSheet.taxSum()).toEqual(0);
53
- });
45
+ it('calculates the correct sum for a given category', () => {
46
+ expect(pricingSheet.sum({ category: 'item' })).toEqual(400);
47
+ });
54
48
 
55
-
49
+ it('calculates the correct tax amount', () => {
50
+ expect(pricingSheet.taxSum()).toEqual(0);
51
+ });
56
52
 
57
53
  describe('getRawPricingSheet', () => {
58
- it('returns the correct list of calculations', () => {
54
+ it('returns the correct list of calculations', () => {
59
55
  expect(pricingSheet.getRawPricingSheet()).toEqual(calculations);
60
56
  });
61
-
57
+
62
58
  it('returns an empty list of calculations if none are provided', () => {
63
59
  expect(BasePricingSheet({}).getRawPricingSheet()).toEqual([]);
64
60
  });
65
61
  });
66
-
67
62
 
68
- describe('isValid', () => {
69
- it('returns true if the sheet has calculations', () => {
70
- expect(pricingSheet.isValid()).toEqual(true);
71
- });
63
+ describe('isValid', () => {
64
+ it('returns true if the sheet has calculations', () => {
65
+ expect(pricingSheet.isValid()).toEqual(true);
66
+ });
72
67
 
73
- it('returns false if the sheet does not have calculations', () => {
74
- expect(BasePricingSheet({}).isValid()).toEqual(false);
68
+ it('returns false if the sheet does not have calculations', () => {
69
+ expect(BasePricingSheet({}).isValid()).toEqual(false);
70
+ });
75
71
  });
76
- });
77
72
 
78
- describe('filterBy', () => {
73
+ describe('filterBy', () => {
79
74
  it('filters the list of calculations correctly', () => {
80
75
  expect(pricingSheet.filterBy({ category: 'item' })).toEqual([ITEM1, ITEM2]);
81
76
  });
82
77
 
83
78
  it('returns the full list of calculations if no filter is provided', () => {
84
- expect(pricingSheet.filterBy()).toEqual(calculations);
85
- })
86
- });
87
-
88
-
79
+ expect(pricingSheet.filterBy()).toEqual(calculations);
80
+ });
81
+ });
89
82
 
90
- describe('resetCalculation', () => {
91
- it('resets the list of calculations correctly', () => {
92
- const expectedCalculations = calculations.reduce((prev,{ amount, ...row}) => {
93
- return [
83
+ describe('resetCalculation', () => {
84
+ it('resets the list of calculations correctly', () => {
85
+ const expectedCalculations = calculations.reduce(
86
+ (prev, { amount, ...row }) => {
87
+ return [
94
88
  ...prev,
95
89
  {
96
- ...row,
97
- amount: -amount
98
- }
99
- ]
100
- }, [...calculations])
101
- expect(pricingSheet.resetCalculation(pricingSheet)).toEqual(expectedCalculations);
90
+ ...row,
91
+ amount: -amount,
92
+ },
93
+ ];
94
+ },
95
+ [...calculations],
96
+ );
97
+ expect(pricingSheet.resetCalculation(pricingSheet)).toEqual(expectedCalculations);
98
+ });
102
99
  });
103
-
104
- })
105
-
106
100
  });
@@ -1,26 +1,27 @@
1
- import { Currency } from '@unchainedshop/types/currencies.js';
2
- import type { Locale as LocaleType, Locales as LocalesType } from 'locale';
3
- import localePkg from 'locale';
4
-
5
- const { Locales, Locale } = localePkg;
1
+ import { resolveAcceptLanguage } from 'resolve-accept-language';
6
2
 
7
3
  const { UNCHAINED_LANG = 'de', UNCHAINED_COUNTRY = 'CH', UNCHAINED_CURRENCY = 'CHF' } = process.env;
8
4
 
9
- export const systemLocale = new Locale(`${UNCHAINED_LANG}-${UNCHAINED_COUNTRY}`);
5
+ export const systemLocale = new Intl.Locale(`${UNCHAINED_LANG}-${UNCHAINED_COUNTRY}`);
10
6
 
11
7
  export const resolveBestSupported = (
12
8
  acceptLanguage: string,
13
- supportedLocales: LocalesType,
14
- ): LocaleType => {
15
- const acceptLocale = new Locales(acceptLanguage);
16
- const bestLocale = acceptLocale.best(supportedLocales);
17
- if (!bestLocale) return systemLocale;
18
- return bestLocale;
9
+ supportedLocales: Array<string>,
10
+ fallbackLocale: string,
11
+ ): Intl.Locale => {
12
+ const { match } = resolveAcceptLanguage(acceptLanguage || '', supportedLocales, fallbackLocale, {
13
+ returnMatchType: true,
14
+ });
15
+ return new Intl.Locale(match);
19
16
  };
20
17
 
21
- export const resolveBestCountry = (localeCountry, shopCountry, countries) => {
18
+ export const resolveBestCountry = (
19
+ localeCountry: string,
20
+ shopCountry: string,
21
+ countries: Array<{ isoCode: string }>,
22
+ ) => {
22
23
  if (shopCountry) {
23
- const resolvedCountry = countries.reduce((lastResolved, country) => {
24
+ const resolvedCountry = countries.reduce<string>((lastResolved, country) => {
24
25
  if (shopCountry === country.isoCode) {
25
26
  return country.isoCode;
26
27
  }
@@ -30,10 +31,10 @@ export const resolveBestCountry = (localeCountry, shopCountry, countries) => {
30
31
  return resolvedCountry;
31
32
  }
32
33
  }
33
- return localeCountry || systemLocale.country;
34
+ return localeCountry || systemLocale.region;
34
35
  };
35
36
 
36
- export const resolveBestCurrency = (localeCurrency, currencies: Array<Currency>) => {
37
+ export const resolveBestCurrency = (localeCurrency: string, currencies: Array<{ isoCode: string }>) => {
37
38
  if (localeCurrency) {
38
39
  const resolvedCurrency = currencies.find((currency) => currency.isoCode === localeCurrency);
39
40
  if (resolvedCurrency) {
@@ -1,4 +1,4 @@
1
- const invertMapObject = (theMapObject) =>
1
+ const invertMapObject = (theMapObject: Record<string, string>): Record<string, string> =>
2
2
  Object.keys(theMapObject).reduce((invertedObj, key) => {
3
3
  const newObj = invertedObj;
4
4
  newObj[theMapObject[key]] = key;
@@ -1,67 +1,57 @@
1
- import {
2
- resolveBestCountry,
3
- resolveBestSupported,
4
- slugify,
5
- systemLocale,
6
- } from '@unchainedshop/utils';
7
- import generateHashId from './generate-random-hash.js'
1
+ import { resolveBestCountry, resolveBestSupported, slugify, systemLocale } from '@unchainedshop/utils';
2
+ import generateHashId from './generate-random-hash.js';
8
3
 
9
4
  describe('Utils', () => {
10
-
11
5
  it('Locale', () => {
12
6
  expect(systemLocale).toBeDefined();
13
- expect(resolveBestCountry).toBeInstanceOf(Function)
14
- expect(resolveBestSupported).toBeInstanceOf(Function)
7
+ expect(resolveBestCountry).toBeInstanceOf(Function);
8
+ expect(resolveBestSupported).toBeInstanceOf(Function);
15
9
  });
16
10
 
17
- describe('generateHashId', () => {
18
- it('should create a random hash ', () => {
19
- const result = generateHashId();
20
-
21
- expect(typeof result).toBe('string');
22
- expect(result).toMatch(/^[A-Z0-9]+$/);
23
- })
24
- });
11
+ describe('generateHashId', () => {
12
+ it('should create a random hash ', () => {
13
+ const result = generateHashId();
25
14
 
26
- describe('slugify', () => {
27
- it('with a normal string', () => {
28
- const text = 'The Quick Brown Fox Jumps Over The Lazy Dog';
29
- const expected = 'the-quick-brown-fox-jumps-over-the-lazy-dog';
30
-
31
- const result = slugify(text);
32
-
33
- expect(result).toEqual(expected);
34
- });
35
-
36
- it('with a string containing special characters', () => {
37
- const text = 'The Quick Brown Fox! Jumps Over The Lazy Dog?';
38
- const expected = 'the-quick-brown-fox-jumps-over-the-lazy-dog';
39
-
40
- const result = slugify(text);
41
-
42
- expect(result).toEqual(expected);
43
- });
44
-
45
- it('with a string containing multiple spaces', () => {
46
- const text = 'The Quick Brown Fox Jumps Over The Lazy Dog';
47
- const expected = 'the-quick-brown-fox-jumps-over-the-lazy-dog';
48
-
49
- const result = slugify(text);
50
-
51
- expect(result).toEqual(expected);
15
+ expect(typeof result).toBe('string');
16
+ expect(result).toMatch(/^[A-Z0-9]+$/);
17
+ });
52
18
  });
53
-
54
- it('with a string containing only special characters (leave underscore)', () => {
55
- const text = '!@#$%^&*()_+';
56
- const expected = '_';
57
-
58
- const result = slugify(text);
59
-
60
- expect(result).toEqual(expected);
61
- });
62
-
63
- })
64
-
65
- });
66
19
 
20
+ describe('slugify', () => {
21
+ it('with a normal string', () => {
22
+ const text = 'The Quick Brown Fox Jumps Over The Lazy Dog';
23
+ const expected = 'the-quick-brown-fox-jumps-over-the-lazy-dog';
24
+
25
+ const result = slugify(text);
26
+
27
+ expect(result).toEqual(expected);
28
+ });
29
+
30
+ it('with a string containing special characters', () => {
31
+ const text = 'The Quick Brown Fox! Jumps Over The Lazy Dog?';
32
+ const expected = 'the-quick-brown-fox-jumps-over-the-lazy-dog';
67
33
 
34
+ const result = slugify(text);
35
+
36
+ expect(result).toEqual(expected);
37
+ });
38
+
39
+ it('with a string containing multiple spaces', () => {
40
+ const text = 'The Quick Brown Fox Jumps Over The Lazy Dog';
41
+ const expected = 'the-quick-brown-fox-jumps-over-the-lazy-dog';
42
+
43
+ const result = slugify(text);
44
+
45
+ expect(result).toEqual(expected);
46
+ });
47
+
48
+ it('with a string containing only special characters (leave underscore)', () => {
49
+ const text = '!@#$%^&*()_+';
50
+ const expected = '_';
51
+
52
+ const result = slugify(text);
53
+
54
+ expect(result).toEqual(expected);
55
+ });
56
+ });
57
+ });
@@ -13,16 +13,28 @@ export { default as buildObfuscatedFieldsFilter } from './build-obfuscated-field
13
13
  * Schemas
14
14
  */
15
15
 
16
- export { Schemas } from './schemas/index.js';
16
+ export enum SortDirection {
17
+ ASC = 'ASC',
18
+ DESC = 'DESC',
19
+ }
17
20
 
21
+ export type SortOption = {
22
+ key: string;
23
+ value: SortDirection;
24
+ };
25
+
26
+ export type NodeOrTree<T> = string | Tree<T>; // eslint-disable-line
27
+ export type Tree<T> = Array<NodeOrTree<T>>;
18
28
  /*
19
29
  * Director
20
30
  */
21
31
 
22
- export { BaseAdapter } from './director/BaseAdapter.js';
23
- export { BaseDirector } from './director/BaseDirector.js';
24
- export { BasePricingAdapter } from './director/BasePricingAdapter.js';
25
- export { BasePricingDirector } from './director/BasePricingDirector.js';
26
- export { BasePricingSheet } from './director/BasePricingSheet.js';
27
- export { BaseDiscountAdapter } from './director/BaseDiscountAdapter.js';
28
- export { BaseDiscountDirector } from './director/BaseDiscountDirector.js';
32
+ export * from './director/BaseAdapter.js';
33
+ export * from './director/BaseDirector.js';
34
+
35
+ export * from './director/BasePricingAdapter.js';
36
+ export * from './director/BasePricingDirector.js';
37
+ export * from './director/BasePricingSheet.js';
38
+
39
+ export * from './director/BaseDiscountAdapter.js';
40
+ export * from './director/BaseDiscountDirector.js';
@@ -1,3 +0,0 @@
1
- import SimpleSchema from 'simpl-schema';
2
- export declare const AddressSchema: SimpleSchema;
3
- //# sourceMappingURL=AddressSchema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AddressSchema.d.ts","sourceRoot":"","sources":["../../src/schemas/AddressSchema.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,cAAc,CAAC;AAExC,eAAO,MAAM,aAAa,cAazB,CAAC"}
@@ -1,13 +0,0 @@
1
- import SimpleSchema from 'simpl-schema';
2
- export const AddressSchema = new SimpleSchema({
3
- firstName: String,
4
- lastName: String,
5
- company: String,
6
- addressLine: String,
7
- addressLine2: String,
8
- city: String,
9
- postalCode: String,
10
- regionCode: String,
11
- countryCode: String,
12
- }, { requiredByDefault: false });
13
- //# sourceMappingURL=AddressSchema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AddressSchema.js","sourceRoot":"","sources":["../../src/schemas/AddressSchema.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,cAAc,CAAC;AAExC,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,YAAY,CAC3C;IACE,SAAS,EAAE,MAAM;IACjB,QAAQ,EAAE,MAAM;IAChB,OAAO,EAAE,MAAM;IACf,WAAW,EAAE,MAAM;IACnB,YAAY,EAAE,MAAM;IACpB,IAAI,EAAE,MAAM;IACZ,UAAU,EAAE,MAAM;IAClB,UAAU,EAAE,MAAM;IAClB,WAAW,EAAE,MAAM;CACpB,EACD,EAAE,iBAAiB,EAAE,KAAK,EAAE,CAC7B,CAAC"}
@@ -1,3 +0,0 @@
1
- import SimpleSchema from 'simpl-schema';
2
- export declare const ContactSchema: SimpleSchema;
3
- //# sourceMappingURL=ContactSchema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ContactSchema.d.ts","sourceRoot":"","sources":["../../src/schemas/ContactSchema.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,cAAc,CAAC;AAExC,eAAO,MAAM,aAAa,cAMzB,CAAC"}
@@ -1,6 +0,0 @@
1
- import SimpleSchema from 'simpl-schema';
2
- export const ContactSchema = new SimpleSchema({
3
- telNumber: String,
4
- emailAddress: String,
5
- }, { requiredByDefault: false });
6
- //# sourceMappingURL=ContactSchema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ContactSchema.js","sourceRoot":"","sources":["../../src/schemas/ContactSchema.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,cAAc,CAAC;AAExC,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,YAAY,CAC3C;IACE,SAAS,EAAE,MAAM;IACjB,YAAY,EAAE,MAAM;CACrB,EACD,EAAE,iBAAiB,EAAE,KAAK,EAAE,CAC7B,CAAC"}
@@ -1,5 +0,0 @@
1
- import SimpleSchema from 'simpl-schema';
2
- export declare const LastLoginSchema: SimpleSchema;
3
- export declare const LastContactSchema: SimpleSchema;
4
- export declare const UserSchema: SimpleSchema;
5
- //# sourceMappingURL=UsersSchema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UsersSchema.d.ts","sourceRoot":"","sources":["../../src/schemas/UsersSchema.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,cAAc,CAAC;AAexC,eAAO,MAAM,eAAe,cAU3B,CAAC;AAEF,eAAO,MAAM,iBAAiB,cAM7B,CAAC;AAEF,eAAO,MAAM,UAAU,cA+BtB,CAAC"}
@@ -1,52 +0,0 @@
1
- import SimpleSchema from 'simpl-schema';
2
- import { AddressSchema } from './AddressSchema.js';
3
- import { timestampFields } from './commonSchemaFields.js';
4
- const ProfileSchema = new SimpleSchema({
5
- displayName: String,
6
- birthday: Date,
7
- phoneMobile: String,
8
- gender: String,
9
- address: AddressSchema,
10
- }, { requiredByDefault: false });
11
- export const LastLoginSchema = new SimpleSchema({
12
- timestamp: Date,
13
- locale: String,
14
- countryCode: String,
15
- remoteAddress: String,
16
- remotePort: String,
17
- userAgent: String,
18
- }, { requiredByDefault: false });
19
- export const LastContactSchema = new SimpleSchema({
20
- telNumber: String,
21
- emailAddress: String,
22
- }, { requiredByDefault: false });
23
- export const UserSchema = new SimpleSchema({
24
- emails: Array,
25
- 'emails.$': Object,
26
- 'emails.$.address': String,
27
- 'emails.$.verified': Boolean,
28
- username: String,
29
- lastLogin: LastLoginSchema,
30
- profile: ProfileSchema,
31
- lastBillingAddress: AddressSchema,
32
- lastContact: LastContactSchema,
33
- guest: Boolean,
34
- initialPassword: Boolean,
35
- tags: Array,
36
- 'tags.$': String,
37
- avatarId: String,
38
- meta: {
39
- type: Object,
40
- optional: true,
41
- blackbox: true,
42
- },
43
- services: {
44
- type: Object,
45
- optional: true,
46
- blackbox: true,
47
- },
48
- roles: Array,
49
- 'roles.$': String,
50
- ...timestampFields,
51
- }, { requiredByDefault: false });
52
- //# sourceMappingURL=UsersSchema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UsersSchema.js","sourceRoot":"","sources":["../../src/schemas/UsersSchema.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,MAAM,aAAa,GAAG,IAAI,YAAY,CACpC;IACE,WAAW,EAAE,MAAM;IACnB,QAAQ,EAAE,IAAI;IACd,WAAW,EAAE,MAAM;IACnB,MAAM,EAAE,MAAM;IACd,OAAO,EAAE,aAAa;CACvB,EACD,EAAE,iBAAiB,EAAE,KAAK,EAAE,CAC7B,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,YAAY,CAC7C;IACE,SAAS,EAAE,IAAI;IACf,MAAM,EAAE,MAAM;IACd,WAAW,EAAE,MAAM;IACnB,aAAa,EAAE,MAAM;IACrB,UAAU,EAAE,MAAM;IAClB,SAAS,EAAE,MAAM;CAClB,EACD,EAAE,iBAAiB,EAAE,KAAK,EAAE,CAC7B,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,YAAY,CAC/C;IACE,SAAS,EAAE,MAAM;IACjB,YAAY,EAAE,MAAM;CACrB,EACD,EAAE,iBAAiB,EAAE,KAAK,EAAE,CAC7B,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,YAAY,CACxC;IACE,MAAM,EAAE,KAAK;IACb,UAAU,EAAE,MAAM;IAClB,kBAAkB,EAAE,MAAM;IAC1B,mBAAmB,EAAE,OAAO;IAC5B,QAAQ,EAAE,MAAM;IAChB,SAAS,EAAE,eAAe;IAC1B,OAAO,EAAE,aAAa;IACtB,kBAAkB,EAAE,aAAa;IACjC,WAAW,EAAE,iBAAiB;IAC9B,KAAK,EAAE,OAAO;IACd,eAAe,EAAE,OAAO;IACxB,IAAI,EAAE,KAAK;IACX,QAAQ,EAAE,MAAM;IAChB,QAAQ,EAAE,MAAM;IAChB,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;QACd,QAAQ,EAAE,IAAI;KACf;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;QACd,QAAQ,EAAE,IAAI;KACf;IACD,KAAK,EAAE,KAAK;IACZ,SAAS,EAAE,MAAM;IACjB,GAAG,eAAe;CACnB,EACD,EAAE,iBAAiB,EAAE,KAAK,EAAE,CAC7B,CAAC"}
@@ -1,35 +0,0 @@
1
- export declare const contextFields: {
2
- context: {
3
- type: ObjectConstructor;
4
- blackbox: boolean;
5
- required: boolean;
6
- };
7
- };
8
- export declare const logFields: {
9
- log: ArrayConstructor;
10
- 'log.$': {
11
- type: ObjectConstructor;
12
- };
13
- 'log.$.date': {
14
- type: DateConstructor;
15
- };
16
- 'log.$.status': {
17
- type: StringConstructor;
18
- };
19
- 'log.$.info': {
20
- type: StringConstructor;
21
- };
22
- };
23
- export declare const timestampFields: {
24
- created: {
25
- type: DateConstructor;
26
- required: boolean;
27
- };
28
- updated: {
29
- type: DateConstructor;
30
- };
31
- deleted: {
32
- type: DateConstructor;
33
- };
34
- };
35
- //# sourceMappingURL=commonSchemaFields.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"commonSchemaFields.d.ts","sourceRoot":"","sources":["../../src/schemas/commonSchemaFields.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa;;;;;;CAMzB,CAAC;AAEF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;CAcrB,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;CAI3B,CAAC"}
@@ -1,28 +0,0 @@
1
- export const contextFields = {
2
- context: {
3
- type: Object,
4
- blackbox: true,
5
- required: false,
6
- },
7
- };
8
- export const logFields = {
9
- log: Array,
10
- 'log.$': {
11
- type: Object,
12
- },
13
- 'log.$.date': {
14
- type: Date,
15
- },
16
- 'log.$.status': {
17
- type: String,
18
- },
19
- 'log.$.info': {
20
- type: String,
21
- },
22
- };
23
- export const timestampFields = {
24
- created: { type: Date, required: true },
25
- updated: { type: Date },
26
- deleted: { type: Date },
27
- };
28
- //# sourceMappingURL=commonSchemaFields.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"commonSchemaFields.js","sourceRoot":"","sources":["../../src/schemas/commonSchemaFields.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,OAAO,EAAE;QACP,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;QACd,QAAQ,EAAE,KAAK;KAChB;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,GAAG,EAAE,KAAK;IACV,OAAO,EAAE;QACP,IAAI,EAAE,MAAM;KACb;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,IAAI;KACX;IACD,cAAc,EAAE;QACd,IAAI,EAAE,MAAM;KACb;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,MAAM;KACb;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;IACvC,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;IACvB,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;CACxB,CAAC"}