Add Activepieces integration for workflow automation
- Add Activepieces fork with SmoothSchedule custom piece - Create integrations app with Activepieces service layer - Add embed token endpoint for iframe integration - Create Automations page with embedded workflow builder - Add sidebar visibility fix for embed mode - Add list inactive customers endpoint to Public API - Include SmoothSchedule triggers: event created/updated/cancelled - Include SmoothSchedule actions: create/update/cancel events, list resources/services/customers 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"extends": [
|
||||
"../../../../.eslintrc.base.json"
|
||||
],
|
||||
"ignorePatterns": [
|
||||
"!**/*"
|
||||
],
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
"*.ts",
|
||||
"*.tsx",
|
||||
"*.js",
|
||||
"*.jsx"
|
||||
],
|
||||
"rules": {}
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"*.ts",
|
||||
"*.tsx"
|
||||
],
|
||||
"rules": {}
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"*.js",
|
||||
"*.jsx"
|
||||
],
|
||||
"rules": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
# pieces-queue
|
||||
|
||||
This library was generated with [Nx](https://nx.dev).
|
||||
|
||||
## Building
|
||||
|
||||
Run `nx build pieces-queue` to build the library.
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "@activepieces/piece-queue",
|
||||
"version": "0.0.12"
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
{
|
||||
"name": "pieces-queue",
|
||||
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "packages/pieces/community/queue/src",
|
||||
"projectType": "library",
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/js:tsc",
|
||||
"outputs": [
|
||||
"{options.outputPath}"
|
||||
],
|
||||
"options": {
|
||||
"outputPath": "dist/packages/pieces/community/queue",
|
||||
"tsConfig": "packages/pieces/community/queue/tsconfig.lib.json",
|
||||
"packageJson": "packages/pieces/community/queue/package.json",
|
||||
"main": "packages/pieces/community/queue/src/index.ts",
|
||||
"assets": [
|
||||
"packages/pieces/community/queue/*.md",
|
||||
{
|
||||
"input": "packages/pieces/community/queue/src/i18n",
|
||||
"output": "./src/i18n",
|
||||
"glob": "**/!(i18n.json)"
|
||||
}
|
||||
],
|
||||
"buildableProjectDepsInPackageJsonType": "dependencies",
|
||||
"updateBuildableProjectDepsInPackageJson": true
|
||||
},
|
||||
"dependsOn": [
|
||||
"^build",
|
||||
"prebuild"
|
||||
]
|
||||
},
|
||||
"publish": {
|
||||
"command": "node tools/scripts/publish.mjs pieces-queue {args.ver} {args.tag}",
|
||||
"dependsOn": [
|
||||
"build"
|
||||
]
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/eslint:lint",
|
||||
"outputs": [
|
||||
"{options.outputFile}"
|
||||
]
|
||||
},
|
||||
"prebuild": {
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"cwd": "packages/pieces/community/queue",
|
||||
"command": "bun install --no-save --silent"
|
||||
},
|
||||
"dependsOn": [
|
||||
"^build"
|
||||
]
|
||||
}
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"A piece that allows you to push items into a queue, providing a way to throttle requests or process data in a First-In-First-Out (FIFO) manner.": "Ein Stück, das es Ihnen ermöglicht, Elemente in eine Warteschlange zu schieben, um Anfragen zu drosseln oder Daten auf eine First-In-First-Out (FIFO) Weise zu verarbeiten.",
|
||||
"Push to Queue": "In die Warteschlange schieben",
|
||||
"Pull items from queue": "Elemente aus der Warteschlange ziehen",
|
||||
"Clear queue": "Warteschlange leeren",
|
||||
"Push item to queue": "Element zur Warteschlange schieben",
|
||||
"Clears all items inside a queue": "Löscht alle Elemente in einer Warteschlange",
|
||||
"Markdown": "Markdown",
|
||||
"Queue Name": "Queue-Name",
|
||||
"Items": "Items",
|
||||
"Number of items": "Anzahl der Elemente",
|
||||
"**Note:**\n- You can push items from other flows. The queue name should be unique across all flows.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n": "**Hinweis:**\n- Du kannst Gegenstände aus anderen Strömen schieben. Der Name der Warteschlange sollte über alle Ströme hinweg eindeutig sein.\n- Der Prüfschritt funktioniert isoliert und beeinflusst nicht die eigentliche Warteschlange nach dem Veröffentlichen.\n",
|
||||
"**Note:**\n- You can pull items from other flows. The queue name should be unique across all flows.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n": "**Hinweis:**\n- Du kannst Gegenstände aus anderen Strömungen ziehen. Der Name der Warteschlange sollte über alle Ströme hinweg eindeutig sein.\n- Der Prüfschritt funktioniert isoliert und beeinflusst nicht die eigentliche Warteschlange nach dem Veröffentlichen.\n",
|
||||
"**Note:**\n- This deletes all items inside the queue permanently.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n": "**Hinweis:**\n- Dies löscht alle Elemente in der Warteschlange dauerhaft.\n- Der Prüfschritt funktioniert isoliert und beeinflusst nicht die eigentliche Warteschlange nach dem Veröffentlichen.\n"
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"A piece that allows you to push items into a queue, providing a way to throttle requests or process data in a First-In-First-Out (FIFO) manner.": "Una pieza que le permite enviar elementos a una cola, proporcionando una manera de limitar las peticiones o procesar los datos de una manera Primera-In-First-Out (FIFO).",
|
||||
"Push to Queue": "Enviar a la cola",
|
||||
"Pull items from queue": "Tirar elementos de la cola",
|
||||
"Clear queue": "Limpiar cola",
|
||||
"Push item to queue": "Enviar elemento a la cola",
|
||||
"Clears all items inside a queue": "Limpia todos los elementos dentro de una cola",
|
||||
"Markdown": "Markdown",
|
||||
"Queue Name": "Nombre de cola",
|
||||
"Items": "Elementos",
|
||||
"Number of items": "Número de elementos",
|
||||
"**Note:**\n- You can push items from other flows. The queue name should be unique across all flows.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n": "**Nota:**\n- Puedes empujar elementos de otros flujos. El nombre de la cola debe ser único en todos los flujos.\n- El paso de prueba funciona de forma aislada y no afecta a la cola real después de publicar.\n",
|
||||
"**Note:**\n- You can pull items from other flows. The queue name should be unique across all flows.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n": "**Nota:**\n- Puedes extraer elementos de otros flujos. El nombre de la cola debe ser único a través de todos los flujos.\n- El paso de prueba funciona de forma aislada y no afecta a la cola real después de publicar.\n",
|
||||
"**Note:**\n- This deletes all items inside the queue permanently.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n": "**Nota:**\n- Esto elimina todos los elementos dentro de la cola permanentemente.\n- El paso de prueba funciona de forma aislada y no afecta a la cola real después de publicar.\n"
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"A piece that allows you to push items into a queue, providing a way to throttle requests or process data in a First-In-First-Out (FIFO) manner.": "Une pièce qui vous permet de pousser des éléments dans une file d’attente, fournissant un moyen de régulariser les requêtes ou de traiter les données d’une manière première entrée dans la première sortie (FIFO).",
|
||||
"Push to Queue": "Envoyer à la file d'attente",
|
||||
"Pull items from queue": "Tirer des éléments de la file d'attente",
|
||||
"Clear queue": "Vider la file d'attente",
|
||||
"Push item to queue": "Envoyer l'élément à la file d'attente",
|
||||
"Clears all items inside a queue": "Efface tous les éléments dans une file d'attente",
|
||||
"Markdown": "Markdown",
|
||||
"Queue Name": "Nom de la file d'attente",
|
||||
"Items": "Éléments",
|
||||
"Number of items": "Nombre d'éléments",
|
||||
"**Note:**\n- You can push items from other flows. The queue name should be unique across all flows.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n": "**Note:**\n- You can push items from other flows. The queue name should be unique across all flows.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n",
|
||||
"**Note:**\n- You can pull items from other flows. The queue name should be unique across all flows.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n": "**Note:**\n- You can pull items from other flows. The queue name should be unique across all flows.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n",
|
||||
"**Note:**\n- This deletes all items inside the queue permanently.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n": "**Note:**\n- This deletes all items inside the queue permanently.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n"
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"A piece that allows you to push items into a queue, providing a way to throttle requests or process data in a First-In-First-Out (FIFO) manner.": "アイテムをキューにプッシュすることで、要求を抑制したり、ファーストインファーストアウト(FIFO)方法でデータを処理したりすることができます。",
|
||||
"Push to Queue": "キューに移動",
|
||||
"Pull items from queue": "キューからアイテムを取得する",
|
||||
"Clear queue": "キューをクリア",
|
||||
"Push item to queue": "Push item to queue",
|
||||
"Clears all items inside a queue": "キュー内のすべての項目をクリアします。",
|
||||
"Markdown": "Markdown",
|
||||
"Queue Name": "キュー名",
|
||||
"Items": "アイテム",
|
||||
"Number of items": "アイテムの数",
|
||||
"**Note:**\n- You can push items from other flows. The queue name should be unique across all flows.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n": "**Note:**\n- You can push items from other flows. The queue name should be unique across all flows.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n",
|
||||
"**Note:**\n- You can pull items from other flows. The queue name should be unique across all flows.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n": "**Note:**\n- You can pull items from other flows. The queue name should be unique across all flows.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n",
|
||||
"**Note:**\n- This deletes all items inside the queue permanently.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n": "**Note:**\n- This deletes all items inside the queue permanently.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n"
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"A piece that allows you to push items into a queue, providing a way to throttle requests or process data in a First-In-First-Out (FIFO) manner.": "Een stuk dat je toelaat om items in een wachtrij te duwen en een manier biedt om verzoeken af te zwakken of gegevens te verwerken op een eerste-In-First-Out (FIFO) manier.",
|
||||
"Push to Queue": "Push naar wachtrij",
|
||||
"Pull items from queue": "Trek items uit de wachtrij",
|
||||
"Clear queue": "Wachtrij wissen",
|
||||
"Push item to queue": "Item naar wachtrij schuiven",
|
||||
"Clears all items inside a queue": "Wist alle voorwerpen binnen een wachtrij",
|
||||
"Markdown": "Markdown",
|
||||
"Queue Name": "Wachtrij naam",
|
||||
"Items": "Artikelen",
|
||||
"Number of items": "Aantal items",
|
||||
"**Note:**\n- You can push items from other flows. The queue name should be unique across all flows.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n": "**Let op:**\n- U kunt items van andere flows duwen. De wachtrijnaam moet uniek zijn in alle flows.\n- De teststap werkt geïsoleerd en heeft geen invloed op de werkelijke wachtrij na publiceren.\n",
|
||||
"**Note:**\n- You can pull items from other flows. The queue name should be unique across all flows.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n": "**Let op:**\n- U kunt items van andere flows trekken. De wachtrijnaam moet uniek zijn in alle stromen.\n- De teststap werkt geïsoleerd en heeft geen invloed op de werkelijke wachtrij na publiceren.\n",
|
||||
"**Note:**\n- This deletes all items inside the queue permanently.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n": "**Opmerking:**\n- Dit verwijdert alle items in de wachtrij permanent.\n- De teststap werkt geïsoleerd en heeft geen invloed op de werkelijke wachtrij na publiceren.\n"
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"A piece that allows you to push items into a queue, providing a way to throttle requests or process data in a First-In-First-Out (FIFO) manner.": "Uma peça que permite a você colocar itens em uma fila, fornecendo uma maneira de acelerar solicitações ou processar dados de uma maneira de First-In-First-Out (FIFO).",
|
||||
"Push to Queue": "Enviar para a fila",
|
||||
"Pull items from queue": "Puxar itens da fila",
|
||||
"Clear queue": "Limpar fila",
|
||||
"Push item to queue": "Enviar item para a fila",
|
||||
"Clears all items inside a queue": "Limpa todos os itens dentro de uma fila",
|
||||
"Markdown": "Markdown",
|
||||
"Queue Name": "Nome da Fila",
|
||||
"Items": "Itens",
|
||||
"Number of items": "Número de itens",
|
||||
"**Note:**\n- You can push items from other flows. The queue name should be unique across all flows.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n": "**Nota:**\n- Você pode enviar itens de outros fluxos. O nome da fila deve ser único entre todos os fluxos.\n- A etapa de teste funciona isoladamente e não afeta a fila atual após a publicação.\n",
|
||||
"**Note:**\n- You can pull items from other flows. The queue name should be unique across all flows.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n": "**Nota:**\n- Você pode puxar itens de outros fluxos. O nome da fila deve ser único entre todos os fluxos.\n- A etapa de teste funciona isoladamente e não afeta a fila atual após a publicação.\n",
|
||||
"**Note:**\n- This deletes all items inside the queue permanently.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n": "**Nota:**\n- Isso exclui todos os itens da fila permanentemente.\n- A etapa de teste funciona isoladamente e não afeta a fila atual após a publicação.\n"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"Queue": "Очередь",
|
||||
"A piece that allows you to push items into a queue, providing a way to throttle requests or process data in a First-In-First-Out (FIFO) manner.": "Фишка, которая позволяет переносить элементы в очередь, предоставляя способ сортировать запросы или обрабатывать данные методом First-In-First-Out (FIFO).",
|
||||
"Push to Queue": "Передать в очередь",
|
||||
"Pull items from queue": "Потянуть элементы из очереди",
|
||||
"Clear queue": "Очистить очередь",
|
||||
"Push item to queue": "Отправить в очередь",
|
||||
"Clears all items inside a queue": "Очищает все элементы внутри очереди",
|
||||
"Markdown": "Markdown",
|
||||
"Queue Name": "Имя очереди",
|
||||
"Items": "Items",
|
||||
"Number of items": "Количество элементов",
|
||||
"**Note:**\n- You can push items from other flows. The queue name should be unique across all flows.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n": "**Примечание:**\n- Вы можете отправлять вещи из других потоков. Имя очереди должно быть уникальным для всех потоков.\n- этап тестирования работает изолированно и не влияет на актуальную очередь после публикации.\n",
|
||||
"**Note:**\n- You can pull items from other flows. The queue name should be unique across all flows.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n": "**Примечание:**\n- Вы можете взять предметы из других потоков. Имя очереди должно быть уникальным во всех потоках.\n- этап тестирования работает изолированно и не влияет на актуальную очередь после публикации.\n",
|
||||
"**Note:**\n- This deletes all items inside the queue permanently.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n": "**Примечание:**\n- Это удалит все элементы в очереди навсегда.\n- этап тестирования работает изолированно и не влияет на актуальную очередь после публикации.\n"
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"A piece that allows you to push items into a queue, providing a way to throttle requests or process data in a First-In-First-Out (FIFO) manner.": "A piece that allows you to push items into a queue, providing a way to throttle requests or process data in a First-In-First-Out (FIFO) manner.",
|
||||
"Push to Queue": "Push to Queue",
|
||||
"Pull items from queue": "Pull items from queue",
|
||||
"Clear queue": "Clear queue",
|
||||
"Push item to queue": "Push item to queue",
|
||||
"Clears all items inside a queue": "Clears all items inside a queue",
|
||||
"Markdown": "Markdown",
|
||||
"Queue Name": "Queue Name",
|
||||
"Items": "Items",
|
||||
"Number of items": "Number of items",
|
||||
"**Note:**\n- You can push items from other flows. The queue name should be unique across all flows.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n": "**Note:**\n- You can push items from other flows. The queue name should be unique across all flows.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n",
|
||||
"**Note:**\n- You can pull items from other flows. The queue name should be unique across all flows.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n": "**Note:**\n- You can pull items from other flows. The queue name should be unique across all flows.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n",
|
||||
"**Note:**\n- This deletes all items inside the queue permanently.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n": "**Note:**\n- This deletes all items inside the queue permanently.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"Queue": "Queue",
|
||||
"A piece that allows you to push items into a queue, providing a way to throttle requests or process data in a First-In-First-Out (FIFO) manner.": "A piece that allows you to push items into a queue, providing a way to throttle requests or process data in a First-In-First-Out (FIFO) manner.",
|
||||
"Push to Queue": "Push to Queue",
|
||||
"Pull items from queue": "Pull items from queue",
|
||||
"Clear queue": "Clear queue",
|
||||
"Push item to queue": "Push item to queue",
|
||||
"Clears all items inside a queue": "Clears all items inside a queue",
|
||||
"Markdown": "Markdown",
|
||||
"Queue Name": "Queue Name",
|
||||
"Items": "Items",
|
||||
"Number of items": "Number of items",
|
||||
"**Note:**\n- You can push items from other flows. The queue name should be unique across all flows.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n": "**Note:**\n- You can push items from other flows. The queue name should be unique across all flows.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n",
|
||||
"**Note:**\n- You can pull items from other flows. The queue name should be unique across all flows.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n": "**Note:**\n- You can pull items from other flows. The queue name should be unique across all flows.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n",
|
||||
"**Note:**\n- This deletes all items inside the queue permanently.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n": "**Note:**\n- This deletes all items inside the queue permanently.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n"
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"A piece that allows you to push items into a queue, providing a way to throttle requests or process data in a First-In-First-Out (FIFO) manner.": "A piece that allows you to push items into a queue, providing a way to throttle requests or process data in a First-In-First-Out (FIFO) manner.",
|
||||
"Push to Queue": "Push to Queue",
|
||||
"Pull items from queue": "Pull items from queue",
|
||||
"Clear queue": "Clear queue",
|
||||
"Push item to queue": "Push item to queue",
|
||||
"Clears all items inside a queue": "Clears all items inside a queue",
|
||||
"Markdown": "Markdown",
|
||||
"Queue Name": "Queue Name",
|
||||
"Items": "项目",
|
||||
"Number of items": "Number of items",
|
||||
"**Note:**\n- You can push items from other flows. The queue name should be unique across all flows.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n": "**Note:**\n- You can push items from other flows. The queue name should be unique across all flows.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n",
|
||||
"**Note:**\n- You can pull items from other flows. The queue name should be unique across all flows.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n": "**Note:**\n- You can pull items from other flows. The queue name should be unique across all flows.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n",
|
||||
"**Note:**\n- This deletes all items inside the queue permanently.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n": "**Note:**\n- This deletes all items inside the queue permanently.\n- The testing step work in isolation and doesn't affect the actual queue after publishing.\n"
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { createPiece, PieceAuth } from "@activepieces/pieces-framework";
|
||||
import { pushToQueue } from "./lib/actions/push-to-queue";
|
||||
import { pullFromQueue } from "./lib/actions/pull-from-queue";
|
||||
import { clearQueue } from "./lib/actions/clear-queue";
|
||||
|
||||
export const queue = createPiece({
|
||||
displayName: "Queue",
|
||||
description: "A piece that allows you to push items into a queue, providing a way to throttle requests or process data in a First-In-First-Out (FIFO) manner.",
|
||||
auth: PieceAuth.None(),
|
||||
minimumSupportedRelease: '0.30.0',
|
||||
logoUrl: 'https://cdn.activepieces.com/pieces/queue.svg',
|
||||
authors: ['AbdullahBitar'],
|
||||
actions: [pushToQueue, pullFromQueue, clearQueue],
|
||||
triggers: [],
|
||||
});
|
||||
@@ -0,0 +1,40 @@
|
||||
import {
|
||||
Property,
|
||||
StoreScope,
|
||||
createAction,
|
||||
} from '@activepieces/pieces-framework';
|
||||
import { constructQueueName } from '../common';
|
||||
|
||||
|
||||
const notes = `**Note:**
|
||||
- This deletes all items inside the queue permanently.
|
||||
- The testing step work in isolation and doesn't affect the actual queue after publishing.
|
||||
`
|
||||
export const clearQueue = createAction({
|
||||
name: 'clear-queue',
|
||||
description: 'Clears all items inside a queue',
|
||||
displayName: 'Clear queue',
|
||||
props: {
|
||||
info: Property.MarkDown({
|
||||
value: notes,
|
||||
}),
|
||||
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)
|
||||
return {
|
||||
success: true
|
||||
}
|
||||
},
|
||||
async test(context) {
|
||||
const queueName = constructQueueName(context.propsValue.queueName, true)
|
||||
await context.store.delete(queueName, StoreScope.PROJECT)
|
||||
return {
|
||||
success: true
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,55 @@
|
||||
import {
|
||||
Property,
|
||||
Store,
|
||||
StoreScope,
|
||||
createAction,
|
||||
} from '@activepieces/pieces-framework';
|
||||
import { constructQueueName, formatStorageError } from '../common';
|
||||
|
||||
const notes = `**Note:**
|
||||
- You can pull items from other flows. The queue name should be unique across all flows.
|
||||
- The testing step work in isolation and doesn't affect the actual queue after publishing.
|
||||
`
|
||||
export const pullFromQueue = createAction({
|
||||
name: 'pull-from-queue',
|
||||
description: 'Pull items from queue',
|
||||
displayName: 'Pull items from queue',
|
||||
props: {
|
||||
info: Property.MarkDown({
|
||||
value: notes,
|
||||
}),
|
||||
queueName: Property.ShortText({
|
||||
displayName: 'Queue Name',
|
||||
required: true,
|
||||
}),
|
||||
numOfItems: Property.Number({
|
||||
displayName: 'Number of items',
|
||||
required: true,
|
||||
})
|
||||
},
|
||||
async run(context) {
|
||||
const items = await poll({ store: context.store, queueName: context.propsValue.queueName, numOfItems: context.propsValue.numOfItems, testing: false })
|
||||
return items
|
||||
},
|
||||
async test(context) {
|
||||
const items = await poll({ store: context.store, queueName: context.propsValue.queueName, numOfItems: context.propsValue.numOfItems, testing: true })
|
||||
return items
|
||||
}
|
||||
});
|
||||
|
||||
async function poll({ store, queueName, numOfItems, testing }: { store: Store, queueName: string, numOfItems: number, testing: boolean }) {
|
||||
const key = constructQueueName(queueName, testing)
|
||||
const allItems = await store.get<unknown[]>(key, StoreScope.PROJECT) || []
|
||||
const neededItems = allItems.splice(0, numOfItems)
|
||||
try {
|
||||
await store.put(key, allItems, StoreScope.PROJECT)
|
||||
} catch (e: unknown) {
|
||||
const name = (e as Error)?.name;
|
||||
if (name === 'StorageLimitError') {
|
||||
throw formatStorageError(e)
|
||||
} else {
|
||||
throw e
|
||||
}
|
||||
}
|
||||
return neededItems
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
import {
|
||||
Property,
|
||||
Store,
|
||||
StoreScope,
|
||||
createAction,
|
||||
} from '@activepieces/pieces-framework';
|
||||
import { constructQueueName, formatStorageError } from '../common';
|
||||
|
||||
const notes = `**Note:**
|
||||
- You can push items from other flows. The queue name should be unique across all flows.
|
||||
- The testing step work in isolation and doesn't affect the actual queue after publishing.
|
||||
`
|
||||
export const pushToQueue = createAction({
|
||||
name: 'push-to-queue',
|
||||
description: 'Push item to queue',
|
||||
displayName: 'Push to Queue',
|
||||
props: {
|
||||
info: Property.MarkDown({
|
||||
value: notes,
|
||||
}),
|
||||
queueName: Property.ShortText({
|
||||
displayName: 'Queue Name',
|
||||
required: true,
|
||||
}),
|
||||
items: Property.Array({
|
||||
displayName: 'Items',
|
||||
required: true,
|
||||
}),
|
||||
},
|
||||
async run(context) {
|
||||
return push({ store: context.store, queueName: context.propsValue.queueName, items: context.propsValue.items, testing: false })
|
||||
},
|
||||
async test(context) {
|
||||
return push({ store: context.store, queueName: context.propsValue.queueName, items: context.propsValue.items, testing: true })
|
||||
}
|
||||
});
|
||||
|
||||
async function push({ store, queueName, items, testing }: { store: Store, queueName: string, items: unknown[], testing: boolean }) {
|
||||
const key = constructQueueName(queueName, testing)
|
||||
const existingQueueItems = await store.get<unknown[]>(key, StoreScope.PROJECT) || []
|
||||
const updatedQueueItems = [...existingQueueItems, ...items]
|
||||
try {
|
||||
return await store.put(key, updatedQueueItems, StoreScope.PROJECT)
|
||||
} catch (e: unknown) {
|
||||
const name = (e as Error)?.name;
|
||||
if (name === 'StorageLimitError') {
|
||||
throw formatStorageError(e)
|
||||
} else {
|
||||
throw e
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
export function constructQueueName(queueName: string, testing: boolean) {
|
||||
return `_queue_rmAPlFmX0s_${testing ? 'testing_' : ''}${queueName}`
|
||||
}
|
||||
|
||||
export function formatStorageError(e: unknown) {
|
||||
const size = (e as { maxStorageSizeInBytes: number }).maxStorageSizeInBytes;
|
||||
return new Error(JSON.stringify({
|
||||
message: `Queue write operation failed. The total size of the queue has exceeded the maximum limit of ${Math.floor(size / 1024)} kb.`,
|
||||
details: {
|
||||
maxSizeInKb: Math.floor(size / 1024),
|
||||
suggestion: "Consider consume faster from the queue or reduce the size of the items being added to the queue."
|
||||
}
|
||||
}));
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"extends": "../../../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true,
|
||||
"noImplicitOverride": true,
|
||||
"noPropertyAccessFromIndexSignature": true,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true
|
||||
},
|
||||
"files": [],
|
||||
"include": [],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.lib.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"outDir": "../../../../dist/out-tsc",
|
||||
"declaration": true,
|
||||
"types": ["node"]
|
||||
},
|
||||
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"],
|
||||
"include": ["src/**/*.ts"]
|
||||
}
|
||||
Reference in New Issue
Block a user