@hasna/connectors 0.4.1 → 0.4.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/bin/index.js CHANGED
@@ -7078,7 +7078,7 @@ var PRESETS = {
7078
7078
  commerce: { description: "Commerce and finance", connectors: ["stripe", "shopify", "revolut", "mercury", "pandadoc"] }
7079
7079
  };
7080
7080
  var program2 = new Command;
7081
- program2.name("connectors").description("Install API connectors for your project").version("0.4.1").enablePositionalOptions();
7081
+ program2.name("connectors").description("Install API connectors for your project").version("0.4.2").enablePositionalOptions();
7082
7082
  program2.command("interactive", { isDefault: true }).alias("i").description("Interactive connector browser").action(() => {
7083
7083
  if (!isTTY) {
7084
7084
  console.log(`Non-interactive environment detected. Use a subcommand:
@@ -8657,8 +8657,20 @@ Testing connector credentials...
8657
8657
  if (existsSync6(tokensFile)) {
8658
8658
  try {
8659
8659
  const tokens = JSON.parse(readFileSync5(tokensFile, "utf-8"));
8660
- if (tokens.accessToken)
8660
+ const isExpired = tokens.expiresAt && Date.now() >= tokens.expiresAt - 60000;
8661
+ if (isExpired && tokens.refreshToken) {
8662
+ try {
8663
+ const refreshed = await refreshOAuthToken(name);
8664
+ apiKey = refreshed.accessToken;
8665
+ if (!options.json)
8666
+ console.log(` ${chalk2.dim("\u21BB")} ${chalk2.dim(name)} \u2014 ${chalk2.dim("token refreshed")}`);
8667
+ } catch {
8668
+ if (tokens.accessToken)
8669
+ apiKey = tokens.accessToken;
8670
+ }
8671
+ } else if (tokens.accessToken) {
8661
8672
  apiKey = tokens.accessToken;
8673
+ }
8662
8674
  } catch {}
8663
8675
  }
8664
8676
  if (!apiKey) {
package/bin/mcp.js CHANGED
@@ -20560,7 +20560,7 @@ async function getConnectorCommandHelp(name, command) {
20560
20560
  loadConnectorVersions();
20561
20561
  var server = new McpServer({
20562
20562
  name: "connectors",
20563
- version: "0.4.1"
20563
+ version: "0.4.2"
20564
20564
  });
20565
20565
  server.registerTool("search_connectors", {
20566
20566
  title: "Search Connectors",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/connectors",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "Open source connector library - Install API connectors with a single command",
5
5
  "type": "module",
6
6
  "bin": {