npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@gcp-edge/tasks-client

v0.0.1

Published

Google Cloud Tasks client for Edge Runtime environments using fetch API

Readme

cloud-tasks-edge-client

Google Cloud Tasks REST API를 fetch로 구현한 클라이언트 라이브러리입니다. 공식 @google-cloud/tasks 라이브러리와 완전히 동일한 타입을 사용하여 동기화를 유지하며, Edge Runtime과 Cloudflare Workers에서 사용할 수 있도록 fetch 기반으로 구현되었습니다.

Installation

npm install cloud-tasks-edge-client @google-cloud/tasks

Usage

Basic Setup

import { CloudTasksClient, type Task, type Queue } from 'cloud-tasks-edge-client';
import type { protos } from '@google-cloud/tasks';

const client = new CloudTasksClient({
  projectId: 'your-project-id',
  location: 'us-central1',
  credentials: {
    accessToken: 'your-access-token'
  }
});

Creating a Task

const createTaskRequest: protos.google.cloud.tasks.v2.ICreateTaskRequest = {
  parent: client.queuePath('your-project', 'us-central1', 'your-queue'),
  task: {
    httpRequest: {
      url: 'https://your-app.com/handler',
      httpMethod: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({ data: 'example' })
    },
    scheduleTime: new Date(Date.now() + 60000).toISOString() // 1 minute from now
  },
  responseView: 'BASIC'
};

const [task] = await client.createTask(createTaskRequest);
console.log('Created task:', task.name);

Getting a Task

const getTaskRequest: protos.google.cloud.tasks.v2.IGetTaskRequest = {
  name: 'projects/your-project/locations/us-central1/queues/your-queue/tasks/task-id',
  responseView: 'FULL'
};

const [task] = await client.getTask(getTaskRequest);
console.log('Task details:', task);

Listing Tasks

const listTasksRequest: protos.google.cloud.tasks.v2.IListTasksRequest = {
  parent: client.queuePath('your-project', 'us-central1', 'your-queue'),
  responseView: 'BASIC',
  pageSize: 100
};

const [tasks] = await client.listTasks(listTasksRequest);
console.log('Tasks:', tasks);

Queue Management

// Get queue
const getQueueRequest: protos.google.cloud.tasks.v2.IGetQueueRequest = {
  name: client.queuePath('your-project', 'us-central1', 'your-queue')
};
const [queue] = await client.getQueue(getQueueRequest);

// Pause queue
const pauseQueueRequest: protos.google.cloud.tasks.v2.IPauseQueueRequest = {
  name: client.queuePath('your-project', 'us-central1', 'your-queue')
};
await client.pauseQueue(pauseQueueRequest);

// Resume queue
const resumeQueueRequest: protos.google.cloud.tasks.v2.IResumeQueueRequest = {
  name: client.queuePath('your-project', 'us-central1', 'your-queue')
};
await client.resumeQueue(resumeQueueRequest);

API Reference

CloudTasksClient

Constructor options:

  • projectId: Google Cloud Project ID
  • location: Default location (e.g., 'us-central1')
  • credentials.accessToken: OAuth 2.0 access token
  • baseURL: API base URL (default: 'https://cloudtasks.googleapis.com')

Methods

Task Management

  • createTask(request): Create a new task
  • getTask(request): Get task details
  • deleteTask(request): Delete a task
  • listTasks(request): List tasks in a queue

Queue Management

  • getQueue(request): Get queue details
  • createQueue(request): Create a new queue
  • updateQueue(request): Update queue configuration
  • deleteQueue(request): Delete a queue
  • purgeQueue(request): Purge all tasks from queue
  • pauseQueue(request): Pause task dispatching
  • resumeQueue(request): Resume task dispatching
  • listQueues(request): List queues in a location

Path Helpers

  • locationPath(project, location): Generate location path
  • queuePath(project, location, queue): Generate queue path
  • taskPath(project, location, queue, task): Generate task path

Authentication

This library requires a valid OAuth 2.0 access token. You can obtain one using:

  • Google Cloud SDK: gcloud auth print-access-token
  • Service Account JSON key with appropriate Cloud Tasks permissions
  • Application Default Credentials in supported environments

Edge Runtime Support

This library is designed to work in Edge Runtime environments including:

  • Cloudflare Workers
  • Vercel Edge Functions
  • Next.js Edge Runtime
  • Deno Deploy