outbound-sdk 0.2.1 → 0.5.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/README.md +2 -2
- package/dist/alerts/check-evaluate.d.ts +53 -0
- package/dist/alerts/check-measure.d.ts +100 -0
- package/dist/alerts/check-schema.d.ts +184 -0
- package/dist/alerts/check-validate.d.ts +18 -0
- package/dist/alerts/index.d.ts +7 -0
- package/dist/alerts/index.js +684 -20
- package/dist/alerts/plugin.d.ts +20 -3
- package/dist/audit/index.js +2 -2
- package/dist/benchmarks/index.js +5 -5
- package/dist/budget/index.d.ts +5 -2
- package/dist/budget/index.js +12 -10
- package/dist/cards/content.d.ts +6 -1
- package/dist/cards/format.d.ts +17 -2
- package/dist/cards/index.d.ts +1 -1
- package/dist/cards/index.js +298 -132
- package/dist/cards/parts.d.ts +9 -2
- package/dist/cards/render.d.ts +20 -3
- package/dist/chunks/{chunk-U2D34ARZ.js → chunk-2D42TQFU.js} +3 -3
- package/dist/chunks/{chunk-6CVZOUHB.js → chunk-3S32R2MH.js} +53 -63
- package/dist/chunks/chunk-4PA526S7.js +17 -0
- package/dist/chunks/{chunk-RCZ7ZZFU.js → chunk-5J7GGV62.js} +12 -5
- package/dist/chunks/chunk-6TKFISG4.js +676 -0
- package/dist/chunks/{chunk-AFU5E5QB.js → chunk-BK5SLY32.js} +104 -84
- package/dist/chunks/{chunk-VQSCHOBV.js → chunk-BLCJHP5H.js} +11 -4
- package/dist/chunks/{chunk-SBIZDCRY.js → chunk-BN6WCAWX.js} +7 -7
- package/dist/chunks/{chunk-4PSO6JEK.js → chunk-BOWXGMN3.js} +6 -21
- package/dist/chunks/{chunk-PURHK3JU.js → chunk-EHSJGQ5K.js} +8 -8
- package/dist/chunks/{chunk-IPUYZD4O.js → chunk-GFDNRWR3.js} +1 -1
- package/dist/chunks/chunk-HPNGSG5E.js +51 -0
- package/dist/chunks/chunk-HWHI4LFY.js +102 -0
- package/dist/chunks/{chunk-E7JHLNLG.js → chunk-J7DDZ4C2.js} +15 -2
- package/dist/chunks/{chunk-DJ2IUQEU.js → chunk-JWGSB7PT.js} +6 -6
- package/dist/chunks/{chunk-R3Y56YVF.js → chunk-OLPMBRXM.js} +4 -3
- package/dist/chunks/{chunk-YOTW5ESM.js → chunk-PQSTQKRD.js} +2 -2
- package/dist/chunks/chunk-PTZO4QXR.js +15 -0
- package/dist/chunks/{chunk-LVYG7XZJ.js → chunk-QAKJ76HB.js} +1 -1
- package/dist/chunks/chunk-QGRZDTX4.js +26 -0
- package/dist/chunks/chunk-WGW3ROLY.js +18 -0
- package/dist/chunks/{chunk-XC6CZP73.js → chunk-WH6V3YNN.js} +32 -1
- package/dist/chunks/{chunk-P3IJBJUI.js → chunk-X4RDBD4J.js} +296 -62
- package/dist/chunks/chunk-XL6LJVHJ.js +71 -0
- package/dist/chunks/{chunk-XNFESPZH.js → chunk-YYCT3NGV.js} +200 -39
- package/dist/chunks/{chunk-UAT3JSJZ.js → chunk-ZOAG2C6V.js} +2 -2
- package/dist/cli/bin.js +19 -30
- package/dist/cli/commands.d.ts +11 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.js +18 -13
- package/dist/cli/mcp.d.ts +5 -0
- package/dist/cli/update.d.ts +15 -0
- package/dist/clients/index.d.ts +1 -1
- package/dist/clients/index.js +35 -10
- package/dist/clients/plugin.d.ts +9 -2
- package/dist/combine/index.js +7 -6
- package/dist/emailbison/account.d.ts +7 -0
- package/dist/emailbison/adapter.d.ts +5 -0
- package/dist/emailbison/capabilities.d.ts +78 -0
- package/dist/emailbison/client.d.ts +29 -0
- package/dist/emailbison/index.d.ts +30 -0
- package/dist/emailbison/index.js +1017 -0
- package/dist/emailbison/mail.d.ts +5 -0
- package/dist/emailbison/map-mail.d.ts +13 -0
- package/dist/emailbison/map-sequence.d.ts +12 -0
- package/dist/emailbison/map-stats.d.ts +47 -0
- package/dist/emailbison/map.d.ts +24 -0
- package/dist/emailbison/native-params.d.ts +5 -0
- package/dist/emailbison/native-workspace.d.ts +167 -0
- package/dist/emailbison/native.d.ts +327 -0
- package/dist/emailbison/stats.d.ts +4 -0
- package/dist/emailbison/webhooks.d.ts +2 -0
- package/dist/exporter/index.d.ts +5 -2
- package/dist/exporter/index.js +2 -2
- package/dist/failover/index.js +3 -3
- package/dist/fixtures/index.js +10 -9
- package/dist/heyreach/capabilities.d.ts +3 -0
- package/dist/heyreach/client.d.ts +2 -0
- package/dist/heyreach/index.js +83 -51
- package/dist/heyreach/map.d.ts +5 -2
- package/dist/identity/index.js +33 -17
- package/dist/identity/plugin.d.ts +2 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +29 -25
- package/dist/insights/campaign.d.ts +3 -0
- package/dist/insights/capped.d.ts +29 -0
- package/dist/insights/copy/copy-audit.d.ts +2 -0
- package/dist/insights/copy/copy-reuse.d.ts +27 -3
- package/dist/insights/copy/index.d.ts +8 -8
- package/dist/insights/copy/reply-timing.d.ts +8 -0
- package/dist/insights/copy/reuse-base.d.ts +32 -0
- package/dist/insights/copy/shared.d.ts +39 -15
- package/dist/insights/copy/step-funnel.d.ts +16 -5
- package/dist/insights/copy/variant-test.d.ts +19 -8
- package/dist/insights/cost.d.ts +91 -0
- package/dist/insights/define.d.ts +78 -3
- package/dist/insights/fields.d.ts +16 -0
- package/dist/insights/index.d.ts +6 -4
- package/dist/insights/index.js +1816 -748
- package/dist/insights/inputs.generated.d.ts +951 -0
- package/dist/insights/ops/campaign-diagnosis.d.ts +3 -1
- package/dist/insights/ops/campaign-ranking.d.ts +15 -7
- package/dist/insights/ops/channel-mix.d.ts +2 -1
- package/dist/insights/ops/client-report.d.ts +18 -5
- package/dist/insights/ops/index.d.ts +8 -4
- package/dist/insights/ops/period-comparison.d.ts +14 -3
- package/dist/insights/ops/pipeline-forecast.d.ts +14 -4
- package/dist/insights/ops/shared.d.ts +39 -24
- package/dist/insights/ops/tag-rollup.d.ts +2 -1
- package/dist/insights/people/account-summary.d.ts +13 -0
- package/dist/insights/people/dropped-replies.d.ts +8 -0
- package/dist/insights/people/find.d.ts +7 -1
- package/dist/insights/people/hot-leads.d.ts +16 -1
- package/dist/insights/people/person-summary.d.ts +6 -0
- package/dist/insights/people/read.d.ts +26 -10
- package/dist/insights/people/suppression-check.d.ts +11 -2
- package/dist/insights/plugin.d.ts +26 -5
- package/dist/insights/ref.d.ts +6 -0
- package/dist/insights/registry.d.ts +30 -18
- package/dist/insights/run-cap.d.ts +35 -0
- package/dist/insights/senders/bounce-watch.d.ts +25 -8
- package/dist/insights/senders/capacity-sends.d.ts +22 -0
- package/dist/insights/senders/domain-health.d.ts +10 -4
- package/dist/insights/senders/index.d.ts +14 -6
- package/dist/insights/senders/read.d.ts +15 -14
- package/dist/insights/senders/sender-capacity.d.ts +5 -13
- package/dist/insights/senders/sender-load.d.ts +2 -0
- package/dist/insights/stats.d.ts +8 -0
- package/dist/insights/tools.d.ts +13 -2
- package/dist/instantly/capabilities.d.ts +13 -0
- package/dist/instantly/client.d.ts +2 -0
- package/dist/instantly/index.js +77 -49
- package/dist/instantly/map.d.ts +6 -2
- package/dist/internal/adapter.d.ts +12 -0
- package/dist/internal/engine/request.d.ts +5 -0
- package/dist/internal/entities.d.ts +3 -20
- package/dist/internal/errors.d.ts +44 -0
- package/dist/internal/fields.d.ts +1 -1
- package/dist/internal/json.d.ts +9 -2
- package/dist/internal/lists.d.ts +24 -0
- package/dist/internal/numbers.d.ts +8 -0
- package/dist/internal/outbound/collections.d.ts +4 -0
- package/dist/internal/outbound/create.d.ts +24 -3
- package/dist/internal/outbound/outbound.d.ts +18 -2
- package/dist/internal/outbound/validate.d.ts +4 -0
- package/dist/internal/outbound/walker.d.ts +3 -2
- package/dist/internal/plural.d.ts +12 -0
- package/dist/internal/renamed.d.ts +28 -0
- package/dist/internal/request-cap.d.ts +35 -0
- package/dist/internal/vocabulary.d.ts +20 -0
- package/dist/loader/index.js +5 -5
- package/dist/memory/adapter.d.ts +7 -0
- package/dist/memory/demo-stats.d.ts +3 -0
- package/dist/memory/demo.d.ts +14 -3
- package/dist/memory/index.d.ts +1 -0
- package/dist/memory/index.js +209 -104
- package/dist/providers/index.d.ts +92 -0
- package/dist/providers/index.js +3 -1
- package/dist/reconcile/index.js +5 -4
- package/dist/redact/index.js +13 -7
- package/dist/redact/plugin.d.ts +7 -0
- package/dist/smartlead/capabilities.d.ts +5 -0
- package/dist/smartlead/index.js +119 -66
- package/dist/smartlead/shared.d.ts +13 -0
- package/dist/sync/index.js +2 -2
- package/dist/tools/ai-sdk.js +10 -6
- package/dist/tools/campaign-tools.d.ts +1 -1
- package/dist/tools/claude-agent.js +10 -6
- package/dist/tools/index.d.ts +2 -2
- package/dist/tools/index.js +16 -9
- package/dist/tools/input-problem.d.ts +8 -0
- package/dist/tools/registry.d.ts +26 -2
- package/dist/tools/shared.d.ts +27 -1
- package/dist/tracing/index.js +2 -2
- package/dist/webhooks/index.js +22 -12
- package/package.json +8 -2
- package/dist/chunks/chunk-FKH5N47I.js +0 -40
package/dist/instantly/index.js
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EVENT_TYPES,
|
|
3
3
|
instantlyEvents
|
|
4
|
-
} from "../chunks/chunk-
|
|
4
|
+
} from "../chunks/chunk-BN6WCAWX.js";
|
|
5
5
|
import {
|
|
6
|
-
createVendorClient,
|
|
7
6
|
flatMapPage,
|
|
8
7
|
mapPage,
|
|
9
|
-
normalizeBody,
|
|
10
8
|
withLeadFields,
|
|
11
9
|
withMappedFields
|
|
12
|
-
} from "../chunks/chunk-
|
|
10
|
+
} from "../chunks/chunk-XL6LJVHJ.js";
|
|
13
11
|
import {
|
|
12
|
+
createVendorClient,
|
|
14
13
|
leadStanding,
|
|
14
|
+
listIn,
|
|
15
|
+
normalizeBody,
|
|
15
16
|
toVariant,
|
|
16
17
|
variantKey
|
|
17
|
-
} from "../chunks/chunk-
|
|
18
|
+
} from "../chunks/chunk-3S32R2MH.js";
|
|
18
19
|
import {
|
|
19
20
|
defineNative,
|
|
20
21
|
inBody,
|
|
@@ -23,32 +24,33 @@ import {
|
|
|
23
24
|
inQuery,
|
|
24
25
|
inQueryRequired
|
|
25
26
|
} from "../chunks/chunk-NAKXLBA6.js";
|
|
27
|
+
import {
|
|
28
|
+
eventTypesOf,
|
|
29
|
+
recordBase,
|
|
30
|
+
refTo,
|
|
31
|
+
refsTo
|
|
32
|
+
} from "../chunks/chunk-2D42TQFU.js";
|
|
33
|
+
import "../chunks/chunk-BOWXGMN3.js";
|
|
26
34
|
import {
|
|
27
35
|
emptyCounts,
|
|
28
36
|
metricRow,
|
|
29
37
|
sumCounts
|
|
30
|
-
} from "../chunks/chunk-
|
|
38
|
+
} from "../chunks/chunk-PQSTQKRD.js";
|
|
39
|
+
import "../chunks/chunk-QGRZDTX4.js";
|
|
40
|
+
import {
|
|
41
|
+
assertWorkspaceId
|
|
42
|
+
} from "../chunks/chunk-QAKJ76HB.js";
|
|
31
43
|
import "../chunks/chunk-NAWZ73QS.js";
|
|
32
44
|
import "../chunks/chunk-FHKSLCVW.js";
|
|
33
45
|
import {
|
|
34
46
|
readEnv,
|
|
35
47
|
requireCredential
|
|
36
|
-
} from "../chunks/chunk-
|
|
37
|
-
import {
|
|
38
|
-
eventTypesOf,
|
|
39
|
-
recordBase,
|
|
40
|
-
refTo,
|
|
41
|
-
refsTo
|
|
42
|
-
} from "../chunks/chunk-U2D34ARZ.js";
|
|
43
|
-
import "../chunks/chunk-4PSO6JEK.js";
|
|
44
|
-
import {
|
|
45
|
-
assertWorkspaceId
|
|
46
|
-
} from "../chunks/chunk-LVYG7XZJ.js";
|
|
48
|
+
} from "../chunks/chunk-GFDNRWR3.js";
|
|
47
49
|
import {
|
|
48
50
|
OutboundError,
|
|
49
51
|
makeErrorMapper,
|
|
50
52
|
requireObject
|
|
51
|
-
} from "../chunks/chunk-
|
|
53
|
+
} from "../chunks/chunk-J7DDZ4C2.js";
|
|
52
54
|
import {
|
|
53
55
|
count,
|
|
54
56
|
emailAddress,
|
|
@@ -63,7 +65,7 @@ import {
|
|
|
63
65
|
text,
|
|
64
66
|
timestamp,
|
|
65
67
|
withoutKeys
|
|
66
|
-
} from "../chunks/chunk-
|
|
68
|
+
} from "../chunks/chunk-BLCJHP5H.js";
|
|
67
69
|
|
|
68
70
|
// src/instantly/map-account.ts
|
|
69
71
|
var CLOCK = /^\d{2}:\d{2}$/u;
|
|
@@ -385,8 +387,10 @@ var toWorkspace = (identity, raw) => ({
|
|
|
385
387
|
...recordBase(identity, text(raw.id) ?? identity.workspaceId, raw),
|
|
386
388
|
name: text(raw.name) ?? identity.workspaceId
|
|
387
389
|
});
|
|
388
|
-
var listEnvelope = (body) => ({
|
|
389
|
-
items: objects(
|
|
390
|
+
var listEnvelope = (body, provider, path) => ({
|
|
391
|
+
items: objects(
|
|
392
|
+
listIn(body, { key: "items", path, provider, vendor: "Instantly" })
|
|
393
|
+
),
|
|
390
394
|
next: text(field(body, "next_starting_after")) ?? void 0
|
|
391
395
|
});
|
|
392
396
|
|
|
@@ -507,26 +511,39 @@ var limits = {
|
|
|
507
511
|
]
|
|
508
512
|
};
|
|
509
513
|
var costs = {
|
|
510
|
-
"blocklist.list": { pageSize: PAGE_SIZE, perPage: 1 },
|
|
514
|
+
"blocklist.list": { pageSize: PAGE_SIZE, perPage: 1, perWalk: 1 },
|
|
511
515
|
// The campaign, its tag assignments, then the tags' names.
|
|
512
516
|
"campaigns.get": { perPage: 3 },
|
|
513
517
|
// The campaigns, their tag assignments, then the tags' names.
|
|
514
|
-
"campaigns.list": { pageSize: PAGE_SIZE, perPage: 3 },
|
|
518
|
+
"campaigns.list": { pageSize: PAGE_SIZE, perPage: 3, perWalk: 1 },
|
|
515
519
|
"campaigns.settings": { perPage: 1 },
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
"
|
|
519
|
-
"
|
|
520
|
-
|
|
520
|
+
// A custom interest label costs one more read of the label list, made only
|
|
521
|
+
// when the lead or a page of leads holds one.
|
|
522
|
+
"leads.get": { perPage: 1, perWalk: 1 },
|
|
523
|
+
"leads.list": {
|
|
524
|
+
pageSize: PAGE_SIZE,
|
|
525
|
+
perPage: 1,
|
|
526
|
+
perPageAtMost: 2,
|
|
527
|
+
perWalk: 1
|
|
528
|
+
},
|
|
529
|
+
"lists.list": { pageSize: PAGE_SIZE, perPage: 1, perWalk: 1 },
|
|
530
|
+
"messages.list": { pageSize: PAGE_SIZE, perPage: 1, perWalk: 1 },
|
|
531
|
+
// The same label read, for a page of replies with a custom status.
|
|
532
|
+
"replies.list": {
|
|
533
|
+
pageSize: PAGE_SIZE,
|
|
534
|
+
perPage: 1,
|
|
535
|
+
perPageAtMost: 2,
|
|
536
|
+
perWalk: 1
|
|
537
|
+
},
|
|
521
538
|
"senders.get": { perPage: 1 },
|
|
522
539
|
// The account, its DNS test, then its warmup analytics.
|
|
523
540
|
"senders.health": { perPage: 3 },
|
|
524
|
-
"senders.list": { pageSize: PAGE_SIZE, perPage: 1 },
|
|
541
|
+
"senders.list": { pageSize: PAGE_SIZE, perPage: 1, perWalk: 1 },
|
|
525
542
|
"sequence.get": { perPage: 1 },
|
|
526
|
-
"sequence.subsequences": { pageSize: PAGE_SIZE, perPage: 1 },
|
|
543
|
+
"sequence.subsequences": { pageSize: PAGE_SIZE, perPage: 1, perWalk: 1 },
|
|
527
544
|
stats: { perPage: 1 },
|
|
528
|
-
"tags.list": { pageSize: PAGE_SIZE, perPage: 1 },
|
|
529
|
-
"webhooks.list": { pageSize: PAGE_SIZE, perPage: 1 },
|
|
545
|
+
"tags.list": { pageSize: PAGE_SIZE, perPage: 1, perWalk: 1 },
|
|
546
|
+
"webhooks.list": { pageSize: PAGE_SIZE, perPage: 1, perWalk: 1 },
|
|
530
547
|
"workspaces.list": { perPage: 1 }
|
|
531
548
|
};
|
|
532
549
|
var caveats = [
|
|
@@ -717,7 +734,9 @@ var listPage = async (client, ctx, path, query, filters = {}) => listEnvelope(
|
|
|
717
734
|
limit: pageSize(query.limit),
|
|
718
735
|
starting_after: after(query.next)
|
|
719
736
|
}
|
|
720
|
-
})
|
|
737
|
+
}),
|
|
738
|
+
client.identity.provider,
|
|
739
|
+
path
|
|
721
740
|
);
|
|
722
741
|
var readLookup = async (client, ctx, lookup, next) => {
|
|
723
742
|
const envelope = await listPage(
|
|
@@ -759,9 +778,9 @@ var accountReaders = (client) => {
|
|
|
759
778
|
return {
|
|
760
779
|
// The per-campaign report, asked for one campaign: an array of one row.
|
|
761
780
|
getCampaignProgress: async (id, ctx) => {
|
|
762
|
-
const rows =
|
|
763
|
-
|
|
764
|
-
);
|
|
781
|
+
const rows = await client.getRows(ctx, "/campaigns/analytics", {
|
|
782
|
+
query: { id }
|
|
783
|
+
});
|
|
765
784
|
const row = rows.find((each) => text(each.campaign_id) === id) ?? rows[0];
|
|
766
785
|
if (row === void 0) {
|
|
767
786
|
throw new OutboundError("NotFound", `Campaign ${id} was not found`, {
|
|
@@ -880,7 +899,9 @@ var listEmails = async (client, ctx, query, received) => {
|
|
|
880
899
|
search: threadId === void 0 ? void 0 : `thread:${threadId}`,
|
|
881
900
|
starting_after: cursor.after
|
|
882
901
|
}
|
|
883
|
-
})
|
|
902
|
+
}),
|
|
903
|
+
client.identity.provider,
|
|
904
|
+
"/emails"
|
|
884
905
|
);
|
|
885
906
|
const sent = envelope.items.filter((item) => !isScheduled(item));
|
|
886
907
|
return {
|
|
@@ -973,11 +994,9 @@ var range = (query) => ({
|
|
|
973
994
|
start_date: query.from
|
|
974
995
|
});
|
|
975
996
|
var senderStats = async (client, ctx, scope, query) => {
|
|
976
|
-
const days2 =
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
})
|
|
980
|
-
);
|
|
997
|
+
const days2 = await client.getRows(ctx, "/accounts/analytics/daily", {
|
|
998
|
+
query: { ...range(query), emails: scope.scopeId }
|
|
999
|
+
});
|
|
981
1000
|
return query.by === "day" ? days2.map((day) => dailyRow(scope, day)) : [summedRow(scope, days2)];
|
|
982
1001
|
};
|
|
983
1002
|
var readStats = async (client, ctx, query) => {
|
|
@@ -998,10 +1017,10 @@ var readStats = async (client, ctx, query) => {
|
|
|
998
1017
|
{ provider: identity.provider }
|
|
999
1018
|
);
|
|
1000
1019
|
}
|
|
1001
|
-
const campaigns = await client.
|
|
1020
|
+
const campaigns = await client.getRows(ctx, "/campaigns/analytics", {
|
|
1002
1021
|
query: range(query)
|
|
1003
1022
|
});
|
|
1004
|
-
return
|
|
1023
|
+
return campaigns.flatMap((campaign) => {
|
|
1005
1024
|
const scopeId = text(campaign.campaign_id);
|
|
1006
1025
|
return scopeId === null ? [] : [campaignRow({ ...scope, scopeId }, campaign)];
|
|
1007
1026
|
});
|
|
@@ -1016,16 +1035,16 @@ var readStats = async (client, ctx, query) => {
|
|
|
1016
1035
|
}
|
|
1017
1036
|
);
|
|
1018
1037
|
}
|
|
1019
|
-
const steps = await client.
|
|
1038
|
+
const steps = await client.getRows(ctx, "/campaigns/analytics/steps", {
|
|
1020
1039
|
query: { ...range(query), campaign_id: query.scopeId }
|
|
1021
1040
|
});
|
|
1022
|
-
return
|
|
1041
|
+
return steps.map((step) => stepRow(scope, step));
|
|
1023
1042
|
}
|
|
1024
1043
|
if (query.by === "day") {
|
|
1025
|
-
const days2 = await client.
|
|
1044
|
+
const days2 = await client.getRows(ctx, "/campaigns/analytics/daily", {
|
|
1026
1045
|
query: { ...range(query), campaign_id: query.scopeId }
|
|
1027
1046
|
});
|
|
1028
|
-
return
|
|
1047
|
+
return days2.map((day) => dailyRow(scope, day));
|
|
1029
1048
|
}
|
|
1030
1049
|
const overview = await client.getObject(
|
|
1031
1050
|
ctx,
|
|
@@ -1178,7 +1197,9 @@ var leadReaders = (client) => ({
|
|
|
1178
1197
|
return { items: [] };
|
|
1179
1198
|
}
|
|
1180
1199
|
const envelope = listEnvelope(
|
|
1181
|
-
await client.post(ctx, "/leads/list", leadListBody(query))
|
|
1200
|
+
await client.post(ctx, "/leads/list", leadListBody(query)),
|
|
1201
|
+
client.identity.provider,
|
|
1202
|
+
"/leads/list"
|
|
1182
1203
|
);
|
|
1183
1204
|
const labels = await readLabels(
|
|
1184
1205
|
client,
|
|
@@ -2575,6 +2596,13 @@ var createClient = (options) => {
|
|
|
2575
2596
|
options.identity.provider,
|
|
2576
2597
|
`Instantly returned no object for ${path}`
|
|
2577
2598
|
),
|
|
2599
|
+
getRows: async (ctx, path, request) => objects(
|
|
2600
|
+
listIn(await http.get(ctx, path, request), {
|
|
2601
|
+
path,
|
|
2602
|
+
provider: options.identity.provider,
|
|
2603
|
+
vendor: "Instantly"
|
|
2604
|
+
})
|
|
2605
|
+
),
|
|
2578
2606
|
identity: options.identity,
|
|
2579
2607
|
raw: { authorize, baseUrl, isRead, isSecret },
|
|
2580
2608
|
readTags: options.readTags
|
package/dist/instantly/map.d.ts
CHANGED
|
@@ -18,5 +18,9 @@ export interface ListEnvelope {
|
|
|
18
18
|
readonly items: JsonObject[];
|
|
19
19
|
readonly next: string | undefined;
|
|
20
20
|
}
|
|
21
|
-
/**
|
|
22
|
-
|
|
21
|
+
/**
|
|
22
|
+
* `{ items, next_starting_after }`: the shape of every Instantly list, with
|
|
23
|
+
* `items` required. Any other answer, a bare array included, is a `Provider`
|
|
24
|
+
* error naming `path`.
|
|
25
|
+
*/
|
|
26
|
+
export declare const listEnvelope: (body: Json, provider: string, path: string) => ListEnvelope;
|
|
@@ -139,6 +139,18 @@ export interface OperationCost {
|
|
|
139
139
|
readonly pageSize?: number | undefined;
|
|
140
140
|
/** Extra requests per record, for example one per lead to fetch a body. */
|
|
141
141
|
readonly perRecord?: number | undefined;
|
|
142
|
+
/**
|
|
143
|
+
* The most extra requests a listing makes once, whatever its length, for
|
|
144
|
+
* example a lookup of category names on its first page. Counted in the
|
|
145
|
+
* upper bound of an insight's cost, never in its lower bound.
|
|
146
|
+
*/
|
|
147
|
+
readonly perWalk?: number | undefined;
|
|
148
|
+
/**
|
|
149
|
+
* The most requests one page can cost, when some pages cost more than
|
|
150
|
+
* `perPage`, for example a label lookup made only when a page holds a
|
|
151
|
+
* custom label. Counted in the upper bound of an insight's cost only.
|
|
152
|
+
*/
|
|
153
|
+
readonly perPageAtMost?: number | undefined;
|
|
142
154
|
}
|
|
143
155
|
export interface Adapter<Native extends NativeCatalog = NoNative> {
|
|
144
156
|
readonly name: string;
|
|
@@ -15,6 +15,11 @@ export interface CallState {
|
|
|
15
15
|
readonly deadlineAt: number | undefined;
|
|
16
16
|
/** Stop after this many vendor requests. A plugin may lower it. */
|
|
17
17
|
maxRequests: number | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* The setting to raise when `maxRequests` stops the call, named in the
|
|
20
|
+
* error. Defaults to "maxRequests". A plugin that lowers the cap sets it.
|
|
21
|
+
*/
|
|
22
|
+
maxRequestsSetBy: string | undefined;
|
|
18
23
|
/**
|
|
19
24
|
* Runs as each vendor request is about to be sent, after any wait, with no
|
|
20
25
|
* other request able to slip in between. A plugin that caps requests across
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
export
|
|
2
|
+
import { campaignStatusSchema, replyCategorySchema } from "./vocabulary.ts";
|
|
3
|
+
export { campaignStatusSchema, replyCategorySchema, SCHEMA_VERSION, } from "./vocabulary.ts";
|
|
4
4
|
/** The fields every entity carries. */
|
|
5
5
|
export declare const baseFields: {
|
|
6
6
|
provider: z.ZodString;
|
|
@@ -17,14 +17,6 @@ export declare const channelSchema: z.ZodEnum<{
|
|
|
17
17
|
linkedin: "linkedin";
|
|
18
18
|
}>;
|
|
19
19
|
export type Channel = z.infer<typeof channelSchema>;
|
|
20
|
-
export declare const campaignStatusSchema: z.ZodEnum<{
|
|
21
|
-
active: "active";
|
|
22
|
-
archived: "archived";
|
|
23
|
-
completed: "completed";
|
|
24
|
-
draft: "draft";
|
|
25
|
-
paused: "paused";
|
|
26
|
-
unknown: "unknown";
|
|
27
|
-
}>;
|
|
28
20
|
export type CampaignStatus = z.infer<typeof campaignStatusSchema>;
|
|
29
21
|
export declare const campaignSchema: z.ZodObject<{
|
|
30
22
|
channel: z.ZodEnum<{
|
|
@@ -149,15 +141,6 @@ export declare const senderSchema: z.ZodObject<{
|
|
|
149
141
|
workspaceId: z.ZodString;
|
|
150
142
|
}, z.core.$strip>;
|
|
151
143
|
export type Sender = z.infer<typeof senderSchema>;
|
|
152
|
-
export declare const replyCategorySchema: z.ZodEnum<{
|
|
153
|
-
unknown: "unknown";
|
|
154
|
-
bounce: "bounce";
|
|
155
|
-
negative: "negative";
|
|
156
|
-
neutral: "neutral";
|
|
157
|
-
ooo: "ooo";
|
|
158
|
-
positive: "positive";
|
|
159
|
-
unsubscribe: "unsubscribe";
|
|
160
|
-
}>;
|
|
161
144
|
export type ReplyCategory = z.infer<typeof replyCategorySchema>;
|
|
162
145
|
export declare const leadStatusSchema: z.ZodEnum<{
|
|
163
146
|
active: "active";
|
|
@@ -252,8 +235,8 @@ export declare const leadSchema: z.ZodObject<{
|
|
|
252
235
|
export type Lead = z.infer<typeof leadSchema>;
|
|
253
236
|
export declare const messageSchema: z.ZodObject<{
|
|
254
237
|
direction: z.ZodEnum<{
|
|
255
|
-
in: "in";
|
|
256
238
|
out: "out";
|
|
239
|
+
in: "in";
|
|
257
240
|
}>;
|
|
258
241
|
bodyHtml: z.ZodNullable<z.ZodString>;
|
|
259
242
|
bodyText: z.ZodNullable<z.ZodString>;
|
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
import type { Json, JsonObject } from "./json.ts";
|
|
2
2
|
export type OutboundErrorCode = "Invalid" | "NotFound" | "Provider" | "RateLimited" | "Unauthorized" | "Unsupported";
|
|
3
|
+
/**
|
|
4
|
+
* What stopped a `RateLimited` call.
|
|
5
|
+
*
|
|
6
|
+
* - `vendor`: the vendor answered 429 and the SDK's retries did not get past it.
|
|
7
|
+
* - `deadline`: the SDK's own rate budget was full, and waiting for room
|
|
8
|
+
* would pass the call's `deadline`. No request was sent.
|
|
9
|
+
* - `call`: the call reached its request cap (`maxRequests` on the call or on
|
|
10
|
+
* `createOutbound`, or `budget({ per: "call" })`).
|
|
11
|
+
* - `run`: a `budget({ per: "run" })` has nothing left.
|
|
12
|
+
*
|
|
13
|
+
* `vendor` and `deadline` can work later. `call` and `run` are caps you set,
|
|
14
|
+
* so the same call stops the same way until you raise or reset them.
|
|
15
|
+
*/
|
|
16
|
+
export type RequestLimit = "call" | "deadline" | "run" | "vendor";
|
|
17
|
+
/**
|
|
18
|
+
* What a `listAll().toArray()` walk had fetched when it stopped. Resume with
|
|
19
|
+
* `listAll({ cursor })`: no record is skipped or repeated.
|
|
20
|
+
*/
|
|
21
|
+
export interface PartialWalk {
|
|
22
|
+
/** The records fetched before the stop, in order. */
|
|
23
|
+
readonly items: readonly unknown[];
|
|
24
|
+
/** Where to resume. `undefined` when no page was finished: start over. */
|
|
25
|
+
readonly cursor: string | undefined;
|
|
26
|
+
/** Vendor requests the walk made, including the one that failed. */
|
|
27
|
+
readonly requests: number;
|
|
28
|
+
}
|
|
3
29
|
export interface OutboundErrorOptions {
|
|
4
30
|
/**
|
|
5
31
|
* The original error or vendor response, for debugging. It is kept as a
|
|
@@ -14,6 +40,13 @@ export interface OutboundErrorOptions {
|
|
|
14
40
|
readonly retryAfterMs?: number | undefined;
|
|
15
41
|
readonly aborted?: boolean | undefined;
|
|
16
42
|
readonly timedOut?: boolean | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* What stopped a `RateLimited` call. Defaults to `vendor` when there is an
|
|
45
|
+
* HTTP status. A `call` or `run` cap makes the error permanent.
|
|
46
|
+
*/
|
|
47
|
+
readonly limit?: RequestLimit | undefined;
|
|
48
|
+
/** What a `toArray()` walk had fetched when it stopped. */
|
|
49
|
+
readonly partial?: PartialWalk | undefined;
|
|
17
50
|
/** Secrets to strip from the message. */
|
|
18
51
|
readonly secrets?: readonly string[] | undefined;
|
|
19
52
|
}
|
|
@@ -29,6 +62,17 @@ export declare class OutboundError extends Error {
|
|
|
29
62
|
readonly retryAfterMs: number | undefined;
|
|
30
63
|
readonly aborted: boolean;
|
|
31
64
|
readonly timedOut: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* What stopped a `RateLimited` call: the vendor, a deadline, or a request
|
|
67
|
+
* cap of your own. `undefined` on every other code.
|
|
68
|
+
*/
|
|
69
|
+
readonly limit: RequestLimit | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Set when `listAll().toArray()` stopped part way: the records it had
|
|
72
|
+
* fetched and the cursor to resume from. A partial answer is never returned
|
|
73
|
+
* as if it were complete.
|
|
74
|
+
*/
|
|
75
|
+
readonly partial: PartialWalk | undefined;
|
|
32
76
|
/** `true` when retrying the same call cannot succeed. */
|
|
33
77
|
readonly permanent: boolean;
|
|
34
78
|
readonly [BRAND] = true;
|
|
@@ -162,8 +162,8 @@ export declare const RECORD_SCHEMAS: {
|
|
|
162
162
|
}, z.core.$strip>;
|
|
163
163
|
readonly message: z.ZodObject<{
|
|
164
164
|
direction: z.ZodEnum<{
|
|
165
|
-
in: "in";
|
|
166
165
|
out: "out";
|
|
166
|
+
in: "in";
|
|
167
167
|
}>;
|
|
168
168
|
bodyHtml: z.ZodNullable<z.ZodString>;
|
|
169
169
|
bodyText: z.ZodNullable<z.ZodString>;
|
package/dist/internal/json.d.ts
CHANGED
|
@@ -36,9 +36,16 @@ export declare const compactObject: (entries: Readonly<Record<string, Json | und
|
|
|
36
36
|
*/
|
|
37
37
|
export declare const toJson: <Value>(value: Value) => Json;
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
39
|
+
* `toJson`, or `undefined` for a value `JSON.stringify` cannot write (a
|
|
40
|
+
* BigInt, a cycle). For an input from a caller, such as a tool's.
|
|
41
41
|
*/
|
|
42
|
+
export declare const jsonInput: <Value>(value: Value) => Json | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Says which of the `given` keys is not one of `known`, or `undefined` when
|
|
45
|
+
* every one is. Used so an input that would be ignored is refused instead.
|
|
46
|
+
*/
|
|
47
|
+
export declare const strayKey: (known: readonly string[], given: readonly string[], noun?: string) => string | undefined;
|
|
48
|
+
/** `strayKey` for a JSON input: which key of `input` is not one of `known`. */
|
|
42
49
|
export declare const unknownKey: (known: readonly string[], input: Json | undefined) => string | undefined;
|
|
43
50
|
/**
|
|
44
51
|
* A copy of `value` without any key that matches `secret`, at any depth. A
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Json } from "./json.ts";
|
|
2
|
+
/**
|
|
3
|
+
* A vendor list that must be a JSON array. Anything else is a `Provider`
|
|
4
|
+
* error with `status: 200`, the answer it was found in.
|
|
5
|
+
*/
|
|
6
|
+
export declare const requireList: (value: Json | undefined, provider: string, message: string) => Json[];
|
|
7
|
+
export interface ListPlace {
|
|
8
|
+
/** The vendor as a person names it: `Instantly`. */
|
|
9
|
+
readonly vendor: string;
|
|
10
|
+
/** The adapter's provider name, for the error. */
|
|
11
|
+
readonly provider: string;
|
|
12
|
+
/** The request, as the error names it: `/campaigns`. */
|
|
13
|
+
readonly path: string;
|
|
14
|
+
/** The field of the answer that holds the array. Omitted when the answer is the array. */
|
|
15
|
+
readonly key?: string | undefined;
|
|
16
|
+
}
|
|
17
|
+
/** The message for an answer that is not the documented list. */
|
|
18
|
+
export declare const noListMessage: (place: ListPlace) => string;
|
|
19
|
+
/**
|
|
20
|
+
* The array a vendor answer holds under `place.key`, or the answer itself
|
|
21
|
+
* when it has no key. Anything else is a `Provider` error that says what was
|
|
22
|
+
* expected.
|
|
23
|
+
*/
|
|
24
|
+
export declare const listIn: (body: Json | undefined, place: ListPlace) => Json[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** A count for a sentence, with thousands separators and at most one decimal: `2,000`, `1.5`. */
|
|
2
|
+
export declare const count: (amount: number) => string;
|
|
3
|
+
/** A rate in percent points with at most one decimal and no sign: `0.0525` as `5.3`, `0.05` as `5`. */
|
|
4
|
+
export declare const points: (rate: number) => string;
|
|
5
|
+
/** A rate as a percent: `0.0525` as `5.3%`, `0.05` as `5%`. */
|
|
6
|
+
export declare const percentOf: (rate: number) => string;
|
|
7
|
+
/** `1 lead`, `2,000 leads`. Pass `many` when adding an `s` is wrong. */
|
|
8
|
+
export declare const plural: (amount: number, one: string, many?: string) => string;
|
|
@@ -11,6 +11,10 @@ export interface PageRequest {
|
|
|
11
11
|
export interface ListSpec<Item, Filters> {
|
|
12
12
|
readonly action: OperationKind;
|
|
13
13
|
readonly schema: ZodType<Item>;
|
|
14
|
+
/** Every filter the listing takes. Any other key is refused, so a misspelt filter cannot widen the answer. */
|
|
15
|
+
readonly takes: {
|
|
16
|
+
readonly [Key in keyof Filters]-?: true;
|
|
17
|
+
};
|
|
14
18
|
/** Checks the filters and the capabilities they need. Returns clean filters. */
|
|
15
19
|
readonly prepare: (filters: Filters) => Filters;
|
|
16
20
|
readonly toOperation: (filters: Filters, page: PageRequest) => Operation;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Adapter } from "../adapter.ts";
|
|
1
2
|
import type { NativeCatalog, NoNative } from "../native.ts";
|
|
2
3
|
import { Outbound } from "./outbound.ts";
|
|
3
4
|
import type { OutboundOptions } from "./outbound.ts";
|
|
@@ -6,11 +7,31 @@ type ExtensionOf<Plugin> = Plugin extends OutboundPlugin<infer Extension> ? unkn
|
|
|
6
7
|
type UnionToIntersection<Union> = (Union extends unknown ? (value: Union) => void : never) extends (value: infer Intersection) => void ? Intersection : never;
|
|
7
8
|
/** The methods a list of plugins adds to the instance. */
|
|
8
9
|
export type ExtensionsOf<Plugins extends readonly OutboundPlugin[]> = UnionToIntersection<ExtensionOf<Plugins[number]>>;
|
|
10
|
+
/**
|
|
11
|
+
* The type of an instance built with these plugins, for a function that
|
|
12
|
+
* takes one:
|
|
13
|
+
*
|
|
14
|
+
* ```ts
|
|
15
|
+
* const plugins = [insights(), exporter()];
|
|
16
|
+
* type MyOutbound = OutboundWith<typeof plugins>;
|
|
17
|
+
* const brief = async (outbound: MyOutbound) => outbound.insights.hotLeads({});
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* `Outbound` alone is an instance with no plugins.
|
|
21
|
+
*/
|
|
22
|
+
export type OutboundWith<Plugins extends readonly OutboundPlugin[] = [], Native extends NativeCatalog = NoNative> = Outbound<Native> & ExtensionsOf<Plugins>;
|
|
23
|
+
/**
|
|
24
|
+
* The native catalog of an adapter type. A union of adapters, as from
|
|
25
|
+
* `cond ? smartlead() : instantly()`, gives the union of their catalogs, so
|
|
26
|
+
* only the reads they share are typed.
|
|
27
|
+
*/
|
|
28
|
+
export type NativeOf<Given> = Given extends Adapter<infer Native> ? Native : NoNative;
|
|
9
29
|
/**
|
|
10
30
|
* Creates the client. One instance wraps one adapter; `combine()` puts
|
|
11
31
|
* several adapters behind one.
|
|
12
32
|
*/
|
|
13
|
-
export declare const createOutbound: <const Plugins extends readonly OutboundPlugin[] = [],
|
|
14
|
-
readonly
|
|
15
|
-
|
|
33
|
+
export declare const createOutbound: <const Plugins extends readonly OutboundPlugin[] = [], const Given extends Adapter<NativeCatalog> = Adapter>(options: Omit<OutboundOptions, "adapter"> & {
|
|
34
|
+
readonly adapter: Given;
|
|
35
|
+
readonly plugins?: Plugins | readonly Plugins[number][] | undefined;
|
|
36
|
+
}) => NoInfer<OutboundWith<Plugins, NativeOf<Given>>>;
|
|
16
37
|
export {};
|
|
@@ -9,10 +9,24 @@ import type { Campaign, Lead, Message, Reply, Sender, Workspace } from "../entit
|
|
|
9
9
|
import type { FieldCoverage } from "../fields.ts";
|
|
10
10
|
import type { OutboundHooks } from "../hooks.ts";
|
|
11
11
|
import type { NativeCatalog, NoNative } from "../native.ts";
|
|
12
|
+
import { CAPPED } from "../request-cap.ts";
|
|
13
|
+
import type { CappedAccess } from "../request-cap.ts";
|
|
12
14
|
import type { CampaignFilters, CampaignHandle, Collection, Estimate, EstimateQuery, LeadFilters, LeadHandle, ListHandle, MessageFilters, NativeClient, OutboundApi, RawClient, ReadCollection, ReplyFilters, SenderFilters, SenderHandle, StatsResult, ThreadHandle, TopLevelStatsOptions, WebhookFilters } from "./api.ts";
|
|
13
15
|
import type { OutboundPlugin } from "./plugins.ts";
|
|
14
|
-
export interface OutboundOptions<Native extends NativeCatalog = NoNative> extends OperationOptions {
|
|
16
|
+
export interface OutboundOptions<Native extends NativeCatalog = NoNative> extends Omit<OperationOptions, "maxRequests"> {
|
|
15
17
|
readonly adapter: Adapter<Native>;
|
|
18
|
+
/**
|
|
19
|
+
* The most vendor requests each SDK call may send, retries included. It is
|
|
20
|
+
* not a total for the instance: for that, use `budget({ maxRequests })`.
|
|
21
|
+
* A `maxRequests` on one call replaces it for that call.
|
|
22
|
+
*/
|
|
23
|
+
readonly maxRequestsPerCall?: number | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated Use `maxRequestsPerCall`. On `createOutbound` this caps each
|
|
26
|
+
* call, not the whole run. It keeps working, with a warning, until a later
|
|
27
|
+
* minor version removes it.
|
|
28
|
+
*/
|
|
29
|
+
readonly maxRequests?: number | undefined;
|
|
16
30
|
/** `plugins[0]` is the outermost layer. */
|
|
17
31
|
readonly plugins?: readonly OutboundPlugin[] | undefined;
|
|
18
32
|
readonly hooks?: OutboundHooks | undefined;
|
|
@@ -42,7 +56,7 @@ export declare class Outbound<Native extends NativeCatalog = NoNative> implement
|
|
|
42
56
|
readonly webhooks: Collection<WebhookSubscription, WebhookFilters>;
|
|
43
57
|
readonly raw: RawClient;
|
|
44
58
|
readonly native: NativeClient<Native>;
|
|
45
|
-
constructor(options: OutboundOptions<Native>, engine?: RequestEngine);
|
|
59
|
+
constructor(options: OutboundOptions<Native>, engine?: RequestEngine, layers?: readonly OutboundPlugin[]);
|
|
46
60
|
get provider(): string;
|
|
47
61
|
get workspaceId(): string;
|
|
48
62
|
get capabilities(): Capabilities;
|
|
@@ -61,6 +75,8 @@ export declare class Outbound<Native extends NativeCatalog = NoNative> implement
|
|
|
61
75
|
* plugins and what they add, so `outbound.workspace(id).insights` works.
|
|
62
76
|
*/
|
|
63
77
|
workspace(id: string): this;
|
|
78
|
+
/** For a cap shared across calls, as insights and tools use. Not public. */
|
|
79
|
+
get [CAPPED](): CappedAccess;
|
|
64
80
|
stats(options?: TopLevelStatsOptions): Promise<StatsResult>;
|
|
65
81
|
limits(): Promise<LimitsSnapshot[]>;
|
|
66
82
|
estimate(query: EstimateQuery): Estimate;
|
|
@@ -2,4 +2,8 @@ import type { TimeRange } from "../adapter.ts";
|
|
|
2
2
|
export declare const normalizeRange: (range: TimeRange) => TimeRange;
|
|
3
3
|
export declare const assertDay: (value: string | undefined, name: string) => string | undefined;
|
|
4
4
|
export declare const assertLimit: (limit: number | undefined) => number | undefined;
|
|
5
|
+
/** `max` for `listAll`: a positive integer, like `limit`. */
|
|
6
|
+
export declare const assertMax: (max: number | undefined) => number | undefined;
|
|
7
|
+
/** A plain JavaScript caller can pass anything as an id. */
|
|
8
|
+
export declare const assertIdIsString: (id: string, what: string) => string;
|
|
5
9
|
export declare const assertId: (id: string, what: string) => string;
|
|
@@ -3,10 +3,11 @@ import type { ListAll, PageResult, ResultMeta } from "./api.ts";
|
|
|
3
3
|
export interface WalkerOptions<Item> {
|
|
4
4
|
readonly cursor: string | undefined;
|
|
5
5
|
readonly max: number | undefined;
|
|
6
|
+
/** Starts the call's accounting, when the first page is asked for. */
|
|
7
|
+
readonly begin: () => CallState;
|
|
6
8
|
/** Fetches one page. `state` is shared by every page of the walk. */
|
|
7
|
-
readonly fetchPage: (cursor: string | undefined, state: CallState
|
|
9
|
+
readonly fetchPage: (cursor: string | undefined, state: CallState) => Promise<{
|
|
8
10
|
readonly page: PageResult<Item>;
|
|
9
|
-
readonly state: CallState;
|
|
10
11
|
}>;
|
|
11
12
|
/** A stable key used to drop records a shifting page returned twice. */
|
|
12
13
|
readonly keyOf: (item: Item) => string | undefined;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The word that goes with `amount`: `one` for exactly one, `many` otherwise.
|
|
3
|
+
* Works for verbs too: `noun(count, "is", "are")`.
|
|
4
|
+
*/
|
|
5
|
+
export declare const noun: (amount: number, one: string, many?: string) => string;
|
|
6
|
+
/** `1 lead`, `3 leads`. Pass `many` when adding an `s` is wrong. */
|
|
7
|
+
export declare const plural: (amount: number, one: string, many?: string) => string;
|
|
8
|
+
/**
|
|
9
|
+
* A person key as a person reads it: `email:jo@example.com` is the address,
|
|
10
|
+
* `linkedin:jo-doe` the profile's address without `https://www.`.
|
|
11
|
+
*/
|
|
12
|
+
export declare const shownKey: (key: string) => string;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { ZodType } from "zod";
|
|
3
|
+
import type { Json } from "./json.ts";
|
|
4
|
+
/** The fields of an object schema, by name. */
|
|
5
|
+
type Fields = Readonly<Record<string, ZodType>>;
|
|
6
|
+
/**
|
|
7
|
+
* The old name of the field `to`. Pass the new field's schema without its
|
|
8
|
+
* default, so leaving the old name out does not set it.
|
|
9
|
+
*/
|
|
10
|
+
export declare const renamed: <Schema extends ZodType>(to: string, base: Schema) => z.ZodOptional<Schema>;
|
|
11
|
+
/** The field names without the deprecated old names. */
|
|
12
|
+
export declare const liveKeys: (fields: Fields) => string[];
|
|
13
|
+
export type Renamed = {
|
|
14
|
+
readonly input: Json | undefined;
|
|
15
|
+
readonly notes: readonly string[];
|
|
16
|
+
} | {
|
|
17
|
+
readonly conflict: {
|
|
18
|
+
readonly from: string;
|
|
19
|
+
readonly to: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* The input with each old name's value moved to its new name, and a note
|
|
24
|
+
* for each old name used. Both names at once is a conflict, since either
|
|
25
|
+
* value could be the one meant.
|
|
26
|
+
*/
|
|
27
|
+
export declare const applyRenames: (fields: Fields, input: Json | undefined) => Renamed;
|
|
28
|
+
export {};
|