@iann29/rastro 0.4.0 → 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.
Files changed (92) hide show
  1. package/README.md +122 -17
  2. package/agent/integration.md +26 -10
  3. package/agent/manifest.json +10 -5
  4. package/agent/manifest.schema.json +14 -5
  5. package/dist/client/federation.d.ts +28 -8
  6. package/dist/client/federation.d.ts.map +1 -1
  7. package/dist/client/federation.js +12 -1
  8. package/dist/client/federation.js.map +1 -1
  9. package/dist/client/index.d.ts +262 -9
  10. package/dist/client/index.d.ts.map +1 -1
  11. package/dist/client/index.js +119 -2
  12. package/dist/client/index.js.map +1 -1
  13. package/dist/component/_generated/api.d.ts +6 -0
  14. package/dist/component/_generated/api.d.ts.map +1 -1
  15. package/dist/component/_generated/api.js.map +1 -1
  16. package/dist/component/_generated/component.d.ts +71 -1
  17. package/dist/component/_generated/component.d.ts.map +1 -1
  18. package/dist/component/constants.d.ts +2 -0
  19. package/dist/component/constants.d.ts.map +1 -1
  20. package/dist/component/constants.js +7 -0
  21. package/dist/component/constants.js.map +1 -1
  22. package/dist/component/coverage.d.ts +1 -0
  23. package/dist/component/coverage.d.ts.map +1 -1
  24. package/dist/component/coverage.js +6 -1
  25. package/dist/component/coverage.js.map +1 -1
  26. package/dist/component/eventStore.d.ts +2 -0
  27. package/dist/component/eventStore.d.ts.map +1 -1
  28. package/dist/component/http.d.ts.map +1 -1
  29. package/dist/component/http.js +51 -1
  30. package/dist/component/http.js.map +1 -1
  31. package/dist/component/ingest.d.ts +2 -0
  32. package/dist/component/ingest.d.ts.map +1 -1
  33. package/dist/component/ingest.js +42 -3
  34. package/dist/component/ingest.js.map +1 -1
  35. package/dist/component/origin.d.ts +70 -0
  36. package/dist/component/origin.d.ts.map +1 -0
  37. package/dist/component/origin.js +230 -0
  38. package/dist/component/origin.js.map +1 -0
  39. package/dist/component/platforms.d.ts +33 -0
  40. package/dist/component/platforms.d.ts.map +1 -0
  41. package/dist/component/platforms.js +328 -0
  42. package/dist/component/platforms.js.map +1 -0
  43. package/dist/component/reports.d.ts +27 -72
  44. package/dist/component/reports.d.ts.map +1 -1
  45. package/dist/component/reports.js +51 -10
  46. package/dist/component/reports.js.map +1 -1
  47. package/dist/component/sanitize.d.ts +5 -0
  48. package/dist/component/sanitize.d.ts.map +1 -1
  49. package/dist/component/sanitize.js +33 -1
  50. package/dist/component/sanitize.js.map +1 -1
  51. package/dist/component/schema.d.ts +62 -7
  52. package/dist/component/schema.js +16 -1
  53. package/dist/component/schema.js.map +1 -1
  54. package/dist/component/trackedLinks.d.ts +91 -0
  55. package/dist/component/trackedLinks.d.ts.map +1 -0
  56. package/dist/component/trackedLinks.js +314 -0
  57. package/dist/component/trackedLinks.js.map +1 -0
  58. package/dist/component/useragent.d.ts +6 -0
  59. package/dist/component/useragent.d.ts.map +1 -1
  60. package/dist/component/useragent.js +9 -0
  61. package/dist/component/useragent.js.map +1 -1
  62. package/dist/component/validators.d.ts +51 -11
  63. package/dist/component/validators.d.ts.map +1 -1
  64. package/dist/component/validators.js +35 -1
  65. package/dist/component/validators.js.map +1 -1
  66. package/dist/tracker/generated.d.ts +6 -6
  67. package/dist/tracker/generated.d.ts.map +1 -1
  68. package/dist/tracker/generated.js +6 -6
  69. package/dist/tracker/generated.js.map +1 -1
  70. package/dist/tracker/tracker.d.ts +1 -0
  71. package/dist/tracker/tracker.d.ts.map +1 -1
  72. package/dist/tracker/tracker.js +16 -4
  73. package/dist/tracker/tracker.js.map +1 -1
  74. package/dist/tracker.min.js +1 -1
  75. package/docs/upgrading.md +152 -19
  76. package/llms.txt +6 -1
  77. package/package.json +2 -2
  78. package/src/component/_generated/api.ts +6 -0
  79. package/src/component/_generated/component.ts +152 -1
  80. package/src/component/constants.ts +7 -0
  81. package/src/component/coverage.ts +7 -1
  82. package/src/component/http.ts +56 -1
  83. package/src/component/ingest.ts +54 -1
  84. package/src/component/origin.ts +273 -0
  85. package/src/component/platforms.ts +359 -0
  86. package/src/component/reports.ts +74 -10
  87. package/src/component/sanitize.ts +39 -1
  88. package/src/component/schema.ts +18 -0
  89. package/src/component/trackedLinks.ts +384 -0
  90. package/src/component/useragent.ts +11 -0
  91. package/src/component/validators.ts +71 -0
  92. package/src/tracker/generated.ts +6 -6
