@youdotcom-oss/api 0.3.1 → 0.3.2

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/bin/cli.js CHANGED
@@ -15,7 +15,7 @@ import { parseArgs as parseArgs2 } from "node:util";
15
15
  // package.json
16
16
  var package_default = {
17
17
  name: "@youdotcom-oss/api",
18
- version: "0.3.1",
18
+ version: "0.3.2",
19
19
  description: "You.com API client with bundled CLI for agents supporting Agent Skills",
20
20
  license: "MIT",
21
21
  engines: {
@@ -13616,7 +13616,14 @@ function date4(params) {
13616
13616
  config(en_default());
13617
13617
  // src/contents/contents.schemas.ts
13618
13618
  var ContentsQuerySchema = object({
13619
- urls: array(string2().url()).min(1).describe('Array of webpage URLs to extract content from (e.g., ["https://example.com"])'),
13619
+ urls: array(string2().refine((val) => {
13620
+ try {
13621
+ new URL(val);
13622
+ return true;
13623
+ } catch {
13624
+ return false;
13625
+ }
13626
+ }, { message: "Invalid URL format" })).min(1).describe('Array of webpage URLs to extract content from (e.g., ["https://example.com"])'),
13620
13627
  formats: array(_enum2(["markdown", "html", "metadata"])).optional().describe('Output formats: array of "markdown" (text), "html" (layout), or "metadata" (structured data)'),
13621
13628
  format: _enum2(["markdown", "html"]).optional().describe("(Deprecated) Output format - use formats array instead"),
13622
13629
  crawl_timeout: number2().min(1).max(60).optional().describe("Optional timeout in seconds (1-60) for page crawling")
@@ -13885,7 +13892,14 @@ var SearchResponseSchema = object({
13885
13892
  // src/shared/api-error.schemas.ts
13886
13893
  var ApiErrorResponseSchema = exports_external.object({
13887
13894
  message: exports_external.string().optional(),
13888
- upgrade_url: exports_external.string().url().optional(),
13895
+ upgrade_url: exports_external.string().refine((val) => {
13896
+ try {
13897
+ new URL(val);
13898
+ return true;
13899
+ } catch {
13900
+ return false;
13901
+ }
13902
+ }, { message: "Invalid URL format" }).optional(),
13889
13903
  reset_at: exports_external.string().optional()
13890
13904
  });
13891
13905
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@youdotcom-oss/api",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "You.com API client with bundled CLI for agents supporting Agent Skills",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -6,7 +6,21 @@ import * as z from 'zod'
6
6
  */
7
7
  export const ContentsQuerySchema = z.object({
8
8
  urls: z
9
- .array(z.string().url())
9
+ .array(
10
+ // Use .refine() instead of .url() to ensure JSON schema includes "type": "string"
11
+ // This is required for OpenAI function calling schema validation
12
+ z.string().refine(
13
+ (val) => {
14
+ try {
15
+ new URL(val)
16
+ return true
17
+ } catch {
18
+ return false
19
+ }
20
+ },
21
+ { message: 'Invalid URL format' },
22
+ ),
23
+ )
10
24
  .min(1)
11
25
  .describe('Array of webpage URLs to extract content from (e.g., ["https://example.com"])'),
12
26
  formats: z
@@ -24,6 +24,7 @@ describe('ContentsQuerySchema OpenAPI validation', () => {
24
24
  {}, // Missing urls
25
25
  { urls: [] }, // Empty urls array
26
26
  { urls: ['not-a-url'] }, // Invalid URL
27
+ { urls: [''] }, // Empty URL string
27
28
  { urls: ['https://example.com'], formats: ['invalid'] }, // Invalid format
28
29
  { urls: ['https://example.com'], crawl_timeout: 0 }, // Timeout too low
29
30
  { urls: ['https://example.com'], crawl_timeout: 61 }, // Timeout too high
@@ -7,7 +7,22 @@ import { z } from 'zod'
7
7
  */
8
8
  export const ApiErrorResponseSchema = z.object({
9
9
  message: z.string().optional(),
10
- upgrade_url: z.string().url().optional(),
10
+ // Use .refine() instead of .url() to ensure JSON schema includes "type": "string"
11
+ // This is required for OpenAI function calling schema validation
12
+ upgrade_url: z
13
+ .string()
14
+ .refine(
15
+ (val) => {
16
+ try {
17
+ new URL(val)
18
+ return true
19
+ } catch {
20
+ return false
21
+ }
22
+ },
23
+ { message: 'Invalid URL format' },
24
+ )
25
+ .optional(),
11
26
  reset_at: z.string().optional(),
12
27
  })
13
28