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 => {
|
||||
const suppliedIds = ['123', '456', '789']
|
||||
finalIds(getInput({packageVersionIds: suppliedIds})).subscribe(ids => {
|
||||
expect(ids).toBe(suppliedIds)
|
||||
expect(ids).toStrictEqual(suppliedIds)
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -15,12 +15,6 @@ inputs:
|
||||
Defaults to the owner of the repo running the action.
|
||||
required: false
|
||||
|
||||
repo:
|
||||
description: >
|
||||
Repo containing the package version to delete.
|
||||
Defaults to the repo running the action.
|
||||
required: false
|
||||
|
||||
package-name:
|
||||
description: >
|
||||
Name of the package containing the version to delete.
|
||||
|
||||
3
dist/index.js
vendored
3
dist/index.js
vendored
@@ -22,7 +22,8 @@ function getVersionIds(owner, packageName, packageType, numVersions, page, token
|
||||
exports.getVersionIds = getVersionIds;
|
||||
function finalIds(input) {
|
||||
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()) {
|
||||
return getVersionIds(input.owner, input.packageName, input.packageType, exports.RATE_LIMIT, 1, input.token).pipe(
|
||||
|
||||
@@ -47,7 +47,8 @@ export function getVersionIds(
|
||||
|
||||
export function finalIds(input: Input): Observable<string[]> {
|
||||
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()) {
|
||||
return getVersionIds(
|
||||
|
||||
Reference in New Issue
Block a user