Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@firebase/functions-types

Package Overview
Dependencies
Maintainers
3
Versions
3026
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@firebase/functions-types

@firebase/functions Types

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2M
increased by6.47%
Maintainers
3
Weekly downloads
 
Created

What is @firebase/functions-types?

@firebase/functions-types is a TypeScript type definition package for Firebase Cloud Functions. It provides type definitions for interacting with Firebase Cloud Functions, enabling developers to write type-safe code when working with Firebase's serverless functions.

What are @firebase/functions-types's main functionalities?

Callable Functions

This feature allows you to define and call HTTPS callable functions from your client app. The code sample demonstrates how to call a function named 'addMessage' and handle the response.

import { HttpsCallable } from '@firebase/functions-types';

const addMessage: HttpsCallable = functions.httpsCallable('addMessage');
addMessage({ text: 'Hello, World!' })
  .then(result => {
    console.log(result.data);
  })
  .catch(error => {
    console.error('Error:', error);
  });

Background Functions

This feature allows you to define background functions that trigger on specific events, such as user creation. The code sample shows how to create a function that triggers when a new user is created.

import { EventContext } from '@firebase/functions-types';

export const onUserCreate = functions.auth.user().onCreate((user, context: EventContext) => {
  console.log('New user created:', user.uid);
});

HTTP Functions

This feature allows you to define HTTP functions that respond to HTTP requests. The code sample demonstrates how to create a simple HTTP function that responds with 'Hello, World!'.

import { Request, Response } from '@firebase/functions-types';

export const helloWorld = functions.https.onRequest((req: Request, res: Response) => {
  res.send('Hello, World!');
});

Other packages similar to @firebase/functions-types

FAQs

Package last updated on 20 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc