veryfront 0.1.708 → 0.1.709

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.708",
3
+ "version": "0.1.709",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "minimumDependencyAge": "P2D",
@@ -3,6 +3,11 @@ export interface TokenResponse {
3
3
  token_type: "Bearer";
4
4
  expires_in?: number;
5
5
  }
6
+ export declare class OAuthTokenRequestError extends Error {
7
+ readonly status: number;
8
+ readonly responseText: string;
9
+ constructor(status: number, responseText: string);
10
+ }
6
11
  interface OAuthTokenConfig {
7
12
  apiBaseUrl: string;
8
13
  apiClientId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"oauth-client.d.ts","sourceRoot":"","sources":["../../../src/src/proxy/oauth-client.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,aAAa;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,QAAQ,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,gBAAgB;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAsB,eAAe,CACnC,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,aAAa,CAAC,CAgExB"}
1
+ {"version":3,"file":"oauth-client.d.ts","sourceRoot":"","sources":["../../../src/src/proxy/oauth-client.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,aAAa;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,QAAQ,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,sBAAuB,SAAQ,KAAK;IAE7C,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,YAAY,EAAE,MAAM;gBADpB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM;CAKhC;AAED,UAAU,gBAAgB;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAsB,eAAe,CACnC,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,aAAa,CAAC,CA8DxB"}
@@ -3,8 +3,18 @@
3
3
  */
4
4
  import * as dntShim from "../../_dnt.shims.js";
5
5
  import { injectContext, ProxySpanNames, withSpan } from "./tracing.js";
6
- import { REQUEST_ERROR, TIMEOUT_ERROR } from "../errors/index.js";
6
+ import { TIMEOUT_ERROR } from "../errors/index.js";
7
7
  const DEFAULT_TIMEOUT_MS = 10_000;
8
+ export class OAuthTokenRequestError extends Error {
9
+ status;
10
+ responseText;
11
+ constructor(status, responseText) {
12
+ super(`OAuth token request failed: ${status} - ${responseText}`);
13
+ this.status = status;
14
+ this.responseText = responseText;
15
+ this.name = "OAuthTokenRequestError";
16
+ }
17
+ }
8
18
  export async function fetchOAuthToken(config) {
9
19
  return withSpan(ProxySpanNames.OAUTH_TOKEN_REQUEST, async () => {
10
20
  const url = `${config.apiBaseUrl}/auth/token`;
@@ -37,9 +47,7 @@ export async function fetchOAuthToken(config) {
37
47
  return response.json();
38
48
  }
39
49
  const errorText = await response.text().catch(() => "Unknown error");
40
- throw REQUEST_ERROR.create({
41
- detail: `OAuth token request failed: ${response.status} - ${errorText}`,
42
- });
50
+ throw new OAuthTokenRequestError(response.status, errorText);
43
51
  }
44
52
  catch (error) {
45
53
  if (error instanceof Error && error.name === "AbortError") {
@@ -31,7 +31,6 @@ export declare class TokenManager {
31
31
  private getCacheKey;
32
32
  private isTokenValid;
33
33
  private fetchAndCacheToken;
34
- private parseStatusFromError;
35
34
  private calculateExpiresAt;
36
35
  }
37
36
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"token-manager.d.ts","sourceRoot":"","sources":["../../../src/src/proxy/token-manager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAmB,MAAM,kBAAkB,CAAC;AAKpE,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,YAAY,CAAC;AAalD,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,sBAAsB,EAAE,MAAM,CAAC;CAChC;AAED,UAAU,mBAAmB;IAC3B,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,qBAAa,YAAY;IAOrB,OAAO,CAAC,MAAM;IANhB,OAAO,CAAC,KAAK,CAAa;IAC1B,OAAO,CAAC,eAAe,CAAsC;IAC7D,OAAO,CAAC,aAAa,CAAyC;IAC9D,OAAO,CAAC,aAAa,CAAS;gBAGpB,MAAM,EAAE,WAAW,EAC3B,OAAO,GAAE,mBAAwB;IAM7B,QAAQ,CACZ,KAAK,EAAE,UAAU,EACjB,WAAW,CAAC,EAAE,MAAM,EACpB,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,MAAM,CAAC;IA4CZ,eAAe,CAAC,KAAK,EAAE,UAAU,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMvE,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAK3B,QAAQ,IAAI,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,M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AAI,CAAC;IAK3B,QAAQ,IAAI,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAIjF,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,YAAY;YAIN,kBAAkB;IAkDhC,OAAO,CAAC,kBAAkB;CAe3B"}
@@ -1,4 +1,4 @@
1
- import { fetchOAuthToken } from "./oauth-client.js";
1
+ import { fetchOAuthToken, OAuthTokenRequestError } from "./oauth-client.js";
2
2
  import { MemoryCache } from "./cache/memory-cache.js";
3
3
  import { ProxySpanNames, withSpan } from "./tracing.js";
4
4
  import { CACHE_ERROR } from "../errors/index.js";
@@ -92,7 +92,7 @@ export class TokenManager {
92
92
  });
93
93
  }
94
94
  catch (error) {
95
- const status = this.parseStatusFromError(error);
95
+ const status = error instanceof OAuthTokenRequestError ? error.status : null;
96
96
  if (status === 400 || status === 404) {
97
97
  const projectKey = projectSlug || customDomain;
98
98
  const cacheKey = this.getCacheKey(scope, projectKey);
@@ -118,11 +118,6 @@ export class TokenManager {
118
118
  });
119
119
  return response.access_token;
120
120
  }
121
- parseStatusFromError(error) {
122
- const message = error instanceof Error ? error.message : String(error);
123
- const match = message.match(/failed: (\d+)/);
124
- return match ? Number(match[1]) : null;
125
- }
126
121
  calculateExpiresAt(response) {
127
122
  if (response.expires_in)
128
123
  return Date.now() + response.expires_in * 1000;
@@ -1,3 +1,3 @@
1
1
  /** Shared version value. */
2
- export declare const VERSION = "0.1.708";
2
+ export declare const VERSION = "0.1.709";
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.708";
4
+ export const VERSION = "0.1.709";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veryfront",
3
- "version": "0.1.708",
3
+ "version": "0.1.709",
4
4
  "description": "The simplest way to build AI-powered apps",
5
5
  "keywords": [
6
6
  "react",