@earthmover/icechunk 2.0.0-alpha.8 → 2.0.0
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 +64 -1
- package/fetch-storage.d.ts +20 -0
- package/fetch-storage.mjs +126 -0
- package/index.d.ts +207 -2
- package/index.js +74 -55
- package/package.json +20 -7
package/README.md
CHANGED
|
@@ -46,7 +46,51 @@ In-memory storage works on all platforms. The following backends are available o
|
|
|
46
46
|
- **HTTP** — `Storage.newHttp(baseUrl, config?)`
|
|
47
47
|
- **Local Filesystem** — `Storage.newLocalFilesystem(path)`
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
#### Fetch Storage (read-only, works everywhere)
|
|
50
|
+
|
|
51
|
+
For read-only access to a publicly hosted Icechunk repository, use the built-in fetch-based storage. This works on both native and WASM builds, making it the easiest way to open a repository in the browser:
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
import { Repository } from '@earthmover/icechunk'
|
|
55
|
+
import { createFetchStorage } from '@earthmover/icechunk/fetch-storage'
|
|
56
|
+
|
|
57
|
+
const storage = createFetchStorage('https://my-bucket.s3.us-west-2.amazonaws.com/my-repo.icechunk')
|
|
58
|
+
const repo = await Repository.open(storage)
|
|
59
|
+
const session = await repo.readonlySession({ branch: 'main' })
|
|
60
|
+
const keys = await session.store.list()
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
The repository must be on S3-compatible storage with public read access and XML listing enabled. `createFetchStorage` uses the browser `fetch` API under the hood, so it works in any environment where `fetch` is available.
|
|
64
|
+
|
|
65
|
+
#### Custom Storage Backends
|
|
66
|
+
|
|
67
|
+
For WASM builds (or any environment where the built-in backends aren't suitable), you can provide your own storage implementation in JavaScript using `Storage.newCustom()`:
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
const storage = Storage.newCustom({
|
|
71
|
+
canWrite: async (_err, ) => true,
|
|
72
|
+
getObjectRange: async (_err, { path, rangeStart, rangeEnd }) => {
|
|
73
|
+
const headers: Record<string, string> = {}
|
|
74
|
+
if (rangeStart != null && rangeEnd != null) {
|
|
75
|
+
headers['Range'] = `bytes=${rangeStart}-${rangeEnd - 1}`
|
|
76
|
+
}
|
|
77
|
+
const resp = await fetch(`https://my-bucket.example.com/${path}`, { headers })
|
|
78
|
+
return { data: new Uint8Array(await resp.arrayBuffer()), version: { etag: resp.headers.get('etag') ?? undefined } }
|
|
79
|
+
},
|
|
80
|
+
putObject: async (_err, { path, data, contentType }) => { /* ... */ },
|
|
81
|
+
copyObject: async (_err, { from, to }) => { /* ... */ },
|
|
82
|
+
listObjects: async (_err, prefix) => { /* return [{ id, createdAt, sizeBytes }] */ },
|
|
83
|
+
deleteBatch: async (_err, { prefix, batch }) => { /* return { deletedObjects, deletedBytes } */ },
|
|
84
|
+
getObjectLastModified: async (_err, path) => { /* return Date */ },
|
|
85
|
+
getObjectConditional: async (_err, { path, previousVersion }) => { /* ... */ },
|
|
86
|
+
})
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
> **Note:** Callbacks use the Node.js error-first convention — the first argument is always `null` (reserved for errors) and the actual arguments follow. Use `_err` to skip it.
|
|
90
|
+
|
|
91
|
+
This is the primary way to use cloud storage in the browser, where native Rust networking is unavailable. Each callback method maps to an operation on the underlying `Storage` trait. See the exported `Storage*` TypeScript interfaces for the full type signatures.
|
|
92
|
+
|
|
93
|
+
#### Virtual Chunks
|
|
50
94
|
|
|
51
95
|
Virtual chunks are supported in node but not in WASM builds.
|
|
52
96
|
|
|
@@ -58,6 +102,18 @@ Install the package with the `--cpu=wasm32` flag to get the WASM binary:
|
|
|
58
102
|
npm install @earthmover/icechunk --cpu=wasm32
|
|
59
103
|
```
|
|
60
104
|
|
|
105
|
+
To open a public repository in the browser, use fetch storage:
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
import { Repository } from '@earthmover/icechunk'
|
|
109
|
+
import { createFetchStorage } from '@earthmover/icechunk/fetch-storage'
|
|
110
|
+
|
|
111
|
+
const storage = createFetchStorage('https://my-bucket.s3.us-west-2.amazonaws.com/my-repo.icechunk')
|
|
112
|
+
const repo = await Repository.open(storage)
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
For more control, use `Storage.newCustom()` to implement your own storage backend with any JS networking library.
|
|
116
|
+
|
|
61
117
|
The WASM build uses `SharedArrayBuffer` for threading, which requires your server to send these headers:
|
|
62
118
|
|
|
63
119
|
```
|
|
@@ -76,6 +132,7 @@ export default defineConfig({
|
|
|
76
132
|
plugins: [wasm(), topLevelAwait()],
|
|
77
133
|
optimizeDeps: {
|
|
78
134
|
exclude: ['@earthmover/icechunk', '@earthmover/icechunk-wasm32-wasi'],
|
|
135
|
+
include: ['@earthmover/icechunk > @earthmover/icechunk-wasm32-wasi'],
|
|
79
136
|
},
|
|
80
137
|
server: {
|
|
81
138
|
headers: {
|
|
@@ -108,3 +165,9 @@ For WASM:
|
|
|
108
165
|
yarn build --target wasm32-wasip1-threads
|
|
109
166
|
NAPI_RS_FORCE_WASI=1 yarn test
|
|
110
167
|
```
|
|
168
|
+
|
|
169
|
+
> [!IMPORTANT]
|
|
170
|
+
> Building the WASM target requires Rust 1.94.1 or later.
|
|
171
|
+
> Rust 1.94.0 has a bug where `std::thread::spawn` is unconditionally disabled on all WASI targets,
|
|
172
|
+
> including `wasm32-wasip1-threads` which supports threading.
|
|
173
|
+
> See [rust-lang/rust#151309](https://github.com/rust-lang/rust/pull/151309) for the fix.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Storage } from '@earthmover/icechunk'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Create a read-only storage backend that fetches objects over HTTP.
|
|
5
|
+
*
|
|
6
|
+
* Works with any publicly accessible icechunk repository hosted on S3-compatible
|
|
7
|
+
* storage. Requires the bucket to support anonymous reads and S3 XML listing.
|
|
8
|
+
*
|
|
9
|
+
* @param baseUrl - Base URL of the icechunk repository (no trailing slash)
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { Repository } from '@earthmover/icechunk'
|
|
14
|
+
* import { createFetchStorage } from '@earthmover/icechunk/fetch-storage'
|
|
15
|
+
*
|
|
16
|
+
* const storage = createFetchStorage('https://my-bucket.s3.us-west-2.amazonaws.com/path/to/repo.icechunk')
|
|
17
|
+
* const repo = await Repository.open(storage)
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function createFetchStorage(baseUrl: string): Storage
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read-only fetch-based storage backend for Icechunk.
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* import { Repository } from '@earthmover/icechunk'
|
|
6
|
+
* import { createFetchStorage } from '@earthmover/icechunk/fetch-storage'
|
|
7
|
+
*
|
|
8
|
+
* const storage = createFetchStorage('https://my-bucket.s3.amazonaws.com/my-repo.icechunk')
|
|
9
|
+
* const repo = await Repository.open(storage)
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { Storage } from '@earthmover/icechunk'
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @param {string} baseUrl - Base URL of the icechunk repository (no trailing slash)
|
|
16
|
+
* @returns {Storage}
|
|
17
|
+
*/
|
|
18
|
+
export function createFetchStorage(baseUrl) {
|
|
19
|
+
// Normalize: strip trailing slash
|
|
20
|
+
const base = baseUrl.replace(/\/+$/, '')
|
|
21
|
+
|
|
22
|
+
function throwForStatus(resp, url) {
|
|
23
|
+
if (resp.ok) return
|
|
24
|
+
if (resp.status === 404) {
|
|
25
|
+
throw new Error(`ObjectNotFound: ${url}`)
|
|
26
|
+
}
|
|
27
|
+
throw new Error(`HTTP ${resp.status}: ${url}`)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return Storage.newCustom({
|
|
31
|
+
canWrite: async (_err) => false,
|
|
32
|
+
|
|
33
|
+
getObjectRange: async (_err, { path, rangeStart, rangeEnd }) => {
|
|
34
|
+
const url = `${base}/${path}`
|
|
35
|
+
const headers = {}
|
|
36
|
+
|
|
37
|
+
if (rangeStart != null && rangeEnd != null) {
|
|
38
|
+
headers['Range'] = `bytes=${rangeStart}-${rangeEnd - 1}`
|
|
39
|
+
} else if (rangeStart != null) {
|
|
40
|
+
headers['Range'] = `bytes=${rangeStart}-`
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const resp = await fetch(url, { headers })
|
|
44
|
+
throwForStatus(resp, url)
|
|
45
|
+
|
|
46
|
+
const data = new Uint8Array(await resp.arrayBuffer())
|
|
47
|
+
const etag = resp.headers.get('etag') ?? undefined
|
|
48
|
+
return { data, version: { etag } }
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
putObject: async () => {
|
|
52
|
+
throw new Error('Read-only storage: putObject not supported')
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
copyObject: async () => {
|
|
56
|
+
throw new Error('Read-only storage: copyObject not supported')
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
listObjects: async (_err, prefix) => {
|
|
60
|
+
// S3-style XML listing
|
|
61
|
+
const url = new URL(base)
|
|
62
|
+
const keyPrefix = url.pathname.replace(/^\//, '') + '/' + prefix
|
|
63
|
+
const listUrl = `${url.origin}/?list-type=2&prefix=${encodeURIComponent(keyPrefix)}`
|
|
64
|
+
|
|
65
|
+
const resp = await fetch(listUrl)
|
|
66
|
+
throwForStatus(resp, listUrl)
|
|
67
|
+
|
|
68
|
+
const xml = await resp.text()
|
|
69
|
+
const results = []
|
|
70
|
+
const contentRegex = /<Contents>([\s\S]*?)<\/Contents>/g
|
|
71
|
+
let match
|
|
72
|
+
while ((match = contentRegex.exec(xml)) !== null) {
|
|
73
|
+
const block = match[1]
|
|
74
|
+
const key = block.match(/<Key>(.*?)<\/Key>/)?.[1]
|
|
75
|
+
const lastModified = block.match(/<LastModified>(.*?)<\/LastModified>/)?.[1]
|
|
76
|
+
const size = block.match(/<Size>(.*?)<\/Size>/)?.[1]
|
|
77
|
+
if (key && lastModified && size) {
|
|
78
|
+
const id = key.startsWith(keyPrefix) ? key.slice(keyPrefix.length) : key
|
|
79
|
+
results.push({
|
|
80
|
+
id,
|
|
81
|
+
createdAt: new Date(lastModified),
|
|
82
|
+
sizeBytes: Number(size),
|
|
83
|
+
})
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return results
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
deleteBatch: async () => {
|
|
91
|
+
throw new Error('Read-only storage: deleteBatch not supported')
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
getObjectLastModified: async (_err, path) => {
|
|
95
|
+
const url = `${base}/${path}`
|
|
96
|
+
const resp = await fetch(url, { method: 'HEAD' })
|
|
97
|
+
throwForStatus(resp, url)
|
|
98
|
+
const lastModified = resp.headers.get('last-modified')
|
|
99
|
+
if (!lastModified) {
|
|
100
|
+
throw new Error(`No Last-Modified header: ${url}`)
|
|
101
|
+
}
|
|
102
|
+
return new Date(lastModified)
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
getObjectConditional: async (_err, { path, previousVersion }) => {
|
|
106
|
+
const url = `${base}/${path}`
|
|
107
|
+
const headers = {}
|
|
108
|
+
|
|
109
|
+
if (previousVersion?.etag) {
|
|
110
|
+
headers['If-None-Match'] = previousVersion.etag
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const resp = await fetch(url, { headers })
|
|
114
|
+
|
|
115
|
+
if (resp.status === 304) {
|
|
116
|
+
return { kind: 'on_latest_version' }
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
throwForStatus(resp, url)
|
|
120
|
+
|
|
121
|
+
const data = new Uint8Array(await resp.arrayBuffer())
|
|
122
|
+
const etag = resp.headers.get('etag') ?? undefined
|
|
123
|
+
return { kind: 'modified', data, newVersion: { etag } }
|
|
124
|
+
},
|
|
125
|
+
})
|
|
126
|
+
}
|
package/index.d.ts
CHANGED
|
@@ -12,6 +12,24 @@ export declare class Repository {
|
|
|
12
12
|
listTags(): Promise<Array<string>>
|
|
13
13
|
createTag(name: string, snapshotId: string): Promise<void>
|
|
14
14
|
lookupManifestFiles(snapshotId: string): Promise<Array<JsManifestFileInfo>>
|
|
15
|
+
lookupBranch(branch: string): Promise<string>
|
|
16
|
+
resetBranch(branch: string, toSnapshotId: string, fromSnapshotId?: string | undefined | null): Promise<void>
|
|
17
|
+
deleteBranch(branch: string): Promise<void>
|
|
18
|
+
lookupTag(tag: string): Promise<string>
|
|
19
|
+
deleteTag(tag: string): Promise<void>
|
|
20
|
+
lookupSnapshot(snapshotId: string): Promise<SnapshotInfo>
|
|
21
|
+
static fetchSpecVersion(storage: JsStorage, storageSettings?: StorageSettings | undefined | null): Promise<number | null>
|
|
22
|
+
static fetchConfig(storage: JsStorage): Promise<RepositoryConfig | null>
|
|
23
|
+
saveConfig(): Promise<void>
|
|
24
|
+
get config(): RepositoryConfig
|
|
25
|
+
get specVersion(): number
|
|
26
|
+
diff(options: DiffOptions): Promise<DiffResult>
|
|
27
|
+
featureFlags(): Promise<Array<FeatureFlag>>
|
|
28
|
+
enabledFeatureFlags(): Promise<Array<FeatureFlag>>
|
|
29
|
+
disabledFeatureFlags(): Promise<Array<FeatureFlag>>
|
|
30
|
+
setFeatureFlag(name: string, setting?: boolean | undefined | null): Promise<void>
|
|
31
|
+
rearrangeSession(branch: string): Promise<JsSession>
|
|
32
|
+
ancestry(options: VersionOptions): Promise<Array<SnapshotInfo>>
|
|
15
33
|
}
|
|
16
34
|
export type JsRepository = Repository
|
|
17
35
|
|
|
@@ -23,17 +41,42 @@ export declare class Session {
|
|
|
23
41
|
get store(): JsStore
|
|
24
42
|
commit(message: string): Promise<string>
|
|
25
43
|
discardChanges(): Promise<void>
|
|
44
|
+
get isFork(): boolean
|
|
45
|
+
get mode(): string
|
|
46
|
+
get config(): RepositoryConfig
|
|
47
|
+
status(): Promise<DiffResult>
|
|
48
|
+
moveNode(fromPath: string, toPath: string): Promise<void>
|
|
49
|
+
getNodeId(path: string): Promise<string>
|
|
50
|
+
merge(other: Session): Promise<void>
|
|
51
|
+
amend(message: string): Promise<string>
|
|
52
|
+
flush(message: string): Promise<string>
|
|
53
|
+
rebase(): Promise<void>
|
|
26
54
|
}
|
|
27
55
|
export type JsSession = Session
|
|
28
56
|
|
|
29
57
|
export declare class Storage {
|
|
30
58
|
static newInMemory(): Promise<Storage>
|
|
59
|
+
/**
|
|
60
|
+
* Create a Storage backed by a JS object implementing the StorageBackend interface.
|
|
61
|
+
*
|
|
62
|
+
* This allows providing a custom storage implementation using JS libraries
|
|
63
|
+
* (fetch, @aws-sdk/client-s3, @google-cloud/storage, etc.), which is
|
|
64
|
+
* especially useful for WASM builds where native Rust networking is unavailable.
|
|
65
|
+
*/
|
|
66
|
+
static newCustom(backend: { canWrite: () => Promise<boolean>; getObjectRange: (args: StorageGetObjectRangeArgs) => Promise<StorageGetObjectResponse>; putObject: (args: StoragePutObjectArgs) => Promise<StorageVersionedUpdateResult>; copyObject: (args: StorageCopyObjectArgs) => Promise<StorageVersionedUpdateResult>; listObjects: (prefix: string) => Promise<Array<StorageListInfo>>; deleteBatch: (args: StorageDeleteBatchArgs) => Promise<StorageDeleteObjectsResult>; getObjectLastModified: (path: string) => Promise<Date>; getObjectConditional: (args: StorageGetObjectConditionalArgs) => Promise<StorageGetModifiedResult> }): Storage
|
|
31
67
|
}
|
|
32
68
|
export type JsStorage = Storage
|
|
33
69
|
|
|
34
70
|
export declare class Store {
|
|
35
|
-
get(key: string): Promise<
|
|
36
|
-
|
|
71
|
+
get(key: string): Promise<Uint8Array | null>
|
|
72
|
+
/**
|
|
73
|
+
* Fetch a byte range from a key.
|
|
74
|
+
*
|
|
75
|
+
* Accepts zarrita's RangeQuery format:
|
|
76
|
+
* { offset: number, length: number } - fetch length bytes starting at offset
|
|
77
|
+
* { suffixLength: number } - fetch the last suffixLength bytes
|
|
78
|
+
*/
|
|
79
|
+
getRange(key: string, range: RangeQuery): Promise<Uint8Array | null>
|
|
37
80
|
set(key: string, value: Buffer): Promise<void>
|
|
38
81
|
exists(key: string): Promise<boolean>
|
|
39
82
|
delete(key: string): Promise<void>
|
|
@@ -43,6 +86,14 @@ export declare class Store {
|
|
|
43
86
|
get supportsWrites(): boolean
|
|
44
87
|
get supportsDeletes(): boolean
|
|
45
88
|
get supportsListing(): boolean
|
|
89
|
+
get readOnly(): Promise<boolean>
|
|
90
|
+
get session(): Session
|
|
91
|
+
isEmpty(prefix: string): Promise<boolean>
|
|
92
|
+
clear(): Promise<void>
|
|
93
|
+
setIfNotExists(key: string, value: Buffer): Promise<void>
|
|
94
|
+
deleteDir(prefix: string): Promise<void>
|
|
95
|
+
getsize(key: string): Promise<number>
|
|
96
|
+
getsizePrefix(prefix: string): Promise<number>
|
|
46
97
|
}
|
|
47
98
|
export type JsStore = Store
|
|
48
99
|
|
|
@@ -66,12 +117,55 @@ export interface CompressionConfig {
|
|
|
66
117
|
level?: number
|
|
67
118
|
}
|
|
68
119
|
|
|
120
|
+
export interface DiffOptions {
|
|
121
|
+
fromBranch?: string
|
|
122
|
+
fromTag?: string
|
|
123
|
+
fromSnapshotId?: string
|
|
124
|
+
toBranch?: string
|
|
125
|
+
toTag?: string
|
|
126
|
+
toSnapshotId?: string
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export interface DiffResult {
|
|
130
|
+
newGroups: Array<string>
|
|
131
|
+
newArrays: Array<string>
|
|
132
|
+
deletedGroups: Array<string>
|
|
133
|
+
deletedArrays: Array<string>
|
|
134
|
+
updatedGroups: Array<string>
|
|
135
|
+
updatedArrays: Array<string>
|
|
136
|
+
updatedChunks: any
|
|
137
|
+
movedNodes: Array<JsMovedNode>
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export interface FeatureFlag {
|
|
141
|
+
id: number
|
|
142
|
+
name: string
|
|
143
|
+
defaultEnabled: boolean
|
|
144
|
+
setting?: boolean
|
|
145
|
+
enabled: boolean
|
|
146
|
+
}
|
|
147
|
+
|
|
69
148
|
export interface ManifestFileInfo {
|
|
70
149
|
id: string
|
|
71
150
|
sizeBytes: number
|
|
72
151
|
numChunkRefs: number
|
|
73
152
|
}
|
|
74
153
|
|
|
154
|
+
export interface MovedNode {
|
|
155
|
+
from: string
|
|
156
|
+
to: string
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Range query matching zarrita's RangeQuery type:
|
|
161
|
+
* { offset: number, length: number } | { suffixLength: number }
|
|
162
|
+
*/
|
|
163
|
+
export interface RangeQuery {
|
|
164
|
+
offset?: number
|
|
165
|
+
length?: number
|
|
166
|
+
suffixLength?: number
|
|
167
|
+
}
|
|
168
|
+
|
|
75
169
|
export interface ReadonlySessionOptions {
|
|
76
170
|
branch?: string
|
|
77
171
|
tag?: string
|
|
@@ -93,12 +187,95 @@ export interface RepositoryConfig {
|
|
|
93
187
|
manifest?: any
|
|
94
188
|
}
|
|
95
189
|
|
|
190
|
+
export interface SnapshotInfo {
|
|
191
|
+
id: string
|
|
192
|
+
parentId?: string
|
|
193
|
+
writtenAt: string
|
|
194
|
+
message: string
|
|
195
|
+
metadata: any
|
|
196
|
+
}
|
|
197
|
+
|
|
96
198
|
/** Storage concurrency settings */
|
|
97
199
|
export interface StorageConcurrencySettings {
|
|
98
200
|
maxConcurrentRequestsForObject?: number
|
|
99
201
|
idealConcurrentRequestSize?: number
|
|
100
202
|
}
|
|
101
203
|
|
|
204
|
+
/** Arguments for copy_object callback */
|
|
205
|
+
export interface StorageCopyObjectArgs {
|
|
206
|
+
from: string
|
|
207
|
+
to: string
|
|
208
|
+
contentType?: string
|
|
209
|
+
version: StorageVersionInfo
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/** Arguments for delete_batch callback */
|
|
213
|
+
export interface StorageDeleteBatchArgs {
|
|
214
|
+
prefix: string
|
|
215
|
+
batch: Array<StorageDeleteItem>
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/** An item in a delete_batch call */
|
|
219
|
+
export interface StorageDeleteItem {
|
|
220
|
+
id: string
|
|
221
|
+
size: number
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/** Result of a delete_batch call from JS */
|
|
225
|
+
export interface StorageDeleteObjectsResult {
|
|
226
|
+
deletedObjects: number
|
|
227
|
+
deletedBytes: number
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/** Result of a get_object_conditional call from JS */
|
|
231
|
+
export interface StorageGetModifiedResult {
|
|
232
|
+
/** "modified" or "on_latest_version" */
|
|
233
|
+
kind: string
|
|
234
|
+
data?: Buffer
|
|
235
|
+
newVersion?: StorageVersionInfo
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/** Arguments for get_object_conditional callback */
|
|
239
|
+
export interface StorageGetObjectConditionalArgs {
|
|
240
|
+
path: string
|
|
241
|
+
previousVersion?: StorageVersionInfo
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/** Arguments for get_object_range callback */
|
|
245
|
+
export interface StorageGetObjectRangeArgs {
|
|
246
|
+
path: string
|
|
247
|
+
rangeStart?: number
|
|
248
|
+
rangeEnd?: number
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/** Result of a get_object_range call from JS */
|
|
252
|
+
export interface StorageGetObjectResponse {
|
|
253
|
+
data: Buffer
|
|
254
|
+
version: StorageVersionInfo
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/** A key-value pair for object metadata */
|
|
258
|
+
export interface StorageKeyValue {
|
|
259
|
+
key: string
|
|
260
|
+
value: string
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/** Entry in a list_objects result from JS */
|
|
264
|
+
export interface StorageListInfo {
|
|
265
|
+
id: string
|
|
266
|
+
createdAt: Date
|
|
267
|
+
sizeBytes: number
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/** Arguments for put_object callback */
|
|
271
|
+
export interface StoragePutObjectArgs {
|
|
272
|
+
path: string
|
|
273
|
+
data: Buffer
|
|
274
|
+
contentType?: string
|
|
275
|
+
metadata: Array<StorageKeyValue>
|
|
276
|
+
previousVersion?: StorageVersionInfo
|
|
277
|
+
}
|
|
278
|
+
|
|
102
279
|
/** Storage retries settings */
|
|
103
280
|
export interface StorageRetriesSettings {
|
|
104
281
|
maxTries?: number
|
|
@@ -110,6 +287,7 @@ export interface StorageRetriesSettings {
|
|
|
110
287
|
export interface StorageSettings {
|
|
111
288
|
concurrency?: StorageConcurrencySettings
|
|
112
289
|
retries?: StorageRetriesSettings
|
|
290
|
+
timeouts?: StorageTimeoutSettings
|
|
113
291
|
unsafeUseConditionalUpdate?: boolean
|
|
114
292
|
unsafeUseConditionalCreate?: boolean
|
|
115
293
|
unsafeUseMetadata?: boolean
|
|
@@ -118,3 +296,30 @@ export interface StorageSettings {
|
|
|
118
296
|
chunksStorageClass?: string
|
|
119
297
|
minimumSizeForMultipartUpload?: number
|
|
120
298
|
}
|
|
299
|
+
|
|
300
|
+
/** Storage timeout settings */
|
|
301
|
+
export interface StorageTimeoutSettings {
|
|
302
|
+
connectTimeoutMs?: number
|
|
303
|
+
readTimeoutMs?: number
|
|
304
|
+
operationTimeoutMs?: number
|
|
305
|
+
operationAttemptTimeoutMs?: number
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/** Result of a put_object or copy_object call from JS */
|
|
309
|
+
export interface StorageVersionedUpdateResult {
|
|
310
|
+
/** "updated" or "not_on_latest_version" */
|
|
311
|
+
kind: string
|
|
312
|
+
newVersion?: StorageVersionInfo
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/** Version information returned from JS storage callbacks */
|
|
316
|
+
export interface StorageVersionInfo {
|
|
317
|
+
etag?: string
|
|
318
|
+
generation?: string
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export interface VersionOptions {
|
|
322
|
+
branch?: string
|
|
323
|
+
tag?: string
|
|
324
|
+
snapshotId?: string
|
|
325
|
+
}
|
package/index.js
CHANGED
|
@@ -3,9 +3,6 @@
|
|
|
3
3
|
// @ts-nocheck
|
|
4
4
|
/* auto-generated by NAPI-RS */
|
|
5
5
|
|
|
6
|
-
const { createRequire } = require('node:module')
|
|
7
|
-
require = createRequire(__filename)
|
|
8
|
-
|
|
9
6
|
const { readFileSync } = require('node:fs')
|
|
10
7
|
let nativeBinding = null
|
|
11
8
|
const loadErrors = []
|
|
@@ -80,8 +77,8 @@ function requireNative() {
|
|
|
80
77
|
try {
|
|
81
78
|
const binding = require('@earthmover/icechunk-android-arm64')
|
|
82
79
|
const bindingPackageVersion = require('@earthmover/icechunk-android-arm64/package.json').version
|
|
83
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
84
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
80
|
+
if (bindingPackageVersion !== '2.0.0-alpha.13' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
81
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
85
82
|
}
|
|
86
83
|
return binding
|
|
87
84
|
} catch (e) {
|
|
@@ -96,8 +93,8 @@ function requireNative() {
|
|
|
96
93
|
try {
|
|
97
94
|
const binding = require('@earthmover/icechunk-android-arm-eabi')
|
|
98
95
|
const bindingPackageVersion = require('@earthmover/icechunk-android-arm-eabi/package.json').version
|
|
99
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
100
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
96
|
+
if (bindingPackageVersion !== '2.0.0-alpha.13' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
97
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
101
98
|
}
|
|
102
99
|
return binding
|
|
103
100
|
} catch (e) {
|
|
@@ -108,7 +105,24 @@ function requireNative() {
|
|
|
108
105
|
}
|
|
109
106
|
} else if (process.platform === 'win32') {
|
|
110
107
|
if (process.arch === 'x64') {
|
|
108
|
+
if (process.config?.variables?.shlib_suffix === 'dll.a' || process.config?.variables?.node_target_type === 'shared_library') {
|
|
109
|
+
try {
|
|
110
|
+
return require('./icechunk.win32-x64-gnu.node')
|
|
111
|
+
} catch (e) {
|
|
112
|
+
loadErrors.push(e)
|
|
113
|
+
}
|
|
111
114
|
try {
|
|
115
|
+
const binding = require('@earthmover/icechunk-win32-x64-gnu')
|
|
116
|
+
const bindingPackageVersion = require('@earthmover/icechunk-win32-x64-gnu/package.json').version
|
|
117
|
+
if (bindingPackageVersion !== '2.0.0-alpha.13' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
118
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
119
|
+
}
|
|
120
|
+
return binding
|
|
121
|
+
} catch (e) {
|
|
122
|
+
loadErrors.push(e)
|
|
123
|
+
}
|
|
124
|
+
} else {
|
|
125
|
+
try {
|
|
112
126
|
return require('./icechunk.win32-x64-msvc.node')
|
|
113
127
|
} catch (e) {
|
|
114
128
|
loadErrors.push(e)
|
|
@@ -116,13 +130,14 @@ function requireNative() {
|
|
|
116
130
|
try {
|
|
117
131
|
const binding = require('@earthmover/icechunk-win32-x64-msvc')
|
|
118
132
|
const bindingPackageVersion = require('@earthmover/icechunk-win32-x64-msvc/package.json').version
|
|
119
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
120
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
133
|
+
if (bindingPackageVersion !== '2.0.0-alpha.13' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
134
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
121
135
|
}
|
|
122
136
|
return binding
|
|
123
137
|
} catch (e) {
|
|
124
138
|
loadErrors.push(e)
|
|
125
139
|
}
|
|
140
|
+
}
|
|
126
141
|
} else if (process.arch === 'ia32') {
|
|
127
142
|
try {
|
|
128
143
|
return require('./icechunk.win32-ia32-msvc.node')
|
|
@@ -132,8 +147,8 @@ function requireNative() {
|
|
|
132
147
|
try {
|
|
133
148
|
const binding = require('@earthmover/icechunk-win32-ia32-msvc')
|
|
134
149
|
const bindingPackageVersion = require('@earthmover/icechunk-win32-ia32-msvc/package.json').version
|
|
135
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
136
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
150
|
+
if (bindingPackageVersion !== '2.0.0-alpha.13' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
151
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
137
152
|
}
|
|
138
153
|
return binding
|
|
139
154
|
} catch (e) {
|
|
@@ -148,8 +163,8 @@ function requireNative() {
|
|
|
148
163
|
try {
|
|
149
164
|
const binding = require('@earthmover/icechunk-win32-arm64-msvc')
|
|
150
165
|
const bindingPackageVersion = require('@earthmover/icechunk-win32-arm64-msvc/package.json').version
|
|
151
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
152
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
166
|
+
if (bindingPackageVersion !== '2.0.0-alpha.13' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
167
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
153
168
|
}
|
|
154
169
|
return binding
|
|
155
170
|
} catch (e) {
|
|
@@ -167,8 +182,8 @@ function requireNative() {
|
|
|
167
182
|
try {
|
|
168
183
|
const binding = require('@earthmover/icechunk-darwin-universal')
|
|
169
184
|
const bindingPackageVersion = require('@earthmover/icechunk-darwin-universal/package.json').version
|
|
170
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
171
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
185
|
+
if (bindingPackageVersion !== '2.0.0-alpha.13' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
186
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
172
187
|
}
|
|
173
188
|
return binding
|
|
174
189
|
} catch (e) {
|
|
@@ -183,8 +198,8 @@ function requireNative() {
|
|
|
183
198
|
try {
|
|
184
199
|
const binding = require('@earthmover/icechunk-darwin-x64')
|
|
185
200
|
const bindingPackageVersion = require('@earthmover/icechunk-darwin-x64/package.json').version
|
|
186
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
187
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
201
|
+
if (bindingPackageVersion !== '2.0.0-alpha.13' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
202
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
188
203
|
}
|
|
189
204
|
return binding
|
|
190
205
|
} catch (e) {
|
|
@@ -199,8 +214,8 @@ function requireNative() {
|
|
|
199
214
|
try {
|
|
200
215
|
const binding = require('@earthmover/icechunk-darwin-arm64')
|
|
201
216
|
const bindingPackageVersion = require('@earthmover/icechunk-darwin-arm64/package.json').version
|
|
202
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
203
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
217
|
+
if (bindingPackageVersion !== '2.0.0-alpha.13' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
218
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
204
219
|
}
|
|
205
220
|
return binding
|
|
206
221
|
} catch (e) {
|
|
@@ -219,8 +234,8 @@ function requireNative() {
|
|
|
219
234
|
try {
|
|
220
235
|
const binding = require('@earthmover/icechunk-freebsd-x64')
|
|
221
236
|
const bindingPackageVersion = require('@earthmover/icechunk-freebsd-x64/package.json').version
|
|
222
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
223
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
237
|
+
if (bindingPackageVersion !== '2.0.0-alpha.13' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
238
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
224
239
|
}
|
|
225
240
|
return binding
|
|
226
241
|
} catch (e) {
|
|
@@ -235,8 +250,8 @@ function requireNative() {
|
|
|
235
250
|
try {
|
|
236
251
|
const binding = require('@earthmover/icechunk-freebsd-arm64')
|
|
237
252
|
const bindingPackageVersion = require('@earthmover/icechunk-freebsd-arm64/package.json').version
|
|
238
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
239
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
253
|
+
if (bindingPackageVersion !== '2.0.0-alpha.13' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
254
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
240
255
|
}
|
|
241
256
|
return binding
|
|
242
257
|
} catch (e) {
|
|
@@ -256,8 +271,8 @@ function requireNative() {
|
|
|
256
271
|
try {
|
|
257
272
|
const binding = require('@earthmover/icechunk-linux-x64-musl')
|
|
258
273
|
const bindingPackageVersion = require('@earthmover/icechunk-linux-x64-musl/package.json').version
|
|
259
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
260
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
274
|
+
if (bindingPackageVersion !== '2.0.0-alpha.13' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
275
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
261
276
|
}
|
|
262
277
|
return binding
|
|
263
278
|
} catch (e) {
|
|
@@ -272,8 +287,8 @@ function requireNative() {
|
|
|
272
287
|
try {
|
|
273
288
|
const binding = require('@earthmover/icechunk-linux-x64-gnu')
|
|
274
289
|
const bindingPackageVersion = require('@earthmover/icechunk-linux-x64-gnu/package.json').version
|
|
275
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
276
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
290
|
+
if (bindingPackageVersion !== '2.0.0-alpha.13' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
291
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
277
292
|
}
|
|
278
293
|
return binding
|
|
279
294
|
} catch (e) {
|
|
@@ -290,8 +305,8 @@ function requireNative() {
|
|
|
290
305
|
try {
|
|
291
306
|
const binding = require('@earthmover/icechunk-linux-arm64-musl')
|
|
292
307
|
const bindingPackageVersion = require('@earthmover/icechunk-linux-arm64-musl/package.json').version
|
|
293
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
294
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
308
|
+
if (bindingPackageVersion !== '2.0.0-alpha.13' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
309
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
295
310
|
}
|
|
296
311
|
return binding
|
|
297
312
|
} catch (e) {
|
|
@@ -306,8 +321,8 @@ function requireNative() {
|
|
|
306
321
|
try {
|
|
307
322
|
const binding = require('@earthmover/icechunk-linux-arm64-gnu')
|
|
308
323
|
const bindingPackageVersion = require('@earthmover/icechunk-linux-arm64-gnu/package.json').version
|
|
309
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
310
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
324
|
+
if (bindingPackageVersion !== '2.0.0-alpha.13' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
325
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
311
326
|
}
|
|
312
327
|
return binding
|
|
313
328
|
} catch (e) {
|
|
@@ -324,8 +339,8 @@ function requireNative() {
|
|
|
324
339
|
try {
|
|
325
340
|
const binding = require('@earthmover/icechunk-linux-arm-musleabihf')
|
|
326
341
|
const bindingPackageVersion = require('@earthmover/icechunk-linux-arm-musleabihf/package.json').version
|
|
327
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
328
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
342
|
+
if (bindingPackageVersion !== '2.0.0-alpha.13' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
343
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
329
344
|
}
|
|
330
345
|
return binding
|
|
331
346
|
} catch (e) {
|
|
@@ -340,8 +355,8 @@ function requireNative() {
|
|
|
340
355
|
try {
|
|
341
356
|
const binding = require('@earthmover/icechunk-linux-arm-gnueabihf')
|
|
342
357
|
const bindingPackageVersion = require('@earthmover/icechunk-linux-arm-gnueabihf/package.json').version
|
|
343
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
344
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
358
|
+
if (bindingPackageVersion !== '2.0.0-alpha.13' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
359
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
345
360
|
}
|
|
346
361
|
return binding
|
|
347
362
|
} catch (e) {
|
|
@@ -358,8 +373,8 @@ function requireNative() {
|
|
|
358
373
|
try {
|
|
359
374
|
const binding = require('@earthmover/icechunk-linux-loong64-musl')
|
|
360
375
|
const bindingPackageVersion = require('@earthmover/icechunk-linux-loong64-musl/package.json').version
|
|
361
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
362
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
376
|
+
if (bindingPackageVersion !== '2.0.0-alpha.13' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
377
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
363
378
|
}
|
|
364
379
|
return binding
|
|
365
380
|
} catch (e) {
|
|
@@ -374,8 +389,8 @@ function requireNative() {
|
|
|
374
389
|
try {
|
|
375
390
|
const binding = require('@earthmover/icechunk-linux-loong64-gnu')
|
|
376
391
|
const bindingPackageVersion = require('@earthmover/icechunk-linux-loong64-gnu/package.json').version
|
|
377
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
378
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
392
|
+
if (bindingPackageVersion !== '2.0.0-alpha.13' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
393
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
379
394
|
}
|
|
380
395
|
return binding
|
|
381
396
|
} catch (e) {
|
|
@@ -392,8 +407,8 @@ function requireNative() {
|
|
|
392
407
|
try {
|
|
393
408
|
const binding = require('@earthmover/icechunk-linux-riscv64-musl')
|
|
394
409
|
const bindingPackageVersion = require('@earthmover/icechunk-linux-riscv64-musl/package.json').version
|
|
395
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
396
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
410
|
+
if (bindingPackageVersion !== '2.0.0-alpha.13' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
411
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
397
412
|
}
|
|
398
413
|
return binding
|
|
399
414
|
} catch (e) {
|
|
@@ -408,8 +423,8 @@ function requireNative() {
|
|
|
408
423
|
try {
|
|
409
424
|
const binding = require('@earthmover/icechunk-linux-riscv64-gnu')
|
|
410
425
|
const bindingPackageVersion = require('@earthmover/icechunk-linux-riscv64-gnu/package.json').version
|
|
411
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
412
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
426
|
+
if (bindingPackageVersion !== '2.0.0-alpha.13' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
427
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
413
428
|
}
|
|
414
429
|
return binding
|
|
415
430
|
} catch (e) {
|
|
@@ -425,8 +440,8 @@ function requireNative() {
|
|
|
425
440
|
try {
|
|
426
441
|
const binding = require('@earthmover/icechunk-linux-ppc64-gnu')
|
|
427
442
|
const bindingPackageVersion = require('@earthmover/icechunk-linux-ppc64-gnu/package.json').version
|
|
428
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
429
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
443
|
+
if (bindingPackageVersion !== '2.0.0-alpha.13' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
444
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
430
445
|
}
|
|
431
446
|
return binding
|
|
432
447
|
} catch (e) {
|
|
@@ -441,8 +456,8 @@ function requireNative() {
|
|
|
441
456
|
try {
|
|
442
457
|
const binding = require('@earthmover/icechunk-linux-s390x-gnu')
|
|
443
458
|
const bindingPackageVersion = require('@earthmover/icechunk-linux-s390x-gnu/package.json').version
|
|
444
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
445
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
459
|
+
if (bindingPackageVersion !== '2.0.0-alpha.13' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
460
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
446
461
|
}
|
|
447
462
|
return binding
|
|
448
463
|
} catch (e) {
|
|
@@ -461,8 +476,8 @@ function requireNative() {
|
|
|
461
476
|
try {
|
|
462
477
|
const binding = require('@earthmover/icechunk-openharmony-arm64')
|
|
463
478
|
const bindingPackageVersion = require('@earthmover/icechunk-openharmony-arm64/package.json').version
|
|
464
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
465
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
479
|
+
if (bindingPackageVersion !== '2.0.0-alpha.13' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
480
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
466
481
|
}
|
|
467
482
|
return binding
|
|
468
483
|
} catch (e) {
|
|
@@ -477,8 +492,8 @@ function requireNative() {
|
|
|
477
492
|
try {
|
|
478
493
|
const binding = require('@earthmover/icechunk-openharmony-x64')
|
|
479
494
|
const bindingPackageVersion = require('@earthmover/icechunk-openharmony-x64/package.json').version
|
|
480
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
481
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
495
|
+
if (bindingPackageVersion !== '2.0.0-alpha.13' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
496
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
482
497
|
}
|
|
483
498
|
return binding
|
|
484
499
|
} catch (e) {
|
|
@@ -493,8 +508,8 @@ function requireNative() {
|
|
|
493
508
|
try {
|
|
494
509
|
const binding = require('@earthmover/icechunk-openharmony-arm')
|
|
495
510
|
const bindingPackageVersion = require('@earthmover/icechunk-openharmony-arm/package.json').version
|
|
496
|
-
if (bindingPackageVersion !== '2.0.0-alpha.
|
|
497
|
-
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.
|
|
511
|
+
if (bindingPackageVersion !== '2.0.0-alpha.13' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
512
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
498
513
|
}
|
|
499
514
|
return binding
|
|
500
515
|
} catch (e) {
|
|
@@ -521,13 +536,17 @@ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
|
521
536
|
wasiBindingError = err
|
|
522
537
|
}
|
|
523
538
|
}
|
|
524
|
-
if (!nativeBinding) {
|
|
539
|
+
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
525
540
|
try {
|
|
526
541
|
wasiBinding = require('@earthmover/icechunk-wasm32-wasi')
|
|
527
542
|
nativeBinding = wasiBinding
|
|
528
543
|
} catch (err) {
|
|
529
544
|
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
530
|
-
wasiBindingError
|
|
545
|
+
if (!wasiBindingError) {
|
|
546
|
+
wasiBindingError = err
|
|
547
|
+
} else {
|
|
548
|
+
wasiBindingError.cause = err
|
|
549
|
+
}
|
|
531
550
|
loadErrors.push(err)
|
|
532
551
|
}
|
|
533
552
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@earthmover/icechunk",
|
|
3
|
-
"version": "2.0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "JavaScript/TypeScript bindings for Icechunk",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -19,10 +19,22 @@
|
|
|
19
19
|
"science",
|
|
20
20
|
"geospatial"
|
|
21
21
|
],
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"browser": "./browser.js",
|
|
25
|
+
"default": "./index.js"
|
|
26
|
+
},
|
|
27
|
+
"./fetch-storage": {
|
|
28
|
+
"types": "./fetch-storage.d.ts",
|
|
29
|
+
"default": "./fetch-storage.mjs"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
22
32
|
"files": [
|
|
23
33
|
"index.d.ts",
|
|
24
34
|
"index.js",
|
|
25
|
-
"browser.js"
|
|
35
|
+
"browser.js",
|
|
36
|
+
"fetch-storage.mjs",
|
|
37
|
+
"fetch-storage.d.ts"
|
|
26
38
|
],
|
|
27
39
|
"napi": {
|
|
28
40
|
"binaryName": "icechunk",
|
|
@@ -72,7 +84,8 @@
|
|
|
72
84
|
"oxlint": "^1.14.0",
|
|
73
85
|
"prettier": "^3.6.2",
|
|
74
86
|
"tinybench": "^6.0.0",
|
|
75
|
-
"typescript": "^5.9.2"
|
|
87
|
+
"typescript": "^5.9.2",
|
|
88
|
+
"zarrita": "^0.6.2"
|
|
76
89
|
},
|
|
77
90
|
"lint-staged": {
|
|
78
91
|
"*.@(js|ts|tsx)": [
|
|
@@ -108,9 +121,9 @@
|
|
|
108
121
|
},
|
|
109
122
|
"packageManager": "yarn@4.12.0",
|
|
110
123
|
"optionalDependencies": {
|
|
111
|
-
"@earthmover/icechunk-win32-x64-msvc": "2.0.0
|
|
112
|
-
"@earthmover/icechunk-linux-x64-gnu": "2.0.0
|
|
113
|
-
"@earthmover/icechunk-darwin-arm64": "2.0.0
|
|
114
|
-
"@earthmover/icechunk-wasm32-wasi": "2.0.0
|
|
124
|
+
"@earthmover/icechunk-win32-x64-msvc": "2.0.0",
|
|
125
|
+
"@earthmover/icechunk-linux-x64-gnu": "2.0.0",
|
|
126
|
+
"@earthmover/icechunk-darwin-arm64": "2.0.0",
|
|
127
|
+
"@earthmover/icechunk-wasm32-wasi": "2.0.0"
|
|
115
128
|
}
|
|
116
129
|
}
|