8.4 KiB
8.4 KiB
@suaveplan/storage-cdn-rackspace - Rackspace Cloud Files (OpenStack Swift) origin + Rackspace CDN provider for @suaveplan/storage-cdn. v2 identity auth with proactive token refresh, service-catalog endpoint lookup (LON/IAD/DFW/ORD/SYD/HKG), HMAC-SHA1 TempURL signing, CDN purge, Range reads, native streaming, full AbortSignal threading, Retry-After honoured, OTel surface with provider+region attributes.
Rackspace Cloud Files (OpenStack Swift) origin + Rackspace CDN provider for @suaveplan/storage-cdn. Full AbstractStorage and CdnAdapter surface — get/set/delete/exists/getMetadata/getPartial/createReadStream/createWriteStream/getSize against Cloud Files, plus purge/signUrl/edgeUrl against the Rackspace CDN. v2 identity auth with proactive token refresh, service-catalog endpoint lookup (LON/IAD/DFW/ORD/SYD/HKG), HMAC-SHA1 TempURL signing, transient-status retry honouring Retry-After, full OTel surface with provider="rackspace" and region attributes.
Documentation tree
- auth-client —
RackspaceAuthClientwraps Rackspace identity v2 (POST /v2.0/tokens) with the three behaviours every consumer of the…- auth-client —
RackspaceAuthClientwraps Rackspace identity v2 (POST /v2.0/tokens) with the three behaviours every consumer of the…
- auth-client —
- cdn-client — Wraps the two Rackspace CDN management operations the adapter actually needs at runtime:
getCdnMetadata(HEAD on the…- cdn-client — Wraps the two Rackspace CDN management operations the adapter actually needs at runtime:
getCdnMetadata(HEAD on the…
- cdn-client — Wraps the two Rackspace CDN management operations the adapter actually needs at runtime:
- error-codes — Declares the canonical
STORAGE_CDN_RACKSPACEerror namespace used by every module in this package. Codes are produced…- error-codes — Declares the canonical
STORAGE_CDN_RACKSPACEerror namespace used by every module in this package. Codes are produced…
- error-codes — Declares the canonical
- key-sanitizer — Validates and normalises caller-supplied storage keys before any fetch is issued against Rackspace Cloud Files, and pro…
- key-sanitizer — Validates and normalises caller-supplied storage keys before any fetch is issued against Rackspace Cloud Files, and pro…
- otel — Owns the OpenTelemetry instrument set for
@suaveplan/storage-cdn-rackspace: counters (reads_total,writes_total,…- otel — Owns the OpenTelemetry instrument set for
@suaveplan/storage-cdn-rackspace: counters (reads_total,writes_total,…
- otel — Owns the OpenTelemetry instrument set for
- rackspace-cdn-adapter —
RackspaceCdnAdapteris the concreteCdnAdapterimplementation that binds@suaveplan/storage'sAbstractStoragec…- rackspace-cdn-adapter.base —
RackspaceCdnAdapterBasecarries the shared internal machinery everyRackspaceCdnAdapterinstance needs: the resolve… - rackspace-cdn-adapter.cdn-methods — Houses the CDN-side method implementations consumed by
RackspaceCdnAdapter:getSize(viafetchContainerSize), `pu… - rackspace-cdn-adapter.helpers — Internal helpers used by
RackspaceCdnAdapterand its sibling ops/streams modules. Splits boundary concerns (option pa… - rackspace-cdn-adapter —
RackspaceCdnAdapteris the concreteCdnAdapterimplementation that binds@suaveplan/storage'sAbstractStoragec… - rackspace-cdn-adapter.ops — Reusable Cloud Files HTTP operations used by
RackspaceCdnAdapter: object GET (objectGet), HEAD (objectHead), PUT… - rackspace-cdn-adapter.streams — Builds the
ReadableStreamandWritableStreaminstancesRackspaceCdnAdapterreturns fromcreateReadStream/ `cre…
- rackspace-cdn-adapter.base —
- registry — Module-augments
@suaveplan/storage/factory'sStorageProviderRegistryandStorageProviderConfigto add the `"racks…- registry — Module-augments
@suaveplan/storage/factory'sStorageProviderRegistryandStorageProviderConfigto add the `"racks…
- registry — Module-augments
- retry-helper — Coordinates retry logic for HTTP requests against Rackspace Cloud Files and the Rackspace CDN management API. Distingui…
- retry-helper — Coordinates retry logic for HTTP requests against Rackspace Cloud Files and the Rackspace CDN management API. Distingui…
- temp-url — Computes Swift TempURL signatures for short-lived signed URLs against Rackspace Cloud Files. The OpenStack Swift TempUR…
- temp-url — Computes Swift TempURL signatures for short-lived signed URLs against Rackspace Cloud Files. The OpenStack Swift TempUR…
Install
bun add @suaveplan/storage-cdn-rackspace
Quick start
import { RackspaceCdnAdapter } from "@suaveplan/storage-cdn-rackspace";
const storage = new RackspaceCdnAdapter({
originBaseUrl: "https://storage101.lon3.clouddrive.com/v1/AUTH_acc/",
edgeBaseUrl: "https://abc.r88.cf6.rackcdn.com/",
username: process.env["RAX_USER"]!,
apiKey: process.env["RAX_KEY"]!,
region: "LON",
container: "myc",
tempUrlKey: process.env["RAX_TEMPURL_KEY"]!,
});
await storage.set("photos/a.jpg", bytes);
await storage.purge("photos/a.jpg");
const signed = await storage.signUrl("photos/a.jpg", { ttlSeconds: 300, method: "GET" });
Factory registration
import { registerRackspaceCdnProvider } from "@suaveplan/storage-cdn-rackspace";
import { createStorage } from "@suaveplan/storage/factory";
registerRackspaceCdnProvider();
const storage = createStorage({ type: "rackspace-cdn", config });
Modules
- error-codes —
STORAGE_CDN_RACKSPACE_CODESregistry +StorageCdnRackspaceError. - constants — region whitelist, default auth URL, retry defaults.
- auth-client — v2 identity auth, token cache, service-catalog lookup, proactive refresh.
- cdn-client —
getCdnMetadata,purgeObject. - temp-url — HMAC-SHA1 TempURL signer via WebCrypto.
- key-sanitizer — strict key validation + per-segment encoder.
- retry-helper — transient classifier +
Retry-Afterhonour. - otel — meters, histograms, counters, tracer.
- rackspace-cdn-adapter — the main
RackspaceCdnAdapterclass. - registry — module-augmentation slot for
createStorage({ type: "rackspace-cdn", ... }).
Capabilities matrix
{
partialReads: true,
partialWrites: false,
nativeStreams: true,
atomicWrites: false,
contentAddressable: false,
cdn: {
cdnPurge: true,
cdnPrefixPurge: false,
cdnSignedUrls: true,
cdnOriginUploads: true,
},
}
Features
- Universal purity — no
node:*or DOM-only imports. - Full Cloud Files surface — origin GET/PUT/DELETE/HEAD with Range, native streaming, AbortSignal.
- CDN integration — purge, signed (TempURL) URLs, edge URL composition.
- Proactive auth refresh — token re-issued five minutes before expiry; concurrent calls deduplicated.
- Service-catalog endpoint resolution — works against any region in the LON/IAD/DFW/ORD/SYD/HKG set; misconfigured region surfaces as
STORAGE_CDN_RACKSPACE.REGION_NOT_IN_CATALOG. - Retry on transient outcomes —
408/425/429/5xxretried withRetry-Afterhonoured. - OTel built-in —
storage_cdn_rackspace.*instruments withprovider="rackspace"andregionattributes for cross-provider dashboards. - 100 / 100 / 100 / 100 Istanbul coverage.
License
MIT — see LICENSE at the repo root.