palbase 0.8.1 → 0.9.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 (72) hide show
  1. package/dist/ai/index.js +2 -2
  2. package/dist/backend/engine.js +2 -2
  3. package/dist/backend/env.js +1 -1
  4. package/dist/backend/index.js +3 -3
  5. package/dist/backend/stack.js +1 -1
  6. package/dist/backend/test.js +2 -2
  7. package/dist/chunks/{KHHJRNAO.js → 23G5YVSL.js} +1 -1
  8. package/dist/chunks/{73R33XMD.js → 3X7CRIHE.js} +1 -1
  9. package/dist/chunks/5UXVSEM2.js +2 -0
  10. package/dist/chunks/6YCANJ7U.js +2 -0
  11. package/dist/chunks/{RYI2OB52.js → 7HMBZG2R.js} +2 -2
  12. package/dist/chunks/{MAYLG7WE.js → 7OZCS3BA.js} +2 -2
  13. package/dist/chunks/FFWT3RBE.js +13 -0
  14. package/dist/chunks/{7XVI5JLP.js → GGKL7UV2.js} +2 -2
  15. package/dist/chunks/HGQXQMYU.js +95 -0
  16. package/dist/chunks/{ZSKMWUIQ.js → I45DYZZL.js} +2 -2
  17. package/dist/chunks/{5RTSNQ4X.js → KSU226RI.js} +2 -2
  18. package/dist/chunks/MEIN5GAG.js +22 -0
  19. package/dist/chunks/{NSQAN2ME.js → OEZLXSQN.js} +2 -2
  20. package/dist/chunks/{6RXVXPHC.js → OGREZP5F.js} +1 -1
  21. package/dist/chunks/{T2Q5CKLL.js → ONP77MHF.js} +2 -2
  22. package/dist/chunks/{CA4VJGGG.js → QR4Z3ORW.js} +1 -1
  23. package/dist/chunks/{M4XLAPDF.js → R5NCHIW3.js} +2 -2
  24. package/dist/chunks/{KYJJJUEU.js → RV35QG7V.js} +2 -2
  25. package/dist/chunks/{RZ525VLP.js → YOTK5642.js} +2 -2
  26. package/dist/chunks/{KJWHR5BP.js → Z7VRCVKE.js} +2 -2
  27. package/dist/cli.js +129 -127
  28. package/dist/refuse/ai.js +1 -1
  29. package/dist/refuse/backend.js +1 -1
  30. package/dist/refuse/server.js +1 -1
  31. package/dist/server/index.js +2 -2
  32. package/dist/server/testing.js +2 -2
  33. package/dist/web/index.js +2 -2
  34. package/dist/web/message.js +2 -0
  35. package/dist/web/palbe.js +2 -2
  36. package/dist/web/paywall.js +2 -2
  37. package/dist/web/push-sw.js +2 -0
  38. package/dist/web/ssr.js +2 -2
  39. package/dist/web/vite.js +2 -2
  40. package/package.json +7 -2
  41. package/types/backend/src/services.d.ts +2 -2
  42. package/types/internal/src/modules/ai.d.ts +1 -1
  43. package/types/internal/src/modules/analytics.d.ts +618 -1
  44. package/types/internal/src/modules/auth.d.ts +409 -90
  45. package/types/internal/src/modules/events.d.ts +7 -3
  46. package/types/internal/src/modules/flags.d.ts +380 -14
  47. package/types/internal/src/modules/notify.d.ts +2270 -99
  48. package/types/internal/src/modules/purchases.d.ts +672 -9
  49. package/types/server/src/webhooks.d.ts +1 -1
  50. package/types/web/src/analytics.d.ts +56 -5
  51. package/types/web/src/client.d.ts +26 -4
  52. package/types/web/src/consent.d.ts +218 -0
  53. package/types/web/src/flags.d.ts +75 -0
  54. package/types/web/src/inapp.d.ts +129 -0
  55. package/types/web/src/inbox.d.ts +59 -0
  56. package/types/web/src/index.d.ts +9 -3
  57. package/types/web/src/installation.d.ts +16 -0
  58. package/types/web/src/message/index.d.ts +5 -0
  59. package/types/web/src/message/present.d.ts +20 -0
  60. package/types/web/src/notify.d.ts +67 -0
  61. package/types/web/src/paywall/index.d.ts +4 -4
  62. package/types/web/src/paywall/placement.d.ts +11 -12
  63. package/types/web/src/paywall/prices.d.ts +7 -2
  64. package/types/web/src/purchases.d.ts +32 -0
  65. package/types/web/src/{paywall → screen}/assets.d.ts +6 -6
  66. package/types/web/src/screen/render.d.ts +186 -0
  67. package/types/web/src/{paywall → screen}/resolve.d.ts +56 -8
  68. package/dist/chunks/5M3HV3X4.js +0 -2
  69. package/dist/chunks/Q4XTWEAW.js +0 -92
  70. package/dist/chunks/Y6AQWQBE.js +0 -2
  71. package/types/web/src/paywall/render.d.ts +0 -93
  72. /package/types/web/src/{paywall → screen}/icons.d.ts +0 -0
