@lancedb/lancedb 0.29.0 → 0.29.1-beta.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/dist/table.d.ts CHANGED
@@ -61,6 +61,26 @@ export interface Version {
61
61
  timestamp: Date;
62
62
  metadata: Record<string, string>;
63
63
  }
64
+ /**
65
+ * Specification selecting Lance's MemWAL LSM-style write path for
66
+ * `mergeInsert`.
67
+ *
68
+ * `specType` is `"bucket"`, `"identity"`, or `"unsharded"`. For `"bucket"`,
69
+ * `column` and `numBuckets` are required; for `"identity"`, `column` is
70
+ * required.
71
+ */
72
+ export interface LsmWriteSpec {
73
+ /** One of `"bucket"`, `"identity"`, or `"unsharded"`. */
74
+ specType: "bucket" | "identity" | "unsharded";
75
+ /** Bucket and identity variants: the sharding column. */
76
+ column?: string;
77
+ /** Bucket variant: the number of buckets, in `[1, 1024]`. */
78
+ numBuckets?: number;
79
+ /** Names of indexes the MemWAL should keep up to date during writes. */
80
+ maintainedIndexes?: string[];
81
+ /** Default `ShardWriter` configuration recorded in the MemWAL index. */
82
+ writerConfigDefaults?: Record<string, string>;
83
+ }
64
84
  /**
65
85
  * A Table is a collection of Records in a LanceDB Database.
66
86
  *
@@ -366,6 +386,54 @@ export declare abstract class Table {
366
386
  * containing the new version number of the table after dropping the columns.
367
387
  */
368
388
  abstract dropColumns(columnNames: string[]): Promise<DropColumnsResult>;
389
+ /**
390
+ * Set the unenforced primary key for this table to a single column.
391
+ *
392
+ * "Unenforced" means LanceDB does not check uniqueness on writes; the
393
+ * column is recorded in the schema as the primary key for use by features
394
+ * such as `merge_insert`. Only single-column primary keys are supported,
395
+ * and the key cannot be changed once set.
396
+ * @param {string | string[]} columns The primary key column. A one-element
397
+ * array is also accepted; passing more than one column is rejected.
398
+ * @returns {Promise<void>}
399
+ */
400
+ abstract setUnenforcedPrimaryKey(columns: string | string[]): Promise<void>;
401
+ /**
402
+ * Install an {@link LsmWriteSpec} on this table, selecting Lance's MemWAL
403
+ * LSM-style write path for future `mergeInsert` calls.
404
+ *
405
+ * `LsmWriteSpec` chooses one of three sharding strategies via `specType`:
406
+ *
407
+ * - `"bucket"` — hash-bucket writes by the single-column unenforced primary
408
+ * key (`column` and `numBuckets` required).
409
+ * - `"identity"` — shard by the raw value of a scalar `column`.
410
+ * - `"unsharded"` — route every write to a single shard.
411
+ *
412
+ * All variants require the table to have an unenforced primary key
413
+ * ({@link Table#setUnenforcedPrimaryKey}); bucket sharding additionally
414
+ * requires it to be the single column being bucketed.
415
+ * @param {LsmWriteSpec} spec The sharding spec to install.
416
+ * @returns {Promise<void>}
417
+ * @example
418
+ * ```ts
419
+ * await table.setUnenforcedPrimaryKey("id");
420
+ * await table.setLsmWriteSpec({
421
+ * specType: "bucket",
422
+ * column: "id",
423
+ * numBuckets: 16,
424
+ * maintainedIndexes: ["id_idx"],
425
+ * });
426
+ * ```
427
+ */
428
+ abstract setLsmWriteSpec(spec: LsmWriteSpec): Promise<void>;
429
+ /**
430
+ * Remove the {@link LsmWriteSpec} from this table, reverting to the standard
431
+ * `mergeInsert` write path.
432
+ *
433
+ * Errors if no spec is currently set.
434
+ * @returns {Promise<void>}
435
+ */
436
+ abstract unsetLsmWriteSpec(): Promise<void>;
369
437
  /** Retrieve the version of the table */
