@uppy/companion-client
Advanced tools
Comparing version 2.2.0 to 2.2.1
'use strict'; | ||
let _Symbol$for; | ||
function _classPrivateFieldLooseBase(receiver, privateKey) { if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { throw new TypeError("attempted to use private field on non-instance"); } return receiver; } | ||
@@ -16,3 +18,3 @@ | ||
const packageJson = { | ||
"version": "2.2.0" | ||
"version": "2.2.1" | ||
}; // Remove the trailing slash so we can always safely append /xyz. | ||
@@ -47,2 +49,4 @@ | ||
var _companionHeaders = /*#__PURE__*/_classPrivateFieldLooseKey("companionHeaders"); | ||
var _getPostResponseFunc = /*#__PURE__*/_classPrivateFieldLooseKey("getPostResponseFunc"); | ||
@@ -54,2 +58,4 @@ | ||
_Symbol$for = Symbol.for('uppy test: getCompanionHeaders'); | ||
class RequestClient { | ||
@@ -63,2 +69,6 @@ constructor(uppy, opts) { | ||
}); | ||
Object.defineProperty(this, _companionHeaders, { | ||
writable: true, | ||
value: void 0 | ||
}); | ||
Object.defineProperty(this, _getPostResponseFunc, { | ||
@@ -73,4 +83,13 @@ writable: true, | ||
this.preflightDone = false; | ||
_classPrivateFieldLooseBase(this, _companionHeaders)[_companionHeaders] = opts == null ? void 0 : opts.companionHeaders; | ||
} | ||
setCompanionHeaders(headers) { | ||
_classPrivateFieldLooseBase(this, _companionHeaders)[_companionHeaders] = headers; | ||
} | ||
[_Symbol$for]() { | ||
return _classPrivateFieldLooseBase(this, _companionHeaders)[_companionHeaders]; | ||
} | ||
get hostname() { | ||
@@ -85,5 +104,4 @@ const { | ||
headers() { | ||
const userHeaders = this.opts.companionHeaders || {}; | ||
return Promise.resolve({ ...RequestClient.defaultHeaders, | ||
...userHeaders | ||
..._classPrivateFieldLooseBase(this, _companionHeaders)[_companionHeaders] | ||
}); | ||
@@ -90,0 +108,0 @@ } |
{ | ||
"name": "@uppy/companion-client", | ||
"description": "Client library for communication with Companion. Intended for use in Uppy plugins.", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "main": "lib/index.js", |
@@ -38,2 +38,4 @@ 'use strict' | ||
#companionHeaders | ||
#getPostResponseFunc = skip => response => (skip ? response : this.onReceiveResponse(response)) | ||
@@ -47,4 +49,11 @@ | ||
this.preflightDone = false | ||
this.#companionHeaders = opts?.companionHeaders | ||
} | ||
setCompanionHeaders (headers) { | ||
this.#companionHeaders = headers | ||
} | ||
[Symbol.for('uppy test: getCompanionHeaders')] () { return this.#companionHeaders } | ||
get hostname () { | ||
@@ -63,6 +72,5 @@ const { companion } = this.uppy.getState() | ||
headers () { | ||
const userHeaders = this.opts.companionHeaders || {} | ||
return Promise.resolve({ | ||
...RequestClient.defaultHeaders, | ||
...userHeaders, | ||
...this.#companionHeaders, | ||
}) | ||
@@ -69,0 +77,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
73604
1077