@coralogix/rum-cli 1.1.26 → 1.1.28

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 (77) hide show
  1. package/README.md +86 -75
  2. package/api/client/request-builder.ts +40 -57
  3. package/api/dsym.api.ts +16 -13
  4. package/api/proguard.api.ts +64 -0
  5. package/api/react-native.api.ts +8 -14
  6. package/api/source-maps.api.ts +7 -13
  7. package/cli/commands/proguard/index.ts +5 -0
  8. package/cli/commands/proguard/upload-proguard-command.ts +36 -0
  9. package/cli/rum-cli.ts +5 -0
  10. package/config/config.ts +2 -0
  11. package/consts/consts.ts +0 -1
  12. package/dist/api/client/client-factory.d.ts +40 -0
  13. package/dist/api/client/request-builder.d.ts +27 -11
  14. package/dist/api/client/request-builder.js +15 -21
  15. package/dist/api/dsym.api.d.ts +1 -1
  16. package/dist/api/dsym.api.js +9 -7
  17. package/dist/api/proguard.api.d.ts +4 -0
  18. package/dist/api/proguard.api.js +52 -0
  19. package/dist/api/react-native.api.js +5 -4
  20. package/dist/api/source-maps.api.js +5 -4
  21. package/dist/cli/commands/proguard/index.d.ts +4 -0
  22. package/dist/cli/commands/proguard/index.js +6 -0
  23. package/dist/cli/commands/proguard/upload-proguard-command.d.ts +2 -0
  24. package/dist/cli/commands/proguard/upload-proguard-command.js +45 -0
  25. package/dist/cli/rum-cli.js +4 -1
  26. package/dist/config/config.d.ts +1 -0
  27. package/dist/config/config.js +2 -1
  28. package/dist/consts/consts.js +2 -3
  29. package/dist/models/proguard-commands.model.d.ts +11 -0
  30. package/dist/models/proguard-commands.model.js +3 -0
  31. package/dist/proto-models/com/coralogix/blobset/v2/entity_metadata.d.ts +18 -0
  32. package/dist/proto-models/com/coralogix/blobset/v2/entity_metadata.js +139 -5
  33. package/dist/proto-models/com/coralogix/blobset/v2/entity_type.d.ts +2 -1
  34. package/dist/proto-models/com/coralogix/blobset/v2/entity_type.js +7 -1
  35. package/dist/proto-models/com/coralogix/rum/v2/release_entity_metadata.d.ts +18 -0
  36. package/dist/proto-models/com/coralogix/rum/v2/release_entity_metadata.js +139 -5
  37. package/dist/proto-models/com/coralogix/rum/v2/release_entity_type.d.ts +2 -1
  38. package/dist/proto-models/com/coralogix/rum/v2/release_entity_type.js +7 -1
  39. package/dist/proto-models/com/coralogix/rum/v2/rum_sdk_versions.d.ts +1 -0
  40. package/dist/proto-models/com/coralogix/rum/v2/rum_sdk_versions.js +17 -3
  41. package/dist/proto-models/com/coralogix/rum/v2/rum_service.d.ts +93 -0
  42. package/dist/proto-models/com/coralogix/rum/v2/rum_service.js +300 -4
  43. package/dist/proto-models/com/coralogix/rum/v2/rum_settings_service.d.ts +9 -8
  44. package/dist/proto-models/com/coralogix/rum/v2/rum_settings_service.js +22 -7
  45. package/dist/services/dsym.service.d.ts +1 -1
  46. package/dist/services/dsym.service.js +3 -3
  47. package/dist/services/proguard.service.d.ts +3 -0
  48. package/dist/services/proguard.service.js +36 -0
  49. package/dist/services/react-native.service.js +2 -2
  50. package/dist/services/source-maps.service.js +2 -2
  51. package/dist/utils/file-processor.utils.d.ts +5 -8
  52. package/dist/utils/file-processor.utils.js +222 -60
  53. package/mapping.txt +160886 -0
  54. package/models/proguard-commands.model.ts +11 -0
  55. package/package.json +2 -3
  56. package/proto-models/com/coralogix/blobset/v2/entity_metadata.ts +160 -4
  57. package/proto-models/com/coralogix/blobset/v2/entity_type.ts +6 -0
  58. package/proto-models/com/coralogix/rum/v2/release_entity_metadata.ts +156 -0
  59. package/proto-models/com/coralogix/rum/v2/release_entity_type.ts +6 -0
  60. package/proto-models/com/coralogix/rum/v2/rum_sdk_versions.ts +17 -1
  61. package/proto-models/com/coralogix/rum/v2/rum_service.ts +347 -1
  62. package/proto-models/com/coralogix/rum/v2/rum_settings_service.ts +23 -6
  63. package/protofetch.lock +4 -4
  64. package/protofetch.toml +3 -3
  65. package/protos/com/coralogix/blobset/v2/entity_metadata.proto +9 -0
  66. package/protos/com/coralogix/blobset/v2/entity_type.proto +1 -0
  67. package/protos/com/coralogix/rum/v2/release_entity_metadata.proto +9 -0
  68. package/protos/com/coralogix/rum/v2/release_entity_type.proto +1 -0
  69. package/protos/com/coralogix/rum/v2/rum_sdk_versions.proto +1 -0
  70. package/protos/com/coralogix/rum/v2/rum_service.proto +23 -0
  71. package/protos/com/coralogix/rum/v2/rum_settings_service.proto +3 -1
  72. package/protoset.bin +0 -0
  73. package/services/dsym.service.ts +2 -2
  74. package/services/proguard.service.ts +33 -0
  75. package/services/react-native.service.ts +1 -1
  76. package/services/source-maps.service.ts +1 -1
  77. package/utils/file-processor.utils.ts +224 -70
