Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@uppy/utils: add missing exports #3989

Merged
merged 1 commit into from Aug 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions packages/@uppy/utils/package.json
Expand Up @@ -47,6 +47,18 @@
"./lib/secondsToTime": "./lib/secondsToTime.js",
"./lib/settle": "./lib/settle.js",
"./lib/toArray": "./lib/toArray.js",
"./lib/FOCUSABLE_ELEMENTS": "./lib/FOCUSABLE_ELEMENTS.js",
"./lib/AbortController": "./lib/AbortController.js",
"./lib/getTextDirection": "./lib/getTextDirection.js",
"./lib/NetworkError": "./lib/NetworkError.js",
"./lib/isNetworkError": "./lib/isNetworkError.js",
"./lib/truncateString": "./lib/truncateString.js",
"./lib/remoteFileObjToLocal": "./lib/remoteFileObjToLocal.js",
"./lib/fetchWithNetworkError": "./lib/fetchWithNetworkError.js",
"./lib/ErrorWithCause": "./lib/ErrorWithCause.js",
"./lib/delay": "./lib/delay.js",
"./lib/hasProperty": "./lib/hasProperty.js",
"./lib/mimeTypes": "./lib/mimeTypes.js",
"./lib/getDroppedFiles": "./lib/getDroppedFiles/index.js"
},
"dependencies": {
Expand Down
70 changes: 70 additions & 0 deletions packages/@uppy/utils/types/index.d.ts
Expand Up @@ -238,6 +238,12 @@ declare module '@uppy/utils/lib/toArray' {
export default toArray
}

declare module '@uppy/utils/lib/AbortController' {
export const AbortController: typeof globalThis.AbortController
export const AbortSignal: typeof globalThis.AbortSignal
export function createAbortError(message?: string): DOMException
}

declare module '@uppy/utils/lib/getDroppedFiles' {
function getDroppedFiles (
dataTransfer: DataTransfer,
Expand All @@ -246,6 +252,70 @@ declare module '@uppy/utils/lib/getDroppedFiles' {
export default getDroppedFiles
}

declare module '@uppy/utils/lib/getTextDirection' {
function getTextDirection (element: Node): string|undefined
export default getTextDirection
}

declare module '@uppy/utils/lib/isNetworkError' {
export default function isNetworkError (xhr: any): boolean

}

declare module '@uppy/utils/lib/NetworkError' {
class NetworkError extends Error {
readonly cause: any

readonly isNetworkError: true

readonly request?: XMLHttpRequest

constructor (error: any, xhr?: XMLHttpRequest)
}

export default NetworkError
}

declare module '@uppy/utils/lib/FOCUSABLE_ELEMENTS' {
const exports: string[]
export default exports
}

declare module '@uppy/utils/lib/truncateString' {
export default function truncateString (string: string, maxLength: number): string
}

declare module '@uppy/utils/lib/remoteFileObjToLocal' {
export default function remoteFileObjToLocal (file: object): Record<string, unknown>
}

declare module '@uppy/utils/lib/fetchWithNetworkError' {
export default function fetchWithNetworkError (...options: unknown[]): Promise<Response>
}

declare module '@uppy/utils/lib/ErrorWithCause' {
export default class ErrorWithCause extends Error {
cause: any

isNetworkError?: true

constructor (message: string, options?: ErrorOptions)
}
}

declare module '@uppy/utils/lib/delay' {
export default function delay (ms:number, opts?: {signal: AbortSignal}): Promise<void>
}

declare module '@uppy/utils/lib/hasProperty' {
export default function has (object: any, key: string): boolean
}

declare module '@uppy/utils/lib/mimeTypes' {
const exports: Record<string, string>
export default exports
}

declare module '@uppy/utils' {
interface IndexedObject<T> {
[key: string]: T
Expand Down