@unchainedshop/platform 2.14.2 → 3.0.0-alpha3

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 (148) hide show
  1. package/lib/bulk-importer/createBulkImporter.d.ts +1 -1
  2. package/lib/bulk-importer/createBulkImporter.d.ts.map +1 -1
  3. package/lib/bulk-importer/handlers/assortment/create.d.ts +1 -1
  4. package/lib/bulk-importer/handlers/assortment/create.d.ts.map +1 -1
  5. package/lib/bulk-importer/handlers/assortment/create.js +9 -7
  6. package/lib/bulk-importer/handlers/assortment/create.js.map +1 -1
  7. package/lib/bulk-importer/handlers/assortment/remove.d.ts +1 -1
  8. package/lib/bulk-importer/handlers/assortment/remove.d.ts.map +1 -1
  9. package/lib/bulk-importer/handlers/assortment/update.d.ts +1 -1
  10. package/lib/bulk-importer/handlers/assortment/update.d.ts.map +1 -1
  11. package/lib/bulk-importer/handlers/assortment/update.js.map +1 -1
  12. package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.d.ts +1 -1
  13. package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.d.ts.map +1 -1
  14. package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.d.ts +1 -1
  15. package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.d.ts.map +1 -1
  16. package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.d.ts +1 -1
  17. package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.d.ts.map +1 -1
  18. package/lib/bulk-importer/handlers/assortment/upsertMedia.d.ts +1 -1
  19. package/lib/bulk-importer/handlers/assortment/upsertMedia.d.ts.map +1 -1
  20. package/lib/bulk-importer/handlers/filter/create.d.ts +1 -1
  21. package/lib/bulk-importer/handlers/filter/create.d.ts.map +1 -1
  22. package/lib/bulk-importer/handlers/filter/create.js +10 -6
  23. package/lib/bulk-importer/handlers/filter/create.js.map +1 -1
  24. package/lib/bulk-importer/handlers/filter/remove.d.ts +1 -1
  25. package/lib/bulk-importer/handlers/filter/remove.d.ts.map +1 -1
  26. package/lib/bulk-importer/handlers/filter/update.d.ts +1 -1
  27. package/lib/bulk-importer/handlers/filter/update.d.ts.map +1 -1
  28. package/lib/bulk-importer/handlers/filter/update.js +10 -6
  29. package/lib/bulk-importer/handlers/filter/update.js.map +1 -1
  30. package/lib/bulk-importer/handlers/product/create.d.ts +1 -1
  31. package/lib/bulk-importer/handlers/product/create.d.ts.map +1 -1
  32. package/lib/bulk-importer/handlers/product/create.js +9 -7
  33. package/lib/bulk-importer/handlers/product/create.js.map +1 -1
  34. package/lib/bulk-importer/handlers/product/remove.d.ts +1 -1
  35. package/lib/bulk-importer/handlers/product/remove.d.ts.map +1 -1
  36. package/lib/bulk-importer/handlers/product/update.d.ts +1 -1
  37. package/lib/bulk-importer/handlers/product/update.d.ts.map +1 -1
  38. package/lib/bulk-importer/handlers/product/upsertMedia.d.ts +1 -1
  39. package/lib/bulk-importer/handlers/product/upsertMedia.d.ts.map +1 -1
  40. package/lib/bulk-importer/handlers/product/upsertVariations.d.ts +1 -1
  41. package/lib/bulk-importer/handlers/product/upsertVariations.d.ts.map +1 -1
  42. package/lib/bulk-importer/handlers/product/upsertVariations.js +17 -11
  43. package/lib/bulk-importer/handlers/product/upsertVariations.js.map +1 -1
  44. package/lib/bulk-importer/upsertAsset.d.ts +2 -2
  45. package/lib/bulk-importer/upsertAsset.d.ts.map +1 -1
  46. package/lib/context/index.d.ts +0 -1
  47. package/lib/context/index.d.ts.map +1 -1
  48. package/lib/context/index.js +0 -1
  49. package/lib/context/index.js.map +1 -1
  50. package/lib/context/setAccessToken.d.ts +2 -2
  51. package/lib/context/setAccessToken.d.ts.map +1 -1
  52. package/lib/context/setAccessToken.js +3 -1
  53. package/lib/context/setAccessToken.js.map +1 -1
  54. package/lib/migrations/migrationRepository.d.ts +1 -1
  55. package/lib/migrations/migrationRepository.d.ts.map +1 -1
  56. package/lib/migrations/runMigrations.d.ts +1 -1
  57. package/lib/migrations/runMigrations.d.ts.map +1 -1
  58. package/lib/platform-index.d.ts +0 -6
  59. package/lib/platform-index.d.ts.map +1 -1
  60. package/lib/platform-index.js +0 -3
  61. package/lib/platform-index.js.map +1 -1
  62. package/lib/setup/setupAccounts.d.ts +2 -2
  63. package/lib/setup/setupAccounts.d.ts.map +1 -1
  64. package/lib/setup/setupAccounts.js +8 -160
  65. package/lib/setup/setupAccounts.js.map +1 -1
  66. package/lib/setup/setupCarts.d.ts +1 -1
  67. package/lib/setup/setupCarts.d.ts.map +1 -1
  68. package/lib/setup/setupCarts.js +1 -1
  69. package/lib/setup/setupCarts.js.map +1 -1
  70. package/lib/setup/setupTemplates.d.ts +1 -1
  71. package/lib/setup/setupTemplates.d.ts.map +1 -1
  72. package/lib/setup/setupTemplates.js +1 -1
  73. package/lib/setup/setupTemplates.js.map +1 -1
  74. package/lib/setup/setupWorkqueue.d.ts +2 -2
  75. package/lib/setup/setupWorkqueue.d.ts.map +1 -1
  76. package/lib/setup/setupWorkqueue.js +1 -1
  77. package/lib/setup/setupWorkqueue.js.map +1 -1
  78. package/lib/startPlatform.d.ts +13 -14
  79. package/lib/startPlatform.d.ts.map +1 -1
  80. package/lib/startPlatform.js +12 -14
  81. package/lib/startPlatform.js.map +1 -1
  82. package/lib/templates/order-parser/formatAddress.d.ts +1 -1
  83. package/lib/templates/order-parser/formatAddress.d.ts.map +1 -1
  84. package/lib/templates/order-parser/getOrderPositionsData.d.ts +9 -7
  85. package/lib/templates/order-parser/getOrderPositionsData.d.ts.map +1 -1
  86. package/lib/templates/order-parser/getOrderPositionsData.js +2 -2
  87. package/lib/templates/order-parser/getOrderPositionsData.js.map +1 -1
  88. package/lib/templates/order-parser/getOrderSummaryData.d.ts +3 -4
  89. package/lib/templates/order-parser/getOrderSummaryData.d.ts.map +1 -1
  90. package/lib/templates/order-parser/getOrderSummaryData.js +1 -1
  91. package/lib/templates/order-parser/getOrderSummaryData.js.map +1 -1
  92. package/lib/templates/resolveAccountActionTemplate.d.ts +1 -1
  93. package/lib/templates/resolveAccountActionTemplate.d.ts.map +1 -1
  94. package/lib/templates/resolveEnrollmentStatusTemplate.d.ts +1 -1
  95. package/lib/templates/resolveEnrollmentStatusTemplate.d.ts.map +1 -1
  96. package/lib/templates/resolveErrorReportTemplate.d.ts +1 -1
  97. package/lib/templates/resolveErrorReportTemplate.d.ts.map +1 -1
  98. package/lib/templates/resolveForwardDeliveryTemplate.d.ts +1 -1
  99. package/lib/templates/resolveForwardDeliveryTemplate.d.ts.map +1 -1
  100. package/lib/templates/resolveOrderConfirmationTemplate.d.ts +1 -1
  101. package/lib/templates/resolveOrderConfirmationTemplate.d.ts.map +1 -1
  102. package/lib/templates/resolveOrderRejectionTemplate.d.ts +1 -1
  103. package/lib/templates/resolveOrderRejectionTemplate.d.ts.map +1 -1
  104. package/lib/templates/resolveQuotationStatusTemplate.d.ts +1 -1
  105. package/lib/templates/resolveQuotationStatusTemplate.d.ts.map +1 -1
  106. package/package.json +12 -13
  107. package/src/bulk-importer/createBulkImporter.ts +1 -1
  108. package/src/bulk-importer/handlers/assortment/create.ts +13 -11
  109. package/src/bulk-importer/handlers/assortment/remove.ts +1 -1
  110. package/src/bulk-importer/handlers/assortment/update.ts +2 -1
  111. package/src/bulk-importer/handlers/assortment/upsertAssortmentChildren.ts +2 -2
  112. package/src/bulk-importer/handlers/assortment/upsertAssortmentFilters.ts +2 -2
  113. package/src/bulk-importer/handlers/assortment/upsertAssortmentProducts.ts +2 -2
  114. package/src/bulk-importer/handlers/assortment/upsertMedia.ts +1 -1
  115. package/src/bulk-importer/handlers/filter/create.ts +14 -12
  116. package/src/bulk-importer/handlers/filter/remove.ts +1 -1
  117. package/src/bulk-importer/handlers/filter/update.ts +14 -12
  118. package/src/bulk-importer/handlers/product/create.ts +13 -11
  119. package/src/bulk-importer/handlers/product/remove.ts +1 -1
  120. package/src/bulk-importer/handlers/product/update.ts +1 -1
  121. package/src/bulk-importer/handlers/product/upsertMedia.ts +2 -2
  122. package/src/bulk-importer/handlers/product/upsertVariations.ts +26 -22
  123. package/src/bulk-importer/upsertAsset.ts +2 -2
  124. package/src/context/index.ts +0 -1
  125. package/src/context/setAccessToken.ts +9 -2
  126. package/src/migrations/migrationRepository.ts +1 -1
  127. package/src/migrations/runMigrations.ts +1 -1
  128. package/src/platform-index.ts +0 -6
  129. package/src/setup/setupAccounts.ts +9 -238
  130. package/src/setup/setupCarts.ts +2 -2
  131. package/src/setup/setupTemplates.ts +2 -2
  132. package/src/setup/setupWorkqueue.ts +8 -3
  133. package/src/startPlatform.ts +26 -40
  134. package/src/templates/order-parser/formatAddress.ts +1 -1
  135. package/src/templates/order-parser/getOrderPositionsData.ts +5 -6
  136. package/src/templates/order-parser/getOrderSummaryData.ts +4 -5
  137. package/src/templates/resolveAccountActionTemplate.ts +1 -1
  138. package/src/templates/resolveEnrollmentStatusTemplate.ts +1 -1
  139. package/src/templates/resolveErrorReportTemplate.ts +1 -1
  140. package/src/templates/resolveForwardDeliveryTemplate.ts +1 -1
  141. package/src/templates/resolveOrderConfirmationTemplate.ts +1 -1
  142. package/src/templates/resolveOrderRejectionTemplate.ts +1 -1
  143. package/src/templates/resolveQuotationStatusTemplate.ts +1 -1
  144. package/lib/context/withAccessToken.d.ts +0 -4
  145. package/lib/context/withAccessToken.d.ts.map +0 -1
  146. package/lib/context/withAccessToken.js +0 -37
  147. package/lib/context/withAccessToken.js.map +0 -1
  148. package/src/context/withAccessToken.ts +0 -40
