@spyglasshq/sdk 0.1.6 → 0.1.7
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/dist/cjs/BaseClient.d.ts +4 -4
- package/dist/cjs/BaseClient.js +7 -7
- package/dist/cjs/Client.d.ts +5 -5
- package/dist/cjs/Client.js +56 -38
- package/dist/cjs/api/client/index.d.ts +1 -1
- package/dist/cjs/api/client/requests/SearchBrandsRequest.js +6 -6
- package/dist/cjs/api/client/requests/SearchCreatorsRequest.js +174 -174
- package/dist/cjs/api/client/requests/SearchMediaRequest.js +223 -223
- package/dist/cjs/api/client/requests/index.d.ts +5 -5
- package/dist/cjs/api/errors/BadRequestError.d.ts +3 -3
- package/dist/cjs/api/errors/BadRequestError.js +2 -2
- package/dist/cjs/api/errors/ContentTooLargeError.d.ts +3 -3
- package/dist/cjs/api/errors/ContentTooLargeError.js +2 -2
- package/dist/cjs/api/errors/ForbiddenError.d.ts +3 -3
- package/dist/cjs/api/errors/ForbiddenError.js +2 -2
- package/dist/cjs/api/errors/InternalServerError.d.ts +3 -3
- package/dist/cjs/api/errors/InternalServerError.js +2 -2
- package/dist/cjs/api/errors/MethodNotAllowedError.d.ts +3 -3
- package/dist/cjs/api/errors/MethodNotAllowedError.js +2 -2
- package/dist/cjs/api/errors/NotFoundError.d.ts +3 -3
- package/dist/cjs/api/errors/NotFoundError.js +2 -2
- package/dist/cjs/api/errors/PaymentRequiredError.d.ts +3 -3
- package/dist/cjs/api/errors/PaymentRequiredError.js +2 -2
- package/dist/cjs/api/errors/TooManyRequestsError.d.ts +3 -3
- package/dist/cjs/api/errors/TooManyRequestsError.js +2 -2
- package/dist/cjs/api/errors/UnauthorizedError.d.ts +3 -3
- package/dist/cjs/api/errors/UnauthorizedError.js +2 -2
- package/dist/cjs/api/errors/index.d.ts +9 -9
- package/dist/cjs/api/index.d.ts +4 -4
- package/dist/cjs/api/resources/account/client/Client.d.ts +4 -4
- package/dist/cjs/api/resources/account/client/Client.js +38 -23
- package/dist/cjs/api/resources/account/client/index.d.ts +1 -1
- package/dist/cjs/api/resources/account/client/requests/InsightsAccountRequest.d.ts +1 -1
- package/dist/cjs/api/resources/account/client/requests/LandingPagesAccountRequest.d.ts +1 -1
- package/dist/cjs/api/resources/account/client/requests/index.d.ts +5 -5
- package/dist/cjs/api/resources/account/exports.d.ts +2 -2
- package/dist/cjs/api/resources/account/index.d.ts +2 -2
- package/dist/cjs/api/resources/account/types/GetAccountResponse.d.ts +3 -3
- package/dist/cjs/api/resources/account/types/IndexAccountResponse.js +2 -2
- package/dist/cjs/api/resources/account/types/IndexStatusAccountResponse.js +2 -2
- package/dist/cjs/api/resources/account/types/InsightsAccountRequestType.js +4 -4
- package/dist/cjs/api/resources/account/types/InsightsAccountResponse.d.ts +2 -2
- package/dist/cjs/api/resources/account/types/LandingPagesAccountRequestShowInactive.js +2 -2
- package/dist/cjs/api/resources/account/types/index.d.ts +7 -7
- package/dist/cjs/api/resources/index.d.ts +3 -3
- package/dist/cjs/api/types/Error_.js +11 -11
- package/dist/cjs/api/types/SearchBrandsResponse.js +1 -1
- package/dist/cjs/api/types/SearchCreatorsResponse.js +1 -1
- package/dist/cjs/api/types/SearchMediaResponse.js +26 -26
- package/dist/cjs/api/types/index.d.ts +7 -7
- package/dist/cjs/auth/BearerAuthProvider.d.ts +1 -1
- package/dist/cjs/auth/BearerAuthProvider.js +2 -2
- package/dist/cjs/auth/index.d.ts +1 -1
- package/dist/cjs/core/auth/AuthProvider.d.ts +2 -2
- package/dist/cjs/core/auth/AuthProvider.js +3 -3
- package/dist/cjs/core/auth/BasicAuth.js +7 -7
- package/dist/cjs/core/auth/BearerToken.js +1 -1
- package/dist/cjs/core/auth/NoOpAuthProvider.d.ts +2 -2
- package/dist/cjs/core/auth/index.d.ts +5 -5
- package/dist/cjs/core/base64.js +4 -4
- package/dist/cjs/core/exports.d.ts +1 -1
- package/dist/cjs/core/fetcher/APIResponse.d.ts +1 -1
- package/dist/cjs/core/fetcher/BinaryResponse.d.ts +4 -4
- package/dist/cjs/core/fetcher/BinaryResponse.js +1 -1
- package/dist/cjs/core/fetcher/EndpointSupplier.d.ts +2 -2
- package/dist/cjs/core/fetcher/EndpointSupplier.js +1 -1
- package/dist/cjs/core/fetcher/Fetcher.d.ts +11 -11
- package/dist/cjs/core/fetcher/Fetcher.js +56 -50
- package/dist/cjs/core/fetcher/Headers.js +10 -10
- package/dist/cjs/core/fetcher/HttpResponsePromise.d.ts +2 -2
- package/dist/cjs/core/fetcher/RawResponse.d.ts +1 -1
- package/dist/cjs/core/fetcher/RawResponse.js +6 -6
- package/dist/cjs/core/fetcher/Supplier.js +1 -1
- package/dist/cjs/core/fetcher/createRequestUrl.js +1 -1
- package/dist/cjs/core/fetcher/getErrorResponseBody.js +11 -11
- package/dist/cjs/core/fetcher/getRequestBody.d.ts +2 -2
- package/dist/cjs/core/fetcher/getRequestBody.js +4 -4
- package/dist/cjs/core/fetcher/getResponseBody.d.ts +2 -2
- package/dist/cjs/core/fetcher/getResponseBody.js +11 -11
- package/dist/cjs/core/fetcher/index.d.ts +13 -13
- package/dist/cjs/core/fetcher/makePassthroughRequest.d.ts +2 -2
- package/dist/cjs/core/fetcher/makePassthroughRequest.js +7 -7
- package/dist/cjs/core/fetcher/makeRequest.js +3 -3
- package/dist/cjs/core/fetcher/redactUrl.js +36 -36
- package/dist/cjs/core/fetcher/requestWithRetries.js +4 -4
- package/dist/cjs/core/fetcher/signals.js +2 -2
- package/dist/cjs/core/index.d.ts +6 -6
- package/dist/cjs/core/logging/exports.d.ts +1 -1
- package/dist/cjs/core/logging/index.d.ts +1 -1
- package/dist/cjs/core/logging/logger.js +4 -4
- package/dist/cjs/core/requestBody.js +1 -1
- package/dist/cjs/core/runtime/index.d.ts +1 -1
- package/dist/cjs/core/runtime/runtime.d.ts +1 -1
- package/dist/cjs/core/runtime/runtime.js +37 -35
- package/dist/cjs/core/url/QueryStringBuilder.d.ts +1 -1
- package/dist/cjs/core/url/QueryStringBuilder.js +3 -3
- package/dist/cjs/core/url/encodePathParam.js +10 -8
- package/dist/cjs/core/url/index.d.ts +4 -4
- package/dist/cjs/core/url/join.js +11 -11
- package/dist/cjs/core/url/qs.d.ts +1 -1
- package/dist/cjs/core/url/qs.js +14 -14
- package/dist/cjs/environments.js +1 -1
- package/dist/cjs/errors/SpyglassError.d.ts +1 -1
- package/dist/cjs/errors/SpyglassError.js +3 -3
- package/dist/cjs/errors/SpyglassTimeoutError.d.ts +1 -1
- package/dist/cjs/errors/SpyglassTimeoutError.js +1 -1
- package/dist/cjs/errors/handleNonStatusCodeError.d.ts +1 -1
- package/dist/cjs/errors/handleNonStatusCodeError.js +5 -5
- package/dist/cjs/errors/index.d.ts +2 -2
- package/dist/cjs/exports.d.ts +1 -1
- package/dist/cjs/index.d.ts +6 -6
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.d.mts +4 -4
- package/dist/esm/BaseClient.mjs +10 -10
- package/dist/esm/Client.d.mts +5 -5
- package/dist/esm/Client.mjs +65 -47
- package/dist/esm/api/client/index.d.mts +1 -1
- package/dist/esm/api/client/index.mjs +1 -1
- package/dist/esm/api/client/requests/SearchBrandsRequest.mjs +6 -6
- package/dist/esm/api/client/requests/SearchCreatorsRequest.mjs +174 -174
- package/dist/esm/api/client/requests/SearchMediaRequest.mjs +223 -223
- package/dist/esm/api/client/requests/index.d.mts +5 -5
- package/dist/esm/api/client/requests/index.mjs +3 -3
- package/dist/esm/api/errors/BadRequestError.d.mts +3 -3
- package/dist/esm/api/errors/BadRequestError.mjs +3 -3
- package/dist/esm/api/errors/ContentTooLargeError.d.mts +3 -3
- package/dist/esm/api/errors/ContentTooLargeError.mjs +3 -3
- package/dist/esm/api/errors/ForbiddenError.d.mts +3 -3
- package/dist/esm/api/errors/ForbiddenError.mjs +3 -3
- package/dist/esm/api/errors/InternalServerError.d.mts +3 -3
- package/dist/esm/api/errors/InternalServerError.mjs +3 -3
- package/dist/esm/api/errors/MethodNotAllowedError.d.mts +3 -3
- package/dist/esm/api/errors/MethodNotAllowedError.mjs +3 -3
- package/dist/esm/api/errors/NotFoundError.d.mts +3 -3
- package/dist/esm/api/errors/NotFoundError.mjs +3 -3
- package/dist/esm/api/errors/PaymentRequiredError.d.mts +3 -3
- package/dist/esm/api/errors/PaymentRequiredError.mjs +3 -3
- package/dist/esm/api/errors/TooManyRequestsError.d.mts +3 -3
- package/dist/esm/api/errors/TooManyRequestsError.mjs +3 -3
- package/dist/esm/api/errors/UnauthorizedError.d.mts +3 -3
- package/dist/esm/api/errors/UnauthorizedError.mjs +3 -3
- package/dist/esm/api/errors/index.d.mts +9 -9
- package/dist/esm/api/errors/index.mjs +9 -9
- package/dist/esm/api/index.d.mts +4 -4
- package/dist/esm/api/index.mjs +4 -4
- package/dist/esm/api/resources/account/client/Client.d.mts +4 -4
- package/dist/esm/api/resources/account/client/Client.mjs +46 -31
- package/dist/esm/api/resources/account/client/index.d.mts +1 -1
- package/dist/esm/api/resources/account/client/index.mjs +1 -1
- package/dist/esm/api/resources/account/client/requests/InsightsAccountRequest.d.mts +1 -1
- package/dist/esm/api/resources/account/client/requests/LandingPagesAccountRequest.d.mts +1 -1
- package/dist/esm/api/resources/account/client/requests/index.d.mts +5 -5
- package/dist/esm/api/resources/account/exports.d.mts +2 -2
- package/dist/esm/api/resources/account/exports.mjs +2 -2
- package/dist/esm/api/resources/account/index.d.mts +2 -2
- package/dist/esm/api/resources/account/index.mjs +2 -2
- package/dist/esm/api/resources/account/types/GetAccountResponse.d.mts +3 -3
- package/dist/esm/api/resources/account/types/IndexAccountResponse.mjs +2 -2
- package/dist/esm/api/resources/account/types/IndexStatusAccountResponse.mjs +2 -2
- package/dist/esm/api/resources/account/types/InsightsAccountRequestType.mjs +4 -4
- package/dist/esm/api/resources/account/types/InsightsAccountResponse.d.mts +2 -2
- package/dist/esm/api/resources/account/types/LandingPagesAccountRequestShowInactive.mjs +2 -2
- package/dist/esm/api/resources/account/types/index.d.mts +7 -7
- package/dist/esm/api/resources/account/types/index.mjs +7 -7
- package/dist/esm/api/resources/index.d.mts +3 -3
- package/dist/esm/api/resources/index.mjs +3 -3
- package/dist/esm/api/types/Error_.mjs +11 -11
- package/dist/esm/api/types/SearchBrandsResponse.mjs +1 -1
- package/dist/esm/api/types/SearchCreatorsResponse.mjs +1 -1
- package/dist/esm/api/types/SearchMediaResponse.mjs +26 -26
- package/dist/esm/api/types/index.d.mts +7 -7
- package/dist/esm/api/types/index.mjs +7 -7
- package/dist/esm/auth/BearerAuthProvider.d.mts +1 -1
- package/dist/esm/auth/BearerAuthProvider.mjs +4 -4
- package/dist/esm/auth/index.d.mts +1 -1
- package/dist/esm/auth/index.mjs +1 -1
- package/dist/esm/core/auth/AuthProvider.d.mts +2 -2
- package/dist/esm/core/auth/AuthProvider.mjs +3 -3
- package/dist/esm/core/auth/BasicAuth.mjs +8 -8
- package/dist/esm/core/auth/BearerToken.mjs +1 -1
- package/dist/esm/core/auth/NoOpAuthProvider.d.mts +2 -2
- package/dist/esm/core/auth/index.d.mts +5 -5
- package/dist/esm/core/auth/index.mjs +4 -4
- package/dist/esm/core/base64.mjs +4 -4
- package/dist/esm/core/exports.d.mts +1 -1
- package/dist/esm/core/exports.mjs +1 -1
- package/dist/esm/core/fetcher/APIResponse.d.mts +1 -1
- package/dist/esm/core/fetcher/BinaryResponse.d.mts +4 -4
- package/dist/esm/core/fetcher/BinaryResponse.mjs +1 -1
- package/dist/esm/core/fetcher/EndpointSupplier.d.mts +2 -2
- package/dist/esm/core/fetcher/EndpointSupplier.mjs +1 -1
- package/dist/esm/core/fetcher/Fetcher.d.mts +11 -11
- package/dist/esm/core/fetcher/Fetcher.mjs +70 -64
- package/dist/esm/core/fetcher/Headers.mjs +10 -10
- package/dist/esm/core/fetcher/HttpResponsePromise.d.mts +2 -2
- package/dist/esm/core/fetcher/RawResponse.d.mts +1 -1
- package/dist/esm/core/fetcher/RawResponse.mjs +7 -7
- package/dist/esm/core/fetcher/Supplier.mjs +1 -1
- package/dist/esm/core/fetcher/createRequestUrl.mjs +2 -2
- package/dist/esm/core/fetcher/getErrorResponseBody.mjs +13 -13
- package/dist/esm/core/fetcher/getRequestBody.d.mts +2 -2
- package/dist/esm/core/fetcher/getRequestBody.mjs +6 -6
- package/dist/esm/core/fetcher/getResponseBody.d.mts +2 -2
- package/dist/esm/core/fetcher/getResponseBody.mjs +13 -13
- package/dist/esm/core/fetcher/index.d.mts +13 -13
- package/dist/esm/core/fetcher/index.mjs +7 -7
- package/dist/esm/core/fetcher/makePassthroughRequest.d.mts +2 -2
- package/dist/esm/core/fetcher/makePassthroughRequest.mjs +16 -16
- package/dist/esm/core/fetcher/makeRequest.mjs +4 -4
- package/dist/esm/core/fetcher/redactUrl.mjs +36 -36
- package/dist/esm/core/fetcher/requestWithRetries.mjs +4 -4
- package/dist/esm/core/fetcher/signals.mjs +2 -2
- package/dist/esm/core/index.d.mts +6 -6
- package/dist/esm/core/index.mjs +6 -6
- package/dist/esm/core/logging/exports.d.mts +1 -1
- package/dist/esm/core/logging/exports.mjs +1 -1
- package/dist/esm/core/logging/index.d.mts +1 -1
- package/dist/esm/core/logging/index.mjs +1 -1
- package/dist/esm/core/logging/logger.mjs +4 -4
- package/dist/esm/core/requestBody.mjs +1 -1
- package/dist/esm/core/runtime/index.d.mts +1 -1
- package/dist/esm/core/runtime/index.mjs +1 -1
- package/dist/esm/core/runtime/runtime.d.mts +1 -1
- package/dist/esm/core/runtime/runtime.mjs +37 -35
- package/dist/esm/core/url/QueryStringBuilder.d.mts +1 -1
- package/dist/esm/core/url/QueryStringBuilder.mjs +4 -4
- package/dist/esm/core/url/encodePathParam.mjs +10 -8
- package/dist/esm/core/url/index.d.mts +4 -4
- package/dist/esm/core/url/index.mjs +4 -4
- package/dist/esm/core/url/join.mjs +11 -11
- package/dist/esm/core/url/qs.d.mts +1 -1
- package/dist/esm/core/url/qs.mjs +14 -14
- package/dist/esm/environments.mjs +1 -1
- package/dist/esm/errors/SpyglassError.d.mts +1 -1
- package/dist/esm/errors/SpyglassError.mjs +4 -4
- package/dist/esm/errors/SpyglassTimeoutError.d.mts +1 -1
- package/dist/esm/errors/SpyglassTimeoutError.mjs +2 -2
- package/dist/esm/errors/handleNonStatusCodeError.d.mts +1 -1
- package/dist/esm/errors/handleNonStatusCodeError.mjs +6 -6
- package/dist/esm/errors/index.d.mts +2 -2
- package/dist/esm/errors/index.mjs +2 -2
- package/dist/esm/exports.d.mts +1 -1
- package/dist/esm/exports.mjs +1 -1
- package/dist/esm/index.d.mts +6 -6
- package/dist/esm/index.mjs +5 -5
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +91 -91
- package/reference.md +83 -82
|
@@ -1 +1 @@
|
|
|
1
|
-
export { getUserAgent, RUNTIME } from
|
|
1
|
+
export { getUserAgent, RUNTIME } from './runtime.js';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export declare const RUNTIME: Runtime;
|
|
5
5
|
export interface Runtime {
|
|
6
|
-
type:
|
|
6
|
+
type: 'browser' | 'web-worker' | 'deno' | 'bun' | 'node' | 'react-native' | 'unknown' | 'workerd' | 'edge-runtime';
|
|
7
7
|
version?: string;
|
|
8
8
|
parsedVersion?: number;
|
|
9
9
|
/**
|
|
@@ -11,10 +11,10 @@ function evaluateRuntime() {
|
|
|
11
11
|
/**
|
|
12
12
|
* A constant that indicates whether the environment the code is running is a Web Browser.
|
|
13
13
|
*/
|
|
14
|
-
const isBrowser = typeof window !==
|
|
14
|
+
const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
|
|
15
15
|
if (isBrowser) {
|
|
16
16
|
return {
|
|
17
|
-
type:
|
|
17
|
+
type: 'browser',
|
|
18
18
|
version: window.navigator.userAgent,
|
|
19
19
|
};
|
|
20
20
|
}
|
|
@@ -22,43 +22,45 @@ function evaluateRuntime() {
|
|
|
22
22
|
* A constant that indicates whether the environment the code is running is Cloudflare.
|
|
23
23
|
* https://developers.cloudflare.com/workers/runtime-apis/web-standards/#navigatoruseragent
|
|
24
24
|
*/
|
|
25
|
-
const isCloudflare = typeof globalThis !==
|
|
25
|
+
const isCloudflare = typeof globalThis !== 'undefined' && ((_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.navigator) === null || _a === void 0 ? void 0 : _a.userAgent) === 'Cloudflare-Workers';
|
|
26
26
|
if (isCloudflare) {
|
|
27
27
|
return {
|
|
28
|
-
type:
|
|
28
|
+
type: 'workerd',
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* A constant that indicates whether the environment the code is running is Edge Runtime.
|
|
33
33
|
* https://vercel.com/docs/functions/runtimes/edge-runtime#check-if-you're-running-on-the-edge-runtime
|
|
34
34
|
*/
|
|
35
|
-
const isEdgeRuntime = typeof EdgeRuntime ===
|
|
35
|
+
const isEdgeRuntime = typeof EdgeRuntime === 'string';
|
|
36
36
|
if (isEdgeRuntime) {
|
|
37
37
|
return {
|
|
38
|
-
type:
|
|
38
|
+
type: 'edge-runtime',
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
42
|
* A constant that indicates whether the environment the code is running is a Web Worker.
|
|
43
43
|
*/
|
|
44
|
-
const isWebWorker = typeof self ===
|
|
45
|
-
typeof (self === null || self === void 0 ? void 0 : self.importScripts) ===
|
|
46
|
-
(((_b = self.constructor) === null || _b === void 0 ? void 0 : _b.name) ===
|
|
47
|
-
((_c = self.constructor) === null || _c === void 0 ? void 0 : _c.name) ===
|
|
48
|
-
((_d = self.constructor) === null || _d === void 0 ? void 0 : _d.name) ===
|
|
44
|
+
const isWebWorker = typeof self === 'object' &&
|
|
45
|
+
typeof (self === null || self === void 0 ? void 0 : self.importScripts) === 'function' &&
|
|
46
|
+
(((_b = self.constructor) === null || _b === void 0 ? void 0 : _b.name) === 'DedicatedWorkerGlobalScope' ||
|
|
47
|
+
((_c = self.constructor) === null || _c === void 0 ? void 0 : _c.name) === 'ServiceWorkerGlobalScope' ||
|
|
48
|
+
((_d = self.constructor) === null || _d === void 0 ? void 0 : _d.name) === 'SharedWorkerGlobalScope');
|
|
49
49
|
if (isWebWorker) {
|
|
50
50
|
return {
|
|
51
|
-
type:
|
|
51
|
+
type: 'web-worker',
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
55
|
* A constant that indicates whether the environment the code is running is Deno.
|
|
56
56
|
* FYI Deno spoofs process.versions.node, see https://deno.land/std@0.177.0/node/process.ts?s=versions
|
|
57
57
|
*/
|
|
58
|
-
const isDeno = typeof Deno !==
|
|
58
|
+
const isDeno = typeof Deno !== 'undefined' &&
|
|
59
|
+
typeof Deno.version !== 'undefined' &&
|
|
60
|
+
typeof Deno.version.deno !== 'undefined';
|
|
59
61
|
if (isDeno) {
|
|
60
62
|
return {
|
|
61
|
-
type:
|
|
63
|
+
type: 'deno',
|
|
62
64
|
version: Deno.version.deno,
|
|
63
65
|
os: (_e = Deno.build) === null || _e === void 0 ? void 0 : _e.os,
|
|
64
66
|
arch: (_f = Deno.build) === null || _f === void 0 ? void 0 : _f.arch,
|
|
@@ -67,13 +69,13 @@ function evaluateRuntime() {
|
|
|
67
69
|
/**
|
|
68
70
|
* A constant that indicates whether the environment the code is running is Bun.sh.
|
|
69
71
|
*/
|
|
70
|
-
const isBun = typeof Bun !==
|
|
72
|
+
const isBun = typeof Bun !== 'undefined' && typeof Bun.version !== 'undefined';
|
|
71
73
|
if (isBun) {
|
|
72
74
|
return {
|
|
73
|
-
type:
|
|
75
|
+
type: 'bun',
|
|
74
76
|
version: Bun.version,
|
|
75
|
-
os: typeof process !==
|
|
76
|
-
arch: typeof process !==
|
|
77
|
+
os: typeof process !== 'undefined' ? process.platform : undefined,
|
|
78
|
+
arch: typeof process !== 'undefined' ? process.arch : undefined,
|
|
77
79
|
};
|
|
78
80
|
}
|
|
79
81
|
/**
|
|
@@ -81,10 +83,10 @@ function evaluateRuntime() {
|
|
|
81
83
|
* This check should come before Node.js detection since React Native may have a process polyfill.
|
|
82
84
|
* https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Core/setUpNavigator.js
|
|
83
85
|
*/
|
|
84
|
-
const isReactNative = typeof navigator !==
|
|
86
|
+
const isReactNative = typeof navigator !== 'undefined' && (navigator === null || navigator === void 0 ? void 0 : navigator.product) === 'ReactNative';
|
|
85
87
|
if (isReactNative) {
|
|
86
88
|
return {
|
|
87
|
-
type:
|
|
89
|
+
type: 'react-native',
|
|
88
90
|
};
|
|
89
91
|
}
|
|
90
92
|
/**
|
|
@@ -94,19 +96,19 @@ function evaluateRuntime() {
|
|
|
94
96
|
* bundlers that perform static analysis on `process.versions` (e.g. Next.js
|
|
95
97
|
* Edge Runtime warns about Node.js APIs even when they are guarded).
|
|
96
98
|
*/
|
|
97
|
-
const _process = typeof process !==
|
|
98
|
-
const isNode = typeof _process !==
|
|
99
|
+
const _process = typeof process !== 'undefined' ? process : undefined;
|
|
100
|
+
const isNode = typeof _process !== 'undefined' && typeof ((_g = _process.versions) === null || _g === void 0 ? void 0 : _g.node) === 'string';
|
|
99
101
|
if (isNode) {
|
|
100
102
|
return {
|
|
101
|
-
type:
|
|
103
|
+
type: 'node',
|
|
102
104
|
version: _process.versions.node,
|
|
103
|
-
parsedVersion: Number(_process.versions.node.split(
|
|
105
|
+
parsedVersion: Number(_process.versions.node.split('.')[0]),
|
|
104
106
|
os: _process.platform,
|
|
105
107
|
arch: _process.arch,
|
|
106
108
|
};
|
|
107
109
|
}
|
|
108
110
|
return {
|
|
109
|
-
type:
|
|
111
|
+
type: 'unknown',
|
|
110
112
|
};
|
|
111
113
|
}
|
|
112
114
|
/**
|
|
@@ -116,14 +118,14 @@ function evaluateRuntime() {
|
|
|
116
118
|
* to `undefined` so they are omitted from the User-Agent.
|
|
117
119
|
*/
|
|
118
120
|
const RUNTIME_DISPLAY_NAMES = {
|
|
119
|
-
node:
|
|
120
|
-
deno:
|
|
121
|
-
bun:
|
|
121
|
+
node: 'Node',
|
|
122
|
+
deno: 'Deno',
|
|
123
|
+
bun: 'Bun',
|
|
122
124
|
browser: undefined,
|
|
123
|
-
|
|
124
|
-
|
|
125
|
+
'web-worker': undefined,
|
|
126
|
+
'react-native': undefined,
|
|
125
127
|
workerd: undefined,
|
|
126
|
-
|
|
128
|
+
'edge-runtime': undefined,
|
|
127
129
|
unknown: undefined,
|
|
128
130
|
};
|
|
129
131
|
/**
|
|
@@ -132,7 +134,7 @@ const RUNTIME_DISPLAY_NAMES = {
|
|
|
132
134
|
* consistent regardless of which runtime reports it (Node reports `x64`, others
|
|
133
135
|
* report `amd64` or `x86_64`).
|
|
134
136
|
*/
|
|
135
|
-
const X86_64_ARCH_ALIASES = new Set([
|
|
137
|
+
const X86_64_ARCH_ALIASES = new Set(['x64', 'amd64', 'x86_64']);
|
|
136
138
|
/**
|
|
137
139
|
* Normalizes a CPU architecture token, collapsing the 64-bit x86 aliases
|
|
138
140
|
* (`x64`, `amd64`, `x86_64`) to `x86_64`. Other architectures are returned
|
|
@@ -142,7 +144,7 @@ function normalizeArch(arch) {
|
|
|
142
144
|
if (arch == null) {
|
|
143
145
|
return arch;
|
|
144
146
|
}
|
|
145
|
-
return X86_64_ARCH_ALIASES.has(arch.toLowerCase()) ?
|
|
147
|
+
return X86_64_ARCH_ALIASES.has(arch.toLowerCase()) ? 'x86_64' : arch;
|
|
146
148
|
}
|
|
147
149
|
/**
|
|
148
150
|
* Percent-encodes the `@` and `/` characters in an npm package name so the
|
|
@@ -151,7 +153,7 @@ function normalizeArch(arch) {
|
|
|
151
153
|
* `@dummy/sdk` becomes `%40dummy%2Fsdk`).
|
|
152
154
|
*/
|
|
153
155
|
function encodeProductName(sdkName) {
|
|
154
|
-
return sdkName.replace(/@/g,
|
|
156
|
+
return sdkName.replace(/@/g, '%40').replace(/\//g, '%2F');
|
|
155
157
|
}
|
|
156
158
|
/**
|
|
157
159
|
* Builds a structured User-Agent string of the form
|
|
@@ -163,7 +165,7 @@ function getUserAgent(sdkName, sdkVersion) {
|
|
|
163
165
|
let userAgent = `${encodeProductName(sdkName)}/${sdkVersion}`;
|
|
164
166
|
const platform = [exports.RUNTIME.os, normalizeArch(exports.RUNTIME.arch)].filter((part) => part != null && part.length > 0);
|
|
165
167
|
if (platform.length > 0) {
|
|
166
|
-
userAgent += ` (${platform.join(
|
|
168
|
+
userAgent += ` (${platform.join('; ')})`;
|
|
167
169
|
}
|
|
168
170
|
const runtimeName = RUNTIME_DISPLAY_NAMES[exports.RUNTIME.type];
|
|
169
171
|
if (runtimeName != null) {
|
|
@@ -36,7 +36,7 @@ class QueryStringBuilder {
|
|
|
36
36
|
if (value === undefined || value === null) {
|
|
37
37
|
return this;
|
|
38
38
|
}
|
|
39
|
-
const serialized = (0, qs_js_1.toQueryString)({ [key]: value }, { arrayFormat: (options === null || options === void 0 ? void 0 : options.style) ===
|
|
39
|
+
const serialized = (0, qs_js_1.toQueryString)({ [key]: value }, { arrayFormat: (options === null || options === void 0 ? void 0 : options.style) === 'comma' ? 'comma' : 'repeat' });
|
|
40
40
|
if (serialized.length > 0) {
|
|
41
41
|
this.parts.set(key, serialized);
|
|
42
42
|
}
|
|
@@ -65,7 +65,7 @@ class QueryStringBuilder {
|
|
|
65
65
|
if (value === undefined || value === null) {
|
|
66
66
|
continue;
|
|
67
67
|
}
|
|
68
|
-
const serialized = (0, qs_js_1.toQueryString)({ [key]: value }, { arrayFormat:
|
|
68
|
+
const serialized = (0, qs_js_1.toQueryString)({ [key]: value }, { arrayFormat: 'repeat' });
|
|
69
69
|
if (serialized.length > 0) {
|
|
70
70
|
this.parts.set(key, serialized);
|
|
71
71
|
}
|
|
@@ -78,6 +78,6 @@ class QueryStringBuilder {
|
|
|
78
78
|
* Returns an empty string when no parameters were added.
|
|
79
79
|
*/
|
|
80
80
|
build() {
|
|
81
|
-
return [...this.parts.values()].join(
|
|
81
|
+
return [...this.parts.values()].join('&');
|
|
82
82
|
}
|
|
83
83
|
}
|
|
@@ -3,15 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.encodePathParam = encodePathParam;
|
|
4
4
|
function encodePathParam(param, InvalidPathParameterError) {
|
|
5
5
|
if (param === null) {
|
|
6
|
-
return
|
|
6
|
+
return 'null';
|
|
7
7
|
}
|
|
8
8
|
const typeofParam = typeof param;
|
|
9
9
|
switch (typeofParam) {
|
|
10
|
-
case
|
|
11
|
-
return
|
|
12
|
-
case
|
|
13
|
-
case
|
|
14
|
-
case
|
|
10
|
+
case 'undefined':
|
|
11
|
+
return 'undefined';
|
|
12
|
+
case 'string':
|
|
13
|
+
case 'number':
|
|
14
|
+
case 'boolean':
|
|
15
15
|
break;
|
|
16
16
|
default:
|
|
17
17
|
param = String(param);
|
|
@@ -19,9 +19,11 @@ function encodePathParam(param, InvalidPathParameterError) {
|
|
|
19
19
|
}
|
|
20
20
|
const encoded = encodeURIComponent(param);
|
|
21
21
|
// "." and ".." are dot segments: URL resolution would remove them and send the request to a different path.
|
|
22
|
-
if (encoded ===
|
|
22
|
+
if (encoded === '.' || encoded === '..') {
|
|
23
23
|
const message = `Invalid path parameter "${encoded}": "." and ".." are not allowed because they change the request path.`;
|
|
24
|
-
throw InvalidPathParameterError != null
|
|
24
|
+
throw InvalidPathParameterError != null
|
|
25
|
+
? new InvalidPathParameterError({ message })
|
|
26
|
+
: new Error(message);
|
|
25
27
|
}
|
|
26
28
|
return encoded;
|
|
27
29
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { encodePathParam } from
|
|
2
|
-
export { join } from
|
|
3
|
-
export { queryBuilder } from
|
|
4
|
-
export { toQueryString } from
|
|
1
|
+
export { encodePathParam } from './encodePathParam.js';
|
|
2
|
+
export { join } from './join.js';
|
|
3
|
+
export { queryBuilder } from './QueryStringBuilder.js';
|
|
4
|
+
export { toQueryString } from './qs.js';
|
|
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.join = join;
|
|
4
4
|
function join(base, ...segments) {
|
|
5
5
|
if (!base) {
|
|
6
|
-
return
|
|
6
|
+
return '';
|
|
7
7
|
}
|
|
8
8
|
if (segments.length === 0) {
|
|
9
9
|
return base;
|
|
10
10
|
}
|
|
11
|
-
if (base.includes(
|
|
11
|
+
if (base.includes('://')) {
|
|
12
12
|
let url;
|
|
13
13
|
try {
|
|
14
14
|
url = new URL(base);
|
|
@@ -17,15 +17,15 @@ function join(base, ...segments) {
|
|
|
17
17
|
return joinPath(base, ...segments);
|
|
18
18
|
}
|
|
19
19
|
const lastSegment = segments[segments.length - 1];
|
|
20
|
-
const shouldPreserveTrailingSlash = lastSegment === null || lastSegment === void 0 ? void 0 : lastSegment.endsWith(
|
|
20
|
+
const shouldPreserveTrailingSlash = lastSegment === null || lastSegment === void 0 ? void 0 : lastSegment.endsWith('/');
|
|
21
21
|
for (const segment of segments) {
|
|
22
22
|
const cleanSegment = trimSlashes(segment);
|
|
23
23
|
if (cleanSegment) {
|
|
24
24
|
url.pathname = joinPathSegments(url.pathname, cleanSegment);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
if (shouldPreserveTrailingSlash && !url.pathname.endsWith(
|
|
28
|
-
url.pathname +=
|
|
27
|
+
if (shouldPreserveTrailingSlash && !url.pathname.endsWith('/')) {
|
|
28
|
+
url.pathname += '/';
|
|
29
29
|
}
|
|
30
30
|
return url.toString();
|
|
31
31
|
}
|
|
@@ -37,20 +37,20 @@ function joinPath(base, ...segments) {
|
|
|
37
37
|
}
|
|
38
38
|
let result = base;
|
|
39
39
|
const lastSegment = segments[segments.length - 1];
|
|
40
|
-
const shouldPreserveTrailingSlash = lastSegment === null || lastSegment === void 0 ? void 0 : lastSegment.endsWith(
|
|
40
|
+
const shouldPreserveTrailingSlash = lastSegment === null || lastSegment === void 0 ? void 0 : lastSegment.endsWith('/');
|
|
41
41
|
for (const segment of segments) {
|
|
42
42
|
const cleanSegment = trimSlashes(segment);
|
|
43
43
|
if (cleanSegment) {
|
|
44
44
|
result = joinPathSegments(result, cleanSegment);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
if (shouldPreserveTrailingSlash && !result.endsWith(
|
|
48
|
-
result +=
|
|
47
|
+
if (shouldPreserveTrailingSlash && !result.endsWith('/')) {
|
|
48
|
+
result += '/';
|
|
49
49
|
}
|
|
50
50
|
return result;
|
|
51
51
|
}
|
|
52
52
|
function joinPathSegments(left, right) {
|
|
53
|
-
if (left.endsWith(
|
|
53
|
+
if (left.endsWith('/')) {
|
|
54
54
|
return left + right;
|
|
55
55
|
}
|
|
56
56
|
return `${left}/${right}`;
|
|
@@ -60,9 +60,9 @@ function trimSlashes(str) {
|
|
|
60
60
|
return str;
|
|
61
61
|
let start = 0;
|
|
62
62
|
let end = str.length;
|
|
63
|
-
if (str.startsWith(
|
|
63
|
+
if (str.startsWith('/'))
|
|
64
64
|
start = 1;
|
|
65
|
-
if (str.endsWith(
|
|
65
|
+
if (str.endsWith('/'))
|
|
66
66
|
end = str.length - 1;
|
|
67
67
|
return start === 0 && end === str.length ? str : str.slice(start, end);
|
|
68
68
|
}
|
package/dist/cjs/core/url/qs.js
CHANGED
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.toQueryString = toQueryString;
|
|
4
4
|
const defaultQsOptions = {
|
|
5
|
-
arrayFormat:
|
|
5
|
+
arrayFormat: 'indices',
|
|
6
6
|
encode: true,
|
|
7
7
|
};
|
|
8
8
|
function encodeValue(value, shouldEncode) {
|
|
9
9
|
if (value === undefined) {
|
|
10
|
-
return
|
|
10
|
+
return '';
|
|
11
11
|
}
|
|
12
12
|
if (value === null) {
|
|
13
|
-
return
|
|
13
|
+
return '';
|
|
14
14
|
}
|
|
15
15
|
const stringValue = String(value);
|
|
16
16
|
return shouldEncode ? encodeURIComponent(stringValue) : stringValue;
|
|
17
17
|
}
|
|
18
|
-
function stringifyObject(obj, prefix =
|
|
18
|
+
function stringifyObject(obj, prefix = '', options) {
|
|
19
19
|
const parts = [];
|
|
20
20
|
for (const [key, value] of Object.entries(obj)) {
|
|
21
21
|
const fullKey = prefix ? `${prefix}[${key}]` : key;
|
|
@@ -27,13 +27,13 @@ function stringifyObject(obj, prefix = "", options) {
|
|
|
27
27
|
continue;
|
|
28
28
|
}
|
|
29
29
|
const effectiveFormat = options.arrayFormat;
|
|
30
|
-
if (effectiveFormat ===
|
|
30
|
+
if (effectiveFormat === 'comma') {
|
|
31
31
|
const encodedKey = options.encode ? encodeURIComponent(fullKey) : fullKey;
|
|
32
32
|
const encodedValues = value
|
|
33
33
|
.filter((item) => item !== undefined && item !== null)
|
|
34
34
|
.map((item) => encodeValue(item, options.encode));
|
|
35
35
|
if (encodedValues.length > 0) {
|
|
36
|
-
parts.push(`${encodedKey}=${encodedValues.join(
|
|
36
|
+
parts.push(`${encodedKey}=${encodedValues.join(',')}`);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
else {
|
|
@@ -42,19 +42,19 @@ function stringifyObject(obj, prefix = "", options) {
|
|
|
42
42
|
if (item == null) {
|
|
43
43
|
continue;
|
|
44
44
|
}
|
|
45
|
-
if (typeof item ===
|
|
46
|
-
const arrayKey = effectiveFormat ===
|
|
45
|
+
if (typeof item === 'object' && !Array.isArray(item) && item !== null) {
|
|
46
|
+
const arrayKey = effectiveFormat === 'indices' ? `${fullKey}[${i}]` : fullKey;
|
|
47
47
|
parts.push(...stringifyObject(item, arrayKey, options));
|
|
48
48
|
}
|
|
49
49
|
else {
|
|
50
|
-
const arrayKey = effectiveFormat ===
|
|
50
|
+
const arrayKey = effectiveFormat === 'indices' ? `${fullKey}[${i}]` : fullKey;
|
|
51
51
|
const encodedKey = options.encode ? encodeURIComponent(arrayKey) : arrayKey;
|
|
52
52
|
parts.push(`${encodedKey}=${encodeValue(item, options.encode)}`);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
else if (typeof value ===
|
|
57
|
+
else if (typeof value === 'object' && value !== null) {
|
|
58
58
|
if (Object.keys(value).length === 0) {
|
|
59
59
|
continue;
|
|
60
60
|
}
|
|
@@ -68,9 +68,9 @@ function stringifyObject(obj, prefix = "", options) {
|
|
|
68
68
|
return parts;
|
|
69
69
|
}
|
|
70
70
|
function toQueryString(obj, options) {
|
|
71
|
-
if (obj == null || typeof obj !==
|
|
72
|
-
return
|
|
71
|
+
if (obj == null || typeof obj !== 'object') {
|
|
72
|
+
return '';
|
|
73
73
|
}
|
|
74
|
-
const parts = stringifyObject(obj,
|
|
75
|
-
return parts.join(
|
|
74
|
+
const parts = stringifyObject(obj, '', Object.assign(Object.assign({}, defaultQsOptions), options));
|
|
75
|
+
return parts.join('&');
|
|
76
76
|
}
|
package/dist/cjs/environments.js
CHANGED
|
@@ -10,7 +10,7 @@ class SpyglassError extends Error {
|
|
|
10
10
|
if (Error.captureStackTrace) {
|
|
11
11
|
Error.captureStackTrace(this, this.constructor);
|
|
12
12
|
}
|
|
13
|
-
this.name =
|
|
13
|
+
this.name = 'SpyglassError';
|
|
14
14
|
this.statusCode = statusCode;
|
|
15
15
|
this.body = body;
|
|
16
16
|
this.rawResponse = rawResponse;
|
|
@@ -24,7 +24,7 @@ class SpyglassError extends Error {
|
|
|
24
24
|
if (headers == null) {
|
|
25
25
|
return undefined;
|
|
26
26
|
}
|
|
27
|
-
const requestId = headers.get(
|
|
27
|
+
const requestId = headers.get('X-Request-Id');
|
|
28
28
|
if (requestId != null) {
|
|
29
29
|
return requestId;
|
|
30
30
|
}
|
|
@@ -49,5 +49,5 @@ function buildMessage({ message, statusCode, body, }) {
|
|
|
49
49
|
if (body != null) {
|
|
50
50
|
lines.push(`Body: ${(0, json_js_1.toJson)(body, undefined, 2)}`);
|
|
51
51
|
}
|
|
52
|
-
return lines.join(
|
|
52
|
+
return lines.join('\n');
|
|
53
53
|
}
|
|
@@ -46,7 +46,7 @@ class SpyglassTimeoutError extends errors.SpyglassError {
|
|
|
46
46
|
if (Error.captureStackTrace) {
|
|
47
47
|
Error.captureStackTrace(this, this.constructor);
|
|
48
48
|
}
|
|
49
|
-
this.name =
|
|
49
|
+
this.name = 'SpyglassTimeoutError';
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
exports.SpyglassTimeoutError = SpyglassTimeoutError;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type * as core from
|
|
1
|
+
import type * as core from '../core/index.js';
|
|
2
2
|
export declare function handleNonStatusCodeError(error: core.Fetcher.Error, rawResponse: core.RawResponse, method: string, path: string): never;
|
|
@@ -38,22 +38,22 @@ exports.handleNonStatusCodeError = handleNonStatusCodeError;
|
|
|
38
38
|
const errors = __importStar(require("./index.js"));
|
|
39
39
|
function handleNonStatusCodeError(error, rawResponse, method, path) {
|
|
40
40
|
switch (error.reason) {
|
|
41
|
-
case
|
|
41
|
+
case 'non-json':
|
|
42
42
|
throw new errors.SpyglassError({
|
|
43
43
|
statusCode: error.statusCode,
|
|
44
44
|
body: error.rawBody,
|
|
45
45
|
rawResponse: rawResponse,
|
|
46
46
|
});
|
|
47
|
-
case
|
|
47
|
+
case 'body-is-null':
|
|
48
48
|
throw new errors.SpyglassError({
|
|
49
49
|
statusCode: error.statusCode,
|
|
50
50
|
rawResponse: rawResponse,
|
|
51
51
|
});
|
|
52
|
-
case
|
|
52
|
+
case 'timeout':
|
|
53
53
|
throw new errors.SpyglassTimeoutError(`Timeout exceeded when calling ${method} ${path}.`, {
|
|
54
54
|
cause: error.cause,
|
|
55
55
|
});
|
|
56
|
-
case
|
|
56
|
+
case 'unknown':
|
|
57
57
|
throw new errors.SpyglassError({
|
|
58
58
|
message: error.errorMessage,
|
|
59
59
|
rawResponse: rawResponse,
|
|
@@ -61,7 +61,7 @@ function handleNonStatusCodeError(error, rawResponse, method, path) {
|
|
|
61
61
|
});
|
|
62
62
|
default:
|
|
63
63
|
throw new errors.SpyglassError({
|
|
64
|
-
message:
|
|
64
|
+
message: 'Unknown error',
|
|
65
65
|
rawResponse: rawResponse,
|
|
66
66
|
});
|
|
67
67
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { SpyglassError } from
|
|
2
|
-
export { SpyglassTimeoutError } from
|
|
1
|
+
export { SpyglassError } from './SpyglassError.js';
|
|
2
|
+
export { SpyglassTimeoutError } from './SpyglassTimeoutError.js';
|
package/dist/cjs/exports.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from './core/exports.js';
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * as spyglass from
|
|
2
|
-
export type { BaseClientOptions, BaseRequestOptions } from
|
|
3
|
-
export { Spyglass } from
|
|
4
|
-
export { SpyglassEnvironment } from
|
|
5
|
-
export { SpyglassError, SpyglassTimeoutError } from
|
|
6
|
-
export * from
|
|
1
|
+
export * as spyglass from './api/index.js';
|
|
2
|
+
export type { BaseClientOptions, BaseRequestOptions } from './BaseClient.js';
|
|
3
|
+
export { Spyglass } from './Client.js';
|
|
4
|
+
export { SpyglassEnvironment } from './environments.js';
|
|
5
|
+
export { SpyglassError, SpyglassTimeoutError } from './errors/index.js';
|
|
6
|
+
export * from './exports.js';
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.1.
|
|
1
|
+
export declare const SDK_VERSION = "0.1.7";
|
package/dist/cjs/version.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { BearerAuthProvider } from
|
|
2
|
-
import * as core from
|
|
3
|
-
import type * as environments from
|
|
4
|
-
export type AuthOption = false | core.AuthProvider[
|
|
1
|
+
import { BearerAuthProvider } from './auth/BearerAuthProvider.mjs';
|
|
2
|
+
import * as core from './core/index.mjs';
|
|
3
|
+
import type * as environments from './environments.mjs';
|
|
4
|
+
export type AuthOption = false | core.AuthProvider['getAuthRequest'] | core.AuthProvider | BearerAuthProvider.AuthOptions;
|
|
5
5
|
export type BaseClientOptions = {
|
|
6
6
|
environment?: core.Supplier<environments.SpyglassEnvironment | string>;
|
|
7
7
|
/** Specify a custom URL to connect the client to. */
|
package/dist/esm/BaseClient.mjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
-
import { BearerAuthProvider } from
|
|
3
|
-
import { mergeHeaders } from
|
|
4
|
-
import * as core from
|
|
2
|
+
import { BearerAuthProvider } from './auth/BearerAuthProvider.mjs';
|
|
3
|
+
import { mergeHeaders } from './core/headers.mjs';
|
|
4
|
+
import * as core from './core/index.mjs';
|
|
5
5
|
export function normalizeClientOptions(options) {
|
|
6
6
|
const headers = mergeHeaders({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
'X-Fern-Language': 'JavaScript',
|
|
8
|
+
'X-Fern-SDK-Name': '@spyglasshq/sdk',
|
|
9
|
+
'X-Fern-SDK-Version': '0.1.7',
|
|
10
|
+
'User-Agent': '@spyglasshq/sdk/0.1.7',
|
|
11
|
+
'X-Fern-Runtime': core.RUNTIME.type,
|
|
12
|
+
'X-Fern-Runtime-Version': core.RUNTIME.version,
|
|
13
13
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
14
14
|
return Object.assign(Object.assign({}, options), { logging: core.logging.createLogger(options === null || options === void 0 ? void 0 : options.logging), headers });
|
|
15
15
|
}
|
|
@@ -21,7 +21,7 @@ export function normalizeClientOptionsWithAuth(options) {
|
|
|
21
21
|
return normalized;
|
|
22
22
|
}
|
|
23
23
|
if (options.auth != null) {
|
|
24
|
-
if (typeof options.auth ===
|
|
24
|
+
if (typeof options.auth === 'function') {
|
|
25
25
|
normalized.authProvider = { getAuthRequest: options.auth };
|
|
26
26
|
return normalized;
|
|
27
27
|
}
|