@flowcore/cli 2.5.2 → 2.7.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/CHANGELOG.md CHANGED
@@ -10,6 +10,20 @@
10
10
 
11
11
  * added description to start that includes week ([58687a7](https://github.com/flowcore-io/flowcore-cli/commit/58687a7bbb66aaa5d6da26af88e555cbb1e72467))
12
12
 
13
+ ## [2.7.0](https://github.com/flowcore-io/flowcore-cli/compare/v2.6.0...v2.7.0) (2024-02-22)
14
+
15
+
16
+ ### Features
17
+
18
+ * add generate manifest commands for scenario and data core ([551d80f](https://github.com/flowcore-io/flowcore-cli/commit/551d80f47e6537cb26e56ce9f69f4b25bb554ef2))
19
+
20
+ ## [2.6.0](https://github.com/flowcore-io/flowcore-cli/compare/v2.5.2...v2.6.0) (2024-02-22)
21
+
22
+
23
+ ### Features
24
+
25
+ * add option to add headers to stream ([41f88f3](https://github.com/flowcore-io/flowcore-cli/commit/41f88f39f53c233705507e7b3ece8bbf346b76e2))
26
+
13
27
  ## [2.5.2](https://github.com/flowcore-io/flowcore-cli/compare/v2.5.1...v2.5.2) (2024-02-22)
14
28
 
15
29
 
package/README.md CHANGED
@@ -18,7 +18,7 @@ $ npm install -g @flowcore/cli
18
18
  $ flowcore COMMAND
19
19
  running command...
20
20
  $ flowcore (--version)
21
- @flowcore/cli/2.5.2 linux-x64 node-v20.11.1
21
+ @flowcore/cli/2.7.0 linux-x64 node-v20.11.1
22
22
  $ flowcore --help [COMMAND]
23
23
  USAGE
24
24
  $ flowcore COMMAND
@@ -32,6 +32,9 @@ USAGE
32
32
  * [`flowcore config set`](#flowcore-config-set)
33
33
  * [`flowcore config show`](#flowcore-config-show)
34
34
  * [`flowcore data-core apply`](#flowcore-data-core-apply)
35
+ * [`flowcore data-core generate event-type FLOWTYPE`](#flowcore-data-core-generate-event-type-flowtype)
36
+ * [`flowcore data-core generate flow-type`](#flowcore-data-core-generate-flow-type)
37
+ * [`flowcore data-core generate manifest`](#flowcore-data-core-generate-manifest)
35
38
  * [`flowcore help [COMMANDS]`](#flowcore-help-commands)
36
39
  * [`flowcore login`](#flowcore-login)
37
40
  * [`flowcore plugins`](#flowcore-plugins)
@@ -45,6 +48,8 @@ USAGE
45
48
  * [`flowcore plugins:uninstall PLUGIN...`](#flowcore-pluginsuninstall-plugin-2)
46
49
  * [`flowcore plugins update`](#flowcore-plugins-update)
47
50
  * [`flowcore scenario apply`](#flowcore-scenario-apply)
51
+ * [`flowcore scenario generate manifest`](#flowcore-scenario-generate-manifest)
52
+ * [`flowcore scenario generate transformer`](#flowcore-scenario-generate-transformer)
48
53
  * [`flowcore scenario local`](#flowcore-scenario-local)
49
54
  * [`flowcore stream STREAM`](#flowcore-stream-stream)
50
55
  * [`flowcore version`](#flowcore-version)
@@ -70,7 +75,7 @@ EXAMPLES
70
75
  $ flowcore apply -f ./path/to/manifest.yml
71
76
  ```
72
77
 
73
- _See code: [src/commands/apply.ts](https://github.com/flowcore-io/flowcore-cli/blob/v2.5.2/src/commands/apply.ts)_
78
+ _See code: [src/commands/apply.ts](https://github.com/flowcore-io/flowcore-cli/blob/v2.7.0/src/commands/apply.ts)_
74
79
 
75
80
  ## `flowcore autocomplete [SHELL]`
76
81
 
@@ -180,7 +185,93 @@ EXAMPLES
180
185
  $ cat <<EOF | flowcore data-core apply -f -
181
186
  ```
182
187
 
183
- _See code: [@flowcore/cli-plugin-data-core](https://github.com/flowcore/flowcore-cli-data-core/blob/v2.0.0/src/commands/data-core/apply.ts)_
188
+ _See code: [@flowcore/cli-plugin-data-core](https://github.com/flowcore/flowcore-cli-data-core/blob/v2.1.0/src/commands/data-core/apply.ts)_
189
+
190
+ ## `flowcore data-core generate event-type FLOWTYPE`
191
+
192
+ add a event type to a data core manifest
193
+
194
+ ```
195
+ USAGE
196
+ $ flowcore data-core generate event-type FLOWTYPE [--profile <value>] [-d <value>] [-f <value>] [-n <value>]
197
+
198
+ FLAGS
199
+ -d, --description=<value> description of the event type
200
+ -f, --file=<value> file to modify
201
+ -n, --name=<value> name of the event type to generate
202
+ --profile=<value> Specify the configuration profile to use
203
+
204
+ DESCRIPTION
205
+ add a event type to a data core manifest
206
+
207
+ EXAMPLES
208
+ $ flowcore data-core generate event-type flow-type-name -n event-type-name
209
+
210
+ $ flowcore data-core generate event-type flow-type-name -n event-type-name -d "description of the event type"
211
+
212
+ $ flowcore data-core generate event-type flow-type-name -n event-type-name -d "description of the event type" -f example.yaml
213
+ ```
214
+
215
+ _See code: [@flowcore/cli-plugin-data-core](https://github.com/flowcore/flowcore-cli-data-core/blob/v2.1.0/src/commands/data-core/generate/event-type.ts)_
216
+
217
+ ## `flowcore data-core generate flow-type`
218
+
219
+ add a flow type to a data core manifest
220
+
221
+ ```
222
+ USAGE
223
+ $ flowcore data-core generate flow-type [--profile <value>] [-d <value>] [-f <value>] [-n <value>]
224
+
225
+ FLAGS
226
+ -d, --description=<value> description of the flow type
227
+ -f, --file=<value> file to modify
228
+ -n, --name=<value> name of the flow type to generate
229
+ --profile=<value> Specify the configuration profile to use
230
+
231
+ DESCRIPTION
232
+ add a flow type to a data core manifest
233
+
234
+ EXAMPLES
235
+ $ flowcore data-core generate flow-type -n flow-type-name
236
+
237
+ $ flowcore data-core generate flow-type -n flow-type-name -d "description of the flow type"
238
+
239
+ $ flowcore data-core generate flow-type -n flow-type-name -d "description of the flow type" -f example.yaml
240
+ ```
241
+
242
+ _See code: [@flowcore/cli-plugin-data-core](https://github.com/flowcore/flowcore-cli-data-core/blob/v2.1.0/src/commands/data-core/generate/flow-type.ts)_
243
+
244
+ ## `flowcore data-core generate manifest`
245
+
246
+ Generate a data core manifest
247
+
248
+ ```
249
+ USAGE
250
+ $ flowcore data-core generate manifest -t <value> [--profile <value>] [-f <value>] [-n <value>] [-o] [--placeholder]
251
+
252
+ FLAGS
253
+ -f, --file=<value> file to apply
254
+ -n, --name=<value> name of the data core to generate
255
+ -o, --overwrite overwrite the existing data core
256
+ -t, --tenant=<value> (required) tenant to apply the data core to, this is the org for your organization, it can be
257
+ seen in the url when accessing your organization
258
+ --placeholder generate a placeholder manifest
259
+ --profile=<value> Specify the configuration profile to use
260
+
261
+ DESCRIPTION
262
+ Generate a data core manifest
263
+
264
+ EXAMPLES
265
+ $ flowcore data-core generate manifest -t flowcore
266
+
267
+ $ flowcore data-core generate manifest -t flowcore --placeholder
268
+
269
+ $ flowcore data-core generate manifest -t flowcore -f example.yaml
270
+
271
+ $ flowcore data-core generate manifest -t flowcore -n data-core-name -f example.yaml
272
+ ```
273
+
274
+ _See code: [@flowcore/cli-plugin-data-core](https://github.com/flowcore/flowcore-cli-data-core/blob/v2.1.0/src/commands/data-core/generate/manifest.ts)_
184
275
 
185
276
  ## `flowcore help [COMMANDS]`
186
277
 
@@ -532,7 +623,66 @@ EXAMPLES
532
623
  $ cat <<EOF | flowcore scenario apply -f -
533
624
  ```
534
625
 
535
- _See code: [@flowcore/cli-plugin-scenario](https://github.com/flowcore/flowcore-cli-plugin-scenario/blob/v2.3.0/src/commands/scenario/apply.ts)_
626
+ _See code: [@flowcore/cli-plugin-scenario](https://github.com/flowcore/flowcore-cli-plugin-scenario/blob/v2.5.0/src/commands/scenario/apply.ts)_
627
+
628
+ ## `flowcore scenario generate manifest`
629
+
630
+ Generate a scenario manifest
631
+
632
+ ```
633
+ USAGE
634
+ $ flowcore scenario generate manifest -t <value> [--profile <value>] [-f <value>] [-n <value>] [-o] [--placeholder]
635
+
636
+ FLAGS
637
+ -f, --file=<value> file to apply
638
+ -n, --name=<value> name of the scenario to generate
639
+ -o, --overwrite overwrite the existing scenario
640
+ -t, --tenant=<value> (required) tenant to apply the scenario to, this is the org for your organization, it can be
641
+ seen in the url when accessing your organization
642
+ --placeholder generate a placeholder manifest
643
+ --profile=<value> Specify the configuration profile to use
644
+
645
+ DESCRIPTION
646
+ Generate a scenario manifest
647
+
648
+ EXAMPLES
649
+ $ flowcore scenario generate manifest -t flowcore
650
+
651
+ $ flowcore scenario generate manifest -t flowcore --placeholder
652
+
653
+ $ flowcore scenario generate manifest -t flowcore -f example.yaml
654
+
655
+ $ flowcore scenario generate manifest -t flowcore -n scenario-name -f example.yaml
656
+ ```
657
+
658
+ _See code: [@flowcore/cli-plugin-scenario](https://github.com/flowcore/flowcore-cli-plugin-scenario/blob/v2.5.0/src/commands/scenario/generate/manifest.ts)_
659
+
660
+ ## `flowcore scenario generate transformer`
661
+
662
+ add a transformer to a scenario manifest
663
+
664
+ ```
665
+ USAGE
666
+ $ flowcore scenario generate transformer [--profile <value>] [-d <value>] [-f <value>] [-n <value>]
667
+
668
+ FLAGS
669
+ -d, --description=<value> description of the transformer
670
+ -f, --file=<value> file to modify
671
+ -n, --name=<value> name of the transformer to generate
672
+ --profile=<value> Specify the configuration profile to use
673
+
674
+ DESCRIPTION
675
+ add a transformer to a scenario manifest
676
+
677
+ EXAMPLES
678
+ $ flowcore scenario generate transformer -n flow-type-name
679
+
680
+ $ flowcore scenario generate transformer -n flow-type-name -d "description of the transformer"
681
+
682
+ $ flowcore scenario generate transformer -n flow-type-name -d "description of the transformer" -f example.yaml
683
+ ```
684
+
685
+ _See code: [@flowcore/cli-plugin-scenario](https://github.com/flowcore/flowcore-cli-plugin-scenario/blob/v2.5.0/src/commands/scenario/generate/transformer.ts)_
536
686
 
537
687
  ## `flowcore scenario local`
538
688
 
@@ -540,18 +690,20 @@ Spin up local stream threads based on a scenario manifest
540
690
 
541
691
  ```
542
692
  USAGE
543
- $ flowcore scenario local -e <value> -f <value> [--profile <value>] [-m http] [-c] [-s <value>] [-t <value>] [-y]
693
+ $ flowcore scenario local -e <value> -f <value> [--profile <value>] [-H <value>] [-m http] [-c] [-s <value>] [-t
694
+ <value>] [-y]
544
695
 
545
696
  FLAGS
546
- -c, --scan Scan the full time range
547
- -e, --endpoint=<value> (required) stream endpoint
548
- -f, --file=<value>... (required) file to apply
549
- -m, --mode=<option> [default: http] stream mode
550
- <options: http>
551
- -s, --start=<value> Start time bucket to stream from, example: (1y, 1m, 1w, 1d, 1h)
552
- -t, --timeout=<value> [default: 5000] Timeout in milliseconds to wait for a response from the destination
553
- -y, --yes skip confirmation
554
- --profile=<value> Specify the configuration profile to use
697
+ -H, --header=<value>... [default: ] header to send with the request, example: (-H 'Authorization: Bearer TOKEN')
698
+ -c, --scan Scan the full time range
699
+ -e, --endpoint=<value> (required) stream endpoint
700
+ -f, --file=<value>... (required) file to apply
701
+ -m, --mode=<option> [default: http] stream mode
702
+ <options: http>
703
+ -s, --start=<value> Start time bucket to stream from, example: (1y, 1m, 1w, 1d, 1h)
704
+ -t, --timeout=<value> [default: 5000] Timeout in milliseconds to wait for a response from the destination
705
+ -y, --yes skip confirmation
706
+ --profile=<value> Specify the configuration profile to use
555
707
 
556
708
  DESCRIPTION
557
709
  Spin up local stream threads based on a scenario manifest
@@ -562,7 +714,7 @@ EXAMPLES
562
714
  $ cat <<EOF | flowcore scenario local -f -
563
715
  ```
564
716
 
565
- _See code: [@flowcore/cli-plugin-scenario](https://github.com/flowcore/flowcore-cli-plugin-scenario/blob/v2.3.0/src/commands/scenario/local.ts)_
717
+ _See code: [@flowcore/cli-plugin-scenario](https://github.com/flowcore/flowcore-cli-plugin-scenario/blob/v2.5.0/src/commands/scenario/local.ts)_
566
718
 
567
719
  ## `flowcore stream STREAM`
568
720
 
@@ -570,13 +722,14 @@ Stream events from a datacore running on the Flowcore Platform
570
722
 
571
723
  ```
572
724
  USAGE
573
- $ flowcore stream STREAM [--profile <value>] [-d <value>] [-j] [-l] [-o http|log] [-c] [-s <value>] [-t
574
- <value>]
725
+ $ flowcore stream STREAM [--profile <value>] [-d <value>] [-H <value>] [-j] [-l] [-o http|log] [-c] [-s
726
+ <value>] [-t <value>]
575
727
 
576
728
  ARGUMENTS
577
729
  STREAM stream url to connect to
578
730
 
579
731
  FLAGS
732
+ -H, --header=<value>... [default: ] header to send with the request, example: (-H 'Authorization: Bearer TOKEN')
580
733
  -c, --scan Scan the full time range
581
734
  -d, --destination=<value> [default: http://localhost:3000/transform] Destination to send events to
582
735
  -j, --json Output json only
@@ -600,7 +753,7 @@ EXAMPLES
600
753
  $ flowcore stream https://flowcore.io/<org>/<data core>/<flow type>/[<event type1>,<event type2>,<event type3>].stream -o log -s 3m
601
754
  ```
602
755
 
603
- _See code: [src/commands/stream.ts](https://github.com/flowcore-io/flowcore-cli/blob/v2.5.2/src/commands/stream.ts)_
756
+ _See code: [src/commands/stream.ts](https://github.com/flowcore-io/flowcore-cli/blob/v2.7.0/src/commands/stream.ts)_
604
757
 
605
758
  ## `flowcore version`
606
759
 
@@ -7,6 +7,7 @@ export default class Stream extends BaseCommand<typeof Stream> {
7
7
  static examples: string[];
8
8
  static flags: {
9
9
  destination: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
10
+ header: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string[], import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
10
11
  json: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
11
12
  live: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
12
13
  output: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
@@ -27,6 +27,7 @@ export default class Stream extends BaseCommand {
27
27
  ];
28
28
  static flags = {
29
29
  destination: Flags.string({ char: 'd', default: "http://localhost:3000/transform", description: 'Destination to send events to' }),
30
+ header: Flags.string({ char: 'H', default: [], description: 'header to send with the request, example: (-H \'Authorization: Bearer TOKEN\')', multiple: true }),
30
31
  json: Flags.boolean({ char: 'j', description: 'Output json only' }),
31
32
  live: Flags.boolean({ allowNo: true, char: 'l', default: true, description: 'Change to live mode when reaching last time bucket' }),
32
33
  output: Flags.string({ char: 'o', default: 'http', description: 'Output format', options: ['http', 'log'] }),
@@ -36,6 +37,12 @@ export default class Stream extends BaseCommand {
36
37
  };
37
38
  async run() {
38
39
  const { args, flags } = await this.parse(Stream);
40
+ for (const header of flags.header) {
41
+ const parts = header.split(": ");
42
+ if (parts.length !== 2) {
43
+ ux.error(`Invalid header: ${header}. (correct example: -H 'X-Custom-Header: some value')`);
44
+ }
45
+ }
39
46
  const parts = args.STREAM.replace(/https?:\/\//i, "").split("/");
40
47
  if (parts.length !== 5) {
41
48
  ux.error(`Invalid stream url, ${args.STREAM}`);
@@ -98,7 +105,7 @@ export default class Stream extends BaseCommand {
98
105
  !this.flags.json && this.log(ux.colorize("blackBright", `Starting to stream events for ${dataCoreId} - ${aggregator} - ${eventTypes}, press ${ux.colorize("whiteBright", "ctrl+c")} to stop`));
99
106
  // eslint-disable-next-line no-void
100
107
  void this.streamEvents(dataCoreId, aggregator, eventTypes, firstTimeBucket, lastTimeBucket, graphqlClient, observer, flags.live);
101
- await this.processEvents(observer, flags.destination, flags.output);
108
+ await this.processEvents(observer, flags.destination, flags.output, flags.header);
102
109
  }
103
110
  calculateBuckets(timediff, startTimeBucket) {
104
111
  return _.times(timediff + 1, (n) => dayjs(startTimeBucket).add(n, "hour").format(TIME_BUCKET_PATTERN));
@@ -149,7 +156,7 @@ export default class Stream extends BaseCommand {
149
156
  }
150
157
  return timeBuckets;
151
158
  }
152
- async processEvents(observer, destination, output) {
159
+ async processEvents(observer, destination, output, header = []) {
153
160
  let done = false;
154
161
  let events = [];
155
162
  const warn = this.flags.json ? () => { } : this.warn.bind(this);
@@ -181,11 +188,17 @@ export default class Stream extends BaseCommand {
181
188
  }
182
189
  !this.flags.json && this.log(`Sending event to ${destination}: ${event.eventId}`);
183
190
  try {
191
+ const headers = {};
192
+ for (const h of header) {
193
+ const [name, value] = h.split(": ");
194
+ headers[name] = value;
195
+ }
184
196
  // eslint-disable-next-line no-await-in-loop
185
197
  const result = await Promise.race([fetch(destination, {
186
198
  body: JSON.stringify(event),
187
199
  headers: {
188
200
  "Content-Type": "application/json",
201
+ ...headers,
189
202
  },
190
203
  method: "POST",
191
204
  }),
@@ -80,6 +80,15 @@
80
80
  "multiple": false,
81
81
  "type": "option"
82
82
  },
83
+ "header": {
84
+ "char": "H",
85
+ "description": "header to send with the request, example: (-H 'Authorization: Bearer TOKEN')",
86
+ "name": "header",
87
+ "default": [],
88
+ "hasDynamicHelp": false,
89
+ "multiple": true,
90
+ "type": "option"
91
+ },
83
92
  "json": {
84
93
  "char": "j",
85
94
  "description": "Output json only",
@@ -148,5 +157,5 @@
148
157
  ]
149
158
  }
150
159
  },
151
- "version": "2.5.2"
160
+ "version": "2.7.0"
152
161
  }
package/package.json CHANGED
@@ -6,8 +6,8 @@
6
6
  "dependencies": {
7
7
  "@datastructures-js/queue": "^4.2.3",
8
8
  "@flowcore/cli-plugin-config": "^1.0.5",
9
- "@flowcore/cli-plugin-data-core": "^2.0.0",
10
- "@flowcore/cli-plugin-scenario": "^2.3.0",
9
+ "@flowcore/cli-plugin-data-core": "^2.1.0",
10
+ "@flowcore/cli-plugin-scenario": "^2.5.0",
11
11
  "@flowcore/time-bucket": "^1.1.0",
12
12
  "@oclif/core": "^3",
13
13
  "@oclif/plugin-autocomplete": "^3.0.2",
@@ -89,7 +89,7 @@
89
89
  "prestart": "npm run build",
90
90
  "update-schema": "rover graph introspect https://graph.api.staging.flowcore.io/graphql -o schema.gql"
91
91
  },
92
- "version": "2.5.2",
92
+ "version": "2.7.0",
93
93
  "bugs": "https://github.com/flowcore-io/flowcore-cli/issues",
94
94
  "keywords": [
95
95
  "flowcore",