@flowcore/cli 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/CHANGELOG.md +308 -0
  2. package/README.md +510 -0
  3. package/bin/dev.cmd +3 -0
  4. package/bin/dev.js +9 -0
  5. package/bin/run.cmd +3 -0
  6. package/bin/run.js +8 -0
  7. package/dist/base-command.d.ts +17 -0
  8. package/dist/base-command.js +32 -0
  9. package/dist/commands/config/set.d.ts +13 -0
  10. package/dist/commands/config/set.js +45 -0
  11. package/dist/commands/config/show.d.ts +6 -0
  12. package/dist/commands/config/show.js +11 -0
  13. package/dist/commands/login.d.ts +19 -0
  14. package/dist/commands/login.js +146 -0
  15. package/dist/commands/stream.d.ts +18 -0
  16. package/dist/commands/stream.js +220 -0
  17. package/dist/commands/whoami.d.ts +5 -0
  18. package/dist/commands/whoami.js +25 -0
  19. package/dist/index.d.ts +1 -0
  20. package/dist/index.js +1 -0
  21. package/dist/interfaces/source-event.interface.d.ts +18 -0
  22. package/dist/interfaces/source-event.interface.js +1 -0
  23. package/dist/utils/config.util.d.ts +31 -0
  24. package/dist/utils/config.util.js +108 -0
  25. package/dist/utils/graphql.util.d.ts +8 -0
  26. package/dist/utils/graphql.util.js +25 -0
  27. package/dist/utils/object-path.util.d.ts +1 -0
  28. package/dist/utils/object-path.util.js +17 -0
  29. package/dist/utils/queries/fetch-data-core.gql.d.ts +12 -0
  30. package/dist/utils/queries/fetch-data-core.gql.js +10 -0
  31. package/dist/utils/queries/fetch-event-type-range.gql.d.ts +21 -0
  32. package/dist/utils/queries/fetch-event-type-range.gql.js +19 -0
  33. package/dist/utils/queries/fetch-events.gql.d.ts +28 -0
  34. package/dist/utils/queries/fetch-events.gql.js +28 -0
  35. package/dist/utils/timebucket.util.d.ts +5 -0
  36. package/dist/utils/timebucket.util.js +11 -0
  37. package/dist/utils/validate-login.util.d.ts +24 -0
  38. package/dist/utils/validate-login.util.js +111 -0
  39. package/oclif.manifest.json +253 -0
  40. package/package.json +102 -0