package/README.md CHANGED
@@ -1,23 +1,26 @@
1
1
  # Official Coralogix RUM CLI
2
2
 
3
- The Coralogix RUM CLI is a command-line interface tool that simplifies the process of uploading rum data . This CLI tool provides an easy and efficient way to authenticate with the Coralogix API.
3
+ The Coralogix RUM CLI is a command-line tool designed to simplify the process of uploading RUM (Real User Monitoring)
4
+ data. It provides a streamlined way to authenticate with the Coralogix API and manage source maps, dSYM files, and
5
+ ProGuard mappings.
4
6
 
5
7
  [![npm version](https://img.shields.io/npm/v/@coralogix/browser.svg)](https://www.npmjs.com/package/@coralogix/browser)
6
8
 
7
- # Links
9
+ ## Links
8
10
 
9
11
  - [Coralogix Real User Monitoring Docs](https://coralogix.com/docs/real-user-monitoring/)
10
-
11
12
  - [Coralogix SDK for Browsers](https://www.npmjs.com/package/@coralogix/browser)
12
13
 
13
- # Installation
14
+ ## Installation
14
15
 
15
16
  To install the Coralogix RUM CLI, follow these steps:
16
17
 
17
18
  1. Open a terminal or command prompt.
18
- 2. Run the following command to install the CLI globally: `npm install -g coralogix-rum-cli`
19
- 3. Once the installation is complete, you can use the CLI by running the `coralogix-rum-cli` command in your terminal.
20
-
19
+ 2. Run the following command to install the CLI globally:
20
+ ```bash
21
+ npm install -g coralogix-rum-cli
22
+ ```
23
+ 3. Once installed, you can use the CLI by running `coralogix-rum-cli` in your terminal.
21
24
 
22
25
  ## Commands
23
26
 
@@ -25,122 +28,130 @@ Here are some examples of how to use the Coralogix RUM CLI:
25
28
 
26
29
  ### Web:
27
30
 
28
- 1. Upload source maps:
31
+ Upload source maps:
29
32
 
30
- - `coralogix-rum-cli upload-source-maps -k <privateKey> -a <application> -v <version> -f <folderPath> -e <env> -c <commitHash> -n <repoName> -o <orgName>`
33
+ ```bash
34
+ coralogix-rum-cli upload-source-maps -k <privateKey> -a <application> -v <version> -f <folderPath> -e <env> -c <commitHash> -n <repoName> -o <orgName>
35
+ ```
31
36
 
32
37
  ### React Native:
33
38
 
34
- 1. Upload React Native source maps:
39
+ Upload React Native source maps:
35
40
 
36
- - `coralogix-rum-cli upload-react-native-source-maps -k <privateKey> -a <application> -v <version> -f <folderPath> -e <env> -c <commitHash> -n <repoName> -o <orgName>`
41
+ ```bash
42
+ coralogix-rum-cli upload-react-native-source-maps -k <privateKey> -a <application> -v <version> -f <folderPath> -e <env> -c <commitHash> -n <repoName> -o <orgName>
43
+ ```
37
44
 
38
45
  ### iOS:
39
46
 
40
- 1. Upload dSYM files:
47
+ Upload dSYM file:
41
48
 
42
- - `coralogix-rum-cli upload-dsym -k <privateKey> -a <application> -v <version> -f <folderPath> -e <env> -c <commitHash> -n <repoName> -o <orgName>`
49
+ ```bash
50
+ coralogix-rum-cli upload-dsym -k <privateKey> -a <application> -v <version> -f <folderPath> -e <env> -c <commitHash> -n <repoName> -o <orgName>
51
+ ```
52
+
53
+ ### Android:
54
+
55
+ Upload ProGuard file:
56
+
57
+ ```bash
58
+ coralogix-rum-cli upload-proguard -k <privateKey> -a <application> -v <version> -f <folderPath> -e <env> -c <commitHash> -n <repoName> -o <orgName>
59
+ ```
43
60
 
44
61
  ## Options
45
62
 
46
63
  - `-k, --private-key <privateKey>`: Private key to authenticate with the Coralogix API.
47
64
  - `-a, --application <application>`: Name of the application.
48
- - `-v, --version <version>`: The application version - must match the version used by RUM sdk.
49
- - `-f, --folder-path <folderPath>`: Path to the folder containing the source maps.
50
- - `-e, --env <env>`: Your environment.
65
+ - `-v, --version <version>`: The application version (must match the version used by the RUM SDK).
66
+ - `-f, --folder-path <folderPath>`: Path to the folder containing the Source Maps, dSYM file, or ProGuard mapping file.
67
+ - `-e, --env <env>`: Your environment (e.g., EU1, US1).
51
68
  - `-c, --commit-hash <commitHash>`: GitHub commit hash (optional).
52
69
  - `-n, --repo-name <repoName>`: GitHub repository name (optional).
53
70
  - `-o, --org-name <orgName>`: GitHub organization name (optional).
54
- - `-g, --generate <generate>`: Update existing release or create a new one if not found (optional).
71
+ - `-g, --generate`: Update existing release or create a new one if not found (optional).
55
72
  - `-h, --help`: Display help.
56
73
 
57
74
  ## Environments
58
75
 
59
- The Coralogix RUM CLI supports the following environments:
76
+ Specify the appropriate environment using the `-e` option:
60
77
 
61
- - EU1: https://ng-api-grpc.coralogix.com:443, // eu-west-1 (Ireland)
62
- - EU2: https://ng-api-grpc.eu2.coralogix.com:443, // eu-north-1 (Stockholm)
63
- - US1: https://ng-api-grpc.coralogix.us:443, // us-east-2 (Ohio)
64
- - US2: https://ng-api-grpc.cx498.coralogix.com:443, // us-west-2 (Oregon)
65
- - AP1: https://ng-api-grpc.app.coralogix.in:443, // ap-south-1 (Mumbai)
66
- - AP2: https://ng-api-grpc.coralogixsg.com:443, // ap-southeast-1 (Singapore)
78
+ - **EU1:** `https://ng-api-grpc.coralogix.com:443` (eu-west-1, Ireland)
79
+ - **EU2:** `https://ng-api-grpc.eu2.coralogix.com:443` (eu-north-1, Stockholm)
80
+ - **US1:** `https://ng-api-grpc.coralogix.us:443` (us-east-2, Ohio)
81
+ - **US2:** `https://ng-api-grpc.cx498.coralogix.com:443` (us-west-2, Oregon)
82
+ - **AP1:** `https://ng-api-grpc.app.coralogix.in:443` (ap-south-1, Mumbai)
83
+ - **AP2:** `https://ng-api-grpc.coralogixsg.com:443` (ap-southeast-1, Singapore)
67
84
 
85
+ ## Folder Size Limits
68
86
 
69
- Please use the appropriate environment value when specifying the `-e, --env` option.
70
-
71
- ## React Native Source maps folder size limit
87
+ Ensure your files do not exceed the following size limits:
72
88
 
73
- The source map folder size limit is 200MB in this project. Please ensure that it does not exceed this limit.
89
+ - **React Native Source Maps:** 200MB per folder
90
+ - **Source Maps:** 200MB per folder
91
+ - **ProGuard Files:** 200MB per folder
92
+ - **dSYM Files:** 400MB per file
74
93
 
75
- ## Source maps folder size limit
94
+ ## Integration
76
95
 
77
- The source map folder size limit is 200MB in this project. Please ensure that it does not exceed this limit.
96
+ ### CI Integration:
78
97
 
79
- ## Dsym folder size limit
98
+ To automate the upload process in your CI pipeline:
80
99
 
81
- The dsym folder size limit is 500MB in this project. Please ensure that it does not exceed this limit.
100
+ 1. **Create a Shell Script:**
101
+ - Name it according to the use case (
102
+ e.g., `upload-source-maps.sh`, `upload-react-native-source-maps.sh`, `upload-dsym.sh`, or `upload-proguard.sh`).
82
103
 
104
+ 2. **Template for the Script:**
105
+ ```bash
106
+ #! /usr/bin/env bash
83
107
 
84
- ## Folder Size Limits
85
- - **Source Maps (including React Native)**: The source map folder size limit is 200MB. Please ensure that it does not exceed this limit.
86
- - **dSYM**: The dSYM folder size limit is 400MB. Please ensure that it does not exceed this limit.
108
+ # Replace these values with your actual information
109
+ REPO_NAME="your-repo-name"
110
+ ORG_NAME="your-github-username"
111
+ APPLICATION="your-application-name"
112
+ ENV="your-environment"
113
+ FILES_PATH="your-files-path"
114
+ PRIVATE_KEY="your-coralogix-private-key"
115
+ VERSION="your-application-version"
87
116
 
117
+ # Get the commit hash using git rev-parse
118
+ COMMIT_HASH=$(git rev-parse HEAD)
88
119
 
89
- ## Integration
120
+ # Run Coralogix RUM CLI to upload the respective files
121
+ coralogix-rum-cli upload-<command> -k "$PRIVATE_KEY" -a "$APPLICATION" -v "$VERSION" -f "$FILES_PATH" -e "$ENV" -c "$COMMIT_HASH" -n "$REPO_NAME" -o "$ORG_NAME"
122
+ ```
90
123
 
91
- ### <u> CI Integration: </u>
124
+ Replace `<command>` with `source-maps`, `react-native-source-maps`, `dsym`, or `proguard` based on the file type.
92
125
 
93
- 1. Create a new file named `upload-source-maps.sh` and open it for editing.
126
+ ### Non-CI Integration:
94
127
 
95
- 2. Copy and paste the following script into the file, replacing the placeholder values with your actual information:
128
+ For manual uploads, use the corresponding command in your terminal:
96
129
 
97
130
  ```bash
98
- #! /usr/bin/env bash
99
-
100
- # Replace these values with your actual information
101
- REPO_NAME="your-repo-name"
102
- ORG_NAME="your-github-username"
103
- APPLICATION="your-application-name"
104
- ENV="your-environment"
105
- SOURCE_MAPS_PATH="your-source-maps-path"
106
- PRIVATE_KEY="your-coralogix-private-key"
107
- VERSION="your-application-version"
108
-
109
- # Get the commit hash using git rev-parse
110
- COMMIT_HASH=$(git rev-parse HEAD)
111
-
112
- # Run Coralogix RUM CLI to upload source maps
113
- coralogix-rum-cli upload-source-maps -k "$PRIVATE_KEY" -a "$APPLICATION" -v "$VERSION" -f "$SOURCE_MAPS_PATH" -e "$ENV" -c "$COMMIT_HASH" -n "$REPO_NAME" -o "$ORG_NAME"
131
+ coralogix-rum-cli upload-<command> -k "$PRIVATE_KEY" -a "$APPLICATION" -v "$VERSION" -f "$FILES_PATH" -e "$ENV" -c "$COMMIT_HASH" -n "$REPO_NAME" -o "$ORG_NAME"
114
132
  ```
115
133
 
116
- ### <u> Non-CI Integration: </u>
117
-
118
- 1. Open a terminal window,and run the following command:
119
- ```bash
120
- coralogix-rum-cli upload-source-maps -k "$PRIVATE_KEY" -a "$APPLICATION" -v "$VERSION" -f "$SOURCE_MAPS_PATH" -e "$ENV" -c "$COMMIT_HASH" -n "$REPO_NAME" -o "$ORG_NAME"
121
- ```
134
+ Replace `<command>` with one of the following as needed:
122
135
 
123
- <br>
136
+ - `source-maps`
137
+ - `react-native-source-maps`
138
+ - `dsym`
139
+ - `proguard`
124
140
 
125
- | IMPORTANT: The $VERSION param must align with the content of the version field in your CoralogixRum.init() configuration in [Coralogix SDK for Browsers](https://www.npmjs.com/package/@coralogix/browser) |
126
- |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
141
+ | IMPORTANT: The $VERSION parameter must exactly match the version specified in the SDK initialization (init) function configuration in your [Coralogix SDK for Browsers](https://www.npmjs.com/package/@coralogix/browser) |
142
+ |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
127
143
 
128
144
 
129
145
  ## Optional GitHub Information
130
146
 
131
- The following options are optional and relate to GitHub information, providing context for source maps:
132
-
133
- - `-c, --commit-hash <commitHash>`: This option allows you to provide the GitHub commit hash associated with the source maps. Including this hash can help in tracking down issues specific to a particular commit.
134
-
135
-
136
- - `-n, --repo-name <repoName>`: By specifying the GitHub repository name, you're indicating the repository where the source code is hosted. This information aids in correlating source maps with the correct repository.
137
-
147
+ You can provide additional GitHub-related options to enhance source map management:
138
148
 
139
- - `-o, --org-name <orgName>`: This option enables you to input your GitHub organization user, helping to attribute the source maps to the appropriate organization user.
149
+ - `-c, --commit-hash <commitHash>`: The commit hash associated with the source maps.
150
+ - `-n, --repo-name <repoName>`: The repository name where the source code is hosted.
151
+ - `-o, --org-name <orgName>`: The organization user associated with the repository.
140
152
 
141
- <br>
142
- Providing these GitHub-related options can enhance the accuracy of source map management and issue tracking within Coralogix RUM. However, they are not mandatory and can be omitted if not applicable.
153
+ These options are optional but can improve issue tracking within Coralogix RUM.
143
154
 
144
155
  ## License
145
156
 
146
- This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
157
+ This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
@@ -1,12 +1,17 @@
1
1
  import { EntityType } from '../../proto-models/com/coralogix/blobset/v2/entity_type';
2
- import { DsymMetadata, EntityMetadata, SourceMapMetadata } from '../../proto-models/com/coralogix/blobset/v2/entity_metadata';
2
+ import {
3
+ DsymMetadata,
4
+ EntityMetadata,
5
+ ProguardMetadata,
6
+ SourceMapMetadata,
7
+ } from '../../proto-models/com/coralogix/blobset/v2/entity_metadata';
3
8
  import { CreateEntityReleaseRequest } from '../../proto-models/com/coralogix/rum/v2/rum_source_map_service';
4
- import { ReleaseEntityMetadata } from '../../proto-models/com/coralogix/rum/v2/release_entity_metadata';
9
+ import { ReactNativeMetadata, ReleaseEntityMetadata } from '../../proto-models/com/coralogix/rum/v2/release_entity_metadata';
5
10
  import { ReleaseEntityType } from '../../proto-models/com/coralogix/rum/v2/release_entity_type';
6
11
  import { UploadBlobRequest } from '../../proto-models/com/coralogix/blobset/v2/blobset_service';
7
12
 
8
13
  export class RequestBuilder {
9
- private static createSourceMapMetadata(
14
+ static createSourceMapMetadata(
10
15
  application: string,
11
16
  version: string,
12
17
  repoName: string | undefined,
@@ -25,7 +30,26 @@ export class RequestBuilder {
25
30
  };
26
31
  }
27
32
 
28
- private static createDsymMetadata(
33
+ static createProguardMetadata(
34
+ application: string,
35
+ version: string,
36
+ repoName: string | undefined,
37
+ commitHash: string | undefined,
38
+ orgName: string | undefined,
39
+ ): { $case: 'proguardMetadata'; proguardMetadata: ProguardMetadata } {
40
+ return {
41
+ $case: 'proguardMetadata',
42
+ proguardMetadata: {
43
+ application,
44
+ releaseId: version,
45
+ repoName: repoName || '',
46
+ commitHash: commitHash || '',
47
+ orgName: orgName || '',
48
+ },
49
+ };
50
+ }
51
+
52
+ static createDsymMetadata(
29
53
  application: string,
30
54
  version: string,
31
55
  repoName: string | undefined,
@@ -44,70 +68,29 @@ export class RequestBuilder {
44
68
  };
45
69
  }
46
70
 
47
- static buildUploadBlobRequest(
48
- uploadBlobRequest: UploadBlobRequest,
71
+ static createUploadBlobRequest(
72
+ metadata:
73
+ | { $case: 'dsymMetadata'; dsymMetadata: DsymMetadata }
74
+ | { $case: 'sourceMapMetadata'; sourceMapMetadata: SourceMapMetadata }
75
+ | { $case: 'proguardMetadata'; proguardMetadata: ProguardMetadata },
49
76
  entityType: EntityType,
50
- metadata: { $case: 'dsymMetadata'; dsymMetadata: DsymMetadata } | { $case: 'sourceMapMetadata'; sourceMapMetadata: SourceMapMetadata },
77
+ uploadBlobRequest: UploadBlobRequest,
51
78
  ): UploadBlobRequest {
52
79
  const entityMetadata: EntityMetadata = { metadata };
53
80
 
54
81
  return { ...uploadBlobRequest, entityType, entityMetadata };
55
82
  }
56
83
 
57
- static buildCreateEntityReleaseRequest(
84
+ static createEntityReleaseRequest(
85
+ metadata:
86
+ | { $case: 'dsymMetadata'; dsymMetadata: DsymMetadata }
87
+ | { $case: 'sourceMapMetadata'; sourceMapMetadata: SourceMapMetadata }
88
+ | { $case: 'reactNativeMetadata'; reactNativeMetadata: ReactNativeMetadata }
89
+ | { $case: 'proguardMetadata'; proguardMetadata: ProguardMetadata },
58
90
  releaseEntityType: ReleaseEntityType,
59
- metadata: { $case: 'dsymMetadata'; dsymMetadata: DsymMetadata } | { $case: 'sourceMapMetadata'; sourceMapMetadata: SourceMapMetadata },
60
91
  ): CreateEntityReleaseRequest {
61
92
  const releaseEntityMetadata: ReleaseEntityMetadata = { metadata };
62
93
 
63
94
  return CreateEntityReleaseRequest.create({ releaseEntityType, releaseEntityMetadata });
64
95
  }
65
-
66
- static createSourceMapsUploadBlobRequest(
67
- entityType: EntityType,
68
- uploadBlobRequest: UploadBlobRequest,
69
- application: string,
70
- version: string,
71
- repoName: string | undefined,
72
- commitHash: string | undefined,
73
- orgName: string | undefined,
74
- ): UploadBlobRequest {
75
- const metadata = this.createSourceMapMetadata(application, version, repoName, commitHash, orgName);
76
- return this.buildUploadBlobRequest(uploadBlobRequest, entityType, metadata);
77
- }
78
-
79
- static createDsymUploadBlobRequest(
80
- uploadBlobRequest: UploadBlobRequest,
81
- application: string,
82
- version: string,
83
- repoName: string | undefined,
84
- commitHash: string | undefined,
85
- orgName: string | undefined,
86
- ): UploadBlobRequest {
87
- const metadata = this.createDsymMetadata(application, version, repoName, commitHash, orgName);
88
- return this.buildUploadBlobRequest(uploadBlobRequest, EntityType.ENTITY_TYPE_DSYM, metadata);
89
- }
90
-
91
- static createDsymReleaseRequest(
92
- application: string,
93
- version: string,
94
- repoName: string | undefined,
95
- commitHash: string | undefined,
96
- orgName: string | undefined,
97
- ): CreateEntityReleaseRequest {
98
- const metadata = this.createDsymMetadata(application, version, repoName, commitHash, orgName);
99
- return this.buildCreateEntityReleaseRequest(ReleaseEntityType.RELEASE_ENTITY_TYPE_DSYM, metadata);
100
- }
101
-
102
- static createReactNativeReleaseRequest(
103
- application: string,
104
- version: string,
105
- repoName: string | undefined,
106
- commitHash: string | undefined,
107
- orgName: string | undefined,
108
- releaseEntityType: ReleaseEntityType,
109
- ): CreateEntityReleaseRequest {
110
- const metadata = this.createSourceMapMetadata(application, version, repoName, commitHash, orgName);
111
- return this.buildCreateEntityReleaseRequest(releaseEntityType, metadata);
112
- }
113
96
  }
package/api/dsym.api.ts CHANGED
@@ -4,12 +4,13 @@ import { BlobSetServiceDefinition, UploadBlobRequest } from '../proto-models/com
4
4
  import { consoleError, createUploadBlobRequestChunks, validateCompressedFilesSize } from '../utils/shared.utils';
5
5
  import { ReleaseEntityType } from '../proto-models/com/coralogix/rum/v2/release_entity_type';
6
6
  import { ClientFactory } from './client/client-factory';
7
- import { RumSourceMapServiceDefinition } from '../proto-models/com/coralogix/rum/v2/rum_source_map_service';
7
+ import { CreateEntityReleaseRequest, RumSourceMapServiceDefinition } from '../proto-models/com/coralogix/rum/v2/rum_source_map_service';
8
8
  import { RequestBuilder } from './client/request-builder';
9
+ import { EntityType } from '../proto-models/com/coralogix/blobset/v2/entity_type';
9
10
 
10
11
  export class DsymApi {
11
12
  static async uploadDsym(
12
- uploadBlobRequest: UploadBlobRequest,
13
+ request: UploadBlobRequest,
13
14
  application: string,
14
15
  version: string,
15
16
  repoName: string | undefined,
@@ -25,7 +26,7 @@ export class DsymApi {
25
26
  const metadata = new Metadata();
26
27
  metadata.set('Authorization', `Bearer ${privateKey}`);
27
28
 
28
- validateCompressedFilesSize(uploadBlobRequest.data.length, config.rumApi.reactNativeMaxCompressedFilesSize);
29
+ validateCompressedFilesSize(request.data.length, config.rumApi.reactNativeMaxCompressedFilesSize);
29
30
 
30
31
  const { exists } = await rumSourceMapClient.isEntityReleaseExists(
31
32
  { releaseId: version, application, releaseEntityType: ReleaseEntityType.RELEASE_ENTITY_TYPE_DSYM },
@@ -37,22 +38,24 @@ export class DsymApi {
37
38
  return;
38
39
  }
39
40
 
40
- const updatedUploadBlobRequest = RequestBuilder.createDsymUploadBlobRequest(
41
- uploadBlobRequest,
42
- application,
43
- version,
44
- repoName,
45
- commitHash,
46
- orgName,
41
+ const dsymMetadata = RequestBuilder.createDsymMetadata(application, version, repoName, commitHash, orgName);
42
+
43
+ const uploadBlobRequest: UploadBlobRequest = RequestBuilder.createUploadBlobRequest(
44
+ dsymMetadata,
45
+ EntityType.ENTITY_TYPE_DSYM,
46
+ request,
47
47
  );
48
48
 
49
- const iterableRequest = createUploadBlobRequestChunks(updatedUploadBlobRequest);
49
+ const iterableRequest = createUploadBlobRequestChunks(uploadBlobRequest);
50
50
 
51
51
  await blobSetClient.uploadBlob(iterableRequest, { metadata });
52
52
 
53
- const uploadEntityReleaseRequest = RequestBuilder.createDsymReleaseRequest(application, version, repoName, commitHash, orgName);
53
+ const entityReleaseRequest: CreateEntityReleaseRequest = RequestBuilder.createEntityReleaseRequest(
54
+ dsymMetadata,
55
+ ReleaseEntityType.RELEASE_ENTITY_TYPE_DSYM,
56
+ );
54
57
 
55
- await rumSourceMapClient.createEntityRelease(uploadEntityReleaseRequest, { metadata });
58
+ await rumSourceMapClient.createEntityRelease(entityReleaseRequest, { metadata });
56
59
  } catch (error) {
57
60
  consoleError(`Failed to upload dSYMs: ${error}`);
58
61
  throw error;
@@ -0,0 +1,64 @@
1
+ import { Client, Metadata } from 'nice-grpc';
2
+ import { BlobSetServiceDefinition, UploadBlobRequest } from '../proto-models/com/coralogix/blobset/v2/blobset_service';
3
+ import { consoleError, createUploadBlobRequestChunks, validateCompressedFilesSize } from '../utils/shared.utils';
4
+ import { ClientFactory } from './client/client-factory';
5
+ import { RequestBuilder } from './client/request-builder';
6
+ import { EntityType } from '../proto-models/com/coralogix/blobset/v2/entity_type';
7
+ import config from '../config/config';
8
+ import { CreateEntityReleaseRequest, RumSourceMapServiceDefinition } from '../proto-models/com/coralogix/rum/v2/rum_source_map_service';
9
+ import { ReleaseEntityType } from '../proto-models/com/coralogix/rum/v2/release_entity_type';
10
+
11
+ export class ProguardApi {
12
+ static async uploadProguard(
13
+ request: UploadBlobRequest,
14
+ application: string,
15
+ version: string,
16
+ repoName: string | undefined,
17
+ commitHash: string | undefined,
18
+ orgName: string | undefined,
19
+ env: string,
20
+ privateKey: string,
21
+ ): Promise<void> {
22
+ try {
23
+ const blobSetClient: Client<typeof BlobSetServiceDefinition> = ClientFactory.getBlobSetGrpcClient(env);
24
+ const rumSourceMapClient: Client<typeof RumSourceMapServiceDefinition> = ClientFactory.getRumSourceMapGrpcClient(env);
25
+
26
+ const metadata: Metadata = new Metadata();
27
+ metadata.set('Authorization', `Bearer ${privateKey}`);
28
+
29
+ validateCompressedFilesSize(request.data.length, config.rumApi.proguardMaxCompressedFilesSize);
30
+
31
+ const { exists } = await rumSourceMapClient.isEntityReleaseExists(
32
+ { releaseId: version, application, releaseEntityType: ReleaseEntityType.RELEASE_ENTITY_TYPE_PROGUARD },
33
+ { metadata },
34
+ );
35
+
36
+ if (exists) {
37
+ consoleError(`Entity release already exists for releaseId: ${version} and application: ${application}`);
38
+ return;
39
+ }
40
+
41
+ const proguardMetadata = RequestBuilder.createProguardMetadata(application, version, repoName, commitHash, orgName);
42
+
43
+ const uploadBlobRequest: UploadBlobRequest = RequestBuilder.createUploadBlobRequest(
44
+ proguardMetadata,
45
+ EntityType.ENTITY_TYPE_PROGUARD,
46
+ request,
47
+ );
48
+
49
+ const iterableRequest = createUploadBlobRequestChunks(uploadBlobRequest);
50
+
51
+ await blobSetClient.uploadBlob(iterableRequest, { metadata });
52
+
53
+ const entityReleaseRequest: CreateEntityReleaseRequest = RequestBuilder.createEntityReleaseRequest(
54
+ proguardMetadata,
55
+ ReleaseEntityType.RELEASE_ENTITY_TYPE_PROGUARD,
56
+ );
57
+
58
+ await rumSourceMapClient.createEntityRelease(entityReleaseRequest, { metadata });
59
+ } catch (error) {
60
+ consoleError(`Failed to upload proguard: ${error}`);
61
+ throw error;
62
+ }
63
+ }
64
+ }
@@ -38,30 +38,24 @@ export class ReactNativeApi {
38
38
  return;
39
39
  }
40
40
 
41
- const uploadBlobRequest: UploadBlobRequest = RequestBuilder.createSourceMapsUploadBlobRequest(
42
- EntityType.ENTITY_TYPE_REACT_NATIVE,
41
+ const reactNativeMetadata = RequestBuilder.createSourceMapMetadata(application, version, repoName, commitHash, orgName);
42
+
43
+ const uploadBlobRequest: UploadBlobRequest = RequestBuilder.createUploadBlobRequest(
44
+ reactNativeMetadata,
45
+ EntityType.ENTITY_TYPE_SOURCE_MAP,
43
46
  request,
44
- application,
45
- version,
46
- repoName,
47
- commitHash,
48
- orgName,
49
47
  );
50
48
 
51
49
  const iterableRequest = createUploadBlobRequestChunks(uploadBlobRequest);
52
50
 
53
51
  await blobSetClient.uploadBlob(iterableRequest, { metadata });
54
52
 
55
- const uploadEntityReleaseRequest: CreateEntityReleaseRequest = RequestBuilder.createReactNativeReleaseRequest(
56
- application,
57
- version,
58
- repoName,
59
- commitHash,
60
- orgName,
53
+ const entityReleaseRequest: CreateEntityReleaseRequest = RequestBuilder.createEntityReleaseRequest(
54
+ reactNativeMetadata,
61
55
  ReleaseEntityType.RELEASE_ENTITY_TYPE_REACT_NATIVE,
62
56
  );
63
57
 
64
- await rumSourceMapClient.createEntityRelease(uploadEntityReleaseRequest, { metadata });
58
+ await rumSourceMapClient.createEntityRelease(entityReleaseRequest, { metadata });
65
59
  } catch (error) {
66
60
  consoleError(`Failed to upload react native source maps: ${error}`);
67
61
  throw error;
@@ -38,30 +38,24 @@ export class SourceMapsApi {
38
38
  return;
39
39
  }
40
40
 
41
- const uploadBlobRequest: UploadBlobRequest = RequestBuilder.createSourceMapsUploadBlobRequest(
41
+ const sourceMapMetadata = RequestBuilder.createSourceMapMetadata(application, version, repoName, commitHash, orgName);
42
+
43
+ const uploadBlobRequest: UploadBlobRequest = RequestBuilder.createUploadBlobRequest(
44
+ sourceMapMetadata,
42
45
  EntityType.ENTITY_TYPE_SOURCE_MAP,
43
46
  request,
44
- application,
45
- version,
46
- repoName,
47
- commitHash,
48
- orgName,
49
47
  );
50
48
 
51
49
  const iterableRequest = createUploadBlobRequestChunks(uploadBlobRequest);
52
50
 
53
51
  await blobSetClient.uploadBlob(iterableRequest, { metadata });
54
52
 
55
- const uploadEntityReleaseRequest: CreateEntityReleaseRequest = RequestBuilder.createReactNativeReleaseRequest(
56
- application,
57
- version,
58
- repoName,
59
- commitHash,
60
- orgName,
53
+ const entityReleaseRequest: CreateEntityReleaseRequest = RequestBuilder.createEntityReleaseRequest(
54
+ sourceMapMetadata,
61
55
  ReleaseEntityType.RELEASE_ENTITY_TYPE_SOURCE_MAP,
62
56
  );
63
57
 
64
- await rumSourceMapClient.createEntityRelease(uploadEntityReleaseRequest, { metadata });
58
+ await rumSourceMapClient.createEntityRelease(entityReleaseRequest, { metadata });
65
59
  } catch (error) {
66
60
  consoleError(`Failed to upload source maps: ${error}`);
67
61
  throw error;
@@ -0,0 +1,5 @@
1
+ import { uploadProguardCommand } from './upload-proguard-command';
2
+
3
+ const proguardCommands = { uploadProguardCommand };
4
+
5
+ export default proguardCommands;
@@ -0,0 +1,36 @@
1
+ import { Command } from 'commander';
2
+ import { validateEnvironment } from '../../validators';
3
+ import { checkMissingArguments, consoleError } from '../../../utils/shared.utils';
4
+ import { UploadProguardCommandOptions } from '../../../models/proguard-commands.model';
5
+ import { ProguardService } from '../../../services/proguard.service';
6
+
7
+ export const uploadProguardCommand = () => {
8
+ const uploadCommand = new Command('upload-proguard')
9
+ .option('-k, --private-key <privateKey>', 'Private key to authenticate with the API')
10
+ .option('-a, --application <application>', 'Name of the application')
11
+ .option('-v, --version <version>', 'The application version - must match the version used by RUM sdk')
12
+ .option('-f, --folder-path <folderPath>', 'Path to the folder containing the proguard mapping file')
13
+ .option('-e, --env <env>', 'Your environment', validateEnvironment)
14
+ .option('-c, --commit-hash <commitHash>', 'GitHub commit hash (optional)')
15
+ .option('-n, --repo-name <repoName>', 'GitHub Repository name (optional)')
16
+ .option('-o, --org-name <orgName>', 'GitHub user name (optional)')
17
+ .description('Upload Proguard mapping file')
18
+ .action(async (options: UploadProguardCommandOptions) => {
19
+ try {
20
+ if (options.help) {
21
+ uploadCommand.outputHelp();
22
+ process.exit(0);
23
+ }
24
+
25
+ const { privateKey, application, version, folderPath, commitHash, repoName, orgName, env } = options;
26
+
27
+ checkMissingArguments<UploadProguardCommandOptions>(options, ['privateKey', 'application', 'version', 'folderPath', 'env']);
28
+
29
+ await ProguardService.upload(application, version, repoName, commitHash, orgName, folderPath, env, privateKey);
30
+ } catch (error) {
31
+ consoleError(error);
32
+ }
33
+ });
34
+
35
+ return uploadCommand;
36
+ };
package/cli/rum-cli.ts CHANGED
@@ -3,6 +3,7 @@ import { Command } from 'commander';
3
3
  import sourceMapsCommands from './commands/source-maps';
4
4
  import reactNativeCommands from './commands/react-native';
5
5
  import dsymCommands from './commands/dsym';
6
+ import proguardCommands from './commands/proguard';
6
7
 
7
8
  const program: Command = new Command();
8
9
 
@@ -15,6 +16,8 @@ const uploadReactNativeSourceMapsCommand: Command = reactNativeCommands.uploadRe
15
16
 
16
17
  const uploadDsymCommand: Command = dsymCommands.uploadDsymCommand();
17
18
 
19
+ const uploadProguardCommand: Command = proguardCommands.uploadProguardCommand();
20
+
18
21
  // Register commands
19
22
  program.addCommand(uploadSourceMapCommand);
20
23
 
@@ -22,5 +25,7 @@ program.addCommand(uploadReactNativeSourceMapsCommand);
22
25
 
23
26
  program.addCommand(uploadDsymCommand);
24
27
 
28
+ program.addCommand(uploadProguardCommand);
29
+
25
30
  // Parse command line arguments
26
31
  program.parse(process.argv);
package/config/config.ts CHANGED
@@ -14,6 +14,7 @@ export interface rumApiConfig {
14
14
  reactNativeMaxCompressedFilesSize: number;
15
15
  sourceMapsMaxCompressedFilesSize: number;
16
16
  dsymMaxCompressedFilesSize: number;
17
+ proguardMaxCompressedFilesSize: number;
17
18
  }
18
19
 
19
20
  export interface Config {
@@ -33,6 +34,7 @@ const config: Config = {
33
34
  dsymMaxMessageSize: 400 * MB, // 400MB(in bytes)
34
35
  reactNativeMaxCompressedFilesSize: 200 * MB, // 200MB (in bytes)
35
36
  sourceMapsMaxCompressedFilesSize: 200 * MB, // 200MB (in bytes)
37
+ proguardMaxCompressedFilesSize: 200 * MB, // 200MB (in bytes)
36
38
  dsymMaxCompressedFilesSize: 400 * MB, // 400MB (in bytes)
37
39
  chunkSize: MB, // 1MB (in bytes)
38
40
  },