@unchainedshop/core-products 4.3.3 → 4.3.4

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 (57) hide show
  1. package/package.json +1 -1
  2. package/lib/db/ProductMediaSchema.d.ts +0 -4
  3. package/lib/db/ProductMediaSchema.d.ts.map +0 -1
  4. package/lib/db/ProductMediaSchema.js +0 -22
  5. package/lib/db/ProductMediaSchema.js.map +0 -1
  6. package/lib/db/ProductReviewsSchema.d.ts +0 -8
  7. package/lib/db/ProductReviewsSchema.d.ts.map +0 -1
  8. package/lib/db/ProductReviewsSchema.js +0 -31
  9. package/lib/db/ProductReviewsSchema.js.map +0 -1
  10. package/lib/db/ProductStatus.d.ts +0 -6
  11. package/lib/db/ProductStatus.d.ts.map +0 -1
  12. package/lib/db/ProductStatus.js +0 -7
  13. package/lib/db/ProductStatus.js.map +0 -1
  14. package/lib/db/ProductVariationsSchema.d.ts +0 -8
  15. package/lib/db/ProductVariationsSchema.d.ts.map +0 -1
  16. package/lib/db/ProductVariationsSchema.js +0 -28
  17. package/lib/db/ProductVariationsSchema.js.map +0 -1
  18. package/lib/db/ProductsSchema.d.ts +0 -11
  19. package/lib/db/ProductsSchema.d.ts.map +0 -1
  20. package/lib/db/ProductsSchema.js +0 -106
  21. package/lib/db/ProductsSchema.js.map +0 -1
  22. package/lib/director/ProductDiscountAdapter.d.ts +0 -4
  23. package/lib/director/ProductDiscountAdapter.d.ts.map +0 -1
  24. package/lib/director/ProductDiscountAdapter.js +0 -3
  25. package/lib/director/ProductDiscountAdapter.js.map +0 -1
  26. package/lib/director/ProductDiscountConfiguration.d.ts +0 -13
  27. package/lib/director/ProductDiscountConfiguration.d.ts.map +0 -1
  28. package/lib/director/ProductDiscountConfiguration.js +0 -2
  29. package/lib/director/ProductDiscountConfiguration.js.map +0 -1
  30. package/lib/director/ProductDiscountDirector.d.ts +0 -3
  31. package/lib/director/ProductDiscountDirector.d.ts.map +0 -1
  32. package/lib/director/ProductDiscountDirector.js +0 -3
  33. package/lib/director/ProductDiscountDirector.js.map +0 -1
  34. package/lib/director/ProductPricingAdapter.d.ts +0 -3
  35. package/lib/director/ProductPricingAdapter.d.ts.map +0 -1
  36. package/lib/director/ProductPricingAdapter.js +0 -25
  37. package/lib/director/ProductPricingAdapter.js.map +0 -1
  38. package/lib/director/ProductPricingDirector.d.ts +0 -3
  39. package/lib/director/ProductPricingDirector.d.ts.map +0 -1
  40. package/lib/director/ProductPricingDirector.js +0 -59
  41. package/lib/director/ProductPricingDirector.js.map +0 -1
  42. package/lib/director/ProductPricingSheet.d.ts +0 -4
  43. package/lib/director/ProductPricingSheet.d.ts.map +0 -1
  44. package/lib/director/ProductPricingSheet.js +0 -78
  45. package/lib/director/ProductPricingSheet.js.map +0 -1
  46. package/lib/migrations/addMigrations.d.ts +0 -3
  47. package/lib/migrations/addMigrations.d.ts.map +0 -1
  48. package/lib/migrations/addMigrations.js +0 -35
  49. package/lib/migrations/addMigrations.js.map +0 -1
  50. package/lib/service/productServices.d.ts +0 -3
  51. package/lib/service/productServices.d.ts.map +0 -1
  52. package/lib/service/productServices.js +0 -5
  53. package/lib/service/productServices.js.map +0 -1
  54. package/lib/service/removeProductService.d.ts +0 -3
  55. package/lib/service/removeProductService.d.ts.map +0 -1
  56. package/lib/service/removeProductService.js +0 -21
  57. package/lib/service/removeProductService.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unchainedshop/core-products",
3
- "version": "4.3.3",
3
+ "version": "4.3.4",
4
4
  "main": "lib/products-index.js",
5
5
  "types": "lib/products-index.d.ts",
6
6
  "type": "module",
