palbase 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/index.js +2 -2
- package/dist/backend/engine.js +2 -2
- package/dist/backend/env.js +1 -1
- package/dist/backend/index.js +10 -10
- package/dist/backend/stack.js +1 -1
- package/dist/backend/test.js +2 -2
- package/dist/chunks/{IVDNNHII.js → 2GGJKIKT.js} +2 -2
- package/dist/chunks/{BJL2FT5W.js → 2S5VK2PA.js} +1 -1
- package/dist/chunks/{ZFX4BFQR.js → 6SXSYK4S.js} +2 -2
- package/dist/chunks/{3OIKIBMG.js → 73WBTWOK.js} +2 -2
- package/dist/chunks/{UNTTPATW.js → ABBUC5HE.js} +1 -1
- package/dist/chunks/{SUNHFMDO.js → C627JALV.js} +2 -2
- package/dist/chunks/{6JO3UVPT.js → CC36MKWZ.js} +2 -2
- package/dist/chunks/{TRHIZOIS.js → COCND66P.js} +3 -3
- package/dist/chunks/{ODFLUINN.js → FEHN6AHI.js} +1 -1
- package/dist/chunks/{BHT2IHBE.js → GUR3A4M7.js} +2 -2
- package/dist/chunks/HNMC2RJ7.js +20 -0
- package/dist/chunks/{RKNVSAGY.js → IOIQM4QO.js} +1 -1
- package/dist/chunks/{CY6B75KF.js → OROMWNJD.js} +2 -2
- package/dist/chunks/{FS222NNP.js → R5BCF2YW.js} +2 -2
- package/dist/chunks/{ST2NZ4TZ.js → RBUTW6OM.js} +1 -1
- package/dist/chunks/{2AT72FFB.js → RQFK2F3Q.js} +2 -2
- package/dist/cli.js +129 -125
- package/dist/refuse/ai.js +1 -1
- package/dist/refuse/backend.js +1 -1
- package/dist/refuse/server.js +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/testing.js +2 -2
- package/dist/web/index.js +2 -2
- package/dist/web/palbe.js +2 -2
- package/dist/web/paywall.js +2 -2
- package/dist/web/vite.js +2 -2
- package/package.json +2 -2
- package/types/backend/src/container.d.ts +4 -2
- package/types/backend/src/decorators.d.ts +32 -17
- package/types/backend/src/engine.d.ts +9 -4
- package/types/backend/src/env.d.ts +1 -1
- package/types/backend/src/index.d.ts +2 -1
- package/types/backend/src/tasks.d.ts +168 -0
- package/types/internal/src/modules/auth.d.ts +64 -47
- package/types/internal/src/modules/machines.d.ts +320 -79
- package/types/internal/src/modules/notify.d.ts +3 -3
- package/types/internal/src/modules/purchases.d.ts +562 -3
- package/types/internal/src/modules/storage.d.ts +31 -2
- package/types/web/src/client.d.ts +7 -0
- package/types/web/src/paywall/placement.d.ts +2 -0
- package/types/web/src/purchases.d.ts +3 -1
- package/dist/chunks/EGRDFD5C.js +0 -20
|
@@ -797,6 +797,28 @@ export type AppleWebCredentials = {
|
|
|
797
797
|
export type ApproveRecoveryRequest = {
|
|
798
798
|
token: string;
|
|
799
799
|
};
|
|
800
|
+
export type AssetLinkStatement = {
|
|
801
|
+
/**
|
|
802
|
+
* `delegate_permission/common.get_login_creds`
|
|
803
|
+
*/
|
|
804
|
+
relation: string[];
|
|
805
|
+
target: AssetLinkTarget;
|
|
806
|
+
};
|
|
807
|
+
export type AssetLinkTarget = {
|
|
808
|
+
namespace: "android_app";
|
|
809
|
+
/**
|
|
810
|
+
* The app's application ID
|
|
811
|
+
*/
|
|
812
|
+
package_name: string;
|
|
813
|
+
/**
|
|
814
|
+
* The SHA-256 of each certificate the app is signed with, as Play Console prints it
|
|
815
|
+
*/
|
|
816
|
+
sha256_cert_fingerprints: string[];
|
|
817
|
+
};
|
|
818
|
+
/**
|
|
819
|
+
* Digital Asset Links statements, one per Android app with a signing certificate.
|
|
820
|
+
*/
|
|
821
|
+
export type AssetLinks = AssetLinkStatement[];
|
|
800
822
|
/**
|
|
801
823
|
* One request's App Attest evidence and the request it claims to be bound to.
|
|
802
824
|
*/
|
|
@@ -1428,6 +1450,10 @@ export type ErrorResponse = {
|
|
|
1428
1450
|
* Human-readable explanation
|
|
1429
1451
|
*/
|
|
1430
1452
|
error_description: string;
|
|
1453
|
+
/**
|
|
1454
|
+
* On a refused configuration (invalid_auth_config): each field refused, by its JSON Pointer in the request body, and why.
|
|
1455
|
+
*/
|
|
1456
|
+
field_errors?: FieldError[];
|
|
1431
1457
|
/**
|
|
1432
1458
|
* Correlation ID for log/audit lookup
|
|
1433
1459
|
*/
|
|
@@ -1444,6 +1470,19 @@ export type ErrorResponse = {
|
|
|
1444
1470
|
export type ExchangeCustomTokenRequest = {
|
|
1445
1471
|
custom_token: string;
|
|
1446
1472
|
};
|
|
1473
|
+
/**
|
|
1474
|
+
* A field the request body was refused for.
|
|
1475
|
+
*/
|
|
1476
|
+
export type FieldError = {
|
|
1477
|
+
/**
|
|
1478
|
+
* Why the field was refused.
|
|
1479
|
+
*/
|
|
1480
|
+
message: string;
|
|
1481
|
+
/**
|
|
1482
|
+
* The field, as a JSON Pointer into the request body (/providers/google/client_id).
|
|
1483
|
+
*/
|
|
1484
|
+
pointer: string;
|
|
1485
|
+
};
|
|
1447
1486
|
export type ForbiddenOrPowRequired = PowRequiredResponse | ErrorResponse;
|
|
1448
1487
|
/**
|
|
1449
1488
|
* A blocking hook: for its before.* event, auth calls the URL and waits for the verdict.
|
|
@@ -2078,6 +2117,31 @@ export type OIDCDiscovery = {
|
|
|
2078
2117
|
token_endpoint_auth_signing_alg_values_supported?: string[];
|
|
2079
2118
|
userinfo_endpoint: string;
|
|
2080
2119
|
};
|
|
2120
|
+
/**
|
|
2121
|
+
* Where the page sends the browser: the CLI's listener, with the one-time code and the state. The CLI redeems the code at /oauth/token with its verifier and the same redirect_uri.
|
|
2122
|
+
*/
|
|
2123
|
+
export type OwnerCLICode = {
|
|
2124
|
+
redirect_to: string;
|
|
2125
|
+
expires_in: number;
|
|
2126
|
+
};
|
|
2127
|
+
/**
|
|
2128
|
+
* The CLI's PKCE challenge (RFC 7636 §4.2).
|
|
2129
|
+
*/
|
|
2130
|
+
export type OwnerCLICodeRequest = {
|
|
2131
|
+
/**
|
|
2132
|
+
* base64url of the SHA-256 of the CLI's verifier
|
|
2133
|
+
*/
|
|
2134
|
+
code_challenge: string;
|
|
2135
|
+
code_challenge_method: "S256";
|
|
2136
|
+
/**
|
|
2137
|
+
* The CLI's listener (RFC 8252 §7.3): a loopback IP literal and a port from 1024 to 65535.
|
|
2138
|
+
*/
|
|
2139
|
+
redirect_uri: string;
|
|
2140
|
+
/**
|
|
2141
|
+
* The CLI's state, sent back to its listener.
|
|
2142
|
+
*/
|
|
2143
|
+
state: string;
|
|
2144
|
+
};
|
|
2081
2145
|
/**
|
|
2082
2146
|
* Form-encoded RFC 9126 PAR parameters. Additional fields are passed through to the AS.
|
|
2083
2147
|
*/
|
|
@@ -3371,53 +3435,6 @@ export type WebAuthnSignupBeginResponse = {
|
|
|
3371
3435
|
*/
|
|
3372
3436
|
user_id: string;
|
|
3373
3437
|
};
|
|
3374
|
-
/**
|
|
3375
|
-
* The CLI's PKCE challenge (RFC 7636 §4.2).
|
|
3376
|
-
*/
|
|
3377
|
-
export type OwnerCLICodeRequest = {
|
|
3378
|
-
/**
|
|
3379
|
-
* base64url of the SHA-256 of the CLI's verifier
|
|
3380
|
-
*/
|
|
3381
|
-
code_challenge: string;
|
|
3382
|
-
code_challenge_method: "S256";
|
|
3383
|
-
/**
|
|
3384
|
-
* The CLI's listener (RFC 8252 §7.3): a loopback IP literal and a port from 1024 to 65535.
|
|
3385
|
-
*/
|
|
3386
|
-
redirect_uri: string;
|
|
3387
|
-
/**
|
|
3388
|
-
* The CLI's state, sent back to its listener.
|
|
3389
|
-
*/
|
|
3390
|
-
state: string;
|
|
3391
|
-
};
|
|
3392
|
-
/**
|
|
3393
|
-
* Where the page sends the browser: the CLI's listener, with the one-time code and the state. The CLI redeems the code at /oauth/token with its verifier and the same redirect_uri.
|
|
3394
|
-
*/
|
|
3395
|
-
export type OwnerCLICode = {
|
|
3396
|
-
redirect_to: string;
|
|
3397
|
-
expires_in: number;
|
|
3398
|
-
};
|
|
3399
|
-
/**
|
|
3400
|
-
* Digital Asset Links statements, one per Android app with a signing certificate.
|
|
3401
|
-
*/
|
|
3402
|
-
export type AssetLinks = AssetLinkStatement[];
|
|
3403
|
-
export type AssetLinkStatement = {
|
|
3404
|
-
/**
|
|
3405
|
-
* `delegate_permission/common.get_login_creds`
|
|
3406
|
-
*/
|
|
3407
|
-
relation: string[];
|
|
3408
|
-
target: AssetLinkTarget;
|
|
3409
|
-
};
|
|
3410
|
-
export type AssetLinkTarget = {
|
|
3411
|
-
namespace: "android_app";
|
|
3412
|
-
/**
|
|
3413
|
-
* The app's application ID
|
|
3414
|
-
*/
|
|
3415
|
-
package_name: string;
|
|
3416
|
-
/**
|
|
3417
|
-
* The SHA-256 of each certificate the app is signed with, as Play Console prints it
|
|
3418
|
-
*/
|
|
3419
|
-
sha256_cert_fingerprints: string[];
|
|
3420
|
-
};
|
|
3421
3438
|
/** Palbase Auth API */
|
|
3422
3439
|
export declare function client(t: Transport): {
|
|
3423
3440
|
/**
|
|
@@ -580,62 +580,6 @@ export type DatabaseCredentials = {
|
|
|
580
580
|
owner: DatabaseLogin;
|
|
581
581
|
app: DatabaseLogin;
|
|
582
582
|
};
|
|
583
|
-
/**
|
|
584
|
-
* A job the machine's program says it runs on a schedule. The platform calls it when it is due — POST /_palbase/jobs/<name> on the machine's own port, with {"job","run_id","scheduled_at","attempt"}, signed as a webhook is (Palbase-Signature) with the key in the machine's PALBASE_PLATFORM_SECRET — waking the machine for it; of a machine's copies one is called. A program says its jobs at GET /_palbase/jobs (asked once each version comes up); nothing from outside reaches /_palbase/ on a machine. One run of a job at a time: a job due again while its last run is not over is skipped. A 2xx answer is done, 404 is no such job in this version, anything else — or no answer within its timeout — is an attempt that failed, made again after 10 s, 20 s, … five minutes at most.
|
|
585
|
-
*/
|
|
586
|
-
export type Job = {
|
|
587
|
-
name: string;
|
|
588
|
-
/**
|
|
589
|
-
* Five fields, as cron's: minute hour day-of-month month day-of-week, in UTC.
|
|
590
|
-
*/
|
|
591
|
-
schedule: string;
|
|
592
|
-
/**
|
|
593
|
-
* How long an attempt has, in seconds.
|
|
594
|
-
*/
|
|
595
|
-
timeout: number;
|
|
596
|
-
/**
|
|
597
|
-
* How many more attempts a run has after its first fails.
|
|
598
|
-
*/
|
|
599
|
-
retries: number;
|
|
600
|
-
/**
|
|
601
|
-
* When it is next due.
|
|
602
|
-
*/
|
|
603
|
-
next_at: string;
|
|
604
|
-
last_run?: JobRun;
|
|
605
|
-
};
|
|
606
|
-
/**
|
|
607
|
-
* One run of a job: the same run (id, the program's run_id) through every attempt it took.
|
|
608
|
-
*/
|
|
609
|
-
export type JobRun = {
|
|
610
|
-
id: string;
|
|
611
|
-
/**
|
|
612
|
-
* When it was due.
|
|
613
|
-
*/
|
|
614
|
-
scheduled_at: string;
|
|
615
|
-
/**
|
|
616
|
-
* running: an attempt is with the machine; waiting: its last attempt failed and another is due; succeeded; failed: no attempt left; skipped: not run — its last run was not over, or the machine's version has no such job (reason).
|
|
617
|
-
*/
|
|
618
|
-
state: "running" | "waiting" | "succeeded" | "failed" | "skipped";
|
|
619
|
-
attempt: number;
|
|
620
|
-
/**
|
|
621
|
-
* Why an attempt failed, or why the run was skipped.
|
|
622
|
-
*/
|
|
623
|
-
reason?: string;
|
|
624
|
-
started_at: string;
|
|
625
|
-
finished_at?: string;
|
|
626
|
-
};
|
|
627
|
-
/**
|
|
628
|
-
* A machine's jobs, as its running version said them, by name.
|
|
629
|
-
*/
|
|
630
|
-
export type JobList = {
|
|
631
|
-
jobs: Job[];
|
|
632
|
-
};
|
|
633
|
-
/**
|
|
634
|
-
* A job's latest runs (50 at most), newest first; runs are kept for 7 days.
|
|
635
|
-
*/
|
|
636
|
-
export type JobRunList = {
|
|
637
|
-
runs: JobRun[];
|
|
638
|
-
};
|
|
639
583
|
/**
|
|
640
584
|
* One line a machine wrote — a line of the NDJSON answer of GET /machines/{name}/logs.
|
|
641
585
|
*/
|
|
@@ -1169,6 +1113,191 @@ export type DatabaseSizeList = {
|
|
|
1169
1113
|
*/
|
|
1170
1114
|
sizes: DatabaseSize[];
|
|
1171
1115
|
};
|
|
1116
|
+
/**
|
|
1117
|
+
* One run of a cron: the same run (id, the program's run_id) through every attempt it took.
|
|
1118
|
+
*/
|
|
1119
|
+
export type CronRun = {
|
|
1120
|
+
id: string;
|
|
1121
|
+
/**
|
|
1122
|
+
* When it was due.
|
|
1123
|
+
*/
|
|
1124
|
+
scheduled_at: string;
|
|
1125
|
+
/**
|
|
1126
|
+
* running: an attempt is with the machine; waiting: its next attempt is due (a run asked for now waits for its first); succeeded; failed: no attempt left; skipped: not run — its last run was not over, the project runs no machine now, or the machine's version has no such cron (reason).
|
|
1127
|
+
*/
|
|
1128
|
+
state: "running" | "waiting" | "succeeded" | "failed" | "skipped";
|
|
1129
|
+
attempt: number;
|
|
1130
|
+
/**
|
|
1131
|
+
* Why an attempt failed, or why the run was skipped.
|
|
1132
|
+
*/
|
|
1133
|
+
reason?: string;
|
|
1134
|
+
/**
|
|
1135
|
+
* Asked for there and then (run now), not made by the schedule.
|
|
1136
|
+
*/
|
|
1137
|
+
manual: boolean;
|
|
1138
|
+
started_at: string;
|
|
1139
|
+
finished_at?: string;
|
|
1140
|
+
};
|
|
1141
|
+
/**
|
|
1142
|
+
* A cron the machine's program says it runs on a schedule (an @Cron of its app). The platform calls it when it is due — POST /_palbase/crons/<name> on the machine's own port, with {"cron","run_id","scheduled_at","attempt"}, signed as a webhook is (Palbase-Signature) with the key in the machine's PALBASE_PLATFORM_SECRET — waking the machine for it; of a machine's copies one is called. A program says its crons at GET /_palbase/crons (asked once each version comes up); nothing from outside reaches /_palbase/ on a machine. One run of a cron at a time: a cron due again while its last run is not over is skipped. A 2xx answer is done, 404 is no such cron in this version, anything else — or no answer within its timeout — is an attempt that failed, made again after 10 s, 20 s, … five minutes at most.
|
|
1143
|
+
*/
|
|
1144
|
+
export type Cron = {
|
|
1145
|
+
name: string;
|
|
1146
|
+
/**
|
|
1147
|
+
* Five fields, as cron's: minute hour day-of-month month day-of-week, on the clocks of time_zone. Where they change, a time they skip is not run and a time they show twice is run the first time only.
|
|
1148
|
+
*/
|
|
1149
|
+
schedule: string;
|
|
1150
|
+
/**
|
|
1151
|
+
* The IANA time zone whose clocks the schedule is on (UTC unless the cron names one).
|
|
1152
|
+
*/
|
|
1153
|
+
time_zone: string;
|
|
1154
|
+
/**
|
|
1155
|
+
* How long an attempt has, in seconds.
|
|
1156
|
+
*/
|
|
1157
|
+
timeout: number;
|
|
1158
|
+
/**
|
|
1159
|
+
* How many more attempts a run has after its first fails.
|
|
1160
|
+
*/
|
|
1161
|
+
retries: number;
|
|
1162
|
+
/**
|
|
1163
|
+
* When it is next due (while paused: when it was, before it was paused).
|
|
1164
|
+
*/
|
|
1165
|
+
next_at: string;
|
|
1166
|
+
/**
|
|
1167
|
+
* Not run until it is resumed, whatever version of the machine comes up meanwhile.
|
|
1168
|
+
*/
|
|
1169
|
+
paused: boolean;
|
|
1170
|
+
/**
|
|
1171
|
+
* When it was paused.
|
|
1172
|
+
*/
|
|
1173
|
+
paused_at?: string;
|
|
1174
|
+
last_run?: CronRun;
|
|
1175
|
+
};
|
|
1176
|
+
/**
|
|
1177
|
+
* A machine's crons, as its running version said them, by name.
|
|
1178
|
+
*/
|
|
1179
|
+
export type CronList = {
|
|
1180
|
+
crons: Cron[];
|
|
1181
|
+
};
|
|
1182
|
+
/**
|
|
1183
|
+
* A cron's latest runs (50 at most), newest first; runs are kept for 7 days.
|
|
1184
|
+
*/
|
|
1185
|
+
export type CronRunList = {
|
|
1186
|
+
runs: CronRun[];
|
|
1187
|
+
};
|
|
1188
|
+
/**
|
|
1189
|
+
* A task on a machine's queue: the same task (id) through every attempt it takes.
|
|
1190
|
+
*/
|
|
1191
|
+
export type Task = {
|
|
1192
|
+
id: string;
|
|
1193
|
+
/**
|
|
1194
|
+
* Its task type: the @Task of the machine's app that does it.
|
|
1195
|
+
*/
|
|
1196
|
+
task: string;
|
|
1197
|
+
/**
|
|
1198
|
+
* waiting: due at run_at (its first attempt, or the next after one that failed); running: an attempt is with the machine; succeeded; failed: no attempt left, or the program said it can never be done (reason); cancelled: taken off the queue before it ran.
|
|
1199
|
+
*/
|
|
1200
|
+
state: "waiting" | "running" | "succeeded" | "failed" | "cancelled";
|
|
1201
|
+
/**
|
|
1202
|
+
* The attempts made — counted on, not from zero, when the task is tried again by hand.
|
|
1203
|
+
*/
|
|
1204
|
+
attempt: number;
|
|
1205
|
+
/**
|
|
1206
|
+
* The attempt after which it has none left (its type's retries, more when tried again by hand).
|
|
1207
|
+
*/
|
|
1208
|
+
retries: number;
|
|
1209
|
+
/**
|
|
1210
|
+
* How long an attempt has, in seconds.
|
|
1211
|
+
*/
|
|
1212
|
+
timeout: number;
|
|
1213
|
+
/**
|
|
1214
|
+
* When it is due (waiting), or was last.
|
|
1215
|
+
*/
|
|
1216
|
+
run_at: string;
|
|
1217
|
+
/**
|
|
1218
|
+
* What it was put under: no second task of its type is put under it until a day after it is over.
|
|
1219
|
+
*/
|
|
1220
|
+
key?: string;
|
|
1221
|
+
/**
|
|
1222
|
+
* Why its last attempt failed, or why it is over without succeeding.
|
|
1223
|
+
*/
|
|
1224
|
+
reason?: string;
|
|
1225
|
+
created_at: string;
|
|
1226
|
+
/**
|
|
1227
|
+
* When its first attempt was made.
|
|
1228
|
+
*/
|
|
1229
|
+
started_at?: string;
|
|
1230
|
+
finished_at?: string;
|
|
1231
|
+
/**
|
|
1232
|
+
* What it carries (any JSON value, the bytes it was given): in a task read by its id, and in the answer to putting it — none once it succeeded or was cancelled (only a task that may be tried again keeps it).
|
|
1233
|
+
*/
|
|
1234
|
+
payload?: unknown;
|
|
1235
|
+
};
|
|
1236
|
+
/**
|
|
1237
|
+
* A page of a machine's tasks, newest first.
|
|
1238
|
+
*/
|
|
1239
|
+
export type TaskPage = {
|
|
1240
|
+
tasks: Task[];
|
|
1241
|
+
/**
|
|
1242
|
+
* The cursor of the next page; none on the last.
|
|
1243
|
+
*/
|
|
1244
|
+
next_cursor?: string;
|
|
1245
|
+
};
|
|
1246
|
+
/**
|
|
1247
|
+
* A task to put on the machine's queue.
|
|
1248
|
+
*/
|
|
1249
|
+
export type TaskWrite = {
|
|
1250
|
+
/**
|
|
1251
|
+
* The task type: one the machine's running version declares.
|
|
1252
|
+
*/
|
|
1253
|
+
task: string;
|
|
1254
|
+
/**
|
|
1255
|
+
* What it carries (any JSON value, 64 KiB at most, with no NUL in its strings): name what it works on, and read it where it runs.
|
|
1256
|
+
*/
|
|
1257
|
+
payload?: unknown;
|
|
1258
|
+
/**
|
|
1259
|
+
* Due this many seconds from now (30 days at most). Not with run_at.
|
|
1260
|
+
*/
|
|
1261
|
+
delay?: number;
|
|
1262
|
+
/**
|
|
1263
|
+
* Due at this time (30 days from now at most; a time past is now). Not with delay.
|
|
1264
|
+
*/
|
|
1265
|
+
run_at?: string;
|
|
1266
|
+
/**
|
|
1267
|
+
* Put once under this key: another task of its type under the same key, while the first is held (until a day after it is over), is not put — the answer is the first.
|
|
1268
|
+
*/
|
|
1269
|
+
key?: string;
|
|
1270
|
+
};
|
|
1271
|
+
/**
|
|
1272
|
+
* A task type the machine's running version declares, with what its queue holds.
|
|
1273
|
+
*/
|
|
1274
|
+
export type TaskType = {
|
|
1275
|
+
name: string;
|
|
1276
|
+
/**
|
|
1277
|
+
* How long an attempt has, in seconds.
|
|
1278
|
+
*/
|
|
1279
|
+
timeout: number;
|
|
1280
|
+
/**
|
|
1281
|
+
* How many more attempts a task has after its first fails.
|
|
1282
|
+
*/
|
|
1283
|
+
retries: number;
|
|
1284
|
+
/**
|
|
1285
|
+
* How many of its tasks are with the machine at once, whatever the number of its copies.
|
|
1286
|
+
*/
|
|
1287
|
+
concurrency: number;
|
|
1288
|
+
waiting: number;
|
|
1289
|
+
running: number;
|
|
1290
|
+
/**
|
|
1291
|
+
* Its tasks that failed and are kept (30 days).
|
|
1292
|
+
*/
|
|
1293
|
+
failed: number;
|
|
1294
|
+
};
|
|
1295
|
+
/**
|
|
1296
|
+
* A machine's task types, by name.
|
|
1297
|
+
*/
|
|
1298
|
+
export type TaskTypeList = {
|
|
1299
|
+
types: TaskType[];
|
|
1300
|
+
};
|
|
1172
1301
|
/** Palbase Machines */
|
|
1173
1302
|
export declare function client(t: Transport): {
|
|
1174
1303
|
/**
|
|
@@ -1459,29 +1588,6 @@ export declare function client(t: Transport): {
|
|
|
1459
1588
|
body: PasswordChange; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1460
1589
|
signal?: AbortSignal;
|
|
1461
1590
|
}): Promise<Reply<200, DatabaseCredentials>>;
|
|
1462
|
-
/**
|
|
1463
|
-
* List a machine's jobs
|
|
1464
|
-
*
|
|
1465
|
-
* The jobs the machine's running version says it runs on a schedule, each with when it is next due and its latest run.
|
|
1466
|
-
*/
|
|
1467
|
-
listJobs(input: {
|
|
1468
|
-
path: {
|
|
1469
|
-
name: string;
|
|
1470
|
-
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1471
|
-
signal?: AbortSignal;
|
|
1472
|
-
}): Promise<Reply<200, JobList>>;
|
|
1473
|
-
/**
|
|
1474
|
-
* List a job's runs
|
|
1475
|
-
*
|
|
1476
|
-
* A job's latest runs, newest first, with the attempts each took and why one failed or was skipped.
|
|
1477
|
-
*/
|
|
1478
|
-
listJobRuns(input: {
|
|
1479
|
-
path: {
|
|
1480
|
-
name: string; /** The job's name. */
|
|
1481
|
-
job: string;
|
|
1482
|
-
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1483
|
-
signal?: AbortSignal;
|
|
1484
|
-
}): Promise<Reply<200, JobRunList>>;
|
|
1485
1591
|
/**
|
|
1486
1592
|
* Read what a machine wrote
|
|
1487
1593
|
*
|
|
@@ -1580,5 +1686,140 @@ export declare function client(t: Transport): {
|
|
|
1580
1686
|
body: DatabaseQuery; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1581
1687
|
signal?: AbortSignal;
|
|
1582
1688
|
}): Promise<Reply<200, DatabaseQueryResult>>;
|
|
1689
|
+
/**
|
|
1690
|
+
* List a machine's crons
|
|
1691
|
+
*
|
|
1692
|
+
* The crons the machine's running version says it runs on a schedule (its app's @Cron classes), each with when it is next due, whether it is paused, and its latest run.
|
|
1693
|
+
*/
|
|
1694
|
+
listCrons(input: {
|
|
1695
|
+
path: {
|
|
1696
|
+
name: string;
|
|
1697
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1698
|
+
signal?: AbortSignal;
|
|
1699
|
+
}): Promise<Reply<200, CronList>>;
|
|
1700
|
+
/**
|
|
1701
|
+
* List a cron's runs
|
|
1702
|
+
*
|
|
1703
|
+
* A cron's latest runs, newest first.
|
|
1704
|
+
*/
|
|
1705
|
+
listCronRuns(input: {
|
|
1706
|
+
path: {
|
|
1707
|
+
name: string; /** The cron's name, as the machine's program declares it: letters, digits, ., _ and -, 64 at most. */
|
|
1708
|
+
cron: string;
|
|
1709
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1710
|
+
signal?: AbortSignal;
|
|
1711
|
+
}): Promise<Reply<200, CronRunList>>;
|
|
1712
|
+
/**
|
|
1713
|
+
* Run a cron now
|
|
1714
|
+
*
|
|
1715
|
+
* Runs the cron now, apart from its schedule: a run of it (manual) that waits for its first attempt, made within seconds — the machine woken for it if asleep. 409 while a run of it is not over; 429 when the project's machine time for the period is used up.
|
|
1716
|
+
*/
|
|
1717
|
+
runCron(input: {
|
|
1718
|
+
path: {
|
|
1719
|
+
name: string; /** The cron's name, as the machine's program declares it: letters, digits, ., _ and -, 64 at most. */
|
|
1720
|
+
cron: string;
|
|
1721
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1722
|
+
signal?: AbortSignal;
|
|
1723
|
+
}): Promise<Reply<201, CronRun>>;
|
|
1724
|
+
/**
|
|
1725
|
+
* Pause a cron
|
|
1726
|
+
*
|
|
1727
|
+
* Pauses the cron: it is not run until it is resumed, whatever version of the machine comes up meanwhile. A run of it already begun goes on. Pausing one paused changes nothing.
|
|
1728
|
+
*/
|
|
1729
|
+
pauseCron(input: {
|
|
1730
|
+
path: {
|
|
1731
|
+
name: string; /** The cron's name, as the machine's program declares it: letters, digits, ., _ and -, 64 at most. */
|
|
1732
|
+
cron: string;
|
|
1733
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1734
|
+
signal?: AbortSignal;
|
|
1735
|
+
}): Promise<Reply<200, Cron>>;
|
|
1736
|
+
/**
|
|
1737
|
+
* Resume a cron
|
|
1738
|
+
*
|
|
1739
|
+
* Resumes a paused cron: it is due at its next time from now — the times it missed while paused are not made up. Resuming one not paused changes nothing.
|
|
1740
|
+
*/
|
|
1741
|
+
resumeCron(input: {
|
|
1742
|
+
path: {
|
|
1743
|
+
name: string; /** The cron's name, as the machine's program declares it: letters, digits, ., _ and -, 64 at most. */
|
|
1744
|
+
cron: string;
|
|
1745
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1746
|
+
signal?: AbortSignal;
|
|
1747
|
+
}): Promise<Reply<200, Cron>>;
|
|
1748
|
+
/**
|
|
1749
|
+
* List a machine's tasks
|
|
1750
|
+
*
|
|
1751
|
+
* A page of the machine's tasks, newest first: of one state and one task type, or all. A task that succeeded or was cancelled is kept a day, one that failed 30.
|
|
1752
|
+
*/
|
|
1753
|
+
listTasks(input: {
|
|
1754
|
+
path: {
|
|
1755
|
+
name: string;
|
|
1756
|
+
};
|
|
1757
|
+
query?: {
|
|
1758
|
+
state?: "waiting" | "running" | "succeeded" | "failed" | "cancelled"; /** Only tasks of this task type. */
|
|
1759
|
+
task?: string; /** The most tasks a page holds (50 when not given). */
|
|
1760
|
+
limit?: number; /** The next_cursor of the page before. */
|
|
1761
|
+
cursor?: string;
|
|
1762
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1763
|
+
signal?: AbortSignal;
|
|
1764
|
+
}): Promise<Reply<200, TaskPage>>;
|
|
1765
|
+
/**
|
|
1766
|
+
* Put a task on a machine's queue
|
|
1767
|
+
*
|
|
1768
|
+
* Puts a task of one of the machine's task types (its app's @Task classes, as its running version declares them) on its queue, due now, after a delay or at a time — 30 days ahead at most. The platform calls the machine's program for it when it is due — POST /_palbase/tasks/<task> on the machine's own port, with {"task","id","attempt","payload","created_at"}, signed as a cron's call is — waking the machine for it; a 2xx is the task done, 422 is the program saying it can never be done (it fails, with no attempt more), anything else — or no answer within its timeout — an attempt that failed, made again after 10 s, 20 s, … an hour at most, as often as its type's retries allow. A task is delivered at least once: its id is the same through its attempts. A key puts it once: another under the same key, while the first is held (until a day after it is over), answers 200 with the first. 404 when the machine's running version has no task of that name; 413 when the payload is over 64 KiB; 429 when the project's machine time for the period is used up (quota_exceeded) or its queues hold 100,000 tasks not yet done or 256 MiB of what the tasks kept carry (queue_full). The payload is kept as the bytes it was given, and sent to the machine as they are.
|
|
1769
|
+
*/
|
|
1770
|
+
enqueueTask(input: {
|
|
1771
|
+
path: {
|
|
1772
|
+
name: string;
|
|
1773
|
+
};
|
|
1774
|
+
body: TaskWrite; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1775
|
+
signal?: AbortSignal;
|
|
1776
|
+
}): Promise<Reply<200, Task> | Reply<201, Task>>;
|
|
1777
|
+
/**
|
|
1778
|
+
* Read a task
|
|
1779
|
+
*
|
|
1780
|
+
* One of the machine's tasks, with its payload.
|
|
1781
|
+
*/
|
|
1782
|
+
getTask(input: {
|
|
1783
|
+
path: {
|
|
1784
|
+
name: string; /** The task's id. */
|
|
1785
|
+
task: string;
|
|
1786
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1787
|
+
signal?: AbortSignal;
|
|
1788
|
+
}): Promise<Reply<200, Task>>;
|
|
1789
|
+
/**
|
|
1790
|
+
* Cancel a task
|
|
1791
|
+
*
|
|
1792
|
+
* Takes a task that is waiting off the queue, letting go of what it carries: it is not run, nor tried again (cancelled). 409 for one with the machine, or over.
|
|
1793
|
+
*/
|
|
1794
|
+
cancelTask(input: {
|
|
1795
|
+
path: {
|
|
1796
|
+
name: string; /** The task's id. */
|
|
1797
|
+
task: string;
|
|
1798
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1799
|
+
signal?: AbortSignal;
|
|
1800
|
+
}): Promise<Reply<200, Task>>;
|
|
1801
|
+
/**
|
|
1802
|
+
* Try a task again
|
|
1803
|
+
*
|
|
1804
|
+
* Puts a task that failed back on the queue, due now, with as many attempts again as its type gives a task — counted on from its last, so no attempt of it is numbered twice. 409 for a task that has not failed; 429 when the project's machine time for the period is used up, or its queues are full.
|
|
1805
|
+
*/
|
|
1806
|
+
retryTask(input: {
|
|
1807
|
+
path: {
|
|
1808
|
+
name: string; /** The task's id. */
|
|
1809
|
+
task: string;
|
|
1810
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1811
|
+
signal?: AbortSignal;
|
|
1812
|
+
}): Promise<Reply<200, Task>>;
|
|
1813
|
+
/**
|
|
1814
|
+
* List a machine's task types
|
|
1815
|
+
*
|
|
1816
|
+
* The task types the machine's running version declares (its app's @Task classes), each with what its queue holds.
|
|
1817
|
+
*/
|
|
1818
|
+
listTaskTypes(input: {
|
|
1819
|
+
path: {
|
|
1820
|
+
name: string;
|
|
1821
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1822
|
+
signal?: AbortSignal;
|
|
1823
|
+
}): Promise<Reply<200, TaskTypeList>>;
|
|
1583
1824
|
};
|
|
1584
1825
|
export type Client = ReturnType<typeof client>;
|
|
@@ -192,12 +192,12 @@ export type EmailTemplateSummary = {
|
|
|
192
192
|
variables: string[];
|
|
193
193
|
};
|
|
194
194
|
/**
|
|
195
|
-
* A template override.
|
|
195
|
+
* A template override. Its subject, and an HTML body, a text body or both: a template with neither is refused (422).
|
|
196
196
|
*/
|
|
197
197
|
export type EmailTemplateWrite = {
|
|
198
|
-
html_body
|
|
198
|
+
html_body?: string;
|
|
199
199
|
subject: string;
|
|
200
|
-
text_body
|
|
200
|
+
text_body?: string;
|
|
201
201
|
};
|
|
202
202
|
export type ErrorResponse = {
|
|
203
203
|
/**
|