@solution25/n8n-nodes-shopware 1.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 +80 -0
- package/dist/credentials/ShopwareOAuth2Api.credentials.d.ts +16 -0
- package/dist/credentials/ShopwareOAuth2Api.credentials.js +78 -0
- package/dist/credentials/ShopwareOAuth2Api.credentials.js.map +1 -0
- package/dist/nodes/Shopware/Shopware.node.d.ts +4 -0
- package/dist/nodes/Shopware/Shopware.node.js +23 -0
- package/dist/nodes/Shopware/Shopware.node.js.map +1 -0
- package/dist/nodes/Shopware/Shopware.node.json +18 -0
- package/dist/nodes/Shopware/test/v1/node/customer/getMany.test.d.ts +1 -0
- package/dist/nodes/Shopware/test/v1/node/customer/getMany.test.js +98 -0
- package/dist/nodes/Shopware/test/v1/node/customer/getMany.test.js.map +1 -0
- package/dist/nodes/Shopware/test/v1/node/helpers.d.ts +6 -0
- package/dist/nodes/Shopware/test/v1/node/helpers.js +44 -0
- package/dist/nodes/Shopware/test/v1/node/helpers.js.map +1 -0
- package/dist/nodes/Shopware/test/v1/node/order/getMany.test.d.ts +1 -0
- package/dist/nodes/Shopware/test/v1/node/order/getMany.test.js +111 -0
- package/dist/nodes/Shopware/test/v1/node/order/getMany.test.js.map +1 -0
- package/dist/nodes/Shopware/test/v1/node/product/getMany.test.d.ts +1 -0
- package/dist/nodes/Shopware/test/v1/node/product/getMany.test.js +96 -0
- package/dist/nodes/Shopware/test/v1/node/product/getMany.test.js.map +1 -0
- package/dist/nodes/Shopware/v1/ShopwareV1.node.d.ts +10 -0
- package/dist/nodes/Shopware/v1/ShopwareV1.node.js +23 -0
- package/dist/nodes/Shopware/v1/ShopwareV1.node.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/category/Category.resource.d.ts +8 -0
- package/dist/nodes/Shopware/v1/actions/category/Category.resource.js +98 -0
- package/dist/nodes/Shopware/v1/actions/category/Category.resource.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/category/create.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/category/create.operation.js +211 -0
- package/dist/nodes/Shopware/v1/actions/category/create.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/category/deleteCategory.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/category/deleteCategory.operation.js +47 -0
- package/dist/nodes/Shopware/v1/actions/category/deleteCategory.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/category/fields.d.ts +1 -0
- package/dist/nodes/Shopware/v1/actions/category/fields.js +21 -0
- package/dist/nodes/Shopware/v1/actions/category/fields.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/category/get.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/category/get.operation.js +77 -0
- package/dist/nodes/Shopware/v1/actions/category/get.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/category/getMany.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/category/getMany.operation.js +164 -0
- package/dist/nodes/Shopware/v1/actions/category/getMany.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/category/types.d.ts +19 -0
- package/dist/nodes/Shopware/v1/actions/category/types.js +3 -0
- package/dist/nodes/Shopware/v1/actions/category/types.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/category/update.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/category/update.operation.js +120 -0
- package/dist/nodes/Shopware/v1/actions/category/update.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/customer/Customer.resource.d.ts +8 -0
- package/dist/nodes/Shopware/v1/actions/customer/Customer.resource.js +98 -0
- package/dist/nodes/Shopware/v1/actions/customer/Customer.resource.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/customer/create.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/customer/create.operation.js +301 -0
- package/dist/nodes/Shopware/v1/actions/customer/create.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/customer/deleteCustomer.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/customer/deleteCustomer.operation.js +47 -0
- package/dist/nodes/Shopware/v1/actions/customer/deleteCustomer.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/customer/fields.d.ts +4 -0
- package/dist/nodes/Shopware/v1/actions/customer/fields.js +30 -0
- package/dist/nodes/Shopware/v1/actions/customer/fields.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/customer/get.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/customer/get.operation.js +77 -0
- package/dist/nodes/Shopware/v1/actions/customer/get.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/customer/getMany.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/customer/getMany.operation.js +319 -0
- package/dist/nodes/Shopware/v1/actions/customer/getMany.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/customer/types.d.ts +54 -0
- package/dist/nodes/Shopware/v1/actions/customer/types.js +3 -0
- package/dist/nodes/Shopware/v1/actions/customer/types.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/customer/update.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/customer/update.operation.js +287 -0
- package/dist/nodes/Shopware/v1/actions/customer/update.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/fields.d.ts +5 -0
- package/dist/nodes/Shopware/v1/actions/fields.js +26 -0
- package/dist/nodes/Shopware/v1/actions/fields.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/node.type.d.ts +9 -0
- package/dist/nodes/Shopware/v1/actions/node.type.js +3 -0
- package/dist/nodes/Shopware/v1/actions/node.type.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/order/Order.resource.d.ts +8 -0
- package/dist/nodes/Shopware/v1/actions/order/Order.resource.js +98 -0
- package/dist/nodes/Shopware/v1/actions/order/Order.resource.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/order/create.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/order/create.operation.js +861 -0
- package/dist/nodes/Shopware/v1/actions/order/create.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/order/deleteOrder.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/order/deleteOrder.operation.js +47 -0
- package/dist/nodes/Shopware/v1/actions/order/deleteOrder.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/order/fields.d.ts +2 -0
- package/dist/nodes/Shopware/v1/actions/order/fields.js +25 -0
- package/dist/nodes/Shopware/v1/actions/order/fields.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/order/get.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/order/get.operation.js +77 -0
- package/dist/nodes/Shopware/v1/actions/order/get.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/order/getMany.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/order/getMany.operation.js +226 -0
- package/dist/nodes/Shopware/v1/actions/order/getMany.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/order/types.d.ts +171 -0
- package/dist/nodes/Shopware/v1/actions/order/types.js +3 -0
- package/dist/nodes/Shopware/v1/actions/order/types.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/order/update.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/order/update.operation.js +723 -0
- package/dist/nodes/Shopware/v1/actions/order/update.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/product/Product.resource.d.ts +8 -0
- package/dist/nodes/Shopware/v1/actions/product/Product.resource.js +98 -0
- package/dist/nodes/Shopware/v1/actions/product/Product.resource.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/product/create.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/product/create.operation.js +335 -0
- package/dist/nodes/Shopware/v1/actions/product/create.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/product/deleteProduct.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/product/deleteProduct.operation.js +47 -0
- package/dist/nodes/Shopware/v1/actions/product/deleteProduct.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/product/fields.d.ts +7 -0
- package/dist/nodes/Shopware/v1/actions/product/fields.js +33 -0
- package/dist/nodes/Shopware/v1/actions/product/fields.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/product/get.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/product/get.operation.js +77 -0
- package/dist/nodes/Shopware/v1/actions/product/get.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/product/getMany.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/product/getMany.operation.js +319 -0
- package/dist/nodes/Shopware/v1/actions/product/getMany.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/product/types.d.ts +66 -0
- package/dist/nodes/Shopware/v1/actions/product/types.js +3 -0
- package/dist/nodes/Shopware/v1/actions/product/types.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/product/update.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/product/update.operation.js +287 -0
- package/dist/nodes/Shopware/v1/actions/product/update.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/router.d.ts +2 -0
- package/dist/nodes/Shopware/v1/actions/router.js +78 -0
- package/dist/nodes/Shopware/v1/actions/router.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/types.d.ts +97 -0
- package/dist/nodes/Shopware/v1/actions/types.js +3 -0
- package/dist/nodes/Shopware/v1/actions/types.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/versionDescription.d.ts +2 -0
- package/dist/nodes/Shopware/v1/actions/versionDescription.js +93 -0
- package/dist/nodes/Shopware/v1/actions/versionDescription.js.map +1 -0
- package/dist/nodes/Shopware/v1/helpers/handlers.d.ts +14 -0
- package/dist/nodes/Shopware/v1/helpers/handlers.js +261 -0
- package/dist/nodes/Shopware/v1/helpers/handlers.js.map +1 -0
- package/dist/nodes/Shopware/v1/helpers/interfaces.d.ts +1 -0
- package/dist/nodes/Shopware/v1/helpers/interfaces.js +3 -0
- package/dist/nodes/Shopware/v1/helpers/interfaces.js.map +1 -0
- package/dist/nodes/Shopware/v1/helpers/utils.d.ts +16 -0
- package/dist/nodes/Shopware/v1/helpers/utils.js +354 -0
- package/dist/nodes/Shopware/v1/helpers/utils.js.map +1 -0
- package/dist/nodes/Shopware/v1/methods/index.d.ts +1 -0
- package/dist/nodes/Shopware/v1/methods/index.js +38 -0
- package/dist/nodes/Shopware/v1/methods/index.js.map +1 -0
- package/dist/nodes/Shopware/v1/methods/loadOptions.d.ts +18 -0
- package/dist/nodes/Shopware/v1/methods/loadOptions.js +143 -0
- package/dist/nodes/Shopware/v1/methods/loadOptions.js.map +1 -0
- package/dist/nodes/Shopware/v1/transport/index.d.ts +2 -0
- package/dist/nodes/Shopware/v1/transport/index.js +25 -0
- package/dist/nodes/Shopware/v1/transport/index.js.map +1 -0
- package/dist/package.json +63 -0
- package/dist/shopware.png +0 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +63 -0
package/README.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# @solution25/n8n-nodes-shopware
|
|
2
|
+
|
|
3
|
+
This is an n8n community node. It lets you use Shopware 6 in your n8n workflows.
|
|
4
|
+
|
|
5
|
+
Shopware 6 is a modern, open-source, headless e-commerce platform designed for flexibility and scalability. With this node, you can connect your Shopware store to other services and automate tasks such as product management, order processing, and customer handling.
|
|
6
|
+
|
|
7
|
+
[n8n](https://n8n.io/) is a [fair-code licensed](https://docs.n8n.io/reference/license/) workflow automation platform.
|
|
8
|
+
|
|
9
|
+
[Installation](#installation)
|
|
10
|
+
[Operations](#operations)
|
|
11
|
+
[Credentials](#credentials)
|
|
12
|
+
[Compatibility](#compatibility)
|
|
13
|
+
[Usage](#usage)
|
|
14
|
+
[Resources](#resources)
|
|
15
|
+
[Version history](#version-history)
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes/installation/) in the n8n community nodes documentation.
|
|
20
|
+
|
|
21
|
+
## Operations
|
|
22
|
+
|
|
23
|
+
This node currently supports the following resources and operations:
|
|
24
|
+
|
|
25
|
+
| Resource | Get | Get Many | Create | Update | Delete |
|
|
26
|
+
|----------|-----|----------|--------|--------|--------|
|
|
27
|
+
| Product | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
28
|
+
| Customer | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
29
|
+
| Order | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
30
|
+
|
|
31
|
+
## Credentials
|
|
32
|
+
|
|
33
|
+
Authentication is handled via a [Shopware Integration](https://docs.shopware.com/en/shopware-6-en/settings/system/integrationen), which you can create in the Shopware admin panel.
|
|
34
|
+
Required fields:
|
|
35
|
+
|
|
36
|
+
* Domain (your Shopware 6 store URL)
|
|
37
|
+
|
|
38
|
+
* Client ID
|
|
39
|
+
|
|
40
|
+
* Client Secret
|
|
41
|
+
|
|
42
|
+
Once configured, the node uses these credentials to authenticate against the Shopware Admin API.
|
|
43
|
+
|
|
44
|
+
## Compatibility
|
|
45
|
+
|
|
46
|
+
n8n version: tested with the latest n8n release (keep n8n updated for best compatibility).
|
|
47
|
+
|
|
48
|
+
Shopware version: compatible with Shopware 6.6.x.x.
|
|
49
|
+
|
|
50
|
+
## Usage
|
|
51
|
+
|
|
52
|
+
Here are a few examples of what you can do with this node:
|
|
53
|
+
|
|
54
|
+
* Automatically create a new customer in Shopware when a signup happens in another system.
|
|
55
|
+
|
|
56
|
+
* Sync products between Shopware and an external inventory tool.
|
|
57
|
+
|
|
58
|
+
* Fetch new orders and send notifications to Slack, email, or other channels.
|
|
59
|
+
|
|
60
|
+
For general n8n usage, see the [Try it out guide](https://docs.n8n.io/try-it-out/).
|
|
61
|
+
|
|
62
|
+
## Resources
|
|
63
|
+
|
|
64
|
+
* [n8n community nodes documentation](https://docs.n8n.io/integrations/#community-nodes)
|
|
65
|
+
* [Shopware 6 Admin API reference](https://shopware.stoplight.io/docs/admin-api/twpxvnspkg3yu-quick-start-guide)
|
|
66
|
+
* [Shopware documentation](https://docs.shopware.com)
|
|
67
|
+
* [Shopware official site](https://www.shopware.com)
|
|
68
|
+
|
|
69
|
+
## Version history
|
|
70
|
+
|
|
71
|
+
| Version | Description |
|
|
72
|
+
| --------------- | ------------------------------------------------------------ |
|
|
73
|
+
| **0.1.0-alpha** | Pre-release with basic product, customer, and order support. |
|
|
74
|
+
| **1.0.0** | Initial release with full product resource support. |
|
|
75
|
+
| **1.1.0** | Added full support for customer resource. |
|
|
76
|
+
| **1.2.0** | Added full support for order resource. |
|
|
77
|
+
| **1.2.1** | Fixed order creation using node-created customers. |
|
|
78
|
+
| **1.3.0** | Added advanced filtering for all resources. |
|
|
79
|
+
| **1.3.1** | Added base unit testing for all resources. |
|
|
80
|
+
| **1.4.0** | Added full support for categories resource. |
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { IAuthenticateGeneric, ICredentialDataDecryptedObject, ICredentialTestRequest, ICredentialType, IHttpRequestHelper, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare class ShopwareOAuth2Api implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
documentationUrl: string;
|
|
6
|
+
icon: {
|
|
7
|
+
readonly light: "file:../shopware.png";
|
|
8
|
+
readonly dark: "file:../shopware.png";
|
|
9
|
+
};
|
|
10
|
+
properties: INodeProperties[];
|
|
11
|
+
preAuthentication(this: IHttpRequestHelper, credentials: ICredentialDataDecryptedObject): Promise<{
|
|
12
|
+
accessToken: string;
|
|
13
|
+
}>;
|
|
14
|
+
authenticate: IAuthenticateGeneric;
|
|
15
|
+
test: ICredentialTestRequest;
|
|
16
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ShopwareOAuth2Api = void 0;
|
|
4
|
+
class ShopwareOAuth2Api {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'shopwareOAuth2Api';
|
|
7
|
+
this.displayName = 'Shopware OAuth2 API';
|
|
8
|
+
this.documentationUrl = 'https://docs.shopware.com/en/shopware-6-en/settings/system/integrationen';
|
|
9
|
+
this.icon = { light: 'file:../shopware.png', dark: 'file:../shopware.png' };
|
|
10
|
+
this.properties = [
|
|
11
|
+
{
|
|
12
|
+
displayName: 'Access Token',
|
|
13
|
+
name: 'accessToken',
|
|
14
|
+
type: 'hidden',
|
|
15
|
+
typeOptions: {
|
|
16
|
+
expirable: true,
|
|
17
|
+
},
|
|
18
|
+
default: '',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
displayName: 'URL',
|
|
22
|
+
name: 'url',
|
|
23
|
+
type: 'string',
|
|
24
|
+
required: true,
|
|
25
|
+
default: '',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
displayName: 'Client ID',
|
|
29
|
+
name: 'clientId',
|
|
30
|
+
type: 'string',
|
|
31
|
+
required: true,
|
|
32
|
+
default: '',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
displayName: 'Client Secret',
|
|
36
|
+
name: 'clientSecret',
|
|
37
|
+
type: 'string',
|
|
38
|
+
typeOptions: {
|
|
39
|
+
password: true,
|
|
40
|
+
},
|
|
41
|
+
required: true,
|
|
42
|
+
default: '',
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
this.authenticate = {
|
|
46
|
+
type: 'generic',
|
|
47
|
+
properties: {
|
|
48
|
+
headers: {
|
|
49
|
+
Authorization: '=Bearer {{$credentials.accessToken}}',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
this.test = {
|
|
54
|
+
request: {
|
|
55
|
+
baseURL: '={{$credentials?.url}}',
|
|
56
|
+
url: '/api/_info/version',
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
async preAuthentication(credentials) {
|
|
61
|
+
const url = credentials.url;
|
|
62
|
+
const { access_token } = (await this.helpers.httpRequest({
|
|
63
|
+
method: 'POST',
|
|
64
|
+
url: `${url.endsWith('/') ? url.slice(0, -1) : url}/api/oauth/token`,
|
|
65
|
+
body: {
|
|
66
|
+
client_id: credentials.clientId,
|
|
67
|
+
client_secret: credentials.clientSecret,
|
|
68
|
+
grant_type: 'client_credentials',
|
|
69
|
+
},
|
|
70
|
+
headers: {
|
|
71
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
72
|
+
},
|
|
73
|
+
}));
|
|
74
|
+
return { accessToken: access_token };
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.ShopwareOAuth2Api = ShopwareOAuth2Api;
|
|
78
|
+
//# sourceMappingURL=ShopwareOAuth2Api.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShopwareOAuth2Api.credentials.js","sourceRoot":"","sources":["../../credentials/ShopwareOAuth2Api.credentials.ts"],"names":[],"mappings":";;;AASA,MAAa,iBAAiB;IAA9B;QACC,SAAI,GAAG,mBAAmB,CAAC;QAE3B,gBAAW,GAAG,qBAAqB,CAAC;QAEpC,qBAAgB,GAAG,0EAA0E,CAAC;QAE9F,SAAI,GAAG,EAAE,KAAK,EAAE,sBAAsB,EAAE,IAAI,EAAE,sBAAsB,EAAW,CAAC;QAEhF,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,cAAc;gBAC3B,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,QAAQ;gBAEd,WAAW,EAAE;oBACZ,SAAS,EAAE,IAAI;iBACf;gBACD,OAAO,EAAE,EAAE;aACX;YACD;gBACC,WAAW,EAAE,KAAK;gBAClB,IAAI,EAAE,KAAK;gBACX,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE,EAAE;aACX;YACD;gBACC,WAAW,EAAE,WAAW;gBACxB,IAAI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use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Shopware = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const ShopwareV1_node_1 = require("./v1/ShopwareV1.node");
|
|
6
|
+
class Shopware extends n8n_workflow_1.VersionedNodeType {
|
|
7
|
+
constructor() {
|
|
8
|
+
const baseDescription = {
|
|
9
|
+
displayName: 'Shopware',
|
|
10
|
+
name: 'shopware',
|
|
11
|
+
icon: 'file:../../../shopware.png',
|
|
12
|
+
group: ['input'],
|
|
13
|
+
description: 'Read, update, write and delete data from Shopware',
|
|
14
|
+
defaultVersion: 1,
|
|
15
|
+
};
|
|
16
|
+
const nodeVersions = {
|
|
17
|
+
1: new ShopwareV1_node_1.ShopwareV1(baseDescription),
|
|
18
|
+
};
|
|
19
|
+
super(nodeVersions, baseDescription);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.Shopware = Shopware;
|
|
23
|
+
//# sourceMappingURL=Shopware.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Shopware.node.js","sourceRoot":"","sources":["../../../nodes/Shopware/Shopware.node.ts"],"names":[],"mappings":";;;AACA,+CAAiD;AAEjD,0DAAkD;AAElD,MAAa,QAAS,SAAQ,gCAAiB;IAC9C;QACC,MAAM,eAAe,GAA6B;YACjD,WAAW,EAAE,UAAU;YACvB,IAAI,EAAE,UAAU;YAEhB,IAAI,EAAE,4BAA4B;YAClC,KAAK,EAAE,CAAC,OAAO,CAAC;YAChB,WAAW,EAAE,mDAAmD;YAChE,cAAc,EAAE,CAAC;SACjB,CAAC;QAEF,MAAM,YAAY,GAAuC;YACxD,CAAC,EAAE,IAAI,4BAAU,CAAC,eAAe,CAAC;SAClC,CAAC;QAEF,KAAK,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC;IACtC,CAAC;CACD;AAlBD,4BAkBC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"node": "@solution25/n8n-nodes-shopware",
|
|
3
|
+
"nodeVersion": "1.0",
|
|
4
|
+
"codexVersion": "1.0",
|
|
5
|
+
"categories": ["Development", "Developer Tools"],
|
|
6
|
+
"resources": {
|
|
7
|
+
"credentialDocumentation": [
|
|
8
|
+
{
|
|
9
|
+
"url": "https://github.com/org/repo?tab=readme-ov-file#credentials"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"primaryDocumentation": [
|
|
13
|
+
{
|
|
14
|
+
"url": "https://github.com/org/repo?tab=readme-ov-file"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const fields_1 = require("../../../../v1/actions/customer/fields");
|
|
37
|
+
const getMany = __importStar(require("../../../../v1/actions/customer/getMany.operation"));
|
|
38
|
+
const transport = __importStar(require("../../../../v1/transport"));
|
|
39
|
+
const helpers_1 = require("../helpers");
|
|
40
|
+
jest.mock('../../../../v1/transport', () => {
|
|
41
|
+
const originalModule = jest.requireActual('../../../../v1/transport');
|
|
42
|
+
return {
|
|
43
|
+
...originalModule,
|
|
44
|
+
apiRequest: jest.fn(async function (method) {
|
|
45
|
+
if (method === 'POST') {
|
|
46
|
+
return {
|
|
47
|
+
data: [
|
|
48
|
+
{
|
|
49
|
+
id: 'aksldfjaksljf',
|
|
50
|
+
firstName: 'John',
|
|
51
|
+
lastName: 'Doe',
|
|
52
|
+
email: 'john@example.com',
|
|
53
|
+
customerNumber: 'CN2038409',
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
return undefined;
|
|
59
|
+
}),
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
describe('Test Shopwarev1, getMany operation', () => {
|
|
63
|
+
it('should return all customers', async () => {
|
|
64
|
+
const nodeParameters = {
|
|
65
|
+
operation: 'getMany',
|
|
66
|
+
returnAll: true,
|
|
67
|
+
filters: {
|
|
68
|
+
fields: '',
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
const items = [
|
|
72
|
+
{
|
|
73
|
+
json: {},
|
|
74
|
+
},
|
|
75
|
+
];
|
|
76
|
+
const result = await getMany.execute.call((0, helpers_1.createMockExecuteFunction)(nodeParameters), items);
|
|
77
|
+
expect(transport.apiRequest).toHaveBeenCalledTimes(1);
|
|
78
|
+
expect(transport.apiRequest).toHaveBeenCalledWith('POST', '/search/customer', {
|
|
79
|
+
fields: fields_1.customerFields,
|
|
80
|
+
filter: [],
|
|
81
|
+
includes: { customer: fields_1.customerFields },
|
|
82
|
+
limit: 50,
|
|
83
|
+
page: 1,
|
|
84
|
+
});
|
|
85
|
+
expect(result).toHaveLength(1);
|
|
86
|
+
expect(result[0]).toEqual({
|
|
87
|
+
json: {
|
|
88
|
+
id: 'aksldfjaksljf',
|
|
89
|
+
firstName: 'John',
|
|
90
|
+
lastName: 'Doe',
|
|
91
|
+
email: 'john@example.com',
|
|
92
|
+
customerNumber: 'CN2038409',
|
|
93
|
+
},
|
|
94
|
+
pairedItem: { item: 0 },
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
//# sourceMappingURL=getMany.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getMany.test.js","sourceRoot":"","sources":["../../../../../../../nodes/Shopware/test/v1/node/customer/getMany.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mEAAwE;AACxE,2FAA6E;AAC7E,oEAAsD;AACtD,wCAAuD;AAEvD,IAAI,CAAC,IAAI,CAAC,0BAA0B,EAAE,GAAG,EAAE;IAC1C,MAAM,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC,0BAA0B,CAAC,CAAC;IACtE,OAAO;QACN,GAAG,cAAc;QACjB,UAAU,EAAE,IAAI,CAAC,EAAE,CAAC,KAAK,WAAW,MAAc;YACjD,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;gBACvB,OAAO;oBACN,IAAI,EAAE;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AAK,EAAE,kBAAkB;gBACzB,cAAc,EAAE,WAAW;aAC3B;YACD,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;SACvB,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { INodeExecutionData, IPairedItemData, NodeExecutionWithMetadata, IDataObject, IExecuteFunctions, INode } from 'n8n-workflow';
|
|
2
|
+
export declare const node: INode;
|
|
3
|
+
export declare function constructExecutionMetaData(inputData: INodeExecutionData[], options: {
|
|
4
|
+
itemData: IPairedItemData | IPairedItemData[];
|
|
5
|
+
}): NodeExecutionWithMetadata[];
|
|
6
|
+
export declare const createMockExecuteFunction: (nodeParameters: IDataObject) => IExecuteFunctions;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createMockExecuteFunction = exports.node = void 0;
|
|
7
|
+
exports.constructExecutionMetaData = constructExecutionMetaData;
|
|
8
|
+
const get_1 = __importDefault(require("lodash/get"));
|
|
9
|
+
exports.node = {
|
|
10
|
+
id: '11',
|
|
11
|
+
name: 'Shopware node',
|
|
12
|
+
typeVersion: 1,
|
|
13
|
+
type: 'n8n-community-nodes.shopware',
|
|
14
|
+
position: [42, 42],
|
|
15
|
+
parameters: {
|
|
16
|
+
operation: 'getMany',
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
function constructExecutionMetaData(inputData, options) {
|
|
20
|
+
const { itemData } = options;
|
|
21
|
+
return inputData.map((data) => {
|
|
22
|
+
const { json, ...rest } = data;
|
|
23
|
+
return { json, pairedItem: itemData, ...rest };
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
const createMockExecuteFunction = (nodeParameters) => {
|
|
27
|
+
const fakeExecuteFunction = {
|
|
28
|
+
getInputData: jest.fn(() => {
|
|
29
|
+
return [{ json: {} }];
|
|
30
|
+
}),
|
|
31
|
+
getNodeParameter: jest.fn((parameterName, _itemIndex, fallbackValue, options) => {
|
|
32
|
+
const parameter = (options === null || options === void 0 ? void 0 : options.extractValue) ? `${parameterName}.value` : parameterName;
|
|
33
|
+
return (0, get_1.default)(nodeParameters, parameter, fallbackValue);
|
|
34
|
+
}),
|
|
35
|
+
getNode: jest.fn(() => {
|
|
36
|
+
return exports.node;
|
|
37
|
+
}),
|
|
38
|
+
helpers: { constructExecutionMetaData: jest.fn(constructExecutionMetaData) },
|
|
39
|
+
continueOnFail: jest.fn(() => false),
|
|
40
|
+
};
|
|
41
|
+
return fakeExecuteFunction;
|
|
42
|
+
};
|
|
43
|
+
exports.createMockExecuteFunction = createMockExecuteFunction;
|
|
44
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../nodes/Shopware/test/v1/node/helpers.ts"],"names":[],"mappings":";;;;;;AA2BA,gEASC;AApCD,qDAA6B;AAWhB,QAAA,IAAI,GAAU;IAC1B,EAAE,EAAE,IAAI;IACR,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,CAAC;IACd,IAAI,EAAE,8BAA8B;IACpC,QAAQ,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;IAClB,UAAU,EAAE;QACX,SAAS,EAAE,SAAS;KACpB;CACD,CAAC;AAOF,SAAgB,0BAA0B,CACzC,SAA+B,EAC/B,OAA0D;IAE1D,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAC7B,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,IAAwB,EAAE,EAAE;QACjD,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;QAC/B,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,IAAI,EAA+B,CAAC;IAC7E,CAAC,CAAC,CAAC;AACJ,CAAC;AAEM,MAAM,yBAAyB,GAAG,CAAC,cAA2B,EAAE,EAAE;IACxE,MAAM,mBAAmB,GAAG;QAC3B,YAAY,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE;YAC1B,OAAO,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;QACvB,CAAC,CAAC;QACF,gBAAgB,EAAE,IAAI,CAAC,EAAE,CACxB,CACC,aAAqB,EACrB,UAAkB,EAClB,aAA2B,EAC3B,OAAkC,EACjC,EAAE;YACH,MAAM,SAAS,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,YAAY,EAAC,CAAC,CAAC,GAAG,aAAa,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC;YACnF,OAAO,IAAA,aAAG,EAAC,cAAc,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;QACtD,CAAC,CACD;QACD,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE;YACrB,OAAO,YAAI,CAAC;QACb,CAAC,CAAC;QACF,OAAO,EAAE,EAAE,0BAA0B,EAAE,IAAI,CAAC,EAAE,CAAC,0BAA0B,CAAC,EAAE;QAC5E,cAAc,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC;KACJ,CAAC;IAClC,OAAO,mBAAmB,CAAC;AAC5B,CAAC,CAAC;AAvBW,QAAA,yBAAyB,6BAuBpC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const fields_1 = require("../../../../v1/actions/order/fields");
|
|
37
|
+
const getMany = __importStar(require("../../../../v1/actions/order/getMany.operation"));
|
|
38
|
+
const transport = __importStar(require("../../../../v1/transport"));
|
|
39
|
+
const helpers_1 = require("../helpers");
|
|
40
|
+
jest.mock('../../../../v1/transport', () => {
|
|
41
|
+
const originalModule = jest.requireActual('../../../../v1/transport');
|
|
42
|
+
return {
|
|
43
|
+
...originalModule,
|
|
44
|
+
apiRequest: jest.fn(async function (method) {
|
|
45
|
+
if (method === 'POST') {
|
|
46
|
+
return {
|
|
47
|
+
data: [
|
|
48
|
+
{
|
|
49
|
+
id: 'aksldfjaksljf',
|
|
50
|
+
orderNumber: 'ON389043',
|
|
51
|
+
orderDateTime: '2025/10/01',
|
|
52
|
+
amountTotal: 39.99,
|
|
53
|
+
amountNet: 30.99,
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
return undefined;
|
|
59
|
+
}),
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
describe('Test Shopwarev1, getMany operation', () => {
|
|
63
|
+
it('should return all orders', async () => {
|
|
64
|
+
const nodeParameters = {
|
|
65
|
+
operation: 'getMany',
|
|
66
|
+
returnAll: true,
|
|
67
|
+
filters: {
|
|
68
|
+
fields: '',
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
const items = [
|
|
72
|
+
{
|
|
73
|
+
json: {},
|
|
74
|
+
},
|
|
75
|
+
];
|
|
76
|
+
const result = await getMany.execute.call((0, helpers_1.createMockExecuteFunction)(nodeParameters), items);
|
|
77
|
+
expect(transport.apiRequest).toHaveBeenCalledTimes(1);
|
|
78
|
+
expect(transport.apiRequest).toHaveBeenCalledWith('POST', '/search/order', {
|
|
79
|
+
fields: fields_1.orderFields,
|
|
80
|
+
filter: [],
|
|
81
|
+
includes: { order: fields_1.orderFields },
|
|
82
|
+
limit: 50,
|
|
83
|
+
page: 1,
|
|
84
|
+
associations: {
|
|
85
|
+
currency: {},
|
|
86
|
+
deliveries: {
|
|
87
|
+
associations: {
|
|
88
|
+
stateMachineState: {},
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
transactions: {
|
|
92
|
+
associations: {
|
|
93
|
+
stateMachineState: {},
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
expect(result).toHaveLength(1);
|
|
99
|
+
expect(result[0]).toEqual({
|
|
100
|
+
json: {
|
|
101
|
+
id: 'aksldfjaksljf',
|
|
102
|
+
orderNumber: 'ON389043',
|
|
103
|
+
orderDateTime: '2025/10/01',
|
|
104
|
+
amountTotal: 39.99,
|
|
105
|
+
amountNet: 30.99,
|
|
106
|
+
},
|
|
107
|
+
pairedItem: { item: 0 },
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
//# sourceMappingURL=getMany.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getMany.test.js","sourceRoot":"","sources":["../../../../../../../nodes/Shopware/test/v1/node/order/getMany.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gEAAkE;AAClE,wFAA0E;AAC1E,oEAAsD;AACtD,wCAAuD;AAEvD,IAAI,CAAC,IAAI,CAAC,0BAA0B,EAAE,GAAG,EAAE;IAC1C,MAAM,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC,0BAA0B,CAAC,CAAC;IACtE,OAAO;QACN,GAAG,cAAc;QACjB,UAAU,EAAE,IAAI,CAAC,EAAE,CAAC,KAAK,WAAW,MAAc;YACjD,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;gBACvB,OAAO;oBACN,IAAI,EAAE;wBACL;4BACC,EAAE,EAAE,eAAe;4BACnB,WAAW,EAAE,UAAU;4BACvB,aAAa,EAAE,YAAY;4BAC3B,WAAW,EAAE,KAAK;4BAClB,SAAS,EAAE,KAAK;yBAChB;qBACD;iBACD,CAAC;YACH,CAAC;YACD,OAAO,SAAS,CAAC;QAClB,CAAC,CAAC;KACF,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,oCAAoC,EAAE,GAAG,EAAE;IACnD,EAAE,CAAC,0BAA0B,EAAE,KAAK,IAAI,EAAE;QACzC,MAAM,cAAc,GAAG;YACtB,SAAS,EAAE,SAAS;YACpB,SAAS,EAAE,IAAI;YACf,OAAO,EAAE;g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1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const fields_1 = require("../../../../v1/actions/product/fields");
|
|
37
|
+
const getMany = __importStar(require("../../../../v1/actions/product/getMany.operation"));
|
|
38
|
+
const transport = __importStar(require("../../../../v1/transport"));
|
|
39
|
+
const helpers_1 = require("../helpers");
|
|
40
|
+
jest.mock('../../../../v1/transport', () => {
|
|
41
|
+
const originalModule = jest.requireActual('../../../../v1/transport');
|
|
42
|
+
return {
|
|
43
|
+
...originalModule,
|
|
44
|
+
apiRequest: jest.fn(async function (method) {
|
|
45
|
+
if (method === 'POST') {
|
|
46
|
+
return {
|
|
47
|
+
data: [
|
|
48
|
+
{
|
|
49
|
+
id: 'aksldfjaksljf',
|
|
50
|
+
name: 'testName',
|
|
51
|
+
productNumber: 'PN389043',
|
|
52
|
+
stock: 3,
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
return undefined;
|
|
58
|
+
}),
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
describe('Test Shopwarev1, getMany operation', () => {
|
|
62
|
+
it('should return all products', async () => {
|
|
63
|
+
const nodeParameters = {
|
|
64
|
+
operation: 'getMany',
|
|
65
|
+
returnAll: true,
|
|
66
|
+
filters: {
|
|
67
|
+
fields: '',
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
const items = [
|
|
71
|
+
{
|
|
72
|
+
json: {},
|
|
73
|
+
},
|
|
74
|
+
];
|
|
75
|
+
const result = await getMany.execute.call((0, helpers_1.createMockExecuteFunction)(nodeParameters), items);
|
|
76
|
+
expect(transport.apiRequest).toHaveBeenCalledTimes(1);
|
|
77
|
+
expect(transport.apiRequest).toHaveBeenCalledWith('POST', '/search/product', {
|
|
78
|
+
fields: fields_1.productFields,
|
|
79
|
+
filter: [],
|
|
80
|
+
includes: { product: fields_1.productFields },
|
|
81
|
+
limit: 50,
|
|
82
|
+
page: 1,
|
|
83
|
+
});
|
|
84
|
+
expect(result).toHaveLength(1);
|
|
85
|
+
expect(result[0]).toEqual({
|
|
86
|
+
json: {
|
|
87
|
+
id: 'aksldfjaksljf',
|
|
88
|
+
name: 'testName',
|
|
89
|
+
productNumber: 'PN389043',
|
|
90
|
+
stock: 3,
|
|
91
|
+
},
|
|
92
|
+
pairedItem: { item: 0 },
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
//# sourceMappingURL=getMany.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getMany.test.js","sourceRoot":"","sources":["../../../../../../../nodes/Shopware/test/v1/node/product/getMany.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kEAAsE;AACtE,0FAA4E;AAC5E,oEAAsD;AACtD,wCAAuD;AAEvD,IAAI,CAAC,IAAI,CAAC,0BAA0B,EAAE,GAAG,EAAE;IAC1C,MAAM,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC,0BAA0B,CAAC,CAAC;IACtE,OAAO;QACN,GAAG,cAAc;QACjB,UAAU,EAAE,IAAI,CAAC,EAAE,CAAC,KAAK,WAAW,MAAc;YACjD,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;gBACvB,OAAO;oBACN,IAAI,EAAE;wBACL;4BACC,EAAE,EAAE,eAAe;4BACnB,IAAI,EAAE,UAAU;4BACK,aAAa,EAAE,UAAU;4BAC9C,KAAK,EAAE,CAAC;yBACR;qBACD;iBACD,CAAC;YACH,CAAC;YACD,OAAO,SAAS,CAAC;QAClB,CAAC,CAAC;KACF,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,oCAAoC,EAAE,GAAG,EAAE;IACnD,EAAE,CAAC,4BAA4B,EAAE,KAAK,IAAI,EAAE;QAC3C,MAAM,cAAc,GAAG;YACtB,SAAS,EAAE,SAAS;YACpB,SAAS,EAAE,IAAI;YACf,OAAO,EAAE;gBACR,MAAM,EAAE,EAAE;aACV;SACD,CAAC;QAEF,MAAM,KAAK,GAAG;YACb;gBACC,IAAI,EAAE,EAAE;aACR;SACD,CAAC;QAEF,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,mCAAyB,EAAC,cAAc,CAAC,EAAE,KAAK,CAAC,CAAC;QAE5F,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QACtD,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,oBAAoB,CAAC,MAAM,EAAE,iBAAiB,EAAE;YAC5E,MAAM,EAAE,sBAAa;YACrB,MAAM,EAAE,EAAE;YACV,QAAQ,EAAE,EAAE,OAAO,EAAE,sBAAa,EAAE;YACpC,KAAK,EAAE,EAAE;YACT,IAAI,EAAE,CAAC;SACP,CAAC,CAAC;QACH,MAAM,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QAC/B,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;YACzB,IAAI,EAAE;gBACL,EAAE,EAAE,eAAe;gBACnB,IAAI,EAAE,UAAU;gBAChB,aAAa,EAAE,UAAU;gBACzB,KAAK,EAAE,CAAC;aACR;YACD,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;SACvB,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IExecuteFunctions, INodeType, INodeTypeDescription, INodeTypeBaseDescription } from 'n8n-workflow';
|
|
2
|
+
import { loadOptions } from './methods';
|
|
3
|
+
export declare class ShopwareV1 implements INodeType {
|
|
4
|
+
description: INodeTypeDescription;
|
|
5
|
+
constructor(baseDescription: INodeTypeBaseDescription);
|
|
6
|
+
methods: {
|
|
7
|
+
loadOptions: typeof loadOptions;
|
|
8
|
+
};
|
|
9
|
+
execute(this: IExecuteFunctions): Promise<import("n8n-workflow").INodeExecutionData[][]>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ShopwareV1 = void 0;
|
|
4
|
+
const router_1 = require("./actions/router");
|
|
5
|
+
const versionDescription_1 = require("./actions/versionDescription");
|
|
6
|
+
const methods_1 = require("./methods");
|
|
7
|
+
class ShopwareV1 {
|
|
8
|
+
constructor(baseDescription) {
|
|
9
|
+
this.methods = {
|
|
10
|
+
loadOptions: methods_1.loadOptions,
|
|
11
|
+
};
|
|
12
|
+
this.description = {
|
|
13
|
+
...baseDescription,
|
|
14
|
+
...versionDescription_1.versionDescription,
|
|
15
|
+
usableAsTool: true,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
async execute() {
|
|
19
|
+
return await router_1.router.call(this);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.ShopwareV1 = ShopwareV1;
|
|
23
|
+
//# sourceMappingURL=ShopwareV1.node.js.map
|