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

@uppy/core

Package Overview
Dependencies
Maintainers
6
Versions
142
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uppy/core - npm Package Compare versions

Comparing version 3.6.1 to 3.7.0

8

CHANGELOG.md
# @uppy/core
## 3.7.0
Released: 2023-11-08
Included in: Uppy v3.19.0
- @uppy/core,@uppy/dashboard: don't cancel all files when clicking "done" (Mikael Finstad / #4771)
- @uppy/core: simplify types with class generic (JokcyLou / #4761)
## 3.6.1

@@ -4,0 +12,0 @@

36

lib/Uppy.js

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

const packageJson = {
"version": "3.6.1"
"version": "3.7.0"
};
import locale from './locale.js';
const getDefaultUploadState = () => ({
totalProgress: 0,
allowNewUpload: true,
error: null,
recoveredState: null
});

@@ -232,6 +238,6 @@ /**

this.setState({
...getDefaultUploadState(),
plugins: {},
files: {},
currentUploads: {},
allowNewUpload: true,
capabilities: {

@@ -242,8 +248,6 @@ uploadProgress: supportsUploadProgress(),

},
totalProgress: 0,
meta: {
...this.opts.meta
},
info: [],
recoveredState: null
info: []
});

@@ -365,2 +369,3 @@ _classPrivateFieldLooseBase(this, _restricter)[_restricter] = new Restricter(() => this.opts, this.i18n);

// todo next major: rename to something better? (it doesn't just reset progress)
resetProgress() {

@@ -388,9 +393,14 @@ const defaultProgress = {

files: updatedFiles,
totalProgress: 0,
allowNewUpload: true,
error: null,
recoveredState: null
...getDefaultUploadState()
});
this.emit('reset-progress');
}
/** @protected */
clearUploadedFiles() {
this.setState({
...getDefaultUploadState(),
files: {}
});
}
addPreProcessor(fn) {

@@ -797,9 +807,7 @@ _classPrivateFieldLooseBase(this, _preProcessors)[_preProcessors].add(fn);

}
this.setState({
totalProgress: 0,
error: null,
recoveredState: null
});
this.setState(getDefaultUploadState());
// todo should we call this.emit('reset-progress') like we do for resetProgress?
}
}
retryUpload(fileID) {

@@ -806,0 +814,0 @@ this.setFileState(fileID, {

{
"name": "@uppy/core",
"description": "Core module for the extensible JavaScript file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Instagram, Dropbox, Google Drive, S3 and more :dog:",
"version": "3.6.1",
"version": "3.7.0",
"license": "MIT",

@@ -29,3 +29,3 @@ "main": "lib/index.js",

"@uppy/store-default": "^3.0.5",
"@uppy/utils": "^5.5.2",
"@uppy/utils": "^5.6.0",
"lodash": "^4.17.21",

@@ -32,0 +32,0 @@ "mime-match": "^1.0.2",

@@ -24,2 +24,10 @@ /* eslint-disable max-classes-per-file */

const getDefaultUploadState = () => ({
totalProgress: 0,
allowNewUpload: true,
error: null,
recoveredState: null,
});
/**

@@ -95,6 +103,6 @@ * Uppy Core module.

this.setState({
...getDefaultUploadState(),
plugins: {},
files: {},
currentUploads: {},
allowNewUpload: true,
capabilities: {

@@ -105,6 +113,4 @@ uploadProgress: supportsUploadProgress(),

},
totalProgress: 0,
meta: { ...this.opts.meta },
info: [],
recoveredState: null,
})

@@ -236,2 +242,3 @@

// todo next major: rename to something better? (it doesn't just reset progress)
resetProgress () {

@@ -256,9 +263,3 @@ const defaultProgress = {

this.setState({
files: updatedFiles,
totalProgress: 0,
allowNewUpload: true,
error: null,
recoveredState: null,
})
this.setState({ files: updatedFiles, ...getDefaultUploadState() })

@@ -268,2 +269,7 @@ this.emit('reset-progress')

/** @protected */
clearUploadedFiles () {
this.setState({ ...getDefaultUploadState(), files: {} })
}
addPreProcessor (fn) {

@@ -863,7 +869,4 @@ this.#preProcessors.add(fn)

this.setState({
totalProgress: 0,
error: null,
recoveredState: null,
})
this.setState(getDefaultUploadState())
// todo should we call this.emit('reset-progress') like we do for resetProgress?
}

@@ -870,0 +873,0 @@ }

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

// This references the old types on purpose, to make sure to not create breaking changes for TS consumers.
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
/// <reference path="../../utils/types/index.d.ts"/>
import * as UppyUtils from '@uppy/utils'

@@ -294,8 +297,9 @@

export class Uppy {
export class Uppy<
TMeta extends IndexedObject<any> = Record<string, unknown>,
TBody extends IndexedObject<any> = Record<string, unknown>,
> {
constructor(opts?: UppyOptions)
on<K extends keyof UppyEventMap>(event: K, callback: UppyEventMap[K]): this
on<K extends keyof UppyEventMap, TMeta extends IndexedObject<any>>(
on<K extends keyof UppyEventMap>(
event: K,

@@ -305,5 +309,3 @@ callback: UppyEventMap<TMeta>[K],

once<K extends keyof UppyEventMap>(event: K, callback: UppyEventMap[K]): this
once<K extends keyof UppyEventMap, TMeta extends IndexedObject<any>>(
once<K extends keyof UppyEventMap>(
event: K,

@@ -313,5 +315,3 @@ callback: UppyEventMap<TMeta>[K],

off<K extends keyof UppyEventMap>(event: K, callback: UppyEventMap[K]): this
off<K extends keyof UppyEventMap, TMeta extends IndexedObject<any>>(
off<K extends keyof UppyEventMap>(
event: K,

@@ -332,5 +332,3 @@ callback: UppyEventMap<TMeta>[K],

getState<
TMeta extends IndexedObject<any> = Record<string, unknown>,
>(): State<TMeta>
getState(): State<TMeta>

@@ -353,20 +351,9 @@ setFileState(fileID: string, state: Record<string, unknown>): void

setMeta<TMeta extends IndexedObject<any> = Record<string, unknown>>(
data: TMeta,
): void
setMeta(data: TMeta): void
setFileMeta<TMeta extends IndexedObject<any> = Record<string, unknown>>(
fileID: string,
data: TMeta,
): void
setFileMeta(fileID: string, data: TMeta): void
getFile<
TMeta extends IndexedObject<any> = Record<string, unknown>,
TBody extends IndexedObject<any> = Record<string, unknown>,
>(fileID: string): UppyFile<TMeta, TBody>
getFile(fileID: string): UppyFile<TMeta, TBody>
getFiles<
TMeta extends IndexedObject<any> = Record<string, unknown>,
TBody extends IndexedObject<any> = Record<string, unknown>,
>(): Array<UppyFile<TMeta, TBody>>
getFiles(): Array<UppyFile<TMeta, TBody>>

@@ -391,9 +378,5 @@ getObjectOfFilesPerState(): {

addFile<TMeta extends IndexedObject<any> = Record<string, unknown>>(
file: AddFileOptions<TMeta>,
): string
addFile(file: AddFileOptions<TMeta>): string
addFiles<TMeta extends IndexedObject<any> = Record<string, unknown>>(
files: AddFileOptions<TMeta>[],
): void
addFiles(files: AddFileOptions<TMeta>[]): void

@@ -408,11 +391,7 @@ removeFile(fileID: string, reason?: FileRemoveReason): void

retryAll<
TMeta extends IndexedObject<any> = Record<string, unknown>,
>(): Promise<UploadResult<TMeta>>
retryAll(): Promise<UploadResult<TMeta>>
cancelAll(options?: CancelOptions): void
retryUpload<TMeta extends IndexedObject<any> = Record<string, unknown>>(
fileID: string,
): Promise<UploadResult<TMeta>>
retryUpload(fileID: string): Promise<UploadResult<TMeta>>

@@ -451,13 +430,9 @@ getID(): string

restore<TMeta extends IndexedObject<any> = Record<string, unknown>>(
uploadID: string,
): Promise<UploadResult<TMeta>>
restore(uploadID: string): Promise<UploadResult<TMeta>>
addResultData(uploadID: string, data: Record<string, unknown>): void
upload<TMeta extends IndexedObject<any> = Record<string, unknown>>(): Promise<
UploadResult<TMeta>
>
upload(): Promise<UploadResult<TMeta>>
}
export default Uppy

@@ -54,4 +54,4 @@ /* eslint-disable @typescript-eslint/no-unused-vars */

}
const uppy = new Uppy()
const f = uppy.getFile<Meta, ResponseBody>('virtual')
const uppy = new Uppy<Meta, ResponseBody>()
const f = uppy.getFile('virtual')
expectType<ResponseBody>(f.response!.body) // eslint-disable-line @typescript-eslint/no-non-null-assertion

@@ -82,4 +82,6 @@ }

{
// Meta signature
type Meta = { myCustomMetadata: string }
/* eslint-disable @typescript-eslint/no-empty-function */
const uppy = new Uppy()
const uppy = new Uppy<Meta>()
// can emit events with internal event types

@@ -108,5 +110,3 @@ uppy.emit('upload')

// Meta signature
type Meta = { myCustomMetadata: string }
uppy.on<'complete', Meta>('complete', (result) => {
uppy.on('complete', (result) => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars

@@ -121,3 +121,3 @@ const meta = result.successful[0].meta.myCustomMetadata

uppy.off<'upload-success', Meta>('upload-success', handleUpload)
uppy.off('upload-success', handleUpload)

@@ -134,3 +134,3 @@ interface CustomResponse extends SuccessResponse {

}
uppy.on<'upload-success', Meta>('upload-success', onUploadSuccess)
uppy.on('upload-success', onUploadSuccess)
}

@@ -137,0 +137,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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