@flowcore/cli 4.2.2 → 4.3.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,26 @@
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.3.0](https://github.com/flowcore-io/flowcore-cli/compare/v4.2.3...v4.3.0) (2024-10-18)
14
+
15
+
16
+ ### Features
17
+
18
+ * **apply:** :sparkles: added flowcore apply v2 with api registry service hooks ([2115c9e](https://github.com/flowcore-io/flowcore-cli/commit/2115c9e61730c8c241578a3a76ec4d24845d969f))
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * **apply:** :sparkles: added apply v2 option ([7c60fdc](https://github.com/flowcore-io/flowcore-cli/commit/7c60fdc1cab54de142b6526e0452dff41c902aea))
24
+ * **configuration:** :rotating_light: fixed linting errors ([fe6e4e9](https://github.com/flowcore-io/flowcore-cli/commit/fe6e4e928d37c9280d5b299afdb9403ee15becd6))
25
+
26
+ ## [4.2.3](https://github.com/flowcore-io/flowcore-cli/compare/v4.2.2...v4.2.3) (2024-10-17)
27
+
28
+
29
+ ### Bug Fixes
30
+
31
+ * update cli-plugin-core ([78015db](https://github.com/flowcore-io/flowcore-cli/commit/78015db9c4584089d2f2e5a60dac8f997bd80447))
32
+
13
33
  ## [4.2.2](https://github.com/flowcore-io/flowcore-cli/compare/v4.2.1...v4.2.2) (2024-10-08)
14
34
 
15
35
 
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.2.2 linux-x64 node-v20.17.0
21
+ @flowcore/cli/4.3.0 linux-x64 node-v20.17.0
22
22
  $ flowcore --help [COMMAND]
23
23
  USAGE
24
24
  $ flowcore COMMAND
@@ -81,12 +81,13 @@ Apply a resource manifest against the Flowcore Platform
81
81
 
82
82
  ```
83
83
  USAGE
84
- $ flowcore apply -f <value> [--profile <value>] [-y]
84
+ $ flowcore apply -f <value> [--profile <value>] [--v2] [-y]
85
85
 
86
86
  FLAGS
87
87
  -f, --file=<value>... (required) file to apply
88
88
  -y, --yes skip confirmation
89
89
  --profile=<value> Specify the configuration profile to use
90
+ --v2 use v2 api
90
91
 
91
92
  DESCRIPTION
92
93
  Apply a resource manifest against the Flowcore Platform
@@ -95,7 +96,7 @@ EXAMPLES
95
96
  $ flowcore apply -f ./path/to/manifest.yml
96
97
  ```
97
98
 
98
- _See code: [src/commands/apply.ts](https://github.com/flowcore-io/flowcore-cli/blob/v4.2.2/src/commands/apply.ts)_
99
+ _See code: [src/commands/apply.ts](https://github.com/flowcore-io/flowcore-cli/blob/v4.3.0/src/commands/apply.ts)_
99
100
 
100
101
  ## `flowcore auth delete key API_KEY_NAME`
101
102
 
@@ -1253,7 +1254,7 @@ EXAMPLES
1253
1254
  $ flowcore stream "https://flowcore.io/<org>/<data core>/<flow type>/[<event type1>,<event type2>,<event type3>].stream" -s 3m
1254
1255
  ```
1255
1256
 
1256
- _See code: [@flowcore/cli-plugin-core](https://github.com/flowcore/flowcore-cli-plugin-core/blob/v4.0.3/src/commands/stream.ts)_
1257
+ _See code: [@flowcore/cli-plugin-core](https://github.com/flowcore/flowcore-cli-plugin-core/blob/v4.2.0/src/commands/stream.ts)_
1257
1258
 
1258
1259
  ## `flowcore stream http STREAM`
1259
1260
 
@@ -1295,7 +1296,7 @@ EXAMPLES
1295
1296
  $ 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
1296
1297
  ```
1297
1298
 
1298
- _See code: [@flowcore/cli-plugin-core](https://github.com/flowcore/flowcore-cli-plugin-core/blob/v4.0.3/src/commands/stream/http.ts)_
1299
+ _See code: [@flowcore/cli-plugin-core](https://github.com/flowcore/flowcore-cli-plugin-core/blob/v4.2.0/src/commands/stream/http.ts)_
1299
1300
 
1300
1301
  ## `flowcore version`
1301
1302
 
@@ -5,6 +5,7 @@ export default class Apply extends BaseCommand<typeof Apply> {
5
5
  static examples: string[];
6
6
  static flags: {
7
7
  file: import("@oclif/core/interfaces").OptionFlag<string[], import("@oclif/core/interfaces").CustomOptions>;
8
+ v2: import("@oclif/core/interfaces").BooleanFlag<boolean>;
8
9
  yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
10
  };
10
11
  run(): Promise<void>;
@@ -1,32 +1,67 @@
1
1
  import { BaseCommand } from "@flowcore/cli-plugin-config";
2
- import { Flags } from '@oclif/core';
2
+ import { ApiRegistryService, baseResourceDto } from "@flowcore/cli-plugin-core";
3
+ import { Flags } from "@oclif/core";
3
4
  import dayjs from "dayjs";
4
5
  import isSameOrBefore from "dayjs/plugin/isSameOrBefore.js";
5
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";
6
10
  dayjs.extend(utc);
7
11
  dayjs.extend(isSameOrBefore);
8
12
  export default class Apply extends BaseCommand {
9
13
  static args = {};
10
- static description = 'Apply a resource manifest against the Flowcore Platform';
14
+ static description = "Apply a resource manifest against the Flowcore Platform";
11
15
  static examples = [
12
- '<%= config.bin %> <%= command.id %> -f ./path/to/manifest.yml',
16
+ "<%= config.bin %> <%= command.id %> -f ./path/to/manifest.yml",
13
17
  ];
14
18
  static flags = {
15
- file: Flags.string({ char: 'f', description: 'file to apply', multiple: true, required: true }),
16
- yes: Flags.boolean({ char: 'y', description: 'skip confirmation' }),
19
+ file: Flags.string({
20
+ char: "f",
21
+ description: "file to apply",
22
+ multiple: true,
23
+ required: true,
24
+ }),
25
+ v2: Flags.boolean({ default: false, description: "use v2 api" }),
26
+ yes: Flags.boolean({ char: "y", description: "skip confirmation" }),
17
27
  };
18
28
  async run() {
19
29
  const { flags } = await this.parse(Apply);
20
- const resources = [
21
- "data-core",
22
- "scenario",
23
- ];
30
+ const apiRegistry = ApiRegistryService.getInstance(this.logger);
31
+ await this.config.runHook("register-api", {
32
+ apiRegistry,
33
+ });
34
+ if (flags.v2) {
35
+ try {
36
+ let documents = [];
37
+ if (fs.statSync(flags.file[0]).isDirectory()) {
38
+ const files = fs.readdirSync(flags.file[0]);
39
+ documents = files.flatMap((file) => {
40
+ const content = fs.readFileSync(join(flags.file[0], file), "utf8");
41
+ return yaml.loadAll(content);
42
+ });
43
+ }
44
+ else {
45
+ documents = flags.file.flatMap((file) => {
46
+ const content = fs.readFileSync(file, "utf8");
47
+ return yaml.loadAll(content);
48
+ });
49
+ }
50
+ const parsedDocuments = documents.map((doc) => baseResourceDto.parse(doc));
51
+ await apiRegistry.apply(parsedDocuments);
52
+ }
53
+ catch (error) {
54
+ this.logger.fatal(`Failed to apply documents with error: ${error}`);
55
+ }
56
+ return;
57
+ }
58
+ const resources = ["data-core", "scenario"];
24
59
  for (const resource of resources) {
25
60
  // eslint-disable-next-line no-await-in-loop
26
61
  await this.config.runCommand(`${resource}:apply`, [
27
62
  ...flags.file.map((file) => `--file=${file}`),
28
- ...flags.profile ? `--profile=${flags.profile}` : [],
29
- ...flags.yes ? ['--yes'] : []
63
+ ...(flags.profile ? `--profile=${flags.profile}` : []),
64
+ ...(flags.yes ? ["--yes"] : []),
30
65
  ]);
31
66
  }
32
67
  }
@@ -24,6 +24,12 @@
24
24
  "multiple": true,
25
25
  "type": "option"
26
26
  },
27
+ "v2": {
28
+ "description": "use v2 api",
29
+ "name": "v2",
30
+ "allowNo": false,
31
+ "type": "boolean"
32
+ },
27
33
  "yes": {
28
34
  "char": "y",
29
35
  "description": "skip confirmation",
@@ -48,5 +54,5 @@
48
54
  ]
49
55
  }
50
56
  },
51
- "version": "4.2.2"
57
+ "version": "4.3.0"
52
58
  }
package/package.json CHANGED
@@ -1,122 +1,124 @@
1
1
  {
2
- "author": "Flowcore",
3
- "bin": {
4
- "flowcore": "./bin/run.js"
5
- },
6
- "dependencies": {
7
- "@datastructures-js/queue": "^4.2.3",
8
- "@flowcore/cli-plugin-ai": "^1.1.2",
9
- "@flowcore/cli-plugin-auth-management": "^1.2.2",
10
- "@flowcore/cli-plugin-config": "^2.4.1",
11
- "@flowcore/cli-plugin-core": "^4.0.3",
12
- "@flowcore/cli-plugin-data-core": "^3.1.1",
13
- "@flowcore/cli-plugin-generator": "^1.6.0",
14
- "@flowcore/cli-plugin-scenario": "^4.1.2",
15
- "@flowcore/cli-plugin-tenant-management": "^1.1.1",
16
- "@flowcore/time-bucket": "^1.1.0",
17
- "@oclif/core": "^4.0.21",
18
- "@oclif/plugin-autocomplete": "^3.2.3",
19
- "@oclif/plugin-help": "^6.2.11",
20
- "@oclif/plugin-not-found": "^3.2.20",
21
- "@oclif/plugin-plugins": "^5.4.7",
22
- "@oclif/plugin-version": "^2.2.12",
23
- "axios": "^1.6.2",
24
- "cassandra-uuid": "^0.1.0",
25
- "cross-fetch": "^4.0.0",
26
- "dayjs": "^1.11.10",
27
- "enquirer": "^2.4.1",
28
- "graphql": "^16.8.1",
29
- "graphql-request": "^6.1.0",
30
- "jwt-decode": "^4.0.0",
31
- "lodash": "^4.17.21",
32
- "merge": "^2.1.1",
33
- "oclif-plugin-update-notifier": "^1.5.84",
34
- "rxjs": "^7.8.1",
35
- "session": "^0.1.0"
36
- },
37
- "description": "Flowcore CLI for interacting with the Flowcore platform",
38
- "devDependencies": {
39
- "@oclif/prettier-config": "^0.2.1",
40
- "@oclif/test": "^4.0.9",
41
- "@types/chai": "^4",
42
- "@types/express": "^4.17.21",
43
- "@types/lodash": "^4.14.202",
44
- "@types/mocha": "^10",
45
- "@types/node": "^18",
46
- "chai": "^4",
47
- "eslint": "^8",
48
- "eslint-config-oclif": "^5",
49
- "eslint-config-oclif-typescript": "^3",
50
- "eslint-config-prettier": "^9.0.0",
51
- "mocha": "^10",
52
- "oclif": "^4.0.4",
53
- "shx": "^0.3.4",
54
- "ts-node": "^10.9.1",
55
- "typescript": "^5"
56
- },
57
- "engines": {
58
- "node": ">=18.0.0"
59
- },
60
- "files": [
61
- "/bin",
62
- "/dist",
63
- "/oclif.manifest.json"
64
- ],
65
- "homepage": "https://github.com/flowcore-io/flowcore-cli",
66
- "license": "MIT",
67
- "main": "",
68
- "name": "@flowcore/cli",
69
- "oclif": {
70
- "bin": "flowcore",
71
- "dirname": "flowcore",
72
- "commands": "./dist/commands",
73
- "plugins": [
74
- "@oclif/plugin-help",
75
- "@oclif/plugin-warn-if-update-available",
76
- "@oclif/plugin-version",
77
- "@oclif/plugin-plugins",
78
- "@oclif/plugin-autocomplete",
79
- "@oclif/plugin-not-found",
80
- "oclif-plugin-update-notifier",
81
- "@flowcore/cli-plugin-config",
82
- "@flowcore/cli-plugin-data-core",
83
- "@flowcore/cli-plugin-scenario",
84
- "@flowcore/cli-plugin-core",
85
- "@flowcore/cli-plugin-generator",
86
- "@flowcore/cli-plugin-auth-management",
87
- "@flowcore/cli-plugin-tenant-management",
88
- "@flowcore/cli-plugin-ai"
89
- ],
90
- "warnIfUpdateAvailable": {
91
- "timeoutInDays": 2
92
- },
93
- "topicSeparator": " "
94
- },
95
- "repository": "flowcore-io/flowcore-cli",
96
- "scripts": {
97
- "build": "shx rm -rf dist && tsc -b",
98
- "lint": "eslint . --ext .ts",
99
- "postpack": "shx rm -f oclif.manifest.json",
100
- "posttest": "npm run lint",
101
- "prepack": "npm run build && oclif manifest && oclif readme",
102
- "prepare": "npm run build",
103
- "test": "mocha --forbid-only \"test/**/*.test.ts\"",
104
- "version": "oclif readme && git add README.md",
105
- "start": "./bin/run.js",
106
- "prestart": "npm run build",
107
- "update-schema": "rover graph introspect https://graph.api.staging.flowcore.io/graphql -o schema.gql"
108
- },
109
- "version": "4.2.2",
110
- "bugs": "https://github.com/flowcore-io/flowcore-cli/issues",
111
- "keywords": [
112
- "flowcore",
113
- "cli",
114
- "flowcore-cli",
115
- "streaming",
116
- "events",
117
- "data"
118
- ],
119
- "types": "dist/index.d.ts",
120
- "exports": "./lib/index.js",
121
- "type": "module"
2
+ "author": "Flowcore",
3
+ "bin": {
4
+ "flowcore": "./bin/run.js"
5
+ },
6
+ "dependencies": {
7
+ "@datastructures-js/queue": "^4.2.3",
8
+ "@flowcore/cli-plugin-ai": "^1.1.2",
9
+ "@flowcore/cli-plugin-auth-management": "^1.2.2",
10
+ "@flowcore/cli-plugin-config": "^2.4.1",
11
+ "@flowcore/cli-plugin-core": "^4.2.0",
12
+ "@flowcore/cli-plugin-data-core": "^3.1.1",
13
+ "@flowcore/cli-plugin-generator": "^1.6.0",
14
+ "@flowcore/cli-plugin-scenario": "^4.1.2",
15
+ "@flowcore/cli-plugin-tenant-management": "^1.1.1",
16
+ "@flowcore/time-bucket": "^1.1.0",
17
+ "@oclif/core": "^4.0.21",
18
+ "@oclif/plugin-autocomplete": "^3.2.3",
19
+ "@oclif/plugin-help": "^6.2.11",
20
+ "@oclif/plugin-not-found": "^3.2.20",
21
+ "@oclif/plugin-plugins": "^5.4.7",
22
+ "@oclif/plugin-version": "^2.2.12",
23
+ "axios": "^1.6.2",
24
+ "cassandra-uuid": "^0.1.0",
25
+ "cross-fetch": "^4.0.0",
26
+ "dayjs": "^1.11.10",
27
+ "enquirer": "^2.4.1",
28
+ "graphql": "^16.8.1",
29
+ "graphql-request": "^6.1.0",
30
+ "js-yaml": "^4.1.0",
31
+ "jwt-decode": "^4.0.0",
32
+ "lodash": "^4.17.21",
33
+ "merge": "^2.1.1",
34
+ "oclif-plugin-update-notifier": "^1.5.84",
35
+ "rxjs": "^7.8.1",
36
+ "session": "^0.1.0"
37
+ },
38
+ "description": "Flowcore CLI for interacting with the Flowcore platform",
39
+ "devDependencies": {
40
+ "@oclif/prettier-config": "^0.2.1",
41
+ "@oclif/test": "^4.0.9",
42
+ "@types/chai": "^4",
43
+ "@types/express": "^4.17.21",
44
+ "@types/js-yaml": "^4.0.9",
45
+ "@types/lodash": "^4.14.202",
46
+ "@types/mocha": "^10",
47
+ "@types/node": "^18",
48
+ "chai": "^4",
49
+ "eslint": "^8",
50
+ "eslint-config-oclif": "^5",
51
+ "eslint-config-oclif-typescript": "^3",
52
+ "eslint-config-prettier": "^9.0.0",
53
+ "mocha": "^10",
54
+ "oclif": "^4.0.4",
55
+ "shx": "^0.3.4",
56
+ "ts-node": "^10.9.1",
57
+ "typescript": "^5"
58
+ },
59
+ "engines": {
60
+ "node": ">=18.0.0"
61
+ },
62
+ "files": [
63
+ "/bin",
64
+ "/dist",
65
+ "/oclif.manifest.json"
66
+ ],
67
+ "homepage": "https://github.com/flowcore-io/flowcore-cli",
68
+ "license": "MIT",
69
+ "main": "",
70
+ "name": "@flowcore/cli",
71
+ "oclif": {
72
+ "bin": "flowcore",
73
+ "dirname": "flowcore",
74
+ "commands": "./dist/commands",
75
+ "plugins": [
76
+ "@oclif/plugin-help",
77
+ "@oclif/plugin-warn-if-update-available",
78
+ "@oclif/plugin-version",
79
+ "@oclif/plugin-plugins",
80
+ "@oclif/plugin-autocomplete",
81
+ "@oclif/plugin-not-found",
82
+ "oclif-plugin-update-notifier",
83
+ "@flowcore/cli-plugin-config",
84
+ "@flowcore/cli-plugin-data-core",
85
+ "@flowcore/cli-plugin-scenario",
86
+ "@flowcore/cli-plugin-core",
87
+ "@flowcore/cli-plugin-generator",
88
+ "@flowcore/cli-plugin-auth-management",
89
+ "@flowcore/cli-plugin-tenant-management",
90
+ "@flowcore/cli-plugin-ai"
91
+ ],
92
+ "warnIfUpdateAvailable": {
93
+ "timeoutInDays": 2
94
+ },
95
+ "topicSeparator": " "
96
+ },
97
+ "repository": "flowcore-io/flowcore-cli",
98
+ "scripts": {
99
+ "build": "shx rm -rf dist && tsc -b",
100
+ "lint": "eslint . --ext .ts",
101
+ "postpack": "shx rm -f oclif.manifest.json",
102
+ "posttest": "npm run lint",
103
+ "prepack": "npm run build && oclif manifest && oclif readme",
104
+ "prepare": "npm run build",
105
+ "test": "mocha --forbid-only \"test/**/*.test.ts\"",
106
+ "version": "oclif readme && git add README.md",
107
+ "start": "./bin/run.js",
108
+ "prestart": "npm run build",
109
+ "update-schema": "rover graph introspect https://graph.api.staging.flowcore.io/graphql -o schema.gql"
110
+ },
111
+ "version": "4.3.0",
112
+ "bugs": "https://github.com/flowcore-io/flowcore-cli/issues",
113
+ "keywords": [
114
+ "flowcore",
115
+ "cli",
116
+ "flowcore-cli",
117
+ "streaming",
118
+ "events",
119
+ "data"
120
+ ],
121
+ "types": "dist/index.d.ts",
122
+ "exports": "./lib/index.js",
123
+ "type": "module"
122
124
  }