@seekrit/cli 0.21.0 → 0.22.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.
Files changed (2) hide show
  1. package/dist/index.js +10 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1976,7 +1976,7 @@ function isServiceToken(value) {
1976
1976
  }
1977
1977
  //#endregion
1978
1978
  //#region package.json
1979
- var version = "0.21.0";
1979
+ var version = "0.22.0";
1980
1980
  //#endregion
1981
1981
  //#region ../../packages/api-client/src/index.ts
1982
1982
  var SeekritApiError = class extends Error {
@@ -1993,13 +1993,16 @@ var SeekritClient = class {
1993
1993
  baseUrl;
1994
1994
  auth;
1995
1995
  fetchImpl;
1996
+ client;
1996
1997
  constructor(options) {
1997
1998
  this.baseUrl = options.baseUrl.replace(/\/$/, "");
1998
1999
  this.auth = options.auth;
1999
2000
  this.fetchImpl = options.fetch ?? ((...args) => fetch(...args));
2001
+ this.client = options.client;
2000
2002
  }
2001
2003
  async request(method, path, body) {
2002
2004
  const headers = { accept: "application/json" };
2005
+ if (this.client) headers["x-seekrit-client"] = this.client;
2003
2006
  if (this.auth.type === "bearer") headers.authorization = `Bearer ${this.auth.token}`;
2004
2007
  else if (this.auth.type === "dynamic") {
2005
2008
  const token = await this.auth.getToken();
@@ -2430,6 +2433,8 @@ async function readStdin() {
2430
2433
  }
2431
2434
  //#endregion
2432
2435
  //#region src/context.ts
2436
+ /** Sent as `x-seekrit-client` so the API attributes usage to the CLI (analytics). */
2437
+ const CLI_CLIENT = `cli/${version}`;
2433
2438
  /**
2434
2439
  * Build the client context from configured credentials, or return null when
2435
2440
  * none are set. `seekrit run` uses this to degrade to a plain launcher instead
@@ -2460,7 +2465,8 @@ function tryBuildContext(dotenvVars = {}) {
2460
2465
  return {
2461
2466
  client: new SeekritClient({
2462
2467
  baseUrl: apiUrl,
2463
- auth
2468
+ auth,
2469
+ client: CLI_CLIENT
2464
2470
  }),
2465
2471
  auth
2466
2472
  };
@@ -3232,7 +3238,8 @@ async function mintAdminToken(apiUrl, creds) {
3232
3238
  type: "m2m",
3233
3239
  clientId: creds.clientId,
3234
3240
  clientSecret: creds.clientSecret
3235
- }
3241
+ },
3242
+ client: `cli/${version}`
3236
3243
  });
3237
3244
  const { orgs } = await client.listOrgs();
3238
3245
  const org = orgs[0];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seekrit/cli",
3
- "version": "0.21.0",
3
+ "version": "0.22.0",
4
4
  "description": "End-to-end encrypted secrets manager CLI — inject decrypted secrets into any command.",
5
5
  "type": "module",
6
6
  "publishConfig": {