@@ -0,0 +1,314 @@
1
+ import { v } from "convex/values";
2
+ import { internal } from "./_generated/api.js";
3
+ import { internalMutation, mutation, query } from "./_generated/server.js";
4
+ import { DAY_MS, MAX_TRACKED_LINKS_PER_SITE, TRACKED_LINK_CLICK_SHARDS, } from "./constants.js";
5
+ import { fail } from "./errors.js";
6
+ import { cleanString, originAllowed, sanitizeOpaqueId } from "./sanitize.js";
7
+ import { trackedLinkChannelValidator, trackedLinkFieldsValidator, } from "./validators.js";
8
+ const SLUG = /^[a-z0-9][a-z0-9-]{1,30}[a-z0-9]$/;
9
+ const PLATFORM = /^[a-z0-9_]{2,24}$/;
10
+ const MAX_DESTINATION_LENGTH = 2048;
11
+ const MAX_CAMPAIGN_LENGTH = 64;
12
+ const RECENT_DAYS = 30;
13
+ // Each shard's all-time counter sits beside the daily ones under this day, so
14
+ // a link's total is TRACKED_LINK_CLICK_SHARDS rows however long it has lived.
15
+ const ALL_TIME = 0;
16
+ const PURGE_BATCH = 500;
17
+ const trackedLinkDocumentValidator = trackedLinkFieldsValidator.extend({
18
+ _id: v.id("trackedLinks"),
19
+ _creationTime: v.number(),
20
+ });
21
+ const redirectValidator = trackedLinkFieldsValidator.pick("slug", "destination", "platform", "channel", "campaign");
22
+ export function isTrackedLinkSlug(value) {
23
+ return SLUG.test(value);
24
+ }
25
+ /**
26
+ * Where a click lands: the destination with the link's utm_* appended. A key
27
+ * the destination already carries wins, and its own query keeps its exact
28
+ * encoding because the tags are appended as text.
29
+ */
30
+ export function trackedLinkLocation(link) {
31
+ const url = new URL(link.destination);
32
+ const utm = [
33
+ ["utm_source", link.platform],
34
+ ["utm_medium", link.channel],
35
+ ["utm_campaign", link.campaign ?? link.slug],
36
+ ["utm_content", link.slug],
37
+ ];
38
+ const tags = new URLSearchParams(utm.filter(([key]) => !url.searchParams.has(key))).toString();
39
+ if (tags)
40
+ url.search = url.search ? `${url.search}&${tags}` : `?${tags}`;
41
+ return url.href;
42
+ }
43
+ function sanitizeLinkSlug(value) {
44
+ const slug = value.trim().toLowerCase();
45
+ if (!isTrackedLinkSlug(slug)) {
46
+ fail("INVALID_ARGUMENT", "slug must be 3 to 32 lowercase letters, digits or hyphens, starting and ending with a letter or digit");
47
+ }
48
+ return slug;
49
+ }
50
+ function sanitizePlatform(value) {
51
+ const platform = value.trim().toLowerCase();
52
+ if (!PLATFORM.test(platform)) {
53
+ fail("INVALID_ARGUMENT", "platform must be 2 to 24 lowercase letters, digits or underscores");
54
+ }
55
+ return platform;
56
+ }
57
+ function sanitizeCampaign(value) {
58
+ return value === undefined
59
+ ? undefined
60
+ : cleanString(value, MAX_CAMPAIGN_LENGTH) || undefined;
61
+ }
62
+ // No open redirect: the destination is an absolute http(s) URL on one of the
63
+ // site's own domains, the same rule the ingestion origin check applies.
64
+ function sanitizeDestination(value, domains) {
65
+ let url;
66
+ try {
67
+ if (value.length <= MAX_DESTINATION_LENGTH) {
68
+ url = new URL(cleanString(value, MAX_DESTINATION_LENGTH));
69
+ }
70
+ }
71
+ catch {
72
+ url = undefined;
73
+ }
74
+ if (!url ||
75
+ (url.protocol !== "http:" && url.protocol !== "https:") ||
76
+ url.username ||
77
+ url.password) {
78
+ fail("INVALID_ARGUMENT", "destination must be an absolute http(s) URL without credentials");
79
+ }
80
+ if (!originAllowed(url.href, domains)) {
81
+ fail("INVALID_ARGUMENT", "destination must be on one of the site's domains");
82
+ }
83
+ return url.href;
84
+ }
85
+ export const create = mutation({
86
+ args: {
87
+ siteId: v.id("sites"),
88
+ slug: v.string(),
89
+ destination: v.string(),
90
+ platform: v.string(),
91
+ channel: trackedLinkChannelValidator,
92
+ campaign: v.optional(v.string()),
93
+ createdBy: v.string(),
94
+ },
95
+ returns: v.id("trackedLinks"),
96
+ handler: async (ctx, args) => {
97
+ const site = await ctx.db.get("sites", args.siteId);
98
+ if (!site)
99
+ fail("NOT_FOUND", "site not found");
100
+ const slug = sanitizeLinkSlug(args.slug);
101
+ const destination = sanitizeDestination(args.destination, site.domains);
102
+ const platform = sanitizePlatform(args.platform);
103
+ let createdBy;
104
+ try {
105
+ createdBy = sanitizeOpaqueId(args.createdBy, "createdBy");
106
+ }
107
+ catch (error) {
108
+ fail("INVALID_ARGUMENT", error instanceof Error ? error.message : "invalid createdBy");
109
+ }
110
+ const taken = await ctx.db
111
+ .query("trackedLinks")
112
+ .withIndex("by_slug", (range) => range.eq("slug", slug))
113
+ .unique();
114
+ if (taken)
115
+ fail("CONFLICT", "another tracked link already uses this slug");
116
+ const links = await ctx.db
117
+ .query("trackedLinks")
118
+ .withIndex("by_siteId", (range) => range.eq("siteId", args.siteId))
119
+ .take(MAX_TRACKED_LINKS_PER_SITE);
120
+ if (links.length >= MAX_TRACKED_LINKS_PER_SITE) {
121
+ fail("LIMIT_EXCEEDED", "tracked link limit reached", {
122
+ limit: MAX_TRACKED_LINKS_PER_SITE,
123
+ });
124
+ }
125
+ return await ctx.db.insert("trackedLinks", {
126
+ siteId: args.siteId,
127
+ slug,
128
+ destination,
129
+ platform,
130
+ channel: args.channel,
131
+ campaign: sanitizeCampaign(args.campaign),
132
+ createdAt: Date.now(),
133
+ createdBy,
134
+ });
135
+ },
136
+ });
137
+ /** Everything but the slug, which every link already printed carries. */
138
+ export const update = mutation({
139
+ args: {
140
+ siteId: v.id("sites"),
141
+ linkId: v.id("trackedLinks"),
142
+ destination: v.optional(v.string()),
143
+ platform: v.optional(v.string()),
144
+ channel: v.optional(trackedLinkChannelValidator),
145
+ campaign: v.optional(v.union(v.string(), v.null())),
146
+ disabled: v.optional(v.boolean()),
147
+ },
148
+ returns: v.null(),
149
+ handler: async (ctx, args) => {
150
+ const link = await ctx.db.get("trackedLinks", args.linkId);
151
+ if (!link || link.siteId !== args.siteId) {
152
+ fail("NOT_FOUND", "tracked link not found");
153
+ }
154
+ const patch = {};
155
+ if (args.destination !== undefined) {
156
+ const site = await ctx.db.get("sites", args.siteId);
157
+ if (!site)
158
+ fail("NOT_FOUND", "site not found");
159
+ patch.destination = sanitizeDestination(args.destination, site.domains);
160
+ }
161
+ if (args.platform !== undefined) {
162
+ patch.platform = sanitizePlatform(args.platform);
163
+ }
164
+ if (args.channel !== undefined)
165
+ patch.channel = args.channel;
166
+ if (args.campaign !== undefined) {
167
+ patch.campaign = sanitizeCampaign(args.campaign ?? undefined);
168
+ }
169
+ if (args.disabled !== undefined) {
170
+ patch.disabledAt = args.disabled
171
+ ? (link.disabledAt ?? Date.now())
172
+ : undefined;
173
+ }
174
+ await ctx.db.patch("trackedLinks", args.linkId, patch);
175
+ return null;
176
+ },
177
+ });
178
+ export const remove = mutation({
179
+ args: { siteId: v.id("sites"), linkId: v.id("trackedLinks") },
180
+ returns: v.null(),
181
+ handler: async (ctx, args) => {
182
+ const link = await ctx.db.get("trackedLinks", args.linkId);
183
+ if (!link || link.siteId !== args.siteId) {
184
+ fail("NOT_FOUND", "tracked link not found");
185
+ }
186
+ await ctx.db.delete("trackedLinks", args.linkId);
187
+ await ctx.scheduler.runAfter(0, internal.trackedLinks.purgeClicks, {
188
+ linkId: args.linkId,
189
+ });
190
+ return null;
191
+ },
192
+ });
193
+ /**
194
+ * The site's links, newest first, with their clicks and bot hits: all time,
195
+ * and over the 30 UTC days ending on the day of `now`. The caller passes the
196
+ * clock so the subscription does not go stale.
197
+ */
198
+ export const list = query({
199
+ args: { siteId: v.id("sites"), now: v.number() },
200
+ returns: v.array(trackedLinkDocumentValidator.extend({
201
+ clicks: v.number(),
202
+ bots: v.number(),
203
+ clicksLast30Days: v.number(),
204
+ botsLast30Days: v.number(),
205
+ })),
206
+ handler: async (ctx, args) => {
207
+ if (!Number.isSafeInteger(args.now) || args.now < RECENT_DAYS * DAY_MS) {
208
+ fail("INVALID_ARGUMENT", "now must be a Unix time in milliseconds");
209
+ }
210
+ const since = Math.floor(args.now / DAY_MS) * DAY_MS - (RECENT_DAYS - 1) * DAY_MS;
211
+ const links = await ctx.db
212
+ .query("trackedLinks")
213
+ .withIndex("by_siteId", (range) => range.eq("siteId", args.siteId))
214
+ .order("desc")
215
+ .take(MAX_TRACKED_LINKS_PER_SITE);
216
+ const sum = (rows) => rows.reduce((total, row) => ({
217
+ clicks: total.clicks + row.clicks,
218
+ bots: total.bots + row.bots,
219
+ }), { clicks: 0, bots: 0 });
220
+ // Up to 4 + 120 counter rows per link, so a full site of 200 links whose
221
+ // every link fills every shard every day reads about 24,800 rows, inside
222
+ // the 32,000 documents a query may read. Raising either cap needs a
223
+ // finished day's shards folded into one row first.
224
+ return await Promise.all(links.map(async (link) => {
225
+ const total = sum(await ctx.db
226
+ .query("trackedLinkClicks")
227
+ .withIndex("by_linkId_and_dayStart_and_shard", (range) => range.eq("linkId", link._id).eq("dayStart", ALL_TIME))
228
+ .take(TRACKED_LINK_CLICK_SHARDS));
229
+ const recent = sum(await ctx.db
230
+ .query("trackedLinkClicks")
231
+ .withIndex("by_linkId_and_dayStart_and_shard", (range) => range
232
+ .eq("linkId", link._id)
233
+ .gte("dayStart", since)
234
+ .lt("dayStart", since + RECENT_DAYS * DAY_MS))
235
+ .take(RECENT_DAYS * TRACKED_LINK_CLICK_SHARDS));
236
+ return {
237
+ ...link,
238
+ clicks: total.clicks,
239
+ bots: total.bots,
240
+ clicksLast30Days: recent.clicks,
241
+ botsLast30Days: recent.bots,
242
+ };
243
+ }));
244
+ },
245
+ });
246
+ /**
247
+ * Counts one click on a live link and returns where it goes, or null for an
248
+ * unknown or disabled slug. Bots are counted apart and never as clicks. The
249
+ * destination is checked against the site's domains again, so a domain the
250
+ * site has since dropped stops redirecting.
251
+ */
252
+ export const recordClick = internalMutation({
253
+ args: { slug: v.string(), bot: v.boolean() },
254
+ returns: v.union(redirectValidator, v.null()),
255
+ handler: async (ctx, args) => {
256
+ const link = await ctx.db
257
+ .query("trackedLinks")
258
+ .withIndex("by_slug", (range) => range.eq("slug", args.slug))
259
+ .unique();
260
+ if (!link || link.disabledAt !== undefined)
261
+ return null;
262
+ const site = await ctx.db.get("sites", link.siteId);
263
+ if (!site || !originAllowed(link.destination, site.domains))
264
+ return null;
265
+ const now = Date.now();
266
+ const shard = Math.floor(Math.random() * TRACKED_LINK_CLICK_SHARDS);
267
+ for (const dayStart of [Math.floor(now / DAY_MS) * DAY_MS, ALL_TIME]) {
268
+ const row = await ctx.db
269
+ .query("trackedLinkClicks")
270
+ .withIndex("by_linkId_and_dayStart_and_shard", (range) => range
271
+ .eq("linkId", link._id)
272
+ .eq("dayStart", dayStart)
273
+ .eq("shard", shard))
274
+ .unique();
275
+ if (row) {
276
+ await ctx.db.patch("trackedLinkClicks", row._id, args.bot ? { bots: row.bots + 1 } : { clicks: row.clicks + 1 });
277
+ }
278
+ else {
279
+ await ctx.db.insert("trackedLinkClicks", {
280
+ linkId: link._id,
281
+ dayStart,
282
+ shard,
283
+ clicks: args.bot ? 0 : 1,
284
+ bots: args.bot ? 1 : 0,
285
+ });
286
+ }
287
+ }
288
+ return {
289
+ slug: link.slug,
290
+ destination: link.destination,
291
+ platform: link.platform,
292
+ channel: link.channel,
293
+ ...(link.campaign === undefined ? {} : { campaign: link.campaign }),
294
+ };
295
+ },
296
+ });
297
+ /** Deletes a removed link's counters a batch at a time. */
298
+ export const purgeClicks = internalMutation({
299
+ args: { linkId: v.id("trackedLinks") },
300
+ returns: v.null(),
301
+ handler: async (ctx, args) => {
302
+ const rows = await ctx.db
303
+ .query("trackedLinkClicks")
304
+ .withIndex("by_linkId_and_dayStart_and_shard", (range) => range.eq("linkId", args.linkId))
305
+ .take(PURGE_BATCH);
306
+ for (const row of rows)
307
+ await ctx.db.delete("trackedLinkClicks", row._id);
308
+ if (rows.length === PURGE_BATCH) {
309
+ await ctx.scheduler.runAfter(0, internal.trackedLinks.purgeClicks, args);
310
+ }
311
+ return null;
312
+ },
313
+ });
314
+ //# s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Q;YACvB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,GAAG,CAAC,IAAI,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;SACpE,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAEH,2DAA2D;AAC3D,MAAM,CAAC,MAAM,WAAW,GAAG,gBAAgB,CAAC;IAC1C,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,cAAc,CAAC,EAAE;IACtC,OAAO,EAAE,CAAC,CAAC,IAAI,EAAE;IACjB,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAiB,EAAE;QAC1C,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,EAAE;aACtB,KAAK,CAAC,mBAAmB,CAAC;aAC1B,SAAS,CAAC,kCAAkC,EAAE,CAAC,KAAK,EAAE,EAAE,CACvD,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAChC;aACA,IAAI,CAAC,WAAW,CAAC,CAAC;QACrB,KAAK,MAAM,GAAG,IAAI,IAAI;YAAE,MAAM,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,mBAAmB,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;QAC1E,IAAI,IAAI,CAAC,MAAM,KAAK,WAAW,EAAE,CAAC;YAChC,MAAM,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QAC3E,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAC,CAAC"}
@@ -5,5 +5,11 @@ export type ClientClassification = {
5
5
  };