370
438
  abstract version(): Promise<number>;
371
439
  /**
@@ -527,6 +595,9 @@ export declare class LocalTable extends Table {
527
595
  addColumns(newColumnTransforms: AddColumnsSql[] | Field | Field[] | Schema): Promise<AddColumnsResult>;
528
596
  alterColumns(columnAlterations: ColumnAlteration[]): Promise<AlterColumnsResult>;
529
597
  dropColumns(columnNames: string[]): Promise<DropColumnsResult>;
598
+ setUnenforcedPrimaryKey(columns: string | string[]): Promise<void>;
599
+ setLsmWriteSpec(spec: LsmWriteSpec): Promise<void>;
600
+ unsetLsmWriteSpec(): Promise<void>;
530
601
  version(): Promise<number>;
531
602
  checkout(version: number | string): Promise<void>;
532
603
  checkoutLatest(): Promise<void>;
package/dist/table.js CHANGED
@@ -258,6 +258,16 @@ class LocalTable extends Table {
258
258
  async dropColumns(columnNames) {
259
259
  return await this.inner.dropColumns(columnNames);
260
260
  }
261
+ async setUnenforcedPrimaryKey(columns) {
262
+ const cols = typeof columns === "string" ? [columns] : columns;
263
+ return await this.inner.setUnenforcedPrimaryKey(cols);
264
+ }
265
+ async setLsmWriteSpec(spec) {
266
+ return await this.inner.setLsmWriteSpec(spec);
267
+ }
268
+ async unsetLsmWriteSpec() {
269
+ return await this.inner.unsetLsmWriteSpec();
270
+ }
261
271
  async version() {
262
272
  return await this.inner.version();
263
273
  }
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "ann"
12
12
  ],
13
13
  "private": false,
14
- "version": "0.29.0",
14
+ "version": "0.29.1-beta.0",
15
15
  "main": "dist/index.js",
16
16
  "exports": {
17
17
  ".": "./dist/index.js",
@@ -38,15 +38,15 @@
38
38
  "url": "https://github.com/lancedb/lancedb"
39
39
  },
40
40
  "devDependencies": {
41
- "@aws-sdk/client-dynamodb": "^3.33.0",
42
- "@aws-sdk/client-kms": "^3.33.0",
43
- "@aws-sdk/client-s3": "^3.33.0",
41
+ "@aws-sdk/client-dynamodb": "3.1003.0",
42
+ "@aws-sdk/client-kms": "3.1003.0",
43
+ "@aws-sdk/client-s3": "3.1003.0",
44
44
  "@biomejs/biome": "^1.7.3",
45
45
  "@jest/globals": "^29.7.0",
46
- "@napi-rs/cli": "^3.5.1",
46
+ "@napi-rs/cli": "3.5.1",
47
47
  "@types/axios": "^0.14.0",
48
48
  "@types/jest": "^29.1.2",
49
- "@types/node": "^22.7.4",
49
+ "@types/node": "22.7.4",
50
50
  "@types/tmp": "^0.2.6",
51
51
  "apache-arrow-15": "npm:apache-arrow@15.0.0",
52
52
  "apache-arrow-16": "npm:apache-arrow@16.0.0",
@@ -57,9 +57,9 @@
57
57
  "shx": "^0.3.4",
58
58
  "tmp": "^0.2.3",
59
59
  "ts-jest": "^29.1.2",
60
- "typedoc": "^0.26.4",
61
- "typedoc-plugin-markdown": "^4.2.1",
62
- "typescript": "^5.5.4",
60
+ "typedoc": "0.26.4",
61
+ "typedoc-plugin-markdown": "4.2.1",
62
+ "typescript": "5.5.4",
63
63
  "typescript-eslint": "^7.1.0"
64
64
  },
65
65
  "ava": {
@@ -68,6 +68,7 @@
68
68
  "engines": {
69
69
  "node": ">= 18"
70
70
  },
71
+ "packageManager": "pnpm@11.1.1",
71
72
  "cpu": [
72
73
  "x64",
73
74
  "arm64"
@@ -80,10 +81,10 @@
80
81
  "scripts": {
81
82
  "artifacts": "napi artifacts",
82
83
  "build:debug": "napi build --platform --dts ../lancedb/native.d.ts --js ../lancedb/native.js --output-dir lancedb",
83
- "postbuild:debug": "shx mkdir -p dist && shx cp lancedb/*.node dist/",
84
+ "postbuild:debug": "shx mkdir -p dist && shx cp lancedb/*.node dist/ && node -e \"require('fs').writeFileSync('dist/package.json', JSON.stringify({name:'@lancedb/lancedb',type:'commonjs'}))\"",
84
85
  "build:release": "napi build --platform --release --dts ../lancedb/native.d.ts --js ../lancedb/native.js --output-dir dist",
85
- "build": "npm run build:debug && npm run tsc",
86
- "build-release": "npm run build:release && npm run tsc",
86
+ "build": "pnpm build:debug && pnpm tsc",
87
+ "build-release": "pnpm build:release && pnpm tsc",
87
88
  "tsc": "tsc -b",
88
89
  "posttsc": "shx cp lancedb/native.d.ts dist/native.d.ts",
89
90
  "lint-ci": "biome ci .",
@@ -93,7 +94,7 @@
93
94
  "lint-fix": "biome check --write . && biome format --write .",
94
95
  "prepublishOnly": "napi prepublish -t npm",
95
96
  "test": "jest --verbose",
96
- "integration": "S3_TEST=1 npm run test",
97
+ "integration": "S3_TEST=1 pnpm test",
97
98
  "universal": "napi universalize",
98
99
  "version": "napi version"
99
100
  },
@@ -101,13 +102,13 @@
101
102
  "reflect-metadata": "^0.2.2"
102
103
  },
103
104
  "optionalDependencies": {
104
- "@lancedb/lancedb-darwin-arm64": "0.29.0",
105
- "@lancedb/lancedb-linux-x64-gnu": "0.29.0",
106
- "@lancedb/lancedb-linux-arm64-gnu": "0.29.0",
107
- "@lancedb/lancedb-linux-x64-musl": "0.29.0",
108
- "@lancedb/lancedb-linux-arm64-musl": "0.29.0",
109
- "@lancedb/lancedb-win32-x64-msvc": "0.29.0",
110
- "@lancedb/lancedb-win32-arm64-msvc": "0.29.0"
105
+ "@lancedb/lancedb-darwin-arm64": "0.29.1-beta.0",
106
+ "@lancedb/lancedb-linux-x64-gnu": "0.29.1-beta.0",
107
+ "@lancedb/lancedb-linux-arm64-gnu": "0.29.1-beta.0",
108
+ "@lancedb/lancedb-linux-x64-musl": "0.29.1-beta.0",
109
+ "@lancedb/lancedb-linux-arm64-musl": "0.29.1-beta.0",
110
+ "@lancedb/lancedb-win32-x64-msvc": "0.29.1-beta.0",
111
+ "@lancedb/lancedb-win32-arm64-msvc": "0.29.1-beta.0"
111
112
  },
112
113
  "peerDependencies": {
113
114
  "apache-arrow": ">=15.0.0 <=18.1.0"
@@ -0,0 +1,18 @@
1
+ # Flat node_modules layout. The @napi-rs/cli build step fails to locate
2
+ # the cdylib artifact under pnpm's isolated layout; the hoisted linker
3
+ # mirrors npm's structure and unblocks the native build.
4
+ nodeLinker: hoisted
5
+
6
+ # Block resolution of versions less than 24h old (Shai-Hulud window).
7
+ # This is the pnpm 11 default but pinned here so it's visible to
8
+ # reviewers and survives a future pnpm major flipping the default.
9
+ minimumReleaseAge: 1440
10
+
11
+ # Fail install if a transitive dep tries to run an unapproved script.
12
+ strictDepBuilds: true
13
+
14
+ allowBuilds:
15
+ '@biomejs/biome': true
16
+ onnxruntime-node: true
17
+ protobufjs: true
18
+ sharp: true