@flowcore/cli 4.2.3 → 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 +13 -0
- package/README.md +6 -5
- package/dist/commands/apply.d.ts +1 -0
- package/dist/commands/apply.js +46 -11
- package/oclif.manifest.json +7 -1
- package/package.json +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,19 @@
|
|
|
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
|
+
|
|
13
26
|
## [4.2.3](https://github.com/flowcore-io/flowcore-cli/compare/v4.2.2...v4.2.3) (2024-10-17)
|
|
14
27
|
|
|
15
28
|
|
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.
|
|
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.
|
|
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
|
|
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
|
|
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
|
|
package/dist/commands/apply.d.ts
CHANGED
|
@@ -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>;
|
package/dist/commands/apply.js
CHANGED
|
@@ -1,32 +1,67 @@
|
|
|
1
1
|
import { BaseCommand } from "@flowcore/cli-plugin-config";
|
|
2
|
-
import {
|
|
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 =
|
|
14
|
+
static description = "Apply a resource manifest against the Flowcore Platform";
|
|
11
15
|
static examples = [
|
|
12
|
-
|
|
16
|
+
"<%= config.bin %> <%= command.id %> -f ./path/to/manifest.yml",
|
|
13
17
|
];
|
|
14
18
|
static flags = {
|
|
15
|
-
file: Flags.string({
|
|
16
|
-
|
|
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
|
|
21
|
-
|
|
22
|
-
|
|
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 ? [
|
|
63
|
+
...(flags.profile ? `--profile=${flags.profile}` : []),
|
|
64
|
+
...(flags.yes ? ["--yes"] : []),
|
|
30
65
|
]);
|
|
31
66
|
}
|
|
32
67
|
}
|
package/oclif.manifest.json
CHANGED
|
@@ -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.
|
|
57
|
+
"version": "4.3.0"
|
|
52
58
|
}
|
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.0
|
|
11
|
+
"@flowcore/cli-plugin-core": "^4.2.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",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"enquirer": "^2.4.1",
|
|
28
28
|
"graphql": "^16.8.1",
|
|
29
29
|
"graphql-request": "^6.1.0",
|
|
30
|
+
"js-yaml": "^4.1.0",
|
|
30
31
|
"jwt-decode": "^4.0.0",
|
|
31
32
|
"lodash": "^4.17.21",
|
|
32
33
|
"merge": "^2.1.1",
|
|
@@ -40,6 +41,7 @@
|
|
|
40
41
|
"@oclif/test": "^4.0.9",
|
|
41
42
|
"@types/chai": "^4",
|
|
42
43
|
"@types/express": "^4.17.21",
|
|
44
|
+
"@types/js-yaml": "^4.0.9",
|
|
43
45
|
"@types/lodash": "^4.14.202",
|
|
44
46
|
"@types/mocha": "^10",
|
|
45
47
|
"@types/node": "^18",
|
|
@@ -106,7 +108,7 @@
|
|
|
106
108
|
"prestart": "npm run build",
|
|
107
109
|
"update-schema": "rover graph introspect https://graph.api.staging.flowcore.io/graphql -o schema.gql"
|
|
108
110
|
},
|
|
109
|
-
"version": "4.
|
|
111
|
+
"version": "4.3.0",
|
|
110
112
|
"bugs": "https://github.com/flowcore-io/flowcore-cli/issues",
|
|
111
113
|
"keywords": [
|
|
112
114
|
"flowcore",
|