outbound-sdk 0.1.0 → 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/README.md +0 -2
- package/dist/alerts/index.js +5 -1
- package/dist/audit/index.js +2 -2
- package/dist/benchmarks/index.js +5 -3
- package/dist/budget/index.js +31 -10
- package/dist/cache/index.js +2 -2
- package/dist/cards/index.js +1 -1
- package/dist/chunks/{chunk-WAM6N4OF.js → chunk-4PSO6JEK.js} +107 -19
- package/dist/chunks/chunk-6CVZOUHB.js +152 -0
- package/dist/chunks/{chunk-OCV66TS2.js → chunk-AFU5E5QB.js} +17 -8
- package/dist/chunks/{chunk-R6AM4GJR.js → chunk-DJ2IUQEU.js} +24 -18
- package/dist/chunks/{chunk-LOXBLQ3I.js → chunk-E7JHLNLG.js} +9 -2
- package/dist/chunks/{chunk-LNCOGBMI.js → chunk-FHKSLCVW.js} +13 -3
- package/dist/chunks/chunk-FKH5N47I.js +40 -0
- package/dist/chunks/chunk-HZCTYL22.js +29 -0
- package/dist/chunks/{chunk-CMQ5ZHLZ.js → chunk-IPUYZD4O.js} +1 -1
- package/dist/chunks/{chunk-VURTOVGI.js → chunk-IVH3NMQZ.js} +1 -1
- package/dist/chunks/{chunk-ZGHQYZEH.js → chunk-LVYG7XZJ.js} +1 -1
- package/dist/chunks/chunk-NAKXLBA6.js +30 -0
- package/dist/chunks/{chunk-7BCYLIDG.js → chunk-PMSSUWD7.js} +186 -33
- package/dist/chunks/{chunk-Q465X22Y.js → chunk-PURHK3JU.js} +93 -209
- package/dist/chunks/{chunk-F7MKFVIG.js → chunk-R3Y56YVF.js} +2 -2
- package/dist/chunks/chunk-RCZ7ZZFU.js +92 -0
- package/dist/chunks/chunk-SBIZDCRY.js +106 -0
- package/dist/chunks/{chunk-IBC52BX3.js → chunk-U2D34ARZ.js} +20 -3
- package/dist/chunks/chunk-UAT3JSJZ.js +331 -0
- package/dist/chunks/{chunk-QZNNCXXD.js → chunk-VQSCHOBV.js} +20 -1
- package/dist/chunks/{chunk-B7V6EOAC.js → chunk-XNFESPZH.js} +160 -126
- package/dist/chunks/{chunk-WW746NJF.js → chunk-YOTW5ESM.js} +25 -1
- package/dist/cli/bin.js +14 -13
- package/dist/cli/commands.d.ts +3 -0
- package/dist/cli/config.d.ts +22 -0
- package/dist/cli/index.d.ts +5 -1
- package/dist/cli/index.js +20 -15
- package/dist/cli/stdio.d.ts +9 -0
- package/dist/clients/index.js +13 -3
- package/dist/combine/account.d.ts +1 -1
- package/dist/combine/index.js +90 -15
- package/dist/combine/route.d.ts +7 -0
- package/dist/exporter/index.js +2 -2
- package/dist/failover/index.js +4 -4
- package/dist/fixtures/index.js +40 -21
- package/dist/heyreach/account.d.ts +1 -1
- package/dist/heyreach/adapter.d.ts +1 -1
- package/dist/heyreach/capabilities.d.ts +2 -0
- package/dist/heyreach/client.d.ts +3 -5
- package/dist/heyreach/index.d.ts +7 -0
- package/dist/heyreach/index.js +428 -205
- package/dist/heyreach/leads.d.ts +4 -0
- package/dist/heyreach/map-account.d.ts +7 -1
- package/dist/heyreach/map-stats.d.ts +8 -5
- package/dist/heyreach/map.d.ts +3 -1
- package/dist/heyreach/webhooks.d.ts +1 -0
- package/dist/identity/index.js +22 -11
- package/dist/index.d.ts +1 -4
- package/dist/index.js +29 -17
- package/dist/insights/copy/index.d.ts +2 -2
- package/dist/insights/copy/variant-test.d.ts +2 -2
- package/dist/insights/index.js +248 -184
- package/dist/insights/ops/anomalies.d.ts +3 -3
- package/dist/insights/ops/index.d.ts +2 -2
- package/dist/insights/ops/shared.d.ts +7 -1
- package/dist/insights/registry.d.ts +4 -4
- package/dist/instantly/adapter-account.d.ts +1 -1
- package/dist/instantly/capabilities.d.ts +2 -0
- package/dist/instantly/client.d.ts +4 -9
- package/dist/instantly/index.d.ts +7 -0
- package/dist/instantly/index.js +410 -155
- package/dist/instantly/map-account.d.ts +20 -5
- package/dist/instantly/map-stats.d.ts +9 -6
- package/dist/instantly/map.d.ts +0 -2
- package/dist/instantly/native-agents-sales.d.ts +41 -41
- package/dist/instantly/native-agents.d.ts +44 -44
- package/dist/instantly/native-campaigns.d.ts +21 -21
- package/dist/instantly/native-leads.d.ts +12 -12
- package/dist/instantly/native-params.d.ts +2 -19
- package/dist/instantly/native-search.d.ts +10 -10
- package/dist/instantly/native-senders.d.ts +56 -56
- package/dist/instantly/native-supersearch.d.ts +33 -33
- package/dist/instantly/native-workspace.d.ts +45 -45
- package/dist/instantly/native.d.ts +262 -262
- package/dist/instantly/webhooks.d.ts +1 -0
- package/dist/internal/adapter.d.ts +24 -2
- package/dist/internal/capabilities.d.ts +18 -0
- package/dist/internal/client.d.ts +15 -0
- package/dist/internal/concurrency.d.ts +8 -0
- package/dist/internal/engine/request.d.ts +7 -0
- package/dist/internal/entities-account.d.ts +73 -3
- package/dist/internal/entities.d.ts +116 -12
- package/dist/internal/errors.d.ts +6 -1
- package/dist/internal/fields.d.ts +462 -0
- package/dist/internal/json.d.ts +9 -0
- package/dist/internal/lead-fields.d.ts +21 -0
- package/dist/internal/lead-status.d.ts +13 -0
- package/dist/internal/metrics.d.ts +14 -2
- package/dist/internal/native.d.ts +15 -0
- package/dist/internal/outbound/api.d.ts +29 -4
- package/dist/internal/outbound/operations-account.d.ts +12 -0
- package/dist/internal/outbound/outbound.d.ts +6 -3
- package/dist/internal/outbound/specs-account.d.ts +5 -1
- package/dist/internal/page.d.ts +14 -0
- package/dist/internal/record.d.ts +17 -0
- package/dist/internal/records.d.ts +7 -0
- package/dist/internal/sequence.d.ts +14 -0
- package/dist/internal/sha256.d.ts +2 -0
- package/dist/loader/index.d.ts +14 -2
- package/dist/loader/index.js +8 -4
- package/dist/memory/account-reads.d.ts +1 -1
- package/dist/memory/account.d.ts +15 -1
- package/dist/memory/data.d.ts +17 -2
- package/dist/memory/index.js +110 -35
- package/dist/redact/index.js +11 -6
- package/dist/redact/plugin.d.ts +1 -1
- package/dist/smartlead/account.d.ts +1 -1
- package/dist/smartlead/adapter.d.ts +1 -1
- package/dist/smartlead/capabilities.d.ts +2 -0
- package/dist/smartlead/client.d.ts +6 -11
- package/dist/smartlead/hmac.d.ts +0 -2
- package/dist/smartlead/index.d.ts +7 -0
- package/dist/smartlead/index.js +731 -572
- package/dist/smartlead/leads.d.ts +4 -1
- package/dist/smartlead/map-account.d.ts +17 -5
- package/dist/smartlead/map-stats.d.ts +9 -10
- package/dist/smartlead/map.d.ts +15 -5
- package/dist/smartlead/native-analytics.d.ts +87 -87
- package/dist/smartlead/native-campaigns.d.ts +64 -64
- package/dist/smartlead/native-inbox.d.ts +51 -51
- package/dist/smartlead/native-params.d.ts +2 -23
- package/dist/smartlead/native-services.d.ts +34 -34
- package/dist/smartlead/native.d.ts +236 -236
- package/dist/smartlead/shared.d.ts +6 -5
- package/dist/smartlead/webhooks.d.ts +1 -0
- package/dist/sync/index.js +3 -3
- package/dist/tools/ai-sdk.js +7 -5
- package/dist/tools/campaign-tools.d.ts +1 -1
- package/dist/tools/claude-agent.js +7 -5
- package/dist/tools/index.js +8 -6
- package/dist/tracing/index.js +2 -2
- package/dist/webhooks/index.js +10 -9
- package/package.json +1 -1
- package/dist/chunks/chunk-FZF6CLPX.js +0 -232
- package/dist/chunks/chunk-GPEJG34O.js +0 -53
- package/dist/chunks/chunk-HEC7XFFH.js +0 -65
- package/dist/chunks/chunk-QTB747K4.js +0 -100
- package/dist/chunks/chunk-TIJKJJDW.js +0 -6
|
@@ -3,12 +3,21 @@ import type { DispatchTarget, OperationOutput } from "./operation-shared.ts";
|
|
|
3
3
|
export type AccountOperation = {
|
|
4
4
|
readonly kind: "blocklist.list";
|
|
5
5
|
readonly query: PageQuery;
|
|
6
|
+
} | {
|
|
7
|
+
readonly kind: "campaigns.progress";
|
|
8
|
+
readonly id: string;
|
|
6
9
|
} | {
|
|
7
10
|
readonly kind: "campaigns.settings";
|
|
8
11
|
readonly id: string;
|
|
12
|
+
} | {
|
|
13
|
+
readonly kind: "lists.get";
|
|
14
|
+
readonly id: string;
|
|
9
15
|
} | {
|
|
10
16
|
readonly kind: "lists.list";
|
|
11
17
|
readonly query: PageQuery;
|
|
18
|
+
} | {
|
|
19
|
+
readonly kind: "placementTests.list";
|
|
20
|
+
readonly query: PageQuery;
|
|
12
21
|
} | {
|
|
13
22
|
readonly kind: "senders.health";
|
|
14
23
|
readonly id: string;
|
|
@@ -18,6 +27,9 @@ export type AccountOperation = {
|
|
|
18
27
|
} | {
|
|
19
28
|
readonly kind: "tags.list";
|
|
20
29
|
readonly query: PageQuery;
|
|
30
|
+
} | {
|
|
31
|
+
readonly kind: "webhooks.get";
|
|
32
|
+
readonly id: string;
|
|
21
33
|
} | {
|
|
22
34
|
readonly kind: "webhooks.list";
|
|
23
35
|
readonly query: WebhookQuery;
|
|
@@ -4,8 +4,9 @@ import { RequestEngine } from "../engine/engine.ts";
|
|
|
4
4
|
import type { LimitsSnapshot, OperationOptions } from "../engine/engine.ts";
|
|
5
5
|
import type { RateLimitStore } from "../engine/rate-store.ts";
|
|
6
6
|
import type { Runtime } from "../engine/runtime.ts";
|
|
7
|
-
import type { BlockEntry, LeadList, Tag, WebhookSubscription } from "../entities-account.ts";
|
|
7
|
+
import type { BlockEntry, LeadList, PlacementTest, Tag, WebhookSubscription } from "../entities-account.ts";
|
|
8
8
|
import type { Campaign, Lead, Message, Reply, Sender, Workspace } from "../entities.ts";
|
|
9
|
+
import type { FieldCoverage } from "../fields.ts";
|
|
9
10
|
import type { OutboundHooks } from "../hooks.ts";
|
|
10
11
|
import type { NativeCatalog, NoNative } from "../native.ts";
|
|
11
12
|
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";
|
|
@@ -34,10 +35,11 @@ export declare class Outbound<Native extends NativeCatalog = NoNative> implement
|
|
|
34
35
|
readonly messages: ReadCollection<Message, MessageFilters>;
|
|
35
36
|
readonly replies: ReadCollection<Reply, ReplyFilters>;
|
|
36
37
|
readonly workspaces: ReadCollection<Workspace, Record<never, never>>;
|
|
37
|
-
readonly lists:
|
|
38
|
+
readonly lists: Collection<LeadList, Record<never, never>>;
|
|
38
39
|
readonly blocklist: ReadCollection<BlockEntry, Record<never, never>>;
|
|
39
40
|
readonly tags: ReadCollection<Tag, Record<never, never>>;
|
|
40
|
-
readonly
|
|
41
|
+
readonly placementTests: ReadCollection<PlacementTest, Record<never, never>>;
|
|
42
|
+
readonly webhooks: Collection<WebhookSubscription, WebhookFilters>;
|
|
41
43
|
readonly raw: RawClient;
|
|
42
44
|
readonly native: NativeClient<Native>;
|
|
43
45
|
constructor(options: OutboundOptions<Native>, engine?: RequestEngine);
|
|
@@ -46,6 +48,7 @@ export declare class Outbound<Native extends NativeCatalog = NoNative> implement
|
|
|
46
48
|
get capabilities(): Capabilities;
|
|
47
49
|
get maturity(): Adapter["maturity"];
|
|
48
50
|
get caveats(): readonly string[];
|
|
51
|
+
get fields(): FieldCoverage;
|
|
49
52
|
/** The plugins on this instance, outermost first. */
|
|
50
53
|
get plugins(): readonly OutboundPlugin[];
|
|
51
54
|
campaign(id: string): CampaignHandle;
|
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
import type { BlockEntry, CampaignSettings, LeadList, SenderHealth, Tag, WebhookSubscription } from "../entities-account.ts";
|
|
1
|
+
import type { BlockEntry, CampaignProgress, CampaignSettings, LeadList, PlacementTest, SenderHealth, Tag, WebhookSubscription } from "../entities-account.ts";
|
|
2
2
|
import type { Sequence } from "../entities.ts";
|
|
3
3
|
import type { WebhookFilters } from "./api.ts";
|
|
4
4
|
import type { GetSpec, ListSpec } from "./collections.ts";
|
|
5
5
|
import type { Core } from "./core.ts";
|
|
6
6
|
type NoFilters = Record<never, never>;
|
|
7
7
|
export declare const settingsGet: (core: Core) => GetSpec<CampaignSettings>;
|
|
8
|
+
export declare const progressGet: (core: Core) => GetSpec<CampaignProgress>;
|
|
8
9
|
export declare const healthGet: (core: Core) => GetSpec<SenderHealth>;
|
|
9
10
|
export declare const subsequenceList: (core: Core) => ListSpec<Sequence, {
|
|
10
11
|
readonly campaignId?: string | undefined;
|
|
11
12
|
}>;
|
|
12
13
|
export declare const listList: (core: Core) => ListSpec<LeadList, NoFilters>;
|
|
14
|
+
export declare const listGet: (core: Core) => GetSpec<LeadList>;
|
|
15
|
+
export declare const webhookGet: (core: Core) => GetSpec<WebhookSubscription>;
|
|
13
16
|
export declare const blocklistList: (core: Core) => ListSpec<BlockEntry, NoFilters>;
|
|
17
|
+
export declare const placementTestList: (core: Core) => ListSpec<PlacementTest, NoFilters>;
|
|
14
18
|
export declare const tagList: (core: Core) => ListSpec<Tag, NoFilters>;
|
|
15
19
|
export declare const webhookList: (core: Core) => ListSpec<WebhookSubscription, WebhookFilters>;
|
|
16
20
|
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Page } from "./adapter.ts";
|
|
2
|
+
import type { Json, JsonObject } from "./json.ts";
|
|
3
|
+
/** The rows of one vendor page as they came, and where the next page starts. */
|
|
4
|
+
export interface RawPage {
|
|
5
|
+
readonly items: readonly JsonObject[];
|
|
6
|
+
readonly next?: Json | undefined;
|
|
7
|
+
}
|
|
8
|
+
/** Maps each row of a vendor page to a record and keeps the page's cursor. */
|
|
9
|
+
export declare const mapPage: <Item>(page: RawPage, toItem: (raw: JsonObject) => Item) => Page<Item>;
|
|
10
|
+
/**
|
|
11
|
+
* `mapPage` for a mapper that may skip a row: a row that maps to nothing,
|
|
12
|
+
* such as a block entry with no value, is left out and not returned empty.
|
|
13
|
+
*/
|
|
14
|
+
export declare const flatMapPage: <Item>(page: RawPage, toItems: (raw: JsonObject) => readonly Item[]) => Page<Item>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { EventData, EventType } from "./entities.ts";
|
|
1
2
|
import type { Json } from "./json.ts";
|
|
2
3
|
/** Which provider and workspace a record belongs to. */
|
|
3
4
|
export interface Identity {
|
|
@@ -17,3 +18,19 @@ export declare const recordBase: (identity: Identity, sourceId: string | number,
|
|
|
17
18
|
export declare const refTo: (identity: Identity, sourceId: string | number | null | undefined) => string | null;
|
|
18
19
|
/** Refs to other records of the same provider and workspace, skipping empty ids. */
|
|
19
20
|
export declare const refsTo: (identity: Identity, sourceIds: readonly (string | number | null | undefined)[]) => string[];
|
|
21
|
+
/**
|
|
22
|
+
* The event types a webhook's vendor event names become, without repeats and
|
|
23
|
+
* in a fixed order. A name the adapter does not know, or maps to `unknown`,
|
|
24
|
+
* adds nothing.
|
|
25
|
+
*/
|
|
26
|
+
export declare const eventTypesOf: (names: readonly string[], known: ReadonlyMap<string, EventType>) => EventType[];
|
|
27
|
+
/** The shared keys of an event's data, each with the type it must have. */
|
|
28
|
+
type SharedEventData = {
|
|
29
|
+
readonly [Key in keyof EventData as string extends Key ? never : Key]?: EventData[Key];
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* An event's `data` from what an adapter read: the shared keys are typed, a
|
|
33
|
+
* vendor's extras are any JSON, and a key with no value is left out.
|
|
34
|
+
*/
|
|
35
|
+
export declare const eventData: (shared: SharedEventData, extras?: Readonly<Record<string, Json | undefined>>) => EventData;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { campaignSchema, campaignStatusSchema, channelSchema, eventDataSchema, eventTypeSchema, evidenceSchema, leadProgressSchema, leadSchema, leadStatusSchema, mailProviderSchema, messageSchema, metricRowSchema, metricScopeSchema, outboundEventSchema, replyCategorySchema, replySchema, SCHEMA_VERSION, senderSchema, senderStatusSchema, sequenceSchema, workspaceSchema, } from "./entities.ts";
|
|
2
|
+
export type { Campaign, CampaignStatus, Channel, EventData, EventType, Evidence, Lead, LeadEngagement, LeadProgress, LeadStatus, MailProvider, Message, MetricRow, MetricScope, OutboundEvent, Reply, ReplyCategory, Sender, SenderStatus, Sequence, SequenceStep, SequenceVariant, Workspace, } from "./entities.ts";
|
|
3
|
+
export { blockEntrySchema, campaignProgressSchema, campaignSettingsSchema, leadListSchema, placementTestSchema, senderHealthSchema, tagSchema, webhookSubscriptionSchema, } from "./entities-account.ts";
|
|
4
|
+
export type { BlockEntry, CampaignProgress, CampaignSettings, Entity, LeadList, PlacementTest, SenderHealth, SendingWindow, Tag, WebhookSubscription, } from "./entities-account.ts";
|
|
5
|
+
export { resolveFields } from "./fields.ts";
|
|
6
|
+
export type { FieldCoverage, FieldDeclaration, FieldGrade, RecordName, } from "./fields.ts";
|
|
7
|
+
export type { LeadFieldMap } from "./lead-fields.ts";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SequenceVariant } from "./entities.ts";
|
|
2
|
+
import type { Json } from "./json.ts";
|
|
3
|
+
/** The key of a variant the vendor does not label: 0 is "A", 1 is "B". */
|
|
4
|
+
export declare const variantKey: (index: number) => string;
|
|
5
|
+
/**
|
|
6
|
+
* One variant of a step. `contentHash` is a hash of subject and body, so
|
|
7
|
+
* stats can tell old copy from new.
|
|
8
|
+
*/
|
|
9
|
+
export declare const toVariant: (subject: string | null, body: string | null, key: string) => SequenceVariant;
|
|
10
|
+
/**
|
|
11
|
+
* A step or variant the vendor numbers from 1, as an index from 0. `null`
|
|
12
|
+
* when the value is not a number of 1 or more.
|
|
13
|
+
*/
|
|
14
|
+
export declare const fromOne: (value: Json | undefined) => number | null;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** The SHA-256 digest of `bytes`, as 32 bytes. */
|
|
2
|
+
export declare const sha256: (bytes: Uint8Array) => Uint8Array;
|
|
1
3
|
/** The SHA-256 digest of a UTF-8 string, as lowercase hex. */
|
|
2
4
|
export declare const sha256Hex: (input: string) => string;
|
|
3
5
|
/** A short stable id derived from the parts, for refs, event ids and cache keys. */
|
package/dist/loader/index.d.ts
CHANGED
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
import type { Adapter } from "../internal/adapter.ts";
|
|
2
2
|
export interface FromEnvOptions {
|
|
3
|
-
/** Overrides `OUTBOUND_SDK_PROVIDER`. */
|
|
3
|
+
/** Overrides `OUTBOUND_SDK_PROVIDER`. A provider id, or `all`, which is also the default. */
|
|
4
4
|
readonly provider?: string | undefined;
|
|
5
5
|
}
|
|
6
6
|
/** The provider ids `fromEnv` can load. */
|
|
7
7
|
export declare const loadableProviders: () => string[];
|
|
8
|
+
/**
|
|
9
|
+
* In place of a provider id: every provider whose key is set, behind one
|
|
10
|
+
* instance. A key added to the environment adds its tool; no code changes.
|
|
11
|
+
*/
|
|
12
|
+
export declare const ALL_PROVIDERS = "all";
|
|
13
|
+
/**
|
|
14
|
+
* The providers whose every required variable is set, in catalog order. A
|
|
15
|
+
* provider that needs no key, such as `memory`, is never among them.
|
|
16
|
+
*/
|
|
17
|
+
export declare const configuredProviders: () => string[];
|
|
8
18
|
/**
|
|
9
19
|
* Builds the adapter named by `OUTBOUND_SDK_PROVIDER`, reading its key from
|
|
10
|
-
* that adapter's own environment variables.
|
|
20
|
+
* that adapter's own environment variables. `all` builds every provider whose
|
|
21
|
+
* key is set: one adapter alone, or several combined. With no provider named,
|
|
22
|
+
* it does the same as `all`.
|
|
11
23
|
*/
|
|
12
24
|
export declare const fromEnv: (options?: FromEnvOptions) => Promise<Adapter>;
|
package/dist/loader/index.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
|
+
ALL_PROVIDERS,
|
|
3
|
+
configuredProviders,
|
|
2
4
|
fromEnv,
|
|
3
5
|
loadableProviders
|
|
4
|
-
} from "../chunks/chunk-
|
|
5
|
-
import "../chunks/chunk-
|
|
6
|
+
} from "../chunks/chunk-RCZ7ZZFU.js";
|
|
7
|
+
import "../chunks/chunk-IPUYZD4O.js";
|
|
6
8
|
import "../chunks/chunk-XC6CZP73.js";
|
|
7
|
-
import "../chunks/chunk-
|
|
8
|
-
import "../chunks/chunk-
|
|
9
|
+
import "../chunks/chunk-E7JHLNLG.js";
|
|
10
|
+
import "../chunks/chunk-VQSCHOBV.js";
|
|
9
11
|
export {
|
|
12
|
+
ALL_PROVIDERS,
|
|
13
|
+
configuredProviders,
|
|
10
14
|
fromEnv,
|
|
11
15
|
loadableProviders
|
|
12
16
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Adapter } from "../internal/adapter.ts";
|
|
2
2
|
import type { Store } from "./store.ts";
|
|
3
|
-
type AccountReads = Pick<Adapter, "getCampaignSettings" | "getSenderHealth" | "listBlocklist" | "listLists" | "listSubsequences" | "listTags" | "listWebhooks">;
|
|
3
|
+
type AccountReads = Pick<Adapter, "getCampaignProgress" | "getCampaignSettings" | "getList" | "getSenderHealth" | "getWebhook" | "listBlocklist" | "listLists" | "listPlacementTests" | "listSubsequences" | "listTags" | "listWebhooks">;
|
|
4
4
|
export declare const accountReads: (store: Store) => AccountReads;
|
|
5
5
|
export {};
|
package/dist/memory/account.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { BlockEntry, CampaignSettings, LeadList, SenderHealth, SendingWindow, Tag, WebhookSubscription } from "../internal/entities-account.ts";
|
|
1
|
+
import type { BlockEntry, CampaignSettings, LeadList, PlacementTest, SenderHealth, SendingWindow, Tag, WebhookSubscription } from "../internal/entities-account.ts";
|
|
2
|
+
import type { EventType } from "../internal/entities.ts";
|
|
2
3
|
import type { Identity } from "../internal/record.ts";
|
|
3
4
|
export interface MemorySettings {
|
|
4
5
|
readonly schedule?: readonly Partial<SendingWindow>[];
|
|
@@ -47,11 +48,23 @@ export interface MemoryTag {
|
|
|
47
48
|
readonly name?: string;
|
|
48
49
|
readonly description?: string;
|
|
49
50
|
}
|
|
51
|
+
export interface MemoryPlacementTest {
|
|
52
|
+
readonly id: string;
|
|
53
|
+
readonly name?: string;
|
|
54
|
+
readonly status?: PlacementTest["status"];
|
|
55
|
+
readonly kind?: NonNullable<PlacementTest["kind"]>;
|
|
56
|
+
readonly campaignId?: string;
|
|
57
|
+
readonly createdAt?: string;
|
|
58
|
+
readonly nextRunAt?: string;
|
|
59
|
+
readonly startsAt?: string;
|
|
60
|
+
readonly endsAt?: string;
|
|
61
|
+
}
|
|
50
62
|
export interface MemoryWebhook {
|
|
51
63
|
readonly id: string;
|
|
52
64
|
readonly url: string;
|
|
53
65
|
readonly name?: string;
|
|
54
66
|
readonly events?: readonly string[];
|
|
67
|
+
readonly eventTypes?: readonly EventType[];
|
|
55
68
|
readonly active?: boolean;
|
|
56
69
|
readonly campaignId?: string;
|
|
57
70
|
readonly createdAt?: string;
|
|
@@ -65,3 +78,4 @@ export declare const toList: (identity: Identity, seed: MemoryList, size: number
|
|
|
65
78
|
export declare const toBlockEntry: (identity: Identity, seed: MemoryBlockEntry) => BlockEntry;
|
|
66
79
|
export declare const toTag: (identity: Identity, seed: MemoryTag) => Tag;
|
|
67
80
|
export declare const toWebhook: (identity: Identity, seed: MemoryWebhook) => WebhookSubscription;
|
|
81
|
+
export declare const toPlacementTest: (identity: Identity, seed: MemoryPlacementTest) => PlacementTest;
|
package/dist/memory/data.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Campaign, CampaignStatus, Channel, Lead, LeadEngagement, LeadStatus, Message, MetricRow, Reply, ReplyCategory, Sender, SenderStatus, Sequence } from "../internal/entities.ts";
|
|
1
|
+
import type { Campaign, CampaignStatus, Channel, Lead, LeadEngagement, LeadProgress, LeadStatus, MailProvider, Message, MetricRow, Reply, ReplyCategory, Sender, SenderStatus, Sequence } from "../internal/entities.ts";
|
|
2
2
|
import type { MetricCounts } from "../internal/metrics.ts";
|
|
3
3
|
import type { Identity } from "../internal/record.ts";
|
|
4
|
-
import type { MemoryBlockEntry, MemoryHealth, MemoryList, MemorySettings, MemoryTag, MemoryWebhook } from "./account.ts";
|
|
4
|
+
import type { MemoryBlockEntry, MemoryHealth, MemoryList, MemoryPlacementTest, MemorySettings, MemoryTag, MemoryWebhook } from "./account.ts";
|
|
5
5
|
export interface MemoryVariant {
|
|
6
6
|
readonly key?: string;
|
|
7
7
|
readonly subject?: string;
|
|
@@ -39,6 +39,8 @@ export interface MemorySender {
|
|
|
39
39
|
readonly name?: string;
|
|
40
40
|
readonly status?: SenderStatus;
|
|
41
41
|
readonly dailyLimit?: number;
|
|
42
|
+
readonly mailProvider?: MailProvider;
|
|
43
|
+
readonly tags?: readonly string[];
|
|
42
44
|
readonly warmup?: {
|
|
43
45
|
readonly enabled: boolean;
|
|
44
46
|
readonly score?: number;
|
|
@@ -56,11 +58,21 @@ export interface MemoryLead {
|
|
|
56
58
|
readonly lastName?: string;
|
|
57
59
|
readonly company?: string;
|
|
58
60
|
readonly title?: string;
|
|
61
|
+
/** The headline. `progress` and the outcome flags follow from it unless given. */
|
|
59
62
|
readonly status?: LeadStatus;
|
|
63
|
+
readonly progress?: LeadProgress;
|
|
64
|
+
readonly replied?: boolean;
|
|
65
|
+
readonly bounced?: boolean;
|
|
66
|
+
readonly unsubscribed?: boolean;
|
|
60
67
|
readonly custom?: Readonly<Record<string, string>>;
|
|
61
68
|
readonly createdAt?: string;
|
|
62
69
|
readonly engagement?: Partial<LeadEngagement>;
|
|
63
70
|
readonly interest?: string;
|
|
71
|
+
readonly interestCategory?: ReplyCategory;
|
|
72
|
+
readonly companyLinkedinUrl?: string;
|
|
73
|
+
readonly location?: string;
|
|
74
|
+
readonly phone?: string;
|
|
75
|
+
readonly website?: string;
|
|
64
76
|
readonly tags?: readonly string[];
|
|
65
77
|
/** The saved lists the lead is on. */
|
|
66
78
|
readonly listIds?: readonly string[];
|
|
@@ -81,6 +93,8 @@ export interface MemoryMessage {
|
|
|
81
93
|
readonly category?: ReplyCategory;
|
|
82
94
|
/** Inbound only. */
|
|
83
95
|
readonly isAuto?: boolean;
|
|
96
|
+
/** Inbound only. */
|
|
97
|
+
readonly unread?: boolean;
|
|
84
98
|
}
|
|
85
99
|
export interface MemoryStats {
|
|
86
100
|
/** `YYYY-MM-DD`. */
|
|
@@ -104,6 +118,7 @@ export interface MemoryData {
|
|
|
104
118
|
readonly blocklist?: readonly MemoryBlockEntry[];
|
|
105
119
|
readonly tags?: readonly MemoryTag[];
|
|
106
120
|
readonly webhooks?: readonly MemoryWebhook[];
|
|
121
|
+
readonly placementTests?: readonly MemoryPlacementTest[];
|
|
107
122
|
}
|
|
108
123
|
export declare const toCampaign: (identity: Identity, seed: MemoryCampaign) => Campaign;
|
|
109
124
|
export declare const toSequence: (identity: Identity, seed: MemoryCampaign) => Sequence;
|
package/dist/memory/index.js
CHANGED
|
@@ -1,32 +1,33 @@
|
|
|
1
1
|
import {
|
|
2
2
|
emptyCounts,
|
|
3
3
|
sumCounts
|
|
4
|
-
} from "../chunks/chunk-
|
|
4
|
+
} from "../chunks/chunk-YOTW5ESM.js";
|
|
5
5
|
import {
|
|
6
6
|
profileSlug
|
|
7
7
|
} from "../chunks/chunk-NAWZ73QS.js";
|
|
8
8
|
import {
|
|
9
9
|
stableId
|
|
10
|
-
} from "../chunks/chunk-
|
|
10
|
+
} from "../chunks/chunk-FHKSLCVW.js";
|
|
11
11
|
import {
|
|
12
12
|
recordBase,
|
|
13
13
|
refTo,
|
|
14
14
|
refsTo
|
|
15
|
-
} from "../chunks/chunk-
|
|
15
|
+
} from "../chunks/chunk-U2D34ARZ.js";
|
|
16
16
|
import {
|
|
17
|
-
SCHEMA_VERSION
|
|
18
|
-
|
|
17
|
+
SCHEMA_VERSION,
|
|
18
|
+
leadProgressSchema
|
|
19
|
+
} from "../chunks/chunk-4PSO6JEK.js";
|
|
19
20
|
import {
|
|
20
21
|
assertWorkspaceId,
|
|
21
22
|
makeRef
|
|
22
|
-
} from "../chunks/chunk-
|
|
23
|
+
} from "../chunks/chunk-LVYG7XZJ.js";
|
|
23
24
|
import {
|
|
24
25
|
OutboundError,
|
|
25
26
|
makeErrorMapper
|
|
26
|
-
} from "../chunks/chunk-
|
|
27
|
+
} from "../chunks/chunk-E7JHLNLG.js";
|
|
27
28
|
import {
|
|
28
29
|
isNumber
|
|
29
|
-
} from "../chunks/chunk-
|
|
30
|
+
} from "../chunks/chunk-VQSCHOBV.js";
|
|
30
31
|
|
|
31
32
|
// src/memory/account.ts
|
|
32
33
|
var base = (identity, sourceId) => recordBase(identity, sourceId, null);
|
|
@@ -98,10 +99,22 @@ var toWebhook = (identity, seed) => ({
|
|
|
98
99
|
active: seed.active ?? true,
|
|
99
100
|
campaignRefs: refsTo(identity, [seed.campaignId]),
|
|
100
101
|
createdAt: seed.createdAt ?? null,
|
|
102
|
+
eventTypes: [...seed.eventTypes ?? []],
|
|
101
103
|
events: [...seed.events ?? []],
|
|
102
104
|
name: seed.name ?? null,
|
|
103
105
|
url: seed.url
|
|
104
106
|
});
|
|
107
|
+
var toPlacementTest = (identity, seed) => ({
|
|
108
|
+
...base(identity, seed.id),
|
|
109
|
+
campaignRef: seed.campaignId === void 0 ? null : makeRef(identity.provider, identity.workspaceId, seed.campaignId),
|
|
110
|
+
createdAt: seed.createdAt ?? null,
|
|
111
|
+
endsAt: seed.endsAt ?? null,
|
|
112
|
+
kind: seed.kind ?? null,
|
|
113
|
+
name: seed.name ?? seed.id,
|
|
114
|
+
nextRunAt: seed.nextRunAt ?? null,
|
|
115
|
+
startsAt: seed.startsAt ?? null,
|
|
116
|
+
status: seed.status ?? "active"
|
|
117
|
+
});
|
|
105
118
|
|
|
106
119
|
// src/memory/data.ts
|
|
107
120
|
var base2 = (identity, sourceId) => recordBase(identity, sourceId, null);
|
|
@@ -147,8 +160,10 @@ var toSender = (identity, seed) => ({
|
|
|
147
160
|
dailyLimit: seed.dailyLimit ?? null,
|
|
148
161
|
kind: seed.linkedinUrl === void 0 ? "mailbox" : "linkedin",
|
|
149
162
|
linkedinUrl: seed.linkedinUrl ?? null,
|
|
163
|
+
mailProvider: seed.mailProvider ?? null,
|
|
150
164
|
name: seed.name ?? null,
|
|
151
165
|
status: seed.status ?? "active",
|
|
166
|
+
tags: [...seed.tags ?? []],
|
|
152
167
|
warmup: seed.warmup === void 0 ? null : { enabled: seed.warmup.enabled, score: seed.warmup.score ?? null }
|
|
153
168
|
});
|
|
154
169
|
var toEngagement = (seed) => ({
|
|
@@ -161,21 +176,42 @@ var toEngagement = (seed) => ({
|
|
|
161
176
|
replies: seed.replies ?? null,
|
|
162
177
|
stepIndex: seed.stepIndex ?? null
|
|
163
178
|
});
|
|
179
|
+
var PROGRESS = /* @__PURE__ */ new Set([
|
|
180
|
+
"active",
|
|
181
|
+
"completed",
|
|
182
|
+
"paused"
|
|
183
|
+
]);
|
|
184
|
+
var standingOf = (seed) => {
|
|
185
|
+
const status = seed.status ?? "active";
|
|
186
|
+
const flagOf = (given, outcome) => given ?? (status === outcome ? true : null);
|
|
187
|
+
return {
|
|
188
|
+
bounced: flagOf(seed.bounced, "bounced"),
|
|
189
|
+
progress: seed.progress ?? leadProgressSchema.parse(PROGRESS.has(status) ? status : "unknown"),
|
|
190
|
+
replied: flagOf(seed.replied, "replied"),
|
|
191
|
+
status,
|
|
192
|
+
unsubscribed: flagOf(seed.unsubscribed, "unsubscribed")
|
|
193
|
+
};
|
|
194
|
+
};
|
|
164
195
|
var toLead = (identity, seed) => ({
|
|
165
196
|
...base2(identity, seed.id),
|
|
197
|
+
...standingOf(seed),
|
|
166
198
|
campaignRef: refOrNull(identity, seed.campaignId),
|
|
167
199
|
company: seed.company ?? null,
|
|
200
|
+
companyLinkedinUrl: seed.companyLinkedinUrl ?? null,
|
|
168
201
|
createdAt: seed.createdAt ?? null,
|
|
169
202
|
custom: { ...seed.custom },
|
|
170
203
|
email: seed.email?.trim().toLowerCase() ?? null,
|
|
171
204
|
engagement: seed.engagement === void 0 ? null : toEngagement(seed.engagement),
|
|
172
205
|
firstName: seed.firstName ?? null,
|
|
173
206
|
interest: seed.interest ?? null,
|
|
207
|
+
interestCategory: seed.interestCategory ?? null,
|
|
174
208
|
tags: [...seed.tags ?? []],
|
|
175
209
|
lastName: seed.lastName ?? null,
|
|
176
210
|
linkedinUrl: seed.linkedinUrl ?? null,
|
|
177
|
-
|
|
178
|
-
|
|
211
|
+
location: seed.location ?? null,
|
|
212
|
+
phone: seed.phone ?? null,
|
|
213
|
+
title: seed.title ?? null,
|
|
214
|
+
website: seed.website ?? null
|
|
179
215
|
});
|
|
180
216
|
var messageFields = (identity, seed, channel, includeBody) => ({
|
|
181
217
|
...base2(identity, seed.id),
|
|
@@ -200,7 +236,8 @@ var toReply = (identity, seed, channel, includeBody) => ({
|
|
|
200
236
|
category: seed.category ?? "unknown",
|
|
201
237
|
categorySource: seed.category === void 0 ? null : "vendor",
|
|
202
238
|
direction: "in",
|
|
203
|
-
isAuto: seed.isAuto ?? null
|
|
239
|
+
isAuto: seed.isAuto ?? null,
|
|
240
|
+
unread: seed.unread ?? null
|
|
204
241
|
});
|
|
205
242
|
var toMetricRow = (identity, counts) => ({
|
|
206
243
|
...counts,
|
|
@@ -240,10 +277,32 @@ var findCampaign = (store, id) => {
|
|
|
240
277
|
var accountReads = (store) => {
|
|
241
278
|
const { data, identity, pageSize } = store;
|
|
242
279
|
const page = (items, query) => Promise.resolve(paginate(items, query, pageSize));
|
|
280
|
+
const sizeOf = (listId) => (data.leads ?? []).filter((lead) => (lead.listIds ?? []).includes(listId)).length;
|
|
243
281
|
return {
|
|
282
|
+
// Counted from the seeded leads of the campaign, by their progress.
|
|
283
|
+
getCampaignProgress: (id) => {
|
|
284
|
+
findCampaign(store, id);
|
|
285
|
+
const mine = (data.leads ?? []).filter((lead) => lead.campaignId === id);
|
|
286
|
+
const counted = (progress) => mine.filter((lead) => toLead(identity, lead).progress === progress).length;
|
|
287
|
+
return Promise.resolve({
|
|
288
|
+
...recordBase(identity, id, null),
|
|
289
|
+
blocked: null,
|
|
290
|
+
campaignRef: makeRef(identity.provider, identity.workspaceId, id),
|
|
291
|
+
completed: counted("completed"),
|
|
292
|
+
failed: null,
|
|
293
|
+
inProgress: counted("active"),
|
|
294
|
+
leads: mine.length,
|
|
295
|
+
notStarted: null,
|
|
296
|
+
stopped: counted("paused")
|
|
297
|
+
});
|
|
298
|
+
},
|
|
244
299
|
getCampaignSettings: (id) => Promise.resolve(
|
|
245
300
|
toSettings(identity, id, findCampaign(store, id).settings ?? {})
|
|
246
301
|
),
|
|
302
|
+
getList: (id) => {
|
|
303
|
+
const seed = data.lists?.find((list) => list.id === id);
|
|
304
|
+
return seed === void 0 ? Promise.reject(notFound(identity.provider, "List", id)) : Promise.resolve(toList(identity, seed, sizeOf(seed.id)));
|
|
305
|
+
},
|
|
247
306
|
getSenderHealth: (id) => {
|
|
248
307
|
const seed = data.senders?.find((sender) => sender.id === id);
|
|
249
308
|
return seed === void 0 ? Promise.reject(notFound(identity.provider, "Sender", id)) : Promise.resolve(toHealth(identity, seed, seed.health ?? {}));
|
|
@@ -252,15 +311,19 @@ var accountReads = (store) => {
|
|
|
252
311
|
(data.blocklist ?? []).map((seed) => toBlockEntry(identity, seed)),
|
|
253
312
|
query
|
|
254
313
|
),
|
|
314
|
+
getWebhook: (id) => {
|
|
315
|
+
const seed = data.webhooks?.find((webhook) => webhook.id === id);
|
|
316
|
+
return seed === void 0 ? Promise.reject(notFound(identity.provider, "Webhook", id)) : Promise.resolve(toWebhook(identity, seed));
|
|
317
|
+
},
|
|
255
318
|
listLists: (query) => page(
|
|
256
319
|
(data.lists ?? []).map(
|
|
257
|
-
(seed) => toList(
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
)
|
|
320
|
+
(seed) => toList(identity, seed, sizeOf(seed.id))
|
|
321
|
+
),
|
|
322
|
+
query
|
|
323
|
+
),
|
|
324
|
+
listPlacementTests: (query) => page(
|
|
325
|
+
(data.placementTests ?? []).map(
|
|
326
|
+
(seed) => toPlacementTest(identity, seed)
|
|
264
327
|
),
|
|
265
328
|
query
|
|
266
329
|
),
|
|
@@ -293,7 +356,7 @@ var matchesScope = (row, query) => {
|
|
|
293
356
|
return row.senderId === void 0 && row.stepIndex === void 0;
|
|
294
357
|
}
|
|
295
358
|
case "campaign": {
|
|
296
|
-
return row.campaignId === query.scopeId && row.senderId === void 0 && row.stepIndex === void 0;
|
|
359
|
+
return (query.scopeId === void 0 || row.campaignId === query.scopeId) && row.senderId === void 0 && row.stepIndex === void 0;
|
|
297
360
|
}
|
|
298
361
|
case "step": {
|
|
299
362
|
return row.campaignId === query.scopeId && row.stepIndex !== void 0;
|
|
@@ -309,6 +372,7 @@ var matchesScope = (row, query) => {
|
|
|
309
372
|
};
|
|
310
373
|
var inRange = (row, query) => (query.from === void 0 || row.date >= query.from) && (query.to === void 0 || row.date <= query.to);
|
|
311
374
|
var groupKey = (row, query) => [
|
|
375
|
+
query.scope === "campaign" ? row.campaignId : "",
|
|
312
376
|
query.by === "day" ? row.date : "",
|
|
313
377
|
query.scope === "step" ? row.stepIndex : "",
|
|
314
378
|
query.scope === "step" ? row.variantKey ?? "" : ""
|
|
@@ -328,7 +392,7 @@ var queryStats = (identity, seeds, query) => {
|
|
|
328
392
|
...identity,
|
|
329
393
|
date: query.by === "day" ? first?.date ?? null : null,
|
|
330
394
|
scope: query.scope,
|
|
331
|
-
scopeId: query.scopeId ?? identity.workspaceId,
|
|
395
|
+
scopeId: query.scopeId ?? (query.scope === "campaign" ? first?.campaignId : void 0) ?? identity.workspaceId,
|
|
332
396
|
stepIndex: query.scope === "step" ? first?.stepIndex ?? null : null,
|
|
333
397
|
variantKey: query.scope === "step" ? first?.variantKey ?? null : null
|
|
334
398
|
},
|
|
@@ -342,6 +406,8 @@ var queryStats = (identity, seeds, query) => {
|
|
|
342
406
|
// src/memory/adapter.ts
|
|
343
407
|
var FULL_CAPABILITIES = {
|
|
344
408
|
blocklist: true,
|
|
409
|
+
"campaigns.bySender": true,
|
|
410
|
+
"campaigns.progress": true,
|
|
345
411
|
"campaigns.settings": true,
|
|
346
412
|
"campaigns.status": "server",
|
|
347
413
|
"leads.byCampaign": true,
|
|
@@ -351,15 +417,18 @@ var FULL_CAPABILITIES = {
|
|
|
351
417
|
"leads.lookup": true,
|
|
352
418
|
"leads.since": "server",
|
|
353
419
|
"leads.timeline": true,
|
|
420
|
+
"lists.get": true,
|
|
354
421
|
"lists.leads": true,
|
|
355
422
|
"lists.list": true,
|
|
356
423
|
"messages.body": "full",
|
|
357
424
|
"messages.byThread": true,
|
|
358
425
|
"messages.list": true,
|
|
359
426
|
"messages.since": "server",
|
|
427
|
+
"placementTests.list": true,
|
|
360
428
|
"replies.category": "vendor",
|
|
361
429
|
"replies.list": true,
|
|
362
430
|
"replies.since": "server",
|
|
431
|
+
"replies.unread": "server",
|
|
363
432
|
"senders.byCampaign": true,
|
|
364
433
|
"senders.get": true,
|
|
365
434
|
"senders.health": true,
|
|
@@ -370,9 +439,11 @@ var FULL_CAPABILITIES = {
|
|
|
370
439
|
"stats.byDay": "exact",
|
|
371
440
|
"stats.bySender": "exact",
|
|
372
441
|
"stats.byStep": "exact",
|
|
442
|
+
"stats.allCampaigns": "full",
|
|
373
443
|
"stats.campaign": "exact",
|
|
374
444
|
"stats.workspace": "exact",
|
|
375
445
|
tags: true,
|
|
446
|
+
"webhooks.get": true,
|
|
376
447
|
"webhooks.list": true,
|
|
377
448
|
workspaces: true
|
|
378
449
|
};
|
|
@@ -399,22 +470,26 @@ var getters = (store) => {
|
|
|
399
470
|
getSequence: (id) => Promise.resolve(toSequence(identity, findCampaign(store, id)))
|
|
400
471
|
};
|
|
401
472
|
};
|
|
473
|
+
var selectCampaigns = (store, query) => {
|
|
474
|
+
const { data } = store;
|
|
475
|
+
const filterHere = store.capabilities["campaigns.status"] === "server";
|
|
476
|
+
const attached = query.senderId === void 0 ? void 0 : (data.senders ?? []).find((sender) => sender.id === query.senderId)?.campaignIds;
|
|
477
|
+
return (data.campaigns ?? []).filter(
|
|
478
|
+
(campaign) => (query.senderId === void 0 || (attached ?? []).includes(campaign.id)) && (!filterHere || query.status === void 0 || (campaign.status ?? "active") === query.status)
|
|
479
|
+
);
|
|
480
|
+
};
|
|
402
481
|
var listers = (store) => {
|
|
403
482
|
const { data, identity, pageSize } = store;
|
|
404
483
|
return {
|
|
405
|
-
listCampaigns: (query) =>
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
pageSize
|
|
415
|
-
)
|
|
416
|
-
);
|
|
417
|
-
},
|
|
484
|
+
listCampaigns: (query) => Promise.resolve(
|
|
485
|
+
paginate(
|
|
486
|
+
selectCampaigns(store, query).map(
|
|
487
|
+
(seed) => toCampaign(identity, seed)
|
|
488
|
+
),
|
|
489
|
+
query,
|
|
490
|
+
pageSize
|
|
491
|
+
)
|
|
492
|
+
),
|
|
418
493
|
listLeads: (query) => {
|
|
419
494
|
const seeds = selectLeads(store, query);
|
|
420
495
|
return Promise.resolve(
|
|
@@ -442,7 +517,7 @@ var listers = (store) => {
|
|
|
442
517
|
listReplies: (query) => Promise.resolve(
|
|
443
518
|
paginate(
|
|
444
519
|
selectMessages(store, query, "replies.since").filter(
|
|
445
|
-
(seed) => seed.direction === "in" && (query.category === void 0 || (seed.category ?? "unknown") === query.category)
|
|
520
|
+
(seed) => seed.direction === "in" && (query.unread === void 0 || seed.unread === query.unread) && (query.category === void 0 || (seed.category ?? "unknown") === query.category)
|
|
446
521
|
).map(
|
|
447
522
|
(seed) => toReply(
|
|
448
523
|
identity,
|
|
@@ -476,7 +551,7 @@ var listers = (store) => {
|
|
|
476
551
|
]
|
|
477
552
|
}),
|
|
478
553
|
stats: (query) => {
|
|
479
|
-
const ofCampaign = query.scope === "campaign" || query.scope === "step";
|
|
554
|
+
const ofCampaign = query.scopeId !== void 0 && (query.scope === "campaign" || query.scope === "step");
|
|
480
555
|
return ofCampaign && !store.mentionsCampaign(query.scopeId) ? Promise.reject(
|
|
481
556
|
notFound(identity.provider, "Campaign", query.scopeId ?? "")
|
|
482
557
|
) : Promise.resolve(queryStats(identity, data.stats ?? [], query));
|