n8n-nodes-base 1.103.0 → 1.104.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/dist/credentials/BeeminderApi.credentials.d.ts.map +1 -1
- package/dist/credentials/BeeminderApi.credentials.js +1 -7
- package/dist/credentials/BeeminderApi.credentials.js.map +1 -1
- package/dist/credentials/BeeminderOAuth2Api.credentials.d.ts +9 -0
- package/dist/credentials/BeeminderOAuth2Api.credentials.d.ts.map +1 -0
- package/dist/credentials/BeeminderOAuth2Api.credentials.js +51 -0
- package/dist/credentials/BeeminderOAuth2Api.credentials.js.map +1 -0
- package/dist/credentials/CustomerIoApi.credentials.js +2 -2
- package/dist/credentials/CustomerIoApi.credentials.js.map +1 -1
- package/dist/credentials/MicrosoftTeamsOAuth2Api.credentials.d.ts.map +1 -1
- package/dist/credentials/MicrosoftTeamsOAuth2Api.credentials.js +1 -1
- package/dist/credentials/MicrosoftTeamsOAuth2Api.credentials.js.map +1 -1
- package/dist/credentials/SlackApi.credentials.d.ts.map +1 -1
- package/dist/credentials/SlackApi.credentials.js +19 -0
- package/dist/credentials/SlackApi.credentials.js.map +1 -1
- package/dist/credentials/ZscalerZiaApi.credentials.js +2 -2
- package/dist/credentials/ZscalerZiaApi.credentials.js.map +1 -1
- package/dist/known/credentials.json +10 -0
- package/dist/nodes/Airtable/v2/transport/index.js +2 -2
- package/dist/nodes/Airtable/v2/transport/index.js.map +1 -1
- package/dist/nodes/Beeminder/Beeminder.node.d.ts.map +1 -1
- package/dist/nodes/Beeminder/Beeminder.node.functions.d.ts +106 -5
- package/dist/nodes/Beeminder/Beeminder.node.functions.d.ts.map +1 -1
- package/dist/nodes/Beeminder/Beeminder.node.functions.js +87 -10
- package/dist/nodes/Beeminder/Beeminder.node.functions.js.map +1 -1
- package/dist/nodes/Beeminder/Beeminder.node.js +1034 -59
- package/dist/nodes/Beeminder/Beeminder.node.js.map +1 -1
- package/dist/nodes/Beeminder/GenericFunctions.d.ts +1 -1
- package/dist/nodes/Beeminder/GenericFunctions.d.ts.map +1 -1
- package/dist/nodes/Beeminder/GenericFunctions.js +49 -4
- package/dist/nodes/Beeminder/GenericFunctions.js.map +1 -1
- package/dist/nodes/ClickUp/ClickUp.node.d.ts.map +1 -1
- package/dist/nodes/ClickUp/ClickUp.node.js +9 -1
- package/dist/nodes/ClickUp/ClickUp.node.js.map +1 -1
- package/dist/nodes/ClickUp/TaskDescription.d.ts.map +1 -1
- package/dist/nodes/ClickUp/TaskDescription.js +26 -0
- package/dist/nodes/ClickUp/TaskDescription.js.map +1 -1
- package/dist/nodes/Code/ExecutionError.d.ts +1 -1
- package/dist/nodes/Code/ExecutionError.d.ts.map +1 -1
- package/dist/nodes/Code/ExecutionError.js +2 -2
- package/dist/nodes/Code/ExecutionError.js.map +1 -1
- package/dist/nodes/Code/ValidationError.d.ts +1 -1
- package/dist/nodes/Code/ValidationError.d.ts.map +1 -1
- package/dist/nodes/Code/ValidationError.js +2 -2
- package/dist/nodes/Code/ValidationError.js.map +1 -1
- package/dist/nodes/Code/errors/WrappedExecutionError.d.ts +1 -1
- package/dist/nodes/Code/errors/WrappedExecutionError.d.ts.map +1 -1
- package/dist/nodes/Code/errors/WrappedExecutionError.js +2 -2
- package/dist/nodes/Code/errors/WrappedExecutionError.js.map +1 -1
- package/dist/nodes/Ftp/Ftp.node.d.ts.map +1 -1
- package/dist/nodes/Ftp/Ftp.node.js +64 -1
- package/dist/nodes/Ftp/Ftp.node.js.map +1 -1
- package/dist/nodes/Google/BigQuery/v2/actions/database/executeQuery.operation.d.ts.map +1 -1
- package/dist/nodes/Google/BigQuery/v2/actions/database/executeQuery.operation.js +61 -0
- package/dist/nodes/Google/BigQuery/v2/actions/database/executeQuery.operation.js.map +1 -1
- package/dist/nodes/Google/Gmail/GmailTrigger.node.d.ts.map +1 -1
- package/dist/nodes/Google/Gmail/GmailTrigger.node.js +4 -1
- package/dist/nodes/Google/Gmail/GmailTrigger.node.js.map +1 -1
- package/dist/nodes/Google/Sheet/GoogleSheets.node.d.ts.map +1 -1
- package/dist/nodes/Google/Sheet/GoogleSheets.node.js +2 -1
- package/dist/nodes/Google/Sheet/GoogleSheets.node.js.map +1 -1
- package/dist/nodes/Google/Sheet/v2/actions/sheet/appendOrUpdate.operation.d.ts.map +1 -1
- package/dist/nodes/Google/Sheet/v2/actions/sheet/appendOrUpdate.operation.js +36 -1
- package/dist/nodes/Google/Sheet/v2/actions/sheet/appendOrUpdate.operation.js.map +1 -1
- package/dist/nodes/Google/Sheet/v2/actions/sheet/update.operation.d.ts.map +1 -1
- package/dist/nodes/Google/Sheet/v2/actions/sheet/update.operation.js +36 -1
- package/dist/nodes/Google/Sheet/v2/actions/sheet/update.operation.js.map +1 -1
- package/dist/nodes/Google/Sheet/v2/actions/versionDescription.js +1 -1
- package/dist/nodes/Google/Sheet/v2/actions/versionDescription.js.map +1 -1
- package/dist/nodes/Mailcheck/GenericFunctions.js +2 -2
- package/dist/nodes/Mailcheck/GenericFunctions.js.map +1 -1
- package/dist/nodes/Merge/v2/utils.js +4 -4
- package/dist/nodes/Merge/v2/utils.js.map +1 -1
- package/dist/nodes/MongoDb/MongoDb.node.d.ts.map +1 -1
- package/dist/nodes/MongoDb/MongoDb.node.js +314 -204
- package/dist/nodes/MongoDb/MongoDb.node.js.map +1 -1
- package/dist/nodes/MongoDb/MongoDbProperties.d.ts.map +1 -1
- package/dist/nodes/MongoDb/MongoDbProperties.js +135 -0
- package/dist/nodes/MongoDb/MongoDbProperties.js.map +1 -1
- package/dist/nodes/Postgres/PostgresTrigger.functions.js +5 -5
- package/dist/nodes/Postgres/PostgresTrigger.functions.js.map +1 -1
- package/dist/nodes/Postgres/v1/genericFunctions.js +7 -7
- package/dist/nodes/Postgres/v1/genericFunctions.js.map +1 -1
- package/dist/nodes/Postgres/v2/helpers/utils.d.ts +3 -3
- package/dist/nodes/RespondToWebhook/RespondToWebhook.node.d.ts.map +1 -1
- package/dist/nodes/RespondToWebhook/RespondToWebhook.node.js +13 -2
- package/dist/nodes/RespondToWebhook/RespondToWebhook.node.js.map +1 -1
- package/dist/nodes/RespondToWebhook/utils/binary.d.ts.map +1 -1
- package/dist/nodes/RespondToWebhook/utils/binary.js +9 -2
- package/dist/nodes/RespondToWebhook/utils/binary.js.map +1 -1
- package/dist/nodes/Slack/SlackTrigger.node.d.ts.map +1 -1
- package/dist/nodes/Slack/SlackTrigger.node.js +9 -2
- package/dist/nodes/Slack/SlackTrigger.node.js.map +1 -1
- package/dist/nodes/Slack/SlackTriggerHelpers.d.ts +1 -0
- package/dist/nodes/Slack/SlackTriggerHelpers.d.ts.map +1 -1
- package/dist/nodes/Slack/SlackTriggerHelpers.js +44 -0
- package/dist/nodes/Slack/SlackTriggerHelpers.js.map +1 -1
- package/dist/nodes/StopAndError/StopAndError.node.d.ts.map +1 -1
- package/dist/nodes/StopAndError/StopAndError.node.js +6 -15
- package/dist/nodes/StopAndError/StopAndError.node.js.map +1 -1
- package/dist/nodes/StopAndError/utils.d.ts +12 -0
- package/dist/nodes/StopAndError/utils.d.ts.map +1 -0
- package/dist/nodes/StopAndError/utils.js +31 -0
- package/dist/nodes/StopAndError/utils.js.map +1 -0
- package/dist/nodes/Transform/utils/utils.js +2 -2
- package/dist/nodes/Transform/utils/utils.js.map +1 -1
- package/dist/nodes/Venafi/Datacenter/GenericFunctions.js +2 -2
- package/dist/nodes/Venafi/Datacenter/GenericFunctions.js.map +1 -1
- package/dist/nodes/Webhook/Webhook.node.d.ts.map +1 -1
- package/dist/nodes/Webhook/Webhook.node.js +11 -0
- package/dist/nodes/Webhook/Webhook.node.js.map +1 -1
- package/dist/nodes/Webhook/error.d.ts +1 -1
- package/dist/nodes/Webhook/error.d.ts.map +1 -1
- package/dist/nodes/Webhook/error.js +2 -2
- package/dist/nodes/Webhook/error.js.map +1 -1
- package/dist/nodes/Wordpress/PostDescription.d.ts.map +1 -1
- package/dist/nodes/Wordpress/PostDescription.js +14 -0
- package/dist/nodes/Wordpress/PostDescription.js.map +1 -1
- package/dist/nodes/Wordpress/PostInterface.d.ts +1 -0
- package/dist/nodes/Wordpress/PostInterface.d.ts.map +1 -1
- package/dist/nodes/Wordpress/Wordpress.node.d.ts.map +1 -1
- package/dist/nodes/Wordpress/Wordpress.node.js +6 -0
- package/dist/nodes/Wordpress/Wordpress.node.js.map +1 -1
- package/dist/typecheck.tsbuildinfo +1 -1
- package/dist/types/credentials.json +4 -3
- package/dist/types/nodes.json +14 -14
- package/dist/utils/types.d.ts +8 -0
- package/dist/utils/types.d.ts.map +1 -0
- package/dist/utils/types.js +57 -0
- package/dist/utils/types.js.map +1 -0
- package/package.json +8 -6
|
@@ -8,6 +8,7 @@ const moment_timezone_1 = __importDefault(require("moment-timezone"));
|
|
|
8
8
|
const n8n_workflow_1 = require("n8n-workflow");
|
|
9
9
|
const Beeminder_node_functions_1 = require("./Beeminder.node.functions");
|
|
10
10
|
const GenericFunctions_1 = require("./GenericFunctions");
|
|
11
|
+
const types_1 = require("../../utils/types");
|
|
11
12
|
class Beeminder {
|
|
12
13
|
description = {
|
|
13
14
|
displayName: 'Beeminder',
|
|
@@ -28,9 +29,39 @@ class Beeminder {
|
|
|
28
29
|
{
|
|
29
30
|
name: 'beeminderApi',
|
|
30
31
|
required: true,
|
|
32
|
+
displayOptions: {
|
|
33
|
+
show: {
|
|
34
|
+
authentication: ['apiToken'],
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'beeminderOAuth2Api',
|
|
40
|
+
required: true,
|
|
41
|
+
displayOptions: {
|
|
42
|
+
show: {
|
|
43
|
+
authentication: ['oAuth2'],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
31
46
|
},
|
|
32
47
|
],
|
|
33
48
|
properties: [
|
|
49
|
+
{
|
|
50
|
+
displayName: 'Authentication',
|
|
51
|
+
name: 'authentication',
|
|
52
|
+
type: 'options',
|
|
53
|
+
options: [
|
|
54
|
+
{
|
|
55
|
+
name: 'API Token',
|
|
56
|
+
value: 'apiToken',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: 'OAuth2',
|
|
60
|
+
value: 'oAuth2',
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
default: 'apiToken',
|
|
64
|
+
},
|
|
34
65
|
{
|
|
35
66
|
displayName: 'Resource',
|
|
36
67
|
name: 'resource',
|
|
@@ -38,10 +69,22 @@ class Beeminder {
|
|
|
38
69
|
noDataExpression: true,
|
|
39
70
|
required: true,
|
|
40
71
|
options: [
|
|
72
|
+
{
|
|
73
|
+
name: 'Charge',
|
|
74
|
+
value: 'charge',
|
|
75
|
+
},
|
|
41
76
|
{
|
|
42
77
|
name: 'Datapoint',
|
|
43
78
|
value: 'datapoint',
|
|
44
79
|
},
|
|
80
|
+
{
|
|
81
|
+
name: 'Goal',
|
|
82
|
+
value: 'goal',
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: 'User',
|
|
86
|
+
value: 'user',
|
|
87
|
+
},
|
|
45
88
|
],
|
|
46
89
|
default: 'datapoint',
|
|
47
90
|
},
|
|
@@ -50,6 +93,32 @@ class Beeminder {
|
|
|
50
93
|
name: 'operation',
|
|
51
94
|
type: 'options',
|
|
52
95
|
noDataExpression: true,
|
|
96
|
+
displayOptions: {
|
|
97
|
+
show: {
|
|
98
|
+
resource: ['charge'],
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
options: [
|
|
102
|
+
{
|
|
103
|
+
name: 'Create',
|
|
104
|
+
value: 'create',
|
|
105
|
+
description: 'Create a charge',
|
|
106
|
+
action: 'Create a charge',
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
default: 'create',
|
|
110
|
+
required: true,
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
displayName: 'Operation',
|
|
114
|
+
name: 'operation',
|
|
115
|
+
type: 'options',
|
|
116
|
+
noDataExpression: true,
|
|
117
|
+
displayOptions: {
|
|
118
|
+
show: {
|
|
119
|
+
resource: ['datapoint'],
|
|
120
|
+
},
|
|
121
|
+
},
|
|
53
122
|
options: [
|
|
54
123
|
{
|
|
55
124
|
name: 'Create',
|
|
@@ -57,12 +126,24 @@ class Beeminder {
|
|
|
57
126
|
description: 'Create datapoint for goal',
|
|
58
127
|
action: 'Create datapoint for goal',
|
|
59
128
|
},
|
|
129
|
+
{
|
|
130
|
+
name: 'Create All',
|
|
131
|
+
value: 'createAll',
|
|
132
|
+
description: 'Create multiple datapoints at once',
|
|
133
|
+
action: 'Create multiple datapoints at once',
|
|
134
|
+
},
|
|
60
135
|
{
|
|
61
136
|
name: 'Delete',
|
|
62
137
|
value: 'delete',
|
|
63
138
|
description: 'Delete a datapoint',
|
|
64
139
|
action: 'Delete a datapoint',
|
|
65
140
|
},
|
|
141
|
+
{
|
|
142
|
+
name: 'Get',
|
|
143
|
+
value: 'get',
|
|
144
|
+
description: 'Get a single datapoint',
|
|
145
|
+
action: 'Get a single datapoint',
|
|
146
|
+
},
|
|
66
147
|
{
|
|
67
148
|
name: 'Get Many',
|
|
68
149
|
value: 'getAll',
|
|
@@ -79,6 +160,102 @@ class Beeminder {
|
|
|
79
160
|
default: 'create',
|
|
80
161
|
required: true,
|
|
81
162
|
},
|
|
163
|
+
{
|
|
164
|
+
displayName: 'Operation',
|
|
165
|
+
name: 'operation',
|
|
166
|
+
type: 'options',
|
|
167
|
+
noDataExpression: true,
|
|
168
|
+
displayOptions: {
|
|
169
|
+
show: {
|
|
170
|
+
resource: ['goal'],
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
// eslint-disable-next-line n8n-nodes-base/node-param-options-type-unsorted-items
|
|
174
|
+
options: [
|
|
175
|
+
{
|
|
176
|
+
name: 'Create',
|
|
177
|
+
value: 'create',
|
|
178
|
+
description: 'Create a new goal',
|
|
179
|
+
action: 'Create a new goal',
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
name: 'Get',
|
|
183
|
+
value: 'get',
|
|
184
|
+
description: 'Get a specific goal',
|
|
185
|
+
action: 'Get a specific goal',
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
name: 'Get Many',
|
|
189
|
+
value: 'getAll',
|
|
190
|
+
description: 'Get many goals',
|
|
191
|
+
action: 'Get many goals',
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
name: 'Get Archived',
|
|
195
|
+
value: 'getArchived',
|
|
196
|
+
description: 'Get archived goals',
|
|
197
|
+
action: 'Get archived goals',
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
name: 'Update',
|
|
201
|
+
value: 'update',
|
|
202
|
+
description: 'Update a goal',
|
|
203
|
+
action: 'Update a goal',
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
name: 'Refresh',
|
|
207
|
+
value: 'refresh',
|
|
208
|
+
description: 'Refresh goal data',
|
|
209
|
+
action: 'Refresh goal data',
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
name: 'Short Circuit',
|
|
213
|
+
value: 'shortCircuit',
|
|
214
|
+
description: 'Short circuit pledge',
|
|
215
|
+
action: 'Short circuit pledge',
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
name: 'Step Down',
|
|
219
|
+
value: 'stepDown',
|
|
220
|
+
description: 'Step down pledge',
|
|
221
|
+
action: 'Step down pledge',
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
name: 'Cancel Step Down',
|
|
225
|
+
value: 'cancelStepDown',
|
|
226
|
+
action: 'Cancel step down',
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
name: 'Uncle',
|
|
230
|
+
value: 'uncle',
|
|
231
|
+
description: 'Derail a goal and charge the pledge amount',
|
|
232
|
+
action: 'Derail a goal and charge the pledge amount',
|
|
233
|
+
},
|
|
234
|
+
],
|
|
235
|
+
default: 'get',
|
|
236
|
+
required: true,
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
displayName: 'Operation',
|
|
240
|
+
name: 'operation',
|
|
241
|
+
type: 'options',
|
|
242
|
+
noDataExpression: true,
|
|
243
|
+
displayOptions: {
|
|
244
|
+
show: {
|
|
245
|
+
resource: ['user'],
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
options: [
|
|
249
|
+
{
|
|
250
|
+
name: 'Get',
|
|
251
|
+
value: 'get',
|
|
252
|
+
description: 'Get user information',
|
|
253
|
+
action: 'Get user information',
|
|
254
|
+
},
|
|
255
|
+
],
|
|
256
|
+
default: 'get',
|
|
257
|
+
required: true,
|
|
258
|
+
},
|
|
82
259
|
{
|
|
83
260
|
displayName: 'Goal Name or ID',
|
|
84
261
|
name: 'goalName',
|
|
@@ -95,6 +272,156 @@ class Beeminder {
|
|
|
95
272
|
description: 'The name of the goal. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
|
96
273
|
required: true,
|
|
97
274
|
},
|
|
275
|
+
{
|
|
276
|
+
displayName: 'Goal Name or ID',
|
|
277
|
+
name: 'goalName',
|
|
278
|
+
type: 'options',
|
|
279
|
+
typeOptions: {
|
|
280
|
+
loadOptionsMethod: 'getGoals',
|
|
281
|
+
},
|
|
282
|
+
displayOptions: {
|
|
283
|
+
show: {
|
|
284
|
+
resource: ['goal'],
|
|
285
|
+
operation: ['uncle'],
|
|
286
|
+
},
|
|
287
|
+
},
|
|
288
|
+
default: '',
|
|
289
|
+
description: 'The name of the goal to derail. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
|
290
|
+
required: true,
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
displayName: 'Goal Name or ID',
|
|
294
|
+
name: 'goalName',
|
|
295
|
+
type: 'options',
|
|
296
|
+
typeOptions: {
|
|
297
|
+
loadOptionsMethod: 'getGoals',
|
|
298
|
+
},
|
|
299
|
+
displayOptions: {
|
|
300
|
+
show: {
|
|
301
|
+
resource: ['goal'],
|
|
302
|
+
operation: ['get', 'update', 'refresh', 'shortCircuit', 'stepDown', 'cancelStepDown'],
|
|
303
|
+
},
|
|
304
|
+
},
|
|
305
|
+
default: '',
|
|
306
|
+
description: 'The name of the goal. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
|
307
|
+
required: true,
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
displayName: 'Amount',
|
|
311
|
+
name: 'amount',
|
|
312
|
+
type: 'number',
|
|
313
|
+
displayOptions: {
|
|
314
|
+
show: {
|
|
315
|
+
resource: ['charge'],
|
|
316
|
+
operation: ['create'],
|
|
317
|
+
},
|
|
318
|
+
},
|
|
319
|
+
default: 0,
|
|
320
|
+
description: 'Charge amount in USD',
|
|
321
|
+
required: true,
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
displayName: 'Datapoints',
|
|
325
|
+
name: 'datapoints',
|
|
326
|
+
type: 'json',
|
|
327
|
+
displayOptions: {
|
|
328
|
+
show: {
|
|
329
|
+
resource: ['datapoint'],
|
|
330
|
+
operation: ['createAll'],
|
|
331
|
+
},
|
|
332
|
+
},
|
|
333
|
+
default: '[]',
|
|
334
|
+
description: 'Array of datapoint objects to create. Each object should contain value and optionally timestamp, comment, etc.',
|
|
335
|
+
placeholder: '[{"value": 1, "comment": "First datapoint"}, {"value": 2, "comment": "Second datapoint"}]',
|
|
336
|
+
required: true,
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
displayName: 'Goal Slug',
|
|
340
|
+
name: 'slug',
|
|
341
|
+
type: 'string',
|
|
342
|
+
displayOptions: {
|
|
343
|
+
show: {
|
|
344
|
+
resource: ['goal'],
|
|
345
|
+
operation: ['create'],
|
|
346
|
+
},
|
|
347
|
+
},
|
|
348
|
+
default: '',
|
|
349
|
+
description: 'Unique identifier for the goal',
|
|
350
|
+
required: true,
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
displayName: 'Goal Title',
|
|
354
|
+
name: 'title',
|
|
355
|
+
type: 'string',
|
|
356
|
+
displayOptions: {
|
|
357
|
+
show: {
|
|
358
|
+
resource: ['goal'],
|
|
359
|
+
operation: ['create'],
|
|
360
|
+
},
|
|
361
|
+
},
|
|
362
|
+
default: '',
|
|
363
|
+
description: 'Human-readable title for the goal',
|
|
364
|
+
required: true,
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
displayName: 'Goal Type',
|
|
368
|
+
name: 'goal_type',
|
|
369
|
+
type: 'options',
|
|
370
|
+
displayOptions: {
|
|
371
|
+
show: {
|
|
372
|
+
resource: ['goal'],
|
|
373
|
+
operation: ['create'],
|
|
374
|
+
},
|
|
375
|
+
},
|
|
376
|
+
// eslint-disable-next-line n8n-nodes-base/node-param-options-type-unsorted-items
|
|
377
|
+
options: [
|
|
378
|
+
{
|
|
379
|
+
name: 'Hustler',
|
|
380
|
+
value: 'hustler',
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
name: 'Biker',
|
|
384
|
+
value: 'biker',
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
name: 'Fatloser',
|
|
388
|
+
value: 'fatloser',
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
name: 'Gainer',
|
|
392
|
+
value: 'gainer',
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
name: 'Inboxer',
|
|
396
|
+
value: 'inboxer',
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
name: 'Drinker',
|
|
400
|
+
value: 'drinker',
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
name: 'Custom',
|
|
404
|
+
value: 'custom',
|
|
405
|
+
},
|
|
406
|
+
],
|
|
407
|
+
default: 'hustler',
|
|
408
|
+
description: 'Type of goal. <a href="https://api.beeminder.com/#attributes-2">More info here.</a>.',
|
|
409
|
+
required: true,
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
displayName: 'Goal Units',
|
|
413
|
+
name: 'gunits',
|
|
414
|
+
type: 'string',
|
|
415
|
+
displayOptions: {
|
|
416
|
+
show: {
|
|
417
|
+
resource: ['goal'],
|
|
418
|
+
operation: ['create'],
|
|
419
|
+
},
|
|
420
|
+
},
|
|
421
|
+
default: '',
|
|
422
|
+
description: 'Units for the goal (e.g., "hours", "pages", "pounds")',
|
|
423
|
+
required: true,
|
|
424
|
+
},
|
|
98
425
|
{
|
|
99
426
|
displayName: 'Return All',
|
|
100
427
|
name: 'returnAll',
|
|
@@ -148,7 +475,8 @@ class Beeminder {
|
|
|
148
475
|
default: '',
|
|
149
476
|
displayOptions: {
|
|
150
477
|
show: {
|
|
151
|
-
|
|
478
|
+
resource: ['datapoint'],
|
|
479
|
+
operation: ['update', 'delete', 'get'],
|
|
152
480
|
},
|
|
153
481
|
},
|
|
154
482
|
required: true,
|
|
@@ -190,6 +518,355 @@ class Beeminder {
|
|
|
190
518
|
},
|
|
191
519
|
],
|
|
192
520
|
},
|
|
521
|
+
{
|
|
522
|
+
displayName: 'Additional Fields',
|
|
523
|
+
name: 'additionalFields',
|
|
524
|
+
type: 'collection',
|
|
525
|
+
placeholder: 'Add Field',
|
|
526
|
+
default: {},
|
|
527
|
+
displayOptions: {
|
|
528
|
+
show: {
|
|
529
|
+
resource: ['charge'],
|
|
530
|
+
operation: ['create'],
|
|
531
|
+
},
|
|
532
|
+
},
|
|
533
|
+
options: [
|
|
534
|
+
{
|
|
535
|
+
displayName: 'Note',
|
|
536
|
+
name: 'note',
|
|
537
|
+
type: 'string',
|
|
538
|
+
default: '',
|
|
539
|
+
description: 'Charge explanation',
|
|
540
|
+
},
|
|
541
|
+
{
|
|
542
|
+
displayName: 'Dry Run',
|
|
543
|
+
name: 'dryrun',
|
|
544
|
+
type: 'boolean',
|
|
545
|
+
default: false,
|
|
546
|
+
description: 'Whether to test charge creation without actually charging',
|
|
547
|
+
},
|
|
548
|
+
],
|
|
549
|
+
},
|
|
550
|
+
{
|
|
551
|
+
displayName: 'Additional Fields',
|
|
552
|
+
name: 'additionalFields',
|
|
553
|
+
type: 'collection',
|
|
554
|
+
placeholder: 'Add Field',
|
|
555
|
+
default: {},
|
|
556
|
+
displayOptions: {
|
|
557
|
+
show: {
|
|
558
|
+
resource: ['goal'],
|
|
559
|
+
operation: ['create'],
|
|
560
|
+
},
|
|
561
|
+
},
|
|
562
|
+
options: [
|
|
563
|
+
{
|
|
564
|
+
displayName: 'Goal Date',
|
|
565
|
+
name: 'goaldate',
|
|
566
|
+
type: 'dateTime',
|
|
567
|
+
default: null,
|
|
568
|
+
description: 'Target date for the goal',
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
displayName: 'Goal Value',
|
|
572
|
+
name: 'goalval',
|
|
573
|
+
type: 'number',
|
|
574
|
+
default: null,
|
|
575
|
+
description: 'Target value for the goal',
|
|
576
|
+
},
|
|
577
|
+
{
|
|
578
|
+
displayName: 'Rate',
|
|
579
|
+
name: 'rate',
|
|
580
|
+
type: 'number',
|
|
581
|
+
default: null,
|
|
582
|
+
description: 'Rate of progress (units per day)',
|
|
583
|
+
},
|
|
584
|
+
{
|
|
585
|
+
displayName: 'Initial Value',
|
|
586
|
+
name: 'initval',
|
|
587
|
+
type: 'number',
|
|
588
|
+
default: 0,
|
|
589
|
+
description: "Initial value for today's date",
|
|
590
|
+
},
|
|
591
|
+
{
|
|
592
|
+
displayName: 'Secret',
|
|
593
|
+
name: 'secret',
|
|
594
|
+
type: 'boolean',
|
|
595
|
+
default: false,
|
|
596
|
+
description: 'Whether the goal is secret',
|
|
597
|
+
},
|
|
598
|
+
{
|
|
599
|
+
displayName: 'Data Public',
|
|
600
|
+
name: 'datapublic',
|
|
601
|
+
type: 'boolean',
|
|
602
|
+
default: false,
|
|
603
|
+
description: 'Whether the data is public',
|
|
604
|
+
},
|
|
605
|
+
{
|
|
606
|
+
displayName: 'Data Source',
|
|
607
|
+
name: 'datasource',
|
|
608
|
+
type: 'options',
|
|
609
|
+
options: [
|
|
610
|
+
{
|
|
611
|
+
name: 'API',
|
|
612
|
+
value: 'api',
|
|
613
|
+
},
|
|
614
|
+
{
|
|
615
|
+
name: 'IFTTT',
|
|
616
|
+
value: 'ifttt',
|
|
617
|
+
},
|
|
618
|
+
{
|
|
619
|
+
name: 'Zapier',
|
|
620
|
+
value: 'zapier',
|
|
621
|
+
},
|
|
622
|
+
{
|
|
623
|
+
name: 'Manual',
|
|
624
|
+
value: 'manual',
|
|
625
|
+
},
|
|
626
|
+
],
|
|
627
|
+
default: 'manual',
|
|
628
|
+
description: 'Data source for the goal',
|
|
629
|
+
},
|
|
630
|
+
{
|
|
631
|
+
displayName: 'Dry Run',
|
|
632
|
+
name: 'dryrun',
|
|
633
|
+
type: 'boolean',
|
|
634
|
+
default: false,
|
|
635
|
+
description: 'Whether to test the endpoint without actually creating a goal',
|
|
636
|
+
},
|
|
637
|
+
{
|
|
638
|
+
displayName: 'Tags',
|
|
639
|
+
name: 'tags',
|
|
640
|
+
type: 'json',
|
|
641
|
+
default: '[]',
|
|
642
|
+
description: 'Array of alphanumeric tags for the goal. Replaces existing tags.',
|
|
643
|
+
placeholder: '["tag1", "tag2"]',
|
|
644
|
+
},
|
|
645
|
+
],
|
|
646
|
+
},
|
|
647
|
+
{
|
|
648
|
+
displayName: 'Update Fields',
|
|
649
|
+
name: 'updateFields',
|
|
650
|
+
type: 'collection',
|
|
651
|
+
placeholder: 'Add Field',
|
|
652
|
+
default: {},
|
|
653
|
+
displayOptions: {
|
|
654
|
+
show: {
|
|
655
|
+
resource: ['goal'],
|
|
656
|
+
operation: ['update'],
|
|
657
|
+
},
|
|
658
|
+
},
|
|
659
|
+
options: [
|
|
660
|
+
{
|
|
661
|
+
displayName: 'Title',
|
|
662
|
+
name: 'title',
|
|
663
|
+
type: 'string',
|
|
664
|
+
default: '',
|
|
665
|
+
description: 'Human-readable title for the goal',
|
|
666
|
+
},
|
|
667
|
+
{
|
|
668
|
+
displayName: 'Y-Axis',
|
|
669
|
+
name: 'yaxis',
|
|
670
|
+
type: 'string',
|
|
671
|
+
default: '',
|
|
672
|
+
description: 'Y-axis label for the goal graph',
|
|
673
|
+
},
|
|
674
|
+
{
|
|
675
|
+
displayName: 'Tmin',
|
|
676
|
+
name: 'tmin',
|
|
677
|
+
type: 'string',
|
|
678
|
+
default: '',
|
|
679
|
+
placeholder: 'yyyy-mm-dd',
|
|
680
|
+
description: 'Minimum date for the goal in format yyyy-mm-dd',
|
|
681
|
+
},
|
|
682
|
+
{
|
|
683
|
+
displayName: 'Tmax',
|
|
684
|
+
name: 'tmax',
|
|
685
|
+
type: 'string',
|
|
686
|
+
default: '',
|
|
687
|
+
placeholder: 'yyyy-mm-dd',
|
|
688
|
+
description: 'Maximum date for the goal in format yyyy-mm-dd',
|
|
689
|
+
},
|
|
690
|
+
{
|
|
691
|
+
displayName: 'Secret',
|
|
692
|
+
name: 'secret',
|
|
693
|
+
type: 'boolean',
|
|
694
|
+
default: false,
|
|
695
|
+
description: 'Whether the goal is secret',
|
|
696
|
+
},
|
|
697
|
+
{
|
|
698
|
+
displayName: 'Data Public',
|
|
699
|
+
name: 'datapublic',
|
|
700
|
+
type: 'boolean',
|
|
701
|
+
default: false,
|
|
702
|
+
description: 'Whether the data is public',
|
|
703
|
+
},
|
|
704
|
+
{
|
|
705
|
+
displayName: 'Road All',
|
|
706
|
+
name: 'roadall',
|
|
707
|
+
type: 'json',
|
|
708
|
+
default: '[]',
|
|
709
|
+
description: 'Array of arrays defining the bright red line. Each sub-array contains [date, value, rate] with exactly one field null.',
|
|
710
|
+
placeholder: '[["2023-01-01", 0, null], [null, 100, 1]]',
|
|
711
|
+
},
|
|
712
|
+
{
|
|
713
|
+
displayName: 'Data Source',
|
|
714
|
+
name: 'datasource',
|
|
715
|
+
type: 'options',
|
|
716
|
+
options: [
|
|
717
|
+
{
|
|
718
|
+
name: 'API',
|
|
719
|
+
value: 'api',
|
|
720
|
+
},
|
|
721
|
+
{
|
|
722
|
+
name: 'IFTTT',
|
|
723
|
+
value: 'ifttt',
|
|
724
|
+
},
|
|
725
|
+
{
|
|
726
|
+
name: 'Zapier',
|
|
727
|
+
value: 'zapier',
|
|
728
|
+
},
|
|
729
|
+
{
|
|
730
|
+
name: 'Manual',
|
|
731
|
+
value: '',
|
|
732
|
+
},
|
|
733
|
+
],
|
|
734
|
+
default: '',
|
|
735
|
+
description: 'Data source for the goal. Use empty string for manual entry.',
|
|
736
|
+
},
|
|
737
|
+
{
|
|
738
|
+
displayName: 'Tags',
|
|
739
|
+
name: 'tags',
|
|
740
|
+
type: 'json',
|
|
741
|
+
default: '[]',
|
|
742
|
+
description: 'Array of alphanumeric tags for the goal. Replaces existing tags.',
|
|
743
|
+
placeholder: '["tag1", "tag2"]',
|
|
744
|
+
},
|
|
745
|
+
],
|
|
746
|
+
},
|
|
747
|
+
{
|
|
748
|
+
displayName: 'Additional Fields',
|
|
749
|
+
name: 'additionalFields',
|
|
750
|
+
type: 'collection',
|
|
751
|
+
placeholder: 'Add Field',
|
|
752
|
+
default: {},
|
|
753
|
+
displayOptions: {
|
|
754
|
+
show: {
|
|
755
|
+
resource: ['goal'],
|
|
756
|
+
operation: ['get'],
|
|
757
|
+
},
|
|
758
|
+
},
|
|
759
|
+
options: [
|
|
760
|
+
{
|
|
761
|
+
displayName: 'Include Datapoints',
|
|
762
|
+
name: 'datapoints',
|
|
763
|
+
type: 'boolean',
|
|
764
|
+
default: false,
|
|
765
|
+
description: 'Whether to include datapoints in the response',
|
|
766
|
+
},
|
|
767
|
+
{
|
|
768
|
+
displayName: 'Emaciated',
|
|
769
|
+
name: 'emaciated',
|
|
770
|
+
type: 'boolean',
|
|
771
|
+
default: false,
|
|
772
|
+
description: 'Whether to include the goal attributes called road, roadall, and fullroad will be stripped from the goal object',
|
|
773
|
+
},
|
|
774
|
+
],
|
|
775
|
+
},
|
|
776
|
+
{
|
|
777
|
+
displayName: 'Additional Fields',
|
|
778
|
+
name: 'additionalFields',
|
|
779
|
+
type: 'collection',
|
|
780
|
+
placeholder: 'Add Field',
|
|
781
|
+
default: {},
|
|
782
|
+
displayOptions: {
|
|
783
|
+
show: {
|
|
784
|
+
resource: ['user'],
|
|
785
|
+
operation: ['get'],
|
|
786
|
+
},
|
|
787
|
+
},
|
|
788
|
+
options: [
|
|
789
|
+
{
|
|
790
|
+
displayName: 'Associations',
|
|
791
|
+
name: 'associations',
|
|
792
|
+
type: 'boolean',
|
|
793
|
+
default: false,
|
|
794
|
+
description: 'Whether to include associations in the response',
|
|
795
|
+
},
|
|
796
|
+
{
|
|
797
|
+
displayName: 'Diff Since',
|
|
798
|
+
name: 'diff_since',
|
|
799
|
+
type: 'dateTime',
|
|
800
|
+
default: null,
|
|
801
|
+
description: 'Only goals and datapoints that have been created or updated since the timestamp will be returned',
|
|
802
|
+
},
|
|
803
|
+
{
|
|
804
|
+
displayName: 'Skinny',
|
|
805
|
+
name: 'skinny',
|
|
806
|
+
type: 'boolean',
|
|
807
|
+
default: false,
|
|
808
|
+
description: 'Whether to return minimal user data',
|
|
809
|
+
},
|
|
810
|
+
{
|
|
811
|
+
displayName: 'Emaciated',
|
|
812
|
+
name: 'emaciated',
|
|
813
|
+
type: 'boolean',
|
|
814
|
+
default: false,
|
|
815
|
+
description: 'Whether to include the goal attributes called road, roadall, and fullroad will be stripped from any goal objects returned with the user',
|
|
816
|
+
},
|
|
817
|
+
{
|
|
818
|
+
displayName: 'Datapoints Count',
|
|
819
|
+
name: 'datapoints_count',
|
|
820
|
+
type: 'number',
|
|
821
|
+
default: null,
|
|
822
|
+
description: 'Number of datapoints to include',
|
|
823
|
+
},
|
|
824
|
+
],
|
|
825
|
+
},
|
|
826
|
+
{
|
|
827
|
+
displayName: 'Additional Fields',
|
|
828
|
+
name: 'additionalFields',
|
|
829
|
+
type: 'collection',
|
|
830
|
+
placeholder: 'Add Field',
|
|
831
|
+
default: {},
|
|
832
|
+
displayOptions: {
|
|
833
|
+
show: {
|
|
834
|
+
resource: ['goal'],
|
|
835
|
+
operation: ['getAll'],
|
|
836
|
+
},
|
|
837
|
+
},
|
|
838
|
+
options: [
|
|
839
|
+
{
|
|
840
|
+
displayName: 'Emaciated',
|
|
841
|
+
name: 'emaciated',
|
|
842
|
+
type: 'boolean',
|
|
843
|
+
default: false,
|
|
844
|
+
description: 'Whether to include the goal attributes called road, roadall, and fullroad will be stripped from the goal objects',
|
|
845
|
+
},
|
|
846
|
+
],
|
|
847
|
+
},
|
|
848
|
+
{
|
|
849
|
+
displayName: 'Additional Fields',
|
|
850
|
+
name: 'additionalFields',
|
|
851
|
+
type: 'collection',
|
|
852
|
+
placeholder: 'Add Field',
|
|
853
|
+
default: {},
|
|
854
|
+
displayOptions: {
|
|
855
|
+
show: {
|
|
856
|
+
resource: ['goal'],
|
|
857
|
+
operation: ['getArchived'],
|
|
858
|
+
},
|
|
859
|
+
},
|
|
860
|
+
options: [
|
|
861
|
+
{
|
|
862
|
+
displayName: 'Emaciated',
|
|
863
|
+
name: 'emaciated',
|
|
864
|
+
type: 'boolean',
|
|
865
|
+
default: false,
|
|
866
|
+
description: 'Whether to include the goal attributes called road, roadall, and fullroad will be stripped from the goal objects',
|
|
867
|
+
},
|
|
868
|
+
],
|
|
869
|
+
},
|
|
193
870
|
{
|
|
194
871
|
displayName: 'Options',
|
|
195
872
|
name: 'options',
|
|
@@ -211,6 +888,36 @@ class Beeminder {
|
|
|
211
888
|
placeholder: '',
|
|
212
889
|
description: 'Attribute to sort on',
|
|
213
890
|
},
|
|
891
|
+
{
|
|
892
|
+
displayName: 'Page',
|
|
893
|
+
name: 'page',
|
|
894
|
+
type: 'number',
|
|
895
|
+
displayOptions: {
|
|
896
|
+
show: {
|
|
897
|
+
'/returnAll': [false],
|
|
898
|
+
},
|
|
899
|
+
},
|
|
900
|
+
default: 1,
|
|
901
|
+
typeOptions: {
|
|
902
|
+
minValue: 1,
|
|
903
|
+
},
|
|
904
|
+
description: 'Used to paginate results, 1-indexed, meaning page 1 is the first page',
|
|
905
|
+
},
|
|
906
|
+
{
|
|
907
|
+
displayName: 'Per Page',
|
|
908
|
+
name: 'per',
|
|
909
|
+
type: 'number',
|
|
910
|
+
displayOptions: {
|
|
911
|
+
show: {
|
|
912
|
+
'/returnAll': [false],
|
|
913
|
+
},
|
|
914
|
+
},
|
|
915
|
+
default: 25,
|
|
916
|
+
typeOptions: {
|
|
917
|
+
minValue: 0,
|
|
918
|
+
},
|
|
919
|
+
description: 'Number of results per page. Default 25. Ignored without page parameter. Must be non-negative',
|
|
920
|
+
},
|
|
214
921
|
],
|
|
215
922
|
},
|
|
216
923
|
{
|
|
@@ -257,8 +964,7 @@ class Beeminder {
|
|
|
257
964
|
// Get all the available groups to display them to user so that they can
|
|
258
965
|
// select them easily
|
|
259
966
|
async getGoals() {
|
|
260
|
-
const
|
|
261
|
-
const endpoint = `/users/${credentials.user}/goals.json`;
|
|
967
|
+
const endpoint = '/users/me/goals.json';
|
|
262
968
|
const returnData = [];
|
|
263
969
|
const goals = await GenericFunctions_1.beeminderApiRequest.call(this, 'GET', endpoint);
|
|
264
970
|
for (const goal of goals) {
|
|
@@ -278,70 +984,37 @@ class Beeminder {
|
|
|
278
984
|
const timezone = this.getTimezone();
|
|
279
985
|
const resource = this.getNodeParameter('resource', 0);
|
|
280
986
|
const operation = this.getNodeParameter('operation', 0);
|
|
281
|
-
let results;
|
|
282
987
|
for (let i = 0; i < length; i++) {
|
|
283
988
|
try {
|
|
989
|
+
let results;
|
|
284
990
|
if (resource === 'datapoint') {
|
|
285
991
|
const goalName = this.getNodeParameter('goalName', i);
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
}
|
|
301
|
-
else if (operation === 'getAll') {
|
|
302
|
-
const returnAll = this.getNodeParameter('returnAll', i);
|
|
303
|
-
const options = this.getNodeParameter('options', i);
|
|
304
|
-
const data = {
|
|
305
|
-
goalName,
|
|
306
|
-
};
|
|
307
|
-
Object.assign(data, options);
|
|
308
|
-
if (!returnAll) {
|
|
309
|
-
data.count = this.getNodeParameter('limit', 0);
|
|
310
|
-
}
|
|
311
|
-
results = await Beeminder_node_functions_1.getAllDatapoints.call(this, data);
|
|
312
|
-
const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(results), { itemData: { item: i } });
|
|
313
|
-
returnData.push(...executionData);
|
|
314
|
-
}
|
|
315
|
-
else if (operation === 'update') {
|
|
316
|
-
const datapointId = this.getNodeParameter('datapointId', i);
|
|
317
|
-
const options = this.getNodeParameter('updateFields', i);
|
|
318
|
-
const data = {
|
|
319
|
-
goalName,
|
|
320
|
-
datapointId,
|
|
321
|
-
};
|
|
322
|
-
Object.assign(data, options);
|
|
323
|
-
if (data.timestamp) {
|
|
324
|
-
data.timestamp = moment_timezone_1.default.tz(data.timestamp, timezone).unix();
|
|
325
|
-
}
|
|
326
|
-
results = await Beeminder_node_functions_1.updateDatapoint.call(this, data);
|
|
327
|
-
const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(results), { itemData: { item: i } });
|
|
328
|
-
returnData.push(...executionData);
|
|
329
|
-
}
|
|
330
|
-
else if (operation === 'delete') {
|
|
331
|
-
const datapointId = this.getNodeParameter('datapointId', i);
|
|
332
|
-
const data = {
|
|
333
|
-
goalName,
|
|
334
|
-
datapointId,
|
|
335
|
-
};
|
|
336
|
-
results = await Beeminder_node_functions_1.deleteDatapoint.call(this, data);
|
|
337
|
-
const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(results), { itemData: { item: i } });
|
|
338
|
-
returnData.push(...executionData);
|
|
339
|
-
}
|
|
992
|
+
(0, types_1.assertIsString)('goalName', goalName);
|
|
993
|
+
results = await executeDatapointOperations(this, operation, goalName, i, timezone);
|
|
994
|
+
}
|
|
995
|
+
else if (resource === 'charge') {
|
|
996
|
+
results = await executeChargeOperations(this, operation, i);
|
|
997
|
+
}
|
|
998
|
+
else if (resource === 'goal') {
|
|
999
|
+
results = await executeGoalOperations(this, operation, i, timezone);
|
|
1000
|
+
}
|
|
1001
|
+
else if (resource === 'user') {
|
|
1002
|
+
results = await executeUserOperations(this, operation, i, timezone);
|
|
1003
|
+
}
|
|
1004
|
+
else {
|
|
1005
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown resource: ${resource}`);
|
|
340
1006
|
}
|
|
1007
|
+
const executionData = buildExecutionData(this, results, i);
|
|
1008
|
+
returnData.push(...executionData);
|
|
341
1009
|
}
|
|
342
1010
|
catch (error) {
|
|
343
1011
|
if (this.continueOnFail()) {
|
|
344
|
-
|
|
1012
|
+
const errorData = {
|
|
1013
|
+
json: {},
|
|
1014
|
+
error: error instanceof n8n_workflow_1.NodeOperationError ? error : undefined,
|
|
1015
|
+
itemIndex: i,
|
|
1016
|
+
};
|
|
1017
|
+
returnData.push(errorData);
|
|
345
1018
|
continue;
|
|
346
1019
|
}
|
|
347
1020
|
throw error;
|
|
@@ -351,4 +1024,306 @@ class Beeminder {
|
|
|
351
1024
|
}
|
|
352
1025
|
}
|
|
353
1026
|
exports.Beeminder = Beeminder;
|
|
1027
|
+
function buildExecutionData(context, results, itemIndex) {
|
|
1028
|
+
return context.helpers.constructExecutionMetaData(context.helpers.returnJsonArray(results), {
|
|
1029
|
+
itemData: { item: itemIndex },
|
|
1030
|
+
});
|
|
1031
|
+
}
|
|
1032
|
+
async function executeDatapointCreate(context, goalName, itemIndex, timezone) {
|
|
1033
|
+
const value = context.getNodeParameter('value', itemIndex);
|
|
1034
|
+
(0, types_1.assertIsNumber)('value', value);
|
|
1035
|
+
const options = context.getNodeParameter('additionalFields', itemIndex);
|
|
1036
|
+
if (options.timestamp) {
|
|
1037
|
+
options.timestamp = moment_timezone_1.default.tz(options.timestamp, timezone).unix();
|
|
1038
|
+
}
|
|
1039
|
+
(0, types_1.assertIsNodeParameters)(options, {
|
|
1040
|
+
comment: { type: 'string', optional: true },
|
|
1041
|
+
timestamp: { type: 'number', optional: true },
|
|
1042
|
+
requestid: { type: 'string', optional: true },
|
|
1043
|
+
});
|
|
1044
|
+
const data = {
|
|
1045
|
+
value,
|
|
1046
|
+
goalName,
|
|
1047
|
+
...options,
|
|
1048
|
+
};
|
|
1049
|
+
return await Beeminder_node_functions_1.createDatapoint.call(context, data);
|
|
1050
|
+
}
|
|
1051
|
+
async function executeDatapointGetAll(context, goalName, itemIndex) {
|
|
1052
|
+
const returnAll = context.getNodeParameter('returnAll', itemIndex);
|
|
1053
|
+
const options = context.getNodeParameter('options', itemIndex);
|
|
1054
|
+
(0, types_1.assertIsNodeParameters)(options, {
|
|
1055
|
+
sort: { type: 'string', optional: true },
|
|
1056
|
+
page: { type: 'number', optional: true },
|
|
1057
|
+
per: { type: 'number', optional: true },
|
|
1058
|
+
});
|
|
1059
|
+
const data = {
|
|
1060
|
+
goalName,
|
|
1061
|
+
count: !returnAll ? context.getNodeParameter('limit', 0) : undefined,
|
|
1062
|
+
...options,
|
|
1063
|
+
};
|
|
1064
|
+
return await Beeminder_node_functions_1.getAllDatapoints.call(context, data);
|
|
1065
|
+
}
|
|
1066
|
+
async function executeDatapointUpdate(context, goalName, itemIndex, timezone) {
|
|
1067
|
+
const datapointId = context.getNodeParameter('datapointId', itemIndex);
|
|
1068
|
+
(0, types_1.assertIsString)('datapointId', datapointId);
|
|
1069
|
+
const options = context.getNodeParameter('updateFields', itemIndex);
|
|
1070
|
+
if (options.timestamp) {
|
|
1071
|
+
options.timestamp = moment_timezone_1.default.tz(options.timestamp, timezone).unix();
|
|
1072
|
+
}
|
|
1073
|
+
(0, types_1.assertIsNodeParameters)(options, {
|
|
1074
|
+
value: { type: 'number', optional: true },
|
|
1075
|
+
comment: { type: 'string', optional: true },
|
|
1076
|
+
timestamp: { type: 'number', optional: true },
|
|
1077
|
+
});
|
|
1078
|
+
const data = {
|
|
1079
|
+
goalName,
|
|
1080
|
+
datapointId,
|
|
1081
|
+
...options,
|
|
1082
|
+
};
|
|
1083
|
+
return await Beeminder_node_functions_1.updateDatapoint.call(context, data);
|
|
1084
|
+
}
|
|
1085
|
+
async function executeDatapointDelete(context, goalName, itemIndex) {
|
|
1086
|
+
const datapointId = context.getNodeParameter('datapointId', itemIndex);
|
|
1087
|
+
(0, types_1.assertIsString)('datapointId', datapointId);
|
|
1088
|
+
const data = {
|
|
1089
|
+
goalName,
|
|
1090
|
+
datapointId,
|
|
1091
|
+
};
|
|
1092
|
+
return await Beeminder_node_functions_1.deleteDatapoint.call(context, data);
|
|
1093
|
+
}
|
|
1094
|
+
async function executeDatapointCreateAll(context, goalName, itemIndex) {
|
|
1095
|
+
const datapoints = context.getNodeParameter('datapoints', itemIndex);
|
|
1096
|
+
const parsedDatapoints = typeof datapoints === 'string' ? (0, n8n_workflow_1.jsonParse)(datapoints) : datapoints;
|
|
1097
|
+
(0, types_1.assertIsArray)('datapoints', parsedDatapoints, (val) => typeof val === 'object' && val !== null && 'value' in val);
|
|
1098
|
+
const data = {
|
|
1099
|
+
goalName,
|
|
1100
|
+
datapoints: parsedDatapoints,
|
|
1101
|
+
};
|
|
1102
|
+
return await Beeminder_node_functions_1.createAllDatapoints.call(context, data);
|
|
1103
|
+
}
|
|
1104
|
+
async function executeDatapointGet(context, goalName, itemIndex) {
|
|
1105
|
+
const datapointId = context.getNodeParameter('datapointId', itemIndex);
|
|
1106
|
+
(0, types_1.assertIsString)('datapointId', datapointId);
|
|
1107
|
+
const data = {
|
|
1108
|
+
goalName,
|
|
1109
|
+
datapointId,
|
|
1110
|
+
};
|
|
1111
|
+
return await Beeminder_node_functions_1.getSingleDatapoint.call(context, data);
|
|
1112
|
+
}
|
|
1113
|
+
async function executeDatapointOperations(context, operation, goalName, itemIndex, timezone) {
|
|
1114
|
+
switch (operation) {
|
|
1115
|
+
case 'create':
|
|
1116
|
+
return await executeDatapointCreate(context, goalName, itemIndex, timezone);
|
|
1117
|
+
case 'getAll':
|
|
1118
|
+
return await executeDatapointGetAll(context, goalName, itemIndex);
|
|
1119
|
+
case 'update':
|
|
1120
|
+
return await executeDatapointUpdate(context, goalName, itemIndex, timezone);
|
|
1121
|
+
case 'delete':
|
|
1122
|
+
return await executeDatapointDelete(context, goalName, itemIndex);
|
|
1123
|
+
case 'createAll':
|
|
1124
|
+
return await executeDatapointCreateAll(context, goalName, itemIndex);
|
|
1125
|
+
case 'get':
|
|
1126
|
+
return await executeDatapointGet(context, goalName, itemIndex);
|
|
1127
|
+
default:
|
|
1128
|
+
throw new n8n_workflow_1.NodeOperationError(context.getNode(), `Unknown datapoint operation: ${operation}`);
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
async function executeChargeOperations(context, operation, itemIndex) {
|
|
1132
|
+
if (operation === 'create') {
|
|
1133
|
+
const amount = context.getNodeParameter('amount', itemIndex);
|
|
1134
|
+
(0, types_1.assertIsNumber)('amount', amount);
|
|
1135
|
+
const options = context.getNodeParameter('additionalFields', itemIndex);
|
|
1136
|
+
(0, types_1.assertIsNodeParameters)(options, {
|
|
1137
|
+
note: { type: 'string', optional: true },
|
|
1138
|
+
dryrun: { type: 'boolean', optional: true },
|
|
1139
|
+
});
|
|
1140
|
+
const data = {
|
|
1141
|
+
amount,
|
|
1142
|
+
...options,
|
|
1143
|
+
};
|
|
1144
|
+
return await Beeminder_node_functions_1.createCharge.call(context, data);
|
|
1145
|
+
}
|
|
1146
|
+
throw new n8n_workflow_1.NodeOperationError(context.getNode(), `Unknown charge operation: ${operation}`);
|
|
1147
|
+
}
|
|
1148
|
+
async function executeGoalCreate(context, itemIndex, timezone) {
|
|
1149
|
+
const slug = context.getNodeParameter('slug', itemIndex);
|
|
1150
|
+
(0, types_1.assertIsString)('slug', slug);
|
|
1151
|
+
const title = context.getNodeParameter('title', itemIndex);
|
|
1152
|
+
(0, types_1.assertIsString)('title', title);
|
|
1153
|
+
const goalType = context.getNodeParameter('goal_type', itemIndex);
|
|
1154
|
+
(0, types_1.assertIsString)('goalType', goalType);
|
|
1155
|
+
const gunits = context.getNodeParameter('gunits', itemIndex);
|
|
1156
|
+
(0, types_1.assertIsString)('gunits', gunits);
|
|
1157
|
+
const options = context.getNodeParameter('additionalFields', itemIndex);
|
|
1158
|
+
if ('tags' in options && typeof options.tags === 'string') {
|
|
1159
|
+
options.tags = (0, n8n_workflow_1.jsonParse)(options.tags);
|
|
1160
|
+
}
|
|
1161
|
+
if (options.goaldate && typeof options.goaldate === 'string') {
|
|
1162
|
+
options.goaldate = moment_timezone_1.default.tz(options.goaldate, timezone).unix();
|
|
1163
|
+
}
|
|
1164
|
+
(0, types_1.assertIsNodeParameters)(options, {
|
|
1165
|
+
goaldate: { type: 'number', optional: true },
|
|
1166
|
+
goalval: { type: 'number', optional: true },
|
|
1167
|
+
rate: { type: 'number', optional: true },
|
|
1168
|
+
initval: { type: 'number', optional: true },
|
|
1169
|
+
secret: { type: 'boolean', optional: true },
|
|
1170
|
+
datapublic: { type: 'boolean', optional: true },
|
|
1171
|
+
datasource: { type: 'string', optional: true },
|
|
1172
|
+
dryrun: { type: 'boolean', optional: true },
|
|
1173
|
+
tags: { type: 'string[]', optional: true },
|
|
1174
|
+
});
|
|
1175
|
+
const data = {
|
|
1176
|
+
slug,
|
|
1177
|
+
title,
|
|
1178
|
+
goal_type: goalType,
|
|
1179
|
+
gunits,
|
|
1180
|
+
...options,
|
|
1181
|
+
};
|
|
1182
|
+
return await Beeminder_node_functions_1.createGoal.call(context, data);
|
|
1183
|
+
}
|
|
1184
|
+
async function executeGoalGet(context, itemIndex) {
|
|
1185
|
+
const goalName = context.getNodeParameter('goalName', itemIndex);
|
|
1186
|
+
(0, types_1.assertIsString)('goalName', goalName);
|
|
1187
|
+
const options = context.getNodeParameter('additionalFields', itemIndex);
|
|
1188
|
+
(0, types_1.assertIsNodeParameters)(options, {
|
|
1189
|
+
datapoints: { type: 'boolean', optional: true },
|
|
1190
|
+
emaciated: { type: 'boolean', optional: true },
|
|
1191
|
+
});
|
|
1192
|
+
const data = {
|
|
1193
|
+
goalName,
|
|
1194
|
+
...options,
|
|
1195
|
+
};
|
|
1196
|
+
return await Beeminder_node_functions_1.getGoal.call(context, data);
|
|
1197
|
+
}
|
|
1198
|
+
async function executeGoalGetAll(context, itemIndex) {
|
|
1199
|
+
const options = context.getNodeParameter('additionalFields', itemIndex);
|
|
1200
|
+
(0, types_1.assertIsNodeParameters)(options, {
|
|
1201
|
+
emaciated: { type: 'boolean', optional: true },
|
|
1202
|
+
});
|
|
1203
|
+
const data = { ...options };
|
|
1204
|
+
return await Beeminder_node_functions_1.getAllGoals.call(context, data);
|
|
1205
|
+
}
|
|
1206
|
+
async function executeGoalGetArchived(context, itemIndex) {
|
|
1207
|
+
const options = context.getNodeParameter('additionalFields', itemIndex);
|
|
1208
|
+
(0, types_1.assertIsNodeParameters)(options, {
|
|
1209
|
+
emaciated: { type: 'boolean', optional: true },
|
|
1210
|
+
});
|
|
1211
|
+
const data = { ...options };
|
|
1212
|
+
return await Beeminder_node_functions_1.getArchivedGoals.call(context, data);
|
|
1213
|
+
}
|
|
1214
|
+
async function executeGoalUpdate(context, itemIndex, timezone) {
|
|
1215
|
+
const goalName = context.getNodeParameter('goalName', itemIndex);
|
|
1216
|
+
(0, types_1.assertIsString)('goalName', goalName);
|
|
1217
|
+
const options = context.getNodeParameter('updateFields', itemIndex);
|
|
1218
|
+
if ('tags' in options && typeof options.tags === 'string') {
|
|
1219
|
+
options.tags = (0, n8n_workflow_1.jsonParse)(options.tags);
|
|
1220
|
+
}
|
|
1221
|
+
if ('roadall' in options && typeof options.roadall === 'string') {
|
|
1222
|
+
options.roadall = (0, n8n_workflow_1.jsonParse)(options.roadall);
|
|
1223
|
+
}
|
|
1224
|
+
console.log('roadall', typeof options.roadall, options.roadall);
|
|
1225
|
+
(0, types_1.assertIsNodeParameters)(options, {
|
|
1226
|
+
title: { type: 'string', optional: true },
|
|
1227
|
+
yaxis: { type: 'string', optional: true },
|
|
1228
|
+
tmin: { type: 'string', optional: true },
|
|
1229
|
+
tmax: { type: 'string', optional: true },
|
|
1230
|
+
secret: { type: 'boolean', optional: true },
|
|
1231
|
+
datapublic: { type: 'boolean', optional: true },
|
|
1232
|
+
roadall: { type: 'object', optional: true },
|
|
1233
|
+
datasource: { type: 'string', optional: true },
|
|
1234
|
+
tags: { type: 'string[]', optional: true },
|
|
1235
|
+
});
|
|
1236
|
+
const data = {
|
|
1237
|
+
goalName,
|
|
1238
|
+
...options,
|
|
1239
|
+
};
|
|
1240
|
+
if (data.goaldate) {
|
|
1241
|
+
data.goaldate = moment_timezone_1.default.tz(data.goaldate, timezone).unix();
|
|
1242
|
+
}
|
|
1243
|
+
return await Beeminder_node_functions_1.updateGoal.call(context, data);
|
|
1244
|
+
}
|
|
1245
|
+
async function executeGoalRefresh(context, itemIndex) {
|
|
1246
|
+
const goalName = context.getNodeParameter('goalName', itemIndex);
|
|
1247
|
+
(0, types_1.assertIsString)('goalName', goalName);
|
|
1248
|
+
const data = {
|
|
1249
|
+
goalName,
|
|
1250
|
+
};
|
|
1251
|
+
return await Beeminder_node_functions_1.refreshGoal.call(context, data);
|
|
1252
|
+
}
|
|
1253
|
+
async function executeGoalShortCircuit(context, itemIndex) {
|
|
1254
|
+
const goalName = context.getNodeParameter('goalName', itemIndex);
|
|
1255
|
+
(0, types_1.assertIsString)('goalName', goalName);
|
|
1256
|
+
const data = {
|
|
1257
|
+
goalName,
|
|
1258
|
+
};
|
|
1259
|
+
return await Beeminder_node_functions_1.shortCircuitGoal.call(context, data);
|
|
1260
|
+
}
|
|
1261
|
+
async function executeGoalStepDown(context, itemIndex) {
|
|
1262
|
+
const goalName = context.getNodeParameter('goalName', itemIndex);
|
|
1263
|
+
(0, types_1.assertIsString)('goalName', goalName);
|
|
1264
|
+
const data = {
|
|
1265
|
+
goalName,
|
|
1266
|
+
};
|
|
1267
|
+
return await Beeminder_node_functions_1.stepDownGoal.call(context, data);
|
|
1268
|
+
}
|
|
1269
|
+
async function executeGoalCancelStepDown(context, itemIndex) {
|
|
1270
|
+
const goalName = context.getNodeParameter('goalName', itemIndex);
|
|
1271
|
+
(0, types_1.assertIsString)('goalName', goalName);
|
|
1272
|
+
const data = {
|
|
1273
|
+
goalName,
|
|
1274
|
+
};
|
|
1275
|
+
return await Beeminder_node_functions_1.cancelStepDownGoal.call(context, data);
|
|
1276
|
+
}
|
|
1277
|
+
async function executeGoalUncle(context, itemIndex) {
|
|
1278
|
+
const goalName = context.getNodeParameter('goalName', itemIndex);
|
|
1279
|
+
(0, types_1.assertIsString)('goalName', goalName);
|
|
1280
|
+
const data = {
|
|
1281
|
+
goalName,
|
|
1282
|
+
};
|
|
1283
|
+
return await Beeminder_node_functions_1.uncleGoal.call(context, data);
|
|
1284
|
+
}
|
|
1285
|
+
async function executeGoalOperations(context, operation, itemIndex, timezone) {
|
|
1286
|
+
switch (operation) {
|
|
1287
|
+
case 'create':
|
|
1288
|
+
return await executeGoalCreate(context, itemIndex, timezone);
|
|
1289
|
+
case 'get':
|
|
1290
|
+
return await executeGoalGet(context, itemIndex);
|
|
1291
|
+
case 'getAll':
|
|
1292
|
+
return await executeGoalGetAll(context, itemIndex);
|
|
1293
|
+
case 'getArchived':
|
|
1294
|
+
return await executeGoalGetArchived(context, itemIndex);
|
|
1295
|
+
case 'update':
|
|
1296
|
+
return await executeGoalUpdate(context, itemIndex, timezone);
|
|
1297
|
+
case 'refresh':
|
|
1298
|
+
return await executeGoalRefresh(context, itemIndex);
|
|
1299
|
+
case 'shortCircuit':
|
|
1300
|
+
return await executeGoalShortCircuit(context, itemIndex);
|
|
1301
|
+
case 'stepDown':
|
|
1302
|
+
return await executeGoalStepDown(context, itemIndex);
|
|
1303
|
+
case 'cancelStepDown':
|
|
1304
|
+
return await executeGoalCancelStepDown(context, itemIndex);
|
|
1305
|
+
case 'uncle':
|
|
1306
|
+
return await executeGoalUncle(context, itemIndex);
|
|
1307
|
+
default:
|
|
1308
|
+
throw new n8n_workflow_1.NodeOperationError(context.getNode(), `Unknown goal operation: ${operation}`);
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
async function executeUserOperations(context, operation, itemIndex, timezone) {
|
|
1312
|
+
if (operation === 'get') {
|
|
1313
|
+
const options = context.getNodeParameter('additionalFields', itemIndex);
|
|
1314
|
+
if (options.diff_since) {
|
|
1315
|
+
options.diff_since = moment_timezone_1.default.tz(options.diff_since, timezone).unix();
|
|
1316
|
+
}
|
|
1317
|
+
(0, types_1.assertIsNodeParameters)(options, {
|
|
1318
|
+
associations: { type: 'boolean', optional: true },
|
|
1319
|
+
diff_since: { type: 'number', optional: true },
|
|
1320
|
+
skinny: { type: 'boolean', optional: true },
|
|
1321
|
+
emaciated: { type: 'boolean', optional: true },
|
|
1322
|
+
datapoints_count: { type: 'number', optional: true },
|
|
1323
|
+
});
|
|
1324
|
+
const data = { ...options };
|
|
1325
|
+
return await Beeminder_node_functions_1.getUser.call(context, data);
|
|
1326
|
+
}
|
|
1327
|
+
throw new n8n_workflow_1.NodeOperationError(context.getNode(), `Unknown user operation: ${operation}`);
|
|
1328
|
+
}
|
|
354
1329
|
//# sourceMappingURL=Beeminder.node.js.map
|