@nexo-labs/payload-typesense 1.4.4 → 1.5.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/index.d.mts CHANGED
@@ -23,12 +23,12 @@
23
23
  /// <reference path="./server.d.ts" />
24
24
 
25
25
  /// <reference types="node" />
26
+ import { AdapterSearchResult, BaseCollectionSchema, BaseDocument, EmbeddingProviderConfig, EmbeddingProviderConfig as EmbeddingProviderConfig$1, FieldMapping, IndexDocument, IndexerAdapter, PayloadDocument, TableConfig, VectorSearchOptions } from "@nexo-labs/payload-indexer";
26
27
  import * as React$2 from "react";
27
28
  import React$1, { CSSProperties, Component as Component$1, ReactNode, cloneElement } from "react";
28
29
  import { URL as URL$1, URLSearchParams as URLSearchParams$1 } from "url";
29
30
  import GraphQL, { ExecutionArgs, ExecutionResult, GraphQLFormattedError, GraphQLInputObjectType, GraphQLNonNull, GraphQLObjectType, GraphQLSchema, ValidationRule } from "graphql";
30
31
  import { BusboyConfig } from "busboy";
31
- import { JSONSchema4 } from "json-schema";
32
32
  import { Agent } from "http";
33
33
  import { Agent as Agent$1 } from "https";
34
34
  import { ParsedUrlQuery } from "querystring";
@@ -1123,36 +1123,248 @@ type Primitive = string | number | boolean | bigint | symbol | undefined | null;
1123
1123
  type Builtin = Primitive | Function | Date | Error | RegExp;
1124
1124
  //#endregion
1125
1125
  //#region ../../node_modules/.pnpm/ts-essentials@10.0.3_typescript@5.7.3/node_modules/ts-essentials/dist/is-any/index.d.ts
1126
- type IsAny<Type$1> = 0 extends 1 & Type$1 ? true : false;
1126
+ type IsAny<Type> = 0 extends 1 & Type ? true : false;
1127
1127
  //#endregion
1128
1128
  //#region ../../node_modules/.pnpm/ts-essentials@10.0.3_typescript@5.7.3/node_modules/ts-essentials/dist/is-unknown/index.d.ts
1129
- type IsUnknown<Type$1> = IsAny<Type$1> extends true ? false : unknown extends Type$1 ? true : false;
1129
+ type IsUnknown<Type> = IsAny<Type> extends true ? false : unknown extends Type ? true : false;
1130
1130
  //#endregion
1131
1131
  //#region ../../node_modules/.pnpm/ts-essentials@10.0.3_typescript@5.7.3/node_modules/ts-essentials/dist/mark-optional/index.d.ts
1132
- type MarkOptional<Type$1, Keys$2 extends keyof Type$1> = Type$1 extends Type$1 ? Omit<Type$1, Keys$2> & Partial<Pick<Type$1, Keys$2>> : never;
1132
+ type MarkOptional<Type, Keys$2 extends keyof Type> = Type extends Type ? Omit<Type, Keys$2> & Partial<Pick<Type, Keys$2>> : never;
1133
1133
  //#endregion
1134
1134
  //#region ../../node_modules/.pnpm/ts-essentials@10.0.3_typescript@5.7.3/node_modules/ts-essentials/dist/mark-required/index.d.ts
1135
- type MarkRequired<Type$1, Keys$2 extends keyof Type$1> = Type$1 extends Type$1 ? Type$1 & Required<Pick<Type$1, Keys$2>> : never;
1135
+ type MarkRequired<Type, Keys$2 extends keyof Type> = Type extends Type ? Type & Required<Pick<Type, Keys$2>> : never;
1136
1136
  //#endregion
1137
1137
  //#region ../../node_modules/.pnpm/ts-essentials@10.0.3_typescript@5.7.3/node_modules/ts-essentials/dist/is-tuple/index.d.ts
1138
- type IsTuple<Type$1> = Type$1 extends readonly any[] ? (any[] extends Type$1 ? never : Type$1) : never;
1138
+ type IsTuple<Type> = Type extends readonly any[] ? (any[] extends Type ? never : Type) : never;
1139
1139
  //#endregion
1140
1140
  //#region ../../node_modules/.pnpm/ts-essentials@10.0.3_typescript@5.7.3/node_modules/ts-essentials/dist/deep-partial/index.d.ts
1141
- type DeepPartial<Type$1> = Type$1 extends Exclude<Builtin, Error> ? Type$1 : Type$1 extends Map<infer Keys, infer Values> ? Map<DeepPartial<Keys>, DeepPartial<Values>> : Type$1 extends ReadonlyMap<infer Keys, infer Values> ? ReadonlyMap<DeepPartial<Keys>, DeepPartial<Values>> : Type$1 extends WeakMap<infer Keys, infer Values> ? WeakMap<DeepPartial<Keys>, DeepPartial<Values>> : Type$1 extends Set<infer Values> ? Set<DeepPartial<Values>> : Type$1 extends ReadonlySet<infer Values> ? ReadonlySet<DeepPartial<Values>> : Type$1 extends WeakSet<infer Values> ? WeakSet<DeepPartial<Values>> : Type$1 extends ReadonlyArray<infer Values> ? Type$1 extends IsTuple<Type$1> ? { [Key in keyof Type$1]?: DeepPartial<Type$1[Key]> } : Type$1 extends Array<Values> ? Array<DeepPartial<Values> | undefined> : ReadonlyArray<DeepPartial<Values> | undefined> : Type$1 extends Promise<infer Value> ? Promise<DeepPartial<Value>> : Type$1 extends {} ? { [Key in keyof Type$1]?: DeepPartial<Type$1[Key]> } : IsUnknown<Type$1> extends true ? unknown : Partial<Type$1>;
1141
+ type DeepPartial<Type> = Type extends Exclude<Builtin, Error> ? Type : Type extends Map<infer Keys, infer Values> ? Map<DeepPartial<Keys>, DeepPartial<Values>> : Type extends ReadonlyMap<infer Keys, infer Values> ? ReadonlyMap<DeepPartial<Keys>, DeepPartial<Values>> : Type extends WeakMap<infer Keys, infer Values> ? WeakMap<DeepPartial<Keys>, DeepPartial<Values>> : Type extends Set<infer Values> ? Set<DeepPartial<Values>> : Type extends ReadonlySet<infer Values> ? ReadonlySet<DeepPartial<Values>> : Type extends WeakSet<infer Values> ? WeakSet<DeepPartial<Values>> : Type extends ReadonlyArray<infer Values> ? Type extends IsTuple<Type> ? { [Key in keyof Type]?: DeepPartial<Type[Key]> } : Type extends Array<Values> ? Array<DeepPartial<Values> | undefined> : ReadonlyArray<DeepPartial<Values> | undefined> : Type extends Promise<infer Value> ? Promise<DeepPartial<Value>> : Type extends {} ? { [Key in keyof Type]?: DeepPartial<Type[Key]> } : IsUnknown<Type> extends true ? unknown : Partial<Type>;
1142
1142
  //#endregion
1143
1143
  //#region ../../node_modules/.pnpm/ts-essentials@10.0.3_typescript@5.7.3/node_modules/ts-essentials/dist/deep-required/index.d.ts
1144
- type DeepRequired<Type$1> = Type$1 extends Error ? Required<Type$1> : Type$1 extends Builtin ? Type$1 : Type$1 extends Map<infer Keys, infer Values> ? Map<DeepRequired<Keys>, DeepRequired<Values>> : Type$1 extends ReadonlyMap<infer Keys, infer Values> ? ReadonlyMap<DeepRequired<Keys>, DeepRequired<Values>> : Type$1 extends WeakMap<infer Keys, infer Values> ? WeakMap<DeepRequired<Keys>, DeepRequired<Values>> : Type$1 extends Set<infer Values> ? Set<DeepRequired<Values>> : Type$1 extends ReadonlySet<infer Values> ? ReadonlySet<DeepRequired<Values>> : Type$1 extends WeakSet<infer Values> ? WeakSet<DeepRequired<Values>> : Type$1 extends Promise<infer Value> ? Promise<DeepRequired<Value>> : Type$1 extends ReadonlyArray<infer Values> ? Type$1 extends IsTuple<Type$1> ? { [Key in keyof Type$1]-?: DeepRequired<Type$1[Key]> } : Type$1 extends Array<Values> ? Array<Exclude<DeepRequired<Values>, undefined>> : ReadonlyArray<Exclude<DeepRequired<Values>, undefined>> : Type$1 extends {} ? { [Key in keyof Type$1]-?: DeepRequired<Type$1[Key]> } : Required<Type$1>;
1144
+ type DeepRequired<Type> = Type extends Error ? Required<Type> : Type extends Builtin ? Type : Type extends Map<infer Keys, infer Values> ? Map<DeepRequired<Keys>, DeepRequired<Values>> : Type extends ReadonlyMap<infer Keys, infer Values> ? ReadonlyMap<DeepRequired<Keys>, DeepRequired<Values>> : Type extends WeakMap<infer Keys, infer Values> ? WeakMap<DeepRequired<Keys>, DeepRequired<Values>> : Type extends Set<infer Values> ? Set<DeepRequired<Values>> : Type extends ReadonlySet<infer Values> ? ReadonlySet<DeepRequired<Values>> : Type extends WeakSet<infer Values> ? WeakSet<DeepRequired<Values>> : Type extends Promise<infer Value> ? Promise<DeepRequired<Value>> : Type extends ReadonlyArray<infer Values> ? Type extends IsTuple<Type> ? { [Key in keyof Type]-?: DeepRequired<Type[Key]> } : Type extends Array<Values> ? Array<Exclude<DeepRequired<Values>, undefined>> : ReadonlyArray<Exclude<DeepRequired<Values>, undefined>> : Type extends {} ? { [Key in keyof Type]-?: DeepRequired<Type[Key]> } : Required<Type>;
1145
1145
  //#endregion
1146
1146
  //#region ../../node_modules/.pnpm/ts-essentials@10.0.3_typescript@5.7.3/node_modules/ts-essentials/dist/deep-undefinable/index.d.ts
1147
- type DeepUndefinable<Type$1> = Type$1 extends Builtin ? Type$1 | undefined : Type$1 extends Map<infer Keys, infer Values> ? Map<DeepUndefinable<Keys>, DeepUndefinable<Values>> : Type$1 extends ReadonlyMap<infer Keys, infer Values> ? ReadonlyMap<DeepUndefinable<Keys>, DeepUndefinable<Values>> : Type$1 extends WeakMap<infer Keys, infer Values> ? DeepUndefinable<Keys> extends object ? WeakMap<DeepUndefinable<Keys>, DeepUndefinable<Values>> : never : Type$1 extends Set<infer Values> ? Set<DeepUndefinable<Values>> : Type$1 extends ReadonlySet<infer Values> ? ReadonlySet<DeepUndefinable<Values>> : Type$1 extends WeakSet<infer Values> ? DeepUndefinable<Values> extends object ? WeakSet<DeepUndefinable<Values>> : never : Type$1 extends ReadonlyArray<infer Values> ? Type$1 extends IsTuple<Type$1> ? { [Key in keyof Type$1]: DeepUndefinable<Type$1[Key]> | undefined } : Type$1 extends Array<Values> ? Array<DeepUndefinable<Values>> : ReadonlyArray<DeepUndefinable<Values>> : Type$1 extends Promise<infer Value> ? Promise<DeepUndefinable<Value>> : Type$1 extends {} ? { [Key in keyof Type$1]: DeepUndefinable<Type$1[Key]> } : Type$1 | undefined;
1147
+ type DeepUndefinable<Type> = Type extends Builtin ? Type | undefined : Type extends Map<infer Keys, infer Values> ? Map<DeepUndefinable<Keys>, DeepUndefinable<Values>> : Type extends ReadonlyMap<infer Keys, infer Values> ? ReadonlyMap<DeepUndefinable<Keys>, DeepUndefinable<Values>> : Type extends WeakMap<infer Keys, infer Values> ? DeepUndefinable<Keys> extends object ? WeakMap<DeepUndefinable<Keys>, DeepUndefinable<Values>> : never : Type extends Set<infer Values> ? Set<DeepUndefinable<Values>> : Type extends ReadonlySet<infer Values> ? ReadonlySet<DeepUndefinable<Values>> : Type extends WeakSet<infer Values> ? DeepUndefinable<Values> extends object ? WeakSet<DeepUndefinable<Values>> : never : Type extends ReadonlyArray<infer Values> ? Type extends IsTuple<Type> ? { [Key in keyof Type]: DeepUndefinable<Type[Key]> | undefined } : Type extends Array<Values> ? Array<DeepUndefinable<Values>> : ReadonlyArray<DeepUndefinable<Values>> : Type extends Promise<infer Value> ? Promise<DeepUndefinable<Value>> : Type extends {} ? { [Key in keyof Type]: DeepUndefinable<Type[Key]> } : Type | undefined;
1148
1148
  //#endregion
1149
1149
  //#region ../../node_modules/.pnpm/ts-essentials@10.0.3_typescript@5.7.3/node_modules/ts-essentials/dist/optional-keys/index.d.ts
1150
- type OptionalKeys<Type$1> = Type$1 extends object ? keyof { [Key in keyof Type$1 as Type$1 extends Required<Pick<Type$1, Key>> ? never : Key]: never } : never;
1150
+ type OptionalKeys<Type> = Type extends object ? keyof { [Key in keyof Type as Type extends Required<Pick<Type, Key>> ? never : Key]: never } : never;
1151
1151
  //#endregion
1152
1152
  //#region ../../node_modules/.pnpm/ts-essentials@10.0.3_typescript@5.7.3/node_modules/ts-essentials/dist/required-keys/index.d.ts
1153
- type RequiredKeys<Type$1> = Type$1 extends unknown ? Exclude<keyof Type$1, OptionalKeys<Type$1>> : never;
1153
+ type RequiredKeys<Type> = Type extends unknown ? Exclude<keyof Type, OptionalKeys<Type>> : never;
1154
1154
  //#endregion
