outbound-sdk 0.0.0-stage → 0.2.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 +119 -2
- package/dist/alerts/index.d.ts +2 -0
- package/dist/alerts/index.js +140 -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 +72 -0
- package/dist/budget/index.d.ts +21 -0
- package/dist/budget/index.js +71 -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-4PSO6JEK.js +357 -0
- package/dist/chunks/chunk-6CVZOUHB.js +152 -0
- package/dist/chunks/chunk-AFU5E5QB.js +714 -0
- package/dist/chunks/chunk-DJ2IUQEU.js +111 -0
- package/dist/chunks/chunk-E7JHLNLG.js +187 -0
- package/dist/chunks/chunk-FHKSLCVW.js +154 -0
- package/dist/chunks/chunk-FKH5N47I.js +40 -0
- package/dist/chunks/chunk-HZCTYL22.js +29 -0
- package/dist/chunks/chunk-IPUYZD4O.js +25 -0
- package/dist/chunks/chunk-IVH3NMQZ.js +61 -0
- package/dist/chunks/chunk-LVYG7XZJ.js +45 -0
- package/dist/chunks/chunk-NAKXLBA6.js +30 -0
- package/dist/chunks/chunk-NAWZ73QS.js +22 -0
- package/dist/chunks/chunk-PMSSUWD7.js +636 -0
- package/dist/chunks/chunk-PURHK3JU.js +432 -0
- package/dist/chunks/chunk-R3Y56YVF.js +43 -0
- package/dist/chunks/chunk-RCZ7ZZFU.js +92 -0
- package/dist/chunks/chunk-SBIZDCRY.js +106 -0
- package/dist/chunks/chunk-U2D34ARZ.js +41 -0
- package/dist/chunks/chunk-UAT3JSJZ.js +331 -0
- package/dist/chunks/chunk-VQSCHOBV.js +111 -0
- package/dist/chunks/chunk-XC6CZP73.js +80 -0
- package/dist/chunks/chunk-XNFESPZH.js +2307 -0
- package/dist/chunks/chunk-YOTW5ESM.js +118 -0
- package/dist/cli/bin.d.ts +2 -0
- package/dist/cli/bin.js +35 -0
- package/dist/cli/commands.d.ts +19 -0
- package/dist/cli/config.d.ts +22 -0
- package/dist/cli/index.d.ts +17 -0
- package/dist/cli/index.js +30 -0
- package/dist/cli/mcp.d.ts +14 -0
- package/dist/cli/stdio.d.ts +9 -0
- package/dist/clients/index.d.ts +2 -0
- package/dist/clients/index.js +117 -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 +420 -0
- package/dist/combine/route.d.ts +24 -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 +260 -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 +70 -0
- package/dist/heyreach/client.d.ts +18 -0
- package/dist/heyreach/inbox.d.ts +7 -0
- package/dist/heyreach/index.d.ts +25 -0
- package/dist/heyreach/index.js +1931 -0
- package/dist/heyreach/leads.d.ts +4 -0
- package/dist/heyreach/lookup.d.ts +15 -0
- package/dist/heyreach/map-account.d.ts +31 -0
- package/dist/heyreach/map-sequence.d.ts +5 -0
- package/dist/heyreach/map-stats.d.ts +13 -0
- package/dist/heyreach/map.d.ts +37 -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 +3 -0
- package/dist/identity/index.d.ts +3 -0
- package/dist/identity/index.js +159 -0
- package/dist/identity/keys.d.ts +9 -0
- package/dist/identity/plugin.d.ts +34 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +131 -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 +4937 -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 +155 -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 +85 -0
- package/dist/instantly/client.d.ts +24 -0
- package/dist/instantly/index.d.ts +27 -0
- package/dist/instantly/index.js +2627 -0
- package/dist/instantly/map-account.d.ts +38 -0
- package/dist/instantly/map-lead.d.ts +18 -0
- package/dist/instantly/map-stats.d.ts +25 -0
- package/dist/instantly/map.d.ts +22 -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 +7 -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 +3 -0
- package/dist/internal/adapter.d.ts +211 -0
- package/dist/internal/capabilities.d.ts +104 -0
- package/dist/internal/client.d.ts +15 -0
- package/dist/internal/concurrency.d.ts +8 -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 +34 -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 +205 -0
- package/dist/internal/entities.d.ts +493 -0
- package/dist/internal/env.d.ts +4 -0
- package/dist/internal/errors.d.ts +62 -0
- package/dist/internal/fields.d.ts +462 -0
- package/dist/internal/hooks.d.ts +55 -0
- package/dist/internal/json.d.ts +49 -0
- package/dist/internal/lead-fields.d.ts +21 -0
- package/dist/internal/lead-status.d.ts +13 -0
- package/dist/internal/limits.d.ts +34 -0
- package/dist/internal/metrics.d.ts +64 -0
- package/dist/internal/native.d.ts +81 -0
- package/dist/internal/outbound/api.d.ts +292 -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 +41 -0
- package/dist/internal/outbound/operations.d.ts +42 -0
- package/dist/internal/outbound/outbound.d.ts +67 -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 +20 -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/page.d.ts +14 -0
- package/dist/internal/record.d.ts +36 -0
- package/dist/internal/records.d.ts +7 -0
- package/dist/internal/redact.d.ts +18 -0
- package/dist/internal/ref.d.ts +16 -0
- package/dist/internal/sequence.d.ts +14 -0
- package/dist/internal/sha256.d.ts +6 -0
- package/dist/internal/text.d.ts +11 -0
- package/dist/internal/url.d.ts +9 -0
- package/dist/loader/index.d.ts +24 -0
- package/dist/loader/index.js +16 -0
- package/dist/memory/account-reads.d.ts +5 -0
- package/dist/memory/account.d.ts +81 -0
- package/dist/memory/adapter.d.ts +16 -0
- package/dist/memory/data.d.ts +137 -0
- package/dist/memory/demo.d.ts +7 -0
- package/dist/memory/index.d.ts +5 -0
- package/dist/memory/index.js +867 -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 +197 -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 +87 -0
- package/dist/smartlead/client.d.ts +18 -0
- package/dist/smartlead/hmac.d.ts +7 -0
- package/dist/smartlead/index.d.ts +24 -0
- package/dist/smartlead/index.js +2329 -0
- package/dist/smartlead/leads.d.ts +9 -0
- package/dist/smartlead/lookup.d.ts +8 -0
- package/dist/smartlead/mail.d.ts +5 -0
- package/dist/smartlead/map-account.d.ts +34 -0
- package/dist/smartlead/map-messages.d.ts +31 -0
- package/dist/smartlead/map-stats.d.ts +36 -0
- package/dist/smartlead/map.d.ts +62 -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 +12 -0
- package/dist/smartlead/native-services.d.ts +204 -0
- package/dist/smartlead/native.d.ts +785 -0
- package/dist/smartlead/shared.d.ts +29 -0
- package/dist/smartlead/stats.d.ts +5 -0
- package/dist/smartlead/webhooks.d.ts +3 -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 +28 -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 +42 -0
- package/dist/tools/index.d.ts +28 -0
- package/dist/tools/index.js +22 -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 +227 -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,111 @@
|
|
|
1
|
+
import {
|
|
2
|
+
stableId
|
|
3
|
+
} from "./chunk-FHKSLCVW.js";
|
|
4
|
+
import {
|
|
5
|
+
eventData,
|
|
6
|
+
refTo
|
|
7
|
+
} from "./chunk-U2D34ARZ.js";
|
|
8
|
+
import {
|
|
9
|
+
SCHEMA_VERSION
|
|
10
|
+
} from "./chunk-4PSO6JEK.js";
|
|
11
|
+
import {
|
|
12
|
+
compactObject,
|
|
13
|
+
emailAddress,
|
|
14
|
+
field,
|
|
15
|
+
flag,
|
|
16
|
+
isJsonObject,
|
|
17
|
+
isString,
|
|
18
|
+
list,
|
|
19
|
+
objects,
|
|
20
|
+
text,
|
|
21
|
+
timestamp
|
|
22
|
+
} from "./chunk-VQSCHOBV.js";
|
|
23
|
+
|
|
24
|
+
// src/heyreach/webhooks.ts
|
|
25
|
+
var EVENT_TYPES = /* @__PURE__ */ new Map([
|
|
26
|
+
["campaign_completed", "campaign.status_changed"],
|
|
27
|
+
["connection_request_accepted", "linkedin.connection_accepted"],
|
|
28
|
+
["connection_request_sent", "linkedin.connection_sent"],
|
|
29
|
+
["every_message_reply_received", "linkedin.message_received"],
|
|
30
|
+
["follow_sent", "unknown"],
|
|
31
|
+
["inmail_reply_received", "linkedin.message_received"],
|
|
32
|
+
["inmail_sent", "linkedin.message_sent"],
|
|
33
|
+
["lead_tag_updated", "lead.status_changed"],
|
|
34
|
+
["liked_post", "unknown"],
|
|
35
|
+
["message_reply_received", "linkedin.message_received"],
|
|
36
|
+
["message_sent", "linkedin.message_sent"],
|
|
37
|
+
["viewed_profile", "unknown"],
|
|
38
|
+
["voice_note_received", "linkedin.message_received"]
|
|
39
|
+
]);
|
|
40
|
+
var recentMessages = (value) => {
|
|
41
|
+
const messages = objects(value).map(
|
|
42
|
+
(message) => compactObject({
|
|
43
|
+
isReply: flag(message.is_reply),
|
|
44
|
+
messageType: text(message.message_type),
|
|
45
|
+
sentAt: timestamp(message.creation_time),
|
|
46
|
+
text: text(message.message),
|
|
47
|
+
transcript: text(field(message.voice_note, "transcript")),
|
|
48
|
+
transcriptStatus: text(field(message.voice_note, "transcript_status"))
|
|
49
|
+
})
|
|
50
|
+
);
|
|
51
|
+
return messages.length === 0 ? void 0 : messages;
|
|
52
|
+
};
|
|
53
|
+
var dataOf = (name, body) => {
|
|
54
|
+
const tags = list(field(body.lead, "tags")).filter((tag) => isString(tag));
|
|
55
|
+
return eventData(
|
|
56
|
+
{
|
|
57
|
+
campaignName: text(field(body.campaign, "name")),
|
|
58
|
+
isInmail: flag(body.is_inmail),
|
|
59
|
+
leadEmail: emailAddress(field(body.lead, "email_address")),
|
|
60
|
+
leadName: text(field(body.lead, "full_name")),
|
|
61
|
+
vendorEvent: name
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
conversationId: text(body.conversation_id),
|
|
65
|
+
externalReference: text(body.external_reference),
|
|
66
|
+
leadLinkedinId: text(field(body.lead, "id")),
|
|
67
|
+
recentMessages: recentMessages(body.recent_messages),
|
|
68
|
+
tags: tags.length === 0 ? void 0 : tags
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
};
|
|
72
|
+
var toEvent = (identity, body) => {
|
|
73
|
+
const name = text(body.event_type) ?? "";
|
|
74
|
+
const occurredAt = timestamp(body.timestamp);
|
|
75
|
+
const correlation = text(body.correlation_id);
|
|
76
|
+
const leadUrl = text(field(body.lead, "profile_url"));
|
|
77
|
+
return {
|
|
78
|
+
campaignRef: refTo(identity, text(field(body.campaign, "id"))),
|
|
79
|
+
data: dataOf(name, body),
|
|
80
|
+
// `correlation_id` is the only identifier HeyReach sends. Two event types
|
|
81
|
+
// can describe one reply, so the name is part of the id.
|
|
82
|
+
id: correlation === null ? stableId(
|
|
83
|
+
identity.provider,
|
|
84
|
+
name,
|
|
85
|
+
text(body.conversation_id),
|
|
86
|
+
leadUrl,
|
|
87
|
+
occurredAt
|
|
88
|
+
) : stableId(identity.provider, name, correlation),
|
|
89
|
+
// A lead's id is its profile URL, as in the REST mapping.
|
|
90
|
+
leadRef: refTo(identity, leadUrl),
|
|
91
|
+
// Messages have no id in HeyReach.
|
|
92
|
+
messageRef: null,
|
|
93
|
+
occurredAt,
|
|
94
|
+
provider: identity.provider,
|
|
95
|
+
raw: body,
|
|
96
|
+
schemaVersion: SCHEMA_VERSION,
|
|
97
|
+
senderRef: refTo(identity, text(field(body.sender, "id"))),
|
|
98
|
+
type: EVENT_TYPES.get(name.toLowerCase()) ?? "unknown",
|
|
99
|
+
workspaceId: identity.workspaceId
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
var detect = (request) => isJsonObject(request.body) && isString(request.body.event_type) && isString(request.body.correlation_id) && !("workspace" in request.body);
|
|
103
|
+
var heyreachEvents = (provider) => ({
|
|
104
|
+
detect,
|
|
105
|
+
parse: (request, workspaceId) => isJsonObject(request.body) ? [toEvent({ provider, workspaceId }, request.body)] : []
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
export {
|
|
109
|
+
EVENT_TYPES,
|
|
110
|
+
heyreachEvents
|
|
111
|
+
};
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isJsonObject,
|
|
3
|
+
isString
|
|
4
|
+
} from "./chunk-VQSCHOBV.js";
|
|
5
|
+
|
|
6
|
+
// src/internal/redact.ts
|
|
7
|
+
var EMAIL = /[\w.!#$%&'*+/=?^`{|}~-]+@[\w-]+(?:\.[\w-]+)+/gu;
|
|
8
|
+
var REDACTED_KEY = "[redacted-key]";
|
|
9
|
+
var REDACTED_EMAIL = "[redacted-email]";
|
|
10
|
+
var redactText = (value, secrets = []) => {
|
|
11
|
+
let result = value;
|
|
12
|
+
for (const secret of secrets) {
|
|
13
|
+
if (secret.length >= 4) {
|
|
14
|
+
result = result.replaceAll(secret, REDACTED_KEY);
|
|
15
|
+
result = result.replaceAll(encodeURIComponent(secret), REDACTED_KEY);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return result.replaceAll(EMAIL, REDACTED_EMAIL);
|
|
19
|
+
};
|
|
20
|
+
var redactUrl = (url, secrets = []) => redactText(url, secrets);
|
|
21
|
+
var MAX_DEPTH = 8;
|
|
22
|
+
var TRUNCATED = "[truncated]";
|
|
23
|
+
var isPlain = (cause) => typeof cause === "number" || typeof cause === "boolean";
|
|
24
|
+
var isText = (cause) => typeof cause === "string";
|
|
25
|
+
var isObject = (cause) => typeof cause === "object" && cause !== null;
|
|
26
|
+
var redactJson = (cause, secrets, depth) => {
|
|
27
|
+
if (cause === null || cause === void 0) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
if (isPlain(cause)) {
|
|
31
|
+
return cause;
|
|
32
|
+
}
|
|
33
|
+
if (isText(cause)) {
|
|
34
|
+
return redactText(cause, secrets);
|
|
35
|
+
}
|
|
36
|
+
if (cause instanceof Error) {
|
|
37
|
+
return redactText(`${cause.name}: ${cause.message}`, secrets);
|
|
38
|
+
}
|
|
39
|
+
if (!isObject(cause)) {
|
|
40
|
+
return redactText(String(cause), secrets);
|
|
41
|
+
}
|
|
42
|
+
if (depth >= MAX_DEPTH) {
|
|
43
|
+
return TRUNCATED;
|
|
44
|
+
}
|
|
45
|
+
if (Array.isArray(cause)) {
|
|
46
|
+
return cause.map((item) => redactJson(item, secrets, depth + 1));
|
|
47
|
+
}
|
|
48
|
+
return Object.fromEntries(
|
|
49
|
+
Object.entries(cause).flatMap(
|
|
50
|
+
([key, value]) => value === void 0 ? [] : [[redactText(key, secrets), redactJson(value, secrets, depth + 1)]]
|
|
51
|
+
)
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
var redactError = (cause, secrets, depth) => {
|
|
55
|
+
const copy = new Error(redactText(cause.message, secrets), {
|
|
56
|
+
cause: cause.cause === void 0 || depth >= MAX_DEPTH ? void 0 : redactCauseAt(cause.cause, secrets, depth + 1)
|
|
57
|
+
});
|
|
58
|
+
copy.name = cause.name;
|
|
59
|
+
if (cause.stack !== void 0) {
|
|
60
|
+
copy.stack = redactText(cause.stack, secrets);
|
|
61
|
+
}
|
|
62
|
+
return copy;
|
|
63
|
+
};
|
|
64
|
+
var redactCauseAt = (cause, secrets, depth) => {
|
|
65
|
+
if (cause === void 0) {
|
|
66
|
+
return void 0;
|
|
67
|
+
}
|
|
68
|
+
if (cause instanceof Error) {
|
|
69
|
+
return cause.name === "OutboundError" ? cause : redactError(cause, secrets, depth);
|
|
70
|
+
}
|
|
71
|
+
return redactJson(cause, secrets, depth);
|
|
72
|
+
};
|
|
73
|
+
var redactCause = (cause, secrets = []) => redactCauseAt(cause, secrets, 0);
|
|
74
|
+
|
|
75
|
+
// src/internal/errors.ts
|
|
76
|
+
var BRAND = /* @__PURE__ */ Symbol.for("outbound-sdk.OutboundError");
|
|
77
|
+
var RETRYABLE = /* @__PURE__ */ new Set([
|
|
78
|
+
"Provider",
|
|
79
|
+
"RateLimited"
|
|
80
|
+
]);
|
|
81
|
+
var OutboundError = class extends Error {
|
|
82
|
+
name = "OutboundError";
|
|
83
|
+
code;
|
|
84
|
+
provider;
|
|
85
|
+
status;
|
|
86
|
+
retryAfterMs;
|
|
87
|
+
aborted;
|
|
88
|
+
timedOut;
|
|
89
|
+
/** `true` when retrying the same call cannot succeed. */
|
|
90
|
+
permanent;
|
|
91
|
+
[BRAND] = true;
|
|
92
|
+
constructor(code, message, options = {}) {
|
|
93
|
+
super(redactText(message, options.secrets), {
|
|
94
|
+
cause: redactCause(options.cause, options.secrets)
|
|
95
|
+
});
|
|
96
|
+
this.code = code;
|
|
97
|
+
this.provider = options.provider;
|
|
98
|
+
this.status = options.status;
|
|
99
|
+
this.retryAfterMs = options.retryAfterMs;
|
|
100
|
+
this.aborted = options.aborted ?? false;
|
|
101
|
+
this.timedOut = options.timedOut ?? false;
|
|
102
|
+
this.permanent = this.aborted || !RETRYABLE.has(code);
|
|
103
|
+
}
|
|
104
|
+
/** Type guard that also recognises errors from another copy of the package. */
|
|
105
|
+
static is(cause) {
|
|
106
|
+
return typeof cause === "object" && cause !== null && BRAND in cause;
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
var isHttpFailure = (cause) => typeof cause === "object" && cause !== null && "status" in cause && "body" in cause;
|
|
110
|
+
var codeForStatus = (status) => {
|
|
111
|
+
if (status === 401 || status === 403) {
|
|
112
|
+
return "Unauthorized";
|
|
113
|
+
}
|
|
114
|
+
if (status === 404) {
|
|
115
|
+
return "NotFound";
|
|
116
|
+
}
|
|
117
|
+
if (status === 429) {
|
|
118
|
+
return "RateLimited";
|
|
119
|
+
}
|
|
120
|
+
if (status === 408 || status >= 500) {
|
|
121
|
+
return "Provider";
|
|
122
|
+
}
|
|
123
|
+
return "Invalid";
|
|
124
|
+
};
|
|
125
|
+
var messageFromBody = (body) => {
|
|
126
|
+
if (isString(body)) {
|
|
127
|
+
return body.slice(0, 300);
|
|
128
|
+
}
|
|
129
|
+
if (!isJsonObject(body)) {
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
for (const key of ["message", "error", "detail", "errorMessage"]) {
|
|
133
|
+
const value = body[key];
|
|
134
|
+
if (isString(value) && value !== "") {
|
|
135
|
+
return value.slice(0, 300);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return null;
|
|
139
|
+
};
|
|
140
|
+
var makeErrorMapper = (provider, options = {}) => (cause) => {
|
|
141
|
+
if (OutboundError.is(cause)) {
|
|
142
|
+
return cause;
|
|
143
|
+
}
|
|
144
|
+
const { secrets = [] } = options;
|
|
145
|
+
if (isHttpFailure(cause)) {
|
|
146
|
+
const code = options.statusCodes?.[cause.status] ?? codeForStatus(cause.status);
|
|
147
|
+
const detail2 = messageFromBody(cause.body);
|
|
148
|
+
return new OutboundError(
|
|
149
|
+
code,
|
|
150
|
+
`${provider} responded ${cause.status}${detail2 === null ? "" : `: ${detail2}`}`,
|
|
151
|
+
{
|
|
152
|
+
cause,
|
|
153
|
+
provider,
|
|
154
|
+
secrets,
|
|
155
|
+
retryAfterMs: cause.retryAfterMs,
|
|
156
|
+
status: cause.status
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
const detail = cause instanceof Error ? cause.message : String(cause);
|
|
161
|
+
return new OutboundError(
|
|
162
|
+
"Provider",
|
|
163
|
+
`${provider} request failed: ${detail}`,
|
|
164
|
+
{
|
|
165
|
+
cause,
|
|
166
|
+
provider,
|
|
167
|
+
secrets
|
|
168
|
+
}
|
|
169
|
+
);
|
|
170
|
+
};
|
|
171
|
+
var requireObject = (body, provider, message) => {
|
|
172
|
+
if (!isJsonObject(body)) {
|
|
173
|
+
throw new OutboundError("Provider", message, { provider });
|
|
174
|
+
}
|
|
175
|
+
return body;
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
export {
|
|
179
|
+
REDACTED_KEY,
|
|
180
|
+
REDACTED_EMAIL,
|
|
181
|
+
redactText,
|
|
182
|
+
redactUrl,
|
|
183
|
+
OutboundError,
|
|
184
|
+
isHttpFailure,
|
|
185
|
+
makeErrorMapper,
|
|
186
|
+
requireObject
|
|
187
|
+
};
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
// src/internal/sha256.ts
|
|
2
|
+
var K = new Uint32Array([
|
|
3
|
+
1116352408,
|
|
4
|
+
1899447441,
|
|
5
|
+
3049323471,
|
|
6
|
+
3921009573,
|
|
7
|
+
961987163,
|
|
8
|
+
1508970993,
|
|
9
|
+
2453635748,
|
|
10
|
+
2870763221,
|
|
11
|
+
3624381080,
|
|
12
|
+
310598401,
|
|
13
|
+
607225278,
|
|
14
|
+
1426881987,
|
|
15
|
+
1925078388,
|
|
16
|
+
2162078206,
|
|
17
|
+
2614888103,
|
|
18
|
+
3248222580,
|
|
19
|
+
3835390401,
|
|
20
|
+
4022224774,
|
|
21
|
+
264347078,
|
|
22
|
+
604807628,
|
|
23
|
+
770255983,
|
|
24
|
+
1249150122,
|
|
25
|
+
1555081692,
|
|
26
|
+
1996064986,
|
|
27
|
+
2554220882,
|
|
28
|
+
2821834349,
|
|
29
|
+
2952996808,
|
|
30
|
+
3210313671,
|
|
31
|
+
3336571891,
|
|
32
|
+
3584528711,
|
|
33
|
+
113926993,
|
|
34
|
+
338241895,
|
|
35
|
+
666307205,
|
|
36
|
+
773529912,
|
|
37
|
+
1294757372,
|
|
38
|
+
1396182291,
|
|
39
|
+
1695183700,
|
|
40
|
+
1986661051,
|
|
41
|
+
2177026350,
|
|
42
|
+
2456956037,
|
|
43
|
+
2730485921,
|
|
44
|
+
2820302411,
|
|
45
|
+
3259730800,
|
|
46
|
+
3345764771,
|
|
47
|
+
3516065817,
|
|
48
|
+
3600352804,
|
|
49
|
+
4094571909,
|
|
50
|
+
275423344,
|
|
51
|
+
430227734,
|
|
52
|
+
506948616,
|
|
53
|
+
659060556,
|
|
54
|
+
883997877,
|
|
55
|
+
958139571,
|
|
56
|
+
1322822218,
|
|
57
|
+
1537002063,
|
|
58
|
+
1747873779,
|
|
59
|
+
1955562222,
|
|
60
|
+
2024104815,
|
|
61
|
+
2227730452,
|
|
62
|
+
2361852424,
|
|
63
|
+
2428436474,
|
|
64
|
+
2756734187,
|
|
65
|
+
3204031479,
|
|
66
|
+
3329325298
|
|
67
|
+
]);
|
|
68
|
+
var INITIAL = [
|
|
69
|
+
1779033703,
|
|
70
|
+
3144134277,
|
|
71
|
+
1013904242,
|
|
72
|
+
2773480762,
|
|
73
|
+
1359893119,
|
|
74
|
+
2600822924,
|
|
75
|
+
528734635,
|
|
76
|
+
1541459225
|
|
77
|
+
];
|
|
78
|
+
var rotate = (value, bits) => value >>> bits | value << 32 - bits;
|
|
79
|
+
var pad = (bytes) => {
|
|
80
|
+
const paddedLength = Math.ceil((bytes.length + 9) / 64) * 64;
|
|
81
|
+
const padded = new Uint8Array(paddedLength);
|
|
82
|
+
padded.set(bytes);
|
|
83
|
+
padded[bytes.length] = 128;
|
|
84
|
+
const view = new DataView(padded.buffer);
|
|
85
|
+
const bitLength = bytes.length * 8;
|
|
86
|
+
view.setUint32(paddedLength - 8, Math.floor(bitLength / 4294967296));
|
|
87
|
+
view.setUint32(paddedLength - 4, bitLength >>> 0);
|
|
88
|
+
return padded;
|
|
89
|
+
};
|
|
90
|
+
var schedule = (view, offset) => {
|
|
91
|
+
const words = new Uint32Array(64);
|
|
92
|
+
for (let index = 0; index < 16; index += 1) {
|
|
93
|
+
words[index] = view.getUint32(offset + index * 4);
|
|
94
|
+
}
|
|
95
|
+
for (let index = 16; index < 64; index += 1) {
|
|
96
|
+
const w15 = words[index - 15] ?? 0;
|
|
97
|
+
const w2 = words[index - 2] ?? 0;
|
|
98
|
+
const s0 = rotate(w15, 7) ^ rotate(w15, 18) ^ w15 >>> 3;
|
|
99
|
+
const s1 = rotate(w2, 17) ^ rotate(w2, 19) ^ w2 >>> 10;
|
|
100
|
+
words[index] = (words[index - 16] ?? 0) + s0 + (words[index - 7] ?? 0) + s1 >>> 0;
|
|
101
|
+
}
|
|
102
|
+
return words;
|
|
103
|
+
};
|
|
104
|
+
var compress = (state, words) => {
|
|
105
|
+
let [a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0] = state;
|
|
106
|
+
for (let index = 0; index < 64; index += 1) {
|
|
107
|
+
const s1 = rotate(e, 6) ^ rotate(e, 11) ^ rotate(e, 25);
|
|
108
|
+
const choice = e & f ^ ~e & g;
|
|
109
|
+
const t1 = h + s1 + choice + (K[index] ?? 0) + (words[index] ?? 0) >>> 0;
|
|
110
|
+
const s0 = rotate(a, 2) ^ rotate(a, 13) ^ rotate(a, 22);
|
|
111
|
+
const majority = a & b ^ a & c ^ b & c;
|
|
112
|
+
const t2 = s0 + majority >>> 0;
|
|
113
|
+
h = g;
|
|
114
|
+
g = f;
|
|
115
|
+
f = e;
|
|
116
|
+
e = d + t1 >>> 0;
|
|
117
|
+
d = c;
|
|
118
|
+
c = b;
|
|
119
|
+
b = a;
|
|
120
|
+
a = t1 + t2 >>> 0;
|
|
121
|
+
}
|
|
122
|
+
const next = [a, b, c, d, e, f, g, h];
|
|
123
|
+
for (let index = 0; index < 8; index += 1) {
|
|
124
|
+
state[index] = (state[index] ?? 0) + (next[index] ?? 0) >>> 0;
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
var sha256 = (bytes) => {
|
|
128
|
+
const padded = pad(bytes);
|
|
129
|
+
const view = new DataView(padded.buffer);
|
|
130
|
+
const state = [...INITIAL];
|
|
131
|
+
for (let offset = 0; offset < padded.length; offset += 64) {
|
|
132
|
+
compress(state, schedule(view, offset));
|
|
133
|
+
}
|
|
134
|
+
const digest = new Uint8Array(32);
|
|
135
|
+
const out = new DataView(digest.buffer);
|
|
136
|
+
for (const [index, word] of state.entries()) {
|
|
137
|
+
out.setUint32(index * 4, word);
|
|
138
|
+
}
|
|
139
|
+
return digest;
|
|
140
|
+
};
|
|
141
|
+
var sha256Hex = (input) => Array.from(
|
|
142
|
+
sha256(new TextEncoder().encode(input)),
|
|
143
|
+
(byte) => byte.toString(16).padStart(2, "0")
|
|
144
|
+
).join("");
|
|
145
|
+
var stableId = (...parts) => sha256Hex(parts.map((part) => String(part ?? "")).join("")).slice(
|
|
146
|
+
0,
|
|
147
|
+
32
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
export {
|
|
151
|
+
sha256,
|
|
152
|
+
sha256Hex,
|
|
153
|
+
stableId
|
|
154
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {
|
|
2
|
+
stableId
|
|
3
|
+
} from "./chunk-FHKSLCVW.js";
|
|
4
|
+
import {
|
|
5
|
+
count
|
|
6
|
+
} from "./chunk-VQSCHOBV.js";
|
|
7
|
+
|
|
8
|
+
// src/internal/sequence.ts
|
|
9
|
+
var variantKey = (index) => String.fromCodePoint(65 + index);
|
|
10
|
+
var toVariant = (subject, body, key) => ({
|
|
11
|
+
body,
|
|
12
|
+
contentHash: stableId(subject, body),
|
|
13
|
+
subject,
|
|
14
|
+
variantKey: key
|
|
15
|
+
});
|
|
16
|
+
var fromOne = (value) => {
|
|
17
|
+
const number = count(value);
|
|
18
|
+
return number === null || number < 1 ? null : number - 1;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// src/internal/lead-status.ts
|
|
22
|
+
var leadStanding = (progress, outcome) => {
|
|
23
|
+
const headline = () => {
|
|
24
|
+
if (outcome.unsubscribed === true) {
|
|
25
|
+
return "unsubscribed";
|
|
26
|
+
}
|
|
27
|
+
if (outcome.bounced === true) {
|
|
28
|
+
return "bounced";
|
|
29
|
+
}
|
|
30
|
+
return outcome.replied === true ? "replied" : progress;
|
|
31
|
+
};
|
|
32
|
+
return { ...outcome, progress, status: headline() };
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export {
|
|
36
|
+
variantKey,
|
|
37
|
+
toVariant,
|
|
38
|
+
fromOne,
|
|
39
|
+
leadStanding
|
|
40
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// src/internal/concurrency.ts
|
|
2
|
+
var DEFAULT_READ_CONCURRENCY = 4;
|
|
3
|
+
var mapConcurrent = async (items, read, limit = DEFAULT_READ_CONCURRENCY) => {
|
|
4
|
+
const results = Array.from({ length: items.length });
|
|
5
|
+
let next = 0;
|
|
6
|
+
let failure;
|
|
7
|
+
const worker = async () => {
|
|
8
|
+
while (failure === void 0 && next < items.length) {
|
|
9
|
+
const index = next;
|
|
10
|
+
next += 1;
|
|
11
|
+
const item = items[index];
|
|
12
|
+
try {
|
|
13
|
+
results[index] = await read(item, index);
|
|
14
|
+
} catch (error) {
|
|
15
|
+
failure ??= { error };
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const workers = Math.max(1, Math.min(Math.floor(limit), items.length));
|
|
20
|
+
await Promise.all(Array.from({ length: workers }, worker));
|
|
21
|
+
if (failure !== void 0) {
|
|
22
|
+
throw failure.error;
|
|
23
|
+
}
|
|
24
|
+
return results;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
mapConcurrent
|
|
29
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
OutboundError
|
|
3
|
+
} from "./chunk-E7JHLNLG.js";
|
|
4
|
+
|
|
5
|
+
// src/internal/env.ts
|
|
6
|
+
var readEnv = (name) => {
|
|
7
|
+
const value = globalThis.process?.env?.[name];
|
|
8
|
+
return value === void 0 || value.trim() === "" ? void 0 : value.trim();
|
|
9
|
+
};
|
|
10
|
+
var requireCredential = (explicit, envName, provider) => {
|
|
11
|
+
const value = explicit?.trim() || readEnv(envName);
|
|
12
|
+
if (value === void 0 || value === "") {
|
|
13
|
+
throw new OutboundError(
|
|
14
|
+
"Unauthorized",
|
|
15
|
+
`${provider} needs an API key: pass apiKey or set ${envName}`,
|
|
16
|
+
{ provider }
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
return value;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export {
|
|
23
|
+
readEnv,
|
|
24
|
+
requireCredential
|
|
25
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import {
|
|
2
|
+
stableId
|
|
3
|
+
} from "./chunk-FHKSLCVW.js";
|
|
4
|
+
|
|
5
|
+
// src/cache/index.ts
|
|
6
|
+
var memoryCacheStore = (maxEntries = 500) => {
|
|
7
|
+
const entries = /* @__PURE__ */ new Map();
|
|
8
|
+
return {
|
|
9
|
+
delete: (key) => {
|
|
10
|
+
entries.delete(key);
|
|
11
|
+
return Promise.resolve();
|
|
12
|
+
},
|
|
13
|
+
get: (key) => Promise.resolve(entries.get(key)),
|
|
14
|
+
set: (key, entry) => {
|
|
15
|
+
entries.delete(key);
|
|
16
|
+
entries.set(key, entry);
|
|
17
|
+
if (entries.size > maxEntries) {
|
|
18
|
+
const [oldest] = entries.keys();
|
|
19
|
+
if (oldest !== void 0) {
|
|
20
|
+
entries.delete(oldest);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return Promise.resolve();
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
var cacheKey = (scope, operation) => `outbound:${stableId(scope.provider, scope.workspaceId, JSON.stringify(operation))}`;
|
|
28
|
+
var cache = (options) => {
|
|
29
|
+
const store = options.store ?? memoryCacheStore();
|
|
30
|
+
const now = options.now ?? (() => Date.now());
|
|
31
|
+
const ttlMs = options.ttl * 1e3;
|
|
32
|
+
const kinds = options.only === void 0 ? void 0 : new Set(options.only);
|
|
33
|
+
return {
|
|
34
|
+
name: "cache",
|
|
35
|
+
wrap: async (operation, next, info) => {
|
|
36
|
+
if (ttlMs <= 0 || kinds !== void 0 && !kinds.has(operation.kind)) {
|
|
37
|
+
return await next(operation);
|
|
38
|
+
}
|
|
39
|
+
const key = cacheKey(info, operation);
|
|
40
|
+
const hit = await store.get(key);
|
|
41
|
+
if (hit !== void 0 && now() - hit.storedAt < ttlMs) {
|
|
42
|
+
return {
|
|
43
|
+
...hit.output,
|
|
44
|
+
fetchedAt: new Date(hit.storedAt).toISOString()
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
const output = await next(operation);
|
|
48
|
+
if (output.stale !== true) {
|
|
49
|
+
const storedAt = output.fetchedAt === void 0 ? now() : Date.parse(output.fetchedAt);
|
|
50
|
+
await store.set(key, { output, storedAt }, ttlMs);
|
|
51
|
+
}
|
|
52
|
+
return output;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export {
|
|
58
|
+
memoryCacheStore,
|
|
59
|
+
cacheKey,
|
|
60
|
+
cache
|
|
61
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {
|
|
2
|
+
OutboundError
|
|
3
|
+
} from "./chunk-E7JHLNLG.js";
|
|
4
|
+
|
|
5
|
+
// src/internal/ref.ts
|
|
6
|
+
var SEPARATOR = ":";
|
|
7
|
+
var makeRef = (provider, workspaceId, sourceId) => [provider, workspaceId, String(sourceId)].join(SEPARATOR);
|
|
8
|
+
var parseRef = (ref) => {
|
|
9
|
+
const [provider, workspaceId, ...rest] = ref.split(SEPARATOR);
|
|
10
|
+
if (!provider || !workspaceId || rest.length === 0) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
return { provider, sourceId: rest.join(SEPARATOR), workspaceId };
|
|
14
|
+
};
|
|
15
|
+
var sourceIdFor = (id, provider, workspaceId) => {
|
|
16
|
+
const parts = parseRef(id);
|
|
17
|
+
if (parts === null || parts.provider !== provider) {
|
|
18
|
+
return id;
|
|
19
|
+
}
|
|
20
|
+
if (parts.workspaceId !== workspaceId) {
|
|
21
|
+
throw new OutboundError(
|
|
22
|
+
"Invalid",
|
|
23
|
+
`${id} belongs to workspace ${parts.workspaceId}, not ${workspaceId}`,
|
|
24
|
+
{ provider }
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
return parts.sourceId;
|
|
28
|
+
};
|
|
29
|
+
var assertWorkspaceId = (workspaceId, provider) => {
|
|
30
|
+
if (workspaceId === "" || workspaceId.includes(SEPARATOR)) {
|
|
31
|
+
throw new OutboundError(
|
|
32
|
+
"Invalid",
|
|
33
|
+
`workspaceId must be a non-empty string without "${SEPARATOR}"`,
|
|
34
|
+
{ provider }
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
return workspaceId;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export {
|
|
41
|
+
makeRef,
|
|
42
|
+
parseRef,
|
|
43
|
+
sourceIdFor,
|
|
44
|
+
assertWorkspaceId
|
|
45
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// src/internal/native.ts
|
|
2
|
+
var defineNative = (catalog) => catalog;
|
|
3
|
+
var inQuery = (type, description) => ({ description, in: "query", type });
|
|
4
|
+
var inQueryRequired = (type, description) => ({
|
|
5
|
+
description,
|
|
6
|
+
in: "query",
|
|
7
|
+
required: true,
|
|
8
|
+
type
|
|
9
|
+
});
|
|
10
|
+
var inBody = (type, description) => ({ description, in: "body", type });
|
|
11
|
+
var inBodyRequired = (type, description) => ({
|
|
12
|
+
description,
|
|
13
|
+
in: "body",
|
|
14
|
+
required: true,
|
|
15
|
+
type
|
|
16
|
+
});
|
|
17
|
+
var inPath = (description) => ({
|
|
18
|
+
description,
|
|
19
|
+
in: "path",
|
|
20
|
+
type: "string"
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export {
|
|
24
|
+
defineNative,
|
|
25
|
+
inQuery,
|
|
26
|
+
inQueryRequired,
|
|
27
|
+
inBody,
|
|
28
|
+
inBodyRequired,
|
|
29
|
+
inPath
|
|
30
|
+
};
|