0.3.0 • Published 10h ago
@scaleflex/dam-core
Licence
MIT
Version
0.3.0
Deps
0
Size
390 kB
Vulns
0
Weekly
0
@scaleflex/dam-core
Headless, framework-agnostic foundation for the Scaleflex DAM widgets. No UI, no Lit, no React — Fetch API only. Everything every widget needs to talk to the Filerobot DAM backend, in one place, so it isn't reimplemented (and allowed to drift) per widget.
What's inside
auth/—resolveAuth,normalizeAuth,exchangeSassKey,buildAuthHeaders,getApiBase, and theAuthConfigunion. Accepts the canonical (container) shape and asset-picker's historical (projectToken) shape, normalizing the latter. Seeplan/05+plan/11.api/—DamClient+folders/files/labelsservices.types/—Asset,Folder,Label, and API response envelopes.store/— headless observableBrowseStore+FavouritesAdapter/LocalFavouritesAdapter.helpers/— CDN / thumbnail URL builders.
Usage
import { resolveAuth, DamClient } from '@scaleflex/dam-core';
// Canonical shape (light-dam / uploader):
const resolved = await resolveAuth({ mode: 'sass-key', container: 'akli', sassKey: 'K' });
// asset-picker shape is accepted too and normalized automatically:
await resolveAuth({ mode: 'sassKey', projectToken: 'akli', sassKey: 'K' });Conventions
This is the bottom of the dependency graph: it imports nothing internal. Keep it that way. Domain types here are the contract every widget shares — change them deliberately.