palbase 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +27 -0
- package/README.md +2 -2
- package/dist/ai/index.js +17 -0
- package/dist/backend/engine.js +2 -0
- package/dist/backend/env.js +1 -0
- package/dist/backend/index.js +12 -0
- package/dist/backend/stack.js +1 -0
- package/dist/backend/test.js +2 -0
- package/dist/chunks/5W6XJM46.js +13 -0
- package/dist/chunks/6OPBXB7Z.js +2 -0
- package/dist/chunks/7LOMYBLN.js +20 -0
- package/dist/chunks/AN5LCF5K.js +55 -0
- package/dist/chunks/ECUYQ73P.js +2 -0
- package/dist/chunks/HDX6YUAB.js +2 -0
- package/dist/chunks/HVC2C35F.js +2 -0
- package/dist/chunks/I3JNX6MZ.js +4 -0
- package/dist/chunks/JEJ5CFTK.js +2 -0
- package/dist/chunks/K3C2IEDS.js +2 -0
- package/dist/chunks/KRBVYYME.js +2 -0
- package/dist/chunks/NIJHTHNF.js +2 -0
- package/dist/chunks/TL4H6V3P.js +2 -0
- package/dist/chunks/UTRQWCMD.js +6 -0
- package/dist/chunks/ZFPDYRRY.js +2 -0
- package/dist/cli.js +815 -0
- package/dist/refuse/ai.js +2 -0
- package/dist/refuse/backend.js +2 -0
- package/dist/refuse/server.js +2 -0
- package/dist/server/index.js +2 -0
- package/dist/server/testing.js +2 -0
- package/dist/web/index.js +2 -0
- package/dist/web/palbe.js +2 -0
- package/dist/web/paywall.js +2 -0
- package/dist/web/vite.js +3 -0
- package/package.json +111 -4
- package/types/ai/src/ai.d.ts +178 -0
- package/types/ai/src/index.d.ts +5 -0
- package/types/ai/src/partial.d.ts +1 -0
- package/types/ai/src/schema.d.ts +47 -0
- package/types/backend/src/bootstrap.d.ts +72 -0
- package/types/backend/src/cache.d.ts +32 -0
- package/types/backend/src/container.d.ts +49 -0
- package/types/backend/src/database.d.ts +148 -0
- package/types/backend/src/db-env.d.ts +4 -0
- package/types/backend/src/decorators.d.ts +293 -0
- package/types/backend/src/engine-db.d.ts +24 -0
- package/types/backend/src/engine-exports.d.ts +3 -0
- package/types/backend/src/engine.d.ts +124 -0
- package/types/backend/src/env.d.ts +27 -0
- package/types/backend/src/errors.d.ts +70 -0
- package/types/backend/src/i18n.d.ts +21 -0
- package/types/backend/src/index.d.ts +23 -0
- package/types/backend/src/openapi.d.ts +73 -0
- package/types/backend/src/platform-calls.d.ts +41 -0
- package/types/backend/src/requests.d.ts +81 -0
- package/types/backend/src/rooms.d.ts +168 -0
- package/types/backend/src/router.d.ts +22 -0
- package/types/backend/src/runtime.d.ts +56 -0
- package/types/backend/src/services.d.ts +262 -0
- package/types/backend/src/stack.d.ts +20 -0
- package/types/backend/src/strings-files.d.ts +3 -0
- package/types/backend/src/testing/index.d.ts +3 -0
- package/types/backend/src/testing/unit.d.ts +66 -0
- package/types/backend/src/upload.d.ts +125 -0
- package/types/backend/src/webhooks.d.ts +113 -0
- package/types/internal/src/event.d.ts +9 -0
- package/types/internal/src/modules/ai.d.ts +678 -0
- package/types/internal/src/modules/analytics.d.ts +1414 -0
- package/types/internal/src/modules/auth.d.ts +5660 -0
- package/types/internal/src/modules/cache.d.ts +158 -0
- package/types/internal/src/modules/events.d.ts +19 -0
- package/types/internal/src/modules/flags.d.ts +957 -0
- package/types/internal/src/modules/index.d.ts +13 -0
- package/types/internal/src/modules/machines.d.ts +1584 -0
- package/types/internal/src/modules/notify.d.ts +1450 -0
- package/types/internal/src/modules/purchases.d.ts +4113 -0
- package/types/internal/src/modules/realtime.d.ts +326 -0
- package/types/internal/src/modules/secrets.d.ts +275 -0
- package/types/internal/src/modules/storage.d.ts +691 -0
- package/types/internal/src/modules/stores.d.ts +1516 -0
- package/types/internal/src/retry.d.ts +14 -0
- package/types/internal/src/transport.d.ts +106 -0
- package/types/server/src/auth/dpop.d.ts +47 -0
- package/types/server/src/auth/jwt.d.ts +115 -0
- package/types/server/src/index.d.ts +9 -0
- package/types/server/src/pages.d.ts +4 -0
- package/types/server/src/purchases.d.ts +51 -0
- package/types/server/src/secrets-env.d.ts +22 -0
- package/types/server/src/server.d.ts +40 -0
- package/types/server/src/testing.d.ts +91 -0
- package/types/server/src/webhooks.d.ts +72 -0
- package/types/web/src/analytics.d.ts +87 -0
- package/types/web/src/auth.d.ts +155 -0
- package/types/web/src/backend-error.d.ts +38 -0
- package/types/web/src/backend-names.d.ts +25 -0
- package/types/web/src/backends.d.ts +84 -0
- package/types/web/src/client.d.ts +51 -0
- package/types/web/src/index.d.ts +13 -0
- package/types/web/src/palbe.d.ts +2 -0
- package/types/web/src/paywall/icons.d.ts +5 -0
- package/types/web/src/paywall/index.d.ts +5 -0
- package/types/web/src/paywall/placement.d.ts +85 -0
- package/types/web/src/paywall/prices.d.ts +40 -0
- package/types/web/src/paywall/render.d.ts +54 -0
- package/types/web/src/paywall/resolve.d.ts +149 -0
- package/types/web/src/purchases.d.ts +86 -0
- package/types/web/src/rooms.d.ts +61 -0
- package/types/web/src/session.d.ts +91 -0
- package/types/web/src/socket.d.ts +87 -0
- package/types/web/src/vite.d.ts +49 -0
|
@@ -0,0 +1,957 @@
|
|
|
1
|
+
import { type Reply, type Transport } from '../transport.js';
|
|
2
|
+
/**
|
|
3
|
+
* Installations per day, platform and app version.
|
|
4
|
+
*/
|
|
5
|
+
export type AdoptionCurve = DailyBucket[];
|
|
6
|
+
export type BatchApplied = {
|
|
7
|
+
/**
|
|
8
|
+
* Operations applied.
|
|
9
|
+
*/
|
|
10
|
+
applied: number;
|
|
11
|
+
};
|
|
12
|
+
export type Condition = {
|
|
13
|
+
/**
|
|
14
|
+
* The value when it matches: the flag's type, inside its choices.
|
|
15
|
+
*/
|
|
16
|
+
value: unknown;
|
|
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).
|
|
19
|
+
*/
|
|
20
|
+
when: string;
|
|
21
|
+
};
|
|
22
|
+
export type DailyBucket = {
|
|
23
|
+
/**
|
|
24
|
+
* The app version.
|
|
25
|
+
*/
|
|
26
|
+
app_version: string;
|
|
27
|
+
/**
|
|
28
|
+
* The day (UTC).
|
|
29
|
+
*/
|
|
30
|
+
day: string;
|
|
31
|
+
/**
|
|
32
|
+
* Installations.
|
|
33
|
+
*/
|
|
34
|
+
installations: number;
|
|
35
|
+
/**
|
|
36
|
+
* The platform.
|
|
37
|
+
*/
|
|
38
|
+
platform: string;
|
|
39
|
+
};
|
|
40
|
+
export type DeletedCount = {
|
|
41
|
+
/**
|
|
42
|
+
* Values removed.
|
|
43
|
+
*/
|
|
44
|
+
deleted: number;
|
|
45
|
+
};
|
|
46
|
+
export type Delta = {
|
|
47
|
+
/**
|
|
48
|
+
* The changes, in the order they were made.
|
|
49
|
+
*/
|
|
50
|
+
ops: DeltaOp[];
|
|
51
|
+
/**
|
|
52
|
+
* The version the client is current as of after applying them.
|
|
53
|
+
*/
|
|
54
|
+
sync_version: string;
|
|
55
|
+
};
|
|
56
|
+
export type DeltaOp = {
|
|
57
|
+
/**
|
|
58
|
+
* The flag's key.
|
|
59
|
+
*/
|
|
60
|
+
key: string;
|
|
61
|
+
/**
|
|
62
|
+
* put: the key's value is now value; delete: the flag is gone.
|
|
63
|
+
*/
|
|
64
|
+
op: "put" | "delete";
|
|
65
|
+
/**
|
|
66
|
+
* Where the value came from.
|
|
67
|
+
*/
|
|
68
|
+
source: "system" | "override";
|
|
69
|
+
/**
|
|
70
|
+
* The value (put only).
|
|
71
|
+
*/
|
|
72
|
+
value?: unknown;
|
|
73
|
+
/**
|
|
74
|
+
* The change's version.
|
|
75
|
+
*/
|
|
76
|
+
version: number;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* The shared draft; absent when there is none.
|
|
80
|
+
*/
|
|
81
|
+
export type DraftAnswer = {
|
|
82
|
+
draft?: TemplateDraft;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* An empty object.
|
|
86
|
+
*/
|
|
87
|
+
export type EmptyRequest = Record<string, never>;
|
|
88
|
+
export type ErrorResponse = {
|
|
89
|
+
/**
|
|
90
|
+
* Machine-readable error code (snake_case)
|
|
91
|
+
*/
|
|
92
|
+
error: string;
|
|
93
|
+
/**
|
|
94
|
+
* Human-readable explanation
|
|
95
|
+
*/
|
|
96
|
+
error_description: string;
|
|
97
|
+
/**
|
|
98
|
+
* Correlation ID
|
|
99
|
+
*/
|
|
100
|
+
request_id: string;
|
|
101
|
+
/**
|
|
102
|
+
* Seconds to wait before retrying, when the refusal ends with time.
|
|
103
|
+
*/
|
|
104
|
+
retry_after?: number;
|
|
105
|
+
/**
|
|
106
|
+
* HTTP status code
|
|
107
|
+
*/
|
|
108
|
+
status: number;
|
|
109
|
+
};
|
|
110
|
+
export type Evaluations = {
|
|
111
|
+
/**
|
|
112
|
+
* The buckets' size.
|
|
113
|
+
*/
|
|
114
|
+
bucket: "hour" | "day";
|
|
115
|
+
/**
|
|
116
|
+
* The flag asked for, or the 20 evaluated most, most first; none counted, none here.
|
|
117
|
+
*/
|
|
118
|
+
flags: FlagEvaluations[];
|
|
119
|
+
/**
|
|
120
|
+
* The reads per bucket, oldest first.
|
|
121
|
+
*/
|
|
122
|
+
reads: ReadsBucket[];
|
|
123
|
+
/**
|
|
124
|
+
* The first bucket's start, Unix milliseconds.
|
|
125
|
+
*/
|
|
126
|
+
since_ms: number;
|
|
127
|
+
/**
|
|
128
|
+
* The window read.
|
|
129
|
+
*/
|
|
130
|
+
window_seconds: number;
|
|
131
|
+
};
|
|
132
|
+
export type EvaluationsBucket = {
|
|
133
|
+
/**
|
|
134
|
+
* The bucket's start, Unix milliseconds.
|
|
135
|
+
*/
|
|
136
|
+
bucket_ms: number;
|
|
137
|
+
/**
|
|
138
|
+
* Counter: the evaluations.
|
|
139
|
+
*/
|
|
140
|
+
evaluations: number;
|
|
141
|
+
/**
|
|
142
|
+
* With flag: the value served, as the operation says, or other. Absent in a total.
|
|
143
|
+
*/
|
|
144
|
+
value?: string;
|
|
145
|
+
};
|
|
146
|
+
export type Flag = {
|
|
147
|
+
/**
|
|
148
|
+
* Targeting, in order, first match wins (8 at most).
|
|
149
|
+
*/
|
|
150
|
+
conditions: Condition[] | null;
|
|
151
|
+
/**
|
|
152
|
+
* When the flag was first defined.
|
|
153
|
+
*/
|
|
154
|
+
created_at: string;
|
|
155
|
+
/**
|
|
156
|
+
* What the flag is for.
|
|
157
|
+
*/
|
|
158
|
+
description: string;
|
|
159
|
+
/**
|
|
160
|
+
* The flag's key.
|
|
161
|
+
*/
|
|
162
|
+
key: string;
|
|
163
|
+
/**
|
|
164
|
+
* A Palbase-managed flag (palbase.*): its type is fixed and it is not deleted.
|
|
165
|
+
*/
|
|
166
|
+
managed: boolean;
|
|
167
|
+
/**
|
|
168
|
+
* Whether the flag may be targeted.
|
|
169
|
+
*/
|
|
170
|
+
supports_conditions: boolean;
|
|
171
|
+
/**
|
|
172
|
+
* When it last changed.
|
|
173
|
+
*/
|
|
174
|
+
updated_at: string;
|
|
175
|
+
/**
|
|
176
|
+
* The default: what every reader gets when no condition matches and they have no value of their own (8 KB at most).
|
|
177
|
+
*/
|
|
178
|
+
value: unknown;
|
|
179
|
+
/**
|
|
180
|
+
* What the flag's values are.
|
|
181
|
+
*/
|
|
182
|
+
value_type: "bool" | "number" | "string" | "object";
|
|
183
|
+
/**
|
|
184
|
+
* A string flag's allowed choices; every value — the default, the conditions', the users' — is one of them.
|
|
185
|
+
*/
|
|
186
|
+
variants: string[] | null;
|
|
187
|
+
/**
|
|
188
|
+
* The version of the flag's last change.
|
|
189
|
+
*/
|
|
190
|
+
version: number;
|
|
191
|
+
};
|
|
192
|
+
export type FlagDefinition = {
|
|
193
|
+
/**
|
|
194
|
+
* Targeting, in order, first match wins (8 at most).
|
|
195
|
+
*/
|
|
196
|
+
conditions?: Condition[] | null;
|
|
197
|
+
/**
|
|
198
|
+
* What the flag is for.
|
|
199
|
+
*/
|
|
200
|
+
description?: string;
|
|
201
|
+
/**
|
|
202
|
+
* The default: what every reader gets when no condition matches and they have no value of their own (8 KB at most).
|
|
203
|
+
*/
|
|
204
|
+
value: unknown;
|
|
205
|
+
/**
|
|
206
|
+
* What the flag's values are.
|
|
207
|
+
*/
|
|
208
|
+
value_type: "bool" | "number" | "string" | "object";
|
|
209
|
+
/**
|
|
210
|
+
* A string flag's allowed choices; every value — the default, the conditions', the users' — is one of them.
|
|
211
|
+
*/
|
|
212
|
+
variants?: string[] | null;
|
|
213
|
+
};
|
|
214
|
+
export type FlagEvaluations = {
|
|
215
|
+
/**
|
|
216
|
+
* The flag's key.
|
|
217
|
+
*/
|
|
218
|
+
key: string;
|
|
219
|
+
/**
|
|
220
|
+
* Per bucket, oldest first; with flag, per value within it, the most evaluated first.
|
|
221
|
+
*/
|
|
222
|
+
rows: EvaluationsBucket[];
|
|
223
|
+
/**
|
|
224
|
+
* Counter: its evaluations over the window.
|
|
225
|
+
*/
|
|
226
|
+
total: number;
|
|
227
|
+
};
|
|
228
|
+
/**
|
|
229
|
+
* The project's flags, by key.
|
|
230
|
+
*/
|
|
231
|
+
export type FlagList = Flag[];
|
|
232
|
+
export type FlagValues = {
|
|
233
|
+
/**
|
|
234
|
+
* When the answer was made.
|
|
235
|
+
*/
|
|
236
|
+
fetched_at: string;
|
|
237
|
+
/**
|
|
238
|
+
* Each flag's value, by key.
|
|
239
|
+
*/
|
|
240
|
+
values: {
|
|
241
|
+
[key: string]: unknown;
|
|
242
|
+
};
|
|
243
|
+
};
|
|
244
|
+
export type InstallationDistribution = {
|
|
245
|
+
/**
|
|
246
|
+
* By platform and app version.
|
|
247
|
+
*/
|
|
248
|
+
buckets: VersionBucket[];
|
|
249
|
+
/**
|
|
250
|
+
* Today's reads that named no installation.
|
|
251
|
+
*/
|
|
252
|
+
unidentified: number;
|
|
253
|
+
};
|
|
254
|
+
/**
|
|
255
|
+
* A refusal, or the draft's issues.
|
|
256
|
+
*/
|
|
257
|
+
export type PublishConflict = ErrorResponse | TemplateValidationFailed;
|
|
258
|
+
export type PublishRequest = {
|
|
259
|
+
/**
|
|
260
|
+
* Why (2048 characters at most).
|
|
261
|
+
*/
|
|
262
|
+
note?: string;
|
|
263
|
+
};
|
|
264
|
+
export type PublishResult = {
|
|
265
|
+
template: TemplateVersion;
|
|
266
|
+
/**
|
|
267
|
+
* The draft changed nothing; nothing was published.
|
|
268
|
+
*/
|
|
269
|
+
unchanged: boolean;
|
|
270
|
+
};
|
|
271
|
+
export type ReadsBucket = {
|
|
272
|
+
/**
|
|
273
|
+
* The bucket's start, Unix milliseconds.
|
|
274
|
+
*/
|
|
275
|
+
bucket_ms: number;
|
|
276
|
+
/**
|
|
277
|
+
* Counter: every read a client made, as it is metered — a snapshot, a delta, its values; answered, not modified or told to resync.
|
|
278
|
+
*/
|
|
279
|
+
reads: number;
|
|
280
|
+
/**
|
|
281
|
+
* Counter: of those reads, the snapshots that named no installation (X-Palbase-Installation), as a web app's.
|
|
282
|
+
*/
|
|
283
|
+
unidentified: number;
|
|
284
|
+
};
|
|
285
|
+
export type Snapshot = {
|
|
286
|
+
/**
|
|
287
|
+
* The hash of what the answer depends on besides the flags (client context, country, user, time conditions).
|
|
288
|
+
*/
|
|
289
|
+
context_hash: string;
|
|
290
|
+
/**
|
|
291
|
+
* When the answer was made.
|
|
292
|
+
*/
|
|
293
|
+
fetched_at: string;
|
|
294
|
+
/**
|
|
295
|
+
* Where each value came from: the flag (system) or the user's own (override).
|
|
296
|
+
*/
|
|
297
|
+
sources: {
|
|
298
|
+
[key: string]: "system" | "override";
|
|
299
|
+
};
|
|
300
|
+
/**
|
|
301
|
+
* The version the answer is current as of: the delta's since.
|
|
302
|
+
*/
|
|
303
|
+
sync_version: string;
|
|
304
|
+
/**
|
|
305
|
+
* Each flag's value, by key.
|
|
306
|
+
*/
|
|
307
|
+
values: {
|
|
308
|
+
[key: string]: unknown;
|
|
309
|
+
};
|
|
310
|
+
};
|
|
311
|
+
export type TemplateCapabilities = {
|
|
312
|
+
/**
|
|
313
|
+
* Publishing can be turned on.
|
|
314
|
+
*/
|
|
315
|
+
activation_available: boolean;
|
|
316
|
+
/**
|
|
317
|
+
* Publishing is on.
|
|
318
|
+
*/
|
|
319
|
+
publish_enabled: boolean;
|
|
320
|
+
};
|
|
321
|
+
export type TemplateChange = {
|
|
322
|
+
after?: FlagDefinition;
|
|
323
|
+
before?: FlagDefinition;
|
|
324
|
+
/**
|
|
325
|
+
* The fields that change.
|
|
326
|
+
*/
|
|
327
|
+
changed_fields: string[];
|
|
328
|
+
/**
|
|
329
|
+
* The parameter.
|
|
330
|
+
*/
|
|
331
|
+
key: string;
|
|
332
|
+
/**
|
|
333
|
+
* What the draft does to it.
|
|
334
|
+
*/
|
|
335
|
+
kind: "added" | "changed" | "removed";
|
|
336
|
+
/**
|
|
337
|
+
* Users' values of the parameter.
|
|
338
|
+
*/
|
|
339
|
+
override_count: number;
|
|
340
|
+
};
|
|
341
|
+
/**
|
|
342
|
+
* Every definition, by key.
|
|
343
|
+
*/
|
|
344
|
+
export type TemplateDocument = {
|
|
345
|
+
[key: string]: FlagDefinition;
|
|
346
|
+
};
|
|
347
|
+
export type TemplateDraft = {
|
|
348
|
+
/**
|
|
349
|
+
* The version it started from.
|
|
350
|
+
*/
|
|
351
|
+
base_version: string;
|
|
352
|
+
/**
|
|
353
|
+
* When it was started.
|
|
354
|
+
*/
|
|
355
|
+
created_at: string;
|
|
356
|
+
/**
|
|
357
|
+
* Who started it.
|
|
358
|
+
*/
|
|
359
|
+
created_by: string;
|
|
360
|
+
definitions: TemplateDocument;
|
|
361
|
+
/**
|
|
362
|
+
* The draft.
|
|
363
|
+
*/
|
|
364
|
+
id: string;
|
|
365
|
+
/**
|
|
366
|
+
* The version it restores.
|
|
367
|
+
*/
|
|
368
|
+
restored_from?: string;
|
|
369
|
+
/**
|
|
370
|
+
* Its revision: every write is the next.
|
|
371
|
+
*/
|
|
372
|
+
revision: string;
|
|
373
|
+
/**
|
|
374
|
+
* When it was last written.
|
|
375
|
+
*/
|
|
376
|
+
updated_at: string;
|
|
377
|
+
/**
|
|
378
|
+
* Who last wrote it.
|
|
379
|
+
*/
|
|
380
|
+
updated_by: string;
|
|
381
|
+
};
|
|
382
|
+
export type TemplateHistoryPage = {
|
|
383
|
+
/**
|
|
384
|
+
* The version in force.
|
|
385
|
+
*/
|
|
386
|
+
active_version: string;
|
|
387
|
+
/**
|
|
388
|
+
* Reads the next page; absent on the last.
|
|
389
|
+
*/
|
|
390
|
+
next_cursor?: string;
|
|
391
|
+
/**
|
|
392
|
+
* Newest first.
|
|
393
|
+
*/
|
|
394
|
+
versions: TemplateVersionSummary[];
|
|
395
|
+
};
|
|
396
|
+
export type TemplateIssue = {
|
|
397
|
+
/**
|
|
398
|
+
* The issue.
|
|
399
|
+
*/
|
|
400
|
+
code: string;
|
|
401
|
+
/**
|
|
402
|
+
* The parameter, when the issue is one's.
|
|
403
|
+
*/
|
|
404
|
+
key?: string;
|
|
405
|
+
/**
|
|
406
|
+
* What to do about it.
|
|
407
|
+
*/
|
|
408
|
+
message: string;
|
|
409
|
+
};
|
|
410
|
+
export type TemplateReview = {
|
|
411
|
+
/**
|
|
412
|
+
* The version in force.
|
|
413
|
+
*/
|
|
414
|
+
active_version: string;
|
|
415
|
+
/**
|
|
416
|
+
* The version it started from.
|
|
417
|
+
*/
|
|
418
|
+
base_version: string;
|
|
419
|
+
/**
|
|
420
|
+
* No issues.
|
|
421
|
+
*/
|
|
422
|
+
can_publish: boolean;
|
|
423
|
+
/**
|
|
424
|
+
* What changes.
|
|
425
|
+
*/
|
|
426
|
+
changes: TemplateChange[];
|
|
427
|
+
/**
|
|
428
|
+
* The draft.
|
|
429
|
+
*/
|
|
430
|
+
draft_id: string;
|
|
431
|
+
/**
|
|
432
|
+
* Its revision.
|
|
433
|
+
*/
|
|
434
|
+
draft_revision: string;
|
|
435
|
+
/**
|
|
436
|
+
* What keeps it from being published.
|
|
437
|
+
*/
|
|
438
|
+
issues: TemplateIssue[];
|
|
439
|
+
/**
|
|
440
|
+
* The version it restores.
|
|
441
|
+
*/
|
|
442
|
+
restored_from?: string;
|
|
443
|
+
};
|
|
444
|
+
export type TemplateValidationFailed = {
|
|
445
|
+
/**
|
|
446
|
+
* template_validation_failed
|
|
447
|
+
*/
|
|
448
|
+
error: string;
|
|
449
|
+
/**
|
|
450
|
+
* Human-readable explanation
|
|
451
|
+
*/
|
|
452
|
+
error_description: string;
|
|
453
|
+
/**
|
|
454
|
+
* What keeps the draft from being published.
|
|
455
|
+
*/
|
|
456
|
+
issues: TemplateIssue[];
|
|
457
|
+
/**
|
|
458
|
+
* Correlation ID
|
|
459
|
+
*/
|
|
460
|
+
request_id?: string;
|
|
461
|
+
/**
|
|
462
|
+
* HTTP status code
|
|
463
|
+
*/
|
|
464
|
+
status?: number;
|
|
465
|
+
};
|
|
466
|
+
export type TemplateVersion = {
|
|
467
|
+
/**
|
|
468
|
+
* Who published it.
|
|
469
|
+
*/
|
|
470
|
+
actor: string;
|
|
471
|
+
/**
|
|
472
|
+
* When it was published.
|
|
473
|
+
*/
|
|
474
|
+
created_at: string;
|
|
475
|
+
definitions: TemplateDocument;
|
|
476
|
+
/**
|
|
477
|
+
* baseline: what was live at activation; publish; restore.
|
|
478
|
+
*/
|
|
479
|
+
kind: "baseline" | "publish" | "restore";
|
|
480
|
+
/**
|
|
481
|
+
* The publication's note.
|
|
482
|
+
*/
|
|
483
|
+
note: string;
|
|
484
|
+
/**
|
|
485
|
+
* The version it followed.
|
|
486
|
+
*/
|
|
487
|
+
parent_version?: string;
|
|
488
|
+
/**
|
|
489
|
+
* The version it restored.
|
|
490
|
+
*/
|
|
491
|
+
restored_from?: string;
|
|
492
|
+
/**
|
|
493
|
+
* The version.
|
|
494
|
+
*/
|
|
495
|
+
version: string;
|
|
496
|
+
};
|
|
497
|
+
export type TemplateVersionSummary = {
|
|
498
|
+
/**
|
|
499
|
+
* Who published it.
|
|
500
|
+
*/
|
|
501
|
+
actor: string;
|
|
502
|
+
/**
|
|
503
|
+
* When it was published.
|
|
504
|
+
*/
|
|
505
|
+
created_at: string;
|
|
506
|
+
/**
|
|
507
|
+
* baseline, publish or restore.
|
|
508
|
+
*/
|
|
509
|
+
kind: "baseline" | "publish" | "restore";
|
|
510
|
+
/**
|
|
511
|
+
* The note.
|
|
512
|
+
*/
|
|
513
|
+
note: string;
|
|
514
|
+
/**
|
|
515
|
+
* The version it followed.
|
|
516
|
+
*/
|
|
517
|
+
parent_version?: string;
|
|
518
|
+
/**
|
|
519
|
+
* The version it restored.
|
|
520
|
+
*/
|
|
521
|
+
restored_from?: string;
|
|
522
|
+
/**
|
|
523
|
+
* The version.
|
|
524
|
+
*/
|
|
525
|
+
version: string;
|
|
526
|
+
};
|
|
527
|
+
export type UserValue = {
|
|
528
|
+
/**
|
|
529
|
+
* The user's value: the flag's type, inside its choices.
|
|
530
|
+
*/
|
|
531
|
+
value: unknown;
|
|
532
|
+
};
|
|
533
|
+
export type UserValueAnswer = {
|
|
534
|
+
/**
|
|
535
|
+
* The flag's key.
|
|
536
|
+
*/
|
|
537
|
+
key: string;
|
|
538
|
+
/**
|
|
539
|
+
* override: the user's own; system: the flag's, resolved for the user.
|
|
540
|
+
*/
|
|
541
|
+
source: "system" | "override";
|
|
542
|
+
/**
|
|
543
|
+
* The value.
|
|
544
|
+
*/
|
|
545
|
+
value: unknown;
|
|
546
|
+
};
|
|
547
|
+
export type UserValues = {
|
|
548
|
+
/**
|
|
549
|
+
* Each flag's value, by key.
|
|
550
|
+
*/
|
|
551
|
+
values?: {
|
|
552
|
+
[key: string]: unknown;
|
|
553
|
+
};
|
|
554
|
+
};
|
|
555
|
+
export type UserValuesBatch = {
|
|
556
|
+
/**
|
|
557
|
+
* 1000 at most.
|
|
558
|
+
*/
|
|
559
|
+
operations: UserValuesOperation[];
|
|
560
|
+
};
|
|
561
|
+
export type UserValuesOperation = {
|
|
562
|
+
/**
|
|
563
|
+
* The user's id.
|
|
564
|
+
*/
|
|
565
|
+
user_id: string;
|
|
566
|
+
/**
|
|
567
|
+
* Each flag's value, by key.
|
|
568
|
+
*/
|
|
569
|
+
values: {
|
|
570
|
+
[key: string]: unknown;
|
|
571
|
+
};
|
|
572
|
+
};
|
|
573
|
+
export type VersionBucket = {
|
|
574
|
+
/**
|
|
575
|
+
* The app version.
|
|
576
|
+
*/
|
|
577
|
+
app_version: string;
|
|
578
|
+
/**
|
|
579
|
+
* Installations.
|
|
580
|
+
*/
|
|
581
|
+
installations: number;
|
|
582
|
+
/**
|
|
583
|
+
* The platform.
|
|
584
|
+
*/
|
|
585
|
+
platform: string;
|
|
586
|
+
};
|
|
587
|
+
/** Palbase Flags */
|
|
588
|
+
export declare function client(t: Transport): {
|
|
589
|
+
/**
|
|
590
|
+
* Read the flags' values
|
|
591
|
+
*
|
|
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.
|
|
593
|
+
*/
|
|
594
|
+
getValues(input?: {
|
|
595
|
+
headers?: {
|
|
596
|
+
"X-Platform"?: string; /** The operating system's version (client.os_version). */
|
|
597
|
+
"X-OS-Version"?: string; /** The app's version (client.app_version). */
|
|
598
|
+
"X-Palbase-Client-Version"?: string; /** The client's languages; the first is client.locale. */
|
|
599
|
+
"Accept-Language"?: string;
|
|
600
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
601
|
+
signal?: AbortSignal;
|
|
602
|
+
}): Promise<Reply<200, FlagValues>>;
|
|
603
|
+
/**
|
|
604
|
+
* Set many users' values
|
|
605
|
+
*
|
|
606
|
+
* Sets values for many users at once (1000 operations at most): all of them, or none.
|
|
607
|
+
*/
|
|
608
|
+
batchUserValues(input: {
|
|
609
|
+
body: UserValuesBatch; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
610
|
+
signal?: AbortSignal;
|
|
611
|
+
}): Promise<Reply<200, BatchApplied>>;
|
|
612
|
+
/**
|
|
613
|
+
* Read what changed
|
|
614
|
+
*
|
|
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.
|
|
616
|
+
*/
|
|
617
|
+
getDelta(input?: {
|
|
618
|
+
query?: {
|
|
619
|
+
since?: number;
|
|
620
|
+
};
|
|
621
|
+
headers?: {
|
|
622
|
+
"If-None-Match"?: string; /** The client's platform (client.platform). */
|
|
623
|
+
"X-Platform"?: string; /** The operating system's version (client.os_version). */
|
|
624
|
+
"X-OS-Version"?: string; /** The app's version (client.app_version). */
|
|
625
|
+
"X-Palbase-Client-Version"?: string; /** The client's languages; the first is client.locale. */
|
|
626
|
+
"Accept-Language"?: string;
|
|
627
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
628
|
+
signal?: AbortSignal;
|
|
629
|
+
}): Promise<Reply<200, Delta> | Reply<304, undefined>>;
|
|
630
|
+
/**
|
|
631
|
+
* Read the reads and evaluations
|
|
632
|
+
*
|
|
633
|
+
* How often the project's client apps read its flags, and the value each flag's answers carried, per hour or per UTC day over a window: what the project's charts draw.
|
|
634
|
+
*
|
|
635
|
+
* An evaluation is a flag's value carried in an answer to a client app: each flag of a snapshot or a values read answered 200, and each flag a delta answered 200 leaves its client holding (the key's last op, when it is a put). Values are resolved on the server, so this is what was served; a client reusing a value it holds is not seen. A snapshot or a delta answered 304, a delta answered 410, and the project's server reading a user's values (`GET /flags/users/{user_id}`) carry none.
|
|
636
|
+
*
|
|
637
|
+
* Every number is a counter, summed over the module's replicas; none is a gauge. A bucket nothing was counted in is absent from `reads` and from a flag's `rows`: it is zero. Buckets start on the hour or at midnight UTC; the first is the one the window starts in (`since_ms`).
|
|
638
|
+
*
|
|
639
|
+
* With `flag`, that flag's evaluations per bucket and value. A value is the served value's JSON as it is kept (`true`, `"dark"`, `{"plan": "pro"}`); one longer than 128 bytes is cut, and `…` and 8 hex characters of its SHA-256 follow the cut. A bucket counts its first 10 values by name and any further one as `other`, which no JSON text is; an answer names at most 10 per bucket, the most evaluated. Without `flag`, the 20 flags evaluated most over the window, each with its total per bucket.
|
|
640
|
+
*
|
|
641
|
+
* Counts are written every minute: the last one may not be in yet, and a replica that stops without its last write loses at most that minute. Kept: hourly evaluations 15 days, daily evaluations and the hourly reads 91 — `bucket=hour` reads up to 14 days back, `bucket=day` up to 90.
|
|
642
|
+
*/
|
|
643
|
+
getEvaluations(input?: {
|
|
644
|
+
query?: {
|
|
645
|
+
window_seconds?: number; /** hour, or day (UTC) (hour). */
|
|
646
|
+
bucket?: "hour" | "day"; /** A flag's key: its evaluations by value. Without it, the 20 flags evaluated most, with their totals. */
|
|
647
|
+
flag?: string;
|
|
648
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
649
|
+
signal?: AbortSignal;
|
|
650
|
+
}): Promise<Reply<200, Evaluations>>;
|
|
651
|
+
/**
|
|
652
|
+
* Read the builds in use
|
|
653
|
+
*
|
|
654
|
+
* The installations that read their flags in the last day, by platform and app version, and the reads that named no installation today.
|
|
655
|
+
*/
|
|
656
|
+
getCurrentInstallations(input?: {
|
|
657
|
+
signal?: AbortSignal;
|
|
658
|
+
}): Promise<Reply<200, InstallationDistribution>>;
|
|
659
|
+
/**
|
|
660
|
+
* Read the adoption curve
|
|
661
|
+
*
|
|
662
|
+
* Installations per day, platform and app version, for the last days (kept 90).
|
|
663
|
+
*/
|
|
664
|
+
getInstallationsDaily(input?: {
|
|
665
|
+
query?: {
|
|
666
|
+
days?: number;
|
|
667
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
668
|
+
signal?: AbortSignal;
|
|
669
|
+
}): Promise<Reply<200, AdoptionCurve>>;
|
|
670
|
+
/**
|
|
671
|
+
* Take a snapshot
|
|
672
|
+
*
|
|
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).
|
|
674
|
+
*/
|
|
675
|
+
getSnapshot(input?: {
|
|
676
|
+
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). */
|
|
679
|
+
"X-Platform"?: string; /** The operating system's version (client.os_version). */
|
|
680
|
+
"X-OS-Version"?: string; /** The app's version (client.app_version). */
|
|
681
|
+
"X-Palbase-Client-Version"?: string; /** The client's languages; the first is client.locale. */
|
|
682
|
+
"Accept-Language"?: string;
|
|
683
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
684
|
+
signal?: AbortSignal;
|
|
685
|
+
}): Promise<Reply<200, Snapshot> | Reply<304, undefined>>;
|
|
686
|
+
/**
|
|
687
|
+
* List the flags
|
|
688
|
+
*
|
|
689
|
+
* Every flag the project defines (200 at most), by key.
|
|
690
|
+
*/
|
|
691
|
+
listDefinitions(input?: {
|
|
692
|
+
signal?: AbortSignal;
|
|
693
|
+
}): Promise<Reply<200, FlagList>>;
|
|
694
|
+
/**
|
|
695
|
+
* Read a flag
|
|
696
|
+
*
|
|
697
|
+
* One flag's definition.
|
|
698
|
+
*/
|
|
699
|
+
getDefinition(input: {
|
|
700
|
+
path: {
|
|
701
|
+
key: string;
|
|
702
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
703
|
+
signal?: AbortSignal;
|
|
704
|
+
}): Promise<Reply<200, Flag>>;
|
|
705
|
+
/**
|
|
706
|
+
* Define a flag
|
|
707
|
+
*
|
|
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>).
|
|
709
|
+
*/
|
|
710
|
+
putDefinition(input: {
|
|
711
|
+
path: {
|
|
712
|
+
key: string;
|
|
713
|
+
};
|
|
714
|
+
body: FlagDefinition; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
715
|
+
signal?: AbortSignal;
|
|
716
|
+
}): Promise<Reply<200, Flag>>;
|
|
717
|
+
/**
|
|
718
|
+
* Delete a flag
|
|
719
|
+
*
|
|
720
|
+
* Deletes a flag and every user's value of it; a client syncing is told. A Palbase-managed flag is not deleted.
|
|
721
|
+
*/
|
|
722
|
+
deleteDefinition(input: {
|
|
723
|
+
path: {
|
|
724
|
+
key: string;
|
|
725
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
726
|
+
signal?: AbortSignal;
|
|
727
|
+
}): Promise<Reply<204, undefined>>;
|
|
728
|
+
/**
|
|
729
|
+
* Turn publishing on
|
|
730
|
+
*
|
|
731
|
+
* Turns publishing on, one way: the live flags become version 1, and from then on definitions change only through a published draft (a direct write is refused, 409 publish_required). Turning it on again answers the active version.
|
|
732
|
+
*/
|
|
733
|
+
activateTemplates(input: {
|
|
734
|
+
body: EmptyRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
735
|
+
signal?: AbortSignal;
|
|
736
|
+
}): Promise<Reply<200, TemplateVersion>>;
|
|
737
|
+
/**
|
|
738
|
+
* Read the active version
|
|
739
|
+
*
|
|
740
|
+
* The version in force, with every definition.
|
|
741
|
+
*/
|
|
742
|
+
getActiveTemplate(input?: {
|
|
743
|
+
signal?: AbortSignal;
|
|
744
|
+
}): Promise<Reply<200, TemplateVersion>>;
|
|
745
|
+
/**
|
|
746
|
+
* Read the publishing state
|
|
747
|
+
*
|
|
748
|
+
* Whether publishing is on, and whether it can be turned on.
|
|
749
|
+
*/
|
|
750
|
+
getTemplateCapabilities(input?: {
|
|
751
|
+
signal?: AbortSignal;
|
|
752
|
+
}): Promise<Reply<200, TemplateCapabilities>>;
|
|
753
|
+
/**
|
|
754
|
+
* Read the draft
|
|
755
|
+
*
|
|
756
|
+
* The project's shared draft, or none.
|
|
757
|
+
*/
|
|
758
|
+
getTemplateDraft(input?: {
|
|
759
|
+
signal?: AbortSignal;
|
|
760
|
+
}): Promise<Reply<200, DraftAnswer>>;
|
|
761
|
+
/**
|
|
762
|
+
* Start a draft
|
|
763
|
+
*
|
|
764
|
+
* Starts the shared draft from the active version named in If-Match.
|
|
765
|
+
*/
|
|
766
|
+
createTemplateDraft(input: {
|
|
767
|
+
headers: {
|
|
768
|
+
"If-Match": string;
|
|
769
|
+
};
|
|
770
|
+
body: EmptyRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
771
|
+
signal?: AbortSignal;
|
|
772
|
+
}): Promise<Reply<201, DraftAnswer>>;
|
|
773
|
+
/**
|
|
774
|
+
* Discard the draft
|
|
775
|
+
*
|
|
776
|
+
* Discards the draft named in If-Match.
|
|
777
|
+
*/
|
|
778
|
+
discardTemplateDraft(input: {
|
|
779
|
+
headers: {
|
|
780
|
+
"If-Match": string;
|
|
781
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
782
|
+
signal?: AbortSignal;
|
|
783
|
+
}): Promise<Reply<204, undefined>>;
|
|
784
|
+
/**
|
|
785
|
+
* Write a draft parameter
|
|
786
|
+
*
|
|
787
|
+
* Writes one parameter of the draft named in If-Match (the next revision); validated as a definition is.
|
|
788
|
+
*/
|
|
789
|
+
putTemplateParameter(input: {
|
|
790
|
+
path: {
|
|
791
|
+
key: string;
|
|
792
|
+
};
|
|
793
|
+
headers: {
|
|
794
|
+
"If-Match": string;
|
|
795
|
+
};
|
|
796
|
+
body: FlagDefinition; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
797
|
+
signal?: AbortSignal;
|
|
798
|
+
}): Promise<Reply<200, DraftAnswer>>;
|
|
799
|
+
/**
|
|
800
|
+
* Remove a draft parameter
|
|
801
|
+
*
|
|
802
|
+
* Removes one parameter of the draft named in If-Match. A Palbase-managed one stays.
|
|
803
|
+
*/
|
|
804
|
+
removeTemplateParameter(input: {
|
|
805
|
+
path: {
|
|
806
|
+
key: string;
|
|
807
|
+
};
|
|
808
|
+
headers: {
|
|
809
|
+
"If-Match": string;
|
|
810
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
811
|
+
signal?: AbortSignal;
|
|
812
|
+
}): Promise<Reply<200, DraftAnswer>>;
|
|
813
|
+
/**
|
|
814
|
+
* Review the draft
|
|
815
|
+
*
|
|
816
|
+
* What publishing the draft would do: each change against the active version, how many users' values each touches, and the issues that keep it from being published.
|
|
817
|
+
*/
|
|
818
|
+
reviewTemplateDraft(input?: {
|
|
819
|
+
signal?: AbortSignal;
|
|
820
|
+
}): Promise<Reply<200, TemplateReview>>;
|
|
821
|
+
/**
|
|
822
|
+
* Publish the draft
|
|
823
|
+
*
|
|
824
|
+
* Publishes the draft named in If-Match: its definitions become the live ones and the next version in one transaction, and every reader is told. The same Idempotency-Key answers the first publication again; an unchanged draft publishes nothing. A draft with issues is refused (409 template_validation_failed) with the issues.
|
|
825
|
+
*/
|
|
826
|
+
publishTemplate(input: {
|
|
827
|
+
headers: {
|
|
828
|
+
"If-Match": string; /** One publication's key: the same key answers its first publication again (1 to 128 printable ASCII). */
|
|
829
|
+
"Idempotency-Key": string;
|
|
830
|
+
};
|
|
831
|
+
body: PublishRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
832
|
+
signal?: AbortSignal;
|
|
833
|
+
}): Promise<Reply<200, PublishResult>>;
|
|
834
|
+
/**
|
|
835
|
+
* Read a publication's receipt
|
|
836
|
+
*
|
|
837
|
+
* A publication's committed answer, by the same draft, key and note — for a client that lost the response.
|
|
838
|
+
*/
|
|
839
|
+
getPublishReceipt(input: {
|
|
840
|
+
headers: {
|
|
841
|
+
"If-Match": string; /** One publication's key: the same key answers its first publication again (1 to 128 printable ASCII). */
|
|
842
|
+
"Idempotency-Key": string;
|
|
843
|
+
};
|
|
844
|
+
body: PublishRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
845
|
+
signal?: AbortSignal;
|
|
846
|
+
}): Promise<Reply<200, PublishResult>>;
|
|
847
|
+
/**
|
|
848
|
+
* Restore a version
|
|
849
|
+
*
|
|
850
|
+
* Starts the shared draft from an earlier version, expecting the active version named in If-Match; published, it becomes the next version.
|
|
851
|
+
*/
|
|
852
|
+
restoreTemplateVersion(input: {
|
|
853
|
+
path: {
|
|
854
|
+
version: string;
|
|
855
|
+
};
|
|
856
|
+
headers: {
|
|
857
|
+
"If-Match": string;
|
|
858
|
+
};
|
|
859
|
+
body: EmptyRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
860
|
+
signal?: AbortSignal;
|
|
861
|
+
}): Promise<Reply<201, DraftAnswer>>;
|
|
862
|
+
/**
|
|
863
|
+
* List the versions
|
|
864
|
+
*
|
|
865
|
+
* The published versions, newest first, paged.
|
|
866
|
+
*/
|
|
867
|
+
listTemplateVersions(input?: {
|
|
868
|
+
query?: {
|
|
869
|
+
limit?: number; /** A next_cursor this list answered. */
|
|
870
|
+
cursor?: string;
|
|
871
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
872
|
+
signal?: AbortSignal;
|
|
873
|
+
}): Promise<Reply<200, TemplateHistoryPage>>;
|
|
874
|
+
/**
|
|
875
|
+
* Read a version
|
|
876
|
+
*
|
|
877
|
+
* One published version, with every definition.
|
|
878
|
+
*/
|
|
879
|
+
getTemplateVersion(input: {
|
|
880
|
+
path: {
|
|
881
|
+
version: string;
|
|
882
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
883
|
+
signal?: AbortSignal;
|
|
884
|
+
}): Promise<Reply<200, TemplateVersion>>;
|
|
885
|
+
/**
|
|
886
|
+
* Read a user's values
|
|
887
|
+
*
|
|
888
|
+
* Every flag's value for one user, as their client would read it (percentiles are the user's; the client context is this request's).
|
|
889
|
+
*/
|
|
890
|
+
getUserValues(input: {
|
|
891
|
+
path: {
|
|
892
|
+
user_id: string;
|
|
893
|
+
};
|
|
894
|
+
headers?: {
|
|
895
|
+
"X-Platform"?: string; /** The operating system's version (client.os_version). */
|
|
896
|
+
"X-OS-Version"?: string; /** The app's version (client.app_version). */
|
|
897
|
+
"X-Palbase-Client-Version"?: string; /** The client's languages; the first is client.locale. */
|
|
898
|
+
"Accept-Language"?: string;
|
|
899
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
900
|
+
signal?: AbortSignal;
|
|
901
|
+
}): Promise<Reply<200, FlagValues>>;
|
|
902
|
+
/**
|
|
903
|
+
* Set a user's values
|
|
904
|
+
*
|
|
905
|
+
* Gives one user their own values for flags (1000 at most), each checked against its flag's type and choices. The user's readers are told (flags:<ref>:<user_id>).
|
|
906
|
+
*/
|
|
907
|
+
putUserValues(input: {
|
|
908
|
+
path: {
|
|
909
|
+
user_id: string;
|
|
910
|
+
};
|
|
911
|
+
body: UserValues; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
912
|
+
signal?: AbortSignal;
|
|
913
|
+
}): Promise<Reply<200, UserValues>>;
|
|
914
|
+
/**
|
|
915
|
+
* Remove a user's values
|
|
916
|
+
*
|
|
917
|
+
* Removes every value of the user's own; their flags resolve as anyone's again.
|
|
918
|
+
*/
|
|
919
|
+
deleteUserValues(input: {
|
|
920
|
+
path: {
|
|
921
|
+
user_id: string;
|
|
922
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
923
|
+
signal?: AbortSignal;
|
|
924
|
+
}): Promise<Reply<200, DeletedCount>>;
|
|
925
|
+
/**
|
|
926
|
+
* Set a user's value
|
|
927
|
+
*
|
|
928
|
+
* Gives one user their own value for a flag, checked against its type and choices.
|
|
929
|
+
*/
|
|
930
|
+
putUserValue(input: {
|
|
931
|
+
path: {
|
|
932
|
+
user_id: string; /** The flag's key: dot-separated segments of a letter then letters, digits and underscores; 128 characters at most. */
|
|
933
|
+
key: string;
|
|
934
|
+
};
|
|
935
|
+
body: UserValue; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
936
|
+
signal?: AbortSignal;
|
|
937
|
+
}): Promise<Reply<200, UserValueAnswer>>;
|
|
938
|
+
/**
|
|
939
|
+
* Remove a user's value
|
|
940
|
+
*
|
|
941
|
+
* Removes the user's own value for a flag; the answer is what resolves for them now.
|
|
942
|
+
*/
|
|
943
|
+
deleteUserValue(input: {
|
|
944
|
+
path: {
|
|
945
|
+
user_id: string; /** The flag's key: dot-separated segments of a letter then letters, digits and underscores; 128 characters at most. */
|
|
946
|
+
key: string;
|
|
947
|
+
};
|
|
948
|
+
headers?: {
|
|
949
|
+
"X-Platform"?: string; /** The operating system's version (client.os_version). */
|
|
950
|
+
"X-OS-Version"?: string; /** The app's version (client.app_version). */
|
|
951
|
+
"X-Palbase-Client-Version"?: string; /** The client's languages; the first is client.locale. */
|
|
952
|
+
"Accept-Language"?: string;
|
|
953
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
954
|
+
signal?: AbortSignal;
|
|
955
|
+
}): Promise<Reply<200, UserValueAnswer>>;
|
|
956
|
+
};
|
|
957
|
+
export type Client = ReturnType<typeof client>;
|