@hasna/connectors 1.3.7 → 1.3.8

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
@@ -498,6 +498,13 @@ var CONNECTORS = [
498
498
  category: "Data & Analytics",
499
499
  tags: ["weather", "data"]
500
500
  },
501
+ {
502
+ name: "arxiv",
503
+ displayName: "arXiv",
504
+ description: "Research paper search and retrieval",
505
+ category: "Data & Analytics",
506
+ tags: ["research", "papers", "academic"]
507
+ },
501
508
  {
502
509
  name: "brandsight",
503
510
  displayName: "Brandsight",
@@ -6185,27 +6192,56 @@ function loadConnectorVersions() {
6185
6192
  }
6186
6193
  }
6187
6194
  // src/lib/installer.ts
6188
- import { existsSync as existsSync2, cpSync, mkdirSync, readFileSync as readFileSync2, writeFileSync, readdirSync, statSync, rmSync } from "fs";
6189
- import { homedir } from "os";
6190
- import { join as join2, dirname as dirname2 } from "path";
6195
+ import { existsSync as existsSync3, cpSync, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync, readdirSync as readdirSync2, statSync as statSync2, rmSync } from "fs";
6196
+ import { join as join3, dirname as dirname2 } from "path";
6191
6197
  import { fileURLToPath as fileURLToPath2 } from "url";
6198
+
6199
+ // src/db/database.ts
6200
+ import { join as join2 } from "path";
6201
+ import { homedir } from "os";
6202
+ import { mkdirSync, existsSync as existsSync2, readdirSync, copyFileSync, statSync } from "fs";
6203
+ function getConnectorsHome() {
6204
+ const home = process.env["HOME"] || process.env["USERPROFILE"] || homedir();
6205
+ const newDir = join2(home, ".hasna", "connectors");
6206
+ const oldDir = join2(home, ".connectors");
6207
+ if (existsSync2(oldDir) && !existsSync2(newDir)) {
6208
+ mkdirSync(newDir, { recursive: true });
6209
+ try {
6210
+ for (const file of readdirSync(oldDir)) {
6211
+ const oldPath = join2(oldDir, file);
6212
+ const newPath = join2(newDir, file);
6213
+ try {
6214
+ if (statSync(oldPath).isFile()) {
6215
+ copyFileSync(oldPath, newPath);
6216
+ }
6217
+ } catch {}
6218
+ }
6219
+ } catch {}
6220
+ }
6221
+ mkdirSync(newDir, { recursive: true });
6222
+ return newDir;
6223
+ }
6224
+ var DB_DIR = getConnectorsHome();
6225
+ var DB_PATH = join2(DB_DIR, "connectors.db");
6226
+
6227
+ // src/lib/installer.ts
6192
6228
  var __dirname2 = dirname2(fileURLToPath2(import.meta.url));
6193
6229
  function resolveConnectorsDir() {
6194
- const fromBin = join2(__dirname2, "..", "connectors");
6195
- if (existsSync2(fromBin))
6230
+ const fromBin = join3(__dirname2, "..", "connectors");
6231
+ if (existsSync3(fromBin))
6196
6232
  return fromBin;
6197
- const fromSrc = join2(__dirname2, "..", "..", "connectors");
6198
- if (existsSync2(fromSrc))
6233
+ const fromSrc = join3(__dirname2, "..", "..", "connectors");
6234
+ if (existsSync3(fromSrc))
6199
6235
  return fromSrc;
6200
6236
  return fromBin;
6201
6237
  }
6202
6238
  var CONNECTORS_DIR = resolveConnectorsDir();
6203
6239
  function getConnectorPath(name) {
6204
6240
  const connectorName = name.startsWith("connect-") ? name : `connect-${name}`;
6205
- return join2(CONNECTORS_DIR, connectorName);
6241
+ return join3(CONNECTORS_DIR, connectorName);
6206
6242
  }
6207
6243
  function connectorExists(name) {
6208
- return existsSync2(getConnectorPath(name));
6244
+ return existsSync3(getConnectorPath(name));
6209
6245
  }
