@cossistant/types 0.0.25 → 0.0.28

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,434 @@
1
+ import { z } from "@hono/zod-openapi";
2
+
3
+ //#region src/api/knowledge.ts
4
+ const knowledgeTypeSchema = z.enum([
5
+ "url",
6
+ "faq",
7
+ "article"
8
+ ]).openapi({
9
+ description: "Knowledge entry type",
10
+ example: "url"
11
+ });
12
+ const headingSchema = z.object({
13
+ level: z.number().int().min(1).max(6).openapi({
14
+ description: "Heading level (1-6)",
15
+ example: 2
16
+ }),
17
+ text: z.string().min(1).openapi({
18
+ description: "Heading text content",
19
+ example: "Getting started"
20
+ })
21
+ });
22
+ const linkSchema = z.url().openapi({
23
+ description: "Absolute URL discovered in the document",
24
+ example: "https://docs.cossistant.com/guide"
25
+ });
26
+ const imageSchema = z.object({
27
+ src: z.url().openapi({
28
+ description: "Image URL captured during scraping",
29
+ example: "https://cdn.cossistant.com/assets/hero.png"
30
+ }),
31
+ alt: z.string().nullable().openapi({
32
+ description: "Optional alt text attached to the image",
33
+ example: "Agent dashboard hero illustration"
34
+ })
35
+ });
36
+ const urlKnowledgePayloadSchema = z.object({
37
+ markdown: z.string().min(1).openapi({
38
+ description: "Scraped markdown body",
39
+ example: "# Welcome to the Help Center"
40
+ }),
41
+ headings: z.array(headingSchema).default([]),
42
+ links: z.array(linkSchema).default([]),
43
+ images: z.array(imageSchema).default([]),
44
+ estimatedTokens: z.number().int().nonnegative().optional().openapi({
45
+ description: "Heuristic token count to assist chunking",
46
+ example: 2048
47
+ })
48
+ }).openapi({ description: "Structured payload for raw page content" });
49
+ const faqKnowledgePayloadSchema = z.object({
50
+ question: z.string().min(1).openapi({
51
+ description: "FAQ question",
52
+ example: "How do I reset my password?"
53
+ }),
54
+ answer: z.string().min(1).openapi({
55
+ description: "Answer shown to customers",
56
+ example: "Go to Settings → Security and click Reset password."
57
+ }),
58
+ categories: z.array(z.string()).default([]),
59
+ relatedQuestions: z.array(z.string()).default([])
60
+ }).openapi({ description: "Payload describing a single FAQ entry" });
61
+ const articleKnowledgePayloadSchema = z.object({
62
+ title: z.string().min(1).openapi({
63
+ description: "Article title",
64
+ example: "Billing and invoicing overview"
65
+ }),
66
+ summary: z.string().nullable().optional().openapi({
67
+ description: "Short synopsis or excerpt",
68
+ example: "Understand how billing cycles and invoices are generated."
69
+ }),
70
+ markdown: z.string().min(1).openapi({
71
+ description: "Article body in markdown format",
72
+ example: "## Billing cycles\n\nCossistant bills you monthly..."
73
+ }),
74
+ keywords: z.array(z.string()).default([]),
75
+ heroImage: imageSchema.optional()
76
+ }).openapi({ description: "Payload describing a full article or help doc" });
77
+ const metadataSchema = z.record(z.string(), z.unknown()).optional().openapi({
78
+ description: "Arbitrary metadata such as locale or crawl depth",
79
+ example: {
80
+ locale: "en-US",
81
+ source: "firecrawl"
82
+ }
83
+ });
84
+ const baseKnowledgeFields = {
85
+ organizationId: z.ulid().openapi({
86
+ description: "Owning organization identifier",
87
+ example: "01JG000000000000000000000"
88
+ }),
89
+ websiteId: z.ulid().openapi({
90
+ description: "Website identifier",
91
+ example: "01JG000000000000000000001"
92
+ }),
93
+ aiAgentId: z.ulid().nullable().optional().openapi({
94
+ description: "Optional AI agent identifier; null/omitted means the entry is shared at the website scope.",
95
+ example: "01JG000000000000000000002"
96
+ }),
97
+ sourceUrl: z.url().nullable().openapi({
98
+ description: "Origin URL for this entry (required for url knowledge; optional for others)",
99
+ example: "https://docs.cossistant.com/getting-started"
100
+ }),
101
+ sourceTitle: z.string().nullable().openapi({
102
+ description: "Readable title captured during scraping",
103
+ example: "Getting started with the Cossistant dashboard"
104
+ }),
105
+ origin: z.string().min(1).openapi({
106
+ description: "Describes how this entry was created (crawl, manual, agent, etc.)",
107
+ example: "crawl"
108
+ }),
109
+ createdBy: z.string().min(1).openapi({
110
+ description: "Identifier of the actor (user, agent, system) that created this entry",
111
+ example: "user_01JG00000000000000000000"
112
+ }),
113
+ contentHash: z.string().min(1).openapi({
114
+ description: "Deterministic hash of the payload for deduping",
115
+ example: "5d41402abc4b2a76b9719d911017c592"
116
+ }),
117
+ metadata: metadataSchema
118
+ };
119
+ const urlKnowledgeSchema = z.object(baseKnowledgeFields).extend({
120
+ type: z.literal("url"),
121
+ sourceUrl: z.url(),
122
+ payload: urlKnowledgePayloadSchema
123
+ }).openapi({ description: "URL knowledge entry" });
124
+ const faqKnowledgeSchema = z.object(baseKnowledgeFields).extend({
125
+ type: z.literal("faq"),
126
+ payload: faqKnowledgePayloadSchema
127
+ }).openapi({ description: "FAQ knowledge entry" });
128
+ const articleKnowledgeSchema = z.object(baseKnowledgeFields).extend({
129
+ type: z.literal("article"),
130
+ sourceUrl: z.url().nullable(),
131
+ payload: articleKnowledgePayloadSchema
132
+ }).openapi({ description: "Article knowledge entry" });
133
+ const knowledgeCreateSchema = z.discriminatedUnion("type", [
134
+ urlKnowledgeSchema,
135
+ faqKnowledgeSchema,
136
+ articleKnowledgeSchema
137
+ ]);
138
+ const knowledgeAuditFieldsSchema = z.object({
139
+ id: z.ulid().openapi({
140
+ description: "Knowledge entry identifier",
141
+ example: "01JG00000000000000000000A"
142
+ }),
143
+ createdAt: z.string().openapi({
144
+ description: "Creation timestamp",
145
+ example: "2024-06-10T12:00:00.000Z"
146
+ }),
147
+ updatedAt: z.string().openapi({
148
+ description: "Last update timestamp",
149
+ example: "2024-06-11T08:00:00.000Z"
150
+ }),
151
+ deletedAt: z.string().nullable().openapi({
152
+ description: "Soft delete timestamp",
153
+ example: null
154
+ })
155
+ });
156
+ const knowledgeSchema = knowledgeCreateSchema.and(knowledgeAuditFieldsSchema).openapi({ description: "Persisted knowledge entry" });
157
+ /**
158
+ * Knowledge response schema - used for single item responses
159
+ */
160
+ const knowledgeResponseSchema = z.object({
161
+ id: z.ulid().openapi({
162
+ description: "Knowledge entry identifier",
163
+ example: "01JG00000000000000000000A"
164
+ }),
165
+ organizationId: z.ulid().openapi({
166
+ description: "Owning organization identifier",
167
+ example: "01JG000000000000000000000"
168
+ }),
169
+ websiteId: z.ulid().openapi({
170
+ description: "Website identifier",
171
+ example: "01JG000000000000000000001"
172
+ }),
173
+ aiAgentId: z.ulid().nullable().openapi({
174
+ description: "Optional AI agent identifier; null means shared at website scope",
175
+ example: "01JG000000000000000000002"
176
+ }),
177
+ type: knowledgeTypeSchema,
178
+ sourceUrl: z.url().nullable().openapi({
179
+ description: "Origin URL for this entry",
180
+ example: "https://docs.cossistant.com/getting-started"
181
+ }),
182
+ sourceTitle: z.string().nullable().openapi({
183
+ description: "Readable title captured during scraping",
184
+ example: "Getting started with the Cossistant dashboard"
185
+ }),
186
+ origin: z.string().openapi({
187
+ description: "How this entry was created (crawl, manual, agent, etc.)",
188
+ example: "crawl"
189
+ }),
190
+ createdBy: z.string().openapi({
191
+ description: "Identifier of the actor that created this entry",
192
+ example: "user_01JG00000000000000000000"
193
+ }),
194
+ contentHash: z.string().openapi({
195
+ description: "Deterministic hash of the payload for deduping",
196
+ example: "5d41402abc4b2a76b9719d911017c592"
197
+ }),
198
+ payload: z.union([
199
+ urlKnowledgePayloadSchema,
200
+ faqKnowledgePayloadSchema,
201
+ articleKnowledgePayloadSchema
202
+ ]),
203
+ metadata: metadataSchema,
204
+ createdAt: z.string().openapi({
205
+ description: "Creation timestamp",
206
+ example: "2024-06-10T12:00:00.000Z"
207
+ }),
208
+ updatedAt: z.string().openapi({
209
+ description: "Last update timestamp",
210
+ example: "2024-06-11T08:00:00.000Z"
211
+ }),
212
+ deletedAt: z.string().nullable().openapi({
213
+ description: "Soft delete timestamp",
214
+ example: null
215
+ })
216
+ }).openapi({ description: "Knowledge entry response" });
217
+ /**
218
+ * List knowledge request schema (TRPC) - with websiteSlug
219
+ */
220
+ const listKnowledgeRequestSchema = z.object({
221
+ websiteSlug: z.string().openapi({
222
+ description: "The website slug to list knowledge for",
223
+ example: "my-website"
224
+ }),
225
+ type: knowledgeTypeSchema.optional().openapi({
226
+ description: "Filter by knowledge type",
227
+ example: "url"
228
+ }),
229
+ aiAgentId: z.ulid().nullable().optional().openapi({
230
+ description: "Filter by AI agent ID; null for shared entries; omit for all",
231
+ example: "01JG000000000000000000002"
232
+ }),
233
+ page: z.coerce.number().int().positive().default(1).openapi({
234
+ description: "Page number (1-indexed)",
235
+ example: 1
236
+ }),
237
+ limit: z.coerce.number().int().positive().max(100).default(20).openapi({
238
+ description: "Items per page (max 100)",
239
+ example: 20
240
+ })
241
+ }).openapi({ description: "Request to list knowledge entries with filters and pagination" });
242
+ /**
243
+ * List knowledge request schema (REST) - without websiteSlug (derived from API key)
244
+ */
245
+ const listKnowledgeRestRequestSchema = z.object({
246
+ type: knowledgeTypeSchema.optional().openapi({
247
+ description: "Filter by knowledge type",
248
+ example: "url"
249
+ }),
250
+ aiAgentId: z.union([
251
+ z.ulid(),
252
+ z.literal("null"),
253
+ z.literal("")
254
+ ]).optional().openapi({
255
+ description: "Filter by AI agent ID. Pass a valid ULID to filter by agent, pass \"null\" or empty string to filter for shared/website-scoped entries only, or omit entirely to return all entries.",
256
+ example: "01JG000000000000000000002"
257
+ }),
258
+ page: z.coerce.number().int().positive().default(1).openapi({
259
+ description: "Page number (1-indexed)",
260
+ example: 1
261
+ }),
262
+ limit: z.coerce.number().int().positive().max(100).default(20).openapi({
263
+ description: "Items per page (max 100)",
264
+ example: 20
265
+ })
266
+ }).openapi({ description: "Request to list knowledge entries with filters and pagination (REST)" });
267
+ /**
268
+ * List knowledge response schema
269
+ */
270
+ const listKnowledgeResponseSchema = z.object({
271
+ items: z.array(knowledgeResponseSchema).openapi({ description: "Array of knowledge entries" }),
272
+ pagination: z.object({
273
+ page: z.number().int().positive().openapi({
274
+ description: "Current page number",
275
+ example: 1
276
+ }),
277
+ limit: z.number().int().positive().openapi({
278
+ description: "Items per page",
279
+ example: 20
280
+ }),
281
+ total: z.number().int().nonnegative().openapi({
282
+ description: "Total number of items",
283
+ example: 100
284
+ }),
285
+ hasMore: z.boolean().openapi({
286
+ description: "Whether there are more items available",
287
+ example: true
288
+ })
289
+ }).openapi({ description: "Pagination metadata" })
290
+ }).openapi({ description: "Paginated list of knowledge entries" });
291
+ /**
292
+ * Get knowledge request schema (TRPC)
293
+ */
294
+ const getKnowledgeRequestSchema = z.object({
295
+ websiteSlug: z.string().openapi({
296
+ description: "The website slug",
297
+ example: "my-website"
298
+ }),
299
+ id: z.ulid().openapi({
300
+ description: "Knowledge entry ID",
301
+ example: "01JG00000000000000000000A"
302
+ })
303
+ }).openapi({ description: "Request to get a single knowledge entry" });
304
+ /**
305
+ * Create knowledge request schema (TRPC) - extends create input with websiteSlug
306
+ */
307
+ const createKnowledgeRequestSchema = z.object({
308
+ websiteSlug: z.string().openapi({
309
+ description: "The website slug to create knowledge for",
310
+ example: "my-website"
311
+ }),
312
+ aiAgentId: z.ulid().nullable().optional().openapi({
313
+ description: "Optional AI agent ID; null/omit for shared at website scope",
314
+ example: "01JG000000000000000000002"
315
+ }),
316
+ type: knowledgeTypeSchema,
317
+ sourceUrl: z.url().nullable().optional().openapi({
318
+ description: "Origin URL for this entry",
319
+ example: "https://docs.cossistant.com/getting-started"
320
+ }),
321
+ sourceTitle: z.string().nullable().optional().openapi({
322
+ description: "Readable title",
323
+ example: "Getting started with the Cossistant dashboard"
324
+ }),
325
+ origin: z.string().min(1).openapi({
326
+ description: "How this entry was created (crawl, manual, agent, etc.)",
327
+ example: "manual"
328
+ }),
329
+ payload: z.union([
330
+ urlKnowledgePayloadSchema,
331
+ faqKnowledgePayloadSchema,
332
+ articleKnowledgePayloadSchema
333
+ ]),
334
+ metadata: metadataSchema
335
+ }).openapi({ description: "Request to create a new knowledge entry" });
336
+ /**
337
+ * Create knowledge request schema (REST) - without websiteSlug
338
+ */
339
+ const createKnowledgeRestRequestSchema = z.object({
340
+ aiAgentId: z.ulid().nullable().optional().openapi({
341
+ description: "Optional AI agent ID; null/omit for shared at website scope",
342
+ example: "01JG000000000000000000002"
343
+ }),
344
+ type: knowledgeTypeSchema,
345
+ sourceUrl: z.url().nullable().optional().openapi({
346
+ description: "Origin URL for this entry",
347
+ example: "https://docs.cossistant.com/getting-started"
348
+ }),
349
+ sourceTitle: z.string().nullable().optional().openapi({
350
+ description: "Readable title",
351
+ example: "Getting started with the Cossistant dashboard"
352
+ }),
353
+ origin: z.string().min(1).openapi({
354
+ description: "How this entry was created (crawl, manual, agent, etc.)",
355
+ example: "manual"
356
+ }),
357
+ payload: z.union([
358
+ urlKnowledgePayloadSchema,
359
+ faqKnowledgePayloadSchema,
360
+ articleKnowledgePayloadSchema
361
+ ]),
362
+ metadata: metadataSchema
363
+ }).openapi({ description: "Request to create a new knowledge entry (REST)" });
364
+ /**
365
+ * Update knowledge request schema (TRPC)
366
+ */
367
+ const updateKnowledgeRequestSchema = z.object({
368
+ websiteSlug: z.string().openapi({
369
+ description: "The website slug",
370
+ example: "my-website"
371
+ }),
372
+ id: z.ulid().openapi({
373
+ description: "Knowledge entry ID to update",
374
+ example: "01JG00000000000000000000A"
375
+ }),
376
+ aiAgentId: z.ulid().nullable().optional().openapi({
377
+ description: "Update AI agent association",
378
+ example: "01JG000000000000000000002"
379
+ }),
380
+ sourceUrl: z.url().nullable().optional().openapi({
381
+ description: "Update origin URL",
382
+ example: "https://docs.cossistant.com/getting-started"
383
+ }),
384
+ sourceTitle: z.string().nullable().optional().openapi({
385
+ description: "Update readable title",
386
+ example: "Getting started with the Cossistant dashboard"
387
+ }),
388
+ payload: z.union([
389
+ urlKnowledgePayloadSchema,
390
+ faqKnowledgePayloadSchema,
391
+ articleKnowledgePayloadSchema
392
+ ]).optional(),
393
+ metadata: metadataSchema
394
+ }).openapi({ description: "Request to update an existing knowledge entry" });
395
+ /**
396
+ * Update knowledge request schema (REST) - without websiteSlug
397
+ */
398
+ const updateKnowledgeRestRequestSchema = z.object({
399
+ aiAgentId: z.ulid().nullable().optional().openapi({
400
+ description: "Update AI agent association",
401
+ example: "01JG000000000000000000002"
402
+ }),
403
+ sourceUrl: z.url().nullable().optional().openapi({
404
+ description: "Update origin URL",
405
+ example: "https://docs.cossistant.com/getting-started"
406
+ }),
407
+ sourceTitle: z.string().nullable().optional().openapi({
408
+ description: "Update readable title",
409
+ example: "Getting started with the Cossistant dashboard"
410
+ }),
411
+ payload: z.union([
412
+ urlKnowledgePayloadSchema,
413
+ faqKnowledgePayloadSchema,
414
+ articleKnowledgePayloadSchema
415
+ ]).optional(),
416
+ metadata: metadataSchema
417
+ }).openapi({ description: "Request to update an existing knowledge entry (REST)" });
418
+ /**
419
+ * Delete knowledge request schema (TRPC)
420
+ */
421
+ const deleteKnowledgeRequestSchema = z.object({
422
+ websiteSlug: z.string().openapi({
423
+ description: "The website slug",
424
+ example: "my-website"
425
+ }),
426
+ id: z.ulid().openapi({
427
+ description: "Knowledge entry ID to delete",
428
+ example: "01JG00000000000000000000A"
429
+ })
430
+ }).openapi({ description: "Request to delete a knowledge entry" });
431
+
432
+ //#endregion
433
+ export { articleKnowledgePayloadSchema, createKnowledgeRequestSchema, createKnowledgeRestRequestSchema, deleteKnowledgeRequestSchema, faqKnowledgePayloadSchema, getKnowledgeRequestSchema, knowledgeCreateSchema, knowledgeResponseSchema, knowledgeSchema, knowledgeTypeSchema, listKnowledgeRequestSchema, listKnowledgeResponseSchema, listKnowledgeRestRequestSchema, updateKnowledgeRequestSchema, updateKnowledgeRestRequestSchema, urlKnowledgePayloadSchema };
434
+ //# sourceMappingURL=knowledge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"knowledge.js","names":[],"sources":["../../src/api/knowledge.ts"],"sourcesContent":["import { z } from \"@hono/zod-openapi\";\n\nexport const knowledgeTypeSchema = z.enum([\"url\", \"faq\", \"article\"]).openapi({\n\tdescription: \"Knowledge entry type\",\n\texample: \"url\",\n});\n\nconst headingSchema = z.object({\n\tlevel: z.number().int().min(1).max(6).openapi({\n\t\tdescription: \"Heading level (1-6)\",\n\t\texample: 2,\n\t}),\n\ttext: z.string().min(1).openapi({\n\t\tdescription: \"Heading text content\",\n\t\texample: \"Getting started\",\n\t}),\n});\n\nconst linkSchema = z.url().openapi({\n\tdescription: \"Absolute URL discovered in the document\",\n\texample: \"https://docs.cossistant.com/guide\",\n});\n\nconst imageSchema = z.object({\n\tsrc: z.url().openapi({\n\t\tdescription: \"Image URL captured during scraping\",\n\t\texample: \"https://cdn.cossistant.com/assets/hero.png\",\n\t}),\n\talt: z.string().nullable().openapi({\n\t\tdescription: \"Optional alt text attached to the image\",\n\t\texample: \"Agent dashboard hero illustration\",\n\t}),\n});\n\nexport const urlKnowledgePayloadSchema = z\n\t.object({\n\t\tmarkdown: z.string().min(1).openapi({\n\t\t\tdescription: \"Scraped markdown body\",\n\t\t\texample: \"# Welcome to the Help Center\",\n\t\t}),\n\t\theadings: z.array(headingSchema).default([]),\n\t\tlinks: z.array(linkSchema).default([]),\n\t\timages: z.array(imageSchema).default([]),\n\t\testimatedTokens: z.number().int().nonnegative().optional().openapi({\n\t\t\tdescription: \"Heuristic token count to assist chunking\",\n\t\t\texample: 2048,\n\t\t}),\n\t})\n\t.openapi({\n\t\tdescription: \"Structured payload for raw page content\",\n\t});\n\nexport const faqKnowledgePayloadSchema = z\n\t.object({\n\t\tquestion: z.string().min(1).openapi({\n\t\t\tdescription: \"FAQ question\",\n\t\t\texample: \"How do I reset my password?\",\n\t\t}),\n\t\tanswer: z.string().min(1).openapi({\n\t\t\tdescription: \"Answer shown to customers\",\n\t\t\texample: \"Go to Settings → Security and click Reset password.\",\n\t\t}),\n\t\tcategories: z.array(z.string()).default([]),\n\t\trelatedQuestions: z.array(z.string()).default([]),\n\t})\n\t.openapi({\n\t\tdescription: \"Payload describing a single FAQ entry\",\n\t});\n\nexport const articleKnowledgePayloadSchema = z\n\t.object({\n\t\ttitle: z.string().min(1).openapi({\n\t\t\tdescription: \"Article title\",\n\t\t\texample: \"Billing and invoicing overview\",\n\t\t}),\n\t\tsummary: z.string().nullable().optional().openapi({\n\t\t\tdescription: \"Short synopsis or excerpt\",\n\t\t\texample: \"Understand how billing cycles and invoices are generated.\",\n\t\t}),\n\t\tmarkdown: z.string().min(1).openapi({\n\t\t\tdescription: \"Article body in markdown format\",\n\t\t\texample: \"## Billing cycles\\n\\nCossistant bills you monthly...\",\n\t\t}),\n\t\tkeywords: z.array(z.string()).default([]),\n\t\theroImage: imageSchema.optional(),\n\t})\n\t.openapi({\n\t\tdescription: \"Payload describing a full article or help doc\",\n\t});\n\nconst metadataSchema = z\n\t.record(z.string(), z.unknown())\n\t.optional()\n\t.openapi({\n\t\tdescription: \"Arbitrary metadata such as locale or crawl depth\",\n\t\texample: {\n\t\t\tlocale: \"en-US\",\n\t\t\tsource: \"firecrawl\",\n\t\t},\n\t});\n\nconst baseKnowledgeFields = {\n\torganizationId: z.ulid().openapi({\n\t\tdescription: \"Owning organization identifier\",\n\t\texample: \"01JG000000000000000000000\",\n\t}),\n\twebsiteId: z.ulid().openapi({\n\t\tdescription: \"Website identifier\",\n\t\texample: \"01JG000000000000000000001\",\n\t}),\n\taiAgentId: z.ulid().nullable().optional().openapi({\n\t\tdescription:\n\t\t\t\"Optional AI agent identifier; null/omitted means the entry is shared at the website scope.\",\n\t\texample: \"01JG000000000000000000002\",\n\t}),\n\tsourceUrl: z.url().nullable().openapi({\n\t\tdescription:\n\t\t\t\"Origin URL for this entry (required for url knowledge; optional for others)\",\n\t\texample: \"https://docs.cossistant.com/getting-started\",\n\t}),\n\tsourceTitle: z.string().nullable().openapi({\n\t\tdescription: \"Readable title captured during scraping\",\n\t\texample: \"Getting started with the Cossistant dashboard\",\n\t}),\n\torigin: z.string().min(1).openapi({\n\t\tdescription:\n\t\t\t\"Describes how this entry was created (crawl, manual, agent, etc.)\",\n\t\texample: \"crawl\",\n\t}),\n\tcreatedBy: z.string().min(1).openapi({\n\t\tdescription:\n\t\t\t\"Identifier of the actor (user, agent, system) that created this entry\",\n\t\texample: \"user_01JG00000000000000000000\",\n\t}),\n\tcontentHash: z.string().min(1).openapi({\n\t\tdescription: \"Deterministic hash of the payload for deduping\",\n\t\texample: \"5d41402abc4b2a76b9719d911017c592\",\n\t}),\n\tmetadata: metadataSchema,\n};\n\nconst urlKnowledgeSchema = z\n\t.object(baseKnowledgeFields)\n\t.extend({\n\t\ttype: z.literal(\"url\"),\n\t\tsourceUrl: z.url(),\n\t\tpayload: urlKnowledgePayloadSchema,\n\t})\n\t.openapi({ description: \"URL knowledge entry\" });\n\nconst faqKnowledgeSchema = z\n\t.object(baseKnowledgeFields)\n\t.extend({\n\t\ttype: z.literal(\"faq\"),\n\t\tpayload: faqKnowledgePayloadSchema,\n\t})\n\t.openapi({ description: \"FAQ knowledge entry\" });\n\nconst articleKnowledgeSchema = z\n\t.object(baseKnowledgeFields)\n\t.extend({\n\t\ttype: z.literal(\"article\"),\n\t\tsourceUrl: z.url().nullable(),\n\t\tpayload: articleKnowledgePayloadSchema,\n\t})\n\t.openapi({ description: \"Article knowledge entry\" });\n\nexport const knowledgeCreateSchema = z.discriminatedUnion(\"type\", [\n\turlKnowledgeSchema,\n\tfaqKnowledgeSchema,\n\tarticleKnowledgeSchema,\n]);\n\nconst knowledgeAuditFieldsSchema = z.object({\n\tid: z.ulid().openapi({\n\t\tdescription: \"Knowledge entry identifier\",\n\t\texample: \"01JG00000000000000000000A\",\n\t}),\n\tcreatedAt: z.string().openapi({\n\t\tdescription: \"Creation timestamp\",\n\t\texample: \"2024-06-10T12:00:00.000Z\",\n\t}),\n\tupdatedAt: z.string().openapi({\n\t\tdescription: \"Last update timestamp\",\n\t\texample: \"2024-06-11T08:00:00.000Z\",\n\t}),\n\tdeletedAt: z.string().nullable().openapi({\n\t\tdescription: \"Soft delete timestamp\",\n\t\texample: null,\n\t}),\n});\n\nexport const knowledgeSchema = knowledgeCreateSchema\n\t// Intersection preserves the discriminated union while adding persisted fields.\n\t.and(knowledgeAuditFieldsSchema)\n\t.openapi({\n\t\tdescription: \"Persisted knowledge entry\",\n\t});\n\nexport type KnowledgeType = z.infer<typeof knowledgeTypeSchema>;\nexport type UrlKnowledgePayload = z.infer<typeof urlKnowledgePayloadSchema>;\nexport type FaqKnowledgePayload = z.infer<typeof faqKnowledgePayloadSchema>;\nexport type ArticleKnowledgePayload = z.infer<\n\ttypeof articleKnowledgePayloadSchema\n>;\nexport type KnowledgeCreateInput = z.infer<typeof knowledgeCreateSchema>;\nexport type Knowledge = z.infer<typeof knowledgeSchema>;\n\n// ============================================================================\n// API Request/Response Schemas\n// ============================================================================\n\n/**\n * Knowledge response schema - used for single item responses\n */\nexport const knowledgeResponseSchema = z\n\t.object({\n\t\tid: z.ulid().openapi({\n\t\t\tdescription: \"Knowledge entry identifier\",\n\t\t\texample: \"01JG00000000000000000000A\",\n\t\t}),\n\t\torganizationId: z.ulid().openapi({\n\t\t\tdescription: \"Owning organization identifier\",\n\t\t\texample: \"01JG000000000000000000000\",\n\t\t}),\n\t\twebsiteId: z.ulid().openapi({\n\t\t\tdescription: \"Website identifier\",\n\t\t\texample: \"01JG000000000000000000001\",\n\t\t}),\n\t\taiAgentId: z.ulid().nullable().openapi({\n\t\t\tdescription:\n\t\t\t\t\"Optional AI agent identifier; null means shared at website scope\",\n\t\t\texample: \"01JG000000000000000000002\",\n\t\t}),\n\t\ttype: knowledgeTypeSchema,\n\t\tsourceUrl: z.url().nullable().openapi({\n\t\t\tdescription: \"Origin URL for this entry\",\n\t\t\texample: \"https://docs.cossistant.com/getting-started\",\n\t\t}),\n\t\tsourceTitle: z.string().nullable().openapi({\n\t\t\tdescription: \"Readable title captured during scraping\",\n\t\t\texample: \"Getting started with the Cossistant dashboard\",\n\t\t}),\n\t\torigin: z.string().openapi({\n\t\t\tdescription: \"How this entry was created (crawl, manual, agent, etc.)\",\n\t\t\texample: \"crawl\",\n\t\t}),\n\t\tcreatedBy: z.string().openapi({\n\t\t\tdescription: \"Identifier of the actor that created this entry\",\n\t\t\texample: \"user_01JG00000000000000000000\",\n\t\t}),\n\t\tcontentHash: z.string().openapi({\n\t\t\tdescription: \"Deterministic hash of the payload for deduping\",\n\t\t\texample: \"5d41402abc4b2a76b9719d911017c592\",\n\t\t}),\n\t\tpayload: z.union([\n\t\t\turlKnowledgePayloadSchema,\n\t\t\tfaqKnowledgePayloadSchema,\n\t\t\tarticleKnowledgePayloadSchema,\n\t\t]),\n\t\tmetadata: metadataSchema,\n\t\tcreatedAt: z.string().openapi({\n\t\t\tdescription: \"Creation timestamp\",\n\t\t\texample: \"2024-06-10T12:00:00.000Z\",\n\t\t}),\n\t\tupdatedAt: z.string().openapi({\n\t\t\tdescription: \"Last update timestamp\",\n\t\t\texample: \"2024-06-11T08:00:00.000Z\",\n\t\t}),\n\t\tdeletedAt: z.string().nullable().openapi({\n\t\t\tdescription: \"Soft delete timestamp\",\n\t\t\texample: null,\n\t\t}),\n\t})\n\t.openapi({\n\t\tdescription: \"Knowledge entry response\",\n\t});\n\nexport type KnowledgeResponse = z.infer<typeof knowledgeResponseSchema>;\n\n/**\n * List knowledge request schema (TRPC) - with websiteSlug\n */\nexport const listKnowledgeRequestSchema = z\n\t.object({\n\t\twebsiteSlug: z.string().openapi({\n\t\t\tdescription: \"The website slug to list knowledge for\",\n\t\t\texample: \"my-website\",\n\t\t}),\n\t\ttype: knowledgeTypeSchema.optional().openapi({\n\t\t\tdescription: \"Filter by knowledge type\",\n\t\t\texample: \"url\",\n\t\t}),\n\t\taiAgentId: z.ulid().nullable().optional().openapi({\n\t\t\tdescription:\n\t\t\t\t\"Filter by AI agent ID; null for shared entries; omit for all\",\n\t\t\texample: \"01JG000000000000000000002\",\n\t\t}),\n\t\tpage: z.coerce.number().int().positive().default(1).openapi({\n\t\t\tdescription: \"Page number (1-indexed)\",\n\t\t\texample: 1,\n\t\t}),\n\t\tlimit: z.coerce.number().int().positive().max(100).default(20).openapi({\n\t\t\tdescription: \"Items per page (max 100)\",\n\t\t\texample: 20,\n\t\t}),\n\t})\n\t.openapi({\n\t\tdescription:\n\t\t\t\"Request to list knowledge entries with filters and pagination\",\n\t});\n\nexport type ListKnowledgeRequest = z.infer<typeof listKnowledgeRequestSchema>;\n\n/**\n * List knowledge request schema (REST) - without websiteSlug (derived from API key)\n */\nexport const listKnowledgeRestRequestSchema = z\n\t.object({\n\t\ttype: knowledgeTypeSchema.optional().openapi({\n\t\t\tdescription: \"Filter by knowledge type\",\n\t\t\texample: \"url\",\n\t\t}),\n\t\taiAgentId: z\n\t\t\t.union([z.ulid(), z.literal(\"null\"), z.literal(\"\")])\n\t\t\t.optional()\n\t\t\t.openapi({\n\t\t\t\tdescription:\n\t\t\t\t\t'Filter by AI agent ID. Pass a valid ULID to filter by agent, pass \"null\" or empty string to filter for shared/website-scoped entries only, or omit entirely to return all entries.',\n\t\t\t\texample: \"01JG000000000000000000002\",\n\t\t\t}),\n\t\tpage: z.coerce.number().int().positive().default(1).openapi({\n\t\t\tdescription: \"Page number (1-indexed)\",\n\t\t\texample: 1,\n\t\t}),\n\t\tlimit: z.coerce.number().int().positive().max(100).default(20).openapi({\n\t\t\tdescription: \"Items per page (max 100)\",\n\t\t\texample: 20,\n\t\t}),\n\t})\n\t.openapi({\n\t\tdescription:\n\t\t\t\"Request to list knowledge entries with filters and pagination (REST)\",\n\t});\n\nexport type ListKnowledgeRestRequest = z.infer<\n\ttypeof listKnowledgeRestRequestSchema\n>;\n\n/**\n * List knowledge response schema\n */\nexport const listKnowledgeResponseSchema = z\n\t.object({\n\t\titems: z.array(knowledgeResponseSchema).openapi({\n\t\t\tdescription: \"Array of knowledge entries\",\n\t\t}),\n\t\tpagination: z\n\t\t\t.object({\n\t\t\t\tpage: z.number().int().positive().openapi({\n\t\t\t\t\tdescription: \"Current page number\",\n\t\t\t\t\texample: 1,\n\t\t\t\t}),\n\t\t\t\tlimit: z.number().int().positive().openapi({\n\t\t\t\t\tdescription: \"Items per page\",\n\t\t\t\t\texample: 20,\n\t\t\t\t}),\n\t\t\t\ttotal: z.number().int().nonnegative().openapi({\n\t\t\t\t\tdescription: \"Total number of items\",\n\t\t\t\t\texample: 100,\n\t\t\t\t}),\n\t\t\t\thasMore: z.boolean().openapi({\n\t\t\t\t\tdescription: \"Whether there are more items available\",\n\t\t\t\t\texample: true,\n\t\t\t\t}),\n\t\t\t})\n\t\t\t.openapi({\n\t\t\t\tdescription: \"Pagination metadata\",\n\t\t\t}),\n\t})\n\t.openapi({\n\t\tdescription: \"Paginated list of knowledge entries\",\n\t});\n\nexport type ListKnowledgeResponse = z.infer<typeof listKnowledgeResponseSchema>;\n\n/**\n * Get knowledge request schema (TRPC)\n */\nexport const getKnowledgeRequestSchema = z\n\t.object({\n\t\twebsiteSlug: z.string().openapi({\n\t\t\tdescription: \"The website slug\",\n\t\t\texample: \"my-website\",\n\t\t}),\n\t\tid: z.ulid().openapi({\n\t\t\tdescription: \"Knowledge entry ID\",\n\t\t\texample: \"01JG00000000000000000000A\",\n\t\t}),\n\t})\n\t.openapi({\n\t\tdescription: \"Request to get a single knowledge entry\",\n\t});\n\nexport type GetKnowledgeRequest = z.infer<typeof getKnowledgeRequestSchema>;\n\n/**\n * Create knowledge request schema (TRPC) - extends create input with websiteSlug\n */\nexport const createKnowledgeRequestSchema = z\n\t.object({\n\t\twebsiteSlug: z.string().openapi({\n\t\t\tdescription: \"The website slug to create knowledge for\",\n\t\t\texample: \"my-website\",\n\t\t}),\n\t\taiAgentId: z.ulid().nullable().optional().openapi({\n\t\t\tdescription:\n\t\t\t\t\"Optional AI agent ID; null/omit for shared at website scope\",\n\t\t\texample: \"01JG000000000000000000002\",\n\t\t}),\n\t\ttype: knowledgeTypeSchema,\n\t\tsourceUrl: z.url().nullable().optional().openapi({\n\t\t\tdescription: \"Origin URL for this entry\",\n\t\t\texample: \"https://docs.cossistant.com/getting-started\",\n\t\t}),\n\t\tsourceTitle: z.string().nullable().optional().openapi({\n\t\t\tdescription: \"Readable title\",\n\t\t\texample: \"Getting started with the Cossistant dashboard\",\n\t\t}),\n\t\torigin: z.string().min(1).openapi({\n\t\t\tdescription: \"How this entry was created (crawl, manual, agent, etc.)\",\n\t\t\texample: \"manual\",\n\t\t}),\n\t\tpayload: z.union([\n\t\t\turlKnowledgePayloadSchema,\n\t\t\tfaqKnowledgePayloadSchema,\n\t\t\tarticleKnowledgePayloadSchema,\n\t\t]),\n\t\tmetadata: metadataSchema,\n\t})\n\t.openapi({\n\t\tdescription: \"Request to create a new knowledge entry\",\n\t});\n\nexport type CreateKnowledgeRequest = z.infer<\n\ttypeof createKnowledgeRequestSchema\n>;\n\n/**\n * Create knowledge request schema (REST) - without websiteSlug\n */\nexport const createKnowledgeRestRequestSchema = z\n\t.object({\n\t\taiAgentId: z.ulid().nullable().optional().openapi({\n\t\t\tdescription:\n\t\t\t\t\"Optional AI agent ID; null/omit for shared at website scope\",\n\t\t\texample: \"01JG000000000000000000002\",\n\t\t}),\n\t\ttype: knowledgeTypeSchema,\n\t\tsourceUrl: z.url().nullable().optional().openapi({\n\t\t\tdescription: \"Origin URL for this entry\",\n\t\t\texample: \"https://docs.cossistant.com/getting-started\",\n\t\t}),\n\t\tsourceTitle: z.string().nullable().optional().openapi({\n\t\t\tdescription: \"Readable title\",\n\t\t\texample: \"Getting started with the Cossistant dashboard\",\n\t\t}),\n\t\torigin: z.string().min(1).openapi({\n\t\t\tdescription: \"How this entry was created (crawl, manual, agent, etc.)\",\n\t\t\texample: \"manual\",\n\t\t}),\n\t\tpayload: z.union([\n\t\t\turlKnowledgePayloadSchema,\n\t\t\tfaqKnowledgePayloadSchema,\n\t\t\tarticleKnowledgePayloadSchema,\n\t\t]),\n\t\tmetadata: metadataSchema,\n\t})\n\t.openapi({\n\t\tdescription: \"Request to create a new knowledge entry (REST)\",\n\t});\n\nexport type CreateKnowledgeRestRequest = z.infer<\n\ttypeof createKnowledgeRestRequestSchema\n>;\n\n/**\n * Update knowledge request schema (TRPC)\n */\nexport const updateKnowledgeRequestSchema = z\n\t.object({\n\t\twebsiteSlug: z.string().openapi({\n\t\t\tdescription: \"The website slug\",\n\t\t\texample: \"my-website\",\n\t\t}),\n\t\tid: z.ulid().openapi({\n\t\t\tdescription: \"Knowledge entry ID to update\",\n\t\t\texample: \"01JG00000000000000000000A\",\n\t\t}),\n\t\taiAgentId: z.ulid().nullable().optional().openapi({\n\t\t\tdescription: \"Update AI agent association\",\n\t\t\texample: \"01JG000000000000000000002\",\n\t\t}),\n\t\tsourceUrl: z.url().nullable().optional().openapi({\n\t\t\tdescription: \"Update origin URL\",\n\t\t\texample: \"https://docs.cossistant.com/getting-started\",\n\t\t}),\n\t\tsourceTitle: z.string().nullable().optional().openapi({\n\t\t\tdescription: \"Update readable title\",\n\t\t\texample: \"Getting started with the Cossistant dashboard\",\n\t\t}),\n\t\tpayload: z\n\t\t\t.union([\n\t\t\t\turlKnowledgePayloadSchema,\n\t\t\t\tfaqKnowledgePayloadSchema,\n\t\t\t\tarticleKnowledgePayloadSchema,\n\t\t\t])\n\t\t\t.optional(),\n\t\tmetadata: metadataSchema,\n\t})\n\t.openapi({\n\t\tdescription: \"Request to update an existing knowledge entry\",\n\t});\n\nexport type UpdateKnowledgeRequest = z.infer<\n\ttypeof updateKnowledgeRequestSchema\n>;\n\n/**\n * Update knowledge request schema (REST) - without websiteSlug\n */\nexport const updateKnowledgeRestRequestSchema = z\n\t.object({\n\t\taiAgentId: z.ulid().nullable().optional().openapi({\n\t\t\tdescription: \"Update AI agent association\",\n\t\t\texample: \"01JG000000000000000000002\",\n\t\t}),\n\t\tsourceUrl: z.url().nullable().optional().openapi({\n\t\t\tdescription: \"Update origin URL\",\n\t\t\texample: \"https://docs.cossistant.com/getting-started\",\n\t\t}),\n\t\tsourceTitle: z.string().nullable().optional().openapi({\n\t\t\tdescription: \"Update readable title\",\n\t\t\texample: \"Getting started with the Cossistant dashboard\",\n\t\t}),\n\t\tpayload: z\n\t\t\t.union([\n\t\t\t\turlKnowledgePayloadSchema,\n\t\t\t\tfaqKnowledgePayloadSchema,\n\t\t\t\tarticleKnowledgePayloadSchema,\n\t\t\t])\n\t\t\t.optional(),\n\t\tmetadata: metadataSchema,\n\t})\n\t.openapi({\n\t\tdescription: \"Request to update an existing knowledge entry (REST)\",\n\t});\n\nexport type UpdateKnowledgeRestRequest = z.infer<\n\ttypeof updateKnowledgeRestRequestSchema\n>;\n\n/**\n * Delete knowledge request schema (TRPC)\n */\nexport const deleteKnowledgeRequestSchema = z\n\t.object({\n\t\twebsiteSlug: z.string().openapi({\n\t\t\tdescription: \"The website slug\",\n\t\t\texample: \"my-website\",\n\t\t}),\n\t\tid: z.ulid().openapi({\n\t\t\tdescription: \"Knowledge entry ID to delete\",\n\t\t\texample: \"01JG00000000000000000000A\",\n\t\t}),\n\t})\n\t.openapi({\n\t\tdescription: \"Request to delete a knowledge entry\",\n\t});\n"],"mappings":";;;AAEA,MAAa,sBAAsB,EAAE,KAAK;CAAC;CAAO;CAAO;CAAU,CAAC,CAAC,QAAQ;CAC5E,aAAa;CACb,SAAS;CACT,CAAC;AAEF,MAAM,gBAAgB,EAAE,OAAO;CAC9B,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ;EAC7C,aAAa;EACb,SAAS;EACT,CAAC;CACF,MAAM,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,QAAQ;EAC/B,aAAa;EACb,SAAS;EACT,CAAC;CACF,CAAC;AAEF,MAAM,aAAa,EAAE,KAAK,CAAC,QAAQ;CAClC,aAAa;CACb,SAAS;CACT,CAAC;AAEF,MAAM,cAAc,EAAE,OAAO;CAC5B,KAAK,EAAE,KAAK,CAAC,QAAQ;EACpB,aAAa;EACb,SAAS;EACT,CAAC;CACF,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,QAAQ;EAClC,aAAa;EACb,SAAS;EACT,CAAC;CACF,CAAC;AAEF,MAAa,4BAA4B,EACvC,OAAO;CACP,UAAU,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,QAAQ;EACnC,aAAa;EACb,SAAS;EACT,CAAC;CACF,UAAU,EAAE,MAAM,cAAc,CAAC,QAAQ,EAAE,CAAC;CAC5C,OAAO,EAAE,MAAM,WAAW,CAAC,QAA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EAChD,aAAa;EACb,SAAS;EACT,CAAC;CACF,aAAa,EAAE,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,QAAQ;EACrD,aAAa;EACb,SAAS;EACT,CAAC;CACF,SAAS,EACP,MAAM;EACN;EACA;EACA;EACA,CAAC,CACD,UAAU;CACZ,UAAU;CACV,CAAC,CACD,QAAQ,EACR,aAAa,iDACb,CAAC;;;;AASH,MAAa,mCAAmC,EAC9C,OAAO;CACP,WAAW,EAAE,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,QAAQ;EACjD,aAAa;EACb,SAAS;EACT,CAAC;CACF,WAAW,EAAE,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,QAAQ;EAChD,aAAa;EACb,SAAS;EACT,CAAC;CACF,aAAa,EAAE,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,QAAQ;EACrD,aAAa;EACb,SAAS;EACT,CAAC;CACF,SAAS,EACP,MAAM;EACN;EACA;EACA;EACA,CAAC,CACD,UAAU;CACZ,UAAU;CACV,CAAC,CACD,QAAQ,EACR,aAAa,wDACb,CAAC;;;;AASH,MAAa,+BAA+B,EAC1C,OAAO;CACP,aAAa,EAAE,QAAQ,CAAC,QAAQ;EAC/B,aAAa;EACb,SAAS;EACT,CAAC;CACF,IAAI,EAAE,MAAM,CAAC,QAAQ;EACpB,aAAa;EACb,SAAS;EACT,CAAC;CACF,CAAC,CACD,QAAQ,EACR,aAAa,uCACb,CAAC"}
package/api/upload.d.ts CHANGED
@@ -87,12 +87,12 @@ declare const generateUploadUrlRequestSchema: z.ZodObject<{
87
87
  }, z.core.$strip>;
