@devcycle/js-cloud-server-sdk
Advanced tools
Comparing version 1.8.0 to 1.8.1
@@ -6,4 +6,7 @@ import { RequestInitWithRetry } from 'fetch-retry'; | ||
} | ||
export declare const exponentialBackoff: RequestInitWithRetry['retryDelay']; | ||
export declare function handleResponse(res: Response): Promise<Response>; | ||
export declare function getWithTimeout(url: string, requestConfig: RequestInit | RequestInitWithRetry, timeout: number): Promise<Response>; | ||
export declare function post(url: string, requestConfig: RequestInit | RequestInitWithRetry, sdkKey: string): Promise<Response>; | ||
export declare function patch(url: string, requestConfig: RequestInit | RequestInitWithRetry, sdkKey: string): Promise<Response>; | ||
export declare function get(url: string, requestConfig: RequestInit | RequestInitWithRetry): Promise<Response>; |
"use strict"; | ||
// NOTE: This file is duplicated in "sdk/js/src/RequestUtils" because nx:rollup cant build non-external dependencies | ||
// from outside the root directory https://github.com/nrwl/nx/issues/10395 | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -6,3 +8,3 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.get = exports.post = exports.getWithTimeout = exports.ResponseError = void 0; | ||
exports.get = exports.patch = exports.post = exports.getWithTimeout = exports.handleResponse = exports.exponentialBackoff = exports.ResponseError = void 0; | ||
const fetch_retry_1 = __importDefault(require("fetch-retry")); | ||
@@ -21,2 +23,3 @@ class ResponseError extends Error { | ||
}; | ||
exports.exponentialBackoff = exponentialBackoff; | ||
const retryOnRequestError = (retries) => { | ||
@@ -33,3 +36,3 @@ return (attempt, error, response) => { | ||
}; | ||
const handleResponse = async (res) => { | ||
async function handleResponse(res) { | ||
// res.ok only checks for 200-299 status codes | ||
@@ -49,3 +52,4 @@ if (!res.ok && res.status >= 400) { | ||
return res; | ||
}; | ||
} | ||
exports.handleResponse = handleResponse; | ||
async function getWithTimeout(url, requestConfig, timeout) { | ||
@@ -79,2 +83,17 @@ const controller = new AbortController(); | ||
exports.post = post; | ||
async function patch(url, requestConfig, sdkKey) { | ||
const [_fetch, config] = await getFetchAndConfig(requestConfig); | ||
const patchHeaders = { | ||
...config.headers, | ||
Authorization: sdkKey, | ||
'Content-Type': 'application/json', | ||
}; | ||
const res = await _fetch(url, { | ||
...config, | ||
headers: patchHeaders, | ||
method: 'PATCH', | ||
}); | ||
return handleResponse(res); | ||
} | ||
exports.patch = patch; | ||
async function get(url, requestConfig) { | ||
@@ -106,3 +125,3 @@ const [_fetch, config] = await getFetchAndConfig(requestConfig); | ||
newConfig.retryOn = retryOnRequestError(requestConfig.retries); | ||
newConfig.retryDelay = exponentialBackoff; | ||
newConfig.retryDelay = exports.exponentialBackoff; | ||
return [await getFetchWithRetry(), newConfig]; | ||
@@ -109,0 +128,0 @@ } |
{ | ||
"name": "@devcycle/js-cloud-server-sdk", | ||
"version": "1.8.0", | ||
"version": "1.8.1", | ||
"description": "The DevCycle JS Cloud Bucketing Server SDK used for feature management.", | ||
"license": "MIT", | ||
"dependencies": { | ||
"@devcycle/types": "^1.9.0", | ||
"cross-fetch": "^3.1.8", | ||
"fetch-retry": "^5.0.3", | ||
"@devcycle/types": "^1.9.1", | ||
"cross-fetch": "^4.0.0", | ||
"fetch-retry": "^5.0.6", | ||
"lodash": "^4.17.21" | ||
@@ -11,0 +11,0 @@ }, |
@@ -6,4 +6,7 @@ import { RequestInitWithRetry } from 'fetch-retry'; | ||
} | ||
export declare const exponentialBackoff: RequestInitWithRetry['retryDelay']; | ||
export declare function handleResponse(res: Response): Promise<Response>; | ||
export declare function getWithTimeout(url: string, requestConfig: RequestInit | RequestInitWithRetry, timeout: number): Promise<Response>; | ||
export declare function post(url: string, requestConfig: RequestInit | RequestInitWithRetry, sdkKey: string): Promise<Response>; | ||
export declare function patch(url: string, requestConfig: RequestInit | RequestInitWithRetry, sdkKey: string): Promise<Response>; | ||
export declare function get(url: string, requestConfig: RequestInit | RequestInitWithRetry): Promise<Response>; |
"use strict"; | ||
// NOTE: This file is duplicated in "sdk/js/src/RequestUtils" because nx:rollup cant build non-external dependencies | ||
// from outside the root directory https://github.com/nrwl/nx/issues/10395 | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -6,3 +8,3 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.get = exports.post = exports.getWithTimeout = exports.ResponseError = void 0; | ||
exports.get = exports.patch = exports.post = exports.getWithTimeout = exports.handleResponse = exports.exponentialBackoff = exports.ResponseError = void 0; | ||
const fetch_retry_1 = __importDefault(require("fetch-retry")); | ||
@@ -21,2 +23,3 @@ class ResponseError extends Error { | ||
}; | ||
exports.exponentialBackoff = exponentialBackoff; | ||
const retryOnRequestError = (retries) => { | ||
@@ -33,3 +36,3 @@ return (attempt, error, response) => { | ||
}; | ||
const handleResponse = async (res) => { | ||
async function handleResponse(res) { | ||
// res.ok only checks for 200-299 status codes | ||
@@ -49,3 +52,4 @@ if (!res.ok && res.status >= 400) { | ||
return res; | ||
}; | ||
} | ||
exports.handleResponse = handleResponse; | ||
async function getWithTimeout(url, requestConfig, timeout) { | ||
@@ -79,2 +83,17 @@ const controller = new AbortController(); | ||
exports.post = post; | ||
async function patch(url, requestConfig, sdkKey) { | ||
const [_fetch, config] = await getFetchAndConfig(requestConfig); | ||
const patchHeaders = { | ||
...config.headers, | ||
Authorization: sdkKey, | ||
'Content-Type': 'application/json', | ||
}; | ||
const res = await _fetch(url, { | ||
...config, | ||
headers: patchHeaders, | ||
method: 'PATCH', | ||
}); | ||
return handleResponse(res); | ||
} | ||
exports.patch = patch; | ||
async function get(url, requestConfig) { | ||
@@ -106,3 +125,3 @@ const [_fetch, config] = await getFetchAndConfig(requestConfig); | ||
newConfig.retryOn = retryOnRequestError(requestConfig.retries); | ||
newConfig.retryDelay = exponentialBackoff; | ||
newConfig.retryDelay = exports.exponentialBackoff; | ||
return [await getFetchWithRetry(), newConfig]; | ||
@@ -109,0 +128,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
95431
985
+ Addedcross-fetch@4.0.0(transitive)
- Removedcross-fetch@3.1.8(transitive)
Updated@devcycle/types@^1.9.1
Updatedcross-fetch@^4.0.0
Updatedfetch-retry@^5.0.6