@@ -1,4 +0,0 @@
1
- import SimpleSchema from 'simpl-schema';
2
- export declare const ProductMediaSchema: SimpleSchema;
3
- export declare const ProductMediaTextsSchema: SimpleSchema;
4
- //# sourceMappingURL=ProductMediaSchema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProductMediaSchema.d.ts","sourceRoot":"","sources":["../../src/db/ProductMediaSchema.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,cAAc,CAAC;AAExC,eAAO,MAAM,kBAAkB,cAW9B,CAAC;AAEF,eAAO,MAAM,uBAAuB,cAYnC,CAAC"}
@@ -1,22 +0,0 @@
1
- import { Schemas } from '@unchainedshop/utils';
2
- import SimpleSchema from 'simpl-schema';
3
- export const ProductMediaSchema = new SimpleSchema({
4
- mediaId: { type: String, required: true },
5
- productId: { type: String, required: true },
6
- sortKey: { type: Number, required: true },
7
- tags: Array,
8
- 'tags.$': String,
9
- meta: { type: Object, blackbox: true },
10
- ...Schemas.timestampFields,
11
- }, { requiredByDefault: false });
12
- export const ProductMediaTextsSchema = new SimpleSchema({
13
- productMediaId: {
14
- type: String,
15
- required: true,
16
- },
17
- locale: String,
18
- title: String,
19
- subtitle: String,
20
- ...Schemas.timestampFields,
21
- }, { requiredByDefault: false });
22
- //# sourceMappingURL=ProductMediaSchema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProductMediaSchema.js","sourceRoot":"","sources":["../../src/db/ProductMediaSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,YAAY,MAAM,cAAc,CAAC;AAExC,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,YAAY,CAChD;IACE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACzC,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC3C,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACzC,IAAI,EAAE,KAAK;IACX,QAAQ,EAAE,MAAM;IAChB,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACtC,GAAG,OAAO,CAAC,eAAe;CAC3B,EACD,EAAE,iBAAiB,EAAE,KAAK,EAAE,CAC7B,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,YAAY,CACrD;IACE,cAAc,EAAE;QACd,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;KACf;IACD,MAAM,EAAE,MAAM;IACd,KAAK,EAAE,MAAM;IACb,QAAQ,EAAE,MAAM;IAChB,GAAG,OAAO,CAAC,eAAe;CAC3B,EACD,EAAE,iBAAiB,EAAE,KAAK,EAAE,CAC7B,CAAC"}
@@ -1,8 +0,0 @@
1
- import SimpleSchema from 'simpl-schema';
2
- export declare const ProductReviewVoteTypes: {
3
- UPVOTE: string;
4
- DOWNVOTE: string;
5
- REPORT: string;
6
- };
7
- export declare const ProductReviewsSchema: SimpleSchema;
8
- //# sourceMappingURL=ProductReviewsSchema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProductReviewsSchema.d.ts","sourceRoot":"","sources":["../../src/db/ProductReviewsSchema.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,cAAc,CAAC;AAExC,eAAO,MAAM,sBAAsB;;;;CAIlC,CAAC;AAEF,eAAO,MAAM,oBAAoB,cAyBhC,CAAC"}
@@ -1,31 +0,0 @@
1
- import { Schemas } from '@unchainedshop/utils';
2
- import SimpleSchema from 'simpl-schema';
3
- export const ProductReviewVoteTypes = {
4
- UPVOTE: 'UPVOTE',
5
- DOWNVOTE: 'DOWNVOTE',
6
- REPORT: 'REPORT',
7
- };
8
- export const ProductReviewsSchema = new SimpleSchema({
9
- productId: { type: String, required: true },
10
- authorId: { type: String, required: true },
11
- rating: {
12
- type: SimpleSchema.Integer,
13
- min: 1,
14
- max: 100,
15
- },
16
- title: String,
17
- review: String,
18
- meta: { type: Object, blackbox: true },
19
- votes: Array,
20
- 'votes.$': { type: Object, required: true },
21
- 'votes.$.timestamp': { type: Date, required: true },
22
- 'votes.$.userId': { type: String, required: true },
23
- 'votes.$.type': {
24
- type: String,
25
- required: true,
26
- allowedValues: Object.values(ProductReviewVoteTypes),
27
- },
28
- 'votes.$.meta': { type: Object, blackbox: true },
29
- ...Schemas.timestampFields,
30
- }, { requiredByDefault: false });
31
- //# sourceMappingURL=ProductReviewsSchema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProductReviewsSchema.js","sourceRoot":"","sources":["../../src/db/ProductReviewsSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,YAAY,MAAM,cAAc,CAAC;AAExC,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,QAAQ;CACjB,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,YAAY,CAClD;IACE,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC3C,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC1C,MAAM,EAAE;QACN,IAAI,EAAE,YAAY,CAAC,OAAO;QAC1B,GAAG,EAAE,CAAC;QACN,GAAG,EAAE,GAAG;KACT;IACD,KAAK,EAAE,MAAM;IACb,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACtC,KAAK,EAAE,KAAK;IACZ,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC3C,mBAAmB,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;IACnD,gBAAgB,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IAClD,cAAc,EAAE;QACd,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;QACd,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC;KACrD;IACD,cAAc,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IAChD,GAAG,OAAO,CAAC,eAAe;CAC3B,EACD,EAAE,iBAAiB,EAAE,KAAK,EAAE,CAC7B,CAAC"}
@@ -1,6 +0,0 @@
1
- export declare enum ProductStatus {
2
- DRAFT = "DRAFT",
3
- ACTIVE = "ACTIVE",
4
- DELETED = "DELETED"
5
- }
6
- //# sourceMappingURL=ProductStatus.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProductStatus.d.ts","sourceRoot":"","sources":["../../src/db/ProductStatus.ts"],"names":[],"mappings":"AAAA,oBAAY,aAAa;IACvB,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,OAAO,YAAY;CACpB"}
@@ -1,7 +0,0 @@
1
- export var ProductStatus;
2
- (function (ProductStatus) {
3
- ProductStatus["DRAFT"] = "DRAFT";
4
- ProductStatus["ACTIVE"] = "ACTIVE";
5
- ProductStatus["DELETED"] = "DELETED";
6
- })(ProductStatus || (ProductStatus = {}));
7
- //# sourceMappingURL=ProductStatus.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProductStatus.js","sourceRoot":"","sources":["../../src/db/ProductStatus.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,gCAAe,CAAA;IACf,kCAAiB,CAAA;IACjB,oCAAmB,CAAA;AACrB,CAAC,EAJW,aAAa,KAAb,aAAa,QAIxB"}
@@ -1,8 +0,0 @@
1
- import SimpleSchema from 'simpl-schema';
2
- export declare const ProductVariationType: {
3
- COLOR: string;
4
- TEXT: string;
5
- };
6
- export declare const ProductVariationsSchema: SimpleSchema;
7
- export declare const ProductVariationTextsSchema: SimpleSchema;
8
- //# sourceMappingURL=ProductVariationsSchema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProductVariationsSchema.d.ts","sourceRoot":"","sources":["../../src/db/ProductVariationsSchema.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,cAAc,CAAC;AAExC,eAAO,MAAM,oBAAoB;;;CAGhC,CAAC;AAEF,eAAO,MAAM,uBAAuB,cAYnC,CAAC;AAEF,eAAO,MAAM,2BAA2B,cAavC,CAAC"}
@@ -1,28 +0,0 @@
1
- import { Schemas } from '@unchainedshop/utils';
2
- import SimpleSchema from 'simpl-schema';
3
- export const ProductVariationType = {
4
- COLOR: 'COLOR',
5
- TEXT: 'TEXT',
6
- };
7
- export const ProductVariationsSchema = new SimpleSchema({
8
- productId: { type: String, required: true },
9
- key: String,
10
- type: String,
11
- tags: Array,
12
- 'tags.$': String,
13
- options: Array,
14
- 'options.$': String,
15
- ...Schemas.timestampFields,
16
- }, { requiredByDefault: false });
17
- export const ProductVariationTextsSchema = new SimpleSchema({
18
- productVariationId: {
19
- type: String,
20
- required: true,
21
- },
22
- productVariationOptionValue: String,
23
- locale: String,
24
- title: String,
25
- subtitle: String,
26
- ...Schemas.timestampFields,
27
- }, { requiredByDefault: false });
28
- //# sourceMappingURL=ProductVariationsSchema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProductVariationsSchema.js","sourceRoot":"","sources":["../../src/db/ProductVariationsSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,YAAY,MAAM,cAAc,CAAC;AAExC,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;CACb,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,YAAY,CACrD;IACE,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC3C,GAAG,EAAE,MAAM;IACX,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,KAAK;IACX,QAAQ,EAAE,MAAM;IAChB,OAAO,EAAE,KAAK;IACd,WAAW,EAAE,MAAM;IACnB,GAAG,OAAO,CAAC,eAAe;CAC3B,EACD,EAAE,iBAAiB,EAAE,KAAK,EAAE,CAC7B,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG,IAAI,YAAY,CACzD;IACE,kBAAkB,EAAE;QAClB,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;KACf;IACD,2BAA2B,EAAE,MAAM;IACnC,MAAM,EAAE,MAAM;IACd,KAAK,EAAE,MAAM;IACb,QAAQ,EAAE,MAAM;IAChB,GAAG,OAAO,CAAC,eAAe;CAC3B,EACD,EAAE,iBAAiB,EAAE,KAAK,EAAE,CAC7B,CAAC"}
@@ -1,11 +0,0 @@
1
- import SimpleSchema from 'simpl-schema';
2
- export declare const ProductTypes: {
3
- SimpleProduct: string;
4
- ConfigurableProduct: string;
5
- BundleProduct: string;
6
- PlanProduct: string;
7
- TokenizedProduct: string;
8
- };
9
- export declare const ProductsSchema: SimpleSchema;
10
- export declare const ProductTextsSchema: SimpleSchema;
11
- //# sourceMappingURL=ProductsSchema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProductsSchema.d.ts","sourceRoot":"","sources":["../../src/db/ProductsSchema.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,cAAc,CAAC;AAExC,eAAO,MAAM,YAAY;;;;;;CAMxB,CAAC;AAoFF,eAAO,MAAM,cAAc,cA6B1B,CAAC;AAEF,eAAO,MAAM,kBAAkB,cAe9B,CAAC"}
@@ -1,106 +0,0 @@
1
- import { Schemas } from '@unchainedshop/utils';
2
- import SimpleSchema from 'simpl-schema';
3
- export const ProductTypes = {
4
- SimpleProduct: 'SIMPLE_PRODUCT',
5
- ConfigurableProduct: 'CONFIGURABLE_PRODUCT',
6
- BundleProduct: 'BUNDLE_PRODUCT',
7
- PlanProduct: 'PLAN_PRODUCT',
8
- TokenizedProduct: 'TOKENIZED_PRODUCT',
9
- };
10
- const ProductCommerceSchema = new SimpleSchema({
11
- salesUnit: String,
12
- salesQuantityPerUnit: String,
13
- defaultOrderQuantity: Number,
14
- pricing: Array,
15
- 'pricing.$': Object,
16
- 'pricing.$.isTaxable': Boolean,
17
- 'pricing.$.isNetPrice': Boolean,
18
- 'pricing.$.countryCode': String,
19
- 'pricing.$.currencyCode': String,
20
- 'pricing.$.amount': Number,
21
- 'pricing.$.maxQuantity': Number,
22
- }, { requiredByDefault: false });
23
- const ProductWarehousingSchema = new SimpleSchema({
24
- baseUnit: String,
25
- sku: String,
26
- }, { requiredByDefault: false });
27
- const ProductTokenizationSchema = new SimpleSchema({
28
- contractAddress: String,
29
- contractStandard: String,
30
- ercMetadataProperties: { type: Object, blackbox: true, optional: true },
31
- tokenId: String,
32
- supply: Number,
33
- }, { requiredByDefault: true });
34
- const ProductSupplySchema = new SimpleSchema({
35
- weightInGram: Number,
36
- heightInMillimeters: Number,
37
- lengthInMillimeters: Number,
38
- widthInMillimeters: Number,
39
- }, { requiredByDefault: false });
40
- const ProductPlanSchema = new SimpleSchema({
41
- billingInterval: String,
42
- billingIntervalCount: Number,
43
- usageCalculationType: String,
44
- trialInterval: String,
45
- trialIntervalCount: Number,
46
- }, { requiredByDefault: false });
47
- const ProductProxySchema = new SimpleSchema({
48
- assignments: Array,
49
- 'assignments.$': Object,
50
- 'assignments.$.vector': { type: Object, blackbox: true },
51
- 'assignments.$.productId': String,
52
- }, { requiredByDefault: false });
53
- const ProductConfigurationSchema = new SimpleSchema({
54
- key: String,
55
- value: String,
56
- });
57
- const ProductBundleItemSchema = new SimpleSchema({
58
- productId: String,
59
- quantity: Number,
60
- configuration: {
61
- type: Array,
62
- defaultValue: [],
63
- },
64
- 'configuration.$': ProductConfigurationSchema,
65
- });
66
- export const ProductsSchema = new SimpleSchema({
67
- sequence: { type: Number, required: true },
68
- slugs: Array,
69
- 'slugs.$': String,
70
- type: {
71
- type: String,
72
- allowedValues: Object.values(ProductTypes),
73
- required: true,
74
- },
75
- status: String,
76
- published: Date,
77
- tags: Array,
78
- 'tags.$': String,
79
- commerce: ProductCommerceSchema,
80
- warehousing: ProductWarehousingSchema,
81
- supply: ProductSupplySchema,
82
- proxy: ProductProxySchema,
83
- plan: ProductPlanSchema,
84
- bundleItems: {
85
- type: Array,
86
- optional: true,
87
- },
88
- 'bundleItems.$': ProductBundleItemSchema,
89
- meta: { type: Object, blackbox: true },
90
- tokenization: ProductTokenizationSchema,
91
- ...Schemas.timestampFields,
92
- }, { requiredByDefault: false });
93
- export const ProductTextsSchema = new SimpleSchema({
94
- productId: { type: String, required: true },
95
- locale: { type: String, required: true },
96
- vendor: String,
97
- brand: String,
98
- title: String,
99
- slug: String,
100
- subtitle: String,
101
- description: String,
102
- labels: Array,
103
- 'labels.$': String,
104
- ...Schemas.timestampFields,
105
- }, { requiredByDefault: false });
106
- //# sourceMappingURL=ProductsSchema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProductsSchema.js","sourceRoot":"","sources":["../../src/db/ProductsSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,YAAY,MAAM,cAAc,CAAC;AAExC,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,aAAa,EAAE,gBAAgB;IAC/B,mBAAmB,EAAE,sBAAsB;IAC3C,aAAa,EAAE,gBAAgB;IAC/B,WAAW,EAAE,cAAc;IAC3B,gBAAgB,EAAE,mBAAmB;CACtC,CAAC;AAEF,MAAM,qBAAqB,GAAG,IAAI,YAAY,CAC5C;IACE,SAAS,EAAE,MAAM;IACjB,oBAAoB,EAAE,MAAM;IAC5B,oBAAoB,EAAE,MAAM;IAC5B,OAAO,EAAE,KAAK;IACd,WAAW,EAAE,MAAM;IACnB,qBAAqB,EAAE,OAAO;IAC9B,sBAAsB,EAAE,OAAO;IAC/B,uBAAuB,EAAE,MAAM;IAC/B,wBAAwB,EAAE,MAAM;IAChC,kBAAkB,EAAE,MAAM;IAC1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EAAE,IAAI,EAAE;IAC3C,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACxC,MAAM,EAAE,MAAM;IACd,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,MAAM;IAChB,WAAW,EAAE,MAAM;IACnB,MAAM,EAAE,KAAK;IACb,UAAU,EAAE,MAAM;IAClB,GAAG,OAAO,CAAC,eAAe;CAC3B,EACD,EAAE,iBAAiB,EAAE,KAAK,EAAE,CAC7B,CAAC"}
@@ -1,4 +0,0 @@
1
- import { IDiscountAdapter } from '@unchainedshop/types/discount.js';
2
- import { ProductDiscountConfiguration } from './ProductDiscountConfiguration.js';
3
- export declare const ProductDiscountAdapter: Omit<IDiscountAdapter<ProductDiscountConfiguration>, 'key' | 'label' | 'version'>;
4
- //# sourceMappingURL=ProductDiscountAdapter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProductDiscountAdapter.d.ts","sourceRoot":"","sources":["../../src/director/ProductDiscountAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AAEjF,eAAO,MAAM,sBAAsB,EAAE,IAAI,CACvC,gBAAgB,CAAC,4BAA4B,CAAC,EAC9C,KAAK,GAAG,OAAO,GAAG,SAAS,CACN,CAAC"}
@@ -1,3 +0,0 @@
1
- import { BaseDiscountAdapter } from '@unchainedshop/utils';
2
- export const ProductDiscountAdapter = BaseDiscountAdapter;
3
- //# sourceMappingURL=ProductDiscountAdapter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProductDiscountAdapter.js","sourceRoot":"","sources":["../../src/director/ProductDiscountAdapter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAG3D,MAAM,CAAC,MAAM,sBAAsB,GAG/B,mBAAmB,CAAC"}
@@ -1,13 +0,0 @@
1
- import { Product, ProductConfiguration } from '@unchainedshop/types/products.js';
2
- type ResolvedConfiguration = {
3
- fixedRate?: number;
4
- rate?: number;
5
- isNetPrice?: boolean;
6
- taxRate?: number;
7
- } & Record<string, any>;
8
- export type PriceConfigurationResolver = (product: Product, quantity: number, configuration: Array<ProductConfiguration>) => ResolvedConfiguration | null;
9
- export interface ProductDiscountConfiguration extends ResolvedConfiguration {
10
- customPriceConfigurationResolver?: PriceConfigurationResolver;
11
- }
12
- export {};
13
- //# sourceMappingURL=ProductDiscountConfiguration.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProductDiscountConfiguration.d.ts","sourceRoot":"","sources":["../../src/director/ProductDiscountConfiguration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAEjF,KAAK,qBAAqB,GAAG;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAExB,MAAM,MAAM,0BAA0B,GAAG,CACvC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,KAAK,CAAC,oBAAoB,CAAC,KACvC,qBAAqB,GAAG,IAAI,CAAC;AAElC,MAAM,WAAW,4BAA6B,SAAQ,qBAAqB;IACzE,gCAAgC,CAAC,EAAE,0BAA0B,CAAC;CAC/D"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=ProductDiscountConfiguration.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProductDiscountConfiguration.js","sourceRoot":"","sources":["../../src/director/ProductDiscountConfiguration.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- import { ProductDiscountConfiguration } from './ProductDiscountConfiguration.js';
2
- export declare const ProductDiscountDirector: import("@unchainedshop/types/discount.js").IDiscountDirector<ProductDiscountConfiguration>;
3
- //# sourceMappingURL=ProductDiscountDirector.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProductDiscountDirector.d.ts","sourceRoot":"","sources":["../../src/director/ProductDiscountDirector.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AAEjF,eAAO,MAAM,uBAAuB,4FAC2C,CAAC"}
@@ -1,3 +0,0 @@
1
- import { BaseDiscountDirector } from '@unchainedshop/utils';
2
- export const ProductDiscountDirector = BaseDiscountDirector('ProductDiscountDirector');
3
- //# sourceMappingURL=ProductDiscountDirector.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProductDiscountDirector.js","sourceRoot":"","sources":["../../src/director/ProductDiscountDirector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAG5D,MAAM,CAAC,MAAM,uBAAuB,GAClC,oBAAoB,CAA+B,yBAAyB,CAAC,CAAC"}
@@ -1,3 +0,0 @@
1
- import { IProductPricingAdapter } from '@unchainedshop/types/products.pricing.js';
2
- export declare const ProductPricingAdapter: IProductPricingAdapter;
3
- //# sourceMappingURL=ProductPricingAdapter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProductPricingAdapter.d.ts","sourceRoot":"","sources":["../../src/director/ProductPricingAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,sBAAsB,EACvB,MAAM,0CAA0C,CAAC;AAMlD,eAAO,MAAM,qBAAqB,EAAE,sBAyBnC,CAAC"}
@@ -1,25 +0,0 @@
1
- import { BasePricingAdapter } from '@unchainedshop/utils';
2
- import { ProductPricingSheet } from './ProductPricingSheet.js';
3
- const basePricingAdapter = BasePricingAdapter();
4
- export const ProductPricingAdapter = {
5
- ...basePricingAdapter,
6
- isActivatedFor: () => {
7
- return false;
8
- },
9
- actions: (params) => {
10
- const { context } = params;
11
- const { currency, quantity } = context;
12
- const baseActions = basePricingAdapter.actions(params);
13
- const resultSheet = ProductPricingSheet({ currency, quantity });
14
- return {
15
- ...baseActions,
16
- calculate: async () => {
17
- const resultRaw = resultSheet.getRawPricingSheet();
18
- resultRaw.forEach(({ amount, category }) => basePricingAdapter.log(`Product Item Calculation -> ${category} ${amount}`));
19
- return resultRaw;
20
- },
21
- resultSheet: () => resultSheet,
22
- };
23
- },
24
- };
25
- //# sourceMappingURL=ProductPricingAdapter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProductPricingAdapter.js","sourceRoot":"","sources":["../../src/director/ProductPricingAdapter.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,MAAM,kBAAkB,GAAG,kBAAkB,EAA2D,CAAC;AAEzG,MAAM,CAAC,MAAM,qBAAqB,GAA2B;IAC3D,GAAG,kBAAkB;IAErB,cAAc,EAAE,GAAG,EAAE;QACnB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,EAAE,CAAC,MAAM,EAAE,EAAE;QAClB,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;QAC3B,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;QACvC,MAAM,WAAW,GAAG,kBAAkB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACvD,MAAM,WAAW,GAAG,mBAAmB,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC;QAEhE,OAAO;YACL,GAAG,WAAW;YACd,SAAS,EAAE,KAAK,IAAI,EAAE;gBACpB,MAAM,SAAS,GAAG,WAAW,CAAC,kBAAkB,EAAE,CAAC;gBACnD,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,CACzC,kBAAkB,CAAC,GAAG,CAAC,+BAA+B,QAAQ,IAAI,MAAM,EAAE,CAAC,CAC5E,CAAC;gBACF,OAAO,SAAS,CAAC;YACnB,CAAC;YACD,WAAW,EAAE,GAAG,EAAE,CAAC,WAAW;SAC/B,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -1,3 +0,0 @@
1
- import { IProductPricingDirector } from '@unchainedshop/types/products.pricing.js';
2
- export declare const ProductPricingDirector: IProductPricingDirector;
3
- //# sourceMappingURL=ProductPricingDirector.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProductPricingDirector.d.ts","sourceRoot":"","sources":["../../src/director/ProductPricingDirector.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,uBAAuB,EAIxB,MAAM,0CAA0C,CAAC;AAWlD,eAAO,MAAM,sBAAsB,EAAE,uBA2DpC,CAAC"}
@@ -1,59 +0,0 @@
1
- import { BasePricingDirector } from '@unchainedshop/utils';
2
- import { ProductPricingSheet } from './ProductPricingSheet.js';
3
- const baseDirector = BasePricingDirector('ProductPricingDirector');
4
- export const ProductPricingDirector = {
5
- ...baseDirector,
6
- async buildPricingContext(context, unchainedAPI) {
7
- const { modules } = unchainedAPI;
8
- if ('item' in context) {
9
- const { item } = context;
10
- const product = await modules.products.findProduct({
11
- productId: item.productId,
12
- });
13
- const order = await modules.orders.findOrder({
14
- orderId: item.orderId,
15
- });
16
- const user = await modules.users.findUserById(order.userId);
17
- const discounts = await modules.orders.discounts.findOrderDiscounts({
18
- orderId: item.orderId,
19
- });
20
- return {
21
- ...unchainedAPI,
22
- country: order.countryCode,
23
- currency: order.currency,
24
- discounts,
25
- order,
26
- product,
27
- quantity: item.quantity,
28
- configuration: item.configuration,
29
- user,
30
- };
31
- }
32
- return {
33
- ...unchainedAPI,
34
- country: context.country,
35
- currency: context.currency,
36
- discounts: [],
37
- order: context.order,
38
- product: context.product,
39
- quantity: context.quantity,
40
- configuration: context.configuration,
41
- user: context.user,
42
- };
43
- },
44
- async actions(pricingContext, unchainedAPI) {
45
- const actions = await baseDirector.actions(pricingContext, unchainedAPI, this.buildPricingContext);
46
- return {
47
- ...actions,
48
- calculationSheet() {
49
- const context = actions.getContext();
50
- return ProductPricingSheet({
51
- calculation: actions.getCalculation(),
52
- currency: context.currency,
53
- quantity: context.quantity,
54
- });
55
- },
56
- };
57
- },
58
- };
59
- //# sourceMappingURL=ProductPricingDirector.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProductPricingDirector.js","sourceRoot":"","sources":["../../src/director/ProductPricingDirector.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,MAAM,YAAY,GAAG,mBAAmB,CAKtC,wBAAwB,CAAC,CAAC;AAE5B,MAAM,CAAC,MAAM,sBAAsB,GAA4B;IAC7D,GAAG,YAAY;IAEf,KAAK,CAAC,mBAAmB,CAAC,OAAO,EAAE,YAAY;QAC7C,MAAM,EAAE,OAAO,EAAE,GAAG,YAAY,CAAC;QAEjC,IAAI,MAAM,IAAI,OAAO,EAAE,CAAC;YACtB,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;YACzB,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC;gBACjD,SAAS,EAAE,IAAI,CAAC,SAAS;aAC1B,CAAC,CAAC;YACH,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC;gBAC3C,OAAO,EAAE,IAAI,CAAC,OAAO;aACtB,CAAC,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YAC5D,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC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heetParams } from '@unchainedshop/types/pricing.js';
3
- export declare const ProductPricingSheet: (params: PricingSheetParams<ProductPricingCalculation>) => IProductPricingSheet;
4
- //# sourceMappingURL=ProductPricingSheet.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProductPricingSheet.d.ts","sourceRoot":"","sources":["../../src/director/ProductPricingSheet.ts"],"names":[],"mappings":"AACA,OAAO,EACL,yBAAyB,EAEzB,oBAAoB,EACrB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE,eAAO,MAAM,mBAAmB,WACtB,kBAAkB,CAAC,yBAAyB,CAAC,KACpD,oBAmFF,CAAC"}
@@ -1,78 +0,0 @@
1
- import { BasePricingSheet } from '@unchainedshop/utils';
2
- import { ProductPricingRowCategory, } from '@unchainedshop/types/products.pricing.js';
3
- export const ProductPricingSheet = (params) => {
4
- const basePricingSheet = BasePricingSheet(params);
5
- const pricingSheet = {
6
- ...basePricingSheet,
7
- addDiscount({ amount, isTaxable, isNetPrice, discountId, meta }) {
8
- basePricingSheet.calculation.push({
9
- category: ProductPricingRowCategory.Discount,
10
- amount,
11
- isTaxable,
12
- isNetPrice,
13
- discountId,
14
- meta,
15
- });
16
- },
17
- addItem({ amount, isTaxable, isNetPrice, meta }) {
18
- basePricingSheet.calculation.push({
19
- category: ProductPricingRowCategory.Item,
20
- amount,
21
- isTaxable,
22
- isNetPrice,
23
- meta,
24
- });
25
- },
26
- addTax({ amount, baseCategory, rate, meta, discountId }) {
27
- basePricingSheet.calculation.push({
28
- category: ProductPricingRowCategory.Tax,
29
- baseCategory,
30
- discountId,
31
- amount,
32
- isTaxable: false,
33
- isNetPrice: false,
34
- rate,
35
- meta,
36
- });
37
- },
38
- taxSum(filter) {
39
- return basePricingSheet.sum({
40
- category: ProductPricingRowCategory.Tax,
41
- ...(filter || {}),
42
- });
43
- },
44
- unitPrice(unitPriceParams) {
45
- const amount = unitPriceParams?.useNetPrice ? this.net() : this.gross();
46
- return {
47
- amount: Math.round(amount / this.quantity),
48
- currency: this.currency,
49
- };
50
- },
51
- discountPrices(explicitDiscountId) {
52
- const discountIds = pricingSheet
53
- .filterBy({
54
- category: ProductPricingRowCategory.Discount,
55
- discountId: explicitDiscountId,
56
- })
57
- .map(({ discountId }) => discountId);
58
- return [...new Set(discountIds)]
59
- .map((discountId) => {
60
- const amount = basePricingSheet.sum({
61
- category: ProductPricingRowCategory.Discount,
62
- discountId,
63
- });
64
- if (!amount) {
65
- return null;
66
- }
67
- return {
68
- discountId,
69
- amount: Math.round(amount),
70
- currency: basePricingSheet.currency,
71
- };
72
- })
73
- .filter(Boolean);
74
- },
75
- };
76
- return pricingSheet;
77
- };
78
- //# sourceMappingURL=ProductPricingSheet.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProductPricingSheet.js","sourceRoot":"","sources":["../../src/director/ProductPricingSheet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAEL,yBAAyB,GAE1B,MAAM,0CAA0C,CAAC;AAGlD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,MAAqD,EAC/B,EAAE;IACxB,MAAM,gBAAgB,GAAG,gBAAgB,CAA4B,MAAM,CAAC,CAAC;IAE7E,MAAM,YAAY,GAAyB;QACzC,GAAG,gBAAgB;QAEnB,WAAW,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE;YAC7D,gBAAgB,CAAC,WAAW,CAAC,IAAI,CAAC;gBAChC,QAAQ,EAAE,yBAAyB,CAAC,QAAQ;gBAC5C,MAAM;gBACN,SAAS;gBACT,UAAU;gBACV,UAAU;gBACV,IAAI;aACL,CAAC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE;YAC7C,gBAAgB,CAAC,WAAW,CAAC,IAA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GAAG,CAAC,CAAC,UAAU,EAAE,EAAE;gBAClB,MAAM,MAAM,GAAG,gBAAgB,CAAC,GAAG,CAAC;oBAClC,QAAQ,EAAE,yBAAyB,CAAC,QAAQ;oBAC5C,UAAU;iBACX,CAAC,CAAC;gBACH,IAAI,CAAC,MAAM,EAAE,CAAC;oBACZ,OAAO,IAAI,CAAC;gBACd,CAAC;gBACD,OAAO;oBACL,UAAU;oBACV,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;oBAC1B,QAAQ,EAAE,gBAAgB,CAAC,QAAQ;iBACpC,CAAC;YACJ,CAAC,CAAC;iBACD,MAAM,CAAC,OAAO,CAAC,CAAC;QACrB,CAAC;KACF,CAAC;IAEF,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC"}
@@ -1,3 +0,0 @@
1
- import { Migration, MigrationRepository } from '@unchainedshop/types/core.js';
2
- export default function addMigrations(repository: MigrationRepository<Migration>): void;
3
- //# sourceMappingURL=addMigrations.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"addMigrations.d.ts","sourceRoot":"","sources":["../../src/migrations/addMigrations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAwB9E,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,UAAU,EAAE,mBAAmB,CAAC,SAAS,CAAC,QAa/E"}
@@ -1,35 +0,0 @@
1
- import { ProductMediaCollection } from '../db/ProductMediaCollection.js';
2
- import { ProductsCollection } from '../db/ProductsCollection.js';
3
- const convertTagsToLowerCase = async (collection) => {
4
- let bulk = collection.initializeUnorderedBulkOp();
5
- let count = 0;
6
- const cursor = await collection.find({ tags: { $regex: '.*[A-Z]' } });
7
- // eslint-disable-next-line no-restricted-syntax
8
- for await (const doc of cursor) {
9
- const transformedTags = doc.tags.map((tag) => tag.toLowerCase());
10
- count += 1;
11
- bulk.find({ _id: doc._id }).updateOne({ $set: { tags: transformedTags } });
12
- if (count % 500 === 0) {
13
- bulk.execute();
14
- bulk = collection.initializeUnorderedBulkOp();
15
- count = 0;
16
- }
17
- }
18
- if (count > 0)
19
- bulk.execute();
20
- };
21
- export default function addMigrations(repository) {
22
- repository?.register({
23
- id: 20220920122600,
24
- name: 'Convert all tags to lower case to make it easy for search',
25
- up: async () => {
26
- const Products = await ProductsCollection(repository.db);
27
- const ProductMedia = await ProductMediaCollection(repository.db);
28
- await Promise.all([
29
- convertTagsToLowerCase(Products.Products),
30
- convertTagsToLowerCase(ProductMedia.ProductMedias),
31
- ]);
32
- },
33
- });
34
- }
35
- //# sourceMappingURL=addMigrations.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"addMigrations.js","sourceRoot":"","sources":["../../src/migrations/addMigrations.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEjE,MAAM,sBAAsB,GAAG,KAAK,EAAE,UAAmC,EAAE,EAAE;IAC3E,IAAI,IAAI,GAAG,UAAU,CAAC,yBAAyB,EAAE,CAAC;IAClD,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;IACtE,gDAAgD;IAChD,IAAI,KAAK,EAAE,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;QAC/B,MAAM,eAAe,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC;QACjE,KAAK,IAAI,CAAC,CAAC;QACX,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,EAAE,CAAC,CAAC;QAC3E,IAAI,KAAK,GAAG,GAAG,KAAK,CAAC,EAAE,CAAC;YACtB,IAAI,CAAC,OAAO,EAAE,CAAC;YACf,IAAI,GAAG,UAAU,CAAC,yBAAyB,EAAE,CAAC;YAC9C,KAAK,GAAG,CAAC,CAAC;QACZ,CAAC;IACH,CAAC;IACD,IAAI,KAAK,GAAG,CAAC;QAAE,IAAI,CAAC,OAAO,EAAE,CAAC;AAChC,CAAC,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,UAA0C;IAC9E,UAAU,EAAE,QAAQ,CAAC;QACnB,EAAE,EAAE,cAAc;QAClB,IAAI,EAAE,2DAA2D;QACjE,EAAE,EAAE,KAAK,IAAI,EAAE;YACb,MAAM,QAAQ,GAAG,MAAM,kBAAkB,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;YACzD,MAAM,YAAY,GAAG,MAAM,sBAAsB,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;YACjE,MAAM,OAAO,CAAC,GAAG,CAAC;gBAChB,sBAAsB,CAAC,QAAQ,CAAC,QAAQ,CAAC;gBACzC,sBAAsB,CAAC,YAAY,CAAC,aAAa,CAAC;aACnD,CAAC,CAAC;QACL,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -1,3 +0,0 @@
1
- import { ProductServices } from '@unchainedshop/types/products.js';
2
- export declare const productServices: ProductServices;
3
- //# sourceMappingURL=productServices.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"productServices.d.ts","sourceRoot":"","sources":["../../src/service/productServices.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAGnE,eAAO,MAAM,eAAe,EAAE,eAE7B,CAAC"}
@@ -1,5 +0,0 @@
1
- import { removeProductService } from './removeProductService.js';
2
- export const productServices = {
3
- removeProduct: removeProductService,
4
- };
5
- //# sourceMappingURL=productServices.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"productServices.js","sourceRoot":"","sources":["../../src/service/productServices.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,MAAM,CAAC,MAAM,eAAe,GAAoB;IAC9C,aAAa,EAAE,oBAAoB;CACpC,CAAC"}
@@ -1,3 +0,0 @@
1
- import { RemoveProductService } from '@unchainedshop/types/products.js';
2
- export declare const removeProductService: RemoveProductService;
3
- //# sourceMappingURL=removeProductService.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"removeProductService.d.ts","sourceRoot":"","sources":["../../src/service/removeProductService.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAGxE,eAAO,MAAM,oBAAoB,EAAE,oBAmBlC,CAAC"}
@@ -1,21 +0,0 @@
1
- import { ProductStatus } from '../db/ProductStatus.js';
2
- export const removeProductService = async ({ productId }, unchainedAPI) => {
3
- const { modules } = unchainedAPI;
4
- const product = await modules.products.findProduct({ productId });
5
- switch (product.status) {
6
- case ProductStatus.ACTIVE:
7
- await modules.products.unpublish(product);
8
- // falls through
9
- case null:
10
- case ProductStatus.DRAFT:
11
- await modules.bookmarks.deleteByProductId(productId);
12
- await modules.assortments.products.delete(productId);
13
- await modules.orders.positions.removeProductByIdFromAllOpenPositions(productId, unchainedAPI);
14
- await modules.products.delete(productId);
15
- break;
16
- default:
17
- throw new Error(`Invalid status', ${product.status}`);
18
- }
19
- return true;
20
- };
21
- //# sourceMappingURL=removeProductService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"removeProductService.js","sourceRoot":"","sources":["../../src/service/removeProductService.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,MAAM,CAAC,MAAM,oBAAoB,GAAyB,KAAK,EAAE,EAAE,SAAS,EAAE,EAAE,YAAY,EAAE,EAAE;IAC9F,MAAM,EAAE,OAAO,EAAE,GAAG,YAAY,CAAC;IACjC,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;IAClE,QAAQ,OAAO,CAAC,MAAM,EAAE,CAAC;QACvB,KAAK,aAAa,CAAC,MAAM;YACvB,MAAM,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAC5C,gBAAgB;QAChB,KAAK,IAAI,CAAC;QACV,KAAK,aAAa,CAAC,KAAK;YACtB,MAAM,OAAO,CAAC,SAAS,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;YACrD,MAAM,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YACrD,MAAM,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,qCAAqC,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;YAC9F,MAAM,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YACzC,MAAM;QACR;YACE,MAAM,IAAI,KAAK,CAAC,oBAAoB,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC1D,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}