Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
616 changes: 580 additions & 36 deletions icechunk-js/icechunk.wasi-browser.js

Large diffs are not rendered by default.

937 changes: 875 additions & 62 deletions icechunk-js/icechunk.wasi.cjs

Large diffs are not rendered by default.

325 changes: 325 additions & 0 deletions icechunk-js/icechunk.wasi.d.cts
Original file line number Diff line number Diff line change
@@ -0,0 +1,325 @@
/* auto-generated by NAPI-RS */
/* eslint-disable */
export declare class Repository {
static create(storage: JsStorage, config?: RepositoryConfig | undefined | null, specVersion?: number | undefined | null, authorizeVirtualChunkAccess?: Record<string, JsCredentials | undefined | null> | undefined | null, checkCleanRoot?: boolean | undefined | null): Promise<Repository>
static open(storage: JsStorage, config?: RepositoryConfig | undefined | null, authorizeVirtualChunkAccess?: Record<string, JsCredentials | undefined | null> | undefined | null): Promise<Repository>
static openOrCreate(storage: JsStorage, config?: RepositoryConfig | undefined | null, specVersion?: number | undefined | null, authorizeVirtualChunkAccess?: Record<string, JsCredentials | undefined | null> | undefined | null, checkCleanRoot?: boolean | undefined | null): Promise<Repository>
static exists(storage: JsStorage, storageSettings?: StorageSettings | undefined | null): Promise<boolean>
readonlySession(options?: ReadonlySessionOptions | undefined | null): Promise<JsSession>
writableSession(branch: string): Promise<JsSession>
listBranches(): Promise<Array<string>>
createBranch(name: string, snapshotId: string): Promise<void>
listTags(): Promise<Array<string>>
createTag(name: string, snapshotId: string): Promise<void>
lookupManifestFiles(snapshotId: string): Promise<Array<JsManifestFileInfo>>
lookupBranch(branch: string): Promise<string>
resetBranch(branch: string, toSnapshotId: string, fromSnapshotId?: string | undefined | null): Promise<void>
deleteBranch(branch: string): Promise<void>
lookupTag(tag: string): Promise<string>
deleteTag(tag: string): Promise<void>
lookupSnapshot(snapshotId: string): Promise<SnapshotInfo>
static fetchSpecVersion(storage: JsStorage, storageSettings?: StorageSettings | undefined | null): Promise<number | null>
static fetchConfig(storage: JsStorage): Promise<RepositoryConfig | null>
saveConfig(): Promise<void>
get config(): RepositoryConfig
get specVersion(): number
diff(options: DiffOptions): Promise<DiffResult>
featureFlags(): Promise<Array<FeatureFlag>>
enabledFeatureFlags(): Promise<Array<FeatureFlag>>
disabledFeatureFlags(): Promise<Array<FeatureFlag>>
setFeatureFlag(name: string, setting?: boolean | undefined | null): Promise<void>
rearrangeSession(branch: string): Promise<JsSession>
ancestry(options: VersionOptions): Promise<Array<SnapshotInfo>>
}
export type JsRepository = Repository

export declare class Session {
get readOnly(): boolean
get snapshotId(): string
get branch(): string | null
get hasUncommittedChanges(): boolean
get store(): JsStore
commit(message: string): Promise<string>
discardChanges(): Promise<void>
get isFork(): boolean
get mode(): string
get config(): RepositoryConfig
status(): Promise<DiffResult>
moveNode(fromPath: string, toPath: string): Promise<void>
getNodeId(path: string): Promise<string>
merge(other: Session): Promise<void>
amend(message: string): Promise<string>
flush(message: string): Promise<string>
rebase(): Promise<void>
}
export type JsSession = Session

export declare class Storage {
static newInMemory(): Promise<Storage>
/**
* Create a Storage backed by a JS object implementing the StorageBackend interface.
*
* This allows providing a custom storage implementation using JS libraries
* (fetch, @aws-sdk/client-s3, @google-cloud/storage, etc.), which is
* especially useful for WASM builds where native Rust networking is unavailable.
*/
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
}
export type JsStorage = Storage

export declare class Store {
get(key: string): Promise<Uint8Array | null>
/**
* Fetch a byte range from a key.
*
* Accepts zarrita's RangeQuery format:
* { offset: number, length: number } - fetch length bytes starting at offset
* { suffixLength: number } - fetch the last suffixLength bytes
*/
getRange(key: string, range: RangeQuery): Promise<Uint8Array | null>
set(key: string, value: Buffer): Promise<void>
exists(key: string): Promise<boolean>
delete(key: string): Promise<void>
list(): Promise<Array<string>>
listPrefix(prefix: string): Promise<Array<string>>
listDir(prefix: string): Promise<Array<string>>
get supportsWrites(): boolean
get supportsDeletes(): boolean
get supportsListing(): boolean
get readOnly(): Promise<boolean>
get session(): Session
isEmpty(prefix: string): Promise<boolean>
clear(): Promise<void>
setIfNotExists(key: string, value: Buffer): Promise<void>
deleteDir(prefix: string): Promise<void>
getsize(key: string): Promise<number>
getsizePrefix(prefix: string): Promise<number>
}
export type JsStore = Store

