palbase 0.0.0-stage → 0.1.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 (100) hide show
  1. package/LICENSE +27 -0
  2. package/README.md +2 -2
  3. package/dist/ai/index.js +17 -0
  4. package/dist/backend/engine.js +2 -0
  5. package/dist/backend/env.js +1 -0
  6. package/dist/backend/index.js +12 -0
  7. package/dist/backend/stack.js +1 -0
  8. package/dist/backend/test.js +2 -0
  9. package/dist/chunks/3OGEBGYZ.js +20 -0
  10. package/dist/chunks/3VASGTIN.js +2 -0
  11. package/dist/chunks/3XT4L2XV.js +2 -0
  12. package/dist/chunks/45J7YXRB.js +2 -0
  13. package/dist/chunks/6FWCNTAM.js +2 -0
  14. package/dist/chunks/DAOLIUNZ.js +2 -0
  15. package/dist/chunks/E5Q4VTW4.js +2 -0
  16. package/dist/chunks/HKJU2FKE.js +2 -0
  17. package/dist/chunks/IKVOXHEE.js +2 -0
  18. package/dist/chunks/JAWWIVZH.js +2 -0
  19. package/dist/chunks/LYEFPLJZ.js +4 -0
  20. package/dist/chunks/QXUMLO7O.js +13 -0
  21. package/dist/chunks/UAY56IQR.js +6 -0
  22. package/dist/cli.js +815 -0
  23. package/dist/refuse/ai.js +2 -0
  24. package/dist/refuse/backend.js +2 -0
  25. package/dist/refuse/server.js +2 -0
  26. package/dist/server/index.js +2 -0
  27. package/dist/server/testing.js +2 -0
  28. package/dist/web/index.js +2 -0
  29. package/dist/web/palbe.js +2 -0
  30. package/dist/web/vite.js +3 -0
  31. package/package.json +107 -4
  32. package/types/ai/src/ai.d.ts +178 -0
  33. package/types/ai/src/index.d.ts +5 -0
  34. package/types/ai/src/partial.d.ts +1 -0
  35. package/types/ai/src/schema.d.ts +47 -0
  36. package/types/backend/src/bootstrap.d.ts +72 -0
  37. package/types/backend/src/cache.d.ts +32 -0
  38. package/types/backend/src/container.d.ts +49 -0
  39. package/types/backend/src/database.d.ts +148 -0
  40. package/types/backend/src/db-env.d.ts +4 -0
  41. package/types/backend/src/decorators.d.ts +293 -0
  42. package/types/backend/src/engine-db.d.ts +24 -0
  43. package/types/backend/src/engine-exports.d.ts +3 -0
  44. package/types/backend/src/engine.d.ts +124 -0
  45. package/types/backend/src/env.d.ts +27 -0
  46. package/types/backend/src/errors.d.ts +70 -0
  47. package/types/backend/src/i18n.d.ts +21 -0
  48. package/types/backend/src/index.d.ts +23 -0
  49. package/types/backend/src/openapi.d.ts +73 -0
  50. package/types/backend/src/platform-calls.d.ts +41 -0
  51. package/types/backend/src/requests.d.ts +81 -0
  52. package/types/backend/src/rooms.d.ts +168 -0
  53. package/types/backend/src/router.d.ts +22 -0
  54. package/types/backend/src/runtime.d.ts +56 -0
  55. package/types/backend/src/services.d.ts +262 -0
  56. package/types/backend/src/stack.d.ts +20 -0
  57. package/types/backend/src/strings-files.d.ts +3 -0
  58. package/types/backend/src/testing/index.d.ts +3 -0
  59. package/types/backend/src/testing/unit.d.ts +66 -0
  60. package/types/backend/src/upload.d.ts +125 -0
  61. package/types/backend/src/webhooks.d.ts +113 -0
  62. package/types/internal/src/event.d.ts +9 -0
  63. package/types/internal/src/modules/ai.d.ts +678 -0
  64. package/types/internal/src/modules/analytics.d.ts +1414 -0
  65. package/types/internal/src/modules/auth.d.ts +5660 -0
  66. package/types/internal/src/modules/cache.d.ts +158 -0
  67. package/types/internal/src/modules/events.d.ts +19 -0
  68. package/types/internal/src/modules/flags.d.ts +957 -0
  69. package/types/internal/src/modules/index.d.ts +13 -0
  70. package/types/internal/src/modules/machines.d.ts +1584 -0
  71. package/types/internal/src/modules/notify.d.ts +1450 -0
  72. package/types/internal/src/modules/purchases.d.ts +2944 -0
  73. package/types/internal/src/modules/realtime.d.ts +326 -0
  74. package/types/internal/src/modules/secrets.d.ts +275 -0
  75. package/types/internal/src/modules/storage.d.ts +691 -0
  76. package/types/internal/src/modules/stores.d.ts +1516 -0
  77. package/types/internal/src/retry.d.ts +14 -0
  78. package/types/internal/src/transport.d.ts +106 -0
  79. package/types/server/src/auth/dpop.d.ts +47 -0
  80. package/types/server/src/auth/jwt.d.ts +115 -0
  81. package/types/server/src/index.d.ts +9 -0
  82. package/types/server/src/pages.d.ts +4 -0
  83. package/types/server/src/purchases.d.ts +51 -0
  84. package/types/server/src/secrets-env.d.ts +22 -0
  85. package/types/server/src/server.d.ts +40 -0
  86. package/types/server/src/testing.d.ts +91 -0
  87. package/types/server/src/webhooks.d.ts +72 -0
  88. package/types/web/src/analytics.d.ts +87 -0
  89. package/types/web/src/auth.d.ts +155 -0
  90. package/types/web/src/backend-error.d.ts +38 -0
  91. package/types/web/src/backend-names.d.ts +25 -0
  92. package/types/web/src/backends.d.ts +84 -0
  93. package/types/web/src/client.d.ts +51 -0
  94. package/types/web/src/index.d.ts +11 -0
  95. package/types/web/src/palbe.d.ts +2 -0
  96. package/types/web/src/purchases.d.ts +73 -0
  97. package/types/web/src/rooms.d.ts +61 -0
  98. package/types/web/src/session.d.ts +91 -0
  99. package/types/web/src/socket.d.ts +87 -0
  100. package/types/web/src/vite.d.ts +49 -0
