outbound-sdk 0.0.0-stage → 0.1.0
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/LICENSE +21 -0
- package/README.md +121 -2
- package/dist/alerts/index.d.ts +2 -0
- package/dist/alerts/index.js +136 -0
- package/dist/alerts/plugin.d.ts +58 -0
- package/dist/audit/index.d.ts +33 -0
- package/dist/audit/index.js +60 -0
- package/dist/benchmarks/index.d.ts +29 -0
- package/dist/benchmarks/index.js +70 -0
- package/dist/budget/index.d.ts +21 -0
- package/dist/budget/index.js +50 -0
- package/dist/cache/index.d.ts +31 -0
- package/dist/cache/index.js +11 -0
- package/dist/cards/content.d.ts +43 -0
- package/dist/cards/copy-cards.d.ts +2 -0
- package/dist/cards/format.d.ts +39 -0
- package/dist/cards/index.d.ts +9 -0
- package/dist/cards/index.js +2070 -0
- package/dist/cards/notify-cards.d.ts +14 -0
- package/dist/cards/ops-cards.d.ts +2 -0
- package/dist/cards/parts.d.ts +22 -0
- package/dist/cards/people-cards.d.ts +2 -0
- package/dist/cards/render.d.ts +28 -0
- package/dist/cards/sender-cards.d.ts +2 -0
- package/dist/cards/slack-rich.d.ts +19 -0
- package/dist/cards/slack-text.d.ts +10 -0
- package/dist/cards/slack.d.ts +21 -0
- package/dist/cards/spec.d.ts +86 -0
- package/dist/cards/tool-cards.d.ts +4 -0
- package/dist/chunks/chunk-4O2HRTTI.js +75 -0
- package/dist/chunks/chunk-7BCYLIDG.js +483 -0
- package/dist/chunks/chunk-B7V6EOAC.js +2273 -0
- package/dist/chunks/chunk-CMQ5ZHLZ.js +25 -0
- package/dist/chunks/chunk-F7MKFVIG.js +43 -0
- package/dist/chunks/chunk-FZF6CLPX.js +232 -0
- package/dist/chunks/chunk-GPEJG34O.js +53 -0
- package/dist/chunks/chunk-HEC7XFFH.js +65 -0
- package/dist/chunks/chunk-IBC52BX3.js +24 -0
- package/dist/chunks/chunk-LNCOGBMI.js +144 -0
- package/dist/chunks/chunk-LOXBLQ3I.js +180 -0
- package/dist/chunks/chunk-NAWZ73QS.js +22 -0
- package/dist/chunks/chunk-OCV66TS2.js +705 -0
- package/dist/chunks/chunk-Q465X22Y.js +548 -0
- package/dist/chunks/chunk-QTB747K4.js +100 -0
- package/dist/chunks/chunk-QZNNCXXD.js +92 -0
- package/dist/chunks/chunk-R6AM4GJR.js +105 -0
- package/dist/chunks/chunk-TIJKJJDW.js +6 -0
- package/dist/chunks/chunk-VURTOVGI.js +61 -0
- package/dist/chunks/chunk-WAM6N4OF.js +269 -0
- package/dist/chunks/chunk-WW746NJF.js +94 -0
- package/dist/chunks/chunk-XC6CZP73.js +80 -0
- package/dist/chunks/chunk-ZGHQYZEH.js +45 -0
- package/dist/cli/bin.d.ts +2 -0
- package/dist/cli/bin.js +34 -0
- package/dist/cli/commands.d.ts +16 -0
- package/dist/cli/index.d.ts +13 -0
- package/dist/cli/index.js +25 -0
- package/dist/cli/mcp.d.ts +14 -0
- package/dist/clients/index.d.ts +2 -0
- package/dist/clients/index.js +107 -0
- package/dist/clients/plugin.d.ts +42 -0
- package/dist/combine/account.d.ts +4 -0
- package/dist/combine/adapter.d.ts +9 -0
- package/dist/combine/index.d.ts +2 -0
- package/dist/combine/index.js +345 -0
- package/dist/combine/route.d.ts +17 -0
- package/dist/exporter/index.d.ts +29 -0
- package/dist/exporter/index.js +77 -0
- package/dist/failover/index.d.ts +11 -0
- package/dist/failover/index.js +45 -0
- package/dist/fixtures/index.d.ts +27 -0
- package/dist/fixtures/index.js +241 -0
- package/dist/fixtures/scrub.d.ts +5 -0
- package/dist/heyreach/account.d.ts +11 -0
- package/dist/heyreach/adapter.d.ts +5 -0
- package/dist/heyreach/capabilities.d.ts +68 -0
- package/dist/heyreach/client.d.ts +20 -0
- package/dist/heyreach/inbox.d.ts +7 -0
- package/dist/heyreach/index.d.ts +18 -0
- package/dist/heyreach/index.js +1708 -0
- package/dist/heyreach/lookup.d.ts +15 -0
- package/dist/heyreach/map-account.d.ts +25 -0
- package/dist/heyreach/map-sequence.d.ts +5 -0
- package/dist/heyreach/map-stats.d.ts +10 -0
- package/dist/heyreach/map.d.ts +35 -0
- package/dist/heyreach/native-organization.d.ts +128 -0
- package/dist/heyreach/native-voice.d.ts +106 -0
- package/dist/heyreach/native.d.ts +496 -0
- package/dist/heyreach/paging.d.ts +7 -0
- package/dist/heyreach/webhooks.d.ts +2 -0
- package/dist/identity/index.d.ts +3 -0
- package/dist/identity/index.js +148 -0
- package/dist/identity/keys.d.ts +9 -0
- package/dist/identity/plugin.d.ts +34 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.js +119 -0
- package/dist/insights/copy/copy-audit.d.ts +55 -0
- package/dist/insights/copy/copy-checks.d.ts +44 -0
- package/dist/insights/copy/copy-reuse.d.ts +59 -0
- package/dist/insights/copy/index.d.ts +67 -0
- package/dist/insights/copy/reply-timing.d.ts +63 -0
- package/dist/insights/copy/shared.d.ts +53 -0
- package/dist/insights/copy/step-funnel.d.ts +66 -0
- package/dist/insights/copy/variant-test.d.ts +64 -0
- package/dist/insights/define.d.ts +98 -0
- package/dist/insights/index.d.ts +10 -0
- package/dist/insights/index.js +4873 -0
- package/dist/insights/ops/anomalies.d.ts +80 -0
- package/dist/insights/ops/campaign-diagnosis.d.ts +39 -0
- package/dist/insights/ops/campaign-ranking.d.ts +56 -0
- package/dist/insights/ops/channel-mix.d.ts +44 -0
- package/dist/insights/ops/client-report.d.ts +76 -0
- package/dist/insights/ops/diagnosis-checks.d.ts +48 -0
- package/dist/insights/ops/index.d.ts +135 -0
- package/dist/insights/ops/period-comparison.d.ts +86 -0
- package/dist/insights/ops/pipeline-forecast.d.ts +44 -0
- package/dist/insights/ops/shared.d.ts +149 -0
- package/dist/insights/ops/tag-rollup.d.ts +32 -0
- package/dist/insights/people/account-summary.d.ts +68 -0
- package/dist/insights/people/dropped-replies.d.ts +51 -0
- package/dist/insights/people/find.d.ts +18 -0
- package/dist/insights/people/hot-leads.d.ts +67 -0
- package/dist/insights/people/index.d.ts +88 -0
- package/dist/insights/people/lead-collisions.d.ts +43 -0
- package/dist/insights/people/person-summary.d.ts +46 -0
- package/dist/insights/people/personalization-gaps.d.ts +60 -0
- package/dist/insights/people/read.d.ts +40 -0
- package/dist/insights/people/suppression-check.d.ts +53 -0
- package/dist/insights/plugin.d.ts +40 -0
- package/dist/insights/registry.d.ts +335 -0
- package/dist/insights/senders/bounce-watch.d.ts +70 -0
- package/dist/insights/senders/domain-health.d.ts +69 -0
- package/dist/insights/senders/index.d.ts +74 -0
- package/dist/insights/senders/read.d.ts +37 -0
- package/dist/insights/senders/sender-capacity.d.ts +67 -0
- package/dist/insights/senders/sender-load.d.ts +52 -0
- package/dist/insights/senders/settings-audit.d.ts +48 -0
- package/dist/insights/senders/warmup-readiness.d.ts +39 -0
- package/dist/insights/stats.d.ts +45 -0
- package/dist/insights/tools.d.ts +16 -0
- package/dist/insights/types.d.ts +4 -0
- package/dist/instantly/adapter-account.d.ts +5 -0
- package/dist/instantly/adapter-mail.d.ts +3 -0
- package/dist/instantly/adapter.d.ts +7 -0
- package/dist/instantly/capabilities.d.ts +83 -0
- package/dist/instantly/client.d.ts +29 -0
- package/dist/instantly/index.d.ts +20 -0
- package/dist/instantly/index.js +2372 -0
- package/dist/instantly/map-account.d.ts +23 -0
- package/dist/instantly/map-lead.d.ts +18 -0
- package/dist/instantly/map-stats.d.ts +22 -0
- package/dist/instantly/map.d.ts +24 -0
- package/dist/instantly/native-agents-sales.d.ts +161 -0
- package/dist/instantly/native-agents.d.ts +156 -0
- package/dist/instantly/native-campaigns.d.ts +101 -0
- package/dist/instantly/native-leads.d.ts +93 -0
- package/dist/instantly/native-params.d.ts +24 -0
- package/dist/instantly/native-search.d.ts +82 -0
- package/dist/instantly/native-senders.d.ts +182 -0
- package/dist/instantly/native-supersearch.d.ts +149 -0
- package/dist/instantly/native-workspace.d.ts +170 -0
- package/dist/instantly/native.d.ts +1081 -0
- package/dist/instantly/pages.d.ts +29 -0
- package/dist/instantly/stats.d.ts +5 -0
- package/dist/instantly/webhooks.d.ts +2 -0
- package/dist/internal/adapter.d.ts +189 -0
- package/dist/internal/capabilities.d.ts +86 -0
- package/dist/internal/cursor.d.ts +10 -0
- package/dist/internal/engine/budget.d.ts +44 -0
- package/dist/internal/engine/engine.d.ts +45 -0
- package/dist/internal/engine/rate-store.d.ts +25 -0
- package/dist/internal/engine/request.d.ts +27 -0
- package/dist/internal/engine/retry.d.ts +21 -0
- package/dist/internal/engine/runtime.d.ts +13 -0
- package/dist/internal/entities-account.d.ts +135 -0
- package/dist/internal/entities.d.ts +389 -0
- package/dist/internal/env.d.ts +4 -0
- package/dist/internal/errors.d.ts +57 -0
- package/dist/internal/hooks.d.ts +55 -0
- package/dist/internal/json.d.ts +40 -0
- package/dist/internal/limits.d.ts +34 -0
- package/dist/internal/metrics.d.ts +52 -0
- package/dist/internal/native.d.ts +66 -0
- package/dist/internal/outbound/api.d.ts +267 -0
- package/dist/internal/outbound/collections.d.ts +31 -0
- package/dist/internal/outbound/core.d.ts +36 -0
- package/dist/internal/outbound/create.d.ts +16 -0
- package/dist/internal/outbound/handles.d.ts +7 -0
- package/dist/internal/outbound/native.d.ts +4 -0
- package/dist/internal/outbound/operation-shared.d.ts +28 -0
- package/dist/internal/outbound/operations-account.d.ts +29 -0
- package/dist/internal/outbound/operations.d.ts +42 -0
- package/dist/internal/outbound/outbound.d.ts +64 -0
- package/dist/internal/outbound/plugins.d.ts +40 -0
- package/dist/internal/outbound/raw.d.ts +9 -0
- package/dist/internal/outbound/specs-account.d.ts +16 -0
- package/dist/internal/outbound/specs.d.ts +14 -0
- package/dist/internal/outbound/stats.d.ts +7 -0
- package/dist/internal/outbound/validate.d.ts +5 -0
- package/dist/internal/outbound/walker.d.ts +22 -0
- package/dist/internal/record.d.ts +19 -0
- package/dist/internal/redact.d.ts +18 -0
- package/dist/internal/ref.d.ts +16 -0
- package/dist/internal/sha256.d.ts +4 -0
- package/dist/internal/text.d.ts +11 -0
- package/dist/internal/url.d.ts +9 -0
- package/dist/loader/index.d.ts +12 -0
- package/dist/loader/index.js +12 -0
- package/dist/memory/account-reads.d.ts +5 -0
- package/dist/memory/account.d.ts +67 -0
- package/dist/memory/adapter.d.ts +16 -0
- package/dist/memory/data.d.ts +122 -0
- package/dist/memory/demo.d.ts +7 -0
- package/dist/memory/index.d.ts +5 -0
- package/dist/memory/index.js +792 -0
- package/dist/memory/stats.d.ts +6 -0
- package/dist/memory/store.d.ts +18 -0
- package/dist/providers/index.d.ts +22 -0
- package/dist/providers/index.js +10 -0
- package/dist/reconcile/index.d.ts +2 -0
- package/dist/reconcile/index.js +72 -0
- package/dist/reconcile/plugin.d.ts +55 -0
- package/dist/redact/index.d.ts +2 -0
- package/dist/redact/index.js +192 -0
- package/dist/redact/plugin.d.ts +22 -0
- package/dist/redis/index.d.ts +41 -0
- package/dist/redis/index.js +114 -0
- package/dist/smartlead/account.d.ts +5 -0
- package/dist/smartlead/adapter.d.ts +5 -0
- package/dist/smartlead/capabilities.d.ts +85 -0
- package/dist/smartlead/client.d.ts +23 -0
- package/dist/smartlead/hmac.d.ts +9 -0
- package/dist/smartlead/index.d.ts +17 -0
- package/dist/smartlead/index.js +2170 -0
- package/dist/smartlead/leads.d.ts +6 -0
- package/dist/smartlead/lookup.d.ts +8 -0
- package/dist/smartlead/mail.d.ts +5 -0
- package/dist/smartlead/map-account.d.ts +22 -0
- package/dist/smartlead/map-messages.d.ts +31 -0
- package/dist/smartlead/map-stats.d.ts +37 -0
- package/dist/smartlead/map.d.ts +52 -0
- package/dist/smartlead/native-analytics.d.ts +242 -0
- package/dist/smartlead/native-campaigns.d.ts +211 -0
- package/dist/smartlead/native-inbox.d.ts +141 -0
- package/dist/smartlead/native-params.d.ts +33 -0
- package/dist/smartlead/native-services.d.ts +204 -0
- package/dist/smartlead/native.d.ts +785 -0
- package/dist/smartlead/shared.d.ts +28 -0
- package/dist/smartlead/stats.d.ts +5 -0
- package/dist/smartlead/webhooks.d.ts +2 -0
- package/dist/sync/index.d.ts +2 -0
- package/dist/sync/index.js +158 -0
- package/dist/sync/plugin.d.ts +58 -0
- package/dist/tools/account-tools.d.ts +21 -0
- package/dist/tools/ai-sdk.d.ts +8 -0
- package/dist/tools/ai-sdk.js +26 -0
- package/dist/tools/campaign-tools.d.ts +59 -0
- package/dist/tools/claude-agent.d.ts +18 -0
- package/dist/tools/claude-agent.js +40 -0
- package/dist/tools/index.d.ts +28 -0
- package/dist/tools/index.js +20 -0
- package/dist/tools/people-tools.d.ts +19 -0
- package/dist/tools/registry.d.ts +34 -0
- package/dist/tools/shared.d.ts +75 -0
- package/dist/tracing/index.d.ts +25 -0
- package/dist/tracing/index.js +69 -0
- package/dist/webhooks/index.d.ts +3 -0
- package/dist/webhooks/index.js +226 -0
- package/dist/webhooks/parse.d.ts +41 -0
- package/dist/webhooks/secret.d.ts +4 -0
- package/package.json +181 -4
|
@@ -0,0 +1,496 @@
|
|
|
1
|
+
/** Every HeyReach read that has no normalized form. */
|
|
2
|
+
export declare const NATIVE: {
|
|
3
|
+
readonly elevenLabsConnection: {
|
|
4
|
+
readonly description: "The workspace's ElevenLabs connection: whether a key is connected, its status, the last four characters of the key, the last library sync and how many imported voices it offers. The key itself is never returned.";
|
|
5
|
+
readonly docs: "https://docs.heyreach.io/hey-reach-api/voice/get-eleven-labs-connection";
|
|
6
|
+
readonly method: "GET";
|
|
7
|
+
readonly path: "/voice/GetElevenLabsConnection";
|
|
8
|
+
};
|
|
9
|
+
readonly elevenLabsVoices: {
|
|
10
|
+
readonly description: "The ElevenLabs voices imported into the workspace, ordered by name, as the last library sync stored them.";
|
|
11
|
+
readonly docs: "https://docs.heyreach.io/hey-reach-api/voice/get-eleven-labs-voices";
|
|
12
|
+
readonly method: "GET";
|
|
13
|
+
readonly params: {
|
|
14
|
+
readonly limit: {
|
|
15
|
+
readonly description: "How many voices to return, 1 to 500. Defaults to 100.";
|
|
16
|
+
readonly in: "query";
|
|
17
|
+
readonly type: "number";
|
|
18
|
+
};
|
|
19
|
+
readonly offset: {
|
|
20
|
+
readonly description: "How many voices to skip. Defaults to 0.";
|
|
21
|
+
readonly in: "query";
|
|
22
|
+
readonly type: "number";
|
|
23
|
+
};
|
|
24
|
+
readonly search: {
|
|
25
|
+
readonly description: "Case-insensitive match on the voice name.";
|
|
26
|
+
readonly in: "query";
|
|
27
|
+
readonly type: "string";
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
readonly path: "/voice/GetElevenLabsVoices";
|
|
31
|
+
};
|
|
32
|
+
readonly senderVoice: {
|
|
33
|
+
readonly description: "The voice assigned to one LinkedIn account. Answers 404 SENDER_VOICE_NOT_ASSIGNED when the account has none.";
|
|
34
|
+
readonly docs: "https://docs.heyreach.io/hey-reach-api/voice/get-sender-voice";
|
|
35
|
+
readonly method: "GET";
|
|
36
|
+
readonly params: {
|
|
37
|
+
readonly accountId: {
|
|
38
|
+
readonly description: "The LinkedIn account's id.";
|
|
39
|
+
readonly in: "path";
|
|
40
|
+
readonly type: "number";
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
readonly path: "/voice/GetSenderVoice/{accountId}";
|
|
44
|
+
};
|
|
45
|
+
readonly staticClip: {
|
|
46
|
+
readonly description: "One uploaded voice clip: its duration, its transcript and why a transcript is absent. Metadata only; the audio is not returned.";
|
|
47
|
+
readonly docs: "https://docs.heyreach.io/hey-reach-api/voice/get-static-clip";
|
|
48
|
+
readonly method: "GET";
|
|
49
|
+
readonly params: {
|
|
50
|
+
readonly clipId: {
|
|
51
|
+
readonly description: "The clip's id, as staticClips lists it.";
|
|
52
|
+
readonly in: "path";
|
|
53
|
+
readonly type: "number";
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
readonly path: "/voice/GetStaticClip/{clipId}";
|
|
57
|
+
};
|
|
58
|
+
readonly staticClips: {
|
|
59
|
+
readonly description: "The workspace's uploaded voice clips, newest first, with duration and transcript. Metadata only.";
|
|
60
|
+
readonly docs: "https://docs.heyreach.io/hey-reach-api/voice/get-static-clips";
|
|
61
|
+
readonly method: "GET";
|
|
62
|
+
readonly params: {
|
|
63
|
+
readonly limit: {
|
|
64
|
+
readonly description: "How many clips to return, 1 to 100. Defaults to 50.";
|
|
65
|
+
readonly in: "query";
|
|
66
|
+
readonly type: "number";
|
|
67
|
+
};
|
|
68
|
+
readonly offset: {
|
|
69
|
+
readonly description: "How many clips to skip. Defaults to 0.";
|
|
70
|
+
readonly in: "query";
|
|
71
|
+
readonly type: "number";
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
readonly path: "/voice/GetStaticClips";
|
|
75
|
+
};
|
|
76
|
+
readonly voiceUsage: {
|
|
77
|
+
readonly description: "Where one voice is in use: the LinkedIn accounts it is assigned to and whether any of them is in a running campaign.";
|
|
78
|
+
readonly docs: "https://docs.heyreach.io/hey-reach-api/voice/get-voice-usage";
|
|
79
|
+
readonly method: "GET";
|
|
80
|
+
readonly params: {
|
|
81
|
+
readonly id: {
|
|
82
|
+
readonly description: "The voice's id, as voices lists it.";
|
|
83
|
+
readonly in: "path";
|
|
84
|
+
readonly type: "number";
|
|
85
|
+
};
|
|
86
|
+
readonly kind: {
|
|
87
|
+
readonly description: "PREDEFINED or CUSTOM. Defaults to CUSTOM.";
|
|
88
|
+
readonly in: "query";
|
|
89
|
+
readonly type: "string";
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
readonly path: "/voice/GetVoiceUsage/{id}";
|
|
93
|
+
};
|
|
94
|
+
readonly voices: {
|
|
95
|
+
readonly description: "The workspace's voice library: every predefined voice and the workspace's own cloned voices, each with the LinkedIn accounts it is assigned to.";
|
|
96
|
+
readonly docs: "https://docs.heyreach.io/hey-reach-api/voice/get-voices";
|
|
97
|
+
readonly method: "GET";
|
|
98
|
+
readonly params: {
|
|
99
|
+
readonly gender: {
|
|
100
|
+
readonly description: "Only voices of this gender: MALE or FEMALE.";
|
|
101
|
+
readonly in: "query";
|
|
102
|
+
readonly type: "string";
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
readonly path: "/voice/GetVoices";
|
|
106
|
+
};
|
|
107
|
+
readonly organizationLinkedInAccounts: {
|
|
108
|
+
readonly description: "LinkedIn accounts across every workspace of the organization, each with its workspace, connection state and count of active campaigns. Needs the organization API key.";
|
|
109
|
+
readonly docs: "https://docs.heyreach.io/hey-reach-api/organization/linked-in-accounts/get-linked-in-accounts";
|
|
110
|
+
readonly lane: "organization";
|
|
111
|
+
readonly method: "POST";
|
|
112
|
+
readonly params: {
|
|
113
|
+
readonly keyword: {
|
|
114
|
+
readonly description: "Search text.";
|
|
115
|
+
readonly in: "body";
|
|
116
|
+
readonly type: "string";
|
|
117
|
+
};
|
|
118
|
+
readonly limit: {
|
|
119
|
+
readonly description: "How many accounts to return.";
|
|
120
|
+
readonly in: "body";
|
|
121
|
+
readonly type: "number";
|
|
122
|
+
};
|
|
123
|
+
readonly offset: {
|
|
124
|
+
readonly description: "How many accounts to skip.";
|
|
125
|
+
readonly in: "body";
|
|
126
|
+
readonly type: "number";
|
|
127
|
+
};
|
|
128
|
+
readonly workspaceIds: {
|
|
129
|
+
readonly description: "Only accounts in these workspaces, as an array of ids. Empty or left out means every workspace.";
|
|
130
|
+
readonly in: "body";
|
|
131
|
+
readonly type: "json";
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
readonly path: "/management/organizations/linkedin-accounts";
|
|
135
|
+
};
|
|
136
|
+
readonly organizationUser: {
|
|
137
|
+
readonly description: "One user of the organization: name, email, roles and permissions. Needs the organization API key.";
|
|
138
|
+
readonly docs: "https://docs.heyreach.io/hey-reach-api/organization/workspace-users/get-user-by-id";
|
|
139
|
+
readonly lane: "organization";
|
|
140
|
+
readonly method: "GET";
|
|
141
|
+
readonly params: {
|
|
142
|
+
readonly userId: {
|
|
143
|
+
readonly description: "The user's id.";
|
|
144
|
+
readonly in: "path";
|
|
145
|
+
readonly type: "number";
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
readonly path: "/management/organizations/users/{userId}";
|
|
149
|
+
};
|
|
150
|
+
readonly organizationUsers: {
|
|
151
|
+
readonly description: "Every existing and invited user of the organization, with roles, invitation state and permissions per workspace. Needs the organization API key.";
|
|
152
|
+
readonly docs: "https://docs.heyreach.io/hey-reach-api/organization/workspace-users/get-all-users";
|
|
153
|
+
readonly lane: "organization";
|
|
154
|
+
readonly method: "POST";
|
|
155
|
+
readonly params: {
|
|
156
|
+
readonly invitationStatus: {
|
|
157
|
+
readonly description: "Only users whose invitation has one of these statuses, as an array of names.";
|
|
158
|
+
readonly in: "body";
|
|
159
|
+
readonly type: "json";
|
|
160
|
+
};
|
|
161
|
+
readonly limit: {
|
|
162
|
+
readonly description: "How many users to return.";
|
|
163
|
+
readonly in: "body";
|
|
164
|
+
readonly type: "number";
|
|
165
|
+
};
|
|
166
|
+
readonly offset: {
|
|
167
|
+
readonly description: "How many users to skip.";
|
|
168
|
+
readonly in: "body";
|
|
169
|
+
readonly type: "number";
|
|
170
|
+
};
|
|
171
|
+
readonly role: {
|
|
172
|
+
readonly description: "Only users with this role.";
|
|
173
|
+
readonly in: "body";
|
|
174
|
+
readonly type: "string";
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
readonly path: "/management/organizations/users";
|
|
178
|
+
};
|
|
179
|
+
readonly organizationWorkspaces: {
|
|
180
|
+
readonly description: "The organization's workspaces, each with its name, seat limit and seats used. Needs the organization API key.";
|
|
181
|
+
readonly docs: "https://docs.heyreach.io/hey-reach-api/organization/workspaces/get-all-workspaces";
|
|
182
|
+
readonly lane: "organization";
|
|
183
|
+
readonly method: "GET";
|
|
184
|
+
readonly params: {
|
|
185
|
+
readonly Limit: {
|
|
186
|
+
readonly description: "How many workspaces to return.";
|
|
187
|
+
readonly in: "query";
|
|
188
|
+
readonly type: "number";
|
|
189
|
+
};
|
|
190
|
+
readonly Offset: {
|
|
191
|
+
readonly description: "How many workspaces to skip.";
|
|
192
|
+
readonly in: "query";
|
|
193
|
+
readonly type: "number";
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
readonly path: "/management/organizations/workspaces";
|
|
197
|
+
};
|
|
198
|
+
readonly workspaceUsers: {
|
|
199
|
+
readonly description: "The users of one workspace, with their role and permissions. Needs the organization API key.";
|
|
200
|
+
readonly docs: "https://docs.heyreach.io/hey-reach-api/organization/workspace-users/get-workspace-users";
|
|
201
|
+
readonly lane: "organization";
|
|
202
|
+
readonly method: "POST";
|
|
203
|
+
readonly params: {
|
|
204
|
+
readonly workspaceId: {
|
|
205
|
+
readonly description: "The workspace's id.";
|
|
206
|
+
readonly in: "path";
|
|
207
|
+
readonly type: "number";
|
|
208
|
+
};
|
|
209
|
+
readonly invitationStatus: {
|
|
210
|
+
readonly description: "Only users whose invitation has one of these statuses, as an array of names.";
|
|
211
|
+
readonly in: "body";
|
|
212
|
+
readonly type: "json";
|
|
213
|
+
};
|
|
214
|
+
readonly limit: {
|
|
215
|
+
readonly description: "How many users to return.";
|
|
216
|
+
readonly in: "body";
|
|
217
|
+
readonly type: "number";
|
|
218
|
+
};
|
|
219
|
+
readonly offset: {
|
|
220
|
+
readonly description: "How many users to skip.";
|
|
221
|
+
readonly in: "body";
|
|
222
|
+
readonly type: "number";
|
|
223
|
+
};
|
|
224
|
+
readonly role: {
|
|
225
|
+
readonly description: "Only users with this role.";
|
|
226
|
+
readonly in: "body";
|
|
227
|
+
readonly type: "string";
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
readonly path: "/management/organizations/users/workspaces/{workspaceId}";
|
|
231
|
+
};
|
|
232
|
+
readonly campaignSequenceV2: {
|
|
233
|
+
readonly description: "A campaign's sequence tree with every message version in full, voice versions included, each with the length and transcript of its recording. Empty when the campaign has no sequence.";
|
|
234
|
+
readonly docs: "https://docs.heyreach.io/hey-reach-api/campaigns/get-campaign-sequence-v-2";
|
|
235
|
+
readonly method: "GET";
|
|
236
|
+
readonly params: {
|
|
237
|
+
readonly campaignId: {
|
|
238
|
+
readonly description: "The campaign's id.";
|
|
239
|
+
readonly in: "query";
|
|
240
|
+
readonly required: true;
|
|
241
|
+
readonly type: "number";
|
|
242
|
+
};
|
|
243
|
+
};
|
|
244
|
+
readonly path: "/campaign/GetCampaignSequenceV2";
|
|
245
|
+
};
|
|
246
|
+
readonly campaignsForLead: {
|
|
247
|
+
readonly description: "The campaigns one lead is in, each with the campaign's status and the lead's status in it. Name the lead by email, LinkedIn id or profile URL.";
|
|
248
|
+
readonly docs: "https://docs.heyreach.io/hey-reach-api/campaigns/get-campaigns-for-lead";
|
|
249
|
+
readonly method: "POST";
|
|
250
|
+
readonly params: {
|
|
251
|
+
readonly limit: {
|
|
252
|
+
readonly description: `How many ${string} to return${string}.`;
|
|
253
|
+
readonly in: "body";
|
|
254
|
+
readonly type: "number";
|
|
255
|
+
};
|
|
256
|
+
readonly offset: {
|
|
257
|
+
readonly description: `How many ${string} to skip.`;
|
|
258
|
+
readonly in: "body";
|
|
259
|
+
readonly type: "number";
|
|
260
|
+
};
|
|
261
|
+
readonly email: {
|
|
262
|
+
readonly description: "The lead's email address.";
|
|
263
|
+
readonly in: "body";
|
|
264
|
+
readonly type: "string";
|
|
265
|
+
};
|
|
266
|
+
readonly linkedinId: {
|
|
267
|
+
readonly description: "The lead's LinkedIn id, `linkedin_id` in lead payloads.";
|
|
268
|
+
readonly in: "body";
|
|
269
|
+
readonly type: "string";
|
|
270
|
+
};
|
|
271
|
+
readonly profileUrl: {
|
|
272
|
+
readonly description: "The lead's LinkedIn profile URL.";
|
|
273
|
+
readonly in: "body";
|
|
274
|
+
readonly type: "string";
|
|
275
|
+
};
|
|
276
|
+
};
|
|
277
|
+
readonly path: "/campaign/GetCampaignsForLead";
|
|
278
|
+
};
|
|
279
|
+
readonly checkApiKey: {
|
|
280
|
+
readonly description: "Whether the API key works. Answers 200 with an empty body, and nothing about who the key belongs to.";
|
|
281
|
+
readonly docs: "https://docs.heyreach.io/hey-reach-api/authentication/check-api-key";
|
|
282
|
+
readonly method: "GET";
|
|
283
|
+
readonly path: "/auth/CheckApiKey";
|
|
284
|
+
};
|
|
285
|
+
readonly companiesFromList: {
|
|
286
|
+
readonly description: "The companies in one company list: name, industry, size, location and website.";
|
|
287
|
+
readonly docs: "https://docs.heyreach.io/hey-reach-api/lists/get-companies-from-list";
|
|
288
|
+
readonly method: "POST";
|
|
289
|
+
readonly params: {
|
|
290
|
+
readonly keyword: {
|
|
291
|
+
readonly description: "Search text.";
|
|
292
|
+
readonly in: "body";
|
|
293
|
+
readonly type: "string";
|
|
294
|
+
};
|
|
295
|
+
readonly listId: {
|
|
296
|
+
readonly description: "The company list's id.";
|
|
297
|
+
readonly in: "body";
|
|
298
|
+
readonly required: true;
|
|
299
|
+
readonly type: "number";
|
|
300
|
+
};
|
|
301
|
+
readonly limit: {
|
|
302
|
+
readonly description: `How many ${string} to return${string}.`;
|
|
303
|
+
readonly in: "body";
|
|
304
|
+
readonly type: "number";
|
|
305
|
+
};
|
|
306
|
+
readonly offset: {
|
|
307
|
+
readonly description: `How many ${string} to skip.`;
|
|
308
|
+
readonly in: "body";
|
|
309
|
+
readonly type: "number";
|
|
310
|
+
};
|
|
311
|
+
};
|
|
312
|
+
readonly path: "/list/GetCompaniesFromList";
|
|
313
|
+
};
|
|
314
|
+
readonly conversationsV2: {
|
|
315
|
+
readonly description: "Conversations with their messages, paged by offset. Unlike the newer listing the normalized reads use, each lead profile here carries its custom fields. Deep pages are refused on a large inbox.";
|
|
316
|
+
readonly docs: "https://docs.heyreach.io/hey-reach-api/inbox/get-conversations-v-2";
|
|
317
|
+
readonly method: "POST";
|
|
318
|
+
readonly params: {
|
|
319
|
+
readonly filters: {
|
|
320
|
+
readonly description: "An object of filters: linkedInAccountIds, campaignIds, searchString, leadLinkedInId, leadProfileUrl, tags, seen.";
|
|
321
|
+
readonly in: "body";
|
|
322
|
+
readonly type: "json";
|
|
323
|
+
};
|
|
324
|
+
readonly limit: {
|
|
325
|
+
readonly description: `How many ${string} to return${string}.`;
|
|
326
|
+
readonly in: "body";
|
|
327
|
+
readonly type: "number";
|
|
328
|
+
};
|
|
329
|
+
readonly offset: {
|
|
330
|
+
readonly description: `How many ${string} to skip.`;
|
|
331
|
+
readonly in: "body";
|
|
332
|
+
readonly type: "number";
|
|
333
|
+
};
|
|
334
|
+
};
|
|
335
|
+
readonly path: "/inbox/GetConversationsV2";
|
|
336
|
+
};
|
|
337
|
+
readonly enrichEmailJob: {
|
|
338
|
+
readonly description: "The state of one email-enrichment job, and the email found once it has completed. The job itself is started in HeyReach.";
|
|
339
|
+
readonly docs: "https://docs.heyreach.io/hey-reach-api/enrichment/check-enrich-email-job";
|
|
340
|
+
readonly method: "GET";
|
|
341
|
+
readonly params: {
|
|
342
|
+
readonly jobId: {
|
|
343
|
+
readonly description: "The job's id.";
|
|
344
|
+
readonly in: "path";
|
|
345
|
+
readonly type: "number";
|
|
346
|
+
};
|
|
347
|
+
};
|
|
348
|
+
readonly path: "/enrichment/enrich-email/check-job/{jobId}";
|
|
349
|
+
};
|
|
350
|
+
readonly isConnection: {
|
|
351
|
+
readonly description: "Whether a lead is a LinkedIn connection of one sender. Name the lead by profile URL or LinkedIn id, never both.";
|
|
352
|
+
readonly docs: "https://docs.heyreach.io/hey-reach-api/my-network/is-connection";
|
|
353
|
+
readonly method: "POST";
|
|
354
|
+
readonly params: {
|
|
355
|
+
readonly leadLinkedInId: {
|
|
356
|
+
readonly description: "The lead's LinkedIn id.";
|
|
357
|
+
readonly in: "body";
|
|
358
|
+
readonly type: "string";
|
|
359
|
+
};
|
|
360
|
+
readonly leadProfileUrl: {
|
|
361
|
+
readonly description: "The lead's LinkedIn profile URL.";
|
|
362
|
+
readonly in: "body";
|
|
363
|
+
readonly type: "string";
|
|
364
|
+
};
|
|
365
|
+
readonly senderAccountId: {
|
|
366
|
+
readonly description: "The LinkedIn account's id.";
|
|
367
|
+
readonly in: "body";
|
|
368
|
+
readonly required: true;
|
|
369
|
+
readonly type: "number";
|
|
370
|
+
};
|
|
371
|
+
};
|
|
372
|
+
readonly path: "/MyNetwork/IsConnection";
|
|
373
|
+
};
|
|
374
|
+
readonly listById: {
|
|
375
|
+
readonly description: "One lead or company list: name, type, item count, creation time and the campaigns that use it.";
|
|
376
|
+
readonly docs: "https://docs.heyreach.io/hey-reach-api/lists/get-by-id";
|
|
377
|
+
readonly method: "GET";
|
|
378
|
+
readonly params: {
|
|
379
|
+
readonly listId: {
|
|
380
|
+
readonly description: "The list's id.";
|
|
381
|
+
readonly in: "query";
|
|
382
|
+
readonly required: true;
|
|
383
|
+
readonly type: "number";
|
|
384
|
+
};
|
|
385
|
+
};
|
|
386
|
+
readonly path: "/list/GetById";
|
|
387
|
+
};
|
|
388
|
+
readonly listsForLead: {
|
|
389
|
+
readonly description: "The lead lists one lead is in. Name the lead by email, LinkedIn id or profile URL. Answers 404 when the lead is in none.";
|
|
390
|
+
readonly docs: "https://docs.heyreach.io/hey-reach-api/lists/get-lists-for-lead";
|
|
391
|
+
readonly method: "POST";
|
|
392
|
+
readonly params: {
|
|
393
|
+
readonly limit: {
|
|
394
|
+
readonly description: `How many ${string} to return${string}.`;
|
|
395
|
+
readonly in: "body";
|
|
396
|
+
readonly type: "number";
|
|
397
|
+
};
|
|
398
|
+
readonly offset: {
|
|
399
|
+
readonly description: `How many ${string} to skip.`;
|
|
400
|
+
readonly in: "body";
|
|
401
|
+
readonly type: "number";
|
|
402
|
+
};
|
|
403
|
+
readonly email: {
|
|
404
|
+
readonly description: "The lead's email address.";
|
|
405
|
+
readonly in: "body";
|
|
406
|
+
readonly type: "string";
|
|
407
|
+
};
|
|
408
|
+
readonly linkedinId: {
|
|
409
|
+
readonly description: "The lead's LinkedIn id, `linkedin_id` in lead payloads.";
|
|
410
|
+
readonly in: "body";
|
|
411
|
+
readonly type: "string";
|
|
412
|
+
};
|
|
413
|
+
readonly profileUrl: {
|
|
414
|
+
readonly description: "The lead's LinkedIn profile URL.";
|
|
415
|
+
readonly in: "body";
|
|
416
|
+
readonly type: "string";
|
|
417
|
+
};
|
|
418
|
+
};
|
|
419
|
+
readonly path: "/list/GetListsForLead";
|
|
420
|
+
};
|
|
421
|
+
readonly myNetworkForSender: {
|
|
422
|
+
readonly description: "The LinkedIn connections of one sender, as lead profiles. Pages by pageNumber and pageSize.";
|
|
423
|
+
readonly docs: "https://docs.heyreach.io/hey-reach-api/my-network/get-my-network-for-sender";
|
|
424
|
+
readonly method: "POST";
|
|
425
|
+
readonly params: {
|
|
426
|
+
readonly pageNumber: {
|
|
427
|
+
readonly description: "The page to read, starting at 0.";
|
|
428
|
+
readonly in: "body";
|
|
429
|
+
readonly type: "number";
|
|
430
|
+
};
|
|
431
|
+
readonly pageSize: {
|
|
432
|
+
readonly description: "How many connections a page holds. The documented example uses 100.";
|
|
433
|
+
readonly in: "body";
|
|
434
|
+
readonly type: "number";
|
|
435
|
+
};
|
|
436
|
+
readonly senderId: {
|
|
437
|
+
readonly description: "The LinkedIn account's id.";
|
|
438
|
+
readonly in: "body";
|
|
439
|
+
readonly required: true;
|
|
440
|
+
readonly type: "number";
|
|
441
|
+
};
|
|
442
|
+
};
|
|
443
|
+
readonly path: "/MyNetwork/GetMyNetworkForSender";
|
|
444
|
+
};
|
|
445
|
+
readonly proxyCountries: {
|
|
446
|
+
readonly description: "The proxy countries a LinkedIn account can be connected through.";
|
|
447
|
+
readonly docs: "https://docs.heyreach.io/hey-reach-api/linked-in-accounts/get-proxy-countries";
|
|
448
|
+
readonly method: "GET";
|
|
449
|
+
readonly path: "/li_account/GetProxyCountries";
|
|
450
|
+
};
|
|
451
|
+
readonly statsByCampaign: {
|
|
452
|
+
readonly description: "The workspace's stats broken down per campaign: one row of counts for each campaign, in total and for each day, deleted campaigns included.";
|
|
453
|
+
readonly docs: "https://docs.heyreach.io/hey-reach-api/analytics/get-overall-stats-by-campaign";
|
|
454
|
+
readonly method: "POST";
|
|
455
|
+
readonly params: {
|
|
456
|
+
readonly accountIds: {
|
|
457
|
+
readonly description: "Only these LinkedIn accounts, as an array of ids. Empty means every account.";
|
|
458
|
+
readonly in: "body";
|
|
459
|
+
readonly required: true;
|
|
460
|
+
readonly type: "json";
|
|
461
|
+
};
|
|
462
|
+
readonly campaignIds: {
|
|
463
|
+
readonly description: "Only these campaigns, as an array of ids. Empty means every campaign.";
|
|
464
|
+
readonly in: "body";
|
|
465
|
+
readonly required: true;
|
|
466
|
+
readonly type: "json";
|
|
467
|
+
};
|
|
468
|
+
readonly endDate: {
|
|
469
|
+
readonly description: "The end of the range, as an ISO 8601 time.";
|
|
470
|
+
readonly in: "body";
|
|
471
|
+
readonly type: "string";
|
|
472
|
+
};
|
|
473
|
+
readonly startDate: {
|
|
474
|
+
readonly description: "The start of the range, as an ISO 8601 time.";
|
|
475
|
+
readonly in: "body";
|
|
476
|
+
readonly type: "string";
|
|
477
|
+
};
|
|
478
|
+
};
|
|
479
|
+
readonly path: "/stats/GetOverallStatsByCampaign";
|
|
480
|
+
};
|
|
481
|
+
readonly webhookById: {
|
|
482
|
+
readonly description: "One webhook: name, URL, event type, campaigns and whether it is active. Its custom headers can hold a secret, so they are never requested.";
|
|
483
|
+
readonly docs: "https://docs.heyreach.io/hey-reach-api/webhooks/get-webhook-by-id";
|
|
484
|
+
readonly method: "GET";
|
|
485
|
+
readonly params: {
|
|
486
|
+
readonly webhookId: {
|
|
487
|
+
readonly description: "The webhook's id.";
|
|
488
|
+
readonly in: "query";
|
|
489
|
+
readonly required: true;
|
|
490
|
+
readonly type: "number";
|
|
491
|
+
};
|
|
492
|
+
};
|
|
493
|
+
readonly path: "/webhooks/GetWebhookById";
|
|
494
|
+
};
|
|
495
|
+
};
|
|
496
|
+
export type HeyReachNative = typeof NATIVE;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Json } from "../internal/json.ts";
|
|
2
|
+
import type { HeyReachClient } from "./client.ts";
|
|
3
|
+
/** The caller's page size, held to what the endpoint allows. */
|
|
4
|
+
export declare const pageSize: (limit: number | undefined, max?: number) => number;
|
|
5
|
+
/** Lists page by offset, and `next` is the offset of the next page. */
|
|
6
|
+
export declare const offsetOf: (next: Json | undefined) => number;
|
|
7
|
+
export declare const numericId: (client: HeyReachClient, id: string, what: string) => number;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import {
|
|
2
|
+
profileSlug
|
|
3
|
+
} from "../chunks/chunk-NAWZ73QS.js";
|
|
4
|
+
import {
|
|
5
|
+
OutboundError
|
|
6
|
+
} from "../chunks/chunk-LOXBLQ3I.js";
|
|
7
|
+
import "../chunks/chunk-QZNNCXXD.js";
|
|
8
|
+
|
|
9
|
+
// src/identity/keys.ts
|
|
10
|
+
var emailKey = (email) => {
|
|
11
|
+
const cleaned = email?.trim().toLowerCase() ?? "";
|
|
12
|
+
return cleaned.includes("@") ? `email:${cleaned}` : null;
|
|
13
|
+
};
|
|
14
|
+
var linkedinKey = (url) => {
|
|
15
|
+
const slug = profileSlug(url);
|
|
16
|
+
return slug === null ? null : `linkedin:${slug}`;
|
|
17
|
+
};
|
|
18
|
+
var keysOf = (record) => [emailKey(record.email), linkedinKey(record.linkedinUrl)].filter(
|
|
19
|
+
(key) => key !== null
|
|
20
|
+
);
|
|
21
|
+
var toKey = (identifier) => {
|
|
22
|
+
const value = identifier.trim();
|
|
23
|
+
const lower = value.toLowerCase();
|
|
24
|
+
if (lower.startsWith("email:") || lower.startsWith("linkedin:")) {
|
|
25
|
+
return lower;
|
|
26
|
+
}
|
|
27
|
+
return linkedinKey(value) ?? emailKey(value);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// src/identity/plugin.ts
|
|
31
|
+
var isLead = (record) => "custom" in record && "email" in record;
|
|
32
|
+
var withKeys = (record) => {
|
|
33
|
+
if (!isLead(record)) {
|
|
34
|
+
return record;
|
|
35
|
+
}
|
|
36
|
+
const personKeys = keysOf(record);
|
|
37
|
+
const tagged = {
|
|
38
|
+
...record,
|
|
39
|
+
personKey: personKeys[0] ?? null,
|
|
40
|
+
personKeys
|
|
41
|
+
};
|
|
42
|
+
return tagged;
|
|
43
|
+
};
|
|
44
|
+
var scanLeads = async function* scanLeads2(outbound, options) {
|
|
45
|
+
if (options.campaignIds === void 0 && outbound.capabilities["leads.list"]) {
|
|
46
|
+
yield* outbound.leads.listAll();
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const campaigns = options.campaignIds === void 0 ? await outbound.campaigns.listAll().toArray() : [];
|
|
50
|
+
const campaignIds = options.campaignIds ?? campaigns.map((campaign) => campaign.ref);
|
|
51
|
+
for (const campaignId of campaignIds) {
|
|
52
|
+
yield* outbound.campaign(campaignId).leads.listAll();
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
var collect = async (outbound, options, keys, found) => {
|
|
56
|
+
let grew = false;
|
|
57
|
+
for await (const lead of scanLeads(outbound, options)) {
|
|
58
|
+
const leadKeys = keysOf(lead);
|
|
59
|
+
if (!found.has(lead.ref) && leadKeys.some((key) => keys.has(key))) {
|
|
60
|
+
found.set(lead.ref, lead);
|
|
61
|
+
for (const key of leadKeys) {
|
|
62
|
+
grew ||= !keys.has(key);
|
|
63
|
+
keys.add(key);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return grew;
|
|
68
|
+
};
|
|
69
|
+
var filterFor = (key) => key.startsWith("email:") ? { email: key.slice("email:".length) } : {
|
|
70
|
+
linkedinUrl: `https://www.linkedin.com/in/${key.slice("linkedin:".length)}`
|
|
71
|
+
};
|
|
72
|
+
var find = async (outbound, keys, found) => {
|
|
73
|
+
const asked = /* @__PURE__ */ new Set();
|
|
74
|
+
for (let next = [...keys].find((key) => !asked.has(key)); next !== void 0; next = [...keys].find((key) => !asked.has(key))) {
|
|
75
|
+
asked.add(next);
|
|
76
|
+
const leads = await outbound.leads.listAll(filterFor(next)).toArray();
|
|
77
|
+
for (const lead of leads) {
|
|
78
|
+
const leadKeys = keysOf(lead);
|
|
79
|
+
if (leadKeys.includes(next)) {
|
|
80
|
+
found.set(`${lead.ref} ${lead.campaignRef ?? ""}`, lead);
|
|
81
|
+
for (const key of leadKeys) {
|
|
82
|
+
keys.add(key);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
var isRedacted = (outbound) => "redacted" in outbound;
|
|
89
|
+
var IDENTIFIER_FIELDS = /* @__PURE__ */ new Set(["email", "linkedin"]);
|
|
90
|
+
var assertIdentifiersReadable = (outbound) => {
|
|
91
|
+
const masked = isRedacted(outbound) ? outbound.redacted.fields.filter((field) => IDENTIFIER_FIELDS.has(field)) : [];
|
|
92
|
+
if (masked.length > 0) {
|
|
93
|
+
throw new OutboundError(
|
|
94
|
+
"Unsupported",
|
|
95
|
+
`person() is not available: the redact plugin masks ${masked.join(" and ")}, so records cannot be linked by identifier. Use an instance without redact, or leave "email" and "linkedin" out of its fields`,
|
|
96
|
+
{ provider: outbound.provider }
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
var bySentAt = (left, right) => (left.sentAt ?? "").localeCompare(right.sentAt ?? "");
|
|
101
|
+
var lookup = async (outbound, identifier, options) => {
|
|
102
|
+
const key = toKey(identifier);
|
|
103
|
+
if (key === null) {
|
|
104
|
+
throw new OutboundError(
|
|
105
|
+
"Invalid",
|
|
106
|
+
"person() needs a person key, an email address or a LinkedIn profile URL"
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
assertIdentifiersReadable(outbound);
|
|
110
|
+
const keys = /* @__PURE__ */ new Set([key]);
|
|
111
|
+
const found = /* @__PURE__ */ new Map();
|
|
112
|
+
if (outbound.capabilities["leads.lookup"] && options.campaignIds === void 0) {
|
|
113
|
+
await find(outbound, keys, found);
|
|
114
|
+
} else if (await collect(outbound, options, keys, found)) {
|
|
115
|
+
await collect(outbound, options, keys, found);
|
|
116
|
+
}
|
|
117
|
+
const records = [...found.values()];
|
|
118
|
+
const wantsTimeline = (options.timeline ?? true) && outbound.capabilities["leads.timeline"];
|
|
119
|
+
const timelines = wantsTimeline ? await Promise.all(
|
|
120
|
+
records.map(
|
|
121
|
+
(record) => outbound.lead(record.ref).timeline({ include: options.include })
|
|
122
|
+
)
|
|
123
|
+
) : [];
|
|
124
|
+
return {
|
|
125
|
+
found: records.length > 0,
|
|
126
|
+
key,
|
|
127
|
+
keys: [...keys].toSorted(),
|
|
128
|
+
records,
|
|
129
|
+
timeline: timelines.flatMap((page) => page.items).toSorted(bySentAt)
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
var identity = () => ({
|
|
133
|
+
extend: (outbound) => ({
|
|
134
|
+
person: (identifier, options = {}) => lookup(outbound, identifier, options)
|
|
135
|
+
}),
|
|
136
|
+
name: "identity",
|
|
137
|
+
wrap: async (operation, next) => {
|
|
138
|
+
const output = await next(operation);
|
|
139
|
+
return { ...output, items: output.items.map(withKeys) };
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
export {
|
|
143
|
+
emailKey,
|
|
144
|
+
identity,
|
|
145
|
+
keysOf,
|
|
146
|
+
linkedinKey,
|
|
147
|
+
toKey
|
|
148
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const emailKey: (email: string | null) => string | null;
|
|
2
|
+
export declare const linkedinKey: (url: string | null) => string | null;
|
|
3
|
+
/** Every exact identifier a record carries. The first is its primary key. */
|
|
4
|
+
export declare const keysOf: (record: {
|
|
5
|
+
readonly email: string | null;
|
|
6
|
+
readonly linkedinUrl: string | null;
|
|
7
|
+
}) => string[];
|
|
8
|
+
/** Accepts a person key, an email address or a LinkedIn URL. */
|
|
9
|
+
export declare const toKey: (identifier: string) => string | null;
|