@flowcore/cli 4.3.2 → 4.5.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,25 @@
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.5.0](https://github.com/flowcore-io/flowcore-cli/compare/v4.4.0...v4.5.0) (2024-10-21)
14
+
15
+
16
+ ### Features
17
+
18
+ * **delete:** :sparkles: added delete resource command ([66053de](https://github.com/flowcore-io/flowcore-cli/commit/66053de89d452ed6d07599f887335cfb69593428))
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * :rotating_light: fixed linting errors ([447be65](https://github.com/flowcore-io/flowcore-cli/commit/447be65ce7072c08754ef70ef7070edcb64216c2))
24
+
25
+ ## [4.4.0](https://github.com/flowcore-io/flowcore-cli/compare/v4.3.2...v4.4.0) (2024-10-18)
26
+
27
+
28
+ ### Features
29
+
30
+ * **apply:** :art: update core plugin so that apply v2 displays what has been changed ([b155e1a](https://github.com/flowcore-io/flowcore-cli/commit/b155e1a209c080d40cfbb82cd122ffe0a227c0ea))
31
+
13
32
  ## [4.3.2](https://github.com/flowcore-io/flowcore-cli/compare/v4.3.1...v4.3.2) (2024-10-18)
14
33
 
15
34
 
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.3.2 linux-x64 node-v20.17.0
21
+ @flowcore/cli/4.5.0 linux-x64 node-v20.18.0
22
22
  $ flowcore --help [COMMAND]
23
23
  USAGE
24
24
  $ flowcore COMMAND
@@ -42,6 +42,7 @@ USAGE
42
42
  * [`flowcore data-core generate event-type FLOWTYPE`](#flowcore-data-core-generate-event-type-flowtype)
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
+ * [`flowcore delete`](#flowcore-delete)
45
46
  * [`flowcore generate nextjs-entity NAME`](#flowcore-generate-nextjs-entity-name)
46
47
  * [`flowcore get adapter [ADAPTER]`](#flowcore-get-adapter-adapter)
47
48
  * [`flowcore get scenario [SCENARIO]`](#flowcore-get-scenario-scenario)
@@ -96,7 +97,7 @@ EXAMPLES
96
97
  $ flowcore apply -f ./path/to/manifest.yml
97
98
  ```
98
99
 
99
- _See code: [src/commands/apply.ts](https://github.com/flowcore-io/flowcore-cli/blob/v4.3.2/src/commands/apply.ts)_
100
+ _See code: [src/commands/apply.ts](https://github.com/flowcore-io/flowcore-cli/blob/v4.5.0/src/commands/apply.ts)_
100
101
 
101
102
  ## `flowcore auth delete key API_KEY_NAME`
102
103
 
@@ -458,6 +459,28 @@ EXAMPLES
458
459
 
459
460
  _See code: [@flowcore/cli-plugin-data-core](https://github.com/flowcore/flowcore-cli-data-core/blob/v3.1.1/src/commands/data-core/init.ts)_
460
461
 
462
+ ## `flowcore delete`
463
+
464
+ Delete a resource manifest from the Flowcore Platform
465
+
466
+ ```
467
+ USAGE
468
+ $ flowcore delete -f <value> [--profile <value>] [-y]
469
+
470
+ FLAGS
471
+ -f, --file=<value>... (required) file to delete
472
+ -y, --yes skip confirmation
473
+ --profile=<value> Specify the configuration profile to use
474
+
475
+ DESCRIPTION
476
+ Delete a resource manifest from the Flowcore Platform
477
+
478
+ EXAMPLES
479
+ $ flowcore delete -f ./path/to/manifest.yml
480
+ ```
481
+
482
+ _See code: [src/commands/delete.ts](https://github.com/flowcore-io/flowcore-cli/blob/v4.5.0/src/commands/delete.ts)_
483
+
461
484
  ## `flowcore generate nextjs-entity NAME`
462
485
 
463
486
  Create a new NextJS entity using the Flowcore IDD approach
@@ -1254,7 +1277,7 @@ EXAMPLES
1254
1277
  $ flowcore stream "https://flowcore.io/<org>/<data core>/<flow type>/[<event type1>,<event type2>,<event type3>].stream" -s 3m
1255
1278
  ```
1256
1279
 
1257
- _See code: [@flowcore/cli-plugin-core](https://github.com/flowcore/flowcore-cli-plugin-core/blob/v4.2.1/src/commands/stream.ts)_
1280
+ _See code: [@flowcore/cli-plugin-core](https://github.com/flowcore/flowcore-cli-plugin-core/blob/v4.5.0/src/commands/stream.ts)_
1258
1281
 
1259
1282
  ## `flowcore stream http STREAM`
1260
1283
 
@@ -1296,7 +1319,7 @@ EXAMPLES
1296
1319
  $ 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
1297
1320
  ```
1298
1321
 
1299
- _See code: [@flowcore/cli-plugin-core](https://github.com/flowcore/flowcore-cli-plugin-core/blob/v4.2.1/src/commands/stream/http.ts)_
1322
+ _See code: [@flowcore/cli-plugin-core](https://github.com/flowcore/flowcore-cli-plugin-core/blob/v4.5.0/src/commands/stream/http.ts)_
1300
1323
 
1301
1324
  ## `flowcore version`
1302
1325
 
@@ -23,7 +23,7 @@ export default class Apply extends BaseCommand {
23
23
  required: true,
24
24
  }),
25
25
  v2: Flags.boolean({ default: false, description: "use v2 api" }),
26
- yes: Flags.boolean({ char: "y", description: "skip confirmation" }),
26
+ yes: Flags.boolean({ char: "y", default: false, description: "skip confirmation" }),
27
27
  };
28
28
  async run() {
29
29
  const { flags } = await this.parse(Apply);
@@ -50,7 +50,7 @@ export default class Apply extends BaseCommand {
50
50
  });
51
51
  }
52
52
  documents.map((doc) => baseResourceDto.parse(doc));
53
- await apiRegistry.apply(documents);
53
+ await apiRegistry.apply(documents, flags.yes);
54
54
  }
55
55
  catch (error) {
56
56
  this.logger.fatal(`Failed to apply documents with error: ${error}`);
@@ -0,0 +1,11 @@
1
+ import { BaseCommand } from "@flowcore/cli-plugin-config";
2
+ export default class Delete extends BaseCommand<typeof Delete> {
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
+ yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
+ };
10
+ run(): Promise<void>;
11
+ }
@@ -0,0 +1,57 @@
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 Delete extends BaseCommand {
13
+ static args = {};
14
+ static description = "Delete a resource manifest from 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 to delete",
22
+ multiple: true,
23
+ required: true,
24
+ }),
25
+ yes: Flags.boolean({ char: "y", default: false, description: "skip confirmation" }),
26
+ };
27
+ async run() {
28
+ const { flags } = await this.parse(Delete);
29
+ const apiRegistry = ApiRegistryService.getInstance(this.logger);
30
+ await this.config.runHook("register-api", {
31
+ apiRegistry,
32
+ cliConfiguration: this.cliConfiguration,
33
+ logger: this.logger,
34
+ });
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
+ documents.map((doc) => baseResourceDto.parse(doc));
51
+ await apiRegistry.delete(documents, flags.yes);
52
+ }
53
+ catch (error) {
54
+ this.logger.fatal(`Failed to delete documents with error: ${error}`);
55
+ }
56
+ }
57
+ }
@@ -52,7 +52,54 @@
52
52
  "commands",
53
53
  "apply.js"
54
54
  ]
55
+ },
56
+ "delete": {
57
+ "aliases": [],
58
+ "args": {},
59
+ "description": "Delete a resource manifest from the Flowcore Platform",
60
+ "examples": [
61
+ "<%= config.bin %> <%= command.id %> -f ./path/to/manifest.yml"
62
+ ],
63
+ "flags": {
64
+ "profile": {
65
+ "description": "Specify the configuration profile to use",
66
+ "name": "profile",
67
+ "hasDynamicHelp": false,
68
+ "multiple": false,
69
+ "type": "option"
70
+ },
71
+ "file": {
72
+ "char": "f",
73
+ "description": "file to delete",
74
+ "name": "file",
75
+ "required": true,
76
+ "hasDynamicHelp": false,
77
+ "multiple": true,
78
+ "type": "option"
79
+ },
80
+ "yes": {
81
+ "char": "y",
82
+ "description": "skip confirmation",
83
+ "name": "yes",
84
+ "allowNo": false,
85
+ "type": "boolean"
86
+ }
87
+ },
88
+ "hasDynamicHelp": false,
89
+ "hiddenAliases": [],
90
+ "id": "delete",
91
+ "pluginAlias": "@flowcore/cli",
92
+ "pluginName": "@flowcore/cli",
93
+ "pluginType": "core",
94
+ "strict": true,
95
+ "enableJsonFlag": false,
96
+ "isESM": true,
97
+ "relativePath": [
98
+ "dist",
99
+ "commands",
100
+ "delete.js"
101
+ ]
55
102
  }
56
103
  },
57
- "version": "4.3.2"
104
+ "version": "4.5.0"
58
105
  }
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.2.1",
11
+ "@flowcore/cli-plugin-core": "^4.5.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",
@@ -108,7 +108,7 @@
108
108
  "prestart": "npm run build",
109
109
  "update-schema": "rover graph introspect https://graph.api.staging.flowcore.io/graphql -o schema.gql"
110
110
  },
111
- "version": "4.3.2",
111
+ "version": "4.5.0",
112
112
  "bugs": "https://github.com/flowcore-io/flowcore-cli/issues",
113
113
  "keywords": [
114
114
  "flowcore",