Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove axios dependency #59

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:

- name: Setup Node.js environment
uses: actions/[email protected]
with:
node-version: 18

- name: Install dependencies
run: npm install
Expand Down
121 changes: 26 additions & 95 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "scryfall-sdk",
"version": "3.3.0",
"dependencies": {
"axios": "^1.3.1"
"engines": {
"node": "^18"
},
"main": "./out/Scry.js",
"types": "./out/Scry.d.ts",
Expand All @@ -28,25 +28,25 @@
"devDependencies": {
"@types/chai": "4.3.4",
"@types/chai-as-promised": "7.1.5",
"@types/eslint": "8.4.10",
"@types/gulp": "4.0.10",
"@types/gulp-mocha": "0.0.33",
"@types/node": "13.7.7",
"@types/node": "^18",
"@types/request-promise": "4.1.48",
"@typescript-eslint/eslint-plugin": "5.50.0",
"@typescript-eslint/parser": "5.50.0",
"chai": "4.3.7",
"chai-as-promised": "7.1.1",
"chalk": "4.1.0",
"del": "6.1.1",
"eslint": "8.33.0",
"even-more-min": "1.0.1",
"fuzzysort": "2.0.4",
"gulp": "4.0.2",
"gulp-mocha": "8.0.0",
"chalk": "4.1.0",
"mocha": "10.2.0",
"ts-node": "10.9.1",
"typescript": "4.9.5",
"eslint": "8.33.0",
"@types/eslint": "8.4.10",
"@typescript-eslint/parser": "5.50.0",
"@typescript-eslint/eslint-plugin": "5.50.0",
"fuzzysort": "2.0.4"
"typescript": "4.9.5"
},
"scripts": {
"build": "npx gulp build",
Expand Down
8 changes: 2 additions & 6 deletions src/api/BulkData.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import Axios from "axios";
import { Stream } from "stream";
import Cached from "../util/Cached";
import MagicQuerier, { List } from "../util/MagicQuerier";

Expand Down Expand Up @@ -76,13 +74,11 @@ class BulkData extends MagicQuerier {
if (new Date(lastDownload).getTime() > new Date(definition.updated_at).getTime())
return undefined;

const result = await Axios.request<Stream>({
const result = await fetch(definition.download_uri, {
method: "GET",
url: definition.download_uri,
responseType: "stream",
});

return result.data;
return result.body;
}

private definition (idOrType: string) {
Expand Down
3 changes: 1 addition & 2 deletions src/api/Cards.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { AxiosRequestConfig } from "axios";
import { Color, RESOURCE_GENERIC_CARD_BACK, SYMBOL_COST, SYMBOL_PRINTS, SYMBOL_RULINGS, SYMBOL_SET, SYMBOL_TEXT } from "../IScry";
import Cached from "../util/Cached";
import MagicEmitter from "../util/MagicEmitter";
Expand Down Expand Up @@ -656,7 +655,7 @@ class Cards extends MagicQuerier {
return emitter;
}

private async queryCard (apiPath: TOrArrayOfT<string | number | undefined>, query?: { [key: string]: any }, post?: any, requestOptions?: AxiosRequestConfig): Promise<Card> {
private async queryCard (apiPath: TOrArrayOfT<string | number | undefined>, query?: { [key: string]: any }, post?: any, requestOptions?: RequestInit): Promise<Card> {
return await this.query<Card>(apiPath, query, post, requestOptions)
.then(Card.construct);
}
Expand Down
3 changes: 1 addition & 2 deletions src/api/Sets.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { AxiosRequestConfig } from "axios";
import { IScry, SYMBOL_CARDS, SYMBOL_SET } from "../IScry";
import Cached from "../util/Cached";
import MagicQuerier, { List, TOrArrayOfT } from "../util/MagicQuerier";
Expand Down Expand Up @@ -122,7 +121,7 @@ class Sets extends MagicQuerier {
throw error;
}

private async querySet (apiPath: TOrArrayOfT<string | number | undefined>, query?: { [key: string]: any }, post?: any, requestOptions?: AxiosRequestConfig): Promise<Set> {
private async querySet (apiPath: TOrArrayOfT<string | number | undefined>, query?: { [key: string]: any }, post?: any, requestOptions?: RequestInit): Promise<Set> {
return await this.query<Set>(apiPath, query, post, requestOptions)
.then(Set.construct);
}
Expand Down
Loading