@flowcore/cli 4.9.1 → 4.10.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,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
+ ## [4.10.0](https://github.com/flowcore-io/flowcore-cli/compare/v4.9.1...v4.10.0) (2024-10-25)
14
+
15
+
16
+ ### Features
17
+
18
+ * **apply:** :sparkles: added new diff command to diff supplied resources with applied ones ([2b42f91](https://github.com/flowcore-io/flowcore-cli/commit/2b42f91d011b4707bf34965eba8f81becef788c0))
19
+
13
20
  ## [4.9.1](https://github.com/flowcore-io/flowcore-cli/compare/v4.9.0...v4.9.1) (2024-10-23)
14
21
 
15
22
 
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.0 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.0/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.0/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.0/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.0/src/commands/info.ts)_
631
653
 
632
654
  ## `flowcore login`
633
655
 
@@ -1300,7 +1322,7 @@ EXAMPLES
1300
1322
  $ flowcore stream "https://flowcore.io/<org>/<data core>/<flow type>/[<event type1>,<event type2>,<event type3>].stream" -s 3m
1301
1323
  ```
1302
1324
 
1303
- _See code: [@flowcore/cli-plugin-core](https://github.com/flowcore/flowcore-cli-plugin-core/blob/v4.6.0/src/commands/stream.ts)_
1325
+ _See code: [@flowcore/cli-plugin-core](https://github.com/flowcore/flowcore-cli-plugin-core/blob/v4.8.0/src/commands/stream.ts)_
1304
1326
 
1305
1327
  ## `flowcore stream http STREAM`
1306
1328
 
@@ -1342,7 +1364,7 @@ EXAMPLES
1342
1364
  $ 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
1365
  ```
1344
1366
 
1345
- _See code: [@flowcore/cli-plugin-core](https://github.com/flowcore/flowcore-cli-plugin-core/blob/v4.6.0/src/commands/stream/http.ts)_
1367
+ _See code: [@flowcore/cli-plugin-core](https://github.com/flowcore/flowcore-cli-plugin-core/blob/v4.8.0/src/commands/stream/http.ts)_
1346
1368
 
1347
1369
  ## `flowcore version`
1348
1370
 
@@ -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.0"
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.8.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.0",
116
116
  "bugs": "https://github.com/flowcore-io/flowcore-cli/issues",
117
117
  "keywords": [
118
118
  "flowcore",