@flowcore/cli 2.0.0 → 2.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.
- package/CHANGELOG.md +7 -0
- package/README.md +6 -6
- package/dist/commands/stream.d.ts +2 -0
- package/dist/commands/stream.js +17 -5
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,13 @@
|
|
|
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.0.1](https://github.com/flowcore-io/flowcore-cli/compare/v2.0.0...v2.0.1) (2024-01-15)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* set to use scan mode when no time buckets are found ([f1fac44](https://github.com/flowcore-io/flowcore-cli/commit/f1fac447a058eb7a61eeff5690208203d27c0a79))
|
|
19
|
+
|
|
13
20
|
## [2.0.0](https://github.com/flowcore-io/flowcore-cli/compare/v1.3.0...v2.0.0) (2024-01-15)
|
|
14
21
|
|
|
15
22
|
|
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ $ npm install -g @flowcore/cli
|
|
|
17
17
|
$ flowcore COMMAND
|
|
18
18
|
running command...
|
|
19
19
|
$ flowcore (--version)
|
|
20
|
-
@flowcore/cli/2.0.
|
|
20
|
+
@flowcore/cli/2.0.1 linux-x64 node-v20.10.0
|
|
21
21
|
$ flowcore --help [COMMAND]
|
|
22
22
|
USAGE
|
|
23
23
|
$ flowcore COMMAND
|
|
@@ -103,7 +103,7 @@ EXAMPLES
|
|
|
103
103
|
$ flowcore config set -l https://auth.flowcore.io/realms/flowcore/.well-known/openid-configuration -c my-client-id -p
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
-
_See code: [src/commands/config/set.ts](https://github.com/flowcore-io/flowcore-cli/blob/v2.0.
|
|
106
|
+
_See code: [src/commands/config/set.ts](https://github.com/flowcore-io/flowcore-cli/blob/v2.0.1/src/commands/config/set.ts)_
|
|
107
107
|
|
|
108
108
|
## `flowcore config show`
|
|
109
109
|
|
|
@@ -123,7 +123,7 @@ EXAMPLES
|
|
|
123
123
|
$ flowcore config show
|
|
124
124
|
```
|
|
125
125
|
|
|
126
|
-
_See code: [src/commands/config/show.ts](https://github.com/flowcore-io/flowcore-cli/blob/v2.0.
|
|
126
|
+
_See code: [src/commands/config/show.ts](https://github.com/flowcore-io/flowcore-cli/blob/v2.0.1/src/commands/config/show.ts)_
|
|
127
127
|
|
|
128
128
|
## `flowcore help [COMMANDS]`
|
|
129
129
|
|
|
@@ -166,7 +166,7 @@ EXAMPLES
|
|
|
166
166
|
$ flowcore login --port 8080
|
|
167
167
|
```
|
|
168
168
|
|
|
169
|
-
_See code: [src/commands/login.ts](https://github.com/flowcore-io/flowcore-cli/blob/v2.0.
|
|
169
|
+
_See code: [src/commands/login.ts](https://github.com/flowcore-io/flowcore-cli/blob/v2.0.1/src/commands/login.ts)_
|
|
170
170
|
|
|
171
171
|
## `flowcore plugins`
|
|
172
172
|
|
|
@@ -479,7 +479,7 @@ EXAMPLES
|
|
|
479
479
|
$ flowcore stream https://flowcore.io/<org>/<data core>/<flow type>/[<event type1>,<event type2>,<event type3>].stream -o log -s 3m
|
|
480
480
|
```
|
|
481
481
|
|
|
482
|
-
_See code: [src/commands/stream.ts](https://github.com/flowcore-io/flowcore-cli/blob/v2.0.
|
|
482
|
+
_See code: [src/commands/stream.ts](https://github.com/flowcore-io/flowcore-cli/blob/v2.0.1/src/commands/stream.ts)_
|
|
483
483
|
|
|
484
484
|
## `flowcore version`
|
|
485
485
|
|
|
@@ -516,5 +516,5 @@ DESCRIPTION
|
|
|
516
516
|
Check what user you are logged in as
|
|
517
517
|
```
|
|
518
518
|
|
|
519
|
-
_See code: [src/commands/whoami.ts](https://github.com/flowcore-io/flowcore-cli/blob/v2.0.
|
|
519
|
+
_See code: [src/commands/whoami.ts](https://github.com/flowcore-io/flowcore-cli/blob/v2.0.1/src/commands/whoami.ts)_
|
|
520
520
|
<!-- commandsstop -->
|
|
@@ -15,6 +15,8 @@ export default class Stream extends BaseCommand<typeof Stream> {
|
|
|
15
15
|
timeout: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<number, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
16
16
|
};
|
|
17
17
|
run(): Promise<void>;
|
|
18
|
+
private calculateBuckets;
|
|
19
|
+
private calculateTimeDifferenceInHours;
|
|
18
20
|
private fetchTimeBuckets;
|
|
19
21
|
private processEvents;
|
|
20
22
|
private setTimeBucket;
|
package/dist/commands/stream.js
CHANGED
|
@@ -97,6 +97,16 @@ export default class Stream extends BaseCommand {
|
|
|
97
97
|
void this.streamEvents(dataCoreId, aggregator, eventTypes, firstTimeBucket, lastTimeBucket, graphqlClient, observer, flags.live);
|
|
98
98
|
await this.processEvents(observer, flags.destination, flags.output);
|
|
99
99
|
}
|
|
100
|
+
calculateBuckets(timediff, startTimeBucket) {
|
|
101
|
+
return _.times(timediff + 1, (n) => dayjs(startTimeBucket).add(n, "hour").format(TIME_BUCKET_PATTERN));
|
|
102
|
+
}
|
|
103
|
+
calculateTimeDifferenceInHours(lastTimeBucket, startTimeBucket, firstTimeBucket) {
|
|
104
|
+
const timediff = dayjs(lastTimeBucket, TIME_BUCKET_HOUR_PATTERN).diff(startTimeBucket, "hour");
|
|
105
|
+
if (timediff < 0) {
|
|
106
|
+
ux.error(`Invalid time range, start time bucket (${ux.colorize("yellow", firstTimeBucket)}) is after last time bucket (${ux.colorize("yellow", lastTimeBucket)})`);
|
|
107
|
+
}
|
|
108
|
+
return timediff;
|
|
109
|
+
}
|
|
100
110
|
async fetchTimeBuckets(dataCoreId, aggregator, eventTypes, startTimeBucket, lastTimeBucket, graphqlClient) {
|
|
101
111
|
!this.flags.json && ux.action.start("Fetching time buckets");
|
|
102
112
|
let timeBuckets = [];
|
|
@@ -129,6 +139,11 @@ export default class Stream extends BaseCommand {
|
|
|
129
139
|
}
|
|
130
140
|
timeBuckets = _.uniq(timeBuckets);
|
|
131
141
|
!this.flags.json && ux.action.stop(`Found ${timeBuckets.length} time buckets`);
|
|
142
|
+
if (timeBuckets.length === 0) {
|
|
143
|
+
!this.flags.json && this.warn("No time buckets found, setting to scan based on requested time range");
|
|
144
|
+
const timediff = this.calculateTimeDifferenceInHours(lastTimeBucket, startTimeBucket, createTimebucket(dayjs()));
|
|
145
|
+
timeBuckets = this.calculateBuckets(timediff, startTimeBucket);
|
|
146
|
+
}
|
|
132
147
|
return timeBuckets;
|
|
133
148
|
}
|
|
134
149
|
async processEvents(observer, destination, output) {
|
|
@@ -225,12 +240,9 @@ export default class Stream extends BaseCommand {
|
|
|
225
240
|
const currentTime = dayjs.utc();
|
|
226
241
|
let liveMode = false;
|
|
227
242
|
let lastEventId = null;
|
|
228
|
-
const timediff =
|
|
229
|
-
if (timediff < 0) {
|
|
230
|
-
ux.error(`Invalid time range, start time bucket (${ux.colorize("yellow", firstTimeBucket)}) is after last time bucket (${ux.colorize("yellow", lastTimeBucket)})`);
|
|
231
|
-
}
|
|
243
|
+
const timediff = this.calculateTimeDifferenceInHours(lastTimeBucket, startTimeBucket, firstTimeBucket);
|
|
232
244
|
let timeBuckets = [];
|
|
233
|
-
timeBuckets = this.flags.scan ?
|
|
245
|
+
timeBuckets = this.flags.scan ? this.calculateBuckets(timediff, startTimeBucket) : (await this.fetchTimeBuckets(dataCoreId, aggregator, eventTypes, startTimeBucket, lastTimeBucket, graphqlClient));
|
|
234
246
|
// eslint-disable-next-line no-constant-condition
|
|
235
247
|
while (true) {
|
|
236
248
|
const timeBucket = timeBuckets.shift();
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"prestart": "npm run build",
|
|
87
87
|
"update-schema": "rover graph introspect https://graph.api.staging.flowcore.io/graphql -o schema.gql"
|
|
88
88
|
},
|
|
89
|
-
"version": "2.0.
|
|
89
|
+
"version": "2.0.1",
|
|
90
90
|
"bugs": "https://github.com/flowcore-io/flowcore-cli/issues",
|
|
91
91
|
"keywords": [
|
|
92
92
|
"flowcore",
|