@grepr/cli 1.1.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.
Files changed (91) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +71 -0
  3. package/build/dist/commands/base-command.d.ts +13 -0
  4. package/build/dist/commands/base-command.d.ts.map +1 -0
  5. package/build/dist/commands/base-command.js +28 -0
  6. package/build/dist/commands/base-command.js.map +1 -0
  7. package/build/dist/commands/config-command.d.ts +19 -0
  8. package/build/dist/commands/config-command.d.ts.map +1 -0
  9. package/build/dist/commands/config-command.js +108 -0
  10. package/build/dist/commands/config-command.js.map +1 -0
  11. package/build/dist/commands/crud-command.d.ts +117 -0
  12. package/build/dist/commands/crud-command.d.ts.map +1 -0
  13. package/build/dist/commands/crud-command.js +264 -0
  14. package/build/dist/commands/crud-command.js.map +1 -0
  15. package/build/dist/commands/dataset-command.d.ts +45 -0
  16. package/build/dist/commands/dataset-command.d.ts.map +1 -0
  17. package/build/dist/commands/dataset-command.js +139 -0
  18. package/build/dist/commands/dataset-command.js.map +1 -0
  19. package/build/dist/commands/integration-command.d.ts +30 -0
  20. package/build/dist/commands/integration-command.d.ts.map +1 -0
  21. package/build/dist/commands/integration-command.js +80 -0
  22. package/build/dist/commands/integration-command.js.map +1 -0
  23. package/build/dist/commands/job-command.d.ts +92 -0
  24. package/build/dist/commands/job-command.d.ts.map +1 -0
  25. package/build/dist/commands/job-command.js +294 -0
  26. package/build/dist/commands/job-command.js.map +1 -0
  27. package/build/dist/commands/list-command.d.ts +69 -0
  28. package/build/dist/commands/list-command.d.ts.map +1 -0
  29. package/build/dist/commands/list-command.js +130 -0
  30. package/build/dist/commands/list-command.js.map +1 -0
  31. package/build/dist/commands/query-command.d.ts +20 -0
  32. package/build/dist/commands/query-command.d.ts.map +1 -0
  33. package/build/dist/commands/query-command.js +167 -0
  34. package/build/dist/commands/query-command.js.map +1 -0
  35. package/build/dist/grepr.d.ts +3 -0
  36. package/build/dist/grepr.d.ts.map +1 -0
  37. package/build/dist/grepr.js +155 -0
  38. package/build/dist/grepr.js.map +1 -0
  39. package/build/dist/lib/api-client-factory.d.ts +21 -0
  40. package/build/dist/lib/api-client-factory.d.ts.map +1 -0
  41. package/build/dist/lib/api-client-factory.js +23 -0
  42. package/build/dist/lib/api-client-factory.js.map +1 -0
  43. package/build/dist/lib/api-client.d.ts +2 -0
  44. package/build/dist/lib/api-client.d.ts.map +1 -0
  45. package/build/dist/lib/api-client.js +3 -0
  46. package/build/dist/lib/api-client.js.map +1 -0
  47. package/build/dist/lib/auth.d.ts +104 -0
  48. package/build/dist/lib/auth.d.ts.map +1 -0
  49. package/build/dist/lib/auth.js +312 -0
  50. package/build/dist/lib/auth.js.map +1 -0
  51. package/build/dist/lib/command-registry.d.ts +35 -0
  52. package/build/dist/lib/command-registry.d.ts.map +1 -0
  53. package/build/dist/lib/command-registry.js +33 -0
  54. package/build/dist/lib/command-registry.js.map +1 -0
  55. package/build/dist/lib/config.d.ts +40 -0
  56. package/build/dist/lib/config.d.ts.map +1 -0
  57. package/build/dist/lib/config.js +114 -0
  58. package/build/dist/lib/config.js.map +1 -0
  59. package/build/dist/lib/grepr-api-client.d.ts +216 -0
  60. package/build/dist/lib/grepr-api-client.d.ts.map +1 -0
  61. package/build/dist/lib/grepr-api-client.js +424 -0
  62. package/build/dist/lib/grepr-api-client.js.map +1 -0
  63. package/build/dist/lib/heartbeat.d.ts +17 -0
  64. package/build/dist/lib/heartbeat.d.ts.map +1 -0
  65. package/build/dist/lib/heartbeat.js +56 -0
  66. package/build/dist/lib/heartbeat.js.map +1 -0
  67. package/build/dist/lib/json-formatter.d.ts +135 -0
  68. package/build/dist/lib/json-formatter.d.ts.map +1 -0
  69. package/build/dist/lib/json-formatter.js +658 -0
  70. package/build/dist/lib/json-formatter.js.map +1 -0
  71. package/build/dist/lib/parser.d.ts +26 -0
  72. package/build/dist/lib/parser.d.ts.map +1 -0
  73. package/build/dist/lib/parser.js +95 -0
  74. package/build/dist/lib/parser.js.map +1 -0
  75. package/build/dist/lib/streaming-job-executor.d.ts +31 -0
  76. package/build/dist/lib/streaming-job-executor.d.ts.map +1 -0
  77. package/build/dist/lib/streaming-job-executor.js +281 -0
  78. package/build/dist/lib/streaming-job-executor.js.map +1 -0
  79. package/build/dist/lib/time-utils.d.ts +28 -0
  80. package/build/dist/lib/time-utils.d.ts.map +1 -0
  81. package/build/dist/lib/time-utils.js +87 -0
  82. package/build/dist/lib/time-utils.js.map +1 -0
  83. package/build/dist/openapi/openApiTypes.d.ts +10430 -0
  84. package/build/dist/openapi/openApiTypes.d.ts.map +1 -0
  85. package/build/dist/openapi/openApiTypes.js +571 -0
  86. package/build/dist/openapi/openApiTypes.js.map +1 -0
  87. package/build/dist/types.d.ts +168 -0
  88. package/build/dist/types.d.ts.map +1 -0
  89. package/build/dist/types.js +20 -0
  90. package/build/dist/types.js.map +1 -0
  91. package/package.json +68 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) [year] Grepr, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,71 @@
