@voquill/functions 0.1.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.
@@ -0,0 +1,350 @@
1
+ import { Member, Term, type EmptyObject, type JsonResponse, type Nullable, type User } from "@repo/types";
2
+ import { z } from "zod";
3
+ import { CloudModel } from "./types";
4
+ type EnterpriseHandlerDefinitions = {
5
+ "auth/register": {
6
+ input: {
7
+ email: string;
8
+ password: string;
9
+ };
10
+ output: {
11
+ token: string;
12
+ user: User;
13
+ };
14
+ };
15
+ "auth/login": {
16
+ input: {
17
+ email: string;
18
+ password: string;
19
+ };
20
+ output: {
21
+ token: string;
22
+ user: User;
23
+ };
24
+ };
25
+ "auth/logout": {
26
+ input: EmptyObject;
27
+ output: EmptyObject;
28
+ };
29
+ "member/tryInitialize": {
30
+ input: EmptyObject;
31
+ output: {
32
+ member: Member;
33
+ };
34
+ };
35
+ "member/getMyMember": {
36
+ input: EmptyObject;
37
+ output: {
38
+ member: Member;
39
+ };
40
+ };
41
+ "user/setMyUser": {
42
+ input: {
43
+ value: User;
44
+ };
45
+ output: {
46
+ user: User;
47
+ };
48
+ };
49
+ "user/getMyUser": {
50
+ input: EmptyObject;
51
+ output: {
52
+ user: Nullable<User>;
53
+ };
54
+ };
55
+ "config/getFullConfig": {
56
+ input: EmptyObject;
57
+ output: {
58
+ limits: {
59
+ free: {
60
+ wordsPerDay: number;
61
+ wordsPerMonth: number;
62
+ tokensPerDay: number;
63
+ tokensPerMonth: number;
64
+ };
65
+ pro: {
66
+ wordsPerDay: number;
67
+ wordsPerMonth: number;
68
+ tokensPerDay: number;
69
+ tokensPerMonth: number;
70
+ };
71
+ };
72
+ };
73
+ };
74
+ "term/listMyTerms": {
75
+ input: EmptyObject;
76
+ output: {
77
+ terms: Term[];
78
+ };
79
+ };
80
+ "term/upsertMyTerm": {
81
+ input: {
82
+ term: Term;
83
+ };
84
+ output: {
85
+ term: Term;
86
+ };
87
+ };
88
+ "term/deleteMyTerm": {
89
+ input: {
90
+ termId: string;
91
+ };
92
+ output: EmptyObject;
93
+ };
94
+ "ai/transcribeAudio": {
95
+ input: {
96
+ audioBase64: string;
97
+ audioMimeType: string;
98
+ prompt?: string;
99
+ language?: string;
100
+ };
101
+ output: {
102
+ text: string;
103
+ };
104
+ };
105
+ "ai/generateText": {
106
+ input: {
107
+ system?: string;
108
+ prompt: string;
109
+ jsonResponse?: JsonResponse;
110
+ model?: CloudModel;
111
+ };
112
+ output: {
113
+ text: string;
114
+ };
115
+ };
116
+ };
117
+ export type EnterpriseHandlerName = keyof EnterpriseHandlerDefinitions;
118
+ export type EnterpriseHandlerInput<N extends EnterpriseHandlerName> = EnterpriseHandlerDefinitions[N]["input"];
119
+ export type EnterpriseHandlerOutput<N extends EnterpriseHandlerName> = EnterpriseHandlerDefinitions[N]["output"];
120
+ export declare const AUTH_HANDLER_NAMES: EnterpriseHandlerName[];
121
+ export declare const AuthRegisterInputZod: z.ZodObject<{
122
+ email: z.ZodString;
123
+ password: z.ZodString;
124
+ }, "strict", z.ZodTypeAny, {
125
+ email: string;
126
+ password: string;
127
+ }, {
128
+ email: string;
129
+ password: string;
130
+ }>;
131
+ export declare const AuthLoginInputZod: z.ZodObject<{
132
+ email: z.ZodString;
133
+ password: z.ZodString;
134
+ }, "strict", z.ZodTypeAny, {
135
+ email: string;
136
+ password: string;
137
+ }, {
138
+ email: string;
139
+ password: string;
140
+ }>;
141
+ export declare const EnterpriseSetMyUserInputZod: z.ZodObject<{
142
+ value: z.ZodObject<{
143
+ id: z.ZodString;
144
+ createdAt: z.ZodString;
145
+ updatedAt: z.ZodString;
146
+ name: z.ZodString;
147
+ bio: z.ZodOptional<z.ZodNullable<z.ZodString>>;
148
+ company: z.ZodOptional<z.ZodNullable<z.ZodString>>;
149
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
150
+ onboarded: z.ZodBoolean;
151
+ onboardedAt: z.ZodNullable<z.ZodString>;
152
+ timezone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
153
+ preferredLanguage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
154
+ preferredMicrophone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
155
+ playInteractionChime: z.ZodBoolean;
156
+ hasFinishedTutorial: z.ZodBoolean;
157
+ wordsThisMonth: z.ZodNumber;
158
+ wordsThisMonthMonth: z.ZodNullable<z.ZodString>;
159
+ wordsTotal: z.ZodNumber;
160
+ hasMigratedPreferredMicrophone: z.ZodOptional<z.ZodBoolean>;
161
+ cohort: z.ZodOptional<z.ZodNullable<z.ZodString>>;
162
+ shouldShowUpgradeDialog: z.ZodOptional<z.ZodBoolean>;
163
+ }, "strict", z.ZodTypeAny, {
164
+ id: string;
165
+ createdAt: string;
166
+ updatedAt: string;
167
+ name: string;
168
+ onboarded: boolean;
169
+ onboardedAt: string | null;
170
+ playInteractionChime: boolean;
171
+ hasFinishedTutorial: boolean;
172
+ wordsThisMonth: number;
173
+ wordsThisMonthMonth: string | null;
174
+ wordsTotal: number;
175
+ bio?: string | null | undefined;
176
+ company?: string | null | undefined;
177
+ title?: string | null | undefined;
178
+ timezone?: string | null | undefined;
179
+ preferredLanguage?: string | null | undefined;
180
+ preferredMicrophone?: string | null | undefined;
181
+ hasMigratedPreferredMicrophone?: boolean | undefined;
182
+ cohort?: string | null | undefined;
183
+ shouldShowUpgradeDialog?: boolean | undefined;
184
+ }, {
185
+ id: string;
186
+ createdAt: string;
187
+ updatedAt: string;
188
+ name: string;
189
+ onboarded: boolean;
190
+ onboardedAt: string | null;
191
+ playInteractionChime: boolean;
192
+ hasFinishedTutorial: boolean;
193
+ wordsThisMonth: number;
194
+ wordsThisMonthMonth: string | null;
195
+ wordsTotal: number;
196
+ bio?: string | null | undefined;
197
+ company?: string | null | undefined;
198
+ title?: string | null | undefined;
199
+ timezone?: string | null | undefined;
200
+ preferredLanguage?: string | null | undefined;
201
+ preferredMicrophone?: string | null | undefined;
202
+ hasMigratedPreferredMicrophone?: boolean | undefined;
203
+ cohort?: string | null | undefined;
204
+ shouldShowUpgradeDialog?: boolean | undefined;
205
+ }>;
206
+ }, "strict", z.ZodTypeAny, {
207
+ value: {
208
+ id: string;
209
+ createdAt: string;
210
+ updatedAt: string;
211
+ name: string;
212
+ onboarded: boolean;
213
+ onboardedAt: string | null;
214
+ playInteractionChime: boolean;
215
+ hasFinishedTutorial: boolean;
216
+ wordsThisMonth: number;
217
+ wordsThisMonthMonth: string | null;
218
+ wordsTotal: number;
219
+ bio?: string | null | undefined;
220
+ company?: string | null | undefined;
221
+ title?: string | null | undefined;
222
+ timezone?: string | null | undefined;
223
+ preferredLanguage?: string | null | undefined;
224
+ preferredMicrophone?: string | null | undefined;
225
+ hasMigratedPreferredMicrophone?: boolean | undefined;
226
+ cohort?: string | null | undefined;
227
+ shouldShowUpgradeDialog?: boolean | undefined;
228
+ };
229
+ }, {
230
+ value: {
231
+ id: string;
232
+ createdAt: string;
233
+ updatedAt: string;
234
+ name: string;
235
+ onboarded: boolean;
236
+ onboardedAt: string | null;
237
+ playInteractionChime: boolean;
238
+ hasFinishedTutorial: boolean;
239
+ wordsThisMonth: number;
240
+ wordsThisMonthMonth: string | null;
241
+ wordsTotal: number;
242
+ bio?: string | null | undefined;
243
+ company?: string | null | undefined;
244
+ title?: string | null | undefined;
245
+ timezone?: string | null | undefined;
246
+ preferredLanguage?: string | null | undefined;
247
+ preferredMicrophone?: string | null | undefined;
248
+ hasMigratedPreferredMicrophone?: boolean | undefined;
249
+ cohort?: string | null | undefined;
250
+ shouldShowUpgradeDialog?: boolean | undefined;
251
+ };
252
+ }>;
253
+ export declare const EnterpriseUpsertTermInputZod: z.ZodObject<{
254
+ term: z.ZodObject<{
255
+ id: z.ZodString;
256
+ createdAt: z.ZodString;
257
+ sourceValue: z.ZodString;
258
+ destinationValue: z.ZodString;
259
+ isReplacement: z.ZodBoolean;
260
+ }, "strict", z.ZodTypeAny, {
261
+ id: string;
262
+ createdAt: string;
263
+ sourceValue: string;
264
+ destinationValue: string;
265
+ isReplacement: boolean;
266
+ }, {
267
+ id: string;
268
+ createdAt: string;
269
+ sourceValue: string;
270
+ destinationValue: string;
271
+ isReplacement: boolean;
272
+ }>;
273
+ }, "strict", z.ZodTypeAny, {
274
+ term: {
275
+ id: string;
276
+ createdAt: string;
277
+ sourceValue: string;
278
+ destinationValue: string;
279
+ isReplacement: boolean;
280
+ };
281
+ }, {
282
+ term: {
283
+ id: string;
284
+ createdAt: string;
285
+ sourceValue: string;
286
+ destinationValue: string;
287
+ isReplacement: boolean;
288
+ };
289
+ }>;
290
+ export declare const EnterpriseDeleteTermInputZod: z.ZodObject<{
291
+ termId: z.ZodString;
292
+ }, "strict", z.ZodTypeAny, {
293
+ termId: string;
294
+ }, {
295
+ termId: string;
296
+ }>;
297
+ export declare const EnterpriseTranscribeAudioInputZod: z.ZodObject<{
298
+ audioBase64: z.ZodString;
299
+ audioMimeType: z.ZodString;
300
+ prompt: z.ZodOptional<z.ZodString>;
301
+ language: z.ZodOptional<z.ZodString>;
302
+ }, "strict", z.ZodTypeAny, {
303
+ audioBase64: string;
304
+ audioMimeType: string;
305
+ prompt?: string | undefined;
306
+ language?: string | undefined;
307
+ }, {
308
+ audioBase64: string;
309
+ audioMimeType: string;
310
+ prompt?: string | undefined;
311
+ language?: string | undefined;
312
+ }>;
313
+ export declare const EnterpriseGenerateTextInputZod: z.ZodObject<{
314
+ system: z.ZodOptional<z.ZodString>;
315
+ prompt: z.ZodString;
316
+ jsonResponse: z.ZodOptional<z.ZodObject<{
317
+ name: z.ZodString;
318
+ description: z.ZodOptional<z.ZodString>;
319
+ schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
320
+ }, "strict", z.ZodTypeAny, {
321
+ name: string;
322
+ schema: Record<string, unknown>;
323
+ description?: string | undefined;
324
+ }, {
325
+ name: string;
326
+ schema: Record<string, unknown>;
327
+ description?: string | undefined;
328
+ }>>;
329
+ model: z.ZodOptional<z.ZodEnum<["medium", "large"]>>;
330
+ }, "strict", z.ZodTypeAny, {
331
+ prompt: string;
332
+ system?: string | undefined;
333
+ jsonResponse?: {
334
+ name: string;
335
+ schema: Record<string, unknown>;
336
+ description?: string | undefined;
337
+ } | undefined;
338
+ model?: "medium" | "large" | undefined;
339
+ }, {
340
+ prompt: string;
341
+ system?: string | undefined;
342
+ jsonResponse?: {
343
+ name: string;
344
+ schema: Record<string, unknown>;
345
+ description?: string | undefined;
346
+ } | undefined;
347
+ model?: "medium" | "large" | undefined;
348
+ }>;
349
+ export {};
350
+ //# sourceMappingURL=enterprise.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enterprise.types.d.ts","sourceRoot":"","sources":["../src/enterprise.types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,IAAI,EAGJ,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,QAAQ,EACb,KAAK,IAAI,EACV,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAkC,MAAM,SAAS,CAAC;AAErE,KAAK,4BAA4B,GAAG;IAClC,eAAe,EAAE;QACf,KAAK,EAAE;YACL,KAAK,EAAE,MAAM,CAAC;YACd,QAAQ,EAAE,MAAM,CAAC;SAClB,CAAC;QACF,MAAM,EAAE;YACN,KAAK,EAAE,MAAM,CAAC;YACd,IAAI,EAAE,IAAI,CAAC;SACZ,CAAC;KACH,CAAC;IACF,YAAY,EAAE;QACZ,KAAK,EAAE;YACL,KAAK,EAAE,MAAM,CAAC;YACd,QAAQ,EAAE,MAAM,CAAC;SAClB,CAAC;QACF,MAAM,EAAE;YACN,KAAK,EAAE,MAAM,CAAC;YACd,IAAI,EAAE,IAAI,CAAC;SACZ,CAAC;KACH,CAAC;IACF,aAAa,EAAE;QACb,KAAK,EAAE,WAAW,CAAC;QACnB,MAAM,EAAE,WAAW,CAAC;KACrB,CAAC;IAEF,sBAAsB,EAAE;QACtB,KAAK,EAAE,WAAW,CAA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;;;;;;;;;;;;;;;;;EAImC,CAAC;AAE7E,eAAO,MAAM,4BAA4B;;;;;;EAImC,CAAC;AAE7E,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;EAO+B,CAAC;AAE9E,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAO+B,CAAC"}
@@ -0,0 +1,51 @@
1
+ import { TermZod, UserZod, } from "@repo/types";
2
+ import { z } from "zod";
3
+ import { CloudModelZod, JsonResponseZod } from "./types";
4
+ export const AUTH_HANDLER_NAMES = [
5
+ "auth/register",
6
+ "auth/login",
7
+ "auth/logout",
8
+ ];
9
+ export const AuthRegisterInputZod = z
10
+ .object({
11
+ email: z.string().email(),
12
+ password: z.string().min(8),
13
+ })
14
+ .strict();
15
+ export const AuthLoginInputZod = z
16
+ .object({
17
+ email: z.string().email(),
18
+ password: z.string().min(1),
19
+ })
20
+ .strict();
21
+ export const EnterpriseSetMyUserInputZod = z
22
+ .object({
23
+ value: UserZod,
24
+ })
25
+ .strict();
26
+ export const EnterpriseUpsertTermInputZod = z
27
+ .object({
28
+ term: TermZod,
29
+ })
30
+ .strict();
31
+ export const EnterpriseDeleteTermInputZod = z
32
+ .object({
33
+ termId: z.string().min(1),
34
+ })
35
+ .strict();
36
+ export const EnterpriseTranscribeAudioInputZod = z
37
+ .object({
38
+ audioBase64: z.string().min(1),
39
+ audioMimeType: z.string().min(1),
40
+ prompt: z.string().max(20000).optional(),
41
+ language: z.string().min(1).optional(),
42
+ })
43
+ .strict();
44
+ export const EnterpriseGenerateTextInputZod = z
45
+ .object({
46
+ system: z.string().max(3000).optional(),
47
+ prompt: z.string().max(25000),
48
+ jsonResponse: JsonResponseZod.optional(),
49
+ model: CloudModelZod.optional(),
50
+ })
51
+ .strict();
@@ -0,0 +1,3 @@
1
+ export * from "./types";
2
+ export * from "./utils";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./types";
2
+ export * from "./utils";