proca 1.1.4 → 1.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.
- package/README.md +213 -161
- package/package.json +1 -1
- package/src/commands/action/list.mjs +27 -12
- package/src/commands/config/token.mjs +34 -0
- package/src/commands/contact/list.mjs +204 -0
- package/src/commands/widget/cache.mjs +29 -0
- package/src/procaCommand.mjs +32 -8
- package/src/commands/supporter/count.mjs +0 -96
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ $ npm install -g proca
|
|
|
18
18
|
$ proca COMMAND
|
|
19
19
|
running command...
|
|
20
20
|
$ proca (--version)
|
|
21
|
-
proca/1.
|
|
21
|
+
proca/1.2.0 linux-x64 node-v20.12.2
|
|
22
22
|
$ proca --help [COMMAND]
|
|
23
23
|
USAGE
|
|
24
24
|
$ proca COMMAND
|
|
@@ -40,13 +40,8 @@ USAGE
|
|
|
40
40
|
- campaign Handle campaigns
|
|
41
41
|
- org
|
|
42
42
|
- config create setting to access the server authentication
|
|
43
|
-
|
|
44
|
-
### TODO TOPICS
|
|
45
|
-
|
|
46
43
|
- widget
|
|
47
|
-
-
|
|
48
|
-
- service
|
|
49
|
-
- target
|
|
44
|
+
- supporters (counter)
|
|
50
45
|
|
|
51
46
|
# Commands
|
|
52
47
|
<!-- commands -->
|
|
@@ -61,7 +56,9 @@ USAGE
|
|
|
61
56
|
* [`proca config get`](#proca-config-get)
|
|
62
57
|
* [`proca config set [KEY] [VALUE]`](#proca-config-set-key-value)
|
|
63
58
|
* [`proca config setup [ENVIRONMENT]`](#proca-config-setup-environment)
|
|
59
|
+
* [`proca config token`](#proca-config-token)
|
|
64
60
|
* [`proca config user`](#proca-config-user)
|
|
61
|
+
* [`proca contact list [TITLE]`](#proca-contact-list-title)
|
|
65
62
|
* [`proca help [COMMAND]`](#proca-help-command)
|
|
66
63
|
* [`proca org add`](#proca-org-add)
|
|
67
64
|
* [`proca org crm`](#proca-org-crm)
|
|
@@ -78,11 +75,11 @@ USAGE
|
|
|
78
75
|
* [`proca plugins uninstall [PLUGIN]`](#proca-plugins-uninstall-plugin)
|
|
79
76
|
* [`proca plugins unlink [PLUGIN]`](#proca-plugins-unlink-plugin)
|
|
80
77
|
* [`proca plugins update`](#proca-plugins-update)
|
|
81
|
-
* [`proca supporter count`](#proca-supporter-count)
|
|
82
78
|
* [`proca user get`](#proca-user-get)
|
|
83
79
|
* [`proca user leave`](#proca-user-leave)
|
|
84
80
|
* [`proca user list`](#proca-user-list)
|
|
85
81
|
* [`proca widget add`](#proca-widget-add)
|
|
82
|
+
* [`proca widget cache`](#proca-widget-cache)
|
|
86
83
|
* [`proca widget get`](#proca-widget-get)
|
|
87
84
|
* [`proca widget list`](#proca-widget-list)
|
|
88
85
|
|
|
@@ -92,7 +89,7 @@ counter of actions
|
|
|
92
89
|
|
|
93
90
|
```
|
|
94
91
|
USAGE
|
|
95
|
-
$ proca action count [ID_NAME_DXID] [--
|
|
92
|
+
$ proca action count [ID_NAME_DXID] [--json | --human | --csv] [--simplify] [-i <value>
|
|
96
93
|
| -n <the_short_name> | -x <value>]
|
|
97
94
|
|
|
98
95
|
FLAGS
|
|
@@ -101,10 +98,10 @@ FLAGS
|
|
|
101
98
|
-x, --dxid=<value> dxid
|
|
102
99
|
|
|
103
100
|
OUTPUT FLAGS
|
|
104
|
-
--csv
|
|
105
|
-
--human
|
|
106
|
-
--json
|
|
107
|
-
--simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
101
|
+
--csv Format output as csv
|
|
102
|
+
--human Format output to be read on screen by a human [default]
|
|
103
|
+
--json Format output as json
|
|
104
|
+
--[no-]simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
108
105
|
|
|
109
106
|
DESCRIPTION
|
|
110
107
|
counter of actions
|
|
@@ -119,8 +116,9 @@ EXAMPLES
|
|
|
119
116
|
|
|
120
117
|
```
|
|
121
118
|
USAGE
|
|
122
|
-
$ proca action list [TITLE] -o <organisation name> [--
|
|
123
|
-
|
|
119
|
+
$ proca action list [TITLE] -o <organisation name> [--json | --human | --csv] [-c
|
|
120
|
+
<campaign title>] [--limit <value>] [--today | --after 2025-04-09] [--optin] [--testing] [--doi] [--utm |
|
|
121
|
+
--simplify] [--comment | ]
|
|
124
122
|
|
|
125
123
|
ARGUMENTS
|
|
126
124
|
TITLE name of the campaign, % for wildchar
|
|
@@ -128,17 +126,20 @@ ARGUMENTS
|
|
|
128
126
|
FLAGS
|
|
129
127
|
-c, --campaign=<campaign title> name of the campaign, % for wildchar
|
|
130
128
|
-o, --org=<organisation name> (required) campaigns of the organisation (coordinator or partner)
|
|
129
|
+
--after=2025-04-09 only actions after a date
|
|
130
|
+
--[no-]comment display the comment
|
|
131
131
|
--doi only export the double optin actions
|
|
132
132
|
--limit=<value> max number of actions
|
|
133
133
|
--optin only export the optin actions
|
|
134
134
|
--testing also export the test actions
|
|
135
|
+
--today only actions today
|
|
135
136
|
--[no-]utm display the utm tracking parameters
|
|
136
137
|
|
|
137
138
|
OUTPUT FLAGS
|
|
138
|
-
--csv
|
|
139
|
-
--human
|
|
140
|
-
--json
|
|
141
|
-
--simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
139
|
+
--csv Format output as csv
|
|
140
|
+
--human Format output to be read on screen by a human [default]
|
|
141
|
+
--json Format output as json
|
|
142
|
+
--[no-]simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
142
143
|
|
|
143
144
|
EXAMPLES
|
|
144
145
|
$ proca action list %pizza%
|
|
@@ -148,7 +149,7 @@ EXAMPLES
|
|
|
148
149
|
|
|
149
150
|
```
|
|
150
151
|
USAGE
|
|
151
|
-
$ proca action replay -o <organisation name> [--
|
|
152
|
+
$ proca action replay -o <organisation name> [--json | --human | --csv] [--simplify] [-c
|
|
152
153
|
<campaign title>]
|
|
153
154
|
|
|
154
155
|
FLAGS
|
|
@@ -156,10 +157,10 @@ FLAGS
|
|
|
156
157
|
-o, --org=<organisation name> (required) campaigns of the organisation (coordinator or partner)
|
|
157
158
|
|
|
158
159
|
OUTPUT FLAGS
|
|
159
|
-
--csv
|
|
160
|
-
--human
|
|
161
|
-
--json
|
|
162
|
-
--simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
160
|
+
--csv Format output as csv
|
|
161
|
+
--human Format output to be read on screen by a human [default]
|
|
162
|
+
--json Format output as json
|
|
163
|
+
--[no-]simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
163
164
|
|
|
164
165
|
EXAMPLES
|
|
165
166
|
$ proca action replay %pizza%
|
|
@@ -169,8 +170,8 @@ EXAMPLES
|
|
|
169
170
|
|
|
170
171
|
```
|
|
171
172
|
USAGE
|
|
172
|
-
$ proca campaign add [TITLE] -n <campaign name> -o <org name> [--
|
|
173
|
-
--
|
|
173
|
+
$ proca campaign add [TITLE] -n <campaign name> -o <org name> [--json | --human |
|
|
174
|
+
--csv] [--simplify]
|
|
174
175
|
|
|
175
176
|
ARGUMENTS
|
|
176
177
|
TITLE title of the campaign
|
|
@@ -180,10 +181,10 @@ FLAGS
|
|
|
180
181
|
-o, --org=<org name> (required) name of the coordinator
|
|
181
182
|
|
|
182
183
|
OUTPUT FLAGS
|
|
183
|
-
--csv
|
|
184
|
-
--human
|
|
185
|
-
--json
|
|
186
|
-
--simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
184
|
+
--csv Format output as csv
|
|
185
|
+
--human Format output to be read on screen by a human [default]
|
|
186
|
+
--json Format output as json
|
|
187
|
+
--[no-]simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
187
188
|
|
|
188
189
|
EXAMPLES
|
|
189
190
|
$ proca campaign add -n <new_campaign> the full name of the campaign
|
|
@@ -195,7 +196,7 @@ delete a campaign
|
|
|
195
196
|
|
|
196
197
|
```
|
|
197
198
|
USAGE
|
|
198
|
-
$ proca campaign delete [--
|
|
199
|
+
$ proca campaign delete [--json | --human | --csv] [--simplify] [-i <organisation name>]
|
|
199
200
|
[-n <campaign name>]
|
|
200
201
|
|
|
201
202
|
FLAGS
|
|
@@ -203,10 +204,10 @@ FLAGS
|
|
|
203
204
|
-n, --name=<campaign name> name of the campaign
|
|
204
205
|
|
|
205
206
|
OUTPUT FLAGS
|
|
206
|
-
--csv
|
|
207
|
-
--human
|
|
208
|
-
--json
|
|
209
|
-
--simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
207
|
+
--csv Format output as csv
|
|
208
|
+
--human Format output to be read on screen by a human [default]
|
|
209
|
+
--json Format output as json
|
|
210
|
+
--[no-]simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
210
211
|
|
|
211
212
|
DESCRIPTION
|
|
212
213
|
delete a campaign
|
|
@@ -221,7 +222,7 @@ view a campaign
|
|
|
221
222
|
|
|
222
223
|
```
|
|
223
224
|
USAGE
|
|
224
|
-
$ proca campaign get [ID_NAME_DXID] [--
|
|
225
|
+
$ proca campaign get [ID_NAME_DXID] [--json | --human | --csv] [--simplify] [-i <value>
|
|
225
226
|
| -n <the_short_name> | -x <value>] [--config] [--stats] [--locale <value>]
|
|
226
227
|
|
|
227
228
|
FLAGS
|
|
@@ -233,10 +234,10 @@ FLAGS
|
|
|
233
234
|
--[no-]stats display the stats
|
|
234
235
|
|
|
235
236
|
OUTPUT FLAGS
|
|
236
|
-
--csv
|
|
237
|
-
--human
|
|
238
|
-
--json
|
|
239
|
-
--simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
237
|
+
--csv Format output as csv
|
|
238
|
+
--human Format output to be read on screen by a human [default]
|
|
239
|
+
--json Format output as json
|
|
240
|
+
--[no-]simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
240
241
|
|
|
241
242
|
DESCRIPTION
|
|
242
243
|
view a campaign
|
|
@@ -251,7 +252,7 @@ list all the campaigns
|
|
|
251
252
|
|
|
252
253
|
```
|
|
253
254
|
USAGE
|
|
254
|
-
$ proca campaign list [TITLE] [--
|
|
255
|
+
$ proca campaign list [TITLE] [--json | --human | --csv] [--simplify] [-o <organisation
|
|
255
256
|
name>] [-t <campaign title>] [--stats]
|
|
256
257
|
|
|
257
258
|
ARGUMENTS
|
|
@@ -263,10 +264,10 @@ FLAGS
|
|
|
263
264
|
--[no-]stats display the stats
|
|
264
265
|
|
|
265
266
|
OUTPUT FLAGS
|
|
266
|
-
--csv
|
|
267
|
-
--human
|
|
268
|
-
--json
|
|
269
|
-
--simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
267
|
+
--csv Format output as csv
|
|
268
|
+
--human Format output to be read on screen by a human [default]
|
|
269
|
+
--json Format output as json
|
|
270
|
+
--[no-]simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
270
271
|
|
|
271
272
|
DESCRIPTION
|
|
272
273
|
list all the campaigns
|
|
@@ -281,8 +282,8 @@ create setting to access the server authentication
|
|
|
281
282
|
|
|
282
283
|
```
|
|
283
284
|
USAGE
|
|
284
|
-
$ proca config add [ENVIRONMENT] --token <API-token> [--
|
|
285
|
-
--
|
|
285
|
+
$ proca config add [ENVIRONMENT] --token <API-token> [--json | --human | --csv]
|
|
286
|
+
[--simplify] [--force] [--url <url>] [--n8n <n8n api>] [--supabase <url>] [--supabase-anon-key <value>]
|
|
286
287
|
[--supabase-secrey-key <value>]
|
|
287
288
|
|
|
288
289
|
ARGUMENTS
|
|
@@ -298,10 +299,10 @@ FLAGS
|
|
|
298
299
|
--url=<url> [default: https://api.proca.app/api] url of the proca server api
|
|
299
300
|
|
|
300
301
|
OUTPUT FLAGS
|
|
301
|
-
--csv
|
|
302
|
-
--human
|
|
303
|
-
--json
|
|
304
|
-
--simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
302
|
+
--csv Format output as csv
|
|
303
|
+
--human Format output to be read on screen by a human [default]
|
|
304
|
+
--json Format output as json
|
|
305
|
+
--[no-]simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
305
306
|
|
|
306
307
|
DESCRIPTION
|
|
307
308
|
create setting to access the server authentication
|
|
@@ -319,13 +320,13 @@ get the server config
|
|
|
319
320
|
|
|
320
321
|
```
|
|
321
322
|
USAGE
|
|
322
|
-
$ proca config get [--
|
|
323
|
+
$ proca config get [--json | --human | --csv] [--simplify]
|
|
323
324
|
|
|
324
325
|
OUTPUT FLAGS
|
|
325
|
-
--csv
|
|
326
|
-
--human
|
|
327
|
-
--json
|
|
328
|
-
--simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
326
|
+
--csv Format output as csv
|
|
327
|
+
--human Format output to be read on screen by a human [default]
|
|
328
|
+
--json Format output as json
|
|
329
|
+
--[no-]simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
329
330
|
|
|
330
331
|
DESCRIPTION
|
|
331
332
|
get the server config
|
|
@@ -337,7 +338,7 @@ update the setting used to authenticate to the servers and services
|
|
|
337
338
|
|
|
338
339
|
```
|
|
339
340
|
USAGE
|
|
340
|
-
$ proca config set [KEY] [VALUE] [--
|
|
341
|
+
$ proca config set [KEY] [VALUE] [--json | --human | --csv] [--simplify]
|
|
341
342
|
[--environment <value>] [--url <url>] [--token <API-token>]
|
|
342
343
|
|
|
343
344
|
ARGUMENTS
|
|
@@ -350,10 +351,10 @@ FLAGS
|
|
|
350
351
|
--url=<url> [default: https://api.proca.app/api] url of the proca server api
|
|
351
352
|
|
|
352
353
|
OUTPUT FLAGS
|
|
353
|
-
--csv
|
|
354
|
-
--human
|
|
355
|
-
--json
|
|
356
|
-
--simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
354
|
+
--csv Format output as csv
|
|
355
|
+
--human Format output to be read on screen by a human [default]
|
|
356
|
+
--json Format output as json
|
|
357
|
+
--[no-]simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
357
358
|
|
|
358
359
|
DESCRIPTION
|
|
359
360
|
update the setting used to authenticate to the servers and services
|
|
@@ -373,8 +374,8 @@ create setting to access the server authentication
|
|
|
373
374
|
|
|
374
375
|
```
|
|
375
376
|
USAGE
|
|
376
|
-
$ proca config setup [ENVIRONMENT] --token <API-token> [--
|
|
377
|
-
--
|
|
377
|
+
$ proca config setup [ENVIRONMENT] --token <API-token> [--json | --human | --csv]
|
|
378
|
+
[--simplify] [--force] [--url <url>] [--n8n <n8n api>] [--supabase <url>] [--supabase-anon-key <value>]
|
|
378
379
|
[--supabase-secrey-key <value>]
|
|
379
380
|
|
|
380
381
|
ARGUMENTS
|
|
@@ -390,10 +391,10 @@ FLAGS
|
|
|
390
391
|
--url=<url> [default: https://api.proca.app/api] url of the proca server api
|
|
391
392
|
|
|
392
393
|
OUTPUT FLAGS
|
|
393
|
-
--csv
|
|
394
|
-
--human
|
|
395
|
-
--json
|
|
396
|
-
--simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
394
|
+
--csv Format output as csv
|
|
395
|
+
--human Format output to be read on screen by a human [default]
|
|
396
|
+
--json Format output as json
|
|
397
|
+
--[no-]simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
397
398
|
|
|
398
399
|
DESCRIPTION
|
|
399
400
|
create setting to access the server authentication
|
|
@@ -405,19 +406,40 @@ EXAMPLES
|
|
|
405
406
|
$ proca config setup --user=xavier@example.org --token=API-12345789
|
|
406
407
|
```
|
|
407
408
|
|
|
409
|
+
## `proca config token`
|
|
410
|
+
|
|
411
|
+
convert between token and sql value
|
|
412
|
+
|
|
413
|
+
```
|
|
414
|
+
USAGE
|
|
415
|
+
$ proca config token [--json | --human | --csv] [--simplify] [--token API-xxx]
|
|
416
|
+
|
|
417
|
+
FLAGS
|
|
418
|
+
--token=API-xxx the token in your config
|
|
419
|
+
|
|
420
|
+
OUTPUT FLAGS
|
|
421
|
+
--csv Format output as csv
|
|
422
|
+
--human Format output to be read on screen by a human [default]
|
|
423
|
+
--json Format output as json
|
|
424
|
+
--[no-]simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
425
|
+
|
|
426
|
+
DESCRIPTION
|
|
427
|
+
convert between token and sql value
|
|
428
|
+
```
|
|
429
|
+
|
|
408
430
|
## `proca config user`
|
|
409
431
|
|
|
410
432
|
fetch the information about the current user (based on the token)
|
|
411
433
|
|
|
412
434
|
```
|
|
413
435
|
USAGE
|
|
414
|
-
$ proca config user [--
|
|
436
|
+
$ proca config user [--json | --human | --csv] [--simplify]
|
|
415
437
|
|
|
416
438
|
OUTPUT FLAGS
|
|
417
|
-
--csv
|
|
418
|
-
--human
|
|
419
|
-
--json
|
|
420
|
-
--simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
439
|
+
--csv Format output as csv
|
|
440
|
+
--human Format output to be read on screen by a human [default]
|
|
441
|
+
--json Format output as json
|
|
442
|
+
--[no-]simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
421
443
|
|
|
422
444
|
DESCRIPTION
|
|
423
445
|
fetch the information about the current user (based on the token)
|
|
@@ -426,6 +448,39 @@ EXAMPLES
|
|
|
426
448
|
$ proca config user
|
|
427
449
|
```
|
|
428
450
|
|
|
451
|
+
## `proca contact list [TITLE]`
|
|
452
|
+
|
|
453
|
+
```
|
|
454
|
+
USAGE
|
|
455
|
+
$ proca contact list [TITLE] -o <organisation name> [--json | --human | --csv] [-c
|
|
456
|
+
<campaign title>] [--limit <value>] [--today | --after 2025-04-09] [--optin] [--testing] [--doi] [--utm |
|
|
457
|
+
--simplify] [--comment | ]
|
|
458
|
+
|
|
459
|
+
ARGUMENTS
|
|
460
|
+
TITLE name of the campaign, % for wildchar
|
|
461
|
+
|
|
462
|
+
FLAGS
|
|
463
|
+
-c, --campaign=<campaign title> name of the campaign, % for wildchar
|
|
464
|
+
-o, --org=<organisation name> (required) campaigns of the organisation (coordinator or partner)
|
|
465
|
+
--after=2025-04-09 only actions after a date
|
|
466
|
+
--[no-]comment display the comment
|
|
467
|
+
--doi only export the double optin actions
|
|
468
|
+
--limit=<value> max number of actions
|
|
469
|
+
--optin only export the optin actions
|
|
470
|
+
--testing also export the test actions
|
|
471
|
+
--today only actions today
|
|
472
|
+
--[no-]utm display the utm tracking parameters
|
|
473
|
+
|
|
474
|
+
OUTPUT FLAGS
|
|
475
|
+
--csv Format output as csv
|
|
476
|
+
--human Format output to be read on screen by a human [default]
|
|
477
|
+
--json Format output as json
|
|
478
|
+
--[no-]simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
479
|
+
|
|
480
|
+
EXAMPLES
|
|
481
|
+
$ proca contact list %pizza%
|
|
482
|
+
```
|
|
483
|
+
|
|
429
484
|
## `proca help [COMMAND]`
|
|
430
485
|
|
|
431
486
|
Display help for proca.
|
|
@@ -450,7 +505,7 @@ _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.2
|
|
|
450
505
|
|
|
451
506
|
```
|
|
452
507
|
USAGE
|
|
453
|
-
$ proca org add [--
|
|
508
|
+
$ proca org add [--json | --human | --csv] [--simplify] [--twitter <screen name>]
|
|
454
509
|
[-n <org name>]
|
|
455
510
|
|
|
456
511
|
FLAGS
|
|
@@ -458,10 +513,10 @@ FLAGS
|
|
|
458
513
|
--twitter=<screen name> twitter account
|
|
459
514
|
|
|
460
515
|
OUTPUT FLAGS
|
|
461
|
-
--csv
|
|
462
|
-
--human
|
|
463
|
-
--json
|
|
464
|
-
--simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
516
|
+
--csv Format output as csv
|
|
517
|
+
--human Format output to be read on screen by a human [default]
|
|
518
|
+
--json Format output as json
|
|
519
|
+
--[no-]simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
465
520
|
|
|
466
521
|
EXAMPLES
|
|
467
522
|
$ proca org add --twitter <twitter of the organisation>
|
|
@@ -473,7 +528,7 @@ view a org crm synchroniser
|
|
|
473
528
|
|
|
474
529
|
```
|
|
475
530
|
USAGE
|
|
476
|
-
$ proca org crm -n <org name> [--
|
|
531
|
+
$ proca org crm -n <org name> [--json | --human | --csv] [--simplify]
|
|
477
532
|
[--synchronize]
|
|
478
533
|
|
|
479
534
|
FLAGS
|
|
@@ -481,10 +536,10 @@ FLAGS
|
|
|
481
536
|
--[no-]synchronize enable or disable the synchronisation queue
|
|
482
537
|
|
|
483
538
|
OUTPUT FLAGS
|
|
484
|
-
--csv
|
|
485
|
-
--human
|
|
486
|
-
--json
|
|
487
|
-
--simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
539
|
+
--csv Format output as csv
|
|
540
|
+
--human Format output to be read on screen by a human [default]
|
|
541
|
+
--json Format output as json
|
|
542
|
+
--[no-]simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
488
543
|
|
|
489
544
|
DESCRIPTION
|
|
490
545
|
view a org crm synchroniser
|
|
@@ -494,7 +549,7 @@ DESCRIPTION
|
|
|
494
549
|
|
|
495
550
|
```
|
|
496
551
|
USAGE
|
|
497
|
-
$ proca org delete [ID_NAME_DXID] [--
|
|
552
|
+
$ proca org delete [ID_NAME_DXID] [--json | --human | --csv] [--simplify] [-i <value>
|
|
498
553
|
| -n <org name> | -x <value>]
|
|
499
554
|
|
|
500
555
|
FLAGS
|
|
@@ -503,10 +558,10 @@ FLAGS
|
|
|
503
558
|
-x, --dxid=<value> dxid
|
|
504
559
|
|
|
505
560
|
OUTPUT FLAGS
|
|
506
|
-
--csv
|
|
507
|
-
--human
|
|
508
|
-
--json
|
|
509
|
-
--simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
561
|
+
--csv Format output as csv
|
|
562
|
+
--human Format output to be read on screen by a human [default]
|
|
563
|
+
--json Format output as json
|
|
564
|
+
--[no-]simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
510
565
|
|
|
511
566
|
EXAMPLES
|
|
512
567
|
$ proca org delete <organisation_name>
|
|
@@ -518,7 +573,7 @@ view a org
|
|
|
518
573
|
|
|
519
574
|
```
|
|
520
575
|
USAGE
|
|
521
|
-
$ proca org get [ID_NAME_DXID] [--
|
|
576
|
+
$ proca org get [ID_NAME_DXID] [--json | --human | --csv] [--simplify] [-n <org
|
|
522
577
|
name>] [--config] [--keys] [--campaigns] [--widgets] [--users]
|
|
523
578
|
|
|
524
579
|
FLAGS
|
|
@@ -530,10 +585,10 @@ FLAGS
|
|
|
530
585
|
--[no-]widgets
|
|
531
586
|
|
|
532
587
|
OUTPUT FLAGS
|
|
533
|
-
--csv
|
|
534
|
-
--human
|
|
535
|
-
--json
|
|
536
|
-
--simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
588
|
+
--csv Format output as csv
|
|
589
|
+
--human Format output to be read on screen by a human [default]
|
|
590
|
+
--json Format output as json
|
|
591
|
+
--[no-]simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
537
592
|
|
|
538
593
|
DESCRIPTION
|
|
539
594
|
view a org
|
|
@@ -548,7 +603,7 @@ let a user join an organisation with a role
|
|
|
548
603
|
|
|
549
604
|
```
|
|
550
605
|
USAGE
|
|
551
|
-
$ proca org join -o <org name> [--
|
|
606
|
+
$ proca org join -o <org name> [--json | --human | --csv] [--simplify] [--user
|
|
552
607
|
<value>] [--role owner|campaigner|coordinator|translator]
|
|
553
608
|
|
|
554
609
|
FLAGS
|
|
@@ -558,10 +613,10 @@ FLAGS
|
|
|
558
613
|
--user=<value> user email
|
|
559
614
|
|
|
560
615
|
OUTPUT FLAGS
|
|
561
|
-
--csv
|
|
562
|
-
--human
|
|
563
|
-
--json
|
|
564
|
-
--simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
616
|
+
--csv Format output as csv
|
|
617
|
+
--human Format output to be read on screen by a human [default]
|
|
618
|
+
--json Format output as json
|
|
619
|
+
--[no-]simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
565
620
|
|
|
566
621
|
DESCRIPTION
|
|
567
622
|
let a user join an organisation with a role
|
|
@@ -860,46 +915,13 @@ DESCRIPTION
|
|
|
860
915
|
|
|
861
916
|
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.25/src/commands/plugins/update.ts)_
|
|
862
917
|
|
|
863
|
-
## `proca supporter count`
|
|
864
|
-
|
|
865
|
-
counter of supporters
|
|
866
|
-
|
|
867
|
-
```
|
|
868
|
-
USAGE
|
|
869
|
-
$ proca supporter count [ID_NAME_DXID] [--simplify [--json | --human | --csv]] [-i <value>
|
|
870
|
-
| -n <the_short_name> | -x <value>] [--org] [--area] [--number --without <value>]
|
|
871
|
-
|
|
872
|
-
FLAGS
|
|
873
|
-
-i, --id=<value>
|
|
874
|
-
-n, --name=<the_short_name> name
|
|
875
|
-
-x, --dxid=<value> dxid
|
|
876
|
-
--area segment by area
|
|
877
|
-
--number just return the number to add to the partner's counter
|
|
878
|
-
--org segment by partner
|
|
879
|
-
--without=<value> total to add to the partner's counter
|
|
880
|
-
|
|
881
|
-
OUTPUT FLAGS
|
|
882
|
-
--csv Format output as csv
|
|
883
|
-
--human Format output to be read on screen by a human [default]
|
|
884
|
-
--json Format output as json
|
|
885
|
-
--simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
886
|
-
|
|
887
|
-
DESCRIPTION
|
|
888
|
-
counter of supporters
|
|
889
|
-
|
|
890
|
-
EXAMPLES
|
|
891
|
-
$ proca supporter count --id <id of the campaign>
|
|
892
|
-
|
|
893
|
-
$ proca supporter count --name <name of the campaign>
|
|
894
|
-
```
|
|
895
|
-
|
|
896
918
|
## `proca user get`
|
|
897
919
|
|
|
898
920
|
fetch the information about a user
|
|
899
921
|
|
|
900
922
|
```
|
|
901
923
|
USAGE
|
|
902
|
-
$ proca user get [--
|
|
924
|
+
$ proca user get [--json | --human | --csv] [--simplify] [--email <value>] [-o <org
|
|
903
925
|
name>] [-i <value>]
|
|
904
926
|
|
|
905
927
|
FLAGS
|
|
@@ -908,10 +930,10 @@ FLAGS
|
|
|
908
930
|
--email=<value> user email
|
|
909
931
|
|
|
910
932
|
OUTPUT FLAGS
|
|
911
|
-
--csv
|
|
912
|
-
--human
|
|
913
|
-
--json
|
|
914
|
-
--simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
933
|
+
--csv Format output as csv
|
|
934
|
+
--human Format output to be read on screen by a human [default]
|
|
935
|
+
--json Format output as json
|
|
936
|
+
--[no-]simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
915
937
|
|
|
916
938
|
DESCRIPTION
|
|
917
939
|
fetch the information about a user
|
|
@@ -926,18 +948,18 @@ leave a org
|
|
|
926
948
|
|
|
927
949
|
```
|
|
928
950
|
USAGE
|
|
929
|
-
$ proca user leave --email <user email> -o <org name> [--
|
|
930
|
-
--
|
|
951
|
+
$ proca user leave --email <user email> -o <org name> [--json | --human | --csv]
|
|
952
|
+
[--simplify]
|
|
931
953
|
|
|
932
954
|
FLAGS
|
|
933
955
|
-o, --org=<org name> (required) name of the org
|
|
934
956
|
--email=<user email> (required) email
|
|
935
957
|
|
|
936
958
|
OUTPUT FLAGS
|
|
937
|
-
--csv
|
|
938
|
-
--human
|
|
939
|
-
--json
|
|
940
|
-
--simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
959
|
+
--csv Format output as csv
|
|
960
|
+
--human Format output to be read on screen by a human [default]
|
|
961
|
+
--json Format output as json
|
|
962
|
+
--[no-]simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
941
963
|
|
|
942
964
|
DESCRIPTION
|
|
943
965
|
leave a org
|
|
@@ -952,16 +974,16 @@ list all the users
|
|
|
952
974
|
|
|
953
975
|
```
|
|
954
976
|
USAGE
|
|
955
|
-
$ proca user list -o <value> [--
|
|
977
|
+
$ proca user list -o <value> [--json | --human | --csv] [--simplify]
|
|
956
978
|
|
|
957
979
|
FLAGS
|
|
958
980
|
-o, --org=<value> (required) organisation
|
|
959
981
|
|
|
960
982
|
OUTPUT FLAGS
|
|
961
|
-
--csv
|
|
962
|
-
--human
|
|
963
|
-
--json
|
|
964
|
-
--simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
983
|
+
--csv Format output as csv
|
|
984
|
+
--human Format output to be read on screen by a human [default]
|
|
985
|
+
--json Format output as json
|
|
986
|
+
--[no-]simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
965
987
|
|
|
966
988
|
DESCRIPTION
|
|
967
989
|
list all the users
|
|
@@ -974,7 +996,7 @@ EXAMPLES
|
|
|
974
996
|
|
|
975
997
|
```
|
|
976
998
|
USAGE
|
|
977
|
-
$ proca widget add -c <campaign name> [--
|
|
999
|
+
$ proca widget add -c <campaign name> [--json | --human | --csv] [--simplify] [-o
|
|
978
1000
|
<en>] [-l <en>] [-n by default <campaign>/<org>/<lang>]
|
|
979
1001
|
|
|
980
1002
|
FLAGS
|
|
@@ -984,10 +1006,40 @@ FLAGS
|
|
|
984
1006
|
-o, --org=<en> organisation
|
|
985
1007
|
|
|
986
1008
|
OUTPUT FLAGS
|
|
987
|
-
--csv
|
|
988
|
-
--human
|
|
989
|
-
--json
|
|
990
|
-
--simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
1009
|
+
--csv Format output as csv
|
|
1010
|
+
--human Format output to be read on screen by a human [default]
|
|
1011
|
+
--json Format output as json
|
|
1012
|
+
--[no-]simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
1013
|
+
```
|
|
1014
|
+
|
|
1015
|
+
## `proca widget cache`
|
|
1016
|
+
|
|
1017
|
+
clear the cdn cache of a widget
|
|
1018
|
+
|
|
1019
|
+
```
|
|
1020
|
+
USAGE
|
|
1021
|
+
$ proca widget cache [ID_NAME_DXID] [--json | --human | --csv] [--simplify] [-i <value>
|
|
1022
|
+
| -n <the_short_name> | -x <value>] [--url <value>]
|
|
1023
|
+
|
|
1024
|
+
FLAGS
|
|
1025
|
+
-i, --id=<value>
|
|
1026
|
+
-n, --name=<the_short_name> name
|
|
1027
|
+
-x, --dxid=<value> dxid
|
|
1028
|
+
--url=<value> url of the widget on the CDN
|
|
1029
|
+
|
|
1030
|
+
OUTPUT FLAGS
|
|
1031
|
+
--csv Format output as csv
|
|
1032
|
+
--human Format output to be read on screen by a human [default]
|
|
1033
|
+
--json Format output as json
|
|
1034
|
+
--[no-]simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
1035
|
+
|
|
1036
|
+
DESCRIPTION
|
|
1037
|
+
clear the cdn cache of a widget
|
|
1038
|
+
|
|
1039
|
+
EXAMPLES
|
|
1040
|
+
$ proca widget cache --url https://cdn.proca.app/d/[campaign]/[org]/[locale]
|
|
1041
|
+
|
|
1042
|
+
$ proca widget cache --name [campaign]/[org]/[locale]
|
|
991
1043
|
```
|
|
992
1044
|
|
|
993
1045
|
## `proca widget get`
|
|
@@ -996,7 +1048,7 @@ view a widget
|
|
|
996
1048
|
|
|
997
1049
|
```
|
|
998
1050
|
USAGE
|
|
999
|
-
$ proca widget get [ID_NAME_DXID] [--
|
|
1051
|
+
$ proca widget get [ID_NAME_DXID] [--json | --human | --csv] [--simplify] [-i <value>
|
|
1000
1052
|
| -n <the_short_name> | -x <value>] [--config]
|
|
1001
1053
|
|
|
1002
1054
|
FLAGS
|
|
@@ -1006,10 +1058,10 @@ FLAGS
|
|
|
1006
1058
|
--[no-]config display the config
|
|
1007
1059
|
|
|
1008
1060
|
OUTPUT FLAGS
|
|
1009
|
-
--csv
|
|
1010
|
-
--human
|
|
1011
|
-
--json
|
|
1012
|
-
--simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
1061
|
+
--csv Format output as csv
|
|
1062
|
+
--human Format output to be read on screen by a human [default]
|
|
1063
|
+
--json Format output as json
|
|
1064
|
+
--[no-]simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
1013
1065
|
|
|
1014
1066
|
DESCRIPTION
|
|
1015
1067
|
view a widget
|
|
@@ -1024,7 +1076,7 @@ list all the widgets of an org or campaign
|
|
|
1024
1076
|
|
|
1025
1077
|
```
|
|
1026
1078
|
USAGE
|
|
1027
|
-
$ proca widget list [--
|
|
1079
|
+
$ proca widget list [--json | --human | --csv] [--simplify] [-o <organisation name>]
|
|
1028
1080
|
[-c <campaign name>] [--config]
|
|
1029
1081
|
|
|
1030
1082
|
FLAGS
|
|
@@ -1033,10 +1085,10 @@ FLAGS
|
|
|
1033
1085
|
--[no-]config get the config
|
|
1034
1086
|
|
|
1035
1087
|
OUTPUT FLAGS
|
|
1036
|
-
--csv
|
|
1037
|
-
--human
|
|
1038
|
-
--json
|
|
1039
|
-
--simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
1088
|
+
--csv Format output as csv
|
|
1089
|
+
--human Format output to be read on screen by a human [default]
|
|
1090
|
+
--json Format output as json
|
|
1091
|
+
--[no-]simplify flatten and filter to output only the most important attributes, mostly relevant for json
|
|
1040
1092
|
|
|
1041
1093
|
DESCRIPTION
|
|
1042
1094
|
list all the widgets of an org or campaign
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from "#src/queries/campaign.mjs";
|
|
9
9
|
import { gql, query } from "#src/urql.mjs";
|
|
10
10
|
|
|
11
|
-
export default class
|
|
11
|
+
export default class List extends Command {
|
|
12
12
|
actionTypes = new Set();
|
|
13
13
|
|
|
14
14
|
static args = {
|
|
@@ -36,6 +36,16 @@ export default class CampaignList extends Command {
|
|
|
36
36
|
description: "max number of actions",
|
|
37
37
|
parse: (input) => Number.parseInt(input, 10),
|
|
38
38
|
}),
|
|
39
|
+
after: Flags.string({
|
|
40
|
+
description: "only actions after a date",
|
|
41
|
+
helpValue: "2025-04-09",
|
|
42
|
+
parse: (input) => new Date(input).toISOString(),
|
|
43
|
+
}),
|
|
44
|
+
today: Flags.boolean({
|
|
45
|
+
description: "only actions today",
|
|
46
|
+
exclusive: ["after"],
|
|
47
|
+
parse: (input) => `${new Date().toISOString().split("T")[0]}T00:00:00Z`,
|
|
48
|
+
}),
|
|
39
49
|
optin: Flags.boolean({
|
|
40
50
|
description: "only export the optin actions",
|
|
41
51
|
default: false,
|
|
@@ -52,6 +62,13 @@ export default class CampaignList extends Command {
|
|
|
52
62
|
description: "display the utm tracking parameters",
|
|
53
63
|
default: true,
|
|
54
64
|
allowNo: true,
|
|
65
|
+
exclusive: ["simplify"],
|
|
66
|
+
}),
|
|
67
|
+
comment: Flags.boolean({
|
|
68
|
+
description: "display the comment",
|
|
69
|
+
default: true,
|
|
70
|
+
allowNo: true,
|
|
71
|
+
exclusive: ["simplify"],
|
|
55
72
|
}),
|
|
56
73
|
};
|
|
57
74
|
|
|
@@ -68,7 +85,7 @@ export default class CampaignList extends Command {
|
|
|
68
85
|
$orgName: String!
|
|
69
86
|
$start: Int
|
|
70
87
|
) {
|
|
71
|
-
|
|
88
|
+
actions (
|
|
72
89
|
after: $after
|
|
73
90
|
campaignId: $campaignId
|
|
74
91
|
campaignName: $campaignName
|
|
@@ -114,8 +131,7 @@ export default class CampaignList extends Command {
|
|
|
114
131
|
}
|
|
115
132
|
}
|
|
116
133
|
`;
|
|
117
|
-
|
|
118
|
-
const variables = {
|
|
134
|
+
const result = await query(Document, {
|
|
119
135
|
after: flags.after,
|
|
120
136
|
// "campaignId": 42,
|
|
121
137
|
campaignName: flags.campaign,
|
|
@@ -125,11 +141,8 @@ export default class CampaignList extends Command {
|
|
|
125
141
|
onlyOptIn: flags.optin,
|
|
126
142
|
orgName: flags.org,
|
|
127
143
|
start: flags.start,
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
const result = await query(Document, variables);
|
|
131
|
-
console.log("result", result);
|
|
132
|
-
return result.exportActions.map((d) => {
|
|
144
|
+
});
|
|
145
|
+
return result.actions.map((d) => {
|
|
133
146
|
d.customFields = JSON.parse(d.customFields);
|
|
134
147
|
if (!d.contact.publicKey) {
|
|
135
148
|
const ref = d.contactRef;
|
|
@@ -151,14 +164,15 @@ export default class CampaignList extends Command {
|
|
|
151
164
|
firstname: d.contact.firstName,
|
|
152
165
|
country: d.contact.country,
|
|
153
166
|
email: d.contact.email,
|
|
154
|
-
widget: d.actionPage.name,
|
|
155
167
|
type: d.actionType,
|
|
156
168
|
date: d.createdAt,
|
|
157
169
|
campaign: d.campaign.name,
|
|
158
170
|
widget_id: d.actionPage.id,
|
|
171
|
+
widget: d.actionPage.name,
|
|
159
172
|
// customFields
|
|
160
173
|
};
|
|
161
|
-
if (
|
|
174
|
+
if (this.flags.comment && d.customFields?.comment)
|
|
175
|
+
result.comment = d.customFields.comment;
|
|
162
176
|
if (d.customFields?.emailProvider)
|
|
163
177
|
result.provider = d.customFields.emailProvider;
|
|
164
178
|
if (this.flags.utm && d.tracking) {
|
|
@@ -181,9 +195,10 @@ export default class CampaignList extends Command {
|
|
|
181
195
|
|
|
182
196
|
async run() {
|
|
183
197
|
const { args, flags } = await this.parse();
|
|
198
|
+
if (flags.today) flags.after = flags.today;
|
|
184
199
|
let data = [];
|
|
185
200
|
|
|
186
201
|
data = await this.fetch(flags);
|
|
187
|
-
|
|
202
|
+
return this.output(data);
|
|
188
203
|
}
|
|
189
204
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import crypto from "node:crypto";
|
|
2
|
+
import { Args, Flags } from "@oclif/core";
|
|
3
|
+
import { error, stdout, ux } from "@oclif/core/ux";
|
|
4
|
+
import Command from "#src/procaCommand.mjs";
|
|
5
|
+
|
|
6
|
+
export default class UserList extends Command {
|
|
7
|
+
static description = "convert between token and sql value";
|
|
8
|
+
|
|
9
|
+
static flags = {
|
|
10
|
+
token: Flags.string({
|
|
11
|
+
exactlyOne: ["token"],
|
|
12
|
+
description: "the token in your config",
|
|
13
|
+
helpValue: "API-xxx",
|
|
14
|
+
}),
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
async run() {
|
|
18
|
+
const { args, flags } = await this.parse();
|
|
19
|
+
if (flags.token) {
|
|
20
|
+
const token = flags.token
|
|
21
|
+
.replace("API-", "")
|
|
22
|
+
.replace(/-/g, "+")
|
|
23
|
+
.replace(/_/g, "/");
|
|
24
|
+
const decoded = Buffer.from(token, "base64").toString("utf-8");
|
|
25
|
+
const hexa = crypto.createHash("sha256").update(decoded).digest("hex");
|
|
26
|
+
console.log(token, decoded, hexa);
|
|
27
|
+
|
|
28
|
+
return this.output({ hexa: `\\x${hexa}` });
|
|
29
|
+
}
|
|
30
|
+
const data = flags;
|
|
31
|
+
|
|
32
|
+
return this.output(data);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { Args, Flags } from "@oclif/core";
|
|
2
|
+
import { error, stdout, ux } from "@oclif/core/ux";
|
|
3
|
+
import Command from "#src/procaCommand.mjs";
|
|
4
|
+
import {
|
|
5
|
+
FragmentOrg,
|
|
6
|
+
FragmentStats,
|
|
7
|
+
FragmentSummary,
|
|
8
|
+
} from "#src/queries/campaign.mjs";
|
|
9
|
+
import { gql, query } from "#src/urql.mjs";
|
|
10
|
+
|
|
11
|
+
export default class List extends Command {
|
|
12
|
+
actionTypes = new Set();
|
|
13
|
+
|
|
14
|
+
static args = {
|
|
15
|
+
title: Args.string({ description: "name of the campaign, % for wildchar" }),
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
static examples = ["<%= config.bin %> <%= command.id %> %pizza%"];
|
|
19
|
+
|
|
20
|
+
static flags = {
|
|
21
|
+
// flag with no value (-f, --force)
|
|
22
|
+
...super.globalFlags,
|
|
23
|
+
org: Flags.string({
|
|
24
|
+
char: "o",
|
|
25
|
+
description: "campaigns of the organisation (coordinator or partner)",
|
|
26
|
+
required: true,
|
|
27
|
+
// exactlyOne: ["org", "title"],
|
|
28
|
+
helpValue: "<organisation name>",
|
|
29
|
+
}),
|
|
30
|
+
campaign: Flags.string({
|
|
31
|
+
char: "c",
|
|
32
|
+
description: "name of the campaign, % for wildchar",
|
|
33
|
+
helpValue: "<campaign title>",
|
|
34
|
+
}),
|
|
35
|
+
limit: Flags.string({
|
|
36
|
+
description: "max number of actions",
|
|
37
|
+
parse: (input) => Number.parseInt(input, 10),
|
|
38
|
+
}),
|
|
39
|
+
after: Flags.string({
|
|
40
|
+
description: "only actions after a date",
|
|
41
|
+
helpValue: "2025-04-09",
|
|
42
|
+
parse: (input) => new Date(input).toISOString(),
|
|
43
|
+
}),
|
|
44
|
+
today: Flags.boolean({
|
|
45
|
+
description: "only actions today",
|
|
46
|
+
exclusive: ["after"],
|
|
47
|
+
parse: (input) => `${new Date().toISOString().split("T")[0]}T00:00:00Z`,
|
|
48
|
+
}),
|
|
49
|
+
optin: Flags.boolean({
|
|
50
|
+
description: "only export the optin actions",
|
|
51
|
+
default: false,
|
|
52
|
+
}),
|
|
53
|
+
testing: Flags.boolean({
|
|
54
|
+
description: "also export the test actions",
|
|
55
|
+
default: false,
|
|
56
|
+
}),
|
|
57
|
+
doi: Flags.boolean({
|
|
58
|
+
description: "only export the double optin actions",
|
|
59
|
+
default: false,
|
|
60
|
+
}),
|
|
61
|
+
utm: Flags.boolean({
|
|
62
|
+
description: "display the utm tracking parameters",
|
|
63
|
+
default: true,
|
|
64
|
+
allowNo: true,
|
|
65
|
+
exclusive: ["simplify"],
|
|
66
|
+
}),
|
|
67
|
+
comment: Flags.boolean({
|
|
68
|
+
description: "display the comment",
|
|
69
|
+
default: true,
|
|
70
|
+
allowNo: true,
|
|
71
|
+
exclusive: ["simplify"],
|
|
72
|
+
}),
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
fetch = async (flags) => {
|
|
76
|
+
const Document = gql`
|
|
77
|
+
query (
|
|
78
|
+
$after: DateTime
|
|
79
|
+
$campaignId: Int
|
|
80
|
+
$campaignName: String
|
|
81
|
+
$includeTesting: Boolean
|
|
82
|
+
$limit: Int
|
|
83
|
+
$onlyDoubleOptIn: Boolean
|
|
84
|
+
$onlyOptIn: Boolean
|
|
85
|
+
$orgName: String!
|
|
86
|
+
$start: Int
|
|
87
|
+
) {
|
|
88
|
+
contacts(
|
|
89
|
+
after: $after
|
|
90
|
+
campaignId: $campaignId
|
|
91
|
+
campaignName: $campaignName
|
|
92
|
+
includeTesting: $includeTesting
|
|
93
|
+
limit: $limit
|
|
94
|
+
onlyDoubleOptIn: $onlyDoubleOptIn
|
|
95
|
+
onlyOptIn: $onlyOptIn
|
|
96
|
+
orgName: $orgName
|
|
97
|
+
start: $start
|
|
98
|
+
) {
|
|
99
|
+
actionId
|
|
100
|
+
actionPage {
|
|
101
|
+
locale
|
|
102
|
+
name
|
|
103
|
+
}
|
|
104
|
+
actionType
|
|
105
|
+
campaign {
|
|
106
|
+
name
|
|
107
|
+
}
|
|
108
|
+
contact {
|
|
109
|
+
contactRef
|
|
110
|
+
payload
|
|
111
|
+
nonce
|
|
112
|
+
publicKey {
|
|
113
|
+
public
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
createdAt
|
|
117
|
+
customFields
|
|
118
|
+
privacy {
|
|
119
|
+
emailStatus
|
|
120
|
+
emailStatusChanged
|
|
121
|
+
givenAt
|
|
122
|
+
optIn
|
|
123
|
+
withConsent
|
|
124
|
+
}
|
|
125
|
+
tracking {
|
|
126
|
+
campaign
|
|
127
|
+
content
|
|
128
|
+
medium
|
|
129
|
+
source
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
`;
|
|
134
|
+
const result = await query(Document, {
|
|
135
|
+
after: flags.after,
|
|
136
|
+
// "campaignId": 42,
|
|
137
|
+
campaignName: flags.campaign,
|
|
138
|
+
includeTesting: flags.testing,
|
|
139
|
+
limit: flags.limit,
|
|
140
|
+
onlyDoubleOptIn: flags.doi,
|
|
141
|
+
onlyOptIn: flags.optin,
|
|
142
|
+
orgName: flags.org,
|
|
143
|
+
start: flags.start,
|
|
144
|
+
});
|
|
145
|
+
return result.contacts.map((d) => {
|
|
146
|
+
d.customFields = JSON.parse(d.customFields);
|
|
147
|
+
if (!d.contact.publicKey) {
|
|
148
|
+
const ref = d.contactRef;
|
|
149
|
+
d.contact = JSON.parse(d.contact.payload);
|
|
150
|
+
d.contact.contactRef = ref;
|
|
151
|
+
} else {
|
|
152
|
+
this.error(
|
|
153
|
+
`encrypted contact we need the private key for ${d.contact.publicKey.public}`,
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
return d;
|
|
157
|
+
});
|
|
158
|
+
// return result.exportActions;
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
simplify = (d) => {
|
|
162
|
+
const result = {
|
|
163
|
+
id: d.actionId,
|
|
164
|
+
firstname: d.contact.firstName,
|
|
165
|
+
country: d.contact.country,
|
|
166
|
+
email: d.contact.email,
|
|
167
|
+
type: d.actionType,
|
|
168
|
+
date: d.createdAt,
|
|
169
|
+
campaign: d.campaign.name,
|
|
170
|
+
widget_id: d.actionPage.id,
|
|
171
|
+
widget: d.actionPage.name,
|
|
172
|
+
// customFields
|
|
173
|
+
};
|
|
174
|
+
if (this.flags.comment && d.customFields?.comment)
|
|
175
|
+
result.comment = d.customFields.comment;
|
|
176
|
+
if (d.customFields?.emailProvider)
|
|
177
|
+
result.provider = d.customFields.emailProvider;
|
|
178
|
+
if (this.flags.utm && d.tracking) {
|
|
179
|
+
result.utm_medium =
|
|
180
|
+
d.tracking.medium === "unknown" ? undefined : d.tracking.medium;
|
|
181
|
+
result.utm_source =
|
|
182
|
+
d.tracking.source === "unknown" ? undefined : d.tracking.source;
|
|
183
|
+
result.utm_campaign =
|
|
184
|
+
d.tracking.campaign === "unknown" ? undefined : d.tracking.campaign;
|
|
185
|
+
if (d.tracking.content)
|
|
186
|
+
result.utm_content =
|
|
187
|
+
d.tracking.content === "unknown" ? undefined : d.tracking.content;
|
|
188
|
+
}
|
|
189
|
+
return result;
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
_table = (r) => {
|
|
193
|
+
super.table(r, null, (table) => table.sort(["id|des"]).toString());
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
async run() {
|
|
197
|
+
const { args, flags } = await this.parse();
|
|
198
|
+
if (flags.today) flags.after = flags.today;
|
|
199
|
+
let data = [];
|
|
200
|
+
|
|
201
|
+
data = await this.fetch(flags);
|
|
202
|
+
return this.output(data);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Args, Flags } from "@oclif/core";
|
|
2
|
+
import { error, stdout, ux } from "@oclif/core/ux";
|
|
3
|
+
import Command from "#src/procaCommand.mjs";
|
|
4
|
+
import { FragmentSummary } from "#src/queries/widget.mjs";
|
|
5
|
+
import { gql, query } from "#src/urql.mjs";
|
|
6
|
+
|
|
7
|
+
export default class WidgetGet extends Command {
|
|
8
|
+
static description = "clear the cdn cache of a widget";
|
|
9
|
+
|
|
10
|
+
static examples = [
|
|
11
|
+
"<%= config.bin %> <%= command.id %> --url https://cdn.proca.app/d/[campaign]/[org]/[locale]",
|
|
12
|
+
"<%= config.bin %> <%= command.id %> --name [campaign]/[org]/[locale]",
|
|
13
|
+
];
|
|
14
|
+
static args = this.multiid();
|
|
15
|
+
|
|
16
|
+
static flags = {
|
|
17
|
+
// flag with no value (-f, --force)
|
|
18
|
+
...this.flagify({ multiid: true }),
|
|
19
|
+
url: Flags.string ({
|
|
20
|
+
description: "url of the widget on the CDN",
|
|
21
|
+
}),
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
async run() {
|
|
25
|
+
const { args, flags } = await this.parse();
|
|
26
|
+
console.log(flags);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
package/src/procaCommand.mjs
CHANGED
|
@@ -31,7 +31,7 @@ class ProcaCommand extends Command {
|
|
|
31
31
|
helpGroup: "OUTPUT",
|
|
32
32
|
description:
|
|
33
33
|
"flatten and filter to output only the most important attributes, mostly relevant for json",
|
|
34
|
-
|
|
34
|
+
allowNo: true,
|
|
35
35
|
}),
|
|
36
36
|
};
|
|
37
37
|
|
|
@@ -112,6 +112,19 @@ class ProcaCommand extends Command {
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
+
flatten = (obj, prefix = "", result = {}) => {
|
|
116
|
+
Object.entries(obj).forEach(([k, v]) => {
|
|
117
|
+
const newKey = Object.hasOwn(result, k) && prefix ? `${prefix}-${k}` : k;
|
|
118
|
+
|
|
119
|
+
if (v?.constructor === Object) {
|
|
120
|
+
this.flatten(v, newKey, result);
|
|
121
|
+
} else {
|
|
122
|
+
result[newKey] = v;
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
return result;
|
|
126
|
+
};
|
|
127
|
+
|
|
115
128
|
simplify = (d) => {
|
|
116
129
|
const r = {};
|
|
117
130
|
for (const [key, value] of Object.entries(d)) {
|
|
@@ -159,10 +172,13 @@ class ProcaCommand extends Command {
|
|
|
159
172
|
async csv(data) {
|
|
160
173
|
return new Promise((resolve, reject) => {
|
|
161
174
|
let d = null;
|
|
175
|
+
const format = this.flags.simplify
|
|
176
|
+
? this.simplify
|
|
177
|
+
: (d) => this.flatten(d, "");
|
|
162
178
|
if (Array.isArray(data)) {
|
|
163
|
-
d = data.map(
|
|
179
|
+
d = data.map(format);
|
|
164
180
|
} else {
|
|
165
|
-
d = [
|
|
181
|
+
d = [format(data)];
|
|
166
182
|
}
|
|
167
183
|
const stream = fastcsv
|
|
168
184
|
.write(d, { headers: true })
|
|
@@ -178,11 +194,19 @@ class ProcaCommand extends Command {
|
|
|
178
194
|
|
|
179
195
|
table(data, transformRow, print = (table) => table.toString()) {
|
|
180
196
|
if (!transformRow) {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
197
|
+
if (this.flags.simplify !== false) {
|
|
198
|
+
transformRow = (d, cell) => {
|
|
199
|
+
for (const [key, value] of Object.entries(this.simplify(d))) {
|
|
200
|
+
cell(key, value);
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
} else {
|
|
204
|
+
transformRow = (d, cell) => {
|
|
205
|
+
for (const [key, value] of Object.entries(this.flatten(d))) {
|
|
206
|
+
cell(key, value);
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
}
|
|
186
210
|
}
|
|
187
211
|
const theme = this.config.theme;
|
|
188
212
|
Table.prototype.pushDelimeter = function (cols) {
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { Args, Flags } from "@oclif/core";
|
|
2
|
-
import Command from "#src/procaCommand.mjs";
|
|
3
|
-
import { gql, query } from "#src/urql.mjs";
|
|
4
|
-
|
|
5
|
-
export default class CounterGet extends Command {
|
|
6
|
-
static description = "counter of supporters";
|
|
7
|
-
|
|
8
|
-
static examples = [
|
|
9
|
-
"<%= config.bin %> <%= command.id %> --id <id of the campaign>",
|
|
10
|
-
"<%= config.bin %> <%= command.id %> --name <name of the campaign>",
|
|
11
|
-
];
|
|
12
|
-
|
|
13
|
-
static args = this.multiid();
|
|
14
|
-
static flags = {
|
|
15
|
-
// flag with no value (-f, --force)
|
|
16
|
-
...this.flagify({ multiid: true }),
|
|
17
|
-
org: Flags.boolean({
|
|
18
|
-
description: "segment by partner",
|
|
19
|
-
default: false,
|
|
20
|
-
}),
|
|
21
|
-
area: Flags.boolean({
|
|
22
|
-
description: "segment by area",
|
|
23
|
-
default: false,
|
|
24
|
-
}),
|
|
25
|
-
without: Flags.string({
|
|
26
|
-
description: "total to add to the partner's counter",
|
|
27
|
-
}),
|
|
28
|
-
number: Flags.boolean({
|
|
29
|
-
description: "just return the number to add to the partner's counter",
|
|
30
|
-
dependsOn: ["without"],
|
|
31
|
-
}),
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
fetchExcluding = async (params) => {
|
|
35
|
-
const GetCounterDocument = gql`
|
|
36
|
-
query GetCounter($name: String, $id: Int, $without: String!) {
|
|
37
|
-
campaign(name: $name, id: $id) {
|
|
38
|
-
stats {
|
|
39
|
-
supporterCount
|
|
40
|
-
supporterCountByOthers (orgName: $without)
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}`;
|
|
44
|
-
|
|
45
|
-
const result = await query(GetCounterDocument, params);
|
|
46
|
-
return result.campaign.stats;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
fetch = async (params) => {
|
|
50
|
-
const GetCounterDocument = gql`
|
|
51
|
-
query GetCounter($name: String, $id: Int, $org: Boolean = false, $area: Boolean = false) {
|
|
52
|
-
campaign(name: $name, id: $id) {
|
|
53
|
-
stats {
|
|
54
|
-
supporterCount
|
|
55
|
-
supporterCountByOrg @include(if: $org) { org { name } count }
|
|
56
|
-
supporterCountByArea @include(if: $area) { area count }
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}`;
|
|
60
|
-
|
|
61
|
-
const result = await query(GetCounterDocument, params);
|
|
62
|
-
return result.campaign.stats;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
simplify = (d) => {
|
|
66
|
-
const result = { total: d.supporterCount };
|
|
67
|
-
d.supporterCountByOrg
|
|
68
|
-
?.sort((a, b) => b.count - a.count)
|
|
69
|
-
.forEach((org) => {
|
|
70
|
-
result[org.org.name] = org.count;
|
|
71
|
-
});
|
|
72
|
-
d.supporterCountByArea
|
|
73
|
-
?.sort((a, b) => b.count - a.count)
|
|
74
|
-
.forEach((area) => {
|
|
75
|
-
result[area.area] = area.count;
|
|
76
|
-
});
|
|
77
|
-
if (d.supporterCountByOthers) {
|
|
78
|
-
result[`without ${this.flags.without}`] = d.supporterCountByOthers;
|
|
79
|
-
}
|
|
80
|
-
return result;
|
|
81
|
-
};
|
|
82
|
-
table = (r) => {
|
|
83
|
-
super.table(r, null, null);
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
async run() {
|
|
87
|
-
const { args, flags } = await this.parse();
|
|
88
|
-
if (flags.without) {
|
|
89
|
-
const data = await this.fetchExcluding(flags);
|
|
90
|
-
if (flags.number) return console.log(data.supporterCountByOthers);
|
|
91
|
-
return this.output(data);
|
|
92
|
-
}
|
|
93
|
-
const data = await this.fetch(flags);
|
|
94
|
-
return this.output(data);
|
|
95
|
-
}
|
|
96
|
-
}
|