auth0 6.4.0 → 7.0.0

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.
Files changed (82) hide show
  1. package/README.md +20 -15
  2. package/dist/cjs/index.d.ts +0 -2
  3. package/dist/cjs/index.js +0 -2
  4. package/dist/cjs/lib/errors.d.ts +0 -18
  5. package/dist/cjs/lib/errors.js +1 -25
  6. package/dist/cjs/lib/middleware/auth0-client-telemetry.d.ts +3 -7
  7. package/dist/cjs/lib/middleware/auth0-client-telemetry.js +1 -25
  8. package/dist/cjs/lib/models.d.ts +0 -24
  9. package/dist/cjs/lib/models.js +0 -53
  10. package/dist/cjs/management/version.d.ts +1 -1
  11. package/dist/cjs/management/version.js +1 -1
  12. package/dist/cjs/management/wrapper/ManagementClient.d.ts +9 -2
  13. package/dist/cjs/management/wrapper/ManagementClient.js +0 -1
  14. package/dist/cjs/management/wrapper/token-provider.d.ts +4 -2
  15. package/dist/cjs/management/wrapper/token-provider.js +142 -11
  16. package/dist/cjs/utils.d.ts +0 -18
  17. package/dist/cjs/utils.js +1 -32
  18. package/dist/esm/index.d.mts +0 -2
  19. package/dist/esm/index.mjs +0 -2
  20. package/dist/esm/lib/errors.d.mts +0 -18
  21. package/dist/esm/lib/errors.mjs +0 -22
  22. package/dist/esm/lib/middleware/auth0-client-telemetry.d.mts +3 -7
  23. package/dist/esm/lib/middleware/auth0-client-telemetry.mjs +1 -25
  24. package/dist/esm/lib/models.d.mts +0 -24
  25. package/dist/esm/lib/models.mjs +1 -49
  26. package/dist/esm/management/version.d.mts +1 -1
  27. package/dist/esm/management/version.mjs +1 -1
  28. package/dist/esm/management/wrapper/ManagementClient.d.mts +9 -2
  29. package/dist/esm/management/wrapper/ManagementClient.mjs +0 -1
  30. package/dist/esm/management/wrapper/token-provider.d.mts +4 -2
  31. package/dist/esm/management/wrapper/token-provider.mjs +142 -11
  32. package/dist/esm/utils.d.mts +0 -18
  33. package/dist/esm/utils.mjs +0 -30
  34. package/package.json +1 -2
  35. package/dist/cjs/auth/backchannel.d.ts +0 -158
  36. package/dist/cjs/auth/backchannel.js +0 -135
  37. package/dist/cjs/auth/base-auth-api.d.ts +0 -41
  38. package/dist/cjs/auth/base-auth-api.js +0 -109
  39. package/dist/cjs/auth/client-authentication.d.ts +0 -27
  40. package/dist/cjs/auth/client-authentication.js +0 -82
  41. package/dist/cjs/auth/database.d.ts +0 -157
  42. package/dist/cjs/auth/database.js +0 -94
  43. package/dist/cjs/auth/id-token-validator.d.ts +0 -18
  44. package/dist/cjs/auth/id-token-validator.js +0 -158
  45. package/dist/cjs/auth/index.d.ts +0 -65
  46. package/dist/cjs/auth/index.js +0 -80
  47. package/dist/cjs/auth/oauth.d.ts +0 -462
  48. package/dist/cjs/auth/oauth.js +0 -280
  49. package/dist/cjs/auth/passwordless.d.ts +0 -165
  50. package/dist/cjs/auth/passwordless.js +0 -173
  51. package/dist/cjs/auth/tokenExchange.d.ts +0 -166
  52. package/dist/cjs/auth/tokenExchange.js +0 -74
  53. package/dist/cjs/lib/index.d.ts +0 -3
  54. package/dist/cjs/lib/index.js +0 -18
  55. package/dist/cjs/lib/runtime.d.ts +0 -61
  56. package/dist/cjs/lib/runtime.js +0 -222
  57. package/dist/cjs/userinfo/index.d.ts +0 -87
  58. package/dist/cjs/userinfo/index.js +0 -104
  59. package/dist/esm/auth/backchannel.d.mts +0 -158
  60. package/dist/esm/auth/backchannel.mjs +0 -131
  61. package/dist/esm/auth/base-auth-api.d.mts +0 -41
  62. package/dist/esm/auth/base-auth-api.mjs +0 -103
  63. package/dist/esm/auth/client-authentication.d.mts +0 -27
  64. package/dist/esm/auth/client-authentication.mjs +0 -45
  65. package/dist/esm/auth/database.d.mts +0 -157
  66. package/dist/esm/auth/database.mjs +0 -90
  67. package/dist/esm/auth/id-token-validator.d.mts +0 -18
  68. package/dist/esm/auth/id-token-validator.mjs +0 -120
  69. package/dist/esm/auth/index.d.mts +0 -65
  70. package/dist/esm/auth/index.mjs +0 -60
  71. package/dist/esm/auth/oauth.d.mts +0 -462
  72. package/dist/esm/auth/oauth.mjs +0 -276
  73. package/dist/esm/auth/passwordless.d.mts +0 -165
  74. package/dist/esm/auth/passwordless.mjs +0 -169
  75. package/dist/esm/auth/tokenExchange.d.mts +0 -166
  76. package/dist/esm/auth/tokenExchange.mjs +0 -70
  77. package/dist/esm/lib/index.d.mts +0 -3
  78. package/dist/esm/lib/index.mjs +0 -2
  79. package/dist/esm/lib/runtime.d.mts +0 -61
  80. package/dist/esm/lib/runtime.mjs +0 -201
  81. package/dist/esm/userinfo/index.d.mts +0 -87
  82. package/dist/esm/userinfo/index.mjs +0 -98
