Skip to content

Commit

Permalink
chore: update all packages (#198)
Browse files Browse the repository at this point in the history
* chore: update all packages

* fix: typecheck
  • Loading branch information
nataly87s authored Apr 20, 2022
1 parent 1315de0 commit cb30301
Show file tree
Hide file tree
Showing 8 changed files with 1,333 additions and 1,306 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*.sln.docstates
dist/
.history/
.DS_Store

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
Expand Down Expand Up @@ -140,7 +141,7 @@ publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
Expand Down Expand Up @@ -244,4 +245,4 @@ _Pvt_Extensions
*.sln.iml

#publish profiles
PublishProfiles/
PublishProfiles/
2 changes: 1 addition & 1 deletion js/tweek-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tweek-client",
"version": "3.2.4",
"version": "3.2.5",
"description": "Tweek client for JavaScript",
"author": "Soluto",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion js/tweek-client/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ export type NoCredentialsOptions = {
export type FetchClientConfig = (BearerAuthenticationOptions | ClientCredentialsOptions | NoCredentialsOptions) & {
fetch?: typeof fetch;
requestTimeoutInMillis?: number;
onError?(response: Error): void;
onError?(response: unknown): void;
};
53 changes: 26 additions & 27 deletions js/tweek-client/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,32 @@ import qs from 'query-string';
import { FetchClientConfig } from './types';
import { FetchError } from './FetchError';

const createFetchWithTimeout = (timeoutInMillis: number, fetchFn: typeof fetch): typeof fetch => (
input: RequestInfo,
init?: RequestInit,
) => {
let timeout: any;

return Promise.race([
fetchFn(input, init),
new Promise<Response>((res) => {
timeout = setTimeout(() => res(new Response(null, { status: 408 })), timeoutInMillis);
}),
])
.then((response) => {
if (timeout) {
clearTimeout(timeout);
}

return response;
})
.catch((error) => {
if (timeout) {
clearTimeout(timeout);
}

throw error;
});
};
const createFetchWithTimeout =
(timeoutInMillis: number, fetchFn: typeof fetch): typeof fetch =>
(input: RequestInfo, init?: RequestInit) => {
let timeout: any;

return Promise.race([
fetchFn(input, init),
new Promise<Response>((res) => {
timeout = setTimeout(() => res(new Response(null, { status: 408 })), timeoutInMillis);
}),
])
.then((response) => {
if (timeout) {
clearTimeout(timeout);
}

return response;
})
.catch((error) => {
if (timeout) {
clearTimeout(timeout);
}

throw error;
});
};

export const createFetchClient = ({
fetch = globalFetch,
Expand Down
2 changes: 1 addition & 1 deletion js/tweek-local-cache/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@types/node": "^15.0.1",
"@types/sinon": "^10.0.0",
"@types/zen-observable": "^0.8.0",
"axios": "^0.21.1",
"axios": "^0.26.1",
"chai": "^4.1.2",
"chai-as-promised": "^7.1.1",
"cross-fetch": "^3.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('tweek repo behavior test', function (this: Mocha.Suite) {
return;
} catch (err) {
error = err;
console.log('tweek api not ready yet:', err.message);
console.log('tweek api not ready yet:', (err as Error).message);
await delay(1000);
}
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"lerna": "^4.0.0",
"lint-staged": "^10.5.4",
"prettier": "^2.2.1",
"yarn-deduplicate": "^3.1.0"
"yarn-deduplicate": "^4.0.0"
},
"scripts": {
"build": "lerna run build",
Expand Down
Loading

0 comments on commit cb30301

Please sign in to comment.