@coralogix/rum-cli 1.1.27 → 1.1.29
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/README.md +86 -75
- package/api/base/base.api.ts +118 -0
- package/api/dsym/dsym.api.ts +62 -0
- package/api/proguard/proguard.api.ts +62 -0
- package/api/react-native/react-native.api.ts +62 -0
- package/api/source-maps/source-maps.api.ts +62 -0
- package/cli/commands/dsym/upload-dsym-command.ts +4 -2
- package/cli/commands/proguard/upload-proguard-command.ts +38 -0
- package/cli/commands/react-native/upload-react-native-source-maps-command.ts +4 -2
- package/cli/commands/source-maps/upload-source-maps-command.ts +4 -2
- package/cli/rum-cli.ts +14 -9
- package/config/config.ts +2 -4
- package/consts/consts.ts +0 -1
- package/dist/api/base/base.api.d.ts +17 -0
- package/dist/api/base/base.api.js +70 -0
- package/dist/api/dsym/dsym.api.d.ts +12 -0
- package/dist/api/dsym/dsym.api.js +51 -0
- package/dist/api/proguard/proguard.api.d.ts +12 -0
- package/dist/api/proguard/proguard.api.js +51 -0
- package/dist/api/react-native/react-native.api.d.ts +12 -0
- package/dist/api/react-native/react-native.api.js +51 -0
- package/dist/api/source-maps/source-maps.api.d.ts +12 -0
- package/dist/api/source-maps/source-maps.api.js +51 -0
- package/dist/cli/commands/dsym/upload-dsym-command.js +4 -3
- package/dist/cli/commands/proguard/upload-proguard-command.d.ts +2 -0
- package/dist/cli/commands/proguard/upload-proguard-command.js +46 -0
- package/dist/cli/commands/react-native/upload-react-native-source-maps-command.js +4 -3
- package/dist/cli/commands/source-maps/upload-source-maps-command.js +4 -3
- package/dist/cli/rum-cli.js +13 -13
- package/dist/config/config.d.ts +1 -2
- package/dist/config/config.js +2 -3
- package/dist/consts/consts.js +2 -3
- package/dist/{api/client/client-factory.d.ts → grpc-client/grpc-client-factory.d.ts} +121 -81
- package/dist/grpc-client/grpc-client-factory.js +31 -0
- package/dist/models/proguard-commands.model.d.ts +11 -0
- package/dist/models/proguard-commands.model.js +3 -0
- package/dist/proto-models/com/coralogix/blobset/v2/entity_metadata.d.ts +18 -0
- package/dist/proto-models/com/coralogix/blobset/v2/entity_metadata.js +139 -5
- package/dist/proto-models/com/coralogix/blobset/v2/entity_type.d.ts +2 -1
- package/dist/proto-models/com/coralogix/blobset/v2/entity_type.js +7 -1
- package/dist/proto-models/com/coralogix/rum/v2/release_entity_metadata.d.ts +18 -0
- package/dist/proto-models/com/coralogix/rum/v2/release_entity_metadata.js +139 -5
- package/dist/proto-models/com/coralogix/rum/v2/release_entity_type.d.ts +2 -1
- package/dist/proto-models/com/coralogix/rum/v2/release_entity_type.js +7 -1
- package/dist/proto-models/com/coralogix/rum/v2/rum_sdk_versions.d.ts +1 -0
- package/dist/proto-models/com/coralogix/rum/v2/rum_sdk_versions.js +17 -3
- package/dist/proto-models/com/coralogix/rum/v2/rum_service.d.ts +93 -0
- package/dist/proto-models/com/coralogix/rum/v2/rum_service.js +300 -4
- package/dist/proto-models/com/coralogix/rum/v2/rum_settings_service.d.ts +9 -8
- package/dist/proto-models/com/coralogix/rum/v2/rum_settings_service.js +22 -7
- package/dist/services/base/base.service.d.ts +9 -0
- package/dist/services/base/base.service.js +35 -0
- package/dist/services/dsym/dsym.service.d.ts +9 -0
- package/dist/services/dsym/dsym.service.js +22 -0
- package/dist/services/proguard/proguard.service.d.ts +9 -0
- package/dist/services/proguard/proguard.service.js +22 -0
- package/dist/services/react-native/react-native.service.d.ts +9 -0
- package/dist/services/react-native/react-native.service.js +22 -0
- package/dist/services/source-maps/source-maps.service.d.ts +9 -0
- package/dist/services/source-maps/source-maps.service.js +22 -0
- package/dist/utils/file-processor.utils.d.ts +5 -8
- package/dist/utils/file-processor.utils.js +47 -64
- package/grpc-client/grpc-client-factory.ts +31 -0
- package/mapping.txt +160886 -0
- package/models/proguard-commands.model.ts +11 -0
- package/package.json +1 -1
- package/proto-models/com/coralogix/blobset/v2/entity_metadata.ts +160 -4
- package/proto-models/com/coralogix/blobset/v2/entity_type.ts +6 -0
- package/proto-models/com/coralogix/rum/v2/release_entity_metadata.ts +156 -0
- package/proto-models/com/coralogix/rum/v2/release_entity_type.ts +6 -0
- package/proto-models/com/coralogix/rum/v2/rum_sdk_versions.ts +17 -1
- package/proto-models/com/coralogix/rum/v2/rum_service.ts +347 -1
- package/proto-models/com/coralogix/rum/v2/rum_settings_service.ts +23 -6
- package/protofetch.lock +4 -4
- package/protofetch.toml +3 -3
- package/protos/com/coralogix/blobset/v2/entity_metadata.proto +9 -0
- package/protos/com/coralogix/blobset/v2/entity_type.proto +1 -0
- package/protos/com/coralogix/rum/v2/release_entity_metadata.proto +9 -0
- package/protos/com/coralogix/rum/v2/release_entity_type.proto +1 -0
- package/protos/com/coralogix/rum/v2/rum_sdk_versions.proto +1 -0
- package/protos/com/coralogix/rum/v2/rum_service.proto +23 -0
- package/protos/com/coralogix/rum/v2/rum_settings_service.proto +3 -1
- package/protoset.bin +0 -0
- package/services/base/base.service.ts +38 -0
- package/services/dsym/dsym.service.ts +21 -0
- package/services/proguard/proguard.service.ts +21 -0
- package/services/react-native/react-native.service.ts +21 -0
- package/services/source-maps/source-maps.service.ts +21 -0
- package/utils/file-processor.utils.ts +48 -76
- package/api/client/client-factory.ts +0 -26
- package/api/client/request-builder.ts +0 -113
- package/api/dsym.api.ts +0 -61
- package/api/react-native.api.ts +0 -70
- package/api/source-maps.api.ts +0 -70
- package/cli/commands/dsym/index.ts +0 -5
- package/cli/commands/react-native/index.ts +0 -5
- package/cli/commands/source-maps/index.ts +0 -5
- package/dist/api/client/client-factory.js +0 -31
- package/dist/api/client/request-builder.d.ts +0 -27
- package/dist/api/client/request-builder.js +0 -58
- package/dist/api/dsym.api.d.ts +0 -4
- package/dist/api/dsym.api.js +0 -50
- package/dist/api/react-native.api.d.ts +0 -4
- package/dist/api/react-native.api.js +0 -51
- package/dist/api/source-maps.api.d.ts +0 -4
- package/dist/api/source-maps.api.js +0 -51
- package/dist/cli/commands/dsym/index.d.ts +0 -4
- package/dist/cli/commands/dsym/index.js +0 -6
- package/dist/cli/commands/react-native/index.d.ts +0 -4
- package/dist/cli/commands/react-native/index.js +0 -6
- package/dist/cli/commands/source-maps/index.d.ts +0 -4
- package/dist/cli/commands/source-maps/index.js +0 -6
- package/dist/services/dsym.service.d.ts +0 -3
- package/dist/services/dsym.service.js +0 -36
- package/dist/services/react-native.service.d.ts +0 -3
- package/dist/services/react-native.service.js +0 -37
- package/dist/services/source-maps.service.d.ts +0 -3
- package/dist/services/source-maps.service.js +0 -37
- package/services/dsym.service.ts +0 -33
- package/services/react-native.service.ts +0 -34
- package/services/source-maps.service.ts +0 -34
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
|
|
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
|
[](https://www.npmjs.com/package/@coralogix/browser)
|
|
6
8
|
|
|
7
|
-
|
|
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
|
-
|
|
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:
|
|
19
|
-
|
|
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
|
-
|
|
31
|
+
Upload source maps:
|
|
29
32
|
|
|
30
|
-
|
|
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
|
-
|
|
39
|
+
Upload React Native source maps:
|
|
35
40
|
|
|
36
|
-
|
|
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
|
-
|
|
47
|
+
Upload dSYM file:
|
|
41
48
|
|
|
42
|
-
|
|
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
|
|
49
|
-
- `-f, --folder-path <folderPath>`: Path to the folder containing the
|
|
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
|
|
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
|
-
|
|
76
|
+
Specify the appropriate environment using the `-e` option:
|
|
60
77
|
|
|
61
|
-
-
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
-
|
|
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
|
-
|
|
70
|
-
|
|
71
|
-
## React Native Source maps folder size limit
|
|
87
|
+
Ensure your files do not exceed the following size limits:
|
|
72
88
|
|
|
73
|
-
|
|
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
|
-
##
|
|
94
|
+
## Integration
|
|
76
95
|
|
|
77
|
-
|
|
96
|
+
### CI Integration:
|
|
78
97
|
|
|
79
|
-
|
|
98
|
+
To automate the upload process in your CI pipeline:
|
|
80
99
|
|
|
81
|
-
|
|
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
|
-
|
|
85
|
-
-
|
|
86
|
-
-
|
|
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
|
-
|
|
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
|
-
|
|
124
|
+
Replace `<command>` with `source-maps`, `react-native-source-maps`, `dsym`, or `proguard` based on the file type.
|
|
92
125
|
|
|
93
|
-
|
|
126
|
+
### Non-CI Integration:
|
|
94
127
|
|
|
95
|
-
|
|
128
|
+
For manual uploads, use the corresponding command in your terminal:
|
|
96
129
|
|
|
97
130
|
```bash
|
|
98
|
-
|
|
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
|
-
|
|
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
|
-
|
|
136
|
+
- `source-maps`
|
|
137
|
+
- `react-native-source-maps`
|
|
138
|
+
- `dsym`
|
|
139
|
+
- `proguard`
|
|
124
140
|
|
|
125
|
-
| IMPORTANT: The $VERSION
|
|
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
|
-
|
|
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
|
-
- `-
|
|
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
|
-
|
|
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.
|
|
@@ -0,0 +1,118 @@
|
|
|
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 { GrpcClientFactory } from '../../grpc-client/grpc-client-factory';
|
|
5
|
+
import { CreateEntityReleaseRequest, RumSourceMapServiceDefinition } from '../../proto-models/com/coralogix/rum/v2/rum_source_map_service';
|
|
6
|
+
import { EntityType } from '../../proto-models/com/coralogix/blobset/v2/entity_type';
|
|
7
|
+
import { ReleaseEntityType } from '../../proto-models/com/coralogix/rum/v2/release_entity_type';
|
|
8
|
+
import { EntityMetadata } from '../../proto-models/com/coralogix/blobset/v2/entity_metadata';
|
|
9
|
+
import { ReleaseEntityMetadata } from '../../proto-models/com/coralogix/rum/v2/release_entity_metadata';
|
|
10
|
+
|
|
11
|
+
export abstract class BaseApi {
|
|
12
|
+
protected abstract getEntityType(): EntityType;
|
|
13
|
+
protected abstract getReleaseEntityType(): ReleaseEntityType;
|
|
14
|
+
protected abstract getMaxCompressedFileSize(): number;
|
|
15
|
+
protected abstract buildReleaseEntityMetadata(
|
|
16
|
+
application: string,
|
|
17
|
+
version: string,
|
|
18
|
+
repoName?: string,
|
|
19
|
+
commitHash?: string,
|
|
20
|
+
orgName?: string,
|
|
21
|
+
): ReleaseEntityMetadata;
|
|
22
|
+
protected abstract buildEntityMetadata(
|
|
23
|
+
application: string,
|
|
24
|
+
version: string,
|
|
25
|
+
repoName?: string,
|
|
26
|
+
commitHash?: string,
|
|
27
|
+
orgName?: string,
|
|
28
|
+
): EntityMetadata;
|
|
29
|
+
|
|
30
|
+
private async uploadBlob(
|
|
31
|
+
blobSetClient: Client<typeof BlobSetServiceDefinition>,
|
|
32
|
+
request: UploadBlobRequest,
|
|
33
|
+
entityMetadata: EntityMetadata | undefined,
|
|
34
|
+
metadata: Metadata,
|
|
35
|
+
): Promise<void> {
|
|
36
|
+
request.entityMetadata = entityMetadata;
|
|
37
|
+
request.entityType = this.getEntityType();
|
|
38
|
+
|
|
39
|
+
const iterableRequest = createUploadBlobRequestChunks(request);
|
|
40
|
+
|
|
41
|
+
await blobSetClient.uploadBlob(iterableRequest, { metadata });
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
private async createEntityRelease(
|
|
45
|
+
rumSourceMapClient: Client<typeof RumSourceMapServiceDefinition>,
|
|
46
|
+
releaseEntityMetadata: ReleaseEntityMetadata | undefined,
|
|
47
|
+
metadata: Metadata,
|
|
48
|
+
): Promise<void> {
|
|
49
|
+
const request: CreateEntityReleaseRequest = {
|
|
50
|
+
releaseEntityType: this.getReleaseEntityType(),
|
|
51
|
+
releaseEntityMetadata,
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
await rumSourceMapClient.createEntityRelease(request, { metadata });
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
private createGrpcMetadata(privateKey: string): Metadata {
|
|
58
|
+
const metadata: Metadata = new Metadata();
|
|
59
|
+
metadata.set('Authorization', `Bearer ${privateKey}`);
|
|
60
|
+
return metadata;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
private async checkEntityReleaseExists(
|
|
64
|
+
rumSourceMapClient: Client<typeof RumSourceMapServiceDefinition>,
|
|
65
|
+
application: string,
|
|
66
|
+
version: string,
|
|
67
|
+
metadata: Metadata,
|
|
68
|
+
): Promise<boolean> {
|
|
69
|
+
const { exists } = await rumSourceMapClient.isEntityReleaseExists(
|
|
70
|
+
{ releaseId: version, application, releaseEntityType: this.getReleaseEntityType() },
|
|
71
|
+
{ metadata },
|
|
72
|
+
);
|
|
73
|
+
return exists;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
public async upload(
|
|
77
|
+
request: UploadBlobRequest,
|
|
78
|
+
application: string,
|
|
79
|
+
version: string,
|
|
80
|
+
repoName: string | undefined,
|
|
81
|
+
commitHash: string | undefined,
|
|
82
|
+
orgName: string | undefined,
|
|
83
|
+
env: string,
|
|
84
|
+
privateKey: string,
|
|
85
|
+
): Promise<void> {
|
|
86
|
+
const metadata: Metadata = this.createGrpcMetadata(privateKey);
|
|
87
|
+
const blobSetClient = GrpcClientFactory.getBlobSetGrpcClient(env, this.getMaxCompressedFileSize());
|
|
88
|
+
const rumSourceMapClient = GrpcClientFactory.getRumSourceMapGrpcClient(env, this.getMaxCompressedFileSize());
|
|
89
|
+
|
|
90
|
+
try {
|
|
91
|
+
validateCompressedFilesSize(request.data.length, this.getMaxCompressedFileSize());
|
|
92
|
+
|
|
93
|
+
const releaseExists: boolean = await this.checkEntityReleaseExists(rumSourceMapClient, application, version, metadata);
|
|
94
|
+
|
|
95
|
+
if (releaseExists) {
|
|
96
|
+
consoleError(`Entity release already exists for releaseId: ${version} and application: ${application}`);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const releaseEntityMetadata: ReleaseEntityMetadata = this.buildReleaseEntityMetadata(
|
|
101
|
+
application,
|
|
102
|
+
version,
|
|
103
|
+
repoName,
|
|
104
|
+
commitHash,
|
|
105
|
+
orgName,
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
const entityMetadata: EntityMetadata = this.buildEntityMetadata(application, version, repoName, commitHash, orgName);
|
|
109
|
+
|
|
110
|
+
await this.uploadBlob(blobSetClient, request, entityMetadata, metadata);
|
|
111
|
+
|
|
112
|
+
await this.createEntityRelease(rumSourceMapClient, releaseEntityMetadata, metadata);
|
|
113
|
+
} catch (error) {
|
|
114
|
+
consoleError(`Failed to upload: ${error}`);
|
|
115
|
+
throw error;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { EntityType } from '../../proto-models/com/coralogix/blobset/v2/entity_type';
|
|
2
|
+
import { ReleaseEntityType } from '../../proto-models/com/coralogix/rum/v2/release_entity_type';
|
|
3
|
+
import config from '../../config/config';
|
|
4
|
+
import { BaseApi } from '../base/base.api';
|
|
5
|
+
import { ReleaseEntityMetadata } from '../../proto-models/com/coralogix/rum/v2/release_entity_metadata';
|
|
6
|
+
import { EntityMetadata } from '../../proto-models/com/coralogix/blobset/v2/entity_metadata';
|
|
7
|
+
|
|
8
|
+
export class DsymApi extends BaseApi {
|
|
9
|
+
protected getEntityType(): EntityType {
|
|
10
|
+
return EntityType.ENTITY_TYPE_DSYM;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
protected getReleaseEntityType(): ReleaseEntityType {
|
|
14
|
+
return ReleaseEntityType.RELEASE_ENTITY_TYPE_DSYM;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
protected getMaxCompressedFileSize(): number {
|
|
18
|
+
return config.rumApi.dsymMaxCompressedFilesSize;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
protected buildReleaseEntityMetadata(
|
|
22
|
+
application: string,
|
|
23
|
+
version: string,
|
|
24
|
+
repoName?: string,
|
|
25
|
+
commitHash?: string,
|
|
26
|
+
orgName?: string,
|
|
27
|
+
): ReleaseEntityMetadata {
|
|
28
|
+
return {
|
|
29
|
+
metadata: {
|
|
30
|
+
$case: 'dsymMetadata',
|
|
31
|
+
dsymMetadata: {
|
|
32
|
+
application,
|
|
33
|
+
releaseId: version,
|
|
34
|
+
repoName: repoName || '',
|
|
35
|
+
commitHash: commitHash || '',
|
|
36
|
+
orgName: orgName || '',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
protected buildEntityMetadata(
|
|
43
|
+
application: string,
|
|
44
|
+
version: string,
|
|
45
|
+
repoName?: string,
|
|
46
|
+
commitHash?: string,
|
|
47
|
+
orgName?: string,
|
|
48
|
+
): EntityMetadata {
|
|
49
|
+
return {
|
|
50
|
+
metadata: {
|
|
51
|
+
$case: 'dsymMetadata',
|
|
52
|
+
dsymMetadata: {
|
|
53
|
+
application,
|
|
54
|
+
releaseId: version,
|
|
55
|
+
repoName: repoName || '',
|
|
56
|
+
commitHash: commitHash || '',
|
|
57
|
+
orgName: orgName || '',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { EntityType } from '../../proto-models/com/coralogix/blobset/v2/entity_type';
|
|
2
|
+
import { ReleaseEntityType } from '../../proto-models/com/coralogix/rum/v2/release_entity_type';
|
|
3
|
+
import config from '../../config/config';
|
|
4
|
+
import { BaseApi } from '../base/base.api';
|
|
5
|
+
import { ReleaseEntityMetadata } from '../../proto-models/com/coralogix/rum/v2/release_entity_metadata';
|
|
6
|
+
import { EntityMetadata } from '../../proto-models/com/coralogix/blobset/v2/entity_metadata';
|
|
7
|
+
|
|
8
|
+
export class ProguardApi extends BaseApi {
|
|
9
|
+
protected getEntityType(): EntityType {
|
|
10
|
+
return EntityType.ENTITY_TYPE_PROGUARD;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
protected getReleaseEntityType(): ReleaseEntityType {
|
|
14
|
+
return ReleaseEntityType.RELEASE_ENTITY_TYPE_PROGUARD;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
protected getMaxCompressedFileSize(): number {
|
|
18
|
+
return config.rumApi.proguardMaxCompressedFilesSize;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
protected buildReleaseEntityMetadata(
|
|
22
|
+
application: string,
|
|
23
|
+
version: string,
|
|
24
|
+
repoName?: string,
|
|
25
|
+
commitHash?: string,
|
|
26
|
+
orgName?: string,
|
|
27
|
+
): ReleaseEntityMetadata {
|
|
28
|
+
return {
|
|
29
|
+
metadata: {
|
|
30
|
+
$case: 'proguardMetadata',
|
|
31
|
+
proguardMetadata: {
|
|
32
|
+
application,
|
|
33
|
+
releaseId: version,
|
|
34
|
+
repoName: repoName || '',
|
|
35
|
+
commitHash: commitHash || '',
|
|
36
|
+
orgName: orgName || '',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
protected buildEntityMetadata(
|
|
43
|
+
application: string,
|
|
44
|
+
version: string,
|
|
45
|
+
repoName?: string,
|
|
46
|
+
commitHash?: string,
|
|
47
|
+
orgName?: string,
|
|
48
|
+
): EntityMetadata {
|
|
49
|
+
return {
|
|
50
|
+
metadata: {
|
|
51
|
+
$case: 'proguardMetadata',
|
|
52
|
+
proguardMetadata: {
|
|
53
|
+
application,
|
|
54
|
+
releaseId: version,
|
|
55
|
+
repoName: repoName || '',
|
|
56
|
+
commitHash: commitHash || '',
|
|
57
|
+
orgName: orgName || '',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { EntityType } from '../../proto-models/com/coralogix/blobset/v2/entity_type';
|
|
2
|
+
import { ReleaseEntityType } from '../../proto-models/com/coralogix/rum/v2/release_entity_type';
|
|
3
|
+
import config from '../../config/config';
|
|
4
|
+
import { BaseApi } from '../base/base.api';
|
|
5
|
+
import { ReleaseEntityMetadata } from '../../proto-models/com/coralogix/rum/v2/release_entity_metadata';
|
|
6
|
+
import { EntityMetadata } from '../../proto-models/com/coralogix/blobset/v2/entity_metadata';
|
|
7
|
+
|
|
8
|
+
export class ReactNativeApi extends BaseApi {
|
|
9
|
+
protected getEntityType(): EntityType {
|
|
10
|
+
return EntityType.ENTITY_TYPE_SOURCE_MAP;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
protected getReleaseEntityType(): ReleaseEntityType {
|
|
14
|
+
return ReleaseEntityType.RELEASE_ENTITY_TYPE_REACT_NATIVE;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
protected getMaxCompressedFileSize(): number {
|
|
18
|
+
return config.rumApi.reactNativeMaxCompressedFilesSize;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
protected buildReleaseEntityMetadata(
|
|
22
|
+
application: string,
|
|
23
|
+
version: string,
|
|
24
|
+
repoName?: string,
|
|
25
|
+
commitHash?: string,
|
|
26
|
+
orgName?: string,
|
|
27
|
+
): ReleaseEntityMetadata {
|
|
28
|
+
return {
|
|
29
|
+
metadata: {
|
|
30
|
+
$case: 'sourceMapMetadata',
|
|
31
|
+
sourceMapMetadata: {
|
|
32
|
+
application,
|
|
33
|
+
releaseId: version,
|
|
34
|
+
repoName: repoName || '',
|
|
35
|
+
commitHash: commitHash || '',
|
|
36
|
+
orgName: orgName || '',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
protected buildEntityMetadata(
|
|
43
|
+
application: string,
|
|
44
|
+
version: string,
|
|
45
|
+
repoName?: string,
|
|
46
|
+
commitHash?: string,
|
|
47
|
+
orgName?: string,
|
|
48
|
+
): EntityMetadata {
|
|
49
|
+
return {
|
|
50
|
+
metadata: {
|
|
51
|
+
$case: 'sourceMapMetadata',
|
|
52
|
+
sourceMapMetadata: {
|
|
53
|
+
application,
|
|
54
|
+
releaseId: version,
|
|
55
|
+
repoName: repoName || '',
|
|
56
|
+
commitHash: commitHash || '',
|
|
57
|
+
orgName: orgName || '',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { EntityType } from '../../proto-models/com/coralogix/blobset/v2/entity_type';
|
|
2
|
+
import { ReleaseEntityType } from '../../proto-models/com/coralogix/rum/v2/release_entity_type';
|
|
3
|
+
import config from '../../config/config';
|
|
4
|
+
import { BaseApi } from '../base/base.api';
|
|
5
|
+
import { ReleaseEntityMetadata } from '../../proto-models/com/coralogix/rum/v2/release_entity_metadata';
|
|
6
|
+
import { EntityMetadata } from '../../proto-models/com/coralogix/blobset/v2/entity_metadata';
|
|
7
|
+
|
|
8
|
+
export class SourceMapsApi extends BaseApi {
|
|
9
|
+
protected getEntityType(): EntityType {
|
|
10
|
+
return EntityType.ENTITY_TYPE_SOURCE_MAP;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
protected getReleaseEntityType(): ReleaseEntityType {
|
|
14
|
+
return ReleaseEntityType.RELEASE_ENTITY_TYPE_SOURCE_MAP;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
protected getMaxCompressedFileSize(): number {
|
|
18
|
+
return config.rumApi.sourceMapsMaxCompressedFilesSize;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
protected buildReleaseEntityMetadata(
|
|
22
|
+
application: string,
|
|
23
|
+
version: string,
|
|
24
|
+
repoName?: string,
|
|
25
|
+
commitHash?: string,
|
|
26
|
+
orgName?: string,
|
|
27
|
+
): ReleaseEntityMetadata {
|
|
28
|
+
return {
|
|
29
|
+
metadata: {
|
|
30
|
+
$case: 'sourceMapMetadata',
|
|
31
|
+
sourceMapMetadata: {
|
|
32
|
+
application,
|
|
33
|
+
releaseId: version,
|
|
34
|
+
repoName: repoName || '',
|
|
35
|
+
commitHash: commitHash || '',
|
|
36
|
+
orgName: orgName || '',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
protected buildEntityMetadata(
|
|
43
|
+
application: string,
|
|
44
|
+
version: string,
|
|
45
|
+
repoName?: string,
|
|
46
|
+
commitHash?: string,
|
|
47
|
+
orgName?: string,
|
|
48
|
+
): EntityMetadata {
|
|
49
|
+
return {
|
|
50
|
+
metadata: {
|
|
51
|
+
$case: 'sourceMapMetadata',
|
|
52
|
+
sourceMapMetadata: {
|
|
53
|
+
application,
|
|
54
|
+
releaseId: version,
|
|
55
|
+
repoName: repoName || '',
|
|
56
|
+
commitHash: commitHash || '',
|
|
57
|
+
orgName: orgName || '',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import { validateEnvironment } from '../../validators';
|
|
3
3
|
import { checkMissingArguments, consoleError } from '../../../utils/shared.utils';
|
|
4
|
-
import { DsymService } from '../../../services/dsym.service';
|
|
4
|
+
import { DsymService } from '../../../services/dsym/dsym.service';
|
|
5
5
|
import { UploadDsymCommandOptions } from '../../../models/dsym-commands.model';
|
|
6
6
|
|
|
7
7
|
export const uploadDsymCommand = () => {
|
|
@@ -26,7 +26,9 @@ export const uploadDsymCommand = () => {
|
|
|
26
26
|
|
|
27
27
|
checkMissingArguments<UploadDsymCommandOptions>(options, ['privateKey', 'application', 'version', 'folderPath', 'env']);
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
const service: DsymService = new DsymService();
|
|
30
|
+
|
|
31
|
+
await service.upload(application, version, repoName, commitHash, orgName, folderPath, env, privateKey);
|
|
30
32
|
} catch (error) {
|
|
31
33
|
consoleError(error);
|
|
32
34
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
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/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
|
+
const service: ProguardService = new ProguardService();
|
|
30
|
+
|
|
31
|
+
await service.upload(application, version, repoName, commitHash, orgName, folderPath, env, privateKey);
|
|
32
|
+
} catch (error) {
|
|
33
|
+
consoleError(error);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
return uploadCommand;
|
|
38
|
+
};
|