n8n-nodes-listbee 0.1.0 → 0.2.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.
Files changed (39) hide show
  1. package/README.md +93 -11
  2. package/dist/credentials/ListBeeApi.credentials.d.ts +1 -0
  3. package/dist/credentials/ListBeeApi.credentials.js +2 -1
  4. package/dist/credentials/ListBeeApi.credentials.js.map +1 -1
  5. package/dist/nodes/ListBee/ListBee.node.js +11 -6
  6. package/dist/nodes/ListBee/ListBee.node.js.map +1 -1
  7. package/dist/nodes/ListBee/ListBeeTrigger.node.d.ts +12 -0
  8. package/dist/nodes/ListBee/ListBeeTrigger.node.js +190 -0
  9. package/dist/nodes/ListBee/ListBeeTrigger.node.js.map +1 -0
  10. package/dist/nodes/ListBee/resources/account.d.ts +3 -0
  11. package/dist/nodes/ListBee/resources/account.js +34 -0
  12. package/dist/nodes/ListBee/resources/account.js.map +1 -0
  13. package/dist/nodes/ListBee/resources/index.d.ts +4 -0
  14. package/dist/nodes/ListBee/resources/index.js +16 -0
  15. package/dist/nodes/ListBee/resources/index.js.map +1 -0
  16. package/dist/nodes/ListBee/resources/listing.js +422 -0
  17. package/dist/nodes/ListBee/resources/listing.js.map +1 -0
  18. package/dist/nodes/ListBee/{OrderDescription.js → resources/order.js} +21 -33
  19. package/dist/nodes/ListBee/resources/order.js.map +1 -0
  20. package/dist/nodes/ListBee/resources/webhook.d.ts +3 -0
  21. package/dist/nodes/ListBee/resources/webhook.js +267 -0
  22. package/dist/nodes/ListBee/resources/webhook.js.map +1 -0
  23. package/dist/nodes/ListBee/utils/errors.d.ts +2 -0
  24. package/dist/nodes/ListBee/utils/errors.js +50 -0
  25. package/dist/nodes/ListBee/utils/errors.js.map +1 -0
  26. package/dist/nodes/ListBee/utils/fields.d.ts +12 -0
  27. package/dist/nodes/ListBee/utils/fields.js +49 -0
  28. package/dist/nodes/ListBee/utils/fields.js.map +1 -0
  29. package/dist/nodes/ListBee/utils/transport.d.ts +2 -0
  30. package/dist/nodes/ListBee/utils/transport.js +14 -0
  31. package/dist/nodes/ListBee/utils/transport.js.map +1 -0
  32. package/dist/package.json +24 -14
  33. package/package.json +24 -13
  34. package/dist/nodes/ListBee/ListingDescription.js +0 -235
  35. package/dist/nodes/ListBee/ListingDescription.js.map +0 -1
  36. package/dist/nodes/ListBee/OrderDescription.js.map +0 -1
  37. package/dist/tsconfig.tsbuildinfo +0 -1
  38. /package/dist/nodes/ListBee/{ListingDescription.d.ts → resources/listing.d.ts} +0 -0
  39. /package/dist/nodes/ListBee/{OrderDescription.d.ts → resources/order.d.ts} +0 -0
package/README.md CHANGED
@@ -1,48 +1,130 @@
1
1
  # n8n-nodes-listbee
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/n8n-nodes-listbee)](https://www.npmjs.com/package/n8n-nodes-listbee)
4
+ [![CI](https://github.com/listbee-dev/n8n-nodes-listbee/actions/workflows/ci.yml/badge.svg)](https://github.com/listbee-dev/n8n-nodes-listbee/actions/workflows/ci.yml)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
6
+
3
7
  [n8n](https://n8n.io/) community node for the [ListBee](https://listbee.so) commerce API.
4
8
 
5
- One API call to sell and deliver digital content. This node lets you manage listings and orders directly from your n8n workflows.
9
+ One API call to sell and deliver digital content. This node lets you manage listings, orders, webhooks, and account status directly from your n8n workflows.
6
10
 
7
11
  ## Installation
8
12
 
13
+ ### n8n Community Nodes (recommended)
14
+
9
15
  1. Open your n8n instance
10
16
  2. Go to **Settings** > **Community Nodes**
11
17
  3. Click **Install a community node**
12
18
  4. Enter `n8n-nodes-listbee`
13
19
  5. Click **Install**
14
20
 
15
- ## Credentials
21
+ ### npm
16
22
 
17
- You need a ListBee API key to use this node:
23
+ ```bash
24
+ cd ~/.n8n/custom
25
+ npm install n8n-nodes-listbee
26
+ ```
27
+
28
+ ## Credentials
18
29
 
19
30
  1. Sign up at [listbee.so](https://listbee.so)
20
- 2. Get your API key from the developer console
21
- 3. In n8n, create new **ListBee API** credentials and paste your key
31
+ 2. Get your API key from the developer console (starts with `lb_`)
32
+ 3. In n8n, go to **Credentials** > **Add Credential** > **ListBee API**
33
+ 4. Paste your API key and save — n8n will verify it automatically
34
+
35
+ ## Nodes
36
+
37
+ This package includes two nodes:
38
+
39
+ ### ListBee
40
+
41
+ Regular node for API operations. Can also be used as an AI tool.
42
+
43
+ ### ListBee Trigger
44
+
45
+ Trigger node that starts workflows when ListBee events occur. Automatically registers and cleans up webhooks.
22
46
 
23
47
  ## Operations
24
48
 
49
+ ### Account
50
+
51
+ | Operation | Description |
52
+ |-----------|-------------|
53
+ | Get | Get account status, plan, fee rate, and operational readiness |
54
+
25
55
  ### Listing
26
56
 
27
57
  | Operation | Description |
28
58
  |-----------|-------------|
29
- | Create | Create a new listing with a product page and payment link |
30
- | Get | Get a listing by slug |
31
- | Get Many | List all listings (paginated) |
32
- | Delete | Delete a listing and its content |
59
+ | Create | Create a listing with product page and payment link |
60
+ | Get | Get a listing by slug |
61
+ | Get Many | List all listings (cursor-paginated) |
62
+ | Delete | Delete a listing and its content |
63
+
64
+ **Create supports all listing fields:** name, price, currency, content, description, tagline, CTA, compare-at price, cover image, cover blur, highlights, badges, rating, rating count, reviews, FAQs, and metadata.
33
65
 
34
66
  ### Order
35
67
 
36
68
  | Operation | Description |
37
69
  |-----------|-------------|
38
- | Get | Get an order by ID |
39
- | Get Many | List orders, optionally filtered by status |
70
+ | Get | Get an order by ID |
71
+ | Get Many | List orders, optionally filtered by status |
72
+
73
+ ### Webhook
74
+
75
+ | Operation | Description |
76
+ |-----------|-------------|
77
+ | Create | Register a new webhook endpoint |
78
+ | Get Many | List all webhook subscriptions |
79
+ | Update | Modify webhook configuration |
80
+ | Delete | Remove a webhook |
81
+ | Test | Send a test event to a webhook |
82
+ | Get Events | View delivery logs for a webhook |
83
+
84
+ ## Trigger Events
85
+
86
+ The ListBee Trigger node supports these events:
87
+
88
+ | Event | Description |
89
+ |-------|-------------|
90
+ | `listing.created` | A new listing was created |
91
+ | `order.completed` | A purchase was completed |
92
+ | `order.refunded` | An order was refunded |
93
+ | `order.disputed` | A chargeback/dispute was opened |
94
+ | `order.dispute_closed` | A dispute was resolved |
95
+
96
+ Leave the events field empty to receive all events.
97
+
98
+ When you activate a workflow with a ListBee Trigger, the node automatically creates a webhook in your ListBee account. When you deactivate it, the webhook is deleted. Incoming events are verified using HMAC-SHA256 signatures.
99
+
100
+ ## Pagination
101
+
102
+ List operations (Get Many) use cursor-based pagination:
103
+
104
+ 1. Set **Limit** (1-100, default 20) to control page size
105
+ 2. The response includes a `cursor` field and `has_more` boolean
106
+ 3. Pass the `cursor` value to the next request to get the next page
107
+
108
+ ## Error Handling
109
+
110
+ The node parses ListBee's RFC 9457 error responses into readable messages. For example:
111
+
112
+ - `Validation error: Price must be greater than 0 [field: price]`
113
+ - `Rate limit exceeded — retry after 60s`
114
+ - `Listing not found`
115
+
116
+ Error details include the request ID for support debugging.
117
+
118
+ ## Idempotency
119
+
120
+ Create operations (Listing, Webhook) support an optional **Idempotency Key** in Additional Fields. When provided, the same key + body combination returns a cached response instead of creating a duplicate.
40
121
 
41
122
  ## Resources
42
123
 
43
124
  - [ListBee Website](https://listbee.so)
44
125
  - [API Documentation](https://docs.listbee.so)
45
126
  - [n8n Community Nodes Docs](https://docs.n8n.io/integrations/community-nodes/)
127
+ - [GitHub Repository](https://github.com/listbee-dev/n8n-nodes-listbee)
46
128
 
47
129
  ## License
48
130
 
@@ -3,6 +3,7 @@ export declare class ListBeeApi implements ICredentialType {
3
3
  name: string;
4
4
  displayName: string;
5
5
  documentationUrl: string;
6
+ icon: "file:../nodes/ListBee/listbee.svg";
6
7
  properties: INodeProperties[];
7
8
  authenticate: IAuthenticateGeneric;
8
9
  test: ICredentialTestRequest;
@@ -6,6 +6,7 @@ class ListBeeApi {
6
6
  this.name = 'listBeeApi';
7
7
  this.displayName = 'ListBee API';
8
8
  this.documentationUrl = 'https://docs.listbee.so';
9
+ this.icon = 'file:../nodes/ListBee/listbee.svg';
9
10
  this.properties = [
10
11
  {
11
12
  displayName: 'API Key',
@@ -14,7 +15,7 @@ class ListBeeApi {
14
15
  typeOptions: { password: true },
15
16
  default: '',
16
17
  placeholder: 'lb_...',
17
- description: 'Your ListBee API key. Find it in the ListBee console.',
18
+ description: 'Your ListBee API key from the developer console',
18
19
  },
19
20
  ];
20
21
  this.authenticate = {
@@ -1 +1 @@
1
- {"version":3,"file":"ListBeeApi.credentials.js","sourceRoot":"","sources":["../../credentials/ListBeeApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,UAAU;IAAvB;QACC,SAAI,GAAG,YAAY,CAAC;QACpB,gBAAW,GAAG,aAAa,CAAC;QAC5B,qBAAgB,GAAG,yBAAyB,CAAC;QAE7C,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,QAAQ;gBACrB,WAAW,EAAE,uDAAuD;aACpE;SACD,CAAC;QAEF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,aAAa,EAAE,iCAAiC;iBAChD;aACD;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,wBAAwB;gBACjC,GAAG,EAAE,aAAa;gBAClB,MAAM,EAAE,KAAK;aACb;SACD,CAAC;IACH,CAAC;CAAA;AAjCD,gCAiCC"}
1
+ {"version":3,"file":"ListBeeApi.credentials.js","sourceRoot":"","sources":["../../credentials/ListBeeApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,UAAU;IAAvB;QACC,SAAI,GAAG,YAAY,CAAC;QACpB,gBAAW,GAAG,aAAa,CAAC;QAC5B,qBAAgB,GAAG,yBAAyB,CAAC;QAC7C,SAAI,GAAG,mCAA4C,CAAC;QAEpD,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,QAAQ;gBACrB,WAAW,EAAE,iDAAiD;aAC9D;SACD,CAAC;QAEF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,aAAa,EAAE,iCAAiC;iBAChD;aACD;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,wBAAwB;gBACjC,GAAG,EAAE,aAAa;gBAClB,MAAM,EAAE,KAAK;aACb;SACD,CAAC;IACH,CAAC;CAAA;AAlCD,gCAkCC"}
@@ -2,8 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ListBee = void 0;
4
4
  const n8n_workflow_1 = require("n8n-workflow");
5
- const ListingDescription_1 = require("./ListingDescription");
6
- const OrderDescription_1 = require("./OrderDescription");
5
+ const resources_1 = require("./resources");
7
6
  class ListBee {
8
7
  constructor() {
9
8
  this.description = {
@@ -40,15 +39,21 @@ class ListBee {
40
39
  type: 'options',
41
40
  noDataExpression: true,
42
41
  options: [
42
+ { name: 'Account', value: 'account' },
43
43
  { name: 'Listing', value: 'listing' },
44
44
  { name: 'Order', value: 'order' },
45
+ { name: 'Webhook', value: 'webhook' },
45
46
  ],
46
47
  default: 'listing',
47
48
  },
48
- ...ListingDescription_1.listingOperations,
49
- ...ListingDescription_1.listingFields,
50
- ...OrderDescription_1.orderOperations,
51
- ...OrderDescription_1.orderFields,
49
+ ...resources_1.accountOperations,
50
+ ...resources_1.accountFields,
51
+ ...resources_1.listingOperations,
52
+ ...resources_1.listingFields,
53
+ ...resources_1.orderOperations,
54
+ ...resources_1.orderFields,
55
+ ...resources_1.webhookOperations,
56
+ ...resources_1.webhookFields,
52
57
  ],
53
58
  };
54
59
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ListBee.node.js","sourceRoot":"","sources":["../../../nodes/ListBee/ListBee.node.ts"],"names":[],"mappings":";;;AAAA,+CAIsB;AAEtB,6DAAwE;AACxE,yDAAkE;AAElE,MAAa,OAAO;IAApB;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,SAAS;YACtB,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,kBAAkB;YACxB,KAAK,EAAE,CAAC,OAAO,CAAC;YAChB,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,8DAA8D;YACxE,WAAW,EAAE,sDAAsD;YACnE,QAAQ,EAAE;gBACT,IAAI,EAAE,SAAS;aACf;YACD,MAAM,EAAE,CAAC,kCAAmB,CAAC,IAAI,CAAC;YAClC,OAAO,EAAE,CAAC,kCAAmB,CAAC,IAAI,CAAC;YACnC,YAAY,EAAE,IAAI;YAClB,WAAW,EAAE;gBACZ;oBACC,IAAI,EAAE,YAAY;oBAClB,QAAQ,EAAE,IAAI;iBACd;aACD;YACD,eAAe,EAAE;gBAChB,OAAO,EAAE,wBAAwB;gBACjC,OAAO,EAAE;oBACR,MAAM,EAAE,kBAAkB;oBAC1B,cAAc,EAAE,kBAAkB;iBAClC;aACD;YACD,UAAU,EAAE;gBACX;oBACC,WAAW,EAAE,UAAU;oBACvB,IAAI,EAAE,UAAU;oBAChB,IAAI,EAAE,SAAS;oBACf,gBAAgB,EAAE,IAAI;oBACtB,OAAO,EAAE;wBACR,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;wBACrC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;qBACjC;oBACD,OAAO,EAAE,SAAS;iBAClB;gBACD,GAAG,sCAAiB;gBACpB,GAAG,kCAAa;gBAChB,GAAG,kCAAe;gBAClB,GAAG,8BAAW;aACd;SACD,CAAC;IACH,CAAC;CAAA;AA9CD,0BA8CC"}
1
+ {"version":3,"file":"ListBee.node.js","sourceRoot":"","sources":["../../../nodes/ListBee/ListBee.node.ts"],"names":[],"mappings":";;;AAAA,+CAIsB;AAEtB,2CASqB;AAErB,MAAa,OAAO;IAApB;QACE,gBAAW,GAAyB;YAClC,WAAW,EAAE,SAAS;YACtB,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,kBAAkB;YACxB,KAAK,EAAE,CAAC,OAAO,CAAC;YAChB,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,8DAA8D;YACxE,WAAW,EAAE,sDAAsD;YACnE,QAAQ,EAAE;gBACR,IAAI,EAAE,SAAS;aAChB;YACD,MAAM,EAAE,CAAC,kCAAmB,CAAC,IAAI,CAAC;YAClC,OAAO,EAAE,CAAC,kCAAmB,CAAC,IAAI,CAAC;YACnC,YAAY,EAAE,IAAI;YAClB,WAAW,EAAE;gBACX;oBACE,IAAI,EAAE,YAAY;oBAClB,QAAQ,EAAE,IAAI;iBACf;aACF;YACD,eAAe,EAAE;gBACf,OAAO,EAAE,wBAAwB;gBACjC,OAAO,EAAE;oBACP,MAAM,EAAE,kBAAkB;oBAC1B,cAAc,EAAE,kBAAkB;iBACnC;aACF;YACD,UAAU,EAAE;gBACV;oBACE,WAAW,EAAE,UAAU;oBACvB,IAAI,EAAE,UAAU;oBAChB,IAAI,EAAE,SAAS;oBACf,gBAAgB,EAAE,IAAI;oBACtB,OAAO,EAAE;wBACP,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;wBACrC,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;wBACrC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;wBACjC,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;qBACtC;oBACD,OAAO,EAAE,SAAS;iBACnB;gBACD,GAAG,6BAAiB;gBACpB,GAAG,yBAAa;gBAChB,GAAG,6BAAiB;gBACpB,GAAG,yBAAa;gBAChB,GAAG,2BAAe;gBAClB,GAAG,uBAAW;gBACd,GAAG,6BAAiB;gBACpB,GAAG,yBAAa;aACjB;SACF,CAAC;IACJ,CAAC;CAAA;AApDD,0BAoDC"}
@@ -0,0 +1,12 @@
1
+ import { type IWebhookFunctions, type IHookFunctions, type INodeType, type INodeTypeDescription, type IWebhookResponseData } from 'n8n-workflow';
2
+ export declare class ListBeeTrigger implements INodeType {
3
+ description: INodeTypeDescription;
4
+ webhookMethods: {
5
+ default: {
6
+ checkExists(this: IHookFunctions): Promise<boolean>;
7
+ create(this: IHookFunctions): Promise<boolean>;
8
+ delete(this: IHookFunctions): Promise<boolean>;
9
+ };
10
+ };
11
+ webhook(this: IWebhookFunctions): Promise<IWebhookResponseData>;
12
+ }
@@ -0,0 +1,190 @@
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
+ exports.ListBeeTrigger = void 0;
37
+ const crypto = __importStar(require("crypto"));
38
+ const n8n_workflow_1 = require("n8n-workflow");
39
+ const fields_1 = require("./utils/fields");
40
+ class ListBeeTrigger {
41
+ constructor() {
42
+ this.description = {
43
+ displayName: 'ListBee Trigger',
44
+ name: 'listBeeTrigger',
45
+ icon: 'file:listbee.svg',
46
+ group: ['trigger'],
47
+ version: 1,
48
+ subtitle: '={{$parameter["events"].length > 0 ? $parameter["events"].join(", ") : "all events"}}',
49
+ description: 'Starts the workflow when a ListBee event occurs',
50
+ defaults: {
51
+ name: 'ListBee Trigger',
52
+ },
53
+ inputs: [],
54
+ outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
55
+ usableAsTool: true,
56
+ credentials: [
57
+ {
58
+ name: 'listBeeApi',
59
+ required: true,
60
+ },
61
+ ],
62
+ webhooks: [
63
+ {
64
+ name: 'default',
65
+ httpMethod: 'POST',
66
+ responseMode: 'onReceived',
67
+ path: 'webhook',
68
+ },
69
+ ],
70
+ properties: [
71
+ {
72
+ displayName: 'Events',
73
+ name: 'events',
74
+ type: 'multiOptions',
75
+ default: [],
76
+ description: 'Events to listen for. Leave empty for all events.',
77
+ options: fields_1.webhookEventOptions,
78
+ },
79
+ ],
80
+ };
81
+ this.webhookMethods = {
82
+ default: {
83
+ async checkExists() {
84
+ const webhookUrl = this.getNodeWebhookUrl('default');
85
+ const webhookData = this.getWorkflowStaticData('node');
86
+ if (webhookData.webhookId) {
87
+ try {
88
+ const response = await this.helpers.httpRequestWithAuthentication.call(this, 'listBeeApi', { method: 'GET', url: 'https://api.listbee.so/v1/webhooks', json: true });
89
+ const webhooks = response.data;
90
+ const exists = webhooks === null || webhooks === void 0 ? void 0 : webhooks.some((wh) => wh.id === webhookData.webhookId && wh.url === webhookUrl);
91
+ if (exists)
92
+ return true;
93
+ }
94
+ catch {
95
+ }
96
+ }
97
+ try {
98
+ const response = await this.helpers.httpRequestWithAuthentication.call(this, 'listBeeApi', { method: 'GET', url: 'https://api.listbee.so/v1/webhooks', json: true });
99
+ const webhooks = response.data;
100
+ const existing = webhooks === null || webhooks === void 0 ? void 0 : webhooks.find((wh) => wh.url === webhookUrl);
101
+ if (existing) {
102
+ webhookData.webhookId = existing.id;
103
+ webhookData.webhookSecret = existing.secret;
104
+ return true;
105
+ }
106
+ }
107
+ catch {
108
+ }
109
+ return false;
110
+ },
111
+ async create() {
112
+ const webhookUrl = this.getNodeWebhookUrl('default');
113
+ const events = this.getNodeParameter('events', []);
114
+ const workflowName = this.getWorkflow().name || 'n8n workflow';
115
+ const webhookData = this.getWorkflowStaticData('node');
116
+ const body = {
117
+ name: `n8n: ${workflowName}`,
118
+ url: webhookUrl,
119
+ };
120
+ if (events.length > 0) {
121
+ body.events = events;
122
+ }
123
+ const response = await this.helpers.httpRequestWithAuthentication.call(this, 'listBeeApi', { method: 'POST', url: 'https://api.listbee.so/v1/webhooks', body, json: true });
124
+ const data = response;
125
+ webhookData.webhookId = data.id;
126
+ webhookData.webhookSecret = data.secret;
127
+ return true;
128
+ },
129
+ async delete() {
130
+ const webhookData = this.getWorkflowStaticData('node');
131
+ const webhookId = webhookData.webhookId;
132
+ if (!webhookId)
133
+ return true;
134
+ try {
135
+ await this.helpers.httpRequestWithAuthentication.call(this, 'listBeeApi', { method: 'DELETE', url: `https://api.listbee.so/v1/webhooks/${webhookId}` });
136
+ }
137
+ catch {
138
+ }
139
+ delete webhookData.webhookId;
140
+ delete webhookData.webhookSecret;
141
+ return true;
142
+ },
143
+ },
144
+ };
145
+ }
146
+ async webhook() {
147
+ var _a;
148
+ const req = this.getRequestObject();
149
+ const webhookData = this.getWorkflowStaticData('node');
150
+ const secret = webhookData.webhookSecret;
151
+ if (secret) {
152
+ const signatureHeader = req.headers['x-webhook-signature'] || '';
153
+ const timestampHeader = req.headers['x-webhook-timestamp'] || '';
154
+ if (!verifySignature(((_a = req.rawBody) === null || _a === void 0 ? void 0 : _a.toString()) || '', secret, signatureHeader, timestampHeader)) {
155
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), {
156
+ message: 'Webhook signature verification failed',
157
+ description: 'The request signature is invalid or the timestamp has expired',
158
+ });
159
+ }
160
+ }
161
+ const body = this.getBodyData();
162
+ return {
163
+ workflowData: [this.helpers.returnJsonArray(body)],
164
+ };
165
+ }
166
+ }
167
+ exports.ListBeeTrigger = ListBeeTrigger;
168
+ function verifySignature(body, secret, signatureHeader, timestampHeader, toleranceSec = 300) {
169
+ if (!signatureHeader || !timestampHeader)
170
+ return false;
171
+ const timestamp = parseInt(timestampHeader, 10);
172
+ if (isNaN(timestamp))
173
+ return false;
174
+ const now = Math.floor(Date.now() / 1000);
175
+ if (Math.abs(now - timestamp) > toleranceSec)
176
+ return false;
177
+ const signedPayload = `${timestamp}.${body}`;
178
+ const expectedSig = crypto
179
+ .createHmac('sha256', secret)
180
+ .update(signedPayload)
181
+ .digest('hex');
182
+ const receivedSig = signatureHeader.replace('sha256=', '');
183
+ try {
184
+ return crypto.timingSafeEqual(Buffer.from(expectedSig, 'hex'), Buffer.from(receivedSig, 'hex'));
185
+ }
186
+ catch {
187
+ return false;
188
+ }
189
+ }
190
+ //# sourceMappingURL=ListBeeTrigger.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ListBeeTrigger.node.js","sourceRoot":"","sources":["../../../nodes/ListBee/ListBeeTrigger.node.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AACjC,+CASsB;AAEtB,2CAAqD;AAErD,MAAa,cAAc;IAA3B;QACE,gBAAW,GAAyB;YAClC,WAAW,EAAE,iBAAiB;YAC9B,IAAI,EAA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G,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;IAC1C,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,SAAS,CAAC,GAAG,YAAY;QAAE,OAAO,KAAK,CAAC;IAE3D,MAAM,aAAa,GAAG,GAAG,SAAS,IAAI,IAAI,EAAE,CAAC;IAC7C,MAAM,WAAW,GAAG,MAAM;SACvB,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC;SAC5B,MAAM,CAAC,aAAa,CAAC;SACrB,MAAM,CAAC,KAAK,CAAC,CAAC;IAEjB,MAAM,WAAW,GAAG,eAAe,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IAE3D,IAAI,CAAC;QACH,OAAO,MAAM,CAAC,eAAe,CAC3B,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,EAC/B,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,CAChC,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { INodeProperties } from 'n8n-workflow';
2
+ export declare const accountOperations: INodeProperties[];
3
+ export declare const accountFields: INodeProperties[];
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.accountFields = exports.accountOperations = void 0;
4
+ const errors_1 = require("../utils/errors");
5
+ exports.accountOperations = [
6
+ {
7
+ displayName: 'Operation',
8
+ name: 'operation',
9
+ type: 'options',
10
+ noDataExpression: true,
11
+ displayOptions: {
12
+ show: { resource: ['account'] },
13
+ },
14
+ options: [
15
+ {
16
+ name: 'Get',
17
+ value: 'get',
18
+ action: 'Get account status',
19
+ routing: {
20
+ request: {
21
+ method: 'GET',
22
+ url: '/v1/account',
23
+ },
24
+ output: {
25
+ postReceive: [errors_1.handleApiError],
26
+ },
27
+ },
28
+ },
29
+ ],
30
+ default: 'get',
31
+ },
32
+ ];
33
+ exports.accountFields = [];
34
+ //# sourceMappingURL=account.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account.js","sourceRoot":"","sources":["../../../../nodes/ListBee/resources/account.ts"],"names":[],"mappings":";;;AACA,4CAAiD;AAEpC,QAAA,iBAAiB,GAAsB;IAClD;QACE,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE;YACd,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,SAAS,CAAC,EAAE;SAChC;QACD,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,KAAK;gBACX,KAAK,EAAE,KAAK;gBACZ,MAAM,EAAE,oBAAoB;gBAC5B,OAAO,EAAE;oBACP,OAAO,EAAE;wBACP,MAAM,EAAE,KAAK;wBACb,GAAG,EAAE,aAAa;qBACnB;oBACD,MAAM,EAAE;wBACN,WAAW,EAAE,CAAC,uBAAc,CAAC;qBAC9B;iBACF;aACF;SACF;QACD,OAAO,EAAE,KAAK;KACf;CACF,CAAC;AAEW,QAAA,aAAa,GAAsB,EAAE,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { accountOperations, accountFields } from './account';
2
+ export { listingOperations, listingFields } from './listing';
3
+ export { orderOperations, orderFields } from './order';
4
+ export { webhookOperations, webhookFields } from './webhook';
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.webhookFields = exports.webhookOperations = exports.orderFields = exports.orderOperations = exports.listingFields = exports.listingOperations = exports.accountFields = exports.accountOperations = void 0;
4
+ var account_1 = require("./account");
5
+ Object.defineProperty(exports, "accountOperations", { enumerable: true, get: function () { return account_1.accountOperations; } });
6
+ Object.defineProperty(exports, "accountFields", { enumerable: true, get: function () { return account_1.accountFields; } });
7
+ var listing_1 = require("./listing");
8
+ Object.defineProperty(exports, "listingOperations", { enumerable: true, get: function () { return listing_1.listingOperations; } });
9
+ Object.defineProperty(exports, "listingFields", { enumerable: true, get: function () { return listing_1.listingFields; } });
10
+ var order_1 = require("./order");
11
+ Object.defineProperty(exports, "orderOperations", { enumerable: true, get: function () { return order_1.orderOperations; } });
12
+ Object.defineProperty(exports, "orderFields", { enumerable: true, get: function () { return order_1.orderFields; } });
13
+ var webhook_1 = require("./webhook");
14
+ Object.defineProperty(exports, "webhookOperations", { enumerable: true, get: function () { return webhook_1.webhookOperations; } });
15
+ Object.defineProperty(exports, "webhookFields", { enumerable: true, get: function () { return webhook_1.webhookFields; } });
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../nodes/ListBee/resources/index.ts"],"names":[],"mappings":";;;AAAA,qCAA6D;AAApD,4GAAA,iBAAiB,OAAA;AAAE,wGAAA,aAAa,OAAA;AACzC,qCAA6D;AAApD,4GAAA,iBAAiB,OAAA;AAAE,wGAAA,aAAa,OAAA;AACzC,iCAAuD;AAA9C,wGAAA,eAAe,OAAA;AAAE,oGAAA,WAAW,OAAA;AACrC,qCAA6D;AAApD,4GAAA,iBAAiB,OAAA;AAAE,wGAAA,aAAa,OAAA"}