@earthmover/icechunk 2.0.0-alpha.13 → 2.0.0-alpha.14

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.
Files changed (3) hide show
  1. package/index.d.ts +3 -143
  2. package/index.js +24 -5
  3. package/package.json +5 -5
package/index.d.ts CHANGED
@@ -51,8 +51,6 @@ export declare class Session {
51
51
  amend(message: string): Promise<string>
52
52
  flush(message: string): Promise<string>
53
53
  rebase(): Promise<void>
54
- /** Get all virtual chunk locations referenced by this session */
55
- allVirtualChunkLocations(): Promise<Array<string>>
56
54
  }
57
55
  export type JsSession = Session
58
56
 
@@ -66,24 +64,11 @@ export declare class Storage {
66
64
  * especially useful for WASM builds where native Rust networking is unavailable.
67
65
  */
68
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
69
- static newLocalFilesystem(path: string): Promise<Storage>
70
- static newS3(bucket: string, prefix?: string | undefined | null, credentials?: S3Credentials | undefined | null, options?: S3Options | undefined | null): Storage
71
- static newR2(bucket?: string | undefined | null, prefix?: string | undefined | null, accountId?: string | undefined | null, credentials?: S3Credentials | undefined | null, options?: S3Options | undefined | null): Storage
72
- static newTigris(bucket: string, prefix?: string | undefined | null, credentials?: S3Credentials | undefined | null, options?: S3Options | undefined | null, useWeakConsistency?: boolean | undefined | null): Storage
73
- static newS3ObjectStore(bucket: string, prefix?: string | undefined | null, credentials?: S3Credentials | undefined | null, options?: S3Options | undefined | null): Promise<Storage>
74
- static newGcs(bucket: string, prefix?: string | undefined | null, credentials?: GcsCredentials | undefined | null, config?: Record<string, string> | undefined | null): Storage
75
- static newAzureBlob(account: string, container: string, prefix?: string | undefined | null, credentials?: AzureCredentials | undefined | null, config?: Record<string, string> | undefined | null): Promise<Storage>
76
- static newHttp(baseUrl: string, config?: Record<string, string> | undefined | null): Storage
77
- static newS3WithRefreshableCredentials(bucket: string, prefix: string | undefined | null, credentialsCallback: () => Promise<S3StaticCredentials>, initialCredentials?: S3StaticCredentials | undefined | null, options?: S3Options | undefined | null): Storage
78
- static newR2WithRefreshableCredentials(bucket: string | undefined | null, prefix: string | undefined | null, accountId: string | undefined | null, credentialsCallback: () => Promise<S3StaticCredentials>, initialCredentials?: S3StaticCredentials | undefined | null, options?: S3Options | undefined | null): Storage
79
- static newTigrisWithRefreshableCredentials(bucket: string, prefix: string | undefined | null, credentialsCallback: () => Promise<S3StaticCredentials>, initialCredentials?: S3StaticCredentials | undefined | null, options?: S3Options | undefined | null, useWeakConsistency?: boolean | undefined | null): Storage
80
- static newS3ObjectStoreWithRefreshableCredentials(bucket: string, prefix: string | undefined | null, credentialsCallback: () => Promise<S3StaticCredentials>, initialCredentials?: S3StaticCredentials | undefined | null, options?: S3Options | undefined | null): Promise<Storage>
81
- static newGcsWithRefreshableCredentials(bucket: string, prefix: string | undefined | null, credentialsCallback: () => Promise<GcsBearerCredential>, initialCredentials?: GcsBearerCredential | undefined | null, config?: Record<string, string> | undefined | null): Storage
82
67
  }
83
68
  export type JsStorage = Storage
84
69
 