@@ -1,3 +1,3 @@
1
- import { TemplateResolver } from '@unchainedshop/types/messaging.js';
1
+ import { TemplateResolver } from '@unchainedshop/core-messaging';
2
2
  export declare const resolveOrderRejectionTemplate: TemplateResolver;
3
3
  //# sourceMappingURL=resolveOrderRejectionTemplate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolveOrderRejectionTemplate.d.ts","sourceRoot":"","sources":["../../src/templates/resolveOrderRejectionTemplate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAiBrE,eAAO,MAAM,6BAA6B,EAAE,gBA2B3C,CAAC"}
1
+ {"version":3,"file":"resolveOrderRejectionTemplate.d.ts","sourceRoot":"","sources":["../../src/templates/resolveOrderRejectionTemplate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAiBjE,eAAO,MAAM,6BAA6B,EAAE,gBA2B3C,CAAC"}
@@ -1,3 +1,3 @@
1
- import { TemplateResolver } from '@unchainedshop/types/messaging.js';
1
+ import { TemplateResolver } from '@unchainedshop/core-messaging';
2
2
  export declare const resolveQuotationStatusTemplate: TemplateResolver;
3
3
  //# sourceMappingURL=resolveQuotationStatusTemplate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolveQuotationStatusTemplate.d.ts","sourceRoot":"","sources":["../../src/templates/resolveQuotationStatusTemplate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAcrE,eAAO,MAAM,8BAA8B,EAAE,gBAuC5C,CAAC"}
1
+ {"version":3,"file":"resolveQuotationStatusTemplate.d.ts","sourceRoot":"","sources":["../../src/templates/resolveQuotationStatusTemplate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAcjE,eAAO,MAAM,8BAA8B,EAAE,gBAuC5C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unchainedshop/platform",
3
- "version": "2.14.2",
3
+ "version": "3.0.0-alpha3",
4
4
  "main": "lib/platform-index.js",
5
5
  "exports": {
6
6
  ".": "./lib/platform-index.js",
@@ -31,25 +31,24 @@
31
31
  },
32
32
  "homepage": "https://github.com/unchainedshop/unchained#readme",
33
33
  "dependencies": {
34
- "@unchainedshop/api": "^2.14.2",
35
- "@unchainedshop/core": "^2.14.2",
36
- "@unchainedshop/events": "^2.14.2",
37
- "@unchainedshop/file-upload": "^2.14.2",
38
- "@unchainedshop/logger": "^2.14.2",
39
- "@unchainedshop/mongodb": "^2.14.2",
40
- "@unchainedshop/plugins": "^2.14.2",
41
- "@unchainedshop/roles": "^2.14.2",
42
- "@unchainedshop/utils": "^2.14.2",
34
+ "@unchainedshop/api": "^3.0.0-alpha3",
35
+ "@unchainedshop/core": "^3.0.0-alpha3",
36
+ "@unchainedshop/events": "^3.0.0-alpha3",
37
+ "@unchainedshop/file-upload": "^3.0.0-alpha3",
38
+ "@unchainedshop/logger": "^3.0.0-alpha3",
39
+ "@unchainedshop/mongodb": "^3.0.0-alpha3",
40
+ "@unchainedshop/plugins": "^3.0.0-alpha3",
41
+ "@unchainedshop/roles": "^3.0.0-alpha3",
42
+ "@unchainedshop/utils": "^3.0.0-alpha3",
43
43
  "event-iterator": "^2.0.0",
44
44
  "JSONStream": "^1.3.5",
45
45
  "moniker": "0.1.2"
46
46
  },
47
47
  "devDependencies": {
48
- "@types/node": "^20.16.5",
49
- "@unchainedshop/types": "^2.14.2",
48
+ "@types/node": "^22.5.5",
50
49
  "cross-env": "^7.0.3",
51
50
  "jest": "^29.7.0",
52
51
  "ts-jest": "^29.2.5",
53
- "typescript": "^5.5.4"
52
+ "typescript": "^5.6.2"
54
53
  }
55
54
  }
@@ -1,5 +1,5 @@
1
1
  import { mongodb } from '@unchainedshop/mongodb';
2
- import { BulkImporter, UnchainedCore } from '@unchainedshop/types/core.js';
2
+ import { BulkImporter, UnchainedCore } from '@unchainedshop/core';
3
3
  import * as AssortmentHandlers from './handlers/assortment/index.js';
4
4
  import * as FilterHandlers from './handlers/filter/index.js';
5
5
  import * as ProductHandlers from './handlers/product/index.js';
@@ -1,4 +1,4 @@
1
- import { UnchainedCore } from '@unchainedshop/types/core.js';
1
+ import { UnchainedCore } from '@unchainedshop/core';
2
2
  import convertTagsToLowerCase from '../utils/convertTagsToLowerCase.js';
3
3
  import upsertAssortmentChildren from './upsertAssortmentChildren.js';
4
4
  import upsertAssortmentFilters from './upsertAssortmentFilters.js';
@@ -34,16 +34,18 @@ export default async function createAssortment(
34
34
  throw new Error(`Can't create assortment ${_id}, fields missing?`);
35
35
  }
36
36
 
37
- logger.debug('create localized content for assortment', specification.content);
38
- await modules.assortments.texts.updateTexts(
39
- _id,
40
- Object.entries(specification.content).map(([locale, localizedData]: [string, any]) => {
41
- return {
42
- locale,
43
- ...localizedData,
44
- };
45
- }),
46
- );
37
+ if (specification.content) {
38
+ logger.debug('create localized content for assortment', specification.content);
39
+ await modules.assortments.texts.updateTexts(
40
+ _id,
41
+ Object.entries(specification.content).map(([locale, localizedData]: [string, any]) => {
42
+ return {
43
+ locale,
44
+ ...localizedData,
45
+ };
46
+ }),
47
+ );
48
+ }
47
49
 
48
50
  logger.debug('create assortment products', products);
49
51
  await upsertAssortmentProducts(
@@ -1,4 +1,4 @@
1
- import { UnchainedCore } from '@unchainedshop/types/core.js';
1
+ import { UnchainedCore } from '@unchainedshop/core';
2
2
 
3
3
  export default async function removeAssortment(payload, { logger }, unchainedAPI: UnchainedCore) {
4
4
  const { modules } = unchainedAPI;
@@ -1,4 +1,4 @@
1
- import { UnchainedCore } from '@unchainedshop/types/core.js';
1
+ import { UnchainedCore } from '@unchainedshop/core';
2
2
  import upsertAssortmentProducts from './upsertAssortmentProducts.js';
3
3
  import upsertAssortmentChildren from './upsertAssortmentChildren.js';
4
4
  import upsertAssortmentFilters from './upsertAssortmentFilters.js';
@@ -27,6 +27,7 @@ export default async function updateAssortment(
27
27
  specification.tags = convertTagsToLowerCase(specification?.tags);
28
28
 
29
29
  await unchainedAPI.modules.assortments.update(_id, { ...specification });
30
+
30
31
  if (specification.content) {
31
32
  logger.debug('replace localized content for assortment', specification.content);
32
33
  await modules.assortments.texts.updateTexts(
@@ -1,5 +1,5 @@
1
- import { AssortmentLink } from '@unchainedshop/types/assortments.js';
2
- import { UnchainedCore } from '@unchainedshop/types/core.js';
1
+ import { AssortmentLink } from '@unchainedshop/core-assortments';
2
+ import { UnchainedCore } from '@unchainedshop/core';
3
3
  import convertTagsToLowerCase from '../utils/convertTagsToLowerCase.js';
4
4
 
5
5
  const upsert = async (assortmentLink: AssortmentLink, { modules }: UnchainedCore) => {
@@ -1,5 +1,5 @@
1
- import { AssortmentFilter } from '@unchainedshop/types/assortments.js';
2
- import { UnchainedCore } from '@unchainedshop/types/core.js';
1
+ import { AssortmentFilter } from '@unchainedshop/core-assortments';
2
+ import { UnchainedCore } from '@unchainedshop/core';
3
3
  import convertTagsToLowerCase from '../utils/convertTagsToLowerCase.js';
4
4
 
5
5
  const upsert = async (assortmentFilter: AssortmentFilter, { modules }: UnchainedCore) => {
@@ -1,5 +1,5 @@
1
- import { AssortmentProduct } from '@unchainedshop/types/assortments.js';
2
- import { UnchainedCore } from '@unchainedshop/types/core.js';
1
+ import { AssortmentProduct } from '@unchainedshop/core-assortments';
2
+ import { UnchainedCore } from '@unchainedshop/core';
3
3
  import convertTagsToLowerCase from '../utils/convertTagsToLowerCase.js';
4
4
 
5
5
  const upsert = async (assortmentProduct: AssortmentProduct, unchainedAPI: UnchainedCore) => {
@@ -1,4 +1,4 @@
1
- import { UnchainedCore } from '@unchainedshop/types/core.js';
1
+ import { UnchainedCore } from '@unchainedshop/core';
2
2
  import upsertAsset from '../../upsertAsset.js';
3
3
 
4
4
  const upsertMediaObject = async (media, unchainedAPI: UnchainedCore) => {
@@ -1,4 +1,4 @@
1
- import { UnchainedCore } from '@unchainedshop/types/core.js';
1
+ import { UnchainedCore } from '@unchainedshop/core';
2
2
 
3
3
  export default async function createFilter(
4
4
  payload: any,
@@ -60,17 +60,19 @@ export default async function createFilter(
60
60
  if (options) {
61
61
  logger.debug('create localized content for filter options', content);
62
62
  await Promise.all(
63
- options.map(async ({ content: optionContent, value: optionValue }) =>
64
- modules.filters.texts.updateTexts(
65
- { filterId: _id, filterOptionValue: optionValue },
66
- Object.entries(optionContent).map(([locale, localizedData]: [string, any]) => {
67
- return {
68
- locale,
69
- ...localizedData,
70
- };
71
- }),
72
- ),
73
- ),
63
+ options.map(async ({ content: optionContent, value: optionValue }) => {
64
+ if (optionContent) {
65
+ await modules.filters.texts.updateTexts(
66
+ { filterId: _id, filterOptionValue: optionValue },
67
+ Object.entries(optionContent).map(([locale, localizedData]: [string, any]) => {
68
+ return {
69
+ locale,
70
+ ...localizedData,
71
+ };
72
+ }),
73
+ );
74
+ }
75
+ }),
74
76
  );
75
77
  }
76
78
 
@@ -1,4 +1,4 @@
1
- import { UnchainedCore } from '@unchainedshop/types/core.js';
1
+ import { UnchainedCore } from '@unchainedshop/core';
2
2
 
3
3
  export default async function removeFilter(payload: any, { logger }, unchainedAPI: UnchainedCore) {
4
4
  const { modules } = unchainedAPI;
@@ -1,4 +1,4 @@
1
- import { UnchainedCore } from '@unchainedshop/types/core.js';
1
+ import { UnchainedCore } from '@unchainedshop/core';
2
2
  import createFilter from './create.js';
3
3
 
4
4
  export default async function updateFilter(
@@ -47,17 +47,19 @@ export default async function updateFilter(
47
47
  if (options) {
48
48
  logger.debug('replace localized content for filter options', content);
49
49
  await Promise.all(
50
- options.map(async ({ content: optionContent, value: optionValue }) =>
51
- modules.filters.texts.updateTexts(
52
- { filterId: _id, filterOptionValue: optionValue },
53
- Object.entries(optionContent).map(([locale, localizedData]: [string, any]) => {
54
- return {
55
- locale,
56
- ...localizedData,
57
- };
58
- }),
59
- ),
60
- ),
50
+ options.map(async ({ content: optionContent, value: optionValue }) => {
51
+ if (optionContent) {
52
+ await modules.filters.texts.updateTexts(
53
+ { filterId: _id, filterOptionValue: optionValue },
54
+ Object.entries(optionContent).map(([locale, localizedData]: [string, any]) => {
55
+ return {
56
+ locale,
57
+ ...localizedData,
58
+ };
59
+ }),
60
+ );
61
+ }
62
+ }),
61
63
  );
62
64
  }
63
65
 
@@ -1,4 +1,4 @@
1
- import { UnchainedCore } from '@unchainedshop/types/core.js';
1
+ import { UnchainedCore } from '@unchainedshop/core';
2
2
  import upsertVariations from './upsertVariations.js';
3
3
  import upsertMedia from './upsertMedia.js';
4
4
  import transformSpecificationToProductStructure from './transformSpecificationToProductStructure.js';
@@ -35,16 +35,18 @@ export default async function createProduct(
35
35
  throw new Error(`Can't create product ${_id}, fields missing?`);
36
36
  }
37
37
 
38
- logger.debug('create localized content for product', specification.content);
39
- await modules.products.texts.updateTexts(
40
- _id,
41
- Object.entries(specification.content).map(([locale, localizedData]: [string, any]) => {
42
- return {
43
- locale,
44
- ...localizedData,
45
- };
46
- }),
47
- );
38
+ if (specification.content) {
39
+ logger.debug('create localized content for product', specification.content);
40
+ await modules.products.texts.updateTexts(
41
+ _id,
42
+ Object.entries(specification.content).map(([locale, localizedData]: [string, any]) => {
43
+ return {
44
+ locale,
45
+ ...localizedData,
46
+ };
47
+ }),
48
+ );
49
+ }
48
50
 
49
51
  logger.debug('create product variations', variations);
50
52
  await upsertVariations(
@@ -1,4 +1,4 @@
1
- import { UnchainedCore } from '@unchainedshop/types/core.js';
1
+ import { UnchainedCore } from '@unchainedshop/core';
2
2
 
3
3
  export default async function removeProduct(payload: any, { logger }, unchainedAPI: UnchainedCore) {
4
4
  const { services } = unchainedAPI;
@@ -1,4 +1,4 @@
1
- import { UnchainedCore } from '@unchainedshop/types/core.js';
1
+ import { UnchainedCore } from '@unchainedshop/core';
2
2
  import upsertVariations from './upsertVariations.js';
3
3
  import upsertMedia from './upsertMedia.js';
4
4
  import transformSpecificationToProductStructure from './transformSpecificationToProductStructure.js';
@@ -1,5 +1,5 @@
1
- import { ProductMedia } from '@unchainedshop/types/products.media.js';
2
- import { UnchainedCore } from '@unchainedshop/types/core.js';
1
+ import { ProductMedia } from '@unchainedshop/core-products';
2
+ import { UnchainedCore } from '@unchainedshop/core';
3
3
  import convertTagsToLowerCase from '../utils/convertTagsToLowerCase.js';
4
4
  import upsertAsset from '../../upsertAsset.js';
5
5
 
@@ -1,5 +1,5 @@
1
- import { UnchainedCore } from '@unchainedshop/types/core.js';
2
- import { ProductVariation } from '@unchainedshop/types/products.variations.js';
1
+ import { UnchainedCore } from '@unchainedshop/core';
2
+ import { ProductVariation } from '@unchainedshop/core-products';
3
3
 
4
4
  const upsert = async (productVariation: ProductVariation, unchainedAPI: UnchainedCore) => {
5
5
  const { modules } = unchainedAPI;
@@ -26,28 +26,32 @@ export default async function upsertVariations({ variations, productId }, unchai
26
26
  );
27
27
 
28
28
  await Promise.all(
29
- options.map(async ({ content: optionContent, value: optionValue }) =>
30
- modules.products.variations.texts.updateVariationTexts(
31
- variation._id,
32
- Object.entries(optionContent).map(([locale, localizedData]: [string, any]) => {
33
- return {
34
- locale,
35
- ...localizedData,
36
- };
37
- }),
38
- optionValue,
39
- ),
40
- ),
41
- );
42
- await modules.products.variations.texts.updateVariationTexts(
43
- variation._id,
44
- Object.entries(content).map(([locale, localizedData]: [string, any]) => {
45
- return {
46
- locale,
47
- ...localizedData,
48
- };
29
+ options.map(async ({ content: optionContent, value: optionValue }) => {
30
+ if (optionContent) {
31
+ await modules.products.variations.texts.updateVariationTexts(
32
+ variation._id,
33
+ Object.entries(optionContent).map(([locale, localizedData]: [string, any]) => {
34
+ return {
35
+ locale,
36
+ ...localizedData,
37
+ };
38
+ }),
39
+ optionValue,
40
+ );
41
+ }
49
42
  }),
50
43
  );
44
+ if (content) {
45
+ await modules.products.variations.texts.updateVariationTexts(
46
+ variation._id,
47
+ Object.entries(content).map(([locale, localizedData]: [string, any]) => {
48
+ return {
49
+ locale,
50
+ ...localizedData,
51
+ };
52
+ }),
53
+ );
54
+ }
51
55
  return variation._id;
52
56
  }),
53
57
  );
@@ -1,5 +1,5 @@
1
- import { UnchainedCore } from '@unchainedshop/types/core.js';
2
- import { File } from '@unchainedshop/types/files.js';
1
+ import { UnchainedCore } from '@unchainedshop/core';
2
+ import { File } from '@unchainedshop/core-files';
3
3
 
4
4
  const upsertAsset = async (
5
5
  directoryName: string,
@@ -1,2 +1 @@
1
- export { default as withAccessToken } from './withAccessToken.js';
2
1
  export { default as setAccessToken } from './setAccessToken.js';
@@ -1,6 +1,13 @@
1
- import { UnchainedCore } from '@unchainedshop/types/core.js';
1
+ import { UnchainedCore } from '@unchainedshop/core';
2
+ import crypto from 'crypto';
3
+
4
+ export default async (
5
+ unchainedAPI: UnchainedCore,
6
+ username: string,
7
+ plainSecret: string,
8
+ ): Promise<void> => {
9
+ const secret = crypto.createHash('sha256').update(`${username}:${plainSecret}`).digest('hex');
2
10
 
3
- export default async (unchainedAPI: UnchainedCore, username: string, secret: string): Promise<void> => {
4
11
  await unchainedAPI.modules.users.updateUser(
5
12
  { username },
6
13
  {
@@ -1,4 +1,4 @@
1
- import { Migration, MigrationRepository } from '@unchainedshop/types/core.js';
1
+ import { Migration, MigrationRepository } from '@unchainedshop/core';
2
2
  import { mongodb } from '@unchainedshop/mongodb';
3
3
 
4
4
  export const createMigrationRepository = (db: mongodb.Db): MigrationRepository<Migration> => {
@@ -1,4 +1,4 @@
1
- import { Migration, UnchainedCore, MigrationRepository } from '@unchainedshop/types/core.js';
1
+ import { Migration, UnchainedCore, MigrationRepository } from '@unchainedshop/core';
2
2
  import { createLogger } from '@unchainedshop/logger';
3
3
  import { generateDbFilterById } from '@unchainedshop/mongodb';
4
4
  import { createMigrationRunner } from './createMigrationRunner.js';
@@ -1,8 +1,2 @@
1
- import { express } from '@unchainedshop/api';
2
-
3
1
  export * from './startPlatform.js';
4
2
  export * from './context/index.js';
5
-
6
- const connectPlatformToExpress4 = express.connect;
7
-
8
- export { connectPlatformToExpress4 };