@glidecms/connect-sdk
v2.1.1
Published
TypeScript SDK for the Glide Connect content delivery API. Read-only access to published articles, taxonomies, collections, images, and all CMS content types.
Downloads
13,787
Keywords
Readme
@glidecms/connect-sdk
TypeScript SDK for the Glide Connect content delivery API. Read-only access to published articles, taxonomies, collections, images, and all CMS content types.
Zero runtime dependencies. Native fetch. Typed errors. Optional LRU caching. Schema auto-discovery.
Install
npm install @glidecms/connect-sdkRequires Node.js >= 22.
Quick start
import { Client } from '@glidecms/connect-sdk';
const sdk = new Client({
apiUrl: 'https://connect.your-tenant.gcpp.io/v1',
apiKey: 'your-api-key',
});
const articles = await sdk.article.list();
const taxonomy = await sdk.taxonomy.getById(42);API surface
26 clients — all flat on the sdk object:
accessBundle, article, author, articleType, changeHistory, collection, collectionType, contentPanel, contentTag, customFieldGroup, file, gallery, glideEntity, image, liveReport, liveReportType, page, redirect, route, settings, siteConfig, taxonomy, taxonomyConfiguration, template, widgetData, widgetType
Plus sdk.schema for auto-discovery of article types, taxonomies, authors, collection types, and custom field groups.
Client methods
Every client extends BaseClient<T> and provides:
| Method | Returns | Description |
|---|---|---|
| getById(id) | Promise<T> | Fetch a single item by ID |
| getByIds(ids) | AsyncGenerator<T[]> | Batch fetch by IDs (yields batches of 50) |
| list(opts?) | Promise<T[]> | Fetch items matching query |
| listWithMeta(opts?) | Promise<ListResult<T>> | Fetch items with total count and metadata |
| listAll(opts?) | AsyncGenerator<T[]> | Iterate all items across all pages |
| aggregate(opts) | Promise<AggregateResult<T>> | Run aggregation queries |
| paginate(opts?, pageSize?) | Paginator<T> | Manual page-by-page iteration |
| waitFor(id, opts?) | Promise<T> | Poll until item exists and optional condition passes |
Some clients add resource-specific methods (e.g. ArticleClient.search(), LiveReportClient.getPosts()).
AI-assisted usage
For SDK selection, safe defaults, task-oriented method guidance, and mutation guardrails, see Agent guide.
Documentation
| | | |---|---| | Tutorial | Build your first Connect integration | | How-to guides | Filtering, search, pagination, caching, logging, query builder, schema, error handling, retry, waitFor, utilities | | API reference | Full method signatures for all clients, config, errors | | Migration notes | Async iteration and request option shape changes | | Agent guide | Agent/MCP usage guidance for read-only delivery workflows | | Agent readiness | Field resolution, query validation, capabilities, content helpers for MCP/CLI/agents |
Guarantees
- Request options.
signal,timeout,retry, andcacheare honored bygetById,list,listAll,fetchAll,paginate,aggregate, andwaitFor. - Timeouts. Default 30s. Per-request override via
opts.timeout. - Cancellation. All methods accept
AbortSignal. Aborted requests throw immediately without retry. - Retry. 5xx and network errors retried with exponential backoff. 4xx, aborts, and timeouts are never retried.
- Rate limiting. 429 responses throw
ConnectRateLimitErrorwithretryAfterpopulated from the response. - waitFor(). Polls with configurable timeout and interval. Each poll is capped to remaining time. Accepts
AbortSignal. Timeout error distinguishes "not found" from "condition not met". - listAll(). Signal, timeout, retry, and cache propagate through all internal pagination and probe requests, including date-window splitting for large datasets.
- Deduplication. Concurrent identical GETs without per-request opts share one fetch. GETs with opts always make independent requests.
