@openpromo/sdk-runtime
v0.13.0
Published
Shared runtime primitives for @openpromo ad platform SDKs — fetch-based HttpClient, cursor pagination, rate limiter, retry.
Maintainers
Readme
@openpromo/sdk-runtime
Shared runtime primitives for the Mosaic ad platform SDKs.
Powering openpromo.app — the AI-native social media workspace.
What
The low-level building blocks shared by every @openpromo/* package: a fetch-based HttpClient for JSON/Bearer APIs, cursor pagination, retry with exponential backoff, and pluggable rate limiting. Runtime-agnostic — works in Bun, Node, Deno, and edge.
You don't install this directly. It's a transitive dependency of the platform SDKs.
What's inside
HttpClient— JSON POST/GET/DELETE with pluggable header builder, retry, rate limiter hooksApiClient— the original Meta-shaped client (form-encoded POST,access_tokenquery)Cursor— generic async-iterable pagination adapterRateLimiter/DelayFn— runtime-agnostic throttling interfacesApiError— base error typeAllPlatforms— canonical cross-platform identifiers with a Valibot schema- OAuth runtime contracts — normalized token sets, state/PKCE helpers, and typed adapter errors
OAuth adapters can bind their requested scopes to a provider-specific union. Inline scope literals
are checked against that catalog; broad string[] values remain accepted for legacy integrations.
Use the shared helper when a provider adds a permission before this SDK publishes an updated catalog;
scopes returned by the provider remain raw strings for forward compatibility.
import { customOAuthScope } from "@openpromo/sdk-runtime";
import { FacebookOAuthScopes } from "@openpromo/meta";
const requested = [
FacebookOAuthScopes.PagesShowList,
customOAuthScope("pages_future_permission"),
] as const;OAuth and platform contracts are also available from the small leaf exports
@openpromo/sdk-runtime/oauth and @openpromo/sdk-runtime/platforms.
Used by
License
MIT © OpenPromo
