palbase 0.4.0 → 0.5.1
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 +10 -10
- package/dist/backend/engine.js +2 -2
- package/dist/backend/env.js +1 -1
- package/dist/backend/index.js +8 -8
- package/dist/backend/stack.js +1 -1
- package/dist/backend/test.js +2 -2
- package/dist/chunks/{TRHIZOIS.js → 32RCJNOH.js} +3 -3
- package/dist/chunks/{BJL2FT5W.js → 3AUBDHV2.js} +1 -1
- package/dist/chunks/{IVDNNHII.js → 7BA7LGEM.js} +2 -2
- package/dist/chunks/A7EL6JKQ.js +20 -0
- package/dist/chunks/AWHTWL65.js +2 -0
- package/dist/chunks/{2AT72FFB.js → B45UFKBR.js} +2 -2
- package/dist/chunks/{ST2NZ4TZ.js → DNHDO6AJ.js} +1 -1
- package/dist/chunks/{BHT2IHBE.js → EHJKMDP3.js} +2 -2
- package/dist/chunks/{3OIKIBMG.js → FSXD7MN3.js} +2 -2
- package/dist/chunks/{SUNHFMDO.js → KSJ6AMCG.js} +2 -2
- package/dist/chunks/PALOWH6U.js +6 -0
- package/dist/chunks/{RKNVSAGY.js → PFSUOVTB.js} +1 -1
- package/dist/chunks/{6JO3UVPT.js → QIN2NQPN.js} +2 -2
- package/dist/chunks/{FS222NNP.js → R43DXJZE.js} +2 -2
- package/dist/chunks/{ODFLUINN.js → TTZRGQWF.js} +1 -1
- package/dist/chunks/{UNTTPATW.js → ZXYDN6NA.js} +1 -1
- package/dist/cli.js +133 -129
- 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/ai/src/ai.d.ts +20 -2
- package/types/ai/src/chats.d.ts +75 -1
- package/types/ai/src/index.d.ts +2 -2
- package/types/ai/src/tools.d.ts +35 -0
- package/types/backend/src/channels.d.ts +81 -0
- 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 +12 -4
- package/types/backend/src/env.d.ts +1 -1
- package/types/backend/src/index.d.ts +4 -2
- package/types/backend/src/openapi.d.ts +3 -0
- package/types/backend/src/rooms.d.ts +10 -0
- package/types/backend/src/tasks.d.ts +168 -0
- package/types/internal/src/chat.d.ts +17 -1
- package/types/internal/src/modules/ai.d.ts +314 -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 +32 -3
- package/types/web/src/ai.d.ts +25 -2
- package/types/web/src/client.d.ts +7 -0
- package/types/web/src/index.d.ts +1 -1
- package/types/web/src/paywall/placement.d.ts +2 -0
- package/types/web/src/purchases.d.ts +3 -1
- package/dist/chunks/CY6B75KF.js +0 -6
- package/dist/chunks/EGRDFD5C.js +0 -20
- package/dist/chunks/ZFX4BFQR.js +0 -2
|
@@ -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
|
/**
|