@drosenthal/n8n-nodes-ynab 0.1.2 → 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.
@@ -0,0 +1,463 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.transactionFields = exports.transactionOperations = void 0;
4
+ const FLAG_COLOR_OPTIONS = [
5
+ { name: '(None)', value: '' },
6
+ { name: 'Red', value: 'red' },
7
+ { name: 'Orange', value: 'orange' },
8
+ { name: 'Yellow', value: 'yellow' },
9
+ { name: 'Green', value: 'green' },
10
+ { name: 'Blue', value: 'blue' },
11
+ { name: 'Purple', value: 'purple' },
12
+ ];
13
+ const CLEARED_OPTIONS = [
14
+ { name: 'Cleared', value: 'cleared' },
15
+ { name: 'Uncleared', value: 'uncleared' },
16
+ { name: 'Reconciled', value: 'reconciled' },
17
+ ];
18
+ const TRANSACTION_FILTER_TYPES = [
19
+ { name: '(None)', value: '' },
20
+ { name: 'Uncategorized', value: 'uncategorized' },
21
+ { name: 'Unapproved', value: 'unapproved' },
22
+ ];
23
+ exports.transactionOperations = [
24
+ {
25
+ displayName: 'Operation',
26
+ name: 'operation',
27
+ type: 'options',
28
+ noDataExpression: true,
29
+ displayOptions: { show: { resource: ['transaction'] } },
30
+ options: [
31
+ {
32
+ name: 'Get All',
33
+ value: 'getAll',
34
+ action: 'Get all transactions',
35
+ routing: {
36
+ request: { method: 'GET', url: '=/plans/{{$parameter.plan_id}}/transactions' },
37
+ },
38
+ },
39
+ {
40
+ name: 'Get',
41
+ value: 'get',
42
+ action: 'Get a transaction',
43
+ routing: {
44
+ request: {
45
+ method: 'GET',
46
+ url: '=/plans/{{$parameter.plan_id}}/transactions/{{$parameter.transaction_id}}',
47
+ },
48
+ },
49
+ },
50
+ {
51
+ name: 'Create',
52
+ value: 'create',
53
+ action: 'Create a transaction',
54
+ routing: {
55
+ request: { method: 'POST', url: '=/plans/{{$parameter.plan_id}}/transactions' },
56
+ },
57
+ },
58
+ {
59
+ name: 'Update',
60
+ value: 'update',
61
+ action: 'Update a transaction',
62
+ routing: {
63
+ request: {
64
+ method: 'PUT',
65
+ url: '=/plans/{{$parameter.plan_id}}/transactions/{{$parameter.transaction_id}}',
66
+ },
67
+ },
68
+ },
69
+ {
70
+ name: 'Delete',
71
+ value: 'delete',
72
+ action: 'Delete a transaction',
73
+ routing: {
74
+ request: {
75
+ method: 'DELETE',
76
+ url: '=/plans/{{$parameter.plan_id}}/transactions/{{$parameter.transaction_id}}',
77
+ },
78
+ },
79
+ },
80
+ {
81
+ name: 'Update Many',
82
+ value: 'updateMany',
83
+ action: 'Update multiple transactions',
84
+ routing: {
85
+ request: { method: 'PATCH', url: '=/plans/{{$parameter.plan_id}}/transactions' },
86
+ },
87
+ },
88
+ {
89
+ name: 'Import',
90
+ value: 'import',
91
+ action: 'Import transactions',
92
+ routing: {
93
+ request: {
94
+ method: 'POST',
95
+ url: '=/plans/{{$parameter.plan_id}}/transactions/import',
96
+ },
97
+ },
98
+ },
99
+ {
100
+ name: 'Get All By Account',
101
+ value: 'getAllByAccount',
102
+ action: 'Get transactions for an account',
103
+ routing: {
104
+ request: {
105
+ method: 'GET',
106
+ url: '=/plans/{{$parameter.plan_id}}/accounts/{{$parameter.account_id}}/transactions',
107
+ },
108
+ },
109
+ },
110
+ {
111
+ name: 'Get All By Category',
112
+ value: 'getAllByCategory',
113
+ action: 'Get transactions for a category',
114
+ routing: {
115
+ request: {
116
+ method: 'GET',
117
+ url: '=/plans/{{$parameter.plan_id}}/categories/{{$parameter.category_id}}/transactions',
118
+ },
119
+ },
120
+ },
121
+ {
122
+ name: 'Get All By Payee',
123
+ value: 'getAllByPayee',
124
+ action: 'Get transactions for a payee',
125
+ routing: {
126
+ request: {
127
+ method: 'GET',
128
+ url: '=/plans/{{$parameter.plan_id}}/payees/{{$parameter.payee_id}}/transactions',
129
+ },
130
+ },
131
+ },
132
+ {
133
+ name: 'Get All By Month',
134
+ value: 'getAllByMonth',
135
+ action: 'Get transactions for a month',
136
+ routing: {
137
+ request: {
138
+ method: 'GET',
139
+ url: '=/plans/{{$parameter.plan_id}}/months/{{$parameter.month}}/transactions',
140
+ },
141
+ },
142
+ },
143
+ ],
144
+ default: 'getAll',
145
+ },
146
+ ];
147
+ const getAllOps = [
148
+ 'getAll',
149
+ 'getAllByAccount',
150
+ 'getAllByCategory',
151
+ 'getAllByPayee',
152
+ 'getAllByMonth',
153
+ ];
154
+ exports.transactionFields = [
155
+ {
156
+ displayName: 'Plan Name or ID',
157
+ name: 'plan_id',
158
+ type: 'options',
159
+ required: true,
160
+ default: '',
161
+ description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
162
+ typeOptions: { loadOptionsMethod: 'getPlans' },
163
+ displayOptions: { show: { resource: ['transaction'] } },
164
+ },
165
+ {
166
+ displayName: 'Transaction ID',
167
+ name: 'transaction_id',
168
+ type: 'string',
169
+ required: true,
170
+ default: '',
171
+ displayOptions: {
172
+ show: { resource: ['transaction'], operation: ['get', 'update', 'delete'] },
173
+ },
174
+ },
175
+ {
176
+ displayName: 'Account Name or ID',
177
+ name: 'account_id',
178
+ type: 'options',
179
+ required: true,
180
+ default: '',
181
+ description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
182
+ typeOptions: { loadOptionsMethod: 'getAccounts', loadOptionsDependsOn: ['plan_id'] },
183
+ displayOptions: { show: { resource: ['transaction'], operation: ['getAllByAccount'] } },
184
+ },
185
+ {
186
+ displayName: 'Category Name or ID',
187
+ name: 'category_id',
188
+ type: 'options',
189
+ required: true,
190
+ default: '',
191
+ description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
192
+ typeOptions: { loadOptionsMethod: 'getCategories', loadOptionsDependsOn: ['plan_id'] },
193
+ displayOptions: { show: { resource: ['transaction'], operation: ['getAllByCategory'] } },
194
+ },
195
+ {
196
+ displayName: 'Payee ID',
197
+ name: 'payee_id',
198
+ type: 'string',
199
+ required: true,
200
+ default: '',
201
+ displayOptions: { show: { resource: ['transaction'], operation: ['getAllByPayee'] } },
202
+ },
203
+ {
204
+ displayName: 'Month',
205
+ name: 'month',
206
+ type: 'string',
207
+ required: true,
208
+ default: 'current',
209
+ placeholder: 'current or YYYY-MM-01',
210
+ description: 'ISO-formatted month (e.g. 2024-03-01) or "current"',
211
+ displayOptions: { show: { resource: ['transaction'], operation: ['getAllByMonth'] } },
212
+ },
213
+ // Query filters for all getAll variants
214
+ {
215
+ displayName: 'Filters',
216
+ name: 'filters',
217
+ type: 'collection',
218
+ placeholder: 'Add Filter',
219
+ default: {},
220
+ displayOptions: { show: { resource: ['transaction'], operation: getAllOps } },
221
+ options: [
222
+ {
223
+ displayName: 'Since Date',
224
+ name: 'since_date',
225
+ type: 'string',
226
+ default: '',
227
+ placeholder: 'YYYY-MM-DD',
228
+ description: 'Only include transactions on or after this date',
229
+ routing: { request: { qs: { since_date: '={{ $value || undefined }}' } } },
230
+ },
231
+ {
232
+ displayName: 'Type',
233
+ name: 'type',
234
+ type: 'options',
235
+ default: '',
236
+ options: TRANSACTION_FILTER_TYPES,
237
+ routing: { request: { qs: { type: '={{ $value || undefined }}' } } },
238
+ },
239
+ {
240
+ displayName: 'Last Knowledge of Server',
241
+ name: 'last_knowledge_of_server',
242
+ type: 'number',
243
+ default: 0,
244
+ description: 'Returns entities changed since this knowledge value',
245
+ routing: {
246
+ request: {
247
+ qs: { last_knowledge_of_server: '={{ $value > 0 ? $value : undefined }}' },
248
+ },
249
+ },
250
+ },
251
+ ],
252
+ },
253
+ // CREATE: single transaction required fields
254
+ {
255
+ displayName: 'Account Name or ID',
256
+ name: 'create_account_id',
257
+ type: 'options',
258
+ required: true,
259
+ default: '',
260
+ description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
261
+ typeOptions: { loadOptionsMethod: 'getAccounts', loadOptionsDependsOn: ['plan_id'] },
262
+ displayOptions: { show: { resource: ['transaction'], operation: ['create'] } },
263
+ routing: { send: { type: 'body', property: 'transaction.account_id' } },
264
+ },
265
+ {
266
+ displayName: 'Date',
267
+ name: 'create_date',
268
+ type: 'string',
269
+ required: true,
270
+ default: '',
271
+ placeholder: 'YYYY-MM-DD',
272
+ description: 'Transaction date in ISO format. Future dates are not permitted.',
273
+ displayOptions: { show: { resource: ['transaction'], operation: ['create'] } },
274
+ routing: { send: { type: 'body', property: 'transaction.date' } },
275
+ },
276
+ {
277
+ displayName: 'Amount (Milliunits)',
278
+ name: 'create_amount',
279
+ type: 'number',
280
+ required: true,
281
+ default: 0,
282
+ description: 'Transaction amount in milliunits format (multiply dollars by 1000, negative for outflow)',
283
+ displayOptions: { show: { resource: ['transaction'], operation: ['create'] } },
284
+ routing: { send: { type: 'body', property: 'transaction.amount' } },
285
+ },
286
+ {
287
+ displayName: 'Additional Fields',
288
+ name: 'createAdditionalFields',
289
+ type: 'collection',
290
+ placeholder: 'Add Field',
291
+ default: {},
292
+ displayOptions: { show: { resource: ['transaction'], operation: ['create'] } },
293
+ options: [
294
+ {
295
+ displayName: 'Payee ID',
296
+ name: 'payee_id',
297
+ type: 'string',
298
+ default: '',
299
+ description: 'UUID of the payee. Leave empty to use Payee Name instead.',
300
+ routing: { send: { type: 'body', property: 'transaction.payee_id' } },
301
+ },
302
+ {
303
+ displayName: 'Payee Name',
304
+ name: 'payee_name',
305
+ type: 'string',
306
+ default: '',
307
+ description: 'Used if Payee ID is empty. Creates a new payee if no match found (max 200 chars).',
308
+ routing: { send: { type: 'body', property: 'transaction.payee_name' } },
309
+ },
310
+ {
311
+ displayName: 'Category Name or ID',
312
+ name: 'category_id',
313
+ type: 'options',
314
+ default: '',
315
+ description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
316
+ typeOptions: { loadOptionsMethod: 'getCategories', loadOptionsDependsOn: ['plan_id'] },
317
+ routing: { send: { type: 'body', property: 'transaction.category_id' } },
318
+ },
319
+ {
320
+ displayName: 'Memo',
321
+ name: 'memo',
322
+ type: 'string',
323
+ default: '',
324
+ description: 'Transaction memo (max 500 chars)',
325
+ routing: { send: { type: 'body', property: 'transaction.memo' } },
326
+ },
327
+ {
328
+ displayName: 'Cleared',
329
+ name: 'cleared',
330
+ type: 'options',
331
+ default: 'uncleared',
332
+ options: CLEARED_OPTIONS,
333
+ routing: { send: { type: 'body', property: 'transaction.cleared' } },
334
+ },
335
+ {
336
+ displayName: 'Approved',
337
+ name: 'approved',
338
+ type: 'boolean',
339
+ default: false,
340
+ routing: { send: { type: 'body', property: 'transaction.approved' } },
341
+ },
342
+ {
343
+ displayName: 'Flag Color',
344
+ name: 'flag_color',
345
+ type: 'options',
346
+ default: '',
347
+ options: FLAG_COLOR_OPTIONS,
348
+ routing: {
349
+ send: { type: 'body', property: 'transaction.flag_color' },
350
+ },
351
+ },
352
+ {
353
+ displayName: 'Import ID',
354
+ name: 'import_id',
355
+ type: 'string',
356
+ default: '',
357
+ description: 'Custom import ID (max 36 chars). Used for deduplication.',
358
+ routing: { send: { type: 'body', property: 'transaction.import_id' } },
359
+ },
360
+ ],
361
+ },
362
+ // UPDATE (PUT single): all fields optional
363
+ {
364
+ displayName: 'Update Fields',
365
+ name: 'updateFields',
366
+ type: 'collection',
367
+ placeholder: 'Add Field',
368
+ default: {},
369
+ displayOptions: { show: { resource: ['transaction'], operation: ['update'] } },
370
+ options: [
371
+ {
372
+ displayName: 'Account Name or ID',
373
+ name: 'account_id',
374
+ type: 'options',
375
+ default: '',
376
+ description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
377
+ typeOptions: { loadOptionsMethod: 'getAccounts', loadOptionsDependsOn: ['plan_id'] },
378
+ routing: { send: { type: 'body', property: 'transaction.account_id' } },
379
+ },
380
+ {
381
+ displayName: 'Date',
382
+ name: 'date',
383
+ type: 'string',
384
+ default: '',
385
+ placeholder: 'YYYY-MM-DD',
386
+ routing: { send: { type: 'body', property: 'transaction.date' } },
387
+ },
388
+ {
389
+ displayName: 'Amount (Milliunits)',
390
+ name: 'amount',
391
+ type: 'number',
392
+ default: 0,
393
+ routing: { send: { type: 'body', property: 'transaction.amount' } },
394
+ },
395
+ {
396
+ displayName: 'Payee ID',
397
+ name: 'payee_id',
398
+ type: 'string',
399
+ default: '',
400
+ description: 'UUID of the payee. Leave empty to use Payee Name instead.',
401
+ routing: { send: { type: 'body', property: 'transaction.payee_id' } },
402
+ },
403
+ {
404
+ displayName: 'Payee Name',
405
+ name: 'payee_name',
406
+ type: 'string',
407
+ default: '',
408
+ routing: { send: { type: 'body', property: 'transaction.payee_name' } },
409
+ },
410
+ {
411
+ displayName: 'Category Name or ID',
412
+ name: 'category_id',
413
+ type: 'options',
414
+ default: '',
415
+ description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
416
+ typeOptions: { loadOptionsMethod: 'getCategories', loadOptionsDependsOn: ['plan_id'] },
417
+ routing: { send: { type: 'body', property: 'transaction.category_id' } },
418
+ },
419
+ {
420
+ displayName: 'Memo',
421
+ name: 'memo',
422
+ type: 'string',
423
+ default: '',
424
+ routing: { send: { type: 'body', property: 'transaction.memo' } },
425
+ },
426
+ {
427
+ displayName: 'Cleared',
428
+ name: 'cleared',
429
+ type: 'options',
430
+ default: 'uncleared',
431
+ options: CLEARED_OPTIONS,
432
+ routing: { send: { type: 'body', property: 'transaction.cleared' } },
433
+ },
434
+ {
435
+ displayName: 'Approved',
436
+ name: 'approved',
437
+ type: 'boolean',
438
+ default: false,
439
+ routing: { send: { type: 'body', property: 'transaction.approved' } },
440
+ },
441
+ {
442
+ displayName: 'Flag Color',
443
+ name: 'flag_color',
444
+ type: 'options',
445
+ default: '',
446
+ options: FLAG_COLOR_OPTIONS,
447
+ routing: { send: { type: 'body', property: 'transaction.flag_color' } },
448
+ },
449
+ ],
450
+ },
451
+ // UPDATE MANY (PATCH): expect array via expression
452
+ {
453
+ displayName: 'Transactions',
454
+ name: 'transactionsArray',
455
+ type: 'json',
456
+ required: true,
457
+ default: '=[]',
458
+ description: 'Array of transaction objects. Each must include either an "id" or "import_id" plus any fields to update.',
459
+ displayOptions: { show: { resource: ['transaction'], operation: ['updateMany'] } },
460
+ routing: { send: { type: 'body', property: 'transactions' } },
461
+ },
462
+ // IMPORT: no body required, but endpoint returns imported transaction_ids
463
+ ];
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.userFields = exports.userOperations = void 0;
4
+ exports.userOperations = [
5
+ {
6
+ displayName: 'Operation',
7
+ name: 'operation',
8
+ type: 'options',
9
+ noDataExpression: true,
10
+ displayOptions: { show: { resource: ['user'] } },
11
+ options: [
12
+ {
13
+ name: 'Get',
14
+ value: 'get',
15
+ action: 'Get authenticated user',
16
+ routing: { request: { method: 'GET', url: '/user' } },
17
+ },
18
+ ],
19
+ default: 'get',
20
+ },
21
+ ];
22
+ exports.userFields = [];
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.allProperties = exports.resourceProperty = void 0;
4
+ const UserDescription_1 = require("./UserDescription");
5
+ const PlanDescription_1 = require("./PlanDescription");
6
+ const AccountDescription_1 = require("./AccountDescription");
7
+ const CategoryDescription_1 = require("./CategoryDescription");
8
+ const PayeeDescription_1 = require("./PayeeDescription");
9
+ const PayeeLocationDescription_1 = require("./PayeeLocationDescription");
10
+ const MonthDescription_1 = require("./MonthDescription");
11
+ const MoneyMovementDescription_1 = require("./MoneyMovementDescription");
12
+ const TransactionDescription_1 = require("./TransactionDescription");
13
+ const ScheduledTransactionDescription_1 = require("./ScheduledTransactionDescription");
14
+ exports.resourceProperty = {
15
+ displayName: 'Resource',
16
+ name: 'resource',
17
+ type: 'options',
18
+ noDataExpression: true,
19
+ default: 'transaction',
20
+ options: [
21
+ { name: 'Account', value: 'account' },
22
+ { name: 'Category', value: 'category' },
23
+ { name: 'Money Movement', value: 'moneyMovement' },
24
+ { name: 'Month', value: 'month' },
25
+ { name: 'Payee', value: 'payee' },
26
+ { name: 'Payee Location', value: 'payeeLocation' },
27
+ { name: 'Plan', value: 'plan' },
28
+ { name: 'Scheduled Transaction', value: 'scheduledTransaction' },
29
+ { name: 'Transaction', value: 'transaction' },
30
+ { name: 'User', value: 'user' },
31
+ ],
32
+ };
33
+ exports.allProperties = [
34
+ exports.resourceProperty,
35
+ ...UserDescription_1.userOperations,
36
+ ...UserDescription_1.userFields,
37
+ ...PlanDescription_1.planOperations,
38
+ ...PlanDescription_1.planFields,
39
+ ...AccountDescription_1.accountOperations,
40
+ ...AccountDescription_1.accountFields,
41
+ ...CategoryDescription_1.categoryOperations,
42
+ ...CategoryDescription_1.categoryFields,
43
+ ...PayeeDescription_1.payeeOperations,
44
+ ...PayeeDescription_1.payeeFields,
45
+ ...PayeeLocationDescription_1.payeeLocationOperations,
46
+ ...PayeeLocationDescription_1.payeeLocationFields,
47
+ ...MonthDescription_1.monthOperations,
48
+ ...MonthDescription_1.monthFields,
49
+ ...MoneyMovementDescription_1.moneyMovementOperations,
50
+ ...MoneyMovementDescription_1.moneyMovementFields,
51
+ ...TransactionDescription_1.transactionOperations,
52
+ ...TransactionDescription_1.transactionFields,
53
+ ...ScheduledTransactionDescription_1.scheduledTransactionOperations,
54
+ ...ScheduledTransactionDescription_1.scheduledTransactionFields,
55
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drosenthal/n8n-nodes-ynab",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "description": "n8n community node for YNAB (You Need A Budget)",
5
5
  "keywords": [
6
6
  "n8n-community-node-package"
@@ -25,11 +25,8 @@
25
25
  },
26
26
  "devDependencies": {
27
27
  "@types/node": "^18.0.0",
28
- "typescript": "^5.0.0",
29
- "n8n-workflow": "*"
30
- },
31
- "dependencies": {
32
- "@devlikeapro/n8n-openapi-node": "*"
28
+ "n8n-workflow": "*",
29
+ "typescript": "^5.0.0"
33
30
  },
34
31
  "peerDependencies": {
35
32
  "n8n-workflow": "*"