85
70
  export declare class Store {
86
- get(key: string): Promise<Buffer | null>
71
+ get(key: string): Promise<Uint8Array | null>
87
72
  /**
88
73
  * Fetch a byte range from a key.
89
74
  *
@@ -91,7 +76,7 @@ export declare class Store {
91
76
  * { offset: number, length: number } - fetch length bytes starting at offset
92
77
  * { suffixLength: number } - fetch the last suffixLength bytes
93
78
  */
94
- getRange(key: string, range: RangeQuery): Promise<Buffer | null>
79
+ getRange(key: string, range: RangeQuery): Promise<Uint8Array | null>
95
80
  set(key: string, value: Buffer): Promise<void>
96
81
  exists(key: string): Promise<boolean>
97
82
  delete(key: string): Promise<void>
@@ -109,32 +94,9 @@ export declare class Store {
109
94
  deleteDir(prefix: string): Promise<void>
110
95
  getsize(key: string): Promise<number>
111
96
  getsizePrefix(prefix: string): Promise<number>
112
- /**
113
- * Set a single virtual reference to a chunk
114
- *
115
- * For checksum validation, provide either etag_checksum (string) or last_modified (JS Date object).
116
- * If both are provided, etag_checksum takes precedence.
117
- */
118
- setVirtualRef(key: string, location: string, offset: number, length: number, etagChecksum: string | undefined | null, lastModified: Date | undefined | null, validateContainer: boolean): Promise<void>
119
- /**
120
- * Set multiple virtual references for the same array
121
- * Returns the indices of failed chunk references if any
122
- */
123
- setVirtualRefs(arrayPath: string, chunks: Array<VirtualChunkSpec>, validateContainers: boolean): Promise<Array<Array<number>> | null>
124
97
  }
125
98
  export type JsStore = Store
126
99
 
127
- /** Azure credentials */
128
- export type AzureCredentials =
129
- | { type: 'FromEnv' }
130
- | { type: 'Static', field0: AzureStaticCredentials }
131
-
132
- /** Azure static credentials */
133
- export type AzureStaticCredentials =
134
- | { type: 'AccessKey', field0: string }
135
- | { type: 'SasToken', field0: string }
136
- | { type: 'BearerToken', field0: string }
137
-
138
100
  /** Caching configuration */
139
101
  export interface CachingConfig {
140
102
  numSnapshotNodes?: number
@@ -155,12 +117,6 @@ export interface CompressionConfig {
155
117
  level?: number
156
118
  }
157
119
 
158
- /** Credentials for virtual chunk access */
159
- export type Credentials =
160
- | { type: 'S3', field0: S3Credentials }
161
- | { type: 'Gcs', field0: GcsCredentials }
162
- | { type: 'Azure', field0: AzureCredentials }
163
-
164
120
  export interface DiffOptions {
165
121
  fromBranch?: string
166
122
  fromTag?: string
@@ -189,25 +145,6 @@ export interface FeatureFlag {
189
145
  enabled: boolean
190
146
  }
191
147
 
192
- /** GCS bearer credential with optional expiry */
193
- export interface GcsBearerCredential {
194
- bearer: string
195
- expiresAfter?: Date
196
- }
197
-
198
- /** GCS credentials */
199
- export type GcsCredentials =
200
- | { type: 'Anonymous' }
201
- | { type: 'FromEnv' }
202
- | { type: 'Static', field0: GcsStaticCredentials }
203
-
204
- /** GCS static credentials */
205
- export type GcsStaticCredentials =
206
- | { type: 'ServiceAccount', field0: string }
207
- | { type: 'ServiceAccountKey', field0: string }
208
- | { type: 'ApplicationCredentials', field0: string }
209
- | { type: 'BearerToken', field0: string }
210
-
211
148
  export interface ManifestFileInfo {
212
149
  id: string
213
150
  sizeBytes: number
@@ -219,17 +156,6 @@ export interface MovedNode {
219
156
  to: string
220
157
  }
221
158
 
222
- /** Object store configuration for virtual chunk containers */
223
- export type ObjectStoreConfig =
224
- | { type: 'InMemory' }
225
- | { type: 'LocalFileSystem', field0: string }
226
- | { type: 'Http', field0: Record<string, string> }
227
- | { type: 'S3Compatible', field0: S3Options }
228
- | { type: 'S3', field0: S3Options }
229
- | { type: 'Gcs', field0: Record<string, string> }
230
- | { type: 'Azure', field0: Record<string, string> }
231
- | { type: 'Tigris', field0: S3Options }
232
-
233
159
  /**
234
160
  * Range query matching zarrita's RangeQuery type:
235
161
  * { offset: number, length: number } | { suffixLength: number }
@@ -246,28 +172,7 @@ export interface ReadonlySessionOptions {
246
172
  snapshotId?: string
247
173
  }
248
174
 
249
- /**
250
- * Repository configuration
251
- *
252
- * The `manifest` field accepts a JSON object matching the serde serialization
253
- * of `ManifestConfig`. Example:
254
- * ```js
255
- * {
256
- * manifest: {
257
- * preload: {
258
- * max_total_refs: 1000,
259
- * preload_if: { true: null },
260
- * max_arrays_to_scan: 10
261
- * },
262
- * splitting: {
263
- * split_sizes: [
264
- * [{ path_matches: { regex: ".*" } }, [{ condition: "any", num_chunks: 100 }]]
265
- * ]
266
- * }
267
- * }
268
- * }
269
- * ```
270
- */
175
+ /** Repository configuration (WASM build — no virtual chunk support) */
271
176
  export interface RepositoryConfig {
272
177
  inlineChunkThresholdBytes?: number
273
178
  getPartialValuesConcurrency?: number
@@ -280,33 +185,6 @@ export interface RepositoryConfig {
280
185
  * The object is deserialized using serde, matching the Rust ManifestConfig structure.
281
186
  */
282
187
  manifest?: any
283
- /** Virtual chunk containers configuration */
284
- virtualChunkContainers?: Record<string, VirtualChunkContainer>
285
- }
286
-
287
- /** S3 credentials */
288
- export type S3Credentials =
289
- | { type: 'FromEnv' }
290
- | { type: 'Anonymous' }
291
- | { type: 'Static', field0: S3StaticCredentials }
292
-
293
- /** S3 options */
294
- export interface S3Options {
295
- region?: string
296
- endpointUrl?: string
297
- allowHttp?: boolean
298
- anonymous?: boolean
299
- forcePathStyle?: boolean
300
- networkStreamTimeoutSeconds?: number
301
- requesterPays?: boolean
302
- }
303
-
304
- /** S3 static credentials */
305
- export interface S3StaticCredentials {
306
- accessKeyId: string
307
- secretAccessKey: string
308
- sessionToken?: string
309
- expiresAfter?: Date
310
188
  }
311
189
 
312
190
  export interface SnapshotInfo {
@@ -445,21 +323,3 @@ export interface VersionOptions {
445
323
  tag?: string
446
324
  snapshotId?: string
447
325
  }
448
-
449
- /** Virtual chunk container configuration */
450
- export interface VirtualChunkContainer {
451
- name?: string
452
- urlPrefix: string
453
- store: JsObjectStoreConfig
454
- }
455
-
456
- /** Specification for a virtual chunk reference */
457
- export interface VirtualChunkSpec {
458
- index: Array<number>
459
- location: string
460
- offset: number
461
- length: number
462
- etagChecksum?: string
463
- /** Last modified datetime (accepts JS Date object) */
464
- lastModified?: Date
465
- }
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 = []
@@ -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)
@@ -123,6 +137,7 @@ function requireNative() {
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')
@@ -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.cause = err
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-alpha.13",
3
+ "version": "2.0.0-alpha.14",
4
4
  "description": "JavaScript/TypeScript bindings for Icechunk",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -121,9 +121,9 @@
121
121
  },
122
122
  "packageManager": "yarn@4.12.0",
123
123
  "optionalDependencies": {
124
- "@earthmover/icechunk-win32-x64-msvc": "2.0.0-alpha.13",
125
- "@earthmover/icechunk-linux-x64-gnu": "2.0.0-alpha.13",
126
- "@earthmover/icechunk-darwin-arm64": "2.0.0-alpha.13",
127
- "@earthmover/icechunk-wasm32-wasi": "2.0.0-alpha.13"
124
+ "@earthmover/icechunk-win32-x64-msvc": "2.0.0-alpha.14",
125
+ "@earthmover/icechunk-linux-x64-gnu": "2.0.0-alpha.14",
126
+ "@earthmover/icechunk-darwin-arm64": "2.0.0-alpha.14",
127
+ "@earthmover/icechunk-wasm32-wasi": "2.0.0-alpha.14"
128
128
  }
129
129
  }