@fire-spark/analytics-server 0.0.0-stage → 0.26.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/dist/app-DlzC8Iq0.js +55 -0
- package/dist/google.d.ts +112 -0
- package/dist/google.js +653 -0
- package/dist/index.d.ts +59 -0
- package/dist/index.js +921 -0
- package/dist/json-D5hsBi3M.js +183 -0
- package/dist/meta.d.ts +143 -0
- package/dist/meta.js +498 -0
- package/dist/provider-DIOneNqa.js +22 -0
- package/dist/retry-BRNUy4Of.d.ts +278 -0
- package/dist/tiktok.d.ts +77 -0
- package/dist/tiktok.js +375 -0
- package/package.json +77 -3
- package/README.md +0 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { A as ServerProvider, B as decimalText, C as RelayRejectedEvent, D as ServerEventInput, E as RetryPolicy, F as TrackingHandlerOptions, I as VerifyEvent, L as VerifyEventContext, M as ServerTracker, N as ServerTrackerOptions, O as ServerIssue, P as ServerUserInput, R as JsonNumber, S as RelayRejectReason, T as ResolvedEvent, V as stringifyJson, _ as ProviderReason, a as backoffDelay, b as RelayErrorBody, c as AnalyticsServerConfigError, d as AppTrackingHandlerOptions, f as DeliveryOptions, g as ProviderOutcome, h as ProviderContext, i as HttpReply, j as ServerTrackResult, k as ServerIssueSource, l as AnalyticsServerConfigErrorCode, m as PreparedEvents, n as DEFAULT_RETRY_POLICY, o as postJson, p as IdempotencyStore, r as FinalOutcome, s as withProviderRetry, t as AttemptOutcome, u as AppAuthentication, v as ProviderResult, w as RequestMeta, x as RelayErrorCode, y as RelayAcceptedBody, z as decimalNumber } from "./retry-BRNUy4Of.js";
|
|
2
|
+
import { SUPPORTED_CONTRACT_VERSIONS, TrackingAppContextV1, TrackingEventV1, normalizeEmail, normalizeEmailForGoogle, normalizePhoneE164, phoneDigits, sha256Hex, upgradeEnvelope, validateEnvelope } from "@fire-spark/analytics";
|
|
3
|
+
//#region src/handler.d.ts
|
|
4
|
+
declare const DEFAULT_MAX_BODY_BYTES = 65536;
|
|
5
|
+
declare const CONTRACT_HEADER = "x-firespark-contract";
|
|
6
|
+
/**
|
|
7
|
+
* `POST` handler for the relay endpoint (`serverSide.endpoint`), for any
|
|
8
|
+
* runtime with web `Request` / `Response` (Next.js route handlers, Hono,
|
|
9
|
+
* Workers). Answers `202` once the events are checked; provider delivery
|
|
10
|
+
* runs afterwards inside `waitUntil`, or before the response when there
|
|
11
|
+
* is no `waitUntil`.
|
|
12
|
+
*/
|
|
13
|
+
declare const createTrackingHandler: (options: TrackingHandlerOptions) => (request: Request) => Promise<Response>;
|
|
14
|
+
/**
|
|
15
|
+
* `POST` handler for app (React Native) events. No `Origin` gate: the
|
|
16
|
+
* request must pass `authenticate`, come from an app in `allowedApps` and
|
|
17
|
+
* carry an event in `relayedEvents` (default `purchase`), which is always
|
|
18
|
+
* re-read by `verifyEvent` before any provider sees it. Same response as
|
|
19
|
+
* `createTrackingHandler`.
|
|
20
|
+
*/
|
|
21
|
+
declare const createAppTrackingHandler: (options: AppTrackingHandlerOptions) => (request: Request) => Promise<Response>;
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/tracker.d.ts
|
|
24
|
+
/**
|
|
25
|
+
* Sends events built on your server (an order webhook, a back-office
|
|
26
|
+
* action) through the same providers. Raw personal data in `user` is
|
|
27
|
+
* hashed here and never sent. These events are trusted, so `verifyEvent`
|
|
28
|
+
* does not run; consent and idempotency still apply.
|
|
29
|
+
*/
|
|
30
|
+
declare const createServerTracker: (options: ServerTrackerOptions) => ServerTracker;
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/deliver.d.ts
|
|
33
|
+
/** Seconds an idempotency claim lasts: the ad platforms' 48 h dedup window. */
|
|
34
|
+
declare const IDEMPOTENCY_TTL_SECONDS = 172800;
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/provider.d.ts
|
|
37
|
+
/** Typed identity helper for a custom destination. */
|
|
38
|
+
declare const defineServerProvider: (provider: ServerProvider) => ServerProvider;
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/redact.d.ts
|
|
41
|
+
/**
|
|
42
|
+
* Last line of defense for issue text: strips emails, hashes, tokens,
|
|
43
|
+
* PEM keys, JWTs, IP addresses and query strings. Issue messages are
|
|
44
|
+
* fixed templates; this only catches what a template could not rule out.
|
|
45
|
+
*/
|
|
46
|
+
declare const redactText: (text: string, secrets?: readonly string[]) => string;
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/request.d.ts
|
|
49
|
+
/** IPv4 or IPv6 text, or `undefined`. */
|
|
50
|
+
declare const cleanIp: (value: unknown) => string | undefined;
|
|
51
|
+
declare const cleanUserAgent: (value: unknown) => string | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* First `x-forwarded-for` entry, else `x-real-ip`, plus `user-agent`.
|
|
54
|
+
* On Vercel the platform sets `x-forwarded-for`; behind another proxy,
|
|
55
|
+
* pass `getRequestMeta` so a client-sent header is not trusted.
|
|
56
|
+
*/
|
|
57
|
+
declare const defaultRequestMeta: (request: Request) => RequestMeta;
|
|
58
|
+
//#endregion
|
|
59
|
+
export { AnalyticsServerConfigError, type AnalyticsServerConfigErrorCode, type AppAuthentication, type AppTrackingHandlerOptions, type AttemptOutcome, CONTRACT_HEADER, DEFAULT_MAX_BODY_BYTES, DEFAULT_RETRY_POLICY, type DeliveryOptions, type FinalOutcome, type HttpReply, IDEMPOTENCY_TTL_SECONDS, type IdempotencyStore, JsonNumber, type PreparedEvents, type ProviderContext, type ProviderOutcome, type ProviderReason, type ProviderResult, type RelayAcceptedBody, type RelayErrorBody, type RelayErrorCode, type RelayRejectReason, type RelayRejectedEvent, type RequestMeta, type ResolvedEvent, type RetryPolicy, SUPPORTED_CONTRACT_VERSIONS, type ServerEventInput, type ServerIssue, type ServerIssueSource, type ServerProvider, type ServerTrackResult, type ServerTracker, type ServerTrackerOptions, type ServerUserInput, type TrackingAppContextV1, type TrackingHandlerOptions, type VerifyEvent, type VerifyEventContext, backoffDelay, cleanIp, cleanUserAgent, createAppTrackingHandler, createServerTracker, createTrackingHandler, decimalNumber, decimalText, defaultRequestMeta, defineServerProvider, normalizeEmail, normalizeEmailForGoogle, normalizePhoneE164, phoneDigits, postJson, redactText, sha256Hex, stringifyJson, upgradeEnvelope, validateEnvelope, withProviderRetry };
|