6
6
  export declare function classifyClient(userAgent: string, headers: Headers): ClientClassification;
7
7
  export declare function classifyUserAgent(userAgent: string): ClientClassification;
8
+ /**
9
+ * The platform whose in-app browser sent the request (Instagram, Facebook,
10
+ * TikTok…), from the marker each app appends to the User-Agent. The system
11
+ * browser a messaging app hands a link to carries none.
12
+ */
13
+ export declare function inAppPlatform(userAgent: string): string | undefined;
8
14
  export declare function isKnownBot(userAgent: string): boolean;
9
15
  //# sourceMappingURL=useragent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useragent.d.ts","sourceRoot":"","sources":["../../src/component/useragent.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AA2EF,wBAAgB,cAAc,CAC5B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,OAAO,GACf,oBAAoB,CAUtB;AAED,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,oBAAoB,CAMzE;AAoED,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAErD"}
1
+ {"version":3,"file":"useragent.d.ts","sourceRoot":"","sources":["../../src/component/useragent.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AA2EF,wBAAgB,cAAc,CAC5B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,OAAO,GACf,oBAAoB,CAUtB;AAED,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,oBAAoB,CAMzE;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEnE;AAoED,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAErD"}
@@ -1,3 +1,4 @@
1
+ import { PLATFORMS } from "./platforms.js";
1
2
  // The tracker never reports the client: everything here is derived from headers
2
3
  // the browser sets itself. Chromium sends the low-entropy `Sec-CH-UA` hints on
3
4
  // cross-origin requests without an `Accept-CH` opt-in, which is the only way to
@@ -80,6 +81,14 @@ export function classifyUserAgent(userAgent) {
80
81
  device: matchAgent(AGENT_DEVICES, userAgent) ?? "desktop",
81
82
  };
82
83
  }
