@10x-media/analytics 0.1.0-beta.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/CHANGELOG.md +41 -0
- package/LICENSE +21 -0
- package/README.md +387 -0
- package/dist/RealtimeCounter-BJrjMPSa.js +473 -0
- package/dist/RealtimeCounter-BJrjMPSa.js.map +1 -0
- package/dist/contract-CWZPKWuR.d.ts +83 -0
- package/dist/dist-B6HruP5v.js +4731 -0
- package/dist/dist-B6HruP5v.js.map +1 -0
- package/dist/exports/adapters/ga4.d.ts +20 -0
- package/dist/exports/adapters/ga4.js +177 -0
- package/dist/exports/adapters/ga4.js.map +1 -0
- package/dist/exports/adapters/native.d.ts +22 -0
- package/dist/exports/adapters/native.js +849 -0
- package/dist/exports/adapters/native.js.map +1 -0
- package/dist/exports/adapters/plausible.d.ts +15 -0
- package/dist/exports/adapters/plausible.js +143 -0
- package/dist/exports/adapters/plausible.js.map +1 -0
- package/dist/exports/adapters/posthog.d.ts +17 -0
- package/dist/exports/adapters/posthog.js +119 -0
- package/dist/exports/adapters/posthog.js.map +1 -0
- package/dist/exports/adapters/umami.d.ts +18 -0
- package/dist/exports/adapters/umami.js +139 -0
- package/dist/exports/adapters/umami.js.map +1 -0
- package/dist/exports/client.d.ts +77 -0
- package/dist/exports/client.js +388 -0
- package/dist/exports/client.js.map +1 -0
- package/dist/exports/geo.d.ts +19 -0
- package/dist/exports/geo.js +2 -0
- package/dist/exports/i18n.d.ts +63 -0
- package/dist/exports/i18n.js +3 -0
- package/dist/exports/rsc.d.ts +120 -0
- package/dist/exports/rsc.js +598 -0
- package/dist/exports/rsc.js.map +1 -0
- package/dist/exports/types.d.ts +4 -0
- package/dist/exports/types.js +1 -0
- package/dist/fetchJson-DZb2_Puj.js +36 -0
- package/dist/fetchJson-DZb2_Puj.js.map +1 -0
- package/dist/geoResolver-CasIa4T9.d.ts +12 -0
- package/dist/index-CZdCT0WJ.d.ts +98 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1081 -0
- package/dist/index.js.map +1 -0
- package/dist/keys-DEqL4LOT.js +57 -0
- package/dist/keys-DEqL4LOT.js.map +1 -0
- package/dist/lib-CE5x1zLQ.js +1058 -0
- package/dist/lib-CE5x1zLQ.js.map +1 -0
- package/dist/maxmindResolver-CXYXXdul.js +99 -0
- package/dist/maxmindResolver-CXYXXdul.js.map +1 -0
- package/dist/presets-CBfq_uJX.d.ts +38 -0
- package/dist/readForWidgetRealtime-D1BD37ST.d.ts +32 -0
- package/dist/series-zytbzPoc.js +17 -0
- package/dist/series-zytbzPoc.js.map +1 -0
- package/dist/server-Cuvhgz-S.js +492 -0
- package/dist/server-Cuvhgz-S.js.map +1 -0
- package/dist/testing/memoryAdapter.d.ts +16 -0
- package/dist/testing/memoryAdapter.js +98 -0
- package/dist/testing/memoryAdapter.js.map +1 -0
- package/dist/translations-keiKtSjF.js +77 -0
- package/dist/translations-keiKtSjF.js.map +1 -0
- package/package.json +156 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { n as AnalyticsAdapter } from "../../contract-CWZPKWuR.js";
|
|
2
|
+
|
|
3
|
+
//#region src/adapters/ga4/ga4.d.ts
|
|
4
|
+
interface Ga4Config {
|
|
5
|
+
/** GA4 property id (numeric), e.g. '123456789'. */
|
|
6
|
+
propertyId: string;
|
|
7
|
+
/** Service-account credentials. */
|
|
8
|
+
credentials: {
|
|
9
|
+
client_email: string;
|
|
10
|
+
private_key: string;
|
|
11
|
+
};
|
|
12
|
+
/** GCP project id; inferred from the credentials when omitted. */
|
|
13
|
+
projectId?: string;
|
|
14
|
+
/** Maximum days of historical data. Defaults to 425 (GA4's rolling-window limit). Pass null to disable clamping. */
|
|
15
|
+
maxLookbackDays?: number | null;
|
|
16
|
+
}
|
|
17
|
+
declare function ga4(config: Ga4Config): AnalyticsAdapter;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { type Ga4Config, ga4 };
|
|
20
|
+
//# sourceMappingURL=ga4.d.ts.map
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { t as dayIso } from "../../series-zytbzPoc.js";
|
|
2
|
+
//#region src/adapters/ga4/ga4.ts
|
|
3
|
+
const METRIC_MAP = {
|
|
4
|
+
pageviews: "screenPageViews",
|
|
5
|
+
visitors: "totalUsers",
|
|
6
|
+
visits: "sessions",
|
|
7
|
+
sessions: "sessions",
|
|
8
|
+
bounceRate: "bounceRate",
|
|
9
|
+
avgDuration: "averageSessionDuration",
|
|
10
|
+
events: "eventCount",
|
|
11
|
+
conversions: "keyEvents",
|
|
12
|
+
revenue: "totalRevenue"
|
|
13
|
+
};
|
|
14
|
+
const DIMENSION_MAP = {
|
|
15
|
+
page: "pagePath",
|
|
16
|
+
referrer: "pageReferrer",
|
|
17
|
+
source: "sessionSource",
|
|
18
|
+
medium: "sessionMedium",
|
|
19
|
+
campaign: "sessionCampaignName",
|
|
20
|
+
utmSource: "sessionSource",
|
|
21
|
+
utmMedium: "sessionMedium",
|
|
22
|
+
utmCampaign: "sessionCampaignName",
|
|
23
|
+
device: "deviceCategory",
|
|
24
|
+
browser: "browser",
|
|
25
|
+
os: "operatingSystem",
|
|
26
|
+
country: "countryId",
|
|
27
|
+
region: "region",
|
|
28
|
+
city: "city",
|
|
29
|
+
language: "language",
|
|
30
|
+
event: "eventName"
|
|
31
|
+
};
|
|
32
|
+
const ga4Metrics = new Set(Object.keys(METRIC_MAP));
|
|
33
|
+
const ga4Dimensions = new Set(Object.keys(DIMENSION_MAP));
|
|
34
|
+
const toContractValue = (metric, raw) => {
|
|
35
|
+
if (metric === "avgDuration") return Math.round(raw * 1e3);
|
|
36
|
+
if (metric === "bounceRate") return Math.round(raw * 100);
|
|
37
|
+
return raw;
|
|
38
|
+
};
|
|
39
|
+
function ga4(config) {
|
|
40
|
+
const capabilities = {
|
|
41
|
+
perPageQuery: true,
|
|
42
|
+
realtime: false,
|
|
43
|
+
comparison: false,
|
|
44
|
+
minGranularity: "day",
|
|
45
|
+
maxLookbackDays: config.maxLookbackDays !== void 0 ? config.maxLookbackDays : 425,
|
|
46
|
+
metrics: ga4Metrics,
|
|
47
|
+
dimensions: ga4Dimensions,
|
|
48
|
+
batchPageReport: true,
|
|
49
|
+
rateLimit: {
|
|
50
|
+
maxConcurrent: 10,
|
|
51
|
+
quotaModel: "tokens",
|
|
52
|
+
readsCountAsUsage: true
|
|
53
|
+
},
|
|
54
|
+
recommendedTtl: {
|
|
55
|
+
realtime: 300,
|
|
56
|
+
aggregate: 21600
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
let clientPromise;
|
|
60
|
+
const getClient = () => {
|
|
61
|
+
if (!clientPromise) clientPromise = (async () => {
|
|
62
|
+
let mod;
|
|
63
|
+
try {
|
|
64
|
+
mod = await import("@google-analytics/data");
|
|
65
|
+
} catch {
|
|
66
|
+
throw new Error("@10x-media/analytics: the GA4 adapter requires the optional peer dependency \"@google-analytics/data\". Install it with: pnpm add @google-analytics/data");
|
|
67
|
+
}
|
|
68
|
+
return new mod.BetaAnalyticsDataClient({
|
|
69
|
+
credentials: config.credentials,
|
|
70
|
+
projectId: config.projectId
|
|
71
|
+
});
|
|
72
|
+
})();
|
|
73
|
+
return clientPromise;
|
|
74
|
+
};
|
|
75
|
+
return {
|
|
76
|
+
id: "ga4",
|
|
77
|
+
label: "Google Analytics 4",
|
|
78
|
+
capabilities,
|
|
79
|
+
isConfigured: () => Boolean(config.propertyId && config.credentials?.client_email && config.credentials?.private_key),
|
|
80
|
+
async query(q, _ctx) {
|
|
81
|
+
const fetchedAt = q.dateRange.end.toISOString();
|
|
82
|
+
const wanted = q.metrics.filter((m) => METRIC_MAP[m]);
|
|
83
|
+
const providerMetrics = [...new Set(wanted.map((m) => METRIC_MAP[m]))];
|
|
84
|
+
const dims = (q.dimensions ?? []).filter((d) => DIMENSION_MAP[d]);
|
|
85
|
+
const providerDims = [...new Set(dims.map((d) => DIMENSION_MAP[d]))];
|
|
86
|
+
const readRow = (row) => {
|
|
87
|
+
const out = {};
|
|
88
|
+
for (const m of wanted) {
|
|
89
|
+
const idx = providerMetrics.indexOf(METRIC_MAP[m]);
|
|
90
|
+
out[m] = toContractValue(m, Number(row.metricValues?.[idx]?.value ?? 0));
|
|
91
|
+
}
|
|
92
|
+
return out;
|
|
93
|
+
};
|
|
94
|
+
const baseRequest = {
|
|
95
|
+
property: `properties/${config.propertyId}`,
|
|
96
|
+
dateRanges: [{
|
|
97
|
+
startDate: q.dateRange.start.toISOString().slice(0, 10),
|
|
98
|
+
endDate: q.dateRange.end.toISOString().slice(0, 10)
|
|
99
|
+
}],
|
|
100
|
+
metrics: providerMetrics.map((name) => ({ name })),
|
|
101
|
+
...q.path ? { dimensionFilter: { filter: {
|
|
102
|
+
fieldName: "pagePath",
|
|
103
|
+
stringFilter: {
|
|
104
|
+
matchType: "EXACT",
|
|
105
|
+
value: q.path
|
|
106
|
+
}
|
|
107
|
+
} } } : {}
|
|
108
|
+
};
|
|
109
|
+
const client = await getClient();
|
|
110
|
+
if (q.granularity === "day" && !dims.length) {
|
|
111
|
+
const [response] = await client.runReport({
|
|
112
|
+
...baseRequest,
|
|
113
|
+
dimensions: [{ name: "date" }],
|
|
114
|
+
metricAggregations: ["TOTAL"],
|
|
115
|
+
orderBys: [{ dimension: { dimensionName: "date" } }]
|
|
116
|
+
});
|
|
117
|
+
const rows = [];
|
|
118
|
+
for (const row of response.rows ?? []) {
|
|
119
|
+
const ymd = row.dimensionValues?.[0]?.value ?? "";
|
|
120
|
+
const ts = dayIso(`${ymd.slice(0, 4)}-${ymd.slice(4, 6)}-${ymd.slice(6, 8)}`);
|
|
121
|
+
if (ts) rows.push({
|
|
122
|
+
timestamp: ts,
|
|
123
|
+
metrics: readRow(row)
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
const totalsRow = response.totals?.[0];
|
|
127
|
+
return {
|
|
128
|
+
rows,
|
|
129
|
+
totals: totalsRow ? readRow(totalsRow) : {},
|
|
130
|
+
meta: {
|
|
131
|
+
provider: "ga4",
|
|
132
|
+
fetchedAt
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
const [response] = await client.runReport({
|
|
137
|
+
...baseRequest,
|
|
138
|
+
...providerDims.length ? { dimensions: providerDims.map((name) => ({ name })) } : {},
|
|
139
|
+
...q.limit ? { limit: q.limit } : {}
|
|
140
|
+
});
|
|
141
|
+
if (!dims.length) {
|
|
142
|
+
const row = response.rows?.[0];
|
|
143
|
+
const totals = row ? readRow(row) : {};
|
|
144
|
+
return {
|
|
145
|
+
rows: [{ metrics: totals }],
|
|
146
|
+
totals,
|
|
147
|
+
meta: {
|
|
148
|
+
provider: "ga4",
|
|
149
|
+
fetchedAt
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
return {
|
|
154
|
+
rows: (response.rows ?? []).map((row) => {
|
|
155
|
+
const dimValues = {};
|
|
156
|
+
for (const d of dims) {
|
|
157
|
+
const idx = providerDims.indexOf(DIMENSION_MAP[d]);
|
|
158
|
+
dimValues[d] = row.dimensionValues?.[idx]?.value ?? "";
|
|
159
|
+
}
|
|
160
|
+
return {
|
|
161
|
+
dimensions: dimValues,
|
|
162
|
+
metrics: readRow(row)
|
|
163
|
+
};
|
|
164
|
+
}),
|
|
165
|
+
totals: void 0,
|
|
166
|
+
meta: {
|
|
167
|
+
provider: "ga4",
|
|
168
|
+
fetchedAt
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
//#endregion
|
|
175
|
+
export { ga4 };
|
|
176
|
+
|
|
177
|
+
//# sourceMappingURL=ga4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ga4.js","names":[],"sources":["../../../src/adapters/ga4/ga4.ts"],"sourcesContent":["import type { BetaAnalyticsDataClient, protos } from '@google-analytics/data'\nimport type {\n\tAdapterContext,\n\tAnalyticsAdapter,\n\tAnalyticsCapabilities,\n\tAnalyticsQuery,\n\tAnalyticsResult,\n\tAnalyticsRow,\n\tDimensionKey,\n\tMetricKey,\n} from '../../core/contract'\nimport { dayIso } from '../series'\n\nexport interface Ga4Config {\n\t/** GA4 property id (numeric), e.g. '123456789'. */\n\tpropertyId: string\n\t/** Service-account credentials. */\n\tcredentials: { client_email: string; private_key: string }\n\t/** GCP project id; inferred from the credentials when omitted. */\n\tprojectId?: string\n\t/** Maximum days of historical data. Defaults to 425 (GA4's rolling-window limit). Pass null to disable clamping. */\n\tmaxLookbackDays?: number | null\n}\n\nconst METRIC_MAP: Partial<Record<MetricKey, string>> = {\n\tpageviews: 'screenPageViews',\n\tvisitors: 'totalUsers',\n\tvisits: 'sessions',\n\tsessions: 'sessions',\n\tbounceRate: 'bounceRate',\n\tavgDuration: 'averageSessionDuration',\n\tevents: 'eventCount',\n\tconversions: 'keyEvents',\n\trevenue: 'totalRevenue',\n}\n\nconst DIMENSION_MAP: Partial<Record<DimensionKey, string>> = {\n\tpage: 'pagePath',\n\treferrer: 'pageReferrer',\n\tsource: 'sessionSource',\n\tmedium: 'sessionMedium',\n\tcampaign: 'sessionCampaignName',\n\tutmSource: 'sessionSource',\n\tutmMedium: 'sessionMedium',\n\tutmCampaign: 'sessionCampaignName',\n\tdevice: 'deviceCategory',\n\tbrowser: 'browser',\n\tos: 'operatingSystem',\n\tcountry: 'countryId',\n\tregion: 'region',\n\tcity: 'city',\n\tlanguage: 'language',\n\tevent: 'eventName',\n}\n\nconst ga4Metrics: ReadonlySet<MetricKey> = new Set(Object.keys(METRIC_MAP) as MetricKey[])\nconst ga4Dimensions: ReadonlySet<DimensionKey> = new Set(\n\tObject.keys(DIMENSION_MAP) as DimensionKey[]\n)\n\n// GA4 returns bounceRate as a 0..1 ratio and averageSessionDuration in seconds; the\n// contract uses a 0..100 percentage and milliseconds.\nconst toContractValue = (metric: MetricKey, raw: number): number => {\n\tif (metric === 'avgDuration') {\n\t\treturn Math.round(raw * 1000)\n\t}\n\tif (metric === 'bounceRate') {\n\t\treturn Math.round(raw * 100)\n\t}\n\treturn raw\n}\n\nexport function ga4(config: Ga4Config): AnalyticsAdapter {\n\tconst maxLookbackDays = config.maxLookbackDays !== undefined ? config.maxLookbackDays : 425\n\n\tconst capabilities: AnalyticsCapabilities = {\n\t\tperPageQuery: true,\n\t\trealtime: false,\n\t\tcomparison: false,\n\t\tminGranularity: 'day',\n\t\tmaxLookbackDays,\n\t\tmetrics: ga4Metrics,\n\t\tdimensions: ga4Dimensions,\n\t\tbatchPageReport: true,\n\t\trateLimit: { maxConcurrent: 10, quotaModel: 'tokens', readsCountAsUsage: true },\n\t\trecommendedTtl: { realtime: 300, aggregate: 21600 },\n\t}\n\n\tlet clientPromise: Promise<BetaAnalyticsDataClient> | undefined\n\n\tconst getClient = (): Promise<BetaAnalyticsDataClient> => {\n\t\tif (!clientPromise) {\n\t\t\tclientPromise = (async () => {\n\t\t\t\tlet mod: typeof import('@google-analytics/data')\n\t\t\t\ttry {\n\t\t\t\t\tmod = await import('@google-analytics/data')\n\t\t\t\t} catch {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t'@10x-media/analytics: the GA4 adapter requires the optional peer dependency \"@google-analytics/data\". Install it with: pnpm add @google-analytics/data'\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\treturn new mod.BetaAnalyticsDataClient({\n\t\t\t\t\tcredentials: config.credentials,\n\t\t\t\t\tprojectId: config.projectId,\n\t\t\t\t})\n\t\t\t})()\n\t\t}\n\t\treturn clientPromise\n\t}\n\n\treturn {\n\t\tid: 'ga4',\n\t\tlabel: 'Google Analytics 4',\n\t\tcapabilities,\n\t\tisConfigured: () =>\n\t\t\tBoolean(\n\t\t\t\tconfig.propertyId && config.credentials?.client_email && config.credentials?.private_key\n\t\t\t),\n\t\t// The gRPC SDK's gax CallOptions has no AbortSignal field, so ctx.signal cannot be\n\t\t// forwarded; gax cancellation uses the call's own handle, not our signal.\n\t\tasync query(q: AnalyticsQuery, _ctx: AdapterContext): Promise<AnalyticsResult> {\n\t\t\tconst fetchedAt = q.dateRange.end.toISOString()\n\t\t\tconst wanted = q.metrics.filter((m) => METRIC_MAP[m])\n\t\t\tconst providerMetrics = [...new Set(wanted.map((m) => METRIC_MAP[m] as string))]\n\t\t\tconst dims = (q.dimensions ?? []).filter((d) => DIMENSION_MAP[d])\n\t\t\tconst providerDims = [...new Set(dims.map((d) => DIMENSION_MAP[d] as string))]\n\n\t\t\tconst readRow = (\n\t\t\t\trow: protos.google.analytics.data.v1beta.IRow\n\t\t\t): Partial<Record<MetricKey, number>> => {\n\t\t\t\tconst out: Partial<Record<MetricKey, number>> = {}\n\t\t\t\tfor (const m of wanted) {\n\t\t\t\t\tconst idx = providerMetrics.indexOf(METRIC_MAP[m] as string)\n\t\t\t\t\tout[m] = toContractValue(m, Number(row.metricValues?.[idx]?.value ?? 0))\n\t\t\t\t}\n\t\t\t\treturn out\n\t\t\t}\n\n\t\t\tconst baseRequest: protos.google.analytics.data.v1beta.IRunReportRequest = {\n\t\t\t\tproperty: `properties/${config.propertyId}`,\n\t\t\t\tdateRanges: [\n\t\t\t\t\t{\n\t\t\t\t\t\tstartDate: q.dateRange.start.toISOString().slice(0, 10),\n\t\t\t\t\t\tendDate: q.dateRange.end.toISOString().slice(0, 10),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tmetrics: providerMetrics.map((name) => ({ name })),\n\t\t\t\t...(q.path\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tdimensionFilter: {\n\t\t\t\t\t\t\t\tfilter: {\n\t\t\t\t\t\t\t\t\tfieldName: 'pagePath',\n\t\t\t\t\t\t\t\t\tstringFilter: { matchType: 'EXACT', value: q.path },\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t}\n\t\t\t\t\t: {}),\n\t\t\t}\n\n\t\t\tconst client = await getClient()\n\n\t\t\tif (q.granularity === 'day' && !dims.length) {\n\t\t\t\tconst [response] = await client.runReport({\n\t\t\t\t\t...baseRequest,\n\t\t\t\t\tdimensions: [{ name: 'date' }],\n\t\t\t\t\tmetricAggregations: [\n\t\t\t\t\t\t'TOTAL',\n\t\t\t\t\t] as unknown as protos.google.analytics.data.v1beta.MetricAggregation[],\n\t\t\t\t\torderBys: [{ dimension: { dimensionName: 'date' } }],\n\t\t\t\t})\n\t\t\t\tconst rows: AnalyticsRow[] = []\n\t\t\t\tfor (const row of response.rows ?? []) {\n\t\t\t\t\tconst ymd = row.dimensionValues?.[0]?.value ?? ''\n\t\t\t\t\tconst ts = dayIso(`${ymd.slice(0, 4)}-${ymd.slice(4, 6)}-${ymd.slice(6, 8)}`)\n\t\t\t\t\tif (ts) {\n\t\t\t\t\t\trows.push({ timestamp: ts, metrics: readRow(row) })\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst totalsRow = response.totals?.[0]\n\t\t\t\tconst totals = totalsRow ? readRow(totalsRow) : {}\n\t\t\t\treturn { rows, totals, meta: { provider: 'ga4', fetchedAt } }\n\t\t\t}\n\n\t\t\tconst [response] = await client.runReport({\n\t\t\t\t...baseRequest,\n\t\t\t\t...(providerDims.length ? { dimensions: providerDims.map((name) => ({ name })) } : {}),\n\t\t\t\t...(q.limit ? { limit: q.limit } : {}),\n\t\t\t})\n\n\t\t\tif (!dims.length) {\n\t\t\t\tconst row = response.rows?.[0]\n\t\t\t\tconst totals = row ? readRow(row) : {}\n\t\t\t\treturn { rows: [{ metrics: totals }], totals, meta: { provider: 'ga4', fetchedAt } }\n\t\t\t}\n\n\t\t\tconst rows: AnalyticsRow[] = (response.rows ?? []).map((row) => {\n\t\t\t\tconst dimValues: Partial<Record<DimensionKey, string>> = {}\n\t\t\t\tfor (const d of dims) {\n\t\t\t\t\tconst idx = providerDims.indexOf(DIMENSION_MAP[d] as string)\n\t\t\t\t\tdimValues[d] = row.dimensionValues?.[idx]?.value ?? ''\n\t\t\t\t}\n\t\t\t\treturn { dimensions: dimValues, metrics: readRow(row) }\n\t\t\t})\n\t\t\tretur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AC3D,UAAU,KAAK,IAAI,kBAAkB,MAAM,SAAS;KACrD;KACA,OAAO;MAAE,YAAY;MAAW,SAAS,QAAQ,GAAG;KAAE;IACvD,CACY;IAAG,QAAQ,KAAA;IAAW,MAAM;KAAE,UAAU;KAAO;IAAU;GAAE;EACxE;CACD;AACD"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { n as AnalyticsAdapter } from "../../contract-CWZPKWuR.js";
|
|
2
|
+
import { n as GeoResolver } from "../../geoResolver-CasIa4T9.js";
|
|
3
|
+
|
|
4
|
+
//#region src/native/nativeAdapter.d.ts
|
|
5
|
+
interface NativeOptions {
|
|
6
|
+
geoResolver?: GeoResolver;
|
|
7
|
+
geoDbPath?: string;
|
|
8
|
+
ingestPath?: string;
|
|
9
|
+
retentionDays?: number;
|
|
10
|
+
/** Opt-in in-process write batching. `true` uses defaults (maxSize 50, maxAgeMs 2000). */
|
|
11
|
+
buffer?: boolean | {
|
|
12
|
+
maxSize?: number;
|
|
13
|
+
maxAgeMs?: number;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
type NativeAdapter = AnalyticsAdapter & {
|
|
17
|
+
flush: () => Promise<void>;
|
|
18
|
+
};
|
|
19
|
+
declare function native(options?: NativeOptions): NativeAdapter;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { type NativeOptions, native };
|
|
22
|
+
//# sourceMappingURL=native.d.ts.map
|