/** Caching configuration */
export interface CachingConfig {
numSnapshotNodes?: number
numChunkRefs?: number
numTransactionChanges?: number
numBytesAttributes?: number
numBytesChunks?: number
}

/** Compression algorithm */
export declare const enum CompressionAlgorithm {
Zstd = 0
}

/** Compression configuration */
export interface CompressionConfig {
algorithm?: CompressionAlgorithm
level?: number
}

export interface DiffOptions {
fromBranch?: string
fromTag?: string
fromSnapshotId?: string
toBranch?: string
toTag?: string
toSnapshotId?: string
}

export interface DiffResult {
newGroups: Array<string>
newArrays: Array<string>
deletedGroups: Array<string>
deletedArrays: Array<string>
updatedGroups: Array<string>
updatedArrays: Array<string>
updatedChunks: any
movedNodes: Array<JsMovedNode>
}

export interface FeatureFlag {
id: number
name: string
defaultEnabled: boolean
setting?: boolean
enabled: boolean
}

export interface ManifestFileInfo {
id: string
sizeBytes: number
numChunkRefs: number
}

export interface MovedNode {
from: string
to: string
}

/**
* Range query matching zarrita's RangeQuery type:
* { offset: number, length: number } | { suffixLength: number }
*/
export interface RangeQuery {
offset?: number
length?: number
suffixLength?: number
}

export interface ReadonlySessionOptions {
branch?: string
tag?: string
snapshotId?: string
}

/** Repository configuration (WASM build — no virtual chunk support) */
export interface RepositoryConfig {
inlineChunkThresholdBytes?: number
getPartialValuesConcurrency?: number
compression?: CompressionConfig
maxConcurrentRequests?: number
caching?: CachingConfig
storage?: StorageSettings
/**
* Manifest configuration, passed as a JSON-compatible object.
* The object is deserialized using serde, matching the Rust ManifestConfig structure.
*/
manifest?: any
}

export interface SnapshotInfo {
id: string
parentId?: string
writtenAt: string
message: string
metadata: any
}

/** Storage concurrency settings */
export interface StorageConcurrencySettings {
maxConcurrentRequestsForObject?: number
idealConcurrentRequestSize?: number
}

/** Arguments for copy_object callback */
export interface StorageCopyObjectArgs {
from: string
to: string
contentType?: string
version: StorageVersionInfo
}

/** Arguments for delete_batch callback */
export interface StorageDeleteBatchArgs {
prefix: string
batch: Array<StorageDeleteItem>
}

/** An item in a delete_batch call */
export interface StorageDeleteItem {
id: string
size: number
}

/** Result of a delete_batch call from JS */
export interface StorageDeleteObjectsResult {
deletedObjects: number
deletedBytes: number
}

/** Result of a get_object_conditional call from JS */
export interface StorageGetModifiedResult {
/** "modified" or "on_latest_version" */
kind: string
data?: Buffer
newVersion?: StorageVersionInfo
}

/** Arguments for get_object_conditional callback */
export interface StorageGetObjectConditionalArgs {
path: string
previousVersion?: StorageVersionInfo
}

/** Arguments for get_object_range callback */
export interface StorageGetObjectRangeArgs {
path: string
rangeStart?: number
rangeEnd?: number
}

/** Result of a get_object_range call from JS */
export interface StorageGetObjectResponse {
data: Buffer
version: StorageVersionInfo
}

/** A key-value pair for object metadata */
export interface StorageKeyValue {
key: string
value: string
}

/** Entry in a list_objects result from JS */
export interface StorageListInfo {
id: string
createdAt: Date
sizeBytes: number
}

/** Arguments for put_object callback */
export interface StoragePutObjectArgs {
path: string
data: Buffer
contentType?: string
metadata: Array<StorageKeyValue>
previousVersion?: StorageVersionInfo
}

/** Storage retries settings */
export interface StorageRetriesSettings {
maxTries?: number
initialBackoffMs?: number
maxBackoffMs?: number
}

/** Storage settings */
export interface StorageSettings {
concurrency?: StorageConcurrencySettings
retries?: StorageRetriesSettings
timeouts?: StorageTimeoutSettings
unsafeUseConditionalUpdate?: boolean
unsafeUseConditionalCreate?: boolean
unsafeUseMetadata?: boolean
storageClass?: string
metadataStorageClass?: string
chunksStorageClass?: string
minimumSizeForMultipartUpload?: number
}

/** Storage timeout settings */
export interface StorageTimeoutSettings {
connectTimeoutMs?: number
readTimeoutMs?: number
operationTimeoutMs?: number
operationAttemptTimeoutMs?: number
}

/** Result of a put_object or copy_object call from JS */
export interface StorageVersionedUpdateResult {
/** "updated" or "not_on_latest_version" */
kind: string
newVersion?: StorageVersionInfo
}

/** Version information returned from JS storage callbacks */
export interface StorageVersionInfo {
etag?: string
generation?: string
}

export interface VersionOptions {
branch?: string
tag?: string
snapshotId?: string
}
Loading
Loading