@coralogix/rum-cli 1.1.22 → 1.1.24
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 +26 -7
- package/api/client/client-factory.ts +26 -0
- package/api/client/request-builder.ts +122 -0
- package/api/dsym.api.ts +61 -0
- package/api/react-native.api.ts +67 -0
- package/api/{rum-api.ts → source-maps.api.ts} +14 -22
- package/cli/commands/dsym/index.ts +5 -0
- package/cli/commands/dsym/upload-dsym-command.ts +36 -0
- package/cli/commands/react-native/index.ts +5 -0
- package/cli/commands/{upload-react-native-source-maps-command.ts → react-native/upload-react-native-source-maps-command.ts} +14 -11
- package/cli/commands/{delete-source-maps-command.ts → source-maps/delete-source-maps-command.ts} +7 -9
- package/cli/commands/source-maps/index.ts +7 -0
- package/cli/commands/{update-source-maps-command.ts → source-maps/update-source-maps-command.ts} +7 -9
- package/cli/commands/{upload-source-maps-command.ts → source-maps/upload-source-maps-command.ts} +7 -9
- package/cli/rum-cli.ts +15 -6
- package/config/config.ts +10 -4
- package/consts/consts.ts +2 -0
- package/dist/api/client/client-factory.d.ts +355 -0
- package/dist/api/client/client-factory.js +31 -0
- package/dist/api/client/request-builder.d.ts +33 -0
- package/dist/api/client/request-builder.js +58 -0
- package/dist/api/dsym.api.d.ts +4 -0
- package/dist/api/dsym.api.js +50 -0
- package/dist/api/react-native.api.d.ts +4 -0
- package/dist/api/react-native.api.js +50 -0
- package/dist/api/{rum-api.d.ts → source-maps.api.d.ts} +2 -2
- package/dist/api/source-maps.api.js +97 -0
- package/dist/cli/commands/dsym/index.d.ts +4 -0
- package/dist/cli/commands/dsym/index.js +6 -0
- package/dist/cli/commands/dsym/upload-dsym-command.d.ts +2 -0
- package/dist/cli/commands/dsym/upload-dsym-command.js +45 -0
- package/dist/cli/commands/react-native/index.d.ts +4 -0
- package/dist/cli/commands/react-native/index.js +6 -0
- package/dist/cli/commands/react-native/upload-react-native-source-maps-command.js +51 -0
- package/dist/cli/commands/source-maps/delete-source-maps-command.js +41 -0
- package/dist/cli/commands/{index.d.ts → source-maps/index.d.ts} +2 -3
- package/dist/cli/commands/source-maps/index.js +8 -0
- package/dist/cli/commands/source-maps/update-source-maps-command.js +46 -0
- package/dist/cli/commands/source-maps/upload-source-maps-command.js +45 -0
- package/dist/cli/rum-cli.js +11 -7
- package/dist/config/config.d.ts +5 -2
- package/dist/config/config.js +6 -3
- package/dist/consts/consts.d.ts +1 -0
- package/dist/consts/consts.js +3 -2
- package/dist/models/dsym-commands.model.d.ts +11 -0
- package/dist/models/dsym-commands.model.js +3 -0
- package/dist/models/react-native-commands.model.d.ts +11 -0
- package/dist/models/react-native-commands.model.js +3 -0
- package/dist/models/{commands.model.d.ts → source-maps-commands.model.d.ts} +3 -3
- package/dist/models/source-maps-commands.model.js +3 -0
- package/dist/proto-models/com/coralogix/blobset/v2/audit_log.d.ts +24 -0
- package/dist/proto-models/com/coralogix/blobset/v2/audit_log.js +64 -0
- package/dist/proto-models/com/coralogix/blobset/v2/blobset_query_service.d.ts +111 -0
- package/dist/proto-models/com/coralogix/blobset/v2/blobset_query_service.js +31 -0
- package/dist/proto-models/com/coralogix/blobset/v2/blobset_service.d.ts +67 -0
- package/dist/proto-models/com/coralogix/blobset/v2/blobset_service.js +174 -0
- package/dist/proto-models/com/coralogix/blobset/v2/dsym.d.ts +58 -0
- package/dist/proto-models/com/coralogix/blobset/v2/dsym.js +331 -0
- package/dist/proto-models/com/coralogix/blobset/v2/entity_metadata.d.ts +78 -0
- package/dist/proto-models/com/coralogix/blobset/v2/entity_metadata.js +459 -0
- package/dist/proto-models/com/coralogix/blobset/v2/entity_type.d.ts +9 -0
- package/dist/proto-models/com/coralogix/blobset/v2/entity_type.js +47 -0
- package/dist/proto-models/com/coralogix/blobset/v2/react_native.d.ts +54 -0
- package/dist/proto-models/com/coralogix/blobset/v2/react_native.js +313 -0
- package/dist/proto-models/com/coralogix/blobset/v2/s3_metadata.d.ts +30 -0
- package/dist/proto-models/com/coralogix/blobset/v2/s3_metadata.js +126 -0
- package/dist/proto-models/com/coralogix/rum/v2/hide_errors.d.ts +44 -0
- package/dist/proto-models/com/coralogix/rum/v2/hide_errors.js +195 -0
- package/dist/proto-models/com/coralogix/rum/v2/release_entity_metadata.d.ts +78 -0
- package/dist/proto-models/com/coralogix/rum/v2/release_entity_metadata.js +459 -0
- package/dist/proto-models/com/coralogix/rum/v2/release_entity_type.d.ts +9 -0
- package/dist/proto-models/com/coralogix/rum/v2/release_entity_type.js +47 -0
- package/dist/proto-models/com/coralogix/rum/v2/rum_hide_errors_service.d.ts +198 -0
- package/dist/proto-models/com/coralogix/rum/v2/rum_hide_errors_service.js +517 -0
- package/dist/proto-models/com/coralogix/rum/v2/rum_saved_filters_service.d.ts +1 -47
- package/dist/proto-models/com/coralogix/rum/v2/rum_saved_filters_service.js +11 -151
- package/dist/proto-models/com/coralogix/rum/v2/rum_sdk_versions.d.ts +41 -0
- package/dist/proto-models/com/coralogix/rum/v2/rum_sdk_versions.js +217 -0
- package/dist/proto-models/com/coralogix/rum/v2/rum_service.d.ts +45 -0
- package/dist/proto-models/com/coralogix/rum/v2/rum_service.js +122 -2
- package/dist/proto-models/com/coralogix/rum/v2/rum_settings.d.ts +45 -0
- package/dist/proto-models/com/coralogix/rum/v2/rum_settings.js +193 -0
- package/dist/proto-models/com/coralogix/rum/v2/rum_settings_service.d.ts +107 -0
- package/dist/proto-models/com/coralogix/rum/v2/rum_settings_service.js +214 -0
- package/dist/proto-models/com/coralogix/rum/v2/rum_source_map_service.d.ts +92 -0
- package/dist/proto-models/com/coralogix/rum/v2/rum_source_map_service.js +261 -2
- package/dist/services/{react-native-source-maps.service.d.ts → dsym.service.d.ts} +1 -1
- package/dist/services/dsym.service.js +36 -0
- package/dist/services/react-native.service.d.ts +3 -0
- package/dist/services/react-native.service.js +37 -0
- package/dist/services/source-maps.service.js +12 -14
- package/dist/utils/file-processor.utils.d.ts +12 -0
- package/dist/utils/file-processor.utils.js +196 -0
- package/dist/utils/shared.utils.d.ts +9 -0
- package/dist/utils/shared.utils.js +62 -0
- package/models/dsym-commands.model.ts +11 -0
- package/models/react-native-commands.model.ts +11 -0
- package/models/{commands.model.ts → source-maps-commands.model.ts} +3 -3
- package/package.json +4 -3
- package/proto-models/com/coralogix/blobset/v2/audit_log.ts +78 -0
- package/proto-models/com/coralogix/blobset/v2/blobset_query_service.ts +30 -0
- package/proto-models/com/coralogix/blobset/v2/blobset_service.ts +203 -0
- package/proto-models/com/coralogix/blobset/v2/dsym.ts +394 -0
- package/proto-models/com/coralogix/blobset/v2/entity_metadata.ts +537 -0
- package/proto-models/com/coralogix/blobset/v2/entity_type.ts +44 -0
- package/proto-models/com/coralogix/blobset/v2/react_native.ts +361 -0
- package/proto-models/com/coralogix/blobset/v2/s3_metadata.ts +148 -0
- package/proto-models/com/coralogix/rum/v2/hide_errors.ts +225 -0
- package/proto-models/com/coralogix/rum/v2/release_entity_metadata.ts +537 -0
- package/proto-models/com/coralogix/rum/v2/release_entity_type.ts +44 -0
- package/proto-models/com/coralogix/rum/v2/rum_hide_errors_service.ts +599 -0
- package/proto-models/com/coralogix/rum/v2/rum_saved_filters_service.ts +10 -174
- package/proto-models/com/coralogix/rum/v2/rum_sdk_versions.ts +254 -0
- package/proto-models/com/coralogix/rum/v2/rum_service.ts +139 -0
- package/proto-models/com/coralogix/rum/v2/rum_settings.ts +209 -0
- package/proto-models/com/coralogix/rum/v2/rum_settings_service.ts +260 -0
- package/proto-models/com/coralogix/rum/v2/rum_source_map_service.ts +304 -0
- package/protofetch.lock +21 -2
- package/protofetch.toml +6 -1
- package/protos/com/coralogix/blobset/v2/audit_log.proto +13 -0
- package/protos/com/coralogix/blobset/v2/blobset_query_service.proto +12 -0
- package/protos/com/coralogix/blobset/v2/blobset_service.proto +18 -0
- package/protos/com/coralogix/blobset/v2/dsym.proto +19 -0
- package/protos/com/coralogix/blobset/v2/entity_metadata.proto +36 -0
- package/protos/com/coralogix/blobset/v2/entity_type.proto +10 -0
- package/protos/com/coralogix/blobset/v2/react_native.proto +23 -0
- package/protos/com/coralogix/blobset/v2/s3_metadata.proto +14 -0
- package/protos/com/coralogix/rum/v2/hide_errors.proto +19 -0
- package/protos/com/coralogix/rum/v2/release_entity_metadata.proto +35 -0
- package/protos/com/coralogix/rum/v2/release_entity_type.proto +10 -0
- package/protos/com/coralogix/rum/v2/rum_hide_errors_service.proto +42 -0
- package/protos/com/coralogix/rum/v2/rum_saved_filters_service.proto +1 -12
- package/protos/com/coralogix/rum/v2/rum_sdk_versions.proto +16 -0
- package/protos/com/coralogix/rum/v2/rum_service.proto +10 -0
- package/protos/com/coralogix/rum/v2/rum_settings.proto +26 -0
- package/protos/com/coralogix/rum/v2/rum_settings_service.proto +21 -0
- package/protos/com/coralogix/rum/v2/rum_source_map_service.proto +19 -0
- package/protoset.bin +0 -0
- package/services/dsym.service.ts +33 -0
- package/services/react-native.service.ts +34 -0
- package/services/source-maps.service.ts +12 -14
- package/utils/file-processor.utils.ts +176 -0
- package/utils/shared.utils.ts +52 -0
- package/cli/commands/index.ts +0 -8
- package/dist/api/rum-api.js +0 -104
- package/dist/cli/commands/delete-source-maps-command.js +0 -43
- package/dist/cli/commands/index.js +0 -9
- package/dist/cli/commands/update-source-maps-command.js +0 -48
- package/dist/cli/commands/upload-react-native-source-maps-command.js +0 -47
- package/dist/cli/commands/upload-source-maps-command.js +0 -47
- package/dist/models/commands.model.js +0 -3
- package/dist/services/react-native-source-maps.service.js +0 -42
- package/dist/utils/index.d.ts +0 -6
- package/dist/utils/index.js +0 -115
- package/services/react-native-source-maps.service.ts +0 -40
- package/utils/index.ts +0 -93
- /package/dist/cli/commands/{upload-react-native-source-maps-command.d.ts → react-native/upload-react-native-source-maps-command.d.ts} +0 -0
- /package/dist/cli/commands/{delete-source-maps-command.d.ts → source-maps/delete-source-maps-command.d.ts} +0 -0
- /package/dist/cli/commands/{update-source-maps-command.d.ts → source-maps/update-source-maps-command.d.ts} +0 -0
- /package/dist/cli/commands/{upload-source-maps-command.d.ts → source-maps/upload-source-maps-command.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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
|
|
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.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@coralogix/browser)
|
|
6
6
|
|
|
@@ -31,23 +31,28 @@ Here are some examples of how to use the Coralogix RUM CLI:
|
|
|
31
31
|
|
|
32
32
|
2. Delete source maps:
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
- `coralogix-rum-cli delete-source-maps -k <privateKey> -a <application> -v <version> -e <env>`
|
|
35
35
|
|
|
36
36
|
3. Update existing source maps:
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
- `coralogix-rum-cli update-source-maps -k <privateKey> -a <application> -v <version> -f <folderPath> -e <env> -c <commitHash> -n <repoName> -o <orgName>`
|
|
39
39
|
|
|
40
40
|
4. Update existing source maps or create a new one if not found:
|
|
41
41
|
|
|
42
42
|
- `coralogix-rum-cli update-source-maps -k <privateKey> -a <application> -v <version> -f <folderPath> -e <env> -c <commitHash> -n <repoName> -o <orgName> -g`
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
|
|
45
44
|
### React Native:
|
|
46
45
|
|
|
47
46
|
1. Upload React Native source maps:
|
|
48
47
|
|
|
49
48
|
- `coralogix-rum-cli upload-react-native-source-maps -k <privateKey> -a <application> -v <version> -f <folderPath> -e <env> -c <commitHash> -n <repoName> -o <orgName>`
|
|
50
|
-
|
|
49
|
+
|
|
50
|
+
### iOS:
|
|
51
|
+
|
|
52
|
+
1. Upload dSYM files:
|
|
53
|
+
|
|
54
|
+
- `coralogix-rum-cli upload-dsym -k <privateKey> -a <application> -v <version> -f <folderPath> -e <env> -c <commitHash> -n <repoName> -o <orgName>`
|
|
55
|
+
|
|
51
56
|
## Options
|
|
52
57
|
|
|
53
58
|
- `-k, --private-key <privateKey>`: Private key to authenticate with the Coralogix API.
|
|
@@ -75,9 +80,23 @@ The Coralogix RUM CLI supports the following environments:
|
|
|
75
80
|
|
|
76
81
|
Please use the appropriate environment value when specifying the `-e, --env` option.
|
|
77
82
|
|
|
83
|
+
## React Native Source maps folder size limit
|
|
84
|
+
|
|
85
|
+
The source map folder size limit is 200MB in this project. Please ensure that it does not exceed this limit.
|
|
86
|
+
|
|
78
87
|
## Source maps folder size limit
|
|
79
88
|
|
|
80
|
-
The source map folder size limit is
|
|
89
|
+
The source map folder size limit is 200MB in this project. Please ensure that it does not exceed this limit.
|
|
90
|
+
|
|
91
|
+
## Dsym folder size limit
|
|
92
|
+
|
|
93
|
+
The dsym folder size limit is 500MB in this project. Please ensure that it does not exceed this limit.
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
## Folder Size Limits
|
|
97
|
+
- **Source Maps (including React Native)**: The source map folder size limit is 200MB. Please ensure that it does not exceed this limit.
|
|
98
|
+
- **dSYM**: The dSYM folder size limit is 400MB. Please ensure that it does not exceed this limit.
|
|
99
|
+
|
|
81
100
|
|
|
82
101
|
## Integration
|
|
83
102
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createChannel, createClient } from 'nice-grpc';
|
|
2
|
+
import config from '../../config/config';
|
|
3
|
+
import { envToDomain } from '../../consts/consts';
|
|
4
|
+
import { BlobSetServiceDefinition } from '../../proto-models/com/coralogix/blobset/v2/blobset_service';
|
|
5
|
+
import { RumSourceMapServiceDefinition } from '../../proto-models/com/coralogix/rum/v2/rum_source_map_service';
|
|
6
|
+
|
|
7
|
+
export class ClientFactory {
|
|
8
|
+
private static getGrpcClient<T extends BlobSetServiceDefinition | RumSourceMapServiceDefinition>(serviceDefinition: T, env: string) {
|
|
9
|
+
const { dsymMaxMessageSize, keepaliveTimeMs, keepaliveTimeoutMs } = config.rumApi;
|
|
10
|
+
const channel = createChannel(envToDomain[env], undefined, {
|
|
11
|
+
'grpc.max_receive_message_length': dsymMaxMessageSize,
|
|
12
|
+
'grpc.max_send_message_length': dsymMaxMessageSize,
|
|
13
|
+
'grpc.keepalive_time_ms': keepaliveTimeMs,
|
|
14
|
+
'grpc.keepalive_timeout_ms': keepaliveTimeoutMs,
|
|
15
|
+
});
|
|
16
|
+
return createClient(serviceDefinition, channel);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
static getBlobSetGrpcClient(env: string) {
|
|
20
|
+
return this.getGrpcClient(BlobSetServiceDefinition, env);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
static getRumSourceMapGrpcClient(env: string) {
|
|
24
|
+
return this.getGrpcClient(RumSourceMapServiceDefinition, env);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { EntityType } from '../../proto-models/com/coralogix/blobset/v2/entity_type';
|
|
2
|
+
import {
|
|
3
|
+
EntityMetadata,
|
|
4
|
+
DsymMetadata,
|
|
5
|
+
ReactNativeMetadata,
|
|
6
|
+
SourceMapMetadata,
|
|
7
|
+
} from '../../proto-models/com/coralogix/blobset/v2/entity_metadata';
|
|
8
|
+
import { CreateEntityReleaseRequest } from '../../proto-models/com/coralogix/rum/v2/rum_source_map_service';
|
|
9
|
+
import { ReleaseEntityMetadata } from '../../proto-models/com/coralogix/rum/v2/release_entity_metadata';
|
|
10
|
+
import { ReleaseEntityType } from '../../proto-models/com/coralogix/rum/v2/release_entity_type';
|
|
11
|
+
import { UploadBlobRequest } from '../../proto-models/com/coralogix/blobset/v2/blobset_service';
|
|
12
|
+
|
|
13
|
+
export class RequestBuilder {
|
|
14
|
+
private static createReactNativeMetadata(
|
|
15
|
+
application: string,
|
|
16
|
+
version: string,
|
|
17
|
+
repoName: string | undefined,
|
|
18
|
+
commitHash: string | undefined,
|
|
19
|
+
orgName: string | undefined,
|
|
20
|
+
): { $case: 'reactNativeMetadata'; reactNativeMetadata: ReactNativeMetadata } {
|
|
21
|
+
return {
|
|
22
|
+
$case: 'reactNativeMetadata',
|
|
23
|
+
reactNativeMetadata: {
|
|
24
|
+
application,
|
|
25
|
+
releaseId: version,
|
|
26
|
+
repoName: repoName || '',
|
|
27
|
+
commitHash: commitHash || '',
|
|
28
|
+
orgName: orgName || '',
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
private static createDsymMetadata(
|
|
34
|
+
application: string,
|
|
35
|
+
version: string,
|
|
36
|
+
repoName: string | undefined,
|
|
37
|
+
commitHash: string | undefined,
|
|
38
|
+
orgName: string | undefined,
|
|
39
|
+
): { $case: 'dsymMetadata'; dsymMetadata: DsymMetadata } {
|
|
40
|
+
return {
|
|
41
|
+
$case: 'dsymMetadata',
|
|
42
|
+
dsymMetadata: {
|
|
43
|
+
application,
|
|
44
|
+
releaseId: version,
|
|
45
|
+
repoName: repoName || '',
|
|
46
|
+
commitHash: commitHash || '',
|
|
47
|
+
orgName: orgName || '',
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
static buildUploadBlobRequest(
|
|
53
|
+
uploadBlobRequest: UploadBlobRequest,
|
|
54
|
+
entityType: EntityType,
|
|
55
|
+
metadata:
|
|
56
|
+
| { $case: 'reactNativeMetadata'; reactNativeMetadata: ReactNativeMetadata }
|
|
57
|
+
| { $case: 'dsymMetadata'; dsymMetadata: DsymMetadata }
|
|
58
|
+
| { $case: 'sourceMapMetadata'; sourceMapMetadata: SourceMapMetadata },
|
|
59
|
+
): UploadBlobRequest {
|
|
60
|
+
const entityMetadata: EntityMetadata = { metadata };
|
|
61
|
+
|
|
62
|
+
return { ...uploadBlobRequest, entityType, entityMetadata };
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
static buildCreateEntityReleaseRequest(
|
|
66
|
+
releaseEntityType: ReleaseEntityType,
|
|
67
|
+
metadata:
|
|
68
|
+
| { $case: 'reactNativeMetadata'; reactNativeMetadata: ReactNativeMetadata }
|
|
69
|
+
| { $case: 'dsymMetadata'; dsymMetadata: DsymMetadata }
|
|
70
|
+
| { $case: 'sourceMapMetadata'; sourceMapMetadata: SourceMapMetadata },
|
|
71
|
+
): CreateEntityReleaseRequest {
|
|
72
|
+
const releaseEntityMetadata: ReleaseEntityMetadata = { metadata };
|
|
73
|
+
|
|
74
|
+
return CreateEntityReleaseRequest.create({ releaseEntityType, releaseEntityMetadata });
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
static createReactNativeUploadBlobRequest(
|
|
78
|
+
uploadBlobRequest: UploadBlobRequest,
|
|
79
|
+
application: string,
|
|
80
|
+
version: string,
|
|
81
|
+
repoName: string | undefined,
|
|
82
|
+
commitHash: string | undefined,
|
|
83
|
+
orgName: string | undefined,
|
|
84
|
+
): UploadBlobRequest {
|
|
85
|
+
const metadata = this.createReactNativeMetadata(application, version, repoName, commitHash, orgName);
|
|
86
|
+
return this.buildUploadBlobRequest(uploadBlobRequest, EntityType.ENTITY_TYPE_REACT_NATIVE, metadata);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
static createDsymUploadBlobRequest(
|
|
90
|
+
uploadBlobRequest: UploadBlobRequest,
|
|
91
|
+
application: string,
|
|
92
|
+
version: string,
|
|
93
|
+
repoName: string | undefined,
|
|
94
|
+
commitHash: string | undefined,
|
|
95
|
+
orgName: string | undefined,
|
|
96
|
+
): UploadBlobRequest {
|
|
97
|
+
const metadata = this.createDsymMetadata(application, version, repoName, commitHash, orgName);
|
|
98
|
+
return this.buildUploadBlobRequest(uploadBlobRequest, EntityType.ENTITY_TYPE_DSYM, metadata);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
static createReactNativeReleaseRequest(
|
|
102
|
+
application: string,
|
|
103
|
+
version: string,
|
|
104
|
+
repoName: string | undefined,
|
|
105
|
+
commitHash: string | undefined,
|
|
106
|
+
orgName: string | undefined,
|
|
107
|
+
): CreateEntityReleaseRequest {
|
|
108
|
+
const metadata = this.createReactNativeMetadata(application, version, repoName, commitHash, orgName);
|
|
109
|
+
return this.buildCreateEntityReleaseRequest(ReleaseEntityType.RELEASE_ENTITY_TYPE_REACT_NATIVE, metadata);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
static createDsymReleaseRequest(
|
|
113
|
+
application: string,
|
|
114
|
+
version: string,
|
|
115
|
+
repoName: string | undefined,
|
|
116
|
+
commitHash: string | undefined,
|
|
117
|
+
orgName: string | undefined,
|
|
118
|
+
): CreateEntityReleaseRequest {
|
|
119
|
+
const metadata = this.createDsymMetadata(application, version, repoName, commitHash, orgName);
|
|
120
|
+
return this.buildCreateEntityReleaseRequest(ReleaseEntityType.RELEASE_ENTITY_TYPE_DSYM, metadata);
|
|
121
|
+
}
|
|
122
|
+
}
|
package/api/dsym.api.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Client, Metadata } from 'nice-grpc';
|
|
2
|
+
import config from '../config/config';
|
|
3
|
+
import { BlobSetServiceDefinition, UploadBlobRequest } from '../proto-models/com/coralogix/blobset/v2/blobset_service';
|
|
4
|
+
import { consoleError, createUploadBlobRequestChunks, validateCompressedFilesSize } from '../utils/shared.utils';
|
|
5
|
+
import { ReleaseEntityType } from '../proto-models/com/coralogix/rum/v2/release_entity_type';
|
|
6
|
+
import { ClientFactory } from './client/client-factory';
|
|
7
|
+
import { RumSourceMapServiceDefinition } from '../proto-models/com/coralogix/rum/v2/rum_source_map_service';
|
|
8
|
+
import { RequestBuilder } from './client/request-builder';
|
|
9
|
+
|
|
10
|
+
export class DsymApi {
|
|
11
|
+
static async uploadDsym(
|
|
12
|
+
uploadBlobRequest: UploadBlobRequest,
|
|
13
|
+
application: string,
|
|
14
|
+
version: string,
|
|
15
|
+
repoName: string | undefined,
|
|
16
|
+
commitHash: string | undefined,
|
|
17
|
+
orgName: string | undefined,
|
|
18
|
+
env: string,
|
|
19
|
+
privateKey: string,
|
|
20
|
+
) {
|
|
21
|
+
try {
|
|
22
|
+
const blobSetClient: Client<typeof BlobSetServiceDefinition> = ClientFactory.getBlobSetGrpcClient(env);
|
|
23
|
+
const rumSourceMapClient: Client<typeof RumSourceMapServiceDefinition> = ClientFactory.getRumSourceMapGrpcClient(env);
|
|
24
|
+
|
|
25
|
+
const metadata = new Metadata();
|
|
26
|
+
metadata.set('Authorization', `Bearer ${privateKey}`);
|
|
27
|
+
|
|
28
|
+
validateCompressedFilesSize(uploadBlobRequest.data.length, config.rumApi.reactNativeMaxCompressedFilesSize);
|
|
29
|
+
|
|
30
|
+
const { exists } = await rumSourceMapClient.isEntityReleaseExists(
|
|
31
|
+
{ releaseId: version, application, releaseEntityType: ReleaseEntityType.RELEASE_ENTITY_TYPE_DSYM },
|
|
32
|
+
{ metadata },
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
if (exists) {
|
|
36
|
+
consoleError(`Entity release already exists for releaseId: ${version} and application: ${application}`);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const updatedUploadBlobRequest = RequestBuilder.createDsymUploadBlobRequest(
|
|
41
|
+
uploadBlobRequest,
|
|
42
|
+
application,
|
|
43
|
+
version,
|
|
44
|
+
repoName,
|
|
45
|
+
commitHash,
|
|
46
|
+
orgName,
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
const iterableRequest = createUploadBlobRequestChunks(updatedUploadBlobRequest);
|
|
50
|
+
|
|
51
|
+
await blobSetClient.uploadBlob(iterableRequest, { metadata });
|
|
52
|
+
|
|
53
|
+
const uploadEntityReleaseRequest = RequestBuilder.createDsymReleaseRequest(application, version, repoName, commitHash, orgName);
|
|
54
|
+
|
|
55
|
+
await rumSourceMapClient.createEntityRelease(uploadEntityReleaseRequest, { metadata });
|
|
56
|
+
} catch (error) {
|
|
57
|
+
consoleError(`Failed to upload dSYMs: ${error}`);
|
|
58
|
+
throw error;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Client, Metadata } from 'nice-grpc';
|
|
2
|
+
import config from '../config/config';
|
|
3
|
+
import { BlobSetServiceDefinition, UploadBlobRequest } from '../proto-models/com/coralogix/blobset/v2/blobset_service';
|
|
4
|
+
import { consoleError, createUploadBlobRequestChunks, validateCompressedFilesSize } from '../utils/shared.utils';
|
|
5
|
+
import { ReleaseEntityType } from '../proto-models/com/coralogix/rum/v2/release_entity_type';
|
|
6
|
+
import { ClientFactory } from './client/client-factory';
|
|
7
|
+
import { RumSourceMapServiceDefinition } from '../proto-models/com/coralogix/rum/v2/rum_source_map_service';
|
|
8
|
+
import { RequestBuilder } from './client/request-builder';
|
|
9
|
+
|
|
10
|
+
export class ReactNativeApi {
|
|
11
|
+
static async uploadReactNativeSourceMaps(
|
|
12
|
+
uploadBlobRequest: UploadBlobRequest,
|
|
13
|
+
application: string,
|
|
14
|
+
version: string,
|
|
15
|
+
repoName: string | undefined,
|
|
16
|
+
commitHash: string | undefined,
|
|
17
|
+
orgName: string | undefined,
|
|
18
|
+
env: string,
|
|
19
|
+
privateKey: string,
|
|
20
|
+
) {
|
|
21
|
+
try {
|
|
22
|
+
const blobSetClient: Client<typeof BlobSetServiceDefinition> = ClientFactory.getBlobSetGrpcClient(env);
|
|
23
|
+
const rumSourceMapClient: Client<typeof RumSourceMapServiceDefinition> = ClientFactory.getRumSourceMapGrpcClient(env);
|
|
24
|
+
|
|
25
|
+
const metadata = new Metadata();
|
|
26
|
+
metadata.set('Authorization', `Bearer ${privateKey}`);
|
|
27
|
+
|
|
28
|
+
validateCompressedFilesSize(uploadBlobRequest.data.length, config.rumApi.dsymMaxCompressedFilesSize);
|
|
29
|
+
|
|
30
|
+
const { exists } = await rumSourceMapClient.isEntityReleaseExists(
|
|
31
|
+
{ releaseId: version, application, releaseEntityType: ReleaseEntityType.RELEASE_ENTITY_TYPE_REACT_NATIVE },
|
|
32
|
+
{ metadata },
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
if (exists) {
|
|
36
|
+
consoleError(`Entity release already exists for releaseId: ${version} and application: ${application}`);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const updatedUploadBlobRequest = RequestBuilder.createReactNativeUploadBlobRequest(
|
|
41
|
+
uploadBlobRequest,
|
|
42
|
+
application,
|
|
43
|
+
version,
|
|
44
|
+
repoName,
|
|
45
|
+
commitHash,
|
|
46
|
+
orgName,
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
const iterableRequest = createUploadBlobRequestChunks(updatedUploadBlobRequest);
|
|
50
|
+
|
|
51
|
+
await blobSetClient.uploadBlob(iterableRequest, { metadata });
|
|
52
|
+
|
|
53
|
+
const uploadEntityReleaseRequest = RequestBuilder.createReactNativeReleaseRequest(
|
|
54
|
+
application,
|
|
55
|
+
version,
|
|
56
|
+
repoName,
|
|
57
|
+
commitHash,
|
|
58
|
+
orgName,
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
await rumSourceMapClient.createEntityRelease(uploadEntityReleaseRequest, { metadata });
|
|
62
|
+
} catch (error) {
|
|
63
|
+
consoleError(`Failed to upload react native source maps: ${error}`);
|
|
64
|
+
throw error;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Client,
|
|
1
|
+
import { Client, Metadata } from 'nice-grpc';
|
|
2
2
|
import config from '../config/config';
|
|
3
3
|
import {
|
|
4
4
|
DeleteSourceMapRequest,
|
|
@@ -6,40 +6,32 @@ import {
|
|
|
6
6
|
UpdateSourceMapRequest,
|
|
7
7
|
UploadSourceMapsRequest,
|
|
8
8
|
} from '../proto-models/com/coralogix/rum/v2/rum_source_map_service';
|
|
9
|
-
import { compressFileContentChunks, validateCompressedFilesSize } from '../utils';
|
|
10
|
-
import { envToDomain } from '../consts/consts';
|
|
11
9
|
import { FileMetadata } from '../proto-models/com/coralogix/rum/v2/file';
|
|
10
|
+
import { validateCompressedFilesSize } from '../utils/shared.utils';
|
|
11
|
+
import { ClientFactory } from './client/client-factory';
|
|
12
|
+
import { FileProcessor } from '../utils/file-processor.utils';
|
|
12
13
|
|
|
13
|
-
export class
|
|
14
|
-
private static
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const channel = createChannel(envToDomain[env], undefined, {
|
|
18
|
-
'grpc.max_receive_message_length': maxMessageSize,
|
|
19
|
-
'grpc.max_send_message_length': maxMessageSize,
|
|
20
|
-
'grpc.keepalive_time_ms': keepaliveTimeMs,
|
|
21
|
-
'grpc.keepalive_timeout_ms': keepaliveTimeoutMs,
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
return createClient(RumSourceMapServiceDefinition, channel);
|
|
14
|
+
export class SourceMapsApi {
|
|
15
|
+
private static sumFilesSize(files: FileMetadata[]): number {
|
|
16
|
+
return files.reduce((acc, file) => acc + file.size, 0);
|
|
25
17
|
}
|
|
26
18
|
|
|
27
19
|
static async uploadSourceMaps(request: UploadSourceMapsRequest, env: string, privateKey: string) {
|
|
28
20
|
try {
|
|
29
|
-
const client: Client<typeof RumSourceMapServiceDefinition> =
|
|
21
|
+
const client: Client<typeof RumSourceMapServiceDefinition> = ClientFactory.getRumSourceMapGrpcClient(env);
|
|
30
22
|
|
|
31
23
|
const { files, releaseId, application, repoName, commitHash, user } = request;
|
|
32
24
|
|
|
33
25
|
const compressedFiles: FileMetadata[] = await Promise.all(
|
|
34
26
|
files.map(async (file: FileMetadata) => {
|
|
35
|
-
const content = compressFileContentChunks(file.content);
|
|
27
|
+
const content = FileProcessor.compressFileContentChunks(file.content);
|
|
36
28
|
const size = content.length;
|
|
37
29
|
const chunkName = file.chunkName;
|
|
38
30
|
return { chunkName, size, content };
|
|
39
31
|
}),
|
|
40
32
|
);
|
|
41
33
|
|
|
42
|
-
validateCompressedFilesSize(compressedFiles, config.rumApi.
|
|
34
|
+
validateCompressedFilesSize(this.sumFilesSize(compressedFiles), config.rumApi.sourceMapsMaxCompressedFilesSize);
|
|
43
35
|
|
|
44
36
|
const metadata = new Metadata();
|
|
45
37
|
|
|
@@ -63,20 +55,20 @@ export class RumApi {
|
|
|
63
55
|
|
|
64
56
|
static async updateSourceMap(request: UpdateSourceMapRequest, env: string, privateKey: string) {
|
|
65
57
|
try {
|
|
66
|
-
const client: Client<typeof RumSourceMapServiceDefinition> =
|
|
58
|
+
const client: Client<typeof RumSourceMapServiceDefinition> = ClientFactory.getRumSourceMapGrpcClient(env);
|
|
67
59
|
|
|
68
60
|
const { files, releaseId, application, repoName, commitHash, user, generate } = request;
|
|
69
61
|
|
|
70
62
|
const compressedFiles: FileMetadata[] = await Promise.all(
|
|
71
63
|
files.map(async (file: FileMetadata) => {
|
|
72
|
-
const content = compressFileContentChunks(file.content);
|
|
64
|
+
const content = FileProcessor.compressFileContentChunks(file.content);
|
|
73
65
|
const size = content.length;
|
|
74
66
|
const chunkName = file.chunkName;
|
|
75
67
|
return { chunkName, size, content };
|
|
76
68
|
}),
|
|
77
69
|
);
|
|
78
70
|
|
|
79
|
-
validateCompressedFilesSize(compressedFiles, config.rumApi.
|
|
71
|
+
validateCompressedFilesSize(this.sumFilesSize(compressedFiles), config.rumApi.sourceMapsMaxCompressedFilesSize);
|
|
80
72
|
|
|
81
73
|
const metadata = new Metadata();
|
|
82
74
|
|
|
@@ -101,7 +93,7 @@ export class RumApi {
|
|
|
101
93
|
|
|
102
94
|
static async deleteSourceMap(request: DeleteSourceMapRequest, env: string, privateKey: string) {
|
|
103
95
|
try {
|
|
104
|
-
const client: Client<typeof RumSourceMapServiceDefinition> =
|
|
96
|
+
const client: Client<typeof RumSourceMapServiceDefinition> = ClientFactory.getRumSourceMapGrpcClient(env);
|
|
105
97
|
|
|
106
98
|
const metadata = new Metadata();
|
|
107
99
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { validateEnvironment } from '../../validators';
|
|
3
|
+
import { checkMissingArguments, consoleError } from '../../../utils/shared.utils';
|
|
4
|
+
import { DsymService } from '../../../services/dsym.service';
|
|
5
|
+
import { UploadDsymCommandOptions } from '../../../models/dsym-commands.model';
|
|
6
|
+
|
|
7
|
+
export const uploadDsymCommand = () => {
|
|
8
|
+
const uploadCommand = new Command('upload-dsym')
|
|
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 dsym')
|
|
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 Dsym')
|
|
18
|
+
.action(async (options: UploadDsymCommandOptions) => {
|
|
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<UploadDsymCommandOptions>(options, ['privateKey', 'application', 'version', 'folderPath', 'env']);
|
|
28
|
+
|
|
29
|
+
await DsymService.upload(application, version, repoName, commitHash, orgName, folderPath, env, privateKey);
|
|
30
|
+
} catch (error) {
|
|
31
|
+
consoleError(error);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
return uploadCommand;
|
|
36
|
+
};
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
|
-
import { validateEnvironment } from '
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { UploadCommandOptions } from '../../models/commands.model';
|
|
7
|
-
import { ReactNativeSourceMapsService } from '../../services/react-native-source-maps.service';
|
|
2
|
+
import { validateEnvironment } from '../../validators';
|
|
3
|
+
import { checkMissingArguments, consoleError } from '../../../utils/shared.utils';
|
|
4
|
+
import { ReactNativeService } from '../../../services/react-native.service';
|
|
5
|
+
import { UploadReactNativeSourceMapsCommandOptions } from '../../../models/react-native-commands.model';
|
|
8
6
|
|
|
9
7
|
export const uploadReactNativeSourceMapsCommand = () => {
|
|
10
8
|
const uploadCommand = new Command('upload-react-native-source-maps')
|
|
@@ -17,7 +15,7 @@ export const uploadReactNativeSourceMapsCommand = () => {
|
|
|
17
15
|
.option('-n, --repo-name <repoName>', 'GitHub Repository name (optional)')
|
|
18
16
|
.option('-o, --org-name <orgName>', 'GitHub user name (optional)')
|
|
19
17
|
.description('Upload react native source maps')
|
|
20
|
-
.action(async (options:
|
|
18
|
+
.action(async (options: UploadReactNativeSourceMapsCommandOptions) => {
|
|
21
19
|
try {
|
|
22
20
|
if (options.help) {
|
|
23
21
|
uploadCommand.outputHelp();
|
|
@@ -26,12 +24,17 @@ export const uploadReactNativeSourceMapsCommand = () => {
|
|
|
26
24
|
|
|
27
25
|
const { privateKey, application, version, folderPath, commitHash, repoName, orgName, env } = options;
|
|
28
26
|
|
|
29
|
-
checkMissingArguments<
|
|
27
|
+
checkMissingArguments<UploadReactNativeSourceMapsCommandOptions>(options, [
|
|
28
|
+
'privateKey',
|
|
29
|
+
'application',
|
|
30
|
+
'version',
|
|
31
|
+
'folderPath',
|
|
32
|
+
'env',
|
|
33
|
+
]);
|
|
30
34
|
|
|
31
|
-
await
|
|
35
|
+
await ReactNativeService.upload(application, version, repoName, commitHash, orgName, folderPath, env, privateKey);
|
|
32
36
|
} catch (error) {
|
|
33
|
-
|
|
34
|
-
console.error(RED_COLOR, error);
|
|
37
|
+
consoleError(error);
|
|
35
38
|
}
|
|
36
39
|
});
|
|
37
40
|
|
package/cli/commands/{delete-source-maps-command.ts → source-maps/delete-source-maps-command.ts}
RENAMED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
|
-
import { validateEnvironment } from '
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { DeleteCommandOptions } from '../../models/commands.model';
|
|
2
|
+
import { validateEnvironment } from '../../validators';
|
|
3
|
+
import { SourceMapsService } from '../../../services/source-maps.service';
|
|
4
|
+
import { checkMissingArguments, consoleError } from '../../../utils/shared.utils';
|
|
5
|
+
import { DeleteSourceMapsCommandOptions } from '../../../models/source-maps-commands.model';
|
|
7
6
|
|
|
8
7
|
export const deleteSourceMapsCommand = () => {
|
|
9
8
|
const deleteCommand = new Command('delete-source-maps')
|
|
@@ -12,7 +11,7 @@ export const deleteSourceMapsCommand = () => {
|
|
|
12
11
|
.option('-v, --version <version>', 'The application version - must match the version used by RUM sdk')
|
|
13
12
|
.option('-e, --env <env>', 'Your environment', validateEnvironment)
|
|
14
13
|
.description('Delete source maps')
|
|
15
|
-
.action(async (options:
|
|
14
|
+
.action(async (options: DeleteSourceMapsCommandOptions) => {
|
|
16
15
|
try {
|
|
17
16
|
if (options.help) {
|
|
18
17
|
deleteCommand.outputHelp();
|
|
@@ -21,12 +20,11 @@ export const deleteSourceMapsCommand = () => {
|
|
|
21
20
|
|
|
22
21
|
const { privateKey, application, version, env } = options;
|
|
23
22
|
|
|
24
|
-
checkMissingArguments<
|
|
23
|
+
checkMissingArguments<DeleteSourceMapsCommandOptions>(options, ['privateKey', 'application', 'version', 'env']);
|
|
25
24
|
|
|
26
25
|
await SourceMapsService.delete(application, version, env, privateKey);
|
|
27
26
|
} catch (error) {
|
|
28
|
-
|
|
29
|
-
console.error(RED_COLOR, error);
|
|
27
|
+
consoleError(error);
|
|
30
28
|
}
|
|
31
29
|
});
|
|
32
30
|
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { updateSourceMapsCommand } from './update-source-maps-command';
|
|
2
|
+
import { uploadSourceMapsCommand } from './upload-source-maps-command';
|
|
3
|
+
import { deleteSourceMapsCommand } from './delete-source-maps-command';
|
|
4
|
+
|
|
5
|
+
const sourceMapsCommands = { uploadSourceMapsCommand, updateSourceMapsCommand, deleteSourceMapsCommand };
|
|
6
|
+
|
|
7
|
+
export default sourceMapsCommands;
|
package/cli/commands/{update-source-maps-command.ts → source-maps/update-source-maps-command.ts}
RENAMED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
|
-
import { validateEnvironment } from '
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { UpdateCommandOptions } from '../../models/commands.model';
|
|
2
|
+
import { validateEnvironment } from '../../validators';
|
|
3
|
+
import { SourceMapsService } from '../../../services/source-maps.service';
|
|
4
|
+
import { checkMissingArguments, consoleError } from '../../../utils/shared.utils';
|
|
5
|
+
import { UpdateSourceMapsCommandOptions } from '../../../models/source-maps-commands.model';
|
|
7
6
|
|
|
8
7
|
export const updateSourceMapsCommand = () => {
|
|
9
8
|
const updateCommand = new Command('update-source-maps')
|
|
@@ -17,7 +16,7 @@ export const updateSourceMapsCommand = () => {
|
|
|
17
16
|
.option('-o, --org-name <orgName>', 'GitHub user name (optional)')
|
|
18
17
|
.option('-g, --generate [generate]', 'Update existing release or create a new one if not found (optional)')
|
|
19
18
|
.description('Update source maps')
|
|
20
|
-
.action(async (options:
|
|
19
|
+
.action(async (options: UpdateSourceMapsCommandOptions) => {
|
|
21
20
|
try {
|
|
22
21
|
if (options.help) {
|
|
23
22
|
updateCommand.outputHelp();
|
|
@@ -26,12 +25,11 @@ export const updateSourceMapsCommand = () => {
|
|
|
26
25
|
|
|
27
26
|
const { privateKey, application, version, folderPath, commitHash, repoName, orgName, env, generate } = options;
|
|
28
27
|
|
|
29
|
-
checkMissingArguments<
|
|
28
|
+
checkMissingArguments<UpdateSourceMapsCommandOptions>(options, ['privateKey', 'application', 'version', 'folderPath', 'env']);
|
|
30
29
|
|
|
31
30
|
await SourceMapsService.update(application, version, repoName, commitHash, orgName, folderPath, generate, env, privateKey);
|
|
32
31
|
} catch (error) {
|
|
33
|
-
|
|
34
|
-
console.error(RED_COLOR, error);
|
|
32
|
+
consoleError(error);
|
|
35
33
|
}
|
|
36
34
|
});
|
|
37
35
|
|
package/cli/commands/{upload-source-maps-command.ts → source-maps/upload-source-maps-command.ts}
RENAMED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
|
-
import { validateEnvironment } from '
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { UploadCommandOptions } from '../../models/commands.model';
|
|
2
|
+
import { validateEnvironment } from '../../validators';
|
|
3
|
+
import { SourceMapsService } from '../../../services/source-maps.service';
|
|
4
|
+
import { checkMissingArguments, consoleError } from '../../../utils/shared.utils';
|
|
5
|
+
import { UploadSourceMapsCommandOptions } from '../../../models/source-maps-commands.model';
|
|
7
6
|
|
|
8
7
|
export const uploadSourceMapsCommand = () => {
|
|
9
8
|
const uploadCommand = new Command('upload-source-maps')
|
|
@@ -16,7 +15,7 @@ export const uploadSourceMapsCommand = () => {
|
|
|
16
15
|
.option('-n, --repo-name <repoName>', 'GitHub Repository name (optional)')
|
|
17
16
|
.option('-o, --org-name <orgName>', 'GitHub user name (optional)')
|
|
18
17
|
.description('Update source maps')
|
|
19
|
-
.action(async (options:
|
|
18
|
+
.action(async (options: UploadSourceMapsCommandOptions) => {
|
|
20
19
|
try {
|
|
21
20
|
if (options.help) {
|
|
22
21
|
uploadCommand.outputHelp();
|
|
@@ -25,12 +24,11 @@ export const uploadSourceMapsCommand = () => {
|
|
|
25
24
|
|
|
26
25
|
const { privateKey, application, version, folderPath, commitHash, repoName, orgName, env } = options;
|
|
27
26
|
|
|
28
|
-
checkMissingArguments<
|
|
27
|
+
checkMissingArguments<UploadSourceMapsCommandOptions>(options, ['privateKey', 'application', 'version', 'folderPath', 'env']);
|
|
29
28
|
|
|
30
29
|
await SourceMapsService.upload(application, version, repoName, commitHash, orgName, folderPath, env, privateKey);
|
|
31
30
|
} catch (error) {
|
|
32
|
-
|
|
33
|
-
console.error(RED_COLOR, error);
|
|
31
|
+
consoleError(error);
|
|
34
32
|
}
|
|
35
33
|
});
|
|
36
34
|
|