1155
- //#region ../../node_modules/.pnpm/next@15.4.8_@babel+core@7.27.7_@opentelemetry+api@1.9.0_@playwright+test@1.56.1_babel-p_1eda7325b4c551db31b014561614ff25/node_modules/next/dist/lib/load-custom-routes.d.ts
1155
+ //#region ../../node_modules/.pnpm/@types+json-schema@7.0.15/node_modules/@types/json-schema/index.d.ts
1156
+ // ==================================================================================================
1157
+ // JSON Schema Draft 04
1158
+ // ==================================================================================================
1159
+
1160
+ /**
1161
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.1
1162
+ */
1163
+ type JSONSchema4TypeName = "string" //
1164
+ | "number" | "integer" | "boolean" | "object" | "array" | "null" | "any";
1165
+ /**
1166
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-04#section-3.5
1167
+ */
1168
+ type JSONSchema4Type = string //
1169
+ | number | boolean | JSONSchema4Object | JSONSchema4Array | null;
1170
+ // Workaround for infinite type recursion
1171
+ interface JSONSchema4Object {
1172
+ [key: string]: JSONSchema4Type;
1173
+ }
1174
+ // Workaround for infinite type recursion
1175
+ // https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540
1176
+ interface JSONSchema4Array extends Array<JSONSchema4Type> {}
1177
+ /**
1178
+ * Meta schema
1179
+ *
1180
+ * Recommended values:
1181
+ * - 'http://json-schema.org/schema#'
1182
+ * - 'http://json-schema.org/hyper-schema#'
1183
+ * - 'http://json-schema.org/draft-04/schema#'
1184
+ * - 'http://json-schema.org/draft-04/hyper-schema#'
1185
+ * - 'http://json-schema.org/draft-03/schema#'
1186
+ * - 'http://json-schema.org/draft-03/hyper-schema#'
1187
+ *
1188
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5
1189
+ */
1190
+ type JSONSchema4Version = string;
1191
+ /**
1192
+ * JSON Schema V4
1193
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-04
1194
+ */
1195
+ interface JSONSchema4 {
1196
+ id?: string | undefined;
1197
+ $ref?: string | undefined;
1198
+ $schema?: JSONSchema4Version | undefined;
1199
+
1200
+ /**
1201
+ * This attribute is a string that provides a short description of the
1202
+ * instance property.
1203
+ *
1204
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.21
1205
+ */
1206
+ title?: string | undefined;
1207
+
1208
+ /**
1209
+ * This attribute is a string that provides a full description of the of
1210
+ * purpose the instance property.
1211
+ *
1212
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.22
1213
+ */
1214
+ description?: string | undefined;
1215
+ default?: JSONSchema4Type | undefined;
1216
+ multipleOf?: number | undefined;
1217
+ maximum?: number | undefined;
1218
+ exclusiveMaximum?: boolean | undefined;
1219
+ minimum?: number | undefined;
1220
+ exclusiveMinimum?: boolean | undefined;
1221
+ maxLength?: number | undefined;
1222
+ minLength?: number | undefined;
1223
+ pattern?: string | undefined;
1224
+
1225
+ /**
1226
+ * May only be defined when "items" is defined, and is a tuple of JSONSchemas.
1227
+ *
1228
+ * This provides a definition for additional items in an array instance
1229
+ * when tuple definitions of the items is provided. This can be false
1230
+ * to indicate additional items in the array are not allowed, or it can
1231
+ * be a schema that defines the schema of the additional items.
1232
+ *
1233
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.6
1234
+ */
1235
+ additionalItems?: boolean | JSONSchema4 | undefined;
1236
+
1237
+ /**
1238
+ * This attribute defines the allowed items in an instance array, and
1239
+ * MUST be a schema or an array of schemas. The default value is an
1240
+ * empty schema which allows any value for items in the instance array.
1241
+ *
1242
+ * When this attribute value is a schema and the instance value is an
1243
+ * array, then all the items in the array MUST be valid according to the
1244
+ * schema.
1245
+ *
1246
+ * When this attribute value is an array of schemas and the instance
1247
+ * value is an array, each position in the instance array MUST conform
1248
+ * to the schema in the corresponding position for this array. This
1249
+ * called tuple typing. When tuple typing is used, additional items are
1250
+ * allowed, disallowed, or constrained by the "additionalItems"
1251
+ * (Section 5.6) attribute using the same rules as
1252
+ * "additionalProperties" (Section 5.4) for objects.
1253
+ *
1254
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.5
1255
+ */
1256
+ items?: JSONSchema4 | JSONSchema4[] | undefined;
1257
+ maxItems?: number | undefined;
1258
+ minItems?: number | undefined;
1259
+ uniqueItems?: boolean | undefined;
1260
+ maxProperties?: number | undefined;
1261
+ minProperties?: number | undefined;
1262
+
1263
+ /**
1264
+ * This attribute indicates if the instance must have a value, and not
1265
+ * be undefined. This is false by default, making the instance
1266
+ * optional.
1267
+ *
1268
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.7
1269
+ */
1270
+ required?: boolean | string[] | undefined;
1271
+
1272
+ /**
1273
+ * This attribute defines a schema for all properties that are not
1274
+ * explicitly defined in an object type definition. If specified, the
1275
+ * value MUST be a schema or a boolean. If false is provided, no
1276
+ * additional properties are allowed beyond the properties defined in
1277
+ * the schema. The default value is an empty schema which allows any
1278
+ * value for additional properties.
1279
+ *
1280
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.4
1281
+ */
1282
+ additionalProperties?: boolean | JSONSchema4 | undefined;
1283
+ definitions?: {
1284
+ [k: string]: JSONSchema4;
1285
+ } | undefined;
1286
+
1287
+ /**
1288
+ * This attribute is an object with property definitions that define the
1289
+ * valid values of instance object property values. When the instance
1290
+ * value is an object, the property values of the instance object MUST
1291
+ * conform to the property definitions in this object. In this object,
1292
+ * each property definition's value MUST be a schema, and the property's
1293
+ * name MUST be the name of the instance property that it defines. The
1294
+ * instance property value MUST be valid according to the schema from
1295
+ * the property definition. Properties are considered unordered, the
1296
+ * order of the instance properties MAY be in any order.
1297
+ *
1298
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.2
1299
+ */
1300
+ properties?: {
1301
+ [k: string]: JSONSchema4;
1302
+ } | undefined;
1303
+
1304
+ /**
1305
+ * This attribute is an object that defines the schema for a set of
1306
+ * property names of an object instance. The name of each property of
1307
+ * this attribute's object is a regular expression pattern in the ECMA
1308
+ * 262/Perl 5 format, while the value is a schema. If the pattern
1309
+ * matches the name of a property on the instance object, the value of
1310
+ * the instance's property MUST be valid against the pattern name's
1311
+ * schema value.
1312
+ *
1313
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.3
1314
+ */
1315
+ patternProperties?: {
1316
+ [k: string]: JSONSchema4;
1317
+ } | undefined;
1318
+ dependencies?: {
1319
+ [k: string]: JSONSchema4 | string[];
1320
+ } | undefined;
1321
+
1322
+ /**
1323
+ * This provides an enumeration of all possible values that are valid
1324
+ * for the instance property. This MUST be an array, and each item in
1325
+ * the array represents a possible value for the instance value. If
1326
+ * this attribute is defined, the instance value MUST be one of the
1327
+ * values in the array in order for the schema to be valid.
1328
+ *
1329
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.19
1330
+ */
1331
+ enum?: JSONSchema4Type[] | undefined;
1332
+
1333
+ /**
1334
+ * A single type, or a union of simple types
1335
+ */
1336
+ type?: JSONSchema4TypeName | JSONSchema4TypeName[] | undefined;
1337
+ allOf?: JSONSchema4[] | undefined;
1338
+ anyOf?: JSONSchema4[] | undefined;
1339
+ oneOf?: JSONSchema4[] | undefined;
1340
+ not?: JSONSchema4 | undefined;
1341
+
1342
+ /**
1343
+ * The value of this property MUST be another schema which will provide
1344
+ * a base schema which the current schema will inherit from. The
1345
+ * inheritance rules are such that any instance that is valid according
1346
+ * to the current schema MUST be valid according to the referenced
1347
+ * schema. This MAY also be an array, in which case, the instance MUST
1348
+ * be valid for all the schemas in the array. A schema that extends
1349
+ * another schema MAY define additional attributes, constrain existing
1350
+ * attributes, or add other constraints.
1351
+ *
1352
+ * Conceptually, the behavior of extends can be seen as validating an
1353
+ * instance against all constraints in the extending schema as well as
1354
+ * the extended schema(s).
1355
+ *
1356
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.26
1357
+ */
1358
+ extends?: string | string[] | undefined;
1359
+
1360
+ /**
1361
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-04#section-5.6
1362
+ */
1363
+ [k: string]: any;
1364
+ format?: string | undefined;
1365
+ }
1366
+ //#endregion
1367
+ //#region ../../node_modules/.pnpm/next@15.4.10_@babel+core@7.27.7_@opentelemetry+api@1.9.0_@playwright+test@1.56.1_babel-_7611c050995f5fd562decbf9927e8c4b/node_modules/next/dist/lib/load-custom-routes.d.ts
1156
1368
  type RouteHas = {
1157
1369
  type: string;
1158
1370
  key: string;
@@ -1163,7 +1375,7 @@ type RouteHas = {
1163
1375
  value: string;
1164
1376
  };
1165
1377
  //#endregion
1166
- //#region ../../node_modules/.pnpm/next@15.4.8_@babel+core@7.27.7_@opentelemetry+api@1.9.0_@playwright+test@1.56.1_babel-p_1eda7325b4c551db31b014561614ff25/node_modules/next/dist/build/analysis/get-page-static-info.d.ts
1378
+ //#region ../../node_modules/.pnpm/next@15.4.10_@babel+core@7.27.7_@opentelemetry+api@1.9.0_@playwright+test@1.56.1_babel-_7611c050995f5fd562decbf9927e8c4b/node_modules/next/dist/build/analysis/get-page-static-info.d.ts
1167
1379
  type MiddlewareMatcher = {
1168
1380
  regexp: string;
1169
1381
  locale?: false;
@@ -1172,14 +1384,14 @@ type MiddlewareMatcher = {
1172
1384
  originalSource: string;
1173
1385
  };
1174
1386
  //#endregion
1175
- //#region ../../node_modules/.pnpm/next@15.4.8_@babel+core@7.27.7_@opentelemetry+api@1.9.0_@playwright+test@1.56.1_babel-p_1eda7325b4c551db31b014561614ff25/node_modules/next/dist/shared/lib/constants.d.ts
1387
+ //#region ../../node_modules/.pnpm/next@15.4.10_@babel+core@7.27.7_@opentelemetry+api@1.9.0_@playwright+test@1.56.1_babel-_7611c050995f5fd562decbf9927e8c4b/node_modules/next/dist/shared/lib/constants.d.ts
1176
1388
  declare const COMPILER_NAMES: {
1177
1389
  readonly client: "client";
1178
1390
  readonly server: "server";
1179
1391
  readonly edgeServer: "edge-server";
1180
1392
  };
1181
1393
  //#endregion
1182
- //#region ../../node_modules/.pnpm/next@15.4.8_@babel+core@7.27.7_@opentelemetry+api@1.9.0_@playwright+test@1.56.1_babel-p_1eda7325b4c551db31b014561614ff25/node_modules/next/dist/client/route-loader.d.ts
1394
+ //#region ../../node_modules/.pnpm/next@15.4.10_@babel+core@7.27.7_@opentelemetry+api@1.9.0_@playwright+test@1.56.1_babel-_7611c050995f5fd562decbf9927e8c4b/node_modules/next/dist/client/route-loader.d.ts
1183
1395
  declare global {
1184
1396
  interface Window {
1185
1397
  __BUILD_MANIFEST?: Record<string, string[]>;
@@ -1196,7 +1408,7 @@ declare global {
1196
1408
  }
1197
1409
  }
1198
1410
  //#endregion
1199
- //#region ../../node_modules/.pnpm/next@15.4.8_@babel+core@7.27.7_@opentelemetry+api@1.9.0_@playwright+test@1.56.1_babel-p_1eda7325b4c551db31b014561614ff25/node_modules/next/dist/client/page-loader.d.ts
1411
+ //#region ../../node_modules/.pnpm/next@15.4.10_@babel+core@7.27.7_@opentelemetry+api@1.9.0_@playwright+test@1.56.1_babel-_7611c050995f5fd562decbf9927e8c4b/node_modules/next/dist/client/page-loader.d.ts
1200
1412
  declare global {
1201
1413
  interface Window {
1202
1414
  __DEV_MIDDLEWARE_MATCHERS?: MiddlewareMatcher[];
@@ -1208,21 +1420,21 @@ declare global {
1208
1420
  }
1209
1421
  }
1210
1422
  //#endregion
1211
- //#region ../../node_modules/.pnpm/next@15.4.8_@babel+core@7.27.7_@opentelemetry+api@1.9.0_@playwright+test@1.56.1_babel-p_1eda7325b4c551db31b014561614ff25/node_modules/next/dist/shared/lib/router/router.d.ts
1423
+ //#region ../../node_modules/.pnpm/next@15.4.10_@babel+core@7.27.7_@opentelemetry+api@1.9.0_@playwright+test@1.56.1_babel-_7611c050995f5fd562decbf9927e8c4b/node_modules/next/dist/shared/lib/router/router.d.ts
1212
1424
  declare global {
1213
1425
  interface Window {
1214
1426
  __NEXT_DATA__: NEXT_DATA;
1215
1427
  }
1216
1428
  }
1217
1429
  //#endregion
1218
- //#region ../../node_modules/.pnpm/next@15.4.8_@babel+core@7.27.7_@opentelemetry+api@1.9.0_@playwright+test@1.56.1_babel-p_1eda7325b4c551db31b014561614ff25/node_modules/next/dist/shared/lib/loadable.shared-runtime.d.ts
1430
+ //#region ../../node_modules/.pnpm/next@15.4.10_@babel+core@7.27.7_@opentelemetry+api@1.9.0_@playwright+test@1.56.1_babel-_7611c050995f5fd562decbf9927e8c4b/node_modules/next/dist/shared/lib/loadable.shared-runtime.d.ts
1219
1431
  declare global {
1220
1432
  interface Window {
1221
1433
  __NEXT_PRELOADREADY?: (ids?: (string | number)[]) => Promise<void>;
1222
1434
  }
1223
1435
  }
1224
1436
  //#endregion
1225
- //#region ../../node_modules/.pnpm/next@15.4.8_@babel+core@7.27.7_@opentelemetry+api@1.9.0_@playwright+test@1.56.1_babel-p_1eda7325b4c551db31b014561614ff25/node_modules/next/dist/lib/metadata/types/alternative-urls-types.d.ts
1437
+ //#region ../../node_modules/.pnpm/next@15.4.10_@babel+core@7.27.7_@opentelemetry+api@1.9.0_@playwright+test@1.56.1_babel-_7611c050995f5fd562decbf9927e8c4b/node_modules/next/dist/lib/metadata/types/alternative-urls-types.d.ts
1226
1438
  type LangCode = 'aa' | 'ab' | 'ae' | 'af' | 'ak' | 'am' | 'an' | 'ar' | 'as' | 'av' | 'ay' | 'az' | 'ba' | 'be' | 'bg' | 'bh' | 'bi' | 'bm' | 'bn' | 'bo' | 'br' | 'bs' | 'ca' | 'ce' | 'ch' | 'co' | 'cr' | 'cs' | 'cu' | 'cv' | 'cy' | 'da' | 'de' | 'dv' | 'dz' | 'ee' | 'el' | 'en' | 'eo' | 'es' | 'et' | 'eu' | 'fa' | 'ff' | 'fi' | 'fj' | 'fo' | 'fr' | 'fy' | 'ga' | 'gd' | 'gl' | 'gn' | 'gu' | 'gv' | 'ha' | 'he' | 'hi' | 'ho' | 'hr' | 'ht' | 'hu' | 'hy' | 'hz' | 'ia' | 'id' | 'ie' | 'ig' | 'ii' | 'ik' | 'io' | 'is' | 'it' | 'iu' | 'ja' | 'jv' | 'ka' | 'kg' | 'ki' | 'kj' | 'kk' | 'kl' | 'km' | 'kn' | 'ko' | 'kr' | 'ks' | 'ku' | 'kv' | 'kw' | 'ky' | 'la' | 'lb' | 'lg' | 'li' | 'ln' | 'lo' | 'lt' | 'lu' | 'lv' | 'mg' | 'mh' | 'mi' | 'mk' | 'ml' | 'mn' | 'mr' | 'ms' | 'mt' | 'my' | 'na' | 'nb' | 'nd' | 'ne' | 'ng' | 'nl' | 'nn' | 'no' | 'nr' | 'nv' | 'ny' | 'oc' | 'oj' | 'om' | 'or' | 'os' | 'pa' | 'pi' | 'pl' | 'ps' | 'pt' | 'qu' | 'rm' | 'rn' | 'ro' | 'ru' | 'rw' | 'sa' | 'sc' | 'sd' | 'se' | 'sg' | 'si' | 'sk' | 'sl' | 'sm' | 'sn' | 'so' | 'sq' | 'sr' | 'ss' | 'st' | 'su' | 'sv' | 'sw' | 'ta' | 'te' | 'tg' | 'th' | 'ti' | 'tk' | 'tl' | 'tn' | 'to' | 'tr' | 'ts' | 'tt' | 'tw' | 'ty' | 'ug' | 'uk' | 'ur' | 'uz' | 've' | 'vi' | 'vo' | 'wa' | 'wo' | 'xh' | 'yi' | 'yo' | 'za' | 'zh' | 'zu' | 'af-ZA' | 'am-ET' | 'ar-AE' | 'ar-BH' | 'ar-DZ' | 'ar-EG' | 'ar-IQ' | 'ar-JO' | 'ar-KW' | 'ar-LB' | 'ar-LY' | 'ar-MA' | 'arn-CL' | 'ar-OM' | 'ar-QA' | 'ar-SA' | 'ar-SD' | 'ar-SY' | 'ar-TN' | 'ar-YE' | 'as-IN' | 'az-az' | 'az-Cyrl-AZ' | 'az-Latn-AZ' | 'ba-RU' | 'be-BY' | 'bg-BG' | 'bn-BD' | 'bn-IN' | 'bo-CN' | 'br-FR' | 'bs-Cyrl-BA' | 'bs-Latn-BA' | 'ca-ES' | 'co-FR' | 'cs-CZ' | 'cy-GB' | 'da-DK' | 'de-AT' | 'de-CH' | 'de-DE' | 'de-LI' | 'de-LU' | 'dsb-DE' | 'dv-MV' | 'el-CY' | 'el-GR' | 'en-029' | 'en-AU' | 'en-BZ' | 'en-CA' | 'en-cb' | 'en-GB' | 'en-IE' | 'en-IN' | 'en-JM' | 'en-MT' | 'en-MY' | 'en-NZ' | 'en-PH' | 'en-SG' | 'en-TT' | 'en-US' | 'en-ZA' | 'en-ZW' | 'es-AR' | 'es-BO' | 'es-CL' | 'es-CO' | 'es-CR' | 'es-DO' | 'es-EC' | 'es-ES' | 'es-GT' | 'es-HN' | 'es-MX' | 'es-NI' | 'es-PA' | 'es-PE' | 'es-PR' | 'es-PY' | 'es-SV' | 'es-US' | 'es-UY' | 'es-VE' | 'et-EE' | 'eu-ES' | 'fa-IR' | 'fi-FI' | 'fil-PH' | 'fo-FO' | 'fr-BE' | 'fr-CA' | 'fr-CH' | 'fr-FR' | 'fr-LU' | 'fr-MC' | 'fy-NL' | 'ga-IE' | 'gd-GB' | 'gd-ie' | 'gl-ES' | 'gsw-FR' | 'gu-IN' | 'ha-Latn-NG' | 'he-IL' | 'hi-IN' | 'hr-BA' | 'hr-HR' | 'hsb-DE' | 'hu-HU' | 'hy-AM' | 'id-ID' | 'ig-NG' | 'ii-CN' | 'in-ID' | 'is-IS' | 'it-CH' | 'it-IT' | 'iu-Cans-CA' | 'iu-Latn-CA' | 'iw-IL' | 'ja-JP' | 'ka-GE' | 'kk-KZ' | 'kl-GL' | 'km-KH' | 'kn-IN' | 'kok-IN' | 'ko-KR' | 'ky-KG' | 'lb-LU' | 'lo-LA' | 'lt-LT' | 'lv-LV' | 'mi-NZ' | 'mk-MK' | 'ml-IN' | 'mn-MN' | 'mn-Mong-CN' | 'moh-CA' | 'mr-IN' | 'ms-BN' | 'ms-MY' | 'mt-MT' | 'nb-NO' | 'ne-NP' | 'nl-BE' | 'nl-NL' | 'nn-NO' | 'no-no' | 'nso-ZA' | 'oc-FR' | 'or-IN' | 'pa-IN' | 'pl-PL' | 'prs-AF' | 'ps-AF' | 'pt-BR' | 'pt-PT' | 'qut-GT' | 'quz-BO' | 'quz-EC' | 'quz-PE' | 'rm-CH' | 'ro-mo' | 'ro-RO' | 'ru-mo' | 'ru-RU' | 'rw-RW' | 'sah-RU' | 'sa-IN' | 'se-FI' | 'se-NO' | 'se-SE' | 'si-LK' | 'sk-SK' | 'sl-SI' | 'sma-NO' | 'sma-SE' | 'smj-NO' | 'smj-SE' | 'smn-FI' | 'sms-FI' | 'sq-AL' | 'sr-BA' | 'sr-CS' | 'sr-Cyrl-BA' | 'sr-Cyrl-CS' | 'sr-Cyrl-ME' | 'sr-Cyrl-RS' | 'sr-Latn-BA' | 'sr-Latn-CS' | 'sr-Latn-ME' | 'sr-Latn-RS' | 'sr-ME' | 'sr-RS' | 'sr-sp' | 'sv-FI' | 'sv-SE' | 'sw-KE' | 'syr-SY' | 'ta-IN' | 'te-IN' | 'tg-Cyrl-TJ' | 'th-TH' | 'tk-TM' | 'tlh-QS' | 'tn-ZA' | 'tr-TR' | 'tt-RU' | 'tzm-Latn-DZ' | 'ug-CN' | 'uk-UA' | 'ur-PK' | 'uz-Cyrl-UZ' | 'uz-Latn-UZ' | 'uz-uz' | 'vi-VN' | 'wo-SN' | 'xh-ZA' | 'yo-NG' | 'zh-CN' | 'zh-HK' | 'zh-MO' | 'zh-SG' | 'zh-TW' | 'zh-Hans' | 'zh-Hant' | 'zu-ZA' | `${Lowercase<string>}-${string}`;
1227
1439
  type UnmatchedLang = 'x-default';
1228
1440
  type HrefLang = LangCode | UnmatchedLang;
@@ -1242,7 +1454,7 @@ type AlternateURLs = {
1242
1454
  } | undefined;
1243
1455
  };
1244
1456
  //#endregion
1245
- //#region ../../node_modules/.pnpm/next@15.4.8_@babel+core@7.27.7_@opentelemetry+api@1.9.0_@playwright+test@1.56.1_babel-p_1eda7325b4c551db31b014561614ff25/node_modules/next/dist/lib/metadata/types/extra-types.d.ts
1457
+ //#region ../../node_modules/.pnpm/next@15.4.10_@babel+core@7.27.7_@opentelemetry+api@1.9.0_@playwright+test@1.56.1_babel-_7611c050995f5fd562decbf9927e8c4b/node_modules/next/dist/lib/metadata/types/extra-types.d.ts
1246
1458
  type AppLinks = {
1247
1459
  ios?: AppLinksApple | Array<AppLinksApple> | undefined;
1248
1460
  iphone?: AppLinksApple | Array<AppLinksApple> | undefined;
@@ -1319,7 +1531,7 @@ type FormatDetection = {
1319
1531
  url?: boolean | undefined;
1320
1532
  };
1321
1533
  //#endregion
1322
- //#region ../../node_modules/.pnpm/next@15.4.8_@babel+core@7.27.7_@opentelemetry+api@1.9.0_@playwright+test@1.56.1_babel-p_1eda7325b4c551db31b014561614ff25/node_modules/next/dist/lib/metadata/types/metadata-types.d.ts
1534
+ //#region ../../node_modules/.pnpm/next@15.4.10_@babel+core@7.27.7_@opentelemetry+api@1.9.0_@playwright+test@1.56.1_babel-_7611c050995f5fd562decbf9927e8c4b/node_modules/next/dist/lib/metadata/types/metadata-types.d.ts
1323
1535
  /**
1324
1536
  *
1325
1537
  * Metadata types
@@ -1420,7 +1632,7 @@ type ThemeColorDescriptor = {
1420
1632
  media?: string | undefined;
1421
1633
  };
1422
1634
  //#endregion
1423
- //#region ../../node_modules/.pnpm/next@15.4.8_@babel+core@7.27.7_@opentelemetry+api@1.9.0_@playwright+test@1.56.1_babel-p_1eda7325b4c551db31b014561614ff25/node_modules/next/dist/lib/metadata/types/opengraph-types.d.ts
1635
+ //#region ../../node_modules/.pnpm/next@15.4.10_@babel+core@7.27.7_@opentelemetry+api@1.9.0_@playwright+test@1.56.1_babel-_7611c050995f5fd562decbf9927e8c4b/node_modules/next/dist/lib/metadata/types/opengraph-types.d.ts
1424
1636
  type OpenGraph = OpenGraphWebsite | OpenGraphArticle | OpenGraphBook | OpenGraphProfile | OpenGraphMusicSong | OpenGraphMusicAlbum | OpenGraphMusicPlaylist | OpenGraphRadioStation | OpenGraphVideoMovie | OpenGraphVideoEpisode | OpenGraphVideoTVShow | OpenGraphVideoOther | OpenGraphMetadata;
1425
1637
  type Locale$3 = string;
1426
1638
  type OpenGraphMetadata = {
@@ -1550,7 +1762,7 @@ type OGActor = {
1550
1762
  role?: string | undefined;
1551
1763
  };
1552
1764
  //#endregion
1553
- //#region ../../node_modules/.pnpm/next@15.4.8_@babel+core@7.27.7_@opentelemetry+api@1.9.0_@playwright+test@1.56.1_babel-p_1eda7325b4c551db31b014561614ff25/node_modules/next/dist/lib/metadata/types/twitter-types.d.ts
1765
+ //#region ../../node_modules/.pnpm/next@15.4.10_@babel+core@7.27.7_@opentelemetry+api@1.9.0_@playwright+test@1.56.1_babel-_7611c050995f5fd562decbf9927e8c4b/node_modules/next/dist/lib/metadata/types/twitter-types.d.ts
1554
1766
  type Twitter = TwitterSummary | TwitterSummaryLargeImage | TwitterPlayer | TwitterApp | TwitterMetadata;
1555
1767
  type TwitterMetadata = {
1556
1768
  site?: string | undefined;
@@ -1604,7 +1816,7 @@ type TwitterPlayerDescriptor = {
1604
1816
  height: number;
1605
1817
  };
1606
1818
  //#endregion
1607
- //#region ../../node_modules/.pnpm/next@15.4.8_@babel+core@7.27.7_@opentelemetry+api@1.9.0_@playwright+test@1.56.1_babel-p_1eda7325b4c551db31b014561614ff25/node_modules/next/dist/lib/metadata/types/metadata-interface.d.ts
1819
+ //#region ../../node_modules/.pnpm/next@15.4.10_@babel+core@7.27.7_@opentelemetry+api@1.9.0_@playwright+test@1.56.1_babel-_7611c050995f5fd562decbf9927e8c4b/node_modules/next/dist/lib/metadata/types/metadata-interface.d.ts
1608
1820
  /**
1609
1821
  * Metadata interface to describe all the metadata fields that can be set in a document.
1610
1822
  *
@@ -2075,7 +2287,7 @@ interface Metadata$1 extends DeprecatedMetadataFields {
2075
2287
  * and relative URLs are composed with `metadataBase`.
2076
2288
  */
2077
2289
  //#endregion
2078
- //#region ../../node_modules/.pnpm/next@15.4.8_@babel+core@7.27.7_@opentelemetry+api@1.9.0_@playwright+test@1.56.1_babel-p_1eda7325b4c551db31b014561614ff25/node_modules/next/dist/server/config-shared.d.ts
2290
+ //#region ../../node_modules/.pnpm/next@15.4.10_@babel+core@7.27.7_@opentelemetry+api@1.9.0_@playwright+test@1.56.1_babel-_7611c050995f5fd562decbf9927e8c4b/node_modules/next/dist/server/config-shared.d.ts
2079
2291
  interface DomainLocale {
2080
2292
  defaultLocale: string;
2081
2293
  domain: string;
@@ -2083,7 +2295,7 @@ interface DomainLocale {
2083
2295
  locales?: readonly string[];
2084
2296
  }
2085
2297
  //#endregion
2086
- //#region ../../node_modules/.pnpm/next@15.4.8_@babel+core@7.27.7_@opentelemetry+api@1.9.0_@playwright+test@1.56.1_babel-p_1eda7325b4c551db31b014561614ff25/node_modules/next/dist/shared/lib/utils.d.ts
2298
+ //#region ../../node_modules/.pnpm/next@15.4.10_@babel+core@7.27.7_@opentelemetry+api@1.9.0_@playwright+test@1.56.1_babel-_7611c050995f5fd562decbf9927e8c4b/node_modules/next/dist/shared/lib/utils.d.ts
2087
2299
  type NEXT_DATA = {
2088
2300
  props: Record<string, any>;
2089
2301
  page: string;
@@ -2116,7 +2328,7 @@ type NEXT_DATA = {
2116
2328
  notFoundSrcPage?: string;
2117
2329
  };
2118
2330
  //#endregion
2119
- //#region ../../node_modules/.pnpm/next@15.4.8_@babel+core@7.27.7_@opentelemetry+api@1.9.0_@playwright+test@1.56.1_babel-p_1eda7325b4c551db31b014561614ff25/node_modules/next/dist/types.d.ts
2331
+ //#region ../../node_modules/.pnpm/next@15.4.10_@babel+core@7.27.7_@opentelemetry+api@1.9.0_@playwright+test@1.56.1_babel-_7611c050995f5fd562decbf9927e8c4b/node_modules/next/dist/types.d.ts
2120
2332
  declare module 'react' {
2121
2333
  interface HtmlHTMLAttributes<T> extends React$1.HTMLAttributes<T> {
2122
2334
  amp?: string;
@@ -16210,8 +16422,8 @@ type RootFoldersConfiguration = {
16210
16422
  collectionOverrides?: (({
16211
16423
  collection
16212
16424
  }: {
16213
- collection: Omit<CollectionConfig$1, 'trash'>;
16214
- }) => Omit<CollectionConfig$1, 'trash'> | Promise<Omit<CollectionConfig$1, 'trash'>>)[];
16425
+ collection: Omit<CollectionConfig, 'trash'>;
16426
+ }) => Omit<CollectionConfig, 'trash'> | Promise<Omit<CollectionConfig, 'trash'>>)[];
16215
16427
  /**
16216
16428
  * If true, you can scope folders to specific collections.
16217
16429
  *
@@ -16868,8 +17080,8 @@ type JobsConfig = {
16868
17080
  * a new collection.
16869
17081
  */
16870
17082
  jobsCollectionOverrides?: (args: {
16871
- defaultJobsCollection: CollectionConfig$1;
16872
- }) => CollectionConfig$1;
17083
+ defaultJobsCollection: CollectionConfig;
17084
+ }) => CollectionConfig;
16873
17085
  /**
16874
17086
  * Adjust the job processing order using a Payload sort string. This can be set globally or per queue.
16875
17087
  *
@@ -17816,7 +18028,7 @@ type Config = {
17816
18028
  *
17817
18029
  * @see https://payloadcms.com/docs/configuration/collections#collection-configs
17818
18030
  */
17819
- collections?: CollectionConfig$1[];
18031
+ collections?: CollectionConfig[];
17820
18032
  /**
17821
18033
  * Compatibility flags for prior Payload versions
17822
18034
  */
@@ -18041,7 +18253,7 @@ type Config = {
18041
18253
  update?: QueryPresetConstraints;
18042
18254
  };
18043
18255
  filterConstraints?: SelectField['filterOptions'];
18044
- labels?: CollectionConfig$1['labels'];
18256
+ labels?: CollectionConfig['labels'];
18045
18257
  };
18046
18258
  /**
18047
18259
  * Control the routing structure that Payload binds itself to.
@@ -21598,7 +21810,7 @@ type CollectionAdminOptions = {
21598
21810
  useAsTitle?: string;
21599
21811
  };
21600
21812
  /** Manage all aspects of a data collection */
21601
- type CollectionConfig$1<TSlug extends CollectionSlug = any> = {
21813
+ type CollectionConfig<TSlug extends CollectionSlug = any> = {
21602
21814
  /**
21603
21815
  * Do not set this property manually. This is set to true during sanitization, to avoid
21604
21816
  * sanitizing the same collection multiple times.
@@ -21814,7 +22026,7 @@ type SanitizedJoins = {
21814
22026
  * @todo remove the `DeepRequired` in v4.
21815
22027
  * We don't actually guarantee that all properties are set when sanitizing configs.
21816
22028
  */
21817
- interface SanitizedCollectionConfig extends Omit<DeepRequired<CollectionConfig$1>, 'admin' | 'auth' | 'endpoints' | 'fields' | 'folders' | 'slug' | 'upload' | 'versions'> {
22029
+ interface SanitizedCollectionConfig extends Omit<DeepRequired<CollectionConfig>, 'admin' | 'auth' | 'endpoints' | 'fields' | 'folders' | 'slug' | 'upload' | 'versions'> {
21818
22030
  admin: CollectionAdminOptions;
21819
22031
  auth: Auth;
21820
22032
  endpoints: Endpoint[] | false;
@@ -24037,7 +24249,7 @@ interface KVAdapterResult {
24037
24249
  payload: Payload;
24038
24250
  }): KVAdapter;
24039
24251
  /** Adapter can create additional collection if needed */
24040
- kvCollection?: CollectionConfig$1;
24252
+ kvCollection?: CollectionConfig;
24041
24253
  }
24042
24254
  //#endregion
24043
24255
  //#region ../../node_modules/.pnpm/payload@3.69.0_graphql@16.10.0_typescript@5.7.3/node_modules/payload/dist/auth/crypto.d.ts
@@ -25230,524 +25442,371 @@ interface CollectionAdminCustom extends Record<string, any> {}
25230
25442
  interface GlobalCustom extends Record<string, any> {}
25231
25443
  interface GlobalAdminCustom extends Record<string, any> {}
25232
25444
  //#endregion
25233
- //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Types.d.ts
25234
- type DropTokensMode = "right_to_left" | "left_to_right" | "both_sides:3";
25235
- type OperationMode = "off" | "always" | "fallback";
25236
- type CommaSeparated<T extends string, ToExtend, OriginalString extends string = T, Previous extends string[] = []> = T extends `${infer Start},${infer Rest}` ? TrimString<Start> extends ToExtend ? CommaSeparated<Rest, ToExtend, OriginalString, [...Previous, TrimString<Start>]> : {
25237
- error: "Invalid operation mode";
25238
- value: TrimString<Start>;
25239
- } : TrimString<T> extends ToExtend ? OriginalString : {
25240
- error: "Invalid operation mode";
25241
- value: TrimString<T>;
25242
- };
25243
- interface SearchParams$1<TDoc extends DocumentSchema, Infix extends string = string> {
25244
- q?: "*" | (string & {});
25245
- query_by?: string | string[];
25246
- query_by_weights?: string | number[];
25247
- prefix?: string | boolean | boolean[];
25248
- filter_by?: string;
25249
- max_filter_by_candidates?: number;
25250
- enable_synonyms?: boolean;
25251
- enable_analytics?: boolean;
25252
- filter_curated_hits?: boolean;
25253
- enable_lazy_filter?: boolean;
25254
- sort_by?: string | string[];
25255
- facet_by?: string | string[];
25256
- max_facet_values?: number;
25257
- facet_sample_threshold?: number;
25258
- facet_sample_percent?: number;
25259
- facet_query?: string;
25260
- facet_query_num_typos?: number;
25261
- facet_return_parent?: string;
25262
- facet_strategy?: "exhaustive" | "top_values" | "automatic";
25263
- page?: number;
25264
- per_page?: number;
25265
- group_by?: string | string[];
25266
- group_limit?: number;
25267
- group_missing_values?: boolean;
25268
- include_fields?: string | string[];
25269
- exclude_fields?: string | string[];
25270
- highlight_fields?: string | string[];
25271
- highlight_full_fields?: string | string[];
25272
- highlight_affix_num_tokens?: number;
25273
- highlight_start_tag?: string;
25274
- highlight_end_tag?: string;
25275
- enable_highlight_v1?: boolean;
25276
- snippet_threshold?: number;
25277
- nl_query?: boolean;
25278
- nl_model_id?: string;
25279
- nl_query_debug?: boolean;
25280
- nl_query_prompt_cache_ttl?: number;
25281
- num_typos?: string | number | number[];
25282
- min_len_1typo?: number;
25283
- min_len_2typo?: number;
25284
- split_join_tokens?: OperationMode;
25285
- exhaustive_search?: boolean;
25286
- drop_tokens_threshold?: number;
25287
- drop_tokens_mode?: DropTokensMode;
25288
- typo_tokens_threshold?: number;
25289
- pinned_hits?: string | string[];
25290
- hidden_hits?: string | string[];
25291
- limit_hits?: number;
25292
- pre_segmented_query?: boolean;
25293
- enable_overrides?: boolean;
25294
- override_tags?: string | string[];
25295
- prioritize_exact_match?: boolean;
25296
- prioritize_token_position?: boolean;
25297
- prioritize_num_matching_fields?: boolean;
25298
- search_cutoff_ms?: number;
25299
- use_cache?: boolean;
25300
- max_candidates?: number;
25301
- infix?: CommaSeparated<Infix, OperationMode> | OperationMode[] | OperationMode;
25302
- preset?: string;
25303
- text_match_type?: "max_score" | "max_weight" | "sum_score";
25304
- vector_query?: string;
25305
- "x-typesense-api-key"?: string;
25306
- "x-typesense-user-id"?: string;
25307
- offset?: number;
25308
- limit?: number;
25309
- stopwords?: string;
25310
- conversation?: boolean;
25311
- validate_field_names?: boolean;
25312
- conversation_stream?: boolean;
25313
- conversation_model_id?: string;
25314
- conversation_id?: string;
25315
- voice_query?: string;
25316
- streamConfig?: StreamConfig<TDoc>;
25317
- }
25318
- interface SearchResponseRequestParams {
25319
- collection_name?: string;
25320
- q?: string;
25321
- page?: number;
25322
- per_page?: number;
25323
- first_q?: string;
25324
- voice_query?: {
25325
- transcribed_query?: string;
25326
- };
25445
+ //#region src/shared/types/plugin-types.d.ts
25446
+ /**
25447
+ * Hybrid search configuration for combining semantic and keyword search
25448
+ */
25449
+ interface HybridSearchConfig {
25450
+ /** Weight between semantic (1.0) and keyword (0.0) search. Default: 0.9 (90% semantic, 10% keyword) */
25451
+ alpha?: number;
25452
+ /** Whether to rerank hybrid search results. Default: true */
25453
+ rerankMatches?: boolean;
25454
+ /** Fields to use for keyword search portion. Default: 'chunk_text,title' */
25455
+ queryFields?: string;
25327
25456
  }
25328
- interface SearchableDocuments<T extends DocumentSchema = DocumentSchema, Infix extends string = string> {
25329
- search(searchParameters: SearchParams$1<T, Infix> | SearchParamsWithPreset<T, Infix>, options: SearchOptions): Promise<SearchResponse$1<T>>;
25330
- clearCache(): void;
25457
+ /**
25458
+ * HNSW (Hierarchical Navigable Small World) optimization parameters
25459
+ * These optimize vector search performance and quality
25460
+ */
25461
+ interface HNSWConfig {
25462
+ /** Higher = better quality, slower indexing. Default: 200 */
25463
+ efConstruction?: number;
25464
+ /** Connections per node - balance memory/speed. Default: 16 */
25465
+ M?: number;
25466
+ /** Search quality - higher = better quality, slower search. Default: 100 */
25467
+ ef?: number;
25468
+ /** Maximum connections per element. Default: 64 */
25469
+ maxConnections?: number;
25470
+ /** Distance metric for vector similarity. Default: 'cosine' */
25471
+ distanceMetric?: 'cosine' | 'l2' | 'ip';
25331
25472
  }
25332
- interface WriteableDocuments<T> {
25333
- create(document: T, options: DocumentWriteParameters): Promise<T>;
25334
- upsert(document: T, options: DocumentWriteParameters): Promise<T>;
25335
- update(document: T, options: DocumentWriteParameters): Promise<T>;
25336
- delete(query: DeleteQuery): Promise<DeleteResponse>;
25337
- import(documents: T[] | string, options: DocumentWriteParameters): Promise<string | ImportResponse[]>;
25338
- export(options: DocumentsExportParameters): Promise<string>;
25473
+ /**
25474
+ * Advanced search parameters for better relevance
25475
+ */
25476
+ interface AdvancedSearchConfig {
25477
+ /** Minimum tokens before allowing typos. Default: 1 */
25478
+ typoTokensThreshold?: number;
25479
+ /** Number of typos to allow. Default: 2 */
25480
+ numTypos?: number;
25481
+ /** Enable prefix matching for partial queries. Default: true */
25482
+ prefix?: boolean;
25483
+ /** Minimum tokens before dropping tokens for partial matching. Default: 1 */
25484
+ dropTokensThreshold?: number;
25485
+ /** Enable stemming for better language matching. Default: true */
25486
+ enableStemming?: boolean;
25339
25487
  }
25340
- interface MultiSearchUnionStreamConfig<T extends DocumentSchema> extends BaseStreamConfig {
25341
- onComplete?: (data: UnionSearchResponse<T>) => void;
25488
+ /**
25489
+ * Source chunk information for citations
25490
+ */
25491
+ interface ChunkSource {
25492
+ /** Unique chunk ID */
25493
+ id: string;
25494
+ /** Parent document title */
25495
+ title: string;
25496
+ /** Parent document slug for URL construction */
25497
+ slug: string;
25498
+ /** Type of document */
25499
+ type: string;
25500
+ /** Chunk index within the document */
25501
+ chunkIndex: number;
25502
+ /** Relevance score (lower is better for vector distance) */
25503
+ relevanceScore: number;
25504
+ /** Full content of the chunk (markdown) */
25505
+ content: string;
25506
+ /** Optional excerpt from the chunk (first 200 chars) */
25507
+ excerpt?: string;
25342
25508
  }
25343
- interface MultiSearchResultsStreamConfig<T extends DocumentSchema[]> extends BaseStreamConfig {
25344
- onComplete?: (data: {
25345
- results: { [Index in keyof T]: SearchResponse$1<T[Index]> } & {
25346
- length: T["length"];
25347
- };
25348
- }) => void;
25509
+ /**
25510
+ * SSE event types
25511
+ */
25512
+ type SSEEventType = 'conversation_id' | 'token' | 'sources' | 'done' | 'error' | 'usage';
25513
+ /**
25514
+ * Usage info structure
25515
+ */
25516
+ interface UsageInfo {
25517
+ tokens_used: number;
25518
+ cost_usd: number;
25519
+ daily_limit: number;
25520
+ daily_used: number;
25521
+ daily_remaining: number;
25522
+ reset_at?: string;
25349
25523
  }
25350
- interface RequestParams<T extends DocumentSchema[]> {
25351
- path: string;
25352
- queryParams?: Record<string, unknown>;
25353
- body?: unknown;
25354
- headers?: Record<string, string>;
25355
- streamConfig?: StreamConfig<T[number]> | MultiSearchResultsStreamConfig<T> | MultiSearchUnionStreamConfig<T[number]>;
25356
- abortSignal?: AbortSignal | null;
25357
- responseType?: AxiosRequestConfig$2["responseType"] | undefined;
25358
- isStreamingRequest: boolean | undefined;
25359
- }
25360
- interface MultiSearchRequestsWithUnionSchema<T extends DocumentSchema, Infix extends string> extends SearchesMultiSearchesRequestSchema<T, Infix> {
25361
- union: true;
25362
- }
25363
- interface MultiSearchRequestsWithoutUnionSchema<T extends DocumentSchema, Infix extends string> extends SearchesMultiSearchesRequestSchema<T, Infix> {
25364
- union?: false | undefined;
25365
- }
25366
- type MultiSearchRequestsSchema<T extends DocumentSchema, Infix extends string> = MultiSearchRequestsWithUnionSchema<T, Infix> | MultiSearchRequestsWithoutUnionSchema<T, Infix>;
25367
- interface UnionSearchResponse<T extends DocumentSchema> extends Omit<SearchResponse$1<T>, "request_params"> {
25368
- union_request_params: SearchResponseRequestParams[];
25524
+ /**
25525
+ * Token usage breakdown
25526
+ */
25527
+ interface TokenUsage {
25528
+ input?: number;
25529
+ output?: number;
25530
+ total: number;
25369
25531
  }
25370
- interface MultiSearchUnionStreamConfig<T extends DocumentSchema> extends BaseStreamConfig {
25371
- onComplete?: (data: UnionSearchResponse<T>) => void;
25532
+ /**
25533
+ * Service types for spending tracking
25534
+ */
25535
+ type ServiceType = 'openai_embedding' | 'openai_llm';
25536
+ /**
25537
+ * Spending entry for tracking AI service costs
25538
+ */
25539
+ interface SpendingEntry {
25540
+ service: ServiceType;
25541
+ model: string;
25542
+ tokens: TokenUsage;
25543
+ cost_usd?: number;
25544
+ timestamp: string;
25372
25545
  }
25373
- interface MultiSearchResultsStreamConfig<T extends DocumentSchema[]> extends BaseStreamConfig {
25374
- onComplete?: (data: {
25375
- results: { [Index in keyof T]: SearchResponse$1<T[Index]> } & {
25376
- length: T["length"];
25377
- };
25378
- }) => void;
25546
+ /**
25547
+ * SSE event structure
25548
+ */
25549
+ interface SSEEvent {
25550
+ type: SSEEventType;
25551
+ data: string | ChunkSource[] | {
25552
+ error: string;
25553
+ } | UsageInfo;
25379
25554
  }
25380
- interface SearchesMultiSearchesRequestSchema<T extends DocumentSchema, Infix extends string> {
25381
- searches: (MultiSearchRequestSchema<T, Infix> | MultiSearchRequestWithPresetSchema<T, Infix>)[];
25555
+ /**
25556
+ * Typesense search hit document (chunk-specific)
25557
+ */
25558
+ interface TypesenseRAGChunkDocument {
25559
+ id: string;
25560
+ chunk_text: string;
25561
+ title?: string;
25562
+ slug?: string;
25563
+ parent_doc_id?: string;
25564
+ chunk_index?: number;
25565
+ [key: string]: unknown;
25382
25566
  }
25383
- interface BaseMultiSearchRequestSchema {
25384
- collection?: string;
25385
- rerank_hybrid_matches?: boolean;
25386
- "x-typesense-api-key"?: string;
25567
+ /**
25568
+ * Typesense search hit for RAG chunks
25569
+ */
25570
+ interface TypesenseRAGSearchHit {
25571
+ document: TypesenseRAGChunkDocument;
25572
+ vector_distance?: number;
25573
+ text_match?: number;
25574
+ [key: string]: unknown;
25387
25575
  }
25388
- type CommonMultiSearchParametersBase<T extends DocumentSchema, Infix extends string> = Partial<BaseMultiSearchRequestSchema & Omit<SearchParams$1<T, Infix>, "streamConfig">>;
25389
- type MultiSearchRequestSchema<T extends DocumentSchema, Infix extends string> = BaseMultiSearchRequestSchema & Omit<SearchParams$1<T, Infix>, "streamConfig">;
25390
- type MultiSearchRequestWithPresetSchema<T extends DocumentSchema, Infix extends string> = BaseMultiSearchRequestSchema & Omit<SearchParamsWithPreset<T, Infix>, "streamConfig">;
25391
- type MultiSearchUnionParameters<T extends DocumentSchema, Infix extends string> = CommonMultiSearchParametersBase<T, Infix> & {
25392
- streamConfig?: MultiSearchUnionStreamConfig<T>;
25393
- use_cache?: boolean;
25394
- };
25395
- type MultiSearchResultsParameters<T extends DocumentSchema[], Infix extends string> = CommonMultiSearchParametersBase<T[number], Infix> & {
25396
- streamConfig?: MultiSearchResultsStreamConfig<T>;
25397
- use_cache?: boolean;
25398
- };
25399
- type Whitespace = " " | "\n" | "\t";
25400
- type TrimString<S extends string> = S extends `${Whitespace}${infer S}` ? TrimString<S> : S extends `${infer S}${Whitespace}` ? TrimString<S> : S;
25401
- //#endregion
25402
- //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/RequestWithCache.d.ts
25403
- declare class RequestWithCache {
25404
- private responseCache;
25405
- private responsePromiseCache;
25406
- clearCache(): void;
25407
- perform<const TContext extends HttpClient, const TMethod extends keyof HttpClient, const TDoc extends DocumentSchema[], TResult>(requestContext: TContext, methodName: TMethod, requestParams: RequestParams<TDoc>, cacheOptions: CacheOptions$2 | undefined): Promise<TResult>;
25408
- private executeRequest;
25576
+ /**
25577
+ * Typesense search result for RAG queries
25578
+ */
25579
+ interface TypesenseRAGSearchResult {
25580
+ hits?: TypesenseRAGSearchHit[];
25581
+ request_params?: {
25582
+ collection_name?: string;
25583
+ [key: string]: unknown;
25584
+ };
25585
+ [key: string]: unknown;
25409
25586
  }
25410
- interface CacheOptions$2 {
25411
- cacheResponseForSeconds?: number;
25412
- maxSize?: number;
25587
+ /**
25588
+ * Configuration for building Typesense queries
25589
+ */
25590
+ interface TypesenseQueryConfig {
25591
+ /** User's message/query */
25592
+ userMessage: string;
25593
+ /** Query embedding vector */
25594
+ queryEmbedding: number[];
25595
+ /** Optional: Filter by selected document IDs */
25596
+ selectedDocuments?: string[];
25597
+ /** Optional: Conversation ID for follow-up */
25598
+ chatId?: string;
25599
+ /** Collections to search */
25600
+ searchCollections: string[];
25601
+ /** Number of results to retrieve */
25602
+ kResults?: number;
25603
+ /** Advanced search config */
25604
+ advancedConfig?: AdvancedSearchConfig;
25413
25605
  }
25414
- //#endregion
25415
- //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/SearchOnlyDocuments.d.ts
25416
- declare class SearchOnlyDocuments<T extends DocumentSchema> implements SearchableDocuments<T> {
25417
- protected collectionName: string;
25418
- protected apiCall: ApiCall;
25419
- protected configuration: Configuration;
25420
- protected requestWithCache: RequestWithCache;
25421
- constructor(collectionName: string, apiCall: ApiCall, configuration: Configuration);
25422
- clearCache(): void;
25423
- search<const Infix extends string>(searchParameters: SearchParams$1<T, Infix> | SearchParamsWithPreset<T, Infix>, {
25424
- cacheSearchResultsForSeconds,
25425
- abortSignal
25426
- }?: SearchOptions): Promise<SearchResponse$1<T>>;
25427
- protected endpointPath(operation?: string): string;
25428
- static get RESOURCEPATH(): string;
25606
+ /**
25607
+ * Embedding result with usage tracking
25608
+ */
25609
+ interface EmbeddingWithUsage {
25610
+ /** The embedding vector */
25611
+ embedding: number[];
25612
+ /** Usage information */
25613
+ usage: {
25614
+ /** Number of tokens used */
25615
+ promptTokens: number;
25616
+ /** Total tokens (same as prompt_tokens for embeddings) */
25617
+ totalTokens: number;
25618
+ };
25429
25619
  }
25430
- //#endregion
25431
- //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Documents.d.ts
25432
- type DeleteQuery = {
25433
- truncate?: true;
25434
- } | {
25435
- truncate?: never;
25436
- filter_by?: string;
25437
- batch_size?: number;
25438
- ignore_not_found?: boolean;
25439
- return_doc?: boolean;
25440
- return_id?: boolean;
25441
- };
25442
- interface DeleteResponse<T extends DocumentSchema = DocumentSchema> {
25443
- num_deleted: number;
25444
- documents?: T[];
25445
- ids?: string[];
25620
+ /**
25621
+ * Batch embedding result with usage tracking
25622
+ */
25623
+ interface BatchEmbeddingWithUsage {
25624
+ /** Array of embedding vectors */
25625
+ embeddings: number[][];
25626
+ /** Total usage information */
25627
+ usage: {
25628
+ /** Number of tokens used */
25629
+ promptTokens: number;
25630
+ /** Total tokens (same as prompt_tokens for embeddings) */
25631
+ totalTokens: number;
25632
+ };
25446
25633
  }
25447
- interface ImportResponseSuccess<T extends DocumentSchema = DocumentSchema> {
25448
- success: true;
25449
- error?: never;
25450
- document?: T;
25451
- id?: string;
25452
- code?: never;
25634
+ interface RAGCallbacks {
25635
+ /** Get Payload instance (required) */
25636
+ getPayload: () => Promise<Payload>;
25637
+ /** Check permissions function (required) */
25638
+ checkPermissions: (request: PayloadRequest) => Promise<boolean>;
25639
+ /** Check token limit function (optional) */
25640
+ checkTokenLimit?: (payload: Payload, userId: string | number, tokens: number) => Promise<{
25641
+ allowed: boolean;
25642
+ limit: number;
25643
+ used: number;
25644
+ remaining: number;
25645
+ reset_at?: string;
25646
+ }>;
25647
+ /** Get user usage stats function (optional) */
25648
+ getUserUsageStats?: (payload: Payload, userId: string | number) => Promise<{
25649
+ limit: number;
25650
+ used: number;
25651
+ remaining: number;
25652
+ reset_at?: string;
25653
+ }>;
25654
+ /** Save chat session function (optional) */
25655
+ saveChatSession?: (payload: Payload, userId: string | number, conversationId: string, userMessage: string, assistantMessage: string, sources: ChunkSource[], spending: SpendingEntry[], collectionName: CollectionSlug) => Promise<void>;
25656
+ /** Create embedding spending function (optional) */
25657
+ createEmbeddingSpending?: (model: string, tokens: number) => SpendingEntry;
25658
+ /** Estimate tokens from text function (optional) */
25659
+ estimateTokensFromText?: (text: string) => number;
25453
25660
  }
25454
- interface ImportResponseFail<T extends DocumentSchema = DocumentSchema> {
25455
- success: false;
25456
- error: string;
25457
- document?: T;
25458
- id?: string;
25459
- code: number;
25661
+ /**
25662
+ * Complete RAG configuration
25663
+ */
25664
+ interface RAGConfig {
25665
+ /** Hybrid search settings */
25666
+ hybrid?: HybridSearchConfig;
25667
+ /** HNSW optimization settings */
25668
+ hnsw?: HNSWConfig;
25669
+ /** Advanced search settings */
25670
+ advanced?: AdvancedSearchConfig;
25460
25671
  }
25461
- type ImportResponse<T extends DocumentSchema = DocumentSchema> = ImportResponseSuccess<T> | ImportResponseFail<T>;
25462
- type DocumentSchema = Record<string, any>;
25463
- interface SearchParamsWithPreset<T extends DocumentSchema, Infix extends string> extends Partial<SearchParams$1<T, Infix>> {
25464
- preset: string;
25672
+ interface RAGFeatureConfig extends RAGConfig {
25673
+ enabled: boolean;
25674
+ callbacks?: RAGCallbacks;
25675
+ agents: AgentConfig[];
25465
25676
  }
25466
- type SearchResponseHighlightObject = {
25467
- matched_tokens?: string[];
25468
- snippet?: string;
25469
- value?: string;
25677
+ type TypesenseProtocol = "http" | "https";
25678
+ type TypesenseNode = {
25679
+ host: string;
25680
+ port: number;
25681
+ protocol: TypesenseProtocol;
25682
+ path?: string;
25470
25683
  };
25471
- type SearchResponseHighlight<T> = T extends string | number ? SearchResponseHighlightObject : { [TAttribute in keyof T]?: SearchResponseHighlight<T[TAttribute]> };
25472
- interface SearchResponseHit<T extends DocumentSchema> {
25473
- curated?: true;
25474
- highlights?: [{
25475
- field: keyof T;
25476
- snippet?: string;
25477
- value?: string;
25478
- snippets?: string[];
25479
- indices?: number[];
25480
- matched_tokens: string[][] | string[];
25481
- }];
25482
- highlight: SearchResponseHighlight<T>;
25483
- document: T;
25484
- text_match: number;
25485
- text_match_info?: {
25486
- best_field_score: `${number}`;
25487
- best_field_weight: number;
25488
- fields_matched: number;
25489
- score: `${number}`;
25490
- tokens_matched: number;
25491
- };
25492
- geo_distance_meters?: {
25493
- location: number;
25494
- };
25495
- }
25496
- interface SearchResponseFacetCountSchema<T extends DocumentSchema> {
25497
- counts: {
25498
- count: number;
25499
- highlighted: string;
25500
- value: string;
25501
- parent?: Record<string, string | number | boolean>;
25502
- }[];
25503
- field_name: keyof T;
25504
- sampled: boolean;
25505
- stats: {
25506
- avg?: number;
25507
- max?: number;
25508
- min?: number;
25509
- sum?: number;
25510
- total_values?: number;
25511
- };
25512
- }
25513
- interface LLMResponse {
25514
- content: string;
25515
- extraction_method: string;
25516
- model: string;
25517
- }
25518
- interface SearchResponse$1<T extends DocumentSchema> {
25519
- facet_counts?: SearchResponseFacetCountSchema<T>[];
25520
- found: number;
25521
- found_docs?: number;
25522
- out_of: number;
25523
- page: number;
25524
- request_params: SearchResponseRequestParams;
25525
- search_time_ms: number;
25526
- search_cutoff?: boolean;
25527
- hits?: SearchResponseHit<T>[];
25528
- grouped_hits?: {
25529
- group_key: string[];
25530
- hits: SearchResponseHit<T>[];
25531
- found?: number;
25532
- }[];
25533
- parsed_nl_query?: {
25534
- parse_time_ms: number;
25535
- generated_params: SearchParams$1<T>;
25536
- augmented_params: SearchParams$1<T>;
25537
- llm_response?: LLMResponse;
25538
- };
25539
- conversation?: {
25540
- answer: string;
25541
- conversation_history: {
25542
- conversation: object[];
25543
- id: string;
25544
- last_updated: number;
25545
- ttl: number;
25546
- };
25547
- conversation_id: string;
25548
- query: string;
25549
- };
25550
- error?: string;
25551
- code?: number;
25552
- }
25553
- interface DocumentWriteParameters {
25554
- dirty_values?: "coerce_or_reject" | "coerce_or_drop" | "drop" | "reject";
25555
- action?: "create" | "update" | "upsert" | "emplace";
25556
- }
25557
- interface UpdateByFilterParameters {
25558
- filter_by?: string;
25559
- }
25560
- interface UpdateByFilterResponse {
25561
- num_updated: number;
25562
- }
25563
- interface DocumentImportParameters extends DocumentWriteParameters {
25564
- batch_size?: number;
25565
- remote_embedding_batch_size?: number;
25566
- remote_embedding_timeout_ms?: number;
25567
- remote_embedding_num_tries?: number;
25568
- return_doc?: boolean;
25569
- return_id?: boolean;
25570
- throwOnFail?: boolean;
25571
- }
25572
- interface DocumentsExportParameters {
25573
- filter_by?: string;
25574
- include_fields?: string;
25575
- exclude_fields?: string;
25576
- }
25577
- interface SearchOptions {
25578
- cacheSearchResultsForSeconds?: number;
25579
- abortSignal?: AbortSignal | null;
25580
- }
25581
- declare class Documents<T extends DocumentSchema = object> extends SearchOnlyDocuments<T> implements WriteableDocuments<T> {
25582
- constructor(collectionName: string, apiCall: ApiCall, configuration: Configuration);
25583
- create(document: T, options?: DocumentWriteParameters): Promise<T>;
25584
- upsert(document: T, options?: DocumentWriteParameters): Promise<T>;
25585
- update(document: T, options: UpdateByFilterParameters): Promise<UpdateByFilterResponse>;
25586
- update(document: T, options: DocumentWriteParameters): Promise<T>;
25587
- delete(query?: DeleteQuery): Promise<DeleteResponse<T>>;
25588
- createMany(documents: T[], options?: DocumentImportParameters): Promise<ImportResponse<T>[]>;
25684
+ /**
25685
+ * Configuration for Typesense connection
25686
+ */
25687
+ type TypesenseConnectionConfig = {
25688
+ apiKey: string;
25689
+ connectionTimeoutSeconds?: number;
25690
+ retryIntervalSeconds?: number;
25691
+ nodes: [TypesenseNode, ...Array<TypesenseNode>];
25692
+ };
25693
+ /**
25694
+ * Main plugin configuration
25695
+ */
25696
+ /**
25697
+ * Configuration for a single conversational agent
25698
+ */
25699
+ interface AgentConfig {
25589
25700
  /**
25590
- * Import a set of documents in a batch.
25591
- * @param {string|Array} documents - Can be a JSONL string of documents or an array of document objects.
25592
- * @param options
25593
- * @return {string|Array} Returns a JSONL string if the input was a JSONL string, otherwise it returns an array of results.
25701
+ * Unique identifier for the agent (used in API requests)
25594
25702
  */
25595
- import(documents: string, options?: DocumentImportParameters): Promise<string>;
25596
- import(documents: T[], options?: DocumentImportParameters): Promise<ImportResponse<T>[]>;
25703
+ slug: string;
25597
25704
  /**
25598
- * Imports documents from a NodeJS readable stream of JSONL.
25705
+ * Display name for the agent (shown in UI)
25706
+ * If not provided, slug will be used.
25599
25707
  */
25600
- importStream(readableStream: ReadStream, options?: DocumentImportParameters): Promise<ImportResponse<T>[]>;
25708
+ name?: string;
25601
25709
  /**
25602
- * Returns a JSONL string for all the documents in this collection
25710
+ * Optional API Key for the LLM provider.
25711
+ * If provided, this overrides the global embedding provider API key for this agent.
25603
25712
  */
25604
- export(options?: DocumentsExportParameters): Promise<string>;
25713
+ apiKey?: string;
25605
25714
  /**
25606
- * Returns a NodeJS readable stream of JSONL for all the documents in this collection.
25715
+ * System prompt that defines the agent's personality and constraints
25607
25716
  */
25608
- exportStream(options?: DocumentsExportParameters): Promise<ReadStream>;
25609
- }
25610
- //#endregion
25611
- //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Configuration.d.ts
25612
- interface NodeConfiguration {
25613
- host: string;
25614
- port: number;
25615
- protocol: string;
25616
- path?: string;
25617
- url?: string;
25618
- }
25619
- interface NodeConfigurationWithHostname {
25620
- host: string;
25621
- port: number;
25622
- protocol: string;
25623
- path?: string;
25624
- }
25625
- interface NodeConfigurationWithUrl {
25626
- url: string;
25627
- }
25628
- interface ConfigurationOptions {
25629
- apiKey: string;
25630
- nodes: NodeConfiguration[] | NodeConfigurationWithHostname[] | NodeConfigurationWithUrl[];
25631
- randomizeNodes?: boolean;
25717
+ systemPrompt: string;
25632
25718
  /**
25633
- * @deprecated
25634
- * masterNode is now consolidated to nodes, starting with Typesense Server v0.12'
25719
+ * LLM model to use (e.g., 'openai/gpt-4o-mini')
25635
25720
  */
25636
- masterNode?: NodeConfiguration | NodeConfigurationWithHostname | NodeConfigurationWithUrl;
25721
+ llmModel: string;
25637
25722
  /**
25638
- * @deprecated
25639
- * readReplicaNodes is now consolidated to nodes, starting with Typesense Server v0.12'
25723
+ * Collections this agent is allowed to search in
25640
25724
  */
25641
- readReplicaNodes?: NodeConfiguration[] | NodeConfigurationWithHostname[] | NodeConfigurationWithUrl[];
25642
- nearestNode?: NodeConfiguration | NodeConfigurationWithHostname | NodeConfigurationWithUrl;
25643
- connectionTimeoutSeconds?: number;
25644
- timeoutSeconds?: number;
25645
- healthcheckIntervalSeconds?: number;
25646
- numRetries?: number;
25647
- retryIntervalSeconds?: number;
25648
- sendApiKeyAsQueryParam?: boolean | undefined;
25649
- useServerSideSearchCache?: boolean;
25650
- cacheSearchResultsForSeconds?: number;
25651
- additionalHeaders?: Record<string, string>;
25652
- logLevel?: LogLevelDesc;
25653
- logger?: Logger$1;
25725
+ searchCollections: string[];
25654
25726
  /**
25655
- * Set a custom HTTP Agent
25656
- *
25657
- * This is helpful for eg, to enable keepAlive which helps prevents ECONNRESET socket hang up errors
25658
- * Usage:
25659
- * const { Agent: HTTPAgent } = require("http");
25660
- * ...
25661
- * httpAgent: new HTTPAgent({ keepAlive: true }),
25662
- * @type {HTTPAgent}
25727
+ * Maximum context size in bytes. Default: 65536 (64KB)
25663
25728
  */
25664
- httpAgent?: Agent;
25729
+ maxContextBytes?: number;
25665
25730
  /**
25666
- * Set a custom HTTPS Agent
25667
- *
25668
- * This is helpful for eg, to enable keepAlive which helps prevents ECONNRESET socket hang up errors
25669
- * Usage:
25670
- * const { Agent: HTTPSAgent } = require("https");
25671
- * ...
25672
- * httpsAgent: new HTTPSAgent({ keepAlive: true }),
25673
- * @type {HTTPSAgent}
25731
+ * TTL for conversation history in seconds. Default: 86400 (24h)
25674
25732
  */
25675
- httpsAgent?: Agent$1;
25733
+ ttl?: number;
25676
25734
  /**
25677
- * Set a custom paramsSerializer
25678
- *
25679
- * See axios documentation for more information on how to use this parameter: https://axios-http.com/docs/req_config
25680
- * This is helpful for handling React Native issues like this: https://github.com/axios/axios/issues/6102#issuecomment-2085301397
25681
- * @type {any}
25735
+ * Name of the conversation history collection. Default: 'conversation_history'
25682
25736
  */
25683
- paramsSerializer?: any;
25737
+ historyCollection?: string;
25684
25738
  /**
25685
- * Set a custom axios adapter
25686
- *
25687
- * Useful for customizing the underlying HTTP client library used by Typesense.
25688
- *
25689
- * For example, you can use this to use a custom HTTP client library like `fetch`, in order for the library to work on the edge.
25690
- * Related GiHub issue: https://github.com/typesense/typesense-js/issues/161
25691
- *
25692
- * See axios documentation for more information on how to use this parameter: https://axios-http.com/docs/req_config
25739
+ * Number of chunks to retrieve for RAG context. Default: 10
25693
25740
  */
25694
- axiosAdapter?: AxiosRequestConfig$1["adapter"];
25741
+ kResults?: number;
25695
25742
  }
25743
+ //#endregion
25744
+ //#region src/plugin/rag-types.d.ts
25696
25745
  /**
25697
- * Configuration options for streaming responses
25746
+ * Search feature configuration for the Typesense RAG plugin
25698
25747
  */
25699
- interface BaseStreamConfig {
25700
- /**
25701
- * Callback function that will be called for each chunk of data received
25702
- * during streaming
25703
- */
25704
- onChunk?: (data: {
25705
- conversation_id: string;
25706
- message: string;
25707
- }) => void;
25708
- /**
25709
- * Callback function that will be called if there is an error during streaming
25710
- */
25711
- onError?: (error: Error) => void;
25748
+ interface TypesenseSearchConfig {
25749
+ /** Enable search endpoints */
25750
+ enabled: boolean;
25751
+ /** Default search settings */
25752
+ defaults?: {
25753
+ /** Search mode: 'semantic' | 'hybrid' | 'keyword' */
25754
+ mode?: 'semantic' | 'hybrid' | 'keyword';
25755
+ /** Results per page */
25756
+ perPage?: number;
25757
+ /** Tables to search by default */
25758
+ tables?: string[];
25759
+ };
25712
25760
  }
25713
25761
  /**
25714
- * Stream configuration for standard search responses
25715
- * For specialized responses like MultiSearch, extend BaseStreamConfig with the appropriate onComplete signature
25762
+ * Configuration for the Typesense RAG plugin
25763
+ *
25764
+ * This plugin handles all Typesense-specific functionality:
25765
+ * - Search endpoints
25766
+ * - RAG endpoints
25767
+ * - Schema synchronization
25768
+ * - Agent synchronization
25716
25769
  */
25717
- interface StreamConfig<T extends DocumentSchema> extends BaseStreamConfig {
25770
+ interface TypesenseRAGPluginConfig {
25771
+ /** Typesense connection configuration */
25772
+ typesense: TypesenseConnectionConfig;
25718
25773
  /**
25719
- * Callback function that will be called when the streaming is complete
25720
- */
25721
- onComplete?: (data: SearchResponse$1<T>) => void;
25722
- }
25723
- declare class Configuration {
25724
- readonly nodes: NodeConfiguration[] | NodeConfigurationWithHostname[] | NodeConfigurationWithUrl[];
25725
- readonly nearestNode?: NodeConfiguration | NodeConfigurationWithHostname | NodeConfigurationWithUrl;
25726
- readonly connectionTimeoutSeconds: number;
25727
- readonly healthcheckIntervalSeconds: number;
25728
- readonly numRetries: number;
25729
- readonly retryIntervalSeconds: number;
25730
- readonly apiKey: string;
25731
- readonly sendApiKeyAsQueryParam?: boolean;
25732
- readonly cacheSearchResultsForSeconds: number;
25733
- readonly useServerSideSearchCache: boolean;
25734
- readonly logger: Logger$1;
25735
- readonly logLevel: LogLevelDesc;
25736
- readonly additionalHeaders?: Record<string, string>;
25737
- readonly httpAgent?: Agent;
25738
- readonly httpsAgent?: Agent$1;
25739
- readonly paramsSerializer?: any;
25740
- readonly axiosAdapter?: AxiosRequestConfig$1["adapter"];
25741
- constructor(options: ConfigurationOptions);
25742
- validate(): boolean;
25743
- private validateNodes;
25744
- private isNodeMissingAnyParameters;
25745
- private setDefaultPathInNode;
25746
- private setDefaultPortInNode;
25747
- private showDeprecationWarnings;
25748
- private shuffleArray;
25774
+ * Embedding provider config (for RAG query embedding)
25775
+ * Note: The RAG handler creates its own provider instance to track usage/spending.
25776
+ * The EmbeddingService from createIndexerPlugin is used for document sync, not RAG queries.
25777
+ */
25778
+ embeddingConfig?: EmbeddingProviderConfig;
25779
+ /** Collection configurations (for schema sync) */
25780
+ collections?: Record<string, TableConfig[]>;
25781
+ /** Search configuration */
25782
+ search?: TypesenseSearchConfig;
25783
+ /** RAG agent configurations */
25784
+ agents?: AgentConfig[];
25785
+ /** Callback functions for permissions, session management, etc. */
25786
+ callbacks?: RAGCallbacks;
25787
+ /** Hybrid search configuration */
25788
+ hybrid?: HybridSearchConfig;
25789
+ /** HNSW optimization configuration */
25790
+ hnsw?: HNSWConfig;
25791
+ /** Advanced search configuration */
25792
+ advanced?: AdvancedSearchConfig;
25749
25793
  }
25750
25794
  //#endregion
25795
+ //#region src/plugin/create-rag-plugin.d.ts
25796
+ /**
25797
+ * Creates a composable Typesense RAG plugin for Payload CMS
25798
+ *
25799
+ * This plugin handles all Typesense-specific features:
25800
+ * - Search endpoints (semantic, hybrid, keyword)
25801
+ * - RAG endpoints (chat, session management)
25802
+ * - Schema synchronization
25803
+ * - Agent synchronization
25804
+ *
25805
+ * @param config - Typesense RAG plugin configuration
25806
+ * @returns Payload config modifier function
25807
+ */
25808
+ declare function createTypesenseRAGPlugin(config: TypesenseRAGPluginConfig): (payloadConfig: Config) => Config;
25809
+ //#endregion
25751
25810
  //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Errors/TypesenseError.d.ts
25752
25811
  declare class TypesenseError extends Error {
25753
25812
  httpStatus?: number;
@@ -25756,7 +25815,7 @@ declare class TypesenseError extends Error {
25756
25815
  }
25757
25816
  //#endregion
25758
25817
  //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/ApiCall.d.ts
25759
- interface Node$1 extends NodeConfiguration {
25818
+ interface Node extends NodeConfiguration {
25760
25819
  isHealthy: boolean;
25761
25820
  index: string | number;
25762
25821
  }
@@ -25768,7 +25827,7 @@ interface HttpClient {
25768
25827
  isStreamingRequest
25769
25828
  }: {
25770
25829
  abortSignal?: AbortSignal | null;
25771
- responseType?: AxiosRequestConfig["responseType"] | undefined;
25830
+ responseType?: AxiosRequestConfig$2["responseType"] | undefined;
25772
25831
  streamConfig?: StreamConfig<T extends DocumentSchema ? T : DocumentSchema> | undefined;
25773
25832
  isStreamingRequest: boolean | undefined;
25774
25833
  }): Promise<T>;
@@ -25780,7 +25839,7 @@ interface HttpClient {
25780
25839
  isStreamingRequest
25781
25840
  }: {
25782
25841
  abortSignal?: AbortSignal | null;
25783
- responseType?: AxiosRequestConfig["responseType"] | undefined;
25842
+ responseType?: AxiosRequestConfig$2["responseType"] | undefined;
25784
25843
  streamConfig?: StreamConfig<T extends DocumentSchema ? T : DocumentSchema> | undefined;
25785
25844
  isStreamingRequest: boolean | undefined;
25786
25845
  }): Promise<T>;
@@ -25808,7 +25867,7 @@ declare class ApiCall implements HttpClient {
25808
25867
  isStreamingRequest
25809
25868
  }?: {
25810
25869
  abortSignal?: any;
25811
- responseType?: AxiosRequestConfig["responseType"] | undefined;
25870
+ responseType?: AxiosRequestConfig$2["responseType"] | undefined;
25812
25871
  streamConfig?: StreamConfig<T extends DocumentSchema ? T : DocumentSchema> | undefined;
25813
25872
  isStreamingRequest?: boolean | undefined;
25814
25873
  }): Promise<T>;
@@ -25820,7 +25879,7 @@ declare class ApiCall implements HttpClient {
25820
25879
  isStreamingRequest
25821
25880
  }?: {
25822
25881
  abortSignal?: AbortSignal | null;
25823
- responseType?: AxiosRequestConfig["responseType"] | undefined;
25882
+ responseType?: AxiosRequestConfig$2["responseType"] | undefined;
25824
25883
  streamConfig?: StreamConfig<T extends DocumentSchema ? T : DocumentSchema> | undefined;
25825
25884
  isStreamingRequest?: boolean | undefined;
25826
25885
  }): Promise<T>;
@@ -25842,7 +25901,7 @@ declare class ApiCall implements HttpClient {
25842
25901
  bodyParameters?: any;
25843
25902
  additionalHeaders?: any;
25844
25903
  abortSignal?: any;
25845
- responseType?: AxiosRequestConfig["responseType"] | undefined;
25904
+ responseType?: AxiosRequestConfig$2["responseType"] | undefined;
25846
25905
  skipConnectionTimeout?: boolean;
25847
25906
  enableKeepAlive?: boolean | undefined;
25848
25907
  streamConfig?: StreamConfig<T extends DocumentSchema ? T : DocumentSchema> | undefined;
@@ -25866,7 +25925,7 @@ declare class ApiCall implements HttpClient {
25866
25925
  private isChunkMessage;
25867
25926
  private combineMessageChunks;
25868
25927
  private isCompleteSearchResponse;
25869
- getNextNode(requestNumber?: number): Node$1;
25928
+ getNextNode(requestNumber?: number): Node;
25870
25929
  nodeDueForHealthcheck(node: any, requestNumber?: number): boolean;
25871
25930
  initializeMetadataForNodes(): void;
25872
25931
  setNodeHealthcheck(node: any, isHealthy: any): void;
@@ -25879,1060 +25938,727 @@ declare class ApiCall implements HttpClient {
25879
25938
  private invokeOnErrorCallback;
25880
25939
  }
25881
25940
  //#endregion
25882
- //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Override.d.ts
25883
- interface OverrideSchema extends OverrideCreateSchema {
25884
- id: string;
25941
+ //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Types.d.ts
25942
+ type DropTokensMode = "right_to_left" | "left_to_right" | "both_sides:3";
25943
+ type OperationMode = "off" | "always" | "fallback";
25944
+ type CommaSeparated<T extends string, ToExtend, OriginalString extends string = T, Previous extends string[] = []> = T extends `${infer Start},${infer Rest}` ? TrimString<Start> extends ToExtend ? CommaSeparated<Rest, ToExtend, OriginalString, [...Previous, TrimString<Start>]> : {
25945
+ error: "Invalid operation mode";
25946
+ value: TrimString<Start>;
25947
+ } : TrimString<T> extends ToExtend ? OriginalString : {
25948
+ error: "Invalid operation mode";
25949
+ value: TrimString<T>;
25950
+ };
25951
+ interface SearchParams$1<TDoc extends DocumentSchema, Infix extends string = string> {
25952
+ q?: "*" | (string & {});
25953
+ query_by?: string | string[];
25954
+ query_by_weights?: string | number[];
25955
+ prefix?: string | boolean | boolean[];
25956
+ filter_by?: string;
25957
+ max_filter_by_candidates?: number;
25958
+ enable_synonyms?: boolean;
25959
+ enable_analytics?: boolean;
25960
+ filter_curated_hits?: boolean;
25961
+ enable_lazy_filter?: boolean;
25962
+ sort_by?: string | string[];
25963
+ facet_by?: string | string[];
25964
+ max_facet_values?: number;
25965
+ facet_sample_threshold?: number;
25966
+ facet_sample_percent?: number;
25967
+ facet_query?: string;
25968
+ facet_query_num_typos?: number;
25969
+ facet_return_parent?: string;
25970
+ facet_strategy?: "exhaustive" | "top_values" | "automatic";
25971
+ page?: number;
25972
+ per_page?: number;
25973
+ group_by?: string | string[];
25974
+ group_limit?: number;
25975
+ group_missing_values?: boolean;
25976
+ include_fields?: string | string[];
25977
+ exclude_fields?: string | string[];
25978
+ highlight_fields?: string | string[];
25979
+ highlight_full_fields?: string | string[];
25980
+ highlight_affix_num_tokens?: number;
25981
+ highlight_start_tag?: string;
25982
+ highlight_end_tag?: string;
25983
+ enable_highlight_v1?: boolean;
25984
+ snippet_threshold?: number;
25985
+ nl_query?: boolean;
25986
+ nl_model_id?: string;
25987
+ nl_query_debug?: boolean;
25988
+ nl_query_prompt_cache_ttl?: number;
25989
+ num_typos?: string | number | number[];
25990
+ min_len_1typo?: number;
25991
+ min_len_2typo?: number;
25992
+ split_join_tokens?: OperationMode;
25993
+ exhaustive_search?: boolean;
25994
+ drop_tokens_threshold?: number;
25995
+ drop_tokens_mode?: DropTokensMode;
25996
+ typo_tokens_threshold?: number;
25997
+ pinned_hits?: string | string[];
25998
+ hidden_hits?: string | string[];
25999
+ limit_hits?: number;
26000
+ pre_segmented_query?: boolean;
26001
+ enable_overrides?: boolean;
26002
+ override_tags?: string | string[];
26003
+ prioritize_exact_match?: boolean;
26004
+ prioritize_token_position?: boolean;
26005
+ prioritize_num_matching_fields?: boolean;
26006
+ search_cutoff_ms?: number;
26007
+ use_cache?: boolean;
26008
+ max_candidates?: number;
26009
+ infix?: CommaSeparated<Infix, OperationMode> | OperationMode[] | OperationMode;
26010
+ preset?: string;
26011
+ text_match_type?: "max_score" | "max_weight" | "sum_score";
26012
+ vector_query?: string;
26013
+ "x-typesense-api-key"?: string;
26014
+ "x-typesense-user-id"?: string;
26015
+ offset?: number;
26016
+ limit?: number;
26017
+ stopwords?: string;
26018
+ conversation?: boolean;
26019
+ validate_field_names?: boolean;
26020
+ conversation_stream?: boolean;
26021
+ conversation_model_id?: string;
26022
+ conversation_id?: string;
26023
+ voice_query?: string;
26024
+ streamConfig?: StreamConfig<TDoc>;
25885
26025
  }
25886
- interface OverrideDeleteSchema {
25887
- id: string;
26026
+ interface SearchResponseRequestParams {
26027
+ collection_name?: string;
26028
+ q?: string;
26029
+ page?: number;
26030
+ per_page?: number;
26031
+ first_q?: string;
26032
+ voice_query?: {
26033
+ transcribed_query?: string;
26034
+ };
25888
26035
  }
25889
- declare class Override {
25890
- private collectionName;
25891
- private overrideId;
25892
- private apiCall;
25893
- constructor(collectionName: string, overrideId: string, apiCall: ApiCall);
25894
- retrieve(): Promise<OverrideSchema>;
25895
- delete(): Promise<OverrideDeleteSchema>;
25896
- private endpointPath;
26036
+ interface SearchableDocuments<T extends DocumentSchema = DocumentSchema, Infix extends string = string> {
26037
+ search(searchParameters: SearchParams$1<T, Infix> | SearchParamsWithPreset<T, Infix>, options: SearchOptions): Promise<SearchResponse$1<T>>;
26038
+ clearCache(): void;
25897
26039
  }
25898
- //#endregion
25899
- //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Overrides.d.ts
25900
- interface OverrideRuleQuerySchema {
25901
- query?: string;
25902
- match?: "exact" | "contains";
26040
+ interface WriteableDocuments<T> {
26041
+ create(document: T, options: DocumentWriteParameters): Promise<T>;
26042
+ upsert(document: T, options: DocumentWriteParameters): Promise<T>;
26043
+ update(document: T, options: DocumentWriteParameters): Promise<T>;
26044
+ delete(query: DeleteQuery): Promise<DeleteResponse>;
26045
+ import(documents: T[] | string, options: DocumentWriteParameters): Promise<string | ImportResponse[]>;
26046
+ export(options: DocumentsExportParameters): Promise<string>;
25903
26047
  }
25904
- interface OverrideRuleFilterSchema {
25905
- filter_by?: string;
26048
+ interface MultiSearchUnionStreamConfig<T extends DocumentSchema> extends BaseStreamConfig {
26049
+ onComplete?: (data: UnionSearchResponse<T>) => void;
25906
26050
  }
25907
- interface OverrideRuleTagsSchema {
25908
- tags?: string[];
26051
+ interface MultiSearchResultsStreamConfig<T extends DocumentSchema[]> extends BaseStreamConfig {
26052
+ onComplete?: (data: {
26053
+ results: { [Index in keyof T]: SearchResponse$1<T[Index]> } & {
26054
+ length: T["length"];
26055
+ };
26056
+ }) => void;
25909
26057
  }
25910
- interface OverrideCreateSchema {
25911
- rule: OverrideRuleQuerySchema & OverrideRuleFilterSchema & OverrideRuleTagsSchema;
25912
- filter_by?: string;
25913
- sort_by?: string;
25914
- remove_matched_tokens?: boolean;
25915
- replace_query?: string;
25916
- includes?: Array<{
25917
- id: string;
25918
- position: number;
25919
- }>;
25920
- excludes?: Array<{
25921
- id: string;
25922
- }>;
25923
- filter_curated_hits?: boolean;
25924
- effective_from_ts?: number;
25925
- effective_to_ts?: number;
25926
- stop_processing?: boolean;
25927
- metadata?: object;
26058
+ interface RequestParams<T extends DocumentSchema[]> {
26059
+ path: string;
26060
+ queryParams?: Record<string, unknown>;
26061
+ body?: unknown;
26062
+ headers?: Record<string, string>;
26063
+ streamConfig?: StreamConfig<T[number]> | MultiSearchResultsStreamConfig<T> | MultiSearchUnionStreamConfig<T[number]>;
26064
+ abortSignal?: AbortSignal | null;
26065
+ responseType?: AxiosRequestConfig$1["responseType"] | undefined;
26066
+ isStreamingRequest: boolean | undefined;
25928
26067
  }
25929
- interface OverridesRetrieveSchema {
25930
- overrides: OverrideSchema[];
26068
+ interface MultiSearchRequestsWithUnionSchema<T extends DocumentSchema, Infix extends string> extends SearchesMultiSearchesRequestSchema<T, Infix> {
26069
+ union: true;
25931
26070
  }
25932
- declare class Overrides {
25933
- private collectionName;
25934
- private apiCall;
25935
- constructor(collectionName: string, apiCall: ApiCall);
25936
- upsert(overrideId: string, params: OverrideCreateSchema): Promise<OverrideSchema>;
25937
- retrieve(): Promise<OverridesRetrieveSchema>;
25938
- private endpointPath;
25939
- static get RESOURCEPATH(): string;
26071
+ interface MultiSearchRequestsWithoutUnionSchema<T extends DocumentSchema, Infix extends string> extends SearchesMultiSearchesRequestSchema<T, Infix> {
26072
+ union?: false | undefined;
25940
26073
  }
25941
- //#endregion
25942
- //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Synonym.d.ts
25943
- interface SynonymSchema extends SynonymCreateSchema {
25944
- id: string;
26074
+ type MultiSearchRequestsSchema<T extends DocumentSchema, Infix extends string> = MultiSearchRequestsWithUnionSchema<T, Infix> | MultiSearchRequestsWithoutUnionSchema<T, Infix>;
26075
+ interface UnionSearchResponse<T extends DocumentSchema> extends Omit<SearchResponse$1<T>, "request_params"> {
26076
+ union_request_params: SearchResponseRequestParams[];
25945
26077
  }
25946
- interface SynonymDeleteSchema {
25947
- id: string;
26078
+ interface MultiSearchUnionStreamConfig<T extends DocumentSchema> extends BaseStreamConfig {
26079
+ onComplete?: (data: UnionSearchResponse<T>) => void;
25948
26080
  }
25949
- declare class Synonym {
25950
- private collectionName;
25951
- private synonymId;
25952
- private apiCall;
25953
- constructor(collectionName: string, synonymId: string, apiCall: ApiCall);
25954
- retrieve(): Promise<SynonymSchema>;
25955
- delete(): Promise<SynonymDeleteSchema>;
25956
- private endpointPath;
26081
+ interface MultiSearchResultsStreamConfig<T extends DocumentSchema[]> extends BaseStreamConfig {
26082
+ onComplete?: (data: {
26083
+ results: { [Index in keyof T]: SearchResponse$1<T[Index]> } & {
26084
+ length: T["length"];
26085
+ };
26086
+ }) => void;
25957
26087
  }
25958
- //#endregion
25959
- //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Synonyms.d.ts
25960
- interface SynonymCreateSchema {
25961
- synonyms: string[];
25962
- root?: string;
25963
- locale?: string;
25964
- symbols_to_index?: string[];
26088
+ interface SearchesMultiSearchesRequestSchema<T extends DocumentSchema, Infix extends string> {
26089
+ searches: (MultiSearchRequestSchema<T, Infix> | MultiSearchRequestWithPresetSchema<T, Infix>)[];
25965
26090
  }
25966
- interface SynonymsRetrieveSchema {
25967
- synonyms: SynonymSchema[];
25968
- }
25969
- declare class Synonyms {
25970
- private collectionName;
25971
- private apiCall;
25972
- constructor(collectionName: string, apiCall: ApiCall);
25973
- upsert(synonymId: string, params: SynonymCreateSchema): Promise<SynonymSchema>;
25974
- retrieve(): Promise<SynonymsRetrieveSchema>;
25975
- private endpointPath;
25976
- static get RESOURCEPATH(): string;
26091
+ interface BaseMultiSearchRequestSchema {
26092
+ collection?: string;
26093
+ rerank_hybrid_matches?: boolean;
26094
+ "x-typesense-api-key"?: string;
25977
26095
  }
26096
+ type CommonMultiSearchParametersBase<T extends DocumentSchema, Infix extends string> = Partial<BaseMultiSearchRequestSchema & Omit<SearchParams$1<T, Infix>, "streamConfig">>;
26097
+ type MultiSearchRequestSchema<T extends DocumentSchema, Infix extends string> = BaseMultiSearchRequestSchema & Omit<SearchParams$1<T, Infix>, "streamConfig">;
26098
+ type MultiSearchRequestWithPresetSchema<T extends DocumentSchema, Infix extends string> = BaseMultiSearchRequestSchema & Omit<SearchParamsWithPreset<T, Infix>, "streamConfig">;
26099
+ type MultiSearchUnionParameters<T extends DocumentSchema, Infix extends string> = CommonMultiSearchParametersBase<T, Infix> & {
26100
+ streamConfig?: MultiSearchUnionStreamConfig<T>;
26101
+ use_cache?: boolean;
26102
+ };
26103
+ type MultiSearchResultsParameters<T extends DocumentSchema[], Infix extends string> = CommonMultiSearchParametersBase<T[number], Infix> & {
26104
+ streamConfig?: MultiSearchResultsStreamConfig<T>;
26105
+ use_cache?: boolean;
26106
+ };
26107
+ type Whitespace = " " | "\n" | "\t";
26108
+ type TrimString<S extends string> = S extends `${Whitespace}${infer S}` ? TrimString<S> : S extends `${infer S}${Whitespace}` ? TrimString<S> : S;
25978
26109
  //#endregion
25979
- //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Document.d.ts
25980
- declare class Document<T extends DocumentSchema = object> {
25981
- private collectionName;
25982
- private documentId;
25983
- private apiCall;
25984
- constructor(collectionName: string, documentId: string, apiCall: ApiCall);
25985
- retrieve(): Promise<T>;
25986
- delete(options?: DeleteQuery): Promise<T>;
25987
- update(partialDocument: Partial<T>, options?: DocumentWriteParameters): Promise<T>;
25988
- private endpointPath;
26110
+ //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/RequestWithCache.d.ts
26111
+ declare class RequestWithCache {
26112
+ private responseCache;
26113
+ private responsePromiseCache;
26114
+ clearCache(): void;
26115
+ perform<const TContext extends HttpClient, const TMethod extends keyof HttpClient, const TDoc extends DocumentSchema[], TResult>(requestContext: TContext, methodName: TMethod, requestParams: RequestParams<TDoc>, cacheOptions: CacheOptions$2 | undefined): Promise<TResult>;
26116
+ private executeRequest;
26117
+ }
26118
+ interface CacheOptions$2 {
26119
+ cacheResponseForSeconds?: number;
26120
+ maxSize?: number;
25989
26121
  }
25990
26122
  //#endregion
25991
- //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Collection.d.ts
25992
- type FieldType = "string" | "int32" | "int64" | "float" | "bool" | "geopoint" | "geopolygon" | "geopoint[]" | "string[]" | "int32[]" | "int64[]" | "float[]" | "bool[]" | "object" | "object[]" | "auto" | "string*" | "image";
25993
- interface CollectionFieldSchema extends Partial<Pick<BaseCollectionCreateSchema, "token_separators" | "symbols_to_index">> {
25994
- name: string;
25995
- type: FieldType;
25996
- optional?: boolean;
25997
- facet?: boolean;
25998
- index?: boolean;
25999
- sort?: boolean;
26000
- locale?: string;
26001
- infix?: boolean;
26002
- stem?: boolean;
26003
- num_dim?: number;
26004
- store?: boolean;
26005
- range_index?: boolean;
26006
- [t: string]: unknown;
26123
+ //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/SearchOnlyDocuments.d.ts
26124
+ declare class SearchOnlyDocuments<T extends DocumentSchema> implements SearchableDocuments<T> {
26125
+ protected collectionName: string;
26126
+ protected apiCall: ApiCall;
26127
+ protected configuration: Configuration;
26128
+ protected requestWithCache: RequestWithCache;
26129
+ constructor(collectionName: string, apiCall: ApiCall, configuration: Configuration);
26130
+ clearCache(): void;
26131
+ search<const Infix extends string>(searchParameters: SearchParams$1<T, Infix> | SearchParamsWithPreset<T, Infix>, {
26132
+ cacheSearchResultsForSeconds,
26133
+ abortSignal
26134
+ }?: SearchOptions): Promise<SearchResponse$1<T>>;
26135
+ protected endpointPath(operation?: string): string;
26136
+ static get RESOURCEPATH(): string;
26007
26137
  }
26008
- interface CollectionSchema extends CollectionCreateSchema {
26009
- created_at: number;
26010
- num_documents: number;
26011
- num_memory_shards: number;
26138
+ //#endregion
26139
+ //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Documents.d.ts
26140
+ type DeleteQuery = {
26141
+ truncate?: true;
26142
+ } | {
26143
+ truncate?: never;
26144
+ filter_by?: string;
26145
+ batch_size?: number;
26146
+ ignore_not_found?: boolean;
26147
+ return_doc?: boolean;
26148
+ return_id?: boolean;
26149
+ };
26150
+ interface DeleteResponse<T extends DocumentSchema = DocumentSchema> {
26151
+ num_deleted: number;
26152
+ documents?: T[];
26153
+ ids?: string[];
26012
26154
  }
26013
- interface CollectionDropFieldSchema {
26014
- name: string;
26015
- drop: true;
26155
+ interface ImportResponseSuccess<T extends DocumentSchema = DocumentSchema> {
26156
+ success: true;
26157
+ error?: never;
26158
+ document?: T;
26159
+ id?: string;
26160
+ code?: never;
26016
26161
  }
26017
- interface CollectionUpdateSchema extends Partial<Omit<CollectionCreateSchema, "name" | "fields">> {
26018
- fields?: (CollectionFieldSchema | CollectionDropFieldSchema)[];
26162
+ interface ImportResponseFail<T extends DocumentSchema = DocumentSchema> {
26163
+ success: false;
26164
+ error: string;
26165
+ document?: T;
26166
+ id?: string;
26167
+ code: number;
26019
26168
  }
26020
- interface CollectionDeleteOptions {
26021
- compact_store?: boolean;
26169
+ type ImportResponse<T extends DocumentSchema = DocumentSchema> = ImportResponseSuccess<T> | ImportResponseFail<T>;
26170
+ type DocumentSchema = Record<string, any>;
26171
+ interface SearchParamsWithPreset<T extends DocumentSchema, Infix extends string> extends Partial<SearchParams$1<T, Infix>> {
26172
+ preset: string;
26022
26173
  }
26023
- declare class Collection<T extends DocumentSchema = object> {
26024
- private readonly name;
26025
- private readonly apiCall;
26026
- private readonly configuration;
26027
- private readonly _documents;
26028
- private individualDocuments;
26029
- private readonly _overrides;
26030
- private individualOverrides;
26031
- private readonly _synonyms;
26032
- private individualSynonyms;
26033
- constructor(name: string, apiCall: ApiCall, configuration: any);
26034
- retrieve(): Promise<CollectionSchema>;
26035
- update(schema: CollectionUpdateSchema): Promise<CollectionSchema>;
26036
- delete(options?: CollectionDeleteOptions): Promise<CollectionSchema>;
26037
- exists(): Promise<boolean>;
26038
- documents(): Documents<T>;
26039
- documents(documentId: string): Document<T>;
26040
- overrides(): Overrides;
26041
- overrides(overrideId: string): Override;
26042
- synonyms(): Synonyms;
26043
- synonyms(synonymId: string): Synonym;
26044
- private endpointPath;
26174
+ type SearchResponseHighlightObject = {
26175
+ matched_tokens?: string[];
26176
+ snippet?: string;
26177
+ value?: string;
26178
+ };
26179
+ type SearchResponseHighlight<T> = T extends string | number ? SearchResponseHighlightObject : { [TAttribute in keyof T]?: SearchResponseHighlight<T[TAttribute]> };
26180
+ interface SearchResponseHit<T extends DocumentSchema> {
26181
+ curated?: true;
26182
+ highlights?: [{
26183
+ field: keyof T;
26184
+ snippet?: string;
26185
+ value?: string;
26186
+ snippets?: string[];
26187
+ indices?: number[];
26188
+ matched_tokens: string[][] | string[];
26189
+ }];
26190
+ highlight: SearchResponseHighlight<T>;
26191
+ document: T;
26192
+ text_match: number;
26193
+ text_match_info?: {
26194
+ best_field_score: `${number}`;
26195
+ best_field_weight: number;
26196
+ fields_matched: number;
26197
+ score: `${number}`;
26198
+ tokens_matched: number;
26199
+ };
26200
+ geo_distance_meters?: {
26201
+ location: number;
26202
+ };
26045
26203
  }
26046
- //#endregion
26047
- //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Collections.d.ts
26048
- interface BaseCollectionCreateSchema {
26049
- name: string;
26050
- default_sorting_field?: string;
26051
- symbols_to_index?: string[];
26052
- token_separators?: string[];
26053
- enable_nested_fields?: boolean;
26054
- metadata?: object;
26055
- voice_query_model?: {
26056
- model_name?: string;
26204
+ interface SearchResponseFacetCountSchema<T extends DocumentSchema> {
26205
+ counts: {
26206
+ count: number;
26207
+ highlighted: string;
26208
+ value: string;
26209
+ parent?: Record<string, string | number | boolean>;
26210
+ }[];
26211
+ field_name: keyof T;
26212
+ sampled: boolean;
26213
+ stats: {
26214
+ avg?: number;
26215
+ max?: number;
26216
+ min?: number;
26217
+ sum?: number;
26218
+ total_values?: number;
26057
26219
  };
26058
26220
  }
26059
- interface CollectionCreateSchemaWithSrc extends Pick<BaseCollectionCreateSchema, "name"> {
26060
- fields?: CollectionFieldSchema[];
26221
+ interface LLMResponse {
26222
+ content: string;
26223
+ extraction_method: string;
26224
+ model: string;
26061
26225
  }
26062
- interface CollectionCreateSchemaWithoutSrc extends BaseCollectionCreateSchema {
26063
- fields: CollectionFieldSchema[];
26226
+ interface SearchResponse$1<T extends DocumentSchema> {
26227
+ facet_counts?: SearchResponseFacetCountSchema<T>[];
26228
+ found: number;
26229
+ found_docs?: number;
26230
+ out_of: number;
26231
+ page: number;
26232
+ request_params: SearchResponseRequestParams;
26233
+ search_time_ms: number;
26234
+ search_cutoff?: boolean;
26235
+ hits?: SearchResponseHit<T>[];
26236
+ grouped_hits?: {
26237
+ group_key: string[];
26238
+ hits: SearchResponseHit<T>[];
26239
+ found?: number;
26240
+ }[];
26241
+ parsed_nl_query?: {
26242
+ parse_time_ms: number;
26243
+ generated_params: SearchParams$1<T>;
26244
+ augmented_params: SearchParams$1<T>;
26245
+ llm_response?: LLMResponse;
26246
+ };
26247
+ conversation?: {
26248
+ answer: string;
26249
+ conversation_history: {
26250
+ conversation: object[];
26251
+ id: string;
26252
+ last_updated: number;
26253
+ ttl: number;
26254
+ };
26255
+ conversation_id: string;
26256
+ query: string;
26257
+ };
26258
+ error?: string;
26259
+ code?: number;
26064
26260
  }
26065
- /**
26066
- * Defines the schema for creating a collection in Typesense.
26067
- *
26068
- * If the `src_name` property in `Options` is a string, the `fields` prop is optional, and only used for embedding fields.
26069
- * Otherwise, `fields` will be required.
26070
- */
26071
- type CollectionCreateSchema<Options$20 extends CollectionCreateOptions = CollectionCreateOptions> = Options$20["src_name"] extends string ? CollectionCreateSchemaWithSrc : CollectionCreateSchemaWithoutSrc;
26072
- interface CollectionCreateOptions {
26073
- src_name?: string;
26261
+ interface DocumentWriteParameters {
26262
+ dirty_values?: "coerce_or_reject" | "coerce_or_drop" | "drop" | "reject";
26263
+ action?: "create" | "update" | "upsert" | "emplace";
26074
26264
  }
26075
- interface CollectionsRetrieveOptions {
26076
- exclude_fields?: string;
26265
+ interface UpdateByFilterParameters {
26266
+ filter_by?: string;
26077
26267
  }
26078
- declare class Collections {
26079
- private apiCall;
26080
- constructor(apiCall: ApiCall);
26081
- create<const Options$20 extends CollectionCreateOptions>(schema: CollectionCreateSchema<Options$20>, options?: Options$20): Promise<CollectionSchema>;
26082
- retrieve(options?: CollectionsRetrieveOptions): Promise<CollectionSchema[]>;
26083
- static get RESOURCEPATH(): string;
26268
+ interface UpdateByFilterResponse {
26269
+ num_updated: number;
26084
26270
  }
26085
- //#endregion
26086
- //#region src/shared/types/plugin-types.d.ts
26087
- /**
26088
- * Hybrid search configuration for combining semantic and keyword search
26089
- */
26090
- interface HybridSearchConfig {
26091
- /** Weight between semantic (1.0) and keyword (0.0) search. Default: 0.9 (90% semantic, 10% keyword) */
26092
- alpha?: number;
26093
- /** Whether to rerank hybrid search results. Default: true */
26094
- rerankMatches?: boolean;
26095
- /** Fields to use for keyword search portion. Default: 'chunk_text,title' */
26096
- queryFields?: string;
26271
+ interface DocumentImportParameters extends DocumentWriteParameters {
26272
+ batch_size?: number;
26273
+ remote_embedding_batch_size?: number;
26274
+ remote_embedding_timeout_ms?: number;
26275
+ remote_embedding_num_tries?: number;
26276
+ return_doc?: boolean;
26277
+ return_id?: boolean;
26278
+ throwOnFail?: boolean;
26097
26279
  }
26098
- /**
26099
- * HNSW (Hierarchical Navigable Small World) optimization parameters
26100
- * These optimize vector search performance and quality
26101
- */
26102
- interface HNSWConfig {
26103
- /** Higher = better quality, slower indexing. Default: 200 */
26104
- efConstruction?: number;
26105
- /** Connections per node - balance memory/speed. Default: 16 */
26106
- M?: number;
26107
- /** Search quality - higher = better quality, slower search. Default: 100 */
26108
- ef?: number;
26109
- /** Maximum connections per element. Default: 64 */
26110
- maxConnections?: number;
26111
- /** Distance metric for vector similarity. Default: 'cosine' */
26112
- distanceMetric?: 'cosine' | 'l2' | 'ip';
26280
+ interface DocumentsExportParameters {
26281
+ filter_by?: string;
26282
+ include_fields?: string;
26283
+ exclude_fields?: string;
26113
26284
  }
26114
- /**
26115
- * Advanced search parameters for better relevance
26116
- */
26117
- interface AdvancedSearchConfig {
26118
- /** Minimum tokens before allowing typos. Default: 1 */
26119
- typoTokensThreshold?: number;
26120
- /** Number of typos to allow. Default: 2 */
26121
- numTypos?: number;
26122
- /** Enable prefix matching for partial queries. Default: true */
26123
- prefix?: boolean;
26124
- /** Minimum tokens before dropping tokens for partial matching. Default: 1 */
26125
- dropTokensThreshold?: number;
26126
- /** Enable stemming for better language matching. Default: true */
26127
- enableStemming?: boolean;
26285
+ interface SearchOptions {
26286
+ cacheSearchResultsForSeconds?: number;
26287
+ abortSignal?: AbortSignal | null;
26128
26288
  }
26129
- /**
26130
- * Source chunk information for citations
26131
- */
26132
- interface ChunkSource {
26133
- /** Unique chunk ID */
26134
- id: string;
26135
- /** Parent document title */
26136
- title: string;
26137
- /** Parent document slug for URL construction */
26138
- slug: string;
26139
- /** Type of document */
26140
- type: string;
26141
- /** Chunk index within the document */
26142
- chunkIndex: number;
26143
- /** Relevance score (lower is better for vector distance) */
26144
- relevanceScore: number;
26145
- /** Full content of the chunk (markdown) */
26146
- content: string;
26147
- /** Optional excerpt from the chunk (first 200 chars) */
26148
- excerpt?: string;
26289
+ declare class Documents<T extends DocumentSchema = object> extends SearchOnlyDocuments<T> implements WriteableDocuments<T> {
26290
+ constructor(collectionName: string, apiCall: ApiCall, configuration: Configuration);
26291
+ create(document: T, options?: DocumentWriteParameters): Promise<T>;
26292
+ upsert(document: T, options?: DocumentWriteParameters): Promise<T>;
26293
+ update(document: T, options: UpdateByFilterParameters): Promise<UpdateByFilterResponse>;
26294
+ update(document: T, options: DocumentWriteParameters): Promise<T>;
26295
+ delete(query?: DeleteQuery): Promise<DeleteResponse<T>>;
26296
+ createMany(documents: T[], options?: DocumentImportParameters): Promise<ImportResponse<T>[]>;
26297
+ /**
26298
+ * Import a set of documents in a batch.
26299
+ * @param {string|Array} documents - Can be a JSONL string of documents or an array of document objects.
26300
+ * @param options
26301
+ * @return {string|Array} Returns a JSONL string if the input was a JSONL string, otherwise it returns an array of results.
26302
+ */
26303
+ import(documents: string, options?: DocumentImportParameters): Promise<string>;
26304
+ import(documents: T[], options?: DocumentImportParameters): Promise<ImportResponse<T>[]>;
26305
+ /**
26306
+ * Imports documents from a NodeJS readable stream of JSONL.
26307
+ */
26308
+ importStream(readableStream: ReadStream, options?: DocumentImportParameters): Promise<ImportResponse<T>[]>;
26309
+ /**
26310
+ * Returns a JSONL string for all the documents in this collection
26311
+ */
26312
+ export(options?: DocumentsExportParameters): Promise<string>;
26313
+ /**
26314
+ * Returns a NodeJS readable stream of JSONL for all the documents in this collection.
26315
+ */
26316
+ exportStream(options?: DocumentsExportParameters): Promise<ReadStream>;
26149
26317
  }
26150
- /**
26151
- * SSE event types
26152
- */
26153
- type SSEEventType = 'conversation_id' | 'token' | 'sources' | 'done' | 'error' | 'usage';
26154
- /**
26155
- * Usage info structure
26156
- */
26157
- interface UsageInfo {
26158
- tokens_used: number;
26159
- cost_usd: number;
26160
- daily_limit: number;
26161
- daily_used: number;
26162
- daily_remaining: number;
26163
- reset_at?: string;
26318
+ //#endregion
26319
+ //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Configuration.d.ts
26320
+ interface NodeConfiguration {
26321
+ host: string;
26322
+ port: number;
26323
+ protocol: string;
26324
+ path?: string;
26325
+ url?: string;
26164
26326
  }
26165
- /**
26166
- * Token usage breakdown
26167
- */
26168
- interface TokenUsage {
26169
- input?: number;
26170
- output?: number;
26171
- total: number;
26327
+ interface NodeConfigurationWithHostname {
26328
+ host: string;
26329
+ port: number;
26330
+ protocol: string;
26331
+ path?: string;
26172
26332
  }
26173
- /**
26174
- * Service types for spending tracking
26175
- */
26176
- type ServiceType = 'openai_embedding' | 'openai_llm';
26177
- /**
26178
- * Spending entry for tracking AI service costs
26179
- */
26180
- interface SpendingEntry {
26181
- service: ServiceType;
26182
- model: string;
26183
- tokens: TokenUsage;
26184
- cost_usd?: number;
26185
- timestamp: string;
26333
+ interface NodeConfigurationWithUrl {
26334
+ url: string;
26186
26335
  }
26187
- /**
26188
- * SSE event structure
26189
- */
26190
- interface SSEEvent {
26191
- type: SSEEventType;
26192
- data: string | ChunkSource[] | {
26193
- error: string;
26194
- } | UsageInfo;
26336
+ interface ConfigurationOptions {
26337
+ apiKey: string;
26338
+ nodes: NodeConfiguration[] | NodeConfigurationWithHostname[] | NodeConfigurationWithUrl[];
26339
+ randomizeNodes?: boolean;
26340
+ /**
26341
+ * @deprecated
26342
+ * masterNode is now consolidated to nodes, starting with Typesense Server v0.12'
26343
+ */
26344
+ masterNode?: NodeConfiguration | NodeConfigurationWithHostname | NodeConfigurationWithUrl;
26345
+ /**
26346
+ * @deprecated
26347
+ * readReplicaNodes is now consolidated to nodes, starting with Typesense Server v0.12'
26348
+ */
26349
+ readReplicaNodes?: NodeConfiguration[] | NodeConfigurationWithHostname[] | NodeConfigurationWithUrl[];
26350
+ nearestNode?: NodeConfiguration | NodeConfigurationWithHostname | NodeConfigurationWithUrl;
26351
+ connectionTimeoutSeconds?: number;
26352
+ timeoutSeconds?: number;
26353
+ healthcheckIntervalSeconds?: number;
26354
+ numRetries?: number;
26355
+ retryIntervalSeconds?: number;
26356
+ sendApiKeyAsQueryParam?: boolean | undefined;
26357
+ useServerSideSearchCache?: boolean;
26358
+ cacheSearchResultsForSeconds?: number;
26359
+ additionalHeaders?: Record<string, string>;
26360
+ logLevel?: LogLevelDesc;
26361
+ logger?: Logger$1;
26362
+ /**
26363
+ * Set a custom HTTP Agent
26364
+ *
26365
+ * This is helpful for eg, to enable keepAlive which helps prevents ECONNRESET socket hang up errors
26366
+ * Usage:
26367
+ * const { Agent: HTTPAgent } = require("http");
26368
+ * ...
26369
+ * httpAgent: new HTTPAgent({ keepAlive: true }),
26370
+ * @type {HTTPAgent}
26371
+ */
26372
+ httpAgent?: Agent;
26373
+ /**
26374
+ * Set a custom HTTPS Agent
26375
+ *
26376
+ * This is helpful for eg, to enable keepAlive which helps prevents ECONNRESET socket hang up errors
26377
+ * Usage:
26378
+ * const { Agent: HTTPSAgent } = require("https");
26379
+ * ...
26380
+ * httpsAgent: new HTTPSAgent({ keepAlive: true }),
26381
+ * @type {HTTPSAgent}
26382
+ */
26383
+ httpsAgent?: Agent$1;
26384
+ /**
26385
+ * Set a custom paramsSerializer
26386
+ *
26387
+ * See axios documentation for more information on how to use this parameter: https://axios-http.com/docs/req_config
26388
+ * This is helpful for handling React Native issues like this: https://github.com/axios/axios/issues/6102#issuecomment-2085301397
26389
+ * @type {any}
26390
+ */
26391
+ paramsSerializer?: any;
26392
+ /**
26393
+ * Set a custom axios adapter
26394
+ *
26395
+ * Useful for customizing the underlying HTTP client library used by Typesense.
26396
+ *
26397
+ * For example, you can use this to use a custom HTTP client library like `fetch`, in order for the library to work on the edge.
26398
+ * Related GiHub issue: https://github.com/typesense/typesense-js/issues/161
26399
+ *
26400
+ * See axios documentation for more information on how to use this parameter: https://axios-http.com/docs/req_config
26401
+ */
26402
+ axiosAdapter?: AxiosRequestConfig["adapter"];
26195
26403
  }
26196
26404
  /**
26197
- * Typesense search hit document (chunk-specific)
26405
+ * Configuration options for streaming responses
26198
26406
  */
26199
- interface TypesenseRAGChunkDocument {
26200
- id: string;
26201
- chunk_text: string;
26202
- title?: string;
26203
- slug?: string;
26204
- parent_doc_id?: string;
26205
- chunk_index?: number;
26206
- [key: string]: unknown;
26407
+ interface BaseStreamConfig {
26408
+ /**
26409
+ * Callback function that will be called for each chunk of data received
26410
+ * during streaming
26411
+ */
26412
+ onChunk?: (data: {
26413
+ conversation_id: string;
26414
+ message: string;
26415
+ }) => void;
26416
+ /**
26417
+ * Callback function that will be called if there is an error during streaming
26418
+ */
26419
+ onError?: (error: Error) => void;
26207
26420
  }
26208
26421
  /**
26209
- * Typesense search hit
26422
+ * Stream configuration for standard search responses
26423
+ * For specialized responses like MultiSearch, extend BaseStreamConfig with the appropriate onComplete signature
26210
26424
  */
26211
- interface TypesenseSearchHit {
26212
- document: TypesenseRAGChunkDocument;
26213
- vector_distance?: number;
26214
- text_match?: number;
26215
- [key: string]: unknown;
26216
- }
26217
- /**
26218
- * Typesense search result
26219
- */
26220
- interface TypesenseSearchResult {
26221
- hits?: TypesenseSearchHit[];
26222
- request_params?: {
26223
- collection_name?: string;
26224
- [key: string]: unknown;
26225
- };
26226
- [key: string]: unknown;
26227
- }
26228
- /**
26229
- * Configuration for building Typesense queries
26230
- */
26231
- interface TypesenseQueryConfig {
26232
- /** User's message/query */
26233
- userMessage: string;
26234
- /** Query embedding vector */
26235
- queryEmbedding: number[];
26236
- /** Optional: Filter by selected document IDs */
26237
- selectedDocuments?: string[];
26238
- /** Optional: Conversation ID for follow-up */
26239
- chatId?: string;
26240
- /** Collections to search */
26241
- searchCollections: string[];
26242
- /** Number of results to retrieve */
26243
- kResults?: number;
26244
- /** Advanced search config */
26245
- advancedConfig?: AdvancedSearchConfig;
26246
- }
26247
- interface RAGCallbacks {
26248
- /** Get Payload instance (required) */
26249
- getPayload: () => Promise<Payload>;
26250
- /** Check permissions function (required) */
26251
- checkPermissions: (request: PayloadRequest) => Promise<boolean>;
26252
- /** Check token limit function (optional) */
26253
- checkTokenLimit?: (payload: Payload, userId: string | number, tokens: number) => Promise<{
26254
- allowed: boolean;
26255
- limit: number;
26256
- used: number;
26257
- remaining: number;
26258
- reset_at?: string;
26259
- }>;
26260
- /** Get user usage stats function (optional) */
26261
- getUserUsageStats?: (payload: Payload, userId: string | number) => Promise<{
26262
- limit: number;
26263
- used: number;
26264
- remaining: number;
26265
- reset_at?: string;
26266
- }>;
26267
- /** Save chat session function (optional) */
26268
- saveChatSession?: (payload: Payload, userId: string | number, conversationId: string, userMessage: string, assistantMessage: string, sources: ChunkSource[], spending: SpendingEntry[], collectionName: CollectionSlug) => Promise<void>;
26269
- /** Create embedding spending function (optional) */
26270
- createEmbeddingSpending?: (model: string, tokens: number) => SpendingEntry;
26271
- /** Estimate tokens from text function (optional) */
26272
- estimateTokensFromText?: (text: string) => number;
26273
- }
26274
- /**
26275
- * Complete RAG configuration
26276
- */
26277
- interface RAGConfig {
26278
- /** Hybrid search settings */
26279
- hybrid?: HybridSearchConfig;
26280
- /** HNSW optimization settings */
26281
- hnsw?: HNSWConfig;
26282
- /** Advanced search settings */
26283
- advanced?: AdvancedSearchConfig;
26284
- }
26285
- interface RAGFeatureConfig extends RAGConfig {
26286
- enabled: boolean;
26287
- callbacks?: RAGCallbacks;
26288
- agents: AgentConfig[];
26289
- }
26290
- /**
26291
- * Modelos OpenAI
26292
- */
26293
- type OpenAIEmbeddingModel = "text-embedding-3-small" | "text-embedding-3-large" | "text-embedding-ada-002";
26294
- /**
26295
- * Modelos Gemini
26296
- */
26297
- type GeminiEmbeddingModel = "gemini-embedding-001" | "text-embedding-004";
26298
- /**
26299
- * Dimensiones por modelo
26300
- */
26301
- type OpenAIDimensionsByModel = {
26302
- "text-embedding-3-large": 3072;
26303
- "text-embedding-3-small": 1536;
26304
- "text-embedding-ada-002": 1536;
26305
- };
26306
- type GeminiDimensionsByModel = {
26307
- "gemini-embedding-001": number;
26308
- "text-embedding-004": 768;
26309
- };
26310
- /**
26311
- * Config por proveedor (Estructura anidada unificada)
26312
- */
26313
- type OpenAIProviderConfig = {
26314
- type: "openai";
26315
- model?: OpenAIEmbeddingModel;
26316
- dimensions?: OpenAIDimensionsByModel[OpenAIEmbeddingModel];
26317
- apiKey: string;
26318
- };
26319
- type GeminiProviderConfig = {
26320
- type: "gemini";
26321
- model?: GeminiEmbeddingModel;
26322
- dimensions?: GeminiDimensionsByModel[GeminiEmbeddingModel];
26323
- apiKey: string;
26324
- };
26325
- /**
26326
- * Config del proveedor (Union)
26327
- */
26328
- type EmbeddingProviderConfig = OpenAIProviderConfig | GeminiProviderConfig;
26329
- type TypesenseProtocol = "http" | "https";
26330
- type TypesenseNode = {
26331
- host: string;
26332
- port: number;
26333
- protocol: TypesenseProtocol;
26334
- path?: string;
26335
- };
26336
- /**
26337
- * Configuration for Typesense connection
26338
- */
26339
- type TypesenseConnectionConfig = {
26340
- apiKey: string;
26341
- connectionTimeoutSeconds?: number;
26342
- retryIntervalSeconds?: number;
26343
- nodes: [TypesenseNode, ...Array<TypesenseNode>];
26344
- };
26345
- /**
26346
- * Main plugin configuration
26347
- */
26348
- /**
26349
- * Configuration for a single conversational agent
26350
- */
26351
- interface AgentConfig {
26352
- /**
26353
- * Unique identifier for the agent (used in API requests)
26354
- */
26355
- slug: string;
26356
- /**
26357
- * Display name for the agent (shown in UI)
26358
- * If not provided, slug will be used.
26359
- */
26360
- name?: string;
26361
- /**
26362
- * Optional API Key for the LLM provider.
26363
- * If provided, this overrides the global embedding provider API key for this agent.
26364
- */
26365
- apiKey?: string;
26366
- /**
26367
- * System prompt that defines the agent's personality and constraints
26368
- */
26369
- systemPrompt: string;
26370
- /**
26371
- * LLM model to use (e.g., 'openai/gpt-4o-mini')
26372
- */
26373
- llmModel: string;
26374
- /**
26375
- * Collections this agent is allowed to search in
26376
- */
26377
- searchCollections: string[];
26378
- /**
26379
- * Maximum context size in bytes. Default: 65536 (64KB)
26380
- */
26381
- maxContextBytes?: number;
26382
- /**
26383
- * TTL for conversation history in seconds. Default: 86400 (24h)
26384
- */
26385
- ttl?: number;
26386
- /**
26387
- * Name of the conversation history collection. Default: 'conversation_history'
26388
- */
26389
- historyCollection?: string;
26390
- /**
26391
- * Number of chunks to retrieve for RAG context. Default: 10
26392
- */
26393
- kResults?: number;
26394
- }
26395
- //#endregion
26396
- //#region src/core/config/mapping-types.d.ts
26397
- /**
26398
- * Field mapping configuration
26399
- * Defines how a Payload field maps to a Typesense field
26400
- */
26401
- interface FieldMapping {
26402
- /**
26403
- * Name of the field in Typesense
26404
- */
26405
- name: string;
26406
- /**
26407
- * Path to the field in Payload (supports dot notation)
26408
- * If not provided, defaults to 'name'
26409
- */
26410
- payloadField?: string;
26411
- /**
26412
- * Type of the field in Typesense
26413
- */
26414
- type: "string" | "int32" | "int64" | "float" | "bool" | "string[]" | "float[]" | "object" | "auto";
26415
- /**
26416
- * Whether the field should be faceted
26417
- */
26418
- facet?: boolean;
26419
- /**
26420
- * Whether the field should be indexed (searchable)
26421
- */
26422
- index?: boolean;
26423
- /**
26424
- * Whether the field is optional
26425
- */
26426
- optional?: boolean;
26427
- /**
26428
- * Custom transformation function to convert Payload value to Typesense value
26429
- * Useful for handling relations, rich text, or any complex data type
26430
- *
26431
- * @param value - The raw value from Payload
26432
- * @returns The transformed value for Typesense
26433
- *
26434
- * @example
26435
- * // Convert relation array to string array of names
26436
- * transform: (value) => {
26437
- * if (Array.isArray(value)) {
26438
- * return value.map(item => item.name || item.title || String(item));
26439
- * }
26440
- * return [];
26441
- * }
26442
- */
26443
- transform?: (value: any) => any;
26444
- }
26445
- /**
26446
- * Base configuration for any table mapping
26447
- */
26448
- interface BaseTableConfig {
26449
- /**
26450
- * Name of the table in Typesense
26451
- * If not provided, generated from collection slug + suffix
26452
- */
26453
- tableName?: string;
26454
- /**
26455
- * Display name for UI
26456
- */
26457
- displayName?: string;
26458
- /**
26459
- * Whether this table sync is enabled
26460
- */
26461
- enabled: boolean;
26462
- /**
26463
- * Fields to map from Payload to Typesense
26464
- */
26465
- fields: FieldMapping[];
26466
- /**
26467
- * Optional callback to determine if a document should be indexed
26468
- *
26469
- * @param doc - The document being indexed
26470
- * @returns boolean | Promise<boolean> - true to index, false to skip
26471
- */
26472
- shouldIndex?: (doc: any) => boolean | Promise<boolean>;
26473
- }
26474
- /**
26475
- * Configuration for Table Mapping
26476
- */
26477
- interface TableConfig extends BaseTableConfig {
26478
- /**
26479
- * Embedding configuration
26480
- * Defines how to generate embeddings for this table
26481
- */
26482
- embedding?: {
26483
- /**
26484
- * Source fields to extract and transform for embedding generation
26485
- * These will be concatenated if multiple are provided
26486
- */
26487
- fields: (string | SourceField)[];
26488
- /**
26489
- * Optional chunking configuration
26490
- * If provided, the content will be chunked before embedding
26491
- */
26492
- chunking?: {
26493
- strategy: "markdown" | "text";
26494
- size?: number;
26495
- overlap?: number;
26496
- /**
26497
- * Callback to intercept and modify chunk results
26498
- * Allows adding extra metadata or modifying the chunk text before embedding
26499
- *
26500
- * @param chunkResultsWithMetadata - The generated chunks with their metadata
26501
- * @param payloadDocument - The original Payload document
26502
- * @returns The modified chunk text or object
26503
- */
26504
- interceptResult?: (chunkResultsWithMetadata: any, payloadDocument: any) => string;
26505
- };
26506
- };
26507
- }
26508
- /**
26509
- * Source field configuration for embedding/chunking
26510
- * Defines a field to extract and optionally transform
26511
- */
26512
- interface SourceField {
26513
- /**
26514
- * Name of the field in Payload
26515
- */
26516
- field: string;
26425
+ interface StreamConfig<T extends DocumentSchema> extends BaseStreamConfig {
26517
26426
  /**
26518
- * Optional transform function to convert the field value
26519
- * Useful for converting RichText to plain text/markdown
26520
- *
26521
- * @param value - The raw value from Payload
26522
- * @returns The transformed value
26427
+ * Callback function that will be called when the streaming is complete
26523
26428
  */
26524
- transform?: (value: any) => any | Promise<any>;
26429
+ onComplete?: (data: SearchResponse$1<T>) => void;
26525
26430
  }
26526
- /**
26527
- * Collection configuration
26528
- * Maps a Payload collection to one or more Typesense tables
26529
- */
26530
- interface CollectionConfig {
26531
- tables: TableConfig[];
26431
+ declare class Configuration {
26432
+ readonly nodes: NodeConfiguration[] | NodeConfigurationWithHostname[] | NodeConfigurationWithUrl[];
26433
+ readonly nearestNode?: NodeConfiguration | NodeConfigurationWithHostname | NodeConfigurationWithUrl;
26434
+ readonly connectionTimeoutSeconds: number;
26435
+ readonly healthcheckIntervalSeconds: number;
26436
+ readonly numRetries: number;
26437
+ readonly retryIntervalSeconds: number;
26438
+ readonly apiKey: string;
26439
+ readonly sendApiKeyAsQueryParam?: boolean;
26440
+ readonly cacheSearchResultsForSeconds: number;
26441
+ readonly useServerSideSearchCache: boolean;
26442
+ readonly logger: Logger$1;
26443
+ readonly logLevel: LogLevelDesc;
26444
+ readonly additionalHeaders?: Record<string, string>;
26445
+ readonly httpAgent?: Agent;
26446
+ readonly httpsAgent?: Agent$1;
26447
+ readonly paramsSerializer?: any;
26448
+ readonly axiosAdapter?: AxiosRequestConfig["adapter"];
26449
+ constructor(options: ConfigurationOptions);
26450
+ validate(): boolean;
26451
+ private validateNodes;
26452
+ private isNodeMissingAnyParameters;
26453
+ private setDefaultPathInNode;
26454
+ private setDefaultPortInNode;
26455
+ private showDeprecationWarnings;
26456
+ private shuffleArray;
26532
26457
  }
26533
26458
  //#endregion
26534
- //#region src/core/config/types.d.ts
26535
- type SearchMode = "semantic" | "keyword" | "hybrid";
26536
- interface SearchDefaults {
26537
- mode?: SearchMode;
26538
- perPage?: number;
26539
- tables?: string[];
26540
- }
26541
- interface SearchFeatureConfig {
26542
- enabled: boolean;
26543
- defaults?: SearchDefaults;
26544
- }
26545
- interface SyncFeatureConfig {
26546
- enabled: boolean;
26547
- autoSync?: boolean;
26548
- batchSize?: number;
26459
+ //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Override.d.ts
26460
+ interface OverrideSchema extends OverrideCreateSchema {
26461
+ id: string;
26549
26462
  }
26550
- interface FeatureFlags {
26551
- embedding?: EmbeddingProviderConfig;
26552
- search?: SearchFeatureConfig;
26553
- rag?: RAGFeatureConfig;
26554
- sync?: SyncFeatureConfig;
26463
+ interface OverrideDeleteSchema {
26464
+ id: string;
26555
26465
  }
26556
- interface ModularPluginConfig {
26557
- typesense: TypesenseConnectionConfig;
26558
- features: FeatureFlags;
26559
- collections: Record<CollectionSlug | string, TableConfig[]>;
26466
+ declare class Override {
26467
+ private collectionName;
26468
+ private overrideId;
26469
+ private apiCall;
26470
+ constructor(collectionName: string, overrideId: string, apiCall: ApiCall);
26471
+ retrieve(): Promise<OverrideSchema>;
26472
+ delete(): Promise<OverrideDeleteSchema>;
26473
+ private endpointPath;
26560
26474
  }
26561
26475
  //#endregion
26562
- //#region src/plugin/main-plugin.d.ts
26563
- /**
26564
- * Typesense Search Plugin for Payload CMS
26565
- *
26566
- * Provides full-text search and vector search capabilities using Typesense,
26567
- * with optional RAG (Retrieval Augmented Generation) support.
26568
- *
26569
- * @param pluginOptions - Configuration options for the plugin
26570
- * @returns Payload config modifier function
26571
- */
26572
- declare const typesenseSearch: (pluginOptions: ModularPluginConfig) => (config: Config) => Config;
26573
- //#endregion
26574
- //#region src/shared/types/types.d.ts
26575
- /**
26576
- * Generic types for better type safety across the plugin
26577
- */
26578
- interface BaseDocument {
26579
- _status?: 'draft' | 'published';
26580
- createdAt: Date | string;
26581
- publishedAt: Date | string;
26582
- id: string;
26583
- slug?: string;
26584
- updatedAt: Date | string;
26585
- }
26586
- interface PayloadDocument extends BaseDocument {
26587
- [key: string]: unknown;
26476
+ //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Overrides.d.ts
26477
+ interface OverrideRuleQuerySchema {
26478
+ query?: string;
26479
+ match?: "exact" | "contains";
26588
26480
  }
26589
- interface TypesenseDocument {
26590
- id: string;
26591
- slug?: string;
26592
- title?: string;
26593
- createdAt: number;
26594
- updatedAt: number;
26595
- embedding?: number[];
26596
- [key: string]: unknown;
26481
+ interface OverrideRuleFilterSchema {
26482
+ filter_by?: string;
26597
26483
  }
26598
- interface TypesenseChunkDocument {
26599
- id: string;
26600
- parent_doc_id: string;
26601
- slug: string;
26602
- title: string;
26603
- createdAt: number;
26604
- publishedAt?: number;
26605
- updatedAt: number;
26606
- chunk_index: number;
26607
- chunk_text: string;
26608
- is_chunk: boolean;
26609
- embedding: number[];
26484
+ interface OverrideRuleTagsSchema {
26485
+ tags?: string[];
26610
26486
  }
26611
- interface SearchResult<T = TypesenseDocument> {
26612
- collection?: string;
26613
- content?: string;
26614
- displayName?: string;
26615
- document: T;
26616
- highlight?: {
26617
- [field: string]: {
26618
- matched_tokens: string[];
26619
- snippet: string;
26620
- value: string;
26621
- };
26622
- };
26623
- highlights?: Array<{
26624
- field: string;
26625
- matched_tokens: string[];
26626
- snippet: string;
26627
- value: string;
26487
+ interface OverrideCreateSchema {
26488
+ rule: OverrideRuleQuerySchema & OverrideRuleFilterSchema & OverrideRuleTagsSchema;
26489
+ filter_by?: string;
26490
+ sort_by?: string;
26491
+ remove_matched_tokens?: boolean;
26492
+ replace_query?: string;
26493
+ includes?: Array<{
26494
+ id: string;
26495
+ position: number;
26628
26496
  }>;
26629
- icon?: string;
26630
- id: string;
26631
- text_match?: number;
26632
- text_match_info?: {
26633
- best_field_score: string;
26634
- best_field_weight: number;
26635
- fields_matched: number;
26636
- score: string;
26637
- tokens_matched: number;
26638
- };
26639
- vector_distance?: number;
26640
- title?: string;
26641
- updatedAt?: string;
26642
- }
26643
- interface SearchResponse<T = TypesenseDocument> {
26644
- collections?: Array<{
26645
- collection: string;
26646
- displayName: string;
26647
- error?: string;
26648
- found: number;
26649
- icon: string;
26497
+ excludes?: Array<{
26498
+ id: string;
26650
26499
  }>;
26651
- found: number;
26652
- hits: SearchResult<T>[];
26653
- page: number;
26654
- request_params: {
26655
- page?: number;
26656
- per_page: number;
26657
- q: string;
26658
- sort_by?: string;
26659
- };
26660
- search_cutoff: boolean;
26661
- search_time_ms: number;
26662
- }
26663
- interface SuggestResult<T = TypesenseDocument> {
26664
- collection?: string;
26665
- displayName?: string;
26666
- document: T;
26667
- highlight?: Record<string, string>;
26668
- icon?: string;
26669
- text_match?: number;
26500
+ filter_curated_hits?: boolean;
26501
+ effective_from_ts?: number;
26502
+ effective_to_ts?: number;
26503
+ stop_processing?: boolean;
26504
+ metadata?: object;
26670
26505
  }
26671
- interface SuggestResponse<T = TypesenseDocument> {
26672
- found: number;
26673
- hits: SuggestResult<T>[];
26674
- page: number;
26675
- request_params: {
26676
- per_page: number;
26677
- q: string;
26678
- };
26679
- search_cutoff: boolean;
26680
- search_time_ms: number;
26506
+ interface OverridesRetrieveSchema {
26507
+ overrides: OverrideSchema[];
26681
26508
  }
26682
- interface SearchParams {
26683
- facets?: string[];
26684
- filters?: Record<string, unknown>;
26685
- highlight_fields?: string[];
26686
- num_typos?: number;
26687
- page?: number;
26688
- per_page?: number;
26689
- q: string;
26690
- snippet_threshold?: number;
26691
- sort_by?: string;
26692
- typo_tokens_threshold?: number;
26509
+ declare class Overrides {
26510
+ private collectionName;
26511
+ private apiCall;
26512
+ constructor(collectionName: string, apiCall: ApiCall);
26513
+ upsert(overrideId: string, params: OverrideCreateSchema): Promise<OverrideSchema>;
26514
+ retrieve(): Promise<OverridesRetrieveSchema>;
26515
+ private endpointPath;
26516
+ static get RESOURCEPATH(): string;
26693
26517
  }
26694
- interface BaseSearchInputProps<T = TypesenseDocument> {
26695
- baseUrl: string;
26696
- className?: string;
26697
- collection?: string;
26698
- debounceMs?: number;
26699
- errorClassName?: string;
26700
- inputClassName?: string;
26701
- inputWrapperClassName?: string;
26702
- loadingClassName?: string;
26703
- maxResults?: number;
26704
- minQueryLength?: number;
26705
- noResultsClassName?: string;
26706
- onError?: (error: string) => void;
26707
- onLoading?: (loading: boolean) => void;
26708
- onResultClick?: (result: SearchResult<T>) => void;
26709
- onResults?: (results: SearchResponse<T>) => void;
26710
- onSearch?: (query: string, results: SearchResponse<T>) => void;
26711
- placeholder?: string;
26712
- resultsHeaderClassName?: string;
26713
- resultsListClassName?: string;
26518
+ //#endregion
26519
+ //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Synonym.d.ts
26520
+ interface SynonymSchema extends SynonymCreateSchema {
26521
+ id: string;
26714
26522
  }
26715
- interface CacheEntry<T = unknown> {
26716
- data: T;
26717
- timestamp: number;
26718
- ttl: number;
26523
+ interface SynonymDeleteSchema {
26524
+ id: string;
26719
26525
  }
26720
- interface CacheOptions$1 {
26721
- maxSize?: number;
26722
- ttl?: number;
26526
+ declare class Synonym {
26527
+ private collectionName;
26528
+ private synonymId;
26529
+ private apiCall;
26530
+ constructor(collectionName: string, synonymId: string, apiCall: ApiCall);
26531
+ retrieve(): Promise<SynonymSchema>;
26532
+ delete(): Promise<SynonymDeleteSchema>;
26533
+ private endpointPath;
26723
26534
  }
26724
- interface HealthCheckResponse {
26725
- cache?: {
26726
- maxSize: number;
26727
- size: number;
26728
- };
26729
- collections?: string[];
26730
- error?: string;
26731
- lastSync?: number;
26732
- status: 'healthy' | 'unhealthy';
26733
- typesense?: {
26734
- ok: boolean;
26735
- version?: string;
26736
- };
26535
+ //#endregion
26536
+ //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Synonyms.d.ts
26537
+ interface SynonymCreateSchema {
26538
+ synonyms: string[];
26539
+ root?: string;
26540
+ locale?: string;
26541
+ symbols_to_index?: string[];
26737
26542
  }
26738
- interface ErrorResponse {
26739
- code?: string;
26740
- details?: string;
26741
- error: string;
26742
- timestamp?: string;
26543
+ interface SynonymsRetrieveSchema {
26544
+ synonyms: SynonymSchema[];
26743
26545
  }
26744
- interface ApiResponse<T = unknown> {
26745
- data?: T;
26746
- error?: ErrorResponse;
26747
- meta?: {
26748
- cached?: boolean;
26749
- requestId?: string;
26750
- timestamp: string;
26751
- };
26752
- success: boolean;
26546
+ declare class Synonyms {
26547
+ private collectionName;
26548
+ private apiCall;
26549
+ constructor(collectionName: string, apiCall: ApiCall);
26550
+ upsert(synonymId: string, params: SynonymCreateSchema): Promise<SynonymSchema>;
26551
+ retrieve(): Promise<SynonymsRetrieveSchema>;
26552
+ private endpointPath;
26553
+ static get RESOURCEPATH(): string;
26753
26554
  }
26754
26555
  //#endregion
26755
- //#region src/features/embedding/embeddings.d.ts
26756
- /**
26757
- * Embedding result with usage tracking
26758
- */
26759
- interface EmbeddingWithUsage {
26760
- /** The embedding vector */
26761
- embedding: number[];
26762
- /** Usage information */
26763
- usage: {
26764
- /** Number of tokens used */
26765
- promptTokens: number;
26766
- /** Total tokens (same as prompt_tokens for embeddings) */
26767
- totalTokens: number;
26768
- };
26769
- }
26770
- /**
26771
- * Batch embedding result with usage tracking
26772
- */
26773
- interface BatchEmbeddingWithUsage {
26774
- /** Array of embedding vectors */
26775
- embeddings: number[][];
26776
- /** Total usage information */
26777
- usage: {
26778
- /** Number of tokens used */
26779
- promptTokens: number;
26780
- /** Total tokens (same as prompt_tokens for embeddings) */
26781
- totalTokens: number;
26782
- };
26556
+ //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Document.d.ts
26557
+ declare class Document<T extends DocumentSchema = object> {
26558
+ private collectionName;
26559
+ private documentId;
26560
+ private apiCall;
26561
+ constructor(collectionName: string, documentId: string, apiCall: ApiCall);
26562
+ retrieve(): Promise<T>;
26563
+ delete(options?: DeleteQuery): Promise<T>;
26564
+ update(partialDocument: Partial<T>, options?: DocumentWriteParameters): Promise<T>;
26565
+ private endpointPath;
26783
26566
  }
26784
- /**
26785
- * Generates an embedding for the given text using OpenAI or Gemini API
26786
- * @param text - The text to generate an embedding for
26787
- * @param config - Optional embedding configuration (provider, model, dimensions, apiKey)
26788
- * @returns The embedding vector as an array of numbers, or null if generation fails
26789
- */
26790
- declare const generateEmbedding: (text: string, config?: EmbeddingProviderConfig) => Promise<number[] | null>;
26791
- /**
26792
- * Generate embedding with usage tracking
26793
- *
26794
- * This function returns both the embedding and usage information (tokens used)
26795
- *
26796
- * @param text - The text to generate an embedding for
26797
- * @param config - Optional embedding configuration
26798
- * @returns Embedding with usage information, or null if generation fails
26799
- */
26800
- declare const generateEmbeddingWithUsage: (text: string, config?: EmbeddingProviderConfig) => Promise<EmbeddingWithUsage | null>;
26801
- /**
26802
- * Generate embeddings for multiple texts with usage tracking (batch)
26803
- *
26804
- * @param texts - Array of texts to generate embeddings for
26805
- * @param config - Optional embedding configuration
26806
- * @returns Embeddings with total usage information, or null if generation fails
26807
- */
26808
- declare const generateEmbeddingsBatchWithUsage: (texts: string[], config?: EmbeddingProviderConfig) => Promise<BatchEmbeddingWithUsage | null>;
26809
26567
  //#endregion
26810
- //#region src/features/rag/query-builder.d.ts
26811
- /**
26812
- * Typesense search request object
26813
- */
26814
- interface TypesenseSearchRequest {
26815
- collection: string;
26816
- query_by: string;
26817
- vector_query: string;
26818
- exclude_fields: string;
26819
- filter_by?: string;
26820
- typo_tokens_threshold?: number;
26821
- num_typos?: number;
26822
- prefix?: boolean;
26823
- drop_tokens_threshold?: number;
26824
- enable_stemming?: boolean;
26568
+ //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Collection.d.ts
26569
+ type FieldType = "string" | "int32" | "int64" | "float" | "bool" | "geopoint" | "geopolygon" | "geopoint[]" | "string[]" | "int32[]" | "int64[]" | "float[]" | "bool[]" | "object" | "object[]" | "auto" | "string*" | "image";
26570
+ interface CollectionFieldSchema extends Partial<Pick<BaseCollectionCreateSchema, "token_separators" | "symbols_to_index">> {
26571
+ name: string;
26572
+ type: FieldType;
26573
+ optional?: boolean;
26574
+ facet?: boolean;
26575
+ index?: boolean;
26576
+ sort?: boolean;
26577
+ locale?: string;
26578
+ infix?: boolean;
26579
+ stem?: boolean;
26580
+ num_dim?: number;
26581
+ store?: boolean;
26582
+ range_index?: boolean;
26583
+ [t: string]: unknown;
26584
+ }
26585
+ interface CollectionSchema extends CollectionCreateSchema {
26586
+ created_at: number;
26587
+ num_documents: number;
26588
+ num_memory_shards: number;
26589
+ }
26590
+ interface CollectionDropFieldSchema {
26591
+ name: string;
26592
+ drop: true;
26593
+ }
26594
+ interface CollectionUpdateSchema extends Partial<Omit<CollectionCreateSchema, "name" | "fields">> {
26595
+ fields?: (CollectionFieldSchema | CollectionDropFieldSchema)[];
26596
+ }
26597
+ interface CollectionDeleteOptions {
26598
+ compact_store?: boolean;
26599
+ }
26600
+ declare class Collection<T extends DocumentSchema = object> {
26601
+ private readonly name;
26602
+ private readonly apiCall;
26603
+ private readonly configuration;
26604
+ private readonly _documents;
26605
+ private individualDocuments;
26606
+ private readonly _overrides;
26607
+ private individualOverrides;
26608
+ private readonly _synonyms;
26609
+ private individualSynonyms;
26610
+ constructor(name: string, apiCall: ApiCall, configuration: any);
26611
+ retrieve(): Promise<CollectionSchema>;
26612
+ update(schema: CollectionUpdateSchema): Promise<CollectionSchema>;
26613
+ delete(options?: CollectionDeleteOptions): Promise<CollectionSchema>;
26614
+ exists(): Promise<boolean>;
26615
+ documents(): Documents<T>;
26616
+ documents(documentId: string): Document<T>;
26617
+ overrides(): Overrides;
26618
+ overrides(overrideId: string): Override;
26619
+ synonyms(): Synonyms;
26620
+ synonyms(synonymId: string): Synonym;
26621
+ private endpointPath;
26825
26622
  }
26826
- /**
26827
- * Build the Typesense conversational search URL with all necessary parameters
26828
- *
26829
- * @param config - Query configuration
26830
- * @param config.userMessage - The user's message/query
26831
- * @param config.chatId - Optional conversation ID for follow-up questions
26832
- * @param conversationModelId - The conversation model ID in Typesense
26833
- * @param typesenseConfig - Typesense connection config
26834
- * @returns URL for the Typesense multi_search endpoint with conversation parameters
26835
- */
26836
- declare function buildConversationalUrl(config: {
26837
- userMessage: string;
26838
- chatId?: string;
26839
- }, conversationModelId: string, typesenseConfig: TypesenseConnectionConfig): URL;
26840
- /**
26841
- * Build multi-search requests for Typesense with hybrid search configuration
26842
- *
26843
- * @param config - Query configuration including embedding, collections, and filters
26844
- * @returns Array of search requests for Typesense multi_search
26845
- */
26846
- declare function buildMultiSearchRequests(config: TypesenseQueryConfig): TypesenseSearchRequest[];
26847
- /**
26848
- * Build the complete Typesense request body for multi-search
26849
- *
26850
- * @param config - Query configuration
26851
- * @returns Request body for Typesense multi_search endpoint
26852
- */
26853
- declare function buildMultiSearchRequestBody(config: TypesenseQueryConfig): {
26854
- searches: TypesenseSearchRequest[];
26855
- };
26856
- /**
26857
- * Build hybrid search parameters for combining semantic and keyword search
26858
- *
26859
- * @param alpha - Weight between semantic (1.0) and keyword (0.0) search
26860
- * @param rerankMatches - Whether to rerank hybrid search results
26861
- * @param queryFields - Fields to use for keyword search
26862
- * @returns Object with hybrid search parameters
26863
- */
26864
- declare function buildHybridSearchParams(alpha?: number, rerankMatches?: boolean, queryFields?: string): {
26865
- alpha: number;
26866
- rerank_hybrid_matches: boolean;
26867
- query_fields: string;
26868
- };
26869
26623
  //#endregion
26870
- //#region src/features/rag/stream-handler.d.ts
26871
- /**
26872
- * Parsed conversation event from Typesense SSE stream
26873
- */
26874
- interface ConversationEvent {
26875
- /** Conversation ID */
26876
- conversationId?: string;
26877
- /** Message token/chunk */
26878
- message?: string;
26879
- /** Search results (only in first event) */
26880
- results?: TypesenseSearchResult[];
26881
- /** Raw parsed data */
26882
- raw?: unknown;
26624
+ //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Collections.d.ts
26625
+ interface BaseCollectionCreateSchema {
26626
+ name: string;
26627
+ default_sorting_field?: string;
26628
+ symbols_to_index?: string[];
26629
+ token_separators?: string[];
26630
+ enable_nested_fields?: boolean;
26631
+ metadata?: object;
26632
+ voice_query_model?: {
26633
+ model_name?: string;
26634
+ };
26883
26635
  }
26884
- /**
26885
- * Stream processing result
26886
- */
26887
- interface StreamProcessingResult {
26888
- /** Full assistant message */
26889
- fullMessage: string;
26890
- /** Conversation ID */
26891
- conversationId: string | null;
26892
- /** Extracted sources */
26893
- sources: ChunkSource[];
26894
- /** Context text (for token estimation) */
26895
- contextText: string;
26636
+ interface CollectionCreateSchemaWithSrc extends Pick<BaseCollectionCreateSchema, "name"> {
26637
+ fields?: CollectionFieldSchema[];
26638
+ }
26639
+ interface CollectionCreateSchemaWithoutSrc extends BaseCollectionCreateSchema {
26640
+ fields: CollectionFieldSchema[];
26896
26641
  }
26897
26642
  /**
26898
- * Parse a single SSE event from Typesense conversation stream
26899
- *
26900
- * @param line - Raw SSE event line
26901
- * @returns Parsed conversation event or null if not parseable
26902
- */
26903
- declare function parseConversationEvent(line: string): ConversationEvent | null;
26904
- /**
26905
- * Extract sources from Typesense search results
26906
- *
26907
- * @param results - Typesense multi-search results array
26908
- * @param documentTypeResolver - Optional function to resolve document type from collection name
26909
- * @returns Array of chunk sources with metadata
26910
- */
26911
- declare function extractSourcesFromResults(results: TypesenseSearchResult[], documentTypeResolver?: (collectionName: string) => string): ChunkSource[];
26912
- /**
26913
- * Build context text from results (useful for token estimation)
26914
- *
26915
- * @param results - Typesense multi-search results array
26916
- * @returns Combined context text from all chunks
26917
- */
26918
- declare function buildContextText(results: TypesenseSearchResult[]): string;
26919
- /**
26920
- * Process a Typesense conversation stream
26921
- *
26922
- * @param response - Fetch Response with SSE stream
26923
- * @param onEvent - Callback for each parsed event
26924
- * @param documentTypeResolver - Optional function to resolve document type
26925
- * @returns Processing result with full message, ID, and sources
26926
- */
26927
- declare function processConversationStream(response: Response, onEvent?: (event: ConversationEvent) => void, documentTypeResolver?: (collectionName: string) => string): Promise<StreamProcessingResult>;
26928
- /**
26929
- * Create a ReadableStream that forwards SSE events
26643
+ * Defines the schema for creating a collection in Typesense.
26930
26644
  *
26931
- * @param response - Fetch Response with SSE stream
26932
- * @param onData - Callback for processing each event before forwarding
26933
- * @returns ReadableStream for SSE events
26645
+ * If the `src_name` property in `Options` is a string, the `fields` prop is optional, and only used for embedding fields.
26646
+ * Otherwise, `fields` will be required.
26934
26647
  */
26935
- declare function createSSEForwardStream(response: Response, onData?: (event: ConversationEvent) => void): ReadableStream<Uint8Array>;
26648
+ type CollectionCreateSchema<Options$20 extends CollectionCreateOptions = CollectionCreateOptions> = Options$20["src_name"] extends string ? CollectionCreateSchemaWithSrc : CollectionCreateSchemaWithoutSrc;
26649
+ interface CollectionCreateOptions {
26650
+ src_name?: string;
26651
+ }
26652
+ interface CollectionsRetrieveOptions {
26653
+ exclude_fields?: string;
26654
+ }
26655
+ declare class Collections {
26656
+ private apiCall;
26657
+ constructor(apiCall: ApiCall);
26658
+ create<const Options$20 extends CollectionCreateOptions>(schema: CollectionCreateSchema<Options$20>, options?: Options$20): Promise<CollectionSchema>;
26659
+ retrieve(options?: CollectionsRetrieveOptions): Promise<CollectionSchema[]>;
26660
+ static get RESOURCEPATH(): string;
26661
+ }
26936
26662
  //#endregion
26937
26663
  //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Aliases.d.ts
26938
26664
  interface CollectionAliasCreateSchema {
@@ -27289,257 +27015,761 @@ declare class ConversationModel {
27289
27015
  private endpointPath;
27290
27016
  }
27291
27017
  //#endregion
27292
- //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/ConversationModels.d.ts
27293
- declare class ConversationModels {
27018
+ //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/ConversationModels.d.ts
27019
+ declare class ConversationModels {
27020
+ private readonly apiCall;
27021
+ constructor(apiCall: ApiCall);
27022
+ create(params: ConversationModelCreateSchema): Promise<ConversationModelCreateSchema>;
27023
+ retrieve(): Promise<ConversationModelSchema[]>;
27024
+ private endpointPath;
27025
+ static get RESOURCEPATH(): string;
27026
+ }
27027
+ //#endregion
27028
+ //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Conversation.d.ts
27029
+ interface ConversationDeleteSchema {
27030
+ id: number;
27031
+ }
27032
+ interface ConversationUpdateSchema {
27033
+ ttl: number;
27034
+ }
27035
+ interface ConversationSchema {
27036
+ id: number;
27037
+ conversation: object[];
27038
+ last_updated: number;
27039
+ ttl: number;
27040
+ }
27041
+ declare class Conversation {
27042
+ private id;
27043
+ private apiCall;
27044
+ constructor(id: string, apiCall: ApiCall);
27045
+ retrieve(): Promise<ConversationSchema[]>;
27046
+ update(params: ConversationUpdateSchema): Promise<ConversationUpdateSchema>;
27047
+ delete(): Promise<ConversationDeleteSchema>;
27048
+ private endpointPath;
27049
+ }
27050
+ //#endregion
27051
+ //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Conversations.d.ts
27052
+ interface ConversationsRetrieveSchema {
27053
+ conversations: ConversationSchema[];
27054
+ }
27055
+ declare class Conversations {
27056
+ private readonly apiCall;
27057
+ private readonly _conversationsModels;
27058
+ private readonly individualConversationModels;
27059
+ constructor(apiCall: ApiCall);
27060
+ retrieve(): Promise<ConversationsRetrieveSchema>;
27061
+ models(): ConversationModels;
27062
+ models(id: string): ConversationModel;
27063
+ static get RESOURCEPATH(): string;
27064
+ }
27065
+ //#endregion
27066
+ //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/StemmingDictionary.d.ts
27067
+ interface StemmingDictionaryCreateSchema {
27068
+ root: string;
27069
+ word: string;
27070
+ }
27071
+ interface StemmingDictionarySchema {
27072
+ id: string;
27073
+ words: StemmingDictionaryCreateSchema[];
27074
+ }
27075
+ declare class StemmingDictionary {
27076
+ private id;
27077
+ private apiCall;
27078
+ constructor(id: string, apiCall: ApiCall);
27079
+ retrieve(): Promise<StemmingDictionarySchema>;
27080
+ private endpointPath;
27081
+ }
27082
+ //#endregion
27083
+ //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/StemmingDictionaries.d.ts
27084
+ interface StemmingDictionariesRetrieveSchema {
27085
+ dictionaries: string[];
27086
+ }
27087
+ declare class StemmingDictionaries {
27088
+ private readonly apiCall;
27089
+ constructor(apiCall: ApiCall);
27090
+ upsert(id: string, wordRootCombinations: StemmingDictionaryCreateSchema[] | string): Promise<StemmingDictionaryCreateSchema[] | string>;
27091
+ retrieve(): Promise<StemmingDictionariesRetrieveSchema>;
27092
+ private endpointPath;
27093
+ static get RESOURCEPATH(): string;
27094
+ }
27095
+ //#endregion
27096
+ //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Stemming.d.ts
27097
+ declare class Stemming {
27098
+ private readonly apiCall;
27099
+ private readonly _stemmingDictionaries;
27100
+ private readonly individualStemmingDictionaries;
27101
+ constructor(apiCall: ApiCall);
27102
+ dictionaries(): StemmingDictionaries;
27103
+ dictionaries(id: string): StemmingDictionary;
27104
+ static get RESOURCEPATH(): string;
27105
+ }
27106
+ //#endregion
27107
+ //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/NLSearchModels.d.ts
27108
+ interface NLSearchModelBase {
27109
+ model_name: string;
27110
+ api_key?: string;
27111
+ api_url?: string;
27112
+ max_bytes?: number;
27113
+ temperature?: number;
27114
+ system_prompt?: string;
27115
+ top_p?: number;
27116
+ top_k?: number;
27117
+ stop_sequences?: string[];
27118
+ api_version?: string;
27119
+ project_id?: string;
27120
+ access_token?: string;
27121
+ refresh_token?: string;
27122
+ client_id?: string;
27123
+ client_secret?: string;
27124
+ region?: string;
27125
+ max_output_tokens?: number;
27126
+ account_id?: string;
27127
+ }
27128
+ interface NLSearchModelCreateSchema extends NLSearchModelBase {
27129
+ id?: string;
27130
+ }
27131
+ interface NLSearchModelSchema extends NLSearchModelBase {
27132
+ id: string;
27133
+ }
27134
+ type NLSearchModelsRetrieveSchema = NLSearchModelSchema[];
27135
+ declare class NLSearchModels {
27136
+ private apiCall;
27137
+ constructor(apiCall: ApiCall);
27138
+ create(schema: NLSearchModelCreateSchema): Promise<NLSearchModelSchema>;
27139
+ retrieve(): Promise<NLSearchModelsRetrieveSchema>;
27140
+ private endpointPath;
27141
+ static get RESOURCEPATH(): string;
27142
+ }
27143
+ //#endregion
27144
+ //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/NLSearchModel.d.ts
27145
+ type NLSearchModelUpdateSchema = NLSearchModelBase;
27146
+ interface NLSearchModelDeleteSchema {
27147
+ id: string;
27148
+ }
27149
+ declare class NLSearchModel {
27150
+ private id;
27151
+ private apiCall;
27152
+ constructor(id: string, apiCall: ApiCall);
27153
+ retrieve(): Promise<NLSearchModelSchema>;
27154
+ update(schema: NLSearchModelUpdateSchema): Promise<NLSearchModelSchema>;
27155
+ delete(): Promise<NLSearchModelDeleteSchema>;
27156
+ private endpointPath;
27157
+ }
27158
+ //#endregion
27159
+ //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Client.d.ts
27160
+ declare class Client {
27161
+ configuration: Configuration;
27162
+ apiCall: ApiCall;
27163
+ debug: Debug;
27164
+ metrics: Metrics;
27165
+ stats: Metrics$1;
27166
+ health: Health;
27167
+ operations: Operations;
27168
+ multiSearch: MultiSearch;
27169
+ analytics: Analytics;
27170
+ stemming: Stemming;
27171
+ private readonly _collections;
27172
+ private readonly individualCollections;
27173
+ private readonly _aliases;
27174
+ private readonly individualAliases;
27175
+ private readonly _keys;
27176
+ private readonly individualKeys;
27177
+ private readonly _presets;
27178
+ private readonly individualPresets;
27179
+ private readonly _stopwords;
27180
+ private readonly individualStopwords;
27181
+ private readonly _conversations;
27182
+ private readonly individualConversations;
27183
+ private readonly _nlSearchModels;
27184
+ private readonly individualNLSearchModels;
27185
+ constructor(options: ConfigurationOptions);
27186
+ collections(): Collections;
27187
+ collections<T extends Record<string, any> = object>(collectionName: string): Collection<T>;
27188
+ aliases(): Aliases;
27189
+ aliases(aliasName: string): Alias;
27190
+ keys(): Keys$1;
27191
+ keys(id: number): Key$1;
27192
+ presets(): Presets;
27193
+ presets(id: string): Preset;
27194
+ stopwords(): Stopwords;
27195
+ stopwords(id: string): Stopword;
27196
+ conversations(): Conversations;
27197
+ conversations(id: string): Conversation;
27198
+ nlSearchModels(): NLSearchModels;
27199
+ nlSearchModels(id: string): NLSearchModel;
27200
+ }
27201
+ //#endregion
27202
+ //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/SearchOnlyCollection.d.ts
27203
+ declare class SearchOnlyCollection<T extends DocumentSchema> {
27204
+ private readonly name;
27294
27205
  private readonly apiCall;
27295
- constructor(apiCall: ApiCall);
27296
- create(params: ConversationModelCreateSchema): Promise<ConversationModelCreateSchema>;
27297
- retrieve(): Promise<ConversationModelSchema[]>;
27298
- private endpointPath;
27299
- static get RESOURCEPATH(): string;
27206
+ private readonly configuration;
27207
+ private readonly _documents;
27208
+ constructor(name: string, apiCall: ApiCall, configuration: any);
27209
+ documents(): SearchableDocuments<T>;
27300
27210
  }
27301
27211
  //#endregion
27302
- //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Conversation.d.ts
27303
- interface ConversationDeleteSchema {
27304
- id: number;
27212
+ //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/SearchClient.d.ts
27213
+ declare class SearchClient {
27214
+ readonly multiSearch: MultiSearch;
27215
+ private readonly configuration;
27216
+ private readonly apiCall;
27217
+ private readonly individualCollections;
27218
+ constructor(options: ConfigurationOptions);
27219
+ clearCache(): void;
27220
+ collections<TDocumentSchema extends DocumentSchema>(collectionName: string): SearchOnlyCollection<TDocumentSchema>;
27305
27221
  }
27306
- interface ConversationUpdateSchema {
27307
- ttl: number;
27222
+ //#endregion
27223
+ //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Errors/HTTPError.d.ts
27224
+ declare class HTTPError extends TypesenseError {}
27225
+ //#endregion
27226
+ //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Errors/MissingConfigurationError.d.ts
27227
+ declare class MissingConfigurationError extends TypesenseError {}
27228
+ //#endregion
27229
+ //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Errors/ObjectAlreadyExists.d.ts
27230
+ declare class ObjectAlreadyExists extends TypesenseError {}
27231
+ //#endregion
27232
+ //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Errors/ObjectNotFound.d.ts
27233
+ declare class ObjectNotFound extends TypesenseError {}
27234
+ //#endregion
27235
+ //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Errors/ObjectUnprocessable.d.ts
27236
+ declare class ObjectUnprocessable extends TypesenseError {}
27237
+ //#endregion
27238
+ //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Errors/RequestMalformed.d.ts
27239
+ declare class RequestMalformed extends TypesenseError {}
27240
+ //#endregion
27241
+ //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Errors/RequestUnauthorized.d.ts
27242
+ declare class RequestUnauthorized extends TypesenseError {}
27243
+ //#endregion
27244
+ //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Errors/ServerError.d.ts
27245
+ declare class ServerError extends TypesenseError {}
27246
+ //#endregion
27247
+ //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Errors/ImportError.d.ts
27248
+ interface ImportErrorPayload {
27249
+ documentsInJSONLFormat: string | ReadStream$1;
27250
+ options: DocumentImportParameters;
27251
+ failedItems: ImportResponse[];
27252
+ successCount: number;
27308
27253
  }
27309
- interface ConversationSchema {
27310
- id: number;
27311
- conversation: object[];
27312
- last_updated: number;
27313
- ttl: number;
27254
+ declare class ImportError extends TypesenseError {
27255
+ payload: ImportErrorPayload;
27256
+ importResults: ImportResponse[];
27257
+ constructor(message: string, importResults: ImportResponse[], payload: ImportErrorPayload);
27314
27258
  }
27315
- declare class Conversation {
27316
- private id;
27317
- private apiCall;
27318
- constructor(id: string, apiCall: ApiCall);
27319
- retrieve(): Promise<ConversationSchema[]>;
27320
- update(params: ConversationUpdateSchema): Promise<ConversationUpdateSchema>;
27321
- delete(): Promise<ConversationDeleteSchema>;
27322
- private endpointPath;
27259
+ declare namespace index_d_exports$1 {
27260
+ export { HTTPError, ImportError, MissingConfigurationError, ObjectAlreadyExists, ObjectNotFound, ObjectUnprocessable, RequestMalformed, RequestUnauthorized, ServerError, TypesenseError };
27323
27261
  }
27324
27262
  //#endregion
27325
- //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Conversations.d.ts
27326
- interface ConversationsRetrieveSchema {
27327
- conversations: ConversationSchema[];
27263
+ //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense.d.ts
27264
+ declare const _default: {
27265
+ Client: typeof Client;
27266
+ SearchClient: typeof SearchClient;
27267
+ Errors: typeof index_d_exports$1;
27268
+ };
27269
+ //#endregion
27270
+ //#region src/adapter/types.d.ts
27271
+ /**
27272
+ * All valid Typesense field types
27273
+ * @see https://typesense.org/docs/latest/api/collections.html#schema-parameters
27274
+ */
27275
+ type TypesenseFieldType = "string" | "int32" | "int64" | "float" | "bool" | "string[]" | "float[]" | "int32[]" | "int64[]" | "bool[]" | "object" | "object[]" | "geopoint" | "geopoint[]" | "auto";
27276
+ /**
27277
+ * Typesense-specific field mapping
27278
+ * Extends the base FieldMapping with Typesense-specific properties
27279
+ *
27280
+ * @example
27281
+ * ```typescript
27282
+ * const fields: TypesenseFieldMapping[] = [
27283
+ * { name: 'title', type: 'string', index: true },
27284
+ * { name: 'views', type: 'int64' },
27285
+ * { name: 'tags', type: 'string[]', facet: true },
27286
+ * { name: 'category', payloadField: 'category.name', type: 'string', facet: true },
27287
+ * ];
27288
+ * ```
27289
+ */
27290
+ interface TypesenseFieldMapping extends FieldMapping {
27291
+ /**
27292
+ * Typesense field type
27293
+ */
27294
+ type: TypesenseFieldType;
27295
+ /**
27296
+ * Whether the field should be faceted (filterable in Typesense UI)
27297
+ */
27298
+ facet?: boolean;
27299
+ /**
27300
+ * Whether the field should be indexed (searchable)
27301
+ * @default true
27302
+ */
27303
+ index?: boolean;
27304
+ /**
27305
+ * Whether the field is optional (can be missing from documents)
27306
+ */
27307
+ optional?: boolean;
27328
27308
  }
27329
- declare class Conversations {
27330
- private readonly apiCall;
27331
- private readonly _conversationsModels;
27332
- private readonly individualConversationModels;
27333
- constructor(apiCall: ApiCall);
27334
- retrieve(): Promise<ConversationsRetrieveSchema>;
27335
- models(): ConversationModels;
27336
- models(id: string): ConversationModel;
27337
- static get RESOURCEPATH(): string;
27309
+ /**
27310
+ * Typesense field schema for collection creation
27311
+ * Used internally when creating/updating collections
27312
+ */
27313
+ interface TypesenseFieldSchema {
27314
+ name: string;
27315
+ type: TypesenseFieldType;
27316
+ facet?: boolean;
27317
+ index?: boolean;
27318
+ optional?: boolean;
27319
+ /** Number of dimensions for vector fields (float[]) */
27320
+ vectorDimensions?: number;
27321
+ /** Allow additional properties for compatibility with BaseCollectionSchema */
27322
+ [key: string]: unknown;
27323
+ }
27324
+ /**
27325
+ * Typesense collection schema for creation/update
27326
+ * Extends BaseCollectionSchema with Typesense-specific options
27327
+ */
27328
+ interface TypesenseCollectionSchema extends BaseCollectionSchema {
27329
+ fields: TypesenseFieldSchema[];
27330
+ /** Default sorting field (must be a numeric field) */
27331
+ defaultSortingField?: string;
27338
27332
  }
27339
27333
  //#endregion
27340
- //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/StemmingDictionary.d.ts
27341
- interface StemmingDictionaryCreateSchema {
27342
- root: string;
27343
- word: string;
27334
+ //#region src/adapter/typesense-adapter.d.ts
27335
+ /**
27336
+ * Typesense implementation of the IndexerAdapter interface
27337
+ *
27338
+ * This adapter provides type-safe field definitions for Typesense.
27339
+ * When used with createIndexerPlugin, TypeScript will validate that
27340
+ * all field mappings in your collection config are valid TypesenseFieldMapping.
27341
+ *
27342
+ * @example
27343
+ * ```typescript
27344
+ * const adapter = createTypesenseAdapter(config);
27345
+ *
27346
+ * // TypeScript infers TFieldMapping = TypesenseFieldMapping
27347
+ * const { plugin } = createIndexerPlugin({
27348
+ * adapter,
27349
+ * collections: {
27350
+ * posts: [{
27351
+ * enabled: true,
27352
+ * fields: [
27353
+ * { name: 'title', type: 'string' }, // ✅ Valid
27354
+ * { name: 'views', type: 'int64' }, // ✅ Valid
27355
+ * { name: 'tags', type: 'string[]', facet: true }, // ✅ With faceting
27356
+ * ]
27357
+ * }]
27358
+ * }
27359
+ * });
27360
+ * ```
27361
+ */
27362
+ declare class TypesenseAdapter implements IndexerAdapter<TypesenseFieldMapping, TypesenseCollectionSchema> {
27363
+ private client;
27364
+ readonly name = "typesense";
27365
+ constructor(client: Client);
27366
+ /**
27367
+ * Test connection to Typesense
27368
+ */
27369
+ testConnection(): Promise<boolean>;
27370
+ /**
27371
+ * Create or update a collection schema
27372
+ */
27373
+ ensureCollection(schema: TypesenseCollectionSchema): Promise<void>;
27374
+ /**
27375
+ * Check if a collection exists
27376
+ */
27377
+ collectionExists(collectionName: string): Promise<boolean>;
27378
+ /**
27379
+ * Delete a collection
27380
+ */
27381
+ deleteCollection(collectionName: string): Promise<void>;
27382
+ /**
27383
+ * Upsert a single document
27384
+ */
27385
+ upsertDocument(collectionName: string, document: IndexDocument): Promise<void>;
27386
+ /**
27387
+ * Upsert multiple documents (batch)
27388
+ */
27389
+ upsertDocuments(collectionName: string, documents: IndexDocument[]): Promise<void>;
27390
+ /**
27391
+ * Delete a document by ID
27392
+ */
27393
+ deleteDocument(collectionName: string, documentId: string): Promise<void>;
27394
+ /**
27395
+ * Delete documents matching a filter
27396
+ * Returns the number of deleted documents
27397
+ */
27398
+ deleteDocumentsByFilter(collectionName: string, filter: Record<string, unknown>): Promise<number>;
27399
+ /**
27400
+ * Perform a vector search
27401
+ * @typeParam TDoc - The document type to return in results
27402
+ */
27403
+ vectorSearch<TDoc = Record<string, unknown>>(collectionName: string, vector: number[], options?: VectorSearchOptions): Promise<AdapterSearchResult<TDoc>[]>;
27404
+ /**
27405
+ * Convert generic schema to Typesense-specific schema
27406
+ */
27407
+ private convertToTypesenseSchema;
27408
+ /**
27409
+ * Convert a single field schema to Typesense format
27410
+ */
27411
+ private convertField;
27412
+ /**
27413
+ * Update collection with new fields if needed
27414
+ */
27415
+ private updateCollectionIfNeeded;
27416
+ /**
27417
+ * Build a Typesense filter string from a filter object
27418
+ */
27419
+ private buildFilterString;
27344
27420
  }
27345
- interface StemmingDictionarySchema {
27421
+ //#endregion
27422
+ //#region src/adapter/create-adapter.d.ts
27423
+ /**
27424
+ * Creates a TypesenseAdapter instance with the provided configuration
27425
+ *
27426
+ * @param config - Typesense connection configuration
27427
+ * @returns A configured TypesenseAdapter instance
27428
+ *
27429
+ * @example
27430
+ * ```typescript
27431
+ * import { createTypesenseAdapter } from '@nexo-labs/payload-typesense';
27432
+ *
27433
+ * const adapter = createTypesenseAdapter({
27434
+ * apiKey: process.env.TYPESENSE_API_KEY!,
27435
+ * nodes: [{
27436
+ * host: 'localhost',
27437
+ * port: 8108,
27438
+ * protocol: 'http'
27439
+ * }]
27440
+ * });
27441
+ * ```
27442
+ */
27443
+ declare function createTypesenseAdapter(config: TypesenseConnectionConfig): TypesenseAdapter;
27444
+ /**
27445
+ * Creates a TypesenseAdapter from an existing Typesense Client
27446
+ * Useful when you already have a configured client instance
27447
+ *
27448
+ * @param client - Existing Typesense Client instance
27449
+ * @returns A TypesenseAdapter instance wrapping the provided client
27450
+ */
27451
+ declare function createTypesenseAdapterFromClient(client: Client): TypesenseAdapter;
27452
+ //#endregion
27453
+ //#region src/shared/types/types.d.ts
27454
+ interface TypesenseDocument {
27346
27455
  id: string;
27347
- words: StemmingDictionaryCreateSchema[];
27348
- }
27349
- declare class StemmingDictionary {
27350
- private id;
27351
- private apiCall;
27352
- constructor(id: string, apiCall: ApiCall);
27353
- retrieve(): Promise<StemmingDictionarySchema>;
27354
- private endpointPath;
27456
+ slug?: string;
27457
+ title?: string;
27458
+ createdAt: number;
27459
+ updatedAt: number;
27460
+ embedding?: number[];
27461
+ [key: string]: unknown;
27355
27462
  }
27356
- //#endregion
27357
- //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/StemmingDictionaries.d.ts
27358
- interface StemmingDictionariesRetrieveSchema {
27359
- dictionaries: string[];
27463
+ interface TypesenseChunkDocument {
27464
+ id: string;
27465
+ parent_doc_id: string;
27466
+ slug: string;
27467
+ title: string;
27468
+ createdAt: number;
27469
+ publishedAt?: number;
27470
+ updatedAt: number;
27471
+ chunk_index: number;
27472
+ chunk_text: string;
27473
+ is_chunk: boolean;
27474
+ embedding: number[];
27360
27475
  }
27361
- declare class StemmingDictionaries {
27362
- private readonly apiCall;
27363
- constructor(apiCall: ApiCall);
27364
- upsert(id: string, wordRootCombinations: StemmingDictionaryCreateSchema[] | string): Promise<StemmingDictionaryCreateSchema[] | string>;
27365
- retrieve(): Promise<StemmingDictionariesRetrieveSchema>;
27366
- private endpointPath;
27367
- static get RESOURCEPATH(): string;
27476
+ interface SearchResult<T = TypesenseDocument> {
27477
+ collection?: string;
27478
+ content?: string;
27479
+ displayName?: string;
27480
+ document: T;
27481
+ highlight?: {
27482
+ [field: string]: {
27483
+ matched_tokens: string[];
27484
+ snippet: string;
27485
+ value: string;
27486
+ };
27487
+ };
27488
+ highlights?: Array<{
27489
+ field: string;
27490
+ matched_tokens: string[];
27491
+ snippet: string;
27492
+ value: string;
27493
+ }>;
27494
+ icon?: string;
27495
+ id: string;
27496
+ text_match?: number;
27497
+ text_match_info?: {
27498
+ best_field_score: string;
27499
+ best_field_weight: number;
27500
+ fields_matched: number;
27501
+ score: string;
27502
+ tokens_matched: number;
27503
+ };
27504
+ vector_distance?: number;
27505
+ title?: string;
27506
+ updatedAt?: string;
27368
27507
  }
27369
- //#endregion
27370
- //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Stemming.d.ts
27371
- declare class Stemming {
27372
- private readonly apiCall;
27373
- private readonly _stemmingDictionaries;
27374
- private readonly individualStemmingDictionaries;
27375
- constructor(apiCall: ApiCall);
27376
- dictionaries(): StemmingDictionaries;
27377
- dictionaries(id: string): StemmingDictionary;
27378
- static get RESOURCEPATH(): string;
27508
+ interface SearchResponse<T = TypesenseDocument> {
27509
+ collections?: Array<{
27510
+ collection: string;
27511
+ displayName: string;
27512
+ error?: string;
27513
+ found: number;
27514
+ icon: string;
27515
+ }>;
27516
+ found: number;
27517
+ hits: SearchResult<T>[];
27518
+ page: number;
27519
+ request_params: {
27520
+ page?: number;
27521
+ per_page: number;
27522
+ q: string;
27523
+ sort_by?: string;
27524
+ };
27525
+ search_cutoff: boolean;
27526
+ search_time_ms: number;
27379
27527
  }
27380
- //#endregion
27381
- //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/NLSearchModels.d.ts
27382
- interface NLSearchModelBase {
27383
- model_name: string;
27384
- api_key?: string;
27385
- api_url?: string;
27386
- max_bytes?: number;
27387
- temperature?: number;
27388
- system_prompt?: string;
27389
- top_p?: number;
27390
- top_k?: number;
27391
- stop_sequences?: string[];
27392
- api_version?: string;
27393
- project_id?: string;
27394
- access_token?: string;
27395
- refresh_token?: string;
27396
- client_id?: string;
27397
- client_secret?: string;
27398
- region?: string;
27399
- max_output_tokens?: number;
27400
- account_id?: string;
27528
+ interface SuggestResult<T = TypesenseDocument> {
27529
+ collection?: string;
27530
+ displayName?: string;
27531
+ document: T;
27532
+ highlight?: Record<string, string>;
27533
+ icon?: string;
27534
+ text_match?: number;
27401
27535
  }
27402
- interface NLSearchModelCreateSchema extends NLSearchModelBase {
27403
- id?: string;
27536
+ interface SuggestResponse<T = TypesenseDocument> {
27537
+ found: number;
27538
+ hits: SuggestResult<T>[];
27539
+ page: number;
27540
+ request_params: {
27541
+ per_page: number;
27542
+ q: string;
27543
+ };
27544
+ search_cutoff: boolean;
27545
+ search_time_ms: number;
27404
27546
  }
27405
- interface NLSearchModelSchema extends NLSearchModelBase {
27406
- id: string;
27547
+ interface SearchParams {
27548
+ facets?: string[];
27549
+ filters?: Record<string, unknown>;
27550
+ highlight_fields?: string[];
27551
+ num_typos?: number;
27552
+ page?: number;
27553
+ per_page?: number;
27554
+ q: string;
27555
+ snippet_threshold?: number;
27556
+ sort_by?: string;
27557
+ typo_tokens_threshold?: number;
27407
27558
  }
27408
- type NLSearchModelsRetrieveSchema = NLSearchModelSchema[];
27409
- declare class NLSearchModels {
27410
- private apiCall;
27411
- constructor(apiCall: ApiCall);
27412
- create(schema: NLSearchModelCreateSchema): Promise<NLSearchModelSchema>;
27413
- retrieve(): Promise<NLSearchModelsRetrieveSchema>;
27414
- private endpointPath;
27415
- static get RESOURCEPATH(): string;
27559
+ interface BaseSearchInputProps<T = TypesenseDocument> {
27560
+ baseUrl: string;
27561
+ className?: string;
27562
+ collection?: string;
27563
+ debounceMs?: number;
27564
+ errorClassName?: string;
27565
+ inputClassName?: string;
27566
+ inputWrapperClassName?: string;
27567
+ loadingClassName?: string;
27568
+ maxResults?: number;
27569
+ minQueryLength?: number;
27570
+ noResultsClassName?: string;
27571
+ onError?: (error: string) => void;
27572
+ onLoading?: (loading: boolean) => void;
27573
+ onResultClick?: (result: SearchResult<T>) => void;
27574
+ onResults?: (results: SearchResponse<T>) => void;
27575
+ onSearch?: (query: string, results: SearchResponse<T>) => void;
27576
+ placeholder?: string;
27577
+ resultsHeaderClassName?: string;
27578
+ resultsListClassName?: string;
27416
27579
  }
27417
- //#endregion
27418
- //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/NLSearchModel.d.ts
27419
- type NLSearchModelUpdateSchema = NLSearchModelBase;
27420
- interface NLSearchModelDeleteSchema {
27421
- id: string;
27580
+ interface CacheEntry<T = unknown> {
27581
+ data: T;
27582
+ timestamp: number;
27583
+ ttl: number;
27422
27584
  }
27423
- declare class NLSearchModel {
27424
- private id;
27425
- private apiCall;
27426
- constructor(id: string, apiCall: ApiCall);
27427
- retrieve(): Promise<NLSearchModelSchema>;
27428
- update(schema: NLSearchModelUpdateSchema): Promise<NLSearchModelSchema>;
27429
- delete(): Promise<NLSearchModelDeleteSchema>;
27430
- private endpointPath;
27585
+ interface CacheOptions$1 {
27586
+ maxSize?: number;
27587
+ ttl?: number;
27431
27588
  }
27432
- //#endregion
27433
- //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Client.d.ts
27434
- declare class Client {
27435
- configuration: Configuration;
27436
- apiCall: ApiCall;
27437
- debug: Debug;
27438
- metrics: Metrics;
27439
- stats: Metrics$1;
27440
- health: Health;
27441
- operations: Operations;
27442
- multiSearch: MultiSearch;
27443
- analytics: Analytics;
27444
- stemming: Stemming;
27445
- private readonly _collections;
27446
- private readonly individualCollections;
27447
- private readonly _aliases;
27448
- private readonly individualAliases;
27449
- private readonly _keys;
27450
- private readonly individualKeys;
27451
- private readonly _presets;
27452
- private readonly individualPresets;
27453
- private readonly _stopwords;
27454
- private readonly individualStopwords;
27455
- private readonly _conversations;
27456
- private readonly individualConversations;
27457
- private readonly _nlSearchModels;
27458
- private readonly individualNLSearchModels;
27459
- constructor(options: ConfigurationOptions);
27460
- collections(): Collections;
27461
- collections<T extends Record<string, any> = object>(collectionName: string): Collection<T>;
27462
- aliases(): Aliases;
27463
- aliases(aliasName: string): Alias;
27464
- keys(): Keys$1;
27465
- keys(id: number): Key$1;
27466
- presets(): Presets;
27467
- presets(id: string): Preset;
27468
- stopwords(): Stopwords;
27469
- stopwords(id: string): Stopword;
27470
- conversations(): Conversations;
27471
- conversations(id: string): Conversation;
27472
- nlSearchModels(): NLSearchModels;
27473
- nlSearchModels(id: string): NLSearchModel;
27589
+ interface HealthCheckResponse {
27590
+ cache?: {
27591
+ maxSize: number;
27592
+ size: number;
27593
+ };
27594
+ collections?: string[];
27595
+ error?: string;
27596
+ lastSync?: number;
27597
+ status: 'healthy' | 'unhealthy';
27598
+ typesense?: {
27599
+ ok: boolean;
27600
+ version?: string;
27601
+ };
27474
27602
  }
27475
- //#endregion
27476
- //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/SearchOnlyCollection.d.ts
27477
- declare class SearchOnlyCollection<T extends DocumentSchema> {
27478
- private readonly name;
27479
- private readonly apiCall;
27480
- private readonly configuration;
27481
- private readonly _documents;
27482
- constructor(name: string, apiCall: ApiCall, configuration: any);
27483
- documents(): SearchableDocuments<T>;
27603
+ interface ErrorResponse {
27604
+ code?: string;
27605
+ details?: string;
27606
+ error: string;
27607
+ timestamp?: string;
27484
27608
  }
27485
- //#endregion
27486
- //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/SearchClient.d.ts
27487
- declare class SearchClient {
27488
- readonly multiSearch: MultiSearch;
27489
- private readonly configuration;
27490
- private readonly apiCall;
27491
- private readonly individualCollections;
27492
- constructor(options: ConfigurationOptions);
27493
- clearCache(): void;
27494
- collections<TDocumentSchema extends DocumentSchema>(collectionName: string): SearchOnlyCollection<TDocumentSchema>;
27609
+ interface ApiResponse<T = unknown> {
27610
+ data?: T;
27611
+ error?: ErrorResponse;
27612
+ meta?: {
27613
+ cached?: boolean;
27614
+ requestId?: string;
27615
+ timestamp: string;
27616
+ };
27617
+ success: boolean;
27495
27618
  }
27496
27619
  //#endregion
27497
- //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Errors/HTTPError.d.ts
27498
- declare class HTTPError extends TypesenseError {}
27499
- //#endregion
27500
- //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Errors/MissingConfigurationError.d.ts
27501
- declare class MissingConfigurationError extends TypesenseError {}
27502
- //#endregion
27503
- //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Errors/ObjectAlreadyExists.d.ts
27504
- declare class ObjectAlreadyExists extends TypesenseError {}
27505
- //#endregion
27506
- //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Errors/ObjectNotFound.d.ts
27507
- declare class ObjectNotFound extends TypesenseError {}
27508
- //#endregion
27509
- //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Errors/ObjectUnprocessable.d.ts
27510
- declare class ObjectUnprocessable extends TypesenseError {}
27511
- //#endregion
27512
- //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Errors/RequestMalformed.d.ts
27513
- declare class RequestMalformed extends TypesenseError {}
27514
- //#endregion
27515
- //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Errors/RequestUnauthorized.d.ts
27516
- declare class RequestUnauthorized extends TypesenseError {}
27517
- //#endregion
27518
- //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Errors/ServerError.d.ts
27519
- declare class ServerError extends TypesenseError {}
27520
- //#endregion
27521
- //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense/Errors/ImportError.d.ts
27522
- interface ImportErrorPayload {
27523
- documentsInJSONLFormat: string | ReadStream$1;
27524
- options: DocumentImportParameters;
27525
- failedItems: ImportResponse[];
27526
- successCount: number;
27620
+ //#region src/features/embedding/embeddings.d.ts
27621
+ /**
27622
+ * Generates an embedding for the given text using OpenAI or Gemini API
27623
+ * @param text - The text to generate an embedding for
27624
+ * @param config - Optional embedding configuration (provider, model, dimensions, apiKey)
27625
+ * @returns The embedding vector as an array of numbers, or null if generation fails
27626
+ */
27627
+ declare const generateEmbedding: (text: string, config?: EmbeddingProviderConfig$1) => Promise<number[] | null>;
27628
+ /**
27629
+ * Generate embedding with usage tracking
27630
+ *
27631
+ * This function returns both the embedding and usage information (tokens used)
27632
+ *
27633
+ * @param text - The text to generate an embedding for
27634
+ * @param config - Optional embedding configuration
27635
+ * @returns Embedding with usage information, or null if generation fails
27636
+ */
27637
+ declare const generateEmbeddingWithUsage: (text: string, config?: EmbeddingProviderConfig$1) => Promise<EmbeddingWithUsage | null>;
27638
+ /**
27639
+ * Generate embeddings for multiple texts with usage tracking (batch)
27640
+ *
27641
+ * @param texts - Array of texts to generate embeddings for
27642
+ * @param config - Optional embedding configuration
27643
+ * @returns Embeddings with total usage information, or null if generation fails
27644
+ */
27645
+ declare const generateEmbeddingsBatchWithUsage: (texts: string[], config?: EmbeddingProviderConfig$1) => Promise<BatchEmbeddingWithUsage | null>;
27646
+ //#endregion
27647
+ //#region src/features/rag/query-builder.d.ts
27648
+ /**
27649
+ * Typesense search request object
27650
+ */
27651
+ interface TypesenseSearchRequest {
27652
+ collection: string;
27653
+ query_by: string;
27654
+ vector_query: string;
27655
+ exclude_fields: string;
27656
+ filter_by?: string;
27657
+ typo_tokens_threshold?: number;
27658
+ num_typos?: number;
27659
+ prefix?: boolean;
27660
+ drop_tokens_threshold?: number;
27661
+ enable_stemming?: boolean;
27527
27662
  }
27528
- declare class ImportError extends TypesenseError {
27529
- payload: ImportErrorPayload;
27530
- importResults: ImportResponse[];
27531
- constructor(message: string, importResults: ImportResponse[], payload: ImportErrorPayload);
27663
+ /**
27664
+ * Build the Typesense conversational search URL with all necessary parameters
27665
+ *
27666
+ * @param config - Query configuration
27667
+ * @param config.userMessage - The user's message/query
27668
+ * @param config.chatId - Optional conversation ID for follow-up questions
27669
+ * @param conversationModelId - The conversation model ID in Typesense
27670
+ * @param typesenseConfig - Typesense connection config
27671
+ * @returns URL for the Typesense multi_search endpoint with conversation parameters
27672
+ */
27673
+ declare function buildConversationalUrl(config: {
27674
+ userMessage: string;
27675
+ chatId?: string;
27676
+ }, conversationModelId: string, typesenseConfig: TypesenseConnectionConfig): URL;
27677
+ /**
27678
+ * Build multi-search requests for Typesense with hybrid search configuration
27679
+ *
27680
+ * @param config - Query configuration including embedding, collections, and filters
27681
+ * @returns Array of search requests for Typesense multi_search
27682
+ */
27683
+ declare function buildMultiSearchRequests(config: TypesenseQueryConfig): TypesenseSearchRequest[];
27684
+ /**
27685
+ * Build the complete Typesense request body for multi-search
27686
+ *
27687
+ * @param config - Query configuration
27688
+ * @returns Request body for Typesense multi_search endpoint
27689
+ */
27690
+ declare function buildMultiSearchRequestBody(config: TypesenseQueryConfig): {
27691
+ searches: TypesenseSearchRequest[];
27692
+ };
27693
+ /**
27694
+ * Build hybrid search parameters for combining semantic and keyword search
27695
+ *
27696
+ * @param alpha - Weight between semantic (1.0) and keyword (0.0) search
27697
+ * @param rerankMatches - Whether to rerank hybrid search results
27698
+ * @param queryFields - Fields to use for keyword search
27699
+ * @returns Object with hybrid search parameters
27700
+ */
27701
+ declare function buildHybridSearchParams(alpha?: number, rerankMatches?: boolean, queryFields?: string): {
27702
+ alpha: number;
27703
+ rerank_hybrid_matches: boolean;
27704
+ query_fields: string;
27705
+ };
27706
+ //#endregion
27707
+ //#region src/features/rag/stream-handler.d.ts
27708
+ /**
27709
+ * Parsed conversation event from Typesense SSE stream
27710
+ */
27711
+ interface ConversationEvent {
27712
+ /** Conversation ID */
27713
+ conversationId?: string;
27714
+ /** Message token/chunk */
27715
+ message?: string;
27716
+ /** Search results (only in first event) */
27717
+ results?: TypesenseRAGSearchResult[];
27718
+ /** Raw parsed data */
27719
+ raw?: unknown;
27532
27720
  }
27533
- declare namespace index_d_exports {
27534
- export { HTTPError, ImportError, MissingConfigurationError, ObjectAlreadyExists, ObjectNotFound, ObjectUnprocessable, RequestMalformed, RequestUnauthorized, ServerError, TypesenseError };
27721
+ /**
27722
+ * Stream processing result
27723
+ */
27724
+ interface StreamProcessingResult {
27725
+ /** Full assistant message */
27726
+ fullMessage: string;
27727
+ /** Conversation ID */
27728
+ conversationId: string | null;
27729
+ /** Extracted sources */
27730
+ sources: ChunkSource[];
27731
+ /** Context text (for token estimation) */
27732
+ contextText: string;
27535
27733
  }
27536
- //#endregion
27537
- //#region ../../node_modules/.pnpm/typesense@2.1.0_@babel+runtime@7.27.0/node_modules/typesense/lib/Typesense.d.ts
27538
- declare const _default: {
27539
- Client: typeof Client;
27540
- SearchClient: typeof SearchClient;
27541
- Errors: typeof index_d_exports;
27542
- };
27734
+ /**
27735
+ * Parse a single SSE event from Typesense conversation stream
27736
+ *
27737
+ * @param line - Raw SSE event line
27738
+ * @returns Parsed conversation event or null if not parseable
27739
+ */
27740
+ declare function parseConversationEvent(line: string): ConversationEvent | null;
27741
+ /**
27742
+ * Extract sources from Typesense search results
27743
+ *
27744
+ * @param results - Typesense multi-search results array
27745
+ * @param documentTypeResolver - Optional function to resolve document type from collection name
27746
+ * @returns Array of chunk sources with metadata
27747
+ */
27748
+ declare function extractSourcesFromResults(results: TypesenseRAGSearchResult[], documentTypeResolver?: (collectionName: string) => string): ChunkSource[];
27749
+ /**
27750
+ * Build context text from results (useful for token estimation)
27751
+ *
27752
+ * @param results - Typesense multi-search results array
27753
+ * @returns Combined context text from all chunks
27754
+ */
27755
+ declare function buildContextText(results: TypesenseRAGSearchResult[]): string;
27756
+ /**
27757
+ * Process a Typesense conversation stream
27758
+ *
27759
+ * @param response - Fetch Response with SSE stream
27760
+ * @param onEvent - Callback for each parsed event
27761
+ * @param documentTypeResolver - Optional function to resolve document type
27762
+ * @returns Processing result with full message, ID, and sources
27763
+ */
27764
+ declare function processConversationStream(response: Response, onEvent?: (event: ConversationEvent) => void, documentTypeResolver?: (collectionName: string) => string): Promise<StreamProcessingResult>;
27765
+ /**
27766
+ * Create a ReadableStream that forwards SSE events
27767
+ *
27768
+ * @param response - Fetch Response with SSE stream
27769
+ * @param onData - Callback for processing each event before forwarding
27770
+ * @returns ReadableStream for SSE events
27771
+ */
27772
+ declare function createSSEForwardStream(response: Response, onData?: (event: ConversationEvent) => void): ReadableStream<Uint8Array>;
27543
27773
  //#endregion
27544
27774
  //#region src/features/rag/setup.d.ts
27545
27775
  /**
@@ -27785,81 +28015,38 @@ type AuthenticateMethod = (options?: {
27785
28015
  */
27786
28016
  declare const jsonResponse: (data: any, options?: ResponseInit) => Response;
27787
28017
  //#endregion
28018
+ //#region src/core/config/types.d.ts
28019
+ type SearchMode = "semantic" | "keyword" | "hybrid";
28020
+ interface SearchDefaults {
28021
+ mode?: SearchMode;
28022
+ perPage?: number;
28023
+ tables?: string[];
28024
+ }
28025
+ interface SearchFeatureConfig {
28026
+ enabled: boolean;
28027
+ defaults?: SearchDefaults;
28028
+ }
28029
+ interface SyncFeatureConfig {
28030
+ enabled: boolean;
28031
+ autoSync?: boolean;
28032
+ batchSize?: number;
28033
+ }
28034
+ interface FeatureFlags {
28035
+ embedding?: EmbeddingProviderConfig$1;
28036
+ search?: SearchFeatureConfig;
28037
+ rag?: RAGFeatureConfig;
28038
+ sync?: SyncFeatureConfig;
28039
+ }
28040
+ interface ModularPluginConfig {
28041
+ typesense: TypesenseConnectionConfig;
28042
+ features: FeatureFlags;
28043
+ collections: Record<CollectionSlug | string, TableConfig[]>;
28044
+ }
28045
+ //#endregion
27788
28046
  //#region src/core/client/typesense-client.d.ts
27789
28047
  declare const createTypesenseClient: (typesenseConfig: TypesenseConnectionConfig) => _default.Client;
27790
28048
  declare const testTypesenseConnection: (client: Client) => Promise<boolean>;
27791
28049
  //#endregion
27792
- //#region src/core/utils/chunk-format-utils.d.ts
27793
- /**
27794
- * Utilities for formatting chunk text with header metadata
27795
- */
27796
- /**
27797
- * Separator used between chunk content and header metadata
27798
- */
27799
- declare const CHUNK_HEADER_SEPARATOR = ".________________________________________.";
27800
- /**
27801
- * Header metadata structure embedded in chunk_text
27802
- */
27803
- interface ChunkHeaderMetadata {
27804
- /** Current section (last header in hierarchy) */
27805
- section: string;
27806
- /** Full hierarchical path */
27807
- path: string;
27808
- }
27809
- /**
27810
- * Parsed chunk with separated headers and content
27811
- */
27812
- interface ParsedChunk {
27813
- /** Header metadata (if present) */
27814
- metadata?: ChunkHeaderMetadata;
27815
- /** The actual chunk content */
27816
- content: string;
27817
- }
27818
- /**
27819
- * Formats chunk text with header metadata at the end
27820
- *
27821
- * @param content - The chunk content
27822
- * @param headers - Hierarchical array of headers (e.g., ['Introduction', 'Introduction > Getting Started'])
27823
- * @returns Formatted chunk text with content + separator + key-value metadata
27824
- *
27825
- * @example
27826
- * const formatted = formatChunkWithHeaders(
27827
- * 'To install the package...',
27828
- * ['Introduction', 'Introduction > Getting Started', 'Introduction > Getting Started > Installation']
27829
- * );
27830
- * // Result:
27831
- * // To install the package...
27832
- * // ._________________________________________.
27833
- * // section: Installation | path: Introduction > Getting Started > Installation
27834
- */
27835
- declare const formatChunkWithHeaders: (content: string, headers: string[]) => string;
27836
- /**
27837
- * Parses chunk text to extract header metadata and content separately
27838
- *
27839
- * @param chunkText - The formatted chunk text
27840
- * @returns Object with separated metadata and content
27841
- *
27842
- * @example
27843
- * const parsed = parseChunkText('Content here\\n._________________________________________.\\nsection: Installation | path: Introduction > Getting Started > Installation');
27844
- * console.log(parsed.metadata.section); // "Installation"
27845
- * console.log(parsed.content); // "Content here"
27846
- */
27847
- declare const parseChunkText: (chunkText: string) => ParsedChunk;
27848
- /**
27849
- * Extracts only the content from a formatted chunk (removes header metadata)
27850
- *
27851
- * @param chunkText - The formatted chunk text
27852
- * @returns Just the content without header metadata
27853
- */
27854
- declare const extractContentOnly: (chunkText: string) => string;
27855
- /**
27856
- * Extracts only the header metadata from a formatted chunk
27857
- *
27858
- * @param chunkText - The formatted chunk text
27859
- * @returns Header metadata or undefined if not present
27860
- */
27861
- declare const extractHeaderMetadata: (chunkText: string) => ChunkHeaderMetadata | undefined;
27862
- //#endregion
27863
28050
  //#region src/features/sync/services/document-delete.d.ts
27864
28051
  /**
27865
28052
  * Deletes a document from Typesense
@@ -27867,153 +28054,26 @@ declare const extractHeaderMetadata: (chunkText: string) => ChunkHeaderMetadata
27867
28054
  */
27868
28055
  declare const deleteDocumentFromTypesense: (typesenseClient: Client, collectionSlug: string, docId: string, tableConfig: TableConfig) => Promise<void>;
27869
28056
  //#endregion
27870
- //#region ../../node_modules/.pnpm/lexical@0.35.0/node_modules/lexical/nodes/LexicalElementNode.d.ts
27871
- type SerializedElementNode<T extends SerializedLexicalNode = SerializedLexicalNode> = Spread<{
27872
- children: Array<T>;
27873
- direction: 'ltr' | 'rtl' | null;
27874
- format: ElementFormatType;
27875
- indent: number;
27876
- textFormat?: number;
27877
- textStyle?: string;
27878
- }, SerializedLexicalNode>;
27879
- type ElementFormatType = 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
27880
- //#endregion
27881
- //#region ../../node_modules/.pnpm/lexical@0.35.0/node_modules/lexical/nodes/LexicalRootNode.d.ts
27882
- type SerializedRootNode<T extends SerializedLexicalNode = SerializedLexicalNode> = SerializedElementNode<T>;
27883
- //#endregion
27884
- //#region ../../node_modules/.pnpm/lexical@0.35.0/node_modules/lexical/LexicalEditorState.d.ts
27885
- interface SerializedEditorState<T extends SerializedLexicalNode = SerializedLexicalNode> {
27886
- root: SerializedRootNode<T>;
27887
- }
27888
- //#endregion
27889
- //#region ../../node_modules/.pnpm/lexical@0.35.0/node_modules/lexical/LexicalConstants.d.ts
27890
- declare const NODE_STATE_KEY = "$";
27891
- //#endregion
27892
- //#region ../../node_modules/.pnpm/lexical@0.35.0/node_modules/lexical/LexicalEditor.d.ts
27893
- type Spread<T1, T2> = Omit<T2, keyof T1> & T1;
27894
- //#endregion
27895
- //#region ../../node_modules/.pnpm/lexical@0.35.0/node_modules/lexical/LexicalNode.d.ts
27896
- /**
27897
- * The base type for all serialized nodes
27898
- */
27899
- type SerializedLexicalNode = {
27900
- /** The type string used by the Node class */
27901
- type: string;
27902
- /** A numeric version for this schema, defaulting to 1, but not generally recommended for use */
27903
- version: number;
27904
- /**
27905
- * Any state persisted with the NodeState API that is not
27906
- * configured for flat storage
27907
- */
27908
- [NODE_STATE_KEY]?: Record<string, unknown>;
27909
- };
27910
- //#endregion
27911
- //#region src/core/utils/transforms.d.ts
27912
- /**
27913
- * Transforms Lexical editor state to Markdown
27914
- * @param value - The serialized editor state
27915
- * @param config - Optional Payload config. If provided, it will be used to generate the editor config.
27916
- */
27917
- declare const transformLexicalToMarkdown: (value?: SerializedEditorState | null, config?: SanitizedConfig) => Promise<string>;
28057
+ //#region src/features/search/endpoints.d.ts
28058
+ declare const createSearchEndpoints: (typesenseClient: Client, pluginOptions: ModularPluginConfig) => {
28059
+ handler: PayloadHandler;
28060
+ method: "get";
28061
+ path: string;
28062
+ }[];
27918
28063
  //#endregion
27919
- //#region src/core/logging/logger.d.ts
27920
- /**
27921
- * Professional logging system for payload-typesense
27922
- * Provides structured logging with levels and context
27923
- */
27924
- type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'silent';
27925
- interface LogContext {
27926
- [key: string]: unknown;
27927
- }
27928
- interface LoggerConfig {
27929
- /** Minimum log level to output (default: 'info') */
27930
- level?: LogLevel;
27931
- /** Prefix for all log messages (default: '[payload-typesense]') */
27932
- prefix?: string;
27933
- /** Enable/disable logging (default: true) */
27934
- enabled?: boolean;
27935
- }
27936
- declare class Logger {
27937
- private level;
27938
- private prefix;
27939
- private enabled;
27940
- constructor(config?: LoggerConfig);
27941
- /**
27942
- * Update logger configuration
27943
- */
27944
- configure(config: Partial<LoggerConfig>): void;
27945
- /**
27946
- * Check if a log level should be output
27947
- */
27948
- private shouldLog;
27949
- /**
27950
- * Format log message with context
27951
- */
27952
- private formatMessage;
27953
- /**
27954
- * Debug level logging - detailed information for debugging
27955
- */
27956
- debug(message: string, context?: LogContext): void;
27957
- /**
27958
- * Info level logging - general informational messages
27959
- */
27960
- info(message: string, context?: LogContext): void;
27961
- /**
27962
- * Warning level logging - warning messages
27963
- */
27964
- warn(message: string, context?: LogContext): void;
27965
- /**
27966
- * Error level logging - error messages
27967
- */
27968
- error(message: string, error?: Error | unknown, context?: LogContext): void;
27969
- /**
27970
- * Get current log level
27971
- */
27972
- getLevel(): LogLevel;
27973
- /**
27974
- * Check if logger is enabled
27975
- */
27976
- isEnabled(): boolean;
27977
- }
27978
- /**
27979
- * Configure the default logger
27980
- */
27981
- declare const configureLogger: (config: LoggerConfig) => void;
28064
+ //#region src/features/rag/endpoints.d.ts
27982
28065
  /**
27983
- * Create a new logger instance with custom configuration
28066
+ * Creates Payload handlers for RAG endpoints
28067
+ *
28068
+ * @param config - RAG plugin configuration (composable, doesn't depend on ModularPluginConfig)
27984
28069
  */
27985
- declare const createLogger: (config?: LoggerConfig) => Logger;
27986
- declare const logger: {
27987
- debug: (message: string, context?: LogContext) => void;
27988
- info: (message: string, context?: LogContext) => void;
27989
- warn: (message: string, context?: LogContext) => void;
27990
- error: (message: string, error?: Error | unknown, context?: LogContext) => void;
27991
- configure: (config: LoggerConfig) => void;
27992
- getLevel: () => LogLevel;
27993
- isEnabled: () => boolean;
27994
- };
28070
+ declare function createRAGPayloadHandlers(config: TypesenseRAGPluginConfig): Array<{
28071
+ path: string;
28072
+ method: 'connect' | 'delete' | 'get' | 'head' | 'options' | 'patch' | 'post' | 'put';
28073
+ handler: PayloadHandler;
28074
+ }>;
27995
28075
  //#endregion
27996
28076
  //#region src/core/config/constants.d.ts
27997
- /**
27998
- * Constants for payload-typesense plugin
27999
- * Centralizes all magic numbers and configuration defaults
28000
- */
28001
- /**
28002
- * Default dimensions for OpenAI text-embedding-3-large model
28003
- */
28004
- declare const DEFAULT_EMBEDDING_DIMENSIONS = 3072;
28005
- /**
28006
- * Default OpenAI embedding model
28007
- */
28008
- declare const DEFAULT_EMBEDDING_MODEL = "text-embedding-3-large";
28009
- /**
28010
- * Default chunk size for text splitting (in characters)
28011
- */
28012
- declare const DEFAULT_CHUNK_SIZE = 1000;
28013
- /**
28014
- * Default overlap between chunks (in characters)
28015
- */
28016
- declare const DEFAULT_CHUNK_OVERLAP = 200;
28017
28077
  /**
28018
28078
  * Default alpha value for hybrid search (0 = pure semantic, 1 = pure keyword)
28019
28079
  */
@@ -28042,31 +28102,6 @@ declare const DEFAULT_SESSION_TTL_SEC: number;
28042
28102
  * Default OpenAI model for RAG chat
28043
28103
  */
28044
28104
  declare const DEFAULT_RAG_LLM_MODEL = "gpt-4o-mini";
28045
- /**
28046
- * Error codes for structured error handling
28047
- */
28048
- declare const ErrorCodes: {
28049
- readonly INVALID_CONFIG: "ERR_1001";
28050
- readonly MISSING_API_KEY: "ERR_1002";
28051
- readonly INVALID_EMBEDDING_CONFIG: "ERR_1003";
28052
- readonly INVALID_RAG_CONFIG: "ERR_1004";
28053
- readonly TYPESENSE_CONNECTION_FAILED: "ERR_2001";
28054
- readonly TYPESENSE_COLLECTION_NOT_FOUND: "ERR_2002";
28055
- readonly TYPESENSE_SEARCH_FAILED: "ERR_2003";
28056
- readonly TYPESENSE_SYNC_FAILED: "ERR_2004";
28057
- readonly TYPESENSE_DELETE_FAILED: "ERR_2005";
28058
- readonly EMBEDDING_GENERATION_FAILED: "ERR_3001";
28059
- readonly INVALID_EMBEDDING_DIMENSIONS: "ERR_3002";
28060
- readonly OPENAI_API_ERROR: "ERR_3003";
28061
- readonly RAG_SEARCH_FAILED: "ERR_4001";
28062
- readonly RAG_SESSION_NOT_FOUND: "ERR_4002";
28063
- readonly RAG_CONVERSATION_FAILED: "ERR_4003";
28064
- readonly RAG_TOKEN_LIMIT_EXCEEDED: "ERR_4004";
28065
- readonly CHUNKING_FAILED: "ERR_5001";
28066
- readonly INVALID_CHUNK_SIZE: "ERR_5002";
28067
- readonly UNKNOWN_ERROR: "ERR_9001";
28068
- readonly VALIDATION_ERROR: "ERR_9002";
28069
- };
28070
- //#endregion
28071
- export { type ApiContext, type ApiResponse, type AuthenticateMethod, type BaseDocument, type BaseSearchInputProps, CHUNK_HEADER_SEPARATOR, type CacheEntry, type CacheOptions$1 as CacheOptions, type ChatMessageWithSources, type ChatSessionData, type ChunkFetchConfig, type ChunkFetchResult, type ChunkHeaderMetadata, type CollectionConfig, type ConversationEvent, DEFAULT_CACHE_TTL_MS, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_EMBEDDING_DIMENSIONS, DEFAULT_EMBEDDING_MODEL, DEFAULT_HYBRID_SEARCH_ALPHA, DEFAULT_RAG_CONTEXT_LIMIT, DEFAULT_RAG_LLM_MODEL, DEFAULT_RAG_MAX_TOKENS, DEFAULT_SEARCH_LIMIT, DEFAULT_SESSION_TTL_SEC, ErrorCodes, type ErrorResponse, type FieldMapping, type HealthCheckResponse, type ModularPluginConfig, type ParsedChunk, type PayloadDocument, type RAGChatRequest, type RAGSearchConfig, type RAGSearchResult, type SearchFeatureConfig, type SearchParams, type SearchResponse, type SearchResult, type SessionConfig, type SourceField, type StreamProcessingResult, type SuggestResponse, type SuggestResult, type SyncFeatureConfig, type TableConfig, type TypesenseChunkDocument, type TypesenseConnectionConfig, type TypesenseDocument, buildContextText, buildConversationalUrl, buildHybridSearchParams, buildMultiSearchRequestBody, buildMultiSearchRequests, closeSession, configureLogger, createLogger, createSSEForwardStream, createTypesenseClient, deleteDocumentFromTypesense, ensureConversationCollection, executeRAGSearch, extractContentOnly, extractHeaderMetadata, extractSourcesFromResults, fetchChunkById, formatChunkWithHeaders, formatSSEEvent, generateEmbedding, generateEmbeddingWithUsage, generateEmbeddingsBatchWithUsage, getActiveSession, getDefaultRAGConfig, getSessionByConversationId, jsonResponse, logger, mergeRAGConfigWithDefaults, parseChunkText, parseConversationEvent, processConversationStream, saveChatSession, sendSSEEvent, testTypesenseConnection, transformLexicalToMarkdown, typesenseSearch };
28105
+ //#endregion
28106
+ export { type ApiContext, type ApiResponse, type AuthenticateMethod, type BaseDocument, type BaseSearchInputProps, type CacheEntry, type CacheOptions$1 as CacheOptions, type ChatMessageWithSources, type ChatSessionData, type ChunkFetchConfig, type ChunkFetchResult, type ConversationEvent, DEFAULT_CACHE_TTL_MS, DEFAULT_HYBRID_SEARCH_ALPHA, DEFAULT_RAG_CONTEXT_LIMIT, DEFAULT_RAG_LLM_MODEL, DEFAULT_RAG_MAX_TOKENS, DEFAULT_SEARCH_LIMIT, DEFAULT_SESSION_TTL_SEC, type ErrorResponse, type HealthCheckResponse, type PayloadDocument, type RAGChatRequest, type RAGSearchConfig, type RAGSearchResult, type SearchFeatureConfig, type SearchParams, type SearchResponse, type SearchResult, type SessionConfig, type StreamProcessingResult, type SuggestResponse, type SuggestResult, type SyncFeatureConfig, TypesenseAdapter, type TypesenseChunkDocument, type TypesenseConnectionConfig, type TypesenseDocument, type TypesenseFieldMapping, type TypesenseFieldType, type TypesenseRAGPluginConfig, type TypesenseSearchConfig, buildContextText, buildConversationalUrl, buildHybridSearchParams, buildMultiSearchRequestBody, buildMultiSearchRequests, closeSession, createRAGPayloadHandlers, createSSEForwardStream, createSearchEndpoints, createTypesenseAdapter, createTypesenseAdapterFromClient, createTypesenseClient, createTypesenseRAGPlugin, deleteDocumentFromTypesense, ensureConversationCollection, executeRAGSearch, extractSourcesFromResults, fetchChunkById, formatSSEEvent, generateEmbedding, generateEmbeddingWithUsage, generateEmbeddingsBatchWithUsage, getActiveSession, getDefaultRAGConfig, getSessionByConversationId, jsonResponse, mergeRAGConfigWithDefaults, parseConversationEvent, processConversationStream, saveChatSession, sendSSEEvent, testTypesenseConnection };
28072
28107
  //# sourceMappingURL=index.d.mts.map