@rebasepro/types 0.16.0 → 0.16.1-canary.g701140a

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.
@@ -1,9 +1,9 @@
1
- import type { CollectionConfig, FilterValues, WhereFilterOp } from "./collections";
2
- import type { OrderByTuple } from "./filter-operators";
3
- import type { LogicalCondition } from "../controllers/data";
4
- import type { AuthAdapter } from "./auth_adapter";
5
- import type { HistoryConfig } from "../controllers/client";
6
- import type { ChannelBusSetting } from "./channel_bus";
1
+ import type { CollectionConfig, FilterValues, WhereFilterOp } from "./collections.js";
2
+ import type { OrderByTuple } from "./filter-operators.js";
3
+ import type { LogicalCondition } from "../controllers/data.js";
4
+ import type { AuthAdapter } from "./auth_adapter.js";
5
+ import type { HistoryConfig } from "../controllers/client.js";
6
+ import type { ChannelBusSetting } from "./channel_bus.js";
7
7
  /**
8
8
  * Abstract database connection interface.
9
9
  * Represents a connection to any database system.
@@ -697,7 +697,7 @@ export interface BackendBootstrapper {
697
697
  /**
698
698
  * Initialize WebSocket server for realtime operations.
699
699
  */
700
- initializeWebsockets?(server: unknown, realtimeService: RealtimeProvider, driver: import("../controllers/data_driver").DataDriver, config?: unknown, authAdapter?: AuthAdapter): Promise<void> | void;
700
+ initializeWebsockets?(server: unknown, realtimeService: RealtimeProvider, driver: import("../controllers/data_driver.js").DataDriver, config?: unknown, authAdapter?: AuthAdapter): Promise<void> | void;
701
701
  }
702
702
  /**
703
703
  * Result of `BackendBootstrapper.initializeDriver()`.
@@ -705,7 +705,7 @@ export interface BackendBootstrapper {
705
705
  */
