@read-frog/api-contract 0.26.0 → 0.27.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/index.d.ts +407 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/contracts/speech.ts +20 -0
- package/src/schemas/speech.ts +23 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@read-frog/api-contract",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@orpc/contract": "^1.16.1",
|
|
28
|
-
"@read-frog/definitions": "0.
|
|
28
|
+
"@read-frog/definitions": "0.15.0",
|
|
29
29
|
"zod": "^4.6.7"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
package/src/contracts/speech.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { oc } from "@orpc/contract";
|
|
2
|
+
import { z } from "zod";
|
|
2
3
|
import {
|
|
4
|
+
speechDeleteAllAudioOutputSchema,
|
|
5
|
+
speechDeleteAudioInputSchema,
|
|
3
6
|
speechPreferencesSchema,
|
|
4
7
|
speechPreferencesUpdateInputSchema,
|
|
5
8
|
speechSynthesizeInputSchema,
|
|
@@ -42,4 +45,21 @@ export const speechContract = {
|
|
|
42
45
|
})
|
|
43
46
|
.input(speechSynthesizeInputSchema)
|
|
44
47
|
.output(speechSynthesizeOutputSchema),
|
|
48
|
+
deleteAudio: oc
|
|
49
|
+
.route({
|
|
50
|
+
method: "POST",
|
|
51
|
+
path: "/speech/audio/delete",
|
|
52
|
+
summary: "Forget the audio kept for some texts, so each is read anew next time",
|
|
53
|
+
tags: ["Speech"],
|
|
54
|
+
})
|
|
55
|
+
.input(speechDeleteAudioInputSchema)
|
|
56
|
+
.output(z.void()),
|
|
57
|
+
deleteAllAudio: oc
|
|
58
|
+
.route({
|
|
59
|
+
method: "DELETE",
|
|
60
|
+
path: "/speech/audio",
|
|
61
|
+
summary: "Forget all the audio kept for the authenticated user's texts",
|
|
62
|
+
tags: ["Speech"],
|
|
63
|
+
})
|
|
64
|
+
.output(speechDeleteAllAudioOutputSchema),
|
|
45
65
|
};
|
package/src/schemas/speech.ts
CHANGED
|
@@ -109,6 +109,29 @@ export const speechSynthesizeInputSchema = z
|
|
|
109
109
|
.strict();
|
|
110
110
|
export type SpeechSynthesizeInput = z.infer<typeof speechSynthesizeInputSchema>;
|
|
111
111
|
|
|
112
|
+
/** The most texts one request forgets the audio of. */
|
|
113
|
+
export const SPEECH_DELETE_AUDIO_MAX_TEXTS = 50;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Texts whose kept audio to forget, each as it is asked to be read aloud
|
|
117
|
+
* (`speech.synthesize`): the next time one is, it is read anew. Audio for a
|
|
118
|
+
* text that has none kept is no error.
|
|
119
|
+
*/
|
|
120
|
+
export const speechDeleteAudioInputSchema = z
|
|
121
|
+
.object({
|
|
122
|
+
texts: z.array(speechSynthesizeInputSchema).min(1).max(SPEECH_DELETE_AUDIO_MAX_TEXTS),
|
|
123
|
+
})
|
|
124
|
+
.strict();
|
|
125
|
+
export type SpeechDeleteAudioInput = z.infer<typeof speechDeleteAudioInputSchema>;
|
|
126
|
+
|
|
127
|
+
export const speechDeleteAllAudioOutputSchema = z
|
|
128
|
+
.object({
|
|
129
|
+
// How many audio files there were.
|
|
130
|
+
deleted: z.number().int().nonnegative(),
|
|
131
|
+
})
|
|
132
|
+
.strict();
|
|
133
|
+
export type SpeechDeleteAllAudioOutput = z.infer<typeof speechDeleteAllAudioOutputSchema>;
|
|
134
|
+
|
|
112
135
|
/**
|
|
113
136
|
* Where to download the audio, an MP3: a link to fetch at once, which stops
|
|
114
137
|
* working at `expiresAt`.
|