@lancedb/lancedb 0.39.0-beta.8 → 0.40.0-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/oauth.js CHANGED
@@ -2,7 +2,8 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  // SPDX-FileCopyrightText: Copyright The LanceDB Authors
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.OAuthFlowType = void 0;
5
+ exports.OAuthSession = exports.ClientAuthMethod = exports.OAuthFlowType = void 0;
6
+ const native_1 = require("./native");
6
7
  /**
7
8
  * OAuth authentication flow types.
8
9
  */
@@ -10,6 +11,101 @@ var OAuthFlowType;
10
11
  (function (OAuthFlowType) {
11
12
  /** Client Credentials grant (service-to-service / M2M). */
12
13
  OAuthFlowType["ClientCredentials"] = "client_credentials";
14
+ /** Interactive Authorization Code grant, using PKCE by default. */
15
+ OAuthFlowType["AuthorizationCode"] = "authorization_code";
16
+ /** Device Authorization grant for CLI and headless environments. */
17
+ OAuthFlowType["DeviceCode"] = "device_code";
13
18
  /** Azure Managed Identity via IMDS. */
14
19
  OAuthFlowType["AzureManagedIdentity"] = "azure_managed_identity";
15
20
  })(OAuthFlowType || (exports.OAuthFlowType = OAuthFlowType = {}));
21
+ /**
22
+ * How the client authenticates to the OAuth token endpoint.
23
+ *
24
+ * The method applies to every OAuth request that carries client
25
+ * authentication: client-credentials, authorization-code exchange,
26
+ * refresh-token, and device-authorization requests. The Azure managed
27
+ * identity flow ignores this option.
28
+ */
29
+ var ClientAuthMethod;
30
+ (function (ClientAuthMethod) {
31
+ /**
32
+ * No client authentication, for public clients using PKCE or the device
33
+ * flow. Cannot be combined with `clientSecret`.
34
+ */
35
+ ClientAuthMethod["None"] = "none";
36
+ /**
37
+ * HTTP Basic authentication. This is the RFC 6749 recommended method and
38
+ * the normal default for confidential clients, including default Okta
39
+ * applications. Requires `clientSecret`.
40
+ */
41
+ ClientAuthMethod["ClientSecretBasic"] = "client_secret_basic";
42
+ /**
43
+ * Credentials in the request body, for providers configured to require it.
44
+ * Requires `clientSecret`.
45
+ */
46
+ ClientAuthMethod["ClientSecretPost"] = "client_secret_post";
47
+ })(ClientAuthMethod || (exports.ClientAuthMethod = ClientAuthMethod = {}));
48
+ /**
49
+ * Explicit OAuth session lifecycle for the persistent token cache: eager
50
+ * `login`, non-secret `status`, and local `logout`.
51
+ *
52
+ * A session is built from the same {@link OAuthConfig} used to connect
53
+ * (including its `tokenCache` options). A connection created with the same
54
+ * configuration shares the cache, so logging in here prepares tokens for
55
+ * later processes without any database request.
56
+ *
57
+ * `login` always runs the configured interactive flow and replaces the cached
58
+ * session (the most recent login wins). `logout` removes only the local
59
+ * credential; it does not revoke anything with the provider and does not sign
60
+ * out of a browser SSO session.
61
+ *
62
+ * @example
63
+ * ```typescript
64
+ * const config: OAuthConfig = {
65
+ * issuerUrl: "https://issuer.example.com",
66
+ * clientId: "my-app",
67
+ * scopes: ["openid", "offline_access"],
68
+ * flow: OAuthFlowType.DeviceCode,
69
+ * tokenCache: { cacheDir: "/tmp/my-app/oauth-cache" },
70
+ * };
71
+ * const session = new OAuthSession(config);
72
+ * const status = await session.login();
73
+ * ```
74
+ */
75
+ class OAuthSession {
76
+ inner;
77
+ /** Create a session manager for the given OAuth configuration. */
78
+ constructor(config) {
79
+ this.inner = new native_1.OAuthSession(config);
80
+ }
81
+ /**
82
+ * Eagerly run the configured authentication flow and store the session.
83
+ *
84
+ * A successful login always replaces any prior cached session for this
85
+ * identity; if the provider does not issue a refresh token (for example
86
+ * without `offline_access`), the previous record is removed and the status
87
+ * reports `refreshable == false`.
88
+ */
89
+ async login() {
90
+ return this.inner.login();
91
+ }
92
+ /**
93
+ * Report whether a matching cached session exists, with safe metadata.
94
+ *
95
+ * This never contacts the identity provider and never exposes token values.
96
+ */
97
+ async status() {
98
+ return this.inner.status();
99
+ }
100
+ /**
101
+ * Remove the matching local cached credential.
102
+ *
103
+ * This only deletes the local cache entry. It does not revoke the refresh
104
+ * token with the provider and does not sign out of a browser SSO session.
105
+ * Repeated calls succeed; `removed` reports whether a credential existed.
106
+ */
107
+ async logout() {
108
+ return this.inner.logout();
109
+ }
110
+ }
111
+ exports.OAuthSession = OAuthSession;
package/dist/table.d.ts CHANGED
@@ -90,7 +90,8 @@ export interface OptimizeOptions {
90
90
  * olderThan.setDate(olderThan.getDate() - 1));