6210
6246
  function installConnector(name, options = {}) {
6211
6247
  const { targetDir = process.cwd(), overwrite = false } = options;
@@ -6218,16 +6254,16 @@ function installConnector(name, options = {}) {
6218
6254
  }
6219
6255
  const connectorName = name.startsWith("connect-") ? name : `connect-${name}`;
6220
6256
  const sourcePath = getConnectorPath(name);
6221
- const destDir = join2(targetDir, ".connectors");
6222
- const destPath = join2(destDir, connectorName);
6223
- if (!existsSync2(sourcePath)) {
6257
+ const destDir = join3(targetDir, ".connectors");
6258
+ const destPath = join3(destDir, connectorName);
6259
+ if (!existsSync3(sourcePath)) {
6224
6260
  return {
6225
6261
  connector: name,
6226
6262
  success: false,
6227
6263
  error: `Connector '${name}' not found`
6228
6264
  };
6229
6265
  }
6230
- if (existsSync2(destPath) && !overwrite) {
6266
+ if (existsSync3(destPath) && !overwrite) {
6231
6267
  return {
6232
6268
  connector: name,
6233
6269
  success: false,
@@ -6236,22 +6272,22 @@ function installConnector(name, options = {}) {
6236
6272
  };
6237
6273
  }
6238
6274
  try {
6239
- if (!existsSync2(destDir)) {
6240
- mkdirSync(destDir, { recursive: true });
6275
+ if (!existsSync3(destDir)) {
6276
+ mkdirSync2(destDir, { recursive: true });
6241
6277
  }
6242
6278
  cpSync(sourcePath, destPath, { recursive: true });
6243
- const homeCredDir = join2(homedir(), ".connectors", connectorName);
6244
- if (existsSync2(homeCredDir)) {
6279
+ const homeCredDir = join3(getConnectorsHome(), connectorName);
6280
+ if (existsSync3(homeCredDir)) {
6245
6281
  const filesToCopy = ["credentials.json", "current_profile"];
6246
6282
  for (const file of filesToCopy) {
6247
- const src = join2(homeCredDir, file);
6248
- if (existsSync2(src)) {
6249
- cpSync(src, join2(destPath, file));
6283
+ const src = join3(homeCredDir, file);
6284
+ if (existsSync3(src)) {
6285
+ cpSync(src, join3(destPath, file));
6250
6286
  }
6251
6287
  }
6252
- const profilesDir = join2(homeCredDir, "profiles");
6253
- if (existsSync2(profilesDir)) {
6254
- cpSync(profilesDir, join2(destPath, "profiles"), { recursive: true });
6288
+ const profilesDir = join3(homeCredDir, "profiles");
6289
+ if (existsSync3(profilesDir)) {
6290
+ cpSync(profilesDir, join3(destPath, "profiles"), { recursive: true });
6255
6291
  }
6256
6292
  }
6257
6293
  updateConnectorsIndex(destDir);
@@ -6272,8 +6308,8 @@ function installConnectors(names, options = {}) {
6272
6308
  return names.map((name) => installConnector(name, options));
6273
6309
  }
6274
6310
  function updateConnectorsIndex(connectorsDir) {
6275
- const indexPath = join2(connectorsDir, "index.ts");
6276
- const connectors = readdirSync(connectorsDir).filter((f) => f.startsWith("connect-") && !f.includes("."));
6311
+ const indexPath = join3(connectorsDir, "index.ts");
6312
+ const connectors = readdirSync2(connectorsDir).filter((f) => f.startsWith("connect-") && !f.includes("."));
6277
6313
  const exports = connectors.map((c) => {
6278
6314
  const name = c.replace("connect-", "");
6279
6315
  return `export * as ${name} from './${c}/src/index.js';`;
@@ -6289,19 +6325,19 @@ ${exports}
6289
6325
  writeFileSync(indexPath, content);
6290
6326
  }
6291
6327
  function getInstalledConnectors(targetDir = process.cwd()) {
6292
- const connectorsDir = join2(targetDir, ".connectors");
6293
- if (!existsSync2(connectorsDir)) {
6328
+ const connectorsDir = join3(targetDir, ".connectors");
6329
+ if (!existsSync3(connectorsDir)) {
6294
6330
  return [];
6295
6331
  }
6296
- return readdirSync(connectorsDir).filter((f) => {
6297
- const fullPath = join2(connectorsDir, f);
6298
- return f.startsWith("connect-") && statSync(fullPath).isDirectory();
6332
+ return readdirSync2(connectorsDir).filter((f) => {
6333
+ const fullPath = join3(connectorsDir, f);
6334
+ return f.startsWith("connect-") && statSync2(fullPath).isDirectory();
6299
6335
  }).map((f) => f.replace("connect-", ""));
6300
6336
  }
6301
6337
  function getConnectorDocs(name) {
6302
6338
  const connectorPath = getConnectorPath(name);
6303
- const claudeMdPath = join2(connectorPath, "CLAUDE.md");
6304
- if (!existsSync2(claudeMdPath))
6339
+ const claudeMdPath = join3(connectorPath, "CLAUDE.md");
6340
+ if (!existsSync3(claudeMdPath))
6305
6341
  return null;
6306
6342
  const raw = readFileSync2(claudeMdPath, "utf-8");
6307
6343
  return {
@@ -6342,9 +6378,9 @@ function parseEnvVarsTable(section) {
6342
6378
  }
6343
6379
  function removeConnector(name, targetDir = process.cwd()) {
6344
6380
  const connectorName = name.startsWith("connect-") ? name : `connect-${name}`;
6345
- const connectorsDir = join2(targetDir, ".connectors");
6346
- const connectorPath = join2(connectorsDir, connectorName);
6347
- if (!existsSync2(connectorPath)) {
6381
+ const connectorsDir = join3(targetDir, ".connectors");
6382
+ const connectorPath = join3(connectorsDir, connectorName);
6383
+ if (!existsSync3(connectorPath)) {
6348
6384
  return false;
6349
6385
  }
6350
6386
  rmSync(connectorPath, { recursive: true });
@@ -6352,17 +6388,17 @@ function removeConnector(name, targetDir = process.cwd()) {
6352
6388
  return true;
6353
6389
  }
6354
6390
  // src/lib/runner.ts
6355
- import { existsSync as existsSync3 } from "fs";
6356
- import { join as join3, dirname as dirname3 } from "path";
6391
+ import { existsSync as existsSync4 } from "fs";
6392
+ import { join as join4, dirname as dirname3 } from "path";
6357
6393
  import { fileURLToPath as fileURLToPath3 } from "url";
6358
6394
  import { spawn } from "child_process";
6359
6395
  var __dirname3 = dirname3(fileURLToPath3(import.meta.url));
6360
6396
  function resolveConnectorsDir2() {
6361
- const fromBin = join3(__dirname3, "..", "connectors");
6362
- if (existsSync3(fromBin))
6397
+ const fromBin = join4(__dirname3, "..", "connectors");
6398
+ if (existsSync4(fromBin))
6363
6399
  return fromBin;
6364
- const fromSrc = join3(__dirname3, "..", "..", "connectors");
6365
- if (existsSync3(fromSrc))
6400
+ const fromSrc = join4(__dirname3, "..", "..", "connectors");
6401
+ if (existsSync4(fromSrc))
6366
6402
  return fromSrc;
6367
6403
  return fromBin;
6368
6404
  }
@@ -6402,9 +6438,9 @@ function buildEnvWithCredentials(connectorName, baseEnv) {
6402
6438
  }
6403
6439
  function getConnectorCliPath(name) {
6404
6440
  const safeName = name.replace(/[^a-z0-9-]/g, "");
6405
- const connectorDir = join3(CONNECTORS_DIR2, `connect-${safeName}`);
6406
- const cliPath = join3(connectorDir, "src", "cli", "index.ts");
6407
- if (existsSync3(cliPath))
6441
+ const connectorDir = join4(CONNECTORS_DIR2, `connect-${safeName}`);
6442
+ const cliPath = join4(connectorDir, "src", "cli", "index.ts");
6443
+ if (existsSync4(cliPath))
6408
6444
  return cliPath;
6409
6445
  return null;
6410
6446
  }
@@ -6483,10 +6519,10 @@ async function getConnectorCommandHelp(name, command) {
6483
6519
  return result.stdout || result.stderr;
6484
6520
  }
6485
6521
  function getConnectorsWithCli() {
6486
- const { readdirSync: readdirSync2 } = __require("fs");
6522
+ const { readdirSync: readdirSync3 } = __require("fs");
6487
6523
  const connectors = [];
6488
6524
  try {
6489
- const dirs = readdirSync2(CONNECTORS_DIR2);
6525
+ const dirs = readdirSync3(CONNECTORS_DIR2);
6490
6526
  for (const dir of dirs) {
6491
6527
  if (!dir.startsWith("connect-"))
6492
6528
  continue;
package/dist/lib/llm.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * Provider-agnostic LLM client for open-connectors.
3
3
  *
4
4
  * Supports: cerebras, groq, openai, anthropic
5
- * Config stored at: ~/.connectors/llm.json
5
+ * Config stored at: ~/.hasna/connectors/llm.json
6
6
  *
7
7
  * Cerebras and Groq are OpenAI-compatible (same SDK, different base URLs).
8
8
  * Anthropic has its own API format.
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * Strategy: atomic O_EXCL file creation as the lock primitive (works on all
9
9
  * platforms including macOS). Lock files live at:
10
- * ~/.connectors/connect-{name}/.write.lock
10
+ * ~/.hasna/connectors/connect-{name}/.write.lock
11
11
  *
12
12
  * Callers that cannot acquire the lock within the timeout receive a LockTimeoutError.
13
13
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/connectors",
3
- "version": "1.3.7",
3
+ "version": "1.3.8",
4
4
  "description": "Open source connector library - Install API connectors with a single command",
5
5
  "type": "module",
6
6
  "bin": {