@flowcore/cli 4.9.1 → 4.10.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 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
+ ## [4.10.1](https://github.com/flowcore-io/flowcore-cli/compare/v4.10.0...v4.10.1) (2024-11-01)
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * update plugin core ([c1f2c25](https://github.com/flowcore-io/flowcore-cli/commit/c1f2c258eee8367ce74c0a8a05575ff3442b806d))
19
+
20
+ ## [4.10.0](https://github.com/flowcore-io/flowcore-cli/compare/v4.9.1...v4.10.0) (2024-10-25)
21
+
22
+
23
+ ### Features
24
+
25
+ * **apply:** :sparkles: added new diff command to diff supplied resources with applied ones ([2b42f91](https://github.com/flowcore-io/flowcore-cli/commit/2b42f91d011b4707bf34965eba8f81becef788c0))
26
+
13
27
  ## [4.9.1](https://github.com/flowcore-io/flowcore-cli/compare/v4.9.0...v4.9.1) (2024-10-23)
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/4.9.1 linux-x64 node-v20.18.0
21
+ @flowcore/cli/4.10.1 linux-x64 node-v20.18.0
22
22
  $ flowcore --help [COMMAND]
23
23
  USAGE
24
24
  $ flowcore COMMAND
@@ -43,6 +43,7 @@ USAGE
43
43
  * [`flowcore data-core generate flow-type`](#flowcore-data-core-generate-flow-type)
44
44
  * [`flowcore data-core init`](#flowcore-data-core-init)
45
45
  * [`flowcore delete`](#flowcore-delete)
46
+ * [`flowcore diff`](#flowcore-diff)
46
47
  * [`flowcore generate nextjs-entity NAME`](#flowcore-generate-nextjs-entity-name)
47
48
  * [`flowcore get adapter [ADAPTER]`](#flowcore-get-adapter-adapter)
48
49
  * [`flowcore get scenario [SCENARIO]`](#flowcore-get-scenario-scenario)
@@ -98,7 +99,7 @@ EXAMPLES
98
99
  $ flowcore apply -f ./path/to/manifest.yml
99
100
  ```
100
101
 
101
- _See code: [src/commands/apply.ts](https://github.com/flowcore-io/flowcore-cli/blob/v4.9.1/src/commands/apply.ts)_
102
+ _See code: [src/commands/apply.ts](https://github.com/flowcore-io/flowcore-cli/blob/v4.10.1/src/commands/apply.ts)_
102
103
 
103
104
  ## `flowcore auth delete key API_KEY_NAME`
104
105
 
@@ -482,7 +483,28 @@ EXAMPLES
482
483
  cat ./path/to/manifest.yml | flowcore delete -f -
483
484
  ```
484
485
 
485
- _See code: [src/commands/delete.ts](https://github.com/flowcore-io/flowcore-cli/blob/v4.9.1/src/commands/delete.ts)_
486
+ _See code: [src/commands/delete.ts](https://github.com/flowcore-io/flowcore-cli/blob/v4.10.1/src/commands/delete.ts)_
487
+
488
+ ## `flowcore diff`
489
+
490
+ Diff a resource manifests against the Flowcore Platform
491
+
492
+ ```
493
+ USAGE
494
+ $ flowcore diff -f <value> [--profile <value>]
495
+
496
+ FLAGS
497
+ -f, --file=<value>... (required) file or directory to diff
498
+ --profile=<value> Specify the configuration profile to use
499
+
500
+ DESCRIPTION
501
+ Diff a resource manifests against the Flowcore Platform
502
+
503
+ EXAMPLES
504
+ $ flowcore diff -f ./path/to/manifest.yml
505
+ ```
506
+
507
+ _See code: [src/commands/diff.ts](https://github.com/flowcore-io/flowcore-cli/blob/v4.10.1/src/commands/diff.ts)_
486
508
 
487
509
  ## `flowcore generate nextjs-entity NAME`
488
510
 
@@ -627,7 +649,7 @@ EXAMPLES
627
649
  $ flowcore info
628
650
  ```
629
651
 
630
- _See code: [src/commands/info.ts](https://github.com/flowcore-io/flowcore-cli/blob/v4.9.1/src/commands/info.ts)_
652
+ _See code: [src/commands/info.ts](https://github.com/flowcore-io/flowcore-cli/blob/v4.10.1/src/commands/info.ts)_
631
653
 
632
654
  ## `flowcore login`
633
655
 
@@ -1268,20 +1290,22 @@ Stream events from a datacore running on the Flowcore Platform and output them t
1268
1290
 
1269
1291
  ```
1270
1292
  USAGE
1271
- $ flowcore stream STREAM [-e <value>] [-j] [-l] [-m <value>] [-p] [-c] [-s <value>] [--profile <value>]
1293
+ $ flowcore stream STREAM [-e <value>] [-j] [-l] [-m <value>] [-p] [-c] [-s <value>] [-z <value>]
1294
+ [--profile <value>]
1272
1295
 
1273
1296
  ARGUMENTS
1274
1297
  STREAM stream url to connect to
1275
1298
 
1276
1299
  FLAGS
1277
- -c, --scan Scan the full time range
1278
- -e, --end=<value> End time to stream to, example: 2024-07-08T12:20:44Z, 1y, 1m, 1w, 1d, 1h, now
1279
- -j, --json Output json only
1280
- -l, --[no-]live Change to live mode when reaching last time bucket
1281
- -m, --max=<value> Maximum number of events to send to the destination
1282
- -p, --payload Only send the event payload to the destination
1283
- -s, --start=<value> Start time bucket to stream from, example: (2024-07-08T12:20:44Z, 1y, 1m, 1w, 1d, 1h, now)
1284
- --profile=<value> Specify the configuration profile to use
1300
+ -c, --scan Scan the full time range
1301
+ -e, --end=<value> End time to stream to, example: 2024-07-08T12:20:44Z, 1y, 1m, 1w, 1d, 1h, now
1302
+ -j, --json Output json only
1303
+ -l, --[no-]live Change to live mode when reaching last time bucket
1304
+ -m, --max=<value> Maximum number of events to send to the destination
1305
+ -p, --payload Only send the event payload to the destination
1306
+ -s, --start=<value> Start time bucket to stream from, example: (2024-07-08T12:20:44Z, 1y, 1m, 1w, 1d, 1h, now)
1307
+ -z, --pageSize=<value> [default: 10000] Number of events to fetch per page
1308
+ --profile=<value> Specify the configuration profile to use
1285
1309
 
1286
1310
  DESCRIPTION
1287
1311
  Stream events from a datacore running on the Flowcore Platform and output them to the console
@@ -1300,7 +1324,7 @@ EXAMPLES
1300
1324
  $ flowcore stream "https://flowcore.io/<org>/<data core>/<flow type>/[<event type1>,<event type2>,<event type3>].stream" -s 3m
1301
1325
  ```
1302
1326
 
1303
- _See code: [@flowcore/cli-plugin-core](https://github.com/flowcore/flowcore-cli-plugin-core/blob/v4.6.0/src/commands/stream.ts)_
1327
+ _See code: [@flowcore/cli-plugin-core](https://github.com/flowcore/flowcore-cli-plugin-core/blob/v4.9.0/src/commands/stream.ts)_
1304
1328
 
1305
1329
  ## `flowcore stream http STREAM`
1306
1330
 
@@ -1308,8 +1332,8 @@ Stream events from a datacore running on the Flowcore Platform and stream to a h
1308
1332
 
1309
1333
  ```
1310
1334
  USAGE
1311
- $ flowcore stream http STREAM [-e <value>] [-j] [-l] [-m <value>] [-p] [-c] [-s <value>] [--profile <value>]
1312
- [-d <value>] [-H <value>] [-t <value>]
1335
+ $ flowcore stream http STREAM [-e <value>] [-j] [-l] [-m <value>] [-p] [-c] [-s <value>] [-z <value>]
1336
+ [--profile <value>] [-d <value>] [-H <value>] [-t <value>]
1313
1337
 
1314
1338
  ARGUMENTS
1315
1339
  STREAM stream url to connect to
@@ -1325,6 +1349,7 @@ FLAGS
1325
1349
  -p, --payload Only send the event payload to the destination
1326
1350
  -s, --start=<value> Start time bucket to stream from, example: (2024-07-08T12:20:44Z, 1y, 1m, 1w, 1d, 1h, now)
1327
1351
  -t, --timeout=<value> [default: 5000] Timeout in milliseconds to wait for a response from the destination
1352
+ -z, --pageSize=<value> [default: 10000] Number of events to fetch per page
1328
1353
  --profile=<value> Specify the configuration profile to use
1329
1354
 
1330
1355
  DESCRIPTION
@@ -1342,7 +1367,7 @@ EXAMPLES
1342
1367
  $ flowcore stream http "https://flowcore.io/<org>/<data core>/<flow type>/[<event type1>,<event type2>,<event type3>].stream" -s 3m -d http://localhost:3000/transform
1343
1368
  ```
1344
1369
 
1345
- _See code: [@flowcore/cli-plugin-core](https://github.com/flowcore/flowcore-cli-plugin-core/blob/v4.6.0/src/commands/stream/http.ts)_
1370
+ _See code: [@flowcore/cli-plugin-core](https://github.com/flowcore/flowcore-cli-plugin-core/blob/v4.9.0/src/commands/stream/http.ts)_
1346
1371
 
1347
1372
  ## `flowcore version`
1348
1373
 
@@ -0,0 +1,10 @@
1
+ import { BaseCommand } from "@flowcore/cli-plugin-config";
2
+ export default class Diff extends BaseCommand<typeof Diff> {
3
+ static args: {};
4
+ static description: string;
5
+ static examples: string[];
6
+ static flags: {
7
+ file: import("@oclif/core/interfaces").OptionFlag<string[], import("@oclif/core/interfaces").CustomOptions>;
8
+ };
9
+ run(): Promise<void>;
10
+ }
@@ -0,0 +1,56 @@
1
+ import { BaseCommand } from "@flowcore/cli-plugin-config";
2
+ import { ApiRegistryService, baseResourceDto } from "@flowcore/cli-plugin-core";
3
+ import { Flags } from "@oclif/core";
4
+ import dayjs from "dayjs";
5
+ import isSameOrBefore from "dayjs/plugin/isSameOrBefore.js";
6
+ import utc from "dayjs/plugin/utc.js";
7
+ import * as yaml from "js-yaml";
8
+ import fs from "node:fs";
9
+ import { join } from "node:path";
10
+ dayjs.extend(utc);
11
+ dayjs.extend(isSameOrBefore);
12
+ export default class Diff extends BaseCommand {
13
+ static args = {};
14
+ static description = "Diff a resource manifests against the Flowcore Platform";
15
+ static examples = [
16
+ "<%= config.bin %> <%= command.id %> -f ./path/to/manifest.yml",
17
+ ];
18
+ static flags = {
19
+ file: Flags.string({
20
+ char: "f",
21
+ description: "file or directory to diff",
22
+ multiple: true,
23
+ required: true,
24
+ }),
25
+ };
26
+ async run() {
27
+ const { flags } = await this.parse(Diff);
28
+ const apiRegistry = ApiRegistryService.getInstance(this.logger);
29
+ await this.config.runHook("register-api", {
30
+ apiRegistry,
31
+ cliConfiguration: this.cliConfiguration,
32
+ logger: this.logger,
33
+ });
34
+ try {
35
+ let documents = [];
36
+ if (fs.statSync(flags.file[0]).isDirectory()) {
37
+ const files = fs.readdirSync(flags.file[0]);
38
+ documents = files.flatMap((file) => {
39
+ const content = fs.readFileSync(join(flags.file[0], file), "utf8");
40
+ return yaml.loadAll(content);
41
+ });
42
+ }
43
+ else {
44
+ documents = flags.file.flatMap((file) => {
45
+ const content = fs.readFileSync(file, "utf8");
46
+ return yaml.loadAll(content);
47
+ });
48
+ }
49
+ documents.map((doc) => baseResourceDto.parse(doc));
50
+ await apiRegistry.showDiff(documents);
51
+ }
52
+ catch (error) {
53
+ this.logger.fatal(`Failed to diff documents with error: ${error}`);
54
+ }
55
+ }
56
+ }
@@ -101,6 +101,46 @@
101
101
  "delete.js"
102
102
  ]
103
103
  },
104
+ "diff": {
105
+ "aliases": [],
106
+ "args": {},
107
+ "description": "Diff a resource manifests against the Flowcore Platform",
108
+ "examples": [
109
+ "<%= config.bin %> <%= command.id %> -f ./path/to/manifest.yml"
110
+ ],
111
+ "flags": {
112
+ "profile": {
113
+ "description": "Specify the configuration profile to use",
114
+ "name": "profile",
115
+ "hasDynamicHelp": false,
116
+ "multiple": false,
117
+ "type": "option"
118
+ },
119
+ "file": {
120
+ "char": "f",
121
+ "description": "file or directory to diff",
122
+ "name": "file",
123
+ "required": true,
124
+ "hasDynamicHelp": false,
125
+ "multiple": true,
126
+ "type": "option"
127
+ }
128
+ },
129
+ "hasDynamicHelp": false,
130
+ "hiddenAliases": [],
131
+ "id": "diff",
132
+ "pluginAlias": "@flowcore/cli",
133
+ "pluginName": "@flowcore/cli",
134
+ "pluginType": "core",
135
+ "strict": true,
136
+ "enableJsonFlag": false,
137
+ "isESM": true,
138
+ "relativePath": [
139
+ "dist",
140
+ "commands",
141
+ "diff.js"
142
+ ]
143
+ },
104
144
  "info": {
105
145
  "aliases": [],
106
146
  "args": {},
@@ -133,5 +173,5 @@
133
173
  ]
134
174
  }
135
175
  },
136
- "version": "4.9.1"
176
+ "version": "4.10.1"
137
177
  }
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "@flowcore/cli-plugin-ai": "^1.1.2",
9
9
  "@flowcore/cli-plugin-auth-management": "^1.2.2",
10
10
  "@flowcore/cli-plugin-config": "^2.4.1",
11
- "@flowcore/cli-plugin-core": "^4.6.0",
11
+ "@flowcore/cli-plugin-core": "^4.9.0",
12
12
  "@flowcore/cli-plugin-data-core": "^3.1.1",
13
13
  "@flowcore/cli-plugin-generator": "^1.6.0",
14
14
  "@flowcore/cli-plugin-scenario": "^4.1.2",
@@ -112,7 +112,7 @@
112
112
  "prestart": "npm run build",
113
113
  "update-schema": "rover graph introspect https://graph.api.staging.flowcore.io/graphql -o schema.gql"
114
114
  },
115
- "version": "4.9.1",
115
+ "version": "4.10.1",
116
116
  "bugs": "https://github.com/flowcore-io/flowcore-cli/issues",
117
117
  "keywords": [
118
118
  "flowcore",