91
91
  * tbl.optimize({cleanupOlderThan: olderThan});
92
92
  *
93
- * // Delete all versions except the current version
93
+ * // Delete versions committed before this point. Versions created by the
94
+ * // optimize call itself are newer than the cutoff and will be retained.
94
95
  * tbl.optimize({cleanupOlderThan: new Date()});
95
96
  */
96
97
  cleanupOlderThan: Date;
@@ -520,10 +521,12 @@ export declare abstract class Table {
520
521
  * Recompute this table's contents from its materialized-view definition.
521
522
  *
522
523
  * Plumbing for {@link MaterializedView.refresh}, which is the way to call
523
- * it: rejects tables that carry no view definition. Local tables only.
524
+ * it: rejects tables that carry no view definition.
524
525
  * @ignore
525
526
  */
526
527
  abstract refreshMaterializedView(full?: boolean, sourceVersion?: number): Promise<RefreshMaterializedViewResult>;
528
+ /** @ignore */
529
+ abstract materializedViewDefinition(): Promise<string>;
527
530
  /**
528
531
  * Alter the name or nullability of columns.
529
532
  * @param {ColumnAlteration[]} columnAlterations One or more alterations to
@@ -894,6 +897,7 @@ export declare class LocalTable extends Table {
894
897
  refreshColumn(column: string): Promise<RefreshColumnResult>;
895
898
  refreshColumnAsync(column: string): Promise<Job>;
896
899
  refreshMaterializedView(full?: boolean, sourceVersion?: number): Promise<RefreshMaterializedViewResult>;
900
+ materializedViewDefinition(): Promise<string>;
897
901
  alterColumns(columnAlterations: ColumnAlteration[]): Promise<AlterColumnsResult>;
898
902
  updateFieldMetadata(updates: FieldMetadataUpdate[]): Promise<UpdateFieldMetadataResult>;
899
903
  dropColumns(columnNames: string[]): Promise<DropColumnsResult>;
package/dist/table.js CHANGED
@@ -278,6 +278,9 @@ class LocalTable extends Table {
278
278
  async refreshMaterializedView(full, sourceVersion) {
279
279
  return await this.inner.refreshMaterializedView(full, sourceVersion);
280
280
  }
281
+ async materializedViewDefinition() {
282
+ return await this.inner.materializedViewDefinition();
283
+ }
281
284
  async alterColumns(columnAlterations) {
282
285
  const processedAlterations = columnAlterations.map((alteration) => {
283
286
  if (typeof alteration.dataType === "string") {
@@ -371,13 +374,7 @@ class LocalTable extends Table {
371
374
  return this.inner.currentBranch() ?? null;
372
375
  }
373
376
  async optimize(options) {
374
- let cleanupOlderThanMs;
375
- if (options?.cleanupOlderThan !== undefined &&
376
- options?.cleanupOlderThan !== null) {
377
- cleanupOlderThanMs =
378
- new Date().getTime() - options.cleanupOlderThan.getTime();
379
- }
380
- return await this.inner.optimize(cleanupOlderThanMs, options?.deleteUnverified);
377
+ return await this.inner.optimize(options?.cleanupOlderThan?.getTime(), options?.deleteUnverified);
381
378
  }
382
379
  async listIndices() {
383
380
  return await this.inner.listIndices();
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "ann"
12
12
  ],
13
13
  "private": false,
14
- "version": "0.39.0-beta.8",
14
+ "version": "0.40.0-beta.0",
15
15
  "main": "dist/index.js",
16
16
  "exports": {
17
17
  ".": "./dist/index.js",
@@ -106,13 +106,13 @@
106
106
  "optionalDependencies": {
107
107
  "@huggingface/transformers": "3.0.2",
108
108
  "openai": "4.29.2",
109
- "@lancedb/lancedb-darwin-arm64": "0.39.0-beta.8",
110
- "@lancedb/lancedb-linux-x64-gnu": "0.39.0-beta.8",
111
- "@lancedb/lancedb-linux-arm64-gnu": "0.39.0-beta.8",
112
- "@lancedb/lancedb-linux-x64-musl": "0.39.0-beta.8",
113
- "@lancedb/lancedb-linux-arm64-musl": "0.39.0-beta.8",
114
- "@lancedb/lancedb-win32-x64-msvc": "0.39.0-beta.8",
115
- "@lancedb/lancedb-win32-arm64-msvc": "0.39.0-beta.8"
109
+ "@lancedb/lancedb-darwin-arm64": "0.40.0-beta.0",
110
+ "@lancedb/lancedb-linux-x64-gnu": "0.40.0-beta.0",
111
+ "@lancedb/lancedb-linux-arm64-gnu": "0.40.0-beta.0",
112
+ "@lancedb/lancedb-linux-x64-musl": "0.40.0-beta.0",
113
+ "@lancedb/lancedb-linux-arm64-musl": "0.40.0-beta.0",
114
+ "@lancedb/lancedb-win32-x64-msvc": "0.40.0-beta.0",
115
+ "@lancedb/lancedb-win32-arm64-msvc": "0.40.0-beta.0"
116
116
  },
117
117
  "peerDependencies": {
118
118
  "@types/node": ">=22",