88
88
  type GenerateUploadUrlRequest = z.infer<typeof generateUploadUrlRequestSchema>;
89
89
  declare const generateUploadUrlResponseSchema: z.ZodObject<{
90
- uploadUrl: z.ZodString;
90
+ uploadUrl: z.ZodURL;
91
91
  key: z.ZodString;
92
92
  bucket: z.ZodString;
93
93
  expiresAt: z.ZodString;
94
94
  contentType: z.ZodString;
95
- publicUrl: z.ZodString;
95
+ publicUrl: z.ZodURL;
96
96
  }, z.core.$strip>;
97
97
  type GenerateUploadUrlResponse = z.infer<typeof generateUploadUrlResponseSchema>;
98
98
  //#endregion
package/api/upload.js CHANGED
@@ -88,7 +88,7 @@ const generateUploadUrlRequestSchema = z.object({
88
88
  }).optional()
89
89
  }).openapi({ description: "Request payload to create a signed S3 upload URL." });
90
90
  const generateUploadUrlResponseSchema = z.object({
91
- uploadUrl: z.string().url().openapi({
91
+ uploadUrl: z.url().openapi({
92
92
  description: "Pre-signed URL that accepts a PUT request to upload the file to S3.",
93
93
  example: "https://example-bucket.s3.amazonaws.com/org-id/file.png?X-Amz-Signature=..."
94
94
  }),
@@ -108,7 +108,7 @@ const generateUploadUrlResponseSchema = z.object({
108
108
  description: "MIME type that should be used when uploading the file.",
109
109
  example: "image/png"
110
110
  }),
111
- publicUrl: z.string().url().openapi({
111
+ publicUrl: z.url().openapi({
112
112
  description: "Publicly accessible URL (or CDN URL when requested) that can be used to read the uploaded file.",
113
113
  example: "https://cdn.example.com/org-id/file.png"
114
114
  })
package/api/upload.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"upload.js","names":[],"sources":["../../src/api/upload.ts"],"sourcesContent":["import { z } from \"@hono/zod-openapi\";\n\nconst idSchema = z.string().min(1).max(128);\n\nexport const uploadOrganizationIdSchema = idSchema.openapi({\n\tdescription: \"Identifier of the organization that owns the uploaded file.\",\n\texample: \"org_01HZYFG9W5V6YB5R6T6V7N9M2Q\",\n});\n\nexport const uploadWebsiteIdSchema = idSchema.openapi({\n\tdescription: \"Identifier of the website associated with the uploaded file.\",\n\texample: \"site_01HZYFH3KJ3MYHJJ3JJ6Y2RNAV\",\n});\n\nexport const uploadConversationIdSchema = idSchema.openapi({\n\tdescription: \"Conversation identifier that will scope the uploaded asset.\",\n\texample: \"conv_01HZYFJ5P7DQ0VE8F68G5VYBAQ\",\n});\n\nexport const uploadUserIdSchema = idSchema.openapi({\n\tdescription: \"User identifier that will scope the uploaded asset.\",\n\texample: \"user_01HZYFKJS3K0M9W6PQZ0J6G1WR\",\n});\n\nexport const uploadContactIdSchema = idSchema.openapi({\n\tdescription: \"Contact identifier that will scope the uploaded asset.\",\n\texample: \"contact_01HZYFMN7J2J4F2SW3Q2N1H0D9\",\n});\n\nexport const uploadVisitorIdSchema = idSchema.openapi({\n\tdescription: \"Visitor identifier that will scope the uploaded asset.\",\n\texample: \"visitor_01HZYFPQ8R2FK1D9V7ZQ6CG6TN\",\n});\n\nexport const uploadPathSchema = z.string().max(512).openapi({\n\tdescription:\n\t\t\"Optional relative path used to group uploads inside the bucket. Nested paths are supported.\",\n\texample: \"assets/avatars\",\n});\n\nexport const uploadFileNameSchema = z\n\t.string()\n\t.min(1)\n\t.max(128)\n\t.regex(/^[^\\\\/]+$/)\n\t.openapi({\n\t\tdescription:\n\t\t\t\"Optional file name to use for the object. Invalid characters will be sanitized on the server side.\",\n\t\texample: \"profile-picture.png\",\n\t});\n\nexport const uploadFileExtensionSchema = z\n\t.string()\n\t.min(1)\n\t.max(16)\n\t.regex(/^[a-zA-Z0-9]+$/)\n\t.openapi({\n\t\tdescription:\n\t\t\t\"Optional file extension without the leading dot. Use this when providing a custom file name without an extension.\",\n\t\texample: \"png\",\n\t});\n\nconst baseScope = {\n\torganizationId: uploadOrganizationIdSchema,\n\twebsiteId: uploadWebsiteIdSchema,\n};\n\nexport const uploadScopeConversationSchema = z\n\t.object({\n\t\t...baseScope,\n\t\ttype: z.literal(\"conversation\"),\n\t\tconversationId: uploadConversationIdSchema,\n\t})\n\t.openapi({\n\t\tdescription:\n\t\t\t\"Scope uploads to a specific conversation. Files will be placed under /{organizationId}/{websiteId}/{conversationId}.\",\n\t});\n\nexport const uploadScopeUserSchema = z\n\t.object({\n\t\t...baseScope,\n\t\ttype: z.literal(\"user\"),\n\t\tuserId: uploadUserIdSchema,\n\t})\n\t.openapi({\n\t\tdescription:\n\t\t\t\"Scope uploads to a specific user. Files will be placed under /{organizationId}/{websiteId}/{userId}.\",\n\t});\n\nexport const uploadScopeContactSchema = z\n\t.object({\n\t\t...baseScope,\n\t\ttype: z.literal(\"contact\"),\n\t\tcontactId: uploadContactIdSchema,\n\t})\n\t.openapi({\n\t\tdescription:\n\t\t\t\"Scope uploads to a specific contact. Files will be placed under /{organizationId}/{websiteId}/{contactId}.\",\n\t});\n\nexport const uploadScopeVisitorSchema = z\n\t.object({\n\t\t...baseScope,\n\t\ttype: z.literal(\"visitor\"),\n\t\tvisitorId: uploadVisitorIdSchema,\n\t})\n\t.openapi({\n\t\tdescription:\n\t\t\t\"Scope uploads to a specific visitor. Files will be placed under /{organizationId}/{websiteId}/{visitorId}.\",\n\t});\n\nexport const uploadScopeSchema = z\n\t.discriminatedUnion(\"type\", [\n\t\tuploadScopeConversationSchema,\n\t\tuploadScopeUserSchema,\n\t\tuploadScopeContactSchema,\n\t\tuploadScopeVisitorSchema,\n\t])\n\t.openapi({\n\t\tdescription:\n\t\t\t\"Defines how uploaded files should be grouped inside the S3 bucket.\",\n\t});\n\nexport const generateUploadUrlRequestSchema = z\n\t.object({\n\t\tcontentType: z.string().min(1).max(256).openapi({\n\t\t\tdescription: \"MIME type of the file to upload.\",\n\t\t\texample: \"image/png\",\n\t\t}),\n\t\twebsiteId: z.string(),\n\t\tscope: uploadScopeSchema,\n\t\tpath: uploadPathSchema.optional(),\n\t\tfileName: uploadFileNameSchema.optional(),\n\t\tfileExtension: uploadFileExtensionSchema.optional(),\n\t\tuseCdn: z.boolean().optional().openapi({\n\t\t\tdescription:\n\t\t\t\t\"Set to true to place the file under the /cdn prefix so it is cached by the CDN.\",\n\t\t\texample: true,\n\t\t}),\n\t\texpiresInSeconds: z\n\t\t\t.number()\n\t\t\t.int()\n\t\t\t.min(60)\n\t\t\t.max(3600)\n\t\t\t.openapi({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Number of seconds before the signed URL expires. Defaults to 900 seconds (15 minutes).\",\n\t\t\t\texample: 900,\n\t\t\t})\n\t\t\t.optional(),\n\t})\n\t.openapi({\n\t\tdescription: \"Request payload to create a signed S3 upload URL.\",\n\t});\n\nexport type GenerateUploadUrlRequest = z.infer<\n\ttypeof generateUploadUrlRequestSchema\n>;\n\nexport const generateUploadUrlResponseSchema = z\n\t.object({\n\t\tuploadUrl: z.string().url().openapi({\n\t\t\tdescription:\n\t\t\t\t\"Pre-signed URL that accepts a PUT request to upload the file to S3.\",\n\t\t\texample:\n\t\t\t\t\"https://example-bucket.s3.amazonaws.com/org-id/file.png?X-Amz-Signature=...\",\n\t\t}),\n\t\tkey: z.string().openapi({\n\t\t\tdescription:\n\t\t\t\t\"Resolved object key that can be used to reference the uploaded asset.\",\n\t\t\texample: \"01JG000000000000000000000/assets/file.png\",\n\t\t}),\n\t\tbucket: z.string().openapi({\n\t\t\tdescription: \"Name of the S3 bucket that will receive the upload.\",\n\t\t\texample: \"cossistant-uploads\",\n\t\t}),\n\t\texpiresAt: z.string().openapi({\n\t\t\tdescription: \"ISO timestamp indicating when the signed URL will expire.\",\n\t\t\texample: \"2024-01-01T12:00:00.000Z\",\n\t\t}),\n\t\tcontentType: z.string().openapi({\n\t\t\tdescription: \"MIME type that should be used when uploading the file.\",\n\t\t\texample: \"image/png\",\n\t\t}),\n\t\tpublicUrl: z.string().url().openapi({\n\t\t\tdescription:\n\t\t\t\t\"Publicly accessible URL (or CDN URL when requested) that can be used to read the uploaded file.\",\n\t\t\texample: \"https://cdn.example.com/org-id/file.png\",\n\t\t}),\n\t})\n\t.openapi({\n\t\tdescription: \"Response payload containing the signed upload URL.\",\n\t});\n\nexport type GenerateUploadUrlResponse = z.infer<\n\ttypeof generateUploadUrlResponseSchema\n>;\n"],"mappings":";;;AAEA,MAAM,WAAW,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,IAAI;AAE3C,MAAa,6BAA6B,SAAS,QAAQ;CAC1D,aAAa;CACb,SAAS;CACT,CAAC;AAEF,MAAa,wBAAwB,SAAS,QAAQ;CACrD,aAAa;CACb,SAAS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BAAoB,EAC/B,mBAAmB,QAAQ;CAC3B;CACA;CACA;CACA;CACA,CAAC,CACD,QAAQ,EACR,aACC,sEACD,CAAC;AAEH,MAAa,iCAAiC,EAC5C,OAAO;CACP,aAAa,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,IAAI,CAAC,QAAQ;EAC/C,aAAa;EACb,SAAS;EACT,CAAC;CACF,WAAW,EAAE,QAAQ;CACrB,OAAO;CACP,MAAM,iBAAiB,UAAU;CACjC,UAAU,qBAAqB,UAAU;CACzC,eAAe,0BAA0B,UAAU;CACnD,QAAQ,EAAE,SAAS,CAAC,UAAU,CAAC,QAAQ;EACtC,aACC;EACD,SAAS;EACT,CAAC;CACF,kBAAkB,EAChB,QAAQ,CACR,KAAK,CACL,IAAI,GAAG,CACP,IAAI,KAAK,CACT,QAAQ;EACR,aACC;EACD,SAAS;EACT,CAAC,CACD,UAAU;CACZ,CAAC,CACD,QAAQ,EACR,aAAa,qDACb,CAAC;AAMH,MAAa,kCAAkC,EAC7C,OAAO;CACP,WAAW,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ;EACnC,aACC;EACD,SACC;EACD,CAAC;CACF,KAAK,EAAE,QAAQ,CAAC,QAAQ;EACvB,aACC;EACD,SAAS;EACT,CAAC;CACF,QAAQ,EAAE,QAAQ,CAAC,QAAQ;EAC1B,aAAa;EACb,SAAS;EACT,CAAC;CACF,WAAW,EAAE,QAAQ,CAAC,QAAQ;EAC7B,aAAa;EACb,SAAS;EACT,CAAC;CACF,aAAa,EAAE,QAAQ,CAAC,QAAQ;EAC/B,aAAa;EACb,SAAS;EACT,CAAC;CACF,WAAW,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ;EACnC,aACC;EACD,SAAS;EACT,CAAC;CACF,CAAC,CACD,QAAQ,EACR,aAAa,sDACb,CAAC"}
1
+ {"version":3,"file":"upload.js","names":[],"sources":["../../src/api/upload.ts"],"sourcesContent":["import { z } from \"@hono/zod-openapi\";\n\nconst idSchema = z.string().min(1).max(128);\n\nexport const uploadOrganizationIdSchema = idSchema.openapi({\n\tdescription: \"Identifier of the organization that owns the uploaded file.\",\n\texample: \"org_01HZYFG9W5V6YB5R6T6V7N9M2Q\",\n});\n\nexport const uploadWebsiteIdSchema = idSchema.openapi({\n\tdescription: \"Identifier of the website associated with the uploaded file.\",\n\texample: \"site_01HZYFH3KJ3MYHJJ3JJ6Y2RNAV\",\n});\n\nexport const uploadConversationIdSchema = idSchema.openapi({\n\tdescription: \"Conversation identifier that will scope the uploaded asset.\",\n\texample: \"conv_01HZYFJ5P7DQ0VE8F68G5VYBAQ\",\n});\n\nexport const uploadUserIdSchema = idSchema.openapi({\n\tdescription: \"User identifier that will scope the uploaded asset.\",\n\texample: \"user_01HZYFKJS3K0M9W6PQZ0J6G1WR\",\n});\n\nexport const uploadContactIdSchema = idSchema.openapi({\n\tdescription: \"Contact identifier that will scope the uploaded asset.\",\n\texample: \"contact_01HZYFMN7J2J4F2SW3Q2N1H0D9\",\n});\n\nexport const uploadVisitorIdSchema = idSchema.openapi({\n\tdescription: \"Visitor identifier that will scope the uploaded asset.\",\n\texample: \"visitor_01HZYFPQ8R2FK1D9V7ZQ6CG6TN\",\n});\n\nexport const uploadPathSchema = z.string().max(512).openapi({\n\tdescription:\n\t\t\"Optional relative path used to group uploads inside the bucket. Nested paths are supported.\",\n\texample: \"assets/avatars\",\n});\n\nexport const uploadFileNameSchema = z\n\t.string()\n\t.min(1)\n\t.max(128)\n\t.regex(/^[^\\\\/]+$/)\n\t.openapi({\n\t\tdescription:\n\t\t\t\"Optional file name to use for the object. Invalid characters will be sanitized on the server side.\",\n\t\texample: \"profile-picture.png\",\n\t});\n\nexport const uploadFileExtensionSchema = z\n\t.string()\n\t.min(1)\n\t.max(16)\n\t.regex(/^[a-zA-Z0-9]+$/)\n\t.openapi({\n\t\tdescription:\n\t\t\t\"Optional file extension without the leading dot. Use this when providing a custom file name without an extension.\",\n\t\texample: \"png\",\n\t});\n\nconst baseScope = {\n\torganizationId: uploadOrganizationIdSchema,\n\twebsiteId: uploadWebsiteIdSchema,\n};\n\nexport const uploadScopeConversationSchema = z\n\t.object({\n\t\t...baseScope,\n\t\ttype: z.literal(\"conversation\"),\n\t\tconversationId: uploadConversationIdSchema,\n\t})\n\t.openapi({\n\t\tdescription:\n\t\t\t\"Scope uploads to a specific conversation. Files will be placed under /{organizationId}/{websiteId}/{conversationId}.\",\n\t});\n\nexport const uploadScopeUserSchema = z\n\t.object({\n\t\t...baseScope,\n\t\ttype: z.literal(\"user\"),\n\t\tuserId: uploadUserIdSchema,\n\t})\n\t.openapi({\n\t\tdescription:\n\t\t\t\"Scope uploads to a specific user. Files will be placed under /{organizationId}/{websiteId}/{userId}.\",\n\t});\n\nexport const uploadScopeContactSchema = z\n\t.object({\n\t\t...baseScope,\n\t\ttype: z.literal(\"contact\"),\n\t\tcontactId: uploadContactIdSchema,\n\t})\n\t.openapi({\n\t\tdescription:\n\t\t\t\"Scope uploads to a specific contact. Files will be placed under /{organizationId}/{websiteId}/{contactId}.\",\n\t});\n\nexport const uploadScopeVisitorSchema = z\n\t.object({\n\t\t...baseScope,\n\t\ttype: z.literal(\"visitor\"),\n\t\tvisitorId: uploadVisitorIdSchema,\n\t})\n\t.openapi({\n\t\tdescription:\n\t\t\t\"Scope uploads to a specific visitor. Files will be placed under /{organizationId}/{websiteId}/{visitorId}.\",\n\t});\n\nexport const uploadScopeSchema = z\n\t.discriminatedUnion(\"type\", [\n\t\tuploadScopeConversationSchema,\n\t\tuploadScopeUserSchema,\n\t\tuploadScopeContactSchema,\n\t\tuploadScopeVisitorSchema,\n\t])\n\t.openapi({\n\t\tdescription:\n\t\t\t\"Defines how uploaded files should be grouped inside the S3 bucket.\",\n\t});\n\nexport const generateUploadUrlRequestSchema = z\n\t.object({\n\t\tcontentType: z.string().min(1).max(256).openapi({\n\t\t\tdescription: \"MIME type of the file to upload.\",\n\t\t\texample: \"image/png\",\n\t\t}),\n\t\twebsiteId: z.string(),\n\t\tscope: uploadScopeSchema,\n\t\tpath: uploadPathSchema.optional(),\n\t\tfileName: uploadFileNameSchema.optional(),\n\t\tfileExtension: uploadFileExtensionSchema.optional(),\n\t\tuseCdn: z.boolean().optional().openapi({\n\t\t\tdescription:\n\t\t\t\t\"Set to true to place the file under the /cdn prefix so it is cached by the CDN.\",\n\t\t\texample: true,\n\t\t}),\n\t\texpiresInSeconds: z\n\t\t\t.number()\n\t\t\t.int()\n\t\t\t.min(60)\n\t\t\t.max(3600)\n\t\t\t.openapi({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Number of seconds before the signed URL expires. Defaults to 900 seconds (15 minutes).\",\n\t\t\t\texample: 900,\n\t\t\t})\n\t\t\t.optional(),\n\t})\n\t.openapi({\n\t\tdescription: \"Request payload to create a signed S3 upload URL.\",\n\t});\n\nexport type GenerateUploadUrlRequest = z.infer<\n\ttypeof generateUploadUrlRequestSchema\n>;\n\nexport const generateUploadUrlResponseSchema = z\n\t.object({\n\t\tuploadUrl: z.url().openapi({\n\t\t\tdescription:\n\t\t\t\t\"Pre-signed URL that accepts a PUT request to upload the file to S3.\",\n\t\t\texample:\n\t\t\t\t\"https://example-bucket.s3.amazonaws.com/org-id/file.png?X-Amz-Signature=...\",\n\t\t}),\n\t\tkey: z.string().openapi({\n\t\t\tdescription:\n\t\t\t\t\"Resolved object key that can be used to reference the uploaded asset.\",\n\t\t\texample: \"01JG000000000000000000000/assets/file.png\",\n\t\t}),\n\t\tbucket: z.string().openapi({\n\t\t\tdescription: \"Name of the S3 bucket that will receive the upload.\",\n\t\t\texample: \"cossistant-uploads\",\n\t\t}),\n\t\texpiresAt: z.string().openapi({\n\t\t\tdescription: \"ISO timestamp indicating when the signed URL will expire.\",\n\t\t\texample: \"2024-01-01T12:00:00.000Z\",\n\t\t}),\n\t\tcontentType: z.string().openapi({\n\t\t\tdescription: \"MIME type that should be used when uploading the file.\",\n\t\t\texample: \"image/png\",\n\t\t}),\n\t\tpublicUrl: z.url().openapi({\n\t\t\tdescription:\n\t\t\t\t\"Publicly accessible URL (or CDN URL when requested) that can be used to read the uploaded file.\",\n\t\t\texample: \"https://cdn.example.com/org-id/file.png\",\n\t\t}),\n\t})\n\t.openapi({\n\t\tdescription: \"Response payload containing the signed upload URL.\",\n\t});\n\nexport type GenerateUploadUrlResponse = z.infer<\n\ttypeof generateUploadUrlResponseSchema\n>;\n"],"mappings":";;;AAEA,MAAM,WAAW,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,IAAI;AAE3C,MAAa,6BAA6B,SAAS,QAAQ;CAC1D,aAAa;CACb,SAAS;CACT,CAAC;AAEF,MAAa,wBAAwB,SAAS,QAAQ;CACrD,aAAa;CACb,SAAS;CACT,CAAC;AAEF,MAAa,6BAA6B,SAAS,QAAQ;CAC1D,aAAa;CACb,SAAS;CACT,CAAC;AAEF,MAAa,qBAAqB,SAAS,QAAQ;CAClD,aAAa;CACb,SAAS;CACT,CAAC;AAEF,MAAa,wBAAwB,SAAS,QAAQ;CACrD,aAAa;CACb,SAAS;CACT,CAAC;AAEF,MAAa,wBAAwB,SAAS,QAAQ;CACrD,aAAa;CACb,SAAS;CACT,CAAC;AAEF,MAAa,mBAAmB,EAAE,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ;CAC3D,aACC;CACD,SAAS;CACT,CAAC;AAEF,MAAa,uBAAuB,EAClC,QAAQ,CACR,IAAI,EAAE,CACN,IAAI,IAAI,CACR,MAAM,YAAY,CAClB,QAAQ;CACR,aACC;CACD,SAAS;CACT,CAAC;AAEH,MAAa,4BAA4B,EACvC,QAAQ,CACR,IAAI,EAAE,CACN,IAAI,GAAG,CACP,MAAM,iBAAiB,CACvB,QAAQ;CACR,aACC;CACD,SAAS;CACT,CAAC;AAEH,MAAM,YAAY;CACjB,gBAAgB;CAChB,WAAW;CACX;AAED,MAAa,gCAAgC,EAC3C,OAAO;CACP,GAAG;CACH,MAAM,EAAE,QAAQ,eAAe;CAC/B,gBAAgB;CAChB,CAAC,CACD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E,QAAQ,CAAC,QAAQ;EAC1B,aAAa;EACb,SAAS;EACT,CAAC;CACF,WAAW,EAAE,QAAQ,CAAC,QAAQ;EAC7B,aAAa;EACb,SAAS;EACT,CAAC;CACF,aAAa,EAAE,QAAQ,CAAC,QAAQ;EAC/B,aAAa;EACb,SAAS;EACT,CAAC;CACF,WAAW,EAAE,KAAK,CAAC,QAAQ;EAC1B,aACC;EACD,SAAS;EACT,CAAC;CACF,CAAC,CACD,QAAQ,EACR,aAAa,sDACb,CAAC"}
package/api/website.d.ts CHANGED
@@ -36,7 +36,7 @@ declare const websiteSummarySchema: z.ZodObject<{
36
36
  name: z.ZodString;
37
37
  domain: z.ZodString;
38
38
  contactEmail: z.ZodNullable<z.ZodString>;
39
- logoUrl: z.ZodNullable<z.ZodString>;
39
+ logoUrl: z.ZodNullable<z.ZodURL>;
40
40
  organizationId: z.ZodULID;
41
41
  whitelistedDomains: z.ZodArray<z.ZodURL>;
42
42
  defaultParticipantIds: z.ZodNullable<z.ZodArray<z.ZodString>>;
@@ -49,7 +49,7 @@ declare const websiteDeveloperSettingsResponseSchema: z.ZodObject<{
49
49
  name: z.ZodString;
50
50
  domain: z.ZodString;
51
51
  contactEmail: z.ZodNullable<z.ZodString>;
52
- logoUrl: z.ZodNullable<z.ZodString>;
52
+ logoUrl: z.ZodNullable<z.ZodURL>;
53
53
  organizationId: z.ZodULID;
54
54
  whitelistedDomains: z.ZodArray<z.ZodURL>;
55
55
  defaultParticipantIds: z.ZodNullable<z.ZodArray<z.ZodString>>;
@@ -96,7 +96,7 @@ declare const updateWebsiteRequestSchema: z.ZodObject<{
96
96
  domain: z.ZodOptional<z.ZodString>;
97
97
  contactEmail: z.ZodOptional<z.ZodNullable<z.ZodString>>;
98
98
  description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
99
- logoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
99
+ logoUrl: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
100
100
  whitelistedDomains: z.ZodOptional<z.ZodArray<z.ZodURL>>;
101
101
  defaultParticipantIds: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
102
102
  installationTarget: z.ZodOptional<z.ZodEnum<{
@@ -207,7 +207,7 @@ declare const websiteListItemSchema: z.ZodObject<{
207
207
  id: z.ZodULID;
208
208
  name: z.ZodString;
209
209
  slug: z.ZodString;
210
- logoUrl: z.ZodNullable<z.ZodString>;
210
+ logoUrl: z.ZodNullable<z.ZodURL>;
211
211
  domain: z.ZodString;
212
212
  organizationId: z.ZodULID;
213
213
  }, z.core.$strip>;
@@ -1 +1 @@
1
- {"version":3,"file":"website.d.ts","names":[],"sources":["../../src/api/website.ts"],"sourcesContent":[],"mappings":";;;;;;AAOA;cAAa,4BAA0B,CAAA,CAAA;;;;;IAAA,SAAA,MAAA,EAAA,QAAA;IAAA,SAAA,KAAA,EAAA,OAAA;EA8B3B,CAAA,CAAA;AASZ,CAAA,eAAa,CAAA;KATD,oBAAA,GAAuB,CAAA,CAAE,aAAa;cASrC,qBAAmB,CAAA,CAAA;;;;;;;;;;;;EAAA,SAAA,eAAA,YAAA,CAAA;CAAA,eAAA,CAAA;AA6CpB,KAAA,aAAA,GAAgB,CAAA,CAAE,KAAa,CAAA,OAAA,mBAAR,CAAA;AAEtB,cAAA,oBA6CV,EA7C8B,CAAA,CAAA,SA6C9B,CAAA;;;;;;;;;;;KAES,cAAA,GAAiB,CAAA,CAAE,aAAa;cAE/B,wCAAsC,CAAA,CAAA;;;;IAjDlB,IAAA,aAAA;IAAA,MAAA,aAAA;IA+CrB,YAAA,eAAgC,YAAA,CAAA;IAE/B,OAAA,eAAA,YAAA,CAAA;;;;;;;;;;;;;;;;;;;;KAUD,gCAAA,GAAmC,CAAA,CAAE,aACzC;cAGK,kCAAgC,CAAA,CAAA;;;;;;;;;;KA2BjC,0BAAA,GAA6B,CAAA,CAAE,aACnC;cAGK,kCAAgC,CAAA,CAAA;EA7CM,cAAA,WAAA;EAAA,SAAA,WAAA;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A,GAA4B,CAAA,CAAE,aAClC;;;;cAMK,uBAAqB,CAAA,CAAA;;;;;;;;KA2BtB,eAAA,GAAkB,CAAA,CAAE,aAAa"}
package/api/website.js CHANGED
@@ -85,7 +85,7 @@ const websiteSummarySchema = z.object({
85
85
  description: "The primary email visitors can use to reach you.",
86
86
  example: "support@dub.co"
87
87
  }),
88
- logoUrl: z.string().url().nullable().openapi({
88
+ logoUrl: z.url().nullable().openapi({
89
89
  description: "Public URL to the website's logo.",
90
90
  example: "https://cdn.example.com/logo.png"
91
91
  }),
@@ -148,7 +148,7 @@ const websiteUpdateDataSchema = z.object({
148
148
  domain: z.string().min(1).optional(),
149
149
  contactEmail: z.string().email().nullable().optional(),
150
150
  description: z.string().nullable().optional(),
151
- logoUrl: z.string().url().nullable().optional(),
151
+ logoUrl: z.url().nullable().optional(),
152
152
  whitelistedDomains: z.array(z.url()).optional(),
153
153
  defaultParticipantIds: z.array(z.string()).nullable().optional(),
154
154
  installationTarget: z.nativeEnum(WebsiteInstallationTarget).optional(),
@@ -306,7 +306,7 @@ const websiteListItemSchema = z.object({
306
306
  description: "The website's slug.",
307
307
  example: "dub-co"
308
308
  }),
309
- logoUrl: z.string().url().nullable().openapi({
309
+ logoUrl: z.url().nullable().openapi({
310
310
  description: "Public URL to the website's logo.",
311
311
  example: "https://cdn.example.com/logo.png"
312
312
  }),