Skip to content

LinksCore

Defined in: src/core.ts:254

The control plane.

Property Modifier Type Description Defined in
analytics readonly AnalyticsSink - src/core.ts:256
deferredTtlMs readonly number Deferred deep-link handoff lifetime (ms). src/core.ts:260
readonly readonly boolean - src/core.ts:257
reservedSlugs readonly readonly string[] - src/core.ts:258
storage readonly KvStorage - src/core.ts:255
claimDeferred(input): Promise<
| {
handoff: DeferredHandoff;
matchType: "exact" | "probabilistic";
}
| null>;

Defined in: src/core.ts:320

Claim a handoff exactly once, by click id (exact) or fingerprint (probabilistic).

Parameter Type
input { clickId?: string; fingerprint?: string; }
input.clickId? string
input.fingerprint? string

Promise< | { handoff: DeferredHandoff; matchType: "exact" | "probabilistic"; } | null>


close(): Promise<void>;

Defined in: src/core.ts:333

Flush counters and stop timers.

Promise<void>


countClick(tenant, linkId): void;

Defined in: src/core.ts:303

Count a non-bot click (batched, never awaited by the redirect).

Parameter Type
tenant string
linkId string

void


createDomain(input, options?): Promise<Domain>;

Defined in: src/core.ts:273

Parameter Type
input Domain
options? ActorOptions

Promise<Domain>


createLink(input, options?): Promise<Link>;

Defined in: src/core.ts:282

Parameter Type
input CreateLinkInput
options? ActorOptions

Promise<Link>


deleteDomain(hostname, options?): Promise<void>;

Defined in: src/core.ts:280

Fails with ConflictError while links use the domain, unless force (deletes them).

Parameter Type
hostname string
options? ActorOptions & object

Promise<void>


deleteLink(
tenant,
id,
options?
): Promise<Link>;

Defined in: src/core.ts:294

Parameter Type
tenant string
id string
options? ActorOptions

Promise<Link>


deleteTenant(key, options?): Promise<void>;

Defined in: src/core.ts:268

Delete a tenant and every link it owns.

Parameter Type
key string
options? ActorOptions

Promise<void>


flushCounters(): Promise<void>;

Defined in: src/core.ts:307

Write pending click counters now.

Promise<void>


getClickCount(tenant, linkId): Promise<number>;

Defined in: src/core.ts:305

Approximate click count (stored + not yet flushed).

Parameter Type
tenant string
linkId string

Promise<number>


getClickRef(clickId): Promise<ClickRef | null>;

Defined in: src/core.ts:311

Parameter Type
clickId string

Promise<ClickRef | null>


getCustomer(tenant, customerId): Promise<Customer | null>;

Defined in: src/core.ts:314

Parameter Type
tenant string
customerId string

Promise<Customer | null>


getDomain(hostname): Promise<Domain | null>;

Defined in: src/core.ts:272

Parameter Type
hostname string

Promise<Domain | null>


getLink(tenant, id): Promise<Link | null>;

Defined in: src/core.ts:283

Parameter Type
tenant string
id string

Promise<Link | null>


getLinkByExternalId(tenant, externalId): Promise<Link | null>;

Defined in: src/core.ts:284

Parameter Type
tenant string
externalId string

Promise<Link | null>


getLinkBySlug(hostname, slug): Promise<Link | null>;

Defined in: src/core.ts:286

The redirect lookup: domain + slug (normalized per the domain’s case rule).

Parameter Type
hostname string
slug string

Promise<Link | null>


getTenant(key): Promise<Tenant | null>;

Defined in: src/core.ts:265

Parameter Type
key string

Promise<Tenant | null>


importLinks(
tenant,
rows,
options?
): Promise<ImportResult>;

Defined in: src/core.ts:296

Parameter Type
tenant string
rows CreateLinkInput[]
options? ActorOptions & object

Promise<ImportResult>


listAudit(tenant?): Promise<AuditEntry[]>;

Defined in: src/core.ts:325

Parameter Type
tenant? string

Promise<AuditEntry[]>


listCustomers(tenant): Promise<Customer[]>;

Defined in: src/core.ts:315

Parameter Type
tenant string

Promise<Customer[]>


listDomains(filter?): Promise<Domain[]>;

Defined in: src/core.ts:271

All domains, or the ones a tenant may use (shared + its own).

Parameter Type
filter? { tenant?: string; }
filter.tenant? string

Promise<Domain[]>


listLinks(tenant, query?): Promise<LinkPage>;

Defined in: src/core.ts:287

Parameter Type
tenant string
query? ListLinksQuery

Promise<LinkPage>


listTags(tenant): Promise<object[]>;

Defined in: src/core.ts:295

Parameter Type
tenant string

Promise<object[]>


listTenants(): Promise<Tenant[]>;

Defined in: src/core.ts:264

Promise<Tenant[]>


now(): number;

Defined in: src/core.ts:262

The clock, for collaborators (redirect handler, tests).

number


onChange(listener): () => void;

Defined in: src/core.ts:329

Subscribe to link/domain changes made through this core (resolver eviction).

Parameter Type
listener (change) => void

() => void


prune(): Promise<{
clickRefs: number;
deferred: number;
}>;

Defined in: src/core.ts:331

Drop expired click refs and deferred handoffs.

Promise<{ clickRefs: number; deferred: number; }>


queryAnalytics(query): Promise<AnalyticsResult>;

Defined in: src/core.ts:326

Parameter Type
query AnalyticsQuery

Promise<AnalyticsResult>


recordClickRef(ref): Promise<void>;

Defined in: src/core.ts:310

Store a click ref so conversions can be attributed to it.

Parameter Type
ref ClickRef

Promise<void>


saveDeferred(handoff, fingerprint?): Promise<void>;

Defined in: src/core.ts:318

Store a deferred deep-link handoff (ADR 0008).

Parameter Type
handoff DeferredHandoff
fingerprint? string

Promise<void>


trackLead(input): Promise<
| ConversionResult<LeadEvent>
| null>;

Defined in: src/core.ts:312

Parameter Type
input TrackLeadInput

Promise< | ConversionResult<LeadEvent> | null>


trackSale(input): Promise<
| ConversionResult<SaleEvent>
| null>;

Defined in: src/core.ts:313

Parameter Type
input TrackSaleInput

Promise< | ConversionResult<SaleEvent> | null>


updateDomain(
hostname,
patch,
options?
): Promise<Domain>;

Defined in: src/core.ts:274

Parameter Type
hostname string
patch Partial<Omit<Domain, "hostname">>
options? ActorOptions

Promise<Domain>


updateLink(
tenant,
id,
patch,
options?
): Promise<Link>;

Defined in: src/core.ts:288

Parameter Type
tenant string
id string
patch UpdateLinkInput
options? ActorOptions

Promise<Link>


upsertTenant(input, options?): Promise<Tenant>;

Defined in: src/core.ts:266

Parameter Type
input Tenant
options? ActorOptions

Promise<Tenant>