@absolutejs/engagement-apollo 0.0.7 → 0.0.9

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.
Files changed (3) hide show
  1. package/README.md +3 -2
  2. package/dist/index.js +21 -3
  3. package/package.json +6 -20
package/README.md CHANGED
@@ -25,8 +25,9 @@ const activity = await apollo.listActivities?.({
25
25
  | `enrichCompany` | `GET /v1/organizations/enrich` | Domain required. |
26
26
  | `listActivities` | `POST /v1/emailer_messages/search` | **Plan-gated** — engagement API access varies by Apollo plan. Returns `[]` if unsupported; verify field mapping against a live account before relying on it. |
27
27
 
28
- All calls fail soft: a non-2xx response or an unexpected shape returns `null` / `[]`
29
- rather than throwing, so a consumer can treat the source as best-effort.
28
+ Company enrichment preserves provider identity and annual revenue with observation time and provider-estimate attribution. Currency remains unknown when the provider does not specify it.
29
+
30
+ Company enrichment returns `null` for no match (404), throws `RateLimitError` for 429, and throws `EngagementProviderError` for authentication, permission, server, or malformed-response failures. Errors exclude raw response bodies and credentials. Person/activity endpoints retain their existing behavior.
30
31
 
31
32
  ## License
32
33
 
package/dist/index.js CHANGED
@@ -1,6 +1,9 @@
1
1
  // @bun
2
2
  // src/index.ts
3
- import { RateLimitError } from "@absolutejs/engagement";
3
+ import {
4
+ EngagementProviderError,
5
+ RateLimitError
6
+ } from "@absolutejs/engagement";
4
7
  var APOLLO_BASE_URL = "https://api.apollo.io";
5
8
  var DEFAULT_ACTIVITY_LIMIT = 50;
6
9
  var DEFAULT_SEARCH_LIMIT = 6;
@@ -36,10 +39,14 @@ var apolloSource = (options) => {
36
39
  const res = await doFetch(`${baseUrl}${path}`, { headers, method: "GET" });
37
40
  if (res.status === 429)
38
41
  throw new RateLimitError("apollo");
39
- if (!res.ok)
42
+ if (res.status === 404)
40
43
  return null;
44
+ if (!res.ok)
45
+ throw new EngagementProviderError("apollo", res.status, "company enrichment");
41
46
  const json = await res.json();
42
- return isRecord(json) ? json : null;
47
+ if (!isRecord(json))
48
+ throw new EngagementProviderError("apollo", 502, "invalid company response");
49
+ return json;
43
50
  };
44
51
  const normalizePerson = (person) => {
45
52
  const org = isRecord(person.organization) ? person.organization : null;
@@ -116,7 +123,18 @@ var apolloSource = (options) => {
116
123
  const org = json && isRecord(json.organization) ? json.organization : null;
117
124
  if (!org)
118
125
  return null;
126
+ const revenue = num(org.annual_revenue);
127
+ const revenueDisplay = str(org.annual_revenue_printed);
119
128
  return {
129
+ providerId: str(org.id),
130
+ annualRevenue: revenue !== null && revenue > 0 || revenueDisplay ? {
131
+ amount: revenue !== null && revenue > 0 ? revenue : null,
132
+ display: revenueDisplay,
133
+ currency: null,
134
+ basis: "provider_estimate",
135
+ provider: "apollo",
136
+ observedAt: new Date().toISOString()
137
+ } : null,
120
138
  description: str(org.short_description),
121
139
  domain: str(org.primary_domain),
122
140
  employeeCount: num(org.estimated_num_employees),
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "author": "Alex Kahn",
3
3
  "description": "Apollo.io EngagementSource adapter for @absolutejs/engagement — person/company enrichment and outreach activity (emails sent/opened/replied) from the Apollo API.",
4
4
  "devDependencies": {
5
- "@absolutejs/engagement": "0.0.7",
5
+ "@absolutejs/engagement": "0.0.9",
6
6
  "@types/bun": "1.3.14",
7
7
  "prettier": "3.8.1",
8
8
  "typescript": "5.9.3"
@@ -23,7 +23,7 @@
23
23
  "main": "./dist/index.js",
24
24
  "name": "@absolutejs/engagement-apollo",
25
25
  "peerDependencies": {
26
- "@absolutejs/engagement": ">=0.0.7 <0.1"
26
+ "@absolutejs/engagement": ">=0.0.9 <0.1"
27
27
  },
28
28
  "publishConfig": {
29
29
  "access": "public"
@@ -40,11 +40,11 @@
40
40
  "test": "bun test",
41
41
  "typecheck": "tsc --noEmit",
42
42
  "verify-package": "absolute-manifest verify-package",
43
- "check:package": "bun run format && bun run typecheck && bun run test && bun run verify-package && bun run build && bun run verify-package --artifacts"
43
+ "check:package": "bun run format && bun run typecheck && bun run test && bun run verify-package && bun run build"
44
44
  },
45
45
  "type": "module",
46
46
  "types": "./dist/index.d.ts",
47
- "version": "0.0.7",
47
+ "version": "0.0.9",
48
48
  "exports": {
49
49
  ".": {
50
50
  "types": "./dist/index.d.ts",
@@ -59,24 +59,10 @@
59
59
  "./manifest.json": "./dist/manifest.json"
60
60
  },
61
61
  "absolutejs": {
62
- "manifestContract": 2,
63
- "runtimePeers": {
64
- "@absolutejs/engagement": {
65
- "artifactImports": [
66
- "@absolutejs/engagement"
67
- ],
68
- "buildExternals": [
69
- "@absolutejs/engagement",
70
- "@absolutejs/engagement/*"
71
- ],
72
- "optional": false,
73
- "range": ">=0.0.7 <0.1",
74
- "tested": "0.0.7"
75
- }
76
- }
62
+ "manifestContract": 2
77
63
  },
78
64
  "dependencies": {
79
- "@absolutejs/manifest": "0.7.2",
65
+ "@absolutejs/manifest": "0.9.0",
80
66
  "@sinclair/typebox": "0.34.52"
81
67
  }
82
68
  }