package/README.md ADDED
@@ -0,0 +1,510 @@
1
+ Flowcore CLI
2
+ =================
3
+
4
+ Flowcore CLI is a command line interface for interacting with the Flowcore Platform.
5
+
6
+ [![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
7
+ [![Build and Release](https://github.com/flowcore-io/flowcore-cli/actions/workflows/build.yml/badge.svg)](https://github.com/flowcore-io/flowcore-cli/actions/workflows/build.yml)
8
+
9
+ <!-- toc -->
10
+ * [Usage](#usage)
11
+ * [Commands](#commands)
12
+ <!-- tocstop -->
13
+ # Usage
14
+ <!-- usage -->
15
+ ```sh-session
16
+ $ npm install -g @flowcore/cli
17
+ $ flowcore COMMAND
18
+ running command...
19
+ $ flowcore (--version)
20
+ @flowcore/cli/1.0.1 linux-x64 node-v20.10.0
21
+ $ flowcore --help [COMMAND]
22
+ USAGE
23
+ $ flowcore COMMAND
24
+ ...
25
+ ```
26
+ <!-- usagestop -->
27
+ # Commands
28
+ <!-- commands -->
29
+ * [`flowcore autocomplete [SHELL]`](#flowcore-autocomplete-shell)
30
+ * [`flowcore config set`](#flowcore-config-set)
31
+ * [`flowcore config show`](#flowcore-config-show)
32
+ * [`flowcore help [COMMANDS]`](#flowcore-help-commands)
33
+ * [`flowcore login`](#flowcore-login)
34
+ * [`flowcore plugins`](#flowcore-plugins)
35
+ * [`flowcore plugins:install PLUGIN...`](#flowcore-pluginsinstall-plugin)
36
+ * [`flowcore plugins:inspect PLUGIN...`](#flowcore-pluginsinspect-plugin)
37
+ * [`flowcore plugins:install PLUGIN...`](#flowcore-pluginsinstall-plugin-1)
38
+ * [`flowcore plugins:link PLUGIN`](#flowcore-pluginslink-plugin)
39
+ * [`flowcore plugins:uninstall PLUGIN...`](#flowcore-pluginsuninstall-plugin)
40
+ * [`flowcore plugins reset`](#flowcore-plugins-reset)
41
+ * [`flowcore plugins:uninstall PLUGIN...`](#flowcore-pluginsuninstall-plugin-1)
42
+ * [`flowcore plugins:uninstall PLUGIN...`](#flowcore-pluginsuninstall-plugin-2)
43
+ * [`flowcore plugins update`](#flowcore-plugins-update)
44
+ * [`flowcore stream STREAM`](#flowcore-stream-stream)
45
+ * [`flowcore version`](#flowcore-version)
46
+ * [`flowcore whoami`](#flowcore-whoami)
47
+
48
+ ## `flowcore autocomplete [SHELL]`
49
+
50
+ Display autocomplete installation instructions.
51
+
52
+ ```
53
+ USAGE
54
+ $ flowcore autocomplete [SHELL] [-r]
55
+
56
+ ARGUMENTS
57
+ SHELL (zsh|bash|powershell) Shell type
58
+
59
+ FLAGS
60
+ -r, --refresh-cache Refresh cache (ignores displaying instructions)
61
+
62
+ DESCRIPTION
63
+ Display autocomplete installation instructions.
64
+
65
+ EXAMPLES
66
+ $ flowcore autocomplete
67
+
68
+ $ flowcore autocomplete bash
69
+
70
+ $ flowcore autocomplete zsh
71
+
72
+ $ flowcore autocomplete powershell
73
+
74
+ $ flowcore autocomplete --refresh-cache
75
+ ```
76
+
77
+ _See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v3.0.3/src/commands/autocomplete/index.ts)_
78
+
79
+ ## `flowcore config set`
80
+
81
+ Configure the cli
82
+
83
+ ```
84
+ USAGE
85
+ $ flowcore config set [--profile <value>] [-c <value>] [-n <value>] [-l <value>] [-p] [-u <value>]
86
+
87
+ FLAGS
88
+ -c, --clientId=<value> client id to use for the login
89
+ -l, --loginUrl=<value> url to discover the openid configuration
90
+ -n, --clientSecret=<value> name to print
91
+ -p, --port prompt for port to listen for the callback
92
+ -u, --url=<value> url to the flowcore platform api
93
+ --profile=<value> Specify the configuration profile to use
94
+
95
+ DESCRIPTION
96
+ Configure the cli
97
+
98
+ EXAMPLES
99
+ $ flowcore config set -l https://auth.flowcore.io/realms/flowcore/.well-known/openid-configuration -c my-client-id -s my-client-secret
100
+
101
+ $ flowcore config set -u https://graph.api.flowcore.io/graphql
102
+
103
+ $ flowcore config set -l https://auth.flowcore.io/realms/flowcore/.well-known/openid-configuration -c my-client-id -p
104
+ ```
105
+
106
+ _See code: [src/commands/config/set.ts](https://github.com/flowcore-io/flowcore-cli/blob/v1.0.1/src/commands/config/set.ts)_
107
+
108
+ ## `flowcore config show`
109
+
110
+ Show the configured login url
111
+
112
+ ```
113
+ USAGE
114
+ $ flowcore config show [--profile <value>]
115
+
116
+ FLAGS
117
+ --profile=<value> Specify the configuration profile to use
118
+
119
+ DESCRIPTION
120
+ Show the configured login url
121
+
122
+ EXAMPLES
123
+ $ flowcore config show
124
+ ```
125
+
126
+ _See code: [src/commands/config/show.ts](https://github.com/flowcore-io/flowcore-cli/blob/v1.0.1/src/commands/config/show.ts)_
127
+
128
+ ## `flowcore help [COMMANDS]`
129
+
130
+ Display help for flowcore.
131
+
132
+ ```
133
+ USAGE
134
+ $ flowcore help [COMMANDS] [-n]
135
+
136
+ ARGUMENTS
137
+ COMMANDS Command to show help for.
138
+
139
+ FLAGS
140
+ -n, --nested-commands Include all nested commands in the output.
141
+
142
+ DESCRIPTION
143
+ Display help for flowcore.
144
+ ```
145
+
146
+ _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.2.20/src/commands/help.ts)_
147
+
148
+ ## `flowcore login`
149
+
150
+ login to the Flowcore Platform
151
+
152
+ ```
153
+ USAGE
154
+ $ flowcore login [--profile <value>] [-p <value>]
155
+
156
+ FLAGS
157
+ -p, --port=<value> [default: 3000] port to listen for the callback
158
+ --profile=<value> Specify the configuration profile to use
159
+
160
+ DESCRIPTION
161
+ login to the Flowcore Platform
162
+
163
+ EXAMPLES
164
+ $ flowcore login
165
+
166
+ $ flowcore login --port 8080
167
+ ```
168
+
169
+ _See code: [src/commands/login.ts](https://github.com/flowcore-io/flowcore-cli/blob/v1.0.1/src/commands/login.ts)_
170
+
171
+ ## `flowcore plugins`
172
+
173
+ List installed plugins.
174
+
175
+ ```
176
+ USAGE
177
+ $ flowcore plugins [--json] [--core]
178
+
179
+ FLAGS
180
+ --core Show core plugins.
181
+
182
+ GLOBAL FLAGS
183
+ --json Format output as json.
184
+
185
+ DESCRIPTION
186
+ List installed plugins.
187
+
188
+ EXAMPLES
189
+ $ flowcore plugins
190
+ ```
191
+
192
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.10/src/commands/plugins/index.ts)_
193
+
194
+ ## `flowcore plugins:install PLUGIN...`
195
+
196
+ Installs a plugin into the CLI.
197
+
198
+ ```
199
+ USAGE
200
+ $ flowcore plugins add plugins:install PLUGIN...
201
+
202
+ ARGUMENTS
203
+ PLUGIN Plugin to install.
204
+
205
+ FLAGS
206
+ -f, --force Run yarn install with force flag.
207
+ -h, --help Show CLI help.
208
+ -s, --silent Silences yarn output.
209
+ -v, --verbose Show verbose yarn output.
210
+
211
+ GLOBAL FLAGS
212
+ --json Format output as json.
213
+
214
+ DESCRIPTION
215
+ Installs a plugin into the CLI.
216
+ Can be installed from npm or a git url.
217
+
218
+ Installation of a user-installed plugin will override a core plugin.
219
+
220
+ e.g. If you have a core plugin that has a 'hello' command, installing a user-installed plugin with a 'hello' command
221
+ will override the core plugin implementation. This is useful if a user needs to update core plugin functionality in
222
+ the CLI without the need to patch and update the whole CLI.
223
+
224
+
225
+ ALIASES
226
+ $ flowcore plugins add
227
+
228
+ EXAMPLES
229
+ $ flowcore plugins add myplugin
230
+
231
+ $ flowcore plugins add https://github.com/someuser/someplugin
232
+
233
+ $ flowcore plugins add someuser/someplugin
234
+ ```
235
+
236
+ ## `flowcore plugins:inspect PLUGIN...`
237
+
238
+ Displays installation properties of a plugin.
239
+
240
+ ```
241
+ USAGE
242
+ $ flowcore plugins inspect PLUGIN...
243
+
244
+ ARGUMENTS
245
+ PLUGIN [default: .] Plugin to inspect.
246
+
247
+ FLAGS
248
+ -h, --help Show CLI help.
249
+ -v, --verbose
250
+
251
+ GLOBAL FLAGS
252
+ --json Format output as json.
253
+
254
+ DESCRIPTION
255
+ Displays installation properties of a plugin.
256
+
257
+ EXAMPLES
258
+ $ flowcore plugins inspect myplugin
259
+ ```
260
+
261
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.10/src/commands/plugins/inspect.ts)_
262
+
263
+ ## `flowcore plugins:install PLUGIN...`
264
+
265
+ Installs a plugin into the CLI.
266
+
267
+ ```
268
+ USAGE
269
+ $ flowcore plugins install PLUGIN...
270
+
271
+ ARGUMENTS
272
+ PLUGIN Plugin to install.
273
+
274
+ FLAGS
275
+ -f, --force Run yarn install with force flag.
276
+ -h, --help Show CLI help.
277
+ -s, --silent Silences yarn output.
278
+ -v, --verbose Show verbose yarn output.
279
+
280
+ GLOBAL FLAGS
281
+ --json Format output as json.
282
+
283
+ DESCRIPTION
284
+ Installs a plugin into the CLI.
285
+ Can be installed from npm or a git url.
286
+
287
+ Installation of a user-installed plugin will override a core plugin.
288
+
289
+ e.g. If you have a core plugin that has a 'hello' command, installing a user-installed plugin with a 'hello' command
290
+ will override the core plugin implementation. This is useful if a user needs to update core plugin functionality in
291
+ the CLI without the need to patch and update the whole CLI.
292
+
293
+
294
+ ALIASES
295
+ $ flowcore plugins add
296
+
297
+ EXAMPLES
298
+ $ flowcore plugins install myplugin
299
+
300
+ $ flowcore plugins install https://github.com/someuser/someplugin
301
+
302
+ $ flowcore plugins install someuser/someplugin
303
+ ```
304
+
305
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.10/src/commands/plugins/install.ts)_
306
+
307
+ ## `flowcore plugins:link PLUGIN`
308
+
309
+ Links a plugin into the CLI for development.
310
+
311
+ ```
312
+ USAGE
313
+ $ flowcore plugins link PLUGIN
314
+
315
+ ARGUMENTS
316
+ PATH [default: .] path to plugin
317
+
318
+ FLAGS
319
+ -h, --help Show CLI help.
320
+ -v, --verbose
321
+ --[no-]install Install dependencies after linking the plugin.
322
+
323
+ DESCRIPTION
324
+ Links a plugin into the CLI for development.
325
+ Installation of a linked plugin will override a user-installed or core plugin.
326
+
327
+ e.g. If you have a user-installed or core plugin that has a 'hello' command, installing a linked plugin with a 'hello'
328
+ command will override the user-installed or core plugin implementation. This is useful for development work.
329
+
330
+
331
+ EXAMPLES
332
+ $ flowcore plugins link myplugin
333
+ ```
334
+
335
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.10/src/commands/plugins/link.ts)_
336
+
337
+ ## `flowcore plugins:uninstall PLUGIN...`
338
+
339
+ Removes a plugin from the CLI.
340
+
341
+ ```
342
+ USAGE
343
+ $ flowcore plugins remove plugins:uninstall PLUGIN...
344
+
345
+ ARGUMENTS
346
+ PLUGIN plugin to uninstall
347
+
348
+ FLAGS
349
+ -h, --help Show CLI help.
350
+ -v, --verbose
351
+
352
+ DESCRIPTION
353
+ Removes a plugin from the CLI.
354
+
355
+ ALIASES
356
+ $ flowcore plugins unlink
357
+ $ flowcore plugins remove
358
+
359
+ EXAMPLES
360
+ $ flowcore plugins remove myplugin
361
+ ```
362
+
363
+ ## `flowcore plugins reset`
364
+
365
+ Remove all user-installed and linked plugins.
366
+
367
+ ```
368
+ USAGE
369
+ $ flowcore plugins reset
370
+ ```
371
+
372
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.10/src/commands/plugins/reset.ts)_
373
+
374
+ ## `flowcore plugins:uninstall PLUGIN...`
375
+
376
+ Removes a plugin from the CLI.
377
+
378
+ ```
379
+ USAGE
380
+ $ flowcore plugins uninstall PLUGIN...
381
+
382
+ ARGUMENTS
383
+ PLUGIN plugin to uninstall
384
+
385
+ FLAGS
386
+ -h, --help Show CLI help.
387
+ -v, --verbose
388
+
389
+ DESCRIPTION
390
+ Removes a plugin from the CLI.
391
+
392
+ ALIASES
393
+ $ flowcore plugins unlink
394
+ $ flowcore plugins remove
395
+
396
+ EXAMPLES
397
+ $ flowcore plugins uninstall myplugin
398
+ ```
399
+
400
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.10/src/commands/plugins/uninstall.ts)_
401
+
402
+ ## `flowcore plugins:uninstall PLUGIN...`
403
+
404
+ Removes a plugin from the CLI.
405
+
406
+ ```
407
+ USAGE
408
+ $ flowcore plugins unlink plugins:uninstall PLUGIN...
409
+
410
+ ARGUMENTS
411
+ PLUGIN plugin to uninstall
412
+
413
+ FLAGS
414
+ -h, --help Show CLI help.
415
+ -v, --verbose
416
+
417
+ DESCRIPTION
418
+ Removes a plugin from the CLI.
419
+
420
+ ALIASES
421
+ $ flowcore plugins unlink
422
+ $ flowcore plugins remove
423
+
424
+ EXAMPLES
425
+ $ flowcore plugins unlink myplugin
426
+ ```
427
+
428
+ ## `flowcore plugins update`
429
+
430
+ Update installed plugins.
431
+
432
+ ```
433
+ USAGE
434
+ $ flowcore plugins update [-h] [-v]
435
+
436
+ FLAGS
437
+ -h, --help Show CLI help.
438
+ -v, --verbose
439
+
440
+ DESCRIPTION
441
+ Update installed plugins.
442
+ ```
443
+
444
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.10/src/commands/plugins/update.ts)_
445
+
446
+ ## `flowcore stream STREAM`
447
+
448
+ Stream events from a datacore running on the Flowcore Platform
449
+
450
+ ```
451
+ USAGE
452
+ $ flowcore stream STREAM [--profile <value>] [-d <value>] [-l] [-o http|log] [-s <value>]
453
+
454
+ ARGUMENTS
455
+ STREAM stream url to connect to
456
+
457
+ FLAGS
458
+ -d, --destination=<value> [default: http://localhost:3000/transform] Destination to send events to
459
+ -l, --live Change to live mode when reaching last time bucket
460
+ -o, --output=<option> [default: http] Output format
461
+ <options: http|log>
462
+ -s, --start=<value> Start time bucket to stream from, example: (1y, 1m, 1d, 1h)
463
+ --profile=<value> Specify the configuration profile to use
464
+
465
+ DESCRIPTION
466
+ Stream events from a datacore running on the Flowcore Platform
467
+
468
+ EXAMPLES
469
+ $ flowcore stream https://staging.flowcore.io/flowcore/flowcore-platform/organization.0/event.organization.subscription.updated-requested.0.stream
470
+ ```
471
+
472
+ _See code: [src/commands/stream.ts](https://github.com/flowcore-io/flowcore-cli/blob/v1.0.1/src/commands/stream.ts)_
473
+
474
+ ## `flowcore version`
475
+
476
+ ```
477
+ USAGE
478
+ $ flowcore version [--json] [--verbose]
479
+
480
+ FLAGS
481
+ --verbose Show additional information about the CLI.
482
+
483
+ GLOBAL FLAGS
484
+ --json Format output as json.
485
+
486
+ FLAG DESCRIPTIONS
487
+ --verbose Show additional information about the CLI.
488
+
489
+ Additionally shows the architecture, node version, operating system, and versions of plugins that the CLI is using.
490
+ ```
491
+
492
+ _See code: [@oclif/plugin-version](https://github.com/oclif/plugin-version/blob/v2.0.9/src/commands/version.ts)_
493
+
494
+ ## `flowcore whoami`
495
+
496
+ Check what user you are logged in as
497
+
498
+ ```
499
+ USAGE
500
+ $ flowcore whoami [--profile <value>]
501
+
502
+ FLAGS
503
+ --profile=<value> Specify the configuration profile to use
504
+
505
+ DESCRIPTION
506
+ Check what user you are logged in as
507
+ ```
508
+
509
+ _See code: [src/commands/whoami.ts](https://github.com/flowcore-io/flowcore-cli/blob/v1.0.1/src/commands/whoami.ts)_
510
+ <!-- commandsstop -->
package/bin/dev.cmd ADDED
@@ -0,0 +1,3 @@
1
+ @echo off
2
+
3
+ node --loader ts-node/esm --no-warnings=ExperimentalWarning "%~dp0\dev" %*
package/bin/dev.js ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env -S node --loader ts-node/esm --no-warnings=ExperimentalWarning
2
+
3
+ // eslint-disable-next-line node/shebang
4
+ async function main() {
5
+ const {execute} = await import('@oclif/core')
6
+ await execute({development: true, dir: import.meta.url})
7
+ }
8
+
9
+ await main()
package/bin/run.cmd ADDED
@@ -0,0 +1,3 @@
1
+ @echo off
2
+
3
+ node "%~dp0\run" %*
package/bin/run.js ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+
3
+ async function main() {
4
+ const {execute} = await import('@oclif/core')
5
+ await execute({dir: import.meta.url})
6
+ }
7
+
8
+ await main()
@@ -0,0 +1,17 @@
1
+ import { Command, Interfaces } from '@oclif/core';
2
+ import { CliConfiguration } from "./utils/config.util.js";
3
+ export type Flags<T extends typeof Command> = Interfaces.InferredFlags<typeof BaseCommand['baseFlags'] & T['flags']>;
4
+ export type Args<T extends typeof Command> = Interfaces.InferredArgs<T['args']>;
5
+ export declare abstract class BaseCommand<T extends typeof Command> extends Command {
6
+ static baseFlags: {
7
+ profile: Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
8
+ };
9
+ protected args: Args<T>;
10
+ protected cliConfiguration: CliConfiguration;
11
+ protected flags: Flags<T>;
12
+ protected catch(err: Error & {
13
+ exitCode?: number;
14
+ }): Promise<unknown>;
15
+ protected finally(_: Error | undefined): Promise<unknown>;
16
+ protected init(): Promise<void>;
17
+ }
@@ -0,0 +1,32 @@
1
+ // src/baseCommand.ts
2
+ import { Command, Flags } from '@oclif/core';
3
+ import { CliConfiguration } from "./utils/config.util.js";
4
+ export class BaseCommand extends Command {
5
+ // define flags that can be inherited by any command that extends BaseCommand
6
+ static baseFlags = {
7
+ 'profile': Flags.string({
8
+ description: 'Specify the configuration profile to use',
9
+ }),
10
+ };
11
+ args;
12
+ cliConfiguration = new CliConfiguration();
13
+ flags;
14
+ async catch(err) {
15
+ return super.catch(err);
16
+ }
17
+ async finally(_) {
18
+ return super.finally(_);
19
+ }
20
+ async init() {
21
+ await super.init();
22
+ const { args, flags } = await this.parse({
23
+ args: this.ctor.args,
24
+ baseFlags: super.ctor.baseFlags,
25
+ flags: this.ctor.flags,
26
+ strict: this.ctor.strict,
27
+ });
28
+ this.cliConfiguration.init(flags.profile || "default", this.config.configDir);
29
+ this.flags = flags;
30
+ this.args = args;
31
+ }
32
+ }
@@ -0,0 +1,13 @@
1
+ import { BaseCommand } from "../../base-command.js";
2
+ export default class Set extends BaseCommand<typeof Set> {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ clientId: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
7
+ clientSecret: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
8
+ loginUrl: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
9
+ port: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
10
+ url: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
11
+ };
12
+ run(): Promise<void>;
13
+ }
@@ -0,0 +1,45 @@
1
+ import { Flags } from '@oclif/core';
2
+ import pkg from "enquirer";
3
+ import _ from "lodash";
4
+ import { BaseCommand } from "../../base-command.js";
5
+ const { prompt } = pkg;
6
+ export default class Set extends BaseCommand {
7
+ static description = 'Configure the cli';
8
+ static examples = [
9
+ '<%= config.bin %> <%= command.id %> -l https://auth.flowcore.io/realms/flowcore/.well-known/openid-configuration -c my-client-id -s my-client-secret',
10
+ '<%= config.bin %> <%= command.id %> -u https://graph.api.flowcore.io/graphql',
11
+ '<%= config.bin %> <%= command.id %> -l https://auth.flowcore.io/realms/flowcore/.well-known/openid-configuration -c my-client-id -p',
12
+ ];
13
+ static flags = {
14
+ clientId: Flags.string({ char: 'c', description: 'client id to use for the login' }),
15
+ clientSecret: Flags.string({ char: 'n', description: 'name to print' }),
16
+ loginUrl: Flags.string({ char: 'l', description: 'url to discover the openid configuration' }),
17
+ port: Flags.boolean({ char: 'p', description: 'prompt for port to listen for the callback' }),
18
+ url: Flags.string({ char: 'u', description: 'url to the flowcore platform api' }),
19
+ };
20
+ async run() {
21
+ const { flags } = await this.parse(Set);
22
+ let callbackPort;
23
+ if (flags.port) {
24
+ const port = await prompt([{
25
+ choices: ["3000", "4000", "5000", "6000"],
26
+ message: "Select a port to listen for the callback",
27
+ name: "callbackPort",
28
+ type: "select"
29
+ }]);
30
+ callbackPort = port.callbackPort;
31
+ }
32
+ console.log(flags);
33
+ this.cliConfiguration.setConfig({
34
+ ...(flags.url && { api: {
35
+ url: flags.url,
36
+ } }),
37
+ login: {
38
+ ...(callbackPort && { callbackPort }),
39
+ ...(flags.loginUrl && { url: flags.loginUrl }),
40
+ ..._.omit(flags, ["port", "url", "loginUrl"]),
41
+ }
42
+ });
43
+ this.cliConfiguration.displayConfigTable(this.log.bind(this));
44
+ }
45
+ }
@@ -0,0 +1,6 @@
1
+ import { BaseCommand } from "../../base-command.js";
2
+ export default class LoginShow extends BaseCommand<typeof LoginShow> {
3
+ static description: string;
4
+ static examples: string[];
5
+ run(): Promise<void>;
6
+ }
@@ -0,0 +1,11 @@
1
+ import { BaseCommand } from "../../base-command.js";
2
+ export default class LoginShow extends BaseCommand {
3
+ static description = 'Show the configured login url';
4
+ static examples = [
5
+ '<%= config.bin %> <%= command.id %>',
6
+ ];
7
+ async run() {
8
+ this.log(`Showing configuration for ${this.cliConfiguration.getSelectedProfile()}`);
9
+ this.cliConfiguration.displayConfigTable(this.log.bind(this));
10
+ }
11
+ }
@@ -0,0 +1,19 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import * as http from "node:http";
3
+ import { BaseClient } from "openid-client";
4
+ import { BaseCommand } from "../base-command.js";
5
+ export default class Login extends BaseCommand<typeof Login> {
6
+ static description: string;
7
+ static examples: string[];
8
+ static flags: {
9
+ port: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<number, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
10
+ };
11
+ protected client: BaseClient | undefined;
12
+ protected server: http.Server | undefined;
13
+ protected catch(err: Error & {
14
+ exitCode?: number;
15
+ }): Promise<unknown>;
16
+ protected init(): Promise<void>;
17
+ run(): Promise<void>;
18
+ private writeToken;
19
+ }