@sectester/core 0.38.0 → 0.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 Bright Security
3
+ Copyright (c) 2025 Bright Security
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -43,8 +43,8 @@ Configuration can be customized using the following options:
43
43
 
44
44
  ```ts
45
45
  export interface ConfigurationOptions {
46
- hostname: string;
47
- projectId: string;
46
+ hostname?: string;
47
+ projectId?: string;
48
48
  credentials?: Credentials;
49
49
  logLevel?: LogLevel;
50
50
  credentialProviders?: CredentialProvider[];
@@ -64,7 +64,7 @@ The default configuration is as follows:
64
64
 
65
65
  - type: `string`
66
66
 
67
- Set the application name (domain name), that is used to establish connection with.
67
+ Set the hostname (domain name) used to establish a connection.
68
68
 
69
69
  ```ts
70
70
  import { Configuration } from '@sectester/core';
@@ -74,11 +74,14 @@ const config = new Configuration({
74
74
  });
75
75
  ```
76
76
 
77
+ > [!NOTE]
78
+ > If you omit the `hostname` parameter, 'app.brightsec.com' will be used by default.
79
+
77
80
  #### projectId
78
81
 
79
82
  - type: `string`
80
83
 
81
- Set ID of the project you want to work with.
84
+ Set the ID of the project you want to work with.
82
85
 
83
86
  ```ts
84
87
  import { Configuration } from '@sectester/core';
@@ -93,13 +96,13 @@ const config = new Configuration({
93
96
  > The project ID can be found in the URL of the project page. For example, in the URL `https://app.brightsec.com/projects/1234`, the project ID is `1234`. We recommend using the dedicated project ID for each application.
94
97
 
95
98
  > [!WARNING]
96
- > If you omit the `projectId` parameter, we will use the default project ID. This is not recommended ecpesially if you have multiple projects.
99
+ > If you omit the `projectId` parameter, we will use the default project ID. This is not recommended especially if you have multiple projects.
97
100
 
98
101
  #### logLevel
99
102
 
100
103
  - type: `LogLevel`
101
104
 
102
- What level of logs to report. Any logs of a higher level than the setting are shown.
105
+ Set the maximum log level to report.
103
106
 
104
107
  ```ts
105
108
  import { Configuration, LogLevel } from '@sectester/core';
@@ -114,7 +117,7 @@ const config = new Configuration({
114
117
 
115
118
  - type: `Credentials`
116
119
 
117
- Set credentials to access the application.
120
+ Set credentials for accessing the application.
118
121
 
119
122
  ```ts
120
123
  import { Configuration } from '@sectester/core';
@@ -133,7 +136,7 @@ More info about [setting up an API key](https://docs.brightsec.com/docs/manage-y
133
136
 
134
137
  - type: `CredentialProvider[]`
135
138
 
136
- Allows you to provide credentials and load it in runtime. The configuration will invoke one provider at a time and only continue to the next if no credentials have been located. For example, if the process finds values defined via the `BRIGHT_TOKEN` environment variables, the file at `.sectesterrc` will not be read.
139
+ Allows you to provide credentials that are loaded at runtime. The configuration will invoke one provider at a time and only continue to the next if no credentials have been located. For example, if the process finds values defined via the `BRIGHT_TOKEN` environment variables, the file at `.sectesterrc` will not be read.
137
140
 
138
141
  #### EnvCredentialProvider
139
142
 
@@ -159,7 +162,7 @@ The `ApiClient` interface and its implementation `FetchApiClient` provide a robu
159
162
  import { FetchApiClient } from '@sectester/core';
160
163
 
161
164
  const client = new FetchApiClient({
162
- baseUrl: 'https://app.neuralegion.com',
165
+ baseUrl: 'https://app.brightsec.com',
163
166
  apiKey: 'your-api-key',
164
167
  timeout: 5000 // optional, defaults to 5000ms
165
168
  });
@@ -190,6 +193,6 @@ The client can be configured using the following options:
190
193
 
191
194
  ## License
192
195
 
193
- Copyright © 2024 [Bright Security](https://brightsec.com/).
196
+ Copyright © 2025 [Bright Security](https://brightsec.com/).
194
197
 
195
198
  This project is licensed under the MIT License - see the [LICENSE file](LICENSE) for details.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sectester/core",
3
- "version": "0.38.0",
3
+ "version": "0.40.0",
4
4
  "description": "The core package can be used to obtain a config including credentials from different sources, and provide a simplified abstraction to handle events and commands.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,7 +1,7 @@
1
1
  import { CredentialProvider, Credentials, CredentialsOptions } from '../credentials-provider';
2
2
  import { LogLevel } from '../logger';
3
3
  export interface ConfigurationOptions {
4
- hostname: string;
4
+ hostname?: string;
5
5
  projectId?: string;
6
6
  logLevel?: LogLevel;
7
7
  credentials?: Credentials | CredentialsOptions;
@@ -38,7 +38,7 @@ class Configuration {
38
38
  get name() {
39
39
  return package_json_1.secTester.name;
40
40
  }
41
- constructor({ hostname, credentials, projectId, logLevel = logger_1.LogLevel.ERROR, credentialProviders = [new credentials_provider_1.EnvCredentialProvider()] }) {
41
+ constructor({ hostname = 'app.brightsec.com', credentials, projectId, logLevel = logger_1.LogLevel.ERROR, credentialProviders = [new credentials_provider_1.EnvCredentialProvider()] }) {
42
42
  this.SCHEMA_REGEXP = /^.+:\/\//;
43
43
  this.HOSTNAME_NORMALIZATION_REGEXP = /^(?!(?:\w+:)?\/\/)|^\/\//;
44
44
  this._container = tsyringe_1.container.createChildContainer();
@@ -49,9 +49,6 @@ class Configuration {
49
49
  this._credentials = new credentials_provider_1.Credentials(credentials);
50
50
  }
51
51
  this._credentialProviders = credentialProviders;
52
- if (!hostname) {
53
- throw new Error(`Please provide 'hostname' option.`);
54
- }
55
52
  this.resolveUrls(hostname);
56
53
  this._projectId = projectId;
57
54
  this._logLevel = logLevel;
@@ -1 +1 @@
1
- {"version":3,"file":"Configuration.js","sourceRoot":"","sources":["../../../../../packages/core/src/configuration/Configuration.ts"],"names":[],"mappings":";;;AAAA,kEAKiC;AACjC,oCAAiC;AACjC,sCAAqC;AACrC,qDAAwD;AACxD,0CAAuC;AACvC,uCAAqC;AAUrC,MAAa,aAAa;IASxB,IAAI,mBAAmB;QACrB,OAAO,IAAI,CAAC,oBAAoB,CAAC;IACnC,CAAC;IAID,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAID,IAAI,WAAW;QACb,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,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