@lumavox/server 0.2.1 → 0.4.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/README.md +21 -16
- package/dist/errors.d.ts +24 -16
- package/dist/errors.js +21 -40
- package/dist/gen/index.d.ts +1 -1
- package/dist/gen/types.gen.d.ts +1767 -1750
- package/dist/index.d.ts +2 -1
- package/dist/paging.d.ts +19 -29
- package/dist/paging.js +17 -32
- package/dist/resources/agents.d.ts +10 -5
- package/dist/resources/agents.js +9 -3
- package/dist/resources/assets.d.ts +14 -9
- package/dist/resources/assets.js +16 -11
- package/dist/resources/end-users.d.ts +25 -18
- package/dist/resources/end-users.js +47 -43
- package/dist/resources/ephemeral-keys.d.ts +9 -9
- package/dist/resources/ephemeral-keys.js +9 -12
- package/dist/resources/generations.d.ts +3 -3
- package/dist/resources/generations.js +3 -7
- package/dist/resources/knowledge.d.ts +11 -12
- package/dist/resources/knowledge.js +8 -13
- package/dist/resources/resource.d.ts +12 -22
- package/dist/resources/resource.js +21 -4
- package/dist/resources/speech.d.ts +10 -21
- package/dist/resources/speech.js +4 -4
- package/dist/resources/templates.d.ts +4 -2
- package/dist/resources/templates.js +5 -1
- package/dist/resources/usage.d.ts +2 -2
- package/dist/resources/voices.d.ts +8 -6
- package/dist/resources/voices.js +8 -6
- package/dist/transport.d.ts +7 -3
- package/dist/transport.js +40 -19
- package/dist/upload.d.ts +7 -5
- package/dist/upload.js +8 -2
- package/dist/wait.d.ts +5 -9
- package/dist/wait.js +3 -3
- package/package.json +1 -1
package/dist/upload.d.ts
CHANGED
|
@@ -6,9 +6,11 @@
|
|
|
6
6
|
*
|
|
7
7
|
* - **The `PUT` carries no credential** — the URL is signed — and exactly
|
|
8
8
|
* the `Content-Type` the ticket was asked for, which is signed into it.
|
|
9
|
-
* - **Its timer
|
|
10
|
-
* URL is refused after it anyway, and a large file on a slow
|
|
11
|
-
* a call that timed out at the client's 30 s — and then sent
|
|
9
|
+
* - **Its timer runs to the ticket's `expires_at`** unless the caller sets
|
|
10
|
+
* one: the URL is refused after it anyway, and a large file on a slow
|
|
11
|
+
* link is not a call that timed out at the client's 30 s — and then sent
|
|
12
|
+
* twice more. A minute at least: the instant is the API's clock, and a
|
|
13
|
+
* machine whose clock runs ahead would otherwise time out at once.
|
|
12
14
|
* - **A Blob, an ArrayBuffer or a typed array; a stream only with its
|
|
13
15
|
* `size`**: a signed `PUT` needs `Content-Length`, which a stream cannot
|
|
14
16
|
* say. On Workers the stream goes through `FixedLengthStream`, which is
|
|
@@ -30,8 +32,8 @@ export declare const sizeOf: (data: UploadData, size?: number) => number | undef
|
|
|
30
32
|
export declare const typeOf: (data: UploadData, type?: string | null) => string;
|
|
31
33
|
/** `type`, or a `TypeError` naming what to pass. */
|
|
32
34
|
export declare function needType(data: UploadData, type?: string | null): string;
|
|
33
|
-
/** The bytes, to a ticket's signed URL, valid
|
|
35
|
+
/** The bytes, to a ticket's signed URL, valid until its `expires_at`. */
|
|
34
36
|
export declare function put(api: Transport, ticket: {
|
|
35
37
|
url: string;
|
|
36
|
-
|
|
38
|
+
expires_at: string;
|
|
37
39
|
}, data: UploadData, type: string, options: UploadOptions): Promise<void>;
|
package/dist/upload.js
CHANGED
|
@@ -14,7 +14,9 @@ export function needType(data, type) {
|
|
|
14
14
|
throw new TypeError("This upload needs its content_type.");
|
|
15
15
|
return found;
|
|
16
16
|
}
|
|
17
|
-
/** The
|
|
17
|
+
/** The least time a `PUT` is given, whatever the ticket's clock says. */
|
|
18
|
+
const MIN_PUT_MS = 60_000;
|
|
19
|
+
/** The bytes, to a ticket's signed URL, valid until its `expires_at`. */
|
|
18
20
|
export async function put(api, ticket, data, type, options) {
|
|
19
21
|
let raw = data;
|
|
20
22
|
const headers = {};
|
|
@@ -30,5 +32,9 @@ export async function put(api, ticket, data, type, options) {
|
|
|
30
32
|
if (Fixed)
|
|
31
33
|
raw = data.pipeThrough(new Fixed(size));
|
|
32
34
|
}
|
|
33
|
-
await api.request({ method: "PUT", path: ticket.url, raw, type, headers, open: true }, {
|
|
35
|
+
await api.request({ method: "PUT", path: ticket.url, raw, type, headers, open: true }, {
|
|
36
|
+
...options,
|
|
37
|
+
timeoutMs: options.timeoutMs ??
|
|
38
|
+
Math.max(Date.parse(ticket.expires_at) - Date.now(), MIN_PUT_MS),
|
|
39
|
+
});
|
|
34
40
|
}
|
package/dist/wait.d.ts
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
*
|
|
7
7
|
* - **One set of in-progress states for every kind**: a generation is
|
|
8
8
|
* `queued`, `submitted` or `running`, the rest `pending`, and a
|
|
9
|
-
* knowledge file or page `importing` before that
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* knowledge file or page `importing` before that (`STATUSES` in
|
|
10
|
+
* `apps/api/src/knowledge/service.ts`), which the document lists only
|
|
11
|
+
* since api 0.31.10. Anything else — `succeeded`,
|
|
12
12
|
* `failed`, `moderated`, `ready`, or a state this release does not know
|
|
13
13
|
* — ends the wait, so a new one cannot hang a caller.
|
|
14
14
|
* - **It answers the last read, never throws for a failure**: a `failed`
|
|
@@ -27,13 +27,9 @@
|
|
|
27
27
|
* the root `CLAUDE.md`; in their first second, 250 are.
|
|
28
28
|
*/
|
|
29
29
|
import { type RequestOptions } from "./transport.js";
|
|
30
|
-
/**
|
|
31
|
-
* A job as each kind's read answers it: with a `status` — which the
|
|
32
|
-
* document lets an asset and an entry leave out (it has a default), and
|
|
33
|
-
* which, absent, is no work in progress.
|
|
34
|
-
*/
|
|
30
|
+
/** A job as each kind's read answers it: with its `status`. */
|
|
35
31
|
export interface Job {
|
|
36
|
-
status
|
|
32
|
+
status: string;
|
|
37
33
|
}
|
|
38
34
|
/**
|
|
39
35
|
* Reads `read` until its status is final, starting from `first` (a job
|
package/dist/wait.js
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
*
|
|
7
7
|
* - **One set of in-progress states for every kind**: a generation is
|
|
8
8
|
* `queued`, `submitted` or `running`, the rest `pending`, and a
|
|
9
|
-
* knowledge file or page `importing` before that
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* knowledge file or page `importing` before that (`STATUSES` in
|
|
10
|
+
* `apps/api/src/knowledge/service.ts`), which the document lists only
|
|
11
|
+
* since api 0.31.10. Anything else — `succeeded`,
|
|
12
12
|
* `failed`, `moderated`, `ready`, or a state this release does not know
|
|
13
13
|
* — ends the wait, so a new one cannot hang a caller.
|
|
14
14
|
* - **It answers the last read, never throws for a failure**: a `failed`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lumavox/server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "The Lumavox API from your server: end users, ephemeral keys and the rest, typed from the published OpenAPI document. Zero dependencies.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|