@@ -1,13 +1,3 @@
1
- /**
2
- * Error thrown when the API returns an error response that can't be parsed to a more specific Error instance.
3
- */
4
- export declare class ResponseError extends Error {
5
- statusCode: number;
6
- body: string;
7
- headers: Headers;
8
- name: "ResponseError";
9
- constructor(statusCode: number, body: string, headers: Headers, msg?: string);
10
- }
11
1
  /**
12
2
  * Error thrown when the request is aborted due to a timeout.
13
3
  */
@@ -15,14 +5,6 @@ export declare class TimeoutError extends Error {
15
5
  name: "TimeoutError";
16
6
  constructor();
17
7
  }
18
- /**
19
- * Error thrown when there is a network error.
20
- */
21
- export declare class FetchError extends Error {
22
- cause: Error;
23
- name: "FetchError";
24
- constructor(cause: Error, msg?: string);
25
- }
26
8
  /**
27
9
  * Error thrown when a required argument was not provided.
28
10
  */
@@ -1,15 +1,3 @@
1
- /**
2
- * Error thrown when the API returns an error response that can't be parsed to a more specific Error instance.
3
- */
4
- export class ResponseError extends Error {
5
- constructor(statusCode, body, headers, msg) {
6
- super(msg);
7
- this.statusCode = statusCode;
8
- this.body = body;
9
- this.headers = headers;
10
- this.name = "ResponseError";
11
- }
12
- }
13
1
  /**
14
2
  * Error thrown when the request is aborted due to a timeout.
15
3
  */
@@ -19,16 +7,6 @@ export class TimeoutError extends Error {
19
7
  this.name = "TimeoutError";
20
8
  }
21
9
  }
22
- /**
23
- * Error thrown when there is a network error.
24
- */
25
- export class FetchError extends Error {
26
- constructor(cause, msg) {
27
- super(msg);
28
- this.cause = cause;
29
- this.name = "FetchError";
30
- }
31
- }
32
10
  /**
33
11
  * Error thrown when a required argument was not provided.
34
12
  */
