@proca/cli 3.3.1 → 3.8.3
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 +1992 -60
- package/package.json +88 -71
- package/proca-cli +8 -0
- package/src/commands/action/add.mjs +192 -0
- package/src/commands/action/confirm.mjs +93 -0
- package/src/commands/action/count.mjs +61 -0
- package/src/commands/action/list.mjs +204 -0
- package/src/commands/action/replay.mjs +56 -0
- package/src/commands/action/requeue.mjs +156 -0
- package/src/commands/campaign/add.mjs +113 -0
- package/src/commands/campaign/copy.mjs +91 -0
- package/src/commands/campaign/delete.mjs +41 -0
- package/src/commands/campaign/get.mjs +132 -0
- package/src/commands/campaign/list.mjs +161 -0
- package/src/commands/campaign/mtt.mjs +131 -0
- package/src/commands/campaign/queries.graphql +19 -0
- package/src/commands/campaign/status.mjs +63 -0
- package/src/commands/campaign/widget/archive.mjs +124 -0
- package/src/commands/campaign/widget/copy.mjs +175 -0
- package/src/commands/campaign/widget/get.mjs +19 -0
- package/src/commands/campaign/widget/index.mjs +17 -0
- package/src/commands/campaign/widget/rebuild.mjs +50 -0
- package/src/commands/config/add.mjs +97 -0
- package/src/commands/config/folder.mjs +42 -0
- package/src/commands/config/server.mjs +33 -0
- package/src/commands/config/set.mjs +103 -0
- package/src/commands/config/user.mjs +79 -0
- package/src/commands/contact/count.mjs +41 -0
- package/src/commands/contact/list.mjs +207 -0
- package/src/commands/org/add.mjs +75 -0
- package/src/commands/org/crm.mjs +88 -0
- package/src/commands/org/delete.mjs +48 -0
- package/src/commands/org/email.mjs +111 -0
- package/src/commands/org/get.mjs +152 -0
- package/src/commands/service/add.mjs +78 -0
- package/src/commands/service/list.mjs +24 -0
- package/src/commands/target/add.mjs +94 -0
- package/src/commands/template/add.mjs +97 -0
- package/src/commands/template/list.mjs +61 -0
- package/src/commands/user/get.mjs +91 -0
- package/src/commands/user/invite.mjs +56 -0
- package/src/commands/user/join.mjs +81 -0
- package/src/commands/user/leave.mjs +57 -0
- package/src/commands/user/list.mjs +80 -0
- package/src/commands/user/reset.mjs +83 -0
- package/src/commands/widget/add.mjs +116 -0
- package/src/commands/widget/delete.mjs +45 -0
- package/src/commands/widget/get.mjs +60 -0
- package/src/commands/widget/list.mjs +135 -0
- package/src/commands/widget/rebuild.mjs +64 -0
- package/src/commands/widget/update.mjs +174 -0
- package/src/config.mjs +49 -0
- package/src/generated/schema.json +10677 -0
- package/src/hooks/help.mjs +14 -0
- package/src/hooks/init.mjs +41 -0
- package/src/index.mjs +1 -0
- package/src/procaCommand.mjs +316 -0
- package/src/queries/campaign.mjs +35 -0
- package/src/queries/widget.mjs +25 -0
- package/src/urql.mjs +60 -0
- package/src/util/twitter.mjs +23 -0
- package/theme.json +29 -0
- package/LICENSE +0 -661
- package/bin/proca-cli +0 -4
- package/dist/a.d.ts +0 -1
- package/dist/a.js +0 -21
- package/dist/a.js.map +0 -1
- package/dist/browser.d.ts +0 -1
- package/dist/browser.js +0 -24
- package/dist/browser.js.map +0 -1
- package/dist/campaign.d.ts +0 -156
- package/dist/campaign.js +0 -188
- package/dist/campaign.js.map +0 -1
- package/dist/cli.d.ts +0 -40
- package/dist/cli.js +0 -411
- package/dist/cli.js.map +0 -1
- package/dist/client.d.ts +0 -2
- package/dist/client.js +0 -18
- package/dist/client.js.map +0 -1
- package/dist/config.d.ts +0 -35
- package/dist/config.js +0 -71
- package/dist/config.js.map +0 -1
- package/dist/crypto.d.ts +0 -40
- package/dist/crypto.js +0 -53
- package/dist/crypto.js.map +0 -1
- package/dist/decrypt.d.ts +0 -7
- package/dist/decrypt.js +0 -29
- package/dist/decrypt.js.map +0 -1
- package/dist/export.d.ts +0 -15
- package/dist/export.js +0 -141
- package/dist/export.js.map +0 -1
- package/dist/format.d.ts +0 -37
- package/dist/format.js +0 -200
- package/dist/format.js.map +0 -1
- package/dist/index.d.ts +0 -8
- package/dist/index.js +0 -35
- package/dist/index.js.map +0 -1
- package/dist/keys.d.ts +0 -4
- package/dist/keys.js +0 -38
- package/dist/keys.js.map +0 -1
- package/dist/org.d.ts +0 -11
- package/dist/org.js +0 -93
- package/dist/org.js.map +0 -1
- package/dist/proca.d.ts +0 -2066
- package/dist/proca.js +0 -396
- package/dist/proca.js.map +0 -1
- package/dist/queue.d.ts +0 -8
- package/dist/queue.js +0 -126
- package/dist/queue.js.map +0 -1
- package/dist/queueMessage.d.ts +0 -102
- package/dist/queueMessage.js +0 -109
- package/dist/queueMessage.js.map +0 -1
- package/dist/scalarLocations.d.ts +0 -4
- package/dist/scalarLocations.js +0 -236
- package/dist/scalarLocations.js.map +0 -1
- package/dist/service/actionnetwork.d.ts +0 -10
- package/dist/service/actionnetwork.js +0 -302
- package/dist/service/actionnetwork.js.map +0 -1
- package/dist/service/distance.d.ts +0 -3
- package/dist/service/distance.js +0 -92
- package/dist/service/distance.js.map +0 -1
- package/dist/service/echo.d.ts +0 -4
- package/dist/service/echo.js +0 -19
- package/dist/service/echo.js.map +0 -1
- package/dist/service/email.d.ts +0 -14
- package/dist/service/email.js +0 -67
- package/dist/service/email.js.map +0 -1
- package/dist/service/identity.d.ts +0 -58
- package/dist/service/identity.js +0 -190
- package/dist/service/identity.js.map +0 -1
- package/dist/service/index.d.ts +0 -14
- package/dist/service/index.js +0 -61
- package/dist/service/index.js.map +0 -1
- package/dist/setup.d.ts +0 -2
- package/dist/setup.js +0 -287
- package/dist/setup.js.map +0 -1
- package/dist/test.d.ts +0 -1
- package/dist/test.js +0 -33
- package/dist/test.js.map +0 -1
- package/dist/util.d.ts +0 -5
- package/dist/util.js +0 -30
- package/dist/util.js.map +0 -1
- package/dist/watch.d.ts +0 -9
- package/dist/watch.js +0 -76
- package/dist/watch.js.map +0 -1
package/dist/cli.js
DELETED
|
@@ -1,411 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const yargs_1 = __importDefault(require("yargs"));
|
|
7
|
-
const config_1 = require("./config");
|
|
8
|
-
const campaign_1 = require("./campaign");
|
|
9
|
-
const org_1 = require("./org");
|
|
10
|
-
const export_1 = require("./export");
|
|
11
|
-
const queue_1 = require("./queue");
|
|
12
|
-
const setup_1 = require("./setup");
|
|
13
|
-
const util_1 = require("./util");
|
|
14
|
-
const watch_1 = require("./watch");
|
|
15
|
-
function cli() {
|
|
16
|
-
const config = config_1.load();
|
|
17
|
-
function override(short, desc, def) {
|
|
18
|
-
return {
|
|
19
|
-
alias: short,
|
|
20
|
-
type: "string",
|
|
21
|
-
describe: desc,
|
|
22
|
-
default: def
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
function cmd(cliMethod) {
|
|
26
|
-
return (opts) => {
|
|
27
|
-
// back propagate the overriding of options
|
|
28
|
-
// this might not be right but we have a two way flow:
|
|
29
|
-
// the opts take defaults from config, but if set, they can override back the config
|
|
30
|
-
config_1.overrideConfig(config, {
|
|
31
|
-
queue_url: opts.queue,
|
|
32
|
-
keyData: opts.keys,
|
|
33
|
-
url: opts.host,
|
|
34
|
-
username: opts.user,
|
|
35
|
-
password: opts.password,
|
|
36
|
-
org: opts.org
|
|
37
|
-
});
|
|
38
|
-
if (opts.sentry) {
|
|
39
|
-
if (process.env.SENTRY_DSN) {
|
|
40
|
-
try {
|
|
41
|
-
const Sentry = require("@sentry/node");
|
|
42
|
-
Sentry.init({
|
|
43
|
-
dsn: process.env.SENTRY_DSN
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
catch (_a) {
|
|
47
|
-
opts.sentry = false;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
opts.sentry = false;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
cliMethod(opts, config).catch((error) => {
|
|
55
|
-
if (process.env['DEBUG'])
|
|
56
|
-
throw error;
|
|
57
|
-
if (error.message) {
|
|
58
|
-
console.error(`Error:`, error.message);
|
|
59
|
-
}
|
|
60
|
-
else if (error.length > 0 && error[0].message) {
|
|
61
|
-
const { message, path, extensions } = error[0];
|
|
62
|
-
console.error(`Error:`, message);
|
|
63
|
-
if (path && path[0] == 'org') {
|
|
64
|
-
console.error(`Do you belong to the team of org "${config.org}" and have proper permissions?`);
|
|
65
|
-
}
|
|
66
|
-
if (extensions && extensions.code == 'permission_denied') {
|
|
67
|
-
console.error(`Needed permissions are: ${extensions.required}`);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
console.error(error);
|
|
72
|
-
}
|
|
73
|
-
if (error.result && error.result.error && error.result.error.length > 0) {
|
|
74
|
-
const { message, extensions, path } = error.result.error[0];
|
|
75
|
-
console.error(message
|
|
76
|
-
+ (extensions && extensions.code ? `, code: ${extensions.code}` : ``)
|
|
77
|
-
+ (path ? `, path: ${path}` : ``));
|
|
78
|
-
}
|
|
79
|
-
if (opts.debug && error.stack) {
|
|
80
|
-
console.error(`The call trace that led to this error is:\n${error.stack}`);
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
function validateIso8601Date(val) {
|
|
86
|
-
if (!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(Z|[+-]\d{2}:\d{2})$/.test(val)) {
|
|
87
|
-
throw new Error("Provide a date time in ISO8601 format (YYYY-MM-DDThh:mm:ssZ or TZ shift instead of Z, eg:+01:00)");
|
|
88
|
-
}
|
|
89
|
-
return val;
|
|
90
|
-
}
|
|
91
|
-
const argv = yargs_1.default
|
|
92
|
-
.scriptName('proca-cli')
|
|
93
|
-
.command(['setup', '$0'], 'configure proca CLI (generates .env, keys.json files)', {}, cmd(setup_1.setup))
|
|
94
|
-
.option('debug', {
|
|
95
|
-
alias: 'D',
|
|
96
|
-
type: 'boolean',
|
|
97
|
-
default: false,
|
|
98
|
-
describe: 'Enable troubleshooting information'
|
|
99
|
-
})
|
|
100
|
-
.option('sentry', {
|
|
101
|
-
alias: 'S',
|
|
102
|
-
type: 'boolean',
|
|
103
|
-
default: false,
|
|
104
|
-
describe: 'Report to sentry (set SENTRY_DSN)'
|
|
105
|
-
})
|
|
106
|
-
.option('org', override('o', 'org name', config.org))
|
|
107
|
-
.option('user', override('u', 'user name', config.username))
|
|
108
|
-
.option('password', override('p', 'password', config.password))
|
|
109
|
-
.option('host', override('h', 'api url', config.url))
|
|
110
|
-
.option('queue', override('q', 'queue url', config.queue_url))
|
|
111
|
-
.option('keys', override('k', 'file containing keys', config.keyData))
|
|
112
|
-
.option('json', {
|
|
113
|
-
alias: 'J',
|
|
114
|
-
type: 'boolean',
|
|
115
|
-
describe: 'Format output in JSON',
|
|
116
|
-
default: false
|
|
117
|
-
})
|
|
118
|
-
.option('indent', {
|
|
119
|
-
type: 'number',
|
|
120
|
-
describe: 'Indent in JSON formatting',
|
|
121
|
-
default: 2
|
|
122
|
-
})
|
|
123
|
-
.option('csv', {
|
|
124
|
-
alias: 'X',
|
|
125
|
-
type: 'boolean',
|
|
126
|
-
describe: 'Format output in CSV',
|
|
127
|
-
default: false
|
|
128
|
-
})
|
|
129
|
-
.command('token', 'print basic auth token', {}, cmd(util_1.showToken))
|
|
130
|
-
.command('org:add', 'add a new organisation', {
|
|
131
|
-
name: {
|
|
132
|
-
alias: 'n',
|
|
133
|
-
type: 'string',
|
|
134
|
-
description: 'Name of campaign',
|
|
135
|
-
demandOption: true
|
|
136
|
-
},
|
|
137
|
-
schema: {
|
|
138
|
-
alias: 's',
|
|
139
|
-
type: 'string',
|
|
140
|
-
description: 'Member personal data schema',
|
|
141
|
-
choices: ['basic', 'popular_initiative', 'eci'],
|
|
142
|
-
default: 'basic'
|
|
143
|
-
},
|
|
144
|
-
title: {
|
|
145
|
-
alias: 't',
|
|
146
|
-
type: 'string',
|
|
147
|
-
description: 'Full org name',
|
|
148
|
-
demandOption: true
|
|
149
|
-
}
|
|
150
|
-
}, cmd(org_1.addOrg))
|
|
151
|
-
.command('campaigns', 'List campaigns for org', {}, cmd(campaign_1.listCampaigns))
|
|
152
|
-
.command('campaign', 'show campaign for org', {
|
|
153
|
-
id: {
|
|
154
|
-
alias: 'i',
|
|
155
|
-
type: 'number',
|
|
156
|
-
description: 'ID of requested object',
|
|
157
|
-
demandOption: true
|
|
158
|
-
}
|
|
159
|
-
}, cmd(campaign_1.getCampaign))
|
|
160
|
-
.command('campaign:upsert', 'Upsert campaign', {
|
|
161
|
-
name: {
|
|
162
|
-
alias: 'n',
|
|
163
|
-
type: 'string',
|
|
164
|
-
description: 'Name of campaign',
|
|
165
|
-
demandOption: true
|
|
166
|
-
},
|
|
167
|
-
title: {
|
|
168
|
-
alias: 't',
|
|
169
|
-
type: 'string',
|
|
170
|
-
description: 'Description of the campaign'
|
|
171
|
-
}
|
|
172
|
-
}, cmd(campaign_1.upsertCampaign))
|
|
173
|
-
.command('pages', 'List action pages for org', {}, cmd(campaign_1.listActionPages))
|
|
174
|
-
.command('page', 'show page for org', {
|
|
175
|
-
id: {
|
|
176
|
-
alias: 'i',
|
|
177
|
-
type: 'number',
|
|
178
|
-
description: 'ID of requested object'
|
|
179
|
-
},
|
|
180
|
-
name: {
|
|
181
|
-
alias: 'n',
|
|
182
|
-
type: 'string',
|
|
183
|
-
description: 'Name of requested object'
|
|
184
|
-
},
|
|
185
|
-
'public': {
|
|
186
|
-
alias: 'P',
|
|
187
|
-
type: 'boolean',
|
|
188
|
-
description: 'Use public API to fetch action page'
|
|
189
|
-
}
|
|
190
|
-
}, cmd(campaign_1.getActionPage))
|
|
191
|
-
.command('page:update', 'update page for org', {
|
|
192
|
-
id: {
|
|
193
|
-
alias: 'i',
|
|
194
|
-
type: 'number',
|
|
195
|
-
description: 'ID of requested object',
|
|
196
|
-
demandOption: true
|
|
197
|
-
},
|
|
198
|
-
name: {
|
|
199
|
-
alias: 'n',
|
|
200
|
-
type: 'string',
|
|
201
|
-
description: 'update ActionPage name'
|
|
202
|
-
},
|
|
203
|
-
locale: {
|
|
204
|
-
alias: 'l',
|
|
205
|
-
type: 'string',
|
|
206
|
-
description: 'update ActionPage locale'
|
|
207
|
-
},
|
|
208
|
-
tytpl: {
|
|
209
|
-
alias: 't',
|
|
210
|
-
type: 'string',
|
|
211
|
-
description: 'update ActionPage Thank You email template reference'
|
|
212
|
-
},
|
|
213
|
-
extra: {
|
|
214
|
-
alias: 'e',
|
|
215
|
-
type: 'number',
|
|
216
|
-
description: 'update ActionPage extra supporters number'
|
|
217
|
-
},
|
|
218
|
-
config: {
|
|
219
|
-
alias: 'c',
|
|
220
|
-
type: 'string',
|
|
221
|
-
description: 'update ActionPage config - provide filename or JSON string'
|
|
222
|
-
}
|
|
223
|
-
}, cmd(campaign_1.updateActionPage))
|
|
224
|
-
.command('page:add', 'Add a page to campaign', {
|
|
225
|
-
campaign: {
|
|
226
|
-
alias: 'c',
|
|
227
|
-
type: 'string',
|
|
228
|
-
description: 'Limit to campaign name',
|
|
229
|
-
demandOption: true
|
|
230
|
-
},
|
|
231
|
-
name: {
|
|
232
|
-
alias: 'n',
|
|
233
|
-
type: 'string',
|
|
234
|
-
description: 'update ActionPage name',
|
|
235
|
-
demandOption: true
|
|
236
|
-
},
|
|
237
|
-
locale: {
|
|
238
|
-
alias: 'l',
|
|
239
|
-
type: 'string',
|
|
240
|
-
description: 'update ActionPage locale',
|
|
241
|
-
demandOption: true
|
|
242
|
-
}
|
|
243
|
-
}, cmd(campaign_1.upsertActionPage))
|
|
244
|
-
.command('keys', 'Display keys', {}, cmd(org_1.listKeys))
|
|
245
|
-
.command('key:add', 'Do not use! deprecated. Use setup instead', {}, cmd(org_1.addKey))
|
|
246
|
-
.command('watch:pages', 'Subscribe to page updates', {
|
|
247
|
-
exec: {
|
|
248
|
-
alias: 'x',
|
|
249
|
-
type: 'string',
|
|
250
|
-
description: 'program to execute with data in stdin'
|
|
251
|
-
},
|
|
252
|
-
all: {
|
|
253
|
-
alias: 'A',
|
|
254
|
-
type: 'boolean',
|
|
255
|
-
description: 'Watch all orgs (not just one passed via -o)'
|
|
256
|
-
}
|
|
257
|
-
}, cmd(watch_1.watchPages))
|
|
258
|
-
.command('export', 'Export action and supporter data', {
|
|
259
|
-
campaign: {
|
|
260
|
-
alias: 'c',
|
|
261
|
-
type: 'string',
|
|
262
|
-
description: 'Limit to campaign name'
|
|
263
|
-
},
|
|
264
|
-
batch: {
|
|
265
|
-
alias: 'b',
|
|
266
|
-
type: 'number',
|
|
267
|
-
description: 'Batch size',
|
|
268
|
-
default: 1000
|
|
269
|
-
},
|
|
270
|
-
start: {
|
|
271
|
-
alias: 's',
|
|
272
|
-
type: 'number',
|
|
273
|
-
description: 'Start from this action id'
|
|
274
|
-
},
|
|
275
|
-
after: {
|
|
276
|
-
alias: 'a',
|
|
277
|
-
type: 'string',
|
|
278
|
-
description: 'Start from this date (iso)',
|
|
279
|
-
coerce: validateIso8601Date
|
|
280
|
-
},
|
|
281
|
-
decrypt: {
|
|
282
|
-
alias: 'd',
|
|
283
|
-
type: 'boolean',
|
|
284
|
-
default: true,
|
|
285
|
-
description: 'Decrypt contact PII'
|
|
286
|
-
},
|
|
287
|
-
ignore: {
|
|
288
|
-
alias: 'I',
|
|
289
|
-
type: 'boolean',
|
|
290
|
-
default: false,
|
|
291
|
-
description: 'Ignore problems with decrypting contact pii'
|
|
292
|
-
},
|
|
293
|
-
all: {
|
|
294
|
-
alias: 'A',
|
|
295
|
-
type: 'boolean',
|
|
296
|
-
default: false,
|
|
297
|
-
description: 'Download all actions (even not opted in)'
|
|
298
|
-
},
|
|
299
|
-
fields: {
|
|
300
|
-
alias: 'F',
|
|
301
|
-
type: 'string',
|
|
302
|
-
default: '',
|
|
303
|
-
description: 'Export fields (comma separated)'
|
|
304
|
-
}
|
|
305
|
-
}, cmd(export_1.exportActions))
|
|
306
|
-
.command('export:syncFile', 'sync exported actions from file to service', {
|
|
307
|
-
filePath: {
|
|
308
|
-
alias: 'f',
|
|
309
|
-
type: 'string',
|
|
310
|
-
demandOption: true,
|
|
311
|
-
description: 'File with actions (json list format)'
|
|
312
|
-
},
|
|
313
|
-
decrypt: {
|
|
314
|
-
alias: 'd',
|
|
315
|
-
type: 'boolean',
|
|
316
|
-
description: 'Decrypt contact PII'
|
|
317
|
-
},
|
|
318
|
-
service: {
|
|
319
|
-
alias: 's',
|
|
320
|
-
type: 'string',
|
|
321
|
-
describe: 'Service to which deliver action data',
|
|
322
|
-
demandOption: true
|
|
323
|
-
},
|
|
324
|
-
service_url: {
|
|
325
|
-
alias: 'l',
|
|
326
|
-
type: 'string',
|
|
327
|
-
describe: 'Deliver to service at location',
|
|
328
|
-
default: config.service_url
|
|
329
|
-
},
|
|
330
|
-
'backoff': {
|
|
331
|
-
alias: 'B',
|
|
332
|
-
type: 'boolean',
|
|
333
|
-
describe: 'Add backoff when calling syncAction'
|
|
334
|
-
}
|
|
335
|
-
}, cmd(export_1.syncExportFile))
|
|
336
|
-
.command('deliver:check', 'print status of delivery queue', {
|
|
337
|
-
queueName: {
|
|
338
|
-
alias: 'Q',
|
|
339
|
-
type: 'string',
|
|
340
|
-
description: 'Exact queue name to use instead of standard ones'
|
|
341
|
-
}
|
|
342
|
-
}, cmd(queue_1.testQueue))
|
|
343
|
-
.command('deliver:sync', 'sync deliver queue to service', {
|
|
344
|
-
queueName: {
|
|
345
|
-
alias: 'Q',
|
|
346
|
-
type: 'string',
|
|
347
|
-
description: 'Exact queue name to use instead of standard ones'
|
|
348
|
-
},
|
|
349
|
-
queuePrefetch: {
|
|
350
|
-
alias: 'N',
|
|
351
|
-
type: 'number',
|
|
352
|
-
description: 'Queue prefetch count'
|
|
353
|
-
},
|
|
354
|
-
decrypt: {
|
|
355
|
-
alias: 'd',
|
|
356
|
-
type: 'boolean',
|
|
357
|
-
description: 'Decrypt contact PII'
|
|
358
|
-
},
|
|
359
|
-
service: {
|
|
360
|
-
alias: 's',
|
|
361
|
-
type: 'string',
|
|
362
|
-
describe: 'Service to which deliver action data',
|
|
363
|
-
demandOption: true
|
|
364
|
-
},
|
|
365
|
-
service_url: {
|
|
366
|
-
alias: 'l',
|
|
367
|
-
type: 'string',
|
|
368
|
-
describe: 'Deliver to service at location',
|
|
369
|
-
default: config.service_url
|
|
370
|
-
},
|
|
371
|
-
'backoff': {
|
|
372
|
-
alias: 'B',
|
|
373
|
-
type: 'boolean',
|
|
374
|
-
describe: 'Add backoff when calling syncAction'
|
|
375
|
-
}
|
|
376
|
-
}, cmd(queue_1.syncQueue))
|
|
377
|
-
.command('deliver:syncFile', 'sync action messages from file to service', {
|
|
378
|
-
filePath: {
|
|
379
|
-
alias: 'f',
|
|
380
|
-
type: 'string',
|
|
381
|
-
demandOption: true,
|
|
382
|
-
description: 'File with actions (json list format)'
|
|
383
|
-
},
|
|
384
|
-
decrypt: {
|
|
385
|
-
alias: 'd',
|
|
386
|
-
type: 'boolean',
|
|
387
|
-
description: 'Decrypt contact PII'
|
|
388
|
-
},
|
|
389
|
-
service: {
|
|
390
|
-
alias: 's',
|
|
391
|
-
type: 'string',
|
|
392
|
-
describe: 'Service to which deliver action data',
|
|
393
|
-
demandOption: true
|
|
394
|
-
},
|
|
395
|
-
service_url: {
|
|
396
|
-
alias: 'l',
|
|
397
|
-
type: 'string',
|
|
398
|
-
describe: 'Deliver to service at location',
|
|
399
|
-
default: config.service_url
|
|
400
|
-
},
|
|
401
|
-
'backoff': {
|
|
402
|
-
alias: 'B',
|
|
403
|
-
type: 'boolean',
|
|
404
|
-
describe: 'Add backoff when calling syncAction'
|
|
405
|
-
}
|
|
406
|
-
}, cmd(queue_1.syncFile))
|
|
407
|
-
.argv;
|
|
408
|
-
// .demandCommand().argv;
|
|
409
|
-
}
|
|
410
|
-
exports.default = cli;
|
|
411
|
-
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;AAAA,kDAA0B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sCAAsC;YAChD,YAAY,EAAE,IAAI;SACnB;QACD,WAAW,EAAE;YACX,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,gCAAgC;YAC1C,OAAO,EAAE,MAAM,CAAC,WAAW;SAC5B;QACD,SAAS,EAAE;YACT,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,qCAAqC;SAChD;KACF,EAAE,GAAG,CAAC,iBAAS,CAAC,CAAC;SACjB,OAAO,CAAC,kBAAkB,EAAE,2CAA2C,EAAE;QACxE,QAAQ,EAAE;YACR,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,QAAQ;YACd,YAAY,EAAE,IAAI;YAClB,WAAW,EAAE,sCAAsC;SACpD;QACD,OAAO,EAAE;YACP,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,SAAS;YACf,WAAW,EAAE,qBAAqB;SACnC;QACD,OAAO,EAAE;YACP,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,sCAAsC;YAChD,YAAY,EAAE,IAAI;SACnB;QACD,WAAW,EAAE;YACX,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,gCAAgC;YAC1C,OAAO,EAAE,MAAM,CAAC,WAAW;SAC5B;QACD,SAAS,EAAE;YACT,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,qCAAqC;SAChD;KACF,EAAE,GAAG,CAAC,gBAAQ,CAAC,CAAC;SAEhB,IAAI,CAAA;IACD,yBAAyB;AACjC,CAAC;AA3ZD,sBA2ZC"}
|
package/dist/client.d.ts
DELETED
package/dist/client.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const urql_serialize_scalars_exchange_1 = __importDefault(require("urql-serialize-scalars-exchange"));
|
|
7
|
-
const api_1 = require("@proca/api");
|
|
8
|
-
const proca_1 = require("./proca");
|
|
9
|
-
function getClient(config) {
|
|
10
|
-
let a = null;
|
|
11
|
-
if (config.username && config.password) {
|
|
12
|
-
a = api_1.basicAuth(config);
|
|
13
|
-
}
|
|
14
|
-
let c = api_1.link(config.url, a, { exchanges: [urql_serialize_scalars_exchange_1.default(proca_1.scalarLocations, api_1.scalarSerializers)] });
|
|
15
|
-
return c;
|
|
16
|
-
}
|
|
17
|
-
exports.default = getClient;
|
|
18
|
-
//# sourceMappingURL=client.js.map
|
package/dist/client.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;;;AAEA,sGAA6E;AAC7E,oCAAyE;AACzE,mCAAwC;AAIxC,SAAwB,SAAS,CAAC,MAAkB;IAClD,IAAI,CAAC,GAAG,IAAI,CAAA;IACZ,IAAI,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ,EAAE;QACtC,CAAC,GAAG,eAAS,CAAC,MAAmB,CAAC,CAAA;KACnC;IACD,IAAI,CAAC,GAAG,UAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,EAAE,EAAC,SAAS,EAAE,CAAC,yCAA8B,CAAC,uBAAe,EAAE,uBAAiB,CAAC,CAAC,EAAC,CAAC,CAAA;IAC9G,OAAO,CAAC,CAAA;AACV,CAAC;AAPD,4BAOC"}
|
package/dist/config.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
export declare type CliConfig = {
|
|
3
|
-
org?: string;
|
|
4
|
-
username?: string;
|
|
5
|
-
password?: string;
|
|
6
|
-
queue_url?: string;
|
|
7
|
-
identity_url?: string;
|
|
8
|
-
identity_api_token?: string;
|
|
9
|
-
identity_consent?: string;
|
|
10
|
-
identity_action_fields?: string[];
|
|
11
|
-
identity_contact_fields?: string[];
|
|
12
|
-
service_url?: string;
|
|
13
|
-
url?: string;
|
|
14
|
-
keyData?: string;
|
|
15
|
-
envFile?: boolean;
|
|
16
|
-
verbose?: boolean;
|
|
17
|
-
};
|
|
18
|
-
export declare function load(): CliConfig;
|
|
19
|
-
export declare function loadFromEnv(env?: NodeJS.ProcessEnv): CliConfig;
|
|
20
|
-
export declare function storeConfig(config: CliConfig, file_name: string): void;
|
|
21
|
-
export declare function overrideConfig(config: CliConfig, overrides: Partial<CliConfig>): void;
|
|
22
|
-
export declare type WidgetConfig = {
|
|
23
|
-
actionpage: number;
|
|
24
|
-
lang: string;
|
|
25
|
-
filename: string;
|
|
26
|
-
organisation: string;
|
|
27
|
-
campaign?: {
|
|
28
|
-
name: string;
|
|
29
|
-
title: string;
|
|
30
|
-
};
|
|
31
|
-
lead?: {
|
|
32
|
-
name: string;
|
|
33
|
-
title: string;
|
|
34
|
-
};
|
|
35
|
-
};
|
package/dist/config.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.overrideConfig = exports.storeConfig = exports.loadFromEnv = exports.load = void 0;
|
|
7
|
-
const dotenv_1 = __importDefault(require("dotenv"));
|
|
8
|
-
const fs_1 = require("fs");
|
|
9
|
-
function load() {
|
|
10
|
-
const { parsed } = dotenv_1.default.config();
|
|
11
|
-
const config = loadFromEnv(process.env);
|
|
12
|
-
// was env file loaded?
|
|
13
|
-
config.envFile = parsed !== undefined;
|
|
14
|
-
return config;
|
|
15
|
-
}
|
|
16
|
-
exports.load = load;
|
|
17
|
-
function loadFromEnv(env = process.env) {
|
|
18
|
-
const config = {
|
|
19
|
-
org: env["ORG_NAME"],
|
|
20
|
-
username: env["AUTH_USER"],
|
|
21
|
-
password: env["AUTH_PASSWORD"],
|
|
22
|
-
queue_url: env["QUEUE_URL"] || 'amqp://api.proca.app/proca',
|
|
23
|
-
identity_url: env["IDENTITY_URL"],
|
|
24
|
-
identity_api_token: env["IDENTITY_API_TOKEN"],
|
|
25
|
-
identity_consent: env["IDENTITY_CONSENT"],
|
|
26
|
-
identity_action_fields: (env["IDENTITY_ACTION_FIELDS"] || '').toLowerCase().split(','),
|
|
27
|
-
identity_contact_fields: (env["IDENTITY_CONTACT_FIELDS"] || '').toLowerCase().split(','),
|
|
28
|
-
service_url: env["SERVICE_URL"] || env["IDENTITY_URL"],
|
|
29
|
-
url: env["API_URL"] || 'https://api.proca.app',
|
|
30
|
-
keyData: env["KEYS"] || 'keys.json',
|
|
31
|
-
envFile: false,
|
|
32
|
-
verbose: false
|
|
33
|
-
};
|
|
34
|
-
return config;
|
|
35
|
-
}
|
|
36
|
-
exports.loadFromEnv = loadFromEnv;
|
|
37
|
-
function storeConfig(config, file_name) {
|
|
38
|
-
let data = '';
|
|
39
|
-
const vars = {
|
|
40
|
-
'ORG_NAME': config.org,
|
|
41
|
-
'AUTH_USER': config.username,
|
|
42
|
-
'AUTH_PASSWORD': config.password,
|
|
43
|
-
'API_URL': config.url,
|
|
44
|
-
'QUEUE_URL': config.queue_url,
|
|
45
|
-
'IDENTITY_URL': config.identity_url,
|
|
46
|
-
'IDENTITY_API_TOKEN': config.identity_api_token,
|
|
47
|
-
'IDENTITY_CONSENT': config.identity_consent,
|
|
48
|
-
'IDENTITY_ACTION_FIELDS': config.identity_action_fields ? config.identity_action_fields.join(",") : null,
|
|
49
|
-
'IDENTITY_CONTACT_FIELDS': config.identity_contact_fields ? config.identity_contact_fields.join(",") : null,
|
|
50
|
-
'SERVICE_URL': config.service_url,
|
|
51
|
-
'KEYS': config.keyData
|
|
52
|
-
};
|
|
53
|
-
for (let [k, v] of Object.entries(vars)) {
|
|
54
|
-
if (v) {
|
|
55
|
-
data += `${k}=${v}\n`;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
fs_1.writeFileSync(file_name, data);
|
|
59
|
-
}
|
|
60
|
-
exports.storeConfig = storeConfig;
|
|
61
|
-
function overrideConfig(config, overrides) {
|
|
62
|
-
for (const prop of ['queue_url', 'keyData', 'url', 'username', 'password', 'org']) {
|
|
63
|
-
const overrides2 = overrides;
|
|
64
|
-
const config2 = config;
|
|
65
|
-
if (overrides2[prop]) {
|
|
66
|
-
config2[prop] = overrides2[prop];
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
exports.overrideConfig = overrideConfig;
|
|
71
|
-
//# sourceMappingURL=config.js.map
|
package/dist/config.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;;;;AACA,oDAA2B;AAC3B,2BAAgC;AAoBhC,SAAgB,IAAI;IAClB,MAAM,EAAC,MAAM,EAAC,GAAG,gBAAM,CAAC,MAAM,EAAE,CAAA;IAChC,MAAM,MAAM,GAAe,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IACnD,uBAAuB;IACvB,MAAM,CAAC,OAAO,GAAG,MAAM,KAAK,SAAS,CAAA;IACrC,OAAO,MAAM,CAAA;AACf,CAAC;AAND,oBAMC;AAED,SAAgB,WAAW,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG;IAE3C,MAAM,MAAM,GAAe;QACzB,GAAG,EAAE,GAAG,CAAC,UAAU,CAAC;QACpB,QAAQ,EAAE,GAAG,CAAC,WAAW,CAAC;QAC1B,QAAQ,EAAE,GAAG,CAAC,eAAe,CAAC;QAC9B,SAAS,EAAE,GAAG,CAAC,WAAW,CAAC,IAAI,4BAA4B;QAC3D,YAAY,EAAE,GAAG,CAAC,cAAc,CAAC;QACjC,kBAAkB,EAAE,GAAG,CAAC,oBA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G,CAAC,CAAC,CAAC,CAAC,IAAI;QAC3G,aAAa,EAAE,MAAM,CAAC,WAAW;QACjC,MAAM,EAAE,MAAM,CAAC,OAAO;KACvB,CAAA;IAED,KAAK,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACvC,IAAI,CAAC,EAAE;YACL,IAAI,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,CAAA;SACtB;KACF;IAED,kBAAa,CAAC,SAAS,EAAE,IAAI,CAAC,CAAA;AAChC,CAAC;AAzBD,kCAyBC;AAGD,SAAgB,cAAc,CAAC,MAAkB,EAAE,SAA8B;IAC/E,KAAK,MAAM,IAAI,IAAI,CAAC,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE;QACjF,MAAM,UAAU,GAAG,SAAgC,CAAA;QACnD,MAAM,OAAO,GAAG,MAA6B,CAAA;QAC7C,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE;YACpB,OAAO,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,CAAA;SACjC;KACF;AACH,CAAC;AARD,wCAQC"}
|
package/dist/crypto.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export declare type KeyPair = {
|
|
2
|
-
public: string;
|
|
3
|
-
private?: string;
|
|
4
|
-
};
|
|
5
|
-
export declare type PublicKey = {
|
|
6
|
-
id: number;
|
|
7
|
-
public: string;
|
|
8
|
-
};
|
|
9
|
-
export declare type KeyStore = {
|
|
10
|
-
filename: string | null;
|
|
11
|
-
readFromFile: boolean;
|
|
12
|
-
keys: KeyPair[];
|
|
13
|
-
};
|
|
14
|
-
declare type MixedFormatValue = {
|
|
15
|
-
private: string;
|
|
16
|
-
} | string;
|
|
17
|
-
export declare type MixedFormat = Record<string, MixedFormatValue>;
|
|
18
|
-
declare type FullFormatValue = {
|
|
19
|
-
private: string;
|
|
20
|
-
};
|
|
21
|
-
export declare type FullFormat = Record<string, FullFormatValue>;
|
|
22
|
-
export interface EncryptedContact {
|
|
23
|
-
payload: string;
|
|
24
|
-
nonce?: string;
|
|
25
|
-
publicKey?: KeyPair;
|
|
26
|
-
signKey?: KeyPair;
|
|
27
|
-
contactRef: string;
|
|
28
|
-
}
|
|
29
|
-
export interface ActionWithEncryptedContact {
|
|
30
|
-
contact: EncryptedContact;
|
|
31
|
-
}
|
|
32
|
-
export declare type ContactWithPII = EncryptedContact & {
|
|
33
|
-
pii?: any;
|
|
34
|
-
};
|
|
35
|
-
export interface ActionWithPII {
|
|
36
|
-
contact: ContactWithPII;
|
|
37
|
-
}
|
|
38
|
-
export declare function readMixedFormat(ks: KeyStore, keys: MixedFormat): KeyStore;
|
|
39
|
-
export declare function decrypt(payload: string, nonce: string, public_key: KeyPair, sign_key: KeyPair, keys: KeyStore): string;
|
|
40
|
-
export {};
|
package/dist/crypto.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.decrypt = exports.readMixedFormat = void 0;
|
|
7
|
-
const tweetnacl_1 = __importDefault(require("tweetnacl"));
|
|
8
|
-
const tweetnacl_util_1 = require("tweetnacl-util");
|
|
9
|
-
const base64url_1 = __importDefault(require("base64url"));
|
|
10
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
11
|
-
function readMixedFormat(ks, keys) {
|
|
12
|
-
for (let [key, value] of Object.entries(keys)) {
|
|
13
|
-
if (typeof key !== "string")
|
|
14
|
-
throw new Error("keys must be a map keyed by public key");
|
|
15
|
-
if (typeof value == "string")
|
|
16
|
-
ks.keys.push({ public: key, private: value });
|
|
17
|
-
if (typeof value == "object") {
|
|
18
|
-
if (typeof value.private !== "string")
|
|
19
|
-
throw new Error("keys must be a map with values containing private key");
|
|
20
|
-
ks.keys.push({ public: key, private: value.private });
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
ks.keys = lodash_1.default.uniqBy(ks.keys, "public");
|
|
24
|
-
return ks;
|
|
25
|
-
}
|
|
26
|
-
exports.readMixedFormat = readMixedFormat;
|
|
27
|
-
function base64url2normal(s) {
|
|
28
|
-
return tweetnacl_util_1.decodeBase64(base64url_1.default.toBase64(s));
|
|
29
|
-
}
|
|
30
|
-
function decrypt(payload, nonce, public_key, sign_key, keys) {
|
|
31
|
-
if (!nonce) {
|
|
32
|
-
return payload; // decrypted
|
|
33
|
-
}
|
|
34
|
-
if (!(public_key && public_key.public && sign_key)) {
|
|
35
|
-
throw new Error("Tried to decrypt a payload providing null public_key or sign_key");
|
|
36
|
-
}
|
|
37
|
-
const privIdx = keys.keys.findIndex((k) => k.public == public_key.public);
|
|
38
|
-
if (privIdx < 0)
|
|
39
|
-
return null;
|
|
40
|
-
const privPair = keys.keys[privIdx];
|
|
41
|
-
const priv = base64url2normal(privPair.private);
|
|
42
|
-
const pub = base64url2normal(sign_key.public);
|
|
43
|
-
// decrypt
|
|
44
|
-
const clear = tweetnacl_1.default.box.open(base64url2normal(payload), base64url2normal(nonce), pub, priv);
|
|
45
|
-
if (clear === null) {
|
|
46
|
-
throw new Error(`decrypting payload returned null (payload ${payload})`);
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
return tweetnacl_util_1.encodeUTF8(clear);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
exports.decrypt = decrypt;
|
|
53
|
-
//# sourceMappingURL=crypto.js.map
|
package/dist/crypto.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"crypto.js","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA4B;AAC5B,mDAAuD;AACvD,0DAAiC;AAEjC,oDAAwB;AAsDxB,SA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