@unchainedshop/platform 4.3.3 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +149 -2
- package/lib/context/index.d.ts +1 -2
- package/lib/context/index.js +1 -2
- package/lib/context/setAccessToken.d.ts +1 -2
- package/lib/context/setAccessToken.js +0 -1
- package/lib/migrations/createMigrationRunner.d.ts +0 -1
- package/lib/migrations/createMigrationRunner.js +0 -3
- package/lib/migrations/migrationRepository.d.ts +1 -2
- package/lib/migrations/migrationRepository.js +1 -1
- package/lib/migrations/runMigrations.d.ts +2 -3
- package/lib/migrations/runMigrations.js +1 -2
- package/lib/platform-index.d.ts +4 -5
- package/lib/platform-index.js +4 -5
- package/lib/setup/setupAccounts.d.ts +1 -2
- package/lib/setup/setupAccounts.js +0 -1
- package/lib/setup/setupTemplates.d.ts +11 -11
- package/lib/setup/setupTemplates.js +16 -19
- package/lib/setup/setupUploadHandlers.d.ts +1 -2
- package/lib/setup/setupUploadHandlers.js +0 -1
- package/lib/setup/setupWorkqueue.d.ts +2 -3
- package/lib/setup/setupWorkqueue.js +1 -7
- package/lib/startPlatform.d.ts +6 -7
- package/lib/startPlatform.js +15 -16
- package/lib/templates/index.d.ts +8 -9
- package/lib/templates/index.js +8 -9
- package/lib/templates/order-parser/getOrderPositionsData.d.ts +2 -3
- package/lib/templates/order-parser/getOrderPositionsData.js +0 -1
- package/lib/templates/order-parser/getOrderSummaryData.d.ts +2 -3
- package/lib/templates/order-parser/getOrderSummaryData.js +0 -1
- package/lib/templates/order-parser/index.d.ts +4 -5
- package/lib/templates/order-parser/index.js +2 -3
- package/lib/templates/resolveAccountActionTemplate.d.ts +1 -2
- package/lib/templates/resolveAccountActionTemplate.js +0 -2
- package/lib/templates/resolveEnrollmentStatusTemplate.d.ts +1 -2
- package/lib/templates/resolveEnrollmentStatusTemplate.js +0 -1
- package/lib/templates/resolveErrorReportTemplate.d.ts +1 -2
- package/lib/templates/resolveErrorReportTemplate.js +0 -1
- package/lib/templates/resolveForwardDeliveryTemplate.d.ts +1 -2
- package/lib/templates/resolveForwardDeliveryTemplate.js +1 -2
- package/lib/templates/resolveOrderConfirmationTemplate.d.ts +1 -2
- package/lib/templates/resolveOrderConfirmationTemplate.js +1 -2
- package/lib/templates/resolveOrderRejectionTemplate.d.ts +1 -2
- package/lib/templates/resolveOrderRejectionTemplate.js +1 -2
- package/lib/templates/resolveQuotationStatusTemplate.d.ts +1 -2
- package/lib/templates/resolveQuotationStatusTemplate.js +0 -1
- package/package.json +17 -16
- package/lib/bulk-importer/createBulkImporter.d.ts +0 -20
- package/lib/bulk-importer/createBulkImporter.d.ts.map +0 -1
- package/lib/bulk-importer/createBulkImporter.js +0 -97
- package/lib/bulk-importer/createBulkImporter.js.map +0 -1
- package/lib/bulk-importer/handlers/assortment/create.d.ts +0 -11
- package/lib/bulk-importer/handlers/assortment/create.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/assortment/create.js +0 -60
- package/lib/bulk-importer/handlers/assortment/create.js.map +0 -1
- package/lib/bulk-importer/handlers/assortment/index.d.ts +0 -4
- package/lib/bulk-importer/handlers/assortment/index.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/assortment/index.js +0 -4
- package/lib/bulk-importer/handlers/assortment/index.js.map +0 -1
- package/lib/bulk-importer/handlers/assortment/remove.d.ts +0 -10
- package/lib/bulk-importer/handlers/assortment/remove.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/assortment/remove.js +0 -13
- package/lib/bulk-importer/handlers/assortment/remove.js.map +0 -1
- package/lib/bulk-importer/handlers/assortment/update.d.ts +0 -12
- package/lib/bulk-importer/handlers/assortment/update.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/assortment/update.js +0 -62
- package/lib/bulk-importer/handlers/assortment/update.js.map +0 -1
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.d.ts +0 -7
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.js +0 -37
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.js.map +0 -1
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.d.ts +0 -7
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.js +0 -32
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.js.map +0 -1
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.d.ts +0 -7
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.js +0 -37
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.js.map +0 -1
- package/lib/bulk-importer/handlers/assortment/upsertMedia.d.ts +0 -7
- package/lib/bulk-importer/handlers/assortment/upsertMedia.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/assortment/upsertMedia.js +0 -39
- package/lib/bulk-importer/handlers/assortment/upsertMedia.js.map +0 -1
- package/lib/bulk-importer/handlers/filter/create.d.ts +0 -11
- package/lib/bulk-importer/handlers/filter/create.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/filter/create.js +0 -54
- package/lib/bulk-importer/handlers/filter/create.js.map +0 -1
- package/lib/bulk-importer/handlers/filter/index.d.ts +0 -4
- package/lib/bulk-importer/handlers/filter/index.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/filter/index.js +0 -4
- package/lib/bulk-importer/handlers/filter/index.js.map +0 -1
- package/lib/bulk-importer/handlers/filter/remove.d.ts +0 -10
- package/lib/bulk-importer/handlers/filter/remove.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/filter/remove.js +0 -14
- package/lib/bulk-importer/handlers/filter/remove.js.map +0 -1
- package/lib/bulk-importer/handlers/filter/update.d.ts +0 -11
- package/lib/bulk-importer/handlers/filter/update.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/filter/update.js +0 -44
- package/lib/bulk-importer/handlers/filter/update.js.map +0 -1
- package/lib/bulk-importer/handlers/product/create.d.ts +0 -11
- package/lib/bulk-importer/handlers/product/create.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/product/create.js +0 -51
- package/lib/bulk-importer/handlers/product/create.js.map +0 -1
- package/lib/bulk-importer/handlers/product/index.d.ts +0 -4
- package/lib/bulk-importer/handlers/product/index.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/product/index.js +0 -4
- package/lib/bulk-importer/handlers/product/index.js.map +0 -1
- package/lib/bulk-importer/handlers/product/remove.d.ts +0 -10
- package/lib/bulk-importer/handlers/product/remove.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/product/remove.js +0 -13
- package/lib/bulk-importer/handlers/product/remove.js.map +0 -1
- package/lib/bulk-importer/handlers/product/transformSpecificationToProductStructure.d.ts +0 -3
- package/lib/bulk-importer/handlers/product/transformSpecificationToProductStructure.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/product/transformSpecificationToProductStructure.js +0 -16
- package/lib/bulk-importer/handlers/product/transformSpecificationToProductStructure.js.map +0 -1
- package/lib/bulk-importer/handlers/product/update.d.ts +0 -11
- package/lib/bulk-importer/handlers/product/update.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/product/update.js +0 -48
- package/lib/bulk-importer/handlers/product/update.js.map +0 -1
- package/lib/bulk-importer/handlers/product/upsertMedia.d.ts +0 -6
- package/lib/bulk-importer/handlers/product/upsertMedia.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/product/upsertMedia.js +0 -45
- package/lib/bulk-importer/handlers/product/upsertMedia.js.map +0 -1
- package/lib/bulk-importer/handlers/product/upsertVariations.d.ts +0 -6
- package/lib/bulk-importer/handlers/product/upsertVariations.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/product/upsertVariations.js +0 -42
- package/lib/bulk-importer/handlers/product/upsertVariations.js.map +0 -1
- package/lib/bulk-importer/handlers/utils/convertTagsToLowerCase.d.ts +0 -3
- package/lib/bulk-importer/handlers/utils/convertTagsToLowerCase.d.ts.map +0 -1
- package/lib/bulk-importer/handlers/utils/convertTagsToLowerCase.js +0 -6
- package/lib/bulk-importer/handlers/utils/convertTagsToLowerCase.js.map +0 -1
- package/lib/bulk-importer/upsertAsset.d.ts +0 -8
- package/lib/bulk-importer/upsertAsset.d.ts.map +0 -1
- package/lib/bulk-importer/upsertAsset.js +0 -33
- package/lib/bulk-importer/upsertAsset.js.map +0 -1
- package/lib/context/index.d.ts.map +0 -1
- package/lib/context/index.js.map +0 -1
- package/lib/context/setAccessToken.d.ts.map +0 -1
- package/lib/context/setAccessToken.js.map +0 -1
- package/lib/context/withAccessToken.d.ts +0 -4
- package/lib/context/withAccessToken.d.ts.map +0 -1
- package/lib/context/withAccessToken.js +0 -42
- package/lib/context/withAccessToken.js.map +0 -1
- package/lib/migrations/createMigrationRunner.d.ts.map +0 -1
- package/lib/migrations/createMigrationRunner.js.map +0 -1
- package/lib/migrations/migrationRepository.d.ts.map +0 -1
- package/lib/migrations/migrationRepository.js.map +0 -1
- package/lib/migrations/runMigrations.d.ts.map +0 -1
- package/lib/migrations/runMigrations.js.map +0 -1
- package/lib/platform-index.d.ts.map +0 -1
- package/lib/platform-index.js.map +0 -1
- package/lib/setup/setupAccounts.d.ts.map +0 -1
- package/lib/setup/setupAccounts.js.map +0 -1
- package/lib/setup/setupCarts.d.ts +0 -8
- package/lib/setup/setupCarts.d.ts.map +0 -1
- package/lib/setup/setupCarts.js +0 -17
- package/lib/setup/setupCarts.js.map +0 -1
- package/lib/setup/setupTemplates.d.ts.map +0 -1
- package/lib/setup/setupTemplates.js.map +0 -1
- package/lib/setup/setupUploadHandlers.d.ts.map +0 -1
- package/lib/setup/setupUploadHandlers.js.map +0 -1
- package/lib/setup/setupWorkqueue.d.ts.map +0 -1
- package/lib/setup/setupWorkqueue.js.map +0 -1
- package/lib/startPlatform.d.ts.map +0 -1
- package/lib/startPlatform.js.map +0 -1
- package/lib/templates/index.d.ts.map +0 -1
- package/lib/templates/index.js.map +0 -1
- package/lib/templates/order-parser/formatAddress.d.ts +0 -3
- package/lib/templates/order-parser/formatAddress.d.ts.map +0 -1
- package/lib/templates/order-parser/formatAddress.js +0 -14
- package/lib/templates/order-parser/formatAddress.js.map +0 -1
- package/lib/templates/order-parser/formatPrice.d.ts +0 -6
- package/lib/templates/order-parser/formatPrice.d.ts.map +0 -1
- package/lib/templates/order-parser/formatPrice.js +0 -6
- package/lib/templates/order-parser/formatPrice.js.map +0 -1
- package/lib/templates/order-parser/getOrderPositionsData.d.ts.map +0 -1
- package/lib/templates/order-parser/getOrderPositionsData.js.map +0 -1
- package/lib/templates/order-parser/getOrderSummaryData.d.ts.map +0 -1
- package/lib/templates/order-parser/getOrderSummaryData.js.map +0 -1
- package/lib/templates/order-parser/index.d.ts.map +0 -1
- package/lib/templates/order-parser/index.js.map +0 -1
- package/lib/templates/resolveAccountActionTemplate.d.ts.map +0 -1
- package/lib/templates/resolveAccountActionTemplate.js.map +0 -1
- package/lib/templates/resolveEnrollmentStatusTemplate.d.ts.map +0 -1
- package/lib/templates/resolveEnrollmentStatusTemplate.js.map +0 -1
- package/lib/templates/resolveErrorReportTemplate.d.ts.map +0 -1
- package/lib/templates/resolveErrorReportTemplate.js.map +0 -1
- package/lib/templates/resolveForwardDeliveryTemplate.d.ts.map +0 -1
- package/lib/templates/resolveForwardDeliveryTemplate.js.map +0 -1
- package/lib/templates/resolveOrderConfirmationTemplate.d.ts.map +0 -1
- package/lib/templates/resolveOrderConfirmationTemplate.js.map +0 -1
- package/lib/templates/resolveOrderRejectionTemplate.d.ts.map +0 -1
- package/lib/templates/resolveOrderRejectionTemplate.js.map +0 -1
- package/lib/templates/resolveQuotationStatusTemplate.d.ts.map +0 -1
- package/lib/templates/resolveQuotationStatusTemplate.js.map +0 -1
- package/src/context/index.ts +0 -1
- package/src/context/setAccessToken.ts +0 -22
- package/src/migrations/createMigrationRunner.ts +0 -65
- package/src/migrations/migrationRepository.ts +0 -22
- package/src/migrations/runMigrations.ts +0 -68
- package/src/platform-index.ts +0 -19
- package/src/setup/setupAccounts.ts +0 -11
- package/src/setup/setupTemplates.ts +0 -67
- package/src/setup/setupUploadHandlers.ts +0 -22
- package/src/setup/setupWorkqueue.ts +0 -104
- package/src/startPlatform.ts +0 -128
- package/src/templates/index.ts +0 -9
- package/src/templates/order-parser/getOrderPositionsData.ts +0 -50
- package/src/templates/order-parser/getOrderSummaryData.ts +0 -91
- package/src/templates/order-parser/index.ts +0 -65
- package/src/templates/resolveAccountActionTemplate.ts +0 -127
- package/src/templates/resolveEnrollmentStatusTemplate.ts +0 -34
- package/src/templates/resolveErrorReportTemplate.ts +0 -47
- package/src/templates/resolveForwardDeliveryTemplate.ts +0 -42
- package/src/templates/resolveOrderConfirmationTemplate.ts +0 -40
- package/src/templates/resolveOrderRejectionTemplate.ts +0 -41
- package/src/templates/resolveQuotationStatusTemplate.ts +0 -45
- package/tests/platform-index.test.ts +0 -7
- package/tsconfig.json +0 -9
package/README.md
CHANGED
|
@@ -1,3 +1,150 @@
|
|
|
1
|
-
|
|
1
|
+
[](https://npmjs.com/package/@unchainedshop/platform)
|
|
2
|
+
[](https://opensource.org/licenses/EUPL-1.2)
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
# @unchainedshop/platform
|
|
5
|
+
|
|
6
|
+
Umbrella package for the Unchained Engine. Provides complete platform setup including database initialization, API server, migrations, templates, and runtime configuration.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @unchainedshop/platform
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import { startPlatform } from '@unchainedshop/platform';
|
|
18
|
+
import express from 'express';
|
|
19
|
+
|
|
20
|
+
const app = express();
|
|
21
|
+
|
|
22
|
+
const { unchainedAPI, graphqlHandler } = await startPlatform({
|
|
23
|
+
express: app,
|
|
24
|
+
options: {
|
|
25
|
+
// Platform options
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// Platform is ready
|
|
30
|
+
app.listen(4010);
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## API Overview
|
|
34
|
+
|
|
35
|
+
### Platform Setup
|
|
36
|
+
|
|
37
|
+
| Export | Description |
|
|
38
|
+
|--------|-------------|
|
|
39
|
+
| `startPlatform` | Initialize complete Unchained platform |
|
|
40
|
+
| `runMigrations` | Run database migrations |
|
|
41
|
+
| `printRuntimeConfiguration` | Log registered templates, events, and adapters |
|
|
42
|
+
|
|
43
|
+
### Context Helpers
|
|
44
|
+
|
|
45
|
+
| Export | Description |
|
|
46
|
+
|--------|-------------|
|
|
47
|
+
| `setAccessToken` | Set access token for user session |
|
|
48
|
+
| `getAccessToken` | Get current access token |
|
|
49
|
+
| `invalidateAccessToken` | Invalidate/logout access token |
|
|
50
|
+
|
|
51
|
+
### Templates
|
|
52
|
+
|
|
53
|
+
| Export | Description |
|
|
54
|
+
|--------|-------------|
|
|
55
|
+
| `MessageTypes` | Available message/notification types |
|
|
56
|
+
| `setupTemplates` | Register message templates |
|
|
57
|
+
|
|
58
|
+
### Message Types
|
|
59
|
+
|
|
60
|
+
| Type | Description |
|
|
61
|
+
|------|-------------|
|
|
62
|
+
| `ACCOUNT_ACTION` | Account verification, password reset |
|
|
63
|
+
| `DELIVERY` | Delivery notifications |
|
|
64
|
+
| `ORDER_CONFIRMATION` | Order confirmation emails |
|
|
65
|
+
| `ORDER_REJECTION` | Order rejection notifications |
|
|
66
|
+
| `QUOTATION_STATUS` | Quotation status updates |
|
|
67
|
+
| `ENROLLMENT_STATUS` | Subscription status updates |
|
|
68
|
+
| `FORWARD_DELIVERY` | Forward delivery notifications |
|
|
69
|
+
|
|
70
|
+
## Quick Start
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
import express from 'express';
|
|
74
|
+
import { startPlatform, MessageTypes } from '@unchainedshop/platform';
|
|
75
|
+
|
|
76
|
+
const app = express();
|
|
77
|
+
|
|
78
|
+
const { unchainedAPI, graphqlHandler } = await startPlatform({
|
|
79
|
+
express: app,
|
|
80
|
+
options: {
|
|
81
|
+
modules: {
|
|
82
|
+
// Module-specific configuration
|
|
83
|
+
},
|
|
84
|
+
plugins: [
|
|
85
|
+
// Plugin imports
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
workQueueConfig: {
|
|
89
|
+
// Worker queue configuration
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
// Access unchained API
|
|
94
|
+
const products = await unchainedAPI.modules.products.findProducts({});
|
|
95
|
+
|
|
96
|
+
// Start server
|
|
97
|
+
app.use('/graphql', graphqlHandler);
|
|
98
|
+
app.listen(4010);
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Configuration
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
const platform = await startPlatform({
|
|
105
|
+
express: app,
|
|
106
|
+
options: {
|
|
107
|
+
modules: {
|
|
108
|
+
orders: {
|
|
109
|
+
// Order module options
|
|
110
|
+
},
|
|
111
|
+
products: {
|
|
112
|
+
// Product module options
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
services: {
|
|
116
|
+
// Custom services
|
|
117
|
+
},
|
|
118
|
+
bulkImporter: {
|
|
119
|
+
handlers: {
|
|
120
|
+
// Custom import handlers
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
workQueueConfig: {
|
|
125
|
+
batchSize: 10,
|
|
126
|
+
pollInterval: 1000,
|
|
127
|
+
},
|
|
128
|
+
context: (defaultResolver) => async (props, req, res) => {
|
|
129
|
+
const context = await defaultResolver(props, req, res);
|
|
130
|
+
return {
|
|
131
|
+
...context,
|
|
132
|
+
// Custom context properties
|
|
133
|
+
};
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Returns
|
|
139
|
+
|
|
140
|
+
The `startPlatform` function returns:
|
|
141
|
+
|
|
142
|
+
| Property | Description |
|
|
143
|
+
|----------|-------------|
|
|
144
|
+
| `unchainedAPI` | Complete Unchained core API instance |
|
|
145
|
+
| `graphqlHandler` | GraphQL Yoga server instance for Express/Fastify |
|
|
146
|
+
| `db` | MongoDB database instance |
|
|
147
|
+
|
|
148
|
+
## License
|
|
149
|
+
|
|
150
|
+
EUPL-1.2
|
package/lib/context/index.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export { default as setAccessToken } from './setAccessToken.
|
|
2
|
-
//# sourceMappingURL=index.d.ts.map
|
|
1
|
+
export { default as setAccessToken } from './setAccessToken.ts';
|
package/lib/context/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export { default as setAccessToken } from
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export { default as setAccessToken } from "./setAccessToken.js";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { UnchainedCore } from '@unchainedshop/core';
|
|
1
|
+
import type { UnchainedCore } from '@unchainedshop/core';
|
|
2
2
|
declare const _default: (unchainedAPI: UnchainedCore, username: string, plainSecret: string) => Promise<void>;
|
|
3
3
|
export default _default;
|
|
4
|
-
//# sourceMappingURL=setAccessToken.d.ts.map
|
|
@@ -2,9 +2,7 @@ class MigrationError extends Error {
|
|
|
2
2
|
migrationId;
|
|
3
3
|
date;
|
|
4
4
|
constructor(migrationId = null, ...params) {
|
|
5
|
-
// Pass remaining arguments (including vendor specific ones) to parent constructor
|
|
6
5
|
super(...params);
|
|
7
|
-
// Maintains proper stack trace for where our error was thrown (only available on V8)
|
|
8
6
|
if (Error.captureStackTrace) {
|
|
9
7
|
Error.captureStackTrace(this, MigrationError);
|
|
10
8
|
}
|
|
@@ -48,4 +46,3 @@ export const createMigrationRunner = ({ currentId, logger = console, migrationRe
|
|
|
48
46
|
}
|
|
49
47
|
},
|
|
50
48
|
});
|
|
51
|
-
//# sourceMappingURL=createMigrationRunner.js.map
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { mongodb, MigrationRepository } from '@unchainedshop/mongodb';
|
|
1
|
+
import { mongodb, type MigrationRepository } from '@unchainedshop/mongodb';
|
|
2
2
|
export declare const createMigrationRepository: (db: mongodb.Db) => MigrationRepository;
|
|
3
|
-
//# sourceMappingURL=migrationRepository.d.ts.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { mongodb } from '@unchainedshop/mongodb';
|
|
1
2
|
export const createMigrationRepository = (db) => {
|
|
2
3
|
const migrations = new Map();
|
|
3
4
|
return {
|
|
@@ -16,4 +17,3 @@ export const createMigrationRepository = (db) => {
|
|
|
16
17
|
},
|
|
17
18
|
};
|
|
18
19
|
};
|
|
19
|
-
//# sourceMappingURL=migrationRepository.js.map
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { UnchainedCore } from '@unchainedshop/core';
|
|
2
|
-
import { MigrationRepository } from '@unchainedshop/mongodb';
|
|
1
|
+
import type { UnchainedCore } from '@unchainedshop/core';
|
|
2
|
+
import { type MigrationRepository } from '@unchainedshop/mongodb';
|
|
3
3
|
export declare const runMigrations: ({ migrationRepository, logger, unchainedAPI, }: {
|
|
4
4
|
migrationRepository: MigrationRepository<UnchainedCore>;
|
|
5
5
|
logger?: any;
|
|
6
6
|
unchainedAPI: UnchainedCore;
|
|
7
7
|
}) => Promise<void>;
|
|
8
|
-
//# sourceMappingURL=runMigrations.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createLogger } from '@unchainedshop/logger';
|
|
2
2
|
import { generateDbFilterById } from '@unchainedshop/mongodb';
|
|
3
|
-
import { createMigrationRunner } from
|
|
3
|
+
import { createMigrationRunner } from "./createMigrationRunner.js";
|
|
4
4
|
export const runMigrations = async ({ migrationRepository, logger = createLogger('unchained:migrations'), unchainedAPI, }) => {
|
|
5
5
|
const LastMigration = migrationRepository.db.collection('last-migration');
|
|
6
6
|
const findCurrentId = async () => {
|
|
@@ -44,4 +44,3 @@ export const runMigrations = async ({ migrationRepository, logger = createLogger
|
|
|
44
44
|
logger.warn(`Some migrations failed, last successful id: ${lastMigrationId}`);
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
|
-
//# sourceMappingURL=runMigrations.js.map
|
package/lib/platform-index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
export * from './startPlatform.
|
|
2
|
-
export * from './context/index.
|
|
3
|
-
export * from './templates/index.
|
|
4
|
-
export * from './migrations/runMigrations.
|
|
1
|
+
export * from './startPlatform.ts';
|
|
2
|
+
export * from './context/index.ts';
|
|
3
|
+
export * from './templates/index.ts';
|
|
4
|
+
export * from './migrations/runMigrations.ts';
|
|
5
5
|
export declare const printRuntimeConfiguration: () => void;
|
|
6
|
-
//# sourceMappingURL=platform-index.d.ts.map
|
package/lib/platform-index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
1
|
+
export * from "./startPlatform.js";
|
|
2
|
+
export * from "./context/index.js";
|
|
3
|
+
export * from "./templates/index.js";
|
|
4
|
+
export * from "./migrations/runMigrations.js";
|
|
5
5
|
import { MessagingDirector, getAllAdapters } from '@unchainedshop/core';
|
|
6
6
|
import { getRegisteredEvents } from '@unchainedshop/events';
|
|
7
7
|
import { log } from '@unchainedshop/logger';
|
|
@@ -13,4 +13,3 @@ export const printRuntimeConfiguration = () => {
|
|
|
13
13
|
const adapters = getAllAdapters().map((adapter) => adapter.asString());
|
|
14
14
|
log(`Adapters: ${adapters.length}`, { adapters });
|
|
15
15
|
};
|
|
16
|
-
//# sourceMappingURL=platform-index.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { UnchainedCore } from '@unchainedshop/core';
|
|
2
|
-
export declare
|
|
3
|
-
ACCOUNT_ACTION
|
|
4
|
-
DELIVERY
|
|
5
|
-
ORDER_CONFIRMATION
|
|
6
|
-
ORDER_REJECTION
|
|
7
|
-
QUOTATION_STATUS
|
|
8
|
-
ENROLLMENT_STATUS
|
|
9
|
-
ERROR_REPORT
|
|
10
|
-
}
|
|
1
|
+
import { type UnchainedCore } from '@unchainedshop/core';
|
|
2
|
+
export declare const MessageTypes: {
|
|
3
|
+
readonly ACCOUNT_ACTION: "ACCOUNT_ACTION";
|
|
4
|
+
readonly DELIVERY: "DELIVERY";
|
|
5
|
+
readonly ORDER_CONFIRMATION: "ORDER_CONFIRMATION";
|
|
6
|
+
readonly ORDER_REJECTION: "ORDER_REJECTION";
|
|
7
|
+
readonly QUOTATION_STATUS: "QUOTATION_STATUS";
|
|
8
|
+
readonly ENROLLMENT_STATUS: "ENROLLMENT_STATUS";
|
|
9
|
+
readonly ERROR_REPORT: "ERROR_REPORT";
|
|
10
|
+
};
|
|
11
|
+
export type MessageTypes = (typeof MessageTypes)[keyof typeof MessageTypes];
|
|
11
12
|
export declare const setupTemplates: (unchainedAPI: UnchainedCore) => void;
|
|
12
|
-
//# sourceMappingURL=setupTemplates.d.ts.map
|
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
import { MessagingDirector } from '@unchainedshop/core';
|
|
2
2
|
import { subscribe } from '@unchainedshop/events';
|
|
3
3
|
import { OrderStatus } from '@unchainedshop/core-orders';
|
|
4
|
-
import { resolveOrderRejectionTemplate } from
|
|
5
|
-
import { resolveAccountActionTemplate } from
|
|
6
|
-
import { resolveForwardDeliveryTemplate } from
|
|
7
|
-
import { resolveOrderConfirmationTemplate } from
|
|
8
|
-
import { resolveQuotationStatusTemplate } from
|
|
9
|
-
import { resolveEnrollmentStatusTemplate } from
|
|
10
|
-
import { resolveErrorReportTemplate } from
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
})(MessageTypes || (MessageTypes = {}));
|
|
4
|
+
import { resolveOrderRejectionTemplate } from "../templates/resolveOrderRejectionTemplate.js";
|
|
5
|
+
import { resolveAccountActionTemplate } from "../templates/resolveAccountActionTemplate.js";
|
|
6
|
+
import { resolveForwardDeliveryTemplate } from "../templates/resolveForwardDeliveryTemplate.js";
|
|
7
|
+
import { resolveOrderConfirmationTemplate } from "../templates/resolveOrderConfirmationTemplate.js";
|
|
8
|
+
import { resolveQuotationStatusTemplate } from "../templates/resolveQuotationStatusTemplate.js";
|
|
9
|
+
import { resolveEnrollmentStatusTemplate } from "../templates/resolveEnrollmentStatusTemplate.js";
|
|
10
|
+
import { resolveErrorReportTemplate } from "../templates/resolveErrorReportTemplate.js";
|
|
11
|
+
export const MessageTypes = {
|
|
12
|
+
ACCOUNT_ACTION: 'ACCOUNT_ACTION',
|
|
13
|
+
DELIVERY: 'DELIVERY',
|
|
14
|
+
ORDER_CONFIRMATION: 'ORDER_CONFIRMATION',
|
|
15
|
+
ORDER_REJECTION: 'ORDER_REJECTION',
|
|
16
|
+
QUOTATION_STATUS: 'QUOTATION_STATUS',
|
|
17
|
+
ENROLLMENT_STATUS: 'ENROLLMENT_STATUS',
|
|
18
|
+
ERROR_REPORT: 'ERROR_REPORT',
|
|
19
|
+
};
|
|
21
20
|
export const setupTemplates = (unchainedAPI) => {
|
|
22
21
|
MessagingDirector.registerTemplate(MessageTypes.ACCOUNT_ACTION, resolveAccountActionTemplate);
|
|
23
22
|
MessagingDirector.registerTemplate(MessageTypes.DELIVERY, resolveForwardDeliveryTemplate);
|
|
@@ -31,7 +30,6 @@ export const setupTemplates = (unchainedAPI) => {
|
|
|
31
30
|
const user = await unchainedAPI.modules.users.findUserById(order.userId);
|
|
32
31
|
const locale = unchainedAPI.modules.users.userLocale(user);
|
|
33
32
|
if (order.status === OrderStatus.PENDING) {
|
|
34
|
-
// We only send the "confirmation" when pending, else we let the other events handle it
|
|
35
33
|
await unchainedAPI.services.worker.addMessage(MessageTypes.ORDER_CONFIRMATION, {
|
|
36
34
|
locale: locale.baseName,
|
|
37
35
|
orderId: order._id,
|
|
@@ -57,4 +55,3 @@ export const setupTemplates = (unchainedAPI) => {
|
|
|
57
55
|
});
|
|
58
56
|
});
|
|
59
57
|
};
|
|
60
|
-
//# sourceMappingURL=setupTemplates.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FailedReschedulerParams, IntervalWorkerParams, IScheduler, IWorker, UnchainedCore } from '@unchainedshop/core';
|
|
2
|
-
import { MigrationRepository } from '@unchainedshop/mongodb';
|
|
1
|
+
import { type FailedReschedulerParams, type IntervalWorkerParams, type IScheduler, type IWorker, type UnchainedCore } from '@unchainedshop/core';
|
|
2
|
+
import type { MigrationRepository } from '@unchainedshop/mongodb';
|
|
3
3
|
export type WorkQueueQueueManager = IWorker<any> | IScheduler<any>;
|
|
4
4
|
export interface SetupWorkqueueOptions extends IntervalWorkerParams, FailedReschedulerParams {
|
|
5
5
|
enabledQueueManagers?: WorkQueueQueueManager[];
|
|
@@ -16,4 +16,3 @@ export declare function setupWorkqueue({ unchainedAPI, migrationRepository, ...w
|
|
|
16
16
|
migrationRepository: MigrationRepository<UnchainedCore>;
|
|
17
17
|
} & SetupWorkqueueOptions): Promise<void>;
|
|
18
18
|
export declare function stopWorkqueue(): void;
|
|
19
|
-
//# sourceMappingURL=setupWorkqueue.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EventListenerWorker, FailedRescheduler, IntervalWorker, } from '@unchainedshop/core';
|
|
2
|
-
import { runMigrations } from
|
|
2
|
+
import { runMigrations } from "../migrations/runMigrations.js";
|
|
3
3
|
import { createLogger } from '@unchainedshop/logger';
|
|
4
4
|
const logger = createLogger('unchained:worker');
|
|
5
5
|
const { UNCHAINED_DISABLE_PROVIDER_INVALIDATION, UNCHAINED_DISABLE_WORKER, UNCHAINED_ASSIGN_CART_FOR_USERS, } = process.env;
|
|
@@ -12,22 +12,18 @@ export const queueWorkers = [];
|
|
|
12
12
|
export async function setupWorkqueue({ unchainedAPI, migrationRepository, ...workQueueOptions }) {
|
|
13
13
|
if (workQueueOptions.disableWorker || UNCHAINED_DISABLE_WORKER)
|
|
14
14
|
return;
|
|
15
|
-
// Run migrations
|
|
16
15
|
await runMigrations({ migrationRepository, unchainedAPI });
|
|
17
|
-
// Start queue managers
|
|
18
16
|
(workQueueOptions?.enabledQueueManagers || defaultQueueManagers).forEach((f) => {
|
|
19
17
|
const handler = f.actions(workQueueOptions, unchainedAPI);
|
|
20
18
|
queueWorkers.push(handler);
|
|
21
19
|
handler.start();
|
|
22
20
|
});
|
|
23
|
-
// Invalidate providers on carts
|
|
24
21
|
if (workQueueOptions.invalidateProviders ?? !UNCHAINED_DISABLE_PROVIDER_INVALIDATION) {
|
|
25
22
|
const orders = await unchainedAPI.modules.orders.findCartsToInvalidate(workQueueOptions.providerInvalidationMaxAgeDays);
|
|
26
23
|
await Promise.allSettled(orders.map(async (order) => {
|
|
27
24
|
await unchainedAPI.services.orders.updateCalculation(order._id);
|
|
28
25
|
}));
|
|
29
26
|
}
|
|
30
|
-
// Ensure users have carts
|
|
31
27
|
if (workQueueOptions.assignCartForUsers ?? Boolean(UNCHAINED_ASSIGN_CART_FOR_USERS)) {
|
|
32
28
|
const users = await unchainedAPI.modules.users.findUsers({});
|
|
33
29
|
await Promise.all(users.map((user) => {
|
|
@@ -40,7 +36,6 @@ export async function setupWorkqueue({ unchainedAPI, migrationRepository, ...wor
|
|
|
40
36
|
});
|
|
41
37
|
}));
|
|
42
38
|
}
|
|
43
|
-
// Setup filter cache
|
|
44
39
|
if (!workQueueOptions?.skipInvalidationOnStartup) {
|
|
45
40
|
unchainedAPI.services.filters
|
|
46
41
|
.invalidateFilterCache()
|
|
@@ -56,4 +51,3 @@ export function stopWorkqueue() {
|
|
|
56
51
|
});
|
|
57
52
|
queueWorkers.length = 0;
|
|
58
53
|
}
|
|
59
|
-
//# sourceMappingURL=setupWorkqueue.js.map
|
package/lib/startPlatform.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { UnchainedServerOptions } from '@unchainedshop/api';
|
|
2
|
-
import { UnchainedCoreOptions } from '@unchainedshop/core';
|
|
1
|
+
import { type UnchainedServerOptions } from '@unchainedshop/api';
|
|
2
|
+
import { type UnchainedCoreOptions } from '@unchainedshop/core';
|
|
3
3
|
import { mongodb } from '@unchainedshop/mongodb';
|
|
4
|
-
import { UnchainedCore } from '@unchainedshop/core';
|
|
5
|
-
import { MessageTypes } from './setup/setupTemplates.
|
|
6
|
-
import { SetupWorkqueueOptions } from './setup/setupWorkqueue.
|
|
7
|
-
import { IRoleOptionConfig } from '@unchainedshop/roles';
|
|
4
|
+
import type { UnchainedCore } from '@unchainedshop/core';
|
|
5
|
+
import { MessageTypes } from './setup/setupTemplates.ts';
|
|
6
|
+
import { type SetupWorkqueueOptions } from './setup/setupWorkqueue.ts';
|
|
7
|
+
import type { IRoleOptionConfig } from '@unchainedshop/roles';
|
|
8
8
|
export { MessageTypes };
|
|
9
9
|
export type PlatformOptions = {
|
|
10
10
|
rolesOptions?: IRoleOptionConfig;
|
|
@@ -15,4 +15,3 @@ export declare const startPlatform: ({ modules, services, options, rolesOptions,
|
|
|
15
15
|
graphqlHandler: any;
|
|
16
16
|
db: mongodb.Db;
|
|
17
17
|
}>;
|
|
18
|
-
//# sourceMappingURL=startPlatform.d.ts.map
|
package/lib/startPlatform.js
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
1
9
|
import { startAPIServer, roles } from '@unchainedshop/api';
|
|
2
10
|
import { initCore } from '@unchainedshop/core';
|
|
3
|
-
import { initDb, stopDb } from '@unchainedshop/mongodb';
|
|
11
|
+
import { initDb, mongodb, stopDb } from '@unchainedshop/mongodb';
|
|
4
12
|
import { defaultLogger } from '@unchainedshop/logger';
|
|
5
|
-
import { setupAccounts } from
|
|
6
|
-
import { setupUploadHandlers } from
|
|
7
|
-
import { setupTemplates, MessageTypes } from
|
|
8
|
-
import { stopWorkqueue, setupWorkqueue } from
|
|
9
|
-
import { createMigrationRepository } from
|
|
13
|
+
import { setupAccounts } from "./setup/setupAccounts.js";
|
|
14
|
+
import { setupUploadHandlers } from "./setup/setupUploadHandlers.js";
|
|
15
|
+
import { setupTemplates, MessageTypes } from "./setup/setupTemplates.js";
|
|
16
|
+
import { stopWorkqueue, setupWorkqueue } from "./setup/setupWorkqueue.js";
|
|
17
|
+
import { createMigrationRepository } from "./migrations/migrationRepository.js";
|
|
10
18
|
export { MessageTypes };
|
|
11
19
|
const REQUIRED_ENV_VARIABLES = [
|
|
12
20
|
'EMAIL_WEBSITE_NAME',
|
|
@@ -33,11 +41,8 @@ export const startPlatform = async ({ modules, services, options, rolesOptions,
|
|
|
33
41
|
exitOnMissingEnvironmentVariables();
|
|
34
42
|
existOnInvalidEnvironmentVariables();
|
|
35
43
|
const configuredRoles = roles.configureRoles(rolesOptions || {});
|
|
36
|
-
// Configure database
|
|
37
44
|
const db = await initDb();
|
|
38
|
-
// Prepare Migrations
|
|
39
45
|
const migrationRepository = createMigrationRepository(db);
|
|
40
|
-
// Initialise core api using the database
|
|
41
46
|
const unchainedAPI = await initCore({
|
|
42
47
|
db,
|
|
43
48
|
migrationRepository,
|
|
@@ -46,25 +51,20 @@ export const startPlatform = async ({ modules, services, options, rolesOptions,
|
|
|
46
51
|
services,
|
|
47
52
|
options,
|
|
48
53
|
});
|
|
49
|
-
// Setup Accounts specific extensions and event handlers
|
|
50
54
|
setupAccounts(unchainedAPI);
|
|
51
|
-
// Setup Messaging Templates
|
|
52
55
|
setupTemplates(unchainedAPI);
|
|
53
|
-
// Setup File Upload Handlers
|
|
54
56
|
setupUploadHandlers(unchainedAPI);
|
|
55
|
-
// Start GraphQL Server
|
|
56
57
|
const graphqlHandler = await startAPIServer({
|
|
57
58
|
unchainedAPI,
|
|
58
59
|
roles: configuredRoles,
|
|
59
60
|
...arbitraryAPIServerConfiguration,
|
|
60
61
|
});
|
|
61
|
-
// Setup Work Queue
|
|
62
62
|
await setupWorkqueue({
|
|
63
63
|
unchainedAPI,
|
|
64
64
|
migrationRepository,
|
|
65
65
|
...workQueueOptions,
|
|
66
66
|
});
|
|
67
|
-
const { default: packageJson } = await import(`${import.meta.dirname}/../package.json
|
|
67
|
+
const { default: packageJson } = await import(__rewriteRelativeImportExtension(`${import.meta.dirname}/../package.json`), {
|
|
68
68
|
with: { type: 'json' },
|
|
69
69
|
});
|
|
70
70
|
defaultLogger.info(`Unchained Engine running`, { version: packageJson.version });
|
|
@@ -84,4 +84,3 @@ export const startPlatform = async ({ modules, services, options, rolesOptions,
|
|
|
84
84
|
defaultLogger.debug(`Unchained Engine started in ${(end - start).toFixed(0)} ms`);
|
|
85
85
|
return { unchainedAPI, graphqlHandler, db };
|
|
86
86
|
};
|
|
87
|
-
//# sourceMappingURL=startPlatform.js.map
|
package/lib/templates/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
export { resolveOrderRejectionTemplate } from './resolveOrderRejectionTemplate.
|
|
2
|
-
export { resolveAccountActionTemplate } from './resolveAccountActionTemplate.
|
|
3
|
-
export { resolveForwardDeliveryTemplate } from './resolveForwardDeliveryTemplate.
|
|
4
|
-
export { resolveOrderConfirmationTemplate } from './resolveOrderConfirmationTemplate.
|
|
5
|
-
export { resolveQuotationStatusTemplate } from './resolveQuotationStatusTemplate.
|
|
6
|
-
export { resolveEnrollmentStatusTemplate } from './resolveEnrollmentStatusTemplate.
|
|
7
|
-
export { resolveErrorReportTemplate } from './resolveErrorReportTemplate.
|
|
8
|
-
export * as parser from './order-parser/index.
|
|
9
|
-
//# sourceMappingURL=index.d.ts.map
|
|
1
|
+
export { resolveOrderRejectionTemplate } from './resolveOrderRejectionTemplate.ts';
|
|
2
|
+
export { resolveAccountActionTemplate } from './resolveAccountActionTemplate.ts';
|
|
3
|
+
export { resolveForwardDeliveryTemplate } from './resolveForwardDeliveryTemplate.ts';
|
|
4
|
+
export { resolveOrderConfirmationTemplate } from './resolveOrderConfirmationTemplate.ts';
|
|
5
|
+
export { resolveQuotationStatusTemplate } from './resolveQuotationStatusTemplate.ts';
|
|
6
|
+
export { resolveEnrollmentStatusTemplate } from './resolveEnrollmentStatusTemplate.ts';
|
|
7
|
+
export { resolveErrorReportTemplate } from './resolveErrorReportTemplate.ts';
|
|
8
|
+
export * as parser from './order-parser/index.ts';
|
package/lib/templates/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
export { resolveOrderRejectionTemplate } from
|
|
2
|
-
export { resolveAccountActionTemplate } from
|
|
3
|
-
export { resolveForwardDeliveryTemplate } from
|
|
4
|
-
export { resolveOrderConfirmationTemplate } from
|
|
5
|
-
export { resolveQuotationStatusTemplate } from
|
|
6
|
-
export { resolveEnrollmentStatusTemplate } from
|
|
7
|
-
export { resolveErrorReportTemplate } from
|
|
8
|
-
export * as parser from
|
|
9
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export { resolveOrderRejectionTemplate } from "./resolveOrderRejectionTemplate.js";
|
|
2
|
+
export { resolveAccountActionTemplate } from "./resolveAccountActionTemplate.js";
|
|
3
|
+
export { resolveForwardDeliveryTemplate } from "./resolveForwardDeliveryTemplate.js";
|
|
4
|
+
export { resolveOrderConfirmationTemplate } from "./resolveOrderConfirmationTemplate.js";
|
|
5
|
+
export { resolveQuotationStatusTemplate } from "./resolveQuotationStatusTemplate.js";
|
|
6
|
+
export { resolveEnrollmentStatusTemplate } from "./resolveEnrollmentStatusTemplate.js";
|
|
7
|
+
export { resolveErrorReportTemplate } from "./resolveErrorReportTemplate.js";
|
|
8
|
+
export * as parser from "./order-parser/index.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UnchainedCore } from '@unchainedshop/core';
|
|
2
|
-
import { Order } from '@unchainedshop/core-orders';
|
|
1
|
+
import type { UnchainedCore } from '@unchainedshop/core';
|
|
2
|
+
import type { Order } from '@unchainedshop/core-orders';
|
|
3
3
|
type PriceFormatter = ({ amount, currencyCode }: {
|
|
4
4
|
amount: number;
|
|
5
5
|
currencyCode: string;
|
|
@@ -27,4 +27,3 @@ export declare const getOrderPositionsData: (order: Order, params: {
|
|
|
27
27
|
total: string;
|
|
28
28
|
}[]>;
|
|
29
29
|
export {};
|
|
30
|
-
//# sourceMappingURL=getOrderPositionsData.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Order } from '@unchainedshop/core-orders';
|
|
2
|
-
import { UnchainedCore } from '@unchainedshop/core';
|
|
1
|
+
import type { Order } from '@unchainedshop/core-orders';
|
|
2
|
+
import { type UnchainedCore } from '@unchainedshop/core';
|
|
3
3
|
type PriceFormatter = ({ amount, currencyCode }: {
|
|
4
4
|
amount: number;
|
|
5
5
|
currencyCode: string;
|
|
@@ -44,4 +44,3 @@ export declare const getOrderSummaryData: (order: Order, params: {
|
|
|
44
44
|
billingAddress: string;
|
|
45
45
|
}>;
|
|
46
46
|
export {};
|
|
47
|
-
//# sourceMappingURL=getOrderSummaryData.d.ts.map
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { getOrderPositionsData } from './getOrderPositionsData.
|
|
2
|
-
import { getOrderSummaryData } from './getOrderSummaryData.
|
|
3
|
-
import { Order } from '@unchainedshop/core-orders';
|
|
4
|
-
import { UnchainedCore } from '@unchainedshop/core';
|
|
1
|
+
import { getOrderPositionsData } from './getOrderPositionsData.ts';
|
|
2
|
+
import { getOrderSummaryData } from './getOrderSummaryData.ts';
|
|
3
|
+
import type { Order } from '@unchainedshop/core-orders';
|
|
4
|
+
import type { UnchainedCore } from '@unchainedshop/core';
|
|
5
5
|
export declare const transformOrderToText: ({ order, locale }: {
|
|
6
6
|
order: Order;
|
|
7
7
|
locale: Intl.Locale;
|
|
8
8
|
}, context: UnchainedCore) => Promise<string>;
|
|
9
9
|
export { getOrderPositionsData, getOrderSummaryData };
|
|
10
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getOrderPositionsData } from
|
|
2
|
-
import { getOrderSummaryData } from
|
|
1
|
+
import { getOrderPositionsData } from "./getOrderPositionsData.js";
|
|
2
|
+
import { getOrderSummaryData } from "./getOrderSummaryData.js";
|
|
3
3
|
export const transformOrderToText = async ({ order, locale }, context) => {
|
|
4
4
|
const orderDate = new Date(order.ordered).toLocaleString();
|
|
5
5
|
const orderNumber = order.orderNumber;
|
|
@@ -53,4 +53,3 @@ ${subtotalText}${deliveryFeesText}${paymentFeesText}${totalLine}${taxesText}
|
|
|
53
53
|
`;
|
|
54
54
|
};
|
|
55
55
|
export { getOrderPositionsData, getOrderSummaryData };
|
|
56
|
-
//# sourceMappingURL=index.js.map
|