@unchainedshop/platform 3.0.0-alpha2 → 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/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/upsertAssortmentChildren.d.ts +1 -1
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.d.ts.map +1 -1
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.js +1 -1
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.js.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/upsertAssortmentFilters.js +1 -1
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.js.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/upsertAssortmentProducts.js +1 -1
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.js.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/assortment/upsertMedia.js +1 -1
- package/lib/bulk-importer/handlers/assortment/upsertMedia.js.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/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/product/create.d.ts +1 -1
- package/lib/bulk-importer/handlers/product/create.d.ts.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/upsertMedia.js +1 -1
- package/lib/bulk-importer/handlers/product/upsertMedia.js.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 +1 -1
- 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/bulk-importer/upsertAsset.js +1 -1
- package/lib/bulk-importer/upsertAsset.js.map +1 -1
- package/lib/context/setAccessToken.d.ts +1 -1
- package/lib/context/setAccessToken.d.ts.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 +1 -1
- package/lib/setup/setupAccounts.d.ts.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 -11
- package/lib/startPlatform.d.ts.map +1 -1
- package/lib/startPlatform.js +12 -8
- 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 +13 -14
- package/src/bulk-importer/createBulkImporter.ts +1 -1
- package/src/bulk-importer/handlers/assortment/create.ts +1 -1
- package/src/bulk-importer/handlers/assortment/remove.ts +1 -1
- package/src/bulk-importer/handlers/assortment/update.ts +1 -1
- package/src/bulk-importer/handlers/assortment/upsertAssortmentChildren.ts +3 -3
- package/src/bulk-importer/handlers/assortment/upsertAssortmentFilters.ts +3 -3
- package/src/bulk-importer/handlers/assortment/upsertAssortmentProducts.ts +3 -3
- package/src/bulk-importer/handlers/assortment/upsertMedia.ts +2 -2
- package/src/bulk-importer/handlers/filter/create.ts +1 -1
- package/src/bulk-importer/handlers/filter/remove.ts +1 -1
- package/src/bulk-importer/handlers/filter/update.ts +1 -1
- package/src/bulk-importer/handlers/product/create.ts +1 -1
- 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 +3 -3
- package/src/bulk-importer/handlers/product/upsertVariations.ts +3 -3
- package/src/bulk-importer/upsertAsset.ts +3 -3
- package/src/context/setAccessToken.ts +1 -1
- 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 +1 -1
- 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 -25
- 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/src/setup/setupCarts.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UnchainedCore } from '@unchainedshop/
|
|
1
|
+
import { UnchainedCore } from '@unchainedshop/core';
|
|
2
2
|
|
|
3
3
|
export interface SetupCartsOptions {
|
|
4
4
|
invalidateProviders?: boolean;
|
|
@@ -24,7 +24,7 @@ export const setupCarts = async (unchainedAPI: UnchainedCore, options: SetupCart
|
|
|
24
24
|
return unchainedAPI.services.orders.nextUserCart(
|
|
25
25
|
{
|
|
26
26
|
user,
|
|
27
|
-
countryCode: locale.
|
|
27
|
+
countryCode: locale.region,
|
|
28
28
|
},
|
|
29
29
|
unchainedAPI,
|
|
30
30
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MessagingDirector } from '@unchainedshop/core-messaging';
|
|
2
|
-
import { UnchainedCore } from '@unchainedshop/
|
|
2
|
+
import { UnchainedCore } from '@unchainedshop/core';
|
|
3
3
|
import { subscribe } from '@unchainedshop/events';
|
|
4
|
-
import { Order, OrderStatus } from '@unchainedshop/
|
|
4
|
+
import { Order, OrderStatus } from '@unchainedshop/core-orders';
|
|
5
5
|
import { RawPayloadType } from '@unchainedshop/events/EventDirector.js';
|
|
6
6
|
import { resolveOrderRejectionTemplate } from '../templates/resolveOrderRejectionTemplate.js';
|
|
7
7
|
import { resolveAccountActionTemplate } from '../templates/resolveAccountActionTemplate.js';
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
EventListenerWorker,
|
|
3
|
+
FailedRescheduler,
|
|
4
|
+
IntervalWorker,
|
|
5
|
+
WorkerSchedule,
|
|
6
|
+
WorkData,
|
|
7
|
+
} from '@unchainedshop/core-worker';
|
|
8
|
+
import { UnchainedCore } from '@unchainedshop/core';
|
|
4
9
|
|
|
5
10
|
export interface SetupWorkqueueOptions {
|
|
6
11
|
batchCount?: number;
|
package/src/startPlatform.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { startAPIServer,
|
|
2
|
-
import { initCore } from '@unchainedshop/core';
|
|
3
|
-
import { initDb } from '@unchainedshop/mongodb';
|
|
1
|
+
import { startAPIServer, roles, UnchainedServerOptions } from '@unchainedshop/api';
|
|
2
|
+
import { initCore, UnchainedCoreOptions } from '@unchainedshop/core';
|
|
3
|
+
import { initDb, mongodb } from '@unchainedshop/mongodb';
|
|
4
4
|
import { createLogger } from '@unchainedshop/logger';
|
|
5
|
-
import { UnchainedCore
|
|
5
|
+
import { UnchainedCore } from '@unchainedshop/core';
|
|
6
6
|
import { getRegisteredEvents } from '@unchainedshop/events';
|
|
7
7
|
import { WorkerDirector } from '@unchainedshop/core-worker';
|
|
8
|
-
import { AdminUiConfig } from '@unchainedshop/types/api.js';
|
|
9
|
-
import { Db } from 'mongodb';
|
|
10
8
|
import { BulkImportHandler, createBulkImporterFactory } from './bulk-importer/createBulkImporter.js';
|
|
11
9
|
import { runMigrations } from './migrations/runMigrations.js';
|
|
12
10
|
import { setupAccounts } from './setup/setupAccounts.js';
|
|
@@ -14,6 +12,7 @@ import { SetupCartsOptions, setupCarts } from './setup/setupCarts.js';
|
|
|
14
12
|
import { setupTemplates, MessageTypes } from './setup/setupTemplates.js';
|
|
15
13
|
import { SetupWorkqueueOptions, setupWorkqueue } from './setup/setupWorkqueue.js';
|
|
16
14
|
import { createMigrationRepository } from './migrations/migrationRepository.js';
|
|
15
|
+
import { IRoleOptionConfig } from '@unchainedshop/roles';
|
|
17
16
|
|
|
18
17
|
export { MessageTypes };
|
|
19
18
|
|
|
@@ -21,15 +20,20 @@ export type PlatformOptions = {
|
|
|
21
20
|
bulkImporter?: {
|
|
22
21
|
handlers?: Record<string, BulkImportHandler>;
|
|
23
22
|
};
|
|
24
|
-
|
|
25
|
-
workQueueOptions?: SetupWorkqueueOptions & SetupCartsOptions;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
GraphQLServerOptions;
|
|
23
|
+
rolesOptions?: IRoleOptionConfig;
|
|
24
|
+
workQueueOptions?: SetupWorkqueueOptions & SetupCartsOptions & { skipInvalidationOnStartup?: boolean };
|
|
25
|
+
} & Omit<UnchainedCoreOptions, 'bulkImporter' | 'migrationRepository' | 'db'> &
|
|
26
|
+
Omit<UnchainedServerOptions, 'roles' | 'unchainedAPI' | 'workTypes' | 'events'>;
|
|
29
27
|
|
|
30
28
|
const logger = createLogger('unchained');
|
|
31
29
|
|
|
32
|
-
const REQUIRED_ENV_VARIABLES = [
|
|
30
|
+
const REQUIRED_ENV_VARIABLES = [
|
|
31
|
+
'EMAIL_WEBSITE_NAME',
|
|
32
|
+
'EMAIL_WEBSITE_URL',
|
|
33
|
+
'EMAIL_FROM',
|
|
34
|
+
'ROOT_URL',
|
|
35
|
+
'UNCHAINED_TOKEN_SECRET',
|
|
36
|
+
];
|
|
33
37
|
|
|
34
38
|
const { UNCHAINED_DISABLE_WORKER } = process.env;
|
|
35
39
|
|
|
@@ -49,18 +53,17 @@ const checkWorkQueueEnabled = (options: SetupWorkqueueOptions) => {
|
|
|
49
53
|
export const queueWorkers: Array<any> = [];
|
|
50
54
|
|
|
51
55
|
export const startPlatform = async ({
|
|
52
|
-
modules
|
|
53
|
-
services
|
|
54
|
-
options
|
|
55
|
-
adminUiConfig = {},
|
|
56
|
+
modules,
|
|
57
|
+
services,
|
|
58
|
+
options,
|
|
56
59
|
rolesOptions = {},
|
|
57
60
|
bulkImporter: bulkImporterOptions,
|
|
58
61
|
workQueueOptions,
|
|
59
|
-
...
|
|
62
|
+
...arbitraryAPIServerConfiguration
|
|
60
63
|
}: PlatformOptions): Promise<{
|
|
61
64
|
unchainedAPI: UnchainedCore;
|
|
62
|
-
|
|
63
|
-
db: Db;
|
|
65
|
+
graphqlHandler: any;
|
|
66
|
+
db: mongodb.Db;
|
|
64
67
|
}> => {
|
|
65
68
|
exitOnMissingEnvironmentVariables();
|
|
66
69
|
|
|
@@ -79,7 +82,6 @@ export const startPlatform = async ({
|
|
|
79
82
|
modules,
|
|
80
83
|
services,
|
|
81
84
|
options,
|
|
82
|
-
rolesOptions,
|
|
83
85
|
});
|
|
84
86
|
|
|
85
87
|
const isWorkQueueEnabled = checkWorkQueueEnabled(workQueueOptions);
|
|
@@ -98,13 +100,12 @@ export const startPlatform = async ({
|
|
|
98
100
|
setupTemplates(unchainedAPI);
|
|
99
101
|
|
|
100
102
|
// Start the graphQL server
|
|
101
|
-
const
|
|
103
|
+
const graphqlHandler = await startAPIServer({
|
|
102
104
|
unchainedAPI,
|
|
103
105
|
roles: configuredRoles,
|
|
104
106
|
events: configuredEvents,
|
|
105
107
|
workTypes: configuredWorkTypes,
|
|
106
|
-
|
|
107
|
-
...arbitraryGraphQLServerOptions,
|
|
108
|
+
...arbitraryAPIServerConfiguration,
|
|
108
109
|
});
|
|
109
110
|
|
|
110
111
|
// Setup work queues for scheduled work
|
|
@@ -115,9 +116,9 @@ export const startPlatform = async ({
|
|
|
115
116
|
}
|
|
116
117
|
|
|
117
118
|
// Setup filter cache
|
|
118
|
-
if (!
|
|
119
|
+
if (!workQueueOptions?.skipInvalidationOnStartup) {
|
|
119
120
|
setImmediate(() => unchainedAPI.modules.filters.invalidateCache({}, unchainedAPI));
|
|
120
121
|
}
|
|
121
122
|
|
|
122
|
-
return { unchainedAPI,
|
|
123
|
+
return { unchainedAPI, graphqlHandler, db };
|
|
123
124
|
};
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { Order } from '@unchainedshop/types/orders.js';
|
|
1
|
+
import { UnchainedCore } from '@unchainedshop/core';
|
|
2
|
+
import { Order } from '@unchainedshop/core-orders';
|
|
4
3
|
import formatPrice from './formatPrice.js';
|
|
5
4
|
|
|
6
5
|
type PriceFormatter = ({ amount, currency }: { amount: number; currency: string }) => string;
|
|
7
6
|
|
|
8
7
|
export const getOrderPositionsData = async (
|
|
9
8
|
order: Order,
|
|
10
|
-
params: { locale?: Locale; useNetPrice?: boolean; format?: PriceFormatter },
|
|
9
|
+
params: { locale?: Intl.Locale; useNetPrice?: boolean; format?: PriceFormatter },
|
|
11
10
|
context: UnchainedCore,
|
|
12
11
|
) => {
|
|
13
12
|
const { modules } = context;
|
|
@@ -20,11 +19,11 @@ export const getOrderPositionsData = async (
|
|
|
20
19
|
orderPositions.map(async (orderPosition) => {
|
|
21
20
|
const productTexts = await modules.products.texts.findLocalizedText({
|
|
22
21
|
productId: orderPosition.productId,
|
|
23
|
-
locale: params.locale?.
|
|
22
|
+
locale: params.locale?.baseName,
|
|
24
23
|
});
|
|
25
24
|
const originalProductTexts = await modules.products.texts.findLocalizedText({
|
|
26
25
|
productId: orderPosition.originalProductId,
|
|
27
|
-
locale: params.locale?.
|
|
26
|
+
locale: params.locale?.baseName,
|
|
28
27
|
});
|
|
29
28
|
|
|
30
29
|
const positionPricing = modules.orders.positions.pricingSheet(
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { UnchainedCore } from '@unchainedshop/
|
|
2
|
-
import { Order } from '@unchainedshop/
|
|
3
|
-
import { OrderPricingRowCategory } from '@unchainedshop/
|
|
4
|
-
import { Locale } from '@unchainedshop/types/common.js';
|
|
1
|
+
import { UnchainedCore } from '@unchainedshop/core';
|
|
2
|
+
import { Order } from '@unchainedshop/core-orders';
|
|
3
|
+
import { OrderPricingRowCategory } from '@unchainedshop/core-orders';
|
|
5
4
|
import formatPrice from './formatPrice.js';
|
|
6
5
|
import { formatAddress } from './formatAddress.js';
|
|
7
6
|
|
|
@@ -9,7 +8,7 @@ type PriceFormatter = ({ amount, currency }: { amount: number; currency: string
|
|
|
9
8
|
|
|
10
9
|
export const getOrderSummaryData = async (
|
|
11
10
|
order: Order,
|
|
12
|
-
params: { locale?: Locale; useNetPrice?: boolean; format?: PriceFormatter },
|
|
11
|
+
params: { locale?: Intl.Locale; useNetPrice?: boolean; format?: PriceFormatter },
|
|
13
12
|
context: UnchainedCore,
|
|
14
13
|
) => {
|
|
15
14
|
const { modules } = context;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TemplateResolver } from '@unchainedshop/
|
|
1
|
+
import { TemplateResolver } from '@unchainedshop/core-messaging';
|
|
2
2
|
import { transformOrderToText } from './order-parser/index.js';
|
|
3
3
|
|
|
4
4
|
const { EMAIL_FROM, EMAIL_WEBSITE_NAME, EMAIL_WEBSITE_URL } = process.env;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TemplateResolver } from '@unchainedshop/
|
|
1
|
+
import { TemplateResolver } from '@unchainedshop/core-messaging';
|
|
2
2
|
import { transformOrderToText } from './order-parser/index.js';
|
|
3
3
|
|
|
4
4
|
const { EMAIL_FROM, EMAIL_WEBSITE_NAME, EMAIL_WEBSITE_URL } = process.env;
|