@adaptic/lumic-utils 1.0.12 → 1.0.14
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/apollo-client.client-Lu1K9ohp.js +3694 -0
- package/dist/apollo-client.client-Lu1K9ohp.js.map +1 -0
- package/dist/apollo-client.client-YFsBF7bL.js +3705 -0
- package/dist/apollo-client.client-YFsBF7bL.js.map +1 -0
- package/dist/apollo-client.server-CAtwy7W4.js +16320 -0
- package/dist/apollo-client.server-CAtwy7W4.js.map +1 -0
- package/dist/apollo-client.server-CWrxRFr9.js +16322 -0
- package/dist/apollo-client.server-CWrxRFr9.js.map +1 -0
- package/dist/index-Bc3hrZJm.js +12108 -0
- package/dist/index-Bc3hrZJm.js.map +1 -0
- package/dist/index-CZkVRs3j.js +75962 -0
- package/dist/index-CZkVRs3j.js.map +1 -0
- package/dist/{index-CcXQeJz8.js → index-Cstek604.js} +182 -22
- package/dist/index-Cstek604.js.map +1 -0
- package/dist/index-DT2sMbfH.js +76169 -0
- package/dist/index-DT2sMbfH.js.map +1 -0
- package/dist/index-DZUGtDjj.js +12271 -0
- package/dist/index-DZUGtDjj.js.map +1 -0
- package/dist/{index-CcgbRft2.js → index-DZZCd-1T.js} +182 -22
- package/dist/index-DZZCd-1T.js.map +1 -0
- package/dist/index.cjs +137 -11417
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +40 -11399
- package/dist/index.mjs.map +1 -1
- package/dist/test.cjs +25 -7
- package/dist/test.cjs.map +1 -1
- package/dist/test.mjs +25 -7
- package/dist/test.mjs.map +1 -1
- package/dist/types/config/__tests__/secrets.test.d.ts +1 -0
- package/dist/types/config/secrets.d.ts +286 -0
- package/dist/types/errors/__tests__/errors.test.d.ts +1 -0
- package/dist/types/errors/index.d.ts +77 -0
- package/dist/types/functions/__tests__/aws-lambda.test.d.ts +1 -0
- package/dist/types/functions/__tests__/aws-s3-utils.test.d.ts +1 -0
- package/dist/types/functions/__tests__/json-llm-tools.test.d.ts +1 -0
- package/dist/types/functions/__tests__/json-tools.test.d.ts +1 -0
- package/dist/types/functions/__tests__/slack-utils.test.d.ts +1 -0
- package/dist/types/functions/aws-lambda.d.ts +1 -1
- package/dist/types/functions/aws-s3-utils.d.ts +2 -2
- package/dist/types/functions/google-sheets.d.ts +4 -4
- package/dist/types/functions/json-llm-tools.d.ts +25 -3
- package/dist/types/functions/llm-anthropic.d.ts +14 -0
- package/dist/types/functions/llm-call.d.ts +14 -3
- package/dist/types/functions/llm-config.d.ts +13 -8
- package/dist/types/functions/llm-deepseek.d.ts +1 -1
- package/dist/types/functions/llm-openai-compatible.d.ts +15 -0
- package/dist/types/functions/llm-openai.d.ts +3 -2
- package/dist/types/functions/llm-utils.d.ts +24 -1
- package/dist/types/functions/slack-utils.d.ts +3 -4
- package/dist/types/functions/utils.d.ts +2 -14
- package/dist/types/functions/zip-utils.d.ts +12 -10
- package/dist/types/index.d.ts +33 -0
- package/dist/types/schemas/aws-schemas.d.ts +210 -0
- package/dist/types/schemas/google-sheets-schemas.d.ts +32 -0
- package/dist/types/schemas/index.d.ts +17 -0
- package/dist/types/schemas/openai-schemas.d.ts +834 -0
- package/dist/types/schemas/perplexity-schemas.d.ts +338 -0
- package/dist/types/schemas/validation-helpers.d.ts +33 -0
- package/dist/types/types/aws-types.d.ts +1 -1
- package/dist/types/types/google-types.d.ts +5 -3
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/types/openai-types.d.ts +396 -6
- package/dist/types/utils/__tests__/circuit-breaker.test.d.ts +1 -0
- package/dist/types/utils/__tests__/correlation.test.d.ts +1 -0
- package/dist/types/utils/__tests__/input-validator.test.d.ts +1 -0
- package/dist/types/utils/__tests__/llm-cost-tracker.test.d.ts +1 -0
- package/dist/types/utils/__tests__/logger.test.d.ts +1 -0
- package/dist/types/utils/__tests__/metrics.test.d.ts +1 -0
- package/dist/types/utils/__tests__/retry.test.d.ts +1 -0
- package/dist/types/utils/__tests__/sanitizer.test.d.ts +1 -0
- package/dist/types/utils/__tests__/timeouts.test.d.ts +1 -0
- package/dist/types/utils/aws-initialise.d.ts +6 -1
- package/dist/types/utils/circuit-breaker.d.ts +99 -0
- package/dist/types/utils/config.d.ts +40 -2
- package/dist/types/utils/correlation.d.ts +43 -0
- package/dist/types/utils/health-check.d.ts +50 -0
- package/dist/types/utils/input-validator.d.ts +51 -0
- package/dist/types/utils/llm-cost-tracker.d.ts +174 -0
- package/dist/types/utils/logger.d.ts +8 -0
- package/dist/types/utils/metrics.d.ts +61 -0
- package/dist/types/utils/rate-limiter.d.ts +85 -0
- package/dist/types/utils/retry.d.ts +58 -0
- package/dist/types/utils/sanitizer.d.ts +30 -0
- package/dist/types/utils/timeouts.d.ts +44 -0
- package/package.json +2 -1
- package/dist/index-CcXQeJz8.js.map +0 -1
- package/dist/index-CcgbRft2.js.map +0 -1
- package/dist/types/aws-types.ts +0 -64
- package/dist/types/google-types.ts +0 -48
- package/dist/types/index.ts +0 -57
- package/dist/types/openai-types.ts +0 -92
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Zod schema for a complete Perplexity API response.
|
|
4
|
+
* Validates the core fields that lumic-utils depends on.
|
|
5
|
+
* Uses .passthrough() to allow additional fields from newer API versions.
|
|
6
|
+
*/
|
|
7
|
+
export declare const perplexityResponseSchema: z.ZodObject<{
|
|
8
|
+
id: z.ZodString;
|
|
9
|
+
model: z.ZodString;
|
|
10
|
+
object: z.ZodString;
|
|
11
|
+
created: z.ZodNumber;
|
|
12
|
+
choices: z.ZodArray<z.ZodObject<{
|
|
13
|
+
index: z.ZodNumber;
|
|
14
|
+
finish_reason: z.ZodNullable<z.ZodEnum<["stop", "length", "model_length"]>>;
|
|
15
|
+
message: z.ZodObject<{
|
|
16
|
+
role: z.ZodEnum<["assistant"]>;
|
|
17
|
+
content: z.ZodString;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
role: "assistant";
|
|
20
|
+
content: string;
|
|
21
|
+
}, {
|
|
22
|
+
role: "assistant";
|
|
23
|
+
content: string;
|
|
24
|
+
}>;
|
|
25
|
+
delta: z.ZodOptional<z.ZodObject<{
|
|
26
|
+
role: z.ZodOptional<z.ZodString>;
|
|
27
|
+
content: z.ZodOptional<z.ZodString>;
|
|
28
|
+
}, "strip", z.ZodTypeAny, {
|
|
29
|
+
role?: string | undefined;
|
|
30
|
+
content?: string | undefined;
|
|
31
|
+
}, {
|
|
32
|
+
role?: string | undefined;
|
|
33
|
+
content?: string | undefined;
|
|
34
|
+
}>>;
|
|
35
|
+
}, "strip", z.ZodTypeAny, {
|
|
36
|
+
message: {
|
|
37
|
+
role: "assistant";
|
|
38
|
+
content: string;
|
|
39
|
+
};
|
|
40
|
+
index: number;
|
|
41
|
+
finish_reason: "length" | "stop" | "model_length" | null;
|
|
42
|
+
delta?: {
|
|
43
|
+
role?: string | undefined;
|
|
44
|
+
content?: string | undefined;
|
|
45
|
+
} | undefined;
|
|
46
|
+
}, {
|
|
47
|
+
message: {
|
|
48
|
+
role: "assistant";
|
|
49
|
+
content: string;
|
|
50
|
+
};
|
|
51
|
+
index: number;
|
|
52
|
+
finish_reason: "length" | "stop" | "model_length" | null;
|
|
53
|
+
delta?: {
|
|
54
|
+
role?: string | undefined;
|
|
55
|
+
content?: string | undefined;
|
|
56
|
+
} | undefined;
|
|
57
|
+
}>, "many">;
|
|
58
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
59
|
+
prompt_tokens: z.ZodNumber;
|
|
60
|
+
completion_tokens: z.ZodNumber;
|
|
61
|
+
total_tokens: z.ZodNumber;
|
|
62
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
63
|
+
prompt_tokens: z.ZodNumber;
|
|
64
|
+
completion_tokens: z.ZodNumber;
|
|
65
|
+
total_tokens: z.ZodNumber;
|
|
66
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
67
|
+
prompt_tokens: z.ZodNumber;
|
|
68
|
+
completion_tokens: z.ZodNumber;
|
|
69
|
+
total_tokens: z.ZodNumber;
|
|
70
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
71
|
+
citations: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
72
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
73
|
+
id: z.ZodString;
|
|
74
|
+
model: z.ZodString;
|
|
75
|
+
object: z.ZodString;
|
|
76
|
+
created: z.ZodNumber;
|
|
77
|
+
choices: z.ZodArray<z.ZodObject<{
|
|
78
|
+
index: z.ZodNumber;
|
|
79
|
+
finish_reason: z.ZodNullable<z.ZodEnum<["stop", "length", "model_length"]>>;
|
|
80
|
+
message: z.ZodObject<{
|
|
81
|
+
role: z.ZodEnum<["assistant"]>;
|
|
82
|
+
content: z.ZodString;
|
|
83
|
+
}, "strip", z.ZodTypeAny, {
|
|
84
|
+
role: "assistant";
|
|
85
|
+
content: string;
|
|
86
|
+
}, {
|
|
87
|
+
role: "assistant";
|
|
88
|
+
content: string;
|
|
89
|
+
}>;
|
|
90
|
+
delta: z.ZodOptional<z.ZodObject<{
|
|
91
|
+
role: z.ZodOptional<z.ZodString>;
|
|
92
|
+
content: z.ZodOptional<z.ZodString>;
|
|
93
|
+
}, "strip", z.ZodTypeAny, {
|
|
94
|
+
role?: string | undefined;
|
|
95
|
+
content?: string | undefined;
|
|
96
|
+
}, {
|
|
97
|
+
role?: string | undefined;
|
|
98
|
+
content?: string | undefined;
|
|
99
|
+
}>>;
|
|
100
|
+
}, "strip", z.ZodTypeAny, {
|
|
101
|
+
message: {
|
|
102
|
+
role: "assistant";
|
|
103
|
+
content: string;
|
|
104
|
+
};
|
|
105
|
+
index: number;
|
|
106
|
+
finish_reason: "length" | "stop" | "model_length" | null;
|
|
107
|
+
delta?: {
|
|
108
|
+
role?: string | undefined;
|
|
109
|
+
content?: string | undefined;
|
|
110
|
+
} | undefined;
|
|
111
|
+
}, {
|
|
112
|
+
message: {
|
|
113
|
+
role: "assistant";
|
|
114
|
+
content: string;
|
|
115
|
+
};
|
|
116
|
+
index: number;
|
|
117
|
+
finish_reason: "length" | "stop" | "model_length" | null;
|
|
118
|
+
delta?: {
|
|
119
|
+
role?: string | undefined;
|
|
120
|
+
content?: string | undefined;
|
|
121
|
+
} | undefined;
|
|
122
|
+
}>, "many">;
|
|
123
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
124
|
+
prompt_tokens: z.ZodNumber;
|
|
125
|
+
completion_tokens: z.ZodNumber;
|
|
126
|
+
total_tokens: z.ZodNumber;
|
|
127
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
128
|
+
prompt_tokens: z.ZodNumber;
|
|
129
|
+
completion_tokens: z.ZodNumber;
|
|
130
|
+
total_tokens: z.ZodNumber;
|
|
131
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
132
|
+
prompt_tokens: z.ZodNumber;
|
|
133
|
+
completion_tokens: z.ZodNumber;
|
|
134
|
+
total_tokens: z.ZodNumber;
|
|
135
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
136
|
+
citations: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
137
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
138
|
+
id: z.ZodString;
|
|
139
|
+
model: z.ZodString;
|
|
140
|
+
object: z.ZodString;
|
|
141
|
+
created: z.ZodNumber;
|
|
142
|
+
choices: z.ZodArray<z.ZodObject<{
|
|
143
|
+
index: z.ZodNumber;
|
|
144
|
+
finish_reason: z.ZodNullable<z.ZodEnum<["stop", "length", "model_length"]>>;
|
|
145
|
+
message: z.ZodObject<{
|
|
146
|
+
role: z.ZodEnum<["assistant"]>;
|
|
147
|
+
content: z.ZodString;
|
|
148
|
+
}, "strip", z.ZodTypeAny, {
|
|
149
|
+
role: "assistant";
|
|
150
|
+
content: string;
|
|
151
|
+
}, {
|
|
152
|
+
role: "assistant";
|
|
153
|
+
content: string;
|
|
154
|
+
}>;
|
|
155
|
+
delta: z.ZodOptional<z.ZodObject<{
|
|
156
|
+
role: z.ZodOptional<z.ZodString>;
|
|
157
|
+
content: z.ZodOptional<z.ZodString>;
|
|
158
|
+
}, "strip", z.ZodTypeAny, {
|
|
159
|
+
role?: string | undefined;
|
|
160
|
+
content?: string | undefined;
|
|
161
|
+
}, {
|
|
162
|
+
role?: string | undefined;
|
|
163
|
+
content?: string | undefined;
|
|
164
|
+
}>>;
|
|
165
|
+
}, "strip", z.ZodTypeAny, {
|
|
166
|
+
message: {
|
|
167
|
+
role: "assistant";
|
|
168
|
+
content: string;
|
|
169
|
+
};
|
|
170
|
+
index: number;
|
|
171
|
+
finish_reason: "length" | "stop" | "model_length" | null;
|
|
172
|
+
delta?: {
|
|
173
|
+
role?: string | undefined;
|
|
174
|
+
content?: string | undefined;
|
|
175
|
+
} | undefined;
|
|
176
|
+
}, {
|
|
177
|
+
message: {
|
|
178
|
+
role: "assistant";
|
|
179
|
+
content: string;
|
|
180
|
+
};
|
|
181
|
+
index: number;
|
|
182
|
+
finish_reason: "length" | "stop" | "model_length" | null;
|
|
183
|
+
delta?: {
|
|
184
|
+
role?: string | undefined;
|
|
185
|
+
content?: string | undefined;
|
|
186
|
+
} | undefined;
|
|
187
|
+
}>, "many">;
|
|
188
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
189
|
+
prompt_tokens: z.ZodNumber;
|
|
190
|
+
completion_tokens: z.ZodNumber;
|
|
191
|
+
total_tokens: z.ZodNumber;
|
|
192
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
193
|
+
prompt_tokens: z.ZodNumber;
|
|
194
|
+
completion_tokens: z.ZodNumber;
|
|
195
|
+
total_tokens: z.ZodNumber;
|
|
196
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
197
|
+
prompt_tokens: z.ZodNumber;
|
|
198
|
+
completion_tokens: z.ZodNumber;
|
|
199
|
+
total_tokens: z.ZodNumber;
|
|
200
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
201
|
+
citations: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
202
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
203
|
+
/** Type inferred from the Perplexity response schema */
|
|
204
|
+
export type PerplexityResponse = z.infer<typeof perplexityResponseSchema>;
|
|
205
|
+
/** Strict validator for Perplexity API responses. Throws on failure. */
|
|
206
|
+
export declare const validatePerplexityResponse: (data: unknown) => z.objectInputType<{
|
|
207
|
+
id: z.ZodString;
|
|
208
|
+
model: z.ZodString;
|
|
209
|
+
object: z.ZodString;
|
|
210
|
+
created: z.ZodNumber;
|
|
211
|
+
choices: z.ZodArray<z.ZodObject<{
|
|
212
|
+
index: z.ZodNumber;
|
|
213
|
+
finish_reason: z.ZodNullable<z.ZodEnum<["stop", "length", "model_length"]>>;
|
|
214
|
+
message: z.ZodObject<{
|
|
215
|
+
role: z.ZodEnum<["assistant"]>;
|
|
216
|
+
content: z.ZodString;
|
|
217
|
+
}, "strip", z.ZodTypeAny, {
|
|
218
|
+
role: "assistant";
|
|
219
|
+
content: string;
|
|
220
|
+
}, {
|
|
221
|
+
role: "assistant";
|
|
222
|
+
content: string;
|
|
223
|
+
}>;
|
|
224
|
+
delta: z.ZodOptional<z.ZodObject<{
|
|
225
|
+
role: z.ZodOptional<z.ZodString>;
|
|
226
|
+
content: z.ZodOptional<z.ZodString>;
|
|
227
|
+
}, "strip", z.ZodTypeAny, {
|
|
228
|
+
role?: string | undefined;
|
|
229
|
+
content?: string | undefined;
|
|
230
|
+
}, {
|
|
231
|
+
role?: string | undefined;
|
|
232
|
+
content?: string | undefined;
|
|
233
|
+
}>>;
|
|
234
|
+
}, "strip", z.ZodTypeAny, {
|
|
235
|
+
message: {
|
|
236
|
+
role: "assistant";
|
|
237
|
+
content: string;
|
|
238
|
+
};
|
|
239
|
+
index: number;
|
|
240
|
+
finish_reason: "length" | "stop" | "model_length" | null;
|
|
241
|
+
delta?: {
|
|
242
|
+
role?: string | undefined;
|
|
243
|
+
content?: string | undefined;
|
|
244
|
+
} | undefined;
|
|
245
|
+
}, {
|
|
246
|
+
message: {
|
|
247
|
+
role: "assistant";
|
|
248
|
+
content: string;
|
|
249
|
+
};
|
|
250
|
+
index: number;
|
|
251
|
+
finish_reason: "length" | "stop" | "model_length" | null;
|
|
252
|
+
delta?: {
|
|
253
|
+
role?: string | undefined;
|
|
254
|
+
content?: string | undefined;
|
|
255
|
+
} | undefined;
|
|
256
|
+
}>, "many">;
|
|
257
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
258
|
+
prompt_tokens: z.ZodNumber;
|
|
259
|
+
completion_tokens: z.ZodNumber;
|
|
260
|
+
total_tokens: z.ZodNumber;
|
|
261
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
262
|
+
prompt_tokens: z.ZodNumber;
|
|
263
|
+
completion_tokens: z.ZodNumber;
|
|
264
|
+
total_tokens: z.ZodNumber;
|
|
265
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
266
|
+
prompt_tokens: z.ZodNumber;
|
|
267
|
+
completion_tokens: z.ZodNumber;
|
|
268
|
+
total_tokens: z.ZodNumber;
|
|
269
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
270
|
+
citations: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
271
|
+
}, z.ZodTypeAny, "passthrough">;
|
|
272
|
+
/** Safe validator for Perplexity API responses. Never throws. */
|
|
273
|
+
export declare const safeValidatePerplexityResponse: (data: unknown) => import("./validation-helpers").ValidationResult<z.objectInputType<{
|
|
274
|
+
id: z.ZodString;
|
|
275
|
+
model: z.ZodString;
|
|
276
|
+
object: z.ZodString;
|
|
277
|
+
created: z.ZodNumber;
|
|
278
|
+
choices: z.ZodArray<z.ZodObject<{
|
|
279
|
+
index: z.ZodNumber;
|
|
280
|
+
finish_reason: z.ZodNullable<z.ZodEnum<["stop", "length", "model_length"]>>;
|
|
281
|
+
message: z.ZodObject<{
|
|
282
|
+
role: z.ZodEnum<["assistant"]>;
|
|
283
|
+
content: z.ZodString;
|
|
284
|
+
}, "strip", z.ZodTypeAny, {
|
|
285
|
+
role: "assistant";
|
|
286
|
+
content: string;
|
|
287
|
+
}, {
|
|
288
|
+
role: "assistant";
|
|
289
|
+
content: string;
|
|
290
|
+
}>;
|
|
291
|
+
delta: z.ZodOptional<z.ZodObject<{
|
|
292
|
+
role: z.ZodOptional<z.ZodString>;
|
|
293
|
+
content: z.ZodOptional<z.ZodString>;
|
|
294
|
+
}, "strip", z.ZodTypeAny, {
|
|
295
|
+
role?: string | undefined;
|
|
296
|
+
content?: string | undefined;
|
|
297
|
+
}, {
|
|
298
|
+
role?: string | undefined;
|
|
299
|
+
content?: string | undefined;
|
|
300
|
+
}>>;
|
|
301
|
+
}, "strip", z.ZodTypeAny, {
|
|
302
|
+
message: {
|
|
303
|
+
role: "assistant";
|
|
304
|
+
content: string;
|
|
305
|
+
};
|
|
306
|
+
index: number;
|
|
307
|
+
finish_reason: "length" | "stop" | "model_length" | null;
|
|
308
|
+
delta?: {
|
|
309
|
+
role?: string | undefined;
|
|
310
|
+
content?: string | undefined;
|
|
311
|
+
} | undefined;
|
|
312
|
+
}, {
|
|
313
|
+
message: {
|
|
314
|
+
role: "assistant";
|
|
315
|
+
content: string;
|
|
316
|
+
};
|
|
317
|
+
index: number;
|
|
318
|
+
finish_reason: "length" | "stop" | "model_length" | null;
|
|
319
|
+
delta?: {
|
|
320
|
+
role?: string | undefined;
|
|
321
|
+
content?: string | undefined;
|
|
322
|
+
} | undefined;
|
|
323
|
+
}>, "many">;
|
|
324
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
325
|
+
prompt_tokens: z.ZodNumber;
|
|
326
|
+
completion_tokens: z.ZodNumber;
|
|
327
|
+
total_tokens: z.ZodNumber;
|
|
328
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
329
|
+
prompt_tokens: z.ZodNumber;
|
|
330
|
+
completion_tokens: z.ZodNumber;
|
|
331
|
+
total_tokens: z.ZodNumber;
|
|
332
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
333
|
+
prompt_tokens: z.ZodNumber;
|
|
334
|
+
completion_tokens: z.ZodNumber;
|
|
335
|
+
total_tokens: z.ZodNumber;
|
|
336
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
337
|
+
citations: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
338
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Result of a safe validation attempt.
|
|
4
|
+
* On success, contains the parsed data. On failure, contains the error details.
|
|
5
|
+
*/
|
|
6
|
+
export interface ValidationResult<T> {
|
|
7
|
+
success: boolean;
|
|
8
|
+
data?: T;
|
|
9
|
+
error?: string;
|
|
10
|
+
issues?: Array<{
|
|
11
|
+
path: string;
|
|
12
|
+
message: string;
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Creates a strict validator function for a Zod schema.
|
|
17
|
+
* Throws on validation failure with a descriptive error message.
|
|
18
|
+
*
|
|
19
|
+
* @param schema - The Zod schema to validate against
|
|
20
|
+
* @param serviceName - Human-readable service name for error messages
|
|
21
|
+
* @returns A validator function that parses and returns typed data
|
|
22
|
+
*/
|
|
23
|
+
export declare function createValidator<T>(schema: z.ZodType<T>, serviceName: string): (data: unknown) => T;
|
|
24
|
+
/**
|
|
25
|
+
* Creates a safe validator function for a Zod schema.
|
|
26
|
+
* Never throws; returns a ValidationResult with success/failure information.
|
|
27
|
+
* On failure, logs a warning but does not throw.
|
|
28
|
+
*
|
|
29
|
+
* @param schema - The Zod schema to validate against
|
|
30
|
+
* @param serviceName - Human-readable service name for log messages
|
|
31
|
+
* @returns A safe validator function that returns a ValidationResult
|
|
32
|
+
*/
|
|
33
|
+
export declare function createSafeValidator<T>(schema: z.ZodType<T>, serviceName: string): (data: unknown) => ValidationResult<T>;
|
|
@@ -10,15 +10,17 @@ export interface GoogleSheetRange {
|
|
|
10
10
|
startCell: GoogleSheetCell;
|
|
11
11
|
endCell: GoogleSheetCell;
|
|
12
12
|
}
|
|
13
|
+
/** Represents a primitive value that can be stored in a Google Sheet cell */
|
|
14
|
+
export type GoogleSheetCellValue = string | number | boolean | null;
|
|
13
15
|
export interface GoogleSheetResponse {
|
|
14
16
|
success: boolean;
|
|
15
17
|
error?: string;
|
|
16
|
-
data?:
|
|
18
|
+
data?: unknown;
|
|
17
19
|
}
|
|
18
20
|
export interface GoogleSheetAddRowResponse extends GoogleSheetResponse {
|
|
19
21
|
data?: {
|
|
20
22
|
rowNumber: number;
|
|
21
|
-
values:
|
|
23
|
+
values: GoogleSheetCellValue[];
|
|
22
24
|
};
|
|
23
25
|
}
|
|
24
26
|
export interface GoogleSheetAddSheetResponse extends GoogleSheetResponse {
|
|
@@ -29,7 +31,7 @@ export interface GoogleSheetAddSheetResponse extends GoogleSheetResponse {
|
|
|
29
31
|
}
|
|
30
32
|
export interface GoogleSheetCellResponse extends GoogleSheetResponse {
|
|
31
33
|
data?: {
|
|
32
|
-
value:
|
|
34
|
+
value: GoogleSheetCellValue;
|
|
33
35
|
};
|
|
34
36
|
}
|
|
35
37
|
export interface GoogleSheetWriteArrayResponse extends GoogleSheetResponse {
|
|
@@ -20,7 +20,7 @@ export interface PerplexityResponse {
|
|
|
20
20
|
export type InvocationType = 'RequestResponse' | 'Event' | 'DryRun';
|
|
21
21
|
export interface LambdaResponse {
|
|
22
22
|
statusCode: number;
|
|
23
|
-
[key: string]:
|
|
23
|
+
[key: string]: unknown;
|
|
24
24
|
}
|
|
25
25
|
export interface SlackApiResponse {
|
|
26
26
|
ok: boolean;
|