@adkit/cli 1.12.10 → 1.12.11
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/dist/cli.js +8 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -167,12 +167,14 @@ function buildAuthSuggestion(code) {
|
|
|
167
167
|
var AdkitClient = class {
|
|
168
168
|
apiKey;
|
|
169
169
|
baseUrl;
|
|
170
|
+
clientVersion;
|
|
170
171
|
projectId;
|
|
171
|
-
constructor({ apiKey, baseUrl, projectId }) {
|
|
172
|
+
constructor({ apiKey, baseUrl, clientVersion, projectId }) {
|
|
172
173
|
const isLocalhost = baseUrl.startsWith("http://localhost") || baseUrl.startsWith("http://127.0.0.1");
|
|
173
174
|
if (baseUrl.startsWith("http://") && !isLocalhost) throw new Error("HTTPS is required \u2014 insecure HTTP base URLs are not allowed");
|
|
174
175
|
this.apiKey = apiKey;
|
|
175
176
|
this.baseUrl = baseUrl;
|
|
177
|
+
this.clientVersion = clientVersion;
|
|
176
178
|
this.projectId = projectId;
|
|
177
179
|
}
|
|
178
180
|
// eslint-disable-next-line max-lines-per-function -- shared client error mapping is intentionally centralized here.
|
|
@@ -180,8 +182,11 @@ var AdkitClient = class {
|
|
|
180
182
|
const url = `${this.baseUrl}${path3}`;
|
|
181
183
|
const headers = {
|
|
182
184
|
Authorization: `Bearer ${this.apiKey}`,
|
|
183
|
-
"Content-Type": "application/json"
|
|
185
|
+
"Content-Type": "application/json",
|
|
186
|
+
"User-Agent": this.clientVersion ? `adkit-cli/${this.clientVersion}` : "adkit-cli",
|
|
187
|
+
"x-adkit-client": "cli"
|
|
184
188
|
};
|
|
189
|
+
if (this.clientVersion) headers["x-adkit-client-version"] = this.clientVersion;
|
|
185
190
|
if (this.projectId) headers["x-adkit-project-id"] = this.projectId;
|
|
186
191
|
const init = { method, headers };
|
|
187
192
|
if (body !== void 0) init.body = JSON.stringify(body);
|
|
@@ -5818,7 +5823,7 @@ function requireClient(flags, options = {}) {
|
|
|
5818
5823
|
if (!apiKey) throw new CliError("NOT_AUTHENTICATED", "No API key found", "Run: adkit setup");
|
|
5819
5824
|
const baseUrl = getBaseUrl();
|
|
5820
5825
|
const projectId = options.projectOptional ? void 0 : selectedProject;
|
|
5821
|
-
return new AdkitClient({ apiKey, baseUrl, projectId });
|
|
5826
|
+
return new AdkitClient({ apiKey, baseUrl, clientVersion: CLI_VERSION, projectId });
|
|
5822
5827
|
}
|
|
5823
5828
|
function toPrintListDisplayRows(rows, isJson) {
|
|
5824
5829
|
if (isJson) return rows;
|
package/package.json
CHANGED