diff --git a/src/fetcher.ts b/src/fetcher.ts index e47c13a7a..b42e5f540 100644 --- a/src/fetcher.ts +++ b/src/fetcher.ts @@ -53,6 +53,8 @@ import { } from './tf-types' import jsonldParser from './jsonldparser' +const DEFAULT_TIMEOUT_MS = 120000 // 2 mins + const Parsable = { 'text/n3': true, 'text/turtle': true, @@ -185,7 +187,7 @@ export interface AutoInitOptions extends RequestInit{ original: NamedNode // Like requeststatus? Can contain text with error. data?: string - // Probably an identifier for request?s + // The request in the RDF metadata in the store req: BlankNode // Might be the same as Options.data body?: string @@ -750,7 +752,7 @@ export default class Fetcher implements CallbackifyInterface { constructor (store: IndexedFormula, options: Options = {}) { this.store = store || new IndexedFormula() this.ns = getNS(this.store.rdfFactory) - this.timeout = options.timeout || 30000 + this.timeout = options.timeout || DEFAULT_TIMEOUT_MS this._fetch = options.fetch || (typeof global !== 'undefined' && global.solidFetcher) @@ -818,7 +820,7 @@ export default class Fetcher implements CallbackifyInterface { return requestedURI } - static proxyIfNecessary (uri: string) { + static mapForLocalTesting:string (uri: string) { var UI if ( typeof window !== 'undefined' && @@ -853,6 +855,7 @@ export default class Fetcher implements CallbackifyInterface { if (y) { return y } + return uri } // browser does 2014 on as https browser script not trusted @@ -1049,7 +1052,7 @@ export default class Fetcher implements CallbackifyInterface { Fetcher.setCredentials(requestedURI, options) - let actualProxyURI = Fetcher.proxyIfNecessary(requestedURI) + let actualProxyURI = Fetcher.mapForLocalTesting(requestedURI) if (requestedURI !== actualProxyURI) { options.proxyUsed = true } @@ -1560,8 +1563,9 @@ export default class Fetcher implements CallbackifyInterface { } Fetcher.setCredentials(uri, options) + const mappedURI = mapForLocalTesting(uri) return new Promise(function (resolve, reject) { - fetcher._fetch(uri, options).then(response => { + fetcher._fetch(mappedURI, options).then(response => { if (response.ok) { if (method === 'PUT' || method === 'PATCH' || method === 'POST' || method === 'DELETE') { fetcher.invalidateCache (uri) diff --git a/tsconfig.json b/tsconfig.json index 485ae3d98..b82a27d43 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -16,5 +16,6 @@ }, "include": [ "src/**/*" - ] + ], + "moduleResolution": "node" }