@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.
- package/lib/bulk-importer/createBulkImporter.d.ts +1 -1
- package/lib/bulk-importer/createBulkImporter.d.ts.map +1 -1
- package/lib/bulk-importer/handlers/assortment/create.d.ts +1 -1
- package/lib/bulk-importer/handlers/assortment/create.d.ts.map +1 -1
- package/lib/bulk-importer/handlers/assortment/create.js +9 -7
- package/lib/bulk-importer/handlers/assortment/create.js.map +1 -1
- package/lib/bulk-importer/handlers/assortment/remove.d.ts +1 -1
- package/lib/bulk-importer/handlers/assortment/remove.d.ts.map +1 -1
- package/lib/bulk-importer/handlers/assortment/update.d.ts +1 -1
- package/lib/bulk-importer/handlers/assortment/update.d.ts.map +1 -1
- package/lib/bulk-importer/handlers/assortment/update.js.map +1 -1
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.d.ts +1 -1
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.d.ts.map +1 -1
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.d.ts +1 -1
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.d.ts.map +1 -1
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.d.ts +1 -1
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.d.ts.map +1 -1
- package/lib/bulk-importer/handlers/assortment/upsertMedia.d.ts +1 -1
- package/lib/bulk-importer/handlers/assortment/upsertMedia.d.ts.map +1 -1
- package/lib/bulk-importer/handlers/filter/create.d.ts +1 -1
- package/lib/bulk-importer/handlers/filter/create.d.ts.map +1 -1
- package/lib/bulk-importer/handlers/filter/create.js +10 -6
- package/lib/bulk-importer/handlers/filter/create.js.map +1 -1
- package/lib/bulk-importer/handlers/filter/remove.d.ts +1 -1
- package/lib/bulk-importer/handlers/filter/remove.d.ts.map +1 -1
- package/lib/bulk-importer/handlers/filter/update.d.ts +1 -1
- package/lib/bulk-importer/handlers/filter/update.d.ts.map +1 -1
- package/lib/bulk-importer/handlers/filter/update.js +10 -6
- package/lib/bulk-importer/handlers/filter/update.js.map +1 -1
- package/lib/bulk-importer/handlers/product/create.d.ts +1 -1
- package/lib/bulk-importer/handlers/product/create.d.ts.map +1 -1
- package/lib/bulk-importer/handlers/product/create.js +9 -7
- package/lib/bulk-importer/handlers/product/create.js.map +1 -1
- package/lib/bulk-importer/handlers/product/remove.d.ts +1 -1
- package/lib/bulk-importer/handlers/product/remove.d.ts.map +1 -1
- package/lib/bulk-importer/handlers/product/update.d.ts +1 -1
- package/lib/bulk-importer/handlers/product/update.d.ts.map +1 -1
- package/lib/bulk-importer/handlers/product/upsertMedia.d.ts +1 -1
- package/lib/bulk-importer/handlers/product/upsertMedia.d.ts.map +1 -1
- package/lib/bulk-importer/handlers/product/upsertVariations.d.ts +1 -1
- package/lib/bulk-importer/handlers/product/upsertVariations.d.ts.map +1 -1
- package/lib/bulk-importer/handlers/product/upsertVariations.js +17 -11
- package/lib/bulk-importer/handlers/product/upsertVariations.js.map +1 -1
- package/lib/bulk-importer/upsertAsset.d.ts +2 -2
- package/lib/bulk-importer/upsertAsset.d.ts.map +1 -1
- package/lib/context/index.d.ts +0 -1
- package/lib/context/index.d.ts.map +1 -1
- package/lib/context/index.js +0 -1
- package/lib/context/index.js.map +1 -1
- package/lib/context/setAccessToken.d.ts +2 -2
- package/lib/context/setAccessToken.d.ts.map +1 -1
- package/lib/context/setAccessToken.js +3 -1
- package/lib/context/setAccessToken.js.map +1 -1
- package/lib/migrations/migrationRepository.d.ts +1 -1
- package/lib/migrations/migrationRepository.d.ts.map +1 -1
- package/lib/migrations/runMigrations.d.ts +1 -1
- package/lib/migrations/runMigrations.d.ts.map +1 -1
- package/lib/platform-index.d.ts +0 -6
- package/lib/platform-index.d.ts.map +1 -1
- package/lib/platform-index.js +0 -3
- package/lib/platform-index.js.map +1 -1
- package/lib/setup/setupAccounts.d.ts +2 -2
- package/lib/setup/setupAccounts.d.ts.map +1 -1
- package/lib/setup/setupAccounts.js +8 -160
- package/lib/setup/setupAccounts.js.map +1 -1
- package/lib/setup/setupCarts.d.ts +1 -1
- package/lib/setup/setupCarts.d.ts.map +1 -1
- package/lib/setup/setupCarts.js +1 -1
- package/lib/setup/setupCarts.js.map +1 -1
- package/lib/setup/setupTemplates.d.ts +1 -1
- package/lib/setup/setupTemplates.d.ts.map +1 -1
- package/lib/setup/setupTemplates.js +1 -1
- package/lib/setup/setupTemplates.js.map +1 -1
- package/lib/setup/setupWorkqueue.d.ts +2 -2
- package/lib/setup/setupWorkqueue.d.ts.map +1 -1
- package/lib/setup/setupWorkqueue.js +1 -1
- package/lib/setup/setupWorkqueue.js.map +1 -1
- package/lib/startPlatform.d.ts +13 -14
- package/lib/startPlatform.d.ts.map +1 -1
- package/lib/startPlatform.js +12 -14
- package/lib/startPlatform.js.map +1 -1
- package/lib/templates/order-parser/formatAddress.d.ts +1 -1
- package/lib/templates/order-parser/formatAddress.d.ts.map +1 -1
- package/lib/templates/order-parser/getOrderPositionsData.d.ts +9 -7
- package/lib/templates/order-parser/getOrderPositionsData.d.ts.map +1 -1
- package/lib/templates/order-parser/getOrderPositionsData.js +2 -2
- package/lib/templates/order-parser/getOrderPositionsData.js.map +1 -1
- package/lib/templates/order-parser/getOrderSummaryData.d.ts +3 -4
- package/lib/templates/order-parser/getOrderSummaryData.d.ts.map +1 -1
- package/lib/templates/order-parser/getOrderSummaryData.js +1 -1
- package/lib/templates/order-parser/getOrderSummaryData.js.map +1 -1
- package/lib/templates/resolveAccountActionTemplate.d.ts +1 -1
- package/lib/templates/resolveAccountActionTemplate.d.ts.map +1 -1
- package/lib/templates/resolveEnrollmentStatusTemplate.d.ts +1 -1
- package/lib/templates/resolveEnrollmentStatusTemplate.d.ts.map +1 -1
- package/lib/templates/resolveErrorReportTemplate.d.ts +1 -1
- package/lib/templates/resolveErrorReportTemplate.d.ts.map +1 -1
- package/lib/templates/resolveForwardDeliveryTemplate.d.ts +1 -1
- package/lib/templates/resolveForwardDeliveryTemplate.d.ts.map +1 -1
- package/lib/templates/resolveOrderConfirmationTemplate.d.ts +1 -1
- package/lib/templates/resolveOrderConfirmationTemplate.d.ts.map +1 -1
- package/lib/templates/resolveOrderRejectionTemplate.d.ts +1 -1
- package/lib/templates/resolveOrderRejectionTemplate.d.ts.map +1 -1
- package/lib/templates/resolveQuotationStatusTemplate.d.ts +1 -1
- package/lib/templates/resolveQuotationStatusTemplate.d.ts.map +1 -1
- package/package.json +12 -13
- package/src/bulk-importer/createBulkImporter.ts +1 -1
- package/src/bulk-importer/handlers/assortment/create.ts +13 -11
- package/src/bulk-importer/handlers/assortment/remove.ts +1 -1
- package/src/bulk-importer/handlers/assortment/update.ts +2 -1
- package/src/bulk-importer/handlers/assortment/upsertAssortmentChildren.ts +2 -2
- package/src/bulk-importer/handlers/assortment/upsertAssortmentFilters.ts +2 -2
- package/src/bulk-importer/handlers/assortment/upsertAssortmentProducts.ts +2 -2
- package/src/bulk-importer/handlers/assortment/upsertMedia.ts +1 -1
- package/src/bulk-importer/handlers/filter/create.ts +14 -12
- package/src/bulk-importer/handlers/filter/remove.ts +1 -1
- package/src/bulk-importer/handlers/filter/update.ts +14 -12
- package/src/bulk-importer/handlers/product/create.ts +13 -11
- package/src/bulk-importer/handlers/product/remove.ts +1 -1
- package/src/bulk-importer/handlers/product/update.ts +1 -1
- package/src/bulk-importer/handlers/product/upsertMedia.ts +2 -2
- package/src/bulk-importer/handlers/product/upsertVariations.ts +26 -22
- package/src/bulk-importer/upsertAsset.ts +2 -2
- package/src/context/index.ts +0 -1
- package/src/context/setAccessToken.ts +9 -2
- package/src/migrations/migrationRepository.ts +1 -1
- package/src/migrations/runMigrations.ts +1 -1
- package/src/platform-index.ts +0 -6
- package/src/setup/setupAccounts.ts +9 -238
- package/src/setup/setupCarts.ts +2 -2
- package/src/setup/setupTemplates.ts +2 -2
- package/src/setup/setupWorkqueue.ts +8 -3
- package/src/startPlatform.ts +26 -40
- package/src/templates/order-parser/formatAddress.ts +1 -1
- package/src/templates/order-parser/getOrderPositionsData.ts +5 -6
- package/src/templates/order-parser/getOrderSummaryData.ts +4 -5
- package/src/templates/resolveAccountActionTemplate.ts +1 -1
- package/src/templates/resolveEnrollmentStatusTemplate.ts +1 -1
- package/src/templates/resolveErrorReportTemplate.ts +1 -1
- package/src/templates/resolveForwardDeliveryTemplate.ts +1 -1
- package/src/templates/resolveOrderConfirmationTemplate.ts +1 -1
- package/src/templates/resolveOrderRejectionTemplate.ts +1 -1
- package/src/templates/resolveQuotationStatusTemplate.ts +1 -1
- package/lib/context/withAccessToken.d.ts +0 -4
- package/lib/context/withAccessToken.d.ts.map +0 -1
- package/lib/context/withAccessToken.js +0 -37
- package/lib/context/withAccessToken.js.map +0 -1
- package/src/context/withAccessToken.ts +0 -40
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveOrderRejectionTemplate.d.ts","sourceRoot":"","sources":["../../src/templates/resolveOrderRejectionTemplate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveQuotationStatusTemplate.d.ts","sourceRoot":"","sources":["../../src/templates/resolveQuotationStatusTemplate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,
|
|
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": "
|
|
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": "^
|
|
35
|
-
"@unchainedshop/core": "^
|
|
36
|
-
"@unchainedshop/events": "^
|
|
37
|
-
"@unchainedshop/file-upload": "^
|
|
38
|
-
"@unchainedshop/logger": "^
|
|
39
|
-
"@unchainedshop/mongodb": "^
|
|
40
|
-
"@unchainedshop/plugins": "^
|
|
41
|
-
"@unchainedshop/roles": "^
|
|
42
|
-
"@unchainedshop/utils": "^
|
|
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": "^
|
|
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.
|
|
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/
|
|
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/
|
|
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
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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/
|
|
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/
|
|
2
|
-
import { UnchainedCore } from '@unchainedshop/
|
|
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/
|
|
2
|
-
import { UnchainedCore } from '@unchainedshop/
|
|
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/
|
|
2
|
-
import { UnchainedCore } from '@unchainedshop/
|
|
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/
|
|
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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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/
|
|
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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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/
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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/
|
|
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/
|
|
2
|
-
import { UnchainedCore } from '@unchainedshop/
|
|
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/
|
|
2
|
-
import { ProductVariation } from '@unchainedshop/
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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/
|
|
2
|
-
import { File } from '@unchainedshop/
|
|
1
|
+
import { UnchainedCore } from '@unchainedshop/core';
|
|
2
|
+
import { File } from '@unchainedshop/core-files';
|
|
3
3
|
|
|
4
4
|
const upsertAsset = async (
|
|
5
5
|
directoryName: string,
|
package/src/context/index.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import { UnchainedCore } from '@unchainedshop/
|
|
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/
|
|
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/
|
|
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';
|