icechunk-js 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -10
- package/dist/index.cjs +17 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +17 -38
- package/dist/index.js.map +1 -1
- package/package.json +10 -10
package/dist/index.d.cts
CHANGED
|
@@ -516,7 +516,7 @@ interface IcechunkStoreOptions {
|
|
|
516
516
|
* import { open, get } from 'zarrita';
|
|
517
517
|
*
|
|
518
518
|
* const store = await IcechunkStore.open('https://bucket.s3.amazonaws.com/repo');
|
|
519
|
-
* const array = await open(store, { kind: 'array'
|
|
519
|
+
* const array = await open(store.resolve('/temperature'), { kind: 'array' });
|
|
520
520
|
* const data = await get(array, [0, 0, null]);
|
|
521
521
|
* ```
|
|
522
522
|
*/
|
|
@@ -691,7 +691,7 @@ declare class Repository {
|
|
|
691
691
|
* version has the highest filename. Deletion tombstones are checked.
|
|
692
692
|
*
|
|
693
693
|
* When listing is not supported (e.g., HTTP storage), only the legacy
|
|
694
|
-
* ref.json path is
|
|
694
|
+
* ref.json path is returned (caller must handle NotFoundError on read).
|
|
695
695
|
*
|
|
696
696
|
* @param dirPrefix - Directory prefix to search
|
|
697
697
|
* @param legacyPath - Optional legacy ref.json path to try if listing fails
|
|
@@ -700,7 +700,9 @@ declare class Repository {
|
|
|
700
700
|
/**
|
|
701
701
|
* List all branches in the repository.
|
|
702
702
|
*
|
|
703
|
-
*
|
|
703
|
+
* Unlike tags, branches in icechunk v1 have no tombstone mechanism —
|
|
704
|
+
* deletion removes the ref file outright. A branch is present iff it has
|
|
705
|
+
* at least one ref file in its directory.
|
|
704
706
|
*
|
|
705
707
|
* @returns Array of branch names
|
|
706
708
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -516,7 +516,7 @@ interface IcechunkStoreOptions {
|
|
|
516
516
|
* import { open, get } from 'zarrita';
|
|
517
517
|
*
|
|
518
518
|
* const store = await IcechunkStore.open('https://bucket.s3.amazonaws.com/repo');
|
|
519
|
-
* const array = await open(store, { kind: 'array'
|
|
519
|
+
* const array = await open(store.resolve('/temperature'), { kind: 'array' });
|
|
520
520
|
* const data = await get(array, [0, 0, null]);
|
|
521
521
|
* ```
|
|
522
522
|
*/
|
|
@@ -691,7 +691,7 @@ declare class Repository {
|
|
|
691
691
|
* version has the highest filename. Deletion tombstones are checked.
|
|
692
692
|
*
|
|
693
693
|
* When listing is not supported (e.g., HTTP storage), only the legacy
|
|
694
|
-
* ref.json path is
|
|
694
|
+
* ref.json path is returned (caller must handle NotFoundError on read).
|
|
695
695
|
*
|
|
696
696
|
* @param dirPrefix - Directory prefix to search
|
|
697
697
|
* @param legacyPath - Optional legacy ref.json path to try if listing fails
|
|
@@ -700,7 +700,9 @@ declare class Repository {
|
|
|
700
700
|
/**
|
|
701
701
|
* List all branches in the repository.
|
|
702
702
|
*
|
|
703
|
-
*
|
|
703
|
+
* Unlike tags, branches in icechunk v1 have no tombstone mechanism —
|
|
704
|
+
* deletion removes the ref file outright. A branch is present iff it has
|
|
705
|
+
* at least one ref file in its directory.
|
|
704
706
|
*
|
|
705
707
|
* @returns Array of branch names
|
|
706
708
|
*/
|
package/dist/index.js
CHANGED
|
@@ -2743,7 +2743,7 @@ var Repository = class _Repository {
|
|
|
2743
2743
|
* version has the highest filename. Deletion tombstones are checked.
|
|
2744
2744
|
*
|
|
2745
2745
|
* When listing is not supported (e.g., HTTP storage), only the legacy
|
|
2746
|
-
* ref.json path is
|
|
2746
|
+
* ref.json path is returned (caller must handle NotFoundError on read).
|
|
2747
2747
|
*
|
|
2748
2748
|
* @param dirPrefix - Directory prefix to search
|
|
2749
2749
|
* @param legacyPath - Optional legacy ref.json path to try if listing fails
|
|
@@ -2779,7 +2779,9 @@ var Repository = class _Repository {
|
|
|
2779
2779
|
/**
|
|
2780
2780
|
* List all branches in the repository.
|
|
2781
2781
|
*
|
|
2782
|
-
*
|
|
2782
|
+
* Unlike tags, branches in icechunk v1 have no tombstone mechanism —
|
|
2783
|
+
* deletion removes the ref file outright. A branch is present iff it has
|
|
2784
|
+
* at least one ref file in its directory.
|
|
2783
2785
|
*
|
|
2784
2786
|
* @returns Array of branch names
|
|
2785
2787
|
*/
|
|
@@ -2788,49 +2790,23 @@ var Repository = class _Repository {
|
|
|
2788
2790
|
if (repoInfo) {
|
|
2789
2791
|
return listBranchesFromRepo(repoInfo);
|
|
2790
2792
|
}
|
|
2791
|
-
const
|
|
2793
|
+
const branches = /* @__PURE__ */ new Set();
|
|
2792
2794
|
try {
|
|
2793
2795
|
for await (const path of this.storage.listPrefix(
|
|
2794
2796
|
`${PATHS.REFS}/branch.`
|
|
2795
2797
|
)) {
|
|
2796
|
-
const
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
);
|
|
2800
|
-
if (deletedMatch) {
|
|
2801
|
-
const branchName = deletedMatch[1];
|
|
2802
|
-
const refFile = `refs/branch.${branchName}/${deletedMatch[2]}`;
|
|
2803
|
-
if (!branchFiles.has(branchName)) {
|
|
2804
|
-
branchFiles.set(branchName, {
|
|
2805
|
-
jsonFiles: [],
|
|
2806
|
-
deletedFiles: /* @__PURE__ */ new Set()
|
|
2807
|
-
});
|
|
2808
|
-
}
|
|
2809
|
-
branchFiles.get(branchName).deletedFiles.add(refFile);
|
|
2810
|
-
} else if (jsonMatch) {
|
|
2811
|
-
const branchName = jsonMatch[1];
|
|
2812
|
-
if (!branchFiles.has(branchName)) {
|
|
2813
|
-
branchFiles.set(branchName, {
|
|
2814
|
-
jsonFiles: [],
|
|
2815
|
-
deletedFiles: /* @__PURE__ */ new Set()
|
|
2816
|
-
});
|
|
2817
|
-
}
|
|
2818
|
-
branchFiles.get(branchName).jsonFiles.push(path);
|
|
2798
|
+
const match = path.match(/^refs\/branch\.(.+)\/([^/]+\.json)$/);
|
|
2799
|
+
if (match) {
|
|
2800
|
+
branches.add(match[1]);
|
|
2819
2801
|
}
|
|
2820
2802
|
}
|
|
2821
|
-
} catch {
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
const result = [];
|
|
2825
|
-
for (const [branchName, { jsonFiles, deletedFiles }] of branchFiles) {
|
|
2826
|
-
if (jsonFiles.length === 0) continue;
|
|
2827
|
-
jsonFiles.sort();
|
|
2828
|
-
const latestRef = jsonFiles[jsonFiles.length - 1];
|
|
2829
|
-
if (!deletedFiles.has(latestRef)) {
|
|
2830
|
-
result.push(branchName);
|
|
2803
|
+
} catch (error) {
|
|
2804
|
+
if (error instanceof AbortError) {
|
|
2805
|
+
throw error;
|
|
2831
2806
|
}
|
|
2807
|
+
throw new Error("Cannot list branches: storage does not support listing");
|
|
2832
2808
|
}
|
|
2833
|
-
return
|
|
2809
|
+
return [...branches];
|
|
2834
2810
|
}
|
|
2835
2811
|
/**
|
|
2836
2812
|
* List all tags in the repository.
|
|
@@ -2866,7 +2842,10 @@ var Repository = class _Repository {
|
|
|
2866
2842
|
tagFiles.get(tagName).jsonFiles.push(path);
|
|
2867
2843
|
}
|
|
2868
2844
|
}
|
|
2869
|
-
} catch {
|
|
2845
|
+
} catch (error) {
|
|
2846
|
+
if (error instanceof AbortError) {
|
|
2847
|
+
throw error;
|
|
2848
|
+
}
|
|
2870
2849
|
throw new Error("Cannot list tags: storage does not support listing");
|
|
2871
2850
|
}
|
|
2872
2851
|
const result = [];
|