@@ -15,10 +15,52 @@ export type Condition = {
15
15
  */
16
16
  value: unknown;
17
17
  /**
18
- * The expression: comparisons over client.platform, client.locale, client.app_version, client.os_version, percentile, server.country and server.now, combined with && || and parentheses (512 characters, 16 comparisons at most).
18
+ * The expression: comparisons over client.platform, client.locale, client.app_version, client.os_version, percentile, server.country, server.now and server.audience, combined with && || and parentheses (512 characters, 16 comparisons at most). server.audience == '<id>' (or in ['<id>', …]) is a reader analytics has in that audience, and only one who allowed personalization: no one else is in any, and there is no "not in".
19
19
  */
20
20
  when: string;
21
21
  };
22
+ /**
23
+ * What calling a leader takes — every variant seen by min_viewers people, the leader's chance to win min_chance — and what the results still lack, reason by reason: none, they are confident.
24
+ */
25
+ export type Confidence = {
26
+ /**
27
+ * The chance to win the leader needs (0 to 1).
28
+ */
29
+ min_chance: number;
30
+ /**
31
+ * The people each variant needs to have been seen by.
32
+ */
33
+ min_viewers: number;
34
+ /**
35
+ * What is still lacking; empty when confident.
36
+ */
37
+ reasons: ConfidenceReason[];
38
+ };
39
+ /**
40
+ * One thing the results lack to call their leader.
41
+ */
42
+ export type ConfidenceReason = {
43
+ /**
44
+ * Its chance to win, for leader_unsure.
45
+ */
46
+ chance?: number;
47
+ /**
48
+ * no_viewers: no one saw a variant yet; too_few_viewers: a variant was seen by fewer than min_viewers (variant, viewers); no_leader: no variant leads yet — one no one saw, or the likeliest even with the next (no leader is named); leader_unsure: the leader's chance to win is under min_chance (variant, chance). A client says a code it does not know in the reason's message.
49
+ */
50
+ code: "no_viewers" | "too_few_viewers" | "no_leader" | "leader_unsure";
51
+ /**
52
+ * The reason in words ("variant b has 40 viewers (needs 100)").
53
+ */
54
+ message: string;
55
+ /**
56
+ * The variant it is about.
57
+ */
58
+ variant?: string;
59
+ /**
60
+ * Its viewers, for too_few_viewers.
61
+ */
62
+ viewers?: number;
63
+ };
22
64
  export type DailyBucket = {
23
65
  /**
24
66
  * The app version.
@@ -54,6 +96,7 @@ export type Delta = {
54
96
  sync_version: string;
55
97
  };
56
98
  export type DeltaOp = {
99
+ experiment?: FlagAssignment;
57
100
  /**
58
101
  * The flag's key.
59
102
  */
@@ -65,7 +108,7 @@ export type DeltaOp = {
65
108
  /**
66
109
  * Where the value came from.
67
110
  */
68
- source: "system" | "override";
111
+ source: "system" | "override" | "experiment";
69
112
  /**
70
113
  * The value (put only).
71
114
  */
@@ -143,6 +186,189 @@ export type EvaluationsBucket = {
143
186
  */
144
187
  value?: string;
145
188
  };
189
+ /**
190
+ * An experiment on a flag: while it runs, each of its people — everyone a read names (a user, or the installation of someone signed in as no one), or the people of an analytics audience who allowed personalization — gets one variant's value, the same on every read, until it is stopped or a variant is declared the winner.
191
+ */
192
+ export type Experiment = {
193
+ /**
194
+ * The analytics audience it is for; absent: everyone a read names.
195
+ */
196
+ audience_id?: string;
197
+ /**
198
+ * When it ended; absent while it runs.
199
+ */
200
+ ended_at?: string;
201
+ /**
202
+ * Who ended it: the API key, or who deleted its flag.
203
+ */
204
+ ended_by?: string;
205
+ /**
206
+ * The analytics event its people are counted for doing after they first saw their variant.
207
+ */
208
+ goal_event: string;
209
+ /**
210
+ * The experiment's id.
211
+ */
212
+ id: string;
213
+ /**
214
+ * Its flag's key.
215
+ */
216
+ key: string;
217
+ /**
218
+ * Its name.
219
+ */
220
+ name: string;
221
+ /**
222
+ * When it started.
223
+ */
224
+ started_at: string;
225
+ /**
226
+ * Who started it: the API key.
227
+ */
228
+ started_by: string;
229
+ /**
230
+ * running; stopped (its people get the flag's own value again); won (the winner's value became the flag's).
231
+ */
232
+ status: "running" | "stopped" | "won";
233
+ /**
234
+ * Its variants.
235
+ */
236
+ variants: ExperimentVariant[];
237
+ /**
238
+ * The variant declared the winner.
239
+ */
240
+ winner?: string;
241
+ };
242
+ /**
243
+ * A page of the project's experiments, newest first.
244
+ */
245
+ export type ExperimentPage = {
246
+ /**
247
+ * The experiments.
248
+ */
249
+ experiments: Experiment[];
250
+ /**
251
+ * The next page's cursor; absent on the last.
252
+ */
253
+ next_cursor?: string;
254
+ };
255
+ /**
256
+ * An experiment to start on a flag.
257
+ */
258
+ export type ExperimentRequest = {
259
+ /**
260
+ * An analytics audience: only its people who allowed personalization are in the experiment, everyone else gets the flag's own value. Absent: everyone a read names.
261
+ */
262
+ audience_id?: string;
263
+ /**
264
+ * The analytics event that counts as converting: a letter or $, then letters, digits and _ . : - $, at most 64.
265
+ */
266
+ goal_event: string;
267
+ /**
268
+ * The flag's key (not a Palbase-managed one).
269
+ */
270
+ key: string;
271
+ /**
272
+ * Its name, 1 to 100 characters.
273
+ */
274
+ name: string;
275
+ /**
276
+ * 2 to 4 variants.
277
+ */
278
+ variants: ExperimentVariant[];
279
+ };
280
+ /**
281
+ * What each variant's people did, counted where their events are (analytics).
282
+ */
283
+ export type ExperimentResults = {
284
+ /**
285
+ * When they were counted.
286
+ */
287
+ computed_at: string;
288
+ confidence: Confidence;
289
+ /**
290
+ * Whether declaring the leader the winner is sound: confidence lacks nothing.
291
+ */
292
+ confident: boolean;
293
+ /**
294
+ * The experiment.
295
+ */
296
+ experiment_id: string;
297
+ /**
298
+ * The event counted as converting.
299
+ */
300
+ goal_event: string;
301
+ /**
302
+ * The variant likeliest to convert best; absent while none leads.
303
+ */
304
+ leader?: string;
305
+ /**
306
+ * The experiment's status.
307
+ */
308
+ status: "running" | "stopped" | "won";
309
+ /**
310
+ * Each variant's numbers, in the experiment's order.
311
+ */
312
+ variants: ExperimentVariantResult[];
313
+ /**
314
+ * The days after a person's first exposure the goal counted within.
315
+ */
316
+ window_days: number;
317
+ };
318
+ /**
319
+ * One value of the experiment's flag, to its share of the people: weight over the variants' weights together.
320
+ */
321
+ export type ExperimentVariant = {
322
+ /**
323
+ * The variant's key: lowercase letters, digits and _, starting with a letter, at most 20.
324
+ */
325
+ key: string;
326
+ /**
327
+ * The value its people get: one the flag takes (its type, 8 KB at most, inside its choices); each variant's its own.
328
+ */
329
+ value: unknown;
330
+ /**
331
+ * Its share: 1 to 1000, over the variants' weights together.
332
+ */
333
+ weight: number;
334
+ };
335
+ /**
336
+ * One variant's numbers.
337
+ */
338
+ export type ExperimentVariantResult = {
339
+ /**
340
+ * Its probability of converting best (0 to 1), Bayesian: how often its rate, drawn from what was seen, is the highest.
341
+ */
342
+ chance_to_win: number;
343
+ /**
344
+ * converters over viewers; 0 with no viewers.
345
+ */
346
+ conversion_rate: number;
347
+ /**
348
+ * The people exposed who did the goal event within window_days after their first exposure.
349
+ */
350
+ converters: number;
351
+ /**
352
+ * The exposures its people's apps reported ($flag_exposure, once a session).
353
+ */
354
+ exposures: number;
355
+ /**
356
+ * The variant's value.
357
+ */
358
+ value: unknown;
359
+ /**
360
+ * The variant's key.
361
+ */
362
+ variant: string;
363
+ /**
364
+ * The people exposed to it: each user, or installation of someone signed in as no one, once.
365
+ */
366
+ viewers: number;
367
+ /**
368
+ * Its weight.
369
+ */
370
+ weight: number;
371
+ };
146
372
  export type Flag = {
147
373
  /**
148
374
  * Targeting, in order, first match wins (8 at most).
@@ -189,6 +415,28 @@ export type Flag = {
189
415
  */
190
416
  version: number;
191
417
  };
418
+ /**
419
+ * The experiment variant a value is.
420
+ */
421
+ export type FlagAssignment = {
422
+ /**
423
+ * The experiment.
424
+ */
425
+ experiment_id: string;
426
+ /**
427
+ * The variant's key.
428
+ */
429
+ variant: string;
430
+ };
431
+ /**
432
+ * flag.changed: the project's flag definitions changed; readers read them again.
433
+ */
434
+ export type FlagChangedEvent = {
435
+ /**
436
+ * The definitions' new version.
437
+ */
438
+ sync_version: number;
439
+ };
192
440
  export type FlagDefinition = {
193
441
  /**
194
442
  * Targeting, in order, first match wins (8 at most).
@@ -229,6 +477,19 @@ export type FlagEvaluations = {
229
477
  * The project's flags, by key.
230
478
  */
231
479
  export type FlagList = Flag[];
480
+ /**
481
+ * flag.override_changed: a user's own flag values changed.
482
+ */
483
+ export type FlagOverrideChangedEvent = {
484
+ /**
485
+ * The new version.
486
+ */
487
+ sync_version: number;
488
+ /**
489
+ * The user.
490
+ */
491
+ user_id: string;
492
+ };
232
493
  export type FlagValues = {
233
494
  /**
234
495
  * When the answer was made.
@@ -284,18 +545,24 @@ export type ReadsBucket = {
284
545
  };
285
546
  export type Snapshot = {
286
547
  /**
287
- * The hash of what the answer depends on besides the flags (client context, country, user, time conditions).
548
+ * The hash of what the answer depends on besides the flags (client context, country, user, time conditions, the audiences the reader is in).
288
549
  */
289
550
  context_hash: string;
551
+ /**
552
+ * The experiment variant each value an experiment gave is, by key; absent when none. When the app reads such a flag, the SDK sends the analytics event $flag_exposure {flag, experiment, variant} once a session: what the experiment's results count.
553
+ */
554
+ experiments?: {
555
+ [key: string]: FlagAssignment;
556
+ };
290
557
  /**
291
558
  * When the answer was made.
292
559
  */
293
560
  fetched_at: string;
294
561
  /**
295
- * Where each value came from: the flag (system) or the user's own (override).
562
+ * Where each value came from: the flag (system), the user's own (override), or an experiment's variant (experiment).
296
563
  */
297
564
  sources: {
298
- [key: string]: "system" | "override";
565
+ [key: string]: "system" | "override" | "experiment";
299
566
  };
300
567
  /**
301
568
  * The version the answer is current as of: the delta's since.
@@ -536,9 +803,9 @@ export type UserValueAnswer = {
536
803
  */
537
804
  key: string;
538
805
  /**
539
- * override: the user's own; system: the flag's, resolved for the user.
806
+ * override: the user's own; experiment: an experiment's variant for the user; system: the flag's, resolved for the user.
540
807
  */
541
- source: "system" | "override";
808
+ source: "system" | "override" | "experiment";
542
809
  /**
543
810
  * The value.
544
811
  */
@@ -584,15 +851,41 @@ export type VersionBucket = {
584
851
  */
585
852
  platform: string;
586
853
  };
854
+ /**
855
+ * The variant that won.
856
+ */
857
+ export type WinnerRequest = {
858
+ /**
859
+ * Roll it out as a condition at the top of the flag's — server.audience == the experiment's audience — and keep the flag's default; for an experiment for an audience only. Absent or false: its value becomes the flag's default.
860
+ */
861
+ as_rule?: boolean;
862
+ /**
863
+ * The variant's key.
864
+ */
865
+ variant: string;
866
+ };
867
+ /** The events this module sends the project's webhooks (x-palbase-events), by type: each one's payload, the event's data. */
868
+ export interface Events {
869
+ /**
870
+ * flag.changed: the project's flag definitions changed.
871
+ */
872
+ "flag.changed": FlagChangedEvent;
873
+ /**
874
+ * flag.override_changed: a user's own flag values changed.
875
+ */
876
+ "flag.override_changed": FlagOverrideChangedEvent;
877
+ }
587
878
  /** Palbase Flags */
588
879
  export declare function client(t: Transport): {
589
880
  /**
590
881
  * Read the flags' values
591
882
  *
592
- * Every flag's value for the reader, alone. Resolved for the reader: a signed-in user's token (with the publishable key) makes the answer theirs — their own values first, then the first condition of each flag that matches, then its default. Conditions read what the client declares (platform, versions, locale), the share of users a percentile picks (signed-in users only), the country of the address the edge saw, and the server's clock.
883
+ * Every flag's value for the reader, alone. Resolved for the reader: a signed-in user's token (with the publishable key) makes the answer theirs — their own values first, then the variant of the experiment running on a flag when they are one of its people, then the first condition of each flag that matches, then its default. Conditions read what the client declares (platform, versions, locale), the share of users a percentile picks (signed-in users only), the country of the address the edge saw, the server's clock, and the analytics audiences the reader — the user or, signed in as no one, the installation proven with its secret — is in, having allowed personalization.
593
884
  */
594
885
  getValues(input?: {
595
886
  headers?: {
887
+ "X-Palbase-Installation"?: string; /** The installation's secret (kernel/installclaim; 43 to 256 characters): proves the X-Palbase-Installation it was made into. Without it, an installation named is no one for audiences and experiments. */
888
+ "X-Palbase-Installation-Secret"?: string; /** The client's platform (client.platform). */
596
889
  "X-Platform"?: string; /** The operating system's version (client.os_version). */
597
890
  "X-OS-Version"?: string; /** The app's version (client.app_version). */
598
891
  "X-Palbase-Client-Version"?: string; /** The client's languages; the first is client.locale. */
@@ -612,14 +905,16 @@ export declare function client(t: Transport): {
612
905
  /**
613
906
  * Read what changed
614
907
  *
615
- * What changed for the reader since a version, in order: a value put, or a flag deleted. A client whose answer may no longer be its own — its context, country or user changed, or a time condition turned (its If-None-Match says) — or whose version is older than the deletions still kept (30 days), is answered 410 and takes a snapshot. Resolved for the reader: a signed-in user's token (with the publishable key) makes the answer theirs — their own values first, then the first condition of each flag that matches, then its default. Conditions read what the client declares (platform, versions, locale), the share of users a percentile picks (signed-in users only), the country of the address the edge saw, and the server's clock.
908
+ * What changed for the reader since a version, in order: a value put (with its experiment variant, when an experiment gave it), or a flag deleted; an experiment started or ended on a flag is a change of it. A client whose answer may no longer be its own — its context, country or user changed, a time condition turned, or the reader entered or left an audience (its If-None-Match says) — or whose version is older than the deletions still kept (30 days), is answered 410 and takes a snapshot. Resolved for the reader: a signed-in user's token (with the publishable key) makes the answer theirs — their own values first, then the variant of the experiment running on a flag when they are one of its people, then the first condition of each flag that matches, then its default. Conditions read what the client declares (platform, versions, locale), the share of users a percentile picks (signed-in users only), the country of the address the edge saw, the server's clock, and the analytics audiences the reader — the user or, signed in as no one, the installation proven with its secret — is in, having allowed personalization.
616
909
  */
617
910
  getDelta(input?: {
618
911
  query?: {
619
912
  since?: number;
620
913
  };
621
914
  headers?: {
622
- "If-None-Match"?: string; /** The client's platform (client.platform). */
915
+ "If-None-Match"?: string; /** The app installation's id (64 characters at most): signed in as no one and proven with X-Palbase-Installation-Secret, whom an audience condition asks about and an experiment places. */
916
+ "X-Palbase-Installation"?: string; /** The installation's secret (kernel/installclaim; 43 to 256 characters): proves the X-Palbase-Installation it was made into. Without it, an installation named is no one for audiences and experiments. */
917
+ "X-Palbase-Installation-Secret"?: string; /** The client's platform (client.platform). */
623
918
  "X-Platform"?: string; /** The operating system's version (client.os_version). */
624
919
  "X-OS-Version"?: string; /** The app's version (client.app_version). */
625
920
  "X-Palbase-Client-Version"?: string; /** The client's languages; the first is client.locale. */
@@ -648,6 +943,76 @@ export declare function client(t: Transport): {
648
943
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
649
944
  signal?: AbortSignal;
650
945
  }): Promise<Reply<200, Evaluations>>;
946
+ /**
947
+ * List experiments
948
+ *
949
+ * The project's experiments, newest first, a page at a time; one flag's with key.
950
+ */
951
+ listExperiments(input?: {
952
+ query?: {
953
+ key?: string; /** How many experiments a page holds (20 unless said). */
954
+ limit?: number; /** The `next_cursor` of the page before. */
955
+ cursor?: string;
956
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
957
+ signal?: AbortSignal;
958
+ }): Promise<Reply<200, ExperimentPage>>;
959
+ /**
960
+ * Start an experiment
961
+ *
962
+ * Starts an experiment on a flag: from the next read on, each of its people — everyone a read names (a user, or signed in as no one the installation proven with its secret: X-Palbase-Installation, X-Palbase-Installation-Secret), or the people of audience_id who allowed personalization — gets one variant's value, the same on every read (a hash of the experiment and the person over the weights: nothing is stored per person). A user's own value still comes first. A read carries the variant (Snapshot.experiments, DeltaOp.experiment); the app reports reading it as the analytics event $flag_exposure {flag, experiment, variant}, once a session. Every variant's value is one the flag takes; one experiment runs on a flag at a time; every reader is told (flags:<ref>).
963
+ */
964
+ startExperiment(input: {
965
+ body: ExperimentRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
966
+ signal?: AbortSignal;
967
+ }): Promise<Reply<201, Experiment>>;
968
+ /**
969
+ * Read an experiment
970
+ *
971
+ * One experiment.
972
+ */
973
+ getExperiment(input: {
974
+ path: {
975
+ experiment_id: string;
976
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
977
+ signal?: AbortSignal;
978
+ }): Promise<Reply<200, Experiment>>;
979
+ /**
980
+ * Read an experiment's results
981
+ *
982
+ * What each variant's people did, counted by analytics where their events are: the exposures their apps reported ($flag_exposure), the people exposed (each user, or installation of someone signed in as no one, once — counted for the variant they saw first), and those of them who did the goal event within `window_days` (7 unless said) after their first exposure; the conversion rate; and each variant's chance to convert best. `leader` is the likeliest best, `confident` whether declaring it the winner is sound. Analytics not answering is a 503: retrying is safe.
983
+ */
984
+ getExperimentResults(input: {
985
+ path: {
986
+ experiment_id: string;
987
+ };
988
+ query?: {
989
+ window_days?: number;
990
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
991
+ signal?: AbortSignal;
992
+ }): Promise<Reply<200, ExperimentResults>>;
993
+ /**
994
+ * Stop an experiment
995
+ *
996
+ * Stops a running experiment, at once: from the next read on its people get the flag's own value again; the flag stays as it was. Its results stay. Every reader is told (flags:<ref>).
997
+ */
998
+ stopExperiment(input: {
999
+ path: {
1000
+ experiment_id: string;
1001
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1002
+ signal?: AbortSignal;
1003
+ }): Promise<Reply<200, Experiment>>;
1004
+ /**
1005
+ * Declare an experiment's winner
1006
+ *
1007
+ * Ends a running experiment with a winner: its value becomes the flag's default — or, as_rule (an experiment for an audience), the first of the flag's conditions, server.audience == the audience, and the default stays. With publishing on, that is the next published version (its note names the experiment). Every reader is told (flags:<ref>).
1008
+ */
1009
+ declareExperimentWinner(input: {
1010
+ path: {
1011
+ experiment_id: string;
1012
+ };
1013
+ body: WinnerRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1014
+ signal?: AbortSignal;
1015
+ }): Promise<Reply<200, Experiment>>;
651
1016
  /**
652
1017
  * Read the builds in use
653
1018
  *
@@ -670,12 +1035,13 @@ export declare function client(t: Transport): {
670
1035
  /**
671
1036
  * Take a snapshot
672
1037
  *
673
- * Every flag's value for the reader, where each came from, and the version it is current as of — what a client starts from, then keeps up to date with deltas. Resolved for the reader: a signed-in user's token (with the publishable key) makes the answer theirs — their own values first, then the first condition of each flag that matches, then its default. Conditions read what the client declares (platform, versions, locale), the share of users a percentile picks (signed-in users only), the country of the address the edge saw, and the server's clock. The answer's ETag names the version and everything else it depends on; sent back as If-None-Match, an unchanged answer is 304. Each read is metered (flags.reads).
1038
+ * Every flag's value for the reader, where each came from, and the version it is current as of — what a client starts from, then keeps up to date with deltas. Resolved for the reader: a signed-in user's token (with the publishable key) makes the answer theirs — their own values first, then the variant of the experiment running on a flag when they are one of its people, then the first condition of each flag that matches, then its default. Conditions read what the client declares (platform, versions, locale), the share of users a percentile picks (signed-in users only), the country of the address the edge saw, the server's clock, and the analytics audiences the reader is in — asked of auth (did they allow personalization) and analytics once per read, for the user or, signed in as no one, the installation proven with its secret (X-Palbase-Installation, X-Palbase-Installation-Secret); a reader they cannot answer for is in none. The answer's ETag names the version and everything else it depends on — the audiences the reader is in too: one who entered or left one gets the new answer; sent back as If-None-Match, an unchanged answer is 304. A value an experiment gave names its variant (experiments): the app reports reading it as the analytics event $flag_exposure. Each read is metered (flags.reads).
674
1039
  */
675
1040
  getSnapshot(input?: {
676
1041
  headers?: {
677
- "If-None-Match"?: string; /** The app installation's id (64 characters at most): counted for version adoption. */
678
- "X-Palbase-Installation"?: string; /** The client's platform (client.platform). */
1042
+ "If-None-Match"?: string; /** The app installation's id (64 characters at most): counted for version adoption; signed in as no one and proven with X-Palbase-Installation-Secret, whom an audience condition asks about and an experiment places. */
1043
+ "X-Palbase-Installation"?: string; /** The installation's secret (kernel/installclaim; 43 to 256 characters): proves the X-Palbase-Installation it was made into. Without it, an installation named is no one for audiences and experiments. */
1044
+ "X-Palbase-Installation-Secret"?: string; /** The client's platform (client.platform). */
679
1045
  "X-Platform"?: string; /** The operating system's version (client.os_version). */
680
1046
  "X-OS-Version"?: string; /** The app's version (client.app_version). */
681
1047
  "X-Palbase-Client-Version"?: string; /** The client's languages; the first is client.locale. */
@@ -705,7 +1071,7 @@ export declare function client(t: Transport): {
705
1071
  /**
706
1072
  * Define a flag
707
1073
  *
708
- * Defines a flag, or changes one (a deleted one comes back): its type, its default, the choices a string flag allows, and the conditions — first match wins — that give another value. Refused while publishing is on (templates), when it would change the type under users' values or leave a user's value outside the choices, and past 200 flags. Every reader is told (flags:<ref>).
1074
+ * Defines a flag, or changes one (a deleted one comes back): its type, its default, the choices a string flag allows, and the conditions — first match wins — that give another value. Refused while publishing is on (templates), when it would change the type under users' values or leave a user's value outside the choices, past 200 flags, and when it would change the type or choices under the experiment running on the flag. Every reader is told (flags:<ref>).
709
1075
  */
710
1076
  putDefinition(input: {
711
1077
  path: {