orangeslice 1.7.19 → 1.7.21

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/README.md CHANGED
@@ -8,6 +8,8 @@ npx orangeslice
8
8
 
9
9
  This installs documentation your AI agent needs to master the database. Point your agent (Claude Code, Cursor, etc.) to `./AGENTS.md` and it becomes a B2B prospecting expert.
10
10
 
11
+ For maintainers: npm publishes docs from the canonical source at `../lib/vfs/sheet-chat` via `npm run sync-docs`, so the app docs and package docs stay in sync.
12
+
11
13
  ## What It Does
12
14
 
13
15
  Your AI agent gets:
package/dist/api.js CHANGED
@@ -14,6 +14,17 @@ const DEFAULT_POLL_INTERVAL_MS = 1000;
14
14
  function sleep(ms) {
15
15
  return new Promise((resolve) => setTimeout(resolve, ms));
16
16
  }
17
+ async function readResponseBody(res) {
18
+ const text = await res.text();
19
+ if (!text)
20
+ return null;
21
+ try {
22
+ return JSON.parse(text);
23
+ }
24
+ catch {
25
+ return text;
26
+ }
27
+ }
17
28
  function asErrorMessage(body) {
18
29
  if (!body || typeof body !== "object")
19
30
  return undefined;
@@ -74,7 +85,7 @@ async function pollUntilComplete(baseUrl, functionId, pending) {
74
85
  while (Date.now() < timeoutAt) {
75
86
  await sleep(pollAfterMs);
76
87
  const res = await fetch(pollUrl, { method: "GET", headers: { "Content-Type": "application/json" } });
77
- const data = (await res.json());
88
+ const data = await readResponseBody(res);
78
89
  if (isPendingResponse(data) || res.status === 202) {
79
90
  const next = data.pollAfterMs;
80
91
  pollAfterMs = typeof next === "number" && next > 0 ? next : DEFAULT_POLL_INTERVAL_MS;
@@ -103,16 +114,11 @@ async function post(functionId, payload, options = {}) {
103
114
  });
104
115
  if (!res.ok) {
105
116
  let message = `${res.status}`;
106
- try {
107
- const data = (await res.json());
108
- message = asErrorMessage(data) || JSON.stringify(data);
109
- }
110
- catch {
111
- message = await res.text();
112
- }
117
+ const data = await readResponseBody(res);
118
+ message = asErrorMessage(data) || (typeof data === "string" ? data : JSON.stringify(data));
113
119
  throw new Error(`[orangeslice] ${functionId}: ${res.status} ${message}`);
114
120
  }
115
- const data = (await res.json());
121
+ const data = await readResponseBody(res);
116
122
  if (isPendingResponse(data)) {
117
123
  return pollUntilComplete(baseUrl, functionId, data);
118
124
  }
package/dist/expansion.js CHANGED
@@ -23,7 +23,7 @@ function extractLinkedinUsername(url) {
23
23
  return slug.length > 0 ? slug : undefined;
24
24
  }
25
25
  async function personLinkedinFindUrl(params) {
26
- return (0, api_1.post)("linkedin/find-profile-url", params, { direct: true });
26
+ return (0, api_1.post)("linkedin/find-profile-url", params);
27
27
  }
28
28
  async function personLinkedinEnrich(params) {
29
29
  const url = typeof params.url === "string" ? params.url.trim() : "";
@@ -74,7 +74,22 @@ async function personContactGet(params) {
74
74
  return (0, api_1.post)("contact", params);
75
75
  }
76
76
  async function companyLinkedinFindUrl(params) {
77
- return (0, api_1.post)("find-linkedin-company-url", params, { direct: true });
77
+ const companyName = typeof params.companyName === "string" && params.companyName.trim().length > 0
78
+ ? params.companyName.trim()
79
+ : typeof params.name === "string" && params.name.trim().length > 0
80
+ ? params.name.trim()
81
+ : undefined;
82
+ const website = typeof params.website === "string" && params.website.trim().length > 0
83
+ ? params.website.trim()
84
+ : typeof params.domain === "string" && params.domain.trim().length > 0
85
+ ? params.domain.trim()
86
+ : undefined;
87
+ const payload = {
88
+ ...params,
89
+ ...(companyName ? { companyName } : {}),
90
+ ...(website ? { website } : {}),
91
+ };
92
+ return (0, api_1.post)("find-linkedin-company-url", payload);
78
93
  }
79
94
  async function companyLinkedinEnrich(params) {
80
95
  const shorthand = typeof params.shorthand === "string" ? params.shorthand.trim() : "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orangeslice",
3
- "version": "1.7.19",
3
+ "version": "1.7.21",
4
4
  "description": "B2B LinkedIn database prospector - 1.15B profiles, 85M companies",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,8 +13,9 @@
13
13
  "README.md"
14
14
  ],
15
15
  "scripts": {
16
+ "sync-docs": "node scripts/sync-docs.mjs",
16
17
  "build": "tsc",
17
- "prepublishOnly": "npm run build",
18
+ "prepublishOnly": "npm run sync-docs && npm run build",
18
19
  "test": "npx tsx test.ts"
19
20
  },
20
21
  "keywords": [
@@ -36,8 +37,5 @@
36
37
  "devDependencies": {
37
38
  "@types/node": "^25.1.0",
38
39
  "typescript": "^5.9.3"
39
- },
40
- "dependencies": {
41
- "orangeslice": "^1.7.12"
42
40
  }
43
41
  }