@read-frog/api-contract 0.12.6 → 0.15.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 +1171 -480
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +301 -103
- package/dist/index.js.map +1 -1
- package/package.json +15 -14
- package/src/contracts/beta-access.ts +3 -6
- package/src/contracts/billing.ts +5 -5
- package/src/contracts/card-template.ts +45 -39
- package/src/contracts/card.ts +22 -19
- package/src/contracts/ebook.ts +13 -11
- package/src/contracts/hosted-ai.ts +5 -5
- package/src/contracts/notebase-column.ts +40 -32
- package/src/contracts/notebase-row.ts +85 -45
- package/src/contracts/notebase.ts +60 -40
- package/src/contracts/shared.ts +21 -2
- package/src/contracts/srs.ts +96 -63
- package/src/contracts/stats.ts +9 -11
- package/src/contracts/user.ts +3 -3
- package/src/contracts/video-transcript.ts +22 -7
- package/src/index.ts +37 -33
- package/src/public-errors.ts +97 -51
- package/src/schemas/beta-access.ts +12 -10
- package/src/schemas/billing.ts +77 -53
- package/src/schemas/card.ts +66 -63
- package/src/schemas/ebook.ts +165 -129
- package/src/schemas/hosted-ai.ts +84 -74
- package/src/schemas/notebase-column.ts +50 -36
- package/src/schemas/notebase-row.ts +88 -57
- package/src/schemas/notebase-stats.ts +28 -20
- package/src/schemas/notebase-view.ts +59 -49
- package/src/schemas/notebase.ts +136 -96
- package/src/schemas/pagination.ts +9 -0
- package/src/schemas/resource-mutation.ts +6 -0
- package/src/schemas/srs-stats.ts +30 -22
- package/src/schemas/srs.ts +152 -106
- package/src/schemas/stats.ts +27 -21
- package/src/schemas/timezone.ts +19 -16
- package/src/schemas/user.ts +27 -19
- package/src/schemas/video-transcript.ts +53 -24
package/src/schemas/ebook.ts
CHANGED
|
@@ -1,143 +1,179 @@
|
|
|
1
|
-
import { EBOOK_ALLOWED_COVER_CONTENT_TYPES } from "@read-frog/definitions"
|
|
2
|
-
import { z } from "zod"
|
|
3
|
-
|
|
4
|
-
export const ebookStatusSchema = z.enum(["pending", "ready"])
|
|
5
|
-
export type EbookStatus = z.infer<typeof ebookStatusSchema
|
|
6
|
-
|
|
7
|
-
export const ebookCoverContentTypeSchema = z.enum(EBOOK_ALLOWED_COVER_CONTENT_TYPES)
|
|
8
|
-
export type EbookCoverContentType = z.infer<typeof ebookCoverContentTypeSchema
|
|
9
|
-
|
|
10
|
-
export const ebookListItemSchema = z
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
import { EBOOK_ALLOWED_COVER_CONTENT_TYPES } from "@read-frog/definitions";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
export const ebookStatusSchema = z.enum(["pending", "ready"]);
|
|
5
|
+
export type EbookStatus = z.infer<typeof ebookStatusSchema>;
|
|
6
|
+
|
|
7
|
+
export const ebookCoverContentTypeSchema = z.enum(EBOOK_ALLOWED_COVER_CONTENT_TYPES);
|
|
8
|
+
export type EbookCoverContentType = z.infer<typeof ebookCoverContentTypeSchema>;
|
|
9
|
+
|
|
10
|
+
export const ebookListItemSchema = z
|
|
11
|
+
.object({
|
|
12
|
+
id: z.uuid(),
|
|
13
|
+
title: z.string(),
|
|
14
|
+
author: z.string().nullable(),
|
|
15
|
+
language: z.string().nullable(),
|
|
16
|
+
fileByteSize: z.number().int(),
|
|
17
|
+
status: ebookStatusSchema,
|
|
18
|
+
progressFraction: z.number(),
|
|
19
|
+
lastReadAt: z.coerce.date().nullable(),
|
|
20
|
+
coverUrl: z.url().nullable(),
|
|
21
|
+
createdAt: z.coerce.date(),
|
|
22
|
+
updatedAt: z.coerce.date(),
|
|
23
|
+
})
|
|
24
|
+
.strict();
|
|
25
|
+
export type EbookListItem = z.infer<typeof ebookListItemSchema>;
|
|
24
26
|
|
|
25
27
|
export const ebookDetailSchema = ebookListItemSchema.extend({
|
|
26
28
|
progressCfi: z.string().nullable(),
|
|
27
|
-
})
|
|
28
|
-
export type EbookDetail = z.infer<typeof ebookDetailSchema
|
|
29
|
-
|
|
30
|
-
export const ebookQuotaSchema = z
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
export
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
export
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
export type
|
|
29
|
+
});
|
|
30
|
+
export type EbookDetail = z.infer<typeof ebookDetailSchema>;
|
|
31
|
+
|
|
32
|
+
export const ebookQuotaSchema = z
|
|
33
|
+
.object({
|
|
34
|
+
count: z.number().int().min(0),
|
|
35
|
+
// 0 is a valid limit: uploading is a paid feature, so free plans get no quota.
|
|
36
|
+
limit: z.number().int().min(0),
|
|
37
|
+
})
|
|
38
|
+
.strict();
|
|
39
|
+
export type EbookQuota = z.infer<typeof ebookQuotaSchema>;
|
|
40
|
+
|
|
41
|
+
export const ebookListInputSchema = z.object({}).strict();
|
|
42
|
+
export type EbookListInput = z.infer<typeof ebookListInputSchema>;
|
|
43
|
+
|
|
44
|
+
export const ebookListOutputSchema = z
|
|
45
|
+
.object({
|
|
46
|
+
items: z.array(ebookListItemSchema),
|
|
47
|
+
quota: ebookQuotaSchema,
|
|
48
|
+
})
|
|
49
|
+
.strict();
|
|
50
|
+
export type EbookListOutput = z.infer<typeof ebookListOutputSchema>;
|
|
51
|
+
|
|
52
|
+
export const ebookGetInputSchema = z
|
|
53
|
+
.object({
|
|
54
|
+
id: z.uuid(),
|
|
55
|
+
})
|
|
56
|
+
.strict();
|
|
57
|
+
export type EbookGetInput = z.infer<typeof ebookGetInputSchema>;
|
|
58
|
+
|
|
59
|
+
export const ebookGetOutputSchema = z
|
|
60
|
+
.object({
|
|
61
|
+
ebook: ebookDetailSchema,
|
|
62
|
+
})
|
|
63
|
+
.strict();
|
|
64
|
+
export type EbookGetOutput = z.infer<typeof ebookGetOutputSchema>;
|
|
65
|
+
|
|
66
|
+
export const ebookRequestUploadInputSchema = z
|
|
67
|
+
.object({
|
|
68
|
+
title: z.string().min(1).max(500),
|
|
69
|
+
author: z.string().max(500).optional(),
|
|
70
|
+
language: z.string().max(35).optional(),
|
|
71
|
+
coverContentType: ebookCoverContentTypeSchema.optional(),
|
|
72
|
+
})
|
|
73
|
+
.strict();
|
|
74
|
+
export type EbookRequestUploadInput = z.infer<typeof ebookRequestUploadInputSchema>;
|
|
63
75
|
|
|
64
76
|
/**
|
|
65
77
|
* S3 POST form policy. `fields` must be appended to the form in iteration order
|
|
66
78
|
* with the file last; S3 ignores anything sent after the `file` part.
|
|
67
79
|
*/
|
|
68
|
-
export const ebookPresignedPostSchema = z
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
export
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
})
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
export
|
|
80
|
+
export const ebookPresignedPostSchema = z
|
|
81
|
+
.object({
|
|
82
|
+
url: z.url(),
|
|
83
|
+
fields: z.record(z.string(), z.string()),
|
|
84
|
+
})
|
|
85
|
+
.strict();
|
|
86
|
+
export type EbookPresignedPost = z.infer<typeof ebookPresignedPostSchema>;
|
|
87
|
+
|
|
88
|
+
export const ebookRequestUploadOutputSchema = z
|
|
89
|
+
.object({
|
|
90
|
+
ebookId: z.uuid(),
|
|
91
|
+
upload: ebookPresignedPostSchema,
|
|
92
|
+
coverUpload: ebookPresignedPostSchema.nullable(),
|
|
93
|
+
expiresAt: z.coerce.date(),
|
|
94
|
+
})
|
|
95
|
+
.strict();
|
|
96
|
+
export type EbookRequestUploadOutput = z.infer<typeof ebookRequestUploadOutputSchema>;
|
|
97
|
+
|
|
98
|
+
export const ebookFinalizeUploadInputSchema = z
|
|
99
|
+
.object({
|
|
100
|
+
ebookId: z.uuid(),
|
|
101
|
+
})
|
|
102
|
+
.strict();
|
|
103
|
+
export type EbookFinalizeUploadInput = z.infer<typeof ebookFinalizeUploadInputSchema>;
|
|
104
|
+
|
|
105
|
+
export const ebookFinalizeUploadOutputSchema = z
|
|
106
|
+
.object({
|
|
107
|
+
ebook: ebookListItemSchema,
|
|
108
|
+
})
|
|
109
|
+
.strict();
|
|
110
|
+
export type EbookFinalizeUploadOutput = z.infer<typeof ebookFinalizeUploadOutputSchema>;
|
|
111
|
+
|
|
112
|
+
export const ebookGetDownloadUrlInputSchema = z
|
|
113
|
+
.object({
|
|
114
|
+
id: z.uuid(),
|
|
115
|
+
})
|
|
116
|
+
.strict();
|
|
117
|
+
export type EbookGetDownloadUrlInput = z.infer<typeof ebookGetDownloadUrlInputSchema>;
|
|
118
|
+
|
|
119
|
+
export const ebookGetDownloadUrlOutputSchema = z
|
|
120
|
+
.object({
|
|
121
|
+
url: z.url(),
|
|
122
|
+
expiresAt: z.coerce.date(),
|
|
123
|
+
})
|
|
124
|
+
.strict();
|
|
125
|
+
export type EbookGetDownloadUrlOutput = z.infer<typeof ebookGetDownloadUrlOutputSchema>;
|
|
126
|
+
|
|
127
|
+
export const ebookUpdateProgressDataSchema = z
|
|
128
|
+
.object({
|
|
129
|
+
cfi: z.string().max(2000),
|
|
130
|
+
fraction: z.number().min(0).max(1),
|
|
131
|
+
})
|
|
132
|
+
.strict();
|
|
133
|
+
export type EbookUpdateProgressData = z.infer<typeof ebookUpdateProgressDataSchema>;
|
|
108
134
|
|
|
109
135
|
export const ebookUpdateProgressInputSchema = ebookUpdateProgressDataSchema.extend({
|
|
110
136
|
id: z.uuid(),
|
|
111
|
-
})
|
|
112
|
-
export type EbookUpdateProgressInput = z.infer<typeof ebookUpdateProgressInputSchema
|
|
113
|
-
|
|
114
|
-
export const ebookUpdateProgressOutputSchema = z
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
export
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
137
|
+
});
|
|
138
|
+
export type EbookUpdateProgressInput = z.infer<typeof ebookUpdateProgressInputSchema>;
|
|
139
|
+
|
|
140
|
+
export const ebookUpdateProgressOutputSchema = z
|
|
141
|
+
.object({
|
|
142
|
+
lastReadAt: z.coerce.date(),
|
|
143
|
+
})
|
|
144
|
+
.strict();
|
|
145
|
+
export type EbookUpdateProgressOutput = z.infer<typeof ebookUpdateProgressOutputSchema>;
|
|
146
|
+
|
|
147
|
+
export const ebookRenameDataSchema = z
|
|
148
|
+
.object({
|
|
149
|
+
title: z.string().min(1).max(500),
|
|
150
|
+
author: z.string().max(500).nullable().optional(),
|
|
151
|
+
})
|
|
152
|
+
.strict();
|
|
153
|
+
export type EbookRenameData = z.infer<typeof ebookRenameDataSchema>;
|
|
124
154
|
|
|
125
155
|
export const ebookRenameInputSchema = ebookRenameDataSchema.extend({
|
|
126
156
|
id: z.uuid(),
|
|
127
|
-
})
|
|
128
|
-
export type EbookRenameInput = z.infer<typeof ebookRenameInputSchema
|
|
129
|
-
|
|
130
|
-
export const ebookRenameOutputSchema = z
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
export
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
157
|
+
});
|
|
158
|
+
export type EbookRenameInput = z.infer<typeof ebookRenameInputSchema>;
|
|
159
|
+
|
|
160
|
+
export const ebookRenameOutputSchema = z
|
|
161
|
+
.object({
|
|
162
|
+
ebook: ebookListItemSchema,
|
|
163
|
+
})
|
|
164
|
+
.strict();
|
|
165
|
+
export type EbookRenameOutput = z.infer<typeof ebookRenameOutputSchema>;
|
|
166
|
+
|
|
167
|
+
export const ebookDeleteInputSchema = z
|
|
168
|
+
.object({
|
|
169
|
+
id: z.uuid(),
|
|
170
|
+
})
|
|
171
|
+
.strict();
|
|
172
|
+
export type EbookDeleteInput = z.infer<typeof ebookDeleteInputSchema>;
|
|
173
|
+
|
|
174
|
+
export const ebookDeleteOutputSchema = z
|
|
175
|
+
.object({
|
|
176
|
+
id: z.uuid(),
|
|
177
|
+
})
|
|
178
|
+
.strict();
|
|
179
|
+
export type EbookDeleteOutput = z.infer<typeof ebookDeleteOutputSchema>;
|
package/src/schemas/hosted-ai.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { z } from "zod"
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
|
|
3
|
-
export const HostedAiOutputFieldTypeSchema = z.enum(["string", "number"])
|
|
3
|
+
export const HostedAiOutputFieldTypeSchema = z.enum(["string", "number"]);
|
|
4
4
|
|
|
5
5
|
export const HostedAiOutputFieldSchema = z.strictObject({
|
|
6
6
|
name: z.string().trim().min(1).max(80),
|
|
7
7
|
type: HostedAiOutputFieldTypeSchema,
|
|
8
|
-
})
|
|
8
|
+
});
|
|
9
9
|
|
|
10
|
-
const HostedAiInstructionsSchema = z.string().trim().min(1).max(16000)
|
|
10
|
+
const HostedAiInstructionsSchema = z.string().trim().min(1).max(16000);
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Which hosted model a request runs on. Deliberately NOT named after a billing
|
|
14
14
|
* plan: which plans may reach which tier is policy (see `access-policy.ts`),
|
|
15
15
|
* not identity, so a future plan can be sold with any tier without a rename.
|
|
16
16
|
*/
|
|
17
|
-
export const HostedAiModelTierSchema = z.enum(["normal", "advance"])
|
|
17
|
+
export const HostedAiModelTierSchema = z.enum(["normal", "advance"]);
|
|
18
18
|
/**
|
|
19
19
|
* The billing/access subject of a hosted request, not a route id. Sub-calls
|
|
20
20
|
* bill against the feature they serve: the page summary is `pageTranslation`,
|
|
@@ -31,8 +31,8 @@ export const HostedAiFeatureSchema = z.enum([
|
|
|
31
31
|
"videoSubtitles",
|
|
32
32
|
"inputTranslation",
|
|
33
33
|
"languageDetection",
|
|
34
|
-
])
|
|
35
|
-
export const HostedAiRequestIdSchema = z.uuid()
|
|
34
|
+
]);
|
|
35
|
+
export const HostedAiRequestIdSchema = z.uuid();
|
|
36
36
|
|
|
37
37
|
const HostedAiRequestMetadataSchema = {
|
|
38
38
|
/**
|
|
@@ -47,47 +47,49 @@ const HostedAiRequestMetadataSchema = {
|
|
|
47
47
|
*/
|
|
48
48
|
modelTier: HostedAiModelTierSchema.default("normal"),
|
|
49
49
|
requestId: HostedAiRequestIdSchema.optional(),
|
|
50
|
-
}
|
|
50
|
+
};
|
|
51
51
|
|
|
52
52
|
export const HostedAiStreamTextInputSchema = z.strictObject({
|
|
53
53
|
...HostedAiRequestMetadataSchema,
|
|
54
54
|
instructions: HostedAiInstructionsSchema,
|
|
55
55
|
prompt: z.string().trim().min(1).max(32000),
|
|
56
56
|
temperature: z.number().min(0).max(2).optional(),
|
|
57
|
-
})
|
|
57
|
+
});
|
|
58
58
|
|
|
59
|
-
export const HostedAiStreamStructuredObjectInputSchema = z
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
59
|
+
export const HostedAiStreamStructuredObjectInputSchema = z
|
|
60
|
+
.strictObject({
|
|
61
|
+
...HostedAiRequestMetadataSchema,
|
|
62
|
+
instructions: HostedAiInstructionsSchema,
|
|
63
|
+
prompt: z.string().trim().min(1).max(32000),
|
|
64
|
+
outputSchema: z.array(HostedAiOutputFieldSchema).min(1).max(32),
|
|
65
|
+
temperature: z.number().min(0).max(2).optional(),
|
|
66
|
+
})
|
|
67
|
+
.superRefine((input, ctx) => {
|
|
68
|
+
const fieldNames = new Set<string>();
|
|
67
69
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
70
|
+
input.outputSchema.forEach((field, index) => {
|
|
71
|
+
if (fieldNames.has(field.name)) {
|
|
72
|
+
ctx.addIssue({
|
|
73
|
+
code: "custom",
|
|
74
|
+
message: `Duplicate output schema name "${field.name}".`,
|
|
75
|
+
path: ["outputSchema", index, "name"],
|
|
76
|
+
});
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
77
79
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
})
|
|
80
|
+
fieldNames.add(field.name);
|
|
81
|
+
});
|
|
82
|
+
});
|
|
81
83
|
|
|
82
|
-
export const HOSTED_AI_NOTE_SUGGESTION_MAX_NOTES = 2
|
|
83
|
-
export const HOSTED_AI_NOTE_SUGGESTION_MAX_NOTE_FIELDS = 16
|
|
84
|
+
export const HOSTED_AI_NOTE_SUGGESTION_MAX_NOTES = 2;
|
|
85
|
+
export const HOSTED_AI_NOTE_SUGGESTION_MAX_NOTE_FIELDS = 16;
|
|
84
86
|
|
|
85
87
|
export const HostedAiNoteSuggestionStreamInputSchema = z.strictObject({
|
|
86
88
|
...HostedAiRequestMetadataSchema,
|
|
87
89
|
instructions: HostedAiInstructionsSchema,
|
|
88
90
|
prompt: z.string().trim().min(1).max(32000),
|
|
89
91
|
temperature: z.number().min(0).max(2).optional(),
|
|
90
|
-
})
|
|
92
|
+
});
|
|
91
93
|
|
|
92
94
|
/**
|
|
93
95
|
* Fixed structured-output schema for hosted note suggestions. Must stay
|
|
@@ -109,21 +111,25 @@ export const HostedAiNoteSuggestionObjectSchema = z.strictObject({
|
|
|
109
111
|
*/
|
|
110
112
|
summaryFieldName: z.string().max(80).nullable(),
|
|
111
113
|
}),
|
|
112
|
-
notes: z
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
z
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
114
|
+
notes: z
|
|
115
|
+
.array(
|
|
116
|
+
z.strictObject({
|
|
117
|
+
fields: z
|
|
118
|
+
.array(
|
|
119
|
+
z.strictObject({
|
|
120
|
+
name: z.string().max(80),
|
|
121
|
+
value: z.union([z.string(), z.number()]).nullable(),
|
|
122
|
+
}),
|
|
123
|
+
)
|
|
124
|
+
.max(HOSTED_AI_NOTE_SUGGESTION_MAX_NOTE_FIELDS),
|
|
125
|
+
}),
|
|
126
|
+
)
|
|
127
|
+
.max(HOSTED_AI_NOTE_SUGGESTION_MAX_NOTES),
|
|
128
|
+
});
|
|
123
129
|
|
|
124
130
|
export const HostedAiStreamPartSchema = z.looseObject({
|
|
125
131
|
type: z.string().trim().min(1),
|
|
126
|
-
})
|
|
132
|
+
});
|
|
127
133
|
|
|
128
134
|
/**
|
|
129
135
|
* The only stream part types this API emits. Every other part the AI SDK
|
|
@@ -143,7 +149,7 @@ export const HOSTED_AI_CLIENT_STREAM_PART_TYPES = [
|
|
|
143
149
|
"reasoning-end",
|
|
144
150
|
"reasoning-file",
|
|
145
151
|
"finish",
|
|
146
|
-
] as const
|
|
152
|
+
] as const;
|
|
147
153
|
|
|
148
154
|
/**
|
|
149
155
|
* Status is per-identity, not per-feature: one call reports every feature and
|
|
@@ -151,25 +157,25 @@ export const HOSTED_AI_CLIENT_STREAM_PART_TYPES = [
|
|
|
151
157
|
* Non-strict so a client still sending the retired `feature` argument gets a
|
|
152
158
|
* useful response rather than a validation error.
|
|
153
159
|
*/
|
|
154
|
-
export const HostedAiStatusInputSchema = z.object({})
|
|
160
|
+
export const HostedAiStatusInputSchema = z.object({});
|
|
155
161
|
|
|
156
162
|
export const HostedAiUnavailableReasonSchema = z.enum([
|
|
157
163
|
"authentication_required",
|
|
158
164
|
"ultra_required",
|
|
159
165
|
"quota_exhausted",
|
|
160
166
|
"service_unavailable",
|
|
161
|
-
])
|
|
167
|
+
]);
|
|
162
168
|
|
|
163
169
|
export const HostedAiCreditPolicyIdSchema = z.enum([
|
|
164
170
|
"custom-action-guest-daily-v1",
|
|
165
171
|
"custom-action-user-daily-v1",
|
|
166
172
|
"custom-action-pro-daily-v1",
|
|
167
173
|
"ultra-weekly-v1",
|
|
168
|
-
])
|
|
174
|
+
]);
|
|
169
175
|
|
|
170
|
-
export const HostedAiCreditPeriodKindSchema = z.enum(["daily", "weekly"])
|
|
176
|
+
export const HostedAiCreditPeriodKindSchema = z.enum(["daily", "weekly"]);
|
|
171
177
|
|
|
172
|
-
export const HostedAiQuotaScopeSchema = z.enum(["guest", "user"])
|
|
178
|
+
export const HostedAiQuotaScopeSchema = z.enum(["guest", "user"]);
|
|
173
179
|
|
|
174
180
|
/**
|
|
175
181
|
* Data payload of the TOO_MANY_REQUESTS error every hosted AI guard emits.
|
|
@@ -187,7 +193,7 @@ export const HostedAiQuotaScopeSchema = z.enum(["guest", "user"])
|
|
|
187
193
|
export const HostedAiRateLimitErrorDataSchema = z.object({
|
|
188
194
|
retryAfterMs: z.number().int().min(0),
|
|
189
195
|
quotaScope: HostedAiQuotaScopeSchema,
|
|
190
|
-
})
|
|
196
|
+
});
|
|
191
197
|
|
|
192
198
|
/**
|
|
193
199
|
* Deliberately free of dollar amounts and of the versioned policy id. Clients
|
|
@@ -206,7 +212,7 @@ export const HostedAiCreditStatusSchema = z.strictObject({
|
|
|
206
212
|
* a client can tell one shared pool from several separate ones.
|
|
207
213
|
*/
|
|
208
214
|
features: z.array(HostedAiFeatureSchema).min(1),
|
|
209
|
-
})
|
|
215
|
+
});
|
|
210
216
|
|
|
211
217
|
export const HostedAiTierStatusSchema = z.strictObject({
|
|
212
218
|
accessAllowed: z.boolean(),
|
|
@@ -220,12 +226,12 @@ export const HostedAiTierStatusSchema = z.strictObject({
|
|
|
220
226
|
*/
|
|
221
227
|
requiresUltra: z.boolean(),
|
|
222
228
|
modelRevision: z.string().trim().min(1),
|
|
223
|
-
})
|
|
229
|
+
});
|
|
224
230
|
|
|
225
231
|
export const HostedAiFeatureStatusSchema = z.strictObject({
|
|
226
232
|
normal: HostedAiTierStatusSchema,
|
|
227
233
|
advance: HostedAiTierStatusSchema,
|
|
228
|
-
})
|
|
234
|
+
});
|
|
229
235
|
|
|
230
236
|
export const HostedAiStatusOutputSchema = z.strictObject({
|
|
231
237
|
credits: z.array(HostedAiCreditStatusSchema),
|
|
@@ -238,24 +244,28 @@ export const HostedAiStatusOutputSchema = z.strictObject({
|
|
|
238
244
|
inputTranslation: HostedAiFeatureStatusSchema,
|
|
239
245
|
languageDetection: HostedAiFeatureStatusSchema,
|
|
240
246
|
}),
|
|
241
|
-
})
|
|
247
|
+
});
|
|
242
248
|
|
|
243
|
-
export type HostedAiOutputFieldType = z.infer<typeof HostedAiOutputFieldTypeSchema
|
|
244
|
-
export type HostedAiOutputField = z.infer<typeof HostedAiOutputFieldSchema
|
|
245
|
-
export type HostedAiModelTier = z.infer<typeof HostedAiModelTierSchema
|
|
246
|
-
export type HostedAiFeature = z.infer<typeof HostedAiFeatureSchema
|
|
247
|
-
export type HostedAiStreamTextInput = z.infer<typeof HostedAiStreamTextInputSchema
|
|
248
|
-
export type HostedAiStreamStructuredObjectInput = z.infer<
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
export type
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
export type
|
|
255
|
-
export type
|
|
256
|
-
export type
|
|
257
|
-
export type
|
|
258
|
-
export type
|
|
259
|
-
export type
|
|
260
|
-
export type
|
|
261
|
-
export type
|
|
249
|
+
export type HostedAiOutputFieldType = z.infer<typeof HostedAiOutputFieldTypeSchema>;
|
|
250
|
+
export type HostedAiOutputField = z.infer<typeof HostedAiOutputFieldSchema>;
|
|
251
|
+
export type HostedAiModelTier = z.infer<typeof HostedAiModelTierSchema>;
|
|
252
|
+
export type HostedAiFeature = z.infer<typeof HostedAiFeatureSchema>;
|
|
253
|
+
export type HostedAiStreamTextInput = z.infer<typeof HostedAiStreamTextInputSchema>;
|
|
254
|
+
export type HostedAiStreamStructuredObjectInput = z.infer<
|
|
255
|
+
typeof HostedAiStreamStructuredObjectInputSchema
|
|
256
|
+
>;
|
|
257
|
+
export type HostedAiNoteSuggestionStreamInput = z.infer<
|
|
258
|
+
typeof HostedAiNoteSuggestionStreamInputSchema
|
|
259
|
+
>;
|
|
260
|
+
export type HostedAiNoteSuggestionObject = z.infer<typeof HostedAiNoteSuggestionObjectSchema>;
|
|
261
|
+
export type HostedAiStreamPart = z.infer<typeof HostedAiStreamPartSchema>;
|
|
262
|
+
export type HostedAiStatusInput = z.infer<typeof HostedAiStatusInputSchema>;
|
|
263
|
+
export type HostedAiUnavailableReason = z.infer<typeof HostedAiUnavailableReasonSchema>;
|
|
264
|
+
export type HostedAiCreditPolicyId = z.infer<typeof HostedAiCreditPolicyIdSchema>;
|
|
265
|
+
export type HostedAiCreditPeriodKind = z.infer<typeof HostedAiCreditPeriodKindSchema>;
|
|
266
|
+
export type HostedAiQuotaScope = z.infer<typeof HostedAiQuotaScopeSchema>;
|
|
267
|
+
export type HostedAiRateLimitErrorData = z.infer<typeof HostedAiRateLimitErrorDataSchema>;
|
|
268
|
+
export type HostedAiCreditStatus = z.infer<typeof HostedAiCreditStatusSchema>;
|
|
269
|
+
export type HostedAiTierStatus = z.infer<typeof HostedAiTierStatusSchema>;
|
|
270
|
+
export type HostedAiFeatureStatus = z.infer<typeof HostedAiFeatureStatusSchema>;
|
|
271
|
+
export type HostedAiStatusOutput = z.infer<typeof HostedAiStatusOutputSchema>;
|