706
706
  export interface InitializedDriver {
707
707
  /** The DataDriver instance, ready for use. */
708
- driver: import("../controllers/data_driver").DataDriver;
708
+ driver: import("../controllers/data_driver.js").DataDriver;
709
709
  /** The realtime service, if the driver created one during init. */
710
710
  realtimeProvider?: RealtimeProvider;
711
711
  /** A collection registry to register schema / tables into. */
@@ -716,7 +716,7 @@ export interface InitializedDriver {
716
716
  * Set by drivers that introspect in `baas` mode; the server serves these
717
717
  * instead of collections loaded from config files.
718
718
  */
719
- collections?: import("./collections").CollectionConfig[];
719
+ collections?: import("./collections.js").CollectionConfig[];
720
720
  /** The underlying database connection (for lifecycle management). */
721
721
  connection?: DatabaseConnection;
722
722
  /**
@@ -1,4 +1,4 @@
1
- import type { CollectionConfig } from "./collections";
1
+ import type { CollectionConfig } from "./collections.js";
2
2
  /**
3
3
  * Serializing collections so they survive a network hop.
4
4
  *
@@ -1,9 +1,9 @@
1
- import type { CollectionCallbacks } from "./entity_callbacks";
2
- import type { Properties, PostgresProperties, FirebaseProperties, MongoProperties } from "./properties";
3
- import type { User } from "../users";
4
- import type { Relation } from "./relations";
5
- import type { SecurityRule } from "./security_rules";
6
- import type { SearchConfig } from "./search";
1
+ import type { CollectionCallbacks } from "./entity_callbacks.js";
2
+ import type { Properties, PostgresProperties, FirebaseProperties, MongoProperties } from "./properties.js";
3
+ import type { User } from "../users/index.js";
4
+ import type { Relation } from "./relations.js";
5
+ import type { SecurityRule } from "./security_rules.js";
6
+ import type { SearchConfig } from "./search.js";
7
7
  /**
8
8
  * Base interface containing all driver-agnostic collection properties.
9
9
  * Use {@link PostgresCollectionConfig} or {@link FirebaseCollectionConfig} for
@@ -475,7 +475,7 @@ export interface EntityChildView<M extends Record<string, unknown> = Record<stri
475
475
  collection: CollectionConfig<M>;
476
476
  source: ChildViewSource;
477
477
  }
478
- export type { WhereFilterOp, FilterValues, WireFilterValues, FilterPreset } from "./filter-operators";
478
+ export type { WhereFilterOp, FilterValues, WireFilterValues, FilterPreset } from "./filter-operators.js";
479
479
  export type InferCollectionConfigType<S extends CollectionConfig> = S extends CollectionConfig<infer M> ? M : never;
480
480
  /**
481
481
  * Configuration for authentication collections.
@@ -1,5 +1,5 @@
1
- import type { RebaseServerClient } from "../controllers/client";
2
- import type { RebaseSdkData } from "../controllers/data";
1
+ import type { RebaseServerClient } from "../controllers/client.js";
2
+ import type { RebaseSdkData } from "../controllers/data.js";
3
3
  /**
4
4
  * Cron Job type definitions for Rebase.
5
5
  *
@@ -1,4 +1,4 @@
1
- import { WhereFilterOp } from "./filter-operators";
1
+ import { WhereFilterOp } from "./filter-operators.js";
2
2
  /**
3
3
  * Describes the capabilities and features supported by a data source (driver).
4
4
  *
@@ -19,10 +19,10 @@
19
19
  *
20
20
  * @group Backend
21
21
  */
22
- import type { DataDriver } from "../controllers/data_driver";
23
- import type { CollectionConfig } from "./collections";
24
- import type { CollectionRegistryInterface, DatabaseAdmin, InitializedDriver, RealtimeProvider, BootstrappedAuth } from "./backend";
25
- import type { HistoryConfig } from "../controllers/client";
22
+ import type { DataDriver } from "../controllers/data_driver.js";
23
+ import type { CollectionConfig } from "./collections.js";
24
+ import type { CollectionRegistryInterface, DatabaseAdmin, InitializedDriver, RealtimeProvider, BootstrappedAuth } from "./backend.js";
25
+ import type { HistoryConfig } from "../controllers/client.js";
26
26
  /**
27
27
  * A `DatabaseAdapter` provides data persistence for Rebase.
28
28
  *
@@ -74,7 +74,7 @@ export interface DatabaseAdapter {
74
74
  * here — turning an adapter-authenticated server's socket into one that
75
75
  * accepted every client as already authenticated.
76
76
  */
77
- initializeWebsockets?(server: unknown, realtimeService: RealtimeProvider, driver: DataDriver, config?: unknown, adapter?: import("./auth_adapter").AuthAdapter): Promise<void> | void;
77
+ initializeWebsockets?(server: unknown, realtimeService: RealtimeProvider, driver: DataDriver, config?: unknown, adapter?: import("./auth_adapter.js").AuthAdapter): Promise<void> | void;
78
78
  /**
79
79
  * Bring the database's collection tables up to date, additively — the boot
80
80
  * companion to `db push`. See `BackendBootstrapper.ensureCollectionSchema`
@@ -1,4 +1,4 @@
1
- import type { SearchMatch } from "./search";
1
+ import type { SearchMatch } from "./search.js";
2
2
  /**
3
3
  * New or existing status
4
4
  * @group Models
@@ -1,7 +1,7 @@
1
- import type { CollectionConfig } from "./collections";
2
- import type { EntityStatus, EntityValues } from "./entities";
3
- import type { User } from "../users";
4
- import type { RebaseCallContext } from "../call_context";
1
+ import type { CollectionConfig } from "./collections.js";
2
+ import type { EntityStatus, EntityValues } from "./entities.js";
3
+ import type { User } from "../users/index.js";
4
+ import type { RebaseCallContext } from "../call_context.js";
5
5
  /**
6
6
  * Lifecycle callbacks for entity CRUD operations.
7
7
  *
@@ -1,29 +1,29 @@
1
- export * from "./entities";
2
- export * from "./filter-operators";
3
- export * from "./chips";
4
- export * from "./properties";
5
- export * from "./admin_block";
6
- export * from "./collections";
7
- export * from "./search";
8
- export * from "./relations";
9
- export * from "./policy";
10
- export * from "./rls-functions";
11
- export * from "./security_rules";
12
- export * from "./entity_callbacks";
13
- export * from "./websockets";
14
- export * from "./backend";
15
- export * from "./channel_bus";
16
- export * from "./data_source";
17
- export * from "./storage_source";
18
- export * from "./cron";
19
- export * from "./backup";
20
- export * from "./component_ref";
21
- export * from "./auth_adapter";
22
- export * from "./database_adapter";
23
- export * from "./api_keys";
24
- export * from "./history";
25
- export * from "./postgres_introspection";
26
- export * from "./project_manifest";
27
- export * from "./collection_contract";
28
- export * from "./schema_version";
29
- export * from "./storage_authorize";
1
+ export * from "./entities.js";
2
+ export * from "./filter-operators.js";
3
+ export * from "./chips.js";
4
+ export * from "./properties.js";
5
+ export * from "./admin_block.js";
6
+ export * from "./collections.js";
7
+ export * from "./search.js";
8
+ export * from "./relations.js";
9
+ export * from "./policy.js";
10
+ export * from "./rls-functions.js";
11
+ export * from "./security_rules.js";
12
+ export * from "./entity_callbacks.js";
13
+ export * from "./websockets.js";
14
+ export * from "./backend.js";
15
+ export * from "./channel_bus.js";
16
+ export * from "./data_source.js";
17
+ export * from "./storage_source.js";
18
+ export * from "./cron.js";
19
+ export * from "./backup.js";
20
+ export * from "./component_ref.js";
21
+ export * from "./auth_adapter.js";
22
+ export * from "./database_adapter.js";
23
+ export * from "./api_keys.js";
24
+ export * from "./history.js";
25
+ export * from "./postgres_introspection.js";
26
+ export * from "./project_manifest.js";
27
+ export * from "./collection_contract.js";
28
+ export * from "./schema_version.js";
29
+ export * from "./storage_authorize.js";
@@ -24,7 +24,7 @@
24
24
  * work: two repositories never need to know about each other, only about the
25
25
  * project.
26
26
  */
27
- import type { StorageSourceDefinition } from "./storage_source";
27
+ import type { StorageSourceDefinition } from "./storage_source.js";
28
28
  /**
29
29
  * Which kind of thing an app is.
30
30
  *
@@ -313,6 +313,35 @@ export interface NativeDependency {
313
313
  * `manifest.json` — generated, and the document the runtime and control plane
314
314
  * both validate against.
315
315
  */
316
+ /**
317
+ * One custom function, as recorded in a built bundle.
318
+ *
319
+ * @see RebaseBundleManifest.functions
320
+ */
321
+ export interface RebaseBundleFunction {
322
+ /**
323
+ * The filename without its extension — which is also the URL segment it
324
+ * mounts at (`/api/functions/<name>`), the API-key permission that grants
325
+ * it, and the name `REBASE_FUNCTIONS_ONLY` selects by. One identity, used
326
+ * everywhere.
327
+ */
328
+ name: string;
329
+ /** Path inside the bundle, so a host can point at the file. */
330
+ file: string;
331
+ /**
332
+ * `false` when the function's own source imports a Node built-in or a
333
+ * package that needs one.
334
+ *
335
+ * Descriptive, never a gate: nothing refuses to build or deploy on this. It
336
+ * says where this function *could* run, not where it should.
337
+ */
338
+ portable: boolean;
339
+ /**
340
+ * Why it is not portable — one short phrase per reason, deduplicated.
341
+ * Absent when it is.
342
+ */
343
+ requires?: string[];
344
+ }
316
345
  export interface RebaseBundleManifest {
317
346
  /** @see BUNDLE_FORMAT_VERSION */
318
347
  bundleFormat: number;
@@ -353,6 +382,28 @@ export interface RebaseBundleManifest {
353
382
  entry: RebaseBundleEntrypoints;
354
383
  /** Collection slugs contained in the bundle, for quick inspection. */
355
384
  collections?: string[];
385
+ /**
386
+ * Every custom function in the bundle, named and classified.
387
+ *
388
+ * Two things are recorded per function, and both are answers a host would
389
+ * otherwise have to get by importing user code:
390
+ *
391
+ * - **What it is called.** That name is the function's identity everywhere —
392
+ * the URL segment it mounts at, the `functions/<name>` API-key
393
+ * permission, the value `REBASE_FUNCTIONS_ONLY` selects by. A host that
394
+ * wants to give one slow function its own replica count currently has to
395
+ * boot the bundle to discover what is in it.
396
+ * - **Whether it needs Node.** Purely descriptive: a function that opens a
397
+ * file or runs raw SQL is a fine function, and every deployment today is
398
+ * a Node process. It is recorded because the question "which of these
399
+ * could run somewhere else" has to be answerable from the artifact, and
400
+ * because answering it per-file after the fact — across a codebase
401
+ * already written — is the expensive version of the same question.
402
+ *
403
+ * Absent on a bundle built before this field existed, which is why every
404
+ * consumer must treat it as optional rather than as an empty list.
405
+ */
406
+ functions?: RebaseBundleFunction[];
356
407
  hooks: {
357
408
  /**
358
409
  * Whether the dependency closure contains native code.
@@ -1,9 +1,9 @@
1
- import type { Entity, EntityReference, EntityRelation, EntityValues, GeoPoint, Vector } from "./entities";
2
- import type { Relation, ResolvedRelation } from "./relations";
3
- import type { ColorKey, ColorScheme } from "./chips";
4
- import type { AuthState } from "../controllers/auth_state";
5
- import type { AfterReadProps, BeforeSaveProps } from "./entity_callbacks";
6
- import type { User } from "../users";
1
+ import type { Entity, EntityReference, EntityRelation, EntityValues, GeoPoint, Vector } from "./entities.js";
2
+ import type { Relation, ResolvedRelation } from "./relations.js";
3
+ import type { ColorKey, ColorScheme } from "./chips.js";
4
+ import type { AuthState } from "../controllers/auth_state.js";
5
+ import type { AfterReadProps, BeforeSaveProps } from "./entity_callbacks.js";
6
+ import type { User } from "../users/index.js";
7
7
  /**
8
8
  * Callbacks/Hooks for individual property fields
9
9
  * @group Entity properties
@@ -324,6 +324,46 @@ export interface BooleanProperty extends BaseProperty {
324
324
  */
325
325
  validation?: PropertyValidationSchema;
326
326
  }
327
+ /**
328
+ * Which pgvector distance a query measures with, and therefore which operator
329
+ * class an index has to be built for. The names match the `distance` option on
330
+ * `vectorSearch`, because an index built for one operator is not used by a
331
+ * query that asks for another.
332
+ *
333
+ * @group Entity properties
334
+ */
335
+ export type VectorDistance = "cosine" | "l2" | "inner_product";
336
+ /**
337
+ * How the ANN index over a vector column is built.
338
+ *
339
+ * Without an index, `vectorSearch` is an exact scan: correct at any size,
340
+ * and linear in the number of rows. With one, it is approximate and fast.
341
+ * That trade is why this is configurable rather than implied.
342
+ *
343
+ * @group Entity properties
344
+ */
345
+ export interface VectorIndexConfig {
346
+ /**
347
+ * `hnsw` (the default) builds a navigable-graph index: slower to build,
348
+ * better recall, and it needs no training data, so it works on an empty
349
+ * table. `ivfflat` is cheaper to build but partitions by centroid, so an
350
+ * index built on an empty or tiny table has useless partitions — build it
351
+ * after the data is loaded, and set {@link lists}.
352
+ */
353
+ method?: "hnsw" | "ivfflat";
354
+ /**
355
+ * Which distance operators to index, defaulting to `cosine` — the default
356
+ * `vectorSearch` measures with. Name several to index several; each one is
357
+ * a separate index with its own build cost and its own storage.
358
+ */
359
+ distance?: VectorDistance | VectorDistance[];
360
+ /** HNSW: connections per node. Postgres defaults to 16. */
361
+ m?: number;
362
+ /** HNSW: candidate-list size while building. Postgres defaults to 64. */
363
+ efConstruction?: number;
364
+ /** IVFFlat: number of partitions. Postgres defaults to 100. */
365
+ lists?: number;
366
+ }
327
367
  export interface VectorProperty extends BaseProperty {
328
368
  type: "vector";
329
369
  /**
@@ -331,6 +371,18 @@ export interface VectorProperty extends BaseProperty {
331
371
  */
332
372
  defaultValue?: Vector;
333
373
  dimensions: number;
374
+ /**
375
+ * ANN index configuration for this column.
376
+ *
377
+ * Omitted, a single HNSW index for cosine distance is created — which is
378
+ * what the default `vectorSearch` uses. `false` creates none, leaving
379
+ * `vectorSearch` an exact scan.
380
+ *
381
+ * Indexes are only created when {@link dimensions} is at most 2000:
382
+ * pgvector cannot index a wider `vector` column, so a 3072-dimension
383
+ * embedding is left unindexed rather than failing the boot.
384
+ */
385
+ index?: VectorIndexConfig | false;
334
386
  validation?: PropertyValidationSchema;
335
387
  }
336
388
  /**
@@ -1,4 +1,4 @@
1
- import type { AnyCollectionConfig } from "./collections";
1
+ import type { AnyCollectionConfig } from "./collections.js";
2
2
  /**
3
3
  * @group Models
4
4
  */
@@ -1,4 +1,4 @@
1
- import type { CollectionConfig } from "./collections";
1
+ import type { CollectionConfig } from "./collections.js";
2
2
  /**
3
3
  * Compute the canonical string a schema version hashes.
4
4
  *
@@ -15,7 +15,7 @@
15
15
  * them with `getPolicyNamesForRule`/`getEffectiveSecurityRules` rather than
16
16
  * matching on `rule.name`.
17
17
  */
18
- import type { PolicyExpression } from "./policy";
18
+ import type { PolicyExpression } from "./policy.js";
19
19
  /**
20
20
  * SQL operation that a policy applies to.
21
21
  * @group Models
@@ -1 +1 @@
1
- export * from "./user";
1
+ export * from "./user.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rebasepro/types",
3
3
  "type": "module",
4
- "version": "0.16.0",
4
+ "version": "0.16.1-canary.g701140a",
5
5
  "description": "Rebase type definitions — shared interfaces and controller types",
6
6
  "funding": {
7
7
  "url": "https://github.com/sponsors/rebaseco"
@@ -88,7 +88,7 @@
88
88
  },
89
89
  "scripts": {
90
90
  "watch": "vite build --watch",
91
- "build": "vite build && tsc --emitDeclarationOnly -p tsconfig.prod.json && node ../../scripts/assert-build-output.mjs",
91
+ "build": "vite build && tsc --emitDeclarationOnly -p tsconfig.prod.json && node ../../scripts/add-dts-extensions.mjs dist && node ../../scripts/assert-build-output.mjs",
92
92
  "test:lint": "eslint \"src/**\" --quiet",
93
93
  "test": "jest --passWithNoTests",
94
94
  "clean": "rm -rf dist && find ./src -name '*.js' -type f | xargs rm -f"
@@ -437,6 +437,19 @@ export interface RebaseServerClient<DB = unknown> extends Omit<RebaseClient<DB>,
437
437
  * Execute raw SQL against the database. Always present server-side for SQL
438
438
  * engines. Values interpolated into the query should be passed via
439
439
  * `params`, referenced as `$1`, `$2`, … placeholders in the query text.
440
+ *
441
+ * **Runtime note.** This is the one accessor on this object that is not
442
+ * portable. It runs on the database owner connection over a TCP socket, so
443
+ * it is available wherever the framework holds that connection — every Node
444
+ * deployment, self-hosted or managed — and not on a host that has no
445
+ * sockets and no business holding owner credentials.
446
+ *
447
+ * Nothing about that is a problem for a Node deployment, and it is not a
448
+ * reason to avoid it there. It is a reason not to build a function's *only*
449
+ * data path on it if that function may later move: `c.get("driver")` and
450
+ * `rebase.dataAsAdmin` go over the same wire wherever they run. A function
451
+ * that genuinely needs raw SQL can ask `runtimeKey()` and degrade, rather
452
+ * than discovering it at the call.
440
453
  */
441
454
  sql(query: string, options?: { database?: string; role?: string; params?: unknown[] }): Promise<Record<string, unknown>[]>;
442
455
  }
@@ -333,6 +333,36 @@ export interface NativeDependency {
333
333
  * `manifest.json` — generated, and the document the runtime and control plane
334
334
  * both validate against.
335
335
  */
336
+ /**
337
+ * One custom function, as recorded in a built bundle.
338
+ *
339
+ * @see RebaseBundleManifest.functions
340
+ */
341
+ export interface RebaseBundleFunction {
342
+ /**
343
+ * The filename without its extension — which is also the URL segment it
344
+ * mounts at (`/api/functions/<name>`), the API-key permission that grants
345
+ * it, and the name `REBASE_FUNCTIONS_ONLY` selects by. One identity, used
346
+ * everywhere.
347
+ */
348
+ name: string;
349
+ /** Path inside the bundle, so a host can point at the file. */
350
+ file: string;
351
+ /**
352
+ * `false` when the function's own source imports a Node built-in or a
353
+ * package that needs one.
354
+ *
355
+ * Descriptive, never a gate: nothing refuses to build or deploy on this. It
356
+ * says where this function *could* run, not where it should.
357
+ */
358
+ portable: boolean;
359
+ /**
360
+ * Why it is not portable — one short phrase per reason, deduplicated.
361
+ * Absent when it is.
362
+ */
363
+ requires?: string[];
364
+ }
365
+
336
366
  export interface RebaseBundleManifest {
337
367
  /** @see BUNDLE_FORMAT_VERSION */
338
368
  bundleFormat: number;
@@ -373,6 +403,28 @@ export interface RebaseBundleManifest {
373
403
  entry: RebaseBundleEntrypoints;
374
404
  /** Collection slugs contained in the bundle, for quick inspection. */
375
405
  collections?: string[];
406
+ /**
407
+ * Every custom function in the bundle, named and classified.
408
+ *
409
+ * Two things are recorded per function, and both are answers a host would
410
+ * otherwise have to get by importing user code:
411
+ *
412
+ * - **What it is called.** That name is the function's identity everywhere —
413
+ * the URL segment it mounts at, the `functions/<name>` API-key
414
+ * permission, the value `REBASE_FUNCTIONS_ONLY` selects by. A host that
415
+ * wants to give one slow function its own replica count currently has to
416
+ * boot the bundle to discover what is in it.
417
+ * - **Whether it needs Node.** Purely descriptive: a function that opens a
418
+ * file or runs raw SQL is a fine function, and every deployment today is
419
+ * a Node process. It is recorded because the question "which of these
420
+ * could run somewhere else" has to be answerable from the artifact, and
421
+ * because answering it per-file after the fact — across a codebase
422
+ * already written — is the expensive version of the same question.
423
+ *
424
+ * Absent on a bundle built before this field existed, which is why every
425
+ * consumer must treat it as optional rather than as an empty list.
426
+ */
427
+ functions?: RebaseBundleFunction[];
376
428
  hooks: {
377
429
  /**
378
430
  * Whether the dependency closure contains native code.
@@ -400,6 +400,48 @@ export interface BooleanProperty extends BaseProperty {
400
400
  validation?: PropertyValidationSchema;
401
401
  }
402
402
 
403
+ /**
404
+ * Which pgvector distance a query measures with, and therefore which operator
405
+ * class an index has to be built for. The names match the `distance` option on
406
+ * `vectorSearch`, because an index built for one operator is not used by a
407
+ * query that asks for another.
408
+ *
409
+ * @group Entity properties
410
+ */
411
+ export type VectorDistance = "cosine" | "l2" | "inner_product";
412
+
413
+ /**
414
+ * How the ANN index over a vector column is built.
415
+ *
416
+ * Without an index, `vectorSearch` is an exact scan: correct at any size,
417
+ * and linear in the number of rows. With one, it is approximate and fast.
418
+ * That trade is why this is configurable rather than implied.
419
+ *
420
+ * @group Entity properties
421
+ */
422
+ export interface VectorIndexConfig {
423
+ /**
424
+ * `hnsw` (the default) builds a navigable-graph index: slower to build,
425
+ * better recall, and it needs no training data, so it works on an empty
426
+ * table. `ivfflat` is cheaper to build but partitions by centroid, so an
427
+ * index built on an empty or tiny table has useless partitions — build it
428
+ * after the data is loaded, and set {@link lists}.
429
+ */
430
+ method?: "hnsw" | "ivfflat";
431
+ /**
432
+ * Which distance operators to index, defaulting to `cosine` — the default
433
+ * `vectorSearch` measures with. Name several to index several; each one is
434
+ * a separate index with its own build cost and its own storage.
435
+ */
436
+ distance?: VectorDistance | VectorDistance[];
437
+ /** HNSW: connections per node. Postgres defaults to 16. */
438
+ m?: number;
439
+ /** HNSW: candidate-list size while building. Postgres defaults to 64. */
440
+ efConstruction?: number;
441
+ /** IVFFlat: number of partitions. Postgres defaults to 100. */
442
+ lists?: number;
443
+ }
444
+
403
445
  export interface VectorProperty extends BaseProperty {
404
446
  type: "vector";
405
447
  /**
@@ -407,6 +449,18 @@ export interface VectorProperty extends BaseProperty {
407
449
  */
408
450
  defaultValue?: Vector;
409
451
  dimensions: number;
452
+ /**
453
+ * ANN index configuration for this column.
454
+ *
455
+ * Omitted, a single HNSW index for cosine distance is created — which is
456
+ * what the default `vectorSearch` uses. `false` creates none, leaving
457
+ * `vectorSearch` an exact scan.
458
+ *
459
+ * Indexes are only created when {@link dimensions} is at most 2000:
460
+ * pgvector cannot index a wider `vector` column, so a 3072-dimension
461
+ * embedding is left unindexed rather than failing the boot.
462
+ */
463
+ index?: VectorIndexConfig | false;
410
464
  validation?: PropertyValidationSchema;
411
465
  }
412
466