restrict to RATE_LIMIT with package-version-ids
This commit is contained in:
@@ -24,7 +24,7 @@ describe('index tests -- call rest', () => {
|
|||||||
it('finalIds test - supplied package version id', done => {
|
it('finalIds test - supplied package version id', done => {
|
||||||
const suppliedIds = ['123', '456', '789']
|
const suppliedIds = ['123', '456', '789']
|
||||||
finalIds(getInput({packageVersionIds: suppliedIds})).subscribe(ids => {
|
finalIds(getInput({packageVersionIds: suppliedIds})).subscribe(ids => {
|
||||||
expect(ids).toBe(suppliedIds)
|
expect(ids).toStrictEqual(suppliedIds)
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -15,12 +15,6 @@ inputs:
|
|||||||
Defaults to the owner of the repo running the action.
|
Defaults to the owner of the repo running the action.
|
||||||
required: false
|
required: false
|
||||||
|
|
||||||
repo:
|
|
||||||
description: >
|
|
||||||
Repo containing the package version to delete.
|
|
||||||
Defaults to the repo running the action.
|
|
||||||
required: false
|
|
||||||
|
|
||||||
package-name:
|
package-name:
|
||||||
description: >
|
description: >
|
||||||
Name of the package containing the version to delete.
|
Name of the package containing the version to delete.
|
||||||
|
|||||||
Vendored
+2
-1
@@ -22,7 +22,8 @@ function getVersionIds(owner, packageName, packageType, numVersions, page, token
|
|||||||
exports.getVersionIds = getVersionIds;
|
exports.getVersionIds = getVersionIds;
|
||||||
function finalIds(input) {
|
function finalIds(input) {
|
||||||
if (input.packageVersionIds.length > 0) {
|
if (input.packageVersionIds.length > 0) {
|
||||||
return (0, rxjs_1.of)(input.packageVersionIds);
|
const toDelete = Math.min(input.packageVersionIds.length, exports.RATE_LIMIT);
|
||||||
|
return (0, rxjs_1.of)(input.packageVersionIds.slice(0, toDelete));
|
||||||
}
|
}
|
||||||
if (input.hasOldestVersionQueryInfo()) {
|
if (input.hasOldestVersionQueryInfo()) {
|
||||||
return getVersionIds(input.owner, input.packageName, input.packageType, exports.RATE_LIMIT, 1, input.token).pipe(
|
return getVersionIds(input.owner, input.packageName, input.packageType, exports.RATE_LIMIT, 1, input.token).pipe(
|
||||||
|
|||||||
+2
-1
@@ -47,7 +47,8 @@ export function getVersionIds(
|
|||||||
|
|
||||||
export function finalIds(input: Input): Observable<string[]> {
|
export function finalIds(input: Input): Observable<string[]> {
|
||||||
if (input.packageVersionIds.length > 0) {
|
if (input.packageVersionIds.length > 0) {
|
||||||
return of(input.packageVersionIds)
|
const toDelete = Math.min(input.packageVersionIds.length, RATE_LIMIT)
|
||||||
|
return of(input.packageVersionIds.slice(0, toDelete))
|
||||||
}
|
}
|
||||||
if (input.hasOldestVersionQueryInfo()) {
|
if (input.hasOldestVersionQueryInfo()) {
|
||||||
return getVersionIds(
|
return getVersionIds(
|
||||||
|
|||||||
Reference in New Issue
Block a user