Skip to content

Commit

Permalink
Release v3.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dpilafian committed Jun 29, 2024
1 parent 6094c44 commit ca4444e
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 39 deletions.
16 changes: 6 additions & 10 deletions dist/fetch-json.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! fetch-json v3.3.0 ~~ https://fetch-json.js.org ~~ MIT License
//! fetch-json v3.3.1 ~~ https://fetch-json.js.org ~~ MIT License

export type Json = string | number | boolean | null | undefined | JsonObject | Json[];
export type JsonObject = {
Expand All @@ -14,7 +14,6 @@ export type FetchJsonParams = {
[field: string]: string | number | boolean | null | undefined;
};
export type FetchJsonParsedResponse = Json | any;
export type FetchJsonTextResponse = FetchJsonAltResponse;
export type FetchJsonAltResponse = {
ok: boolean;
error: boolean;
Expand All @@ -31,21 +30,18 @@ declare const fetchJson: {
baseOptions: FetchJsonOptions;
getBaseOptions(): FetchJsonOptions;
setBaseOptions(options: FetchJsonOptions): FetchJsonOptions;
request<T>(method: FetchJsonMethod, url: string, data?: Json | FetchJsonParams | T, options?: FetchJsonOptions): Promise<FetchJsonResponse>;
request<T>(method: FetchJsonMethod, url: string, data?: FetchJsonParams | Json | T, options?: FetchJsonOptions): Promise<FetchJsonResponse>;
get(url: string, params?: FetchJsonParams, options?: FetchJsonOptions): Promise<FetchJsonResponse>;
post<T_1>(url: string, resource?: Json | T_1, options?: FetchJsonOptions): Promise<FetchJsonResponse>;
put<T_2>(url: string, resource?: Json | T_2, options?: FetchJsonOptions): Promise<FetchJsonResponse>;
patch<T_3>(url: string, resource?: Json | T_3, options?: FetchJsonOptions): Promise<FetchJsonResponse>;
delete<T_4>(url: string, resource?: Json | T_4, options?: FetchJsonOptions): Promise<FetchJsonResponse>;
post<T>(url: string, resource?: Json | T, options?: FetchJsonOptions): Promise<FetchJsonResponse>;
put<T>(url: string, resource?: Json | T, options?: FetchJsonOptions): Promise<FetchJsonResponse>;
patch<T>(url: string, resource?: Json | T, options?: FetchJsonOptions): Promise<FetchJsonResponse>;
delete<T>(url: string, resource?: Json | T, options?: FetchJsonOptions): Promise<FetchJsonResponse>;
head(url: string, params?: FetchJsonParams, options?: FetchJsonOptions): Promise<FetchJsonResponse>;
logger: FetchJsonLogger | null;
getLogHeaders(): string[];
getLogHeaderIndexMap(): {
[header: string]: number;
};
getLogHeaderIndex(): {
[header: string]: number;
};
enableLogger(customLogger?: FetchJsonLogger): FetchJsonLogger;
disableLogger(): void;
};
Expand Down
7 changes: 2 additions & 5 deletions dist/fetch-json.dev.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! fetch-json v3.3.0 ~~ https://fetch-json.js.org ~~ MIT License
//! fetch-json v3.3.1 ~~ https://fetch-json.js.org ~~ MIT License

const fetchJson = {
version: '3.3.0',
version: '3.3.1',
baseOptions: {},
getBaseOptions() {
return this.baseOptions;
Expand Down Expand Up @@ -99,9 +99,6 @@ const fetchJson = {
getLogHeaderIndexMap() {
return { timestamp: 0, http: 1, method: 2, domain: 3, url: 4, ok: 5, status: 6, text: 7, type: 8 };
},
getLogHeaderIndex() {
return { timestamp: 0, http: 1, method: 2, domain: 3, url: 4, ok: 5, status: 6, text: 7, type: 8 };
},
enableLogger(customLogger) {
this.logger = customLogger ?? console.log;
return this.logger;
Expand Down
7 changes: 2 additions & 5 deletions dist/fetch-json.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! fetch-json v3.3.0 ~~ https://fetch-json.js.org ~~ MIT License
//! fetch-json v3.3.1 ~~ https://fetch-json.js.org ~~ MIT License

const fetchJson = {
version: '3.3.0',
version: '3.3.1',
baseOptions: {},
getBaseOptions() {
return this.baseOptions;
Expand Down Expand Up @@ -99,9 +99,6 @@ const fetchJson = {
getLogHeaderIndexMap() {
return { timestamp: 0, http: 1, method: 2, domain: 3, url: 4, ok: 5, status: 6, text: 7, type: 8 };
},
getLogHeaderIndex() {
return { timestamp: 0, http: 1, method: 2, domain: 3, url: 4, ok: 5, status: 6, text: 7, type: 8 };
},
enableLogger(customLogger) {
this.logger = customLogger ?? console.log;
return this.logger;
Expand Down
4 changes: 2 additions & 2 deletions dist/fetch-json.min.js

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

6 changes: 3 additions & 3 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
<link rel=apple-touch-icon href=logos.png>
<link rel=stylesheet href=https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/css/all.min.css>
<link rel=stylesheet href=https://cdn.jsdelivr.net/npm/[email protected]/dist/dna-engine.css>
<link rel=stylesheet href=https://cdn.jsdelivr.net/npm/web-ignition@2.1/dist/reset.min.css>
<link rel=stylesheet href=https://cdn.jsdelivr.net/npm/web-ignition@2.1/dist/layouts/letterbox.css>
<link rel=stylesheet href=https://cdn.jsdelivr.net/npm/web-ignition@2.2/dist/reset.min.css>
<link rel=stylesheet href=https://cdn.jsdelivr.net/npm/web-ignition@2.2/dist/layouts/letterbox.css>
<style>
html { background-image: url(examples.png); }
main >section h1 { color: steelblue; }
Expand All @@ -42,7 +42,7 @@
main >section figure code.language-js .js-param { color: darkmagenta; }
</style>
<script defer src=https://cdn.jsdelivr.net/npm/[email protected]/dist/dna-engine.min.js></script>
<script defer src=https://cdn.jsdelivr.net/npm/web-ignition@2.1/dist/lib-x.min.js></script>
<script defer src=https://cdn.jsdelivr.net/npm/web-ignition@2.2/dist/lib-x.min.js></script>
<script defer src=https://cdn.jsdelivr.net/npm/[email protected]/dist/fetch-json.min.js></script>
<script data-on-load=setup data-wait-for=fetchJson>
const setup = () => {
Expand Down
5 changes: 0 additions & 5 deletions fetch-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export type FetchJsonOptions = RequestInit & Partial<FetchJsonInit>;
export type FetchJsonMethod = string;
export type FetchJsonParams = { [field: string]: string | number | boolean | null | undefined };
export type FetchJsonParsedResponse = Json | any;
export type FetchJsonTextResponse = FetchJsonAltResponse; //deprecated
export type FetchJsonAltResponse = { //used when the HTTP response is an error or unexpectedly not JSON
ok: boolean, //code for HTTP status in the range 200-299
error: boolean, //code for HTTP status not in the range 200-299 or exception thrown
Expand Down Expand Up @@ -133,10 +132,6 @@ const fetchJson = {
getLogHeaderIndexMap(): { [header: string]: number } {
return { timestamp: 0, http: 1, method: 2, domain: 3, url: 4, ok: 5, status: 6, text: 7, type: 8 };
},
getLogHeaderIndex(): { [header: string]: number } { //DEPRECATED
// console.log('[fetch-json] getLogHeaderIndex() is deprecated -- use getLogHeaderIndexMap() instead');
return { timestamp: 0, http: 1, method: 2, domain: 3, url: 4, ok: 5, status: 6, text: 7, type: 8 };
},
enableLogger(customLogger?: FetchJsonLogger): FetchJsonLogger {
this.logger = customLogger ?? console.log;
return this.logger;
Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "fetch-json",
"description": "A wrapper around Fetch just for JSON",
"version": "3.3.0",
"version": "3.3.1",
"license": "MIT",
"type": "module",
"module": "dist/fetch-json.js",
Expand Down Expand Up @@ -91,9 +91,9 @@
"interactive": "http-server -o spec/fixtures/"
},
"devDependencies": {
"@eslint/js": "~9.3",
"@eslint/js": "~9.6",
"@fortawesome/fontawesome-free": "~6.5",
"@types/node": "~20.12",
"@types/node": "~20.14",
"add-dist-header": "~1.4",
"assert-deep-strict-equal": "~1.2",
"copy-file-util": "~1.2",
Expand All @@ -104,17 +104,17 @@
"http-server": "~14.1",
"jsdom": "~24.1",
"jshint": "~2.13",
"mocha": "~10.4",
"puppeteer": "~22.10",
"mocha": "~10.5",
"puppeteer": "~22.12",
"puppeteer-browser-ready": "~1.3",
"replacer-util": "~1.3",
"rimraf": "~5.0",
"run-scripts-util": "~1.2",
"typescript": "~5.4",
"typescript-eslint": "~7.11",
"uglify-js": "~3.17",
"typescript": "~5.5",
"typescript-eslint": "~7.14",
"uglify-js": "~3.18",
"w3c-html-validator": "~1.8",
"web-ignition": "~2.1",
"web-ignition": "~2.2",
"whatwg-fetch": "~3.6"
}
}

0 comments on commit ca4444e

Please sign in to comment.