Skip to content

files-sdk@2.0.0

Latest

Choose a tag to compare

@github-actions github-actions released this 21 Jun 20:21
· 2 commits to main since this release
Immutable release. Only release title and notes can be modified.
5ee636a

Major Changes

  • 2b81046: Release files-sdk 2.0 — the full-stack release. Alongside the core Files API, the SDK now reaches the browser with framework client bindings (files-sdk/react, files-sdk/vue, files-sdk/svelte), a server gateway (files-sdk/api) with route handlers for Next.js, Hono, Express, Fastify, Koa, Elysia, Nitro, SvelteKit, Astro, Bun, and Deno, and a shadcn UI component registry wired to the useFiles hook. See the accompanying changesets for the full surface.

Minor Changes

  • 58757d7: Add an Archil adapter (files-sdk/archil) for Archil disks over their S3-compatible API. The disk id is the path-style bucket and the endpoint is derived from the Archil region; SigV4 enables byte ranges, multipart, and presigned URLs. Supports a branch option (branch-scoped access) and an optional disk instance exposed at adapter.disk for Archil-native operations.
  • 31c9c3f: Add files-sdk/apicreateFilesRouter, a server gateway exposing the whole Files verb set (upload, download, head, exists, list, search, url, delete, copy, move, capabilities, signed upload URLs) over a single endpoint, with deny-by-default per-operation authorize (throw to deny, return a key-prefix/expiry/read-only constraint), redirect-or-proxy streaming downloads (Range/206 + client-disconnect abort), keyless presign→complete uploads with a proxy fallback, HMAC round-trip tokens, and an origin allowlist.
  • 91d20ef: Add files-sdk/astrocreateRouteHandler(router) returns { GET, POST, PUT } for an Astro endpoint (GET serves downloads, POST the JSON verbs, PUT the upload byte path). The handlers are Web-native, so the route runs on Node and edge adapters alike. The endpoint must run per-request: set prerender = false (or output: "server") with an SSR adapter.
  • 31c9c3f: Add files-sdk/clientcreateFilesClient, a framework-agnostic verb client for the gateway; download returns the same lazy StoredFile the server SDK returns.
  • 31c9c3f: Add files-sdk/expresscreateRouteHandler(router) returns a Node (req, res) handler that bridges IncomingMessage/ServerResponse to the Web Request/Response the gateway speaks (also works with Connect and a raw http.createServer). A client disconnect aborts the upstream read on a proxied download. Mount it before any body parser so the gateway can read the raw upload/JSON body.
  • 91d20ef: Add files-sdk/fastifycreateRouteHandler(router) returns a Fastify (request, reply) handler that reply.hijack()s and bridges the raw IncomingMessage/ServerResponse to the Web Request/Response the gateway speaks (the same seam as files-sdk/express). A client disconnect aborts the upstream read on a proxied download. Drop Fastify's built-in body parsers (removeAllContentTypeParsers() + a no-op addContentTypeParser("*", …)) so the gateway can read the raw upload/JSON body.
  • 31c9c3f: Add files-sdk/honocreateRouteHandler(router) returns a single Hono handler (app.all("/api/files", handler)). Web-native, so it runs on Workers, Bun, Deno, and Node.
  • 91d20ef: Add files-sdk/koacreateRouteHandler(router) returns a Koa handler that sets ctx.respond = false and bridges ctx.req/ctx.res to the Web Request/Response the gateway speaks (the same seam as files-sdk/express). A client disconnect aborts the upstream read on a proxied download. Mount it before any body parser so the gateway can read the raw upload/JSON body.
  • 31c9c3f: Add files-sdk/nextcreateRouteHandler to mount the gateway in the Next.js App Router.
  • 91d20ef: Add files-sdk/nitrocreateRouteHandler(router) returns an h3 event handler for Nitro (and Nuxt server) routes that marshals event.node.req into the Web Request the gateway speaks and returns the Web Response for Nitro to flush, hiding the toWebRequest(event) step. A client disconnect aborts the upstream read on a proxied download. Targets Nitro v2 / h3 v1, where event.node.req is present on every preset.
  • 9923947: Expose the versioning() and softDelete() plugin verbs through the gateway, client and useFiles hook. createFilesRouter now dispatches versions / restoreVersion / trashed / restoreTrashed / purge (each a new deny-by-default FilesOperation, answered only when the matching plugin wraps the Files instance — otherwise a 422), and createFilesClient / useFiles gain matching methods (files.versions(key), files.restoreVersion(key, versionId?), files.trashed(), files.restoreTrashed(key), files.purge(key?)). Trash listing and "empty trash" are key-prefix-scoped, so a multi-tenant authorize keyPrefix never leaks or purges another tenant's trash.
  • 31c9c3f: Add files-sdk/reactuseFiles({ endpoint }) returning every verb (imperative, with ambient upload progress/error) plus optional reactive useList/useFile/useSearch hooks. Emitted as a "use client" module.
  • 31c9c3f: Add files-sdk/svelte — the Svelte binding: useFiles returning Svelte stores for the ambient state, plus useList/useFile/useSearch query stores. Store-based (no Svelte runtime dependency).
  • 91d20ef: Add files-sdk/sveltekitcreateRouteHandler(router) returns { GET, POST, PUT } for a SvelteKit +server.ts endpoint (GET serves downloads, POST the JSON verbs, PUT the upload byte path). The handlers are Web-native, so the route runs on the Node and edge adapters alike. This is the server binding, distinct from the files-sdk/svelte client store.
  • b20440c: Add a shadcn component registry of useFiles-wired UI, installable with npx shadcn add. Upload + display: dropzone, file-list, file-preview, upload-progress, multipart-uploader. Navigation + actions: file-browser (folder tree via list({ delimiter }) + breadcrumbs), file-search (search() with glob/regex/substring/exact), share-dialog (url() / signedUploadUrl() with expiry + copy), file-actions (copy/move/rename/download/delete menu), capabilities-badges (capabilities() as feature badges). Plugin showcases: version-history (versioning() — list + restore snapshots) and trash-bin (softDelete() — restore + purge soft-deleted files). The components ship in the docs site rather than the package, but they're a first-class part of the SDK surface.
  • 31c9c3f: Add files-sdk/vue — the Vue 3 twin of the React hook: a useFiles composable returning refs for the ambient state, plus reactive useList/useFile/useSearch composables over the same gateway.