@@ -0,0 +1,1414 @@
1
+ import { type Reply, type Transport } from '../transport.js';
2
+ export type AliasRequest = {
3
+ /**
4
+ * One id.
5
+ */
6
+ from: string;
7
+ /**
8
+ * When the device sent it, unix milliseconds on its clock: the difference to the server's is the clock's error, taken off timestamp.
9
+ */
10
+ sent_at?: number;
11
+ /**
12
+ * Unix milliseconds on the device's clock.
13
+ */
14
+ timestamp?: number;
15
+ /**
16
+ * The other: the event is under it.
17
+ */
18
+ to: string;
19
+ };
20
+ export type BatchAnswer = {
21
+ /**
22
+ * Events kept.
23
+ */
24
+ accepted: number;
25
+ /**
26
+ * Events refused.
27
+ */
28
+ rejected: BatchRejection[];
29
+ };
30
+ export type BatchRejection = {
31
+ /**
32
+ * Why: the code.
33
+ */
34
+ error: string;
35
+ /**
36
+ * Why, in words.
37
+ */
38
+ error_description: string;
39
+ /**
40
+ * Its place in the batch.
41
+ */
42
+ index: number;
43
+ };
44
+ export type BatchRequest = {
45
+ /**
46
+ * 1 to 100 events.
47
+ */
48
+ events: CaptureRequest[];
49
+ };
50
+ export type Breakdown = {
51
+ /**
52
+ * What the events are split by, as asked.
53
+ */
54
+ by: string;
55
+ /**
56
+ * Reads the next page; absent on the last.
57
+ */
58
+ next_cursor?: string;
59
+ /**
60
+ * The most frequent value first.
61
+ */
62
+ rows: BreakdownRow[];
63
+ };
64
+ export type BreakdownRow = {
65
+ /**
66
+ * Events with this value.
67
+ */
68
+ events: number;
69
+ /**
70
+ * Distinct ids among them.
71
+ */
72
+ users: number;
73
+ /**
74
+ * The value ("" when absent or empty).
75
+ */
76
+ value: string;
77
+ };
78
+ export type CaptureRequest = {
79
+ /**
80
+ * The app's version.
81
+ */
82
+ app_version?: string;
83
+ /**
84
+ * Who did it (256 characters at most). With a user's token, the user's id instead.
85
+ */
86
+ distinct_id: string;
87
+ /**
88
+ * The event's name: a letter or $, then letters, digits and _.:-$; 64 at most.
89
+ */
90
+ event: string;
91
+ /**
92
+ * Free-form properties: 100 at most, 8 KiB each as JSON.
93
+ */
94
+ properties?: {
95
+ [key: string]: unknown;
96
+ };
97
+ /**
98
+ * When the device sent it, unix milliseconds on its clock: the difference to the server's is the clock's error, taken off timestamp.
99
+ */
100
+ sent_at?: number;
101
+ /**
102
+ * The session it happened in.
103
+ */
104
+ session_id?: string;
105
+ /**
106
+ * Unix milliseconds on the device's clock.
107
+ */
108
+ timestamp?: number;
109
+ };
110
+ export type ConsoleAnswer = {
111
+ /**
112
+ * Records that passed.
113
+ */
114
+ accepted: number;
115
+ /**
116
+ * Always false: nothing samples a history away.
117
+ */
118
+ sampled: boolean;
119
+ /**
120
+ * Records kept.
121
+ */
122
+ stored: number;
123
+ };
124
+ export type ConsoleBatch = {
125
+ /**
126
+ * 500 at most.
127
+ */
128
+ records: ConsoleStoredRecord[];
129
+ /**
130
+ * The launch: app version and build, OS version, device model, SDK version.
131
+ */
132
+ session?: {
133
+ [key: string]: unknown;
134
+ };
135
+ /**
136
+ * The app session the history is from.
137
+ */
138
+ session_id: string;
139
+ /**
140
+ * What made the device send it.
141
+ */
142
+ trigger: "error" | "crash" | "user_report";
143
+ };
144
+ export type ConsoleConfig = {
145
+ /**
146
+ * Bodies are kept now.
147
+ */
148
+ bodies_enabled: boolean;
149
+ /**
150
+ * enabled or disabled: the project's setting; unavailable: it could not be read, and bodies are not kept.
151
+ */
152
+ bodies_reason: "enabled" | "disabled" | "unavailable";
153
+ /**
154
+ * An upload's limit.
155
+ */
156
+ max_batch_bytes: number;
157
+ /**
158
+ * A record's limit.
159
+ */
160
+ max_record_bytes: number;
161
+ };
162
+ export type ConsolePage = {
163
+ /**
164
+ * Reads the next page; absent on the last.
165
+ */
166
+ next_cursor?: string;
167
+ /**
168
+ * Newest first.
169
+ */
170
+ records: ConsoleRecord[];
171
+ /**
172
+ * How long records are kept.
173
+ */
174
+ retention_days: number;
175
+ };
176
+ export type ConsoleRecord = {
177
+ /**
178
+ * Whose.
179
+ */
180
+ distinct_id: string;
181
+ /**
182
+ * The record as the SDK wrote it (JSON).
183
+ */
184
+ record: string;
185
+ /**
186
+ * The record.
187
+ */
188
+ record_id: string;
189
+ /**
190
+ * Its schema's version.
191
+ */
192
+ schema_version: number;
193
+ /**
194
+ * The session.
195
+ */
196
+ session_id: string;
197
+ /**
198
+ * When, on the device's clock.
199
+ */
200
+ timestamp: string;
201
+ };
202
+ /**
203
+ * One record, in the SDK's own versioned shape (schemaVersion 1): a log message (message) or a network exchange (network), each with its id and createdAt. The rest is kept as sent.
204
+ */
205
+ export type ConsoleStoredRecord = {
206
+ [key: string]: unknown;
207
+ };
208
+ export type ErrorResponse = {
209
+ /**
210
+ * Machine-readable error code (snake_case)
211
+ */
212
+ error: string;
213
+ /**
214
+ * Human-readable explanation
215
+ */
216
+ error_description: string;
217
+ /**
218
+ * Correlation ID
219
+ */
220
+ request_id: string;
221
+ /**
222
+ * Seconds to wait before retrying, when the refusal ends with time.
223
+ */
224
+ retry_after?: number;
225
+ /**
226
+ * HTTP status code
227
+ */
228
+ status: number;
229
+ };
230
+ export type Event = {
231
+ /**
232
+ * Whose.
233
+ */
234
+ distinct_id: string;
235
+ /**
236
+ * The event.
237
+ */
238
+ event_id: string;
239
+ /**
240
+ * Its name.
241
+ */
242
+ name: string;
243
+ /**
244
+ * Its properties.
245
+ */
246
+ properties: {
247
+ [key: string]: unknown;
248
+ };
249
+ /**
250
+ * The session.
251
+ */
252
+ session_id: string;
253
+ /**
254
+ * When it happened (corrected for the device's clock).
255
+ */
256
+ timestamp: string;
257
+ };
258
+ export type EventBucket = {
259
+ /**
260
+ * The bucket's start, unix milliseconds, UTC.
261
+ */
262
+ bucket_ms: number;
263
+ /**
264
+ * Events.
265
+ */
266
+ events: number;
267
+ /**
268
+ * Distinct ids.
269
+ */
270
+ users: number;
271
+ };
272
+ export type EventNames = {
273
+ /**
274
+ * In order.
275
+ */
276
+ names: string[];
277
+ };
278
+ export type EventPage = {
279
+ /**
280
+ * Newest first.
281
+ */
282
+ events: Event[];
283
+ /**
284
+ * Reads the next page; absent on the last.
285
+ */
286
+ next_cursor?: string;
287
+ };
288
+ export type EventTimeline = {
289
+ /**
290
+ * What a row spans: hour or day.
291
+ */
292
+ bucket: "hour" | "day";
293
+ /**
294
+ * Bucket by bucket, oldest first.
295
+ */
296
+ rows: EventBucket[];
297
+ };
298
+ export type FunnelAnswer = {
299
+ /**
300
+ * The steps.
301
+ */
302
+ steps: FunnelStep[];
303
+ };
304
+ export type FunnelRequest = {
305
+ /**
306
+ * How long after the first step the last may be (an hour unless said).
307
+ */
308
+ conversion_window_seconds?: number;
309
+ /**
310
+ * 2 to 10 event names, in order.
311
+ */
312
+ steps: string[];
313
+ /**
314
+ * Any other funnel event between steps breaks the chain.
315
+ */
316
+ strict_order?: boolean;
317
+ /**
318
+ * How far back (an hour unless said).
319
+ */
320
+ window_seconds?: number;
321
+ };
322
+ export type FunnelStep = {
323
+ /**
324
+ * Their share of the first step's.
325
+ */
326
+ conversion_rate: number;
327
+ /**
328
+ * The event.
329
+ */
330
+ name: string;
331
+ /**
332
+ * Its place, from 1.
333
+ */
334
+ step: number;
335
+ /**
336
+ * People who reached it.
337
+ */
338
+ users: number;
339
+ };
340
+ export type IdentifyRequest = {
341
+ /**
342
+ * The anonymous id they had.
343
+ */
344
+ anonymous_id?: string;
345
+ /**
346
+ * The user's id.
347
+ */
348
+ distinct_id: string;
349
+ /**
350
+ * When the device sent it, unix milliseconds on its clock: the difference to the server's is the clock's error, taken off timestamp.
351
+ */
352
+ sent_at?: number;
353
+ /**
354
+ * Unix milliseconds on the device's clock.
355
+ */
356
+ timestamp?: number;
357
+ /**
358
+ * Free-form properties: 100 at most, 8 KiB each as JSON.
359
+ */
360
+ traits?: {
361
+ [key: string]: unknown;
362
+ };
363
+ };
364
+ export type MachineTraffic = {
365
+ /**
366
+ * What a row spans: hour or day.
367
+ */
368
+ bucket: "hour" | "day";
369
+ /**
370
+ * Bucket by bucket, oldest first.
371
+ */
372
+ rows: TraceHour[];
373
+ };
374
+ export type NameCount = {
375
+ /**
376
+ * How often.
377
+ */
378
+ count: number;
379
+ /**
380
+ * The name.
381
+ */
382
+ name: string;
383
+ };
384
+ export type PageRequest = {
385
+ /**
386
+ * Who saw it.
387
+ */
388
+ distinct_id: string;
389
+ /**
390
+ * Free-form properties: 100 at most, 8 KiB each as JSON.
391
+ */
392
+ properties?: {
393
+ [key: string]: unknown;
394
+ };
395
+ /**
396
+ * Where from.
397
+ */
398
+ referrer?: string;
399
+ /**
400
+ * When the device sent it, unix milliseconds on its clock: the difference to the server's is the clock's error, taken off timestamp.
401
+ */
402
+ sent_at?: number;
403
+ /**
404
+ * The session.
405
+ */
406
+ session_id?: string;
407
+ /**
408
+ * Unix milliseconds on the device's clock.
409
+ */
410
+ timestamp?: number;
411
+ /**
412
+ * Its title.
413
+ */
414
+ title?: string;
415
+ /**
416
+ * The page.
417
+ */
418
+ url: string;
419
+ };
420
+ export type PerfAnswer = {
421
+ /**
422
+ * Samples kept.
423
+ */
424
+ accepted: number;
425
+ /**
426
+ * Samples dropped.
427
+ */
428
+ dropped: number;
429
+ };
430
+ export type PerfBucket = {
431
+ /**
432
+ * The bucket's start, unix milliseconds, UTC.
433
+ */
434
+ bucket_ms: number;
435
+ /**
436
+ * Median.
437
+ */
438
+ p50: number;
439
+ /**
440
+ * 75th percentile.
441
+ */
442
+ p75: number;
443
+ /**
444
+ * 95th percentile.
445
+ */
446
+ p95: number;
447
+ /**
448
+ * Samples.
449
+ */
450
+ sample_count: number;
451
+ };
452
+ export type PerfConfig = {
453
+ /**
454
+ * Samples the SDK batches.
455
+ */
456
+ flush_at: number;
457
+ /**
458
+ * How often the SDK sends at least.
459
+ */
460
+ flush_interval_ms: number;
461
+ /**
462
+ * The share kept, 0 to 100.
463
+ */
464
+ sample_pct: number;
465
+ };
466
+ export type PerfGroup = {
467
+ /**
468
+ * The dimension's value (the name, when grouped by name).
469
+ */
470
+ key: string;
471
+ /**
472
+ * The measure.
473
+ */
474
+ name: string;
475
+ /**
476
+ * Median.
477
+ */
478
+ p50: number;
479
+ /**
480
+ * 75th percentile.
481
+ */
482
+ p75: number;
483
+ /**
484
+ * 95th percentile.
485
+ */
486
+ p95: number;
487
+ /**
488
+ * 99th percentile.
489
+ */
490
+ p99: number;
491
+ /**
492
+ * Samples.
493
+ */
494
+ sample_count: number;
495
+ /**
496
+ * The type.
497
+ */
498
+ trace_type: string;
499
+ };
500
+ export type PerfItem = {
501
+ /**
502
+ * Not read.
503
+ */
504
+ app_id?: string;
505
+ /**
506
+ * 5 at most.
507
+ */
508
+ attrs?: {
509
+ [key: string]: string;
510
+ };
511
+ /**
512
+ * 32 at most.
513
+ */
514
+ counters?: {
515
+ [key: string]: number;
516
+ };
517
+ /**
518
+ * Not read: who measured is the caller.
519
+ */
520
+ distinct_id?: string;
521
+ /**
522
+ * The measure: a network sample's "<METHOD> <url>" (kept as its route: the query dropped, ids as :id).
523
+ */
524
+ name: string;
525
+ /**
526
+ * The request a network sample measured.
527
+ */
528
+ request_id?: string;
529
+ /**
530
+ * The sample's id: it decides its sampling.
531
+ */
532
+ row_id: string;
533
+ /**
534
+ * Unix milliseconds.
535
+ */
536
+ timestamp: number;
537
+ /**
538
+ * What was measured: network, app_start, custom, screen or web_vital (another is dropped).
539
+ */
540
+ trace_type: string;
541
+ /**
542
+ * The measurement.
543
+ */
544
+ value: number;
545
+ };
546
+ export type PerfPage = {
547
+ /**
548
+ * The dimension.
549
+ */
550
+ group_by: string;
551
+ /**
552
+ * Reads the next page; absent on the last.
553
+ */
554
+ next_cursor?: string;
555
+ /**
556
+ * The most sampled first.
557
+ */
558
+ rows: PerfGroup[];
559
+ };
560
+ export type PerfRequest = {
561
+ /**
562
+ * 100 at most; more are dropped.
563
+ */
564
+ items: PerfItem[];
565
+ };
566
+ export type PerfTimeline = {
567
+ /**
568
+ * What a row spans: hour or day.
569
+ */
570
+ bucket: "hour" | "day";
571
+ /**
572
+ * Bucket by bucket, oldest first.
573
+ */
574
+ rows: PerfBucket[];
575
+ };
576
+ export type RequestLine = {
577
+ /**
578
+ * The address it came from.
579
+ */
580
+ client_ip: string;
581
+ /**
582
+ * How long it took.
583
+ */
584
+ duration_ms: number;
585
+ /**
586
+ * How it ended when it did not reach a module's answer (Envoy's response flags: UAEX the check refused it, NR no module answers its path, UF the module could not be reached, UT it did not answer in time, DC the client went away).
587
+ */
588
+ flags?: string;
589
+ /**
590
+ * Its HTTP method.
591
+ */
592
+ method: string;
593
+ /**
594
+ * The module it went to; other for a path none answers.
595
+ */
596
+ module: string;
597
+ /**
598
+ * Its path, without its query.
599
+ */
600
+ path: string;
601
+ /**
602
+ * The id the edge gave the request.
603
+ */
604
+ request_id: string;
605
+ /**
606
+ * The status it was answered; 0 for none.
607
+ */
608
+ status: number;
609
+ /**
610
+ * When it arrived.
611
+ */
612
+ ts: string;
613
+ /**
614
+ * The client's user agent.
615
+ */
616
+ user_agent: string;
617
+ };
618
+ export type RequestLinePage = {
619
+ /**
620
+ * Reads the next page; absent on the last.
621
+ */
622
+ next_cursor?: string;
623
+ /**
624
+ * The request lines.
625
+ */
626
+ requests: RequestLine[];
627
+ };
628
+ export type RetentionAnswer = {
629
+ /**
630
+ * The period.
631
+ */
632
+ period: string;
633
+ /**
634
+ * Periods read: as many as the window holds.
635
+ */
636
+ periods: number;
637
+ /**
638
+ * Newest first.
639
+ */
640
+ rows: RetentionRow[];
641
+ };
642
+ export type RetentionRequest = {
643
+ /**
644
+ * The event that puts a person in a cohort.
645
+ */
646
+ first_event: string;
647
+ /**
648
+ * A cohort's period (week unless said).
649
+ */
650
+ period?: "day" | "week" | "month";
651
+ /**
652
+ * Periods after the cohort (8 unless said; 31 at most).
653
+ */
654
+ periods?: number;
655
+ /**
656
+ * The event that counts as returning.
657
+ */
658
+ return_event: string;
659
+ /**
660
+ * How far back (30 days unless said).
661
+ */
662
+ window_seconds?: number;
663
+ };
664
+ export type RetentionRow = {
665
+ /**
666
+ * People in it.
667
+ */
668
+ cohort_size: number;
669
+ /**
670
+ * The cohort's period.
671
+ */
672
+ cohort_start: string;
673
+ /**
674
+ * How many of the periods after have fully passed.
675
+ */
676
+ observable: number;
677
+ /**
678
+ * returns[0] is the cohort's size, returns[k] the people back k periods later.
679
+ */
680
+ returns: number[];
681
+ };
682
+ export type ScreenRequest = {
683
+ /**
684
+ * Who saw it.
685
+ */
686
+ distinct_id: string;
687
+ /**
688
+ * Free-form properties: 100 at most, 8 KiB each as JSON.
689
+ */
690
+ properties?: {
691
+ [key: string]: unknown;
692
+ };
693
+ /**
694
+ * The screen.
695
+ */
696
+ screen_name: string;
697
+ /**
698
+ * When the device sent it, unix milliseconds on its clock: the difference to the server's is the clock's error, taken off timestamp.
699
+ */
700
+ sent_at?: number;
701
+ /**
702
+ * The session.
703
+ */
704
+ session_id?: string;
705
+ /**
706
+ * Unix milliseconds on the device's clock.
707
+ */
708
+ timestamp?: number;
709
+ };
710
+ export type Settings = {
711
+ /**
712
+ * Console records keep request and response bodies.
713
+ */
714
+ console_bodies: boolean;
715
+ /**
716
+ * How long console records are kept, in days.
717
+ */
718
+ console_retention_days: number;
719
+ /**
720
+ * The share of performance samples kept.
721
+ */
722
+ perf_sample_pct: number;
723
+ /**
724
+ * How long events, samples and traces are kept, in days.
725
+ */
726
+ retention_days: number;
727
+ };
728
+ export type Summary = {
729
+ /**
730
+ * The 50 most frequent names.
731
+ */
732
+ events: NameCount[];
733
+ /**
734
+ * Events.
735
+ */
736
+ total: number;
737
+ /**
738
+ * Distinct ids.
739
+ */
740
+ unique_users: number;
741
+ /**
742
+ * The window read, after the retention bound it.
743
+ */
744
+ window_seconds: number;
745
+ };
746
+ export type Trace = {
747
+ /**
748
+ * Whose.
749
+ */
750
+ distinct_id: string;
751
+ /**
752
+ * How long.
753
+ */
754
+ duration_ms: number;
755
+ /**
756
+ * The path.
757
+ */
758
+ endpoint: string;
759
+ /**
760
+ * The error's code.
761
+ */
762
+ error_code: string;
763
+ /**
764
+ * The error.
765
+ */
766
+ error_message: string;
767
+ /**
768
+ * The method.
769
+ */
770
+ method: string;
771
+ /**
772
+ * The request.
773
+ */
774
+ request_id: string;
775
+ /**
776
+ * The session.
777
+ */
778
+ session_id: string;
779
+ /**
780
+ * client or backend.
781
+ */
782
+ source: string;
783
+ /**
784
+ * The status.
785
+ */
786
+ status: number;
787
+ /**
788
+ * When.
789
+ */
790
+ timestamp: string;
791
+ /**
792
+ * Its trace.
793
+ */
794
+ trace_id: string;
795
+ };
796
+ export type TraceBatchRequest = {
797
+ /**
798
+ * 1 to 100 traces.
799
+ */
800
+ traces: TraceRequest[];
801
+ };
802
+ export type TraceHour = {
803
+ /**
804
+ * 2xx.
805
+ */
806
+ count_2xx: number;
807
+ /**
808
+ * 3xx.
809
+ */
810
+ count_3xx: number;
811
+ /**
812
+ * 4xx.
813
+ */
814
+ count_4xx: number;
815
+ /**
816
+ * 5xx.
817
+ */
818
+ count_5xx: number;
819
+ /**
820
+ * 4xx and 5xx.
821
+ */
822
+ error_count: number;
823
+ /**
824
+ * The bucket's start (an hour, or a day), unix milliseconds, UTC.
825
+ */
826
+ hour_ms: number;
827
+ /**
828
+ * Median duration.
829
+ */
830
+ p50_duration_ms: number;
831
+ /**
832
+ * 95th percentile.
833
+ */
834
+ p95_duration_ms: number;
835
+ /**
836
+ * Requests.
837
+ */
838
+ requests: number;
839
+ };
840
+ export type TraceList = {
841
+ /**
842
+ * In order.
843
+ */
844
+ traces: Trace[];
845
+ };
846
+ export type TracePage = {
847
+ /**
848
+ * Reads the next page; absent on the last.
849
+ */
850
+ next_cursor?: string;
851
+ /**
852
+ * The requests.
853
+ */
854
+ traces: Trace[];
855
+ };
856
+ export type TraceRequest = {
857
+ /**
858
+ * What the client says of itself (4 KiB at most).
859
+ */
860
+ client_meta?: {
861
+ [key: string]: unknown;
862
+ };
863
+ /**
864
+ * Whose (the signed-in user's when absent).
865
+ */
866
+ distinct_id?: string;
867
+ /**
868
+ * How long it took.
869
+ */
870
+ duration_ms?: number;
871
+ /**
872
+ * The path (512 at most).
873
+ */
874
+ endpoint: string;
875
+ /**
876
+ * The error's code.
877
+ */
878
+ error_code?: string;
879
+ /**
880
+ * The error (4 KiB at most).
881
+ */
882
+ error_message?: string;
883
+ /**
884
+ * The HTTP method.
885
+ */
886
+ method?: string;
887
+ /**
888
+ * The request's id: letters, digits, _ and -; 64 at most.
889
+ */
890
+ request_id: string;
891
+ /**
892
+ * When the device sent it, unix milliseconds on its clock: the difference to the server's is the clock's error, taken off timestamp.
893
+ */
894
+ sent_at?: number;
895
+ /**
896
+ * The session.
897
+ */
898
+ session_id?: string;
899
+ /**
900
+ * Who saw it.
901
+ */
902
+ source: "client" | "backend";
903
+ /**
904
+ * The status (0, or 100 to 599).
905
+ */
906
+ status?: number;
907
+ /**
908
+ * Unix milliseconds on the device's clock.
909
+ */
910
+ timestamp?: number;
911
+ /**
912
+ * The trace it is part of.
913
+ */
914
+ trace_id?: string;
915
+ };
916
+ export type TraceSummary = {
917
+ /**
918
+ * 4xx.
919
+ */
920
+ client_error_count: number;
921
+ /**
922
+ * 2xx.
923
+ */
924
+ count_2xx: number;
925
+ /**
926
+ * 3xx.
927
+ */
928
+ count_3xx: number;
929
+ /**
930
+ * 4xx.
931
+ */
932
+ count_4xx: number;
933
+ /**
934
+ * 5xx.
935
+ */
936
+ count_5xx: number;
937
+ /**
938
+ * 4xx and 5xx.
939
+ */
940
+ error_count: number;
941
+ /**
942
+ * Errors' share.
943
+ */
944
+ error_rate: number;
945
+ /**
946
+ * Median duration.
947
+ */
948
+ p50_duration_ms: number;
949
+ /**
950
+ * 95th percentile.
951
+ */
952
+ p95_duration_ms: number;
953
+ /**
954
+ * 99th percentile.
955
+ */
956
+ p99_duration_ms: number;
957
+ /**
958
+ * 5xx.
959
+ */
960
+ server_error_count: number;
961
+ /**
962
+ * Requests.
963
+ */
964
+ total: number;
965
+ };
966
+ export type TraceTimeline = {
967
+ /**
968
+ * What a row spans: hour or day.
969
+ */
970
+ bucket: "hour" | "day";
971
+ /**
972
+ * Bucket by bucket, oldest first.
973
+ */
974
+ rows: TraceHour[];
975
+ };
976
+ /** Palbase Analytics */
977
+ export declare function client(t: Transport): {
978
+ /**
979
+ * Join two ids
980
+ *
981
+ * An $alias event: from and to are one user. The request is answered once what it sends is kept — on the platform's stream, written to the store within seconds, even while the store is restarting. A signed-in user's token (with the publishable key) makes it theirs: their user id is the distinct id, whatever the body says.
982
+ */
983
+ alias(input: {
984
+ headers?: {
985
+ "Idempotency-Key"?: string; /** The app's version: kept with what it sends. */
986
+ "X-Palbase-Client-Version"?: string; /** The app's platform (ios, android, web). */
987
+ "X-Platform"?: string; /** The operating system's version. */
988
+ "X-OS-Version"?: string;
989
+ };
990
+ body: AliasRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
991
+ signal?: AbortSignal;
992
+ }): Promise<Reply<202, undefined>>;
993
+ /**
994
+ * Send events in a batch
995
+ *
996
+ * Up to 100 events (3 MiB). Each is kept or refused on its own: 202 when all were kept, 207 naming the refused by their place, and the first refusal's own answer when none was. The request is answered once what it sends is kept — on the platform's stream, written to the store within seconds, even while the store is restarting. A signed-in user's token (with the publishable key) makes it theirs: their user id is the distinct id, whatever the body says.
997
+ */
998
+ batch(input: {
999
+ headers?: {
1000
+ "Idempotency-Key"?: string; /** The app's version: kept with what it sends. */
1001
+ "X-Palbase-Client-Version"?: string; /** The app's platform (ios, android, web). */
1002
+ "X-Platform"?: string; /** The operating system's version. */
1003
+ "X-OS-Version"?: string;
1004
+ };
1005
+ body: BatchRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1006
+ signal?: AbortSignal;
1007
+ }): Promise<Reply<202, BatchAnswer> | Reply<207, BatchAnswer>>;
1008
+ /**
1009
+ * Break the events down
1010
+ *
1011
+ * The window's events split by one dimension — the platform, the app version, the OS version, the country, the event's name, or one of its properties — the most frequent value first: how many events had each value, by how many distinct ids. An absent or empty value is ""; a property that is not a string is its JSON (a number, true, an array).
1012
+ */
1013
+ getEventBreakdown(input: {
1014
+ query: {
1015
+ window_seconds?: number; /** What to split by: platform, app_version, os_version, country, event (the event's name), or property:<key> — a key of the events' properties (letters, digits and _ . $ -, 64 at most). */
1016
+ by: string; /** Only this event (every event unless said). */
1017
+ event?: string; /** Values per page (10 unless said). */
1018
+ limit?: number; /** The next_cursor of the page before: reads the page after it. */
1019
+ cursor?: string;
1020
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1021
+ signal?: AbortSignal;
1022
+ }): Promise<Reply<200, Breakdown>>;
1023
+ /**
1024
+ * Send an event
1025
+ *
1026
+ * One event: a name, who did it (distinct_id), its properties (100 at most, 8 KiB each, 32 KiB in all), when on the device's clock (corrected by sent_at). The request is answered once what it sends is kept — on the platform's stream, written to the store within seconds, even while the store is restarting. A signed-in user's token (with the publishable key) makes it theirs: their user id is the distinct id, whatever the body says.
1027
+ */
1028
+ capture(input: {
1029
+ headers?: {
1030
+ "Idempotency-Key"?: string; /** The app's version: kept with what it sends. */
1031
+ "X-Palbase-Client-Version"?: string; /** The app's platform (ios, android, web). */
1032
+ "X-Platform"?: string; /** The operating system's version. */
1033
+ "X-OS-Version"?: string;
1034
+ };
1035
+ body: CaptureRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1036
+ signal?: AbortSignal;
1037
+ }): Promise<Reply<202, undefined>>;
1038
+ /**
1039
+ * Upload console history
1040
+ *
1041
+ * An app's console history — its log messages and network exchanges — sent when something went wrong (an error, a crash, a user's report): 500 records at most, 64 KiB each, 2 MiB in all, kept whole or not at all. Request and response bodies are kept only if the project said so; otherwise they are removed before anything is kept, and each record says so. The request is answered once what it sends is kept — on the platform's stream, written to the store within seconds, even while the store is restarting. A signed-in user's token (with the publishable key) makes it theirs: their user id is the distinct id, whatever the body says.
1042
+ */
1043
+ sendConsoleHistory(input: {
1044
+ headers?: {
1045
+ "Idempotency-Key"?: string; /** The app's version: kept with what it sends. */
1046
+ "X-Palbase-Client-Version"?: string; /** The app's platform (ios, android, web). */
1047
+ "X-Platform"?: string; /** The operating system's version. */
1048
+ "X-OS-Version"?: string;
1049
+ };
1050
+ body: ConsoleBatch; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1051
+ signal?: AbortSignal;
1052
+ }): Promise<Reply<202, ConsoleAnswer>>;
1053
+ /**
1054
+ * Read what console uploads keep
1055
+ *
1056
+ * Whether bodies are kept now — and why: the project's setting, or a setting that could not be read (then they are not) — and the upload limits.
1057
+ */
1058
+ getConsoleConfig(input?: {
1059
+ signal?: AbortSignal;
1060
+ }): Promise<Reply<200, ConsoleConfig>>;
1061
+ /**
1062
+ * List console records
1063
+ *
1064
+ * A page of the window's console records, newest first, each as the SDK wrote it (its bodies removed if the project keeps none), and how long records are kept.
1065
+ */
1066
+ listConsoleRecords(input?: {
1067
+ query?: {
1068
+ window_seconds?: number; /** Only this distinct id's. */
1069
+ user?: string; /** Only this session's. */
1070
+ session?: string; /** Rows per page (100 unless said). */
1071
+ limit?: number; /** The next_cursor of the page before: reads the page after it. */
1072
+ cursor?: string;
1073
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1074
+ signal?: AbortSignal;
1075
+ }): Promise<Reply<200, ConsolePage>>;
1076
+ /**
1077
+ * List event names
1078
+ *
1079
+ * Every name the window's events had (1000 at most), in order.
1080
+ */
1081
+ listEventNames(input?: {
1082
+ query?: {
1083
+ window_seconds?: number;
1084
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1085
+ signal?: AbortSignal;
1086
+ }): Promise<Reply<200, EventNames>>;
1087
+ /**
1088
+ * List events
1089
+ *
1090
+ * A page of the window's events, newest first.
1091
+ */
1092
+ listEvents(input?: {
1093
+ query?: {
1094
+ window_seconds?: number; /** Only events of this name. */
1095
+ name?: string; /** Only this distinct id's. */
1096
+ distinct_id?: string; /** Only this session's. */
1097
+ session_id?: string; /** Rows per page (100 unless said). */
1098
+ limit?: number; /** The next_cursor of the page before: reads the page after it. */
1099
+ cursor?: string;
1100
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1101
+ signal?: AbortSignal;
1102
+ }): Promise<Reply<200, EventPage>>;
1103
+ /**
1104
+ * Read events over time
1105
+ *
1106
+ * The window's events bucket by bucket, oldest first: how many, and by how many distinct ids. A bucket with no event is not a row; its start is unix milliseconds, UTC.
1107
+ */
1108
+ getEventTimeline(input?: {
1109
+ query?: {
1110
+ window_seconds?: number; /** hour or day: what a row spans (hours for a window of two days or less, days beyond, unless said). */
1111
+ bucket?: "hour" | "day"; /** Only this event. */
1112
+ name?: string;
1113
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1114
+ signal?: AbortSignal;
1115
+ }): Promise<Reply<200, EventTimeline>>;
1116
+ /**
1117
+ * Run a funnel
1118
+ *
1119
+ * How many people took each step — event names, in order — each within the conversion window of their first; in strict order, any other event between breaks the chain. A step's conversion rate is its share of the first step's.
1120
+ */
1121
+ runFunnel(input: {
1122
+ body: FunnelRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1123
+ signal?: AbortSignal;
1124
+ }): Promise<Reply<200, FunnelAnswer>>;
1125
+ /**
1126
+ * Say who the user is
1127
+ *
1128
+ * An $identify event: the user's id, their traits, and the anonymous id they had — their anonymous history goes with them if they are deleted. The request is answered once what it sends is kept — on the platform's stream, written to the store within seconds, even while the store is restarting. A signed-in user's token (with the publishable key) makes it theirs: their user id is the distinct id, whatever the body says.
1129
+ */
1130
+ identify(input: {
1131
+ headers?: {
1132
+ "Idempotency-Key"?: string; /** The app's version: kept with what it sends. */
1133
+ "X-Palbase-Client-Version"?: string; /** The app's platform (ios, android, web). */
1134
+ "X-Platform"?: string; /** The operating system's version. */
1135
+ "X-OS-Version"?: string;
1136
+ };
1137
+ body: IdentifyRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1138
+ signal?: AbortSignal;
1139
+ }): Promise<Reply<202, undefined>>;
1140
+ /**
1141
+ * Send a page view
1142
+ *
1143
+ * A $pageview event; url, title and referrer are kept among its properties. The request is answered once what it sends is kept — on the platform's stream, written to the store within seconds, even while the store is restarting. A signed-in user's token (with the publishable key) makes it theirs: their user id is the distinct id, whatever the body says.
1144
+ */
1145
+ page(input: {
1146
+ headers?: {
1147
+ "Idempotency-Key"?: string; /** The app's version: kept with what it sends. */
1148
+ "X-Palbase-Client-Version"?: string; /** The app's platform (ios, android, web). */
1149
+ "X-Platform"?: string; /** The operating system's version. */
1150
+ "X-OS-Version"?: string;
1151
+ };
1152
+ body: PageRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1153
+ signal?: AbortSignal;
1154
+ }): Promise<Reply<202, undefined>>;
1155
+ /**
1156
+ * Send performance samples
1157
+ *
1158
+ * Up to 100 samples (512 KiB): app starts, screens, network calls, web vitals, custom measures. Each is kept or dropped on its own — a bad shape, a time more than 7 days off, or not sampled in at the project's rate — and the answer counts both: dropping is the server's call, not an error. The request is answered once what it sends is kept — on the platform's stream, written to the store within seconds, even while the store is restarting. A signed-in user's token (with the publishable key) makes it theirs: their user id is the distinct id, whatever the body says.
1159
+ */
1160
+ sendPerf(input: {
1161
+ headers?: {
1162
+ "Idempotency-Key"?: string; /** The app's version: kept with what it sends. */
1163
+ "X-Palbase-Client-Version"?: string; /** The app's platform (ios, android, web). */
1164
+ "X-Platform"?: string; /** The operating system's version. */
1165
+ "X-OS-Version"?: string;
1166
+ };
1167
+ body: PerfRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1168
+ signal?: AbortSignal;
1169
+ }): Promise<Reply<202, PerfAnswer>>;
1170
+ /**
1171
+ * Read performance percentiles
1172
+ *
1173
+ * The window's samples, grouped by their type and name and by one more dimension (the name alone, the app version, the platform, the OS version): p50, p75, p95, p99 and how many samples, the most sampled first.
1174
+ */
1175
+ listPerfGroups(input?: {
1176
+ query?: {
1177
+ window_seconds?: number; /** Only this type. */
1178
+ trace_type?: "network" | "app_start" | "custom" | "screen" | "web_vital"; /** Only this measure. */
1179
+ name?: string; /** The dimension (name unless said). */
1180
+ group_by?: "name" | "app_version" | "platform" | "os_version"; /** Rows per page (100 unless said). */
1181
+ limit?: number; /** The next_cursor of the page before: reads the page after it. */
1182
+ cursor?: string;
1183
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1184
+ signal?: AbortSignal;
1185
+ }): Promise<Reply<200, PerfPage>>;
1186
+ /**
1187
+ * Read the sampling
1188
+ *
1189
+ * The share of samples the project keeps, for the SDK to sample at before it sends (the server samples again), and how the SDK batches them. An unchanged configuration is 304 against If-None-Match.
1190
+ */
1191
+ getPerfConfig(input?: {
1192
+ headers?: {
1193
+ "If-None-Match"?: string;
1194
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1195
+ signal?: AbortSignal;
1196
+ }): Promise<Reply<200, PerfConfig> | Reply<304, undefined>>;
1197
+ /**
1198
+ * Read performance percentiles over time
1199
+ *
1200
+ * One type's samples bucket by bucket, oldest first: p50, p75, p95 and how many samples. A bucket with no sample is not a row; its start is unix milliseconds, UTC.
1201
+ */
1202
+ getPerfTimeline(input: {
1203
+ query: {
1204
+ window_seconds?: number; /** hour or day: what a row spans (hours for a window of two days or less, days beyond, unless said). */
1205
+ bucket?: "hour" | "day"; /** The type: a percentile is of one type's samples (an app start's milliseconds and a CLS's score are never one). */
1206
+ trace_type: "network" | "app_start" | "custom" | "screen" | "web_vital"; /** Only this measure. */
1207
+ name?: string;
1208
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1209
+ signal?: AbortSignal;
1210
+ }): Promise<Reply<200, PerfTimeline>>;
1211
+ /**
1212
+ * List request lines
1213
+ *
1214
+ * A page of the project's requests as the edge saw them — every module's, newest first: what Studio's Logs show. A line keeps its path without its query, its status and duration, and the client's address and user agent; lines are kept a week.
1215
+ */
1216
+ listRequestLines(input?: {
1217
+ query?: {
1218
+ window_seconds?: number; /** Only this module's requests. */
1219
+ module?: "auth" | "storage" | "realtime" | "flags" | "notify" | "analytics" | "secrets" | "machines" | "stores" | "ai" | "other"; /** Only these levels, comma-separated: info (answered below 400), warn (4xx), error (5xx, or no answer). */
1220
+ level?: string; /** Only lines whose path or user agent holds this, or whose request id or client address is this. */
1221
+ q?: string; /** Rows per page (100 unless said). */
1222
+ limit?: number; /** The next_cursor of the page before: reads the page after it. */
1223
+ cursor?: string;
1224
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1225
+ signal?: AbortSignal;
1226
+ }): Promise<Reply<200, RequestLinePage>>;
1227
+ /**
1228
+ * Read a machine's requests over time
1229
+ *
1230
+ * The requests the edge took to one of the project's machines, bucket by bucket, oldest first — every request to the machine's address, whatever program answers it: by status class, with their median and p95 duration, as the machine's page shows them. A bucket with no request is not a row. Kept 30 days; nothing of who sent a request or what it asked is kept.
1231
+ */
1232
+ getMachineTraffic(input: {
1233
+ path: {
1234
+ name: string;
1235
+ };
1236
+ query?: {
1237
+ window_seconds?: number; /** hour or day: what a row spans (hours up to two days, days beyond, unless said). */
1238
+ bucket?: "hour" | "day";
1239
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1240
+ signal?: AbortSignal;
1241
+ }): Promise<Reply<200, MachineTraffic>>;
1242
+ /**
1243
+ * Run a retention table
1244
+ *
1245
+ * The people whose first first_event fell in each period (day, week, month), and how many of them did return_event in each period after — as many periods as the window holds, 31 at most. A period that has not fully passed is not counted as observable.
1246
+ */
1247
+ runRetention(input: {
1248
+ body: RetentionRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1249
+ signal?: AbortSignal;
1250
+ }): Promise<Reply<200, RetentionAnswer>>;
1251
+ /**
1252
+ * Send a screen view
1253
+ *
1254
+ * A $screen event; screen_name is kept among its properties. The request is answered once what it sends is kept — on the platform's stream, written to the store within seconds, even while the store is restarting. A signed-in user's token (with the publishable key) makes it theirs: their user id is the distinct id, whatever the body says.
1255
+ */
1256
+ screen(input: {
1257
+ headers?: {
1258
+ "Idempotency-Key"?: string; /** The app's version: kept with what it sends. */
1259
+ "X-Palbase-Client-Version"?: string; /** The app's platform (ios, android, web). */
1260
+ "X-Platform"?: string; /** The operating system's version. */
1261
+ "X-OS-Version"?: string;
1262
+ };
1263
+ body: ScreenRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1264
+ signal?: AbortSignal;
1265
+ }): Promise<Reply<202, undefined>>;
1266
+ /**
1267
+ * Read the settings
1268
+ *
1269
+ * The project's analytics settings.
1270
+ */
1271
+ getSettings(input?: {
1272
+ signal?: AbortSignal;
1273
+ }): Promise<Reply<200, Settings>>;
1274
+ /**
1275
+ * Change the settings
1276
+ *
1277
+ * How long rows are kept (a shorter retention removes what is older within minutes; a longer one keeps what is still there longer), the share of performance samples kept, and whether console records keep bodies.
1278
+ */
1279
+ putSettings(input: {
1280
+ body: Settings; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1281
+ signal?: AbortSignal;
1282
+ }): Promise<Reply<200, Settings>>;
1283
+ /**
1284
+ * Summarize the events
1285
+ *
1286
+ * The window's events: how many, by how many distinct ids, and the 50 most frequent names.
1287
+ */
1288
+ getSummary(input?: {
1289
+ query?: {
1290
+ window_seconds?: number;
1291
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1292
+ signal?: AbortSignal;
1293
+ }): Promise<Reply<200, Summary>>;
1294
+ /**
1295
+ * List requests
1296
+ *
1297
+ * A page of the window's requests, newest first: the traces sent, and the clients' network samples (GET /analytics/perf/client), in one shape.
1298
+ */
1299
+ listTraces(input?: {
1300
+ query?: {
1301
+ window_seconds?: number; /** Only this path. */
1302
+ endpoint?: string; /** client or backend. */
1303
+ source?: "client" | "backend"; /** Only this HTTP method. */
1304
+ method?: string; /** Only this status. */
1305
+ status?: number; /** Only this class of status. */
1306
+ status_class?: "2xx" | "3xx" | "4xx" | "5xx"; /** At least this long. */
1307
+ duration_min_ms?: number; /** At most this long. */
1308
+ duration_max_ms?: number; /** Only this user's (their distinct id). */
1309
+ distinct_id?: string; /** Only this request. */
1310
+ request_id?: string; /** Rows per page (100 unless said). */
1311
+ limit?: number; /** The next_cursor of the page before: reads the page after it. */
1312
+ cursor?: string;
1313
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1314
+ signal?: AbortSignal;
1315
+ }): Promise<Reply<200, TracePage>>;
1316
+ /**
1317
+ * Send a request trace
1318
+ *
1319
+ * One request, as the client (or a backend) saw it: its path, method, status, duration and error, by the request id the platform gave it. The request is answered once what it sends is kept — on the platform's stream, written to the store within seconds, even while the store is restarting. A signed-in user's token (with the publishable key) makes it theirs: their user id is the distinct id, whatever the body says.
1320
+ */
1321
+ sendTrace(input: {
1322
+ headers?: {
1323
+ "Idempotency-Key"?: string; /** The app's version: kept with what it sends. */
1324
+ "X-Palbase-Client-Version"?: string; /** The app's platform (ios, android, web). */
1325
+ "X-Platform"?: string; /** The operating system's version. */
1326
+ "X-OS-Version"?: string;
1327
+ };
1328
+ body: TraceRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1329
+ signal?: AbortSignal;
1330
+ }): Promise<Reply<202, undefined>>;
1331
+ /**
1332
+ * Send request traces in a batch
1333
+ *
1334
+ * Up to 100 requests at once, each kept or refused on its own as a batch of events is: 202 when all were kept, 207 with the refused ones named by place, the first refusal's own answer when none was. What a backend sends of the requests it answered. The request is answered once what it keeps is on the platform's stream, written to the store within seconds.
1335
+ */
1336
+ sendTraceBatch(input: {
1337
+ headers?: {
1338
+ "Idempotency-Key"?: string; /** The app's version: kept with what it sends. */
1339
+ "X-Palbase-Client-Version"?: string; /** The app's platform (ios, android, web). */
1340
+ "X-Platform"?: string; /** The operating system's version. */
1341
+ "X-OS-Version"?: string;
1342
+ };
1343
+ body: TraceBatchRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1344
+ signal?: AbortSignal;
1345
+ }): Promise<Reply<202, BatchAnswer> | Reply<207, BatchAnswer>>;
1346
+ /**
1347
+ * Read one request's hops
1348
+ *
1349
+ * Every report of one request — the client's and the backend's — by trace id, or by request id (a client sample carries no trace id); 500 at most, in order.
1350
+ */
1351
+ getTraceHops(input: {
1352
+ query: {
1353
+ window_seconds?: number; /** The trace id, or the request id. */
1354
+ trace_id: string;
1355
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1356
+ signal?: AbortSignal;
1357
+ }): Promise<Reply<200, TraceList>>;
1358
+ /**
1359
+ * List a session's requests
1360
+ *
1361
+ * A page of one session's requests, in the order they happened.
1362
+ */
1363
+ listSessionTraces(input: {
1364
+ query: {
1365
+ window_seconds?: number; /** The session. */
1366
+ session_id: string; /** Rows per page (100 unless said). */
1367
+ limit?: number; /** The next_cursor of the page before: reads the page after it. */
1368
+ cursor?: string;
1369
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1370
+ signal?: AbortSignal;
1371
+ }): Promise<Reply<200, TracePage>>;
1372
+ /**
1373
+ * Summarize requests
1374
+ *
1375
+ * The whole window's requests — not a page's — with the filters: counts by status class, error rate, duration percentiles.
1376
+ */
1377
+ getTraceSummary(input?: {
1378
+ query?: {
1379
+ window_seconds?: number; /** Only this path. */
1380
+ endpoint?: string; /** client or backend. */
1381
+ source?: "client" | "backend"; /** Only this HTTP method. */
1382
+ method?: string; /** Only this status. */
1383
+ status?: number; /** Only this class of status. */
1384
+ status_class?: "2xx" | "3xx" | "4xx" | "5xx"; /** At least this long. */
1385
+ duration_min_ms?: number; /** At most this long. */
1386
+ duration_max_ms?: number; /** Only this user's (their distinct id). */
1387
+ distinct_id?: string; /** Only this request. */
1388
+ request_id?: string;
1389
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1390
+ signal?: AbortSignal;
1391
+ }): Promise<Reply<200, TraceSummary>>;
1392
+ /**
1393
+ * Read requests over time
1394
+ *
1395
+ * The summary, bucket by bucket — hour by hour unless said, or day by day — oldest first; a bucket with no request is not a row. A row's hour_ms is its bucket's start, an hour's or a day's (unix milliseconds, UTC).
1396
+ */
1397
+ getTraceTimeline(input?: {
1398
+ query?: {
1399
+ window_seconds?: number; /** hour or day: what a row spans (hour unless said). */
1400
+ bucket?: "hour" | "day"; /** Only this path. */
1401
+ endpoint?: string; /** client or backend. */
1402
+ source?: "client" | "backend"; /** Only this HTTP method. */
1403
+ method?: string; /** Only this status. */
1404
+ status?: number; /** Only this class of status. */
1405
+ status_class?: "2xx" | "3xx" | "4xx" | "5xx"; /** At least this long. */
1406
+ duration_min_ms?: number; /** At most this long. */
1407
+ duration_max_ms?: number; /** Only this user's (their distinct id). */
1408
+ distinct_id?: string; /** Only this request. */
1409
+ request_id?: string;
1410
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1411
+ signal?: AbortSignal;
1412
+ }): Promise<Reply<200, TraceTimeline>>;
1413
+ };
1414
+ export type Client = ReturnType<typeof client>;