1
+ # Grepr CLI
2
+
3
+ The official command-line interface for Grepr observability platform. Query logs, manage data sources, and stream results with secure authentication.
4
+
5
+ ## Installation
6
+
7
+ ### From npm Registry (Recommended)
8
+
9
+ ```bash
10
+ # Install globally
11
+ npm install -g @grepr/cli
12
+
13
+ # Verify installation
14
+ grepr --help
15
+ ```
16
+
17
+ ### Alternative Installation Methods
18
+
19
+ ```bash
20
+ # Run without installing
21
+ npx @grepr/cli --help
22
+
23
+ # Or with yarn
24
+ yarn global add @grepr/cli
25
+ ```
26
+
27
+ ## Requirements
28
+
29
+ - **Node.js 18.0.0 or higher** - [Download here](https://nodejs.org/)
30
+ - **npm or yarn** - Usually comes with Node.js
31
+
32
+ ## Quick Start
33
+
34
+ ```bash
35
+ # Save your organization configuration
36
+ grepr --org-name your-org-name config:save myconfig
37
+
38
+ # Query your data
39
+ grepr --conf myconfig query --dataset-name "production-logs" --query "level:ERROR"
40
+
41
+ # Execute jobs from definition files
42
+ grepr --conf myconfig job:create my-job.json
43
+ ```
44
+
45
+ ## Documentation
46
+
47
+ For complete command reference, examples, and advanced usage, visit the official documentation:
48
+
49
+ **📖 [Grepr CLI Documentation](https://docs.grepr.ai/cli)**
50
+
51
+ ## Authentication
52
+
53
+ The CLI supports **OAuth 2.0** using secure browser-based login
54
+
55
+ Authentication tokens are cached locally.
56
+
57
+ ## Output Formats
58
+
59
+ - **Table** - Human-readable formatted tables (default)
60
+ - **CSV** - For data analysis and spreadsheets
61
+ - **JSON** - Machine-readable formats (pretty, raw, compact)
62
+
63
+ ## Support
64
+
65
+ - **Documentation**: [docs.grepr.ai](https://docs.grepr.ai)
66
+ - **Issues**: Contact your Grepr administrator
67
+ - **Version**: Run `grepr --version`
68
+
69
+ ## License
70
+
71
+ MIT License - see LICENSE file for details.
@@ -0,0 +1,13 @@
1
+ import { GreprApiClient } from '../lib/api-client.js';
2
+ import { FormattableCommandOptions, JobDefinition } from '../types.js';
3
+ export declare abstract class BaseCommand<T extends FormattableCommandOptions> {
4
+ private streamingExecutor;
5
+ protected apiClient: GreprApiClient | null;
6
+ constructor();
7
+ abstract execute(options: T): Promise<void>;
8
+ protected processJobStream(jobDefinition: JobDefinition, options: T): Promise<void>;
9
+ protected validateHeaderAuth(options: T): void;
10
+ protected initializeComponents(options: T): void;
11
+ protected handleError(error: Error, context?: string): void;
12
+ }
13
+ //# sourceMappingURL=base-command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-command.d.ts","sourceRoot":"","sources":["../../../src/main/typescript/commands/base-command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEvE,8BAAsB,WAAW,CAAC,CAAC,SAAS,yBAAyB;IACnE,OAAO,CAAC,iBAAiB,CAAuB;IAChD,SAAS,CAAC,SAAS,EAAE,cAAc,GAAG,IAAI,CAAQ;;IAMlD,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;cAE3B,gBAAgB,CAAC,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzF,SAAS,CAAC,kBAAkB,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI;IAO9C,SAAS,CAAC,oBAAoB,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI;IAMhD,SAAS,CAAC,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,SAAK,GAAG,IAAI;CAKxD"}
@@ -0,0 +1,28 @@
1
+ import { StreamingJobExecutor } from '../lib/streaming-job-executor.js';
2
+ export class BaseCommand {
3
+ streamingExecutor;
4
+ apiClient = null;
5
+ constructor() {
6
+ this.streamingExecutor = new StreamingJobExecutor();
7
+ }
8
+ async processJobStream(jobDefinition, options) {
9
+ await this.streamingExecutor.execute(jobDefinition, options);
10
+ }
11
+ validateHeaderAuth(options) {
12
+ if (options.authMethod === 'header' && !options.userId) {
13
+ console.error('Error: --user-id is required when using --auth-method header');
14
+ process.exit(1);
15
+ }
16
+ }
17
+ initializeComponents(options) {
18
+ // For backward compatibility, create the API client here
19
+ // The streaming executor will create its own client as needed
20
+ this.apiClient = this.streamingExecutor.createApiClient(options);
21
+ }
22
+ handleError(error, context = '') {
23
+ const errorMsg = context ? `${context}: ${error.message}` : error.message;
24
+ console.error(`[ERROR] ${context}: ${error.message}`);
25
+ process.exit(1);
26
+ }
27
+ }
28
+ //# sourceMappingURL=base-command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-command.js","sourceRoot":"","sources":["../../../src/main/typescript/commands/base-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAIxE,MAAM,OAAgB,WAAW;IACvB,iBAAiB,CAAuB;IACtC,SAAS,GAA0B,IAAI,CAAC;IAElD;QACE,IAAI,CAAC,iBAAiB,GAAG,IAAI,oBAAoB,EAAE,CAAC;IACtD,CAAC;IAIS,KAAK,CAAC,gBAAgB,CAAC,aAA4B,EAAE,OAAU;QACvE,MAAM,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IAC/D,CAAC;IAES,kBAAkB,CAAC,OAAU;QACrC,IAAI,OAAO,CAAC,UAAU,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;YACvD,OAAO,CAAC,KAAK,CAAC,8DAA8D,CAAC,CAAC;YAC9E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;IAES,oBAAoB,CAAC,OAAU;QACvC,yDAAyD;QACzD,8DAA8D;QAC9D,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACnE,CAAC;IAES,WAAW,CAAC,KAAY,EAAE,OAAO,GAAG,EAAE;QAC9C,MAAM,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC;QAC1E,OAAO,CAAC,KAAK,CAAC,WAAW,OAAO,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACtD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;CACF"}
@@ -0,0 +1,19 @@
1
+ import { Command } from 'commander';
2
+ import { ICommand } from '../lib/command-registry.js';
3
+ import { CliOptions } from '../types.js';
4
+ export declare class ConfigCommand implements ICommand {
5
+ getCommandName(): string;
6
+ getCommandDescription(): string;
7
+ getCommandOptions(): Array<{
8
+ flags: string;
9
+ description: string;
10
+ defaultValue?: any;
11
+ parser?: (value: string) => any;
12
+ }>;
13
+ addToProgram(program: Command, mergeConfiguration: (options: any) => Promise<any>): void;
14
+ saveConfig(name: string, options: CliOptions): Promise<void>;
15
+ listConfigs(): Promise<void>;
16
+ showConfig(name: string): Promise<void>;
17
+ deleteConfig(name: string): Promise<void>;
18
+ }
19
+ //# sourceMappingURL=config-command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-command.d.ts","sourceRoot":"","sources":["../../../src/main/typescript/commands/config-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,qBAAa,aAAc,YAAW,QAAQ;IAE5C,cAAc,IAAI,MAAM;IAIxB,qBAAqB,IAAI,MAAM;IAI/B,iBAAiB,IAAI,KAAK,CAAC;QACzB,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,CAAC,EAAE,GAAG,CAAC;QACnB,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,GAAG,CAAC;KACjC,CAAC;IAIF,YAAY,CACV,OAAO,EAAE,OAAO,EAChB,kBAAkB,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,GACjD,IAAI;IA2DD,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAa5D,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAa5B,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUvC,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAKhD"}
@@ -0,0 +1,108 @@
1
+ import { ConfigManager } from '../lib/config.js';
2
+ export class ConfigCommand {
3
+ getCommandName() {
4
+ return 'config';
5
+ }
6
+ getCommandDescription() {
7
+ return 'Configuration management commands';
8
+ }
9
+ getCommandOptions() {
10
+ return [];
11
+ }
12
+ addToProgram(program, mergeConfiguration) {
13
+ // config:save command
14
+ program
15
+ .command('config:save <name>')
16
+ .description('Save current configuration for reuse')
17
+ .action(async (name, options, command) => {
18
+ try {
19
+ const globalOptions = command.parent?.opts();
20
+ const mergedGlobalOptions = await mergeConfiguration(globalOptions);
21
+ await this.saveConfig(name, mergedGlobalOptions);
22
+ }
23
+ catch (error) {
24
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error';
25
+ console.error('Error saving configuration:', errorMessage);
26
+ process.exit(1);
27
+ }
28
+ });
29
+ // config:list command
30
+ program
31
+ .command('config:list')
32
+ .description('List saved configurations')
33
+ .action(async () => {
34
+ try {
35
+ await this.listConfigs();
36
+ }
37
+ catch (error) {
38
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error';
39
+ console.error('Error listing configurations:', errorMessage);
40
+ process.exit(1);
41
+ }
42
+ });
43
+ // config:show command
44
+ program
45
+ .command('config:show <name>')
46
+ .description('Show a saved configuration')
47
+ .action(async (name) => {
48
+ try {
49
+ await this.showConfig(name);
50
+ }
51
+ catch (error) {
52
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error';
53
+ console.error('Error showing configuration:', errorMessage);
54
+ process.exit(1);
55
+ }
56
+ });
57
+ // config:delete command
58
+ program
59
+ .command('config:delete <name>')
60
+ .description('Delete a saved configuration')
61
+ .action(async (name) => {
62
+ try {
63
+ await this.deleteConfig(name);
64
+ }
65
+ catch (error) {
66
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error';
67
+ console.error('Error deleting configuration:', errorMessage);
68
+ process.exit(1);
69
+ }
70
+ });
71
+ }
72
+ async saveConfig(name, options) {
73
+ if (!options.orgName) {
74
+ console.error('Error: Cannot save configuration without --org-name');
75
+ process.exit(1);
76
+ }
77
+ const configManager = new ConfigManager();
78
+ const saveableConfig = ConfigManager.extractSaveableConfig(options);
79
+ await configManager.setConfig(name, saveableConfig);
80
+ console.log(`Configuration '${name}' saved successfully.`);
81
+ }
82
+ async listConfigs() {
83
+ const configManager = new ConfigManager();
84
+ const configs = await configManager.listConfigs();
85
+ if (configs.length === 0) {
86
+ console.log('No saved configurations found.');
87
+ console.log('Use "grepr config:save <name>" to save a configuration.');
88
+ }
89
+ else {
90
+ console.log('Saved configurations:');
91
+ configs.forEach(name => console.log(` ${name}`));
92
+ }
93
+ }
94
+ async showConfig(name) {
95
+ const configManager = new ConfigManager();
96
+ const config = await configManager.getConfig(name);
97
+ if (config) {
98
+ console.log(`Configuration '${name}':`);
99
+ console.log(JSON.stringify(config, null, 2));
100
+ }
101
+ }
102
+ async deleteConfig(name) {
103
+ const configManager = new ConfigManager();
104
+ await configManager.deleteConfig(name);
105
+ console.log(`Configuration '${name}' deleted successfully.`);
106
+ }
107
+ }
108
+ //# sourceMappingURL=config-command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-command.js","sourceRoot":"","sources":["../../../src/main/typescript/commands/config-command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAIjD,MAAM,OAAO,aAAa;IAExB,cAAc;QACZ,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,qBAAqB;QACnB,OAAO,mCAAmC,CAAC;IAC7C,CAAC;IAED,iBAAiB;QAMf,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,YAAY,CACV,OAAgB,EAChB,kBAAkD;QAElD,sBAAsB;QACtB,OAAO;aACJ,OAAO,CAAC,oBAAoB,CAAC;aAC7B,WAAW,CAAC,sCAAsC,CAAC;aACnD,MAAM,CAAC,KAAK,EAAE,IAAY,EAAE,OAAY,EAAE,OAAgB,EAAE,EAAE;YAC7D,IAAI,CAAC;gBACH,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC;gBAC7C,MAAM,mBAAmB,GAAG,MAAM,kBAAkB,CAAC,aAAa,CAAC,CAAC;gBACpE,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC;YACnD,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;gBAC9E,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,YAAY,CAAC,CAAC;gBAC3D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;QACH,CAAC,CAAC,CAAC;QAEL,sBAAsB;QACtB,OAAO;aACJ,OAAO,CAAC,aAAa,CAAC;aACtB,WAAW,CAAC,2BAA2B,CAAC;aACxC,MAAM,CAAC,KAAK,IAAI,EAAE;YACjB,IAAI,CAAC;gBACH,MAAM,IAAI,CAAC,WAAW,EAAE,CA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AC,CAAC;QAEnD,IAAI,MAAM,EAAE,CAAC;YACX,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,IAAI,CAAC,CAAC;YACxC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,IAAY;QAC7B,MAAM,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC;QAC1C,MAAM,aAAa,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QACvC,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,yBAAyB,CAAC,CAAC;IAC/D,CAAC;CACF"}
@@ -0,0 +1,117 @@
1
+ import { Command } from 'commander';
2
+ import { JsonFormatter } from '../lib/json-formatter.js';
3
+ import { ICommand } from '../lib/command-registry.js';
4
+ import { GreprApiClient } from '../lib/api-client.js';
5
+ import { ApiClientFactoryOptions } from '../lib/api-client-factory.js';
6
+ export interface CrudCommandOptions extends ApiClientFactoryOptions {
7
+ quiet?: boolean;
8
+ timezone?: string;
9
+ output?: string;
10
+ format?: 'table' | 'csv' | 'pretty' | 'raw' | 'compact';
11
+ sort?: string;
12
+ color?: boolean;
13
+ timestamps?: boolean;
14
+ jobState?: boolean;
15
+ }
16
+ export interface CrudCreateUpdateOptions extends CrudCommandOptions {
17
+ resourceFile: string;
18
+ }
19
+ /**
20
+ * Base class for CRUD commands (job:*, integration:*, dataset:*)
21
+ * Provides common functionality for create, read, update, delete operations
22
+ */
23
+ export declare abstract class CrudCommand<T extends CrudCommandOptions> implements ICommand {
24
+ protected formatter: JsonFormatter | null;
25
+ protected apiClient: GreprApiClient | null;
26
+ /**
27
+ * Get the command prefix (e.g., 'job', 'integration', 'dataset')
28
+ */
29
+ abstract getCommandPrefix(): string;
30
+ /**
31
+ * Get singular resource name for messages (e.g., 'job', 'integration', 'dataset')
32
+ */
33
+ abstract getResourceName(): string;
34
+ /**
35
+ * Execute get operation
36
+ */
37
+ executeGet(resourceId: string, options: T): Promise<void>;
38
+ /**
39
+ * Execute create operation
40
+ */
41
+ executeCreate(options: CrudCreateUpdateOptions): Promise<void>;
42
+ /**
43
+ * Execute update operation
44
+ */
45
+ executeUpdate(resourceId: string, options: CrudCreateUpdateOptions): Promise<void>;
46
+ /**
47
+ * Execute delete operation
48
+ */
49
+ executeDelete(resourceId: string, options: T): Promise<void>;
50
+ /**
51
+ * Whether this command supports get operations
52
+ */
53
+ protected supportsGet(): boolean;
54
+ /**
55
+ * Whether this command supports create operations
56
+ */
57
+ protected supportsCreate(): boolean;
58
+ /**
59
+ * Whether this command supports update operations
60
+ */
61
+ protected supportsUpdate(): boolean;
62
+ /**
63
+ * Whether this command supports delete operations
64
+ */
65
+ protected supportsDelete(): boolean;
66
+ /**
67
+ * Get command-specific options for get command
68
+ */
69
+ protected getGetOptions(): Array<{
70
+ flags: string;
71
+ description: string;
72
+ defaultValue?: any;
73
+ parser?: (value: string) => any;
74
+ }>;
75
+ /**
76
+ * Get command-specific options for update command
77
+ */
78
+ protected getUpdateOptions(): Array<{
79
+ flags: string;
80
+ description: string;
81
+ defaultValue?: any;
82
+ parser?: (value: string) => any;
83
+ }>;
84
+ /**
85
+ * Add this command to the program
86
+ */
87
+ addToProgram(program: Command, mergeConfiguration: (options: any) => Promise<any>): void;
88
+ /**
89
+ * Setup formatter for output
90
+ */
91
+ protected setupFormatter(options: T): void;
92
+ /**
93
+ * Create API client using shared factory
94
+ */
95
+ protected createApiClient(options: T): GreprApiClient;
96
+ /**
97
+ * Format and output single resource
98
+ */
99
+ protected formatAndOutputSingle(data: Record<string, unknown>, options: T): Promise<void>;
100
+ /**
101
+ * Load resource definition from file
102
+ */
103
+ protected loadResourceFromFile(resourceFile: string): Promise<Record<string, unknown>>;
104
+ /**
105
+ * Show success message for create operation
106
+ */
107
+ protected showCreateSuccess(createdResource: Record<string, unknown>, options: T): void;
108
+ /**
109
+ * Show success message for update operation
110
+ */
111
+ protected showUpdateSuccess(resourceId: string, options: T): void;
112
+ /**
113
+ * Show success message for delete operation
114
+ */
115
+ protected showDeleteSuccess(resourceId: string, options: T): void;
116
+ }
117
+ //# sourceMappingURL=crud-command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crud-command.d.ts","sourceRoot":"","sources":["../../../src/main/typescript/commands/crud-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,aAAa,EAAwB,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAmB,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAExF,MAAM,WAAW,kBAAmB,SAAQ,uBAAuB;IACjE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,CAAC;IACxD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,uBAAwB,SAAQ,kBAAkB;IACjE,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,8BAAsB,WAAW,CAAC,CAAC,SAAS,kBAAkB,CAAE,YAAW,QAAQ;IACjF,SAAS,CAAC,SAAS,EAAE,aAAa,GAAG,IAAI,CAAQ;IACjD,SAAS,CAAC,SAAS,EAAE,cAAc,GAAG,IAAI,CAAQ;IAElD;;OAEG;IACH,QAAQ,CAAC,gBAAgB,IAAI,MAAM;IAEnC;;OAE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;IACH,SAAS,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI;IAgB1C;;OAEG;IACH,SAAS,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC,GAAG,cAAc;IAIrD;;OAEG;cACa,qBAAqB,CACnC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,EAAE,CAAC,GACT,OAAO,CAAC,IAAI,CAAC;IAmBhB;;OAEG;cACa,oBAAoB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAoB5F;;OAEG;IACH,SAAS,CAAC,iBAAiB,CAAC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI;IAMvF;;OAEG;IACH,SAAS,CAAC,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI;IAMjE;;OAEG;IACH,SAAS,CAAC,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI;CAKlE"}
@@ -0,0 +1,264 @@
1
+ import fs from 'fs-extra';
2
+ import { JsonFormatter } from '../lib/json-formatter.js';
3
+ import { createApiClient } from '../lib/api-client-factory.js';
4
+ /**
5
+ * Base class for CRUD commands (job:*, integration:*, dataset:*)
6
+ * Provides common functionality for create, read, update, delete operations
7
+ */
8
+ export class CrudCommand {
9
+ formatter = null;
10
+ apiClient = null;
11
+ /**
12
+ * Execute get operation
13
+ */
14
+ async executeGet(resourceId, options) {
15
+ throw new Error(`${this.getResourceName()}:get operation is not supported`);
16
+ }
17
+ /**
18
+ * Execute create operation
19
+ */
20
+ async executeCreate(options) {
21
+ throw new Error(`${this.getResourceName()}:create operation is not supported`);
22
+ }
23
+ /**
24
+ * Execute update operation
25
+ */
26
+ async executeUpdate(resourceId, options) {
27
+ throw new Error(`${this.getResourceName()}:update operation is not supported`);
28
+ }
29
+ /**
30
+ * Execute delete operation
31
+ */
32
+ async executeDelete(resourceId, options) {
33
+ throw new Error(`${this.getResourceName()}:delete operation is not supported`);
34
+ }
35
+ /**
36
+ * Whether this command supports get operations
37
+ */
38
+ supportsGet() {
39
+ return true;
40
+ }
41
+ /**
42
+ * Whether this command supports create operations
43
+ */
44
+ supportsCreate() {
45
+ return true;
46
+ }
47
+ /**
48
+ * Whether this command supports update operations
49
+ */
50
+ supportsUpdate() {
51
+ return true;
52
+ }
53
+ /**
54
+ * Whether this command supports delete operations
55
+ */
56
+ supportsDelete() {
57
+ return true;
58
+ }
59
+ /**
60
+ * Get command-specific options for get command
61
+ */
62
+ getGetOptions() {
63
+ return [];
64
+ }
65
+ /**
66
+ * Get command-specific options for update command
67
+ */
68
+ getUpdateOptions() {
69
+ return [];
70
+ }
71
+ /**
72
+ * Add this command to the program
73
+ */
74
+ addToProgram(program, mergeConfiguration) {
75
+ const prefix = this.getCommandPrefix();
76
+ const resourceName = this.getResourceName();
77
+ // Get command
78
+ if (this.supportsGet()) {
79
+ program
80
+ .command(`${prefix}:get <id>`)
81
+ .description(`Get a specific ${resourceName} by ID`)
82
+ .option('-f, --format <format>', 'Output format (table, csv, pretty, raw, compact)', 'pretty')
83
+ .option('-s, --sort <column:order>', 'Sort by column (e.g., "name:asc")', 'id:asc')
84
+ .option('--no-color', 'Disable colored output')
85
+ .option('--no-timestamps', 'Hide timestamps')
86
+ .option('--no-job-state', 'Hide job state messages')
87
+ .action(async (resourceId, options, command) => {
88
+ try {
89
+ const globalOptions = command.parent?.opts();
90
+ const mergedGlobalOptions = await mergeConfiguration(globalOptions);
91
+ const mergedOptions = {
92
+ ...mergedGlobalOptions,
93
+ ...options
94
+ };
95
+ await this.executeGet(resourceId, mergedOptions);
96
+ }
97
+ catch (error) {
98
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error';
99
+ console.error(`Error getting ${resourceName} ${resourceId}:`, errorMessage);
100
+ process.exit(1);
101
+ }
102
+ });
103
+ }
104
+ // Create command
105
+ if (this.supportsCreate()) {
106
+ program
107
+ .command(`${prefix}:create <${resourceName}-file>`)
108
+ .description(`Create a new ${resourceName} from file`)
109
+ .action(async (resourceFile, options, command) => {
110
+ try {
111
+ const globalOptions = command.parent?.opts();
112
+ const mergedGlobalOptions = await mergeConfiguration(globalOptions);
113
+ const mergedOptions = {
114
+ ...mergedGlobalOptions,
115
+ resourceFile
116
+ };
117
+ await this.executeCreate(mergedOptions);
118
+ }
119
+ catch (error) {
120
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error';
121
+ console.error(`Error creating ${resourceName}:`, errorMessage);
122
+ process.exit(1);
123
+ }
124
+ });
125
+ }
126
+ // Update command
127
+ if (this.supportsUpdate()) {
128
+ let updateCommand = program
129
+ .command(`${prefix}:update <id> <${resourceName}-file>`)
130
+ .description(`Update an existing ${resourceName}`);
131
+ // Add update-specific options
132
+ this.getUpdateOptions().forEach(option => {
133
+ if (option.parser) {
134
+ updateCommand = updateCommand.option(option.flags, option.description, option.parser, option.defaultValue);
135
+ }
136
+ else {
137
+ updateCommand = updateCommand.option(option.flags, option.description, option.defaultValue);
138
+ }
139
+ });
140
+ updateCommand.action(async (resourceId, resourceFile, options, command) => {
141
+ try {
142
+ const globalOptions = command.parent?.opts();
143
+ const mergedGlobalOptions = await mergeConfiguration(globalOptions);
144
+ const mergedOptions = {
145
+ ...mergedGlobalOptions,
146
+ resourceFile,
147
+ ...options
148
+ };
149
+ await this.executeUpdate(resourceId, mergedOptions);
150
+ }
151
+ catch (error) {
152
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error';
153
+ console.error(`Error updating ${resourceName} ${resourceId}:`, errorMessage);
154
+ process.exit(1);
155
+ }
156
+ });
157
+ }
158
+ // Delete command
159
+ if (this.supportsDelete()) {
160
+ program
161
+ .command(`${prefix}:delete <id>`)
162
+ .description(`Delete a ${resourceName}`)
163
+ .action(async (resourceId, options, command) => {
164
+ try {
165
+ const globalOptions = command.parent?.opts();
166
+ const mergedGlobalOptions = await mergeConfiguration(globalOptions);
167
+ await this.executeDelete(resourceId, mergedGlobalOptions);
168
+ }
169
+ catch (error) {
170
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error';
171
+ console.error(`Error deleting ${resourceName} ${resourceId}:`, errorMessage);
172
+ process.exit(1);
173
+ }
174
+ });
175
+ }
176
+ }
177
+ /**
178
+ * Setup formatter for output
179
+ */
180
+ setupFormatter(options) {
181
+ const formatterOptions = {
182
+ format: options.format || 'pretty',
183
+ showTimestamps: options.timestamps !== false,
184
+ colorize: options.color !== false && process.stdout.isTTY && !options.output,
185
+ sortBy: options.sort || 'id:asc'
186
+ };
187
+ // Only add timezone if it's defined
188
+ if (options.timezone) {
189
+ formatterOptions.timezone = options.timezone;
190
+ }
191
+ this.formatter = new JsonFormatter(formatterOptions);
192
+ }
193
+ /**
194
+ * Create API client using shared factory
195
+ */
196
+ createApiClient(options) {
197
+ return createApiClient(options);
198
+ }
199
+ /**
200
+ * Format and output single resource
201
+ */
202
+ async formatAndOutputSingle(data, options) {
203
+ // Setup formatter
204
+ this.setupFormatter(options);
205
+ // Handle output
206
+ if (options.output) {
207
+ // Write to file
208
+ const formattedData = this.formatter.formatObject(data);
209
+ await fs.writeFile(options.output, formattedData);
210
+ if (!options.quiet) {
211
+ console.log(`✓ Output written to ${options.output}`);
212
+ }
213
+ }
214
+ else {
215
+ // Write to stdout
216
+ console.log(this.formatter.formatObject(data));
217
+ }
218
+ }
219
+ /**
220
+ * Load resource definition from file
221
+ */
222
+ async loadResourceFromFile(resourceFile) {
223
+ try {
224
+ if (!await fs.pathExists(resourceFile)) {
225
+ throw new Error(`${this.getResourceName()} definition file not found: ${resourceFile}`);
226
+ }
227
+ const resourceData = await fs.readJson(resourceFile);
228
+ // Basic validation - most resources should have a name
229
+ if (!resourceData.name) {
230
+ throw new Error(`${this.getResourceName()} definition must include a name`);
231
+ }
232
+ return resourceData;
233
+ }
234
+ catch (error) {
235
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error';
236
+ throw new Error(`Failed to load ${this.getResourceName()} definition: ${errorMessage}`);
237
+ }
238
+ }
239
+ /**
240
+ * Show success message for create operation
241
+ */
242
+ showCreateSuccess(createdResource, options) {
243
+ if (!options.quiet) {
244
+ console.log(`✓ ${this.getResourceName()} created successfully with ID: ${createdResource.id}`);
245
+ }
246
+ }
247
+ /**
248
+ * Show success message for update operation
249
+ */
250
+ showUpdateSuccess(resourceId, options) {
251
+ if (!options.quiet) {
252
+ console.log(`✓ ${this.getResourceName()} ${resourceId} updated successfully`);
253
+ }
254
+ }
255
+ /**
256
+ * Show success message for delete operation
257
+ */
258
+ showDeleteSuccess(resourceId, options) {
259
+ if (!options.quiet) {
260
+ console.log(`✓ ${this.getResourceName()} ${resourceId} deleted successfully`);
261
+ }
262
+ }
263
+ }
264
+ //# sourceMappingURL=crud-command.js.map