Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4622 from AbdullahBitar/queue
feat(queue): clear queue action
- Loading branch information
Showing
3 changed files
with
36 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"name": "@activepieces/piece-queue", | ||
"version": "0.0.2" | ||
"version": "0.0.3" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
packages/pieces/community/queue/src/lib/actions/clear-queue.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { | ||
Property, | ||
StoreScope, | ||
createAction, | ||
} from '@activepieces/pieces-framework'; | ||
import { constructQueueName } from '../common'; | ||
|
||
export const clearQueue = createAction({ | ||
name: 'clear-queue', | ||
description: 'Clears all items inside a queue', | ||
displayName: 'Clear queue', | ||
props: { | ||
info: Property.MarkDown({ | ||
value: ` | ||
**Note:** | ||
- This deletes all items inside the queue permanently. | ||
- The testing step work in isolation and doesn't affect the actual queue after publishing. | ||
`, | ||
}), | ||
queueName: Property.ShortText({ | ||
displayName: 'Queue Name', | ||
required: true, | ||
}) | ||
}, | ||
async run(context) { | ||
const queueName = constructQueueName(context.propsValue.queueName, false) | ||
await context.store.delete(queueName, StoreScope.PROJECT) | ||
}, | ||
async test(context) { | ||
const queueName = constructQueueName(context.propsValue.queueName, true) | ||
await context.store.delete(queueName, StoreScope.PROJECT) | ||
} | ||
}); |