Library for asynchronous data processing.
Usage example:
import fetch, { RequestInit } from 'node-fetch';
import { Queue } from './index';
const API_BASE = 'https://api.atlassian.com';
const appContextAri = 'ari:cloud:jira::site/...';
const token = '...';
async function apiClient(path: string, init: RequestInit): Promise<APIResponse> {
const url = API_BASE + path;
const extraHeaders = {
'X-Forge-Context': appContextAri,
Authorization: `Bearer ${token}`
};
init.headers = Object.assign(init.headers!, extraHeaders);
return fetch(url, init);
}
async function demo() {
const queue = new Queue({key: "queue-name"}, apiClient);
const payloads = {
page: 1
}
await queue.push([payloads])
}
demo();