Socket
Socket
Sign inDemoInstall

@invertase/firestore-record-acknowledgements

Package Overview
Dependencies
0
Maintainers
3
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @invertase/firestore-record-acknowledgements

A JavaScript utility library for the Firebase Record Acknowledgements Extension.


Version published
Weekly downloads
22
increased by2100%
Maintainers
3
Created
Weekly downloads
 

Readme

Source

Firestore Record Acknowledgements Utilities

To assist with the usage of this Extension, a utility library exists to help provide a typed API interface for easily constructing operations to send to the API.

Installation

npm i --save @invertase/firestore-record-acknowledgements

To use this library, you must also have the firebase package installed and initialized before any usage.

Usage

The library exports a number of functions to assist sending the correct payloads to the correct extension endpoints, with fully typed responses. The user should be authenticated via the firebase/auth package before using any of the functions.

import { getNotice, acknowledgeNotice, unacknowledgeNotice, getAcknowledgments } from '@invertase/firestore-record-acknowledgements';

// ...

// Get a notice by ID (and optional version).
const notice = await getNotice({ type: 'banner', version: 2 });

// Acknowledge a notice by ID.
await acknowledgeNotice({ noticeId: '...', metadata: { ... } });

// Unacknowledge a notice by ID.
await unacknowledgeNotice({ noticeId: '...', metadata: { ... } });

// Get all acknowledgements for current user.
const acknowledgements = await getAcknowledgments({ includeUnacknowledgments: true });

Custom Functions Instance

If you need to provide a custom functions instance, you can provide an instance to the functions argument. This is useful if you wish to use a secondary app instance or change the region of the functions instance.

import { initializeApp } from 'firebase/app';
import { getFunctions } from 'firebase/functions';

const app = initializeApp({ ... });
const functions = getFunctions(app, 'europe-west1');

// Use the custom functions instance.
const notice = await getNotice({ functions, type: 'banner' });

Multiple Extension Instances

If you have multiple instances of the extension installed, you can provide the extensionId argument to the functions:

// Makes a request to the uniuque deployed extension.
const notice = await getNotice({ extensionId: '1234', type: 'banner' });

FAQs

Last updated on 03 Nov 2022

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc