@fjacquet/n8n-nodes-getbring 0.0.0-stage → 0.1.1
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/LICENSE +24 -0
- package/README.md +210 -2
- package/dist/credentials/BringApi.credentials.d.ts +9 -0
- package/dist/credentials/BringApi.credentials.js +41 -0
- package/dist/credentials/BringApi.credentials.js.map +1 -0
- package/dist/nodes/Bring/Bring.node.d.ts +10 -0
- package/dist/nodes/Bring/Bring.node.js +220 -0
- package/dist/nodes/Bring/Bring.node.js.map +1 -0
- package/dist/nodes/Bring/Bring.node.json +12 -0
- package/dist/nodes/Bring/batch.d.ts +21 -0
- package/dist/nodes/Bring/batch.js +25 -0
- package/dist/nodes/Bring/batch.js.map +1 -0
- package/dist/nodes/Bring/bring.dark.svg +6 -0
- package/dist/nodes/Bring/bring.svg +6 -0
- package/dist/nodes/Bring/descriptions/CatalogDescription.d.ts +2 -0
- package/dist/nodes/Bring/descriptions/CatalogDescription.js +45 -0
- package/dist/nodes/Bring/descriptions/CatalogDescription.js.map +1 -0
- package/dist/nodes/Bring/descriptions/ItemDescription.d.ts +2 -0
- package/dist/nodes/Bring/descriptions/ItemDescription.js +79 -0
- package/dist/nodes/Bring/descriptions/ItemDescription.js.map +1 -0
- package/dist/nodes/Bring/descriptions/ListDescription.d.ts +3 -0
- package/dist/nodes/Bring/descriptions/ListDescription.js +57 -0
- package/dist/nodes/Bring/descriptions/ListDescription.js.map +1 -0
- package/dist/nodes/Bring/items.d.ts +19 -0
- package/dist/nodes/Bring/items.js +23 -0
- package/dist/nodes/Bring/items.js.map +1 -0
- package/dist/nodes/Bring/lists.d.ts +27 -0
- package/dist/nodes/Bring/lists.js +33 -0
- package/dist/nodes/Bring/lists.js.map +1 -0
- package/dist/nodes/Bring/locales/articles.de-AT.json +383 -0
- package/dist/nodes/Bring/locales/articles.de-CH.json +444 -0
- package/dist/nodes/Bring/locales/articles.de-DE.json +446 -0
- package/dist/nodes/Bring/locales/articles.en-AU.json +389 -0
- package/dist/nodes/Bring/locales/articles.en-CA.json +386 -0
- package/dist/nodes/Bring/locales/articles.en-GB.json +388 -0
- package/dist/nodes/Bring/locales/articles.en-US.json +385 -0
- package/dist/nodes/Bring/locales/articles.es-ES.json +375 -0
- package/dist/nodes/Bring/locales/articles.fr-CH.json +387 -0
- package/dist/nodes/Bring/locales/articles.fr-FR.json +333 -0
- package/dist/nodes/Bring/locales/articles.hu-HU.json +351 -0
- package/dist/nodes/Bring/locales/articles.it-CH.json +391 -0
- package/dist/nodes/Bring/locales/articles.it-IT.json +322 -0
- package/dist/nodes/Bring/locales/articles.nb-NO.json +356 -0
- package/dist/nodes/Bring/locales/articles.nl-NL.json +373 -0
- package/dist/nodes/Bring/locales/articles.pl-PL.json +354 -0
- package/dist/nodes/Bring/locales/articles.pt-BR.json +367 -0
- package/dist/nodes/Bring/locales/articles.ru-RU.json +367 -0
- package/dist/nodes/Bring/locales/articles.sv-SE.json +356 -0
- package/dist/nodes/Bring/locales/articles.tr-TR.json +355 -0
- package/dist/nodes/Bring/translation.d.ts +8 -0
- package/dist/nodes/Bring/translation.js +105 -0
- package/dist/nodes/Bring/translation.js.map +1 -0
- package/dist/nodes/Bring/transport.d.ts +12 -0
- package/dist/nodes/Bring/transport.js +89 -0
- package/dist/nodes/Bring/transport.js.map +1 -0
- package/dist/package.json +66 -0
- package/package.json +64 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Cyrill Raccaud <cyrill.raccaud+pypi@gmail.com>
|
|
4
|
+
Copyright (c) 2024 Manfred Dennerlein Rodelo <manfred@dennerlein.name>
|
|
5
|
+
Copyright (c) 2022-2024 Elias Ball <contact.eliasball@gmail.com>
|
|
6
|
+
Copyright (c) 2026 Frederic Jacquet
|
|
7
|
+
|
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
10
|
+
in the Software without restriction, including without limitation the rights
|
|
11
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
furnished to do so, subject to the following conditions:
|
|
14
|
+
|
|
15
|
+
The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,211 @@
|
|
|
1
|
-
#
|
|
1
|
+
# n8n-nodes-getbring
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@fjacquet/n8n-nodes-getbring)
|
|
4
|
+
[](https://www.npmjs.com/package/@fjacquet/n8n-nodes-getbring)
|
|
5
|
+
[](https://github.com/fjacquet/n8n-nodes-getbring/actions/workflows/ci.yml)
|
|
6
|
+
[](./LICENSE)
|
|
7
|
+
[](https://nodejs.org)
|
|
8
|
+
[](https://docs.n8n.io/integrations/community-nodes/)
|
|
9
|
+
|
|
10
|
+
An [n8n](https://n8n.io) community node for [Bring!](https://www.getbring.com) shopping lists. List your lists, read their items, add, remove and complete items, and read the article catalog.
|
|
11
|
+
|
|
12
|
+
Item names are translated to Bring's catalog keys, so an item you add as "Oignons" shows up in the app with its icon instead of as a plain custom item.
|
|
13
|
+
|
|
14
|
+
This package is a TypeScript port of [miaucl/bring-api](https://github.com/miaucl/bring-api). It has no runtime dependencies.
|
|
15
|
+
|
|
16
|
+
## Requirements
|
|
17
|
+
|
|
18
|
+
- n8n with community nodes enabled.
|
|
19
|
+
- Node.js 24 or later (set in `engines`).
|
|
20
|
+
- A Bring! account with an email address and password.
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
In n8n open **Settings → Community Nodes → Install** and enter:
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
@fjacquet/n8n-nodes-getbring
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Or, for a self-managed custom-nodes directory:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm install @fjacquet/n8n-nodes-getbring
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Credential setup
|
|
37
|
+
|
|
38
|
+
1. In n8n create a credential of type **Bring API**.
|
|
39
|
+
2. Enter the **Email** and **Password** of your Bring! account.
|
|
40
|
+
3. Click **Test**. It tries to sign in.
|
|
41
|
+
|
|
42
|
+
The node signs in once per execution and reuses the session for all input items. The password and tokens never appear in node output or error messages.
|
|
43
|
+
|
|
44
|
+
## Node usage
|
|
45
|
+
|
|
46
|
+
Add the **Bring!** node, pick the credential, then a resource and an operation.
|
|
47
|
+
|
|
48
|
+
Every operation that takes a **List** offers three modes: pick from a list, enter the list **ID** (UUID), or enter the list **Name**. A name must match exactly one list. If no list or several lists have that name, the node stops with an error that names the list.
|
|
49
|
+
|
|
50
|
+
| Resource | Operation | What it does |
|
|
51
|
+
|---|---|---|
|
|
52
|
+
| List | Get Many | Returns one item per list: `listUuid`, `name`, `theme`. |
|
|
53
|
+
| List | Get Items | Returns the items of one list. |
|
|
54
|
+
| Item | Add | Adds items to a list. |
|
|
55
|
+
| Item | Remove | Removes items from a list. |
|
|
56
|
+
| Item | Complete | Marks items as bought; Bring moves them to "recently used". |
|
|
57
|
+
| Catalog | Get | Returns the article catalog of a locale. |
|
|
58
|
+
|
|
59
|
+
### List → Get Many
|
|
60
|
+
|
|
61
|
+
No parameters. Output per list:
|
|
62
|
+
|
|
63
|
+
```json
|
|
64
|
+
{ "listUuid": "…", "name": "Maison", "theme": "…" }
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### List → Get Items
|
|
68
|
+
|
|
69
|
+
- **List**: the list to read.
|
|
70
|
+
- **Include Recently Used**: off by default. When on, items from the "recently" section are returned too.
|
|
71
|
+
|
|
72
|
+
Output per item:
|
|
73
|
+
|
|
74
|
+
```json
|
|
75
|
+
{
|
|
76
|
+
"key": "Zwiebeln",
|
|
77
|
+
"name": "Oignons",
|
|
78
|
+
"specification": "3 pièces",
|
|
79
|
+
"uuid": "…",
|
|
80
|
+
"status": "purchase",
|
|
81
|
+
"listUuid": "…"
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
`key` is the Bring catalog key (German). `name` is the display name in the list's language. `status` is `purchase` or `recently`.
|
|
86
|
+
|
|
87
|
+
### Item → Add, Remove, Complete
|
|
88
|
+
|
|
89
|
+
Parameters:
|
|
90
|
+
|
|
91
|
+
- **List**: the target list.
|
|
92
|
+
- **Item Name**: the name to add, remove or complete. Required. A blank name makes that item fail.
|
|
93
|
+
- **Specification**: optional detail such as a quantity or brand.
|
|
94
|
+
- **Item UUID** (Remove and Complete only): target one specific item.
|
|
95
|
+
- **Options → Translate Name**: on by default. See [Translation](#translation).
|
|
96
|
+
|
|
97
|
+
Each input item produces one output item: your input fields plus `key`, `name`, `specification`, `uuid`, `listUuid` and `operation` (`TO_PURCHASE`, `REMOVE` or `TO_RECENTLY`). `uuid` is always present for Add. For Remove and Complete it is present only when you gave an **Item UUID**.
|
|
98
|
+
|
|
99
|
+
Add generates a UUID for each new item. Remove and Complete without an **Item UUID** act on the newest item with that name, which is how Bring resolves it. Pass the `uuid` returned by Get Items to target an exact item.
|
|
100
|
+
|
|
101
|
+
All input items for the same list are sent to Bring in one request.
|
|
102
|
+
|
|
103
|
+
### Catalog → Get
|
|
104
|
+
|
|
105
|
+
- **Locale Source**: **Fixed Locale** (default) or **From List**.
|
|
106
|
+
- **Locale**: one of the 20 supported locales. Used with Fixed Locale. No login is needed in this mode.
|
|
107
|
+
- **List**: used with From List. The node reads that list's article language.
|
|
108
|
+
|
|
109
|
+
Output: one item per article, `{ "key": "Zwiebeln", "name": "Oignons", "locale": "fr-FR" }`.
|
|
110
|
+
|
|
111
|
+
Use it to feed a validation step or an AI agent with the exact names Bring knows. The node can also be used as a tool by AI Agent nodes; on self-hosted n8n set `N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true`.
|
|
112
|
+
|
|
113
|
+
### Example: Paprika shopping list to Bring
|
|
114
|
+
|
|
115
|
+
Take the ingredients from a Paprika-style shopping list (one item per ingredient, with a `name` field) and add them to the list "Maison". Paste this into the n8n canvas; the first node is a placeholder for your own source.
|
|
116
|
+
|
|
117
|
+
```json
|
|
118
|
+
{
|
|
119
|
+
"nodes": [
|
|
120
|
+
{
|
|
121
|
+
"parameters": {},
|
|
122
|
+
"name": "Shopping list",
|
|
123
|
+
"type": "n8n-nodes-base.noOp",
|
|
124
|
+
"typeVersion": 1,
|
|
125
|
+
"position": [0, 0]
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"parameters": {
|
|
129
|
+
"resource": "item",
|
|
130
|
+
"operation": "add",
|
|
131
|
+
"list": { "__rl": true, "mode": "name", "value": "Maison" },
|
|
132
|
+
"itemName": "={{ $json.name }}",
|
|
133
|
+
"specification": "={{ $json.quantity }}"
|
|
134
|
+
},
|
|
135
|
+
"name": "Bring!",
|
|
136
|
+
"type": "@fjacquet/n8n-nodes-getbring.bring",
|
|
137
|
+
"typeVersion": 1,
|
|
138
|
+
"position": [220, 0]
|
|
139
|
+
}
|
|
140
|
+
],
|
|
141
|
+
"connections": {
|
|
142
|
+
"Shopping list": { "main": [[{ "node": "Bring!", "type": "main", "index": 0 }]] }
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
"Maison" is a French-language list, so "Oignons" becomes the key `Zwiebeln` and gets its icon. After you attach your credential, adjust the field names (`name`, `quantity`) to match your source.
|
|
148
|
+
|
|
149
|
+
## Translation
|
|
150
|
+
|
|
151
|
+
Bring stores items under German catalog keys (`Zwiebeln`). The app shows them in the language of the list. The node translates in both directions using the list's article language, read from your Bring settings. If a list has no language setting, the account language is used.
|
|
152
|
+
|
|
153
|
+
Adding an item (**Translate Name** on):
|
|
154
|
+
|
|
155
|
+
1. The name is trimmed.
|
|
156
|
+
2. It is matched exactly against the catalog names of the list's language.
|
|
157
|
+
3. If that fails, it is matched case-insensitively. " OIGNONS " finds `Zwiebeln`.
|
|
158
|
+
4. If that fails, it is matched against the German keys.
|
|
159
|
+
5. If nothing matches, the name is sent as written and becomes a **custom item** without an icon.
|
|
160
|
+
|
|
161
|
+
If two catalog entries share one display name, the last one in the catalog wins, as in bring-api.
|
|
162
|
+
|
|
163
|
+
There is no fuzzy or plural matching. "Oignon" does not match "Oignons". Use the **Catalog → Get** operation to list the exact names, for example to validate input or to give an AI agent the allowed values.
|
|
164
|
+
|
|
165
|
+
Turn **Translate Name** off to send the name as written. Lists in German (Switzerland, `de-CH`) are never translated, because the catalog keys are already German there.
|
|
166
|
+
|
|
167
|
+
If the account locale is not one of the 20 supported locales (for example `fr-BE`), the node falls back to the default for that language (`fr-FR`). For an unknown language it uses `de-CH` and does no translation.
|
|
168
|
+
|
|
169
|
+
Get Items translates the other way: the Bring key becomes `name`, and the original key stays in `key`. Keys with no catalog entry (custom items) are returned unchanged.
|
|
170
|
+
|
|
171
|
+
## Error handling
|
|
172
|
+
|
|
173
|
+
Errors surface as n8n node errors. A wrong password gives `Bring login failed: invalid email or password`. For login errors the response body is never echoed.
|
|
174
|
+
|
|
175
|
+
Use the node setting **Continue On Fail** to get `{ "error": "<message>" }` items instead of stopping the workflow.
|
|
176
|
+
|
|
177
|
+
For Item operations:
|
|
178
|
+
|
|
179
|
+
- A failed login always stops the node, even with Continue On Fail, because the node signs in before it processes any item.
|
|
180
|
+
- The node plans all input items before it writes anything. Without Continue On Fail, one invalid item (blank name, unknown or ambiguous list) stops the node and nothing is written.
|
|
181
|
+
- With Continue On Fail, invalid items become error items and the rest of the batch is still sent.
|
|
182
|
+
- Lists are written one after another. If an item sends to several lists and a later list fails, the earlier lists stay written. A failed list gives error items for its inputs only.
|
|
183
|
+
|
|
184
|
+
## Development
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
npm install
|
|
188
|
+
npm test # vitest
|
|
189
|
+
npm run lint # biome + n8n-node lint
|
|
190
|
+
npm run typecheck # tsc, sources and tests
|
|
191
|
+
npm run build # n8n-node build → dist/
|
|
192
|
+
npm run dev # local n8n with this node loaded (needs Docker or Podman)
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Credits
|
|
196
|
+
|
|
197
|
+
This package is a TypeScript port of [miaucl/bring-api](https://github.com/miaucl/bring-api) by Cyrill Raccaud and Manfred Dennerlein Rodelo. The catalog files, locale list, request headers and translation rules come from that project. bring-api in turn builds on earlier work by Elias Ball.
|
|
198
|
+
|
|
199
|
+
## Disclaimer
|
|
200
|
+
|
|
201
|
+
The developers of this module are in no way endorsed by or affiliated with Bring! Labs AG, or any associated subsidiaries, logos or trademarks.
|
|
202
|
+
|
|
203
|
+
## License
|
|
204
|
+
|
|
205
|
+
[MIT](./LICENSE). The license keeps the copyright lines of the bring-api authors.
|
|
206
|
+
|
|
207
|
+
## Links
|
|
208
|
+
|
|
209
|
+
- [bring-api](https://github.com/miaucl/bring-api)
|
|
210
|
+
- [n8n community nodes documentation](https://docs.n8n.io/integrations/#community-nodes)
|
|
211
|
+
- [Issues](https://github.com/fjacquet/n8n-nodes-getbring/issues)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ICredentialTestRequest, ICredentialType, Icon, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare class BringApi implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
documentationUrl: string;
|
|
6
|
+
icon: Icon;
|
|
7
|
+
properties: INodeProperties[];
|
|
8
|
+
test: ICredentialTestRequest;
|
|
9
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BringApi = void 0;
|
|
4
|
+
class BringApi {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'bringApi';
|
|
7
|
+
this.displayName = 'Bring API';
|
|
8
|
+
this.documentationUrl = 'https://github.com/fjacquet/n8n-nodes-getbring#credential-setup';
|
|
9
|
+
this.icon = {
|
|
10
|
+
light: 'file:../nodes/Bring/bring.svg',
|
|
11
|
+
dark: 'file:../nodes/Bring/bring.dark.svg',
|
|
12
|
+
};
|
|
13
|
+
this.properties = [
|
|
14
|
+
{
|
|
15
|
+
displayName: 'Email',
|
|
16
|
+
name: 'email',
|
|
17
|
+
type: 'string',
|
|
18
|
+
placeholder: 'name@email.com',
|
|
19
|
+
default: '',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
displayName: 'Password',
|
|
23
|
+
name: 'password',
|
|
24
|
+
type: 'string',
|
|
25
|
+
typeOptions: { password: true },
|
|
26
|
+
default: '',
|
|
27
|
+
},
|
|
28
|
+
];
|
|
29
|
+
this.test = {
|
|
30
|
+
request: {
|
|
31
|
+
baseURL: 'https://api.getbring.com/rest',
|
|
32
|
+
url: '/v2/bringauth',
|
|
33
|
+
method: 'POST',
|
|
34
|
+
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
35
|
+
body: { email: '={{$credentials.email}}', password: '={{$credentials.password}}' },
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.BringApi = BringApi;
|
|
41
|
+
//# sourceMappingURL=BringApi.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BringApi.credentials.js","sourceRoot":"","sources":["../../credentials/BringApi.credentials.ts"],"names":[],"mappings":";;;AAEA,MAAa,QAAQ;IAArB;QACC,SAAI,GAAG,UAAU,CAAC;QAElB,gBAAW,GAAG,WAAW,CAAC;QAE1B,qBAAgB,GAAG,iEAAiE,CAAC;QAErF,SAAI,GAAS;YACZ,KAAK,EAAE,+BAA+B;YACtC,IAAI,EAAE,oCAAoC;SAC1C,CAAC;QAEF,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,OAAO;gBACpB,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,gBAAgB;gBAC7B,OAAO,EAAE,EAAE;aACX;YACD;gBACC,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;aACX;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,+BAA+B;gBACxC,GAAG,EAAE,eAAe;gBACpB,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE,EAAE,cAAc,EAAE,mCAAmC,EAAE;gBAChE,IAAI,EAAE,EAAE,KAAK,EAAE,yBAAyB,EAAE,QAAQ,EAAE,4BAA4B,EAAE;aAClF;SACD,CAAC;IACH,CAAC;CAAA;AAtCD,4BAsCC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IExecuteFunctions, ILoadOptionsFunctions, INodeExecutionData, INodeListSearchResult, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare class Bring implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
methods: {
|
|
5
|
+
listSearch: {
|
|
6
|
+
searchLists(this: ILoadOptionsFunctions, filter?: string): Promise<INodeListSearchResult>;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Bring = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const batch_1 = require("./batch");
|
|
6
|
+
const CatalogDescription_1 = require("./descriptions/CatalogDescription");
|
|
7
|
+
const ItemDescription_1 = require("./descriptions/ItemDescription");
|
|
8
|
+
const ListDescription_1 = require("./descriptions/ListDescription");
|
|
9
|
+
const items_1 = require("./items");
|
|
10
|
+
const lists_1 = require("./lists");
|
|
11
|
+
const translation_1 = require("./translation");
|
|
12
|
+
const transport_1 = require("./transport");
|
|
13
|
+
const ITEM_OPERATIONS = {
|
|
14
|
+
add: 'TO_PURCHASE',
|
|
15
|
+
remove: 'REMOVE',
|
|
16
|
+
complete: 'TO_RECENTLY',
|
|
17
|
+
};
|
|
18
|
+
async function fetchLists(ctx, session) {
|
|
19
|
+
const response = await transport_1.bringRequest.call(ctx, session, 'GET', `bringusers/${session.uuid}/lists`);
|
|
20
|
+
return response.lists;
|
|
21
|
+
}
|
|
22
|
+
function fail(ctx, error, index) {
|
|
23
|
+
return error instanceof n8n_workflow_1.NodeApiError
|
|
24
|
+
? error
|
|
25
|
+
: new n8n_workflow_1.NodeOperationError(ctx.getNode(), error, { itemIndex: index });
|
|
26
|
+
}
|
|
27
|
+
async function executeItems(ctx, items, session, loadLists, loadLocale) {
|
|
28
|
+
var _a, _b;
|
|
29
|
+
const failures = new Map();
|
|
30
|
+
const rows = [];
|
|
31
|
+
for (let i = 0; i < items.length; i++) {
|
|
32
|
+
try {
|
|
33
|
+
const op = ctx.getNodeParameter('operation', i);
|
|
34
|
+
const locator = ctx.getNodeParameter('list', i);
|
|
35
|
+
const listUuid = (0, lists_1.resolveListUuid)(locator.mode === 'name' ? await loadLists() : [], locator);
|
|
36
|
+
const { translate = true } = ctx.getNodeParameter('options', i, {});
|
|
37
|
+
rows.push({
|
|
38
|
+
index: i,
|
|
39
|
+
listUuid,
|
|
40
|
+
locale: translate ? await loadLocale(listUuid) : translation_1.DEFAULT_LOCALE,
|
|
41
|
+
input: {
|
|
42
|
+
name: String((_a = ctx.getNodeParameter('itemName', i)) !== null && _a !== void 0 ? _a : ''),
|
|
43
|
+
specification: String((_b = ctx.getNodeParameter('specification', i, '')) !== null && _b !== void 0 ? _b : ''),
|
|
44
|
+
uuid: op === 'add' ? undefined : ctx.getNodeParameter('itemUuid', i, ''),
|
|
45
|
+
},
|
|
46
|
+
operation: ITEM_OPERATIONS[op],
|
|
47
|
+
translate,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
failures.set(i, error);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const { batches, errors } = (0, items_1.planBatches)(rows);
|
|
55
|
+
for (const e of errors)
|
|
56
|
+
failures.set(e.index, e.error);
|
|
57
|
+
if (failures.size > 0 && !ctx.continueOnFail()) {
|
|
58
|
+
const first = Math.min(...failures.keys());
|
|
59
|
+
throw fail(ctx, failures.get(first), first);
|
|
60
|
+
}
|
|
61
|
+
const names = new Map(rows.map((r) => [r.index, r.input.name.trim()]));
|
|
62
|
+
const results = new Map();
|
|
63
|
+
for (const [listUuid, group] of batches) {
|
|
64
|
+
try {
|
|
65
|
+
await transport_1.bringRequest.call(ctx, session, 'PUT', `v2/bringlists/${listUuid}/items`, (0, batch_1.buildBody)(group.map((g) => g.change)));
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
if (!ctx.continueOnFail())
|
|
69
|
+
throw fail(ctx, error, group[0].index);
|
|
70
|
+
for (const g of group)
|
|
71
|
+
failures.set(g.index, error);
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
for (const { index, change } of group) {
|
|
75
|
+
results.set(index, {
|
|
76
|
+
json: {
|
|
77
|
+
...items[index].json,
|
|
78
|
+
key: change.itemId,
|
|
79
|
+
name: names.get(index),
|
|
80
|
+
specification: change.spec,
|
|
81
|
+
uuid: change.uuid,
|
|
82
|
+
listUuid,
|
|
83
|
+
operation: change.operation,
|
|
84
|
+
},
|
|
85
|
+
pairedItem: { item: index },
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return items.map((_, i) => {
|
|
90
|
+
var _a;
|
|
91
|
+
return (_a = results.get(i)) !== null && _a !== void 0 ? _a : {
|
|
92
|
+
json: { error: failures.get(i).message },
|
|
93
|
+
pairedItem: { item: i },
|
|
94
|
+
};
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
class Bring {
|
|
98
|
+
constructor() {
|
|
99
|
+
this.description = {
|
|
100
|
+
displayName: 'Bring!',
|
|
101
|
+
name: 'bring',
|
|
102
|
+
icon: { light: 'file:bring.svg', dark: 'file:bring.dark.svg' },
|
|
103
|
+
group: ['transform'],
|
|
104
|
+
version: 1,
|
|
105
|
+
subtitle: '={{ $parameter["operation"] + ": " + $parameter["resource"] }}',
|
|
106
|
+
description: 'Manage Bring! shopping lists',
|
|
107
|
+
defaults: { name: 'Bring!' },
|
|
108
|
+
inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
109
|
+
outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
110
|
+
usableAsTool: true,
|
|
111
|
+
credentials: [{ name: 'bringApi', required: true }],
|
|
112
|
+
properties: [
|
|
113
|
+
{
|
|
114
|
+
displayName: 'Resource',
|
|
115
|
+
name: 'resource',
|
|
116
|
+
type: 'options',
|
|
117
|
+
noDataExpression: true,
|
|
118
|
+
options: [
|
|
119
|
+
{ name: 'Catalog', value: 'catalog' },
|
|
120
|
+
{ name: 'Item', value: 'item' },
|
|
121
|
+
{ name: 'List', value: 'list' },
|
|
122
|
+
],
|
|
123
|
+
default: 'list',
|
|
124
|
+
},
|
|
125
|
+
...ListDescription_1.listProperties,
|
|
126
|
+
...ItemDescription_1.itemProperties,
|
|
127
|
+
...CatalogDescription_1.catalogProperties,
|
|
128
|
+
],
|
|
129
|
+
};
|
|
130
|
+
this.methods = {
|
|
131
|
+
listSearch: {
|
|
132
|
+
async searchLists(filter) {
|
|
133
|
+
const session = await transport_1.bringLogin.call(this);
|
|
134
|
+
const lists = await fetchLists(this, session);
|
|
135
|
+
const needle = filter === null || filter === void 0 ? void 0 : filter.toLowerCase();
|
|
136
|
+
return {
|
|
137
|
+
results: lists
|
|
138
|
+
.filter((l) => !needle || l.name.toLowerCase().includes(needle))
|
|
139
|
+
.map((l) => ({ name: l.name, value: l.listUuid })),
|
|
140
|
+
};
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
async execute() {
|
|
146
|
+
const items = this.getInputData();
|
|
147
|
+
const out = [];
|
|
148
|
+
let sessionPromise;
|
|
149
|
+
const getSession = () => {
|
|
150
|
+
sessionPromise !== null && sessionPromise !== void 0 ? sessionPromise : (sessionPromise = transport_1.bringLogin.call(this));
|
|
151
|
+
return sessionPromise;
|
|
152
|
+
};
|
|
153
|
+
let lists;
|
|
154
|
+
const locales = new Map();
|
|
155
|
+
const loadLists = async () => {
|
|
156
|
+
lists !== null && lists !== void 0 ? lists : (lists = await fetchLists(this, await getSession()));
|
|
157
|
+
return lists;
|
|
158
|
+
};
|
|
159
|
+
const loadLocale = async (listUuid) => {
|
|
160
|
+
let locale = locales.get(listUuid);
|
|
161
|
+
if (locale === undefined) {
|
|
162
|
+
locale = await transport_1.getListLocale.call(this, await getSession(), listUuid);
|
|
163
|
+
locales.set(listUuid, locale);
|
|
164
|
+
}
|
|
165
|
+
return locale;
|
|
166
|
+
};
|
|
167
|
+
if (items.length > 0 && this.getNodeParameter('resource', 0) === 'item') {
|
|
168
|
+
return [await executeItems(this, items, await getSession(), loadLists, loadLocale)];
|
|
169
|
+
}
|
|
170
|
+
for (let i = 0; i < items.length; i++) {
|
|
171
|
+
try {
|
|
172
|
+
const operation = this.getNodeParameter('operation', i);
|
|
173
|
+
const pairedItem = { item: i };
|
|
174
|
+
if (this.getNodeParameter('resource', i) === 'catalog') {
|
|
175
|
+
let locale;
|
|
176
|
+
if (this.getNodeParameter('localeSource', i) === 'locale') {
|
|
177
|
+
locale = this.getNodeParameter('locale', i);
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
const locator = this.getNodeParameter('list', i);
|
|
181
|
+
locale = await loadLocale((0, lists_1.resolveListUuid)(locator.mode === 'name' ? await loadLists() : [], locator));
|
|
182
|
+
}
|
|
183
|
+
for (const [key, name] of Object.entries((0, translation_1.getCatalog)(locale))) {
|
|
184
|
+
out.push({ json: { key, name, locale }, pairedItem });
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
else if (operation === 'getAll') {
|
|
188
|
+
for (const l of await loadLists()) {
|
|
189
|
+
out.push({
|
|
190
|
+
json: { listUuid: l.listUuid, name: l.name, theme: l.theme },
|
|
191
|
+
pairedItem,
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
else if (operation === 'getItems') {
|
|
196
|
+
const locator = this.getNodeParameter('list', i);
|
|
197
|
+
const listUuid = (0, lists_1.resolveListUuid)(locator.mode === 'name' ? await loadLists() : [], locator);
|
|
198
|
+
const response = (await transport_1.bringRequest.call(this, await getSession(), 'GET', `v2/bringlists/${listUuid}`));
|
|
199
|
+
const locale = await loadLocale(listUuid);
|
|
200
|
+
const includeRecently = this.getNodeParameter('includeRecently', i, false);
|
|
201
|
+
for (const row of (0, lists_1.mapListItems)(response, locale, listUuid, includeRecently)) {
|
|
202
|
+
out.push({ json: row, pairedItem });
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
catch (error) {
|
|
207
|
+
if (this.continueOnFail()) {
|
|
208
|
+
out.push({ json: { error: error.message }, pairedItem: { item: i } });
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
throw error instanceof n8n_workflow_1.NodeApiError
|
|
212
|
+
? error
|
|
213
|
+
: new n8n_workflow_1.NodeOperationError(this.getNode(), error, { itemIndex: i });
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return [out];
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
exports.Bring = Bring;
|
|
220
|
+
//# sourceMappingURL=Bring.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Bring.node.js","sourceRoot":"","sources":["../../../nodes/Bring/Bring.node.ts"],"names":[],"mappings":";;;AASA,+CAAqF;AAErF,mCAAoC;AACpC,0EAAsE;AACtE,oEAAgE;AAChE,oEAAgE;AAChE,mCAAoD;AACpD,mCAAwE;AACxE,+CAA2D;AAC3D,2CAAyF;AAIzF,MAAM,eAAe,GAAmC;IACvD,GAAG,EAAE,aAAa;IAClB,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,aAAa;CACvB,CAAC;AAGF,KAAK,UAAU,UAAU,CACxB,GAA8C,EAC9C,OAAqB;IAErB,MAAM,QAAQ,GAAG,MAAM,wBAAY,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,cAAc,OAAO,CAAC,IAAI,QAAQ,CAAC,CAAC;IAClG,OAAQ,QAA6B,CAAC,KAAK,CAAC;AAC7C,CAAC;AAED,SAAS,IAAI,CAAC,GAAsB,EAAE,KAAY,EAAE,KAAa;IAChE,OAAO,KAAK,YAAY,2BAAY;QACnC,CAAC,CAAC,KAAK;QACP,CAAC,CAAC,IAAI,iCAAkB,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;AACvE,CAAC;AAED,KAAK,UAAU,YAAY,CAC1B,GAAsB,EACtB,KAA2B,EAC3B,OAAqB,EACrB,SAA+B,E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AE,MAAM,EAAE,QAAQ,EAAE,eAAe,CAAC,EAAE,CAAC;wBAC7E,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC,CAAC;oBACrC,CAAC;gBACF,CAAC;YACF,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;oBAC3B,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAG,KAAe,CAAC,OAAO,EAAE,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;oBACjF,SAAS;gBACV,CAAC;gBACD,MAAM,KAAK,YAAY,2BAAY;oBAClC,CAAC,CAAC,KAAK;oBACP,CAAC,CAAC,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAc,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC;YAC7E,CAAC;QACF,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,CAAC;IACd,CAAC;CACD;AAvID,sBAuIC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"node": "@fjacquet/n8n-nodes-getbring.bring",
|
|
3
|
+
"nodeVersion": "1.0",
|
|
4
|
+
"codexVersion": "1.0",
|
|
5
|
+
"categories": ["Productivity"],
|
|
6
|
+
"resources": {
|
|
7
|
+
"credentialDocumentation": [
|
|
8
|
+
{ "url": "https://github.com/fjacquet/n8n-nodes-getbring#credential-setup" }
|
|
9
|
+
],
|
|
10
|
+
"primaryDocumentation": [{ "url": "https://github.com/fjacquet/n8n-nodes-getbring" }]
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type BringOperation = 'TO_PURCHASE' | 'TO_RECENTLY' | 'REMOVE';
|
|
2
|
+
export interface ItemInput {
|
|
3
|
+
name: string;
|
|
4
|
+
specification: string;
|
|
5
|
+
uuid?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface BringChange {
|
|
8
|
+
itemId: string;
|
|
9
|
+
spec: string;
|
|
10
|
+
uuid?: string;
|
|
11
|
+
operation: BringOperation;
|
|
12
|
+
accuracy: '0.0';
|
|
13
|
+
altitude: '0.0';
|
|
14
|
+
latitude: '0.0';
|
|
15
|
+
longitude: '0.0';
|
|
16
|
+
}
|
|
17
|
+
export declare function buildChange(input: ItemInput, operation: BringOperation, locale: string, translate: boolean, newUuid: () => string): BringChange;
|
|
18
|
+
export declare function buildBody(changes: BringChange[]): {
|
|
19
|
+
changes: BringChange[];
|
|
20
|
+
sender: '';
|
|
21
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildChange = buildChange;
|
|
4
|
+
exports.buildBody = buildBody;
|
|
5
|
+
const translation_1 = require("./translation");
|
|
6
|
+
function buildChange(input, operation, locale, translate, newUuid) {
|
|
7
|
+
var _a, _b;
|
|
8
|
+
const name = String((_a = input.name) !== null && _a !== void 0 ? _a : '').trim();
|
|
9
|
+
if (!name)
|
|
10
|
+
throw new Error('Item name is empty');
|
|
11
|
+
return {
|
|
12
|
+
itemId: translate ? (0, translation_1.toKey)(name, locale) : name,
|
|
13
|
+
spec: String((_b = input.specification) !== null && _b !== void 0 ? _b : ''),
|
|
14
|
+
...((input.uuid || operation === 'TO_PURCHASE') && { uuid: input.uuid || newUuid() }),
|
|
15
|
+
operation,
|
|
16
|
+
accuracy: '0.0',
|
|
17
|
+
altitude: '0.0',
|
|
18
|
+
latitude: '0.0',
|
|
19
|
+
longitude: '0.0',
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function buildBody(changes) {
|
|
23
|
+
return { changes, sender: '' };
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=batch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batch.js","sourceRoot":"","sources":["../../../nodes/Bring/batch.ts"],"names":[],"mappings":";;AAsBA,kCAoBC;AAED,8BAEC;AA7CD,+CAAsC;AAqBtC,SAAgB,WAAW,CAC1B,KAAgB,EAChB,SAAyB,EACzB,MAAc,EACd,SAAkB,EAClB,OAAqB;;IAErB,MAAM,IAAI,GAAG,MAAM,CAAC,MAAA,KAAK,CAAC,IAAI,mCAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC7C,IAAI,CAAC,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACjD,OAAO;QACN,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,IAAA,mBAAK,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI;QAC9C,IAAI,EAAE,MAAM,CAAC,MAAA,KAAK,CAAC,aAAa,mCAAI,EAAE,CAAC;QAEvC,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,SAAS,KAAK,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,OAAO,EAAE,EAAE,CAAC;QACrF,SAAS;QACT,QAAQ,EAAE,KAAK;QACf,QAAQ,EAAE,KAAK;QACf,QAAQ,EAAE,KAAK;QACf,SAAS,EAAE,KAAK;KAChB,CAAC;AACH,CAAC;AAED,SAAgB,SAAS,CAAC,OAAsB;IAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32" role="img" aria-labelledby="t">
|
|
2
|
+
<title id="t">Shopping basket</title>
|
|
3
|
+
<path d="M5 13h22l-2.5 12a2 2 0 0 1-2 1.6h-13a2 2 0 0 1-2-1.6L5 13Z" fill="#5fd08f"/>
|
|
4
|
+
<path d="M11 13l4-7M21 13l-4-7" stroke="#5fd08f" stroke-width="2" stroke-linecap="round" fill="none"/>
|
|
5
|
+
<path d="M11 17v6M16 17v6M21 17v6" stroke="#1b2b22" stroke-width="1.6" stroke-linecap="round"/>
|
|
6
|
+
</svg>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32" role="img" aria-labelledby="t">
|
|
2
|
+
<title id="t">Shopping basket</title>
|
|
3
|
+
<path d="M5 13h22l-2.5 12a2 2 0 0 1-2 1.6h-13a2 2 0 0 1-2-1.6L5 13Z" fill="#2f8f5b"/>
|
|
4
|
+
<path d="M11 13l4-7M21 13l-4-7" stroke="#2f8f5b" stroke-width="2" stroke-linecap="round" fill="none"/>
|
|
5
|
+
<path d="M11 17v6M16 17v6M21 17v6" stroke="#fff" stroke-width="1.6" stroke-linecap="round"/>
|
|
6
|
+
</svg>
|