@trezor/utils
Advanced tools
Comparing version 9.0.3 to 9.0.4
@@ -13,3 +13,3 @@ export declare const createDeferred: <T, P = string | number | undefined>(id?: P | undefined) => { | ||
} | ||
export declare type DeferredResponse<D> = D extends Deferred<infer R> ? R : never; | ||
export type DeferredResponse<D> = D extends Deferred<infer R> ? R : never; | ||
//# sourceMappingURL=createDeferred.d.ts.map |
@@ -1,2 +0,1 @@ | ||
export * from './createDeferred'; | ||
export * from './arrayDistinct'; | ||
@@ -7,23 +6,26 @@ export * from './arrayPartition'; | ||
export * from './bytesToHumanReadable'; | ||
export * from './mergeObject'; | ||
export * from './getWeakRandomId'; | ||
export * from './getRandomNumberInRange'; | ||
export * from './capitalizeFirstLetter'; | ||
export * from './countBytesInString'; | ||
export * from './truncateMiddle'; | ||
export * from './createDeferred'; | ||
export * from './createTimeoutPromise'; | ||
export * as enumUtils from './enumUtils'; | ||
export * from './getNumberFromPixelString'; | ||
export * from './isUrl'; | ||
export * from './getRandomNumberInRange'; | ||
export * from './getWeakRandomId'; | ||
export * from './hasUppercaseLetter'; | ||
export * from './isAscii'; | ||
export * from './isHex'; | ||
export * from './isNotUndefined'; | ||
export * as versionUtils from './versionUtils'; | ||
export * from './isUrl'; | ||
export * from './mergeObject'; | ||
export * from './objectPartition'; | ||
export * from './parseHostname'; | ||
export * from './throwError'; | ||
export * from './isHex'; | ||
export * from './redactUserPath'; | ||
export * from './resolveStaticPath'; | ||
export * from './createTimeoutPromise'; | ||
export * from './scheduleAction'; | ||
export * from './redactUserPath'; | ||
export * from './throwError'; | ||
export * from './truncateMiddle'; | ||
export * from './topologicalSort'; | ||
export * as versionUtils from './versionUtils'; | ||
export * as xssFilters from './xssFilters'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -29,4 +29,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.xssFilters = exports.versionUtils = exports.bufferUtils = void 0; | ||
__exportStar(require("./createDeferred"), exports); | ||
exports.xssFilters = exports.versionUtils = exports.enumUtils = exports.bufferUtils = void 0; | ||
__exportStar(require("./arrayDistinct"), exports); | ||
@@ -37,23 +36,26 @@ __exportStar(require("./arrayPartition"), exports); | ||
__exportStar(require("./bytesToHumanReadable"), exports); | ||
__exportStar(require("./mergeObject"), exports); | ||
__exportStar(require("./getWeakRandomId"), exports); | ||
__exportStar(require("./getRandomNumberInRange"), exports); | ||
__exportStar(require("./capitalizeFirstLetter"), exports); | ||
__exportStar(require("./countBytesInString"), exports); | ||
__exportStar(require("./truncateMiddle"), exports); | ||
__exportStar(require("./createDeferred"), exports); | ||
__exportStar(require("./createTimeoutPromise"), exports); | ||
exports.enumUtils = __importStar(require("./enumUtils")); | ||
__exportStar(require("./getNumberFromPixelString"), exports); | ||
__exportStar(require("./isUrl"), exports); | ||
__exportStar(require("./getRandomNumberInRange"), exports); | ||
__exportStar(require("./getWeakRandomId"), exports); | ||
__exportStar(require("./hasUppercaseLetter"), exports); | ||
__exportStar(require("./isAscii"), exports); | ||
__exportStar(require("./isHex"), exports); | ||
__exportStar(require("./isNotUndefined"), exports); | ||
exports.versionUtils = __importStar(require("./versionUtils")); | ||
__exportStar(require("./isUrl"), exports); | ||
__exportStar(require("./mergeObject"), exports); | ||
__exportStar(require("./objectPartition"), exports); | ||
__exportStar(require("./parseHostname"), exports); | ||
__exportStar(require("./throwError"), exports); | ||
__exportStar(require("./isHex"), exports); | ||
__exportStar(require("./redactUserPath"), exports); | ||
__exportStar(require("./resolveStaticPath"), exports); | ||
__exportStar(require("./createTimeoutPromise"), exports); | ||
__exportStar(require("./scheduleAction"), exports); | ||
__exportStar(require("./redactUserPath"), exports); | ||
__exportStar(require("./throwError"), exports); | ||
__exportStar(require("./truncateMiddle"), exports); | ||
__exportStar(require("./topologicalSort"), exports); | ||
exports.versionUtils = __importStar(require("./versionUtils")); | ||
exports.xssFilters = __importStar(require("./xssFilters")); | ||
//# sourceMappingURL=index.js.map |
@@ -1,7 +0,7 @@ | ||
declare type Mergable = { | ||
type Mergable = { | ||
[key: string]: any; | ||
[index: number]: never; | ||
}; | ||
declare type Merge<A, B> = A extends Mergable ? (B extends Mergable ? MergeResult<A, B> : B) : B; | ||
declare type MergeResult<A, B> = { | ||
type Merge<A, B> = A extends Mergable ? (B extends Mergable ? MergeResult<A, B> : B) : B; | ||
type MergeResult<A, B> = { | ||
[K in Exclude<keyof A, keyof B>]: A[K]; | ||
@@ -8,0 +8,0 @@ } & { |
@@ -1,2 +0,2 @@ | ||
declare type Obj<T> = { | ||
type Obj<T> = { | ||
[key: string]: T; | ||
@@ -3,0 +3,0 @@ }; |
@@ -1,3 +0,3 @@ | ||
export declare type ScheduledAction<T> = (signal?: AbortSignal) => Promise<T>; | ||
export declare type ScheduleActionParams = { | ||
export type ScheduledAction<T> = (signal?: AbortSignal) => Promise<T>; | ||
export type ScheduleActionParams = { | ||
delay?: number; | ||
@@ -4,0 +4,0 @@ deadline?: number; |
@@ -54,2 +54,15 @@ "use strict"; | ||
}); | ||
const resolveAction = (action, clear) => __awaiter(void 0, void 0, void 0, function* () { | ||
const aborter = new AbortController(); | ||
const onClear = () => aborter.abort(); | ||
if (clear.aborted) | ||
onClear(); | ||
clear.addEventListener('abort', onClear); | ||
try { | ||
return yield new Promise(resolve => resolve(action(aborter.signal))); | ||
} | ||
finally { | ||
clear.removeEventListener('abort', onClear); | ||
} | ||
}); | ||
const attemptLoop = (attempts, attempt, failure, clear) => __awaiter(void 0, void 0, void 0, function* () { | ||
@@ -80,3 +93,3 @@ for (let a = 0; a < attempts - 1; a++) { | ||
rejectAfterMs(timeout, abortedByTimeout, clear), | ||
new Promise(resolve => resolve(action(clear))), | ||
resolveAction(action, clear), | ||
]), () => resolveAfterMs(gap !== null && gap !== void 0 ? gap : 0, clear), clear)), | ||
@@ -83,0 +96,0 @@ ]); |
@@ -1,3 +0,3 @@ | ||
declare type VersionArray = [number, number, number]; | ||
declare type VersionInput = VersionArray | string; | ||
type VersionArray = [number, number, number]; | ||
type VersionInput = VersionArray | string; | ||
export declare const isVersionArray: (arr: number[]) => arr is VersionArray; | ||
@@ -4,0 +4,0 @@ export declare const isNewer: (versionX: VersionInput, versionY: VersionInput) => boolean; |
{ | ||
"name": "@trezor/utils", | ||
"version": "9.0.3", | ||
"author": "Trezor <info@trezor.io>", | ||
"homepage": "https://github.com/trezor/trezor-suite/tree/develop/packages/utils", | ||
"description": "A collection of typescript utils that are intended to be used across trezor-suite monorepo.", | ||
"license": "SEE LICENSE IN LICENSE.md", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/trezor/trezor-suite.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/trezor/trezor-suite/issues" | ||
}, | ||
"sideEffects": false, | ||
"main": "lib/index", | ||
"files": [ | ||
"lib/", | ||
"!**/*.map" | ||
], | ||
"scripts": { | ||
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'", | ||
"test:unit": "jest --verbose -c ../../jest.config.base.js", | ||
"type-check": "tsc --build tsconfig.json", | ||
"build:lib": "rimraf ./lib && yarn tsc --build tsconfig.lib.json" | ||
}, | ||
"devDependencies": { | ||
"jest": "^26.6.3", | ||
"rimraf": "^3.0.2", | ||
"typescript": "4.7.4" | ||
} | ||
} | ||
"name": "@trezor/utils", | ||
"version": "9.0.4", | ||
"author": "Trezor <info@trezor.io>", | ||
"homepage": "https://github.com/trezor/trezor-suite/tree/develop/packages/utils", | ||
"description": "A collection of typescript utils that are intended to be used across trezor-suite monorepo.", | ||
"npmPublishAccess": "public", | ||
"license": "SEE LICENSE IN LICENSE.md", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/trezor/trezor-suite.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/trezor/trezor-suite/issues" | ||
}, | ||
"sideEffects": false, | ||
"main": "lib/index", | ||
"files": [ | ||
"lib/", | ||
"!**/*.map" | ||
], | ||
"scripts": { | ||
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'", | ||
"test:unit": "jest --verbose -c ../../jest.config.base.js", | ||
"type-check": "tsc --build tsconfig.json", | ||
"build:lib": "rimraf ./lib && yarn tsc --build tsconfig.lib.json", | ||
"prepublishOnly": "yarn tsx ../../scripts/prepublishNPM.js", | ||
"prepublish": "yarn tsx ../../scripts/prepublish.js" | ||
}, | ||
"devDependencies": { | ||
"jest": "^26.6.3", | ||
"rimraf": "^3.0.2", | ||
"tsx": "^3.8.2", | ||
"typescript": "4.9.3" | ||
} | ||
} |
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
31200
64
557
4