Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@uppy/companion-client

Package Overview
Dependencies
Maintainers
8
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uppy/companion-client - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

lib/package.json

7

CHANGELOG.md
# @uppy/companion-client
## 2.2.0
Released: 2022-05-30
Included in: Uppy v2.11.0
- @uppy/companion-client: Revert "Revert "@uppy/companion-client: refactor to ESM"" (Antoine du Hamel / #3730)
## 2.1.0

@@ -4,0 +11,0 @@

26

lib/index.js

@@ -6,15 +6,21 @@ 'use strict';

const RequestClient = require('./RequestClient');
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Socket = exports.SearchProvider = exports.RequestClient = exports.Provider = void 0;
const Provider = require('./Provider');
const _0 = require("./RequestClient.js");
const SearchProvider = require('./SearchProvider');
exports.RequestClient = _0;
const Socket = require('./Socket');
const _1 = require("./Provider.js");
module.exports = {
RequestClient,
Provider,
SearchProvider,
Socket
};
exports.Provider = _1;
const _2 = require("./SearchProvider.js");
exports.SearchProvider = _2;
const _3 = require("./Socket.js");
exports.Socket = _3;
'use strict';
const RequestClient = require('./RequestClient');
var tokenStorage = require("./tokenStorage.js");
const tokenStorage = require('./tokenStorage');
const RequestClient = require("./RequestClient.js");

@@ -11,3 +11,3 @@ const getName = id => {

module.exports = class Provider extends RequestClient {
class Provider extends RequestClient {
constructor(uppy, opts) {

@@ -46,3 +46,4 @@ super(uppy, opts);

onReceiveResponse(response) {
response = super.onReceiveResponse(response);
response = super.onReceiveResponse(response); // eslint-disable-line no-param-reassign
const plugin = this.uppy.getPlugin(this.pluginId);

@@ -125,2 +126,3 @@ const oldAuthenticated = plugin.getPluginState().authenticated;

static initPlugin(plugin, opts, defaultOpts) {
/* eslint-disable no-param-reassign */
plugin.type = 'acquirer';

@@ -155,4 +157,7 @@ plugin.files = [];

plugin.storage = plugin.opts.storage || tokenStorage;
/* eslint-enable no-param-reassign */
}
};
}
module.exports = Provider;
'use strict';
var _class, _getPostResponseFunc, _getUrl, _errorHandler, _temp;
function _classPrivateFieldLooseBase(receiver, privateKey) { if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { throw new TypeError("attempted to use private field on non-instance"); } return receiver; }

@@ -11,8 +9,11 @@

const fetchWithNetworkError = require('@uppy/utils/lib/fetchWithNetworkError');
const fetchWithNetworkError = require("@uppy/utils/lib/fetchWithNetworkError");
const ErrorWithCause = require('@uppy/utils/lib/ErrorWithCause');
const ErrorWithCause = require("@uppy/utils/lib/ErrorWithCause");
const AuthError = require('./AuthError'); // Remove the trailing slash so we can always safely append /xyz.
const AuthError = require("./AuthError.js");
const packageJson = {
"version": "2.2.0"
}; // Remove the trailing slash so we can always safely append /xyz.

@@ -46,4 +47,9 @@ function stripSlash(url) {

module.exports = (_temp = (_getPostResponseFunc = /*#__PURE__*/_classPrivateFieldLooseKey("getPostResponseFunc"), _getUrl = /*#__PURE__*/_classPrivateFieldLooseKey("getUrl"), _errorHandler = /*#__PURE__*/_classPrivateFieldLooseKey("errorHandler"), _class = class RequestClient {
// eslint-disable-next-line global-require
var _getPostResponseFunc = /*#__PURE__*/_classPrivateFieldLooseKey("getPostResponseFunc");
var _getUrl = /*#__PURE__*/_classPrivateFieldLooseKey("getUrl");
var _errorHandler = /*#__PURE__*/_classPrivateFieldLooseKey("errorHandler");
class RequestClient {
constructor(uppy, opts) {

@@ -165,7 +171,3 @@ Object.defineProperty(this, _errorHandler, {

}), _class.VERSION = "2.1.0", _class.defaultHeaders = {
Accept: 'application/json',
'Content-Type': 'application/json',
'Uppy-Versions': `@uppy/companion-client=${_class.VERSION}`
}, _temp);
}

@@ -193,2 +195,10 @@ function _getUrl2(url) {

};
}
}
RequestClient.VERSION = packageJson.version;
RequestClient.defaultHeaders = {
Accept: 'application/json',
'Content-Type': 'application/json',
'Uppy-Versions': `@uppy/companion-client=${RequestClient.VERSION}`
};
module.exports = RequestClient;
'use strict';
const RequestClient = require('./RequestClient');
const RequestClient = require("./RequestClient.js");

@@ -9,3 +9,3 @@ const getName = id => {

module.exports = class SearchProvider extends RequestClient {
class SearchProvider extends RequestClient {
constructor(uppy, opts) {

@@ -24,6 +24,7 @@ super(uppy, opts);

search(text, queries) {
queries = queries ? `&${queries}` : '';
return this.get(`search/${this.id}/list?q=${encodeURIComponent(text)}${queries}`);
return this.get(`search/${this.id}/list?q=${encodeURIComponent(text)}${queries ? `&${queries}` : ''}`);
}
};
}
module.exports = SearchProvider;

@@ -1,2 +0,2 @@

var _queued, _emitter, _isOpen, _socket, _handleMessage;
"use strict";

@@ -11,5 +11,18 @@ let _Symbol$for, _Symbol$for2;

const ee = require('namespace-emitter');
const ee = require("namespace-emitter");
module.exports = (_queued = /*#__PURE__*/_classPrivateFieldLooseKey("queued"), _emitter = /*#__PURE__*/_classPrivateFieldLooseKey("emitter"), _isOpen = /*#__PURE__*/_classPrivateFieldLooseKey("isOpen"), _socket = /*#__PURE__*/_classPrivateFieldLooseKey("socket"), _handleMessage = /*#__PURE__*/_classPrivateFieldLooseKey("handleMessage"), _Symbol$for = Symbol.for('uppy test: getSocket'), _Symbol$for2 = Symbol.for('uppy test: getQueued'), class UppySocket {
var _queued = /*#__PURE__*/_classPrivateFieldLooseKey("queued");
var _emitter = /*#__PURE__*/_classPrivateFieldLooseKey("emitter");
var _isOpen = /*#__PURE__*/_classPrivateFieldLooseKey("isOpen");
var _socket = /*#__PURE__*/_classPrivateFieldLooseKey("socket");
var _handleMessage = /*#__PURE__*/_classPrivateFieldLooseKey("handleMessage");
_Symbol$for = Symbol.for('uppy test: getSocket');
_Symbol$for2 = Symbol.for('uppy test: getQueued');
class UppySocket {
constructor(opts) {

@@ -118,2 +131,4 @@ Object.defineProperty(this, _queued, {

});
}
module.exports = UppySocket;

@@ -6,3 +6,10 @@ 'use strict';

module.exports.setItem = (key, value) => {
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getItem = getItem;
exports.removeItem = removeItem;
exports.setItem = setItem;
function setItem(key, value) {
return new Promise(resolve => {

@@ -12,9 +19,9 @@ localStorage.setItem(key, value);

});
};
}
module.exports.getItem = key => {
function getItem(key) {
return Promise.resolve(localStorage.getItem(key));
};
}
module.exports.removeItem = key => {
function removeItem(key) {
return new Promise(resolve => {

@@ -24,2 +31,2 @@ localStorage.removeItem(key);

});
};
}
{
"name": "@uppy/companion-client",
"description": "Client library for communication with Companion. Intended for use in Uppy plugins.",
"version": "2.1.0",
"version": "2.2.0",
"license": "MIT",
"main": "lib/index.js",
"types": "types/index.d.ts",
"type": "module",
"keywords": [

@@ -24,5 +25,8 @@ "file uploader",

"dependencies": {
"@uppy/utils": "^4.0.7",
"@uppy/utils": "^4.1.0",
"namespace-emitter": "^2.0.1"
},
"devDependencies": {
"@jest/globals": "^27.4.2"
}
}

@@ -11,2 +11,2 @@ 'use strict'

module.exports = AuthError
export default AuthError

@@ -7,12 +7,5 @@ 'use strict'

const RequestClient = require('./RequestClient')
const Provider = require('./Provider')
const SearchProvider = require('./SearchProvider')
const Socket = require('./Socket')
module.exports = {
RequestClient,
Provider,
SearchProvider,
Socket,
}
export { default as RequestClient } from './RequestClient.js'
export { default as Provider } from './Provider.js'
export { default as SearchProvider } from './SearchProvider.js'
export { default as Socket } from './Socket.js'
'use strict'
const RequestClient = require('./RequestClient')
const tokenStorage = require('./tokenStorage')
import RequestClient from './RequestClient.js'
import * as tokenStorage from './tokenStorage.js'

@@ -10,3 +10,3 @@ const getName = (id) => {

module.exports = class Provider extends RequestClient {
export default class Provider extends RequestClient {
constructor (uppy, opts) {

@@ -41,3 +41,3 @@ super(uppy, opts)

onReceiveResponse (response) {
response = super.onReceiveResponse(response)
response = super.onReceiveResponse(response) // eslint-disable-line no-param-reassign
const plugin = this.uppy.getPlugin(this.pluginId)

@@ -111,2 +111,3 @@ const oldAuthenticated = plugin.getPluginState().authenticated

static initPlugin (plugin, opts, defaultOpts) {
/* eslint-disable no-param-reassign */
plugin.type = 'acquirer'

@@ -137,3 +138,4 @@ plugin.files = []

plugin.storage = plugin.opts.storage || tokenStorage
/* eslint-enable no-param-reassign */
}
}
'use strict'
const fetchWithNetworkError = require('@uppy/utils/lib/fetchWithNetworkError')
const ErrorWithCause = require('@uppy/utils/lib/ErrorWithCause')
const AuthError = require('./AuthError')
import fetchWithNetworkError from '@uppy/utils/lib/fetchWithNetworkError'
import ErrorWithCause from '@uppy/utils/lib/ErrorWithCause'
import AuthError from './AuthError.js'
import packageJson from '../package.json'
// Remove the trailing slash so we can always safely append /xyz.

@@ -33,5 +35,4 @@ function stripSlash (url) {

module.exports = class RequestClient {
// eslint-disable-next-line global-require
static VERSION = require('../package.json').version
export default class RequestClient {
static VERSION = packageJson.version

@@ -38,0 +39,0 @@ #getPostResponseFunc = skip => response => (skip ? response : this.onReceiveResponse(response))

@@ -1,2 +0,3 @@

const RequestClient = require('./RequestClient')
import { describe, it, expect } from '@jest/globals'
import RequestClient from './RequestClient.js'

@@ -3,0 +4,0 @@ describe('RequestClient', () => {

'use strict'
const RequestClient = require('./RequestClient')
import RequestClient from './RequestClient.js'

@@ -9,3 +9,3 @@ const getName = (id) => {

module.exports = class SearchProvider extends RequestClient {
export default class SearchProvider extends RequestClient {
constructor (uppy, opts) {

@@ -24,5 +24,4 @@ super(uppy, opts)

search (text, queries) {
queries = queries ? `&${queries}` : ''
return this.get(`search/${this.id}/list?q=${encodeURIComponent(text)}${queries}`)
return this.get(`search/${this.id}/list?q=${encodeURIComponent(text)}${queries ? `&${queries}` : ''}`)
}
}

@@ -1,4 +0,4 @@

const ee = require('namespace-emitter')
import ee from 'namespace-emitter'
module.exports = class UppySocket {
export default class UppySocket {
#queued = []

@@ -5,0 +5,0 @@

@@ -1,2 +0,3 @@

const UppySocket = require('./Socket')
import { afterEach, beforeEach, jest, describe, it, expect } from '@jest/globals'
import UppySocket from './Socket.js'

@@ -13,3 +14,3 @@ describe('Socket', () => {

global.WebSocket = class WebSocket {
globalThis.WebSocket = class WebSocket {
constructor (target) {

@@ -39,3 +40,3 @@ webSocketConstructorSpy(target)

afterEach(() => {
global.WebSocket = undefined
globalThis.WebSocket = undefined
})

@@ -42,0 +43,0 @@

@@ -6,3 +6,3 @@ 'use strict'

*/
module.exports.setItem = (key, value) => {
export function setItem (key, value) {
return new Promise((resolve) => {

@@ -14,7 +14,7 @@ localStorage.setItem(key, value)

module.exports.getItem = (key) => {
export function getItem (key) {
return Promise.resolve(localStorage.getItem(key))
}
module.exports.removeItem = (key) => {
export function removeItem (key) {
return new Promise((resolve) => {

@@ -21,0 +21,0 @@ localStorage.removeItem(key)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc