@rpldy/abort
Advanced tools
Comparing version 1.7.1 to 1.8.0-rc.0
@@ -11,4 +11,2 @@ "use strict"; | ||
_shared.logger.debugLog(`abort: aborting ${item.state} item - `, item); | ||
//manually finish request for item that hasnt reached the sender yet | ||
finalizeItem(item.id, { | ||
@@ -31,8 +29,4 @@ status: 0, | ||
const itemState = item?.state; | ||
const method = !!itemState && | ||
//$FlowIssue[prop-missing] | ||
ITEM_STATE_ABORTS[itemState]; | ||
return method ? | ||
//$FlowExpectedError[extra-arg] | ||
method(item, aborts, finalizeItem) : false; | ||
const method = !!itemState && ITEM_STATE_ABORTS[itemState]; | ||
return method ? method(item, aborts, finalizeItem) : false; | ||
}; | ||
@@ -49,3 +43,2 @@ const abortItem = (id, items, aborts, finalizeItem) => callAbortOnItem(items[id], aborts, finalizeItem); | ||
const abortAll = (items, aborts, queue, finalizeItem, options) => { | ||
//$FlowIssue[incompatible-type] - no flat | ||
const itemIds = Object.values(queue).flat(); | ||
@@ -52,0 +45,0 @@ const isFastAbort = getIsFastAbortNeeded(itemIds.length, options.fastAbortThreshold); |
@@ -8,8 +8,5 @@ "use strict"; | ||
const fastAbortBatch = (batch, aborts) => { | ||
batch.items.forEach(_ref => { | ||
let { | ||
id | ||
} = _ref; | ||
return aborts[id]?.(); | ||
}); | ||
batch.items.forEach(({ | ||
id | ||
}) => aborts[id]?.()); | ||
}; | ||
@@ -16,0 +13,0 @@ exports.fastAbortBatch = fastAbortBatch; |
@@ -9,7 +9,3 @@ "use strict"; | ||
const getAbortEnhancer = () => { | ||
/** | ||
* an uploader enhancer function to add abort functionality | ||
*/ | ||
return uploader => { | ||
//$FlowIssue[incompatible-call]: unsure how to tell Flow this is ok... | ||
uploader.update({ | ||
@@ -16,0 +12,0 @@ abortAll: _abort.abortAll, |
@@ -5,4 +5,2 @@ import { FILE_STATES, logger } from "@rpldy/shared"; | ||
logger.debugLog(`abort: aborting ${item.state} item - `, item); | ||
//manually finish request for item that hasnt reached the sender yet | ||
finalizeItem(item.id, { | ||
@@ -25,8 +23,4 @@ status: 0, | ||
const itemState = item?.state; | ||
const method = !!itemState && | ||
//$FlowIssue[prop-missing] | ||
ITEM_STATE_ABORTS[itemState]; | ||
return method ? | ||
//$FlowExpectedError[extra-arg] | ||
method(item, aborts, finalizeItem) : false; | ||
const method = !!itemState && ITEM_STATE_ABORTS[itemState]; | ||
return method ? method(item, aborts, finalizeItem) : false; | ||
}; | ||
@@ -42,3 +36,2 @@ const abortItem = (id, items, aborts, finalizeItem) => callAbortOnItem(items[id], aborts, finalizeItem); | ||
const abortAll = (items, aborts, queue, finalizeItem, options) => { | ||
//$FlowIssue[incompatible-type] - no flat | ||
const itemIds = Object.values(queue).flat(); | ||
@@ -45,0 +38,0 @@ const isFastAbort = getIsFastAbortNeeded(itemIds.length, options.fastAbortThreshold); |
const fastAbortBatch = (batch, aborts) => { | ||
batch.items.forEach(_ref => { | ||
let { | ||
id | ||
} = _ref; | ||
return aborts[id]?.(); | ||
}); | ||
batch.items.forEach(({ | ||
id | ||
}) => aborts[id]?.()); | ||
}; | ||
@@ -9,0 +6,0 @@ const fastAbortAll = aborts => { |
import { abortAll, abortBatch, abortItem } from "./abort"; | ||
const getAbortEnhancer = () => { | ||
/** | ||
* an uploader enhancer function to add abort functionality | ||
*/ | ||
return uploader => { | ||
//$FlowIssue[incompatible-call]: unsure how to tell Flow this is ok... | ||
uploader.update({ | ||
@@ -9,0 +5,0 @@ abortAll, |
MIT License | ||
Copyright (c) 2023-2024 Yoav Niran | ||
Copyright (c) 2024 Yoav Niran | ||
@@ -5,0 +5,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy |
{ | ||
"version": "1.7.1", | ||
"version": "1.8.0-rc.0", | ||
"name": "@rpldy/abort", | ||
@@ -25,8 +25,8 @@ "description": "adds the capability to abort/cancel running & pending uploads", | ||
"dependencies": { | ||
"@rpldy/raw-uploader": "^1.7.1", | ||
"@rpldy/shared": "^1.7.1", | ||
"@rpldy/simple-state": "^1.7.1" | ||
"@rpldy/raw-uploader": "^1.8.0-rc.0", | ||
"@rpldy/shared": "^1.8.0-rc.0", | ||
"@rpldy/simple-state": "^1.8.0-rc.0" | ||
}, | ||
"devDependencies": { | ||
"flow-bin": "^0.223.2" | ||
"flow-bin": "^0.229.0" | ||
}, | ||
@@ -36,3 +36,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "7833f3aee74341e82620699a536ba2554819a0bf" | ||
"gitHead": "2e8e5b171dd02388932ce44e6a7c5ed8e987dbe5" | ||
} |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
11348
195
1