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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@crowdin/apps-storage

v0.31.0

Published

Transport-agnostic client for the Crowdin App Storage REST API: the data an installed Crowdin app keeps on the Crowdin side.

Readme

Crowdin Apps Storage

npm npm

Transport-agnostic client for the Crowdin App Storage REST API (/api/v2/applications/{applicationIdentifier}/storage): the data an installed Crowdin app keeps on the Crowdin side. The key-value space (kv) is shared by all members of an app installation, with private per-user records under the reserved user:{id}: prefix, module-scoped records under the reserved module:{moduleKey}: prefix, and secret values encrypted at rest.

This package is the shared core of two SDK integrations - if you use either, you do not need it directly: @crowdin/serverless-apps-sdk/storage wires it to the Crowdin host bridge, and @crowdin/app-project-module exposes it as crowdinApp.crowdinStorage(crowdinId). Use this package directly only when you need a custom transport.

Installation

npm install @crowdin/apps-storage

The package has no runtime dependencies.

Usage

import { createStorage } from "@crowdin/apps-storage";
import type { StorageRequest, StorageResponse } from "@crowdin/apps-storage";

async function transport(request: StorageRequest): Promise<StorageResponse> {
  const query = request.query ? `?${new URLSearchParams(request.query)}` : "";
  const url = `https://api.crowdin.com/api/v2/applications/my-app/storage/${request.path}${query}`;
  const res = await fetch(url, {
    method: request.method,
    headers: {
      Authorization: `Bearer ${token}`,
      "Content-Type": "application/json",
    },
    body: request.body === undefined ? undefined : JSON.stringify(request.body),
  });
  const text = await res.text();
  return {
    status: res.status,
    statusText: res.statusText,
    body: text === "" ? undefined : JSON.parse(text),
  };
}

const { kv } = createStorage({ transport, getUserId: () => "77" });

await kv.set("welcome-message", { text: "Hi!" });
const message = await kv.get<{ text: string }>("welcome-message");
await kv.user.set("gh-token", token, { secret: true });
const page = await kv.list({ prefix: "cfg_", limit: 100 });
const everything = await kv.withFetchAll().list();

Semantics

  • set defaults to keyPolicy: "OVERRIDE": it POSTs first and on 409 falls back to a JSON Patch replace of /value (plus /ttl when ttl was passed - the stored TTL stays untouched otherwise). keyPolicy: "FAIL_IF_EXISTS" throws KeyExistsError on 409 instead. Clearing a TTL is not possible through set; delete and re-create the key instead.
  • secret applies only when the key is created; overriding an existing key never changes its secret flag.
  • get and getWithMetadata resolve undefined on 404; delete is idempotent - deleting a missing key resolves.
  • kv.user.* prefixes every key with user:{id}: (the caller identity from getUserId) and strips that prefix from listed keys, so keys always read the way you wrote them.
  • A key under module:{moduleKey}: scopes the record to that app module's surface: it exists only where the app runs as that module (the app's own token and the app's installer are not narrowed by module prefixes), listings skip the rest, and the API rejects set under a module key other than the current surface's (or an unknown one). Key positions are typed as KvKey, so editors suggest the module: prefix; enumerate the app's module keys in the optional type parameter (createStorage<"main" | "reports">(...)) and they suggest the full module:{moduleKey}: prefixes instead, while any other key stays accepted.
  • list accepts prefix, orderBy, limit, and offset; orderBy takes the REST sort format (key, createdAt, updatedAt, expiresAt, each optionally followed by desc, comma-separated - e.g. "updatedAt desc,key"), and without it records come in a stable insertion order (oldest first) - a stable base order for offset paging.
  • withFetchAll(maxAmount?) returns a copy of the scope whose list walks all pages sequentially (500 entries per request) up to maxAmount; the caller's limit and offset are ignored in that mode, the prefix and orderBy are honored.

Errors

Non-2xx responses outside the special cases above reject with StorageApiError carrying status and the parsed Crowdin error payload. A status: 0 response (transport failure) is also a StorageApiError - it is never treated as a missing key or a conflict.

Transport contract

createStorage({ transport, getUserId }):

  • transport(request) receives { method, path, query?, body? } where path is relative to the storage root - kv/records or kv/records/{urlencoded-key}. Prepend applications/{applicationIdentifier}/storage/ and your API origin, serialize query into the URL, and resolve the raw HTTP response { status, statusText?, body? } without throwing on non-2xx statuses.
  • getUserId() returns the current user id for kv.user.* (a plain string or a promise of one). It is invoked lazily and awaited on every user-scoped operation and may throw when there is no authenticated user; when the option is omitted, any kv.user.* call rejects.

Limits

Enforced server-side: a key is 1..500 characters matching ^[a-zA-Z0-9:._-]+$, a value is up to 240 KiB of serialized JSON, a TTL is 60..31536000 seconds. A user:{id}: key prefix is reserved for the user with that id; a module:{moduleKey}: prefix is reserved for records scoped to that module; a key that starts with either reserved word but does not match the full prefix shape is rejected.

License

MIT