@corsair-dev/cli 0.1.13 → 0.1.14

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.
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../auth.ts"],"names":[],"mappings":"AAguBA,wBAAsB,OAAO,CAAC,EAC7B,GAAG,EACH,QAAQ,EAAE,WAAW,EACrB,QAAQ,EAAE,WAAW,EACrB,IAAI,EAAE,OAAO,EACb,WAAW,EAAE,eAAuB,EACpC,MAAM,EAAE,UAAkB,EAC1B,OAAO,EAAE,WAAmB,EAC5B,SAAS,GACT,EAAE;IACF,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uDAAuD;IACvD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,iFAAiF;IACjF,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,kFAAkF;IAClF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgJhB"}
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../auth.ts"],"names":[],"mappings":"AA6pBA,wBAAsB,OAAO,CAAC,EAC7B,GAAG,EACH,QAAQ,EAAE,WAAW,EACrB,QAAQ,EAAE,WAAW,EACrB,IAAI,EAAE,OAAO,EACb,WAAW,EAAE,eAAuB,EACpC,MAAM,EAAE,UAAkB,EAC1B,OAAO,EAAE,WAAmB,EAC5B,SAAS,GACT,EAAE;IACF,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uDAAuD;IACvD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,iFAAiF;IACjF,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,kFAAkF;IAClF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgJhB"}
package/dist/index.js CHANGED
@@ -1591,6 +1591,7 @@ import {
1591
1591
  createAccountKeyManager as createAccountKeyManager3,
1592
1592
  createIntegrationKeyManager as createIntegrationKeyManager3,
1593
1593
  encryptDEK,
1594
+ exchangeCodeForTokens,
1594
1595
  generateDEK
1595
1596
  } from "corsair/core";
1596
1597
  import { createCorsairOrm } from "corsair/orm";
@@ -1683,56 +1684,6 @@ function waitForOAuthCode(port) {
1683
1684
  server.on("error", reject);
1684
1685
  });
1685
1686
  }
1686
- function exchangeCodeForTokens(code, clientId, clientSecret, oauthConfig, redirectUri) {
1687
- const tokenUrl = new URL(oauthConfig.tokenUrl);
1688
- const useBasicAuth = oauthConfig.tokenAuthMethod === "basic";
1689
- return new Promise((resolve, reject) => {
1690
- const postDataParams = {
1691
- code: code.trim(),
1692
- redirect_uri: redirectUri,
1693
- grant_type: "authorization_code"
1694
- };
1695
- if (!useBasicAuth) {
1696
- postDataParams.client_id = clientId;
1697
- postDataParams.client_secret = clientSecret;
1698
- }
1699
- const postData = querystring.stringify(postDataParams);
1700
- const headers = {
1701
- "Content-Type": "application/x-www-form-urlencoded",
1702
- "Content-Length": Buffer.byteLength(postData).toString()
1703
- };
1704
- if (useBasicAuth) {
1705
- headers.Authorization = `Basic ${Buffer.from(`${clientId}:${clientSecret}`).toString("base64")}`;
1706
- }
1707
- const req = https.request(
1708
- {
1709
- hostname: tokenUrl.hostname,
1710
- path: tokenUrl.pathname,
1711
- method: "POST",
1712
- headers
1713
- },
1714
- (res) => {
1715
- let data = "";
1716
- res.on("data", (chunk) => {
1717
- data += chunk;
1718
- });
1719
- res.on("end", () => {
1720
- if (res.statusCode !== 200) {
1721
- reject(new Error(`Token exchange failed: ${data}`));
1722
- return;
1723
- }
1724
- resolve(JSON.parse(data));
1725
- });
1726
- }
1727
- );
1728
- req.on(
1729
- "error",
1730
- (error) => reject(new Error(`Request failed: ${error.message}`))
1731
- );
1732
- req.write(postData);
1733
- req.end();
1734
- });
1735
- }
1736
1687
  async function extractInternalConfig3(cwd) {
1737
1688
  const instance = await getCorsairInstance({ cwd, shouldThrowOnError: true });
1738
1689
  const internal = instance[CORSAIR_INTERNAL3];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corsair-dev/cli",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -23,7 +23,7 @@
23
23
  "@clack/prompts": "^1.0.0",
24
24
  "c12": "^3.3.3",
25
25
  "zod": "^3.25.76",
26
- "corsair": "0.1.60"
26
+ "corsair": "0.1.65"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/jest": "^29.5.14",