Skip to content

Latest commit

 

History

History
228 lines (139 loc) · 8.83 KB

File metadata and controls

228 lines (139 loc) · 8.83 KB

@zarrita/storage

0.2.0

Minor Changes

  • Add custom fetch option to FetchStore. Accepts a WinterTC-style fetch handler (Request in, Response out) to cover the long tail of things users need at the fetch level. Deprecates overrides. (#388)

    Presigning a URL:

    const store = new FetchStore("https://my-bucket.s3.amazonaws.com/data.zarr", {
      async fetch(request) {
        const newUrl = await presign(request.url);
        return fetch(new Request(newUrl, request));
      },
    });

    Remapping response status codes:

    const store = new FetchStore("https://my-bucket.s3.amazonaws.com/data.zarr", {
      async fetch(request) {
        const response = await fetch(request);
        if (response.status === 403) {
          return new Response(null, { status: 404 });
        }
        return response;
      },
    });

    Migrating from overrides

    overrides only supported static RequestInit properties. For anything dynamic (like refreshing a token), you had to thread it through every call site:

    const store = new FetchStore("https://example.com/data.zarr");
    const arr = await zarr.open(store);
    
    // token logic leaks into every get call
    let chunk = await zarr.get(arr, null, {
      opts: { headers: { Authorization: `Bearer ${await getAccessToken()}` } },
    });

    With fetch, auth is configured once on the store and every request picks it up:

    const store = new FetchStore("https://example.com/data.zarr", {
      async fetch(request) {
        const token = await getAccessToken();
        request.headers.set("Authorization", `Bearer ${token}`);
        return fetch(request);
      },
    });
    const arr = await zarr.open(store);
    
    // call sites don't need to know about auth
    let chunk = await zarr.get(arr);
  • ReferenceStore now uses FetchStore internally and accepts the same fetch option. The default fetch handler translates s3://, gs://, and gcs:// URIs to HTTPS, but you can provide your own to add auth or handle other protocols: (#389)

    const store = await ReferenceStore.fromUrl("https://example.com/refs.json", {
      async fetch(request) {
        // translate s3:// and gs:// URIs to HTTPS
        const url = ReferenceStore.resolveUri(request.url);
        const req = new Request(url, request);
        req.headers.set("Authorization", `Bearer ${await getToken()}`);
        return fetch(req);
      },
    });

Patch Changes

  • Enable declarationMap so "go to definition" resolves to .ts source instead of .d.ts files (#361)

  • Upgrade unzipit from 1.4.3 to 2.0.0 (#386)

0.1.4

Patch Changes

  • Add getRange() to ZipFileStore for sharding support (#337)

    Enables reading sharded arrays from zip files by implementing partial byte-range reads. Uncompressed entries support true partial reads; compressed entries fall back to reading the full entry and slicing.

0.1.3

Patch Changes

  • Fix handling of paths with spaces in Zarr stores (a06a7e6)

    Paths containing spaces or other special characters in Zarr stores were not being resolved correctly. The internal use of the URL for path resolution was inadvertently exposing URL-encoded paths (e.g., converting spaces to %20), preventing stores from finding entries with these characters.

    This fix ensures paths are properly decoded after resolution, allowing Zarr arrays and groups with spaces in their names to be accessed correctly in both ZipFileStore and consolidated metadata.

0.1.2

Patch Changes

  • Add a transformEntries option for the ZipFileStore, to allow for transformation of internal zip paths (e.g., to remove a root folder). (#294)

0.1.1

Patch Changes

0.1.0

Minor Changes

  • fix(storage): Rename storage type Writeable to Writable (#114)

Patch Changes

  • Fix TypedArray types for TypeScript < 5.7 (#239)

    TypeScript changed the typing behavior of all TypedArray objects to now be generic over the underlying ArrayBufferLike type. In order to have our types be consistent with these changes, we needed to specify the ArrayBuffer explicitly, but that breaks for older versions of TypeScript. This PR fixes the version of TypeScript to 5.6. We will need to bump again when we want to support 5.7.

  • Use a counter to prioritize v2/v3 when opening. (#109)

  • Remove use of public any from API in favor of unknown (#173)

  • Consolidate @zarrita/core into zarrita (#269)

  • Add default generic paramter to ZipFileStore (#248)

  • FetchStore throws an error for 403 (forbidden) responses. This is a breaking change because previously 404 and 403 responses were treated the same way. Now, only 404 responses signify a "missing" key from the store. (#212)

  • Add support for passing fetch options to ReferenceStore. (#155)

0.1.0-next.10

Patch Changes

  • Consolidate @zarrita/core into zarrita (#269)

0.1.0-next.9

Patch Changes

  • Add default generic paramter to ZipFileStore (#248)

0.1.0-next.8

Patch Changes

  • Fix TypedArray types for TypeScript < 5.7 (#239)

    TypeScript changed the typing behavior of all TypedArray objects to now be generic over the underlying ArrayBufferLike type. In order to have our types be consistent with these changes, we needed to specify the ArrayBuffer explicitly, but that breaks for older versions of TypeScript. This PR fixes the version of TypeScript to 5.6. We will need to bump again when we want to support 5.7.

0.1.0-next.7

Patch Changes

  • FetchStore throws an error for 403 (forbidden) responses. This is a breaking change because previously 404 and 403 responses were treated the same way. Now, only 404 responses signify a "missing" key from the store. (#212)

0.1.0-next.6

Patch Changes

  • Enable creation of ReferenceStore via non-async functions. (#203)

0.1.0-next.5

Patch Changes

  • Remove use of public any from API in favor of unknown (#173)

0.1.0-next.4

Patch Changes

  • Add support for passing fetch options to ReferenceStore. (#155)

  • Add support for passing fetch options to ZipFileStore.fromUrl. (#156)

0.1.0-next.3

Minor Changes

  • fix(storage): Rename storage type Writeable to Writable (#114)

0.1.0-next.2

Patch Changes

  • Use a counter to prioritize v2/v3 when opening. (#109)

0.1.0-next.1

Patch Changes

  • Add licenses and READMES to packages (#107)

0.1.0-next.0

Minor Changes

  • chore: prepare preleases (fa43aff)

0.0.2

Patch Changes

  • feat: Support partial reads from Readable (#93)

    Introduces the Readable.getRange method, which can be optionally implemented by a store to support partial reads. The RangeQuery param is inspired by the HTTP Range header. Allowing the suffixLength query means the store can decide the best way to return the final N bytes from a file.

    const store = new FetchStore("http://localhost:8080/data.zarr");
    await store.getRange("/foo.json", { suffixLength: 100 });
    await store.getRange("/foo.json", { offset: 10, length: 20 });

0.0.1

Patch Changes

  • feat: allow RequestInit options to be configured in FetchStore constructor (#77)