@unchainedshop/utils 2.0.0-rc.3 → 2.0.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.
- package/jest.config.js +3 -0
- package/lib/db/build-db-indexes.d.ts +1 -1
- package/lib/db/build-sort-option.d.ts +2 -2
- package/lib/db/generate-db-filter-by-id.d.ts +1 -1
- package/lib/db/generate-db-mutations.d.ts +2 -2
- package/lib/db/generate-db-mutations.js +3 -3
- package/lib/db/generate-db-mutations.js.map +1 -1
- package/lib/director/BaseAdapter.d.ts +1 -1
- package/lib/director/BaseDirector.d.ts +1 -1
- package/lib/director/BaseDirector.js +5 -1
- package/lib/director/BaseDirector.js.map +1 -1
- package/lib/director/BaseDiscountAdapter.d.ts +1 -1
- package/lib/director/BaseDiscountDirector.d.ts +1 -1
- package/lib/director/BaseDiscountDirector.js +1 -1
- package/lib/director/BaseDiscountDirector.js.map +1 -1
- package/lib/director/BasePricingAdapter.d.ts +1 -1
- package/lib/director/BasePricingDirector.d.ts +1 -1
- package/lib/director/BasePricingDirector.js +1 -1
- package/lib/director/BasePricingDirector.js.map +1 -1
- package/lib/director/BasePricingSheet.d.ts +1 -1
- package/lib/director/BasePricingSheet.js.map +1 -1
- package/lib/find-localized-text.d.ts +2 -2
- package/lib/find-localized-text.js +11 -5
- package/lib/find-localized-text.js.map +1 -1
- package/lib/find-preserving-ids.d.ts +1 -1
- package/lib/schemas/UsersSchema.js +2 -2
- package/lib/schemas/UsersSchema.js.map +1 -1
- package/lib/schemas/index.d.ts +42 -0
- package/lib/schemas/index.js +14 -0
- package/lib/schemas/index.js.map +1 -0
- package/lib/utils-index.d.ts +23 -62
- package/lib/utils-index.js +23 -35
- package/lib/utils-index.js.map +1 -1
- package/package.json +5 -5
- package/src/db/build-db-indexes.ts +1 -1
- package/src/db/build-sort-option.ts +2 -2
- package/src/db/generate-db-filter-by-id.ts +1 -1
- package/src/db/generate-db-mutations.ts +5 -5
- package/src/director/BaseAdapter.ts +1 -1
- package/src/director/BaseDirector.ts +7 -3
- package/src/director/BaseDiscountAdapter.ts +1 -1
- package/src/director/BaseDiscountDirector.ts +2 -2
- package/src/director/BasePricingAdapter.ts +1 -1
- package/src/director/BasePricingDirector.ts +3 -3
- package/src/director/BasePricingSheet.ts +5 -1
- package/src/director/base-director.test.ts +129 -0
- package/src/director/base-discount-adapter.test.ts +52 -0
- package/src/director/base-price-sheet.test.ts +106 -0
- package/src/find-localized-text.ts +12 -6
- package/src/find-preserving-ids.ts +1 -1
- package/src/schemas/UsersSchema.ts +2 -2
- package/src/schemas/index.ts +18 -0
- package/{tests → src}/utils-index.test.ts +2 -3
- package/src/utils-index.ts +23 -37
- package/tsconfig.json +5 -23
package/jest.config.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Collection, Indexes, Document } from '@unchainedshop/types/common';
|
|
1
|
+
import { Collection, Indexes, Document } from '@unchainedshop/types/common.js';
|
|
2
2
|
export declare const buildDbIndexes: <T extends Document>(collection: Collection<T>, indexes: Indexes<T>) => Promise<boolean>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SortOption } from '@unchainedshop/types/api';
|
|
2
|
-
import { Sort } from '@unchainedshop/types/common';
|
|
1
|
+
import { SortOption } from '@unchainedshop/types/api.js';
|
|
2
|
+
import { Sort } from '@unchainedshop/types/common.js';
|
|
3
3
|
declare const buildSortOptions: (sort?: Array<SortOption>) => Sort;
|
|
4
4
|
export default buildSortOptions;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import SimpleSchema from 'simpl-schema';
|
|
2
|
-
import { Collection, _ID, TimestampFields } from '@unchainedshop/types/common';
|
|
3
|
-
import { ModuleCreateMutation, ModuleMutations } from '@unchainedshop/types/core';
|
|
2
|
+
import { Collection, _ID, TimestampFields } from '@unchainedshop/types/common.js';
|
|
3
|
+
import { ModuleCreateMutation, ModuleMutations } from '@unchainedshop/types/core.js';
|
|
4
4
|
export declare const generateDbMutations: <T extends TimestampFields & {
|
|
5
5
|
_id?: _ID;
|
|
6
6
|
}>(collection: Collection<T>, schema: SimpleSchema, options?: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { checkId } from './check-id';
|
|
2
|
-
import { generateDbObjectId } from './generate-db-object-id';
|
|
3
|
-
import { generateDbFilterById } from './generate-db-filter-by-id';
|
|
1
|
+
import { checkId } from './check-id.js';
|
|
2
|
+
import { generateDbObjectId } from './generate-db-object-id.js';
|
|
3
|
+
import { generateDbFilterById } from './generate-db-filter-by-id.js';
|
|
4
4
|
export const generateDbMutations = (collection, schema, options) => {
|
|
5
5
|
if (!collection)
|
|
6
6
|
throw new Error('Collection is missing');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-db-mutations.js","sourceRoot":"","sources":["../../src/db/generate-db-mutations.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"generate-db-mutations.js","sourceRoot":"","sources":["../../src/db/generate-db-mutations.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErE,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,UAAyB,EACzB,MAAoB,EACpB,OAGC,EAC6C,EAAE;IAChD,IAAI,CAAC,UAAU;QAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC1D,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IAElD,MAAM,EAAE,aAAa,EAAE,0BAA0B,EAAE,GAAG,OAAO,IAAI;QAC/D,aAAa,EAAE,KAAK;QACpB,0BAA0B,EAAE,KAAK;KAClC,CAAC;IAEF,MAAM,iBAAiB,GAAG,KAAK,EAAE,GAAG,EAAE,EA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+
import { IBaseAdapter } from '@unchainedshop/types/common.js';
|
|
2
2
|
export declare const BaseAdapter: Omit<IBaseAdapter, 'key' | 'label' | 'version'>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IBaseAdapter, IBaseDirector } from '@unchainedshop/types/common';
|
|
1
|
+
import { IBaseAdapter, IBaseDirector } from '@unchainedshop/types/common.js';
|
|
2
2
|
export declare const BaseDirector: <AdapterType extends IBaseAdapter>(directorName: string, options?: {
|
|
3
3
|
adapterSortKey?: string;
|
|
4
4
|
adapterKeyField?: string;
|
|
@@ -13,9 +13,13 @@ export const BaseDirector = (directorName, options) => {
|
|
|
13
13
|
.filter(adapterFilter || (() => true));
|
|
14
14
|
},
|
|
15
15
|
registerAdapter: (Adapter) => {
|
|
16
|
-
log(`${directorName} -> Registered ${keyField !== 'key' ? `${Adapter[keyField]}
|
|
16
|
+
log(`${directorName} -> Registered ${keyField !== 'key' ? `${Adapter[keyField]}` : ''} ${Adapter.key} ${Adapter.version} (${Adapter.label})`);
|
|
17
17
|
Adapters.set(Adapter[keyField], Adapter);
|
|
18
18
|
},
|
|
19
|
+
unregisterAdapter: (key) => {
|
|
20
|
+
log(`${directorName} -> Unregistered ${key}`);
|
|
21
|
+
return Adapters.delete(key);
|
|
22
|
+
},
|
|
19
23
|
};
|
|
20
24
|
};
|
|
21
25
|
//# sourceMappingURL=BaseDirector.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseDirector.js","sourceRoot":"","sources":["../../src/director/BaseDirector.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,YAAoB,EACpB,OAGC,EAC2B,EAAE;IAC9B,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAuB,CAAC;IAChD,MAAM,QAAQ,GAAG,OAAO,EAAE,eAAe,IAAI,KAAK,CAAC;IAEnD,OAAO;QACL,UAAU,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D,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;iBACjC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;iBACrD,MAAM,CAAC,aAAa,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;QAC3C,CAAC;QAED,eAAe,EAAE,CAAC,OAAO,EAAE,EAAE;YAC3B,GAAG,CACD,GAAG,YAAY,kBAAkB,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAC/E,OAAO,CAAC,GACV,IAAI,OAAO,CAAC,OAAO,KAAK,OAAO,CAAC,KAAK,GAAG,CACzC,CAAC;YACF,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC;QAC3C,CAAC;QAED,iBAAiB,EAAE,CAAC,GAAG,EAAE,EAAE;YACzB,GAAG,CAAC,GAAG,YAAY,oBAAoB,GAAG,EAAE,CAAC,CAAC;YAC9C,OAAO,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC9B,CAAC;KACF,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { IDiscountAdapter } from '@unchainedshop/types/discount';
|
|
1
|
+
import { IDiscountAdapter } from '@unchainedshop/types/discount.js';
|
|
2
2
|
export declare const BaseDiscountAdapter: Omit<IDiscountAdapter, 'key' | 'label' | 'version'>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { IDiscountDirector } from '@unchainedshop/types/discount';
|
|
1
|
+
import { IDiscountDirector } from '@unchainedshop/types/discount.js';
|
|
2
2
|
export declare const BaseDiscountDirector: (directorName: string) => IDiscountDirector;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { log } from '@unchainedshop/logger';
|
|
2
|
-
import { BaseDirector } from './BaseDirector';
|
|
2
|
+
import { BaseDirector } from './BaseDirector.js';
|
|
3
3
|
export const BaseDiscountDirector = (directorName) => {
|
|
4
4
|
const baseDirector = BaseDirector(directorName, {
|
|
5
5
|
adapterSortKey: 'orderIndex',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseDiscountDirector.js","sourceRoot":"","sources":["../../src/director/BaseDiscountDirector.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"BaseDiscountDirector.js","sourceRoot":"","sources":["../../src/director/BaseDiscountDirector.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,YAAoB,EAAqB,EAAE;IAC9E,MAAM,YAAY,GAAG,YAAY,CAAmB,YAAY,EAAE;QAChE,cAAc,EAAE,YAAY;KAC7B,CAAC,CAAC;IAEH,OAAO;QACL,GAAG,YAAY;QAEf,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,EAAE;YAC/C,MAAM,OAAO,GAAG,EAAE,GAAG,eAAe,EAAE,GAAG,YAAY,EAAE,CAAC;YAExD,OAAO;gBACL,gCAAgC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;oBAClD,IAAI,CAAC,OAAO,CAAC,KAAK;wBAAE,OAAO,IAAI,CAAC;oBAEhC,GAAG,CAAC,0DAA0D,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;oBAE/E,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,GAAG,CACjC,YAAY;yBACT,WAAW,EAAE;yBACb,MAAM,CAAC,CAAC,OAAO,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CAAC,MAAM,mBAAmB,CAAC,CAAC;qBAC5E;oBACD,OAAO,cAAc,CAAC;gBACxB,CAAC;aACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { BasePricingAdapterContext, IPricingSheet, IPricingAdapter, PricingCalculation } from '@unchainedshop/types/pricing';
|
|
1
|
+
import { BasePricingAdapterContext, IPricingSheet, IPricingAdapter, PricingCalculation } from '@unchainedshop/types/pricing.js';
|
|
2
2
|
export declare const BasePricingAdapter: <Context extends BasePricingAdapterContext, Calculation extends PricingCalculation>() => IPricingAdapter<Context, Calculation, IPricingSheet<Calculation>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { BasePricingAdapterContext, BasePricingContext, IPricingDirector, IPricingAdapter, IPricingSheet, PricingCalculation } from '@unchainedshop/types/pricing';
|
|
1
|
+
import { BasePricingAdapterContext, BasePricingContext, IPricingDirector, IPricingAdapter, IPricingSheet, PricingCalculation } from '@unchainedshop/types/pricing.js';
|
|
2
2
|
export declare const BasePricingDirector: <DirectorContext extends BasePricingContext, AdapterContext extends BasePricingAdapterContext, Calculation extends PricingCalculation, PricingAdapter extends IPricingAdapter<AdapterContext, Calculation, IPricingSheet<Calculation>>>(directorName: string) => IPricingDirector<DirectorContext, Calculation, AdapterContext, IPricingSheet<Calculation>, PricingAdapter>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { log, LogLevel } from '@unchainedshop/logger';
|
|
2
|
-
import { BaseDirector } from './BaseDirector';
|
|
2
|
+
import { BaseDirector } from './BaseDirector.js';
|
|
3
3
|
export const BasePricingDirector = (directorName) => {
|
|
4
4
|
const baseDirector = BaseDirector(directorName, {
|
|
5
5
|
adapterSortKey: 'orderIndex',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BasePricingDirector.js","sourceRoot":"","sources":["../../src/director/BasePricingDirector.ts"],"names":[],"mappings":"AAUA,OAA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AC,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { PricingCalculation, IBasePricingSheet, PricingSheetParams } from '@unchainedshop/types/pricing';
|
|
1
|
+
import { PricingCalculation, IBasePricingSheet, PricingSheetParams } from '@unchainedshop/types/pricing.js';
|
|
2
2
|
export declare const BasePricingSheet: <Calculation extends PricingCalculation>(params: PricingSheetParams<Calculation>) => IBasePricingSheet<Calculation>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BasePricingSheet.js","sourceRoot":"","sources":["../../src/director/BasePricingSheet.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BasePricingSheet.js","sourceRoot":"","sources":["../../src/director/BasePricingSheet.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,MAAuC,EACP,EAAE;IAClC,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,IAAI,EAAE,CAAC;IAE7C,MAAM,YAAY,GAAmC;QACnD,WAAW;QACX,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QAEzB,kBAAkB;YAChB,OAAO,WAAW,CAAC;QACrB,CAAC;QAED,OAAO;YACL,OAAO,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC;QAChC,CAAC;QAED,GAAG,CAAC,MAAM;YACR,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;iBACzB,MAAM,CAAC,OAAO,CAAC;iBACf,MAAM,CAAC,CAAC,GAAW,EAAE,cAA2B,EAAE,EAAE,CAAC,GAAG,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QAC1F,CAAC;QAED,MAAM;YACJ,OAAO,CAAC,CAAC;QACX,CAAC;QAED,KAAK;YACH,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC;QACpB,CAAC;QAED,GAAG;YACD,OAAO,IAAI,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,MA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AAO,YAAY,CAAC,WAAW,CAAC;QAClC,CAAC;KACF,CAAC;IAEF,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import 'abort-controller/polyfill';
|
|
2
|
-
import { Collection, Filter, Locale, Document } from '@unchainedshop/types/common';
|
|
1
|
+
import 'abort-controller/polyfill.js';
|
|
2
|
+
import { Collection, Filter, Locale, Document } from '@unchainedshop/types/common.js';
|
|
3
3
|
declare const findLocalizedText: <T extends Document>(collection: Collection<T>, selector: Filter<T>, locale: Locale) => Promise<T>;
|
|
4
4
|
export default findLocalizedText;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import 'abort-controller/polyfill';
|
|
1
|
+
import 'abort-controller/polyfill.js';
|
|
2
2
|
import LRU from 'lru-cache';
|
|
3
|
-
import { systemLocale } from './locale-helpers';
|
|
3
|
+
import { systemLocale } from './locale-helpers.js';
|
|
4
4
|
const { NODE_ENV } = process.env;
|
|
5
5
|
const ttl = NODE_ENV === 'production' ? 1000 * 10 : 0; // 10 seconds or 0 seconds
|
|
6
6
|
const textCache = new LRU({ max: 50000, ttl });
|
|
@@ -19,19 +19,25 @@ const findLocalizedText = async (collection, selector, locale) => {
|
|
|
19
19
|
const cachedText = textCache.get(cacheKey);
|
|
20
20
|
if (cachedText)
|
|
21
21
|
return cachedText;
|
|
22
|
-
const exactTranslation = await collection.findOne(extendSelectorWithLocale(selector, locale), {
|
|
22
|
+
const exactTranslation = await collection.findOne(extendSelectorWithLocale(selector, locale), {
|
|
23
|
+
sort: { updated: -1 },
|
|
24
|
+
});
|
|
23
25
|
if (exactTranslation) {
|
|
24
26
|
textCache.set(cacheKey, exactTranslation);
|
|
25
27
|
return exactTranslation;
|
|
26
28
|
}
|
|
27
29
|
if (systemLocale.normalized !== locale.normalized) {
|
|
28
|
-
const fallbackTranslation = await collection.findOne(extendSelectorWithLocale(selector, systemLocale), {
|
|
30
|
+
const fallbackTranslation = await collection.findOne(extendSelectorWithLocale(selector, systemLocale), {
|
|
31
|
+
sort: { updated: -1 },
|
|
32
|
+
});
|
|
29
33
|
if (fallbackTranslation) {
|
|
30
34
|
textCache.set(cacheKey, fallbackTranslation);
|
|
31
35
|
return fallbackTranslation;
|
|
32
36
|
}
|
|
33
37
|
}
|
|
34
|
-
const foundText = await collection.findOne(selector, {
|
|
38
|
+
const foundText = await collection.findOne(selector, {
|
|
39
|
+
sort: { updated: -1 },
|
|
40
|
+
});
|
|
35
41
|
textCache.set(cacheKey, foundText);
|
|
36
42
|
return foundText;
|
|
37
43
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-localized-text.js","sourceRoot":"","sources":["../src/find-localized-text.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"find-localized-text.js","sourceRoot":"","sources":["../src/find-localized-text.ts"],"names":[],"mappings":"AAAA,OAAO,8BAA8B,CAAC;AACtC,OAAO,GAAG,MAAM,WAAW,CAAC;AAE5B,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;AAEjC,MAAM,GAAG,GAAG,QAAQ,KAAK,YAAY,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,0BAA0B;AAEjF,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;AAE/C,MAAM,wBAAwB,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE;IACpD,MAAM,cAAc,GAAG;QACrB,MAAM,EAAE,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,EAAE;KACtD,CAAC;IACF,OAAO,EAAE,GAAG,cAAc,EAAE,GAAG,QAAQ,EAAE,CAAC;AAC5C,CAAC,C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AACxB,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Collection, FindOptions, Query } from '@unchainedshop/types/common';
|
|
1
|
+
import { Collection, FindOptions, Query } from '@unchainedshop/types/common.js';
|
|
2
2
|
export declare const findPreservingIds: <T>(collection: Collection<T>) => (selector: Query, ids: Array<string>, options?: FindOptions) => Promise<T[]>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import SimpleSchema from 'simpl-schema';
|
|
2
|
-
import { AddressSchema } from './AddressSchema';
|
|
3
|
-
import { timestampFields } from './commonSchemaFields';
|
|
2
|
+
import { AddressSchema } from './AddressSchema.js';
|
|
3
|
+
import { timestampFields } from './commonSchemaFields.js';
|
|
4
4
|
const ProfileSchema = new SimpleSchema({
|
|
5
5
|
displayName: String,
|
|
6
6
|
birthday: Date,
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,SAA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boolean;
|
|
7
|
+
};
|
|
8
|
+
updated: {
|
|
9
|
+
type: DateConstructor;
|
|
10
|
+
};
|
|
11
|
+
deleted: {
|
|
12
|
+
type: DateConstructor;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
contextFields: {
|
|
16
|
+
context: {
|
|
17
|
+
type: ObjectConstructor;
|
|
18
|
+
blackbox: boolean;
|
|
19
|
+
required: boolean;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
logFields: {
|
|
23
|
+
log: ArrayConstructor;
|
|
24
|
+
'log.$': {
|
|
25
|
+
type: ObjectConstructor;
|
|
26
|
+
};
|
|
27
|
+
'log.$.date': {
|
|
28
|
+
type: DateConstructor;
|
|
29
|
+
};
|
|
30
|
+
'log.$.status': {
|
|
31
|
+
type: StringConstructor;
|
|
32
|
+
};
|
|
33
|
+
'log.$.info': {
|
|
34
|
+
type: StringConstructor;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
Address: SimpleSchema;
|
|
38
|
+
Contact: SimpleSchema;
|
|
39
|
+
User: SimpleSchema;
|
|
40
|
+
};
|
|
41
|
+
export { Schemas };
|
|
42
|
+
export type { SimpleSchema };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { timestampFields, contextFields, logFields } from './commonSchemaFields.js';
|
|
2
|
+
import { AddressSchema } from './AddressSchema.js';
|
|
3
|
+
import { ContactSchema } from './ContactSchema.js';
|
|
4
|
+
import { UserSchema } from './UsersSchema.js';
|
|
5
|
+
const Schemas = {
|
|
6
|
+
timestampFields,
|
|
7
|
+
contextFields,
|
|
8
|
+
logFields,
|
|
9
|
+
Address: AddressSchema,
|
|
10
|
+
Contact: ContactSchema,
|
|
11
|
+
User: UserSchema,
|
|
12
|
+
};
|
|
13
|
+
export { Schemas };
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpF,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,OAAO,GAAG;IACd,eAAe;IACf,aAAa;IACb,SAAS;IACT,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;IACtB,IAAI,EAAE,UAAU;CACjB,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
package/lib/utils-index.d.ts
CHANGED
|
@@ -1,62 +1,23 @@
|
|
|
1
|
-
export { default as findLocalizedText } from './find-localized-text';
|
|
2
|
-
export * from './locale-helpers';
|
|
3
|
-
export { default as objectInvert } from './object-invert';
|
|
4
|
-
export { default as findUnusedSlug } from './find-unused-slug';
|
|
5
|
-
export { default as slugify } from './slugify';
|
|
6
|
-
export { default as pipePromises } from './pipe-promises';
|
|
7
|
-
export { default as generateRandomHash } from './generate-random-hash';
|
|
8
|
-
export { default as randomValueHex } from './random-value-hex';
|
|
9
|
-
export { default as buildSortOptions } from './db/build-sort-option';
|
|
10
|
-
export { checkId } from './db/check-id';
|
|
11
|
-
export { generateDbObjectId } from './db/generate-db-object-id';
|
|
12
|
-
export { generateDbFilterById } from './db/generate-db-filter-by-id';
|
|
13
|
-
export { generateDbMutations } from './db/generate-db-mutations';
|
|
14
|
-
export { buildDbIndexes } from './db/build-db-indexes';
|
|
15
|
-
export { findPreservingIds } from './find-preserving-ids';
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
deleted: {
|
|
26
|
-
type: DateConstructor;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
contextFields: {
|
|
30
|
-
context: {
|
|
31
|
-
type: ObjectConstructor;
|
|
32
|
-
blackbox: boolean;
|
|
33
|
-
required: boolean;
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
logFields: {
|
|
37
|
-
log: ArrayConstructor;
|
|
38
|
-
'log.$': {
|
|
39
|
-
type: ObjectConstructor;
|
|
40
|
-
};
|
|
41
|
-
'log.$.date': {
|
|
42
|
-
type: DateConstructor;
|
|
43
|
-
};
|
|
44
|
-
'log.$.status': {
|
|
45
|
-
type: StringConstructor;
|
|
46
|
-
};
|
|
47
|
-
'log.$.info': {
|
|
48
|
-
type: StringConstructor;
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
Address: import("simpl-schema/dist/esm/SimpleSchema").SimpleSchema;
|
|
52
|
-
Contact: import("simpl-schema/dist/esm/SimpleSchema").SimpleSchema;
|
|
53
|
-
User: import("simpl-schema/dist/esm/SimpleSchema").SimpleSchema;
|
|
54
|
-
};
|
|
55
|
-
export { Schemas };
|
|
56
|
-
export { BaseAdapter } from './director/BaseAdapter';
|
|
57
|
-
export { BaseDirector } from './director/BaseDirector';
|
|
58
|
-
export { BasePricingAdapter } from './director/BasePricingAdapter';
|
|
59
|
-
export { BasePricingDirector } from './director/BasePricingDirector';
|
|
60
|
-
export { BasePricingSheet } from './director/BasePricingSheet';
|
|
61
|
-
export { BaseDiscountAdapter } from './director/BaseDiscountAdapter';
|
|
62
|
-
export { BaseDiscountDirector } from './director/BaseDiscountDirector';
|
|
1
|
+
export { default as findLocalizedText } from './find-localized-text.js';
|
|
2
|
+
export * from './locale-helpers.js';
|
|
3
|
+
export { default as objectInvert } from './object-invert.js';
|
|
4
|
+
export { default as findUnusedSlug } from './find-unused-slug.js';
|
|
5
|
+
export { default as slugify } from './slugify.js';
|
|
6
|
+
export { default as pipePromises } from './pipe-promises.js';
|
|
7
|
+
export { default as generateRandomHash } from './generate-random-hash.js';
|
|
8
|
+
export { default as randomValueHex } from './random-value-hex.js';
|
|
9
|
+
export { default as buildSortOptions } from './db/build-sort-option.js';
|
|
10
|
+
export { checkId } from './db/check-id.js';
|
|
11
|
+
export { generateDbObjectId } from './db/generate-db-object-id.js';
|
|
12
|
+
export { generateDbFilterById } from './db/generate-db-filter-by-id.js';
|
|
13
|
+
export { generateDbMutations } from './db/generate-db-mutations.js';
|
|
14
|
+
export { buildDbIndexes } from './db/build-db-indexes.js';
|
|
15
|
+
export { findPreservingIds } from './find-preserving-ids.js';
|
|
16
|
+
export { Schemas } from './schemas/index.js';
|
|
17
|
+
export { BaseAdapter } from './director/BaseAdapter.js';
|
|
18
|
+
export { BaseDirector } from './director/BaseDirector.js';
|
|
19
|
+
export { BasePricingAdapter } from './director/BasePricingAdapter.js';
|
|
20
|
+
export { BasePricingDirector } from './director/BasePricingDirector.js';
|
|
21
|
+
export { BasePricingSheet } from './director/BasePricingSheet.js';
|
|
22
|
+
export { BaseDiscountAdapter } from './director/BaseDiscountAdapter.js';
|
|
23
|
+
export { BaseDiscountDirector } from './director/BaseDiscountDirector.js';
|
package/lib/utils-index.js
CHANGED
|
@@ -1,45 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export { default as
|
|
6
|
-
export
|
|
7
|
-
export { default as
|
|
8
|
-
export { default as
|
|
9
|
-
export { default as
|
|
10
|
-
export { default as pipePromises } from './pipe-promises';
|
|
11
|
-
export { default as generateRandomHash } from './generate-random-hash';
|
|
12
|
-
export { default as randomValueHex } from './random-value-hex';
|
|
13
|
-
export { default as buildSortOptions } from './db/build-sort-option';
|
|
1
|
+
export { default as findLocalizedText } from './find-localized-text.js';
|
|
2
|
+
export * from './locale-helpers.js';
|
|
3
|
+
export { default as objectInvert } from './object-invert.js';
|
|
4
|
+
export { default as findUnusedSlug } from './find-unused-slug.js';
|
|
5
|
+
export { default as slugify } from './slugify.js';
|
|
6
|
+
export { default as pipePromises } from './pipe-promises.js';
|
|
7
|
+
export { default as generateRandomHash } from './generate-random-hash.js';
|
|
8
|
+
export { default as randomValueHex } from './random-value-hex.js';
|
|
9
|
+
export { default as buildSortOptions } from './db/build-sort-option.js';
|
|
14
10
|
/*
|
|
15
11
|
* Db utils
|
|
16
12
|
*/
|
|
17
|
-
export { checkId } from './db/check-id';
|
|
18
|
-
export { generateDbObjectId } from './db/generate-db-object-id';
|
|
19
|
-
export { generateDbFilterById } from './db/generate-db-filter-by-id';
|
|
20
|
-
export { generateDbMutations } from './db/generate-db-mutations';
|
|
21
|
-
export { buildDbIndexes } from './db/build-db-indexes';
|
|
22
|
-
export { findPreservingIds } from './find-preserving-ids';
|
|
13
|
+
export { checkId } from './db/check-id.js';
|
|
14
|
+
export { generateDbObjectId } from './db/generate-db-object-id.js';
|
|
15
|
+
export { generateDbFilterById } from './db/generate-db-filter-by-id.js';
|
|
16
|
+
export { generateDbMutations } from './db/generate-db-mutations.js';
|
|
17
|
+
export { buildDbIndexes } from './db/build-db-indexes.js';
|
|
18
|
+
export { findPreservingIds } from './find-preserving-ids.js';
|
|
23
19
|
/*
|
|
24
20
|
* Schemas
|
|
25
21
|
*/
|
|
26
|
-
|
|
27
|
-
timestampFields,
|
|
28
|
-
contextFields,
|
|
29
|
-
logFields,
|
|
30
|
-
Address: AddressSchema,
|
|
31
|
-
Contact: ContactSchema,
|
|
32
|
-
User: UserSchema,
|
|
33
|
-
};
|
|
34
|
-
export { Schemas };
|
|
22
|
+
export { Schemas } from './schemas/index.js';
|
|
35
23
|
/*
|
|
36
24
|
* Director
|
|
37
25
|
*/
|
|
38
|
-
export { BaseAdapter } from './director/BaseAdapter';
|
|
39
|
-
export { BaseDirector } from './director/BaseDirector';
|
|
40
|
-
export { BasePricingAdapter } from './director/BasePricingAdapter';
|
|
41
|
-
export { BasePricingDirector } from './director/BasePricingDirector';
|
|
42
|
-
export { BasePricingSheet } from './director/BasePricingSheet';
|
|
43
|
-
export { BaseDiscountAdapter } from './director/BaseDiscountAdapter';
|
|
44
|
-
export { BaseDiscountDirector } from './director/BaseDiscountDirector';
|
|
26
|
+
export { BaseAdapter } from './director/BaseAdapter.js';
|
|
27
|
+
export { BaseDirector } from './director/BaseDirector.js';
|
|
28
|
+
export { BasePricingAdapter } from './director/BasePricingAdapter.js';
|
|
29
|
+
export { BasePricingDirector } from './director/BasePricingDirector.js';
|
|
30
|
+
export { BasePricingSheet } from './director/BasePricingSheet.js';
|
|
31
|
+
export { BaseDiscountAdapter } from './director/BaseDiscountAdapter.js';
|
|
32
|
+
export { BaseDiscountDirector } from './director/BaseDiscountDirector.js';
|
|
45
33
|
//# sourceMappingURL=utils-index.js.map
|
package/lib/utils-index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils-index.js","sourceRoot":"","sources":["../src/utils-index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"utils-index.js","sourceRoot":"","sources":["../src/utils-index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AACxE,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,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAExE;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D;;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,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,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.0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"main": "lib/utils-index.js",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./lib/utils-index.js",
|
|
@@ -30,18 +30,18 @@
|
|
|
30
30
|
},
|
|
31
31
|
"homepage": "https://github.com/unchainedshop/unchained#readme",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@unchainedshop/logger": "^2.0.0
|
|
33
|
+
"@unchainedshop/logger": "^2.0.0",
|
|
34
34
|
"abort-controller": "3.0.0",
|
|
35
|
-
"bson": "^4.7.
|
|
35
|
+
"bson": "^4.7.2",
|
|
36
36
|
"hashids": "^2.2.10",
|
|
37
|
-
"jest": "^29.
|
|
37
|
+
"jest": "^29.4.1",
|
|
38
38
|
"locale": "0.1.0",
|
|
39
39
|
"lru-cache": "^7.14.1",
|
|
40
40
|
"simpl-schema": "=3.2.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/node": "^18.11.18",
|
|
44
|
-
"@unchainedshop/types": "^2.0.0
|
|
44
|
+
"@unchainedshop/types": "^2.0.0",
|
|
45
45
|
"typescript": "^4.9.4"
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import SimpleSchema from 'simpl-schema';
|
|
2
|
-
import { Collection, _ID, Update, TimestampFields } from '@unchainedshop/types/common';
|
|
3
|
-
import { ModuleCreateMutation, ModuleMutations } from '@unchainedshop/types/core';
|
|
2
|
+
import { Collection, _ID, Update, TimestampFields } from '@unchainedshop/types/common.js';
|
|
3
|
+
import { ModuleCreateMutation, ModuleMutations } from '@unchainedshop/types/core.js';
|
|
4
4
|
|
|
5
|
-
import { checkId } from './check-id';
|
|
6
|
-
import { generateDbObjectId } from './generate-db-object-id';
|
|
7
|
-
import { generateDbFilterById } from './generate-db-filter-by-id';
|
|
5
|
+
import { checkId } from './check-id.js';
|
|
6
|
+
import { generateDbObjectId } from './generate-db-object-id.js';
|
|
7
|
+
import { generateDbFilterById } from './generate-db-filter-by-id.js';
|
|
8
8
|
|
|
9
9
|
export const generateDbMutations = <T extends TimestampFields & { _id?: _ID }>(
|
|
10
10
|
collection: Collection<T>,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IBaseAdapter, IBaseDirector } from '@unchainedshop/types/common';
|
|
1
|
+
import { IBaseAdapter, IBaseDirector } from '@unchainedshop/types/common.js';
|
|
2
2
|
import { log } from '@unchainedshop/logger';
|
|
3
3
|
|
|
4
4
|
export const BaseDirector = <AdapterType extends IBaseAdapter>(
|
|
@@ -25,12 +25,16 @@ export const BaseDirector = <AdapterType extends IBaseAdapter>(
|
|
|
25
25
|
|
|
26
26
|
registerAdapter: (Adapter) => {
|
|
27
27
|
log(
|
|
28
|
-
`${directorName} -> Registered ${keyField !== 'key' ? `${Adapter[keyField]}
|
|
28
|
+
`${directorName} -> Registered ${keyField !== 'key' ? `${Adapter[keyField]}` : ''} ${
|
|
29
29
|
Adapter.key
|
|
30
30
|
} ${Adapter.version} (${Adapter.label})`,
|
|
31
31
|
);
|
|
32
|
-
|
|
33
32
|
Adapters.set(Adapter[keyField], Adapter);
|
|
34
33
|
},
|
|
34
|
+
|
|
35
|
+
unregisterAdapter: (key) => {
|
|
36
|
+
log(`${directorName} -> Unregistered ${key}`);
|
|
37
|
+
return Adapters.delete(key);
|
|
38
|
+
},
|
|
35
39
|
};
|
|
36
40
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { log, LogLevel } from '@unchainedshop/logger';
|
|
2
2
|
|
|
3
|
-
import { IDiscountAdapter } from '@unchainedshop/types/discount';
|
|
3
|
+
import { IDiscountAdapter } from '@unchainedshop/types/discount.js';
|
|
4
4
|
|
|
5
5
|
export const BaseDiscountAdapter: Omit<IDiscountAdapter, 'key' | 'label' | 'version'> = {
|
|
6
6
|
orderIndex: 0,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IDiscountAdapter, IDiscountDirector } from '@unchainedshop/types/discount';
|
|
1
|
+
import { IDiscountAdapter, IDiscountDirector } from '@unchainedshop/types/discount.js';
|
|
2
2
|
import { log } from '@unchainedshop/logger';
|
|
3
|
-
import { BaseDirector } from './BaseDirector';
|
|
3
|
+
import { BaseDirector } from './BaseDirector.js';
|
|
4
4
|
|
|
5
5
|
export const BaseDiscountDirector = (directorName: string): IDiscountDirector => {
|
|
6
6
|
const baseDirector = BaseDirector<IDiscountAdapter>(directorName, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Discount } from '@unchainedshop/types/discount';
|
|
1
|
+
import { Discount } from '@unchainedshop/types/discount.js';
|
|
2
2
|
import {
|
|
3
3
|
BasePricingAdapterContext,
|
|
4
4
|
BasePricingContext,
|
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
IPricingSheet,
|
|
8
8
|
PricingCalculation,
|
|
9
9
|
IPricingAdapterActions,
|
|
10
|
-
} from '@unchainedshop/types/pricing';
|
|
10
|
+
} from '@unchainedshop/types/pricing.js';
|
|
11
11
|
import { log, LogLevel } from '@unchainedshop/logger';
|
|
12
|
-
import { BaseDirector } from './BaseDirector';
|
|
12
|
+
import { BaseDirector } from './BaseDirector.js';
|
|
13
13
|
|
|
14
14
|
export const BasePricingDirector = <
|
|
15
15
|
DirectorContext extends BasePricingContext,
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
PricingCalculation,
|
|
3
|
+
IBasePricingSheet,
|
|
4
|
+
PricingSheetParams,
|
|
5
|
+
} from '@unchainedshop/types/pricing.js';
|
|
2
6
|
|
|
3
7
|
export const BasePricingSheet = <Calculation extends PricingCalculation>(
|
|
4
8
|
params: PricingSheetParams<Calculation>,
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { BaseDirector } from "./BaseDirector.js";
|
|
2
|
+
|
|
3
|
+
const adapter1 = {
|
|
4
|
+
key: 'adapter1',
|
|
5
|
+
label: 'Adapter 1',
|
|
6
|
+
version: '1',
|
|
7
|
+
log: import.meta.jest.fn(),
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const adapter2 = {
|
|
11
|
+
key: 'adapter2',
|
|
12
|
+
label: 'Adapter 2',
|
|
13
|
+
version: '2',
|
|
14
|
+
log: import.meta.jest.fn(),
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const adapter3 = {
|
|
18
|
+
key: 'adapter3',
|
|
19
|
+
label: 'Adapter 3',
|
|
20
|
+
version: '3',
|
|
21
|
+
log: import.meta.jest.fn(),
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
describe('BaseDirector', () => {
|
|
25
|
+
let director;
|
|
26
|
+
|
|
27
|
+
beforeEach(() => {
|
|
28
|
+
director = BaseDirector('TestDirector');
|
|
29
|
+
director.registerAdapter(adapter1);
|
|
30
|
+
director.registerAdapter(adapter3);
|
|
31
|
+
director.registerAdapter(adapter2);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
describe('registerAdapter', ()=> {
|
|
35
|
+
|
|
36
|
+
it('should add the adapter to the director', () => {
|
|
37
|
+
director.registerAdapter(adapter1);
|
|
38
|
+
expect(director.getAdapter(adapter1.key)).toBe(adapter1);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
xit('should generate a log message when an adapter is registered', () => {
|
|
42
|
+
const spy = import.meta.jest.spyOn(console, 'log')
|
|
43
|
+
expect(spy).toHaveBeenCalledWith(
|
|
44
|
+
'TestDirector -> Registered adapter1 1.0.0 (Adapter 1)',
|
|
45
|
+
);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('should allow multiple adapters to be registered', () => {
|
|
49
|
+
expect(director.getAdapter(adapter1.key)).toBe(adapter1);
|
|
50
|
+
expect(director.getAdapter(adapter2.key)).toBe(adapter2);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('should register an adapter and add it to the internal map', () => {
|
|
54
|
+
expect(director.getAdapter(adapter1.key)).toEqual(adapter1);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('should use the adapterKeyField specified in the options to store the adapter in the internal map', () => {
|
|
58
|
+
|
|
59
|
+
director = BaseDirector('TestDirector', {
|
|
60
|
+
adapterKeyField: 'label',
|
|
61
|
+
});
|
|
62
|
+
director.registerAdapter(adapter1);
|
|
63
|
+
expect(director.getAdapter(adapter1.label)).toEqual(adapter1);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('should return the correct Adapter object', () => {
|
|
67
|
+
const directorName = 'TestDirector';
|
|
68
|
+
const adapterKeyField = 'key';
|
|
69
|
+
director = BaseDirector(directorName, { adapterKeyField });
|
|
70
|
+
director.registerAdapter(adapter1);
|
|
71
|
+
|
|
72
|
+
expect(director.getAdapter(adapter1.key)).toEqual(adapter1);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('should return undefined if the Adapter does not exist', () => {
|
|
76
|
+
const directorName = 'TestDirector';
|
|
77
|
+
const adapterKeyField = 'key';
|
|
78
|
+
director = BaseDirector(directorName, { adapterKeyField });
|
|
79
|
+
expect(director.getAdapter(adapter1.key)).toBeUndefined();
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
describe('getAdapter', () => {
|
|
86
|
+
it('should return the correct Adapter object for a given key', () => {
|
|
87
|
+
// Expect that calling getAdapter with the key 'foo' returns the fooAdapter
|
|
88
|
+
expect(director.getAdapter(adapter1.key)).toBe(adapter1);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it('should return undefined if no Adapter is registered with the given key', () => {
|
|
92
|
+
// Expect that calling getAdapter with a key that has not been registered returns undefined
|
|
93
|
+
expect(director.getAdapter('invalid-key')).toBeUndefined();
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it('should return the correct Adapter object when the keyField is set to a property other than "key"', () => {
|
|
97
|
+
// Create a director with the keyField option set to 'label'
|
|
98
|
+
director = BaseDirector('TestDirector', { adapterKeyField: 'label' });
|
|
99
|
+
director.registerAdapter(adapter1);
|
|
100
|
+
expect(director.getAdapter(adapter1.label)).toBe(adapter1);
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
describe('getAdapters', () => {
|
|
105
|
+
it('should return an array of registered Adapter objects', () => {
|
|
106
|
+
expect(director.getAdapters()).toEqual([adapter1, adapter3, adapter2]);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it('should return an empty array if no Adapter objects have been registered', () => {
|
|
110
|
+
const directorName = 'TestDirector';
|
|
111
|
+
const adapterKeyField = 'key';
|
|
112
|
+
const baseDirector = BaseDirector(directorName, { adapterKeyField });
|
|
113
|
+
expect(baseDirector.getAdapters()).toEqual([]);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it('should return an array of registered Adapter objects sorted by the adapterSortKey provided', () => {
|
|
117
|
+
director = BaseDirector('TestDirector', { adapterSortKey: 'version' });
|
|
118
|
+
director.registerAdapter(adapter1);
|
|
119
|
+
director.registerAdapter(adapter3);
|
|
120
|
+
director.registerAdapter(adapter2);
|
|
121
|
+
expect(director.getAdapters()).toEqual([adapter1, adapter2, adapter3]);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { BaseDiscountAdapter } from "./BaseDiscountAdapter.js";
|
|
2
|
+
|
|
3
|
+
describe("BaseDiscountAdapter instantiation", () => {
|
|
4
|
+
const adapter = BaseDiscountAdapter;
|
|
5
|
+
const context = null
|
|
6
|
+
it("should initialize with default values", () => {
|
|
7
|
+
expect(adapter.orderIndex).toEqual(0);
|
|
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({
|
|
13
|
+
isValidForSystemTriggering: expect.any(Function),
|
|
14
|
+
reserve: expect.any(Function),
|
|
15
|
+
release: expect.any(Function),
|
|
16
|
+
isValidForCodeTriggering: expect.any(Function),
|
|
17
|
+
discountForPricingAdapterKey: expect.any(Function),
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
describe('actions', ()=> {
|
|
22
|
+
const actions = adapter.actions(context)
|
|
23
|
+
|
|
24
|
+
it('isValidForSystemTriggering', async () => {
|
|
25
|
+
const result = await adapter.actions(context);
|
|
26
|
+
|
|
27
|
+
expect(await result.isValidForSystemTriggering()).toEqual(false)
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
it('reserve', async () => {
|
|
31
|
+
const result = await adapter.actions(context);
|
|
32
|
+
expect(await result.reserve({code: ''})).toEqual({})
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
it('release', async () => {
|
|
36
|
+
const result = await adapter.actions(context);
|
|
37
|
+
expect(await result.release()).toEqual(null)
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
it('isValidForCodeTriggering', async () => {
|
|
41
|
+
const result = await adapter.actions(context);
|
|
42
|
+
expect(await result.isValidForCodeTriggering({code: ''})).toEqual(false)
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
it('discountForPricingAdapterKey', async () => {
|
|
46
|
+
const result = await adapter.actions(context);
|
|
47
|
+
const calculationSheet = {}
|
|
48
|
+
expect(await result.discountForPricingAdapterKey({calculationSheet, pricingAdapterKey: 'key'} as any)).toEqual(null)
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
})
|
|
52
|
+
});
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { BasePricingSheet } from "./BasePricingSheet.js";
|
|
2
|
+
|
|
3
|
+
describe('BasePricingSheet', () => {
|
|
4
|
+
let pricingSheet;
|
|
5
|
+
const TAX = { category: 'tax', amount: 100 };
|
|
6
|
+
const DISCOUNT = { category: 'discount', amount: 50 };
|
|
7
|
+
const ITEM1 = { category: 'item', amount: 200 };
|
|
8
|
+
const ITEM2 = { category: 'item', amount: 200 };
|
|
9
|
+
const calculations = [TAX, DISCOUNT, ITEM1, ITEM2];
|
|
10
|
+
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
pricingSheet = BasePricingSheet({
|
|
13
|
+
calculation: calculations,
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('gross() calculates the sum of the amounts in the calculations', () => {
|
|
18
|
+
expect(pricingSheet.gross()).toEqual(550);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('gross() returns 0 if the calculation is empty', () => {
|
|
22
|
+
expect(BasePricingSheet({ calculation: [] }).gross()).toEqual(0);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
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
|
+
});
|
|
34
|
+
|
|
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
|
+
});
|
|
38
|
+
|
|
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
|
+
});
|
|
46
|
+
|
|
47
|
+
it('calculates the correct sum for a given category', () => {
|
|
48
|
+
expect(pricingSheet.sum({ category: 'item' })).toEqual(400);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('calculates the correct tax amount', () => {
|
|
52
|
+
expect(pricingSheet.taxSum()).toEqual(0);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
describe('getRawPricingSheet', () => {
|
|
58
|
+
it('returns the correct list of calculations', () => {
|
|
59
|
+
expect(pricingSheet.getRawPricingSheet()).toEqual(calculations);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('returns an empty list of calculations if none are provided', () => {
|
|
63
|
+
expect(BasePricingSheet({}).getRawPricingSheet()).toEqual([]);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
describe('isValid', () => {
|
|
69
|
+
it('returns true if the sheet has calculations', () => {
|
|
70
|
+
expect(pricingSheet.isValid()).toEqual(true);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('returns false if the sheet does not have calculations', () => {
|
|
74
|
+
expect(BasePricingSheet({}).isValid()).toEqual(false);
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
describe('filterBy', () => {
|
|
79
|
+
it('filters the list of calculations correctly', () => {
|
|
80
|
+
expect(pricingSheet.filterBy({ category: 'item' })).toEqual([ITEM1, ITEM2]);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it('returns the full list of calculations if no filter is provided', () => {
|
|
84
|
+
expect(pricingSheet.filterBy()).toEqual(calculations);
|
|
85
|
+
})
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
describe('resetCalculation', () => {
|
|
91
|
+
it('resets the list of calculations correctly', () => {
|
|
92
|
+
const expectedCalculations = calculations.reduce((prev,{ amount, ...row}) => {
|
|
93
|
+
return [
|
|
94
|
+
...prev,
|
|
95
|
+
{
|
|
96
|
+
...row,
|
|
97
|
+
amount: -amount
|
|
98
|
+
}
|
|
99
|
+
]
|
|
100
|
+
}, [...calculations])
|
|
101
|
+
expect(pricingSheet.resetCalculation(pricingSheet)).toEqual(expectedCalculations);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import 'abort-controller/polyfill';
|
|
1
|
+
import 'abort-controller/polyfill.js';
|
|
2
2
|
import LRU from 'lru-cache';
|
|
3
|
-
import { Collection, Filter, Locale, Document } from '@unchainedshop/types/common';
|
|
4
|
-
import { systemLocale } from './locale-helpers';
|
|
3
|
+
import { Collection, Filter, Locale, Document } from '@unchainedshop/types/common.js';
|
|
4
|
+
import { systemLocale } from './locale-helpers.js';
|
|
5
5
|
|
|
6
6
|
const { NODE_ENV } = process.env;
|
|
7
7
|
|
|
@@ -31,7 +31,9 @@ const findLocalizedText = async <T extends Document>(
|
|
|
31
31
|
|
|
32
32
|
if (cachedText) return cachedText as T;
|
|
33
33
|
|
|
34
|
-
const exactTranslation = await collection.findOne(extendSelectorWithLocale(selector, locale), {
|
|
34
|
+
const exactTranslation = await collection.findOne(extendSelectorWithLocale(selector, locale), {
|
|
35
|
+
sort: { updated: -1 },
|
|
36
|
+
});
|
|
35
37
|
if (exactTranslation) {
|
|
36
38
|
textCache.set(cacheKey, exactTranslation);
|
|
37
39
|
return exactTranslation as T;
|
|
@@ -40,7 +42,9 @@ const findLocalizedText = async <T extends Document>(
|
|
|
40
42
|
if (systemLocale.normalized !== locale.normalized) {
|
|
41
43
|
const fallbackTranslation = await collection.findOne(
|
|
42
44
|
extendSelectorWithLocale(selector, systemLocale),
|
|
43
|
-
{
|
|
45
|
+
{
|
|
46
|
+
sort: { updated: -1 },
|
|
47
|
+
},
|
|
44
48
|
);
|
|
45
49
|
if (fallbackTranslation) {
|
|
46
50
|
textCache.set(cacheKey, fallbackTranslation);
|
|
@@ -48,7 +52,9 @@ const findLocalizedText = async <T extends Document>(
|
|
|
48
52
|
}
|
|
49
53
|
}
|
|
50
54
|
|
|
51
|
-
const foundText = await collection.findOne(selector, {
|
|
55
|
+
const foundText = await collection.findOne(selector, {
|
|
56
|
+
sort: { updated: -1 },
|
|
57
|
+
});
|
|
52
58
|
textCache.set(cacheKey, foundText);
|
|
53
59
|
return foundText as T;
|
|
54
60
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import SimpleSchema from 'simpl-schema';
|
|
2
|
-
import { AddressSchema } from './AddressSchema';
|
|
3
|
-
import { timestampFields } from './commonSchemaFields';
|
|
2
|
+
import { AddressSchema } from './AddressSchema.js';
|
|
3
|
+
import { timestampFields } from './commonSchemaFields.js';
|
|
4
4
|
|
|
5
5
|
const ProfileSchema = new SimpleSchema(
|
|
6
6
|
{
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import SimpleSchema from 'simpl-schema';
|
|
2
|
+
import { timestampFields, contextFields, logFields } from './commonSchemaFields.js';
|
|
3
|
+
import { AddressSchema } from './AddressSchema.js';
|
|
4
|
+
import { ContactSchema } from './ContactSchema.js';
|
|
5
|
+
import { UserSchema } from './UsersSchema.js';
|
|
6
|
+
|
|
7
|
+
const Schemas = {
|
|
8
|
+
timestampFields,
|
|
9
|
+
contextFields,
|
|
10
|
+
logFields,
|
|
11
|
+
Address: AddressSchema,
|
|
12
|
+
Contact: ContactSchema,
|
|
13
|
+
User: UserSchema,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { Schemas };
|
|
17
|
+
|
|
18
|
+
export type { SimpleSchema };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { SortDirection } from '@unchainedshop/types/api';
|
|
2
|
+
import { SortDirection } from '@unchainedshop/types/api.js';
|
|
3
3
|
import {
|
|
4
4
|
buildSortOptions,
|
|
5
5
|
checkId,
|
|
@@ -15,11 +15,10 @@ import {
|
|
|
15
15
|
resolveBestCountry,
|
|
16
16
|
resolveBestSupported,
|
|
17
17
|
resolveUserRemoteAddress,
|
|
18
|
-
|
|
19
18
|
slugify,
|
|
20
19
|
systemLocale,
|
|
21
20
|
} from '@unchainedshop/utils';
|
|
22
|
-
import generateHashId from '
|
|
21
|
+
import generateHashId from './generate-random-hash.js'
|
|
23
22
|
|
|
24
23
|
describe('Utils', () => {
|
|
25
24
|
|
package/src/utils-index.ts
CHANGED
|
@@ -1,52 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export { default as
|
|
7
|
-
export
|
|
8
|
-
export { default as
|
|
9
|
-
export { default as
|
|
10
|
-
export { default as slugify } from './slugify';
|
|
11
|
-
export { default as pipePromises } from './pipe-promises';
|
|
12
|
-
export { default as generateRandomHash } from './generate-random-hash';
|
|
13
|
-
export { default as randomValueHex } from './random-value-hex';
|
|
14
|
-
export { default as buildSortOptions } from './db/build-sort-option';
|
|
1
|
+
export { default as findLocalizedText } from './find-localized-text.js';
|
|
2
|
+
export * from './locale-helpers.js';
|
|
3
|
+
export { default as objectInvert } from './object-invert.js';
|
|
4
|
+
export { default as findUnusedSlug } from './find-unused-slug.js';
|
|
5
|
+
export { default as slugify } from './slugify.js';
|
|
6
|
+
export { default as pipePromises } from './pipe-promises.js';
|
|
7
|
+
export { default as generateRandomHash } from './generate-random-hash.js';
|
|
8
|
+
export { default as randomValueHex } from './random-value-hex.js';
|
|
9
|
+
export { default as buildSortOptions } from './db/build-sort-option.js';
|
|
15
10
|
|
|
16
11
|
/*
|
|
17
12
|
* Db utils
|
|
18
13
|
*/
|
|
19
14
|
|
|
20
|
-
export { checkId } from './db/check-id';
|
|
21
|
-
export { generateDbObjectId } from './db/generate-db-object-id';
|
|
22
|
-
export { generateDbFilterById } from './db/generate-db-filter-by-id';
|
|
23
|
-
export { generateDbMutations } from './db/generate-db-mutations';
|
|
24
|
-
export { buildDbIndexes } from './db/build-db-indexes';
|
|
25
|
-
export { findPreservingIds } from './find-preserving-ids';
|
|
15
|
+
export { checkId } from './db/check-id.js';
|
|
16
|
+
export { generateDbObjectId } from './db/generate-db-object-id.js';
|
|
17
|
+
export { generateDbFilterById } from './db/generate-db-filter-by-id.js';
|
|
18
|
+
export { generateDbMutations } from './db/generate-db-mutations.js';
|
|
19
|
+
export { buildDbIndexes } from './db/build-db-indexes.js';
|
|
20
|
+
export { findPreservingIds } from './find-preserving-ids.js';
|
|
26
21
|
|
|
27
22
|
/*
|
|
28
23
|
* Schemas
|
|
29
24
|
*/
|
|
30
25
|
|
|
31
|
-
|
|
32
|
-
timestampFields,
|
|
33
|
-
contextFields,
|
|
34
|
-
logFields,
|
|
35
|
-
Address: AddressSchema,
|
|
36
|
-
Contact: ContactSchema,
|
|
37
|
-
User: UserSchema,
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export { Schemas };
|
|
26
|
+
export { Schemas } from './schemas/index.js';
|
|
41
27
|
|
|
42
28
|
/*
|
|
43
29
|
* Director
|
|
44
30
|
*/
|
|
45
31
|
|
|
46
|
-
export { BaseAdapter } from './director/BaseAdapter';
|
|
47
|
-
export { BaseDirector } from './director/BaseDirector';
|
|
48
|
-
export { BasePricingAdapter } from './director/BasePricingAdapter';
|
|
49
|
-
export { BasePricingDirector } from './director/BasePricingDirector';
|
|
50
|
-
export { BasePricingSheet } from './director/BasePricingSheet';
|
|
51
|
-
export { BaseDiscountAdapter } from './director/BaseDiscountAdapter';
|
|
52
|
-
export { BaseDiscountDirector } from './director/BaseDiscountDirector';
|
|
32
|
+
export { BaseAdapter } from './director/BaseAdapter.js';
|
|
33
|
+
export { BaseDirector } from './director/BaseDirector.js';
|
|
34
|
+
export { BasePricingAdapter } from './director/BasePricingAdapter.js';
|
|
35
|
+
export { BasePricingDirector } from './director/BasePricingDirector.js';
|
|
36
|
+
export { BasePricingSheet } from './director/BasePricingSheet.js';
|
|
37
|
+
export { BaseDiscountAdapter } from './director/BaseDiscountAdapter.js';
|
|
38
|
+
export { BaseDiscountDirector } from './director/BaseDiscountDirector.js';
|
package/tsconfig.json
CHANGED
|
@@ -1,29 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
+
"extends": "../shared/base.tsconfig.json",
|
|
2
3
|
"compilerOptions": {
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"declaration": true,
|
|
6
|
-
"esModuleInterop": true,
|
|
7
|
-
"experimentalDecorators": true,
|
|
8
|
-
"forceConsistentCasingInFileNames": true,
|
|
9
|
-
"lib": [
|
|
10
|
-
"esnext"
|
|
11
|
-
],
|
|
12
|
-
"module": "esnext",
|
|
13
|
-
"moduleResolution": "node",
|
|
14
|
-
"noImplicitReturns": true,
|
|
15
|
-
"noUnusedLocals": false,
|
|
16
|
-
"outDir": "lib",
|
|
17
|
-
"preserveWatchOutput": true,
|
|
18
|
-
"skipLibCheck": true,
|
|
19
|
-
"sourceMap": true,
|
|
20
|
-
"target": "esnext",
|
|
21
|
-
"types": [
|
|
22
|
-
"node",
|
|
23
|
-
"jest"
|
|
24
|
-
]
|
|
4
|
+
"rootDir": "src",
|
|
5
|
+
"outDir": "lib"
|
|
25
6
|
},
|
|
7
|
+
"exclude": ["**/*.test.ts", "**/*.test.js", "tests"],
|
|
26
8
|
"include": [
|
|
27
|
-
"src"
|
|
9
|
+
"./src"
|
|
28
10
|
]
|
|
29
11
|
}
|