@@ -1,10 +1,9 @@
1
- import { Middleware, ClientOptions, FetchParams, RequestContext } from "../runtime.mjs";
1
+ import { ClientOptions } from "../models.mjs";
2
2
  /**
3
- * Handles Auth0 client telemetry functionality. Can be used both as middleware
4
- * for automatic header injection and as a standalone utility for manual telemetry header generation.
3
+ * Generates the Auth0-Client telemetry header value.
5
4
  * @private
6
5
  */
7
- export declare class Auth0ClientTelemetry implements Middleware {
6
+ export declare class Auth0ClientTelemetry {
8
7
  clientInfo: {
9
8
  name: string;
10
9
  [key: string]: unknown;
@@ -12,9 +11,6 @@ export declare class Auth0ClientTelemetry implements Middleware {
12
11
  constructor(options: ClientOptions);
13
12
  /**
14
13
  * Get the Auth0-Client header value for telemetry.
15
- * This method can be used when you need to manually add telemetry headers
16
- * instead of using the middleware system.
17
14
  */
18
15
  getAuth0ClientHeader(): string | undefined;
19
- pre?(context: RequestContext): Promise<FetchParams | void>;
20
16
  }
@@ -1,17 +1,7 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
1
  import { generateClientInfo } from "../../utils.mjs";
11
2
  import { base64url } from "jose";
12
3
  /**
13
- * Handles Auth0 client telemetry functionality. Can be used both as middleware
14
- * for automatic header injection and as a standalone utility for manual telemetry header generation.
4
+ * Generates the Auth0-Client telemetry header value.
15
5
  * @private
16
6
  */
17
7
  export class Auth0ClientTelemetry {
@@ -20,8 +10,6 @@ export class Auth0ClientTelemetry {
20
10
  }
21
11
  /**
22
12
  * Get the Auth0-Client header value for telemetry.
23
- * This method can be used when you need to manually add telemetry headers
24
- * instead of using the middleware system.
25
13
  */
26
14
  getAuth0ClientHeader() {
27
15
  if ("string" === typeof this.clientInfo.name && this.clientInfo.name.length > 0) {
@@ -29,16 +17,4 @@ export class Auth0ClientTelemetry {
29
17
  }
30
18
  return undefined;
31
19
  }
32
- pre(context) {
33
- return __awaiter(this, void 0, void 0, function* () {
34
- const headerValue = this.getAuth0ClientHeader();
35
- if (headerValue) {
36
- context.init.headers = Object.assign(Object.assign({}, context.init.headers), { "Auth0-Client": headerValue });
37
- }
38
- return {
39
- url: context.url,
40
- init: context.init,
41
- };
42
- });
43
- }
44
20
  }
@@ -71,30 +71,6 @@ export interface ApiResponse<T> {
71
71
  status: number;
72
72
  statusText: string;
73
73
  }
74
- export declare class JSONApiResponse<T> implements ApiResponse<T> {
75
- data: T;
76
- headers: Headers;
77
- readonly status: number;
78
- readonly statusText: string;
79
- constructor(data: T, headers: Headers, status: number, statusText: string);
80
- static fromResponse<T = unknown>(raw: Response): Promise<JSONApiResponse<T>>;
81
- }
82
- export declare class VoidApiResponse implements ApiResponse<undefined> {
83
- headers: Headers;
84
- readonly status: number;
85
- readonly statusText: string;
86
- data: undefined;
87
- constructor(headers: Headers, status: number, statusText: string);
88
- static fromResponse(raw: Response): Promise<VoidApiResponse>;
89
- }
90
- export declare class TextApiResponse implements ApiResponse<string> {
91
- data: string;
92
- headers: Headers;
93
- readonly status: number;
94
- readonly statusText: string;
95
- constructor(data: string, headers: Headers, status: number, statusText: string);
96
- static fromResponse(raw: Response): Promise<TextApiResponse>;
97
- }
98
74
  export interface FetchParams {
99
75
  url: string | URL | Request;
100
76
  init: RequestInit;
@@ -1,49 +1 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- export class JSONApiResponse {
11
- constructor(data, headers, status, statusText) {
12
- this.data = data;
13
- this.headers = headers;
14
- this.status = status;
15
- this.statusText = statusText;
16
- }
17
- static fromResponse(raw) {
18
- return __awaiter(this, void 0, void 0, function* () {
19
- const value = (yield raw.json());
20
- return new JSONApiResponse(value, raw.headers, raw.status, raw.statusText);
21
- });
22
- }
23
- }
24
- export class VoidApiResponse {
25
- constructor(headers, status, statusText) {
26
- this.headers = headers;
27
- this.status = status;
28
- this.statusText = statusText;
29
- }
30
- static fromResponse(raw) {
31
- return __awaiter(this, void 0, void 0, function* () {
32
- return new VoidApiResponse(raw.headers, raw.status, raw.statusText);
33
- });
34
- }
35
- }
36
- export class TextApiResponse {
37
- constructor(data, headers, status, statusText) {
38
- this.data = data;
39
- this.headers = headers;
40
- this.status = status;
41
- this.statusText = statusText;
42
- }
43
- static fromResponse(raw) {
44
- return __awaiter(this, void 0, void 0, function* () {
45
- const value = yield raw.text();
46
- return new TextApiResponse(value, raw.headers, raw.status, raw.statusText);
47
- });
48
- }
49
- }
1
+ export {};
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "6.4.0";
1
+ export declare const SDK_VERSION = "7.0.0";
@@ -1 +1 @@
1
- export const SDK_VERSION = "6.4.0";
1
+ export const SDK_VERSION = "7.0.0";
@@ -15,7 +15,7 @@ export declare namespace ManagementClient {
15
15
  * @group Management API
16
16
  * @public
17
17
  */
18
- interface ManagementClientOptions extends Omit<FernClient.Options, "token" | "environment" | "fetcher" | "baseUrl" | "fetch"> {
18
+ interface ManagementClientOptions extends Omit<FernClient.Options, "token" | "environment" | "fetcher" | "baseUrl"> {
19
19
  /** Auth0 domain (e.g., 'your-tenant.auth0.com') */
20
20
  domain: string;
21
21
  /**
@@ -114,7 +114,14 @@ export declare namespace ManagementClient {
114
114
  clientAssertionSigningKey: string;
115
115
  /** Algorithm for signing the client assertion. Defaults to RS256 */
116
116
  clientAssertionSigningAlg?: string;
117
- /** Enable mTLS for token endpoint calls */
117
+ /**
118
+ * Enable mTLS for token endpoint calls.
119
+ *
120
+ * mTLS (RFC 8705) is a transport-layer concern that is independent of the client
121
+ * authentication method: a client authenticating with `private_key_jwt` can still present a
122
+ * TLS client certificate to obtain a certificate-bound access token. This mirrors v6, which
123
+ * added the `mtls.` endpoint alias from `useMTLS` alone regardless of the auth method.
124
+ */
118
125
  useMTLS?: boolean;
119
126
  }
120
127
  /**
@@ -71,7 +71,6 @@ export class ManagementClient extends FernClient {
71
71
  const token = createTokenSupplier(_options);
72
72
  // Temporarily remove fetcher from options to avoid people passing it for now
73
73
  delete _options.fetcher;
74
- delete _options.fetch;
75
74
  // Prepare the base client options
76
75
  let clientOptions = Object.assign(Object.assign({}, _options), { baseUrl,
77
76
  headers,
@@ -1,7 +1,6 @@
1
- import { ManagementClient } from "./ManagementClient.mjs";
1
+ import type { ManagementClient } from "./ManagementClient.mjs";
2
2
  export declare class TokenProvider {
3
3
  private readonly options;
4
- private authenticationClient;
5
4
  private expiresAt;
6
5
  private accessToken;
7
6
  private pending;
@@ -12,4 +11,7 @@ export declare class TokenProvider {
12
11
  audience: string;
13
12
  });
14
13
  getAccessToken(): Promise<string>;
14
+ private fetchToken;
15
+ private buildClientAssertion;
16
+ private buildTelemetryHeader;
15
17
  }
@@ -7,30 +7,161 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { AuthenticationClient } from "../../auth/index.mjs";
11
- const LEEWAY = 10 * 1000;
10
+ import { base64url, importPKCS8, SignJWT } from "jose";
11
+ import { generateClientInfo } from "../../utils.mjs";
12
+ import { ManagementError } from "../errors/ManagementError.mjs";
13
+ const LEEWAY = 10 * 1000; // 10s refresh-ahead in ms
12
14
  export class TokenProvider {
13
15
  constructor(options) {
14
16
  this.options = options;
15
17
  this.expiresAt = 0;
16
18
  this.accessToken = "";
17
- this.authenticationClient = new AuthenticationClient(Object.assign(Object.assign({}, options), { headers: options.headers }));
19
+ // Validate domain: must be a bare hostname, no slashes or query strings.
20
+ if (/[/?#]/.test(options.domain)) {
21
+ throw new Error(`ManagementClient: invalid domain "${options.domain}". Provide a bare hostname, e.g. "tenant.auth0.com".`);
22
+ }
23
+ if (options.useMTLS) {
24
+ const { fetch: customFetch } = options;
25
+ if (!customFetch) {
26
+ throw new Error("ManagementClient: useMTLS requires a custom fetch implementation. " +
27
+ "Provide a `fetch` option configured with your mTLS client certificate.");
28
+ }
29
+ // mTLS (RFC 8705) is a transport-layer concern independent of the client authentication
30
+ // method. It combines with both `clientSecret` and `clientAssertionSigningKey`: the TLS
31
+ // client certificate yields a certificate-bound token regardless of how the client
32
+ // authenticates. v6 supported this, so no auth-method restriction is imposed here.
33
+ }
18
34
  }
19
35
  getAccessToken() {
20
36
  return __awaiter(this, void 0, void 0, function* () {
21
37
  if (!this.accessToken || Date.now() > this.expiresAt - LEEWAY) {
22
- this.pending =
23
- this.pending ||
24
- this.authenticationClient.oauth.clientCredentialsGrant({
25
- audience: this.options.audience,
26
- });
27
- const { data: { access_token: accessToken, expires_in: expiresIn }, } = yield this.pending.finally(() => {
38
+ this.pending = this.pending || this.fetchToken();
39
+ const result = yield this.pending.finally(() => {
28
40
  delete this.pending;
29
41
  });
30
- this.expiresAt = Date.now() + expiresIn * 1000;
31
- this.accessToken = accessToken;
42
+ this.expiresAt = result.expiresAt;
43
+ this.accessToken = result.accessToken;
32
44
  }
33
45
  return this.accessToken;
34
46
  });
35
47
  }
48
+ fetchToken() {
49
+ return __awaiter(this, void 0, void 0, function* () {
50
+ var _a;
51
+ const { domain, clientId, audience } = this.options;
52
+ const tokenUrl = this.options.useMTLS ? `https://mtls.${domain}/oauth/token` : `https://${domain}/oauth/token`;
53
+ const body = new URLSearchParams({
54
+ grant_type: "client_credentials",
55
+ client_id: clientId,
56
+ audience,
57
+ });
58
+ if ("clientSecret" in this.options) {
59
+ body.set("client_secret", this.options.clientSecret);
60
+ }
61
+ else if ("clientAssertionSigningKey" in this.options) {
62
+ const assertion = yield this.buildClientAssertion(domain, clientId);
63
+ body.set("client_assertion", assertion);
64
+ body.set("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer");
65
+ }
66
+ // Build request headers. Start with user-supplied plain-string headers so they can be
67
+ // overridden by SDK-controlled values (Content-Type, Auth0-Client) set below.
68
+ // Supplier-function headers (Fern's Supplier<string | null | undefined> type) are skipped —
69
+ // they require async resolution and are not supported on the token endpoint path.
70
+ const userHeaders = (_a = this.options.headers) !== null && _a !== void 0 ? _a : {};
71
+ const headers = {};
72
+ for (const [key, value] of Object.entries(userHeaders)) {
73
+ if (typeof value === "string") {
74
+ headers[key.toLowerCase()] = value;
75
+ }
76
+ }
77
+ headers["content-type"] = "application/x-www-form-urlencoded";
78
+ const telemetryHeader = this.buildTelemetryHeader();
79
+ if (telemetryHeader) {
80
+ headers["auth0-client"] = telemetryHeader;
81
+ }
82
+ // Use custom fetch for mTLS, else global fetch.
83
+ // `fetch` is defined on BaseClientOptions (src/management/BaseClient.ts) which is Fern-generated.
84
+ // If that file is regenerated, verify `fetch?: typeof fetch` is still present — token acquisition
85
+ // for mTLS depends on it being forwarded here.
86
+ const { fetch: customFetch } = this.options;
87
+ const fetcher = customFetch !== null && customFetch !== void 0 ? customFetch : fetch;
88
+ let response;
89
+ try {
90
+ response = yield fetcher(tokenUrl, {
91
+ method: "POST",
92
+ headers,
93
+ body: body.toString(),
94
+ signal: AbortSignal.timeout(10000),
95
+ });
96
+ }
97
+ catch (err) {
98
+ // Built-in fetch aborts with a "TimeoutError"; node-fetch (used on the mTLS path with a
99
+ // custom fetch) aborts with an "AbortError". Match both so a token-request timeout maps
100
+ // to a 408 regardless of the underlying fetch implementation.
101
+ if (err instanceof Error && (err.name === "TimeoutError" || err.name === "AbortError")) {
102
+ throw new ManagementError({
103
+ message: "ManagementClient: token request timed out",
104
+ statusCode: 408,
105
+ });
106
+ }
107
+ throw err;
108
+ }
109
+ if (!response.ok) {
110
+ // Read the body exactly once. `response.json()` followed by `response.text()` throws
111
+ // "Body has already been read", which would swallow non-JSON error payloads (e.g. proxy
112
+ // or WAF 502s). Read text, then attempt to parse it as JSON.
113
+ const raw = yield response.text().catch(() => "");
114
+ let errorBody;
115
+ try {
116
+ errorBody = raw ? JSON.parse(raw) : response.statusText;
117
+ }
118
+ catch (_b) {
119
+ errorBody = raw || response.statusText;
120
+ }
121
+ throw new ManagementError({
122
+ message: "ManagementClient: token request failed",
123
+ statusCode: response.status,
124
+ body: errorBody,
125
+ });
126
+ }
127
+ const json = (yield response.json());
128
+ return {
129
+ accessToken: json.access_token,
130
+ expiresAt: Date.now() + json.expires_in * 1000,
131
+ };
132
+ });
133
+ }
134
+ buildClientAssertion(domain, clientId) {
135
+ return __awaiter(this, void 0, void 0, function* () {
136
+ const { clientAssertionSigningKey, clientAssertionSigningAlg = "RS256" } = this
137
+ .options;
138
+ const key = yield importPKCS8(clientAssertionSigningKey, clientAssertionSigningAlg);
139
+ const now = Math.floor(Date.now() / 1000);
140
+ return new SignJWT({})
141
+ .setProtectedHeader({ alg: clientAssertionSigningAlg })
142
+ .setIssuedAt(now)
143
+ .setIssuer(clientId)
144
+ .setSubject(clientId)
145
+ .setAudience(`https://${domain}/`)
146
+ .setExpirationTime(now + 180) // 3 min lifetime
147
+ .setJti(crypto.randomUUID())
148
+ .sign(key);
149
+ });
150
+ }
151
+ buildTelemetryHeader() {
152
+ var _a;
153
+ const opts = this.options;
154
+ if (opts.telemetry === false)
155
+ return null;
156
+ const nodeAuth0Info = generateClientInfo();
157
+ const info = opts.clientInfo
158
+ ? { name: opts.clientInfo.name, version: String((_a = opts.clientInfo.version) !== null && _a !== void 0 ? _a : nodeAuth0Info.version) }
159
+ : { name: nodeAuth0Info.name, version: nodeAuth0Info.version };
160
+ // NOTE: auth0-auth-js TelemetryConfig does not support env fields.
161
+ // The runtime fingerprint (env.node / env.cloudflare-workers) present in the
162
+ // original node-auth0 Auth0-Client header is intentionally omitted here.
163
+ // This is a known, accepted delta vs the pre-v7 token request telemetry shape.
164
+ // Use jose's base64url encoder for runtime portability (Buffer is Node-only).
165
+ return base64url.encode(new TextEncoder().encode(JSON.stringify(info)));
166
+ }
36
167
  }
@@ -5,21 +5,3 @@ export declare const generateClientInfo: () => {
5
5
  [x: string]: string;
6
6
  };
7
7
  };
8
- /**
9
- * @private
10
- */
11
- export declare const mtlsPrefix = "mtls";
12
- type SyncGetter<T> = () => T;
13
- type AsyncGetter<T> = () => Promise<T>;
14
- /**
15
- * Resolves a value that can be a static value, a synchronous function, or an asynchronous function.
16
- *
17
- * @template T - The type of the value to be resolved.
18
- * @param {T | SyncGetter<T> | AsyncGetter<T>} value - The value to be resolved. It can be:
19
- * - A static value of type T.
20
- * - A synchronous function that returns a value of type T.
21
- * - An asynchronous function that returns a Promise of type T.
22
- * @returns {Promise<T>} A promise that resolves to the value of type T.
23
- */
24
- export declare const resolveValueToPromise: <T>(value: T | SyncGetter<T> | AsyncGetter<T>) => Promise<T>;
25
- export {};
@@ -1,12 +1,3 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
1
  import { SDK_VERSION as version } from "./management/version.mjs";
11
2
  import { RUNTIME } from "./management/core/index.mjs";
12
3
  export const generateClientInfo = () => {
@@ -22,24 +13,3 @@ export const generateClientInfo = () => {
22
13
  },
23
14
  };
24
15
  };
25
- /**
26
- * @private
27
- */
28
- export const mtlsPrefix = "mtls";
29
- /**
30
- * Resolves a value that can be a static value, a synchronous function, or an asynchronous function.
31
- *
32
- * @template T - The type of the value to be resolved.
33
- * @param {T | SyncGetter<T> | AsyncGetter<T>} value - The value to be resolved. It can be:
34
- * - A static value of type T.
35
- * - A synchronous function that returns a value of type T.
36
- * - An asynchronous function that returns a Promise of type T.
37
- * @returns {Promise<T>} A promise that resolves to the value of type T.
38
- */
39
- export const resolveValueToPromise = (value) => __awaiter(void 0, void 0, void 0, function* () {
40
- if (typeof value === "function") {
41
- const result = value(); // Call the function
42
- return result instanceof Promise ? result : Promise.resolve(result); // Handle sync/async
43
- }
44
- return Promise.resolve(value); // Static value
45
- });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "auth0",
3
- "version": "6.4.0",
3
+ "version": "7.0.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -1732,7 +1732,6 @@
1732
1732
  "validate": "yarn lint:check && yarn format --check && yarn build && yarn test && yarn lint:package"
1733
1733
  },
1734
1734
  "dependencies": {
1735
- "uuid": "^11.1.1",
1736
1735
  "jose": "^5.0.0",
1737
1736
  "auth0-legacy": "npm:auth0@^4.37.1"
1738
1737
  },