84
+ /**
85
+ * The platform whose in-app browser sent the request (Instagram, Facebook,
86
+ * TikTok…), from the marker each app appends to the User-Agent. The system
87
+ * browser a messaging app hands a link to carries none.
88
+ */
89
+ export function inAppPlatform(userAgent) {
90
+ return PLATFORMS.find((row) => row.agent?.test(userAgent))?.id;
91
+ }
83
92
  function matchAgent(table, userAgent) {
84
93
  for (const [pattern, value] of table) {
85
94
  if (pattern.test(userAgent))
@@ -1 +1 @@
1
- {"version":3,"file":"useragent.js","sourceRoot":"","sources":["../../src/component/useragent.ts"],"names":[],"mappings":"AAMA,gFAAgF;AAChF,+EAA+E;AAC/E,gFAAgF;AAChF,+EAA+E;AAC/E,4EAA4E;AAC5E,4EAA4E;AAC5E,MAAM,eAAe,GAAG,GAAG,CAAC;AAC5B,MAAM,eAAe,GAAG,EAAE,CAAC;AAE3B,MAAM,aAAa,GACjB,2DAA2D,CAAC;AAC9D,MAAM,gBAAgB,GAAG,6BAA6B,CAAC;AAEvD,gFAAgF;AAChF,4EAA4E;AAC5E,0EAA0E;AAC1E,2CAA2C;AAC3C,MAAM,WAAW,GAAG,IAAI,GAAG,CAAiB;IAC1C,CAAC,OAAO,EAAE,OAAO,CAAC;IAClB,CAAC,UAAU,EAAE,UAAU,CAAC;IACxB,CAAC,eAAe,EAAE,QAAQ,CAAC;IAC3B,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAC1B,CAAC,OAAO,EAAE,OAAO,CAAC;IAClB,CAAC,UAAU,EAAE,OAAO,CAAC;IACrB,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;IACxC,CAAC,SAAS,EAAE,SAAS,CAAC;IACtB,CAAC,QAAQ,EAAE,QAA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CAAC,CAAC;IAC5C,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAC7B,OAAO,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;AACpE,CAAC;AAED,SAAS,qBAAqB,CAAC,MAAqB;IAClD,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IACtC,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;IAC5B,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAChC,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IACjC,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,qBAAqB,CAC5B,MAA2B,EAC3B,QAA4B;IAE5B,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC3C,IAAI,MAAM;QAAE,OAAO,QAAQ,CAAC;IAC5B,yEAAyE;IACzE,qEAAqE;IACrE,4EAA4E;IAC5E,2EAA2E;IAC3E,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,QAAQ,CAAC;IAC5C,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,OAAO,CAAC,KAAa;IAC5B,OAAO,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AACvC,CAAC;AAED,+EAA+E;AAC/E,2EAA2E;AAC3E,6EAA6E;AAC7E,8EAA8E;AAC9E,0EAA0E;AAC1E,MAAM,WAAW,GACf,6RAA6R,CAAC;AAEhS,MAAM,UAAU,UAAU,CAAC,SAAiB;IAC1C,OAAO,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AACrC,CAAC"}
@@ -5,6 +5,7 @@ export declare const propertyValueValidator: import("convex/values").VUnion<stri
5
5
  export declare const eventPropertiesValidator: import("convex/values").VRecord<Record<string, string | number | boolean | null>, import("convex/values").VString<string, "required">, import("convex/values").VUnion<string | number | boolean | null, [import("convex/values").VString<string, "required">, import("convex/values").VFloat64<number, "required">, import("convex/values").VBoolean<boolean, "required">, import("convex/values").VNull<null, "required">], "required", never>, "required", string>;
6
6
  export declare const trackerEventValidator: import("convex/values").VObject<{
7
7
  affiliateSlug?: string | undefined;
8
+ clid?: string[] | undefined;
8
9
  currency?: string | undefined;
9
10
  eventId: string;
10
11
  href?: string | undefined;
@@ -37,12 +38,14 @@ export declare const trackerEventValidator: import("convex/values").VObject<{
37
38
  currency: import("convex/values").VString<string | undefined, "optional">;
38
39
  affiliateSlug: import("convex/values").VString<string | undefined, "optional">;
39
40
  value: import("convex/values").VFloat64<number | undefined, "optional">;
40
- }, "required", "affiliateSlug" | "currency" | "eventId" | "href" | "name" | "path" | "properties" | "referrer" | "revenueCents" | "sequence" | "sessionId" | "target" | "timestamp" | "type" | "value" | "visitorId" | `properties.${string}`>;
41
+ clid: import("convex/values").VArray<string[] | undefined, import("convex/values").VString<string, "required">, "optional">;
42
+ }, "required", "affiliateSlug" | "clid" | "currency" | "eventId" | "href" | "name" | "path" | "properties" | "referrer" | "revenueCents" | "sequence" | "sessionId" | "target" | "timestamp" | "type" | "value" | "visitorId" | `properties.${string}`>;
41
43
  export declare const ingestContextValidator: import("convex/values").VObject<{
42
44
  browser?: string | undefined;
43
45
  city?: string | undefined;
44
46
  country?: string | undefined;
45
47
  device?: string | undefined;
48
+ inApp?: string | undefined;
46
49
  latitude?: number | undefined;
47
50
  longitude?: number | undefined;
48
51
  os?: string | undefined;
@@ -56,17 +59,22 @@ export declare const ingestContextValidator: import("convex/values").VObject<{
56
59
  os: import("convex/values").VString<string | undefined, "optional">;
57
60
  device: import("convex/values").VString<string | undefined, "optional">;
58
61
  visitorKey: import("convex/values").VString<string | undefined, "optional">;
59
- }, "required", "browser" | "city" | "country" | "device" | "latitude" | "longitude" | "os" | "visitorKey">;
62
+ inApp: import("convex/values").VString<string | undefined, "optional">;
63
+ }, "required", "browser" | "city" | "country" | "device" | "inApp" | "latitude" | "longitude" | "os" | "visitorKey">;
64
+ export declare const channelValidator: import("convex/values").VUnion<"affiliate" | "ai" | "direct" | "display" | "email" | "messaging" | "offline" | "organic_search" | "organic_social" | "paid_search" | "paid_social" | "referral", [import("convex/values").VLiteral<"direct", "required">, import("convex/values").VLiteral<"organic_search", "required">, import("convex/values").VLiteral<"paid_search", "required">, import("convex/values").VLiteral<"organic_social", "required">, import("convex/values").VLiteral<"paid_social", "required">, import("convex/values").VLiteral<"messaging", "required">, import("convex/values").VLiteral<"email", "required">, import("convex/values").VLiteral<"affiliate", "required">, import("convex/values").VLiteral<"ai", "required">, import("convex/values").VLiteral<"display", "required">, import("convex/values").VLiteral<"referral", "required">, import("convex/values").VLiteral<"offline", "required">], "required", never>;
65
+ export declare const evidenceValidator: import("convex/values").VUnion<"affiliate" | "clickId" | "inApp" | "legacy" | "none" | "referrer" | "utm", [import("convex/values").VLiteral<"utm", "required">, import("convex/values").VLiteral<"clickId", "required">, import("convex/values").VLiteral<"referrer", "required">, import("convex/values").VLiteral<"inApp", "required">, import("convex/values").VLiteral<"affiliate", "required">, import("convex/values").VLiteral<"none", "required">, import("convex/values").VLiteral<"legacy", "required">], "required", never>;
60
66
  export declare const batchedEventValidator: import("convex/values").VObject<{
61
67
  affiliateSlug?: string | undefined;
62
68
  aggregateCountry?: string | undefined;
63
69
  browser?: string | undefined;
64
70
  city?: string | undefined;
71
+ clid?: string[] | undefined;
65
72
  country?: string | undefined;
66
73
  currency?: string | undefined;
67
74
  device?: string | undefined;
68
75
  eventId: string;
69
76
  href?: string | undefined;
77
+ inApp?: string | undefined;
70
78
  latitude?: number | undefined;
71
79
  longitude?: number | undefined;
72
80
  name?: string | undefined;
@@ -100,6 +108,7 @@ export declare const batchedEventValidator: import("convex/values").VObject<{
100
108
  currency: import("convex/values").VString<string | undefined, "optional">;
101
109
  affiliateSlug: import("convex/values").VString<string | undefined, "optional">;
102
110
  value: import("convex/values").VFloat64<number | undefined, "optional">;
111
+ clid: import("convex/values").VArray<string[] | undefined, import("convex/values").VString<string, "required">, "optional">;
103
112
  country: import("convex/values").VString<string | undefined, "optional">;
104
113
  city: import("convex/values").VString<string | undefined, "optional">;
105
114
  latitude: import("convex/values").VFloat64<number | undefined, "optional">;
@@ -108,8 +117,9 @@ export declare const batchedEventValidator: import("convex/values").VObject<{
108
117
  os: import("convex/values").VString<string | undefined, "optional">;
109
118
  device: import("convex/values").VString<string | undefined, "optional">;
110
119
  visitorKey: import("convex/values").VString<string | undefined, "optional">;
120
+ inApp: import("convex/values").VString<string | undefined, "optional">;
111
121
  aggregateCountry: import("convex/values").VString<string | undefined, "optional">;
112
- }, "required", "affiliateSlug" | "aggregateCountry" | "browser" | "city" | "country" | "currency" | "device" | "eventId" | "href" | "latitude" | "longitude" | "name" | "os" | "path" | "properties" | "referrer" | "revenueCents" | "sequence" | "sessionId" | "target" | "timestamp" | "type" | "value" | "visitorId" | "visitorKey" | `properties.${string}`>;
122
+ }, "required", "affiliateSlug" | "aggregateCountry" | "browser" | "city" | "clid" | "country" | "currency" | "device" | "eventId" | "href" | "inApp" | "latitude" | "longitude" | "name" | "os" | "path" | "properties" | "referrer" | "revenueCents" | "sequence" | "sessionId" | "target" | "timestamp" | "type" | "value" | "visitorId" | "visitorKey" | `properties.${string}`>;
113
123
  export declare const siteFieldsValidator: import("convex/values").VObject<{
114
124
  cookieless: boolean;
115
125
  createdAt: number;
@@ -137,6 +147,7 @@ export declare const sessionFieldsValidator: import("convex/values").VObject<{
137
147
  affiliateId?: import("convex/values").GenericId<"affiliates"> | undefined;
138
148
  affiliateSlug?: string | undefined;
139
149
  browser: string;
150
+ channel?: "affiliate" | "ai" | "direct" | "display" | "email" | "messaging" | "offline" | "organic_search" | "organic_social" | "paid_search" | "paid_social" | "referral" | undefined;
140
151
  city?: string | undefined;
141
152
  conversionCount: number;
142
153
  country?: string | undefined;
@@ -145,6 +156,7 @@ export declare const sessionFieldsValidator: import("convex/values").VObject<{
145
156
  durationMs: number;
146
157
  entryPath: string;
147
158
  eventCount: number;
159
+ evidence?: "affiliate" | "clickId" | "inApp" | "legacy" | "none" | "referrer" | "utm" | undefined;
148
160
  exitPath: string;
149
161
  lastSeenAt: number;
150
162
  latitude?: number | undefined;
@@ -152,6 +164,7 @@ export declare const sessionFieldsValidator: import("convex/values").VObject<{
152
164
  newVisitor?: boolean | undefined;
153
165
  os: string;
154
166
  pageviewCount: number;
167
+ platform?: string | undefined;
155
168
  referrer?: string | undefined;
156
169
  revenueCents: number;
157
170
  sessionId: string;
@@ -175,6 +188,9 @@ export declare const sessionFieldsValidator: import("convex/values").VObject<{
175
188
  exitPath: import("convex/values").VString<string, "required">;
176
189
  referrer: import("convex/values").VString<string | undefined, "optional">;
177
190
  source: import("convex/values").VString<string, "required">;
191
+ platform: import("convex/values").VString<string | undefined, "optional">;
192
+ channel: import("convex/values").VUnion<"affiliate" | "ai" | "direct" | "display" | "email" | "messaging" | "offline" | "organic_search" | "organic_social" | "paid_search" | "paid_social" | "referral" | undefined, [import("convex/values").VLiteral<"direct", "required">, import("convex/values").VLiteral<"organic_search", "required">, import("convex/values").VLiteral<"paid_search", "required">, import("convex/values").VLiteral<"organic_social", "required">, import("convex/values").VLiteral<"paid_social", "required">, import("convex/values").VLiteral<"messaging", "required">, import("convex/values").VLiteral<"email", "required">, import("convex/values").VLiteral<"affiliate", "required">, import("convex/values").VLiteral<"ai", "required">, import("convex/values").VLiteral<"display", "required">, import("convex/values").VLiteral<"referral", "required">, import("convex/values").VLiteral<"offline", "required">], "optional", never>;
193
+ evidence: import("convex/values").VUnion<"affiliate" | "clickId" | "inApp" | "legacy" | "none" | "referrer" | "utm" | undefined, [import("convex/values").VLiteral<"utm", "required">, import("convex/values").VLiteral<"clickId", "required">, import("convex/values").VLiteral<"referrer", "required">, import("convex/values").VLiteral<"inApp", "required">, import("convex/values").VLiteral<"affiliate", "required">, import("convex/values").VLiteral<"none", "required">, import("convex/values").VLiteral<"legacy", "required">], "optional", never>;
178
194
  utmSource: import("convex/values").VString<string | undefined, "optional">;
179
195
  utmMedium: import("convex/values").VString<string | undefined, "optional">;
180
196
  utmCampaign: import("convex/values").VString<string | undefined, "optional">;
@@ -195,7 +211,7 @@ export declare const sessionFieldsValidator: import("convex/values").VObject<{
195
211
  affiliateId: import("convex/values").VId<import("convex/values").GenericId<"affiliates"> | undefined, "optional">;
196
212
  affiliateAttributedAt: import("convex/values").VFloat64<number | undefined, "optional">;
197
213
  affiliateExpiresAt: import("convex/values").VFloat64<number | undefined, "optional">;
198
- }, "required", "affiliateAttributedAt" | "affiliateExpiresAt" | "affiliateId" | "affiliateSlug" | "browser" | "city" | "conversionCount" | "country" | "currency" | "device" | "durationMs" | "entryPath" | "eventCount" | "exitPath" | "lastSeenAt" | "latitude" | "longitude" | "newVisitor" | "os" | "pageviewCount" | "referrer" | "revenueCents" | "sessionId" | "siteId" | "source" | "startedAt" | "utmCampaign" | "utmMedium" | "utmSource" | "visitorId" | "visitorKey">;
214
+ }, "required", "affiliateAttributedAt" | "affiliateExpiresAt" | "affiliateId" | "affiliateSlug" | "browser" | "channel" | "city" | "conversionCount" | "country" | "currency" | "device" | "durationMs" | "entryPath" | "eventCount" | "evidence" | "exitPath" | "lastSeenAt" | "latitude" | "longitude" | "newVisitor" | "os" | "pageviewCount" | "platform" | "referrer" | "revenueCents" | "sessionId" | "siteId" | "source" | "startedAt" | "utmCampaign" | "utmMedium" | "utmSource" | "visitorId" | "visitorKey">;
199
215
  export declare const eventFieldsValidator: import("convex/values").VObject<{
200
216
  affiliateSlug?: string | undefined;
201
217
  browser: string;
@@ -245,17 +261,17 @@ export declare const eventFieldsValidator: import("convex/values").VObject<{
245
261
  os: import("convex/values").VString<string, "required">;
246
262
  device: import("convex/values").VString<string, "required">;
247
263
  }, "required", "affiliateSlug" | "browser" | "city" | "country" | "currency" | "device" | "eventId" | "href" | "latitude" | "longitude" | "name" | "os" | "path" | "properties" | "referrer" | "revenueCents" | "sequence" | "sessionId" | "siteId" | "target" | "timestamp" | "type" | "visitorId" | `properties.${string}`>;
248
- export declare const dimensionTypeValidator: import("convex/values").VUnion<"browser" | "campaign" | "country" | "device" | "event" | "goal" | "medium" | "outbound" | "page" | "source", [import("convex/values").VLiteral<"source", "required">, import("convex/values").VLiteral<"campaign", "required">, import("convex/values").VLiteral<"page", "required">, import("convex/values").VLiteral<"country", "required">, import("convex/values").VLiteral<"device", "required">, import("convex/values").VLiteral<"browser", "required">, import("convex/values").VLiteral<"event", "required">, import("convex/values").VLiteral<"goal", "required">, import("convex/values").VLiteral<"medium", "required">, import("convex/values").VLiteral<"outbound", "required">], "required", never>;
264
+ export declare const dimensionTypeValidator: import("convex/values").VUnion<"browser" | "campaign" | "channel" | "country" | "device" | "event" | "evidence" | "goal" | "medium" | "outbound" | "page" | "platform" | "source", [import("convex/values").VLiteral<"source", "required">, import("convex/values").VLiteral<"campaign", "required">, import("convex/values").VLiteral<"page", "required">, import("convex/values").VLiteral<"country", "required">, import("convex/values").VLiteral<"device", "required">, import("convex/values").VLiteral<"browser", "required">, import("convex/values").VLiteral<"event", "required">, import("convex/values").VLiteral<"goal", "required">, import("convex/values").VLiteral<"medium", "required">, import("convex/values").VLiteral<"outbound", "required">, import("convex/values").VLiteral<"platform", "required">, import("convex/values").VLiteral<"channel", "required">, import("convex/values").VLiteral<"evidence", "required">], "required", never>;
249
265
  export declare const dimensionSlotValidator: import("convex/values").VObject<{
250
266
  count: number;
251
267
  pageviews?: number | undefined;
252
268
  revenueCents: number;
253
269
  sessions?: number | undefined;
254
270
  slot: number;
255
- type: "browser" | "campaign" | "country" | "device" | "event" | "goal" | "medium" | "outbound" | "page" | "source";
271
+ type: "browser" | "campaign" | "channel" | "country" | "device" | "event" | "evidence" | "goal" | "medium" | "outbound" | "page" | "platform" | "source";
256
272
  value: string;
257
273
  }, {
258
- type: import("convex/values").VUnion<"browser" | "campaign" | "country" | "device" | "event" | "goal" | "medium" | "outbound" | "page" | "source", [import("convex/values").VLiteral<"source", "required">, import("convex/values").VLiteral<"campaign", "required">, import("convex/values").VLiteral<"page", "required">, import("convex/values").VLiteral<"country", "required">, import("convex/values").VLiteral<"device", "required">, import("convex/values").VLiteral<"browser", "required">, import("convex/values").VLiteral<"event", "required">, import("convex/values").VLiteral<"goal", "required">, import("convex/values").VLiteral<"medium", "required">, import("convex/values").VLiteral<"outbound", "required">], "required", never>;
274
+ type: import("convex/values").VUnion<"browser" | "campaign" | "channel" | "country" | "device" | "event" | "evidence" | "goal" | "medium" | "outbound" | "page" | "platform" | "source", [import("convex/values").VLiteral<"source", "required">, import("convex/values").VLiteral<"campaign", "required">, import("convex/values").VLiteral<"page", "required">, import("convex/values").VLiteral<"country", "required">, import("convex/values").VLiteral<"device", "required">, import("convex/values").VLiteral<"browser", "required">, import("convex/values").VLiteral<"event", "required">, import("convex/values").VLiteral<"goal", "required">, import("convex/values").VLiteral<"medium", "required">, import("convex/values").VLiteral<"outbound", "required">, import("convex/values").VLiteral<"platform", "required">, import("convex/values").VLiteral<"channel", "required">, import("convex/values").VLiteral<"evidence", "required">], "required", never>;
259
275
  slot: import("convex/values").VFloat64<number, "required">;
260
276
  value: import("convex/values").VString<string, "required">;
261
277
  count: import("convex/values").VFloat64<number, "required">;
@@ -285,7 +301,7 @@ export declare const aggregateFieldsValidator: import("convex/values").VObject<{
285
301
  revenueCents: number;
286
302
  sessions?: number | undefined;
287
303
  slot: number;
288
- type: "browser" | "campaign" | "country" | "device" | "event" | "goal" | "medium" | "outbound" | "page" | "source";
304
+ type: "browser" | "campaign" | "channel" | "country" | "device" | "event" | "evidence" | "goal" | "medium" | "outbound" | "page" | "platform" | "source";
289
305
  value: string;
290
306
  }[];
291
307
  durationMs?: number | undefined;
@@ -335,7 +351,7 @@ export declare const aggregateFieldsValidator: import("convex/values").VObject<{
335
351
  revenueCents: number;
336
352
  sessions?: number | undefined;
337
353
  slot: number;
338
- type: "browser" | "campaign" | "country" | "device" | "event" | "goal" | "medium" | "outbound" | "page" | "source";
354
+ type: "browser" | "campaign" | "channel" | "country" | "device" | "event" | "evidence" | "goal" | "medium" | "outbound" | "page" | "platform" | "source";
339
355
  value: string;
340
356
  }[], import("convex/values").VObject<{
341
357
  count: number;
@@ -343,10 +359,10 @@ export declare const aggregateFieldsValidator: import("convex/values").VObject<{
343
359
  revenueCents: number;
344
360
  sessions?: number | undefined;
345
361
  slot: number;
346
- type: "browser" | "campaign" | "country" | "device" | "event" | "goal" | "medium" | "outbound" | "page" | "source";
362
+ type: "browser" | "campaign" | "channel" | "country" | "device" | "event" | "evidence" | "goal" | "medium" | "outbound" | "page" | "platform" | "source";
347
363
  value: string;
348
364
  }, {
349
- type: import("convex/values").VUnion<"browser" | "campaign" | "country" | "device" | "event" | "goal" | "medium" | "outbound" | "page" | "source", [import("convex/values").VLiteral<"source", "required">, import("convex/values").VLiteral<"campaign", "required">, import("convex/values").VLiteral<"page", "required">, import("convex/values").VLiteral<"country", "required">, import("convex/values").VLiteral<"device", "required">, import("convex/values").VLiteral<"browser", "required">, import("convex/values").VLiteral<"event", "required">, import("convex/values").VLiteral<"goal", "required">, import("convex/values").VLiteral<"medium", "required">, import("convex/values").VLiteral<"outbound", "required">], "required", never>;
365
+ type: import("convex/values").VUnion<"browser" | "campaign" | "channel" | "country" | "device" | "event" | "evidence" | "goal" | "medium" | "outbound" | "page" | "platform" | "source", [import("convex/values").VLiteral<"source", "required">, import("convex/values").VLiteral<"campaign", "required">, import("convex/values").VLiteral<"page", "required">, import("convex/values").VLiteral<"country", "required">, import("convex/values").VLiteral<"device", "required">, import("convex/values").VLiteral<"browser", "required">, import("convex/values").VLiteral<"event", "required">, import("convex/values").VLiteral<"goal", "required">, import("convex/values").VLiteral<"medium", "required">, import("convex/values").VLiteral<"outbound", "required">, import("convex/values").VLiteral<"platform", "required">, import("convex/values").VLiteral<"channel", "required">, import("convex/values").VLiteral<"evidence", "required">], "required", never>;
350
366
  slot: import("convex/values").VFloat64<number, "required">;
351
367
  value: import("convex/values").VString<string, "required">;
352
368
  count: import("convex/values").VFloat64<number, "required">;
@@ -443,6 +459,28 @@ export declare const affiliateFieldsValidator: import("convex/values").VObject<{
443
459
  createdAt: import("convex/values").VFloat64<number, "required">;
444
460
  updatedAt: import("convex/values").VFloat64<number, "required">;
445
461
  }, "required", "active" | "attributionWindowDays" | "commissionBps" | "createdAt" | "name" | "siteId" | "slug" | "updatedAt">;
462
+ export declare const trackedLinkChannelValidator: import("convex/values").VUnion<"affiliate" | "display" | "email" | "messaging" | "offline" | "organic_social" | "paid_social" | "referral", [import("convex/values").VLiteral<"organic_social", "required">, import("convex/values").VLiteral<"paid_social", "required">, import("convex/values").VLiteral<"messaging", "required">, import("convex/values").VLiteral<"email", "required">, import("convex/values").VLiteral<"affiliate", "required">, import("convex/values").VLiteral<"display", "required">, import("convex/values").VLiteral<"referral", "required">, import("convex/values").VLiteral<"offline", "required">], "required", never>;
463
+ export declare const trackedLinkFieldsValidator: import("convex/values").VObject<{
464
+ campaign?: string | undefined;
465
+ channel: "affiliate" | "display" | "email" | "messaging" | "offline" | "organic_social" | "paid_social" | "referral";
466
+ createdAt: number;
467
+ createdBy: string;
468
+ destination: string;
469
+ disabledAt?: number | undefined;
470
+ platform: string;
471
+ siteId: import("convex/values").GenericId<"sites">;
472
+ slug: string;
473
+ }, {
474
+ siteId: import("convex/values").VId<import("convex/values").GenericId<"sites">, "required">;
475
+ slug: import("convex/values").VString<string, "required">;
476
+ destination: import("convex/values").VString<string, "required">;
477
+ platform: import("convex/values").VString<string, "required">;
478
+ channel: import("convex/values").VUnion<"affiliate" | "display" | "email" | "messaging" | "offline" | "organic_social" | "paid_social" | "referral", [import("convex/values").VLiteral<"organic_social", "required">, import("convex/values").VLiteral<"paid_social", "required">, import("convex/values").VLiteral<"messaging", "required">, import("convex/values").VLiteral<"email", "required">, import("convex/values").VLiteral<"affiliate", "required">, import("convex/values").VLiteral<"display", "required">, import("convex/values").VLiteral<"referral", "required">, import("convex/values").VLiteral<"offline", "required">], "required", never>;
479
+ campaign: import("convex/values").VString<string | undefined, "optional">;
480
+ createdAt: import("convex/values").VFloat64<number, "required">;
481
+ createdBy: import("convex/values").VString<string, "required">;
482
+ disabledAt: import("convex/values").VFloat64<number | undefined, "optional">;
483
+ }, "required", "campaign" | "channel" | "createdAt" | "createdBy" | "destination" | "disabledAt" | "platform" | "siteId" | "slug">;
446
484
  export declare const ingestResultValidator: import("convex/values").VObject<{
447
485
  accepted: number;
448
486
  duplicates: number;
@@ -480,4 +518,6 @@ export type IngestContext = Infer<typeof ingestContextValidator>;
480
518
  export type EventProperties = Infer<typeof eventPropertiesValidator>;
481
519
  export type FunnelStep = Infer<typeof funnelStepValidator>;
482
520
  export type EventType = Infer<typeof eventTypeValidator>;
521
+ export type Channel = Infer<typeof channelValidator>;
522
+ export type Evidence = Infer<typeof evidenceValidator>;
483
523
  //# sourceMappingURL=validators.d.ts.map