Niedzielski has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/395654 )
Change subject: Chore: remove isomorphic unfetch extras ...................................................................... Chore: remove isomorphic unfetch extras IsomorphicHeaders no longer appear to be necessary. Remove the definition and update all references to Headers instead. Change-Id: I38b021e06d25121ec6323b6f7137abfbf3dba8e1 --- M src/common/http/page-http-client.ts M src/common/marshallers/page-base/page-base-unmarshaller.ts M src/common/marshallers/page-summary/page-summary-unmarshaller.ts M src/common/marshallers/page/page-unmarshaller.ts M src/common/marshallers/utils.test.ts D src/common/types/isomorphic-unfetch-extras.d.ts 6 files changed, 7 insertions(+), 14 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/marvin refs/changes/54/395654/1 diff --git a/src/common/http/page-http-client.ts b/src/common/http/page-http-client.ts index 46d155e..3ff5bac 100644 --- a/src/common/http/page-http-client.ts +++ b/src/common/http/page-http-client.ts @@ -1,4 +1,3 @@ -import { IsomorphicHeaders } from "../types/isomorphic-unfetch-extras"; import { JSONObject } from "../types/json"; import { Page, PageLead } from "../models/page/page"; import { PageTitleID, PageTitlePath } from "../models/page/title"; @@ -41,7 +40,7 @@ interface UnmarshalParams { url: string; requestTitleID?: PageTitleID | string; - headers: IsomorphicHeaders; + headers: Headers; json: JSONObject; } diff --git a/src/common/marshallers/page-base/page-base-unmarshaller.ts b/src/common/marshallers/page-base/page-base-unmarshaller.ts index 416499c..7e95266 100644 --- a/src/common/marshallers/page-base/page-base-unmarshaller.ts +++ b/src/common/marshallers/page-base/page-base-unmarshaller.ts @@ -1,7 +1,6 @@ import { ETag } from "../../models/etag"; import { PageGeolocation } from "../../models/page/geolocation"; import { PageTitleID } from "../../models/page/title"; -import { IsomorphicHeaders } from "../../types/isomorphic-unfetch-extras"; import { JSONObject } from "../../types/json"; import { RESTBase } from "../restbase"; @@ -26,7 +25,7 @@ } }; -export const unmarshalETag = (headers: IsomorphicHeaders): ETag => { +export const unmarshalETag = (headers: Headers): ETag => { const etag = headers.get("ETag") as string; const [revision, timeID] = etag.split("/"); return { revision: parseInt(revision, 10), timeID }; diff --git a/src/common/marshallers/page-summary/page-summary-unmarshaller.ts b/src/common/marshallers/page-summary/page-summary-unmarshaller.ts index f0ece26..42626de 100644 --- a/src/common/marshallers/page-summary/page-summary-unmarshaller.ts +++ b/src/common/marshallers/page-summary/page-summary-unmarshaller.ts @@ -1,7 +1,6 @@ import { PageImage } from "../../models/page/image"; import { PageSummary } from "../../models/page/summary"; import { PageTitleID } from "../../models/page/title"; -import { IsomorphicHeaders } from "../../types/isomorphic-unfetch-extras"; import { JSONObject } from "../../types/json"; import { unmarshalPageTitleID, @@ -67,7 +66,7 @@ }: { url: string; requestTitleID?: PageTitleID | string; - headers: IsomorphicHeaders; + headers: Headers; json: JSONObject; }): PageSummary => { const type: RESTBase.PageSummary.PageSummary = json as any; diff --git a/src/common/marshallers/page/page-unmarshaller.ts b/src/common/marshallers/page/page-unmarshaller.ts index 9ed89d8..3cb858a 100644 --- a/src/common/marshallers/page/page-unmarshaller.ts +++ b/src/common/marshallers/page/page-unmarshaller.ts @@ -8,7 +8,6 @@ FilePageImage } from "../../models/page/page"; import { PageUser, PageUserGender } from "../../models/page/user"; -import { IsomorphicHeaders } from "../../types/isomorphic-unfetch-extras"; import { JSONArray, JSONObject } from "../../types/json"; import { unmarshalPageTitleID, @@ -91,7 +90,7 @@ }: { url: string; requestTitleID?: PageTitleID | string; - headers: IsomorphicHeaders; + headers: Headers; json: JSONObject; }): PageLead => { const type: RESTBase.PageSections.Lead = json as any; @@ -151,7 +150,7 @@ }: { url: string; requestTitleID?: PageTitleID | string; - headers: IsomorphicHeaders; + headers: Headers; json: JSONObject; }): Page => { const type: RESTBase.PageSections.Page = json as any; diff --git a/src/common/marshallers/utils.test.ts b/src/common/marshallers/utils.test.ts index 9b35ebe..656a390 100644 --- a/src/common/marshallers/utils.test.ts +++ b/src/common/marshallers/utils.test.ts @@ -1,4 +1,4 @@ -import * as fetch from "node-fetch"; +import { Headers } from "node-fetch"; import { JSONValue } from "../types/json"; export const reviveFile = ( @@ -8,6 +8,6 @@ const ETAG_REVISION = 802006980; const ETAG_TIME_ID = "4f754377-a235-11e7-a776-efb84f18649a"; -export const HEADERS = new fetch.Headers(); +export const HEADERS = new Headers(); HEADERS.append("etag", `${ETAG_REVISION}/${ETAG_TIME_ID}`); export const EXPECTED_ETAG = { revision: ETAG_REVISION, timeID: ETAG_TIME_ID }; diff --git a/src/common/types/isomorphic-unfetch-extras.d.ts b/src/common/types/isomorphic-unfetch-extras.d.ts deleted file mode 100644 index 721cad4..0000000 --- a/src/common/types/isomorphic-unfetch-extras.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Headers as NodeHeaders } from "node-fetch"; - -export type IsomorphicHeaders = Headers | NodeHeaders; -- To view, visit https://gerrit.wikimedia.org/r/395654 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I38b021e06d25121ec6323b6f7137abfbf3dba8e1 Gerrit-PatchSet: 1 Gerrit-Project: marvin Gerrit-Branch: master Gerrit-Owner: Niedzielski <sniedziel...@wikimedia.org> Gerrit-Reviewer: Sniedzielski <sniedziel...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits