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

@bss-sbc/shopify-rest-api-rate-limiter

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bss-sbc/shopify-rest-api-rate-limiter

README.md

  • 1.0.6
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Shopify REST API Rate Limiter

From: BSS Group > BSS Commerce > Division Shopify/Blockchain

API References

  • BucketManager: Manage Token bucket rate limiter of active store

    • initializeAll: (activeStores: Shop[]) => number;: Initialize rate limiter for all given stores

    • initializeOne: (domain: string) => TokenBucketRateLimiter: Initialize rate limiter for specific domain

    • get: (domain: string) => TokenBucketRateLimiter: Get initialized rate limiter of a specific domain

    • clear: (domain: string) => void: Clear rate limiter of a specific domain, used when app is uninstalled

  • safeFetch: (domain: string, url: RequestInfo, params?: RequestInit) => Promise<Response>: use this instead of normal fetch, with additional parameter domain, which specify a store.

Example

// To bulk initialize
const shops = [
    { id: 1, domain: 'dev-mida-dean.myshopify.com' },
    { id: 2, domain: 'dev-mida-store.myshopify.com' },
]
const intialized = BucketManager.initializeAll(shops);

// To initialize
BucketManager.initializeOne({
    id: 1,
    domain: 'dev-mida-dean.myshopify.com',
});

// To get specific bucket
const bucket = BucketManager.get('dev-mida-dean.myshopify.com');

// To clean up specific bucket
BucketManager.clear('dev-mida-dean.myshopify.com');

// Auto initialize bucket,
// using safeFetch
const response = await safeFetch(domain, url, params);

Roadmap

Because of numbers of microservices, it is difficult to listen to app/uninstalled webhook event. So, auto clear bucket is necessary

FAQs

Package last updated on 03 Apr 2023

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