@bugbug-io/sdk 14.0.0 → 14.0.2

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/index.js CHANGED
@@ -7702,33 +7702,51 @@ var require_dist = __commonJS({
7702
7702
  }
7703
7703
  });
7704
7704
 
7705
+ // ../core/dist/constants/defaults.js
7706
+ var DEFAULT_CONFIG_FILE_NAME = "bugbug.yaml";
7707
+ var DEFAULT_API_URL = "https://app.bugbug.io/api/v2";
7708
+ var DEFAULT_YAML_SCHEMA_URL = `${DEFAULT_API_URL}/schema/yaml/v1/`;
7709
+ var DEFAULT_MCP_URL = "https://mcp.bugbug.io";
7710
+ var DEFAULT_MCP_ACCESS_PATH = "/mcp";
7711
+ var DEFAULT_MCP_ACCESS_URL = `${DEFAULT_MCP_URL}${DEFAULT_MCP_ACCESS_PATH}`;
7712
+ var DOCS_BASE_URL = "https://docs.bugbug.io";
7713
+ var DOCS_ASK_URL = `${DOCS_BASE_URL}/master.md`;
7714
+ var CREDENTIALS_DIR_NAME = ".bugbug";
7715
+ var GLOBAL_CONFIG_FILE_NAME = "config.yaml";
7716
+ var DEFAULT_ROOT_CONFIG_FILE_NAME = `~/${CREDENTIALS_DIR_NAME}/${GLOBAL_CONFIG_FILE_NAME}`;
7717
+ var DEFAULT_ROOT_CONFIG_TEMP = `~/${CREDENTIALS_DIR_NAME}/tmp`;
7718
+
7705
7719
  // src/modules/auth/auth.ts
7706
7720
  var AuthModule = class {
7707
7721
  #client;
7708
7722
  constructor(client) {
7709
7723
  this.#client = client;
7710
7724
  }
7725
+ #oauthPath = (path) => !process.env.BUGBUG_APP_URL && this.#client.getConfig().apiUrl === DEFAULT_API_URL ? `/rest${path}` : path;
7711
7726
  getAuth = async (params, options = {}) => {
7712
- const response = await this.#client.getAppRoot("/auth/authorize-url", {
7713
- ...options,
7714
- authenticated: false,
7715
- acceptRedirect: true,
7716
- redirect: "manual",
7717
- queryParams: {
7718
- client_id: params.clientId,
7719
- redirect_uri: params.redirectUri,
7720
- code_challenge: params.codeChallenge,
7721
- code_challenge_method: params.codeChallengeMethod,
7722
- state: params.state
7727
+ const response = await this.#client.getAppRoot(
7728
+ this.#oauthPath("/auth/authorize-url"),
7729
+ {
7730
+ ...options,
7731
+ authenticated: false,
7732
+ acceptRedirect: true,
7733
+ redirect: "manual",
7734
+ queryParams: {
7735
+ client_id: params.clientId,
7736
+ redirect_uri: params.redirectUri,
7737
+ code_challenge: params.codeChallenge,
7738
+ code_challenge_method: params.codeChallengeMethod,
7739
+ state: params.state
7740
+ }
7723
7741
  }
7724
- });
7742
+ );
7725
7743
  const authorizeUrl = response instanceof Response ? response.headers.get("location") : void 0;
7726
7744
  if (!authorizeUrl) {
7727
7745
  throw new Error("BugBug OAuth authorize response did not include a redirect URL.");
7728
7746
  }
7729
7747
  return { authorizeUrl: new URL(authorizeUrl, response.url).toString() };
7730
7748
  };
7731
- exchangeCode = async (payload, options = {}) => this.#client.postAppRoot("/auth/oauth/token/", {
7749
+ exchangeCode = async (payload, options = {}) => this.#client.postAppRoot(this.#oauthPath("/auth/oauth/token/"), {
7732
7750
  ...options,
7733
7751
  authenticated: false,
7734
7752
  body: {
@@ -7739,7 +7757,7 @@ var AuthModule = class {
7739
7757
  code_verifier: payload.codeVerifier
7740
7758
  }
7741
7759
  });
7742
- identity = async (options = {}) => this.#client.getAppRoot("/auth/identity", options);
7760
+ identity = async (options = {}) => this.#client.getAppRoot(this.#oauthPath("/auth/identity"), options);
7743
7761
  };
7744
7762
 
7745
7763
  // src/modules/components/components.ts
@@ -9393,20 +9411,6 @@ var import_dotenv = __toESM(require_main(), 1);
9393
9411
  import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
9394
9412
  import { dirname as dirname3, resolve as resolve3 } from "path";
9395
9413
 
9396
- // ../core/dist/constants/defaults.js
9397
- var DEFAULT_CONFIG_FILE_NAME = "bugbug.yaml";
9398
- var DEFAULT_API_URL = "https://app.bugbug.io/api/v2";
9399
- var DEFAULT_YAML_SCHEMA_URL = `${DEFAULT_API_URL}/schema/yaml/v1/`;
9400
- var DEFAULT_MCP_URL = "https://mcp.bugbug.io";
9401
- var DEFAULT_MCP_ACCESS_PATH = "/mcp";
9402
- var DEFAULT_MCP_ACCESS_URL = `${DEFAULT_MCP_URL}${DEFAULT_MCP_ACCESS_PATH}`;
9403
- var DOCS_BASE_URL = "https://docs.bugbug.io";
9404
- var DOCS_ASK_URL = `${DOCS_BASE_URL}/master.md`;
9405
- var CREDENTIALS_DIR_NAME = ".bugbug";
9406
- var GLOBAL_CONFIG_FILE_NAME = "config.yaml";
9407
- var DEFAULT_ROOT_CONFIG_FILE_NAME = `~/${CREDENTIALS_DIR_NAME}/${GLOBAL_CONFIG_FILE_NAME}`;
9408
- var DEFAULT_ROOT_CONFIG_TEMP = `~/${CREDENTIALS_DIR_NAME}/tmp`;
9409
-
9410
9414
  // ../core/dist/utils/globalConfigFile.js
9411
9415
  import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
9412
9416
  import { homedir } from "os";
@@ -9573,7 +9577,7 @@ var buildUserAgent = (clientType, version) => `BugBug ${clientType.toUpperCase()
9573
9577
  // ../core/package.json
9574
9578
  var package_default = {
9575
9579
  name: "@bugbug-io/core",
9576
- version: "14.0.0",
9580
+ version: "14.0.2",
9577
9581
  private: true,
9578
9582
  type: "module",
9579
9583
  main: "dist/index.js",
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/modules/auth/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EACV,mBAAmB,EACnB,qBAAqB,EACrB,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,cAAc,CAAC;AAEtB,qBAAa,UAAU;;gBAGT,MAAM,EAAE,eAAe;IAInC,OAAO,GACL,QAAQ,mBAAmB,EAC3B,UAAS,cAAmB,KAC3B,OAAO,CAAC,qBAAqB,CAAC,CAwB/B;IAEF,YAAY,GACV,SAAS,gBAAgB,EACzB,UAAS,cAAmB,KAC3B,OAAO,CAAC,iBAAiB,CAAC,CAWxB;IAEL,QAAQ,GAAU,UAAS,cAAmB,KAAG,OAAO,CAAC,YAAY,CAAC,CACH;CACpE"}
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/modules/auth/auth.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EACV,mBAAmB,EACnB,qBAAqB,EACrB,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,cAAc,CAAC;AAEtB,qBAAa,UAAU;;gBAGT,MAAM,EAAE,eAAe;IASnC,OAAO,GACL,QAAQ,mBAAmB,EAC3B,UAAS,cAAmB,KAC3B,OAAO,CAAC,qBAAqB,CAAC,CA2B/B;IAEF,YAAY,GACV,SAAS,gBAAgB,EACzB,UAAS,cAAmB,KAC3B,OAAO,CAAC,iBAAiB,CAAC,CAWxB;IAEL,QAAQ,GAAU,UAAS,cAAmB,KAAG,OAAO,CAAC,YAAY,CAAC,CACc;CACrF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bugbug-io/sdk",
3
- "version": "14.0.0",
3
+ "version": "14.0.2",
4
4
  "description": "A comprehensive TypeScript SDK for BugBug API with modular architecture, rate limiting, and built-in utilities",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",