veryfront 0.1.1116 → 0.1.1117

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/esm/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.1116",
3
+ "version": "0.1.1117",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "minimumDependencyAge": {
@@ -16,6 +16,11 @@ export declare class ProviderError extends Error {
16
16
  readonly status: number;
17
17
  readonly retryable: boolean;
18
18
  readonly retryAfterMs?: number;
19
+ /**
20
+ * Bounded structured provider response used by the internal error classifier.
21
+ * Kept non-enumerable so logs and JSON serialization retain the generic error.
22
+ */
23
+ readonly responseBody?: string;
19
24
  constructor(options: {
20
25
  provider: ProviderKind;
21
26
  status: number;
@@ -1 +1 @@
1
- {"version":3,"file":"provider-http.d.ts","sourceRoot":"","sources":["../../../../src/src/provider/runtime-loader/provider-http.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,YAAY,CAAC;AAKxF;;;;;GAKG;AACH,qBAAa,aAAc,SAAQ,KAAK;IACtC,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;gBAEnB,OAAO,EAAE;QACnB,QAAQ,EAAE,YAAY,CAAC;QACvB,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,OAAO,CAAC;QACnB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB;CAUF;AAED,4EAA4E;AAC5E,qBAAa,uBAAwB,SAAQ,aAAa;CAAG;AAE7D,mFAAmF;AAC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K,CAAC;IACnC,IAAI,EAAE,WAAW,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,YAAY,CAAC;CAC5B,GAAG,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAkBtC"}
@@ -36,6 +36,15 @@ export class ProviderQuotaError extends ProviderError {
36
36
  /** Non-retryable 4xx/5xx that doesn't fit another bucket. */
37
37
  export class ProviderRequestError extends ProviderError {
38
38
  }
39
+ function preserveStructuredResponseBody(error, responseBody) {
40
+ Object.defineProperty(error, "responseBody", {
41
+ value: responseBody,
42
+ enumerable: false,
43
+ configurable: false,
44
+ writable: false,
45
+ });
46
+ return error;
47
+ }
39
48
  /** Parses retry after ms. */
40
49
  export function parseRetryAfterMs(header) {
41
50
  if (!header)
@@ -72,10 +81,11 @@ export async function buildProviderError(provider, response) {
72
81
  }
73
82
  })();
74
83
  const errorRecord = readRecord(parsedBody?.error);
84
+ const errorType = typeof errorRecord?.type === "string" ? errorRecord.type : undefined;
75
85
  const errorCode = typeof errorRecord?.code === "string"
76
86
  ? errorRecord.code
77
- : typeof errorRecord?.type === "string"
78
- ? errorRecord.type
87
+ : errorType !== undefined
88
+ ? errorType
79
89
  : typeof errorRecord?.status === "string"
80
90
  ? errorRecord.status
81
91
  : undefined;
@@ -173,12 +183,19 @@ export async function buildProviderError(provider, response) {
173
183
  ...(retryAfterMs !== undefined ? { retryAfterMs } : {}),
174
184
  });
175
185
  }
176
- return new ProviderRequestError({
186
+ const requestError = new ProviderRequestError({
177
187
  provider,
178
188
  status,
179
189
  message,
180
190
  retryable: false,
181
191
  });
192
+ const isStructuredInvalidRequest = status === 400 &&
193
+ errorType === "invalid_request_error" &&
194
+ parsedBody !== undefined &&
195
+ !truncated;
196
+ return isStructuredInvalidRequest
197
+ ? preserveStructuredResponseBody(requestError, rawBody)
198
+ : requestError;
182
199
  }
183
200
  /** Request and parse a JSON response. */
184
201
  export async function requestJson(options) {
@@ -1,3 +1,3 @@
1
1
  /** Shared version value. */
2
- export declare const VERSION = "0.1.1116";
2
+ export declare const VERSION = "0.1.1117";
3
3
  //# sourceMappingURL=version-constant.d.ts.map
@@ -1,4 +1,4 @@
1
1
  // Keep in sync with deno.json version.
2
2
  // scripts/release.ts updates this constant during releases.
3
3
  /** Shared version value. */
4
- export const VERSION = "0.1.1116";
4
+ export const VERSION = "0.1.1117";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veryfront",
3
- "version": "0.1.1116",
3
+ "version": "0.1.1117",
4
4
  "description": "The simplest way to build AI-powered apps",
5
5
  "keywords": [
6
6
  "react",
@@ -332,10 +332,10 @@
332
332
  "@types/react": "19.2.14",
333
333
  "@types/react-dom": "19.2.3",
334
334
  "ws": "8.21.0",
335
- "@veryfront/ext-bundler-esbuild": "0.1.1116",
336
- "@veryfront/ext-content-mdx": "0.1.1116",
337
- "@veryfront/ext-css-tailwind": "0.1.1116",
338
- "@veryfront/ext-parser-babel": "0.1.1116"
335
+ "@veryfront/ext-bundler-esbuild": "0.1.1117",
336
+ "@veryfront/ext-content-mdx": "0.1.1117",
337
+ "@veryfront/ext-css-tailwind": "0.1.1117",
338
+ "@veryfront/ext-parser-babel": "0.1.1117"
339
339
  },
340
340
  "devDependencies": {
341
341
  "@types/node": "20.9.0"